10 #include <linux/kernel.h>
12 #include <linux/types.h>
13 #include <linux/module.h>
14 #include <linux/list.h>
15 #include <linux/pci.h>
17 #include <linux/sched.h>
18 #include <linux/slab.h>
29 #include <scsi/scsi.h>
38 #define QLA2XXX_DRIVER_NAME "qla2xxx"
39 #define QLA2XXX_APIDEV "ql2xapidev"
46 #define MAILBOX_REGISTER_COUNT_2100 8
47 #define MAILBOX_REGISTER_COUNT_2200 24
48 #define MAILBOX_REGISTER_COUNT 32
50 #define QLA2200A_RISC_ROM_VER 4
75 #define BIT_16 0x10000
76 #define BIT_17 0x20000
77 #define BIT_18 0x40000
78 #define BIT_19 0x80000
79 #define BIT_20 0x100000
80 #define BIT_21 0x200000
81 #define BIT_22 0x400000
82 #define BIT_23 0x800000
83 #define BIT_24 0x1000000
84 #define BIT_25 0x2000000
85 #define BIT_26 0x4000000
86 #define BIT_27 0x8000000
87 #define BIT_28 0x10000000
88 #define BIT_29 0x20000000
89 #define BIT_30 0x40000000
90 #define BIT_31 0x80000000
92 #define LSB(x) ((uint8_t)(x))
93 #define MSB(x) ((uint8_t)((uint16_t)(x) >> 8))
95 #define LSW(x) ((uint16_t)(x))
96 #define MSW(x) ((uint16_t)((uint32_t)(x) >> 16))
98 #define LSD(x) ((uint32_t)((uint64_t)(x)))
99 #define MSD(x) ((uint32_t)((((uint64_t)(x)) >> 16) >> 16))
101 #define MAKE_HANDLE(x, y) ((uint32_t)((((uint32_t)(x)) << 16) | (uint32_t)(y)))
107 #define RD_REG_BYTE(addr) readb(addr)
108 #define RD_REG_WORD(addr) readw(addr)
109 #define RD_REG_DWORD(addr) readl(addr)
110 #define RD_REG_BYTE_RELAXED(addr) readb_relaxed(addr)
111 #define RD_REG_WORD_RELAXED(addr) readw_relaxed(addr)
112 #define RD_REG_DWORD_RELAXED(addr) readl_relaxed(addr)
113 #define WRT_REG_BYTE(addr, data) writeb(data,addr)
114 #define WRT_REG_WORD(addr, data) writew(data,addr)
115 #define WRT_REG_DWORD(addr, data) writel(data,addr)
120 #define QLA83XX_LED_PORT0 0x00201320
121 #define QLA83XX_LED_PORT1 0x00201328
122 #define QLA83XX_IDC_DEV_STATE 0x22102384
123 #define QLA83XX_IDC_MAJOR_VERSION 0x22102380
124 #define QLA83XX_IDC_MINOR_VERSION 0x22102398
125 #define QLA83XX_IDC_DRV_PRESENCE 0x22102388
126 #define QLA83XX_IDC_DRIVER_ACK 0x2210238c
127 #define QLA83XX_IDC_CONTROL 0x22102390
128 #define QLA83XX_IDC_AUDIT 0x22102394
129 #define QLA83XX_IDC_LOCK_RECOVERY 0x2210239c
130 #define QLA83XX_DRIVER_LOCKID 0x22102104
131 #define QLA83XX_DRIVER_LOCK 0x8111c028
132 #define QLA83XX_DRIVER_UNLOCK 0x8111c02c
133 #define QLA83XX_FLASH_LOCKID 0x22102100
134 #define QLA83XX_FLASH_LOCK 0x8111c010
135 #define QLA83XX_FLASH_UNLOCK 0x8111c014
136 #define QLA83XX_DEV_PARTINFO1 0x221023e0
137 #define QLA83XX_DEV_PARTINFO2 0x221023e4
138 #define QLA83XX_FW_HEARTBEAT 0x221020b0
139 #define QLA83XX_PEG_HALT_STATUS1 0x221020a8
140 #define QLA83XX_PEG_HALT_STATUS2 0x221020ac
143 #define IDC_DEVICE_STATE_CHANGE BIT_0
144 #define IDC_PEG_HALT_STATUS_CHANGE BIT_1
145 #define IDC_NIC_FW_REPORTED_FAILURE BIT_2
146 #define IDC_HEARTBEAT_FAILURE BIT_3
149 #define ERR_LEVEL_NON_FATAL 0x1
150 #define ERR_LEVEL_RECOVERABLE_FATAL 0x2
151 #define ERR_LEVEL_UNRECOVERABLE_FATAL 0x4
154 #define QLA83XX_SUPP_IDC_MAJOR_VERSION 0x01
155 #define QLA83XX_SUPP_IDC_MINOR_VERSION 0x0
158 #define QLA83XX_NIC_CORE_RESET 0x1
159 #define QLA83XX_IDC_STATE_HANDLER 0x2
160 #define QLA83XX_NIC_CORE_UNRECOVERABLE 0x3
163 #define QLA83XX_IDC_RESET_DISABLED BIT_0
164 #define QLA83XX_IDC_GRACEFUL_RESET BIT_1
167 #define QLA83XX_IDC_INITIALIZATION_TIMEOUT 30
168 #define QLA83XX_IDC_RESET_ACK_TIMEOUT 10
169 #define QLA83XX_MAX_LOCK_RECOVERY_WAIT (2 * HZ)
172 #define QLA83XX_CLASS_TYPE_NONE 0x0
173 #define QLA83XX_CLASS_TYPE_NIC 0x1
174 #define QLA83XX_CLASS_TYPE_FCOE 0x2
175 #define QLA83XX_CLASS_TYPE_ISCSI 0x3
178 #define IDC_LOCK_RECOVERY_STAGE1 0x1
181 #define IDC_LOCK_RECOVERY_STAGE2 0x2
184 #define IDC_AUDIT_TIMESTAMP 0x0
188 #define IDC_AUDIT_COMPLETION 0x1
197 #define RD_REG_WORD_PIO(addr) (inw((unsigned long)addr))
198 #define WRT_REG_WORD_PIO(addr, data) (outw(data,(unsigned long)addr))
204 #define MAX_FIBRE_DEVICES_2100 512
205 #define MAX_FIBRE_DEVICES_2400 2048
206 #define MAX_FIBRE_DEVICES_LOOP 128
207 #define MAX_FIBRE_DEVICES_MAX MAX_FIBRE_DEVICES_2400
208 #define LOOPID_MAP_SIZE (ha->max_fibre_devices)
209 #define MAX_FIBRE_LUNS 0xFFFF
210 #define MAX_HOST_COUNT 16
217 #define MAX_LUNS MAX_FIBRE_LUNS
218 #define MAX_CMDS_PER_LUN 255
223 #define SNS_LAST_LOOP_ID_2100 0xfe
224 #define SNS_LAST_LOOP_ID_2300 0x7ff
226 #define LAST_LOCAL_LOOP_ID 0x7d
227 #define SNS_FL_PORT 0x7e
228 #define FABRIC_CONTROLLER 0x7f
229 #define SIMPLE_NAME_SERVER 0x80
230 #define SNS_FIRST_LOOP_ID 0x81
231 #define MANAGEMENT_SERVER 0xfe
232 #define BROADCAST 0xff
238 #define NPH_LAST_HANDLE 0x7ef
239 #define NPH_MGMT_SERVER 0x7fa
240 #define NPH_SNS 0x7fc
241 #define NPH_FABRIC_CONTROLLER 0x7fd
242 #define NPH_F_PORT 0x7fe
243 #define NPH_IP_BROADCAST 0x7ff
251 #define PORT_RETRY_TIME 1
252 #define LOOP_DOWN_TIMEOUT 60
253 #define LOOP_DOWN_TIME 255
254 #define LOOP_DOWN_RESET (LOOP_DOWN_TIME - 30)
257 #define MAX_OUTSTANDING_COMMANDS 1024
260 #define REQUEST_ENTRY_CNT_2100 128
261 #define REQUEST_ENTRY_CNT_2200 2048
262 #define REQUEST_ENTRY_CNT_24XX 2048
263 #define RESPONSE_ENTRY_CNT_2100 64
264 #define RESPONSE_ENTRY_CNT_2300 512
265 #define RESPONSE_ENTRY_CNT_MQ 128
266 #define ATIO_ENTRY_CNT_24XX 4096
293 #define SRB_DMA_VALID BIT_0
294 #define SRB_FCP_CMND_DMA_VALID BIT_12
295 #define SRB_CRC_CTX_DMA_VALID BIT_2
296 #define SRB_CRC_PROT_DMA_VALID BIT_4
297 #define SRB_CRC_CTX_DSD_VALID BIT_5
300 #define IS_PROT_IO(sp) (sp->flags & SRB_CRC_CTX_DSD_VALID)
309 #define SRB_LOGIN_RETRIED BIT_0
310 #define SRB_LOGIN_COND_PLOGI BIT_1
311 #define SRB_LOGIN_SKIP_PRLI BIT_2
331 #define SRB_LOGIN_CMD 1
332 #define SRB_LOGOUT_CMD 2
333 #define SRB_ELS_CMD_RPT 3
334 #define SRB_ELS_CMD_HST 4
336 #define SRB_ADISC_CMD 6
338 #define SRB_SCSI_CMD 8
339 #define SRB_BIDI_CMD 9
358 #define GET_CMD_SP(sp) (sp->u.scmd.cmd)
359 #define SET_CMD_SP(sp, cmd) (sp->u.scmd.cmd = cmd)
360 #define GET_CMD_CTX_SP(sp) (sp->u.scmd.ctx)
362 #define GET_CMD_SENSE_LEN(sp) \
363 (sp->u.scmd.request_sense_length)
364 #define SET_CMD_SENSE_LEN(sp, len) \
365 (sp->u.scmd.request_sense_length = len)
366 #define GET_CMD_SENSE_PTR(sp) \
367 (sp->u.scmd.request_sense_ptr)
368 #define SET_CMD_SENSE_PTR(sp, ptr) \
369 (sp->u.scmd.request_sense_ptr = ptr)
388 #define CSR_FLASH_64K_BANK BIT_3
389 #define CSR_FLASH_ENABLE BIT_1
390 #define CSR_ISP_SOFT_RESET BIT_0
393 #define ICR_EN_INT BIT_15
394 #define ICR_EN_RISC BIT_3
397 #define ISR_RISC_INT BIT_3
401 #define NVR_DESELECT 0
402 #define NVR_BUSY BIT_15
403 #define NVR_WRT_ENABLE BIT_14
404 #define NVR_PR_ENABLE BIT_13
405 #define NVR_DATA_IN BIT_3
406 #define NVR_DATA_OUT BIT_2
407 #define NVR_SELECT BIT_1
408 #define NVR_CLOCK BIT_0
410 #define NVR_WAIT_CNT 20000
434 #define HSR_RISC_INT BIT_15
435 #define HSR_RISC_PAUSED BIT_8
488 #define HCCR_HOST_INT BIT_7
489 #define HCCR_RISC_PAUSE BIT_5
491 #define HCCR_RESET_RISC 0x1000
492 #define HCCR_PAUSE_RISC 0x2000
493 #define HCCR_RELEASE_RISC 0x3000
494 #define HCCR_SET_HOST_INT 0x5000
495 #define HCCR_CLR_HOST_INT 0x6000
496 #define HCCR_CLR_RISC_INT 0x7000
497 #define HCCR_DISABLE_PARITY_PAUSE 0x4001
498 #define HCCR_ENABLE_PARITY 0xA000
503 #define GPIO_LED_MASK 0x00C0
504 #define GPIO_LED_GREEN_OFF_AMBER_OFF 0x0000
505 #define GPIO_LED_GREEN_ON_AMBER_OFF 0x0040
506 #define GPIO_LED_GREEN_OFF_AMBER_ON 0x0080
507 #define GPIO_LED_GREEN_ON_AMBER_ON 0x00C0
508 #define GPIO_LED_ALL_OFF 0x0000
509 #define GPIO_LED_RED_ON_OTHER_OFF 0x0001
510 #define GPIO_LED_RGA_ON 0x00C1
549 #define ISP_REQ_Q_IN(ha, reg) \
550 (IS_QLA2100(ha) || IS_QLA2200(ha) ? \
551 &(reg)->u.isp2100.mailbox4 : \
552 &(reg)->u.isp2300.req_q_in)
553 #define ISP_REQ_Q_OUT(ha, reg) \
554 (IS_QLA2100(ha) || IS_QLA2200(ha) ? \
555 &(reg)->u.isp2100.mailbox4 : \
556 &(reg)->u.isp2300.req_q_out)
557 #define ISP_RSP_Q_IN(ha, reg) \
558 (IS_QLA2100(ha) || IS_QLA2200(ha) ? \
559 &(reg)->u.isp2100.mailbox5 : \
560 &(reg)->u.isp2300.rsp_q_in)
561 #define ISP_RSP_Q_OUT(ha, reg) \
562 (IS_QLA2100(ha) || IS_QLA2200(ha) ? \
563 &(reg)->u.isp2100.mailbox5 : \
564 &(reg)->u.isp2300.rsp_q_out)
566 #define MAILBOX_REG(ha, reg, num) \
567 (IS_QLA2100(ha) || IS_QLA2200(ha) ? \
569 &(reg)->u.isp2100.mailbox0 + (num) : \
570 &(reg)->u_end.isp2200.mailbox8 + (num) - 8) : \
571 &(reg)->u.isp2300.mailbox0 + (num))
572 #define RD_MAILBOX_REG(ha, reg, num) \
573 RD_REG_WORD(MAILBOX_REG(ha, reg, num))
574 #define WRT_MAILBOX_REG(ha, reg, num, data) \
575 WRT_REG_WORD(MAILBOX_REG(ha, reg, num), data)
577 #define FB_CMD_REG(ha, reg) \
578 (IS_QLA2100(ha) || IS_QLA2200(ha) ? \
579 &(reg)->fb_cmd_2100 : \
580 &(reg)->u.isp2300.fb_cmd)
581 #define RD_FB_CMD_REG(ha, reg) \
582 RD_REG_WORD(FB_CMD_REG(ha, reg))
583 #define WRT_FB_CMD_REG(ha, reg, data) \
584 WRT_REG_WORD(FB_CMD_REG(ha, reg), data)
594 #define MBX_DMA_IN BIT_0
595 #define MBX_DMA_OUT BIT_1
596 #define IOCTL_CMD BIT_2
599 #define MBX_TOV_SECONDS 30
604 #define PROD_ID_1 0x4953
605 #define PROD_ID_2 0x0000
606 #define PROD_ID_2a 0x5020
607 #define PROD_ID_3 0x2020
612 #define MBS_FRM_ALIVE 0
613 #define MBS_CHKSUM_ERR 1
619 #define MBS_COMMAND_COMPLETE 0x4000
620 #define MBS_INVALID_COMMAND 0x4001
621 #define MBS_HOST_INTERFACE_ERROR 0x4002
622 #define MBS_TEST_FAILED 0x4003
623 #define MBS_COMMAND_ERROR 0x4005
624 #define MBS_COMMAND_PARAMETER_ERROR 0x4006
625 #define MBS_PORT_ID_USED 0x4007
626 #define MBS_LOOP_ID_USED 0x4008
627 #define MBS_ALL_IDS_IN_USE 0x4009
628 #define MBS_NOT_LOGGED_IN 0x400A
629 #define MBS_LINK_DOWN_ERROR 0x400B
630 #define MBS_DIAG_ECHO_TEST_ERROR 0x400C
635 #define MBA_ASYNC_EVENT 0x8000
636 #define MBA_RESET 0x8001
637 #define MBA_SYSTEM_ERR 0x8002
638 #define MBA_REQ_TRANSFER_ERR 0x8003
639 #define MBA_RSP_TRANSFER_ERR 0x8004
640 #define MBA_WAKEUP_THRES 0x8005
641 #define MBA_LIP_OCCURRED 0x8010
643 #define MBA_LOOP_UP 0x8011
644 #define MBA_LOOP_DOWN 0x8012
645 #define MBA_LIP_RESET 0x8013
646 #define MBA_PORT_UPDATE 0x8014
647 #define MBA_RSCN_UPDATE 0x8015
648 #define MBA_LIP_F8 0x8016
649 #define MBA_LOOP_INIT_ERR 0x8017
650 #define MBA_FABRIC_AUTH_REQ 0x801b
651 #define MBA_SCSI_COMPLETION 0x8020
652 #define MBA_CTIO_COMPLETION 0x8021
653 #define MBA_IP_COMPLETION 0x8022
654 #define MBA_IP_RECEIVE 0x8023
655 #define MBA_IP_BROADCAST 0x8024
656 #define MBA_IP_LOW_WATER_MARK 0x8025
657 #define MBA_IP_RCV_BUFFER_EMPTY 0x8026
658 #define MBA_IP_HDR_DATA_SPLIT 0x8027
660 #define MBA_TRACE_NOTIFICATION 0x8028
661 #define MBA_POINT_TO_POINT 0x8030
662 #define MBA_CMPLT_1_16BIT 0x8031
663 #define MBA_CMPLT_2_16BIT 0x8032
664 #define MBA_CMPLT_3_16BIT 0x8033
665 #define MBA_CMPLT_4_16BIT 0x8034
666 #define MBA_CMPLT_5_16BIT 0x8035
667 #define MBA_CHG_IN_CONNECTION 0x8036
668 #define MBA_RIO_RESPONSE 0x8040
669 #define MBA_ZIO_RESPONSE 0x8040
670 #define MBA_CMPLT_2_32BIT 0x8042
671 #define MBA_BYPASS_NOTIFICATION 0x8043
672 #define MBA_DISCARD_RND_FRAME 0x8048
673 #define MBA_REJECTED_FCP_CMD 0x8049
676 #define MBA_IDC_AEN 0x8200
679 #define INTR_ROM_MB_SUCCESS 0x1
680 #define INTR_ROM_MB_FAILED 0x2
681 #define INTR_MB_SUCCESS 0x10
682 #define INTR_MB_FAILED 0x11
683 #define INTR_ASYNC_EVENT 0x12
684 #define INTR_RSP_QUE_UPDATE 0x13
685 #define INTR_RSP_QUE_UPDATE_83XX 0x14
686 #define INTR_ATIO_QUE_UPDATE 0x1C
687 #define INTR_ATIO_RSP_QUE_UPDATE 0x1D
690 #define MBS_LB_RESET 0x17
694 #define FO1_AE_ON_LIPF8 BIT_0
695 #define FO1_AE_ALL_LIP_RESET BIT_1
696 #define FO1_CTIO_RETRY BIT_3
697 #define FO1_DISABLE_LIP_F7_SW BIT_4
698 #define FO1_DISABLE_100MS_LOS_WAIT BIT_5
699 #define FO1_DISABLE_GPIO6_7 BIT_6
700 #define FO1_AE_ON_LOOP_INIT_ERR BIT_7
701 #define FO1_SET_EMPHASIS_SWING BIT_8
702 #define FO1_AE_AUTO_BYPASS BIT_9
703 #define FO1_ENABLE_PURE_IOCB BIT_10
704 #define FO1_AE_PLOGI_RJT BIT_11
705 #define FO1_ENABLE_ABORT_SEQUENCE BIT_12
706 #define FO1_AE_QUEUE_FULL BIT_13
708 #define FO2_ENABLE_ATIO_TYPE_3 BIT_0
709 #define FO2_REV_LOOPBACK BIT_1
711 #define FO3_ENABLE_EMERG_IOCB BIT_0
712 #define FO3_AE_RND_ERROR BIT_1
715 #define ADD_FO_COUNT 3
716 #define ADD_FO1_DISABLE_GPIO_LED_CTRL BIT_6
717 #define ADD_FO1_ENABLE_PUREX_IOCB BIT_10
719 #define ADD_FO2_ENABLE_SEL_CLS2 BIT_5
721 #define ADD_FO3_NO_ABT_ON_LINK_DOWN BIT_14
726 #define MBC_LOAD_RAM 1
727 #define MBC_EXECUTE_FIRMWARE 2
728 #define MBC_WRITE_RAM_WORD 4
729 #define MBC_READ_RAM_WORD 5
730 #define MBC_MAILBOX_REGISTER_TEST 6
731 #define MBC_VERIFY_CHECKSUM 7
732 #define MBC_GET_FIRMWARE_VERSION 8
733 #define MBC_LOAD_RISC_RAM 9
734 #define MBC_DUMP_RISC_RAM 0xa
735 #define MBC_LOAD_RISC_RAM_EXTENDED 0xb
736 #define MBC_DUMP_RISC_RAM_EXTENDED 0xc
737 #define MBC_WRITE_RAM_WORD_EXTENDED 0xd
738 #define MBC_READ_RAM_EXTENDED 0xf
739 #define MBC_IOCB_COMMAND 0x12
740 #define MBC_STOP_FIRMWARE 0x14
741 #define MBC_ABORT_COMMAND 0x15
742 #define MBC_ABORT_DEVICE 0x16
743 #define MBC_ABORT_TARGET 0x17
744 #define MBC_RESET 0x18
745 #define MBC_GET_ADAPTER_LOOP_ID 0x20
746 #define MBC_GET_RETRY_COUNT 0x22
747 #define MBC_DISABLE_VI 0x24
748 #define MBC_ENABLE_VI 0x25
749 #define MBC_GET_FIRMWARE_OPTION 0x28
750 #define MBC_SET_FIRMWARE_OPTION 0x38
751 #define MBC_LOOP_PORT_BYPASS 0x40
752 #define MBC_LOOP_PORT_ENABLE 0x41
753 #define MBC_GET_RESOURCE_COUNTS 0x42
754 #define MBC_NON_PARTICIPATE 0x43
755 #define MBC_DIAGNOSTIC_ECHO 0x44
756 #define MBC_DIAGNOSTIC_LOOP_BACK 0x45
757 #define MBC_ONLINE_SELF_TEST 0x46
758 #define MBC_ENHANCED_GET_PORT_DATABASE 0x47
759 #define MBC_CONFIGURE_VF 0x4b
760 #define MBC_RESET_LINK_STATUS 0x52
761 #define MBC_IOCB_COMMAND_A64 0x54
762 #define MBC_PORT_LOGOUT 0x56
763 #define MBC_SEND_RNID_ELS 0x57
764 #define MBC_SET_RNID_PARAMS 0x59
765 #define MBC_GET_RNID_PARAMS 0x5a
766 #define MBC_DATA_RATE 0x5d
767 #define MBC_INITIALIZE_FIRMWARE 0x60
768 #define MBC_INITIATE_LIP 0x62
770 #define MBC_GET_FC_AL_POSITION_MAP 0x63
771 #define MBC_GET_PORT_DATABASE 0x64
772 #define MBC_CLEAR_ACA 0x65
773 #define MBC_TARGET_RESET 0x66
774 #define MBC_CLEAR_TASK_SET 0x67
775 #define MBC_ABORT_TASK_SET 0x68
776 #define MBC_GET_FIRMWARE_STATE 0x69
777 #define MBC_GET_PORT_NAME 0x6a
778 #define MBC_GET_LINK_STATUS 0x6b
779 #define MBC_LIP_RESET 0x6c
780 #define MBC_SEND_SNS_COMMAND 0x6e
782 #define MBC_LOGIN_FABRIC_PORT 0x6f
783 #define MBC_SEND_CHANGE_REQUEST 0x70
784 #define MBC_LOGOUT_FABRIC_PORT 0x71
785 #define MBC_LIP_FULL_LOGIN 0x72
786 #define MBC_LOGIN_LOOP_PORT 0x74
787 #define MBC_PORT_NODE_NAME_LIST 0x75
788 #define MBC_INITIALIZE_RECEIVE_QUEUE 0x77
789 #define MBC_UNLOAD_IP 0x79
790 #define MBC_GET_ID_LIST 0x7C
791 #define MBC_SEND_LFA_COMMAND 0x7D
792 #define MBC_LUN_RESET 0x7E
797 #define MBC_SERDES_PARAMS 0x10
798 #define MBC_GET_IOCB_STATUS 0x12
799 #define MBC_PORT_PARAMS 0x1A
800 #define MBC_GET_TIMEOUT_PARAMS 0x22
801 #define MBC_TRACE_CONTROL 0x27
802 #define MBC_GEN_SYSTEM_ERROR 0x2a
803 #define MBC_WRITE_SFP 0x30
804 #define MBC_READ_SFP 0x31
805 #define MBC_SET_TIMEOUT_PARAMS 0x32
806 #define MBC_MID_INITIALIZE_FIRMWARE 0x48
807 #define MBC_MID_GET_VP_DATABASE 0x49
808 #define MBC_MID_GET_VP_ENTRY 0x4a
809 #define MBC_HOST_MEMORY_COPY 0x53
810 #define MBC_SEND_RNFT_ELS 0x5e
811 #define MBC_GET_LINK_PRIV_STATS 0x6d
812 #define MBC_SET_VENDOR_ID 0x76
813 #define MBC_PORT_RESET 0x120
814 #define MBC_SET_PORT_CONFIG 0x122
815 #define MBC_GET_PORT_CONFIG 0x123
820 #define MBC_WRITE_MPI_REGISTER 0x01
823 #define FCAL_MAP_SIZE 128
826 #define MBX_31 BIT_31
827 #define MBX_30 BIT_30
828 #define MBX_29 BIT_29
829 #define MBX_28 BIT_28
830 #define MBX_27 BIT_27
831 #define MBX_26 BIT_26
832 #define MBX_25 BIT_25
833 #define MBX_24 BIT_24
834 #define MBX_23 BIT_23
835 #define MBX_22 BIT_22
836 #define MBX_21 BIT_21
837 #define MBX_20 BIT_20
838 #define MBX_19 BIT_19
839 #define MBX_18 BIT_18
840 #define MBX_17 BIT_17
841 #define MBX_16 BIT_16
842 #define MBX_15 BIT_15
843 #define MBX_14 BIT_14
844 #define MBX_13 BIT_13
845 #define MBX_12 BIT_12
846 #define MBX_11 BIT_11
847 #define MBX_10 BIT_10
862 #define FSTATE_CONFIG_WAIT 0
863 #define FSTATE_WAIT_AL_PA 1
864 #define FSTATE_WAIT_LOGIN 2
865 #define FSTATE_READY 3
866 #define FSTATE_LOSS_OF_SYNC 4
867 #define FSTATE_ERROR 5
868 #define FSTATE_REINIT 6
869 #define FSTATE_NON_PART 7
871 #define FSTATE_CONFIG_CORRECT 0
872 #define FSTATE_P2P_RCV_LIP 1
873 #define FSTATE_P2P_CHOOSE_LOOP 2
874 #define FSTATE_P2P_RCV_UNIDEN_LIP 3
875 #define FSTATE_FATAL_ERROR 4
876 #define FSTATE_LOOP_BACK_CONN 5
882 #define PORT_DATABASE_SIZE 128
920 uint8_t prli_svc_param_word_0[2];
922 uint8_t prli_svc_param_word_3[2];
932 #define PD_STATE_DISCOVERY 0
933 #define PD_STATE_WAIT_DISCOVERY_ACK 1
934 #define PD_STATE_PORT_LOGIN 2
935 #define PD_STATE_WAIT_PORT_LOGIN_ACK 3
936 #define PD_STATE_PROCESS_LOGIN 4
937 #define PD_STATE_WAIT_PROCESS_LOGIN_ACK 5
938 #define PD_STATE_PORT_LOGGED_IN 6
939 #define PD_STATE_PORT_UNAVAILABLE 7
940 #define PD_STATE_PROCESS_LOGOUT 8
941 #define PD_STATE_WAIT_PROCESS_LOGOUT_ACK 9
942 #define PD_STATE_PORT_LOGOUT 10
943 #define PD_STATE_WAIT_PORT_LOGOUT_ACK 11
946 #define QLA_ZIO_MODE_6 (BIT_2 | BIT_1)
947 #define QLA_ZIO_DISABLED 0
948 #define QLA_ZIO_DEFAULT_TIMER 2
954 #define ICB_VERSION 1
999 uint8_t command_resource_count;
1000 uint8_t immediate_notify_resource_count;
1023 uint8_t add_firmware_options[2];
1025 uint8_t response_accumulation_timer;
1026 uint8_t interrupt_delay_timer;
1055 #define GLSO_SEND_RPS BIT_0
1056 #define GLSO_USE_DID BIT_3
1077 #define NV_START_BIT BIT_2
1078 #define NV_WRITE_OP (BIT_26+BIT_24)
1079 #define NV_READ_OP (BIT_26+BIT_25)
1080 #define NV_ERASE_OP (BIT_26+BIT_25+BIT_24)
1081 #define NV_MASK_OP (BIT_26+BIT_25+BIT_24)
1082 #define NV_DELAY_COUNT 10
1098 uint8_t parameter_block_version;
1152 uint8_t add_firmware_options[2];
1154 uint8_t response_accumulation_timer;
1155 uint8_t interrupt_delay_timer;
1218 uint8_t seriallink_options[4];
1246 uint8_t port_down_retry_count;
1338 #define RESPONSE_PROCESSED 0xDEADDEAD
1349 #define ATIO_PROCESSED 0xDEADDEAD
1360 #define SET_TARGET_ID(ha, to, from) \
1362 if (HAS_EXTENDED_IDS(ha)) \
1363 to.extended = cpu_to_le16(from); \
1365 to.id.standard = (uint8_t)from; \
1371 #define COMMAND_TYPE 0x11
1381 #define CF_WRITE BIT_6
1382 #define CF_READ BIT_5
1383 #define CF_SIMPLE_TAG BIT_3
1384 #define CF_ORDERED_TAG BIT_2
1385 #define CF_HEAD_TAG BIT_1
1402 #define COMMAND_A64_TYPE 0x19
1426 #define CONTINUE_TYPE 0x02
1452 #define CONTINUE_A64_TYPE 0x0A
1470 #define PO_MODE_DIF_INSERT 0
1471 #define PO_MODE_DIF_REMOVE 1
1472 #define PO_MODE_DIF_PASS 2
1473 #define PO_MODE_DIF_REPLACE 3
1474 #define PO_MODE_DIF_TCP_CKSUM 6
1475 #define PO_ENABLE_DIF_BUNDLING BIT_8
1476 #define PO_ENABLE_INCR_GUARD_SEED BIT_3
1477 #define PO_DISABLE_INCR_REF_TAG BIT_5
1478 #define PO_DISABLE_GUARD_CHECK BIT_4
1528 #define CRC_CONTEXT_LEN_FW (offsetof(struct crc_context, fcp_cmnd.lun))
1529 #define CRC_CONTEXT_FCPCMND_OFF (offsetof(struct crc_context, fcp_cmnd.lun))
1534 #define STATUS_TYPE 0x03
1555 #define RF_RQ_DMA_ERROR BIT_6
1556 #define RF_INV_E_ORDER BIT_5
1557 #define RF_INV_E_COUNT BIT_4
1558 #define RF_INV_E_PARAM BIT_3
1559 #define RF_INV_E_TYPE BIT_2
1560 #define RF_BUSY BIT_1
1561 #define RF_MASK (RF_RQ_DMA_ERROR | RF_INV_E_ORDER | RF_INV_E_COUNT | \
1562 RF_INV_E_PARAM | RF_INV_E_TYPE | RF_BUSY)
1563 #define RF_MASK_24XX (RF_INV_E_ORDER | RF_INV_E_COUNT | RF_INV_E_PARAM | \
1569 #define SS_MASK 0xfff
1570 #define SS_RESIDUAL_UNDER BIT_11
1571 #define SS_RESIDUAL_OVER BIT_10
1572 #define SS_SENSE_LEN_VALID BIT_9
1573 #define SS_RESPONSE_INFO_LEN_VALID BIT_8
1575 #define SS_RESERVE_CONFLICT (BIT_4 | BIT_3)
1576 #define SS_BUSY_CONDITION BIT_3
1577 #define SS_CONDITION_MET BIT_2
1578 #define SS_CHECK_CONDITION BIT_1
1583 #define CS_COMPLETE 0x0
1584 #define CS_INCOMPLETE 0x1
1586 #define CS_TRANSPORT 0x3
1587 #define CS_RESET 0x4
1588 #define CS_ABORTED 0x5
1589 #define CS_TIMEOUT 0x6
1590 #define CS_DATA_OVERRUN 0x7
1591 #define CS_DIF_ERROR 0xC
1593 #define CS_DATA_UNDERRUN 0x15
1594 #define CS_QUEUE_FULL 0x1C
1595 #define CS_PORT_UNAVAILABLE 0x28
1597 #define CS_PORT_LOGGED_OUT 0x29
1598 #define CS_PORT_CONFIG_CHG 0x2A
1599 #define CS_PORT_BUSY 0x2B
1600 #define CS_COMPLETE_CHKCOND 0x30
1601 #define CS_BAD_PAYLOAD 0x80
1602 #define CS_UNKNOWN 0x81
1603 #define CS_RETRY 0x82
1604 #define CS_LOOP_DOWN_ABORT 0x83
1606 #define CS_BIDIR_RD_OVERRUN 0x700
1607 #define CS_BIDIR_RD_WR_OVERRUN 0x707
1608 #define CS_BIDIR_RD_OVERRUN_WR_UNDERRUN 0x715
1609 #define CS_BIDIR_RD_UNDERRUN 0x1500
1610 #define CS_BIDIR_RD_UNDERRUN_WR_OVERRUN 0x1507
1611 #define CS_BIDIR_RD_WR_UNDERRUN 0x1515
1612 #define CS_BIDIR_DMA 0x200
1616 #define SF_ABTS_TERMINATED BIT_10
1617 #define SF_LOGOUT_SENT BIT_13
1622 #define STATUS_CONT_TYPE 0x10
1635 #define STATUS_TYPE_21 0x21
1648 #define STATUS_TYPE_22 0x22
1660 #define MARKER_TYPE 0x04
1669 #define MK_SYNC_ID_LUN 0
1670 #define MK_SYNC_ID 1
1671 #define MK_SYNC_ALL 2
1672 #define MK_SYNC_LIP 3
1684 #define MS_IOCB_TYPE 0x29
1715 #define MBX_IOCB_TYPE 0x39
1721 #define SOURCE_SCSI 0x00
1722 #define SOURCE_IP 0x01
1723 #define SOURCE_VI 0x02
1724 #define SOURCE_SCTP 0x03
1725 #define SOURCE_MP 0x04
1726 #define SOURCE_MPIOCTL 0x05
1727 #define SOURCE_ASYNC_IOCB 0x07
1756 #define RESPONSE_ENTRY_SIZE (sizeof(response_t))
1757 #define REQUEST_ENTRY_SIZE (sizeof(request_t))
1771 #elif defined(__LITTLE_ENDIAN)
1776 #error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined!"
1781 #define INVALID_PORT_ID 0xFFFFFF
1796 #define FC4_TYPE_FCP_SCSI 0x08
1797 #define FC4_TYPE_OTHER 0x0
1798 #define FC4_TYPE_UNKNOWN 0xff
1844 #define QLA_FCPORT_SCAN_NONE 0
1845 #define QLA_FCPORT_SCAN_FOUND 1
1850 #define FCS_UNCONFIGURED 1
1851 #define FCS_DEVICE_DEAD 2
1852 #define FCS_DEVICE_LOST 3
1853 #define FCS_ONLINE 4
1855 static const char *
const port_state_str[] = {
1866 #define FCF_FABRIC_DEVICE BIT_0
1867 #define FCF_LOGIN_NEEDED BIT_1
1868 #define FCF_FCP2_DEVICE BIT_2
1869 #define FCF_ASYNC_SENT BIT_3
1870 #define FCF_CONF_COMP_SUPPORTED BIT_4
1873 #define FC_NO_LOOP_ID 0x1000
1881 #define CT_REJECT_RESPONSE 0x8001
1882 #define CT_ACCEPT_RESPONSE 0x8002
1883 #define CT_REASON_INVALID_COMMAND_CODE 0x01
1884 #define CT_REASON_CANNOT_PERFORM 0x09
1885 #define CT_REASON_COMMAND_UNSUPPORTED 0x0b
1886 #define CT_EXPL_ALREADY_REGISTERED 0x10
1888 #define NS_N_PORT_TYPE 0x01
1889 #define NS_NL_PORT_TYPE 0x02
1890 #define NS_NX_PORT_TYPE 0x7F
1892 #define GA_NXT_CMD 0x100
1893 #define GA_NXT_REQ_SIZE (16 + 4)
1894 #define GA_NXT_RSP_SIZE (16 + 620)
1896 #define GID_PT_CMD 0x1A1
1897 #define GID_PT_REQ_SIZE (16 + 4)
1899 #define GPN_ID_CMD 0x112
1900 #define GPN_ID_REQ_SIZE (16 + 4)
1901 #define GPN_ID_RSP_SIZE (16 + 8)
1903 #define GNN_ID_CMD 0x113
1904 #define GNN_ID_REQ_SIZE (16 + 4)
1905 #define GNN_ID_RSP_SIZE (16 + 8)
1907 #define GFT_ID_CMD 0x117
1908 #define GFT_ID_REQ_SIZE (16 + 4)
1909 #define GFT_ID_RSP_SIZE (16 + 32)
1911 #define RFT_ID_CMD 0x217
1912 #define RFT_ID_REQ_SIZE (16 + 4 + 32)
1913 #define RFT_ID_RSP_SIZE 16
1915 #define RFF_ID_CMD 0x21F
1916 #define RFF_ID_REQ_SIZE (16 + 4 + 2 + 1 + 1)
1917 #define RFF_ID_RSP_SIZE 16
1919 #define RNN_ID_CMD 0x213
1920 #define RNN_ID_REQ_SIZE (16 + 4 + 8)
1921 #define RNN_ID_RSP_SIZE 16
1923 #define RSNN_NN_CMD 0x239
1924 #define RSNN_NN_REQ_SIZE (16 + 8 + 1 + 255)
1925 #define RSNN_NN_RSP_SIZE 16
1927 #define GFPN_ID_CMD 0x11C
1928 #define GFPN_ID_REQ_SIZE (16 + 4)
1929 #define GFPN_ID_RSP_SIZE (16 + 8)
1931 #define GPSC_CMD 0x127
1932 #define GPSC_REQ_SIZE (16 + 8)
1933 #define GPSC_RSP_SIZE (16 + 2 + 2)
1935 #define GFF_ID_CMD 0x011F
1936 #define GFF_ID_REQ_SIZE (16 + 4)
1937 #define GFF_ID_RSP_SIZE (16 + 128)
1942 #define FDMI_HBA_ATTR_COUNT 9
1943 #define FDMI_HBA_NODE_NAME 1
1944 #define FDMI_HBA_MANUFACTURER 2
1945 #define FDMI_HBA_SERIAL_NUMBER 3
1946 #define FDMI_HBA_MODEL 4
1947 #define FDMI_HBA_MODEL_DESCRIPTION 5
1948 #define FDMI_HBA_HARDWARE_VERSION 6
1949 #define FDMI_HBA_DRIVER_VERSION 7
1950 #define FDMI_HBA_OPTION_ROM_VERSION 8
1951 #define FDMI_HBA_FIRMWARE_VERSION 9
1952 #define FDMI_HBA_OS_NAME_AND_VERSION 0xa
1953 #define FDMI_HBA_MAXIMUM_CT_PAYLOAD_LENGTH 0xb
1981 #define FDMI_PORT_ATTR_COUNT 6
1982 #define FDMI_PORT_FC4_TYPES 1
1983 #define FDMI_PORT_SUPPORT_SPEED 2
1984 #define FDMI_PORT_CURRENT_SPEED 3
1985 #define FDMI_PORT_MAX_FRAME_SIZE 4
1986 #define FDMI_PORT_OS_DEVICE_NAME 5
1987 #define FDMI_PORT_HOST_NAME 6
1989 #define FDMI_PORT_SPEED_1GB 0x1
1990 #define FDMI_PORT_SPEED_2GB 0x2
1991 #define FDMI_PORT_SPEED_10GB 0x4
1992 #define FDMI_PORT_SPEED_4GB 0x8
1993 #define FDMI_PORT_SPEED_8GB 0x10
1994 #define FDMI_PORT_SPEED_16GB 0x20
1995 #define FDMI_PORT_SPEED_UNKNOWN 0x8000
2019 #define GRHL_CMD 0x100
2020 #define GHAT_CMD 0x101
2021 #define GRPL_CMD 0x102
2022 #define GPAT_CMD 0x110
2024 #define RHBA_CMD 0x200
2025 #define RHBA_RSP_SIZE 16
2027 #define RHAT_CMD 0x201
2028 #define RPRT_CMD 0x210
2030 #define RPA_CMD 0x211
2031 #define RPA_RSP_SIZE 16
2033 #define DHBA_CMD 0x300
2034 #define DHBA_REQ_SIZE (16 + 8)
2035 #define DHBA_RSP_SIZE 16
2037 #define DHAT_CMD 0x301
2038 #define DPRT_CMD 0x310
2039 #define DPA_CMD 0x311
2189 entries[MAX_FIBRE_DEVICES_MAX];
2219 #define GFF_FCP_SCSI_OFFSET 7
2236 #define RFT_ID_SNS_SCMD_LEN 22
2237 #define RFT_ID_SNS_CMD_SIZE 60
2238 #define RFT_ID_SNS_DATA_SIZE 16
2240 #define RNN_ID_SNS_SCMD_LEN 10
2241 #define RNN_ID_SNS_CMD_SIZE 36
2242 #define RNN_ID_SNS_DATA_SIZE 16
2244 #define GA_NXT_SNS_SCMD_LEN 6
2245 #define GA_NXT_SNS_CMD_SIZE 28
2246 #define GA_NXT_SNS_DATA_SIZE (620 + 16)
2248 #define GID_PT_SNS_SCMD_LEN 6
2249 #define GID_PT_SNS_CMD_SIZE 28
2254 #define GID_PT_SNS_DATA_SIZE (MAX_FIBRE_DEVICES_2100 * 4 + 16)
2256 #define GPN_ID_SNS_SCMD_LEN 6
2257 #define GPN_ID_SNS_CMD_SIZE 28
2258 #define GPN_ID_SNS_DATA_SIZE (8 + 16)
2260 #define GNN_ID_SNS_SCMD_LEN 6
2261 #define GNN_ID_SNS_CMD_SIZE 28
2262 #define GNN_ID_SNS_DATA_SIZE (8 + 16)
2318 #define VP_OPTS_RETRY_ENABLE BIT_0
2319 #define VP_OPTS_VP_DISABLE BIT_1
2323 #define VP_RET_CODE_OK 0
2324 #define VP_RET_CODE_FATAL 1
2325 #define VP_RET_CODE_WRONG_ID 2
2326 #define VP_RET_CODE_WWPN 3
2327 #define VP_RET_CODE_RESOURCES 4
2328 #define VP_RET_CODE_NO_MEM 5
2329 #define VP_RET_CODE_NOT_FOUND 6
2392 #define QLA_MSIX_CHIP_REV_24XX 3
2393 #define QLA_MSIX_FW_MODE(m) (((m) & (BIT_7|BIT_8|BIT_9)) >> 7)
2394 #define QLA_MSIX_FW_MODE_1(m) (QLA_MSIX_FW_MODE(m) == 1)
2396 #define QLA_MSIX_DEFAULT 0x00
2397 #define QLA_MSIX_RSP_Q 0x01
2399 #define QLA_MIDX_DEFAULT 0
2400 #define QLA_MIDX_RSP_Q 1
2401 #define QLA_PCI_MSIX_CONTROL 0xa2
2402 #define QLA_83XX_PCI_MSIX_CONTROL 0x92
2413 #define WATCH_INTERVAL 1
2433 #define QLA_EVT_FLAG_FREE 0x1
2441 #define QLA_IDC_ACK_REGS 7
2446 #define QLA_LOGIO_LOGIN_RETRIED BIT_0
2451 #define QLA_UEVENT_CODE_FW_DUMP 0
2462 struct mutex fw_update_mutex;
2478 unsigned long long io_count;
2479 unsigned long long transfer_bytes;
2483 #define MBC_INITIALIZE_MULTIQ 0x1f
2484 #define QLA_QUE_PAGE 0X1000
2485 #define QLA_MQ_SIZE 32
2486 #define QLA_MAX_QUEUES 256
2487 #define ISP_QUE_REG(ha, id) \
2488 ((ha->mqenable || IS_QLA83XX(ha)) ? \
2489 ((void *)(ha->mqiobase) +\
2490 (QLA_QUE_PAGE * id)) :\
2491 ((void *)(ha->iobase)))
2492 #define QLA_REQ_QUE_ID(tag) \
2493 ((tag < QLA_MAX_QUEUES && tag > 0) ? tag : 0)
2494 #define QLA_DEFAULT_QUE_QOS 5
2495 #define QLA_PRECONFIG_VPORTS 32
2496 #define QLA_MAX_VPORTS_QLA24XX 128
2497 #define QLA_MAX_VPORTS_QLA25XX 256
2523 request_t *ring_ptr;
2561 void *target_lport_ptr;
2576 uint8_t saved_firmware_options[2];
2588 #define SRB_MIN_REQ 128
2622 uint32_t nic_core_reset_hdlr_active:1;
2643 #define MIN_IOBASE_LEN 0x100
2659 #define FLOGI_SEQ_DEL BIT_8
2660 #define FLOGI_MID_SUPPORT BIT_10
2661 #define FLOGI_VSAN_SUPPORT BIT_12
2662 #define FLOGI_SP_SUPPORT BIT_13
2676 #define PORT_SPEED_UNKNOWN 0xFFFF
2677 #define PORT_SPEED_1GB 0x00
2678 #define PORT_SPEED_2GB 0x01
2679 #define PORT_SPEED_4GB 0x03
2680 #define PORT_SPEED_8GB 0x04
2681 #define PORT_SPEED_16GB 0x05
2682 #define PORT_SPEED_10GB 0x13
2687 #define ISP_CFG_NL 1
2689 #define ISP_CFG_FL 4
2700 #define PCI_DEVICE_ID_QLOGIC_ISP2532 0x2532
2701 #define PCI_DEVICE_ID_QLOGIC_ISP8432 0x8432
2702 #define PCI_DEVICE_ID_QLOGIC_ISP8001 0x8001
2703 #define PCI_DEVICE_ID_QLOGIC_ISP8031 0x8031
2704 #define PCI_DEVICE_ID_QLOGIC_ISP2031 0x2031
2706 #define DT_ISP2100 BIT_0
2707 #define DT_ISP2200 BIT_1
2708 #define DT_ISP2300 BIT_2
2709 #define DT_ISP2312 BIT_3
2710 #define DT_ISP2322 BIT_4
2711 #define DT_ISP6312 BIT_5
2712 #define DT_ISP6322 BIT_6
2713 #define DT_ISP2422 BIT_7
2714 #define DT_ISP2432 BIT_8
2715 #define DT_ISP5422 BIT_9
2716 #define DT_ISP5432 BIT_10
2717 #define DT_ISP2532 BIT_11
2718 #define DT_ISP8432 BIT_12
2719 #define DT_ISP8001 BIT_13
2720 #define DT_ISP8021 BIT_14
2721 #define DT_ISP2031 BIT_15
2722 #define DT_ISP8031 BIT_16
2723 #define DT_ISP_LAST (DT_ISP8031 << 1)
2725 #define DT_T10_PI BIT_25
2726 #define DT_IIDMA BIT_26
2727 #define DT_FWI2 BIT_27
2728 #define DT_ZIO_SUPPORTED BIT_28
2729 #define DT_OEM_001 BIT_29
2730 #define DT_ISP2200A BIT_30
2731 #define DT_EXTENDED_IDS BIT_31
2732 #define DT_MASK(ha) ((ha)->device_type & (DT_ISP_LAST - 1))
2733 #define IS_QLA2100(ha) (DT_MASK(ha) & DT_ISP2100)
2734 #define IS_QLA2200(ha) (DT_MASK(ha) & DT_ISP2200)
2735 #define IS_QLA2300(ha) (DT_MASK(ha) & DT_ISP2300)
2736 #define IS_QLA2312(ha) (DT_MASK(ha) & DT_ISP2312)
2737 #define IS_QLA2322(ha) (DT_MASK(ha) & DT_ISP2322)
2738 #define IS_QLA6312(ha) (DT_MASK(ha) & DT_ISP6312)
2739 #define IS_QLA6322(ha) (DT_MASK(ha) & DT_ISP6322)
2740 #define IS_QLA2422(ha) (DT_MASK(ha) & DT_ISP2422)
2741 #define IS_QLA2432(ha) (DT_MASK(ha) & DT_ISP2432)
2742 #define IS_QLA5422(ha) (DT_MASK(ha) & DT_ISP5422)
2743 #define IS_QLA5432(ha) (DT_MASK(ha) & DT_ISP5432)
2744 #define IS_QLA2532(ha) (DT_MASK(ha) & DT_ISP2532)
2745 #define IS_QLA8432(ha) (DT_MASK(ha) & DT_ISP8432)
2746 #define IS_QLA8001(ha) (DT_MASK(ha) & DT_ISP8001)
2747 #define IS_QLA81XX(ha) (IS_QLA8001(ha))
2748 #define IS_QLA82XX(ha) (DT_MASK(ha) & DT_ISP8021)
2749 #define IS_QLA2031(ha) (DT_MASK(ha) & DT_ISP2031)
2750 #define IS_QLA8031(ha) (DT_MASK(ha) & DT_ISP8031)
2752 #define IS_QLA23XX(ha) (IS_QLA2300(ha) || IS_QLA2312(ha) || IS_QLA2322(ha) || \
2753 IS_QLA6312(ha) || IS_QLA6322(ha))
2754 #define IS_QLA24XX(ha) (IS_QLA2422(ha) || IS_QLA2432(ha))
2755 #define IS_QLA54XX(ha) (IS_QLA5422(ha) || IS_QLA5432(ha))
2756 #define IS_QLA25XX(ha) (IS_QLA2532(ha))
2757 #define IS_QLA83XX(ha) (IS_QLA2031(ha) || IS_QLA8031(ha))
2758 #define IS_QLA84XX(ha) (IS_QLA8432(ha))
2759 #define IS_QLA24XX_TYPE(ha) (IS_QLA24XX(ha) || IS_QLA54XX(ha) || \
2761 #define IS_CNA_CAPABLE(ha) (IS_QLA81XX(ha) || IS_QLA82XX(ha) || \
2763 #define IS_QLA2XXX_MIDTYPE(ha) (IS_QLA24XX(ha) || IS_QLA84XX(ha) || \
2764 IS_QLA25XX(ha) || IS_QLA81XX(ha) || \
2765 IS_QLA82XX(ha) || IS_QLA83XX(ha))
2766 #define IS_MSIX_NACK_CAPABLE(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha))
2767 #define IS_NOPOLLING_TYPE(ha) ((IS_QLA25XX(ha) || IS_QLA81XX(ha) || \
2768 IS_QLA83XX(ha)) && (ha)->flags.msix_enabled)
2769 #define IS_FAC_REQUIRED(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha))
2770 #define IS_NOCACHE_VPD_TYPE(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha))
2771 #define IS_ALOGIO_CAPABLE(ha) (IS_QLA23XX(ha) || IS_FWI2_CAPABLE(ha))
2773 #define IS_T10_PI_CAPABLE(ha) ((ha)->device_type & DT_T10_PI)
2774 #define IS_IIDMA_CAPABLE(ha) ((ha)->device_type & DT_IIDMA)
2775 #define IS_FWI2_CAPABLE(ha) ((ha)->device_type & DT_FWI2)
2776 #define IS_ZIO_SUPPORTED(ha) ((ha)->device_type & DT_ZIO_SUPPORTED)
2777 #define IS_OEM_001(ha) ((ha)->device_type & DT_OEM_001)
2778 #define HAS_EXTENDED_IDS(ha) ((ha)->device_type & DT_EXTENDED_IDS)
2779 #define IS_CT6_SUPPORTED(ha) ((ha)->device_type & DT_CT6_SUPPORTED)
2780 #define IS_MQUE_CAPABLE(ha) ((ha)->mqenable || IS_QLA83XX(ha))
2781 #define IS_BIDI_CAPABLE(ha) ((IS_QLA25XX(ha) || IS_QLA2031(ha)))
2783 #define IS_MCTP_CAPABLE(ha) (IS_QLA2031(ha) && \
2784 ((ha)->fw_attributes_ext[0] & BIT_0))
2785 #define IS_PI_UNINIT_CAPABLE(ha) (IS_QLA83XX(ha))
2786 #define IS_PI_IPGUARD_CAPABLE(ha) (IS_QLA83XX(ha))
2787 #define IS_PI_DIFB_DIX0_CAPABLE(ha) (0)
2788 #define IS_PI_SPLIT_DET_CAPABLE_HBA(ha) (IS_QLA83XX(ha))
2789 #define IS_PI_SPLIT_DET_CAPABLE(ha) (IS_PI_SPLIT_DET_CAPABLE_HBA(ha) && \
2790 (((ha)->fw_attributes_h << 16 | (ha)->fw_attributes) & BIT_22))
2798 #define MAX_NVRAM_SIZE 4096
2799 #define VPD_OFFSET MAX_NVRAM_SIZE / 2
2811 int port_down_retry_count;
2824 #define SFP_DEV_SIZE 256
2825 #define SFP_BLOCK_SIZE 64
2829 #define XGMAC_DATA_SIZE 4096
2833 #define DCBX_TLV_DATA_SIZE 4096
2842 int gid_list_info_size;
2845 #define DMA_POOL_SIZE 256
2863 unsigned long mbx_cmd_flags;
2864 #define MBX_INTERRUPT 1
2865 #define MBX_INTR_WAIT 2
2866 #define MBX_UPDATE_FLASH_ACTIVE 3
2868 struct mutex vport_lock;
2873 int notify_dcbx_comp;
2886 #define RISC_START_ADDRESS_2100 0x1000
2887 #define RISC_START_ADDRESS_2300 0x800
2888 #define RISC_START_ADDRESS_2400 0x100000
2903 int fw_dump_reading;
2907 #define MCTP_DUMP_SIZE 0x086064
2911 int mctp_dump_reading;
2928 #define BINZERO "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
2929 char model_desc[80];
2933 char *optrom_buffer;
2936 #define QLA_SWAITING 0
2937 #define QLA_SREADING 1
2938 #define QLA_SWRITING 2
2943 #define ROM_CODE_TYPE_BIOS 0
2944 #define ROM_CODE_TYPE_FCODE 1
2945 #define ROM_CODE_TYPE_EFI 3
2980 #define QLA_LED_GRN_ON 0x01
2981 #define QLA_LED_YLW_ON 0x02
2982 #define QLA_LED_ABR_ON 0x04
2983 #define QLA_LED_ALL_ON 0x07
2992 sizeof(
unsigned long)];
2996 int cur_vport_count;
3007 #define DSD_LIST_DMA_POOL_SIZE 512
3011 #define FCP_CMND_DMA_POOL_SIZE 512
3013 unsigned long nx_pcibase;
3015 unsigned long nxdb_wr_ptr;
3020 unsigned long mn_win_crb;
3021 unsigned long ms_win_crb;
3034 #define NUM_DSD_CHAIN 4096
3088 #define LOOP_TIMEOUT 1
3091 #define LOOP_UPDATE 4
3092 #define LOOP_READY 5
3095 unsigned long dpc_flags;
3096 #define RESET_MARKER_NEEDED 0
3097 #define RESET_ACTIVE 1
3098 #define ISP_ABORT_NEEDED 2
3099 #define ABORT_ISP_ACTIVE 3
3100 #define LOOP_RESYNC_NEEDED 4
3101 #define LOOP_RESYNC_ACTIVE 5
3102 #define LOCAL_LOOP_UPDATE 6
3103 #define RSCN_UPDATE 7
3104 #define RELOGIN_NEEDED 8
3105 #define REGISTER_FC4_NEEDED 9
3106 #define ISP_ABORT_RETRY 10
3107 #define BEACON_BLINK_NEEDED 11
3108 #define REGISTER_FDMI_NEEDED 12
3109 #define FCPORT_UPDATE_NEEDED 13
3110 #define VP_DPC_NEEDED 14
3111 #define UNLOADING 15
3112 #define NPIV_CONFIG_NEEDED 16
3113 #define ISP_UNRECOVERABLE 17
3114 #define FCOE_CTX_RESET_NEEDED 18
3115 #define MPI_RESET_NEEDED 19
3116 #define ISP_QUIESCE_NEEDED 20
3117 #define SCR_PENDING 21
3120 #define SWITCH_FOUND BIT_0
3121 #define DFLG_NO_CABLE BIT_1
3122 #define DFLG_DEV_FAILED BIT_5
3161 unsigned long vp_flags;
3162 #define VP_IDX_ACQUIRED 0
3163 #define VP_CREATE_NEEDED 1
3164 #define VP_BIND_NEEDED 2
3165 #define VP_DELETE_NEEDED 3
3166 #define VP_SCR_NEEDED 4
3168 #define VP_OFFLINE 0
3174 #define VP_ERR_UNKWN 0
3175 #define VP_ERR_PORTDWN 1
3176 #define VP_ERR_FAB_UNSUPPORTED 2
3177 #define VP_ERR_FAB_NORESOURCES 3
3178 #define VP_ERR_FAB_LOGOUT 4
3179 #define VP_ERR_ADAP_NORESOURCES 5
3182 int fw_heartbeat_counter;
3183 int seconds_since_last_heartbeat;
3191 #define SET_VP_IDX 1
3193 #define RESET_VP_IDX 3
3194 #define RESET_AL_PA 4
3203 #define LOOP_TRANSITION(ha) \
3204 (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
3205 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
3206 atomic_read(&ha->loop_state) == LOOP_DOWN)
3208 #define QLA_VHA_MARK_BUSY(__vha, __bail) do { \
3209 atomic_inc(&__vha->vref_count); \
3211 if (__vha->flags.delete_progress) { \
3212 atomic_dec(&__vha->vref_count); \
3219 #define QLA_VHA_MARK_NOT_BUSY(__vha) do { \
3220 atomic_dec(&__vha->vref_count); \
3226 #define MBS_MASK 0x3fff
3228 #define QLA_SUCCESS (MBS_COMMAND_COMPLETE & MBS_MASK)
3229 #define QLA_INVALID_COMMAND (MBS_INVALID_COMMAND & MBS_MASK)
3230 #define QLA_INTERFACE_ERROR (MBS_HOST_INTERFACE_ERROR & MBS_MASK)
3231 #define QLA_TEST_FAILED (MBS_TEST_FAILED & MBS_MASK)
3232 #define QLA_COMMAND_ERROR (MBS_COMMAND_ERROR & MBS_MASK)
3233 #define QLA_PARAMETER_ERROR (MBS_COMMAND_PARAMETER_ERROR & MBS_MASK)
3234 #define QLA_PORT_ID_USED (MBS_PORT_ID_USED & MBS_MASK)
3235 #define QLA_LOOP_ID_USED (MBS_LOOP_ID_USED & MBS_MASK)
3236 #define QLA_ALL_IDS_IN_USE (MBS_ALL_IDS_IN_USE & MBS_MASK)
3237 #define QLA_NOT_LOGGED_IN (MBS_NOT_LOGGED_IN & MBS_MASK)
3239 #define QLA_FUNCTION_TIMEOUT 0x100
3240 #define QLA_FUNCTION_PARAMETER_ERROR 0x101
3241 #define QLA_FUNCTION_FAILED 0x102
3242 #define QLA_MEMORY_ALLOC_FAILED 0x103
3243 #define QLA_LOCK_TIMEOUT 0x104
3244 #define QLA_ABORTED 0x105
3245 #define QLA_SUSPENDED 0x106
3246 #define QLA_BUSY 0x107
3247 #define QLA_ALREADY_REGISTERED 0x109
3249 #define NVRAM_DELAY() udelay(10)
3251 #define INVALID_HANDLE (MAX_OUTSTANDING_COMMANDS+1)
3256 #define OPTROM_SIZE_2300 0x20000
3257 #define OPTROM_SIZE_2322 0x100000
3258 #define OPTROM_SIZE_24XX 0x100000
3259 #define OPTROM_SIZE_25XX 0x200000
3260 #define OPTROM_SIZE_81XX 0x400000
3261 #define OPTROM_SIZE_82XX 0x800000
3262 #define OPTROM_SIZE_83XX 0x1000000
3264 #define OPTROM_BURST_SIZE 0x1000
3265 #define OPTROM_BURST_DWORDS (OPTROM_BURST_SIZE / 4)
3267 #define QLA_DSDS_PER_IOCB 37
3269 #define CMD_SP(Cmnd) ((Cmnd)->SCp.ptr)
3271 #define QLA_SG_ALL 1024