ReactOS 0.4.16-dev-1946-g52006dd
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) WDFAPI NTSTATUS NTAPI 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) WDFAPI size_t NTAPI 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 328 of file fxdmaenablerapi.cpp.

331{
335
339 (PVOID *) &pDmaEnabler,
341
343 if (!NT_SUCCESS(status)) {
344 return;
345 }
346
347 if (MaximumElements == 0) {
350 "Cannot set MaximumElements of zero on WDFDMAENABLER %p",
351 DmaEnabler);
352 return;
353 }
354
355 pDmaEnabler->SetMaxSGElements(MaximumElements);
356}
LONG NTSTATUS
Definition: precomp.h:26
#define TRACINGDMA
Definition: dbgtrace.h:71
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#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
__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 71 of file fxdmaenablerapi.cpp.

71 {
72 return status;
73 }

◆ if() [2/11]

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

Definition at line 86 of file fxdmaenablerapi.cpp.

86 {
88 Attributes->ParentObject,
90 (PVOID*)&pParent);
91
93 FxDeviceBase * pSearchDevice;
94
95 //
96 // If a parent object is passed-in it must be descendent of device.
97 // DmaEnabler stores device and uses it during dispose
98 // (to remove it from dmaenabler list maintained at device level),
99 // so DmaEnabler cannot outlive device.
100 //
101
103
104 if (pSearchDevice == NULL) {
106
109 "Attributes->ParentObject 0x%p must have WDFDEVICE as an "
110 "eventual ancestor, %!STATUS!",
111 Attributes->ParentObject, status);
112
113 return status;
114 }
115 else if (pSearchDevice != pDevice) {
117
120 "Attributes->ParentObject 0x%p ancestor is WDFDEVICE %p, but "
121 "not the same WDFDEVICE 0x%p passed to WdfDmaEnablerCreate, "
122 "%!STATUS!",
123 Attributes->ParentObject, pSearchDevice->GetHandle(),
124 Device, status);
125
126 return status;
127 }
128 }
129 else {
130 //
131 // For < 1.11 drivers we only allow pDevice to be the parent
132 // since that is what we were blindly setting the parent to.
133 //
134 // Using the passed-in parent for such drivers could cause
135 // side-effects such as earlier deletion of DmaEnabler object. So
136 // we don't do that.
137 //
138 // We cause this verifier breakpoint to warn downlevel drivers
139 // that the parent they passed in gets ignored.
140 //
141 if (pParent != pDevice) {
144 "For drivers bound to version <= 1.9 "
145 "WdfDmaEnablerCreate uses WDFDEVICE as the "
146 "parent object for the dma enabler object. "
147 "Attributes->ParentObject 0x%p, which is different from "
148 "WDFDEVICE 0x%p, gets ignored. Please note that DmaEnabler "
149 "would be disposed only when device is disposed.",
150 Attributes->ParentObject, Device);
151
154 }
155 }
156
158 }
159 }
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 223 of file fxdmaenablerapi.cpp.

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

◆ if() [4/11]

if ( Config->Size = expectedSize)

Definition at line 169 of file fxdmaenablerapi.cpp.

169 {
171
174 "WDF_DMA_ENABLER_CONFIG Size 0x%x, expected 0x%x, %!STATUS!",
175 Config->Size, expectedSize, status);
176
177 return status;
178 }
#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 184 of file fxdmaenablerapi.cpp.

184 {
185 //
186 // Init new fields to default values.
187 //
190 Config->MaximumLength);
191 //
192 // Copy over existing fields and readjust the struct size.
193 //
195 dmaConfig.Size = sizeof(dmaConfig);
196
197 //
198 // Use new config structure from now on.
199 //
200 Config = &dmaConfig;
201 }
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 515 of file fxdmaenablerapi.cpp.

516 {
520 "ConfigDirection 0x%x is an invalid value, %!STATUS!",
522 return status;
523 }
_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 255 of file fxdmaenablerapi.cpp.

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

◆ if() [8/11]

if ( pDmaEnabler  = NULL)

Definition at line 240 of file fxdmaenablerapi.cpp.

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

◆ if() [9/11]

if ( ProfileConfig->  DmaDescriptor = NULL)

Definition at line 502 of file fxdmaenablerapi.cpp.

503 {
505
507 "ProfileConfig (%p) may not have NULL DmaDescriptor, %!STATUS!",
509
511
512 return status;
513 }
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ PWDF_DMA_SYSTEM_PROFILE_CONFIG ProfileConfig

◆ if() [10/11]

Definition at line 489 of file fxdmaenablerapi.cpp.

490 {
492
494 "WDF_DMA_SYSTEM_PROFILE_CONFIG Size 0x%x, expected 0x%x, %!STATUS!",
496
498
499 return status;
500 }

◆ if() [11/11]

if ( ProfileConfig  = NULL)

Definition at line 479 of file fxdmaenablerapi.cpp.

480 {
483 "ProfileConfig must be non-null, %!STATUS!",
484 status);
486 return status;
487 }

◆ switch() [1/2]

switch ( Config->  Profile)

Definition at line 204 of file fxdmaenablerapi.cpp.

204 {
213 break;
214 default:
218 "DMA Profile value %d is unknown, %!STATUS!",
219 Config->Profile, status);
220 return status;
221 }
@ 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 381 of file fxdmaenablerapi.cpp.

381 {
382
384 length = pDmaEnabler->GetReadDmaDescription()->MaximumFragmentLength;
385 break;
386
388 length = pDmaEnabler->GetWriteDmaDescription()->MaximumFragmentLength;
389 break;
390
391 default:
392 length = 0;
394 "Invalid value for Dma direction %d, %p",
397 break;
398 }
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 445 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(), __crt_stdio_input::skip_whitespace(), 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(), wined3d_set_adapter_display_mode(), and __crt_stdio_output::write_multiple_characters().

◆ Attributes

◆ Config

◆ ConfigDirection

◆ Device

Definition at line 44 of file fxdmaenablerapi.cpp.

◆ dmaConfig

Definition at line 59 of file fxdmaenablerapi.cpp.

Referenced by if().

◆ DmaDirection

Initial value:

Definition at line 368 of file fxdmaenablerapi.cpp.

◆ DmaEnabler

Initial value:

Definition at line 283 of file fxdmaenablerapi.cpp.

◆ DmaEnablerHandle

Initial value:

Definition at line 50 of file fxdmaenablerapi.cpp.

◆ else

else
Initial value:

Definition at line 160 of file fxdmaenablerapi.cpp.

◆ handle

WDFDMAENABLER handle

Definition at line 56 of file fxdmaenablerapi.cpp.

◆ length

Definition at line 372 of file fxdmaenablerapi.cpp.

◆ pDevice

FxDeviceBase* pDevice

Definition at line 54 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 237 of file fxdmaenablerapi.cpp.

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

◆ pFxDriverGlobals

PFX_DRIVER_GLOBALS pFxDriverGlobals

Definition at line 57 of file fxdmaenablerapi.cpp.

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

◆ pParent

FxObject* pParent

Definition at line 58 of file fxdmaenablerapi.cpp.

Referenced by if().

◆ ProfileConfig

◆ status