125 ULONG mapRegistersAllocated;
146 "Unable to allocate DmaEnablerList for "
147 "WDFDEVICE %p, %!STATUS!",
265 if (
Config->AddressWidthOverride != 0) {
276 "AddressWidthOverride set to %d. AddressWidthOverride "
277 "must be zero when using a system DMA profile "
278 "(%!WDF_DMA_PROFILE!) - %!STATUS!",
279 Config->AddressWidthOverride,
288 (
Config->AddressWidthOverride > 32)) {
292 "AddressWidthOverride set to %d. AddressWidthOverride "
293 "must be <= 32 when using a 32-bit DMA profile "
294 "(%!WDF_DMA_PROFILE!) - %!STATUS!",
295 Config->AddressWidthOverride,
314 NT_ASSERTMSGW(
L"Ensure driver is not doing something earlier that "
315 L"would require DMA v3 before we downgrade them to "
319 if (
Config->AddressWidthOverride < 64) {
323 if (
Config->AddressWidthOverride < 32) {
332 if (
Config->AddressWidthOverride < 24) {
335 "AddressWidthOverride of less than 24 bits is not supported"
339 else if ((
Config->AddressWidthOverride != 64) &&
340 (
Config->AddressWidthOverride != 32)) {
351 "DMA AddressWidthOverride requires Windows version 6.2 or "
352 "higher. Windows cannot support %d bit DMA is falling back to "
353 "the next lower supported width (%d-bit)",
354 Config->AddressWidthOverride,
366 if (
Config->WdmDmaVersionOverride != 0) {
368 if (
Config->WdmDmaVersionOverride < deviceDescription.
Version) {
377 "WdmDmaVersionOverride set to %d, conflicts with required version of %d, "
379 Config->WdmDmaVersionOverride,
426 mapRegistersAllocated = 0;
497 "WDFDMAENABLER %p, profile %!WDF_DMA_PROFILE! "
498 "Enabler has already been configured for %!WDF_DMA_DIRECTION!, %!STATUS!",
552 size_t systemSGListSize = 0;
575 "Unable to allocate scatter gather list for system DMA "
576 "enabler %p, %!STATUS!",
592 )->AdapterObject !=
NULL) &&
595 )->AdapterObject !=
NULL)) {
647 size_t sgLookasideListSize;
649 sgLookasideListSize = 0;
789 AdapterInfo->DeviceDescription.Version != 0);
794 AdapterInfo->AdapterObject =
796 &AdapterInfo->DeviceDescription,
797 (
PULONG)&AdapterInfo->NumberOfMapRegisters);
799 if (AdapterInfo->AdapterObject ==
NULL) {
802 "Unable to allocate DmaAdapter object for "
803 "WDFDMAENABLER %p, %!STATUS!",
818 ULONG mapRegistersCount;
820 status = AdapterInfo->AdapterObject->DmaOperations->
821 CalculateScatterGatherList( AdapterInfo->AdapterObject,
824 AdapterInfo->NumberOfMapRegisters *
PAGE_SIZE,
825 (
PULONG) &AdapterInfo->PreallocatedSGListSize,
831 "CalculateScatterGatherList failed for "
836 ASSERT(AdapterInfo->NumberOfMapRegisters == mapRegistersCount);
854 AdapterInfo->NumberOfMapRegisters);
857 ASSERT(AdapterInfo->NumberOfMapRegisters > 1);
860 ((
size_t) (AdapterInfo->NumberOfMapRegisters - 1)) <<
PAGE_SHIFT);
863 "WDFDMAENABLER %p, profile %!WDF_DMA_PROFILE! "
864 "DmaAdapterObject %p, MapRegisters %d, "
866 AdapterInfo->AdapterObject,
867 AdapterInfo->NumberOfMapRegisters,
868 AdapterInfo->MaximumFragmentLength);
872 "The maximum transfer length for WDFDMAENABLER %p "
873 "is reduced to %I64d from %I64d due to mapregisters limit",
875 AdapterInfo->MaximumFragmentLength);
886 if (AdapterInfo->AdapterObject !=
NULL) {
887 AdapterInfo->AdapterObject->DmaOperations->PutDmaAdapter(AdapterInfo->AdapterObject);
888 AdapterInfo->AdapterObject =
NULL;
939 "WDFDMAENABLER %p: PowerUp notification",
GetHandle());
979 "WDFDMAENABLER %p: PowerUp: "
980 "%!WdfDmaEnablerCallback! failed %!STATUS!",
999 "WDFDMAENABLER %p: PowerDown notification",
GetHandle());
1040 "WDFDMAENABLER %p: PowerDown: "
1041 "%!WdfDmaEnablerCallback! failed %!STATUS!",
1064 BufferPA->QuadPart = 0;
1068 "WDFDMAENABLER %p AllocateCommonBuffer: could cast value %I64d to a "
1117 "should not call this routine if enabler is not using DMAv3",
virtual VOID RemoveDmaEnabler(__inout FxDmaEnabler *Enabler)
virtual VOID SetDeviceTelemetryInfoFlags(_In_ FxDeviceInfoFlags Flag)
MdDeviceObject __inline GetPhysicalDevice(VOID)
MdDeviceObject __inline GetDeviceObject(VOID)
virtual VOID AddDmaEnabler(__inout FxDmaEnabler *Enabler)
BOOLEAN m_IsSGListAllocated
FxDmaDescription m_SimplexAdapterInfo
BOOLEAN m_DmaEnablerFillFailed
VOID InitializeTransferContext(__out PVOID Context, __in WDF_DMA_DIRECTION Direction)
WDF_DMA_PROFILE m_Profile
_Must_inspect_result_ NTSTATUS ConfigureSystemAdapter(__in PWDF_DMA_SYSTEM_PROFILE_CONFIG Config, __in WDF_DMA_DIRECTION ConfigDirection)
BOOLEAN m_IsDuplexTransfer
_Must_inspect_result_ NTSTATUS PowerDown(VOID)
__inline FxDmaDescription * GetWriteDmaDescription(VOID)
FxDmaDescription m_DuplexAdapterInfo[FxDuplexDmaDescriptionTypeMax]
FxTransactionedEntry m_TransactionLink
_Must_inspect_result_ NTSTATUS ConfigureDmaAdapter(__in PDEVICE_DESCRIPTION DeviceDescription, __in WDF_DMA_DIRECTION ConfigDirection)
__inline FxDmaDescription * GetReadDmaDescription(VOID)
VOID AllocateCommonBuffer(__in size_t Length, __deref_out_opt PVOID *BufferVA, __out PHYSICAL_ADDRESS *BufferPA)
FxEvtDmaEnablerSelfManagedIoStopCallback m_EvtDmaEnablerSelfManagedIoStop
FxEvtDmaEnablerEnableCallback m_EvtDmaEnablerEnable
_Must_inspect_result_ NTSTATUS Initialize(__in PWDF_DMA_ENABLER_CONFIG Config, __inout FxDeviceBase *Device)
VOID RevokeResources(VOID)
_Must_inspect_result_ NTSTATUS InitializeResources(__inout FxDmaDescription *AdapterInfo)
FxEvtDmaEnablerDisableCallback m_EvtDmaEnablerDisable
FxEvtDmaEnablerSelfManagedIoStartCallback m_EvtDmaEnablerSelfManagedIoStart
FxEvtDmaEnablerFillCallback m_EvtDmaEnablerFill
virtual BOOLEAN Dispose(VOID)
BOOLEAN m_IsScatterGather
__inline FxDmaDescription * GetDmaDescription(__in WDF_DMA_DIRECTION Direction)
_Must_inspect_result_ NTSTATUS ConfigureBusMasterAdapters(__in PDEVICE_DESCRIPTION DeviceDescription, __in PWDF_DMA_ENABLER_CONFIG Config)
FxEvtDmaEnablerFlushCallback m_EvtDmaEnablerFlush
VOID FreeCommonBuffer(__in size_t Length, __in PVOID BufferVA, __in PHYSICAL_ADDRESS BufferPA)
_Must_inspect_result_ NTSTATUS PowerUp(VOID)
BOOLEAN m_DmaEnablerEnableFailed
BOOLEAN m_DmaEnablerSelfManagedIoStartFailed
union FxDmaEnabler::@4819 m_SGList
ULONG m_CommonBufferAlignment
VOID FreeResources(__inout FxDmaDescription *AdapterInfo)
FxDmaEnabler(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
VOID ReleaseResources(VOID)
PFN_WDF_DMA_ENABLER_DISABLE m_Method
NTSTATUS Invoke(__in WDFDMAENABLER Handle)
PFN_WDF_DMA_ENABLER_ENABLE m_Method
NTSTATUS Invoke(__in WDFDMAENABLER Handle)
PFN_WDF_DMA_ENABLER_FILL m_Method
NTSTATUS Invoke(__in WDFDMAENABLER Handle)
PFN_WDF_DMA_ENABLER_FLUSH m_Method
NTSTATUS Invoke(__in WDFDMAENABLER Handle)
NTSTATUS Invoke(__in WDFDMAENABLER Handle)
PFN_WDF_DMA_ENABLER_SELFMANAGED_IO_START m_Method
PFN_WDF_DMA_ENABLER_SELFMANAGED_IO_STOP m_Method
NTSTATUS Invoke(__in WDFDMAENABLER Handle)
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
CfxDeviceBase * m_DeviceBase
VOID MarkDisposeOverride(__in FxObjectLockState State=ObjectLock)
#define NT_SUCCESS(StatCode)
#define ExAllocatePoolWithTag(hernya, size, tag)
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS pFxDriverGlobals
FxVerifierDbgBreakPoint(pFxDriverGlobals)
@ FxEvtDmaEnablerSelfManagedIoStart
@ FxEvtDmaEnablerSelfManagedIoStop
__inline _Must_inspect_result_ BOOLEAN IsOsVersionGreaterThanOrEqualTo(__in ULONG Major, __in ULONG Minor)
__inline size_t FxSizeTMax(__in size_t A, __in size_t B)
__inline size_t FxSizeTMin(__in size_t A, __in size_t B)
@ DeviceInfoDmaSystemDuplex
VOID NTAPI ExDeleteNPagedLookasideList(IN PNPAGED_LOOKASIDE_LIST Lookaside)
VOID NTAPI ExInitializeNPagedLookasideList(IN PNPAGED_LOOKASIDE_LIST Lookaside, IN PALLOCATE_FUNCTION Allocate OPTIONAL, IN PFREE_FUNCTION Free OPTIONAL, IN ULONG Flags, IN SIZE_T Size, IN ULONG Tag, IN USHORT Depth)
#define _Must_inspect_result_
_In_ ULONG _In_ ULONG _In_ ULONG Length
PDMA_ADAPTER NTAPI IoGetDmaAdapter(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PDEVICE_DESCRIPTION DeviceDescription, IN OUT PULONG NumberOfMapRegisters)
#define TRACE_LEVEL_WARNING
#define TRACE_LEVEL_VERBOSE
#define TRACE_LEVEL_ERROR
VOID SetTransactionedObject(__in FxObject *Object)
BOOLEAN Dma64BitAddresses
PHYSICAL_ADDRESS DeviceAddress
INTERFACE_TYPE InterfaceType
BOOLEAN Dma32BitAddresses
ULONG AlignmentRequirement
struct _DMA_OPERATIONS * DmaOperations
PINITIALIZE_DMA_TRANSFER_CONTEXT InitializeDmaTransferContext
PDMA_ADAPTER AdapterObject
DEVICE_DESCRIPTION DeviceDescription
size_t PreallocatedSGListSize
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_ WDFDEVICE Device
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_CHILD_LIST_CONFIG Config
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
@ WDF_DMA_ENABLER_CONFIG_NO_SGLIST_PREALLOCATION
@ WdfDmaProfileScatterGather
@ WdfDmaProfileScatterGatherDuplex
@ WdfDmaProfileSystemDuplex
@ WdfDmaProfileScatterGather64Duplex
@ WdfDmaProfileScatterGather64
#define WDF_DMA_ENABLER_UNLIMITED_FRAGMENTS
enum _WDF_DMA_DIRECTION WDF_DMA_DIRECTION
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ PWDF_DMA_SYSTEM_PROFILE_CONFIG _In_ WDF_DMA_DIRECTION ConfigDirection
@ WdfDmaDirectionReadFromDevice
@ WdfDmaDirectionWriteToDevice
WDF_EXTERN_C_START typedef _In_ WDFDEVICE _In_ WDFCONTEXT _In_ WDF_DMA_DIRECTION Direction
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceDescription
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST
struct _SCATTER_GATHER_LIST * PSCATTER_GATHER_LIST
#define DEVICE_DESCRIPTION_VERSION2
#define DEVICE_DESCRIPTION_VERSION3