Subject: Re: FreeBSD Bus DMA (was Re: AdvanSys board support)
To: None <, jonathan@DSG.Stanford.EDU>
From: Noriyuki Soda <>
List: tech-kern
Date: 06/12/1998 06:08:39
Justin writes:
> 2) The concept of dma tags has been extended to be more hierarchical than
> in the NetBSD implementation.  In a typical FreeBSD driver, a parent tag
> is provided

It seems that current FreeBSD's bus_dma_tag_create() and bus_dmamap_create()
interface are not correct. 
bus_dma_tag_create() takes "nsegments" (AHC_NSEG in ahc driver) and 
"maxsegsz" (AHC_MAXTRANSFER_SIZE in ahc driver) arguments. But these values
should be treated by bus_dma map, not bus_dma tag.
For example, in ahc driver, "hscb" and "ahc_dmaphys" should be bus_dma'fied,
too. But these structures should not be scatter/gather'ed (i.e. AHC_NSEG
and AHC_MAXTRANSFER_SIZE only affect actual scsi data transfer, but
don't affect hscb and ahc_dmaphys.)
So, AHC_NSEG and AHC_MAXTRANSFER_SIZE should be treated on dma map layer,
not dma tag layer.
Please note that bus_dma interface is also used for cache flush and cache 
invalidatation on architecture other than i386.

About bus_dmamap_callback_t, I think that reducing bounce memory size 
is certainly good thing. But it is pain if we must use callback in all 
cases.  (Think about hardware_scb in ahc driver.)
I think NetBSD's interface is more convenient than FreeBSD's.
Isn't there other way to reduce bounce memory ?