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_ABORT_COMMAND 0x10 80 #define SRB_FUNCTION_RELEASE_RECOVERY 0x11 81 #define SRB_FUNCTION_RESET_BUS 0x12 82 #define SRB_FUNCTION_RESET_DEVICE 0x13 83 #define SRB_FUNCTION_TERMINATE_IO 0x14 84 #define SRB_FUNCTION_FLUSH_QUEUE 0x15 85 #define SRB_FUNCTION_REMOVE_DEVICE 0x16 86 #define SRB_FUNCTION_WMI 0x17 87 #define SRB_FUNCTION_LOCK_QUEUE 0x18 88 #define SRB_FUNCTION_UNLOCK_QUEUE 0x19 89 #define SRB_FUNCTION_RESET_LOGICAL_UNIT 0x20 90 #define SRB_FUNCTION_SET_LINK_TIMEOUT 0x21 91 #define SRB_FUNCTION_LINK_TIMEOUT_OCCURRED 0x22 92 #define SRB_FUNCTION_LINK_TIMEOUT_COMPLETE 0x23 93 #define SRB_FUNCTION_POWER 0x24 94 #define SRB_FUNCTION_PNP 0x25 95 #define SRB_FUNCTION_DUMP_POINTERS 0x26 96 97 /* SCSI_REQUEST_BLOCK.SrbStatus constants */ 98 #define SRB_STATUS_PENDING 0x00 99 #define SRB_STATUS_SUCCESS 0x01 100 #define SRB_STATUS_ABORTED 0x02 101 #define SRB_STATUS_ABORT_FAILED 0x03 102 #define SRB_STATUS_ERROR 0x04 103 #define SRB_STATUS_BUSY 0x05 104 #define SRB_STATUS_INVALID_REQUEST 0x06 105 #define SRB_STATUS_INVALID_PATH_ID 0x07 106 #define SRB_STATUS_NO_DEVICE 0x08 107 #define SRB_STATUS_TIMEOUT 0x09 108 #define SRB_STATUS_SELECTION_TIMEOUT 0x0A 109 #define SRB_STATUS_COMMAND_TIMEOUT 0x0B 110 #define SRB_STATUS_MESSAGE_REJECTED 0x0D 111 #define SRB_STATUS_BUS_RESET 0x0E 112 #define SRB_STATUS_PARITY_ERROR 0x0F 113 #define SRB_STATUS_REQUEST_SENSE_FAILED 0x10 114 #define SRB_STATUS_NO_HBA 0x11 115 #define SRB_STATUS_DATA_OVERRUN 0x12 116 #define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13 117 #define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14 118 #define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15 119 #define SRB_STATUS_REQUEST_FLUSHED 0x16 120 #define SRB_STATUS_INVALID_LUN 0x20 121 #define SRB_STATUS_INVALID_TARGET_ID 0x21 122 #define SRB_STATUS_BAD_FUNCTION 0x22 123 #define SRB_STATUS_ERROR_RECOVERY 0x23 124 #define SRB_STATUS_NOT_POWERED 0x24 125 #define SRB_STATUS_LINK_DOWN 0x25 126 #define SRB_STATUS_INTERNAL_ERROR 0x30 127 128 #define SRB_STATUS_QUEUE_FROZEN 0x40 129 #define SRB_STATUS_AUTOSENSE_VALID 0x80 130 131 #define SRB_STATUS(Status) \ 132 (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN)) 133 134 /* SCSI_REQUEST_BLOCK.SrbFlags constants */ 135 #define SRB_FLAGS_QUEUE_ACTION_ENABLE 0x00000002 136 #define SRB_FLAGS_DISABLE_DISCONNECT 0x00000004 137 #define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008 138 #define SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x00000010 139 #define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020 140 #define SRB_FLAGS_DATA_IN 0x00000040 141 #define SRB_FLAGS_DATA_OUT 0x00000080 142 #define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000 143 #define SRB_FLAGS_UNSPECIFIED_DIRECTION (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT) 144 #define SRB_FLAGS_NO_QUEUE_FREEZE 0x00000100 145 #define SRB_FLAGS_ADAPTER_CACHE_ENABLE 0x00000200 146 #define SRB_FLAGS_FREE_SENSE_BUFFER 0x00000400 147 #define SRB_FLAGS_IS_ACTIVE 0x00010000 148 #define SRB_FLAGS_ALLOCATED_FROM_ZONE 0x00020000 149 #define SRB_FLAGS_SGLIST_FROM_POOL 0x00040000 150 #define SRB_FLAGS_BYPASS_LOCKED_QUEUE 0x00080000 151 #define SRB_FLAGS_NO_KEEP_AWAKE 0x00100000 152 #define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE 0x00200000 153 #define SRB_FLAGS_PORT_DRIVER_SENSEHASPORT 0x00400000 154 #define SRB_FLAGS_DONT_START_NEXT_PACKET 0x00800000 155 #define SRB_FLAGS_PORT_DRIVER_RESERVED 0x0F000000 156 #define SRB_FLAGS_CLASS_DRIVER_RESERVED 0xF0000000 157 158 #if DBG 159 #define SCSI_PORT_SIGNATURE 0x54524f50 160 #endif 161 162 #define SRB_SIMPLE_TAG_REQUEST 0x20 163 #define SRB_HEAD_OF_QUEUE_TAG_REQUEST 0x21 164 #define SRB_ORDERED_QUEUE_TAG_REQUEST 0x22 165 166 #define SRB_WMI_FLAGS_ADAPTER_REQUEST 0x0001 167 #define SRB_POWER_FLAGS_ADAPTER_REQUEST 0x0001 168 #define SRB_PNP_FLAGS_ADAPTER_REQUEST 0x0001 169 170 #define SP_BUS_PARITY_ERROR 0x0001 171 #define SP_UNEXPECTED_DISCONNECT 0x0002 172 #define SP_INVALID_RESELECTION 0x0003 173 #define SP_BUS_TIME_OUT 0x0004 174 #define SP_PROTOCOL_ERROR 0x0005 175 #define SP_INTERNAL_ADAPTER_ERROR 0x0006 176 #define SP_REQUEST_TIMEOUT 0x0007 177 #define SP_IRQ_NOT_RESPONDING 0x0008 178 #define SP_BAD_FW_WARNING 0x0009 179 #define SP_BAD_FW_ERROR 0x000a 180 #define SP_LOST_WMI_MINIPORT_REQUEST 0x000b 181 182 #define SP_VER_TRACE_SUPPORT 0x0010 183 184 #define SP_RETURN_NOT_FOUND 0 185 #define SP_RETURN_FOUND 1 186 #define SP_RETURN_ERROR 2 187 #define SP_RETURN_BAD_CONFIG 3 188 189 typedef PHYSICAL_ADDRESS SCSI_PHYSICAL_ADDRESS, *PSCSI_PHYSICAL_ADDRESS; 190 191 typedef struct _ACCESS_RANGE { 192 SCSI_PHYSICAL_ADDRESS RangeStart; 193 ULONG RangeLength; 194 BOOLEAN RangeInMemory; 195 } ACCESS_RANGE, *PACCESS_RANGE; 196 197 typedef struct _PORT_CONFIGURATION_INFORMATION { 198 ULONG Length; 199 ULONG SystemIoBusNumber; 200 INTERFACE_TYPE AdapterInterfaceType; 201 ULONG BusInterruptLevel; 202 ULONG BusInterruptVector; 203 KINTERRUPT_MODE InterruptMode; 204 ULONG MaximumTransferLength; 205 ULONG NumberOfPhysicalBreaks; 206 ULONG DmaChannel; 207 ULONG DmaPort; 208 DMA_WIDTH DmaWidth; 209 DMA_SPEED DmaSpeed; 210 ULONG AlignmentMask; 211 ULONG NumberOfAccessRanges; 212 ACCESS_RANGE (*AccessRanges)[]; 213 PVOID Reserved; 214 UCHAR NumberOfBuses; 215 UCHAR InitiatorBusId[8]; 216 BOOLEAN ScatterGather; 217 BOOLEAN Master; 218 BOOLEAN CachesData; 219 BOOLEAN AdapterScansDown; 220 BOOLEAN AtdiskPrimaryClaimed; 221 BOOLEAN AtdiskSecondaryClaimed; 222 BOOLEAN Dma32BitAddresses; 223 BOOLEAN DemandMode; 224 BOOLEAN MapBuffers; 225 BOOLEAN NeedPhysicalAddresses; 226 BOOLEAN TaggedQueuing; 227 BOOLEAN AutoRequestSense; 228 BOOLEAN MultipleRequestPerLu; 229 BOOLEAN ReceiveEvent; 230 BOOLEAN RealModeInitialized; 231 BOOLEAN BufferAccessScsiPortControlled; 232 UCHAR MaximumNumberOfTargets; 233 UCHAR ReservedUchars[2]; 234 ULONG SlotNumber; 235 ULONG BusInterruptLevel2; 236 ULONG BusInterruptVector2; 237 KINTERRUPT_MODE InterruptMode2; 238 ULONG DmaChannel2; 239 ULONG DmaPort2; 240 DMA_WIDTH DmaWidth2; 241 DMA_SPEED DmaSpeed2; 242 ULONG DeviceExtensionSize; 243 ULONG SpecificLuExtensionSize; 244 ULONG SrbExtensionSize; 245 UCHAR Dma64BitAddresses; 246 BOOLEAN ResetTargetSupported; 247 UCHAR MaximumNumberOfLogicalUnits; 248 BOOLEAN WmiDataProvider; 249 } PORT_CONFIGURATION_INFORMATION, *PPORT_CONFIGURATION_INFORMATION; 250 251 #define CONFIG_INFO_VERSION_2 sizeof(PORT_CONFIGURATION_INFORMATION) 252 253 #ifdef __GNUC__ 254 __extension__ /* enums limited to range of integer */ 255 #endif 256 typedef enum _SCSI_ADAPTER_CONTROL_TYPE { 257 ScsiQuerySupportedControlTypes = 0, 258 ScsiStopAdapter, 259 ScsiRestartAdapter, 260 ScsiSetBootConfig, 261 ScsiSetRunningConfig, 262 ScsiAdapterControlMax, 263 MakeAdapterControlTypeSizeOfUlong = 0xffffffff 264 } SCSI_ADAPTER_CONTROL_TYPE, *PSCSI_ADAPTER_CONTROL_TYPE; 265 266 typedef enum _SCSI_ADAPTER_CONTROL_STATUS { 267 ScsiAdapterControlSuccess = 0, 268 ScsiAdapterControlUnsuccessful 269 } SCSI_ADAPTER_CONTROL_STATUS, *PSCSI_ADAPTER_CONTROL_STATUS; 270 271 typedef struct _SCSI_SUPPORTED_CONTROL_TYPE_LIST { 272 ULONG MaxControlType; 273 BOOLEAN SupportedTypeList[0]; 274 } SCSI_SUPPORTED_CONTROL_TYPE_LIST, *PSCSI_SUPPORTED_CONTROL_TYPE_LIST; 275 276 typedef struct _SCSI_REQUEST_BLOCK { 277 USHORT Length; 278 UCHAR Function; 279 UCHAR SrbStatus; 280 UCHAR ScsiStatus; 281 UCHAR PathId; 282 UCHAR TargetId; 283 UCHAR Lun; 284 UCHAR QueueTag; 285 UCHAR QueueAction; 286 UCHAR CdbLength; 287 UCHAR SenseInfoBufferLength; 288 ULONG SrbFlags; 289 ULONG DataTransferLength; 290 ULONG TimeOutValue; 291 _Field_size_bytes_(DataTransferLength) PVOID DataBuffer; 292 PVOID SenseInfoBuffer; 293 struct _SCSI_REQUEST_BLOCK *NextSrb; 294 PVOID OriginalRequest; 295 PVOID SrbExtension; 296 _ANONYMOUS_UNION union { 297 ULONG InternalStatus; 298 ULONG QueueSortKey; 299 ULONG LinkTimeoutValue; 300 } DUMMYUNIONNAME; 301 #if defined(_WIN64) 302 ULONG Reserved; 303 #endif 304 UCHAR Cdb[16]; 305 } SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK; 306 307 #define SCSI_REQUEST_BLOCK_SIZE sizeof(SCSI_REQUEST_BLOCK) 308 309 typedef struct _SCSI_WMI_REQUEST_BLOCK { 310 USHORT Length; 311 UCHAR Function; 312 UCHAR SrbStatus; 313 UCHAR WMISubFunction; 314 UCHAR PathId; 315 UCHAR TargetId; 316 UCHAR Lun; 317 UCHAR Reserved1; 318 UCHAR WMIFlags; 319 UCHAR Reserved2[2]; 320 ULONG SrbFlags; 321 ULONG DataTransferLength; 322 ULONG TimeOutValue; 323 PVOID DataBuffer; 324 PVOID DataPath; 325 PVOID Reserved3; 326 PVOID OriginalRequest; 327 PVOID SrbExtension; 328 ULONG Reserved4; 329 #if (NTDDI_VERSION >= NTDDI_WS03SP1) && defined(_WIN64) 330 ULONG Reserved6; 331 #endif 332 UCHAR Reserved5[16]; 333 } SCSI_WMI_REQUEST_BLOCK, *PSCSI_WMI_REQUEST_BLOCK; 334 335 typedef enum _STOR_DEVICE_POWER_STATE { 336 StorPowerDeviceUnspecified = 0, 337 StorPowerDeviceD0, 338 StorPowerDeviceD1, 339 StorPowerDeviceD2, 340 StorPowerDeviceD3, 341 StorPowerDeviceMaximum 342 } STOR_DEVICE_POWER_STATE, *PSTOR_DEVICE_POWER_STATE; 343 344 typedef enum _STOR_POWER_ACTION { 345 StorPowerActionNone = 0, 346 StorPowerActionReserved, 347 StorPowerActionSleep, 348 StorPowerActionHibernate, 349 StorPowerActionShutdown, 350 StorPowerActionShutdownReset, 351 StorPowerActionShutdownOff, 352 StorPowerActionWarmEject 353 } STOR_POWER_ACTION, *PSTOR_POWER_ACTION; 354 355 typedef struct _SCSI_POWER_REQUEST_BLOCK { 356 USHORT Length; 357 UCHAR Function; 358 UCHAR SrbStatus; 359 UCHAR SrbPowerFlags; 360 UCHAR PathId; 361 UCHAR TargetId; 362 UCHAR Lun; 363 STOR_DEVICE_POWER_STATE DevicePowerState; 364 ULONG SrbFlags; 365 ULONG DataTransferLength; 366 ULONG TimeOutValue; 367 PVOID DataBuffer; 368 PVOID SenseInfoBuffer; 369 struct _SCSI_REQUEST_BLOCK *NextSrb; 370 PVOID OriginalRequest; 371 PVOID SrbExtension; 372 STOR_POWER_ACTION PowerAction; 373 #if defined(_WIN64) 374 ULONG Reserved; 375 #endif 376 UCHAR Reserved5[16]; 377 } SCSI_POWER_REQUEST_BLOCK, *PSCSI_POWER_REQUEST_BLOCK; 378 379 typedef enum _STOR_PNP_ACTION { 380 StorStartDevice = 0x0, 381 StorRemoveDevice = 0x2, 382 StorStopDevice = 0x4, 383 StorQueryCapabilities = 0x9, 384 StorQueryResourceRequirements = 0xB, 385 StorFilterResourceRequirements = 0xD, 386 StorSurpriseRemoval = 0x17 387 } STOR_PNP_ACTION, *PSTOR_PNP_ACTION; 388 389 typedef struct _STOR_DEVICE_CAPABILITIES { 390 USHORT Version; 391 ULONG DeviceD1:1; 392 ULONG DeviceD2:1; 393 ULONG LockSupported:1; 394 ULONG EjectSupported:1; 395 ULONG Removable:1; 396 ULONG DockDevice:1; 397 ULONG UniqueID:1; 398 ULONG SilentInstall:1; 399 ULONG SurpriseRemovalOK:1; 400 ULONG NoDisplayInUI:1; 401 } STOR_DEVICE_CAPABILITIES, *PSTOR_DEVICE_CAPABILITIES; 402 403 typedef struct _SCSI_PNP_REQUEST_BLOCK { 404 USHORT Length; 405 UCHAR Function; 406 UCHAR SrbStatus; 407 UCHAR PnPSubFunction; 408 UCHAR PathId; 409 UCHAR TargetId; 410 UCHAR Lun; 411 STOR_PNP_ACTION PnPAction; 412 ULONG SrbFlags; 413 ULONG DataTransferLength; 414 ULONG TimeOutValue; 415 PVOID DataBuffer; 416 PVOID SenseInfoBuffer; 417 struct _SCSI_REQUEST_BLOCK *NextSrb; 418 PVOID OriginalRequest; 419 PVOID SrbExtension; 420 ULONG SrbPnPFlags; 421 #if defined(_WIN64) 422 ULONG Reserved; 423 #endif 424 UCHAR Reserved4[16]; 425 } SCSI_PNP_REQUEST_BLOCK, *PSCSI_PNP_REQUEST_BLOCK; 426 427 typedef 428 _Must_inspect_result_ 429 BOOLEAN 430 (NTAPI *PHW_INITIALIZE)( 431 _In_ PVOID DeviceExtension); 432 433 typedef 434 _Must_inspect_result_ 435 BOOLEAN 436 (NTAPI *PHW_STARTIO)( 437 _In_ PVOID DeviceExtension, 438 _In_ PSCSI_REQUEST_BLOCK Srb); 439 440 typedef 441 _Must_inspect_result_ 442 BOOLEAN 443 (NTAPI *PHW_INTERRUPT)( 444 _In_ PVOID DeviceExtension); 445 446 typedef VOID 447 (NTAPI *PHW_TIMER)( 448 _In_ PVOID DeviceExtension); 449 450 typedef VOID 451 (NTAPI *PHW_DMA_STARTED)( 452 _In_ PVOID DeviceExtension); 453 454 typedef 455 _Must_inspect_result_ 456 ULONG 457 (NTAPI *PHW_FIND_ADAPTER)( 458 _In_ PVOID DeviceExtension, 459 _In_ PVOID HwContext, 460 _In_ PVOID BusInformation, 461 _In_ PCHAR ArgumentString, 462 _Inout_ PPORT_CONFIGURATION_INFORMATION ConfigInfo, 463 _Out_ PBOOLEAN Again); 464 465 typedef 466 _Must_inspect_result_ 467 BOOLEAN 468 (NTAPI *PHW_RESET_BUS)( 469 _In_ PVOID DeviceExtension, 470 _In_ ULONG PathId); 471 472 typedef 473 _Must_inspect_result_ 474 BOOLEAN 475 (NTAPI *PHW_ADAPTER_STATE)( 476 _In_ PVOID DeviceExtension, 477 _In_ PVOID Context, 478 _In_ BOOLEAN SaveState); 479 480 typedef 481 _Must_inspect_result_ 482 SCSI_ADAPTER_CONTROL_STATUS 483 (NTAPI *PHW_ADAPTER_CONTROL)( 484 _In_ PVOID DeviceExtension, 485 _In_ SCSI_ADAPTER_CONTROL_TYPE ControlType, 486 _In_ PVOID Parameters); 487 488 typedef enum _SCSI_NOTIFICATION_TYPE { 489 RequestComplete, 490 NextRequest, 491 NextLuRequest, 492 ResetDetected, 493 CallDisableInterrupts, 494 CallEnableInterrupts, 495 RequestTimerCall, 496 BusChangeDetected, 497 WMIEvent, 498 WMIReregister, 499 LinkUp, 500 LinkDown, 501 QueryTickCount, 502 BufferOverrunDetected, 503 TraceNotification 504 } SCSI_NOTIFICATION_TYPE, *PSCSI_NOTIFICATION_TYPE; 505 506 typedef struct _HW_INITIALIZATION_DATA { 507 ULONG HwInitializationDataSize; 508 INTERFACE_TYPE AdapterInterfaceType; 509 PHW_INITIALIZE HwInitialize; 510 PHW_STARTIO HwStartIo; 511 PHW_INTERRUPT HwInterrupt; 512 PHW_FIND_ADAPTER HwFindAdapter; 513 PHW_RESET_BUS HwResetBus; 514 PHW_DMA_STARTED HwDmaStarted; 515 PHW_ADAPTER_STATE HwAdapterState; 516 ULONG DeviceExtensionSize; 517 ULONG SpecificLuExtensionSize; 518 ULONG SrbExtensionSize; 519 ULONG NumberOfAccessRanges; 520 PVOID Reserved; 521 BOOLEAN MapBuffers; 522 BOOLEAN NeedPhysicalAddresses; 523 BOOLEAN TaggedQueuing; 524 BOOLEAN AutoRequestSense; 525 BOOLEAN MultipleRequestPerLu; 526 BOOLEAN ReceiveEvent; 527 USHORT VendorIdLength; 528 PVOID VendorId; 529 _ANONYMOUS_UNION union { 530 USHORT ReservedUshort; 531 USHORT PortVersionFlags; 532 } DUMMYUNIONNAME; 533 USHORT DeviceIdLength; 534 PVOID DeviceId; 535 PHW_ADAPTER_CONTROL HwAdapterControl; 536 } HW_INITIALIZATION_DATA, *PHW_INITIALIZATION_DATA; 537 538 #if defined(_NTDDK_) 539 #define SCSIPORTAPI 540 #else 541 #define SCSIPORTAPI DECLSPEC_IMPORT 542 #endif 543 544 SCSIPORTAPI 545 VOID 546 NTAPI 547 ScsiPortCompleteRequest( 548 _In_ PVOID HwDeviceExtension, 549 _In_ UCHAR PathId, 550 _In_ UCHAR TargetId, 551 _In_ UCHAR Lun, 552 _In_ UCHAR SrbStatus); 553 554 _Must_inspect_result_ 555 SCSIPORTAPI 556 ULONG 557 NTAPI 558 ScsiPortConvertPhysicalAddressToUlong( 559 _In_ SCSI_PHYSICAL_ADDRESS Address); 560 561 #define ScsiPortConvertPhysicalAddressToUlong(Address) ((Address).LowPart) 562 #define ScsiPortConvertPhysicalAddressToULongPtr(Address) ((ULONG_PTR)((Address).QuadPart)) 563 564 _Must_inspect_result_ 565 SCSIPORTAPI 566 SCSI_PHYSICAL_ADDRESS 567 NTAPI 568 ScsiPortConvertUlongToPhysicalAddress( 569 _In_ ULONG_PTR UlongAddress); 570 571 SCSIPORTAPI 572 VOID 573 NTAPI 574 ScsiPortFlushDma( 575 _In_ PVOID DeviceExtension); 576 577 SCSIPORTAPI 578 VOID 579 NTAPI 580 ScsiPortFreeDeviceBase( 581 _In_ PVOID HwDeviceExtension, 582 _In_ PVOID MappedAddress); 583 584 _Must_inspect_result_ 585 SCSIPORTAPI 586 ULONG 587 NTAPI 588 ScsiPortGetBusData( 589 _In_ PVOID DeviceExtension, 590 _In_ ULONG BusDataType, 591 _In_ ULONG SystemIoBusNumber, 592 _In_ ULONG SlotNumber, 593 _In_reads_bytes_(Length) PVOID Buffer, 594 _In_ ULONG Length); 595 596 _Must_inspect_result_ 597 SCSIPORTAPI 598 PVOID 599 NTAPI 600 ScsiPortGetDeviceBase( 601 _In_ PVOID HwDeviceExtension, 602 _In_ INTERFACE_TYPE BusType, 603 _In_ ULONG SystemIoBusNumber, 604 _In_ SCSI_PHYSICAL_ADDRESS IoAddress, 605 _In_ ULONG NumberOfBytes, 606 _In_ BOOLEAN InIoSpace); 607 608 _Must_inspect_result_ 609 SCSIPORTAPI 610 PVOID 611 NTAPI 612 ScsiPortGetLogicalUnit( 613 _In_ PVOID HwDeviceExtension, 614 _In_ UCHAR PathId, 615 _In_ UCHAR TargetId, 616 _In_ UCHAR Lun); 617 618 _Must_inspect_result_ 619 SCSIPORTAPI 620 SCSI_PHYSICAL_ADDRESS 621 NTAPI 622 ScsiPortGetPhysicalAddress( 623 _In_ PVOID HwDeviceExtension, 624 _In_ PSCSI_REQUEST_BLOCK Srb, 625 _In_ PVOID VirtualAddress, 626 _Out_ ULONG *Length); 627 628 _Must_inspect_result_ 629 SCSIPORTAPI 630 PSCSI_REQUEST_BLOCK 631 NTAPI 632 ScsiPortGetSrb( 633 _In_ PVOID DeviceExtension, 634 _In_ UCHAR PathId, 635 _In_ UCHAR TargetId, 636 _In_ UCHAR Lun, 637 _In_ LONG QueueTag); 638 639 _Must_inspect_result_ 640 SCSIPORTAPI 641 PVOID 642 NTAPI 643 ScsiPortGetUncachedExtension( 644 _In_ PVOID HwDeviceExtension, 645 _In_ PPORT_CONFIGURATION_INFORMATION ConfigInfo, 646 _In_ ULONG NumberOfBytes); 647 648 _Must_inspect_result_ 649 SCSIPORTAPI 650 PVOID 651 NTAPI 652 ScsiPortGetVirtualAddress( 653 _In_ PVOID HwDeviceExtension, 654 _In_ SCSI_PHYSICAL_ADDRESS PhysicalAddress); 655 656 _Must_inspect_result_ 657 _IRQL_requires_max_(PASSIVE_LEVEL) 658 SCSIPORTAPI 659 ULONG 660 NTAPI 661 ScsiPortInitialize( 662 _In_ PVOID Argument1, 663 _In_ PVOID Argument2, 664 _In_ struct _HW_INITIALIZATION_DATA *HwInitializationData, 665 _In_ PVOID HwContext); 666 667 SCSIPORTAPI 668 VOID 669 NTAPI 670 ScsiPortIoMapTransfer( 671 _In_ PVOID HwDeviceExtension, 672 _In_ PSCSI_REQUEST_BLOCK Srb, 673 _In_ PVOID LogicalAddress, 674 _In_ ULONG Length); 675 676 SCSIPORTAPI 677 VOID 678 NTAPI 679 ScsiPortLogError( 680 _In_ PVOID HwDeviceExtension, 681 _In_opt_ PSCSI_REQUEST_BLOCK Srb, 682 _In_ UCHAR PathId, 683 _In_ UCHAR TargetId, 684 _In_ UCHAR Lun, 685 _In_ ULONG ErrorCode, 686 _In_ ULONG UniqueId); 687 688 SCSIPORTAPI 689 VOID 690 __cdecl 691 ScsiPortNotification( 692 _In_ SCSI_NOTIFICATION_TYPE NotificationType, 693 _In_ PVOID HwDeviceExtension, 694 ...); 695 696 SCSIPORTAPI 697 VOID 698 NTAPI 699 ScsiPortQuerySystemTime( 700 _Out_ PLARGE_INTEGER CurrentTime); 701 702 _Must_inspect_result_ 703 SCSIPORTAPI 704 ULONG 705 NTAPI 706 ScsiPortSetBusDataByOffset( 707 _In_ PVOID DeviceExtension, 708 _In_ ULONG BusDataType, 709 _In_ ULONG SystemIoBusNumber, 710 _In_ ULONG SlotNumber, 711 _In_reads_bytes_(Length) PVOID Buffer, 712 _In_ ULONG Offset, 713 _In_ ULONG Length); 714 715 SCSIPORTAPI 716 VOID 717 NTAPI 718 ScsiPortStallExecution( 719 _In_ ULONG Delay); 720 721 _Must_inspect_result_ 722 SCSIPORTAPI 723 BOOLEAN 724 NTAPI 725 ScsiPortValidateRange( 726 _In_ PVOID HwDeviceExtension, 727 _In_ INTERFACE_TYPE BusType, 728 _In_ ULONG SystemIoBusNumber, 729 _In_ SCSI_PHYSICAL_ADDRESS IoAddress, 730 _In_ ULONG NumberOfBytes, 731 _In_ BOOLEAN InIoSpace); 732 733 SCSIPORTAPI 734 VOID 735 __cdecl 736 ScsiDebugPrint( 737 ULONG DebugPrintLevel, 738 PCCHAR DebugMessage, 739 ...); 740 741 #if defined(_M_AMD64) 742 743 #define ScsiPortReadPortUchar READ_PORT_UCHAR 744 #define ScsiPortReadPortUshort READ_PORT_USHORT 745 #define ScsiPortReadPortUlong READ_PORT_ULONG 746 747 #define ScsiPortReadPortBufferUchar READ_PORT_BUFFER_UCHAR 748 #define ScsiPortReadPortBufferUshort READ_PORT_BUFFER_USHORT 749 #define ScsiPortReadPortBufferUlong READ_PORT_BUFFER_ULONG 750 751 #define ScsiPortReadRegisterUchar READ_REGISTER_UCHAR 752 #define ScsiPortReadRegisterUshort READ_REGISTER_USHORT 753 #define ScsiPortReadRegisterUlong READ_REGISTER_ULONG 754 755 #define ScsiPortReadRegisterBufferUchar READ_REGISTER_BUFFER_UCHAR 756 #define ScsiPortReadRegisterBufferUshort READ_REGISTER_BUFFER_USHORT 757 #define ScsiPortReadRegisterBufferUlong READ_REGISTER_BUFFER_ULONG 758 759 #define ScsiPortWritePortUchar WRITE_PORT_UCHAR 760 #define ScsiPortWritePortUshort WRITE_PORT_USHORT 761 #define ScsiPortWritePortUlong WRITE_PORT_ULONG 762 763 #define ScsiPortWritePortBufferUchar WRITE_PORT_BUFFER_UCHAR 764 #define ScsiPortWritePortBufferUshort WRITE_PORT_BUFFER_USHORT 765 #define ScsiPortWritePortBufferUlong WRITE_PORT_BUFFER_ULONG 766 767 #define ScsiPortWriteRegisterUchar WRITE_REGISTER_UCHAR 768 #define ScsiPortWriteRegisterUshort WRITE_REGISTER_USHORT 769 #define ScsiPortWriteRegisterUlong WRITE_REGISTER_ULONG 770 771 #define ScsiPortWriteRegisterBufferUchar WRITE_REGISTER_BUFFER_UCHAR 772 #define ScsiPortWriteRegisterBufferUshort WRITE_REGISTER_BUFFER_USHORT 773 #define ScsiPortWriteRegisterBufferUlong WRITE_REGISTER_BUFFER_ULONG 774 775 #define ScsiPortMoveMemory memmove 776 777 #else 778 779 _Must_inspect_result_ 780 SCSIPORTAPI 781 UCHAR 782 NTAPI 783 ScsiPortReadPortUchar( 784 _In_ PUCHAR Port); 785 786 _Must_inspect_result_ 787 SCSIPORTAPI 788 ULONG 789 NTAPI 790 ScsiPortReadPortUlong( 791 _In_ PULONG Port); 792 793 _Must_inspect_result_ 794 SCSIPORTAPI 795 USHORT 796 NTAPI 797 ScsiPortReadPortUshort( 798 _In_ PUSHORT Port); 799 800 SCSIPORTAPI 801 VOID 802 NTAPI 803 ScsiPortReadPortBufferUchar( 804 _In_ PUCHAR Port, 805 _In_ PUCHAR Buffer, 806 _In_ ULONG Count); 807 808 SCSIPORTAPI 809 VOID 810 NTAPI 811 ScsiPortReadPortBufferUlong( 812 _In_ PULONG Port, 813 _In_ PULONG Buffer, 814 _In_ ULONG Count); 815 816 SCSIPORTAPI 817 VOID 818 NTAPI 819 ScsiPortReadPortBufferUshort( 820 _In_ PUSHORT Port, 821 _In_ PUSHORT Buffer, 822 _In_ ULONG Count); 823 824 _Must_inspect_result_ 825 SCSIPORTAPI 826 UCHAR 827 NTAPI 828 ScsiPortReadRegisterUchar( 829 _In_ PUCHAR Register); 830 831 _Must_inspect_result_ 832 SCSIPORTAPI 833 ULONG 834 NTAPI 835 ScsiPortReadRegisterUlong( 836 _In_ PULONG Register); 837 838 _Must_inspect_result_ 839 SCSIPORTAPI 840 USHORT 841 NTAPI 842 ScsiPortReadRegisterUshort( 843 _In_ PUSHORT Register); 844 845 SCSIPORTAPI 846 VOID 847 NTAPI 848 ScsiPortReadRegisterBufferUchar( 849 _In_ PUCHAR Register, 850 _In_ PUCHAR Buffer, 851 _In_ ULONG Count); 852 853 SCSIPORTAPI 854 VOID 855 NTAPI 856 ScsiPortReadRegisterBufferUlong( 857 _In_ PULONG Register, 858 _In_ PULONG Buffer, 859 _In_ ULONG Count); 860 861 SCSIPORTAPI 862 VOID 863 NTAPI 864 ScsiPortReadRegisterBufferUshort( 865 _In_ PUSHORT Register, 866 _In_ PUSHORT Buffer, 867 _In_ ULONG Count); 868 869 SCSIPORTAPI 870 VOID 871 NTAPI 872 ScsiPortWritePortUchar( 873 _In_ PUCHAR Port, 874 _In_ UCHAR Value); 875 876 SCSIPORTAPI 877 VOID 878 NTAPI 879 ScsiPortWritePortUlong( 880 _In_ PULONG Port, 881 _In_ ULONG Value); 882 883 SCSIPORTAPI 884 VOID 885 NTAPI 886 ScsiPortWritePortUshort( 887 _In_ PUSHORT Port, 888 _In_ USHORT Value); 889 890 SCSIPORTAPI 891 VOID 892 NTAPI 893 ScsiPortWritePortBufferUchar( 894 _In_ PUCHAR Port, 895 _In_ PUCHAR Buffer, 896 _In_ ULONG Count); 897 898 SCSIPORTAPI 899 VOID 900 NTAPI 901 ScsiPortWritePortBufferUlong( 902 _In_ PULONG Port, 903 _In_ PULONG Buffer, 904 _In_ ULONG Count); 905 906 SCSIPORTAPI 907 VOID 908 NTAPI 909 ScsiPortWritePortBufferUshort( 910 _In_ PUSHORT Port, 911 _In_ PUSHORT Buffer, 912 _In_ ULONG Count); 913 914 SCSIPORTAPI 915 VOID 916 NTAPI 917 ScsiPortWriteRegisterUchar( 918 _In_ PUCHAR Register, 919 _In_ UCHAR Value); 920 921 SCSIPORTAPI 922 VOID 923 NTAPI 924 ScsiPortWriteRegisterUlong( 925 _In_ PULONG Register, 926 _In_ ULONG Value); 927 928 SCSIPORTAPI 929 VOID 930 NTAPI 931 ScsiPortWriteRegisterUshort( 932 _In_ PUSHORT Register, 933 _In_ USHORT Value); 934 935 SCSIPORTAPI 936 VOID 937 NTAPI 938 ScsiPortWriteRegisterBufferUchar( 939 _In_ PUCHAR Register, 940 _In_ PUCHAR Buffer, 941 _In_ ULONG Count); 942 943 SCSIPORTAPI 944 VOID 945 NTAPI 946 ScsiPortWriteRegisterBufferUlong( 947 _In_ PULONG Register, 948 _In_ PULONG Buffer, 949 _In_ ULONG Count); 950 951 SCSIPORTAPI 952 VOID 953 NTAPI 954 ScsiPortWriteRegisterBufferUshort( 955 _In_ PUSHORT Register, 956 _In_ PUSHORT Buffer, 957 _In_ ULONG Count); 958 959 SCSIPORTAPI 960 VOID 961 NTAPI 962 ScsiPortMoveMemory( 963 _In_ PVOID WriteBuffer, 964 _In_ PVOID ReadBuffer, 965 _In_ ULONG Length); 966 967 #endif /* defined(_M_AMD64) */ 968 969 #ifdef __cplusplus 970 } 971 #endif 972 973 #endif /* _NTSRB_ */ 974