Mapping to DMA Address

Hi Experts,

I do want to implement Page table in my KMDF driver.
In that I need to map the user provided Scatterlist to the DMA address.

Also , I need to map the kernel virtual address to the DMA Address.

Are there any relevant Routines in Windows to achieve this feature. Also , if there is any example, please provide it.

Thanks in Advance.

What problem are you trying to solve with “implementing a page table”?

Create a MDL and then pass it to ->GetScatterGatherList.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hi Experts,
>
> I do want to implement Page table in my KMDF driver.
> In that I need to map the user provided Scatterlist to the DMA address.
>
>
> Also , I need to map the kernel virtual address to the DMA Address.
>
>
> Are there any relevant Routines in Windows to achieve this feature. Also , if there is any example, please provide it.
>
> Thanks in Advance.
>

Yes, OP… there’s an entire Windows set of APIs for handling Scatter/Gather DMA.

https:

If that’s not helpful, please provide a more specific question.

Peter
OSR
@OSRDrivers</https:>

I tried with GetScatterGatherList(). but to use this routine, it is said that a sequence of routines need to handle before so that it’s result can be given as input to this routine.

Actually, to get the dma adapter object for the device, i used WdfDmaEnablerWdmGetDmaAdapter() in earlier.

But ,IoGetDmaAdapter() must be called by the driver to get the DMA Object. Will there be any problem with using the adapter object got from the above WdfDmaEnablerWdmGetDmaAdapter().

Also, while allocating the MDLusing IoAllocateMdl(), there is a length parameter which indicates the buffer that the MDL to describe. Am not clear with this length parameter.Can anyone make it cooler.

xxxxx@gmail.com wrote:

I tried with GetScatterGatherList(). but to use this routine, it is said that a sequence of routines need to handle before so that it’s result can be given as input to this routine.

Actually, to get the dma adapter object for the device, i used WdfDmaEnablerWdmGetDmaAdapter() in earlier.

But ,IoGetDmaAdapter() must be called by the driver to get the DMA Object. Will there be any problem with using the adapter object got from the above WdfDmaEnablerWdmGetDmaAdapter().

As the function’s name implies, WdfDmaEnablerWdmGetDmaAdapter simply
calls IoGetDmaAdapter. However, in a KMDF driver, you shouldn’t need to
call the DMA adapter functions directly. The WdfDmaEnabler abstraction
should be able to handle anything you need to do.

Also, while allocating the MDLusing IoAllocateMdl(), there is a length parameter which indicates the buffer that the MDL to describe. Am not clear with this length parameter.Can anyone make it cooler.

Hard to see how it could be clearer. If you intended to map a 4MB
buffer, then the length parameter should be 4MB.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.