Hello,
I am facing a problem while writing a WDM DMA driver for a PCI chipset PLX 9080. I have to use the DMA chaining mode of PLX 9080. The descripor list for DMA chaining has to be on the PCI host.
I have carried out the following steps so far.
(1) In the start device got access to the DMA Adapter object by using "IoGetDmaAdapter"
(2) Then used the Adpater object pointer to allocate 33 buffers using "AllocateCommonBuffer". The physical and the virtual addresses of these buffers are stored. All the 33 buffers are of PAGE_SIZE. Next, the PCI descriptors for the DMA chaining transfer are stored in these allocated buffers.
(3) When a IOCTL write is fired to the DMA device object with DIRECT_IO (METHOD_OUT_DIRECT), I get the Mdl for the output buffer for the DMA transfer.
(4) The following set of operations are used to get the physical addresses of the buffer referred to by the Mdl.
(a) Mdl = Irp->MdlAddress
(b) MmProbeAndLockPages()
(c) MmGetMdlByteCount ()
(d) MmGetMdlVirtualAddress ()
(e) MmGetMdlByteOffset()
(5) Determine the number of map registers required by using ADDRESS_AND_SIZE_TO_SPAN_PAGES
(6) Then determine howmany times the GetScatterGatherList needs to be called by dividing the above result with the no of map registers allocated.
(7) If a scatter gather list alreday exists, clear it by calling PutScatterGatherList.
(8) Next Call ScatterGatherList with an adapter control routine.
(9) Mark the IRP Pending
Adapter Control routine
(10) Uses the elements of the scatter gather lsit to fill in the descriptors allocated using the AllocatecommonBuffer.
(11) Once the descriptors are filled with the physical addresses obtained, we next assign the DMA channel 0 descritor register wuth the address of the first PCI descriptor by giving the physicall address of the first buffer obtained via AllocateCommonBuffer API.
(3) Finally the DMA registers are filled to reflect chaining mode and the transferis started.
(4) the device physical address that I gave is the address at which the device has mapped the memory. This address is not the address that I see in Windows in the resources tab for the driver.
(5) I complete the IRP in the DPC.
Observation:
(1) I tried for a small size of 0x3c bytes and found the device to freeze.
(2) I suspect address given for DMA transfer. Are the PCI and device physical addresses provided correct?
(3) To get the device back to normal operation, I have to restart the system.
(4) I get no interrupt so IRP remains pending.
Where does the problem lie? Can u guide me?
Regards,
Purvi