4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2009 QLogic Corporation. All rights reserved.
24 * Use is subject to license terms.
28 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
34 #include <sys/stmf_defines.h>
43 #define REG_FLASH_ADDR 0x00
44 #define REG_FLASH_DATA 0x04
45 #define REG_CTRL_STATUS 0x08
46 #define REG_INTR_CTRL 0x0C
47 #define REG_INTR_STATUS 0x10
48 #define REG_REQ_IN_PTR 0x1C
49 #define REG_REQ_OUT_PTR 0x20
50 #define REG_RESP_IN_PTR 0x24
51 #define REG_RESP_OUT_PTR 0x28
52 #define REG_PREQ_IN_PTR 0x2C
53 #define REG_PREQ_OUT_PTR 0x30
54 #define REG_ATIO_IN_PTR 0x3C
55 #define REG_ATIO_OUT_PTR 0x40
56 #define REG_RISC_STATUS 0x44
58 #define REG_GPIO_DATA 0x4C
59 #define REG_GPIO_ENABLE 0x50
60 #define REG_IOBUS_BASE_ADDR 0x54
61 #define REG_HOST_SEMA 0x58
62 #define REG_MBOX0 0x80
64 #define REG_MBOX(n) (REG_MBOX0 + (n << 1))
69 * Ctrl Status register definitions
71 #define FLASH_ERROR BIT_18
72 #define DMA_ACTIVE_STATUS BIT_17
73 #define DMA_SHUTDOWN_CTRL BIT_16
74 #define FUNCTION_NUMBER BIT_15
76 * #define 81XX_FUNCTION_NUMBER BIT_15 | BIT_14 | BIT_13 | BIT_12
78 #define PCI_X_BUS_MODE (BIT_8 | BIT_9 | BIT_10 | BIT_11)
79 #define PCI_X_XFER_CTRL (BIT_4 | BIT_5)
80 #define PCI_64_BIT_SLOT BIT_2
81 #define FLASH_WRITE_ENABLE BIT_1
82 #define CHIP_SOFT_RESET BIT_0
87 #define ENABLE_RISC_INTR BIT_3
90 * INTR_STATUS register
92 #define RISC_PCI_INTR_REQUEST BIT_3
95 * RISC_STATUS register
97 #define FW_INTR_INFO_MASK (BIT_15 | BIT_14 | BIT_13 | BIT_12 | \
98 BIT_11 | BIT_10 | BIT_9 | BIT_8 | \
99 BIT_7 | BIT_6 | BIT_5 | BIT_4 | \
100 BIT_3 | BIT_2 | BIT_1)
101 #define FW_INTR_INFO_SHIFT 18
103 #define FW_INTR_INFO(status) (status & (FW_INTR_INFO_MASK << \
105 #define RISC_HOST_INTR_REQUEST BIT_15
106 #define RISC_PAUSED BIT_8
108 #define FW_INTR_STATUS_MASK (BIT_7 | BIT_6 | BIT_5 | BIT_4 | \
109 BIT_3 | BIT_2 | BIT_1 | BIT_0)
111 #define ROM_MBX_CMD_SUCCESSFUL 0x01
112 #define ROM_MBX_CMD_NOT_SUCCESSFUL 0x02
113 #define MBX_CMD_SUCCESSFUL 0x10
114 #define MBX_CMD_NOT_SUCCESSFUL 0x11
115 #define ASYNC_EVENT 0x12
116 #define RESP_Q_UPDATE 0x13
117 #define ATIO_Q_UPDATE 0x1c
118 #define RESP_ATIO_Q_UPDATE 0x1d
121 * Mailbox command completion status.
123 #define QLT_MBX_CMD_SUCCESS 0x4000
129 #define SET_RISC_RESET 0x01
130 #define CLEAR_RISC_RESET 0x02
131 #define SET_RISC_PAUSE 0x03
132 #define CLEAR_RISC_PAUSE 0x04
133 #define SET_HOST_TO_RISC_INTR 0x05
134 #define CLEAR_HOST_TO_RISC_INTR 0x06
135 #define CLEAR_RISC_TO_PCI_INTR 0x0A
137 #define HCCR_CMD_SHIFT 28
138 #define HCCR_CMD(cmd) ((uint32_t)cmd << HCCR_CMD_SHIFT)
140 #define MBC_STOP_FIRMWARE 0x14
143 * Flash/NVRAM definitions
145 #define FLASH_DATA_FLAG BIT_31
146 #define FLASH_CONF_ADDR 0x7FFD0000
147 #define FLASH_DATA_ADDR 0x7FF00000
148 #define FLASH_DATA_ADDR_81XX 0x7F8D0000
149 #define NVRAM_CONF_ADDR 0x7FFF0000
150 #define NVRAM_DATA_ADDR 0x7FFE0000
152 #define NVRAM_FUNC0_ADDR (NVRAM_DATA_ADDR + 0x80)
153 #define NVRAM_FUNC1_ADDR (NVRAM_DATA_ADDR + 0x180)
155 #define QLT25_NVRAM_FUNC0_ADDR (FLASH_DATA_ADDR + 0x48080)
156 #define QLT25_NVRAM_FUNC1_ADDR (FLASH_DATA_ADDR + 0x48180)
158 #define QLT81_NVRAM_FUNC0_ADDR (FLASH_DATA_ADDR_81XX + 0x80)
159 #define QLT81_NVRAM_FUNC1_ADDR (FLASH_DATA_ADDR_81XX + 0x180)
161 typedef struct qlt_nvram
{
164 uint8_t nvram_version
[2];
165 uint8_t reserved_0
[2];
167 /* Firmware Initialization Control Block. */
169 uint8_t reserved_1
[2];
170 uint8_t max_frame_length
[2];
171 uint8_t execution_throttle
[2];
172 uint8_t exchange_count
[2];
173 uint8_t hard_address
[2];
174 uint8_t port_name
[8];
175 uint8_t node_name
[8];
176 uint8_t login_retry_count
[2];
177 uint8_t link_down_on_nos
[2];
178 uint8_t interrupt_delay_timer
[2];
179 uint8_t login_timeout
[2];
182 * BIT 0 = Hard Assigned Loop ID
183 * BIT 1 = Enable Fairness
184 * BIT 2 = Enable Full-Duplex
186 * BIT 4 = Target Mode Enable
187 * BIT 5 = Initiator Mode Disable
192 * BIT 9 = Disable Initial LIP
193 * BIT 10 = Descending Loop ID Search
194 * BIT 11 = Previous Assigned Loop ID
196 * BIT 13 = Full Login after LIP
197 * BIT 14 = Node Name Option
198 * BIT 15-31 = Reserved
200 uint8_t firmware_options_1
[4];
203 * BIT 0 = Operation Mode bit 0
204 * BIT 1 = Operation Mode bit 1
205 * BIT 2 = Operation Mode bit 2
206 * BIT 3 = Operation Mode bit 3
207 * BIT 4 = Connection Options bit 0
208 * BIT 5 = Connection Options bit 1
209 * BIT 6 = Connection Options bit 2
210 * BIT 7 = Enable Non part on LIHA failure
212 * BIT 8 = Enable Class 2
213 * BIT 9 = Enable ACK0
215 * BIT 11 = Enable FC-SP Security
216 * BIT 12 = FC Tape Enable
217 * BIT 13-31 = Reserved
219 uint8_t firmware_options_2
[4];
223 * BIT 1 = Soft ID only
226 * BIT 4 = FCP RSP Payload bit 0
227 * BIT 5 = FCP RSP Payload bit 1
228 * BIT 6 = Enable Rec Out-of-Order data frame handling
229 * BIT 7 = Disable Automatic PLOGI on Local Loop
232 * BIT 9 = Enable Out-of-Order FCP_XFER_RDY relative
237 * BIT 13 = Data Rate bit 0
238 * BIT 14 = Data Rate bit 1
239 * BIT 15 = Data Rate bit 2
240 * BIT 16 = 75-ohm Termination Select
241 * BIT 17-31 = Reserved
243 uint8_t firmware_options_3
[4];
246 * Serial Link Control (offset 56)
247 * BIT 0 = control enable
248 * BIT 1-15 = Reserved
250 uint8_t swing_opt
[2];
253 * Serial Link Control 1G (offset 58)
256 * BIT 8-10 = output swing
257 * BIT 11-13 = output emphasis
258 * BIT 14-15 = Reserved
263 * Serial Link Control 2G (offset 60)
266 * BIT 8-10 = output swing
267 * BIT 11-13 = output emphasis
268 * BIT 14-15 = Reserved
273 * Serial Link Control 4G (offset 62)
276 * BIT 8-10 = output swing
277 * BIT 11-13 = output emphasis
278 * BIT 14-15 = Reserved
283 uint8_t reserved_2
[32];
286 uint8_t reserved_3
[32];
288 /* PCIe table entries. */
289 uint8_t reserved_4
[32];
292 uint8_t reserved_5
[32];
295 uint8_t reserved_6
[32];
298 uint8_t reserved_7
[32];
301 * BIT 0 = Enable spinup delay
302 * BIT 1 = Disable BIOS
303 * BIT 2 = Enable Memory Map BIOS
304 * BIT 3 = Enable Selectable Boot
305 * BIT 4 = Disable RISC code load
306 * BIT 5 = Disable serdes
307 * BIT 6 = Enable opt boot mode
308 * BIT 7 = Enable int mode BIOS
312 * BIT 10 = Enable lip full login
313 * BIT 11 = Enable target reset
315 * BIT 13 = Default Node Name Option
316 * BIT 14 = Default valid
317 * BIT 15 = Enable alternate WWN
323 uint8_t alternate_port_name
[8];
324 uint8_t alternate_node_name
[8];
326 uint8_t boot_port_name
[8];
327 uint8_t boot_lun_number
[2];
328 uint8_t reserved_8
[2];
330 uint8_t alt1_boot_port_name
[8];
331 uint8_t alt1_boot_lun_number
[2];
332 uint8_t reserved_9
[2];
334 uint8_t alt2_boot_port_name
[8];
335 uint8_t alt2_boot_lun_number
[2];
336 uint8_t reserved_10
[2];
338 uint8_t alt3_boot_port_name
[8];
339 uint8_t alt3_boot_lun_number
[2];
340 uint8_t reserved_11
[2];
343 * BIT 0 = Selective Login
344 * BIT 1 = Alt-Boot Enable
346 * BIT 3 = Enable Boot Order List
348 * BIT 5 = Enable Selective LUN
352 uint8_t efi_parameters
[4];
356 uint8_t reserved_13
[2];
358 uint8_t boot_id_number
[2];
359 uint8_t reserved_14
[2];
361 uint8_t max_luns_per_target
[2];
362 uint8_t reserved_15
[2];
364 uint8_t port_down_retry_count
[2];
365 uint8_t link_down_timeout
[2];
368 * FCode parameters word (offset 344)
370 * BIT 0 = Enable BIOS pathname
376 uint8_t reserved_16
[7];
379 uint8_t prev_drv_ver_major
;
380 uint8_t prev_drv_ver_submajob
;
381 uint8_t prev_drv_ver_minor
;
382 uint8_t prev_drv_ver_subminor
;
384 uint8_t prev_bios_ver_major
[2];
385 uint8_t prev_bios_ver_minor
[2];
387 uint8_t prev_efi_ver_major
[2];
388 uint8_t prev_efi_ver_minor
[2];
390 uint8_t prev_fw_ver_major
[2];
391 uint8_t prev_fw_ver_minor
;
392 uint8_t prev_fw_ver_subminor
;
394 uint8_t reserved_17
[16];
397 uint8_t def_port_name
[8];
398 uint8_t def_node_name
[8];
400 uint8_t reserved_18
[16];
403 uint8_t reserved_19
[32];
406 uint8_t reserved_20
[28];
409 uint8_t fw_table_offset
[2];
410 uint8_t fw_table_sig
[2];
413 uint8_t model_name
[8];
416 uint8_t power_table
[16];
418 uint8_t subsystem_vendor_id
[2];
419 uint8_t subsystem_device_id
[2];
424 /* ISP81xx Extended Initialisation Control Block */
425 typedef struct qlt_ext_icb_81xx
{
428 uint8_t fcf_vlan_match
;
429 uint8_t reserved_6
[3];
430 uint8_t fcf_vlan_id
[2];
431 uint8_t fcf_fabric_name
[8];
432 uint8_t reserved_7
[14];
433 uint8_t spma_proposed_mac_address
[6];
434 uint8_t reserved_8
[28];
436 } qlt_ext_icb_81xx_t
;
438 typedef struct qlt_nvram_81xx
{
441 uint8_t nvram_version
[2];
442 uint8_t reserved_0
[2];
444 /* Firmware Initialization Control Block. */
446 uint8_t reserved_1
[2];
447 uint8_t max_frame_length
[2];
448 uint8_t execution_throttle
[2];
449 uint8_t exchange_count
[2];
450 uint8_t reserved_2
[2];
451 uint8_t port_name
[8];
452 uint8_t node_name
[8];
453 uint8_t login_retry_count
[2];
454 uint8_t reserved_3
[2];
455 uint8_t interrupt_delay_timer
[2];
456 uint8_t login_timeout
[2];
459 * BIT 0 = Hard Assigned Loop ID
460 * BIT 1 = Enable Fairness
461 * BIT 2 = Enable Full-Duplex
463 * BIT 4 = Target Mode Enable
464 * BIT 5 = Initiator Mode Disable
474 * BIT 14 = Node Name Option
475 * BIT 15-31 = Reserved
477 uint8_t firmware_options_1
[4];
480 * BIT 0 = Operation Mode bit 0
481 * BIT 1 = Operation Mode bit 1
482 * BIT 2 = Operation Mode bit 2
483 * BIT 3 = Operation Mode bit 3
489 * BIT 8 = Enable Class 2
490 * BIT 9 = Enable ACK0
492 * BIT 11 = Enable FC-SP Security
493 * BIT 12 = FC Tape Enable
495 * BIT 14 = Target PRLI Control
496 * BIT 15-31 = Reserved
498 uint8_t firmware_options_2
[4];
502 * BIT 1 = Soft ID only
505 * BIT 4 = FCP RSP Payload bit 0
506 * BIT 5 = FCP RSP Payload bit 1
507 * BIT 6 = Enable Rec Out-of-Order data frame handling
511 * BIT 9 = Enable Out-of-Order FCP_XFER_RDY relative
520 * BIT 17 = Enable Multiple FCFs
521 * BIT 18-20 = MAC Addressing Mode
522 * BIT 21-25 = Ethernet Data Rate
523 * BIT 26 = Enable Ethernet Header Receive ATIO_Q
524 * BIT 27 = Enable Ethernet Header Receive RSP_Q
525 * BIT 28-29 = SPMA Selection
526 * BIT 30-31 = Reserved
528 uint8_t firmware_options_3
[4];
530 /* Offset 56 (38h). */
531 uint8_t reserved_4
[8];
533 /* Offset 64 (40h). */
534 uint8_t enode_mac
[6];
536 /* Offset 70 (46h). */
537 uint8_t reserved_5
[26];
539 /* Offset 96 (60h). */
540 uint8_t oem_specific
;
541 uint8_t reserved_6
[15];
543 /* Offset 112 (70h). */
544 uint8_t reserved_7
[16];
546 /* Offset 128 (80h). */
547 qlt_ext_icb_81xx_t ext_blk
;
550 uint8_t reserved_8
[32];
553 uint8_t reserved_9
[32];
557 uint8_t alternate_port_name
[8];
558 uint8_t alternate_name_name
[8];
560 uint8_t boot_port_name
[8];
561 uint8_t boot_lun_number
[2];
562 uint8_t reserved_10
[2];
564 uint8_t alt1_boot_port_name
[8];
565 uint8_t alt1_boot_lun_number
[2];
566 uint8_t reserved_11
[2];
568 uint8_t alt2_boot_port_name
[8];
569 uint8_t alt2_boot_lun_number
[2];
570 uint8_t reserved_12
[2];
572 uint8_t alt3_boot_port_name
[8];
573 uint8_t alt3_boot_lun_number
[2];
574 uint8_t reserved_13
[2];
577 * BIT 0 = Selective Login
578 * BIT 1 = Alt-Boot Enable
580 * BIT 3 = Enable Boot Order List
582 * BIT 5 = Enable Selective LUN
586 uint8_t efi_parameters
[4];
590 uint8_t reserved_15
[2];
592 uint8_t boot_id_number
[2];
593 uint8_t reserved_16
[2];
595 uint8_t max_luns_per_target
[2];
596 uint8_t reserved_17
[2];
598 uint8_t port_down_retry_count
[2];
599 uint8_t link_down_timeout
[2];
602 * FCode parameters word (offset 344)
604 * BIT 0 = Enable BIOS pathname
609 uint8_t fcode_parameter
[2];
610 uint8_t reserved_18
[6];
613 uint8_t reserved_19
[4];
614 uint8_t reserved_20
[10];
615 uint8_t reserved_21
[2];
616 uint8_t reserved_22
[16];
619 uint8_t reserved_23
[16];
620 uint8_t reserved_24
[16];
623 uint8_t reserved_25
[64];
626 uint8_t model_name
[16];
629 uint8_t feature_mask_l
[2];
630 uint8_t feature_mask_h
[2];
631 uint8_t reserved_26
[4];
633 uint8_t subsystem_vendor_id
[2];
634 uint8_t subsystem_device_id
[2];
644 #endif /* _QLT_REGS_H */