aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2009-05-14 12:23:11 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-16 07:56:47 -0400
commitd69864158e24f323e818403c6b89ad4871aea6f6 (patch)
tree2fe0ec981c9bc96b5195956defd1b5989aa694a5 /arch/sparc
parent797a75686528e9f6f9bfee2a719a00b47868c999 (diff)
sparc: remove dma-mapping_{32|64}.h
This modifies SPARC32 to use struct dma_map ops. It means that we can remove dma-mapping_{32|64}.h. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Tested-by: Robert Reif <reif@earthlink.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/include/asm/dma-mapping.h148
-rw-r--r--arch/sparc/include/asm/dma-mapping_32.h42
-rw-r--r--arch/sparc/include/asm/dma-mapping_64.h121
-rw-r--r--arch/sparc/kernel/dma.c99
4 files changed, 172 insertions, 238 deletions
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 8c911ea9ee5f..204e4bf64438 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -1,33 +1,134 @@
1#ifndef ___ASM_SPARC_DMA_MAPPING_H 1#ifndef ___ASM_SPARC_DMA_MAPPING_H
2#define ___ASM_SPARC_DMA_MAPPING_H 2#define ___ASM_SPARC_DMA_MAPPING_H
3#if defined(__sparc__) && defined(__arch64__) 3
4#include <asm/dma-mapping_64.h> 4#include <linux/scatterlist.h>
5#else 5#include <linux/mm.h>
6#include <asm/dma-mapping_32.h>
7#endif
8 6
9#define DMA_ERROR_CODE (~(dma_addr_t)0x0) 7#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
10 8
11extern int dma_supported(struct device *dev, u64 mask); 9extern int dma_supported(struct device *dev, u64 mask);
12extern int dma_set_mask(struct device *dev, u64 dma_mask); 10extern int dma_set_mask(struct device *dev, u64 dma_mask);
13 11
14static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 12#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
13#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
14#define dma_is_consistent(d, h) (1)
15
16struct dma_ops {
17 void *(*alloc_coherent)(struct device *dev, size_t size,
18 dma_addr_t *dma_handle, gfp_t flag);
19 void (*free_coherent)(struct device *dev, size_t size,
20 void *cpu_addr, dma_addr_t dma_handle);
21 dma_addr_t (*map_page)(struct device *dev, struct page *page,
22 unsigned long offset, size_t size,
23 enum dma_data_direction direction);
24 void (*unmap_page)(struct device *dev, dma_addr_t dma_addr,
25 size_t size,
26 enum dma_data_direction direction);
27 int (*map_sg)(struct device *dev, struct scatterlist *sg, int nents,
28 enum dma_data_direction direction);
29 void (*unmap_sg)(struct device *dev, struct scatterlist *sg,
30 int nhwentries,
31 enum dma_data_direction direction);
32 void (*sync_single_for_cpu)(struct device *dev,
33 dma_addr_t dma_handle, size_t size,
34 enum dma_data_direction direction);
35 void (*sync_single_for_device)(struct device *dev,
36 dma_addr_t dma_handle, size_t size,
37 enum dma_data_direction direction);
38 void (*sync_sg_for_cpu)(struct device *dev, struct scatterlist *sg,
39 int nelems,
40 enum dma_data_direction direction);
41 void (*sync_sg_for_device)(struct device *dev,
42 struct scatterlist *sg, int nents,
43 enum dma_data_direction dir);
44};
45extern const struct dma_ops *dma_ops;
46
47static inline void *dma_alloc_coherent(struct device *dev, size_t size,
48 dma_addr_t *dma_handle, gfp_t flag)
15{ 49{
16 return (dma_addr == DMA_ERROR_CODE); 50 return dma_ops->alloc_coherent(dev, size, dma_handle, flag);
17} 51}
18 52
19static inline int dma_get_cache_alignment(void) 53static inline void dma_free_coherent(struct device *dev, size_t size,
54 void *cpu_addr, dma_addr_t dma_handle)
20{ 55{
21 /* 56 dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
22 * no easy way to get cache size on all processors, so return
23 * the maximum possible, to be safe
24 */
25 return (1 << INTERNODE_CACHE_SHIFT);
26} 57}
27 58
28#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 59static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
29#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 60 size_t size,
30#define dma_is_consistent(d, h) (1) 61 enum dma_data_direction direction)
62{
63 return dma_ops->map_page(dev, virt_to_page(cpu_addr),
64 (unsigned long)cpu_addr & ~PAGE_MASK, size,
65 direction);
66}
67
68static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
69 size_t size,
70 enum dma_data_direction direction)
71{
72 dma_ops->unmap_page(dev, dma_addr, size, direction);
73}
74
75static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
76 unsigned long offset, size_t size,
77 enum dma_data_direction direction)
78{
79 return dma_ops->map_page(dev, page, offset, size, direction);
80}
81
82static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
83 size_t size,
84 enum dma_data_direction direction)
85{
86 dma_ops->unmap_page(dev, dma_address, size, direction);
87}
88
89static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
90 int nents, enum dma_data_direction direction)
91{
92 return dma_ops->map_sg(dev, sg, nents, direction);
93}
94
95static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
96 int nents, enum dma_data_direction direction)
97{
98 dma_ops->unmap_sg(dev, sg, nents, direction);
99}
100
101static inline void dma_sync_single_for_cpu(struct device *dev,
102 dma_addr_t dma_handle, size_t size,
103 enum dma_data_direction direction)
104{
105 dma_ops->sync_single_for_cpu(dev, dma_handle, size, direction);
106}
107
108static inline void dma_sync_single_for_device(struct device *dev,
109 dma_addr_t dma_handle,
110 size_t size,
111 enum dma_data_direction direction)
112{
113 if (dma_ops->sync_single_for_device)
114 dma_ops->sync_single_for_device(dev, dma_handle, size,
115 direction);
116}
117
118static inline void dma_sync_sg_for_cpu(struct device *dev,
119 struct scatterlist *sg, int nelems,
120 enum dma_data_direction direction)
121{
122 dma_ops->sync_sg_for_cpu(dev, sg, nelems, direction);
123}
124
125static inline void dma_sync_sg_for_device(struct device *dev,
126 struct scatterlist *sg, int nelems,
127 enum dma_data_direction direction)
128{
129 if (dma_ops->sync_sg_for_device)
130 dma_ops->sync_sg_for_device(dev, sg, nelems, direction);
131}
31 132
32static inline void dma_sync_single_range_for_cpu(struct device *dev, 133static inline void dma_sync_single_range_for_cpu(struct device *dev,
33 dma_addr_t dma_handle, 134 dma_addr_t dma_handle,
@@ -47,4 +148,19 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
47 dma_sync_single_for_device(dev, dma_handle+offset, size, dir); 148 dma_sync_single_for_device(dev, dma_handle+offset, size, dir);
48} 149}
49 150
151
152static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
153{
154 return (dma_addr == DMA_ERROR_CODE);
155}
156
157static inline int dma_get_cache_alignment(void)
158{
159 /*
160 * no easy way to get cache size on all processors, so return
161 * the maximum possible, to be safe
162 */
163 return (1 << INTERNODE_CACHE_SHIFT);
164}
165
50#endif 166#endif
diff --git a/arch/sparc/include/asm/dma-mapping_32.h b/arch/sparc/include/asm/dma-mapping_32.h
deleted file mode 100644
index 7f09c85103a5..000000000000
--- a/arch/sparc/include/asm/dma-mapping_32.h
+++ /dev/null
@@ -1,42 +0,0 @@
1#ifndef _ASM_SPARC_DMA_MAPPING_H
2#define _ASM_SPARC_DMA_MAPPING_H
3
4#include <linux/types.h>
5
6struct device;
7struct scatterlist;
8struct page;
9
10extern void *dma_alloc_coherent(struct device *dev, size_t size,
11 dma_addr_t *dma_handle, gfp_t flag);
12extern void dma_free_coherent(struct device *dev, size_t size,
13 void *cpu_addr, dma_addr_t dma_handle);
14extern dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
15 size_t size,
16 enum dma_data_direction direction);
17extern void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
18 size_t size,
19 enum dma_data_direction direction);
20extern dma_addr_t dma_map_page(struct device *dev, struct page *page,
21 unsigned long offset, size_t size,
22 enum dma_data_direction direction);
23extern void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
24 size_t size, enum dma_data_direction direction);
25extern int dma_map_sg(struct device *dev, struct scatterlist *sg,
26 int nents, enum dma_data_direction direction);
27extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
28 int nents, enum dma_data_direction direction);
29extern void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
30 size_t size,
31 enum dma_data_direction direction);
32extern void dma_sync_single_for_device(struct device *dev,
33 dma_addr_t dma_handle,
34 size_t size,
35 enum dma_data_direction direction);
36extern void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
37 int nelems, enum dma_data_direction direction);
38extern void dma_sync_sg_for_device(struct device *dev,
39 struct scatterlist *sg, int nelems,
40 enum dma_data_direction direction);
41
42#endif /* _ASM_SPARC_DMA_MAPPING_H */
diff --git a/arch/sparc/include/asm/dma-mapping_64.h b/arch/sparc/include/asm/dma-mapping_64.h
deleted file mode 100644
index 579757e00a25..000000000000
--- a/arch/sparc/include/asm/dma-mapping_64.h
+++ /dev/null
@@ -1,121 +0,0 @@
1#ifndef _ASM_SPARC64_DMA_MAPPING_H
2#define _ASM_SPARC64_DMA_MAPPING_H
3
4#include <linux/scatterlist.h>
5#include <linux/mm.h>
6
7struct dma_ops {
8 void *(*alloc_coherent)(struct device *dev, size_t size,
9 dma_addr_t *dma_handle, gfp_t flag);
10 void (*free_coherent)(struct device *dev, size_t size,
11 void *cpu_addr, dma_addr_t dma_handle);
12 dma_addr_t (*map_page)(struct device *dev, struct page *page,
13 unsigned long offset, size_t size,
14 enum dma_data_direction direction);
15 void (*unmap_page)(struct device *dev, dma_addr_t dma_addr,
16 size_t size,
17 enum dma_data_direction direction);
18 int (*map_sg)(struct device *dev, struct scatterlist *sg, int nents,
19 enum dma_data_direction direction);
20 void (*unmap_sg)(struct device *dev, struct scatterlist *sg,
21 int nhwentries,
22 enum dma_data_direction direction);
23 void (*sync_single_for_cpu)(struct device *dev,
24 dma_addr_t dma_handle, size_t size,
25 enum dma_data_direction direction);
26 void (*sync_single_for_device)(struct device *dev,
27 dma_addr_t dma_handle, size_t size,
28 enum dma_data_direction direction);
29 void (*sync_sg_for_cpu)(struct device *dev, struct scatterlist *sg,
30 int nelems,
31 enum dma_data_direction direction);
32 void (*sync_sg_for_device)(struct device *dev,
33 struct scatterlist *sg, int nents,
34 enum dma_data_direction dir);
35};
36extern const struct dma_ops *dma_ops;
37
38static inline void *dma_alloc_coherent(struct device *dev, size_t size,
39 dma_addr_t *dma_handle, gfp_t flag)
40{
41 return dma_ops->alloc_coherent(dev, size, dma_handle, flag);
42}
43
44static inline void dma_free_coherent(struct device *dev, size_t size,
45 void *cpu_addr, dma_addr_t dma_handle)
46{
47 dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
48}
49
50static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
51 size_t size,
52 enum dma_data_direction direction)
53{
54 return dma_ops->map_page(dev, virt_to_page(cpu_addr),
55 (unsigned long)cpu_addr & ~PAGE_MASK, size,
56 direction);
57}
58
59static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
60 size_t size,
61 enum dma_data_direction direction)
62{
63 dma_ops->unmap_page(dev, dma_addr, size, direction);
64}
65
66static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
67 unsigned long offset, size_t size,
68 enum dma_data_direction direction)
69{
70 return dma_ops->map_page(dev, page, offset, size, direction);
71}
72
73static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
74 size_t size,
75 enum dma_data_direction direction)
76{
77 dma_ops->unmap_page(dev, dma_address, size, direction);
78}
79
80static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
81 int nents, enum dma_data_direction direction)
82{
83 return dma_ops->map_sg(dev, sg, nents, direction);
84}
85
86static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
87 int nents, enum dma_data_direction direction)
88{
89 dma_ops->unmap_sg(dev, sg, nents, direction);
90}
91
92static inline void dma_sync_single_for_cpu(struct device *dev,
93 dma_addr_t dma_handle, size_t size,
94 enum dma_data_direction direction)
95{
96 dma_ops->sync_single_for_cpu(dev, dma_handle, size, direction);
97}
98
99static inline void dma_sync_single_for_device(struct device *dev,
100 dma_addr_t dma_handle,
101 size_t size,
102 enum dma_data_direction direction)
103{
104 /* No flushing needed to sync cpu writes to the device. */
105}
106
107static inline void dma_sync_sg_for_cpu(struct device *dev,
108 struct scatterlist *sg, int nelems,
109 enum dma_data_direction direction)
110{
111 dma_ops->sync_sg_for_cpu(dev, sg, nelems, direction);
112}
113
114static inline void dma_sync_sg_for_device(struct device *dev,
115 struct scatterlist *sg, int nelems,
116 enum dma_data_direction direction)
117{
118 /* No flushing needed to sync cpu writes to the device. */
119}
120
121#endif /* _ASM_SPARC64_DMA_MAPPING_H */
diff --git a/arch/sparc/kernel/dma.c b/arch/sparc/kernel/dma.c
index 3c9ff4f8af3a..524c32f97c55 100644
--- a/arch/sparc/kernel/dma.c
+++ b/arch/sparc/kernel/dma.c
@@ -35,8 +35,8 @@ int dma_set_mask(struct device *dev, u64 dma_mask)
35} 35}
36EXPORT_SYMBOL(dma_set_mask); 36EXPORT_SYMBOL(dma_set_mask);
37 37
38void *dma_alloc_coherent(struct device *dev, size_t size, 38static void *dma32_alloc_coherent(struct device *dev, size_t size,
39 dma_addr_t *dma_handle, gfp_t flag) 39 dma_addr_t *dma_handle, gfp_t flag)
40{ 40{
41#ifdef CONFIG_PCI 41#ifdef CONFIG_PCI
42 if (dev->bus == &pci_bus_type) 42 if (dev->bus == &pci_bus_type)
@@ -44,10 +44,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
44#endif 44#endif
45 return sbus_alloc_consistent(dev, size, dma_handle); 45 return sbus_alloc_consistent(dev, size, dma_handle);
46} 46}
47EXPORT_SYMBOL(dma_alloc_coherent);
48 47
49void dma_free_coherent(struct device *dev, size_t size, 48static void dma32_free_coherent(struct device *dev, size_t size,
50 void *cpu_addr, dma_addr_t dma_handle) 49 void *cpu_addr, dma_addr_t dma_handle)
51{ 50{
52#ifdef CONFIG_PCI 51#ifdef CONFIG_PCI
53 if (dev->bus == &pci_bus_type) { 52 if (dev->bus == &pci_bus_type) {
@@ -58,38 +57,10 @@ void dma_free_coherent(struct device *dev, size_t size,
58#endif 57#endif
59 sbus_free_consistent(dev, size, cpu_addr, dma_handle); 58 sbus_free_consistent(dev, size, cpu_addr, dma_handle);
60} 59}
61EXPORT_SYMBOL(dma_free_coherent);
62 60
63dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, 61static dma_addr_t dma32_map_page(struct device *dev, struct page *page,
64 size_t size, enum dma_data_direction direction) 62 unsigned long offset, size_t size,
65{ 63 enum dma_data_direction direction)
66#ifdef CONFIG_PCI
67 if (dev->bus == &pci_bus_type)
68 return pci_map_single(to_pci_dev(dev), cpu_addr,
69 size, (int)direction);
70#endif
71 return sbus_map_single(dev, cpu_addr, size, (int)direction);
72}
73EXPORT_SYMBOL(dma_map_single);
74
75void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
76 size_t size,
77 enum dma_data_direction direction)
78{
79#ifdef CONFIG_PCI
80 if (dev->bus == &pci_bus_type) {
81 pci_unmap_single(to_pci_dev(dev), dma_addr,
82 size, (int)direction);
83 return;
84 }
85#endif
86 sbus_unmap_single(dev, dma_addr, size, (int)direction);
87}
88EXPORT_SYMBOL(dma_unmap_single);
89
90dma_addr_t dma_map_page(struct device *dev, struct page *page,
91 unsigned long offset, size_t size,
92 enum dma_data_direction direction)
93{ 64{
94#ifdef CONFIG_PCI 65#ifdef CONFIG_PCI
95 if (dev->bus == &pci_bus_type) 66 if (dev->bus == &pci_bus_type)
@@ -99,10 +70,9 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page,
99 return sbus_map_single(dev, page_address(page) + offset, 70 return sbus_map_single(dev, page_address(page) + offset,
100 size, (int)direction); 71 size, (int)direction);
101} 72}
102EXPORT_SYMBOL(dma_map_page);
103 73
104void dma_unmap_page(struct device *dev, dma_addr_t dma_address, 74static void dma32_unmap_page(struct device *dev, dma_addr_t dma_address,
105 size_t size, enum dma_data_direction direction) 75 size_t size, enum dma_data_direction direction)
106{ 76{
107#ifdef CONFIG_PCI 77#ifdef CONFIG_PCI
108 if (dev->bus == &pci_bus_type) { 78 if (dev->bus == &pci_bus_type) {
@@ -113,10 +83,9 @@ void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
113#endif 83#endif
114 sbus_unmap_single(dev, dma_address, size, (int)direction); 84 sbus_unmap_single(dev, dma_address, size, (int)direction);
115} 85}
116EXPORT_SYMBOL(dma_unmap_page);
117 86
118int dma_map_sg(struct device *dev, struct scatterlist *sg, 87static int dma32_map_sg(struct device *dev, struct scatterlist *sg,
119 int nents, enum dma_data_direction direction) 88 int nents, enum dma_data_direction direction)
120{ 89{
121#ifdef CONFIG_PCI 90#ifdef CONFIG_PCI
122 if (dev->bus == &pci_bus_type) 91 if (dev->bus == &pci_bus_type)
@@ -124,10 +93,9 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg,
124#endif 93#endif
125 return sbus_map_sg(dev, sg, nents, direction); 94 return sbus_map_sg(dev, sg, nents, direction);
126} 95}
127EXPORT_SYMBOL(dma_map_sg);
128 96
129void dma_unmap_sg(struct device *dev, struct scatterlist *sg, 97void dma32_unmap_sg(struct device *dev, struct scatterlist *sg,
130 int nents, enum dma_data_direction direction) 98 int nents, enum dma_data_direction direction)
131{ 99{
132#ifdef CONFIG_PCI 100#ifdef CONFIG_PCI
133 if (dev->bus == &pci_bus_type) { 101 if (dev->bus == &pci_bus_type) {
@@ -137,10 +105,10 @@ void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
137#endif 105#endif
138 sbus_unmap_sg(dev, sg, nents, (int)direction); 106 sbus_unmap_sg(dev, sg, nents, (int)direction);
139} 107}
140EXPORT_SYMBOL(dma_unmap_sg);
141 108
142void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, 109static void dma32_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
143 size_t size, enum dma_data_direction direction) 110 size_t size,
111 enum dma_data_direction direction)
144{ 112{
145#ifdef CONFIG_PCI 113#ifdef CONFIG_PCI
146 if (dev->bus == &pci_bus_type) { 114 if (dev->bus == &pci_bus_type) {
@@ -151,10 +119,10 @@ void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
151#endif 119#endif
152 sbus_dma_sync_single_for_cpu(dev, dma_handle, size, (int) direction); 120 sbus_dma_sync_single_for_cpu(dev, dma_handle, size, (int) direction);
153} 121}
154EXPORT_SYMBOL(dma_sync_single_for_cpu);
155 122
156void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, 123static void dma32_sync_single_for_device(struct device *dev,
157 size_t size, enum dma_data_direction direction) 124 dma_addr_t dma_handle, size_t size,
125 enum dma_data_direction direction)
158{ 126{
159#ifdef CONFIG_PCI 127#ifdef CONFIG_PCI
160 if (dev->bus == &pci_bus_type) { 128 if (dev->bus == &pci_bus_type) {
@@ -165,10 +133,9 @@ void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
165#endif 133#endif
166 sbus_dma_sync_single_for_device(dev, dma_handle, size, (int) direction); 134 sbus_dma_sync_single_for_device(dev, dma_handle, size, (int) direction);
167} 135}
168EXPORT_SYMBOL(dma_sync_single_for_device);
169 136
170void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, 137static void dma32_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
171 int nelems, enum dma_data_direction direction) 138 int nelems, enum dma_data_direction direction)
172{ 139{
173#ifdef CONFIG_PCI 140#ifdef CONFIG_PCI
174 if (dev->bus == &pci_bus_type) { 141 if (dev->bus == &pci_bus_type) {
@@ -179,11 +146,10 @@ void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
179#endif 146#endif
180 BUG(); 147 BUG();
181} 148}
182EXPORT_SYMBOL(dma_sync_sg_for_cpu);
183 149
184void dma_sync_sg_for_device(struct device *dev, 150static void dma32_sync_sg_for_device(struct device *dev,
185 struct scatterlist *sg, int nelems, 151 struct scatterlist *sg, int nelems,
186 enum dma_data_direction direction) 152 enum dma_data_direction direction)
187{ 153{
188#ifdef CONFIG_PCI 154#ifdef CONFIG_PCI
189 if (dev->bus == &pci_bus_type) { 155 if (dev->bus == &pci_bus_type) {
@@ -194,4 +160,19 @@ void dma_sync_sg_for_device(struct device *dev,
194#endif 160#endif
195 BUG(); 161 BUG();
196} 162}
197EXPORT_SYMBOL(dma_sync_sg_for_device); 163
164static const struct dma_ops dma32_dma_ops = {
165 .alloc_coherent = dma32_alloc_coherent,
166 .free_coherent = dma32_free_coherent,
167 .map_page = dma32_map_page,
168 .unmap_page = dma32_unmap_page,
169 .map_sg = dma32_map_sg,
170 .unmap_sg = dma32_unmap_sg,
171 .sync_single_for_cpu = dma32_sync_single_for_cpu,
172 .sync_single_for_device = dma32_sync_single_for_device,
173 .sync_sg_for_cpu = dma32_sync_sg_for_cpu,
174 .sync_sg_for_device = dma32_sync_sg_for_device,
175};
176
177const struct dma_ops *dma_ops = &dma32_dma_ops;
178EXPORT_SYMBOL(dma_ops);