Subject: Re: FreeBSD Bus DMA (was Re: AdvanSys board support)
To: Jason Thorpe <>
From: Justin T. Gibbs <>
List: tech-kern
Date: 06/11/1998 22:48:10
> > 	s = splvm();
> > 	error = bus_dmamap_load(bt->buffer_dmat, bccb->dmamap,
> > 				csio->data_ptr,	csio->dxfer_len,
> > 				btexecuteccb, bccb, /*flags*/0);
>You seem to live in a very SCSI-centric world.  What about the (extremely)
>common case of needing to remember the DMA address for building (and
>rebuilding) linked command chains on e.g. network drivers?  Also, how do
>you deal w/ map syncs?  How about partial syncs?

I just poked around if_de.c of NetBSD current.  It certainly looks to me
like it translates the data in map->dm_segs to private storage so it can
use it's own version of the data for building linked command chains.  
Perhaps if_de.c isn't a good example.  Can you provide a better one?

As for map syncs, if an implementation requires dm_segs like data in order
to perform a sync operation it can certainly include this data in its dma
map object.  The FreeBSD x86 implementation doesn't need dm_segs type data
in order to perform synch operations (partial or otherwise).  It stores a
list of bounce page objects instead.

> > >But how is the bus-dma layer supposed to get at the map itself if the
> > >only way to construct the map is ot call the _driver's_ callback?
> > 
> > The map is constructed up front, so this question makes no sense.
>Justin... The DMA segment list is a _fundamental_ part of the map!  Just
>like vm_map_entry_t's are a fundamental part of a vm_map!

If it's so fundamental, why is it unnecessary in an x86 implementation?

>I suppose you're never going to really understand that until you stop
>calling the DMA segment list a "S/G list".  That information _can be
>used_ as an "S/G list", but the DMA segment list, as a concept, is much
>more general.

Why does the client of bus_dmamap_create need to know of the existence of
dm_segs data in the dma map?

>Jason R. Thorpe                             
>NASA Ames Research Center                            Home: +1 408 866 1912
>NAS: M/S 258-5                                       Work: +1 650 604 0935
>Moffett Field, CA 94035                             Pager: +1 650 428 6939