Subject: Re: Valid use of bus_dma(9)?
To: David Young <dyoung@pobox.com>
From: Jason Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 07/23/2004 15:34:13
--Apple-Mail-10-645704319
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; format=flowed


On Jul 23, 2004, at 1:38 PM, David Young wrote:

> On Fri, Jul 23, 2004 at 05:19:23PM +0200, Manuel Bouyer wrote:
>>
>> bus_dmamem_alloc(9) says:
>>             The mapping of this memory is machine-dependent (or 
>> "opaque");
>> 	    machine-independent code is not to assume that the addresses
>> 	    returned are valid in kernel virtual address space, or that the
>> 	    addresses returned are system physical addresses.  The address
>>
>> To me, this means that we can't make any assumptions about the values 
>> returned
>> by bus_dmamem_alloc(), and especially it's wrong to assume we can do
>> memory-related operations on ds_addr/ds_len.
>
> Network drivers don't copy ds_addr into transmit/receive descriptors?
> How does this work if they are not "system physical addresses" ?

System physical addresses != DMA addresses.  At least, on many 
platforms this is the case.

The whole idea is that bus_dmamem_alloc() returns addresses that are 
opaque to the driver.  The driver MUST use bus_dmamap_load*() in order 
to translate an address to one valid for use in DMA.

         -- Jason R. Thorpe <thorpej@wasabisystems.com>


--Apple-Mail-10-645704319
content-type: application/pgp-signature; x-mac-type=70674453;
	name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQFBAZJlOpVKkaBm8XkRAtN4AJ0fDjhuh8TC/nKvSJ4PMfCa+Dz4+QCgwnDu
yqXhDY2951n9rBDSCvvsPk4=
=vHAI
-----END PGP SIGNATURE-----

--Apple-Mail-10-645704319--