Subject: Re: DMA buffers
To: Marcus Comstedt <marcus@idonex.se>
From: Jason R Thorpe <thorpej@zembu.com>
List: port-dreamcast
Date: 01/19/2001 10:32:59
On Wed, Jan 10, 2001 at 01:06:52AM +0100, Marcus Comstedt wrote:
> For the Maple Bus driver, I need to allocate some contiguous physical
> memory for use as DMA buffers. The code I use currently looks in
> principle like this:
>
> paddr_t dmabuf = SH3_P2SEG_TO_PHYS(vtophys(uvm_km_alloc(phys_map, SIZE)))
>
> Can someone confirm that this is the right way to do it? I'm a little
> confused that the vtophys function returns a P2 address rather than a
> physical address...
Not even that is completely safe.
The Right Thing To Do would be to implement the framework described in
bus_dma(9). This is particularly important for when you get the broadband
adapter working, which as I understand it, is a SHB->PCI bridge with a
PCI Ethernet chip on the other side.
--
-- Jason R. Thorpe <thorpej@zembu.com>