]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/pci-dma_32.c
x86: move pci fixup to pci-dma.c
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / pci-dma_32.c
index 0aae2f3847a5486fe657ce3403179c6359aabeca..6543bb30b65d560b2a43c9bb92e7ef45905a9454 100644 (file)
 #include <linux/string.h>
 #include <linux/pci.h>
 #include <linux/module.h>
-#include <linux/pci.h>
 #include <asm/io.h>
 
+/* For i386, we make it point to the NULL address */
+dma_addr_t bad_dma_address __read_mostly = 0x0;
+EXPORT_SYMBOL(bad_dma_address);
+
 struct dma_coherent_mem {
        void            *virt_base;
        u32             device_base;
@@ -154,17 +157,27 @@ EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
 #ifdef CONFIG_PCI
 /* Many VIA bridges seem to corrupt data for DAC. Disable it here */
 
-int forbid_dac;
-EXPORT_SYMBOL(forbid_dac);
-
-static __devinit void via_no_dac(struct pci_dev *dev)
+int
+dma_supported(struct device *dev, u64 mask)
 {
-       if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && forbid_dac == 0) {
-               printk(KERN_INFO "PCI: VIA PCI bridge detected. Disabling DAC.\n");
-               forbid_dac = 1;
-       }
+       /*
+        * we fall back to GFP_DMA when the mask isn't all 1s,
+        * so we can't guarantee allocations that must be
+        * within a tighter range than GFP_DMA..
+        */
+       if (mask < 0x00ffffff)
+               return 0;
+
+       /* Work around chipset bugs */
+       if (forbid_dac > 0 && mask > 0xffffffffULL)
+               return 0;
+
+       if (dma_ops->dma_supported)
+               return dma_ops->dma_supported(dev, mask);
+
+       return 1;
 }
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_ANY_ID, via_no_dac);
+EXPORT_SYMBOL(dma_supported);
 
 static int check_iommu(char *s)
 {