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