diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-11-26 11:19:58 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-02-15 10:22:20 -0500 |
commit | a9c9147eb9b1dba0ce567a41897c7773b4d1b0bc (patch) | |
tree | 178938c909f4717c2e599d6f3de954d7ee8a7f21 | |
parent | 93f1d629e22b08642eb713ad96ac2cb9ade0641c (diff) |
ARM: dma-mapping: provide per-cpu type map/unmap functions
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-By: Santosh Shilimkar <santosh.shilimkar@ti.com>
-rw-r--r-- | arch/arm/include/asm/cacheflush.h | 9 | ||||
-rw-r--r-- | arch/arm/kernel/asm-offsets.c | 5 | ||||
-rw-r--r-- | arch/arm/mm/cache-fa.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/cache-v3.S | 24 | ||||
-rw-r--r-- | arch/arm/mm/cache-v4.S | 24 | ||||
-rw-r--r-- | arch/arm/mm/cache-v4wb.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/cache-v4wt.S | 25 | ||||
-rw-r--r-- | arch/arm/mm/cache-v6.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/cache-v7.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 29 | ||||
-rw-r--r-- | arch/arm/mm/proc-arm1020.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/proc-arm1020e.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/proc-arm1022.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/proc-arm1026.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/proc-arm920.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/proc-arm922.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/proc-arm925.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/proc-arm926.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/proc-arm940.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/proc-arm946.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/proc-feroceon.S | 42 | ||||
-rw-r--r-- | arch/arm/mm/proc-mohawk.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/proc-xsc3.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/proc-xscale.S | 41 |
24 files changed, 598 insertions, 17 deletions
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h index 730aefcfbee3..4c733236e342 100644 --- a/arch/arm/include/asm/cacheflush.h +++ b/arch/arm/include/asm/cacheflush.h | |||
@@ -213,6 +213,9 @@ struct cpu_cache_fns { | |||
213 | void (*coherent_user_range)(unsigned long, unsigned long); | 213 | void (*coherent_user_range)(unsigned long, unsigned long); |
214 | void (*flush_kern_dcache_area)(void *, size_t); | 214 | void (*flush_kern_dcache_area)(void *, size_t); |
215 | 215 | ||
216 | void (*dma_map_area)(const void *, size_t, int); | ||
217 | void (*dma_unmap_area)(const void *, size_t, int); | ||
218 | |||
216 | void (*dma_inv_range)(const void *, const void *); | 219 | void (*dma_inv_range)(const void *, const void *); |
217 | void (*dma_clean_range)(const void *, const void *); | 220 | void (*dma_clean_range)(const void *, const void *); |
218 | void (*dma_flush_range)(const void *, const void *); | 221 | void (*dma_flush_range)(const void *, const void *); |
@@ -244,6 +247,8 @@ extern struct cpu_cache_fns cpu_cache; | |||
244 | * is visible to DMA, or data written by DMA to system memory is | 247 | * is visible to DMA, or data written by DMA to system memory is |
245 | * visible to the CPU. | 248 | * visible to the CPU. |
246 | */ | 249 | */ |
250 | #define dmac_map_area cpu_cache.dma_map_area | ||
251 | #define dmac_unmap_area cpu_cache.dma_unmap_area | ||
247 | #define dmac_inv_range cpu_cache.dma_inv_range | 252 | #define dmac_inv_range cpu_cache.dma_inv_range |
248 | #define dmac_clean_range cpu_cache.dma_clean_range | 253 | #define dmac_clean_range cpu_cache.dma_clean_range |
249 | #define dmac_flush_range cpu_cache.dma_flush_range | 254 | #define dmac_flush_range cpu_cache.dma_flush_range |
@@ -270,10 +275,14 @@ extern void __cpuc_flush_dcache_area(void *, size_t); | |||
270 | * is visible to DMA, or data written by DMA to system memory is | 275 | * is visible to DMA, or data written by DMA to system memory is |
271 | * visible to the CPU. | 276 | * visible to the CPU. |
272 | */ | 277 | */ |
278 | #define dmac_map_area __glue(_CACHE,_dma_map_area) | ||
279 | #define dmac_unmap_area __glue(_CACHE,_dma_unmap_area) | ||
273 | #define dmac_inv_range __glue(_CACHE,_dma_inv_range) | 280 | #define dmac_inv_range __glue(_CACHE,_dma_inv_range) |
274 | #define dmac_clean_range __glue(_CACHE,_dma_clean_range) | 281 | #define dmac_clean_range __glue(_CACHE,_dma_clean_range) |
275 | #define dmac_flush_range __glue(_CACHE,_dma_flush_range) | 282 | #define dmac_flush_range __glue(_CACHE,_dma_flush_range) |
276 | 283 | ||
284 | extern void dmac_map_area(const void *, size_t, int); | ||
285 | extern void dmac_unmap_area(const void *, size_t, int); | ||
277 | extern void dmac_inv_range(const void *, const void *); | 286 | extern void dmac_inv_range(const void *, const void *); |
278 | extern void dmac_clean_range(const void *, const void *); | 287 | extern void dmac_clean_range(const void *, const void *); |
279 | extern void dmac_flush_range(const void *, const void *); | 288 | extern void dmac_flush_range(const void *, const void *); |
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c index 4a881258bb17..883511522fca 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
15 | #include <linux/dma-mapping.h> | ||
15 | #include <asm/mach/arch.h> | 16 | #include <asm/mach/arch.h> |
16 | #include <asm/thread_info.h> | 17 | #include <asm/thread_info.h> |
17 | #include <asm/memory.h> | 18 | #include <asm/memory.h> |
@@ -112,5 +113,9 @@ int main(void) | |||
112 | #ifdef MULTI_PABORT | 113 | #ifdef MULTI_PABORT |
113 | DEFINE(PROCESSOR_PABT_FUNC, offsetof(struct processor, _prefetch_abort)); | 114 | DEFINE(PROCESSOR_PABT_FUNC, offsetof(struct processor, _prefetch_abort)); |
114 | #endif | 115 | #endif |
116 | BLANK(); | ||
117 | DEFINE(DMA_BIDIRECTIONAL, DMA_BIDIRECTIONAL); | ||
118 | DEFINE(DMA_TO_DEVICE, DMA_TO_DEVICE); | ||
119 | DEFINE(DMA_FROM_DEVICE, DMA_FROM_DEVICE); | ||
115 | return 0; | 120 | return 0; |
116 | } | 121 | } |
diff --git a/arch/arm/mm/cache-fa.S b/arch/arm/mm/cache-fa.S index a89444a3c016..8ebffdd6fcff 100644 --- a/arch/arm/mm/cache-fa.S +++ b/arch/arm/mm/cache-fa.S | |||
@@ -205,6 +205,30 @@ ENTRY(fa_dma_flush_range) | |||
205 | mcr p15, 0, r0, c7, c10, 4 @ drain write buffer | 205 | mcr p15, 0, r0, c7, c10, 4 @ drain write buffer |
206 | mov pc, lr | 206 | mov pc, lr |
207 | 207 | ||
208 | /* | ||
209 | * dma_map_area(start, size, dir) | ||
210 | * - start - kernel virtual start address | ||
211 | * - size - size of region | ||
212 | * - dir - DMA direction | ||
213 | */ | ||
214 | ENTRY(fa_dma_map_area) | ||
215 | add r1, r1, r0 | ||
216 | cmp r2, #DMA_TO_DEVICE | ||
217 | beq fa_dma_clean_range | ||
218 | bcs fa_dma_inv_range | ||
219 | b fa_dma_flush_range | ||
220 | ENDPROC(fa_dma_map_area) | ||
221 | |||
222 | /* | ||
223 | * dma_unmap_area(start, size, dir) | ||
224 | * - start - kernel virtual start address | ||
225 | * - size - size of region | ||
226 | * - dir - DMA direction | ||
227 | */ | ||
228 | ENTRY(fa_dma_unmap_area) | ||
229 | mov pc, lr | ||
230 | ENDPROC(fa_dma_unmap_area) | ||
231 | |||
208 | __INITDATA | 232 | __INITDATA |
209 | 233 | ||
210 | .type fa_cache_fns, #object | 234 | .type fa_cache_fns, #object |
@@ -215,6 +239,8 @@ ENTRY(fa_cache_fns) | |||
215 | .long fa_coherent_kern_range | 239 | .long fa_coherent_kern_range |
216 | .long fa_coherent_user_range | 240 | .long fa_coherent_user_range |
217 | .long fa_flush_kern_dcache_area | 241 | .long fa_flush_kern_dcache_area |
242 | .long fa_dma_map_area | ||
243 | .long fa_dma_unmap_area | ||
218 | .long fa_dma_inv_range | 244 | .long fa_dma_inv_range |
219 | .long fa_dma_clean_range | 245 | .long fa_dma_clean_range |
220 | .long fa_dma_flush_range | 246 | .long fa_dma_flush_range |
diff --git a/arch/arm/mm/cache-v3.S b/arch/arm/mm/cache-v3.S index 2a482731ea36..6df52dc014be 100644 --- a/arch/arm/mm/cache-v3.S +++ b/arch/arm/mm/cache-v3.S | |||
@@ -121,6 +121,28 @@ ENTRY(v3_dma_flush_range) | |||
121 | ENTRY(v3_dma_clean_range) | 121 | ENTRY(v3_dma_clean_range) |
122 | mov pc, lr | 122 | mov pc, lr |
123 | 123 | ||
124 | /* | ||
125 | * dma_unmap_area(start, size, dir) | ||
126 | * - start - kernel virtual start address | ||
127 | * - size - size of region | ||
128 | * - dir - DMA direction | ||
129 | */ | ||
130 | ENTRY(v3_dma_unmap_area) | ||
131 | teq r2, #DMA_TO_DEVICE | ||
132 | bne v3_dma_inv_range | ||
133 | /* FALLTHROUGH */ | ||
134 | |||
135 | /* | ||
136 | * dma_map_area(start, size, dir) | ||
137 | * - start - kernel virtual start address | ||
138 | * - size - size of region | ||
139 | * - dir - DMA direction | ||
140 | */ | ||
141 | ENTRY(v3_dma_map_area) | ||
142 | mov pc, lr | ||
143 | ENDPROC(v3_dma_unmap_area) | ||
144 | ENDPROC(v3_dma_map_area) | ||
145 | |||
124 | __INITDATA | 146 | __INITDATA |
125 | 147 | ||
126 | .type v3_cache_fns, #object | 148 | .type v3_cache_fns, #object |
@@ -131,6 +153,8 @@ ENTRY(v3_cache_fns) | |||
131 | .long v3_coherent_kern_range | 153 | .long v3_coherent_kern_range |
132 | .long v3_coherent_user_range | 154 | .long v3_coherent_user_range |
133 | .long v3_flush_kern_dcache_area | 155 | .long v3_flush_kern_dcache_area |
156 | .long v3_dma_map_area | ||
157 | .long v3_dma_unmap_area | ||
134 | .long v3_dma_inv_range | 158 | .long v3_dma_inv_range |
135 | .long v3_dma_clean_range | 159 | .long v3_dma_clean_range |
136 | .long v3_dma_flush_range | 160 | .long v3_dma_flush_range |
diff --git a/arch/arm/mm/cache-v4.S b/arch/arm/mm/cache-v4.S index 5c7da3e372e9..df3b423713b9 100644 --- a/arch/arm/mm/cache-v4.S +++ b/arch/arm/mm/cache-v4.S | |||
@@ -133,6 +133,28 @@ ENTRY(v4_dma_flush_range) | |||
133 | ENTRY(v4_dma_clean_range) | 133 | ENTRY(v4_dma_clean_range) |
134 | mov pc, lr | 134 | mov pc, lr |
135 | 135 | ||
136 | /* | ||
137 | * dma_unmap_area(start, size, dir) | ||
138 | * - start - kernel virtual start address | ||
139 | * - size - size of region | ||
140 | * - dir - DMA direction | ||
141 | */ | ||
142 | ENTRY(v4_dma_unmap_area) | ||
143 | teq r2, #DMA_TO_DEVICE | ||
144 | bne v4_dma_inv_range | ||
145 | /* FALLTHROUGH */ | ||
146 | |||
147 | /* | ||
148 | * dma_map_area(start, size, dir) | ||
149 | * - start - kernel virtual start address | ||
150 | * - size - size of region | ||
151 | * - dir - DMA direction | ||
152 | */ | ||
153 | ENTRY(v4_dma_map_area) | ||
154 | mov pc, lr | ||
155 | ENDPROC(v4_dma_unmap_area) | ||
156 | ENDPROC(v4_dma_map_area) | ||
157 | |||
136 | __INITDATA | 158 | __INITDATA |
137 | 159 | ||
138 | .type v4_cache_fns, #object | 160 | .type v4_cache_fns, #object |
@@ -143,6 +165,8 @@ ENTRY(v4_cache_fns) | |||
143 | .long v4_coherent_kern_range | 165 | .long v4_coherent_kern_range |
144 | .long v4_coherent_user_range | 166 | .long v4_coherent_user_range |
145 | .long v4_flush_kern_dcache_area | 167 | .long v4_flush_kern_dcache_area |
168 | .long v4_dma_map_area | ||
169 | .long v4_dma_unmap_area | ||
146 | .long v4_dma_inv_range | 170 | .long v4_dma_inv_range |
147 | .long v4_dma_clean_range | 171 | .long v4_dma_clean_range |
148 | .long v4_dma_flush_range | 172 | .long v4_dma_flush_range |
diff --git a/arch/arm/mm/cache-v4wb.S b/arch/arm/mm/cache-v4wb.S index 3dbedf1ec0e7..32e7a7448496 100644 --- a/arch/arm/mm/cache-v4wb.S +++ b/arch/arm/mm/cache-v4wb.S | |||
@@ -216,6 +216,30 @@ ENTRY(v4wb_dma_clean_range) | |||
216 | .globl v4wb_dma_flush_range | 216 | .globl v4wb_dma_flush_range |
217 | .set v4wb_dma_flush_range, v4wb_coherent_kern_range | 217 | .set v4wb_dma_flush_range, v4wb_coherent_kern_range |
218 | 218 | ||
219 | /* | ||
220 | * dma_map_area(start, size, dir) | ||
221 | * - start - kernel virtual start address | ||
222 | * - size - size of region | ||
223 | * - dir - DMA direction | ||
224 | */ | ||
225 | ENTRY(v4wb_dma_map_area) | ||
226 | add r1, r1, r0 | ||
227 | cmp r2, #DMA_TO_DEVICE | ||
228 | beq v4wb_dma_clean_range | ||
229 | bcs v4wb_dma_inv_range | ||
230 | b v4wb_dma_flush_range | ||
231 | ENDPROC(v4wb_dma_map_area) | ||
232 | |||
233 | /* | ||
234 | * dma_unmap_area(start, size, dir) | ||
235 | * - start - kernel virtual start address | ||
236 | * - size - size of region | ||
237 | * - dir - DMA direction | ||
238 | */ | ||
239 | ENTRY(v4wb_dma_unmap_area) | ||
240 | mov pc, lr | ||
241 | ENDPROC(v4wb_dma_unmap_area) | ||
242 | |||
219 | __INITDATA | 243 | __INITDATA |
220 | 244 | ||
221 | .type v4wb_cache_fns, #object | 245 | .type v4wb_cache_fns, #object |
@@ -226,6 +250,8 @@ ENTRY(v4wb_cache_fns) | |||
226 | .long v4wb_coherent_kern_range | 250 | .long v4wb_coherent_kern_range |
227 | .long v4wb_coherent_user_range | 251 | .long v4wb_coherent_user_range |
228 | .long v4wb_flush_kern_dcache_area | 252 | .long v4wb_flush_kern_dcache_area |
253 | .long v4wb_dma_map_area | ||
254 | .long v4wb_dma_unmap_area | ||
229 | .long v4wb_dma_inv_range | 255 | .long v4wb_dma_inv_range |
230 | .long v4wb_dma_clean_range | 256 | .long v4wb_dma_clean_range |
231 | .long v4wb_dma_flush_range | 257 | .long v4wb_dma_flush_range |
diff --git a/arch/arm/mm/cache-v4wt.S b/arch/arm/mm/cache-v4wt.S index b3b7410270b4..3d8dad5b2650 100644 --- a/arch/arm/mm/cache-v4wt.S +++ b/arch/arm/mm/cache-v4wt.S | |||
@@ -172,6 +172,29 @@ ENTRY(v4wt_dma_clean_range) | |||
172 | .globl v4wt_dma_flush_range | 172 | .globl v4wt_dma_flush_range |
173 | .equ v4wt_dma_flush_range, v4wt_dma_inv_range | 173 | .equ v4wt_dma_flush_range, v4wt_dma_inv_range |
174 | 174 | ||
175 | /* | ||
176 | * dma_unmap_area(start, size, dir) | ||
177 | * - start - kernel virtual start address | ||
178 | * - size - size of region | ||
179 | * - dir - DMA direction | ||
180 | */ | ||
181 | ENTRY(v4wt_dma_unmap_area) | ||
182 | add r1, r1, r0 | ||
183 | teq r2, #DMA_TO_DEVICE | ||
184 | bne v4wt_dma_inv_range | ||
185 | /* FALLTHROUGH */ | ||
186 | |||
187 | /* | ||
188 | * dma_map_area(start, size, dir) | ||
189 | * - start - kernel virtual start address | ||
190 | * - size - size of region | ||
191 | * - dir - DMA direction | ||
192 | */ | ||
193 | ENTRY(v4wt_dma_map_area) | ||
194 | mov pc, lr | ||
195 | ENDPROC(v4wt_dma_unmap_area) | ||
196 | ENDPROC(v4wt_dma_map_area) | ||
197 | |||
175 | __INITDATA | 198 | __INITDATA |
176 | 199 | ||
177 | .type v4wt_cache_fns, #object | 200 | .type v4wt_cache_fns, #object |
@@ -182,6 +205,8 @@ ENTRY(v4wt_cache_fns) | |||
182 | .long v4wt_coherent_kern_range | 205 | .long v4wt_coherent_kern_range |
183 | .long v4wt_coherent_user_range | 206 | .long v4wt_coherent_user_range |
184 | .long v4wt_flush_kern_dcache_area | 207 | .long v4wt_flush_kern_dcache_area |
208 | .long v4wt_dma_map_area | ||
209 | .long v4wt_dma_unmap_area | ||
185 | .long v4wt_dma_inv_range | 210 | .long v4wt_dma_inv_range |
186 | .long v4wt_dma_clean_range | 211 | .long v4wt_dma_clean_range |
187 | .long v4wt_dma_flush_range | 212 | .long v4wt_dma_flush_range |
diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S index 4ba0a24ce6f5..6f926dd0e0f7 100644 --- a/arch/arm/mm/cache-v6.S +++ b/arch/arm/mm/cache-v6.S | |||
@@ -263,6 +263,30 @@ ENTRY(v6_dma_flush_range) | |||
263 | mcr p15, 0, r0, c7, c10, 4 @ drain write buffer | 263 | mcr p15, 0, r0, c7, c10, 4 @ drain write buffer |
264 | mov pc, lr | 264 | mov pc, lr |
265 | 265 | ||
266 | /* | ||
267 | * dma_map_area(start, size, dir) | ||
268 | * - start - kernel virtual start address | ||
269 | * - size - size of region | ||
270 | * - dir - DMA direction | ||
271 | */ | ||
272 | ENTRY(v6_dma_map_area) | ||
273 | add r1, r1, r0 | ||
274 | cmp r2, #DMA_TO_DEVICE | ||
275 | beq v6_dma_clean_range | ||
276 | bcs v6_dma_inv_range | ||
277 | b v6_dma_flush_range | ||
278 | ENDPROC(v6_dma_map_area) | ||
279 | |||
280 | /* | ||
281 | * dma_unmap_area(start, size, dir) | ||
282 | * - start - kernel virtual start address | ||
283 | * - size - size of region | ||
284 | * - dir - DMA direction | ||
285 | */ | ||
286 | ENTRY(v6_dma_unmap_area) | ||
287 | mov pc, lr | ||
288 | ENDPROC(v6_dma_unmap_area) | ||
289 | |||
266 | __INITDATA | 290 | __INITDATA |
267 | 291 | ||
268 | .type v6_cache_fns, #object | 292 | .type v6_cache_fns, #object |
@@ -273,6 +297,8 @@ ENTRY(v6_cache_fns) | |||
273 | .long v6_coherent_kern_range | 297 | .long v6_coherent_kern_range |
274 | .long v6_coherent_user_range | 298 | .long v6_coherent_user_range |
275 | .long v6_flush_kern_dcache_area | 299 | .long v6_flush_kern_dcache_area |
300 | .long v6_dma_map_area | ||
301 | .long v6_dma_unmap_area | ||
276 | .long v6_dma_inv_range | 302 | .long v6_dma_inv_range |
277 | .long v6_dma_clean_range | 303 | .long v6_dma_clean_range |
278 | .long v6_dma_flush_range | 304 | .long v6_dma_flush_range |
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S index 9073db849fb4..e30d8bc67182 100644 --- a/arch/arm/mm/cache-v7.S +++ b/arch/arm/mm/cache-v7.S | |||
@@ -271,6 +271,30 @@ ENTRY(v7_dma_flush_range) | |||
271 | mov pc, lr | 271 | mov pc, lr |
272 | ENDPROC(v7_dma_flush_range) | 272 | ENDPROC(v7_dma_flush_range) |
273 | 273 | ||
274 | /* | ||
275 | * dma_map_area(start, size, dir) | ||
276 | * - start - kernel virtual start address | ||
277 | * - size - size of region | ||
278 | * - dir - DMA direction | ||
279 | */ | ||
280 | ENTRY(v7_dma_map_area) | ||
281 | add r1, r1, r0 | ||
282 | cmp r2, #DMA_TO_DEVICE | ||
283 | beq v7_dma_clean_range | ||
284 | bcs v7_dma_inv_range | ||
285 | b v7_dma_flush_range | ||
286 | ENDPROC(v7_dma_map_area) | ||
287 | |||
288 | /* | ||
289 | * dma_unmap_area(start, size, dir) | ||
290 | * - start - kernel virtual start address | ||
291 | * - size - size of region | ||
292 | * - dir - DMA direction | ||
293 | */ | ||
294 | ENTRY(v7_dma_unmap_area) | ||
295 | mov pc, lr | ||
296 | ENDPROC(v7_dma_unmap_area) | ||
297 | |||
274 | __INITDATA | 298 | __INITDATA |
275 | 299 | ||
276 | .type v7_cache_fns, #object | 300 | .type v7_cache_fns, #object |
@@ -281,6 +305,8 @@ ENTRY(v7_cache_fns) | |||
281 | .long v7_coherent_kern_range | 305 | .long v7_coherent_kern_range |
282 | .long v7_coherent_user_range | 306 | .long v7_coherent_user_range |
283 | .long v7_flush_kern_dcache_area | 307 | .long v7_flush_kern_dcache_area |
308 | .long v7_dma_map_area | ||
309 | .long v7_dma_unmap_area | ||
284 | .long v7_dma_inv_range | 310 | .long v7_dma_inv_range |
285 | .long v7_dma_clean_range | 311 | .long v7_dma_clean_range |
286 | .long v7_dma_flush_range | 312 | .long v7_dma_flush_range |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 0d68d2c83cda..efa8efa33f5e 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -406,35 +406,31 @@ EXPORT_SYMBOL(dma_free_coherent); | |||
406 | */ | 406 | */ |
407 | static void dma_cache_maint(const void *start, size_t size, int direction) | 407 | static void dma_cache_maint(const void *start, size_t size, int direction) |
408 | { | 408 | { |
409 | void (*inner_op)(const void *, const void *); | ||
410 | void (*outer_op)(unsigned long, unsigned long); | 409 | void (*outer_op)(unsigned long, unsigned long); |
411 | 410 | ||
412 | BUG_ON(!virt_addr_valid(start) || !virt_addr_valid(start + size - 1)); | ||
413 | |||
414 | switch (direction) { | 411 | switch (direction) { |
415 | case DMA_FROM_DEVICE: /* invalidate only */ | 412 | case DMA_FROM_DEVICE: /* invalidate only */ |
416 | inner_op = dmac_inv_range; | ||
417 | outer_op = outer_inv_range; | 413 | outer_op = outer_inv_range; |
418 | break; | 414 | break; |
419 | case DMA_TO_DEVICE: /* writeback only */ | 415 | case DMA_TO_DEVICE: /* writeback only */ |
420 | inner_op = dmac_clean_range; | ||
421 | outer_op = outer_clean_range; | 416 | outer_op = outer_clean_range; |
422 | break; | 417 | break; |
423 | case DMA_BIDIRECTIONAL: /* writeback and invalidate */ | 418 | case DMA_BIDIRECTIONAL: /* writeback and invalidate */ |
424 | inner_op = dmac_flush_range; | ||
425 | outer_op = outer_flush_range; | 419 | outer_op = outer_flush_range; |
426 | break; | 420 | break; |
427 | default: | 421 | default: |
428 | BUG(); | 422 | BUG(); |
429 | } | 423 | } |
430 | 424 | ||
431 | inner_op(start, start + size); | ||
432 | outer_op(__pa(start), __pa(start) + size); | 425 | outer_op(__pa(start), __pa(start) + size); |
433 | } | 426 | } |
434 | 427 | ||
435 | void ___dma_single_cpu_to_dev(const void *kaddr, size_t size, | 428 | void ___dma_single_cpu_to_dev(const void *kaddr, size_t size, |
436 | enum dma_data_direction dir) | 429 | enum dma_data_direction dir) |
437 | { | 430 | { |
431 | BUG_ON(!virt_addr_valid(kaddr) || !virt_addr_valid(kaddr + size - 1)); | ||
432 | |||
433 | dmac_map_area(kaddr, size, dir); | ||
438 | dma_cache_maint(kaddr, size, dir); | 434 | dma_cache_maint(kaddr, size, dir); |
439 | } | 435 | } |
440 | EXPORT_SYMBOL(___dma_single_cpu_to_dev); | 436 | EXPORT_SYMBOL(___dma_single_cpu_to_dev); |
@@ -442,12 +438,15 @@ EXPORT_SYMBOL(___dma_single_cpu_to_dev); | |||
442 | void ___dma_single_dev_to_cpu(const void *kaddr, size_t size, | 438 | void ___dma_single_dev_to_cpu(const void *kaddr, size_t size, |
443 | enum dma_data_direction dir) | 439 | enum dma_data_direction dir) |
444 | { | 440 | { |
445 | /* nothing to do */ | 441 | BUG_ON(!virt_addr_valid(kaddr) || !virt_addr_valid(kaddr + size - 1)); |
442 | |||
443 | dmac_unmap_area(kaddr, size, dir); | ||
446 | } | 444 | } |
447 | EXPORT_SYMBOL(___dma_single_dev_to_cpu); | 445 | EXPORT_SYMBOL(___dma_single_dev_to_cpu); |
448 | 446 | ||
449 | static void dma_cache_maint_page(struct page *page, unsigned long offset, | 447 | static void dma_cache_maint_page(struct page *page, unsigned long offset, |
450 | size_t size, void (*op)(const void *, const void *)) | 448 | size_t size, enum dma_data_direction dir, |
449 | void (*op)(const void *, size_t, int)) | ||
451 | { | 450 | { |
452 | /* | 451 | /* |
453 | * A single sg entry may refer to multiple physically contiguous | 452 | * A single sg entry may refer to multiple physically contiguous |
@@ -471,12 +470,12 @@ static void dma_cache_maint_page(struct page *page, unsigned long offset, | |||
471 | vaddr = kmap_high_get(page); | 470 | vaddr = kmap_high_get(page); |
472 | if (vaddr) { | 471 | if (vaddr) { |
473 | vaddr += offset; | 472 | vaddr += offset; |
474 | op(vaddr, vaddr + len); | 473 | op(vaddr, len, dir); |
475 | kunmap_high(page); | 474 | kunmap_high(page); |
476 | } | 475 | } |
477 | } else { | 476 | } else { |
478 | vaddr = page_address(page) + offset; | 477 | vaddr = page_address(page) + offset; |
479 | op(vaddr, vaddr + len); | 478 | op(vaddr, len, dir); |
480 | } | 479 | } |
481 | offset = 0; | 480 | offset = 0; |
482 | page++; | 481 | page++; |
@@ -488,27 +487,23 @@ void ___dma_page_cpu_to_dev(struct page *page, unsigned long off, | |||
488 | size_t size, enum dma_data_direction dir) | 487 | size_t size, enum dma_data_direction dir) |
489 | { | 488 | { |
490 | unsigned long paddr; | 489 | unsigned long paddr; |
491 | void (*inner_op)(const void *, const void *); | ||
492 | void (*outer_op)(unsigned long, unsigned long); | 490 | void (*outer_op)(unsigned long, unsigned long); |
493 | 491 | ||
494 | switch (direction) { | 492 | switch (direction) { |
495 | case DMA_FROM_DEVICE: /* invalidate only */ | 493 | case DMA_FROM_DEVICE: /* invalidate only */ |
496 | inner_op = dmac_inv_range; | ||
497 | outer_op = outer_inv_range; | 494 | outer_op = outer_inv_range; |
498 | break; | 495 | break; |
499 | case DMA_TO_DEVICE: /* writeback only */ | 496 | case DMA_TO_DEVICE: /* writeback only */ |
500 | inner_op = dmac_clean_range; | ||
501 | outer_op = outer_clean_range; | 497 | outer_op = outer_clean_range; |
502 | break; | 498 | break; |
503 | case DMA_BIDIRECTIONAL: /* writeback and invalidate */ | 499 | case DMA_BIDIRECTIONAL: /* writeback and invalidate */ |
504 | inner_op = dmac_flush_range; | ||
505 | outer_op = outer_flush_range; | 500 | outer_op = outer_flush_range; |
506 | break; | 501 | break; |
507 | default: | 502 | default: |
508 | BUG(); | 503 | BUG(); |
509 | } | 504 | } |
510 | 505 | ||
511 | dma_cache_maint_page(page, off, size, inner_op); | 506 | dma_cache_maint_page(page, off, size, dir, dmac_map_area); |
512 | 507 | ||
513 | paddr = page_to_phys(page) + off; | 508 | paddr = page_to_phys(page) + off; |
514 | outer_op(paddr, paddr + size); | 509 | outer_op(paddr, paddr + size); |
@@ -518,7 +513,7 @@ EXPORT_SYMBOL(___dma_page_cpu_to_dev); | |||
518 | void ___dma_page_dev_to_cpu(struct page *page, unsigned long off, | 513 | void ___dma_page_dev_to_cpu(struct page *page, unsigned long off, |
519 | size_t size, enum dma_data_direction dir) | 514 | size_t size, enum dma_data_direction dir) |
520 | { | 515 | { |
521 | /* nothing to do */ | 516 | dma_cache_maint_page(page, off, size, dir, dmac_unmap_area); |
522 | } | 517 | } |
523 | EXPORT_SYMBOL(___dma_page_dev_to_cpu); | 518 | EXPORT_SYMBOL(___dma_page_dev_to_cpu); |
524 | 519 | ||
diff --git a/arch/arm/mm/proc-arm1020.S b/arch/arm/mm/proc-arm1020.S index 8012e24282b2..c85f5eb42634 100644 --- a/arch/arm/mm/proc-arm1020.S +++ b/arch/arm/mm/proc-arm1020.S | |||
@@ -330,6 +330,30 @@ ENTRY(arm1020_dma_flush_range) | |||
330 | mcr p15, 0, ip, c7, c10, 4 @ drain WB | 330 | mcr p15, 0, ip, c7, c10, 4 @ drain WB |
331 | mov pc, lr | 331 | mov pc, lr |
332 | 332 | ||
333 | /* | ||
334 | * dma_map_area(start, size, dir) | ||
335 | * - start - kernel virtual start address | ||
336 | * - size - size of region | ||
337 | * - dir - DMA direction | ||
338 | */ | ||
339 | ENTRY(arm1020_dma_map_area) | ||
340 | add r1, r1, r0 | ||
341 | cmp r2, #DMA_TO_DEVICE | ||
342 | beq arm1020_dma_clean_range | ||
343 | bcs arm1020_dma_inv_range | ||
344 | b arm1020_dma_flush_range | ||
345 | ENDPROC(arm1020_dma_map_area) | ||
346 | |||
347 | /* | ||
348 | * dma_unmap_area(start, size, dir) | ||
349 | * - start - kernel virtual start address | ||
350 | * - size - size of region | ||
351 | * - dir - DMA direction | ||
352 | */ | ||
353 | ENTRY(arm1020_dma_unmap_area) | ||
354 | mov pc, lr | ||
355 | ENDPROC(arm1020_dma_unmap_area) | ||
356 | |||
333 | ENTRY(arm1020_cache_fns) | 357 | ENTRY(arm1020_cache_fns) |
334 | .long arm1020_flush_kern_cache_all | 358 | .long arm1020_flush_kern_cache_all |
335 | .long arm1020_flush_user_cache_all | 359 | .long arm1020_flush_user_cache_all |
@@ -337,6 +361,8 @@ ENTRY(arm1020_cache_fns) | |||
337 | .long arm1020_coherent_kern_range | 361 | .long arm1020_coherent_kern_range |
338 | .long arm1020_coherent_user_range | 362 | .long arm1020_coherent_user_range |
339 | .long arm1020_flush_kern_dcache_area | 363 | .long arm1020_flush_kern_dcache_area |
364 | .long arm1020_dma_map_area | ||
365 | .long arm1020_dma_unmap_area | ||
340 | .long arm1020_dma_inv_range | 366 | .long arm1020_dma_inv_range |
341 | .long arm1020_dma_clean_range | 367 | .long arm1020_dma_clean_range |
342 | .long arm1020_dma_flush_range | 368 | .long arm1020_dma_flush_range |
diff --git a/arch/arm/mm/proc-arm1020e.S b/arch/arm/mm/proc-arm1020e.S index 41fe25d234f5..5a3cf7620a2c 100644 --- a/arch/arm/mm/proc-arm1020e.S +++ b/arch/arm/mm/proc-arm1020e.S | |||
@@ -316,6 +316,30 @@ ENTRY(arm1020e_dma_flush_range) | |||
316 | mcr p15, 0, ip, c7, c10, 4 @ drain WB | 316 | mcr p15, 0, ip, c7, c10, 4 @ drain WB |
317 | mov pc, lr | 317 | mov pc, lr |
318 | 318 | ||
319 | /* | ||
320 | * dma_map_area(start, size, dir) | ||
321 | * - start - kernel virtual start address | ||
322 | * - size - size of region | ||
323 | * - dir - DMA direction | ||
324 | */ | ||
325 | ENTRY(arm1020e_dma_map_area) | ||
326 | add r1, r1, r0 | ||
327 | cmp r2, #DMA_TO_DEVICE | ||
328 | beq arm1020e_dma_clean_range | ||
329 | bcs arm1020e_dma_inv_range | ||
330 | b arm1020e_dma_flush_range | ||
331 | ENDPROC(arm1020e_dma_map_area) | ||
332 | |||
333 | /* | ||
334 | * dma_unmap_area(start, size, dir) | ||
335 | * - start - kernel virtual start address | ||
336 | * - size - size of region | ||
337 | * - dir - DMA direction | ||
338 | */ | ||
339 | ENTRY(arm1020e_dma_unmap_area) | ||
340 | mov pc, lr | ||
341 | ENDPROC(arm1020e_dma_unmap_area) | ||
342 | |||
319 | ENTRY(arm1020e_cache_fns) | 343 | ENTRY(arm1020e_cache_fns) |
320 | .long arm1020e_flush_kern_cache_all | 344 | .long arm1020e_flush_kern_cache_all |
321 | .long arm1020e_flush_user_cache_all | 345 | .long arm1020e_flush_user_cache_all |
@@ -323,6 +347,8 @@ ENTRY(arm1020e_cache_fns) | |||
323 | .long arm1020e_coherent_kern_range | 347 | .long arm1020e_coherent_kern_range |
324 | .long arm1020e_coherent_user_range | 348 | .long arm1020e_coherent_user_range |
325 | .long arm1020e_flush_kern_dcache_area | 349 | .long arm1020e_flush_kern_dcache_area |
350 | .long arm1020e_dma_map_area | ||
351 | .long arm1020e_dma_unmap_area | ||
326 | .long arm1020e_dma_inv_range | 352 | .long arm1020e_dma_inv_range |
327 | .long arm1020e_dma_clean_range | 353 | .long arm1020e_dma_clean_range |
328 | .long arm1020e_dma_flush_range | 354 | .long arm1020e_dma_flush_range |
diff --git a/arch/arm/mm/proc-arm1022.S b/arch/arm/mm/proc-arm1022.S index 20a5b1b31a70..fec8f5878438 100644 --- a/arch/arm/mm/proc-arm1022.S +++ b/arch/arm/mm/proc-arm1022.S | |||
@@ -305,6 +305,30 @@ ENTRY(arm1022_dma_flush_range) | |||
305 | mcr p15, 0, ip, c7, c10, 4 @ drain WB | 305 | mcr p15, 0, ip, c7, c10, 4 @ drain WB |
306 | mov pc, lr | 306 | mov pc, lr |
307 | 307 | ||
308 | /* | ||
309 | * dma_map_area(start, size, dir) | ||
310 | * - start - kernel virtual start address | ||
311 | * - size - size of region | ||
312 | * - dir - DMA direction | ||
313 | */ | ||
314 | ENTRY(arm1022_dma_map_area) | ||
315 | add r1, r1, r0 | ||
316 | cmp r2, #DMA_TO_DEVICE | ||
317 | beq arm1022_dma_clean_range | ||
318 | bcs arm1022_dma_inv_range | ||
319 | b arm1022_dma_flush_range | ||
320 | ENDPROC(arm1022_dma_map_area) | ||
321 | |||
322 | /* | ||
323 | * dma_unmap_area(start, size, dir) | ||
324 | * - start - kernel virtual start address | ||
325 | * - size - size of region | ||
326 | * - dir - DMA direction | ||
327 | */ | ||
328 | ENTRY(arm1022_dma_unmap_area) | ||
329 | mov pc, lr | ||
330 | ENDPROC(arm1022_dma_unmap_area) | ||
331 | |||
308 | ENTRY(arm1022_cache_fns) | 332 | ENTRY(arm1022_cache_fns) |
309 | .long arm1022_flush_kern_cache_all | 333 | .long arm1022_flush_kern_cache_all |
310 | .long arm1022_flush_user_cache_all | 334 | .long arm1022_flush_user_cache_all |
@@ -312,6 +336,8 @@ ENTRY(arm1022_cache_fns) | |||
312 | .long arm1022_coherent_kern_range | 336 | .long arm1022_coherent_kern_range |
313 | .long arm1022_coherent_user_range | 337 | .long arm1022_coherent_user_range |
314 | .long arm1022_flush_kern_dcache_area | 338 | .long arm1022_flush_kern_dcache_area |
339 | .long arm1022_dma_map_area | ||
340 | .long arm1022_dma_unmap_area | ||
315 | .long arm1022_dma_inv_range | 341 | .long arm1022_dma_inv_range |
316 | .long arm1022_dma_clean_range | 342 | .long arm1022_dma_clean_range |
317 | .long arm1022_dma_flush_range | 343 | .long arm1022_dma_flush_range |
diff --git a/arch/arm/mm/proc-arm1026.S b/arch/arm/mm/proc-arm1026.S index 96aedb10fcc4..9ece6f666497 100644 --- a/arch/arm/mm/proc-arm1026.S +++ b/arch/arm/mm/proc-arm1026.S | |||
@@ -299,6 +299,30 @@ ENTRY(arm1026_dma_flush_range) | |||
299 | mcr p15, 0, ip, c7, c10, 4 @ drain WB | 299 | mcr p15, 0, ip, c7, c10, 4 @ drain WB |
300 | mov pc, lr | 300 | mov pc, lr |
301 | 301 | ||
302 | /* | ||
303 | * dma_map_area(start, size, dir) | ||
304 | * - start - kernel virtual start address | ||
305 | * - size - size of region | ||
306 | * - dir - DMA direction | ||
307 | */ | ||
308 | ENTRY(arm1026_dma_map_area) | ||
309 | add r1, r1, r0 | ||
310 | cmp r2, #DMA_TO_DEVICE | ||
311 | beq arm1026_dma_clean_range | ||
312 | bcs arm1026_dma_inv_range | ||
313 | b arm1026_dma_flush_range | ||
314 | ENDPROC(arm1026_dma_map_area) | ||
315 | |||
316 | /* | ||
317 | * dma_unmap_area(start, size, dir) | ||
318 | * - start - kernel virtual start address | ||
319 | * - size - size of region | ||
320 | * - dir - DMA direction | ||
321 | */ | ||
322 | ENTRY(arm1026_dma_unmap_area) | ||
323 | mov pc, lr | ||
324 | ENDPROC(arm1026_dma_unmap_area) | ||
325 | |||
302 | ENTRY(arm1026_cache_fns) | 326 | ENTRY(arm1026_cache_fns) |
303 | .long arm1026_flush_kern_cache_all | 327 | .long arm1026_flush_kern_cache_all |
304 | .long arm1026_flush_user_cache_all | 328 | .long arm1026_flush_user_cache_all |
@@ -306,6 +330,8 @@ ENTRY(arm1026_cache_fns) | |||
306 | .long arm1026_coherent_kern_range | 330 | .long arm1026_coherent_kern_range |
307 | .long arm1026_coherent_user_range | 331 | .long arm1026_coherent_user_range |
308 | .long arm1026_flush_kern_dcache_area | 332 | .long arm1026_flush_kern_dcache_area |
333 | .long arm1026_dma_map_area | ||
334 | .long arm1026_dma_unmap_area | ||
309 | .long arm1026_dma_inv_range | 335 | .long arm1026_dma_inv_range |
310 | .long arm1026_dma_clean_range | 336 | .long arm1026_dma_clean_range |
311 | .long arm1026_dma_flush_range | 337 | .long arm1026_dma_flush_range |
diff --git a/arch/arm/mm/proc-arm920.S b/arch/arm/mm/proc-arm920.S index 471669e2d7cb..6f6ab2747da6 100644 --- a/arch/arm/mm/proc-arm920.S +++ b/arch/arm/mm/proc-arm920.S | |||
@@ -288,6 +288,30 @@ ENTRY(arm920_dma_flush_range) | |||
288 | mcr p15, 0, r0, c7, c10, 4 @ drain WB | 288 | mcr p15, 0, r0, c7, c10, 4 @ drain WB |
289 | mov pc, lr | 289 | mov pc, lr |
290 | 290 | ||
291 | /* | ||
292 | * dma_map_area(start, size, dir) | ||
293 | * - start - kernel virtual start address | ||
294 | * - size - size of region | ||
295 | * - dir - DMA direction | ||
296 | */ | ||
297 | ENTRY(arm920_dma_map_area) | ||
298 | add r1, r1, r0 | ||
299 | cmp r2, #DMA_TO_DEVICE | ||
300 | beq arm920_dma_clean_range | ||
301 | bcs arm920_dma_inv_range | ||
302 | b arm920_dma_flush_range | ||
303 | ENDPROC(arm920_dma_map_area) | ||
304 | |||
305 | /* | ||
306 | * dma_unmap_area(start, size, dir) | ||
307 | * - start - kernel virtual start address | ||
308 | * - size - size of region | ||
309 | * - dir - DMA direction | ||
310 | */ | ||
311 | ENTRY(arm920_dma_unmap_area) | ||
312 | mov pc, lr | ||
313 | ENDPROC(arm920_dma_unmap_area) | ||
314 | |||
291 | ENTRY(arm920_cache_fns) | 315 | ENTRY(arm920_cache_fns) |
292 | .long arm920_flush_kern_cache_all | 316 | .long arm920_flush_kern_cache_all |
293 | .long arm920_flush_user_cache_all | 317 | .long arm920_flush_user_cache_all |
@@ -295,6 +319,8 @@ ENTRY(arm920_cache_fns) | |||
295 | .long arm920_coherent_kern_range | 319 | .long arm920_coherent_kern_range |
296 | .long arm920_coherent_user_range | 320 | .long arm920_coherent_user_range |
297 | .long arm920_flush_kern_dcache_area | 321 | .long arm920_flush_kern_dcache_area |
322 | .long arm920_dma_map_area | ||
323 | .long arm920_dma_unmap_area | ||
298 | .long arm920_dma_inv_range | 324 | .long arm920_dma_inv_range |
299 | .long arm920_dma_clean_range | 325 | .long arm920_dma_clean_range |
300 | .long arm920_dma_flush_range | 326 | .long arm920_dma_flush_range |
diff --git a/arch/arm/mm/proc-arm922.S b/arch/arm/mm/proc-arm922.S index ee111b00fa41..4e4396b121ca 100644 --- a/arch/arm/mm/proc-arm922.S +++ b/arch/arm/mm/proc-arm922.S | |||
@@ -290,6 +290,30 @@ ENTRY(arm922_dma_flush_range) | |||
290 | mcr p15, 0, r0, c7, c10, 4 @ drain WB | 290 | mcr p15, 0, r0, c7, c10, 4 @ drain WB |
291 | mov pc, lr | 291 | mov pc, lr |
292 | 292 | ||
293 | /* | ||
294 | * dma_map_area(start, size, dir) | ||
295 | * - start - kernel virtual start address | ||
296 | * - size - size of region | ||
297 | * - dir - DMA direction | ||
298 | */ | ||
299 | ENTRY(arm922_dma_map_area) | ||
300 | add r1, r1, r0 | ||
301 | cmp r2, #DMA_TO_DEVICE | ||
302 | beq arm922_dma_clean_range | ||
303 | bcs arm922_dma_inv_range | ||
304 | b arm922_dma_flush_range | ||
305 | ENDPROC(arm922_dma_map_area) | ||
306 | |||
307 | /* | ||
308 | * dma_unmap_area(start, size, dir) | ||
309 | * - start - kernel virtual start address | ||
310 | * - size - size of region | ||
311 | * - dir - DMA direction | ||
312 | */ | ||
313 | ENTRY(arm922_dma_unmap_area) | ||
314 | mov pc, lr | ||
315 | ENDPROC(arm922_dma_unmap_area) | ||
316 | |||
293 | ENTRY(arm922_cache_fns) | 317 | ENTRY(arm922_cache_fns) |
294 | .long arm922_flush_kern_cache_all | 318 | .long arm922_flush_kern_cache_all |
295 | .long arm922_flush_user_cache_all | 319 | .long arm922_flush_user_cache_all |
@@ -297,6 +321,8 @@ ENTRY(arm922_cache_fns) | |||
297 | .long arm922_coherent_kern_range | 321 | .long arm922_coherent_kern_range |
298 | .long arm922_coherent_user_range | 322 | .long arm922_coherent_user_range |
299 | .long arm922_flush_kern_dcache_area | 323 | .long arm922_flush_kern_dcache_area |
324 | .long arm922_dma_map_area | ||
325 | .long arm922_dma_unmap_area | ||
300 | .long arm922_dma_inv_range | 326 | .long arm922_dma_inv_range |
301 | .long arm922_dma_clean_range | 327 | .long arm922_dma_clean_range |
302 | .long arm922_dma_flush_range | 328 | .long arm922_dma_flush_range |
diff --git a/arch/arm/mm/proc-arm925.S b/arch/arm/mm/proc-arm925.S index 8deb5bde58e4..7c01c5d1108c 100644 --- a/arch/arm/mm/proc-arm925.S +++ b/arch/arm/mm/proc-arm925.S | |||
@@ -341,6 +341,30 @@ ENTRY(arm925_dma_flush_range) | |||
341 | mcr p15, 0, r0, c7, c10, 4 @ drain WB | 341 | mcr p15, 0, r0, c7, c10, 4 @ drain WB |
342 | mov pc, lr | 342 | mov pc, lr |
343 | 343 | ||
344 | /* | ||
345 | * dma_map_area(start, size, dir) | ||
346 | * - start - kernel virtual start address | ||
347 | * - size - size of region | ||
348 | * - dir - DMA direction | ||
349 | */ | ||
350 | ENTRY(arm925_dma_map_area) | ||
351 | add r1, r1, r0 | ||
352 | cmp r2, #DMA_TO_DEVICE | ||
353 | beq arm925_dma_clean_range | ||
354 | bcs arm925_dma_inv_range | ||
355 | b arm925_dma_flush_range | ||
356 | ENDPROC(arm925_dma_map_area) | ||
357 | |||
358 | /* | ||
359 | * dma_unmap_area(start, size, dir) | ||
360 | * - start - kernel virtual start address | ||
361 | * - size - size of region | ||
362 | * - dir - DMA direction | ||
363 | */ | ||
364 | ENTRY(arm925_dma_unmap_area) | ||
365 | mov pc, lr | ||
366 | ENDPROC(arm925_dma_unmap_area) | ||
367 | |||
344 | ENTRY(arm925_cache_fns) | 368 | ENTRY(arm925_cache_fns) |
345 | .long arm925_flush_kern_cache_all | 369 | .long arm925_flush_kern_cache_all |
346 | .long arm925_flush_user_cache_all | 370 | .long arm925_flush_user_cache_all |
@@ -348,6 +372,8 @@ ENTRY(arm925_cache_fns) | |||
348 | .long arm925_coherent_kern_range | 372 | .long arm925_coherent_kern_range |
349 | .long arm925_coherent_user_range | 373 | .long arm925_coherent_user_range |
350 | .long arm925_flush_kern_dcache_area | 374 | .long arm925_flush_kern_dcache_area |
375 | .long arm925_dma_map_area | ||
376 | .long arm925_dma_unmap_area | ||
351 | .long arm925_dma_inv_range | 377 | .long arm925_dma_inv_range |
352 | .long arm925_dma_clean_range | 378 | .long arm925_dma_clean_range |
353 | .long arm925_dma_flush_range | 379 | .long arm925_dma_flush_range |
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S index 64db6e275a44..72a01a4b80ab 100644 --- a/arch/arm/mm/proc-arm926.S +++ b/arch/arm/mm/proc-arm926.S | |||
@@ -304,6 +304,30 @@ ENTRY(arm926_dma_flush_range) | |||
304 | mcr p15, 0, r0, c7, c10, 4 @ drain WB | 304 | mcr p15, 0, r0, c7, c10, 4 @ drain WB |
305 | mov pc, lr | 305 | mov pc, lr |
306 | 306 | ||
307 | /* | ||
308 | * dma_map_area(start, size, dir) | ||
309 | * - start - kernel virtual start address | ||
310 | * - size - size of region | ||
311 | * - dir - DMA direction | ||
312 | */ | ||
313 | ENTRY(arm926_dma_map_area) | ||
314 | add r1, r1, r0 | ||
315 | cmp r2, #DMA_TO_DEVICE | ||
316 | beq arm926_dma_clean_range | ||
317 | bcs arm926_dma_inv_range | ||
318 | b arm926_dma_flush_range | ||
319 | ENDPROC(arm926_dma_map_area) | ||
320 | |||
321 | /* | ||
322 | * dma_unmap_area(start, size, dir) | ||
323 | * - start - kernel virtual start address | ||
324 | * - size - size of region | ||
325 | * - dir - DMA direction | ||
326 | */ | ||
327 | ENTRY(arm926_dma_unmap_area) | ||
328 | mov pc, lr | ||
329 | ENDPROC(arm926_dma_unmap_area) | ||
330 | |||
307 | ENTRY(arm926_cache_fns) | 331 | ENTRY(arm926_cache_fns) |
308 | .long arm926_flush_kern_cache_all | 332 | .long arm926_flush_kern_cache_all |
309 | .long arm926_flush_user_cache_all | 333 | .long arm926_flush_user_cache_all |
@@ -311,6 +335,8 @@ ENTRY(arm926_cache_fns) | |||
311 | .long arm926_coherent_kern_range | 335 | .long arm926_coherent_kern_range |
312 | .long arm926_coherent_user_range | 336 | .long arm926_coherent_user_range |
313 | .long arm926_flush_kern_dcache_area | 337 | .long arm926_flush_kern_dcache_area |
338 | .long arm926_dma_map_area | ||
339 | .long arm926_dma_unmap_area | ||
314 | .long arm926_dma_inv_range | 340 | .long arm926_dma_inv_range |
315 | .long arm926_dma_clean_range | 341 | .long arm926_dma_clean_range |
316 | .long arm926_dma_flush_range | 342 | .long arm926_dma_flush_range |
diff --git a/arch/arm/mm/proc-arm940.S b/arch/arm/mm/proc-arm940.S index 8196b9f401fb..6bb58fca7270 100644 --- a/arch/arm/mm/proc-arm940.S +++ b/arch/arm/mm/proc-arm940.S | |||
@@ -233,6 +233,30 @@ ENTRY(arm940_dma_flush_range) | |||
233 | mcr p15, 0, ip, c7, c10, 4 @ drain WB | 233 | mcr p15, 0, ip, c7, c10, 4 @ drain WB |
234 | mov pc, lr | 234 | mov pc, lr |
235 | 235 | ||
236 | /* | ||
237 | * dma_map_area(start, size, dir) | ||
238 | * - start - kernel virtual start address | ||
239 | * - size - size of region | ||
240 | * - dir - DMA direction | ||
241 | */ | ||
242 | ENTRY(arm940_dma_map_area) | ||
243 | add r1, r1, r0 | ||
244 | cmp r2, #DMA_TO_DEVICE | ||
245 | beq arm940_dma_clean_range | ||
246 | bcs arm940_dma_inv_range | ||
247 | b arm940_dma_flush_range | ||
248 | ENDPROC(arm940_dma_map_area) | ||
249 | |||
250 | /* | ||
251 | * dma_unmap_area(start, size, dir) | ||
252 | * - start - kernel virtual start address | ||
253 | * - size - size of region | ||
254 | * - dir - DMA direction | ||
255 | */ | ||
256 | ENTRY(arm940_dma_unmap_area) | ||
257 | mov pc, lr | ||
258 | ENDPROC(arm940_dma_unmap_area) | ||
259 | |||
236 | ENTRY(arm940_cache_fns) | 260 | ENTRY(arm940_cache_fns) |
237 | .long arm940_flush_kern_cache_all | 261 | .long arm940_flush_kern_cache_all |
238 | .long arm940_flush_user_cache_all | 262 | .long arm940_flush_user_cache_all |
@@ -240,6 +264,8 @@ ENTRY(arm940_cache_fns) | |||
240 | .long arm940_coherent_kern_range | 264 | .long arm940_coherent_kern_range |
241 | .long arm940_coherent_user_range | 265 | .long arm940_coherent_user_range |
242 | .long arm940_flush_kern_dcache_area | 266 | .long arm940_flush_kern_dcache_area |
267 | .long arm940_dma_map_area | ||
268 | .long arm940_dma_unmap_area | ||
243 | .long arm940_dma_inv_range | 269 | .long arm940_dma_inv_range |
244 | .long arm940_dma_clean_range | 270 | .long arm940_dma_clean_range |
245 | .long arm940_dma_flush_range | 271 | .long arm940_dma_flush_range |
diff --git a/arch/arm/mm/proc-arm946.S b/arch/arm/mm/proc-arm946.S index 9a951239c86c..ac0f9ba719d7 100644 --- a/arch/arm/mm/proc-arm946.S +++ b/arch/arm/mm/proc-arm946.S | |||
@@ -275,6 +275,30 @@ ENTRY(arm946_dma_flush_range) | |||
275 | mcr p15, 0, r0, c7, c10, 4 @ drain WB | 275 | mcr p15, 0, r0, c7, c10, 4 @ drain WB |
276 | mov pc, lr | 276 | mov pc, lr |
277 | 277 | ||
278 | /* | ||
279 | * dma_map_area(start, size, dir) | ||
280 | * - start - kernel virtual start address | ||
281 | * - size - size of region | ||
282 | * - dir - DMA direction | ||
283 | */ | ||
284 | ENTRY(arm946_dma_map_area) | ||
285 | add r1, r1, r0 | ||
286 | cmp r2, #DMA_TO_DEVICE | ||
287 | beq arm946_dma_clean_range | ||
288 | bcs arm946_dma_inv_range | ||
289 | b arm946_dma_flush_range | ||
290 | ENDPROC(arm946_dma_map_area) | ||
291 | |||
292 | /* | ||
293 | * dma_unmap_area(start, size, dir) | ||
294 | * - start - kernel virtual start address | ||
295 | * - size - size of region | ||
296 | * - dir - DMA direction | ||
297 | */ | ||
298 | ENTRY(arm946_dma_unmap_area) | ||
299 | mov pc, lr | ||
300 | ENDPROC(arm946_dma_unmap_area) | ||
301 | |||
278 | ENTRY(arm946_cache_fns) | 302 | ENTRY(arm946_cache_fns) |
279 | .long arm946_flush_kern_cache_all | 303 | .long arm946_flush_kern_cache_all |
280 | .long arm946_flush_user_cache_all | 304 | .long arm946_flush_user_cache_all |
@@ -282,6 +306,8 @@ ENTRY(arm946_cache_fns) | |||
282 | .long arm946_coherent_kern_range | 306 | .long arm946_coherent_kern_range |
283 | .long arm946_coherent_user_range | 307 | .long arm946_coherent_user_range |
284 | .long arm946_flush_kern_dcache_area | 308 | .long arm946_flush_kern_dcache_area |
309 | .long arm946_dma_map_area | ||
310 | .long arm946_dma_unmap_area | ||
285 | .long arm946_dma_inv_range | 311 | .long arm946_dma_inv_range |
286 | .long arm946_dma_clean_range | 312 | .long arm946_dma_clean_range |
287 | .long arm946_dma_flush_range | 313 | .long arm946_dma_flush_range |
diff --git a/arch/arm/mm/proc-feroceon.S b/arch/arm/mm/proc-feroceon.S index dbc39383e66a..97e1d784f152 100644 --- a/arch/arm/mm/proc-feroceon.S +++ b/arch/arm/mm/proc-feroceon.S | |||
@@ -367,6 +367,44 @@ ENTRY(feroceon_range_dma_flush_range) | |||
367 | mcr p15, 0, r0, c7, c10, 4 @ drain WB | 367 | mcr p15, 0, r0, c7, c10, 4 @ drain WB |
368 | mov pc, lr | 368 | mov pc, lr |
369 | 369 | ||
370 | /* | ||
371 | * dma_map_area(start, size, dir) | ||
372 | * - start - kernel virtual start address | ||
373 | * - size - size of region | ||
374 | * - dir - DMA direction | ||
375 | */ | ||
376 | ENTRY(feroceon_dma_map_area) | ||
377 | add r1, r1, r0 | ||
378 | cmp r2, #DMA_TO_DEVICE | ||
379 | beq feroceon_dma_clean_range | ||
380 | bcs feroceon_dma_inv_range | ||
381 | b feroceon_dma_flush_range | ||
382 | ENDPROC(feroceon_dma_map_area) | ||
383 | |||
384 | /* | ||
385 | * dma_map_area(start, size, dir) | ||
386 | * - start - kernel virtual start address | ||
387 | * - size - size of region | ||
388 | * - dir - DMA direction | ||
389 | */ | ||
390 | ENTRY(feroceon_range_dma_map_area) | ||
391 | add r1, r1, r0 | ||
392 | cmp r2, #DMA_TO_DEVICE | ||
393 | beq feroceon_range_dma_clean_range | ||
394 | bcs feroceon_range_dma_inv_range | ||
395 | b feroceon_range_dma_flush_range | ||
396 | ENDPROC(feroceon_range_dma_map_area) | ||
397 | |||
398 | /* | ||
399 | * dma_unmap_area(start, size, dir) | ||
400 | * - start - kernel virtual start address | ||
401 | * - size - size of region | ||
402 | * - dir - DMA direction | ||
403 | */ | ||
404 | ENTRY(feroceon_dma_unmap_area) | ||
405 | mov pc, lr | ||
406 | ENDPROC(feroceon_dma_unmap_area) | ||
407 | |||
370 | ENTRY(feroceon_cache_fns) | 408 | ENTRY(feroceon_cache_fns) |
371 | .long feroceon_flush_kern_cache_all | 409 | .long feroceon_flush_kern_cache_all |
372 | .long feroceon_flush_user_cache_all | 410 | .long feroceon_flush_user_cache_all |
@@ -374,6 +412,8 @@ ENTRY(feroceon_cache_fns) | |||
374 | .long feroceon_coherent_kern_range | 412 | .long feroceon_coherent_kern_range |
375 | .long feroceon_coherent_user_range | 413 | .long feroceon_coherent_user_range |
376 | .long feroceon_flush_kern_dcache_area | 414 | .long feroceon_flush_kern_dcache_area |
415 | .long feroceon_dma_map_area | ||
416 | .long feroceon_dma_unmap_area | ||
377 | .long feroceon_dma_inv_range | 417 | .long feroceon_dma_inv_range |
378 | .long feroceon_dma_clean_range | 418 | .long feroceon_dma_clean_range |
379 | .long feroceon_dma_flush_range | 419 | .long feroceon_dma_flush_range |
@@ -385,6 +425,8 @@ ENTRY(feroceon_range_cache_fns) | |||
385 | .long feroceon_coherent_kern_range | 425 | .long feroceon_coherent_kern_range |
386 | .long feroceon_coherent_user_range | 426 | .long feroceon_coherent_user_range |
387 | .long feroceon_range_flush_kern_dcache_area | 427 | .long feroceon_range_flush_kern_dcache_area |
428 | .long feroceon_range_dma_map_area | ||
429 | .long feroceon_dma_unmap_area | ||
388 | .long feroceon_range_dma_inv_range | 430 | .long feroceon_range_dma_inv_range |
389 | .long feroceon_range_dma_clean_range | 431 | .long feroceon_range_dma_clean_range |
390 | .long feroceon_range_dma_flush_range | 432 | .long feroceon_range_dma_flush_range |
diff --git a/arch/arm/mm/proc-mohawk.S b/arch/arm/mm/proc-mohawk.S index 9674d36cc97d..55b7fbec6548 100644 --- a/arch/arm/mm/proc-mohawk.S +++ b/arch/arm/mm/proc-mohawk.S | |||
@@ -268,6 +268,30 @@ ENTRY(mohawk_dma_flush_range) | |||
268 | mcr p15, 0, r0, c7, c10, 4 @ drain WB | 268 | mcr p15, 0, r0, c7, c10, 4 @ drain WB |
269 | mov pc, lr | 269 | mov pc, lr |
270 | 270 | ||
271 | /* | ||
272 | * dma_map_area(start, size, dir) | ||
273 | * - start - kernel virtual start address | ||
274 | * - size - size of region | ||
275 | * - dir - DMA direction | ||
276 | */ | ||
277 | ENTRY(mohawk_dma_map_area) | ||
278 | add r1, r1, r0 | ||
279 | cmp r2, #DMA_TO_DEVICE | ||
280 | beq mohawk_dma_clean_range | ||
281 | bcs mohawk_dma_inv_range | ||
282 | b mohawk_dma_flush_range | ||
283 | ENDPROC(mohawk_dma_map_area) | ||
284 | |||
285 | /* | ||
286 | * dma_unmap_area(start, size, dir) | ||
287 | * - start - kernel virtual start address | ||
288 | * - size - size of region | ||
289 | * - dir - DMA direction | ||
290 | */ | ||
291 | ENTRY(mohawk_dma_unmap_area) | ||
292 | mov pc, lr | ||
293 | ENDPROC(mohawk_dma_unmap_area) | ||
294 | |||
271 | ENTRY(mohawk_cache_fns) | 295 | ENTRY(mohawk_cache_fns) |
272 | .long mohawk_flush_kern_cache_all | 296 | .long mohawk_flush_kern_cache_all |
273 | .long mohawk_flush_user_cache_all | 297 | .long mohawk_flush_user_cache_all |
@@ -275,6 +299,8 @@ ENTRY(mohawk_cache_fns) | |||
275 | .long mohawk_coherent_kern_range | 299 | .long mohawk_coherent_kern_range |
276 | .long mohawk_coherent_user_range | 300 | .long mohawk_coherent_user_range |
277 | .long mohawk_flush_kern_dcache_area | 301 | .long mohawk_flush_kern_dcache_area |
302 | .long mohawk_dma_map_area | ||
303 | .long mohawk_dma_unmap_area | ||
278 | .long mohawk_dma_inv_range | 304 | .long mohawk_dma_inv_range |
279 | .long mohawk_dma_clean_range | 305 | .long mohawk_dma_clean_range |
280 | .long mohawk_dma_flush_range | 306 | .long mohawk_dma_flush_range |
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S index 96456f548798..4e4ce889b3e6 100644 --- a/arch/arm/mm/proc-xsc3.S +++ b/arch/arm/mm/proc-xsc3.S | |||
@@ -304,6 +304,30 @@ ENTRY(xsc3_dma_flush_range) | |||
304 | mcr p15, 0, r0, c7, c10, 4 @ data write barrier | 304 | mcr p15, 0, r0, c7, c10, 4 @ data write barrier |
305 | mov pc, lr | 305 | mov pc, lr |
306 | 306 | ||
307 | /* | ||
308 | * dma_map_area(start, size, dir) | ||
309 | * - start - kernel virtual start address | ||
310 | * - size - size of region | ||
311 | * - dir - DMA direction | ||
312 | */ | ||
313 | ENTRY(xsc3_dma_map_area) | ||
314 | add r1, r1, r0 | ||
315 | cmp r2, #DMA_TO_DEVICE | ||
316 | beq xsc3_dma_clean_range | ||
317 | bcs xsc3_dma_inv_range | ||
318 | b xsc3_dma_flush_range | ||
319 | ENDPROC(xsc3_dma_map_area) | ||
320 | |||
321 | /* | ||
322 | * dma_unmap_area(start, size, dir) | ||
323 | * - start - kernel virtual start address | ||
324 | * - size - size of region | ||
325 | * - dir - DMA direction | ||
326 | */ | ||
327 | ENTRY(xsc3_dma_unmap_area) | ||
328 | mov pc, lr | ||
329 | ENDPROC(xsc3_dma_unmap_area) | ||
330 | |||
307 | ENTRY(xsc3_cache_fns) | 331 | ENTRY(xsc3_cache_fns) |
308 | .long xsc3_flush_kern_cache_all | 332 | .long xsc3_flush_kern_cache_all |
309 | .long xsc3_flush_user_cache_all | 333 | .long xsc3_flush_user_cache_all |
@@ -311,6 +335,8 @@ ENTRY(xsc3_cache_fns) | |||
311 | .long xsc3_coherent_kern_range | 335 | .long xsc3_coherent_kern_range |
312 | .long xsc3_coherent_user_range | 336 | .long xsc3_coherent_user_range |
313 | .long xsc3_flush_kern_dcache_area | 337 | .long xsc3_flush_kern_dcache_area |
338 | .long xsc3_dma_map_area | ||
339 | .long xsc3_dma_unmap_area | ||
314 | .long xsc3_dma_inv_range | 340 | .long xsc3_dma_inv_range |
315 | .long xsc3_dma_clean_range | 341 | .long xsc3_dma_clean_range |
316 | .long xsc3_dma_flush_range | 342 | .long xsc3_dma_flush_range |
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S index 93df47265f2d..a7999f94bf27 100644 --- a/arch/arm/mm/proc-xscale.S +++ b/arch/arm/mm/proc-xscale.S | |||
@@ -363,6 +363,43 @@ ENTRY(xscale_dma_flush_range) | |||
363 | mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer | 363 | mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer |
364 | mov pc, lr | 364 | mov pc, lr |
365 | 365 | ||
366 | /* | ||
367 | * dma_map_area(start, size, dir) | ||
368 | * - start - kernel virtual start address | ||
369 | * - size - size of region | ||
370 | * - dir - DMA direction | ||
371 | */ | ||
372 | ENTRY(xscale_dma_map_area) | ||
373 | add r1, r1, r0 | ||
374 | cmp r2, #DMA_TO_DEVICE | ||
375 | beq xscale_dma_clean_range | ||
376 | bcs xscale_dma_inv_range | ||
377 | b xscale_dma_flush_range | ||
378 | ENDPROC(xscale_dma_map_area) | ||
379 | |||
380 | /* | ||
381 | * dma_map_area(start, size, dir) | ||
382 | * - start - kernel virtual start address | ||
383 | * - size - size of region | ||
384 | * - dir - DMA direction | ||
385 | */ | ||
386 | ENTRY(xscale_dma_a0_map_area) | ||
387 | add r1, r1, r0 | ||
388 | teq r2, #DMA_TO_DEVICE | ||
389 | beq xscale_dma_clean_range | ||
390 | b xscale_dma_flush_range | ||
391 | ENDPROC(xscsale_dma_a0_map_area) | ||
392 | |||
393 | /* | ||
394 | * dma_unmap_area(start, size, dir) | ||
395 | * - start - kernel virtual start address | ||
396 | * - size - size of region | ||
397 | * - dir - DMA direction | ||
398 | */ | ||
399 | ENTRY(xscale_dma_unmap_area) | ||
400 | mov pc, lr | ||
401 | ENDPROC(xscale_dma_unmap_area) | ||
402 | |||
366 | ENTRY(xscale_cache_fns) | 403 | ENTRY(xscale_cache_fns) |
367 | .long xscale_flush_kern_cache_all | 404 | .long xscale_flush_kern_cache_all |
368 | .long xscale_flush_user_cache_all | 405 | .long xscale_flush_user_cache_all |
@@ -370,6 +407,8 @@ ENTRY(xscale_cache_fns) | |||
370 | .long xscale_coherent_kern_range | 407 | .long xscale_coherent_kern_range |
371 | .long xscale_coherent_user_range | 408 | .long xscale_coherent_user_range |
372 | .long xscale_flush_kern_dcache_area | 409 | .long xscale_flush_kern_dcache_area |
410 | .long xscale_dma_map_area | ||
411 | .long xscale_dma_unmap_area | ||
373 | .long xscale_dma_inv_range | 412 | .long xscale_dma_inv_range |
374 | .long xscale_dma_clean_range | 413 | .long xscale_dma_clean_range |
375 | .long xscale_dma_flush_range | 414 | .long xscale_dma_flush_range |
@@ -394,6 +433,8 @@ ENTRY(xscale_80200_A0_A1_cache_fns) | |||
394 | .long xscale_coherent_kern_range | 433 | .long xscale_coherent_kern_range |
395 | .long xscale_coherent_user_range | 434 | .long xscale_coherent_user_range |
396 | .long xscale_flush_kern_dcache_area | 435 | .long xscale_flush_kern_dcache_area |
436 | .long xscale_dma_a0_map_area | ||
437 | .long xscale_dma_unmap_area | ||
397 | .long xscale_dma_flush_range | 438 | .long xscale_dma_flush_range |
398 | .long xscale_dma_clean_range | 439 | .long xscale_dma_clean_range |
399 | .long xscale_dma_flush_range | 440 | .long xscale_dma_flush_range |