1 /* 2 * scsi.h 3 * 4 * Interface between SCSI miniport drivers and the SCSI port driver. 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 _NTSRB_ 24 #define _NTSRB_ 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 #define SCSI_MAXIMUM_LOGICAL_UNITS 8 31 #define SCSI_MAXIMUM_TARGETS_PER_BUS 128 32 #define SCSI_MAXIMUM_LUNS_PER_TARGET 255 33 #define SCSI_MAXIMUM_BUSES 8 34 #define SCSI_MINIMUM_PHYSICAL_BREAKS 16 35 #define SCSI_MAXIMUM_PHYSICAL_BREAKS 255 36 #define SCSI_MAXIMUM_TARGETS 8 37 38 /* PORT_CONFIGURATION_INFORMATION.Dma64BitAddresses constants */ 39 #define SCSI_DMA64_MINIPORT_SUPPORTED 0x01 40 #define SCSI_DMA64_SYSTEM_SUPPORTED 0x80 41 #if (NTDDI_VERSION > NTDDI_WS03SP1) 42 #define SCSI_DMA64_MINIPORT_FULL64BIT_SUPPORTED 0x02 43 #endif 44 45 #define SP_UNINITIALIZED_VALUE ((ULONG) ~0) 46 #define SP_UNTAGGED ((UCHAR) ~0) 47 48 /* Asynchronous events */ 49 #define SRBEV_BUS_RESET 0x0001 50 #define SRBEV_SCSI_ASYNC_NOTIFICATION 0x0002 51 52 #define MAXIMUM_CDB_SIZE 12 53 54 #if DBG 55 #define DebugPrint(x) ScsiDebugPrint x 56 #else 57 #define DebugPrint(x) 58 #endif 59 60 #define SCSI_COMBINE_BUS_TARGET(Bus, Target)( \ 61 ((((UCHAR) (Target)) & ~(0x20 - 1)) << 8) | \ 62 (((UCHAR) (Bus)) << 5) | \ 63 (((UCHAR) (Target)) & (0x20 - 1))) 64 65 #define SCSI_DECODE_BUS_TARGET(Value, Bus, Target)( \ 66 Bus = (UCHAR) ((Value) >> 5), \ 67 Target = (UCHAR) ((((Value) >> 8) & ~(0x20 - 1)) | ((Value) & (0x20 - 1)))) 68 69 /* SCSI_REQUEST_BLOCK.Function constants */ 70 #define SRB_FUNCTION_EXECUTE_SCSI 0x00 71 #define SRB_FUNCTION_CLAIM_DEVICE 0x01 72 #define SRB_FUNCTION_IO_CONTROL 0x02 73 #define SRB_FUNCTION_RECEIVE_EVENT 0x03 74 #define SRB_FUNCTION_RELEASE_QUEUE 0x04 75 #define SRB_FUNCTION_ATTACH_DEVICE 0x05 76 #define SRB_FUNCTION_RELEASE_DEVICE 0x06 77 #define SRB_FUNCTION_SHUTDOWN 0x07 78 #define SRB_FUNCTION_FLUSH 0x08 79 #define SRB_FUNCTION_PROTOCOL_COMMAND 0x09 80 #define SRB_FUNCTION_ABORT_COMMAND 0x10 81 #define SRB_FUNCTION_RELEASE_RECOVERY 0x11 82 #define SRB_FUNCTION_RESET_BUS 0x12 83 #define SRB_FUNCTION_RESET_DEVICE 0x13 84 #define SRB_FUNCTION_TERMINATE_IO 0x14 85 #define SRB_FUNCTION_FLUSH_QUEUE 0x15 86 #define SRB_FUNCTION_REMOVE_DEVICE 0x16 87 #define SRB_FUNCTION_WMI 0x17 88 #define SRB_FUNCTION_LOCK_QUEUE 0x18 89 #define SRB_FUNCTION_UNLOCK_QUEUE 0x19 90 #define SRB_FUNCTION_QUIESCE_DEVICE 0x1a 91 #define SRB_FUNCTION_RESET_LOGICAL_UNIT 0x20 92 #define SRB_FUNCTION_SET_LINK_TIMEOUT 0x21 93 #define SRB_FUNCTION_LINK_TIMEOUT_OCCURRED 0x22 94 #define SRB_FUNCTION_LINK_TIMEOUT_COMPLETE 0x23 95 #define SRB_FUNCTION_POWER 0x24 96 #define SRB_FUNCTION_PNP 0x25 97 #define SRB_FUNCTION_DUMP_POINTERS 0x26 98 #define SRB_FUNCTION_FREE_DUMP_POINTERS 0x27 99 #define SRB_FUNCTION_STORAGE_REQUEST_BLOCK 0x28 // special value 100 #define SRB_FUNCTION_CRYPTO_OPERATION 0x29 101 #define SRB_FUNCTION_GET_DUMP_INFO 0x2a 102 #define SRB_FUNCTION_FREE_DUMP_INFO 0x2b 103 104 /* SCSI_REQUEST_BLOCK.SrbStatus constants */ 105 #define SRB_STATUS_PENDING 0x00 106 #define SRB_STATUS_SUCCESS 0x01 107 #define SRB_STATUS_ABORTED 0x02 108 #define SRB_STATUS_ABORT_FAILED 0x03 109 #define SRB_STATUS_ERROR 0x04 110 #define SRB_STATUS_BUSY 0x05 111 #define SRB_STATUS_INVALID_REQUEST 0x06 112 #define SRB_STATUS_INVALID_PATH_ID 0x07 113 #define SRB_STATUS_NO_DEVICE 0x08 114 #define SRB_STATUS_TIMEOUT 0x09 115 #define SRB_STATUS_SELECTION_TIMEOUT 0x0A 116 #define SRB_STATUS_COMMAND_TIMEOUT 0x0B 117 #define SRB_STATUS_MESSAGE_REJECTED 0x0D 118 #define SRB_STATUS_BUS_RESET 0x0E 119 #define SRB_STATUS_PARITY_ERROR 0x0F 120 #define SRB_STATUS_REQUEST_SENSE_FAILED 0x10 121 #define SRB_STATUS_NO_HBA 0x11 122 #define SRB_STATUS_DATA_OVERRUN 0x12 123 #define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13 124 #define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14 125 #define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15 126 #define SRB_STATUS_REQUEST_FLUSHED 0x16 127 #define SRB_STATUS_INVALID_LUN 0x20 128 #define SRB_STATUS_INVALID_TARGET_ID 0x21 129 #define SRB_STATUS_BAD_FUNCTION 0x22 130 #define SRB_STATUS_ERROR_RECOVERY 0x23 131 #define SRB_STATUS_NOT_POWERED 0x24 132 #define SRB_STATUS_LINK_DOWN 0x25 133 #define SRB_STATUS_INSUFFICIENT_RESOURCES 0x26 134 #define SRB_STATUS_THROTTLED_REQUEST 0x27 135 #define SRB_STATUS_INTERNAL_ERROR 0x30 136 137 #define SRB_STATUS_QUEUE_FROZEN 0x40 138 #define SRB_STATUS_AUTOSENSE_VALID 0x80 139 140 #define SRB_STATUS(Status) \ 141 (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN)) 142 143 /* SCSI_REQUEST_BLOCK.SrbFlags constants */ 144 #define SRB_FLAGS_QUEUE_ACTION_ENABLE 0x00000002 145 #define SRB_FLAGS_DISABLE_DISCONNECT 0x00000004 146 #define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008 147 #define SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x00000010 148 #define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020 149 #define SRB_FLAGS_DATA_IN 0x00000040 150 #define SRB_FLAGS_DATA_OUT 0x00000080 151 #define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000 152 #define SRB_FLAGS_UNSPECIFIED_DIRECTION (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT) 153 #define SRB_FLAGS_NO_QUEUE_FREEZE 0x00000100 154 #define SRB_FLAGS_ADAPTER_CACHE_ENABLE 0x00000200 155 #define SRB_FLAGS_FREE_SENSE_BUFFER 0x00000400 156 #define SRB_FLAGS_D3_PROCESSING 0x00000800 157 #define SRB_FLAGS_SEQUENTIAL_REQUIRED 0x00001000 158 #define SRB_FLAGS_IS_ACTIVE 0x00010000 159 #define SRB_FLAGS_ALLOCATED_FROM_ZONE 0x00020000 160 #define SRB_FLAGS_SGLIST_FROM_POOL 0x00040000 161 #define SRB_FLAGS_BYPASS_LOCKED_QUEUE 0x00080000 162 #define SRB_FLAGS_NO_KEEP_AWAKE 0x00100000 163 #define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE 0x00200000 164 #define SRB_FLAGS_PORT_DRIVER_SENSEHASPORT 0x00400000 165 #define SRB_FLAGS_DONT_START_NEXT_PACKET 0x00800000 166 #define SRB_FLAGS_PORT_DRIVER_RESERVED 0x0F000000 167 #define SRB_FLAGS_CLASS_DRIVER_RESERVED 0xF0000000 168 169 #if DBG 170 #define SCSI_PORT_SIGNATURE 0x54524f50 171 #endif 172 173 #define SRB_SIMPLE_TAG_REQUEST 0x20 174 #define SRB_HEAD_OF_QUEUE_TAG_REQUEST 0x21 175 #define SRB_ORDERED_QUEUE_TAG_REQUEST 0x22 176 177 #define SRB_WMI_FLAGS_ADAPTER_REQUEST 0x0001 178 #define SRB_POWER_FLAGS_ADAPTER_REQUEST 0x0001 179 #define SRB_PNP_FLAGS_ADAPTER_REQUEST 0x0001 180 181 #define SP_BUS_PARITY_ERROR 0x0001 182 #define SP_UNEXPECTED_DISCONNECT 0x0002 183 #define SP_INVALID_RESELECTION 0x0003 184 #define SP_BUS_TIME_OUT 0x0004 185 #define SP_PROTOCOL_ERROR 0x0005 186 #define SP_INTERNAL_ADAPTER_ERROR 0x0006 187 #define SP_REQUEST_TIMEOUT 0x0007 188 #define SP_IRQ_NOT_RESPONDING 0x0008 189 #define SP_BAD_FW_WARNING 0x0009 190 #define SP_BAD_FW_ERROR 0x000a 191 #define SP_LOST_WMI_MINIPORT_REQUEST 0x000b 192 193 #define SP_VER_TRACE_SUPPORT 0x0010 194 195 #define SP_RETURN_NOT_FOUND 0 196 #define SP_RETURN_FOUND 1 197 #define SP_RETURN_ERROR 2 198 #define SP_RETURN_BAD_CONFIG 3 199 200 typedef PHYSICAL_ADDRESS SCSI_PHYSICAL_ADDRESS, *PSCSI_PHYSICAL_ADDRESS; 201 202 typedef struct _ACCESS_RANGE { 203 SCSI_PHYSICAL_ADDRESS RangeStart; 204 ULONG RangeLength; 205 BOOLEAN RangeInMemory; 206 } ACCESS_RANGE, *PACCESS_RANGE; 207 208 typedef struct _PORT_CONFIGURATION_INFORMATION { 209 ULONG Length; 210 ULONG SystemIoBusNumber; 211 INTERFACE_TYPE AdapterInterfaceType; 212 ULONG BusInterruptLevel; 213 ULONG BusInterruptVector; 214 KINTERRUPT_MODE InterruptMode; 215 ULONG MaximumTransferLength; 216 ULONG NumberOfPhysicalBreaks; 217 ULONG DmaChannel; 218 ULONG DmaPort; 219 DMA_WIDTH DmaWidth; 220 DMA_SPEED DmaSpeed; 221 ULONG AlignmentMask; 222 ULONG NumberOfAccessRanges; 223 ACCESS_RANGE (*AccessRanges)[]; 224 PVOID Reserved; 225 UCHAR NumberOfBuses; 226 UCHAR InitiatorBusId[8]; 227 BOOLEAN ScatterGather; 228 BOOLEAN Master; 229 BOOLEAN CachesData; 230 BOOLEAN AdapterScansDown; 231 BOOLEAN AtdiskPrimaryClaimed; 232 BOOLEAN AtdiskSecondaryClaimed; 233 BOOLEAN Dma32BitAddresses; 234 BOOLEAN DemandMode; 235 BOOLEAN MapBuffers; 236 BOOLEAN NeedPhysicalAddresses; 237 BOOLEAN TaggedQueuing; 238 BOOLEAN AutoRequestSense; 239 BOOLEAN MultipleRequestPerLu; 240 BOOLEAN ReceiveEvent; 241 BOOLEAN RealModeInitialized; 242 BOOLEAN BufferAccessScsiPortControlled; 243 UCHAR MaximumNumberOfTargets; 244 UCHAR ReservedUchars[2]; 245 ULONG SlotNumber; 246 ULONG BusInterruptLevel2; 247 ULONG BusInterruptVector2; 248 KINTERRUPT_MODE InterruptMode2; 249 ULONG DmaChannel2; 250 ULONG DmaPort2; 251 DMA_WIDTH DmaWidth2; 252 DMA_SPEED DmaSpeed2; 253 ULONG DeviceExtensionSize; 254 ULONG SpecificLuExtensionSize; 255 ULONG SrbExtensionSize; 256 UCHAR Dma64BitAddresses; 257 BOOLEAN ResetTargetSupported; 258 UCHAR MaximumNumberOfLogicalUnits; 259 BOOLEAN WmiDataProvider; 260 } PORT_CONFIGURATION_INFORMATION, *PPORT_CONFIGURATION_INFORMATION; 261 262 #define CONFIG_INFO_VERSION_2 sizeof(PORT_CONFIGURATION_INFORMATION) 263 264 #ifdef __GNUC__ 265 __extension__ /* enums limited to range of integer */ 266 #endif 267 typedef enum _SCSI_ADAPTER_CONTROL_TYPE { 268 ScsiQuerySupportedControlTypes = 0, 269 ScsiStopAdapter, 270 ScsiRestartAdapter, 271 ScsiSetBootConfig, 272 ScsiSetRunningConfig, 273 ScsiAdapterControlMax, 274 MakeAdapterControlTypeSizeOfUlong = 0xffffffff 275 } SCSI_ADAPTER_CONTROL_TYPE, *PSCSI_ADAPTER_CONTROL_TYPE; 276 277 typedef enum _SCSI_ADAPTER_CONTROL_STATUS { 278 ScsiAdapterControlSuccess = 0, 279 ScsiAdapterControlUnsuccessful 280 } SCSI_ADAPTER_CONTROL_STATUS, *PSCSI_ADAPTER_CONTROL_STATUS; 281 282 typedef struct _SCSI_SUPPORTED_CONTROL_TYPE_LIST { 283 ULONG MaxControlType; 284 BOOLEAN SupportedTypeList[0]; 285 } SCSI_SUPPORTED_CONTROL_TYPE_LIST, *PSCSI_SUPPORTED_CONTROL_TYPE_LIST; 286 287 typedef struct _SCSI_REQUEST_BLOCK { 288 USHORT Length; 289 UCHAR Function; 290 UCHAR SrbStatus; 291 UCHAR ScsiStatus; 292 UCHAR PathId; 293 UCHAR TargetId; 294 UCHAR Lun; 295 UCHAR QueueTag; 296 UCHAR QueueAction; 297 UCHAR CdbLength; 298 UCHAR SenseInfoBufferLength; 299 ULONG SrbFlags; 300 ULONG DataTransferLength; 301 ULONG TimeOutValue; 302 _Field_size_bytes_(DataTransferLength) PVOID DataBuffer; 303 PVOID SenseInfoBuffer; 304 struct _SCSI_REQUEST_BLOCK *NextSrb; 305 PVOID OriginalRequest; 306 PVOID SrbExtension; 307 _ANONYMOUS_UNION union { 308 ULONG InternalStatus; 309 ULONG QueueSortKey; 310 ULONG LinkTimeoutValue; 311 } DUMMYUNIONNAME; 312 #if defined(_WIN64) 313 ULONG Reserved; 314 #endif 315 UCHAR Cdb[16]; 316 } SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK; 317 318 #define SCSI_REQUEST_BLOCK_SIZE sizeof(SCSI_REQUEST_BLOCK) 319 320 typedef struct _SCSI_WMI_REQUEST_BLOCK { 321 USHORT Length; 322 UCHAR Function; 323 UCHAR SrbStatus; 324 UCHAR WMISubFunction; 325 UCHAR PathId; 326 UCHAR TargetId; 327 UCHAR Lun; 328 UCHAR Reserved1; 329 UCHAR WMIFlags; 330 UCHAR Reserved2[2]; 331 ULONG SrbFlags; 332 ULONG DataTransferLength; 333 ULONG TimeOutValue; 334 PVOID DataBuffer; 335 PVOID DataPath; 336 PVOID Reserved3; 337 PVOID OriginalRequest; 338 PVOID SrbExtension; 339 ULONG Reserved4; 340 #if (NTDDI_VERSION >= NTDDI_WS03SP1) && defined(_WIN64) 341 ULONG Reserved6; 342 #endif 343 UCHAR Reserved5[16]; 344 } SCSI_WMI_REQUEST_BLOCK, *PSCSI_WMI_REQUEST_BLOCK; 345 346 typedef enum _STOR_DEVICE_POWER_STATE { 347 StorPowerDeviceUnspecified = 0, 348 StorPowerDeviceD0, 349 StorPowerDeviceD1, 350 StorPowerDeviceD2, 351 StorPowerDeviceD3, 352 StorPowerDeviceMaximum 353 } STOR_DEVICE_POWER_STATE, *PSTOR_DEVICE_POWER_STATE; 354 355 typedef enum _STOR_POWER_ACTION { 356 StorPowerActionNone = 0, 357 StorPowerActionReserved, 358 StorPowerActionSleep, 359 StorPowerActionHibernate, 360 StorPowerActionShutdown, 361 StorPowerActionShutdownReset, 362 StorPowerActionShutdownOff, 363 StorPowerActionWarmEject 364 } STOR_POWER_ACTION, *PSTOR_POWER_ACTION; 365 366 typedef struct _SCSI_POWER_REQUEST_BLOCK { 367 USHORT Length; 368 UCHAR Function; 369 UCHAR SrbStatus; 370 UCHAR SrbPowerFlags; 371 UCHAR PathId; 372 UCHAR TargetId; 373 UCHAR Lun; 374 STOR_DEVICE_POWER_STATE DevicePowerState; 375 ULONG SrbFlags; 376 ULONG DataTransferLength; 377 ULONG TimeOutValue; 378 PVOID DataBuffer; 379 PVOID SenseInfoBuffer; 380 struct _SCSI_REQUEST_BLOCK *NextSrb; 381 PVOID OriginalRequest; 382 PVOID SrbExtension; 383 STOR_POWER_ACTION PowerAction; 384 #if defined(_WIN64) 385 ULONG Reserved; 386 #endif 387 UCHAR Reserved5[16]; 388 } SCSI_POWER_REQUEST_BLOCK, *PSCSI_POWER_REQUEST_BLOCK; 389 390 typedef enum _STOR_PNP_ACTION { 391 StorStartDevice = 0x0, 392 StorRemoveDevice = 0x2, 393 StorStopDevice = 0x4, 394 StorQueryCapabilities = 0x9, 395 StorQueryResourceRequirements = 0xB, 396 StorFilterResourceRequirements = 0xD, 397 StorSurpriseRemoval = 0x17 398 } STOR_PNP_ACTION, *PSTOR_PNP_ACTION; 399 400 typedef struct _STOR_DEVICE_CAPABILITIES { 401 USHORT Version; 402 ULONG DeviceD1:1; 403 ULONG DeviceD2:1; 404 ULONG LockSupported:1; 405 ULONG EjectSupported:1; 406 ULONG Removable:1; 407 ULONG DockDevice:1; 408 ULONG UniqueID:1; 409 ULONG SilentInstall:1; 410 ULONG SurpriseRemovalOK:1; 411 ULONG NoDisplayInUI:1; 412 } STOR_DEVICE_CAPABILITIES, *PSTOR_DEVICE_CAPABILITIES; 413 414 typedef struct _SCSI_PNP_REQUEST_BLOCK { 415 USHORT Length; 416 UCHAR Function; 417 UCHAR SrbStatus; 418 UCHAR PnPSubFunction; 419 UCHAR PathId; 420 UCHAR TargetId; 421 UCHAR Lun; 422 STOR_PNP_ACTION PnPAction; 423 ULONG SrbFlags; 424 ULONG DataTransferLength; 425 ULONG TimeOutValue; 426 PVOID DataBuffer; 427 PVOID SenseInfoBuffer; 428 struct _SCSI_REQUEST_BLOCK *NextSrb; 429 PVOID OriginalRequest; 430 PVOID SrbExtension; 431 ULONG SrbPnPFlags; 432 #if defined(_WIN64) 433 ULONG Reserved; 434 #endif 435 UCHAR Reserved4[16]; 436 } SCSI_PNP_REQUEST_BLOCK, *PSCSI_PNP_REQUEST_BLOCK; 437 438 #if (NTDDI_VERSION >= NTDDI_WIN8) 439 #if defined(_WIN64) 440 #define SRB_ALIGN DECLSPEC_ALIGN(8) 441 #define POINTER_ALIGN DECLSPEC_ALIGN(8) 442 #else 443 #define SRB_ALIGN 444 #define POINTER_ALIGN 445 #endif 446 447 typedef enum _SRBEXDATATYPE { 448 SrbExDataTypeUnknown = 0, 449 SrbExDataTypeBidirectional, 450 SrbExDataTypeScsiCdb16 = 0x40, 451 SrbExDataTypeScsiCdb32, 452 SrbExDataTypeScsiCdbVar, 453 SrbExDataTypeWmi = 0x60, 454 SrbExDataTypePower, 455 SrbExDataTypePnP, 456 SrbExDataTypeIoInfo = 0x80, 457 SrbExDataTypeMSReservedStart = 0xf0000000, 458 SrbExDataTypeReserved = 0xffffffff 459 } SRBEXDATATYPE, *PSRBEXDATATYPE; 460 461 typedef struct SRB_ALIGN _SRBEX_DATA { 462 SRBEXDATATYPE Type; 463 ULONG Length; 464 _Field_size_bytes_(Length) UCHAR Data[ANYSIZE_ARRAY]; 465 } SRBEX_DATA, *PSRBEX_DATA; 466 467 #define SRBEX_DATA_BIDIRECTIONAL_LENGTH ((2 * sizeof(ULONG)) + sizeof(PVOID)) 468 469 typedef struct SRB_ALIGN _SRBEX_DATA_BIDIRECTIONAL { 470 _Field_range_(SrbExDataTypeBidirectional, SrbExDataTypeBidirectional) 471 SRBEXDATATYPE Type; 472 _Field_range_(SRBEX_DATA_BIDIRECTIONAL_LENGTH, SRBEX_DATA_BIDIRECTIONAL_LENGTH) 473 ULONG Length; 474 ULONG DataInTransferLength; 475 ULONG Reserved1; 476 _Field_size_bytes_full_(DataInTransferLength) 477 PVOID POINTER_ALIGN DataInBuffer; 478 } SRBEX_DATA_BIDIRECTIONAL, *PSRBEX_DATA_BIDIRECTIONAL; 479 480 #define SRBEX_DATA_SCSI_CDB16_LENGTH ((20 * sizeof(UCHAR)) + sizeof(ULONG) + sizeof(PVOID)) 481 482 typedef struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB16 { 483 _Field_range_(SrbExDataTypeScsiCdb16, SrbExDataTypeScsiCdb16) 484 SRBEXDATATYPE Type; 485 _Field_range_(SRBEX_DATA_SCSI_CDB16_LENGTH, SRBEX_DATA_SCSI_CDB16_LENGTH) 486 ULONG Length; 487 UCHAR ScsiStatus; 488 UCHAR SenseInfoBufferLength; 489 UCHAR CdbLength; 490 UCHAR Reserved; 491 ULONG Reserved1; 492 _Field_size_bytes_full_(SenseInfoBufferLength) 493 PVOID POINTER_ALIGN SenseInfoBuffer; 494 UCHAR POINTER_ALIGN Cdb[16]; 495 } SRBEX_DATA_SCSI_CDB16, *PSRBEX_DATA_SCSI_CDB16; 496 497 #define SRBEX_DATA_SCSI_CDB32_LENGTH ((36 * sizeof(UCHAR)) + sizeof(ULONG) + sizeof(PVOID)) 498 499 typedef struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB32 { 500 _Field_range_(SrbExDataTypeScsiCdb32, SrbExDataTypeScsiCdb32) 501 SRBEXDATATYPE Type; 502 _Field_range_(SRBEX_DATA_SCSI_CDB32_LENGTH, SRBEX_DATA_SCSI_CDB32_LENGTH) 503 ULONG Length; 504 UCHAR ScsiStatus; 505 UCHAR SenseInfoBufferLength; 506 UCHAR CdbLength; 507 UCHAR Reserved; 508 ULONG Reserved1; 509 _Field_size_bytes_full_(SenseInfoBufferLength) 510 PVOID POINTER_ALIGN SenseInfoBuffer; 511 UCHAR POINTER_ALIGN Cdb[32]; 512 } SRBEX_DATA_SCSI_CDB32, *PSRBEX_DATA_SCSI_CDB32; 513 514 #define SRBEX_DATA_SCSI_CDB_VAR_LENGTH_MIN ((4 * sizeof(UCHAR)) + (3 * sizeof(ULONG)) + sizeof(PVOID)) 515 #define SRBEX_DATA_SCSI_CDB_VAR_LENGTH_MAX 0xffffffffUL 516 517 typedef struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB_VAR { 518 _Field_range_(SrbExDataTypeScsiCdbVar, SrbExDataTypeScsiCdbVar) 519 SRBEXDATATYPE Type; 520 _Field_range_(SRBEX_DATA_SCSI_CDB_VAR_LENGTH_MIN, SRBEX_DATA_SCSI_CDB_VAR_LENGTH_MAX) 521 ULONG Length; 522 UCHAR ScsiStatus; 523 UCHAR SenseInfoBufferLength; 524 UCHAR Reserved[2]; 525 ULONG CdbLength; 526 ULONG Reserved1[2]; 527 _Field_size_bytes_full_(SenseInfoBufferLength) 528 PVOID POINTER_ALIGN SenseInfoBuffer; 529 _Field_size_bytes_full_(CdbLength) 530 UCHAR POINTER_ALIGN Cdb[ANYSIZE_ARRAY]; 531 } SRBEX_DATA_SCSI_CDB_VAR, *PSRBEX_DATA_SCSI_CDB_VAR; 532 533 #define SRBEX_DATA_WMI_LENGTH ((4 * sizeof(UCHAR)) + sizeof(ULONG) + sizeof(PVOID)) 534 535 typedef struct SRB_ALIGN _SRBEX_DATA_WMI { 536 _Field_range_(SrbExDataTypeWmi, SrbExDataTypeWmi) 537 SRBEXDATATYPE Type; 538 _Field_range_(SRBEX_DATA_WMI_LENGTH, SRBEX_DATA_WMI_LENGTH) 539 ULONG Length; 540 UCHAR WMISubFunction; 541 UCHAR WMIFlags; 542 UCHAR Reserved[2]; 543 ULONG Reserved1; 544 PVOID POINTER_ALIGN DataPath; 545 } SRBEX_DATA_WMI, *PSRBEX_DATA_WMI; 546 547 #define SRBEX_DATA_POWER_LENGTH ((4 * sizeof(UCHAR)) + sizeof(STOR_DEVICE_POWER_STATE) + sizeof(STOR_POWER_ACTION)) 548 549 typedef struct SRB_ALIGN _SRBEX_DATA_POWER { 550 _Field_range_(SrbExDataTypePower, SrbExDataTypePower) 551 SRBEXDATATYPE Type; 552 _Field_range_(SRBEX_DATA_POWER_LENGTH, SRBEX_DATA_POWER_LENGTH) 553 ULONG Length; 554 UCHAR SrbPowerFlags; 555 UCHAR Reserved[3]; 556 STOR_DEVICE_POWER_STATE DevicePowerState; 557 STOR_POWER_ACTION PowerAction; 558 } SRBEX_DATA_POWER, *PSRBEX_DATA_POWER; 559 560 #define SRBEX_DATA_PNP_LENGTH ((4 * sizeof(UCHAR)) + sizeof(STOR_PNP_ACTION) + (2 * sizeof(ULONG))) 561 562 typedef struct SRB_ALIGN _SRBEX_DATA_PNP { 563 _Field_range_(SrbExDataTypePnP, SrbExDataTypePnP) 564 SRBEXDATATYPE Type; 565 _Field_range_(SRBEX_DATA_PNP_LENGTH, SRBEX_DATA_PNP_LENGTH) 566 ULONG Length; 567 UCHAR PnPSubFunction; 568 UCHAR Reserved[3]; 569 STOR_PNP_ACTION PnPAction; 570 ULONG SrbPnPFlags; 571 ULONG Reserved1; 572 } SRBEX_DATA_PNP, *PSRBEX_DATA_PNP; 573 574 #define SRBEX_DATA_IO_INFO_LENGTH ((5 * sizeof(ULONG)) + (4 * sizeof(UCHAR))) 575 576 #define REQUEST_INFO_NO_CACHE_FLAG 0x00000001 577 #define REQUEST_INFO_PAGING_IO_FLAG 0x00000002 578 #define REQUEST_INFO_SEQUENTIAL_IO_FLAG 0x00000004 579 #define REQUEST_INFO_TEMPORARY_FLAG 0x00000008 580 #define REQUEST_INFO_WRITE_THROUGH_FLAG 0x00000010 581 #define REQUEST_INFO_HYBRID_WRITE_THROUGH_FLAG 0x00000020 582 583 #if (NTDDI_VERSION >= NTDDI_WINTHRESHOLD) 584 585 #define REQUEST_INFO_NO_FILE_OBJECT_FLAG 0x00000040 586 #define REQUEST_INFO_VOLSNAP_IO_FLAG 0x00000080 587 #define REQUEST_INFO_STREAM_FLAG 0x00000100 588 589 #endif /* (NTDDI_VERSION >= NTDDI_WINTHRESHOLD) */ 590 591 #define REQUEST_INFO_VALID_CACHEPRIORITY_FLAG 0x80000000 592 593 typedef struct SRB_ALIGN _SRBEX_DATA_IO_INFO { 594 _Field_range_(SrbExDataTypeIoInfo, SrbExDataTypeIoInfo) 595 SRBEXDATATYPE Type; 596 _Field_range_(SRBEX_DATA_IO_INFO_LENGTH, SRBEX_DATA_IO_INFO_LENGTH) 597 ULONG Length; 598 ULONG Flags; 599 ULONG Key; 600 ULONG RWLength; 601 BOOLEAN IsWriteRequest; 602 UCHAR CachePriority; 603 UCHAR Reserved[2]; 604 ULONG Reserved1[2]; 605 } SRBEX_DATA_IO_INFO, *PSRBEX_DATA_IO_INFO; 606 607 #define SRB_SIGNATURE 0x53524258 608 #define STORAGE_REQUEST_BLOCK_VERSION_1 0x1 609 610 typedef struct SRB_ALIGN _STORAGE_REQUEST_BLOCK_HEADER { 611 USHORT Length; 612 _Field_range_(SRB_FUNCTION_STORAGE_REQUEST_BLOCK, SRB_FUNCTION_STORAGE_REQUEST_BLOCK) 613 UCHAR Function; 614 UCHAR SrbStatus; 615 } STORAGE_REQUEST_BLOCK_HEADER, *PSTORAGE_REQUEST_BLOCK_HEADER; 616 617 typedef _Struct_size_bytes_(SrbLength) struct SRB_ALIGN _STORAGE_REQUEST_BLOCK { 618 USHORT Length; 619 _Field_range_(SRB_FUNCTION_STORAGE_REQUEST_BLOCK, SRB_FUNCTION_STORAGE_REQUEST_BLOCK) 620 UCHAR Function; 621 UCHAR SrbStatus; 622 UCHAR ReservedUchar[4]; 623 _Field_range_(SRB_SIGNATURE, SRB_SIGNATURE) 624 ULONG Signature; 625 _Field_range_(STORAGE_REQUEST_BLOCK_VERSION_1, STORAGE_REQUEST_BLOCK_VERSION_1) 626 ULONG Version; 627 ULONG SrbLength; 628 ULONG SrbFunction; 629 ULONG SrbFlags; 630 ULONG ReservedUlong; 631 ULONG RequestTag; 632 USHORT RequestPriority; 633 USHORT RequestAttribute; 634 ULONG TimeOutValue; 635 ULONG SystemStatus; 636 ULONG ZeroGuard1; 637 _Field_range_(sizeof(STORAGE_REQUEST_BLOCK), SrbLength - sizeof(STOR_ADDRESS)) 638 ULONG AddressOffset; 639 ULONG NumSrbExData; 640 ULONG DataTransferLength; 641 _Field_size_bytes_full_(DataTransferLength) 642 PVOID POINTER_ALIGN DataBuffer; 643 PVOID POINTER_ALIGN ZeroGuard2; 644 PVOID POINTER_ALIGN OriginalRequest; 645 PVOID POINTER_ALIGN ClassContext; 646 PVOID POINTER_ALIGN PortContext; 647 PVOID POINTER_ALIGN MiniportContext; 648 struct _STORAGE_REQUEST_BLOCK POINTER_ALIGN *NextSrb; 649 _At_buffer_(SrbExDataOffset, _Iter_, NumSrbExData, _Field_range_(0, SrbLength - sizeof(SRBEX_DATA))) 650 _Field_size_(NumSrbExData) 651 ULONG SrbExDataOffset[ANYSIZE_ARRAY]; 652 } STORAGE_REQUEST_BLOCK, *PSTORAGE_REQUEST_BLOCK; 653 654 #define SRB_TYPE_SCSI_REQUEST_BLOCK 0 655 #define SRB_TYPE_STORAGE_REQUEST_BLOCK 1 656 657 #define STORAGE_ADDRESS_TYPE_BTL8 0 658 #endif /* (NTDDI_VERSION >= NTDDI_WIN8) */ 659 660 typedef 661 _Must_inspect_result_ 662 BOOLEAN 663 (NTAPI *PHW_INITIALIZE)( 664 _In_ PVOID DeviceExtension); 665 666 typedef 667 _Must_inspect_result_ 668 BOOLEAN 669 (NTAPI *PHW_STARTIO)( 670 _In_ PVOID DeviceExtension, 671 _In_ PSCSI_REQUEST_BLOCK Srb); 672 673 typedef 674 _Must_inspect_result_ 675 BOOLEAN 676 (NTAPI *PHW_INTERRUPT)( 677 _In_ PVOID DeviceExtension); 678 679 typedef VOID 680 (NTAPI *PHW_TIMER)( 681 _In_ PVOID DeviceExtension); 682 683 typedef VOID 684 (NTAPI *PHW_DMA_STARTED)( 685 _In_ PVOID DeviceExtension); 686 687 typedef 688 _Must_inspect_result_ 689 ULONG 690 (NTAPI *PHW_FIND_ADAPTER)( 691 _In_ PVOID DeviceExtension, 692 _In_ PVOID HwContext, 693 _In_ PVOID BusInformation, 694 _In_ PCHAR ArgumentString, 695 _Inout_ PPORT_CONFIGURATION_INFORMATION ConfigInfo, 696 _Out_ PBOOLEAN Again); 697 698 typedef 699 _Must_inspect_result_ 700 BOOLEAN 701 (NTAPI *PHW_RESET_BUS)( 702 _In_ PVOID DeviceExtension, 703 _In_ ULONG PathId); 704 705 typedef 706 _Must_inspect_result_ 707 BOOLEAN 708 (NTAPI *PHW_ADAPTER_STATE)( 709 _In_ PVOID DeviceExtension, 710 _In_ PVOID Context, 711 _In_ BOOLEAN SaveState); 712 713 typedef 714 _Must_inspect_result_ 715 SCSI_ADAPTER_CONTROL_STATUS 716 (NTAPI *PHW_ADAPTER_CONTROL)( 717 _In_ PVOID DeviceExtension, 718 _In_ SCSI_ADAPTER_CONTROL_TYPE ControlType, 719 _In_ PVOID Parameters); 720 721 typedef enum _SCSI_NOTIFICATION_TYPE { 722 RequestComplete, 723 NextRequest, 724 NextLuRequest, 725 ResetDetected, 726 CallDisableInterrupts, 727 CallEnableInterrupts, 728 RequestTimerCall, 729 BusChangeDetected, 730 WMIEvent, 731 WMIReregister, 732 LinkUp, 733 LinkDown, 734 QueryTickCount, 735 BufferOverrunDetected, 736 TraceNotification 737 } SCSI_NOTIFICATION_TYPE, *PSCSI_NOTIFICATION_TYPE; 738 739 typedef struct _HW_INITIALIZATION_DATA { 740 ULONG HwInitializationDataSize; 741 INTERFACE_TYPE AdapterInterfaceType; 742 PHW_INITIALIZE HwInitialize; 743 PHW_STARTIO HwStartIo; 744 PHW_INTERRUPT HwInterrupt; 745 PHW_FIND_ADAPTER HwFindAdapter; 746 PHW_RESET_BUS HwResetBus; 747 PHW_DMA_STARTED HwDmaStarted; 748 PHW_ADAPTER_STATE HwAdapterState; 749 ULONG DeviceExtensionSize; 750 ULONG SpecificLuExtensionSize; 751 ULONG SrbExtensionSize; 752 ULONG NumberOfAccessRanges; 753 PVOID Reserved; 754 BOOLEAN MapBuffers; 755 BOOLEAN NeedPhysicalAddresses; 756 BOOLEAN TaggedQueuing; 757 BOOLEAN AutoRequestSense; 758 BOOLEAN MultipleRequestPerLu; 759 BOOLEAN ReceiveEvent; 760 USHORT VendorIdLength; 761 PVOID VendorId; 762 _ANONYMOUS_UNION union { 763 USHORT ReservedUshort; 764 USHORT PortVersionFlags; 765 } DUMMYUNIONNAME; 766 USHORT DeviceIdLength; 767 PVOID DeviceId; 768 PHW_ADAPTER_CONTROL HwAdapterControl; 769 } HW_INITIALIZATION_DATA, *PHW_INITIALIZATION_DATA; 770 771 #if defined(_NTDDK_) 772 #define SCSIPORT_API 773 #else 774 #define SCSIPORT_API DECLSPEC_IMPORT 775 #endif 776 777 SCSIPORT_API 778 VOID 779 NTAPI 780 ScsiPortCompleteRequest( 781 _In_ PVOID HwDeviceExtension, 782 _In_ UCHAR PathId, 783 _In_ UCHAR TargetId, 784 _In_ UCHAR Lun, 785 _In_ UCHAR SrbStatus); 786 787 _Must_inspect_result_ 788 SCSIPORT_API 789 ULONG 790 NTAPI 791 ScsiPortConvertPhysicalAddressToUlong( 792 _In_ SCSI_PHYSICAL_ADDRESS Address); 793 794 #define ScsiPortConvertPhysicalAddressToUlong(Address) ((Address).LowPart) 795 #define ScsiPortConvertPhysicalAddressToULongPtr(Address) ((ULONG_PTR)((Address).QuadPart)) 796 797 _Must_inspect_result_ 798 SCSIPORT_API 799 SCSI_PHYSICAL_ADDRESS 800 NTAPI 801 ScsiPortConvertUlongToPhysicalAddress( 802 _In_ ULONG_PTR UlongAddress); 803 804 SCSIPORT_API 805 VOID 806 NTAPI 807 ScsiPortFlushDma( 808 _In_ PVOID DeviceExtension); 809 810 SCSIPORT_API 811 VOID 812 NTAPI 813 ScsiPortFreeDeviceBase( 814 _In_ PVOID HwDeviceExtension, 815 _In_ PVOID MappedAddress); 816 817 _Must_inspect_result_ 818 SCSIPORT_API 819 ULONG 820 NTAPI 821 ScsiPortGetBusData( 822 _In_ PVOID DeviceExtension, 823 _In_ ULONG BusDataType, 824 _In_ ULONG SystemIoBusNumber, 825 _In_ ULONG SlotNumber, 826 _In_reads_bytes_(Length) PVOID Buffer, 827 _In_ ULONG Length); 828 829 _Must_inspect_result_ 830 SCSIPORT_API 831 PVOID 832 NTAPI 833 ScsiPortGetDeviceBase( 834 _In_ PVOID HwDeviceExtension, 835 _In_ INTERFACE_TYPE BusType, 836 _In_ ULONG SystemIoBusNumber, 837 _In_ SCSI_PHYSICAL_ADDRESS IoAddress, 838 _In_ ULONG NumberOfBytes, 839 _In_ BOOLEAN InIoSpace); 840 841 _Must_inspect_result_ 842 SCSIPORT_API 843 PVOID 844 NTAPI 845 ScsiPortGetLogicalUnit( 846 _In_ PVOID HwDeviceExtension, 847 _In_ UCHAR PathId, 848 _In_ UCHAR TargetId, 849 _In_ UCHAR Lun); 850 851 _Must_inspect_result_ 852 SCSIPORT_API 853 SCSI_PHYSICAL_ADDRESS 854 NTAPI 855 ScsiPortGetPhysicalAddress( 856 _In_ PVOID HwDeviceExtension, 857 _In_ PSCSI_REQUEST_BLOCK Srb, 858 _In_ PVOID VirtualAddress, 859 _Out_ ULONG *Length); 860 861 _Must_inspect_result_ 862 SCSIPORT_API 863 PSCSI_REQUEST_BLOCK 864 NTAPI 865 ScsiPortGetSrb( 866 _In_ PVOID DeviceExtension, 867 _In_ UCHAR PathId, 868 _In_ UCHAR TargetId, 869 _In_ UCHAR Lun, 870 _In_ LONG QueueTag); 871 872 _Must_inspect_result_ 873 SCSIPORT_API 874 PVOID 875 NTAPI 876 ScsiPortGetUncachedExtension( 877 _In_ PVOID HwDeviceExtension, 878 _In_ PPORT_CONFIGURATION_INFORMATION ConfigInfo, 879 _In_ ULONG NumberOfBytes); 880 881 _Must_inspect_result_ 882 SCSIPORT_API 883 PVOID 884 NTAPI 885 ScsiPortGetVirtualAddress( 886 _In_ PVOID HwDeviceExtension, 887 _In_ SCSI_PHYSICAL_ADDRESS PhysicalAddress); 888 889 _Must_inspect_result_ 890 _IRQL_requires_max_(PASSIVE_LEVEL) 891 SCSIPORT_API 892 ULONG 893 NTAPI 894 ScsiPortInitialize( 895 _In_ PVOID Argument1, 896 _In_ PVOID Argument2, 897 _In_ struct _HW_INITIALIZATION_DATA *HwInitializationData, 898 _In_ PVOID HwContext); 899 900 SCSIPORT_API 901 VOID 902 NTAPI 903 ScsiPortIoMapTransfer( 904 _In_ PVOID HwDeviceExtension, 905 _In_ PSCSI_REQUEST_BLOCK Srb, 906 _In_ PVOID LogicalAddress, 907 _In_ ULONG Length); 908 909 SCSIPORT_API 910 VOID 911 NTAPI 912 ScsiPortLogError( 913 _In_ PVOID HwDeviceExtension, 914 _In_opt_ PSCSI_REQUEST_BLOCK Srb, 915 _In_ UCHAR PathId, 916 _In_ UCHAR TargetId, 917 _In_ UCHAR Lun, 918 _In_ ULONG ErrorCode, 919 _In_ ULONG UniqueId); 920 921 SCSIPORT_API 922 VOID 923 __cdecl 924 ScsiPortNotification( 925 _In_ SCSI_NOTIFICATION_TYPE NotificationType, 926 _In_ PVOID HwDeviceExtension, 927 ...); 928 929 SCSIPORT_API 930 VOID 931 NTAPI 932 ScsiPortQuerySystemTime( 933 _Out_ PLARGE_INTEGER CurrentTime); 934 935 _Must_inspect_result_ 936 SCSIPORT_API 937 ULONG 938 NTAPI 939 ScsiPortSetBusDataByOffset( 940 _In_ PVOID DeviceExtension, 941 _In_ ULONG BusDataType, 942 _In_ ULONG SystemIoBusNumber, 943 _In_ ULONG SlotNumber, 944 _In_reads_bytes_(Length) PVOID Buffer, 945 _In_ ULONG Offset, 946 _In_ ULONG Length); 947 948 SCSIPORT_API 949 VOID 950 NTAPI 951 ScsiPortStallExecution( 952 _In_ ULONG Delay); 953 954 _Must_inspect_result_ 955 SCSIPORT_API 956 BOOLEAN 957 NTAPI 958 ScsiPortValidateRange( 959 _In_ PVOID HwDeviceExtension, 960 _In_ INTERFACE_TYPE BusType, 961 _In_ ULONG SystemIoBusNumber, 962 _In_ SCSI_PHYSICAL_ADDRESS IoAddress, 963 _In_ ULONG NumberOfBytes, 964 _In_ BOOLEAN InIoSpace); 965 966 SCSIPORT_API 967 VOID 968 __cdecl 969 ScsiDebugPrint( 970 ULONG DebugPrintLevel, 971 PCCHAR DebugMessage, 972 ...); 973 974 #if defined(_M_AMD64) 975 976 #define ScsiPortReadPortUchar READ_PORT_UCHAR 977 #define ScsiPortReadPortUshort READ_PORT_USHORT 978 #define ScsiPortReadPortUlong READ_PORT_ULONG 979 980 #define ScsiPortReadPortBufferUchar READ_PORT_BUFFER_UCHAR 981 #define ScsiPortReadPortBufferUshort READ_PORT_BUFFER_USHORT 982 #define ScsiPortReadPortBufferUlong READ_PORT_BUFFER_ULONG 983 984 #define ScsiPortReadRegisterUchar READ_REGISTER_UCHAR 985 #define ScsiPortReadRegisterUshort READ_REGISTER_USHORT 986 #define ScsiPortReadRegisterUlong READ_REGISTER_ULONG 987 988 #define ScsiPortReadRegisterBufferUchar READ_REGISTER_BUFFER_UCHAR 989 #define ScsiPortReadRegisterBufferUshort READ_REGISTER_BUFFER_USHORT 990 #define ScsiPortReadRegisterBufferUlong READ_REGISTER_BUFFER_ULONG 991 992 #define ScsiPortWritePortUchar WRITE_PORT_UCHAR 993 #define ScsiPortWritePortUshort WRITE_PORT_USHORT 994 #define ScsiPortWritePortUlong WRITE_PORT_ULONG 995 996 #define ScsiPortWritePortBufferUchar WRITE_PORT_BUFFER_UCHAR 997 #define ScsiPortWritePortBufferUshort WRITE_PORT_BUFFER_USHORT 998 #define ScsiPortWritePortBufferUlong WRITE_PORT_BUFFER_ULONG 999 1000 #define ScsiPortWriteRegisterUchar WRITE_REGISTER_UCHAR 1001 #define ScsiPortWriteRegisterUshort WRITE_REGISTER_USHORT 1002 #define ScsiPortWriteRegisterUlong WRITE_REGISTER_ULONG 1003 1004 #define ScsiPortWriteRegisterBufferUchar WRITE_REGISTER_BUFFER_UCHAR 1005 #define ScsiPortWriteRegisterBufferUshort WRITE_REGISTER_BUFFER_USHORT 1006 #define ScsiPortWriteRegisterBufferUlong WRITE_REGISTER_BUFFER_ULONG 1007 1008 #define ScsiPortMoveMemory memmove 1009 1010 #else 1011 1012 _Must_inspect_result_ 1013 SCSIPORT_API 1014 UCHAR 1015 NTAPI 1016 ScsiPortReadPortUchar( 1017 _In_ PUCHAR Port); 1018 1019 _Must_inspect_result_ 1020 SCSIPORT_API 1021 ULONG 1022 NTAPI 1023 ScsiPortReadPortUlong( 1024 _In_ PULONG Port); 1025 1026 _Must_inspect_result_ 1027 SCSIPORT_API 1028 USHORT 1029 NTAPI 1030 ScsiPortReadPortUshort( 1031 _In_ PUSHORT Port); 1032 1033 SCSIPORT_API 1034 VOID 1035 NTAPI 1036 ScsiPortReadPortBufferUchar( 1037 _In_ PUCHAR Port, 1038 _In_ PUCHAR Buffer, 1039 _In_ ULONG Count); 1040 1041 SCSIPORT_API 1042 VOID 1043 NTAPI 1044 ScsiPortReadPortBufferUlong( 1045 _In_ PULONG Port, 1046 _In_ PULONG Buffer, 1047 _In_ ULONG Count); 1048 1049 SCSIPORT_API 1050 VOID 1051 NTAPI 1052 ScsiPortReadPortBufferUshort( 1053 _In_ PUSHORT Port, 1054 _In_ PUSHORT Buffer, 1055 _In_ ULONG Count); 1056 1057 _Must_inspect_result_ 1058 SCSIPORT_API 1059 UCHAR 1060 NTAPI 1061 ScsiPortReadRegisterUchar( 1062 _In_ PUCHAR Register); 1063 1064 _Must_inspect_result_ 1065 SCSIPORT_API 1066 ULONG 1067 NTAPI 1068 ScsiPortReadRegisterUlong( 1069 _In_ PULONG Register); 1070 1071 _Must_inspect_result_ 1072 SCSIPORT_API 1073 USHORT 1074 NTAPI 1075 ScsiPortReadRegisterUshort( 1076 _In_ PUSHORT Register); 1077 1078 SCSIPORT_API 1079 VOID 1080 NTAPI 1081 ScsiPortReadRegisterBufferUchar( 1082 _In_ PUCHAR Register, 1083 _In_ PUCHAR Buffer, 1084 _In_ ULONG Count); 1085 1086 SCSIPORT_API 1087 VOID 1088 NTAPI 1089 ScsiPortReadRegisterBufferUlong( 1090 _In_ PULONG Register, 1091 _In_ PULONG Buffer, 1092 _In_ ULONG Count); 1093 1094 SCSIPORT_API 1095 VOID 1096 NTAPI 1097 ScsiPortReadRegisterBufferUshort( 1098 _In_ PUSHORT Register, 1099 _In_ PUSHORT Buffer, 1100 _In_ ULONG Count); 1101 1102 SCSIPORT_API 1103 VOID 1104 NTAPI 1105 ScsiPortWritePortUchar( 1106 _In_ PUCHAR Port, 1107 _In_ UCHAR Value); 1108 1109 SCSIPORT_API 1110 VOID 1111 NTAPI 1112 ScsiPortWritePortUlong( 1113 _In_ PULONG Port, 1114 _In_ ULONG Value); 1115 1116 SCSIPORT_API 1117 VOID 1118 NTAPI 1119 ScsiPortWritePortUshort( 1120 _In_ PUSHORT Port, 1121 _In_ USHORT Value); 1122 1123 SCSIPORT_API 1124 VOID 1125 NTAPI 1126 ScsiPortWritePortBufferUchar( 1127 _In_ PUCHAR Port, 1128 _In_ PUCHAR Buffer, 1129 _In_ ULONG Count); 1130 1131 SCSIPORT_API 1132 VOID 1133 NTAPI 1134 ScsiPortWritePortBufferUlong( 1135 _In_ PULONG Port, 1136 _In_ PULONG Buffer, 1137 _In_ ULONG Count); 1138 1139 SCSIPORT_API 1140 VOID 1141 NTAPI 1142 ScsiPortWritePortBufferUshort( 1143 _In_ PUSHORT Port, 1144 _In_ PUSHORT Buffer, 1145 _In_ ULONG Count); 1146 1147 SCSIPORT_API 1148 VOID 1149 NTAPI 1150 ScsiPortWriteRegisterUchar( 1151 _In_ PUCHAR Register, 1152 _In_ UCHAR Value); 1153 1154 SCSIPORT_API 1155 VOID 1156 NTAPI 1157 ScsiPortWriteRegisterUlong( 1158 _In_ PULONG Register, 1159 _In_ ULONG Value); 1160 1161 SCSIPORT_API 1162 VOID 1163 NTAPI 1164 ScsiPortWriteRegisterUshort( 1165 _In_ PUSHORT Register, 1166 _In_ USHORT Value); 1167 1168 SCSIPORT_API 1169 VOID 1170 NTAPI 1171 ScsiPortWriteRegisterBufferUchar( 1172 _In_ PUCHAR Register, 1173 _In_ PUCHAR Buffer, 1174 _In_ ULONG Count); 1175 1176 SCSIPORT_API 1177 VOID 1178 NTAPI 1179 ScsiPortWriteRegisterBufferUlong( 1180 _In_ PULONG Register, 1181 _In_ PULONG Buffer, 1182 _In_ ULONG Count); 1183 1184 SCSIPORT_API 1185 VOID 1186 NTAPI 1187 ScsiPortWriteRegisterBufferUshort( 1188 _In_ PUSHORT Register, 1189 _In_ PUSHORT Buffer, 1190 _In_ ULONG Count); 1191 1192 SCSIPORT_API 1193 VOID 1194 NTAPI 1195 ScsiPortMoveMemory( 1196 _In_ PVOID WriteBuffer, 1197 _In_ PVOID ReadBuffer, 1198 _In_ ULONG Length); 1199 1200 #endif /* defined(_M_AMD64) */ 1201 1202 #ifdef __cplusplus 1203 } 1204 #endif 1205 1206 #endif /* _NTSRB_ */ 1207