Re: Looking for KMDF alternative to MmAllocateContiguousMemorySpecifyCache
- From: already5chosen@xxxxxxxxx
- Date: 20 Sep 2006 09:58:02 -0700
Eliyas Yakub [MSFT] wrote:
Why do you need contiguous memory? Do you need it for DMA purposes?
There is no direct KMDF equivalent of this function. WdfCommonBuffer will
give you contiguous memory but you need to allocate a DMA enabler object
first.
Yes, both you and Max guessed right - DMA. Our good old friend - PLX
PCI9xxx.
Why don't I use AllocateCommonBuffer? Two reasons:
1. Strictly speaking, I don't need contiguous memory.
Since the buffer I'm planning to allocate is not exactly small I want
to apply as little pressure as possible on the system resources.
O.k. Now I realized that this argument isn't very sound because
MmAllocateContiguousMemory() also gives me, well, contiguous memory.
But at least I can allocated several smaller buffer... on the other
hand, the same is possible with AllocateCommonBuffer(). Well,... let's
continue to the argument #2
2. I run my PCI9xxx in the Scatter/Gather Mode with the SG Descriptors
located in the system memory. The oddity is - the device supports
dual-address cycles for DMA data access, but not for descriptors
access.
So the user buffer could live elsewhere in the full address space but
descriptors have to reside in the lower 4GB. So going with common
buffer I really have no idea what profile I should specify in
WDF_DMA_ENABLER_CONFIG_INIT(). Allocating space for descriptor list
with MmAllocateContiguousMemory(,4G-1) and setting
profile=WdfDmaProfileScatterGather64 looks like a nice workaround.
Now thinking about it, may be, I should create TWO DMA enabler objects,
one for descriptor list (with profile =WdfDmaProfilePacket or
WdfDmaProfileScatterGather) and another one for the data with
profile=WdfDmaProfileScatterGather64? Sounds weird.
Yes it's okay to use WDM and KMDF function in a driver however you should
try to find out if there a KMDF equivalent and use that (just like you are
doing now) because we provide KMDF equivalent to a WDM function only if
there is any value add in doing so in terms of better and simple programming
pattern, eliminating common mistakes, improving reliability, diagnosability,
etc.
We have come up with a porting table that will help you in quickly
identifying which concept of WDM maps to KMDF.
http://www.microsoft.com/whdc/driver/wdf/WDF_Port.mspx
-Eliyas
Thanks
.
- Follow-Ups:
- Re: Looking for KMDF alternative to MmAllocateContiguousMemorySpecifyCache
- From: Eliyas Yakub [MSFT]
- Re: Looking for KMDF alternative to MmAllocateContiguousMemorySpecifyCache
- From: Maxim S. Shatskih
- Re: Looking for KMDF alternative to MmAllocateContiguousMemorySpecifyCache
- References:
- Looking for KMDF alternative to MmAllocateContiguousMemorySpecifyCache
- From: already5chosen
- Re: Looking for KMDF alternative to MmAllocateContiguousMemorySpecifyCache
- From: Eliyas Yakub [MSFT]
- Looking for KMDF alternative to MmAllocateContiguousMemorySpecifyCache
- Prev by Date: Re: Installing USB driverin Vista
- Next by Date: Re: Looking for KMDF alternative to MmAllocateContiguousMemorySpecifyCache
- Previous by thread: Re: Looking for KMDF alternative to MmAllocateContiguousMemorySpecifyCache
- Next by thread: Re: Looking for KMDF alternative to MmAllocateContiguousMemorySpecifyCache
- Index(es):
Relevant Pages
|