Merge branch 'for-next' of git://www.jni.nu/cris into cris_merge
[linux-2.6] / arch / ia64 / kernel / pci-swiotlb.c
1 /* Glue code to lib/swiotlb.c */
2
3 #include <linux/pci.h>
4 #include <linux/cache.h>
5 #include <linux/module.h>
6 #include <linux/dma-mapping.h>
7
8 #include <asm/swiotlb.h>
9 #include <asm/dma.h>
10 #include <asm/iommu.h>
11 #include <asm/machvec.h>
12
13 int swiotlb __read_mostly;
14 EXPORT_SYMBOL(swiotlb);
15
16 struct dma_mapping_ops swiotlb_dma_ops = {
17         .mapping_error = swiotlb_dma_mapping_error,
18         .alloc_coherent = swiotlb_alloc_coherent,
19         .free_coherent = swiotlb_free_coherent,
20         .map_single = swiotlb_map_single,
21         .unmap_single = swiotlb_unmap_single,
22         .sync_single_for_cpu = swiotlb_sync_single_for_cpu,
23         .sync_single_for_device = swiotlb_sync_single_for_device,
24         .sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
25         .sync_single_range_for_device = swiotlb_sync_single_range_for_device,
26         .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
27         .sync_sg_for_device = swiotlb_sync_sg_for_device,
28         .map_sg = swiotlb_map_sg,
29         .unmap_sg = swiotlb_unmap_sg,
30         .dma_supported_op = swiotlb_dma_supported,
31 };
32
33 void __init pci_swiotlb_init(void)
34 {
35         if (!iommu_detected) {
36 #ifdef CONFIG_IA64_GENERIC
37                 swiotlb = 1;
38                 printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n");
39                 machvec_init("dig");
40                 swiotlb_init();
41                 dma_ops = &swiotlb_dma_ops;
42 #else
43                 panic("Unable to find Intel IOMMU");
44 #endif
45         }
46 }