aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/kernel/pci-dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64/kernel/pci-dma.c')
-rw-r--r--arch/ia64/kernel/pci-dma.c49
1 files changed, 31 insertions, 18 deletions
diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c
index 640669eba5d4..b30209ec8c6e 100644
--- a/arch/ia64/kernel/pci-dma.c
+++ b/arch/ia64/kernel/pci-dma.c
@@ -41,21 +41,7 @@ struct device fallback_dev = {
41 .dma_mask = &fallback_dev.coherent_dma_mask, 41 .dma_mask = &fallback_dev.coherent_dma_mask,
42}; 42};
43 43
44extern struct dma_mapping_ops vtd_dma_ops; 44extern struct dma_map_ops intel_dma_ops;
45
46void __init pci_iommu_alloc(void)
47{
48 dma_ops = &vtd_dma_ops;
49 /*
50 * The order of these functions is important for
51 * fall-back/fail-over reasons
52 */
53 detect_intel_iommu();
54
55#ifdef CONFIG_SWIOTLB
56 pci_swiotlb_init();
57#endif
58}
59 45
60static int __init pci_iommu_init(void) 46static int __init pci_iommu_init(void)
61{ 47{
@@ -81,10 +67,10 @@ iommu_dma_init(void)
81 67
82int iommu_dma_supported(struct device *dev, u64 mask) 68int iommu_dma_supported(struct device *dev, u64 mask)
83{ 69{
84 struct dma_mapping_ops *ops = platform_dma_get_ops(dev); 70 struct dma_map_ops *ops = platform_dma_get_ops(dev);
85 71
86 if (ops->dma_supported_op) 72 if (ops->dma_supported)
87 return ops->dma_supported_op(dev, mask); 73 return ops->dma_supported(dev, mask);
88 74
89 /* Copied from i386. Doesn't make much sense, because it will 75 /* Copied from i386. Doesn't make much sense, because it will
90 only work for pci_alloc_coherent. 76 only work for pci_alloc_coherent.
@@ -113,4 +99,31 @@ int iommu_dma_supported(struct device *dev, u64 mask)
113} 99}
114EXPORT_SYMBOL(iommu_dma_supported); 100EXPORT_SYMBOL(iommu_dma_supported);
115 101
102static int vtd_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
103{
104 return 0;
105}
106
107void __init pci_iommu_alloc(void)
108{
109 dma_ops = &intel_dma_ops;
110
111 dma_ops->sync_single_for_cpu = machvec_dma_sync_single;
112 dma_ops->sync_sg_for_cpu = machvec_dma_sync_sg;
113 dma_ops->sync_single_for_device = machvec_dma_sync_single;
114 dma_ops->sync_sg_for_device = machvec_dma_sync_sg;
115 dma_ops->dma_supported = iommu_dma_supported;
116 dma_ops->mapping_error = vtd_dma_mapping_error;
117
118 /*
119 * The order of these functions is important for
120 * fall-back/fail-over reasons
121 */
122 detect_intel_iommu();
123
124#ifdef CONFIG_SWIOTLB
125 pci_swiotlb_init();
126#endif
127}
128
116#endif 129#endif