xref: /linux/drivers/scsi/qla2xxx/qla_fw29.h (revision 67f8bc848ee31831336bd478e57d2f993551902e)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * QLogic Fibre Channel HBA Driver
4  * Copyright (c)  2026- Marvell.
5  *
6  * See LICENSE.qla2xxx for copyright and licensing details.
7  */
8 #ifndef __QLA_FW29_H
9 #define __QLA_FW29_H
10 
11 #include "qla_fw.h"
12 
13 /* Control Flags 2 common for cmd6 and 7 */
14 #define CF2_VMID_ENABLE			BIT_0
15 #define CF2_CSCTL_PRIORITY_TAG		BIT_1
16 #define CF2_NO_TRNF_READY_ENABLE	BIT_2
17 #define CF2_RX_ID_ENABLE		BIT_3
18 
19 /*
20  * vp_index layout for 29xx extended command IOCBs
21  * (cmd_type_6_ext, cmd_type_7_ext, cmd_type_crc_2_ext, ...):
22  *   bits [8:0]   - VP index (9 bits)
23  *   bits [15:9]  - reserved, must be zero
24  * Access on a host-endian value via le16_to_cpu(vp_index) & CMD_EXT_VP_INDEX_MASK.
25  */
26 #define CMD_EXT_VP_INDEX_MASK		0x01ff
27 
28 /*
29  * Combined vp_index/sof_type field layout (used by ELS and ABTS ext IOCBs):
30  *   bits [8:0]   - VP index (9 bits)
31  *   bits [11:9]  - reserved
32  *   bits [15:12] - SOF type (4 bits)
33  */
34 #define EXT_VP_SOF_VP_INDEX_MASK	0x01ff
35 #define EXT_VP_SOF_SOF_TYPE_SHIFT	12
36 #define EXT_VP_SOF_SOF_TYPE_MASK	0xf000
37 
38 static inline u16 qla_ext_get_vp_index(__le16 vp_sof)
39 {
40 	return le16_to_cpu(vp_sof) & EXT_VP_SOF_VP_INDEX_MASK;
41 }
42 
43 static inline u16 qla_ext_get_sof_type(__le16 vp_sof)
44 {
45 	return (le16_to_cpu(vp_sof) >> EXT_VP_SOF_SOF_TYPE_SHIFT) & 0xf;
46 }
47 
48 static inline __le16 qla_ext_build_vp_sof(u16 vp_idx, u16 sof_type)
49 {
50 	return cpu_to_le16((vp_idx & EXT_VP_SOF_VP_INDEX_MASK) |
51 			   ((sof_type & 0xf) << EXT_VP_SOF_SOF_TYPE_SHIFT));
52 }
53 
54 /*
55  * Combined vp_idx/vp_status field layout (vp_rpt_id_entry_24xx_ext):
56  *   bits [8:0]   - VP index (9 bits)
57  *   bits [15:9]  - VP status (7 bits)
58  */
59 #define EXT_VP_STATUS_VP_INDEX_MASK	0x01ff
60 #define EXT_VP_STATUS_VP_STATUS_SHIFT	9
61 #define EXT_VP_STATUS_VP_STATUS_MASK	0xfe00
62 
63 /*
64  * ISP queue - command entry structure definition.
65  */
66 #define NUM_CMD67_DSDS	4
67 struct cmd_type_6_ext {
68 	uint8_t entry_type;		/* Entry type. */
69 	uint8_t entry_count;		/* Entry count. */
70 	uint8_t sys_define;		/* System defined. */
71 	uint8_t entry_status;		/* Entry Status. */
72 
73 	uint32_t handle;		/* System handle. */
74 
75 	__le16	nport_handle;		/* N_PORT handle. */
76 	__le16	timeout;		/* Command timeout. */
77 
78 	__le16	dseg_count;		/* Data segment count. */
79 
80 	__le16	fcp_rsp_dsd_len;	/* FCP_RSP DSD length. */
81 
82 	struct scsi_lun lun;		/* FCP LUN (BE). */
83 
84 	__le16	control_flags;		/* Control flags. */
85 
86 	__le16	fcp_cmnd_dseg_len;	/* Data segment length. */
87 					/* Data segment address. */
88 	__le64	 fcp_cmnd_dseg_address __packed;
89 					/* Data segment address. */
90 	__le64	 fcp_rsp_dseg_address __packed;
91 
92 	__le32	byte_count;		/* Total byte count. */
93 	__le16	control_flags_2;		/* Control flags 2. */
94 
95 	__le16	vp_index;		/* VP Index 9bits*/
96 	__le32	fburstlen_rxid;		/* First Burst length/RX ID */
97 	__le16 io_tag;			/* I/O Tag */
98 	uint8_t vl_n_fctl;		/* VL (7-4) | RSVD (3-2) | F_CTL [17] (1) | RSVD (0) */
99 	uint8_t prtag_csctl;		/* Priority Tag or CS_CTL */
100 	__le32	src_vm_id;		/* Source VM ID */
101 	uint8_t reserved_2[16];		/* Reserved */
102 	struct dsd64 dsd[NUM_CMD67_DSDS];		/* Data Segment Descriptors */
103 };
104 
105 struct cmd_type_7_ext {
106 	uint8_t entry_type;		/* Entry type. */
107 	uint8_t entry_count;		/* Entry count. */
108 	uint8_t sys_define;		/* System defined. */
109 	uint8_t entry_status;		/* Entry Status. */
110 	uint32_t handle;		/* System handle. */
111 	__le16	nport_handle;		/* N_PORT handle. */
112 	__le16	timeout;		/* Command timeout. */
113 
114 	__le16	dseg_count;		/* Data segment count. */
115 	uint16_t reserved_1;
116 
117 	struct scsi_lun lun;		/* FCP LUN (BE). */
118 
119 	__le16	task_mgmt_flags;	/* Task management flags. */
120 
121 	uint8_t task;
122 	uint8_t crn;
123 	uint8_t fcp_cdb[MAX_CMDSZ];	/* SCSI command words. */
124 	__le32	byte_count;		/* Total byte count. */
125 	__le16	ctrl_flags_2;		/* Control flags 2 */
126 	__le16	vp_index;		/* VP Index 9bits*/
127 	__le32	rx_id;			/* Receive Exchange ID */
128 	__le16	io_tag;			/* I/O Tag */
129 	uint8_t vl_n_fctl;		/* VL (7-4) | RSVD (3-2) | F_CTL [17] (1) | RSVD (0) */
130 	uint8_t reserved_3[21];		/* Reserved */
131 	struct dsd64 dsd[NUM_CMD67_DSDS];	/* Data Segment Descriptors */
132 };
133 
134 /*
135  * Inline data-DSD capacity of the 29xx cmd_type_crc_2_ext IOCB.  Unlike
136  * cmd_type_6_ext / cmd_type_7_ext (which carry NUM_CMD67_DSDS inline DSDs),
137  * CRC_2 places the bulk of its DSDs in the separate CRC-context DMA; only
138  * a single data_dsd is carried inline in both the u.nobundling and
139  * u.bundling variants.  Use this constant wherever the IOCB-reservation
140  * calculator needs the CRC_2 ext inline capacity so it stays in sync with
141  * the firmware-facing layout below.
142  */
143 #define NUM_CRC2_EXT_INLINE_DSDS	1
144 
145 struct cmd_type_crc_2_ext {
146 	uint8_t entry_type;		/* Entry type. */
147 	uint8_t entry_count;		/* Entry count. */
148 	uint8_t sys_define;		/* System defined. */
149 	uint8_t entry_status;		/* Entry Status. */
150 
151 	uint32_t handle;		/* System handle. */
152 
153 	__le16	nport_handle;		/* N_PORT handle. */
154 	__le16	timeout;		/* Command timeout. */
155 
156 	__le16	dseg_count;		/* Data segment count. */
157 	__le16	fcp_rsp_dseg_len;	/* FCP_RSP DSD length. */
158 
159 	struct scsi_lun lun;		/* FCP LUN (BE). */
160 
161 	__le16	control_flags_1;		/* Control flags. */
162 	__le16	fcp_cmnd_dseg_len;	/* Data segment length. */
163 
164 	__le64	 fcp_cmnd_dseg_address __packed;
165 					/* Data segment address. */
166 	__le64	 fcp_rsp_dseg_address __packed;
167 
168 	__le32	byte_count;		/* Total byte count. */
169 
170 	__le16	control_flags_2;		/* Control flags - 2 */
171 	__le16	vp_index;		/* VP Index (bits [8:0]); bits [15:9] reserved.
172 					 * See CMD_EXT_VP_INDEX_MASK.
173 					 */
174 
175 	uint32_t reserved_1;
176 
177 	__le16	 iocb_tag; /* Unused */
178 	__le16 vl_prio; /* Bit 1 - F_CTL, Bits 4-7 VL, rest are rsvd */
179 
180 	uint32_t reserved_2; /* 3C-3F offset */
181 
182 	__le32 ref_tag;
183 	uint8_t ref_tag_mask[4];	/* Validation/Replacement Mask*/
184 
185 	__le16 app_tag;
186 	uint8_t app_tag_mask[2];	/* Validation/Replacement Mask*/
187 
188 	__le16 blk_size;		/* Data size in bytes */
189 	__le16 prot_opts;		/* Requested Data Protection Mode */
190 
191 	__le32 tot_byte_count;		/* Total byte count/ total data
192 					 * transfer count
193 					 */
194 	union {
195 		struct {
196 			uint32_t	reserved_1; /* offset 54 */
197 			uint16_t	reserved_2;
198 			__le16		guard_seed; /* offset 5A */
199 			struct dsd64	data_dsd[1];
200 			uint32_t	reserved_5[2];
201 			uint32_t	reserved_6;
202 		} nobundling;
203 		struct {
204 			__le32	dif_byte_count;	/* Total DIF byte
205 						 * count
206 						 */
207 			__le16	dseg_count;	/* Data segment count */
208 			__le16 guard_seed;      /* Initial Guard Seed */
209 			struct dsd64	data_dsd[1];
210 			struct dsd64	dif_dsd;
211 		} bundling;
212 	} u;
213 	uint8_t reserved_3[12];			/* MUST be set to 0. */
214 };
215 
216 /*
217  * ISP queue - status entry structure definition.
218  */
219 struct sts_entry_24xx_ext {
220 	uint8_t entry_type;		/* Entry type. */
221 	uint8_t entry_count;		/* Entry count. */
222 	uint8_t sys_define;		/* System defined. */
223 	uint8_t entry_status;		/* Entry Status. */
224 
225 	uint32_t handle;		/* System handle. */
226 
227 	__le16	comp_status;		/* Completion status. */
228 	__le16	ox_id;			/* OX_ID used by the firmware. */
229 
230 	__le32	residual_len;		/* FW calc residual transfer length. */
231 
232 	union {
233 		__le16 reserved_1;
234 		__le16 nvme_rsp_pyld_len;
235 	} u1;
236 
237 	__le16	state_flags;		/* State flags. */
238 
239 	__le16 read_sa_index;
240 	__le16 wr_sa_index;
241 	uint8_t	reserved_2[8];
242 	uint8_t act_dif[8];
243 	uint8_t exp_dif[8];
244 	union {
245 		struct {
246 			__le32	rsp_data_len_dma;	/* FCP response data length  */
247 			uint8_t reserved_3[76];
248 		};
249 		struct {
250 			uint8_t nvme_ersp_data[32];
251 			uint8_t reserved_4[48];
252 		};
253 		struct {
254 			__le32	bid_rd_rsp_residual_count;	/* BID read rsp residual cnt */
255 			__le16	retry_delay_timer;	/* Retry delay timer. */
256 			__le16	scsi_status;		/* SCSI status. */
257 			__le32	rsp_residual_count;	/* FCP RSP residual count. */
258 			__le32	sense_len;		/* FCP SENSE length. */
259 			__le32	rsp_data_len_ndma;	/* FCP response data length  */
260 			uint8_t	data[60];	/* FCP rsp/sense information */
261 		};
262 	} u2;
263 
264 	/*
265 	 * If DIF Error is set in comp_status, these additional fields are
266 	 * defined:
267 	 *
268 	 * !!! NOTE: Firmware sends expected/actual DIF data in big endian
269 	 * format; but all of the "data" field gets swab32-d in the beginning
270 	 * of qla2900_status_entry().
271 	 *
272 	 * &data[10] : uint8_t report_runt_bg[2];	- computed guard
273 	 * &data[12] : uint8_t actual_dif[8];		- DIF Data received
274 	 * &data[20] : uint8_t expected_dif[8];		- DIF Data computed
275 	 */
276 };
277 
278 /*
279  * ISP queue - marker entry structure definition.
280  */
281 struct mrk_entry_24xx_ext {
282 	uint8_t entry_type;		/* Entry type. */
283 	uint8_t entry_count;		/* Entry count. */
284 	uint8_t handle_count;		/* Handle count. */
285 	uint8_t entry_status;		/* Entry Status. */
286 
287 	uint32_t handle;		/* System handle. */
288 
289 	__le16	nport_handle;		/* N_PORT handle. */
290 
291 	uint8_t modifier;		/* Modifier (7-0). */
292 	uint8_t reserved_1;
293 
294 	__le16	vp_index;	/* VP Index. 9bits*/
295 	uint16_t reserved_3;
296 
297 	uint8_t lun[8];			/* FCP LUN (BE). */
298 	uint8_t reserved_4[104];
299 };
300 
301 /*
302  * ISP queue - CT Pass-Through entry structure definition.
303  */
304 #define NUM_CT_DSDS	5
305 struct ct_entry_24xx_ext {
306 	uint8_t entry_type;		/* Entry type. */
307 	uint8_t entry_count;		/* Entry count. */
308 	uint8_t sys_define;		/* System Defined. */
309 	uint8_t entry_status;		/* Entry Status. */
310 
311 	uint32_t handle;		/* System handle. */
312 
313 	__le16	comp_status;		/* Completion status. */
314 
315 	__le16	nport_handle;		/* N_PORT handle. */
316 
317 	__le16	cmd_dsd_count;
318 
319 	__le16	vp_index;		/* vp index 9 bits*/
320 
321 	__le16	timeout;		/* Command timeout. */
322 	uint16_t reserved_2;
323 
324 	__le16	rsp_dsd_count;
325 
326 	uint8_t reserved_3[10];
327 	uint8_t reserved_4[28];		/* Reserved. */
328 
329 	__le32	rsp_byte_count;
330 	__le32	cmd_byte_count;
331 	struct dsd64 dsd[NUM_CT_DSDS];	/* Data Segment Descriptors */
332 };
333 
334 /*
335  * 29xx extended Link Service pass-through request IOCB (128 bytes).
336  *
337  * Same wire purpose as the 64-byte struct pt_ls4_request used on 24xx-class
338  * adapters, but laid out for the 128-byte 29xx request ring:
339  *   - vp_index widened to __le16 (bits [8:0] meaningful, see
340  *     CMD_EXT_VP_INDEX_MASK).
341  *   - reserved area expanded to 32 bytes between exchange_address and
342  *     rx_byte_count.
343  *   - inline DSD capacity grown from 2 to 5.
344  * Header through 'tx_dseg_count' (offset 14) and the control_flags /
345  * exchange_address fields keep the same offsets as struct pt_ls4_request,
346  * so common code can populate them via either type once IS_QLA29XX(ha) is
347  * branched for the layout-divergent fields.
348  */
349 #define NUM_PT_LS4_EXT_DSDS	5
350 struct pt_ls4_request_ext {
351 	uint8_t entry_type;
352 	uint8_t entry_count;
353 	uint8_t sys_define;
354 	uint8_t entry_status;
355 	uint32_t handle;
356 	__le16	status;
357 	__le16	nport_handle;
358 	__le16	tx_dseg_count;
359 	__le16	vp_index;	/* VP Index 9 bits; see CMD_EXT_VP_INDEX_MASK */
360 	__le16	timeout;
361 	__le16	control_flags;	/* CF_LS4_* (see struct pt_ls4_request) */
362 	__le16	rx_dseg_count;
363 	__le16	rsvd2;
364 	__le32	exchange_address;
365 	uint8_t rsvd3[32];
366 	__le32	rx_byte_count;
367 	__le32	tx_byte_count;
368 	struct dsd64 dsd[NUM_PT_LS4_EXT_DSDS];
369 };
370 
371 /*
372  * ISP queue - PUREX IOCB entry structure definition
373  */
374 struct purex_entry_24xx_ext {
375 	uint8_t entry_type;		/* Entry type. */
376 	uint8_t entry_count;		/* Entry count. */
377 	uint8_t sys_define;		/* System defined. */
378 	uint8_t entry_status;		/* Entry Status. */
379 
380 	__le16	reserved1;
381 	__le16	vp_idx;			/* VP index 9 bits*/
382 
383 	__le16	status_flags;
384 	__le16	nport_handle;
385 
386 	__le16	frame_size;
387 	__le16	trunc_frame_size;
388 
389 	__le32	rx_xchg_addr;
390 
391 	uint8_t d_id[3];
392 	uint8_t r_ctl;
393 
394 	uint8_t s_id[3];
395 	uint8_t cs_ctl;
396 
397 	uint8_t f_ctl[3];
398 	uint8_t type;
399 
400 	__le16	seq_cnt;
401 	uint8_t df_ctl;
402 	uint8_t seq_id;
403 
404 	__le16	rx_id;
405 	__le16	ox_id;
406 	__le32	param;
407 
408 	uint8_t els_frame_payload[84];
409 };
410 
411 /*
412  * ISP queue - ELS Pass-Through entry structure definition.
413  * ELS_EXT_EST_SOFI*: 4-bit sof_type for extended IOCBs (qla_fw.h EST_SOFI*
414  * is for els_entry_24xx byte layout).
415  */
416 #define ELS_EXT_EST_SOFI3	(1 << 1)
417 #define ELS_EXT_EST_SOFI2	(3 << 3)
418 
419 struct els_entry_24xx_ext {
420 	uint8_t entry_type;		/* Entry type. */
421 	uint8_t entry_count;		/* Entry count. */
422 	uint8_t sys_define;		/* System Defined. */
423 	uint8_t entry_status;		/* Entry Status. */
424 
425 	uint32_t handle;		/* System handle. */
426 
427 	__le16	comp_status;		/* response only */
428 	__le16	nport_handle;
429 
430 	__le16	tx_dsd_count;
431 
432 	__le16	vp_index_sof;		/* bits [8:0]=VP index, [15:12]=SOF type */
433 
434 	__le32	rx_xchg_address;	/* Receive exchange address. */
435 	__le16	rx_dsd_count;
436 
437 	uint8_t opcode;
438 	uint8_t reserved_2;
439 
440 	uint8_t d_id[3];
441 	uint8_t s_id[3];
442 
443 	__le16	control_flags;		/* Control flags. */
444 
445 	union {
446 		struct {
447 			__le32	 rx_byte_count;
448 			__le32	 tx_byte_count;
449 
450 			__le64	 tx_address __packed;	/* DSD 0 address. */
451 			__le32	 tx_len;		/* DSD 0 length. */
452 
453 			__le64	 rx_address __packed;	/* DSD 1 address. */
454 			__le32	 rx_len;		/* DSD 1 length. */
455 		};
456 		struct {
457 			__le32	total_byte_count;
458 			__le32	error_subcode_1;
459 			__le32	error_subcode_2;
460 			__le32	error_subcode_3;
461 			uint8_t reserved_3[16];
462 		};
463 	};
464 	uint8_t reserved_4[64];
465 };
466 
467 struct els_sts_entry_24xx_ext {
468 	uint8_t entry_type;		/* Entry type. */
469 	uint8_t entry_count;		/* Entry count. */
470 	uint8_t sys_define;		/* System Defined. */
471 	uint8_t entry_status;		/* Entry Status. */
472 
473 	__le32	handle;		/* System handle. */
474 
475 	__le16	comp_status;
476 
477 	__le16	nport_handle;		/* N_PORT handle. */
478 
479 	__le16	reserved_1;
480 
481 	__le16	vp_index_sof;		/* bits [8:0]=VP index, [15:12]=SOF type */
482 
483 	__le32	rx_xchg_address;	/* Receive exchange address. */
484 	__le16	reserved_2;
485 
486 	uint8_t opcode;
487 	uint8_t reserved_3;
488 
489 	uint8_t d_id[3];
490 	uint8_t s_id[3];
491 
492 	__le16	control_flags;		/* Control flags. */
493 	__le32	total_byte_count;
494 	__le32	error_subcode_1;
495 	__le32	error_subcode_2;
496 	__le32	error_subcode_3;
497 
498 	uint8_t	reserved_4[80];
499 };
500 
501 struct logio_entry_24xx_ext {
502 	uint8_t entry_type;		/* Entry type. */
503 	uint8_t entry_count;		/* Entry count. */
504 	uint8_t sys_define;		/* System defined. */
505 	uint8_t entry_status;		/* Entry Status. */
506 
507 	uint32_t handle;		/* System handle. */
508 
509 	__le16	comp_status;		/* Completion status. */
510 
511 	__le16	nport_handle;		/* N_PORT handle. */
512 
513 	__le16	control_flags;		/* Control flags. */
514 
515 	__le16	vp_index;		/* VP Index 9bits*/
516 
517 	uint8_t port_id[3];		/* PortID of destination port. */
518 
519 	uint8_t rsp_size;		/* Response size in 32bit words. */
520 
521 	__le32	io_parameter[11];	/* General I/O parameters. */
522 	uint8_t reserved_2[64];		/* Reserved*/
523 };
524 
525 struct tsk_mgmt_entry_ext {
526 	uint8_t entry_type;		/* Entry type. */
527 	uint8_t entry_count;		/* Entry count. */
528 	uint8_t handle_count;		/* Handle count. */
529 	uint8_t entry_status;		/* Entry Status. */
530 
531 	uint32_t handle;		/* System handle. */
532 
533 	__le16	nport_handle;		/* N_PORT handle. */
534 
535 	__le16	reserved_1;
536 
537 	__le16	delay;			/* Activity delay in seconds. */
538 
539 	__le16	timeout;		/* Command timeout. */
540 
541 	struct scsi_lun lun;		/* FCP LUN (BE). */
542 
543 	__le32	control_flags;		/* Control Flags. */
544 
545 	__le16	vp_index;	/* VP Index 9bits */
546 
547 	uint8_t reserved_3[98];
548 };
549 
550 struct abort_entry_24xx_ext {
551 	uint8_t entry_type;		/* Entry type. */
552 	uint8_t entry_count;		/* Entry count. */
553 	uint8_t handle_count;		/* Handle count. */
554 	uint8_t entry_status;		/* Entry Status. */
555 
556 	uint32_t handle;		/* System handle. */
557 
558 	union {
559 		__le16 nport_handle;            /* N_PORT handle. */
560 		__le16 comp_status;             /* Completion status. */
561 	};
562 
563 	__le16	options;		/* Options. */
564 
565 	uint32_t handle_to_abort;	/* System handle to abort. */
566 
567 	__le16	req_que_no;
568 
569 	__le16	vp_index;		/* VP Index 9bits*/
570 	u8	reserved_2[4];
571 	union {
572 		struct {
573 			__le16 abts_rty_cnt;
574 			__le16 rsp_timeout;
575 		} drv;
576 		struct {
577 			u8	ba_rjt_vendorUnique;
578 			u8	ba_rjt_reasonCodeExpl;
579 			u8	ba_rjt_reasonCode;
580 			u8	reserved_3;
581 		} fw;
582 	};
583 	u8	reserved_4[100];
584 };
585 
586 struct abts_entry_24xx_ext {
587 	uint8_t entry_type;
588 	uint8_t entry_count;
589 	uint8_t handle_count;
590 	uint8_t entry_status;
591 
592 	__le32	handle;		/* type 0x55 only */
593 
594 	__le16	comp_status;		/* type 0x55 only */
595 	__le16	nport_handle;		/* type 0x54 only */
596 
597 	__le16	control_flags;		/* type 0x55 only */
598 	__le16	vp_idx_sof;		/* bits [8:0]=VP index, [15:12]=SOF type */
599 
600 	__le32	rx_xch_addr;
601 
602 	uint8_t d_id[3];
603 	uint8_t r_ctl;
604 
605 	uint8_t s_id[3];
606 	uint8_t cs_ctl;
607 
608 	uint8_t f_ctl[3];
609 	uint8_t type;
610 
611 	__le16	seq_cnt;
612 	uint8_t df_ctl;
613 	uint8_t seq_id;
614 
615 	__le16	rx_id;
616 	__le16	ox_id;
617 
618 	__le32	param;
619 
620 	union {
621 		struct {
622 			__le32	subcode3;
623 			__le32	rsvd;
624 			__le32	subcode1;
625 			__le32	subcode2;
626 		} error;
627 		struct {
628 			__le16	rsrvd1;
629 			uint8_t last_seq_id;
630 			uint8_t seq_id_valid;
631 			__le16	aborted_rx_id;
632 			__le16	aborted_ox_id;
633 			__le16	high_seq_cnt;
634 			__le16	low_seq_cnt;
635 		} ba_acc;
636 		struct {
637 			uint8_t vendor_unique;
638 			uint8_t explanation;
639 			uint8_t reason;
640 		} ba_rjt;
641 	} payload;
642 
643 	__le32	rx_xch_addr_to_abort;
644 	uint8_t reserved_2[64];
645 } __packed;
646 /*
647  * Virtual Port Control IOCB
648  */
649 struct vp_ctrl_entry_24xx_ext {
650 	uint8_t entry_type;		/* Entry type. */
651 	uint8_t entry_count;		/* Entry count. */
652 	uint8_t sys_define;		/* System defined. */
653 	uint8_t entry_status;		/* Entry Status. */
654 
655 	uint32_t handle;		/* System handle. */
656 
657 	__le16	vp_idx_failed;
658 
659 	__le16	comp_status;		/* Completion status. */
660 
661 	__le16	command;
662 
663 	__le16	vp_count;
664 
665 	uint8_t vp_idx_map[16];
666 	__le16	flags;
667 	__le16	id;
668 	uint16_t reserved_4;
669 	__le16	hopct;
670 	uint8_t reserved_5[88];
671 };
672 
673 /*
674  * Modify Virtual Port Configuration IOCB
675  */
676 struct vp_config_entry_24xx_ext {
677 	uint8_t entry_type;		/* Entry type. */
678 	uint8_t entry_count;		/* Entry count. */
679 	uint8_t handle_count;
680 	uint8_t entry_status;		/* Entry Status. */
681 
682 	uint32_t handle;		/* System handle. */
683 
684 	__le16	flags;
685 
686 	__le16	comp_status;		/* Completion status. */
687 
688 	uint8_t command;
689 
690 	uint8_t vp_count;
691 
692 	uint8_t vp_index1;
693 	uint8_t vp_index2;
694 
695 	uint8_t options_idx1;
696 	uint8_t hard_address_idx1;
697 	uint16_t reserved_vp1;
698 	uint8_t port_name_idx1[WWN_SIZE];
699 	uint8_t node_name_idx1[WWN_SIZE];
700 
701 	uint8_t options_idx2;
702 	uint8_t hard_address_idx2;
703 	uint16_t reserved_vp2;
704 	uint8_t port_name_idx2[WWN_SIZE];
705 	uint8_t node_name_idx2[WWN_SIZE];
706 	__le16	id;
707 	uint16_t reserved_4;
708 	__le16	hopct;
709 	uint8_t reserved_5[66];
710 };
711 
712 struct vp_rpt_id_entry_24xx_ext {
713 	uint8_t entry_type;		/* Entry type. */
714 	uint8_t entry_count;		/* Entry count. */
715 	uint8_t sys_define;		/* System defined. */
716 	uint8_t entry_status;		/* Entry Status. */
717 	__le32 resv1;
718 	uint8_t vp_acquired;
719 	uint8_t vp_setup;
720 	__le16	vp_idx_status;		/* bits [8:0]=VP index, [15:9]=VP status */
721 
722 	uint8_t port_id[3];
723 	uint8_t format;
724 	union {
725 		struct vp_rpt_id_ext_f1 {
726 			/* format 1 fabric */
727 			uint8_t vpstat1_subcode; /* vp_status=1 subcode */
728 			uint8_t flags;
729 
730 			__le16 fip_flags;
731 			uint8_t rsv2[12];
732 
733 			uint8_t ls_rjt_vendor;
734 			uint8_t ls_rjt_explanation;
735 			uint8_t ls_rjt_reason;
736 			uint8_t rsv3;
737 			__le16	rsv8;
738 			__le16	flogi_acc_payload_size;	/* bits [8:0] meaningful */
739 			uint8_t port_name[8];
740 			uint8_t node_name[8];
741 			__le16 bbcr;
742 			uint8_t reserved_5[6];
743 		} f1;
744 		struct vp_rpt_id_ext_f2 { /* format 2: N2N direct connect */
745 			uint8_t vpstat1_subcode;
746 			uint8_t flags;
747 			__le16 fip_flags;
748 			uint8_t rsv2[12];
749 
750 			uint8_t ls_rjt_vendor;
751 			uint8_t ls_rjt_explanation;
752 			uint8_t ls_rjt_reason;
753 			uint8_t rsv3[5];
754 
755 			uint8_t port_name[8];
756 			uint8_t node_name[8];
757 			__le16 bbcr;
758 			uint8_t reserved_5[2];
759 			uint8_t remote_nport_id[4];
760 		} f2;
761 	} u;
762 	uint8_t reserved_end[64];
763 };
764 
765 /*
766  * ISP queue - 64-Bit addressing, continuation entry structure definition
767  * for the 29xx extended (128-byte) IOCB ring.  Mirrors cont_a64_entry_t
768  * but carries 10 DSDs per entry instead of 5.
769  */
770 #define NUM_CONT1_DSDS	10
771 struct cont_a64_entry_ext {
772 	uint8_t entry_type;		/* Entry type. */
773 	uint8_t entry_count;		/* Entry count. */
774 	uint8_t sys_define;		/* System defined. */
775 	uint8_t entry_status;		/* Entry Status. */
776 	uint32_t reserved;
777 	struct dsd64 dsd[NUM_CONT1_DSDS];
778 };
779 
780 /*
781  * 29xx extended Command Type FC-NVMe IOCB (128 bytes).
782  *
783  * The header layout up through 'byte_count' (offset 48) is identical to the
784  * 64-byte struct cmd_nvme used by 24xx-class adapters, so common code can
785  * populate those fields via either type.  Fields beyond 'byte_count' diverge:
786  * 29xx adds control_flags_2/vp_index/first_burst_rx_id/io_tag/..., drops
787  * port_id[3]+vp_index(byte), and carries NUM_NVME_DSDS inline DSDs.
788  */
789 #define NUM_NVME_DSDS	4
790 struct cmd_nvme_ext {
791 	uint8_t entry_type;		/* Entry type. */
792 	uint8_t entry_count;		/* Entry count. */
793 	uint8_t sys_define;		/* System defined. */
794 	uint8_t entry_status;		/* Entry Status. */
795 
796 	uint32_t handle;		/* System handle. */
797 	__le16	nport_handle;		/* N_PORT handle. */
798 	__le16	timeout;		/* Command timeout. */
799 
800 	__le16	dseg_count;		/* Data segment count. */
801 	__le16	nvme_rsp_dsd_len;	/* NVMe RSP DSD length */
802 
803 	uint64_t rsvd;
804 
805 	__le16	control_flags;		/* Control Flags (see struct cmd_nvme) */
806 	__le16	nvme_cmnd_dseg_len;			/* Data segment length. */
807 
808 	__le64	 nvme_cmnd_dseg_address __packed;	/* Data segment address. */
809 
810 	__le64	 nvme_rsp_dseg_address __packed;	/* Data segment address. */
811 
812 	__le32	byte_count;		/* Total byte count. */
813 
814 	__le16	control_flags_2;
815 	/*
816 	 * vp_index layout matches the other 29xx extended IOCBs: only bits
817 	 * [8:0] are meaningful (see CMD_EXT_VP_INDEX_MASK).
818 	 */
819 	__le16	vp_index;
820 	__le32	first_burst_rx_id;
821 	__le16	io_tag;
822 	uint8_t vl_n_fctl;	/* VL(7:4) | RSVD(3:2) | F_CTL[17](1) | RSVD(0) */
823 	uint8_t prtag_csctl;	/* Priority Tag or CS_CTL */
824 	__le32	src_vm_id;	/* Source VM ID */
825 	uint8_t reserved_2[16];
826 
827 	struct dsd64 nvme_dsd[NUM_NVME_DSDS];
828 };
829 
830 #endif
831