xref: /dragonfly/sys/dev/raid/asr/i2oadptr.h (revision 0db87cb7)
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 #if ((defined(KERNEL) || defined(_KERNEL)) && defined(__FreeBSD__))
88 # if (KERN_VERSION < 3)
89 #  include "i386/pci/i2omsg.h"
90 # else
91 #  include "dev/asr/i2omsg.h"
92 # endif
93 #else
94 # include    "i2omsg.h"		 /* Include the Base Message file */
95 #endif
96 
97 
98 #define	I2OADPTR_REV 1_5_1	/* Header file revision string */
99 
100 
101 /*****************************************************************************
102  *
103  *    i2oadptr.h -- I2O Adapter Class Message defintion file
104  *
105  *
106  *  Revision History:
107  *
108  *  1.5.d   03/06/97 - First definition for spec. draft version 1.5d.
109  *  1.5.1   05/02/97 - Corrections from review cycle:
110  *	    1) Remove "SCSI" from function definition comment.
111  *	    2) Add revision string.
112  *	    3) Convert tabs to spaces.
113  *	    4) New disclaimer.
114  *
115  *
116  *
117  *****************************************************************************/
118 
119 /*
120     NOTES:
121 
122     Gets, reads, receives, etc. are all even numbered functions.
123     Sets, writes, sends, etc. are all odd numbered functions.
124     Functions that both send and receive data can be either but an attempt is made
125     to use the function number that indicates the greater transfer amount.
126     Functions that do not send or receive data use odd function numbers.
127 
128     Some functions are synonyms like read, receive and send, write.
129 
130     All common functions will have a code of less than 0x80.
131     Unique functions to a class will start at 0x80.
132     Executive Functions start at 0xA0.
133 
134     Utility Message function codes range from 0 - 0x1f
135     Base Message function codes range from 0x20 - 0xfe
136     Private Message function code is 0xff.
137 */
138 
139 
140 PRAGMA_ALIGN_PUSH
141 
142 PRAGMA_PACK_PUSH
143 
144 /*
145     Bus Adapter Class specific functions
146 */
147 
148 #define	I2O_HBA_ADAPTER_RESET		    0x85
149 #define	I2O_HBA_BUS_QUIESCE		    0x8b
150 #define	I2O_HBA_BUS_RESET		    0x87
151 #define	I2O_HBA_BUS_SCAN		    0x89
152 
153 
154 /*
155     Detailed Status Codes for HBA operations
156 
157     Note:
158     The 16-bit Detailed Status Code field for HBA operations is divided
159     into two separate 8-bit fields.  The lower 8 bits are reserved.  The
160     upper 8 bits are used to report Adapter Status information.	 The
161     definitions for these two fields, however, will be consistent with
162     the standard reply message frame structure declaration, which treats
163     this as a single 16-bit field.  In addition, the values used will be
164     consistent with the Adapter Status codes defined for the SCSI
165     Peripheral class.  Theses codes are based on CAM-1.	 In other words,
166     these definitions are a subset of the SCSI peripheral class codes.
167     Where applicable, "SCSI" has been removed from the definition.
168 */
169 
170 
171 #define	I2O_HBA_DSC_MASK			0xFF00
172 
173 #define	I2O_HBA_DSC_SUCCESS			0x0000
174 #define	I2O_HBA_DSC_ADAPTER_BUSY		0x0500
175 #define	I2O_HBA_DSC_COMMAND_TIMEOUT		0x0B00
176 #define	I2O_HBA_DSC_COMPLETE_WITH_ERROR		0x0400
177 #define	I2O_HBA_DSC_FUNCTION_UNAVAILABLE	0x3A00
178 #define	I2O_HBA_DSC_NO_ADAPTER			0x1100
179 #define	I2O_HBA_DSC_PARITY_ERROR_FAILURE	0x0F00
180 #define	I2O_HBA_DSC_PATH_INVALID		0x0700
181 #define	I2O_HBA_DSC_PROVIDE_FAILURE		0x1600
182 #define	I2O_HBA_DSC_QUEUE_FROZEN		0x4000
183 #define	I2O_HBA_DSC_REQUEST_ABORTED		0x0200
184 #define	I2O_HBA_DSC_REQUEST_INVALID		0x0600
185 #define	I2O_HBA_DSC_REQUEST_LENGTH_ERROR	0x1500
186 #define	I2O_HBA_DSC_REQUEST_TERMINATED		0x1800
187 #define	I2O_HBA_DSC_RESOURCE_UNAVAILABLE	0x3400
188 #define	I2O_HBA_DSC_BUS_BUSY			0x3F00
189 #define	I2O_HBA_DSC_BUS_RESET			0x0E00
190 #define	I2O_HBA_DSC_ID_INVALID			0x3900
191 #define	I2O_HBA_DSC_SEQUENCE_FAILURE		0x1400
192 #define	I2O_HBA_DSC_UNABLE_TO_ABORT		0x0300
193 #define	I2O_HBA_DSC_UNABLE_TO_TERMINATE		0x0900
194 #define	I2O_HBA_DSC_UNACKNOWLEDGED_EVENT	0x3500
195 #define	I2O_HBA_DSC_UNEXPECTED_BUS_FREE		0x1300
196 
197 
198 
199 /****************************************************************************/
200 
201 /* Bus Adapter Parameter Groups */
202 
203 /****************************************************************************/
204 
205 
206 #define	    I2O_HBA_CONTROLLER_INFO_GROUP_NO		0x0000
207 #define	    I2O_HBA_HISTORICAL_STATS_GROUP_NO		0x0100
208 #define	    I2O_HBA_SCSI_CONTROLLER_INFO_GROUP_NO	0x0200
209 #define	    I2O_HBA_SCSI_BUS_PORT_INFO_GROUP_NO		0x0201
210 #define	    I2O_HBA_FCA_CONTROLLER_INFO_GROUP_NO	0x0300
211 #define	    I2O_HBA_FCA_PORT_INFO_GROUP_NO		0x0301
212 
213 
214 /* - 0000h - HBA Controller Information Parameter Group */
215 
216 /* Bus Type */
217 
218 #define	    I2O_HBA_BUS_TYPE_GENERIC	    0x00
219 #define	    I2O_HBA_BUS_TYPE_SCSI	    0x01
220 #define	    I2O_HBA_BUS_TYPE_FCA	    0x10
221 
222 
223 typedef struct _I2O_HBA_CONTROLLER_INFO_SCALAR {
224     U8		BusType;
225     U8		BusState;
226     U16		Reserved2;
227     U8		BusName[12];
228 } I2O_HBA_CONTROLLER_INFO_SCALAR, *PI2O_HBA_CONTROLLER_INFO_SCALAR;
229 
230 
231 /* - 0100h - HBA Historical Stats Parameter Group */
232 
233 typedef struct _I2O_HBA_HIST_STATS_SCALAR {
234     U32		TimeLastPoweredUp;
235     U32		TimeLastReset;
236 } I2O_HBA_HIST_STATS_SCALAR, *PI2O_HBA_HIST_STATS_SCALAR;
237 
238 
239 /* - 0200h - HBA SCSI Controller Information Parameter Group */
240 
241 /* SCSI Type */
242 
243 #define	I2O_SCSI_TYPE_UNKNOWN		    0x00
244 #define	I2O_SCSI_TYPE_SCSI_1		    0x01
245 #define	I2O_SCSI_TYPE_SCSI_2		    0x02
246 #define	I2O_SCSI_TYPE_SCSI_3		    0x03
247 
248 /* Protection Management */
249 
250 #define	    I2O_SCSI_PORT_PROT_OTHER	    0x00
251 #define	    I2O_SCSI_PORT_PROT_UNKNOWN	    0x01
252 #define	    I2O_SCSI_PORT_PROT_UNPROTECTED  0x02
253 #define	    I2O_SCSI_PORT_PROT_PROTECTED    0x03
254 #define	    I2O_SCSI_PORT_PROT_SCC	    0x04
255 
256 /* Settings */
257 
258 #define	    I2O_SCSI_PORT_PARITY_FLAG	    0x01
259 #define	    I2O_SCSI_PORT_PARITY_DISABLED   0x00
260 #define	    I2O_SCSI_PORT_PARITY_ENABLED    0x01
261 
262 #define	    I2O_SCSI_PORT_SCAN_ORDER_FLAG   0x02
263 #define	    I2O_SCSI_PORT_SCAN_LOW_TO_HIGH  0x00
264 #define	    I2O_SCSI_PORT_SCAN_HIGH_TO_LOW  0x02
265 
266 #define	    I2O_SCSI_PORT_IID_FLAG	    0x04
267 #define	    I2O_SCSI_PORT_IID_DEFAULT	    0x00
268 #define	    I2O_SCSI_PORT_IID_SPECIFIED	    0x04
269 
270 #define	    I2O_SCSI_PORT_SCAM_FLAG	    0x08
271 #define	    I2O_SCSI_PORT_SCAM_DISABLED	    0x00
272 #define	    I2O_SCSI_PORT_SCAM_ENABLED	    0x08
273 
274 #define	    I2O_SCSI_PORT_TYPE_FLAG	    0x80
275 #define	    I2O_SCSI_PORT_TYPE_PARALLEL	    0x00
276 #define	    I2O_SCSI_PORT_TYPE_SERIAL	    0x80
277 
278 typedef struct _I2O_HBA_SCSI_CONTROLLER_INFO_SCALAR {
279     U8		SCSIType;
280     U8		ProtectionManagement;
281     U8		Settings;
282     U8		Reserved1;
283     U32		InitiatorID;
284     U64		ScanLun0Only;
285     U16		DisableDevice;
286     U8		MaxOffset;
287     U8		MaxDataWidth;
288     U64		MaxSyncRate;
289 } I2O_HBA_SCSI_CONTROLLER_INFO_SCALAR, *PI2O_HBA_SCSI_CONTROLLER_INFO_SCALAR;
290 
291 
292 /* - 0201h - HBA SCSI Bus Port Information Parameter Group */
293 
294 /*  NOTE:   Refer to the SCSI Peripheral Class Bus Port Information Parameter
295 	    Group field definitions for HBA SCSI Bus Port field definitions.
296  */
297 
298 typedef struct _I2O_HBA_SCSI_BUS_PORT_INFO_SCALAR {
299     U8		PhysicalInterface;
300     U8		ElectricalInterface;
301     U8		Isochronous;
302     U8		ConnectorType;
303     U8		ConnectorGender;
304     U8		Reserved1;
305     U16		Reserved2;
306     U32		MaxNumberDevices;
307     U32		DeviceIdBegin;
308     U32		DeviceIdEnd;
309     U8		LunBegin[8];
310     U8		LunEnd[8];
311 } I2O_HBA_SCSI_BUS_PORT_INFO_SCALAR, *PI2O_HBA_SCSI_BUS_PORT_INFO_SCALAR;
312 
313 
314 /* - 0300h - HBA FCA Controller Information Parameters Group defines */
315 
316 /* SCSI Type */
317 
318 #define	I2O_FCA_TYPE_UNKNOWN		    0x00
319 #define	I2O_FCA_TYPE_FCAL		    0x01
320 
321 typedef struct _I2O_HBA_FCA_CONTROLLER_INFO_SCALAR {
322     U8		FcaType;
323     U8		Reserved1;
324     U16		Reserved2;
325 } I2O_HBA_FCA_CONTROLLER_INFO_SCALAR, *PI2O_HBA_FCA_CONTROLLER_INFO_SCALAR;
326 
327 
328 /* - 0301h - HBA FCA Port Information Parameters Group defines */
329 
330 typedef struct _I2O_HBA_FCA_PORT_INFO_SCALAR {
331     U32		Reserved4;
332 } I2O_HBA_FCA_PORT_INFO_SCALAR, *PI2O_HBA_FCA_PORT_INFO_SCALAR;
333 
334 
335 /****************************************************************************/
336 
337 /* I2O Bus Adapter Class Specific Message Definitions */
338 
339 /****************************************************************************/
340 
341 
342 /****************************************************************************/
343 
344 /* I2O Bus Adapter Class Reply Message Frame */
345 
346 typedef struct _I2O_HBA_REPLY_MESSAGE_FRAME {
347     I2O_SINGLE_REPLY_MESSAGE_FRAME StdReplyFrame;
348 } I2O_HBA_REPLY_MESSAGE_FRAME, *PI2O_HBA_REPLY_MESSAGE_FRAME;
349 
350 
351 /****************************************************************************/
352 
353 /* I2O HBA Adapter Reset Message Frame */
354 
355 typedef struct _I2O_HBA_ADAPTER_RESET_MESSAGE {
356     I2O_MESSAGE_FRAME	    StdMessageFrame;
357     I2O_TRANSACTION_CONTEXT TransactionContext;
358 } I2O_HBA_ADAPTER_RESET_MESSAGE, *PI2O_HBA_ADAPTER_RESET_MESSAGE;
359 
360 
361 /****************************************************************************/
362 
363 /* I2O HBA Bus Quiesce Message Frame */
364 
365 typedef U32	I2O_HBQ_FLAGS;
366 
367 #define	I2O_HBQ_FLAG_NORMAL		0x0000
368 #define	I2O_HBQ_FLAG_QUIESCE		0x0001
369 
370 typedef struct _I2O_HBA_BUS_QUIESCE_MESSAGE {
371     I2O_MESSAGE_FRAME	    StdMessageFrame;
372     I2O_TRANSACTION_CONTEXT TransactionContext;
373     I2O_HBQ_FLAGS	    Flags;
374 } I2O_HBA_BUS_QUIESCE_MESSAGE, *PI2O_HBA_BUS_QUIESCE_MESSAGE;
375 
376 
377 /****************************************************************************/
378 
379 /* I2O HBA Bus Reset Message Frame */
380 
381 typedef struct _I2O_HBA_BUS_RESET_MESSAGE {
382     I2O_MESSAGE_FRAME	    StdMessageFrame;
383     I2O_TRANSACTION_CONTEXT TransactionContext;
384 } I2O_HBA_BUS_RESET_MESSAGE, *PI2O_HBA_BUS_RESET_MESSAGE;
385 
386 
387 /****************************************************************************/
388 
389 /* I2O HBA Bus Scan Message Frame */
390 
391 /* NOTE: SCSI-2 8-bit scalar LUN goes into offset 1 of Lun arrays */
392 
393 typedef struct _I2O_HBA_BUS_SCAN_MESSAGE {
394     I2O_MESSAGE_FRAME	    StdMessageFrame;
395     I2O_TRANSACTION_CONTEXT TransactionContext;
396 } I2O_HBA_BUS_SCAN_MESSAGE, *PI2O_HBA_BUS_SCAN_MESSAGE;
397 
398 
399 PRAGMA_PACK_POP
400 
401 PRAGMA_ALIGN_POP
402 
403 #endif	    /* I2O_ADPTR_HDR */
404 
405 
406