aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/dig
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2009-01-05 09:59:02 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-06 08:06:57 -0500
commit160c1d8e40866edfeae7d68816b7005d70acf391 (patch)
tree37dd78b2ea28a3953a46d401bd9657005eb444d7 /arch/ia64/dig
parentf0402a262e1a4c03fc66b83659823bdcaac3c41a (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/Makefile4
-rw-r--r--arch/ia64/dig/dig_vtd_iommu.c77
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
8obj-y := setup.o 8obj-y := setup.o
9ifeq ($(CONFIG_DMAR), y) 9ifeq ($(CONFIG_DMAR), y)
10obj-$(CONFIG_IA64_GENERIC) += machvec.o machvec_vtd.o dig_vtd_iommu.o 10obj-$(CONFIG_IA64_GENERIC) += machvec.o machvec_vtd.o
11else 11else
12obj-$(CONFIG_IA64_GENERIC) += machvec.o 12obj-$(CONFIG_IA64_GENERIC) += machvec.o
13endif 13endif
14obj-$(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
7void *
8vtd_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}
13EXPORT_SYMBOL_GPL(vtd_alloc_coherent);
14
15void
16vtd_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}
21EXPORT_SYMBOL_GPL(vtd_free_coherent);
22
23dma_addr_t
24vtd_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}
29EXPORT_SYMBOL_GPL(vtd_map_single_attrs);
30
31void
32vtd_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}
37EXPORT_SYMBOL_GPL(vtd_unmap_single_attrs);
38
39int
40vtd_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}
45EXPORT_SYMBOL_GPL(vtd_map_sg_attrs);
46
47void
48vtd_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}
53EXPORT_SYMBOL_GPL(vtd_unmap_sg_attrs);
54
55int
56vtd_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
57{
58 return 0;
59}
60EXPORT_SYMBOL_GPL(vtd_dma_mapping_error);
61
62extern int iommu_dma_supported(struct device *dev, u64 mask);
63
64struct 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};