]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/ia64/kernel/pci-dma.c
x86, ia64: convert to use generic dma_map_ops struct
[linux-2.6-omap-h63xx.git] / arch / ia64 / kernel / pci-dma.c
index 640669eba5d46536d8e4b1156a82de582ef98ad8..b30209ec8c6e25a844fe933f13d254041217d7bd 100644 (file)
@@ -41,21 +41,7 @@ struct device fallback_dev = {
        .dma_mask = &fallback_dev.coherent_dma_mask,
 };
 
-extern struct dma_mapping_ops vtd_dma_ops;
-
-void __init pci_iommu_alloc(void)
-{
-       dma_ops = &vtd_dma_ops;
-       /*
-        * The order of these functions is important for
-        * fall-back/fail-over reasons
-        */
-       detect_intel_iommu();
-
-#ifdef CONFIG_SWIOTLB
-       pci_swiotlb_init();
-#endif
-}
+extern struct dma_map_ops intel_dma_ops;
 
 static int __init pci_iommu_init(void)
 {
@@ -81,10 +67,10 @@ iommu_dma_init(void)
 
 int iommu_dma_supported(struct device *dev, u64 mask)
 {
-       struct dma_mapping_ops *ops = platform_dma_get_ops(dev);
+       struct dma_map_ops *ops = platform_dma_get_ops(dev);
 
-       if (ops->dma_supported_op)
-               return ops->dma_supported_op(dev, mask);
+       if (ops->dma_supported)
+               return ops->dma_supported(dev, mask);
 
        /* Copied from i386. Doesn't make much sense, because it will
           only work for pci_alloc_coherent.
@@ -113,4 +99,31 @@ int iommu_dma_supported(struct device *dev, u64 mask)
 }
 EXPORT_SYMBOL(iommu_dma_supported);
 
+static int vtd_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
+{
+       return 0;
+}
+
+void __init pci_iommu_alloc(void)
+{
+       dma_ops = &intel_dma_ops;
+
+       dma_ops->sync_single_for_cpu = machvec_dma_sync_single;
+       dma_ops->sync_sg_for_cpu = machvec_dma_sync_sg;
+       dma_ops->sync_single_for_device = machvec_dma_sync_single;
+       dma_ops->sync_sg_for_device = machvec_dma_sync_sg;
+       dma_ops->dma_supported = iommu_dma_supported;
+       dma_ops->mapping_error = vtd_dma_mapping_error;
+
+       /*
+        * The order of these functions is important for
+        * fall-back/fail-over reasons
+        */
+       detect_intel_iommu();
+
+#ifdef CONFIG_SWIOTLB
+       pci_swiotlb_init();
+#endif
+}
+
 #endif