Problems with dma_alloc_coherent()
jwhitney-linuxppc at sands-edge.com
Sat Apr 3 05:27:32 EST 2004
On Apr 2, 2004, at 1:50 PM, Michael R. Zucca wrote:
> John Whitney wrote:
>> As an exemplification of the problem I am having with the current
>> DMA/PCI API:
>> I am developing a Generic DMA driver. DMA providers register
>> themselves with it. Clients ask the DMA core driver to please have a
>> registered driver transfer the data from one location to another, and
>> call them back when it is complete.
> If CPU memory is assumed to be a source/target and the other
> source/target is the device, then you should take a DMA direction, a
> virtual address, a device or bus, and a bus-local address. If CPU
> memory isn't the only target or the DMA engine is between a bunch of
> bridges, you might need to take a source bus and bus-local address,
> and a destination bus and bus-local address.
The "device" will always be the DMA controller (since it is moving data
from one place to another), and all physical addresses should be from
the controller's perspective. However, the client does not know what
DMA controller might be used (or even which ones exists), as it has
been abstracted. Direction is not needed to be specified. The source
will ALWAYS be "to device" the destination will always be "from
device". The DMA controller device just needs source and destination
physical addresses (adjusted for its memory space).
I'm not trying to handle wierd bus scenarios... I'm just trying to
figure out how to go from a virtual address to a DMA-controller
specific one, with the constraints I have been told about with the
LinuxPPC kernel, in an abstracted interface. As I outlined in the
previous message, I can't see a way to do this.
Heck, let's make it simple. Let's say I have a high-speed serial port,
and I want to DMA data to it with a known DMA controller (not
abstracted) with a standard "device" structure associated with it. The
serial driver has the physical address of the 1-byte transmit register
of the serial port that it wants to DMA to. How does he make this into
a physical address the known DMA controller device can use? There is
no phys_to_bus() macro, and it would be deprecated if it existed.
There is no DMA/PCI API for taking a physical address and converting it
to a dma_addr_t for a specific device (the DMA controller). I can't
ioremap() the device, and pass that virtual address to the DMA API, as
it will produce a bad physical address and I have been told this is the
desired way for the API to work.
What's generic method is left, that doesn't require platform-specific
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc-dev