21#define SCSI_MAXIMUM_LOGICAL_UNITS 8
22#define SCSI_MAXIMUM_TARGETS_PER_BUS 128
23#define SCSI_MAXIMUM_LUNS_PER_TARGET 255
24#define SCSI_MAXIMUM_BUSES 8
25#define SCSI_MINIMUM_PHYSICAL_BREAKS 16
26#define SCSI_MAXIMUM_PHYSICAL_BREAKS 255
31#define SCSI_MAXIMUM_TARGETS 8
33#define MAXIMUM_CDB_SIZE 12
146#define CONFIG_INFO_VERSION_2 sizeof(PORT_CONFIGURATION_INFORMATION)
161#define SCSI_DMA64_SYSTEM_SUPPORTED 0x80
169#define SCSI_DMA64_MINIPORT_SUPPORTED 0x01
204#pragma warning(disable:4200)
225#pragma warning(disable:4200)
232#define SP_UNINITIALIZED_VALUE ((ULONG) ~0)
233#define SP_UNTAGGED ((UCHAR) ~0)
239#define SRBEV_BUS_RESET 0x0001
240#define SRBEV_SCSI_ASYNC_NOTIFICATION 0x0002
282#define SCSI_REQUEST_BLOCK_SIZE sizeof(SCSI_REQUEST_BLOCK)
315#define SRB_FUNCTION_EXECUTE_SCSI 0x00
316#define SRB_FUNCTION_CLAIM_DEVICE 0x01
317#define SRB_FUNCTION_IO_CONTROL 0x02
318#define SRB_FUNCTION_RECEIVE_EVENT 0x03
319#define SRB_FUNCTION_RELEASE_QUEUE 0x04
320#define SRB_FUNCTION_ATTACH_DEVICE 0x05
321#define SRB_FUNCTION_RELEASE_DEVICE 0x06
322#define SRB_FUNCTION_SHUTDOWN 0x07
323#define SRB_FUNCTION_FLUSH 0x08
324#define SRB_FUNCTION_ABORT_COMMAND 0x10
325#define SRB_FUNCTION_RELEASE_RECOVERY 0x11
326#define SRB_FUNCTION_RESET_BUS 0x12
327#define SRB_FUNCTION_RESET_DEVICE 0x13
328#define SRB_FUNCTION_TERMINATE_IO 0x14
329#define SRB_FUNCTION_FLUSH_QUEUE 0x15
330#define SRB_FUNCTION_REMOVE_DEVICE 0x16
331#define SRB_FUNCTION_WMI 0x17
332#define SRB_FUNCTION_LOCK_QUEUE 0x18
333#define SRB_FUNCTION_UNLOCK_QUEUE 0x19
334#define SRB_FUNCTION_RESET_LOGICAL_UNIT 0x20
340#define SRB_STATUS_PENDING 0x00
341#define SRB_STATUS_SUCCESS 0x01
342#define SRB_STATUS_ABORTED 0x02
343#define SRB_STATUS_ABORT_FAILED 0x03
344#define SRB_STATUS_ERROR 0x04
345#define SRB_STATUS_BUSY 0x05
346#define SRB_STATUS_INVALID_REQUEST 0x06
347#define SRB_STATUS_INVALID_PATH_ID 0x07
348#define SRB_STATUS_NO_DEVICE 0x08
349#define SRB_STATUS_TIMEOUT 0x09
350#define SRB_STATUS_SELECTION_TIMEOUT 0x0A
351#define SRB_STATUS_COMMAND_TIMEOUT 0x0B
352#define SRB_STATUS_MESSAGE_REJECTED 0x0D
353#define SRB_STATUS_BUS_RESET 0x0E
354#define SRB_STATUS_PARITY_ERROR 0x0F
355#define SRB_STATUS_REQUEST_SENSE_FAILED 0x10
356#define SRB_STATUS_NO_HBA 0x11
357#define SRB_STATUS_DATA_OVERRUN 0x12
358#define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13
359#define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14
360#define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15
361#define SRB_STATUS_REQUEST_FLUSHED 0x16
362#define SRB_STATUS_INVALID_LUN 0x20
363#define SRB_STATUS_INVALID_TARGET_ID 0x21
364#define SRB_STATUS_BAD_FUNCTION 0x22
365#define SRB_STATUS_ERROR_RECOVERY 0x23
366#define SRB_STATUS_NOT_POWERED 0x24
373#define SRB_STATUS_INTERNAL_ERROR 0x30
386#define SRB_STATUS_QUEUE_FROZEN 0x40
387#define SRB_STATUS_AUTOSENSE_VALID 0x80
389#define SRB_STATUS(Status) (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN))
395#define SRB_FLAGS_QUEUE_ACTION_ENABLE 0x00000002
396#define SRB_FLAGS_DISABLE_DISCONNECT 0x00000004
397#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008
398#define SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x00000010
399#define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020
400#define SRB_FLAGS_DATA_IN 0x00000040
401#define SRB_FLAGS_DATA_OUT 0x00000080
402#define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000
403#define SRB_FLAGS_UNSPECIFIED_DIRECTION (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT)
404#define SRB_FLAGS_NO_QUEUE_FREEZE 0x00000100
405#define SRB_FLAGS_ADAPTER_CACHE_ENABLE 0x00000200
406#define SRB_FLAGS_FREE_SENSE_BUFFER 0x00000400
407#define SRB_FLAGS_IS_ACTIVE 0x00010000
408#define SRB_FLAGS_ALLOCATED_FROM_ZONE 0x00020000
409#define SRB_FLAGS_SGLIST_FROM_POOL 0x00040000
410#define SRB_FLAGS_BYPASS_LOCKED_QUEUE 0x00080000
412#define SRB_FLAGS_NO_KEEP_AWAKE 0x00100000
413#define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE 0x00200000
414#define SRB_FLAGS_PORT_DRIVER_SENSEHASPORT 0x00400000
415#define SRB_FLAGS_DONT_START_NEXT_PACKET 0x00800000
417#define SRB_FLAGS_PORT_DRIVER_RESERVED 0x0F000000
418#define SRB_FLAGS_CLASS_DRIVER_RESERVED 0xF0000000
423#define SRB_SIMPLE_TAG_REQUEST 0x20
424#define SRB_HEAD_OF_QUEUE_TAG_REQUEST 0x21
425#define SRB_ORDERED_QUEUE_TAG_REQUEST 0x22
427#define SRB_WMI_FLAGS_ADAPTER_REQUEST 0x01
504#define SP_BUS_PARITY_ERROR 0x0001
505#define SP_UNEXPECTED_DISCONNECT 0x0002
506#define SP_INVALID_RESELECTION 0x0003
507#define SP_BUS_TIME_OUT 0x0004
508#define SP_PROTOCOL_ERROR 0x0005
509#define SP_INTERNAL_ADAPTER_ERROR 0x0006
510#define SP_REQUEST_TIMEOUT 0x0007
511#define SP_IRQ_NOT_RESPONDING 0x0008
512#define SP_BAD_FW_WARNING 0x0009
513#define SP_BAD_FW_ERROR 0x000a
514#define SP_LOST_WMI_MINIPORT_REQUEST 0x000b
521#define SP_RETURN_NOT_FOUND 0
522#define SP_RETURN_FOUND 1
523#define SP_RETURN_ERROR 2
524#define SP_RETURN_BAD_CONFIG 3
608#define SCSIPORT_API DECLSPEC_IMPORT
957#define ScsiPortConvertPhysicalAddressToUlong(Address) ((Address).LowPart)
975 ULONG DebugPrintLevel,
#define WriteBuffer(BaseIoAddress, Buffer, Count)
#define ReadBuffer(BaseIoAddress, Buffer, Count)
_In_ PSCSI_REQUEST_BLOCK Srb
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR PathId
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR TargetId
struct _SCSI_SUPPORTED_CONTROL_TYPE_LIST SCSI_SUPPORTED_CONTROL_TYPE_LIST
SCSIPORT_API VOID NTAPI ScsiPortLogError(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb OPTIONAL, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun, IN ULONG ErrorCode, IN ULONG UniqueId)
SCSIPORT_API BOOLEAN NTAPI ScsiPortValidateRange(IN PVOID HwDeviceExtension, IN INTERFACE_TYPE BusType, IN ULONG SystemIoBusNumber, IN SCSI_PHYSICAL_ADDRESS IoAddress, IN ULONG NumberOfBytes, IN BOOLEAN InIoSpace)
VOID(NTAPI * PHW_DMA_STARTED)(IN PVOID DeviceExtension)
struct _SCSI_REQUEST_BLOCK SCSI_REQUEST_BLOCK
BOOLEAN(NTAPI * PHW_INTERRUPT)(IN PVOID DeviceExtension)
struct _ACCESS_RANGE ACCESS_RANGE
struct _PORT_CONFIGURATION_INFORMATION_COMMON PORT_CONFIGURATION_INFORMATION_COMMON
SCSIPORT_API VOID NTAPI ScsiPortReadPortBufferUshort(IN PUSHORT Port, IN PUSHORT Buffer, IN ULONG Count)
_SCSI_ADAPTER_CONTROL_TYPE
@ ScsiQuerySupportedControlTypes
@ MakeAdapterControlTypeSizeOfUlong
struct _PORT_CONFIGURATION_INFORMATION_NT * PPORT_CONFIGURATION_INFORMATION_NT
SCSIPORT_API VOID NTAPI ScsiPortReadRegisterBufferUshort(IN PUSHORT Register, IN PUSHORT Buffer, IN ULONG Count)
PHYSICAL_ADDRESS SCSI_PHYSICAL_ADDRESS
struct _PORT_CONFIGURATION_INFORMATION * PPORT_CONFIGURATION_INFORMATION
enum _SCSI_NOTIFICATION_TYPE * PSCSI_NOTIFICATION_TYPE
SCSIPORT_API VOID NTAPI ScsiPortWritePortBufferUshort(IN PUSHORT Port, IN PUSHORT Buffer, IN ULONG Count)
enum _SCSI_NOTIFICATION_TYPE SCSI_NOTIFICATION_TYPE
SCSIPORT_API ULONG NTAPI ScsiPortReadPortUlong(IN PULONG Port)
SCSIPORT_API VOID NTAPI ScsiPortWriteRegisterUlong(IN PULONG Register, IN ULONG Value)
SCSIPORT_API VOID NTAPI ScsiPortFreeDeviceBase(IN PVOID HwDeviceExtension, IN PVOID MappedAddress)
SCSIPORT_API USHORT NTAPI ScsiPortReadPortUshort(IN PUSHORT Port)
SCSIPORT_API VOID NTAPI ScsiPortWritePortBufferUchar(IN PUCHAR Port, IN PUCHAR Buffer, IN ULONG Count)
SCSIPORT_API VOID NTAPI ScsiPortMoveMemory(IN PVOID WriteBuffer, IN PVOID ReadBuffer, IN ULONG Length)
struct _PORT_CONFIGURATION_INFORMATION_NT PORT_CONFIGURATION_INFORMATION_NT
struct _HW_INITIALIZATION_DATA_COMMON * PHW_INITIALIZATION_DATA_COMMON
_SCSI_ADAPTER_CONTROL_STATUS
@ ScsiAdapterControlSuccess
@ ScsiAdapterControlUnsuccessful
SCSIPORT_API VOID NTAPI ScsiPortWriteRegisterBufferUlong(IN PULONG Register, IN PULONG Buffer, IN ULONG Count)
struct _HW_INITIALIZATION_DATA * PHW_INITIALIZATION_DATA
VOID(NTAPI * PHW_TIMER)(IN PVOID DeviceExtension)
struct _SCSI_WMI_REQUEST_BLOCK SCSI_WMI_REQUEST_BLOCK
enum _SCSI_ADAPTER_CONTROL_TYPE SCSI_ADAPTER_CONTROL_TYPE
SCSIPORT_API PSCSI_REQUEST_BLOCK NTAPI ScsiPortGetSrb(IN PVOID DeviceExtension, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun, IN LONG QueueTag)
SCSIPORT_API ULONG NTAPI ScsiPortSetBusDataByOffset(IN PVOID DeviceExtension, IN ULONG BusDataType, IN ULONG SystemIoBusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
enum _SCSI_ADAPTER_CONTROL_STATUS SCSI_ADAPTER_CONTROL_STATUS
SCSIPORT_API VOID NTAPI ScsiPortWriteRegisterUchar(IN PUCHAR Register, IN UCHAR Value)
SCSIPORT_API VOID NTAPI ScsiPortWriteRegisterBufferUshort(IN PUSHORT Register, IN PUSHORT Buffer, IN ULONG Count)
SCSIPORT_API VOID NTAPI ScsiPortWriteRegisterUshort(IN PUSHORT Register, IN USHORT Value)
SCSIPORT_API ULONG NTAPI ScsiPortGetBusData(IN PVOID DeviceExtension, IN ULONG BusDataType, IN ULONG SystemIoBusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Length)
SCSIPORT_API VOID NTAPI ScsiPortReadPortBufferUchar(IN PUCHAR Port, IN PUCHAR Buffer, IN ULONG Count)
SCSIPORT_API ULONG NTAPI ScsiPortReadRegisterUlong(IN PULONG Register)
SCSIPORT_API SCSI_PHYSICAL_ADDRESS NTAPI ScsiPortConvertUlongToPhysicalAddress(ULONG UlongAddress)
SCSIPORT_API VOID NTAPI ScsiPortCompleteRequest(IN PVOID HwDeviceExtension, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun, IN UCHAR SrbStatus)
struct _HW_INITIALIZATION_DATA HW_INITIALIZATION_DATA
SCSIPORT_API PVOID NTAPI ScsiPortGetVirtualAddress(IN PVOID HwDeviceExtension, IN SCSI_PHYSICAL_ADDRESS PhysicalAddress)
struct _SCSI_SUPPORTED_CONTROL_TYPE_LIST * PSCSI_SUPPORTED_CONTROL_TYPE_LIST
SCSIPORT_API VOID NTAPI ScsiPortFlushDma(IN PVOID DeviceExtension)
SCSIPORT_API VOID __cdecl ScsiDebugPrint(ULONG DebugPrintLevel, PCCHAR DebugMessage,...)
SCSIPORT_API VOID NTAPI ScsiPortReadPortBufferUlong(IN PULONG Port, IN PULONG Buffer, IN ULONG Count)
SCSIPORT_API PVOID NTAPI ScsiPortGetLogicalUnit(IN PVOID HwDeviceExtension, IN UCHAR PathId, IN UCHAR TargetId, IN UCHAR Lun)
BOOLEAN(NTAPI * PHW_STARTIO)(IN PVOID DeviceExtension, IN PSCSI_REQUEST_BLOCK Srb)
struct _PORT_CONFIGURATION_INFORMATION_2K PORT_CONFIGURATION_INFORMATION_2K
BOOLEAN(NTAPI * PHW_ADAPTER_STATE)(IN PVOID DeviceExtension, IN PVOID Context, IN BOOLEAN SaveState)
SCSIPORT_API VOID NTAPI ScsiPortWriteRegisterBufferUchar(IN PUCHAR Register, IN PUCHAR Buffer, IN ULONG Count)
BOOLEAN(NTAPI * PHW_RESET_BUS)(IN PVOID DeviceExtension, IN ULONG PathId)
SCSIPORT_API PVOID NTAPI ScsiPortGetDeviceBase(IN PVOID HwDeviceExtension, IN INTERFACE_TYPE BusType, IN ULONG SystemIoBusNumber, IN SCSI_PHYSICAL_ADDRESS IoAddress, IN ULONG NumberOfBytes, IN BOOLEAN InIoSpace)
SCSIPORT_API VOID NTAPI ScsiPortWritePortUchar(IN PUCHAR Port, IN UCHAR Value)
SCSIPORT_API USHORT NTAPI ScsiPortReadRegisterUshort(IN PUSHORT Register)
SCSIPORT_API VOID NTAPI ScsiPortIoMapTransfer(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb, IN PVOID LogicalAddress, IN ULONG Length)
SCSIPORT_API ULONG NTAPI ScsiPortInitialize(IN PVOID Argument1, IN PVOID Argument2, IN struct _HW_INITIALIZATION_DATA *HwInitializationData, IN PVOID HwContext)
SCSIPORT_API VOID __cdecl ScsiPortNotification(IN SCSI_NOTIFICATION_TYPE NotificationType, IN PVOID HwDeviceExtension,...)
#define ScsiPortConvertPhysicalAddressToUlong(Address)
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
SCSIPORT_API VOID NTAPI ScsiPortStallExecution(IN ULONG Delay)
PHYSICAL_ADDRESS * PSCSI_PHYSICAL_ADDRESS
struct _PORT_CONFIGURATION_INFORMATION PORT_CONFIGURATION_INFORMATION
SCSIPORT_API VOID NTAPI ScsiPortWritePortUshort(IN PUSHORT Port, IN USHORT Value)
struct _HW_INITIALIZATION_DATA_COMMON HW_INITIALIZATION_DATA_COMMON
struct _SCSI_WMI_REQUEST_BLOCK * PSCSI_WMI_REQUEST_BLOCK
SCSI_ADAPTER_CONTROL_STATUS(NTAPI * PHW_ADAPTER_CONTROL)(IN PVOID DeviceExtension, IN SCSI_ADAPTER_CONTROL_TYPE ControlType, IN PVOID Parameters)
SCSIPORT_API VOID NTAPI ScsiPortWritePortBufferUlong(IN PULONG Port, IN PULONG Buffer, IN ULONG Count)
SCSIPORT_API VOID NTAPI ScsiPortReadRegisterBufferUlong(IN PULONG Register, IN PULONG Buffer, IN ULONG Count)
struct _HW_INITIALIZATION_DATA_2K * PHW_INITIALIZATION_DATA_2K
SCSIPORT_API UCHAR NTAPI ScsiPortReadRegisterUchar(IN PUCHAR Register)
enum _SCSI_ADAPTER_CONTROL_TYPE * PSCSI_ADAPTER_CONTROL_TYPE
SCSIPORT_API VOID NTAPI ScsiPortWritePortUlong(IN PULONG Port, IN ULONG Value)
struct _HW_INITIALIZATION_DATA_2K HW_INITIALIZATION_DATA_2K
enum _SCSI_ADAPTER_CONTROL_STATUS * PSCSI_ADAPTER_CONTROL_STATUS
SCSIPORT_API SCSI_PHYSICAL_ADDRESS NTAPI ScsiPortGetPhysicalAddress(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb, IN PVOID VirtualAddress, OUT ULONG *Length)
struct _PORT_CONFIGURATION_INFORMATION_2K * PPORT_CONFIGURATION_INFORMATION_2K
SCSIPORT_API UCHAR NTAPI ScsiPortReadPortUchar(IN PUCHAR Port)
struct _PORT_CONFIGURATION_INFORMATION_COMMON * PPORT_CONFIGURATION_INFORMATION_COMMON
SCSIPORT_API PVOID NTAPI ScsiPortGetUncachedExtension(IN PVOID HwDeviceExtension, IN PPORT_CONFIGURATION_INFORMATION ConfigInfo, IN ULONG NumberOfBytes)
ULONG(NTAPI * PHW_FIND_ADAPTER)(IN PVOID DeviceExtension, IN PVOID HwContext, IN PVOID BusInformation, IN PCHAR ArgumentString, IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo, OUT PBOOLEAN Again)
SCSIPORT_API VOID NTAPI ScsiPortReadRegisterBufferUchar(IN PUCHAR Register, IN PUCHAR Buffer, IN ULONG Count)
struct _ACCESS_RANGE * PACCESS_RANGE
BOOLEAN(NTAPI * PHW_INITIALIZE)(IN PVOID DeviceExtension)
enum _INTERFACE_TYPE INTERFACE_TYPE
_In_ NDIS_ERROR_CODE ErrorCode
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
enum _KINTERRUPT_MODE KINTERRUPT_MODE
enum _DMA_SPEED DMA_SPEED
enum _DMA_WIDTH DMA_WIDTH
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA _In_ PVOID HwContext
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA * HwInitializationData
PULONG MinorVersion OPTIONAL
struct _ACCESS_RANGE ACCESS_RANGE
BOOLEAN(STREAMAPI * PHW_INTERRUPT)(IN PVOID DeviceExtension)
SCSI_PHYSICAL_ADDRESS RangeStart
PHW_ADAPTER_CONTROL HwAdapterControl
HW_INITIALIZATION_DATA_2K w2k
HW_INITIALIZATION_DATA comm
PHW_INTERRUPT HwInterrupt
PHW_ADAPTER_STATE HwAdapterState
PHW_DMA_STARTED HwDmaStarted
BOOLEAN MultipleRequestPerLu
BOOLEAN NeedPhysicalAddresses
ULONG SpecificLuExtensionSize
ULONG HwInitializationDataSize
PHW_INITIALIZE HwInitialize
ULONG DeviceExtensionSize
INTERFACE_TYPE AdapterInterfaceType
PHW_FIND_ADAPTER HwFindAdapter
ULONG NumberOfAccessRanges
UCHAR SenseInfoBufferLength
struct _SCSI_REQUEST_BLOCK * NextSrb
OUT BOOLEAN SupportedTypeList[0]
_In_ WDF_SPECIAL_FILE_TYPE NotificationType
_In_ WDFDEVICE _In_ PPNP_BUS_INFORMATION BusInformation
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
_Reserved_ PVOID Reserved
_IRQL_requires_same_ _In_opt_ PVOID Argument1
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE BusType
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes