blob: 855226e086652c54475c4fad24d0edf1a07c2eff [file] [log] [blame]
David Somayajuluafaf5a22006-09-19 10:28:00 -07001/*
2 * QLogic iSCSI HBA Driver
3 * Copyright (c) 2003-2006 QLogic Corporation
4 *
5 * See LICENSE.qla4xxx for copyright and licensing details.
6 */
7
8#ifndef _QLA4X_FW_H
9#define _QLA4X_FW_H
10
11
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
16/*************************************************************************
17 *
18 * ISP 4010 I/O Register Set Structure and Definitions
19 *
20 *************************************************************************/
21
22struct port_ctrl_stat_regs {
David C Somayajulub2854312007-05-23 17:52:26 -070023 __le32 ext_hw_conf; /* 0x50 R/W */
24 __le32 rsrvd0; /* 0x54 */
25 __le32 port_ctrl; /* 0x58 */
26 __le32 port_status; /* 0x5c */
27 __le32 rsrvd1[32]; /* 0x60-0xdf */
28 __le32 gp_out; /* 0xe0 */
29 __le32 gp_in; /* 0xe4 */
30 __le32 rsrvd2[5]; /* 0xe8-0xfb */
31 __le32 port_err_status; /* 0xfc */
David Somayajuluafaf5a22006-09-19 10:28:00 -070032};
33
34struct host_mem_cfg_regs {
David C Somayajulub2854312007-05-23 17:52:26 -070035 __le32 rsrvd0[12]; /* 0x50-0x79 */
36 __le32 req_q_out; /* 0x80 */
37 __le32 rsrvd1[31]; /* 0x84-0xFF */
David Somayajuluafaf5a22006-09-19 10:28:00 -070038};
39
David Somayajuluafaf5a22006-09-19 10:28:00 -070040/* remote register set (access via PCI memory read/write) */
41struct isp_reg {
42#define MBOX_REG_COUNT 8
43 __le32 mailbox[MBOX_REG_COUNT];
44
45 __le32 flash_address; /* 0x20 */
46 __le32 flash_data;
47 __le32 ctrl_status;
48
49 union {
50 struct {
51 __le32 nvram;
52 __le32 reserved1[2]; /* 0x30 */
53 } __attribute__ ((packed)) isp4010;
54 struct {
55 __le32 intr_mask;
56 __le32 nvram; /* 0x30 */
57 __le32 semaphore;
58 } __attribute__ ((packed)) isp4022;
59 } u1;
60
61 __le32 req_q_in; /* SCSI Request Queue Producer Index */
62 __le32 rsp_q_out; /* SCSI Completion Queue Consumer Index */
63
64 __le32 reserved2[4]; /* 0x40 */
65
66 union {
67 struct {
68 __le32 ext_hw_conf; /* 0x50 */
69 __le32 flow_ctrl;
70 __le32 port_ctrl;
71 __le32 port_status;
72
73 __le32 reserved3[8]; /* 0x60 */
74
75 __le32 req_q_out; /* 0x80 */
76
77 __le32 reserved4[23]; /* 0x84 */
78
79 __le32 gp_out; /* 0xe0 */
80 __le32 gp_in;
81
82 __le32 reserved5[5];
83
84 __le32 port_err_status; /* 0xfc */
85 } __attribute__ ((packed)) isp4010;
86 struct {
87 union {
88 struct port_ctrl_stat_regs p0;
89 struct host_mem_cfg_regs p1;
David Somayajuluafaf5a22006-09-19 10:28:00 -070090 };
David Somayajuluafaf5a22006-09-19 10:28:00 -070091 } __attribute__ ((packed)) isp4022;
92 } u2;
93}; /* 256 x100 */
94
95
96/* Semaphore Defines for 4010 */
97#define QL4010_DRVR_SEM_BITS 0x00000030
98#define QL4010_GPIO_SEM_BITS 0x000000c0
99#define QL4010_SDRAM_SEM_BITS 0x00000300
100#define QL4010_PHY_SEM_BITS 0x00000c00
101#define QL4010_NVRAM_SEM_BITS 0x00003000
102#define QL4010_FLASH_SEM_BITS 0x0000c000
103
104#define QL4010_DRVR_SEM_MASK 0x00300000
105#define QL4010_GPIO_SEM_MASK 0x00c00000
106#define QL4010_SDRAM_SEM_MASK 0x03000000
107#define QL4010_PHY_SEM_MASK 0x0c000000
108#define QL4010_NVRAM_SEM_MASK 0x30000000
109#define QL4010_FLASH_SEM_MASK 0xc0000000
110
111/* Semaphore Defines for 4022 */
112#define QL4022_RESOURCE_MASK_BASE_CODE 0x7
113#define QL4022_RESOURCE_BITS_BASE_CODE 0x4
114
115
116#define QL4022_DRVR_SEM_MASK (QL4022_RESOURCE_MASK_BASE_CODE << (1+16))
117#define QL4022_DDR_RAM_SEM_MASK (QL4022_RESOURCE_MASK_BASE_CODE << (4+16))
118#define QL4022_PHY_GIO_SEM_MASK (QL4022_RESOURCE_MASK_BASE_CODE << (7+16))
119#define QL4022_NVRAM_SEM_MASK (QL4022_RESOURCE_MASK_BASE_CODE << (10+16))
120#define QL4022_FLASH_SEM_MASK (QL4022_RESOURCE_MASK_BASE_CODE << (13+16))
121
122
123
124/* Page # defines for 4022 */
125#define PORT_CTRL_STAT_PAGE 0 /* 4022 */
126#define HOST_MEM_CFG_PAGE 1 /* 4022 */
127#define LOCAL_RAM_CFG_PAGE 2 /* 4022 */
128#define PROT_STAT_PAGE 3 /* 4022 */
129
130/* Register Mask - sets corresponding mask bits in the upper word */
131static inline uint32_t set_rmask(uint32_t val)
132{
133 return (val & 0xffff) | (val << 16);
134}
135
136
137static inline uint32_t clr_rmask(uint32_t val)
138{
139 return 0 | (val << 16);
140}
141
142/* ctrl_status definitions */
143#define CSR_SCSI_PAGE_SELECT 0x00000003
144#define CSR_SCSI_INTR_ENABLE 0x00000004 /* 4010 */
145#define CSR_SCSI_RESET_INTR 0x00000008
146#define CSR_SCSI_COMPLETION_INTR 0x00000010
147#define CSR_SCSI_PROCESSOR_INTR 0x00000020
148#define CSR_INTR_RISC 0x00000040
149#define CSR_BOOT_ENABLE 0x00000080
150#define CSR_NET_PAGE_SELECT 0x00000300 /* 4010 */
151#define CSR_FUNC_NUM 0x00000700 /* 4022 */
152#define CSR_NET_RESET_INTR 0x00000800 /* 4010 */
153#define CSR_FORCE_SOFT_RESET 0x00002000 /* 4022 */
154#define CSR_FATAL_ERROR 0x00004000
155#define CSR_SOFT_RESET 0x00008000
156#define ISP_CONTROL_FN_MASK CSR_FUNC_NUM
157#define ISP_CONTROL_FN0_SCSI 0x0500
158#define ISP_CONTROL_FN1_SCSI 0x0700
159
160#define INTR_PENDING (CSR_SCSI_COMPLETION_INTR |\
161 CSR_SCSI_PROCESSOR_INTR |\
162 CSR_SCSI_RESET_INTR)
163
164/* ISP InterruptMask definitions */
165#define IMR_SCSI_INTR_ENABLE 0x00000004 /* 4022 */
166
167/* ISP 4022 nvram definitions */
168#define NVR_WRITE_ENABLE 0x00000010 /* 4022 */
169
170/* ISP port_status definitions */
171
172/* ISP Semaphore definitions */
173
174/* ISP General Purpose Output definitions */
David C Somayajulub2854312007-05-23 17:52:26 -0700175#define GPOR_TOPCAT_RESET 0x00000004
David Somayajuluafaf5a22006-09-19 10:28:00 -0700176
177/* shadow registers (DMA'd from HA to system memory. read only) */
178struct shadow_regs {
179 /* SCSI Request Queue Consumer Index */
180 __le32 req_q_out; /* 0 x0 R */
181
182 /* SCSI Completion Queue Producer Index */
183 __le32 rsp_q_in; /* 4 x4 R */
184}; /* 8 x8 */
185
186
187/* External hardware configuration register */
188union external_hw_config_reg {
189 struct {
190 /* FIXME: Do we even need this? All values are
191 * referred to by 16 bit quantities. Platform and
192 * endianess issues. */
193 __le32 bReserved0:1;
194 __le32 bSDRAMProtectionMethod:2;
195 __le32 bSDRAMBanks:1;
196 __le32 bSDRAMChipWidth:1;
197 __le32 bSDRAMChipSize:2;
198 __le32 bParityDisable:1;
199 __le32 bExternalMemoryType:1;
200 __le32 bFlashBIOSWriteEnable:1;
201 __le32 bFlashUpperBankSelect:1;
202 __le32 bWriteBurst:2;
203 __le32 bReserved1:3;
204 __le32 bMask:16;
205 };
206 uint32_t Asuint32_t;
207};
208
209/*************************************************************************
210 *
211 * Mailbox Commands Structures and Definitions
212 *
213 *************************************************************************/
214
215/* Mailbox command definitions */
216#define MBOX_CMD_ABOUT_FW 0x0009
David C Somayajulub2854312007-05-23 17:52:26 -0700217#define MBOX_CMD_PING 0x000B
Vikas Chaudhary09a0f712010-04-28 11:42:24 +0530218#define MBOX_CMD_ABORT_TASK 0x0015
David Somayajuluafaf5a22006-09-19 10:28:00 -0700219#define MBOX_CMD_LUN_RESET 0x0016
Mike Christiece545032008-02-29 18:25:20 -0600220#define MBOX_CMD_TARGET_WARM_RESET 0x0017
David C Somayajulud9150582006-11-15 17:38:40 -0800221#define MBOX_CMD_GET_MANAGEMENT_DATA 0x001E
David Somayajuluafaf5a22006-09-19 10:28:00 -0700222#define MBOX_CMD_GET_FW_STATUS 0x001F
223#define MBOX_CMD_SET_ISNS_SERVICE 0x0021
224#define ISNS_DISABLE 0
225#define ISNS_ENABLE 1
David C Somayajulud9150582006-11-15 17:38:40 -0800226#define MBOX_CMD_COPY_FLASH 0x0024
227#define MBOX_CMD_WRITE_FLASH 0x0025
David Somayajuluafaf5a22006-09-19 10:28:00 -0700228#define MBOX_CMD_READ_FLASH 0x0026
229#define MBOX_CMD_CLEAR_DATABASE_ENTRY 0x0031
230#define MBOX_CMD_CONN_CLOSE_SESS_LOGOUT 0x0056
231#define LOGOUT_OPTION_CLOSE_SESSION 0x01
232#define LOGOUT_OPTION_RELOGIN 0x02
233#define MBOX_CMD_EXECUTE_IOCB_A64 0x005A
234#define MBOX_CMD_INITIALIZE_FIRMWARE 0x0060
235#define MBOX_CMD_GET_INIT_FW_CTRL_BLOCK 0x0061
236#define MBOX_CMD_REQUEST_DATABASE_ENTRY 0x0062
237#define MBOX_CMD_SET_DATABASE_ENTRY 0x0063
238#define MBOX_CMD_GET_DATABASE_ENTRY 0x0064
239#define DDB_DS_UNASSIGNED 0x00
240#define DDB_DS_NO_CONNECTION_ACTIVE 0x01
241#define DDB_DS_SESSION_ACTIVE 0x04
242#define DDB_DS_SESSION_FAILED 0x06
243#define DDB_DS_LOGIN_IN_PROCESS 0x07
244#define MBOX_CMD_GET_FW_STATE 0x0069
David C Somayajulud9150582006-11-15 17:38:40 -0800245#define MBOX_CMD_GET_INIT_FW_CTRL_BLOCK_DEFAULTS 0x006A
246#define MBOX_CMD_RESTORE_FACTORY_DEFAULTS 0x0087
David C Somayajulub2854312007-05-23 17:52:26 -0700247#define MBOX_CMD_SET_ACB 0x0088
248#define MBOX_CMD_GET_ACB 0x0089
249#define MBOX_CMD_DISABLE_ACB 0x008A
250#define MBOX_CMD_GET_IPV6_NEIGHBOR_CACHE 0x008B
251#define MBOX_CMD_GET_IPV6_DEST_CACHE 0x008C
252#define MBOX_CMD_GET_IPV6_DEF_ROUTER_LIST 0x008D
253#define MBOX_CMD_GET_IPV6_LCL_PREFIX_LIST 0x008E
254#define MBOX_CMD_SET_IPV6_NEIGHBOR_CACHE 0x0090
255#define MBOX_CMD_GET_IP_ADDR_STATE 0x0091
256#define MBOX_CMD_SEND_IPV6_ROUTER_SOL 0x0092
257#define MBOX_CMD_GET_DB_ENTRY_CURRENT_IP_ADDR 0x0093
David Somayajuluafaf5a22006-09-19 10:28:00 -0700258
259/* Mailbox 1 */
260#define FW_STATE_READY 0x0000
261#define FW_STATE_CONFIG_WAIT 0x0001
Vikas Chaudhary2a49a782010-04-28 11:37:07 +0530262#define FW_STATE_WAIT_AUTOCONNECT 0x0002
David Somayajuluafaf5a22006-09-19 10:28:00 -0700263#define FW_STATE_ERROR 0x0004
Vikas Chaudhary2a49a782010-04-28 11:37:07 +0530264#define FW_STATE_CONFIGURING_IP 0x0008
David Somayajuluafaf5a22006-09-19 10:28:00 -0700265
266/* Mailbox 3 */
267#define FW_ADDSTATE_OPTICAL_MEDIA 0x0001
Vikas Chaudhary2a49a782010-04-28 11:37:07 +0530268#define FW_ADDSTATE_DHCPv4_ENABLED 0x0002
269#define FW_ADDSTATE_DHCPv4_LEASE_ACQUIRED 0x0004
270#define FW_ADDSTATE_DHCPv4_LEASE_EXPIRED 0x0008
David Somayajuluafaf5a22006-09-19 10:28:00 -0700271#define FW_ADDSTATE_LINK_UP 0x0010
272#define FW_ADDSTATE_ISNS_SVC_ENABLED 0x0020
273#define MBOX_CMD_GET_DATABASE_ENTRY_DEFAULTS 0x006B
274#define MBOX_CMD_CONN_OPEN_SESS_LOGIN 0x0074
275#define MBOX_CMD_GET_CRASH_RECORD 0x0076 /* 4010 only */
276#define MBOX_CMD_GET_CONN_EVENT_LOG 0x0077
277
278/* Mailbox status definitions */
279#define MBOX_COMPLETION_STATUS 4
280#define MBOX_STS_BUSY 0x0007
281#define MBOX_STS_INTERMEDIATE_COMPLETION 0x1000
282#define MBOX_STS_COMMAND_COMPLETE 0x4000
283#define MBOX_STS_COMMAND_ERROR 0x4005
284
285#define MBOX_ASYNC_EVENT_STATUS 8
286#define MBOX_ASTS_SYSTEM_ERROR 0x8002
287#define MBOX_ASTS_REQUEST_TRANSFER_ERROR 0x8003
288#define MBOX_ASTS_RESPONSE_TRANSFER_ERROR 0x8004
289#define MBOX_ASTS_PROTOCOL_STATISTIC_ALARM 0x8005
290#define MBOX_ASTS_SCSI_COMMAND_PDU_REJECTED 0x8006
291#define MBOX_ASTS_LINK_UP 0x8010
292#define MBOX_ASTS_LINK_DOWN 0x8011
293#define MBOX_ASTS_DATABASE_CHANGED 0x8014
294#define MBOX_ASTS_UNSOLICITED_PDU_RECEIVED 0x8015
295#define MBOX_ASTS_SELF_TEST_FAILED 0x8016
296#define MBOX_ASTS_LOGIN_FAILED 0x8017
297#define MBOX_ASTS_DNS 0x8018
298#define MBOX_ASTS_HEARTBEAT 0x8019
299#define MBOX_ASTS_NVRAM_INVALID 0x801A
300#define MBOX_ASTS_MAC_ADDRESS_CHANGED 0x801B
301#define MBOX_ASTS_IP_ADDRESS_CHANGED 0x801C
302#define MBOX_ASTS_DHCP_LEASE_EXPIRED 0x801D
303#define MBOX_ASTS_DHCP_LEASE_ACQUIRED 0x801F
304#define MBOX_ASTS_ISNS_UNSOLICITED_PDU_RECEIVED 0x8021
David C Somayajulub2854312007-05-23 17:52:26 -0700305#define MBOX_ASTS_DUPLICATE_IP 0x8025
306#define MBOX_ASTS_ARP_COMPLETE 0x8026
307#define MBOX_ASTS_SUBNET_STATE_CHANGE 0x8027
308#define MBOX_ASTS_RESPONSE_QUEUE_FULL 0x8028
309#define MBOX_ASTS_IP_ADDR_STATE_CHANGED 0x8029
310#define MBOX_ASTS_IPV6_PREFIX_EXPIRED 0x802B
311#define MBOX_ASTS_IPV6_ND_PREFIX_IGNORED 0x802C
312#define MBOX_ASTS_IPV6_LCL_PREFIX_IGNORED 0x802D
313#define MBOX_ASTS_ICMPV6_ERROR_MSG_RCVD 0x802E
314
David Somayajuluafaf5a22006-09-19 10:28:00 -0700315#define ISNS_EVENT_DATA_RECEIVED 0x0000
316#define ISNS_EVENT_CONNECTION_OPENED 0x0001
317#define ISNS_EVENT_CONNECTION_FAILED 0x0002
318#define MBOX_ASTS_IPSEC_SYSTEM_FATAL_ERROR 0x8022
319#define MBOX_ASTS_SUBNET_STATE_CHANGE 0x8027
320
321/*************************************************************************/
322
323/* Host Adapter Initialization Control Block (from host) */
David C Somayajulub2854312007-05-23 17:52:26 -0700324struct addr_ctrl_blk {
325 uint8_t version; /* 00 */
Vikas Chaudhary2a49a782010-04-28 11:37:07 +0530326#define IFCB_VER_MIN 0x01
327#define IFCB_VER_MAX 0x02
David C Somayajulub2854312007-05-23 17:52:26 -0700328 uint8_t control; /* 01 */
David Somayajuluafaf5a22006-09-19 10:28:00 -0700329
David C Somayajulub2854312007-05-23 17:52:26 -0700330 uint16_t fw_options; /* 02-03 */
David Somayajuluafaf5a22006-09-19 10:28:00 -0700331#define FWOPT_HEARTBEAT_ENABLE 0x1000
332#define FWOPT_SESSION_MODE 0x0040
333#define FWOPT_INITIATOR_MODE 0x0020
334#define FWOPT_TARGET_MODE 0x0010
335
David C Somayajulub2854312007-05-23 17:52:26 -0700336 uint16_t exec_throttle; /* 04-05 */
337 uint8_t zio_count; /* 06 */
338 uint8_t res0; /* 07 */
339 uint16_t eth_mtu_size; /* 08-09 */
340 uint16_t add_fw_options; /* 0A-0B */
David Somayajuluafaf5a22006-09-19 10:28:00 -0700341
David C Somayajulub2854312007-05-23 17:52:26 -0700342 uint8_t hb_interval; /* 0C */
343 uint8_t inst_num; /* 0D */
344 uint16_t res1; /* 0E-0F */
345 uint16_t rqq_consumer_idx; /* 10-11 */
346 uint16_t compq_producer_idx; /* 12-13 */
347 uint16_t rqq_len; /* 14-15 */
348 uint16_t compq_len; /* 16-17 */
349 uint32_t rqq_addr_lo; /* 18-1B */
350 uint32_t rqq_addr_hi; /* 1C-1F */
351 uint32_t compq_addr_lo; /* 20-23 */
352 uint32_t compq_addr_hi; /* 24-27 */
353 uint32_t shdwreg_addr_lo; /* 28-2B */
354 uint32_t shdwreg_addr_hi; /* 2C-2F */
David Somayajuluafaf5a22006-09-19 10:28:00 -0700355
David C Somayajulub2854312007-05-23 17:52:26 -0700356 uint16_t iscsi_opts; /* 30-31 */
357 uint16_t ipv4_tcp_opts; /* 32-33 */
358 uint16_t ipv4_ip_opts; /* 34-35 */
Vikas Chaudhary2a49a782010-04-28 11:37:07 +0530359#define IPOPT_IPv4_PROTOCOL_ENABLE 0x8000
David Somayajuluafaf5a22006-09-19 10:28:00 -0700360
David C Somayajulub2854312007-05-23 17:52:26 -0700361 uint16_t iscsi_max_pdu_size; /* 36-37 */
362 uint8_t ipv4_tos; /* 38 */
363 uint8_t ipv4_ttl; /* 39 */
364 uint8_t acb_version; /* 3A */
Vikas Chaudhary2a49a782010-04-28 11:37:07 +0530365#define ACB_NOT_SUPPORTED 0x00
366#define ACB_SUPPORTED 0x02 /* Capable of ACB Version 2
367 Features */
368
David C Somayajulub2854312007-05-23 17:52:26 -0700369 uint8_t res2; /* 3B */
370 uint16_t def_timeout; /* 3C-3D */
371 uint16_t iscsi_fburst_len; /* 3E-3F */
372 uint16_t iscsi_def_time2wait; /* 40-41 */
373 uint16_t iscsi_def_time2retain; /* 42-43 */
374 uint16_t iscsi_max_outstnd_r2t; /* 44-45 */
375 uint16_t conn_ka_timeout; /* 46-47 */
376 uint16_t ipv4_port; /* 48-49 */
377 uint16_t iscsi_max_burst_len; /* 4A-4B */
378 uint32_t res5; /* 4C-4F */
379 uint8_t ipv4_addr[4]; /* 50-53 */
380 uint16_t ipv4_vlan_tag; /* 54-55 */
381 uint8_t ipv4_addr_state; /* 56 */
382 uint8_t ipv4_cacheid; /* 57 */
383 uint8_t res6[8]; /* 58-5F */
384 uint8_t ipv4_subnet[4]; /* 60-63 */
385 uint8_t res7[12]; /* 64-6F */
386 uint8_t ipv4_gw_addr[4]; /* 70-73 */
387 uint8_t res8[0xc]; /* 74-7F */
388 uint8_t pri_dns_srvr_ip[4];/* 80-83 */
389 uint8_t sec_dns_srvr_ip[4];/* 84-87 */
390 uint16_t min_eph_port; /* 88-89 */
391 uint16_t max_eph_port; /* 8A-8B */
392 uint8_t res9[4]; /* 8C-8F */
393 uint8_t iscsi_alias[32];/* 90-AF */
394 uint8_t res9_1[0x16]; /* B0-C5 */
395 uint16_t tgt_portal_grp;/* C6-C7 */
396 uint8_t abort_timer; /* C8 */
397 uint8_t ipv4_tcp_wsf; /* C9 */
398 uint8_t res10[6]; /* CA-CF */
399 uint8_t ipv4_sec_ip_addr[4]; /* D0-D3 */
400 uint8_t ipv4_dhcp_vid_len; /* D4 */
401 uint8_t ipv4_dhcp_vid[11]; /* D5-DF */
402 uint8_t res11[20]; /* E0-F3 */
403 uint8_t ipv4_dhcp_alt_cid_len; /* F4 */
404 uint8_t ipv4_dhcp_alt_cid[11]; /* F5-FF */
405 uint8_t iscsi_name[224]; /* 100-1DF */
406 uint8_t res12[32]; /* 1E0-1FF */
407 uint32_t cookie; /* 200-203 */
408 uint16_t ipv6_port; /* 204-205 */
409 uint16_t ipv6_opts; /* 206-207 */
Vikas Chaudhary2a49a782010-04-28 11:37:07 +0530410#define IPV6_OPT_IPV6_PROTOCOL_ENABLE 0x8000
411
David C Somayajulub2854312007-05-23 17:52:26 -0700412 uint16_t ipv6_addtl_opts; /* 208-209 */
Vikas Chaudhary2a49a782010-04-28 11:37:07 +0530413#define IPV6_ADDOPT_NEIGHBOR_DISCOVERY_ADDR_ENABLE 0x0002 /* Pri ACB
414 Only */
415#define IPV6_ADDOPT_AUTOCONFIG_LINK_LOCAL_ADDR 0x0001
416
David C Somayajulub2854312007-05-23 17:52:26 -0700417 uint16_t ipv6_tcp_opts; /* 20A-20B */
418 uint8_t ipv6_tcp_wsf; /* 20C */
419 uint16_t ipv6_flow_lbl; /* 20D-20F */
Vikas Chaudhary2a49a782010-04-28 11:37:07 +0530420 uint8_t ipv6_dflt_rtr_addr[16]; /* 210-21F */
David C Somayajulub2854312007-05-23 17:52:26 -0700421 uint16_t ipv6_vlan_tag; /* 220-221 */
422 uint8_t ipv6_lnk_lcl_addr_state;/* 222 */
423 uint8_t ipv6_addr0_state; /* 223 */
424 uint8_t ipv6_addr1_state; /* 224 */
Vikas Chaudhary2a49a782010-04-28 11:37:07 +0530425#define IP_ADDRSTATE_UNCONFIGURED 0
426#define IP_ADDRSTATE_INVALID 1
427#define IP_ADDRSTATE_ACQUIRING 2
428#define IP_ADDRSTATE_TENTATIVE 3
429#define IP_ADDRSTATE_DEPRICATED 4
430#define IP_ADDRSTATE_PREFERRED 5
431#define IP_ADDRSTATE_DISABLING 6
432
433 uint8_t ipv6_dflt_rtr_state; /* 225 */
434#define IPV6_RTRSTATE_UNKNOWN 0
435#define IPV6_RTRSTATE_MANUAL 1
436#define IPV6_RTRSTATE_ADVERTISED 3
437#define IPV6_RTRSTATE_STALE 4
438
David C Somayajulub2854312007-05-23 17:52:26 -0700439 uint8_t ipv6_traffic_class; /* 226 */
440 uint8_t ipv6_hop_limit; /* 227 */
441 uint8_t ipv6_if_id[8]; /* 228-22F */
442 uint8_t ipv6_addr0[16]; /* 230-23F */
443 uint8_t ipv6_addr1[16]; /* 240-24F */
444 uint32_t ipv6_nd_reach_time; /* 250-253 */
445 uint32_t ipv6_nd_rexmit_timer; /* 254-257 */
446 uint32_t ipv6_nd_stale_timeout; /* 258-25B */
447 uint8_t ipv6_dup_addr_detect_count; /* 25C */
448 uint8_t ipv6_cache_id; /* 25D */
449 uint8_t res13[18]; /* 25E-26F */
450 uint32_t ipv6_gw_advrt_mtu; /* 270-273 */
451 uint8_t res14[140]; /* 274-2FF */
452};
David Somayajuluafaf5a22006-09-19 10:28:00 -0700453
David C Somayajulub2854312007-05-23 17:52:26 -0700454struct init_fw_ctrl_blk {
455 struct addr_ctrl_blk pri;
Vikas Chaudhary2a49a782010-04-28 11:37:07 +0530456/* struct addr_ctrl_blk sec;*/
David Somayajuluafaf5a22006-09-19 10:28:00 -0700457};
458
459/*************************************************************************/
460
461struct dev_db_entry {
David C Somayajulub2854312007-05-23 17:52:26 -0700462 uint16_t options; /* 00-01 */
David Somayajuluafaf5a22006-09-19 10:28:00 -0700463#define DDB_OPT_DISC_SESSION 0x10
464#define DDB_OPT_TARGET 0x02 /* device is a target */
Vikas Chaudhary2a49a782010-04-28 11:37:07 +0530465#define DDB_OPT_IPV6_DEVICE 0x100
466#define DDB_OPT_IPV6_NULL_LINK_LOCAL 0x800 /* post connection */
467#define DDB_OPT_IPV6_FW_DEFINED_LINK_LOCAL 0x800 /* pre connection */
David Somayajuluafaf5a22006-09-19 10:28:00 -0700468
David C Somayajulub2854312007-05-23 17:52:26 -0700469 uint16_t exec_throttle; /* 02-03 */
470 uint16_t exec_count; /* 04-05 */
471 uint16_t res0; /* 06-07 */
472 uint16_t iscsi_options; /* 08-09 */
473 uint16_t tcp_options; /* 0A-0B */
474 uint16_t ip_options; /* 0C-0D */
475 uint16_t iscsi_max_rcv_data_seg_len; /* 0E-0F */
476 uint32_t res1; /* 10-13 */
477 uint16_t iscsi_max_snd_data_seg_len; /* 14-15 */
478 uint16_t iscsi_first_burst_len; /* 16-17 */
479 uint16_t iscsi_def_time2wait; /* 18-19 */
480 uint16_t iscsi_def_time2retain; /* 1A-1B */
481 uint16_t iscsi_max_outsnd_r2t; /* 1C-1D */
482 uint16_t ka_timeout; /* 1E-1F */
483 uint8_t isid[6]; /* 20-25 big-endian, must be converted
David Somayajuluafaf5a22006-09-19 10:28:00 -0700484 * to little-endian */
David C Somayajulub2854312007-05-23 17:52:26 -0700485 uint16_t tsid; /* 26-27 */
486 uint16_t port; /* 28-29 */
487 uint16_t iscsi_max_burst_len; /* 2A-2B */
488 uint16_t def_timeout; /* 2C-2D */
489 uint16_t res2; /* 2E-2F */
490 uint8_t ip_addr[0x10]; /* 30-3F */
491 uint8_t iscsi_alias[0x20]; /* 40-5F */
492 uint8_t tgt_addr[0x20]; /* 60-7F */
493 uint16_t mss; /* 80-81 */
494 uint16_t res3; /* 82-83 */
495 uint16_t lcl_port; /* 84-85 */
496 uint8_t ipv4_tos; /* 86 */
497 uint16_t ipv6_flow_lbl; /* 87-89 */
498 uint8_t res4[0x36]; /* 8A-BF */
499 uint8_t iscsi_name[0xE0]; /* C0-19F : xxzzy Make this a
David Somayajuluafaf5a22006-09-19 10:28:00 -0700500 * pointer to a string so we
501 * don't have to reserve soooo
502 * much RAM */
Vikas Chaudhary2a49a782010-04-28 11:37:07 +0530503 uint8_t link_local_ipv6_addr[0x10]; /* 1A0-1AF */
David C Somayajulub2854312007-05-23 17:52:26 -0700504 uint8_t res5[0x10]; /* 1B0-1BF */
505 uint16_t ddb_link; /* 1C0-1C1 */
506 uint16_t chap_tbl_idx; /* 1C2-1C3 */
507 uint16_t tgt_portal_grp; /* 1C4-1C5 */
508 uint8_t tcp_xmt_wsf; /* 1C6 */
509 uint8_t tcp_rcv_wsf; /* 1C7 */
510 uint32_t stat_sn; /* 1C8-1CB */
511 uint32_t exp_stat_sn; /* 1CC-1CF */
512 uint8_t res6[0x30]; /* 1D0-1FF */
David Somayajuluafaf5a22006-09-19 10:28:00 -0700513};
514
515/*************************************************************************/
516
517/* Flash definitions */
518
519#define FLASH_OFFSET_SYS_INFO 0x02000000
520#define FLASH_DEFAULTBLOCKSIZE 0x20000
521#define FLASH_EOF_OFFSET (FLASH_DEFAULTBLOCKSIZE-8) /* 4 bytes
522 * for EOF
523 * signature */
524
525struct sys_info_phys_addr {
526 uint8_t address[6]; /* 00-05 */
527 uint8_t filler[2]; /* 06-07 */
528};
529
530struct flash_sys_info {
531 uint32_t cookie; /* 00-03 */
532 uint32_t physAddrCount; /* 04-07 */
533 struct sys_info_phys_addr physAddr[4]; /* 08-27 */
534 uint8_t vendorId[128]; /* 28-A7 */
535 uint8_t productId[128]; /* A8-127 */
536 uint32_t serialNumber; /* 128-12B */
537
538 /* PCI Configuration values */
539 uint32_t pciDeviceVendor; /* 12C-12F */
540 uint32_t pciDeviceId; /* 130-133 */
541 uint32_t pciSubsysVendor; /* 134-137 */
542 uint32_t pciSubsysId; /* 138-13B */
543
544 /* This validates version 1. */
545 uint32_t crumbs; /* 13C-13F */
546
547 uint32_t enterpriseNumber; /* 140-143 */
548
549 uint32_t mtu; /* 144-147 */
550 uint32_t reserved0; /* 148-14b */
551 uint32_t crumbs2; /* 14c-14f */
552 uint8_t acSerialNumber[16]; /* 150-15f */
553 uint32_t crumbs3; /* 160-16f */
554
555 /* Leave this last in the struct so it is declared invalid if
556 * any new items are added.
557 */
558 uint32_t reserved1[39]; /* 170-1ff */
559}; /* 200 */
560
561struct crash_record {
562 uint16_t fw_major_version; /* 00 - 01 */
563 uint16_t fw_minor_version; /* 02 - 03 */
564 uint16_t fw_patch_version; /* 04 - 05 */
565 uint16_t fw_build_version; /* 06 - 07 */
566
567 uint8_t build_date[16]; /* 08 - 17 */
568 uint8_t build_time[16]; /* 18 - 27 */
569 uint8_t build_user[16]; /* 28 - 37 */
570 uint8_t card_serial_num[16]; /* 38 - 47 */
571
572 uint32_t time_of_crash_in_secs; /* 48 - 4B */
573 uint32_t time_of_crash_in_ms; /* 4C - 4F */
574
575 uint16_t out_RISC_sd_num_frames; /* 50 - 51 */
576 uint16_t OAP_sd_num_words; /* 52 - 53 */
577 uint16_t IAP_sd_num_frames; /* 54 - 55 */
578 uint16_t in_RISC_sd_num_words; /* 56 - 57 */
579
580 uint8_t reserved1[28]; /* 58 - 7F */
581
582 uint8_t out_RISC_reg_dump[256]; /* 80 -17F */
583 uint8_t in_RISC_reg_dump[256]; /*180 -27F */
584 uint8_t in_out_RISC_stack_dump[0]; /*280 - ??? */
585};
586
587struct conn_event_log_entry {
588#define MAX_CONN_EVENT_LOG_ENTRIES 100
589 uint32_t timestamp_sec; /* 00 - 03 seconds since boot */
590 uint32_t timestamp_ms; /* 04 - 07 milliseconds since boot */
591 uint16_t device_index; /* 08 - 09 */
592 uint16_t fw_conn_state; /* 0A - 0B */
593 uint8_t event_type; /* 0C - 0C */
594 uint8_t error_code; /* 0D - 0D */
595 uint16_t error_code_detail; /* 0E - 0F */
596 uint8_t num_consecutive_events; /* 10 - 10 */
597 uint8_t rsvd[3]; /* 11 - 13 */
598};
599
600/*************************************************************************
601 *
602 * IOCB Commands Structures and Definitions
603 *
604 *************************************************************************/
605#define IOCB_MAX_CDB_LEN 16 /* Bytes in a CBD */
606#define IOCB_MAX_SENSEDATA_LEN 32 /* Bytes of sense data */
Karen Higgins94bced32009-07-15 15:02:58 -0500607#define IOCB_MAX_EXT_SENSEDATA_LEN 60 /* Bytes of extended sense data */
David Somayajuluafaf5a22006-09-19 10:28:00 -0700608
609/* IOCB header structure */
610struct qla4_header {
611 uint8_t entryType;
612#define ET_STATUS 0x03
613#define ET_MARKER 0x04
614#define ET_CONT_T1 0x0A
615#define ET_STATUS_CONTINUATION 0x10
616#define ET_CMND_T3 0x19
617#define ET_PASSTHRU0 0x3A
618#define ET_PASSTHRU_STATUS 0x3C
619
620 uint8_t entryStatus;
621 uint8_t systemDefined;
622 uint8_t entryCount;
623
624 /* SyetemDefined definition */
625};
626
627/* Generic queue entry structure*/
628struct queue_entry {
629 uint8_t data[60];
630 uint32_t signature;
631
632};
633
634/* 64 bit addressing segment counts*/
635
636#define COMMAND_SEG_A64 1
637#define CONTINUE_SEG_A64 5
638
639/* 64 bit addressing segment definition*/
640
641struct data_seg_a64 {
642 struct {
643 uint32_t addrLow;
644 uint32_t addrHigh;
645
646 } base;
647
648 uint32_t count;
649
650};
651
652/* Command Type 3 entry structure*/
653
654struct command_t3_entry {
655 struct qla4_header hdr; /* 00-03 */
656
657 uint32_t handle; /* 04-07 */
658 uint16_t target; /* 08-09 */
659 uint16_t connection_id; /* 0A-0B */
660
661 uint8_t control_flags; /* 0C */
662
663 /* data direction (bits 5-6) */
664#define CF_WRITE 0x20
665#define CF_READ 0x40
666#define CF_NO_DATA 0x00
667
668 /* task attributes (bits 2-0) */
669#define CF_HEAD_TAG 0x03
670#define CF_ORDERED_TAG 0x02
671#define CF_SIMPLE_TAG 0x01
672
673 /* STATE FLAGS FIELD IS A PLACE HOLDER. THE FW WILL SET BITS
674 * IN THIS FIELD AS THE COMMAND IS PROCESSED. WHEN THE IOCB IS
675 * CHANGED TO AN IOSB THIS FIELD WILL HAVE THE STATE FLAGS SET
676 * PROPERLY.
677 */
678 uint8_t state_flags; /* 0D */
679 uint8_t cmdRefNum; /* 0E */
680 uint8_t reserved1; /* 0F */
681 uint8_t cdb[IOCB_MAX_CDB_LEN]; /* 10-1F */
682 struct scsi_lun lun; /* FCP LUN (BE). */
683 uint32_t cmdSeqNum; /* 28-2B */
684 uint16_t timeout; /* 2C-2D */
685 uint16_t dataSegCnt; /* 2E-2F */
686 uint32_t ttlByteCnt; /* 30-33 */
687 struct data_seg_a64 dataseg[COMMAND_SEG_A64]; /* 34-3F */
688
689};
690
691
692/* Continuation Type 1 entry structure*/
693struct continuation_t1_entry {
694 struct qla4_header hdr;
695
696 struct data_seg_a64 dataseg[CONTINUE_SEG_A64];
697
698};
699
700/* Parameterize for 64 or 32 bits */
701#define COMMAND_SEG COMMAND_SEG_A64
702#define CONTINUE_SEG CONTINUE_SEG_A64
703
704#define ET_COMMAND ET_CMND_T3
705#define ET_CONTINUE ET_CONT_T1
706
707/* Marker entry structure*/
Mathieu Desnoyers1c3f0b82007-10-18 23:41:04 -0700708struct qla4_marker_entry {
David Somayajuluafaf5a22006-09-19 10:28:00 -0700709 struct qla4_header hdr; /* 00-03 */
710
711 uint32_t system_defined; /* 04-07 */
712 uint16_t target; /* 08-09 */
713 uint16_t modifier; /* 0A-0B */
David C Somayajulu9d562912008-03-19 11:23:03 -0700714#define MM_LUN_RESET 0
715#define MM_TGT_WARM_RESET 1
David Somayajuluafaf5a22006-09-19 10:28:00 -0700716
717 uint16_t flags; /* 0C-0D */
718 uint16_t reserved1; /* 0E-0F */
719 struct scsi_lun lun; /* FCP LUN (BE). */
720 uint64_t reserved2; /* 18-1F */
721 uint64_t reserved3; /* 20-27 */
722 uint64_t reserved4; /* 28-2F */
723 uint64_t reserved5; /* 30-37 */
724 uint64_t reserved6; /* 38-3F */
725};
726
727/* Status entry structure*/
728struct status_entry {
729 struct qla4_header hdr; /* 00-03 */
730
731 uint32_t handle; /* 04-07 */
732
733 uint8_t scsiStatus; /* 08 */
734#define SCSI_CHECK_CONDITION 0x02
735
736 uint8_t iscsiFlags; /* 09 */
737#define ISCSI_FLAG_RESIDUAL_UNDER 0x02
738#define ISCSI_FLAG_RESIDUAL_OVER 0x04
739
740 uint8_t iscsiResponse; /* 0A */
741
742 uint8_t completionStatus; /* 0B */
743#define SCS_COMPLETE 0x00
744#define SCS_INCOMPLETE 0x01
745#define SCS_RESET_OCCURRED 0x04
746#define SCS_ABORTED 0x05
747#define SCS_TIMEOUT 0x06
748#define SCS_DATA_OVERRUN 0x07
749#define SCS_DATA_UNDERRUN 0x15
750#define SCS_QUEUE_FULL 0x1C
751#define SCS_DEVICE_UNAVAILABLE 0x28
752#define SCS_DEVICE_LOGGED_OUT 0x29
753
754 uint8_t reserved1; /* 0C */
755
756 /* state_flags MUST be at the same location as state_flags in
757 * the Command_T3/4_Entry */
758 uint8_t state_flags; /* 0D */
759
760 uint16_t senseDataByteCnt; /* 0E-0F */
761 uint32_t residualByteCnt; /* 10-13 */
762 uint32_t bidiResidualByteCnt; /* 14-17 */
763 uint32_t expSeqNum; /* 18-1B */
764 uint32_t maxCmdSeqNum; /* 1C-1F */
765 uint8_t senseData[IOCB_MAX_SENSEDATA_LEN]; /* 20-3F */
766
767};
768
Karen Higgins94bced32009-07-15 15:02:58 -0500769/* Status Continuation entry */
770struct status_cont_entry {
771 struct qla4_header hdr; /* 00-03 */
772 uint8_t ext_sense_data[IOCB_MAX_EXT_SENSEDATA_LEN]; /* 04-63 */
773};
774
David Somayajuluafaf5a22006-09-19 10:28:00 -0700775struct passthru0 {
776 struct qla4_header hdr; /* 00-03 */
777 uint32_t handle; /* 04-07 */
778 uint16_t target; /* 08-09 */
779 uint16_t connectionID; /* 0A-0B */
780#define ISNS_DEFAULT_SERVER_CONN_ID ((uint16_t)0x8000)
781
782 uint16_t controlFlags; /* 0C-0D */
783#define PT_FLAG_ETHERNET_FRAME 0x8000
784#define PT_FLAG_ISNS_PDU 0x8000
785#define PT_FLAG_SEND_BUFFER 0x0200
786#define PT_FLAG_WAIT_4_RESPONSE 0x0100
787
788 uint16_t timeout; /* 0E-0F */
789#define PT_DEFAULT_TIMEOUT 30 /* seconds */
790
791 struct data_seg_a64 outDataSeg64; /* 10-1B */
792 uint32_t res1; /* 1C-1F */
793 struct data_seg_a64 inDataSeg64; /* 20-2B */
794 uint8_t res2[20]; /* 2C-3F */
795};
796
797struct passthru_status {
798 struct qla4_header hdr; /* 00-03 */
799 uint32_t handle; /* 04-07 */
800 uint16_t target; /* 08-09 */
801 uint16_t connectionID; /* 0A-0B */
802
803 uint8_t completionStatus; /* 0C */
804#define PASSTHRU_STATUS_COMPLETE 0x01
805
806 uint8_t residualFlags; /* 0D */
807
808 uint16_t timeout; /* 0E-0F */
809 uint16_t portNumber; /* 10-11 */
810 uint8_t res1[10]; /* 12-1B */
811 uint32_t outResidual; /* 1C-1F */
812 uint8_t res2[12]; /* 20-2B */
813 uint32_t inResidual; /* 2C-2F */
814 uint8_t res4[16]; /* 30-3F */
815};
816
817#endif /* _QLA4X_FW_H */