ReactOS 0.4.15-dev-8191-gbc6c731
fxdmaenablerapi.cpp File Reference
#include "fxdmapch.hpp"
Include dependency graph for fxdmaenablerapi.cpp:

Go to the source code of this file.

Functions

_Must_inspect_result_ __drv_maxIRQL (PASSIVE_LEVEL) NTSTATUS WDFEXPORT(WdfDmaEnablerCreate)(__in PWDF_DRIVER_GLOBALS DriverGlobals
 
 FxObjectHandleGetPtrAndGlobals (GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE_BASE,(PVOID *) &pDevice, &pFxDriverGlobals)
 
 if (!NT_SUCCESS(status))
 
 FxPointerNotNull (pFxDriverGlobals, DmaEnablerHandle)
 
 FxPointerNotNull (pFxDriverGlobals, Config)
 
 if (Attributes !=NULL &&Attributes->ParentObject !=NULL)
 
 if (Config->Size !=expectedSize)
 
 if (Config->Size< sizeof(WDF_DMA_ENABLER_CONFIG))
 
 switch (Config->Profile)
 
 if (Config->MaximumLength==0)
 
 if (pDmaEnabler==NULL)
 
 if (NT_SUCCESS(status))
 
 __drv_maxIRQL (DISPATCH_LEVEL) size_t WDFEXPORT(WdfDmaEnablerGetMaximumLength)(__in PWDF_DRIVER_GLOBALS DriverGlobals
 
 FxObjectHandleGetPtr (GetFxDriverGlobals(DriverGlobals), DmaEnabler, FX_TYPE_DMA_ENABLER,(PVOID *) &pDmaEnabler)
 
return pDmaEnabler GetMaximumLength ()
 
return pDmaEnabler GetMaxSGElements ()
 
__in WDFDMAENABLER __in __drv_when (MaximumElements==0, __drv_reportError(MaximumElements cannot be zero)) size_t MaximumElements)
 
 FxObjectHandleGetPtrAndGlobals (GetFxDriverGlobals(DriverGlobals), DmaEnabler, FX_TYPE_DMA_ENABLER,(PVOID *) &pDmaEnabler, &pFxDriverGlobals)
 
 switch (DmaDirection)
 
 if (ProfileConfig==NULL)
 
 if (ProfileConfig->Size !=sizeof(WDF_DMA_SYSTEM_PROFILE_CONFIG))
 
 if (ProfileConfig->DmaDescriptor==NULL)
 
 if (ConfigDirection !=WdfDmaDirectionReadFromDevice &&ConfigDirection !=WdfDmaDirectionWriteToDevice)
 

Variables

_Must_inspect_result_ __in WDFDEVICE Device
 
_Must_inspect_result_ __in WDFDEVICE __in WDF_DMA_ENABLER_CONFIGConfig
 
_Must_inspect_result_ __in WDFDEVICE __in WDF_DMA_ENABLER_CONFIG __in_opt WDF_OBJECT_ATTRIBUTESAttributes
 
_Must_inspect_result_ __in WDFDEVICE __in WDF_DMA_ENABLER_CONFIG __in_opt WDF_OBJECT_ATTRIBUTES __out WDFDMAENABLER * DmaEnablerHandle
 
FxDeviceBasepDevice
 
NTSTATUS status = FxVerifierCheckIrqlLevel(pFxDriverGlobals, PASSIVE_LEVEL)
 
WDFDMAENABLER handle
 
PFX_DRIVER_GLOBALS pFxDriverGlobals
 
FxObjectpParent
 
WDF_DMA_ENABLER_CONFIG dmaConfig
 
 else
 
 pDmaEnabler
 
__in WDFDMAENABLER DmaEnabler
 
__in WDFDMAENABLER __in WDF_DMA_DIRECTION DmaDirection
 
size_t length
 
return adapter
 
_Must_inspect_result_ __in WDFDMAENABLER __in PWDF_DMA_SYSTEM_PROFILE_CONFIG ProfileConfig
 
_Must_inspect_result_ __in WDFDMAENABLER __in PWDF_DMA_SYSTEM_PROFILE_CONFIG __in WDF_DMA_DIRECTION ConfigDirection
 

Function Documentation

◆ __drv_maxIRQL() [1/2]

__drv_maxIRQL ( DISPATCH_LEVEL  )

◆ __drv_maxIRQL() [2/2]

_Must_inspect_result_ __drv_maxIRQL ( PASSIVE_LEVEL  )

◆ __drv_when()

__in WDFDMAENABLER __in __drv_when ( MaximumElements  = = 0,
__drv_reportError(MaximumElements cannot be zero  
)

Definition at line 320 of file fxdmaenablerapi.cpp.

323{
327
331 (PVOID *) &pDmaEnabler,
333
335 if (!NT_SUCCESS(status)) {
336 return;
337 }
338
339 if (MaximumElements == 0) {
342 "Cannot set MaximumElements of zero on WDFDMAENABLER %p",
343 DmaEnabler);
344 return;
345 }
346
347 pDmaEnabler->SetMaxSGElements(MaximumElements);
348}
LONG NTSTATUS
Definition: precomp.h:26
#define TRACINGDMA
Definition: dbgtrace.h:71
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE_BASE,(PVOID *) &pDevice, &pFxDriverGlobals)
pDmaEnabler
NTSTATUS status
PFX_DRIVER_GLOBALS pFxDriverGlobals
DriverGlobals
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
@ FX_TYPE_DMA_ENABLER
Definition: fxtypes.h:107
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
Definition: fxverifier.h:158
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: ps.c:97
_Must_inspect_result_ _In_ WDFDMAENABLER DmaEnabler

