2 * QLogic Fibre Channel HBA Driver
3 * Copyright (c) 2003-2014 QLogic Corporation
5 * See LICENSE.qla2xxx for copyright and licensing details.
10 #include <linux/nvme.h>
11 #include <linux/nvme-fc.h>
15 #define MBS_CHECKSUM_ERROR 0x4010
16 #define MBS_INVALID_PRODUCT_KEY 0x4020
21 #define FO1_ENABLE_PUREX BIT_10
22 #define FO1_DISABLE_LED_CTRL BIT_6
23 #define FO1_ENABLE_8016 BIT_0
24 #define FO2_ENABLE_SEL_CLASS2 BIT_5
25 #define FO3_NO_ABTS_ON_LINKDOWN BIT_14
26 #define FO3_HOLD_STS_IOCB BIT_12
29 * Port Database structure definition for ISP 24xx.
31 #define PDO_FORCE_ADISC BIT_1
32 #define PDO_FORCE_PLOGI BIT_0
35 #define PORT_DATABASE_24XX_SIZE 64
36 struct port_database_24xx
{
38 #define PDF_TASK_RETRY_ID BIT_14
39 #define PDF_FC_TAPE BIT_7
40 #define PDF_ACK0_CAPABLE BIT_6
41 #define PDF_FCP2_CONF BIT_5
42 #define PDF_CLASS_2 BIT_4
43 #define PDF_HARD_ADDR BIT_1
46 * for NVMe, the login_state field has been
48 * The lower nibble is for FCP.
49 * The upper nibble is for NVMe.
51 uint8_t current_login_state
;
52 uint8_t last_login_state
;
53 #define PDS_PLOGI_PENDING 0x03
54 #define PDS_PLOGI_COMPLETE 0x04
55 #define PDS_PRLI_PENDING 0x05
56 #define PDS_PRLI_COMPLETE 0x06
57 #define PDS_PORT_UNAVAILABLE 0x07
58 #define PDS_PRLO_PENDING 0x09
59 #define PDS_LOGO_PENDING 0x11
60 #define PDS_PRLI2_PENDING 0x12
62 uint8_t hard_address
[3];
70 uint16_t nport_handle
; /* N_PORT handle. */
72 uint16_t receive_data_size
;
75 uint8_t prli_svc_param_word_0
[2]; /* Big endian */
76 /* Bits 15-0 of word 0 */
77 uint8_t prli_svc_param_word_3
[2]; /* Big endian */
78 /* Bits 15-0 of word 3 */
80 uint8_t port_name
[WWN_SIZE
];
81 uint8_t node_name
[WWN_SIZE
];
83 uint8_t reserved_3
[4];
84 uint16_t prli_nvme_svc_param_word_0
; /* Bits 15-0 of word 0 */
85 uint16_t prli_nvme_svc_param_word_3
; /* Bits 15-0 of word 3 */
86 uint16_t nvme_first_burst_size
;
87 uint8_t reserved_4
[14];
91 * MB 75h returns a list of DB entries similar to port_database_24xx(64B).
92 * However, in this case it returns 1st 40 bytes.
94 struct get_name_list_extended
{
96 u8 current_login_state
;
103 __le16 nport_handle
; /* N_PORT handle. */
104 __le16 receive_data_size
;
107 /* PRLI SVC Param are Big endian */
108 u8 prli_svc_param_word_0
[2]; /* Bits 15-0 of word 0 */
109 u8 prli_svc_param_word_3
[2]; /* Bits 15-0 of word 3 */
110 u8 port_name
[WWN_SIZE
];
111 u8 node_name
[WWN_SIZE
];
114 /* MB 75h: This is the short version of the database */
115 struct get_name_list
{
116 u8 port_node_name
[WWN_SIZE
]; /* B7 most sig, B0 least sig */
121 struct vp_database_24xx
{
125 uint8_t port_name
[WWN_SIZE
];
126 uint8_t node_name
[WWN_SIZE
];
127 uint16_t port_id_low
;
128 uint16_t port_id_high
;
134 uint16_t nvram_version
;
137 /* Firmware Initialization Control Block. */
140 __le16 frame_payload_size
;
141 uint16_t execution_throttle
;
142 uint16_t exchange_count
;
143 uint16_t hard_address
;
145 uint8_t port_name
[WWN_SIZE
];
146 uint8_t node_name
[WWN_SIZE
];
148 uint16_t login_retry_count
;
149 uint16_t link_down_on_nos
;
150 uint16_t interrupt_delay_timer
;
151 uint16_t login_timeout
;
153 uint32_t firmware_options_1
;
154 uint32_t firmware_options_2
;
155 uint32_t firmware_options_3
;
160 * BIT 0 = Control Enable
164 * BIT 8-10 = Output Swing 1G
165 * BIT 11-13 = Output Emphasis 1G
166 * BIT 14-15 = Reserved
169 * BIT 8-10 = Output Swing 2G
170 * BIT 11-13 = Output Emphasis 2G
171 * BIT 14-15 = Reserved
174 * BIT 8-10 = Output Swing 4G
175 * BIT 11-13 = Output Emphasis 4G
176 * BIT 14-15 = Reserved
178 uint16_t seriallink_options
[4];
180 uint16_t reserved_2
[16];
183 uint16_t reserved_3
[16];
185 /* PCIe table entries. */
186 uint16_t reserved_4
[16];
189 uint16_t reserved_5
[16];
192 uint16_t reserved_6
[16];
195 uint16_t reserved_7
[16];
198 * BIT 0 = Enable spinup delay
199 * BIT 1 = Disable BIOS
200 * BIT 2 = Enable Memory Map BIOS
201 * BIT 3 = Enable Selectable Boot
202 * BIT 4 = Disable RISC code load
203 * BIT 5 = Disable Serdes
209 * BIT 10 = Enable lip full login
210 * BIT 11 = Enable target reset
214 * BIT 15 = Enable alternate WWN
220 uint8_t alternate_port_name
[WWN_SIZE
];
221 uint8_t alternate_node_name
[WWN_SIZE
];
223 uint8_t boot_port_name
[WWN_SIZE
];
224 uint16_t boot_lun_number
;
227 uint8_t alt1_boot_port_name
[WWN_SIZE
];
228 uint16_t alt1_boot_lun_number
;
231 uint8_t alt2_boot_port_name
[WWN_SIZE
];
232 uint16_t alt2_boot_lun_number
;
233 uint16_t reserved_10
;
235 uint8_t alt3_boot_port_name
[WWN_SIZE
];
236 uint16_t alt3_boot_lun_number
;
237 uint16_t reserved_11
;
240 * BIT 0 = Selective Login
241 * BIT 1 = Alt-Boot Enable
243 * BIT 3 = Boot Order List
245 * BIT 5 = Selective LUN
249 uint32_t efi_parameters
;
253 uint16_t reserved_13
;
255 uint16_t boot_id_number
;
256 uint16_t reserved_14
;
258 uint16_t max_luns_per_target
;
259 uint16_t reserved_15
;
261 uint16_t port_down_retry_count
;
262 uint16_t link_down_timeout
;
264 /* FCode parameters. */
265 uint16_t fcode_parameter
;
267 uint16_t reserved_16
[3];
270 uint8_t prev_drv_ver_major
;
271 uint8_t prev_drv_ver_submajob
;
272 uint8_t prev_drv_ver_minor
;
273 uint8_t prev_drv_ver_subminor
;
275 uint16_t prev_bios_ver_major
;
276 uint16_t prev_bios_ver_minor
;
278 uint16_t prev_efi_ver_major
;
279 uint16_t prev_efi_ver_minor
;
281 uint16_t prev_fw_ver_major
;
282 uint8_t prev_fw_ver_minor
;
283 uint8_t prev_fw_ver_subminor
;
285 uint16_t reserved_17
[8];
288 uint16_t reserved_18
[16];
291 uint16_t reserved_19
[16];
294 uint16_t reserved_20
[16];
297 uint8_t model_name
[16];
299 uint16_t reserved_21
[2];
302 /* HW Parameter Block. */
303 uint16_t pcie_table_sig
;
304 uint16_t pcie_table_offset
;
306 uint16_t subsystem_vendor_id
;
307 uint16_t subsystem_device_id
;
313 * ISP Initialization Control Block.
314 * Little endian except where noted.
316 #define ICB_VERSION 1
317 struct init_cb_24xx
{
321 uint16_t frame_payload_size
;
322 uint16_t execution_throttle
;
323 uint16_t exchange_count
;
325 uint16_t hard_address
;
327 uint8_t port_name
[WWN_SIZE
]; /* Big endian. */
328 uint8_t node_name
[WWN_SIZE
]; /* Big endian. */
330 uint16_t response_q_inpointer
;
331 uint16_t request_q_outpointer
;
333 uint16_t login_retry_count
;
335 uint16_t prio_request_q_outpointer
;
337 uint16_t response_q_length
;
338 uint16_t request_q_length
;
340 uint16_t link_down_on_nos
; /* Milliseconds. */
342 uint16_t prio_request_q_length
;
344 __le64 request_q_address __packed
;
345 __le64 response_q_address __packed
;
346 __le64 prio_request_q_address __packed
;
350 uint8_t reserved_2
[4];
352 uint16_t atio_q_inpointer
;
353 uint16_t atio_q_length
;
354 __le64 atio_q_address __packed
;
356 uint16_t interrupt_delay_timer
; /* 100us increments. */
357 uint16_t login_timeout
;
360 * BIT 0 = Enable Hard Loop Id
361 * BIT 1 = Enable Fairness
362 * BIT 2 = Enable Full-Duplex
364 * BIT 4 = Enable Target Mode
365 * BIT 5 = Disable Initiator Mode
366 * BIT 6 = Acquire FA-WWN
367 * BIT 7 = Enable D-port Diagnostics
370 * BIT 9 = Non Participating LIP
371 * BIT 10 = Descending Loop ID Search
372 * BIT 11 = Acquire Loop ID in LIPA
374 * BIT 13 = Full Login after LIP
375 * BIT 14 = Node Name Option
376 * BIT 15-31 = Reserved
378 uint32_t firmware_options_1
;
381 * BIT 0 = Operation Mode bit 0
382 * BIT 1 = Operation Mode bit 1
383 * BIT 2 = Operation Mode bit 2
384 * BIT 3 = Operation Mode bit 3
385 * BIT 4 = Connection Options bit 0
386 * BIT 5 = Connection Options bit 1
387 * BIT 6 = Connection Options bit 2
388 * BIT 7 = Enable Non part on LIHA failure
390 * BIT 8 = Enable Class 2
391 * BIT 9 = Enable ACK0
393 * BIT 11 = Enable FC-SP Security
394 * BIT 12 = FC Tape Enable
396 * BIT 14 = Enable Target PRLI Control
397 * BIT 15-31 = Reserved
399 uint32_t firmware_options_2
;
403 * BIT 1 = Soft ID only
406 * BIT 4 = FCP RSP Payload bit 0
407 * BIT 5 = FCP RSP Payload bit 1
408 * BIT 6 = Enable Receive Out-of-Order data frame handling
409 * BIT 7 = Disable Automatic PLOGI on Local Loop
412 * BIT 9 = Enable Out-of-Order FCP_XFER_RDY relative offset handling
416 * BIT 13 = Data Rate bit 0
417 * BIT 14 = Data Rate bit 1
418 * BIT 15 = Data Rate bit 2
419 * BIT 16 = Enable 75 ohm Termination Select
420 * BIT 17-28 = Reserved
421 * BIT 29 = Enable response queue 0 in index shadowing
422 * BIT 30 = Enable request queue 0 out index shadowing
425 uint32_t firmware_options_3
;
428 uint8_t reserved_3
[20];
432 * ISP queue - command entry structure definition.
434 #define COMMAND_BIDIRECTIONAL 0x75
436 uint8_t entry_type
; /* Entry type. */
437 uint8_t entry_count
; /* Entry count. */
438 uint8_t sys_define
; /* System defined */
439 uint8_t entry_status
; /* Entry status. */
441 uint32_t handle
; /* System handle. */
443 uint16_t nport_handle
; /* N_PORT hanlde. */
445 uint16_t timeout
; /* Commnad timeout. */
447 uint16_t wr_dseg_count
; /* Write Data segment count. */
448 uint16_t rd_dseg_count
; /* Read Data segment count. */
450 struct scsi_lun lun
; /* FCP LUN (BE). */
452 uint16_t control_flags
; /* Control flags. */
453 #define BD_WRAP_BACK BIT_3
454 #define BD_READ_DATA BIT_1
455 #define BD_WRITE_DATA BIT_0
457 uint16_t fcp_cmnd_dseg_len
; /* Data segment length. */
458 __le64 fcp_cmnd_dseg_address __packed
;/* Data segment address. */
460 uint16_t reserved
[2]; /* Reserved */
462 uint32_t rd_byte_count
; /* Total Byte count Read. */
463 uint32_t wr_byte_count
; /* Total Byte count write. */
465 uint8_t port_id
[3]; /* PortID of destination port.*/
468 struct dsd64 fcp_dsd
;
471 #define COMMAND_TYPE_6 0x48 /* Command Type 6 entry */
473 uint8_t entry_type
; /* Entry type. */
474 uint8_t entry_count
; /* Entry count. */
475 uint8_t sys_define
; /* System defined. */
476 uint8_t entry_status
; /* Entry Status. */
478 uint32_t handle
; /* System handle. */
480 uint16_t nport_handle
; /* N_PORT handle. */
481 uint16_t timeout
; /* Command timeout. */
483 uint16_t dseg_count
; /* Data segment count. */
485 uint16_t fcp_rsp_dsd_len
; /* FCP_RSP DSD length. */
487 struct scsi_lun lun
; /* FCP LUN (BE). */
489 uint16_t control_flags
; /* Control flags. */
490 #define CF_DIF_SEG_DESCR_ENABLE BIT_3
491 #define CF_DATA_SEG_DESCR_ENABLE BIT_2
492 #define CF_READ_DATA BIT_1
493 #define CF_WRITE_DATA BIT_0
495 uint16_t fcp_cmnd_dseg_len
; /* Data segment length. */
496 /* Data segment address. */
497 __le64 fcp_cmnd_dseg_address __packed
;
498 /* Data segment address. */
499 __le64 fcp_rsp_dseg_address __packed
;
501 uint32_t byte_count
; /* Total byte count. */
503 uint8_t port_id
[3]; /* PortID of destination port. */
506 struct dsd64 fcp_dsd
;
509 #define COMMAND_TYPE_7 0x18 /* Command Type 7 entry */
511 uint8_t entry_type
; /* Entry type. */
512 uint8_t entry_count
; /* Entry count. */
513 uint8_t sys_define
; /* System defined. */
514 uint8_t entry_status
; /* Entry Status. */
516 uint32_t handle
; /* System handle. */
518 uint16_t nport_handle
; /* N_PORT handle. */
519 uint16_t timeout
; /* Command timeout. */
520 #define FW_MAX_TIMEOUT 0x1999
522 uint16_t dseg_count
; /* Data segment count. */
525 struct scsi_lun lun
; /* FCP LUN (BE). */
527 uint16_t task_mgmt_flags
; /* Task management flags. */
528 #define TMF_CLEAR_ACA BIT_14
529 #define TMF_TARGET_RESET BIT_13
530 #define TMF_LUN_RESET BIT_12
531 #define TMF_CLEAR_TASK_SET BIT_10
532 #define TMF_ABORT_TASK_SET BIT_9
533 #define TMF_DSD_LIST_ENABLE BIT_2
534 #define TMF_READ_DATA BIT_1
535 #define TMF_WRITE_DATA BIT_0
539 #define TSK_HEAD_OF_QUEUE 1
540 #define TSK_ORDERED 2
542 #define TSK_UNTAGGED 5
546 uint8_t fcp_cdb
[MAX_CMDSZ
]; /* SCSI command words. */
547 uint32_t byte_count
; /* Total byte count. */
549 uint8_t port_id
[3]; /* PortID of destination port. */
555 #define COMMAND_TYPE_CRC_2 0x6A /* Command Type CRC_2 (Type 6)
557 struct cmd_type_crc_2
{
558 uint8_t entry_type
; /* Entry type. */
559 uint8_t entry_count
; /* Entry count. */
560 uint8_t sys_define
; /* System defined. */
561 uint8_t entry_status
; /* Entry Status. */
563 uint32_t handle
; /* System handle. */
565 uint16_t nport_handle
; /* N_PORT handle. */
566 uint16_t timeout
; /* Command timeout. */
568 uint16_t dseg_count
; /* Data segment count. */
570 uint16_t fcp_rsp_dseg_len
; /* FCP_RSP DSD length. */
572 struct scsi_lun lun
; /* FCP LUN (BE). */
574 uint16_t control_flags
; /* Control flags. */
576 uint16_t fcp_cmnd_dseg_len
; /* Data segment length. */
577 __le64 fcp_cmnd_dseg_address __packed
;
578 /* Data segment address. */
579 __le64 fcp_rsp_dseg_address __packed
;
581 uint32_t byte_count
; /* Total byte count. */
583 uint8_t port_id
[3]; /* PortID of destination port. */
586 __le64 crc_context_address __packed
; /* Data segment address. */
587 uint16_t crc_context_len
; /* Data segment length. */
588 uint16_t reserved_1
; /* MUST be set to 0. */
593 * ISP queue - status entry structure definition.
595 #define STATUS_TYPE 0x03 /* Status entry. */
596 struct sts_entry_24xx
{
597 uint8_t entry_type
; /* Entry type. */
598 uint8_t entry_count
; /* Entry count. */
599 uint8_t sys_define
; /* System defined. */
600 uint8_t entry_status
; /* Entry Status. */
602 uint32_t handle
; /* System handle. */
604 uint16_t comp_status
; /* Completion status. */
605 uint16_t ox_id
; /* OX_ID used by the firmware. */
607 uint32_t residual_len
; /* FW calc residual transfer length. */
611 uint16_t nvme_rsp_pyld_len
;
614 uint16_t state_flags
; /* State flags. */
615 #define SF_TRANSFERRED_DATA BIT_11
616 #define SF_NVME_ERSP BIT_6
617 #define SF_FCP_RSP_DMA BIT_0
619 uint16_t retry_delay
;
620 uint16_t scsi_status
; /* SCSI status. */
621 #define SS_CONFIRMATION_REQ BIT_12
623 uint32_t rsp_residual_count
; /* FCP RSP residual count. */
625 uint32_t sense_len
; /* FCP SENSE length. */
629 uint32_t rsp_data_len
; /* FCP response data length */
630 uint8_t data
[28]; /* FCP rsp/sense information */
632 struct nvme_fc_ersp_iu nvme_ersp
;
633 uint8_t nvme_ersp_data
[32];
637 * If DIF Error is set in comp_status, these additional fields are
640 * !!! NOTE: Firmware sends expected/actual DIF data in big endian
641 * format; but all of the "data" field gets swab32-d in the beginning
642 * of qla2x00_status_entry().
644 * &data[10] : uint8_t report_runt_bg[2]; - computed guard
645 * &data[12] : uint8_t actual_dif[8]; - DIF Data received
646 * &data[20] : uint8_t expected_dif[8]; - DIF Data computed
652 * Status entry completion status
654 #define CS_DATA_REASSEMBLY_ERROR 0x11 /* Data Reassembly Error.. */
655 #define CS_ABTS_BY_TARGET 0x13 /* Target send ABTS to abort IOCB. */
656 #define CS_FW_RESOURCE 0x2C /* Firmware Resource Unavailable. */
657 #define CS_TASK_MGMT_OVERRUN 0x30 /* Task management overrun (8+). */
658 #define CS_ABORT_BY_TARGET 0x47 /* Abort By Target. */
661 * ISP queue - marker entry structure definition.
663 #define MARKER_TYPE 0x04 /* Marker entry. */
664 struct mrk_entry_24xx
{
665 uint8_t entry_type
; /* Entry type. */
666 uint8_t entry_count
; /* Entry count. */
667 uint8_t handle_count
; /* Handle count. */
668 uint8_t entry_status
; /* Entry Status. */
670 uint32_t handle
; /* System handle. */
672 uint16_t nport_handle
; /* N_PORT handle. */
674 uint8_t modifier
; /* Modifier (7-0). */
675 #define MK_SYNC_ID_LUN 0 /* Synchronize ID/LUN */
676 #define MK_SYNC_ID 1 /* Synchronize ID */
677 #define MK_SYNC_ALL 2 /* Synchronize all ID/LUN */
685 uint8_t lun
[8]; /* FCP LUN (BE). */
686 uint8_t reserved_4
[40];
690 * ISP queue - CT Pass-Through entry structure definition.
692 #define CT_IOCB_TYPE 0x29 /* CT Pass-Through IOCB entry */
693 struct ct_entry_24xx
{
694 uint8_t entry_type
; /* Entry type. */
695 uint8_t entry_count
; /* Entry count. */
696 uint8_t sys_define
; /* System Defined. */
697 uint8_t entry_status
; /* Entry Status. */
699 uint32_t handle
; /* System handle. */
701 uint16_t comp_status
; /* Completion status. */
703 uint16_t nport_handle
; /* N_PORT handle. */
705 uint16_t cmd_dsd_count
;
710 uint16_t timeout
; /* Command timeout. */
713 uint16_t rsp_dsd_count
;
715 uint8_t reserved_3
[10];
717 uint32_t rsp_byte_count
;
718 uint32_t cmd_byte_count
;
724 * ISP queue - ELS Pass-Through entry structure definition.
726 #define ELS_IOCB_TYPE 0x53 /* ELS Pass-Through IOCB entry */
727 struct els_entry_24xx
{
728 uint8_t entry_type
; /* Entry type. */
729 uint8_t entry_count
; /* Entry count. */
730 uint8_t sys_define
; /* System Defined. */
731 uint8_t entry_status
; /* Entry Status. */
733 uint32_t handle
; /* System handle. */
737 uint16_t nport_handle
; /* N_PORT handle. */
739 uint16_t tx_dsd_count
;
743 #define EST_SOFI3 (1 << 4)
744 #define EST_SOFI2 (3 << 4)
746 uint32_t rx_xchg_address
; /* Receive exchange address. */
747 uint16_t rx_dsd_count
;
755 uint16_t control_flags
; /* Control flags. */
756 #define ECF_PAYLOAD_DESCR_MASK (BIT_15|BIT_14|BIT_13)
757 #define EPD_ELS_COMMAND (0 << 13)
758 #define EPD_ELS_ACC (1 << 13)
759 #define EPD_ELS_RJT (2 << 13)
760 #define EPD_RX_XCHG (3 << 13)
761 #define ECF_CLR_PASSTHRU_PEND BIT_12
762 #define ECF_INCL_FRAME_HDR BIT_11
764 __le32 rx_byte_count
;
765 __le32 tx_byte_count
;
767 __le64 tx_address __packed
; /* Data segment 0 address. */
768 __le32 tx_len
; /* Data segment 0 length. */
769 __le64 rx_address __packed
; /* Data segment 1 address. */
770 __le32 rx_len
; /* Data segment 1 length. */
773 struct els_sts_entry_24xx
{
774 uint8_t entry_type
; /* Entry type. */
775 uint8_t entry_count
; /* Entry count. */
776 uint8_t sys_define
; /* System Defined. */
777 uint8_t entry_status
; /* Entry Status. */
779 uint32_t handle
; /* System handle. */
781 uint16_t comp_status
;
783 uint16_t nport_handle
; /* N_PORT handle. */
790 uint32_t rx_xchg_address
; /* Receive exchange address. */
801 uint16_t control_flags
; /* Control flags. */
802 uint32_t total_byte_count
;
803 uint32_t error_subcode_1
;
804 uint32_t error_subcode_2
;
807 * ISP queue - Mailbox Command entry structure definition.
809 #define MBX_IOCB_TYPE 0x39
810 struct mbx_entry_24xx
{
811 uint8_t entry_type
; /* Entry type. */
812 uint8_t entry_count
; /* Entry count. */
813 uint8_t handle_count
; /* Handle count. */
814 uint8_t entry_status
; /* Entry Status. */
816 uint32_t handle
; /* System handle. */
822 #define LOGINOUT_PORT_IOCB_TYPE 0x52 /* Login/Logout Port entry. */
823 struct logio_entry_24xx
{
824 uint8_t entry_type
; /* Entry type. */
825 uint8_t entry_count
; /* Entry count. */
826 uint8_t sys_define
; /* System defined. */
827 uint8_t entry_status
; /* Entry Status. */
829 uint32_t handle
; /* System handle. */
831 uint16_t comp_status
; /* Completion status. */
832 #define CS_LOGIO_ERROR 0x31 /* Login/Logout IOCB error. */
834 uint16_t nport_handle
; /* N_PORT handle. */
836 uint16_t control_flags
; /* Control flags. */
838 #define LCF_INCLUDE_SNS BIT_10 /* Include SNS (FFFFFC) during LOGO. */
839 #define LCF_FCP2_OVERRIDE BIT_9 /* Set/Reset word 3 of PRLI. */
840 #define LCF_CLASS_2 BIT_8 /* Enable class 2 during PLOGI. */
841 #define LCF_FREE_NPORT BIT_7 /* Release NPORT handle after LOGO. */
842 #define LCF_EXPL_LOGO BIT_6 /* Perform an explicit LOGO. */
843 #define LCF_NVME_PRLI BIT_6 /* Perform NVME FC4 PRLI */
844 #define LCF_SKIP_PRLI BIT_5 /* Skip PRLI after PLOGI. */
845 #define LCF_IMPL_LOGO_ALL BIT_5 /* Implicit LOGO to all ports. */
846 #define LCF_COND_PLOGI BIT_4 /* PLOGI only if not logged-in. */
847 #define LCF_IMPL_LOGO BIT_4 /* Perform an implicit LOGO. */
848 #define LCF_IMPL_PRLO BIT_4 /* Perform an implicit PRLO. */
850 #define LCF_COMMAND_PLOGI 0x00 /* PLOGI. */
851 #define LCF_COMMAND_PRLI 0x01 /* PRLI. */
852 #define LCF_COMMAND_PDISC 0x02 /* PDISC. */
853 #define LCF_COMMAND_ADISC 0x03 /* ADISC. */
854 #define LCF_COMMAND_LOGO 0x08 /* LOGO. */
855 #define LCF_COMMAND_PRLO 0x09 /* PRLO. */
856 #define LCF_COMMAND_TPRLO 0x0A /* TPRLO. */
861 uint8_t port_id
[3]; /* PortID of destination port. */
863 uint8_t rsp_size
; /* Response size in 32bit words. */
865 uint32_t io_parameter
[11]; /* General I/O parameters. */
866 #define LSC_SCODE_NOLINK 0x01
867 #define LSC_SCODE_NOIOCB 0x02
868 #define LSC_SCODE_NOXCB 0x03
869 #define LSC_SCODE_CMD_FAILED 0x04
870 #define LSC_SCODE_NOFABRIC 0x05
871 #define LSC_SCODE_FW_NOT_READY 0x07
872 #define LSC_SCODE_NOT_LOGGED_IN 0x09
873 #define LSC_SCODE_NOPCB 0x0A
875 #define LSC_SCODE_ELS_REJECT 0x18
876 #define LSC_SCODE_CMD_PARAM_ERR 0x19
877 #define LSC_SCODE_PORTID_USED 0x1A
878 #define LSC_SCODE_NPORT_USED 0x1B
879 #define LSC_SCODE_NONPORT 0x1C
880 #define LSC_SCODE_LOGGED_IN 0x1D
881 #define LSC_SCODE_NOFLOGI_ACC 0x1F
884 #define TSK_MGMT_IOCB_TYPE 0x14
885 struct tsk_mgmt_entry
{
886 uint8_t entry_type
; /* Entry type. */
887 uint8_t entry_count
; /* Entry count. */
888 uint8_t handle_count
; /* Handle count. */
889 uint8_t entry_status
; /* Entry Status. */
891 uint32_t handle
; /* System handle. */
893 uint16_t nport_handle
; /* N_PORT handle. */
897 uint16_t delay
; /* Activity delay in seconds. */
899 uint16_t timeout
; /* Command timeout. */
901 struct scsi_lun lun
; /* FCP LUN (BE). */
903 uint32_t control_flags
; /* Control Flags. */
904 #define TCF_NOTMCMD_TO_TARGET BIT_31
905 #define TCF_LUN_RESET BIT_4
906 #define TCF_ABORT_TASK_SET BIT_3
907 #define TCF_CLEAR_TASK_SET BIT_2
908 #define TCF_TARGET_RESET BIT_1
909 #define TCF_CLEAR_ACA BIT_0
911 uint8_t reserved_2
[20];
913 uint8_t port_id
[3]; /* PortID of destination port. */
916 uint8_t reserved_3
[12];
919 #define ABORT_IOCB_TYPE 0x33
920 struct abort_entry_24xx
{
921 uint8_t entry_type
; /* Entry type. */
922 uint8_t entry_count
; /* Entry count. */
923 uint8_t handle_count
; /* Handle count. */
924 uint8_t entry_status
; /* Entry Status. */
926 uint32_t handle
; /* System handle. */
928 uint16_t nport_handle
; /* N_PORT handle. */
929 /* or Completion status. */
931 uint16_t options
; /* Options. */
932 #define AOF_NO_ABTS BIT_0 /* Do not send any ABTS. */
934 uint32_t handle_to_abort
; /* System handle to abort. */
937 uint8_t reserved_1
[30];
939 uint8_t port_id
[3]; /* PortID of destination port. */
942 uint8_t reserved_2
[12];
946 * ISP I/O Register Set structure definitions.
948 struct device_reg_24xx
{
949 uint32_t flash_addr
; /* Flash/NVRAM BIOS address. */
950 #define FARX_DATA_FLAG BIT_31
951 #define FARX_ACCESS_FLASH_CONF 0x7FFD0000
952 #define FARX_ACCESS_FLASH_DATA 0x7FF00000
953 #define FARX_ACCESS_NVRAM_CONF 0x7FFF0000
954 #define FARX_ACCESS_NVRAM_DATA 0x7FFE0000
956 #define FA_NVRAM_FUNC0_ADDR 0x80
957 #define FA_NVRAM_FUNC1_ADDR 0x180
959 #define FA_NVRAM_VPD_SIZE 0x200
960 #define FA_NVRAM_VPD0_ADDR 0x00
961 #define FA_NVRAM_VPD1_ADDR 0x100
963 #define FA_BOOT_CODE_ADDR 0x00000
965 * RISC code begins at offset 512KB
966 * within flash. Consisting of two
967 * contiguous RISC code segments.
969 #define FA_RISC_CODE_ADDR 0x20000
970 #define FA_RISC_CODE_SEGMENTS 2
972 #define FA_FLASH_DESCR_ADDR_24 0x11000
973 #define FA_FLASH_LAYOUT_ADDR_24 0x11400
974 #define FA_NPIV_CONF0_ADDR_24 0x16000
975 #define FA_NPIV_CONF1_ADDR_24 0x17000
977 #define FA_FW_AREA_ADDR 0x40000
978 #define FA_VPD_NVRAM_ADDR 0x48000
979 #define FA_FEATURE_ADDR 0x4C000
980 #define FA_FLASH_DESCR_ADDR 0x50000
981 #define FA_FLASH_LAYOUT_ADDR 0x50400
982 #define FA_HW_EVENT0_ADDR 0x54000
983 #define FA_HW_EVENT1_ADDR 0x54400
984 #define FA_HW_EVENT_SIZE 0x200
985 #define FA_HW_EVENT_ENTRY_SIZE 4
986 #define FA_NPIV_CONF0_ADDR 0x5C000
987 #define FA_NPIV_CONF1_ADDR 0x5D000
988 #define FA_FCP_PRIO0_ADDR 0x10000
989 #define FA_FCP_PRIO1_ADDR 0x12000
992 * Flash Error Log Event Codes.
994 #define HW_EVENT_RESET_ERR 0xF00B
995 #define HW_EVENT_ISP_ERR 0xF020
996 #define HW_EVENT_PARITY_ERR 0xF022
997 #define HW_EVENT_NVRAM_CHKSUM_ERR 0xF023
998 #define HW_EVENT_FLASH_FW_ERR 0xF024
1000 uint32_t flash_data
; /* Flash/NVRAM BIOS data. */
1002 uint32_t ctrl_status
; /* Control/Status. */
1003 #define CSRX_FLASH_ACCESS_ERROR BIT_18 /* Flash/NVRAM Access Error. */
1004 #define CSRX_DMA_ACTIVE BIT_17 /* DMA Active status. */
1005 #define CSRX_DMA_SHUTDOWN BIT_16 /* DMA Shutdown control status. */
1006 #define CSRX_FUNCTION BIT_15 /* Function number. */
1007 /* PCI-X Bus Mode. */
1008 #define CSRX_PCIX_BUS_MODE_MASK (BIT_11|BIT_10|BIT_9|BIT_8)
1009 #define PBM_PCI_33MHZ (0 << 8)
1010 #define PBM_PCIX_M1_66MHZ (1 << 8)
1011 #define PBM_PCIX_M1_100MHZ (2 << 8)
1012 #define PBM_PCIX_M1_133MHZ (3 << 8)
1013 #define PBM_PCIX_M2_66MHZ (5 << 8)
1014 #define PBM_PCIX_M2_100MHZ (6 << 8)
1015 #define PBM_PCIX_M2_133MHZ (7 << 8)
1016 #define PBM_PCI_66MHZ (8 << 8)
1017 /* Max Write Burst byte count. */
1018 #define CSRX_MAX_WRT_BURST_MASK (BIT_5|BIT_4)
1019 #define MWB_512_BYTES (0 << 4)
1020 #define MWB_1024_BYTES (1 << 4)
1021 #define MWB_2048_BYTES (2 << 4)
1022 #define MWB_4096_BYTES (3 << 4)
1024 #define CSRX_64BIT_SLOT BIT_2 /* PCI 64-Bit Bus Slot. */
1025 #define CSRX_FLASH_ENABLE BIT_1 /* Flash BIOS Read/Write enable. */
1026 #define CSRX_ISP_SOFT_RESET BIT_0 /* ISP soft reset. */
1028 uint32_t ictrl
; /* Interrupt control. */
1029 #define ICRX_EN_RISC_INT BIT_3 /* Enable RISC interrupts on PCI. */
1031 uint32_t istatus
; /* Interrupt status. */
1032 #define ISRX_RISC_INT BIT_3 /* RISC interrupt. */
1034 uint32_t unused_1
[2]; /* Gap. */
1036 /* Request Queue. */
1037 uint32_t req_q_in
; /* In-Pointer. */
1038 uint32_t req_q_out
; /* Out-Pointer. */
1039 /* Response Queue. */
1040 uint32_t rsp_q_in
; /* In-Pointer. */
1041 uint32_t rsp_q_out
; /* Out-Pointer. */
1042 /* Priority Request Queue. */
1043 uint32_t preq_q_in
; /* In-Pointer. */
1044 uint32_t preq_q_out
; /* Out-Pointer. */
1046 uint32_t unused_2
[2]; /* Gap. */
1049 uint32_t atio_q_in
; /* In-Pointer. */
1050 uint32_t atio_q_out
; /* Out-Pointer. */
1052 uint32_t host_status
;
1053 #define HSRX_RISC_INT BIT_15 /* RISC to Host interrupt. */
1054 #define HSRX_RISC_PAUSED BIT_8 /* RISC Paused. */
1056 uint32_t hccr
; /* Host command & control register. */
1057 /* HCCR statuses. */
1058 #define HCCRX_HOST_INT BIT_6 /* Host to RISC interrupt bit. */
1059 #define HCCRX_RISC_RESET BIT_5 /* RISC Reset mode bit. */
1060 /* HCCR commands. */
1062 #define HCCRX_NOOP 0x00000000
1063 /* Set RISC Reset. */
1064 #define HCCRX_SET_RISC_RESET 0x10000000
1065 /* Clear RISC Reset. */
1066 #define HCCRX_CLR_RISC_RESET 0x20000000
1067 /* Set RISC Pause. */
1068 #define HCCRX_SET_RISC_PAUSE 0x30000000
1069 /* Releases RISC Pause. */
1070 #define HCCRX_REL_RISC_PAUSE 0x40000000
1071 /* Set HOST to RISC interrupt. */
1072 #define HCCRX_SET_HOST_INT 0x50000000
1073 /* Clear HOST to RISC interrupt. */
1074 #define HCCRX_CLR_HOST_INT 0x60000000
1075 /* Clear RISC to PCI interrupt. */
1076 #define HCCRX_CLR_RISC_INT 0xA0000000
1078 uint32_t gpiod
; /* GPIO Data register. */
1080 /* LED update mask. */
1081 #define GPDX_LED_UPDATE_MASK (BIT_20|BIT_19|BIT_18)
1082 /* Data update mask. */
1083 #define GPDX_DATA_UPDATE_MASK (BIT_17|BIT_16)
1084 /* Data update mask. */
1085 #define GPDX_DATA_UPDATE_2_MASK (BIT_28|BIT_27|BIT_26|BIT_17|BIT_16)
1086 /* LED control mask. */
1087 #define GPDX_LED_COLOR_MASK (BIT_4|BIT_3|BIT_2)
1088 /* LED bit values. Color names as
1089 * referenced in fw spec.
1091 #define GPDX_LED_YELLOW_ON BIT_2
1092 #define GPDX_LED_GREEN_ON BIT_3
1093 #define GPDX_LED_AMBER_ON BIT_4
1095 #define GPDX_DATA_INOUT (BIT_1|BIT_0)
1097 uint32_t gpioe
; /* GPIO Enable register. */
1098 /* Enable update mask. */
1099 #define GPEX_ENABLE_UPDATE_MASK (BIT_17|BIT_16)
1100 /* Enable update mask. */
1101 #define GPEX_ENABLE_UPDATE_2_MASK (BIT_28|BIT_27|BIT_26|BIT_17|BIT_16)
1103 #define GPEX_ENABLE (BIT_1|BIT_0)
1105 uint32_t iobase_addr
; /* I/O Bus Base Address register. */
1107 uint32_t unused_3
[10]; /* Gap. */
1142 uint32_t iobase_window
;
1145 uint32_t unused_4_1
[6]; /* Gap. */
1147 uint32_t unused_5
[2]; /* Gap. */
1148 uint32_t iobase_select
;
1149 uint32_t unused_6
[2]; /* Gap. */
1150 uint32_t iobase_sdata
;
1152 /* RISC-RISC semaphore register PCI offet */
1153 #define RISC_REGISTER_BASE_OFFSET 0x7010
1154 #define RISC_REGISTER_WINDOW_OFFET 0x6
1156 /* RISC-RISC semaphore/flag register (risc address 0x7016) */
1158 #define RISC_SEMAPHORE 0x1UL
1159 #define RISC_SEMAPHORE_WE (RISC_SEMAPHORE << 16)
1160 #define RISC_SEMAPHORE_CLR (RISC_SEMAPHORE_WE | 0x0UL)
1161 #define RISC_SEMAPHORE_SET (RISC_SEMAPHORE_WE | RISC_SEMAPHORE)
1163 #define RISC_SEMAPHORE_FORCE 0x8000UL
1164 #define RISC_SEMAPHORE_FORCE_WE (RISC_SEMAPHORE_FORCE << 16)
1165 #define RISC_SEMAPHORE_FORCE_CLR (RISC_SEMAPHORE_FORCE_WE | 0x0UL)
1166 #define RISC_SEMAPHORE_FORCE_SET \
1167 (RISC_SEMAPHORE_FORCE_WE | RISC_SEMAPHORE_FORCE)
1169 /* RISC semaphore timeouts (ms) */
1170 #define TIMEOUT_SEMAPHORE 2500
1171 #define TIMEOUT_SEMAPHORE_FORCE 2000
1172 #define TIMEOUT_TOTAL_ELAPSED 4500
1174 /* Trace Control *************************************************************/
1176 #define TC_AEN_DISABLE 0
1178 #define TC_EFT_ENABLE 4
1179 #define TC_EFT_DISABLE 5
1181 #define TC_FCE_ENABLE 8
1182 #define TC_FCE_OPTIONS 0
1183 #define TC_FCE_DEFAULT_RX_SIZE 2112
1184 #define TC_FCE_DEFAULT_TX_SIZE 2112
1185 #define TC_FCE_DISABLE 9
1186 #define TC_FCE_DISABLE_TRACE BIT_0
1188 /* MID Support ***************************************************************/
1190 #define MIN_MULTI_ID_FABRIC 64 /* Must be power-of-2. */
1191 #define MAX_MULTI_ID_FABRIC 256 /* ... */
1193 struct mid_conf_entry_24xx
{
1194 uint16_t reserved_1
;
1197 * BIT 0 = Enable Hard Loop Id
1198 * BIT 1 = Acquire Loop ID in LIPA
1199 * BIT 2 = ID not Acquired
1201 * BIT 4 = Enable Initiator Mode
1202 * BIT 5 = Disable Target Mode
1203 * BIT 6-7 = Reserved
1207 uint8_t hard_address
;
1209 uint8_t port_name
[WWN_SIZE
];
1210 uint8_t node_name
[WWN_SIZE
];
1213 struct mid_init_cb_24xx
{
1214 struct init_cb_24xx init_cb
;
1219 struct mid_conf_entry_24xx entries
[MAX_MULTI_ID_FABRIC
];
1223 struct mid_db_entry_24xx
{
1225 #define MDBS_NON_PARTIC BIT_3
1226 #define MDBS_ID_ACQUIRED BIT_1
1227 #define MDBS_ENABLED BIT_0
1230 uint8_t hard_address
;
1232 uint8_t port_name
[WWN_SIZE
];
1233 uint8_t node_name
[WWN_SIZE
];
1240 * Virtual Port Control IOCB
1242 #define VP_CTRL_IOCB_TYPE 0x30 /* Virtual Port Control entry. */
1243 struct vp_ctrl_entry_24xx
{
1244 uint8_t entry_type
; /* Entry type. */
1245 uint8_t entry_count
; /* Entry count. */
1246 uint8_t sys_define
; /* System defined. */
1247 uint8_t entry_status
; /* Entry Status. */
1249 uint32_t handle
; /* System handle. */
1251 uint16_t vp_idx_failed
;
1253 uint16_t comp_status
; /* Completion status. */
1254 #define CS_VCE_IOCB_ERROR 0x01 /* Error processing IOCB */
1255 #define CS_VCE_ACQ_ID_ERROR 0x02 /* Error while acquireing ID. */
1256 #define CS_VCE_BUSY 0x05 /* Firmware not ready to accept cmd. */
1259 #define VCE_COMMAND_ENABLE_VPS 0x00 /* Enable VPs. */
1260 #define VCE_COMMAND_DISABLE_VPS 0x08 /* Disable VPs. */
1261 #define VCE_COMMAND_DISABLE_VPS_REINIT 0x09 /* Disable VPs and reinit link. */
1262 #define VCE_COMMAND_DISABLE_VPS_LOGO 0x0a /* Disable VPs and LOGO ports. */
1263 #define VCE_COMMAND_DISABLE_VPS_LOGO_ALL 0x0b /* Disable VPs and LOGO ports. */
1267 uint8_t vp_idx_map
[16];
1270 uint16_t reserved_4
;
1272 uint8_t reserved_5
[24];
1276 * Modify Virtual Port Configuration IOCB
1278 #define VP_CONFIG_IOCB_TYPE 0x31 /* Virtual Port Config entry. */
1279 struct vp_config_entry_24xx
{
1280 uint8_t entry_type
; /* Entry type. */
1281 uint8_t entry_count
; /* Entry count. */
1282 uint8_t handle_count
;
1283 uint8_t entry_status
; /* Entry Status. */
1285 uint32_t handle
; /* System handle. */
1288 #define CS_VF_BIND_VPORTS_TO_VF BIT_0
1289 #define CS_VF_SET_QOS_OF_VPORTS BIT_1
1290 #define CS_VF_SET_HOPS_OF_VPORTS BIT_2
1292 uint16_t comp_status
; /* Completion status. */
1293 #define CS_VCT_STS_ERROR 0x01 /* Specified VPs were not disabled. */
1294 #define CS_VCT_CNT_ERROR 0x02 /* Invalid VP count. */
1295 #define CS_VCT_ERROR 0x03 /* Unknown error. */
1296 #define CS_VCT_IDX_ERROR 0x02 /* Invalid VP index. */
1297 #define CS_VCT_BUSY 0x05 /* Firmware not ready to accept cmd. */
1300 #define VCT_COMMAND_MOD_VPS 0x00 /* Modify VP configurations. */
1301 #define VCT_COMMAND_MOD_ENABLE_VPS 0x01 /* Modify configuration & enable VPs. */
1308 uint8_t options_idx1
;
1309 uint8_t hard_address_idx1
;
1310 uint16_t reserved_vp1
;
1311 uint8_t port_name_idx1
[WWN_SIZE
];
1312 uint8_t node_name_idx1
[WWN_SIZE
];
1314 uint8_t options_idx2
;
1315 uint8_t hard_address_idx2
;
1316 uint16_t reserved_vp2
;
1317 uint8_t port_name_idx2
[WWN_SIZE
];
1318 uint8_t node_name_idx2
[WWN_SIZE
];
1320 uint16_t reserved_4
;
1322 uint8_t reserved_5
[2];
1325 #define VP_RPT_ID_IOCB_TYPE 0x32 /* Report ID Acquisition entry. */
1330 VP_STAT_SNS_TO
, /* timeout */
1332 VP_STAT_SCR_TO
, /* timeout */
1337 VP_FLAGS_CON_FLOOP
= 1,
1338 VP_FLAGS_CON_P2P
= 2,
1339 VP_FLAGS_CON_FABRIC
= 3,
1340 VP_FLAGS_NAME_VALID
= BIT_5
,
1343 struct vp_rpt_id_entry_24xx
{
1344 uint8_t entry_type
; /* Entry type. */
1345 uint8_t entry_count
; /* Entry count. */
1346 uint8_t sys_define
; /* System defined. */
1347 uint8_t entry_status
; /* Entry Status. */
1349 uint8_t vp_acquired
;
1351 uint8_t vp_idx
; /* Format 0=reserved */
1352 uint8_t vp_status
; /* Format 0=reserved */
1359 uint8_t vp_idx_map
[16];
1360 uint8_t reserved_4
[32];
1363 /* format 1 fabric */
1364 uint8_t vpstat1_subcode
; /* vp_status=1 subcode */
1366 #define TOPO_MASK 0xE
1368 #define TOPO_N2N 0x4
1374 uint8_t ls_rjt_vendor
;
1375 uint8_t ls_rjt_explanation
;
1376 uint8_t ls_rjt_reason
;
1379 uint8_t port_name
[8];
1380 uint8_t node_name
[8];
1382 uint8_t reserved_5
[6];
1384 struct _f2
{ /* format 2: N2N direct connect */
1385 uint8_t vpstat1_subcode
;
1390 uint8_t ls_rjt_vendor
;
1391 uint8_t ls_rjt_explanation
;
1392 uint8_t ls_rjt_reason
;
1395 uint8_t port_name
[8];
1396 uint8_t node_name
[8];
1398 uint8_t reserved_5
[2];
1399 uint8_t remote_nport_id
[4];
1404 #define VF_EVFP_IOCB_TYPE 0x26 /* Exchange Virtual Fabric Parameters entry. */
1405 struct vf_evfp_entry_24xx
{
1406 uint8_t entry_type
; /* Entry type. */
1407 uint8_t entry_count
; /* Entry count. */
1408 uint8_t sys_define
; /* System defined. */
1409 uint8_t entry_status
; /* Entry Status. */
1411 uint32_t handle
; /* System handle. */
1412 uint16_t comp_status
; /* Completion status. */
1413 uint16_t timeout
; /* timeout */
1414 uint16_t adim_tagging_mode
;
1419 uint16_t nport_handle
; /* N_PORT handle. */
1420 uint16_t control_flags
;
1421 uint32_t io_parameter_0
;
1422 uint32_t io_parameter_1
;
1423 __le64 tx_address __packed
; /* Data segment 0 address. */
1424 uint32_t tx_len
; /* Data segment 0 length. */
1425 __le64 rx_address __packed
; /* Data segment 1 address. */
1426 uint32_t rx_len
; /* Data segment 1 length. */
1429 /* END MID Support ***********************************************************/
1431 /* Flash Description Table ***************************************************/
1433 struct qla_fdt_layout
{
1444 uint8_t alt_erase_cmd
;
1445 uint8_t wrt_enable_cmd
;
1446 uint8_t wrt_enable_bits
;
1447 uint8_t wrt_sts_reg_cmd
;
1448 uint8_t unprotect_sec_cmd
;
1449 uint8_t read_man_id_cmd
;
1450 uint32_t block_size
;
1451 uint32_t alt_block_size
;
1452 uint32_t flash_size
;
1453 uint32_t wrt_enable_data
;
1454 uint8_t read_id_addr_len
;
1455 uint8_t wrt_disable_bits
;
1456 uint8_t read_dev_id_len
;
1457 uint8_t chip_erase_cmd
;
1458 uint16_t read_timeout
;
1459 uint8_t protect_sec_cmd
;
1460 uint8_t unused2
[65];
1463 /* Flash Layout Table ********************************************************/
1465 struct qla_flt_location
{
1474 #define FLT_REG_FW 0x01
1475 #define FLT_REG_BOOT_CODE 0x07
1476 #define FLT_REG_VPD_0 0x14
1477 #define FLT_REG_NVRAM_0 0x15
1478 #define FLT_REG_VPD_1 0x16
1479 #define FLT_REG_NVRAM_1 0x17
1480 #define FLT_REG_VPD_2 0xD4
1481 #define FLT_REG_NVRAM_2 0xD5
1482 #define FLT_REG_VPD_3 0xD6
1483 #define FLT_REG_NVRAM_3 0xD7
1484 #define FLT_REG_FDT 0x1a
1485 #define FLT_REG_FLT 0x1c
1486 #define FLT_REG_HW_EVENT_0 0x1d
1487 #define FLT_REG_HW_EVENT_1 0x1f
1488 #define FLT_REG_NPIV_CONF_0 0x29
1489 #define FLT_REG_NPIV_CONF_1 0x2a
1490 #define FLT_REG_GOLD_FW 0x2f
1491 #define FLT_REG_FCP_PRIO_0 0x87
1492 #define FLT_REG_FCP_PRIO_1 0x88
1493 #define FLT_REG_CNA_FW 0x97
1494 #define FLT_REG_BOOT_CODE_8044 0xA2
1495 #define FLT_REG_FCOE_FW 0xA4
1496 #define FLT_REG_FCOE_NVRAM_0 0xAA
1497 #define FLT_REG_FCOE_NVRAM_1 0xAC
1500 #define FLT_REG_IMG_PRI_27XX 0x95
1501 #define FLT_REG_IMG_SEC_27XX 0x96
1502 #define FLT_REG_FW_SEC_27XX 0x02
1503 #define FLT_REG_BOOTLOAD_SEC_27XX 0x9
1504 #define FLT_REG_VPD_SEC_27XX_0 0x50
1505 #define FLT_REG_VPD_SEC_27XX_1 0x52
1506 #define FLT_REG_VPD_SEC_27XX_2 0xD8
1507 #define FLT_REG_VPD_SEC_27XX_3 0xDA
1510 #define FLT_REG_AUX_IMG_PRI_28XX 0x125
1511 #define FLT_REG_AUX_IMG_SEC_28XX 0x126
1512 #define FLT_REG_VPD_SEC_28XX_0 0x10C
1513 #define FLT_REG_VPD_SEC_28XX_1 0x10E
1514 #define FLT_REG_VPD_SEC_28XX_2 0x110
1515 #define FLT_REG_VPD_SEC_28XX_3 0x112
1516 #define FLT_REG_NVRAM_SEC_28XX_0 0x10D
1517 #define FLT_REG_NVRAM_SEC_28XX_1 0x10F
1518 #define FLT_REG_NVRAM_SEC_28XX_2 0x111
1519 #define FLT_REG_NVRAM_SEC_28XX_3 0x113
1520 #define FLT_REG_MPI_PRI_28XX 0xD3
1521 #define FLT_REG_MPI_SEC_28XX 0xF0
1522 #define FLT_REG_PEP_PRI_28XX 0xD1
1523 #define FLT_REG_PEP_SEC_28XX 0xF1
1525 struct qla_flt_region
{
1534 struct qla_flt_header
{
1539 struct qla_flt_region region
[0];
1542 #define FLT_REGION_SIZE 16
1543 #define FLT_MAX_REGIONS 0xFF
1544 #define FLT_REGIONS_SIZE (FLT_REGION_SIZE * FLT_MAX_REGIONS)
1546 /* Flash NPIV Configuration Table ********************************************/
1548 struct qla_npiv_header
{
1556 struct qla_npiv_entry
{
1562 uint8_t port_name
[WWN_SIZE
];
1563 uint8_t node_name
[WWN_SIZE
];
1566 /* 84XX Support **************************************************************/
1568 #define MBA_ISP84XX_ALERT 0x800f /* Alert Notification. */
1569 #define A84_PANIC_RECOVERY 0x1
1570 #define A84_OP_LOGIN_COMPLETE 0x2
1571 #define A84_DIAG_LOGIN_COMPLETE 0x3
1572 #define A84_GOLD_LOGIN_COMPLETE 0x4
1574 #define MBC_ISP84XX_RESET 0x3a /* Reset. */
1576 #define FSTATE_REMOTE_FC_DOWN BIT_0
1577 #define FSTATE_NSL_LINK_DOWN BIT_1
1578 #define FSTATE_IS_DIAG_FW BIT_2
1579 #define FSTATE_LOGGED_IN BIT_3
1580 #define FSTATE_WAITING_FOR_VERIFY BIT_4
1582 #define VERIFY_CHIP_IOCB_TYPE 0x1B
1583 struct verify_chip_entry_84xx
{
1585 uint8_t entry_count
;
1586 uint8_t sys_defined
;
1587 uint8_t entry_status
;
1592 #define VCO_DONT_UPDATE_FW BIT_0
1593 #define VCO_FORCE_UPDATE BIT_1
1594 #define VCO_DONT_RESET_UPDATE BIT_2
1595 #define VCO_DIAG_FW BIT_3
1596 #define VCO_END_OF_DATA BIT_14
1597 #define VCO_ENABLE_DSD BIT_15
1599 uint16_t reserved_1
;
1601 uint16_t data_seg_cnt
;
1602 uint16_t reserved_2
[3];
1605 uint32_t exchange_address
;
1607 uint32_t reserved_3
[3];
1609 uint32_t fw_seq_size
;
1610 uint32_t relative_offset
;
1615 struct verify_chip_rsp_84xx
{
1617 uint8_t entry_count
;
1618 uint8_t sys_defined
;
1619 uint8_t entry_status
;
1623 uint16_t comp_status
;
1624 #define CS_VCS_CHIP_FAILURE 0x3
1625 #define CS_VCS_BAD_EXCHANGE 0x8
1626 #define CS_VCS_SEQ_COMPLETEi 0x40
1628 uint16_t failure_code
;
1629 #define VFC_CHECKSUM_ERROR 0x1
1630 #define VFC_INVALID_LEN 0x2
1631 #define VFC_ALREADY_IN_PROGRESS 0x8
1633 uint16_t reserved_1
[4];
1636 uint32_t exchange_address
;
1638 uint32_t reserved_2
[6];
1641 #define ACCESS_CHIP_IOCB_TYPE 0x2B
1642 struct access_chip_84xx
{
1644 uint8_t entry_count
;
1645 uint8_t sys_defined
;
1646 uint8_t entry_status
;
1651 #define ACO_DUMP_MEMORY 0x0
1652 #define ACO_LOAD_MEMORY 0x1
1653 #define ACO_CHANGE_CONFIG_PARAM 0x2
1654 #define ACO_REQUEST_INFO 0x3
1658 uint16_t dseg_count
;
1659 uint16_t reserved2
[3];
1661 uint32_t parameter1
;
1662 uint32_t parameter2
;
1663 uint32_t parameter3
;
1665 uint32_t reserved3
[3];
1666 uint32_t total_byte_cnt
;
1672 struct access_chip_rsp_84xx
{
1674 uint8_t entry_count
;
1675 uint8_t sys_defined
;
1676 uint8_t entry_status
;
1680 uint16_t comp_status
;
1681 uint16_t failure_code
;
1682 uint32_t residual_count
;
1684 uint32_t reserved
[12];
1687 /* 81XX Support **************************************************************/
1689 #define MBA_DCBX_START 0x8016
1690 #define MBA_DCBX_COMPLETE 0x8030
1691 #define MBA_FCF_CONF_ERR 0x8031
1692 #define MBA_DCBX_PARAM_UPDATE 0x8032
1693 #define MBA_IDC_COMPLETE 0x8100
1694 #define MBA_IDC_NOTIFY 0x8101
1695 #define MBA_IDC_TIME_EXT 0x8102
1697 #define MBC_IDC_ACK 0x101
1698 #define MBC_RESTART_MPI_FW 0x3d
1699 #define MBC_FLASH_ACCESS_CTRL 0x3e /* Control flash access. */
1700 #define MBC_GET_XGMAC_STATS 0x7a
1701 #define MBC_GET_DCBX_PARAMS 0x51
1704 * ISP83xx mailbox commands
1706 #define MBC_WRITE_REMOTE_REG 0x0001 /* Write remote register */
1707 #define MBC_READ_REMOTE_REG 0x0009 /* Read remote register */
1708 #define MBC_RESTART_NIC_FIRMWARE 0x003d /* Restart NIC firmware */
1709 #define MBC_SET_ACCESS_CONTROL 0x003e /* Access control command */
1711 /* Flash access control option field bit definitions */
1712 #define FAC_OPT_FORCE_SEMAPHORE BIT_15
1713 #define FAC_OPT_REQUESTOR_ID BIT_14
1714 #define FAC_OPT_CMD_SUBCODE 0xff
1716 /* Flash access control command subcodes */
1717 #define FAC_OPT_CMD_WRITE_PROTECT 0x00
1718 #define FAC_OPT_CMD_WRITE_ENABLE 0x01
1719 #define FAC_OPT_CMD_ERASE_SECTOR 0x02
1720 #define FAC_OPT_CMD_LOCK_SEMAPHORE 0x03
1721 #define FAC_OPT_CMD_UNLOCK_SEMAPHORE 0x04
1722 #define FAC_OPT_CMD_GET_SECTOR_SIZE 0x05
1724 /* enhanced features bit definitions */
1725 #define NEF_LR_DIST_ENABLE BIT_0
1727 /* LR Distance bit positions */
1728 #define LR_DIST_NV_POS 2
1729 #define LR_DIST_FW_POS 12
1730 #define LR_DIST_FW_SHIFT (LR_DIST_FW_POS - LR_DIST_NV_POS)
1731 #define LR_DIST_FW_FIELD(x) ((x) << LR_DIST_FW_SHIFT & 0xf000)
1733 /* FAC semaphore defines */
1734 #define FAC_SEMAPHORE_UNLOCK 0
1735 #define FAC_SEMAPHORE_LOCK 1
1740 uint16_t nvram_version
;
1741 uint16_t reserved_0
;
1743 /* Firmware Initialization Control Block. */
1745 uint16_t reserved_1
;
1746 uint16_t frame_payload_size
;
1747 uint16_t execution_throttle
;
1748 uint16_t exchange_count
;
1749 uint16_t reserved_2
;
1751 uint8_t port_name
[WWN_SIZE
];
1752 uint8_t node_name
[WWN_SIZE
];
1754 uint16_t login_retry_count
;
1755 uint16_t reserved_3
;
1756 uint16_t interrupt_delay_timer
;
1757 uint16_t login_timeout
;
1759 uint32_t firmware_options_1
;
1760 uint32_t firmware_options_2
;
1761 uint32_t firmware_options_3
;
1763 uint16_t reserved_4
[4];
1766 uint8_t enode_mac
[6];
1767 uint16_t reserved_5
[5];
1770 uint16_t reserved_6
[24];
1773 uint16_t ex_version
;
1774 uint8_t prio_fcf_matching_flags
;
1775 uint8_t reserved_6_1
[3];
1776 uint16_t pri_fcf_vlan_id
;
1777 uint8_t pri_fcf_fabric_name
[8];
1778 uint16_t reserved_6_2
[7];
1779 uint8_t spma_mac_addr
[6];
1780 uint16_t reserved_6_3
[14];
1783 uint8_t min_supported_speed
;
1784 uint8_t reserved_7_0
;
1785 uint16_t reserved_7
[31];
1788 * BIT 0 = Enable spinup delay
1789 * BIT 1 = Disable BIOS
1790 * BIT 2 = Enable Memory Map BIOS
1791 * BIT 3 = Enable Selectable Boot
1792 * BIT 4 = Disable RISC code load
1793 * BIT 5 = Disable Serdes
1794 * BIT 6 = Opt boot mode
1795 * BIT 7 = Interrupt enable
1797 * BIT 8 = EV Control enable
1798 * BIT 9 = Enable lip reset
1799 * BIT 10 = Enable lip full login
1800 * BIT 11 = Enable target reset
1801 * BIT 12 = Stop firmware
1802 * BIT 13 = Enable nodename option
1803 * BIT 14 = Default WWPN valid
1804 * BIT 15 = Enable alternate WWN
1806 * BIT 16 = CLP LUN string
1807 * BIT 17 = CLP Target string
1808 * BIT 18 = CLP BIOS enable string
1809 * BIT 19 = CLP Serdes string
1810 * BIT 20 = CLP WWPN string
1811 * BIT 21 = CLP WWNN string
1814 * BIT 24 = Keep WWPN
1815 * BIT 25 = Temp WWPN
1820 uint8_t alternate_port_name
[WWN_SIZE
];
1821 uint8_t alternate_node_name
[WWN_SIZE
];
1823 uint8_t boot_port_name
[WWN_SIZE
];
1824 uint16_t boot_lun_number
;
1825 uint16_t reserved_8
;
1827 uint8_t alt1_boot_port_name
[WWN_SIZE
];
1828 uint16_t alt1_boot_lun_number
;
1829 uint16_t reserved_9
;
1831 uint8_t alt2_boot_port_name
[WWN_SIZE
];
1832 uint16_t alt2_boot_lun_number
;
1833 uint16_t reserved_10
;
1835 uint8_t alt3_boot_port_name
[WWN_SIZE
];
1836 uint16_t alt3_boot_lun_number
;
1837 uint16_t reserved_11
;
1840 * BIT 0 = Selective Login
1841 * BIT 1 = Alt-Boot Enable
1843 * BIT 3 = Boot Order List
1845 * BIT 5 = Selective LUN
1849 uint32_t efi_parameters
;
1851 uint8_t reset_delay
;
1852 uint8_t reserved_12
;
1853 uint16_t reserved_13
;
1855 uint16_t boot_id_number
;
1856 uint16_t reserved_14
;
1858 uint16_t max_luns_per_target
;
1859 uint16_t reserved_15
;
1861 uint16_t port_down_retry_count
;
1862 uint16_t link_down_timeout
;
1864 /* FCode parameters. */
1865 uint16_t fcode_parameter
;
1867 uint16_t reserved_16
[3];
1870 uint8_t reserved_17
[4];
1871 uint16_t reserved_18
[5];
1872 uint8_t reserved_19
[2];
1873 uint16_t reserved_20
[8];
1876 uint8_t reserved_21
[16];
1877 uint16_t reserved_22
[3];
1879 /* Offset 406 (0x196) Enhanced Features
1880 * BIT 0 = Extended BB credits for LR
1881 * BIT 1 = Virtual Fabric Enable
1882 * BIT 2-5 = Distance Support if BIT 0 is on
1885 uint16_t enhanced_features
;
1886 uint16_t reserved_24
[4];
1889 uint16_t reserved_25
[32];
1892 uint8_t model_name
[16];
1895 uint16_t feature_mask_l
;
1896 uint16_t feature_mask_h
;
1897 uint16_t reserved_26
[2];
1899 uint16_t subsystem_vendor_id
;
1900 uint16_t subsystem_device_id
;
1906 * ISP Initialization Control Block.
1907 * Little endian except where noted.
1909 #define ICB_VERSION 1
1910 struct init_cb_81xx
{
1912 uint16_t reserved_1
;
1914 uint16_t frame_payload_size
;
1915 uint16_t execution_throttle
;
1916 uint16_t exchange_count
;
1918 uint16_t reserved_2
;
1920 uint8_t port_name
[WWN_SIZE
]; /* Big endian. */
1921 uint8_t node_name
[WWN_SIZE
]; /* Big endian. */
1923 uint16_t response_q_inpointer
;
1924 uint16_t request_q_outpointer
;
1926 uint16_t login_retry_count
;
1928 uint16_t prio_request_q_outpointer
;
1930 uint16_t response_q_length
;
1931 uint16_t request_q_length
;
1933 uint16_t reserved_3
;
1935 uint16_t prio_request_q_length
;
1937 __le64 request_q_address __packed
;
1938 __le64 response_q_address __packed
;
1939 __le64 prio_request_q_address __packed
;
1941 uint8_t reserved_4
[8];
1943 uint16_t atio_q_inpointer
;
1944 uint16_t atio_q_length
;
1945 __le64 atio_q_address __packed
;
1947 uint16_t interrupt_delay_timer
; /* 100us increments. */
1948 uint16_t login_timeout
;
1951 * BIT 0-3 = Reserved
1952 * BIT 4 = Enable Target Mode
1953 * BIT 5 = Disable Initiator Mode
1957 * BIT 8-13 = Reserved
1958 * BIT 14 = Node Name Option
1959 * BIT 15-31 = Reserved
1961 uint32_t firmware_options_1
;
1964 * BIT 0 = Operation Mode bit 0
1965 * BIT 1 = Operation Mode bit 1
1966 * BIT 2 = Operation Mode bit 2
1967 * BIT 3 = Operation Mode bit 3
1968 * BIT 4-7 = Reserved
1970 * BIT 8 = Enable Class 2
1971 * BIT 9 = Enable ACK0
1973 * BIT 11 = Enable FC-SP Security
1974 * BIT 12 = FC Tape Enable
1976 * BIT 14 = Enable Target PRLI Control
1977 * BIT 15-31 = Reserved
1979 uint32_t firmware_options_2
;
1982 * BIT 0-3 = Reserved
1983 * BIT 4 = FCP RSP Payload bit 0
1984 * BIT 5 = FCP RSP Payload bit 1
1985 * BIT 6 = Enable Receive Out-of-Order data frame handling
1989 * BIT 9 = Enable Out-of-Order FCP_XFER_RDY relative offset handling
1990 * BIT 10-16 = Reserved
1991 * BIT 17 = Enable multiple FCFs
1992 * BIT 18-20 = MAC addressing mode
1993 * BIT 21-25 = Ethernet data rate
1994 * BIT 26 = Enable ethernet header rx IOCB for ATIO q
1995 * BIT 27 = Enable ethernet header rx IOCB for response q
1996 * BIT 28 = SPMA selection bit 0
1997 * BIT 28 = SPMA selection bit 1
1998 * BIT 30-31 = Reserved
2000 uint32_t firmware_options_3
;
2002 uint8_t reserved_5
[8];
2004 uint8_t enode_mac
[6];
2006 uint8_t reserved_6
[10];
2009 struct mid_init_cb_81xx
{
2010 struct init_cb_81xx init_cb
;
2015 struct mid_conf_entry_24xx entries
[MAX_MULTI_ID_FABRIC
];
2018 struct ex_init_cb_81xx
{
2019 uint16_t ex_version
;
2020 uint8_t prio_fcf_matching_flags
;
2021 uint8_t reserved_1
[3];
2022 uint16_t pri_fcf_vlan_id
;
2023 uint8_t pri_fcf_fabric_name
[8];
2024 uint16_t reserved_2
[7];
2025 uint8_t spma_mac_addr
[6];
2026 uint16_t reserved_3
[14];
2029 #define FARX_ACCESS_FLASH_CONF_81XX 0x7FFD0000
2030 #define FARX_ACCESS_FLASH_DATA_81XX 0x7F800000
2031 #define FARX_ACCESS_FLASH_CONF_28XX 0x7FFD0000
2032 #define FARX_ACCESS_FLASH_DATA_28XX 0x7F7D0000
2034 /* FCP priority config defines *************************************/
2036 #define QLFC_FCP_PRIO_DISABLE 0x0
2037 #define QLFC_FCP_PRIO_ENABLE 0x1
2038 #define QLFC_FCP_PRIO_GET_CONFIG 0x2
2039 #define QLFC_FCP_PRIO_SET_CONFIG 0x3
2041 struct qla_fcp_prio_entry
{
2042 uint16_t flags
; /* Describes parameter(s) in FCP */
2043 /* priority entry that are valid */
2044 #define FCP_PRIO_ENTRY_VALID 0x1
2045 #define FCP_PRIO_ENTRY_TAG_VALID 0x2
2046 #define FCP_PRIO_ENTRY_SPID_VALID 0x4
2047 #define FCP_PRIO_ENTRY_DPID_VALID 0x8
2048 #define FCP_PRIO_ENTRY_LUNB_VALID 0x10
2049 #define FCP_PRIO_ENTRY_LUNE_VALID 0x20
2050 #define FCP_PRIO_ENTRY_SWWN_VALID 0x40
2051 #define FCP_PRIO_ENTRY_DWWN_VALID 0x80
2052 uint8_t tag
; /* Priority value */
2053 uint8_t reserved
; /* Reserved for future use */
2054 uint32_t src_pid
; /* Src port id. high order byte */
2055 /* unused; -1 (wild card) */
2056 uint32_t dst_pid
; /* Src port id. high order byte */
2057 /* unused; -1 (wild card) */
2058 uint16_t lun_beg
; /* 1st lun num of lun range. */
2059 /* -1 (wild card) */
2060 uint16_t lun_end
; /* 2nd lun num of lun range. */
2061 /* -1 (wild card) */
2062 uint8_t src_wwpn
[8]; /* Source WWPN: -1 (wild card) */
2063 uint8_t dst_wwpn
[8]; /* Destination WWPN: -1 (wild card) */
2066 struct qla_fcp_prio_cfg
{
2067 uint8_t signature
[4]; /* "HQOS" signature of config data */
2068 uint16_t version
; /* 1: Initial version */
2069 uint16_t length
; /* config data size in num bytes */
2070 uint16_t checksum
; /* config data bytes checksum */
2071 uint16_t num_entries
; /* Number of entries */
2072 uint16_t size_of_entry
; /* Size of each entry in num bytes */
2073 uint8_t attributes
; /* enable/disable, persistence */
2074 #define FCP_PRIO_ATTR_DISABLE 0x0
2075 #define FCP_PRIO_ATTR_ENABLE 0x1
2076 #define FCP_PRIO_ATTR_PERSIST 0x2
2077 uint8_t reserved
; /* Reserved for future use */
2078 #define FCP_PRIO_CFG_HDR_SIZE 0x10
2079 struct qla_fcp_prio_entry entry
[1]; /* fcp priority entries */
2080 #define FCP_PRIO_CFG_ENTRY_SIZE 0x20
2083 #define FCP_PRIO_CFG_SIZE (32*1024) /* fcp prio data per port*/
2085 /* 25XX Support ****************************************************/
2086 #define FA_FCP_PRIO0_ADDR_25 0x3C000
2087 #define FA_FCP_PRIO1_ADDR_25 0x3E000
2089 /* 81XX Flash locations -- occupies second 2MB region. */
2090 #define FA_BOOT_CODE_ADDR_81 0x80000
2091 #define FA_RISC_CODE_ADDR_81 0xA0000
2092 #define FA_FW_AREA_ADDR_81 0xC0000
2093 #define FA_VPD_NVRAM_ADDR_81 0xD0000
2094 #define FA_VPD0_ADDR_81 0xD0000
2095 #define FA_VPD1_ADDR_81 0xD0400
2096 #define FA_NVRAM0_ADDR_81 0xD0080
2097 #define FA_NVRAM1_ADDR_81 0xD0180
2098 #define FA_FEATURE_ADDR_81 0xD4000
2099 #define FA_FLASH_DESCR_ADDR_81 0xD8000
2100 #define FA_FLASH_LAYOUT_ADDR_81 0xD8400
2101 #define FA_HW_EVENT0_ADDR_81 0xDC000
2102 #define FA_HW_EVENT1_ADDR_81 0xDC400
2103 #define FA_NPIV_CONF0_ADDR_81 0xD1000
2104 #define FA_NPIV_CONF1_ADDR_81 0xD2000
2106 /* 83XX Flash locations -- occupies second 8MB region. */
2107 #define FA_FLASH_LAYOUT_ADDR_83 (0x3F1000/4)
2108 #define FA_FLASH_LAYOUT_ADDR_28 (0x11000/4)
2110 #define NVRAM_DUAL_FCP_NVME_FLAG_OFFSET 0x196