x86: dma-ops on highmem fix
[deliverable/linux.git] / arch / x86 / kernel / pci-nommu_64.c
index 2a34c6c025a920832455dc0c32c4978ee5881ee0..6e330769d0174c5a0c3014ed2bac7f25fe70f4cc 100644 (file)
@@ -5,8 +5,9 @@
 #include <linux/pci.h>
 #include <linux/string.h>
 #include <linux/dma-mapping.h>
+#include <linux/scatterlist.h>
 
-#include <asm/iommu.h>
+#include <asm/gart.h>
 #include <asm/processor.h>
 #include <asm/dma.h>
 
@@ -25,10 +26,10 @@ check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)
 }
 
 static dma_addr_t
-nommu_map_single(struct device *hwdev, void *ptr, size_t size,
+nommu_map_single(struct device *hwdev, phys_addr_t paddr, size_t size,
               int direction)
 {
-       dma_addr_t bus = virt_to_bus(ptr);
+       dma_addr_t bus = paddr;
        if (!check_addr("map_single", hwdev, bus, size))
                                return bad_dma_address;
        return bus;
@@ -57,12 +58,12 @@ static void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
 static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
               int nents, int direction)
 {
+       struct scatterlist *s;
        int i;
 
-       for (i = 0; i < nents; i++ ) {
-               struct scatterlist *s = &sg[i];
-               BUG_ON(!s->page);
-               s->dma_address = virt_to_bus(page_address(s->page) +s->offset);
+       for_each_sg(sg, s, nents, i) {
+               BUG_ON(!sg_page(s));
+               s->dma_address = virt_to_bus(sg_virt(s));
                if (!check_addr("map_sg", hwdev, s->dma_address, s->length))
                        return 0;
                s->dma_length = s->length;
This page took 0.030781 seconds and 5 git commands to generate.