Subject: Re: FreeBSD Bus DMA (was Re: AdvanSys board support)
To: Justin T. Gibbs <gibbs@plutotech.com>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 06/11/1998 17:43:45
On Thu, 11 Jun 1998 17:16:08 -0600 
 "Justin T. Gibbs" <gibbs@plutotech.com> wrote:

 > When a BT CCB (the object that handles individual transactions) is 
 > allocated, we encounter code like this:
 > 
 > 	error = bus_dmamap_create(bt->buffer_dmat, /*flags*/0,
 > 				  &ccb->dmamap);
 > 

[ . . . ]

 > 	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?

 > >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!

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.

Jason R. Thorpe                                       thorpej@nas.nasa.gov
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