◆ FxObjectHandleGetPtr()

FxObjectHandleGetPtr ( GetFxDriverGlobals(DriverGlobals ,
DmaEnabler  ,
FX_TYPE_DMA_ENABLER  ,
(PVOID *) &  pDmaEnabler 
)

Referenced by if().

◆ FxObjectHandleGetPtrAndGlobals() [1/2]

FxObjectHandleGetPtrAndGlobals ( GetFxDriverGlobals(DriverGlobals ,
Device  ,
FX_TYPE_DEVICE_BASE  ,
(PVOID *) &  pDevice,
pFxDriverGlobals 
)

Referenced by __drv_when().

◆ FxObjectHandleGetPtrAndGlobals() [2/2]

FxObjectHandleGetPtrAndGlobals ( GetFxDriverGlobals(DriverGlobals ,
DmaEnabler  ,
FX_TYPE_DMA_ENABLER  ,
(PVOID *) &  pDmaEnabler,
pFxDriverGlobals 
)

◆ FxPointerNotNull() [1/2]

FxPointerNotNull ( pFxDriverGlobals  ,
Config   
)

◆ FxPointerNotNull() [2/2]

FxPointerNotNull ( pFxDriverGlobals  ,
DmaEnablerHandle   
)

◆ GetMaximumLength()

return pDmaEnabler GetMaximumLength ( )

◆ GetMaxSGElements()

return pDmaEnabler GetMaxSGElements ( )

◆ if() [1/11]

if ( NT_SUCCESSstatus)

Definition at line 69 of file fxdmaenablerapi.cpp.

69 {
70 return status;
71 }

◆ if() [2/11]

if ( Attributes = NULL && Attributes->ParentObject != NULL)

Definition at line 84 of file fxdmaenablerapi.cpp.

84 {
86 Attributes->ParentObject,
88 (PVOID*)&pParent);
89
91 FxDeviceBase * pSearchDevice;
92
93 //
94 // If a parent object is passed-in it must be descendent of device.
95 // DmaEnabler stores device and uses it during dispose
96 // (to remove it from dmaenabler list maintained at device level),
97 // so DmaEnabler cannot outlive device.
98 //
99
101
102 if (pSearchDevice == NULL) {
104
107 "Attributes->ParentObject 0x%p must have WDFDEVICE as an "
108 "eventual ancestor, %!STATUS!",
109 Attributes->ParentObject, status);
110
111 return status;
112 }
113 else if (pSearchDevice != pDevice) {
115
118 "Attributes->ParentObject 0x%p ancestor is WDFDEVICE %p, but "
119 "not the same WDFDEVICE 0x%p passed to WdfDmaEnablerCreate, "
120 "%!STATUS!",
121 Attributes->ParentObject, pSearchDevice->GetHandle(),
122 Device, status);
123
124 return status;
125 }
126 }
127 else {
128 //
129 // For < 1.11 drivers we only allow pDevice to be the parent
130 // since that is what we were blindly setting the parent to.
131 //
132 // Using the passed-in parent for such drivers could cause
133 // side-effects such as earlier deletion of DmaEnabler object. So
134 // we don't do that.
135 //
136 // We cause this verifier breakpoint to warn downlevel drivers
137 // that the parent they passed in gets ignored.
138 //
139 if (pParent != pDevice) {
142 "For drivers bound to version <= 1.9 "
143 "WdfDmaEnablerCreate uses WDFDEVICE as the "
144 "parent object for the dma enabler object. "
145 "Attributes->ParentObject 0x%p, which is different from "
146 "WDFDEVICE 0x%p, gets ignored. Please note that DmaEnabler "
147 "would be disposed only when device is disposed.",
148 Attributes->ParentObject, Device);
149
152 }
153 }
154
156 }
157 }
static FxDeviceBase * _SearchForDevice(__in FxObject *Object, __out_opt IFxHasCallbacks **Callbacks)
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
#define NULL
Definition: types.h:112
FxVerifierDbgBreakPoint(pFxDriverGlobals)
FxDeviceBase * pDevice
FxObject * pParent
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals), DmaEnabler, FX_TYPE_DMA_ENABLER,(PVOID *) &pDmaEnabler)
@ FX_TYPE_OBJECT
Definition: fxtypes.h:45
#define TRACE_LEVEL_WARNING
Definition: storswtr.h:28
_Must_inspect_result_ BOOLEAN IsVersionGreaterThanOrEqualTo(__in ULONG Major, __in ULONG Minor)
Definition: globalskm.cpp:92
__inline _Must_inspect_result_ BOOLEAN IsDownlevelVerificationEnabled()
Definition: fxglobals.h:314
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
#define STATUS_WDF_OBJECT_ATTRIBUTES_INVALID
Definition: wdfstatus.h:171

