xref: /dragonfly/sys/dev/raid/asr/i2oadptr.h (revision 73b5ca6b)
1 /*-
2  ****************************************************************
3  * Copyright (c) 1996-2000 Distributed Processing Technology Corporation
4  * Copyright (c) 2000 Adaptec Corproation.
5  * All rights reserved.
6  *
7  * Copyright 1999 I2O Special Interest Group (I2O SIG).	 All rights reserved.
8  * All rights reserved
9  *
10  * TERMS AND CONDITIONS OF USE
11  *
12  * Redistribution and use in source form, with or without modification, are
13  * permitted provided that redistributions of source code must retain the
14  * above copyright notice, this list of conditions and the following disclaimer.
15  *
16  * This software is provided `as is' by Distributed Processing Technology and
17  * any express or implied warranties, including, but not limited to, the
18  * implied warranties of merchantability and fitness for a particular purpose,
19  * are disclaimed. In no event shall Distributed Processing Technology be
20  * liable for any direct, indirect, incidental, special, exemplary or
21  * consequential damages (including, but not limited to, procurement of
22  * substitute goods or services; loss of use, data, or profits; or business
23  * interruptions) however caused and on any theory of liability, whether in
24  * contract, strict liability, or tort (including negligence or otherwise)
25  * arising in any way out of the use of this driver software, even if advised
26  * of the possibility of such damage.
27  *
28  * This header file, and any modifications of this header file, are provided
29  * contingent upon your agreement and adherence to the here-listed terms and
30  * conditions.	By accepting and/or using this header file, you agree to abide
31  * by these terms and conditions and that these terms and conditions will be
32  * construed and governed in accordance with the laws of the State of California,
33  * without reference to conflict-of-law provisions.  If you do not agree
34  * to these terms and conditions, please delete this file, and any copies,
35  * permanently, without making any use thereof.
36  *
37  * THIS HEADER FILE IS PROVIDED FREE OF CHARGE ON AN AS-IS BASIS WITHOUT
38  * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
39  * TO IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
40  * PURPOSE.  I2O SIG DOES NOT WARRANT THAT THIS HEADER FILE WILL MEET THE
41  * USER'S REQUIREMENTS OR THAT ITS OPERATION WILL BE UNINTERRUPTED OR
42  * ERROR-FREE.
43  *
44  * I2O SIG DISCLAIMS ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF
45  * ANY PROPRIETARY RIGHTS, RELATING TO THE IMPLEMENTATION OF THE I2O
46  * SPECIFICATIONS.  I2O SIG DOES NOT WARRANT OR REPRESENT THAT SUCH
47  * IMPLEMENTATIONS WILL NOT INFRINGE SUCH RIGHTS.
48  *
49  * THE USER OF THIS HEADER FILE SHALL HAVE NO RECOURSE TO I2O SIG FOR ANY
50  * ACTUAL OR CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO, LOST DATA
51  * OR LOST PROFITS ARISING OUT OF THE USE OR INABILITY TO USE THIS PROGRAM.
52  *
53  * I2O SIG grants the user of this header file a license to copy, distribute,
54  * and modify it, for any purpose, under the following terms.  Any copying,
55  * distribution, or modification of this header file must not delete or alter
56  * the copyright notice of I2O SIG or any of these Terms and Conditions.
57  *
58  * Any distribution of this header file must not include a charge for the
59  * header file (unless such charges are strictly for the physical acts of
60  * copying or transferring copies).  However, distribution of a product in
61  * which this header file is embedded may include a charge so long as any
62  * such charge does not include any charge for the header file itself.
63  *
64  * Any modification of this header file constitutes a derivative work based
65  * on this header file.	 Any distribution of such derivative work: (1) must
66  * include prominent notices that the header file has been changed from the
67  * original, together with the dates of any changes; (2) automatically includes
68  * this same license to the original header file from I2O SIG, without any
69  * restriction thereon from the distributing user; and (3) must include a
70  * grant of license of the modified file under the same terms and conditions
71  * as these Terms and Conditions.
72  *
73  * The I2O SIG Web site can be found at: http://www.i2osig.org
74  *
75  * The I2O SIG encourages you to deposit derivative works based on this
76  * header file at the I2O SIG Web site.	 Furthermore, to become a Registered
77  * Developer of the I2O SIG, sign up at the Web site or call 415.750.8352
78  * (United States).
79  *
80  * $FreeBSD: src/sys/dev/asr/i2oadptr.h,v 1.6 2005/01/06 01:42:29 imp Exp $
81  *
82  ****************************************************************/
83 
84 #if !defined(I2O_ADPTR_HDR)
85 #define	I2O_ADPTR_HDR
86 
87 #include    "i2omsg.h"		 /* Include the Base Message file */
88 
89 
90 #define	I2OADPTR_REV 1_5_1	/* Header file revision string */
91 
92 
93 /*****************************************************************************
94  *
95  *    i2oadptr.h -- I2O Adapter Class Message defintion file
96  *
97  *
98  *  Revision History:
99  *
100  *  1.5.d   03/06/97 - First definition for spec. draft version 1.5d.
101  *  1.5.1   05/02/97 - Corrections from review cycle:
102  *	    1) Remove "SCSI" from function definition comment.
103  *	    2) Add revision string.
104  *	    3) Convert tabs to spaces.
105  *	    4) New disclaimer.
106  *
107  *
108  *
109  *****************************************************************************/
110 
111 /*
112     NOTES:
113 
114     Gets, reads, receives, etc. are all even numbered functions.
115     Sets, writes, sends, etc. are all odd numbered functions.
116     Functions that both send and receive data can be either but an attempt is made
117     to use the function number that indicates the greater transfer amount.
118     Functions that do not send or receive data use odd function numbers.
119 
120     Some functions are synonyms like read, receive and send, write.
121 
122     All common functions will have a code of less than 0x80.
123     Unique functions to a class will start at 0x80.
124     Executive Functions start at 0xA0.
125 
126     Utility Message function codes range from 0 - 0x1f
127     Base Message function codes range from 0x20 - 0xfe
128     Private Message function code is 0xff.
129 */
130 
131 
132 PRAGMA_ALIGN_PUSH
133 
134 PRAGMA_PACK_PUSH
135 
136 /*
137     Bus Adapter Class specific functions
138 */
139 
140 #define	I2O_HBA_ADAPTER_RESET		    0x85
141 #define	I2O_HBA_BUS_QUIESCE		    0x8b
142 #define	I2O_HBA_BUS_RESET		    0x87
143 #define	I2O_HBA_BUS_SCAN		    0x89
144 
145 
146 /*
147     Detailed Status Codes for HBA operations
148 
149     Note:
150     The 16-bit Detailed Status Code field for HBA operations is divided
151     into two separate 8-bit fields.  The lower 8 bits are reserved.  The
152     upper 8 bits are used to report Adapter Status information.	 The
153     definitions for these two fields, however, will be consistent with
154     the standard reply message frame structure declaration, which treats
155     this as a single 16-bit field.  In addition, the values used will be
156     consistent with the Adapter Status codes defined for the SCSI
157     Peripheral class.  Theses codes are based on CAM-1.	 In other words,
158     these definitions are a subset of the SCSI peripheral class codes.
159     Where applicable, "SCSI" has been removed from the definition.
160 */
161 
162 
163 #define	I2O_HBA_DSC_MASK			0xFF00
164 
165 #define	I2O_HBA_DSC_SUCCESS			0x0000
166 #define	I2O_HBA_DSC_ADAPTER_BUSY		0x0500
167 #define	I2O_HBA_DSC_COMMAND_TIMEOUT		0x0B00
168 #define	I2O_HBA_DSC_COMPLETE_WITH_ERROR		0x0400
169 #define	I2O_HBA_DSC_FUNCTION_UNAVAILABLE	0x3A00
170 #define	I2O_HBA_DSC_NO_ADAPTER			0x1100
171 #define	I2O_HBA_DSC_PARITY_ERROR_FAILURE	0x0F00
172 #define	I2O_HBA_DSC_PATH_INVALID		0x0700
173 #define	I2O_HBA_DSC_PROVIDE_FAILURE		0x1600
174 #define	I2O_HBA_DSC_QUEUE_FROZEN		0x4000
175 #define	I2O_HBA_DSC_REQUEST_ABORTED		0x0200
176 #define	I2O_HBA_DSC_REQUEST_INVALID		0x0600
177 #define	I2O_HBA_DSC_REQUEST_LENGTH_ERROR	0x1500
178 #define	I2O_HBA_DSC_REQUEST_TERMINATED		0x1800
179 #define	I2O_HBA_DSC_RESOURCE_UNAVAILABLE	0x3400
180 #define	I2O_HBA_DSC_BUS_BUSY			0x3F00
181 #define	I2O_HBA_DSC_BUS_RESET			0x0E00
182 #define	I2O_HBA_DSC_ID_INVALID			0x3900
183 #define	I2O_HBA_DSC_SEQUENCE_FAILURE		0x1400
184 #define	I2O_HBA_DSC_UNABLE_TO_ABORT		0x0300
185 #define	I2O_HBA_DSC_UNABLE_TO_TERMINATE		0x0900
186 #define	I2O_HBA_DSC_UNACKNOWLEDGED_EVENT	0x3500
187 #define	I2O_HBA_DSC_UNEXPECTED_BUS_FREE		0x1300
188 
189 
190 
191 /****************************************************************************/
192 
193 /* Bus Adapter Parameter Groups */
194 
195 /****************************************************************************/
196 
197 
198 #define	    I2O_HBA_CONTROLLER_INFO_GROUP_NO		0x0000
199 #define	    I2O_HBA_HISTORICAL_STATS_GROUP_NO		0x0100
200 #define	    I2O_HBA_SCSI_CONTROLLER_INFO_GROUP_NO	0x0200
201 #define	    I2O_HBA_SCSI_BUS_PORT_INFO_GROUP_NO		0x0201
202 #define	    I2O_HBA_FCA_CONTROLLER_INFO_GROUP_NO	0x0300
203 #define	    I2O_HBA_FCA_PORT_INFO_GROUP_NO		0x0301
204 
205 
206 /* - 0000h - HBA Controller Information Parameter Group */
207 
208 /* Bus Type */
209 
210 #define	    I2O_HBA_BUS_TYPE_GENERIC	    0x00
211 #define	    I2O_HBA_BUS_TYPE_SCSI	    0x01
212 #define	    I2O_HBA_BUS_TYPE_FCA	    0x10
213 
214 
215 typedef struct _I2O_HBA_CONTROLLER_INFO_SCALAR {
216     U8		BusType;
217     U8		BusState;
218     U16		Reserved2;
219     U8		BusName[12];
220 } I2O_HBA_CONTROLLER_INFO_SCALAR, *PI2O_HBA_CONTROLLER_INFO_SCALAR;
221 
222 
223 /* - 0100h - HBA Historical Stats Parameter Group */
224 
225 typedef struct _I2O_HBA_HIST_STATS_SCALAR {
226     U32		TimeLastPoweredUp;
227     U32		TimeLastReset;
228 } I2O_HBA_HIST_STATS_SCALAR, *PI2O_HBA_HIST_STATS_SCALAR;
229 
230 
231 /* - 0200h - HBA SCSI Controller Information Parameter Group */
232 
233 /* SCSI Type */
234 
235 #define	I2O_SCSI_TYPE_UNKNOWN		    0x00
236 #define	I2O_SCSI_TYPE_SCSI_1		    0x01
237 #define	I2O_SCSI_TYPE_SCSI_2		    0x02
238 #define	I2O_SCSI_TYPE_SCSI_3		    0x03
239 
240 /* Protection Management */
241 
242 #define	    I2O_SCSI_PORT_PROT_OTHER	    0x00
243 #define	    I2O_SCSI_PORT_PROT_UNKNOWN	    0x01
244 #define	    I2O_SCSI_PORT_PROT_UNPROTECTED  0x02
245 #define	    I2O_SCSI_PORT_PROT_PROTECTED    0x03
246 #define	    I2O_SCSI_PORT_PROT_SCC	    0x04
247 
248 /* Settings */
249 
250 #define	    I2O_SCSI_PORT_PARITY_FLAG	    0x01
251 #define	    I2O_SCSI_PORT_PARITY_DISABLED   0x00
252 #define	    I2O_SCSI_PORT_PARITY_ENABLED    0x01
253 
254 #define	    I2O_SCSI_PORT_SCAN_ORDER_FLAG   0x02
255 #define	    I2O_SCSI_PORT_SCAN_LOW_TO_HIGH  0x00
256 #define	    I2O_SCSI_PORT_SCAN_HIGH_TO_LOW  0x02
257 
258 #define	    I2O_SCSI_PORT_IID_FLAG	    0x04
259 #define	    I2O_SCSI_PORT_IID_DEFAULT	    0x00
260 #define	    I2O_SCSI_PORT_IID_SPECIFIED	    0x04
261 
262 #define	    I2O_SCSI_PORT_SCAM_FLAG	    0x08
263 #define	    I2O_SCSI_PORT_SCAM_DISABLED	    0x00
264 #define	    I2O_SCSI_PORT_SCAM_ENABLED	    0x08
265 
266 #define	    I2O_SCSI_PORT_TYPE_FLAG	    0x80
267 #define	    I2O_SCSI_PORT_TYPE_PARALLEL	    0x00
268 #define	    I2O_SCSI_PORT_TYPE_SERIAL	    0x80
269 
270 typedef struct _I2O_HBA_SCSI_CONTROLLER_INFO_SCALAR {
271     U8		SCSIType;
272     U8		ProtectionManagement;
273     U8		Settings;
274     U8		Reserved1;
275     U32		InitiatorID;
276     U64		ScanLun0Only;
277     U16		DisableDevice;
278     U8		MaxOffset;
279     U8		MaxDataWidth;
280     U64		MaxSyncRate;
281 } I2O_HBA_SCSI_CONTROLLER_INFO_SCALAR, *PI2O_HBA_SCSI_CONTROLLER_INFO_SCALAR;
282 
283 
284 /* - 0201h - HBA SCSI Bus Port Information Parameter Group */
285 
286 /*  NOTE:   Refer to the SCSI Peripheral Class Bus Port Information Parameter
287 	    Group field definitions for HBA SCSI Bus Port field definitions.
288  */
289 
290 typedef struct _I2O_HBA_SCSI_BUS_PORT_INFO_SCALAR {
291     U8		PhysicalInterface;
292     U8		ElectricalInterface;
293     U8		Isochronous;
294     U8		ConnectorType;
295     U8		ConnectorGender;
296     U8		Reserved1;
297     U16		Reserved2;
298     U32		MaxNumberDevices;
299     U32		DeviceIdBegin;
300     U32		DeviceIdEnd;
301     U8		LunBegin[8];
302     U8		LunEnd[8];
303 } I2O_HBA_SCSI_BUS_PORT_INFO_SCALAR, *PI2O_HBA_SCSI_BUS_PORT_INFO_SCALAR;
304 
305 
306 /* - 0300h - HBA FCA Controller Information Parameters Group defines */
307 
308 /* SCSI Type */
309 
310 #define	I2O_FCA_TYPE_UNKNOWN		    0x00
311 #define	I2O_FCA_TYPE_FCAL		    0x01
312 
313 typedef struct _I2O_HBA_FCA_CONTROLLER_INFO_SCALAR {
314     U8		FcaType;
315     U8		Reserved1;
316     U16		Reserved2;
317 } I2O_HBA_FCA_CONTROLLER_INFO_SCALAR, *PI2O_HBA_FCA_CONTROLLER_INFO_SCALAR;
318 
319 
320 /* - 0301h - HBA FCA Port Information Parameters Group defines */
321 
322 typedef struct _I2O_HBA_FCA_PORT_INFO_SCALAR {
323     U32		Reserved4;
324 } I2O_HBA_FCA_PORT_INFO_SCALAR, *PI2O_HBA_FCA_PORT_INFO_SCALAR;
325 
326 
327 /****************************************************************************/
328 
329 /* I2O Bus Adapter Class Specific Message Definitions */
330 
331 /****************************************************************************/
332 
333 
334 /****************************************************************************/
335 
336 /* I2O Bus Adapter Class Reply Message Frame */
337 
338 typedef struct _I2O_HBA_REPLY_MESSAGE_FRAME {
339     I2O_SINGLE_REPLY_MESSAGE_FRAME StdReplyFrame;
340 } I2O_HBA_REPLY_MESSAGE_FRAME, *PI2O_HBA_REPLY_MESSAGE_FRAME;
341 
342 
343 /****************************************************************************/
344 
345 /* I2O HBA Adapter Reset Message Frame */
346 
347 typedef struct _I2O_HBA_ADAPTER_RESET_MESSAGE {
348     I2O_MESSAGE_FRAME	    StdMessageFrame;
349     I2O_TRANSACTION_CONTEXT TransactionContext;
350 } I2O_HBA_ADAPTER_RESET_MESSAGE, *PI2O_HBA_ADAPTER_RESET_MESSAGE;
351 
352 
353 /****************************************************************************/
354 
355 /* I2O HBA Bus Quiesce Message Frame */
356 
357 typedef U32	I2O_HBQ_FLAGS;
358 
359 #define	I2O_HBQ_FLAG_NORMAL		0x0000
360 #define	I2O_HBQ_FLAG_QUIESCE		0x0001
361 
362 typedef struct _I2O_HBA_BUS_QUIESCE_MESSAGE {
363     I2O_MESSAGE_FRAME	    StdMessageFrame;
364     I2O_TRANSACTION_CONTEXT TransactionContext;
365     I2O_HBQ_FLAGS	    Flags;
366 } I2O_HBA_BUS_QUIESCE_MESSAGE, *PI2O_HBA_BUS_QUIESCE_MESSAGE;
367 
368 
369 /****************************************************************************/
370 
371 /* I2O HBA Bus Reset Message Frame */
372 
373 typedef struct _I2O_HBA_BUS_RESET_MESSAGE {
374     I2O_MESSAGE_FRAME	    StdMessageFrame;
375     I2O_TRANSACTION_CONTEXT TransactionContext;
376 } I2O_HBA_BUS_RESET_MESSAGE, *PI2O_HBA_BUS_RESET_MESSAGE;
377 
378 
379 /****************************************************************************/
380 
381 /* I2O HBA Bus Scan Message Frame */
382 
383 /* NOTE: SCSI-2 8-bit scalar LUN goes into offset 1 of Lun arrays */
384 
385 typedef struct _I2O_HBA_BUS_SCAN_MESSAGE {
386     I2O_MESSAGE_FRAME	    StdMessageFrame;
387     I2O_TRANSACTION_CONTEXT TransactionContext;
388 } I2O_HBA_BUS_SCAN_MESSAGE, *PI2O_HBA_BUS_SCAN_MESSAGE;
389 
390 
391 PRAGMA_PACK_POP
392 
393 PRAGMA_ALIGN_POP
394 
395 #endif	    /* I2O_ADPTR_HDR */
396 
397 
398