Root/
1 | /* Glue code to lib/swiotlb.c */ |
2 | |
3 | #include <linux/pci.h> |
4 | #include <linux/gfp.h> |
5 | #include <linux/cache.h> |
6 | #include <linux/module.h> |
7 | #include <linux/dma-mapping.h> |
8 | |
9 | #include <asm/swiotlb.h> |
10 | #include <asm/dma.h> |
11 | #include <asm/iommu.h> |
12 | #include <asm/machvec.h> |
13 | |
14 | int swiotlb __read_mostly; |
15 | EXPORT_SYMBOL(swiotlb); |
16 | |
17 | static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size, |
18 | dma_addr_t *dma_handle, gfp_t gfp) |
19 | { |
20 | if (dev->coherent_dma_mask != DMA_BIT_MASK(64)) |
21 | gfp |= GFP_DMA; |
22 | return swiotlb_alloc_coherent(dev, size, dma_handle, gfp); |
23 | } |
24 | |
25 | struct dma_map_ops swiotlb_dma_ops = { |
26 | .alloc_coherent = ia64_swiotlb_alloc_coherent, |
27 | .free_coherent = swiotlb_free_coherent, |
28 | .map_page = swiotlb_map_page, |
29 | .unmap_page = swiotlb_unmap_page, |
30 | .map_sg = swiotlb_map_sg_attrs, |
31 | .unmap_sg = swiotlb_unmap_sg_attrs, |
32 | .sync_single_for_cpu = swiotlb_sync_single_for_cpu, |
33 | .sync_single_for_device = swiotlb_sync_single_for_device, |
34 | .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu, |
35 | .sync_sg_for_device = swiotlb_sync_sg_for_device, |
36 | .dma_supported = swiotlb_dma_supported, |
37 | .mapping_error = swiotlb_dma_mapping_error, |
38 | }; |
39 | |
40 | void __init swiotlb_dma_init(void) |
41 | { |
42 | dma_ops = &swiotlb_dma_ops; |
43 | swiotlb_init(1); |
44 | } |
45 | |
46 | void __init pci_swiotlb_init(void) |
47 | { |
48 | if (!iommu_detected) { |
49 | #ifdef CONFIG_IA64_GENERIC |
50 | swiotlb = 1; |
51 | printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n"); |
52 | machvec_init("dig"); |
53 | swiotlb_init(1); |
54 | dma_ops = &swiotlb_dma_ops; |
55 | #else |
56 | panic("Unable to find Intel IOMMU"); |
57 | #endif |
58 | } |
59 | } |
60 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9