Tech Support > Microsoft Windows > Drivers > Scatter/gather DMA to a kernel buffer
Scatter/gather DMA to a kernel buffer
Posted by Alex on May 12th, 2008


Hi,
I have to start a DMA scatter/gather transfer from a device to a kernel
mode buffer (allocated in nonpageable pool). I wanted to use
GetScatterGatherList(), but I haven't got any IRP to get the MDL from, so
I tried using IoAllocateMdl() to allocate a custom MDL mapping my buffer.
The code I use is the following:

MDLForDma = IoAllocateMdl((PVOID)(MyBuffer->BufferHead), Length, FALSE,
FALSE, NULL);

if(MDLForDma == NULL)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
return Status;
}

The allocation goes fine, but when I afterwards call GetScatterGatherList
what should I put into CurrentVa parameter?
Peeking inside the MDLForDma that IoAllocateMdl() returns I noticed that
StartVa is 0, and I guess that 0 is not a valid virtual address. Is there
something I'm doing wrong?

Bye
Alex

Posted by Tim Roberts on May 14th, 2008


Alex <viszont_latasra_@nerdshack.com> wrote:
Umm, since you allocated the buffer, don't you HAVE the virtual address?
Specifically, MyBuffer->BufferHead?
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.


Similar Posts