1 /* Glue code to lib/swiotlb.c */
4 #include <linux/cache.h>
5 #include <linux/module.h>
6 #include <asm/dma-mapping.h>
8 #include <asm/swiotlb.h>
12 int swiotlb __read_mostly;
13 EXPORT_SYMBOL(swiotlb);
16 struct dma_mapping_ops swiotlb_dma_ops = {
18 .mapping_error = swiotlb_dma_mapping_error,
19 .alloc_coherent = swiotlb_alloc_coherent,
20 .free_coherent = swiotlb_free_coherent,
21 .map_single = swiotlb_map_single,
22 .unmap_single = swiotlb_unmap_single,
23 .sync_single_for_cpu = swiotlb_sync_single_for_cpu,
24 .sync_single_for_device = swiotlb_sync_single_for_device,
25 .sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
26 .sync_single_range_for_device = swiotlb_sync_single_range_for_device,
27 .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
28 .sync_sg_for_device = swiotlb_sync_sg_for_device,
29 .map_sg = swiotlb_map_sg,
30 .unmap_sg = swiotlb_unmap_sg,
31 .dma_supported = NULL,
35 void pci_swiotlb_init(void)
38 /* don't initialize swiotlb if iommu=off (no_iommu=1) */
39 if (!iommu_aperture && !no_iommu &&
40 (end_pfn > MAX_DMA32_PFN || force_iommu))
43 printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n");
45 dma_ops = &swiotlb_dma_ops;
50 printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n");
51 dma_ops = &swiotlb_dma_ops;