12 #define MAX_PRST_DEV_DB_ENTRIES 64
13 #define MIN_DISC_DEV_DB_ENTRY MAX_PRST_DEV_DB_ENTRIES
14 #define MAX_DEV_DB_ENTRIES 512
15 #define MAX_DEV_DB_ENTRIES_40XX 256
55 #define HINT_MBX_INT_PENDING BIT_0
61 #define HSRX_RISC_MB_INT BIT_0
62 #define HSRX_RISC_IOCB_INT BIT_1
65 #define ISRX_82XX_RISC_INT BIT_0
99 #define INT_ENABLE_FW_MB (1 << 2)
100 #define INT_MASK_FW_MB (1 << 2)
104 #define MBOX_REG_COUNT 8
159 #define QL4010_DRVR_SEM_BITS 0x00000030
160 #define QL4010_GPIO_SEM_BITS 0x000000c0
161 #define QL4010_SDRAM_SEM_BITS 0x00000300
162 #define QL4010_PHY_SEM_BITS 0x00000c00
163 #define QL4010_NVRAM_SEM_BITS 0x00003000
164 #define QL4010_FLASH_SEM_BITS 0x0000c000
166 #define QL4010_DRVR_SEM_MASK 0x00300000
167 #define QL4010_GPIO_SEM_MASK 0x00c00000
168 #define QL4010_SDRAM_SEM_MASK 0x03000000
169 #define QL4010_PHY_SEM_MASK 0x0c000000
170 #define QL4010_NVRAM_SEM_MASK 0x30000000
171 #define QL4010_FLASH_SEM_MASK 0xc0000000
174 #define QL4022_RESOURCE_MASK_BASE_CODE 0x7
175 #define QL4022_RESOURCE_BITS_BASE_CODE 0x4
178 #define QL4022_DRVR_SEM_MASK (QL4022_RESOURCE_MASK_BASE_CODE << (1+16))
179 #define QL4022_DDR_RAM_SEM_MASK (QL4022_RESOURCE_MASK_BASE_CODE << (4+16))
180 #define QL4022_PHY_GIO_SEM_MASK (QL4022_RESOURCE_MASK_BASE_CODE << (7+16))
181 #define QL4022_NVRAM_SEM_MASK (QL4022_RESOURCE_MASK_BASE_CODE << (10+16))
182 #define QL4022_FLASH_SEM_MASK (QL4022_RESOURCE_MASK_BASE_CODE << (13+16))
185 #define NVRAM_PORT0_BOOT_MODE 0x03b1
186 #define NVRAM_PORT0_BOOT_PRI_TGT 0x03b2
187 #define NVRAM_PORT0_BOOT_SEC_TGT 0x03bb
188 #define NVRAM_PORT1_BOOT_MODE 0x07b1
189 #define NVRAM_PORT1_BOOT_PRI_TGT 0x07b2
190 #define NVRAM_PORT1_BOOT_SEC_TGT 0x07bb
194 #define PORT_CTRL_STAT_PAGE 0
195 #define HOST_MEM_CFG_PAGE 1
196 #define LOCAL_RAM_CFG_PAGE 2
197 #define PROT_STAT_PAGE 3
202 return (val & 0xffff) | (val << 16);
208 return 0 | (val << 16);
212 #define CSR_SCSI_PAGE_SELECT 0x00000003
213 #define CSR_SCSI_INTR_ENABLE 0x00000004
214 #define CSR_SCSI_RESET_INTR 0x00000008
215 #define CSR_SCSI_COMPLETION_INTR 0x00000010
216 #define CSR_SCSI_PROCESSOR_INTR 0x00000020
217 #define CSR_INTR_RISC 0x00000040
218 #define CSR_BOOT_ENABLE 0x00000080
219 #define CSR_NET_PAGE_SELECT 0x00000300
220 #define CSR_FUNC_NUM 0x00000700
221 #define CSR_NET_RESET_INTR 0x00000800
222 #define CSR_FORCE_SOFT_RESET 0x00002000
223 #define CSR_FATAL_ERROR 0x00004000
224 #define CSR_SOFT_RESET 0x00008000
225 #define ISP_CONTROL_FN_MASK CSR_FUNC_NUM
226 #define ISP_CONTROL_FN0_SCSI 0x0500
227 #define ISP_CONTROL_FN1_SCSI 0x0700
229 #define INTR_PENDING (CSR_SCSI_COMPLETION_INTR |\
230 CSR_SCSI_PROCESSOR_INTR |\
234 #define IMR_SCSI_INTR_ENABLE 0x00000004
237 #define NVR_WRITE_ENABLE 0x00000010
239 #define QL4010_NVRAM_SIZE 0x200
240 #define QL40X2_NVRAM_SIZE 0x800
247 #define GPOR_TOPCAT_RESET 0x00000004
283 #define FA_FLASH_LAYOUT_ADDR_82 0xFC400
284 #define FA_FLASH_DESCR_ADDR_82 0xFC000
285 #define FA_BOOT_LOAD_ADDR_82 0x04000
286 #define FA_BOOT_CODE_ADDR_82 0x20000
287 #define FA_RISC_CODE_ADDR_82 0x40000
288 #define FA_GOLD_RISC_CODE_ADDR_82 0x80000
289 #define FA_FLASH_ISCSI_CHAP 0x540000
290 #define FA_FLASH_CHAP_SIZE 0xC0000
342 #define FLT_REG_FDT 0x1a
343 #define FLT_REG_FLT 0x1c
344 #define FLT_REG_BOOTLOAD_82 0x72
345 #define FLT_REG_FW_82 0x74
346 #define FLT_REG_FW_82_1 0x97
347 #define FLT_REG_GOLD_FW_82 0x75
348 #define FLT_REG_BOOT_CODE_82 0x78
349 #define FLT_REG_ISCSI_PARAM 0x65
350 #define FLT_REG_ISCSI_CHAP 0x63
366 #define MBOX_CMD_ABOUT_FW 0x0009
367 #define MBOX_CMD_PING 0x000B
368 #define PING_IPV6_PROTOCOL_ENABLE 0x1
369 #define PING_IPV6_LINKLOCAL_ADDR 0x4
370 #define PING_IPV6_ADDR0 0x8
371 #define PING_IPV6_ADDR1 0xC
372 #define MBOX_CMD_ENABLE_INTRS 0x0010
373 #define INTR_DISABLE 0
374 #define INTR_ENABLE 1
375 #define MBOX_CMD_STOP_FW 0x0014
376 #define MBOX_CMD_ABORT_TASK 0x0015
377 #define MBOX_CMD_LUN_RESET 0x0016
378 #define MBOX_CMD_TARGET_WARM_RESET 0x0017
379 #define MBOX_CMD_GET_MANAGEMENT_DATA 0x001E
380 #define MBOX_CMD_GET_FW_STATUS 0x001F
381 #define MBOX_CMD_SET_ISNS_SERVICE 0x0021
382 #define ISNS_DISABLE 0
383 #define ISNS_ENABLE 1
384 #define MBOX_CMD_COPY_FLASH 0x0024
385 #define MBOX_CMD_WRITE_FLASH 0x0025
386 #define MBOX_CMD_READ_FLASH 0x0026
387 #define MBOX_CMD_CLEAR_DATABASE_ENTRY 0x0031
388 #define MBOX_CMD_CONN_OPEN 0x0074
389 #define MBOX_CMD_CONN_CLOSE_SESS_LOGOUT 0x0056
390 #define LOGOUT_OPTION_CLOSE_SESSION 0x0002
391 #define LOGOUT_OPTION_RELOGIN 0x0004
392 #define LOGOUT_OPTION_FREE_DDB 0x0008
393 #define MBOX_CMD_SET_PARAM 0x0059
394 #define SET_DRVR_VERSION 0x200
395 #define MAX_DRVR_VER_LEN 24
396 #define MBOX_CMD_EXECUTE_IOCB_A64 0x005A
397 #define MBOX_CMD_INITIALIZE_FIRMWARE 0x0060
398 #define MBOX_CMD_GET_INIT_FW_CTRL_BLOCK 0x0061
399 #define MBOX_CMD_REQUEST_DATABASE_ENTRY 0x0062
400 #define MBOX_CMD_SET_DATABASE_ENTRY 0x0063
401 #define MBOX_CMD_GET_DATABASE_ENTRY 0x0064
402 #define DDB_DS_UNASSIGNED 0x00
403 #define DDB_DS_NO_CONNECTION_ACTIVE 0x01
404 #define DDB_DS_DISCOVERY 0x02
405 #define DDB_DS_SESSION_ACTIVE 0x04
406 #define DDB_DS_SESSION_FAILED 0x06
407 #define DDB_DS_LOGIN_IN_PROCESS 0x07
408 #define MBOX_CMD_GET_FW_STATE 0x0069
409 #define MBOX_CMD_GET_INIT_FW_CTRL_BLOCK_DEFAULTS 0x006A
410 #define MBOX_CMD_GET_SYS_INFO 0x0078
411 #define MBOX_CMD_GET_NVRAM 0x0078
412 #define MBOX_CMD_SET_NVRAM 0x0079
413 #define MBOX_CMD_RESTORE_FACTORY_DEFAULTS 0x0087
414 #define MBOX_CMD_SET_ACB 0x0088
415 #define MBOX_CMD_GET_ACB 0x0089
416 #define MBOX_CMD_DISABLE_ACB 0x008A
417 #define MBOX_CMD_GET_IPV6_NEIGHBOR_CACHE 0x008B
418 #define MBOX_CMD_GET_IPV6_DEST_CACHE 0x008C
419 #define MBOX_CMD_GET_IPV6_DEF_ROUTER_LIST 0x008D
420 #define MBOX_CMD_GET_IPV6_LCL_PREFIX_LIST 0x008E
421 #define MBOX_CMD_SET_IPV6_NEIGHBOR_CACHE 0x0090
422 #define MBOX_CMD_GET_IP_ADDR_STATE 0x0091
423 #define MBOX_CMD_SEND_IPV6_ROUTER_SOL 0x0092
424 #define MBOX_CMD_GET_DB_ENTRY_CURRENT_IP_ADDR 0x0093
425 #define MBOX_CMD_MINIDUMP 0x0129
428 #define MINIDUMP_GET_SIZE_SUBCOMMAND 0x00
429 #define MINIDUMP_GET_TMPLT_SUBCOMMAND 0x01
432 #define FW_STATE_READY 0x0000
433 #define FW_STATE_CONFIG_WAIT 0x0001
434 #define FW_STATE_WAIT_AUTOCONNECT 0x0002
435 #define FW_STATE_ERROR 0x0004
436 #define FW_STATE_CONFIGURING_IP 0x0008
439 #define FW_ADDSTATE_OPTICAL_MEDIA 0x0001
440 #define FW_ADDSTATE_DHCPv4_ENABLED 0x0002
441 #define FW_ADDSTATE_DHCPv4_LEASE_ACQUIRED 0x0004
442 #define FW_ADDSTATE_DHCPv4_LEASE_EXPIRED 0x0008
443 #define FW_ADDSTATE_LINK_UP 0x0010
444 #define FW_ADDSTATE_ISNS_SVC_ENABLED 0x0020
445 #define FW_ADDSTATE_LINK_SPEED_10MBPS 0x0100
446 #define FW_ADDSTATE_LINK_SPEED_100MBPS 0x0200
447 #define FW_ADDSTATE_LINK_SPEED_1GBPS 0x0400
448 #define FW_ADDSTATE_LINK_SPEED_10GBPS 0x0800
450 #define MBOX_CMD_GET_DATABASE_ENTRY_DEFAULTS 0x006B
451 #define IPV6_DEFAULT_DDB_ENTRY 0x0001
453 #define MBOX_CMD_CONN_OPEN_SESS_LOGIN 0x0074
454 #define MBOX_CMD_GET_CRASH_RECORD 0x0076
455 #define MBOX_CMD_GET_CONN_EVENT_LOG 0x0077
457 #define MBOX_CMD_IDC_ACK 0x0101
458 #define MBOX_CMD_PORT_RESET 0x0120
459 #define MBOX_CMD_SET_PORT_CONFIG 0x0122
462 #define MBOX_COMPLETION_STATUS 4
463 #define MBOX_STS_BUSY 0x0007
464 #define MBOX_STS_INTERMEDIATE_COMPLETION 0x1000
465 #define MBOX_STS_COMMAND_COMPLETE 0x4000
466 #define MBOX_STS_COMMAND_ERROR 0x4005
468 #define MBOX_ASYNC_EVENT_STATUS 8
469 #define MBOX_ASTS_SYSTEM_ERROR 0x8002
470 #define MBOX_ASTS_REQUEST_TRANSFER_ERROR 0x8003
471 #define MBOX_ASTS_RESPONSE_TRANSFER_ERROR 0x8004
472 #define MBOX_ASTS_PROTOCOL_STATISTIC_ALARM 0x8005
473 #define MBOX_ASTS_SCSI_COMMAND_PDU_REJECTED 0x8006
474 #define MBOX_ASTS_LINK_UP 0x8010
475 #define MBOX_ASTS_LINK_DOWN 0x8011
476 #define MBOX_ASTS_DATABASE_CHANGED 0x8014
477 #define MBOX_ASTS_UNSOLICITED_PDU_RECEIVED 0x8015
478 #define MBOX_ASTS_SELF_TEST_FAILED 0x8016
479 #define MBOX_ASTS_LOGIN_FAILED 0x8017
480 #define MBOX_ASTS_DNS 0x8018
481 #define MBOX_ASTS_HEARTBEAT 0x8019
482 #define MBOX_ASTS_NVRAM_INVALID 0x801A
483 #define MBOX_ASTS_MAC_ADDRESS_CHANGED 0x801B
484 #define MBOX_ASTS_IP_ADDRESS_CHANGED 0x801C
485 #define MBOX_ASTS_DHCP_LEASE_EXPIRED 0x801D
486 #define MBOX_ASTS_DHCP_LEASE_ACQUIRED 0x801F
487 #define MBOX_ASTS_ISNS_UNSOLICITED_PDU_RECEIVED 0x8021
488 #define MBOX_ASTS_DUPLICATE_IP 0x8025
489 #define MBOX_ASTS_ARP_COMPLETE 0x8026
490 #define MBOX_ASTS_SUBNET_STATE_CHANGE 0x8027
491 #define MBOX_ASTS_RESPONSE_QUEUE_FULL 0x8028
492 #define MBOX_ASTS_IP_ADDR_STATE_CHANGED 0x8029
493 #define MBOX_ASTS_IPV6_PREFIX_EXPIRED 0x802B
494 #define MBOX_ASTS_IPV6_ND_PREFIX_IGNORED 0x802C
495 #define MBOX_ASTS_IPV6_LCL_PREFIX_IGNORED 0x802D
496 #define MBOX_ASTS_ICMPV6_ERROR_MSG_RCVD 0x802E
497 #define MBOX_ASTS_IDC_COMPLETE 0x8100
498 #define MBOX_ASTS_IDC_NOTIFY 0x8101
499 #define MBOX_ASTS_TXSCVR_INSERTED 0x8130
500 #define MBOX_ASTS_TXSCVR_REMOVED 0x8131
502 #define ISNS_EVENT_DATA_RECEIVED 0x0000
503 #define ISNS_EVENT_CONNECTION_OPENED 0x0001
504 #define ISNS_EVENT_CONNECTION_FAILED 0x0002
505 #define MBOX_ASTS_IPSEC_SYSTEM_FATAL_ERROR 0x8022
506 #define MBOX_ASTS_SUBNET_STATE_CHANGE 0x8027
509 #define ACB_STATE_UNCONFIGURED 0x00
510 #define ACB_STATE_INVALID 0x01
511 #define ACB_STATE_ACQUIRING 0x02
512 #define ACB_STATE_TENTATIVE 0x03
513 #define ACB_STATE_DEPRICATED 0x04
514 #define ACB_STATE_VALID 0x05
515 #define ACB_STATE_DISABLING 0x06
518 #define FLASH_SEGMENT_IFCB 0x04000000
520 #define FLASH_OPT_RMW_HOLD 0
521 #define FLASH_OPT_RMW_INIT 1
522 #define FLASH_OPT_COMMIT 2
523 #define FLASH_OPT_RMW_COMMIT 3
530 #define IFCB_VER_MIN 0x01
531 #define IFCB_VER_MAX 0x02
535 #define FWOPT_HEARTBEAT_ENABLE 0x1000
536 #define FWOPT_SESSION_MODE 0x0040
537 #define FWOPT_INITIATOR_MODE 0x0020
538 #define FWOPT_TARGET_MODE 0x0010
539 #define FWOPT_ENABLE_CRBDB 0x8000
546 #define ADFWOPT_SERIALIZE_TASK_MGMT 0x0400
547 #define ADFWOPT_AUTOCONN_DISABLE 0x0002
565 #define TCPOPT_DHCP_ENABLE 0x0200
567 #define IPOPT_IPV4_PROTOCOL_ENABLE 0x8000
568 #define IPOPT_VLAN_TAGGING_ENABLE 0x2000
574 #define ACB_NOT_SUPPORTED 0x00
575 #define ACB_SUPPORTED 0x02
619 #define IPV6_OPT_IPV6_PROTOCOL_ENABLE 0x8000
620 #define IPV6_OPT_VLAN_TAGGING_ENABLE 0x2000
623 #define IPV6_ADDOPT_NEIGHBOR_DISCOVERY_ADDR_ENABLE 0x0002
625 #define IPV6_ADDOPT_AUTOCONFIG_LINK_LOCAL_ADDR 0x0001
635 #define IP_ADDRSTATE_UNCONFIGURED 0
636 #define IP_ADDRSTATE_INVALID 1
637 #define IP_ADDRSTATE_ACQUIRING 2
638 #define IP_ADDRSTATE_TENTATIVE 3
639 #define IP_ADDRSTATE_DEPRICATED 4
640 #define IP_ADDRSTATE_PREFERRED 5
641 #define IP_ADDRSTATE_DISABLING 6
644 #define IPV6_RTRSTATE_UNKNOWN 0
645 #define IPV6_RTRSTATE_MANUAL 1
646 #define IPV6_RTRSTATE_ADVERTISED 3
647 #define IPV6_RTRSTATE_STALE 4
664 #define IP_ADDR_COUNT 4
668 #define IP_STATE_MASK 0x0F000000
669 #define IP_STATE_SHIFT 24
676 #define PRIMARI_ACB 0
677 #define SECONDARY_ACB 1
749 #define MAX_CHAP_ENTRIES_40XX 128
750 #define MAX_CHAP_ENTRIES_82XX 1024
751 #define MAX_RESRV_CHAP_IDX 3
752 #define FLASH_CHAP_OFFSET 0x06000000
758 #define MIN_CHAP_SECRET_LEN 12
759 #define MAX_CHAP_SECRET_LEN 100
761 #define MAX_CHAP_NAME_LEN 256
764 #define CHAP_VALID_COOKIE 0x4092
765 #define CHAP_INVALID_COOKIE 0xFFEE
771 #define DDB_OPT_DISC_SESSION 0x10
772 #define DDB_OPT_TARGET 0x02
773 #define DDB_OPT_IPV6_DEVICE 0x100
774 #define DDB_OPT_AUTO_SENDTGTS_DISABLE 0x40
775 #define DDB_OPT_IPV6_NULL_LINK_LOCAL 0x800
776 #define DDB_OPT_IPV6_FW_DEFINED_LINK_LOCAL 0x800
785 #define BYTE_UNITS 512
823 #define DDB_VALID_COOKIE 0x9034
832 #define FLASH_OFFSET_SYS_INFO 0x02000000
833 #define FLASH_DEFAULTBLOCKSIZE 0x20000
834 #define FLASH_EOF_OFFSET (FLASH_DEFAULTBLOCKSIZE-8)
837 #define FLASH_RAW_ACCESS_ADDR 0x8e000000
839 #define BOOT_PARAM_OFFSET_PORT0 0x3b0
840 #define BOOT_PARAM_OFFSET_PORT1 0x7b0
842 #define FLASH_OFFSET_DB_INFO 0x05000000
843 #define FLASH_OFFSET_DB_END (FLASH_OFFSET_DB_INFO + 0x7fff)
946 #define MAX_CONN_EVENT_LOG_ENTRIES 100
954 uint8_t num_consecutive_events;
963 #define IOCB_MAX_CDB_LEN 16
964 #define IOCB_MAX_SENSEDATA_LEN 32
965 #define IOCB_MAX_EXT_SENSEDATA_LEN 60
970 #define ET_STATUS 0x03
971 #define ET_MARKER 0x04
972 #define ET_CONT_T1 0x0A
973 #define ET_STATUS_CONTINUATION 0x10
974 #define ET_CMND_T3 0x19
975 #define ET_PASSTHRU0 0x3A
976 #define ET_PASSTHRU_STATUS 0x3C
977 #define ET_MBOX_CMD 0x38
978 #define ET_MBOX_STATUS 0x39
982 #define SD_ISCSI_PDU 0x01
997 #define COMMAND_SEG_A64 1
998 #define CONTINUE_SEG_A64 5
1025 #define CF_WRITE 0x20
1026 #define CF_READ 0x40
1027 #define CF_NO_DATA 0x00
1030 #define CF_HEAD_TAG 0x03
1031 #define CF_ORDERED_TAG 0x02
1032 #define CF_SIMPLE_TAG 0x01
1062 #define COMMAND_SEG COMMAND_SEG_A64
1063 #define CONTINUE_SEG CONTINUE_SEG_A64
1065 #define ET_COMMAND ET_CMND_T3
1066 #define ET_CONTINUE ET_CONT_T1
1075 #define MM_LUN_RESET 0
1076 #define MM_TGT_WARM_RESET 1
1095 #define SCSI_CHECK_CONDITION 0x02
1098 #define ISCSI_FLAG_RESIDUAL_UNDER 0x02
1099 #define ISCSI_FLAG_RESIDUAL_OVER 0x04
1104 #define SCS_COMPLETE 0x00
1105 #define SCS_INCOMPLETE 0x01
1106 #define SCS_RESET_OCCURRED 0x04
1107 #define SCS_ABORTED 0x05
1108 #define SCS_TIMEOUT 0x06
1109 #define SCS_DATA_OVERRUN 0x07
1110 #define SCS_DATA_UNDERRUN 0x15
1111 #define SCS_QUEUE_FULL 0x1C
1112 #define SCS_DEVICE_UNAVAILABLE 0x28
1113 #define SCS_DEVICE_LOGGED_OUT 0x29
1141 #define ISNS_DEFAULT_SERVER_CONN_ID ((uint16_t)0x8000)
1144 #define PT_FLAG_ETHERNET_FRAME 0x8000
1145 #define PT_FLAG_ISNS_PDU 0x8000
1146 #define PT_FLAG_SEND_BUFFER 0x0200
1147 #define PT_FLAG_WAIT_4_RESPONSE 0x0100
1148 #define PT_FLAG_ISCSI_PDU 0x1000
1151 #define PT_DEFAULT_TIMEOUT 30
1166 #define PASSTHRU_STATUS_COMPLETE 0x01
1199 #define RESPONSE_PROCESSED 0xDEADDEAD
1241 #define QLA8XXX_DBG_STATE_ARRAY_LEN 16
1242 #define QLA8XXX_DBG_CAP_SIZE_ARRAY_LEN 8
1243 #define QLA8XXX_DBG_RSVD_ARRAY_LEN 8
1244 #define QLA83XX_DBG_OCM_WNDREG_ARRAY_LEN 16
1245 #define QLA83XX_SS_OCM_WNDREG_INDEX 3
1246 #define QLA83XX_SS_PCI_INDEX 0