Hi,
I am converting a legacy device driver (ie WinNT) to WDF so it can be
used on Vista onwards. The operation involves DMA of large buffers of data
to the device.
I get unexpected behaviour in the DMA.
My device is capable of hardware scatter gather DMA so I would like to use
that feature for performance. However when I set the DMA profile to
WdfDmaProfileScatterGather the call back always gets a single large
ScatterGather element for the size of the whole transaction. ie it seems
to be behaving as if I had configured WdfDmaProfilePacket.
My start up code looks like:
WDF_DMA_ENABLER_CONFIG_INIT( &dmaConfig,
WdfDmaProfileScatterGather, maxXfrLen );
status = WdfDmaEnablerCreate( hDevice, &dmaConfig,
WDF_NO_OBJECT_ATTRIBUTES, &pRWC->DmaEnablerHandle );
After executing windbg shows that the dmaconfig is setup as expected ie
0: kd> dt dmaConfig
Local var @ 0xf7909608 Type _WDF_DMA_ENABLER_CONFIG
+0x000 Size : 0x24
+0x004 Profile : 2 ( WdfDmaProfileScatterGather )
+0x008 MaximumLength : 0x400000
+0x00c EvtDmaEnablerFill : (null)
+0x010 EvtDmaEnablerFlush : (null)
+0x014 EvtDmaEnablerDisable : (null)
+0x018 EvtDmaEnablerEnable : (null)
+0x01c EvtDmaEnablerSelfManagedIoStart : (null)
+0x020 EvtDmaEnablerSelfManagedIoStop : (null)
But further down the line after I call WdfDmaTransactionExecute my
EvtProgramDmaFunction get a scatter gather list with one element which is
the size of the whole transaction.
ie:
0: kd> dt ScatterGather
Local var @ 0xf78c9e74 Type _SCATTER_GATHER_LIST*
0x85c50000
+0x000 NumberOfElements : 1
+0x004 Reserved : 1
+0x008 Elements : [0] _SCATTER_GATHER_ELEMENT
where the size of the only element is 0x3ed00 bytes - much too big an
element to be in a ‘real’ scatter gather list entry.
Its as if the DMA profile is WdfDmaProfilePacket instead of
WdfDmaProfileScatterGather. ie WDF is assuming my device cannot do
hardware DMA and so is using map registers to make the (almost certainly
non-contiguous) 0x3ed00 bytes appear contiguous.
Can any one help. Have I misunderstood the operation of scatter gather
within WDF or have I just got something wrong with my code.
Thanks for any advice.
Rgds
Phil McHugh
Newspaper Software Solutions
Agfa Graphics
Tel: +44 (0) 1525 850649
Mob: +44 (0) 7836 364655
DISCLAIMER
This e-mail and the information contained in it may be confidential,
privileged and protected by law. Access by the intended recipient only is
authorised. If you are not an intended recipient, please notify the
sender immediately and do not disclose, copy, or distribute the contents
to any other person or take any action in reliance on the contents. Any
liability arising from any third party acting on any information contained
in this e-mail is hereby excluded. No warranties or assurances are made
in relation to the content of this email and the information contained in
it. We cannot guarantee that this email is virus free and has not been
intercepted or amended.