---
 drivers/pci/pci.c                    |   34 ++++++++++++++++++++++++++++++++++
 include/asm-generic/pci-dma-compat.h |   15 +++++++++++++++
 2 files changed, 49 insertions(+)

diff -r 58e8a73bbe8d drivers/pci/pci.c
--- a/drivers/pci/pci.c	Wed Jan 02 18:18:55 2008 +1100
+++ b/drivers/pci/pci.c	Wed Jan 02 22:25:24 2008 +1100
@@ -1578,6 +1578,40 @@ static void __devinit pci_no_domains(voi
 #endif
 }
 
+#ifndef ARCH_HAS_PCI_MAP_SG_RING
+int pci_map_sg_ring(struct pci_dev *hwdev, struct sg_ring *sg, int direction)
+
+	struct sg_ring *i;
+
+	for (i = sg; i; i = sg_ring_next(i, sg)) {
+		BUG_ON(i->num > i->max);
+		i->dma_num = pci_map_sg(dev, i->sg, i->num, direction);
+		if (i->dma_num == 0 && i->num != 0)
+			goto unmap;
+	}
+	return 0;
+
+unmap:
+	while (sg) {
+		pci_unmap_sg(dev, sg->sg, sg->dma_num, direction);
+		sg = sg_ring_next(sg, i);
+	}
+	return -ENOMEM;
+}
+EXPORT_SYMBOL(pci_map_sg_ring);
+
+void pci_unmap_sg_ring(struct pci_dev *hwdev, struct sg_ring *sg, int direction)
+{
+	struct sg_ring *i;
+
+	for (i = sg; i; i = sg_ring_next(i, sg)) {
+		BUG_ON(i->dma_num > i->max);
+		pci_unmap_sg(dev, i->sg, i->dma_num, direction);
+	}
+}
+EXPORT_SYMBOL(pci_unmap_sg_ring);
+#endif /* !ARCH_HAS_PCI_MAP_SG_RING */
+
 static int __devinit pci_init(void)
 {
 	struct pci_dev *dev = NULL;
diff -r 58e8a73bbe8d include/asm-generic/pci-dma-compat.h
--- a/include/asm-generic/pci-dma-compat.h	Wed Jan 02 18:18:55 2008 +1100
+++ b/include/asm-generic/pci-dma-compat.h	Wed Jan 02 22:25:24 2008 +1100
@@ -70,6 +70,21 @@ pci_unmap_sg(struct pci_dev *hwdev, stru
 	dma_unmap_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
 }
 
+#define ARCH_HAS_PCI_MAP_SG_RING
+static inline int
+pci_map_sg_ring(struct pci_dev *hwdev, struct sg_ring *sg, int direction)
+{
+	return dma_map_sg_ring(hwdev == NULL ? NULL : &hwdev->dev, sg,
+			       (enum dma_data_direction)direction);
+}
+
+static inline void
+pci_unmap_sg_ring(struct pci_dev *hwdev, struct sg_ring *sg, int direction)
+{
+	dma_unmap_sg_ring(hwdev == NULL ? NULL : &hwdev->dev, sg,
+			  (enum dma_data_direction)direction);
+}
+
 static inline void
 pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle,
 		    size_t size, int direction)
