xref: /illumos-gate/usr/src/uts/common/sys/scsi/generic/sense.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_SCSI_GENERIC_SENSE_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_SCSI_GENERIC_SENSE_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate /*
37*7c478bd9Sstevel@tonic-gate  * Standard (Non-Extended) SCSI Sense.
38*7c478bd9Sstevel@tonic-gate  *
39*7c478bd9Sstevel@tonic-gate  * For Error Classe 0-6. This is all
40*7c478bd9Sstevel@tonic-gate  * Vendor Unique sense information.
41*7c478bd9Sstevel@tonic-gate  *
42*7c478bd9Sstevel@tonic-gate  * Note: This is pre-SCSI-2.
43*7c478bd9Sstevel@tonic-gate  */
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate struct scsi_sense {
46*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
47*7c478bd9Sstevel@tonic-gate 	uchar_t	ns_code		: 4,	/* Vendor Uniqe error code 	*/
48*7c478bd9Sstevel@tonic-gate 		ns_class	: 3,	/* Error class 			*/
49*7c478bd9Sstevel@tonic-gate 		ns_valid	: 1;	/* Logical Block Address is val */
50*7c478bd9Sstevel@tonic-gate 	uchar_t	ns_lba_hi	: 5,	/* High Logical Block Address */
51*7c478bd9Sstevel@tonic-gate 		ns_vu		: 3;	/* Vendor Unique value */
52*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
53*7c478bd9Sstevel@tonic-gate 	uchar_t	ns_valid	: 1,	/* Logical Block Address is valid */
54*7c478bd9Sstevel@tonic-gate 		ns_class	: 3,	/* Error class */
55*7c478bd9Sstevel@tonic-gate 		ns_code		: 4;	/* Vendor Uniqe error code */
56*7c478bd9Sstevel@tonic-gate 	uchar_t	ns_vu		: 3,	/* Vendor Unique value */
57*7c478bd9Sstevel@tonic-gate 		ns_lba_hi	: 5;	/* High Logical Block Address */
58*7c478bd9Sstevel@tonic-gate #else
59*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
60*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
61*7c478bd9Sstevel@tonic-gate 	uchar_t	ns_lba_mid;		/* Middle Logical Block Address */
62*7c478bd9Sstevel@tonic-gate 	uchar_t	ns_lba_lo;		/* Low part of Logical Block Address */
63*7c478bd9Sstevel@tonic-gate };
64*7c478bd9Sstevel@tonic-gate 
65*7c478bd9Sstevel@tonic-gate /*
66*7c478bd9Sstevel@tonic-gate  * SCSI Extended Sense structure
67*7c478bd9Sstevel@tonic-gate  *
68*7c478bd9Sstevel@tonic-gate  * For Error Class 7, the Extended Sense Structure is applicable (now referred
69*7c478bd9Sstevel@tonic-gate  * to in SPC-3 as "fixed format sense data").  The es_code field is used
70*7c478bd9Sstevel@tonic-gate  * to determine whether the extended sense data is actually "fixed format" or
71*7c478bd9Sstevel@tonic-gate  * the newer "descriptor format" introduced in SPC-3.
72*7c478bd9Sstevel@tonic-gate  */
73*7c478bd9Sstevel@tonic-gate 
74*7c478bd9Sstevel@tonic-gate #define	CLASS_EXTENDED_SENSE	0x7	/* indicates extended sense */
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate struct scsi_extended_sense {
77*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
78*7c478bd9Sstevel@tonic-gate 	uchar_t	es_code		: 4,	/* Vendor Unique error code 	*/
79*7c478bd9Sstevel@tonic-gate 		es_class	: 3,	/* Error Class- fixed at 0x7 	*/
80*7c478bd9Sstevel@tonic-gate 		es_valid	: 1;	/* sense data is valid 		*/
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate 	uchar_t	es_segnum;		/* segment number: for COPY cmd */
83*7c478bd9Sstevel@tonic-gate 
84*7c478bd9Sstevel@tonic-gate 	uchar_t	es_key		: 4,	/* Sense key (see below) 	*/
85*7c478bd9Sstevel@tonic-gate 				: 1,	/* reserved 			*/
86*7c478bd9Sstevel@tonic-gate 		es_ili		: 1,	/* Incorrect Length Indicator 	*/
87*7c478bd9Sstevel@tonic-gate 		es_eom		: 1,	/* End of Media 		*/
88*7c478bd9Sstevel@tonic-gate 		es_filmk	: 1;	/* File Mark Detected 		*/
89*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
90*7c478bd9Sstevel@tonic-gate 	uchar_t	es_valid	: 1,	/* sense data is valid */
91*7c478bd9Sstevel@tonic-gate 		es_class	: 3,	/* Error Class- fixed at 0x7 */
92*7c478bd9Sstevel@tonic-gate 		es_code		: 4;	/* Vendor Unique error code */
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate 	uchar_t	es_segnum;		/* segment number: for COPY cmd */
95*7c478bd9Sstevel@tonic-gate 
96*7c478bd9Sstevel@tonic-gate 	uchar_t	es_filmk	: 1,	/* File Mark Detected */
97*7c478bd9Sstevel@tonic-gate 		es_eom		: 1,	/* End of Media */
98*7c478bd9Sstevel@tonic-gate 		es_ili		: 1,	/* Incorrect Length Indicator */
99*7c478bd9Sstevel@tonic-gate 				: 1,	/* reserved */
100*7c478bd9Sstevel@tonic-gate 		es_key		: 4;	/* Sense key (see below) */
101*7c478bd9Sstevel@tonic-gate #else
102*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
103*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
104*7c478bd9Sstevel@tonic-gate 
105*7c478bd9Sstevel@tonic-gate 	uchar_t	es_info_1;		/* information byte 1 */
106*7c478bd9Sstevel@tonic-gate 	uchar_t	es_info_2;		/* information byte 2 */
107*7c478bd9Sstevel@tonic-gate 	uchar_t	es_info_3;		/* information byte 3 */
108*7c478bd9Sstevel@tonic-gate 	uchar_t	es_info_4;		/* information byte 4 */
109*7c478bd9Sstevel@tonic-gate 	uchar_t	es_add_len;		/* number of additional bytes */
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate 	uchar_t	es_cmd_info[4];		/* command specific information */
112*7c478bd9Sstevel@tonic-gate 	uchar_t	es_add_code;		/* Additional Sense Code */
113*7c478bd9Sstevel@tonic-gate 	uchar_t	es_qual_code;		/* Additional Sense Code Qualifier */
114*7c478bd9Sstevel@tonic-gate 	uchar_t	es_fru_code;		/* Field Replaceable Unit Code */
115*7c478bd9Sstevel@tonic-gate 	uchar_t	es_skey_specific[3];	/* Sense Key Specific information */
116*7c478bd9Sstevel@tonic-gate 
117*7c478bd9Sstevel@tonic-gate 	/*
118*7c478bd9Sstevel@tonic-gate 	 * Additional bytes may be defined in each implementation.
119*7c478bd9Sstevel@tonic-gate 	 * The actual amount of space allocated for Sense Information
120*7c478bd9Sstevel@tonic-gate 	 * is also implementation dependent.
121*7c478bd9Sstevel@tonic-gate 	 *
122*7c478bd9Sstevel@tonic-gate 	 * Modulo that, the declaration of an array two bytes in size
123*7c478bd9Sstevel@tonic-gate 	 * nicely rounds this entire structure to a size of 20 bytes.
124*7c478bd9Sstevel@tonic-gate 	 */
125*7c478bd9Sstevel@tonic-gate 
126*7c478bd9Sstevel@tonic-gate 	uchar_t	es_add_info[2];		/* additional information */
127*7c478bd9Sstevel@tonic-gate 
128*7c478bd9Sstevel@tonic-gate };
129*7c478bd9Sstevel@tonic-gate 
130*7c478bd9Sstevel@tonic-gate /*
131*7c478bd9Sstevel@tonic-gate  * Sense code values for Extended Sense
132*7c478bd9Sstevel@tonic-gate  */
133*7c478bd9Sstevel@tonic-gate 
134*7c478bd9Sstevel@tonic-gate #define	CODE_FMT_FIXED_CURRENT		0x0
135*7c478bd9Sstevel@tonic-gate #define	CODE_FMT_FIXED_DEFERRED		0x1
136*7c478bd9Sstevel@tonic-gate #define	CODE_FMT_DESCR_CURRENT		0x2
137*7c478bd9Sstevel@tonic-gate #define	CODE_FMT_DESCR_DEFERRED		0x3
138*7c478bd9Sstevel@tonic-gate #define	CODE_FMT_VENDOR_SPECIFIC	0xF
139*7c478bd9Sstevel@tonic-gate 
140*7c478bd9Sstevel@tonic-gate /*
141*7c478bd9Sstevel@tonic-gate  * Sense Key values for Extended Sense.
142*7c478bd9Sstevel@tonic-gate  */
143*7c478bd9Sstevel@tonic-gate 
144*7c478bd9Sstevel@tonic-gate #define	KEY_NO_SENSE		0x00
145*7c478bd9Sstevel@tonic-gate #define	KEY_RECOVERABLE_ERROR	0x01
146*7c478bd9Sstevel@tonic-gate #define	KEY_NOT_READY		0x02
147*7c478bd9Sstevel@tonic-gate #define	KEY_MEDIUM_ERROR	0x03
148*7c478bd9Sstevel@tonic-gate #define	KEY_HARDWARE_ERROR	0x04
149*7c478bd9Sstevel@tonic-gate #define	KEY_ILLEGAL_REQUEST	0x05
150*7c478bd9Sstevel@tonic-gate #define	KEY_UNIT_ATTENTION	0x06
151*7c478bd9Sstevel@tonic-gate #define	KEY_WRITE_PROTECT	0x07
152*7c478bd9Sstevel@tonic-gate #define	KEY_DATA_PROTECT	KEY_WRITE_PROTECT
153*7c478bd9Sstevel@tonic-gate #define	KEY_BLANK_CHECK		0x08
154*7c478bd9Sstevel@tonic-gate #define	KEY_VENDOR_UNIQUE	0x09
155*7c478bd9Sstevel@tonic-gate #define	KEY_COPY_ABORTED	0x0A
156*7c478bd9Sstevel@tonic-gate #define	KEY_ABORTED_COMMAND	0x0B
157*7c478bd9Sstevel@tonic-gate #define	KEY_EQUAL		0x0C
158*7c478bd9Sstevel@tonic-gate #define	KEY_VOLUME_OVERFLOW	0x0D
159*7c478bd9Sstevel@tonic-gate #define	KEY_MISCOMPARE		0x0E
160*7c478bd9Sstevel@tonic-gate #define	KEY_RESERVED		0x0F
161*7c478bd9Sstevel@tonic-gate 
162*7c478bd9Sstevel@tonic-gate /*
163*7c478bd9Sstevel@tonic-gate  * Descriptor sense data header
164*7c478bd9Sstevel@tonic-gate  *
165*7c478bd9Sstevel@tonic-gate  * Descriptor format sense data is described in the SPC-3 standard.  Unlike
166*7c478bd9Sstevel@tonic-gate  * the fixed format sense data, descriptor format consists of a header
167*7c478bd9Sstevel@tonic-gate  * followed by a variable length list of sense data descriptors.
168*7c478bd9Sstevel@tonic-gate  */
169*7c478bd9Sstevel@tonic-gate 
170*7c478bd9Sstevel@tonic-gate struct scsi_descr_sense_hdr {
171*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
172*7c478bd9Sstevel@tonic-gate 	uchar_t	ds_code		: 4,	/* Vendor Unique error code 	*/
173*7c478bd9Sstevel@tonic-gate 		ds_class	: 3,	/* Error Class- fixed at 0x7 	*/
174*7c478bd9Sstevel@tonic-gate 		ds_reserved	: 1;	/* sense data is valid 		*/
175*7c478bd9Sstevel@tonic-gate 
176*7c478bd9Sstevel@tonic-gate 	uchar_t	ds_key		: 4,	/* Sense key 			*/
177*7c478bd9Sstevel@tonic-gate 		ds_reserved2	: 4;	/* reserved 			*/
178*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
179*7c478bd9Sstevel@tonic-gate 	uchar_t	ds_reserved	: 1,	/* sense data is valid */
180*7c478bd9Sstevel@tonic-gate 		ds_class	: 3,	/* Error Class- fixed at 0x7 */
181*7c478bd9Sstevel@tonic-gate 		ds_code		: 4;	/* Vendor Unique error code */
182*7c478bd9Sstevel@tonic-gate 
183*7c478bd9Sstevel@tonic-gate 	uchar_t	ds_reserved2	: 4,	/* reserved */
184*7c478bd9Sstevel@tonic-gate 		ds_key		: 4;	/* Sense key (see below) */
185*7c478bd9Sstevel@tonic-gate #else
186*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
187*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
188*7c478bd9Sstevel@tonic-gate 
189*7c478bd9Sstevel@tonic-gate 	uchar_t	ds_add_code;		/* Additional Sense Code */
190*7c478bd9Sstevel@tonic-gate 	uchar_t	ds_qual_code;		/* Additional Sense Code Qualifier */
191*7c478bd9Sstevel@tonic-gate 
192*7c478bd9Sstevel@tonic-gate 	uchar_t ds_reserved3[3];	/* reserved */
193*7c478bd9Sstevel@tonic-gate 
194*7c478bd9Sstevel@tonic-gate 	uchar_t ds_addl_sense_length;	/* Additional sense data length */
195*7c478bd9Sstevel@tonic-gate };
196*7c478bd9Sstevel@tonic-gate 
197*7c478bd9Sstevel@tonic-gate /*
198*7c478bd9Sstevel@tonic-gate  * SCSI sense descriptors
199*7c478bd9Sstevel@tonic-gate  */
200*7c478bd9Sstevel@tonic-gate 
201*7c478bd9Sstevel@tonic-gate struct scsi_information_sense_descr {
202*7c478bd9Sstevel@tonic-gate 	uchar_t isd_descr_type;		/* Descriptor type (0x00)	*/
203*7c478bd9Sstevel@tonic-gate 	uchar_t isd_addl_length;	/* Additional byte count (0x0A)	*/
204*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
205*7c478bd9Sstevel@tonic-gate 	uchar_t	isd_reserved1	: 7,	/* reserved 			*/
206*7c478bd9Sstevel@tonic-gate 		isd_valid	: 1;	/* Always set to 1 		*/
207*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
208*7c478bd9Sstevel@tonic-gate 	uchar_t	isd_valid	: 1,	/* Always set to 1 		*/
209*7c478bd9Sstevel@tonic-gate 		isd_reserved1	: 7;	/* reserved 			*/
210*7c478bd9Sstevel@tonic-gate #else
211*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
212*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
213*7c478bd9Sstevel@tonic-gate 	uchar_t isd_reserved2;		/* reserved */
214*7c478bd9Sstevel@tonic-gate 	uchar_t isd_information[8];	/* Information bytes		*/
215*7c478bd9Sstevel@tonic-gate };
216*7c478bd9Sstevel@tonic-gate 
217*7c478bd9Sstevel@tonic-gate struct scsi_cmd_specific_sense_descr {
218*7c478bd9Sstevel@tonic-gate 	uchar_t css_descr_type;		/* Descriptor type (0x01)	*/
219*7c478bd9Sstevel@tonic-gate 	uchar_t css_addl_length;	/* Additional byte count (0x0A)	*/
220*7c478bd9Sstevel@tonic-gate 	uchar_t css_reserved[2];	/* reserved 			*/
221*7c478bd9Sstevel@tonic-gate 	uchar_t css_cmd_specific_info[8]; /* Command specific info	*/
222*7c478bd9Sstevel@tonic-gate };
223*7c478bd9Sstevel@tonic-gate 
224*7c478bd9Sstevel@tonic-gate struct scsi_sk_specific_sense_descr {
225*7c478bd9Sstevel@tonic-gate 	uchar_t sss_descr_type;		/* Descriptor type 		*/
226*7c478bd9Sstevel@tonic-gate 	uchar_t sss_addl_length;	/* Additional byte count (0x06)	*/
227*7c478bd9Sstevel@tonic-gate 	uchar_t sss_reserved[2];	/* reserved 			*/
228*7c478bd9Sstevel@tonic-gate 	union {
229*7c478bd9Sstevel@tonic-gate 		/*
230*7c478bd9Sstevel@tonic-gate 		 * Field pointer (Sense key = Illegal Request)
231*7c478bd9Sstevel@tonic-gate 		 */
232*7c478bd9Sstevel@tonic-gate 		struct {
233*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
234*7c478bd9Sstevel@tonic-gate 			uchar_t	bit_pointer	: 3,
235*7c478bd9Sstevel@tonic-gate 				bpv		: 1,
236*7c478bd9Sstevel@tonic-gate 				reserved	: 2,
237*7c478bd9Sstevel@tonic-gate 				cd		: 1,
238*7c478bd9Sstevel@tonic-gate 				sksv		: 1;
239*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
240*7c478bd9Sstevel@tonic-gate 			uchar_t	sksv		: 1,
241*7c478bd9Sstevel@tonic-gate 				cd		: 1,
242*7c478bd9Sstevel@tonic-gate 				reserved	: 2,
243*7c478bd9Sstevel@tonic-gate 				bpv		: 1,
244*7c478bd9Sstevel@tonic-gate 				bit_pointer	: 3;
245*7c478bd9Sstevel@tonic-gate #else
246*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
247*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
248*7c478bd9Sstevel@tonic-gate 			uchar_t field_pointer[2];
249*7c478bd9Sstevel@tonic-gate 		} fp;
250*7c478bd9Sstevel@tonic-gate 		/*
251*7c478bd9Sstevel@tonic-gate 		 * Actual Retry Count (Sense key = Hardware error,
252*7c478bd9Sstevel@tonic-gate 		 * Medium Error or Recovered Error)
253*7c478bd9Sstevel@tonic-gate 		 */
254*7c478bd9Sstevel@tonic-gate 		struct {
255*7c478bd9Sstevel@tonic-gate 			uchar_t sksv;
256*7c478bd9Sstevel@tonic-gate 			uchar_t actual_retry_count[2];
257*7c478bd9Sstevel@tonic-gate 		} arc;
258*7c478bd9Sstevel@tonic-gate 		/*
259*7c478bd9Sstevel@tonic-gate 		 * Progress Indication (Sense key = No Sense or Not Ready
260*7c478bd9Sstevel@tonic-gate 		 */
261*7c478bd9Sstevel@tonic-gate 		struct {
262*7c478bd9Sstevel@tonic-gate 			uchar_t sksv;
263*7c478bd9Sstevel@tonic-gate 			uchar_t progress_indication[2];
264*7c478bd9Sstevel@tonic-gate 		} pi;
265*7c478bd9Sstevel@tonic-gate 		/*
266*7c478bd9Sstevel@tonic-gate 		 * Segment Pointer (Sense key = Copy Aborted)
267*7c478bd9Sstevel@tonic-gate 		 */
268*7c478bd9Sstevel@tonic-gate 		struct {
269*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
270*7c478bd9Sstevel@tonic-gate 			uchar_t	bit_pointer	: 3,
271*7c478bd9Sstevel@tonic-gate 				bpv		: 1,
272*7c478bd9Sstevel@tonic-gate 				reserved	: 1,
273*7c478bd9Sstevel@tonic-gate 				sd		: 1,
274*7c478bd9Sstevel@tonic-gate 				reserved2	: 1,
275*7c478bd9Sstevel@tonic-gate 				sksv		: 1;
276*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
277*7c478bd9Sstevel@tonic-gate 			uchar_t	sksv		: 1,
278*7c478bd9Sstevel@tonic-gate 				reserved2	: 1,
279*7c478bd9Sstevel@tonic-gate 				sd		: 1,
280*7c478bd9Sstevel@tonic-gate 				reserved	: 1,
281*7c478bd9Sstevel@tonic-gate 				bpv		: 1,
282*7c478bd9Sstevel@tonic-gate 				bit_pointer	: 3;
283*7c478bd9Sstevel@tonic-gate #else
284*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
285*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
286*7c478bd9Sstevel@tonic-gate 			uchar_t field_pointer[2];
287*7c478bd9Sstevel@tonic-gate 		} sp;
288*7c478bd9Sstevel@tonic-gate 	} sss_data;
289*7c478bd9Sstevel@tonic-gate 	uchar_t sss_reserved2;		/* reserved 			*/
290*7c478bd9Sstevel@tonic-gate };
291*7c478bd9Sstevel@tonic-gate 
292*7c478bd9Sstevel@tonic-gate struct scsi_fru_sense_descr {
293*7c478bd9Sstevel@tonic-gate 	uchar_t fs_descr_type;		/* Descriptor type (0x03)	*/
294*7c478bd9Sstevel@tonic-gate 	uchar_t fs_addl_length;		/* Additional byte count (0x02)	*/
295*7c478bd9Sstevel@tonic-gate 	uchar_t fs_reserved;		/* reserved 			*/
296*7c478bd9Sstevel@tonic-gate 	uchar_t fs_fru_code; 		/* Field Replaceable Unit Code	*/
297*7c478bd9Sstevel@tonic-gate };
298*7c478bd9Sstevel@tonic-gate 
299*7c478bd9Sstevel@tonic-gate struct scsi_stream_cmd_sense_descr {
300*7c478bd9Sstevel@tonic-gate 	uchar_t scs_descr_type;		/* Descriptor type (0x04)	*/
301*7c478bd9Sstevel@tonic-gate 	uchar_t scs_addl_length;	/* Additional byte count (0x02)	*/
302*7c478bd9Sstevel@tonic-gate 	uchar_t scs_reserved;		/* reserved 			*/
303*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
304*7c478bd9Sstevel@tonic-gate 	uchar_t	scs_reserved2	: 5,
305*7c478bd9Sstevel@tonic-gate 		scs_ili		: 1,
306*7c478bd9Sstevel@tonic-gate 		scs_eom		: 1,
307*7c478bd9Sstevel@tonic-gate 		scs_filemark	: 1;
308*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
309*7c478bd9Sstevel@tonic-gate 	uchar_t	scs_filemark	: 1,
310*7c478bd9Sstevel@tonic-gate 		scs_eom		: 1,
311*7c478bd9Sstevel@tonic-gate 		scs_ili		: 1,
312*7c478bd9Sstevel@tonic-gate 		scs_reserved2	: 5;
313*7c478bd9Sstevel@tonic-gate #else
314*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
315*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
316*7c478bd9Sstevel@tonic-gate };
317*7c478bd9Sstevel@tonic-gate 
318*7c478bd9Sstevel@tonic-gate struct scsi_block_cmd_sense_descr {
319*7c478bd9Sstevel@tonic-gate 	uchar_t bcs_descr_type;		/* Descriptor type (0x05)	*/
320*7c478bd9Sstevel@tonic-gate 	uchar_t bcs_addl_length;	/* Additional byte count (0x02)	*/
321*7c478bd9Sstevel@tonic-gate 	uchar_t bcs_reserved;		/* reserved 			*/
322*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
323*7c478bd9Sstevel@tonic-gate 	uchar_t	bcs_reserved2	: 5,
324*7c478bd9Sstevel@tonic-gate 		bcs_ili		: 1,
325*7c478bd9Sstevel@tonic-gate 		bcs_reserved3	: 2;
326*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
327*7c478bd9Sstevel@tonic-gate 	uchar_t	bcs_reserved3	: 2,
328*7c478bd9Sstevel@tonic-gate 		bcs_ili		: 1,
329*7c478bd9Sstevel@tonic-gate 		bcs_reserved2	: 5;
330*7c478bd9Sstevel@tonic-gate #else
331*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
332*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
333*7c478bd9Sstevel@tonic-gate };
334*7c478bd9Sstevel@tonic-gate 
335*7c478bd9Sstevel@tonic-gate struct scsi_vendor_specific_sense_descr {
336*7c478bd9Sstevel@tonic-gate 	uchar_t vss_descr_type;		/* Descriptor type (0x80-0xFF)	*/
337*7c478bd9Sstevel@tonic-gate 	uchar_t vss_addl_length;	/* Additional byte count	*/
338*7c478bd9Sstevel@tonic-gate 	/*
339*7c478bd9Sstevel@tonic-gate 	 * Variable length vendor specific data
340*7c478bd9Sstevel@tonic-gate 	 */
341*7c478bd9Sstevel@tonic-gate 	uchar_t vss_vendor_specific_info[1];
342*7c478bd9Sstevel@tonic-gate };
343*7c478bd9Sstevel@tonic-gate 
344*7c478bd9Sstevel@tonic-gate /*
345*7c478bd9Sstevel@tonic-gate  * SCSI Descriptor Types
346*7c478bd9Sstevel@tonic-gate  */
347*7c478bd9Sstevel@tonic-gate #define	DESCR_INFORMATION		0x00
348*7c478bd9Sstevel@tonic-gate #define	DESCR_COMMAND_SPECIFIC		0x01
349*7c478bd9Sstevel@tonic-gate #define	DESCR_SENSE_KEY_SPECIFIC	0x02
350*7c478bd9Sstevel@tonic-gate #define	DESCR_FRU			0x03
351*7c478bd9Sstevel@tonic-gate #define	DESCR_STREAM_COMMANDS		0x04
352*7c478bd9Sstevel@tonic-gate #define	DESCR_BLOCK_COMMANDS		0x05
353*7c478bd9Sstevel@tonic-gate 
354*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
355*7c478bd9Sstevel@tonic-gate }
356*7c478bd9Sstevel@tonic-gate #endif
357*7c478bd9Sstevel@tonic-gate 
358*7c478bd9Sstevel@tonic-gate /*
359*7c478bd9Sstevel@tonic-gate  * Each implementation will have specific mappings to what
360*7c478bd9Sstevel@tonic-gate  * Sense Information means
361*7c478bd9Sstevel@tonic-gate  */
362*7c478bd9Sstevel@tonic-gate 
363*7c478bd9Sstevel@tonic-gate #include <sys/scsi/impl/sense.h>
364*7c478bd9Sstevel@tonic-gate 
365*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_SCSI_GENERIC_SENSE_H */
366