Re: pci segments/domains

David S. Miller (davem@redhat.com)
Fri, 17 May 2002 04:41:57 -0700 (PDT)


From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Date: Fri, 17 May 2002 15:39:03 +0400

What about
dma_addr_t pci_to_pci_map_single(struct pci_dev *master,
struct pci_dev *target,
dma_addr_t tgt_addr, size_t size, int dir)

Could be implemented without much pain if there is enough interest. :-)

tgt_addr does not make any sense, we are trying to DMA to a device
resource, so pass a "struct resource *" and "unsigned long res_offset"
instead of tgt_addr.

So, as a (real life) example, suppose you wanted to portably point
your BTTV card at the framebuffer of a video card, you'd do
something like:

res = fb_pdev->resource[1];
res_off = OFFSET_INTO_FRAMEBUFFER;
bttv_dma_addr = pci_to_pci_map_single(struct pci_dev *bttv_pdev,
struct pci_dev *fb_pdev,
res, res_off, size,
PCI_DMA_FROMDEVICE);

Note the direction is in terms of the master. The DMA is coming
"from" the master in this "BTTV capture to framebuffer" case.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/