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