consistent_alloc() on PPC
Matt Porter
mporter at kernel.crashing.org
Fri Jan 21 05:16:27 EST 2005
On Thu, Jan 20, 2005 at 10:00:47PM +0530, Sachin P wrote:
> Hi,
> Thanks a lot to all of you for the help .
> The following is a more clearer version of the problem I am facing :
>
> 1.I am porting drivers from X86 (running Linux 2.4-20) to
> PPC platform running (Montevista Linux-2.4.20).
> 2.In wrapper function for DMA allocation, I am using
> consistent_alloc() to allocate the memory. This function gives me
> both the virtual-address as well as the dma-address.
> I pass both these values to the upper-level drivers.
> 3. However , once the upper-level drivers are done with the memory
> they call the wrapper function for free dma and pass only the dma
> address and not the virtual-address. However consistent_free()
> accepts only virtual-address.
> Hence I need a way to convert the dma address to the
> virtual-address.
All you need to do is cache the virtual address and the dma/phys
address for later use when calling consistent_free(). converting
random DMA/phys to virtual is a bad idea since you are going to
find multiple mappings. Cache the results in your driver...it's
trivial.
-Matt
More information about the Linuxppc-dev
mailing list