1c2c66affSColin Finck /*
2c2c66affSColin Finck * scsi.h
3c2c66affSColin Finck *
4c2c66affSColin Finck * SCSI port and class interface.
5c2c66affSColin Finck *
6c2c66affSColin Finck * This file is part of the w32api package.
7c2c66affSColin Finck *
8c2c66affSColin Finck * Contributors:
9c2c66affSColin Finck * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10c2c66affSColin Finck *
11c2c66affSColin Finck * THIS SOFTWARE IS NOT COPYRIGHTED
12c2c66affSColin Finck *
13c2c66affSColin Finck * This source code is offered for use in the public domain. You may
14c2c66affSColin Finck * use, modify or distribute it freely.
15c2c66affSColin Finck *
16c2c66affSColin Finck * This code is distributed in the hope that it will be useful but
17c2c66affSColin Finck * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18c2c66affSColin Finck * DISCLAIMED. This includes but is not limited to warranties of
19c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20c2c66affSColin Finck *
21c2c66affSColin Finck */
22c2c66affSColin Finck
23c2c66affSColin Finck #ifndef _NTSCSI_
24c2c66affSColin Finck #define _NTSCSI_
25c2c66affSColin Finck
26c2c66affSColin Finck #ifdef __cplusplus
27c2c66affSColin Finck extern "C" {
28c2c66affSColin Finck #endif
29c2c66affSColin Finck
30c2c66affSColin Finck #ifndef _NTSCSI_USER_MODE_
31c2c66affSColin Finck #include "srb.h"
32c2c66affSColin Finck #endif
33c2c66affSColin Finck
34c2c66affSColin Finck #define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_MASK 0x02
35c2c66affSColin Finck #define NOTIFICATION_POWER_MANAGEMENT_CLASS_MASK 0x04
36c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_REQUEST_CLASS_MASK 0x08
37c2c66affSColin Finck #define NOTIFICATION_MEDIA_STATUS_CLASS_MASK 0x10
38c2c66affSColin Finck #define NOTIFICATION_MULTI_HOST_CLASS_MASK 0x20
39c2c66affSColin Finck #define NOTIFICATION_DEVICE_BUSY_CLASS_MASK 0x40
40c2c66affSColin Finck
41c2c66affSColin Finck
42c2c66affSColin Finck #define NOTIFICATION_NO_CLASS_EVENTS 0x0
43c2c66affSColin Finck #define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_EVENTS 0x1
44c2c66affSColin Finck #define NOTIFICATION_POWER_MANAGEMENT_CLASS_EVENTS 0x2
45c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_REQUEST_CLASS_EVENTS 0x3
46c2c66affSColin Finck #define NOTIFICATION_MEDIA_STATUS_CLASS_EVENTS 0x4
47c2c66affSColin Finck #define NOTIFICATION_MULTI_HOST_CLASS_EVENTS 0x5
48c2c66affSColin Finck #define NOTIFICATION_DEVICE_BUSY_CLASS_EVENTS 0x6
49c2c66affSColin Finck
50c2c66affSColin Finck #define NOTIFICATION_OPERATIONAL_EVENT_NO_CHANGE 0x0
51c2c66affSColin Finck #define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_REQUESTED 0x1
52c2c66affSColin Finck #define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_OCCURRED 0x2
53c2c66affSColin Finck
54c2c66affSColin Finck #define NOTIFICATION_OPERATIONAL_STATUS_AVAILABLE 0x0
55c2c66affSColin Finck #define NOTIFICATION_OPERATIONAL_STATUS_TEMPORARY_BUSY 0x1
56c2c66affSColin Finck #define NOTIFICATION_OPERATIONAL_STATUS_EXTENDED_BUSY 0x2
57c2c66affSColin Finck
58c2c66affSColin Finck #define NOTIFICATION_OPERATIONAL_OPCODE_NONE 0x0
59c2c66affSColin Finck #define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_CHANGE 0x1
60c2c66affSColin Finck #define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_ADDED 0x2
61c2c66affSColin Finck #define NOTIFICATION_OPERATIONAL_OPCODE_UNIT_RESET 0x3
62c2c66affSColin Finck #define NOTIFICATION_OPERATIONAL_OPCODE_FIRMWARE_CHANGED 0x4
63c2c66affSColin Finck #define NOTIFICATION_OPERATIONAL_OPCODE_INQUIRY_CHANGED 0x5
64c2c66affSColin Finck
65c2c66affSColin Finck #define NOTIFICATION_POWER_EVENT_NO_CHANGE 0x0
66c2c66affSColin Finck #define NOTIFICATION_POWER_EVENT_CHANGE_SUCCEEDED 0x1
67c2c66affSColin Finck #define NOTIFICATION_POWER_EVENT_CHANGE_FAILED 0x2
68c2c66affSColin Finck
69c2c66affSColin Finck #define NOTIFICATION_POWER_STATUS_ACTIVE 0x1
70c2c66affSColin Finck #define NOTIFICATION_POWER_STATUS_IDLE 0x2
71c2c66affSColin Finck #define NOTIFICATION_POWER_STATUS_STANDBY 0x3
72c2c66affSColin Finck #define NOTIFICATION_POWER_STATUS_SLEEP 0x4
73c2c66affSColin Finck
74c2c66affSColin Finck #define NOTIFICATION_MEDIA_EVENT_NO_EVENT 0x0
75c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_EVENT_NO_CHANGE 0x0
76c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_EVENT_BUTTON_DOWN 0x1
77c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_EVENT_BUTTON_UP 0x2
78c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_EVENT_EXTERNAL 0x3
79c2c66affSColin Finck
80c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_STATUS_READY 0x0
81c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_STATUS_PREVENT 0x1
82c2c66affSColin Finck
83c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_REQUEST_NONE 0x0000
84c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_REQUEST_QUEUE_OVERRUN 0x0001
85c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_REQUEST_PLAY 0x0101
86c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_REQUEST_REWIND_BACK 0x0102
87c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_REQUEST_FAST_FORWARD 0x0103
88c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_REQUEST_PAUSE 0x0104
89c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_REQUEST_STOP 0x0106
90c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_REQUEST_ASCII_LOW 0x0200
91c2c66affSColin Finck #define NOTIFICATION_EXTERNAL_REQUEST_ASCII_HIGH 0x02ff
92c2c66affSColin Finck
93c2c66affSColin Finck #define NOTIFICATION_MEDIA_EVENT_NO_CHANGE 0x0
94c2c66affSColin Finck #define NOTIFICATION_MEDIA_EVENT_EJECT_REQUEST 0x1
95c2c66affSColin Finck #define NOTIFICATION_MEDIA_EVENT_NEW_MEDIA 0x2
96c2c66affSColin Finck #define NOTIFICATION_MEDIA_EVENT_MEDIA_REMOVAL 0x3
97c2c66affSColin Finck #define NOTIFICATION_MEDIA_EVENT_MEDIA_CHANGE 0x4
98c2c66affSColin Finck
99c2c66affSColin Finck #define NOTIFICATION_BUSY_EVENT_NO_EVENT 0x0
100c2c66affSColin Finck #define NOTIFICATION_MULTI_HOST_EVENT_NO_CHANGE 0x0
101c2c66affSColin Finck #define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_REQUEST 0x1
102c2c66affSColin Finck #define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_GRANT 0x2
103c2c66affSColin Finck #define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_RELEASE 0x3
104c2c66affSColin Finck
105c2c66affSColin Finck #define NOTIFICATION_MULTI_HOST_STATUS_READY 0x0
106c2c66affSColin Finck #define NOTIFICATION_MULTI_HOST_STATUS_PREVENT 0x1
107c2c66affSColin Finck
108c2c66affSColin Finck #define NOTIFICATION_MULTI_HOST_PRIORITY_NO_REQUESTS 0x0
109c2c66affSColin Finck #define NOTIFICATION_MULTI_HOST_PRIORITY_LOW 0x1
110c2c66affSColin Finck #define NOTIFICATION_MULTI_HOST_PRIORITY_MEDIUM 0x2
111c2c66affSColin Finck #define NOTIFICATION_MULTI_HOST_PRIORITY_HIGH 0x3
112c2c66affSColin Finck
113c2c66affSColin Finck #define NOTIFICATION_BUSY_EVENT_NO_EVENT 0x0
114c2c66affSColin Finck #define NOTIFICATION_BUSY_EVENT_NO_CHANGE 0x0
115c2c66affSColin Finck #define NOTIFICATION_BUSY_EVENT_BUSY 0x1
116*d7d716a6SVictor Perevertkin #define NOTIFICATION_BUSY_EVENT_LO_CHANGE 0x2
117c2c66affSColin Finck
118c2c66affSColin Finck #define NOTIFICATION_BUSY_STATUS_NO_EVENT 0x0
119c2c66affSColin Finck #define NOTIFICATION_BUSY_STATUS_POWER 0x1
120c2c66affSColin Finck #define NOTIFICATION_BUSY_STATUS_IMMEDIATE 0x2
121c2c66affSColin Finck #define NOTIFICATION_BUSY_STATUS_DEFERRED 0x3
122c2c66affSColin Finck
123c2c66affSColin Finck #define DVD_FORMAT_LEAD_IN 0x00
124c2c66affSColin Finck #define DVD_FORMAT_COPYRIGHT 0x01
125c2c66affSColin Finck #define DVD_FORMAT_DISK_KEY 0x02
126c2c66affSColin Finck #define DVD_FORMAT_BCA 0x03
127c2c66affSColin Finck #define DVD_FORMAT_MANUFACTURING 0x04
128c2c66affSColin Finck
129c2c66affSColin Finck #define DVD_REPORT_AGID 0x00
130c2c66affSColin Finck #define DVD_CHALLENGE_KEY 0x01
131c2c66affSColin Finck #define DVD_KEY_1 0x02
132c2c66affSColin Finck #define DVD_KEY_2 0x03
133c2c66affSColin Finck #define DVD_TITLE_KEY 0x04
134c2c66affSColin Finck #define DVD_REPORT_ASF 0x05
135c2c66affSColin Finck #define DVD_INVALIDATE_AGID 0x3F
136c2c66affSColin Finck
137c2c66affSColin Finck #define BLANK_FULL 0x0
138c2c66affSColin Finck #define BLANK_MINIMAL 0x1
139c2c66affSColin Finck #define BLANK_TRACK 0x2
140c2c66affSColin Finck #define BLANK_UNRESERVE_TRACK 0x3
141c2c66affSColin Finck #define BLANK_TAIL 0x4
142c2c66affSColin Finck #define BLANK_UNCLOSE_SESSION 0x5
143c2c66affSColin Finck #define BLANK_SESSION 0x6
144c2c66affSColin Finck
145c2c66affSColin Finck #define CD_EXPECTED_SECTOR_ANY 0x0
146c2c66affSColin Finck #define CD_EXPECTED_SECTOR_CDDA 0x1
147c2c66affSColin Finck #define CD_EXPECTED_SECTOR_MODE1 0x2
148c2c66affSColin Finck #define CD_EXPECTED_SECTOR_MODE2 0x3
149c2c66affSColin Finck #define CD_EXPECTED_SECTOR_MODE2_FORM1 0x4
150c2c66affSColin Finck #define CD_EXPECTED_SECTOR_MODE2_FORM2 0x5
151c2c66affSColin Finck
152c2c66affSColin Finck #define DISK_STATUS_EMPTY 0x00
153c2c66affSColin Finck #define DISK_STATUS_INCOMPLETE 0x01
154c2c66affSColin Finck #define DISK_STATUS_COMPLETE 0x02
155c2c66affSColin Finck #define DISK_STATUS_OTHERS 0x03
156c2c66affSColin Finck
157c2c66affSColin Finck #define LAST_SESSION_EMPTY 0x00
158c2c66affSColin Finck #define LAST_SESSION_INCOMPLETE 0x01
159c2c66affSColin Finck #define LAST_SESSION_RESERVED_DAMAGED 0x02
160c2c66affSColin Finck #define LAST_SESSION_COMPLETE 0x03
161c2c66affSColin Finck
162c2c66affSColin Finck #define DISK_TYPE_CDDA 0x00
163c2c66affSColin Finck #define DISK_TYPE_CDI 0x10
164c2c66affSColin Finck #define DISK_TYPE_XA 0x20
165c2c66affSColin Finck #define DISK_TYPE_UNDEFINED 0xFF
166c2c66affSColin Finck
167c2c66affSColin Finck #define DISC_BGFORMAT_STATE_NONE 0x0
168c2c66affSColin Finck #define DISC_BGFORMAT_STATE_INCOMPLETE 0x1
169c2c66affSColin Finck #define DISC_BGFORMAT_STATE_RUNNING 0x2
170c2c66affSColin Finck #define DISC_BGFORMAT_STATE_COMPLETE 0x3
171c2c66affSColin Finck
172c2c66affSColin Finck #define DATA_BLOCK_MODE0 0x0
173c2c66affSColin Finck #define DATA_BLOCK_MODE1 0x1
174c2c66affSColin Finck #define DATA_BLOCK_MODE2 0x2
175c2c66affSColin Finck
176c2c66affSColin Finck /* READ_TOC formats */
177c2c66affSColin Finck #define READ_TOC_FORMAT_TOC 0x00
178c2c66affSColin Finck #define READ_TOC_FORMAT_SESSION 0x01
179c2c66affSColin Finck #define READ_TOC_FORMAT_FULL_TOC 0x02
180c2c66affSColin Finck #define READ_TOC_FORMAT_PMA 0x03
181c2c66affSColin Finck #define READ_TOC_FORMAT_ATIP 0x04
182c2c66affSColin Finck
183c2c66affSColin Finck #define CDB6GENERIC_LENGTH 6
184c2c66affSColin Finck #define CDB10GENERIC_LENGTH 10
185c2c66affSColin Finck #define CDB12GENERIC_LENGTH 12
186c2c66affSColin Finck
187c2c66affSColin Finck #define SETBITON 1
188c2c66affSColin Finck #define SETBITOFF 0
189c2c66affSColin Finck
190c2c66affSColin Finck /* Mode Sense/Select page constants */
191c2c66affSColin Finck #define MODE_PAGE_VENDOR_SPECIFIC 0x00
192c2c66affSColin Finck #define MODE_PAGE_ERROR_RECOVERY 0x01
193c2c66affSColin Finck #define MODE_PAGE_DISCONNECT 0x02
194c2c66affSColin Finck #define MODE_PAGE_FORMAT_DEVICE 0x03
195c2c66affSColin Finck #define MODE_PAGE_MRW 0x03
196c2c66affSColin Finck #define MODE_PAGE_RIGID_GEOMETRY 0x04
197c2c66affSColin Finck #define MODE_PAGE_FLEXIBILE 0x05
198c2c66affSColin Finck #define MODE_PAGE_WRITE_PARAMETERS 0x05
199c2c66affSColin Finck #define MODE_PAGE_VERIFY_ERROR 0x07
200c2c66affSColin Finck #define MODE_PAGE_CACHING 0x08
201c2c66affSColin Finck #define MODE_PAGE_PERIPHERAL 0x09
202c2c66affSColin Finck #define MODE_PAGE_CONTROL 0x0A
203c2c66affSColin Finck #define MODE_PAGE_MEDIUM_TYPES 0x0B
204c2c66affSColin Finck #define MODE_PAGE_NOTCH_PARTITION 0x0C
205c2c66affSColin Finck #define MODE_PAGE_CD_AUDIO_CONTROL 0x0E
206c2c66affSColin Finck #define MODE_PAGE_DATA_COMPRESS 0x0F
207c2c66affSColin Finck #define MODE_PAGE_DEVICE_CONFIG 0x10
208c2c66affSColin Finck #define MODE_PAGE_XOR_CONTROL 0x10
209c2c66affSColin Finck #define MODE_PAGE_MEDIUM_PARTITION 0x11
210c2c66affSColin Finck #define MODE_PAGE_ENCLOSURE_SERVICES_MANAGEMENT 0x14
211c2c66affSColin Finck #define MODE_PAGE_EXTENDED 0x15
212c2c66affSColin Finck #define MODE_PAGE_EXTENDED_DEVICE_SPECIFIC 0x16
213c2c66affSColin Finck #define MODE_PAGE_CDVD_FEATURE_SET 0x18
214c2c66affSColin Finck #define MODE_PAGE_PROTOCOL_SPECIFIC_LUN 0x18
215c2c66affSColin Finck #define MODE_PAGE_PROTOCOL_SPECIFIC_PORT 0x19
216c2c66affSColin Finck #define MODE_PAGE_POWER_CONDITION 0x1A
217c2c66affSColin Finck #define MODE_PAGE_LUN_MAPPING 0x1B
218c2c66affSColin Finck #define MODE_PAGE_FAULT_REPORTING 0x1C
219c2c66affSColin Finck #define MODE_PAGE_CDVD_INACTIVITY 0x1D
220c2c66affSColin Finck #define MODE_PAGE_ELEMENT_ADDRESS 0x1D
221c2c66affSColin Finck #define MODE_PAGE_TRANSPORT_GEOMETRY 0x1E
222c2c66affSColin Finck #define MODE_PAGE_DEVICE_CAPABILITIES 0x1F
223c2c66affSColin Finck #define MODE_PAGE_CAPABILITIES 0x2A
224c2c66affSColin Finck
225c2c66affSColin Finck #define MODE_SENSE_RETURN_ALL 0x3f
226c2c66affSColin Finck
227c2c66affSColin Finck #define MODE_SENSE_CURRENT_VALUES 0x00
228c2c66affSColin Finck #define MODE_SENSE_CHANGEABLE_VALUES 0x40
229c2c66affSColin Finck #define MODE_SENSE_DEFAULT_VAULES 0x80
230c2c66affSColin Finck #define MODE_SENSE_SAVED_VALUES 0xc0
231c2c66affSColin Finck
232c2c66affSColin Finck /* SCSI CDB operation codes */
233c2c66affSColin Finck #define SCSIOP_TEST_UNIT_READY 0x00
234c2c66affSColin Finck #define SCSIOP_REZERO_UNIT 0x01
235c2c66affSColin Finck #define SCSIOP_REWIND 0x01
236c2c66affSColin Finck #define SCSIOP_REQUEST_BLOCK_ADDR 0x02
237c2c66affSColin Finck #define SCSIOP_REQUEST_SENSE 0x03
238c2c66affSColin Finck #define SCSIOP_FORMAT_UNIT 0x04
239c2c66affSColin Finck #define SCSIOP_READ_BLOCK_LIMITS 0x05
240c2c66affSColin Finck #define SCSIOP_REASSIGN_BLOCKS 0x07
241c2c66affSColin Finck #define SCSIOP_INIT_ELEMENT_STATUS 0x07
242c2c66affSColin Finck #define SCSIOP_READ6 0x08
243c2c66affSColin Finck #define SCSIOP_RECEIVE 0x08
244c2c66affSColin Finck #define SCSIOP_WRITE6 0x0A
245c2c66affSColin Finck #define SCSIOP_PRINT 0x0A
246c2c66affSColin Finck #define SCSIOP_SEND 0x0A
247c2c66affSColin Finck #define SCSIOP_SEEK6 0x0B
248c2c66affSColin Finck #define SCSIOP_TRACK_SELECT 0x0B
249c2c66affSColin Finck #define SCSIOP_SLEW_PRINT 0x0B
250c2c66affSColin Finck #define SCSIOP_SET_CAPACITY 0x0B
251c2c66affSColin Finck #define SCSIOP_SEEK_BLOCK 0x0C
252c2c66affSColin Finck #define SCSIOP_PARTITION 0x0D
253c2c66affSColin Finck #define SCSIOP_READ_REVERSE 0x0F
254c2c66affSColin Finck #define SCSIOP_WRITE_FILEMARKS 0x10
255c2c66affSColin Finck #define SCSIOP_FLUSH_BUFFER 0x10
256c2c66affSColin Finck #define SCSIOP_SPACE 0x11
257c2c66affSColin Finck #define SCSIOP_INQUIRY 0x12
258c2c66affSColin Finck #define SCSIOP_VERIFY6 0x13
259c2c66affSColin Finck #define SCSIOP_RECOVER_BUF_DATA 0x14
260c2c66affSColin Finck #define SCSIOP_MODE_SELECT 0x15
261c2c66affSColin Finck #define SCSIOP_RESERVE_UNIT 0x16
262c2c66affSColin Finck #define SCSIOP_RELEASE_UNIT 0x17
263c2c66affSColin Finck #define SCSIOP_COPY 0x18
264c2c66affSColin Finck #define SCSIOP_ERASE 0x19
265c2c66affSColin Finck #define SCSIOP_MODE_SENSE 0x1A
266c2c66affSColin Finck #define SCSIOP_START_STOP_UNIT 0x1B
267c2c66affSColin Finck #define SCSIOP_STOP_PRINT 0x1B
268c2c66affSColin Finck #define SCSIOP_LOAD_UNLOAD 0x1B
269c2c66affSColin Finck #define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C
270c2c66affSColin Finck #define SCSIOP_SEND_DIAGNOSTIC 0x1D
271c2c66affSColin Finck #define SCSIOP_MEDIUM_REMOVAL 0x1E
272c2c66affSColin Finck
273c2c66affSColin Finck #define SCSIOP_READ_FORMATTED_CAPACITY 0x23
274c2c66affSColin Finck #define SCSIOP_READ_CAPACITY 0x25
275c2c66affSColin Finck #define SCSIOP_READ 0x28
276c2c66affSColin Finck #define SCSIOP_WRITE 0x2A
277c2c66affSColin Finck #define SCSIOP_SEEK 0x2B
278c2c66affSColin Finck #define SCSIOP_LOCATE 0x2B
279c2c66affSColin Finck #define SCSIOP_POSITION_TO_ELEMENT 0x2B
280c2c66affSColin Finck #define SCSIOP_WRITE_VERIFY 0x2E
281c2c66affSColin Finck #define SCSIOP_VERIFY 0x2F
282c2c66affSColin Finck #define SCSIOP_SEARCH_DATA_HIGH 0x30
283c2c66affSColin Finck #define SCSIOP_SEARCH_DATA_EQUAL 0x31
284c2c66affSColin Finck #define SCSIOP_SEARCH_DATA_LOW 0x32
285c2c66affSColin Finck #define SCSIOP_SET_LIMITS 0x33
286c2c66affSColin Finck #define SCSIOP_READ_POSITION 0x34
287c2c66affSColin Finck #define SCSIOP_SYNCHRONIZE_CACHE 0x35
288c2c66affSColin Finck #define SCSIOP_COMPARE 0x39
289c2c66affSColin Finck #define SCSIOP_COPY_COMPARE 0x3A
290c2c66affSColin Finck #define SCSIOP_WRITE_DATA_BUFF 0x3B
291c2c66affSColin Finck #define SCSIOP_READ_DATA_BUFF 0x3C
292c2c66affSColin Finck #define SCSIOP_WRITE_LONG 0x3F
293c2c66affSColin Finck #define SCSIOP_CHANGE_DEFINITION 0x40
294c2c66affSColin Finck #define SCSIOP_WRITE_SAME 0x41
295c2c66affSColin Finck #define SCSIOP_READ_SUB_CHANNEL 0x42
2963da77f91SVictor Perevertkin #define SCSIOP_UNMAP 0x42
297c2c66affSColin Finck #define SCSIOP_READ_TOC 0x43
298c2c66affSColin Finck #define SCSIOP_READ_HEADER 0x44
299c2c66affSColin Finck #define SCSIOP_REPORT_DENSITY_SUPPORT 0x44
300c2c66affSColin Finck #define SCSIOP_PLAY_AUDIO 0x45
301c2c66affSColin Finck #define SCSIOP_GET_CONFIGURATION 0x46
302c2c66affSColin Finck #define SCSIOP_PLAY_AUDIO_MSF 0x47
303c2c66affSColin Finck #define SCSIOP_PLAY_TRACK_INDEX 0x48
3043da77f91SVictor Perevertkin #define SCSIOP_SANITIZE 0x48
305c2c66affSColin Finck #define SCSIOP_PLAY_TRACK_RELATIVE 0x49
306c2c66affSColin Finck #define SCSIOP_GET_EVENT_STATUS 0x4A
307c2c66affSColin Finck #define SCSIOP_PAUSE_RESUME 0x4B
308c2c66affSColin Finck #define SCSIOP_LOG_SELECT 0x4C
309c2c66affSColin Finck #define SCSIOP_LOG_SENSE 0x4D
310c2c66affSColin Finck #define SCSIOP_STOP_PLAY_SCAN 0x4E
311c2c66affSColin Finck #define SCSIOP_XDWRITE 0x50
312c2c66affSColin Finck #define SCSIOP_XPWRITE 0x51
313c2c66affSColin Finck #define SCSIOP_READ_DISK_INFORMATION 0x51
314c2c66affSColin Finck #define SCSIOP_READ_DISC_INFORMATION 0x51
315c2c66affSColin Finck #define SCSIOP_READ_TRACK_INFORMATION 0x52
316c2c66affSColin Finck #define SCSIOP_XDWRITE_READ 0x53
317c2c66affSColin Finck #define SCSIOP_RESERVE_TRACK_RZONE 0x53
318c2c66affSColin Finck #define SCSIOP_SEND_OPC_INFORMATION 0x54
319c2c66affSColin Finck #define SCSIOP_MODE_SELECT10 0x55
320c2c66affSColin Finck #define SCSIOP_RESERVE_UNIT10 0x56
321c2c66affSColin Finck #define SCSIOP_RESERVE_ELEMENT 0x56
322c2c66affSColin Finck #define SCSIOP_RELEASE_UNIT10 0x57
323c2c66affSColin Finck #define SCSIOP_RELEASE_ELEMENT 0x57
324c2c66affSColin Finck #define SCSIOP_REPAIR_TRACK 0x58
325c2c66affSColin Finck #define SCSIOP_MODE_SENSE10 0x5A
326c2c66affSColin Finck #define SCSIOP_CLOSE_TRACK_SESSION 0x5B
327c2c66affSColin Finck #define SCSIOP_READ_BUFFER_CAPACITY 0x5C
328c2c66affSColin Finck #define SCSIOP_SEND_CUE_SHEET 0x5D
329c2c66affSColin Finck #define SCSIOP_PERSISTENT_RESERVE_IN 0x5E
330c2c66affSColin Finck #define SCSIOP_PERSISTENT_RESERVE_OUT 0x5F
331c2c66affSColin Finck
3323da77f91SVictor Perevertkin #define SCSIOP_OPERATION32 0x7F
3333da77f91SVictor Perevertkin
3343da77f91SVictor Perevertkin #define SCSIOP_XDWRITE_EXTENDED16 0x80
3353da77f91SVictor Perevertkin #define SCSIOP_WRITE_FILEMARKS16 0x80
3363da77f91SVictor Perevertkin #define SCSIOP_REBUILD16 0x81
3373da77f91SVictor Perevertkin #define SCSIOP_READ_REVERSE16 0x81
3383da77f91SVictor Perevertkin #define SCSIOP_REGENERATE16 0x82
3393da77f91SVictor Perevertkin #define SCSIOP_EXTENDED_COPY 0x83
3403da77f91SVictor Perevertkin #define SCSIOP_POPULATE_TOKEN 0x83
3413da77f91SVictor Perevertkin #define SCSIOP_WRITE_USING_TOKEN 0x83
3423da77f91SVictor Perevertkin #define SCSIOP_RECEIVE_COPY_RESULTS 0x84
3433da77f91SVictor Perevertkin #define SCSIOP_RECEIVE_ROD_TOKEN_INFORMATION 0x84
3443da77f91SVictor Perevertkin #define SCSIOP_ATA_PASSTHROUGH16 0x85
3453da77f91SVictor Perevertkin #define SCSIOP_ACCESS_CONTROL_IN 0x86
3463da77f91SVictor Perevertkin #define SCSIOP_ACCESS_CONTROL_OUT 0x87
3473da77f91SVictor Perevertkin #define SCSIOP_READ16 0x88
3483da77f91SVictor Perevertkin #define SCSIOP_COMPARE_AND_WRITE 0x89
3493da77f91SVictor Perevertkin #define SCSIOP_WRITE16 0x8A
3503da77f91SVictor Perevertkin #define SCSIOP_READ_ATTRIBUTES 0x8C
3513da77f91SVictor Perevertkin #define SCSIOP_WRITE_ATTRIBUTES 0x8D
3523da77f91SVictor Perevertkin #define SCSIOP_WRITE_VERIFY16 0x8E
3533da77f91SVictor Perevertkin #define SCSIOP_VERIFY16 0x8F
3543da77f91SVictor Perevertkin #define SCSIOP_PREFETCH16 0x90
3553da77f91SVictor Perevertkin #define SCSIOP_SYNCHRONIZE_CACHE16 0x91
3563da77f91SVictor Perevertkin #define SCSIOP_SPACE16 0x91
3573da77f91SVictor Perevertkin #define SCSIOP_LOCK_UNLOCK_CACHE16 0x92
3583da77f91SVictor Perevertkin #define SCSIOP_LOCATE16 0x92
3593da77f91SVictor Perevertkin #define SCSIOP_WRITE_SAME16 0x93
3603da77f91SVictor Perevertkin #define SCSIOP_ERASE16 0x93
3613da77f91SVictor Perevertkin #define SCSIOP_ZBC_OUT 0x94
3623da77f91SVictor Perevertkin #define SCSIOP_ZBC_IN 0x95
3633da77f91SVictor Perevertkin #define SCSIOP_READ_DATA_BUFF16 0x9B
3643da77f91SVictor Perevertkin #define SCSIOP_READ_CAPACITY16 0x9E
3653da77f91SVictor Perevertkin #define SCSIOP_GET_LBA_STATUS 0x9E
3663da77f91SVictor Perevertkin #define SCSIOP_GET_PHYSICAL_ELEMENT_STATUS 0x9E
3673da77f91SVictor Perevertkin #define SCSIOP_REMOVE_ELEMENT_AND_TRUNCATE 0x9E
3683da77f91SVictor Perevertkin #define SCSIOP_SERVICE_ACTION_IN16 0x9E
3693da77f91SVictor Perevertkin #define SCSIOP_SERVICE_ACTION_OUT16 0x9F
3703da77f91SVictor Perevertkin
371c2c66affSColin Finck #define SCSIOP_REPORT_LUNS 0xA0
372c2c66affSColin Finck #define SCSIOP_BLANK 0xA1
373c2c66affSColin Finck #define SCSIOP_ATA_PASSTHROUGH12 0xA1
374c2c66affSColin Finck #define SCSIOP_SEND_EVENT 0xA2
3753da77f91SVictor Perevertkin #define SCSIOP_SECURITY_PROTOCOL_IN 0xA2
376c2c66affSColin Finck #define SCSIOP_SEND_KEY 0xA3
377c2c66affSColin Finck #define SCSIOP_MAINTENANCE_IN 0xA3
378c2c66affSColin Finck #define SCSIOP_REPORT_KEY 0xA4
379c2c66affSColin Finck #define SCSIOP_MAINTENANCE_OUT 0xA4
380c2c66affSColin Finck #define SCSIOP_MOVE_MEDIUM 0xA5
381c2c66affSColin Finck #define SCSIOP_LOAD_UNLOAD_SLOT 0xA6
382c2c66affSColin Finck #define SCSIOP_EXCHANGE_MEDIUM 0xA6
383c2c66affSColin Finck #define SCSIOP_SET_READ_AHEAD 0xA7
384c2c66affSColin Finck #define SCSIOP_MOVE_MEDIUM_ATTACHED 0xA7
385c2c66affSColin Finck #define SCSIOP_READ12 0xA8
386c2c66affSColin Finck #define SCSIOP_GET_MESSAGE 0xA8
387c2c66affSColin Finck #define SCSIOP_SERVICE_ACTION_OUT12 0xA9
388c2c66affSColin Finck #define SCSIOP_WRITE12 0xAA
389c2c66affSColin Finck #define SCSIOP_SEND_MESSAGE 0xAB
390c2c66affSColin Finck #define SCSIOP_SERVICE_ACTION_IN12 0xAB
391c2c66affSColin Finck #define SCSIOP_GET_PERFORMANCE 0xAC
392c2c66affSColin Finck #define SCSIOP_READ_DVD_STRUCTURE 0xAD
393c2c66affSColin Finck #define SCSIOP_WRITE_VERIFY12 0xAE
394c2c66affSColin Finck #define SCSIOP_VERIFY12 0xAF
395c2c66affSColin Finck #define SCSIOP_SEARCH_DATA_HIGH12 0xB0
396c2c66affSColin Finck #define SCSIOP_SEARCH_DATA_EQUAL12 0xB1
397c2c66affSColin Finck #define SCSIOP_SEARCH_DATA_LOW12 0xB2
398c2c66affSColin Finck #define SCSIOP_SET_LIMITS12 0xB3
399c2c66affSColin Finck #define SCSIOP_READ_ELEMENT_STATUS_ATTACHED 0xB4
400c2c66affSColin Finck #define SCSIOP_REQUEST_VOL_ELEMENT 0xB5
4013da77f91SVictor Perevertkin #define SCSIOP_SECURITY_PROTOCOL_OUT 0xB5
402c2c66affSColin Finck #define SCSIOP_SEND_VOLUME_TAG 0xB6
403c2c66affSColin Finck #define SCSIOP_SET_STREAMING 0xB6
404c2c66affSColin Finck #define SCSIOP_READ_DEFECT_DATA 0xB7
405c2c66affSColin Finck #define SCSIOP_READ_ELEMENT_STATUS 0xB8
406c2c66affSColin Finck #define SCSIOP_READ_CD_MSF 0xB9
407c2c66affSColin Finck #define SCSIOP_SCAN_CD 0xBA
408c2c66affSColin Finck #define SCSIOP_REDUNDANCY_GROUP_IN 0xBA
409c2c66affSColin Finck #define SCSIOP_SET_CD_SPEED 0xBB
410c2c66affSColin Finck #define SCSIOP_REDUNDANCY_GROUP_OUT 0xBB
411c2c66affSColin Finck #define SCSIOP_PLAY_CD 0xBC
412c2c66affSColin Finck #define SCSIOP_SPARE_IN 0xBC
413c2c66affSColin Finck #define SCSIOP_MECHANISM_STATUS 0xBD
414c2c66affSColin Finck #define SCSIOP_SPARE_OUT 0xBD
415c2c66affSColin Finck #define SCSIOP_READ_CD 0xBE
416c2c66affSColin Finck #define SCSIOP_VOLUME_SET_IN 0xBE
417c2c66affSColin Finck #define SCSIOP_SEND_DVD_STRUCTURE 0xBF
418c2c66affSColin Finck #define SCSIOP_VOLUME_SET_OUT 0xBF
419c2c66affSColin Finck #define SCSIOP_INIT_ELEMENT_RANGE 0xE7
420c2c66affSColin Finck
4213da77f91SVictor Perevertkin // SCSI operation parameters
4223da77f91SVictor Perevertkin
4233da77f91SVictor Perevertkin // SCSIOP_SANITIZE (0x48)
4243da77f91SVictor Perevertkin
4253da77f91SVictor Perevertkin #define SERVICE_ACTION_OVERWRITE 0x01
4263da77f91SVictor Perevertkin #define SERVICE_ACTION_BLOCK_ERASE 0x02
4273da77f91SVictor Perevertkin #define SERVICE_ACTION_CRYPTO_ERASE 0x03
4283da77f91SVictor Perevertkin #define SERVICE_ACTION_EXIT_FAILURE 0x1f
4293da77f91SVictor Perevertkin
4303da77f91SVictor Perevertkin // SCSIOP_OPERATION32 (0x7F)
4313da77f91SVictor Perevertkin
4323da77f91SVictor Perevertkin #define SERVICE_ACTION_XDWRITE 0x0004
4333da77f91SVictor Perevertkin #define SERVICE_ACTION_XPWRITE 0x0006
4343da77f91SVictor Perevertkin #define SERVICE_ACTION_XDWRITEREAD 0x0007
4353da77f91SVictor Perevertkin #define SERVICE_ACTION_WRITE 0x000B
4363da77f91SVictor Perevertkin #define SERVICE_ACTION_WRITE_VERIFY 0x000C
4373da77f91SVictor Perevertkin #define SERVICE_ACTION_WRITE_SAME 0x000D
4383da77f91SVictor Perevertkin #define SERVICE_ACTION_ORWRITE 0x000E
4393da77f91SVictor Perevertkin
4403da77f91SVictor Perevertkin // SCSIOP_POPULATE_TOKEN, SCSIOP_WRITE_USING_TOKEN (0x83)
4413da77f91SVictor Perevertkin
4423da77f91SVictor Perevertkin #define SERVICE_ACTION_POPULATE_TOKEN 0x10
4433da77f91SVictor Perevertkin #define SERVICE_ACTION_WRITE_USING_TOKEN 0x11
4443da77f91SVictor Perevertkin
4453da77f91SVictor Perevertkin // SCSIOP_RECEIVE_ROD_TOKEN_INFORMATION (0x84)
4463da77f91SVictor Perevertkin
4473da77f91SVictor Perevertkin #define SERVICE_ACTION_RECEIVE_TOKEN_INFORMATION 0x07
4483da77f91SVictor Perevertkin
4493da77f91SVictor Perevertkin // SCSIOP_ZBC_OUT (0x94)
4503da77f91SVictor Perevertkin
4513da77f91SVictor Perevertkin #define SERVICE_ACTION_CLOSE_ZONE 0x01
4523da77f91SVictor Perevertkin #define SERVICE_ACTION_FINISH_ZONE 0x02
4533da77f91SVictor Perevertkin #define SERVICE_ACTION_OPEN_ZONE 0x03
4543da77f91SVictor Perevertkin #define SERVICE_ACTION_RESET_WRITE_POINTER 0x04
4553da77f91SVictor Perevertkin
4563da77f91SVictor Perevertkin // SCSIOP_ZBC_IN (0x95)
4573da77f91SVictor Perevertkin
4583da77f91SVictor Perevertkin #define SERVICE_ACTION_REPORT_ZONES 0x00
4593da77f91SVictor Perevertkin
4603da77f91SVictor Perevertkin #define REPORT_ZONES_OPTION_LIST_ALL_ZONES 0x00
4613da77f91SVictor Perevertkin #define REPORT_ZONES_OPTION_LIST_EMPTY_ZONES 0x01
4623da77f91SVictor Perevertkin #define REPORT_ZONES_OPTION_LIST_IMPLICITLY_OPENED_ZONES 0x02
4633da77f91SVictor Perevertkin #define REPORT_ZONES_OPTION_LIST_EXPLICITLY_OPENED_ZONES 0x03
4643da77f91SVictor Perevertkin #define REPORT_ZONES_OPTION_LIST_CLOSED_ZONES 0x04
4653da77f91SVictor Perevertkin #define REPORT_ZONES_OPTION_LIST_FULL_ZONES 0x05
4663da77f91SVictor Perevertkin #define REPORT_ZONES_OPTION_LIST_READ_ONLY_ZONES 0x06
4673da77f91SVictor Perevertkin #define REPORT_ZONES_OPTION_LIST_OFFLINE_ZONES 0x07
4683da77f91SVictor Perevertkin #define REPORT_ZONES_OPTION_LIST_RWP_ZONES 0x10
4693da77f91SVictor Perevertkin #define REPORT_ZONES_OPTION_LIST_NON_SEQUENTIAL_WRITE_RESOURCES_ACTIVE_ZONES 0x11
4703da77f91SVictor Perevertkin #define REPORT_ZONES_OPTION_LIST_NOT_WRITE_POINTER_ZONES 0x3F
4713da77f91SVictor Perevertkin
4723da77f91SVictor Perevertkin // SCSIOP_SERVICE_ACTION_IN16 (0x9E)
4733da77f91SVictor Perevertkin
4743da77f91SVictor Perevertkin #define SERVICE_ACTION_READ_CAPACITY16 0x10
4753da77f91SVictor Perevertkin #define SERVICE_ACTION_GET_LBA_STATUS 0x12
4763da77f91SVictor Perevertkin #define SERVICE_ACTION_GET_PHYSICAL_ELEMENT_STATUS 0x17
4773da77f91SVictor Perevertkin #define SERVICE_ACTION_REMOVE_ELEMENT_AND_TRUNCATE 0x18
4783da77f91SVictor Perevertkin
4793da77f91SVictor Perevertkin // SCSIOP_MAINTENANCE_IN (0xA3)
4803da77f91SVictor Perevertkin
4813da77f91SVictor Perevertkin #define SERVICE_ACTION_REPORT_TIMESTAMP 0x0F
4823da77f91SVictor Perevertkin
4833da77f91SVictor Perevertkin // SCSIOP_MAINTENANCE_OUT (0xA4)
4843da77f91SVictor Perevertkin
4853da77f91SVictor Perevertkin #define SERVICE_ACTION_SET_TIMESTAMP 0x0F
486c2c66affSColin Finck
487c2c66affSColin Finck #define CDB_RETURN_ON_COMPLETION 0
488c2c66affSColin Finck #define CDB_RETURN_IMMEDIATE 1
489c2c66affSColin Finck
490c2c66affSColin Finck #define CDB_FORCE_MEDIA_ACCESS 0x08
491c2c66affSColin Finck
492c2c66affSColin Finck #define SCSIOP_DENON_EJECT_DISC 0xE6
493c2c66affSColin Finck #define SCSIOP_DENON_STOP_AUDIO 0xE7
494c2c66affSColin Finck #define SCSIOP_DENON_PLAY_AUDIO 0xE8
495c2c66affSColin Finck #define SCSIOP_DENON_READ_TOC 0xE9
496c2c66affSColin Finck #define SCSIOP_DENON_READ_SUBCODE 0xEB
497c2c66affSColin Finck
498c2c66affSColin Finck #define SCSIMESS_ABORT 0x06
499c2c66affSColin Finck #define SCSIMESS_ABORT_WITH_TAG 0x0D
500c2c66affSColin Finck #define SCSIMESS_BUS_DEVICE_RESET 0X0C
501c2c66affSColin Finck #define SCSIMESS_CLEAR_QUEUE 0X0E
502c2c66affSColin Finck #define SCSIMESS_COMMAND_COMPLETE 0X00
503c2c66affSColin Finck #define SCSIMESS_DISCONNECT 0X04
504c2c66affSColin Finck #define SCSIMESS_EXTENDED_MESSAGE 0X01
505c2c66affSColin Finck #define SCSIMESS_IDENTIFY 0X80
506c2c66affSColin Finck #define SCSIMESS_IDENTIFY_WITH_DISCON 0XC0
507c2c66affSColin Finck #define SCSIMESS_IGNORE_WIDE_RESIDUE 0X23
508c2c66affSColin Finck #define SCSIMESS_INITIATE_RECOVERY 0X0F
509c2c66affSColin Finck #define SCSIMESS_INIT_DETECTED_ERROR 0X05
510c2c66affSColin Finck #define SCSIMESS_LINK_CMD_COMP 0X0A
511c2c66affSColin Finck #define SCSIMESS_LINK_CMD_COMP_W_FLAG 0X0B
512c2c66affSColin Finck #define SCSIMESS_MESS_PARITY_ERROR 0X09
513c2c66affSColin Finck #define SCSIMESS_MESSAGE_REJECT 0X07
514c2c66affSColin Finck #define SCSIMESS_NO_OPERATION 0X08
515c2c66affSColin Finck #define SCSIMESS_HEAD_OF_QUEUE_TAG 0X21
516c2c66affSColin Finck #define SCSIMESS_ORDERED_QUEUE_TAG 0X22
517c2c66affSColin Finck #define SCSIMESS_SIMPLE_QUEUE_TAG 0X20
518c2c66affSColin Finck #define SCSIMESS_RELEASE_RECOVERY 0X10
519c2c66affSColin Finck #define SCSIMESS_RESTORE_POINTERS 0X03
520c2c66affSColin Finck #define SCSIMESS_SAVE_DATA_POINTER 0X02
521c2c66affSColin Finck #define SCSIMESS_TERMINATE_IO_PROCESS 0X11
522c2c66affSColin Finck
523c2c66affSColin Finck #define SCSIMESS_MODIFY_DATA_POINTER 0X00
524c2c66affSColin Finck #define SCSIMESS_SYNCHRONOUS_DATA_REQ 0X01
525c2c66affSColin Finck #define SCSIMESS_WIDE_DATA_REQUEST 0X03
526c2c66affSColin Finck
527c2c66affSColin Finck #define SCSIMESS_MODIFY_DATA_LENGTH 5
528c2c66affSColin Finck #define SCSIMESS_SYNCH_DATA_LENGTH 3
529c2c66affSColin Finck #define SCSIMESS_WIDE_DATA_LENGTH 2
530c2c66affSColin Finck
531c2c66affSColin Finck #define CDB_INQUIRY_EVPD 0x01
532c2c66affSColin Finck
533c2c66affSColin Finck #define LUN0_FORMAT_SAVING_DEFECT_LIST 0
534c2c66affSColin Finck #define USE_DEFAULTMSB 0
535c2c66affSColin Finck #define USE_DEFAULTLSB 0
536c2c66affSColin Finck
537c2c66affSColin Finck #define START_UNIT_CODE 0x01
538c2c66affSColin Finck #define STOP_UNIT_CODE 0x00
539c2c66affSColin Finck
540c2c66affSColin Finck /* INQUIRYDATA.DeviceType constants */
541c2c66affSColin Finck #define DIRECT_ACCESS_DEVICE 0x00
542c2c66affSColin Finck #define SEQUENTIAL_ACCESS_DEVICE 0x01
543c2c66affSColin Finck #define PRINTER_DEVICE 0x02
544c2c66affSColin Finck #define PROCESSOR_DEVICE 0x03
545c2c66affSColin Finck #define WRITE_ONCE_READ_MULTIPLE_DEVICE 0x04
546c2c66affSColin Finck #define READ_ONLY_DIRECT_ACCESS_DEVICE 0x05
547c2c66affSColin Finck #define SCANNER_DEVICE 0x06
548c2c66affSColin Finck #define OPTICAL_DEVICE 0x07
549c2c66affSColin Finck #define MEDIUM_CHANGER 0x08
550c2c66affSColin Finck #define COMMUNICATION_DEVICE 0x09
551c2c66affSColin Finck #define ARRAY_CONTROLLER_DEVICE 0x0C
552c2c66affSColin Finck #define SCSI_ENCLOSURE_DEVICE 0x0D
553c2c66affSColin Finck #define REDUCED_BLOCK_DEVICE 0x0E
554c2c66affSColin Finck #define OPTICAL_CARD_READER_WRITER_DEVICE 0x0F
555c2c66affSColin Finck #define BRIDGE_CONTROLLER_DEVICE 0x10
556c2c66affSColin Finck #define OBJECT_BASED_STORAGE_DEVICE 0x11
557c2c66affSColin Finck #define LOGICAL_UNIT_NOT_PRESENT_DEVICE 0x7F
558c2c66affSColin Finck
559c2c66affSColin Finck #define DEVICE_QUALIFIER_ACTIVE 0x00
560c2c66affSColin Finck #define DEVICE_QUALIFIER_NOT_ACTIVE 0x01
561c2c66affSColin Finck #define DEVICE_QUALIFIER_NOT_SUPPORTED 0x03
562c2c66affSColin Finck
563c2c66affSColin Finck /* INQUIRYDATA.DeviceTypeQualifier constants */
564c2c66affSColin Finck #define DEVICE_CONNECTED 0x00
565c2c66affSColin Finck
566c2c66affSColin Finck #define SCSISTAT_GOOD 0x00
567c2c66affSColin Finck #define SCSISTAT_CHECK_CONDITION 0x02
568c2c66affSColin Finck #define SCSISTAT_CONDITION_MET 0x04
569c2c66affSColin Finck #define SCSISTAT_BUSY 0x08
570c2c66affSColin Finck #define SCSISTAT_INTERMEDIATE 0x10
571c2c66affSColin Finck #define SCSISTAT_INTERMEDIATE_COND_MET 0x14
572c2c66affSColin Finck #define SCSISTAT_RESERVATION_CONFLICT 0x18
573c2c66affSColin Finck #define SCSISTAT_COMMAND_TERMINATED 0x22
574c2c66affSColin Finck #define SCSISTAT_QUEUE_FULL 0x28
575c2c66affSColin Finck
576c2c66affSColin Finck #define RESERVATION_ACTION_READ_KEYS 0x00
577c2c66affSColin Finck #define RESERVATION_ACTION_READ_RESERVATIONS 0x01
578c2c66affSColin Finck
579c2c66affSColin Finck #define RESERVATION_ACTION_REGISTER 0x00
580c2c66affSColin Finck #define RESERVATION_ACTION_RESERVE 0x01
581c2c66affSColin Finck #define RESERVATION_ACTION_RELEASE 0x02
582c2c66affSColin Finck #define RESERVATION_ACTION_CLEAR 0x03
583c2c66affSColin Finck #define RESERVATION_ACTION_PREEMPT 0x04
584c2c66affSColin Finck #define RESERVATION_ACTION_PREEMPT_ABORT 0x05
585c2c66affSColin Finck #define RESERVATION_ACTION_REGISTER_IGNORE_EXISTING 0x06
586c2c66affSColin Finck
587c2c66affSColin Finck #define RESERVATION_SCOPE_LU 0x00
588c2c66affSColin Finck #define RESERVATION_SCOPE_ELEMENT 0x02
589c2c66affSColin Finck
590c2c66affSColin Finck #define RESERVATION_TYPE_WRITE_EXCLUSIVE 0x01
591c2c66affSColin Finck #define RESERVATION_TYPE_EXCLUSIVE 0x03
592c2c66affSColin Finck #define RESERVATION_TYPE_WRITE_EXCLUSIVE_REGISTRANTS 0x05
593c2c66affSColin Finck #define RESERVATION_TYPE_EXCLUSIVE_REGISTRANTS 0x06
594c2c66affSColin Finck
5953da77f91SVictor Perevertkin #define SENSE_BUFFER_SIZE sizeof(SENSE_DATA)
5963da77f91SVictor Perevertkin #define SENSE_BUFFER_SIZE_EX sizeof(SENSE_DATA_EX)
597c2c66affSColin Finck
598c2c66affSColin Finck #define MAX_SENSE_BUFFER_SIZE 255
599c2c66affSColin Finck
600c2c66affSColin Finck #define MAX_ADDITIONAL_SENSE_BYTES (MAX_SENSE_BUFFER_SIZE - SENSE_BUFFER_SIZE)
6013da77f91SVictor Perevertkin #define MAX_ADDITIONAL_SENSE_BYTES_EX (MAX_SENSE_BUFFER_SIZE - SENSE_BUFFER_SIZE_EX)
602c2c66affSColin Finck
603c2c66affSColin Finck /* Sense codes */
604c2c66affSColin Finck #define SCSI_SENSE_NO_SENSE 0x00
605c2c66affSColin Finck #define SCSI_SENSE_RECOVERED_ERROR 0x01
606c2c66affSColin Finck #define SCSI_SENSE_NOT_READY 0x02
607c2c66affSColin Finck #define SCSI_SENSE_MEDIUM_ERROR 0x03
608c2c66affSColin Finck #define SCSI_SENSE_HARDWARE_ERROR 0x04
609c2c66affSColin Finck #define SCSI_SENSE_ILLEGAL_REQUEST 0x05
610c2c66affSColin Finck #define SCSI_SENSE_UNIT_ATTENTION 0x06
611c2c66affSColin Finck #define SCSI_SENSE_DATA_PROTECT 0x07
612c2c66affSColin Finck #define SCSI_SENSE_BLANK_CHECK 0x08
613c2c66affSColin Finck #define SCSI_SENSE_UNIQUE 0x09
614c2c66affSColin Finck #define SCSI_SENSE_COPY_ABORTED 0x0A
615c2c66affSColin Finck #define SCSI_SENSE_ABORTED_COMMAND 0x0B
616c2c66affSColin Finck #define SCSI_SENSE_EQUAL 0x0C
617c2c66affSColin Finck #define SCSI_SENSE_VOL_OVERFLOW 0x0D
618c2c66affSColin Finck #define SCSI_SENSE_MISCOMPARE 0x0E
619c2c66affSColin Finck #define SCSI_SENSE_RESERVED 0x0F
620c2c66affSColin Finck
6213da77f91SVictor Perevertkin // Sense Error Codes
6223da77f91SVictor Perevertkin
6233da77f91SVictor Perevertkin #define SCSI_SENSE_ERRORCODE_FIXED_CURRENT 0x70
6243da77f91SVictor Perevertkin #define SCSI_SENSE_ERRORCODE_FIXED_DEFERRED 0x71
6253da77f91SVictor Perevertkin #define SCSI_SENSE_ERRORCODE_DESCRIPTOR_CURRENT 0x72
6263da77f91SVictor Perevertkin #define SCSI_SENSE_ERRORCODE_DESCRIPTOR_DEFERRED 0x73
6273da77f91SVictor Perevertkin
6283da77f91SVictor Perevertkin // Sense Descriptor Types
6293da77f91SVictor Perevertkin
6303da77f91SVictor Perevertkin #define SCSI_SENSE_DESCRIPTOR_TYPE_INFORMATION 0x00
6313da77f91SVictor Perevertkin #define SCSI_SENSE_DESCRIPTOR_TYPE_COMMAND_SPECIFIC 0x01
6323da77f91SVictor Perevertkin #define SCSI_SENSE_DESCRIPTOR_TYPE_SENSE_KEY_SPECIFIC 0x02
6333da77f91SVictor Perevertkin #define SCSI_SENSE_DESCRIPTOR_TYPE_FIELD_REPLACEABLE_UNIT 0x03
6343da77f91SVictor Perevertkin #define SCSI_SENSE_DESCRIPTOR_TYPE_STREAM_COMMAND 0x04
6353da77f91SVictor Perevertkin #define SCSI_SENSE_DESCRIPTOR_TYPE_BLOCK_COMMAND 0x05
6363da77f91SVictor Perevertkin #define SCSI_SENSE_DESCRIPTOR_TYPE_OSD_OBJECT_IDENTIFICATION 0x06
6373da77f91SVictor Perevertkin #define SCSI_SENSE_DESCRIPTOR_TYPE_OSD_RESPONSE_INTEGRITY_CHECK 0x07
6383da77f91SVictor Perevertkin #define SCSI_SENSE_DESCRIPTOR_TYPE_OSD_ATTRIBUTE_IDENTIFICATION 0x08
6393da77f91SVictor Perevertkin #define SCSI_SENSE_DESCRIPTOR_TYPE_ATA_STATUS_RETURN 0x09
6403da77f91SVictor Perevertkin #define SCSI_SENSE_DESCRIPTOR_TYPE_PROGRESS_INDICATION 0x0A
6413da77f91SVictor Perevertkin #define SCSI_SENSE_DESCRIPTOR_TYPE_USER_DATA_SEGMENT_REFERRAL 0x0B
6423da77f91SVictor Perevertkin
643c2c66affSColin Finck /* Additional tape bit */
644c2c66affSColin Finck #define SCSI_ILLEGAL_LENGTH 0x20
645c2c66affSColin Finck #define SCSI_EOM 0x40
646c2c66affSColin Finck #define SCSI_FILE_MARK 0x80
647c2c66affSColin Finck
648c2c66affSColin Finck /* Additional Sense codes */
649c2c66affSColin Finck #define SCSI_ADSENSE_NO_SENSE 0x00
650c2c66affSColin Finck #define SCSI_ADSENSE_NO_SEEK_COMPLETE 0x02
6513da77f91SVictor Perevertkin #define SCSI_ADSENSE_WRITE 0x03
652c2c66affSColin Finck #define SCSI_ADSENSE_LUN_NOT_READY 0x04
653c2c66affSColin Finck #define SCSI_ADSENSE_LUN_COMMUNICATION 0x08
6543da77f91SVictor Perevertkin #define SCSI_ADSENSE_SERVO_ERROR 0x09
6553da77f91SVictor Perevertkin #define SCSI_ADSENSE_WARNING 0x0B
656c2c66affSColin Finck #define SCSI_ADSENSE_WRITE_ERROR 0x0C
6573da77f91SVictor Perevertkin #define SCSI_ADSENSE_COPY_TARGET_DEVICE_ERROR 0x0D
6583da77f91SVictor Perevertkin #define SCSI_ADSENSE_UNRECOVERED_ERROR 0x11
659c2c66affSColin Finck #define SCSI_ADSENSE_TRACK_ERROR 0x14
660c2c66affSColin Finck #define SCSI_ADSENSE_SEEK_ERROR 0x15
661c2c66affSColin Finck #define SCSI_ADSENSE_REC_DATA_NOECC 0x17
662c2c66affSColin Finck #define SCSI_ADSENSE_REC_DATA_ECC 0x18
6633da77f91SVictor Perevertkin #define SCSI_ADSENSE_DEFECT_LIST_ERROR 0x19
664c2c66affSColin Finck #define SCSI_ADSENSE_PARAMETER_LIST_LENGTH 0x1A
6653da77f91SVictor Perevertkin #define SCSI_ADSENSE_MISCOMPARE_DURING_VERIFY_OPERATION 0x1D
666c2c66affSColin Finck #define SCSI_ADSENSE_ILLEGAL_COMMAND 0x20
6673da77f91SVictor Perevertkin #define SCSI_ADSENSE_ACCESS_DENIED 0x20
668c2c66affSColin Finck #define SCSI_ADSENSE_ILLEGAL_BLOCK 0x21
6693da77f91SVictor Perevertkin #define SCSI_ADSENSE_INVALID_TOKEN 0x23
670c2c66affSColin Finck #define SCSI_ADSENSE_INVALID_CDB 0x24
671c2c66affSColin Finck #define SCSI_ADSENSE_INVALID_LUN 0x25
672c2c66affSColin Finck #define SCSI_ADSENSE_INVALID_FIELD_PARAMETER_LIST 0x26
673c2c66affSColin Finck #define SCSI_ADSENSE_WRITE_PROTECT 0x27
674c2c66affSColin Finck #define SCSI_ADSENSE_MEDIUM_CHANGED 0x28
675c2c66affSColin Finck #define SCSI_ADSENSE_BUS_RESET 0x29
676c2c66affSColin Finck #define SCSI_ADSENSE_PARAMETERS_CHANGED 0x2A
677c2c66affSColin Finck #define SCSI_ADSENSE_INSUFFICIENT_TIME_FOR_OPERATION 0x2E
678c2c66affSColin Finck #define SCSI_ADSENSE_INVALID_MEDIA 0x30
6793da77f91SVictor Perevertkin #define SCSI_ADSENSE_DEFECT_LIST 0x32
6803da77f91SVictor Perevertkin #define SCSI_ADSENSE_LB_PROVISIONING 0x38
681c2c66affSColin Finck #define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE 0x3a
682c2c66affSColin Finck #define SCSI_ADSENSE_POSITION_ERROR 0x3b
6833da77f91SVictor Perevertkin #define SCSI_ADSENSE_LOGICAL_UNIT_ERROR 0x3e
684c2c66affSColin Finck #define SCSI_ADSENSE_OPERATING_CONDITIONS_CHANGED 0x3f
6853da77f91SVictor Perevertkin #define SCSI_ADSENSE_DATA_PATH_FAILURE 0x41
6863da77f91SVictor Perevertkin #define SCSI_ADSENSE_POWER_ON_SELF_TEST_FAILURE 0x42
6873da77f91SVictor Perevertkin #define SCSI_ADSENSE_INTERNAL_TARGET_FAILURE 0x44
6883da77f91SVictor Perevertkin #define SCSI_ADSENSE_DATA_TRANSFER_ERROR 0x4b
6893da77f91SVictor Perevertkin #define SCSI_ADSENSE_LUN_FAILED_SELF_CONFIGURATION 0x4c
6903da77f91SVictor Perevertkin #define SCSI_ADSENSE_RESOURCE_FAILURE 0x55
691c2c66affSColin Finck #define SCSI_ADSENSE_OPERATOR_REQUEST 0x5a
692c2c66affSColin Finck #define SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x5d
693c2c66affSColin Finck #define SCSI_ADSENSE_ILLEGAL_MODE_FOR_THIS_TRACK 0x64
694c2c66affSColin Finck #define SCSI_ADSENSE_COPY_PROTECTION_FAILURE 0x6f
695c2c66affSColin Finck #define SCSI_ADSENSE_POWER_CALIBRATION_ERROR 0x73
696c2c66affSColin Finck #define SCSI_ADSENSE_VENDOR_UNIQUE 0x80
697c2c66affSColin Finck #define SCSI_ADSENSE_MUSIC_AREA 0xA0
698c2c66affSColin Finck #define SCSI_ADSENSE_DATA_AREA 0xA1
699c2c66affSColin Finck #define SCSI_ADSENSE_VOLUME_OVERFLOW 0xA7
700c2c66affSColin Finck
701c2c66affSColin Finck #define SCSI_ADWRITE_PROTECT SCSI_ADSENSE_WRITE_PROTECT
702c2c66affSColin Finck #define SCSI_FAILURE_PREDICTION_THRESHOLD_EXCEEDED SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED
703c2c66affSColin Finck
7043da77f91SVictor Perevertkin // ADSENSE additional qualifiers
7053da77f91SVictor Perevertkin
7063da77f91SVictor Perevertkin // SCSI_ADSENSE_NO_SENSE (0x00)
7073da77f91SVictor Perevertkin
7083da77f91SVictor Perevertkin #define SCSI_SENSEQ_FILEMARK_DETECTED 0x01
7093da77f91SVictor Perevertkin #define SCSI_SENSEQ_END_OF_MEDIA_DETECTED 0x02
7103da77f91SVictor Perevertkin #define SCSI_SENSEQ_SETMARK_DETECTED 0x03
7113da77f91SVictor Perevertkin #define SCSI_SENSEQ_BEGINNING_OF_MEDIA_DETECTED 0x04
7123da77f91SVictor Perevertkin #define SCSI_SENSEQ_OPERATION_IS_IN_PROGRESS 0x16
7133da77f91SVictor Perevertkin
7143da77f91SVictor Perevertkin // SCSI_ADSENSE_WRITE (0x03)
7153da77f91SVictor Perevertkin
7163da77f91SVictor Perevertkin #define SCSI_SENSEQ_PERIPHERAL_DEVICE_WRITE_FAULT 0x00
7173da77f91SVictor Perevertkin #define SCSI_SENSEQ_NO_WRITE_CURRENT 0x01
7183da77f91SVictor Perevertkin #define SCSI_SENSEQ_EXCESSIVE_WRITE_ERRORS 0x02
7193da77f91SVictor Perevertkin
7203da77f91SVictor Perevertkin // SCSI_ADSENSE_LUN_NOT_READY (0x04)
7213da77f91SVictor Perevertkin
722c2c66affSColin Finck #define SCSI_SENSEQ_CAUSE_NOT_REPORTABLE 0x00
723c2c66affSColin Finck #define SCSI_SENSEQ_BECOMING_READY 0x01
724c2c66affSColin Finck #define SCSI_SENSEQ_INIT_COMMAND_REQUIRED 0x02
725c2c66affSColin Finck #define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED 0x03
726c2c66affSColin Finck #define SCSI_SENSEQ_FORMAT_IN_PROGRESS 0x04
727c2c66affSColin Finck #define SCSI_SENSEQ_REBUILD_IN_PROGRESS 0x05
728c2c66affSColin Finck #define SCSI_SENSEQ_RECALCULATION_IN_PROGRESS 0x06
729c2c66affSColin Finck #define SCSI_SENSEQ_OPERATION_IN_PROGRESS 0x07
730c2c66affSColin Finck #define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS 0x08
7313da77f91SVictor Perevertkin #define SCSI_SENSEQ_SPACE_ALLOC_IN_PROGRESS 0x14
7323da77f91SVictor Perevertkin
7333da77f91SVictor Perevertkin // SCSI_ADSENSE_LUN_COMMUNICATION (0x08)
734c2c66affSColin Finck
735c2c66affSColin Finck #define SCSI_SENSEQ_COMM_FAILURE 0x00
736c2c66affSColin Finck #define SCSI_SENSEQ_COMM_TIMEOUT 0x01
737c2c66affSColin Finck #define SCSI_SENSEQ_COMM_PARITY_ERROR 0x02
738c2c66affSColin Finck #define SCSI_SESNEQ_COMM_CRC_ERROR 0x03
739c2c66affSColin Finck #define SCSI_SENSEQ_UNREACHABLE_TARGET 0x04
740c2c66affSColin Finck
7413da77f91SVictor Perevertkin // SCSI_ADSENSE_SERVO_ERROR (0x09)
742c2c66affSColin Finck
7433da77f91SVictor Perevertkin #define SCSI_SENSEQ_TRACK_FOLLOWING_ERROR 0x00
7443da77f91SVictor Perevertkin #define SCSI_SENSEQ_TRACKING_SERVO_FAILURE 0x01
7453da77f91SVictor Perevertkin #define SCSI_SENSEQ_FOCUS_SERVO_FAILURE 0x02
7463da77f91SVictor Perevertkin #define SCSI_SENSEQ_SPINDLE_SERVO_FAILURE 0x03
7473da77f91SVictor Perevertkin #define SCSI_SENSEQ_HEAD_SELECT_FAULT 0x04
7483da77f91SVictor Perevertkin
7493da77f91SVictor Perevertkin // SCSI_ADSENSE_WARNING (0x0B)
7503da77f91SVictor Perevertkin
7513da77f91SVictor Perevertkin #define SCSI_SENSEQ_POWER_LOSS_EXPECTED 0x08
7523da77f91SVictor Perevertkin
7533da77f91SVictor Perevertkin // SCSI_ADSENSE_WRITE_ERROR (0x0C)
7543da77f91SVictor Perevertkin
7553da77f91SVictor Perevertkin #define SCSI_SENSEQ_LOSS_OF_STREAMING 0x09
7563da77f91SVictor Perevertkin #define SCSI_SENSEQ_PADDING_BLOCKS_ADDED 0x0A
7573da77f91SVictor Perevertkin
7583da77f91SVictor Perevertkin // SCSI_ADSENSE_COPY_TARGET_DEVICE_ERROR (0x0D)
7593da77f91SVictor Perevertkin
7603da77f91SVictor Perevertkin #define SCSI_SENSEQ_NOT_REACHABLE 0x02
7613da77f91SVictor Perevertkin #define SCSI_SENSEQ_DATA_UNDERRUN 0x04
7623da77f91SVictor Perevertkin
7633da77f91SVictor Perevertkin // SCSI_ADSENSE_UNRECOVERED_ERROR (0x11)
7643da77f91SVictor Perevertkin
7653da77f91SVictor Perevertkin #define SCSI_SENSEQ_UNRECOVERED_READ_ERROR 0x00
7663da77f91SVictor Perevertkin
7673da77f91SVictor Perevertkin // SCSI_ADSENSE_SEEK_ERROR (0x15)
7683da77f91SVictor Perevertkin
7693da77f91SVictor Perevertkin #define SCSI_SENSEQ_RANDOM_POSITIONING_ERROR 0x00
7703da77f91SVictor Perevertkin #define SCSI_SENSEQ_MECHANICAL_POSITIONING_ERROR 0x01
7713da77f91SVictor Perevertkin #define SCSI_SENSEQ_POSITIONING_ERROR_DETECTED_BY_READ_OF_MEDIUM 0x02
7723da77f91SVictor Perevertkin
7733da77f91SVictor Perevertkin // SCSI_ADSENSE_DEFECT_LIST_ERROR (0x19)
7743da77f91SVictor Perevertkin
7753da77f91SVictor Perevertkin #define SCSI_SENSEQ_DEFECT_LIST_ERROR 0x00
7763da77f91SVictor Perevertkin #define SCSI_SENSEQ_DEFECT_LIST_NOT_AVAILABLE 0x01
7773da77f91SVictor Perevertkin #define SCSI_SENSEQ_DEFECT_LIST_ERROR_IN_PRIMARY_LIST 0x02
7783da77f91SVictor Perevertkin #define SCSI_SENSEQ_DEFECT_LIST_ERROR_IN_GROWN_LIST 0x03
7793da77f91SVictor Perevertkin
7803da77f91SVictor Perevertkin // SCSI_ADSENSE_ACCESS_DENIED (0x20)
7813da77f91SVictor Perevertkin
7823da77f91SVictor Perevertkin #define SCSI_SENSEQ_NO_ACCESS_RIGHTS 0x02
7833da77f91SVictor Perevertkin
7843da77f91SVictor Perevertkin // SCSI_ADSENSE_ILLEGAL_BLOCK (0x21)
7853da77f91SVictor Perevertkin
7863da77f91SVictor Perevertkin #define SCSI_SENSEQ_LOGICAL_ADDRESS_OUT_OF_RANGE 0x00
787c2c66affSColin Finck #define SCSI_SENSEQ_ILLEGAL_ELEMENT_ADDR 0x01
7883da77f91SVictor Perevertkin #define SCSI_SENSEQ_INVALID_WRITE_ADDRESS 0x02
7893da77f91SVictor Perevertkin #define SCSI_SENSEQ_INVALID_WRITE_CROSSING_LAYER_JUMP 0x03
7903da77f91SVictor Perevertkin #define SCSI_SENSEQ_UNALIGNED_WRITE 0x04
7913da77f91SVictor Perevertkin #define SCSI_SENSEQ_WRITE_BOUNDARY_VIOLATION 0x05
7923da77f91SVictor Perevertkin #define SCSI_SENSEQ_READ_INVALID_DATA 0x06
7933da77f91SVictor Perevertkin #define SCSI_SENSEQ_READ_BOUNDARY_VIOLATION 0x07
7943da77f91SVictor Perevertkin #define SCSI_SENSEQ_MISALIGNED_WRITE 0x08
7953da77f91SVictor Perevertkin
7963da77f91SVictor Perevertkin // SCSI_ADSENSE_INVALID_FIELD_PARAMETER_LIST (0x26)
7973da77f91SVictor Perevertkin
7983da77f91SVictor Perevertkin #define SCSI_SENSEQ_INVALID_RELEASE_OF_PERSISTENT_RESERVATION 0x04
7993da77f91SVictor Perevertkin #define SCSI_SENSEQ_TOO_MANY_SEGMENT_DESCRIPTORS 0x08
8003da77f91SVictor Perevertkin
8013da77f91SVictor Perevertkin // SCSI_ADSENSE_WRITE_PROTECT (0x27)
8023da77f91SVictor Perevertkin
8033da77f91SVictor Perevertkin #define SCSI_SENSEQ_SPACE_ALLOC_FAILED_WRITE_PROTECT 0x07
8043da77f91SVictor Perevertkin
8053da77f91SVictor Perevertkin // SCSI_ADSENSE_PARAMETERS_CHANGED (0x2A)
8063da77f91SVictor Perevertkin
8073da77f91SVictor Perevertkin #define SCSI_SENSEQ_CAPACITY_DATA_CHANGED 0x09
8083da77f91SVictor Perevertkin
8093da77f91SVictor Perevertkin // SCSI_ADSENSE_POSITION_ERROR (0x3b)
810c2c66affSColin Finck
811c2c66affSColin Finck #define SCSI_SENSEQ_DESTINATION_FULL 0x0d
812c2c66affSColin Finck #define SCSI_SENSEQ_SOURCE_EMPTY 0x0e
813c2c66affSColin Finck
8143da77f91SVictor Perevertkin // SCSI_ADSENSE_INVALID_MEDIA (0x30)
8153da77f91SVictor Perevertkin
816c2c66affSColin Finck #define SCSI_SENSEQ_INCOMPATIBLE_MEDIA_INSTALLED 0x00
817c2c66affSColin Finck #define SCSI_SENSEQ_UNKNOWN_FORMAT 0x01
818c2c66affSColin Finck #define SCSI_SENSEQ_INCOMPATIBLE_FORMAT 0x02
819c2c66affSColin Finck #define SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED 0x03
820c2c66affSColin Finck
8213da77f91SVictor Perevertkin // SCSI_ADSENSE_DEFECT_LIST (0x32)
8223da77f91SVictor Perevertkin
8233da77f91SVictor Perevertkin #define SCSI_SENSEQ_NO_DEFECT_SPARE_LOCATION_AVAILABLE 0x00
8243da77f91SVictor Perevertkin #define SCSI_SENSEQ_DEFECT_LIST_UPDATE_FAILURE 0x01
8253da77f91SVictor Perevertkin
8263da77f91SVictor Perevertkin // SCSI_ADSENSE_LB_PROVISIONING (0x38)
8273da77f91SVictor Perevertkin
8283da77f91SVictor Perevertkin #define SCSI_SENSEQ_SOFT_THRESHOLD_REACHED 0x07
8293da77f91SVictor Perevertkin
8303da77f91SVictor Perevertkin // SCSI_ADSENSE_LOGICAL_UNIT_ERROR (0x3e)
8313da77f91SVictor Perevertkin
8323da77f91SVictor Perevertkin #define SCSI_SENSEQ_LOGICAL_UNIT_HAS_NOT_SELF_CONFIGURED_YET 0x00
8333da77f91SVictor Perevertkin #define SCSI_SENSEQ_LOGICAL_UNIT_FAILURE 0x01
8343da77f91SVictor Perevertkin #define SCSI_SENSEQ_TIMEOUT_ON_LOGICAL_UNIT 0x02
8353da77f91SVictor Perevertkin #define SCSI_SENSEQ_LOGICAL_UNIT_FAILED_SELF_TEST 0x03
8363da77f91SVictor Perevertkin #define SCSI_SENSEQ_LOGICAL_UNIT_FAILED_TO_UPDATE_SELF_TEST_LOG 0x04
8373da77f91SVictor Perevertkin
8383da77f91SVictor Perevertkin // SCSI_ADSENSE_OPERATING_CONDITIONS_CHANGED (0x3f)
8393da77f91SVictor Perevertkin
840c2c66affSColin Finck #define SCSI_SENSEQ_TARGET_OPERATING_CONDITIONS_CHANGED 0x00
841c2c66affSColin Finck #define SCSI_SENSEQ_MICROCODE_CHANGED 0x01
842c2c66affSColin Finck #define SCSI_SENSEQ_OPERATING_DEFINITION_CHANGED 0x02
843c2c66affSColin Finck #define SCSI_SENSEQ_INQUIRY_DATA_CHANGED 0x03
844c2c66affSColin Finck #define SCSI_SENSEQ_COMPONENT_DEVICE_ATTACHED 0x04
845c2c66affSColin Finck #define SCSI_SENSEQ_DEVICE_IDENTIFIER_CHANGED 0x05
846c2c66affSColin Finck #define SCSI_SENSEQ_REDUNDANCY_GROUP_MODIFIED 0x06
847c2c66affSColin Finck #define SCSI_SENSEQ_REDUNDANCY_GROUP_DELETED 0x07
848c2c66affSColin Finck #define SCSI_SENSEQ_SPARE_MODIFIED 0x08
849c2c66affSColin Finck #define SCSI_SENSEQ_SPARE_DELETED 0x09
850c2c66affSColin Finck #define SCSI_SENSEQ_VOLUME_SET_MODIFIED 0x0A
851c2c66affSColin Finck #define SCSI_SENSEQ_VOLUME_SET_DELETED 0x0B
852c2c66affSColin Finck #define SCSI_SENSEQ_VOLUME_SET_DEASSIGNED 0x0C
853c2c66affSColin Finck #define SCSI_SENSEQ_VOLUME_SET_REASSIGNED 0x0D
854c2c66affSColin Finck #define SCSI_SENSEQ_REPORTED_LUNS_DATA_CHANGED 0x0E
855c2c66affSColin Finck #define SCSI_SENSEQ_ECHO_BUFFER_OVERWRITTEN 0x0F
856c2c66affSColin Finck #define SCSI_SENSEQ_MEDIUM_LOADABLE 0x10
857c2c66affSColin Finck #define SCSI_SENSEQ_MEDIUM_AUXILIARY_MEMORY_ACCESSIBLE 0x11
858c2c66affSColin Finck
8593da77f91SVictor Perevertkin // SCSI_ADSENSE_INTERNAL_TARGET_FAILURE (0x44)
8603da77f91SVictor Perevertkin
8613da77f91SVictor Perevertkin #define SCSI_SENSEQ_INTERNAL_TARGET_FAILURE 0x00
8623da77f91SVictor Perevertkin #define SCSI_SENSEQ_PRESISTENT_RESERVATION_INFORMATION_LOST 0x01
8633da77f91SVictor Perevertkin #define SCSI_SENSEQ_ATA_DEVICE_FAILED_SET_FEATURES 0x71
8643da77f91SVictor Perevertkin
8653da77f91SVictor Perevertkin // SCSI_ADSENSE_DATA_TRANSFER_ERROR (0x4b)
8663da77f91SVictor Perevertkin
8673da77f91SVictor Perevertkin #define SCSI_SENSEQ_INITIATOR_RESPONSE_TIMEOUT 0x06
8683da77f91SVictor Perevertkin
8693da77f91SVictor Perevertkin // SCSI_ADSENSE_RESOURCE_FAILURE (0x55)
8703da77f91SVictor Perevertkin
8713da77f91SVictor Perevertkin #define SCSI_SENSEQ_SYSTEM_RESOURCE_FAILURE 0x00
8723da77f91SVictor Perevertkin #define SCSI_SENSEQ_SYSTEM_BUFFER_FULL 0x01
8733da77f91SVictor Perevertkin #define SCSI_SENSEQ_INSUFFICIENT_RESERVATION_RESOURCES 0x02
8743da77f91SVictor Perevertkin #define SCSI_SENSEQ_INSUFFICIENT_RESOURCES 0x03
8753da77f91SVictor Perevertkin
8763da77f91SVictor Perevertkin // SCSI_ADSENSE_OPERATOR_REQUEST (0x5a)
8773da77f91SVictor Perevertkin
878c2c66affSColin Finck #define SCSI_SENSEQ_STATE_CHANGE_INPUT 0x00
879c2c66affSColin Finck #define SCSI_SENSEQ_MEDIUM_REMOVAL 0x01
880c2c66affSColin Finck #define SCSI_SENSEQ_WRITE_PROTECT_ENABLE 0x02
881c2c66affSColin Finck #define SCSI_SENSEQ_WRITE_PROTECT_DISABLE 0x03
882c2c66affSColin Finck
8833da77f91SVictor Perevertkin // SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED (0x5d)
8843da77f91SVictor Perevertkin
8853da77f91SVictor Perevertkin #define SCSI_SENSEQ_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x00
8863da77f91SVictor Perevertkin #define SCSI_SENSEQ_MEDIA_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x01
8873da77f91SVictor Perevertkin #define SCSI_SENSEQ_LUN_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x02
8883da77f91SVictor Perevertkin #define SCSI_SENSEQ_SPARE_AREA_EXHAUSTION_PREDICTION_THRESHOLD_EXCEEDED 0x03
8893da77f91SVictor Perevertkin #define SCSI_SENSEQ_GENERAL_HARD_DRIVE_FAILURE 0x10
8903da77f91SVictor Perevertkin #define SCSI_SENSEQ_DRIVE_ERROR_RATE_TOO_HIGH 0x11
8913da77f91SVictor Perevertkin #define SCSI_SENSEQ_DATA_ERROR_RATE_TOO_HIGH 0x12
8923da77f91SVictor Perevertkin #define SCSI_SENSEQ_SEEK_ERROR_RATE_TOO_HIGH 0x13
8933da77f91SVictor Perevertkin #define SCSI_SENSEQ_TOO_MANY_BLOCK_REASSIGNS 0x14
8943da77f91SVictor Perevertkin #define SCSI_SENSEQ_ACCESS_TIMES_TOO_HIGH 0x15
8953da77f91SVictor Perevertkin #define SCSI_SENSEQ_START_UNIT_TIMES_TOO_HIGH 0x16
8963da77f91SVictor Perevertkin #define SCSI_SENSEQ_CHANNEL_PARAMETRICS 0x17
8973da77f91SVictor Perevertkin #define SCSI_SENSEQ_CONTROLLER_DETECTED 0x18
8983da77f91SVictor Perevertkin #define SCSI_SENSEQ_THROUGHPUT_PERFORMANCE 0x19
8993da77f91SVictor Perevertkin #define SCSI_SENSEQ_SEEK_TIME_PERFORMANCE 0x1A
9003da77f91SVictor Perevertkin #define SCSI_SENSEQ_SPIN_UP_RETRY_COUNT 0x1B
9013da77f91SVictor Perevertkin #define SCSI_SENSEQ_DRIVE_CALIBRATION_RETRY_COUNT 0x1C
9023da77f91SVictor Perevertkin #define SCSI_SENSEQ_DATA_CHANNEL_DATA_ERROR_RATE_TOO_HIGH 0x32
9033da77f91SVictor Perevertkin #define SCSI_SENSEQ_SERVO_DATA_ERROR_RATE_TOO_HIGH 0x42
9043da77f91SVictor Perevertkin #define SCSI_SENSEQ_SERVER_SEEK_ERROR_RATE_TOO_HIGH 0x43
9053da77f91SVictor Perevertkin #define SCSI_SENSEQ_FAILURE_PREDICTION_THRESHOLD_EXCEEDED_FALSE 0xFF
9063da77f91SVictor Perevertkin
9073da77f91SVictor Perevertkin // SCSI_ADSENSE_COPY_PROTECTION_FAILURE (0x6f)
9083da77f91SVictor Perevertkin
909c2c66affSColin Finck #define SCSI_SENSEQ_AUTHENTICATION_FAILURE 0x00
910c2c66affSColin Finck #define SCSI_SENSEQ_KEY_NOT_PRESENT 0x01
911c2c66affSColin Finck #define SCSI_SENSEQ_KEY_NOT_ESTABLISHED 0x02
912c2c66affSColin Finck #define SCSI_SENSEQ_READ_OF_SCRAMBLED_SECTOR_WITHOUT_AUTHENTICATION 0x03
913c2c66affSColin Finck #define SCSI_SENSEQ_MEDIA_CODE_MISMATCHED_TO_LOGICAL_UNIT 0x04
914c2c66affSColin Finck #define SCSI_SENSEQ_LOGICAL_UNIT_RESET_COUNT_ERROR 0x05
915c2c66affSColin Finck
9163da77f91SVictor Perevertkin // SCSI_ADSENSE_POWER_CALIBRATION_ERROR (0x73)
9173da77f91SVictor Perevertkin
918c2c66affSColin Finck #define SCSI_SENSEQ_POWER_CALIBRATION_AREA_ALMOST_FULL 0x01
919c2c66affSColin Finck #define SCSI_SENSEQ_POWER_CALIBRATION_AREA_FULL 0x02
920c2c66affSColin Finck #define SCSI_SENSEQ_POWER_CALIBRATION_AREA_ERROR 0x03
921c2c66affSColin Finck #define SCSI_SENSEQ_PMA_RMA_UPDATE_FAILURE 0x04
922c2c66affSColin Finck #define SCSI_SENSEQ_PMA_RMA_IS_FULL 0x05
923c2c66affSColin Finck #define SCSI_SENSEQ_PMA_RMA_ALMOST_FULL 0x06
924c2c66affSColin Finck
925c2c66affSColin Finck #define FILE_DEVICE_SCSI 0x0000001b
926c2c66affSColin Finck
927c2c66affSColin Finck #define IOCTL_SCSI_EXECUTE_IN ((FILE_DEVICE_SCSI << 16) + 0x0011)
928c2c66affSColin Finck #define IOCTL_SCSI_EXECUTE_OUT ((FILE_DEVICE_SCSI << 16) + 0x0012)
929c2c66affSColin Finck #define IOCTL_SCSI_EXECUTE_NONE ((FILE_DEVICE_SCSI << 16) + 0x0013)
930c2c66affSColin Finck
931c2c66affSColin Finck /* SMART support in ATAPI */
932c2c66affSColin Finck #define IOCTL_SCSI_MINIPORT_SMART_VERSION ((FILE_DEVICE_SCSI << 16) + 0x0500)
933c2c66affSColin Finck #define IOCTL_SCSI_MINIPORT_IDENTIFY ((FILE_DEVICE_SCSI << 16) + 0x0501)
934c2c66affSColin Finck #define IOCTL_SCSI_MINIPORT_READ_SMART_ATTRIBS ((FILE_DEVICE_SCSI << 16) + 0x0502)
935c2c66affSColin Finck #define IOCTL_SCSI_MINIPORT_READ_SMART_THRESHOLDS ((FILE_DEVICE_SCSI << 16) + 0x0503)
936c2c66affSColin Finck #define IOCTL_SCSI_MINIPORT_ENABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0504)
937c2c66affSColin Finck #define IOCTL_SCSI_MINIPORT_DISABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0505)
938c2c66affSColin Finck #define IOCTL_SCSI_MINIPORT_RETURN_STATUS ((FILE_DEVICE_SCSI << 16) + 0x0506)
939c2c66affSColin Finck #define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTOSAVE ((FILE_DEVICE_SCSI << 16) + 0x0507)
940c2c66affSColin Finck #define IOCTL_SCSI_MINIPORT_SAVE_ATTRIBUTE_VALUES ((FILE_DEVICE_SCSI << 16) + 0x0508)
941c2c66affSColin Finck #define IOCTL_SCSI_MINIPORT_EXECUTE_OFFLINE_DIAGS ((FILE_DEVICE_SCSI << 16) + 0x0509)
942c2c66affSColin Finck #define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTO_OFFLINE ((FILE_DEVICE_SCSI << 16) + 0x050a)
943c2c66affSColin Finck #define IOCTL_SCSI_MINIPORT_READ_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050b)
944c2c66affSColin Finck #define IOCTL_SCSI_MINIPORT_WRITE_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050c)
945c2c66affSColin Finck
946c2c66affSColin Finck /* CLUSTER support */
947c2c66affSColin Finck #define IOCTL_SCSI_MINIPORT_NOT_QUORUM_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0520)
948c2c66affSColin Finck #define IOCTL_SCSI_MINIPORT_NOT_CLUSTER_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0521)
949c2c66affSColin Finck
950c2c66affSColin Finck #define MODE_FD_SINGLE_SIDE 0x01
951c2c66affSColin Finck #define MODE_FD_DOUBLE_SIDE 0x02
952c2c66affSColin Finck #define MODE_FD_MAXIMUM_TYPE 0x1E
953c2c66affSColin Finck #define MODE_DSP_FUA_SUPPORTED 0x10
954c2c66affSColin Finck #define MODE_DSP_WRITE_PROTECT 0x80
955c2c66affSColin Finck
956c2c66affSColin Finck #define CDDA_CHANNEL_MUTED 0x0
957c2c66affSColin Finck #define CDDA_CHANNEL_ZERO 0x1
958c2c66affSColin Finck #define CDDA_CHANNEL_ONE 0x2
959c2c66affSColin Finck #define CDDA_CHANNEL_TWO 0x4
960c2c66affSColin Finck #define CDDA_CHANNEL_THREE 0x8
961c2c66affSColin Finck
962c2c66affSColin Finck #define CDVD_LMT_CADDY 0
963c2c66affSColin Finck #define CDVD_LMT_TRAY 1
964c2c66affSColin Finck #define CDVD_LMT_POPUP 2
965c2c66affSColin Finck #define CDVD_LMT_RESERVED1 3
966c2c66affSColin Finck #define CDVD_LMT_CHANGER_INDIVIDUAL 4
967c2c66affSColin Finck #define CDVD_LMT_CHANGER_CARTRIDGE 5
968c2c66affSColin Finck #define CDVD_LMT_RESERVED2 6
969c2c66affSColin Finck #define CDVD_LMT_RESERVED3 7
970c2c66affSColin Finck
971c2c66affSColin Finck #define LOADING_MECHANISM_CADDY 0x00
972c2c66affSColin Finck #define LOADING_MECHANISM_TRAY 0x01
973c2c66affSColin Finck #define LOADING_MECHANISM_POPUP 0x02
974c2c66affSColin Finck #define LOADING_MECHANISM_INDIVIDUAL_CHANGER 0x04
975c2c66affSColin Finck #define LOADING_MECHANISM_CARTRIDGE_CHANGER 0x05
976c2c66affSColin Finck
977c2c66affSColin Finck #define MODE_BLOCK_DESC_LENGTH 8
978c2c66affSColin Finck #define MODE_HEADER_LENGTH 4
979c2c66affSColin Finck #define MODE_HEADER_LENGTH10 8
980c2c66affSColin Finck
981c2c66affSColin Finck /* CDROM audio control */
982c2c66affSColin Finck #define CDB_AUDIO_PAUSE 0x00
983c2c66affSColin Finck #define CDB_AUDIO_RESUME 0x01
984c2c66affSColin Finck #define CDB_DEVICE_START 0x11
985c2c66affSColin Finck #define CDB_DEVICE_STOP 0x10
986c2c66affSColin Finck #define CDB_EJECT_MEDIA 0x10
987c2c66affSColin Finck #define CDB_LOAD_MEDIA 0x01
988c2c66affSColin Finck #define CDB_SUBCHANNEL_HEADER 0x00
989c2c66affSColin Finck #define CDB_SUBCHANNEL_BLOCK 0x01
990c2c66affSColin Finck
991c2c66affSColin Finck #define CDROM_AUDIO_CONTROL_PAGE 0x0E
992c2c66affSColin Finck #define MODE_SELECT_IMMEDIATE 0x04
993c2c66affSColin Finck #define MODE_SELECT_PFBIT 0x10
994c2c66affSColin Finck
995c2c66affSColin Finck #define CDB_USE_MSF 0x01
996c2c66affSColin Finck
997c2c66affSColin Finck /* Multisession CDROMs */
998c2c66affSColin Finck #define GET_LAST_SESSION 0x01
999c2c66affSColin Finck #define GET_SESSION_DATA 0x02
1000c2c66affSColin Finck
1001c2c66affSColin Finck typedef union _CDB {
1002c2c66affSColin Finck struct _CDB6GENERIC {
1003c2c66affSColin Finck UCHAR OperationCode;
1004c2c66affSColin Finck UCHAR Immediate:1;
1005c2c66affSColin Finck UCHAR CommandUniqueBits:4;
1006c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1007c2c66affSColin Finck UCHAR CommandUniqueBytes[3];
1008c2c66affSColin Finck UCHAR Link:1;
1009c2c66affSColin Finck UCHAR Flag:1;
1010c2c66affSColin Finck UCHAR Reserved:4;
1011c2c66affSColin Finck UCHAR VendorUnique:2;
1012c2c66affSColin Finck } CDB6GENERIC, *PCDB6GENERIC;
1013c2c66affSColin Finck struct _CDB6READWRITE {
1014c2c66affSColin Finck UCHAR OperationCode;
1015c2c66affSColin Finck UCHAR LogicalBlockMsb1:5;
1016c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1017c2c66affSColin Finck UCHAR LogicalBlockMsb0;
1018c2c66affSColin Finck UCHAR LogicalBlockLsb;
1019c2c66affSColin Finck UCHAR TransferBlocks;
1020c2c66affSColin Finck UCHAR Control;
1021c2c66affSColin Finck } CDB6READWRITE, *PCDB6READWRITE;
1022c2c66affSColin Finck struct _CDB6INQUIRY {
1023c2c66affSColin Finck UCHAR OperationCode;
1024c2c66affSColin Finck UCHAR Reserved1:5;
1025c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1026c2c66affSColin Finck UCHAR PageCode;
1027c2c66affSColin Finck UCHAR IReserved;
1028c2c66affSColin Finck UCHAR AllocationLength;
1029c2c66affSColin Finck UCHAR Control;
1030c2c66affSColin Finck } CDB6INQUIRY, *PCDB6INQUIRY;
1031c2c66affSColin Finck struct _CDB6INQUIRY3 {
1032c2c66affSColin Finck UCHAR OperationCode;
1033c2c66affSColin Finck UCHAR EnableVitalProductData:1;
1034c2c66affSColin Finck UCHAR CommandSupportData:1;
1035c2c66affSColin Finck UCHAR Reserved1:6;
1036c2c66affSColin Finck UCHAR PageCode;
1037c2c66affSColin Finck UCHAR Reserved2;
1038c2c66affSColin Finck UCHAR AllocationLength;
1039c2c66affSColin Finck UCHAR Control;
1040c2c66affSColin Finck } CDB6INQUIRY3, *PCDB6INQUIRY3;
1041c2c66affSColin Finck struct _CDB6VERIFY {
1042c2c66affSColin Finck UCHAR OperationCode;
1043c2c66affSColin Finck UCHAR Fixed:1;
1044c2c66affSColin Finck UCHAR ByteCompare:1;
1045c2c66affSColin Finck UCHAR Immediate:1;
1046c2c66affSColin Finck UCHAR Reserved:2;
1047c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1048c2c66affSColin Finck UCHAR VerificationLength[3];
1049c2c66affSColin Finck UCHAR Control;
1050c2c66affSColin Finck } CDB6VERIFY, *PCDB6VERIFY;
1051c2c66affSColin Finck struct _CDB6FORMAT {
1052c2c66affSColin Finck UCHAR OperationCode;
1053c2c66affSColin Finck UCHAR FormatControl:5;
1054c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1055c2c66affSColin Finck UCHAR FReserved1;
1056c2c66affSColin Finck UCHAR InterleaveMsb;
1057c2c66affSColin Finck UCHAR InterleaveLsb;
1058c2c66affSColin Finck UCHAR FReserved2;
1059c2c66affSColin Finck } CDB6FORMAT, *PCDB6FORMAT;
1060c2c66affSColin Finck struct _CDB10 {
1061c2c66affSColin Finck UCHAR OperationCode;
1062c2c66affSColin Finck UCHAR RelativeAddress:1;
1063c2c66affSColin Finck UCHAR Reserved1:2;
1064c2c66affSColin Finck UCHAR ForceUnitAccess:1;
1065c2c66affSColin Finck UCHAR DisablePageOut:1;
1066c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1067c2c66affSColin Finck UCHAR LogicalBlockByte0;
1068c2c66affSColin Finck UCHAR LogicalBlockByte1;
1069c2c66affSColin Finck UCHAR LogicalBlockByte2;
1070c2c66affSColin Finck UCHAR LogicalBlockByte3;
1071c2c66affSColin Finck UCHAR Reserved2;
1072c2c66affSColin Finck UCHAR TransferBlocksMsb;
1073c2c66affSColin Finck UCHAR TransferBlocksLsb;
1074c2c66affSColin Finck UCHAR Control;
1075c2c66affSColin Finck } CDB10, *PCDB10;
1076c2c66affSColin Finck struct _CDB12 {
1077c2c66affSColin Finck UCHAR OperationCode;
1078c2c66affSColin Finck UCHAR RelativeAddress:1;
1079c2c66affSColin Finck UCHAR Reserved1:2;
1080c2c66affSColin Finck UCHAR ForceUnitAccess:1;
1081c2c66affSColin Finck UCHAR DisablePageOut:1;
1082c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1083c2c66affSColin Finck UCHAR LogicalBlock[4];
1084c2c66affSColin Finck UCHAR TransferLength[4];
1085c2c66affSColin Finck UCHAR Reserved2;
1086c2c66affSColin Finck UCHAR Control;
1087c2c66affSColin Finck } CDB12, *PCDB12;
1088c2c66affSColin Finck struct _CDB16 {
1089c2c66affSColin Finck UCHAR OperationCode;
1090c2c66affSColin Finck UCHAR Reserved1:3;
1091c2c66affSColin Finck UCHAR ForceUnitAccess:1;
1092c2c66affSColin Finck UCHAR DisablePageOut:1;
1093c2c66affSColin Finck UCHAR Protection:3;
1094c2c66affSColin Finck UCHAR LogicalBlock[8];
1095c2c66affSColin Finck UCHAR TransferLength[4];
1096c2c66affSColin Finck UCHAR Reserved2;
1097c2c66affSColin Finck UCHAR Control;
1098c2c66affSColin Finck } CDB16, *PCDB16;
1099c2c66affSColin Finck struct _PAUSE_RESUME {
1100c2c66affSColin Finck UCHAR OperationCode;
1101c2c66affSColin Finck UCHAR Reserved1:5;
1102c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1103c2c66affSColin Finck UCHAR Reserved2[6];
1104c2c66affSColin Finck UCHAR Action;
1105c2c66affSColin Finck UCHAR Control;
1106c2c66affSColin Finck } PAUSE_RESUME, *PPAUSE_RESUME;
1107c2c66affSColin Finck struct _READ_TOC {
1108c2c66affSColin Finck UCHAR OperationCode;
1109c2c66affSColin Finck UCHAR Reserved0:1;
1110c2c66affSColin Finck UCHAR Msf:1;
1111c2c66affSColin Finck UCHAR Reserved1:3;
1112c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1113c2c66affSColin Finck UCHAR Format2:4;
1114c2c66affSColin Finck UCHAR Reserved2:4;
1115c2c66affSColin Finck UCHAR Reserved3[3];
1116c2c66affSColin Finck UCHAR StartingTrack;
1117c2c66affSColin Finck UCHAR AllocationLength[2];
1118c2c66affSColin Finck UCHAR Control:6;
1119c2c66affSColin Finck UCHAR Format:2;
1120c2c66affSColin Finck } READ_TOC, *PREAD_TOC;
1121c2c66affSColin Finck struct _READ_DISK_INFORMATION {
1122c2c66affSColin Finck UCHAR OperationCode;
1123c2c66affSColin Finck UCHAR Reserved1:5;
1124c2c66affSColin Finck UCHAR Lun:3;
1125c2c66affSColin Finck UCHAR Reserved2[5];
1126c2c66affSColin Finck UCHAR AllocationLength[2];
1127c2c66affSColin Finck UCHAR Control;
1128c2c66affSColin Finck } READ_DISK_INFORMATION, *PREAD_DISK_INFORMATION;
1129c2c66affSColin Finck struct _READ_TRACK_INFORMATION {
1130c2c66affSColin Finck UCHAR OperationCode;
1131c2c66affSColin Finck UCHAR Track:1;
1132c2c66affSColin Finck UCHAR Reserved1:3;
1133c2c66affSColin Finck UCHAR Reserved2:1;
1134c2c66affSColin Finck UCHAR Lun:3;
1135c2c66affSColin Finck UCHAR BlockAddress[4];
1136c2c66affSColin Finck UCHAR Reserved3;
1137c2c66affSColin Finck UCHAR AllocationLength[2];
1138c2c66affSColin Finck UCHAR Control;
1139c2c66affSColin Finck } READ_TRACK_INFORMATION, *PREAD_TRACK_INFORMATION;
1140c2c66affSColin Finck struct _RESERVE_TRACK_RZONE {
1141c2c66affSColin Finck UCHAR OperationCode;
1142c2c66affSColin Finck UCHAR Reserved1[4];
1143c2c66affSColin Finck UCHAR ReservationSize[4];
1144c2c66affSColin Finck UCHAR Control;
1145c2c66affSColin Finck } RESERVE_TRACK_RZONE, *PRESERVE_TRACK_RZONE;
1146c2c66affSColin Finck struct _SEND_OPC_INFORMATION {
1147c2c66affSColin Finck UCHAR OperationCode;
1148c2c66affSColin Finck UCHAR DoOpc:1;
1149c2c66affSColin Finck UCHAR Reserved1:7;
1150c2c66affSColin Finck UCHAR Exclude0:1;
1151c2c66affSColin Finck UCHAR Exclude1:1;
1152c2c66affSColin Finck UCHAR Reserved2:6;
1153c2c66affSColin Finck UCHAR Reserved3[4];
1154c2c66affSColin Finck UCHAR ParameterListLength[2];
1155c2c66affSColin Finck UCHAR Reserved4;
1156c2c66affSColin Finck } SEND_OPC_INFORMATION, *PSEND_OPC_INFORMATION;
1157c2c66affSColin Finck struct _REPAIR_TRACK {
1158c2c66affSColin Finck UCHAR OperationCode;
1159c2c66affSColin Finck UCHAR Immediate:1;
1160c2c66affSColin Finck UCHAR Reserved1:7;
1161c2c66affSColin Finck UCHAR Reserved2[2];
1162c2c66affSColin Finck UCHAR TrackNumber[2];
1163c2c66affSColin Finck UCHAR Reserved3[3];
1164c2c66affSColin Finck UCHAR Control;
1165c2c66affSColin Finck } REPAIR_TRACK, *PREPAIR_TRACK;
1166c2c66affSColin Finck struct _CLOSE_TRACK {
1167c2c66affSColin Finck UCHAR OperationCode;
1168c2c66affSColin Finck UCHAR Immediate:1;
1169c2c66affSColin Finck UCHAR Reserved1:7;
1170c2c66affSColin Finck UCHAR Track:1;
1171c2c66affSColin Finck UCHAR Session:1;
1172c2c66affSColin Finck UCHAR Reserved2:6;
1173c2c66affSColin Finck UCHAR Reserved3;
1174c2c66affSColin Finck UCHAR TrackNumber[2];
1175c2c66affSColin Finck UCHAR Reserved4[3];
1176c2c66affSColin Finck UCHAR Control;
1177c2c66affSColin Finck } CLOSE_TRACK, *PCLOSE_TRACK;
1178c2c66affSColin Finck struct _READ_BUFFER_CAPACITY {
1179c2c66affSColin Finck UCHAR OperationCode;
1180c2c66affSColin Finck UCHAR BlockInfo:1;
1181c2c66affSColin Finck UCHAR Reserved1:7;
1182c2c66affSColin Finck UCHAR Reserved2[5];
1183c2c66affSColin Finck UCHAR AllocationLength[2];
1184c2c66affSColin Finck UCHAR Control;
1185c2c66affSColin Finck } READ_BUFFER_CAPACITY, *PREAD_BUFFER_CAPACITY;
1186c2c66affSColin Finck struct _SEND_CUE_SHEET {
1187c2c66affSColin Finck UCHAR OperationCode;
1188c2c66affSColin Finck UCHAR Reserved[5];
1189c2c66affSColin Finck UCHAR CueSheetSize[3];
1190c2c66affSColin Finck UCHAR Control;
1191c2c66affSColin Finck } SEND_CUE_SHEET, *PSEND_CUE_SHEET;
1192c2c66affSColin Finck struct _READ_HEADER {
1193c2c66affSColin Finck UCHAR OperationCode;
1194c2c66affSColin Finck UCHAR Reserved1:1;
1195c2c66affSColin Finck UCHAR Msf:1;
1196c2c66affSColin Finck UCHAR Reserved2:3;
1197c2c66affSColin Finck UCHAR Lun:3;
1198c2c66affSColin Finck UCHAR LogicalBlockAddress[4];
1199c2c66affSColin Finck UCHAR Reserved3;
1200c2c66affSColin Finck UCHAR AllocationLength[2];
1201c2c66affSColin Finck UCHAR Control;
1202c2c66affSColin Finck } READ_HEADER, *PREAD_HEADER;
1203c2c66affSColin Finck struct _PLAY_AUDIO {
1204c2c66affSColin Finck UCHAR OperationCode;
1205c2c66affSColin Finck UCHAR Reserved1:5;
1206c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1207c2c66affSColin Finck UCHAR StartingBlockAddress[4];
1208c2c66affSColin Finck UCHAR Reserved2;
1209c2c66affSColin Finck UCHAR PlayLength[2];
1210c2c66affSColin Finck UCHAR Control;
1211c2c66affSColin Finck } PLAY_AUDIO, *PPLAY_AUDIO;
1212c2c66affSColin Finck struct _PLAY_AUDIO_MSF {
1213c2c66affSColin Finck UCHAR OperationCode;
1214c2c66affSColin Finck UCHAR Reserved1:5;
1215c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1216c2c66affSColin Finck UCHAR Reserved2;
1217c2c66affSColin Finck UCHAR StartingM;
1218c2c66affSColin Finck UCHAR StartingS;
1219c2c66affSColin Finck UCHAR StartingF;
1220c2c66affSColin Finck UCHAR EndingM;
1221c2c66affSColin Finck UCHAR EndingS;
1222c2c66affSColin Finck UCHAR EndingF;
1223c2c66affSColin Finck UCHAR Control;
1224c2c66affSColin Finck } PLAY_AUDIO_MSF, *PPLAY_AUDIO_MSF;
1225c2c66affSColin Finck struct _BLANK_MEDIA {
1226c2c66affSColin Finck UCHAR OperationCode;
1227c2c66affSColin Finck UCHAR BlankType:3;
1228c2c66affSColin Finck UCHAR Reserved1:1;
1229c2c66affSColin Finck UCHAR Immediate:1;
1230c2c66affSColin Finck UCHAR Reserved2:3;
1231c2c66affSColin Finck UCHAR AddressOrTrack[4];
1232c2c66affSColin Finck UCHAR Reserved3[5];
1233c2c66affSColin Finck UCHAR Control;
1234c2c66affSColin Finck } BLANK_MEDIA, *PBLANK_MEDIA;
1235c2c66affSColin Finck struct _PLAY_CD {
1236c2c66affSColin Finck UCHAR OperationCode;
1237c2c66affSColin Finck UCHAR Reserved1:1;
1238c2c66affSColin Finck UCHAR CMSF:1;
1239c2c66affSColin Finck UCHAR ExpectedSectorType:3;
1240c2c66affSColin Finck UCHAR Lun:3;
1241c2c66affSColin Finck _ANONYMOUS_UNION union {
1242c2c66affSColin Finck struct _LBA {
1243c2c66affSColin Finck UCHAR StartingBlockAddress[4];
1244c2c66affSColin Finck UCHAR PlayLength[4];
1245c2c66affSColin Finck } LBA;
1246c2c66affSColin Finck struct _MSF {
1247c2c66affSColin Finck UCHAR Reserved1;
1248c2c66affSColin Finck UCHAR StartingM;
1249c2c66affSColin Finck UCHAR StartingS;
1250c2c66affSColin Finck UCHAR StartingF;
1251c2c66affSColin Finck UCHAR EndingM;
1252c2c66affSColin Finck UCHAR EndingS;
1253c2c66affSColin Finck UCHAR EndingF;
1254c2c66affSColin Finck UCHAR Reserved2;
1255c2c66affSColin Finck } MSF;
1256c2c66affSColin Finck } DUMMYUNIONNAME;
1257c2c66affSColin Finck UCHAR Audio:1;
1258c2c66affSColin Finck UCHAR Composite:1;
1259c2c66affSColin Finck UCHAR Port1:1;
1260c2c66affSColin Finck UCHAR Port2:1;
1261c2c66affSColin Finck UCHAR Reserved2:3;
1262c2c66affSColin Finck UCHAR Speed:1;
1263c2c66affSColin Finck UCHAR Control;
1264c2c66affSColin Finck } PLAY_CD, *PPLAY_CD;
1265c2c66affSColin Finck struct _SCAN_CD {
1266c2c66affSColin Finck UCHAR OperationCode;
1267c2c66affSColin Finck UCHAR RelativeAddress:1;
1268c2c66affSColin Finck UCHAR Reserved1:3;
1269c2c66affSColin Finck UCHAR Direct:1;
1270c2c66affSColin Finck UCHAR Lun:3;
1271c2c66affSColin Finck UCHAR StartingAddress[4];
1272c2c66affSColin Finck UCHAR Reserved2[3];
1273c2c66affSColin Finck UCHAR Reserved3:6;
1274c2c66affSColin Finck UCHAR Type:2;
1275c2c66affSColin Finck UCHAR Reserved4;
1276c2c66affSColin Finck UCHAR Control;
1277c2c66affSColin Finck } SCAN_CD, *PSCAN_CD;
1278c2c66affSColin Finck struct _STOP_PLAY_SCAN {
1279c2c66affSColin Finck UCHAR OperationCode;
1280c2c66affSColin Finck UCHAR Reserved1:5;
1281c2c66affSColin Finck UCHAR Lun:3;
1282c2c66affSColin Finck UCHAR Reserved2[7];
1283c2c66affSColin Finck UCHAR Control;
1284c2c66affSColin Finck } STOP_PLAY_SCAN, *PSTOP_PLAY_SCAN;
1285c2c66affSColin Finck struct _SUBCHANNEL {
1286c2c66affSColin Finck UCHAR OperationCode;
1287c2c66affSColin Finck UCHAR Reserved0:1;
1288c2c66affSColin Finck UCHAR Msf:1;
1289c2c66affSColin Finck UCHAR Reserved1:3;
1290c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1291c2c66affSColin Finck UCHAR Reserved2:6;
1292c2c66affSColin Finck UCHAR SubQ:1;
1293c2c66affSColin Finck UCHAR Reserved3:1;
1294c2c66affSColin Finck UCHAR Format;
1295c2c66affSColin Finck UCHAR Reserved4[2];
1296c2c66affSColin Finck UCHAR TrackNumber;
1297c2c66affSColin Finck UCHAR AllocationLength[2];
1298c2c66affSColin Finck UCHAR Control;
1299c2c66affSColin Finck } SUBCHANNEL, *PSUBCHANNEL;
1300c2c66affSColin Finck struct _READ_CD {
1301c2c66affSColin Finck UCHAR OperationCode;
1302c2c66affSColin Finck UCHAR RelativeAddress:1;
1303c2c66affSColin Finck UCHAR Reserved0:1;
1304c2c66affSColin Finck UCHAR ExpectedSectorType:3;
1305c2c66affSColin Finck UCHAR Lun:3;
1306c2c66affSColin Finck UCHAR StartingLBA[4];
1307c2c66affSColin Finck UCHAR TransferBlocks[3];
1308c2c66affSColin Finck UCHAR Reserved2:1;
1309c2c66affSColin Finck UCHAR ErrorFlags:2;
1310c2c66affSColin Finck UCHAR IncludeEDC:1;
1311c2c66affSColin Finck UCHAR IncludeUserData:1;
1312c2c66affSColin Finck UCHAR HeaderCode:2;
1313c2c66affSColin Finck UCHAR IncludeSyncData:1;
1314c2c66affSColin Finck UCHAR SubChannelSelection:3;
1315c2c66affSColin Finck UCHAR Reserved3:5;
1316c2c66affSColin Finck UCHAR Control;
1317c2c66affSColin Finck } READ_CD, *PREAD_CD;
1318c2c66affSColin Finck struct _READ_CD_MSF {
1319c2c66affSColin Finck UCHAR OperationCode;
1320c2c66affSColin Finck UCHAR RelativeAddress:1;
1321c2c66affSColin Finck UCHAR Reserved1:1;
1322c2c66affSColin Finck UCHAR ExpectedSectorType:3;
1323c2c66affSColin Finck UCHAR Lun:3;
1324c2c66affSColin Finck UCHAR Reserved2;
1325c2c66affSColin Finck UCHAR StartingM;
1326c2c66affSColin Finck UCHAR StartingS;
1327c2c66affSColin Finck UCHAR StartingF;
1328c2c66affSColin Finck UCHAR EndingM;
1329c2c66affSColin Finck UCHAR EndingS;
1330c2c66affSColin Finck UCHAR EndingF;
1331c2c66affSColin Finck UCHAR Reserved3;
1332c2c66affSColin Finck UCHAR Reserved4:1;
1333c2c66affSColin Finck UCHAR ErrorFlags:2;
1334c2c66affSColin Finck UCHAR IncludeEDC:1;
1335c2c66affSColin Finck UCHAR IncludeUserData:1;
1336c2c66affSColin Finck UCHAR HeaderCode:2;
1337c2c66affSColin Finck UCHAR IncludeSyncData:1;
1338c2c66affSColin Finck UCHAR SubChannelSelection:3;
1339c2c66affSColin Finck UCHAR Reserved5:5;
1340c2c66affSColin Finck UCHAR Control;
1341c2c66affSColin Finck } READ_CD_MSF, *PREAD_CD_MSF;
1342c2c66affSColin Finck struct _PLXTR_READ_CDDA {
1343c2c66affSColin Finck UCHAR OperationCode;
1344c2c66affSColin Finck UCHAR Reserved0:5;
1345c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1346c2c66affSColin Finck UCHAR LogicalBlockByte0;
1347c2c66affSColin Finck UCHAR LogicalBlockByte1;
1348c2c66affSColin Finck UCHAR LogicalBlockByte2;
1349c2c66affSColin Finck UCHAR LogicalBlockByte3;
1350c2c66affSColin Finck UCHAR TransferBlockByte0;
1351c2c66affSColin Finck UCHAR TransferBlockByte1;
1352c2c66affSColin Finck UCHAR TransferBlockByte2;
1353c2c66affSColin Finck UCHAR TransferBlockByte3;
1354c2c66affSColin Finck UCHAR SubCode;
1355c2c66affSColin Finck UCHAR Control;
1356c2c66affSColin Finck } PLXTR_READ_CDDA, *PPLXTR_READ_CDDA;
1357c2c66affSColin Finck struct _NEC_READ_CDDA {
1358c2c66affSColin Finck UCHAR OperationCode;
1359c2c66affSColin Finck UCHAR Reserved0;
1360c2c66affSColin Finck UCHAR LogicalBlockByte0;
1361c2c66affSColin Finck UCHAR LogicalBlockByte1;
1362c2c66affSColin Finck UCHAR LogicalBlockByte2;
1363c2c66affSColin Finck UCHAR LogicalBlockByte3;
1364c2c66affSColin Finck UCHAR Reserved1;
1365c2c66affSColin Finck UCHAR TransferBlockByte0;
1366c2c66affSColin Finck UCHAR TransferBlockByte1;
1367c2c66affSColin Finck UCHAR Control;
1368c2c66affSColin Finck } NEC_READ_CDDA, *PNEC_READ_CDDA;
13693da77f91SVictor Perevertkin #if (NTDDI_VERSION >= NTDDI_WIN8)
13703da77f91SVictor Perevertkin struct _MODE_SENSE {
13713da77f91SVictor Perevertkin UCHAR OperationCode;
13723da77f91SVictor Perevertkin UCHAR Reserved1:3;
13733da77f91SVictor Perevertkin UCHAR Dbd:1;
13743da77f91SVictor Perevertkin UCHAR Reserved2:4;
13753da77f91SVictor Perevertkin UCHAR PageCode:6;
13763da77f91SVictor Perevertkin UCHAR Pc:2;
13773da77f91SVictor Perevertkin UCHAR SubPageCode;
13783da77f91SVictor Perevertkin UCHAR AllocationLength;
13793da77f91SVictor Perevertkin UCHAR Control;
13803da77f91SVictor Perevertkin } MODE_SENSE;
13813da77f91SVictor Perevertkin struct _MODE_SENSE10 {
13823da77f91SVictor Perevertkin UCHAR OperationCode;
13833da77f91SVictor Perevertkin UCHAR Reserved1:3;
13843da77f91SVictor Perevertkin UCHAR Dbd:1;
13853da77f91SVictor Perevertkin UCHAR LongLBAAccepted:1;
13863da77f91SVictor Perevertkin UCHAR Reserved2:3;
13873da77f91SVictor Perevertkin UCHAR PageCode:6;
13883da77f91SVictor Perevertkin UCHAR Pc:2;
13893da77f91SVictor Perevertkin UCHAR SubPageCode;
13903da77f91SVictor Perevertkin UCHAR Reserved3[3];
13913da77f91SVictor Perevertkin UCHAR AllocationLength[2];
13923da77f91SVictor Perevertkin UCHAR Control;
13933da77f91SVictor Perevertkin } MODE_SENSE10;
13943da77f91SVictor Perevertkin #else
1395c2c66affSColin Finck struct _MODE_SENSE {
1396c2c66affSColin Finck UCHAR OperationCode;
1397c2c66affSColin Finck UCHAR Reserved1:3;
1398c2c66affSColin Finck UCHAR Dbd:1;
1399c2c66affSColin Finck UCHAR Reserved2:1;
1400c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1401c2c66affSColin Finck UCHAR PageCode:6;
1402c2c66affSColin Finck UCHAR Pc:2;
1403c2c66affSColin Finck UCHAR Reserved3;
1404c2c66affSColin Finck UCHAR AllocationLength;
1405c2c66affSColin Finck UCHAR Control;
1406c2c66affSColin Finck } MODE_SENSE, *PMODE_SENSE;
1407c2c66affSColin Finck struct _MODE_SENSE10 {
1408c2c66affSColin Finck UCHAR OperationCode;
1409c2c66affSColin Finck UCHAR Reserved1:3;
1410c2c66affSColin Finck UCHAR Dbd:1;
1411c2c66affSColin Finck UCHAR Reserved2:1;
1412c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1413c2c66affSColin Finck UCHAR PageCode:6;
1414c2c66affSColin Finck UCHAR Pc:2;
1415c2c66affSColin Finck UCHAR Reserved3[4];
1416c2c66affSColin Finck UCHAR AllocationLength[2];
1417c2c66affSColin Finck UCHAR Control;
1418c2c66affSColin Finck } MODE_SENSE10, *PMODE_SENSE10;
14193da77f91SVictor Perevertkin #endif
1420c2c66affSColin Finck struct _MODE_SELECT {
1421c2c66affSColin Finck UCHAR OperationCode;
1422c2c66affSColin Finck UCHAR SPBit:1;
1423c2c66affSColin Finck UCHAR Reserved1:3;
1424c2c66affSColin Finck UCHAR PFBit:1;
1425c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1426c2c66affSColin Finck UCHAR Reserved2[2];
1427c2c66affSColin Finck UCHAR ParameterListLength;
1428c2c66affSColin Finck UCHAR Control;
1429c2c66affSColin Finck } MODE_SELECT, *PMODE_SELECT;
1430c2c66affSColin Finck struct _MODE_SELECT10 {
1431c2c66affSColin Finck UCHAR OperationCode;
1432c2c66affSColin Finck UCHAR SPBit:1;
1433c2c66affSColin Finck UCHAR Reserved1:3;
1434c2c66affSColin Finck UCHAR PFBit:1;
1435c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1436c2c66affSColin Finck UCHAR Reserved2[5];
1437c2c66affSColin Finck UCHAR ParameterListLength[2];
1438c2c66affSColin Finck UCHAR Control;
1439c2c66affSColin Finck } MODE_SELECT10, *PMODE_SELECT10;
1440c2c66affSColin Finck struct _LOCATE {
1441c2c66affSColin Finck UCHAR OperationCode;
1442c2c66affSColin Finck UCHAR Immediate:1;
1443c2c66affSColin Finck UCHAR CPBit:1;
1444c2c66affSColin Finck UCHAR BTBit:1;
1445c2c66affSColin Finck UCHAR Reserved1:2;
1446c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1447c2c66affSColin Finck UCHAR Reserved3;
1448c2c66affSColin Finck UCHAR LogicalBlockAddress[4];
1449c2c66affSColin Finck UCHAR Reserved4;
1450c2c66affSColin Finck UCHAR Partition;
1451c2c66affSColin Finck UCHAR Control;
1452c2c66affSColin Finck } LOCATE, *PLOCATE;
1453c2c66affSColin Finck struct _LOGSENSE {
1454c2c66affSColin Finck UCHAR OperationCode;
1455c2c66affSColin Finck UCHAR SPBit:1;
1456c2c66affSColin Finck UCHAR PPCBit:1;
1457c2c66affSColin Finck UCHAR Reserved1:3;
1458c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1459c2c66affSColin Finck UCHAR PageCode:6;
1460c2c66affSColin Finck UCHAR PCBit:2;
1461c2c66affSColin Finck UCHAR Reserved2;
1462c2c66affSColin Finck UCHAR Reserved3;
1463c2c66affSColin Finck UCHAR ParameterPointer[2];
1464c2c66affSColin Finck UCHAR AllocationLength[2];
1465c2c66affSColin Finck UCHAR Control;
1466c2c66affSColin Finck } LOGSENSE, *PLOGSENSE;
1467c2c66affSColin Finck struct _LOGSELECT {
1468c2c66affSColin Finck UCHAR OperationCode;
1469c2c66affSColin Finck UCHAR SPBit:1;
1470c2c66affSColin Finck UCHAR PCRBit:1;
1471c2c66affSColin Finck UCHAR Reserved1:3;
1472c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1473c2c66affSColin Finck UCHAR Reserved:6;
1474c2c66affSColin Finck UCHAR PCBit:2;
1475c2c66affSColin Finck UCHAR Reserved2[4];
1476c2c66affSColin Finck UCHAR ParameterListLength[2];
1477c2c66affSColin Finck UCHAR Control;
1478c2c66affSColin Finck } LOGSELECT, *PLOGSELECT;
1479c2c66affSColin Finck struct _PRINT {
1480c2c66affSColin Finck UCHAR OperationCode;
1481c2c66affSColin Finck UCHAR Reserved:5;
1482c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1483c2c66affSColin Finck UCHAR TransferLength[3];
1484c2c66affSColin Finck UCHAR Control;
1485c2c66affSColin Finck } PRINT, *PPRINT;
1486c2c66affSColin Finck struct _SEEK {
1487c2c66affSColin Finck UCHAR OperationCode;
1488c2c66affSColin Finck UCHAR Reserved1:5;
1489c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1490c2c66affSColin Finck UCHAR LogicalBlockAddress[4];
1491c2c66affSColin Finck UCHAR Reserved2[3];
1492c2c66affSColin Finck UCHAR Control;
1493c2c66affSColin Finck } SEEK, *PSEEK;
1494c2c66affSColin Finck struct _ERASE {
1495c2c66affSColin Finck UCHAR OperationCode;
1496c2c66affSColin Finck UCHAR Long:1;
1497c2c66affSColin Finck UCHAR Immediate:1;
1498c2c66affSColin Finck UCHAR Reserved1:3;
1499c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1500c2c66affSColin Finck UCHAR Reserved2[3];
1501c2c66affSColin Finck UCHAR Control;
1502c2c66affSColin Finck } ERASE, *PERASE;
1503c2c66affSColin Finck struct _START_STOP {
1504c2c66affSColin Finck UCHAR OperationCode;
1505c2c66affSColin Finck UCHAR Immediate:1;
1506c2c66affSColin Finck UCHAR Reserved1:4;
1507c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1508c2c66affSColin Finck UCHAR Reserved2[2];
1509c2c66affSColin Finck UCHAR Start:1;
1510c2c66affSColin Finck UCHAR LoadEject:1;
1511c2c66affSColin Finck UCHAR Reserved3:6;
1512c2c66affSColin Finck UCHAR Control;
1513c2c66affSColin Finck } START_STOP, *PSTART_STOP;
1514c2c66affSColin Finck struct _MEDIA_REMOVAL {
1515c2c66affSColin Finck UCHAR OperationCode;
1516c2c66affSColin Finck UCHAR Reserved1:5;
1517c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1518c2c66affSColin Finck UCHAR Reserved2[2];
1519c2c66affSColin Finck UCHAR Prevent:1;
1520c2c66affSColin Finck UCHAR Persistant:1;
1521c2c66affSColin Finck UCHAR Reserved3:6;
1522c2c66affSColin Finck UCHAR Control;
1523c2c66affSColin Finck } MEDIA_REMOVAL, *PMEDIA_REMOVAL;
1524c2c66affSColin Finck struct _SEEK_BLOCK {
1525c2c66affSColin Finck UCHAR OperationCode;
1526c2c66affSColin Finck UCHAR Immediate:1;
1527c2c66affSColin Finck UCHAR Reserved1:7;
1528c2c66affSColin Finck UCHAR BlockAddress[3];
1529c2c66affSColin Finck UCHAR Link:1;
1530c2c66affSColin Finck UCHAR Flag:1;
1531c2c66affSColin Finck UCHAR Reserved2:4;
1532c2c66affSColin Finck UCHAR VendorUnique:2;
1533c2c66affSColin Finck } SEEK_BLOCK, *PSEEK_BLOCK;
1534c2c66affSColin Finck struct _REQUEST_BLOCK_ADDRESS {
1535c2c66affSColin Finck UCHAR OperationCode;
1536c2c66affSColin Finck UCHAR Reserved1[3];
1537c2c66affSColin Finck UCHAR AllocationLength;
1538c2c66affSColin Finck UCHAR Link:1;
1539c2c66affSColin Finck UCHAR Flag:1;
1540c2c66affSColin Finck UCHAR Reserved2:4;
1541c2c66affSColin Finck UCHAR VendorUnique:2;
1542c2c66affSColin Finck } REQUEST_BLOCK_ADDRESS, *PREQUEST_BLOCK_ADDRESS;
1543c2c66affSColin Finck struct _PARTITION {
1544c2c66affSColin Finck UCHAR OperationCode;
1545c2c66affSColin Finck UCHAR Immediate:1;
1546c2c66affSColin Finck UCHAR Sel:1;
1547c2c66affSColin Finck UCHAR PartitionSelect:6;
1548c2c66affSColin Finck UCHAR Reserved1[3];
1549c2c66affSColin Finck UCHAR Control;
1550c2c66affSColin Finck } PARTITION, *PPARTITION;
1551c2c66affSColin Finck struct _WRITE_TAPE_MARKS {
1552c2c66affSColin Finck UCHAR OperationCode;
1553c2c66affSColin Finck UCHAR Immediate:1;
1554c2c66affSColin Finck UCHAR WriteSetMarks:1;
1555c2c66affSColin Finck UCHAR Reserved:3;
1556c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1557c2c66affSColin Finck UCHAR TransferLength[3];
1558c2c66affSColin Finck UCHAR Control;
1559c2c66affSColin Finck } WRITE_TAPE_MARKS, *PWRITE_TAPE_MARKS;
1560c2c66affSColin Finck struct _SPACE_TAPE_MARKS {
1561c2c66affSColin Finck UCHAR OperationCode;
1562c2c66affSColin Finck UCHAR Code:3;
1563c2c66affSColin Finck UCHAR Reserved:2;
1564c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1565c2c66affSColin Finck UCHAR NumMarksMSB;
1566c2c66affSColin Finck UCHAR NumMarks;
1567c2c66affSColin Finck UCHAR NumMarksLSB;
1568c2c66affSColin Finck union {
1569c2c66affSColin Finck UCHAR value;
1570c2c66affSColin Finck struct {
1571c2c66affSColin Finck UCHAR Link:1;
1572c2c66affSColin Finck UCHAR Flag:1;
1573c2c66affSColin Finck UCHAR Reserved:4;
1574c2c66affSColin Finck UCHAR VendorUnique:2;
1575c2c66affSColin Finck } Fields;
1576c2c66affSColin Finck } Byte6;
1577c2c66affSColin Finck } SPACE_TAPE_MARKS, *PSPACE_TAPE_MARKS;
1578c2c66affSColin Finck struct _READ_POSITION {
1579c2c66affSColin Finck UCHAR Operation;
1580c2c66affSColin Finck UCHAR BlockType:1;
1581c2c66affSColin Finck UCHAR Reserved1:4;
1582c2c66affSColin Finck UCHAR Lun:3;
1583c2c66affSColin Finck UCHAR Reserved2[7];
1584c2c66affSColin Finck UCHAR Control;
1585c2c66affSColin Finck } READ_POSITION, *PREAD_POSITION;
1586c2c66affSColin Finck struct _CDB6READWRITETAPE {
1587c2c66affSColin Finck UCHAR OperationCode;
1588c2c66affSColin Finck UCHAR VendorSpecific:5;
1589c2c66affSColin Finck UCHAR Reserved:3;
1590c2c66affSColin Finck UCHAR TransferLenMSB;
1591c2c66affSColin Finck UCHAR TransferLen;
1592c2c66affSColin Finck UCHAR TransferLenLSB;
1593c2c66affSColin Finck UCHAR Link:1;
1594c2c66affSColin Finck UCHAR Flag:1;
1595c2c66affSColin Finck UCHAR Reserved1:4;
1596c2c66affSColin Finck UCHAR VendorUnique:2;
1597c2c66affSColin Finck } CDB6READWRITETAPE, *PCDB6READWRITETAPE;
1598c2c66affSColin Finck struct _INIT_ELEMENT_STATUS {
1599c2c66affSColin Finck UCHAR OperationCode;
1600c2c66affSColin Finck UCHAR Reserved1:5;
1601c2c66affSColin Finck UCHAR LogicalUnitNubmer:3;
1602c2c66affSColin Finck UCHAR Reserved2[3];
1603c2c66affSColin Finck UCHAR Reserved3:7;
1604c2c66affSColin Finck UCHAR NoBarCode:1;
1605c2c66affSColin Finck } INIT_ELEMENT_STATUS, *PINIT_ELEMENT_STATUS;
1606c2c66affSColin Finck struct _INITIALIZE_ELEMENT_RANGE {
1607c2c66affSColin Finck UCHAR OperationCode;
1608c2c66affSColin Finck UCHAR Range:1;
1609c2c66affSColin Finck UCHAR Reserved1:4;
1610c2c66affSColin Finck UCHAR LogicalUnitNubmer:3;
1611c2c66affSColin Finck UCHAR FirstElementAddress[2];
1612c2c66affSColin Finck UCHAR Reserved2[2];
1613c2c66affSColin Finck UCHAR NumberOfElements[2];
1614c2c66affSColin Finck UCHAR Reserved3;
1615c2c66affSColin Finck UCHAR Reserved4:7;
1616c2c66affSColin Finck UCHAR NoBarCode:1;
1617c2c66affSColin Finck } INITIALIZE_ELEMENT_RANGE, *PINITIALIZE_ELEMENT_RANGE;
1618c2c66affSColin Finck struct _POSITION_TO_ELEMENT {
1619c2c66affSColin Finck UCHAR OperationCode;
1620c2c66affSColin Finck UCHAR Reserved1:5;
1621c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1622c2c66affSColin Finck UCHAR TransportElementAddress[2];
1623c2c66affSColin Finck UCHAR DestinationElementAddress[2];
1624c2c66affSColin Finck UCHAR Reserved2[2];
1625c2c66affSColin Finck UCHAR Flip:1;
1626c2c66affSColin Finck UCHAR Reserved3:7;
1627c2c66affSColin Finck UCHAR Control;
1628c2c66affSColin Finck } POSITION_TO_ELEMENT, *PPOSITION_TO_ELEMENT;
1629c2c66affSColin Finck struct _MOVE_MEDIUM {
1630c2c66affSColin Finck UCHAR OperationCode;
1631c2c66affSColin Finck UCHAR Reserved1:5;
1632c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1633c2c66affSColin Finck UCHAR TransportElementAddress[2];
1634c2c66affSColin Finck UCHAR SourceElementAddress[2];
1635c2c66affSColin Finck UCHAR DestinationElementAddress[2];
1636c2c66affSColin Finck UCHAR Reserved2[2];
1637c2c66affSColin Finck UCHAR Flip:1;
1638c2c66affSColin Finck UCHAR Reserved3:7;
1639c2c66affSColin Finck UCHAR Control;
1640c2c66affSColin Finck } MOVE_MEDIUM, *PMOVE_MEDIUM;
1641c2c66affSColin Finck struct _EXCHANGE_MEDIUM {
1642c2c66affSColin Finck UCHAR OperationCode;
1643c2c66affSColin Finck UCHAR Reserved1:5;
1644c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1645c2c66affSColin Finck UCHAR TransportElementAddress[2];
1646c2c66affSColin Finck UCHAR SourceElementAddress[2];
1647c2c66affSColin Finck UCHAR Destination1ElementAddress[2];
1648c2c66affSColin Finck UCHAR Destination2ElementAddress[2];
1649c2c66affSColin Finck UCHAR Flip1:1;
1650c2c66affSColin Finck UCHAR Flip2:1;
1651c2c66affSColin Finck UCHAR Reserved3:6;
1652c2c66affSColin Finck UCHAR Control;
1653c2c66affSColin Finck } EXCHANGE_MEDIUM, *PEXCHANGE_MEDIUM;
1654c2c66affSColin Finck struct _READ_ELEMENT_STATUS {
1655c2c66affSColin Finck UCHAR OperationCode;
1656c2c66affSColin Finck UCHAR ElementType:4;
1657c2c66affSColin Finck UCHAR VolTag:1;
1658c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1659c2c66affSColin Finck UCHAR StartingElementAddress[2];
1660c2c66affSColin Finck UCHAR NumberOfElements[2];
1661c2c66affSColin Finck UCHAR Reserved1;
1662c2c66affSColin Finck UCHAR AllocationLength[3];
1663c2c66affSColin Finck UCHAR Reserved2;
1664c2c66affSColin Finck UCHAR Control;
1665c2c66affSColin Finck } READ_ELEMENT_STATUS, *PREAD_ELEMENT_STATUS;
1666c2c66affSColin Finck struct _SEND_VOLUME_TAG {
1667c2c66affSColin Finck UCHAR OperationCode;
1668c2c66affSColin Finck UCHAR ElementType:4;
1669c2c66affSColin Finck UCHAR Reserved1:1;
1670c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1671c2c66affSColin Finck UCHAR StartingElementAddress[2];
1672c2c66affSColin Finck UCHAR Reserved2;
1673c2c66affSColin Finck UCHAR ActionCode:5;
1674c2c66affSColin Finck UCHAR Reserved3:3;
1675c2c66affSColin Finck UCHAR Reserved4[2];
1676c2c66affSColin Finck UCHAR ParameterListLength[2];
1677c2c66affSColin Finck UCHAR Reserved5;
1678c2c66affSColin Finck UCHAR Control;
1679c2c66affSColin Finck } SEND_VOLUME_TAG, *PSEND_VOLUME_TAG;
1680c2c66affSColin Finck struct _REQUEST_VOLUME_ELEMENT_ADDRESS {
1681c2c66affSColin Finck UCHAR OperationCode;
1682c2c66affSColin Finck UCHAR ElementType:4;
1683c2c66affSColin Finck UCHAR VolTag:1;
1684c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1685c2c66affSColin Finck UCHAR StartingElementAddress[2];
1686c2c66affSColin Finck UCHAR NumberElements[2];
1687c2c66affSColin Finck UCHAR Reserved1;
1688c2c66affSColin Finck UCHAR AllocationLength[3];
1689c2c66affSColin Finck UCHAR Reserved2;
1690c2c66affSColin Finck UCHAR Control;
1691c2c66affSColin Finck } REQUEST_VOLUME_ELEMENT_ADDRESS, *PREQUEST_VOLUME_ELEMENT_ADDRESS;
1692c2c66affSColin Finck struct _LOAD_UNLOAD {
1693c2c66affSColin Finck UCHAR OperationCode;
1694c2c66affSColin Finck UCHAR Immediate:1;
1695c2c66affSColin Finck UCHAR Reserved1:4;
1696c2c66affSColin Finck UCHAR Lun:3;
1697c2c66affSColin Finck UCHAR Reserved2[2];
1698c2c66affSColin Finck UCHAR Start:1;
1699c2c66affSColin Finck UCHAR LoadEject:1;
1700c2c66affSColin Finck UCHAR Reserved3:6;
1701c2c66affSColin Finck UCHAR Reserved4[3];
1702c2c66affSColin Finck UCHAR Slot;
1703c2c66affSColin Finck UCHAR Reserved5[3];
1704c2c66affSColin Finck } LOAD_UNLOAD, *PLOAD_UNLOAD;
1705c2c66affSColin Finck struct _MECH_STATUS {
1706c2c66affSColin Finck UCHAR OperationCode;
1707c2c66affSColin Finck UCHAR Reserved:5;
1708c2c66affSColin Finck UCHAR Lun:3;
1709c2c66affSColin Finck UCHAR Reserved1[6];
1710c2c66affSColin Finck UCHAR AllocationLength[2];
1711c2c66affSColin Finck UCHAR Reserved2[1];
1712c2c66affSColin Finck UCHAR Control;
1713c2c66affSColin Finck } MECH_STATUS, *PMECH_STATUS;
1714c2c66affSColin Finck struct _SYNCHRONIZE_CACHE10 {
1715c2c66affSColin Finck UCHAR OperationCode;
1716c2c66affSColin Finck UCHAR RelAddr:1;
1717c2c66affSColin Finck UCHAR Immediate:1;
1718c2c66affSColin Finck UCHAR Reserved:3;
1719c2c66affSColin Finck UCHAR Lun:3;
1720c2c66affSColin Finck UCHAR LogicalBlockAddress[4];
1721c2c66affSColin Finck UCHAR Reserved2;
1722c2c66affSColin Finck UCHAR BlockCount[2];
1723c2c66affSColin Finck UCHAR Control;
1724c2c66affSColin Finck } SYNCHRONIZE_CACHE10, *PSYNCHRONIZE_CACHE10;
1725c2c66affSColin Finck struct _GET_EVENT_STATUS_NOTIFICATION {
1726c2c66affSColin Finck UCHAR OperationCode;
1727c2c66affSColin Finck UCHAR Immediate:1;
1728c2c66affSColin Finck UCHAR Reserved:4;
1729c2c66affSColin Finck UCHAR Lun:3;
1730c2c66affSColin Finck UCHAR Reserved2[2];
1731c2c66affSColin Finck UCHAR NotificationClassRequest;
1732c2c66affSColin Finck UCHAR Reserved3[2];
1733c2c66affSColin Finck UCHAR EventListLength[2];
1734c2c66affSColin Finck UCHAR Control;
1735c2c66affSColin Finck } GET_EVENT_STATUS_NOTIFICATION, *PGET_EVENT_STATUS_NOTIFICATION;
1736c2c66affSColin Finck struct _GET_PERFORMANCE {
1737c2c66affSColin Finck UCHAR OperationCode;
1738c2c66affSColin Finck UCHAR Except:2;
1739c2c66affSColin Finck UCHAR Write:1;
1740c2c66affSColin Finck UCHAR Tolerance:2;
1741c2c66affSColin Finck UCHAR Reserved0:3;
1742c2c66affSColin Finck UCHAR StartingLBA[4];
1743c2c66affSColin Finck UCHAR Reserved1[2];
1744c2c66affSColin Finck UCHAR MaximumNumberOfDescriptors[2];
1745c2c66affSColin Finck UCHAR Type;
1746c2c66affSColin Finck UCHAR Control;
1747c2c66affSColin Finck } GET_PERFORMANCE;
1748c2c66affSColin Finck struct _READ_DVD_STRUCTURE {
1749c2c66affSColin Finck UCHAR OperationCode;
1750c2c66affSColin Finck UCHAR Reserved1:5;
1751c2c66affSColin Finck UCHAR Lun:3;
1752c2c66affSColin Finck UCHAR RMDBlockNumber[4];
1753c2c66affSColin Finck UCHAR LayerNumber;
1754c2c66affSColin Finck UCHAR Format;
1755c2c66affSColin Finck UCHAR AllocationLength[2];
1756c2c66affSColin Finck UCHAR Reserved3:6;
1757c2c66affSColin Finck UCHAR AGID:2;
1758c2c66affSColin Finck UCHAR Control;
1759c2c66affSColin Finck } READ_DVD_STRUCTURE, *PREAD_DVD_STRUCTURE;
1760c2c66affSColin Finck struct _SET_STREAMING {
1761c2c66affSColin Finck UCHAR OperationCode;
1762c2c66affSColin Finck UCHAR Reserved[8];
1763c2c66affSColin Finck UCHAR ParameterListLength[2];
1764c2c66affSColin Finck UCHAR Control;
1765c2c66affSColin Finck } SET_STREAMING;
1766c2c66affSColin Finck struct _SEND_DVD_STRUCTURE {
1767c2c66affSColin Finck UCHAR OperationCode;
1768c2c66affSColin Finck UCHAR Reserved1:5;
1769c2c66affSColin Finck UCHAR Lun:3;
1770c2c66affSColin Finck UCHAR Reserved2[5];
1771c2c66affSColin Finck UCHAR Format;
1772c2c66affSColin Finck UCHAR ParameterListLength[2];
1773c2c66affSColin Finck UCHAR Reserved3;
1774c2c66affSColin Finck UCHAR Control;
1775c2c66affSColin Finck } SEND_DVD_STRUCTURE, *PSEND_DVD_STRUCTURE;
1776c2c66affSColin Finck struct _SEND_KEY {
1777c2c66affSColin Finck UCHAR OperationCode;
1778c2c66affSColin Finck UCHAR Reserved1:5;
1779c2c66affSColin Finck UCHAR Lun:3;
1780c2c66affSColin Finck UCHAR Reserved2[6];
1781c2c66affSColin Finck UCHAR ParameterListLength[2];
1782c2c66affSColin Finck UCHAR KeyFormat:6;
1783c2c66affSColin Finck UCHAR AGID:2;
1784c2c66affSColin Finck UCHAR Control;
1785c2c66affSColin Finck } SEND_KEY, *PSEND_KEY;
1786c2c66affSColin Finck struct _REPORT_KEY {
1787c2c66affSColin Finck UCHAR OperationCode;
1788c2c66affSColin Finck UCHAR Reserved1:5;
1789c2c66affSColin Finck UCHAR Lun:3;
1790c2c66affSColin Finck UCHAR LogicalBlockAddress[4];
1791c2c66affSColin Finck UCHAR Reserved2[2];
1792c2c66affSColin Finck UCHAR AllocationLength[2];
1793c2c66affSColin Finck UCHAR KeyFormat:6;
1794c2c66affSColin Finck UCHAR AGID:2;
1795c2c66affSColin Finck UCHAR Control;
1796c2c66affSColin Finck } REPORT_KEY, *PREPORT_KEY;
1797c2c66affSColin Finck struct _SET_READ_AHEAD {
1798c2c66affSColin Finck UCHAR OperationCode;
1799c2c66affSColin Finck UCHAR Reserved1:5;
1800c2c66affSColin Finck UCHAR Lun:3;
1801c2c66affSColin Finck UCHAR TriggerLBA[4];
1802c2c66affSColin Finck UCHAR ReadAheadLBA[4];
1803c2c66affSColin Finck UCHAR Reserved2;
1804c2c66affSColin Finck UCHAR Control;
1805c2c66affSColin Finck } SET_READ_AHEAD, *PSET_READ_AHEAD;
1806c2c66affSColin Finck struct _READ_FORMATTED_CAPACITIES {
1807c2c66affSColin Finck UCHAR OperationCode;
1808c2c66affSColin Finck UCHAR Reserved1:5;
1809c2c66affSColin Finck UCHAR Lun:3;
1810c2c66affSColin Finck UCHAR Reserved2[5];
1811c2c66affSColin Finck UCHAR AllocationLength[2];
1812c2c66affSColin Finck UCHAR Control;
1813c2c66affSColin Finck } READ_FORMATTED_CAPACITIES, *PREAD_FORMATTED_CAPACITIES;
1814c2c66affSColin Finck struct _REPORT_LUNS {
1815c2c66affSColin Finck UCHAR OperationCode;
1816c2c66affSColin Finck UCHAR Reserved1[5];
1817c2c66affSColin Finck UCHAR AllocationLength[4];
1818c2c66affSColin Finck UCHAR Reserved2[1];
1819c2c66affSColin Finck UCHAR Control;
1820c2c66affSColin Finck } REPORT_LUNS, *PREPORT_LUNS;
1821c2c66affSColin Finck struct _PERSISTENT_RESERVE_IN {
1822c2c66affSColin Finck UCHAR OperationCode;
1823c2c66affSColin Finck UCHAR ServiceAction:5;
1824c2c66affSColin Finck UCHAR Reserved1:3;
1825c2c66affSColin Finck UCHAR Reserved2[5];
1826c2c66affSColin Finck UCHAR AllocationLength[2];
1827c2c66affSColin Finck UCHAR Control;
1828c2c66affSColin Finck } PERSISTENT_RESERVE_IN, *PPERSISTENT_RESERVE_IN;
1829c2c66affSColin Finck struct _PERSISTENT_RESERVE_OUT {
1830c2c66affSColin Finck UCHAR OperationCode;
1831c2c66affSColin Finck UCHAR ServiceAction:5;
1832c2c66affSColin Finck UCHAR Reserved1:3;
1833c2c66affSColin Finck UCHAR Type:4;
1834c2c66affSColin Finck UCHAR Scope:4;
1835c2c66affSColin Finck UCHAR Reserved2[4];
1836c2c66affSColin Finck UCHAR ParameterListLength[2];
1837c2c66affSColin Finck UCHAR Control;
1838c2c66affSColin Finck } PERSISTENT_RESERVE_OUT, *PPERSISTENT_RESERVE_OUT;
1839c2c66affSColin Finck struct _GET_CONFIGURATION {
1840c2c66affSColin Finck UCHAR OperationCode;
1841c2c66affSColin Finck UCHAR RequestType:1;
1842c2c66affSColin Finck UCHAR Reserved1:7;
1843c2c66affSColin Finck UCHAR StartingFeature[2];
1844c2c66affSColin Finck UCHAR Reserved2[3];
1845c2c66affSColin Finck UCHAR AllocationLength[2];
1846c2c66affSColin Finck UCHAR Control;
1847c2c66affSColin Finck } GET_CONFIGURATION, *PGET_CONFIGURATION;
1848c2c66affSColin Finck struct _SET_CD_SPEED {
1849c2c66affSColin Finck UCHAR OperationCode;
1850c2c66affSColin Finck _ANONYMOUS_UNION union {
1851c2c66affSColin Finck UCHAR Reserved1;
1852c2c66affSColin Finck _ANONYMOUS_STRUCT struct {
1853c2c66affSColin Finck UCHAR RotationControl:2;
1854c2c66affSColin Finck UCHAR Reserved3:6;
1855c2c66affSColin Finck } DUMMYSTRUCTNAME;
1856c2c66affSColin Finck } DUMMYUNIONNAME;
1857c2c66affSColin Finck UCHAR ReadSpeed[2];
1858c2c66affSColin Finck UCHAR WriteSpeed[2];
1859c2c66affSColin Finck UCHAR Reserved2[5];
1860c2c66affSColin Finck UCHAR Control;
1861c2c66affSColin Finck } SET_CD_SPEED, *PSET_CD_SPEED;
1862c2c66affSColin Finck struct _READ12 {
1863c2c66affSColin Finck UCHAR OperationCode;
1864c2c66affSColin Finck UCHAR RelativeAddress:1;
1865c2c66affSColin Finck UCHAR Reserved1:2;
1866c2c66affSColin Finck UCHAR ForceUnitAccess:1;
1867c2c66affSColin Finck UCHAR DisablePageOut:1;
1868c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1869c2c66affSColin Finck UCHAR LogicalBlock[4];
1870c2c66affSColin Finck UCHAR TransferLength[4];
1871c2c66affSColin Finck UCHAR Reserved2:7;
1872c2c66affSColin Finck UCHAR Streaming:1;
1873c2c66affSColin Finck UCHAR Control;
1874c2c66affSColin Finck } READ12;
1875c2c66affSColin Finck struct _WRITE12 {
1876c2c66affSColin Finck UCHAR OperationCode;
1877c2c66affSColin Finck UCHAR RelativeAddress:1;
1878c2c66affSColin Finck UCHAR Reserved1:1;
1879c2c66affSColin Finck UCHAR EBP:1;
1880c2c66affSColin Finck UCHAR ForceUnitAccess:1;
1881c2c66affSColin Finck UCHAR DisablePageOut:1;
1882c2c66affSColin Finck UCHAR LogicalUnitNumber:3;
1883c2c66affSColin Finck UCHAR LogicalBlock[4];
1884c2c66affSColin Finck UCHAR TransferLength[4];
1885c2c66affSColin Finck UCHAR Reserved2:7;
1886c2c66affSColin Finck UCHAR Streaming:1;
1887c2c66affSColin Finck UCHAR Control;
1888c2c66affSColin Finck } WRITE12;
1889c2c66affSColin Finck struct _READ16 {
1890c2c66affSColin Finck UCHAR OperationCode;
1891c2c66affSColin Finck UCHAR Reserved1:3;
1892c2c66affSColin Finck UCHAR ForceUnitAccess:1;
1893c2c66affSColin Finck UCHAR DisablePageOut:1;
1894c2c66affSColin Finck UCHAR ReadProtect:3;
1895c2c66affSColin Finck UCHAR LogicalBlock[8];
1896c2c66affSColin Finck UCHAR TransferLength[4];
1897c2c66affSColin Finck UCHAR Reserved2:7;
1898c2c66affSColin Finck UCHAR Streaming:1;
1899c2c66affSColin Finck UCHAR Control;
1900c2c66affSColin Finck } READ16;
1901c2c66affSColin Finck struct _WRITE16 {
1902c2c66affSColin Finck UCHAR OperationCode;
1903c2c66affSColin Finck UCHAR Reserved1:3;
1904c2c66affSColin Finck UCHAR ForceUnitAccess:1;
1905c2c66affSColin Finck UCHAR DisablePageOut:1;
1906c2c66affSColin Finck UCHAR WriteProtect:3;
1907c2c66affSColin Finck UCHAR LogicalBlock[8];
1908c2c66affSColin Finck UCHAR TransferLength[4];
1909c2c66affSColin Finck UCHAR Reserved2:7;
1910c2c66affSColin Finck UCHAR Streaming:1;
1911c2c66affSColin Finck UCHAR Control;
1912c2c66affSColin Finck } WRITE16;
1913c2c66affSColin Finck struct _VERIFY16 {
1914c2c66affSColin Finck UCHAR OperationCode;
1915c2c66affSColin Finck UCHAR Reserved1:1;
1916c2c66affSColin Finck UCHAR ByteCheck:1;
1917c2c66affSColin Finck UCHAR BlockVerify:1;
1918c2c66affSColin Finck UCHAR Reserved2: 1;
1919c2c66affSColin Finck UCHAR DisablePageOut:1;
1920c2c66affSColin Finck UCHAR VerifyProtect:3;
1921c2c66affSColin Finck UCHAR LogicalBlock[8];
1922c2c66affSColin Finck UCHAR VerificationLength[4];
1923c2c66affSColin Finck UCHAR Reserved3:7;
1924c2c66affSColin Finck UCHAR Streaming:1;
1925c2c66affSColin Finck UCHAR Control;
1926c2c66affSColin Finck } VERIFY16;
1927c2c66affSColin Finck struct _SYNCHRONIZE_CACHE16 {
1928c2c66affSColin Finck UCHAR OperationCode;
1929c2c66affSColin Finck UCHAR Reserved1:1;
1930c2c66affSColin Finck UCHAR Immediate:1;
1931c2c66affSColin Finck UCHAR Reserved2:6;
1932c2c66affSColin Finck UCHAR LogicalBlock[8];
1933c2c66affSColin Finck UCHAR BlockCount[4];
1934c2c66affSColin Finck UCHAR Reserved3;
1935c2c66affSColin Finck UCHAR Control;
1936c2c66affSColin Finck } SYNCHRONIZE_CACHE16;
1937c2c66affSColin Finck struct _READ_CAPACITY16 {
1938c2c66affSColin Finck UCHAR OperationCode;
1939c2c66affSColin Finck UCHAR ServiceAction:5;
1940c2c66affSColin Finck UCHAR Reserved1:3;
1941c2c66affSColin Finck UCHAR LogicalBlock[8];
19423da77f91SVictor Perevertkin UCHAR AllocationLength[4];
1943c2c66affSColin Finck UCHAR PMI:1;
1944c2c66affSColin Finck UCHAR Reserved2:7;
1945c2c66affSColin Finck UCHAR Control;
1946c2c66affSColin Finck } READ_CAPACITY16;
19473da77f91SVictor Perevertkin struct _TOKEN_OPERATION {
19483da77f91SVictor Perevertkin UCHAR OperationCode;
19493da77f91SVictor Perevertkin UCHAR ServiceAction:5;
19503da77f91SVictor Perevertkin UCHAR Reserved1:3;
19513da77f91SVictor Perevertkin UCHAR Reserved2[4];
19523da77f91SVictor Perevertkin UCHAR ListIdentifier[4];
19533da77f91SVictor Perevertkin UCHAR ParameterListLength[4];
19543da77f91SVictor Perevertkin UCHAR GroupNumber:5;
19553da77f91SVictor Perevertkin UCHAR Reserved3:3;
19563da77f91SVictor Perevertkin UCHAR Control;
19573da77f91SVictor Perevertkin } TOKEN_OPERATION;
19583da77f91SVictor Perevertkin struct _RECEIVE_TOKEN_INFORMATION {
19593da77f91SVictor Perevertkin UCHAR OperationCode;
19603da77f91SVictor Perevertkin UCHAR ServiceAction:5;
19613da77f91SVictor Perevertkin UCHAR Reserved1:3;
19623da77f91SVictor Perevertkin UCHAR ListIdentifier[4];
19633da77f91SVictor Perevertkin UCHAR Reserved2[4];
19643da77f91SVictor Perevertkin UCHAR AllocationLength[4];
19653da77f91SVictor Perevertkin UCHAR Reserved3;
19663da77f91SVictor Perevertkin UCHAR Control;
19673da77f91SVictor Perevertkin } RECEIVE_TOKEN_INFORMATION;
19683da77f91SVictor Perevertkin struct _UNMAP {
19693da77f91SVictor Perevertkin UCHAR OperationCode;
19703da77f91SVictor Perevertkin UCHAR Anchor:1;
19713da77f91SVictor Perevertkin UCHAR Reserved1:7;
19723da77f91SVictor Perevertkin UCHAR Reserved2[4];
19733da77f91SVictor Perevertkin UCHAR GroupNumber:5;
19743da77f91SVictor Perevertkin UCHAR Reserved3:3;
19753da77f91SVictor Perevertkin UCHAR AllocationLength[2];
19763da77f91SVictor Perevertkin UCHAR Control;
19773da77f91SVictor Perevertkin } UNMAP;
19783da77f91SVictor Perevertkin struct _GET_LBA_STATUS {
19793da77f91SVictor Perevertkin UCHAR OperationCode;
19803da77f91SVictor Perevertkin UCHAR ServiceAction:5;
19813da77f91SVictor Perevertkin UCHAR Reserved1:3;
19823da77f91SVictor Perevertkin UCHAR StartingLBA[8];
19833da77f91SVictor Perevertkin UCHAR AllocationLength[4];
19843da77f91SVictor Perevertkin UCHAR Reserved2;
19853da77f91SVictor Perevertkin UCHAR Control;
19863da77f91SVictor Perevertkin } GET_LBA_STATUS;
1987c2c66affSColin Finck ULONG AsUlong[4];
1988c2c66affSColin Finck UCHAR AsByte[16];
1989c2c66affSColin Finck } CDB, *PCDB;
1990c2c66affSColin Finck
1991c2c66affSColin Finck typedef struct _NOTIFICATION_EVENT_STATUS_HEADER {
1992c2c66affSColin Finck UCHAR EventDataLength[2];
1993c2c66affSColin Finck UCHAR NotificationClass:3;
1994c2c66affSColin Finck UCHAR Reserved:4;
1995c2c66affSColin Finck UCHAR NEA:1;
1996c2c66affSColin Finck UCHAR SupportedEventClasses;
1997c2c66affSColin Finck UCHAR ClassEventData[0];
1998c2c66affSColin Finck } NOTIFICATION_EVENT_STATUS_HEADER, *PNOTIFICATION_EVENT_STATUS_HEADER;
1999c2c66affSColin Finck
2000c2c66affSColin Finck typedef struct _NOTIFICATION_OPERATIONAL_STATUS {
2001c2c66affSColin Finck UCHAR OperationalEvent:4;
2002c2c66affSColin Finck UCHAR Reserved1:4;
2003c2c66affSColin Finck UCHAR OperationalStatus:4;
2004c2c66affSColin Finck UCHAR Reserved2:3;
2005c2c66affSColin Finck UCHAR PersistentPrevented:1;
2006c2c66affSColin Finck UCHAR Operation[2];
2007c2c66affSColin Finck } NOTIFICATION_OPERATIONAL_STATUS, *PNOTIFICATION_OPERATIONAL_STATUS;
2008c2c66affSColin Finck
2009c2c66affSColin Finck typedef struct _NOTIFICATION_POWER_STATUS {
2010c2c66affSColin Finck UCHAR PowerEvent:4;
2011c2c66affSColin Finck UCHAR Reserved:4;
2012c2c66affSColin Finck UCHAR PowerStatus;
2013c2c66affSColin Finck UCHAR Reserved2[2];
2014c2c66affSColin Finck } NOTIFICATION_POWER_STATUS, *PNOTIFICATION_POWER_STATUS;
2015c2c66affSColin Finck
2016c2c66affSColin Finck typedef struct _NOTIFICATION_EXTERNAL_STATUS {
2017c2c66affSColin Finck UCHAR ExternalEvent:4;
2018c2c66affSColin Finck UCHAR Reserved1:4;
2019c2c66affSColin Finck UCHAR ExternalStatus:4;
2020c2c66affSColin Finck UCHAR Reserved2:3;
2021c2c66affSColin Finck UCHAR PersistentPrevented:1;
2022c2c66affSColin Finck UCHAR Request[2];
2023c2c66affSColin Finck } NOTIFICATION_EXTERNAL_STATUS, *PNOTIFICATION_EXTERNAL_STATUS;
2024c2c66affSColin Finck
2025c2c66affSColin Finck typedef struct _NOTIFICATION_MEDIA_STATUS {
2026c2c66affSColin Finck UCHAR MediaEvent:4;
2027c2c66affSColin Finck UCHAR Reserved:4;
2028c2c66affSColin Finck _ANONYMOUS_UNION union {
2029c2c66affSColin Finck UCHAR PowerStatus;
2030c2c66affSColin Finck UCHAR MediaStatus;
2031c2c66affSColin Finck _ANONYMOUS_STRUCT struct {
2032c2c66affSColin Finck UCHAR DoorTrayOpen:1;
2033c2c66affSColin Finck UCHAR MediaPresent:1;
2034c2c66affSColin Finck UCHAR ReservedX:6;
2035c2c66affSColin Finck } DUMMYSTRUCTNAME;
2036c2c66affSColin Finck } DUMMYUNIONNAME;
2037c2c66affSColin Finck UCHAR StartSlot;
2038c2c66affSColin Finck UCHAR EndSlot;
2039c2c66affSColin Finck } NOTIFICATION_MEDIA_STATUS, *PNOTIFICATION_MEDIA_STATUS;
2040c2c66affSColin Finck
2041c2c66affSColin Finck typedef struct _NOTIFICATION_MULTI_HOST_STATUS {
2042c2c66affSColin Finck UCHAR MultiHostEvent:4;
2043c2c66affSColin Finck UCHAR Reserved1:4;
2044c2c66affSColin Finck UCHAR MultiHostStatus:4;
2045c2c66affSColin Finck UCHAR Reserved2:3;
2046c2c66affSColin Finck UCHAR PersistentPrevented:1;
2047c2c66affSColin Finck UCHAR Priority[2];
2048c2c66affSColin Finck } NOTIFICATION_MULTI_HOST_STATUS, *PNOTIFICATION_MULTI_HOST_STATUS;
2049c2c66affSColin Finck
2050c2c66affSColin Finck typedef struct _NOTIFICATION_BUSY_STATUS {
2051c2c66affSColin Finck UCHAR DeviceBusyEvent:4;
2052c2c66affSColin Finck UCHAR Reserved:4;
2053c2c66affSColin Finck UCHAR DeviceBusyStatus;
2054c2c66affSColin Finck UCHAR Time[2];
2055c2c66affSColin Finck } NOTIFICATION_BUSY_STATUS, *PNOTIFICATION_BUSY_STATUS;
2056c2c66affSColin Finck
2057c2c66affSColin Finck typedef struct _READ_DVD_STRUCTURES_HEADER {
2058c2c66affSColin Finck UCHAR Length[2];
2059c2c66affSColin Finck UCHAR Reserved[2];
2060c2c66affSColin Finck UCHAR Data[0];
2061c2c66affSColin Finck } READ_DVD_STRUCTURES_HEADER, *PREAD_DVD_STRUCTURES_HEADER;
2062c2c66affSColin Finck
2063c2c66affSColin Finck typedef struct _CDVD_KEY_HEADER {
2064c2c66affSColin Finck UCHAR DataLength[2];
2065c2c66affSColin Finck UCHAR Reserved[2];
2066c2c66affSColin Finck UCHAR Data[0];
2067c2c66affSColin Finck } CDVD_KEY_HEADER, *PCDVD_KEY_HEADER;
2068c2c66affSColin Finck
2069c2c66affSColin Finck typedef struct _CDVD_REPORT_AGID_DATA {
2070c2c66affSColin Finck UCHAR Reserved1[3];
2071c2c66affSColin Finck UCHAR Reserved2:6;
2072c2c66affSColin Finck UCHAR AGID:2;
2073c2c66affSColin Finck } CDVD_REPORT_AGID_DATA, *PCDVD_REPORT_AGID_DATA;
2074c2c66affSColin Finck
2075c2c66affSColin Finck typedef struct _CDVD_CHALLENGE_KEY_DATA {
2076c2c66affSColin Finck UCHAR ChallengeKeyValue[10];
2077c2c66affSColin Finck UCHAR Reserved[2];
2078c2c66affSColin Finck } CDVD_CHALLENGE_KEY_DATA, *PCDVD_CHALLENGE_KEY_DATA;
2079c2c66affSColin Finck
2080c2c66affSColin Finck typedef struct _CDVD_KEY_DATA {
2081c2c66affSColin Finck UCHAR Key[5];
2082c2c66affSColin Finck UCHAR Reserved[3];
2083c2c66affSColin Finck } CDVD_KEY_DATA, *PCDVD_KEY_DATA;
2084c2c66affSColin Finck
2085c2c66affSColin Finck typedef struct _CDVD_REPORT_ASF_DATA {
2086c2c66affSColin Finck UCHAR Reserved1[3];
2087c2c66affSColin Finck UCHAR Success:1;
2088c2c66affSColin Finck UCHAR Reserved2:7;
2089c2c66affSColin Finck } CDVD_REPORT_ASF_DATA, *PCDVD_REPORT_ASF_DATA;
2090c2c66affSColin Finck
2091c2c66affSColin Finck typedef struct _CDVD_TITLE_KEY_HEADER {
2092c2c66affSColin Finck UCHAR DataLength[2];
2093c2c66affSColin Finck UCHAR Reserved1[1];
2094c2c66affSColin Finck UCHAR Reserved2:3;
2095c2c66affSColin Finck UCHAR CGMS:2;
2096c2c66affSColin Finck UCHAR CP_SEC:1;
2097c2c66affSColin Finck UCHAR CPM:1;
2098c2c66affSColin Finck UCHAR Zero:1;
2099c2c66affSColin Finck CDVD_KEY_DATA TitleKey;
2100c2c66affSColin Finck } CDVD_TITLE_KEY_HEADER, *PCDVD_TITLE_KEY_HEADER;
2101c2c66affSColin Finck
2102c2c66affSColin Finck typedef struct _FORMAT_DESCRIPTOR {
2103c2c66affSColin Finck UCHAR NumberOfBlocks[4];
2104c2c66affSColin Finck UCHAR FormatSubType:2;
2105c2c66affSColin Finck UCHAR FormatType:6;
2106c2c66affSColin Finck UCHAR BlockLength[3];
2107c2c66affSColin Finck } FORMAT_DESCRIPTOR, *PFORMAT_DESCRIPTOR;
2108c2c66affSColin Finck
2109c2c66affSColin Finck typedef struct _FORMAT_LIST_HEADER {
2110c2c66affSColin Finck UCHAR Reserved;
2111c2c66affSColin Finck UCHAR VendorSpecific:1;
2112c2c66affSColin Finck UCHAR Immediate:1;
2113c2c66affSColin Finck UCHAR TryOut:1;
2114c2c66affSColin Finck UCHAR IP:1;
2115c2c66affSColin Finck UCHAR STPF:1;
2116c2c66affSColin Finck UCHAR DCRT:1;
2117c2c66affSColin Finck UCHAR DPRY:1;
2118c2c66affSColin Finck UCHAR FOV:1;
2119c2c66affSColin Finck UCHAR FormatDescriptorLength[2];
2120c2c66affSColin Finck FORMAT_DESCRIPTOR Descriptors[0];
2121c2c66affSColin Finck } FORMAT_LIST_HEADER, *PFORMAT_LIST_HEADER;
2122c2c66affSColin Finck
2123c2c66affSColin Finck typedef struct _FORMATTED_CAPACITY_DESCRIPTOR {
2124c2c66affSColin Finck UCHAR NumberOfBlocks[4];
2125c2c66affSColin Finck UCHAR Maximum:1;
2126c2c66affSColin Finck UCHAR Valid:1;
2127c2c66affSColin Finck UCHAR FormatType:6;
2128c2c66affSColin Finck UCHAR BlockLength[3];
2129c2c66affSColin Finck } FORMATTED_CAPACITY_DESCRIPTOR, *PFORMATTED_CAPACITY_DESCRIPTOR;
2130c2c66affSColin Finck
2131c2c66affSColin Finck typedef struct _FORMATTED_CAPACITY_LIST {
2132c2c66affSColin Finck UCHAR Reserved[3];
2133c2c66affSColin Finck UCHAR CapacityListLength;
2134c2c66affSColin Finck FORMATTED_CAPACITY_DESCRIPTOR Descriptors[0];
2135c2c66affSColin Finck } FORMATTED_CAPACITY_LIST, *PFORMATTED_CAPACITY_LIST;
2136c2c66affSColin Finck
2137c2c66affSColin Finck typedef struct _OPC_TABLE_ENTRY {
2138c2c66affSColin Finck UCHAR Speed[2];
2139c2c66affSColin Finck UCHAR OPCValue[6];
2140c2c66affSColin Finck } OPC_TABLE_ENTRY, *POPC_TABLE_ENTRY;
2141c2c66affSColin Finck
2142c2c66affSColin Finck typedef struct _DISC_INFORMATION {
2143c2c66affSColin Finck UCHAR Length[2];
2144c2c66affSColin Finck UCHAR DiscStatus:2;
2145c2c66affSColin Finck UCHAR LastSessionStatus:2;
2146c2c66affSColin Finck UCHAR Erasable:1;
2147c2c66affSColin Finck UCHAR Reserved1:3;
2148c2c66affSColin Finck UCHAR FirstTrackNumber;
2149c2c66affSColin Finck UCHAR NumberOfSessionsLsb;
2150c2c66affSColin Finck UCHAR LastSessionFirstTrackLsb;
2151c2c66affSColin Finck UCHAR LastSessionLastTrackLsb;
2152c2c66affSColin Finck UCHAR MrwStatus:2;
2153c2c66affSColin Finck UCHAR MrwDirtyBit:1;
2154c2c66affSColin Finck UCHAR Reserved2:2;
2155c2c66affSColin Finck UCHAR URU:1;
2156c2c66affSColin Finck UCHAR DBC_V:1;
2157c2c66affSColin Finck UCHAR DID_V:1;
2158c2c66affSColin Finck UCHAR DiscType;
2159c2c66affSColin Finck UCHAR NumberOfSessionsMsb;
2160c2c66affSColin Finck UCHAR LastSessionFirstTrackMsb;
2161c2c66affSColin Finck UCHAR LastSessionLastTrackMsb;
2162c2c66affSColin Finck UCHAR DiskIdentification[4];
2163c2c66affSColin Finck UCHAR LastSessionLeadIn[4];
2164c2c66affSColin Finck UCHAR LastPossibleLeadOutStartTime[4];
2165c2c66affSColin Finck UCHAR DiskBarCode[8];
2166c2c66affSColin Finck UCHAR Reserved4;
2167c2c66affSColin Finck UCHAR NumberOPCEntries;
2168c2c66affSColin Finck OPC_TABLE_ENTRY OPCTable[1];
2169c2c66affSColin Finck } DISC_INFORMATION, *PDISC_INFORMATION;
2170c2c66affSColin Finck
2171c2c66affSColin Finck typedef struct _DISK_INFORMATION {
2172c2c66affSColin Finck UCHAR Length[2];
2173c2c66affSColin Finck UCHAR DiskStatus:2;
2174c2c66affSColin Finck UCHAR LastSessionStatus:2;
2175c2c66affSColin Finck UCHAR Erasable:1;
2176c2c66affSColin Finck UCHAR Reserved1:3;
2177c2c66affSColin Finck UCHAR FirstTrackNumber;
2178c2c66affSColin Finck UCHAR NumberOfSessions;
2179c2c66affSColin Finck UCHAR LastSessionFirstTrack;
2180c2c66affSColin Finck UCHAR LastSessionLastTrack;
2181c2c66affSColin Finck UCHAR Reserved2:5;
2182c2c66affSColin Finck UCHAR GEN:1;
2183c2c66affSColin Finck UCHAR DBC_V:1;
2184c2c66affSColin Finck UCHAR DID_V:1;
2185c2c66affSColin Finck UCHAR DiskType;
2186c2c66affSColin Finck UCHAR Reserved3[3];
2187c2c66affSColin Finck UCHAR DiskIdentification[4];
2188c2c66affSColin Finck UCHAR LastSessionLeadIn[4];
2189c2c66affSColin Finck UCHAR LastPossibleStartTime[4];
2190c2c66affSColin Finck UCHAR DiskBarCode[8];
2191c2c66affSColin Finck UCHAR Reserved4;
2192c2c66affSColin Finck UCHAR NumberOPCEntries;
2193c2c66affSColin Finck OPC_TABLE_ENTRY OPCTable[0];
2194c2c66affSColin Finck } DISK_INFORMATION, *PDISK_INFORMATION;
2195c2c66affSColin Finck
2196c2c66affSColin Finck typedef struct _DATA_BLOCK_HEADER {
2197c2c66affSColin Finck UCHAR DataMode;
2198c2c66affSColin Finck UCHAR Reserved[4];
2199c2c66affSColin Finck _ANONYMOUS_UNION union {
2200c2c66affSColin Finck UCHAR LogicalBlockAddress[4];
2201c2c66affSColin Finck struct {
2202c2c66affSColin Finck UCHAR Reserved;
2203c2c66affSColin Finck UCHAR M;
2204c2c66affSColin Finck UCHAR S;
2205c2c66affSColin Finck UCHAR F;
2206c2c66affSColin Finck } MSF;
2207c2c66affSColin Finck } DUMMYUNIONNAME;
2208c2c66affSColin Finck } DATA_BLOCK_HEADER, *PDATA_BLOCK_HEADER;
2209c2c66affSColin Finck
2210c2c66affSColin Finck typedef struct _TRACK_INFORMATION {
2211c2c66affSColin Finck UCHAR Length[2];
2212c2c66affSColin Finck UCHAR TrackNumber;
2213c2c66affSColin Finck UCHAR SessionNumber;
2214c2c66affSColin Finck UCHAR Reserved1;
2215c2c66affSColin Finck UCHAR TrackMode:4;
2216c2c66affSColin Finck UCHAR Copy:1;
2217c2c66affSColin Finck UCHAR Damage:1;
2218c2c66affSColin Finck UCHAR Reserved2:2;
2219c2c66affSColin Finck UCHAR DataMode:4;
2220c2c66affSColin Finck UCHAR FP:1;
2221c2c66affSColin Finck UCHAR Packet:1;
2222c2c66affSColin Finck UCHAR Blank:1;
2223c2c66affSColin Finck UCHAR RT:1;
2224c2c66affSColin Finck UCHAR NWA_V:1;
2225c2c66affSColin Finck UCHAR Reserved3:7;
2226c2c66affSColin Finck UCHAR TrackStartAddress[4];
2227c2c66affSColin Finck UCHAR NextWritableAddress[4];
2228c2c66affSColin Finck UCHAR FreeBlocks[4];
2229c2c66affSColin Finck UCHAR FixedPacketSize[4];
2230c2c66affSColin Finck } TRACK_INFORMATION, *PTRACK_INFORMATION;
2231c2c66affSColin Finck
2232c2c66affSColin Finck typedef struct _TRACK_INFORMATION2 {
2233c2c66affSColin Finck UCHAR Length[2];
2234c2c66affSColin Finck UCHAR TrackNumberLsb;
2235c2c66affSColin Finck UCHAR SessionNumberLsb;
2236c2c66affSColin Finck UCHAR Reserved4;
2237c2c66affSColin Finck UCHAR TrackMode:4;
2238c2c66affSColin Finck UCHAR Copy:1;
2239c2c66affSColin Finck UCHAR Damage:1;
2240c2c66affSColin Finck UCHAR Reserved5:2;
2241c2c66affSColin Finck UCHAR DataMode:4;
2242c2c66affSColin Finck UCHAR FixedPacket:1;
2243c2c66affSColin Finck UCHAR Packet:1;
2244c2c66affSColin Finck UCHAR Blank:1;
2245c2c66affSColin Finck UCHAR ReservedTrack:1;
2246c2c66affSColin Finck UCHAR NWA_V:1;
2247c2c66affSColin Finck UCHAR LRA_V:1;
2248c2c66affSColin Finck UCHAR Reserved6:6;
2249c2c66affSColin Finck UCHAR TrackStartAddress[4];
2250c2c66affSColin Finck UCHAR NextWritableAddress[4];
2251c2c66affSColin Finck UCHAR FreeBlocks[4];
2252c2c66affSColin Finck UCHAR FixedPacketSize[4];
2253c2c66affSColin Finck UCHAR TrackSize[4];
2254c2c66affSColin Finck UCHAR LastRecordedAddress[4];
2255c2c66affSColin Finck UCHAR TrackNumberMsb;
2256c2c66affSColin Finck UCHAR SessionNumberMsb;
2257c2c66affSColin Finck UCHAR Reserved7[2];
2258c2c66affSColin Finck } TRACK_INFORMATION2, *PTRACK_INFORMATION2;
2259c2c66affSColin Finck
2260c2c66affSColin Finck typedef struct _TRACK_INFORMATION3 {
2261c2c66affSColin Finck UCHAR Length[2];
2262c2c66affSColin Finck UCHAR TrackNumberLsb;
2263c2c66affSColin Finck UCHAR SessionNumberLsb;
2264c2c66affSColin Finck UCHAR Reserved4;
2265c2c66affSColin Finck UCHAR TrackMode:4;
2266c2c66affSColin Finck UCHAR Copy:1;
2267c2c66affSColin Finck UCHAR Damage:1;
2268c2c66affSColin Finck UCHAR Reserved5:2;
2269c2c66affSColin Finck UCHAR DataMode:4;
2270c2c66affSColin Finck UCHAR FixedPacket:1;
2271c2c66affSColin Finck UCHAR Packet:1;
2272c2c66affSColin Finck UCHAR Blank:1;
2273c2c66affSColin Finck UCHAR ReservedTrack:1;
2274c2c66affSColin Finck UCHAR NWA_V:1;
2275c2c66affSColin Finck UCHAR LRA_V:1;
2276c2c66affSColin Finck UCHAR Reserved6:6;
2277c2c66affSColin Finck UCHAR TrackStartAddress[4];
2278c2c66affSColin Finck UCHAR NextWritableAddress[4];
2279c2c66affSColin Finck UCHAR FreeBlocks[4];
2280c2c66affSColin Finck UCHAR FixedPacketSize[4];
2281c2c66affSColin Finck UCHAR TrackSize[4];
2282c2c66affSColin Finck UCHAR LastRecordedAddress[4];
2283c2c66affSColin Finck UCHAR TrackNumberMsb;
2284c2c66affSColin Finck UCHAR SessionNumberMsb;
2285c2c66affSColin Finck UCHAR Reserved7[2];
2286c2c66affSColin Finck UCHAR ReadCompatibilityLba[4];
2287c2c66affSColin Finck } TRACK_INFORMATION3, *PTRACK_INFORMATION3;
2288c2c66affSColin Finck
2289c2c66affSColin Finck typedef struct _PERFORMANCE_DESCRIPTOR {
2290c2c66affSColin Finck UCHAR RandomAccess:1;
2291c2c66affSColin Finck UCHAR Exact:1;
2292c2c66affSColin Finck UCHAR RestoreDefaults:1;
2293c2c66affSColin Finck UCHAR WriteRotationControl:2;
2294c2c66affSColin Finck UCHAR Reserved1:3;
2295c2c66affSColin Finck UCHAR Reserved[3];
2296c2c66affSColin Finck UCHAR StartLba[4];
2297c2c66affSColin Finck UCHAR EndLba[4];
2298c2c66affSColin Finck UCHAR ReadSize[4];
2299c2c66affSColin Finck UCHAR ReadTime[4];
2300c2c66affSColin Finck UCHAR WriteSize[4];
2301c2c66affSColin Finck UCHAR WriteTime[4];
2302c2c66affSColin Finck } PERFORMANCE_DESCRIPTOR, *PPERFORMANCE_DESCRIPTOR;
2303c2c66affSColin Finck
2304c2c66affSColin Finck typedef struct _SCSI_EXTENDED_MESSAGE {
2305c2c66affSColin Finck UCHAR InitialMessageCode;
2306c2c66affSColin Finck UCHAR MessageLength;
2307c2c66affSColin Finck UCHAR MessageType;
2308c2c66affSColin Finck union _EXTENDED_ARGUMENTS {
2309c2c66affSColin Finck struct {
2310c2c66affSColin Finck UCHAR Modifier[4];
2311c2c66affSColin Finck } Modify;
2312c2c66affSColin Finck struct {
2313c2c66affSColin Finck UCHAR TransferPeriod;
2314c2c66affSColin Finck UCHAR ReqAckOffset;
2315c2c66affSColin Finck } Synchronous;
2316c2c66affSColin Finck struct{
2317c2c66affSColin Finck UCHAR Width;
2318c2c66affSColin Finck } Wide;
2319c2c66affSColin Finck } ExtendedArguments;
2320c2c66affSColin Finck }SCSI_EXTENDED_MESSAGE, *PSCSI_EXTENDED_MESSAGE;
2321c2c66affSColin Finck
2322c2c66affSColin Finck #ifndef _INQUIRYDATA_DEFINED /* also in minitape.h */
2323c2c66affSColin Finck #define _INQUIRYDATA_DEFINED
2324c2c66affSColin Finck
2325c2c66affSColin Finck #define INQUIRYDATABUFFERSIZE 36
2326c2c66affSColin Finck
2327c2c66affSColin Finck #if (NTDDI_VERSION < NTDDI_WINXP)
2328c2c66affSColin Finck typedef struct _INQUIRYDATA {
2329c2c66affSColin Finck UCHAR DeviceType:5;
2330c2c66affSColin Finck UCHAR DeviceTypeQualifier:3;
2331c2c66affSColin Finck UCHAR DeviceTypeModifier:7;
2332c2c66affSColin Finck UCHAR RemovableMedia:1;
2333c2c66affSColin Finck UCHAR Versions;
2334c2c66affSColin Finck UCHAR ResponseDataFormat:4;
2335c2c66affSColin Finck UCHAR HiSupport:1;
2336c2c66affSColin Finck UCHAR NormACA:1;
2337c2c66affSColin Finck UCHAR ReservedBit:1;
2338c2c66affSColin Finck UCHAR AERC:1;
2339c2c66affSColin Finck UCHAR AdditionalLength;
2340c2c66affSColin Finck UCHAR Reserved[2];
2341c2c66affSColin Finck UCHAR SoftReset:1;
2342c2c66affSColin Finck UCHAR CommandQueue:1;
2343c2c66affSColin Finck UCHAR Reserved2:1;
2344c2c66affSColin Finck UCHAR LinkedCommands:1;
2345c2c66affSColin Finck UCHAR Synchronous:1;
2346c2c66affSColin Finck UCHAR Wide16Bit:1;
2347c2c66affSColin Finck UCHAR Wide32Bit:1;
2348c2c66affSColin Finck UCHAR RelativeAddressing:1;
2349c2c66affSColin Finck UCHAR VendorId[8];
2350c2c66affSColin Finck UCHAR ProductId[16];
2351c2c66affSColin Finck UCHAR ProductRevisionLevel[4];
2352c2c66affSColin Finck UCHAR VendorSpecific[20];
2353c2c66affSColin Finck UCHAR Reserved3[40];
2354c2c66affSColin Finck } INQUIRYDATA, *PINQUIRYDATA;
2355c2c66affSColin Finck #else
2356c2c66affSColin Finck typedef struct _INQUIRYDATA {
2357c2c66affSColin Finck UCHAR DeviceType:5;
2358c2c66affSColin Finck UCHAR DeviceTypeQualifier:3;
2359c2c66affSColin Finck UCHAR DeviceTypeModifier:7;
2360c2c66affSColin Finck UCHAR RemovableMedia:1;
2361c2c66affSColin Finck _ANONYMOUS_UNION union {
2362c2c66affSColin Finck UCHAR Versions;
2363c2c66affSColin Finck _ANONYMOUS_STRUCT struct {
2364c2c66affSColin Finck UCHAR ANSIVersion:3;
2365c2c66affSColin Finck UCHAR ECMAVersion:3;
2366c2c66affSColin Finck UCHAR ISOVersion:2;
2367c2c66affSColin Finck } DUMMYSTRUCTNAME;
2368c2c66affSColin Finck } DUMMYUNIONNAME;
2369c2c66affSColin Finck UCHAR ResponseDataFormat:4;
2370c2c66affSColin Finck UCHAR HiSupport:1;
2371c2c66affSColin Finck UCHAR NormACA:1;
2372c2c66affSColin Finck UCHAR TerminateTask:1;
2373c2c66affSColin Finck UCHAR AERC:1;
2374c2c66affSColin Finck UCHAR AdditionalLength;
2375c2c66affSColin Finck UCHAR Reserved;
2376c2c66affSColin Finck UCHAR Addr16:1;
2377c2c66affSColin Finck UCHAR Addr32:1;
2378c2c66affSColin Finck UCHAR AckReqQ:1;
2379c2c66affSColin Finck UCHAR MediumChanger:1;
2380c2c66affSColin Finck UCHAR MultiPort:1;
2381c2c66affSColin Finck UCHAR ReservedBit2:1;
2382c2c66affSColin Finck UCHAR EnclosureServices:1;
2383c2c66affSColin Finck UCHAR ReservedBit3:1;
2384c2c66affSColin Finck UCHAR SoftReset:1;
2385c2c66affSColin Finck UCHAR CommandQueue:1;
2386c2c66affSColin Finck UCHAR TransferDisable:1;
2387c2c66affSColin Finck UCHAR LinkedCommands:1;
2388c2c66affSColin Finck UCHAR Synchronous:1;
2389c2c66affSColin Finck UCHAR Wide16Bit:1;
2390c2c66affSColin Finck UCHAR Wide32Bit:1;
2391c2c66affSColin Finck UCHAR RelativeAddressing:1;
2392c2c66affSColin Finck UCHAR VendorId[8];
2393c2c66affSColin Finck UCHAR ProductId[16];
2394c2c66affSColin Finck UCHAR ProductRevisionLevel[4];
2395c2c66affSColin Finck UCHAR VendorSpecific[20];
2396c2c66affSColin Finck UCHAR Reserved3[40];
2397c2c66affSColin Finck } INQUIRYDATA, *PINQUIRYDATA;
2398c2c66affSColin Finck #endif /* (NTDDI_VERSION < NTDDI_WINXP) */
2399c2c66affSColin Finck
2400c2c66affSColin Finck #endif /* _INQUIRYDATA_DEFINED */
2401c2c66affSColin Finck
24023da77f91SVictor Perevertkin #define VPD_MAX_BUFFER_SIZE 0xff
24033da77f91SVictor Perevertkin
24043da77f91SVictor Perevertkin #define VPD_SUPPORTED_PAGES 0x00
24053da77f91SVictor Perevertkin #define VPD_SERIAL_NUMBER 0x80
24063da77f91SVictor Perevertkin #define VPD_DEVICE_IDENTIFIERS 0x83
24073da77f91SVictor Perevertkin #define VPD_MEDIA_SERIAL_NUMBER 0x84
24083da77f91SVictor Perevertkin #define VPD_SOFTWARE_INTERFACE_IDENTIFIERS 0x84
24093da77f91SVictor Perevertkin #define VPD_NETWORK_MANAGEMENT_ADDRESSES 0x85
24103da77f91SVictor Perevertkin #define VPD_EXTENDED_INQUIRY_DATA 0x86
24113da77f91SVictor Perevertkin #define VPD_MODE_PAGE_POLICY 0x87
24123da77f91SVictor Perevertkin #define VPD_SCSI_PORTS 0x88
24133da77f91SVictor Perevertkin #define VPD_ATA_INFORMATION 0x89
24143da77f91SVictor Perevertkin
24153da77f91SVictor Perevertkin #define VPD_THIRD_PARTY_COPY 0x8F
24163da77f91SVictor Perevertkin #define VPD_BLOCK_LIMITS 0xB0
24173da77f91SVictor Perevertkin #define VPD_BLOCK_DEVICE_CHARACTERISTICS 0xB1
24183da77f91SVictor Perevertkin #define VPD_LOGICAL_BLOCK_PROVISIONING 0xB2
24193da77f91SVictor Perevertkin #define VPD_ZONED_BLOCK_DEVICE_CHARACTERISTICS 0xB6
24203da77f91SVictor Perevertkin
2421c2c66affSColin Finck typedef struct _VPD_MEDIA_SERIAL_NUMBER_PAGE {
2422c2c66affSColin Finck UCHAR DeviceType:5;
2423c2c66affSColin Finck UCHAR DeviceTypeQualifier:3;
2424c2c66affSColin Finck UCHAR PageCode;
2425c2c66affSColin Finck UCHAR Reserved;
2426c2c66affSColin Finck UCHAR PageLength;
2427c2c66affSColin Finck UCHAR SerialNumber[0];
2428c2c66affSColin Finck } VPD_MEDIA_SERIAL_NUMBER_PAGE, *PVPD_MEDIA_SERIAL_NUMBER_PAGE;
2429c2c66affSColin Finck
2430c2c66affSColin Finck typedef struct _VPD_SERIAL_NUMBER_PAGE {
2431c2c66affSColin Finck UCHAR DeviceType:5;
2432c2c66affSColin Finck UCHAR DeviceTypeQualifier:3;
2433c2c66affSColin Finck UCHAR PageCode;
2434c2c66affSColin Finck UCHAR Reserved;
2435c2c66affSColin Finck UCHAR PageLength;
2436c2c66affSColin Finck UCHAR SerialNumber[0];
2437c2c66affSColin Finck } VPD_SERIAL_NUMBER_PAGE, *PVPD_SERIAL_NUMBER_PAGE;
2438c2c66affSColin Finck
2439c2c66affSColin Finck typedef enum _VPD_CODE_SET {
2440c2c66affSColin Finck VpdCodeSetReserved = 0,
2441c2c66affSColin Finck VpdCodeSetBinary = 1,
2442c2c66affSColin Finck VpdCodeSetAscii = 2,
2443c2c66affSColin Finck VpdCodeSetUTF8 = 3
2444c2c66affSColin Finck } VPD_CODE_SET, *PVPD_CODE_SET;
2445c2c66affSColin Finck
2446c2c66affSColin Finck typedef enum _VPD_ASSOCIATION {
2447c2c66affSColin Finck VpdAssocDevice = 0,
2448c2c66affSColin Finck VpdAssocPort = 1,
2449c2c66affSColin Finck VpdAssocTarget = 2,
2450c2c66affSColin Finck VpdAssocReserved1 = 3,
2451c2c66affSColin Finck VpdAssocReserved2 = 4
2452c2c66affSColin Finck } VPD_ASSOCIATION, *PVPD_ASSOCIATION;
2453c2c66affSColin Finck
2454c2c66affSColin Finck typedef enum _VPD_IDENTIFIER_TYPE {
2455c2c66affSColin Finck VpdIdentifierTypeVendorSpecific = 0,
2456c2c66affSColin Finck VpdIdentifierTypeVendorId = 1,
2457c2c66affSColin Finck VpdIdentifierTypeEUI64 = 2,
2458c2c66affSColin Finck VpdIdentifierTypeFCPHName = 3,
2459c2c66affSColin Finck VpdIdentifierTypePortRelative = 4,
2460c2c66affSColin Finck VpdIdentifierTypeTargetPortGroup = 5,
2461c2c66affSColin Finck VpdIdentifierTypeLogicalUnitGroup = 6,
2462c2c66affSColin Finck VpdIdentifierTypeMD5LogicalUnitId = 7,
2463c2c66affSColin Finck VpdIdentifierTypeSCSINameString = 8
2464c2c66affSColin Finck } VPD_IDENTIFIER_TYPE, *PVPD_IDENTIFIER_TYPE;
2465c2c66affSColin Finck
2466c2c66affSColin Finck typedef struct _VPD_IDENTIFICATION_DESCRIPTOR {
2467c2c66affSColin Finck UCHAR CodeSet:4;
2468c2c66affSColin Finck UCHAR Reserved:4;
2469c2c66affSColin Finck UCHAR IdentifierType:4;
2470c2c66affSColin Finck UCHAR Association:2;
2471c2c66affSColin Finck UCHAR Reserved2:2;
2472c2c66affSColin Finck UCHAR Reserved3;
2473c2c66affSColin Finck UCHAR IdentifierLength;
2474c2c66affSColin Finck UCHAR Identifier[0];
2475c2c66affSColin Finck } VPD_IDENTIFICATION_DESCRIPTOR, *PVPD_IDENTIFICATION_DESCRIPTOR;
2476c2c66affSColin Finck
2477c2c66affSColin Finck typedef struct _VPD_IDENTIFICATION_PAGE {
2478c2c66affSColin Finck UCHAR DeviceType:5;
2479c2c66affSColin Finck UCHAR DeviceTypeQualifier:3;
2480c2c66affSColin Finck UCHAR PageCode;
2481c2c66affSColin Finck UCHAR Reserved;
2482c2c66affSColin Finck UCHAR PageLength;
2483c2c66affSColin Finck UCHAR Descriptors[0];
2484c2c66affSColin Finck } VPD_IDENTIFICATION_PAGE, *PVPD_IDENTIFICATION_PAGE;
2485c2c66affSColin Finck
24863da77f91SVictor Perevertkin typedef struct _VPD_ATA_INFORMATION_PAGE {
24873da77f91SVictor Perevertkin UCHAR DeviceType:5;
24883da77f91SVictor Perevertkin UCHAR DeviceTypeQualifier:3;
24893da77f91SVictor Perevertkin UCHAR PageCode;
24903da77f91SVictor Perevertkin UCHAR PageLength[2];
24913da77f91SVictor Perevertkin UCHAR Reserved0[4];
24923da77f91SVictor Perevertkin UCHAR VendorId[8];
24933da77f91SVictor Perevertkin UCHAR ProductId[16];
24943da77f91SVictor Perevertkin UCHAR ProductRevisionLevel[4];
24953da77f91SVictor Perevertkin UCHAR DeviceSignature[20];
24963da77f91SVictor Perevertkin UCHAR CommandCode;
24973da77f91SVictor Perevertkin UCHAR Reserved1[3];
24983da77f91SVictor Perevertkin UCHAR IdentifyDeviceData[512];
24993da77f91SVictor Perevertkin } VPD_ATA_INFORMATION_PAGE, *PVPD_ATA_INFORMATION_PAGE;
25003da77f91SVictor Perevertkin
25013da77f91SVictor Perevertkin #if (NTDDI_VERSION >= NTDDI_WIN8)
25023da77f91SVictor Perevertkin typedef struct _VPD_THIRD_PARTY_COPY_PAGE {
25033da77f91SVictor Perevertkin UCHAR DeviceType:5;
25043da77f91SVictor Perevertkin UCHAR DeviceTypeQualifier:3;
25053da77f91SVictor Perevertkin UCHAR PageCode;
25063da77f91SVictor Perevertkin UCHAR PageLength[2];
25073da77f91SVictor Perevertkin #if !defined(__midl)
25083da77f91SVictor Perevertkin UCHAR ThirdPartyCopyDescriptors[ANYSIZE_ARRAY];
25093da77f91SVictor Perevertkin #endif
25103da77f91SVictor Perevertkin } VPD_THIRD_PARTY_COPY_PAGE, *PVPD_THIRD_PARTY_COPY_PAGE;
25113da77f91SVictor Perevertkin
25123da77f91SVictor Perevertkin typedef struct _WINDOWS_BLOCK_DEVICE_TOKEN_LIMITS_DESCRIPTOR {
25133da77f91SVictor Perevertkin UCHAR DescriptorType[2];
25143da77f91SVictor Perevertkin UCHAR DescriptorLength[2];
25153da77f91SVictor Perevertkin UCHAR VendorSpecific[6];
25163da77f91SVictor Perevertkin UCHAR MaximumRangeDescriptors[2];
25173da77f91SVictor Perevertkin UCHAR MaximumInactivityTimer[4];
25183da77f91SVictor Perevertkin UCHAR DefaultInactivityTimer[4];
25193da77f91SVictor Perevertkin UCHAR MaximumTokenTransferSize[8];
25203da77f91SVictor Perevertkin UCHAR OptimalTransferCount[8];
25213da77f91SVictor Perevertkin } WINDOWS_BLOCK_DEVICE_TOKEN_LIMITS_DESCRIPTOR, *PWINDOWS_BLOCK_DEVICE_TOKEN_LIMITS_DESCRIPTOR;
25223da77f91SVictor Perevertkin
25233da77f91SVictor Perevertkin #define BLOCK_DEVICE_TOKEN_LIMITS_DESCRIPTOR_TYPE_WINDOWS 0x00
25243da77f91SVictor Perevertkin
25253da77f91SVictor Perevertkin #endif /* (NTDDI_VERSION >= NTDDI_WIN8) */
25263da77f91SVictor Perevertkin
25273da77f91SVictor Perevertkin typedef struct _VPD_BLOCK_LIMITS_PAGE {
25283da77f91SVictor Perevertkin UCHAR DeviceType:5;
25293da77f91SVictor Perevertkin UCHAR DeviceTypeQualifier:3;
25303da77f91SVictor Perevertkin UCHAR PageCode;
25313da77f91SVictor Perevertkin UCHAR PageLength[2];
25323da77f91SVictor Perevertkin union {
25333da77f91SVictor Perevertkin struct {
25343da77f91SVictor Perevertkin UCHAR Reserved0;
25353da77f91SVictor Perevertkin UCHAR MaximumCompareAndWriteLength;
25363da77f91SVictor Perevertkin UCHAR OptimalTransferLengthGranularity[2];
25373da77f91SVictor Perevertkin UCHAR MaximumTransferLength[4];
25383da77f91SVictor Perevertkin UCHAR OptimalTransferLength[4];
25393da77f91SVictor Perevertkin UCHAR MaxPrefetchXDReadXDWriteTransferLength[4];
25403da77f91SVictor Perevertkin UCHAR MaximumUnmapLBACount[4];
25413da77f91SVictor Perevertkin UCHAR MaximumUnmapBlockDescriptorCount[4];
25423da77f91SVictor Perevertkin UCHAR OptimalUnmapGranularity[4];
25433da77f91SVictor Perevertkin union {
25443da77f91SVictor Perevertkin struct {
25453da77f91SVictor Perevertkin UCHAR UnmapGranularityAlignmentByte3:7;
25463da77f91SVictor Perevertkin UCHAR UGAValid:1;
25473da77f91SVictor Perevertkin UCHAR UnmapGranularityAlignmentByte2;
25483da77f91SVictor Perevertkin UCHAR UnmapGranularityAlignmentByte1;
25493da77f91SVictor Perevertkin UCHAR UnmapGranularityAlignmentByte0;
25503da77f91SVictor Perevertkin };
25513da77f91SVictor Perevertkin UCHAR UnmapGranularityAlignment[4];
25523da77f91SVictor Perevertkin };
25533da77f91SVictor Perevertkin UCHAR Reserved1[28];
25543da77f91SVictor Perevertkin };
25553da77f91SVictor Perevertkin #if !defined(__midl)
25563da77f91SVictor Perevertkin UCHAR Descriptors[0];
25573da77f91SVictor Perevertkin #endif
25583da77f91SVictor Perevertkin };
25593da77f91SVictor Perevertkin } VPD_BLOCK_LIMITS_PAGE, *PVPD_BLOCK_LIMITS_PAGE;
25603da77f91SVictor Perevertkin
25613da77f91SVictor Perevertkin #define ZONED_CAPABILITIES_NOT_REPORTED 0x0
25623da77f91SVictor Perevertkin #define ZONED_CAPABILITIES_HOST_AWARE 0x1
25633da77f91SVictor Perevertkin #define ZONED_CAPABILITIES_DEVICE_MANAGED 0x2
25643da77f91SVictor Perevertkin
25653da77f91SVictor Perevertkin typedef struct _VPD_BLOCK_DEVICE_CHARACTERISTICS_PAGE {
25663da77f91SVictor Perevertkin UCHAR DeviceType:5;
25673da77f91SVictor Perevertkin UCHAR DeviceTypeQualifier:3;
25683da77f91SVictor Perevertkin UCHAR PageCode;
25693da77f91SVictor Perevertkin UCHAR Reserved0;
25703da77f91SVictor Perevertkin UCHAR PageLength;
25713da77f91SVictor Perevertkin UCHAR MediumRotationRateMsb;
25723da77f91SVictor Perevertkin UCHAR MediumRotationRateLsb;
25733da77f91SVictor Perevertkin UCHAR MediumProductType;
25743da77f91SVictor Perevertkin UCHAR NominalFormFactor:4;
25753da77f91SVictor Perevertkin UCHAR WACEREQ:2;
25763da77f91SVictor Perevertkin UCHAR WABEREQ:2;
25773da77f91SVictor Perevertkin UCHAR VBULS:1;
25783da77f91SVictor Perevertkin UCHAR FUAB:1;
25793da77f91SVictor Perevertkin UCHAR BOCS:1;
25803da77f91SVictor Perevertkin UCHAR Reserved1:1;
25813da77f91SVictor Perevertkin UCHAR ZONED:2;
25823da77f91SVictor Perevertkin UCHAR Reserved2:2;
25833da77f91SVictor Perevertkin UCHAR Reserved3[3];
25843da77f91SVictor Perevertkin UCHAR DepopulationTime[4];
25853da77f91SVictor Perevertkin UCHAR Reserved4[48];
25863da77f91SVictor Perevertkin } VPD_BLOCK_DEVICE_CHARACTERISTICS_PAGE, *PVPD_BLOCK_DEVICE_CHARACTERISTICS_PAGE;
25873da77f91SVictor Perevertkin
25883da77f91SVictor Perevertkin #define PROVISIONING_TYPE_UNKNOWN 0x0
25893da77f91SVictor Perevertkin #define PROVISIONING_TYPE_RESOURCE 0x1
25903da77f91SVictor Perevertkin #define PROVISIONING_TYPE_THIN 0x2
25913da77f91SVictor Perevertkin
25923da77f91SVictor Perevertkin typedef struct _VPD_LOGICAL_BLOCK_PROVISIONING_PAGE {
25933da77f91SVictor Perevertkin UCHAR DeviceType:5;
25943da77f91SVictor Perevertkin UCHAR DeviceTypeQualifier:3;
25953da77f91SVictor Perevertkin UCHAR PageCode;
25963da77f91SVictor Perevertkin UCHAR PageLength[2];
25973da77f91SVictor Perevertkin UCHAR ThresholdExponent;
25983da77f91SVictor Perevertkin UCHAR DP:1;
25993da77f91SVictor Perevertkin UCHAR ANC_SUP:1;
26003da77f91SVictor Perevertkin UCHAR LBPRZ:1;
26013da77f91SVictor Perevertkin UCHAR Reserved0:2;
26023da77f91SVictor Perevertkin UCHAR LBPWS10:1;
26033da77f91SVictor Perevertkin UCHAR LBPWS:1;
26043da77f91SVictor Perevertkin UCHAR LBPU:1;
26053da77f91SVictor Perevertkin UCHAR ProvisioningType:3;
26063da77f91SVictor Perevertkin UCHAR Reserved1:5;
26073da77f91SVictor Perevertkin UCHAR Reserved2;
26083da77f91SVictor Perevertkin #if !defined(__midl)
26093da77f91SVictor Perevertkin UCHAR ProvisioningGroupDescr[0];
26103da77f91SVictor Perevertkin #endif
26113da77f91SVictor Perevertkin } VPD_LOGICAL_BLOCK_PROVISIONING_PAGE, *PVPD_LOGICAL_BLOCK_PROVISIONING_PAGE;
26123da77f91SVictor Perevertkin
26133da77f91SVictor Perevertkin typedef struct _VPD_ZONED_BLOCK_DEVICE_CHARACTERISTICS_PAGE {
26143da77f91SVictor Perevertkin UCHAR DeviceType:5;
26153da77f91SVictor Perevertkin UCHAR DeviceTypeQualifier:3;
26163da77f91SVictor Perevertkin UCHAR PageCode;
26173da77f91SVictor Perevertkin UCHAR PageLength[2];
26183da77f91SVictor Perevertkin UCHAR URSWRZ:1;
26193da77f91SVictor Perevertkin UCHAR Reserved1:7;
26203da77f91SVictor Perevertkin UCHAR Reserved2[3];
26213da77f91SVictor Perevertkin UCHAR OptimalNumberOfOpenSequentialWritePreferredZone[4];
26223da77f91SVictor Perevertkin UCHAR OptimalNumberOfNonSequentiallyWrittenSequentialWritePreferredZone[4];
26233da77f91SVictor Perevertkin UCHAR MaxNumberOfOpenSequentialWriteRequiredZone[4];
26243da77f91SVictor Perevertkin UCHAR Reserved3[44];
26253da77f91SVictor Perevertkin } VPD_ZONED_BLOCK_DEVICE_CHARACTERISTICS_PAGE, *PVPD_ZONED_BLOCK_DEVICE_CHARACTERISTICS_PAGE;
26263da77f91SVictor Perevertkin
2627c2c66affSColin Finck typedef struct _VPD_SUPPORTED_PAGES_PAGE {
2628c2c66affSColin Finck UCHAR DeviceType:5;
2629c2c66affSColin Finck UCHAR DeviceTypeQualifier:3;
2630c2c66affSColin Finck UCHAR PageCode;
2631c2c66affSColin Finck UCHAR Reserved;
2632c2c66affSColin Finck UCHAR PageLength;
2633c2c66affSColin Finck UCHAR SupportedPageList[0];
2634c2c66affSColin Finck } VPD_SUPPORTED_PAGES_PAGE, *PVPD_SUPPORTED_PAGES_PAGE;
2635c2c66affSColin Finck
2636c2c66affSColin Finck typedef struct _PRI_REGISTRATION_LIST {
2637c2c66affSColin Finck UCHAR Generation[4];
2638c2c66affSColin Finck UCHAR AdditionalLength[4];
2639c2c66affSColin Finck UCHAR ReservationKeyList[0][8];
2640c2c66affSColin Finck } PRI_REGISTRATION_LIST, *PPRI_REGISTRATION_LIST;
2641c2c66affSColin Finck
2642c2c66affSColin Finck typedef struct _PRI_RESERVATION_DESCRIPTOR {
2643c2c66affSColin Finck UCHAR ReservationKey[8];
2644c2c66affSColin Finck UCHAR ScopeSpecificAddress[4];
2645c2c66affSColin Finck UCHAR Reserved;
2646c2c66affSColin Finck UCHAR Type:4;
2647c2c66affSColin Finck UCHAR Scope:4;
2648c2c66affSColin Finck UCHAR Obsolete[2];
2649c2c66affSColin Finck } PRI_RESERVATION_DESCRIPTOR, *PPRI_RESERVATION_DESCRIPTOR;
2650c2c66affSColin Finck
2651c2c66affSColin Finck typedef struct _PRI_RESERVATION_LIST {
2652c2c66affSColin Finck UCHAR Generation[4];
2653c2c66affSColin Finck UCHAR AdditionalLength[4];
2654c2c66affSColin Finck PRI_RESERVATION_DESCRIPTOR Reservations[0];
2655c2c66affSColin Finck } PRI_RESERVATION_LIST, *PPRI_RESERVATION_LIST;
2656c2c66affSColin Finck
2657c2c66affSColin Finck typedef struct _PRO_PARAMETER_LIST {
2658c2c66affSColin Finck UCHAR ReservationKey[8];
2659c2c66affSColin Finck UCHAR ServiceActionReservationKey[8];
2660c2c66affSColin Finck UCHAR ScopeSpecificAddress[4];
2661c2c66affSColin Finck UCHAR ActivatePersistThroughPowerLoss:1;
2662c2c66affSColin Finck UCHAR Reserved1:7;
2663c2c66affSColin Finck UCHAR Reserved2;
2664c2c66affSColin Finck UCHAR Obsolete[2];
2665c2c66affSColin Finck } PRO_PARAMETER_LIST, *PPRO_PARAMETER_LIST;
2666c2c66affSColin Finck
2667c2c66affSColin Finck typedef struct _SENSE_DATA {
2668c2c66affSColin Finck UCHAR ErrorCode:7;
2669c2c66affSColin Finck UCHAR Valid:1;
2670c2c66affSColin Finck UCHAR SegmentNumber;
2671c2c66affSColin Finck UCHAR SenseKey:4;
2672c2c66affSColin Finck UCHAR Reserved:1;
2673c2c66affSColin Finck UCHAR IncorrectLength:1;
2674c2c66affSColin Finck UCHAR EndOfMedia:1;
2675c2c66affSColin Finck UCHAR FileMark:1;
2676c2c66affSColin Finck UCHAR Information[4];
2677c2c66affSColin Finck UCHAR AdditionalSenseLength;
2678c2c66affSColin Finck UCHAR CommandSpecificInformation[4];
2679c2c66affSColin Finck UCHAR AdditionalSenseCode;
2680c2c66affSColin Finck UCHAR AdditionalSenseCodeQualifier;
2681c2c66affSColin Finck UCHAR FieldReplaceableUnitCode;
2682c2c66affSColin Finck UCHAR SenseKeySpecific[3];
2683c2c66affSColin Finck } SENSE_DATA, *PSENSE_DATA;
2684c2c66affSColin Finck
26853da77f91SVictor Perevertkin typedef struct _SCSI_SENSE_DESCRIPTOR_HEADER {
26863da77f91SVictor Perevertkin UCHAR DescriptorType;
26873da77f91SVictor Perevertkin UCHAR AdditionalLength;
26883da77f91SVictor Perevertkin } SCSI_SENSE_DESCRIPTOR_HEADER, *PSCSI_SENSE_DESCRIPTOR_HEADER;
26893da77f91SVictor Perevertkin
26903da77f91SVictor Perevertkin typedef struct _SCSI_SENSE_DESCRIPTOR_INFORMATION {
26913da77f91SVictor Perevertkin SCSI_SENSE_DESCRIPTOR_HEADER Header;
26923da77f91SVictor Perevertkin UCHAR Valid:1;
26933da77f91SVictor Perevertkin UCHAR Reserved1:7;
26943da77f91SVictor Perevertkin UCHAR Reserved2;
26953da77f91SVictor Perevertkin UCHAR Information[8];
26963da77f91SVictor Perevertkin } SCSI_SENSE_DESCRIPTOR_INFORMATION, *PSCSI_SENSE_DESCRIPTOR_INFORMATION;
26973da77f91SVictor Perevertkin
26983da77f91SVictor Perevertkin typedef struct _SCSI_SENSE_DESCRIPTOR_BLOCK_COMMAND {
26993da77f91SVictor Perevertkin SCSI_SENSE_DESCRIPTOR_HEADER Header;
27003da77f91SVictor Perevertkin UCHAR Reserved1;
27013da77f91SVictor Perevertkin UCHAR Reserved2:5;
27023da77f91SVictor Perevertkin UCHAR IncorrectLength:1;
27033da77f91SVictor Perevertkin UCHAR Reserved3:2;
27043da77f91SVictor Perevertkin } SCSI_SENSE_DESCRIPTOR_BLOCK_COMMAND, *PSCSI_SENSE_DESCRIPTOR_BLOCK_COMMAND;
27053da77f91SVictor Perevertkin
27063da77f91SVictor Perevertkin typedef struct _SCSI_SENSE_DESCRIPTOR_ATA_STATUS_RETURN {
27073da77f91SVictor Perevertkin SCSI_SENSE_DESCRIPTOR_HEADER Header;
27083da77f91SVictor Perevertkin UCHAR Extend:1;
27093da77f91SVictor Perevertkin UCHAR Reserved1:7;
27103da77f91SVictor Perevertkin UCHAR Error;
27113da77f91SVictor Perevertkin UCHAR SectorCount15_8;
27123da77f91SVictor Perevertkin UCHAR SectorCount7_0;
27133da77f91SVictor Perevertkin UCHAR LbaLow15_8;
27143da77f91SVictor Perevertkin UCHAR LbaLow7_0;
27153da77f91SVictor Perevertkin UCHAR LbaMid15_8;
27163da77f91SVictor Perevertkin UCHAR LbaMid7_0;
27173da77f91SVictor Perevertkin UCHAR LbaHigh15_8;
27183da77f91SVictor Perevertkin UCHAR LbaHigh7_0;
27193da77f91SVictor Perevertkin UCHAR Device;
27203da77f91SVictor Perevertkin UCHAR Status;
27213da77f91SVictor Perevertkin } SCSI_SENSE_DESCRIPTOR_ATA_STATUS_RETURN, *PSCSI_SENSE_DESCRIPTOR_ATA_STATUS_RETURN;
27223da77f91SVictor Perevertkin
27233da77f91SVictor Perevertkin typedef struct _SENSE_DATA FIXED_SENSE_DATA, *PFIXED_SENSE_DATA;
27243da77f91SVictor Perevertkin
27253da77f91SVictor Perevertkin typedef struct _DESCRIPTOR_SENSE_DATA {
27263da77f91SVictor Perevertkin UCHAR ErrorCode:7;
27273da77f91SVictor Perevertkin UCHAR Reserved1:1;
27283da77f91SVictor Perevertkin UCHAR SenseKey:4;
27293da77f91SVictor Perevertkin UCHAR Reserved2:4;
27303da77f91SVictor Perevertkin UCHAR AdditionalSenseCode;
27313da77f91SVictor Perevertkin UCHAR AdditionalSenseCodeQualifier;
27323da77f91SVictor Perevertkin UCHAR Reserved3[3];
27333da77f91SVictor Perevertkin UCHAR AdditionalSenseLength;
27343da77f91SVictor Perevertkin UCHAR DescriptorBuffer[ANYSIZE_ARRAY];
27353da77f91SVictor Perevertkin } DESCRIPTOR_SENSE_DATA, *PDESCRIPTOR_SENSE_DATA;
27363da77f91SVictor Perevertkin
27373da77f91SVictor Perevertkin typedef union _SENSE_DATA_EX {
27383da77f91SVictor Perevertkin FIXED_SENSE_DATA FixedData;
27393da77f91SVictor Perevertkin DESCRIPTOR_SENSE_DATA DescriptorData;
27403da77f91SVictor Perevertkin } SENSE_DATA_EX, *PSENSE_DATA_EX;
27413da77f91SVictor Perevertkin
2742c2c66affSColin Finck /* Read Capacity Data. Returned in Big Endian format */
2743c2c66affSColin Finck typedef struct _READ_CAPACITY_DATA {
2744c2c66affSColin Finck ULONG LogicalBlockAddress;
2745c2c66affSColin Finck ULONG BytesPerBlock;
2746c2c66affSColin Finck } READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;
2747c2c66affSColin Finck
2748c2c66affSColin Finck typedef struct _READ_CAPACITY_DATA_EX {
2749c2c66affSColin Finck LARGE_INTEGER LogicalBlockAddress;
2750c2c66affSColin Finck ULONG BytesPerBlock;
2751c2c66affSColin Finck } READ_CAPACITY_DATA_EX, *PREAD_CAPACITY_DATA_EX;
2752c2c66affSColin Finck
27533da77f91SVictor Perevertkin #define RC_BASIS_LAST_LBA_NOT_SEQUENTIAL_WRITE_REQUIRED_ZONES 0x0
27543da77f91SVictor Perevertkin #define RC_BASIS_LAST_LBA_ON_LOGICAL_UNIT 0x1
27553da77f91SVictor Perevertkin
27563da77f91SVictor Perevertkin typedef struct _READ_CAPACITY16_DATA {
27573da77f91SVictor Perevertkin LARGE_INTEGER LogicalBlockAddress;
27583da77f91SVictor Perevertkin ULONG BytesPerBlock;
27593da77f91SVictor Perevertkin UCHAR ProtectionEnable:1;
27603da77f91SVictor Perevertkin UCHAR ProtectionType:3;
27613da77f91SVictor Perevertkin UCHAR RcBasis:2;
27623da77f91SVictor Perevertkin UCHAR Reserved:2;
27633da77f91SVictor Perevertkin UCHAR LogicalPerPhysicalExponent:4;
27643da77f91SVictor Perevertkin UCHAR ProtectionInfoExponent:4;
27653da77f91SVictor Perevertkin UCHAR LowestAlignedBlock_MSB:6;
27663da77f91SVictor Perevertkin UCHAR LBPRZ:1;
27673da77f91SVictor Perevertkin UCHAR LBPME:1;
27683da77f91SVictor Perevertkin UCHAR LowestAlignedBlock_LSB;
27693da77f91SVictor Perevertkin UCHAR Reserved3[16];
27703da77f91SVictor Perevertkin } READ_CAPACITY16_DATA, *PREAD_CAPACITY16_DATA;
27713da77f91SVictor Perevertkin
27723da77f91SVictor Perevertkin typedef struct _LBA_STATUS_DESCRIPTOR {
27733da77f91SVictor Perevertkin ULONGLONG StartingLBA;
27743da77f91SVictor Perevertkin ULONG LogicalBlockCount;
27753da77f91SVictor Perevertkin UCHAR ProvisioningStatus:4;
27763da77f91SVictor Perevertkin UCHAR Reserved1:4;
27773da77f91SVictor Perevertkin UCHAR Reserved2[3];
27783da77f91SVictor Perevertkin } LBA_STATUS_DESCRIPTOR, *PLBA_STATUS_DESCRIPTOR;
27793da77f91SVictor Perevertkin
27803da77f91SVictor Perevertkin typedef struct _LBA_STATUS_LIST_HEADER {
27813da77f91SVictor Perevertkin ULONG ParameterLength;
27823da77f91SVictor Perevertkin ULONG Reserved;
27833da77f91SVictor Perevertkin LBA_STATUS_DESCRIPTOR Descriptors[0];
27843da77f91SVictor Perevertkin } LBA_STATUS_LIST_HEADER, *PLBA_STATUS_LIST_HEADER;
27853da77f91SVictor Perevertkin
27863da77f91SVictor Perevertkin #define LBA_STATUS_MAPPED 0x0
27873da77f91SVictor Perevertkin #define LBA_STATUS_DEALLOCATED 0x1
27883da77f91SVictor Perevertkin #define LBA_STATUS_ANCHORED 0x2
27893da77f91SVictor Perevertkin
2790c2c66affSColin Finck /* Read Block Limits Data. Returned in Big Endian format */
2791c2c66affSColin Finck typedef struct _READ_BLOCK_LIMITS {
2792c2c66affSColin Finck UCHAR Reserved;
2793c2c66affSColin Finck UCHAR BlockMaximumSize[3];
2794c2c66affSColin Finck UCHAR BlockMinimumSize[2];
2795c2c66affSColin Finck } READ_BLOCK_LIMITS_DATA, *PREAD_BLOCK_LIMITS_DATA;
2796c2c66affSColin Finck
2797c2c66affSColin Finck typedef struct _READ_BUFFER_CAPACITY_DATA {
2798c2c66affSColin Finck UCHAR DataLength[2];
2799c2c66affSColin Finck UCHAR Reserved1;
2800c2c66affSColin Finck UCHAR BlockDataReturned:1;
2801c2c66affSColin Finck UCHAR Reserved4:7;
2802c2c66affSColin Finck UCHAR TotalBufferSize[4];
2803c2c66affSColin Finck UCHAR AvailableBufferSize[4];
2804c2c66affSColin Finck } READ_BUFFER_CAPACITY_DATA, *PREAD_BUFFER_CAPACITY_DATA;
2805c2c66affSColin Finck
2806c2c66affSColin Finck typedef struct _MODE_PARAMETER_HEADER {
2807c2c66affSColin Finck UCHAR ModeDataLength;
2808c2c66affSColin Finck UCHAR MediumType;
2809c2c66affSColin Finck UCHAR DeviceSpecificParameter;
2810c2c66affSColin Finck UCHAR BlockDescriptorLength;
2811c2c66affSColin Finck } MODE_PARAMETER_HEADER, *PMODE_PARAMETER_HEADER;
2812c2c66affSColin Finck
2813c2c66affSColin Finck typedef struct _MODE_PARAMETER_HEADER10 {
2814c2c66affSColin Finck UCHAR ModeDataLength[2];
2815c2c66affSColin Finck UCHAR MediumType;
2816c2c66affSColin Finck UCHAR DeviceSpecificParameter;
2817c2c66affSColin Finck UCHAR Reserved[2];
2818c2c66affSColin Finck UCHAR BlockDescriptorLength[2];
2819c2c66affSColin Finck } MODE_PARAMETER_HEADER10, *PMODE_PARAMETER_HEADER10;
2820c2c66affSColin Finck
2821c2c66affSColin Finck typedef struct _MODE_PARAMETER_BLOCK {
2822c2c66affSColin Finck UCHAR DensityCode;
2823c2c66affSColin Finck UCHAR NumberOfBlocks[3];
2824c2c66affSColin Finck UCHAR Reserved;
2825c2c66affSColin Finck UCHAR BlockLength[3];
2826c2c66affSColin Finck } MODE_PARAMETER_BLOCK, *PMODE_PARAMETER_BLOCK;
2827c2c66affSColin Finck
2828c2c66affSColin Finck typedef struct _MODE_DISCONNECT_PAGE {
2829c2c66affSColin Finck UCHAR PageCode:6;
2830c2c66affSColin Finck UCHAR Reserved:1;
2831c2c66affSColin Finck UCHAR PageSavable:1;
2832c2c66affSColin Finck UCHAR PageLength;
2833c2c66affSColin Finck UCHAR BufferFullRatio;
2834c2c66affSColin Finck UCHAR BufferEmptyRatio;
2835c2c66affSColin Finck UCHAR BusInactivityLimit[2];
2836c2c66affSColin Finck UCHAR BusDisconnectTime[2];
2837c2c66affSColin Finck UCHAR BusConnectTime[2];
2838c2c66affSColin Finck UCHAR MaximumBurstSize[2];
2839c2c66affSColin Finck UCHAR DataTransferDisconnect:2;
2840c2c66affSColin Finck UCHAR Reserved2[3];
2841c2c66affSColin Finck } MODE_DISCONNECT_PAGE, *PMODE_DISCONNECT_PAGE;
2842c2c66affSColin Finck
2843c2c66affSColin Finck typedef struct _MODE_CACHING_PAGE {
2844c2c66affSColin Finck UCHAR PageCode:6;
2845c2c66affSColin Finck UCHAR Reserved:1;
2846c2c66affSColin Finck UCHAR PageSavable:1;
2847c2c66affSColin Finck UCHAR PageLength;
2848c2c66affSColin Finck UCHAR ReadDisableCache:1;
2849c2c66affSColin Finck UCHAR MultiplicationFactor:1;
2850c2c66affSColin Finck UCHAR WriteCacheEnable:1;
2851c2c66affSColin Finck UCHAR Reserved2:5;
2852c2c66affSColin Finck UCHAR WriteRetensionPriority:4;
2853c2c66affSColin Finck UCHAR ReadRetensionPriority:4;
2854c2c66affSColin Finck UCHAR DisablePrefetchTransfer[2];
2855c2c66affSColin Finck UCHAR MinimumPrefetch[2];
2856c2c66affSColin Finck UCHAR MaximumPrefetch[2];
2857c2c66affSColin Finck UCHAR MaximumPrefetchCeiling[2];
2858c2c66affSColin Finck } MODE_CACHING_PAGE, *PMODE_CACHING_PAGE;
2859c2c66affSColin Finck
2860c2c66affSColin Finck typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE2 {
2861c2c66affSColin Finck UCHAR PageCode:6;
2862c2c66affSColin Finck UCHAR Reserved:1;
2863c2c66affSColin Finck UCHAR PageSavable:1;
2864c2c66affSColin Finck UCHAR PageLength;
2865c2c66affSColin Finck UCHAR WriteType:4;
2866c2c66affSColin Finck UCHAR TestWrite:1;
2867c2c66affSColin Finck UCHAR LinkSizeValid:1;
2868c2c66affSColin Finck UCHAR BufferUnderrunFreeEnabled:1;
2869c2c66affSColin Finck UCHAR Reserved2:1;
2870c2c66affSColin Finck UCHAR TrackMode:4;
2871c2c66affSColin Finck UCHAR Copy:1;
2872c2c66affSColin Finck UCHAR FixedPacket:1;
2873c2c66affSColin Finck UCHAR MultiSession:2;
2874c2c66affSColin Finck UCHAR DataBlockType:4;
2875c2c66affSColin Finck UCHAR Reserved3:4;
2876c2c66affSColin Finck UCHAR LinkSize;
2877c2c66affSColin Finck UCHAR Reserved4;
2878c2c66affSColin Finck UCHAR HostApplicationCode:6;
2879c2c66affSColin Finck UCHAR Reserved5:2;
2880c2c66affSColin Finck UCHAR SessionFormat;
2881c2c66affSColin Finck UCHAR Reserved6;
2882c2c66affSColin Finck UCHAR PacketSize[4];
2883c2c66affSColin Finck UCHAR AudioPauseLength[2];
2884c2c66affSColin Finck UCHAR MediaCatalogNumber[16];
2885c2c66affSColin Finck UCHAR ISRC[16];
2886c2c66affSColin Finck UCHAR SubHeaderData[4];
2887c2c66affSColin Finck } MODE_CDROM_WRITE_PARAMETERS_PAGE2, *PMODE_CDROM_WRITE_PARAMETERS_PAGE2;
2888c2c66affSColin Finck
2889c2c66affSColin Finck typedef struct _MODE_MRW_PAGE {
2890c2c66affSColin Finck UCHAR PageCode:6;
2891c2c66affSColin Finck UCHAR Reserved:1;
2892c2c66affSColin Finck UCHAR PageSavable:1;
2893c2c66affSColin Finck UCHAR PageLength;
2894c2c66affSColin Finck UCHAR Reserved1;
2895c2c66affSColin Finck UCHAR LbaSpace:1;
2896c2c66affSColin Finck UCHAR Reserved2:7;
2897c2c66affSColin Finck UCHAR Reserved3[4];
2898c2c66affSColin Finck } MODE_MRW_PAGE, *PMODE_MRW_PAGE;
2899c2c66affSColin Finck
2900c2c66affSColin Finck typedef struct _MODE_FLEXIBLE_DISK_PAGE {
2901c2c66affSColin Finck UCHAR PageCode:6;
2902c2c66affSColin Finck UCHAR Reserved:1;
2903c2c66affSColin Finck UCHAR PageSavable:1;
2904c2c66affSColin Finck UCHAR PageLength;
2905c2c66affSColin Finck UCHAR TransferRate[2];
2906c2c66affSColin Finck UCHAR NumberOfHeads;
2907c2c66affSColin Finck UCHAR SectorsPerTrack;
2908c2c66affSColin Finck UCHAR BytesPerSector[2];
2909c2c66affSColin Finck UCHAR NumberOfCylinders[2];
2910c2c66affSColin Finck UCHAR StartWritePrecom[2];
2911c2c66affSColin Finck UCHAR StartReducedCurrent[2];
2912c2c66affSColin Finck UCHAR StepRate[2];
2913c2c66affSColin Finck UCHAR StepPluseWidth;
2914c2c66affSColin Finck UCHAR HeadSettleDelay[2];
2915c2c66affSColin Finck UCHAR MotorOnDelay;
2916c2c66affSColin Finck UCHAR MotorOffDelay;
2917c2c66affSColin Finck UCHAR Reserved2:5;
2918c2c66affSColin Finck UCHAR MotorOnAsserted:1;
2919c2c66affSColin Finck UCHAR StartSectorNumber:1;
2920c2c66affSColin Finck UCHAR TrueReadySignal:1;
2921c2c66affSColin Finck UCHAR StepPlusePerCyclynder:4;
2922c2c66affSColin Finck UCHAR Reserved3:4;
2923c2c66affSColin Finck UCHAR WriteCompenstation;
2924c2c66affSColin Finck UCHAR HeadLoadDelay;
2925c2c66affSColin Finck UCHAR HeadUnloadDelay;
2926c2c66affSColin Finck UCHAR Pin2Usage:4;
2927c2c66affSColin Finck UCHAR Pin34Usage:4;
2928c2c66affSColin Finck UCHAR Pin1Usage:4;
2929c2c66affSColin Finck UCHAR Pin4Usage:4;
2930c2c66affSColin Finck UCHAR MediumRotationRate[2];
2931c2c66affSColin Finck UCHAR Reserved4[2];
2932c2c66affSColin Finck } MODE_FLEXIBLE_DISK_PAGE, *PMODE_FLEXIBLE_DISK_PAGE;
2933c2c66affSColin Finck
2934c2c66affSColin Finck typedef struct _MODE_FORMAT_PAGE {
2935c2c66affSColin Finck UCHAR PageCode:6;
2936c2c66affSColin Finck UCHAR Reserved:1;
2937c2c66affSColin Finck UCHAR PageSavable:1;
2938c2c66affSColin Finck UCHAR PageLength;
2939c2c66affSColin Finck UCHAR TracksPerZone[2];
2940c2c66affSColin Finck UCHAR AlternateSectorsPerZone[2];
2941c2c66affSColin Finck UCHAR AlternateTracksPerZone[2];
2942c2c66affSColin Finck UCHAR AlternateTracksPerLogicalUnit[2];
2943c2c66affSColin Finck UCHAR SectorsPerTrack[2];
2944c2c66affSColin Finck UCHAR BytesPerPhysicalSector[2];
2945c2c66affSColin Finck UCHAR Interleave[2];
2946c2c66affSColin Finck UCHAR TrackSkewFactor[2];
2947c2c66affSColin Finck UCHAR CylinderSkewFactor[2];
2948c2c66affSColin Finck UCHAR Reserved2:4;
2949c2c66affSColin Finck UCHAR SurfaceFirst:1;
2950c2c66affSColin Finck UCHAR RemovableMedia:1;
2951c2c66affSColin Finck UCHAR HardSectorFormating:1;
2952c2c66affSColin Finck UCHAR SoftSectorFormating:1;
2953c2c66affSColin Finck UCHAR Reserved3[3];
2954c2c66affSColin Finck } MODE_FORMAT_PAGE, *PMODE_FORMAT_PAGE;
2955c2c66affSColin Finck
2956c2c66affSColin Finck typedef struct _MODE_RIGID_GEOMETRY_PAGE {
2957c2c66affSColin Finck UCHAR PageCode:6;
2958c2c66affSColin Finck UCHAR Reserved:1;
2959c2c66affSColin Finck UCHAR PageSavable:1;
2960c2c66affSColin Finck UCHAR PageLength;
2961c2c66affSColin Finck UCHAR NumberOfCylinders[3];
2962c2c66affSColin Finck UCHAR NumberOfHeads;
2963c2c66affSColin Finck UCHAR StartWritePrecom[3];
2964c2c66affSColin Finck UCHAR StartReducedCurrent[3];
2965c2c66affSColin Finck UCHAR DriveStepRate[2];
2966c2c66affSColin Finck UCHAR LandZoneCyclinder[3];
2967c2c66affSColin Finck UCHAR RotationalPositionLock:2;
2968c2c66affSColin Finck UCHAR Reserved2:6;
2969c2c66affSColin Finck UCHAR RotationOffset;
2970c2c66affSColin Finck UCHAR Reserved3;
2971c2c66affSColin Finck UCHAR RoataionRate[2];
2972c2c66affSColin Finck UCHAR Reserved4[2];
2973c2c66affSColin Finck } MODE_RIGID_GEOMETRY_PAGE, *PMODE_RIGID_GEOMETRY_PAGE;
2974c2c66affSColin Finck
2975c2c66affSColin Finck typedef struct _MODE_READ_WRITE_RECOVERY_PAGE {
2976c2c66affSColin Finck UCHAR PageCode:6;
2977c2c66affSColin Finck UCHAR Reserved1:1;
2978c2c66affSColin Finck UCHAR PSBit:1;
2979c2c66affSColin Finck UCHAR PageLength;
2980c2c66affSColin Finck UCHAR DCRBit:1;
2981c2c66affSColin Finck UCHAR DTEBit:1;
2982c2c66affSColin Finck UCHAR PERBit:1;
2983c2c66affSColin Finck UCHAR EERBit:1;
2984c2c66affSColin Finck UCHAR RCBit:1;
2985c2c66affSColin Finck UCHAR TBBit:1;
2986c2c66affSColin Finck UCHAR ARRE:1;
2987c2c66affSColin Finck UCHAR AWRE:1;
2988c2c66affSColin Finck UCHAR ReadRetryCount;
2989c2c66affSColin Finck UCHAR Reserved4[4];
2990c2c66affSColin Finck UCHAR WriteRetryCount;
2991c2c66affSColin Finck UCHAR Reserved5[3];
2992c2c66affSColin Finck } MODE_READ_WRITE_RECOVERY_PAGE, *PMODE_READ_WRITE_RECOVERY_PAGE;
2993c2c66affSColin Finck
2994c2c66affSColin Finck typedef struct _MODE_READ_RECOVERY_PAGE {
2995c2c66affSColin Finck UCHAR PageCode:6;
2996c2c66affSColin Finck UCHAR Reserved1:1;
2997c2c66affSColin Finck UCHAR PSBit:1;
2998c2c66affSColin Finck UCHAR PageLength;
2999c2c66affSColin Finck UCHAR DCRBit:1;
3000c2c66affSColin Finck UCHAR DTEBit:1;
3001c2c66affSColin Finck UCHAR PERBit:1;
3002c2c66affSColin Finck UCHAR Reserved2:1;
3003c2c66affSColin Finck UCHAR RCBit:1;
3004c2c66affSColin Finck UCHAR TBBit:1;
3005c2c66affSColin Finck UCHAR Reserved3:2;
3006c2c66affSColin Finck UCHAR ReadRetryCount;
3007c2c66affSColin Finck UCHAR Reserved4[4];
3008c2c66affSColin Finck } MODE_READ_RECOVERY_PAGE, *PMODE_READ_RECOVERY_PAGE;
3009c2c66affSColin Finck
3010c2c66affSColin Finck typedef struct _MODE_INFO_EXCEPTIONS {
3011c2c66affSColin Finck UCHAR PageCode:6;
3012c2c66affSColin Finck UCHAR Reserved1:1;
3013c2c66affSColin Finck UCHAR PSBit:1;
3014c2c66affSColin Finck UCHAR PageLength;
3015c2c66affSColin Finck _ANONYMOUS_UNION union {
3016c2c66affSColin Finck UCHAR Flags;
3017c2c66affSColin Finck _ANONYMOUS_STRUCT struct {
3018c2c66affSColin Finck UCHAR LogErr:1;
3019c2c66affSColin Finck UCHAR Reserved2:1;
3020c2c66affSColin Finck UCHAR Test:1;
3021c2c66affSColin Finck UCHAR Dexcpt:1;
3022c2c66affSColin Finck UCHAR Reserved3:3;
3023c2c66affSColin Finck UCHAR Perf:1;
3024c2c66affSColin Finck } DUMMYSTRUCTNAME;
3025c2c66affSColin Finck } DUMMYUNIONNAME;
3026c2c66affSColin Finck UCHAR ReportMethod:4;
3027c2c66affSColin Finck UCHAR Reserved4:4;
3028c2c66affSColin Finck UCHAR IntervalTimer[4];
3029c2c66affSColin Finck UCHAR ReportCount[4];
3030c2c66affSColin Finck } MODE_INFO_EXCEPTIONS, *PMODE_INFO_EXCEPTIONS;
3031c2c66affSColin Finck
3032c2c66affSColin Finck typedef struct _POWER_CONDITION_PAGE {
3033c2c66affSColin Finck UCHAR PageCode:6;
3034c2c66affSColin Finck UCHAR Reserved:1;
3035c2c66affSColin Finck UCHAR PSBit:1;
3036c2c66affSColin Finck UCHAR PageLength;
3037c2c66affSColin Finck UCHAR Reserved2;
3038c2c66affSColin Finck UCHAR Standby:1;
3039c2c66affSColin Finck UCHAR Idle:1;
3040c2c66affSColin Finck UCHAR Reserved3:6;
3041c2c66affSColin Finck UCHAR IdleTimer[4];
3042c2c66affSColin Finck UCHAR StandbyTimer[4];
3043c2c66affSColin Finck } POWER_CONDITION_PAGE, *PPOWER_CONDITION_PAGE;
3044c2c66affSColin Finck
3045c2c66affSColin Finck typedef struct _CDDA_OUTPUT_PORT {
3046c2c66affSColin Finck UCHAR ChannelSelection:4;
3047c2c66affSColin Finck UCHAR Reserved:4;
3048c2c66affSColin Finck UCHAR Volume;
3049c2c66affSColin Finck } CDDA_OUTPUT_PORT, *PCDDA_OUTPUT_PORT;
3050c2c66affSColin Finck
3051c2c66affSColin Finck typedef struct _CDAUDIO_CONTROL_PAGE {
3052c2c66affSColin Finck UCHAR PageCode:6;
3053c2c66affSColin Finck UCHAR Reserved:1;
3054c2c66affSColin Finck UCHAR PSBit:1;
3055c2c66affSColin Finck UCHAR PageLength;
3056c2c66affSColin Finck UCHAR Reserved2:1;
3057c2c66affSColin Finck UCHAR StopOnTrackCrossing:1;
3058c2c66affSColin Finck UCHAR Immediate:1;
3059c2c66affSColin Finck UCHAR Reserved3:5;
3060c2c66affSColin Finck UCHAR Reserved4[3];
3061c2c66affSColin Finck UCHAR Obsolete[2];
3062c2c66affSColin Finck CDDA_OUTPUT_PORT CDDAOutputPorts[4];
3063c2c66affSColin Finck } CDAUDIO_CONTROL_PAGE, *PCDAUDIO_CONTROL_PAGE;
3064c2c66affSColin Finck
3065c2c66affSColin Finck typedef struct _CDVD_FEATURE_SET_PAGE {
3066c2c66affSColin Finck UCHAR PageCode:6;
3067c2c66affSColin Finck UCHAR Reserved:1;
3068c2c66affSColin Finck UCHAR PSBit:1;
3069c2c66affSColin Finck UCHAR PageLength;
3070c2c66affSColin Finck UCHAR CDAudio[2];
3071c2c66affSColin Finck UCHAR EmbeddedChanger[2];
3072c2c66affSColin Finck UCHAR PacketSMART[2];
3073c2c66affSColin Finck UCHAR PersistantPrevent[2];
3074c2c66affSColin Finck UCHAR EventStatusNotification[2];
3075c2c66affSColin Finck UCHAR DigitalOutput[2];
3076c2c66affSColin Finck UCHAR CDSequentialRecordable[2];
3077c2c66affSColin Finck UCHAR DVDSequentialRecordable[2];
3078c2c66affSColin Finck UCHAR RandomRecordable[2];
3079c2c66affSColin Finck UCHAR KeyExchange[2];
3080c2c66affSColin Finck UCHAR Reserved2[2];
3081c2c66affSColin Finck } CDVD_FEATURE_SET_PAGE, *PCDVD_FEATURE_SET_PAGE;
3082c2c66affSColin Finck
3083c2c66affSColin Finck typedef struct _CDVD_INACTIVITY_TIMEOUT_PAGE {
3084c2c66affSColin Finck UCHAR PageCode:6;
3085c2c66affSColin Finck UCHAR Reserved:1;
3086c2c66affSColin Finck UCHAR PSBit:1;
3087c2c66affSColin Finck UCHAR PageLength;
3088c2c66affSColin Finck UCHAR Reserved2[2];
3089c2c66affSColin Finck UCHAR SWPP:1;
3090c2c66affSColin Finck UCHAR DISP:1;
3091c2c66affSColin Finck UCHAR Reserved3:6;
3092c2c66affSColin Finck UCHAR Reserved4;
3093c2c66affSColin Finck UCHAR GroupOneMinimumTimeout[2];
3094c2c66affSColin Finck UCHAR GroupTwoMinimumTimeout[2];
3095c2c66affSColin Finck } CDVD_INACTIVITY_TIMEOUT_PAGE, *PCDVD_INACTIVITY_TIMEOUT_PAGE;
3096c2c66affSColin Finck
3097c2c66affSColin Finck typedef struct _CDVD_CAPABILITIES_PAGE {
3098c2c66affSColin Finck UCHAR PageCode:6;
3099c2c66affSColin Finck UCHAR Reserved:1;
3100c2c66affSColin Finck UCHAR PSBit:1;
3101c2c66affSColin Finck UCHAR PageLength;
3102c2c66affSColin Finck UCHAR CDRRead:1;
3103c2c66affSColin Finck UCHAR CDERead:1;
3104c2c66affSColin Finck UCHAR Method2:1;
3105c2c66affSColin Finck UCHAR DVDROMRead:1;
3106c2c66affSColin Finck UCHAR DVDRRead:1;
3107c2c66affSColin Finck UCHAR DVDRAMRead:1;
3108c2c66affSColin Finck UCHAR Reserved2:2;
3109c2c66affSColin Finck UCHAR CDRWrite:1;
3110c2c66affSColin Finck UCHAR CDEWrite:1;
3111c2c66affSColin Finck UCHAR TestWrite:1;
3112c2c66affSColin Finck UCHAR Reserved3:1;
3113c2c66affSColin Finck UCHAR DVDRWrite:1;
3114c2c66affSColin Finck UCHAR DVDRAMWrite:1;
3115c2c66affSColin Finck UCHAR Reserved4:2;
3116c2c66affSColin Finck UCHAR AudioPlay:1;
3117c2c66affSColin Finck UCHAR Composite:1;
3118c2c66affSColin Finck UCHAR DigitalPortOne:1;
3119c2c66affSColin Finck UCHAR DigitalPortTwo:1;
3120c2c66affSColin Finck UCHAR Mode2Form1:1;
3121c2c66affSColin Finck UCHAR Mode2Form2:1;
3122c2c66affSColin Finck UCHAR MultiSession:1;
3123c2c66affSColin Finck UCHAR BufferUnderrunFree:1;
3124c2c66affSColin Finck UCHAR CDDA:1;
3125c2c66affSColin Finck UCHAR CDDAAccurate:1;
3126c2c66affSColin Finck UCHAR RWSupported:1;
3127c2c66affSColin Finck UCHAR RWDeinterleaved:1;
3128c2c66affSColin Finck UCHAR C2Pointers:1;
3129c2c66affSColin Finck UCHAR ISRC:1;
3130c2c66affSColin Finck UCHAR UPC:1;
3131c2c66affSColin Finck UCHAR ReadBarCodeCapable:1;
3132c2c66affSColin Finck UCHAR Lock:1;
3133c2c66affSColin Finck UCHAR LockState:1;
3134c2c66affSColin Finck UCHAR PreventJumper:1;
3135c2c66affSColin Finck UCHAR Eject:1;
3136c2c66affSColin Finck UCHAR Reserved6:1;
3137c2c66affSColin Finck UCHAR LoadingMechanismType:3;
3138c2c66affSColin Finck UCHAR SeparateVolume:1;
3139c2c66affSColin Finck UCHAR SeperateChannelMute:1;
3140c2c66affSColin Finck UCHAR SupportsDiskPresent:1;
3141c2c66affSColin Finck UCHAR SWSlotSelection:1;
3142c2c66affSColin Finck UCHAR SideChangeCapable:1;
3143c2c66affSColin Finck UCHAR RWInLeadInReadable:1;
3144c2c66affSColin Finck UCHAR Reserved7:2;
3145c2c66affSColin Finck _ANONYMOUS_UNION union {
3146c2c66affSColin Finck UCHAR ReadSpeedMaximum[2];
3147c2c66affSColin Finck UCHAR ObsoleteReserved[2];
3148c2c66affSColin Finck } DUMMYUNIONNAME;
3149c2c66affSColin Finck UCHAR NumberVolumeLevels[2];
3150c2c66affSColin Finck UCHAR BufferSize[2];
3151c2c66affSColin Finck _ANONYMOUS_UNION union {
3152c2c66affSColin Finck UCHAR ReadSpeedCurrent[2];
3153c2c66affSColin Finck UCHAR ObsoleteReserved2[2];
3154c2c66affSColin Finck } DUMMYUNIONNAME2;
3155c2c66affSColin Finck UCHAR ObsoleteReserved3;
3156c2c66affSColin Finck UCHAR Reserved8:1;
3157c2c66affSColin Finck UCHAR BCK:1;
3158c2c66affSColin Finck UCHAR RCK:1;
3159c2c66affSColin Finck UCHAR LSBF:1;
3160c2c66affSColin Finck UCHAR Length:2;
3161c2c66affSColin Finck UCHAR Reserved9:2;
3162c2c66affSColin Finck _ANONYMOUS_UNION union {
3163c2c66affSColin Finck UCHAR WriteSpeedMaximum[2];
3164c2c66affSColin Finck UCHAR ObsoleteReserved4[2];
3165c2c66affSColin Finck } DUMMYUNIONNAME3;
3166c2c66affSColin Finck _ANONYMOUS_UNION union {
3167c2c66affSColin Finck UCHAR WriteSpeedCurrent[2];
3168c2c66affSColin Finck UCHAR ObsoleteReserved11[2];
3169c2c66affSColin Finck } DUMMYUNIONNAME4;
3170c2c66affSColin Finck _ANONYMOUS_UNION union {
3171c2c66affSColin Finck UCHAR CopyManagementRevision[2];
3172c2c66affSColin Finck UCHAR Reserved10[2];
3173c2c66affSColin Finck } DUMMYUNIONNAME5;
3174c2c66affSColin Finck } CDVD_CAPABILITIES_PAGE, *PCDVD_CAPABILITIES_PAGE;
3175c2c66affSColin Finck
3176c2c66affSColin Finck typedef struct _LUN_LIST {
3177c2c66affSColin Finck UCHAR LunListLength[4];
3178c2c66affSColin Finck UCHAR Reserved[4];
3179c2c66affSColin Finck UCHAR Lun[0][8];
3180c2c66affSColin Finck } LUN_LIST, *PLUN_LIST;
3181c2c66affSColin Finck
3182c2c66affSColin Finck typedef struct _MODE_PARM_READ_WRITE {
3183c2c66affSColin Finck MODE_PARAMETER_HEADER ParameterListHeader;
3184c2c66affSColin Finck MODE_PARAMETER_BLOCK ParameterListBlock;
3185c2c66affSColin Finck } MODE_PARM_READ_WRITE_DATA, *PMODE_PARM_READ_WRITE_DATA;
3186c2c66affSColin Finck
3187c2c66affSColin Finck typedef struct _PORT_OUTPUT {
3188c2c66affSColin Finck UCHAR ChannelSelection;
3189c2c66affSColin Finck UCHAR Volume;
3190c2c66affSColin Finck } PORT_OUTPUT, *PPORT_OUTPUT;
3191c2c66affSColin Finck
3192c2c66affSColin Finck typedef struct _AUDIO_OUTPUT {
3193c2c66affSColin Finck UCHAR CodePage;
3194c2c66affSColin Finck UCHAR ParameterLength;
3195c2c66affSColin Finck UCHAR Immediate;
3196c2c66affSColin Finck UCHAR Reserved[2];
3197c2c66affSColin Finck UCHAR LbaFormat;
3198c2c66affSColin Finck UCHAR LogicalBlocksPerSecond[2];
3199c2c66affSColin Finck PORT_OUTPUT PortOutput[4];
3200c2c66affSColin Finck } AUDIO_OUTPUT, *PAUDIO_OUTPUT;
3201c2c66affSColin Finck
3202c2c66affSColin Finck /* Atapi 2.5 changers */
3203c2c66affSColin Finck typedef struct _MECHANICAL_STATUS_INFORMATION_HEADER {
3204c2c66affSColin Finck UCHAR CurrentSlot:5;
3205c2c66affSColin Finck UCHAR ChangerState:2;
3206c2c66affSColin Finck UCHAR Fault:1;
3207c2c66affSColin Finck UCHAR Reserved:5;
3208c2c66affSColin Finck UCHAR MechanismState:3;
3209c2c66affSColin Finck UCHAR CurrentLogicalBlockAddress[3];
3210c2c66affSColin Finck UCHAR NumberAvailableSlots;
3211c2c66affSColin Finck UCHAR SlotTableLength[2];
3212c2c66affSColin Finck } MECHANICAL_STATUS_INFORMATION_HEADER, *PMECHANICAL_STATUS_INFORMATION_HEADER;
3213c2c66affSColin Finck
3214c2c66affSColin Finck typedef struct _SLOT_TABLE_INFORMATION {
3215c2c66affSColin Finck UCHAR DiscChanged:1;
3216c2c66affSColin Finck UCHAR Reserved:6;
3217c2c66affSColin Finck UCHAR DiscPresent:1;
3218c2c66affSColin Finck UCHAR Reserved2[3];
3219c2c66affSColin Finck } SLOT_TABLE_INFORMATION, *PSLOT_TABLE_INFORMATION;
3220c2c66affSColin Finck
3221c2c66affSColin Finck typedef struct _MECHANICAL_STATUS {
3222c2c66affSColin Finck MECHANICAL_STATUS_INFORMATION_HEADER MechanicalStatusHeader;
3223c2c66affSColin Finck SLOT_TABLE_INFORMATION SlotTableInfo[1];
3224c2c66affSColin Finck } MECHANICAL_STATUS, *PMECHANICAL_STATUS;
3225c2c66affSColin Finck
3226c2c66affSColin Finck /* Tape definitions */
3227c2c66affSColin Finck typedef struct _TAPE_POSITION_DATA {
3228c2c66affSColin Finck UCHAR Reserved1:2;
3229c2c66affSColin Finck UCHAR BlockPositionUnsupported:1;
3230c2c66affSColin Finck UCHAR Reserved2:3;
3231c2c66affSColin Finck UCHAR EndOfPartition:1;
3232c2c66affSColin Finck UCHAR BeginningOfPartition:1;
3233c2c66affSColin Finck UCHAR PartitionNumber;
3234c2c66affSColin Finck USHORT Reserved3;
3235c2c66affSColin Finck UCHAR FirstBlock[4];
3236c2c66affSColin Finck UCHAR LastBlock[4];
3237c2c66affSColin Finck UCHAR Reserved4;
3238c2c66affSColin Finck UCHAR NumberOfBlocks[3];
3239c2c66affSColin Finck UCHAR NumberOfBytes[4];
3240c2c66affSColin Finck } TAPE_POSITION_DATA, *PTAPE_POSITION_DATA;
3241c2c66affSColin Finck
32423da77f91SVictor Perevertkin #include <pshpack1.h>
32433da77f91SVictor Perevertkin typedef struct _UNMAP_BLOCK_DESCRIPTOR {
32443da77f91SVictor Perevertkin UCHAR StartingLba[8];
32453da77f91SVictor Perevertkin UCHAR LbaCount[4];
32463da77f91SVictor Perevertkin UCHAR Reserved[4];
32473da77f91SVictor Perevertkin } UNMAP_BLOCK_DESCRIPTOR, *PUNMAP_BLOCK_DESCRIPTOR;
32483da77f91SVictor Perevertkin
32493da77f91SVictor Perevertkin typedef struct _UNMAP_LIST_HEADER {
32503da77f91SVictor Perevertkin UCHAR DataLength[2];
32513da77f91SVictor Perevertkin UCHAR BlockDescrDataLength[2];
32523da77f91SVictor Perevertkin UCHAR Reserved[4];
32533da77f91SVictor Perevertkin #if !defined(__midl)
32543da77f91SVictor Perevertkin UNMAP_BLOCK_DESCRIPTOR Descriptors[0];
32553da77f91SVictor Perevertkin #endif
32563da77f91SVictor Perevertkin } UNMAP_LIST_HEADER, *PUNMAP_LIST_HEADER;
32573da77f91SVictor Perevertkin #include <poppack.h>
32583da77f91SVictor Perevertkin
32593da77f91SVictor Perevertkin #define LOG_PAGE_CODE_SUPPORTED_LOG_PAGES 0x00
32603da77f91SVictor Perevertkin #define LOG_PAGE_CODE_WRITE_ERROR_COUNTERS 0x02
32613da77f91SVictor Perevertkin #define LOG_PAGE_CODE_READ_ERROR_COUNTERS 0x03
32623da77f91SVictor Perevertkin #define LOG_PAGE_CODE_LOGICAL_BLOCK_PROVISIONING 0x0C
32633da77f91SVictor Perevertkin #define LOG_PAGE_CODE_TEMPERATURE 0x0D
32643da77f91SVictor Perevertkin #define LOG_PAGE_CODE_STARTSTOP_CYCLE_COUNTERS 0x0E
32653da77f91SVictor Perevertkin #define LOG_PAGE_CODE_SELFTEST_RESULTS 0x10
32663da77f91SVictor Perevertkin #define LOG_PAGE_CODE_SOLID_STATE_MEDIA 0x11
32673da77f91SVictor Perevertkin #define LOG_PAGE_CODE_BACKGROUND_SCAN_RESULTS 0x15
32683da77f91SVictor Perevertkin #define LOG_PAGE_CODE_INFORMATIONAL_EXCEPTIONS 0x2F
32693da77f91SVictor Perevertkin
32703da77f91SVictor Perevertkin
32713da77f91SVictor Perevertkin #include <pshpack1.h>
32723da77f91SVictor Perevertkin typedef struct _LOG_PARAMETER_HEADER {
32733da77f91SVictor Perevertkin UCHAR ParameterCode[2];
32743da77f91SVictor Perevertkin union {
32753da77f91SVictor Perevertkin UCHAR ControlByte;
32763da77f91SVictor Perevertkin struct {
32773da77f91SVictor Perevertkin UCHAR FormatAndLinking:2;
32783da77f91SVictor Perevertkin UCHAR TMC:2;
32793da77f91SVictor Perevertkin UCHAR ETC:1;
32803da77f91SVictor Perevertkin UCHAR TSD:1;
32813da77f91SVictor Perevertkin UCHAR Obsolete:1;
32823da77f91SVictor Perevertkin UCHAR DU:1;
32833da77f91SVictor Perevertkin };
32843da77f91SVictor Perevertkin };
32853da77f91SVictor Perevertkin UCHAR ParameterLength;
32863da77f91SVictor Perevertkin } LOG_PARAMETER_HEADER, *PLOG_PARAMETER_HEADER;
32873da77f91SVictor Perevertkin
32883da77f91SVictor Perevertkin typedef struct _LOG_PARAMETER {
32893da77f91SVictor Perevertkin LOG_PARAMETER_HEADER Header;
32903da77f91SVictor Perevertkin union {
32913da77f91SVictor Perevertkin #if !defined(__midl)
32923da77f91SVictor Perevertkin UCHAR AsByte[0];
32933da77f91SVictor Perevertkin #endif
32943da77f91SVictor Perevertkin struct _THRESHOLD_RESOURCE_COUNT {
32953da77f91SVictor Perevertkin UCHAR ResourceCount[4];
32963da77f91SVictor Perevertkin UCHAR Scope : 2;
32973da77f91SVictor Perevertkin UCHAR Reserved1 : 6;
32983da77f91SVictor Perevertkin UCHAR Reserved2[3];
32993da77f91SVictor Perevertkin } THRESHOLD_RESOURCE_COUNT;
33003da77f91SVictor Perevertkin struct _TEMPERATURE {
33013da77f91SVictor Perevertkin UCHAR Reserved;
33023da77f91SVictor Perevertkin UCHAR Temperature;
33033da77f91SVictor Perevertkin } TEMPERATURE;
33043da77f91SVictor Perevertkin struct _DATE_OF_MANUFACTURE {
33053da77f91SVictor Perevertkin UCHAR Year[4];
33063da77f91SVictor Perevertkin UCHAR Week[2];
33073da77f91SVictor Perevertkin } DATE_OF_MANUFACTURE;
33083da77f91SVictor Perevertkin struct _SELF_TEST_RESULTS {
33093da77f91SVictor Perevertkin UCHAR SelfTestResults : 4;
33103da77f91SVictor Perevertkin UCHAR Reserved1 : 1;
33113da77f91SVictor Perevertkin UCHAR SelfTestCode : 3;
33123da77f91SVictor Perevertkin UCHAR SelfTestNumber;
33133da77f91SVictor Perevertkin UCHAR PowerOnHours[2];
33143da77f91SVictor Perevertkin UCHAR AddressOfFirstFailure[8];
33153da77f91SVictor Perevertkin UCHAR SenseKey : 4;
33163da77f91SVictor Perevertkin UCHAR Reserved2 : 4;
33173da77f91SVictor Perevertkin UCHAR AdditionalSenseCode;
33183da77f91SVictor Perevertkin UCHAR AdditionalSenseCodeQualifier;
33193da77f91SVictor Perevertkin UCHAR VendorSpecific;
33203da77f91SVictor Perevertkin } SELF_TEST_RESULTS;
33213da77f91SVictor Perevertkin
33223da77f91SVictor Perevertkin struct _SOLID_STATE_MEDIA {
33233da77f91SVictor Perevertkin UCHAR Reserved[3];
33243da77f91SVictor Perevertkin UCHAR PercentageUsed;
33253da77f91SVictor Perevertkin } SOLID_STATE_MEDIA;
33263da77f91SVictor Perevertkin
33273da77f91SVictor Perevertkin struct _BACKGROUND_SCAN_STATUS {
33283da77f91SVictor Perevertkin UCHAR PowerOnMinutes[4];
33293da77f91SVictor Perevertkin UCHAR Reserved;
33303da77f91SVictor Perevertkin UCHAR ScanStatus;
33313da77f91SVictor Perevertkin UCHAR ScansPerformed[2];
33323da77f91SVictor Perevertkin UCHAR ScanProgress[2];
33333da77f91SVictor Perevertkin UCHAR MediumScansPerformed[2];
33343da77f91SVictor Perevertkin } BACKGROUND_SCAN_STATUS;
33353da77f91SVictor Perevertkin
33363da77f91SVictor Perevertkin struct _INFORMATIONAL_EXCEPTIONS {
33373da77f91SVictor Perevertkin UCHAR ASC;
33383da77f91SVictor Perevertkin UCHAR ASCQ;
33393da77f91SVictor Perevertkin UCHAR MostRecentTemperature;
33403da77f91SVictor Perevertkin UCHAR VendorSpecific[ANYSIZE_ARRAY];
33413da77f91SVictor Perevertkin } INFORMATIONAL_EXCEPTIONS;
33423da77f91SVictor Perevertkin };
33433da77f91SVictor Perevertkin } LOG_PARAMETER, *PLOG_PARAMETER;
33443da77f91SVictor Perevertkin
33453da77f91SVictor Perevertkin typedef struct _LOG_PAGE {
33463da77f91SVictor Perevertkin UCHAR PageCode:6;
33473da77f91SVictor Perevertkin UCHAR SPF:1;
33483da77f91SVictor Perevertkin UCHAR DS:1;
33493da77f91SVictor Perevertkin UCHAR SubPageCode;
33503da77f91SVictor Perevertkin UCHAR PageLength[2];
33513da77f91SVictor Perevertkin #if !defined(__midl)
33523da77f91SVictor Perevertkin LOG_PARAMETER Parameters[0];
33533da77f91SVictor Perevertkin #endif
33543da77f91SVictor Perevertkin
33553da77f91SVictor Perevertkin } LOG_PAGE, *PLOG_PAGE;
33563da77f91SVictor Perevertkin
33573da77f91SVictor Perevertkin #include <poppack.h>
33583da77f91SVictor Perevertkin
33593da77f91SVictor Perevertkin #define LOG_PAGE_LBP_PARAMETER_CODE_AVAILABLE 0x1
33603da77f91SVictor Perevertkin #define LOG_PAGE_LBP_PARAMETER_CODE_USED 0x2
33613da77f91SVictor Perevertkin
33623da77f91SVictor Perevertkin #define LOG_PAGE_LBP_RESOURCE_SCOPE_NOT_REPORTED 0x0
33633da77f91SVictor Perevertkin #define LOG_PAGE_LBP_RESOURCE_SCOPE_DEDICATED_TO_LUN 0x1
33643da77f91SVictor Perevertkin #define LOG_PAGE_LBP_RESOURCE_SCOPE_NOT_DEDICATED_TO_LUN 0x2
33653da77f91SVictor Perevertkin
33663da77f91SVictor Perevertkin typedef struct _LOG_PARAMETER_THRESHOLD_RESOURCE_COUNT {
33673da77f91SVictor Perevertkin LOG_PARAMETER_HEADER Header;
33683da77f91SVictor Perevertkin UCHAR ResourceCount[4];
33693da77f91SVictor Perevertkin UCHAR Scope:2;
33703da77f91SVictor Perevertkin UCHAR Reserved0:6;
33713da77f91SVictor Perevertkin UCHAR Reserved1[3];
33723da77f91SVictor Perevertkin } LOG_PARAMETER_THRESHOLD_RESOURCE_COUNT, *PLOG_PARAMETER_THRESHOLD_RESOURCE_COUNT;
33733da77f91SVictor Perevertkin
33743da77f91SVictor Perevertkin typedef struct _LOG_PAGE_LOGICAL_BLOCK_PROVISIONING {
33753da77f91SVictor Perevertkin UCHAR PageCode:6;
33763da77f91SVictor Perevertkin UCHAR SPF:1;
33773da77f91SVictor Perevertkin UCHAR DS:1;
33783da77f91SVictor Perevertkin UCHAR SubPageCode;
33793da77f91SVictor Perevertkin UCHAR PageLength[2];
33803da77f91SVictor Perevertkin #if !defined(__midl)
33813da77f91SVictor Perevertkin LOG_PARAMETER_HEADER Parameters[0];
33823da77f91SVictor Perevertkin #endif
33833da77f91SVictor Perevertkin } LOG_PAGE_LOGICAL_BLOCK_PROVISIONING, *PLOG_PAGE_LOGICAL_BLOCK_PROVISIONING;
33843da77f91SVictor Perevertkin
33853da77f91SVictor Perevertkin typedef struct _MODE_CONTROL_PAGE {
33863da77f91SVictor Perevertkin UCHAR PageCode:6;
33873da77f91SVictor Perevertkin UCHAR Reserved1:1;
33883da77f91SVictor Perevertkin UCHAR PageSavable:1;
33893da77f91SVictor Perevertkin UCHAR PageLength;
33903da77f91SVictor Perevertkin UCHAR RLEC:1;
33913da77f91SVictor Perevertkin UCHAR GLTSD:1;
33923da77f91SVictor Perevertkin UCHAR D_SENSE:1;
33933da77f91SVictor Perevertkin UCHAR DPICZ:1;
33943da77f91SVictor Perevertkin UCHAR TMF_ONLY:1;
33953da77f91SVictor Perevertkin UCHAR TST:3;
33963da77f91SVictor Perevertkin UCHAR Obsolete1:1;
33973da77f91SVictor Perevertkin UCHAR QERR:2;
33983da77f91SVictor Perevertkin UCHAR NUAR:1;
33993da77f91SVictor Perevertkin UCHAR QueueAlgorithmModifier:4;
34003da77f91SVictor Perevertkin UCHAR Obsolete2:3;
34013da77f91SVictor Perevertkin UCHAR SWP:1;
34023da77f91SVictor Perevertkin UCHAR UA_INTLCK_CTRL:2;
34033da77f91SVictor Perevertkin UCHAR RAC:1;
34043da77f91SVictor Perevertkin UCHAR VS:1;
34053da77f91SVictor Perevertkin UCHAR AutoloadMode:3;
34063da77f91SVictor Perevertkin UCHAR Reserved2:1;
34073da77f91SVictor Perevertkin UCHAR RWWP:1;
34083da77f91SVictor Perevertkin UCHAR ATMPE:1;
34093da77f91SVictor Perevertkin UCHAR TAS:1;
34103da77f91SVictor Perevertkin UCHAR ATO:1;
34113da77f91SVictor Perevertkin UCHAR Obsolete3[2];
34123da77f91SVictor Perevertkin UCHAR BusyTimeoutPeriod[2];
34133da77f91SVictor Perevertkin UCHAR ExtendeSelfTestCompletionTime[2];
34143da77f91SVictor Perevertkin } MODE_CONTROL_PAGE, *PMODE_CONTROL_PAGE;
34153da77f91SVictor Perevertkin
3416c2c66affSColin Finck /* This structure is used to convert little endian ULONGs
3417c2c66affSColin Finck to SCSI CDB big endians values. */
3418c2c66affSColin Finck typedef union _EIGHT_BYTE {
3419c2c66affSColin Finck _ANONYMOUS_STRUCT struct {
3420c2c66affSColin Finck UCHAR Byte0;
3421c2c66affSColin Finck UCHAR Byte1;
3422c2c66affSColin Finck UCHAR Byte2;
3423c2c66affSColin Finck UCHAR Byte3;
3424c2c66affSColin Finck UCHAR Byte4;
3425c2c66affSColin Finck UCHAR Byte5;
3426c2c66affSColin Finck UCHAR Byte6;
3427c2c66affSColin Finck UCHAR Byte7;
3428c2c66affSColin Finck } DUMMYSTRUCTNAME;
3429c2c66affSColin Finck ULONGLONG AsULongLong;
3430c2c66affSColin Finck } EIGHT_BYTE, *PEIGHT_BYTE;
3431c2c66affSColin Finck
3432c2c66affSColin Finck typedef union _FOUR_BYTE {
3433c2c66affSColin Finck _ANONYMOUS_STRUCT struct {
3434c2c66affSColin Finck UCHAR Byte0;
3435c2c66affSColin Finck UCHAR Byte1;
3436c2c66affSColin Finck UCHAR Byte2;
3437c2c66affSColin Finck UCHAR Byte3;
3438c2c66affSColin Finck } DUMMYSTRUCTNAME;
3439c2c66affSColin Finck ULONG AsULong;
3440c2c66affSColin Finck } FOUR_BYTE, *PFOUR_BYTE;
3441c2c66affSColin Finck
3442c2c66affSColin Finck typedef union _TWO_BYTE {
3443c2c66affSColin Finck _ANONYMOUS_STRUCT struct {
3444c2c66affSColin Finck UCHAR Byte0;
3445c2c66affSColin Finck UCHAR Byte1;
3446c2c66affSColin Finck } DUMMYSTRUCTNAME;
3447c2c66affSColin Finck USHORT AsUShort;
3448c2c66affSColin Finck } TWO_BYTE, *PTWO_BYTE;
3449c2c66affSColin Finck
3450c2c66affSColin Finck /* Byte reversing macro for converting between
3451c2c66affSColin Finck big- and little-endian formats */
3452c2c66affSColin Finck #define REVERSE_BYTES_QUAD(Destination, Source) { \
3453c2c66affSColin Finck PEIGHT_BYTE _val1 = (PEIGHT_BYTE)(Destination); \
3454c2c66affSColin Finck PEIGHT_BYTE _val2 = (PEIGHT_BYTE)(Source); \
3455c2c66affSColin Finck _val1->Byte7 = _val2->Byte0; \
3456c2c66affSColin Finck _val1->Byte6 = _val2->Byte1; \
3457c2c66affSColin Finck _val1->Byte5 = _val2->Byte2; \
3458c2c66affSColin Finck _val1->Byte4 = _val2->Byte3; \
3459c2c66affSColin Finck _val1->Byte3 = _val2->Byte4; \
3460c2c66affSColin Finck _val1->Byte2 = _val2->Byte5; \
3461c2c66affSColin Finck _val1->Byte1 = _val2->Byte6; \
3462c2c66affSColin Finck _val1->Byte0 = _val2->Byte7; \
3463c2c66affSColin Finck }
3464c2c66affSColin Finck
3465c2c66affSColin Finck #define REVERSE_BYTES(Destination, Source) { \
3466c2c66affSColin Finck PFOUR_BYTE _val1 = (PFOUR_BYTE)(Destination); \
3467c2c66affSColin Finck PFOUR_BYTE _val2 = (PFOUR_BYTE)(Source); \
3468c2c66affSColin Finck _val1->Byte3 = _val2->Byte0; \
3469c2c66affSColin Finck _val1->Byte2 = _val2->Byte1; \
3470c2c66affSColin Finck _val1->Byte1 = _val2->Byte2; \
3471c2c66affSColin Finck _val1->Byte0 = _val2->Byte3; \
3472c2c66affSColin Finck }
3473c2c66affSColin Finck
3474c2c66affSColin Finck #define REVERSE_BYTES_SHORT(Destination, Source) { \
3475c2c66affSColin Finck PTWO_BYTE _val1 = (PTWO_BYTE)(Destination); \
3476c2c66affSColin Finck PTWO_BYTE _val2 = (PTWO_BYTE)(Source); \
3477c2c66affSColin Finck _val1->Byte1 = _val2->Byte0; \
3478c2c66affSColin Finck _val1->Byte0 = _val2->Byte1; \
3479c2c66affSColin Finck }
3480c2c66affSColin Finck
3481c2c66affSColin Finck #define REVERSE_SHORT(Short) { \
3482c2c66affSColin Finck UCHAR _val; \
3483c2c66affSColin Finck PTWO_BYTE _val2 = (PTWO_BYTE)(Short); \
3484c2c66affSColin Finck _val = _val2->Byte0; \
3485c2c66affSColin Finck _val2->Byte0 = _val2->Byte1; \
3486c2c66affSColin Finck _val2->Byte1 = _val; \
3487c2c66affSColin Finck }
3488c2c66affSColin Finck
3489c2c66affSColin Finck #define REVERSE_LONG(Long) { \
3490c2c66affSColin Finck UCHAR _val; \
3491c2c66affSColin Finck PFOUR_BYTE _val2 = (PFOUR_BYTE)(Long); \
3492c2c66affSColin Finck _val = _val2->Byte3; \
3493c2c66affSColin Finck _val2->Byte3 = _val2->Byte0; \
3494c2c66affSColin Finck _val2->Byte0 = _val; \
3495c2c66affSColin Finck _val = _val2->Byte2; \
3496c2c66affSColin Finck _val2->Byte2 = _val2->Byte1; \
3497c2c66affSColin Finck _val2->Byte1 = _val; \
3498c2c66affSColin Finck }
3499c2c66affSColin Finck
3500c2c66affSColin Finck #define WHICH_BIT(Data, Bit) { \
3501c2c66affSColin Finck UCHAR _val; \
3502c2c66affSColin Finck for (_val = 0; _val < 32; _val++) { \
3503c2c66affSColin Finck if (((Data) >> _val) == 1) { \
3504c2c66affSColin Finck break; \
3505c2c66affSColin Finck } \
3506c2c66affSColin Finck } \
3507c2c66affSColin Finck ASSERT(_val != 32); \
3508c2c66affSColin Finck (Bit) = _val; \
3509c2c66affSColin Finck }
3510c2c66affSColin Finck
35113da77f91SVictor Perevertkin #if defined(_WIN64)
35123da77f91SVictor Perevertkin #define STOR_ADDRESS_ALIGN DECLSPEC_ALIGN(8)
35133da77f91SVictor Perevertkin #else
35143da77f91SVictor Perevertkin #define STOR_ADDRESS_ALIGN
35153da77f91SVictor Perevertkin #endif
35163da77f91SVictor Perevertkin
35173da77f91SVictor Perevertkin typedef struct STOR_ADDRESS_ALIGN _STOR_ADDRESS {
35183da77f91SVictor Perevertkin USHORT Type;
35193da77f91SVictor Perevertkin USHORT Port;
35203da77f91SVictor Perevertkin ULONG AddressLength;
35213da77f91SVictor Perevertkin _Field_size_bytes_(AddressLength) UCHAR AddressData[ANYSIZE_ARRAY];
35223da77f91SVictor Perevertkin } STOR_ADDRESS, *PSTOR_ADDRESS;
35233da77f91SVictor Perevertkin
35243da77f91SVictor Perevertkin #define STOR_ADDRESS_TYPE_UNKNOWN 0x0
35253da77f91SVictor Perevertkin #define STOR_ADDRESS_TYPE_BTL8 0x1
35263da77f91SVictor Perevertkin #define STOR_ADDRESS_TYPE_MAX 0xffff
35273da77f91SVictor Perevertkin
35283da77f91SVictor Perevertkin #define STOR_ADDR_BTL8_ADDRESS_LENGTH 4
35293da77f91SVictor Perevertkin
35303da77f91SVictor Perevertkin typedef struct STOR_ADDRESS_ALIGN _STOR_ADDR_BTL8 {
35313da77f91SVictor Perevertkin _Field_range_(STOR_ADDRESS_TYPE_BTL8, STOR_ADDRESS_TYPE_BTL8)
35323da77f91SVictor Perevertkin USHORT Type;
35333da77f91SVictor Perevertkin USHORT Port;
35343da77f91SVictor Perevertkin _Field_range_(STOR_ADDR_BTL8_ADDRESS_LENGTH, STOR_ADDR_BTL8_ADDRESS_LENGTH)
35353da77f91SVictor Perevertkin ULONG AddressLength;
35363da77f91SVictor Perevertkin UCHAR Path;
35373da77f91SVictor Perevertkin UCHAR Target;
35383da77f91SVictor Perevertkin UCHAR Lun;
35393da77f91SVictor Perevertkin UCHAR Reserved;
35403da77f91SVictor Perevertkin } STOR_ADDR_BTL8, *PSTOR_ADDR_BTL8;
35413da77f91SVictor Perevertkin
3542c2c66affSColin Finck /* FIXME : This structure doesn't exist in the official header */
3543c2c66affSColin Finck typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE {
3544c2c66affSColin Finck UCHAR PageLength;
3545c2c66affSColin Finck UCHAR WriteType:4;
3546c2c66affSColin Finck UCHAR TestWrite:1;
3547c2c66affSColin Finck UCHAR LinkSizeValid:1;
3548c2c66affSColin Finck UCHAR BufferUnderrunFreeEnabled:1;
3549c2c66affSColin Finck UCHAR Reserved2:1;
3550c2c66affSColin Finck UCHAR TrackMode:4;
3551c2c66affSColin Finck UCHAR Copy:1;
3552c2c66affSColin Finck UCHAR FixedPacket:1;
3553c2c66affSColin Finck UCHAR MultiSession:2;
3554c2c66affSColin Finck UCHAR DataBlockType:4;
3555c2c66affSColin Finck UCHAR Reserved3:4;
3556c2c66affSColin Finck UCHAR LinkSize;
3557c2c66affSColin Finck UCHAR Reserved4;
3558c2c66affSColin Finck UCHAR HostApplicationCode:6;
3559c2c66affSColin Finck UCHAR Reserved5:2;
3560c2c66affSColin Finck UCHAR SessionFormat;
3561c2c66affSColin Finck UCHAR Reserved6;
3562c2c66affSColin Finck UCHAR PacketSize[4];
3563c2c66affSColin Finck UCHAR AudioPauseLength[2];
3564c2c66affSColin Finck UCHAR Reserved7:7;
3565c2c66affSColin Finck UCHAR MediaCatalogNumberValid:1;
3566c2c66affSColin Finck UCHAR MediaCatalogNumber[13];
3567c2c66affSColin Finck UCHAR MediaCatalogNumberZero;
3568c2c66affSColin Finck UCHAR MediaCatalogNumberAFrame;
3569c2c66affSColin Finck UCHAR Reserved8:7;
3570c2c66affSColin Finck UCHAR ISRCValid:1;
3571c2c66affSColin Finck UCHAR ISRCCountry[2];
3572c2c66affSColin Finck UCHAR ISRCOwner[3];
3573c2c66affSColin Finck UCHAR ISRCRecordingYear[2];
3574c2c66affSColin Finck UCHAR ISRCSerialNumber[5];
3575c2c66affSColin Finck UCHAR ISRCZero;
3576c2c66affSColin Finck UCHAR ISRCAFrame;
3577c2c66affSColin Finck UCHAR ISRCReserved;
3578c2c66affSColin Finck UCHAR SubHeaderData[4];
3579c2c66affSColin Finck } MODE_CDROM_WRITE_PARAMETERS_PAGE, *PMODE_CDROM_WRITE_PARAMETERS_PAGE;
3580c2c66affSColin Finck
35813da77f91SVictor Perevertkin #if (NTDDI_VERSION >= NTDDI_WIN8)
35823da77f91SVictor Perevertkin #include <pshpack1.h>
35833da77f91SVictor Perevertkin
35843da77f91SVictor Perevertkin #define BLOCK_DEVICE_TOKEN_SIZE 512
35853da77f91SVictor Perevertkin
35863da77f91SVictor Perevertkin typedef struct {
35873da77f91SVictor Perevertkin UCHAR LogicalBlockAddress[8];
35883da77f91SVictor Perevertkin UCHAR TransferLength[4];
35893da77f91SVictor Perevertkin UCHAR Reserved[4];
35903da77f91SVictor Perevertkin } BLOCK_DEVICE_RANGE_DESCRIPTOR, *PBLOCK_DEVICE_RANGE_DESCRIPTOR;
35913da77f91SVictor Perevertkin
35923da77f91SVictor Perevertkin typedef struct {
35933da77f91SVictor Perevertkin UCHAR PopulateTokenDataLength[2];
35943da77f91SVictor Perevertkin UCHAR Immediate:1;
35953da77f91SVictor Perevertkin UCHAR Reserved1:7;
35963da77f91SVictor Perevertkin UCHAR Reserved2;
35973da77f91SVictor Perevertkin UCHAR InactivityTimeout[4];
35983da77f91SVictor Perevertkin UCHAR Reserved3[6];
35993da77f91SVictor Perevertkin UCHAR BlockDeviceRangeDescriptorListLength[2];
36003da77f91SVictor Perevertkin #if !defined(__midl)
36013da77f91SVictor Perevertkin UCHAR BlockDeviceRangeDescriptor[ANYSIZE_ARRAY];
36023da77f91SVictor Perevertkin #endif
36033da77f91SVictor Perevertkin } POPULATE_TOKEN_HEADER, *PPOPULATE_TOKEN_HEADER;
36043da77f91SVictor Perevertkin
36053da77f91SVictor Perevertkin typedef struct {
36063da77f91SVictor Perevertkin UCHAR WriteUsingTokenDataLength[2];
36073da77f91SVictor Perevertkin UCHAR Immediate:1;
36083da77f91SVictor Perevertkin UCHAR Reserved1:7;
36093da77f91SVictor Perevertkin UCHAR Reserved2[5];
36103da77f91SVictor Perevertkin UCHAR BlockOffsetIntoToken[8];
36113da77f91SVictor Perevertkin UCHAR Token[BLOCK_DEVICE_TOKEN_SIZE];
36123da77f91SVictor Perevertkin UCHAR Reserved3[6];
36133da77f91SVictor Perevertkin UCHAR BlockDeviceRangeDescriptorListLength[2];
36143da77f91SVictor Perevertkin #if !defined(__midl)
36153da77f91SVictor Perevertkin UCHAR BlockDeviceRangeDescriptor[ANYSIZE_ARRAY];
36163da77f91SVictor Perevertkin #endif
36173da77f91SVictor Perevertkin } WRITE_USING_TOKEN_HEADER, *PWRITE_USING_TOKEN_HEADER;
36183da77f91SVictor Perevertkin
36193da77f91SVictor Perevertkin typedef struct {
36203da77f91SVictor Perevertkin UCHAR AvailableData[4];
36213da77f91SVictor Perevertkin UCHAR ResponseToServiceAction:5;
36223da77f91SVictor Perevertkin UCHAR Reserved1:3;
36233da77f91SVictor Perevertkin UCHAR OperationStatus:7;
36243da77f91SVictor Perevertkin UCHAR Reserved2:1;
36253da77f91SVictor Perevertkin UCHAR OperationCounter[2];
36263da77f91SVictor Perevertkin UCHAR EstimatedStatusUpdateDelay[4];
36273da77f91SVictor Perevertkin UCHAR CompletionStatus;
36283da77f91SVictor Perevertkin UCHAR SenseDataFieldLength;
36293da77f91SVictor Perevertkin UCHAR SenseDataLength;
36303da77f91SVictor Perevertkin UCHAR TransferCountUnits;
36313da77f91SVictor Perevertkin UCHAR TransferCount[8];
36323da77f91SVictor Perevertkin UCHAR SegmentsProcessed[2];
36333da77f91SVictor Perevertkin UCHAR Reserved3[6];
36343da77f91SVictor Perevertkin #if !defined(__midl)
36353da77f91SVictor Perevertkin UCHAR SenseData[ANYSIZE_ARRAY];
36363da77f91SVictor Perevertkin #endif
36373da77f91SVictor Perevertkin } RECEIVE_TOKEN_INFORMATION_HEADER, *PRECEIVE_TOKEN_INFORMATION_HEADER;
36383da77f91SVictor Perevertkin
36393da77f91SVictor Perevertkin typedef struct {
36403da77f91SVictor Perevertkin UCHAR TokenDescriptorsLength[4];
36413da77f91SVictor Perevertkin #if !defined(__midl)
36423da77f91SVictor Perevertkin UCHAR TokenDescriptor[ANYSIZE_ARRAY];
36433da77f91SVictor Perevertkin #endif
36443da77f91SVictor Perevertkin } RECEIVE_TOKEN_INFORMATION_RESPONSE_HEADER, *PRECEIVE_TOKEN_INFORMATION_RESPONSE_HEADER;
36453da77f91SVictor Perevertkin
36463da77f91SVictor Perevertkin typedef struct {
36473da77f91SVictor Perevertkin UCHAR TokenIdentifier[2];
36483da77f91SVictor Perevertkin UCHAR Token[BLOCK_DEVICE_TOKEN_SIZE];
36493da77f91SVictor Perevertkin } BLOCK_DEVICE_TOKEN_DESCRIPTOR, *PBLOCK_DEVICE_TOKEN_DESCRIPTOR;
36503da77f91SVictor Perevertkin
36513da77f91SVictor Perevertkin typedef enum _OPERATION_STATUS {
36523da77f91SVictor Perevertkin OPERATION_COMPLETED_WITH_SUCCESS = 0x01,
36533da77f91SVictor Perevertkin OPERATION_COMPLETED_WITH_ERROR = 0x02,
36543da77f91SVictor Perevertkin OPERATION_COMPLETED_WITH_RESIDUAL_DATA = 0x03,
36553da77f91SVictor Perevertkin OPERATION_IN_PROGRESS_IN_FOREGROUND = 0x11,
36563da77f91SVictor Perevertkin OPERATION_IN_PROGRESS_IN_BACKGROUND = 0x12,
36573da77f91SVictor Perevertkin OPERATION_TERMINATED = 0x60
36583da77f91SVictor Perevertkin } OPERATION_STATUS, *POPERATION_STATUS;
36593da77f91SVictor Perevertkin
36603da77f91SVictor Perevertkin typedef enum _TRANSFER_COUNT_UNITS {
36613da77f91SVictor Perevertkin TRANSFER_COUNT_UNITS_BYTES = 0,
36623da77f91SVictor Perevertkin TRANSFER_COUNT_UNITS_KIBIBYTES = 1,
36633da77f91SVictor Perevertkin TRANSFER_COUNT_UNITS_MEBIBYTES = 2,
36643da77f91SVictor Perevertkin TRANSFER_COUNT_UNITS_GIBIBYTES = 3,
36653da77f91SVictor Perevertkin TRANSFER_COUNT_UNITS_TEBIBYTES = 4,
36663da77f91SVictor Perevertkin TRANSFER_COUNT_UNITS_PEBIBYTES = 5,
36673da77f91SVictor Perevertkin TRANSFER_COUNT_UNITS_EXBIBYTES = 6,
36683da77f91SVictor Perevertkin TRANSFER_COUNT_UNITS_NUMBER_BLOCKS = 0xF1
36693da77f91SVictor Perevertkin } TRANSFER_COUNT_UNITS, *PTRANSFER_COUNT_UNITS;
36703da77f91SVictor Perevertkin
36713da77f91SVictor Perevertkin #include <poppack.h>
36723da77f91SVictor Perevertkin #endif /* (NTDDI_VERSION >= NTDDI_WIN8) */
36733da77f91SVictor Perevertkin
36743da77f91SVictor Perevertkin // SCSI utility functions
36753da77f91SVictor Perevertkin
36763da77f91SVictor Perevertkin #define ScsiGetSenseErrorCode(SenseInfoBuffer) (((PUCHAR)(SenseInfoBuffer))[0] & 0x7f)
36773da77f91SVictor Perevertkin
36783da77f91SVictor Perevertkin #define ScsiGetSenseDescriptorLength(DescriptorBuffer) \
36793da77f91SVictor Perevertkin (sizeof(SCSI_SENSE_DESCRIPTOR_HEADER) + ((PSCSI_SENSE_DESCRIPTOR_HEADER)(DescriptorBuffer))->AdditionalLength)
36803da77f91SVictor Perevertkin
36813da77f91SVictor Perevertkin #define IsFixedSenseDataFormat(SenseInfoBuffer) \
36823da77f91SVictor Perevertkin ((ScsiGetSenseErrorCode(SenseInfoBuffer)) == SCSI_SENSE_ERRORCODE_FIXED_CURRENT || \
36833da77f91SVictor Perevertkin (ScsiGetSenseErrorCode(SenseInfoBuffer)) == SCSI_SENSE_ERRORCODE_FIXED_DEFERRED)
36843da77f91SVictor Perevertkin
36853da77f91SVictor Perevertkin #define IsDescriptorSenseDataFormat(SenseInfoBuffer) \
36863da77f91SVictor Perevertkin ((ScsiGetSenseErrorCode(SenseInfoBuffer)) == SCSI_SENSE_ERRORCODE_DESCRIPTOR_CURRENT || \
36873da77f91SVictor Perevertkin (ScsiGetSenseErrorCode(SenseInfoBuffer)) == SCSI_SENSE_ERRORCODE_DESCRIPTOR_DEFERRED)
36883da77f91SVictor Perevertkin
36893da77f91SVictor Perevertkin #define IsSenseDataCurrentError(SenseInfoBuffer) \
36903da77f91SVictor Perevertkin ((ScsiGetSenseErrorCode(SenseInfoBuffer)) == SCSI_SENSE_ERRORCODE_FIXED_CURRENT || \
36913da77f91SVictor Perevertkin (ScsiGetSenseErrorCode(SenseInfoBuffer)) == SCSI_SENSE_ERRORCODE_DESCRIPTOR_CURRENT)
36923da77f91SVictor Perevertkin
36933da77f91SVictor Perevertkin #define IsSenseDataDeferredError(SenseInfoBuffer) \
36943da77f91SVictor Perevertkin ((ScsiGetSenseErrorCode(SenseInfoBuffer)) == SCSI_SENSE_ERRORCODE_FIXED_DEFERRED || \
36953da77f91SVictor Perevertkin (ScsiGetSenseErrorCode(SenseInfoBuffer)) == SCSI_SENSE_ERRORCODE_DESCRIPTOR_DEFERRED)
36963da77f91SVictor Perevertkin
36973da77f91SVictor Perevertkin #define IsSenseDataFormatValueValid(SenseInfoBuffer) \
36983da77f91SVictor Perevertkin (IsFixedSenseDataFormat(SenseInfoBuffer) || IsDescriptorSenseDataFormat(SenseInfoBuffer))
36993da77f91SVictor Perevertkin
37003da77f91SVictor Perevertkin _Success_(return != FALSE)
37013da77f91SVictor Perevertkin FORCEINLINE
37023da77f91SVictor Perevertkin BOOLEAN
ScsiGetTotalSenseByteCountIndicated(_In_reads_bytes_ (SenseInfoBufferLength)PVOID SenseInfoBuffer,_In_ UCHAR SenseInfoBufferLength,_Out_ UCHAR * TotalByteCountIndicated)37033da77f91SVictor Perevertkin ScsiGetTotalSenseByteCountIndicated(
37043da77f91SVictor Perevertkin _In_reads_bytes_(SenseInfoBufferLength) PVOID SenseInfoBuffer,
37053da77f91SVictor Perevertkin _In_ UCHAR SenseInfoBufferLength,
37063da77f91SVictor Perevertkin _Out_ UCHAR *TotalByteCountIndicated)
37073da77f91SVictor Perevertkin {
37083da77f91SVictor Perevertkin BOOLEAN succeed = FALSE;
37093da77f91SVictor Perevertkin UCHAR byteCount = 0;
37103da77f91SVictor Perevertkin PFIXED_SENSE_DATA senseInfoBuffer = NULL;
37113da77f91SVictor Perevertkin
37123da77f91SVictor Perevertkin if (SenseInfoBuffer == NULL || SenseInfoBufferLength == 0 || TotalByteCountIndicated == NULL)
37133da77f91SVictor Perevertkin {
37143da77f91SVictor Perevertkin
37153da77f91SVictor Perevertkin return FALSE;
37163da77f91SVictor Perevertkin }
37173da77f91SVictor Perevertkin
37183da77f91SVictor Perevertkin senseInfoBuffer = (PFIXED_SENSE_DATA)SenseInfoBuffer;
37193da77f91SVictor Perevertkin
37203da77f91SVictor Perevertkin if (RTL_CONTAINS_FIELD(senseInfoBuffer, SenseInfoBufferLength, AdditionalSenseLength))
37213da77f91SVictor Perevertkin {
37223da77f91SVictor Perevertkin
37233da77f91SVictor Perevertkin if (senseInfoBuffer->AdditionalSenseLength <=
37243da77f91SVictor Perevertkin (MAX_SENSE_BUFFER_SIZE - RTL_SIZEOF_THROUGH_FIELD(FIXED_SENSE_DATA, AdditionalSenseLength)))
37253da77f91SVictor Perevertkin {
37263da77f91SVictor Perevertkin
37273da77f91SVictor Perevertkin byteCount = senseInfoBuffer->AdditionalSenseLength +
37283da77f91SVictor Perevertkin RTL_SIZEOF_THROUGH_FIELD(FIXED_SENSE_DATA, AdditionalSenseLength);
37293da77f91SVictor Perevertkin
37303da77f91SVictor Perevertkin *TotalByteCountIndicated = byteCount;
37313da77f91SVictor Perevertkin
37323da77f91SVictor Perevertkin succeed = TRUE;
37333da77f91SVictor Perevertkin }
37343da77f91SVictor Perevertkin }
37353da77f91SVictor Perevertkin
37363da77f91SVictor Perevertkin return succeed;
37373da77f91SVictor Perevertkin }
37383da77f91SVictor Perevertkin
37393da77f91SVictor Perevertkin _Success_(return != FALSE)
37403da77f91SVictor Perevertkin FORCEINLINE
37413da77f91SVictor Perevertkin BOOLEAN
ScsiGetFixedSenseKeyAndCodes(_In_reads_bytes_ (SenseInfoBufferLength)PVOID SenseInfoBuffer,_In_ UCHAR SenseInfoBufferLength,_Out_opt_ PUCHAR SenseKey,_Out_opt_ PUCHAR AdditionalSenseCode,_Out_opt_ PUCHAR AdditionalSenseCodeQualifier)37423da77f91SVictor Perevertkin ScsiGetFixedSenseKeyAndCodes(
37433da77f91SVictor Perevertkin _In_reads_bytes_(SenseInfoBufferLength) PVOID SenseInfoBuffer,
37443da77f91SVictor Perevertkin _In_ UCHAR SenseInfoBufferLength,
37453da77f91SVictor Perevertkin _Out_opt_ PUCHAR SenseKey,
37463da77f91SVictor Perevertkin _Out_opt_ PUCHAR AdditionalSenseCode,
37473da77f91SVictor Perevertkin _Out_opt_ PUCHAR AdditionalSenseCodeQualifier)
37483da77f91SVictor Perevertkin {
37493da77f91SVictor Perevertkin PFIXED_SENSE_DATA fixedSenseData = (PFIXED_SENSE_DATA)SenseInfoBuffer;
37503da77f91SVictor Perevertkin BOOLEAN succeed = FALSE;
37513da77f91SVictor Perevertkin ULONG dataLength = 0;
37523da77f91SVictor Perevertkin
37533da77f91SVictor Perevertkin if (SenseInfoBuffer == NULL || SenseInfoBufferLength == 0)
37543da77f91SVictor Perevertkin {
37553da77f91SVictor Perevertkin return FALSE;
37563da77f91SVictor Perevertkin }
37573da77f91SVictor Perevertkin
37583da77f91SVictor Perevertkin if (RTL_CONTAINS_FIELD(fixedSenseData, SenseInfoBufferLength, AdditionalSenseLength))
37593da77f91SVictor Perevertkin {
37603da77f91SVictor Perevertkin
37613da77f91SVictor Perevertkin dataLength = fixedSenseData->AdditionalSenseLength +
37623da77f91SVictor Perevertkin RTL_SIZEOF_THROUGH_FIELD(FIXED_SENSE_DATA, AdditionalSenseLength);
37633da77f91SVictor Perevertkin
37643da77f91SVictor Perevertkin if (dataLength > SenseInfoBufferLength)
37653da77f91SVictor Perevertkin {
37663da77f91SVictor Perevertkin dataLength = SenseInfoBufferLength;
37673da77f91SVictor Perevertkin }
37683da77f91SVictor Perevertkin
37693da77f91SVictor Perevertkin if (SenseKey != NULL)
37703da77f91SVictor Perevertkin {
37713da77f91SVictor Perevertkin *SenseKey = fixedSenseData->SenseKey;
37723da77f91SVictor Perevertkin }
37733da77f91SVictor Perevertkin
37743da77f91SVictor Perevertkin if (AdditionalSenseCode != NULL)
37753da77f91SVictor Perevertkin {
37763da77f91SVictor Perevertkin *AdditionalSenseCode = RTL_CONTAINS_FIELD(fixedSenseData, dataLength, AdditionalSenseCode)
37773da77f91SVictor Perevertkin ? fixedSenseData->AdditionalSenseCode
37783da77f91SVictor Perevertkin : 0;
37793da77f91SVictor Perevertkin }
37803da77f91SVictor Perevertkin
37813da77f91SVictor Perevertkin if (AdditionalSenseCodeQualifier != NULL)
37823da77f91SVictor Perevertkin {
37833da77f91SVictor Perevertkin *AdditionalSenseCodeQualifier =
37843da77f91SVictor Perevertkin RTL_CONTAINS_FIELD(fixedSenseData, dataLength, AdditionalSenseCodeQualifier)
37853da77f91SVictor Perevertkin ? fixedSenseData->AdditionalSenseCodeQualifier
37863da77f91SVictor Perevertkin : 0;
37873da77f91SVictor Perevertkin }
37883da77f91SVictor Perevertkin
37893da77f91SVictor Perevertkin succeed = TRUE;
37903da77f91SVictor Perevertkin }
37913da77f91SVictor Perevertkin
37923da77f91SVictor Perevertkin return succeed;
37933da77f91SVictor Perevertkin }
37943da77f91SVictor Perevertkin
37953da77f91SVictor Perevertkin _Success_(return != FALSE)
37963da77f91SVictor Perevertkin FORCEINLINE
37973da77f91SVictor Perevertkin BOOLEAN
ScsiGetDescriptorSenseKeyAndCodes(_In_reads_bytes_ (SenseInfoBufferLength)PVOID SenseInfoBuffer,_In_ UCHAR SenseInfoBufferLength,_Out_opt_ PUCHAR SenseKey,_Out_opt_ PUCHAR AdditionalSenseCode,_Out_opt_ PUCHAR AdditionalSenseCodeQualifier)37983da77f91SVictor Perevertkin ScsiGetDescriptorSenseKeyAndCodes(
37993da77f91SVictor Perevertkin _In_reads_bytes_(SenseInfoBufferLength) PVOID SenseInfoBuffer,
38003da77f91SVictor Perevertkin _In_ UCHAR SenseInfoBufferLength,
38013da77f91SVictor Perevertkin _Out_opt_ PUCHAR SenseKey,
38023da77f91SVictor Perevertkin _Out_opt_ PUCHAR AdditionalSenseCode,
38033da77f91SVictor Perevertkin _Out_opt_ PUCHAR AdditionalSenseCodeQualifier)
38043da77f91SVictor Perevertkin {
38053da77f91SVictor Perevertkin PDESCRIPTOR_SENSE_DATA descriptorSenseData = (PDESCRIPTOR_SENSE_DATA)SenseInfoBuffer;
38063da77f91SVictor Perevertkin BOOLEAN succeed = FALSE;
38073da77f91SVictor Perevertkin
38083da77f91SVictor Perevertkin if (SenseInfoBuffer == NULL || SenseInfoBufferLength == 0)
38093da77f91SVictor Perevertkin {
38103da77f91SVictor Perevertkin return FALSE;
38113da77f91SVictor Perevertkin }
38123da77f91SVictor Perevertkin if (RTL_CONTAINS_FIELD(descriptorSenseData, SenseInfoBufferLength, AdditionalSenseLength))
38133da77f91SVictor Perevertkin {
38143da77f91SVictor Perevertkin
38153da77f91SVictor Perevertkin if (SenseKey)
38163da77f91SVictor Perevertkin {
38173da77f91SVictor Perevertkin *SenseKey = descriptorSenseData->SenseKey;
38183da77f91SVictor Perevertkin }
38193da77f91SVictor Perevertkin
38203da77f91SVictor Perevertkin if (AdditionalSenseCode != NULL)
38213da77f91SVictor Perevertkin {
38223da77f91SVictor Perevertkin *AdditionalSenseCode = descriptorSenseData->AdditionalSenseCode;
38233da77f91SVictor Perevertkin }
38243da77f91SVictor Perevertkin
38253da77f91SVictor Perevertkin if (AdditionalSenseCodeQualifier != NULL)
38263da77f91SVictor Perevertkin {
38273da77f91SVictor Perevertkin *AdditionalSenseCodeQualifier = descriptorSenseData->AdditionalSenseCodeQualifier;
38283da77f91SVictor Perevertkin }
38293da77f91SVictor Perevertkin
38303da77f91SVictor Perevertkin succeed = TRUE;
38313da77f91SVictor Perevertkin }
38323da77f91SVictor Perevertkin
38333da77f91SVictor Perevertkin return succeed;
38343da77f91SVictor Perevertkin }
38353da77f91SVictor Perevertkin
38363da77f91SVictor Perevertkin typedef ULONG SCSI_SENSE_OPTIONS;
38373da77f91SVictor Perevertkin
38383da77f91SVictor Perevertkin #define SCSI_SENSE_OPTIONS_NONE ((SCSI_SENSE_OPTIONS)0x00000000)
38393da77f91SVictor Perevertkin #define SCSI_SENSE_OPTIONS_FIXED_FORMAT_IF_UNKNOWN_FORMAT_INDICATED ((SCSI_SENSE_OPTIONS)0x00000001)
38403da77f91SVictor Perevertkin
38413da77f91SVictor Perevertkin _Success_(return != FALSE)
38423da77f91SVictor Perevertkin FORCEINLINE
38433da77f91SVictor Perevertkin BOOLEAN
ScsiGetSenseKeyAndCodes(_In_reads_bytes_ (SenseInfoBufferLength)PVOID SenseInfoBuffer,_In_ UCHAR SenseInfoBufferLength,_In_ SCSI_SENSE_OPTIONS Options,_Out_opt_ PUCHAR SenseKey,_Out_opt_ PUCHAR AdditionalSenseCode,_Out_opt_ PUCHAR AdditionalSenseCodeQualifier)38443da77f91SVictor Perevertkin ScsiGetSenseKeyAndCodes(
38453da77f91SVictor Perevertkin _In_reads_bytes_(SenseInfoBufferLength) PVOID SenseInfoBuffer,
38463da77f91SVictor Perevertkin _In_ UCHAR SenseInfoBufferLength,
38473da77f91SVictor Perevertkin _In_ SCSI_SENSE_OPTIONS Options,
38483da77f91SVictor Perevertkin _Out_opt_ PUCHAR SenseKey,
38493da77f91SVictor Perevertkin _Out_opt_ PUCHAR AdditionalSenseCode,
38503da77f91SVictor Perevertkin _Out_opt_ PUCHAR AdditionalSenseCodeQualifier)
38513da77f91SVictor Perevertkin {
38523da77f91SVictor Perevertkin BOOLEAN succeed = FALSE;
38533da77f91SVictor Perevertkin
38543da77f91SVictor Perevertkin if (SenseInfoBuffer == NULL || SenseInfoBufferLength == 0)
38553da77f91SVictor Perevertkin {
38563da77f91SVictor Perevertkin return FALSE;
38573da77f91SVictor Perevertkin }
38583da77f91SVictor Perevertkin
38593da77f91SVictor Perevertkin if (IsDescriptorSenseDataFormat(SenseInfoBuffer))
38603da77f91SVictor Perevertkin {
38613da77f91SVictor Perevertkin succeed = ScsiGetDescriptorSenseKeyAndCodes(SenseInfoBuffer, SenseInfoBufferLength, SenseKey,
38623da77f91SVictor Perevertkin AdditionalSenseCode, AdditionalSenseCodeQualifier);
38633da77f91SVictor Perevertkin }
38643da77f91SVictor Perevertkin else
38653da77f91SVictor Perevertkin {
38663da77f91SVictor Perevertkin if ((Options & SCSI_SENSE_OPTIONS_FIXED_FORMAT_IF_UNKNOWN_FORMAT_INDICATED) ||
38673da77f91SVictor Perevertkin IsFixedSenseDataFormat(SenseInfoBuffer))
38683da77f91SVictor Perevertkin {
38693da77f91SVictor Perevertkin
38703da77f91SVictor Perevertkin succeed = ScsiGetFixedSenseKeyAndCodes(SenseInfoBuffer, SenseInfoBufferLength, SenseKey,
38713da77f91SVictor Perevertkin AdditionalSenseCode, AdditionalSenseCodeQualifier);
38723da77f91SVictor Perevertkin }
38733da77f91SVictor Perevertkin }
38743da77f91SVictor Perevertkin
38753da77f91SVictor Perevertkin return succeed;
38763da77f91SVictor Perevertkin }
38773da77f91SVictor Perevertkin
38783da77f91SVictor Perevertkin _Success_(return != FALSE)
38793da77f91SVictor Perevertkin FORCEINLINE
38803da77f91SVictor Perevertkin BOOLEAN
ScsiGetSenseDescriptor(_In_reads_bytes_ (SenseInfoBufferLength)PVOID SenseInfoBuffer,_In_ UCHAR SenseInfoBufferLength,_Outptr_result_bytebuffer_ (* DescriptorBufferLength)PVOID * DescriptorBuffer,_Out_ UCHAR * DescriptorBufferLength)38813da77f91SVictor Perevertkin ScsiGetSenseDescriptor(
38823da77f91SVictor Perevertkin _In_reads_bytes_(SenseInfoBufferLength) PVOID SenseInfoBuffer,
38833da77f91SVictor Perevertkin _In_ UCHAR SenseInfoBufferLength,
38843da77f91SVictor Perevertkin _Outptr_result_bytebuffer_(*DescriptorBufferLength) PVOID *DescriptorBuffer,
38853da77f91SVictor Perevertkin _Out_ UCHAR *DescriptorBufferLength)
38863da77f91SVictor Perevertkin {
38873da77f91SVictor Perevertkin PDESCRIPTOR_SENSE_DATA descriptorSenseData;
38883da77f91SVictor Perevertkin BOOLEAN succeed = FALSE;
38893da77f91SVictor Perevertkin UCHAR dataLength = 0;
38903da77f91SVictor Perevertkin
38913da77f91SVictor Perevertkin if (SenseInfoBuffer == NULL || SenseInfoBufferLength == 0 || DescriptorBuffer == NULL ||
38923da77f91SVictor Perevertkin DescriptorBufferLength == NULL)
38933da77f91SVictor Perevertkin {
38943da77f91SVictor Perevertkin return FALSE;
38953da77f91SVictor Perevertkin }
38963da77f91SVictor Perevertkin
38973da77f91SVictor Perevertkin *DescriptorBuffer = NULL;
38983da77f91SVictor Perevertkin *DescriptorBufferLength = 0;
38993da77f91SVictor Perevertkin
39003da77f91SVictor Perevertkin if (!IsDescriptorSenseDataFormat(SenseInfoBuffer))
39013da77f91SVictor Perevertkin {
39023da77f91SVictor Perevertkin return FALSE;
39033da77f91SVictor Perevertkin }
39043da77f91SVictor Perevertkin
39053da77f91SVictor Perevertkin descriptorSenseData = (PDESCRIPTOR_SENSE_DATA)SenseInfoBuffer;
39063da77f91SVictor Perevertkin
39073da77f91SVictor Perevertkin if (RTL_CONTAINS_FIELD(descriptorSenseData, SenseInfoBufferLength, AdditionalSenseLength))
39083da77f91SVictor Perevertkin {
39093da77f91SVictor Perevertkin if (descriptorSenseData->AdditionalSenseLength <=
39103da77f91SVictor Perevertkin (MAX_SENSE_BUFFER_SIZE -
39113da77f91SVictor Perevertkin RTL_SIZEOF_THROUGH_FIELD(DESCRIPTOR_SENSE_DATA, AdditionalSenseLength)))
39123da77f91SVictor Perevertkin {
39133da77f91SVictor Perevertkin dataLength = descriptorSenseData->AdditionalSenseLength +
39143da77f91SVictor Perevertkin RTL_SIZEOF_THROUGH_FIELD(DESCRIPTOR_SENSE_DATA, AdditionalSenseLength);
39153da77f91SVictor Perevertkin
39163da77f91SVictor Perevertkin if (dataLength > SenseInfoBufferLength)
39173da77f91SVictor Perevertkin {
39183da77f91SVictor Perevertkin dataLength = SenseInfoBufferLength;
39193da77f91SVictor Perevertkin }
39203da77f91SVictor Perevertkin
39213da77f91SVictor Perevertkin *DescriptorBufferLength =
39223da77f91SVictor Perevertkin dataLength - RTL_SIZEOF_THROUGH_FIELD(DESCRIPTOR_SENSE_DATA, AdditionalSenseLength);
39233da77f91SVictor Perevertkin
39243da77f91SVictor Perevertkin if (*DescriptorBufferLength > 0)
39253da77f91SVictor Perevertkin {
39263da77f91SVictor Perevertkin *DescriptorBuffer = (PVOID)(descriptorSenseData->DescriptorBuffer);
39273da77f91SVictor Perevertkin succeed = TRUE;
39283da77f91SVictor Perevertkin }
39293da77f91SVictor Perevertkin }
39303da77f91SVictor Perevertkin }
39313da77f91SVictor Perevertkin
39323da77f91SVictor Perevertkin return succeed;
39333da77f91SVictor Perevertkin }
39343da77f91SVictor Perevertkin
39353da77f91SVictor Perevertkin _Success_(return != FALSE)
39363da77f91SVictor Perevertkin FORCEINLINE
39373da77f91SVictor Perevertkin BOOLEAN
ScsiValidateInformationSenseDescriptor(_In_reads_bytes_ (DescriptorBufferLength)PVOID DescriptorBuffer,_In_ UCHAR DescriptorBufferLength)39383da77f91SVictor Perevertkin ScsiValidateInformationSenseDescriptor(
39393da77f91SVictor Perevertkin _In_reads_bytes_(DescriptorBufferLength) PVOID DescriptorBuffer,
39403da77f91SVictor Perevertkin _In_ UCHAR DescriptorBufferLength)
39413da77f91SVictor Perevertkin {
39423da77f91SVictor Perevertkin PSCSI_SENSE_DESCRIPTOR_INFORMATION descriptor;
39433da77f91SVictor Perevertkin UCHAR additionalLength;
39443da77f91SVictor Perevertkin
39453da77f91SVictor Perevertkin if (DescriptorBuffer == NULL ||
39463da77f91SVictor Perevertkin DescriptorBufferLength < sizeof(SCSI_SENSE_DESCRIPTOR_INFORMATION))
39473da77f91SVictor Perevertkin {
39483da77f91SVictor Perevertkin return FALSE;
39493da77f91SVictor Perevertkin }
39503da77f91SVictor Perevertkin
39513da77f91SVictor Perevertkin descriptor = (PSCSI_SENSE_DESCRIPTOR_INFORMATION)DescriptorBuffer;
39523da77f91SVictor Perevertkin
39533da77f91SVictor Perevertkin if (descriptor->Header.DescriptorType != SCSI_SENSE_DESCRIPTOR_TYPE_INFORMATION)
39543da77f91SVictor Perevertkin {
39553da77f91SVictor Perevertkin return FALSE;
39563da77f91SVictor Perevertkin }
39573da77f91SVictor Perevertkin
39583da77f91SVictor Perevertkin additionalLength = sizeof(SCSI_SENSE_DESCRIPTOR_INFORMATION) -
39593da77f91SVictor Perevertkin RTL_SIZEOF_THROUGH_FIELD(SCSI_SENSE_DESCRIPTOR_INFORMATION, Header);
39603da77f91SVictor Perevertkin
39613da77f91SVictor Perevertkin if (descriptor->Header.AdditionalLength != additionalLength)
39623da77f91SVictor Perevertkin {
39633da77f91SVictor Perevertkin return FALSE;
39643da77f91SVictor Perevertkin }
39653da77f91SVictor Perevertkin
39663da77f91SVictor Perevertkin if (descriptor->Valid == 0)
39673da77f91SVictor Perevertkin {
39683da77f91SVictor Perevertkin return FALSE;
39693da77f91SVictor Perevertkin }
39703da77f91SVictor Perevertkin
39713da77f91SVictor Perevertkin return TRUE;
39723da77f91SVictor Perevertkin }
39733da77f91SVictor Perevertkin
39743da77f91SVictor Perevertkin _Success_(return != FALSE)
39753da77f91SVictor Perevertkin FORCEINLINE
39763da77f91SVictor Perevertkin BOOLEAN
ScsiValidateBlockCommandSenseDescriptor(_In_reads_bytes_ (DescriptorBufferLength)PVOID DescriptorBuffer,_In_ UCHAR DescriptorBufferLength)39773da77f91SVictor Perevertkin ScsiValidateBlockCommandSenseDescriptor(
39783da77f91SVictor Perevertkin _In_reads_bytes_(DescriptorBufferLength) PVOID DescriptorBuffer,
39793da77f91SVictor Perevertkin _In_ UCHAR DescriptorBufferLength)
39803da77f91SVictor Perevertkin {
39813da77f91SVictor Perevertkin PSCSI_SENSE_DESCRIPTOR_BLOCK_COMMAND descriptor;
39823da77f91SVictor Perevertkin UCHAR additionalLength;
39833da77f91SVictor Perevertkin
39843da77f91SVictor Perevertkin if (DescriptorBuffer == NULL ||
39853da77f91SVictor Perevertkin DescriptorBufferLength < sizeof(SCSI_SENSE_DESCRIPTOR_BLOCK_COMMAND))
39863da77f91SVictor Perevertkin {
39873da77f91SVictor Perevertkin return FALSE;
39883da77f91SVictor Perevertkin }
39893da77f91SVictor Perevertkin
39903da77f91SVictor Perevertkin descriptor = (PSCSI_SENSE_DESCRIPTOR_BLOCK_COMMAND)DescriptorBuffer;
39913da77f91SVictor Perevertkin
39923da77f91SVictor Perevertkin if (descriptor->Header.DescriptorType != SCSI_SENSE_DESCRIPTOR_TYPE_BLOCK_COMMAND)
39933da77f91SVictor Perevertkin {
39943da77f91SVictor Perevertkin return FALSE;
39953da77f91SVictor Perevertkin }
39963da77f91SVictor Perevertkin
39973da77f91SVictor Perevertkin additionalLength = sizeof(SCSI_SENSE_DESCRIPTOR_BLOCK_COMMAND) -
39983da77f91SVictor Perevertkin RTL_SIZEOF_THROUGH_FIELD(SCSI_SENSE_DESCRIPTOR_BLOCK_COMMAND, Header);
39993da77f91SVictor Perevertkin
40003da77f91SVictor Perevertkin if (descriptor->Header.AdditionalLength != additionalLength)
40013da77f91SVictor Perevertkin {
40023da77f91SVictor Perevertkin return FALSE;
40033da77f91SVictor Perevertkin }
40043da77f91SVictor Perevertkin
40053da77f91SVictor Perevertkin return TRUE;
40063da77f91SVictor Perevertkin }
40073da77f91SVictor Perevertkin
40083da77f91SVictor Perevertkin _Success_(return != FALSE)
40093da77f91SVictor Perevertkin FORCEINLINE
40103da77f91SVictor Perevertkin BOOLEAN
ScsiConvertToFixedSenseFormat(_In_reads_bytes_ (SenseInfoBufferLength)PVOID SenseInfoBuffer,_In_ UCHAR SenseInfoBufferLength,_Out_writes_bytes_ (OutBufferLength)PVOID OutBuffer,_In_ UCHAR OutBufferLength)40113da77f91SVictor Perevertkin ScsiConvertToFixedSenseFormat(
40123da77f91SVictor Perevertkin _In_reads_bytes_(SenseInfoBufferLength) PVOID SenseInfoBuffer,
40133da77f91SVictor Perevertkin _In_ UCHAR SenseInfoBufferLength,
40143da77f91SVictor Perevertkin _Out_writes_bytes_(OutBufferLength) PVOID OutBuffer,
40153da77f91SVictor Perevertkin _In_ UCHAR OutBufferLength)
40163da77f91SVictor Perevertkin {
40173da77f91SVictor Perevertkin BOOLEAN succeed = FALSE;
40183da77f91SVictor Perevertkin BOOLEAN validSense = FALSE;
40193da77f91SVictor Perevertkin UCHAR senseKey = 0;
40203da77f91SVictor Perevertkin UCHAR additionalSenseCode = 0;
40213da77f91SVictor Perevertkin UCHAR additionalSenseCodeQualifier = 0;
40223da77f91SVictor Perevertkin PFIXED_SENSE_DATA outBuffer = (PFIXED_SENSE_DATA)OutBuffer;
40233da77f91SVictor Perevertkin
40243da77f91SVictor Perevertkin if (SenseInfoBuffer == NULL || SenseInfoBufferLength == 0 || OutBuffer == NULL ||
40253da77f91SVictor Perevertkin OutBufferLength < sizeof(FIXED_SENSE_DATA))
40263da77f91SVictor Perevertkin {
40273da77f91SVictor Perevertkin return FALSE;
40283da77f91SVictor Perevertkin }
40293da77f91SVictor Perevertkin
40303da77f91SVictor Perevertkin if (IsDescriptorSenseDataFormat(SenseInfoBuffer))
40313da77f91SVictor Perevertkin {
40323da77f91SVictor Perevertkin RtlZeroMemory(OutBuffer, OutBufferLength);
40333da77f91SVictor Perevertkin
40343da77f91SVictor Perevertkin validSense =
40353da77f91SVictor Perevertkin ScsiGetSenseKeyAndCodes(SenseInfoBuffer, SenseInfoBufferLength, SCSI_SENSE_OPTIONS_NONE,
40363da77f91SVictor Perevertkin &senseKey, &additionalSenseCode, &additionalSenseCodeQualifier);
40373da77f91SVictor Perevertkin if (validSense)
40383da77f91SVictor Perevertkin {
40393da77f91SVictor Perevertkin
40403da77f91SVictor Perevertkin if (IsSenseDataCurrentError(SenseInfoBuffer))
40413da77f91SVictor Perevertkin {
40423da77f91SVictor Perevertkin outBuffer->ErrorCode = SCSI_SENSE_ERRORCODE_FIXED_CURRENT;
40433da77f91SVictor Perevertkin }
40443da77f91SVictor Perevertkin else
40453da77f91SVictor Perevertkin {
40463da77f91SVictor Perevertkin outBuffer->ErrorCode = SCSI_SENSE_ERRORCODE_FIXED_DEFERRED;
40473da77f91SVictor Perevertkin }
40483da77f91SVictor Perevertkin outBuffer->AdditionalSenseLength =
40493da77f91SVictor Perevertkin sizeof(FIXED_SENSE_DATA) -
40503da77f91SVictor Perevertkin RTL_SIZEOF_THROUGH_FIELD(FIXED_SENSE_DATA, AdditionalSenseLength);
40513da77f91SVictor Perevertkin outBuffer->SenseKey = senseKey;
40523da77f91SVictor Perevertkin outBuffer->AdditionalSenseCode = additionalSenseCode;
40533da77f91SVictor Perevertkin outBuffer->AdditionalSenseCodeQualifier = additionalSenseCodeQualifier;
40543da77f91SVictor Perevertkin
40553da77f91SVictor Perevertkin succeed = TRUE;
40563da77f91SVictor Perevertkin }
40573da77f91SVictor Perevertkin }
40583da77f91SVictor Perevertkin
40593da77f91SVictor Perevertkin return succeed;
40603da77f91SVictor Perevertkin }
40613da77f91SVictor Perevertkin
40623da77f91SVictor Perevertkin _Success_(return != FALSE)
40633da77f91SVictor Perevertkin FORCEINLINE
40643da77f91SVictor Perevertkin BOOLEAN
ScsiGetNextSenseDescriptorByType(_In_reads_bytes_ (BufferLength)PVOID Buffer,_In_ UCHAR BufferLength,_In_reads_ (TypeListCount)PUCHAR TypeList,_In_ ULONG TypeListCount,_Out_ PUCHAR OutType,_Outptr_result_bytebuffer_ (* OutBufferLength)PVOID * OutBuffer,_Out_ UCHAR * OutBufferLength)40653da77f91SVictor Perevertkin ScsiGetNextSenseDescriptorByType(
40663da77f91SVictor Perevertkin _In_reads_bytes_(BufferLength) PVOID Buffer,
40673da77f91SVictor Perevertkin _In_ UCHAR BufferLength,
40683da77f91SVictor Perevertkin _In_reads_(TypeListCount) PUCHAR TypeList,
40693da77f91SVictor Perevertkin _In_ ULONG TypeListCount,
40703da77f91SVictor Perevertkin _Out_ PUCHAR OutType,
40713da77f91SVictor Perevertkin _Outptr_result_bytebuffer_(*OutBufferLength) PVOID *OutBuffer,
40723da77f91SVictor Perevertkin _Out_ UCHAR *OutBufferLength)
40733da77f91SVictor Perevertkin {
40743da77f91SVictor Perevertkin PUCHAR remainingBuffer;
40753da77f91SVictor Perevertkin UCHAR remainingBufferLength;
40763da77f91SVictor Perevertkin UCHAR type;
40773da77f91SVictor Perevertkin ULONG i;
40783da77f91SVictor Perevertkin UCHAR descriptorLength;
40793da77f91SVictor Perevertkin
40803da77f91SVictor Perevertkin if (Buffer == NULL || BufferLength == 0 || TypeList == NULL || TypeListCount == 0 ||
40813da77f91SVictor Perevertkin OutType == NULL || OutBuffer == NULL || OutBufferLength == NULL)
40823da77f91SVictor Perevertkin {
40833da77f91SVictor Perevertkin return FALSE;
40843da77f91SVictor Perevertkin }
40853da77f91SVictor Perevertkin
40863da77f91SVictor Perevertkin *OutBuffer = NULL;
40873da77f91SVictor Perevertkin *OutBufferLength = 0;
40883da77f91SVictor Perevertkin *OutType = 0;
40893da77f91SVictor Perevertkin
40903da77f91SVictor Perevertkin remainingBuffer = (PUCHAR)Buffer;
40913da77f91SVictor Perevertkin remainingBufferLength = BufferLength;
40923da77f91SVictor Perevertkin
40933da77f91SVictor Perevertkin while (remainingBufferLength >= sizeof(SCSI_SENSE_DESCRIPTOR_HEADER))
40943da77f91SVictor Perevertkin {
40953da77f91SVictor Perevertkin for (i = 0; i < TypeListCount; i++)
40963da77f91SVictor Perevertkin {
40973da77f91SVictor Perevertkin type = TypeList[i];
40983da77f91SVictor Perevertkin
40993da77f91SVictor Perevertkin if (((PSCSI_SENSE_DESCRIPTOR_HEADER)remainingBuffer)->DescriptorType == type)
41003da77f91SVictor Perevertkin {
41013da77f91SVictor Perevertkin *OutBuffer = (PVOID)remainingBuffer;
41023da77f91SVictor Perevertkin *OutBufferLength = remainingBufferLength;
41033da77f91SVictor Perevertkin *OutType = type;
41043da77f91SVictor Perevertkin return TRUE;
41053da77f91SVictor Perevertkin }
41063da77f91SVictor Perevertkin }
41073da77f91SVictor Perevertkin
41083da77f91SVictor Perevertkin descriptorLength = ScsiGetSenseDescriptorLength(remainingBuffer);
41093da77f91SVictor Perevertkin
41103da77f91SVictor Perevertkin if (remainingBufferLength > descriptorLength)
41113da77f91SVictor Perevertkin {
41123da77f91SVictor Perevertkin remainingBuffer += descriptorLength;
41133da77f91SVictor Perevertkin remainingBufferLength -= descriptorLength;
41143da77f91SVictor Perevertkin }
41153da77f91SVictor Perevertkin else
41163da77f91SVictor Perevertkin {
41173da77f91SVictor Perevertkin break;
41183da77f91SVictor Perevertkin }
41193da77f91SVictor Perevertkin }
41203da77f91SVictor Perevertkin
41213da77f91SVictor Perevertkin return FALSE;
41223da77f91SVictor Perevertkin }
41233da77f91SVictor Perevertkin
4124c2c66affSColin Finck #ifdef __cplusplus
4125c2c66affSColin Finck }
4126c2c66affSColin Finck #endif
4127c2c66affSColin Finck
4128c2c66affSColin Finck #endif /* _NTSCSI_ */
4129