Re: DMA mapping

From: David S. Miller (davem@redhat.com)
Date: Tue Mar 07 2000 - 03:59:53 EST


   Date: Tue, 7 Mar 2000 08:41:53 +0000
   From: Giuliano Procida <myxie@dev.madge.com>

   Could someone point me at the discussion that lead to current API? In
   particular, I'm curious as to why there isn't a

     void * pci_map_invert (pci_dev * device, dma_addr_t bus_addr)

You want the equivalent of bus_to_virt(), most people
don't need the facility because the driver either

1) Doesn't need a bus_to_virt() operation

or

2) Does need it, but can easily keep track of the dma vs.
   cpu pointers to accomplish the same goal, and because we
   lack this interface the implementation for a given architecture is
   simpler and less complex

That is why, so make your driver do #2. Store the DMA address and
CPU address somewhere in your driver software state, and then you
can easily convert a pointer within one view to a pointer in the
other, and vice versa.

The bus_to_virt() interface is just for lazy driver authors :-)

   and why ia64 has a 64-bit dma_addr_t.

It probably shouldn't, because it represents 32-bit
addresses in all the cases the pci.h interface supports.
(and this does not exclude 64-bit PCI devices, they
 just will use a 32-bit single-address-cycle since
 the high 32-bits of a DMA address will be all zeros,
 as per the PCI specs)

Later,
David S. Miller
davem@redhat.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:22 EST