Re: Scatter/gather DMA to a kernel buffer

Tech-Archive recommends: Fix windows errors by optimizing your registry



Alex <viszont_latasra_@xxxxxxxxxxxxx> wrote:

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);
...
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?

Umm, since you allocated the buffer, don't you HAVE the virtual address?
Specifically, MyBuffer->BufferHead?
--
Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.
.



Relevant Pages

  • [PATCH] cpm_uart: Fix dpram allocation and non-console uarts
    ... Makes non-console UART work on both 8xx and 82xx ... static unsigned int cpm_uart_tx_empty(struct uart_port *port) ... /* Write back buffer pointer */ ... * Allocate DP-Ram and memory buffers. ...
    (Linux-Kernel)
  • Re: Access violation with heap memory
    ... I'm getting a runtime access violation using heap memory that was ... Now, when I try to access the buffer in the main function, I ... Why are you using 'char'? ... Note that there is no need to allocate storage until you are in the FillBuf, ...
    (microsoft.public.vc.mfc)
  • Re: [PATCH 0/3]HTLB mapping for drivers (take 2)
    ... It sounds like this patch set working towards the same goal as my ... so the buffer is in normal memory. ... is responsible for populating a buffer for sending to a device. ... Allocate memory. ...
    (Linux-Kernel)
  • Re: [RFC v2][PATCH 2/9] General infrastructure for checkpoint restart
    ... kmalloc a temporary buffer and flush immediately. ... Only after the container resumes ... (This is also useful in case you want to keep the checkpoint image entirely ... provides a shortcut to allocate space directly on the buffer, ...
    (Linux-Kernel)
  • Re: perfmon2 vector argument question
    ... into a kernel buffer. ... the vector must be copied into a kernel-level buffer. ... because kmalloc/kfree are expensive. ... Another approach that was suggested to me is to allocate on demand but not kfree ...
    (Linux-Kernel)