1fcf3ce44SJohn Forte /*
2fcf3ce44SJohn Forte  * CDDL HEADER START
3fcf3ce44SJohn Forte  *
4fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7fcf3ce44SJohn Forte  *
8fcf3ce44SJohn Forte  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fcf3ce44SJohn Forte  * or http://www.opensolaris.org/os/licensing.
10fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11fcf3ce44SJohn Forte  * and limitations under the License.
12fcf3ce44SJohn Forte  *
13fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18fcf3ce44SJohn Forte  *
19fcf3ce44SJohn Forte  * CDDL HEADER END
20fcf3ce44SJohn Forte  */
21fcf3ce44SJohn Forte 
22*4c3888b8SHans Rosenfeld /* Copyright 2015 QLogic Corporation */
23fcf3ce44SJohn Forte 
24fcf3ce44SJohn Forte /*
25f885d00fSDaniel Beauregard  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
26fcf3ce44SJohn Forte  */
27fcf3ce44SJohn Forte 
28fcf3ce44SJohn Forte #ifndef	_QL_IOCB_H
29fcf3ce44SJohn Forte #define	_QL_IOCB_H
30fcf3ce44SJohn Forte 
31fcf3ce44SJohn Forte /*
32fcf3ce44SJohn Forte  * ISP2xxx Solaris Fibre Channel Adapter (FCA) driver header file.
33fcf3ce44SJohn Forte  *
34fcf3ce44SJohn Forte  * ***********************************************************************
35fcf3ce44SJohn Forte  * *									**
36fcf3ce44SJohn Forte  * *				NOTICE					**
37*4c3888b8SHans Rosenfeld  * *		COPYRIGHT (C) 1996-2015 QLOGIC CORPORATION		**
38fcf3ce44SJohn Forte  * *			ALL RIGHTS RESERVED				**
39fcf3ce44SJohn Forte  * *									**
40fcf3ce44SJohn Forte  * ***********************************************************************
41fcf3ce44SJohn Forte  *
42fcf3ce44SJohn Forte  */
43fcf3ce44SJohn Forte 
44fcf3ce44SJohn Forte #ifdef	__cplusplus
45fcf3ce44SJohn Forte extern "C" {
46fcf3ce44SJohn Forte #endif
47fcf3ce44SJohn Forte 
48*4c3888b8SHans Rosenfeld typedef struct ql_64bit_data_seg {
49*4c3888b8SHans Rosenfeld 	uint32_t	address[2];
50*4c3888b8SHans Rosenfeld 	uint32_t	length;
51*4c3888b8SHans Rosenfeld } ql_64bit_data_seg_t;
52*4c3888b8SHans Rosenfeld 
53*4c3888b8SHans Rosenfeld typedef struct ql_32bit_data_seg {
54*4c3888b8SHans Rosenfeld 	uint32_t	address;
55*4c3888b8SHans Rosenfeld 	uint32_t	length;
56*4c3888b8SHans Rosenfeld } ql_32bit_data_seg_t;
57*4c3888b8SHans Rosenfeld 
58*4c3888b8SHans Rosenfeld #define	ABORTED_ENTRY_TYPE	0
59fcf3ce44SJohn Forte 
60fcf3ce44SJohn Forte /*
61fcf3ce44SJohn Forte  * ISP queue -	32-Bit DMA addressing command with extended LUN support
62fcf3ce44SJohn Forte  *		entry structure definition.
63fcf3ce44SJohn Forte  */
64fcf3ce44SJohn Forte #define	IOCB_CMD_TYPE_2		0x11	/* Command entry */
65fcf3ce44SJohn Forte #define	MAX_CMDSZ		16	/* SCSI maximum CDB size. */
66fcf3ce44SJohn Forte #define	CMD_TYPE_2_DATA_SEGMENTS	3	/* Number of data segments. */
67fcf3ce44SJohn Forte typedef struct cmd_entry {
68*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
69*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
70*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
71*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
72fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
73*4c3888b8SHans Rosenfeld 	uint8_t target_l;		/* SCSI ID - LSB */
74*4c3888b8SHans Rosenfeld 	uint8_t target_h;		/* SCSI ID - MSB */
75*4c3888b8SHans Rosenfeld 	uint8_t lun_l;			/* SCSI LUN - LSB */
76*4c3888b8SHans Rosenfeld 	uint8_t lun_h;			/* SCSI LUN - MSB */
77*4c3888b8SHans Rosenfeld 	uint8_t control_flags_l;	/* Control flags - LSB. */
78*4c3888b8SHans Rosenfeld 	uint8_t control_flags_h;	/* Control flags - MSB. */
79*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[2];
80fcf3ce44SJohn Forte 	uint16_t timeout;		/* Command timeout. */
81fcf3ce44SJohn Forte 	uint16_t dseg_count;		/* Data segment count - LSB. */
82*4c3888b8SHans Rosenfeld 	uint8_t scsi_cdb[MAX_CMDSZ];	/* SCSI command words. */
83fcf3ce44SJohn Forte 	uint32_t byte_count;		/* Total byte count. */
84*4c3888b8SHans Rosenfeld 	ql_32bit_data_seg_t	dseg[3];	/* Data segments. */
85fcf3ce44SJohn Forte } cmd_entry_t, request_t;
86fcf3ce44SJohn Forte 
87fcf3ce44SJohn Forte /*
88fcf3ce44SJohn Forte  * Command entry control flags least significant byte.
89fcf3ce44SJohn Forte  */
90fcf3ce44SJohn Forte #define	CF_HTAG		BIT_1
91fcf3ce44SJohn Forte #define	CF_OTAG		BIT_2
92fcf3ce44SJohn Forte #define	CF_STAG		BIT_3
93fcf3ce44SJohn Forte #define	CF_DATA_IN	BIT_5
94fcf3ce44SJohn Forte #define	CF_DATA_OUT	BIT_6
95fcf3ce44SJohn Forte 
96fcf3ce44SJohn Forte /*
97fcf3ce44SJohn Forte  * ISP24xx queue - Command IOCB structure definition.
98fcf3ce44SJohn Forte  */
99fcf3ce44SJohn Forte #define	IOCB_CMD_TYPE_7		0x18
100*4c3888b8SHans Rosenfeld #define	CMD_TYPE_7_DATA_SEGMENTS 1	/* Number of 64 bit data segments. */
101fcf3ce44SJohn Forte typedef struct cmd7_24xx_entry {
102*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
103*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
104*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
105*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
106fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
107fcf3ce44SJohn Forte 	uint16_t n_port_hdl;
108fcf3ce44SJohn Forte 	uint16_t timeout;		/* Command timeout. */
109fcf3ce44SJohn Forte 	uint16_t dseg_count;
110*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[2];
111*4c3888b8SHans Rosenfeld 	uint8_t fcp_lun[8];		/* SCSI LUN ID. */
112*4c3888b8SHans Rosenfeld 	uint8_t control_flags;
113*4c3888b8SHans Rosenfeld 	uint8_t task_mgmt;		/* Task management flags. */
114*4c3888b8SHans Rosenfeld 	uint8_t task;			/* Task Attributes Values. */
115*4c3888b8SHans Rosenfeld 	uint8_t crn;			/* Command reference number. */
116*4c3888b8SHans Rosenfeld 	uint8_t scsi_cdb[MAX_CMDSZ];	/* SCSI command bytes. */
117fcf3ce44SJohn Forte 	uint32_t total_byte_count;
118*4c3888b8SHans Rosenfeld 	uint8_t target_id[3];		/* SCSI Target ID */
119*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
120*4c3888b8SHans Rosenfeld 	ql_64bit_data_seg_t	dseg;		/* Data segments. */
121f885d00fSDaniel Beauregard } cmd7_24xx_entry_t;
122f885d00fSDaniel Beauregard 
123f885d00fSDaniel Beauregard /*
124f885d00fSDaniel Beauregard  * ISP24xx queue - Command IOCB structure definition.
125f885d00fSDaniel Beauregard  */
126f885d00fSDaniel Beauregard #define	IOCB_CMD_TYPE_6		0x48
127*4c3888b8SHans Rosenfeld #define	CMD_TYPE_6_DATA_SEGMENTS 1	/* Number of 64 bit data segments. */
128f885d00fSDaniel Beauregard typedef struct cmd6_24xx_entry {
129*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
130*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
131*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
132*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
133f885d00fSDaniel Beauregard 	uint32_t handle;		/* System handle */
134f885d00fSDaniel Beauregard 	uint16_t n_port_hdl;
135f885d00fSDaniel Beauregard 	uint16_t timeout;		/* Command timeout. */
136f885d00fSDaniel Beauregard 	uint16_t dseg_count;
137f885d00fSDaniel Beauregard 	uint16_t rsp_length;
138*4c3888b8SHans Rosenfeld 	uint8_t fcp_lun[8];		/* SCSI LUN ID. */
139f885d00fSDaniel Beauregard 	uint16_t control_flags;
140f885d00fSDaniel Beauregard 	uint16_t cmnd_length;
141f885d00fSDaniel Beauregard 	uint32_t cmnd_address[2];
142f885d00fSDaniel Beauregard 	uint32_t rsp_address[2];	/* Data segment 0 address. */
143f885d00fSDaniel Beauregard 	uint32_t total_byte_count;
144*4c3888b8SHans Rosenfeld 	uint8_t target_id[3];		/* SCSI Target ID */
145*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
146*4c3888b8SHans Rosenfeld 	ql_64bit_data_seg_t	dseg;		/* Data segments. */
147f885d00fSDaniel Beauregard } cmd6_24xx_entry_t;
148f885d00fSDaniel Beauregard 
149f885d00fSDaniel Beauregard typedef struct fcp_cmnd {
150f885d00fSDaniel Beauregard 	uint8_t		fcp_lun[8];		/* SCSI LUN ID. */
151f885d00fSDaniel Beauregard 	uint8_t		crn;			/* Command reference number. */
152f885d00fSDaniel Beauregard 	uint8_t		task;			/* Task Attributes Values. */
153f885d00fSDaniel Beauregard 	uint8_t		task_mgmt;		/* Task management flags. */
154f885d00fSDaniel Beauregard 	uint8_t		control_flags;		/* Plus additional cdb length */
155f885d00fSDaniel Beauregard 	uint8_t		scsi_cdb[MAX_CMDSZ];
156f885d00fSDaniel Beauregard 	uint32_t	dl;
157f885d00fSDaniel Beauregard } fcp_cmnd_t;
158f885d00fSDaniel Beauregard 
159f885d00fSDaniel Beauregard typedef struct cmd6_2400_dma {
160f885d00fSDaniel Beauregard 	fcp_cmnd_t	cmd;
161f885d00fSDaniel Beauregard 	uint32_t	cookie_list[QL_DMA_SG_LIST_LENGTH + 1][3];
162f885d00fSDaniel Beauregard } cmd6_2400_dma_t;
163fcf3ce44SJohn Forte 
164fcf3ce44SJohn Forte /*
165fcf3ce44SJohn Forte  * Task Management Flags.
166fcf3ce44SJohn Forte  */
167fcf3ce44SJohn Forte #define	TF_TARGET_RESET		BIT_13
168fcf3ce44SJohn Forte #define	TF_LUN_RESET		BIT_12
169fcf3ce44SJohn Forte #define	TF_CLEAR_TASK_SET	BIT_10
170fcf3ce44SJohn Forte #define	TF_ABORT_TASK_SET	BIT_9
171fcf3ce44SJohn Forte 
172fcf3ce44SJohn Forte /*
173fcf3ce44SJohn Forte  * Task Attributes Values.
174fcf3ce44SJohn Forte  */
175fcf3ce44SJohn Forte #define	TA_STAG		0
176fcf3ce44SJohn Forte #define	TA_HTAG		1
177fcf3ce44SJohn Forte #define	TA_OTAG		2
178fcf3ce44SJohn Forte #define	TA_ACA		4
179fcf3ce44SJohn Forte #define	TA_UNTAGGED	5
180fcf3ce44SJohn Forte 
181fcf3ce44SJohn Forte /*
182fcf3ce44SJohn Forte  * Control Flags.
183fcf3ce44SJohn Forte  */
184fcf3ce44SJohn Forte #define	CF_DSD_PTR	BIT_2
185fcf3ce44SJohn Forte #define	CF_RD		BIT_1
186fcf3ce44SJohn Forte #define	CF_WR		BIT_0
187fcf3ce44SJohn Forte 
188fcf3ce44SJohn Forte /*
189fcf3ce44SJohn Forte  * ISP queue -	64-Bit DMA addressing command with extended LUN support
190fcf3ce44SJohn Forte  *		entry structure definition.
191fcf3ce44SJohn Forte  */
192fcf3ce44SJohn Forte #define	IOCB_CMD_TYPE_3		0x19	/* Command Type 3 entry (64 bit) */
193*4c3888b8SHans Rosenfeld #define	CMD_TYPE_3_DATA_SEGMENTS 2	/* Number of 64 bit data segments. */
194fcf3ce44SJohn Forte typedef struct cmd_3_entry {
195*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
196*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
197*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
198*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
199fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
200*4c3888b8SHans Rosenfeld 	uint8_t target_l;		/* SCSI ID - LSB */
201*4c3888b8SHans Rosenfeld 	uint8_t target_h;		/* SCSI ID - MSB */
202*4c3888b8SHans Rosenfeld 	uint8_t lun_l;			/* SCSI LUN - LSB */
203*4c3888b8SHans Rosenfeld 	uint8_t lun_h;			/* SCSI LUN - MSB */
204*4c3888b8SHans Rosenfeld 	uint8_t control_flags_l;	/* Control flags - LSB. */
205*4c3888b8SHans Rosenfeld 	uint8_t control_flags_h;	/* Control flags - MSB. */
206*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[2];
207fcf3ce44SJohn Forte 	uint16_t timeout;		/* Command timeout. */
208fcf3ce44SJohn Forte 	uint16_t dseg_count;		/* Data segment count - LSB. */
209*4c3888b8SHans Rosenfeld 	uint8_t scsi_cdb[MAX_CMDSZ];	/* SCSI command words. */
210fcf3ce44SJohn Forte 	uint32_t byte_count;		/* Total byte count. */
211*4c3888b8SHans Rosenfeld 	ql_64bit_data_seg_t	dseg[2];	/* Data segments. */
212fcf3ce44SJohn Forte } cmd_3_entry_t;
213fcf3ce44SJohn Forte 
214fcf3ce44SJohn Forte /*
215fcf3ce44SJohn Forte  * ISP queue -	Command type 4 DSD list pointer structure definition.
216fcf3ce44SJohn Forte  */
217fcf3ce44SJohn Forte #define	COMMAND_CHAINING_TYPE	0x15
218fcf3ce44SJohn Forte typedef struct cmd_chaining_entry {
219*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
220*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
221*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
222*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
223fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
224*4c3888b8SHans Rosenfeld 	uint8_t reserved;
225*4c3888b8SHans Rosenfeld 	uint8_t target;		/* SCSI ID */
226*4c3888b8SHans Rosenfeld 	uint8_t lun_l;			/* SCSI LUN - LSB */
227*4c3888b8SHans Rosenfeld 	uint8_t lun_h;			/* SCSI LUN - MSB */
228*4c3888b8SHans Rosenfeld 	uint8_t control_flags_l;	/* Control flags - LSB. */
229*4c3888b8SHans Rosenfeld 	uint8_t control_flags_h;	/* Control flags - MSB. */
230*4c3888b8SHans Rosenfeld 	uint8_t crn;
231*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
232*4c3888b8SHans Rosenfeld 	uint8_t timeout_l;		/* Command timeout - LSB. */
233*4c3888b8SHans Rosenfeld 	uint8_t timeout_h;		/* Command timeout - MSB. */
234*4c3888b8SHans Rosenfeld 	uint8_t dseg_count_l;		/* Data segment count - LSB. */
235*4c3888b8SHans Rosenfeld 	uint8_t dseg_count_h;		/* Data segment count - MSB. */
236*4c3888b8SHans Rosenfeld 	uint8_t scsi_cdb[MAX_CMDSZ];	/* SCSI command words. */
237fcf3ce44SJohn Forte 	uint32_t byte_count;		/* Total byte count. */
238fcf3ce44SJohn Forte 	uint16_t list_type;		/* 0 = 32bit, 1 = 64bit. */
239fcf3ce44SJohn Forte 	uint16_t base_address[2];
240fcf3ce44SJohn Forte 	uint16_t list_address[4];
241fcf3ce44SJohn Forte 	uint8_t reserved_2[10];
242fcf3ce44SJohn Forte } cmd_chaining_entry_t;
243fcf3ce44SJohn Forte 
244fcf3ce44SJohn Forte /*
245fcf3ce44SJohn Forte  * ISP queue - continuation entry structure definition.
246fcf3ce44SJohn Forte  */
247fcf3ce44SJohn Forte #define	CONTINUATION_TYPE_0	0x02	/* Continuation entry. */
248*4c3888b8SHans Rosenfeld #define	CONT_TYPE_0_DATA_SEGMENTS 7	/* Number of 32 bit data segments. */
249fcf3ce44SJohn Forte typedef struct cont_entry {
250fcf3ce44SJohn Forte 	uint8_t entry_type;		/* Entry type. */
251fcf3ce44SJohn Forte 	uint8_t entry_count;		/* Entry count. */
252fcf3ce44SJohn Forte 	uint8_t sys_define;		/* System defined. */
253fcf3ce44SJohn Forte 	uint8_t entry_status;		/* Entry Status. */
254fcf3ce44SJohn Forte 	uint32_t reserved;
255*4c3888b8SHans Rosenfeld 	ql_32bit_data_seg_t	dseg[7];	/* Data segments. */
256fcf3ce44SJohn Forte } cont_entry_t;
257fcf3ce44SJohn Forte 
258fcf3ce44SJohn Forte /*
259fcf3ce44SJohn Forte  * ISP queue - 64-Bit addressing, continuation entry structure definition.
260fcf3ce44SJohn Forte  */
261fcf3ce44SJohn Forte #define	CONTINUATION_TYPE_1	0x0A	/* Continuation Type 1 entry. */
262*4c3888b8SHans Rosenfeld #define	CONT_TYPE_1_DATA_SEGMENTS 5	/* Number of 64 bit data segments. */
263fcf3ce44SJohn Forte typedef struct cont_type_1_entry {
264fcf3ce44SJohn Forte 	uint8_t entry_type;		/* Entry type. */
265fcf3ce44SJohn Forte 	uint8_t entry_count;		/* Entry count. */
266fcf3ce44SJohn Forte 	uint8_t sys_define;		/* System defined. */
267fcf3ce44SJohn Forte 	uint8_t entry_status;		/* Entry Status. */
268*4c3888b8SHans Rosenfeld 	ql_64bit_data_seg_t	dseg[5];	/* Data segments. */
269fcf3ce44SJohn Forte } cont_type_1_entry_t;
270fcf3ce44SJohn Forte 
271fcf3ce44SJohn Forte /*
272fcf3ce44SJohn Forte  * ISP queue - status entry structure definition.
273fcf3ce44SJohn Forte  */
274fcf3ce44SJohn Forte #define	STATUS_TYPE	0x03		/* Status entry. */
275fcf3ce44SJohn Forte typedef struct sts_entry {
276*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
277*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
278*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
279*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
280fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle. */
281*4c3888b8SHans Rosenfeld 	uint8_t scsi_status_l;		/* SCSI status - LSB. */
282*4c3888b8SHans Rosenfeld 	uint8_t scsi_status_h;		/* SCSI status - MSB. */
283fcf3ce44SJohn Forte 	uint16_t comp_status;		/* Completion status. */
284*4c3888b8SHans Rosenfeld 	uint8_t state_flags_l;		/* State flags - LSB. */
285*4c3888b8SHans Rosenfeld 	uint8_t state_flags_h;		/* State flags. */
286*4c3888b8SHans Rosenfeld 	uint8_t status_flags_l;	/* Status flags. */
287*4c3888b8SHans Rosenfeld 	uint8_t status_flags_h;	/* Status flags - MSB. */
288fcf3ce44SJohn Forte 	uint16_t rsp_info_length;	/* Response Info Length. */
289fcf3ce44SJohn Forte 	uint16_t req_sense_length;	/* Request sense data length. */
290fcf3ce44SJohn Forte 	uint32_t residual_length;	/* Residual transfer length. */
291*4c3888b8SHans Rosenfeld 	uint8_t rsp_info[8];		/* FCP response information. */
292*4c3888b8SHans Rosenfeld 	uint8_t req_sense_data[32];	/* Request sense data. */
293fcf3ce44SJohn Forte } sts_entry_t, response_t;
294fcf3ce44SJohn Forte 
295fcf3ce44SJohn Forte /*
296fcf3ce44SJohn Forte  * Status entry entry status
297fcf3ce44SJohn Forte  */
298fcf3ce44SJohn Forte #define	RF_INV_E_ORDER	BIT_5		/* Invalid entry order. */
299*4c3888b8SHans Rosenfeld #define	RF_INV_E_COUNT	BIT_4		/* Invalid entry count. */
300*4c3888b8SHans Rosenfeld #define	RF_INV_E_PARAM	BIT_3		/* Invalid entry parameter. */
301*4c3888b8SHans Rosenfeld #define	RF_INV_E_TYPE	BIT_2		/* Invalid entry type. */
302fcf3ce44SJohn Forte #define	RF_BUSY		BIT_1		/* Busy */
303fcf3ce44SJohn Forte 
304fcf3ce44SJohn Forte /*
305fcf3ce44SJohn Forte  * Status entry SCSI status most significant byte.
306fcf3ce44SJohn Forte  */
307fcf3ce44SJohn Forte #define	FCP_CONF_REQ		BIT_4
308fcf3ce44SJohn Forte #define	FCP_RESID_UNDER		BIT_3
309fcf3ce44SJohn Forte #define	FCP_RESID_OVER		BIT_2
310fcf3ce44SJohn Forte #define	FCP_SNS_LEN_VALID	BIT_1
311fcf3ce44SJohn Forte #define	FCP_RSP_LEN_VALID	BIT_0
312fcf3ce44SJohn Forte #define	FCP_RSP_MASK		(FCP_RESID_UNDER | FCP_RESID_OVER | \
313fcf3ce44SJohn Forte 				FCP_RSP_LEN_VALID)
314fcf3ce44SJohn Forte 
315fcf3ce44SJohn Forte /*
316fcf3ce44SJohn Forte  * Status entry state flag most significant byte.
317fcf3ce44SJohn Forte  * Not used in by ISP24xx
318fcf3ce44SJohn Forte  */
319fcf3ce44SJohn Forte #define	SF_ARQ_DONE		BIT_5
320fcf3ce44SJohn Forte #define	SF_GOT_STATUS		BIT_4
321fcf3ce44SJohn Forte #define	SF_XFERRED_DATA		BIT_3
322fcf3ce44SJohn Forte #define	SF_SENT_CMD		BIT_2
323fcf3ce44SJohn Forte #define	SF_GOT_TARGET		BIT_1
324fcf3ce44SJohn Forte #define	SF_GOT_BUS		BIT_0
325fcf3ce44SJohn Forte 
326fcf3ce44SJohn Forte /*
327fcf3ce44SJohn Forte  * Status entry state flag least significant byte.
328fcf3ce44SJohn Forte  * Not used in by ISP24xx
329fcf3ce44SJohn Forte  */
330fcf3ce44SJohn Forte #define	SF_NO_FAST_POST		BIT_7
331fcf3ce44SJohn Forte #define	SF_DATA_OUT		BIT_6
332fcf3ce44SJohn Forte #define	SF_DATA_IN		BIT_5
333fcf3ce44SJohn Forte 
334fcf3ce44SJohn Forte #define	SF_SIMPLE_Q		BIT_3
335fcf3ce44SJohn Forte #define	SF_ORDERED_Q		BIT_2
336fcf3ce44SJohn Forte #define	SF_HEAD_OF_Q		BIT_1
337fcf3ce44SJohn Forte #define	SF_ACA_Q		BIT_0
338fcf3ce44SJohn Forte 
339fcf3ce44SJohn Forte /*
340fcf3ce44SJohn Forte  * Status entry completion status definitions.
341fcf3ce44SJohn Forte  */
342fcf3ce44SJohn Forte #define	CS_COMPLETE		0x0	/* No errors */
343fcf3ce44SJohn Forte #define	CS_INCOMPLETE		0x1	/* Incomplete transfer of cmd. */
344fcf3ce44SJohn Forte #define	CS_DMA_ERROR		0x2	/* A DMA direction error. */
345fcf3ce44SJohn Forte #define	CS_PORT_ID_CHANGE	0x2	/* The port ID has changed. */
346fcf3ce44SJohn Forte #define	CS_TRANSPORT		0x3	/* Transport error. */
347fcf3ce44SJohn Forte #define	CS_RESET		0x4	/* SCSI bus reset occurred */
348fcf3ce44SJohn Forte #define	CS_ABORTED		0x5	/* System aborted command. */
349fcf3ce44SJohn Forte #define	CS_TIMEOUT		0x6	/* Timeout error. */
350fcf3ce44SJohn Forte #define	CS_DATA_OVERRUN		0x7	/* Data overrun. */
351fcf3ce44SJohn Forte #define	CS_INVALID_RX_ID	0x8	/* Invalid RX_ID. */
352fcf3ce44SJohn Forte #define	CS_DATA_REASSEM_ERROR	0x11	/* Data reassembly error. */
353fcf3ce44SJohn Forte #define	CS_ABTS_REC		0x13	/* ABTS from target. */
354fcf3ce44SJohn Forte #define	CS_DATA_UNDERRUN	0x15	/* Data Underrun. */
355fcf3ce44SJohn Forte #define	CS_QUEUE_FULL		0x1C	/* Queue Full. */
356fcf3ce44SJohn Forte #define	CS_PORT_UNAVAILABLE	0x28	/* Port unavailable */
357fcf3ce44SJohn Forte 					/* (selection timeout) */
358fcf3ce44SJohn Forte #define	CS_PORT_LOGGED_OUT	0x29	/* Port Logged Out */
359fcf3ce44SJohn Forte #define	CS_PORT_CONFIG_CHG	0x2A	/* Port Configuration Changed */
360fcf3ce44SJohn Forte #define	CS_PORT_BUSY		0x2B	/* Port Busy */
361fcf3ce44SJohn Forte #define	CS_RESOUCE_UNAVAILABLE	0x2C	/* Frimware resource unavailable. */
362fcf3ce44SJohn Forte #define	CS_TASK_MGMT_OVERRUN	0x30	/* Task management overrun. */
363fcf3ce44SJohn Forte #define	CS_LOGIN_LOGOUT_ERROR	0x31	/* login/logout IOCB error. */
364fcf3ce44SJohn Forte #define	CS_SEQ_COMPLETE		0x40	/* Sequence Complete. */
365fcf3ce44SJohn Forte #define	CS_ABORTED_SEQ_REC	0x47	/* Abort sequence was received. */
366*4c3888b8SHans Rosenfeld #define	CS_DEV_NOT_READY	0x81	/* Device not ready */
367fcf3ce44SJohn Forte #define	CS_INVALID_PARAMETER	0x102	/* IP invalid_parameter. */
368fcf3ce44SJohn Forte #define	CS_ERROR_RESOURCE	0x103	/* IP insufficient resources. */
369fcf3ce44SJohn Forte #define	CS_IP_NOT_INITIALIZED	0x104	/* IP not_initialized. */
370fcf3ce44SJohn Forte 
371fcf3ce44SJohn Forte #define	CS_BAD_PAYLOAD		0x180	/* Driver defined */
372fcf3ce44SJohn Forte #define	CS_UNKNOWN		0x181	/* Driver defined */
373fcf3ce44SJohn Forte #define	CS_CMD_FAILED		0x182	/* Driver defined */
374fcf3ce44SJohn Forte #define	CS_LOOP_DOWN_ABORT	0x183	/* Driver defined */
375fcf3ce44SJohn Forte #define	CS_FCP_RESPONSE_ERROR	0x184	/* Driver defined */
376fcf3ce44SJohn Forte #define	CS_DEVICE_UNAVAILABLE	0x185	/* Driver defined */
377fcf3ce44SJohn Forte /*
378fcf3ce44SJohn Forte  * ISP24xx queue - Status IOCB structure definition.
379fcf3ce44SJohn Forte  */
380fcf3ce44SJohn Forte typedef struct sts_24xx_entry {
381*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
382*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
383*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
384*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
385fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle. */
386fcf3ce44SJohn Forte 	uint16_t comp_status;		/* Completion status. */
387fcf3ce44SJohn Forte 	uint16_t ox_id;
388fcf3ce44SJohn Forte 	uint32_t residual_length;	/* Residual transfer length. */
389fcf3ce44SJohn Forte 	uint16_t reserved;
390fcf3ce44SJohn Forte 	uint8_t	 state_flags_l;		/* State flags. */
391fcf3ce44SJohn Forte 	uint8_t	 state_flags_h;
392fcf3ce44SJohn Forte 	uint16_t reserved_1;
393*4c3888b8SHans Rosenfeld 	uint8_t scsi_status_l;		/* SCSI status - LSB. */
394*4c3888b8SHans Rosenfeld 	uint8_t scsi_status_h;		/* SCSI status - MSB. */
395fcf3ce44SJohn Forte 	uint32_t fcp_rsp_residual_count;
396fcf3ce44SJohn Forte 	uint32_t fcp_sense_length;
397fcf3ce44SJohn Forte 	uint32_t fcp_rsp_data_length;	/* Response Info Length. */
398*4c3888b8SHans Rosenfeld 	uint8_t rsp_sense_data[28];	/* FCP response and/or sense data. */
399fcf3ce44SJohn Forte } sts_24xx_entry_t;
400fcf3ce44SJohn Forte 
401fcf3ce44SJohn Forte /*
402fcf3ce44SJohn Forte  * ISP queue - status continuation entry structure definition.
403fcf3ce44SJohn Forte  */
404fcf3ce44SJohn Forte #define	STATUS_CONT_TYPE	0x10	/* Status continuation entry. */
405fcf3ce44SJohn Forte typedef struct sts_cont_entry {
406*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
407*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
408*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
409*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
410*4c3888b8SHans Rosenfeld 	uint8_t req_sense_data[60];	/* Request sense data. */
411fcf3ce44SJohn Forte } sts_cont_entry_t;
412fcf3ce44SJohn Forte 
413fcf3ce44SJohn Forte /*
414fcf3ce44SJohn Forte  * ISP queue -	marker with extended LUN support
415fcf3ce44SJohn Forte  *		entry structure definition.
416fcf3ce44SJohn Forte  */
417fcf3ce44SJohn Forte #define	MARKER_TYPE	0x04		/* Marker entry. */
418fcf3ce44SJohn Forte typedef struct mrk_entry {
419*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
420*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
421*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
422*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
423fcf3ce44SJohn Forte 	uint32_t sys_define_2;		/* System defined. */
424*4c3888b8SHans Rosenfeld 	uint8_t target_l;		/* SCSI ID - LSB */
425*4c3888b8SHans Rosenfeld 	uint8_t target_h;		/* SCSI ID - MSB */
426*4c3888b8SHans Rosenfeld 	uint8_t modifier;		/* Modifier (7-0). */
427*4c3888b8SHans Rosenfeld 	uint8_t reserved_1;
428*4c3888b8SHans Rosenfeld 	uint8_t sequence_number[2];	/* Sequence number of event. */
429*4c3888b8SHans Rosenfeld 	uint8_t lun_l;			/* SCSI LUN - LSB */
430*4c3888b8SHans Rosenfeld 	uint8_t lun_h;			/* SCSI LUN - MSB */
431*4c3888b8SHans Rosenfeld 	uint8_t reserved_2[48];
432fcf3ce44SJohn Forte } mrk_entry_t;
433fcf3ce44SJohn Forte 
434fcf3ce44SJohn Forte /*
435fcf3ce44SJohn Forte  * Marker modifiers
436fcf3ce44SJohn Forte  */
437fcf3ce44SJohn Forte #define	MK_SYNC_ID_LUN	0		/* Synchronize ID/LUN */
438fcf3ce44SJohn Forte #define	MK_SYNC_ID	1		/* Synchronize ID */
439fcf3ce44SJohn Forte #define	MK_SYNC_ALL	2		/* Synchronize all ID/LUN */
440fcf3ce44SJohn Forte #define	MK_SYNC_LIP	3		/* Synchronize all ID/LUN, */
441fcf3ce44SJohn Forte 					/* clear port changed, */
442fcf3ce44SJohn Forte 					/* use sequence number. */
443fcf3ce44SJohn Forte /*
444fcf3ce44SJohn Forte  * ISP24xx queue - Marker IOCB structure definition.
445fcf3ce44SJohn Forte  */
446fcf3ce44SJohn Forte typedef struct marker_24xx_entry {
447*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
448*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
449*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
450*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
451fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
452fcf3ce44SJohn Forte 	uint16_t n_port_hdl;
453*4c3888b8SHans Rosenfeld 	uint8_t modifier;		/* Modifier */
454*4c3888b8SHans Rosenfeld 	uint8_t reserved[2];
455*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
456*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[2];
457*4c3888b8SHans Rosenfeld 	uint8_t fcp_lun[8];		/* SCSI LUN ID. */
458*4c3888b8SHans Rosenfeld 	uint8_t reserved_2[40];
459fcf3ce44SJohn Forte } marker_24xx_entry_t;
460fcf3ce44SJohn Forte 
461fcf3ce44SJohn Forte /*
462fcf3ce44SJohn Forte  * ISP queue -	Management Server entry structure definition.
463fcf3ce44SJohn Forte  */
464fcf3ce44SJohn Forte #define	MS_TYPE			0x29
465fcf3ce44SJohn Forte #define	MS_DATA_SEGMENTS	1	/* Number of data segments. */
466fcf3ce44SJohn Forte typedef struct ms_entry {
467*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
468*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
469*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
470*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
471fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
472*4c3888b8SHans Rosenfeld 	uint8_t loop_id_l;		/* device id - LSB */
473*4c3888b8SHans Rosenfeld 	uint8_t loop_id_h;		/* device id - MSB */
474fcf3ce44SJohn Forte 	uint16_t comp_status;		/* Completion status */
475*4c3888b8SHans Rosenfeld 	uint8_t control_flags_l;	/* Control flags - LSB. */
476*4c3888b8SHans Rosenfeld 	uint8_t control_flags_h;	/* Control flags - MSB. */
477*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[2];
478fcf3ce44SJohn Forte 	uint16_t timeout;		/* Command timeout. */
479*4c3888b8SHans Rosenfeld 	uint8_t cmd_dseg_count_l;	/* CMD segment count - LSB. */
480*4c3888b8SHans Rosenfeld 	uint8_t cmd_dseg_count_h;	/* CMD segment count - MSB. */
481fcf3ce44SJohn Forte 	uint16_t total_dseg_count;	/* CMD + RESP segment count. */
482fcf3ce44SJohn Forte 	uint8_t	 reserved_2[10];
483fcf3ce44SJohn Forte 	uint32_t resp_byte_count;	/* Response byte count */
484fcf3ce44SJohn Forte 	uint32_t cmd_byte_count;	/* Command byte count */
485*4c3888b8SHans Rosenfeld 	ql_64bit_data_seg_t	dseg[2];	/* Data segments. */
486fcf3ce44SJohn Forte } ms_entry_t;
487fcf3ce44SJohn Forte 
488*4c3888b8SHans Rosenfeld #define	CF_ELS_PASSTHROUGH	BIT_7	/* MSB */
489*4c3888b8SHans Rosenfeld 
490fcf3ce44SJohn Forte /*
491fcf3ce44SJohn Forte  * ISP24xx queue - CT Pass-Through IOCB structure definition.
492fcf3ce44SJohn Forte  */
493fcf3ce44SJohn Forte #define	CT_PASSTHRU_TYPE		0x29
494fcf3ce44SJohn Forte #define	CT_PASSTHRU_DATA_SEGMENTS	1	/* Number of data segments. */
495fcf3ce44SJohn Forte typedef struct ct_passthru_entry {
496*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
497*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
498*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
499*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
500fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
501fcf3ce44SJohn Forte 	uint16_t status;
502fcf3ce44SJohn Forte 	uint16_t n_port_hdl;
503fcf3ce44SJohn Forte 	uint16_t cmd_dseg_count;
504*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
505*4c3888b8SHans Rosenfeld 	uint8_t reserved;
506fcf3ce44SJohn Forte 	uint16_t timeout;
507fcf3ce44SJohn Forte 	uint16_t reserved_1;
508fcf3ce44SJohn Forte 	uint16_t resp_dseg_count;
509*4c3888b8SHans Rosenfeld 	uint8_t reserved_2[10];
510fcf3ce44SJohn Forte 	uint32_t resp_byte_count;
511fcf3ce44SJohn Forte 	uint32_t cmd_byte_count;
512*4c3888b8SHans Rosenfeld 	ql_64bit_data_seg_t	dseg[2];	/* Data segments. */
513fcf3ce44SJohn Forte } ct_passthru_entry_t;
514fcf3ce44SJohn Forte 
51516dd44c2SDaniel Beauregard /*
51616dd44c2SDaniel Beauregard  * ISP24xx queue - ELS Pass-Through IOCB structure definition.
51716dd44c2SDaniel Beauregard  */
51816dd44c2SDaniel Beauregard #define	ELS_PASSTHRU_TYPE		0x53
51916dd44c2SDaniel Beauregard typedef struct els_passthru_entry {
520*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
521*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
522*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
523*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
52416dd44c2SDaniel Beauregard 	uint32_t handle;		/* System handle */
52516dd44c2SDaniel Beauregard 	uint16_t reserved_8_9;
52616dd44c2SDaniel Beauregard 	uint16_t n_port_hdl;
52716dd44c2SDaniel Beauregard 	uint16_t xmt_dseg_count;	/* Only one allowed */
528*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
529*4c3888b8SHans Rosenfeld 	uint8_t sof_type;
53016dd44c2SDaniel Beauregard 	uint32_t rcv_exch_address;
53116dd44c2SDaniel Beauregard 	uint16_t rcv_dseg_count;
532*4c3888b8SHans Rosenfeld 	uint8_t els_cmd_opcode;
533*4c3888b8SHans Rosenfeld 	uint8_t reserved_17;
534*4c3888b8SHans Rosenfeld 	uint8_t d_id_7_0;
535*4c3888b8SHans Rosenfeld 	uint8_t d_id_15_8;
536*4c3888b8SHans Rosenfeld 	uint8_t d_id_23_16;
537*4c3888b8SHans Rosenfeld 	uint8_t s_id_23_16;
538*4c3888b8SHans Rosenfeld 	uint8_t s_id_7_0;
539*4c3888b8SHans Rosenfeld 	uint8_t s_id_15_8;
54016dd44c2SDaniel Beauregard 	uint16_t control_flags;
54116dd44c2SDaniel Beauregard 	uint32_t rcv_payld_data_bcnt;
54216dd44c2SDaniel Beauregard 	uint32_t xmt_payld_data_bcnt;
543*4c3888b8SHans Rosenfeld 	ql_64bit_data_seg_t	dseg[2];	/* Data segments. */
54416dd44c2SDaniel Beauregard } els_passthru_entry_t;
54516dd44c2SDaniel Beauregard 
54616dd44c2SDaniel Beauregard /*
54716dd44c2SDaniel Beauregard  * ISP24x queue - ELS Pass-Through IOCB response.
54816dd44c2SDaniel Beauregard  */
54916dd44c2SDaniel Beauregard typedef struct els_passthru_entry_rsp {
550*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
551*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
552*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
553*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
55416dd44c2SDaniel Beauregard 	uint32_t handle;		/* System handle */
55516dd44c2SDaniel Beauregard 	uint16_t comp_status;
55616dd44c2SDaniel Beauregard 	uint16_t n_port_hdl;
55716dd44c2SDaniel Beauregard 	uint16_t reserved_c_d;
558*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
559*4c3888b8SHans Rosenfeld 	uint8_t sof_type;
56016dd44c2SDaniel Beauregard 	uint32_t rcv_exch_addr;
56116dd44c2SDaniel Beauregard 	uint16_t reserved_14_15;
562*4c3888b8SHans Rosenfeld 	uint8_t els_cmd_opcode;
563*4c3888b8SHans Rosenfeld 	uint8_t reserved_17;
564*4c3888b8SHans Rosenfeld 	uint8_t d_id_7_0;
565*4c3888b8SHans Rosenfeld 	uint8_t d_id_15_8;
566*4c3888b8SHans Rosenfeld 	uint8_t d_id_23_16;
567*4c3888b8SHans Rosenfeld 	uint8_t s_id_23_16;
568*4c3888b8SHans Rosenfeld 	uint8_t s_id_7_0;
569*4c3888b8SHans Rosenfeld 	uint8_t s_id_15_8;
57016dd44c2SDaniel Beauregard 	uint16_t control_flags;
57116dd44c2SDaniel Beauregard 	uint32_t total_data_bcnt;
57216dd44c2SDaniel Beauregard 	uint32_t error_subcode1;
57316dd44c2SDaniel Beauregard 	uint32_t error_subcode2;
574*4c3888b8SHans Rosenfeld 	uint8_t reserved_2c_3f[20];
57516dd44c2SDaniel Beauregard } els_passthru_entry_rsp_t;
57616dd44c2SDaniel Beauregard 
577fcf3ce44SJohn Forte /*
578fcf3ce44SJohn Forte  * ISP24xx queue - Task Management IOCB structure definition.
579fcf3ce44SJohn Forte  */
580fcf3ce44SJohn Forte #define	TASK_MGMT_TYPE		0x14
581fcf3ce44SJohn Forte typedef struct task_mgmt_entry {
582*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
583*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
584*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
585*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
586fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
587fcf3ce44SJohn Forte 	uint16_t n_port_hdl;
588fcf3ce44SJohn Forte 	uint16_t reserved;
589fcf3ce44SJohn Forte 	uint16_t delay;
590fcf3ce44SJohn Forte 	uint16_t timeout;
591*4c3888b8SHans Rosenfeld 	uint8_t fcp_lun[8];		/* SCSI LUN ID. */
592fcf3ce44SJohn Forte 	uint32_t control_flags;
593*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[20];
594*4c3888b8SHans Rosenfeld 	uint8_t target_id[3];		/* SCSI Target ID */
595*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
596*4c3888b8SHans Rosenfeld 	uint8_t reserved_2[12];
597fcf3ce44SJohn Forte } task_mgmt_entry_t;
598fcf3ce44SJohn Forte 
599fcf3ce44SJohn Forte /*
600fcf3ce44SJohn Forte  * Control Flags.
601fcf3ce44SJohn Forte  */
602fcf3ce44SJohn Forte #define	CF_DO_NOT_SEND		BIT_31
603fcf3ce44SJohn Forte #define	CF_LUN_RESET		BIT_4
604fcf3ce44SJohn Forte #define	CF_ABORT_TASK_SET	BIT_3
605fcf3ce44SJohn Forte #define	CF_CLEAR_TASK_SET	BIT_2
606fcf3ce44SJohn Forte #define	CF_TARGET_RESET		BIT_1
607fcf3ce44SJohn Forte #define	CF_CLEAR_ACA		BIT_0
608fcf3ce44SJohn Forte 
609fcf3ce44SJohn Forte /*
610fcf3ce44SJohn Forte  * ISP24xx queue - Abort I/O IOCB structure definition.
611fcf3ce44SJohn Forte  */
612fcf3ce44SJohn Forte #define	ABORT_CMD_TYPE		0x33
613fcf3ce44SJohn Forte typedef struct abort_cmd_entry {
614*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
615*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
616*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
617*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
618fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
619fcf3ce44SJohn Forte 	uint16_t n_port_hdl;		/* also comp_status */
620*4c3888b8SHans Rosenfeld 	uint8_t options;
621*4c3888b8SHans Rosenfeld 	uint8_t options_h;
622fcf3ce44SJohn Forte 	uint32_t cmd_handle;
623*4c3888b8SHans Rosenfeld 	uint8_t reserved[32];
624*4c3888b8SHans Rosenfeld 	uint8_t target_id[3];		/* Port ID */
625*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
626*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[12];
627fcf3ce44SJohn Forte } abort_cmd_entry_t;
628fcf3ce44SJohn Forte 
629fcf3ce44SJohn Forte /*
630fcf3ce44SJohn Forte  * Option Flags.
631fcf3ce44SJohn Forte  */
632fcf3ce44SJohn Forte #define	AF_NO_ABTS		BIT_0
633fcf3ce44SJohn Forte 
634fcf3ce44SJohn Forte /*
635fcf3ce44SJohn Forte  * ISP24xx queue - Login/Logout Port IOCB structure definition.
636fcf3ce44SJohn Forte  */
637fcf3ce44SJohn Forte #define	LOG_TYPE		0x52
638fcf3ce44SJohn Forte typedef struct log_entry {
639*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
640*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
641*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
642*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
643fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
644fcf3ce44SJohn Forte 	uint16_t status;
645fcf3ce44SJohn Forte 	uint16_t n_port_hdl;
646fcf3ce44SJohn Forte 	uint16_t control_flags;
647*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
648*4c3888b8SHans Rosenfeld 	uint8_t reserved;
649*4c3888b8SHans Rosenfeld 	uint8_t port_id[3];
650*4c3888b8SHans Rosenfeld 	uint8_t rsp_size;
651fcf3ce44SJohn Forte 	uint32_t io_param[11];
652fcf3ce44SJohn Forte } log_entry_t;
653fcf3ce44SJohn Forte 
654fcf3ce44SJohn Forte /*
655fcf3ce44SJohn Forte  * ISP24xx control flag commands
656fcf3ce44SJohn Forte  */
657fcf3ce44SJohn Forte #define	CF_CMD_PLOGI	0x00
658fcf3ce44SJohn Forte #define	CF_CMD_PRLI	0x01
659fcf3ce44SJohn Forte #define	CF_CMD_PDISC	0x02
660fcf3ce44SJohn Forte #define	CF_CMD_ADISC	0x03
661fcf3ce44SJohn Forte #define	CF_CMD_LOGO	0x08
662fcf3ce44SJohn Forte #define	CF_CMD_PRLO	0x09
663fcf3ce44SJohn Forte #define	CF_CMD_TPRLO	0x0A
664fcf3ce44SJohn Forte 
665fcf3ce44SJohn Forte /*
666fcf3ce44SJohn Forte  * ISP24xx control flag command options
667fcf3ce44SJohn Forte  */
668fcf3ce44SJohn Forte #define	CFO_COND_PLOGI		BIT_4
669fcf3ce44SJohn Forte #define	CFO_SKIP_PRLI		BIT_5
670fcf3ce44SJohn Forte #define	CFO_COMMON_FEATURES	BIT_7
671fcf3ce44SJohn Forte #define	CFO_CLASS_2		BIT_8
672fcf3ce44SJohn Forte #define	CFO_FCP_2_OVR		BIT_9
673fcf3ce44SJohn Forte 
674fcf3ce44SJohn Forte #define	CFO_IMPLICIT_LOGO	BIT_4
675fcf3ce44SJohn Forte #define	CFO_IMPLICIT_LOGO_ALL	BIT_5
676fcf3ce44SJohn Forte #define	CFO_EXPLICIT_LOGO	BIT_6
677fcf3ce44SJohn Forte #define	CFO_FREE_N_PORT_HANDLE	BIT_7
678fcf3ce44SJohn Forte 
679fcf3ce44SJohn Forte #define	CFO_IMPLICIT_PRLO	BIT_4
680fcf3ce44SJohn Forte 
681fcf3ce44SJohn Forte /*
682fcf3ce44SJohn Forte  * ISP24xx Login/Logout Status Sub Codes in in I/O Parameter 0 field.
683fcf3ce44SJohn Forte  */
684fcf3ce44SJohn Forte #define	CS0_NO_LINK			0x01
685fcf3ce44SJohn Forte #define	CS0_NO_IOCB			0x02
686fcf3ce44SJohn Forte #define	CS0_NO_EXCH_CTRL_BLK		0x03
687fcf3ce44SJohn Forte #define	CS0_COMMAND_FAILED		0x04
688fcf3ce44SJohn Forte #define	CS0_NO_FABRIC_PRESENT		0x05
689fcf3ce44SJohn Forte #define	CS0_FIRMWARE_NOT_READY		0x07
690fcf3ce44SJohn Forte #define	CS0_PORT_NOT_LOGGED_IN		0x09
691fcf3ce44SJohn Forte #define	CS0_NO_PCB_ALLOCATED		0x0A
692fcf3ce44SJohn Forte #define	CS0_ELS_REJECT_RECEIVED		0x18
693fcf3ce44SJohn Forte #define	CS0_CMD_PARAMETER_ERROR		0x19
694fcf3ce44SJohn Forte #define	CS0_PORT_ID_USED		0x1A
695fcf3ce44SJohn Forte #define	CS0_N_PORT_HANDLE_USED		0x1B
696fcf3ce44SJohn Forte #define	CS0_NO_N_PORT_HANDLE_AVAILABLE	0x1C
697fcf3ce44SJohn Forte #define	CS0_NO_FLOGI_ACC		0x1F
698fcf3ce44SJohn Forte 
699fcf3ce44SJohn Forte /*
700fcf3ce44SJohn Forte  * ISP24xx Login/Logout Status Sub Codes in in I/O Parameter 1 field.
701fcf3ce44SJohn Forte  */
702fcf3ce44SJohn Forte #define	CS1_PLOGI_FAILED		0x02
703fcf3ce44SJohn Forte #define	CS1_PLOGI_RESPONSE_FAILED	0x03
704fcf3ce44SJohn Forte #define	CS1_PRLI_FAILED			0x04
705fcf3ce44SJohn Forte #define	CS1_PRLI_RESPONSE_FAILED	0x05
706fcf3ce44SJohn Forte #define	CS1_COMMAND_LOGGED_OUT		0x07
707fcf3ce44SJohn Forte 
708fcf3ce44SJohn Forte /*
709fcf3ce44SJohn Forte  * ISP queue -	Enable LUN with extended LUN support
710fcf3ce44SJohn Forte  *		entry structure definition.
711fcf3ce44SJohn Forte  */
712fcf3ce44SJohn Forte #define	ENABLE_LUN_TYPE	0xB		/* Enable LUN entry */
713fcf3ce44SJohn Forte typedef struct enable_lun_entry {
714*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
715*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
716*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
717*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
718fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
719*4c3888b8SHans Rosenfeld 	uint8_t reserved[8];
720*4c3888b8SHans Rosenfeld 	uint8_t status;
721*4c3888b8SHans Rosenfeld 	uint8_t reserved_1;
722*4c3888b8SHans Rosenfeld 	uint8_t command_count;
723*4c3888b8SHans Rosenfeld 	uint8_t immediate_notify_count;
724*4c3888b8SHans Rosenfeld 	uint8_t reserved_2[2];
725*4c3888b8SHans Rosenfeld 	uint8_t timeout_l;		/* Timeout - LSB. */
726*4c3888b8SHans Rosenfeld 	uint8_t timeout_h;		/* Timeout - MSB. */
727*4c3888b8SHans Rosenfeld 	uint8_t reserved_3[40];
728fcf3ce44SJohn Forte } enable_lun_entry_t;
729fcf3ce44SJohn Forte 
730fcf3ce44SJohn Forte /*
731fcf3ce44SJohn Forte  * ISP queue -	Modify LUN with extended LUN support
732fcf3ce44SJohn Forte  *		entry structure definition.
733fcf3ce44SJohn Forte  */
734fcf3ce44SJohn Forte #define	MODIFY_LUN_TYPE	0xC		/* Modify LUN entry */
735fcf3ce44SJohn Forte typedef struct modify_lun_entry {
736*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
737*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
738*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
739*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
740fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
741*4c3888b8SHans Rosenfeld 	uint8_t reserved[2];
742*4c3888b8SHans Rosenfeld 	uint8_t operators;
743*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[5];
744*4c3888b8SHans Rosenfeld 	uint8_t status;
745*4c3888b8SHans Rosenfeld 	uint8_t reserved_2;
746*4c3888b8SHans Rosenfeld 	uint8_t command_count;
747*4c3888b8SHans Rosenfeld 	uint8_t immediate_notify_count;
748*4c3888b8SHans Rosenfeld 	uint8_t reserved_3[2];
749*4c3888b8SHans Rosenfeld 	uint8_t timeout_l;		/* Timeout - LSB. */
750*4c3888b8SHans Rosenfeld 	uint8_t timeout_h;		/* Timeout - MSB. */
751*4c3888b8SHans Rosenfeld 	uint8_t reserved_4[40];
752fcf3ce44SJohn Forte } modify_lun_entry_t;
753fcf3ce44SJohn Forte 
754fcf3ce44SJohn Forte /*
755fcf3ce44SJohn Forte  * ISP queue -	Immediate Notify with extended LUN support
756fcf3ce44SJohn Forte  *		entry structure definition.
757fcf3ce44SJohn Forte  */
758fcf3ce44SJohn Forte #define	IMMEDIATE_NOTIFY_TYPE	0xD	/* Immediate notify entry */
759fcf3ce44SJohn Forte typedef struct immediate_notify_entry {
760*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
761*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
762*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
763*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
764fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
765*4c3888b8SHans Rosenfeld 	uint8_t initiator_id_l;
766*4c3888b8SHans Rosenfeld 	uint8_t initiator_id_h;
767*4c3888b8SHans Rosenfeld 	uint8_t lun_l;
768*4c3888b8SHans Rosenfeld 	uint8_t lun_h;
769*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[4];
770fcf3ce44SJohn Forte 	uint16_t status;
771*4c3888b8SHans Rosenfeld 	uint8_t task_flags_l;
772*4c3888b8SHans Rosenfeld 	uint8_t task_flags_h;
773fcf3ce44SJohn Forte 	uint16_t sequence_id;
774*4c3888b8SHans Rosenfeld 	uint8_t reserved_3[40];
775fcf3ce44SJohn Forte 	uint16_t ox_id;
776fcf3ce44SJohn Forte } immediate_notify_entry_t;
777fcf3ce44SJohn Forte 
778fcf3ce44SJohn Forte /*
779fcf3ce44SJohn Forte  * ISP24xx queue - Immediate Notify IOCB structure definition.
780fcf3ce44SJohn Forte  */
781fcf3ce44SJohn Forte typedef struct immd_notify_24xx_entry {
782*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
783*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
784*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
785*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
786fcf3ce44SJohn Forte 	uint32_t reserved;
787fcf3ce44SJohn Forte 	uint16_t n_port_hdl;
788fcf3ce44SJohn Forte 	uint16_t reserved_1;
789fcf3ce44SJohn Forte 	uint16_t flags;
790fcf3ce44SJohn Forte 	uint16_t srr_rx_id;
791fcf3ce44SJohn Forte 	uint16_t status;
792*4c3888b8SHans Rosenfeld 	uint8_t status_subcode;
793*4c3888b8SHans Rosenfeld 	uint8_t reserved_2;
794fcf3ce44SJohn Forte 	uint32_t receive_exchange_address;
795fcf3ce44SJohn Forte 	uint32_t srr_relative_offset;
796fcf3ce44SJohn Forte 	uint16_t srr_iu;
797fcf3ce44SJohn Forte 	uint16_t srr_ox_id;
798*4c3888b8SHans Rosenfeld 	uint8_t reserved_3[19];
799*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
800*4c3888b8SHans Rosenfeld 	uint8_t reserved_4[10];
801fcf3ce44SJohn Forte 	uint16_t ox_id;
802fcf3ce44SJohn Forte } immd_notify_24xx_entry_t;
803fcf3ce44SJohn Forte 
804fcf3ce44SJohn Forte /*
805fcf3ce44SJohn Forte  * ISP queue -	Notify Acknowledge extended LUN support
806fcf3ce44SJohn Forte  *		entry structure definition.
807fcf3ce44SJohn Forte  */
808fcf3ce44SJohn Forte #define	NOTIFY_ACKNOWLEDGE_TYPE	0xE	/* Immediate notify entry */
809fcf3ce44SJohn Forte typedef struct notify_acknowledge_entry {
810*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
811*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
812*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
813*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
814fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
815*4c3888b8SHans Rosenfeld 	uint8_t initiator_id_l;
816*4c3888b8SHans Rosenfeld 	uint8_t initiator_id_h;
817*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[2];
818*4c3888b8SHans Rosenfeld 	uint8_t flags_l;
819*4c3888b8SHans Rosenfeld 	uint8_t flags_h;
820*4c3888b8SHans Rosenfeld 	uint8_t reserved_2[2];
821fcf3ce44SJohn Forte 	uint16_t status;
822*4c3888b8SHans Rosenfeld 	uint8_t task_flags_l;
823*4c3888b8SHans Rosenfeld 	uint8_t task_flags_h;
824fcf3ce44SJohn Forte 	uint16_t sequence_id;
825*4c3888b8SHans Rosenfeld 	uint8_t reserved_3[42];
826fcf3ce44SJohn Forte } notify_acknowledge_entry_t;
827fcf3ce44SJohn Forte 
828fcf3ce44SJohn Forte /*
829fcf3ce44SJohn Forte  * ISP24xx queue - Notify Acknowledge IOCB structure definition.
830fcf3ce44SJohn Forte  */
831fcf3ce44SJohn Forte typedef struct notify_ack_24xx_entry {
832*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
833*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
834*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
835*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
836fcf3ce44SJohn Forte 	uint32_t handle;
837fcf3ce44SJohn Forte 	uint16_t n_port_hdl;
838fcf3ce44SJohn Forte 	uint16_t reserved_1;
839fcf3ce44SJohn Forte 	uint16_t flags;
840fcf3ce44SJohn Forte 	uint16_t srr_rx_id;
841fcf3ce44SJohn Forte 	uint16_t status;
842*4c3888b8SHans Rosenfeld 	uint8_t status_subcode;
843*4c3888b8SHans Rosenfeld 	uint8_t reserved_2;
844fcf3ce44SJohn Forte 	uint32_t receive_exchange_address;
845fcf3ce44SJohn Forte 	uint32_t srr_relative_offset;
846fcf3ce44SJohn Forte 	uint16_t srr_iu;
847fcf3ce44SJohn Forte 	uint16_t srr_flags;
848*4c3888b8SHans Rosenfeld 	uint8_t reserved_3[19];
849*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
850*4c3888b8SHans Rosenfeld 	uint8_t srr_reject_vendor_unique;
851*4c3888b8SHans Rosenfeld 	uint8_t srr_reject_code_explanation;
852*4c3888b8SHans Rosenfeld 	uint8_t srr_reject_code;
853*4c3888b8SHans Rosenfeld 	uint8_t reserved_4[7];
854fcf3ce44SJohn Forte 	uint16_t ox_id;
855fcf3ce44SJohn Forte } notify_ack_24xx_entry_t;
856fcf3ce44SJohn Forte 
857fcf3ce44SJohn Forte /*
858fcf3ce44SJohn Forte  * ISP queue -	Accept Target I/O with extended LUN support
859fcf3ce44SJohn Forte  *		entry structure definition.
860fcf3ce44SJohn Forte  */
861fcf3ce44SJohn Forte #define	ATIO_TYPE	0x16			/* ATIO entry */
862fcf3ce44SJohn Forte typedef struct atio_entry {
863fcf3ce44SJohn Forte 	uint8_t		entry_type;		/* Entry type. */
864fcf3ce44SJohn Forte 	uint8_t		entry_count;		/* Entry count. */
865fcf3ce44SJohn Forte 	uint8_t		sys_define;		/* System defined. */
866fcf3ce44SJohn Forte 	uint8_t		entry_status;		/* Entry Status. */
867fcf3ce44SJohn Forte 	uint32_t	handle;			/* System handle */
868fcf3ce44SJohn Forte 	uint8_t		initiator_id_l;
869fcf3ce44SJohn Forte 	uint8_t		initiator_id_h;
870fcf3ce44SJohn Forte 	uint16_t	rx_id;
871fcf3ce44SJohn Forte 	uint8_t		flags_l;
872fcf3ce44SJohn Forte 	uint8_t		flags_h;
873fcf3ce44SJohn Forte 	uint16_t	status;
874fcf3ce44SJohn Forte 	uint8_t		reserved_1;
875fcf3ce44SJohn Forte 	uint8_t		task_codes : 3,
876fcf3ce44SJohn Forte 			reserved_2 : 5;
877fcf3ce44SJohn Forte 	uint8_t		task_flags;
878fcf3ce44SJohn Forte 	uint8_t		execution_codes;
879fcf3ce44SJohn Forte 	uint8_t		cdb[MAX_CMDSZ];
880fcf3ce44SJohn Forte 	uint32_t	data_length;
881fcf3ce44SJohn Forte 	uint8_t		lun_l;
882fcf3ce44SJohn Forte 	uint8_t		lun_h;
883fcf3ce44SJohn Forte 	uint8_t		reserved_3[20];
884fcf3ce44SJohn Forte 	uint16_t	ox_id;
885fcf3ce44SJohn Forte } atio_entry_t;
886fcf3ce44SJohn Forte 
887fcf3ce44SJohn Forte /*
888fcf3ce44SJohn Forte  * ISP24xx queue - Accept Target I/O IOCB structure definition.
889fcf3ce44SJohn Forte  */
890fcf3ce44SJohn Forte #define	ATIO_24xx_TYPE		0x06
891fcf3ce44SJohn Forte typedef struct atio_24xx_entry {
892*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
893*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
894fcf3ce44SJohn Forte 	uint16_t len_attr;		/* System defined. */
895fcf3ce44SJohn Forte 	uint32_t receive_exchange_address;
896*4c3888b8SHans Rosenfeld 	uint8_t frame_hdr[24];
897*4c3888b8SHans Rosenfeld 	uint8_t payload[32];
898fcf3ce44SJohn Forte } atio_24xx_entry_t;
899fcf3ce44SJohn Forte 
900fcf3ce44SJohn Forte /*
901fcf3ce44SJohn Forte  * ISP queue -	Continue Target I/O with extended LUN support
902fcf3ce44SJohn Forte  *		entry structure definition.
903fcf3ce44SJohn Forte  */
904*4c3888b8SHans Rosenfeld #define	CTIO_TYPE_2	0x17
905*4c3888b8SHans Rosenfeld #define	CTIO_TYPE_3	0x1F
906fcf3ce44SJohn Forte typedef struct ctio_entry {
907*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
908*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
909*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
910*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
911fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
912*4c3888b8SHans Rosenfeld 	uint8_t initiator_id_l;
913*4c3888b8SHans Rosenfeld 	uint8_t initiator_id_h;
914fcf3ce44SJohn Forte 	uint16_t rx_id;
915*4c3888b8SHans Rosenfeld 	uint8_t flags_l;
916*4c3888b8SHans Rosenfeld 	uint8_t flags_h;
917fcf3ce44SJohn Forte 	uint16_t status;
918fcf3ce44SJohn Forte 	uint16_t timeout;
919*4c3888b8SHans Rosenfeld 	uint8_t dseg_count_l;
920*4c3888b8SHans Rosenfeld 	uint8_t dseg_count_h;
921fcf3ce44SJohn Forte 	uint32_t relative_offset;
922fcf3ce44SJohn Forte 	uint32_t residual_transfer_length;
923*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[4];
924fcf3ce44SJohn Forte 
925fcf3ce44SJohn Forte 	union {
926fcf3ce44SJohn Forte 		struct {
927*4c3888b8SHans Rosenfeld 			uint8_t reserved_2[2];
928*4c3888b8SHans Rosenfeld 			uint8_t scsi_status_l;
929*4c3888b8SHans Rosenfeld 			uint8_t scsi_status_h;
930fcf3ce44SJohn Forte 			uint32_t byte_count;
931*4c3888b8SHans Rosenfeld 			ql_32bit_data_seg_t	dseg[3];
932fcf3ce44SJohn Forte 		}s0_32bit;
933fcf3ce44SJohn Forte 
934fcf3ce44SJohn Forte 		struct {
935*4c3888b8SHans Rosenfeld 			uint8_t reserved_3[2];
936*4c3888b8SHans Rosenfeld 			uint8_t scsi_status_l;
937*4c3888b8SHans Rosenfeld 			uint8_t scsi_status_h;
938fcf3ce44SJohn Forte 			uint32_t byte_count;
939*4c3888b8SHans Rosenfeld 			ql_64bit_data_seg_t	dseg[2];
940fcf3ce44SJohn Forte 		}s0_64bit;
941fcf3ce44SJohn Forte 
942fcf3ce44SJohn Forte 		struct {
943*4c3888b8SHans Rosenfeld 			uint8_t sense_length_l;
944*4c3888b8SHans Rosenfeld 			uint8_t sense_length_h;
945*4c3888b8SHans Rosenfeld 			uint8_t scsi_status_l;
946*4c3888b8SHans Rosenfeld 			uint8_t scsi_status_h;
947*4c3888b8SHans Rosenfeld 			uint8_t response_length_l;
948*4c3888b8SHans Rosenfeld 			uint8_t response_length_h;
949*4c3888b8SHans Rosenfeld 			uint8_t response_info[26];
950fcf3ce44SJohn Forte 		}s1;
951fcf3ce44SJohn Forte 
952fcf3ce44SJohn Forte 		struct {
953*4c3888b8SHans Rosenfeld 			uint8_t reserved_4[2];
954fcf3ce44SJohn Forte 			uint32_t response_length;
955fcf3ce44SJohn Forte 			uint32_t response_pointer;
956*4c3888b8SHans Rosenfeld 			uint8_t reserved[16];
957fcf3ce44SJohn Forte 		}s2;
958fcf3ce44SJohn Forte 	}type;
959fcf3ce44SJohn Forte } ctio_entry_t;
960fcf3ce44SJohn Forte 
961fcf3ce44SJohn Forte /*
962fcf3ce44SJohn Forte  * ISP24xx queue -	Continue Target I/O IOCBs from the System
963fcf3ce44SJohn Forte  *		Target Driver structure definition.
964fcf3ce44SJohn Forte  */
965fcf3ce44SJohn Forte #define	CTIO_24xx_TYPE		0x12
966fcf3ce44SJohn Forte typedef struct ctio_snd_entry {
967*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
968*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
969*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
970*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
971fcf3ce44SJohn Forte 	uint32_t handle;
972fcf3ce44SJohn Forte 	uint16_t n_port_hdl;
973fcf3ce44SJohn Forte 	uint16_t timeout;
974fcf3ce44SJohn Forte 	uint16_t dseg_count;
975*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
976*4c3888b8SHans Rosenfeld 	uint8_t flags;
977fcf3ce44SJohn Forte 	uint8_t initiator_id[3];
978*4c3888b8SHans Rosenfeld 	uint8_t reserved_1;
979fcf3ce44SJohn Forte 	uint32_t receive_exchange_address;
980fcf3ce44SJohn Forte 
981fcf3ce44SJohn Forte 	union {
982fcf3ce44SJohn Forte 		struct {
983fcf3ce44SJohn Forte 			uint16_t reserved_2;
984fcf3ce44SJohn Forte 			uint16_t flags;
985fcf3ce44SJohn Forte 			uint32_t residual_length;
986fcf3ce44SJohn Forte 			uint16_t ox_id;
987fcf3ce44SJohn Forte 			uint16_t scsi_status;
988fcf3ce44SJohn Forte 			uint32_t relative_offset;
989fcf3ce44SJohn Forte 			uint32_t reserved_3;
990fcf3ce44SJohn Forte 			uint32_t transfer_length;
991fcf3ce44SJohn Forte 			uint32_t reserved_4;
992*4c3888b8SHans Rosenfeld 			ql_64bit_data_seg_t	dseg;
993fcf3ce44SJohn Forte 		}s0;
994fcf3ce44SJohn Forte 
995fcf3ce44SJohn Forte 		struct {
996fcf3ce44SJohn Forte 			uint16_t sense_length;
997fcf3ce44SJohn Forte 			uint16_t flags;
998fcf3ce44SJohn Forte 			uint32_t residual_length;
999fcf3ce44SJohn Forte 			uint16_t ox_id;
1000fcf3ce44SJohn Forte 			uint16_t scsi_status;
1001fcf3ce44SJohn Forte 			uint16_t response_length;
1002fcf3ce44SJohn Forte 			uint16_t reserved_2;
1003*4c3888b8SHans Rosenfeld 			uint8_t rsp_sense_data[24];
1004fcf3ce44SJohn Forte 		}s1;
1005fcf3ce44SJohn Forte 
1006fcf3ce44SJohn Forte 		struct {
1007fcf3ce44SJohn Forte 			uint16_t reserved_2;
1008fcf3ce44SJohn Forte 			uint16_t flags;
1009fcf3ce44SJohn Forte 			uint32_t residual_length;
1010fcf3ce44SJohn Forte 			uint16_t ox_id;
1011*4c3888b8SHans Rosenfeld 			uint8_t reserved_3[10];
1012fcf3ce44SJohn Forte 			uint32_t transfer_length;
1013fcf3ce44SJohn Forte 			uint32_t reserved_4;
1014*4c3888b8SHans Rosenfeld 			ql_64bit_data_seg_t	dseg;
1015fcf3ce44SJohn Forte 		}s2;
1016fcf3ce44SJohn Forte 	}type;
1017fcf3ce44SJohn Forte } ctio_snd_entry_t;
1018fcf3ce44SJohn Forte 
1019fcf3ce44SJohn Forte /*
1020fcf3ce44SJohn Forte  * ISP24xx queue -	Continue Target I/O IOCBs from the ISP24xx
1021fcf3ce44SJohn Forte  *		Firmware structure definition.
1022fcf3ce44SJohn Forte  */
1023fcf3ce44SJohn Forte typedef struct ctio_rcv_entry {
1024*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
1025*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
1026*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
1027*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
1028fcf3ce44SJohn Forte 	uint32_t handle;
1029fcf3ce44SJohn Forte 	uint16_t status;
1030fcf3ce44SJohn Forte 	uint16_t timeout;
1031fcf3ce44SJohn Forte 	uint16_t dseg_count;
1032*4c3888b8SHans Rosenfeld 	uint8_t reserved[6];
1033fcf3ce44SJohn Forte 
1034*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
1035*4c3888b8SHans Rosenfeld 	uint8_t flags;
1036fcf3ce44SJohn Forte 	uint8_t initiator_id[3];
1037*4c3888b8SHans Rosenfeld 	uint8_t reserved_1;
1038fcf3ce44SJohn Forte 	uint32_t receive_exchange_address;
1039fcf3ce44SJohn Forte 
1040fcf3ce44SJohn Forte 	union {
1041fcf3ce44SJohn Forte 		struct {
1042fcf3ce44SJohn Forte 			uint16_t reserved_2;
1043fcf3ce44SJohn Forte 			uint16_t flags;
1044fcf3ce44SJohn Forte 			uint32_t residual_length;
1045fcf3ce44SJohn Forte 			uint16_t ox_id;
1046fcf3ce44SJohn Forte 			uint16_t scsi_status;
1047fcf3ce44SJohn Forte 			uint32_t relative_offset;
1048fcf3ce44SJohn Forte 			uint32_t reserved_3;
1049fcf3ce44SJohn Forte 			uint32_t transfer_length;
1050fcf3ce44SJohn Forte 			uint32_t reserved_4;
1051*4c3888b8SHans Rosenfeld 			ql_64bit_data_seg_t	dseg;
1052fcf3ce44SJohn Forte 		}s0;
1053fcf3ce44SJohn Forte 
1054fcf3ce44SJohn Forte 		struct {
1055fcf3ce44SJohn Forte 			uint16_t sense_length;
1056fcf3ce44SJohn Forte 			uint16_t flags;
1057fcf3ce44SJohn Forte 			uint32_t residual_length;
1058fcf3ce44SJohn Forte 			uint16_t ox_id;
1059fcf3ce44SJohn Forte 			uint16_t scsi_status;
1060fcf3ce44SJohn Forte 			uint16_t response_length;
1061fcf3ce44SJohn Forte 			uint16_t reserved_2;
1062*4c3888b8SHans Rosenfeld 			uint8_t rsp_sense_data[24];
1063fcf3ce44SJohn Forte 		}s1;
1064fcf3ce44SJohn Forte 
1065fcf3ce44SJohn Forte 		struct {
1066fcf3ce44SJohn Forte 			uint16_t reserved_2;
1067fcf3ce44SJohn Forte 			uint16_t flags;
1068fcf3ce44SJohn Forte 			uint32_t residual_length;
1069fcf3ce44SJohn Forte 			uint16_t ox_id;
1070*4c3888b8SHans Rosenfeld 			uint8_t reserved_3[10];
1071fcf3ce44SJohn Forte 			uint32_t transfer_length;
1072fcf3ce44SJohn Forte 			uint32_t reserved_4;
1073*4c3888b8SHans Rosenfeld 			ql_64bit_data_seg_t	dseg;
1074fcf3ce44SJohn Forte 		}s2;
1075fcf3ce44SJohn Forte 	}type;
1076fcf3ce44SJohn Forte } ctio_rcv_entry_t;
1077fcf3ce44SJohn Forte 
1078fcf3ce44SJohn Forte /*
1079fcf3ce44SJohn Forte  * ISP queue -	32-Bit DMA addressing IP entry structure definition.
1080fcf3ce44SJohn Forte  */
1081fcf3ce44SJohn Forte #define	IP_TYPE			0x13
1082fcf3ce44SJohn Forte #define	IP_DATA_SEGMENTS	3	/* Number of data segments. */
1083fcf3ce44SJohn Forte typedef struct ip_entry {
1084*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
1085*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
1086*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
1087*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
1088fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
1089*4c3888b8SHans Rosenfeld 	uint8_t loop_id_l;		/* device id - LSB */
1090*4c3888b8SHans Rosenfeld 	uint8_t loop_id_h;		/* device id - MSB */
1091fcf3ce44SJohn Forte 	uint16_t comp_status;		/* Completion status. */
1092*4c3888b8SHans Rosenfeld 	uint8_t control_flags_l;	/* Control flags - LSB. */
1093*4c3888b8SHans Rosenfeld 	uint8_t control_flags_h;	/* Control flags - MSB. */
1094*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[2];
1095fcf3ce44SJohn Forte 	uint16_t timeout;		/* Command timeout. */
1096fcf3ce44SJohn Forte 	uint16_t dseg_count;		/* Data segment count. */
1097*4c3888b8SHans Rosenfeld 	uint8_t reserved_2[16];
1098fcf3ce44SJohn Forte 	uint32_t byte_count;		/* Total byte count. */
1099*4c3888b8SHans Rosenfeld 	ql_32bit_data_seg_t	dseg[3];	/* Data segments. */
1100fcf3ce44SJohn Forte } ip_entry_t;
1101fcf3ce44SJohn Forte 
1102fcf3ce44SJohn Forte /*
1103fcf3ce44SJohn Forte  * ISP queue -	64-Bit DMA addressing IP entry structure definition.
1104fcf3ce44SJohn Forte  */
1105fcf3ce44SJohn Forte #define	IP_A64_TYPE		0x1B
1106fcf3ce44SJohn Forte #define	IP_A64_DATA_SEGMENTS	2	/* Number of data segments. */
1107fcf3ce44SJohn Forte typedef struct ip_a64_entry {
1108*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
1109*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
1110*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
1111*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
1112fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
1113*4c3888b8SHans Rosenfeld 	uint8_t reserved;
1114*4c3888b8SHans Rosenfeld 	uint8_t loop_id;		/* Loop ID */
1115fcf3ce44SJohn Forte 	uint16_t comp_status;		/* Completion status. */
1116*4c3888b8SHans Rosenfeld 	uint8_t control_flags_l;	/* Control flags - LSB. */
1117*4c3888b8SHans Rosenfeld 	uint8_t control_flags_h;	/* Control flags - MSB. */
1118*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[2];
1119fcf3ce44SJohn Forte 	uint16_t timeout;		/* Command timeout. */
1120fcf3ce44SJohn Forte 	uint16_t dseg_count;		/* Data segment count. */
1121*4c3888b8SHans Rosenfeld 	uint8_t reserved_2[16];
1122fcf3ce44SJohn Forte 	uint32_t byte_count;		/* Total byte count. */
1123*4c3888b8SHans Rosenfeld 	ql_64bit_data_seg_t	dseg[2];	/* Data segments. */
1124fcf3ce44SJohn Forte } ip_a64_entry_t;
1125fcf3ce44SJohn Forte 
1126fcf3ce44SJohn Forte /*
1127fcf3ce44SJohn Forte  * ISP24xx queue - IP command entry structure definition.
1128fcf3ce44SJohn Forte  */
1129fcf3ce44SJohn Forte #define	IP_CMD_TYPE		0x3B
1130fcf3ce44SJohn Forte #define	IP_CMD_DATA_SEGMENTS	1
1131fcf3ce44SJohn Forte typedef struct ip_cmd_entry {
1132*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
1133*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
1134*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
1135*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
1136fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle. */
1137fcf3ce44SJohn Forte 	uint16_t hdl_status;		/* N_port hdl or Completion status */
1138fcf3ce44SJohn Forte 	uint16_t timeout_hdl;		/* N_port hdl or Command timeout */
1139fcf3ce44SJohn Forte 	uint16_t dseg_count;		/* Data segment count. */
1140*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[6];
1141fcf3ce44SJohn Forte 	uint32_t exch_addr;
1142fcf3ce44SJohn Forte 	uint16_t control_flags;
1143fcf3ce44SJohn Forte 	uint16_t frame_hdr_cntrl_flgs;
1144*4c3888b8SHans Rosenfeld 	uint8_t reserved_2[12];
1145fcf3ce44SJohn Forte 	uint32_t sys_define_2;
1146fcf3ce44SJohn Forte 	uint32_t byte_count;		/* Total byte count. */
1147*4c3888b8SHans Rosenfeld 	uint8_t reserved_3[4];
1148*4c3888b8SHans Rosenfeld 	ql_64bit_data_seg_t	dseg;	/* Data segments. */
1149fcf3ce44SJohn Forte } ip_cmd_entry_t;
1150fcf3ce44SJohn Forte 
1151fcf3ce44SJohn Forte /*
1152fcf3ce44SJohn Forte  * IP command Control Flags.
1153fcf3ce44SJohn Forte  */
1154fcf3ce44SJohn Forte #define	IPCF_TERMINATE_EXCH	BIT_1
1155fcf3ce44SJohn Forte /*
1156fcf3ce44SJohn Forte  * IP command Frame Header Control Flags.
1157fcf3ce44SJohn Forte  */
1158fcf3ce44SJohn Forte #define	IPCF_FIRST_SEQ		BIT_5
1159fcf3ce44SJohn Forte #define	IPCF_LAST_SEQ		BIT_4
1160fcf3ce44SJohn Forte 
1161fcf3ce44SJohn Forte /*
1162fcf3ce44SJohn Forte  * ISP queue - Receive IP buffer entry structure definition.
1163fcf3ce44SJohn Forte  */
1164fcf3ce44SJohn Forte #define	IP_RCVBUF_HANDLES	24	/* Buffer handles in entry. */
1165fcf3ce44SJohn Forte #define	IP_RECEIVE_TYPE		0x23	/* IP receive entry */
1166fcf3ce44SJohn Forte typedef struct ip_rcv_entry {
1167*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
1168*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
1169*4c3888b8SHans Rosenfeld 	uint8_t segment_count;		/* Segment count. */
1170*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
1171*4c3888b8SHans Rosenfeld 	uint8_t s_id[3];		/* Source ID. */
1172*4c3888b8SHans Rosenfeld 	uint8_t reserved[2];
1173*4c3888b8SHans Rosenfeld 	uint8_t loop_id;		/* Loop ID */
1174fcf3ce44SJohn Forte 	uint16_t comp_status;		/* Completion status. */
1175*4c3888b8SHans Rosenfeld 	uint8_t class_of_srv_l;	/* Class of service - LSB. */
1176*4c3888b8SHans Rosenfeld 	uint8_t class_of_srv_h;	/* Class of service - MSB. */
1177fcf3ce44SJohn Forte 	uint16_t seq_length;		/* Sequence length. */
1178fcf3ce44SJohn Forte 	uint16_t buffer_handle[IP_RCVBUF_HANDLES]; /* Buffer handles. */
1179fcf3ce44SJohn Forte } ip_rcv_entry_t;
1180fcf3ce44SJohn Forte 
1181fcf3ce44SJohn Forte /*
1182fcf3ce44SJohn Forte  * ISP queue - Receive IP buffer continuation entry structure definition.
1183fcf3ce44SJohn Forte  */
1184fcf3ce44SJohn Forte #define	IP_RCVBUF_CONT_HANDLES	30	/* Buffer handles in entry. */
1185fcf3ce44SJohn Forte #define	IP_RECEIVE_CONT_TYPE	0x2B	/* IP receive continuation entry */
1186fcf3ce44SJohn Forte typedef struct ip_rcv_cont_entry {
1187*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
1188*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
1189*4c3888b8SHans Rosenfeld 	uint8_t reserved;
1190*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
1191fcf3ce44SJohn Forte 	uint16_t buffer_handle[IP_RCVBUF_CONT_HANDLES]; /* Buf handles */
1192fcf3ce44SJohn Forte } ip_rcv_cont_entry_t;
1193fcf3ce44SJohn Forte 
1194fcf3ce44SJohn Forte /*
1195fcf3ce44SJohn Forte  * ISP24xx queue - Receive IP buffer entry structure definition.
1196fcf3ce44SJohn Forte  */
1197fcf3ce44SJohn Forte #define	IP_24XX_RCVBUF_HANDLES	4
1198fcf3ce44SJohn Forte #define	IP_24XX_RECEIVE_TYPE	0x3c
1199fcf3ce44SJohn Forte typedef struct ip_rcv_24xx_entry {
1200*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
1201*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
1202*4c3888b8SHans Rosenfeld 	uint8_t segment_count;		/* Segment count. */
1203*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
1204*4c3888b8SHans Rosenfeld 	uint8_t s_id[3];		/* Source ID. */
1205*4c3888b8SHans Rosenfeld 	uint8_t reserved[1];
1206fcf3ce44SJohn Forte 	uint16_t comp_status;		/* Completion status. */
1207fcf3ce44SJohn Forte 	uint16_t n_port_hdl;		/* Loop ID */
1208*4c3888b8SHans Rosenfeld 	uint8_t class_of_srv_l;	/* Class of service - LSB. */
1209*4c3888b8SHans Rosenfeld 	uint8_t class_of_srv_h;	/* Class of service - MSB. */
1210fcf3ce44SJohn Forte 	uint16_t seq_length;		/* Sequence length. */
1211fcf3ce44SJohn Forte 	uint16_t buffer_handle[IP_24XX_RCVBUF_HANDLES]; /* Buffer handles. */
1212fcf3ce44SJohn Forte } ip_rcv_24xx_entry_t;
1213fcf3ce44SJohn Forte 
1214fcf3ce44SJohn Forte /*
1215fcf3ce44SJohn Forte  * ISP receive buffer container structure definition.
1216fcf3ce44SJohn Forte  */
1217fcf3ce44SJohn Forte typedef struct rcvbuf {
1218fcf3ce44SJohn Forte 	uint32_t bufp[2];		/* Buffer pointer. */
1219fcf3ce44SJohn Forte 	uint16_t handle;		/* Buffer handle. */
1220fcf3ce44SJohn Forte 	uint16_t reserved;
1221fcf3ce44SJohn Forte } rcvbuf_t;
1222fcf3ce44SJohn Forte 
1223fcf3ce44SJohn Forte /*
1224fcf3ce44SJohn Forte  * ISP24xx queue - IP Load Buffer Pool entry structure definition.
1225fcf3ce44SJohn Forte  */
1226fcf3ce44SJohn Forte #define	IP_POOL_BUFFERS		4
1227fcf3ce44SJohn Forte #define	IP_BUF_POOL_TYPE	0x3d
1228*4c3888b8SHans Rosenfeld typedef struct ip_buf_pool_entry {
1229*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
1230*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
1231*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
1232*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
1233fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
1234fcf3ce44SJohn Forte 	uint16_t status;
1235fcf3ce44SJohn Forte 	uint16_t buffer_pool_id;
1236fcf3ce44SJohn Forte 	uint16_t option;
1237*4c3888b8SHans Rosenfeld 	uint8_t buffer_count;
1238*4c3888b8SHans Rosenfeld 	uint8_t buffer_count_h;
1239fcf3ce44SJohn Forte 	rcvbuf_t buffers[IP_POOL_BUFFERS];
1240fcf3ce44SJohn Forte } ip_buf_pool_entry_t;
1241fcf3ce44SJohn Forte /*
1242fcf3ce44SJohn Forte  * ISP2400 queue - Virtual Port Modify IOCB structure definition.
1243fcf3ce44SJohn Forte  */
1244fcf3ce44SJohn Forte #define	VP_MODIFY_TYPE		0x31
1245fcf3ce44SJohn Forte typedef struct vp_modify_entry {
1246*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
1247*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
1248*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
1249*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
1250fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
1251fcf3ce44SJohn Forte 	uint16_t reserved;
1252fcf3ce44SJohn Forte 	uint16_t status;
1253*4c3888b8SHans Rosenfeld 	uint8_t command;
1254*4c3888b8SHans Rosenfeld 	uint8_t vp_count;
1255*4c3888b8SHans Rosenfeld 	uint8_t first_vp_index;
1256*4c3888b8SHans Rosenfeld 	uint8_t second_vp_index;
1257*4c3888b8SHans Rosenfeld 	uint8_t first_options;
1258*4c3888b8SHans Rosenfeld 	uint8_t first_hard_prev_addr;
1259*4c3888b8SHans Rosenfeld 	uint8_t reserved_2[2];
1260*4c3888b8SHans Rosenfeld 	uint8_t first_port_name[8];
1261*4c3888b8SHans Rosenfeld 	uint8_t first_node_name[8];
1262*4c3888b8SHans Rosenfeld 	uint8_t second_options;
1263*4c3888b8SHans Rosenfeld 	uint8_t second_hard_prev_addr;
1264*4c3888b8SHans Rosenfeld 	uint8_t reserved_3[2];
1265*4c3888b8SHans Rosenfeld 	uint8_t second_port_name[8];
1266*4c3888b8SHans Rosenfeld 	uint8_t second_node_name[8];
1267*4c3888b8SHans Rosenfeld 	uint8_t reserved_4[6];
12684f8b8adcSDaniel Beauregard 	uint16_t fcf_index;
1269fcf3ce44SJohn Forte } vp_modify_entry_t;
1270fcf3ce44SJohn Forte 
1271fcf3ce44SJohn Forte /*
1272fcf3ce44SJohn Forte  * ISP2400 VP modify commands
1273fcf3ce44SJohn Forte  */
1274fcf3ce44SJohn Forte #define	VPM_MODIFY		0x0
1275fcf3ce44SJohn Forte #define	VPM_MODIFY_ENABLE	0x1
1276fcf3ce44SJohn Forte 
1277fcf3ce44SJohn Forte /*
1278fcf3ce44SJohn Forte  * ISP2400 queue - Virtual Port Control IOCB structure definition.
1279fcf3ce44SJohn Forte  */
1280fcf3ce44SJohn Forte #define	VP_CONTROL_TYPE		0x30
1281fcf3ce44SJohn Forte typedef struct vp_control_entry {
1282*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
1283*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
1284*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
1285*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
1286fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
1287fcf3ce44SJohn Forte 	uint16_t vp_index_failed;
1288fcf3ce44SJohn Forte 	uint16_t status;
1289*4c3888b8SHans Rosenfeld 	uint8_t command;
1290*4c3888b8SHans Rosenfeld 	uint8_t command_h;
1291*4c3888b8SHans Rosenfeld 	uint8_t vp_count;
1292*4c3888b8SHans Rosenfeld 	uint8_t vp_count_h;
1293*4c3888b8SHans Rosenfeld 	uint8_t vp_index[16];
1294*4c3888b8SHans Rosenfeld 	uint8_t reserved[30];
12954f8b8adcSDaniel Beauregard 	uint16_t fcf_index;
1296fcf3ce44SJohn Forte } vp_control_entry_t;
1297fcf3ce44SJohn Forte 
1298fcf3ce44SJohn Forte /*
1299fcf3ce44SJohn Forte  * ISP2400 VP control commands
1300fcf3ce44SJohn Forte  */
1301fcf3ce44SJohn Forte #define	VPC_ENABLE		0x0
1302fcf3ce44SJohn Forte #define	VPC_DISABLE		0x8
13035dfd244aSDaniel Beauregard #define	VPC_DISABLE_INIT	0x9	/* Only 2400 & 2500 */
1304fcf3ce44SJohn Forte #define	VPC_DISABLE_LOGOUT	0xa
13055dfd244aSDaniel Beauregard #define	VPC_DISABLE_LOGOUT_ALL	0xb
1306fcf3ce44SJohn Forte 
1307fcf3ce44SJohn Forte /*
1308fcf3ce44SJohn Forte  * ISP2400 queue - Report ID Acquisition IOCB structure definition.
1309fcf3ce44SJohn Forte  */
1310fcf3ce44SJohn Forte #define	REPORT_ID_TYPE		0x32
1311fcf3ce44SJohn Forte typedef struct report_id_0 {
1312*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
1313*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
1314*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
1315*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
1316fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
1317*4c3888b8SHans Rosenfeld 	uint8_t vp_acquired;
1318*4c3888b8SHans Rosenfeld 	uint8_t vp_setup;
1319*4c3888b8SHans Rosenfeld 	uint8_t reserved[2];
1320*4c3888b8SHans Rosenfeld 	uint8_t port_id[3];
1321*4c3888b8SHans Rosenfeld 	uint8_t format;
1322*4c3888b8SHans Rosenfeld 	uint8_t vp_index[16];
1323*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[32];
1324fcf3ce44SJohn Forte } report_id_0_t;
1325fcf3ce44SJohn Forte 
1326fcf3ce44SJohn Forte typedef struct report_id_1 {
1327*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
1328*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
1329*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
1330*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
1331fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
1332fcf3ce44SJohn Forte 	uint16_t vp_count;
1333*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
1334*4c3888b8SHans Rosenfeld 	uint8_t vp_status;
1335*4c3888b8SHans Rosenfeld 	uint8_t port_id[3];
1336*4c3888b8SHans Rosenfeld 	uint8_t format;
1337*4c3888b8SHans Rosenfeld 	uint8_t reserved[48];
1338fcf3ce44SJohn Forte } report_id_1_t;
1339fcf3ce44SJohn Forte 
1340*4c3888b8SHans Rosenfeld typedef struct report_id_acq {
1341*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
1342*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
1343*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
1344*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
1345*4c3888b8SHans Rosenfeld 	uint32_t handle;		/* System handle */
1346*4c3888b8SHans Rosenfeld 	uint8_t vp_acquired;
1347*4c3888b8SHans Rosenfeld 	uint8_t vp_setup;
1348*4c3888b8SHans Rosenfeld 	uint8_t vp_index;
1349*4c3888b8SHans Rosenfeld 	uint8_t vp_status;
1350*4c3888b8SHans Rosenfeld 	uint8_t port_id[3];
1351*4c3888b8SHans Rosenfeld 	uint8_t format;
1352*4c3888b8SHans Rosenfeld 	uint8_t status_subcode;
1353*4c3888b8SHans Rosenfeld 	uint8_t flags;
1354*4c3888b8SHans Rosenfeld 	uint16_t fip_flags;
1355*4c3888b8SHans Rosenfeld 	uint16_t fcf_index;
1356*4c3888b8SHans Rosenfeld 	uint16_t mac[3];
1357*4c3888b8SHans Rosenfeld 	uint8_t reserved[4];
1358*4c3888b8SHans Rosenfeld 	uint8_t ls_rjt_subcode;
1359*4c3888b8SHans Rosenfeld 	uint8_t ls_rjt_explanation;
1360*4c3888b8SHans Rosenfeld 	uint8_t ls_rjt_reason_code;
1361*4c3888b8SHans Rosenfeld 	uint8_t reserved_1[29];
1362*4c3888b8SHans Rosenfeld } report_id_acq_t;
1363*4c3888b8SHans Rosenfeld 
1364fcf3ce44SJohn Forte /*
1365fcf3ce44SJohn Forte  * ISP2400 queue - Verify Menlo FW entry structure definition.
1366fcf3ce44SJohn Forte  */
1367fcf3ce44SJohn Forte #define	VERIFY_MENLO_TYPE	0x1b
1368fcf3ce44SJohn Forte typedef struct vfy_menlo_entry {
1369*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
1370*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
1371*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
1372*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
1373fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
1374fcf3ce44SJohn Forte 	uint16_t options_status;
1375fcf3ce44SJohn Forte 	uint16_t failure_code;
1376fcf3ce44SJohn Forte 	uint16_t dseg_count;
1377fcf3ce44SJohn Forte 	uint16_t reserved_1[3];
1378fcf3ce44SJohn Forte 	uint32_t fw_version;
1379fcf3ce44SJohn Forte 	uint32_t exch_addr;
1380fcf3ce44SJohn Forte 	uint32_t reserved_2[3];
1381fcf3ce44SJohn Forte 	uint32_t fw_size;
1382fcf3ce44SJohn Forte 	uint32_t fw_sequence_size;
1383fcf3ce44SJohn Forte 	uint32_t relative_offset;
1384*4c3888b8SHans Rosenfeld 	ql_64bit_data_seg_t	dseg;	/* Data segments. */
1385fcf3ce44SJohn Forte } vfy_menlo_entry_t;
1386fcf3ce44SJohn Forte 
1387fcf3ce44SJohn Forte /*
1388fcf3ce44SJohn Forte  * Option Flags.
1389fcf3ce44SJohn Forte  */
1390fcf3ce44SJohn Forte #define	VMO_DSD_CHAINING	BIT_15
1391fcf3ce44SJohn Forte #define	VM_END_OF_DATA		BIT_14
1392fcf3ce44SJohn Forte #define	VMF_DIAGNOSTIC_FW	BIT_3
1393fcf3ce44SJohn Forte #define	VMF_DO_NOT_RESET	BIT_2
1394fcf3ce44SJohn Forte #define	VMF_FORCE_UPDATE_FW	BIT_1
1395fcf3ce44SJohn Forte #define	VMF_DO_NOT_UPDATE_FW	BIT_0
1396fcf3ce44SJohn Forte 
1397fcf3ce44SJohn Forte /*
1398fcf3ce44SJohn Forte  * ISP2400 queue - Access Menlo Data entry structure definition.
1399fcf3ce44SJohn Forte  */
1400fcf3ce44SJohn Forte #define	MENLO_DATA_TYPE		0x2b
1401fcf3ce44SJohn Forte typedef struct menlo_data_entry {
1402*4c3888b8SHans Rosenfeld 	uint8_t entry_type;		/* Entry type. */
1403*4c3888b8SHans Rosenfeld 	uint8_t entry_count;		/* Entry count. */
1404*4c3888b8SHans Rosenfeld 	uint8_t sys_define;		/* System defined. */
1405*4c3888b8SHans Rosenfeld 	uint8_t entry_status;		/* Entry Status. */
1406fcf3ce44SJohn Forte 	uint32_t handle;		/* System handle */
1407fcf3ce44SJohn Forte 	uint16_t options_status;
1408fcf3ce44SJohn Forte 	uint16_t failure_code;
1409fcf3ce44SJohn Forte 	uint16_t dseg_count;
1410fcf3ce44SJohn Forte 	uint16_t reserved_1[3];
1411fcf3ce44SJohn Forte 	uint32_t parameter_1;
1412fcf3ce44SJohn Forte 	uint32_t parameter_2;
1413fcf3ce44SJohn Forte 	uint32_t parameter_3;
1414fcf3ce44SJohn Forte 	uint32_t reserved_2[3];
1415fcf3ce44SJohn Forte 	uint32_t total_byte_count;
1416fcf3ce44SJohn Forte 	uint32_t reserved_3;
1417*4c3888b8SHans Rosenfeld 	ql_64bit_data_seg_t	dseg;	/* Data segments. */
1418fcf3ce44SJohn Forte } menlo_data_entry_t;
1419fcf3ce44SJohn Forte 
1420fcf3ce44SJohn Forte /*
1421fcf3ce44SJohn Forte  * Mailbox IOCB.
1422fcf3ce44SJohn Forte  */
1423fcf3ce44SJohn Forte typedef union ql_mbx_iocb {
1424fcf3ce44SJohn Forte 	cmd_entry_t		cmd;
1425fcf3ce44SJohn Forte 	cmd_3_entry_t		cmd3;
1426f885d00fSDaniel Beauregard 	cmd7_24xx_entry_t	cmd24;
1427fcf3ce44SJohn Forte 	ms_entry_t		ms;
1428fcf3ce44SJohn Forte 	ct_passthru_entry_t	ms24;
1429fcf3ce44SJohn Forte 	abort_cmd_entry_t	abo;
1430fcf3ce44SJohn Forte 	task_mgmt_entry_t	mgmt;
1431fcf3ce44SJohn Forte 	sts_entry_t		sts;
1432fcf3ce44SJohn Forte 	sts_24xx_entry_t	sts24;
1433fcf3ce44SJohn Forte 	log_entry_t		log;
1434fcf3ce44SJohn Forte 	vp_control_entry_t	vpc;
1435fcf3ce44SJohn Forte 	vp_modify_entry_t	vpm;
1436fcf3ce44SJohn Forte 	vfy_menlo_entry_t	mvfy;
1437fcf3ce44SJohn Forte 	menlo_data_entry_t	mdata;
1438*4c3888b8SHans Rosenfeld 	els_passthru_entry_t	els;
1439fcf3ce44SJohn Forte } ql_mbx_iocb_t;
1440fcf3ce44SJohn Forte 
1441fcf3ce44SJohn Forte /*
1442fcf3ce44SJohn Forte  * Global Data in ql_iocb.c source file.
1443fcf3ce44SJohn Forte  */
1444fcf3ce44SJohn Forte 
1445fcf3ce44SJohn Forte /*
1446fcf3ce44SJohn Forte  * Global Function Prototypes in ql_iocb.c source file.
1447fcf3ce44SJohn Forte  */
1448fcf3ce44SJohn Forte void ql_start_iocb(ql_adapter_state_t *, ql_srb_t *);
1449*4c3888b8SHans Rosenfeld int ql_marker(ql_adapter_state_t *, uint16_t, ql_lun_t *lq, uint8_t);
1450fcf3ce44SJohn Forte void ql_isp_rcvbuf(ql_adapter_state_t *);
1451*4c3888b8SHans Rosenfeld void ql_command_iocb(ql_adapter_state_t *, ql_request_q_t *, ql_srb_t *,
1452*4c3888b8SHans Rosenfeld     void *);
1453*4c3888b8SHans Rosenfeld void ql_ms_iocb(ql_adapter_state_t *, ql_request_q_t *, ql_srb_t *, void *);
1454*4c3888b8SHans Rosenfeld void ql_ip_iocb(ql_adapter_state_t *, ql_request_q_t *, ql_srb_t *, void *);
1455*4c3888b8SHans Rosenfeld void ql_command_24xx_iocb(ql_adapter_state_t *, ql_request_q_t *, ql_srb_t *,
1456*4c3888b8SHans Rosenfeld     void *);
1457*4c3888b8SHans Rosenfeld void ql_ms_24xx_iocb(ql_adapter_state_t *, ql_request_q_t *, ql_srb_t *,
1458*4c3888b8SHans Rosenfeld     void *);
1459*4c3888b8SHans Rosenfeld void ql_ip_24xx_iocb(ql_adapter_state_t *, ql_request_q_t *, ql_srb_t *,
1460*4c3888b8SHans Rosenfeld     void *);
1461fcf3ce44SJohn Forte 
1462fcf3ce44SJohn Forte #ifdef	__cplusplus
1463fcf3ce44SJohn Forte }
1464fcf3ce44SJohn Forte #endif
1465fcf3ce44SJohn Forte 
1466fcf3ce44SJohn Forte #endif /* _QL_IOCB_H */
1467