xref: /dragonfly/sys/dev/raid/asr/i2outil.h (revision c37c9ab3)
1 /*-
2  ****************************************************************
3  * Copyright (c) 1996-2000 Distributed Processing Technology Corporation
4  * Copyright (c) 2000 Adaptec Corporation.
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/i2outil.h,v 1.6 2005/01/06 01:42:29 imp Exp $
81  *
82  ****************************************************************/
83 
84 /*********************************************************************
85  * I2OUtil.h -- I2O Utility Class Message defintion file
86  *
87  * This file contains information presented in Chapter 6 of the I2O
88  * Specification.
89  **********************************************************************/
90 
91 #if !defined(I2O_UTILITY_HDR)
92 #define	I2O_UTILITY_HDR
93 
94 #define	I2OUTIL_REV 1_5_4  /* I2OUtil header file revision string */
95 
96 #include   "i2omsg.h"	    /* Include the Base Message file */
97 
98 
99 /*
100 NOTES:
101 
102    Gets, reads, receives, etc. are all even numbered functions.
103    Sets, writes, sends, etc. are all odd numbered functions.
104    Functions that both send and receive data can be either but an attempt is made
105        to use the function number that indicates the greater transfer amount.
106    Functions that do not send or receive data use odd function numbers.
107 
108    Some functions are synonyms like read, receive and send, write.
109 
110    All common functions will have a code of less than 0x80.
111    Unique functions to a class will start at 0x80.
112    Executive Functions start at 0xA0.
113 
114    Utility Message function codes range from 0 - 0x1f
115    Base Message function codes range from 0x20 - 0xfe
116    Private Message function code is 0xff.
117 */
118 
119 PRAGMA_ALIGN_PUSH
120 
121 PRAGMA_PACK_PUSH
122 
123 /* Utility Message class functions. */
124 
125 #define	   I2O_UTIL_NOP				       0x00
126 #define	   I2O_UTIL_ABORT			       0x01
127 #define	   I2O_UTIL_CLAIM			       0x09
128 #define	   I2O_UTIL_CLAIM_RELEASE		       0x0B
129 #define	   I2O_UTIL_CONFIG_DIALOG		       0x10
130 #define	   I2O_UTIL_DEVICE_RESERVE		       0x0D
131 #define	   I2O_UTIL_DEVICE_RELEASE		       0x0F
132 #define	   I2O_UTIL_EVENT_ACKNOWLEDGE		       0x14
133 #define	   I2O_UTIL_EVENT_REGISTER		       0x13
134 #define	   I2O_UTIL_LOCK			       0x17
135 #define	   I2O_UTIL_LOCK_RELEASE		       0x19
136 #define	   I2O_UTIL_PARAMS_GET			       0x06
137 #define	   I2O_UTIL_PARAMS_SET			       0x05
138 #define	   I2O_UTIL_REPLY_FAULT_NOTIFY		       0x15
139 
140 /****************************************************************************/
141 
142 /* ABORT Abort type defines. */
143 
144 #define	   I2O_ABORT_TYPE_EXACT_ABORT		       0x00
145 #define	   I2O_ABORT_TYPE_FUNCTION_ABORT	       0x01
146 #define	   I2O_ABORT_TYPE_TRANSACTION_ABORT	       0x02
147 #define	   I2O_ABORT_TYPE_WILD_ABORT		       0x03
148 #define	   I2O_ABORT_TYPE_CLEAN_EXACT_ABORT	       0x04
149 #define	   I2O_ABORT_TYPE_CLEAN_FUNCTION_ABORT	       0x05
150 #define	   I2O_ABORT_TYPE_CLEAN_TRANSACTION_ABORT      0x06
151 #define	   I2O_ABORT_TYPE_CLEAN_WILD_ABORT	       0x07
152 
153 /* UtilAbort Function Message Frame structure. */
154 
155 typedef struct _I2O_UTIL_ABORT_MESSAGE {
156     I2O_MESSAGE_FRAME	       StdMessageFrame;
157     I2O_TRANSACTION_CONTEXT    TransactionContext;
158 #   if (defined(_DPT_BIG_ENDIAN) || defined(sparc))
159 	U32		       reserved;
160 #   else
161 	U16		       reserved;
162 	U8		       AbortType;
163 	U8		       FunctionToAbort;
164 #   endif
165     I2O_TRANSACTION_CONTEXT    TransactionContextToAbort;
166 } I2O_UTIL_ABORT_MESSAGE, *PI2O_UTIL_ABORT_MESSAGE;
167 
168 
169 typedef struct _I2O_UTIL_ABORT_REPLY {
170     I2O_MESSAGE_FRAME	       StdMessageFrame;
171     I2O_TRANSACTION_CONTEXT    TransactionContext;
172     U32			       CountOfAbortedMessages;
173 } I2O_UTIL_ABORT_REPLY, *PI2O_UTIL_ABORT_REPLY;
174 
175 
176 /****************************************************************************/
177 
178 /* Claim Flag defines */
179 
180 #define	   I2O_CLAIM_FLAGS_EXCLUSIVE		       0x0001 /* Reserved */
181 #define	   I2O_CLAIM_FLAGS_RESET_SENSITIVE	       0x0002
182 #define	   I2O_CLAIM_FLAGS_STATE_SENSITIVE	       0x0004
183 #define	   I2O_CLAIM_FLAGS_CAPACITY_SENSITIVE	       0x0008
184 #define	   I2O_CLAIM_FLAGS_PEER_SERVICE_DISABLED       0x0010
185 #define	   I2O_CLAIM_FLAGS_MGMT_SERVICE_DISABLED       0x0020
186 
187 /* Claim Type defines */
188 
189 #define	   I2O_CLAIM_TYPE_PRIMARY_USER		       0x01
190 #define	   I2O_CLAIM_TYPE_AUTHORIZED_USER	       0x02
191 #define	   I2O_CLAIM_TYPE_SECONDARY_USER	       0x03
192 #define	   I2O_CLAIM_TYPE_MANAGEMENT_USER	       0x04
193 
194 /* UtilClaim Function Message Frame structure. */
195 
196 typedef struct _I2O_UTIL_CLAIM_MESSAGE {
197     I2O_MESSAGE_FRAME	       StdMessageFrame;
198     I2O_TRANSACTION_CONTEXT    TransactionContext;
199     U16			       ClaimFlags;
200     U8			       reserved;
201     U8			       ClaimType;
202 } I2O_UTIL_CLAIM_MESSAGE, *PI2O_UTIL_CLAIM_MESSAGE;
203 
204 
205 /****************************************************************************/
206 
207 /* Claim Release Flag defines */
208 
209 #define	   I2O_RELEASE_FLAGS_CONDITIONAL	       0x0001
210 
211 /* UtilClaimRelease Function Message Frame structure. */
212 
213 typedef struct _I2O_UTIL_CLAIM_RELEASE_MESSAGE {
214     I2O_MESSAGE_FRAME	       StdMessageFrame;
215     I2O_TRANSACTION_CONTEXT    TransactionContext;
216     U16			       ReleaseFlags;
217     U8			       reserved;
218     U8			       ClaimType;
219 } I2O_UTIL_CLAIM_RELEASE_MESSAGE, *PI2O_UTIL_CLAIM_RELEASE_MESSAGE;
220 
221 
222 /****************************************************************************/
223 
224 /*  UtilConfigDialog Function Message Frame structure */
225 
226 typedef struct _I2O_UTIL_CONFIG_DIALOG_MESSAGE {
227     I2O_MESSAGE_FRAME	       StdMessageFrame;
228     I2O_TRANSACTION_CONTEXT    TransactionContext;
229     U32			       PageNumber;
230     I2O_SG_ELEMENT	       SGL;
231 } I2O_UTIL_CONFIG_DIALOG_MESSAGE, *PI2O_UTIL_CONFIG_DIALOG_MESSAGE;
232 
233 
234 /****************************************************************************/
235 
236 /*  Event Acknowledge Function Message Frame structure */
237 
238 typedef struct _I2O_UTIL_EVENT_ACK_MESSAGE {
239     I2O_MESSAGE_FRAME	       StdMessageFrame;
240     I2O_TRANSACTION_CONTEXT    TransactionContext;
241     U32			       EventIndicator;
242     U32			       EventData[1];
243 } I2O_UTIL_EVENT_ACK_MESSAGE, *PI2O_UTIL_EVENT_ACK_MESSAGE;
244 
245 /* Event Ack Reply structure */
246 
247 typedef struct _I2O_UTIL_EVENT_ACK_REPLY {
248     I2O_MESSAGE_FRAME	       StdMessageFrame;
249     I2O_TRANSACTION_CONTEXT    TransactionContext;
250     U32			       EventIndicator;
251     U32			       EventData[1];
252 } I2O_UTIL_EVENT_ACK_REPLY, *PI2O_UTIL_EVENT_ACK_REPLY;
253 
254 
255 /****************************************************************************/
256 
257 /* Event Indicator Mask Flags */
258 
259 #define	   I2O_EVENT_IND_STATE_CHANGE		       0x80000000
260 #define	   I2O_EVENT_IND_GENERAL_WARNING	       0x40000000
261 #define	   I2O_EVENT_IND_CONFIGURATION_FLAG	       0x20000000
262 /* #define	   I2O_EVENT_IND_RESERVE_RELEASE	       0x10000000 */
263 #define	   I2O_EVENT_IND_LOCK_RELEASE		       0x10000000
264 #define	   I2O_EVENT_IND_CAPABILITY_CHANGE	       0x08000000
265 #define	   I2O_EVENT_IND_DEVICE_RESET		       0x04000000
266 #define	   I2O_EVENT_IND_EVENT_MASK_MODIFIED	       0x02000000
267 #define	   I2O_EVENT_IND_FIELD_MODIFIED		       0x01000000
268 #define	   I2O_EVENT_IND_VENDOR_EVENT		       0x00800000
269 #define	   I2O_EVENT_IND_DEVICE_STATE		       0x00400000
270 
271 /* Event Data for generic Events */
272 
273 #define	   I2O_EVENT_STATE_CHANGE_NORMAL	       0x00
274 #define	   I2O_EVENT_STATE_CHANGE_SUSPENDED	       0x01
275 #define	   I2O_EVENT_STATE_CHANGE_RESTART	       0x02
276 #define	   I2O_EVENT_STATE_CHANGE_NA_RECOVER	       0x03
277 #define	   I2O_EVENT_STATE_CHANGE_NA_NO_RECOVER	       0x04
278 #define	   I2O_EVENT_STATE_CHANGE_QUIESCE_REQUEST      0x05
279 #define	   I2O_EVENT_STATE_CHANGE_FAILED	       0x10
280 #define	   I2O_EVENT_STATE_CHANGE_FAULTED	       0x11
281 
282 #define	   I2O_EVENT_GEN_WARNING_NORMAL		       0x00
283 #define	   I2O_EVENT_GEN_WARNING_ERROR_THRESHOLD       0x01
284 #define	   I2O_EVENT_GEN_WARNING_MEDIA_FAULT	       0x02
285 
286 #define	   I2O_EVENT_CAPABILITY_OTHER		       0x01
287 #define	   I2O_EVENT_CAPABILITY_CHANGED		       0x02
288 
289 #define	   I2O_EVENT_SENSOR_STATE_CHANGED	       0x01
290 
291 
292 /*  UtilEventRegister Function Message Frame structure */
293 
294 typedef struct _I2O_UTIL_EVENT_REGISTER_MESSAGE {
295     I2O_MESSAGE_FRAME	       StdMessageFrame;
296     I2O_TRANSACTION_CONTEXT    TransactionContext;
297     U32			       EventMask;
298 } I2O_UTIL_EVENT_REGISTER_MESSAGE, *PI2O_UTIL_EVENT_REGISTER_MESSAGE;
299 
300 /* UtilEventRegister Reply structure */
301 
302 typedef struct _I2O_UTIL_EVENT_REGISTER_REPLY {
303     I2O_MESSAGE_FRAME	       StdMessageFrame;
304     I2O_TRANSACTION_CONTEXT    TransactionContext;
305     U32			       EventIndicator;
306     U32			       EventData[1];
307 } I2O_UTIL_EVENT_REGISTER_REPLY, *PI2O_UTIL_EVENT_REGISTER_REPLY;
308 
309 
310 /****************************************************************************/
311 
312 /* UtilLock Function Message Frame structure. */
313 
314 typedef struct _I2O_UTIL_LOCK_MESSAGE {
315     I2O_MESSAGE_FRAME	       StdMessageFrame;
316     I2O_TRANSACTION_CONTEXT    TransactionContext;
317 } I2O_UTIL_LOCK_MESSAGE, *PI2O_UTIL_LOCK_MESSAGE;
318 
319 /****************************************************************************/
320 
321 /* UtilLockRelease Function Message Frame structure. */
322 
323 typedef struct _I2O_UTIL_LOCK_RELEASE_MESSAGE {
324     I2O_MESSAGE_FRAME	       StdMessageFrame;
325     I2O_TRANSACTION_CONTEXT    TransactionContext;
326 } I2O_UTIL_LOCK_RELEASE_MESSAGE, *PI2O_UTIL_LOCK_RELEASE_MESSAGE;
327 
328 
329 /****************************************************************************/
330 
331 /* UtilNOP Function Message Frame structure. */
332 
333 typedef struct _I2O_UTIL_NOP_MESSAGE {
334     I2O_MESSAGE_FRAME	       StdMessageFrame;
335 } I2O_UTIL_NOP_MESSAGE, *PI2O_UTIL_NOP_MESSAGE;
336 
337 
338 /****************************************************************************/
339 
340 /* UtilParamsGet Message Frame structure. */
341 
342 typedef struct _I2O_UTIL_PARAMS_GET_MESSAGE {
343     I2O_MESSAGE_FRAME	       StdMessageFrame;
344     I2O_TRANSACTION_CONTEXT    TransactionContext;
345     U32			       OperationFlags;
346     I2O_SG_ELEMENT	       SGL;
347 } I2O_UTIL_PARAMS_GET_MESSAGE, *PI2O_UTIL_PARAMS_GET_MESSAGE;
348 
349 
350 /****************************************************************************/
351 
352 /* UtilParamsSet Message Frame structure. */
353 
354 typedef struct _I2O_UTIL_PARAMS_SET_MESSAGE {
355     I2O_MESSAGE_FRAME	       StdMessageFrame;
356     I2O_TRANSACTION_CONTEXT    TransactionContext;
357     U32			       OperationFlags;
358     I2O_SG_ELEMENT	       SGL;
359 } I2O_UTIL_PARAMS_SET_MESSAGE, *PI2O_UTIL_PARAMS_SET_MESSAGE;
360 
361 
362 /****************************************************************************/
363 
364 /* UtilReplyFaultNotify Message for Message Failure. */
365 
366 typedef struct _I2O_UTIL_REPLY_FAULT_NOTIFY_MESSAGE {
367     I2O_MESSAGE_FRAME	       StdMessageFrame;
368     I2O_TRANSACTION_CONTEXT    TransactionContext;
369     U8			       LowestVersion;
370     U8			       HighestVersion;
371     BF			       Severity:I2O_FAILCODE_SEVERITY_SZ;
372     BF			       FailureCode:I2O_FAILCODE_CODE_SZ;
373     BF			       FailingIOP_ID:I2O_IOP_ID_SZ;
374     BF			       reserved:I2O_RESERVED_4BITS;
375     BF			       FailingHostUnitID:I2O_UNIT_ID_SZ;
376     U32			       AgeLimit;
377 #if I2O_64BIT_CONTEXT
378     PI2O_MESSAGE_FRAME	       OriginalMFA;
379 #else
380     PI2O_MESSAGE_FRAME	       OriginalMFALowPart;
381     U32			       OriginalMFAHighPart;  /* Always 0000 */
382 #endif
383 } I2O_UTIL_REPLY_FAULT_NOTIFY_MESSAGE, *PI2O_UTIL_REPLY_FAULT_NOTIFY_MESSAGE;
384 
385 
386 /****************************************************************************/
387 
388 /* Device Reserve Function Message Frame structure. */
389 /* NOTE:  This was previously called the Reserve Message */
390 
391 typedef struct _I2O_UTIL_DEVICE_RESERVE_MESSAGE {
392     I2O_MESSAGE_FRAME	       StdMessageFrame;
393     I2O_TRANSACTION_CONTEXT    TransactionContext;
394 } I2O_UTIL_DEVICE_RESERVE_MESSAGE, *PI2O_UTIL_DEVICE_RESERVE_MESSAGE;
395 
396 
397 /****************************************************************************/
398 
399 /* Device Release Function Message Frame structure. */
400 /* NOTE:  This was previously called the ReserveRelease Message */
401 
402 typedef struct _I2O_UTIL_DEVICE_RELEASE_MESSAGE {
403     I2O_MESSAGE_FRAME	       StdMessageFrame;
404     I2O_TRANSACTION_CONTEXT    TransactionContext;
405 } I2O_UTIL_DEVICE_RELEASE_MESSAGE, *PI2O_UTIL_DEVICE_RELEASE_MESSAGE;
406 
407 
408 /****************************************************************************/
409 
410 PRAGMA_PACK_POP
411 PRAGMA_ALIGN_POP
412 
413 #endif	  /* I2O_UTILITY_HDR  */
414