1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29#include <asm/reg.h>
30#include <asm/page.h>
31#include <asm/cputable.h>
32#include <asm/mmu.h>
33#include <asm/ppc_asm.h>
34#include <asm/asm-offsets.h>
35#include <asm/processor.h>
36#include <asm/bug.h>
37
38
39
40
41
42
43_GLOBAL(__tlbil_va)
44
45
46
47 mfmsr r5
48 mfspr r6,SPRN_PID
49 wrteei 0
50 mtspr SPRN_PID,r4
51 tlbsx. r3, 0, r3
52 mtspr SPRN_PID,r6
53 wrtee r5
54 bne 1f
55 sync
56
57
58
59 tlbwe r3, r3, TLB_TAG
60 isync
611: blr
62
63
64
65
66
67
68
69
70
71
72
73
74
75_GLOBAL(__tlbil_va)
76 mfspr r5,SPRN_MMUCR
77 mfmsr r10
78
79
80
81
82
83 rlwimi r5,r4,0,16,31
84
85
86
87
88
89
90
91
92
93 wrteei 0
94 mtspr SPRN_MMUCR,r5
95 tlbsx. r6,0,r3
96 bne 10f
97 sync
98BEGIN_MMU_FTR_SECTION
99 b 2f
100END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_47x)
101
102
103
104
105 tlbwe r6,r6,PPC44x_TLB_PAGEID
106 isync
10710: wrtee r10
108 blr
1092:
110#ifdef CONFIG_PPC_47x
111 oris r7,r6,0x8000
112 clrrwi r4,r3,12
113 ori r4,r4,PPC47x_TLBE_SIZE
114 tlbwe r4,r7,0
115 isync
116 wrtee r10
117 blr
118#else
1191: trap
120 EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,0;
121#endif
122
123_GLOBAL(_tlbil_all)
124_GLOBAL(_tlbil_pid)
125BEGIN_MMU_FTR_SECTION
126 b 2f
127END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_47x)
128 li r3,0
129 sync
130
131
132 lis r4,tlb_44x_hwater@ha
133 lwz r5,tlb_44x_hwater@l(r4)
134
1351: tlbwe r3,r3,PPC44x_TLB_PAGEID
136 addi r3,r3,1
137 cmpw 0,r3,r5
138 ble 1b
139
140 isync
141 blr
1422:
143#ifdef CONFIG_PPC_47x
144
145
146
147 mfmsr r11
148 wrteei 0
149 li r3,-1
150 lis r10,tlb_47x_boltmap@h
151 ori r10,r10,tlb_47x_boltmap@l
152 lis r7,0x8000
153
154 b 9f
155
1561: li r9,4
157 li r4,0
158 li r6,0
159 andi. r0,r8,1
160 mtctr r9
161 bne- 3f
162
1632:
164 or r5,r3,r4
165 rlwimi r5,r5,16,8,15
166 tlbre r6,r5,0
1673: addis r4,r4,0x2000
168 andi. r0,r6,PPC47x_TLB0_VALID
169 beq 4f
170 rlwimi r7,r5,0,1,2
171 rlwinm r6,r6,0,21,19
172 tlbwe r6,r7,0
1734: bdnz 2b
174 srwi r8,r8,1
1759: cmpwi cr1,r3,255
176 addi r3,r3,1
177 beq cr1,1f
178 andi. r0,r3,0x1f
179 bne 1b
180 lwz r8,0(r10)
181 addi r10,r10,4
182 b 1b
1831: isync
184 wrtee r11
185#else
1861: trap
187 EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,0;
188#endif
189 blr
190
191#ifdef CONFIG_PPC_47x
192
193
194
195
196# define ICBT(CT,RA,RB) \
197 .long 0x7c00002c | ((CT) << 21) | ((RA) << 16) | ((RB) << 11)
198
199
200
201
202
203
204_GLOBAL(_tlbivax_bcast)
205 mfspr r5,SPRN_MMUCR
206 mfmsr r10
207 rlwimi r5,r4,0,16,31
208 wrteei 0
209 mtspr SPRN_MMUCR,r5
210 isync
211
212 .long 0x7c000624 | (r3 << 11)
213 isync
214 eieio
215 tlbsync
216BEGIN_FTR_SECTION
217 b 1f
218END_FTR_SECTION_IFSET(CPU_FTR_476_DD2)
219 sync
220 wrtee r10
221 blr
222
223
224
225
2261: mflr r9
227 bl 2f
2282: mflr r6
229 li r7,32
230 ICBT(0,r6,r7)
231 add r6,r6,r7
232 ICBT(0,r6,r7)
233 add r6,r6,r7
234 ICBT(0,r6,r7)
235 sync
236 nop
237 nop
238 nop
239 nop
240 nop
241 nop
242 nop
243 nop
244 mtlr r9
245 wrtee r10
246 blr
247#endif
248
249
250
251
252
253
254
255
256
257
258
259
260_GLOBAL(_tlbil_all)
261BEGIN_MMU_FTR_SECTION
262 li r3,(MMUCSR0_TLBFI)@l
263 mtspr SPRN_MMUCSR0, r3
2641:
265 mfspr r3,SPRN_MMUCSR0
266 andi. r3,r3,MMUCSR0_TLBFI@l
267 bne 1b
268MMU_FTR_SECTION_ELSE
269 PPC_TLBILX_ALL(0,R0)
270ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_USE_TLBILX)
271 msync
272 isync
273 blr
274
275_GLOBAL(_tlbil_pid)
276BEGIN_MMU_FTR_SECTION
277 slwi r3,r3,16
278 mfmsr r10
279 wrteei 0
280 mfspr r4,SPRN_MAS6
281 mtspr SPRN_MAS6,r3
282 PPC_TLBILX_PID(0,R0)
283 mtspr SPRN_MAS6,r4
284 wrtee r10
285MMU_FTR_SECTION_ELSE
286 li r3,(MMUCSR0_TLBFI)@l
287 mtspr SPRN_MMUCSR0, r3
2881:
289 mfspr r3,SPRN_MMUCSR0
290 andi. r3,r3,MMUCSR0_TLBFI@l
291 bne 1b
292ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_USE_TLBILX)
293 msync
294 isync
295 blr
296
297
298
299
300
301_GLOBAL(__tlbil_va)
302 mfmsr r10
303 wrteei 0
304 slwi r4,r4,16
305 ori r4,r4,(MAS6_ISIZE(BOOK3E_PAGESZ_4K))@l
306 mtspr SPRN_MAS6,r4
307BEGIN_MMU_FTR_SECTION
308 tlbsx 0,r3
309 mfspr r4,SPRN_MAS1
310 andis. r3,r4,MAS1_VALID@h
311 beq 1f
312 rlwinm r4,r4,0,1,31
313 mtspr SPRN_MAS1,r4
314 tlbwe
315MMU_FTR_SECTION_ELSE
316 PPC_TLBILX_VA(0,R3)
317ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_USE_TLBILX)
318 msync
319 isync
3201: wrtee r10
321 blr
322
323
324
325
326
327
328
329_GLOBAL(_tlbil_pid)
330 slwi r4,r3,MAS6_SPID_SHIFT
331 mfmsr r10
332 wrteei 0
333 mtspr SPRN_MAS6,r4
334 PPC_TLBILX_PID(0,R0)
335 wrtee r10
336 msync
337 isync
338 blr
339
340_GLOBAL(_tlbil_pid_noind)
341 slwi r4,r3,MAS6_SPID_SHIFT
342 mfmsr r10
343 ori r4,r4,MAS6_SIND
344 wrteei 0
345 mtspr SPRN_MAS6,r4
346 PPC_TLBILX_PID(0,R0)
347 wrtee r10
348 msync
349 isync
350 blr
351
352_GLOBAL(_tlbil_all)
353 PPC_TLBILX_ALL(0,R0)
354 msync
355 isync
356 blr
357
358_GLOBAL(_tlbil_va)
359 mfmsr r10
360 wrteei 0
361 cmpwi cr0,r6,0
362 slwi r4,r4,MAS6_SPID_SHIFT
363 rlwimi r4,r5,MAS6_ISIZE_SHIFT,MAS6_ISIZE_MASK
364 beq 1f
365 rlwimi r4,r6,MAS6_SIND_SHIFT,MAS6_SIND
3661: mtspr SPRN_MAS6,r4
367 PPC_TLBILX_VA(0,R3)
368 msync
369 isync
370 wrtee r10
371 blr
372
373_GLOBAL(_tlbivax_bcast)
374 mfmsr r10
375 wrteei 0
376 cmpwi cr0,r6,0
377 slwi r4,r4,MAS6_SPID_SHIFT
378 rlwimi r4,r5,MAS6_ISIZE_SHIFT,MAS6_ISIZE_MASK
379 beq 1f
380 rlwimi r4,r6,MAS6_SIND_SHIFT,MAS6_SIND
3811: mtspr SPRN_MAS6,r4
382 PPC_TLBIVAX(0,R3)
383 eieio
384 tlbsync
385 sync
386 wrtee r10
387 blr
388
389_GLOBAL(set_context)
390#ifdef CONFIG_BDI_SWITCH
391
392
393
394 lis r5, abatron_pteptrs@h
395 ori r5, r5, abatron_pteptrs@l
396 stw r4, 0x4(r5)
397#endif
398 mtspr SPRN_PID,r3
399 isync
400 blr
401#else
402
403#endif
404
405
406
407
408
409
410
411_GLOBAL(loadcam_entry)
412 LOAD_REG_ADDR(r4, TLBCAM)
413 mulli r5,r3,TLBCAM_SIZE
414 add r3,r5,r4
415 lwz r4,TLBCAM_MAS0(r3)
416 mtspr SPRN_MAS0,r4
417 lwz r4,TLBCAM_MAS1(r3)
418 mtspr SPRN_MAS1,r4
419 PPC_LL r4,TLBCAM_MAS2(r3)
420 mtspr SPRN_MAS2,r4
421 lwz r4,TLBCAM_MAS3(r3)
422 mtspr SPRN_MAS3,r4
423BEGIN_MMU_FTR_SECTION
424 lwz r4,TLBCAM_MAS7(r3)
425 mtspr SPRN_MAS7,r4
426END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS)
427 isync
428 tlbwe
429 isync
430 blr
431#endif
432