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",
__inline FxDmaDescription * GetReadDmaDescription(VOID)
__inline FxDmaDescription * GetDmaDescription(__in WDF_DMA_DIRECTION Direction)
_Must_inspect_result_ NTSTATUS InitializeResources(__inout FxDmaDescription *AdapterInfo)
#define _Must_inspect_result_
virtual VOID RemoveDmaEnabler(__inout FxDmaEnabler *Enabler)
FxTransactionedEntry m_TransactionLink
#define STATUS_INSUFFICIENT_RESOURCES
_In_ ULONG _In_ ULONG _In_ ULONG Length
MdDeviceObject __inline GetDeviceObject(VOID)
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
WDF_EXTERN_C_START typedef _In_ WDFDEVICE _In_ WDFCONTEXT _In_ WDF_DMA_DIRECTION Direction
PDMA_ADAPTER NTAPI IoGetDmaAdapter(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PDEVICE_DESCRIPTION DeviceDescription, IN OUT PULONG NumberOfMapRegisters)
virtual VOID AddDmaEnabler(__inout FxDmaEnabler *Enabler)
#define STATUS_INVALID_PARAMETER
PINITIALIZE_DMA_TRANSFER_CONTEXT InitializeDmaTransferContext
BOOLEAN m_DmaEnablerFillFailed
VOID RevokeResources(VOID)
NTSTATUS Invoke(__in WDFDMAENABLER Handle)
_Must_inspect_result_ NTSTATUS ConfigureSystemAdapter(__in PWDF_DMA_SYSTEM_PROFILE_CONFIG Config, __in WDF_DMA_DIRECTION ConfigDirection)
#define WDF_DMA_ENABLER_UNLIMITED_FRAGMENTS
FxEvtDmaEnablerSelfManagedIoStopCallback m_EvtDmaEnablerSelfManagedIoStop
size_t PreallocatedSGListSize
BOOLEAN m_IsScatterGather
VOID SetTransactionedObject(__in FxObject *Object)
FxEvtDmaEnablerEnableCallback m_EvtDmaEnablerEnable
NTSTATUS Invoke(__in WDFDMAENABLER Handle)
WDF_DMA_PROFILE m_Profile
struct _DMA_OPERATIONS * DmaOperations
FxDmaEnabler(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
#define DEVICE_DESCRIPTION_VERSION3
NTSTATUS Invoke(__in WDFDMAENABLER Handle)
BOOLEAN m_IsSGListAllocated
ULONG m_CommonBufferAlignment
FxEvtDmaEnablerFillCallback m_EvtDmaEnablerFill
_Must_inspect_result_ NTSTATUS Initialize(__in PWDF_DMA_ENABLER_CONFIG Config, __inout FxDeviceBase *Device)
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceDescription
#define TRACE_LEVEL_VERBOSE
__inline WDFDMAENABLER GetHandle(VOID)
VOID MarkDisposeOverride(__in FxObjectLockState State=ObjectLock)
VOID ReleaseResources(VOID)
PFN_WDF_DMA_ENABLER_SELFMANAGED_IO_START m_Method
struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST
BOOLEAN Dma32BitAddresses
BOOLEAN m_DmaEnablerEnableFailed
BOOLEAN Dma64BitAddresses
VOID AllocateCommonBuffer(__in size_t Length, __deref_out_opt PVOID *BufferVA, __out PHYSICAL_ADDRESS *BufferPA)
__inline size_t FxSizeTMax(__in size_t A, __in size_t B)
VOID FreeCommonBuffer(__in size_t Length, __in PVOID BufferVA, __in PHYSICAL_ADDRESS BufferPA)
PFX_DRIVER_GLOBALS pFxDriverGlobals
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)
BOOLEAN m_DmaEnablerSelfManagedIoStartFailed
MdDeviceObject __inline GetPhysicalDevice(VOID)
#define NT_SUCCESS(StatCode)
FxEvtDmaEnablerSelfManagedIoStartCallback m_EvtDmaEnablerSelfManagedIoStart
_Must_inspect_result_ NTSTATUS PowerUp(VOID)
_Must_inspect_result_ NTSTATUS ConfigureBusMasterAdapters(__in PDEVICE_DESCRIPTION DeviceDescription, __in PWDF_DMA_ENABLER_CONFIG Config)
virtual VOID SetDeviceTelemetryInfoFlags(_In_ FxDeviceInfoFlags Flag)
__inline FxDmaDescription * GetWriteDmaDescription(VOID)
PHYSICAL_ADDRESS DeviceAddress
FxEvtDmaEnablerDisableCallback m_EvtDmaEnablerDisable
#define STATUS_UNSUCCESSFUL
#define ExAllocatePoolWithTag(hernya, size, tag)
NTSTATUS Invoke(__in WDFDMAENABLER Handle)
PFN_WDF_DMA_ENABLER_FLUSH m_Method
PFN_WDF_DMA_ENABLER_DISABLE m_Method
CfxDeviceBase * m_DeviceBase
DEVICE_DESCRIPTION DeviceDescription
NTSTATUS Invoke(__in WDFDMAENABLER Handle)
PFN_WDF_DMA_ENABLER_SELFMANAGED_IO_STOP m_Method
_Must_inspect_result_ _In_ WDFDEVICE Device
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
ULONG AlignmentRequirement
__inline size_t FxSizeTMin(__in size_t A, __in size_t B)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_CHILD_LIST_CONFIG Config
#define TRACE_LEVEL_ERROR
#define TRACE_LEVEL_WARNING
NTSTATUS Invoke(__in WDFDMAENABLER Handle)
FxEvtDmaEnablerFlushCallback m_EvtDmaEnablerFlush
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ PWDF_DMA_SYSTEM_PROFILE_CONFIG _In_ WDF_DMA_DIRECTION ConfigDirection
union FxDmaEnabler::@4627 m_SGList
PDMA_ADAPTER AdapterObject
PFN_WDF_DMA_ENABLER_ENABLE m_Method
FxDmaDescription m_DuplexAdapterInfo[FxDuplexDmaDescriptionTypeMax]
__inline _Must_inspect_result_ BOOLEAN IsOsVersionGreaterThanOrEqualTo(__in ULONG Major, __in ULONG Minor)
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
_Must_inspect_result_ NTSTATUS ConfigureDmaAdapter(__in PDEVICE_DESCRIPTION DeviceDescription, __in WDF_DMA_DIRECTION ConfigDirection)
VOID InitializeTransferContext(__out PVOID Context, __in WDF_DMA_DIRECTION Direction)
_Must_inspect_result_ NTSTATUS PowerDown(VOID)
BOOLEAN m_IsDuplexTransfer
virtual BOOLEAN Dispose(VOID)
#define DEVICE_DESCRIPTION_VERSION2
INTERFACE_TYPE InterfaceType
struct _SCATTER_GATHER_LIST * PSCATTER_GATHER_LIST
enum _WDF_DMA_DIRECTION WDF_DMA_DIRECTION
#define RtlZeroMemory(Destination, Length)
#define RtlCopyMemory(Destination, Source, Length)
VOID NTAPI ExDeleteNPagedLookasideList(IN PNPAGED_LOOKASIDE_LIST Lookaside)
VOID FreeResources(__inout FxDmaDescription *AdapterInfo)
static SERVICE_STATUS status
FxVerifierDbgBreakPoint(pFxDriverGlobals)
FxDmaDescription m_SimplexAdapterInfo
PFN_WDF_DMA_ENABLER_FILL m_Method