ReactOS 0.4.15-dev-7918-g2a2556c
pnpdma.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
#include <wdmguid.h>
Include dependency graph for pnpdma.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

PDMA_ADAPTER NTAPI IoGetDmaAdapter (IN PDEVICE_OBJECT PhysicalDeviceObject, IN PDEVICE_DESCRIPTION DeviceDescription, IN OUT PULONG NumberOfMapRegisters)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file pnpdma.c.

Function Documentation

◆ IoGetDmaAdapter()

PDMA_ADAPTER NTAPI IoGetDmaAdapter ( IN PDEVICE_OBJECT  PhysicalDeviceObject,
IN PDEVICE_DESCRIPTION  DeviceDescription,
IN OUT PULONG  NumberOfMapRegisters 
)

Definition at line 23 of file pnpdma.c.

26{
29 BUS_INTERFACE_STANDARD BusInterface;
32 DEVICE_DESCRIPTION PrivateDeviceDescription;
33 PDMA_ADAPTER Adapter = NULL;
34
35 DPRINT("IoGetDmaAdapter called\n");
36
37
38 /* Try to create DMA adapter through bus driver */
40 {
41 if (DeviceDescription->InterfaceType == PNPBus ||
43 {
44 RtlCopyMemory(&PrivateDeviceDescription,
46 sizeof(DEVICE_DESCRIPTION));
47
50 sizeof(INTERFACE_TYPE),
51 &PrivateDeviceDescription.InterfaceType,
53
54 if (!NT_SUCCESS(Status))
55 PrivateDeviceDescription.InterfaceType = Internal;
56
57 DeviceDescription = &PrivateDeviceDescription;
58 }
59
60 Stack.Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD);
61 Stack.Parameters.QueryInterface.Version = 1;
62 Stack.Parameters.QueryInterface.Interface = (PINTERFACE)&BusInterface;
63 Stack.Parameters.QueryInterface.InterfaceType =
64 &GUID_BUS_INTERFACE_STANDARD;
65
69 &Stack);
70
71 if (NT_SUCCESS(Status))
72 {
73 Adapter = BusInterface.GetDmaAdapter(BusInterface.Context,
76
77 BusInterface.InterfaceDereference(BusInterface.Context);
78 if (Adapter) return Adapter;
79 }
80 }
81
82 /* Fall back to HAL */
86}
LONG NTSTATUS
Definition: precomp.h:26
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:25
@ InterfaceTypeUndefined
Definition: hwresource.cpp:136
@ PNPBus
Definition: hwresource.cpp:152
@ Internal
Definition: hwresource.cpp:137
enum _INTERFACE_TYPE INTERFACE_TYPE
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
NTSTATUS NTAPI IopInitiatePnpIrp(IN PDEVICE_OBJECT DeviceObject, IN PIO_STATUS_BLOCK IoStatusBlock, IN UCHAR MinorFunction, IN PIO_STACK_LOCATION Stack)
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:1382
struct _INTERFACE * PINTERFACE
#define DPRINT
Definition: sndvol32.h:71
PINTERFACE_DEREFERENCE InterfaceDereference
Definition: iotypes.h:912
PGET_DMA_ADAPTER GetDmaAdapter
Definition: iotypes.h:914
INTERFACE_TYPE InterfaceType
Definition: iotypes.h:2080
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceDescription
Definition: wdfpdo.h:432
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
_Out_ PULONG NumberOfMapRegisters
Definition: halfuncs.h:209
#define HalGetDmaAdapter
Definition: haltypes.h:302
#define IRP_MN_QUERY_INTERFACE
@ DevicePropertyLegacyBusType
Definition: iotypes.h:1208
struct _BUS_INTERFACE_STANDARD BUS_INTERFACE_STANDARD

Referenced by FxDmaEnabler::InitializeResources(), NdisMAllocateMapRegisters(), NdisMInitializeScatterGatherDma(), NdisMRegisterDmaChannel(), StreamClassStartDevice(), USBPORT_StartDevice(), and VideoPortGetDmaAdapter().