From: emusic on
Hello!

I have written a virtual (root-enumerated) device driver as a miniport
for the WavePci (portcls.sys). WavePci interface uses a scatter-gather
list to supply a miniport driver with an IRP data buffer. In my
IMiniportWavePci::Init method, I must return a IDmaChannel interface.
To obtain such interface, I use IPortWavePci::NewMasterDmaChannel.
Under 32-bit Windows (2k/XP/2k3) it works fine. Under 64-bit Windows,
IPortWavePci::NewMasterDmaChannel always returns
STATUS_DEVICE_CONFIGURATION_ERROR.

I traced IPortWavePci::NewMasterDmaChannel and found it calls
IoGetDmaAdapter that returns 0. IoGetDmaAdapter issues
IRP_MJ_PNP/IRP_MN_QUERY_INTERFACE with the BUS_INTERFACE_STANDARD to a
device stack. This IRP is received back by the portcls.sys that returns
STATUS_NOT_SUPPORTED.

How can I get a valid DMA_ADAPTER structure under 64-bit Windows? I
only need a standard mechanism that breaks an IRP buffer into a
scatted-gather list compatible with WavePci; then my miniport driver
will receive a mapping list from the portcls.sys. In 32-bit Windows,
there is a set of legacy driver support functions; are they present in
64-bit Windows?

I could implement all DMA_OPERATIONS functionality myself but it seems
like a last chance. Maybe there is a simpler way?

Regards,
Eugene

From: Eliyas Yakub [MSFT] on
You cannot call IoGetDmaAdapter on a root-enumerated device. It kind of
works on X86 because the system falls back to using HalGetDmaAdapter when
the IRP_MN_QUERY_INTERFACE fails. On x64, these hal functions are not
available so the function returns NULL.


--
-Eliyas
This posting is provided "AS IS" with no warranties, and confers no rights.
http://www.microsoft.com/whdc/driver/kernel/KB-drv.mspx


From: emusic on
Thank you for your answer. I know that IoGetDmaAdapter don't give me a
valid DMA_ADAPTER object but maybe there is a workaround? I don't need
a real DMA activity but only a set of functions to place into the
DMA_OPERATIONS structure. Maybe it is possible to request DMA_ADAPTER
from a system hardware device? Or the only way is to implement all
DMA_OPERATIONS functionality myself?

From: Eliyas Yakub [MSFT] on
You have to fake it out yourself. When the I/O manager sends the
query-interfaces, he sends it to the top of the stack. Which means it will
pass thru your driver. So you can intercept and fill out the interface
structure yourself and complete the request - instead of passing it down.
When you complete the request, the I/O manager will call GetDmaAdapter and
InterfaceDereference functions from the interface. You will have to respond
to that.

--
-Eliyas
This posting is provided "AS IS" with no warranties, and confers no rights.
http://www.microsoft.com/whdc/driver/kernel/KB-drv.mspx