ReactOS  0.4.13-dev-544-gede3fdd
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  */
22 NTAPI
26 {
29  BUS_INTERFACE_STANDARD BusInterface;
31  IO_STACK_LOCATION Stack;
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  {
43  {
44  RtlCopyMemory(&PrivateDeviceDescription,
46  sizeof(DEVICE_DESCRIPTION));
47 
50  sizeof(INTERFACE_TYPE),
51  &PrivateDeviceDescription.InterfaceType,
52  &ResultLength);
53 
54  if (!NT_SUCCESS(Status))
55  PrivateDeviceDescription.InterfaceType = Internal;
56 
57  DeviceDescription = &PrivateDeviceDescription;
58  }
59 
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 }
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
#define HalGetDmaAdapter
Definition: haltypes.h:291
#define IN
Definition: typedefs.h:38
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
enum _INTERFACE_TYPE INTERFACE_TYPE
PGET_DMA_ADAPTER GetDmaAdapter
Definition: iotypes.h:881
_Out_ PULONG NumberOfMapRegisters
Definition: halfuncs.h:209
PDMA_ADAPTER NTAPI IoGetDmaAdapter(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PDEVICE_DESCRIPTION DeviceDescription, IN OUT PULONG NumberOfMapRegisters)
Definition: pnpdma.c:23
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:4210
void DPRINT(...)
Definition: polytest.cpp:61
struct _INTERFACE * PINTERFACE
_Must_inspect_result_ _In_ PDEVICE_DESCRIPTION DeviceDescription
Definition: iofuncs.h:1015
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IRP_MN_QUERY_INTERFACE
Status
Definition: gdiplustypes.h:24
struct _BUS_INTERFACE_STANDARD BUS_INTERFACE_STANDARD
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
unsigned int * PULONG
Definition: retypes.h:1
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
PINTERFACE_DEREFERENCE InterfaceDereference
Definition: iotypes.h:879
#define OUT
Definition: typedefs.h:39
INTERFACE_TYPE InterfaceType
Definition: iotypes.h:2035
unsigned int ULONG
Definition: retypes.h:1
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
NTSTATUS NTAPI IopInitiatePnpIrp(IN PDEVICE_OBJECT DeviceObject, IN PIO_STATUS_BLOCK IoStatusBlock, IN UCHAR MinorFunction, IN PIO_STACK_LOCATION Stack)