Subject: Re: Valid use of bus_dma(9)?
To: None <tech-kern@NetBSD.org>
From: Matt Thomas <matt@3am-software.com>
List: tech-kern
Date: 07/23/2004 16:04:54
At 03:34 PM 7/23/2004, you wrote:
>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.
which fpa does. It allocates a 8KB chunk of which only a small portion
should be coherent. it try to map/load this small chunk as coherent which
is what that code is trying to do.
--
Matt Thomas email: matt@3am-software.com
3am Software Foundry www: http://3am-software.com/bio/matt/
Cupertino, CA disclaimer: I avow all knowledge of this message.