Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
[pandora-kernel.git] / arch / x86_64 / kernel / pci-nommu.c
index 44adcc2..2a34c6c 100644 (file)
@@ -4,7 +4,9 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/string.h>
-#include <asm/proto.h>
+#include <linux/dma-mapping.h>
+
+#include <asm/iommu.h>
 #include <asm/processor.h>
 #include <asm/dma.h>
 
@@ -12,9 +14,11 @@ static int
 check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)
 {
         if (hwdev && bus + size > *hwdev->dma_mask) {
-               printk(KERN_ERR
-                   "nommu_%s: overflow %Lx+%lu of device mask %Lx\n",
-              name, (long long)bus, size, (long long)*hwdev->dma_mask);
+               if (*hwdev->dma_mask >= DMA_32BIT_MASK)
+                       printk(KERN_ERR
+                           "nommu_%s: overflow %Lx+%zu of device mask %Lx\n",
+                               name, (long long)bus, size,
+                               (long long)*hwdev->dma_mask);
                return 0;
        }
        return 1;
@@ -30,7 +34,7 @@ nommu_map_single(struct device *hwdev, void *ptr, size_t size,
        return bus;
 }
 
-void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
+static void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
                        int direction)
 {
 }
@@ -50,12 +54,11 @@ void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
  * Device ownership issues as mentioned above for pci_map_single are
  * the same here.
  */
-int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
+static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
               int nents, int direction)
 {
        int i;
 
-       BUG_ON(direction == DMA_NONE);
        for (i = 0; i < nents; i++ ) {
                struct scatterlist *s = &sg[i];
                BUG_ON(!s->page);
@@ -71,12 +74,12 @@ int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
  * Again, cpu read rules concerning calls here are the same as for
  * pci_unmap_single() above.
  */
-void nommu_unmap_sg(struct device *dev, struct scatterlist *sg,
+static void nommu_unmap_sg(struct device *dev, struct scatterlist *sg,
                  int nents, int dir)
 {
 }
 
-struct dma_mapping_ops nommu_dma_ops = {
+const struct dma_mapping_ops nommu_dma_ops = {
        .map_single = nommu_map_single,
        .unmap_single = nommu_unmap_single,
        .map_sg = nommu_map_sg,
@@ -88,5 +91,7 @@ void __init no_iommu_init(void)
 {
        if (dma_ops)
                return;
+
+       force_iommu = 0; /* no HW IOMMU */
        dma_ops = &nommu_dma_ops;
 }