◆ if() [3/11]

if ( Config->  MaximumLength = = 0)

Definition at line 221 of file fxdmaenablerapi.cpp.

221 {
223
226 "Config MaximumLength of zero is invalid, %!STATUS!",
227 status);
228
229 return status;
230 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

◆ if() [4/11]

if ( Config->Size = expectedSize)

Definition at line 167 of file fxdmaenablerapi.cpp.

167 {
169
172 "WDF_DMA_ENABLER_CONFIG Size 0x%x, expected 0x%x, %!STATUS!",
173 Config->Size, expectedSize, status);
174
175 return status;
176 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_CHILD_LIST_CONFIG Config
Definition: wdfchildlist.h:476

◆ if() [5/11]

if ( )

Definition at line 182 of file fxdmaenablerapi.cpp.

182 {
183 //
184 // Init new fields to default values.
185 //
188 Config->MaximumLength);
189 //
190 // Copy over existing fields and readjust the struct size.
191 //
193 dmaConfig.Size = sizeof(dmaConfig);
194
195 //
196 // Use new config structure from now on.
197 //
198 Config = &dmaConfig;
199 }
WDF_DMA_ENABLER_CONFIG dmaConfig
WDF_DMA_PROFILE Profile
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
FORCEINLINE VOID WDF_DMA_ENABLER_CONFIG_INIT(_Out_ PWDF_DMA_ENABLER_CONFIG Config, _In_ WDF_DMA_PROFILE Profile, _In_ size_t MaximumLength)

◆ if() [6/11]

Definition at line 501 of file fxdmaenablerapi.cpp.

502 {
506 "ConfigDirection 0x%x is an invalid value, %!STATUS!",
508 return status;
509 }
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ PWDF_DMA_SYSTEM_PROFILE_CONFIG _In_ WDF_DMA_DIRECTION ConfigDirection

◆ if() [7/11]

