Regarding consistent_alloc

Tom Rini trini at kernel.crashing.org
Wed Dec 11 04:49:11 EST 2002


On Mon, Dec 09, 2002 at 11:06:13AM +0200, Pantelis Antoniou wrote:

[snip]
> Since I'm the one that started this thread let me make a few points.
>
> 1. The comment that consistent_alloc is tied to the PCI bus is valid,
> since the dma_handle is returned by a call to virt_to_bus(), with
> the virt_to_bus() being:
>
> /*
> * The PCI bus is inherently Little-Endian.  The PowerPC is being
> * run Big-Endian.  Thus all values which cross the [PCI] barrier
> * must be endian-adjusted.  Also, the local DRAM has a different
> * address from the PCI point of view, thus buffer addresses also
> * have to be modified [mapped] appropriately.
> */
> extern inline unsigned long virt_to_bus(volatile void * address)
> {
> #ifndef CONFIG_APUS
>        if (address == (void *)0)
>                return 0;
>        return (unsigned long)address - KERNELBASE + PCI_DRAM_OFFSET;
> #else
>        return iopa ((unsigned long) address);
> #endif
> }

This is typically used by PCI, but look at the code for the !CONFIG_APUS
(ie just about every machine, including all 8xx) case.  This is the
iopa, that if classes haven't made me even more incoherent, that has
been mentioned throught the thread.

> Also the consistent_sync() takes as a direction argument values like
> PCI_DMA_FROMDEVICE.

This is unfortunate, but 'expected' for now.  These constants really
have nothing to do with PCI DMA, but DMA in general.  There was a hope
of fixing that in 2.5, but I don't recall if it happened (it might
have) yet.

> It has something obviously to do with a PCI bus. My board, and I believe
> most of the boards with a 8xx do not have a PCI bus.
>
> Is it possible to modify consistent_alloc to be something more
> generic?

It is already generic, it's just not obvious :(

> 2. I have a requirement to have my drivers loaded as modules.
> m8xx_cpm_hostalloc has a very simplistic implementation, which
> makes it unsuitable for something like that. I have some patches
> that fix both m8xx_cpm_hostalloc and 8xx_cpm_dpalloc by implementing
> a proper heap, with free space management and coalescing.
> What is the proper way to push them, and to whom?

<buck passing mode=on>Dan Malek still knows the most about the
8xx-specific portions of the kernel, so he should really speak up here
when he gets a moment</buck passing>

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-embedded mailing list