Subject: Re: DMA segs and scatter/gather
To: Bruce J.A. Nourish <bjan+tech-kern@bjan.net>
From: Frank van der Linden <fvdl@netbsd.org>
List: tech-kern
Date: 08/22/2003 14:12:13
On Thu, Aug 21, 2003 at 05:43:26PM -0700, Bruce J.A. Nourish wrote:
> Now the plot thickens. After the dmamap_alloc, the FreeBSD driver calls
> dmamap_load. This function (effectively) returns a pointer to an
> array of bus_dma_segment_t's; via the pointer, the driver accesses the
> ds_addr of the first bus_dma_segement_t, and saves it into a softc
> structure that corresponds to the physical address of the start of
> the DMA memory. Essentially, the code _assumes_ there will be only
> one segment, as it is not possible to infer the address of one segment
> by looking at another (they are discontiguous, by definition). 

Sounds like the FreeBSD gets lucky. The number of segments specified
is indeed the maximum number, and it is usually 1 in NetBSD source,
because a contiguous stretch of DMA memory is required.

I'd change it to always be 1.

- Frank

-- 
Frank van der Linden                                            fvdl@netbsd.org
===============================================================================
NetBSD. Free, Unix-like OS. > 45 different platforms.    http://www.netbsd.org/