1
2
3
4
5
6
7
8
9
10
11#include <linux/sys.h>
12#include <linux/linkage.h>
13#include <asm/smp.h>
14#include <asm/page.h>
15#include <asm/cache.h>
16#include <asm/irqflags.h>
17#include <asm/cacheflush.h>
18#include "cache.inc"
19
20#define mn10300_local_dcache_inv_range_intr_interval \
21 +((1 << MN10300_DCACHE_INV_RANGE_INTR_LOG2_INTERVAL) - 1)
22
23
24
25#endif
26
27 .am33_2
28
29 .globl mn10300_local_icache_inv_page
30 .globl mn10300_local_icache_inv_range
31 .globl mn10300_local_icache_inv_range2
32
33mn10300_local_icache_inv_page = mn10300_local_icache_inv
34mn10300_local_icache_inv_range = mn10300_local_icache_inv
35mn10300_local_icache_inv_range2 = mn10300_local_icache_inv
36
37#ifndef CONFIG_SMP
38 .globl mn10300_icache_inv
39 .globl mn10300_icache_inv_page
40 .globl mn10300_icache_inv_range
41 .globl mn10300_icache_inv_range2
42 .globl mn10300_dcache_inv
43 .globl mn10300_dcache_inv_page
44 .globl mn10300_dcache_inv_range
45 .globl mn10300_dcache_inv_range2
46
47mn10300_icache_inv = mn10300_local_icache_inv
48mn10300_icache_inv_page = mn10300_local_icache_inv_page
49mn10300_icache_inv_range = mn10300_local_icache_inv_range
50mn10300_icache_inv_range2 = mn10300_local_icache_inv_range2
51mn10300_dcache_inv = mn10300_local_dcache_inv
52mn10300_dcache_inv_page = mn10300_local_dcache_inv_page
53mn10300_dcache_inv_range = mn10300_local_dcache_inv_range
54mn10300_dcache_inv_range2 = mn10300_local_dcache_inv_range2
55
56#endif
57
58
59
60
61
62
63
64 ALIGN
65 .globl mn10300_local_icache_inv
66 .type mn10300_local_icache_inv,@function
67mn10300_local_icache_inv:
68 mov CHCTR,a0
69
70 movhu (a0),d0
71 btst CHCTR_ICEN,d0
72 beq mn10300_local_icache_inv_end
73
74 invalidate_icache 1
75
76mn10300_local_icache_inv_end:
77 ret [],0
78 .size mn10300_local_icache_inv,.-mn10300_local_icache_inv
79
80
81
82
83
84
85
86 ALIGN
87 .globl mn10300_local_dcache_inv
88 .type mn10300_local_dcache_inv,@function
89mn10300_local_dcache_inv:
90 mov CHCTR,a0
91
92 movhu (a0),d0
93 btst CHCTR_DCEN,d0
94 beq mn10300_local_dcache_inv_end
95
96 invalidate_dcache 1
97
98mn10300_local_dcache_inv_end:
99 ret [],0
100 .size mn10300_local_dcache_inv,.-mn10300_local_dcache_inv
101
102
103
104
105
106
107
108
109
110 ALIGN
111 .globl mn10300_local_dcache_inv_page
112 .globl mn10300_local_dcache_inv_range
113 .globl mn10300_local_dcache_inv_range2
114 .type mn10300_local_dcache_inv_page,@function
115 .type mn10300_local_dcache_inv_range,@function
116 .type mn10300_local_dcache_inv_range2,@function
117mn10300_local_dcache_inv_page:
118 and ~(PAGE_SIZE-1),d0
119 mov PAGE_SIZE,d1
120mn10300_local_dcache_inv_range2:
121 add d0,d1
122mn10300_local_dcache_inv_range:
123
124
125
126#ifdef CONFIG_MN10300_CACHE_WBACK
127 btst ~L1_CACHE_TAG_MASK,d0
128 bne 1f
129 btst ~L1_CACHE_TAG_MASK,d1
130 beq 2f
1311:
132 bra mn10300_local_dcache_flush_inv_range
1332:
134#endif
135
136 movm [d2,d3,a2],(sp)
137
138 mov CHCTR,a2
139 movhu (a2),d2
140 btst CHCTR_DCEN,d2
141 beq mn10300_local_dcache_inv_range_end
142
143#ifndef CONFIG_MN10300_CACHE_WBACK
144 and L1_CACHE_TAG_MASK,d0
145
146 add L1_CACHE_BYTES,d1
147 and L1_CACHE_TAG_MASK,d1
148#endif
149 mov d0,a1
150
151 clr d2
152
153
154
155
156 mov DCACHE_TAG(0,0),a0
157 mov a1,d0
158 and L1_CACHE_TAG_ENTRY,d0
159 add d0,a0
160
161
162 sub a1,d1
163 lsr L1_CACHE_SHIFT,d1
164
165
166 and ~(L1_CACHE_DISPARITY-1),a1
167
168mn10300_local_dcache_inv_range_outer_loop:
169 LOCAL_CLI_SAVE(d3)
170
171
172 movhu (a2),d0
173 and ~CHCTR_DCEN,d0
174 movhu d0,(a2)
175
176
177 setlb
178 movhu (a2),d0
179 btst CHCTR_DCBUSY,d0
180 lne
181
182mn10300_local_dcache_inv_range_loop:
183
184
185 mov (L1_CACHE_WAYDISP*0,a0),d0
186 btst L1_CACHE_TAG_VALID,d0
187 beq mn10300_local_dcache_inv_range_skip_0
188
189
190 xor a1,d0
191 lsr 12,d0
192 bne mn10300_local_dcache_inv_range_skip_0
193
194 mov d2,(L1_CACHE_WAYDISP*0,a0)
195
196mn10300_local_dcache_inv_range_skip_0:
197
198
199 mov (L1_CACHE_WAYDISP*1,a0),d0
200 btst L1_CACHE_TAG_VALID,d0
201 beq mn10300_local_dcache_inv_range_skip_1
202
203
204 xor a1,d0
205 lsr 12,d0
206 bne mn10300_local_dcache_inv_range_skip_1
207
208 mov d2,(L1_CACHE_WAYDISP*1,a0)
209
210mn10300_local_dcache_inv_range_skip_1:
211
212
213 mov (L1_CACHE_WAYDISP*2,a0),d0
214 btst L1_CACHE_TAG_VALID,d0
215 beq mn10300_local_dcache_inv_range_skip_2
216
217
218 xor a1,d0
219 lsr 12,d0
220 bne mn10300_local_dcache_inv_range_skip_2
221
222 mov d2,(L1_CACHE_WAYDISP*2,a0)
223
224mn10300_local_dcache_inv_range_skip_2:
225
226
227 mov (L1_CACHE_WAYDISP*3,a0),d0
228 btst L1_CACHE_TAG_VALID,d0
229 beq mn10300_local_dcache_inv_range_skip_3
230
231
232 xor a1,d0
233 lsr 12,d0
234 bne mn10300_local_dcache_inv_range_skip_3
235
236 mov d2,(L1_CACHE_WAYDISP*3,a0)
237
238mn10300_local_dcache_inv_range_skip_3:
239
240
241
242
243
244 add L1_CACHE_BYTES,a0
245 add L1_CACHE_BYTES,a1
246 and ~L1_CACHE_WAYDISP,a0
247 add -1,d1
248 btst mn10300_local_dcache_inv_range_intr_interval,d1
249 bne mn10300_local_dcache_inv_range_loop
250
251
252 setlb
253 movhu (a2),d0
254 btst CHCTR_DCBUSY,d0
255 lne
256
257
258 or CHCTR_DCEN,d0
259 movhu d0,(a2)
260 movhu (a2),d0
261
262
263
264
265
266 LOCAL_IRQ_RESTORE(d3)
267
268
269 add 0,d1
270 bne mn10300_local_dcache_inv_range_outer_loop
271
272mn10300_local_dcache_inv_range_end:
273 ret [d2,d3,a2],12
274 .size mn10300_local_dcache_inv_page,.-mn10300_local_dcache_inv_page
275 .size mn10300_local_dcache_inv_range,.-mn10300_local_dcache_inv_range
276 .size mn10300_local_dcache_inv_range2,.-mn10300_local_dcache_inv_range2
277