aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/cache-v6.S
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/arm/mm/cache-v6.S
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'arch/arm/mm/cache-v6.S')
-rw-r--r--arch/arm/mm/cache-v6.S59
1 files changed, 40 insertions, 19 deletions
diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S
index 86aa689ef1aa..73b4a8b66a57 100644
--- a/arch/arm/mm/cache-v6.S
+++ b/arch/arm/mm/cache-v6.S
@@ -21,18 +21,22 @@
21#define D_CACHE_LINE_SIZE 32 21#define D_CACHE_LINE_SIZE 32
22#define BTB_FLUSH_SIZE 8 22#define BTB_FLUSH_SIZE 8
23 23
24#ifdef CONFIG_ARM_ERRATA_411920
25/* 24/*
26 * Invalidate the entire I cache (this code is a workaround for the ARM1136 25 * v6_flush_icache_all()
27 * erratum 411920 - Invalidate Instruction Cache operation can fail. This 26 *
28 * erratum is present in 1136, 1156 and 1176. It does not affect the MPCore. 27 * Flush the whole I-cache.
28 *
29 * ARM1136 erratum 411920 - Invalidate Instruction Cache operation can fail.
30 * This erratum is present in 1136, 1156 and 1176. It does not affect the
31 * MPCore.
29 * 32 *
30 * Registers: 33 * Registers:
31 * r0 - set to 0 34 * r0 - set to 0
32 * r1 - corrupted 35 * r1 - corrupted
33 */ 36 */
34ENTRY(v6_icache_inval_all) 37ENTRY(v6_flush_icache_all)
35 mov r0, #0 38 mov r0, #0
39#ifdef CONFIG_ARM_ERRATA_411920
36 mrs r1, cpsr 40 mrs r1, cpsr
37 cpsid ifa @ disable interrupts 41 cpsid ifa @ disable interrupts
38 mcr p15, 0, r0, c7, c5, 0 @ invalidate entire I-cache 42 mcr p15, 0, r0, c7, c5, 0 @ invalidate entire I-cache
@@ -43,8 +47,11 @@ ENTRY(v6_icache_inval_all)
43 .rept 11 @ ARM Ltd recommends at least 47 .rept 11 @ ARM Ltd recommends at least
44 nop @ 11 NOPs 48 nop @ 11 NOPs
45 .endr 49 .endr
46 mov pc, lr 50#else
51 mcr p15, 0, r0, c7, c5, 0 @ invalidate I-cache
47#endif 52#endif
53 mov pc, lr
54ENDPROC(v6_flush_icache_all)
48 55
49/* 56/*
50 * v6_flush_cache_all() 57 * v6_flush_cache_all()
@@ -60,7 +67,7 @@ ENTRY(v6_flush_kern_cache_all)
60#ifndef CONFIG_ARM_ERRATA_411920 67#ifndef CONFIG_ARM_ERRATA_411920
61 mcr p15, 0, r0, c7, c5, 0 @ I+BTB cache invalidate 68 mcr p15, 0, r0, c7, c5, 0 @ I+BTB cache invalidate
62#else 69#else
63 b v6_icache_inval_all 70 b v6_flush_icache_all
64#endif 71#endif
65#else 72#else
66 mcr p15, 0, r0, c7, c15, 0 @ Cache clean+invalidate 73 mcr p15, 0, r0, c7, c15, 0 @ Cache clean+invalidate
@@ -138,7 +145,7 @@ ENTRY(v6_coherent_user_range)
138#ifndef CONFIG_ARM_ERRATA_411920 145#ifndef CONFIG_ARM_ERRATA_411920
139 mcr p15, 0, r0, c7, c5, 0 @ I+BTB cache invalidate 146 mcr p15, 0, r0, c7, c5, 0 @ I+BTB cache invalidate
140#else 147#else
141 b v6_icache_inval_all 148 b v6_flush_icache_all
142#endif 149#endif
143#else 150#else
144 mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB 151 mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB
@@ -169,6 +176,7 @@ ENDPROC(v6_coherent_kern_range)
169 */ 176 */
170ENTRY(v6_flush_kern_dcache_area) 177ENTRY(v6_flush_kern_dcache_area)
171 add r1, r0, r1 178 add r1, r0, r1
179 bic r0, r0, #D_CACHE_LINE_SIZE - 1
1721: 1801:
173#ifdef HARVARD_CACHE 181#ifdef HARVARD_CACHE
174 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line 182 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line
@@ -196,6 +204,10 @@ ENTRY(v6_flush_kern_dcache_area)
196 * - end - virtual end address of region 204 * - end - virtual end address of region
197 */ 205 */
198v6_dma_inv_range: 206v6_dma_inv_range:
207#ifdef CONFIG_DMA_CACHE_RWFO
208 ldrb r2, [r0] @ read for ownership
209 strb r2, [r0] @ write for ownership
210#endif
199 tst r0, #D_CACHE_LINE_SIZE - 1 211 tst r0, #D_CACHE_LINE_SIZE - 1
200 bic r0, r0, #D_CACHE_LINE_SIZE - 1 212 bic r0, r0, #D_CACHE_LINE_SIZE - 1
201#ifdef HARVARD_CACHE 213#ifdef HARVARD_CACHE
@@ -204,6 +216,10 @@ v6_dma_inv_range:
204 mcrne p15, 0, r0, c7, c11, 1 @ clean unified line 216 mcrne p15, 0, r0, c7, c11, 1 @ clean unified line
205#endif 217#endif
206 tst r1, #D_CACHE_LINE_SIZE - 1 218 tst r1, #D_CACHE_LINE_SIZE - 1
219#ifdef CONFIG_DMA_CACHE_RWFO
220 ldrneb r2, [r1, #-1] @ read for ownership
221 strneb r2, [r1, #-1] @ write for ownership
222#endif
207 bic r1, r1, #D_CACHE_LINE_SIZE - 1 223 bic r1, r1, #D_CACHE_LINE_SIZE - 1
208#ifdef HARVARD_CACHE 224#ifdef HARVARD_CACHE
209 mcrne p15, 0, r1, c7, c14, 1 @ clean & invalidate D line 225 mcrne p15, 0, r1, c7, c14, 1 @ clean & invalidate D line
@@ -211,10 +227,6 @@ v6_dma_inv_range:
211 mcrne p15, 0, r1, c7, c15, 1 @ clean & invalidate unified line 227 mcrne p15, 0, r1, c7, c15, 1 @ clean & invalidate unified line
212#endif 228#endif
2131: 2291:
214#ifdef CONFIG_DMA_CACHE_RWFO
215 ldr r2, [r0] @ read for ownership
216 str r2, [r0] @ write for ownership
217#endif
218#ifdef HARVARD_CACHE 230#ifdef HARVARD_CACHE
219 mcr p15, 0, r0, c7, c6, 1 @ invalidate D line 231 mcr p15, 0, r0, c7, c6, 1 @ invalidate D line
220#else 232#else
@@ -222,6 +234,10 @@ v6_dma_inv_range:
222#endif 234#endif
223 add r0, r0, #D_CACHE_LINE_SIZE 235 add r0, r0, #D_CACHE_LINE_SIZE
224 cmp r0, r1 236 cmp r0, r1
237#ifdef CONFIG_DMA_CACHE_RWFO
238 ldrlo r2, [r0] @ read for ownership
239 strlo r2, [r0] @ write for ownership
240#endif
225 blo 1b 241 blo 1b
226 mov r0, #0 242 mov r0, #0
227 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 243 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
@@ -256,12 +272,12 @@ v6_dma_clean_range:
256 * - end - virtual end address of region 272 * - end - virtual end address of region
257 */ 273 */
258ENTRY(v6_dma_flush_range) 274ENTRY(v6_dma_flush_range)
259 bic r0, r0, #D_CACHE_LINE_SIZE - 1
2601:
261#ifdef CONFIG_DMA_CACHE_RWFO 275#ifdef CONFIG_DMA_CACHE_RWFO
262 ldr r2, [r0] @ read for ownership 276 ldrb r2, [r0] @ read for ownership
263 str r2, [r0] @ write for ownership 277 strb r2, [r0] @ write for ownership
264#endif 278#endif
279 bic r0, r0, #D_CACHE_LINE_SIZE - 1
2801:
265#ifdef HARVARD_CACHE 281#ifdef HARVARD_CACHE
266 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line 282 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line
267#else 283#else
@@ -269,6 +285,10 @@ ENTRY(v6_dma_flush_range)
269#endif 285#endif
270 add r0, r0, #D_CACHE_LINE_SIZE 286 add r0, r0, #D_CACHE_LINE_SIZE
271 cmp r0, r1 287 cmp r0, r1
288#ifdef CONFIG_DMA_CACHE_RWFO
289 ldrlob r2, [r0] @ read for ownership
290 strlob r2, [r0] @ write for ownership
291#endif
272 blo 1b 292 blo 1b
273 mov r0, #0 293 mov r0, #0
274 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 294 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
@@ -312,6 +332,7 @@ ENDPROC(v6_dma_unmap_area)
312 332
313 .type v6_cache_fns, #object 333 .type v6_cache_fns, #object
314ENTRY(v6_cache_fns) 334ENTRY(v6_cache_fns)
335 .long v6_flush_icache_all
315 .long v6_flush_kern_cache_all 336 .long v6_flush_kern_cache_all
316 .long v6_flush_user_cache_all 337 .long v6_flush_user_cache_all
317 .long v6_flush_user_cache_range 338 .long v6_flush_user_cache_range