Skip to contentSkip to conversation

how to get virtual address from dma address

DISCUSSION Manfred Spraul 1 participant 1 message Oct 3, 2001

lore
Share & tools
lore
#0 lore raw
Quoted 1 line

Then why isn't there a call like pci_unmap_single()

<<< linux/include/asm-i386/pci.h:
/* Unmap a single streaming mode DMA translation. The dma_addr and size
* must match what was provided for in a previous pci_map_single call.
All
* other usages are undefined.
*
* After this call, reads by the cpu to the buffer are guarenteed to see
* whatever the device wrote there.
*/
static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
size_t size, int direction)
<<<<

Please try to store both the dma address and the virtual address in your driver and use pci_map_single().
I'm aware of one case where that's not possible: if your hardware builds a linked list of finished commands, and that list is in DMA addresses, not virtual addresses.
I think both sym53c8xx and one of the USB controllers (usb-ohci.c?) have that problem, they use a hash table for the reverse dma address->linear address mapping.

I hope that answers your question.

--
Manfred