Hi All,
In my WDM driver’s AddDevice routine for our PCI device, I call the
IoCreateDevice to create and get the function device pointer. Then I set the
AlignmentRequirement field to 7(orginal value is 0, and the physical
device’s is also 0) because our hardware need 8 bytes alignment requirement
for DMA operation. But after I called IoAttachDeviceToDeviceStack, the
AlignemntRequirement return back to 0 and physical device’s is still 0! So
when I initialize a DMA adapter and I call GetDmaAlignment, it just return
1.
But according to Win2K DDK, the comment for IoAttachDeviceToDeviceStack
is “This routine sets the AlignmentRequirement in SourceDevice to the value
in the next-lower device object”. So is there anything I missed here that
cause this strange problem? Your answer is appreciated!
Best Regards,
William
Cannot set the AlignmentRequirement field in DeviceObjectGetDmaAlignment is the minimum alignment required to do DMA (based on the processor and the hal). You should use that to set the DeviceObject’s AlignmentRequirement. GetDmaAlignment does not know anything about your device. x86 hal always returns 1 for GetDmaAlignment as that’s the minimum requirement. You should also set the AlignmentRequirement after the call to IoAttachDeviceToDeviceStack. Otherwise your value will be overwritten by what’s present in the PDO.
“William Zhang” wrote in message news:xxxxx@ntdev…
Hi All,
In my WDM driver’s AddDevice routine for our PCI device, I call the IoCreateDevice to create and get the function device pointer. Then I set the AlignmentRequirement field to 7(orginal value is 0, and the physical device’s is also 0) because our hardware need 8 bytes alignment requirement for DMA operation. But after I called IoAttachDeviceToDeviceStack, the AlignemntRequirement return back to 0 and physical device’s is still 0! So when I initialize a DMA adapter and I call GetDmaAlignment, it just return 1.
But according to Win2K DDK, the comment for IoAttachDeviceToDeviceStack is “This routine sets the AlignmentRequirement in SourceDevice to the value in the next-lower device object”. So is there anything I missed here that cause this strange problem? Your answer is appreciated!
Best Regards,
William