diff options
Diffstat (limited to 'arch/arm/mm/cache-v7.S')
-rw-r--r-- | arch/arm/mm/cache-v7.S | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S index 3b172275262e..cd956647c21a 100644 --- a/arch/arm/mm/cache-v7.S +++ b/arch/arm/mm/cache-v7.S | |||
@@ -33,6 +33,24 @@ ENTRY(v7_flush_icache_all) | |||
33 | mov pc, lr | 33 | mov pc, lr |
34 | ENDPROC(v7_flush_icache_all) | 34 | ENDPROC(v7_flush_icache_all) |
35 | 35 | ||
36 | /* | ||
37 | * v7_flush_dcache_louis() | ||
38 | * | ||
39 | * Flush the D-cache up to the Level of Unification Inner Shareable | ||
40 | * | ||
41 | * Corrupted registers: r0-r7, r9-r11 (r6 only in Thumb mode) | ||
42 | */ | ||
43 | |||
44 | ENTRY(v7_flush_dcache_louis) | ||
45 | dmb @ ensure ordering with previous memory accesses | ||
46 | mrc p15, 1, r0, c0, c0, 1 @ read clidr, r0 = clidr | ||
47 | ands r3, r0, #0xe00000 @ extract LoUIS from clidr | ||
48 | mov r3, r3, lsr #20 @ r3 = LoUIS * 2 | ||
49 | moveq pc, lr @ return if level == 0 | ||
50 | mov r10, #0 @ r10 (starting level) = 0 | ||
51 | b flush_levels @ start flushing cache levels | ||
52 | ENDPROC(v7_flush_dcache_louis) | ||
53 | |||
36 | /* | 54 | /* |
37 | * v7_flush_dcache_all() | 55 | * v7_flush_dcache_all() |
38 | * | 56 | * |
@@ -49,7 +67,7 @@ ENTRY(v7_flush_dcache_all) | |||
49 | mov r3, r3, lsr #23 @ left align loc bit field | 67 | mov r3, r3, lsr #23 @ left align loc bit field |
50 | beq finished @ if loc is 0, then no need to clean | 68 | beq finished @ if loc is 0, then no need to clean |
51 | mov r10, #0 @ start clean at cache level 0 | 69 | mov r10, #0 @ start clean at cache level 0 |
52 | loop1: | 70 | flush_levels: |
53 | add r2, r10, r10, lsr #1 @ work out 3x current cache level | 71 | add r2, r10, r10, lsr #1 @ work out 3x current cache level |
54 | mov r1, r0, lsr r2 @ extract cache type bits from clidr | 72 | mov r1, r0, lsr r2 @ extract cache type bits from clidr |
55 | and r1, r1, #7 @ mask of the bits for current cache only | 73 | and r1, r1, #7 @ mask of the bits for current cache only |
@@ -71,9 +89,9 @@ loop1: | |||
71 | clz r5, r4 @ find bit position of way size increment | 89 | clz r5, r4 @ find bit position of way size increment |
72 | ldr r7, =0x7fff | 90 | ldr r7, =0x7fff |
73 | ands r7, r7, r1, lsr #13 @ extract max number of the index size | 91 | ands r7, r7, r1, lsr #13 @ extract max number of the index size |
74 | loop2: | 92 | loop1: |
75 | mov r9, r4 @ create working copy of max way size | 93 | mov r9, r4 @ create working copy of max way size |
76 | loop3: | 94 | loop2: |
77 | ARM( orr r11, r10, r9, lsl r5 ) @ factor way and cache number into r11 | 95 | ARM( orr r11, r10, r9, lsl r5 ) @ factor way and cache number into r11 |
78 | THUMB( lsl r6, r9, r5 ) | 96 | THUMB( lsl r6, r9, r5 ) |
79 | THUMB( orr r11, r10, r6 ) @ factor way and cache number into r11 | 97 | THUMB( orr r11, r10, r6 ) @ factor way and cache number into r11 |
@@ -82,13 +100,13 @@ loop3: | |||
82 | THUMB( orr r11, r11, r6 ) @ factor index number into r11 | 100 | THUMB( orr r11, r11, r6 ) @ factor index number into r11 |
83 | mcr p15, 0, r11, c7, c14, 2 @ clean & invalidate by set/way | 101 | mcr p15, 0, r11, c7, c14, 2 @ clean & invalidate by set/way |
84 | subs r9, r9, #1 @ decrement the way | 102 | subs r9, r9, #1 @ decrement the way |
85 | bge loop3 | ||
86 | subs r7, r7, #1 @ decrement the index | ||
87 | bge loop2 | 103 | bge loop2 |
104 | subs r7, r7, #1 @ decrement the index | ||
105 | bge loop1 | ||
88 | skip: | 106 | skip: |
89 | add r10, r10, #2 @ increment cache number | 107 | add r10, r10, #2 @ increment cache number |
90 | cmp r3, r10 | 108 | cmp r3, r10 |
91 | bgt loop1 | 109 | bgt flush_levels |
92 | finished: | 110 | finished: |
93 | mov r10, #0 @ swith back to cache level 0 | 111 | mov r10, #0 @ swith back to cache level 0 |
94 | mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr | 112 | mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr |
@@ -120,6 +138,24 @@ ENTRY(v7_flush_kern_cache_all) | |||
120 | mov pc, lr | 138 | mov pc, lr |
121 | ENDPROC(v7_flush_kern_cache_all) | 139 | ENDPROC(v7_flush_kern_cache_all) |
122 | 140 | ||
141 | /* | ||
142 | * v7_flush_kern_cache_louis(void) | ||
143 | * | ||
144 | * Flush the data cache up to Level of Unification Inner Shareable. | ||
145 | * Invalidate the I-cache to the point of unification. | ||
146 | */ | ||
147 | ENTRY(v7_flush_kern_cache_louis) | ||
148 | ARM( stmfd sp!, {r4-r5, r7, r9-r11, lr} ) | ||
149 | THUMB( stmfd sp!, {r4-r7, r9-r11, lr} ) | ||
150 | bl v7_flush_dcache_louis | ||
151 | mov r0, #0 | ||
152 | ALT_SMP(mcr p15, 0, r0, c7, c1, 0) @ invalidate I-cache inner shareable | ||
153 | ALT_UP(mcr p15, 0, r0, c7, c5, 0) @ I+BTB cache invalidate | ||
154 | ARM( ldmfd sp!, {r4-r5, r7, r9-r11, lr} ) | ||
155 | THUMB( ldmfd sp!, {r4-r7, r9-r11, lr} ) | ||
156 | mov pc, lr | ||
157 | ENDPROC(v7_flush_kern_cache_louis) | ||
158 | |||
123 | /* | 159 | /* |
124 | * v7_flush_cache_all() | 160 | * v7_flush_cache_all() |
125 | * | 161 | * |