3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/io/pnpdma.c
6 * PURPOSE: PnP manager DMA routines
8 * PROGRAMMERS: Filip Navara (xnavara@volny.cz)
11 /* INCLUDES ******************************************************************/
15 #include <internal/debug.h>
18 /* FUNCTIONS *****************************************************************/
25 IN PDEVICE_OBJECT PhysicalDeviceObject
,
26 IN PDEVICE_DESCRIPTION DeviceDescription
,
27 IN OUT PULONG NumberOfMapRegisters
)
31 BUS_INTERFACE_STANDARD BusInterface
;
32 IO_STATUS_BLOCK IoStatusBlock
;
33 IO_STACK_LOCATION Stack
;
34 DEVICE_DESCRIPTION PrivateDeviceDescription
;
35 PDMA_ADAPTER Adapter
= NULL
;
37 DPRINT("IoGetDmaAdapter called\n");
40 * Try to create DMA adapter through bus driver.
43 if (PhysicalDeviceObject
!= NULL
)
45 if (DeviceDescription
->InterfaceType
== PNPBus
||
46 DeviceDescription
->InterfaceType
== InterfaceTypeUndefined
)
48 RtlCopyMemory(&PrivateDeviceDescription
, DeviceDescription
,
49 sizeof(DEVICE_DESCRIPTION
));
50 Status
= IoGetDeviceProperty(PhysicalDeviceObject
,
51 DevicePropertyLegacyBusType
, sizeof(INTERFACE_TYPE
),
52 &PrivateDeviceDescription
.InterfaceType
, &ResultLength
);
53 if (!NT_SUCCESS(Status
))
54 PrivateDeviceDescription
.InterfaceType
= Internal
;
55 DeviceDescription
= &PrivateDeviceDescription
;
58 Stack
.Parameters
.QueryInterface
.Size
= sizeof(BUS_INTERFACE_STANDARD
);
59 Stack
.Parameters
.QueryInterface
.Version
= 1;
60 Stack
.Parameters
.QueryInterface
.Interface
= (PINTERFACE
)&BusInterface
;
61 Stack
.Parameters
.QueryInterface
.InterfaceType
=
62 &GUID_BUS_INTERFACE_STANDARD
;
63 Status
= IopInitiatePnpIrp(PhysicalDeviceObject
, &IoStatusBlock
,
64 IRP_MN_QUERY_INTERFACE
, &Stack
);
65 if (NT_SUCCESS(Status
))
67 Adapter
= BusInterface
.GetDmaAdapter(BusInterface
.Context
,
68 DeviceDescription
, NumberOfMapRegisters
);
69 BusInterface
.InterfaceDereference(BusInterface
.Context
);
79 return HalGetDmaAdapter(PhysicalDeviceObject
, DeviceDescription
,
80 NumberOfMapRegisters
);