ReactOS  0.4.15-dev-1200-gc3b3fcd
scsi.h
Go to the documentation of this file.
1 /*
2  * scsi.h
3  *
4  * SCSI port and class interface.
5  *
6  * This file is part of the w32api package.
7  *
8  * Contributors:
9  * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10  *
11  * THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  * This source code is offered for use in the public domain. You may
14  * use, modify or distribute it freely.
15  *
16  * This code is distributed in the hope that it will be useful but
17  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  * DISCLAIMED. This includes but is not limited to warranties of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  */
22 
23 #ifndef _NTSCSI_
24 #define _NTSCSI_
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #ifndef _NTSCSI_USER_MODE_
31 #include "srb.h"
32 #endif
33 
34 #define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_MASK 0x02
35 #define NOTIFICATION_POWER_MANAGEMENT_CLASS_MASK 0x04
36 #define NOTIFICATION_EXTERNAL_REQUEST_CLASS_MASK 0x08
37 #define NOTIFICATION_MEDIA_STATUS_CLASS_MASK 0x10
38 #define NOTIFICATION_MULTI_HOST_CLASS_MASK 0x20
39 #define NOTIFICATION_DEVICE_BUSY_CLASS_MASK 0x40
40 
41 
42 #define NOTIFICATION_NO_CLASS_EVENTS 0x0
43 #define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_EVENTS 0x1
44 #define NOTIFICATION_POWER_MANAGEMENT_CLASS_EVENTS 0x2
45 #define NOTIFICATION_EXTERNAL_REQUEST_CLASS_EVENTS 0x3
46 #define NOTIFICATION_MEDIA_STATUS_CLASS_EVENTS 0x4
47 #define NOTIFICATION_MULTI_HOST_CLASS_EVENTS 0x5
48 #define NOTIFICATION_DEVICE_BUSY_CLASS_EVENTS 0x6
49 
50 #define NOTIFICATION_OPERATIONAL_EVENT_NO_CHANGE 0x0
51 #define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_REQUESTED 0x1
52 #define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_OCCURRED 0x2
53 
54 #define NOTIFICATION_OPERATIONAL_STATUS_AVAILABLE 0x0
55 #define NOTIFICATION_OPERATIONAL_STATUS_TEMPORARY_BUSY 0x1
56 #define NOTIFICATION_OPERATIONAL_STATUS_EXTENDED_BUSY 0x2
57 
58 #define NOTIFICATION_OPERATIONAL_OPCODE_NONE 0x0
59 #define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_CHANGE 0x1
60 #define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_ADDED 0x2
61 #define NOTIFICATION_OPERATIONAL_OPCODE_UNIT_RESET 0x3
62 #define NOTIFICATION_OPERATIONAL_OPCODE_FIRMWARE_CHANGED 0x4
63 #define NOTIFICATION_OPERATIONAL_OPCODE_INQUIRY_CHANGED 0x5
64 
65 #define NOTIFICATION_POWER_EVENT_NO_CHANGE 0x0
66 #define NOTIFICATION_POWER_EVENT_CHANGE_SUCCEEDED 0x1
67 #define NOTIFICATION_POWER_EVENT_CHANGE_FAILED 0x2
68 
69 #define NOTIFICATION_POWER_STATUS_ACTIVE 0x1
70 #define NOTIFICATION_POWER_STATUS_IDLE 0x2
71 #define NOTIFICATION_POWER_STATUS_STANDBY 0x3
72 #define NOTIFICATION_POWER_STATUS_SLEEP 0x4
73 
74 #define NOTIFICATION_MEDIA_EVENT_NO_EVENT 0x0
75 #define NOTIFICATION_EXTERNAL_EVENT_NO_CHANGE 0x0
76 #define NOTIFICATION_EXTERNAL_EVENT_BUTTON_DOWN 0x1
77 #define NOTIFICATION_EXTERNAL_EVENT_BUTTON_UP 0x2
78 #define NOTIFICATION_EXTERNAL_EVENT_EXTERNAL 0x3
79 
80 #define NOTIFICATION_EXTERNAL_STATUS_READY 0x0
81 #define NOTIFICATION_EXTERNAL_STATUS_PREVENT 0x1
82 
83 #define NOTIFICATION_EXTERNAL_REQUEST_NONE 0x0000
84 #define NOTIFICATION_EXTERNAL_REQUEST_QUEUE_OVERRUN 0x0001
85 #define NOTIFICATION_EXTERNAL_REQUEST_PLAY 0x0101
86 #define NOTIFICATION_EXTERNAL_REQUEST_REWIND_BACK 0x0102
87 #define NOTIFICATION_EXTERNAL_REQUEST_FAST_FORWARD 0x0103
88 #define NOTIFICATION_EXTERNAL_REQUEST_PAUSE 0x0104
89 #define NOTIFICATION_EXTERNAL_REQUEST_STOP 0x0106
90 #define NOTIFICATION_EXTERNAL_REQUEST_ASCII_LOW 0x0200
91 #define NOTIFICATION_EXTERNAL_REQUEST_ASCII_HIGH 0x02ff
92 
93 #define NOTIFICATION_MEDIA_EVENT_NO_CHANGE 0x0
94 #define NOTIFICATION_MEDIA_EVENT_EJECT_REQUEST 0x1
95 #define NOTIFICATION_MEDIA_EVENT_NEW_MEDIA 0x2
96 #define NOTIFICATION_MEDIA_EVENT_MEDIA_REMOVAL 0x3
97 #define NOTIFICATION_MEDIA_EVENT_MEDIA_CHANGE 0x4
98 
99 #define NOTIFICATION_BUSY_EVENT_NO_EVENT 0x0
100 #define NOTIFICATION_MULTI_HOST_EVENT_NO_CHANGE 0x0
101 #define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_REQUEST 0x1
102 #define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_GRANT 0x2
103 #define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_RELEASE 0x3
104 
105 #define NOTIFICATION_MULTI_HOST_STATUS_READY 0x0
106 #define NOTIFICATION_MULTI_HOST_STATUS_PREVENT 0x1
107 
108 #define NOTIFICATION_MULTI_HOST_PRIORITY_NO_REQUESTS 0x0
109 #define NOTIFICATION_MULTI_HOST_PRIORITY_LOW 0x1
110 #define NOTIFICATION_MULTI_HOST_PRIORITY_MEDIUM 0x2
111 #define NOTIFICATION_MULTI_HOST_PRIORITY_HIGH 0x3
112 
113 #define NOTIFICATION_BUSY_EVENT_NO_EVENT 0x0
114 #define NOTIFICATION_BUSY_EVENT_NO_CHANGE 0x0
115 #define NOTIFICATION_BUSY_EVENT_BUSY 0x1
116 #define NOTIFICATION_BUSY_EVENT_LO_CHANGE 0x2
117 
118 #define NOTIFICATION_BUSY_STATUS_NO_EVENT 0x0
119 #define NOTIFICATION_BUSY_STATUS_POWER 0x1
120 #define NOTIFICATION_BUSY_STATUS_IMMEDIATE 0x2
121 #define NOTIFICATION_BUSY_STATUS_DEFERRED 0x3
122 
123 #define DVD_FORMAT_LEAD_IN 0x00
124 #define DVD_FORMAT_COPYRIGHT 0x01
125 #define DVD_FORMAT_DISK_KEY 0x02
126 #define DVD_FORMAT_BCA 0x03
127 #define DVD_FORMAT_MANUFACTURING 0x04
128 
129 #define DVD_REPORT_AGID 0x00
130 #define DVD_CHALLENGE_KEY 0x01
131 #define DVD_KEY_1 0x02
132 #define DVD_KEY_2 0x03
133 #define DVD_TITLE_KEY 0x04
134 #define DVD_REPORT_ASF 0x05
135 #define DVD_INVALIDATE_AGID 0x3F
136 
137 #define BLANK_FULL 0x0
138 #define BLANK_MINIMAL 0x1
139 #define BLANK_TRACK 0x2
140 #define BLANK_UNRESERVE_TRACK 0x3
141 #define BLANK_TAIL 0x4
142 #define BLANK_UNCLOSE_SESSION 0x5
143 #define BLANK_SESSION 0x6
144 
145 #define CD_EXPECTED_SECTOR_ANY 0x0
146 #define CD_EXPECTED_SECTOR_CDDA 0x1
147 #define CD_EXPECTED_SECTOR_MODE1 0x2
148 #define CD_EXPECTED_SECTOR_MODE2 0x3
149 #define CD_EXPECTED_SECTOR_MODE2_FORM1 0x4
150 #define CD_EXPECTED_SECTOR_MODE2_FORM2 0x5
151 
152 #define DISK_STATUS_EMPTY 0x00
153 #define DISK_STATUS_INCOMPLETE 0x01
154 #define DISK_STATUS_COMPLETE 0x02
155 #define DISK_STATUS_OTHERS 0x03
156 
157 #define LAST_SESSION_EMPTY 0x00
158 #define LAST_SESSION_INCOMPLETE 0x01
159 #define LAST_SESSION_RESERVED_DAMAGED 0x02
160 #define LAST_SESSION_COMPLETE 0x03
161 
162 #define DISK_TYPE_CDDA 0x00
163 #define DISK_TYPE_CDI 0x10
164 #define DISK_TYPE_XA 0x20
165 #define DISK_TYPE_UNDEFINED 0xFF
166 
167 #define DISC_BGFORMAT_STATE_NONE 0x0
168 #define DISC_BGFORMAT_STATE_INCOMPLETE 0x1
169 #define DISC_BGFORMAT_STATE_RUNNING 0x2
170 #define DISC_BGFORMAT_STATE_COMPLETE 0x3
171 
172 #define DATA_BLOCK_MODE0 0x0
173 #define DATA_BLOCK_MODE1 0x1
174 #define DATA_BLOCK_MODE2 0x2
175 
176 /* READ_TOC formats */
177 #define READ_TOC_FORMAT_TOC 0x00
178 #define READ_TOC_FORMAT_SESSION 0x01
179 #define READ_TOC_FORMAT_FULL_TOC 0x02
180 #define READ_TOC_FORMAT_PMA 0x03
181 #define READ_TOC_FORMAT_ATIP 0x04
182 
183 #define CDB6GENERIC_LENGTH 6
184 #define CDB10GENERIC_LENGTH 10
185 #define CDB12GENERIC_LENGTH 12
186 
187 #define SETBITON 1
188 #define SETBITOFF 0
189 
190 /* Mode Sense/Select page constants */
191 #define MODE_PAGE_VENDOR_SPECIFIC 0x00
192 #define MODE_PAGE_ERROR_RECOVERY 0x01
193 #define MODE_PAGE_DISCONNECT 0x02
194 #define MODE_PAGE_FORMAT_DEVICE 0x03
195 #define MODE_PAGE_MRW 0x03
196 #define MODE_PAGE_RIGID_GEOMETRY 0x04
197 #define MODE_PAGE_FLEXIBILE 0x05
198 #define MODE_PAGE_WRITE_PARAMETERS 0x05
199 #define MODE_PAGE_VERIFY_ERROR 0x07
200 #define MODE_PAGE_CACHING 0x08
201 #define MODE_PAGE_PERIPHERAL 0x09
202 #define MODE_PAGE_CONTROL 0x0A
203 #define MODE_PAGE_MEDIUM_TYPES 0x0B
204 #define MODE_PAGE_NOTCH_PARTITION 0x0C
205 #define MODE_PAGE_CD_AUDIO_CONTROL 0x0E
206 #define MODE_PAGE_DATA_COMPRESS 0x0F
207 #define MODE_PAGE_DEVICE_CONFIG 0x10
208 #define MODE_PAGE_XOR_CONTROL 0x10
209 #define MODE_PAGE_MEDIUM_PARTITION 0x11
210 #define MODE_PAGE_ENCLOSURE_SERVICES_MANAGEMENT 0x14
211 #define MODE_PAGE_EXTENDED 0x15
212 #define MODE_PAGE_EXTENDED_DEVICE_SPECIFIC 0x16
213 #define MODE_PAGE_CDVD_FEATURE_SET 0x18
214 #define MODE_PAGE_PROTOCOL_SPECIFIC_LUN 0x18
215 #define MODE_PAGE_PROTOCOL_SPECIFIC_PORT 0x19
216 #define MODE_PAGE_POWER_CONDITION 0x1A
217 #define MODE_PAGE_LUN_MAPPING 0x1B
218 #define MODE_PAGE_FAULT_REPORTING 0x1C
219 #define MODE_PAGE_CDVD_INACTIVITY 0x1D
220 #define MODE_PAGE_ELEMENT_ADDRESS 0x1D
221 #define MODE_PAGE_TRANSPORT_GEOMETRY 0x1E
222 #define MODE_PAGE_DEVICE_CAPABILITIES 0x1F
223 #define MODE_PAGE_CAPABILITIES 0x2A
224 
225 #define MODE_SENSE_RETURN_ALL 0x3f
226 
227 #define MODE_SENSE_CURRENT_VALUES 0x00
228 #define MODE_SENSE_CHANGEABLE_VALUES 0x40
229 #define MODE_SENSE_DEFAULT_VAULES 0x80
230 #define MODE_SENSE_SAVED_VALUES 0xc0
231 
232 /* SCSI CDB operation codes */
233 #define SCSIOP_TEST_UNIT_READY 0x00
234 #define SCSIOP_REZERO_UNIT 0x01
235 #define SCSIOP_REWIND 0x01
236 #define SCSIOP_REQUEST_BLOCK_ADDR 0x02
237 #define SCSIOP_REQUEST_SENSE 0x03
238 #define SCSIOP_FORMAT_UNIT 0x04
239 #define SCSIOP_READ_BLOCK_LIMITS 0x05
240 #define SCSIOP_REASSIGN_BLOCKS 0x07
241 #define SCSIOP_INIT_ELEMENT_STATUS 0x07
242 #define SCSIOP_READ6 0x08
243 #define SCSIOP_RECEIVE 0x08
244 #define SCSIOP_WRITE6 0x0A
245 #define SCSIOP_PRINT 0x0A
246 #define SCSIOP_SEND 0x0A
247 #define SCSIOP_SEEK6 0x0B
248 #define SCSIOP_TRACK_SELECT 0x0B
249 #define SCSIOP_SLEW_PRINT 0x0B
250 #define SCSIOP_SET_CAPACITY 0x0B
251 #define SCSIOP_SEEK_BLOCK 0x0C
252 #define SCSIOP_PARTITION 0x0D
253 #define SCSIOP_READ_REVERSE 0x0F
254 #define SCSIOP_WRITE_FILEMARKS 0x10
255 #define SCSIOP_FLUSH_BUFFER 0x10
256 #define SCSIOP_SPACE 0x11
257 #define SCSIOP_INQUIRY 0x12
258 #define SCSIOP_VERIFY6 0x13
259 #define SCSIOP_RECOVER_BUF_DATA 0x14
260 #define SCSIOP_MODE_SELECT 0x15
261 #define SCSIOP_RESERVE_UNIT 0x16
262 #define SCSIOP_RELEASE_UNIT 0x17
263 #define SCSIOP_COPY 0x18
264 #define SCSIOP_ERASE 0x19
265 #define SCSIOP_MODE_SENSE 0x1A
266 #define SCSIOP_START_STOP_UNIT 0x1B
267 #define SCSIOP_STOP_PRINT 0x1B
268 #define SCSIOP_LOAD_UNLOAD 0x1B
269 #define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C
270 #define SCSIOP_SEND_DIAGNOSTIC 0x1D
271 #define SCSIOP_MEDIUM_REMOVAL 0x1E
272 
273 #define SCSIOP_READ_FORMATTED_CAPACITY 0x23
274 #define SCSIOP_READ_CAPACITY 0x25
275 #define SCSIOP_READ 0x28
276 #define SCSIOP_WRITE 0x2A
277 #define SCSIOP_SEEK 0x2B
278 #define SCSIOP_LOCATE 0x2B
279 #define SCSIOP_POSITION_TO_ELEMENT 0x2B
280 #define SCSIOP_WRITE_VERIFY 0x2E
281 #define SCSIOP_VERIFY 0x2F
282 #define SCSIOP_SEARCH_DATA_HIGH 0x30
283 #define SCSIOP_SEARCH_DATA_EQUAL 0x31
284 #define SCSIOP_SEARCH_DATA_LOW 0x32
285 #define SCSIOP_SET_LIMITS 0x33
286 #define SCSIOP_READ_POSITION 0x34
287 #define SCSIOP_SYNCHRONIZE_CACHE 0x35
288 #define SCSIOP_COMPARE 0x39
289 #define SCSIOP_COPY_COMPARE 0x3A
290 #define SCSIOP_WRITE_DATA_BUFF 0x3B
291 #define SCSIOP_READ_DATA_BUFF 0x3C
292 #define SCSIOP_WRITE_LONG 0x3F
293 #define SCSIOP_CHANGE_DEFINITION 0x40
294 #define SCSIOP_WRITE_SAME 0x41
295 #define SCSIOP_READ_SUB_CHANNEL 0x42
296 #define SCSIOP_UNMAP 0x42
297 #define SCSIOP_READ_TOC 0x43
298 #define SCSIOP_READ_HEADER 0x44
299 #define SCSIOP_REPORT_DENSITY_SUPPORT 0x44
300 #define SCSIOP_PLAY_AUDIO 0x45
301 #define SCSIOP_GET_CONFIGURATION 0x46
302 #define SCSIOP_PLAY_AUDIO_MSF 0x47
303 #define SCSIOP_PLAY_TRACK_INDEX 0x48
304 #define SCSIOP_SANITIZE 0x48
305 #define SCSIOP_PLAY_TRACK_RELATIVE 0x49
306 #define SCSIOP_GET_EVENT_STATUS 0x4A
307 #define SCSIOP_PAUSE_RESUME 0x4B
308 #define SCSIOP_LOG_SELECT 0x4C
309 #define SCSIOP_LOG_SENSE 0x4D
310 #define SCSIOP_STOP_PLAY_SCAN 0x4E
311 #define SCSIOP_XDWRITE 0x50
312 #define SCSIOP_XPWRITE 0x51
313 #define SCSIOP_READ_DISK_INFORMATION 0x51
314 #define SCSIOP_READ_DISC_INFORMATION 0x51
315 #define SCSIOP_READ_TRACK_INFORMATION 0x52
316 #define SCSIOP_XDWRITE_READ 0x53
317 #define SCSIOP_RESERVE_TRACK_RZONE 0x53
318 #define SCSIOP_SEND_OPC_INFORMATION 0x54
319 #define SCSIOP_MODE_SELECT10 0x55
320 #define SCSIOP_RESERVE_UNIT10 0x56
321 #define SCSIOP_RESERVE_ELEMENT 0x56
322 #define SCSIOP_RELEASE_UNIT10 0x57
323 #define SCSIOP_RELEASE_ELEMENT 0x57
324 #define SCSIOP_REPAIR_TRACK 0x58
325 #define SCSIOP_MODE_SENSE10 0x5A
326 #define SCSIOP_CLOSE_TRACK_SESSION 0x5B
327 #define SCSIOP_READ_BUFFER_CAPACITY 0x5C
328 #define SCSIOP_SEND_CUE_SHEET 0x5D
329 #define SCSIOP_PERSISTENT_RESERVE_IN 0x5E
330 #define SCSIOP_PERSISTENT_RESERVE_OUT 0x5F
331 
332 #define SCSIOP_OPERATION32 0x7F
333 
334 #define SCSIOP_XDWRITE_EXTENDED16 0x80
335 #define SCSIOP_WRITE_FILEMARKS16 0x80
336 #define SCSIOP_REBUILD16 0x81
337 #define SCSIOP_READ_REVERSE16 0x81
338 #define SCSIOP_REGENERATE16 0x82
339 #define SCSIOP_EXTENDED_COPY 0x83
340 #define SCSIOP_POPULATE_TOKEN 0x83
341 #define SCSIOP_WRITE_USING_TOKEN 0x83
342 #define SCSIOP_RECEIVE_COPY_RESULTS 0x84
343 #define SCSIOP_RECEIVE_ROD_TOKEN_INFORMATION 0x84
344 #define SCSIOP_ATA_PASSTHROUGH16 0x85
345 #define SCSIOP_ACCESS_CONTROL_IN 0x86
346 #define SCSIOP_ACCESS_CONTROL_OUT 0x87
347 #define SCSIOP_READ16 0x88
348 #define SCSIOP_COMPARE_AND_WRITE 0x89
349 #define SCSIOP_WRITE16 0x8A
350 #define SCSIOP_READ_ATTRIBUTES 0x8C
351 #define SCSIOP_WRITE_ATTRIBUTES 0x8D
352 #define SCSIOP_WRITE_VERIFY16 0x8E
353 #define SCSIOP_VERIFY16 0x8F
354 #define SCSIOP_PREFETCH16 0x90
355 #define SCSIOP_SYNCHRONIZE_CACHE16 0x91
356 #define SCSIOP_SPACE16 0x91
357 #define SCSIOP_LOCK_UNLOCK_CACHE16 0x92
358 #define SCSIOP_LOCATE16 0x92
359 #define SCSIOP_WRITE_SAME16 0x93
360 #define SCSIOP_ERASE16 0x93
361 #define SCSIOP_ZBC_OUT 0x94
362 #define SCSIOP_ZBC_IN 0x95
363 #define SCSIOP_READ_DATA_BUFF16 0x9B
364 #define SCSIOP_READ_CAPACITY16 0x9E
365 #define SCSIOP_GET_LBA_STATUS 0x9E
366 #define SCSIOP_GET_PHYSICAL_ELEMENT_STATUS 0x9E
367 #define SCSIOP_REMOVE_ELEMENT_AND_TRUNCATE 0x9E
368 #define SCSIOP_SERVICE_ACTION_IN16 0x9E
369 #define SCSIOP_SERVICE_ACTION_OUT16 0x9F
370 
371 #define SCSIOP_REPORT_LUNS 0xA0
372 #define SCSIOP_BLANK 0xA1
373 #define SCSIOP_ATA_PASSTHROUGH12 0xA1
374 #define SCSIOP_SEND_EVENT 0xA2
375 #define SCSIOP_SECURITY_PROTOCOL_IN 0xA2
376 #define SCSIOP_SEND_KEY 0xA3
377 #define SCSIOP_MAINTENANCE_IN 0xA3
378 #define SCSIOP_REPORT_KEY 0xA4
379 #define SCSIOP_MAINTENANCE_OUT 0xA4
380 #define SCSIOP_MOVE_MEDIUM 0xA5
381 #define SCSIOP_LOAD_UNLOAD_SLOT 0xA6
382 #define SCSIOP_EXCHANGE_MEDIUM 0xA6
383 #define SCSIOP_SET_READ_AHEAD 0xA7
384 #define SCSIOP_MOVE_MEDIUM_ATTACHED 0xA7
385 #define SCSIOP_READ12 0xA8
386 #define SCSIOP_GET_MESSAGE 0xA8
387 #define SCSIOP_SERVICE_ACTION_OUT12 0xA9
388 #define SCSIOP_WRITE12 0xAA
389 #define SCSIOP_SEND_MESSAGE 0xAB
390 #define SCSIOP_SERVICE_ACTION_IN12 0xAB
391 #define SCSIOP_GET_PERFORMANCE 0xAC
392 #define SCSIOP_READ_DVD_STRUCTURE 0xAD
393 #define SCSIOP_WRITE_VERIFY12 0xAE
394 #define SCSIOP_VERIFY12 0xAF
395 #define SCSIOP_SEARCH_DATA_HIGH12 0xB0
396 #define SCSIOP_SEARCH_DATA_EQUAL12 0xB1
397 #define SCSIOP_SEARCH_DATA_LOW12 0xB2
398 #define SCSIOP_SET_LIMITS12 0xB3
399 #define SCSIOP_READ_ELEMENT_STATUS_ATTACHED 0xB4
400 #define SCSIOP_REQUEST_VOL_ELEMENT 0xB5
401 #define SCSIOP_SECURITY_PROTOCOL_OUT 0xB5
402 #define SCSIOP_SEND_VOLUME_TAG 0xB6
403 #define SCSIOP_SET_STREAMING 0xB6
404 #define SCSIOP_READ_DEFECT_DATA 0xB7
405 #define SCSIOP_READ_ELEMENT_STATUS 0xB8
406 #define SCSIOP_READ_CD_MSF 0xB9
407 #define SCSIOP_SCAN_CD 0xBA
408 #define SCSIOP_REDUNDANCY_GROUP_IN 0xBA
409 #define SCSIOP_SET_CD_SPEED 0xBB
410 #define SCSIOP_REDUNDANCY_GROUP_OUT 0xBB
411 #define SCSIOP_PLAY_CD 0xBC
412 #define SCSIOP_SPARE_IN 0xBC
413 #define SCSIOP_MECHANISM_STATUS 0xBD
414 #define SCSIOP_SPARE_OUT 0xBD
415 #define SCSIOP_READ_CD 0xBE
416 #define SCSIOP_VOLUME_SET_IN 0xBE
417 #define SCSIOP_SEND_DVD_STRUCTURE 0xBF
418 #define SCSIOP_VOLUME_SET_OUT 0xBF
419 #define SCSIOP_INIT_ELEMENT_RANGE 0xE7
420 
421 // SCSI operation parameters
422 
423 // SCSIOP_SANITIZE (0x48)
424 
425 #define SERVICE_ACTION_OVERWRITE 0x01
426 #define SERVICE_ACTION_BLOCK_ERASE 0x02
427 #define SERVICE_ACTION_CRYPTO_ERASE 0x03
428 #define SERVICE_ACTION_EXIT_FAILURE 0x1f
429 
430 // SCSIOP_OPERATION32 (0x7F)
431 
432 #define SERVICE_ACTION_XDWRITE 0x0004
433 #define SERVICE_ACTION_XPWRITE 0x0006
434 #define SERVICE_ACTION_XDWRITEREAD 0x0007
435 #define SERVICE_ACTION_WRITE 0x000B
436 #define SERVICE_ACTION_WRITE_VERIFY 0x000C
437 #define SERVICE_ACTION_WRITE_SAME 0x000D
438 #define SERVICE_ACTION_ORWRITE 0x000E
439 
440 // SCSIOP_POPULATE_TOKEN, SCSIOP_WRITE_USING_TOKEN (0x83)
441 
442 #define SERVICE_ACTION_POPULATE_TOKEN 0x10
443 #define SERVICE_ACTION_WRITE_USING_TOKEN 0x11
444 
445 // SCSIOP_RECEIVE_ROD_TOKEN_INFORMATION (0x84)
446 
447 #define SERVICE_ACTION_RECEIVE_TOKEN_INFORMATION 0x07
448 
449 // SCSIOP_ZBC_OUT (0x94)
450 
451 #define SERVICE_ACTION_CLOSE_ZONE 0x01
452 #define SERVICE_ACTION_FINISH_ZONE 0x02
453 #define SERVICE_ACTION_OPEN_ZONE 0x03
454 #define SERVICE_ACTION_RESET_WRITE_POINTER 0x04
455 
456 // SCSIOP_ZBC_IN (0x95)
457 
458 #define SERVICE_ACTION_REPORT_ZONES 0x00
459 
460 #define REPORT_ZONES_OPTION_LIST_ALL_ZONES 0x00
461 #define REPORT_ZONES_OPTION_LIST_EMPTY_ZONES 0x01
462 #define REPORT_ZONES_OPTION_LIST_IMPLICITLY_OPENED_ZONES 0x02
463 #define REPORT_ZONES_OPTION_LIST_EXPLICITLY_OPENED_ZONES 0x03
464 #define REPORT_ZONES_OPTION_LIST_CLOSED_ZONES 0x04
465 #define REPORT_ZONES_OPTION_LIST_FULL_ZONES 0x05
466 #define REPORT_ZONES_OPTION_LIST_READ_ONLY_ZONES 0x06
467 #define REPORT_ZONES_OPTION_LIST_OFFLINE_ZONES 0x07
468 #define REPORT_ZONES_OPTION_LIST_RWP_ZONES 0x10
469 #define REPORT_ZONES_OPTION_LIST_NON_SEQUENTIAL_WRITE_RESOURCES_ACTIVE_ZONES 0x11
470 #define REPORT_ZONES_OPTION_LIST_NOT_WRITE_POINTER_ZONES 0x3F
471 
472 // SCSIOP_SERVICE_ACTION_IN16 (0x9E)
473 
474 #define SERVICE_ACTION_READ_CAPACITY16 0x10
475 #define SERVICE_ACTION_GET_LBA_STATUS 0x12
476 #define SERVICE_ACTION_GET_PHYSICAL_ELEMENT_STATUS 0x17
477 #define SERVICE_ACTION_REMOVE_ELEMENT_AND_TRUNCATE 0x18
478 
479 // SCSIOP_MAINTENANCE_IN (0xA3)
480 
481 #define SERVICE_ACTION_REPORT_TIMESTAMP 0x0F
482 
483 // SCSIOP_MAINTENANCE_OUT (0xA4)
484 
485 #define SERVICE_ACTION_SET_TIMESTAMP 0x0F
486 
487 #define CDB_RETURN_ON_COMPLETION 0
488 #define CDB_RETURN_IMMEDIATE 1
489 
490 #define CDB_FORCE_MEDIA_ACCESS 0x08
491 
492 #define SCSIOP_DENON_EJECT_DISC 0xE6
493 #define SCSIOP_DENON_STOP_AUDIO 0xE7
494 #define SCSIOP_DENON_PLAY_AUDIO 0xE8
495 #define SCSIOP_DENON_READ_TOC 0xE9
496 #define SCSIOP_DENON_READ_SUBCODE 0xEB
497 
498 #define SCSIMESS_ABORT 0x06
499 #define SCSIMESS_ABORT_WITH_TAG 0x0D
500 #define SCSIMESS_BUS_DEVICE_RESET 0X0C
501 #define SCSIMESS_CLEAR_QUEUE 0X0E
502 #define SCSIMESS_COMMAND_COMPLETE 0X00
503 #define SCSIMESS_DISCONNECT 0X04
504 #define SCSIMESS_EXTENDED_MESSAGE 0X01
505 #define SCSIMESS_IDENTIFY 0X80
506 #define SCSIMESS_IDENTIFY_WITH_DISCON 0XC0
507 #define SCSIMESS_IGNORE_WIDE_RESIDUE 0X23
508 #define SCSIMESS_INITIATE_RECOVERY 0X0F
509 #define SCSIMESS_INIT_DETECTED_ERROR 0X05
510 #define SCSIMESS_LINK_CMD_COMP 0X0A
511 #define SCSIMESS_LINK_CMD_COMP_W_FLAG 0X0B
512 #define SCSIMESS_MESS_PARITY_ERROR 0X09
513 #define SCSIMESS_MESSAGE_REJECT 0X07
514 #define SCSIMESS_NO_OPERATION 0X08
515 #define SCSIMESS_HEAD_OF_QUEUE_TAG 0X21
516 #define SCSIMESS_ORDERED_QUEUE_TAG 0X22
517 #define SCSIMESS_SIMPLE_QUEUE_TAG 0X20
518 #define SCSIMESS_RELEASE_RECOVERY 0X10
519 #define SCSIMESS_RESTORE_POINTERS 0X03
520 #define SCSIMESS_SAVE_DATA_POINTER 0X02
521 #define SCSIMESS_TERMINATE_IO_PROCESS 0X11
522 
523 #define SCSIMESS_MODIFY_DATA_POINTER 0X00
524 #define SCSIMESS_SYNCHRONOUS_DATA_REQ 0X01
525 #define SCSIMESS_WIDE_DATA_REQUEST 0X03
526 
527 #define SCSIMESS_MODIFY_DATA_LENGTH 5
528 #define SCSIMESS_SYNCH_DATA_LENGTH 3
529 #define SCSIMESS_WIDE_DATA_LENGTH 2
530 
531 #define CDB_INQUIRY_EVPD 0x01
532 
533 #define LUN0_FORMAT_SAVING_DEFECT_LIST 0
534 #define USE_DEFAULTMSB 0
535 #define USE_DEFAULTLSB 0
536 
537 #define START_UNIT_CODE 0x01
538 #define STOP_UNIT_CODE 0x00
539 
540 /* INQUIRYDATA.DeviceType constants */
541 #define DIRECT_ACCESS_DEVICE 0x00
542 #define SEQUENTIAL_ACCESS_DEVICE 0x01
543 #define PRINTER_DEVICE 0x02
544 #define PROCESSOR_DEVICE 0x03
545 #define WRITE_ONCE_READ_MULTIPLE_DEVICE 0x04
546 #define READ_ONLY_DIRECT_ACCESS_DEVICE 0x05
547 #define SCANNER_DEVICE 0x06
548 #define OPTICAL_DEVICE 0x07
549 #define MEDIUM_CHANGER 0x08
550 #define COMMUNICATION_DEVICE 0x09
551 #define ARRAY_CONTROLLER_DEVICE 0x0C
552 #define SCSI_ENCLOSURE_DEVICE 0x0D
553 #define REDUCED_BLOCK_DEVICE 0x0E
554 #define OPTICAL_CARD_READER_WRITER_DEVICE 0x0F
555 #define BRIDGE_CONTROLLER_DEVICE 0x10
556 #define OBJECT_BASED_STORAGE_DEVICE 0x11
557 #define LOGICAL_UNIT_NOT_PRESENT_DEVICE 0x7F
558 
559 #define DEVICE_QUALIFIER_ACTIVE 0x00
560 #define DEVICE_QUALIFIER_NOT_ACTIVE 0x01
561 #define DEVICE_QUALIFIER_NOT_SUPPORTED 0x03
562 
563 /* INQUIRYDATA.DeviceTypeQualifier constants */
564 #define DEVICE_CONNECTED 0x00
565 
566 #define SCSISTAT_GOOD 0x00
567 #define SCSISTAT_CHECK_CONDITION 0x02
568 #define SCSISTAT_CONDITION_MET 0x04
569 #define SCSISTAT_BUSY 0x08
570 #define SCSISTAT_INTERMEDIATE 0x10
571 #define SCSISTAT_INTERMEDIATE_COND_MET 0x14
572 #define SCSISTAT_RESERVATION_CONFLICT 0x18
573 #define SCSISTAT_COMMAND_TERMINATED 0x22
574 #define SCSISTAT_QUEUE_FULL 0x28
575 
576 #define RESERVATION_ACTION_READ_KEYS 0x00
577 #define RESERVATION_ACTION_READ_RESERVATIONS 0x01
578 
579 #define RESERVATION_ACTION_REGISTER 0x00
580 #define RESERVATION_ACTION_RESERVE 0x01
581 #define RESERVATION_ACTION_RELEASE 0x02
582 #define RESERVATION_ACTION_CLEAR 0x03
583 #define RESERVATION_ACTION_PREEMPT 0x04
584 #define RESERVATION_ACTION_PREEMPT_ABORT 0x05
585 #define RESERVATION_ACTION_REGISTER_IGNORE_EXISTING 0x06
586 
587 #define RESERVATION_SCOPE_LU 0x00
588 #define RESERVATION_SCOPE_ELEMENT 0x02
589 
590 #define RESERVATION_TYPE_WRITE_EXCLUSIVE 0x01
591 #define RESERVATION_TYPE_EXCLUSIVE 0x03
592 #define RESERVATION_TYPE_WRITE_EXCLUSIVE_REGISTRANTS 0x05
593 #define RESERVATION_TYPE_EXCLUSIVE_REGISTRANTS 0x06
594 
595 #define SENSE_BUFFER_SIZE sizeof(SENSE_DATA)
596 #define SENSE_BUFFER_SIZE_EX sizeof(SENSE_DATA_EX)
597 
598 #define MAX_SENSE_BUFFER_SIZE 255
599 
600 #define MAX_ADDITIONAL_SENSE_BYTES (MAX_SENSE_BUFFER_SIZE - SENSE_BUFFER_SIZE)
601 #define MAX_ADDITIONAL_SENSE_BYTES_EX (MAX_SENSE_BUFFER_SIZE - SENSE_BUFFER_SIZE_EX)
602 
603 /* Sense codes */
604 #define SCSI_SENSE_NO_SENSE 0x00
605 #define SCSI_SENSE_RECOVERED_ERROR 0x01
606 #define SCSI_SENSE_NOT_READY 0x02
607 #define SCSI_SENSE_MEDIUM_ERROR 0x03
608 #define SCSI_SENSE_HARDWARE_ERROR 0x04
609 #define SCSI_SENSE_ILLEGAL_REQUEST 0x05
610 #define SCSI_SENSE_UNIT_ATTENTION 0x06
611 #define SCSI_SENSE_DATA_PROTECT 0x07
612 #define SCSI_SENSE_BLANK_CHECK 0x08
613 #define SCSI_SENSE_UNIQUE 0x09
614 #define SCSI_SENSE_COPY_ABORTED 0x0A
615 #define SCSI_SENSE_ABORTED_COMMAND 0x0B
616 #define SCSI_SENSE_EQUAL 0x0C
617 #define SCSI_SENSE_VOL_OVERFLOW 0x0D
618 #define SCSI_SENSE_MISCOMPARE 0x0E
619 #define SCSI_SENSE_RESERVED 0x0F
620 
621 // Sense Error Codes
622 
623 #define SCSI_SENSE_ERRORCODE_FIXED_CURRENT 0x70
624 #define SCSI_SENSE_ERRORCODE_FIXED_DEFERRED 0x71
625 #define SCSI_SENSE_ERRORCODE_DESCRIPTOR_CURRENT 0x72
626 #define SCSI_SENSE_ERRORCODE_DESCRIPTOR_DEFERRED 0x73
627 
628 // Sense Descriptor Types
629 
630 #define SCSI_SENSE_DESCRIPTOR_TYPE_INFORMATION 0x00
631 #define SCSI_SENSE_DESCRIPTOR_TYPE_COMMAND_SPECIFIC 0x01
632 #define SCSI_SENSE_DESCRIPTOR_TYPE_SENSE_KEY_SPECIFIC 0x02
633 #define SCSI_SENSE_DESCRIPTOR_TYPE_FIELD_REPLACEABLE_UNIT 0x03
634 #define SCSI_SENSE_DESCRIPTOR_TYPE_STREAM_COMMAND 0x04
635 #define SCSI_SENSE_DESCRIPTOR_TYPE_BLOCK_COMMAND 0x05
636 #define SCSI_SENSE_DESCRIPTOR_TYPE_OSD_OBJECT_IDENTIFICATION 0x06
637 #define SCSI_SENSE_DESCRIPTOR_TYPE_OSD_RESPONSE_INTEGRITY_CHECK 0x07
638 #define SCSI_SENSE_DESCRIPTOR_TYPE_OSD_ATTRIBUTE_IDENTIFICATION 0x08
639 #define SCSI_SENSE_DESCRIPTOR_TYPE_ATA_STATUS_RETURN 0x09
640 #define SCSI_SENSE_DESCRIPTOR_TYPE_PROGRESS_INDICATION 0x0A
641 #define SCSI_SENSE_DESCRIPTOR_TYPE_USER_DATA_SEGMENT_REFERRAL 0x0B
642 
643 /* Additional tape bit */
644 #define SCSI_ILLEGAL_LENGTH 0x20
645 #define SCSI_EOM 0x40
646 #define SCSI_FILE_MARK 0x80
647 
648 /* Additional Sense codes */
649 #define SCSI_ADSENSE_NO_SENSE 0x00
650 #define SCSI_ADSENSE_NO_SEEK_COMPLETE 0x02
651 #define SCSI_ADSENSE_WRITE 0x03
652 #define SCSI_ADSENSE_LUN_NOT_READY 0x04
653 #define SCSI_ADSENSE_LUN_COMMUNICATION 0x08
654 #define SCSI_ADSENSE_SERVO_ERROR 0x09
655 #define SCSI_ADSENSE_WARNING 0x0B
656 #define SCSI_ADSENSE_WRITE_ERROR 0x0C
657 #define SCSI_ADSENSE_COPY_TARGET_DEVICE_ERROR 0x0D
658 #define SCSI_ADSENSE_UNRECOVERED_ERROR 0x11
659 #define SCSI_ADSENSE_TRACK_ERROR 0x14
660 #define SCSI_ADSENSE_SEEK_ERROR 0x15
661 #define SCSI_ADSENSE_REC_DATA_NOECC 0x17
662 #define SCSI_ADSENSE_REC_DATA_ECC 0x18
663 #define SCSI_ADSENSE_DEFECT_LIST_ERROR 0x19
664 #define SCSI_ADSENSE_PARAMETER_LIST_LENGTH 0x1A
665 #define SCSI_ADSENSE_MISCOMPARE_DURING_VERIFY_OPERATION 0x1D
666 #define SCSI_ADSENSE_ILLEGAL_COMMAND 0x20
667 #define SCSI_ADSENSE_ACCESS_DENIED 0x20
668 #define SCSI_ADSENSE_ILLEGAL_BLOCK 0x21
669 #define SCSI_ADSENSE_INVALID_TOKEN 0x23
670 #define SCSI_ADSENSE_INVALID_CDB 0x24
671 #define SCSI_ADSENSE_INVALID_LUN 0x25
672 #define SCSI_ADSENSE_INVALID_FIELD_PARAMETER_LIST 0x26
673 #define SCSI_ADSENSE_WRITE_PROTECT 0x27
674 #define SCSI_ADSENSE_MEDIUM_CHANGED 0x28
675 #define SCSI_ADSENSE_BUS_RESET 0x29
676 #define SCSI_ADSENSE_PARAMETERS_CHANGED 0x2A
677 #define SCSI_ADSENSE_INSUFFICIENT_TIME_FOR_OPERATION 0x2E
678 #define SCSI_ADSENSE_INVALID_MEDIA 0x30
679 #define SCSI_ADSENSE_DEFECT_LIST 0x32
680 #define SCSI_ADSENSE_LB_PROVISIONING 0x38
681 #define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE 0x3a
682 #define SCSI_ADSENSE_POSITION_ERROR 0x3b
683 #define SCSI_ADSENSE_LOGICAL_UNIT_ERROR 0x3e
684 #define SCSI_ADSENSE_OPERATING_CONDITIONS_CHANGED 0x3f
685 #define SCSI_ADSENSE_DATA_PATH_FAILURE 0x41
686 #define SCSI_ADSENSE_POWER_ON_SELF_TEST_FAILURE 0x42
687 #define SCSI_ADSENSE_INTERNAL_TARGET_FAILURE 0x44
688 #define SCSI_ADSENSE_DATA_TRANSFER_ERROR 0x4b
689 #define SCSI_ADSENSE_LUN_FAILED_SELF_CONFIGURATION 0x4c
690 #define SCSI_ADSENSE_RESOURCE_FAILURE 0x55
691 #define SCSI_ADSENSE_OPERATOR_REQUEST 0x5a
692 #define SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x5d
693 #define SCSI_ADSENSE_ILLEGAL_MODE_FOR_THIS_TRACK 0x64
694 #define SCSI_ADSENSE_COPY_PROTECTION_FAILURE 0x6f
695 #define SCSI_ADSENSE_POWER_CALIBRATION_ERROR 0x73
696 #define SCSI_ADSENSE_VENDOR_UNIQUE 0x80
697 #define SCSI_ADSENSE_MUSIC_AREA 0xA0
698 #define SCSI_ADSENSE_DATA_AREA 0xA1
699 #define SCSI_ADSENSE_VOLUME_OVERFLOW 0xA7
700 
701 #define SCSI_ADWRITE_PROTECT SCSI_ADSENSE_WRITE_PROTECT
702 #define SCSI_FAILURE_PREDICTION_THRESHOLD_EXCEEDED SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED
703 
704 // ADSENSE additional qualifiers
705 
706 // SCSI_ADSENSE_NO_SENSE (0x00)
707 
708 #define SCSI_SENSEQ_FILEMARK_DETECTED 0x01
709 #define SCSI_SENSEQ_END_OF_MEDIA_DETECTED 0x02
710 #define SCSI_SENSEQ_SETMARK_DETECTED 0x03
711 #define SCSI_SENSEQ_BEGINNING_OF_MEDIA_DETECTED 0x04
712 #define SCSI_SENSEQ_OPERATION_IS_IN_PROGRESS 0x16
713 
714 // SCSI_ADSENSE_WRITE (0x03)
715 
716 #define SCSI_SENSEQ_PERIPHERAL_DEVICE_WRITE_FAULT 0x00
717 #define SCSI_SENSEQ_NO_WRITE_CURRENT 0x01
718 #define SCSI_SENSEQ_EXCESSIVE_WRITE_ERRORS 0x02
719 
720 // SCSI_ADSENSE_LUN_NOT_READY (0x04)
721 
722 #define SCSI_SENSEQ_CAUSE_NOT_REPORTABLE 0x00
723 #define SCSI_SENSEQ_BECOMING_READY 0x01
724 #define SCSI_SENSEQ_INIT_COMMAND_REQUIRED 0x02
725 #define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED 0x03
726 #define SCSI_SENSEQ_FORMAT_IN_PROGRESS 0x04
727 #define SCSI_SENSEQ_REBUILD_IN_PROGRESS 0x05
728 #define SCSI_SENSEQ_RECALCULATION_IN_PROGRESS 0x06
729 #define SCSI_SENSEQ_OPERATION_IN_PROGRESS 0x07
730 #define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS 0x08
731 #define SCSI_SENSEQ_SPACE_ALLOC_IN_PROGRESS 0x14
732 
733 // SCSI_ADSENSE_LUN_COMMUNICATION (0x08)
734 
735 #define SCSI_SENSEQ_COMM_FAILURE 0x00
736 #define SCSI_SENSEQ_COMM_TIMEOUT 0x01
737 #define SCSI_SENSEQ_COMM_PARITY_ERROR 0x02
738 #define SCSI_SESNEQ_COMM_CRC_ERROR 0x03
739 #define SCSI_SENSEQ_UNREACHABLE_TARGET 0x04
740 
741 // SCSI_ADSENSE_SERVO_ERROR (0x09)
742 
743 #define SCSI_SENSEQ_TRACK_FOLLOWING_ERROR 0x00
744 #define SCSI_SENSEQ_TRACKING_SERVO_FAILURE 0x01
745 #define SCSI_SENSEQ_FOCUS_SERVO_FAILURE 0x02
746 #define SCSI_SENSEQ_SPINDLE_SERVO_FAILURE 0x03
747 #define SCSI_SENSEQ_HEAD_SELECT_FAULT 0x04
748 
749 // SCSI_ADSENSE_WARNING (0x0B)
750 
751 #define SCSI_SENSEQ_POWER_LOSS_EXPECTED 0x08
752 
753 // SCSI_ADSENSE_WRITE_ERROR (0x0C)
754 
755 #define SCSI_SENSEQ_LOSS_OF_STREAMING 0x09
756 #define SCSI_SENSEQ_PADDING_BLOCKS_ADDED 0x0A
757 
758 // SCSI_ADSENSE_COPY_TARGET_DEVICE_ERROR (0x0D)
759 
760 #define SCSI_SENSEQ_NOT_REACHABLE 0x02
761 #define SCSI_SENSEQ_DATA_UNDERRUN 0x04
762 
763 // SCSI_ADSENSE_UNRECOVERED_ERROR (0x11)
764 
765 #define SCSI_SENSEQ_UNRECOVERED_READ_ERROR 0x00
766 
767 // SCSI_ADSENSE_SEEK_ERROR (0x15)
768 
769 #define SCSI_SENSEQ_RANDOM_POSITIONING_ERROR 0x00
770 #define SCSI_SENSEQ_MECHANICAL_POSITIONING_ERROR 0x01
771 #define SCSI_SENSEQ_POSITIONING_ERROR_DETECTED_BY_READ_OF_MEDIUM 0x02
772 
773 // SCSI_ADSENSE_DEFECT_LIST_ERROR (0x19)
774 
775 #define SCSI_SENSEQ_DEFECT_LIST_ERROR 0x00
776 #define SCSI_SENSEQ_DEFECT_LIST_NOT_AVAILABLE 0x01
777 #define SCSI_SENSEQ_DEFECT_LIST_ERROR_IN_PRIMARY_LIST 0x02
778 #define SCSI_SENSEQ_DEFECT_LIST_ERROR_IN_GROWN_LIST 0x03
779 
780 // SCSI_ADSENSE_ACCESS_DENIED (0x20)
781 
782 #define SCSI_SENSEQ_NO_ACCESS_RIGHTS 0x02
783 
784 // SCSI_ADSENSE_ILLEGAL_BLOCK (0x21)
785 
786 #define SCSI_SENSEQ_LOGICAL_ADDRESS_OUT_OF_RANGE 0x00
787 #define SCSI_SENSEQ_ILLEGAL_ELEMENT_ADDR 0x01
788 #define SCSI_SENSEQ_INVALID_WRITE_ADDRESS 0x02
789 #define SCSI_SENSEQ_INVALID_WRITE_CROSSING_LAYER_JUMP 0x03
790 #define SCSI_SENSEQ_UNALIGNED_WRITE 0x04
791 #define SCSI_SENSEQ_WRITE_BOUNDARY_VIOLATION 0x05
792 #define SCSI_SENSEQ_READ_INVALID_DATA 0x06
793 #define SCSI_SENSEQ_READ_BOUNDARY_VIOLATION 0x07
794 #define SCSI_SENSEQ_MISALIGNED_WRITE 0x08
795 
796 // SCSI_ADSENSE_INVALID_FIELD_PARAMETER_LIST (0x26)
797 
798 #define SCSI_SENSEQ_INVALID_RELEASE_OF_PERSISTENT_RESERVATION 0x04
799 #define SCSI_SENSEQ_TOO_MANY_SEGMENT_DESCRIPTORS 0x08
800 
801 // SCSI_ADSENSE_WRITE_PROTECT (0x27)
802 
803 #define SCSI_SENSEQ_SPACE_ALLOC_FAILED_WRITE_PROTECT 0x07
804 
805 // SCSI_ADSENSE_PARAMETERS_CHANGED (0x2A)
806 
807 #define SCSI_SENSEQ_CAPACITY_DATA_CHANGED 0x09
808 
809 // SCSI_ADSENSE_POSITION_ERROR (0x3b)
810 
811 #define SCSI_SENSEQ_DESTINATION_FULL 0x0d
812 #define SCSI_SENSEQ_SOURCE_EMPTY 0x0e
813 
814 // SCSI_ADSENSE_INVALID_MEDIA (0x30)
815 
816 #define SCSI_SENSEQ_INCOMPATIBLE_MEDIA_INSTALLED 0x00
817 #define SCSI_SENSEQ_UNKNOWN_FORMAT 0x01
818 #define SCSI_SENSEQ_INCOMPATIBLE_FORMAT 0x02
819 #define SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED 0x03
820 
821 // SCSI_ADSENSE_DEFECT_LIST (0x32)
822 
823 #define SCSI_SENSEQ_NO_DEFECT_SPARE_LOCATION_AVAILABLE 0x00
824 #define SCSI_SENSEQ_DEFECT_LIST_UPDATE_FAILURE 0x01
825 
826 // SCSI_ADSENSE_LB_PROVISIONING (0x38)
827 
828 #define SCSI_SENSEQ_SOFT_THRESHOLD_REACHED 0x07
829 
830 // SCSI_ADSENSE_LOGICAL_UNIT_ERROR (0x3e)
831 
832 #define SCSI_SENSEQ_LOGICAL_UNIT_HAS_NOT_SELF_CONFIGURED_YET 0x00
833 #define SCSI_SENSEQ_LOGICAL_UNIT_FAILURE 0x01
834 #define SCSI_SENSEQ_TIMEOUT_ON_LOGICAL_UNIT 0x02
835 #define SCSI_SENSEQ_LOGICAL_UNIT_FAILED_SELF_TEST 0x03
836 #define SCSI_SENSEQ_LOGICAL_UNIT_FAILED_TO_UPDATE_SELF_TEST_LOG 0x04
837 
838 // SCSI_ADSENSE_OPERATING_CONDITIONS_CHANGED (0x3f)
839 
840 #define SCSI_SENSEQ_TARGET_OPERATING_CONDITIONS_CHANGED 0x00
841 #define SCSI_SENSEQ_MICROCODE_CHANGED 0x01
842 #define SCSI_SENSEQ_OPERATING_DEFINITION_CHANGED 0x02
843 #define SCSI_SENSEQ_INQUIRY_DATA_CHANGED 0x03
844 #define SCSI_SENSEQ_COMPONENT_DEVICE_ATTACHED 0x04
845 #define SCSI_SENSEQ_DEVICE_IDENTIFIER_CHANGED 0x05
846 #define SCSI_SENSEQ_REDUNDANCY_GROUP_MODIFIED 0x06
847 #define SCSI_SENSEQ_REDUNDANCY_GROUP_DELETED 0x07
848 #define SCSI_SENSEQ_SPARE_MODIFIED 0x08
849 #define SCSI_SENSEQ_SPARE_DELETED 0x09
850 #define SCSI_SENSEQ_VOLUME_SET_MODIFIED 0x0A
851 #define SCSI_SENSEQ_VOLUME_SET_DELETED 0x0B
852 #define SCSI_SENSEQ_VOLUME_SET_DEASSIGNED 0x0C
853 #define SCSI_SENSEQ_VOLUME_SET_REASSIGNED 0x0D
854 #define SCSI_SENSEQ_REPORTED_LUNS_DATA_CHANGED 0x0E
855 #define SCSI_SENSEQ_ECHO_BUFFER_OVERWRITTEN 0x0F
856 #define SCSI_SENSEQ_MEDIUM_LOADABLE 0x10
857 #define SCSI_SENSEQ_MEDIUM_AUXILIARY_MEMORY_ACCESSIBLE 0x11
858 
859 // SCSI_ADSENSE_INTERNAL_TARGET_FAILURE (0x44)
860 
861 #define SCSI_SENSEQ_INTERNAL_TARGET_FAILURE 0x00
862 #define SCSI_SENSEQ_PRESISTENT_RESERVATION_INFORMATION_LOST 0x01
863 #define SCSI_SENSEQ_ATA_DEVICE_FAILED_SET_FEATURES 0x71
864 
865 // SCSI_ADSENSE_DATA_TRANSFER_ERROR (0x4b)
866 
867 #define SCSI_SENSEQ_INITIATOR_RESPONSE_TIMEOUT 0x06
868 
869 // SCSI_ADSENSE_RESOURCE_FAILURE (0x55)
870 
871 #define SCSI_SENSEQ_SYSTEM_RESOURCE_FAILURE 0x00
872 #define SCSI_SENSEQ_SYSTEM_BUFFER_FULL 0x01
873 #define SCSI_SENSEQ_INSUFFICIENT_RESERVATION_RESOURCES 0x02
874 #define SCSI_SENSEQ_INSUFFICIENT_RESOURCES 0x03
875 
876 // SCSI_ADSENSE_OPERATOR_REQUEST (0x5a)
877 
878 #define SCSI_SENSEQ_STATE_CHANGE_INPUT 0x00
879 #define SCSI_SENSEQ_MEDIUM_REMOVAL 0x01
880 #define SCSI_SENSEQ_WRITE_PROTECT_ENABLE 0x02
881 #define SCSI_SENSEQ_WRITE_PROTECT_DISABLE 0x03
882 
883 // SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED (0x5d)
884 
885 #define SCSI_SENSEQ_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x00
886 #define SCSI_SENSEQ_MEDIA_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x01
887 #define SCSI_SENSEQ_LUN_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x02
888 #define SCSI_SENSEQ_SPARE_AREA_EXHAUSTION_PREDICTION_THRESHOLD_EXCEEDED 0x03
889 #define SCSI_SENSEQ_GENERAL_HARD_DRIVE_FAILURE 0x10
890 #define SCSI_SENSEQ_DRIVE_ERROR_RATE_TOO_HIGH 0x11
891 #define SCSI_SENSEQ_DATA_ERROR_RATE_TOO_HIGH 0x12
892 #define SCSI_SENSEQ_SEEK_ERROR_RATE_TOO_HIGH 0x13
893 #define SCSI_SENSEQ_TOO_MANY_BLOCK_REASSIGNS 0x14
894 #define SCSI_SENSEQ_ACCESS_TIMES_TOO_HIGH 0x15
895 #define SCSI_SENSEQ_START_UNIT_TIMES_TOO_HIGH 0x16
896 #define SCSI_SENSEQ_CHANNEL_PARAMETRICS 0x17
897 #define SCSI_SENSEQ_CONTROLLER_DETECTED 0x18
898 #define SCSI_SENSEQ_THROUGHPUT_PERFORMANCE 0x19
899 #define SCSI_SENSEQ_SEEK_TIME_PERFORMANCE 0x1A
900 #define SCSI_SENSEQ_SPIN_UP_RETRY_COUNT 0x1B
901 #define SCSI_SENSEQ_DRIVE_CALIBRATION_RETRY_COUNT 0x1C
902 #define SCSI_SENSEQ_DATA_CHANNEL_DATA_ERROR_RATE_TOO_HIGH 0x32
903 #define SCSI_SENSEQ_SERVO_DATA_ERROR_RATE_TOO_HIGH 0x42
904 #define SCSI_SENSEQ_SERVER_SEEK_ERROR_RATE_TOO_HIGH 0x43
905 #define SCSI_SENSEQ_FAILURE_PREDICTION_THRESHOLD_EXCEEDED_FALSE 0xFF
906 
907 // SCSI_ADSENSE_COPY_PROTECTION_FAILURE (0x6f)
908 
909 #define SCSI_SENSEQ_AUTHENTICATION_FAILURE 0x00
910 #define SCSI_SENSEQ_KEY_NOT_PRESENT 0x01
911 #define SCSI_SENSEQ_KEY_NOT_ESTABLISHED 0x02
912 #define SCSI_SENSEQ_READ_OF_SCRAMBLED_SECTOR_WITHOUT_AUTHENTICATION 0x03
913 #define SCSI_SENSEQ_MEDIA_CODE_MISMATCHED_TO_LOGICAL_UNIT 0x04
914 #define SCSI_SENSEQ_LOGICAL_UNIT_RESET_COUNT_ERROR 0x05
915 
916 // SCSI_ADSENSE_POWER_CALIBRATION_ERROR (0x73)
917 
918 #define SCSI_SENSEQ_POWER_CALIBRATION_AREA_ALMOST_FULL 0x01
919 #define SCSI_SENSEQ_POWER_CALIBRATION_AREA_FULL 0x02
920 #define SCSI_SENSEQ_POWER_CALIBRATION_AREA_ERROR 0x03
921 #define SCSI_SENSEQ_PMA_RMA_UPDATE_FAILURE 0x04
922 #define SCSI_SENSEQ_PMA_RMA_IS_FULL 0x05
923 #define SCSI_SENSEQ_PMA_RMA_ALMOST_FULL 0x06
924 
925 #define FILE_DEVICE_SCSI 0x0000001b
926 
927 #define IOCTL_SCSI_EXECUTE_IN ((FILE_DEVICE_SCSI << 16) + 0x0011)
928 #define IOCTL_SCSI_EXECUTE_OUT ((FILE_DEVICE_SCSI << 16) + 0x0012)
929 #define IOCTL_SCSI_EXECUTE_NONE ((FILE_DEVICE_SCSI << 16) + 0x0013)
930 
931 /* SMART support in ATAPI */
932 #define IOCTL_SCSI_MINIPORT_SMART_VERSION ((FILE_DEVICE_SCSI << 16) + 0x0500)
933 #define IOCTL_SCSI_MINIPORT_IDENTIFY ((FILE_DEVICE_SCSI << 16) + 0x0501)
934 #define IOCTL_SCSI_MINIPORT_READ_SMART_ATTRIBS ((FILE_DEVICE_SCSI << 16) + 0x0502)
935 #define IOCTL_SCSI_MINIPORT_READ_SMART_THRESHOLDS ((FILE_DEVICE_SCSI << 16) + 0x0503)
936 #define IOCTL_SCSI_MINIPORT_ENABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0504)
937 #define IOCTL_SCSI_MINIPORT_DISABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0505)
938 #define IOCTL_SCSI_MINIPORT_RETURN_STATUS ((FILE_DEVICE_SCSI << 16) + 0x0506)
939 #define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTOSAVE ((FILE_DEVICE_SCSI << 16) + 0x0507)
940 #define IOCTL_SCSI_MINIPORT_SAVE_ATTRIBUTE_VALUES ((FILE_DEVICE_SCSI << 16) + 0x0508)
941 #define IOCTL_SCSI_MINIPORT_EXECUTE_OFFLINE_DIAGS ((FILE_DEVICE_SCSI << 16) + 0x0509)
942 #define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTO_OFFLINE ((FILE_DEVICE_SCSI << 16) + 0x050a)
943 #define IOCTL_SCSI_MINIPORT_READ_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050b)
944 #define IOCTL_SCSI_MINIPORT_WRITE_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050c)
945 
946 /* CLUSTER support */
947 #define IOCTL_SCSI_MINIPORT_NOT_QUORUM_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0520)
948 #define IOCTL_SCSI_MINIPORT_NOT_CLUSTER_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0521)
949 
950 #define MODE_FD_SINGLE_SIDE 0x01
951 #define MODE_FD_DOUBLE_SIDE 0x02
952 #define MODE_FD_MAXIMUM_TYPE 0x1E
953 #define MODE_DSP_FUA_SUPPORTED 0x10
954 #define MODE_DSP_WRITE_PROTECT 0x80
955 
956 #define CDDA_CHANNEL_MUTED 0x0
957 #define CDDA_CHANNEL_ZERO 0x1
958 #define CDDA_CHANNEL_ONE 0x2
959 #define CDDA_CHANNEL_TWO 0x4
960 #define CDDA_CHANNEL_THREE 0x8
961 
962 #define CDVD_LMT_CADDY 0
963 #define CDVD_LMT_TRAY 1
964 #define CDVD_LMT_POPUP 2
965 #define CDVD_LMT_RESERVED1 3
966 #define CDVD_LMT_CHANGER_INDIVIDUAL 4
967 #define CDVD_LMT_CHANGER_CARTRIDGE 5
968 #define CDVD_LMT_RESERVED2 6
969 #define CDVD_LMT_RESERVED3 7
970 
971 #define LOADING_MECHANISM_CADDY 0x00
972 #define LOADING_MECHANISM_TRAY 0x01
973 #define LOADING_MECHANISM_POPUP 0x02
974 #define LOADING_MECHANISM_INDIVIDUAL_CHANGER 0x04
975 #define LOADING_MECHANISM_CARTRIDGE_CHANGER 0x05
976 
977 #define MODE_BLOCK_DESC_LENGTH 8
978 #define MODE_HEADER_LENGTH 4
979 #define MODE_HEADER_LENGTH10 8
980 
981 /* CDROM audio control */
982 #define CDB_AUDIO_PAUSE 0x00
983 #define CDB_AUDIO_RESUME 0x01
984 #define CDB_DEVICE_START 0x11
985 #define CDB_DEVICE_STOP 0x10
986 #define CDB_EJECT_MEDIA 0x10
987 #define CDB_LOAD_MEDIA 0x01
988 #define CDB_SUBCHANNEL_HEADER 0x00
989 #define CDB_SUBCHANNEL_BLOCK 0x01
990 
991 #define CDROM_AUDIO_CONTROL_PAGE 0x0E
992 #define MODE_SELECT_IMMEDIATE 0x04
993 #define MODE_SELECT_PFBIT 0x10
994 
995 #define CDB_USE_MSF 0x01
996 
997 /* Multisession CDROMs */
998 #define GET_LAST_SESSION 0x01
999 #define GET_SESSION_DATA 0x02
1000 
1001 typedef union _CDB {
1002  struct _CDB6GENERIC {
1013  struct _CDB6READWRITE {
1020  UCHAR Control;
1022  struct _CDB6INQUIRY {
1024  UCHAR Reserved1:5;
1026  UCHAR PageCode;
1027  UCHAR IReserved;
1029  UCHAR Control;
1031  struct _CDB6INQUIRY3 {
1041  struct _CDB6VERIFY {
1050  } CDB6VERIFY, *PCDB6VERIFY;
1051  struct _CDB6FORMAT {
1055  UCHAR FReserved1;
1058  UCHAR FReserved2;
1059  } CDB6FORMAT, *PCDB6FORMAT;
1060  struct _CDB10 {
1063  UCHAR Reserved1:2;
1071  UCHAR Reserved2;
1074  UCHAR Control;
1075  } CDB10, *PCDB10;
1076  struct _CDB12 {
1087  } CDB12, *PCDB12;
1088  struct _CDB16 {
1098  } CDB16, *PCDB16;
1099  struct _PAUSE_RESUME {
1101  UCHAR Reserved1:5;
1103  UCHAR Reserved2[6];
1104  UCHAR Action;
1105  UCHAR Control;
1107  struct _READ_TOC {
1109  UCHAR Reserved0:1;
1110  UCHAR Msf:1;
1111  UCHAR Reserved1:3;
1114  UCHAR Reserved2:4;
1118  UCHAR Control:6;
1119  UCHAR Format:2;
1120  } READ_TOC, *PREAD_TOC;
1157  struct _REPAIR_TRACK {
1166  struct _CLOSE_TRACK {
1178  struct _READ_BUFFER_CAPACITY {
1181  UCHAR Reserved1:7;
1186  struct _SEND_CUE_SHEET {
1190  UCHAR Control;
1192  struct _READ_HEADER {
1194  UCHAR Reserved1:1;
1195  UCHAR Msf:1;
1196  UCHAR Reserved2:3;
1197  UCHAR Lun:3;
1201  UCHAR Control;
1203  struct _PLAY_AUDIO {
1211  } PLAY_AUDIO, *PPLAY_AUDIO;
1212  struct _PLAY_AUDIO_MSF {
1214  UCHAR Reserved1:5;
1216  UCHAR Reserved2;
1223  UCHAR Control;
1225  struct _BLANK_MEDIA {
1227  UCHAR BlankType:3;
1228  UCHAR Reserved1:1;
1230  UCHAR Reserved2:3;
1235  struct _PLAY_CD {
1241  _ANONYMOUS_UNION union {
1242  struct _LBA {
1245  } LBA;
1246  struct _MSF {
1247  UCHAR Reserved1;
1255  } MSF;
1256  } DUMMYUNIONNAME;
1261  UCHAR Reserved2:3;
1264  } PLAY_CD, *PPLAY_CD;
1265  struct _SCAN_CD {
1277  } SCAN_CD, *PSCAN_CD;
1285  struct _SUBCHANNEL {
1287  UCHAR Reserved0:1;
1288  UCHAR Msf:1;
1289  UCHAR Reserved1:3;
1291  UCHAR Reserved2:6;
1292  UCHAR SubQ:1;
1293  UCHAR Reserved3:1;
1294  UCHAR Format;
1295  UCHAR Reserved4[2];
1298  UCHAR Control;
1299  } SUBCHANNEL, *PSUBCHANNEL;
1300  struct _READ_CD {
1303  UCHAR Reserved0:1;
1309  UCHAR ErrorFlags:2;
1310  UCHAR IncludeEDC:1;
1312  UCHAR HeaderCode:2;
1315  UCHAR Reserved3:5;
1316  UCHAR Control;
1317  } READ_CD, *PREAD_CD;
1318  struct _READ_CD_MSF {
1321  UCHAR Reserved1:1;
1324  UCHAR Reserved2;
1331  UCHAR Reserved3;
1332  UCHAR Reserved4:1;
1333  UCHAR ErrorFlags:2;
1334  UCHAR IncludeEDC:1;
1336  UCHAR HeaderCode:2;
1340  UCHAR Control;
1342  struct _PLXTR_READ_CDDA {
1344  UCHAR Reserved0:5;
1354  UCHAR SubCode;
1355  UCHAR Control;
1357  struct _NEC_READ_CDDA {
1359  UCHAR Reserved0;
1364  UCHAR Reserved1;
1367  UCHAR Control;
1369 #if (NTDDI_VERSION >= NTDDI_WIN8)
1370  struct _MODE_SENSE {
1372  UCHAR Reserved1:3;
1373  UCHAR Dbd:1;
1374  UCHAR Reserved2:4;
1375  UCHAR PageCode:6;
1376  UCHAR Pc:2;
1379  UCHAR Control;
1380  } MODE_SENSE;
1381  struct _MODE_SENSE10 {
1383  UCHAR Reserved1:3;
1384  UCHAR Dbd:1;
1386  UCHAR Reserved2:3;
1387  UCHAR PageCode:6;
1388  UCHAR Pc:2;
1390  UCHAR Reserved3[3];
1392  UCHAR Control;
1393  } MODE_SENSE10;
1394 #else
1395  struct _MODE_SENSE {
1397  UCHAR Reserved1:3;
1398  UCHAR Dbd:1;
1399  UCHAR Reserved2:1;
1401  UCHAR PageCode:6;
1402  UCHAR Pc:2;
1403  UCHAR Reserved3;
1405  UCHAR Control;
1406  } MODE_SENSE, *PMODE_SENSE;
1407  struct _MODE_SENSE10 {
1409  UCHAR Reserved1:3;
1410  UCHAR Dbd:1;
1411  UCHAR Reserved2:1;
1413  UCHAR PageCode:6;
1414  UCHAR Pc:2;
1415  UCHAR Reserved3[4];
1417  UCHAR Control;
1419 #endif
1420  struct _MODE_SELECT {
1422  UCHAR SPBit:1;
1423  UCHAR Reserved1:3;
1424  UCHAR PFBit:1;
1426  UCHAR Reserved2[2];
1428  UCHAR Control;
1430  struct _MODE_SELECT10 {
1432  UCHAR SPBit:1;
1433  UCHAR Reserved1:3;
1434  UCHAR PFBit:1;
1436  UCHAR Reserved2[5];
1438  UCHAR Control;
1440  struct _LOCATE {
1452  } LOCATE, *PLOCATE;
1453  struct _LOGSENSE {
1455  UCHAR SPBit:1;
1456  UCHAR PPCBit:1;
1457  UCHAR Reserved1:3;
1459  UCHAR PageCode:6;
1460  UCHAR PCBit:2;
1461  UCHAR Reserved2;
1462  UCHAR Reserved3;
1465  UCHAR Control;
1466  } LOGSENSE, *PLOGSENSE;
1467  struct _LOGSELECT {
1478  } LOGSELECT, *PLOGSELECT;
1479  struct _PRINT {
1485  } PRINT, *PPRINT;
1486  struct _SEEK {
1488  UCHAR Reserved1:5;
1491  UCHAR Reserved2[3];
1492  UCHAR Control;
1493  } SEEK, *PSEEK;
1494  struct _ERASE {
1496  UCHAR Long:1;
1497  UCHAR Immediate:1;
1498  UCHAR Reserved1:3;
1500  UCHAR Reserved2[3];
1501  UCHAR Control;
1502  } ERASE, *PERASE;
1503  struct _START_STOP {
1505  UCHAR Immediate:1;
1506  UCHAR Reserved1:4;
1508  UCHAR Reserved2[2];
1509  UCHAR Start:1;
1510  UCHAR LoadEject:1;
1511  UCHAR Reserved3:6;
1512  UCHAR Control;
1513  } START_STOP, *PSTART_STOP;
1514  struct _MEDIA_REMOVAL {
1516  UCHAR Reserved1:5;
1518  UCHAR Reserved2[2];
1519  UCHAR Prevent:1;
1522  UCHAR Control;
1524  struct _SEEK_BLOCK {
1533  } SEEK_BLOCK, *PSEEK_BLOCK;
1543  struct _PARTITION {
1550  } PARTITION, *PPARTITION;
1568  union {
1570  struct {
1573  UCHAR Reserved:4;
1575  } Fields;
1576  } Byte6;
1629  struct _MOVE_MEDIUM {
1692  struct _LOAD_UNLOAD {
1694  UCHAR Immediate:1;
1695  UCHAR Reserved1:4;
1697  UCHAR Reserved2[2];
1698  UCHAR Start:1;
1699  UCHAR LoadEject:1;
1700  UCHAR Reserved3:6;
1701  UCHAR Reserved4[3];
1702  UCHAR Slot;
1703  UCHAR Reserved5[3];
1705  struct _MECH_STATUS {
1711  UCHAR Reserved2[1];
1747  } GET_PERFORMANCE;
1748  struct _READ_DVD_STRUCTURE {
1750  UCHAR Reserved1:5;
1751  UCHAR Lun:3;
1752  UCHAR RMDBlockNumber[4];
1754  UCHAR Format;
1756  UCHAR Reserved3:6;
1757  UCHAR AGID:2;
1758  UCHAR Control;
1760  struct _SET_STREAMING {
1764  UCHAR Control;
1765  } SET_STREAMING;
1776  struct _SEND_KEY {
1778  UCHAR Reserved1:5;
1779  UCHAR Lun:3;
1780  UCHAR Reserved2[6];
1782  UCHAR KeyFormat:6;
1783  UCHAR AGID:2;
1784  UCHAR Control;
1785  } SEND_KEY, *PSEND_KEY;
1786  struct _REPORT_KEY {
1788  UCHAR Reserved1:5;
1789  UCHAR Lun:3;
1791  UCHAR Reserved2[2];
1793  UCHAR KeyFormat:6;
1794  UCHAR AGID:2;
1795  UCHAR Control;
1796  } REPORT_KEY, *PREPORT_KEY;
1797  struct _SET_READ_AHEAD {
1799  UCHAR Reserved1:5;
1801  UCHAR TriggerLBA[4];
1802  UCHAR ReadAheadLBA[4];
1804  UCHAR Control;
1814  struct _REPORT_LUNS {
1816  UCHAR Reserved1[5];
1818  UCHAR Reserved2[1];
1819  UCHAR Control;
1839  struct _GET_CONFIGURATION {
1846  UCHAR Control;
1848  struct _SET_CD_SPEED {
1850  _ANONYMOUS_UNION union {
1851  UCHAR Reserved1;
1852  _ANONYMOUS_STRUCT struct {
1855  } DUMMYSTRUCTNAME;
1856  } DUMMYUNIONNAME;
1857  UCHAR ReadSpeed[2];
1858  UCHAR WriteSpeed[2];
1862  struct _READ12 {
1874  } READ12;
1875  struct _WRITE12 {
1888  } WRITE12;
1889  struct _READ16 {
1900  } READ16;
1901  struct _WRITE16 {
1912  } WRITE16;
1913  struct _VERIFY16 {
1926  } VERIFY16;
1946  } READ_CAPACITY16;
1957  } TOKEN_OPERATION;
1968  struct _UNMAP {
1977  } UNMAP;
1986  } GET_LBA_STATUS;
1989 } CDB, *PCDB;
1990 
1999 
2008 
2015 
2024 
2028  _ANONYMOUS_UNION union {
2031  _ANONYMOUS_STRUCT struct {
2035  } DUMMYSTRUCTNAME;
2036  } DUMMYUNIONNAME;
2040 
2049 
2056 
2062 
2063 typedef struct _CDVD_KEY_HEADER {
2064  UCHAR DataLength[2];
2065  UCHAR Reserved[2];
2068 
2069 typedef struct _CDVD_REPORT_AGID_DATA {
2070  UCHAR Reserved1[3];
2071  UCHAR Reserved2:6;
2072  UCHAR AGID:2;
2074 
2075 typedef struct _CDVD_CHALLENGE_KEY_DATA {
2077  UCHAR Reserved[2];
2079 
2080 typedef struct _CDVD_KEY_DATA {
2081  UCHAR Key[5];
2082  UCHAR Reserved[3];
2084 
2085 typedef struct _CDVD_REPORT_ASF_DATA {
2086  UCHAR Reserved1[3];
2087  UCHAR Success:1;
2088  UCHAR Reserved2:7;
2090 
2091 typedef struct _CDVD_TITLE_KEY_HEADER {
2092  UCHAR DataLength[2];
2093  UCHAR Reserved1[1];
2094  UCHAR Reserved2:3;
2095  UCHAR CGMS:2;
2096  UCHAR CP_SEC:1;
2097  UCHAR CPM:1;
2098  UCHAR Zero:1;
2101 
2102 typedef struct _FORMAT_DESCRIPTOR {
2108 
2109 typedef struct _FORMAT_LIST_HEADER {
2114  UCHAR IP:1;
2115  UCHAR STPF:1;
2116  UCHAR DCRT:1;
2117  UCHAR DPRY:1;
2118  UCHAR FOV:1;
2122 
2130 
2136 
2137 typedef struct _OPC_TABLE_ENTRY {
2141 
2142 typedef struct _DISC_INFORMATION {
2170 
2171 typedef struct _DISK_INFORMATION {
2195 
2196 typedef struct _DATA_BLOCK_HEADER {
2199  _ANONYMOUS_UNION union {
2201  struct {
2202  UCHAR Reserved;
2206  } MSF;
2207  } DUMMYUNIONNAME;
2209 
2210 typedef struct _TRACK_INFORMATION {
2231 
2232 typedef struct _TRACK_INFORMATION2 {
2259 
2260 typedef struct _TRACK_INFORMATION3 {
2288 
2289 typedef struct _PERFORMANCE_DESCRIPTOR {
2303 
2304 typedef struct _SCSI_EXTENDED_MESSAGE {
2308  union _EXTENDED_ARGUMENTS {
2309  struct {
2310  UCHAR Modifier[4];
2311  } Modify;
2312  struct {
2315  } Synchronous;
2316  struct{
2317  UCHAR Width;
2318  } Wide;
2321 
2322 #ifndef _INQUIRYDATA_DEFINED /* also in minitape.h */
2323 #define _INQUIRYDATA_DEFINED
2324 
2325 #define INQUIRYDATABUFFERSIZE 36
2326 
2327 #if (NTDDI_VERSION < NTDDI_WINXP)
2328 typedef struct _INQUIRYDATA {
2329  UCHAR DeviceType:5;
2333  UCHAR Versions;
2335  UCHAR HiSupport:1;
2336  UCHAR NormACA:1;
2337  UCHAR ReservedBit:1;
2338  UCHAR AERC:1;
2340  UCHAR Reserved[2];
2341  UCHAR SoftReset:1;
2342  UCHAR CommandQueue:1;
2343  UCHAR Reserved2:1;
2345  UCHAR Synchronous:1;
2346  UCHAR Wide16Bit:1;
2347  UCHAR Wide32Bit:1;
2349  UCHAR VendorId[8];
2350  UCHAR ProductId[16];
2352  UCHAR VendorSpecific[20];
2353  UCHAR Reserved3[40];
2355 #else
2356 typedef struct _INQUIRYDATA {
2357  UCHAR DeviceType:5;
2361  _ANONYMOUS_UNION union {
2362  UCHAR Versions;
2363  _ANONYMOUS_STRUCT struct {
2364  UCHAR ANSIVersion:3;
2365  UCHAR ECMAVersion:3;
2366  UCHAR ISOVersion:2;
2367  } DUMMYSTRUCTNAME;
2368  } DUMMYUNIONNAME;
2370  UCHAR HiSupport:1;
2371  UCHAR NormACA:1;
2372  UCHAR TerminateTask:1;
2373  UCHAR AERC:1;
2375  UCHAR Reserved;
2376  UCHAR Addr16:1;
2377  UCHAR Addr32:1;
2378  UCHAR AckReqQ:1;
2379  UCHAR MediumChanger:1;
2380  UCHAR MultiPort:1;
2381  UCHAR ReservedBit2:1;
2383  UCHAR ReservedBit3:1;
2384  UCHAR SoftReset:1;
2385  UCHAR CommandQueue:1;
2388  UCHAR Synchronous:1;
2389  UCHAR Wide16Bit:1;
2390  UCHAR Wide32Bit:1;
2392  UCHAR VendorId[8];
2393  UCHAR ProductId[16];
2395  UCHAR VendorSpecific[20];
2396  UCHAR Reserved3[40];
2398 #endif /* (NTDDI_VERSION < NTDDI_WINXP) */
2399 
2400 #endif /* _INQUIRYDATA_DEFINED */
2401 
2402 #define VPD_MAX_BUFFER_SIZE 0xff
2403 
2404 #define VPD_SUPPORTED_PAGES 0x00
2405 #define VPD_SERIAL_NUMBER 0x80
2406 #define VPD_DEVICE_IDENTIFIERS 0x83
2407 #define VPD_MEDIA_SERIAL_NUMBER 0x84
2408 #define VPD_SOFTWARE_INTERFACE_IDENTIFIERS 0x84
2409 #define VPD_NETWORK_MANAGEMENT_ADDRESSES 0x85
2410 #define VPD_EXTENDED_INQUIRY_DATA 0x86
2411 #define VPD_MODE_PAGE_POLICY 0x87
2412 #define VPD_SCSI_PORTS 0x88
2413 #define VPD_ATA_INFORMATION 0x89
2414 
2415 #define VPD_THIRD_PARTY_COPY 0x8F
2416 #define VPD_BLOCK_LIMITS 0xB0
2417 #define VPD_BLOCK_DEVICE_CHARACTERISTICS 0xB1
2418 #define VPD_LOGICAL_BLOCK_PROVISIONING 0xB2
2419 #define VPD_ZONED_BLOCK_DEVICE_CHARACTERISTICS 0xB6
2420 
2429 
2430 typedef struct _VPD_SERIAL_NUMBER_PAGE {
2438 
2439 typedef enum _VPD_CODE_SET {
2445 
2446 typedef enum _VPD_ASSOCIATION {
2453 
2454 typedef enum _VPD_IDENTIFIER_TYPE {
2465 
2476 
2485 
2500 
2501 #if (NTDDI_VERSION >= NTDDI_WIN8)
2507 #if !defined(__midl)
2509 #endif
2511 
2522 
2523 #define BLOCK_DEVICE_TOKEN_LIMITS_DESCRIPTOR_TYPE_WINDOWS 0x00
2524 
2525 #endif /* (NTDDI_VERSION >= NTDDI_WIN8) */
2526 
2527 typedef struct _VPD_BLOCK_LIMITS_PAGE {
2532  union {
2533  struct {
2543  union {
2544  struct {
2550  };
2552  };
2554  };
2555 #if !defined(__midl)
2557 #endif
2558  };
2560 
2561 #define ZONED_CAPABILITIES_NOT_REPORTED 0x0
2562 #define ZONED_CAPABILITIES_HOST_AWARE 0x1
2563 #define ZONED_CAPABILITIES_DEVICE_MANAGED 0x2
2564 
2587 
2588 #define PROVISIONING_TYPE_UNKNOWN 0x0
2589 #define PROVISIONING_TYPE_RESOURCE 0x1
2590 #define PROVISIONING_TYPE_THIN 0x2
2591 
2608 #if !defined(__midl)
2610 #endif
2612 
2626 
2635 
2636 typedef struct _PRI_REGISTRATION_LIST {
2641 
2650 
2651 typedef struct _PRI_RESERVATION_LIST {
2656 
2657 typedef struct _PRO_PARAMETER_LIST {
2666 
2667 typedef struct _SENSE_DATA {
2668  UCHAR ErrorCode:7;
2669  UCHAR Valid:1;
2671  UCHAR SenseKey:4;
2672  UCHAR Reserved:1;
2674  UCHAR EndOfMedia:1;
2675  UCHAR FileMark:1;
2676  UCHAR Information[4];
2684 
2689 
2697 
2705 
2722 
2724 
2725 typedef struct _DESCRIPTOR_SENSE_DATA {
2736 
2737 typedef union _SENSE_DATA_EX {
2741 
2742 /* Read Capacity Data. Returned in Big Endian format */
2743 typedef struct _READ_CAPACITY_DATA {
2747 
2748 typedef struct _READ_CAPACITY_DATA_EX {
2752 
2753 #define RC_BASIS_LAST_LBA_NOT_SEQUENTIAL_WRITE_REQUIRED_ZONES 0x0
2754 #define RC_BASIS_LAST_LBA_ON_LOGICAL_UNIT 0x1
2755 
2756 typedef struct _READ_CAPACITY16_DATA {
2762  UCHAR Reserved:2;
2771 
2772 typedef struct _LBA_STATUS_DESCRIPTOR {
2779 
2780 typedef struct _LBA_STATUS_LIST_HEADER {
2785 
2786 #define LBA_STATUS_MAPPED 0x0
2787 #define LBA_STATUS_DEALLOCATED 0x1
2788 #define LBA_STATUS_ANCHORED 0x2
2789 
2790 /* Read Block Limits Data. Returned in Big Endian format */
2791 typedef struct _READ_BLOCK_LIMITS {
2796 
2805 
2806 typedef struct _MODE_PARAMETER_HEADER {
2808  UCHAR MediumType;
2812 
2813 typedef struct _MODE_PARAMETER_HEADER10 {
2814  UCHAR ModeDataLength[2];
2815  UCHAR MediumType;
2817  UCHAR Reserved[2];
2820 
2821 typedef struct _MODE_PARAMETER_BLOCK {
2823  UCHAR NumberOfBlocks[3];
2824  UCHAR Reserved;
2825  UCHAR BlockLength[3];
2827 
2828 typedef struct _MODE_DISCONNECT_PAGE {
2842 
2843 typedef struct _MODE_CACHING_PAGE {
2844  UCHAR PageCode:6;
2846  UCHAR PageSavable:1;
2847  UCHAR PageLength;
2851  UCHAR Reserved2:5;
2859 
2888 
2889 typedef struct _MODE_MRW_PAGE {
2890  UCHAR PageCode:6;
2893  UCHAR PageLength;
2894  UCHAR Reserved1;
2896  UCHAR Reserved2:7;
2897  UCHAR Reserved3[4];
2899 
2933 
2934 typedef struct _MODE_FORMAT_PAGE {
2955 
2974 
2975 typedef struct _MODE_READ_WRITE_RECOVERY_PAGE {
2976  UCHAR PageCode:6;
2977  UCHAR Reserved1:1;
2978  UCHAR PSBit:1;
2979  UCHAR PageLength;
2980  UCHAR DCRBit:1;
2981  UCHAR DTEBit:1;
2982  UCHAR PERBit:1;
2983  UCHAR EERBit:1;
2984  UCHAR RCBit:1;
2985  UCHAR TBBit:1;
2986  UCHAR ARRE:1;
2987  UCHAR AWRE:1;
2989  UCHAR Reserved4[4];
2991  UCHAR Reserved5[3];
2993 
2994 typedef struct _MODE_READ_RECOVERY_PAGE {
2995  UCHAR PageCode:6;
2996  UCHAR Reserved1:1;
2997  UCHAR PSBit:1;
2998  UCHAR PageLength;
2999  UCHAR DCRBit:1;
3000  UCHAR DTEBit:1;
3001  UCHAR PERBit:1;
3002  UCHAR Reserved2:1;
3003  UCHAR RCBit:1;
3004  UCHAR TBBit:1;
3005  UCHAR Reserved3:2;
3007  UCHAR Reserved4[4];
3009 
3010 typedef struct _MODE_INFO_EXCEPTIONS {
3015  _ANONYMOUS_UNION union {
3017  _ANONYMOUS_STRUCT struct {
3024  } DUMMYSTRUCTNAME;
3025  } DUMMYUNIONNAME;
3031 
3032 typedef struct _POWER_CONDITION_PAGE {
3044 
3045 typedef struct _CDDA_OUTPUT_PORT {
3050 
3051 typedef struct _CDAUDIO_CONTROL_PAGE {
3064 
3065 typedef struct _CDVD_FEATURE_SET_PAGE {
3082 
3096 
3097 typedef struct _CDVD_CAPABILITIES_PAGE {
3145  _ANONYMOUS_UNION union {
3148  } DUMMYUNIONNAME;
3151  _ANONYMOUS_UNION union {
3154  } DUMMYUNIONNAME2;
3162  _ANONYMOUS_UNION union {
3165  } DUMMYUNIONNAME3;
3166  _ANONYMOUS_UNION union {
3169  } DUMMYUNIONNAME4;
3170  _ANONYMOUS_UNION union {
3173  } DUMMYUNIONNAME5;
3175 
3176 typedef struct _LUN_LIST {
3179  UCHAR Lun[0][8];
3180 } LUN_LIST, *PLUN_LIST;
3181 
3182 typedef struct _MODE_PARM_READ_WRITE {
3186 
3187 typedef struct _PORT_OUTPUT {
3191 
3192 typedef struct _AUDIO_OUTPUT {
3201 
3202 /* Atapi 2.5 changers */
3204  UCHAR CurrentSlot:5;
3205  UCHAR ChangerState:2;
3206  UCHAR Fault:1;
3207  UCHAR Reserved:5;
3213 
3214 typedef struct _SLOT_TABLE_INFORMATION {
3215  UCHAR DiscChanged:1;
3216  UCHAR Reserved:6;
3217  UCHAR DiscPresent:1;
3218  UCHAR Reserved2[3];
3220 
3221 typedef struct _MECHANICAL_STATUS {
3225 
3226 /* Tape definitions */
3227 typedef struct _TAPE_POSITION_DATA {
3241 
3242 #include <pshpack1.h>
3243 typedef struct _UNMAP_BLOCK_DESCRIPTOR {
3248 
3249 typedef struct _UNMAP_LIST_HEADER {
3253 #if !defined(__midl)
3255 #endif
3257 #include <poppack.h>
3258 
3259 #define LOG_PAGE_CODE_SUPPORTED_LOG_PAGES 0x00
3260 #define LOG_PAGE_CODE_WRITE_ERROR_COUNTERS 0x02
3261 #define LOG_PAGE_CODE_READ_ERROR_COUNTERS 0x03
3262 #define LOG_PAGE_CODE_LOGICAL_BLOCK_PROVISIONING 0x0C
3263 #define LOG_PAGE_CODE_TEMPERATURE 0x0D
3264 #define LOG_PAGE_CODE_STARTSTOP_CYCLE_COUNTERS 0x0E
3265 #define LOG_PAGE_CODE_SELFTEST_RESULTS 0x10
3266 #define LOG_PAGE_CODE_SOLID_STATE_MEDIA 0x11
3267 #define LOG_PAGE_CODE_BACKGROUND_SCAN_RESULTS 0x15
3268 #define LOG_PAGE_CODE_INFORMATIONAL_EXCEPTIONS 0x2F
3269 
3270 
3271 #include <pshpack1.h>
3272 typedef struct _LOG_PARAMETER_HEADER {
3274  union {
3276  struct {