1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#include <linux/linkage.h>
17#include <linux/init.h>
18#include <asm/assembler.h>
19#include <asm/memory.h>
20#include <asm/page.h>
21
22#include "proc-macros.S"
23
24
25
26
27#define CACHE_DLINESIZE 16
28
29
30
31
32#ifdef CONFIG_ARCH_GEMINI
33#define CACHE_DSIZE 8192
34#else
35#define CACHE_DSIZE 16384
36#endif
37
38
39#define CACHE_DLIMIT (CACHE_DSIZE * 2)
40
41
42
43
44
45
46ENTRY(fa_flush_icache_all)
47 mov r0,
48 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
49 ret lr
50ENDPROC(fa_flush_icache_all)
51
52
53
54
55
56
57
58ENTRY(fa_flush_user_cache_all)
59
60
61
62
63
64
65ENTRY(fa_flush_kern_cache_all)
66 mov ip,
67 mov r2,
68__flush_whole_cache:
69 mcr p15, 0, ip, c7, c14, 0 @ clean/invalidate D cache
70 tst r2,
71 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
72 mcrne p15, 0, ip, c7, c5, 6 @ invalidate BTB
73 mcrne p15, 0, ip, c7, c10, 4 @ drain write buffer
74 mcrne p15, 0, ip, c7, c5, 4 @ prefetch flush
75 ret lr
76
77
78
79
80
81
82
83
84
85
86
87ENTRY(fa_flush_user_cache_range)
88 mov ip,
89 sub r3, r1, r0 @ calculate total size
90 cmp r3,
91 bhs __flush_whole_cache @ flush whole D cache
92
931: tst r2,
94 mcrne p15, 0, r0, c7, c5, 1 @ invalidate I line
95 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D entry
96 add r0, r0,
97 cmp r0, r1
98 blo 1b
99 tst r2,
100 mcrne p15, 0, ip, c7, c5, 6 @ invalidate BTB
101 mcrne p15, 0, ip, c7, c10, 4 @ data write barrier
102 mcrne p15, 0, ip, c7, c5, 4 @ prefetch flush
103 ret lr
104
105
106
107
108
109
110
111
112
113
114
115ENTRY(fa_coherent_kern_range)
116
117
118
119
120
121
122
123
124
125
126
127
128ENTRY(fa_coherent_user_range)
129 bic r0, r0,
1301: mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D entry
131 mcr p15, 0, r0, c7, c5, 1 @ invalidate I entry
132 add r0, r0,
133 cmp r0, r1
134 blo 1b
135 mov r0,
136 mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB
137 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
138 mcr p15, 0, r0, c7, c5, 4 @ prefetch flush
139 ret lr
140
141
142
143
144
145
146
147
148
149
150ENTRY(fa_flush_kern_dcache_area)
151 add r1, r0, r1
1521: mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line
153 add r0, r0,
154 cmp r0, r1
155 blo 1b
156 mov r0,
157 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
158 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
159 ret lr
160
161
162
163
164
165
166
167
168
169
170
171
172fa_dma_inv_range:
173 tst r0,
174 bic r0, r0,
175 mcrne p15, 0, r0, c7, c14, 1 @ clean & invalidate D entry
176 tst r1,
177 bic r1, r1,
178 mcrne p15, 0, r1, c7, c14, 1 @ clean & invalidate D entry
1791: mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
180 add r0, r0,
181 cmp r0, r1
182 blo 1b
183 mov r0,
184 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
185 ret lr
186
187
188
189
190
191
192
193
194
195fa_dma_clean_range:
196 bic r0, r0,
1971: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
198 add r0, r0,
199 cmp r0, r1
200 blo 1b
201 mov r0,
202 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
203 ret lr
204
205
206
207
208
209
210ENTRY(fa_dma_flush_range)
211 bic r0, r0,
2121: mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D entry
213 add r0, r0,
214 cmp r0, r1
215 blo 1b
216 mov r0,
217 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
218 ret lr
219
220
221
222
223
224
225
226ENTRY(fa_dma_map_area)
227 add r1, r1, r0
228 cmp r2,
229 beq fa_dma_clean_range
230 bcs fa_dma_inv_range
231 b fa_dma_flush_range
232ENDPROC(fa_dma_map_area)
233
234
235
236
237
238
239
240ENTRY(fa_dma_unmap_area)
241 ret lr
242ENDPROC(fa_dma_unmap_area)
243
244 .globl fa_flush_kern_cache_louis
245 .equ fa_flush_kern_cache_louis, fa_flush_kern_cache_all
246
247 __INITDATA
248
249 @ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S)
250 define_cache_functions fa
251