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