1 /* Fallback functions when the main IOMMU code is not compiled in. This
2 code is roughly equivalent to i386. */
4 #include <linux/init.h>
6 #include <linux/string.h>
8 #include <asm/processor.h>
11 EXPORT_SYMBOL(iommu_merge);
13 dma_addr_t bad_dma_address;
14 EXPORT_SYMBOL(bad_dma_address);
16 int iommu_bio_merge = 0;
17 EXPORT_SYMBOL(iommu_bio_merge);
19 int iommu_sac_force = 0;
20 EXPORT_SYMBOL(iommu_sac_force);
23 * Dummy IO MMU functions
26 void *dma_alloc_coherent(struct device *hwdev, size_t size,
27 dma_addr_t *dma_handle, gfp_t gfp)
31 int order = get_order(size);
34 mask = hwdev->coherent_dma_mask & *hwdev->dma_mask;
38 ret = (void *)__get_free_pages(gfp, order);
41 *dma_handle = virt_to_bus(ret);
42 if ((*dma_handle & ~mask) == 0)
44 free_pages((unsigned long)ret, order);
53 EXPORT_SYMBOL(dma_alloc_coherent);
55 void dma_free_coherent(struct device *hwdev, size_t size,
56 void *vaddr, dma_addr_t dma_handle)
58 free_pages((unsigned long)vaddr, get_order(size));
60 EXPORT_SYMBOL(dma_free_coherent);
62 int dma_supported(struct device *hwdev, u64 mask)
65 * we fall back to GFP_DMA when the mask isn't all 1s,
66 * so we can't guarantee allocations that must be
67 * within a tighter range than GFP_DMA..
68 * RED-PEN this won't work for pci_map_single. Caller has to
69 * use GFP_DMA in the first place.
71 if (mask < 0x00ffffff)
76 EXPORT_SYMBOL(dma_supported);
78 int dma_get_cache_alignment(void)
80 return boot_cpu_data.x86_clflush_size;
82 EXPORT_SYMBOL(dma_get_cache_alignment);
84 static int __init check_ram(void)
86 if (end_pfn >= 0xffffffff>>PAGE_SHIFT) {
88 KERN_ERR "WARNING more than 4GB of memory but IOMMU not compiled in.\n"
89 KERN_ERR "WARNING 32bit PCI may malfunction.\n");
93 __initcall(check_ram);