Scatter/gather DMA to a kernel buffer



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
.



Relevant Pages

  • Re: Scatter/gather DMA to a kernel buffer
    ... I tried using IoAllocateMdl() to allocate a custom MDL mapping my buffer. ... MDLForDma = IoAllocateMdl, Length, FALSE, ...
    (microsoft.public.development.device.drivers)
  • MDL doubts
    ... while we call IoAllocateMdl we pass the base virtual address to it allocated ... Q1.Is this the virtual kernal space adress. ... Q2.Does it allocate memory for the MDL structure. ...
    (microsoft.public.development.device.drivers)
  • Re: About IOCTL_HID_GET_FEATURE
    ... > Irp->MdlAddress to the output feature report buffer. ... >>> I want to know how should I allocate the feature report buffer to the ... >>> By using IoAllocateMdl()? ... >> Maxim Shatskih, Windows DDK MVP ...
    (microsoft.public.development.device.drivers)