https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ca22dc9bb5054c6d6365574c5c519901b5ae1036
commit ca22dc9bb5054c6d6365574c5c519901b5ae1036 Author: Eric Kohl <eric.k...@reactos.org> AuthorDate: Sat Mar 3 14:19:33 2018 +0100 Commit: Eric Kohl <eric.k...@reactos.org> CommitDate: Sat Mar 3 14:19:33 2018 +0100 [STORPORT][DDK] Add the StorPortExtendedFunction stub - Add the StorPortExtendedFunction stub to the storport driver. - Add the declaration of StorPortExtendedFunction to the ddk. CORE-12695 --- drivers/storage/port/storport/storport.c | 17 ++ drivers/storage/port/storport/storport.spec | 2 +- sdk/include/ddk/storport.h | 335 ++++++++++++++++++++++++++++ 3 files changed, 353 insertions(+), 1 deletion(-) diff --git a/drivers/storage/port/storport/storport.c b/drivers/storage/port/storport/storport.c index 61982fcb77..a9fd3d07f8 100644 --- a/drivers/storage/port/storport/storport.c +++ b/drivers/storage/port/storport/storport.c @@ -518,6 +518,23 @@ StorPortDeviceReady( } +/* + * @unimplemented + */ +STORPORT_API +ULONG +StorPortExtendedFunction( + _In_ STORPORT_FUNCTION_CODE FunctionCode, + _In_ PVOID HwDeviceExtension, + ...) +{ + DPRINT1("StorPortExtendedFunction(%d %p ...)\n", + FunctionCode, HwDeviceExtension); + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + + /* * @implemented */ diff --git a/drivers/storage/port/storport/storport.spec b/drivers/storage/port/storport/storport.spec index 7bfe160a4c..310e201f9e 100644 --- a/drivers/storage/port/storport/storport.spec +++ b/drivers/storage/port/storport/storport.spec @@ -9,7 +9,7 @@ @ cdecl StorPortDebugPrint() @ stdcall StorPortDeviceBusy(ptr long long long long) @ stdcall StorPortDeviceReady(ptr long long long) -# StorPortExtendedFunction +@ cdecl StorPortExtendedFunction() @ stdcall StorPortFreeDeviceBase(ptr ptr) @ stdcall StorPortFreeRegistryBuffer(ptr ptr) @ stdcall StorPortGetBusData(ptr long long long ptr long) diff --git a/sdk/include/ddk/storport.h b/sdk/include/ddk/storport.h index b08a156e94..64a6e1059d 100644 --- a/sdk/include/ddk/storport.h +++ b/sdk/include/ddk/storport.h @@ -523,6 +523,46 @@ typedef enum _VPD_IDENTIFIER_TYPE VpdIdentifierTypeSCSINameString = 8 } VPD_IDENTIFIER_TYPE, *PVPD_IDENTIFIER_TYPE; +typedef enum _STORPORT_FUNCTION_CODE +{ + ExtFunctionAllocatePool, + ExtFunctionFreePool, + ExtFunctionAllocateMdl, + ExtFunctionFreeMdl, + ExtFunctionBuildMdlForNonPagedPool, + ExtFunctionGetSystemAddress, + ExtFunctionGetOriginalMdl, + ExtFunctionCompleteServiceIrp, + ExtFunctionGetDeviceObjects, + ExtFunctionBuildScatterGatherList, + ExtFunctionPutScatterGatherList, + ExtFunctionAcquireMSISpinLock, + ExtFunctionReleaseMSISpinLock, + ExtFunctionGetMessageInterruptInformation, + ExtFunctionInitializePerformanceOptimizations, + ExtFunctionGetStartIoPerformanceParameters, + ExtFunctionLogSystemEvent, +#if (NTDDI_VERSION >= NTDDI_WIN7) + ExtFunctionGetCurrentProcessorNumber, + ExtFunctionGetActiveGroupCount, + ExtFunctionGetGroupAffinity, + ExtFunctionGetActiveNodeCount, + ExtFunctionGetNodeAffinity, + ExtFunctionGetHighestNodeNumber, + ExtFunctionGetLogicalProcessorRelationship, + ExtFunctionAllocateContiguousMemorySpecifyCacheNode, + ExtFunctionFreeContiguousMemorySpecifyCache +#endif +} STORPORT_FUNCTION_CODE, *PSTORPORT_FUNCTION_CODE; + +typedef enum _STOR_EVENT_ASSOCIATION_ENUM +{ + StorEventAdapterAssociation = 0, + StorEventLunAssociation, + StorEventTargetAssociation, + StorEventInvalidAssociation +} STOR_EVENT_ASSOCIATION_ENUM; + typedef struct _SCSI_REQUEST_BLOCK { USHORT Length; @@ -2003,6 +2043,54 @@ typedef struct _STOR_LOCK_HANDLE } Context; } STOR_LOCK_HANDLE, *PSTOR_LOCK_HANDLE; +typedef struct _STOR_LOG_EVENT_DETAILS +{ + ULONG InterfaceRevision; + ULONG Size; + ULONG Flags; + STOR_EVENT_ASSOCIATION_ENUM EventAssociation; + ULONG PathId; + ULONG TargetId; + ULONG LunId; + BOOLEAN StorportSpecificErrorCode; + ULONG ErrorCode; + ULONG UniqueId; + ULONG DumpDataSize; + PVOID DumpData; + ULONG StringCount; + PWSTR *StringList; +} STOR_LOG_EVENT_DETAILS, *PSTOR_LOG_EVENT_DETAILS; + +typedef struct _PERF_CONFIGURATION_DATA +{ + ULONG Version; + ULONG Size; + ULONG Flags; + ULONG ConcurrentChannels; + ULONG FirstRedirectionMessageNumber, LastRedirectionMessageNumber; + ULONG DeviceNode; + ULONG Reserved; + PGROUP_AFFINITY MessageTargets; +} PERF_CONFIGURATION_DATA, *PPERF_CONFIGURATION_DATA; + +typedef struct _STARTIO_PERFORMANCE_PARAMETERS +{ + ULONG Version; + ULONG Size; + ULONG MessageNumber; + ULONG ChannelNumber; +} STARTIO_PERFORMANCE_PARAMETERS, *PSTARTIO_PERFORMANCE_PARAMETERS; + +typedef struct _MESSAGE_INTERRUPT_INFORMATION +{ + ULONG MessageId; + ULONG MessageData; + STOR_PHYSICAL_ADDRESS MessageAddress; + ULONG InterruptVector; + ULONG InterruptLevel; + KINTERRUPT_MODE InterruptMode; +} MESSAGE_INTERRUPT_INFORMATION, *PMESSAGE_INTERRUPT_INFORMATION; + typedef BOOLEAN (NTAPI *PHW_INITIALIZE)( @@ -2086,6 +2174,14 @@ BOOLEAN typedef STOR_SYNCHRONIZED_ACCESS *PSTOR_SYNCHRONIZED_ACCESS; +typedef +VOID +(NTAPI *PpostScaterGatherExecute)( + _In_ PVOID *DeviceObject, + _In_ PVOID *Irp, + _In_ PSTOR_SCATTER_GATHER_LIST ScatterGather, + _In_ PVOID Context); + typedef struct _HW_INITIALIZATION_DATA { ULONG HwInitializationDataSize; @@ -2721,6 +2817,245 @@ StorPortReleaseSpinLock( LockHandle); } +STORPORT_API +ULONG +StorPortExtendedFunction( + _In_ STORPORT_FUNCTION_CODE FunctionCode, + _In_ PVOID HwDeviceExtension, + ...); + +FORCEINLINE +ULONG +StorPortAllocatePool( + _In_ PVOID HwDeviceExtension, + _In_ ULONG NumberOfBytes, + _In_ ULONG Tag, + _Out_ PVOID *BufferPointer + ) +{ + return StorPortExtendedFunction(ExtFunctionAllocatePool, + HwDeviceExtension, + NumberOfBytes, + Tag, + BufferPointer); +} + +FORCEINLINE +ULONG +StorPortFreePool( + _In_ PVOID HwDeviceExtension, + _In_ PVOID BufferPointer) +{ + return StorPortExtendedFunction(ExtFunctionFreePool, + HwDeviceExtension, + BufferPointer); +} + +FORCEINLINE +ULONG +StorPortAllocateMdl( + _In_ PVOID HwDeviceExtension, + _In_ PVOID BufferPointer, + _In_ ULONG NumberOfBytes, + _Out_ PVOID *Mdl) +{ + return StorPortExtendedFunction(ExtFunctionAllocateMdl, + HwDeviceExtension, + BufferPointer, + NumberOfBytes, + Mdl); +} + +FORCEINLINE +ULONG +StorPortFreeMdl( + _In_ PVOID HwDeviceExtension, + _In_ PVOID Mdl) +{ + return StorPortExtendedFunction(ExtFunctionFreeMdl, + HwDeviceExtension, + Mdl); +} + +FORCEINLINE +ULONG +StorPortBuildMdlForNonPagedPool( + _In_ PVOID HwDeviceExtension, + _Inout_ PVOID Mdl) +{ + return StorPortExtendedFunction(ExtFunctionBuildMdlForNonPagedPool, + HwDeviceExtension, + Mdl); +} + +FORCEINLINE +ULONG +StorPortGetSystemAddress( + _In_ PVOID HwDeviceExtension, + _In_ PSCSI_REQUEST_BLOCK Srb, + _Out_ PVOID *SystemAddress) +{ + return StorPortExtendedFunction(ExtFunctionGetSystemAddress, + HwDeviceExtension, + Srb, + SystemAddress); +} + +FORCEINLINE +ULONG +StorPortGetOriginalMdl( + _In_ PVOID HwDeviceExtension, + _In_ PSCSI_REQUEST_BLOCK Srb, + _Out_ PVOID *Mdl) +{ + return StorPortExtendedFunction(ExtFunctionGetOriginalMdl, + HwDeviceExtension, + Srb, + Mdl); +} + +FORCEINLINE +ULONG +StorPortCompleteServiceIrp( + _In_ PVOID HwDeviceExtension, + _In_ PVOID Irp) +{ + return StorPortExtendedFunction(ExtFunctionCompleteServiceIrp, + HwDeviceExtension, + Irp); +} + +FORCEINLINE +ULONG +StorPortGetDeviceObjects( + _In_ PVOID HwDeviceExtension, + _Out_ PVOID *AdapterDeviceObject, + _Out_ PVOID *PhysicalDeviceObject, + _Out_ PVOID *LowerDeviceObject) +{ + return StorPortExtendedFunction(ExtFunctionGetDeviceObjects, + HwDeviceExtension, + AdapterDeviceObject, + PhysicalDeviceObject, + LowerDeviceObject); +} + +FORCEINLINE +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) +{ + return StorPortExtendedFunction(ExtFunctionBuildScatterGatherList, + HwDeviceExtension, + Mdl, + CurrentVa, + Length, + ExecutionRoutine, + Context, + WriteToDevice, + ScatterGatherBuffer, + ScatterGatherBufferLength); +} + +FORCEINLINE +ULONG +StorPortPutScatterGatherList( + _In_ PVOID HwDeviceExtension, + _In_ PSTOR_SCATTER_GATHER_LIST ScatterGatherList, + _In_ BOOLEAN WriteToDevice) +{ + return StorPortExtendedFunction(ExtFunctionPutScatterGatherList, + HwDeviceExtension, + ScatterGatherList, + WriteToDevice); +} + +FORCEINLINE +ULONG +StorPortAcquireMSISpinLock( + _In_ PVOID HwDeviceExtension, + _In_ ULONG MessageId, + _In_ PULONG OldIrql) +{ + return StorPortExtendedFunction(ExtFunctionAcquireMSISpinLock, + HwDeviceExtension, + MessageId, + OldIrql); +} + +FORCEINLINE +ULONG +StorPortReleaseMSISpinLock( + _In_ PVOID HwDeviceExtension, + _In_ ULONG MessageId, + _In_ ULONG OldIrql) +{ + return StorPortExtendedFunction(ExtFunctionReleaseMSISpinLock, + HwDeviceExtension, + MessageId, + OldIrql); +} + +FORCEINLINE +ULONG +StorPortGetMSIInfo( + _In_ PVOID HwDeviceExtension, + _In_ ULONG MessageId, + _Out_ PMESSAGE_INTERRUPT_INFORMATION InterruptInfo) +{ + return StorPortExtendedFunction(ExtFunctionGetMessageInterruptInformation, + HwDeviceExtension, + MessageId, + InterruptInfo); +} + +FORCEINLINE +ULONG +StorPortInitializePerfOpts( + _In_ PVOID HwDeviceExtension, + _In_ BOOLEAN Query, + _Inout_ PPERF_CONFIGURATION_DATA PerfConfigData) +{ + return StorPortExtendedFunction(ExtFunctionInitializePerformanceOptimizations, + HwDeviceExtension, + Query, + PerfConfigData); +} + +FORCEINLINE +ULONG +StorPortGetStartIoPerfParams( + _In_ PVOID HwDeviceExtension, + _In_ PSCSI_REQUEST_BLOCK Srb, + _Inout_ PSTARTIO_PERFORMANCE_PARAMETERS StartIoPerfParams) +{ + return StorPortExtendedFunction(ExtFunctionGetStartIoPerformanceParameters, + HwDeviceExtension, + Srb, + StartIoPerfParams); +} + +FORCEINLINE +ULONG +StorPortLogSystemEvent( + _In_ PVOID HwDeviceExtension, + _Inout_ PSTOR_LOG_EVENT_DETAILS LogDetails, + _Inout_ PULONG MaximumSize) +{ + return StorPortExtendedFunction(ExtFunctionLogSystemEvent, + HwDeviceExtension, + LogDetails, + MaximumSize); +} + #if DBG #define DebugPrint(x) StorPortDebugPrint x #else