xref: /illumos-gate/usr/src/uts/common/sys/scsi/generic/inquiry.h (revision 88f8b78a88cbdc6d8c1af5c3e54bc49d25095c98)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1996-2000 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_SYS_SCSI_GENERIC_INQUIRY_H
28 #define	_SYS_SCSI_GENERIC_INQUIRY_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * SCSI Inquiry Data
38  *
39  * Format of data returned as a result of an INQUIRY command.
40  *
41  */
42 
43 #if defined(_BIT_FIELDS_LTOH)
44 struct scsi_inquiry {
45 
46 	/*
47 	 * byte 0
48 	 *
49 	 * Bits 7-5 are the Peripheral Device Qualifier
50 	 * Bits 4-0 are the Peripheral Device Type
51 	 *
52 	 */
53 
54 	uchar_t	inq_dtype;
55 
56 	/* byte 1 */
57 	uchar_t	inq_qual	: 7,	/* device type qualifier	*/
58 		inq_rmb		: 1;	/* removable media		*/
59 
60 	/* byte 2 */
61 	uchar_t	inq_ansi	: 3,	/* ANSI version 		*/
62 		inq_ecma	: 3,	/* ECMA version 		*/
63 		inq_iso		: 2;	/* ISO version 			*/
64 
65 	/* byte 3 */
66 	uchar_t	inq_rdf		: 4,	/* response data format 	*/
67 				: 1,	/* reserved 			*/
68 		inq_normaca	: 1,	/* setting NACA bit supported */
69 		inq_trmiop	: 1,	/* TERMINATE I/O PROC msg 	*/
70 		inq_aenc	: 1;	/* async event notification cap. */
71 
72 	/* bytes 4-7 */
73 
74 	uchar_t	inq_len;		/* additional length 		*/
75 
76 	uchar_t			: 8;	/* reserved 			*/
77 
78 	uchar_t	inq_addr16	: 1,	/* supports 16 bit wide SCSI addr */
79 		inq_addr32	: 1,	/* supports 32 bit wide SCSI addr */
80 		inq_ackqreqq	: 1,	/* data tranfer on Q cable */
81 		inq_mchngr	: 1,	/* embedded/attached to medium chngr */
82 		inq_dualp	: 1,	/* dual port device */
83 		inq_port	: 1,	/* port receiving inquiry cmd */
84 				: 2;	/* reserved 			*/
85 
86 	uchar_t	inq_sftre	: 1,	/* supports Soft Reset option 	*/
87 		inq_cmdque	: 1,	/* supports command queueing 	*/
88 		inq_trandis	: 1,	/* supports transfer disable messages */
89 		inq_linked	: 1,	/* supports linked commands 	*/
90 		inq_sync	: 1,	/* supports synchronous data xfers */
91 		inq_wbus16	: 1,	/* supports 16 bit wide data xfers */
92 		inq_wbus32	: 1,	/* supports 32 bit wide data xfers */
93 		inq_reladdr	: 1;	/* supports relative addressing */
94 
95 	/* bytes 8-35 */
96 
97 	char	inq_vid[8];		/* vendor ID 			*/
98 	char	inq_pid[16];		/* product ID 			*/
99 	char	inq_revision[4];	/* revision level 		*/
100 
101 	/*
102 	 * Bytes 36-47 are reserved:
103 	 *	For Sun qualified hard disk drives the inq_serial field contains
104 	 *		two bytes of mfg date year code (ascii)
105 	 *		two bytes of mfg date week code (ascii)
106 	 *		six bytes of mfg serial number (ascii)
107 	 *		two bytes unused
108 	 */
109 	char	inq_serial[12];
110 
111 	/*
112 	 * Bytes 48-95 are reserved.
113 	 * 96 to 'n' are vendor-specific parameter bytes
114 	 */
115 };
116 
117 #elif defined(_BIT_FIELDS_HTOL)
118 
119 struct scsi_inquiry {
120 
121 	/*
122 	 * byte 0
123 	 *
124 	 * Bits 7-5 are the Peripheral Device Qualifier
125 	 * Bits 4-0 are the Peripheral Device Type
126 	 *
127 	 */
128 
129 	uchar_t	inq_dtype;
130 
131 	/* byte 1 */
132 	uchar_t	inq_rmb		: 1,	/* removable media */
133 		inq_qual	: 7;	/* device type qualifier */
134 
135 	/* byte 2 */
136 	uchar_t	inq_iso		: 2,	/* ISO version */
137 		inq_ecma	: 3,	/* ECMA version */
138 		inq_ansi	: 3;	/* ANSI version */
139 
140 	/* byte 3 */
141 	uchar_t	inq_aenc	: 1,	/* async event notification cap. */
142 		inq_trmiop	: 1,	/* supports TERMINATE I/O PROC msg */
143 		inq_normaca	: 1,	/* setting NACA bit supported */
144 				: 1,	/* reserved */
145 		inq_rdf		: 4;	/* response data format */
146 
147 	/* bytes 4-7 */
148 
149 	uchar_t	inq_len;		/* additional length */
150 
151 	uchar_t			: 8;	/* reserved */
152 
153 	uchar_t			: 2,	/* reserved 			*/
154 		inq_port	: 1,	/* port receiving inquiry cmd */
155 		inq_dualp	: 1,	/* dual port device */
156 		inq_mchngr	: 1,	/* embedded/attached to medium chngr */
157 		inq_ackqreqq	: 1,	/* data tranfer on Q cable */
158 		inq_addr32	: 1,	/* supports 32 bit wide SCSI addr */
159 		inq_addr16	: 1;	/* supports 16 bit wide SCSI addr */
160 
161 	uchar_t	inq_reladdr	: 1,	/* supports relative addressing */
162 		inq_wbus32	: 1,	/* supports 32 bit wide data xfers */
163 		inq_wbus16	: 1,	/* supports 16 bit wide data xfers */
164 		inq_sync	: 1,	/* supports synchronous data xfers */
165 		inq_linked	: 1,	/* supports linked commands */
166 		inq_trandis	: 1,	/* supports transfer disable messages */
167 		inq_cmdque	: 1,	/* supports command queueing */
168 		inq_sftre	: 1;	/* supports Soft Reset option */
169 
170 	/* bytes 8-35 */
171 
172 	char	inq_vid[8];		/* vendor ID */
173 
174 	char	inq_pid[16];		/* product ID */
175 
176 	char	inq_revision[4];	/* revision level */
177 
178 	/*
179 	 * Bytes 36-47 are reserved:
180 	 *	For Sun qualified hard disk drives the inq_serial field contains
181 	 *		two bytes of mfg date year code (ascii)
182 	 *		two bytes of mfg date week code (ascii)
183 	 *		six bytes of mfg serial number (ascii)
184 	 *		two bytes unused
185 	 */
186 	char	inq_serial[12];
187 
188 	/*
189 	 * Bytes 48-95 are reserved.
190 	 * 96 to 'n' are vendor-specific parameter bytes
191 	 */
192 };
193 #else
194 #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
195 #endif	/* _BIT_FIELDS_LTOH */
196 
197 /*
198  * Defined Peripheral Device Types
199  */
200 
201 #define	DTYPE_DIRECT		0x00
202 #define	DTYPE_SEQUENTIAL	0x01
203 #define	DTYPE_PRINTER		0x02
204 #define	DTYPE_PROCESSOR		0x03
205 #define	DTYPE_WORM		0x04
206 #define	DTYPE_RODIRECT		0x05
207 #define	DTYPE_SCANNER		0x06
208 #define	DTYPE_OPTICAL		0x07
209 #define	DTYPE_CHANGER		0x08
210 #define	DTYPE_COMM		0x09
211 #define	DTYPE_ARRAY_CTRL	0x0C
212 #define	DTYPE_ESI		0x0D
213 
214 /*
215  * Device types 0x0E-0x1E are reserved
216  */
217 
218 #define	DTYPE_UNKNOWN		0x1F
219 
220 #define	DTYPE_MASK		0x1F
221 
222 /*
223  * The peripheral qualifier tells us more about a particular device.
224  * (DPQ == DEVICE PERIPHERAL QUALIFIER).
225  */
226 
227 #define	DPQ_POSSIBLE	0x00
228 				/*
229 				 * The specified peripheral device type is
230 				 * currently connected to this logical unit.
231 				 * If the target cannot detrermine whether
232 				 * or not a physical device is currently
233 				 * connected, it shall also return this
234 				 * qualifier.
235 				 */
236 
237 #define	DPQ_SUPPORTED	0x20
238 				/*
239 				 * The target is capable of supporting the
240 				 * specified peripheral device type on this
241 				 * logical unit, however the the physical
242 				 * device is not currently connected to this
243 				 * logical unit.
244 				 */
245 
246 #define	DPQ_NEVER	0x60
247 				/*
248 				 * The target is not capable of supporting a
249 				 * physical device on this logical unit. For
250 				 * this peripheral qualifier, the peripheral
251 				 * device type will be set to DTYPE_UNKNOWN
252 				 * in order to provide compatibility with
253 				 * previous versions of SCSI.
254 				 */
255 
256 #define	DPQ_VUNIQ	0x80
257 				/*
258 				 * If this bit is set, this is a vendor
259 				 * unique qualifier.
260 				 */
261 /*
262  * To maintain compatibility with previous versions
263  * of inquiry data formats, if a device peripheral
264  * qualifier states that the target is not capable
265  * of supporting a physical device on this logical unit,
266  * then the qualifier DPQ_NEVER is set, *AND* the
267  * actual device type must be set to DTYPE_UNKNOWN.
268  *
269  * This may make for some problems with older drivers
270  * that blindly check the entire first byte, where they
271  * should be checking for only the least 5 bits to see
272  * whether the correct type is at the specified nexus.
273  */
274 
275 #define	DTYPE_NOTPRESENT	(DPQ_NEVER | DTYPE_UNKNOWN)
276 
277 /*
278  * Defined Response Data Formats
279  *
280  * RDF_LEVEL0 means that this structure complies with SCSI-1 spec.
281  *
282  * RDF_CCS means that this structure complies with CCS pseudo-spec.
283  *
284  * RDF_SCSI2 means that the structure complies with the SCSI-2/3 spec.
285  */
286 
287 #define	RDF_LEVEL0		0x00
288 #define	RDF_CCS			0x01
289 #define	RDF_SCSI2		0x02
290 
291 #ifdef	__cplusplus
292 }
293 #endif
294 
295 /*
296  * Include in implementation specifuc
297  * (non-generic) inquiry definitions.
298  */
299 
300 #include <sys/scsi/impl/inquiry.h>
301 
302 #endif	/* _SYS_SCSI_GENERIC_INQUIRY_H */
303