diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2009-01-05 09:59:02 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-06 08:06:57 -0500 |
commit | 160c1d8e40866edfeae7d68816b7005d70acf391 (patch) | |
tree | 37dd78b2ea28a3953a46d401bd9657005eb444d7 /arch/ia64/dig | |
parent | f0402a262e1a4c03fc66b83659823bdcaac3c41a (diff) |
x86, ia64: convert to use generic dma_map_ops struct
This converts X86 and IA64 to use include/linux/dma-mapping.h.
It's a bit large but pretty boring. The major change for X86 is
converting 'int dir' to 'enum dma_data_direction dir' in DMA mapping
operations. The major changes for IA64 is using map_page and
unmap_page instead of map_single and unmap_single.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/ia64/dig')
-rw-r--r-- | arch/ia64/dig/Makefile | 4 | ||||
-rw-r--r-- | arch/ia64/dig/dig_vtd_iommu.c | 77 |
2 files changed, 2 insertions, 79 deletions
diff --git a/arch/ia64/dig/Makefile b/arch/ia64/dig/Makefile index 5c0283830bd6..2f7caddf093e 100644 --- a/arch/ia64/dig/Makefile +++ b/arch/ia64/dig/Makefile | |||
@@ -7,8 +7,8 @@ | |||
7 | 7 | ||
8 | obj-y := setup.o | 8 | obj-y := setup.o |
9 | ifeq ($(CONFIG_DMAR), y) | 9 | ifeq ($(CONFIG_DMAR), y) |
10 | obj-$(CONFIG_IA64_GENERIC) += machvec.o machvec_vtd.o dig_vtd_iommu.o | 10 | obj-$(CONFIG_IA64_GENERIC) += machvec.o machvec_vtd.o |
11 | else | 11 | else |
12 | obj-$(CONFIG_IA64_GENERIC) += machvec.o | 12 | obj-$(CONFIG_IA64_GENERIC) += machvec.o |
13 | endif | 13 | endif |
14 | obj-$(CONFIG_IA64_DIG_VTD) += dig_vtd_iommu.o | 14 | |
diff --git a/arch/ia64/dig/dig_vtd_iommu.c b/arch/ia64/dig/dig_vtd_iommu.c deleted file mode 100644 index fdb8ba9f4992..000000000000 --- a/arch/ia64/dig/dig_vtd_iommu.c +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | #include <linux/types.h> | ||
2 | #include <linux/kernel.h> | ||
3 | #include <linux/module.h> | ||
4 | #include <linux/dma-mapping.h> | ||
5 | #include <linux/intel-iommu.h> | ||
6 | |||
7 | void * | ||
8 | vtd_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | ||
9 | gfp_t flags) | ||
10 | { | ||
11 | return intel_alloc_coherent(dev, size, dma_handle, flags); | ||
12 | } | ||
13 | EXPORT_SYMBOL_GPL(vtd_alloc_coherent); | ||
14 | |||
15 | void | ||
16 | vtd_free_coherent(struct device *dev, size_t size, void *vaddr, | ||
17 | dma_addr_t dma_handle) | ||
18 | { | ||
19 | intel_free_coherent(dev, size, vaddr, dma_handle); | ||
20 | } | ||
21 | EXPORT_SYMBOL_GPL(vtd_free_coherent); | ||
22 | |||
23 | dma_addr_t | ||
24 | vtd_map_single_attrs(struct device *dev, void *addr, size_t size, | ||
25 | int dir, struct dma_attrs *attrs) | ||
26 | { | ||
27 | return intel_map_single(dev, (phys_addr_t)addr, size, dir); | ||
28 | } | ||
29 | EXPORT_SYMBOL_GPL(vtd_map_single_attrs); | ||
30 | |||
31 | void | ||
32 | vtd_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size, | ||
33 | int dir, struct dma_attrs *attrs) | ||
34 | { | ||
35 | intel_unmap_single(dev, iova, size, dir); | ||
36 | } | ||
37 | EXPORT_SYMBOL_GPL(vtd_unmap_single_attrs); | ||
38 | |||
39 | int | ||
40 | vtd_map_sg_attrs(struct device *dev, struct scatterlist *sglist, int nents, | ||
41 | int dir, struct dma_attrs *attrs) | ||
42 | { | ||
43 | return intel_map_sg(dev, sglist, nents, dir); | ||
44 | } | ||
45 | EXPORT_SYMBOL_GPL(vtd_map_sg_attrs); | ||
46 | |||
47 | void | ||
48 | vtd_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist, | ||
49 | int nents, int dir, struct dma_attrs *attrs) | ||
50 | { | ||
51 | intel_unmap_sg(dev, sglist, nents, dir); | ||
52 | } | ||
53 | EXPORT_SYMBOL_GPL(vtd_unmap_sg_attrs); | ||
54 | |||
55 | int | ||
56 | vtd_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | ||
57 | { | ||
58 | return 0; | ||
59 | } | ||
60 | EXPORT_SYMBOL_GPL(vtd_dma_mapping_error); | ||
61 | |||
62 | extern int iommu_dma_supported(struct device *dev, u64 mask); | ||
63 | |||
64 | struct dma_mapping_ops vtd_dma_ops = { | ||
65 | .alloc_coherent = vtd_alloc_coherent, | ||
66 | .free_coherent = vtd_free_coherent, | ||
67 | .map_single_attrs = vtd_map_single_attrs, | ||
68 | .unmap_single_attrs = vtd_unmap_single_attrs, | ||
69 | .map_sg_attrs = vtd_map_sg_attrs, | ||
70 | .unmap_sg_attrs = vtd_unmap_sg_attrs, | ||
71 | .sync_single_for_cpu = machvec_dma_sync_single, | ||
72 | .sync_sg_for_cpu = machvec_dma_sync_sg, | ||
73 | .sync_single_for_device = machvec_dma_sync_single, | ||
74 | .sync_sg_for_device = machvec_dma_sync_sg, | ||
75 | .dma_supported_op = iommu_dma_supported, | ||
76 | .mapping_error = vtd_dma_mapping_error, | ||
77 | }; | ||