Subject: Re: Proposal for modification of bus_dma(9)
To: Jason Thorpe <thorpej@nas.nasa.gov>
From: Matt Thomas <matt@3am-software.com>
List: tech-kern
Date: 02/01/1998 09:23:30
At 05:12 AM 2/1/98 , Jason Thorpe wrote:
>[ Ross - please make sure to point out any mistakes I might make wrt. to
>  things that can and can't be done on the A12... Everyone - note that
>  this was written at around 1.45am after I got home, having just thought
>  of this in the car on the way; please just dismiss anything that might
>  look like sheer stupidity as simply the effects of being tired :-]
>
>Hi folks...
>
>With the recent commit of preliminary support for the Avalon Computer Systems
>A12 Scalable Parallel Processor to NetBSD/alpha, I have been rethinking
>the semantics of bus_dmamap_sync().
>
>In particular, I am no longer very happy with the BUS_DMAMEM_NOSYNC option
>to bus_dmamem_map(), which allows DMA-safe memory to be mapped in such a
>way that bus_dmamap_sync() calls are not required.  I agree with Ross Harvey's
>assessment of this option: it's really the only hole in the bus_dma
>abstraction, and is meant as a way to map memory non-cacheable for things
>like SCSI controller mailbox entries or network interface transmit descriptors,
>and other device control structures that are given to the device via DMA.

bus_dmamap_sync is not acceptable since it cannot know how to copy 
descriptors in such way to make sure that invalid descriptors are
not presented to the device.

>Unfortunately, NOSYNC isn't something which can be implementd on the A12
>(at least in current incarnations of the A12 hardware).  The A12 cannot
>DMA directly to main memory.  Instead, PCI devices DMA into SRAM bounce
>buffers (which are implemented in hardware) which must then be copied into
>the host buffer.
>
>Because the A12 requirementes necessitate consistent synchronization,
>I would like to alter the interface to bus_dmamap_sync() to make doing
>this synchronization easier and less expensive.
>
>The bus_dmamap_sync() interface currently looks like:
>
>	void bus_dmamap_sync __P((bus_dma_tag_t tag, bus_dmamap_t dmamap,
>		bus_dmasync_op_t op));
>
>I would like to change it to:
>
>	void bus_dmamap_sync __P((bus_dma_tag_t tag, bus_dmamap_t dmamap,
>		bus_addr_t offset, bus_size_t len, int ops));

>Now, the "ops" change allows us to perform multiple synchronization
>operations in a single call, unlike the previous version, which allowed
>only one per call.

Much better.  But it doesn't solve the problem above.  
-- 
Matt Thomas               Internet:   matt@3am-software.com
3am Software Foundry      WWW URL:    http://www.3am-software.com/bio/matt/
Nashua, NH                Disclaimer: I disavow all knowledge of this message