]> 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 048f09b62553e638ecb6c0ba89528a4f9665b014..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;
@@ -63,7 +66,8 @@ void dma_free_coherent(struct device *dev, size_t size,
 {
        struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
        int order = get_order(size);
-       
+
+       WARN_ON(irqs_disabled());       /* for portability */
        if (mem && vaddr >= mem->virt_base && vaddr < (mem->virt_base + (mem->size << PAGE_SHIFT))) {
                int page = (vaddr - mem->virt_base) >> PAGE_SHIFT;
 
@@ -153,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)
 {