generic device DMA implementation
Quoted 3 lines · David Brownell
Isn't the goal to make sure that for every kind of "struct device *" it should be possible to use those dma_*() calls, without BUGging out.
No.
Quoted 1 line
If that's not true ... then why were they defined?
So that other memory mapped busses such as ISA and sbus
can use them.
USB devices should do DMA operations with respect to their USB
host adapters, typically a PCI device. For example, imagine a machine with two USB controllers on different bus instances.
One of these days, I'd like to add "struct device *dma_dev;" to
struct request_queue to facilitate optional centralization of dma_{,un}map_sg for most hardware drivers. PCI scsi controllers, for example would set dma_dev to the PCI device. USB scsi controllers would set it to the USB host adapter.
Adam J. Richter __ ______________ 575 Oroville Road [email protected] \ / Milpitas, California 95035 +1 408 309-6081 | g g d r a s i l United States of America
"Free Software For The Rest Of Us."
Quoted 6 lines · Adam J. Richter
Quoted 3 lines · David Brownell
Isn't the goal to make sure that for every kind of "struct device *" it should be possible to use those dma_*() calls, without BUGging out.
Quoted 6 lines
No.Quoted 1 line
If that's not true ... then why were they defined?
So that other memory mapped busses such as ISA and sbus
can use them.
That sounds like a "yes", not a "no" ... except for devices on busses that don't have do memory mapped I/O. It's what I described: dma_*() calls being used with struct device, without BUGging out.
Quoted 3 lines
USB devices should do DMA operations with respect to their USB
host adapters, typically a PCI device. For example, imagine a machine with two USB controllers on different bus instances.
USB already does that ... you write as if it didn't. It's done that since pretty early in the 2.4 series, when conversions to the "new" PCI DMA APIs replaced usage of virt_to_bus and bus_to_virt and USB became usable on platforms that weren't very PC-like. Controllers that don't use PCI also need Linux support, in embedded configs.
However, the device drivers can't do that using the not-yet-generic DMA calls. It's handled by usbcore, or by the USB DMA calls. That works, and will continue to do so ... but it does highlight how "generic" the implementation of those APIs is (not very).
- Dave