blob: 6b77fd872a7aebc3d701ff0b1e747fc33d5eb23f [file] [log] [blame]
Glauber Costa459121c92008-04-08 13:20:43 -03001#include <linux/dma-mapping.h>
Glauber Costacb5867a2008-04-08 13:20:51 -03002#include <linux/dmar.h>
3
4#include <asm/gart.h>
5#include <asm/calgary.h>
Glauber Costa459121c92008-04-08 13:20:43 -03006
Glauber Costa85c246e2008-04-08 13:20:50 -03007const struct dma_mapping_ops *dma_ops;
8EXPORT_SYMBOL(dma_ops);
9
Glauber Costaf9c258d2008-04-08 13:20:52 -030010#ifdef CONFIG_IOMMU_DEBUG
11int panic_on_overflow __read_mostly = 1;
12int force_iommu __read_mostly = 1;
13#else
14int panic_on_overflow __read_mostly = 0;
15int force_iommu __read_mostly = 0;
16#endif
17
Glauber Costa459121c92008-04-08 13:20:43 -030018int dma_set_mask(struct device *dev, u64 mask)
19{
20 if (!dev->dma_mask || !dma_supported(dev, mask))
21 return -EIO;
22
23 *dev->dma_mask = mask;
24
25 return 0;
26}
27EXPORT_SYMBOL(dma_set_mask);
28
Glauber Costacb5867a2008-04-08 13:20:51 -030029static int __init pci_iommu_init(void)
30{
31#ifdef CONFIG_CALGARY_IOMMU
32 calgary_iommu_init();
33#endif
Glauber Costa459121c92008-04-08 13:20:43 -030034
Glauber Costacb5867a2008-04-08 13:20:51 -030035 intel_iommu_init();
36
37#ifdef CONFIG_GART_IOMMU
38 gart_iommu_init();
39#endif
40
41 no_iommu_init();
42 return 0;
43}
44
45void pci_iommu_shutdown(void)
46{
47 gart_iommu_shutdown();
48}
49/* Must execute after PCI subsystem */
50fs_initcall(pci_iommu_init);