if ( NT_SUCCESS(status )

Definition at line 253 of file fxdmaenablerapi.cpp.

253 {
254 //
255 // Ok: start this DmaEnabler.
256 //
257 status = pDmaEnabler->Initialize( Config, pDevice );
258 }

◆ if() [8/11]

if ( pDmaEnabler  = NULL)

Definition at line 238 of file fxdmaenablerapi.cpp.

238 {
240
242 "Could not allocate memory for a WDFDMAENABLER, "
243 "%!STATUS!", status);
244
245 return status;
246 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

◆ if() [9/11]

if ( ProfileConfig->  DmaDescriptor = NULL)

Definition at line 488 of file fxdmaenablerapi.cpp.

489 {
491
493 "ProfileConfig (%p) may not have NULL DmaDescriptor, %!STATUS!",
495
497
498 return status;
499 }
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ PWDF_DMA_SYSTEM_PROFILE_CONFIG ProfileConfig

◆ if() [10/11]

Definition at line 475 of file fxdmaenablerapi.cpp.

476 {
478
480 "WDF_DMA_SYSTEM_PROFILE_CONFIG Size 0x%x, expected 0x%x, %!STATUS!",
482
484
485 return status;
486 }

◆ if() [11/11]

if ( ProfileConfig  = NULL)

Definition at line 465 of file fxdmaenablerapi.cpp.

466 {
469 "ProfileConfig must be non-null, %!STATUS!",
470 status);
472 return status;
473 }

◆ switch() [1/2]

switch ( Config->  Profile)

Definition at line 202 of file fxdmaenablerapi.cpp.

202 {
211 break;
212 default:
216 "DMA Profile value %d is unknown, %!STATUS!",
217 Config->Profile, status);
218 return status;
219 }
@ WdfDmaProfileScatterGather
Definition: wdfdmaenabler.h:55
@ WdfDmaProfilePacket
Definition: wdfdmaenabler.h:54
@ WdfDmaProfileScatterGatherDuplex
Definition: wdfdmaenabler.h:58
@ WdfDmaProfileSystem
Definition: wdfdmaenabler.h:60
@ WdfDmaProfileSystemDuplex
Definition: wdfdmaenabler.h:61
@ WdfDmaProfilePacket64
Definition: wdfdmaenabler.h:56
@ WdfDmaProfileScatterGather64Duplex
Definition: wdfdmaenabler.h:59
@ WdfDmaProfileScatterGather64
Definition: wdfdmaenabler.h:57

◆ switch() [2/2]

switch ( DmaDirection  )

Definition at line 371 of file fxdmaenablerapi.cpp.

371 {
372
374 length = pDmaEnabler->GetReadDmaDescription()->MaximumFragmentLength;
375 break;
376
378 length = pDmaEnabler->GetWriteDmaDescription()->MaximumFragmentLength;
379 break;
380
381 default:
382 length = 0;
384 "Invalid value for Dma direction %d, %p",
387 break;
388 }
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
_In_ WDFDMAENABLER _In_ WDF_DMA_DIRECTION DmaDirection
@ WdfDmaDirectionReadFromDevice
Definition: wdfdmaenabler.h:65
@ WdfDmaDirectionWriteToDevice
Definition: wdfdmaenabler.h:66

Variable Documentation

◆ adapter

return adapter

Definition at line 433 of file fxdmaenablerapi.cpp.

