Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: syssrc
On Thu, May 18, 2000 at 05:15:14PM +0200, Paul Kranenburg wrote:
> > Log Message:
> > rearrange the order of bus_dma operations to be more like many other
> > drivers, at the suggestion of fvdl. also, use bus_dmamap_load() not
> > load_raw().
>
> You're headed for trouble with this change. According to bus_dma(9),
> memory allocated with bus_dmamem_alloc() should be loaded with
> bus_dmamap_load_raw().
Sigh, everyone seems to completely misunderstand this, so let me
explain (again).
bus_dmamap_load() can map any memory that is mapped into some address
space, including memory allocated with bus_dmamem_alloc() (take a look
at all of the PCI network card drivers sometime).
bus_dmamap_load_raw() is a function that allows you to map memory
allocated with bus_dmamem_alloc() that you happen to choose to not
map into any address space. A perfect example of this is, say, a
frame grabber buffer that might be Very Large .. and the only access
to the buffer is via a user process mmap'ing small windows of it at
various times. Since it won't really be mapped into an address space,
you load that type of thing with bus_dmamap_load_raw().
Now...
I'm thinking of redefining the interface of bus_dmamap_load_raw() to
allow any physical page on the system (physical as in "the physical
address that the vm_page structure contains, i.e. CPU memory bus address)
so that it can be indirectly used by the UVM pagers to bring in pages
from e.g. disk without having to map them into KVA space first.
In any case, the reason that bus_dmamap_load_raw() wasn't ever really
implemented is because for the vast vast vast majority of cases (and,
really, all cases that currently exist in the NetBSD source tree), it's
not needed.
> The sparc and sparc64 implementations depend on this, since both the
> `alignment' and `boundary' argument to bus_dmamem_alloc() cannot be
> dealt with until actual DMA resources are allocated. Those values
> are saved in the segments returned for later use in bus_dmamap_load_raw().
bus_dmamap_load() should also be able to handle this. In fact, for PCI
IDE DMA to work, it has to.
--
-- Jason R. Thorpe <thorpej%zembu.com@localhost>
Home |
Main Index |
Thread Index |
Old Index