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:
> > Modified Files:
> >     syssrc/sys/dev/ic: hme.c
> > 
> > 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().

Not really.. there seems to be some confusion on this.

If you want to feed memory allocated with bus_dmamem_alloc, that has
not been mapped, directly into a dmamap, you indeed need to use load_raw.
The problem is, that several platforms do not implement this.

However, if you map the memory allocated by bus_dmamem_alloc through
bus_dmamem_map, then you can use the va obtained through this call
to load the memory into a dmamap using bus_dmamap_load. This is
what most drivers do. See, for example, ahc_createdmamem in aic7xxx.c.

Since hme.c was already using bus_dmamem_map, it was easiest to
just re-arrange the bus_dma code in hme.c to match other drivers,
avoiding load_raw.
 
> 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().

If the sparc and sparc64 bus_dma implementations *only* allow DMA memory
allocated by bus_dmamem_alloc to be loaded into a DMA map through
bus_dmamap_load_raw (i.e., the indirect way via bus_dmamem_map is not
possible), then these implementations need to be fixed.

- Frank



Home | Main Index | Thread Index | Old Index