Referenced by adapter_adjust_memory(), apply_format_fixups(), CheckDepthStencilCapability(), CheckRenderTargetCapability(), d3d8_CheckDepthStencilMatch(), d3d8_CheckDeviceFormat(), d3d8_CheckDeviceMultiSampleType(), d3d8_CheckDeviceType(), d3d8_CreateDevice(), d3d8_EnumAdapterModes(), d3d8_GetAdapterDisplayMode(), d3d8_GetAdapterIdentifier(), d3d8_GetAdapterModeCount(), d3d8_GetAdapterMonitor(), d3d8_GetDeviceCaps(), d3d9_CheckDepthStencilMatch(), d3d9_CheckDeviceFormat(), d3d9_CheckDeviceFormatConversion(), d3d9_CheckDeviceMultiSampleType(), d3d9_CheckDeviceType(), d3d9_CreateDevice(), d3d9_CreateDeviceEx(), d3d9_EnumAdapterModes(), d3d9_EnumAdapterModesEx(), d3d9_GetAdapterDisplayMode(), d3d9_GetAdapterDisplayModeEx(), d3d9_GetAdapterIdentifier(), d3d9_GetAdapterLUID(), d3d9_GetAdapterModeCount(), d3d9_GetAdapterModeCountEx(), d3d9_GetAdapterMonitor(), d3d9_GetDeviceCaps(), ddraw_enumerate_secondary_devices(), device_init(), fill_videocontroller(), find_arb_vs_compile_args(), get_texture_memory(), got_one(), init_format_texture_info(), FxDmaEnabler::InitializeTransferContext(), MiniportHalt(), MiniportHandleInterrupt(), MiniportInitialize(), MiniportISR(), MiniportQueryInformation(), MiniportSend(), MiniportSetInformation(), nbAStat(), nbCall(), nbCancel(), nbCmdThread(), nbDispatch(), nbHangup(), nbInternalHangup(), nbRecv(), nbReset(), nbResizeAdapter(), nbSend(), nbShutdownAdapter(), nbSStat(), Netbios(), NetBIOSHangupSession(), NetBTAstat(), NetBTAstatRemote(), NetBTCall(), NetBTCleanupAdapter(), NetBTEnumCallback(), NetBTFindName(), NetBTInternalFindName(), NetBTNameWaitLoop(), NetBTRecv(), NetBTRegisterAdapter(), NetBTSend(), NetBTWaitForNameResponse(), RPC_UuidGetNodeAddress(), swapchain_init(), wined3d_adapter_cleanup(), wined3d_adapter_init(), wined3d_adapter_init_fb_cfgs(), wined3d_adapter_init_ffp_attrib_ops(), wined3d_adapter_init_format_info(), wined3d_adapter_init_gl_caps(), wined3d_adapter_init_nogl(), wined3d_caps_gl_ctx_create(), wined3d_check_depth_stencil_match(), wined3d_check_device_format(), wined3d_cs_exec_reset_state(), wined3d_enum_adapter_modes(), wined3d_get_adapter_display_mode(), wined3d_get_adapter_identifier(), wined3d_get_adapter_mode_count(), wined3d_get_device_caps(), wined3d_get_output_desc(), and wined3d_set_adapter_display_mode().

◆ Attributes

◆ Config

◆ ConfigDirection

◆ Device

Definition at line 42 of file fxdmaenablerapi.cpp.

◆ dmaConfig

Definition at line 57 of file fxdmaenablerapi.cpp.

Referenced by if().

◆ DmaDirection

Initial value:

Definition at line 358 of file fxdmaenablerapi.cpp.

◆ DmaEnabler

Initial value:

Definition at line 279 of file fxdmaenablerapi.cpp.

◆ DmaEnablerHandle

Initial value:

Definition at line 48 of file fxdmaenablerapi.cpp.

◆ else

else
Initial value:

Definition at line 158 of file fxdmaenablerapi.cpp.

◆ handle

WDFDMAENABLER handle

Definition at line 54 of file fxdmaenablerapi.cpp.

◆ length

Definition at line 362 of file fxdmaenablerapi.cpp.

◆ pDevice

FxDeviceBase* pDevice

Definition at line 52 of file fxdmaenablerapi.cpp.

Referenced by if().

◆ pDmaEnabler

FxDmaEnabler* pDmaEnabler
Initial value:
_Must_inspect_result_ __in WDFDEVICE __in WDF_DMA_ENABLER_CONFIG __in_opt WDF_OBJECT_ATTRIBUTES * Attributes

Definition at line 235 of file fxdmaenablerapi.cpp.

Referenced by __drv_when(), if(), and switch().

◆ pFxDriverGlobals

PFX_DRIVER_GLOBALS pFxDriverGlobals

Definition at line 55 of file fxdmaenablerapi.cpp.

Referenced by __drv_when(), if(), and switch().

◆ pParent

FxObject* pParent

Definition at line 56 of file fxdmaenablerapi.cpp.

Referenced by if().

◆ ProfileConfig

◆ status