1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SCSI_GENERIC_INQUIRY_H
#define _SYS_SCSI_GENERIC_INQUIRY_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* SCSI Standard Inquiry Data:
*
* Format of data returned as a result of an INQUIRY command.
*
* NOTE: Fields marked 'DEPRECATED' are defined in older versions of t10 "SCSI
* Primary Command" spec, and are marked 'Obsolete' in newer versions.
*/
#if defined(_BIT_FIELDS_LTOH)
struct scsi_inquiry {
/*
* byte 0
*
* Bits 7-5 are the Peripheral Device Qualifier
* Bits 4-0 are the Peripheral Device Type
*/
uchar_t inq_dtype;
/* byte 1 */
uchar_t inq_qual : 7, /* device type qualifier */
inq_rmb : 1; /* removable media */
/* byte 2 */
uchar_t inq_ansi : 3, /* ANSI version */
inq_ecma : 3, /* ECMA version */
inq_iso : 2; /* ISO version */
/* byte 3 */
uchar_t inq_rdf : 4, /* response data format */
inq_hisup : 1, /* hierarchical addressing model */
inq_normaca : 1, /* setting NACA bit supported */
inq_trmiop : 1, /* DEPRECATED: terminate I/O proc */
inq_aenc : 1; /* DEPRECATED: async event notify */
/* bytes 4-7 */
uchar_t inq_len; /* additional length */
uchar_t inq_protect : 1, /* supports protection information */
inq_5_1 : 1,
inq_5_2 : 1,
inq_3pc : 1, /* third-party copy */
inq_tpgs : 2, /* impl/expl asymmetric lun access */
inq_acc : 1, /* access controls coordinator */
inq_sccs : 1; /* embedded storage array */
uchar_t inq_addr16 : 1, /* SPI: 16-bit wide SCSI addr */
inq_addr32 : 1, /* DEPRECATED: 32 bit wide address */
inq_ackqreqq : 1, /* DEPRECATED: data xfer on Q cable */
inq_mchngr : 1, /* DEPRECATED: embeded medium changer */
inq_dualp : 1, /* multi port device */
inq_port : 1, /* DEPRECATED: port rcv inquiry cmd */
inq_encserv : 1, /* embedded enclosure services */
inq_bque : 1; /* DEPRECATED: combined with cmdque */
uchar_t inq_sftre : 1, /* DEPRECATED: Soft Reset option */
inq_cmdque : 1, /* supports command queueing */
inq_trandis : 1, /* DEPRECATED: transfer disable msgs */
inq_linked : 1, /* DEPRECATED: linked commands */
inq_sync : 1, /* SPI: synchronous data xfers */
inq_wbus16 : 1, /* SPI: 16-bit wide data xfers */
inq_wbus32 : 1, /* DEPRECATED: 32 bit wide data xfers */
inq_reladdr : 1; /* DEPRECATED: relative addressing */
/* bytes 8-35 */
char inq_vid[8]; /* vendor ID */
char inq_pid[16]; /* product ID */
char inq_revision[4]; /* revision level */
/*
* Bytes 36-47 are reserved:
* For Sun qualified hard disk drives the inq_serial field contains
* two bytes of mfg date year code (ascii)
* two bytes of mfg date week code (ascii)
* six bytes of mfg serial number (ascii)
* two bytes unused
*/
char inq_serial[12];
/*
* Bytes 48-55 are reserved.
*/
uchar_t __inq_48 : 8;
uchar_t __inq_49 : 8;
uchar_t __inq_50 : 8;
uchar_t __inq_51 : 8;
uchar_t __inq_52 : 8;
uchar_t __inq_53 : 8;
uchar_t __inq_54 : 8;
uchar_t __inq_55 : 8;
/*
* The meanings of byte 56 is specific to SPI-3. For protocols older
* or other than this these fields are reserved.
*/
uchar_t inq_ius : 1, /* SPI3: information units */
inq_qas : 1, /* SPI3: quick arb sel */
inq_clk : 2, /* SPI3: clocking */
__inq_56_4 : 1, /* reserved */
__inq_56_5 : 1, /* reserved */
__inq_56_6 : 1, /* reserved */
__inq_56_7 : 1; /* reserved */
uchar_t __inq_57 : 8; /* reserved */
/*
* byte pairs 58-73 are version descriptors
* See: Table 51: dpANS SCSI Primary Commands - 2 (SPC-2) T10/1236
*/
struct inq_vd {
uchar_t inq_vd_msb;
uchar_t inq_vd_lsb;
} inq_vd[8];
/*
* Bytes 74-95 are reserved.
* 96 to 'n' are vendor-specific parameter bytes.
*
* Pad structure to 132 bytes so that access to some vendor-specific
* data is possible via scsi_device(9S) sd_inq (for mpxio).
*/
uchar_t __inq_74_127[132 - 74];
};
#elif defined(_BIT_FIELDS_HTOL)
struct scsi_inquiry {
/*
* byte 0
*
* Bits 7-5 are the Peripheral Device Qualifier
* Bits 4-0 are the Peripheral Device Type
*/
uchar_t inq_dtype;
/* byte 1 */
uchar_t inq_rmb : 1, /* removable media */
inq_qual : 7; /* device type qualifier */
/* byte 2 */
uchar_t inq_iso : 2, /* ISO version */
inq_ecma : 3, /* ECMA version */
inq_ansi : 3; /* ANSI version */
/* byte 3 */
uchar_t inq_aenc : 1, /* DEPRECATED: async event notify */
inq_trmiop : 1, /* DEPRECATED: terminate I/O proc */
inq_normaca : 1, /* setting NACA bit supported */
inq_hisup : 1, /* hierarchical addressing model */
inq_rdf : 4; /* response data format */
/* bytes 4-7 */
uchar_t inq_len; /* additional length */
uchar_t inq_sccs : 1, /* embedded storage array */
inq_acc : 1, /* access controls coordinator */
inq_tpgs : 2, /* impl/expl asymmetric lun access */
inq_3pc : 1, /* third-party copy */
inq_5_2 : 1,
inq_5_1 : 1,
inq_protect : 1; /* supports protection information */
uchar_t inq_bque : 1, /* DEPRECATED: combined with cmdque */
inq_encserv : 1, /* embedded enclosure services */
inq_port : 1, /* DEPRECATED: port rcv inquiry cmd */
inq_dualp : 1, /* multi port device */
inq_mchngr : 1, /* DEPRECATED: embeded medium changer */
inq_ackqreqq : 1, /* DEPRECATED: data xfer on Q cable */
inq_addr32 : 1, /* DEPRECATED: 32 bit wide address */
inq_addr16 : 1; /* SPI: 16-bit wide SCSI addr */
uchar_t inq_reladdr : 1, /* DEPRECATED: relative addressing */
inq_wbus32 : 1, /* DEPRECATED: 32 bit wide data xfers */
inq_wbus16 : 1, /* SPI: 16-bit wide data xfers */
inq_sync : 1, /* SPI: synchronous data xfers */
inq_linked : 1, /* DEPRECATED: linked commands */
inq_trandis : 1, /* DEPRECATED: transfer disable msgs */
inq_cmdque : 1, /* supports command queueing */
inq_sftre : 1; /* DEPRECATED: Soft Reset option */
/* bytes 8-35 */
char inq_vid[8]; /* vendor ID */
char inq_pid[16]; /* product ID */
char inq_revision[4]; /* revision level */
/*
* Bytes 36-47 are reserved:
* For Sun qualified hard disk drives the inq_serial field contains
* two bytes of mfg date year code (ascii)
* two bytes of mfg date week code (ascii)
* six bytes of mfg serial number (ascii)
* two bytes unused
*/
char inq_serial[12];
/*
* Bytes 48-55 are reserved.
*/
uchar_t __inq_48 : 8;
uchar_t __inq_49 : 8;
uchar_t __inq_50 : 8;
uchar_t __inq_51 : 8;
uchar_t __inq_52 : 8;
uchar_t __inq_53 : 8;
uchar_t __inq_54 : 8;
uchar_t __inq_55 : 8;
/*
* The meanings of byte 56 is specific to SPI-3. For protocols older
* or other than this these fields are reserved.
*/
uchar_t __inq_56_7 : 1, /* reserved */
__inq_56_6 : 1, /* reserved */
__inq_56_5 : 1, /* reserved */
__inq_56_4 : 1, /* reserved */
inq_clk : 2, /* SPI3: clocking */
inq_qas : 1, /* SPI3: quick arb sel */
inq_ius : 1; /* SPI3: information units */
uchar_t __inq_57 : 8; /* reserved */
/*
* byte pairs 58-73 are version descriptors
* See: Table 51: dpANS SCSI Primary Commands - 2 (SPC-2) T10/1236
*/
struct inq_vd {
uchar_t inq_vd_msb;
uchar_t inq_vd_lsb;
} inq_vd[8];
/*
* Bytes 74-95 are reserved.
* 96 to 'n' are vendor-specific parameter bytes.
*
* Pad structure to 132 bytes so that access to some vendor-specific
* data is possible via scsi_device(9S) sd_inq (for mpxio).
*/
uchar_t __inq_74_127[132 - 74];
};
#else
#error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
#endif /* _BIT_FIELDS_LTOH */
/*
* Defined Peripheral Device Types
*/
#define DTYPE_DIRECT 0x00 /* magnetic disk */
#define DTYPE_SEQUENTIAL 0x01 /* magnetic tape */
#define DTYPE_PRINTER 0x02
#define DTYPE_PROCESSOR 0x03
#define DTYPE_WORM 0x04 /* some optical disks */
#define DTYPE_RODIRECT 0x05
#define DTYPE_SCANNER 0x06 /* obsolete */
#define DTYPE_OPTICAL 0x07
#define DTYPE_CHANGER 0x08 /* jukeboxes */
#define DTYPE_COMM 0x09 /* obsolete */
#define DTYPE_ARRAY_CTRL 0x0C
#define DTYPE_ESI 0x0D /* Enclosure services device */
#define DTYPE_RBC 0x0E /* Simplified direct-access device */
#define DTYPE_OCRW 0x0F /* Optical card reader/writer device */
#define DTYPE_BCC 0x10
#define DTYPE_OSD 0x11 /* Object-based Storage Device */
#define DTYPE_ADC 0x12
/*
* Device types 0x13-0x1D are reserved in spc-3 (r23)
*/
#define DTYPE_WELLKNOWN 0x1E
#define DTYPE_UNKNOWN 0x1F
#define DTYPE_MASK 0x1F
/* ASCII mapping used by scsi_dname(9F) */
#define DTYPE_ASCII { \
"Direct Access", "Sequential Access", "Printer", "Processor", \
"Write-Once/Read-Many", "Read-Only Direct Access", "Scanner", \
"Optical", "Changer", "Communications", "Unknown-0A", \
"Unknown-0B", "Array Controller", "Enclosure-Services", \
"Simplified-Direct-Access", "Optical-Card", "Bridge", \
"Object-Storage", NULL}
/*
* The peripheral qualifier tells us more about a particular device.
* (DPQ == DEVICE PERIPHERAL QUALIFIER).
*/
#define DPQ_MASK 0x60 /* DPQ bits */
#define DPQ_POSSIBLE 0x00
/*
* The specified peripheral device type is
* currently connected to this logical unit.
* If the target cannot determine whether
* or not a physical device is currently
* connected, it shall also return this
* qualifier.
*/
#define DPQ_SUPPORTED 0x20
/*
* The target is capable of supporting the
* specified peripheral device type on this
* logical unit, however the physical device
* is not currently connected to this logical
* unit.
*/
#define DPQ_NEVER 0x60
/*
* The target is not capable of supporting a
* physical device on this logical unit. For
* this peripheral qualifier, the peripheral
* device type will be set to DTYPE_UNKNOWN
* in order to provide compatibility with
* previous versions of SCSI.
*/
#define DPQ_VUNIQ 0x80
/*
* If this bit is set, this is a vendor
* unique qualifier.
*/
/*
* To maintain compatibility with previous versions
* of inquiry data formats, if a device peripheral
* qualifier states that the target is not capable
* of supporting a physical device on this logical unit,
* then the qualifier DPQ_NEVER is set, *AND* the
* actual device type must be set to DTYPE_UNKNOWN.
*
* This may make for some problems with older drivers
* that blindly check the entire first byte, where they
* should be checking for only the least 5 bits to see
* whether the correct type is at the specified nexus.
*/
#define DTYPE_NOTPRESENT (DPQ_NEVER | DTYPE_UNKNOWN)
/*
* Defined Response Data Formats:
*/
#define RDF_LEVEL0 0x00 /* no conformance claim (SCSI-1) */
#define RDF_CCS 0x01 /* Obsolete (pseudo-spec) */
#define RDF_SCSI2 0x02 /* Obsolete (SCSI-2/3 spec) */
#define RDF_SCSI_SPC 0x03 /* ANSI INCITS 301-1997 (SPC) */
#define RDF_SCSI_SPC2 0x04 /* ANSI INCITS 351-2001 (SPC-2) */
#define RDF_SCSI_SPC3 0x05 /* ANSI INCITS 408-2005 (SPC-3) */
#define RDF_SCSI_SPC4 0x06 /* t10 (SPC-4) */
/*
* Defined Target Port Group Select values:
*/
#define TPGS_FAILOVER_NONE 0x0
#define TPGS_FAILOVER_IMPLICIT 0x1
#define TPGS_FAILOVER_EXPLICIT 0x2
#define TPGS_FAILOVER_BOTH 0x3
/*
* SPC-3 revision 21c, section 7.6.4.1
* Table 289 -- Device Identification VPD page
*/
struct vpd_hdr {
#if defined(_BIT_FIELDS_LTOH)
uchar_t device_type : 4,
periph_qual : 4;
#elif defined(_BIT_FIELDS_HTOL)
uchar_t periph_qual : 4,
device_type : 4;
#else
#error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
#endif
uchar_t page_code,
page_len[2];
};
/*
* SPC-3 revision 21c, section 7.6.4.1
* Table 290 -- Identification descriptor
*/
struct vpd_desc {
#if defined(_BIT_FIELDS_LTOH)
uchar_t code_set : 4,
proto_id : 4;
uchar_t id_type : 4,
association : 2,
: 1,
piv : 1;
#elif defined(_BIT_FIELDS_HTOL)
uchar_t proto_id : 4,
code_set : 4;
uchar_t piv : 1,
: 1,
association : 2,
id_type : 4;
#else
#error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
#endif
uchar_t resrv1;
uchar_t len;
/* ---- data follows ---- */
};
/*
* "pm-capable" integer property bit mask definitions
*/
#define PM_CAPABLE_PM_MASK 0x0000ffff /* use lower 16 bits to */
/* indicate PM mode */
#define PM_CAPABLE_CCS RDF_CCS
#define PM_CAPABLE_SCSI2 RDF_SCSI2
#define PM_CAPABLE_SPC RDF_SCSI_SPC
#define PM_CAPABLE_SPC2 RDF_SCSI_SPC2
#define PM_CAPABLE_SPC3 RDF_SCSI_SPC3
#define PM_CAPABLE_SPC4 RDF_SCSI_SPC4
#define PM_CAPABLE_LOG_MASK 0xffff0000 /* use upper 16 bit to */
/* indicate log specifics */
#define PM_CAPABLE_LOG_SUPPORTED 0x10000 /* Log page 0xE might be */
/* supported */
#define PM_CAPABLE_SMART_LOG 0x20000 /* Log page 0xE reports SMART */
/* attributes instead of the */
/* default SCSI Log pages */
#ifdef __cplusplus
}
#endif
/*
* Include in implementation specifuc
* (non-generic) inquiry definitions.
*/
#include <sys/scsi/impl/inquiry.h>
#endif /* _SYS_SCSI_GENERIC_INQUIRY_H */
|