xref: /reactos/sdk/include/ddk/storport.h (revision 48cc7814)
1 /*
2  * storport.h
3  *
4  * StorPort interface
5  *
6  * This file is part of the w32api package.
7  *
8  * Contributors:
9  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10  *
11  * THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  * This source code is offered for use in the public domain. You may
14  * use, modify or distribute it freely.
15  *
16  * This code is distributed in the hope that it will be useful but
17  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  * DISCLAIMED. This includes but is not limited to warranties of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  */
22 
23 #ifndef _NTSTORPORT_
24 #define _NTSTORPORT_
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #if defined(_STORPORT_)
31 #define STORPORT_API
32 #else
33 #define STORPORT_API DECLSPEC_IMPORT
34 #endif
35 
36 #define DIRECT_ACCESS_DEVICE                0x00
37 #define SEQUENTIAL_ACCESS_DEVICE            0x01
38 #define PRINTER_DEVICE                      0x02
39 #define PROCESSOR_DEVICE                    0x03
40 #define WRITE_ONCE_READ_MULTIPLE_DEVICE     0x04
41 #define READ_ONLY_DIRECT_ACCESS_DEVICE      0x05
42 #define SCANNER_DEVICE                      0x06
43 #define OPTICAL_DEVICE                      0x07
44 #define MEDIUM_CHANGER                      0x08
45 #define COMMUNICATION_DEVICE                0x09
46 #define ARRAY_CONTROLLER_DEVICE             0x0C
47 #define SCSI_ENCLOSURE_DEVICE               0x0D
48 #define REDUCED_BLOCK_DEVICE                0x0E
49 #define OPTICAL_CARD_READER_WRITER_DEVICE   0x0F
50 #define BRIDGE_CONTROLLER_DEVICE            0x10
51 #define OBJECT_BASED_STORAGE_DEVICE         0x11
52 #define LOGICAL_UNIT_NOT_PRESENT_DEVICE     0x7F
53 
54 #define DEVICE_CONNECTED                    0x00
55 
56 #define CDB6GENERIC_LENGTH                  6
57 #define CDB10GENERIC_LENGTH                 10
58 #define CDB12GENERIC_LENGTH                 12
59 
60 #define INQUIRYDATABUFFERSIZE               36
61 
62 #define MODE_PAGE_VENDOR_SPECIFIC           0x00
63 #define MODE_PAGE_ERROR_RECOVERY            0x01
64 #define MODE_PAGE_DISCONNECT                0x02
65 #define MODE_PAGE_FORMAT_DEVICE             0x03
66 #define MODE_PAGE_MRW                       0x03
67 #define MODE_PAGE_RIGID_GEOMETRY            0x04
68 #define MODE_PAGE_FLEXIBILE                 0x05
69 #define MODE_PAGE_WRITE_PARAMETERS          0x05
70 #define MODE_PAGE_VERIFY_ERROR              0x07
71 #define MODE_PAGE_CACHING                   0x08
72 #define MODE_PAGE_PERIPHERAL                0x09
73 #define MODE_PAGE_CONTROL                   0x0A
74 #define MODE_PAGE_MEDIUM_TYPES              0x0B
75 #define MODE_PAGE_NOTCH_PARTITION           0x0C
76 #define MODE_PAGE_CD_AUDIO_CONTROL          0x0E
77 #define MODE_PAGE_DATA_COMPRESS             0x0F
78 #define MODE_PAGE_DEVICE_CONFIG             0x10
79 #define MODE_PAGE_XOR_CONTROL               0x10
80 #define MODE_PAGE_MEDIUM_PARTITION          0x11
81 #define MODE_PAGE_ENCLOSURE_SERVICES_MANAGEMENT 0x14
82 #define MODE_PAGE_EXTENDED                  0x15
83 #define MODE_PAGE_EXTENDED_DEVICE_SPECIFIC  0x16
84 #define MODE_PAGE_CDVD_FEATURE_SET          0x18
85 #define MODE_PAGE_PROTOCOL_SPECIFIC_LUN     0x18
86 #define MODE_PAGE_PROTOCOL_SPECIFIC_PORT    0x19
87 #define MODE_PAGE_POWER_CONDITION           0x1A
88 #define MODE_PAGE_LUN_MAPPING               0x1B
89 #define MODE_PAGE_FAULT_REPORTING           0x1C
90 #define MODE_PAGE_CDVD_INACTIVITY           0x1D
91 #define MODE_PAGE_ELEMENT_ADDRESS           0x1D
92 #define MODE_PAGE_TRANSPORT_GEOMETRY        0x1E
93 #define MODE_PAGE_DEVICE_CAPABILITIES       0x1F
94 #define MODE_PAGE_CAPABILITIES              0x2A
95 #define MODE_SENSE_RETURN_ALL               0x3F
96 
97 #define MODE_SENSE_CURRENT_VALUES           0x00
98 #define MODE_SENSE_CHANGEABLE_VALUES        0x40
99 #define MODE_SENSE_DEFAULT_VAULES           0x80
100 #define MODE_SENSE_SAVED_VALUES             0xc0
101 
102 #define SCSIOP_TEST_UNIT_READY              0x00
103 #define SCSIOP_REZERO_UNIT                  0x01
104 #define SCSIOP_REWIND                       0x01
105 #define SCSIOP_REQUEST_BLOCK_ADDR           0x02
106 #define SCSIOP_REQUEST_SENSE                0x03
107 #define SCSIOP_FORMAT_UNIT                  0x04
108 #define SCSIOP_READ_BLOCK_LIMITS            0x05
109 #define SCSIOP_REASSIGN_BLOCKS              0x07
110 #define SCSIOP_INIT_ELEMENT_STATUS          0x07
111 #define SCSIOP_READ6                        0x08
112 #define SCSIOP_RECEIVE                      0x08
113 #define SCSIOP_WRITE6                       0x0A
114 #define SCSIOP_PRINT                        0x0A
115 #define SCSIOP_SEND                         0x0A
116 #define SCSIOP_SEEK6                        0x0B
117 #define SCSIOP_TRACK_SELECT                 0x0B
118 #define SCSIOP_SLEW_PRINT                   0x0B
119 #define SCSIOP_SET_CAPACITY                 0x0B
120 #define SCSIOP_SEEK_BLOCK                   0x0C
121 #define SCSIOP_PARTITION                    0x0D
122 #define SCSIOP_READ_REVERSE                 0x0F
123 #define SCSIOP_WRITE_FILEMARKS              0x10
124 #define SCSIOP_FLUSH_BUFFER                 0x10
125 #define SCSIOP_SPACE                        0x11
126 #define SCSIOP_INQUIRY                      0x12
127 #define SCSIOP_VERIFY6                      0x13
128 #define SCSIOP_RECOVER_BUF_DATA             0x14
129 #define SCSIOP_MODE_SELECT                  0x15
130 #define SCSIOP_RESERVE_UNIT                 0x16
131 #define SCSIOP_RELEASE_UNIT                 0x17
132 #define SCSIOP_COPY                         0x18
133 #define SCSIOP_ERASE                        0x19
134 #define SCSIOP_MODE_SENSE                   0x1A
135 #define SCSIOP_START_STOP_UNIT              0x1B
136 #define SCSIOP_STOP_PRINT                   0x1B
137 #define SCSIOP_LOAD_UNLOAD                  0x1B
138 #define SCSIOP_RECEIVE_DIAGNOSTIC           0x1C
139 #define SCSIOP_SEND_DIAGNOSTIC              0x1D
140 #define SCSIOP_MEDIUM_REMOVAL               0x1E
141 #define SCSIOP_READ_FORMATTED_CAPACITY      0x23
142 #define SCSIOP_READ_CAPACITY                0x25
143 #define SCSIOP_READ                         0x28
144 #define SCSIOP_WRITE                        0x2A
145 #define SCSIOP_SEEK                         0x2B
146 #define SCSIOP_LOCATE                       0x2B
147 #define SCSIOP_POSITION_TO_ELEMENT          0x2B
148 #define SCSIOP_WRITE_VERIFY                 0x2E
149 #define SCSIOP_VERIFY                       0x2F
150 #define SCSIOP_SEARCH_DATA_HIGH             0x30
151 #define SCSIOP_SEARCH_DATA_EQUAL            0x31
152 #define SCSIOP_SEARCH_DATA_LOW              0x32
153 #define SCSIOP_SET_LIMITS                   0x33
154 #define SCSIOP_READ_POSITION                0x34
155 #define SCSIOP_SYNCHRONIZE_CACHE            0x35
156 #define SCSIOP_COMPARE                      0x39
157 #define SCSIOP_COPY_COMPARE                 0x3A
158 #define SCSIOP_WRITE_DATA_BUFF              0x3B
159 #define SCSIOP_READ_DATA_BUFF               0x3C
160 #define SCSIOP_WRITE_LONG                   0x3F
161 #define SCSIOP_CHANGE_DEFINITION            0x40
162 #define SCSIOP_WRITE_SAME                   0x41
163 #define SCSIOP_READ_SUB_CHANNEL             0x42
164 #define SCSIOP_READ_TOC                     0x43
165 #define SCSIOP_READ_HEADER                  0x44
166 #define SCSIOP_REPORT_DENSITY_SUPPORT       0x44
167 #define SCSIOP_PLAY_AUDIO                   0x45
168 #define SCSIOP_GET_CONFIGURATION            0x46
169 #define SCSIOP_PLAY_AUDIO_MSF               0x47
170 #define SCSIOP_PLAY_TRACK_INDEX             0x48
171 #define SCSIOP_PLAY_TRACK_RELATIVE          0x49
172 #define SCSIOP_GET_EVENT_STATUS             0x4A
173 #define SCSIOP_PAUSE_RESUME                 0x4B
174 #define SCSIOP_LOG_SELECT                   0x4C
175 #define SCSIOP_LOG_SENSE                    0x4D
176 #define SCSIOP_STOP_PLAY_SCAN               0x4E
177 #define SCSIOP_XDWRITE                      0x50
178 #define SCSIOP_XPWRITE                      0x51
179 #define SCSIOP_READ_DISK_INFORMATION        0x51
180 #define SCSIOP_READ_DISC_INFORMATION        0x51
181 #define SCSIOP_READ_TRACK_INFORMATION       0x52
182 #define SCSIOP_XDWRITE_READ                 0x53
183 #define SCSIOP_RESERVE_TRACK_RZONE          0x53
184 #define SCSIOP_SEND_OPC_INFORMATION         0x54
185 #define SCSIOP_MODE_SELECT10                0x55
186 #define SCSIOP_RESERVE_UNIT10               0x56
187 #define SCSIOP_RESERVE_ELEMENT              0x56
188 #define SCSIOP_RELEASE_UNIT10               0x57
189 #define SCSIOP_RELEASE_ELEMENT              0x57
190 #define SCSIOP_REPAIR_TRACK                 0x58
191 #define SCSIOP_MODE_SENSE10                 0x5A
192 #define SCSIOP_CLOSE_TRACK_SESSION          0x5B
193 #define SCSIOP_READ_BUFFER_CAPACITY         0x5C
194 #define SCSIOP_SEND_CUE_SHEET               0x5D
195 #define SCSIOP_PERSISTENT_RESERVE_IN        0x5E
196 #define SCSIOP_PERSISTENT_RESERVE_OUT       0x5F
197 #define SCSIOP_XDWRITE_EXTENDED16           0x80
198 #define SCSIOP_WRITE_FILEMARKS16            0x80
199 #define SCSIOP_REBUILD16                    0x81
200 #define SCSIOP_READ_REVERSE16               0x81
201 #define SCSIOP_REGENERATE16                 0x82
202 #define SCSIOP_EXTENDED_COPY                0x83
203 #define SCSIOP_RECEIVE_COPY_RESULTS         0x84
204 #define SCSIOP_ATA_PASSTHROUGH16            0x85
205 #define SCSIOP_ACCESS_CONTROL_IN            0x86
206 #define SCSIOP_ACCESS_CONTROL_OUT           0x87
207 #define SCSIOP_READ16                       0x88
208 #define SCSIOP_WRITE16                      0x8A
209 #define SCSIOP_READ_ATTRIBUTES              0x8C
210 #define SCSIOP_WRITE_ATTRIBUTES             0x8D
211 #define SCSIOP_WRITE_VERIFY16               0x8E
212 #define SCSIOP_VERIFY16                     0x8F
213 #define SCSIOP_PREFETCH16                   0x90
214 #define SCSIOP_SYNCHRONIZE_CACHE16          0x91
215 #define SCSIOP_SPACE16                      0x91
216 #define SCSIOP_LOCK_UNLOCK_CACHE16          0x92
217 #define SCSIOP_LOCATE16                     0x92
218 #define SCSIOP_WRITE_SAME16                 0x93
219 #define SCSIOP_ERASE16                      0x93
220 #define SCSIOP_READ_CAPACITY16              0x9E
221 #define SCSIOP_SERVICE_ACTION_IN16          0x9E
222 #define SCSIOP_SERVICE_ACTION_OUT16         0x9F
223 #define SCSIOP_REPORT_LUNS                  0xA0
224 #define SCSIOP_BLANK                        0xA1
225 #define SCSIOP_ATA_PASSTHROUGH12            0xA1
226 #define SCSIOP_SEND_EVENT                   0xA2
227 #define SCSIOP_SEND_KEY                     0xA3
228 #define SCSIOP_MAINTENANCE_IN               0xA3
229 #define SCSIOP_REPORT_KEY                   0xA4
230 #define SCSIOP_MAINTENANCE_OUT              0xA4
231 #define SCSIOP_MOVE_MEDIUM                  0xA5
232 #define SCSIOP_LOAD_UNLOAD_SLOT             0xA6
233 #define SCSIOP_EXCHANGE_MEDIUM              0xA6
234 #define SCSIOP_SET_READ_AHEAD               0xA7
235 #define SCSIOP_MOVE_MEDIUM_ATTACHED         0xA7
236 #define SCSIOP_READ12                       0xA8
237 #define SCSIOP_GET_MESSAGE                  0xA8
238 #define SCSIOP_SERVICE_ACTION_OUT12         0xA9
239 #define SCSIOP_WRITE12                      0xAA
240 #define SCSIOP_SEND_MESSAGE                 0xAB
241 #define SCSIOP_SERVICE_ACTION_IN12          0xAB
242 #define SCSIOP_GET_PERFORMANCE              0xAC
243 #define SCSIOP_READ_DVD_STRUCTURE           0xAD
244 #define SCSIOP_WRITE_VERIFY12               0xAE
245 #define SCSIOP_VERIFY12                     0xAF
246 #define SCSIOP_SEARCH_DATA_HIGH12           0xB0
247 #define SCSIOP_SEARCH_DATA_EQUAL12          0xB1
248 #define SCSIOP_SEARCH_DATA_LOW12            0xB2
249 #define SCSIOP_SET_LIMITS12                 0xB3
250 #define SCSIOP_READ_ELEMENT_STATUS_ATTACHED 0xB4
251 #define SCSIOP_REQUEST_VOL_ELEMENT          0xB5
252 #define SCSIOP_SEND_VOLUME_TAG              0xB6
253 #define SCSIOP_SET_STREAMING                0xB6
254 #define SCSIOP_READ_DEFECT_DATA             0xB7
255 #define SCSIOP_READ_ELEMENT_STATUS          0xB8
256 #define SCSIOP_READ_CD_MSF                  0xB9
257 #define SCSIOP_SCAN_CD                      0xBA
258 #define SCSIOP_REDUNDANCY_GROUP_IN          0xBA
259 #define SCSIOP_SET_CD_SPEED                 0xBB
260 #define SCSIOP_REDUNDANCY_GROUP_OUT         0xBB
261 #define SCSIOP_PLAY_CD                      0xBC
262 #define SCSIOP_SPARE_IN                     0xBC
263 #define SCSIOP_MECHANISM_STATUS             0xBD
264 #define SCSIOP_SPARE_OUT                    0xBD
265 #define SCSIOP_READ_CD                      0xBE
266 #define SCSIOP_VOLUME_SET_IN                0xBE
267 #define SCSIOP_SEND_DVD_STRUCTURE           0xBF
268 #define SCSIOP_VOLUME_SET_OUT               0xBF
269 #define SCSIOP_INIT_ELEMENT_RANGE           0xE7
270 
271 #define SCSISTAT_GOOD                       0x00
272 #define SCSISTAT_CHECK_CONDITION            0x02
273 #define SCSISTAT_CONDITION_MET              0x04
274 #define SCSISTAT_BUSY                       0x08
275 #define SCSISTAT_INTERMEDIATE               0x10
276 #define SCSISTAT_INTERMEDIATE_COND_MET      0x14
277 #define SCSISTAT_RESERVATION_CONFLICT       0x18
278 #define SCSISTAT_COMMAND_TERMINATED         0x22
279 #define SCSISTAT_QUEUE_FULL                 0x28
280 
281 #define SETBITON                            1
282 #define SETBITOFF                           0
283 
284 #define SP_RETURN_NOT_FOUND                 0
285 #define SP_RETURN_FOUND                     1
286 #define SP_RETURN_ERROR                     2
287 #define SP_RETURN_BAD_CONFIG                3
288 
289 #define SRB_FUNCTION_EXECUTE_SCSI           0x00
290 #define SRB_FUNCTION_CLAIM_DEVICE           0x01
291 #define SRB_FUNCTION_IO_CONTROL             0x02
292 #define SRB_FUNCTION_RECEIVE_EVENT          0x03
293 #define SRB_FUNCTION_RELEASE_QUEUE          0x04
294 #define SRB_FUNCTION_ATTACH_DEVICE          0x05
295 #define SRB_FUNCTION_RELEASE_DEVICE         0x06
296 #define SRB_FUNCTION_SHUTDOWN               0x07
297 #define SRB_FUNCTION_FLUSH                  0x08
298 #define SRB_FUNCTION_ABORT_COMMAND          0x10
299 #define SRB_FUNCTION_RELEASE_RECOVERY       0x11
300 #define SRB_FUNCTION_RESET_BUS              0x12
301 #define SRB_FUNCTION_RESET_DEVICE           0x13
302 #define SRB_FUNCTION_TERMINATE_IO           0x14
303 #define SRB_FUNCTION_FLUSH_QUEUE            0x15
304 #define SRB_FUNCTION_REMOVE_DEVICE          0x16
305 #define SRB_FUNCTION_WMI                    0x17
306 #define SRB_FUNCTION_LOCK_QUEUE             0x18
307 #define SRB_FUNCTION_UNLOCK_QUEUE           0x19
308 #define SRB_FUNCTION_RESET_LOGICAL_UNIT     0x20
309 #define SRB_FUNCTION_SET_LINK_TIMEOUT       0x21
310 #define SRB_FUNCTION_LINK_TIMEOUT_OCCURRED  0x22
311 #define SRB_FUNCTION_LINK_TIMEOUT_COMPLETE  0x23
312 #define SRB_FUNCTION_POWER                  0x24
313 #define SRB_FUNCTION_PNP                    0x25
314 #define SRB_FUNCTION_DUMP_POINTERS          0x26
315 
316 #define SRB_STATUS_PENDING                  0x00
317 #define SRB_STATUS_SUCCESS                  0x01
318 #define SRB_STATUS_ABORTED                  0x02
319 #define SRB_STATUS_ABORT_FAILED             0x03
320 #define SRB_STATUS_ERROR                    0x04
321 #define SRB_STATUS_BUSY                     0x05
322 #define SRB_STATUS_INVALID_REQUEST          0x06
323 #define SRB_STATUS_INVALID_PATH_ID          0x07
324 #define SRB_STATUS_NO_DEVICE                0x08
325 #define SRB_STATUS_TIMEOUT                  0x09
326 #define SRB_STATUS_SELECTION_TIMEOUT        0x0A
327 #define SRB_STATUS_COMMAND_TIMEOUT          0x0B
328 #define SRB_STATUS_MESSAGE_REJECTED         0x0D
329 #define SRB_STATUS_BUS_RESET                0x0E
330 #define SRB_STATUS_PARITY_ERROR             0x0F
331 #define SRB_STATUS_REQUEST_SENSE_FAILED     0x10
332 #define SRB_STATUS_NO_HBA                   0x11
333 #define SRB_STATUS_DATA_OVERRUN             0x12
334 #define SRB_STATUS_UNEXPECTED_BUS_FREE      0x13
335 #define SRB_STATUS_PHASE_SEQUENCE_FAILURE   0x14
336 #define SRB_STATUS_BAD_SRB_BLOCK_LENGTH     0x15
337 #define SRB_STATUS_REQUEST_FLUSHED          0x16
338 #define SRB_STATUS_INVALID_LUN              0x20
339 #define SRB_STATUS_INVALID_TARGET_ID        0x21
340 #define SRB_STATUS_BAD_FUNCTION             0x22
341 #define SRB_STATUS_ERROR_RECOVERY           0x23
342 #define SRB_STATUS_NOT_POWERED              0x24
343 #define SRB_STATUS_LINK_DOWN                0x25
344 #define SRB_STATUS_INTERNAL_ERROR           0x30
345 #define SRB_STATUS_QUEUE_FROZEN             0x40
346 #define SRB_STATUS_AUTOSENSE_VALID          0x80
347 #define SRB_STATUS(Status)                  (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN))
348 
349 #define SRB_FLAGS_QUEUE_ACTION_ENABLE       0x00000002
350 #define SRB_FLAGS_DISABLE_DISCONNECT        0x00000004
351 #define SRB_FLAGS_DISABLE_SYNCH_TRANSFER    0x00000008
352 
353 #define SRB_FLAGS_BYPASS_FROZEN_QUEUE       0x00000010
354 #define SRB_FLAGS_DISABLE_AUTOSENSE         0x00000020
355 #define SRB_FLAGS_DATA_IN                   0x00000040
356 #define SRB_FLAGS_DATA_OUT                  0x00000080
357 #define SRB_FLAGS_NO_DATA_TRANSFER          0x00000000
358 #define SRB_FLAGS_UNSPECIFIED_DIRECTION     (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT)
359 
360 #define SRB_FLAGS_NO_QUEUE_FREEZE           0x00000100
361 #define SRB_FLAGS_ADAPTER_CACHE_ENABLE      0x00000200
362 #define SRB_FLAGS_FREE_SENSE_BUFFER         0x00000400
363 
364 #define SRB_FLAGS_IS_ACTIVE                 0x00010000
365 #define SRB_FLAGS_ALLOCATED_FROM_ZONE       0x00020000
366 #define SRB_FLAGS_SGLIST_FROM_POOL          0x00040000
367 #define SRB_FLAGS_BYPASS_LOCKED_QUEUE       0x00080000
368 
369 #define SRB_FLAGS_NO_KEEP_AWAKE             0x00100000
370 #define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE    0x00200000
371 
372 #define SRB_FLAGS_PORT_DRIVER_SENSEHASPORT  0x00400000
373 #define SRB_FLAGS_DONT_START_NEXT_PACKET    0x00800000
374 
375 #define SRB_FLAGS_PORT_DRIVER_RESERVED      0x0F000000
376 #define SRB_FLAGS_CLASS_DRIVER_RESERVED     0xF0000000
377 
378 #define SRB_SIMPLE_TAG_REQUEST              0x20
379 #define SRB_HEAD_OF_QUEUE_TAG_REQUEST       0x21
380 #define SRB_ORDERED_QUEUE_TAG_REQUEST       0x22
381 
382 #define SRB_WMI_FLAGS_ADAPTER_REQUEST       0x01
383 #define SRB_POWER_FLAGS_ADAPTER_REQUEST     0x01
384 #define SRB_PNP_FLAGS_ADAPTER_REQUEST       0x01
385 
386 #define STOR_MAP_NO_BUFFERS                 (0)
387 #define STOR_MAP_ALL_BUFFERS                (1)
388 #define STOR_MAP_NON_READ_WRITE_BUFFERS     (2)
389 
390 #define VPD_SUPPORTED_PAGES                 0x00
391 #define VPD_SERIAL_NUMBER                   0x80
392 #define VPD_DEVICE_IDENTIFIERS              0x83
393 #define VPD_MEDIA_SERIAL_NUMBER             0x84
394 #define VPD_SOFTWARE_INTERFACE_IDENTIFIERS  0x84
395 #define VPD_NETWORK_MANAGEMENT_ADDRESSES    0x85
396 #define VPD_EXTENDED_INQUIRY_DATA           0x86
397 #define VPD_MODE_PAGE_POLICY                0x87
398 #define VPD_SCSI_PORTS                      0x88
399 
400 typedef enum _STOR_SYNCHRONIZATION_MODEL
401 {
402     StorSynchronizeHalfDuplex,
403     StorSynchronizeFullDuplex
404 } STOR_SYNCHRONIZATION_MODEL;
405 
406 typedef enum _STOR_DMA_WIDTH
407 {
408     DmaUnknown,
409     Dma32Bit,
410     Dma64BitScatterGather,
411     Dma64Bit
412 } STOR_DMA_WIDTH;
413 
414 typedef enum _STOR_SPINLOCK
415 {
416     DpcLock = 1,
417     StartIoLock,
418     InterruptLock
419 } STOR_SPINLOCK;
420 
421 typedef enum _SCSI_ADAPTER_CONTROL_TYPE
422 {
423     ScsiQuerySupportedControlTypes = 0,
424     ScsiStopAdapter,
425     ScsiRestartAdapter,
426     ScsiSetBootConfig,
427     ScsiSetRunningConfig,
428     ScsiAdapterControlMax,
429     MakeAdapterControlTypeSizeOfUlong = 0xffffffff
430 } SCSI_ADAPTER_CONTROL_TYPE, *PSCSI_ADAPTER_CONTROL_TYPE;
431 
432 typedef enum _SCSI_ADAPTER_CONTROL_STATUS
433 {
434     ScsiAdapterControlSuccess = 0,
435     ScsiAdapterControlUnsuccessful
436 } SCSI_ADAPTER_CONTROL_STATUS, *PSCSI_ADAPTER_CONTROL_STATUS;
437 
438 typedef enum _SCSI_NOTIFICATION_TYPE
439 {
440     RequestComplete,
441     NextRequest,
442     NextLuRequest,
443     ResetDetected,
444     _obsolete1,
445     _obsolete2,
446     RequestTimerCall,
447     BusChangeDetected,
448     WMIEvent,
449     WMIReregister,
450     LinkUp,
451     LinkDown,
452     QueryTickCount,
453     BufferOverrunDetected,
454     TraceNotification,
455     GetExtendedFunctionTable,
456     EnablePassiveInitialization = 0x1000,
457     InitializeDpc,
458     IssueDpc,
459     AcquireSpinLock,
460     ReleaseSpinLock
461 } SCSI_NOTIFICATION_TYPE, *PSCSI_NOTIFICATION_TYPE;
462 
463 typedef enum _STOR_DEVICE_POWER_STATE
464 {
465     StorPowerDeviceUnspecified = 0,
466     StorPowerDeviceD0,
467     StorPowerDeviceD1,
468     StorPowerDeviceD2,
469     StorPowerDeviceD3,
470     StorPowerDeviceMaximum
471 } STOR_DEVICE_POWER_STATE, *PSTOR_DEVICE_POWER_STATE;
472 
473 typedef enum _STOR_POWER_ACTION
474 {
475     StorPowerActionNone = 0,
476     StorPowerActionReserved,
477     StorPowerActionSleep,
478     StorPowerActionHibernate,
479     StorPowerActionShutdown,
480     StorPowerActionShutdownReset,
481     StorPowerActionShutdownOff,
482     StorPowerActionWarmEject
483 } STOR_POWER_ACTION, *PSTOR_POWER_ACTION;
484 
485 typedef enum _STOR_PNP_ACTION
486 {
487     StorStartDevice = 0x0,
488     StorRemoveDevice = 0x2,
489     StorStopDevice = 0x4,
490     StorQueryCapabilities = 0x9,
491     StorQueryResourceRequirements = 0xB,
492     StorFilterResourceRequirements = 0xD,
493     StorSurpriseRemoval = 0x17
494 } STOR_PNP_ACTION, *PSTOR_PNP_ACTION;
495 
496 typedef enum _VPD_CODE_SET
497 {
498     VpdCodeSetReserved = 0,
499     VpdCodeSetBinary = 1,
500     VpdCodeSetAscii = 2,
501     VpdCodeSetUTF8 = 3
502 } VPD_CODE_SET, *PVPD_CODE_SET;
503 
504 typedef enum _VPD_ASSOCIATION
505 {
506     VpdAssocDevice = 0,
507     VpdAssocPort = 1,
508     VpdAssocTarget = 2,
509     VpdAssocReserved1 = 3,
510     VpdAssocReserved2 = 4
511 } VPD_ASSOCIATION, *PVPD_ASSOCIATION;
512 
513 typedef enum _VPD_IDENTIFIER_TYPE
514 {
515     VpdIdentifierTypeVendorSpecific = 0,
516     VpdIdentifierTypeVendorId = 1,
517     VpdIdentifierTypeEUI64 = 2,
518     VpdIdentifierTypeFCPHName = 3,
519     VpdIdentifierTypePortRelative = 4,
520     VpdIdentifierTypeTargetPortGroup = 5,
521     VpdIdentifierTypeLogicalUnitGroup = 6,
522     VpdIdentifierTypeMD5LogicalUnitId = 7,
523     VpdIdentifierTypeSCSINameString = 8
524 } VPD_IDENTIFIER_TYPE, *PVPD_IDENTIFIER_TYPE;
525 
526 typedef enum _STORPORT_FUNCTION_CODE
527 {
528     ExtFunctionAllocatePool,
529     ExtFunctionFreePool,
530     ExtFunctionAllocateMdl,
531     ExtFunctionFreeMdl,
532     ExtFunctionBuildMdlForNonPagedPool,
533     ExtFunctionGetSystemAddress,
534     ExtFunctionGetOriginalMdl,
535     ExtFunctionCompleteServiceIrp,
536     ExtFunctionGetDeviceObjects,
537     ExtFunctionBuildScatterGatherList,
538     ExtFunctionPutScatterGatherList,
539     ExtFunctionAcquireMSISpinLock,
540     ExtFunctionReleaseMSISpinLock,
541     ExtFunctionGetMessageInterruptInformation,
542     ExtFunctionInitializePerformanceOptimizations,
543     ExtFunctionGetStartIoPerformanceParameters,
544     ExtFunctionLogSystemEvent,
545 #if (NTDDI_VERSION >= NTDDI_WIN7)
546     ExtFunctionGetCurrentProcessorNumber,
547     ExtFunctionGetActiveGroupCount,
548     ExtFunctionGetGroupAffinity,
549     ExtFunctionGetActiveNodeCount,
550     ExtFunctionGetNodeAffinity,
551     ExtFunctionGetHighestNodeNumber,
552     ExtFunctionGetLogicalProcessorRelationship,
553     ExtFunctionAllocateContiguousMemorySpecifyCacheNode,
554     ExtFunctionFreeContiguousMemorySpecifyCache
555 #endif
556 } STORPORT_FUNCTION_CODE, *PSTORPORT_FUNCTION_CODE;
557 
558 typedef enum _STOR_EVENT_ASSOCIATION_ENUM
559 {
560     StorEventAdapterAssociation = 0,
561     StorEventLunAssociation,
562     StorEventTargetAssociation,
563     StorEventInvalidAssociation
564 } STOR_EVENT_ASSOCIATION_ENUM;
565 
566 typedef struct _SCSI_REQUEST_BLOCK
567 {
568     USHORT Length;
569     UCHAR Function;
570     UCHAR SrbStatus;
571     UCHAR ScsiStatus;
572     UCHAR PathId;
573     UCHAR TargetId;
574     UCHAR Lun;
575     UCHAR QueueTag;
576     UCHAR QueueAction;
577     UCHAR CdbLength;
578     UCHAR SenseInfoBufferLength;
579     ULONG SrbFlags;
580     ULONG DataTransferLength;
581     ULONG TimeOutValue;
582     PVOID DataBuffer;
583     PVOID SenseInfoBuffer;
584     struct _SCSI_REQUEST_BLOCK *NextSrb;
585     PVOID OriginalRequest;
586     PVOID SrbExtension;
587     union
588     {
589         ULONG InternalStatus;
590         ULONG QueueSortKey;
591         ULONG LinkTimeoutValue;
592     };
593 #if defined(_WIN64)
594     ULONG Reserved;
595 #endif
596     UCHAR Cdb[16];
597 } SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK;
598 
599 typedef struct _SCSI_WMI_REQUEST_BLOCK
600 {
601     USHORT Length;
602     UCHAR Function;
603     UCHAR SrbStatus;
604     UCHAR WMISubFunction;
605     UCHAR PathId;
606     UCHAR TargetId;
607     UCHAR Lun;
608     UCHAR Reserved1;
609     UCHAR WMIFlags;
610     UCHAR Reserved2[2];
611     ULONG SrbFlags;
612     ULONG DataTransferLength;
613     ULONG TimeOutValue;
614     PVOID DataBuffer;
615     PVOID DataPath;
616     PVOID Reserved3;
617     PVOID OriginalRequest;
618     PVOID SrbExtension;
619     ULONG Reserved4;
620 #if (NTDDI_VERSION >= NTDDI_WS03SP1) && defined(_WIN64)
621     ULONG Reserved6;
622 #endif
623     UCHAR Reserved5[16];
624 } SCSI_WMI_REQUEST_BLOCK, *PSCSI_WMI_REQUEST_BLOCK;
625 
626 typedef struct _SCSI_POWER_REQUEST_BLOCK
627 {
628     USHORT Length;
629     UCHAR Function;
630     UCHAR SrbStatus;
631     UCHAR SrbPowerFlags;
632     UCHAR PathId;
633     UCHAR TargetId;
634     UCHAR Lun;
635     STOR_DEVICE_POWER_STATE DevicePowerState;
636     ULONG SrbFlags;
637     ULONG DataTransferLength;
638     ULONG TimeOutValue;
639     PVOID DataBuffer;
640     PVOID SenseInfoBuffer;
641     struct _SCSI_REQUEST_BLOCK *NextSrb;
642     PVOID OriginalRequest;
643     PVOID SrbExtension;
644     STOR_POWER_ACTION PowerAction;
645 #if defined(_WIN64)
646     ULONG Reserved;
647 #endif
648     UCHAR Reserved5[16];
649 } SCSI_POWER_REQUEST_BLOCK, *PSCSI_POWER_REQUEST_BLOCK;
650 
651 typedef struct _STOR_DEVICE_CAPABILITIES
652 {
653     USHORT Version;
654     ULONG DeviceD1:1;
655     ULONG DeviceD2:1;
656     ULONG LockSupported:1;
657     ULONG EjectSupported:1;
658     ULONG Removable:1;
659     ULONG DockDevice:1;
660     ULONG UniqueID:1;
661     ULONG SilentInstall:1;
662     ULONG SurpriseRemovalOK:1;
663     ULONG NoDisplayInUI:1;
664 } STOR_DEVICE_CAPABILITIES, *PSTOR_DEVICE_CAPABILITIES;
665 
666 typedef struct _SCSI_PNP_REQUEST_BLOCK
667 {
668     USHORT Length;
669     UCHAR Function;
670     UCHAR SrbStatus;
671     UCHAR PnPSubFunction;
672     UCHAR PathId;
673     UCHAR TargetId;
674     UCHAR Lun;
675     STOR_PNP_ACTION PnPAction;
676     ULONG SrbFlags;
677     ULONG DataTransferLength;
678     ULONG TimeOutValue;
679     PVOID DataBuffer;
680     PVOID SenseInfoBuffer;
681     struct _SCSI_REQUEST_BLOCK *NextSrb;
682     PVOID OriginalRequest;
683     PVOID SrbExtension;
684     ULONG SrbPnPFlags;
685 #if defined(_WIN64)
686     ULONG Reserved;
687 #endif
688     UCHAR Reserved4[16];
689 } SCSI_PNP_REQUEST_BLOCK, *PSCSI_PNP_REQUEST_BLOCK;
690 
691 #include <pshpack1.h>
692 typedef union _CDB
693 {
694     struct _CDB6GENERIC
695     {
696         UCHAR OperationCode;
697         UCHAR Immediate:1;
698         UCHAR CommandUniqueBits:4;
699         UCHAR LogicalUnitNumber:3;
700         UCHAR CommandUniqueBytes[3];
701         UCHAR Link:1;
702         UCHAR Flag:1;
703         UCHAR Reserved:4;
704         UCHAR VendorUnique:2;
705     } CDB6GENERIC, *PCDB6GENERIC;
706     struct _CDB6READWRITE
707     {
708         UCHAR OperationCode;
709         UCHAR LogicalBlockMsb1:5;
710         UCHAR LogicalUnitNumber:3;
711         UCHAR LogicalBlockMsb0;
712         UCHAR LogicalBlockLsb;
713         UCHAR TransferBlocks;
714         UCHAR Control;
715     } CDB6READWRITE, *PCDB6READWRITE;
716     struct _CDB6INQUIRY
717     {
718         UCHAR OperationCode;
719         UCHAR Reserved1:5;
720         UCHAR LogicalUnitNumber:3;
721         UCHAR PageCode;
722         UCHAR IReserved;
723         UCHAR AllocationLength;
724         UCHAR Control;
725     } CDB6INQUIRY, *PCDB6INQUIRY;
726     struct _CDB6INQUIRY3
727     {
728         UCHAR OperationCode;
729         UCHAR EnableVitalProductData:1;
730         UCHAR CommandSupportData:1;
731         UCHAR Reserved1:6;
732         UCHAR PageCode;
733         UCHAR Reserved2;
734         UCHAR AllocationLength;
735         UCHAR Control;
736     } CDB6INQUIRY3, *PCDB6INQUIRY3;
737     struct _CDB6VERIFY
738     {
739         UCHAR OperationCode;
740         UCHAR Fixed:1;
741         UCHAR ByteCompare:1;
742         UCHAR Immediate:1;
743         UCHAR Reserved:2;
744         UCHAR LogicalUnitNumber:3;
745         UCHAR VerificationLength[3];
746         UCHAR Control;
747     } CDB6VERIFY, *PCDB6VERIFY;
748     struct _CDB6FORMAT
749     {
750         UCHAR OperationCode;
751         UCHAR FormatControl:5;
752         UCHAR LogicalUnitNumber:3;
753         UCHAR FReserved1;
754         UCHAR InterleaveMsb;
755         UCHAR InterleaveLsb;
756         UCHAR FReserved2;
757     } CDB6FORMAT, *PCDB6FORMAT;
758     struct _CDB10
759     {
760         UCHAR OperationCode;
761         UCHAR RelativeAddress:1;
762         UCHAR Reserved1:2;
763         UCHAR ForceUnitAccess:1;
764         UCHAR DisablePageOut:1;
765         UCHAR LogicalUnitNumber:3;
766         UCHAR LogicalBlockByte0;
767         UCHAR LogicalBlockByte1;
768         UCHAR LogicalBlockByte2;
769         UCHAR LogicalBlockByte3;
770         UCHAR Reserved2;
771         UCHAR TransferBlocksMsb;
772         UCHAR TransferBlocksLsb;
773         UCHAR Control;
774     } CDB10, *PCDB10;
775     struct _CDB12
776     {
777         UCHAR OperationCode;
778         UCHAR RelativeAddress:1;
779         UCHAR Reserved1:2;
780         UCHAR ForceUnitAccess:1;
781         UCHAR DisablePageOut:1;
782         UCHAR LogicalUnitNumber:3;
783         UCHAR LogicalBlock[4];
784         UCHAR TransferLength[4];
785         UCHAR Reserved2;
786         UCHAR Control;
787     } CDB12, *PCDB12;
788     struct _CDB16
789     {
790         UCHAR OperationCode;
791         UCHAR Reserved1:3;
792         UCHAR ForceUnitAccess:1;
793         UCHAR DisablePageOut:1;
794         UCHAR Protection:3;
795         UCHAR LogicalBlock[8];
796         UCHAR TransferLength[4];
797         UCHAR Reserved2;
798         UCHAR Control;
799     } CDB16, *PCDB16;
800     struct _PAUSE_RESUME
801     {
802         UCHAR OperationCode;
803         UCHAR Reserved1:5;
804         UCHAR LogicalUnitNumber:3;
805         UCHAR Reserved2[6];
806         UCHAR Action;
807         UCHAR Control;
808     } PAUSE_RESUME, *PPAUSE_RESUME;
809     struct _READ_TOC
810     {
811         UCHAR OperationCode;
812         UCHAR Reserved0:1;
813         UCHAR Msf:1;
814         UCHAR Reserved1:3;
815         UCHAR LogicalUnitNumber:3;
816         UCHAR Format2:4;
817         UCHAR Reserved2:4;
818         UCHAR Reserved3[3];
819         UCHAR StartingTrack;
820         UCHAR AllocationLength[2];
821         UCHAR Control:6;
822         UCHAR Format:2;
823     } READ_TOC, *PREAD_TOC;
824     struct _READ_DISK_INFORMATION
825     {
826         UCHAR OperationCode;
827         UCHAR Reserved1:5;
828         UCHAR Lun:3;
829         UCHAR Reserved2[5];
830         UCHAR AllocationLength[2];
831         UCHAR Control;
832     } READ_DISK_INFORMATION, *PREAD_DISK_INFORMATION;
833     struct _READ_TRACK_INFORMATION
834     {
835         UCHAR OperationCode;
836         UCHAR Track:1;
837         UCHAR Reserved1:3;
838         UCHAR Reserved2:1;
839         UCHAR Lun:3;
840         UCHAR BlockAddress[4];
841         UCHAR Reserved3;
842         UCHAR AllocationLength[2];
843         UCHAR Control;
844     } READ_TRACK_INFORMATION, *PREAD_TRACK_INFORMATION;
845     struct _RESERVE_TRACK_RZONE
846     {
847         UCHAR OperationCode;
848         UCHAR Reserved1[4];
849         UCHAR ReservationSize[4];
850         UCHAR Control;
851     } RESERVE_TRACK_RZONE, *PRESERVE_TRACK_RZONE;
852     struct _SEND_OPC_INFORMATION
853     {
854         UCHAR OperationCode;
855         UCHAR DoOpc:1;
856         UCHAR Reserved1:7;
857         UCHAR Exclude0:1;
858         UCHAR Exclude1:1;
859         UCHAR Reserved2:6;
860         UCHAR Reserved3[4];
861         UCHAR ParameterListLength[2];
862         UCHAR Reserved4;
863     } SEND_OPC_INFORMATION, *PSEND_OPC_INFORMATION;
864     struct _REPAIR_TRACK
865     {
866         UCHAR OperationCode;
867         UCHAR Immediate:1;
868         UCHAR Reserved1:7;
869         UCHAR Reserved2[2];
870         UCHAR TrackNumber[2];
871         UCHAR Reserved3[3];
872         UCHAR Control;
873     } REPAIR_TRACK, *PREPAIR_TRACK;
874     struct _CLOSE_TRACK
875     {
876         UCHAR OperationCode;
877         UCHAR Immediate:1;
878         UCHAR Reserved1:7;
879         UCHAR Track:1;
880         UCHAR Session:1;
881         UCHAR Reserved2:6;
882         UCHAR Reserved3;
883         UCHAR TrackNumber[2];
884         UCHAR Reserved4[3];
885         UCHAR Control;
886     } CLOSE_TRACK, *PCLOSE_TRACK;
887     struct _READ_BUFFER_CAPACITY
888     {
889         UCHAR OperationCode;
890         UCHAR BlockInfo:1;
891         UCHAR Reserved1:7;
892         UCHAR Reserved2[5];
893         UCHAR AllocationLength[2];
894         UCHAR Control;
895     } READ_BUFFER_CAPACITY, *PREAD_BUFFER_CAPACITY;
896     struct _SEND_CUE_SHEET
897     {
898         UCHAR OperationCode;
899         UCHAR Reserved[5];
900         UCHAR CueSheetSize[3];
901         UCHAR Control;
902     } SEND_CUE_SHEET, *PSEND_CUE_SHEET;
903     struct _READ_HEADER
904     {
905         UCHAR OperationCode;
906         UCHAR Reserved1:1;
907         UCHAR Msf:1;
908         UCHAR Reserved2:3;
909         UCHAR Lun:3;
910         UCHAR LogicalBlockAddress[4];
911         UCHAR Reserved3;
912         UCHAR AllocationLength[2];
913         UCHAR Control;
914     } READ_HEADER, *PREAD_HEADER;
915     struct _PLAY_AUDIO
916     {
917         UCHAR OperationCode;
918         UCHAR Reserved1:5;
919         UCHAR LogicalUnitNumber:3;
920         UCHAR StartingBlockAddress[4];
921         UCHAR Reserved2;
922         UCHAR PlayLength[2];
923         UCHAR Control;
924     } PLAY_AUDIO, *PPLAY_AUDIO;
925     struct _PLAY_AUDIO_MSF
926     {
927         UCHAR OperationCode;
928         UCHAR Reserved1:5;
929         UCHAR LogicalUnitNumber:3;
930         UCHAR Reserved2;
931         UCHAR StartingM;
932         UCHAR StartingS;
933         UCHAR StartingF;
934         UCHAR EndingM;
935         UCHAR EndingS;
936         UCHAR EndingF;
937         UCHAR Control;
938     } PLAY_AUDIO_MSF, *PPLAY_AUDIO_MSF;
939     struct _BLANK_MEDIA
940     {
941         UCHAR OperationCode;
942         UCHAR BlankType:3;
943         UCHAR Reserved1:1;
944         UCHAR Immediate:1;
945         UCHAR Reserved2:3;
946         UCHAR AddressOrTrack[4];
947         UCHAR Reserved3[5];
948         UCHAR Control;
949     } BLANK_MEDIA, *PBLANK_MEDIA;
950     struct _PLAY_CD
951     {
952         UCHAR OperationCode;
953         UCHAR Reserved1:1;
954         UCHAR CMSF:1;
955         UCHAR ExpectedSectorType:3;
956         UCHAR Lun:3;
957         _ANONYMOUS_UNION union
958         {
959             struct _LBA
960             {
961                 UCHAR StartingBlockAddress[4];
962                 UCHAR PlayLength[4];
963             } LBA;
964             struct _MSF
965             {
966                 UCHAR Reserved1;
967                 UCHAR StartingM;
968                 UCHAR StartingS;
969                 UCHAR StartingF;
970                 UCHAR EndingM;
971                 UCHAR EndingS;
972                 UCHAR EndingF;
973                 UCHAR Reserved2;
974             } MSF;
975         } DUMMYUNIONNAME;
976         UCHAR Audio:1;
977         UCHAR Composite:1;
978         UCHAR Port1:1;
979         UCHAR Port2:1;
980         UCHAR Reserved2:3;
981         UCHAR Speed:1;
982         UCHAR Control;
983     } PLAY_CD, *PPLAY_CD;
984     struct _SCAN_CD
985     {
986         UCHAR OperationCode;
987         UCHAR RelativeAddress:1;
988         UCHAR Reserved1:3;
989         UCHAR Direct:1;
990         UCHAR Lun:3;
991         UCHAR StartingAddress[4];
992         UCHAR Reserved2[3];
993         UCHAR Reserved3:6;
994         UCHAR Type:2;
995         UCHAR Reserved4;
996         UCHAR Control;
997     } SCAN_CD, *PSCAN_CD;
998     struct _STOP_PLAY_SCAN
999     {
1000         UCHAR OperationCode;
1001         UCHAR Reserved1:5;
1002         UCHAR Lun:3;
1003         UCHAR Reserved2[7];
1004         UCHAR Control;
1005     } STOP_PLAY_SCAN, *PSTOP_PLAY_SCAN;
1006     struct _SUBCHANNEL
1007     {
1008         UCHAR OperationCode;
1009         UCHAR Reserved0:1;
1010         UCHAR Msf:1;
1011         UCHAR Reserved1:3;
1012         UCHAR LogicalUnitNumber:3;
1013         UCHAR Reserved2:6;
1014         UCHAR SubQ:1;
1015         UCHAR Reserved3:1;
1016         UCHAR Format;
1017         UCHAR Reserved4[2];
1018         UCHAR TrackNumber;
1019         UCHAR AllocationLength[2];
1020         UCHAR Control;
1021     } SUBCHANNEL, *PSUBCHANNEL;
1022     struct _READ_CD
1023     {
1024         UCHAR OperationCode;
1025         UCHAR RelativeAddress:1;
1026         UCHAR Reserved0:1;
1027         UCHAR ExpectedSectorType:3;
1028         UCHAR Lun:3;
1029         UCHAR StartingLBA[4];
1030         UCHAR TransferBlocks[3];
1031         UCHAR Reserved2:1;
1032         UCHAR ErrorFlags:2;
1033         UCHAR IncludeEDC:1;
1034         UCHAR IncludeUserData:1;
1035         UCHAR HeaderCode:2;
1036         UCHAR IncludeSyncData:1;
1037         UCHAR SubChannelSelection:3;
1038         UCHAR Reserved3:5;
1039         UCHAR Control;
1040     } READ_CD, *PREAD_CD;
1041     struct _READ_CD_MSF
1042     {
1043         UCHAR OperationCode;
1044         UCHAR RelativeAddress:1;
1045         UCHAR Reserved1:1;
1046         UCHAR ExpectedSectorType:3;
1047         UCHAR Lun:3;
1048         UCHAR Reserved2;
1049         UCHAR StartingM;
1050         UCHAR StartingS;
1051         UCHAR StartingF;
1052         UCHAR EndingM;
1053         UCHAR EndingS;
1054         UCHAR EndingF;
1055         UCHAR Reserved3;
1056         UCHAR Reserved4:1;
1057         UCHAR ErrorFlags:2;
1058         UCHAR IncludeEDC:1;
1059         UCHAR IncludeUserData:1;
1060         UCHAR HeaderCode:2;
1061         UCHAR IncludeSyncData:1;
1062         UCHAR SubChannelSelection:3;
1063         UCHAR Reserved5:5;
1064         UCHAR Control;
1065     } READ_CD_MSF, *PREAD_CD_MSF;
1066     struct _PLXTR_READ_CDDA
1067     {
1068         UCHAR OperationCode;
1069         UCHAR Reserved0:5;
1070         UCHAR LogicalUnitNumber:3;
1071         UCHAR LogicalBlockByte0;
1072         UCHAR LogicalBlockByte1;
1073         UCHAR LogicalBlockByte2;
1074         UCHAR LogicalBlockByte3;
1075         UCHAR TransferBlockByte0;
1076         UCHAR TransferBlockByte1;
1077         UCHAR TransferBlockByte2;
1078         UCHAR TransferBlockByte3;
1079         UCHAR SubCode;
1080         UCHAR Control;
1081     } PLXTR_READ_CDDA, *PPLXTR_READ_CDDA;
1082     struct _NEC_READ_CDDA
1083     {
1084         UCHAR OperationCode;
1085         UCHAR Reserved0;
1086         UCHAR LogicalBlockByte0;
1087         UCHAR LogicalBlockByte1;
1088         UCHAR LogicalBlockByte2;
1089         UCHAR LogicalBlockByte3;
1090         UCHAR Reserved1;
1091         UCHAR TransferBlockByte0;
1092         UCHAR TransferBlockByte1;
1093         UCHAR Control;
1094     } NEC_READ_CDDA, *PNEC_READ_CDDA;
1095     struct _MODE_SENSE
1096     {
1097         UCHAR OperationCode;
1098         UCHAR Reserved1:3;
1099         UCHAR Dbd:1;
1100         UCHAR Reserved2:1;
1101         UCHAR LogicalUnitNumber:3;
1102         UCHAR PageCode:6;
1103         UCHAR Pc:2;
1104         UCHAR Reserved3;
1105         UCHAR AllocationLength;
1106         UCHAR Control;
1107     } MODE_SENSE, *PMODE_SENSE;
1108     struct _MODE_SENSE10
1109     {
1110         UCHAR OperationCode;
1111         UCHAR Reserved1:3;
1112         UCHAR Dbd:1;
1113         UCHAR Reserved2:1;
1114         UCHAR LogicalUnitNumber:3;
1115         UCHAR PageCode:6;
1116         UCHAR Pc:2;
1117         UCHAR Reserved3[4];
1118         UCHAR AllocationLength[2];
1119         UCHAR Control;
1120     } MODE_SENSE10, *PMODE_SENSE10;
1121     struct _MODE_SELECT
1122     {
1123         UCHAR OperationCode;
1124         UCHAR SPBit:1;
1125         UCHAR Reserved1:3;
1126         UCHAR PFBit:1;
1127         UCHAR LogicalUnitNumber:3;
1128         UCHAR Reserved2[2];
1129         UCHAR ParameterListLength;
1130         UCHAR Control;
1131     } MODE_SELECT, *PMODE_SELECT;
1132     struct _MODE_SELECT10
1133     {
1134         UCHAR OperationCode;
1135         UCHAR SPBit:1;
1136         UCHAR Reserved1:3;
1137         UCHAR PFBit:1;
1138         UCHAR LogicalUnitNumber:3;
1139         UCHAR Reserved2[5];
1140         UCHAR ParameterListLength[2];
1141         UCHAR Control;
1142     } MODE_SELECT10, *PMODE_SELECT10;
1143     struct _LOCATE
1144     {
1145         UCHAR OperationCode;
1146         UCHAR Immediate:1;
1147         UCHAR CPBit:1;
1148         UCHAR BTBit:1;
1149         UCHAR Reserved1:2;
1150         UCHAR LogicalUnitNumber:3;
1151         UCHAR Reserved3;
1152         UCHAR LogicalBlockAddress[4];
1153         UCHAR Reserved4;
1154         UCHAR Partition;
1155         UCHAR Control;
1156     } LOCATE, *PLOCATE;
1157     struct _LOGSENSE
1158     {
1159         UCHAR OperationCode;
1160         UCHAR SPBit:1;
1161         UCHAR PPCBit:1;
1162         UCHAR Reserved1:3;
1163         UCHAR LogicalUnitNumber:3;
1164         UCHAR PageCode:6;
1165         UCHAR PCBit:2;
1166         UCHAR Reserved2;
1167         UCHAR Reserved3;
1168         UCHAR ParameterPointer[2];
1169         UCHAR AllocationLength[2];
1170         UCHAR Control;
1171     } LOGSENSE, *PLOGSENSE;
1172     struct _LOGSELECT
1173     {
1174         UCHAR OperationCode;
1175         UCHAR SPBit:1;
1176         UCHAR PCRBit:1;
1177         UCHAR Reserved1:3;
1178         UCHAR LogicalUnitNumber:3;
1179         UCHAR Reserved:6;
1180         UCHAR PCBit:2;
1181         UCHAR Reserved2[4];
1182         UCHAR ParameterListLength[2];
1183         UCHAR Control;
1184     } LOGSELECT, *PLOGSELECT;
1185     struct _PRINT
1186     {
1187         UCHAR OperationCode;
1188         UCHAR Reserved:5;
1189         UCHAR LogicalUnitNumber:3;
1190         UCHAR TransferLength[3];
1191         UCHAR Control;
1192     } PRINT, *PPRINT;
1193     struct _SEEK
1194     {
1195         UCHAR OperationCode;
1196         UCHAR Reserved1:5;
1197         UCHAR LogicalUnitNumber:3;
1198         UCHAR LogicalBlockAddress[4];
1199         UCHAR Reserved2[3];
1200         UCHAR Control;
1201     } SEEK, *PSEEK;
1202     struct _ERASE
1203     {
1204         UCHAR OperationCode;
1205         UCHAR Long:1;
1206         UCHAR Immediate:1;
1207         UCHAR Reserved1:3;
1208         UCHAR LogicalUnitNumber:3;
1209         UCHAR Reserved2[3];
1210         UCHAR Control;
1211     } ERASE, *PERASE;
1212     struct _START_STOP
1213     {
1214         UCHAR OperationCode;
1215         UCHAR Immediate:1;
1216         UCHAR Reserved1:4;
1217         UCHAR LogicalUnitNumber:3;
1218         UCHAR Reserved2[2];
1219         UCHAR Start:1;
1220         UCHAR LoadEject:1;
1221         UCHAR Reserved3:6;
1222         UCHAR Control;
1223     } START_STOP, *PSTART_STOP;
1224     struct _MEDIA_REMOVAL
1225     {
1226         UCHAR OperationCode;
1227         UCHAR Reserved1:5;
1228         UCHAR LogicalUnitNumber:3;
1229         UCHAR Reserved2[2];
1230         UCHAR Prevent:1;
1231         UCHAR Persistant:1;
1232         UCHAR Reserved3:6;
1233         UCHAR Control;
1234     } MEDIA_REMOVAL, *PMEDIA_REMOVAL;
1235     struct _SEEK_BLOCK
1236     {
1237         UCHAR OperationCode;
1238         UCHAR Immediate:1;
1239         UCHAR Reserved1:7;
1240         UCHAR BlockAddress[3];
1241         UCHAR Link:1;
1242         UCHAR Flag:1;
1243         UCHAR Reserved2:4;
1244         UCHAR VendorUnique:2;
1245     } SEEK_BLOCK, *PSEEK_BLOCK;
1246     struct _REQUEST_BLOCK_ADDRESS
1247     {
1248         UCHAR OperationCode;
1249         UCHAR Reserved1[3];
1250         UCHAR AllocationLength;
1251         UCHAR Link:1;
1252         UCHAR Flag:1;
1253         UCHAR Reserved2:4;
1254         UCHAR VendorUnique:2;
1255     } REQUEST_BLOCK_ADDRESS, *PREQUEST_BLOCK_ADDRESS;
1256     struct _PARTITION
1257     {
1258         UCHAR OperationCode;
1259         UCHAR Immediate:1;
1260         UCHAR Sel:1;
1261         UCHAR PartitionSelect:6;
1262         UCHAR Reserved1[3];
1263         UCHAR Control;
1264     } PARTITION, *PPARTITION;
1265     struct _WRITE_TAPE_MARKS
1266     {
1267         UCHAR OperationCode;
1268         UCHAR Immediate:1;
1269         UCHAR WriteSetMarks:1;
1270         UCHAR Reserved:3;
1271         UCHAR LogicalUnitNumber:3;
1272         UCHAR TransferLength[3];
1273         UCHAR Control;
1274     } WRITE_TAPE_MARKS, *PWRITE_TAPE_MARKS;
1275     struct _SPACE_TAPE_MARKS
1276     {
1277         UCHAR OperationCode;
1278         UCHAR Code:3;
1279         UCHAR Reserved:2;
1280         UCHAR LogicalUnitNumber:3;
1281         UCHAR NumMarksMSB;
1282         UCHAR NumMarks;
1283         UCHAR NumMarksLSB;
1284         union
1285         {
1286             UCHAR value;
1287             struct
1288             {
1289                 UCHAR Link:1;
1290                 UCHAR Flag:1;
1291                 UCHAR Reserved:4;
1292                 UCHAR VendorUnique:2;
1293             } Fields;
1294         } Byte6;
1295     } SPACE_TAPE_MARKS, *PSPACE_TAPE_MARKS;
1296     struct _READ_POSITION
1297     {
1298         UCHAR Operation;
1299         UCHAR BlockType:1;
1300         UCHAR Reserved1:4;
1301         UCHAR Lun:3;
1302         UCHAR Reserved2[7];
1303         UCHAR Control;
1304     } READ_POSITION, *PREAD_POSITION;
1305     struct _CDB6READWRITETAPE
1306     {
1307         UCHAR OperationCode;
1308         UCHAR VendorSpecific:5;
1309         UCHAR Reserved:3;
1310         UCHAR TransferLenMSB;
1311         UCHAR TransferLen;
1312         UCHAR TransferLenLSB;
1313         UCHAR Link:1;
1314         UCHAR Flag:1;
1315         UCHAR Reserved1:4;
1316         UCHAR VendorUnique:2;
1317     } CDB6READWRITETAPE, *PCDB6READWRITETAPE;
1318     struct _INIT_ELEMENT_STATUS
1319     {
1320         UCHAR OperationCode;
1321         UCHAR Reserved1:5;
1322         UCHAR LogicalUnitNubmer:3;
1323         UCHAR Reserved2[3];
1324         UCHAR Reserved3:7;
1325         UCHAR NoBarCode:1;
1326     } INIT_ELEMENT_STATUS, *PINIT_ELEMENT_STATUS;
1327     struct _INITIALIZE_ELEMENT_RANGE
1328     {
1329         UCHAR OperationCode;
1330         UCHAR Range:1;
1331         UCHAR Reserved1:4;
1332         UCHAR LogicalUnitNubmer:3;
1333         UCHAR FirstElementAddress[2];
1334         UCHAR Reserved2[2];
1335         UCHAR NumberOfElements[2];
1336         UCHAR Reserved3;
1337         UCHAR Reserved4:7;
1338         UCHAR NoBarCode:1;
1339     } INITIALIZE_ELEMENT_RANGE, *PINITIALIZE_ELEMENT_RANGE;
1340     struct _POSITION_TO_ELEMENT
1341     {
1342         UCHAR OperationCode;
1343         UCHAR Reserved1:5;
1344         UCHAR LogicalUnitNumber:3;
1345         UCHAR TransportElementAddress[2];
1346         UCHAR DestinationElementAddress[2];
1347         UCHAR Reserved2[2];
1348         UCHAR Flip:1;
1349         UCHAR Reserved3:7;
1350         UCHAR Control;
1351     } POSITION_TO_ELEMENT, *PPOSITION_TO_ELEMENT;
1352     struct _MOVE_MEDIUM
1353     {
1354         UCHAR OperationCode;
1355         UCHAR Reserved1:5;
1356         UCHAR LogicalUnitNumber:3;
1357         UCHAR TransportElementAddress[2];
1358         UCHAR SourceElementAddress[2];
1359         UCHAR DestinationElementAddress[2];
1360         UCHAR Reserved2[2];
1361         UCHAR Flip:1;
1362         UCHAR Reserved3:7;
1363         UCHAR Control;
1364     } MOVE_MEDIUM, *PMOVE_MEDIUM;
1365     struct _EXCHANGE_MEDIUM
1366     {
1367         UCHAR OperationCode;
1368         UCHAR Reserved1:5;
1369         UCHAR LogicalUnitNumber:3;
1370         UCHAR TransportElementAddress[2];
1371         UCHAR SourceElementAddress[2];
1372         UCHAR Destination1ElementAddress[2];
1373         UCHAR Destination2ElementAddress[2];
1374         UCHAR Flip1:1;
1375         UCHAR Flip2:1;
1376         UCHAR Reserved3:6;
1377         UCHAR Control;
1378     } EXCHANGE_MEDIUM, *PEXCHANGE_MEDIUM;
1379     struct _READ_ELEMENT_STATUS
1380     {
1381         UCHAR OperationCode;
1382         UCHAR ElementType:4;
1383         UCHAR VolTag:1;
1384         UCHAR LogicalUnitNumber:3;
1385         UCHAR StartingElementAddress[2];
1386         UCHAR NumberOfElements[2];
1387         UCHAR Reserved1;
1388         UCHAR AllocationLength[3];
1389         UCHAR Reserved2;
1390         UCHAR Control;
1391     } READ_ELEMENT_STATUS, *PREAD_ELEMENT_STATUS;
1392     struct _SEND_VOLUME_TAG
1393     {
1394         UCHAR OperationCode;
1395         UCHAR ElementType:4;
1396         UCHAR Reserved1:1;
1397         UCHAR LogicalUnitNumber:3;
1398         UCHAR StartingElementAddress[2];
1399         UCHAR Reserved2;
1400         UCHAR ActionCode:5;
1401         UCHAR Reserved3:3;
1402         UCHAR Reserved4[2];
1403         UCHAR ParameterListLength[2];
1404         UCHAR Reserved5;
1405         UCHAR Control;
1406     } SEND_VOLUME_TAG, *PSEND_VOLUME_TAG;
1407     struct _REQUEST_VOLUME_ELEMENT_ADDRESS
1408     {
1409         UCHAR OperationCode;
1410         UCHAR ElementType:4;
1411         UCHAR VolTag:1;
1412         UCHAR LogicalUnitNumber:3;
1413         UCHAR StartingElementAddress[2];
1414         UCHAR NumberElements[2];
1415         UCHAR Reserved1;
1416         UCHAR AllocationLength[3];
1417         UCHAR Reserved2;
1418         UCHAR Control;
1419     } REQUEST_VOLUME_ELEMENT_ADDRESS, *PREQUEST_VOLUME_ELEMENT_ADDRESS;
1420     struct _LOAD_UNLOAD
1421     {
1422         UCHAR OperationCode;
1423         UCHAR Immediate:1;
1424         UCHAR Reserved1:4;
1425         UCHAR Lun:3;
1426         UCHAR Reserved2[2];
1427         UCHAR Start:1;
1428         UCHAR LoadEject:1;
1429         UCHAR Reserved3:6;
1430         UCHAR Reserved4[3];
1431         UCHAR Slot;
1432         UCHAR Reserved5[3];
1433     } LOAD_UNLOAD, *PLOAD_UNLOAD;
1434     struct _MECH_STATUS
1435     {
1436         UCHAR OperationCode;
1437         UCHAR Reserved:5;
1438         UCHAR Lun:3;
1439         UCHAR Reserved1[6];
1440         UCHAR AllocationLength[2];
1441         UCHAR Reserved2[1];
1442         UCHAR Control;
1443     } MECH_STATUS, *PMECH_STATUS;
1444     struct _SYNCHRONIZE_CACHE10
1445     {
1446         UCHAR OperationCode;
1447         UCHAR RelAddr:1;
1448         UCHAR Immediate:1;
1449         UCHAR Reserved:3;
1450         UCHAR Lun:3;
1451         UCHAR LogicalBlockAddress[4];
1452         UCHAR Reserved2;
1453         UCHAR BlockCount[2];
1454         UCHAR Control;
1455     } SYNCHRONIZE_CACHE10, *PSYNCHRONIZE_CACHE10;
1456     struct _GET_EVENT_STATUS_NOTIFICATION
1457     {
1458         UCHAR OperationCode;
1459         UCHAR Immediate:1;
1460         UCHAR Reserved:4;
1461         UCHAR Lun:3;
1462         UCHAR Reserved2[2];
1463         UCHAR NotificationClassRequest;
1464         UCHAR Reserved3[2];
1465         UCHAR EventListLength[2];
1466         UCHAR Control;
1467     } GET_EVENT_STATUS_NOTIFICATION, *PGET_EVENT_STATUS_NOTIFICATION;
1468     struct _GET_PERFORMANCE
1469     {
1470         UCHAR OperationCode;
1471         UCHAR Except:2;
1472         UCHAR Write:1;
1473         UCHAR Tolerance:2;
1474         UCHAR Reserved0:3;
1475         UCHAR StartingLBA[4];
1476         UCHAR Reserved1[2];
1477         UCHAR MaximumNumberOfDescriptors[2];
1478         UCHAR Type;
1479         UCHAR Control;
1480     } GET_PERFORMANCE;
1481     struct _READ_DVD_STRUCTURE
1482     {
1483         UCHAR OperationCode;
1484         UCHAR Reserved1:5;
1485         UCHAR Lun:3;
1486         UCHAR RMDBlockNumber[4];
1487         UCHAR LayerNumber;
1488         UCHAR Format;
1489         UCHAR AllocationLength[2];
1490         UCHAR Reserved3:6;
1491         UCHAR AGID:2;
1492         UCHAR Control;
1493     } READ_DVD_STRUCTURE, *PREAD_DVD_STRUCTURE;
1494     struct _SET_STREAMING
1495     {
1496         UCHAR OperationCode;
1497         UCHAR Reserved[8];
1498         UCHAR ParameterListLength[2];
1499         UCHAR Control;
1500     } SET_STREAMING;
1501     struct _SEND_DVD_STRUCTURE
1502     {
1503         UCHAR OperationCode;
1504         UCHAR Reserved1:5;
1505         UCHAR Lun:3;
1506         UCHAR Reserved2[5];
1507         UCHAR Format;
1508         UCHAR ParameterListLength[2];
1509         UCHAR Reserved3;
1510         UCHAR Control;
1511     } SEND_DVD_STRUCTURE, *PSEND_DVD_STRUCTURE;
1512     struct _SEND_KEY
1513     {
1514         UCHAR OperationCode;
1515         UCHAR Reserved1:5;
1516         UCHAR Lun:3;
1517         UCHAR Reserved2[6];
1518         UCHAR ParameterListLength[2];
1519         UCHAR KeyFormat:6;
1520         UCHAR AGID:2;
1521         UCHAR Control;
1522     } SEND_KEY, *PSEND_KEY;
1523     struct _REPORT_KEY
1524     {
1525         UCHAR OperationCode;
1526         UCHAR Reserved1:5;
1527         UCHAR Lun:3;
1528         UCHAR LogicalBlockAddress[4];
1529         UCHAR Reserved2[2];
1530         UCHAR AllocationLength[2];
1531         UCHAR KeyFormat:6;
1532         UCHAR AGID:2;
1533         UCHAR Control;
1534     } REPORT_KEY, *PREPORT_KEY;
1535     struct _SET_READ_AHEAD
1536     {
1537         UCHAR OperationCode;
1538         UCHAR Reserved1:5;
1539         UCHAR Lun:3;
1540         UCHAR TriggerLBA[4];
1541         UCHAR ReadAheadLBA[4];
1542         UCHAR Reserved2;
1543         UCHAR Control;
1544     } SET_READ_AHEAD, *PSET_READ_AHEAD;
1545     struct _READ_FORMATTED_CAPACITIES
1546     {
1547         UCHAR OperationCode;
1548         UCHAR Reserved1:5;
1549         UCHAR Lun:3;
1550         UCHAR Reserved2[5];
1551         UCHAR AllocationLength[2];
1552         UCHAR Control;
1553     } READ_FORMATTED_CAPACITIES, *PREAD_FORMATTED_CAPACITIES;
1554     struct _REPORT_LUNS
1555     {
1556         UCHAR OperationCode;
1557         UCHAR Reserved1[5];
1558         UCHAR AllocationLength[4];
1559         UCHAR Reserved2[1];
1560         UCHAR Control;
1561     } REPORT_LUNS, *PREPORT_LUNS;
1562     struct _PERSISTENT_RESERVE_IN
1563     {
1564         UCHAR OperationCode;
1565         UCHAR ServiceAction:5;
1566         UCHAR Reserved1:3;
1567         UCHAR Reserved2[5];
1568         UCHAR AllocationLength[2];
1569         UCHAR Control;
1570     } PERSISTENT_RESERVE_IN, *PPERSISTENT_RESERVE_IN;
1571     struct _PERSISTENT_RESERVE_OUT
1572     {
1573         UCHAR OperationCode;
1574         UCHAR ServiceAction:5;
1575         UCHAR Reserved1:3;
1576         UCHAR Type:4;
1577         UCHAR Scope:4;
1578         UCHAR Reserved2[4];
1579         UCHAR ParameterListLength[2];
1580         UCHAR Control;
1581     } PERSISTENT_RESERVE_OUT, *PPERSISTENT_RESERVE_OUT;
1582     struct _GET_CONFIGURATION
1583     {
1584         UCHAR OperationCode;
1585         UCHAR RequestType:1;
1586         UCHAR Reserved1:7;
1587         UCHAR StartingFeature[2];
1588         UCHAR Reserved2[3];
1589         UCHAR AllocationLength[2];
1590         UCHAR Control;
1591     } GET_CONFIGURATION, *PGET_CONFIGURATION;
1592     struct _SET_CD_SPEED
1593     {
1594         UCHAR OperationCode;
1595         _ANONYMOUS_UNION union
1596         {
1597             UCHAR Reserved1;
1598             _ANONYMOUS_STRUCT struct
1599             {
1600                 UCHAR RotationControl:2;
1601                 UCHAR Reserved3:6;
1602             } DUMMYSTRUCTNAME;
1603         } DUMMYUNIONNAME;
1604         UCHAR ReadSpeed[2];
1605         UCHAR WriteSpeed[2];
1606         UCHAR Reserved2[5];
1607         UCHAR Control;
1608     } SET_CD_SPEED, *PSET_CD_SPEED;
1609     struct _READ12
1610     {
1611         UCHAR OperationCode;
1612         UCHAR RelativeAddress:1;
1613         UCHAR Reserved1:2;
1614         UCHAR ForceUnitAccess:1;
1615         UCHAR DisablePageOut:1;
1616         UCHAR LogicalUnitNumber:3;
1617         UCHAR LogicalBlock[4];
1618         UCHAR TransferLength[4];
1619         UCHAR Reserved2:7;
1620         UCHAR Streaming:1;
1621         UCHAR Control;
1622     } READ12;
1623     struct _WRITE12
1624     {
1625         UCHAR OperationCode;
1626         UCHAR RelativeAddress:1;
1627         UCHAR Reserved1:1;
1628         UCHAR EBP:1;
1629         UCHAR ForceUnitAccess:1;
1630         UCHAR DisablePageOut:1;
1631         UCHAR LogicalUnitNumber:3;
1632         UCHAR LogicalBlock[4];
1633         UCHAR TransferLength[4];
1634         UCHAR Reserved2:7;
1635         UCHAR Streaming:1;
1636         UCHAR Control;
1637     } WRITE12;
1638     struct _READ16
1639     {
1640         UCHAR OperationCode;
1641         UCHAR Reserved1:3;
1642         UCHAR ForceUnitAccess:1;
1643         UCHAR DisablePageOut:1;
1644         UCHAR ReadProtect:3;
1645         UCHAR LogicalBlock[8];
1646         UCHAR TransferLength[4];
1647         UCHAR Reserved2:7;
1648         UCHAR Streaming:1;
1649         UCHAR Control;
1650     } READ16;
1651     struct _WRITE16
1652     {
1653         UCHAR OperationCode;
1654         UCHAR Reserved1:3;
1655         UCHAR ForceUnitAccess:1;
1656         UCHAR DisablePageOut:1;
1657         UCHAR WriteProtect:3;
1658         UCHAR LogicalBlock[8];
1659         UCHAR TransferLength[4];
1660         UCHAR Reserved2:7;
1661         UCHAR Streaming:1;
1662         UCHAR Control;
1663     } WRITE16;
1664     struct _VERIFY16
1665     {
1666         UCHAR OperationCode;
1667         UCHAR Reserved1:1;
1668         UCHAR ByteCheck:1;
1669         UCHAR BlockVerify:1;
1670         UCHAR Reserved2: 1;
1671         UCHAR DisablePageOut:1;
1672         UCHAR VerifyProtect:3;
1673         UCHAR LogicalBlock[8];
1674         UCHAR VerificationLength[4];
1675         UCHAR Reserved3:7;
1676         UCHAR Streaming:1;
1677         UCHAR Control;
1678     } VERIFY16;
1679     struct _SYNCHRONIZE_CACHE16
1680     {
1681         UCHAR OperationCode;
1682         UCHAR Reserved1:1;
1683         UCHAR Immediate:1;
1684         UCHAR Reserved2:6;
1685         UCHAR LogicalBlock[8];
1686         UCHAR BlockCount[4];
1687         UCHAR Reserved3;
1688         UCHAR Control;
1689     } SYNCHRONIZE_CACHE16;
1690     struct _READ_CAPACITY16
1691     {
1692         UCHAR OperationCode;
1693         UCHAR ServiceAction:5;
1694         UCHAR Reserved1:3;
1695         UCHAR LogicalBlock[8];
1696         UCHAR BlockCount[4];
1697         UCHAR PMI:1;
1698         UCHAR Reserved2:7;
1699         UCHAR Control;
1700     } READ_CAPACITY16;
1701     ULONG AsUlong[4];
1702     UCHAR AsByte[16];
1703 } CDB, *PCDB;
1704 
1705 typedef union _EIGHT_BYTE
1706 {
1707     struct
1708     {
1709         UCHAR Byte0;
1710         UCHAR Byte1;
1711         UCHAR Byte2;
1712         UCHAR Byte3;
1713         UCHAR Byte4;
1714         UCHAR Byte5;
1715         UCHAR Byte6;
1716         UCHAR Byte7;
1717     };
1718     ULONGLONG AsULongLong;
1719 } EIGHT_BYTE, *PEIGHT_BYTE;
1720 
1721 typedef union _FOUR_BYTE
1722 {
1723     struct
1724     {
1725         UCHAR Byte0;
1726         UCHAR Byte1;
1727         UCHAR Byte2;
1728         UCHAR Byte3;
1729     };
1730     ULONG AsULong;
1731 } FOUR_BYTE, *PFOUR_BYTE;
1732 
1733 typedef union _TWO_BYTE
1734 {
1735     struct
1736     {
1737         UCHAR Byte0;
1738         UCHAR Byte1;
1739     };
1740     USHORT AsUShort;
1741 } TWO_BYTE, *PTWO_BYTE;
1742 #include <poppack.h>
1743 
1744 #if (NTDDI_VERSION < NTDDI_WINXP)
1745 typedef struct _INQUIRYDATA
1746 {
1747     UCHAR DeviceType:5;
1748     UCHAR DeviceTypeQualifier:3;
1749     UCHAR DeviceTypeModifier:7;
1750     UCHAR RemovableMedia:1;
1751     UCHAR Versions;
1752     UCHAR ResponseDataFormat:4;
1753     UCHAR HiSupport:1;
1754     UCHAR NormACA:1;
1755     UCHAR ReservedBit:1;
1756     UCHAR AERC:1;
1757     UCHAR AdditionalLength;
1758     UCHAR Reserved[2];
1759     UCHAR SoftReset:1;
1760     UCHAR CommandQueue:1;
1761     UCHAR Reserved2:1;
1762     UCHAR LinkedCommands:1;
1763     UCHAR Synchronous:1;
1764     UCHAR Wide16Bit:1;
1765     UCHAR Wide32Bit:1;
1766     UCHAR RelativeAddressing:1;
1767     UCHAR VendorId[8];
1768     UCHAR ProductId[16];
1769     UCHAR ProductRevisionLevel[4];
1770     UCHAR VendorSpecific[20];
1771     UCHAR Reserved3[40];
1772 } INQUIRYDATA, *PINQUIRYDATA;
1773 #else
1774 #include <pshpack1.h>
1775 typedef struct _INQUIRYDATA
1776 {
1777     UCHAR DeviceType:5;
1778     UCHAR DeviceTypeQualifier:3;
1779     UCHAR DeviceTypeModifier:7;
1780     UCHAR RemovableMedia:1;
1781     union
1782     {
1783         UCHAR Versions;
1784         struct
1785         {
1786             UCHAR ANSIVersion:3;
1787             UCHAR ECMAVersion:3;
1788             UCHAR ISOVersion:2;
1789         };
1790     };
1791     UCHAR ResponseDataFormat:4;
1792     UCHAR HiSupport:1;
1793     UCHAR NormACA:1;
1794     UCHAR TerminateTask:1;
1795     UCHAR AERC:1;
1796     UCHAR AdditionalLength;
1797     UCHAR Reserved;
1798     UCHAR Addr16:1;
1799     UCHAR Addr32:1;
1800     UCHAR AckReqQ:1;
1801     UCHAR MediumChanger:1;
1802     UCHAR MultiPort:1;
1803     UCHAR ReservedBit2:1;
1804     UCHAR EnclosureServices:1;
1805     UCHAR ReservedBit3:1;
1806     UCHAR SoftReset:1;
1807     UCHAR CommandQueue:1;
1808     UCHAR TransferDisable:1;
1809     UCHAR LinkedCommands:1;
1810     UCHAR Synchronous:1;
1811     UCHAR Wide16Bit:1;
1812     UCHAR Wide32Bit:1;
1813     UCHAR RelativeAddressing:1;
1814     UCHAR VendorId[8];
1815     UCHAR ProductId[16];
1816     UCHAR ProductRevisionLevel[4];
1817     UCHAR VendorSpecific[20];
1818     UCHAR Reserved3[40];
1819 } INQUIRYDATA, *PINQUIRYDATA;
1820 #include <poppack.h>
1821 #endif
1822 
1823 typedef struct _VPD_MEDIA_SERIAL_NUMBER_PAGE
1824 {
1825     UCHAR DeviceType:5;
1826     UCHAR DeviceTypeQualifier:3;
1827     UCHAR PageCode;
1828     UCHAR Reserved;
1829     UCHAR PageLength;
1830     UCHAR SerialNumber[0];
1831 } VPD_MEDIA_SERIAL_NUMBER_PAGE, *PVPD_MEDIA_SERIAL_NUMBER_PAGE;
1832 
1833 typedef struct _VPD_SERIAL_NUMBER_PAGE
1834 {
1835     UCHAR DeviceType:5;
1836     UCHAR DeviceTypeQualifier:3;
1837     UCHAR PageCode;
1838     UCHAR Reserved;
1839     UCHAR PageLength;
1840     UCHAR SerialNumber[0];
1841 } VPD_SERIAL_NUMBER_PAGE, *PVPD_SERIAL_NUMBER_PAGE;
1842 
1843 typedef struct _VPD_IDENTIFICATION_DESCRIPTOR
1844 {
1845     UCHAR CodeSet:4;
1846     UCHAR Reserved:4;
1847     UCHAR IdentifierType:4;
1848     UCHAR Association:2;
1849     UCHAR Reserved2:2;
1850     UCHAR Reserved3;
1851     UCHAR IdentifierLength;
1852     UCHAR Identifier[0];
1853 } VPD_IDENTIFICATION_DESCRIPTOR, *PVPD_IDENTIFICATION_DESCRIPTOR;
1854 
1855 typedef struct _VPD_IDENTIFICATION_PAGE
1856 {
1857     UCHAR DeviceType:5;
1858     UCHAR DeviceTypeQualifier:3;
1859     UCHAR PageCode;
1860     UCHAR Reserved;
1861     UCHAR PageLength;
1862     UCHAR Descriptors[0];
1863 } VPD_IDENTIFICATION_PAGE, *PVPD_IDENTIFICATION_PAGE;
1864 
1865 typedef struct _VPD_SUPPORTED_PAGES_PAGE
1866 {
1867     UCHAR DeviceType:5;
1868     UCHAR DeviceTypeQualifier:3;
1869     UCHAR PageCode;
1870     UCHAR Reserved;
1871     UCHAR PageLength;
1872     UCHAR SupportedPageList[0];
1873 } VPD_SUPPORTED_PAGES_PAGE, *PVPD_SUPPORTED_PAGES_PAGE;
1874 
1875 #include <pshpack1.h>
1876 typedef struct _READ_CAPACITY_DATA
1877 {
1878     ULONG LogicalBlockAddress;
1879     ULONG BytesPerBlock;
1880 } READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;
1881 
1882 typedef struct _READ_CAPACITY_DATA_EX
1883 {
1884     LARGE_INTEGER LogicalBlockAddress;
1885     ULONG BytesPerBlock;
1886 } READ_CAPACITY_DATA_EX, *PREAD_CAPACITY_DATA_EX;
1887 
1888 typedef struct _MODE_PARAMETER_HEADER
1889 {
1890     UCHAR ModeDataLength;
1891     UCHAR MediumType;
1892     UCHAR DeviceSpecificParameter;
1893     UCHAR BlockDescriptorLength;
1894 }MODE_PARAMETER_HEADER, *PMODE_PARAMETER_HEADER;
1895 
1896 typedef struct _MODE_PARAMETER_HEADER10
1897 {
1898     UCHAR ModeDataLength[2];
1899     UCHAR MediumType;
1900     UCHAR DeviceSpecificParameter;
1901     UCHAR Reserved[2];
1902     UCHAR BlockDescriptorLength[2];
1903 }MODE_PARAMETER_HEADER10, *PMODE_PARAMETER_HEADER10;
1904 
1905 typedef struct _MODE_PARAMETER_BLOCK
1906 {
1907     UCHAR DensityCode;
1908     UCHAR NumberOfBlocks[3];
1909     UCHAR Reserved;
1910     UCHAR BlockLength[3];
1911 }MODE_PARAMETER_BLOCK, *PMODE_PARAMETER_BLOCK;
1912 
1913 typedef struct _LUN_LIST
1914 {
1915     UCHAR LunListLength[4];
1916     UCHAR Reserved[4];
1917 #if !defined(__midl)
1918     UCHAR Lun[0][8];
1919 #endif
1920 } LUN_LIST, *PLUN_LIST;
1921 #include <poppack.h>
1922 
1923 typedef PHYSICAL_ADDRESS STOR_PHYSICAL_ADDRESS;
1924 
1925 typedef struct _ACCESS_RANGE
1926 {
1927     STOR_PHYSICAL_ADDRESS RangeStart;
1928     ULONG RangeLength;
1929     BOOLEAN RangeInMemory;
1930 } ACCESS_RANGE, *PACCESS_RANGE;
1931 
1932 typedef struct _MEMORY_REGION
1933 {
1934     PUCHAR VirtualBase;
1935     PHYSICAL_ADDRESS PhysicalBase;
1936     ULONG Length;
1937 } MEMORY_REGION, *PMEMORY_REGION;
1938 
1939 typedef struct _PORT_CONFIGURATION_INFORMATION
1940 {
1941     ULONG Length;
1942     ULONG SystemIoBusNumber;
1943     INTERFACE_TYPE  AdapterInterfaceType;
1944     ULONG BusInterruptLevel;
1945     ULONG BusInterruptVector;
1946     KINTERRUPT_MODE InterruptMode;
1947     ULONG MaximumTransferLength;
1948     ULONG NumberOfPhysicalBreaks;
1949     ULONG DmaChannel;
1950     ULONG DmaPort;
1951     DMA_WIDTH DmaWidth;
1952     DMA_SPEED DmaSpeed;
1953     ULONG AlignmentMask;
1954     ULONG NumberOfAccessRanges;
1955     ACCESS_RANGE (*AccessRanges)[];
1956     PVOID Reserved;
1957     UCHAR NumberOfBuses;
1958     CCHAR InitiatorBusId[8];
1959     BOOLEAN ScatterGather;
1960     BOOLEAN Master;
1961     BOOLEAN CachesData;
1962     BOOLEAN AdapterScansDown;
1963     BOOLEAN AtdiskPrimaryClaimed;
1964     BOOLEAN AtdiskSecondaryClaimed;
1965     BOOLEAN Dma32BitAddresses;
1966     BOOLEAN DemandMode;
1967     UCHAR MapBuffers;
1968     BOOLEAN NeedPhysicalAddresses;
1969     BOOLEAN TaggedQueuing;
1970     BOOLEAN AutoRequestSense;
1971     BOOLEAN MultipleRequestPerLu;
1972     BOOLEAN ReceiveEvent;
1973     BOOLEAN RealModeInitialized;
1974     BOOLEAN BufferAccessScsiPortControlled;
1975     UCHAR MaximumNumberOfTargets;
1976     UCHAR ReservedUchars[2];
1977     ULONG SlotNumber;
1978     ULONG BusInterruptLevel2;
1979     ULONG BusInterruptVector2;
1980     KINTERRUPT_MODE InterruptMode2;
1981     ULONG DmaChannel2;
1982     ULONG DmaPort2;
1983     DMA_WIDTH DmaWidth2;
1984     DMA_SPEED DmaSpeed2;
1985     ULONG DeviceExtensionSize;
1986     ULONG SpecificLuExtensionSize;
1987     ULONG SrbExtensionSize;
1988     UCHAR  Dma64BitAddresses;
1989     BOOLEAN ResetTargetSupported;
1990     UCHAR MaximumNumberOfLogicalUnits;
1991     BOOLEAN WmiDataProvider;
1992     STOR_SYNCHRONIZATION_MODEL SynchronizationModel;
1993 } PORT_CONFIGURATION_INFORMATION, *PPORT_CONFIGURATION_INFORMATION;
1994 
1995 typedef struct _STOR_SCATTER_GATHER_ELEMENT
1996 {
1997     STOR_PHYSICAL_ADDRESS PhysicalAddress;
1998     ULONG Length;
1999     ULONG_PTR Reserved;
2000 } STOR_SCATTER_GATHER_ELEMENT, *PSTOR_SCATTER_GATHER_ELEMENT;
2001 
2002 typedef struct _STOR_SCATTER_GATHER_LIST
2003 {
2004     ULONG NumberOfElements;
2005     ULONG_PTR Reserved;
2006     STOR_SCATTER_GATHER_ELEMENT List[];
2007 } STOR_SCATTER_GATHER_LIST, *PSTOR_SCATTER_GATHER_LIST;
2008 
2009 typedef struct _DPC_BUFFER
2010 {
2011     CSHORT Type;
2012     UCHAR Number;
2013     UCHAR Importance;
2014     struct
2015     {
2016         PVOID F;
2017         PVOID B;
2018     };
2019     PVOID DeferredRoutine;
2020     PVOID DeferredContext;
2021     PVOID SystemArgument1;
2022     PVOID SystemArgument2;
2023     PVOID DpcData;
2024 } DPC_BUFFER;
2025 
2026 typedef struct _STOR_DPC
2027 {
2028     DPC_BUFFER Dpc;
2029     ULONG_PTR Lock;
2030 } STOR_DPC, *PSTOR_DPC;
2031 
2032 typedef struct _STOR_LOCK_HANDLE
2033 {
2034     STOR_SPINLOCK Lock;
2035     struct
2036     {
2037         struct
2038         {
2039             PVOID Next;
2040             PVOID Lock;
2041         } LockQueue;
2042         KIRQL OldIrql;
2043     } Context;
2044 } STOR_LOCK_HANDLE, *PSTOR_LOCK_HANDLE;
2045 
2046 typedef struct _STOR_LOG_EVENT_DETAILS
2047 {
2048     ULONG InterfaceRevision;
2049     ULONG Size;
2050     ULONG Flags;
2051     STOR_EVENT_ASSOCIATION_ENUM EventAssociation;
2052     ULONG PathId;
2053     ULONG TargetId;
2054     ULONG LunId;
2055     BOOLEAN StorportSpecificErrorCode;
2056     ULONG ErrorCode;
2057     ULONG UniqueId;
2058     ULONG DumpDataSize;
2059     PVOID DumpData;
2060     ULONG StringCount;
2061     PWSTR *StringList;
2062 } STOR_LOG_EVENT_DETAILS, *PSTOR_LOG_EVENT_DETAILS;
2063 
2064 typedef struct _PERF_CONFIGURATION_DATA
2065 {
2066     ULONG Version;
2067     ULONG Size;
2068     ULONG Flags;
2069     ULONG ConcurrentChannels;
2070     ULONG FirstRedirectionMessageNumber, LastRedirectionMessageNumber;
2071     ULONG DeviceNode;
2072     ULONG Reserved;
2073     PGROUP_AFFINITY MessageTargets;
2074 } PERF_CONFIGURATION_DATA, *PPERF_CONFIGURATION_DATA;
2075 
2076 typedef struct _STARTIO_PERFORMANCE_PARAMETERS
2077 {
2078     ULONG Version;
2079     ULONG Size;
2080     ULONG MessageNumber;
2081     ULONG ChannelNumber;
2082 } STARTIO_PERFORMANCE_PARAMETERS, *PSTARTIO_PERFORMANCE_PARAMETERS;
2083 
2084 typedef struct _MESSAGE_INTERRUPT_INFORMATION
2085 {
2086     ULONG MessageId;
2087     ULONG MessageData;
2088     STOR_PHYSICAL_ADDRESS MessageAddress;
2089     ULONG InterruptVector;
2090     ULONG InterruptLevel;
2091     KINTERRUPT_MODE InterruptMode;
2092 } MESSAGE_INTERRUPT_INFORMATION, *PMESSAGE_INTERRUPT_INFORMATION;
2093 
2094 typedef
2095 BOOLEAN
2096 (NTAPI *PHW_INITIALIZE)(
2097     _In_ PVOID DeviceExtension);
2098 
2099 typedef
2100 BOOLEAN
2101 (NTAPI *PHW_BUILDIO)(
2102     _In_ PVOID DeviceExtension,
2103     _In_ PSCSI_REQUEST_BLOCK Srb);
2104 
2105 typedef
2106 BOOLEAN
2107 (NTAPI *PHW_STARTIO)(
2108     _In_ PVOID DeviceExtension,
2109     _In_ PSCSI_REQUEST_BLOCK Srb);
2110 
2111 typedef
2112 BOOLEAN
2113 (NTAPI *PHW_INTERRUPT)(
2114     _In_ PVOID DeviceExtension);
2115 
2116 typedef
2117 VOID
2118 (NTAPI *PHW_TIMER)(
2119     _In_ PVOID DeviceExtension);
2120 
2121 typedef
2122 VOID
2123 (NTAPI *PHW_DMA_STARTED)(
2124     _In_ PVOID DeviceExtension);
2125 
2126 typedef
2127 ULONG
2128 (NTAPI *PHW_FIND_ADAPTER)(
2129     IN PVOID DeviceExtension,
2130     IN PVOID HwContext,
2131     IN PVOID BusInformation,
2132     IN PCHAR ArgumentString,
2133     IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo,
2134     OUT PBOOLEAN Again);
2135 
2136 typedef
2137 BOOLEAN
2138 (NTAPI *PHW_RESET_BUS)(
2139     IN PVOID DeviceExtension,
2140     IN ULONG PathId);
2141 
2142 typedef
2143 BOOLEAN
2144 (NTAPI *PHW_ADAPTER_STATE)(
2145     IN PVOID DeviceExtension,
2146     IN PVOID Context,
2147     IN BOOLEAN SaveState);
2148 
2149 typedef
2150 SCSI_ADAPTER_CONTROL_STATUS
2151 (NTAPI *PHW_ADAPTER_CONTROL)(
2152     IN PVOID DeviceExtension,
2153     IN SCSI_ADAPTER_CONTROL_TYPE ControlType,
2154     IN PVOID Parameters);
2155 
2156 typedef
2157 BOOLEAN
2158 (*PHW_PASSIVE_INITIALIZE_ROUTINE)(
2159     _In_ PVOID DeviceExtension);
2160 
2161 typedef
2162 VOID
2163 (*PHW_DPC_ROUTINE)(
2164     _In_ PSTOR_DPC Dpc,
2165     _In_ PVOID HwDeviceExtension,
2166     _In_ PVOID SystemArgument1,
2167     _In_ PVOID SystemArgument2);
2168 
2169 typedef
2170 BOOLEAN
2171 (NTAPI STOR_SYNCHRONIZED_ACCESS)(
2172     _In_ PVOID HwDeviceExtension,
2173     _In_ PVOID Context);
2174 
2175 typedef STOR_SYNCHRONIZED_ACCESS *PSTOR_SYNCHRONIZED_ACCESS;
2176 
2177 typedef
2178 VOID
2179 (NTAPI *PpostScaterGatherExecute)(
2180     _In_ PVOID *DeviceObject,
2181     _In_ PVOID *Irp,
2182     _In_ PSTOR_SCATTER_GATHER_LIST ScatterGather,
2183     _In_ PVOID Context);
2184 
2185 typedef struct _HW_INITIALIZATION_DATA
2186 {
2187     ULONG HwInitializationDataSize;
2188     INTERFACE_TYPE  AdapterInterfaceType;
2189     PHW_INITIALIZE HwInitialize;
2190     PHW_STARTIO HwStartIo;
2191     PHW_INTERRUPT HwInterrupt;
2192     PHW_FIND_ADAPTER HwFindAdapter;
2193     PHW_RESET_BUS HwResetBus;
2194     PHW_DMA_STARTED HwDmaStarted;
2195     PHW_ADAPTER_STATE HwAdapterState;
2196     ULONG DeviceExtensionSize;
2197     ULONG SpecificLuExtensionSize;
2198     ULONG SrbExtensionSize;
2199     ULONG NumberOfAccessRanges;
2200     PVOID Reserved;
2201     UCHAR MapBuffers;
2202     BOOLEAN NeedPhysicalAddresses;
2203     BOOLEAN TaggedQueuing;
2204     BOOLEAN AutoRequestSense;
2205     BOOLEAN MultipleRequestPerLu;
2206     BOOLEAN ReceiveEvent;
2207     USHORT VendorIdLength;
2208     PVOID VendorId;
2209     USHORT ReservedUshort;
2210     USHORT DeviceIdLength;
2211     PVOID DeviceId;
2212     PHW_ADAPTER_CONTROL HwAdapterControl;
2213     PHW_BUILDIO HwBuildIo;
2214 } HW_INITIALIZATION_DATA, *PHW_INITIALIZATION_DATA;
2215 
2216 
2217 
2218 #define REVERSE_BYTES_QUAD(Destination, Source) { \
2219     PEIGHT_BYTE d = (PEIGHT_BYTE)(Destination); \
2220     PEIGHT_BYTE s = (PEIGHT_BYTE)(Source); \
2221     d->Byte7 = s->Byte0; \
2222     d->Byte6 = s->Byte1; \
2223     d->Byte5 = s->Byte2; \
2224     d->Byte4 = s->Byte3; \
2225     d->Byte3 = s->Byte4; \
2226     d->Byte2 = s->Byte5; \
2227     d->Byte1 = s->Byte6; \
2228     d->Byte0 = s->Byte7; \
2229 }
2230 
2231 #define REVERSE_BYTES(Destination, Source) { \
2232     PFOUR_BYTE d = (PFOUR_BYTE)(Destination); \
2233     PFOUR_BYTE s = (PFOUR_BYTE)(Source); \
2234     d->Byte3 = s->Byte0; \
2235     d->Byte2 = s->Byte1; \
2236     d->Byte1 = s->Byte2; \
2237     d->Byte0 = s->Byte3; \
2238 }
2239 
2240 #define REVERSE_BYTES_SHORT(Destination, Source) { \
2241     PTWO_BYTE d = (PTWO_BYTE)(Destination); \
2242     PTWO_BYTE s = (PTWO_BYTE)(Source); \
2243     d->Byte1 = s->Byte0; \
2244     d->Byte0 = s->Byte1; \
2245 }
2246 
2247 #define StorPortCopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length))
2248 
2249 STORPORT_API
2250 PUCHAR
2251 NTAPI
2252 StorPortAllocateRegistryBuffer(
2253     _In_ PVOID HwDeviceExtension,
2254     _In_ PULONG Length);
2255 
2256 STORPORT_API
2257 BOOLEAN
2258 NTAPI
2259 StorPortBusy(
2260   _In_ PVOID HwDeviceExtension,
2261   _In_ ULONG RequestsToComplete);
2262 
2263 STORPORT_API
2264 VOID
2265 NTAPI
2266 StorPortCompleteRequest(
2267     _In_ PVOID HwDeviceExtension,
2268     _In_ UCHAR PathId,
2269     _In_ UCHAR TargetId,
2270     _In_ UCHAR Lun,
2271     _In_ UCHAR SrbStatus);
2272 
2273 STORPORT_API
2274 ULONG64
2275 NTAPI
2276 StorPortConvertPhysicalAddressToUlong64(
2277     _In_ STOR_PHYSICAL_ADDRESS Address);
2278 
2279 STORPORT_API
2280 STOR_PHYSICAL_ADDRESS
2281 NTAPI
2282 StorPortConvertUlong64ToPhysicalAddress(
2283     _In_ ULONG64 UlongAddress);
2284 
2285 STORPORT_API
2286 VOID
2287 __cdecl
2288 StorPortDebugPrint(
2289     _In_ ULONG DebugPrintLevel,
2290     _In_ PCCHAR DebugMessage,
2291     ...);
2292 
2293 STORPORT_API
2294 BOOLEAN
2295 NTAPI
2296 StorPortDeviceBusy(
2297     _In_ PVOID HwDeviceExtension,
2298     _In_ UCHAR PathId,
2299     _In_ UCHAR TargetId,
2300     _In_ UCHAR Lun,
2301     _In_ ULONG RequestsToComplete);
2302 
2303 STORPORT_API
2304 BOOLEAN
2305 NTAPI
2306 StorPortDeviceReady(
2307     _In_ PVOID HwDeviceExtension,
2308     _In_ UCHAR PathId,
2309     _In_ UCHAR TargetId,
2310     _In_ UCHAR Lun);
2311 
2312 STORPORT_API
2313 VOID
2314 NTAPI
2315 StorPortFreeDeviceBase(
2316     _In_ PVOID HwDeviceExtension,
2317     _In_ PVOID MappedAddress);
2318 
2319 STORPORT_API
2320 VOID
2321 NTAPI
2322 StorPortFreeRegistryBuffer(
2323     _In_ PVOID HwDeviceExtension,
2324     _In_ PUCHAR Buffer);
2325 
2326 STORPORT_API
2327 ULONG
2328 NTAPI
2329 StorPortGetBusData(
2330     _In_ PVOID DeviceExtension,
2331     _In_ ULONG BusDataType,
2332     _In_ ULONG SystemIoBusNumber,
2333     _In_ ULONG SlotNumber,
2334     _Out_ _When_(Length != 0, _Out_writes_bytes_(Length)) PVOID Buffer,
2335     _In_ ULONG Length);
2336 
2337 STORPORT_API
2338 PVOID
2339 NTAPI
2340 StorPortGetDeviceBase(
2341     _In_ PVOID HwDeviceExtension,
2342     _In_ INTERFACE_TYPE BusType,
2343     _In_ ULONG SystemIoBusNumber,
2344     _In_ STOR_PHYSICAL_ADDRESS IoAddress,
2345     _In_ ULONG NumberOfBytes,
2346     _In_ BOOLEAN InIoSpace);
2347 
2348 STORPORT_API
2349 PVOID
2350 NTAPI
2351 StorPortGetLogicalUnit(
2352     _In_ PVOID HwDeviceExtension,
2353     _In_ UCHAR PathId,
2354     _In_ UCHAR TargetId,
2355     _In_ UCHAR Lun);
2356 
2357 STORPORT_API
2358 STOR_PHYSICAL_ADDRESS
2359 NTAPI
2360 StorPortGetPhysicalAddress(
2361     _In_ PVOID HwDeviceExtension,
2362     _In_opt_ PSCSI_REQUEST_BLOCK Srb,
2363     _In_ PVOID VirtualAddress,
2364     _Out_ ULONG *Length);
2365 
2366 STORPORT_API
2367 PSTOR_SCATTER_GATHER_LIST
2368 NTAPI
2369 StorPortGetScatterGatherList(
2370     _In_ PVOID DeviceExtension,
2371     _In_ PSCSI_REQUEST_BLOCK Srb);
2372 
2373 STORPORT_API
2374 PSCSI_REQUEST_BLOCK
2375 NTAPI
2376 StorPortGetSrb(
2377     _In_ PVOID DeviceExtension,
2378     _In_ UCHAR PathId,
2379     _In_ UCHAR TargetId,
2380     _In_ UCHAR Lun,
2381     _In_ LONG QueueTag);
2382 
2383 STORPORT_API
2384 PVOID
2385 NTAPI
2386 StorPortGetUncachedExtension(
2387     _In_ PVOID HwDeviceExtension,
2388     _In_ PPORT_CONFIGURATION_INFORMATION ConfigInfo,
2389     _In_ ULONG NumberOfBytes);
2390 
2391 STORPORT_API
2392 PVOID
2393 NTAPI
2394 StorPortGetVirtualAddress(
2395     _In_ PVOID HwDeviceExtension,
2396     _In_ STOR_PHYSICAL_ADDRESS PhysicalAddress);
2397 
2398 STORPORT_API
2399 ULONG
2400 NTAPI
2401 StorPortInitialize(
2402     _In_ PVOID Argument1,
2403     _In_ PVOID Argument2,
2404     _In_ PHW_INITIALIZATION_DATA HwInitializationData,
2405     _In_opt_ PVOID Unused);
2406 
2407 STORPORT_API
2408 VOID
2409 NTAPI
2410 StorPortLogError(
2411     _In_ PVOID HwDeviceExtension,
2412     _In_opt_ PSCSI_REQUEST_BLOCK Srb,
2413     _In_ UCHAR PathId,
2414     _In_ UCHAR TargetId,
2415     _In_ UCHAR Lun,
2416     _In_ ULONG ErrorCode,
2417     _In_ ULONG UniqueId);
2418 
2419 STORPORT_API
2420 VOID
2421 NTAPI
2422 StorPortMoveMemory(
2423     _Out_writes_bytes_(Length) PVOID WriteBuffer,
2424     _In_reads_bytes_(Length) PVOID ReadBuffer,
2425     _In_ ULONG Length);
2426 
2427 STORPORT_API
2428 VOID
2429 __cdecl
2430 StorPortNotification(
2431     _In_ SCSI_NOTIFICATION_TYPE NotificationType,
2432     _In_ PVOID HwDeviceExtension,
2433     ...);
2434 
2435 STORPORT_API
2436 VOID
2437 NTAPI
2438 StorPortQuerySystemTime(
2439     _Out_ PLARGE_INTEGER CurrentTime);
2440 
2441 STORPORT_API
2442 BOOLEAN
2443 NTAPI
2444 StorPortPause(
2445     _In_ PVOID HwDeviceExtension,
2446     _In_ ULONG TimeOut);
2447 
2448 STORPORT_API
2449 BOOLEAN
2450 NTAPI
2451 StorPortPauseDevice(
2452     _In_ PVOID HwDeviceExtension,
2453     _In_ UCHAR PathId,
2454     _In_ UCHAR TargetId,
2455     _In_ UCHAR Lun,
2456     _In_ ULONG TimeOut);
2457 
2458 STORPORT_API
2459 VOID
2460 NTAPI
2461 StorPortReadPortBufferUchar(
2462     _In_ PVOID HwDeviceExtension,
2463     _In_ PUCHAR Port,
2464     _In_ PUCHAR Buffer,
2465     _In_ ULONG Count);
2466 
2467 STORPORT_API
2468 VOID
2469 NTAPI
2470 StorPortReadPortBufferUlong(
2471     _In_ PVOID HwDeviceExtension,
2472     _In_ PULONG Port,
2473     _In_ PULONG Buffer,
2474     _In_ ULONG Count);
2475 
2476 STORPORT_API
2477 VOID
2478 NTAPI
2479 StorPortReadPortBufferUshort(
2480     _In_ PVOID HwDeviceExtension,
2481     _In_ PUSHORT Port,
2482     _In_ PUSHORT Buffer,
2483     _In_ ULONG Count);
2484 
2485 STORPORT_API
2486 UCHAR
2487 NTAPI
2488 StorPortReadPortUchar(
2489     _In_ PVOID HwDeviceExtension,
2490     _In_ PUCHAR Port);
2491 
2492 STORPORT_API
2493 ULONG
2494 NTAPI
2495 StorPortReadPortUlong(
2496     _In_ PVOID HwDeviceExtension,
2497     _In_ PULONG Port);
2498 
2499 STORPORT_API
2500 USHORT
2501 NTAPI
2502 StorPortReadPortUshort(
2503     _In_ PVOID HwDeviceExtension,
2504     _In_ PUSHORT Port);
2505 
2506 STORPORT_API
2507 VOID
2508 NTAPI
2509 StorPortReadRegisterBufferUchar(
2510     _In_ PVOID HwDeviceExtension,
2511     _In_ PUCHAR Register,
2512     _In_ PUCHAR Buffer,
2513     _In_ ULONG Count);
2514 
2515 STORPORT_API
2516 VOID
2517 NTAPI
2518 StorPortReadRegisterBufferUlong(
2519     _In_ PVOID HwDeviceExtension,
2520     _In_ PULONG Register,
2521     _In_ PULONG Buffer,
2522     _In_ ULONG Count);
2523 
2524 STORPORT_API
2525 VOID
2526 NTAPI
2527 StorPortReadRegisterBufferUshort(
2528     _In_ PVOID HwDeviceExtension,
2529     _In_ PUSHORT Register,
2530     _In_ PUSHORT Buffer,
2531     _In_ ULONG Count);
2532 
2533 STORPORT_API
2534 UCHAR
2535 NTAPI
2536 StorPortReadRegisterUchar(
2537     _In_ PVOID HwDeviceExtension,
2538     _In_ PUCHAR Register);
2539 
2540 STORPORT_API
2541 ULONG
2542 NTAPI
2543 StorPortReadRegisterUlong(
2544     _In_ PVOID HwDeviceExtension,
2545     _In_ PULONG Register);
2546 
2547 STORPORT_API
2548 USHORT
2549 NTAPI
2550 StorPortReadRegisterUshort(
2551     _In_ PVOID HwDeviceExtension,
2552     _In_ PUSHORT Register);
2553 
2554 STORPORT_API
2555 BOOLEAN
2556 NTAPI
2557 StorPortReady(
2558   _In_ PVOID HwDeviceExtension);
2559 
2560 STORPORT_API
2561 BOOLEAN
2562 NTAPI
2563 StorPortRegistryRead(
2564     _In_ PVOID HwDeviceExtension,
2565     _In_ PUCHAR ValueName,
2566     _In_ ULONG Global,
2567     _In_ ULONG Type,
2568     _In_ PUCHAR Buffer,
2569     _In_ PULONG BufferLength);
2570 
2571 STORPORT_API
2572 BOOLEAN
2573 NTAPI
2574 StorPortRegistryWrite(
2575     _In_ PVOID HwDeviceExtension,
2576     _In_ PUCHAR ValueName,
2577     _In_ ULONG Global,
2578     _In_ ULONG Type,
2579     _In_ PUCHAR Buffer,
2580     _In_ ULONG BufferLength);
2581 
2582 STORPORT_API
2583 BOOLEAN
2584 NTAPI
2585 StorPortResume(
2586   _In_ PVOID HwDeviceExtension);
2587 
2588 STORPORT_API
2589 BOOLEAN
2590 NTAPI
2591 StorPortResumeDevice(
2592   _In_ PVOID HwDeviceExtension,
2593   _In_ UCHAR PathId,
2594   _In_ UCHAR TargetId,
2595   _In_ UCHAR Lun);
2596 
2597 STORPORT_API
2598 ULONG
2599 NTAPI
2600 StorPortSetBusDataByOffset(
2601     _In_ PVOID DeviceExtension,
2602     _In_ ULONG BusDataType,
2603     _In_ ULONG SystemIoBusNumber,
2604     _In_ ULONG SlotNumber,
2605     _In_reads_bytes_(Length) PVOID Buffer,
2606     _In_ ULONG Offset,
2607     _In_ ULONG Length);
2608 
2609 STORPORT_API
2610 BOOLEAN
2611 NTAPI
2612 StorPortSetDeviceQueueDepth(
2613   _In_ PVOID HwDeviceExtension,
2614   _In_ UCHAR PathId,
2615   _In_ UCHAR TargetId,
2616   _In_ UCHAR Lun,
2617   _In_ ULONG Depth);
2618 
2619 STORPORT_API
2620 VOID
2621 NTAPI
2622 StorPortStallExecution(
2623     _In_ ULONG Delay);
2624 
2625 STORPORT_API
2626 VOID
2627 NTAPI
2628 StorPortSynchronizeAccess(
2629     _In_ PVOID HwDeviceExtension,
2630     _In_ PSTOR_SYNCHRONIZED_ACCESS SynchronizedAccessRoutine,
2631     _In_opt_ PVOID Context);
2632 
2633 STORPORT_API
2634 BOOLEAN
2635 NTAPI
2636 StorPortValidateRange(
2637     _In_ PVOID HwDeviceExtension,
2638     _In_ INTERFACE_TYPE BusType,
2639     _In_ ULONG SystemIoBusNumber,
2640     _In_ STOR_PHYSICAL_ADDRESS IoAddress,
2641     _In_ ULONG NumberOfBytes,
2642     _In_ BOOLEAN InIoSpace);
2643 
2644 STORPORT_API
2645 VOID
2646 NTAPI
2647 StorPortWritePortBufferUchar(
2648     _In_ PVOID HwDeviceExtension,
2649     _In_ PUCHAR Port,
2650     _In_ PUCHAR Buffer,
2651     _In_ ULONG Count);
2652 
2653 STORPORT_API
2654 VOID
2655 NTAPI
2656 StorPortWritePortBufferUlong(
2657     _In_ PVOID HwDeviceExtension,
2658     _In_ PULONG Port,
2659     _In_ PULONG Buffer,
2660     _In_ ULONG Count);
2661 
2662 STORPORT_API
2663 VOID
2664 NTAPI
2665 StorPortWritePortBufferUshort(
2666     _In_ PVOID HwDeviceExtension,
2667     _In_ PUSHORT Port,
2668     _In_ PUSHORT Buffer,
2669     _In_ ULONG Count);
2670 
2671 STORPORT_API
2672 VOID
2673 NTAPI
2674 StorPortWritePortUchar(
2675     _In_ PVOID HwDeviceExtension,
2676     _In_ PUCHAR Port,
2677     _In_ UCHAR Value);
2678 
2679 STORPORT_API
2680 VOID
2681 NTAPI
2682 StorPortWritePortUlong(
2683     _In_ PVOID HwDeviceExtension,
2684     _In_ PULONG Port,
2685     _In_ ULONG Value);
2686 
2687 STORPORT_API
2688 VOID
2689 NTAPI
2690 StorPortWritePortUshort(
2691     _In_ PVOID HwDeviceExtension,
2692     _In_ PUSHORT Port,
2693     _In_ USHORT Value);
2694 
2695 STORPORT_API
2696 VOID
2697 NTAPI
2698 StorPortWriteRegisterBufferUchar(
2699     _In_ PVOID HwDeviceExtension,
2700     _In_ PUCHAR Register,
2701     _In_ PUCHAR Buffer,
2702     _In_ ULONG Count);
2703 
2704 STORPORT_API
2705 VOID
2706 NTAPI
2707 StorPortWriteRegisterBufferUlong(
2708     _In_ PVOID HwDeviceExtension,
2709     _In_ PULONG Register,
2710     _In_ PULONG Buffer,
2711     _In_ ULONG Count);
2712 
2713 STORPORT_API
2714 VOID
2715 NTAPI
2716 StorPortWriteRegisterBufferUshort(
2717     _In_ PVOID HwDeviceExtension,
2718     _In_ PUSHORT Register,
2719     _In_ PUSHORT Buffer,
2720     _In_ ULONG Count);
2721 
2722 STORPORT_API
2723 VOID
2724 NTAPI
2725 StorPortWriteRegisterUchar(
2726     _In_ PVOID HwDeviceExtension,
2727     _In_ PUCHAR Register,
2728     _In_ UCHAR Value);
2729 
2730 STORPORT_API
2731 VOID
2732 NTAPI
2733 StorPortWriteRegisterUlong(
2734     _In_ PVOID HwDeviceExtension,
2735     _In_ PULONG Register,
2736     _In_ ULONG Value);
2737 
2738 STORPORT_API
2739 VOID
2740 NTAPI
2741 StorPortWriteRegisterUshort(
2742     _In_ PVOID HwDeviceExtension,
2743     _In_ PUSHORT Register,
2744     _In_ USHORT Value);
2745 
2746 
2747 FORCEINLINE
2748 BOOLEAN
2749 StorPortEnablePassiveInitialization(
2750     _In_ PVOID DeviceExtension,
2751     _In_ PHW_PASSIVE_INITIALIZE_ROUTINE HwPassiveInitializeRoutine)
2752 {
2753     LONG Succ;
2754     Succ = FALSE;
2755     StorPortNotification(EnablePassiveInitialization,
2756                          DeviceExtension,
2757                          HwPassiveInitializeRoutine,
2758                          &Succ);
2759     return (BOOLEAN)Succ;
2760 }
2761 
2762 FORCEINLINE
2763 VOID
2764 StorPortInitializeDpc(
2765     _In_ PVOID DeviceExtension,
2766     _Out_ PSTOR_DPC Dpc,
2767     _In_ PHW_DPC_ROUTINE HwDpcRoutine)
2768 {
2769     StorPortNotification(InitializeDpc,
2770                          DeviceExtension,
2771                          Dpc,
2772                          HwDpcRoutine);
2773 }
2774 
2775 FORCEINLINE
2776 BOOLEAN
2777 StorPortIssueDpc(
2778     _In_ PVOID DeviceExtension,
2779     _In_ PSTOR_DPC Dpc,
2780     _In_ PVOID SystemArgument1,
2781     _In_ PVOID SystemArgument2)
2782 {
2783     LONG Succ;
2784     Succ = FALSE;
2785     StorPortNotification(IssueDpc,
2786                          DeviceExtension,
2787                          Dpc,
2788                          SystemArgument1,
2789                          SystemArgument2,
2790                          &Succ);
2791     return (BOOLEAN)Succ;
2792 }
2793 
2794 FORCEINLINE
2795 VOID
2796 StorPortAcquireSpinLock(
2797     _In_ PVOID DeviceExtension,
2798     _In_ STOR_SPINLOCK SpinLock,
2799     _In_ PVOID LockContext,
2800     _Inout_ PSTOR_LOCK_HANDLE LockHandle)
2801 {
2802     StorPortNotification(AcquireSpinLock,
2803                          DeviceExtension,
2804                          SpinLock,
2805                          LockContext,
2806                          LockHandle);
2807 }
2808 
2809 FORCEINLINE
2810 VOID
2811 StorPortReleaseSpinLock(
2812     _In_ PVOID DeviceExtension,
2813     _Inout_ PSTOR_LOCK_HANDLE LockHandle)
2814 {
2815     StorPortNotification(ReleaseSpinLock,
2816                          DeviceExtension,
2817                          LockHandle);
2818 }
2819 
2820 STORPORT_API
2821 ULONG
2822 StorPortExtendedFunction(
2823     _In_ STORPORT_FUNCTION_CODE FunctionCode,
2824     _In_ PVOID HwDeviceExtension,
2825     ...);
2826 
2827 FORCEINLINE
2828 ULONG
2829 StorPortAllocatePool(
2830     _In_ PVOID HwDeviceExtension,
2831     _In_ ULONG NumberOfBytes,
2832     _In_ ULONG Tag,
2833     _Out_ PVOID *BufferPointer
2834     )
2835 {
2836     return StorPortExtendedFunction(ExtFunctionAllocatePool,
2837                                     HwDeviceExtension,
2838                                     NumberOfBytes,
2839                                     Tag,
2840                                     BufferPointer);
2841 }
2842 
2843 FORCEINLINE
2844 ULONG
2845 StorPortFreePool(
2846     _In_ PVOID HwDeviceExtension,
2847     _In_ PVOID BufferPointer)
2848 {
2849     return StorPortExtendedFunction(ExtFunctionFreePool,
2850                                     HwDeviceExtension,
2851                                     BufferPointer);
2852 }
2853 
2854 FORCEINLINE
2855 ULONG
2856 StorPortAllocateMdl(
2857     _In_ PVOID HwDeviceExtension,
2858     _In_ PVOID BufferPointer,
2859     _In_ ULONG NumberOfBytes,
2860     _Out_ PVOID *Mdl)
2861 {
2862     return StorPortExtendedFunction(ExtFunctionAllocateMdl,
2863                                     HwDeviceExtension,
2864                                     BufferPointer,
2865                                     NumberOfBytes,
2866                                     Mdl);
2867 }
2868 
2869 FORCEINLINE
2870 ULONG
2871 StorPortFreeMdl(
2872     _In_ PVOID HwDeviceExtension,
2873     _In_ PVOID Mdl)
2874 {
2875     return StorPortExtendedFunction(ExtFunctionFreeMdl,
2876                                     HwDeviceExtension,
2877                                     Mdl);
2878 }
2879 
2880 FORCEINLINE
2881 ULONG
2882 StorPortBuildMdlForNonPagedPool(
2883     _In_ PVOID HwDeviceExtension,
2884     _Inout_ PVOID Mdl)
2885 {
2886     return StorPortExtendedFunction(ExtFunctionBuildMdlForNonPagedPool,
2887                                     HwDeviceExtension,
2888                                     Mdl);
2889 }
2890 
2891 FORCEINLINE
2892 ULONG
2893 StorPortGetSystemAddress(
2894     _In_ PVOID HwDeviceExtension,
2895     _In_ PSCSI_REQUEST_BLOCK Srb,
2896     _Out_ PVOID *SystemAddress)
2897 {
2898     return StorPortExtendedFunction(ExtFunctionGetSystemAddress,
2899                                     HwDeviceExtension,
2900                                     Srb,
2901                                     SystemAddress);
2902 }
2903 
2904 FORCEINLINE
2905 ULONG
2906 StorPortGetOriginalMdl(
2907     _In_ PVOID HwDeviceExtension,
2908     _In_ PSCSI_REQUEST_BLOCK Srb,
2909     _Out_ PVOID *Mdl)
2910 {
2911     return StorPortExtendedFunction(ExtFunctionGetOriginalMdl,
2912                                     HwDeviceExtension,
2913                                     Srb,
2914                                     Mdl);
2915 }
2916 
2917 FORCEINLINE
2918 ULONG
2919 StorPortCompleteServiceIrp(
2920     _In_ PVOID HwDeviceExtension,
2921     _In_ PVOID Irp)
2922 {
2923     return StorPortExtendedFunction(ExtFunctionCompleteServiceIrp,
2924                                     HwDeviceExtension,
2925                                     Irp);
2926 }
2927 
2928 FORCEINLINE
2929 ULONG
2930 StorPortGetDeviceObjects(
2931     _In_ PVOID HwDeviceExtension,
2932     _Out_ PVOID *AdapterDeviceObject,
2933     _Out_ PVOID *PhysicalDeviceObject,
2934     _Out_ PVOID *LowerDeviceObject)
2935 {
2936     return StorPortExtendedFunction(ExtFunctionGetDeviceObjects,
2937                                     HwDeviceExtension,
2938                                     AdapterDeviceObject,
2939                                     PhysicalDeviceObject,
2940                                     LowerDeviceObject);
2941 }
2942 
2943 FORCEINLINE
2944 ULONG
2945 StorPortBuildScatterGatherList(
2946     _In_ PVOID HwDeviceExtension,
2947     _In_ PVOID Mdl,
2948     _In_ PVOID CurrentVa,
2949     _In_ ULONG Length,
2950     _In_ PpostScaterGatherExecute ExecutionRoutine,
2951     _In_ PVOID Context,
2952     _In_ BOOLEAN WriteToDevice,
2953     _Inout_ PVOID ScatterGatherBuffer,
2954     _In_ ULONG ScatterGatherBufferLength)
2955 {
2956     return StorPortExtendedFunction(ExtFunctionBuildScatterGatherList,
2957                                     HwDeviceExtension,
2958                                     Mdl,
2959                                     CurrentVa,
2960                                     Length,
2961                                     ExecutionRoutine,
2962                                     Context,
2963                                     WriteToDevice,
2964                                     ScatterGatherBuffer,
2965                                     ScatterGatherBufferLength);
2966 }
2967 
2968 FORCEINLINE
2969 ULONG
2970 StorPortPutScatterGatherList(
2971     _In_ PVOID HwDeviceExtension,
2972     _In_ PSTOR_SCATTER_GATHER_LIST ScatterGatherList,
2973     _In_ BOOLEAN WriteToDevice)
2974 {
2975     return StorPortExtendedFunction(ExtFunctionPutScatterGatherList,
2976                                     HwDeviceExtension,
2977                                     ScatterGatherList,
2978                                     WriteToDevice);
2979 }
2980 
2981 FORCEINLINE
2982 ULONG
2983 StorPortAcquireMSISpinLock(
2984     _In_ PVOID HwDeviceExtension,
2985     _In_ ULONG MessageId,
2986     _In_ PULONG OldIrql)
2987 {
2988     return StorPortExtendedFunction(ExtFunctionAcquireMSISpinLock,
2989                                     HwDeviceExtension,
2990                                     MessageId,
2991                                     OldIrql);
2992 }
2993 
2994 FORCEINLINE
2995 ULONG
2996 StorPortReleaseMSISpinLock(
2997     _In_ PVOID HwDeviceExtension,
2998     _In_ ULONG MessageId,
2999     _In_ ULONG OldIrql)
3000 {
3001     return StorPortExtendedFunction(ExtFunctionReleaseMSISpinLock,
3002                                     HwDeviceExtension,
3003                                     MessageId,
3004                                     OldIrql);
3005 }
3006 
3007 FORCEINLINE
3008 ULONG
3009 StorPortGetMSIInfo(
3010     _In_ PVOID HwDeviceExtension,
3011     _In_ ULONG MessageId,
3012     _Out_ PMESSAGE_INTERRUPT_INFORMATION InterruptInfo)
3013 {
3014     return StorPortExtendedFunction(ExtFunctionGetMessageInterruptInformation,
3015                                     HwDeviceExtension,
3016                                     MessageId,
3017                                     InterruptInfo);
3018 }
3019 
3020 FORCEINLINE
3021 ULONG
3022 StorPortInitializePerfOpts(
3023     _In_ PVOID HwDeviceExtension,
3024     _In_ BOOLEAN Query,
3025     _Inout_ PPERF_CONFIGURATION_DATA PerfConfigData)
3026 {
3027     return StorPortExtendedFunction(ExtFunctionInitializePerformanceOptimizations,
3028                                     HwDeviceExtension,
3029                                     Query,
3030                                     PerfConfigData);
3031 }
3032 
3033 FORCEINLINE
3034 ULONG
3035 StorPortGetStartIoPerfParams(
3036     _In_ PVOID HwDeviceExtension,
3037     _In_ PSCSI_REQUEST_BLOCK Srb,
3038     _Inout_ PSTARTIO_PERFORMANCE_PARAMETERS StartIoPerfParams)
3039 {
3040     return StorPortExtendedFunction(ExtFunctionGetStartIoPerformanceParameters,
3041                                     HwDeviceExtension,
3042                                     Srb,
3043                                     StartIoPerfParams);
3044 }
3045 
3046 FORCEINLINE
3047 ULONG
3048 StorPortLogSystemEvent(
3049     _In_ PVOID HwDeviceExtension,
3050     _Inout_ PSTOR_LOG_EVENT_DETAILS LogDetails,
3051     _Inout_ PULONG MaximumSize)
3052 {
3053     return StorPortExtendedFunction(ExtFunctionLogSystemEvent,
3054                                     HwDeviceExtension,
3055                                     LogDetails,
3056                                     MaximumSize);
3057 }
3058 
3059 #if DBG
3060 #define DebugPrint(x) StorPortDebugPrint x
3061 #else
3062 #define DebugPrint(x)
3063 #endif
3064 
3065 #ifdef __cplusplus
3066 }
3067 #endif
3068 
3069 #endif /* _NTSTORPORT_ */
3070