Commit | Line | Data |
---|---|---|
fa90c54f AV |
1 | /* |
2 | * QLogic Fibre Channel HBA Driver | |
bd21eaf9 | 3 | * Copyright (c) 2003-2014 QLogic Corporation |
fa90c54f AV |
4 | * |
5 | * See LICENSE.qla2xxx for copyright and licensing details. | |
6 | */ | |
1da177e4 LT |
7 | #ifndef __QLA_DEF_H |
8 | #define __QLA_DEF_H | |
9 | ||
10 | #include <linux/kernel.h> | |
11 | #include <linux/init.h> | |
12 | #include <linux/types.h> | |
13 | #include <linux/module.h> | |
14 | #include <linux/list.h> | |
15 | #include <linux/pci.h> | |
16 | #include <linux/dma-mapping.h> | |
17 | #include <linux/sched.h> | |
18 | #include <linux/slab.h> | |
19 | #include <linux/dmapool.h> | |
20 | #include <linux/mempool.h> | |
21 | #include <linux/spinlock.h> | |
22 | #include <linux/completion.h> | |
abbd8870 | 23 | #include <linux/interrupt.h> |
19a7b4ae | 24 | #include <linux/workqueue.h> |
5433383e | 25 | #include <linux/firmware.h> |
14e660e6 | 26 | #include <linux/aer.h> |
4d4df193 | 27 | #include <linux/mutex.h> |
482c9dc7 | 28 | #include <linux/btree.h> |
1da177e4 LT |
29 | |
30 | #include <scsi/scsi.h> | |
31 | #include <scsi/scsi_host.h> | |
32 | #include <scsi/scsi_device.h> | |
33 | #include <scsi/scsi_cmnd.h> | |
392e2f65 | 34 | #include <scsi/scsi_transport_fc.h> |
9a069e19 | 35 | #include <scsi/scsi_bsg_fc.h> |
1da177e4 | 36 | |
df95f39a BVA |
37 | /* Big endian Fibre Channel S_ID (source ID) or D_ID (destination ID). */ |
38 | typedef struct { | |
39 | uint8_t domain; | |
40 | uint8_t area; | |
41 | uint8_t al_pa; | |
42 | } be_id_t; | |
43 | ||
44 | /* Little endian Fibre Channel S_ID (source ID) or D_ID (destination ID). */ | |
45 | typedef struct { | |
46 | uint8_t al_pa; | |
47 | uint8_t area; | |
48 | uint8_t domain; | |
49 | } le_id_t; | |
50 | ||
6e98016c | 51 | #include "qla_bsg.h" |
15b7a68c | 52 | #include "qla_dsd.h" |
a9083016 | 53 | #include "qla_nx.h" |
7ec0effd | 54 | #include "qla_nx2.h" |
e84067d7 | 55 | #include "qla_nvme.h" |
6a03b4cd HZ |
56 | #define QLA2XXX_DRIVER_NAME "qla2xxx" |
57 | #define QLA2XXX_APIDEV "ql2xapidev" | |
f24b697b | 58 | #define QLA2XXX_MANUFACTURER "QLogic Corporation" |
cb63067a | 59 | |
1da177e4 LT |
60 | /* |
61 | * We have MAILBOX_REGISTER_COUNT sized arrays in a few places, | |
62 | * but that's fine as we don't look at the last 24 ones for | |
63 | * ISP2100 HBAs. | |
64 | */ | |
65 | #define MAILBOX_REGISTER_COUNT_2100 8 | |
67ddda35 | 66 | #define MAILBOX_REGISTER_COUNT_2200 24 |
1da177e4 LT |
67 | #define MAILBOX_REGISTER_COUNT 32 |
68 | ||
69 | #define QLA2200A_RISC_ROM_VER 4 | |
70 | #define FPM_2300 6 | |
71 | #define FPM_2310 7 | |
72 | ||
73 | #include "qla_settings.h" | |
74 | ||
726b8548 QT |
75 | #define MODE_DUAL (MODE_TARGET | MODE_INITIATOR) |
76 | ||
fa2a1ce5 | 77 | /* |
1da177e4 LT |
78 | * Data bit definitions |
79 | */ | |
80 | #define BIT_0 0x1 | |
81 | #define BIT_1 0x2 | |
82 | #define BIT_2 0x4 | |
83 | #define BIT_3 0x8 | |
84 | #define BIT_4 0x10 | |
85 | #define BIT_5 0x20 | |
86 | #define BIT_6 0x40 | |
87 | #define BIT_7 0x80 | |
88 | #define BIT_8 0x100 | |
89 | #define BIT_9 0x200 | |
90 | #define BIT_10 0x400 | |
91 | #define BIT_11 0x800 | |
92 | #define BIT_12 0x1000 | |
93 | #define BIT_13 0x2000 | |
94 | #define BIT_14 0x4000 | |
95 | #define BIT_15 0x8000 | |
96 | #define BIT_16 0x10000 | |
97 | #define BIT_17 0x20000 | |
98 | #define BIT_18 0x40000 | |
99 | #define BIT_19 0x80000 | |
100 | #define BIT_20 0x100000 | |
101 | #define BIT_21 0x200000 | |
102 | #define BIT_22 0x400000 | |
103 | #define BIT_23 0x800000 | |
104 | #define BIT_24 0x1000000 | |
105 | #define BIT_25 0x2000000 | |
106 | #define BIT_26 0x4000000 | |
107 | #define BIT_27 0x8000000 | |
108 | #define BIT_28 0x10000000 | |
109 | #define BIT_29 0x20000000 | |
110 | #define BIT_30 0x40000000 | |
111 | #define BIT_31 0x80000000 | |
112 | ||
113 | #define LSB(x) ((uint8_t)(x)) | |
114 | #define MSB(x) ((uint8_t)((uint16_t)(x) >> 8)) | |
115 | ||
116 | #define LSW(x) ((uint16_t)(x)) | |
117 | #define MSW(x) ((uint16_t)((uint32_t)(x) >> 16)) | |
118 | ||
119 | #define LSD(x) ((uint32_t)((uint64_t)(x))) | |
120 | #define MSD(x) ((uint32_t)((((uint64_t)(x)) >> 16) >> 16)) | |
121 | ||
2afa19a9 | 122 | #define MAKE_HANDLE(x, y) ((uint32_t)((((uint32_t)(x)) << 16) | (uint32_t)(y))) |
1da177e4 LT |
123 | |
124 | /* | |
125 | * I/O register | |
126 | */ | |
127 | ||
128 | #define RD_REG_BYTE(addr) readb(addr) | |
129 | #define RD_REG_WORD(addr) readw(addr) | |
130 | #define RD_REG_DWORD(addr) readl(addr) | |
131 | #define RD_REG_BYTE_RELAXED(addr) readb_relaxed(addr) | |
132 | #define RD_REG_WORD_RELAXED(addr) readw_relaxed(addr) | |
133 | #define RD_REG_DWORD_RELAXED(addr) readl_relaxed(addr) | |
c1c7178c BVA |
134 | #define WRT_REG_BYTE(addr, data) writeb(data, addr) |
135 | #define WRT_REG_WORD(addr, data) writew(data, addr) | |
136 | #define WRT_REG_DWORD(addr, data) writel(data, addr) | |
1da177e4 | 137 | |
7d613ac6 SV |
138 | /* |
139 | * ISP83XX specific remote register addresses | |
140 | */ | |
141 | #define QLA83XX_LED_PORT0 0x00201320 | |
142 | #define QLA83XX_LED_PORT1 0x00201328 | |
143 | #define QLA83XX_IDC_DEV_STATE 0x22102384 | |
144 | #define QLA83XX_IDC_MAJOR_VERSION 0x22102380 | |
145 | #define QLA83XX_IDC_MINOR_VERSION 0x22102398 | |
146 | #define QLA83XX_IDC_DRV_PRESENCE 0x22102388 | |
147 | #define QLA83XX_IDC_DRIVER_ACK 0x2210238c | |
148 | #define QLA83XX_IDC_CONTROL 0x22102390 | |
149 | #define QLA83XX_IDC_AUDIT 0x22102394 | |
150 | #define QLA83XX_IDC_LOCK_RECOVERY 0x2210239c | |
151 | #define QLA83XX_DRIVER_LOCKID 0x22102104 | |
152 | #define QLA83XX_DRIVER_LOCK 0x8111c028 | |
153 | #define QLA83XX_DRIVER_UNLOCK 0x8111c02c | |
154 | #define QLA83XX_FLASH_LOCKID 0x22102100 | |
155 | #define QLA83XX_FLASH_LOCK 0x8111c010 | |
156 | #define QLA83XX_FLASH_UNLOCK 0x8111c014 | |
157 | #define QLA83XX_DEV_PARTINFO1 0x221023e0 | |
158 | #define QLA83XX_DEV_PARTINFO2 0x221023e4 | |
159 | #define QLA83XX_FW_HEARTBEAT 0x221020b0 | |
160 | #define QLA83XX_PEG_HALT_STATUS1 0x221020a8 | |
161 | #define QLA83XX_PEG_HALT_STATUS2 0x221020ac | |
162 | ||
163 | /* 83XX: Macros defining 8200 AEN Reason codes */ | |
164 | #define IDC_DEVICE_STATE_CHANGE BIT_0 | |
165 | #define IDC_PEG_HALT_STATUS_CHANGE BIT_1 | |
166 | #define IDC_NIC_FW_REPORTED_FAILURE BIT_2 | |
167 | #define IDC_HEARTBEAT_FAILURE BIT_3 | |
168 | ||
169 | /* 83XX: Macros defining 8200 AEN Error-levels */ | |
170 | #define ERR_LEVEL_NON_FATAL 0x1 | |
171 | #define ERR_LEVEL_RECOVERABLE_FATAL 0x2 | |
172 | #define ERR_LEVEL_UNRECOVERABLE_FATAL 0x4 | |
173 | ||
174 | /* 83XX: Macros for IDC Version */ | |
175 | #define QLA83XX_SUPP_IDC_MAJOR_VERSION 0x01 | |
176 | #define QLA83XX_SUPP_IDC_MINOR_VERSION 0x0 | |
177 | ||
178 | /* 83XX: Macros for scheduling dpc tasks */ | |
179 | #define QLA83XX_NIC_CORE_RESET 0x1 | |
180 | #define QLA83XX_IDC_STATE_HANDLER 0x2 | |
181 | #define QLA83XX_NIC_CORE_UNRECOVERABLE 0x3 | |
182 | ||
183 | /* 83XX: Macros for defining IDC-Control bits */ | |
184 | #define QLA83XX_IDC_RESET_DISABLED BIT_0 | |
185 | #define QLA83XX_IDC_GRACEFUL_RESET BIT_1 | |
186 | ||
187 | /* 83XX: Macros for different timeouts */ | |
188 | #define QLA83XX_IDC_INITIALIZATION_TIMEOUT 30 | |
189 | #define QLA83XX_IDC_RESET_ACK_TIMEOUT 10 | |
190 | #define QLA83XX_MAX_LOCK_RECOVERY_WAIT (2 * HZ) | |
191 | ||
192 | /* 83XX: Macros for defining class in DEV-Partition Info register */ | |
193 | #define QLA83XX_CLASS_TYPE_NONE 0x0 | |
194 | #define QLA83XX_CLASS_TYPE_NIC 0x1 | |
195 | #define QLA83XX_CLASS_TYPE_FCOE 0x2 | |
196 | #define QLA83XX_CLASS_TYPE_ISCSI 0x3 | |
197 | ||
198 | /* 83XX: Macros for IDC Lock-Recovery stages */ | |
199 | #define IDC_LOCK_RECOVERY_STAGE1 0x1 /* Stage1: Intent for | |
200 | * lock-recovery | |
201 | */ | |
202 | #define IDC_LOCK_RECOVERY_STAGE2 0x2 /* Stage2: Perform lock-recovery */ | |
203 | ||
204 | /* 83XX: Macros for IDC Audit type */ | |
205 | #define IDC_AUDIT_TIMESTAMP 0x0 /* IDC-AUDIT: Record timestamp of | |
206 | * dev-state change to NEED-RESET | |
207 | * or NEED-QUIESCENT | |
208 | */ | |
209 | #define IDC_AUDIT_COMPLETION 0x1 /* IDC-AUDIT: Record duration of | |
210 | * reset-recovery completion is | |
211 | * second | |
212 | */ | |
2d5a4c34 HM |
213 | /* ISP2031: Values for laser on/off */ |
214 | #define PORT_0_2031 0x00201340 | |
215 | #define PORT_1_2031 0x00201350 | |
216 | #define LASER_ON_2031 0x01800100 | |
217 | #define LASER_OFF_2031 0x01800180 | |
7d613ac6 | 218 | |
f6df144c | 219 | /* |
220 | * The ISP2312 v2 chip cannot access the FLASH/GPIO registers via MMIO in an | |
221 | * 133Mhz slot. | |
222 | */ | |
223 | #define RD_REG_WORD_PIO(addr) (inw((unsigned long)addr)) | |
c1c7178c | 224 | #define WRT_REG_WORD_PIO(addr, data) (outw(data, (unsigned long)addr)) |
f6df144c | 225 | |
1da177e4 LT |
226 | /* |
227 | * Fibre Channel device definitions. | |
228 | */ | |
229 | #define WWN_SIZE 8 /* Size of WWPN, WWN & WWNN */ | |
642ef983 CD |
230 | #define MAX_FIBRE_DEVICES_2100 512 |
231 | #define MAX_FIBRE_DEVICES_2400 2048 | |
232 | #define MAX_FIBRE_DEVICES_LOOP 128 | |
233 | #define MAX_FIBRE_DEVICES_MAX MAX_FIBRE_DEVICES_2400 | |
5f16b331 | 234 | #define LOOPID_MAP_SIZE (ha->max_fibre_devices) |
cc4731f5 | 235 | #define MAX_FIBRE_LUNS 0xFFFF |
1da177e4 LT |
236 | #define MAX_HOST_COUNT 16 |
237 | ||
238 | /* | |
239 | * Host adapter default definitions. | |
240 | */ | |
241 | #define MAX_BUSES 1 /* We only have one bus today */ | |
1da177e4 LT |
242 | #define MIN_LUNS 8 |
243 | #define MAX_LUNS MAX_FIBRE_LUNS | |
fa2a1ce5 AV |
244 | #define MAX_CMDS_PER_LUN 255 |
245 | ||
1da177e4 LT |
246 | /* |
247 | * Fibre Channel device definitions. | |
248 | */ | |
249 | #define SNS_LAST_LOOP_ID_2100 0xfe | |
250 | #define SNS_LAST_LOOP_ID_2300 0x7ff | |
251 | ||
252 | #define LAST_LOCAL_LOOP_ID 0x7d | |
253 | #define SNS_FL_PORT 0x7e | |
254 | #define FABRIC_CONTROLLER 0x7f | |
255 | #define SIMPLE_NAME_SERVER 0x80 | |
256 | #define SNS_FIRST_LOOP_ID 0x81 | |
257 | #define MANAGEMENT_SERVER 0xfe | |
258 | #define BROADCAST 0xff | |
259 | ||
3d71644c AV |
260 | /* |
261 | * There is no correspondence between an N-PORT id and an AL_PA. Therefore the | |
262 | * valid range of an N-PORT id is 0 through 0x7ef. | |
263 | */ | |
1429f044 | 264 | #define NPH_LAST_HANDLE 0x7ee |
265 | #define NPH_MGMT_SERVER 0x7ef /* FFFFEF */ | |
3d71644c AV |
266 | #define NPH_SNS 0x7fc /* FFFFFC */ |
267 | #define NPH_FABRIC_CONTROLLER 0x7fd /* FFFFFD */ | |
268 | #define NPH_F_PORT 0x7fe /* FFFFFE */ | |
269 | #define NPH_IP_BROADCAST 0x7ff /* FFFFFF */ | |
270 | ||
b98ae0d7 QT |
271 | #define NPH_SNS_LID(ha) (IS_FWI2_CAPABLE(ha) ? NPH_SNS : SIMPLE_NAME_SERVER) |
272 | ||
3d71644c AV |
273 | #define MAX_CMDSZ 16 /* SCSI maximum CDB size. */ |
274 | #include "qla_fw.h" | |
726b8548 QT |
275 | |
276 | struct name_list_extended { | |
277 | struct get_name_list_extended *l; | |
278 | dma_addr_t ldma; | |
1c6cacf4 | 279 | struct list_head fcports; |
726b8548 | 280 | u32 size; |
0aca7784 | 281 | u8 sent; |
726b8548 | 282 | }; |
1da177e4 LT |
283 | /* |
284 | * Timeout timer counts in seconds | |
285 | */ | |
8482e118 | 286 | #define PORT_RETRY_TIME 1 |
1da177e4 LT |
287 | #define LOOP_DOWN_TIMEOUT 60 |
288 | #define LOOP_DOWN_TIME 255 /* 240 */ | |
289 | #define LOOP_DOWN_RESET (LOOP_DOWN_TIME - 30) | |
290 | ||
e7b42e33 | 291 | #define DEFAULT_OUTSTANDING_COMMANDS 4096 |
8d93f550 | 292 | #define MIN_OUTSTANDING_COMMANDS 128 |
1da177e4 LT |
293 | |
294 | /* ISP request and response entry counts (37-65535) */ | |
295 | #define REQUEST_ENTRY_CNT_2100 128 /* Number of request entries. */ | |
296 | #define REQUEST_ENTRY_CNT_2200 2048 /* Number of request entries. */ | |
d743de66 | 297 | #define REQUEST_ENTRY_CNT_24XX 2048 /* Number of request entries. */ |
f2ea653f | 298 | #define REQUEST_ENTRY_CNT_83XX 8192 /* Number of request entries. */ |
e7b42e33 | 299 | #define RESPONSE_ENTRY_CNT_83XX 4096 /* Number of response entries.*/ |
1da177e4 LT |
300 | #define RESPONSE_ENTRY_CNT_2100 64 /* Number of response entries.*/ |
301 | #define RESPONSE_ENTRY_CNT_2300 512 /* Number of response entries.*/ | |
2afa19a9 | 302 | #define RESPONSE_ENTRY_CNT_MQ 128 /* Number of response entries.*/ |
2d70c103 | 303 | #define ATIO_ENTRY_CNT_24XX 4096 /* Number of ATIO entries. */ |
8ae6d9c7 | 304 | #define RESPONSE_ENTRY_CNT_FX00 256 /* Number of response entries.*/ |
99e1b683 | 305 | #define FW_DEF_EXCHANGES_CNT 2048 |
d1e3635a QT |
306 | #define FW_MAX_EXCHANGES_CNT (32 * 1024) |
307 | #define REDUCE_EXCHANGES_CNT (8 * 1024) | |
1da177e4 | 308 | |
17d98630 | 309 | struct req_que; |
a6ca8878 | 310 | struct qla_tgt_sess; |
17d98630 | 311 | |
1da177e4 | 312 | /* |
fa2a1ce5 | 313 | * SCSI Request Block |
1da177e4 | 314 | */ |
9ba56b95 | 315 | struct srb_cmd { |
1da177e4 | 316 | struct scsi_cmnd *cmd; /* Linux SCSI command pkt */ |
1da177e4 | 317 | uint32_t request_sense_length; |
8ae6d9c7 | 318 | uint32_t fw_sense_length; |
1da177e4 | 319 | uint8_t *request_sense_ptr; |
cf53b069 | 320 | void *ctx; |
9ba56b95 | 321 | }; |
1da177e4 LT |
322 | |
323 | /* | |
324 | * SRB flag definitions | |
325 | */ | |
bad75002 AE |
326 | #define SRB_DMA_VALID BIT_0 /* Command sent to ISP */ |
327 | #define SRB_FCP_CMND_DMA_VALID BIT_12 /* DIF: DSD List valid */ | |
328 | #define SRB_CRC_CTX_DMA_VALID BIT_2 /* DIF: context DMA valid */ | |
329 | #define SRB_CRC_PROT_DMA_VALID BIT_4 /* DIF: prot DMA valid */ | |
330 | #define SRB_CRC_CTX_DSD_VALID BIT_5 /* DIF: dsd_list valid */ | |
f6145e86 | 331 | #define SRB_WAKEUP_ON_COMP BIT_6 |
50b81275 | 332 | #define SRB_DIF_BUNDL_DMA_VALID BIT_7 /* DIF: DMA list valid */ |
bad75002 AE |
333 | |
334 | /* To identify if a srb is of T10-CRC type. @sp => srb_t pointer */ | |
335 | #define IS_PROT_IO(sp) (sp->flags & SRB_CRC_CTX_DSD_VALID) | |
1da177e4 | 336 | |
2d73ac61 QT |
337 | /* |
338 | * 24 bit port ID type definition. | |
339 | */ | |
340 | typedef union { | |
341 | uint32_t b24 : 24; | |
342 | ||
343 | struct { | |
344 | #ifdef __BIG_ENDIAN | |
345 | uint8_t domain; | |
346 | uint8_t area; | |
347 | uint8_t al_pa; | |
348 | #elif defined(__LITTLE_ENDIAN) | |
349 | uint8_t al_pa; | |
350 | uint8_t area; | |
351 | uint8_t domain; | |
352 | #else | |
353 | #error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined!" | |
354 | #endif | |
355 | uint8_t rsvd_1; | |
356 | } b; | |
357 | } port_id_t; | |
358 | #define INVALID_PORT_ID 0xFFFFFF | |
359 | ||
df95f39a BVA |
360 | static inline le_id_t be_id_to_le(be_id_t id) |
361 | { | |
362 | le_id_t res; | |
363 | ||
364 | res.domain = id.domain; | |
365 | res.area = id.area; | |
366 | res.al_pa = id.al_pa; | |
367 | ||
368 | return res; | |
369 | } | |
370 | ||
371 | static inline be_id_t le_id_to_be(le_id_t id) | |
372 | { | |
373 | be_id_t res; | |
374 | ||
375 | res.domain = id.domain; | |
376 | res.area = id.area; | |
377 | res.al_pa = id.al_pa; | |
378 | ||
379 | return res; | |
380 | } | |
381 | ||
382 | static inline port_id_t be_to_port_id(be_id_t id) | |
383 | { | |
384 | port_id_t res; | |
385 | ||
386 | res.b.domain = id.domain; | |
387 | res.b.area = id.area; | |
388 | res.b.al_pa = id.al_pa; | |
389 | res.b.rsvd_1 = 0; | |
390 | ||
391 | return res; | |
392 | } | |
393 | ||
394 | static inline be_id_t port_id_to_be_id(port_id_t port_id) | |
395 | { | |
396 | be_id_t res; | |
397 | ||
398 | res.domain = port_id.b.domain; | |
399 | res.area = port_id.b.area; | |
400 | res.al_pa = port_id.b.al_pa; | |
401 | ||
402 | return res; | |
403 | } | |
404 | ||
6eb54715 HM |
405 | struct els_logo_payload { |
406 | uint8_t opcode; | |
407 | uint8_t rsvd[3]; | |
408 | uint8_t s_id[3]; | |
409 | uint8_t rsvd1[1]; | |
410 | uint8_t wwpn[WWN_SIZE]; | |
411 | }; | |
412 | ||
edd05de1 DG |
413 | struct els_plogi_payload { |
414 | uint8_t opcode; | |
415 | uint8_t rsvd[3]; | |
416 | uint8_t data[112]; | |
417 | }; | |
418 | ||
726b8548 QT |
419 | struct ct_arg { |
420 | void *iocb; | |
421 | u16 nport_handle; | |
422 | dma_addr_t req_dma; | |
423 | dma_addr_t rsp_dma; | |
424 | u32 req_size; | |
425 | u32 rsp_size; | |
b5f3bc39 QT |
426 | u32 req_allocated_size; |
427 | u32 rsp_allocated_size; | |
726b8548 QT |
428 | void *req; |
429 | void *rsp; | |
2d73ac61 | 430 | port_id_t id; |
726b8548 QT |
431 | }; |
432 | ||
ac280b67 AV |
433 | /* |
434 | * SRB extensions. | |
435 | */ | |
4916392b MI |
436 | struct srb_iocb { |
437 | union { | |
438 | struct { | |
439 | uint16_t flags; | |
440 | #define SRB_LOGIN_RETRIED BIT_0 | |
441 | #define SRB_LOGIN_COND_PLOGI BIT_1 | |
442 | #define SRB_LOGIN_SKIP_PRLI BIT_2 | |
a5d42f4c | 443 | #define SRB_LOGIN_NVME_PRLI BIT_3 |
48acad09 | 444 | #define SRB_LOGIN_PRLI_ONLY BIT_4 |
4916392b | 445 | uint16_t data[2]; |
726b8548 | 446 | u32 iop[2]; |
4916392b | 447 | } logio; |
3822263e | 448 | struct { |
6eb54715 HM |
449 | #define ELS_DCMD_TIMEOUT 20 |
450 | #define ELS_DCMD_LOGO 0x5 | |
451 | uint32_t flags; | |
452 | uint32_t els_cmd; | |
453 | struct completion comp; | |
454 | struct els_logo_payload *els_logo_pyld; | |
455 | dma_addr_t els_logo_pyld_dma; | |
456 | } els_logo; | |
457 | struct { | |
edd05de1 DG |
458 | #define ELS_DCMD_PLOGI 0x3 |
459 | uint32_t flags; | |
460 | uint32_t els_cmd; | |
461 | struct completion comp; | |
462 | struct els_plogi_payload *els_plogi_pyld; | |
463 | struct els_plogi_payload *els_resp_pyld; | |
8777e431 QT |
464 | u32 tx_size; |
465 | u32 rx_size; | |
edd05de1 DG |
466 | dma_addr_t els_plogi_pyld_dma; |
467 | dma_addr_t els_resp_pyld_dma; | |
468 | uint32_t fw_status[3]; | |
469 | __le16 comp_status; | |
470 | __le16 len; | |
471 | } els_plogi; | |
472 | struct { | |
3822263e MI |
473 | /* |
474 | * Values for flags field below are as | |
475 | * defined in tsk_mgmt_entry struct | |
476 | * for control_flags field in qla_fw.h. | |
477 | */ | |
9cb78c16 | 478 | uint64_t lun; |
3822263e | 479 | uint32_t flags; |
3822263e | 480 | uint32_t data; |
8ae6d9c7 | 481 | struct completion comp; |
1f8deefe | 482 | __le16 comp_status; |
3822263e | 483 | } tmf; |
8ae6d9c7 GM |
484 | struct { |
485 | #define SRB_FXDISC_REQ_DMA_VALID BIT_0 | |
486 | #define SRB_FXDISC_RESP_DMA_VALID BIT_1 | |
487 | #define SRB_FXDISC_REQ_DWRD_VALID BIT_2 | |
488 | #define SRB_FXDISC_RSP_DWRD_VALID BIT_3 | |
489 | #define FXDISC_TIMEOUT 20 | |
490 | uint8_t flags; | |
491 | uint32_t req_len; | |
492 | uint32_t rsp_len; | |
493 | void *req_addr; | |
494 | void *rsp_addr; | |
495 | dma_addr_t req_dma_handle; | |
496 | dma_addr_t rsp_dma_handle; | |
1f8deefe SK |
497 | __le32 adapter_id; |
498 | __le32 adapter_id_hi; | |
499 | __le16 req_func_type; | |
500 | __le32 req_data; | |
501 | __le32 req_data_extra; | |
502 | __le32 result; | |
503 | __le32 seq_number; | |
504 | __le16 fw_flags; | |
8ae6d9c7 | 505 | struct completion fxiocb_comp; |
1f8deefe | 506 | __le32 reserved_0; |
8ae6d9c7 GM |
507 | uint8_t reserved_1; |
508 | } fxiocb; | |
509 | struct { | |
510 | uint32_t cmd_hndl; | |
1f8deefe | 511 | __le16 comp_status; |
b027a5ac | 512 | __le16 req_que_no; |
8ae6d9c7 GM |
513 | struct completion comp; |
514 | } abt; | |
726b8548 | 515 | struct ct_arg ctarg; |
15f30a57 QT |
516 | #define MAX_IOCB_MB_REG 28 |
517 | #define SIZEOF_IOCB_MB_REG (MAX_IOCB_MB_REG * sizeof(uint16_t)) | |
726b8548 | 518 | struct { |
15f30a57 QT |
519 | __le16 in_mb[MAX_IOCB_MB_REG]; /* from FW */ |
520 | __le16 out_mb[MAX_IOCB_MB_REG]; /* to FW */ | |
726b8548 QT |
521 | void *out, *in; |
522 | dma_addr_t out_dma, in_dma; | |
15f30a57 QT |
523 | struct completion comp; |
524 | int rc; | |
726b8548 QT |
525 | } mbx; |
526 | struct { | |
527 | struct imm_ntfy_from_isp *ntfy; | |
528 | } nack; | |
7401bc18 DG |
529 | struct { |
530 | __le16 comp_status; | |
531 | uint16_t rsp_pyld_len; | |
532 | uint8_t aen_op; | |
533 | void *desc; | |
534 | ||
535 | /* These are only used with ls4 requests */ | |
536 | int cmd_len; | |
537 | int rsp_len; | |
538 | dma_addr_t cmd_dma; | |
539 | dma_addr_t rsp_dma; | |
e84067d7 | 540 | enum nvmefc_fcp_datadir dir; |
7401bc18 DG |
541 | uint32_t dl; |
542 | uint32_t timeout_sec; | |
cf19c45d | 543 | struct list_head entry; |
7401bc18 | 544 | } nvme; |
2853192e QT |
545 | struct { |
546 | u16 cmd; | |
547 | u16 vp_index; | |
548 | } ctrlvp; | |
4916392b | 549 | } u; |
99b0bec7 | 550 | |
ac280b67 | 551 | struct timer_list timer; |
9ba56b95 | 552 | void (*timeout)(void *); |
ac280b67 AV |
553 | }; |
554 | ||
4916392b MI |
555 | /* Values for srb_ctx type */ |
556 | #define SRB_LOGIN_CMD 1 | |
557 | #define SRB_LOGOUT_CMD 2 | |
558 | #define SRB_ELS_CMD_RPT 3 | |
559 | #define SRB_ELS_CMD_HST 4 | |
560 | #define SRB_CT_CMD 5 | |
561 | #define SRB_ADISC_CMD 6 | |
3822263e | 562 | #define SRB_TM_CMD 7 |
9ba56b95 | 563 | #define SRB_SCSI_CMD 8 |
a9b6f722 | 564 | #define SRB_BIDI_CMD 9 |
8ae6d9c7 GM |
565 | #define SRB_FXIOCB_DCMD 10 |
566 | #define SRB_FXIOCB_BCMD 11 | |
567 | #define SRB_ABT_CMD 12 | |
6eb54715 | 568 | #define SRB_ELS_DCMD 13 |
726b8548 QT |
569 | #define SRB_MB_IOCB 14 |
570 | #define SRB_CT_PTHRU_CMD 15 | |
571 | #define SRB_NACK_PLOGI 16 | |
572 | #define SRB_NACK_PRLI 17 | |
573 | #define SRB_NACK_LOGO 18 | |
7401bc18 | 574 | #define SRB_NVME_CMD 19 |
e84067d7 | 575 | #define SRB_NVME_LS 20 |
a5d42f4c | 576 | #define SRB_PRLI_CMD 21 |
2853192e | 577 | #define SRB_CTRL_VP 22 |
11aea16a | 578 | #define SRB_PRLO_CMD 23 |
ac280b67 | 579 | |
c5419e26 QT |
580 | enum { |
581 | TYPE_SRB, | |
582 | TYPE_TGT_CMD, | |
6b0431d6 | 583 | TYPE_TGT_TMCMD, /* task management */ |
c5419e26 QT |
584 | }; |
585 | ||
9ba56b95 | 586 | typedef struct srb { |
c5419e26 QT |
587 | /* |
588 | * Do not move cmd_type field, it needs to | |
589 | * line up with qla_tgt_cmd->cmd_type | |
590 | */ | |
591 | uint8_t cmd_type; | |
592 | uint8_t pad[3]; | |
9ba56b95 | 593 | atomic_t ref_count; |
4c2a2d01 QT |
594 | struct kref cmd_kref; /* need to migrate ref_count over to this */ |
595 | void *priv; | |
6fcd98fd | 596 | wait_queue_head_t nvme_ls_waitq; |
9ba56b95 | 597 | struct fc_port *fcport; |
25ff6af1 | 598 | struct scsi_qla_host *vha; |
3a4b6cc7 | 599 | unsigned int start_timer:1; |
9ba56b95 GM |
600 | uint32_t handle; |
601 | uint16_t flags; | |
9a069e19 | 602 | uint16_t type; |
15f30a57 | 603 | const char *name; |
5780790e | 604 | int iocbs; |
d7459527 | 605 | struct qla_qpair *qpair; |
2d73ac61 | 606 | struct list_head elem; |
726b8548 QT |
607 | u32 gen1; /* scratch */ |
608 | u32 gen2; /* scratch */ | |
2853192e | 609 | int rc; |
e374f9f5 | 610 | int retry_count; |
982cc4be | 611 | struct completion *comp; |
4916392b | 612 | union { |
9ba56b95 | 613 | struct srb_iocb iocb_cmd; |
75cc8cfc | 614 | struct bsg_job *bsg_job; |
9ba56b95 | 615 | struct srb_cmd scmd; |
4916392b | 616 | } u; |
6c18a43e BVA |
617 | /* |
618 | * Report completion status @res and call sp_put(@sp). @res is | |
619 | * an NVMe status code, a SCSI result (e.g. DID_OK << 16) or a | |
620 | * QLA_* status value. | |
621 | */ | |
622 | void (*done)(struct srb *sp, int res); | |
623 | /* Stop the timer and free @sp. Only used by the FCP code. */ | |
624 | void (*free)(struct srb *sp); | |
625 | /* | |
626 | * Call nvme_private->fd->done() and free @sp. Only used by the NVMe | |
627 | * code. | |
628 | */ | |
4c2a2d01 | 629 | void (*put_fn)(struct kref *kref); |
9ba56b95 GM |
630 | } srb_t; |
631 | ||
632 | #define GET_CMD_SP(sp) (sp->u.scmd.cmd) | |
633 | #define SET_CMD_SP(sp, cmd) (sp->u.scmd.cmd = cmd) | |
634 | #define GET_CMD_CTX_SP(sp) (sp->u.scmd.ctx) | |
635 | ||
636 | #define GET_CMD_SENSE_LEN(sp) \ | |
637 | (sp->u.scmd.request_sense_length) | |
638 | #define SET_CMD_SENSE_LEN(sp, len) \ | |
639 | (sp->u.scmd.request_sense_length = len) | |
640 | #define GET_CMD_SENSE_PTR(sp) \ | |
641 | (sp->u.scmd.request_sense_ptr) | |
642 | #define SET_CMD_SENSE_PTR(sp, ptr) \ | |
643 | (sp->u.scmd.request_sense_ptr = ptr) | |
8ae6d9c7 GM |
644 | #define GET_FW_SENSE_LEN(sp) \ |
645 | (sp->u.scmd.fw_sense_length) | |
646 | #define SET_FW_SENSE_LEN(sp, len) \ | |
647 | (sp->u.scmd.fw_sense_length = len) | |
9a069e19 GM |
648 | |
649 | struct msg_echo_lb { | |
650 | dma_addr_t send_dma; | |
651 | dma_addr_t rcv_dma; | |
652 | uint16_t req_sg_cnt; | |
653 | uint16_t rsp_sg_cnt; | |
654 | uint16_t options; | |
655 | uint32_t transfer_size; | |
1b98b421 | 656 | uint32_t iteration_count; |
9a069e19 GM |
657 | }; |
658 | ||
1da177e4 LT |
659 | /* |
660 | * ISP I/O Register Set structure definitions. | |
661 | */ | |
3d71644c AV |
662 | struct device_reg_2xxx { |
663 | uint16_t flash_address; /* Flash BIOS address */ | |
664 | uint16_t flash_data; /* Flash BIOS data */ | |
1da177e4 | 665 | uint16_t unused_1[1]; /* Gap */ |
3d71644c | 666 | uint16_t ctrl_status; /* Control/Status */ |
fa2a1ce5 | 667 | #define CSR_FLASH_64K_BANK BIT_3 /* Flash upper 64K bank select */ |
1da177e4 LT |
668 | #define CSR_FLASH_ENABLE BIT_1 /* Flash BIOS Read/Write enable */ |
669 | #define CSR_ISP_SOFT_RESET BIT_0 /* ISP soft reset */ | |
670 | ||
3d71644c | 671 | uint16_t ictrl; /* Interrupt control */ |
1da177e4 LT |
672 | #define ICR_EN_INT BIT_15 /* ISP enable interrupts. */ |
673 | #define ICR_EN_RISC BIT_3 /* ISP enable RISC interrupts. */ | |
674 | ||
3d71644c | 675 | uint16_t istatus; /* Interrupt status */ |
1da177e4 LT |
676 | #define ISR_RISC_INT BIT_3 /* RISC interrupt */ |
677 | ||
3d71644c AV |
678 | uint16_t semaphore; /* Semaphore */ |
679 | uint16_t nvram; /* NVRAM register. */ | |
1da177e4 LT |
680 | #define NVR_DESELECT 0 |
681 | #define NVR_BUSY BIT_15 | |
682 | #define NVR_WRT_ENABLE BIT_14 /* Write enable */ | |
683 | #define NVR_PR_ENABLE BIT_13 /* Protection register enable */ | |
684 | #define NVR_DATA_IN BIT_3 | |
685 | #define NVR_DATA_OUT BIT_2 | |
686 | #define NVR_SELECT BIT_1 | |
687 | #define NVR_CLOCK BIT_0 | |
688 | ||
45aeaf1e RA |
689 | #define NVR_WAIT_CNT 20000 |
690 | ||
1da177e4 LT |
691 | union { |
692 | struct { | |
3d71644c AV |
693 | uint16_t mailbox0; |
694 | uint16_t mailbox1; | |
695 | uint16_t mailbox2; | |
696 | uint16_t mailbox3; | |
697 | uint16_t mailbox4; | |
698 | uint16_t mailbox5; | |
699 | uint16_t mailbox6; | |
700 | uint16_t mailbox7; | |
701 | uint16_t unused_2[59]; /* Gap */ | |
1da177e4 LT |
702 | } __attribute__((packed)) isp2100; |
703 | struct { | |
3d71644c AV |
704 | /* Request Queue */ |
705 | uint16_t req_q_in; /* In-Pointer */ | |
706 | uint16_t req_q_out; /* Out-Pointer */ | |
707 | /* Response Queue */ | |
708 | uint16_t rsp_q_in; /* In-Pointer */ | |
709 | uint16_t rsp_q_out; /* Out-Pointer */ | |
1da177e4 LT |
710 | |
711 | /* RISC to Host Status */ | |
fa2a1ce5 | 712 | uint32_t host_status; |
1da177e4 LT |
713 | #define HSR_RISC_INT BIT_15 /* RISC interrupt */ |
714 | #define HSR_RISC_PAUSED BIT_8 /* RISC Paused */ | |
715 | ||
716 | /* Host to Host Semaphore */ | |
fa2a1ce5 | 717 | uint16_t host_semaphore; |
3d71644c AV |
718 | uint16_t unused_3[17]; /* Gap */ |
719 | uint16_t mailbox0; | |
720 | uint16_t mailbox1; | |
721 | uint16_t mailbox2; | |
722 | uint16_t mailbox3; | |
723 | uint16_t mailbox4; | |
724 | uint16_t mailbox5; | |
725 | uint16_t mailbox6; | |
726 | uint16_t mailbox7; | |
727 | uint16_t mailbox8; | |
728 | uint16_t mailbox9; | |
729 | uint16_t mailbox10; | |
730 | uint16_t mailbox11; | |
731 | uint16_t mailbox12; | |
732 | uint16_t mailbox13; | |
733 | uint16_t mailbox14; | |
734 | uint16_t mailbox15; | |
735 | uint16_t mailbox16; | |
736 | uint16_t mailbox17; | |
737 | uint16_t mailbox18; | |
738 | uint16_t mailbox19; | |
739 | uint16_t mailbox20; | |
740 | uint16_t mailbox21; | |
741 | uint16_t mailbox22; | |
742 | uint16_t mailbox23; | |
743 | uint16_t mailbox24; | |
744 | uint16_t mailbox25; | |
745 | uint16_t mailbox26; | |
746 | uint16_t mailbox27; | |
747 | uint16_t mailbox28; | |
748 | uint16_t mailbox29; | |
749 | uint16_t mailbox30; | |
750 | uint16_t mailbox31; | |
751 | uint16_t fb_cmd; | |
752 | uint16_t unused_4[10]; /* Gap */ | |
1da177e4 LT |
753 | } __attribute__((packed)) isp2300; |
754 | } u; | |
755 | ||
3d71644c | 756 | uint16_t fpm_diag_config; |
c81d04c9 AV |
757 | uint16_t unused_5[0x4]; /* Gap */ |
758 | uint16_t risc_hw; | |
759 | uint16_t unused_5_1; /* Gap */ | |
3d71644c | 760 | uint16_t pcr; /* Processor Control Register. */ |
1da177e4 | 761 | uint16_t unused_6[0x5]; /* Gap */ |
3d71644c | 762 | uint16_t mctr; /* Memory Configuration and Timing. */ |
1da177e4 | 763 | uint16_t unused_7[0x3]; /* Gap */ |
3d71644c | 764 | uint16_t fb_cmd_2100; /* Unused on 23XX */ |
1da177e4 | 765 | uint16_t unused_8[0x3]; /* Gap */ |
3d71644c | 766 | uint16_t hccr; /* Host command & control register. */ |
1da177e4 LT |
767 | #define HCCR_HOST_INT BIT_7 /* Host interrupt bit */ |
768 | #define HCCR_RISC_PAUSE BIT_5 /* Pause mode bit */ | |
769 | /* HCCR commands */ | |
770 | #define HCCR_RESET_RISC 0x1000 /* Reset RISC */ | |
771 | #define HCCR_PAUSE_RISC 0x2000 /* Pause RISC */ | |
772 | #define HCCR_RELEASE_RISC 0x3000 /* Release RISC from reset. */ | |
773 | #define HCCR_SET_HOST_INT 0x5000 /* Set host interrupt */ | |
774 | #define HCCR_CLR_HOST_INT 0x6000 /* Clear HOST interrupt */ | |
775 | #define HCCR_CLR_RISC_INT 0x7000 /* Clear RISC interrupt */ | |
776 | #define HCCR_DISABLE_PARITY_PAUSE 0x4001 /* Disable parity error RISC pause. */ | |
777 | #define HCCR_ENABLE_PARITY 0xA000 /* Enable PARITY interrupt */ | |
778 | ||
779 | uint16_t unused_9[5]; /* Gap */ | |
3d71644c AV |
780 | uint16_t gpiod; /* GPIO Data register. */ |
781 | uint16_t gpioe; /* GPIO Enable register. */ | |
1da177e4 LT |
782 | #define GPIO_LED_MASK 0x00C0 |
783 | #define GPIO_LED_GREEN_OFF_AMBER_OFF 0x0000 | |
784 | #define GPIO_LED_GREEN_ON_AMBER_OFF 0x0040 | |
785 | #define GPIO_LED_GREEN_OFF_AMBER_ON 0x0080 | |
786 | #define GPIO_LED_GREEN_ON_AMBER_ON 0x00C0 | |
f6df144c | 787 | #define GPIO_LED_ALL_OFF 0x0000 |
788 | #define GPIO_LED_RED_ON_OTHER_OFF 0x0001 /* isp2322 */ | |
789 | #define GPIO_LED_RGA_ON 0x00C1 /* isp2322: red green amber */ | |
1da177e4 LT |
790 | |
791 | union { | |
792 | struct { | |
3d71644c AV |
793 | uint16_t unused_10[8]; /* Gap */ |
794 | uint16_t mailbox8; | |
795 | uint16_t mailbox9; | |
796 | uint16_t mailbox10; | |
797 | uint16_t mailbox11; | |
798 | uint16_t mailbox12; | |
799 | uint16_t mailbox13; | |
800 | uint16_t mailbox14; | |
801 | uint16_t mailbox15; | |
802 | uint16_t mailbox16; | |
803 | uint16_t mailbox17; | |
804 | uint16_t mailbox18; | |
805 | uint16_t mailbox19; | |
806 | uint16_t mailbox20; | |
807 | uint16_t mailbox21; | |
808 | uint16_t mailbox22; | |
809 | uint16_t mailbox23; /* Also probe reg. */ | |
1da177e4 LT |
810 | } __attribute__((packed)) isp2200; |
811 | } u_end; | |
3d71644c AV |
812 | }; |
813 | ||
73208dfd | 814 | struct device_reg_25xxmq { |
08029990 AV |
815 | uint32_t req_q_in; |
816 | uint32_t req_q_out; | |
817 | uint32_t rsp_q_in; | |
818 | uint32_t rsp_q_out; | |
aa230bc5 AE |
819 | uint32_t atio_q_in; |
820 | uint32_t atio_q_out; | |
73208dfd AC |
821 | }; |
822 | ||
8ae6d9c7 GM |
823 | |
824 | struct device_reg_fx00 { | |
825 | uint32_t mailbox0; /* 00 */ | |
826 | uint32_t mailbox1; /* 04 */ | |
827 | uint32_t mailbox2; /* 08 */ | |
828 | uint32_t mailbox3; /* 0C */ | |
829 | uint32_t mailbox4; /* 10 */ | |
830 | uint32_t mailbox5; /* 14 */ | |
831 | uint32_t mailbox6; /* 18 */ | |
832 | uint32_t mailbox7; /* 1C */ | |
833 | uint32_t mailbox8; /* 20 */ | |
834 | uint32_t mailbox9; /* 24 */ | |
835 | uint32_t mailbox10; /* 28 */ | |
836 | uint32_t mailbox11; | |
837 | uint32_t mailbox12; | |
838 | uint32_t mailbox13; | |
839 | uint32_t mailbox14; | |
840 | uint32_t mailbox15; | |
841 | uint32_t mailbox16; | |
842 | uint32_t mailbox17; | |
843 | uint32_t mailbox18; | |
844 | uint32_t mailbox19; | |
845 | uint32_t mailbox20; | |
846 | uint32_t mailbox21; | |
847 | uint32_t mailbox22; | |
848 | uint32_t mailbox23; | |
849 | uint32_t mailbox24; | |
850 | uint32_t mailbox25; | |
851 | uint32_t mailbox26; | |
852 | uint32_t mailbox27; | |
853 | uint32_t mailbox28; | |
854 | uint32_t mailbox29; | |
855 | uint32_t mailbox30; | |
856 | uint32_t mailbox31; | |
857 | uint32_t aenmailbox0; | |
858 | uint32_t aenmailbox1; | |
859 | uint32_t aenmailbox2; | |
860 | uint32_t aenmailbox3; | |
861 | uint32_t aenmailbox4; | |
862 | uint32_t aenmailbox5; | |
863 | uint32_t aenmailbox6; | |
864 | uint32_t aenmailbox7; | |
865 | /* Request Queue. */ | |
866 | uint32_t req_q_in; /* A0 - Request Queue In-Pointer */ | |
867 | uint32_t req_q_out; /* A4 - Request Queue Out-Pointer */ | |
868 | /* Response Queue. */ | |
869 | uint32_t rsp_q_in; /* A8 - Response Queue In-Pointer */ | |
870 | uint32_t rsp_q_out; /* AC - Response Queue Out-Pointer */ | |
871 | /* Init values shadowed on FW Up Event */ | |
872 | uint32_t initval0; /* B0 */ | |
873 | uint32_t initval1; /* B4 */ | |
874 | uint32_t initval2; /* B8 */ | |
875 | uint32_t initval3; /* BC */ | |
876 | uint32_t initval4; /* C0 */ | |
877 | uint32_t initval5; /* C4 */ | |
878 | uint32_t initval6; /* C8 */ | |
879 | uint32_t initval7; /* CC */ | |
880 | uint32_t fwheartbeat; /* D0 */ | |
f9a2a543 | 881 | uint32_t pseudoaen; /* D4 */ |
8ae6d9c7 GM |
882 | }; |
883 | ||
884 | ||
885 | ||
9a168bdd | 886 | typedef union { |
3d71644c AV |
887 | struct device_reg_2xxx isp; |
888 | struct device_reg_24xx isp24; | |
73208dfd | 889 | struct device_reg_25xxmq isp25mq; |
a9083016 | 890 | struct device_reg_82xx isp82; |
8ae6d9c7 | 891 | struct device_reg_fx00 ispfx00; |
f73cb695 | 892 | } __iomem device_reg_t; |
1da177e4 LT |
893 | |
894 | #define ISP_REQ_Q_IN(ha, reg) \ | |
895 | (IS_QLA2100(ha) || IS_QLA2200(ha) ? \ | |
896 | &(reg)->u.isp2100.mailbox4 : \ | |
897 | &(reg)->u.isp2300.req_q_in) | |
898 | #define ISP_REQ_Q_OUT(ha, reg) \ | |
899 | (IS_QLA2100(ha) || IS_QLA2200(ha) ? \ | |
900 | &(reg)->u.isp2100.mailbox4 : \ | |
901 | &(reg)->u.isp2300.req_q_out) | |
902 | #define ISP_RSP_Q_IN(ha, reg) \ | |
903 | (IS_QLA2100(ha) || IS_QLA2200(ha) ? \ | |
904 | &(reg)->u.isp2100.mailbox5 : \ | |
905 | &(reg)->u.isp2300.rsp_q_in) | |
906 | #define ISP_RSP_Q_OUT(ha, reg) \ | |
907 | (IS_QLA2100(ha) || IS_QLA2200(ha) ? \ | |
908 | &(reg)->u.isp2100.mailbox5 : \ | |
909 | &(reg)->u.isp2300.rsp_q_out) | |
910 | ||
aa230bc5 AE |
911 | #define ISP_ATIO_Q_IN(vha) (vha->hw->tgt.atio_q_in) |
912 | #define ISP_ATIO_Q_OUT(vha) (vha->hw->tgt.atio_q_out) | |
913 | ||
1da177e4 LT |
914 | #define MAILBOX_REG(ha, reg, num) \ |
915 | (IS_QLA2100(ha) || IS_QLA2200(ha) ? \ | |
916 | (num < 8 ? \ | |
917 | &(reg)->u.isp2100.mailbox0 + (num) : \ | |
918 | &(reg)->u_end.isp2200.mailbox8 + (num) - 8) : \ | |
919 | &(reg)->u.isp2300.mailbox0 + (num)) | |
920 | #define RD_MAILBOX_REG(ha, reg, num) \ | |
921 | RD_REG_WORD(MAILBOX_REG(ha, reg, num)) | |
922 | #define WRT_MAILBOX_REG(ha, reg, num, data) \ | |
923 | WRT_REG_WORD(MAILBOX_REG(ha, reg, num), data) | |
924 | ||
925 | #define FB_CMD_REG(ha, reg) \ | |
926 | (IS_QLA2100(ha) || IS_QLA2200(ha) ? \ | |
927 | &(reg)->fb_cmd_2100 : \ | |
928 | &(reg)->u.isp2300.fb_cmd) | |
929 | #define RD_FB_CMD_REG(ha, reg) \ | |
930 | RD_REG_WORD(FB_CMD_REG(ha, reg)) | |
931 | #define WRT_FB_CMD_REG(ha, reg, data) \ | |
932 | WRT_REG_WORD(FB_CMD_REG(ha, reg), data) | |
933 | ||
934 | typedef struct { | |
935 | uint32_t out_mb; /* outbound from driver */ | |
936 | uint32_t in_mb; /* Incoming from RISC */ | |
937 | uint16_t mb[MAILBOX_REGISTER_COUNT]; | |
938 | long buf_size; | |
939 | void *bufp; | |
940 | uint32_t tov; | |
941 | uint8_t flags; | |
942 | #define MBX_DMA_IN BIT_0 | |
943 | #define MBX_DMA_OUT BIT_1 | |
944 | #define IOCTL_CMD BIT_2 | |
945 | } mbx_cmd_t; | |
946 | ||
8ae6d9c7 GM |
947 | struct mbx_cmd_32 { |
948 | uint32_t out_mb; /* outbound from driver */ | |
949 | uint32_t in_mb; /* Incoming from RISC */ | |
950 | uint32_t mb[MAILBOX_REGISTER_COUNT]; | |
951 | long buf_size; | |
952 | void *bufp; | |
953 | uint32_t tov; | |
954 | uint8_t flags; | |
955 | #define MBX_DMA_IN BIT_0 | |
956 | #define MBX_DMA_OUT BIT_1 | |
957 | #define IOCTL_CMD BIT_2 | |
958 | }; | |
959 | ||
960 | ||
1da177e4 LT |
961 | #define MBX_TOV_SECONDS 30 |
962 | ||
963 | /* | |
964 | * ISP product identification definitions in mailboxes after reset. | |
965 | */ | |
966 | #define PROD_ID_1 0x4953 | |
967 | #define PROD_ID_2 0x0000 | |
968 | #define PROD_ID_2a 0x5020 | |
969 | #define PROD_ID_3 0x2020 | |
970 | ||
971 | /* | |
972 | * ISP mailbox Self-Test status codes | |
973 | */ | |
974 | #define MBS_FRM_ALIVE 0 /* Firmware Alive. */ | |
975 | #define MBS_CHKSUM_ERR 1 /* Checksum Error. */ | |
976 | #define MBS_BUSY 4 /* Busy. */ | |
977 | ||
978 | /* | |
979 | * ISP mailbox command complete status codes | |
980 | */ | |
981 | #define MBS_COMMAND_COMPLETE 0x4000 | |
982 | #define MBS_INVALID_COMMAND 0x4001 | |
983 | #define MBS_HOST_INTERFACE_ERROR 0x4002 | |
984 | #define MBS_TEST_FAILED 0x4003 | |
985 | #define MBS_COMMAND_ERROR 0x4005 | |
986 | #define MBS_COMMAND_PARAMETER_ERROR 0x4006 | |
987 | #define MBS_PORT_ID_USED 0x4007 | |
988 | #define MBS_LOOP_ID_USED 0x4008 | |
989 | #define MBS_ALL_IDS_IN_USE 0x4009 | |
990 | #define MBS_NOT_LOGGED_IN 0x400A | |
3d71644c AV |
991 | #define MBS_LINK_DOWN_ERROR 0x400B |
992 | #define MBS_DIAG_ECHO_TEST_ERROR 0x400C | |
1da177e4 LT |
993 | |
994 | /* | |
995 | * ISP mailbox asynchronous event status codes | |
996 | */ | |
997 | #define MBA_ASYNC_EVENT 0x8000 /* Asynchronous event. */ | |
998 | #define MBA_RESET 0x8001 /* Reset Detected. */ | |
999 | #define MBA_SYSTEM_ERR 0x8002 /* System Error. */ | |
1000 | #define MBA_REQ_TRANSFER_ERR 0x8003 /* Request Transfer Error. */ | |
1001 | #define MBA_RSP_TRANSFER_ERR 0x8004 /* Response Transfer Error. */ | |
1002 | #define MBA_WAKEUP_THRES 0x8005 /* Request Queue Wake-up. */ | |
1003 | #define MBA_LIP_OCCURRED 0x8010 /* Loop Initialization Procedure */ | |
1004 | /* occurred. */ | |
1005 | #define MBA_LOOP_UP 0x8011 /* FC Loop UP. */ | |
1006 | #define MBA_LOOP_DOWN 0x8012 /* FC Loop Down. */ | |
1007 | #define MBA_LIP_RESET 0x8013 /* LIP reset occurred. */ | |
1008 | #define MBA_PORT_UPDATE 0x8014 /* Port Database update. */ | |
1009 | #define MBA_RSCN_UPDATE 0x8015 /* Register State Chg Notification. */ | |
1010 | #define MBA_LIP_F8 0x8016 /* Received a LIP F8. */ | |
1011 | #define MBA_LOOP_INIT_ERR 0x8017 /* Loop Initialization Error. */ | |
1012 | #define MBA_FABRIC_AUTH_REQ 0x801b /* Fabric Authentication Required. */ | |
1013 | #define MBA_SCSI_COMPLETION 0x8020 /* SCSI Command Complete. */ | |
1014 | #define MBA_CTIO_COMPLETION 0x8021 /* CTIO Complete. */ | |
1015 | #define MBA_IP_COMPLETION 0x8022 /* IP Transmit Command Complete. */ | |
1016 | #define MBA_IP_RECEIVE 0x8023 /* IP Received. */ | |
1017 | #define MBA_IP_BROADCAST 0x8024 /* IP Broadcast Received. */ | |
1018 | #define MBA_IP_LOW_WATER_MARK 0x8025 /* IP Low Water Mark reached. */ | |
1019 | #define MBA_IP_RCV_BUFFER_EMPTY 0x8026 /* IP receive buffer queue empty. */ | |
1020 | #define MBA_IP_HDR_DATA_SPLIT 0x8027 /* IP header/data splitting feature */ | |
1021 | /* used. */ | |
45ebeb56 | 1022 | #define MBA_TRACE_NOTIFICATION 0x8028 /* Trace/Diagnostic notification. */ |
1da177e4 LT |
1023 | #define MBA_POINT_TO_POINT 0x8030 /* Point to point mode. */ |
1024 | #define MBA_CMPLT_1_16BIT 0x8031 /* Completion 1 16bit IOSB. */ | |
1025 | #define MBA_CMPLT_2_16BIT 0x8032 /* Completion 2 16bit IOSB. */ | |
1026 | #define MBA_CMPLT_3_16BIT 0x8033 /* Completion 3 16bit IOSB. */ | |
1027 | #define MBA_CMPLT_4_16BIT 0x8034 /* Completion 4 16bit IOSB. */ | |
1028 | #define MBA_CMPLT_5_16BIT 0x8035 /* Completion 5 16bit IOSB. */ | |
1029 | #define MBA_CHG_IN_CONNECTION 0x8036 /* Change in connection mode. */ | |
1030 | #define MBA_RIO_RESPONSE 0x8040 /* RIO response queue update. */ | |
1031 | #define MBA_ZIO_RESPONSE 0x8040 /* ZIO response queue update. */ | |
1032 | #define MBA_CMPLT_2_32BIT 0x8042 /* Completion 2 32bit IOSB. */ | |
1033 | #define MBA_BYPASS_NOTIFICATION 0x8043 /* Auto bypass notification. */ | |
1034 | #define MBA_DISCARD_RND_FRAME 0x8048 /* discard RND frame due to error. */ | |
1035 | #define MBA_REJECTED_FCP_CMD 0x8049 /* rejected FCP_CMD. */ | |
8ae6d9c7 GM |
1036 | #define MBA_FW_NOT_STARTED 0x8050 /* Firmware not started */ |
1037 | #define MBA_FW_STARTING 0x8051 /* Firmware starting */ | |
1038 | #define MBA_FW_RESTART_CMPLT 0x8060 /* Firmware restart complete */ | |
1039 | #define MBA_INIT_REQUIRED 0x8061 /* Initialization required */ | |
1040 | #define MBA_SHUTDOWN_REQUESTED 0x8062 /* Shutdown Requested */ | |
a29b3dd7 | 1041 | #define MBA_TEMPERATURE_ALERT 0x8070 /* Temperature Alert */ |
b5a340dd | 1042 | #define MBA_DPORT_DIAGNOSTICS 0x8080 /* D-port Diagnostics */ |
92d4408e | 1043 | #define MBA_TRANS_INSERT 0x8130 /* Transceiver Insertion */ |
8ae6d9c7 GM |
1044 | #define MBA_FW_INIT_FAILURE 0x8401 /* Firmware initialization failure */ |
1045 | #define MBA_MIRROR_LUN_CHANGE 0x8402 /* Mirror LUN State Change | |
1046 | Notification */ | |
1047 | #define MBA_FW_POLL_STATE 0x8600 /* Firmware in poll diagnostic state */ | |
b6511d99 | 1048 | #define MBA_FW_RESET_FCT 0x8502 /* Firmware reset factory defaults */ |
0f8cdff5 | 1049 | #define MBA_FW_INIT_INPROGRESS 0x8500 /* Firmware boot in progress */ |
7d613ac6 SV |
1050 | /* 83XX FCoE specific */ |
1051 | #define MBA_IDC_AEN 0x8200 /* FCoE: NIC Core state change AEN */ | |
fafbda9f AE |
1052 | |
1053 | /* Interrupt type codes */ | |
1054 | #define INTR_ROM_MB_SUCCESS 0x1 | |
1055 | #define INTR_ROM_MB_FAILED 0x2 | |
1056 | #define INTR_MB_SUCCESS 0x10 | |
1057 | #define INTR_MB_FAILED 0x11 | |
1058 | #define INTR_ASYNC_EVENT 0x12 | |
1059 | #define INTR_RSP_QUE_UPDATE 0x13 | |
1060 | #define INTR_RSP_QUE_UPDATE_83XX 0x14 | |
1061 | #define INTR_ATIO_QUE_UPDATE 0x1C | |
1062 | #define INTR_ATIO_RSP_QUE_UPDATE 0x1D | |
c9558869 | 1063 | #define INTR_ATIO_QUE_UPDATE_27XX 0x1E |
7d613ac6 | 1064 | |
9a069e19 GM |
1065 | /* ISP mailbox loopback echo diagnostic error code */ |
1066 | #define MBS_LB_RESET 0x17 | |
1da177e4 LT |
1067 | /* |
1068 | * Firmware options 1, 2, 3. | |
1069 | */ | |
1070 | #define FO1_AE_ON_LIPF8 BIT_0 | |
1071 | #define FO1_AE_ALL_LIP_RESET BIT_1 | |
1072 | #define FO1_CTIO_RETRY BIT_3 | |
1073 | #define FO1_DISABLE_LIP_F7_SW BIT_4 | |
1074 | #define FO1_DISABLE_100MS_LOS_WAIT BIT_5 | |
3d71644c | 1075 | #define FO1_DISABLE_GPIO6_7 BIT_6 /* LED bits */ |
1da177e4 LT |
1076 | #define FO1_AE_ON_LOOP_INIT_ERR BIT_7 |
1077 | #define FO1_SET_EMPHASIS_SWING BIT_8 | |
1078 | #define FO1_AE_AUTO_BYPASS BIT_9 | |
1079 | #define FO1_ENABLE_PURE_IOCB BIT_10 | |
1080 | #define FO1_AE_PLOGI_RJT BIT_11 | |
1081 | #define FO1_ENABLE_ABORT_SEQUENCE BIT_12 | |
1082 | #define FO1_AE_QUEUE_FULL BIT_13 | |
1083 | ||
1084 | #define FO2_ENABLE_ATIO_TYPE_3 BIT_0 | |
1085 | #define FO2_REV_LOOPBACK BIT_1 | |
1086 | ||
1087 | #define FO3_ENABLE_EMERG_IOCB BIT_0 | |
1088 | #define FO3_AE_RND_ERROR BIT_1 | |
1089 | ||
3d71644c AV |
1090 | /* 24XX additional firmware options */ |
1091 | #define ADD_FO_COUNT 3 | |
1092 | #define ADD_FO1_DISABLE_GPIO_LED_CTRL BIT_6 /* LED bits */ | |
1093 | #define ADD_FO1_ENABLE_PUREX_IOCB BIT_10 | |
1094 | ||
1095 | #define ADD_FO2_ENABLE_SEL_CLS2 BIT_5 | |
1096 | ||
1097 | #define ADD_FO3_NO_ABT_ON_LINK_DOWN BIT_14 | |
1098 | ||
1da177e4 LT |
1099 | /* |
1100 | * ISP mailbox commands | |
1101 | */ | |
1102 | #define MBC_LOAD_RAM 1 /* Load RAM. */ | |
1103 | #define MBC_EXECUTE_FIRMWARE 2 /* Execute firmware. */ | |
1da177e4 LT |
1104 | #define MBC_READ_RAM_WORD 5 /* Read RAM word. */ |
1105 | #define MBC_MAILBOX_REGISTER_TEST 6 /* Wrap incoming mailboxes */ | |
1106 | #define MBC_VERIFY_CHECKSUM 7 /* Verify checksum. */ | |
1107 | #define MBC_GET_FIRMWARE_VERSION 8 /* Get firmware revision. */ | |
1108 | #define MBC_LOAD_RISC_RAM 9 /* Load RAM command. */ | |
1109 | #define MBC_DUMP_RISC_RAM 0xa /* Dump RAM command. */ | |
3f006ac3 | 1110 | #define MBC_SECURE_FLASH_UPDATE 0xa /* Secure Flash Update(28xx) */ |
1da177e4 LT |
1111 | #define MBC_LOAD_RISC_RAM_EXTENDED 0xb /* Load RAM extended. */ |
1112 | #define MBC_DUMP_RISC_RAM_EXTENDED 0xc /* Dump RAM extended. */ | |
1113 | #define MBC_WRITE_RAM_WORD_EXTENDED 0xd /* Write RAM word extended */ | |
1114 | #define MBC_READ_RAM_EXTENDED 0xf /* Read RAM extended. */ | |
1115 | #define MBC_IOCB_COMMAND 0x12 /* Execute IOCB command. */ | |
f6ef3b18 | 1116 | #define MBC_STOP_FIRMWARE 0x14 /* Stop firmware. */ |
1da177e4 LT |
1117 | #define MBC_ABORT_COMMAND 0x15 /* Abort IOCB command. */ |
1118 | #define MBC_ABORT_DEVICE 0x16 /* Abort device (ID/LUN). */ | |
1119 | #define MBC_ABORT_TARGET 0x17 /* Abort target (ID). */ | |
1120 | #define MBC_RESET 0x18 /* Reset. */ | |
1121 | #define MBC_GET_ADAPTER_LOOP_ID 0x20 /* Get loop id of ISP2200. */ | |
deeae7a6 | 1122 | #define MBC_GET_SET_ZIO_THRESHOLD 0x21 /* Get/SET ZIO THRESHOLD. */ |
1da177e4 LT |
1123 | #define MBC_GET_RETRY_COUNT 0x22 /* Get f/w retry cnt/delay. */ |
1124 | #define MBC_DISABLE_VI 0x24 /* Disable VI operation. */ | |
1125 | #define MBC_ENABLE_VI 0x25 /* Enable VI operation. */ | |
1126 | #define MBC_GET_FIRMWARE_OPTION 0x28 /* Get Firmware Options. */ | |
b0d6cabd | 1127 | #define MBC_GET_MEM_OFFLOAD_CNTRL_STAT 0x34 /* Memory Offload ctrl/Stat*/ |
1da177e4 LT |
1128 | #define MBC_SET_FIRMWARE_OPTION 0x38 /* Set Firmware Options. */ |
1129 | #define MBC_LOOP_PORT_BYPASS 0x40 /* Loop Port Bypass. */ | |
1130 | #define MBC_LOOP_PORT_ENABLE 0x41 /* Loop Port Enable. */ | |
1131 | #define MBC_GET_RESOURCE_COUNTS 0x42 /* Get Resource Counts. */ | |
1132 | #define MBC_NON_PARTICIPATE 0x43 /* Non-Participating Mode. */ | |
1133 | #define MBC_DIAGNOSTIC_ECHO 0x44 /* Diagnostic echo. */ | |
1134 | #define MBC_DIAGNOSTIC_LOOP_BACK 0x45 /* Diagnostic loop back. */ | |
1135 | #define MBC_ONLINE_SELF_TEST 0x46 /* Online self-test. */ | |
1136 | #define MBC_ENHANCED_GET_PORT_DATABASE 0x47 /* Get port database + login */ | |
6246b8a1 | 1137 | #define MBC_CONFIGURE_VF 0x4b /* Configure VFs */ |
1da177e4 LT |
1138 | #define MBC_RESET_LINK_STATUS 0x52 /* Reset Link Error Status */ |
1139 | #define MBC_IOCB_COMMAND_A64 0x54 /* Execute IOCB command (64) */ | |
af11f64d | 1140 | #define MBC_PORT_LOGOUT 0x56 /* Port Logout request */ |
1da177e4 LT |
1141 | #define MBC_SEND_RNID_ELS 0x57 /* Send RNID ELS request */ |
1142 | #define MBC_SET_RNID_PARAMS 0x59 /* Set RNID parameters */ | |
90687a1e JC |
1143 | #define MBC_GET_RNID_PARAMS 0x5a /* Get RNID parameters */ |
1144 | #define MBC_DATA_RATE 0x5d /* Data Rate */ | |
1da177e4 LT |
1145 | #define MBC_INITIALIZE_FIRMWARE 0x60 /* Initialize firmware */ |
1146 | #define MBC_INITIATE_LIP 0x62 /* Initiate Loop */ | |
1147 | /* Initialization Procedure */ | |
1148 | #define MBC_GET_FC_AL_POSITION_MAP 0x63 /* Get FC_AL Position Map. */ | |
1149 | #define MBC_GET_PORT_DATABASE 0x64 /* Get Port Database. */ | |
1150 | #define MBC_CLEAR_ACA 0x65 /* Clear ACA. */ | |
1151 | #define MBC_TARGET_RESET 0x66 /* Target Reset. */ | |
1152 | #define MBC_CLEAR_TASK_SET 0x67 /* Clear Task Set. */ | |
1153 | #define MBC_ABORT_TASK_SET 0x68 /* Abort Task Set. */ | |
1154 | #define MBC_GET_FIRMWARE_STATE 0x69 /* Get firmware state. */ | |
1155 | #define MBC_GET_PORT_NAME 0x6a /* Get port name. */ | |
1156 | #define MBC_GET_LINK_STATUS 0x6b /* Get port link status. */ | |
1157 | #define MBC_LIP_RESET 0x6c /* LIP reset. */ | |
1158 | #define MBC_SEND_SNS_COMMAND 0x6e /* Send Simple Name Server */ | |
1159 | /* commandd. */ | |
1160 | #define MBC_LOGIN_FABRIC_PORT 0x6f /* Login fabric port. */ | |
1161 | #define MBC_SEND_CHANGE_REQUEST 0x70 /* Send Change Request. */ | |
1162 | #define MBC_LOGOUT_FABRIC_PORT 0x71 /* Logout fabric port. */ | |
1163 | #define MBC_LIP_FULL_LOGIN 0x72 /* Full login LIP. */ | |
1164 | #define MBC_LOGIN_LOOP_PORT 0x74 /* Login Loop Port. */ | |
1165 | #define MBC_PORT_NODE_NAME_LIST 0x75 /* Get port/node name list. */ | |
1166 | #define MBC_INITIALIZE_RECEIVE_QUEUE 0x77 /* Initialize receive queue */ | |
1167 | #define MBC_UNLOAD_IP 0x79 /* Shutdown IP */ | |
1168 | #define MBC_GET_ID_LIST 0x7C /* Get Port ID list. */ | |
1169 | #define MBC_SEND_LFA_COMMAND 0x7D /* Send Loop Fabric Address */ | |
1170 | #define MBC_LUN_RESET 0x7E /* Send LUN reset */ | |
1171 | ||
8ae6d9c7 GM |
1172 | /* |
1173 | * all the Mt. Rainier mailbox command codes that clash with FC/FCoE ones | |
1174 | * should be defined with MBC_MR_* | |
1175 | */ | |
1176 | #define MBC_MR_DRV_SHUTDOWN 0x6A | |
1177 | ||
3d71644c AV |
1178 | /* |
1179 | * ISP24xx mailbox commands | |
1180 | */ | |
db64e930 JC |
1181 | #define MBC_WRITE_SERDES 0x3 /* Write serdes word. */ |
1182 | #define MBC_READ_SERDES 0x4 /* Read serdes word. */ | |
f73cb695 | 1183 | #define MBC_LOAD_DUMP_MPI_RAM 0x5 /* Load/Dump MPI RAM. */ |
3d71644c AV |
1184 | #define MBC_SERDES_PARAMS 0x10 /* Serdes Tx Parameters. */ |
1185 | #define MBC_GET_IOCB_STATUS 0x12 /* Get IOCB status command. */ | |
d8b45213 | 1186 | #define MBC_PORT_PARAMS 0x1A /* Port iDMA Parameters. */ |
3d71644c | 1187 | #define MBC_GET_TIMEOUT_PARAMS 0x22 /* Get FW timeouts. */ |
a7a167bf | 1188 | #define MBC_TRACE_CONTROL 0x27 /* Trace control command. */ |
3d71644c | 1189 | #define MBC_GEN_SYSTEM_ERROR 0x2a /* Generate System Error. */ |
ad0ecd61 | 1190 | #define MBC_WRITE_SFP 0x30 /* Write SFP Data. */ |
88729e53 | 1191 | #define MBC_READ_SFP 0x31 /* Read SFP Data. */ |
3d71644c | 1192 | #define MBC_SET_TIMEOUT_PARAMS 0x32 /* Set FW timeouts. */ |
b5a340dd | 1193 | #define MBC_DPORT_DIAGNOSTICS 0x47 /* D-Port Diagnostics */ |
3d71644c AV |
1194 | #define MBC_MID_INITIALIZE_FIRMWARE 0x48 /* MID Initialize firmware. */ |
1195 | #define MBC_MID_GET_VP_DATABASE 0x49 /* MID Get VP Database. */ | |
1196 | #define MBC_MID_GET_VP_ENTRY 0x4a /* MID Get VP Entry. */ | |
1197 | #define MBC_HOST_MEMORY_COPY 0x53 /* Host Memory Copy. */ | |
1198 | #define MBC_SEND_RNFT_ELS 0x5e /* Send RNFT ELS request */ | |
1199 | #define MBC_GET_LINK_PRIV_STATS 0x6d /* Get link & private data. */ | |
61e1b269 | 1200 | #define MBC_LINK_INITIALIZATION 0x72 /* Do link initialization. */ |
3d71644c | 1201 | #define MBC_SET_VENDOR_ID 0x76 /* Set Vendor ID. */ |
8fcd6b8b | 1202 | #define MBC_PORT_RESET 0x120 /* Port Reset */ |
23f2ebd1 SR |
1203 | #define MBC_SET_PORT_CONFIG 0x122 /* Set port configuration */ |
1204 | #define MBC_GET_PORT_CONFIG 0x123 /* Get port configuration */ | |
3d71644c | 1205 | |
b1d46989 MI |
1206 | /* |
1207 | * ISP81xx mailbox commands | |
1208 | */ | |
1209 | #define MBC_WRITE_MPI_REGISTER 0x01 /* Write MPI Register. */ | |
1210 | ||
e8887c51 JC |
1211 | /* |
1212 | * ISP8044 mailbox commands | |
1213 | */ | |
1214 | #define MBC_SET_GET_ETH_SERDES_REG 0x150 | |
1215 | #define HCS_WRITE_SERDES 0x3 | |
1216 | #define HCS_READ_SERDES 0x4 | |
1217 | ||
1da177e4 LT |
1218 | /* Firmware return data sizes */ |
1219 | #define FCAL_MAP_SIZE 128 | |
1220 | ||
1221 | /* Mailbox bit definitions for out_mb and in_mb */ | |
1222 | #define MBX_31 BIT_31 | |
1223 | #define MBX_30 BIT_30 | |
1224 | #define MBX_29 BIT_29 | |
1225 | #define MBX_28 BIT_28 | |
1226 | #define MBX_27 BIT_27 | |
1227 | #define MBX_26 BIT_26 | |
1228 | #define MBX_25 BIT_25 | |
1229 | #define MBX_24 BIT_24 | |
1230 | #define MBX_23 BIT_23 | |
1231 | #define MBX_22 BIT_22 | |
1232 | #define MBX_21 BIT_21 | |
1233 | #define MBX_20 BIT_20 | |
1234 | #define MBX_19 BIT_19 | |
1235 | #define MBX_18 BIT_18 | |
1236 | #define MBX_17 BIT_17 | |
1237 | #define MBX_16 BIT_16 | |
1238 | #define MBX_15 BIT_15 | |
1239 | #define MBX_14 BIT_14 | |
1240 | #define MBX_13 BIT_13 | |
1241 | #define MBX_12 BIT_12 | |
1242 | #define MBX_11 BIT_11 | |
1243 | #define MBX_10 BIT_10 | |
1244 | #define MBX_9 BIT_9 | |
1245 | #define MBX_8 BIT_8 | |
1246 | #define MBX_7 BIT_7 | |
1247 | #define MBX_6 BIT_6 | |
1248 | #define MBX_5 BIT_5 | |
1249 | #define MBX_4 BIT_4 | |
1250 | #define MBX_3 BIT_3 | |
1251 | #define MBX_2 BIT_2 | |
1252 | #define MBX_1 BIT_1 | |
1253 | #define MBX_0 BIT_0 | |
1254 | ||
a5d42f4c | 1255 | #define RNID_TYPE_PORT_LOGIN 0x7 |
c46e65c7 | 1256 | #define RNID_TYPE_SET_VERSION 0x9 |
fe52f6e1 | 1257 | #define RNID_TYPE_ASIC_TEMP 0xC |
3a11711a | 1258 | |
1da177e4 LT |
1259 | /* |
1260 | * Firmware state codes from get firmware state mailbox command | |
1261 | */ | |
1262 | #define FSTATE_CONFIG_WAIT 0 | |
1263 | #define FSTATE_WAIT_AL_PA 1 | |
1264 | #define FSTATE_WAIT_LOGIN 2 | |
1265 | #define FSTATE_READY 3 | |
1266 | #define FSTATE_LOSS_OF_SYNC 4 | |
1267 | #define FSTATE_ERROR 5 | |
1268 | #define FSTATE_REINIT 6 | |
1269 | #define FSTATE_NON_PART 7 | |
1270 | ||
1271 | #define FSTATE_CONFIG_CORRECT 0 | |
1272 | #define FSTATE_P2P_RCV_LIP 1 | |
1273 | #define FSTATE_P2P_CHOOSE_LOOP 2 | |
1274 | #define FSTATE_P2P_RCV_UNIDEN_LIP 3 | |
1275 | #define FSTATE_FATAL_ERROR 4 | |
1276 | #define FSTATE_LOOP_BACK_CONN 5 | |
1277 | ||
4243c115 SC |
1278 | #define QLA27XX_IMG_STATUS_VER_MAJOR 0x01 |
1279 | #define QLA27XX_IMG_STATUS_VER_MINOR 0x00 | |
1280 | #define QLA27XX_IMG_STATUS_SIGN 0xFACEFADE | |
ecc89f25 | 1281 | #define QLA28XX_IMG_STATUS_SIGN 0xFACEFADF |
5fa8774c JC |
1282 | #define QLA28XX_IMG_STATUS_SIGN 0xFACEFADF |
1283 | #define QLA28XX_AUX_IMG_STATUS_SIGN 0xFACEFAED | |
1284 | #define QLA27XX_DEFAULT_IMAGE 0 | |
4243c115 SC |
1285 | #define QLA27XX_PRIMARY_IMAGE 1 |
1286 | #define QLA27XX_SECONDARY_IMAGE 2 | |
1287 | ||
1da177e4 LT |
1288 | /* |
1289 | * Port Database structure definition | |
1290 | * Little endian except where noted. | |
1291 | */ | |
1292 | #define PORT_DATABASE_SIZE 128 /* bytes */ | |
1293 | typedef struct { | |
1294 | uint8_t options; | |
1295 | uint8_t control; | |
1296 | uint8_t master_state; | |
1297 | uint8_t slave_state; | |
1298 | uint8_t reserved[2]; | |
1299 | uint8_t hard_address; | |
1300 | uint8_t reserved_1; | |
1301 | uint8_t port_id[4]; | |
1302 | uint8_t node_name[WWN_SIZE]; | |
1303 | uint8_t port_name[WWN_SIZE]; | |
1304 | uint16_t execution_throttle; | |
1305 | uint16_t execution_count; | |
1306 | uint8_t reset_count; | |
1307 | uint8_t reserved_2; | |
1308 | uint16_t resource_allocation; | |
1309 | uint16_t current_allocation; | |
1310 | uint16_t queue_head; | |
1311 | uint16_t queue_tail; | |
1312 | uint16_t transmit_execution_list_next; | |
1313 | uint16_t transmit_execution_list_previous; | |
1314 | uint16_t common_features; | |
1315 | uint16_t total_concurrent_sequences; | |
1316 | uint16_t RO_by_information_category; | |
1317 | uint8_t recipient; | |
1318 | uint8_t initiator; | |
1319 | uint16_t receive_data_size; | |
1320 | uint16_t concurrent_sequences; | |
1321 | uint16_t open_sequences_per_exchange; | |
1322 | uint16_t lun_abort_flags; | |
1323 | uint16_t lun_stop_flags; | |
1324 | uint16_t stop_queue_head; | |
1325 | uint16_t stop_queue_tail; | |
1326 | uint16_t port_retry_timer; | |
1327 | uint16_t next_sequence_id; | |
1328 | uint16_t frame_count; | |
1329 | uint16_t PRLI_payload_length; | |
1330 | uint8_t prli_svc_param_word_0[2]; /* Big endian */ | |
1331 | /* Bits 15-0 of word 0 */ | |
1332 | uint8_t prli_svc_param_word_3[2]; /* Big endian */ | |
1333 | /* Bits 15-0 of word 3 */ | |
1334 | uint16_t loop_id; | |
1335 | uint16_t extended_lun_info_list_pointer; | |
1336 | uint16_t extended_lun_stop_list_pointer; | |
1337 | } port_database_t; | |
1338 | ||
1339 | /* | |
1340 | * Port database slave/master states | |
1341 | */ | |
1342 | #define PD_STATE_DISCOVERY 0 | |
1343 | #define PD_STATE_WAIT_DISCOVERY_ACK 1 | |
1344 | #define PD_STATE_PORT_LOGIN 2 | |
1345 | #define PD_STATE_WAIT_PORT_LOGIN_ACK 3 | |
1346 | #define PD_STATE_PROCESS_LOGIN 4 | |
1347 | #define PD_STATE_WAIT_PROCESS_LOGIN_ACK 5 | |
1348 | #define PD_STATE_PORT_LOGGED_IN 6 | |
1349 | #define PD_STATE_PORT_UNAVAILABLE 7 | |
1350 | #define PD_STATE_PROCESS_LOGOUT 8 | |
1351 | #define PD_STATE_WAIT_PROCESS_LOGOUT_ACK 9 | |
1352 | #define PD_STATE_PORT_LOGOUT 10 | |
1353 | #define PD_STATE_WAIT_PORT_LOGOUT_ACK 11 | |
1354 | ||
1355 | ||
4fdfefe5 AV |
1356 | #define QLA_ZIO_MODE_6 (BIT_2 | BIT_1) |
1357 | #define QLA_ZIO_DISABLED 0 | |
1358 | #define QLA_ZIO_DEFAULT_TIMER 2 | |
1359 | ||
1da177e4 LT |
1360 | /* |
1361 | * ISP Initialization Control Block. | |
1362 | * Little endian except where noted. | |
1363 | */ | |
1364 | #define ICB_VERSION 1 | |
1365 | typedef struct { | |
1366 | uint8_t version; | |
1367 | uint8_t reserved_1; | |
1368 | ||
1369 | /* | |
1370 | * LSB BIT 0 = Enable Hard Loop Id | |
1371 | * LSB BIT 1 = Enable Fairness | |
1372 | * LSB BIT 2 = Enable Full-Duplex | |
1373 | * LSB BIT 3 = Enable Fast Posting | |
1374 | * LSB BIT 4 = Enable Target Mode | |
1375 | * LSB BIT 5 = Disable Initiator Mode | |
1376 | * LSB BIT 6 = Enable ADISC | |
1377 | * LSB BIT 7 = Enable Target Inquiry Data | |
1378 | * | |
1379 | * MSB BIT 0 = Enable PDBC Notify | |
1380 | * MSB BIT 1 = Non Participating LIP | |
1381 | * MSB BIT 2 = Descending Loop ID Search | |
1382 | * MSB BIT 3 = Acquire Loop ID in LIPA | |
1383 | * MSB BIT 4 = Stop PortQ on Full Status | |
1384 | * MSB BIT 5 = Full Login after LIP | |
1385 | * MSB BIT 6 = Node Name Option | |
1386 | * MSB BIT 7 = Ext IFWCB enable bit | |
1387 | */ | |
1388 | uint8_t firmware_options[2]; | |
1389 | ||
1390 | uint16_t frame_payload_size; | |
1391 | uint16_t max_iocb_allocation; | |
1392 | uint16_t execution_throttle; | |
1393 | uint8_t retry_count; | |
1394 | uint8_t retry_delay; /* unused */ | |
1395 | uint8_t port_name[WWN_SIZE]; /* Big endian. */ | |
1396 | uint16_t hard_address; | |
1397 | uint8_t inquiry_data; | |
1398 | uint8_t login_timeout; | |
1399 | uint8_t node_name[WWN_SIZE]; /* Big endian. */ | |
1400 | ||
1401 | uint16_t request_q_outpointer; | |
1402 | uint16_t response_q_inpointer; | |
1403 | uint16_t request_q_length; | |
1404 | uint16_t response_q_length; | |
d4556a49 BVA |
1405 | __le64 request_q_address __packed; |
1406 | __le64 response_q_address __packed; | |
1da177e4 LT |
1407 | |
1408 | uint16_t lun_enables; | |
1409 | uint8_t command_resource_count; | |
1410 | uint8_t immediate_notify_resource_count; | |
1411 | uint16_t timeout; | |
1412 | uint8_t reserved_2[2]; | |
1413 | ||
1414 | /* | |
1415 | * LSB BIT 0 = Timer Operation mode bit 0 | |
1416 | * LSB BIT 1 = Timer Operation mode bit 1 | |
1417 | * LSB BIT 2 = Timer Operation mode bit 2 | |
1418 | * LSB BIT 3 = Timer Operation mode bit 3 | |
1419 | * LSB BIT 4 = Init Config Mode bit 0 | |
1420 | * LSB BIT 5 = Init Config Mode bit 1 | |
1421 | * LSB BIT 6 = Init Config Mode bit 2 | |
1422 | * LSB BIT 7 = Enable Non part on LIHA failure | |
1423 | * | |
1424 | * MSB BIT 0 = Enable class 2 | |
1425 | * MSB BIT 1 = Enable ACK0 | |
1426 | * MSB BIT 2 = | |
1427 | * MSB BIT 3 = | |
1428 | * MSB BIT 4 = FC Tape Enable | |
1429 | * MSB BIT 5 = Enable FC Confirm | |
1430 | * MSB BIT 6 = Enable command queuing in target mode | |
1431 | * MSB BIT 7 = No Logo On Link Down | |
1432 | */ | |
1433 | uint8_t add_firmware_options[2]; | |
1434 | ||
1435 | uint8_t response_accumulation_timer; | |
1436 | uint8_t interrupt_delay_timer; | |
1437 | ||
1438 | /* | |
1439 | * LSB BIT 0 = Enable Read xfr_rdy | |
1440 | * LSB BIT 1 = Soft ID only | |
1441 | * LSB BIT 2 = | |
1442 | * LSB BIT 3 = | |
1443 | * LSB BIT 4 = FCP RSP Payload [0] | |
1444 | * LSB BIT 5 = FCP RSP Payload [1] / Sbus enable - 2200 | |
1445 | * LSB BIT 6 = Enable Out-of-Order frame handling | |
1446 | * LSB BIT 7 = Disable Automatic PLOGI on Local Loop | |
1447 | * | |
1448 | * MSB BIT 0 = Sbus enable - 2300 | |
1449 | * MSB BIT 1 = | |
1450 | * MSB BIT 2 = | |
1451 | * MSB BIT 3 = | |
06c22bd1 | 1452 | * MSB BIT 4 = LED mode |
1da177e4 LT |
1453 | * MSB BIT 5 = enable 50 ohm termination |
1454 | * MSB BIT 6 = Data Rate (2300 only) | |
1455 | * MSB BIT 7 = Data Rate (2300 only) | |
1456 | */ | |
1457 | uint8_t special_options[2]; | |
1458 | ||
1459 | uint8_t reserved_3[26]; | |
1460 | } init_cb_t; | |
1461 | ||
1462 | /* | |
1463 | * Get Link Status mailbox command return buffer. | |
1464 | */ | |
3d71644c AV |
1465 | #define GLSO_SEND_RPS BIT_0 |
1466 | #define GLSO_USE_DID BIT_3 | |
1467 | ||
43ef0580 AV |
1468 | struct link_statistics { |
1469 | uint32_t link_fail_cnt; | |
1470 | uint32_t loss_sync_cnt; | |
1471 | uint32_t loss_sig_cnt; | |
1472 | uint32_t prim_seq_err_cnt; | |
1473 | uint32_t inval_xmit_word_cnt; | |
1474 | uint32_t inval_crc_cnt; | |
032d8dd7 | 1475 | uint32_t lip_cnt; |
243de676 HZ |
1476 | uint32_t link_up_cnt; |
1477 | uint32_t link_down_loop_init_tmo; | |
1478 | uint32_t link_down_los; | |
1479 | uint32_t link_down_loss_rcv_clk; | |
1480 | uint32_t reserved0[5]; | |
1481 | uint32_t port_cfg_chg; | |
1482 | uint32_t reserved1[11]; | |
1483 | uint32_t rsp_q_full; | |
1484 | uint32_t atio_q_full; | |
1485 | uint32_t drop_ae; | |
1486 | uint32_t els_proto_err; | |
1487 | uint32_t reserved2; | |
43ef0580 AV |
1488 | uint32_t tx_frames; |
1489 | uint32_t rx_frames; | |
fabbb8df JC |
1490 | uint32_t discarded_frames; |
1491 | uint32_t dropped_frames; | |
243de676 | 1492 | uint32_t reserved3; |
43ef0580 | 1493 | uint32_t nos_rcvd; |
243de676 HZ |
1494 | uint32_t reserved4[4]; |
1495 | uint32_t tx_prjt; | |
1496 | uint32_t rcv_exfail; | |
1497 | uint32_t rcv_abts; | |
1498 | uint32_t seq_frm_miss; | |
1499 | uint32_t corr_err; | |
1500 | uint32_t mb_rqst; | |
1501 | uint32_t nport_full; | |
1502 | uint32_t eofa; | |
1503 | uint32_t reserved5; | |
1504 | uint32_t fpm_recv_word_cnt_lo; | |
1505 | uint32_t fpm_recv_word_cnt_hi; | |
1506 | uint32_t fpm_disc_word_cnt_lo; | |
1507 | uint32_t fpm_disc_word_cnt_hi; | |
1508 | uint32_t fpm_xmit_word_cnt_lo; | |
1509 | uint32_t fpm_xmit_word_cnt_hi; | |
1510 | uint32_t reserved6[70]; | |
43ef0580 | 1511 | }; |
1da177e4 LT |
1512 | |
1513 | /* | |
1514 | * NVRAM Command values. | |
1515 | */ | |
1516 | #define NV_START_BIT BIT_2 | |
1517 | #define NV_WRITE_OP (BIT_26+BIT_24) | |
1518 | #define NV_READ_OP (BIT_26+BIT_25) | |
1519 | #define NV_ERASE_OP (BIT_26+BIT_25+BIT_24) | |
1520 | #define NV_MASK_OP (BIT_26+BIT_25+BIT_24) | |
1521 | #define NV_DELAY_COUNT 10 | |
1522 | ||
1523 | /* | |
1524 | * QLogic ISP2100, ISP2200 and ISP2300 NVRAM structure definition. | |
1525 | */ | |
1526 | typedef struct { | |
1527 | /* | |
1528 | * NVRAM header | |
1529 | */ | |
1530 | uint8_t id[4]; | |
1531 | uint8_t nvram_version; | |
1532 | uint8_t reserved_0; | |
1533 | ||
1534 | /* | |
1535 | * NVRAM RISC parameter block | |
1536 | */ | |
1537 | uint8_t parameter_block_version; | |
1538 | uint8_t reserved_1; | |
1539 | ||
1540 | /* | |
1541 | * LSB BIT 0 = Enable Hard Loop Id | |
1542 | * LSB BIT 1 = Enable Fairness | |
1543 | * LSB BIT 2 = Enable Full-Duplex | |
1544 | * LSB BIT 3 = Enable Fast Posting | |
1545 | * LSB BIT 4 = Enable Target Mode | |
1546 | * LSB BIT 5 = Disable Initiator Mode | |
1547 | * LSB BIT 6 = Enable ADISC | |
1548 | * LSB BIT 7 = Enable Target Inquiry Data | |
1549 | * | |
1550 | * MSB BIT 0 = Enable PDBC Notify | |
1551 | * MSB BIT 1 = Non Participating LIP | |
1552 | * MSB BIT 2 = Descending Loop ID Search | |
1553 | * MSB BIT 3 = Acquire Loop ID in LIPA | |
1554 | * MSB BIT 4 = Stop PortQ on Full Status | |
1555 | * MSB BIT 5 = Full Login after LIP | |
1556 | * MSB BIT 6 = Node Name Option | |
1557 | * MSB BIT 7 = Ext IFWCB enable bit | |
1558 | */ | |
1559 | uint8_t firmware_options[2]; | |
1560 | ||
1561 | uint16_t frame_payload_size; | |
1562 | uint16_t max_iocb_allocation; | |
1563 | uint16_t execution_throttle; | |
1564 | uint8_t retry_count; | |
1565 | uint8_t retry_delay; /* unused */ | |
1566 | uint8_t port_name[WWN_SIZE]; /* Big endian. */ | |
1567 | uint16_t hard_address; | |
1568 | uint8_t inquiry_data; | |
1569 | uint8_t login_timeout; | |
1570 | uint8_t node_name[WWN_SIZE]; /* Big endian. */ | |
1571 | ||
1572 | /* | |
1573 | * LSB BIT 0 = Timer Operation mode bit 0 | |
1574 | * LSB BIT 1 = Timer Operation mode bit 1 | |
1575 | * LSB BIT 2 = Timer Operation mode bit 2 | |
1576 | * LSB BIT 3 = Timer Operation mode bit 3 | |
1577 | * LSB BIT 4 = Init Config Mode bit 0 | |
1578 | * LSB BIT 5 = Init Config Mode bit 1 | |
1579 | * LSB BIT 6 = Init Config Mode bit 2 | |
1580 | * LSB BIT 7 = Enable Non part on LIHA failure | |
1581 | * | |
1582 | * MSB BIT 0 = Enable class 2 | |
1583 | * MSB BIT 1 = Enable ACK0 | |
1584 | * MSB BIT 2 = | |
1585 | * MSB BIT 3 = | |
1586 | * MSB BIT 4 = FC Tape Enable | |
1587 | * MSB BIT 5 = Enable FC Confirm | |
1588 | * MSB BIT 6 = Enable command queuing in target mode | |
1589 | * MSB BIT 7 = No Logo On Link Down | |
1590 | */ | |
1591 | uint8_t add_firmware_options[2]; | |
1592 | ||
1593 | uint8_t response_accumulation_timer; | |
1594 | uint8_t interrupt_delay_timer; | |
1595 | ||
1596 | /* | |
1597 | * LSB BIT 0 = Enable Read xfr_rdy | |
1598 | * LSB BIT 1 = Soft ID only | |
1599 | * LSB BIT 2 = | |
1600 | * LSB BIT 3 = | |
1601 | * LSB BIT 4 = FCP RSP Payload [0] | |
1602 | * LSB BIT 5 = FCP RSP Payload [1] / Sbus enable - 2200 | |
1603 | * LSB BIT 6 = Enable Out-of-Order frame handling | |
1604 | * LSB BIT 7 = Disable Automatic PLOGI on Local Loop | |
1605 | * | |
1606 | * MSB BIT 0 = Sbus enable - 2300 | |
1607 | * MSB BIT 1 = | |
1608 | * MSB BIT 2 = | |
1609 | * MSB BIT 3 = | |
06c22bd1 | 1610 | * MSB BIT 4 = LED mode |
1da177e4 LT |
1611 | * MSB BIT 5 = enable 50 ohm termination |
1612 | * MSB BIT 6 = Data Rate (2300 only) | |
1613 | * MSB BIT 7 = Data Rate (2300 only) | |
1614 | */ | |
1615 | uint8_t special_options[2]; | |
1616 | ||
1617 | /* Reserved for expanded RISC parameter block */ | |
1618 | uint8_t reserved_2[22]; | |
1619 | ||
1620 | /* | |
1621 | * LSB BIT 0 = Tx Sensitivity 1G bit 0 | |
1622 | * LSB BIT 1 = Tx Sensitivity 1G bit 1 | |
1623 | * LSB BIT 2 = Tx Sensitivity 1G bit 2 | |
1624 | * LSB BIT 3 = Tx Sensitivity 1G bit 3 | |
1625 | * LSB BIT 4 = Rx Sensitivity 1G bit 0 | |
1626 | * LSB BIT 5 = Rx Sensitivity 1G bit 1 | |
1627 | * LSB BIT 6 = Rx Sensitivity 1G bit 2 | |
1628 | * LSB BIT 7 = Rx Sensitivity 1G bit 3 | |
fa2a1ce5 | 1629 | * |
1da177e4 LT |
1630 | * MSB BIT 0 = Tx Sensitivity 2G bit 0 |
1631 | * MSB BIT 1 = Tx Sensitivity 2G bit 1 | |
1632 | * MSB BIT 2 = Tx Sensitivity 2G bit 2 | |
1633 | * MSB BIT 3 = Tx Sensitivity 2G bit 3 | |
1634 | * MSB BIT 4 = Rx Sensitivity 2G bit 0 | |
1635 | * MSB BIT 5 = Rx Sensitivity 2G bit 1 | |
1636 | * MSB BIT 6 = Rx Sensitivity 2G bit 2 | |
1637 | * MSB BIT 7 = Rx Sensitivity 2G bit 3 | |
1638 | * | |
1639 | * LSB BIT 0 = Output Swing 1G bit 0 | |
1640 | * LSB BIT 1 = Output Swing 1G bit 1 | |
1641 | * LSB BIT 2 = Output Swing 1G bit 2 | |
1642 | * LSB BIT 3 = Output Emphasis 1G bit 0 | |
1643 | * LSB BIT 4 = Output Emphasis 1G bit 1 | |
1644 | * LSB BIT 5 = Output Swing 2G bit 0 | |
1645 | * LSB BIT 6 = Output Swing 2G bit 1 | |
1646 | * LSB BIT 7 = Output Swing 2G bit 2 | |
fa2a1ce5 | 1647 | * |
1da177e4 LT |
1648 | * MSB BIT 0 = Output Emphasis 2G bit 0 |
1649 | * MSB BIT 1 = Output Emphasis 2G bit 1 | |
1650 | * MSB BIT 2 = Output Enable | |
1651 | * MSB BIT 3 = | |
1652 | * MSB BIT 4 = | |
1653 | * MSB BIT 5 = | |
1654 | * MSB BIT 6 = | |
1655 | * MSB BIT 7 = | |
1656 | */ | |
1657 | uint8_t seriallink_options[4]; | |
1658 | ||
1659 | /* | |
1660 | * NVRAM host parameter block | |
1661 | * | |
1662 | * LSB BIT 0 = Enable spinup delay | |
1663 | * LSB BIT 1 = Disable BIOS | |
1664 | * LSB BIT 2 = Enable Memory Map BIOS | |
1665 | * LSB BIT 3 = Enable Selectable Boot | |
1666 | * LSB BIT 4 = Disable RISC code load | |
1667 | * LSB BIT 5 = Set cache line size 1 | |
1668 | * LSB BIT 6 = PCI Parity Disable | |
1669 | * LSB BIT 7 = Enable extended logging | |
1670 | * | |
1671 | * MSB BIT 0 = Enable 64bit addressing | |
1672 | * MSB BIT 1 = Enable lip reset | |
1673 | * MSB BIT 2 = Enable lip full login | |
1674 | * MSB BIT 3 = Enable target reset | |
1675 | * MSB BIT 4 = Enable database storage | |
1676 | * MSB BIT 5 = Enable cache flush read | |
1677 | * MSB BIT 6 = Enable database load | |
1678 | * MSB BIT 7 = Enable alternate WWN | |
1679 | */ | |
1680 | uint8_t host_p[2]; | |
1681 | ||
1682 | uint8_t boot_node_name[WWN_SIZE]; | |
1683 | uint8_t boot_lun_number; | |
1684 | uint8_t reset_delay; | |
1685 | uint8_t port_down_retry_count; | |
1686 | uint8_t boot_id_number; | |
1687 | uint16_t max_luns_per_target; | |
1688 | uint8_t fcode_boot_port_name[WWN_SIZE]; | |
1689 | uint8_t alternate_port_name[WWN_SIZE]; | |
1690 | uint8_t alternate_node_name[WWN_SIZE]; | |
1691 | ||
1692 | /* | |
1693 | * BIT 0 = Selective Login | |
1694 | * BIT 1 = Alt-Boot Enable | |
1695 | * BIT 2 = | |
1696 | * BIT 3 = Boot Order List | |
1697 | * BIT 4 = | |
1698 | * BIT 5 = Selective LUN | |
1699 | * BIT 6 = | |
1700 | * BIT 7 = unused | |
1701 | */ | |
1702 | uint8_t efi_parameters; | |
1703 | ||
1704 | uint8_t link_down_timeout; | |
1705 | ||
cca5335c | 1706 | uint8_t adapter_id[16]; |
1da177e4 LT |
1707 | |
1708 | uint8_t alt1_boot_node_name[WWN_SIZE]; | |
1709 | uint16_t alt1_boot_lun_number; | |
1710 | uint8_t alt2_boot_node_name[WWN_SIZE]; | |
1711 | uint16_t alt2_boot_lun_number; | |
1712 | uint8_t alt3_boot_node_name[WWN_SIZE]; | |
1713 | uint16_t alt3_boot_lun_number; | |
1714 | uint8_t alt4_boot_node_name[WWN_SIZE]; | |
1715 | uint16_t alt4_boot_lun_number; | |
1716 | uint8_t alt5_boot_node_name[WWN_SIZE]; | |
1717 | uint16_t alt5_boot_lun_number; | |
1718 | uint8_t alt6_boot_node_name[WWN_SIZE]; | |
1719 | uint16_t alt6_boot_lun_number; | |
1720 | uint8_t alt7_boot_node_name[WWN_SIZE]; | |
1721 | uint16_t alt7_boot_lun_number; | |
1722 | ||
1723 | uint8_t reserved_3[2]; | |
1724 | ||
1725 | /* Offset 200-215 : Model Number */ | |
1726 | uint8_t model_number[16]; | |
1727 | ||
1728 | /* OEM related items */ | |
1729 | uint8_t oem_specific[16]; | |
1730 | ||
1731 | /* | |
1732 | * NVRAM Adapter Features offset 232-239 | |
1733 | * | |
1734 | * LSB BIT 0 = External GBIC | |
1735 | * LSB BIT 1 = Risc RAM parity | |
1736 | * LSB BIT 2 = Buffer Plus Module | |
1737 | * LSB BIT 3 = Multi Chip Adapter | |
1738 | * LSB BIT 4 = Internal connector | |
1739 | * LSB BIT 5 = | |
1740 | * LSB BIT 6 = | |
1741 | * LSB BIT 7 = | |
1742 | * | |
1743 | * MSB BIT 0 = | |
1744 | * MSB BIT 1 = | |
1745 | * MSB BIT 2 = | |
1746 | * MSB BIT 3 = | |
1747 | * MSB BIT 4 = | |
1748 | * MSB BIT 5 = | |
1749 | * MSB BIT 6 = | |
1750 | * MSB BIT 7 = | |
1751 | */ | |
1752 | uint8_t adapter_features[2]; | |
1753 | ||
1754 | uint8_t reserved_4[16]; | |
1755 | ||
1756 | /* Subsystem vendor ID for ISP2200 */ | |
1757 | uint16_t subsystem_vendor_id_2200; | |
1758 | ||
1759 | /* Subsystem device ID for ISP2200 */ | |
1760 | uint16_t subsystem_device_id_2200; | |
1761 | ||
1762 | uint8_t reserved_5; | |
1763 | uint8_t checksum; | |
1764 | } nvram_t; | |
1765 | ||
1766 | /* | |
1767 | * ISP queue - response queue entry definition. | |
1768 | */ | |
1769 | typedef struct { | |
2d70c103 NB |
1770 | uint8_t entry_type; /* Entry type. */ |
1771 | uint8_t entry_count; /* Entry count. */ | |
1772 | uint8_t sys_define; /* System defined. */ | |
1773 | uint8_t entry_status; /* Entry Status. */ | |
1774 | uint32_t handle; /* System defined handle */ | |
1775 | uint8_t data[52]; | |
1da177e4 LT |
1776 | uint32_t signature; |
1777 | #define RESPONSE_PROCESSED 0xDEADDEAD /* Signature */ | |
1778 | } response_t; | |
1779 | ||
2d70c103 NB |
1780 | /* |
1781 | * ISP queue - ATIO queue entry definition. | |
1782 | */ | |
1783 | struct atio { | |
1784 | uint8_t entry_type; /* Entry type. */ | |
1785 | uint8_t entry_count; /* Entry count. */ | |
5f35509d QT |
1786 | __le16 attr_n_length; |
1787 | uint8_t data[56]; | |
2d70c103 NB |
1788 | uint32_t signature; |
1789 | #define ATIO_PROCESSED 0xDEADDEAD /* Signature */ | |
1790 | }; | |
1791 | ||
1da177e4 LT |
1792 | typedef union { |
1793 | uint16_t extended; | |
1794 | struct { | |
1795 | uint8_t reserved; | |
1796 | uint8_t standard; | |
1797 | } id; | |
1798 | } target_id_t; | |
1799 | ||
1800 | #define SET_TARGET_ID(ha, to, from) \ | |
1801 | do { \ | |
1802 | if (HAS_EXTENDED_IDS(ha)) \ | |
1803 | to.extended = cpu_to_le16(from); \ | |
1804 | else \ | |
1805 | to.id.standard = (uint8_t)from; \ | |
1806 | } while (0) | |
1807 | ||
1808 | /* | |
1809 | * ISP queue - command entry structure definition. | |
1810 | */ | |
1811 | #define COMMAND_TYPE 0x11 /* Command entry */ | |
1da177e4 LT |
1812 | typedef struct { |
1813 | uint8_t entry_type; /* Entry type. */ | |
1814 | uint8_t entry_count; /* Entry count. */ | |
1815 | uint8_t sys_define; /* System defined. */ | |
1816 | uint8_t entry_status; /* Entry Status. */ | |
1817 | uint32_t handle; /* System handle. */ | |
1818 | target_id_t target; /* SCSI ID */ | |
1819 | uint16_t lun; /* SCSI LUN */ | |
1820 | uint16_t control_flags; /* Control flags. */ | |
1821 | #define CF_WRITE BIT_6 | |
1822 | #define CF_READ BIT_5 | |
1823 | #define CF_SIMPLE_TAG BIT_3 | |
1824 | #define CF_ORDERED_TAG BIT_2 | |
1825 | #define CF_HEAD_TAG BIT_1 | |
1826 | uint16_t reserved_1; | |
1827 | uint16_t timeout; /* Command timeout. */ | |
1828 | uint16_t dseg_count; /* Data segment count. */ | |
1829 | uint8_t scsi_cdb[MAX_CMDSZ]; /* SCSI command words. */ | |
1830 | uint32_t byte_count; /* Total byte count. */ | |
15b7a68c BVA |
1831 | union { |
1832 | struct dsd32 dsd32[3]; | |
1833 | struct dsd64 dsd64[2]; | |
1834 | }; | |
1da177e4 LT |
1835 | } cmd_entry_t; |
1836 | ||
1837 | /* | |
1838 | * ISP queue - 64-Bit addressing, command entry structure definition. | |
1839 | */ | |
1840 | #define COMMAND_A64_TYPE 0x19 /* Command A64 entry */ | |
1841 | typedef struct { | |
1842 | uint8_t entry_type; /* Entry type. */ | |
1843 | uint8_t entry_count; /* Entry count. */ | |
1844 | uint8_t sys_define; /* System defined. */ | |
1845 | uint8_t entry_status; /* Entry Status. */ | |
1846 | uint32_t handle; /* System handle. */ | |
1847 | target_id_t target; /* SCSI ID */ | |
1848 | uint16_t lun; /* SCSI LUN */ | |
1849 | uint16_t control_flags; /* Control flags. */ | |
1850 | uint16_t reserved_1; | |
1851 | uint16_t timeout; /* Command timeout. */ | |
1852 | uint16_t dseg_count; /* Data segment count. */ | |
1853 | uint8_t scsi_cdb[MAX_CMDSZ]; /* SCSI command words. */ | |
1854 | uint32_t byte_count; /* Total byte count. */ | |
15b7a68c | 1855 | struct dsd64 dsd[2]; |
1da177e4 LT |
1856 | } cmd_a64_entry_t, request_t; |
1857 | ||
1858 | /* | |
1859 | * ISP queue - continuation entry structure definition. | |
1860 | */ | |
1861 | #define CONTINUE_TYPE 0x02 /* Continuation entry. */ | |
1862 | typedef struct { | |
1863 | uint8_t entry_type; /* Entry type. */ | |
1864 | uint8_t entry_count; /* Entry count. */ | |
1865 | uint8_t sys_define; /* System defined. */ | |
1866 | uint8_t entry_status; /* Entry Status. */ | |
1867 | uint32_t reserved; | |
15b7a68c | 1868 | struct dsd32 dsd[7]; |
1da177e4 LT |
1869 | } cont_entry_t; |
1870 | ||
1871 | /* | |
1872 | * ISP queue - 64-Bit addressing, continuation entry structure definition. | |
1873 | */ | |
1874 | #define CONTINUE_A64_TYPE 0x0A /* Continuation A64 entry. */ | |
1875 | typedef struct { | |
1876 | uint8_t entry_type; /* Entry type. */ | |
1877 | uint8_t entry_count; /* Entry count. */ | |
1878 | uint8_t sys_define; /* System defined. */ | |
1879 | uint8_t entry_status; /* Entry Status. */ | |
15b7a68c | 1880 | struct dsd64 dsd[5]; |
1da177e4 LT |
1881 | } cont_a64_entry_t; |
1882 | ||
bad75002 | 1883 | #define PO_MODE_DIF_INSERT 0 |
9e522cd8 AE |
1884 | #define PO_MODE_DIF_REMOVE 1 |
1885 | #define PO_MODE_DIF_PASS 2 | |
1886 | #define PO_MODE_DIF_REPLACE 3 | |
1887 | #define PO_MODE_DIF_TCP_CKSUM 6 | |
bad75002 | 1888 | #define PO_ENABLE_INCR_GUARD_SEED BIT_3 |
bad75002 | 1889 | #define PO_DISABLE_GUARD_CHECK BIT_4 |
f83adb61 QT |
1890 | #define PO_DISABLE_INCR_REF_TAG BIT_5 |
1891 | #define PO_DIS_HEADER_MODE BIT_7 | |
1892 | #define PO_ENABLE_DIF_BUNDLING BIT_8 | |
1893 | #define PO_DIS_FRAME_MODE BIT_9 | |
1894 | #define PO_DIS_VALD_APP_ESC BIT_10 /* Dis validation for escape tag/ffffh */ | |
1895 | #define PO_DIS_VALD_APP_REF_ESC BIT_11 | |
1896 | ||
1897 | #define PO_DIS_APP_TAG_REPL BIT_12 /* disable REG Tag replacement */ | |
1898 | #define PO_DIS_REF_TAG_REPL BIT_13 | |
1899 | #define PO_DIS_APP_TAG_VALD BIT_14 /* disable REF Tag validation */ | |
1900 | #define PO_DIS_REF_TAG_VALD BIT_15 | |
1901 | ||
bad75002 AE |
1902 | /* |
1903 | * ISP queue - 64-Bit addressing, continuation crc entry structure definition. | |
1904 | */ | |
1905 | struct crc_context { | |
1906 | uint32_t handle; /* System handle. */ | |
c7ee3bd4 QT |
1907 | __le32 ref_tag; |
1908 | __le16 app_tag; | |
bad75002 AE |
1909 | uint8_t ref_tag_mask[4]; /* Validation/Replacement Mask*/ |
1910 | uint8_t app_tag_mask[2]; /* Validation/Replacement Mask*/ | |
c7ee3bd4 QT |
1911 | __le16 guard_seed; /* Initial Guard Seed */ |
1912 | __le16 prot_opts; /* Requested Data Protection Mode */ | |
1913 | __le16 blk_size; /* Data size in bytes */ | |
bad75002 AE |
1914 | uint16_t runt_blk_guard; /* Guard value for runt block (tape |
1915 | * only) */ | |
c7ee3bd4 | 1916 | __le32 byte_count; /* Total byte count/ total data |
bad75002 AE |
1917 | * transfer count */ |
1918 | union { | |
1919 | struct { | |
1920 | uint32_t reserved_1; | |
1921 | uint16_t reserved_2; | |
1922 | uint16_t reserved_3; | |
1923 | uint32_t reserved_4; | |
9e75b5e2 | 1924 | struct dsd64 data_dsd[1]; |
bad75002 AE |
1925 | uint32_t reserved_5[2]; |
1926 | uint32_t reserved_6; | |
1927 | } nobundling; | |
1928 | struct { | |
c7ee3bd4 | 1929 | __le32 dif_byte_count; /* Total DIF byte |
bad75002 AE |
1930 | * count */ |
1931 | uint16_t reserved_1; | |
c7ee3bd4 | 1932 | __le16 dseg_count; /* Data segment count */ |
bad75002 | 1933 | uint32_t reserved_2; |
9e75b5e2 | 1934 | struct dsd64 data_dsd[1]; |
15b7a68c | 1935 | struct dsd64 dif_dsd; |
bad75002 AE |
1936 | } bundling; |
1937 | } u; | |
1938 | ||
1939 | struct fcp_cmnd fcp_cmnd; | |
1940 | dma_addr_t crc_ctx_dma; | |
1941 | /* List of DMA context transfers */ | |
1942 | struct list_head dsd_list; | |
1943 | ||
50b81275 GM |
1944 | /* List of DIF Bundling context DMA address */ |
1945 | struct list_head ldif_dsd_list; | |
1946 | u8 no_ldif_dsd; | |
1947 | ||
1948 | struct list_head ldif_dma_hndl_list; | |
1949 | u32 dif_bundl_len; | |
1950 | u8 no_dif_bundl; | |
bad75002 AE |
1951 | /* This structure should not exceed 512 bytes */ |
1952 | }; | |
1953 | ||
1954 | #define CRC_CONTEXT_LEN_FW (offsetof(struct crc_context, fcp_cmnd.lun)) | |
1955 | #define CRC_CONTEXT_FCPCMND_OFF (offsetof(struct crc_context, fcp_cmnd.lun)) | |
1956 | ||
1da177e4 LT |
1957 | /* |
1958 | * ISP queue - status entry structure definition. | |
1959 | */ | |
1960 | #define STATUS_TYPE 0x03 /* Status entry. */ | |
1961 | typedef struct { | |
1962 | uint8_t entry_type; /* Entry type. */ | |
1963 | uint8_t entry_count; /* Entry count. */ | |
1964 | uint8_t sys_define; /* System defined. */ | |
1965 | uint8_t entry_status; /* Entry Status. */ | |
1966 | uint32_t handle; /* System handle. */ | |
1967 | uint16_t scsi_status; /* SCSI status. */ | |
1968 | uint16_t comp_status; /* Completion status. */ | |
1969 | uint16_t state_flags; /* State flags. */ | |
1970 | uint16_t status_flags; /* Status flags. */ | |
1971 | uint16_t rsp_info_len; /* Response Info Length. */ | |
1972 | uint16_t req_sense_length; /* Request sense data length. */ | |
1973 | uint32_t residual_length; /* Residual transfer length. */ | |
1974 | uint8_t rsp_info[8]; /* FCP response information. */ | |
1975 | uint8_t req_sense_data[32]; /* Request sense data. */ | |
1976 | } sts_entry_t; | |
1977 | ||
1978 | /* | |
1979 | * Status entry entry status | |
1980 | */ | |
3d71644c | 1981 | #define RF_RQ_DMA_ERROR BIT_6 /* Request Queue DMA error. */ |
1da177e4 LT |
1982 | #define RF_INV_E_ORDER BIT_5 /* Invalid entry order. */ |
1983 | #define RF_INV_E_COUNT BIT_4 /* Invalid entry count. */ | |
1984 | #define RF_INV_E_PARAM BIT_3 /* Invalid entry parameter. */ | |
1985 | #define RF_INV_E_TYPE BIT_2 /* Invalid entry type. */ | |
1986 | #define RF_BUSY BIT_1 /* Busy */ | |
3d71644c AV |
1987 | #define RF_MASK (RF_RQ_DMA_ERROR | RF_INV_E_ORDER | RF_INV_E_COUNT | \ |
1988 | RF_INV_E_PARAM | RF_INV_E_TYPE | RF_BUSY) | |
1989 | #define RF_MASK_24XX (RF_INV_E_ORDER | RF_INV_E_COUNT | RF_INV_E_PARAM | \ | |
1990 | RF_INV_E_TYPE) | |
1da177e4 LT |
1991 | |
1992 | /* | |
1993 | * Status entry SCSI status bit definitions. | |
1994 | */ | |
1995 | #define SS_MASK 0xfff /* Reserved bits BIT_12-BIT_15*/ | |
1996 | #define SS_RESIDUAL_UNDER BIT_11 | |
1997 | #define SS_RESIDUAL_OVER BIT_10 | |
1998 | #define SS_SENSE_LEN_VALID BIT_9 | |
1999 | #define SS_RESPONSE_INFO_LEN_VALID BIT_8 | |
df2e32c5 | 2000 | #define SS_SCSI_STATUS_BYTE 0xff |
1da177e4 LT |
2001 | |
2002 | #define SS_RESERVE_CONFLICT (BIT_4 | BIT_3) | |
2003 | #define SS_BUSY_CONDITION BIT_3 | |
2004 | #define SS_CONDITION_MET BIT_2 | |
2005 | #define SS_CHECK_CONDITION BIT_1 | |
2006 | ||
2007 | /* | |
2008 | * Status entry completion status | |
2009 | */ | |
2010 | #define CS_COMPLETE 0x0 /* No errors */ | |
2011 | #define CS_INCOMPLETE 0x1 /* Incomplete transfer of cmd. */ | |
2012 | #define CS_DMA 0x2 /* A DMA direction error. */ | |
2013 | #define CS_TRANSPORT 0x3 /* Transport error. */ | |
2014 | #define CS_RESET 0x4 /* SCSI bus reset occurred */ | |
2015 | #define CS_ABORTED 0x5 /* System aborted command. */ | |
2016 | #define CS_TIMEOUT 0x6 /* Timeout error. */ | |
2017 | #define CS_DATA_OVERRUN 0x7 /* Data overrun. */ | |
bad75002 | 2018 | #define CS_DIF_ERROR 0xC /* DIF error detected */ |
1da177e4 LT |
2019 | |
2020 | #define CS_DATA_UNDERRUN 0x15 /* Data Underrun. */ | |
2021 | #define CS_QUEUE_FULL 0x1C /* Queue Full. */ | |
2022 | #define CS_PORT_UNAVAILABLE 0x28 /* Port unavailable */ | |
2023 | /* (selection timeout) */ | |
2024 | #define CS_PORT_LOGGED_OUT 0x29 /* Port Logged Out */ | |
2025 | #define CS_PORT_CONFIG_CHG 0x2A /* Port Configuration Changed */ | |
2026 | #define CS_PORT_BUSY 0x2B /* Port Busy */ | |
2027 | #define CS_COMPLETE_CHKCOND 0x30 /* Error? */ | |
f934c9d0 CD |
2028 | #define CS_IOCB_ERROR 0x31 /* Generic error for IOCB request |
2029 | failure */ | |
1da177e4 LT |
2030 | #define CS_BAD_PAYLOAD 0x80 /* Driver defined */ |
2031 | #define CS_UNKNOWN 0x81 /* Driver defined */ | |
2032 | #define CS_RETRY 0x82 /* Driver defined */ | |
2033 | #define CS_LOOP_DOWN_ABORT 0x83 /* Driver defined */ | |
2034 | ||
a9b6f722 SK |
2035 | #define CS_BIDIR_RD_OVERRUN 0x700 |
2036 | #define CS_BIDIR_RD_WR_OVERRUN 0x707 | |
2037 | #define CS_BIDIR_RD_OVERRUN_WR_UNDERRUN 0x715 | |
2038 | #define CS_BIDIR_RD_UNDERRUN 0x1500 | |
2039 | #define CS_BIDIR_RD_UNDERRUN_WR_OVERRUN 0x1507 | |
2040 | #define CS_BIDIR_RD_WR_UNDERRUN 0x1515 | |
2041 | #define CS_BIDIR_DMA 0x200 | |
1da177e4 LT |
2042 | /* |
2043 | * Status entry status flags | |
2044 | */ | |
2045 | #define SF_ABTS_TERMINATED BIT_10 | |
2046 | #define SF_LOGOUT_SENT BIT_13 | |
2047 | ||
2048 | /* | |
2049 | * ISP queue - status continuation entry structure definition. | |
2050 | */ | |
2051 | #define STATUS_CONT_TYPE 0x10 /* Status continuation entry. */ | |
2052 | typedef struct { | |
2053 | uint8_t entry_type; /* Entry type. */ | |
2054 | uint8_t entry_count; /* Entry count. */ | |
2055 | uint8_t sys_define; /* System defined. */ | |
2056 | uint8_t entry_status; /* Entry Status. */ | |
2057 | uint8_t data[60]; /* data */ | |
2058 | } sts_cont_entry_t; | |
2059 | ||
2060 | /* | |
2061 | * ISP queue - RIO Type 1 status entry (32 bit I/O entry handles) | |
2062 | * structure definition. | |
2063 | */ | |
2064 | #define STATUS_TYPE_21 0x21 /* Status entry. */ | |
2065 | typedef struct { | |
2066 | uint8_t entry_type; /* Entry type. */ | |
2067 | uint8_t entry_count; /* Entry count. */ | |
2068 | uint8_t handle_count; /* Handle count. */ | |
2069 | uint8_t entry_status; /* Entry Status. */ | |
2070 | uint32_t handle[15]; /* System handles. */ | |
2071 | } sts21_entry_t; | |
2072 | ||
2073 | /* | |
2074 | * ISP queue - RIO Type 2 status entry (16 bit I/O entry handles) | |
2075 | * structure definition. | |
2076 | */ | |
2077 | #define STATUS_TYPE_22 0x22 /* Status entry. */ | |
2078 | typedef struct { | |
2079 | uint8_t entry_type; /* Entry type. */ | |
2080 | uint8_t entry_count; /* Entry count. */ | |
2081 | uint8_t handle_count; /* Handle count. */ | |
2082 | uint8_t entry_status; /* Entry Status. */ | |
2083 | uint16_t handle[30]; /* System handles. */ | |
2084 | } sts22_entry_t; | |
2085 | ||
2086 | /* | |
2087 | * ISP queue - marker entry structure definition. | |
2088 | */ | |
2089 | #define MARKER_TYPE 0x04 /* Marker entry. */ | |
2090 | typedef struct { | |
2091 | uint8_t entry_type; /* Entry type. */ | |
2092 | uint8_t entry_count; /* Entry count. */ | |
2093 | uint8_t handle_count; /* Handle count. */ | |
2094 | uint8_t entry_status; /* Entry Status. */ | |
2095 | uint32_t sys_define_2; /* System defined. */ | |
2096 | target_id_t target; /* SCSI ID */ | |
2097 | uint8_t modifier; /* Modifier (7-0). */ | |
2098 | #define MK_SYNC_ID_LUN 0 /* Synchronize ID/LUN */ | |
2099 | #define MK_SYNC_ID 1 /* Synchronize ID */ | |
2100 | #define MK_SYNC_ALL 2 /* Synchronize all ID/LUN */ | |
2101 | #define MK_SYNC_LIP 3 /* Synchronize all ID/LUN, */ | |
2102 | /* clear port changed, */ | |
2103 | /* use sequence number. */ | |
2104 | uint8_t reserved_1; | |
2105 | uint16_t sequence_number; /* Sequence number of event */ | |
2106 | uint16_t lun; /* SCSI LUN */ | |
2107 | uint8_t reserved_2[48]; | |
2108 | } mrk_entry_t; | |
2109 | ||
2110 | /* | |
2111 | * ISP queue - Management Server entry structure definition. | |
2112 | */ | |
2113 | #define MS_IOCB_TYPE 0x29 /* Management Server IOCB entry */ | |
2114 | typedef struct { | |
2115 | uint8_t entry_type; /* Entry type. */ | |
2116 | uint8_t entry_count; /* Entry count. */ | |
2117 | uint8_t handle_count; /* Handle count. */ | |
2118 | uint8_t entry_status; /* Entry Status. */ | |
2119 | uint32_t handle1; /* System handle. */ | |
2120 | target_id_t loop_id; | |
2121 | uint16_t status; | |
2122 | uint16_t control_flags; /* Control flags. */ | |
2123 | uint16_t reserved2; | |
2124 | uint16_t timeout; | |
2125 | uint16_t cmd_dsd_count; | |
2126 | uint16_t total_dsd_count; | |
2127 | uint8_t type; | |
2128 | uint8_t r_ctl; | |
2129 | uint16_t rx_id; | |
2130 | uint16_t reserved3; | |
2131 | uint32_t handle2; | |
2132 | uint32_t rsp_bytecount; | |
2133 | uint32_t req_bytecount; | |
15b7a68c BVA |
2134 | struct dsd64 req_dsd; |
2135 | struct dsd64 rsp_dsd; | |
1da177e4 LT |
2136 | } ms_iocb_entry_t; |
2137 | ||
2138 | ||
2139 | /* | |
2140 | * ISP queue - Mailbox Command entry structure definition. | |
2141 | */ | |
2142 | #define MBX_IOCB_TYPE 0x39 | |
2143 | struct mbx_entry { | |
2144 | uint8_t entry_type; | |
2145 | uint8_t entry_count; | |
2146 | uint8_t sys_define1; | |
2147 | /* Use sys_define1 for source type */ | |
2148 | #define SOURCE_SCSI 0x00 | |
2149 | #define SOURCE_IP 0x01 | |
2150 | #define SOURCE_VI 0x02 | |
2151 | #define SOURCE_SCTP 0x03 | |
2152 | #define SOURCE_MP 0x04 | |
2153 | #define SOURCE_MPIOCTL 0x05 | |
2154 | #define SOURCE_ASYNC_IOCB 0x07 | |
2155 | ||
2156 | uint8_t entry_status; | |
2157 | ||
2158 | uint32_t handle; | |
2159 | target_id_t loop_id; | |
2160 | ||
2161 | uint16_t status; | |
2162 | uint16_t state_flags; | |
2163 | uint16_t status_flags; | |
2164 | ||
2165 | uint32_t sys_define2[2]; | |
2166 | ||
2167 | uint16_t mb0; | |
2168 | uint16_t mb1; | |
2169 | uint16_t mb2; | |
2170 | uint16_t mb3; | |
2171 | uint16_t mb6; | |
2172 | uint16_t mb7; | |
2173 | uint16_t mb9; | |
2174 | uint16_t mb10; | |
2175 | uint32_t reserved_2[2]; | |
2176 | uint8_t node_name[WWN_SIZE]; | |
2177 | uint8_t port_name[WWN_SIZE]; | |
2178 | }; | |
2179 | ||
5d964837 QT |
2180 | #ifndef IMMED_NOTIFY_TYPE |
2181 | #define IMMED_NOTIFY_TYPE 0x0D /* Immediate notify entry. */ | |
2182 | /* | |
2183 | * ISP queue - immediate notify entry structure definition. | |
2184 | * This is sent by the ISP to the Target driver. | |
2185 | * This IOCB would have report of events sent by the | |
2186 | * initiator, that needs to be handled by the target | |
2187 | * driver immediately. | |
2188 | */ | |
2189 | struct imm_ntfy_from_isp { | |
2190 | uint8_t entry_type; /* Entry type. */ | |
2191 | uint8_t entry_count; /* Entry count. */ | |
2192 | uint8_t sys_define; /* System defined. */ | |
2193 | uint8_t entry_status; /* Entry Status. */ | |
2194 | union { | |
2195 | struct { | |
2196 | uint32_t sys_define_2; /* System defined. */ | |
2197 | target_id_t target; | |
2198 | uint16_t lun; | |
2199 | uint8_t target_id; | |
2200 | uint8_t reserved_1; | |
2201 | uint16_t status_modifier; | |
2202 | uint16_t status; | |
2203 | uint16_t task_flags; | |
2204 | uint16_t seq_id; | |
2205 | uint16_t srr_rx_id; | |
2206 | uint32_t srr_rel_offs; | |
2207 | uint16_t srr_ui; | |
2208 | #define SRR_IU_DATA_IN 0x1 | |
2209 | #define SRR_IU_DATA_OUT 0x5 | |
2210 | #define SRR_IU_STATUS 0x7 | |
2211 | uint16_t srr_ox_id; | |
2212 | uint8_t reserved_2[28]; | |
2213 | } isp2x; | |
2214 | struct { | |
2215 | uint32_t reserved; | |
2216 | uint16_t nport_handle; | |
2217 | uint16_t reserved_2; | |
2218 | uint16_t flags; | |
2219 | #define NOTIFY24XX_FLAGS_GLOBAL_TPRLO BIT_1 | |
2220 | #define NOTIFY24XX_FLAGS_PUREX_IOCB BIT_0 | |
2221 | uint16_t srr_rx_id; | |
2222 | uint16_t status; | |
2223 | uint8_t status_subcode; | |
2224 | uint8_t fw_handle; | |
2225 | uint32_t exchange_address; | |
2226 | uint32_t srr_rel_offs; | |
2227 | uint16_t srr_ui; | |
2228 | uint16_t srr_ox_id; | |
2229 | union { | |
2230 | struct { | |
2231 | uint8_t node_name[8]; | |
2232 | } plogi; /* PLOGI/ADISC/PDISC */ | |
2233 | struct { | |
2234 | /* PRLI word 3 bit 0-15 */ | |
2235 | uint16_t wd3_lo; | |
2236 | uint8_t resv0[6]; | |
2237 | } prli; | |
2238 | struct { | |
2239 | uint8_t port_id[3]; | |
2240 | uint8_t resv1; | |
2241 | uint16_t nport_handle; | |
2242 | uint16_t resv2; | |
2243 | } req_els; | |
2244 | } u; | |
2245 | uint8_t port_name[8]; | |
2246 | uint8_t resv3[3]; | |
2247 | uint8_t vp_index; | |
2248 | uint32_t reserved_5; | |
2249 | uint8_t port_id[3]; | |
2250 | uint8_t reserved_6; | |
2251 | } isp24; | |
2252 | } u; | |
2253 | uint16_t reserved_7; | |
2254 | uint16_t ox_id; | |
2255 | } __packed; | |
2256 | #endif | |
2257 | ||
1da177e4 LT |
2258 | /* |
2259 | * ISP request and response queue entry sizes | |
2260 | */ | |
2261 | #define RESPONSE_ENTRY_SIZE (sizeof(response_t)) | |
2262 | #define REQUEST_ENTRY_SIZE (sizeof(request_t)) | |
2263 | ||
2264 | ||
1da177e4 LT |
2265 | |
2266 | /* | |
2267 | * Switch info gathering structure. | |
2268 | */ | |
2269 | typedef struct { | |
2270 | port_id_t d_id; | |
2271 | uint8_t node_name[WWN_SIZE]; | |
2272 | uint8_t port_name[WWN_SIZE]; | |
d8b45213 | 2273 | uint8_t fabric_port_name[WWN_SIZE]; |
d8b45213 | 2274 | uint16_t fp_speed; |
e8c72ba5 | 2275 | uint8_t fc4_type; |
a5d42f4c | 2276 | uint8_t fc4f_nvme; /* nvme fc4 feature bits */ |
1da177e4 LT |
2277 | } sw_info_t; |
2278 | ||
e8c72ba5 CD |
2279 | /* FCP-4 types */ |
2280 | #define FC4_TYPE_FCP_SCSI 0x08 | |
33b28357 | 2281 | #define FC4_TYPE_NVME 0x28 |
e8c72ba5 CD |
2282 | #define FC4_TYPE_OTHER 0x0 |
2283 | #define FC4_TYPE_UNKNOWN 0xff | |
2284 | ||
726b8548 QT |
2285 | /* mailbox command 4G & above */ |
2286 | struct mbx_24xx_entry { | |
2287 | uint8_t entry_type; | |
2288 | uint8_t entry_count; | |
2289 | uint8_t sys_define1; | |
2290 | uint8_t entry_status; | |
2291 | uint32_t handle; | |
2292 | uint16_t mb[28]; | |
2293 | }; | |
2294 | ||
2295 | #define IOCB_SIZE 64 | |
2296 | ||
1da177e4 LT |
2297 | /* |
2298 | * Fibre channel port type. | |
2299 | */ | |
5d964837 | 2300 | typedef enum { |
1da177e4 LT |
2301 | FCT_UNKNOWN, |
2302 | FCT_RSCN, | |
2303 | FCT_SWITCH, | |
2304 | FCT_BROADCAST, | |
2305 | FCT_INITIATOR, | |
a5d42f4c | 2306 | FCT_TARGET, |
a6a6d058 HR |
2307 | FCT_NVME_INITIATOR = 0x10, |
2308 | FCT_NVME_TARGET = 0x20, | |
2309 | FCT_NVME_DISCOVERY = 0x40, | |
2310 | FCT_NVME = 0xf0, | |
1da177e4 LT |
2311 | } fc_port_type_t; |
2312 | ||
726b8548 QT |
2313 | enum qla_sess_deletion { |
2314 | QLA_SESS_DELETION_NONE = 0, | |
2315 | QLA_SESS_DELETION_IN_PROGRESS, | |
2316 | QLA_SESS_DELETED, | |
2317 | }; | |
2318 | ||
5d964837 QT |
2319 | enum qlt_plogi_link_t { |
2320 | QLT_PLOGI_LINK_SAME_WWN, | |
2321 | QLT_PLOGI_LINK_CONFLICT, | |
2322 | QLT_PLOGI_LINK_MAX | |
2323 | }; | |
2324 | ||
2325 | struct qlt_plogi_ack_t { | |
2326 | struct list_head list; | |
2327 | struct imm_ntfy_from_isp iocb; | |
2328 | port_id_t id; | |
2329 | int ref_count; | |
726b8548 QT |
2330 | void *fcport; |
2331 | }; | |
2332 | ||
2333 | struct ct_sns_desc { | |
2334 | struct ct_sns_pkt *ct_sns; | |
2335 | dma_addr_t ct_sns_dma; | |
2336 | }; | |
2337 | ||
2338 | enum discovery_state { | |
2339 | DSC_DELETED, | |
a4239945 | 2340 | DSC_GNN_ID, |
726b8548 QT |
2341 | DSC_GNL, |
2342 | DSC_LOGIN_PEND, | |
2343 | DSC_LOGIN_FAILED, | |
2344 | DSC_GPDB, | |
726b8548 QT |
2345 | DSC_UPD_FCPORT, |
2346 | DSC_LOGIN_COMPLETE, | |
f13515ac | 2347 | DSC_ADISC, |
726b8548 QT |
2348 | DSC_DELETE_PEND, |
2349 | }; | |
2350 | ||
2351 | enum login_state { /* FW control Target side */ | |
2352 | DSC_LS_LLIOCB_SENT = 2, | |
2353 | DSC_LS_PLOGI_PEND, | |
2354 | DSC_LS_PLOGI_COMP, | |
2355 | DSC_LS_PRLI_PEND, | |
2356 | DSC_LS_PRLI_COMP, | |
2357 | DSC_LS_PORT_UNAVAIL, | |
2358 | DSC_LS_PRLO_PEND = 9, | |
2359 | DSC_LS_LOGO_PEND, | |
2360 | }; | |
2361 | ||
2362 | enum fcport_mgt_event { | |
2363 | FCME_RELOGIN = 1, | |
2364 | FCME_RSCN, | |
726b8548 | 2365 | FCME_PLOGI_DONE, /* Initiator side sent LLIOCB */ |
a5d42f4c | 2366 | FCME_PRLI_DONE, |
726b8548 QT |
2367 | FCME_GNL_DONE, |
2368 | FCME_GPSC_DONE, | |
2369 | FCME_GPDB_DONE, | |
2370 | FCME_GPNID_DONE, | |
a5d42f4c | 2371 | FCME_GFFID_DONE, |
f13515ac | 2372 | FCME_ADISC_DONE, |
a4239945 QT |
2373 | FCME_GNNID_DONE, |
2374 | FCME_GFPNID_DONE, | |
8777e431 | 2375 | FCME_ELS_PLOGI_DONE, |
5d964837 QT |
2376 | }; |
2377 | ||
41dc529a QT |
2378 | enum rscn_addr_format { |
2379 | RSCN_PORT_ADDR, | |
2380 | RSCN_AREA_ADDR, | |
2381 | RSCN_DOM_ADDR, | |
2382 | RSCN_FAB_ADDR, | |
2383 | }; | |
2384 | ||
1da177e4 LT |
2385 | /* |
2386 | * Fibre channel port structure. | |
2387 | */ | |
2388 | typedef struct fc_port { | |
2389 | struct list_head list; | |
7b867cf7 | 2390 | struct scsi_qla_host *vha; |
1da177e4 LT |
2391 | |
2392 | uint8_t node_name[WWN_SIZE]; | |
2393 | uint8_t port_name[WWN_SIZE]; | |
2394 | port_id_t d_id; | |
2395 | uint16_t loop_id; | |
2396 | uint16_t old_loop_id; | |
2397 | ||
5d964837 QT |
2398 | unsigned int conf_compl_supported:1; |
2399 | unsigned int deleted:2; | |
1ae634eb | 2400 | unsigned int free_pending:1; |
5d964837 QT |
2401 | unsigned int local:1; |
2402 | unsigned int logout_on_delete:1; | |
726b8548 | 2403 | unsigned int logo_ack_needed:1; |
5d964837 QT |
2404 | unsigned int keep_nport_handle:1; |
2405 | unsigned int send_els_logo:1; | |
726b8548 QT |
2406 | unsigned int login_pause:1; |
2407 | unsigned int login_succ:1; | |
c0c462c8 | 2408 | unsigned int query:1; |
a4239945 | 2409 | unsigned int id_changed:1; |
cb873ba4 | 2410 | unsigned int scan_needed:1; |
5d964837 | 2411 | |
5621b0dd | 2412 | struct completion nvme_del_done; |
a5d42f4c DG |
2413 | uint32_t nvme_prli_service_param; |
2414 | #define NVME_PRLI_SP_CONF BIT_7 | |
2415 | #define NVME_PRLI_SP_INITIATOR BIT_5 | |
2416 | #define NVME_PRLI_SP_TARGET BIT_4 | |
2417 | #define NVME_PRLI_SP_DISCOVERY BIT_3 | |
03aaa89f | 2418 | #define NVME_PRLI_SP_FIRST_BURST BIT_0 |
a5d42f4c | 2419 | uint8_t nvme_flag; |
03aaa89f | 2420 | uint32_t nvme_first_burst_size; |
a5d42f4c | 2421 | #define NVME_FLAG_REGISTERED 4 |
9dd9686b | 2422 | #define NVME_FLAG_DELETING 2 |
870fe24f | 2423 | #define NVME_FLAG_RESETTING 1 |
a5d42f4c | 2424 | |
726b8548 | 2425 | struct fc_port *conflict; |
5d964837 QT |
2426 | unsigned char logout_completed; |
2427 | int generation; | |
2428 | ||
2429 | struct se_session *se_sess; | |
2430 | struct kref sess_kref; | |
2431 | struct qla_tgt *tgt; | |
2432 | unsigned long expires; | |
2433 | struct list_head del_list_entry; | |
2434 | struct work_struct free_work; | |
cd4ed6b4 QT |
2435 | struct work_struct reg_work; |
2436 | uint64_t jiffies_at_registration; | |
5d964837 QT |
2437 | struct qlt_plogi_ack_t *plogi_link[QLT_PLOGI_LINK_MAX]; |
2438 | ||
8ae6d9c7 GM |
2439 | uint16_t tgt_id; |
2440 | uint16_t old_tgt_id; | |
cd4ed6b4 | 2441 | uint16_t sec_since_registration; |
8ae6d9c7 | 2442 | |
09ff701a SR |
2443 | uint8_t fcp_prio; |
2444 | ||
d8b45213 AV |
2445 | uint8_t fabric_port_name[WWN_SIZE]; |
2446 | uint16_t fp_speed; | |
2447 | ||
1da177e4 LT |
2448 | fc_port_type_t port_type; |
2449 | ||
2450 | atomic_t state; | |
2451 | uint32_t flags; | |
2452 | ||
1da177e4 | 2453 | int login_retry; |
1da177e4 | 2454 | |
d97994dc | 2455 | struct fc_rport *rport, *drport; |
ad3e0eda | 2456 | u32 supported_classes; |
df7baa50 | 2457 | |
e8c72ba5 | 2458 | uint8_t fc4_type; |
a5d42f4c | 2459 | uint8_t fc4f_nvme; |
b3b02e6e | 2460 | uint8_t scan_state; |
edd05de1 | 2461 | uint8_t n2n_flag; |
8ae6d9c7 GM |
2462 | |
2463 | unsigned long last_queue_full; | |
2464 | unsigned long last_ramp_up; | |
2465 | ||
2466 | uint16_t port_id; | |
e05fe292 | 2467 | |
a5d42f4c DG |
2468 | struct nvme_fc_remote_port *nvme_remote_port; |
2469 | ||
e05fe292 | 2470 | unsigned long retry_delay_timestamp; |
a6ca8878 | 2471 | struct qla_tgt_sess *tgt_session; |
726b8548 QT |
2472 | struct ct_sns_desc ct_desc; |
2473 | enum discovery_state disc_state; | |
cd4ed6b4 | 2474 | enum discovery_state next_disc_state; |
726b8548 | 2475 | enum login_state fw_login_state; |
8777e431 | 2476 | unsigned long dm_login_expire; |
5b33469a QT |
2477 | unsigned long plogi_nack_done_deadline; |
2478 | ||
726b8548 QT |
2479 | u32 login_gen, last_login_gen; |
2480 | u32 rscn_gen, last_rscn_gen; | |
2481 | u32 chip_reset; | |
2482 | struct list_head gnl_entry; | |
2483 | struct work_struct del_work; | |
2484 | u8 iocb[IOCB_SIZE]; | |
c0c462c8 DG |
2485 | u8 current_login_state; |
2486 | u8 last_login_state; | |
8777e431 QT |
2487 | u16 n2n_link_reset_cnt; |
2488 | u16 n2n_chip_reset; | |
1da177e4 LT |
2489 | } fc_port_t; |
2490 | ||
726b8548 QT |
2491 | #define QLA_FCPORT_SCAN 1 |
2492 | #define QLA_FCPORT_FOUND 2 | |
2493 | ||
2494 | struct event_arg { | |
2495 | enum fcport_mgt_event event; | |
2496 | fc_port_t *fcport; | |
2497 | srb_t *sp; | |
2498 | port_id_t id; | |
2499 | u16 data[2], rc; | |
2500 | u8 port_name[WWN_SIZE]; | |
2501 | u32 iop[2]; | |
2502 | }; | |
2503 | ||
8ae6d9c7 GM |
2504 | #include "qla_mr.h" |
2505 | ||
1da177e4 LT |
2506 | /* |
2507 | * Fibre channel port/lun states. | |
2508 | */ | |
2509 | #define FCS_UNCONFIGURED 1 | |
2510 | #define FCS_DEVICE_DEAD 2 | |
2511 | #define FCS_DEVICE_LOST 3 | |
2512 | #define FCS_ONLINE 4 | |
1da177e4 | 2513 | |
c4dc7cd3 | 2514 | extern const char *const port_state_str[5]; |
ec426e10 | 2515 | |
1da177e4 LT |
2516 | /* |
2517 | * FC port flags. | |
2518 | */ | |
2519 | #define FCF_FABRIC_DEVICE BIT_0 | |
2520 | #define FCF_LOGIN_NEEDED BIT_1 | |
f08b7251 | 2521 | #define FCF_FCP2_DEVICE BIT_2 |
5ff1d584 | 2522 | #define FCF_ASYNC_SENT BIT_3 |
2d70c103 | 2523 | #define FCF_CONF_COMP_SUPPORTED BIT_4 |
6d674927 | 2524 | #define FCF_ASYNC_ACTIVE BIT_5 |
1da177e4 LT |
2525 | |
2526 | /* No loop ID flag. */ | |
2527 | #define FC_NO_LOOP_ID 0x1000 | |
2528 | ||
1da177e4 LT |
2529 | /* |
2530 | * FC-CT interface | |
2531 | * | |
2532 | * NOTE: All structures are big-endian in form. | |
2533 | */ | |
2534 | ||
2535 | #define CT_REJECT_RESPONSE 0x8001 | |
2536 | #define CT_ACCEPT_RESPONSE 0x8002 | |
df57caba HM |
2537 | #define CT_REASON_INVALID_COMMAND_CODE 0x01 |
2538 | #define CT_REASON_CANNOT_PERFORM 0x09 | |
2539 | #define CT_REASON_COMMAND_UNSUPPORTED 0x0b | |
2540 | #define CT_EXPL_ALREADY_REGISTERED 0x10 | |
2541 | #define CT_EXPL_HBA_ATTR_NOT_REGISTERED 0x11 | |
2542 | #define CT_EXPL_MULTIPLE_HBA_ATTR 0x12 | |
2543 | #define CT_EXPL_INVALID_HBA_BLOCK_LENGTH 0x13 | |
2544 | #define CT_EXPL_MISSING_REQ_HBA_ATTR 0x14 | |
2545 | #define CT_EXPL_PORT_NOT_REGISTERED_ 0x15 | |
2546 | #define CT_EXPL_MISSING_HBA_ID_PORT_LIST 0x16 | |
2547 | #define CT_EXPL_HBA_NOT_REGISTERED 0x17 | |
2548 | #define CT_EXPL_PORT_ATTR_NOT_REGISTERED 0x20 | |
2549 | #define CT_EXPL_PORT_NOT_REGISTERED 0x21 | |
2550 | #define CT_EXPL_MULTIPLE_PORT_ATTR 0x22 | |
2551 | #define CT_EXPL_INVALID_PORT_BLOCK_LENGTH 0x23 | |
1da177e4 LT |
2552 | |
2553 | #define NS_N_PORT_TYPE 0x01 | |
2554 | #define NS_NL_PORT_TYPE 0x02 | |
2555 | #define NS_NX_PORT_TYPE 0x7F | |
2556 | ||
2557 | #define GA_NXT_CMD 0x100 | |
2558 | #define GA_NXT_REQ_SIZE (16 + 4) | |
2559 | #define GA_NXT_RSP_SIZE (16 + 620) | |
2560 | ||
a4239945 QT |
2561 | #define GPN_FT_CMD 0x172 |
2562 | #define GPN_FT_REQ_SIZE (16 + 4) | |
2563 | #define GNN_FT_CMD 0x173 | |
2564 | #define GNN_FT_REQ_SIZE (16 + 4) | |
2565 | ||
1da177e4 LT |
2566 | #define GID_PT_CMD 0x1A1 |
2567 | #define GID_PT_REQ_SIZE (16 + 4) | |
1da177e4 LT |
2568 | |
2569 | #define GPN_ID_CMD 0x112 | |
2570 | #define GPN_ID_REQ_SIZE (16 + 4) | |
2571 | #define GPN_ID_RSP_SIZE (16 + 8) | |
2572 | ||
2573 | #define GNN_ID_CMD 0x113 | |
2574 | #define GNN_ID_REQ_SIZE (16 + 4) | |
2575 | #define GNN_ID_RSP_SIZE (16 + 8) | |
2576 | ||
2577 | #define GFT_ID_CMD 0x117 | |
2578 | #define GFT_ID_REQ_SIZE (16 + 4) | |
2579 | #define GFT_ID_RSP_SIZE (16 + 32) | |
2580 | ||
726b8548 QT |
2581 | #define GID_PN_CMD 0x121 |
2582 | #define GID_PN_REQ_SIZE (16 + 8) | |
2583 | #define GID_PN_RSP_SIZE (16 + 4) | |
2584 | ||
1da177e4 LT |
2585 | #define RFT_ID_CMD 0x217 |
2586 | #define RFT_ID_REQ_SIZE (16 + 4 + 32) | |
2587 | #define RFT_ID_RSP_SIZE 16 | |
2588 | ||
2589 | #define RFF_ID_CMD 0x21F | |
2590 | #define RFF_ID_REQ_SIZE (16 + 4 + 2 + 1 + 1) | |
2591 | #define RFF_ID_RSP_SIZE 16 | |
2592 | ||
2593 | #define RNN_ID_CMD 0x213 | |
2594 | #define RNN_ID_REQ_SIZE (16 + 4 + 8) | |
2595 | #define RNN_ID_RSP_SIZE 16 | |
2596 | ||
2597 | #define RSNN_NN_CMD 0x239 | |
2598 | #define RSNN_NN_REQ_SIZE (16 + 8 + 1 + 255) | |
2599 | #define RSNN_NN_RSP_SIZE 16 | |
2600 | ||
d8b45213 AV |
2601 | #define GFPN_ID_CMD 0x11C |
2602 | #define GFPN_ID_REQ_SIZE (16 + 4) | |
2603 | #define GFPN_ID_RSP_SIZE (16 + 8) | |
2604 | ||
2605 | #define GPSC_CMD 0x127 | |
2606 | #define GPSC_REQ_SIZE (16 + 8) | |
2607 | #define GPSC_RSP_SIZE (16 + 2 + 2) | |
2608 | ||
e8c72ba5 CD |
2609 | #define GFF_ID_CMD 0x011F |
2610 | #define GFF_ID_REQ_SIZE (16 + 4) | |
2611 | #define GFF_ID_RSP_SIZE (16 + 128) | |
d8b45213 | 2612 | |
cca5335c AV |
2613 | /* |
2614 | * HBA attribute types. | |
2615 | */ | |
2616 | #define FDMI_HBA_ATTR_COUNT 9 | |
df57caba HM |
2617 | #define FDMIV2_HBA_ATTR_COUNT 17 |
2618 | #define FDMI_HBA_NODE_NAME 0x1 | |
2619 | #define FDMI_HBA_MANUFACTURER 0x2 | |
2620 | #define FDMI_HBA_SERIAL_NUMBER 0x3 | |
2621 | #define FDMI_HBA_MODEL 0x4 | |
2622 | #define FDMI_HBA_MODEL_DESCRIPTION 0x5 | |
2623 | #define FDMI_HBA_HARDWARE_VERSION 0x6 | |
2624 | #define FDMI_HBA_DRIVER_VERSION 0x7 | |
2625 | #define FDMI_HBA_OPTION_ROM_VERSION 0x8 | |
2626 | #define FDMI_HBA_FIRMWARE_VERSION 0x9 | |
cca5335c AV |
2627 | #define FDMI_HBA_OS_NAME_AND_VERSION 0xa |
2628 | #define FDMI_HBA_MAXIMUM_CT_PAYLOAD_LENGTH 0xb | |
df57caba HM |
2629 | #define FDMI_HBA_NODE_SYMBOLIC_NAME 0xc |
2630 | #define FDMI_HBA_VENDOR_ID 0xd | |
2631 | #define FDMI_HBA_NUM_PORTS 0xe | |
2632 | #define FDMI_HBA_FABRIC_NAME 0xf | |
2633 | #define FDMI_HBA_BOOT_BIOS_NAME 0x10 | |
2634 | #define FDMI_HBA_TYPE_VENDOR_IDENTIFIER 0xe0 | |
cca5335c AV |
2635 | |
2636 | struct ct_fdmi_hba_attr { | |
2637 | uint16_t type; | |
2638 | uint16_t len; | |
2639 | union { | |
2640 | uint8_t node_name[WWN_SIZE]; | |
df57caba HM |
2641 | uint8_t manufacturer[64]; |
2642 | uint8_t serial_num[32]; | |
dd83cb2c | 2643 | uint8_t model[16+1]; |
cca5335c | 2644 | uint8_t model_desc[80]; |
df57caba | 2645 | uint8_t hw_version[32]; |
cca5335c AV |
2646 | uint8_t driver_version[32]; |
2647 | uint8_t orom_version[16]; | |
df57caba | 2648 | uint8_t fw_version[32]; |
cca5335c | 2649 | uint8_t os_version[128]; |
df57caba | 2650 | uint32_t max_ct_len; |
cca5335c AV |
2651 | } a; |
2652 | }; | |
2653 | ||
2654 | struct ct_fdmi_hba_attributes { | |
2655 | uint32_t count; | |
2656 | struct ct_fdmi_hba_attr entry[FDMI_HBA_ATTR_COUNT]; | |
2657 | }; | |
2658 | ||
df57caba HM |
2659 | struct ct_fdmiv2_hba_attr { |
2660 | uint16_t type; | |
2661 | uint16_t len; | |
2662 | union { | |
2663 | uint8_t node_name[WWN_SIZE]; | |
dd83cb2c | 2664 | uint8_t manufacturer[64]; |
df57caba | 2665 | uint8_t serial_num[32]; |
dd83cb2c | 2666 | uint8_t model[16+1]; |
df57caba HM |
2667 | uint8_t model_desc[80]; |
2668 | uint8_t hw_version[16]; | |
2669 | uint8_t driver_version[32]; | |
2670 | uint8_t orom_version[16]; | |
2671 | uint8_t fw_version[32]; | |
2672 | uint8_t os_version[128]; | |
2673 | uint32_t max_ct_len; | |
2674 | uint8_t sym_name[256]; | |
2675 | uint32_t vendor_id; | |
2676 | uint32_t num_ports; | |
2677 | uint8_t fabric_name[WWN_SIZE]; | |
2678 | uint8_t bios_name[32]; | |
577419f7 | 2679 | uint8_t vendor_identifier[8]; |
df57caba HM |
2680 | } a; |
2681 | }; | |
2682 | ||
2683 | struct ct_fdmiv2_hba_attributes { | |
2684 | uint32_t count; | |
2685 | struct ct_fdmiv2_hba_attr entry[FDMIV2_HBA_ATTR_COUNT]; | |
2686 | }; | |
2687 | ||
cca5335c AV |
2688 | /* |
2689 | * Port attribute types. | |
2690 | */ | |
8a85e171 | 2691 | #define FDMI_PORT_ATTR_COUNT 6 |
df57caba HM |
2692 | #define FDMIV2_PORT_ATTR_COUNT 16 |
2693 | #define FDMI_PORT_FC4_TYPES 0x1 | |
2694 | #define FDMI_PORT_SUPPORT_SPEED 0x2 | |
2695 | #define FDMI_PORT_CURRENT_SPEED 0x3 | |
2696 | #define FDMI_PORT_MAX_FRAME_SIZE 0x4 | |
2697 | #define FDMI_PORT_OS_DEVICE_NAME 0x5 | |
2698 | #define FDMI_PORT_HOST_NAME 0x6 | |
2699 | #define FDMI_PORT_NODE_NAME 0x7 | |
2700 | #define FDMI_PORT_NAME 0x8 | |
2701 | #define FDMI_PORT_SYM_NAME 0x9 | |
2702 | #define FDMI_PORT_TYPE 0xa | |
2703 | #define FDMI_PORT_SUPP_COS 0xb | |
2704 | #define FDMI_PORT_FABRIC_NAME 0xc | |
2705 | #define FDMI_PORT_FC4_TYPE 0xd | |
2706 | #define FDMI_PORT_STATE 0x101 | |
2707 | #define FDMI_PORT_COUNT 0x102 | |
2708 | #define FDMI_PORT_ID 0x103 | |
cca5335c | 2709 | |
5881569b AV |
2710 | #define FDMI_PORT_SPEED_1GB 0x1 |
2711 | #define FDMI_PORT_SPEED_2GB 0x2 | |
2712 | #define FDMI_PORT_SPEED_10GB 0x4 | |
2713 | #define FDMI_PORT_SPEED_4GB 0x8 | |
2714 | #define FDMI_PORT_SPEED_8GB 0x10 | |
2715 | #define FDMI_PORT_SPEED_16GB 0x20 | |
f73cb695 | 2716 | #define FDMI_PORT_SPEED_32GB 0x40 |
ecc89f25 | 2717 | #define FDMI_PORT_SPEED_64GB 0x80 |
5881569b AV |
2718 | #define FDMI_PORT_SPEED_UNKNOWN 0x8000 |
2719 | ||
df57caba HM |
2720 | #define FC_CLASS_2 0x04 |
2721 | #define FC_CLASS_3 0x08 | |
2722 | #define FC_CLASS_2_3 0x0C | |
2723 | ||
2724 | struct ct_fdmiv2_port_attr { | |
cca5335c AV |
2725 | uint16_t type; |
2726 | uint16_t len; | |
2727 | union { | |
2728 | uint8_t fc4_types[32]; | |
2729 | uint32_t sup_speed; | |
2730 | uint32_t cur_speed; | |
2731 | uint32_t max_frame_size; | |
2732 | uint8_t os_dev_name[32]; | |
dd83cb2c | 2733 | uint8_t host_name[256]; |
df57caba HM |
2734 | uint8_t node_name[WWN_SIZE]; |
2735 | uint8_t port_name[WWN_SIZE]; | |
2736 | uint8_t port_sym_name[128]; | |
2737 | uint32_t port_type; | |
2738 | uint32_t port_supported_cos; | |
2739 | uint8_t fabric_name[WWN_SIZE]; | |
2740 | uint8_t port_fc4_type[32]; | |
2741 | uint32_t port_state; | |
2742 | uint32_t num_ports; | |
2743 | uint32_t port_id; | |
cca5335c AV |
2744 | } a; |
2745 | }; | |
2746 | ||
2747 | /* | |
2748 | * Port Attribute Block. | |
2749 | */ | |
df57caba HM |
2750 | struct ct_fdmiv2_port_attributes { |
2751 | uint32_t count; | |
2752 | struct ct_fdmiv2_port_attr entry[FDMIV2_PORT_ATTR_COUNT]; | |
2753 | }; | |
2754 | ||
2755 | struct ct_fdmi_port_attr { | |
2756 | uint16_t type; | |
2757 | uint16_t len; | |
2758 | union { | |
2759 | uint8_t fc4_types[32]; | |
2760 | uint32_t sup_speed; | |
2761 | uint32_t cur_speed; | |
2762 | uint32_t max_frame_size; | |
2763 | uint8_t os_dev_name[32]; | |
dd83cb2c | 2764 | uint8_t host_name[256]; |
df57caba HM |
2765 | } a; |
2766 | }; | |
2767 | ||
cca5335c AV |
2768 | struct ct_fdmi_port_attributes { |
2769 | uint32_t count; | |
2770 | struct ct_fdmi_port_attr entry[FDMI_PORT_ATTR_COUNT]; | |
2771 | }; | |
2772 | ||
2773 | /* FDMI definitions. */ | |
2774 | #define GRHL_CMD 0x100 | |
2775 | #define GHAT_CMD 0x101 | |
2776 | #define GRPL_CMD 0x102 | |
2777 | #define GPAT_CMD 0x110 | |
2778 | ||
2779 | #define RHBA_CMD 0x200 | |
2780 | #define RHBA_RSP_SIZE 16 | |
2781 | ||
2782 | #define RHAT_CMD 0x201 | |
2783 | #define RPRT_CMD 0x210 | |
2784 | ||
2785 | #define RPA_CMD 0x211 | |
2786 | #define RPA_RSP_SIZE 16 | |
2787 | ||
2788 | #define DHBA_CMD 0x300 | |
2789 | #define DHBA_REQ_SIZE (16 + 8) | |
2790 | #define DHBA_RSP_SIZE 16 | |
2791 | ||
2792 | #define DHAT_CMD 0x301 | |
2793 | #define DPRT_CMD 0x310 | |
2794 | #define DPA_CMD 0x311 | |
2795 | ||
1da177e4 LT |
2796 | /* CT command header -- request/response common fields */ |
2797 | struct ct_cmd_hdr { | |
2798 | uint8_t revision; | |
2799 | uint8_t in_id[3]; | |
2800 | uint8_t gs_type; | |
2801 | uint8_t gs_subtype; | |
2802 | uint8_t options; | |
2803 | uint8_t reserved; | |
2804 | }; | |
2805 | ||
2806 | /* CT command request */ | |
2807 | struct ct_sns_req { | |
2808 | struct ct_cmd_hdr header; | |
2809 | uint16_t command; | |
2810 | uint16_t max_rsp_size; | |
2811 | uint8_t fragment_id; | |
2812 | uint8_t reserved[3]; | |
2813 | ||
2814 | union { | |
d8b45213 | 2815 | /* GA_NXT, GPN_ID, GNN_ID, GFT_ID, GFPN_ID */ |
1da177e4 LT |
2816 | struct { |
2817 | uint8_t reserved; | |
df95f39a | 2818 | be_id_t port_id; |
1da177e4 LT |
2819 | } port_id; |
2820 | ||
a4239945 QT |
2821 | struct { |
2822 | uint8_t reserved; | |
2823 | uint8_t domain; | |
2824 | uint8_t area; | |
2825 | uint8_t port_type; | |
2826 | } gpn_ft; | |
2827 | ||
1da177e4 LT |
2828 | struct { |
2829 | uint8_t port_type; | |
2830 | uint8_t domain; | |
2831 | uint8_t area; | |
2832 | uint8_t reserved; | |
2833 | } gid_pt; | |
2834 | ||
2835 | struct { | |
2836 | uint8_t reserved; | |
df95f39a | 2837 | be_id_t port_id; |
1da177e4 LT |
2838 | uint8_t fc4_types[32]; |
2839 | } rft_id; | |
2840 | ||
2841 | struct { | |
2842 | uint8_t reserved; | |
df95f39a | 2843 | be_id_t port_id; |
1da177e4 LT |
2844 | uint16_t reserved2; |
2845 | uint8_t fc4_feature; | |
2846 | uint8_t fc4_type; | |
2847 | } rff_id; | |
2848 | ||
2849 | struct { | |
2850 | uint8_t reserved; | |
df95f39a | 2851 | be_id_t port_id; |
1da177e4 LT |
2852 | uint8_t node_name[8]; |
2853 | } rnn_id; | |
2854 | ||
2855 | struct { | |
2856 | uint8_t node_name[8]; | |
2857 | uint8_t name_len; | |
2858 | uint8_t sym_node_name[255]; | |
2859 | } rsnn_nn; | |
cca5335c AV |
2860 | |
2861 | struct { | |
577419f7 | 2862 | uint8_t hba_identifier[8]; |
cca5335c AV |
2863 | } ghat; |
2864 | ||
2865 | struct { | |
2866 | uint8_t hba_identifier[8]; | |
2867 | uint32_t entry_count; | |
2868 | uint8_t port_name[8]; | |
2869 | struct ct_fdmi_hba_attributes attrs; | |
2870 | } rhba; | |
2871 | ||
df57caba HM |
2872 | struct { |
2873 | uint8_t hba_identifier[8]; | |
2874 | uint32_t entry_count; | |
2875 | uint8_t port_name[8]; | |
2876 | struct ct_fdmiv2_hba_attributes attrs; | |
2877 | } rhba2; | |
2878 | ||
cca5335c AV |
2879 | struct { |
2880 | uint8_t hba_identifier[8]; | |
2881 | struct ct_fdmi_hba_attributes attrs; | |
2882 | } rhat; | |
2883 | ||
2884 | struct { | |
2885 | uint8_t port_name[8]; | |
2886 | struct ct_fdmi_port_attributes attrs; | |
2887 | } rpa; | |
2888 | ||
df57caba HM |
2889 | struct { |
2890 | uint8_t port_name[8]; | |
2891 | struct ct_fdmiv2_port_attributes attrs; | |
2892 | } rpa2; | |
2893 | ||
cca5335c AV |
2894 | struct { |
2895 | uint8_t port_name[8]; | |
2896 | } dhba; | |
2897 | ||
2898 | struct { | |
2899 | uint8_t port_name[8]; | |
2900 | } dhat; | |
2901 | ||
2902 | struct { | |
2903 | uint8_t port_name[8]; | |
2904 | } dprt; | |
2905 | ||
2906 | struct { | |
2907 | uint8_t port_name[8]; | |
2908 | } dpa; | |
d8b45213 AV |
2909 | |
2910 | struct { | |
2911 | uint8_t port_name[8]; | |
2912 | } gpsc; | |
e8c72ba5 CD |
2913 | |
2914 | struct { | |
2915 | uint8_t reserved; | |
a5d42f4c | 2916 | uint8_t port_id[3]; |
e8c72ba5 | 2917 | } gff_id; |
726b8548 QT |
2918 | |
2919 | struct { | |
2920 | uint8_t port_name[8]; | |
2921 | } gid_pn; | |
1da177e4 LT |
2922 | } req; |
2923 | }; | |
2924 | ||
2925 | /* CT command response header */ | |
2926 | struct ct_rsp_hdr { | |
2927 | struct ct_cmd_hdr header; | |
2928 | uint16_t response; | |
2929 | uint16_t residual; | |
2930 | uint8_t fragment_id; | |
2931 | uint8_t reason_code; | |
2932 | uint8_t explanation_code; | |
2933 | uint8_t vendor_unique; | |
2934 | }; | |
2935 | ||
2936 | struct ct_sns_gid_pt_data { | |
2937 | uint8_t control_byte; | |
df95f39a | 2938 | be_id_t port_id; |
1da177e4 LT |
2939 | }; |
2940 | ||
a4239945 QT |
2941 | /* It's the same for both GPN_FT and GNN_FT */ |
2942 | struct ct_sns_gpnft_rsp { | |
2943 | struct { | |
2944 | struct ct_cmd_hdr header; | |
2945 | uint16_t response; | |
2946 | uint16_t residual; | |
2947 | uint8_t fragment_id; | |
2948 | uint8_t reason_code; | |
2949 | uint8_t explanation_code; | |
2950 | uint8_t vendor_unique; | |
2951 | }; | |
2952 | /* Assume the largest number of targets for the union */ | |
2953 | struct ct_sns_gpn_ft_data { | |
2954 | u8 control_byte; | |
2955 | u8 port_id[3]; | |
2956 | u32 reserved; | |
2957 | u8 port_name[8]; | |
2958 | } entries[1]; | |
2959 | }; | |
2960 | ||
2961 | /* CT command response */ | |
1da177e4 LT |
2962 | struct ct_sns_rsp { |
2963 | struct ct_rsp_hdr header; | |
2964 | ||
2965 | union { | |
2966 | struct { | |
2967 | uint8_t port_type; | |
df95f39a | 2968 | be_id_t port_id; |
1da177e4 LT |
2969 | uint8_t port_name[8]; |
2970 | uint8_t sym_port_name_len; | |
2971 | uint8_t sym_port_name[255]; | |
2972 | uint8_t node_name[8]; | |
2973 | uint8_t sym_node_name_len; | |
2974 | uint8_t sym_node_name[255]; | |
2975 | uint8_t init_proc_assoc[8]; | |
2976 | uint8_t node_ip_addr[16]; | |
2977 | uint8_t class_of_service[4]; | |
2978 | uint8_t fc4_types[32]; | |
2979 | uint8_t ip_address[16]; | |
2980 | uint8_t fabric_port_name[8]; | |
2981 | uint8_t reserved; | |
2982 | uint8_t hard_address[3]; | |
2983 | } ga_nxt; | |
2984 | ||
2985 | struct { | |
642ef983 CD |
2986 | /* Assume the largest number of targets for the union */ |
2987 | struct ct_sns_gid_pt_data | |
2988 | entries[MAX_FIBRE_DEVICES_MAX]; | |
1da177e4 LT |
2989 | } gid_pt; |
2990 | ||
2991 | struct { | |
2992 | uint8_t port_name[8]; | |
2993 | } gpn_id; | |
2994 | ||
2995 | struct { | |
2996 | uint8_t node_name[8]; | |
2997 | } gnn_id; | |
2998 | ||
2999 | struct { | |
3000 | uint8_t fc4_types[32]; | |
3001 | } gft_id; | |
cca5335c AV |
3002 | |
3003 | struct { | |
3004 | uint32_t entry_count; | |
3005 | uint8_t port_name[8]; | |
3006 | struct ct_fdmi_hba_attributes attrs; | |
3007 | } ghat; | |
d8b45213 AV |
3008 | |
3009 | struct { | |
3010 | uint8_t port_name[8]; | |
3011 | } gfpn_id; | |
3012 | ||
3013 | struct { | |
3014 | uint16_t speeds; | |
3015 | uint16_t speed; | |
3016 | } gpsc; | |
e8c72ba5 CD |
3017 | |
3018 | #define GFF_FCP_SCSI_OFFSET 7 | |
d3bae931 | 3019 | #define GFF_NVME_OFFSET 23 /* type = 28h */ |
e8c72ba5 CD |
3020 | struct { |
3021 | uint8_t fc4_features[128]; | |
3022 | } gff_id; | |
726b8548 QT |
3023 | struct { |
3024 | uint8_t reserved; | |
3025 | uint8_t port_id[3]; | |
3026 | } gid_pn; | |
1da177e4 LT |
3027 | } rsp; |
3028 | }; | |
3029 | ||
3030 | struct ct_sns_pkt { | |
3031 | union { | |
3032 | struct ct_sns_req req; | |
3033 | struct ct_sns_rsp rsp; | |
3034 | } p; | |
3035 | }; | |
3036 | ||
a4239945 QT |
3037 | struct ct_sns_gpnft_pkt { |
3038 | union { | |
3039 | struct ct_sns_req req; | |
3040 | struct ct_sns_gpnft_rsp rsp; | |
3041 | } p; | |
3042 | }; | |
3043 | ||
f352eeb7 QT |
3044 | enum scan_flags_t { |
3045 | SF_SCANNING = BIT_0, | |
3046 | SF_QUEUED = BIT_1, | |
3047 | }; | |
3048 | ||
33b28357 QT |
3049 | enum fc4type_t { |
3050 | FS_FC4TYPE_FCP = BIT_0, | |
3051 | FS_FC4TYPE_NVME = BIT_1, | |
3052 | }; | |
3053 | ||
a4239945 QT |
3054 | struct fab_scan_rp { |
3055 | port_id_t id; | |
33b28357 | 3056 | enum fc4type_t fc4type; |
a4239945 QT |
3057 | u8 port_name[8]; |
3058 | u8 node_name[8]; | |
3059 | }; | |
3060 | ||
3061 | struct fab_scan { | |
3062 | struct fab_scan_rp *l; | |
3063 | u32 size; | |
6944dccb QT |
3064 | u16 scan_retry; |
3065 | #define MAX_SCAN_RETRIES 5 | |
f352eeb7 QT |
3066 | enum scan_flags_t scan_flags; |
3067 | struct delayed_work scan_work; | |
a4239945 QT |
3068 | }; |
3069 | ||
1da177e4 | 3070 | /* |
25985edc | 3071 | * SNS command structures -- for 2200 compatibility. |
1da177e4 LT |
3072 | */ |
3073 | #define RFT_ID_SNS_SCMD_LEN 22 | |
3074 | #define RFT_ID_SNS_CMD_SIZE 60 | |
3075 | #define RFT_ID_SNS_DATA_SIZE 16 | |
3076 | ||
3077 | #define RNN_ID_SNS_SCMD_LEN 10 | |
3078 | #define RNN_ID_SNS_CMD_SIZE 36 | |
3079 | #define RNN_ID_SNS_DATA_SIZE 16 | |
3080 | ||
3081 | #define GA_NXT_SNS_SCMD_LEN 6 | |
3082 | #define GA_NXT_SNS_CMD_SIZE 28 | |
3083 | #define GA_NXT_SNS_DATA_SIZE (620 + 16) | |
3084 | ||
3085 | #define GID_PT_SNS_SCMD_LEN 6 | |
3086 | #define GID_PT_SNS_CMD_SIZE 28 | |
642ef983 CD |
3087 | /* |
3088 | * Assume MAX_FIBRE_DEVICES_2100 as these defines are only used with older | |
3089 | * adapters. | |
3090 | */ | |
3091 | #define GID_PT_SNS_DATA_SIZE (MAX_FIBRE_DEVICES_2100 * 4 + 16) | |
1da177e4 LT |
3092 | |
3093 | #define GPN_ID_SNS_SCMD_LEN 6 | |
3094 | #define GPN_ID_SNS_CMD_SIZE 28 | |
3095 | #define GPN_ID_SNS_DATA_SIZE (8 + 16) | |
3096 | ||
3097 | #define GNN_ID_SNS_SCMD_LEN 6 | |
3098 | #define GNN_ID_SNS_CMD_SIZE 28 | |
3099 | #define GNN_ID_SNS_DATA_SIZE (8 + 16) | |
3100 | ||
3101 | struct sns_cmd_pkt { | |
3102 | union { | |
3103 | struct { | |
3104 | uint16_t buffer_length; | |
3105 | uint16_t reserved_1; | |
d4556a49 | 3106 | __le64 buffer_address __packed; |
1da177e4 LT |
3107 | uint16_t subcommand_length; |
3108 | uint16_t reserved_2; | |
3109 | uint16_t subcommand; | |
3110 | uint16_t size; | |
3111 | uint32_t reserved_3; | |
3112 | uint8_t param[36]; | |
3113 | } cmd; | |
3114 | ||
3115 | uint8_t rft_data[RFT_ID_SNS_DATA_SIZE]; | |
3116 | uint8_t rnn_data[RNN_ID_SNS_DATA_SIZE]; | |
3117 | uint8_t gan_data[GA_NXT_SNS_DATA_SIZE]; | |
3118 | uint8_t gid_data[GID_PT_SNS_DATA_SIZE]; | |
3119 | uint8_t gpn_data[GPN_ID_SNS_DATA_SIZE]; | |
3120 | uint8_t gnn_data[GNN_ID_SNS_DATA_SIZE]; | |
3121 | } p; | |
3122 | }; | |
3123 | ||
5433383e AV |
3124 | struct fw_blob { |
3125 | char *name; | |
3126 | uint32_t segs[4]; | |
3127 | const struct firmware *fw; | |
3128 | }; | |
3129 | ||
1da177e4 LT |
3130 | /* Return data from MBC_GET_ID_LIST call. */ |
3131 | struct gid_list_info { | |
3132 | uint8_t al_pa; | |
3133 | uint8_t area; | |
fa2a1ce5 | 3134 | uint8_t domain; |
1da177e4 LT |
3135 | uint8_t loop_id_2100; /* ISP2100/ISP2200 -- 4 bytes. */ |
3136 | uint16_t loop_id; /* ISP23XX -- 6 bytes. */ | |
3d71644c | 3137 | uint16_t reserved_1; /* ISP24XX -- 8 bytes. */ |
1da177e4 | 3138 | }; |
1da177e4 | 3139 | |
2c3dfe3f SJ |
3140 | /* NPIV */ |
3141 | typedef struct vport_info { | |
3142 | uint8_t port_name[WWN_SIZE]; | |
3143 | uint8_t node_name[WWN_SIZE]; | |
3144 | int vp_id; | |
3145 | uint16_t loop_id; | |
3146 | unsigned long host_no; | |
3147 | uint8_t port_id[3]; | |
3148 | int loop_state; | |
3149 | } vport_info_t; | |
3150 | ||
3151 | typedef struct vport_params { | |
3152 | uint8_t port_name[WWN_SIZE]; | |
3153 | uint8_t node_name[WWN_SIZE]; | |
3154 | uint32_t options; | |
3155 | #define VP_OPTS_RETRY_ENABLE BIT_0 | |
3156 | #define VP_OPTS_VP_DISABLE BIT_1 | |
3157 | } vport_params_t; | |
3158 | ||
3159 | /* NPIV - return codes of VP create and modify */ | |
3160 | #define VP_RET_CODE_OK 0 | |
3161 | #define VP_RET_CODE_FATAL 1 | |
3162 | #define VP_RET_CODE_WRONG_ID 2 | |
3163 | #define VP_RET_CODE_WWPN 3 | |
3164 | #define VP_RET_CODE_RESOURCES 4 | |
3165 | #define VP_RET_CODE_NO_MEM 5 | |
3166 | #define VP_RET_CODE_NOT_FOUND 6 | |
3167 | ||
7b867cf7 | 3168 | struct qla_hw_data; |
2afa19a9 | 3169 | struct rsp_que; |
abbd8870 AV |
3170 | /* |
3171 | * ISP operations | |
3172 | */ | |
3173 | struct isp_operations { | |
3174 | ||
3175 | int (*pci_config) (struct scsi_qla_host *); | |
3f006ac3 | 3176 | int (*reset_chip)(struct scsi_qla_host *); |
abbd8870 AV |
3177 | int (*chip_diag) (struct scsi_qla_host *); |
3178 | void (*config_rings) (struct scsi_qla_host *); | |
3f006ac3 | 3179 | int (*reset_adapter)(struct scsi_qla_host *); |
abbd8870 AV |
3180 | int (*nvram_config) (struct scsi_qla_host *); |
3181 | void (*update_fw_options) (struct scsi_qla_host *); | |
3182 | int (*load_risc) (struct scsi_qla_host *, uint32_t *); | |
3183 | ||
dc6d6d34 | 3184 | char * (*pci_info_str)(struct scsi_qla_host *, char *, size_t); |
df57caba | 3185 | char * (*fw_version_str)(struct scsi_qla_host *, char *, size_t); |
abbd8870 | 3186 | |
7d12e780 | 3187 | irq_handler_t intr_handler; |
7b867cf7 AC |
3188 | void (*enable_intrs) (struct qla_hw_data *); |
3189 | void (*disable_intrs) (struct qla_hw_data *); | |
abbd8870 | 3190 | |
2afa19a9 | 3191 | int (*abort_command) (srb_t *); |
9cb78c16 HR |
3192 | int (*target_reset) (struct fc_port *, uint64_t, int); |
3193 | int (*lun_reset) (struct fc_port *, uint64_t, int); | |
abbd8870 AV |
3194 | int (*fabric_login) (struct scsi_qla_host *, uint16_t, uint8_t, |
3195 | uint8_t, uint8_t, uint16_t *, uint8_t); | |
1c7c6357 AV |
3196 | int (*fabric_logout) (struct scsi_qla_host *, uint16_t, uint8_t, |
3197 | uint8_t, uint8_t); | |
abbd8870 AV |
3198 | |
3199 | uint16_t (*calc_req_entries) (uint16_t); | |
3200 | void (*build_iocbs) (srb_t *, cmd_entry_t *, uint16_t); | |
726b8548 QT |
3201 | void *(*prep_ms_iocb) (struct scsi_qla_host *, struct ct_arg *); |
3202 | void *(*prep_ms_fdmi_iocb) (struct scsi_qla_host *, uint32_t, | |
cca5335c | 3203 | uint32_t); |
abbd8870 | 3204 | |
3695310e | 3205 | uint8_t *(*read_nvram)(struct scsi_qla_host *, void *, |
abbd8870 | 3206 | uint32_t, uint32_t); |
3695310e | 3207 | int (*write_nvram)(struct scsi_qla_host *, void *, uint32_t, |
abbd8870 AV |
3208 | uint32_t); |
3209 | ||
3210 | void (*fw_dump) (struct scsi_qla_host *, int); | |
f6df144c | 3211 | |
3212 | int (*beacon_on) (struct scsi_qla_host *); | |
3213 | int (*beacon_off) (struct scsi_qla_host *); | |
3214 | void (*beacon_blink) (struct scsi_qla_host *); | |
854165f4 | 3215 | |
3695310e | 3216 | void *(*read_optrom)(struct scsi_qla_host *, void *, |
854165f4 | 3217 | uint32_t, uint32_t); |
3695310e | 3218 | int (*write_optrom)(struct scsi_qla_host *, void *, uint32_t, |
854165f4 | 3219 | uint32_t); |
30c47662 AV |
3220 | |
3221 | int (*get_flash_version) (struct scsi_qla_host *, void *); | |
7b867cf7 | 3222 | int (*start_scsi) (srb_t *); |
d7459527 | 3223 | int (*start_scsi_mq) (srb_t *); |
a9083016 | 3224 | int (*abort_isp) (struct scsi_qla_host *); |
845bbb09 | 3225 | int (*iospace_config)(struct qla_hw_data *); |
8ae6d9c7 | 3226 | int (*initialize_adapter)(struct scsi_qla_host *); |
abbd8870 AV |
3227 | }; |
3228 | ||
a8488abe AV |
3229 | /* MSI-X Support *************************************************************/ |
3230 | ||
3231 | #define QLA_MSIX_CHIP_REV_24XX 3 | |
3232 | #define QLA_MSIX_FW_MODE(m) (((m) & (BIT_7|BIT_8|BIT_9)) >> 7) | |
3233 | #define QLA_MSIX_FW_MODE_1(m) (QLA_MSIX_FW_MODE(m) == 1) | |
3234 | ||
17e5fc58 | 3235 | #define QLA_BASE_VECTORS 2 /* default + RSP */ |
d7459527 | 3236 | #define QLA_MSIX_RSP_Q 0x01 |
093df737 QT |
3237 | #define QLA_ATIO_VECTOR 0x02 |
3238 | #define QLA_MSIX_QPAIR_MULTIQ_RSP_Q 0x03 | |
a8488abe | 3239 | |
a8488abe AV |
3240 | #define QLA_MIDX_DEFAULT 0 |
3241 | #define QLA_MIDX_RSP_Q 1 | |
73208dfd | 3242 | #define QLA_PCI_MSIX_CONTROL 0xa2 |
6246b8a1 | 3243 | #define QLA_83XX_PCI_MSIX_CONTROL 0x92 |
a8488abe AV |
3244 | |
3245 | struct scsi_qla_host; | |
3246 | ||
cdb898c5 QT |
3247 | |
3248 | #define QLA83XX_RSPQ_MSIX_ENTRY_NUMBER 1 /* refer to qla83xx_msix_entries */ | |
3249 | ||
a8488abe AV |
3250 | struct qla_msix_entry { |
3251 | int have_irq; | |
d7459527 | 3252 | int in_use; |
73208dfd AC |
3253 | uint32_t vector; |
3254 | uint16_t entry; | |
d7459527 | 3255 | char name[30]; |
4fa18345 | 3256 | void *handle; |
cdb898c5 | 3257 | int cpuid; |
a8488abe AV |
3258 | }; |
3259 | ||
2c3dfe3f SJ |
3260 | #define WATCH_INTERVAL 1 /* number of seconds */ |
3261 | ||
0971de7f AV |
3262 | /* Work events. */ |
3263 | enum qla_work_type { | |
3264 | QLA_EVT_AEN, | |
8a659571 | 3265 | QLA_EVT_IDC_ACK, |
ac280b67 | 3266 | QLA_EVT_ASYNC_LOGIN, |
ac280b67 AV |
3267 | QLA_EVT_ASYNC_LOGOUT, |
3268 | QLA_EVT_ASYNC_LOGOUT_DONE, | |
5ff1d584 | 3269 | QLA_EVT_ASYNC_ADISC, |
3420d36c | 3270 | QLA_EVT_UEVENT, |
8ae6d9c7 | 3271 | QLA_EVT_AENFX, |
726b8548 | 3272 | QLA_EVT_GPNID, |
e374f9f5 | 3273 | QLA_EVT_UNMAP, |
726b8548 QT |
3274 | QLA_EVT_NEW_SESS, |
3275 | QLA_EVT_GPDB, | |
a5d42f4c | 3276 | QLA_EVT_PRLI, |
726b8548 | 3277 | QLA_EVT_GPSC, |
726b8548 QT |
3278 | QLA_EVT_GNL, |
3279 | QLA_EVT_NACK, | |
9b3e0f4d | 3280 | QLA_EVT_RELOGIN, |
11aea16a QT |
3281 | QLA_EVT_ASYNC_PRLO, |
3282 | QLA_EVT_ASYNC_PRLO_DONE, | |
a4239945 QT |
3283 | QLA_EVT_GPNFT, |
3284 | QLA_EVT_GPNFT_DONE, | |
3285 | QLA_EVT_GNNFT_DONE, | |
3286 | QLA_EVT_GNNID, | |
3287 | QLA_EVT_GFPNID, | |
e374f9f5 | 3288 | QLA_EVT_SP_RETRY, |
cc28e0ac | 3289 | QLA_EVT_IIDMA, |
8777e431 | 3290 | QLA_EVT_ELS_PLOGI, |
0971de7f AV |
3291 | }; |
3292 | ||
3293 | ||
3294 | struct qla_work_evt { | |
3295 | struct list_head list; | |
3296 | enum qla_work_type type; | |
3297 | u32 flags; | |
3298 | #define QLA_EVT_FLAG_FREE 0x1 | |
3299 | ||
3300 | union { | |
3301 | struct { | |
3302 | enum fc_host_event_code code; | |
3303 | u32 data; | |
3304 | } aen; | |
8a659571 AV |
3305 | struct { |
3306 | #define QLA_IDC_ACK_REGS 7 | |
3307 | uint16_t mb[QLA_IDC_ACK_REGS]; | |
3308 | } idc_ack; | |
ac280b67 AV |
3309 | struct { |
3310 | struct fc_port *fcport; | |
3311 | #define QLA_LOGIO_LOGIN_RETRIED BIT_0 | |
3312 | u16 data[2]; | |
3313 | } logio; | |
3420d36c AV |
3314 | struct { |
3315 | u32 code; | |
3316 | #define QLA_UEVENT_CODE_FW_DUMP 0 | |
3317 | } uevent; | |
8ae6d9c7 GM |
3318 | struct { |
3319 | uint32_t evtcode; | |
3320 | uint32_t mbx[8]; | |
3321 | uint32_t count; | |
3322 | } aenfx; | |
3323 | struct { | |
3324 | srb_t *sp; | |
3325 | } iosb; | |
726b8548 QT |
3326 | struct { |
3327 | port_id_t id; | |
3328 | } gpnid; | |
3329 | struct { | |
3330 | port_id_t id; | |
3331 | u8 port_name[8]; | |
a4239945 | 3332 | u8 node_name[8]; |
726b8548 | 3333 | void *pla; |
a4239945 | 3334 | u8 fc4_type; |
726b8548 QT |
3335 | } new_sess; |
3336 | struct { /*Get PDB, Get Speed, update fcport, gnl, gidpn */ | |
3337 | fc_port_t *fcport; | |
3338 | u8 opt; | |
3339 | } fcport; | |
3340 | struct { | |
3341 | fc_port_t *fcport; | |
3342 | u8 iocb[IOCB_SIZE]; | |
3343 | int type; | |
3344 | } nack; | |
a4239945 QT |
3345 | struct { |
3346 | u8 fc4_type; | |
33b28357 | 3347 | srb_t *sp; |
a4239945 | 3348 | } gpnft; |
8ae6d9c7 | 3349 | } u; |
0971de7f AV |
3350 | }; |
3351 | ||
4d4df193 HK |
3352 | struct qla_chip_state_84xx { |
3353 | struct list_head list; | |
3354 | struct kref kref; | |
3355 | ||
3356 | void *bus; | |
3357 | spinlock_t access_lock; | |
3358 | struct mutex fw_update_mutex; | |
3359 | uint32_t fw_update; | |
3360 | uint32_t op_fw_version; | |
3361 | uint32_t op_fw_size; | |
3362 | uint32_t op_fw_seq_size; | |
3363 | uint32_t diag_fw_version; | |
3364 | uint32_t gold_fw_version; | |
3365 | }; | |
3366 | ||
54b9993c AG |
3367 | struct qla_dif_statistics { |
3368 | uint64_t dif_input_bytes; | |
3369 | uint64_t dif_output_bytes; | |
3370 | uint64_t dif_input_requests; | |
3371 | uint64_t dif_output_requests; | |
3372 | uint32_t dif_guard_err; | |
3373 | uint32_t dif_ref_tag_err; | |
3374 | uint32_t dif_app_tag_err; | |
3375 | }; | |
3376 | ||
e5f5f6f7 HZ |
3377 | struct qla_statistics { |
3378 | uint32_t total_isp_aborts; | |
49fd462a HZ |
3379 | uint64_t input_bytes; |
3380 | uint64_t output_bytes; | |
fabbb8df JC |
3381 | uint64_t input_requests; |
3382 | uint64_t output_requests; | |
3383 | uint32_t control_requests; | |
3384 | ||
3385 | uint64_t jiffies_at_last_reset; | |
33e79977 QT |
3386 | uint32_t stat_max_pend_cmds; |
3387 | uint32_t stat_max_qfull_cmds_alloc; | |
3388 | uint32_t stat_max_qfull_cmds_dropped; | |
54b9993c AG |
3389 | |
3390 | struct qla_dif_statistics qla_dif_stats; | |
e5f5f6f7 HZ |
3391 | }; |
3392 | ||
a9b6f722 SK |
3393 | struct bidi_statistics { |
3394 | unsigned long long io_count; | |
3395 | unsigned long long transfer_bytes; | |
3396 | }; | |
3397 | ||
be25152c QT |
3398 | struct qla_tc_param { |
3399 | struct scsi_qla_host *vha; | |
3400 | uint32_t blk_sz; | |
3401 | uint32_t bufflen; | |
3402 | struct scatterlist *sg; | |
3403 | struct scatterlist *prot_sg; | |
3404 | struct crc_context *ctx; | |
3405 | uint8_t *ctx_dsd_alloced; | |
3406 | }; | |
3407 | ||
73208dfd AC |
3408 | /* Multi queue support */ |
3409 | #define MBC_INITIALIZE_MULTIQ 0x1f | |
3410 | #define QLA_QUE_PAGE 0X1000 | |
3411 | #define QLA_MQ_SIZE 32 | |
73208dfd AC |
3412 | #define QLA_MAX_QUEUES 256 |
3413 | #define ISP_QUE_REG(ha, id) \ | |
ecc89f25 JC |
3414 | ((ha->mqenable || IS_QLA83XX(ha) || \ |
3415 | IS_QLA27XX(ha) || IS_QLA28XX(ha)) ? \ | |
da9b1d5c AV |
3416 | ((void __iomem *)ha->mqiobase + (QLA_QUE_PAGE * id)) :\ |
3417 | ((void __iomem *)ha->iobase)) | |
73208dfd AC |
3418 | #define QLA_REQ_QUE_ID(tag) \ |
3419 | ((tag < QLA_MAX_QUEUES && tag > 0) ? tag : 0) | |
3420 | #define QLA_DEFAULT_QUE_QOS 5 | |
3421 | #define QLA_PRECONFIG_VPORTS 32 | |
3422 | #define QLA_MAX_VPORTS_QLA24XX 128 | |
3423 | #define QLA_MAX_VPORTS_QLA25XX 256 | |
82de802a | 3424 | |
60a9eadb QT |
3425 | struct qla_tgt_counters { |
3426 | uint64_t qla_core_sbt_cmd; | |
3427 | uint64_t core_qla_que_buf; | |
3428 | uint64_t qla_core_ret_ctio; | |
3429 | uint64_t core_qla_snd_status; | |
3430 | uint64_t qla_core_ret_sta_ctio; | |
3431 | uint64_t core_qla_free_cmd; | |
3432 | uint64_t num_q_full_sent; | |
3433 | uint64_t num_alloc_iocb_failed; | |
3434 | uint64_t num_term_xchg_sent; | |
3435 | }; | |
3436 | ||
82de802a QT |
3437 | struct qla_qpair; |
3438 | ||
7b867cf7 AC |
3439 | /* Response queue data structure */ |
3440 | struct rsp_que { | |
3441 | dma_addr_t dma; | |
3442 | response_t *ring; | |
3443 | response_t *ring_ptr; | |
08029990 AV |
3444 | uint32_t __iomem *rsp_q_in; /* FWI2-capable only. */ |
3445 | uint32_t __iomem *rsp_q_out; | |
7b867cf7 AC |
3446 | uint16_t ring_index; |
3447 | uint16_t out_ptr; | |
7c6300e3 | 3448 | uint16_t *in_ptr; /* queue shadow in index */ |
7b867cf7 AC |
3449 | uint16_t length; |
3450 | uint16_t options; | |
7b867cf7 | 3451 | uint16_t rid; |
73208dfd AC |
3452 | uint16_t id; |
3453 | uint16_t vp_idx; | |
7b867cf7 | 3454 | struct qla_hw_data *hw; |
73208dfd AC |
3455 | struct qla_msix_entry *msix; |
3456 | struct req_que *req; | |
2afa19a9 | 3457 | srb_t *status_srb; /* status continuation entry */ |
82de802a | 3458 | struct qla_qpair *qpair; |
8ae6d9c7 GM |
3459 | |
3460 | dma_addr_t dma_fx00; | |
3461 | response_t *ring_fx00; | |
3462 | uint16_t length_fx00; | |
3463 | uint8_t rsp_pkt[REQUEST_ENTRY_SIZE]; | |
7b867cf7 | 3464 | }; |
1da177e4 | 3465 | |
7b867cf7 AC |
3466 | /* Request queue data structure */ |
3467 | struct req_que { | |
3468 | dma_addr_t dma; | |
3469 | request_t *ring; | |
3470 | request_t *ring_ptr; | |
08029990 AV |
3471 | uint32_t __iomem *req_q_in; /* FWI2-capable only. */ |
3472 | uint32_t __iomem *req_q_out; | |
7b867cf7 AC |
3473 | uint16_t ring_index; |
3474 | uint16_t in_ptr; | |
7c6300e3 | 3475 | uint16_t *out_ptr; /* queue shadow out index */ |
7b867cf7 AC |
3476 | uint16_t cnt; |
3477 | uint16_t length; | |
3478 | uint16_t options; | |
3479 | uint16_t rid; | |
73208dfd | 3480 | uint16_t id; |
7b867cf7 AC |
3481 | uint16_t qos; |
3482 | uint16_t vp_idx; | |
73208dfd | 3483 | struct rsp_que *rsp; |
8d93f550 | 3484 | srb_t **outstanding_cmds; |
7b867cf7 | 3485 | uint32_t current_outstanding_cmd; |
8d93f550 | 3486 | uint16_t num_outstanding_cmds; |
7b867cf7 | 3487 | int max_q_depth; |
8ae6d9c7 GM |
3488 | |
3489 | dma_addr_t dma_fx00; | |
3490 | request_t *ring_fx00; | |
3491 | uint16_t length_fx00; | |
3492 | uint8_t req_pkt[REQUEST_ENTRY_SIZE]; | |
7b867cf7 | 3493 | }; |
1da177e4 | 3494 | |
d7459527 MH |
3495 | /*Queue pair data structure */ |
3496 | struct qla_qpair { | |
3497 | spinlock_t qp_lock; | |
3498 | atomic_t ref_count; | |
e326d22a | 3499 | uint32_t lun_cnt; |
82de802a QT |
3500 | /* |
3501 | * For qpair 0, qp_lock_ptr will point at hardware_lock due to | |
3502 | * legacy code. For other Qpair(s), it will point at qp_lock. | |
3503 | */ | |
3504 | spinlock_t *qp_lock_ptr; | |
3505 | struct scsi_qla_host *vha; | |
7c3f8fd1 | 3506 | u32 chip_reset; |
82de802a | 3507 | |
d7459527 MH |
3508 | /* distill these fields down to 'online=0/1' |
3509 | * ha->flags.eeh_busy | |
3510 | * ha->flags.pci_channel_io_perm_failure | |
3511 | * base_vha->loop_state | |
3512 | */ | |
3513 | uint32_t online:1; | |
3514 | /* move vha->flags.difdix_supported here */ | |
3515 | uint32_t difdix_supported:1; | |
3516 | uint32_t delete_in_progress:1; | |
4b60c827 | 3517 | uint32_t fw_started:1; |
7c3f8fd1 QT |
3518 | uint32_t enable_class_2:1; |
3519 | uint32_t enable_explicit_conf:1; | |
af7bb382 | 3520 | uint32_t use_shadow_reg:1; |
d7459527 MH |
3521 | |
3522 | uint16_t id; /* qp number used with FW */ | |
d7459527 | 3523 | uint16_t vp_idx; /* vport ID */ |
d7459527 MH |
3524 | mempool_t *srb_mempool; |
3525 | ||
8abfa9e2 QT |
3526 | struct pci_dev *pdev; |
3527 | void (*reqq_start_iocbs)(struct qla_qpair *); | |
3528 | ||
d7459527 MH |
3529 | /* to do: New driver: move queues to here instead of pointers */ |
3530 | struct req_que *req; | |
3531 | struct rsp_que *rsp; | |
3532 | struct atio_que *atio; | |
3533 | struct qla_msix_entry *msix; /* point to &ha->msix_entries[x] */ | |
3534 | struct qla_hw_data *hw; | |
3535 | struct work_struct q_work; | |
3536 | struct list_head qp_list_elem; /* vha->qp_list */ | |
e326d22a | 3537 | struct list_head hints_list; |
82de802a | 3538 | uint16_t cpuid; |
0691094f QT |
3539 | uint16_t retry_term_cnt; |
3540 | uint32_t retry_term_exchg_addr; | |
3541 | uint64_t retry_term_jiff; | |
60a9eadb | 3542 | struct qla_tgt_counters tgt_counters; |
d7459527 MH |
3543 | }; |
3544 | ||
9a069e19 GM |
3545 | /* Place holder for FW buffer parameters */ |
3546 | struct qlfc_fw { | |
3547 | void *fw_buf; | |
3548 | dma_addr_t fw_dma; | |
3549 | uint32_t len; | |
3550 | }; | |
3551 | ||
0e8cd71c SK |
3552 | struct scsi_qlt_host { |
3553 | void *target_lport_ptr; | |
3554 | struct mutex tgt_mutex; | |
3555 | struct mutex tgt_host_action_mutex; | |
3556 | struct qla_tgt *qla_tgt; | |
3557 | }; | |
3558 | ||
2d70c103 NB |
3559 | struct qlt_hw_data { |
3560 | /* Protected by hw lock */ | |
2d70c103 NB |
3561 | uint32_t node_name_set:1; |
3562 | ||
3563 | dma_addr_t atio_dma; /* Physical address. */ | |
3564 | struct atio *atio_ring; /* Base virtual address */ | |
3565 | struct atio *atio_ring_ptr; /* Current address. */ | |
3566 | uint16_t atio_ring_index; /* Current index. */ | |
3567 | uint16_t atio_q_length; | |
aa230bc5 AE |
3568 | uint32_t __iomem *atio_q_in; |
3569 | uint32_t __iomem *atio_q_out; | |
2d70c103 | 3570 | |
2d70c103 | 3571 | struct qla_tgt_func_tmpl *tgt_ops; |
2d70c103 | 3572 | struct qla_tgt_vp_map *tgt_vp_map; |
2d70c103 NB |
3573 | |
3574 | int saved_set; | |
3575 | uint16_t saved_exchange_count; | |
3576 | uint32_t saved_firmware_options_1; | |
3577 | uint32_t saved_firmware_options_2; | |
3578 | uint32_t saved_firmware_options_3; | |
3579 | uint8_t saved_firmware_options[2]; | |
3580 | uint8_t saved_add_firmware_options[2]; | |
3581 | ||
3582 | uint8_t tgt_node_name[WWN_SIZE]; | |
33e79977 | 3583 | |
36c78452 | 3584 | struct dentry *dfs_tgt_sess; |
c423437e | 3585 | struct dentry *dfs_tgt_port_database; |
09620eeb | 3586 | struct dentry *dfs_naqp; |
c423437e | 3587 | |
33e79977 QT |
3588 | struct list_head q_full_list; |
3589 | uint32_t num_pend_cmds; | |
3590 | uint32_t num_qfull_cmds_alloc; | |
3591 | uint32_t num_qfull_cmds_dropped; | |
3592 | spinlock_t q_full_lock; | |
3593 | uint32_t leak_exchg_thresh_hold; | |
7560151b | 3594 | spinlock_t sess_lock; |
09620eeb QT |
3595 | int num_act_qpairs; |
3596 | #define DEFAULT_NAQP 2 | |
2f424b9b | 3597 | spinlock_t atio_lock ____cacheline_aligned; |
482c9dc7 | 3598 | struct btree_head32 host_map; |
2d70c103 NB |
3599 | }; |
3600 | ||
33e79977 QT |
3601 | #define MAX_QFULL_CMDS_ALLOC 8192 |
3602 | #define Q_FULL_THRESH_HOLD_PERCENT 90 | |
3603 | #define Q_FULL_THRESH_HOLD(ha) \ | |
03e8c680 | 3604 | ((ha->cur_fw_xcb_count/100) * Q_FULL_THRESH_HOLD_PERCENT) |
33e79977 QT |
3605 | |
3606 | #define LEAK_EXCHG_THRESH_HOLD_PERCENT 75 /* 75 percent */ | |
3607 | ||
7b867cf7 AC |
3608 | /* |
3609 | * Qlogic host adapter specific data structure. | |
3610 | */ | |
3611 | struct qla_hw_data { | |
3612 | struct pci_dev *pdev; | |
3613 | /* SRB cache. */ | |
3614 | #define SRB_MIN_REQ 128 | |
3615 | mempool_t *srb_mempool; | |
1da177e4 LT |
3616 | |
3617 | volatile struct { | |
1da177e4 LT |
3618 | uint32_t mbox_int :1; |
3619 | uint32_t mbox_busy :1; | |
1da177e4 LT |
3620 | uint32_t disable_risc_code_load :1; |
3621 | uint32_t enable_64bit_addressing :1; | |
3622 | uint32_t enable_lip_reset :1; | |
1da177e4 | 3623 | uint32_t enable_target_reset :1; |
7b867cf7 | 3624 | uint32_t enable_lip_full_login :1; |
1da177e4 | 3625 | uint32_t enable_led_scheme :1; |
7190575f | 3626 | |
3d71644c AV |
3627 | uint32_t msi_enabled :1; |
3628 | uint32_t msix_enabled :1; | |
d4c760c2 | 3629 | uint32_t disable_serdes :1; |
4346b149 | 3630 | uint32_t gpsc_supported :1; |
2c3dfe3f | 3631 | uint32_t npiv_supported :1; |
85880801 | 3632 | uint32_t pci_channel_io_perm_failure :1; |
df613b96 | 3633 | uint32_t fce_enabled :1; |
1d2874de | 3634 | uint32_t fac_supported :1; |
7190575f | 3635 | |
2533cf67 | 3636 | uint32_t chip_reset_done :1; |
cbc8eb67 | 3637 | uint32_t running_gold_fw :1; |
85880801 | 3638 | uint32_t eeh_busy :1; |
3155754a | 3639 | uint32_t disable_msix_handshake :1; |
09ff701a | 3640 | uint32_t fcp_prio_enabled :1; |
7190575f | 3641 | uint32_t isp82xx_fw_hung:1; |
7d613ac6 | 3642 | uint32_t nic_core_hung:1; |
7190575f GM |
3643 | |
3644 | uint32_t quiesce_owner:1; | |
7d613ac6 SV |
3645 | uint32_t nic_core_reset_hdlr_active:1; |
3646 | uint32_t nic_core_reset_owner:1; | |
b6d0d9d5 | 3647 | uint32_t isp82xx_no_md_cap:1; |
2d70c103 | 3648 | uint32_t host_shutting_down:1; |
bf5b8ad7 | 3649 | uint32_t idc_compl_status:1; |
8ae6d9c7 GM |
3650 | uint32_t mr_reset_hdlr_active:1; |
3651 | uint32_t mr_intr_valid:1; | |
b0d6cabd | 3652 | |
40f3862b | 3653 | uint32_t dport_enabled:1; |
2486c627 | 3654 | uint32_t fawwpn_enabled:1; |
b0d6cabd | 3655 | uint32_t exlogins_enabled:1; |
2f56a7f1 | 3656 | uint32_t exchoffld_enabled:1; |
15f30a57 | 3657 | |
ec7193e2 QT |
3658 | uint32_t lip_ae:1; |
3659 | uint32_t n2n_ae:1; | |
15f30a57 | 3660 | uint32_t fw_started:1; |
ec7193e2 | 3661 | uint32_t fw_init_done:1; |
e4e3a2ce QT |
3662 | |
3663 | uint32_t detected_lr_sfp:1; | |
3664 | uint32_t using_lr_setting:1; | |
9cd883f0 | 3665 | uint32_t rida_fmt2:1; |
b2000805 | 3666 | uint32_t purge_mbox:1; |
8777e431 | 3667 | uint32_t n2n_bigger:1; |
3f006ac3 MH |
3668 | uint32_t secure_adapter:1; |
3669 | uint32_t secure_fw:1; | |
1da177e4 LT |
3670 | } flags; |
3671 | ||
d1e3635a | 3672 | uint16_t max_exchg; |
1f4c7c38 | 3673 | uint16_t long_range_distance; /* 32G & above */ |
e4e3a2ce QT |
3674 | #define LR_DISTANCE_5K 1 |
3675 | #define LR_DISTANCE_10K 0 | |
3676 | ||
fa2a1ce5 | 3677 | /* This spinlock is used to protect "io transactions", you must |
7b867cf7 AC |
3678 | * acquire it before doing any IO to the card, eg with RD_REG*() and |
3679 | * WRT_REG*() for the duration of your entire commandtransaction. | |
3680 | * | |
3681 | * This spinlock is of lower priority than the io request lock. | |
3682 | */ | |
1da177e4 | 3683 | |
7b867cf7 | 3684 | spinlock_t hardware_lock ____cacheline_aligned; |
285d0321 | 3685 | int bars; |
09483916 | 3686 | int mem_only; |
f73cb695 | 3687 | device_reg_t *iobase; /* Base I/O address */ |
3776541d | 3688 | resource_size_t pio_address; |
fa2a1ce5 | 3689 | |
7b867cf7 | 3690 | #define MIN_IOBASE_LEN 0x100 |
8ae6d9c7 GM |
3691 | dma_addr_t bar0_hdl; |
3692 | ||
3693 | void __iomem *cregbase; | |
3694 | dma_addr_t bar2_hdl; | |
3695 | #define BAR0_LEN_FX00 (1024 * 1024) | |
3696 | #define BAR2_LEN_FX00 (128 * 1024) | |
3697 | ||
3698 | uint32_t rqstq_intr_code; | |
3699 | uint32_t mbx_intr_code; | |
3700 | uint32_t req_que_len; | |
3701 | uint32_t rsp_que_len; | |
3702 | uint32_t req_que_off; | |
3703 | uint32_t rsp_que_off; | |
3704 | ||
3705 | /* Multi queue data structs */ | |
f73cb695 CD |
3706 | device_reg_t *mqiobase; |
3707 | device_reg_t *msixbase; | |
73208dfd AC |
3708 | uint16_t msix_count; |
3709 | uint8_t mqenable; | |
3710 | struct req_que **req_q_map; | |
3711 | struct rsp_que **rsp_q_map; | |
d7459527 | 3712 | struct qla_qpair **queue_pair_map; |
73208dfd AC |
3713 | unsigned long req_qid_map[(QLA_MAX_QUEUES / 8) / sizeof(unsigned long)]; |
3714 | unsigned long rsp_qid_map[(QLA_MAX_QUEUES / 8) / sizeof(unsigned long)]; | |
d7459527 MH |
3715 | unsigned long qpair_qid_map[(QLA_MAX_QUEUES / 8) |
3716 | / sizeof(unsigned long)]; | |
2afa19a9 AC |
3717 | uint8_t max_req_queues; |
3718 | uint8_t max_rsp_queues; | |
d7459527 | 3719 | uint8_t max_qpairs; |
b95b9452 | 3720 | uint8_t num_qpairs; |
d7459527 | 3721 | struct qla_qpair *base_qpair; |
73208dfd AC |
3722 | struct qla_npiv_entry *npiv_info; |
3723 | uint16_t nvram_npiv_size; | |
1da177e4 | 3724 | |
7b867cf7 AC |
3725 | uint16_t switch_cap; |
3726 | #define FLOGI_SEQ_DEL BIT_8 | |
3727 | #define FLOGI_MID_SUPPORT BIT_10 | |
3728 | #define FLOGI_VSAN_SUPPORT BIT_12 | |
3729 | #define FLOGI_SP_SUPPORT BIT_13 | |
e5b68a61 AC |
3730 | |
3731 | uint8_t port_no; /* Physical port of adapter */ | |
ead03855 | 3732 | uint8_t exch_starvation; |
e5b68a61 | 3733 | |
7b867cf7 AC |
3734 | /* Timeout timers. */ |
3735 | uint8_t loop_down_abort_time; /* port down timer */ | |
3736 | atomic_t loop_down_timer; /* loop down timer */ | |
3737 | uint8_t link_down_timeout; /* link down timeout */ | |
3738 | uint16_t max_loop_id; | |
642ef983 | 3739 | uint16_t max_fibre_devices; /* Maximum number of targets */ |
1da177e4 | 3740 | |
1da177e4 | 3741 | uint16_t fb_rev; |
7b867cf7 | 3742 | uint16_t min_external_loopid; /* First external loop Id */ |
1da177e4 | 3743 | |
d8b45213 | 3744 | #define PORT_SPEED_UNKNOWN 0xFFFF |
7b867cf7 AC |
3745 | #define PORT_SPEED_1GB 0x00 |
3746 | #define PORT_SPEED_2GB 0x01 | |
4910b524 | 3747 | #define PORT_SPEED_AUTO 0x02 |
7b867cf7 AC |
3748 | #define PORT_SPEED_4GB 0x03 |
3749 | #define PORT_SPEED_8GB 0x04 | |
6246b8a1 | 3750 | #define PORT_SPEED_16GB 0x05 |
f73cb695 | 3751 | #define PORT_SPEED_32GB 0x06 |
ecc89f25 | 3752 | #define PORT_SPEED_64GB 0x07 |
3a03eb79 | 3753 | #define PORT_SPEED_10GB 0x13 |
7b867cf7 | 3754 | uint16_t link_data_rate; /* F/W operating speed */ |
4910b524 | 3755 | uint16_t set_data_rate; /* Set by user */ |
1da177e4 LT |
3756 | |
3757 | uint8_t current_topology; | |
3758 | uint8_t prev_topology; | |
3759 | #define ISP_CFG_NL 1 | |
3760 | #define ISP_CFG_N 2 | |
3761 | #define ISP_CFG_FL 4 | |
3762 | #define ISP_CFG_F 8 | |
3763 | ||
7b867cf7 | 3764 | uint8_t operating_mode; /* F/W operating mode */ |
1da177e4 LT |
3765 | #define LOOP 0 |
3766 | #define P2P 1 | |
3767 | #define LOOP_P2P 2 | |
3768 | #define P2P_LOOP 3 | |
1da177e4 | 3769 | uint8_t interrupts_on; |
7b867cf7 | 3770 | uint32_t isp_abort_cnt; |
7b867cf7 AC |
3771 | #define PCI_DEVICE_ID_QLOGIC_ISP2532 0x2532 |
3772 | #define PCI_DEVICE_ID_QLOGIC_ISP8432 0x8432 | |
3a03eb79 | 3773 | #define PCI_DEVICE_ID_QLOGIC_ISP8001 0x8001 |
6246b8a1 GM |
3774 | #define PCI_DEVICE_ID_QLOGIC_ISP8031 0x8031 |
3775 | #define PCI_DEVICE_ID_QLOGIC_ISP2031 0x2031 | |
f73cb695 | 3776 | #define PCI_DEVICE_ID_QLOGIC_ISP2071 0x2071 |
2c5bbbb2 | 3777 | #define PCI_DEVICE_ID_QLOGIC_ISP2271 0x2271 |
2b48992f | 3778 | #define PCI_DEVICE_ID_QLOGIC_ISP2261 0x2261 |
ecc89f25 JC |
3779 | #define PCI_DEVICE_ID_QLOGIC_ISP2061 0x2061 |
3780 | #define PCI_DEVICE_ID_QLOGIC_ISP2081 0x2081 | |
3781 | #define PCI_DEVICE_ID_QLOGIC_ISP2089 0x2089 | |
3782 | #define PCI_DEVICE_ID_QLOGIC_ISP2281 0x2281 | |
3783 | #define PCI_DEVICE_ID_QLOGIC_ISP2289 0x2289 | |
2c5bbbb2 | 3784 | |
9e052e2d | 3785 | uint32_t isp_type; |
7b867cf7 AC |
3786 | #define DT_ISP2100 BIT_0 |
3787 | #define DT_ISP2200 BIT_1 | |
3788 | #define DT_ISP2300 BIT_2 | |
3789 | #define DT_ISP2312 BIT_3 | |
3790 | #define DT_ISP2322 BIT_4 | |
3791 | #define DT_ISP6312 BIT_5 | |
3792 | #define DT_ISP6322 BIT_6 | |
3793 | #define DT_ISP2422 BIT_7 | |
3794 | #define DT_ISP2432 BIT_8 | |
3795 | #define DT_ISP5422 BIT_9 | |
3796 | #define DT_ISP5432 BIT_10 | |
3797 | #define DT_ISP2532 BIT_11 | |
3798 | #define DT_ISP8432 BIT_12 | |
3a03eb79 | 3799 | #define DT_ISP8001 BIT_13 |
a9083016 | 3800 | #define DT_ISP8021 BIT_14 |
6246b8a1 GM |
3801 | #define DT_ISP2031 BIT_15 |
3802 | #define DT_ISP8031 BIT_16 | |
8ae6d9c7 | 3803 | #define DT_ISPFX00 BIT_17 |
7ec0effd | 3804 | #define DT_ISP8044 BIT_18 |
f73cb695 | 3805 | #define DT_ISP2071 BIT_19 |
2c5bbbb2 | 3806 | #define DT_ISP2271 BIT_20 |
2b48992f | 3807 | #define DT_ISP2261 BIT_21 |
ecc89f25 JC |
3808 | #define DT_ISP2061 BIT_22 |
3809 | #define DT_ISP2081 BIT_23 | |
3810 | #define DT_ISP2089 BIT_24 | |
3811 | #define DT_ISP2281 BIT_25 | |
3812 | #define DT_ISP2289 BIT_26 | |
3813 | #define DT_ISP_LAST (DT_ISP2289 << 1) | |
7b867cf7 | 3814 | |
9e052e2d | 3815 | uint32_t device_type; |
e02587d7 | 3816 | #define DT_T10_PI BIT_25 |
7b867cf7 AC |
3817 | #define DT_IIDMA BIT_26 |
3818 | #define DT_FWI2 BIT_27 | |
3819 | #define DT_ZIO_SUPPORTED BIT_28 | |
3820 | #define DT_OEM_001 BIT_29 | |
3821 | #define DT_ISP2200A BIT_30 | |
3822 | #define DT_EXTENDED_IDS BIT_31 | |
9e052e2d JC |
3823 | |
3824 | #define DT_MASK(ha) ((ha)->isp_type & (DT_ISP_LAST - 1)) | |
7b867cf7 AC |
3825 | #define IS_QLA2100(ha) (DT_MASK(ha) & DT_ISP2100) |
3826 | #define IS_QLA2200(ha) (DT_MASK(ha) & DT_ISP2200) | |
3827 | #define IS_QLA2300(ha) (DT_MASK(ha) & DT_ISP2300) | |
3828 | #define IS_QLA2312(ha) (DT_MASK(ha) & DT_ISP2312) | |
3829 | #define IS_QLA2322(ha) (DT_MASK(ha) & DT_ISP2322) | |
3830 | #define IS_QLA6312(ha) (DT_MASK(ha) & DT_ISP6312) | |
3831 | #define IS_QLA6322(ha) (DT_MASK(ha) & DT_ISP6322) | |
3832 | #define IS_QLA2422(ha) (DT_MASK(ha) & DT_ISP2422) | |
3833 | #define IS_QLA2432(ha) (DT_MASK(ha) & DT_ISP2432) | |
3834 | #define IS_QLA5422(ha) (DT_MASK(ha) & DT_ISP5422) | |
3835 | #define IS_QLA5432(ha) (DT_MASK(ha) & DT_ISP5432) | |
3836 | #define IS_QLA2532(ha) (DT_MASK(ha) & DT_ISP2532) | |
3837 | #define IS_QLA8432(ha) (DT_MASK(ha) & DT_ISP8432) | |
3a03eb79 | 3838 | #define IS_QLA8001(ha) (DT_MASK(ha) & DT_ISP8001) |
6246b8a1 | 3839 | #define IS_QLA81XX(ha) (IS_QLA8001(ha)) |
a9083016 | 3840 | #define IS_QLA82XX(ha) (DT_MASK(ha) & DT_ISP8021) |
7ec0effd | 3841 | #define IS_QLA8044(ha) (DT_MASK(ha) & DT_ISP8044) |
6246b8a1 GM |
3842 | #define IS_QLA2031(ha) (DT_MASK(ha) & DT_ISP2031) |
3843 | #define IS_QLA8031(ha) (DT_MASK(ha) & DT_ISP8031) | |
8ae6d9c7 | 3844 | #define IS_QLAFX00(ha) (DT_MASK(ha) & DT_ISPFX00) |
f73cb695 | 3845 | #define IS_QLA2071(ha) (DT_MASK(ha) & DT_ISP2071) |
2c5bbbb2 | 3846 | #define IS_QLA2271(ha) (DT_MASK(ha) & DT_ISP2271) |
2b48992f | 3847 | #define IS_QLA2261(ha) (DT_MASK(ha) & DT_ISP2261) |
ecc89f25 JC |
3848 | #define IS_QLA2081(ha) (DT_MASK(ha) & DT_ISP2081) |
3849 | #define IS_QLA2281(ha) (DT_MASK(ha) & DT_ISP2281) | |
7b867cf7 AC |
3850 | |
3851 | #define IS_QLA23XX(ha) (IS_QLA2300(ha) || IS_QLA2312(ha) || IS_QLA2322(ha) || \ | |
3852 | IS_QLA6312(ha) || IS_QLA6322(ha)) | |
3853 | #define IS_QLA24XX(ha) (IS_QLA2422(ha) || IS_QLA2432(ha)) | |
3854 | #define IS_QLA54XX(ha) (IS_QLA5422(ha) || IS_QLA5432(ha)) | |
3855 | #define IS_QLA25XX(ha) (IS_QLA2532(ha)) | |
6246b8a1 | 3856 | #define IS_QLA83XX(ha) (IS_QLA2031(ha) || IS_QLA8031(ha)) |
7b867cf7 | 3857 | #define IS_QLA84XX(ha) (IS_QLA8432(ha)) |
2b48992f | 3858 | #define IS_QLA27XX(ha) (IS_QLA2071(ha) || IS_QLA2271(ha) || IS_QLA2261(ha)) |
ecc89f25 | 3859 | #define IS_QLA28XX(ha) (IS_QLA2081(ha) || IS_QLA2281(ha)) |
7b867cf7 AC |
3860 | #define IS_QLA24XX_TYPE(ha) (IS_QLA24XX(ha) || IS_QLA54XX(ha) || \ |
3861 | IS_QLA84XX(ha)) | |
6246b8a1 | 3862 | #define IS_CNA_CAPABLE(ha) (IS_QLA81XX(ha) || IS_QLA82XX(ha) || \ |
7ec0effd AD |
3863 | IS_QLA8031(ha) || IS_QLA8044(ha)) |
3864 | #define IS_P3P_TYPE(ha) (IS_QLA82XX(ha) || IS_QLA8044(ha)) | |
7b867cf7 | 3865 | #define IS_QLA2XXX_MIDTYPE(ha) (IS_QLA24XX(ha) || IS_QLA84XX(ha) || \ |
a9083016 | 3866 | IS_QLA25XX(ha) || IS_QLA81XX(ha) || \ |
7ec0effd | 3867 | IS_QLA82XX(ha) || IS_QLA83XX(ha) || \ |
ecc89f25 JC |
3868 | IS_QLA8044(ha) || IS_QLA27XX(ha) || \ |
3869 | IS_QLA28XX(ha)) | |
fd564b5d | 3870 | #define IS_MSIX_NACK_CAPABLE(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha) || \ |
ecc89f25 | 3871 | IS_QLA27XX(ha) || IS_QLA28XX(ha)) |
b77ed25c | 3872 | #define IS_NOPOLLING_TYPE(ha) (IS_QLA81XX(ha) && (ha)->flags.msix_enabled) |
f73cb695 | 3873 | #define IS_FAC_REQUIRED(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha) || \ |
ecc89f25 | 3874 | IS_QLA27XX(ha) || IS_QLA28XX(ha)) |
f73cb695 | 3875 | #define IS_NOCACHE_VPD_TYPE(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha) || \ |
ecc89f25 | 3876 | IS_QLA27XX(ha) || IS_QLA28XX(ha)) |
ac280b67 | 3877 | #define IS_ALOGIO_CAPABLE(ha) (IS_QLA23XX(ha) || IS_FWI2_CAPABLE(ha)) |
7b867cf7 | 3878 | |
e02587d7 | 3879 | #define IS_T10_PI_CAPABLE(ha) ((ha)->device_type & DT_T10_PI) |
7b867cf7 AC |
3880 | #define IS_IIDMA_CAPABLE(ha) ((ha)->device_type & DT_IIDMA) |
3881 | #define IS_FWI2_CAPABLE(ha) ((ha)->device_type & DT_FWI2) | |
3882 | #define IS_ZIO_SUPPORTED(ha) ((ha)->device_type & DT_ZIO_SUPPORTED) | |
3883 | #define IS_OEM_001(ha) ((ha)->device_type & DT_OEM_001) | |
3884 | #define HAS_EXTENDED_IDS(ha) ((ha)->device_type & DT_EXTENDED_IDS) | |
6246b8a1 | 3885 | #define IS_CT6_SUPPORTED(ha) ((ha)->device_type & DT_CT6_SUPPORTED) |
f73cb695 | 3886 | #define IS_MQUE_CAPABLE(ha) ((ha)->mqenable || IS_QLA83XX(ha) || \ |
ecc89f25 JC |
3887 | IS_QLA27XX(ha) || IS_QLA28XX(ha)) |
3888 | #define IS_BIDI_CAPABLE(ha) \ | |
3889 | (IS_QLA25XX(ha) || IS_QLA2031(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) | |
81178772 SK |
3890 | /* Bit 21 of fw_attributes decides the MCTP capabilities */ |
3891 | #define IS_MCTP_CAPABLE(ha) (IS_QLA2031(ha) && \ | |
3892 | ((ha)->fw_attributes_ext[0] & BIT_0)) | |
b20f02e1 HM |
3893 | #define IS_PI_UNINIT_CAPABLE(ha) (IS_QLA83XX(ha) || IS_QLA27XX(ha)) |
3894 | #define IS_PI_IPGUARD_CAPABLE(ha) (IS_QLA83XX(ha) || IS_QLA27XX(ha)) | |
9e522cd8 | 3895 | #define IS_PI_DIFB_DIX0_CAPABLE(ha) (0) |
ecc89f25 JC |
3896 | #define IS_PI_SPLIT_DET_CAPABLE_HBA(ha) (IS_QLA83XX(ha) || IS_QLA27XX(ha) || \ |
3897 | IS_QLA28XX(ha)) | |
9e522cd8 AE |
3898 | #define IS_PI_SPLIT_DET_CAPABLE(ha) (IS_PI_SPLIT_DET_CAPABLE_HBA(ha) && \ |
3899 | (((ha)->fw_attributes_h << 16 | (ha)->fw_attributes) & BIT_22)) | |
ecc89f25 JC |
3900 | #define IS_ATIO_MSIX_CAPABLE(ha) (IS_QLA83XX(ha) || IS_QLA27XX(ha) || \ |
3901 | IS_QLA28XX(ha)) | |
33c36c0a | 3902 | #define IS_TGT_MODE_CAPABLE(ha) (ha->tgt.atio_q_length) |
ecc89f25 JC |
3903 | #define IS_SHADOW_REG_CAPABLE(ha) (IS_QLA27XX(ha) || IS_QLA28XX(ha)) |
3904 | #define IS_DPORT_CAPABLE(ha) (IS_QLA83XX(ha) || IS_QLA27XX(ha) || \ | |
3905 | IS_QLA28XX(ha)) | |
3906 | #define IS_FAWWN_CAPABLE(ha) (IS_QLA83XX(ha) || IS_QLA27XX(ha) || \ | |
3907 | IS_QLA28XX(ha)) | |
99e1b683 | 3908 | #define IS_EXCHG_OFFLD_CAPABLE(ha) \ |
ecc89f25 | 3909 | (IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) |
99e1b683 | 3910 | #define IS_EXLOGIN_OFFLD_CAPABLE(ha) \ |
ecc89f25 JC |
3911 | (IS_QLA25XX(ha) || IS_QLA81XX(ha) || IS_QLA83XX(ha) || \ |
3912 | IS_QLA27XX(ha) || IS_QLA28XX(ha)) | |
a4239945 | 3913 | #define USE_ASYNC_SCAN(ha) (IS_QLA25XX(ha) || IS_QLA81XX(ha) ||\ |
ecc89f25 | 3914 | IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) |
1da177e4 LT |
3915 | |
3916 | /* HBA serial number */ | |
3917 | uint8_t serial0; | |
3918 | uint8_t serial1; | |
3919 | uint8_t serial2; | |
3920 | ||
3921 | /* NVRAM configuration data */ | |
7b867cf7 | 3922 | #define MAX_NVRAM_SIZE 4096 |
c1c7178c | 3923 | #define VPD_OFFSET (MAX_NVRAM_SIZE / 2) |
3d71644c | 3924 | uint16_t nvram_size; |
1da177e4 | 3925 | uint16_t nvram_base; |
281afe19 | 3926 | void *nvram; |
6f641790 | 3927 | uint16_t vpd_size; |
3928 | uint16_t vpd_base; | |
281afe19 | 3929 | void *vpd; |
1da177e4 LT |
3930 | |
3931 | uint16_t loop_reset_delay; | |
1da177e4 LT |
3932 | uint8_t retry_count; |
3933 | uint8_t login_timeout; | |
3934 | uint16_t r_a_tov; | |
3935 | int port_down_retry_count; | |
1da177e4 | 3936 | uint8_t mbx_count; |
8ae6d9c7 | 3937 | uint8_t aen_mbx_count; |
b2000805 QT |
3938 | atomic_t num_pend_mbx_stage1; |
3939 | atomic_t num_pend_mbx_stage2; | |
3940 | atomic_t num_pend_mbx_stage3; | |
0eaaca4c | 3941 | uint16_t frame_payload_size; |
1da177e4 | 3942 | |
7b867cf7 | 3943 | uint32_t login_retry_count; |
1da177e4 LT |
3944 | /* SNS command interfaces. */ |
3945 | ms_iocb_entry_t *ms_iocb; | |
3946 | dma_addr_t ms_iocb_dma; | |
3947 | struct ct_sns_pkt *ct_sns; | |
3948 | dma_addr_t ct_sns_dma; | |
3949 | /* SNS command interfaces for 2200. */ | |
3950 | struct sns_cmd_pkt *sns_cmd; | |
3951 | dma_addr_t sns_cmd_dma; | |
3952 | ||
e4e3a2ce | 3953 | #define SFP_DEV_SIZE 512 |
7b867cf7 AC |
3954 | #define SFP_BLOCK_SIZE 64 |
3955 | void *sfp_data; | |
3956 | dma_addr_t sfp_data_dma; | |
88729e53 | 3957 | |
3f006ac3 MH |
3958 | void *flt; |
3959 | dma_addr_t flt_dma; | |
3960 | ||
b5d0329f | 3961 | #define XGMAC_DATA_SIZE 4096 |
ce0423f4 AV |
3962 | void *xgmac_data; |
3963 | dma_addr_t xgmac_data_dma; | |
3964 | ||
b5d0329f | 3965 | #define DCBX_TLV_DATA_SIZE 4096 |
11bbc1d8 AV |
3966 | void *dcbx_tlv; |
3967 | dma_addr_t dcbx_tlv_dma; | |
3968 | ||
39a11240 | 3969 | struct task_struct *dpc_thread; |
1da177e4 LT |
3970 | uint8_t dpc_active; /* DPC routine is active */ |
3971 | ||
1da177e4 LT |
3972 | dma_addr_t gid_list_dma; |
3973 | struct gid_list_info *gid_list; | |
abbd8870 | 3974 | int gid_list_info_size; |
1da177e4 | 3975 | |
fa2a1ce5 | 3976 | /* Small DMA pool allocations -- maximum 256 bytes in length. */ |
7b867cf7 | 3977 | #define DMA_POOL_SIZE 256 |
1da177e4 LT |
3978 | struct dma_pool *s_dma_pool; |
3979 | ||
3980 | dma_addr_t init_cb_dma; | |
3d71644c AV |
3981 | init_cb_t *init_cb; |
3982 | int init_cb_size; | |
b64b0e8f AV |
3983 | dma_addr_t ex_init_cb_dma; |
3984 | struct ex_init_cb_81xx *ex_init_cb; | |
1da177e4 | 3985 | |
5ff1d584 AV |
3986 | void *async_pd; |
3987 | dma_addr_t async_pd_dma; | |
3988 | ||
b0d6cabd HM |
3989 | #define ENABLE_EXTENDED_LOGIN BIT_7 |
3990 | ||
3991 | /* Extended Logins */ | |
3992 | void *exlogin_buf; | |
3993 | dma_addr_t exlogin_buf_dma; | |
3994 | int exlogin_size; | |
3995 | ||
2f56a7f1 HM |
3996 | #define ENABLE_EXCHANGE_OFFLD BIT_2 |
3997 | ||
3998 | /* Exchange Offload */ | |
3999 | void *exchoffld_buf; | |
4000 | dma_addr_t exchoffld_buf_dma; | |
4001 | int exchoffld_size; | |
4002 | int exchoffld_count; | |
4003 | ||
8777e431 QT |
4004 | /* n2n */ |
4005 | struct els_plogi_payload plogi_els_payld; | |
4006 | ||
a4239945 | 4007 | void *swl; |
7a67735b | 4008 | |
1da177e4 | 4009 | /* These are used by mailbox operations. */ |
8ae6d9c7 GM |
4010 | uint16_t mailbox_out[MAILBOX_REGISTER_COUNT]; |
4011 | uint32_t mailbox_out32[MAILBOX_REGISTER_COUNT]; | |
4012 | uint32_t aenmb[AEN_MAILBOX_REGISTER_COUNT_FX00]; | |
1da177e4 LT |
4013 | |
4014 | mbx_cmd_t *mcp; | |
8ae6d9c7 GM |
4015 | struct mbx_cmd_32 *mcp32; |
4016 | ||
1da177e4 | 4017 | unsigned long mbx_cmd_flags; |
7b867cf7 AC |
4018 | #define MBX_INTERRUPT 1 |
4019 | #define MBX_INTR_WAIT 2 | |
1da177e4 LT |
4020 | #define MBX_UPDATE_FLASH_ACTIVE 3 |
4021 | ||
7b867cf7 | 4022 | struct mutex vport_lock; /* Virtual port synchronization */ |
feafb7b1 | 4023 | spinlock_t vport_slock; /* order is hardware_lock, then vport_slock */ |
d7459527 | 4024 | struct mutex mq_lock; /* multi-queue synchronization */ |
7b867cf7 | 4025 | struct completion mbx_cmd_comp; /* Serialize mbx access */ |
0b05a1f0 | 4026 | struct completion mbx_intr_comp; /* Used for completion notification */ |
23f2ebd1 | 4027 | struct completion dcbx_comp; /* For set port config notification */ |
f356bef1 CD |
4028 | struct completion lb_portup_comp; /* Used to wait for link up during |
4029 | * loopback */ | |
4030 | #define DCBX_COMP_TIMEOUT 20 | |
4031 | #define LB_PORTUP_COMP_TIMEOUT 10 | |
4032 | ||
23f2ebd1 | 4033 | int notify_dcbx_comp; |
f356bef1 | 4034 | int notify_lb_portup_comp; |
a9b6f722 | 4035 | struct mutex selflogin_lock; |
1da177e4 | 4036 | |
1da177e4 | 4037 | /* Basic firmware related information. */ |
1da177e4 LT |
4038 | uint16_t fw_major_version; |
4039 | uint16_t fw_minor_version; | |
4040 | uint16_t fw_subminor_version; | |
4041 | uint16_t fw_attributes; | |
6246b8a1 | 4042 | uint16_t fw_attributes_h; |
03aaa89f | 4043 | #define FW_ATTR_H_NVME_FBURST BIT_1 |
171e4909 GM |
4044 | #define FW_ATTR_H_NVME BIT_10 |
4045 | #define FW_ATTR_H_NVME_UPDATED BIT_14 | |
4046 | ||
6246b8a1 | 4047 | uint16_t fw_attributes_ext[2]; |
1da177e4 LT |
4048 | uint32_t fw_memory_size; |
4049 | uint32_t fw_transfer_size; | |
441d1072 AV |
4050 | uint32_t fw_srisc_address; |
4051 | #define RISC_START_ADDRESS_2100 0x1000 | |
4052 | #define RISC_START_ADDRESS_2300 0x800 | |
4053 | #define RISC_START_ADDRESS_2400 0x100000 | |
03e8c680 QT |
4054 | |
4055 | uint16_t orig_fw_tgt_xcb_count; | |
4056 | uint16_t cur_fw_tgt_xcb_count; | |
4057 | uint16_t orig_fw_xcb_count; | |
4058 | uint16_t cur_fw_xcb_count; | |
4059 | uint16_t orig_fw_iocb_count; | |
4060 | uint16_t cur_fw_iocb_count; | |
4061 | uint16_t fw_max_fcf_count; | |
1da177e4 | 4062 | |
f73cb695 CD |
4063 | uint32_t fw_shared_ram_start; |
4064 | uint32_t fw_shared_ram_end; | |
ad1ef177 JC |
4065 | uint32_t fw_ddr_ram_start; |
4066 | uint32_t fw_ddr_ram_end; | |
f73cb695 | 4067 | |
7b867cf7 | 4068 | uint16_t fw_options[16]; /* slots: 1,2,3,10,11 */ |
1da177e4 | 4069 | uint8_t fw_seriallink_options[4]; |
3d71644c | 4070 | uint16_t fw_seriallink_options24[4]; |
1da177e4 | 4071 | |
2a3192a3 | 4072 | uint8_t serdes_version[3]; |
55a96158 | 4073 | uint8_t mpi_version[3]; |
3a03eb79 | 4074 | uint32_t mpi_capabilities; |
55a96158 | 4075 | uint8_t phy_version[3]; |
03aa868c | 4076 | uint8_t pep_version[3]; |
3a03eb79 | 4077 | |
f73cb695 | 4078 | /* Firmware dump template */ |
a28d9e4e JC |
4079 | struct fwdt { |
4080 | void *template; | |
4081 | ulong length; | |
4082 | ulong dump_size; | |
4083 | } fwdt[2]; | |
a7a167bf AV |
4084 | struct qla2xxx_fw_dump *fw_dump; |
4085 | uint32_t fw_dump_len; | |
a4226ec3 | 4086 | u32 fw_dump_alloc_len; |
2a3192a3 JC |
4087 | bool fw_dumped; |
4088 | bool fw_dump_mpi; | |
61f098dd HP |
4089 | unsigned long fw_dump_cap_flags; |
4090 | #define RISC_PAUSE_CMPL 0 | |
4091 | #define DMA_SHUTDOWN_CMPL 1 | |
4092 | #define ISP_RESET_CMPL 2 | |
4093 | #define RISC_RDY_AFT_RESET 3 | |
4094 | #define RISC_SRAM_DUMP_CMPL 4 | |
4095 | #define RISC_EXT_MEM_DUMP_CMPL 5 | |
d14e72fb HM |
4096 | #define ISP_MBX_RDY 6 |
4097 | #define ISP_SOFT_RESET_CMPL 7 | |
1da177e4 | 4098 | int fw_dump_reading; |
edaa5c74 | 4099 | int prev_minidump_failed; |
a7a167bf AV |
4100 | dma_addr_t eft_dma; |
4101 | void *eft; | |
81178772 SK |
4102 | /* Current size of mctp dump is 0x086064 bytes */ |
4103 | #define MCTP_DUMP_SIZE 0x086064 | |
4104 | dma_addr_t mctp_dump_dma; | |
4105 | void *mctp_dump; | |
4106 | int mctp_dumped; | |
4107 | int mctp_dump_reading; | |
bb99de67 | 4108 | uint32_t chain_offset; |
df613b96 AV |
4109 | struct dentry *dfs_dir; |
4110 | struct dentry *dfs_fce; | |
ce1025cd | 4111 | struct dentry *dfs_tgt_counters; |
03e8c680 | 4112 | struct dentry *dfs_fw_resource_cnt; |
ce1025cd | 4113 | |
df613b96 AV |
4114 | dma_addr_t fce_dma; |
4115 | void *fce; | |
4116 | uint32_t fce_bufs; | |
4117 | uint16_t fce_mb[8]; | |
4118 | uint64_t fce_wr, fce_rd; | |
4119 | struct mutex fce_mutex; | |
4120 | ||
3d71644c | 4121 | uint32_t pci_attr; |
a8488abe | 4122 | uint16_t chip_revision; |
1da177e4 LT |
4123 | |
4124 | uint16_t product_id[4]; | |
4125 | ||
4126 | uint8_t model_number[16+1]; | |
1ee27146 | 4127 | char model_desc[80]; |
cca5335c | 4128 | uint8_t adapter_id[16+1]; |
1da177e4 | 4129 | |
854165f4 | 4130 | /* Option ROM information. */ |
4131 | char *optrom_buffer; | |
4132 | uint32_t optrom_size; | |
4133 | int optrom_state; | |
4134 | #define QLA_SWAITING 0 | |
4135 | #define QLA_SREADING 1 | |
4136 | #define QLA_SWRITING 2 | |
b7cc176c JC |
4137 | uint32_t optrom_region_start; |
4138 | uint32_t optrom_region_size; | |
7a8ab9c8 | 4139 | struct mutex optrom_mutex; |
854165f4 | 4140 | |
7b867cf7 | 4141 | /* PCI expansion ROM image information. */ |
30c47662 AV |
4142 | #define ROM_CODE_TYPE_BIOS 0 |
4143 | #define ROM_CODE_TYPE_FCODE 1 | |
4144 | #define ROM_CODE_TYPE_EFI 3 | |
7b867cf7 AC |
4145 | uint8_t bios_revision[2]; |
4146 | uint8_t efi_revision[2]; | |
4147 | uint8_t fcode_revision[16]; | |
30c47662 AV |
4148 | uint32_t fw_revision[4]; |
4149 | ||
0f2d962f MI |
4150 | uint32_t gold_fw_version[4]; |
4151 | ||
3a03eb79 AV |
4152 | /* Offsets for flash/nvram access (set to ~0 if not used). */ |
4153 | uint32_t flash_conf_off; | |
4154 | uint32_t flash_data_off; | |
4155 | uint32_t nvram_conf_off; | |
4156 | uint32_t nvram_data_off; | |
4157 | ||
7d232c74 | 4158 | uint32_t fdt_wrt_disable; |
7ec0effd | 4159 | uint32_t fdt_wrt_enable; |
7d232c74 AV |
4160 | uint32_t fdt_erase_cmd; |
4161 | uint32_t fdt_block_size; | |
4162 | uint32_t fdt_unprotect_sec_cmd; | |
4163 | uint32_t fdt_protect_sec_cmd; | |
7ec0effd | 4164 | uint32_t fdt_wrt_sts_reg_cmd; |
7d232c74 | 4165 | |
5fa8774c JC |
4166 | struct { |
4167 | uint32_t flt_region_flt; | |
4168 | uint32_t flt_region_fdt; | |
4169 | uint32_t flt_region_boot; | |
4170 | uint32_t flt_region_boot_sec; | |
4171 | uint32_t flt_region_fw; | |
4172 | uint32_t flt_region_fw_sec; | |
4173 | uint32_t flt_region_vpd_nvram; | |
4174 | uint32_t flt_region_vpd_nvram_sec; | |
4175 | uint32_t flt_region_vpd; | |
4176 | uint32_t flt_region_vpd_sec; | |
4177 | uint32_t flt_region_nvram; | |
4178 | uint32_t flt_region_nvram_sec; | |
4179 | uint32_t flt_region_npiv_conf; | |
4180 | uint32_t flt_region_gold_fw; | |
4181 | uint32_t flt_region_fcp_prio; | |
4182 | uint32_t flt_region_bootload; | |
4183 | uint32_t flt_region_img_status_pri; | |
4184 | uint32_t flt_region_img_status_sec; | |
4185 | uint32_t flt_region_aux_img_status_pri; | |
4186 | uint32_t flt_region_aux_img_status_sec; | |
4187 | }; | |
4243c115 | 4188 | uint8_t active_image; |
c00d8994 | 4189 | |
1da177e4 | 4190 | /* Needed for BEACON */ |
7b867cf7 AC |
4191 | uint16_t beacon_blink_led; |
4192 | uint8_t beacon_color_state; | |
f6df144c | 4193 | #define QLA_LED_GRN_ON 0x01 |
4194 | #define QLA_LED_YLW_ON 0x02 | |
4195 | #define QLA_LED_ABR_ON 0x04 | |
4196 | #define QLA_LED_ALL_ON 0x07 /* yellow, green, amber. */ | |
4197 | /* ISP2322: red, green, amber. */ | |
7b867cf7 AC |
4198 | uint16_t zio_mode; |
4199 | uint16_t zio_timer; | |
a8488abe | 4200 | |
73208dfd | 4201 | struct qla_msix_entry *msix_entries; |
2c3dfe3f | 4202 | |
7b867cf7 AC |
4203 | struct list_head vp_list; /* list of VP */ |
4204 | unsigned long vp_idx_map[(MAX_MULTI_ID_FABRIC / 8) / | |
4205 | sizeof(unsigned long)]; | |
4206 | uint16_t num_vhosts; /* number of vports created */ | |
4207 | uint16_t num_vsans; /* number of vsan created */ | |
4208 | uint16_t max_npiv_vports; /* 63 or 125 per topoloty */ | |
4209 | int cur_vport_count; | |
4210 | ||
4211 | struct qla_chip_state_84xx *cs84xx; | |
7b867cf7 | 4212 | struct isp_operations *isp_ops; |
68ca949c | 4213 | struct workqueue_struct *wq; |
9a069e19 | 4214 | struct qlfc_fw fw_buf; |
09ff701a SR |
4215 | |
4216 | /* FCP_CMND priority support */ | |
4217 | struct qla_fcp_prio_cfg *fcp_prio_cfg; | |
a9083016 GM |
4218 | |
4219 | struct dma_pool *dl_dma_pool; | |
4220 | #define DSD_LIST_DMA_POOL_SIZE 512 | |
4221 | ||
4222 | struct dma_pool *fcp_cmnd_dma_pool; | |
4223 | mempool_t *ctx_mempool; | |
4224 | #define FCP_CMND_DMA_POOL_SIZE 512 | |
4225 | ||
8dfa4b5a BVA |
4226 | void __iomem *nx_pcibase; /* Base I/O address */ |
4227 | void __iomem *nxdb_rd_ptr; /* Doorbell read pointer */ | |
4228 | void __iomem *nxdb_wr_ptr; /* Door bell write pointer */ | |
a9083016 GM |
4229 | |
4230 | uint32_t crb_win; | |
4231 | uint32_t curr_window; | |
4232 | uint32_t ddr_mn_window; | |
4233 | unsigned long mn_win_crb; | |
4234 | unsigned long ms_win_crb; | |
4235 | int qdr_sn_window; | |
7d613ac6 SV |
4236 | uint32_t fcoe_dev_init_timeout; |
4237 | uint32_t fcoe_reset_timeout; | |
a9083016 GM |
4238 | rwlock_t hw_lock; |
4239 | uint16_t portnum; /* port number */ | |
4240 | int link_width; | |
4241 | struct fw_blob *hablob; | |
4242 | struct qla82xx_legacy_intr_set nx_legacy_intr; | |
4243 | ||
4244 | uint16_t gbl_dsd_inuse; | |
4245 | uint16_t gbl_dsd_avail; | |
4246 | struct list_head gbl_dsd_list; | |
4247 | #define NUM_DSD_CHAIN 4096 | |
9c2b2975 HZ |
4248 | |
4249 | uint8_t fw_type; | |
4250 | __le32 file_prd_off; /* File firmware product offset */ | |
08de2844 GM |
4251 | |
4252 | uint32_t md_template_size; | |
4253 | void *md_tmplt_hdr; | |
4254 | dma_addr_t md_tmplt_hdr_dma; | |
4255 | void *md_dump; | |
4256 | uint32_t md_dump_size; | |
2d70c103 | 4257 | |
5f16b331 | 4258 | void *loop_id_map; |
7d613ac6 SV |
4259 | |
4260 | /* QLA83XX IDC specific fields */ | |
4261 | uint32_t idc_audit_ts; | |
454073c9 | 4262 | uint32_t idc_extend_tmo; |
7d613ac6 SV |
4263 | |
4264 | /* DPC low-priority workqueue */ | |
4265 | struct workqueue_struct *dpc_lp_wq; | |
4266 | struct work_struct idc_aen; | |
4267 | /* DPC high-priority workqueue */ | |
4268 | struct workqueue_struct *dpc_hp_wq; | |
4269 | struct work_struct nic_core_reset; | |
4270 | struct work_struct idc_state_handler; | |
4271 | struct work_struct nic_core_unrecoverable; | |
f3ddac19 | 4272 | struct work_struct board_disable; |
7d613ac6 | 4273 | |
8ae6d9c7 | 4274 | struct mr_data_fx00 mr; |
b2000805 | 4275 | uint32_t chip_reset; |
8ae6d9c7 | 4276 | |
2d70c103 | 4277 | struct qlt_hw_data tgt; |
a1b23c5a | 4278 | int allow_cna_fw_dump; |
1f4c7c38 | 4279 | uint32_t fw_ability_mask; |
72a92df2 JC |
4280 | uint16_t min_supported_speed; |
4281 | uint16_t max_supported_speed; | |
deeae7a6 | 4282 | |
50b81275 GM |
4283 | /* DMA pool for the DIF bundling buffers */ |
4284 | struct dma_pool *dif_bundl_pool; | |
4285 | #define DIF_BUNDLING_DMA_POOL_SIZE 1024 | |
4286 | struct { | |
4287 | struct { | |
4288 | struct list_head head; | |
4289 | uint count; | |
4290 | } good; | |
4291 | struct { | |
4292 | struct list_head head; | |
4293 | uint count; | |
4294 | } unusable; | |
4295 | } pool; | |
4296 | ||
4297 | unsigned long long dif_bundle_crossed_pages; | |
4298 | unsigned long long dif_bundle_reads; | |
4299 | unsigned long long dif_bundle_writes; | |
4300 | unsigned long long dif_bundle_kallocs; | |
4301 | unsigned long long dif_bundle_dma_allocs; | |
4302 | ||
deeae7a6 DG |
4303 | atomic_t nvme_active_aen_cnt; |
4304 | uint16_t nvme_last_rptd_aen; /* Last recorded aen count */ | |
8b4673ba QT |
4305 | |
4306 | atomic_t zio_threshold; | |
4307 | uint16_t last_zio_threshold; | |
5fa8774c | 4308 | |
4825034a | 4309 | #define DEFAULT_ZIO_THRESHOLD 5 |
7b867cf7 AC |
4310 | }; |
4311 | ||
5fa8774c JC |
4312 | struct active_regions { |
4313 | uint8_t global; | |
4314 | struct { | |
4315 | uint8_t board_config; | |
4316 | uint8_t vpd_nvram; | |
4317 | uint8_t npiv_config_0_1; | |
4318 | uint8_t npiv_config_2_3; | |
4319 | } aux; | |
4320 | }; | |
4321 | ||
1f4c7c38 JC |
4322 | #define FW_ABILITY_MAX_SPEED_MASK 0xFUL |
4323 | #define FW_ABILITY_MAX_SPEED_16G 0x0 | |
4324 | #define FW_ABILITY_MAX_SPEED_32G 0x1 | |
4325 | #define FW_ABILITY_MAX_SPEED(ha) \ | |
4326 | (ha->fw_ability_mask & FW_ABILITY_MAX_SPEED_MASK) | |
4327 | ||
4910b524 AG |
4328 | #define QLA_GET_DATA_RATE 0 |
4329 | #define QLA_SET_DATA_RATE_NOLR 1 | |
4330 | #define QLA_SET_DATA_RATE_LR 2 /* Set speed and initiate LR */ | |
4331 | ||
7b867cf7 AC |
4332 | /* |
4333 | * Qlogic scsi host structure | |
4334 | */ | |
4335 | typedef struct scsi_qla_host { | |
4336 | struct list_head list; | |
4337 | struct list_head vp_fcports; /* list of fcports */ | |
4338 | struct list_head work_list; | |
f999f4c1 | 4339 | spinlock_t work_lock; |
ec7193e2 | 4340 | struct work_struct iocb_work; |
f999f4c1 | 4341 | |
7b867cf7 AC |
4342 | /* Commonly used flags and state information. */ |
4343 | struct Scsi_Host *host; | |
4344 | unsigned long host_no; | |
4345 | uint8_t host_str[16]; | |
4346 | ||
4347 | volatile struct { | |
4348 | uint32_t init_done :1; | |
4349 | uint32_t online :1; | |
7b867cf7 AC |
4350 | uint32_t reset_active :1; |
4351 | ||
4352 | uint32_t management_server_logged_in :1; | |
4353 | uint32_t process_response_queue :1; | |
bad75002 | 4354 | uint32_t difdix_supported:1; |
feafb7b1 | 4355 | uint32_t delete_progress:1; |
8ae6d9c7 GM |
4356 | |
4357 | uint32_t fw_tgt_reported:1; | |
969a6199 | 4358 | uint32_t bbcr_enable:1; |
d7459527 | 4359 | uint32_t qpairs_available:1; |
d65237c7 SC |
4360 | uint32_t qpairs_req_created:1; |
4361 | uint32_t qpairs_rsp_created:1; | |
a5d42f4c | 4362 | uint32_t nvme_enabled:1; |
03aaa89f | 4363 | uint32_t nvme_first_burst:1; |
7b867cf7 AC |
4364 | } flags; |
4365 | ||
4366 | atomic_t loop_state; | |
4367 | #define LOOP_TIMEOUT 1 | |
4368 | #define LOOP_DOWN 2 | |
4369 | #define LOOP_UP 3 | |
4370 | #define LOOP_UPDATE 4 | |
4371 | #define LOOP_READY 5 | |
4372 | #define LOOP_DEAD 6 | |
4373 | ||
4005a995 | 4374 | unsigned long relogin_jif; |
7b867cf7 AC |
4375 | unsigned long dpc_flags; |
4376 | #define RESET_MARKER_NEEDED 0 /* Send marker to ISP. */ | |
4377 | #define RESET_ACTIVE 1 | |
4378 | #define ISP_ABORT_NEEDED 2 /* Initiate ISP abort. */ | |
4379 | #define ABORT_ISP_ACTIVE 3 /* ISP abort in progress. */ | |
4380 | #define LOOP_RESYNC_NEEDED 4 /* Device Resync needed. */ | |
4381 | #define LOOP_RESYNC_ACTIVE 5 | |
4382 | #define LOCAL_LOOP_UPDATE 6 /* Perform a local loop update. */ | |
4383 | #define RSCN_UPDATE 7 /* Perform an RSCN update. */ | |
ddb9b126 SS |
4384 | #define RELOGIN_NEEDED 8 |
4385 | #define REGISTER_FC4_NEEDED 9 /* SNS FC4 registration required. */ | |
4386 | #define ISP_ABORT_RETRY 10 /* ISP aborted. */ | |
4387 | #define BEACON_BLINK_NEEDED 11 | |
4388 | #define REGISTER_FDMI_NEEDED 12 | |
4389 | #define FCPORT_UPDATE_NEEDED 13 | |
4390 | #define VP_DPC_NEEDED 14 /* wake up for VP dpc handling */ | |
4391 | #define UNLOADING 15 | |
4392 | #define NPIV_CONFIG_NEEDED 16 | |
a9083016 GM |
4393 | #define ISP_UNRECOVERABLE 17 |
4394 | #define FCOE_CTX_RESET_NEEDED 18 /* Initiate FCoE context reset */ | |
b1d46989 | 4395 | #define MPI_RESET_NEEDED 19 /* Initiate MPI FW reset */ |
579d12b5 | 4396 | #define ISP_QUIESCE_NEEDED 20 /* Driver need some quiescence */ |
48acad09 | 4397 | #define N2N_LINK_RESET 21 |
50280c01 CD |
4398 | #define PORT_UPDATE_NEEDED 22 |
4399 | #define FX00_RESET_RECOVERY 23 | |
4400 | #define FX00_TARGET_SCAN 24 | |
4401 | #define FX00_CRITEMP_RECOVERY 25 | |
e8f5e95d | 4402 | #define FX00_HOST_INFO_RESEND 26 |
d7459527 | 4403 | #define QPAIR_ONLINE_CHECK_NEEDED 27 |
8b4673ba | 4404 | #define SET_NVME_ZIO_THRESHOLD_NEEDED 28 |
e4e3a2ce | 4405 | #define DETECT_SFP_CHANGE 29 |
c0c462c8 | 4406 | #define N2N_LOGIN_NEEDED 30 |
9b3e0f4d | 4407 | #define IOCB_WORK_ACTIVE 31 |
8b4673ba | 4408 | #define SET_ZIO_THRESHOLD_NEEDED 32 |
3f006ac3 | 4409 | #define ISP_ABORT_TO_ROM 33 |
7b867cf7 | 4410 | |
232792b6 JL |
4411 | unsigned long pci_flags; |
4412 | #define PFLG_DISCONNECTED 0 /* PCI device removed */ | |
beb9e315 | 4413 | #define PFLG_DRIVER_REMOVING 1 /* PCI driver .remove */ |
6b383979 | 4414 | #define PFLG_DRIVER_PROBING 2 /* PCI driver .probe */ |
232792b6 | 4415 | |
7b867cf7 | 4416 | uint32_t device_flags; |
ddb9b126 SS |
4417 | #define SWITCH_FOUND BIT_0 |
4418 | #define DFLG_NO_CABLE BIT_1 | |
a9083016 | 4419 | #define DFLG_DEV_FAILED BIT_5 |
7b867cf7 | 4420 | |
7b867cf7 AC |
4421 | /* ISP configuration data. */ |
4422 | uint16_t loop_id; /* Host adapter loop id */ | |
a9b6f722 SK |
4423 | uint16_t self_login_loop_id; /* host adapter loop id |
4424 | * get it on self login | |
4425 | */ | |
4426 | fc_port_t bidir_fcport; /* fcport used for bidir cmnds | |
4427 | * no need of allocating it for | |
4428 | * each command | |
4429 | */ | |
7b867cf7 AC |
4430 | |
4431 | port_id_t d_id; /* Host adapter port id */ | |
4432 | uint8_t marker_needed; | |
4433 | uint16_t mgmt_svr_loop_id; | |
4434 | ||
4435 | ||
4436 | ||
7b867cf7 AC |
4437 | /* Timeout timers. */ |
4438 | uint8_t loop_down_abort_time; /* port down timer */ | |
4439 | atomic_t loop_down_timer; /* loop down timer */ | |
4440 | uint8_t link_down_timeout; /* link down timeout */ | |
4441 | ||
4442 | uint32_t timer_active; | |
4443 | struct timer_list timer; | |
4444 | ||
4445 | uint8_t node_name[WWN_SIZE]; | |
4446 | uint8_t port_name[WWN_SIZE]; | |
4447 | uint8_t fabric_node_name[WWN_SIZE]; | |
bad7001c | 4448 | |
a5d42f4c | 4449 | struct nvme_fc_local_port *nvme_local_port; |
5621b0dd | 4450 | struct completion nvme_del_done; |
a5d42f4c | 4451 | |
bad7001c AV |
4452 | uint16_t fcoe_vlan_id; |
4453 | uint16_t fcoe_fcf_idx; | |
4454 | uint8_t fcoe_vn_port_mac[6]; | |
4455 | ||
8b2f5ff3 SN |
4456 | /* list of commands waiting on workqueue */ |
4457 | struct list_head qla_cmd_list; | |
4458 | struct list_head qla_sess_op_cmd_list; | |
41dc529a | 4459 | struct list_head unknown_atio_list; |
8b2f5ff3 | 4460 | spinlock_t cmd_list_lock; |
41dc529a | 4461 | struct delayed_work unknown_atio_work; |
8b2f5ff3 | 4462 | |
df673274 AP |
4463 | /* Counter to detect races between ELS and RSCN events */ |
4464 | atomic_t generation_tick; | |
4465 | /* Time when global fcport update has been scheduled */ | |
4466 | int total_fcport_update_gen; | |
71cdc079 AP |
4467 | /* List of pending LOGOs, protected by tgt_mutex */ |
4468 | struct list_head logo_list; | |
b7bd104e AP |
4469 | /* List of pending PLOGI acks, protected by hw lock */ |
4470 | struct list_head plogi_ack_list; | |
df673274 | 4471 | |
d7459527 MH |
4472 | struct list_head qp_list; |
4473 | ||
7ec0effd | 4474 | uint32_t vp_abort_cnt; |
7b867cf7 | 4475 | |
2c3dfe3f | 4476 | struct fc_vport *fc_vport; /* holds fc_vport * for each vport */ |
2c3dfe3f | 4477 | uint16_t vp_idx; /* vport ID */ |
d7459527 | 4478 | struct qla_qpair *qpair; /* base qpair */ |
2c3dfe3f | 4479 | |
2c3dfe3f | 4480 | unsigned long vp_flags; |
2c3dfe3f SJ |
4481 | #define VP_IDX_ACQUIRED 0 /* bit no 0 */ |
4482 | #define VP_CREATE_NEEDED 1 | |
4483 | #define VP_BIND_NEEDED 2 | |
4484 | #define VP_DELETE_NEEDED 3 | |
4485 | #define VP_SCR_NEEDED 4 /* State Change Request registration */ | |
ded6411f | 4486 | #define VP_CONFIG_OK 5 /* Flag to cfg VP, if FW is ready */ |
2c3dfe3f SJ |
4487 | atomic_t vp_state; |
4488 | #define VP_OFFLINE 0 | |
4489 | #define VP_ACTIVE 1 | |
4490 | #define VP_FAILED 2 | |
4491 | // #define VP_DISABLE 3 | |
4492 | uint16_t vp_err_state; | |
4493 | uint16_t vp_prev_err_state; | |
4494 | #define VP_ERR_UNKWN 0 | |
4495 | #define VP_ERR_PORTDWN 1 | |
4496 | #define VP_ERR_FAB_UNSUPPORTED 2 | |
4497 | #define VP_ERR_FAB_NORESOURCES 3 | |
4498 | #define VP_ERR_FAB_LOGOUT 4 | |
4499 | #define VP_ERR_ADAP_NORESOURCES 5 | |
7b867cf7 | 4500 | struct qla_hw_data *hw; |
0e8cd71c | 4501 | struct scsi_qlt_host vha_tgt; |
2afa19a9 | 4502 | struct req_que *req; |
a9083016 GM |
4503 | int fw_heartbeat_counter; |
4504 | int seconds_since_last_heartbeat; | |
2be21fa2 SK |
4505 | struct fc_host_statistics fc_host_stat; |
4506 | struct qla_statistics qla_stats; | |
a9b6f722 | 4507 | struct bidi_statistics bidi_stats; |
feafb7b1 | 4508 | atomic_t vref_count; |
7ec0effd | 4509 | struct qla8044_reset_template reset_tmplt; |
969a6199 | 4510 | uint16_t bbcr; |
0645cb83 QT |
4511 | |
4512 | uint16_t u_ql2xexchoffld; | |
4513 | uint16_t u_ql2xiniexchg; | |
4514 | uint16_t qlini_mode; | |
4515 | uint16_t ql2xexchoffld; | |
4516 | uint16_t ql2xiniexchg; | |
4517 | ||
726b8548 QT |
4518 | struct name_list_extended gnl; |
4519 | /* Count of active session/fcport */ | |
4520 | int fcport_count; | |
4521 | wait_queue_head_t fcport_waitQ; | |
c4a9b538 | 4522 | wait_queue_head_t vref_waitq; |
72a92df2 | 4523 | uint8_t min_supported_speed; |
edd05de1 DG |
4524 | uint8_t n2n_node_name[WWN_SIZE]; |
4525 | uint8_t n2n_port_name[WWN_SIZE]; | |
4526 | uint16_t n2n_id; | |
2d73ac61 | 4527 | struct list_head gpnid_list; |
a4239945 | 4528 | struct fab_scan scan; |
f0783d43 ML |
4529 | |
4530 | unsigned int irq_offset; | |
1da177e4 LT |
4531 | } scsi_qla_host_t; |
4532 | ||
4243c115 SC |
4533 | struct qla27xx_image_status { |
4534 | uint8_t image_status_mask; | |
f8f97b0c | 4535 | uint16_t generation; |
4243c115 | 4536 | uint8_t ver_major; |
5fa8774c JC |
4537 | uint8_t ver_minor; |
4538 | uint8_t bitmap; /* 28xx only */ | |
4539 | uint8_t reserved[2]; | |
4243c115 SC |
4540 | uint32_t checksum; |
4541 | uint32_t signature; | |
4542 | } __packed; | |
4543 | ||
5fa8774c JC |
4544 | /* 28xx aux image status bimap values */ |
4545 | #define QLA28XX_AUX_IMG_BOARD_CONFIG BIT_0 | |
4546 | #define QLA28XX_AUX_IMG_VPD_NVRAM BIT_1 | |
4547 | #define QLA28XX_AUX_IMG_NPIV_CONFIG_0_1 BIT_2 | |
4548 | #define QLA28XX_AUX_IMG_NPIV_CONFIG_2_3 BIT_3 | |
4549 | ||
2d70c103 NB |
4550 | #define SET_VP_IDX 1 |
4551 | #define SET_AL_PA 2 | |
4552 | #define RESET_VP_IDX 3 | |
4553 | #define RESET_AL_PA 4 | |
4554 | struct qla_tgt_vp_map { | |
4555 | uint8_t idx; | |
4556 | scsi_qla_host_t *vha; | |
4557 | }; | |
4558 | ||
d7459527 MH |
4559 | struct qla2_sgx { |
4560 | dma_addr_t dma_addr; /* OUT */ | |
4561 | uint32_t dma_len; /* OUT */ | |
4562 | ||
4563 | uint32_t tot_bytes; /* IN */ | |
4564 | struct scatterlist *cur_sg; /* IN */ | |
4565 | ||
4566 | /* for book keeping, bzero on initial invocation */ | |
4567 | uint32_t bytes_consumed; | |
4568 | uint32_t num_bytes; | |
4569 | uint32_t tot_partial; | |
4570 | ||
4571 | /* for debugging */ | |
4572 | uint32_t num_sg; | |
4573 | srb_t *sp; | |
4574 | }; | |
4575 | ||
4b60c827 QT |
4576 | #define QLA_FW_STARTED(_ha) { \ |
4577 | int i; \ | |
4578 | _ha->flags.fw_started = 1; \ | |
4579 | _ha->base_qpair->fw_started = 1; \ | |
4580 | for (i = 0; i < _ha->max_qpairs; i++) { \ | |
4581 | if (_ha->queue_pair_map[i]) \ | |
4582 | _ha->queue_pair_map[i]->fw_started = 1; \ | |
4583 | } \ | |
4584 | } | |
4585 | ||
4586 | #define QLA_FW_STOPPED(_ha) { \ | |
4587 | int i; \ | |
4588 | _ha->flags.fw_started = 0; \ | |
4589 | _ha->base_qpair->fw_started = 0; \ | |
4590 | for (i = 0; i < _ha->max_qpairs; i++) { \ | |
4591 | if (_ha->queue_pair_map[i]) \ | |
4592 | _ha->queue_pair_map[i]->fw_started = 0; \ | |
4593 | } \ | |
4594 | } | |
4595 | ||
3f006ac3 MH |
4596 | |
4597 | #define SFUB_CHECKSUM_SIZE 4 | |
4598 | ||
4599 | struct secure_flash_update_block { | |
4600 | uint32_t block_info; | |
4601 | uint32_t signature_lo; | |
4602 | uint32_t signature_hi; | |
4603 | uint32_t signature_upper[0x3e]; | |
4604 | }; | |
4605 | ||
4606 | struct secure_flash_update_block_pk { | |
4607 | uint32_t block_info; | |
4608 | uint32_t signature_lo; | |
4609 | uint32_t signature_hi; | |
4610 | uint32_t signature_upper[0x3e]; | |
4611 | uint32_t public_key[0x41]; | |
4612 | }; | |
4613 | ||
1da177e4 LT |
4614 | /* |
4615 | * Macros to help code, maintain, etc. | |
4616 | */ | |
4617 | #define LOOP_TRANSITION(ha) \ | |
4618 | (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \ | |
23443b1d | 4619 | test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \ |
1da177e4 | 4620 | atomic_read(&ha->loop_state) == LOOP_DOWN) |
fa2a1ce5 | 4621 | |
8ae6d9c7 GM |
4622 | #define STATE_TRANSITION(ha) \ |
4623 | (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \ | |
4624 | test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) | |
4625 | ||
d7459527 MH |
4626 | #define QLA_VHA_MARK_BUSY(__vha, __bail) do { \ |
4627 | atomic_inc(&__vha->vref_count); \ | |
4628 | mb(); \ | |
4629 | if (__vha->flags.delete_progress) { \ | |
4630 | atomic_dec(&__vha->vref_count); \ | |
c4a9b538 | 4631 | wake_up(&__vha->vref_waitq); \ |
d7459527 MH |
4632 | __bail = 1; \ |
4633 | } else { \ | |
4634 | __bail = 0; \ | |
4635 | } \ | |
feafb7b1 AE |
4636 | } while (0) |
4637 | ||
c4a9b538 | 4638 | #define QLA_VHA_MARK_NOT_BUSY(__vha) do { \ |
d7459527 | 4639 | atomic_dec(&__vha->vref_count); \ |
c4a9b538 JC |
4640 | wake_up(&__vha->vref_waitq); \ |
4641 | } while (0) \ | |
d7459527 MH |
4642 | |
4643 | #define QLA_QPAIR_MARK_BUSY(__qpair, __bail) do { \ | |
4644 | atomic_inc(&__qpair->ref_count); \ | |
4645 | mb(); \ | |
4646 | if (__qpair->delete_in_progress) { \ | |
4647 | atomic_dec(&__qpair->ref_count); \ | |
4648 | __bail = 1; \ | |
4649 | } else { \ | |
4650 | __bail = 0; \ | |
4651 | } \ | |
feafb7b1 AE |
4652 | } while (0) |
4653 | ||
d7459527 MH |
4654 | #define QLA_QPAIR_MARK_NOT_BUSY(__qpair) \ |
4655 | atomic_dec(&__qpair->ref_count); \ | |
4656 | ||
7c3f8fd1 QT |
4657 | |
4658 | #define QLA_ENA_CONF(_ha) {\ | |
4659 | int i;\ | |
4660 | _ha->base_qpair->enable_explicit_conf = 1; \ | |
4661 | for (i = 0; i < _ha->max_qpairs; i++) { \ | |
4662 | if (_ha->queue_pair_map[i]) \ | |
4663 | _ha->queue_pair_map[i]->enable_explicit_conf = 1; \ | |
4664 | } \ | |
4665 | } | |
4666 | ||
4667 | #define QLA_DIS_CONF(_ha) {\ | |
4668 | int i;\ | |
4669 | _ha->base_qpair->enable_explicit_conf = 0; \ | |
4670 | for (i = 0; i < _ha->max_qpairs; i++) { \ | |
4671 | if (_ha->queue_pair_map[i]) \ | |
4672 | _ha->queue_pair_map[i]->enable_explicit_conf = 0; \ | |
4673 | } \ | |
4674 | } | |
4675 | ||
1da177e4 LT |
4676 | /* |
4677 | * qla2x00 local function return status codes | |
4678 | */ | |
4679 | #define MBS_MASK 0x3fff | |
4680 | ||
4681 | #define QLA_SUCCESS (MBS_COMMAND_COMPLETE & MBS_MASK) | |
4682 | #define QLA_INVALID_COMMAND (MBS_INVALID_COMMAND & MBS_MASK) | |
4683 | #define QLA_INTERFACE_ERROR (MBS_HOST_INTERFACE_ERROR & MBS_MASK) | |
4684 | #define QLA_TEST_FAILED (MBS_TEST_FAILED & MBS_MASK) | |
4685 | #define QLA_COMMAND_ERROR (MBS_COMMAND_ERROR & MBS_MASK) | |
4686 | #define QLA_PARAMETER_ERROR (MBS_COMMAND_PARAMETER_ERROR & MBS_MASK) | |
4687 | #define QLA_PORT_ID_USED (MBS_PORT_ID_USED & MBS_MASK) | |
4688 | #define QLA_LOOP_ID_USED (MBS_LOOP_ID_USED & MBS_MASK) | |
4689 | #define QLA_ALL_IDS_IN_USE (MBS_ALL_IDS_IN_USE & MBS_MASK) | |
4690 | #define QLA_NOT_LOGGED_IN (MBS_NOT_LOGGED_IN & MBS_MASK) | |
4691 | ||
4692 | #define QLA_FUNCTION_TIMEOUT 0x100 | |
4693 | #define QLA_FUNCTION_PARAMETER_ERROR 0x101 | |
4694 | #define QLA_FUNCTION_FAILED 0x102 | |
4695 | #define QLA_MEMORY_ALLOC_FAILED 0x103 | |
4696 | #define QLA_LOCK_TIMEOUT 0x104 | |
4697 | #define QLA_ABORTED 0x105 | |
4698 | #define QLA_SUSPENDED 0x106 | |
4699 | #define QLA_BUSY 0x107 | |
cca5335c | 4700 | #define QLA_ALREADY_REGISTERED 0x109 |
0c6df590 | 4701 | #define QLA_OS_TIMER_EXPIRED 0x10a |
1da177e4 | 4702 | |
1da177e4 LT |
4703 | #define NVRAM_DELAY() udelay(10) |
4704 | ||
1da177e4 LT |
4705 | /* |
4706 | * Flash support definitions | |
4707 | */ | |
854165f4 | 4708 | #define OPTROM_SIZE_2300 0x20000 |
4709 | #define OPTROM_SIZE_2322 0x100000 | |
4710 | #define OPTROM_SIZE_24XX 0x100000 | |
c3a2f0df | 4711 | #define OPTROM_SIZE_25XX 0x200000 |
3a03eb79 | 4712 | #define OPTROM_SIZE_81XX 0x400000 |
a9083016 | 4713 | #define OPTROM_SIZE_82XX 0x800000 |
6246b8a1 | 4714 | #define OPTROM_SIZE_83XX 0x1000000 |
ecc89f25 | 4715 | #define OPTROM_SIZE_28XX 0x2000000 |
a9083016 GM |
4716 | |
4717 | #define OPTROM_BURST_SIZE 0x1000 | |
4718 | #define OPTROM_BURST_DWORDS (OPTROM_BURST_SIZE / 4) | |
1da177e4 | 4719 | |
bad75002 AE |
4720 | #define QLA_DSDS_PER_IOCB 37 |
4721 | ||
4d78c973 GM |
4722 | #define CMD_SP(Cmnd) ((Cmnd)->SCp.ptr) |
4723 | ||
58548cb5 GM |
4724 | #define QLA_SG_ALL 1024 |
4725 | ||
4d78c973 GM |
4726 | enum nexus_wait_type { |
4727 | WAIT_HOST = 0, | |
4728 | WAIT_TARGET, | |
4729 | WAIT_LUN, | |
4730 | }; | |
4731 | ||
e4e3a2ce QT |
4732 | /* Refer to SNIA SFF 8247 */ |
4733 | struct sff_8247_a0 { | |
4734 | u8 txid; /* transceiver id */ | |
4735 | u8 ext_txid; | |
4736 | u8 connector; | |
4737 | /* compliance code */ | |
4738 | u8 eth_infi_cc3; /* ethernet, inifiband */ | |
4739 | u8 sonet_cc4[2]; | |
4740 | u8 eth_cc6; | |
4741 | /* link length */ | |
4742 | #define FC_LL_VL BIT_7 /* very long */ | |
4743 | #define FC_LL_S BIT_6 /* Short */ | |
4744 | #define FC_LL_I BIT_5 /* Intermidiate*/ | |
4745 | #define FC_LL_L BIT_4 /* Long */ | |
4746 | #define FC_LL_M BIT_3 /* Medium */ | |
4747 | #define FC_LL_SA BIT_2 /* ShortWave laser */ | |
4748 | #define FC_LL_LC BIT_1 /* LongWave laser */ | |
4749 | #define FC_LL_EL BIT_0 /* Electrical inter enclosure */ | |
4750 | u8 fc_ll_cc7; | |
4751 | /* FC technology */ | |
4752 | #define FC_TEC_EL BIT_7 /* Electrical inter enclosure */ | |
4753 | #define FC_TEC_SN BIT_6 /* short wave w/o OFC */ | |
4754 | #define FC_TEC_SL BIT_5 /* short wave with OFC */ | |
4755 | #define FC_TEC_LL BIT_4 /* Longwave Laser */ | |
4756 | #define FC_TEC_ACT BIT_3 /* Active cable */ | |
4757 | #define FC_TEC_PAS BIT_2 /* Passive cable */ | |
4758 | u8 fc_tec_cc8; | |
4759 | /* Transmission Media */ | |
4760 | #define FC_MED_TW BIT_7 /* Twin Ax */ | |
4761 | #define FC_MED_TP BIT_6 /* Twited Pair */ | |
4762 | #define FC_MED_MI BIT_5 /* Min Coax */ | |
4763 | #define FC_MED_TV BIT_4 /* Video Coax */ | |
4764 | #define FC_MED_M6 BIT_3 /* Multimode, 62.5um */ | |
4765 | #define FC_MED_M5 BIT_2 /* Multimode, 50um */ | |
4766 | #define FC_MED_SM BIT_0 /* Single Mode */ | |
4767 | u8 fc_med_cc9; | |
4768 | /* speed FC_SP_12: 12*100M = 1200 MB/s */ | |
4769 | #define FC_SP_12 BIT_7 | |
4770 | #define FC_SP_8 BIT_6 | |
4771 | #define FC_SP_16 BIT_5 | |
4772 | #define FC_SP_4 BIT_4 | |
4773 | #define FC_SP_32 BIT_3 | |
4774 | #define FC_SP_2 BIT_2 | |
4775 | #define FC_SP_1 BIT_0 | |
4776 | u8 fc_sp_cc10; | |
4777 | u8 encode; | |
4778 | u8 bitrate; | |
4779 | u8 rate_id; | |
4780 | u8 length_km; /* offset 14/eh */ | |
4781 | u8 length_100m; | |
4782 | u8 length_50um_10m; | |
4783 | u8 length_62um_10m; | |
4784 | u8 length_om4_10m; | |
4785 | u8 length_om3_10m; | |
4786 | #define SFF_VEN_NAME_LEN 16 | |
4787 | u8 vendor_name[SFF_VEN_NAME_LEN]; /* offset 20/14h */ | |
4788 | u8 tx_compat; | |
4789 | u8 vendor_oui[3]; | |
4790 | #define SFF_PART_NAME_LEN 16 | |
4791 | u8 vendor_pn[SFF_PART_NAME_LEN]; /* part number */ | |
4792 | u8 vendor_rev[4]; | |
4793 | u8 wavelength[2]; | |
4794 | u8 resv; | |
4795 | u8 cc_base; | |
4796 | u8 options[2]; /* offset 64 */ | |
4797 | u8 br_max; | |
4798 | u8 br_min; | |
4799 | u8 vendor_sn[16]; | |
4800 | u8 date_code[8]; | |
4801 | u8 diag; | |
4802 | u8 enh_options; | |
4803 | u8 sff_revision; | |
4804 | u8 cc_ext; | |
4805 | u8 vendor_specific[32]; | |
4806 | u8 resv2[128]; | |
4807 | }; | |
4808 | ||
4809 | #define AUTO_DETECT_SFP_SUPPORT(_vha)\ | |
4810 | (ql2xautodetectsfp && !_vha->vp_idx && \ | |
4811 | (IS_QLA25XX(_vha->hw) || IS_QLA81XX(_vha->hw) ||\ | |
ecc89f25 JC |
4812 | IS_QLA83XX(_vha->hw) || IS_QLA27XX(_vha->hw) || \ |
4813 | IS_QLA28XX(_vha->hw))) | |
e4e3a2ce | 4814 | |
3f006ac3 MH |
4815 | #define FLASH_SEMAPHORE_REGISTER_ADDR 0x00101016 |
4816 | ||
09620eeb | 4817 | #define USER_CTRL_IRQ(_ha) (ql2xuctrlirq && QLA_TGT_MODE_ENABLED() && \ |
ecc89f25 | 4818 | (IS_QLA27XX(_ha) || IS_QLA28XX(_ha) || IS_QLA83XX(_ha))) |
09620eeb | 4819 | |
9cd883f0 QT |
4820 | #define SAVE_TOPO(_ha) { \ |
4821 | if (_ha->current_topology) \ | |
4822 | _ha->prev_topology = _ha->current_topology; \ | |
4823 | } | |
4824 | ||
4825 | #define N2N_TOPO(ha) \ | |
4826 | ((ha->prev_topology == ISP_CFG_N && !ha->current_topology) || \ | |
4827 | ha->current_topology == ISP_CFG_N || \ | |
4828 | !ha->current_topology) | |
4829 | ||
c5419e26 | 4830 | #include "qla_target.h" |
1da177e4 LT |
4831 | #include "qla_gbl.h" |
4832 | #include "qla_dbg.h" | |
4833 | #include "qla_inline.h" | |
1da177e4 | 4834 | #endif |