Subject: Re: lack of pciide transfer alignment checking causes crash
To: matthew green <mrg@eterna.com.au>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 06/26/2005 21:53:51
On Sun, Jun 26, 2005 at 07:04:52AM +1000, matthew green wrote:
> 
> 
> i have a similar problem with BCM4401 ethernet -- it can only address
> 1GB of physical ram and i need to introduce bounce buffers into the
> driver itself, as i've as yet been unable to figure out how to make
> bus_dma(9) do this for me.
> 
> is there a way for bus_dma(9) to properly handle this sort of device?
> some audio chipsets have the same issue, so, a more general solution
> than bounce buffers in the driver would seem best.

Right now, bus_dma(9) because it only knows the limitations of the bus
(e.g. the 16MB limit for ISA, or 4GB limit for 32bit PCI).
The bus_dma interface would need to be extended to be able to specify
a range of allowed physical addresses. I think this information needs to
be passed to bus_dmamap_create() and bus_dmamem_alloc() (it's the same kind
of information as alignment and boundary).
If several devices need this, and it's not something limited to one or two
i386-only device, it probably make sense to extend bus_dma in this direction.
For platforms already using bounce buffer, it would not be hard to add this.
For platforms using an IOMMU, this should not be too difficult to add either.
As a temporary measure, other platforms could return EINVAL for out of range
requests (or maybe at bus_dmamap_create() time. bus_dmamem_alloc() is easier).

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--