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