Hi,
I was looking at ways to allocate a DMA buffer (of size 10 MB) for
communicating between my device and driver (storport miniport) outside the
context of HwStorFindAdapter. As discussed on the group a couple of days
back, this seems to rule out the usage of StorPortGetUncachedExtension API.
This DMA buffer is not for issuing read/write SRBs but for other data
transfer.
As alternatives, I was looking at doing the following:
a. Allocate a non-paged pool buffer of 10 MB, using
StorPortAllocatePool.
b. Allocate a MDL for the buffer allocated using StorPortAllocateMdl
c. With the MDL and buffer, create scatter-gather list using
StorPortBuildScatterGatherList.
d. Use the SG list for DMA transfers.
Is this approach correct? Are there any pitfalls/issues in this
approach?
I have attempted to do the above and see the following failures:
-
When I specify the size for StorPortBuildScatterGatherList as 10MB,
with verifier turned on, I see a stop code of 0xE6. The description
indicates that the DMA was attempted with buffer which was not locked and is
from paged pool. I am not sure who attempted the DMA transfer (as I am yet
setting it up) and also the memory for the buffer was allocated from
non-paged pool. -
I then tried to carve out a smaller DMA buffer from the original 10
MB buffer by specifying 256K as the size for StorPortBuildScatterGatherList
(just for testing). The call fails with STOR_STATUS_UNSUCCESSFUL. Since
there are no guidelines on the size that can be specified when using this
API, I am not sure if it’s the size that is the issue here or I am doing
some thing wrong with my code.
On a side note, I am able to successfully allocate a DMA buffer for 10 MB if
I do this from within HwStorFindAdapter using StorPortGetUncachedExtension
API on the same server (Win2k8 R2 with 4GB memory and device supports 64bit
DMA).
Any advice from the experts would definitely help.
Regards,
Girish.