http://msdn.microsoft.com/en-us/library/ff540590(v=vs.85).aspx
1.wdm dma
uses IoGetDmaAdapter
DeviceDescription parameter in this determines map buffer or scatter gather method
2.map buffer dma
AllocateAdapterChannel uses user mode mdl request
it checks preallocated map registers
when dma is possible for the adapter, adapter routine is called
from adapter routine, map transfer for mdl,length is done.it returned the device logical address
the device logical address is programmed into the hardware
return deallocate adapter
for scatter gather simulation call maptransfer continuously,each map transfer is 1 map register,1 sge,maximum of num of map register for which maptransfer can be called depends on IoGetDmaAdapter
The above step is for single irp, and sequential processing
3.scatter gather dma
for a single irp driver calls getscattergatherlist,which invokes adapterlistcontrol routine
adapterlistcontrol has gets sgl,mapregisterbase
after a dma for current fdo is finished ,its map registers should be freed so that another fdo
in the system can do a allocateadapterchannel adaptercontrol callback
so dma hops from one fdo to another like isr searching entire system.
Also we can allocate a commonbuffer and skip adaptercontrol and do the dma directly.this is
because for common buffer we already get the device logical address(phy address),in former we
had to wait for the adapter control to get the map register and then call maptransfer to get the
device logical address
In get/setscattergatherlist method we can parallelly issue multiple getscattergatherlist and
then adapterlistcontrolgets called async,we process the sgl input and program the device
2.ndis dma
NdisMInitializescattergatherlist() if called uses get/setscattergatherlist method above.
otherwise, the first method is used.
A serialized nic uses NdisMAllocateMapRegisters
A deserialized one uses other
the first method allocates shared memory,copy data into shared memory,get map register using
NdisMStartBufferPhysicalMapping the resultant device logical address is programmed,maybe shared
memory address is directly used,output is similar to sgl but for single mdl
maptransfer gives output single mapregister entry with length.this can be multiple contiguous
physical page.the length of output is given in one of the parameters.
max dma size lso - 64k
max dma offld - 1mb
No comments:
Post a Comment