ReactOS 0.4.16-dev-306-g647d351
pnpdma.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Kernel
3 * COPYRIGHT: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/io/pnpmgr/pnpdma.c
5 * PURPOSE: PnP manager DMA routines
6 * PROGRAMMERS: Filip Navara (xnavara@volny.cz)
7 */
8
9/* INCLUDES ******************************************************************/
10
11#include <ntoskrnl.h>
12#define NDEBUG
13#include <debug.h>
14#include <wdmguid.h>
15
16/* PUBLIC FUNCTIONS **********************************************************/
17
18/*
19 * @implemented
20 */
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:33
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)
PDMA_ADAPTER NTAPI IoGetDmaAdapter(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PDEVICE_DESCRIPTION DeviceDescription, IN OUT PULONG NumberOfMapRegisters)
Definition: pnpdma.c:23
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:73
PINTERFACE_DEREFERENCE InterfaceDereference
Definition: iotypes.h:912
PGET_DMA_ADAPTER GetDmaAdapter
Definition: iotypes.h:914
INTERFACE_TYPE InterfaceType
Definition: iotypes.h:2080
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
_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