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
197
198_GLOBAL(_tlbivax_bcast)
199 mfspr r5,SPRN_MMUCR
200 mfmsr r10
201 rlwimi r5,r4,0,16,31
202 wrteei 0
203 mtspr SPRN_MMUCR,r5
204 isync
205 PPC_TLBIVAX(0, R3)
206 isync
207 eieio
208 tlbsync
209BEGIN_FTR_SECTION
210 b 1f
211END_FTR_SECTION_IFSET(CPU_FTR_476_DD2)
212 sync
213 wrtee r10
214 blr
215
216
217
218
2191: mflr r9
220 bl 2f
2212: mflr r6
222 li r7,32
223 PPC_ICBT(0,R6,R7)
224 add r6,r6,r7
225 PPC_ICBT(0,R6,R7)
226 add r6,r6,r7
227 PPC_ICBT(0,R6,R7)
228 sync
229 nop
230 nop
231 nop
232 nop
233 nop
234 nop
235 nop
236 nop
237 mtlr r9
238 wrtee r10
239 blr
240#endif
241
242
243
244
245
246
247
248
249
250
251
252
253_GLOBAL(_tlbil_all)
254BEGIN_MMU_FTR_SECTION
255 li r3,(MMUCSR0_TLBFI)@l
256 mtspr SPRN_MMUCSR0, r3
2571:
258 mfspr r3,SPRN_MMUCSR0
259 andi. r3,r3,MMUCSR0_TLBFI@l
260 bne 1b
261MMU_FTR_SECTION_ELSE
262 PPC_TLBILX_ALL(0,R0)
263ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_USE_TLBILX)
264 msync
265 isync
266 blr
267
268_GLOBAL(_tlbil_pid)
269BEGIN_MMU_FTR_SECTION
270 slwi r3,r3,16
271 mfmsr r10
272 wrteei 0
273 mfspr r4,SPRN_MAS6
274 mtspr SPRN_MAS6,r3
275 PPC_TLBILX_PID(0,R0)
276 mtspr SPRN_MAS6,r4
277 wrtee r10
278MMU_FTR_SECTION_ELSE
279 li r3,(MMUCSR0_TLBFI)@l
280 mtspr SPRN_MMUCSR0, r3
2811:
282 mfspr r3,SPRN_MMUCSR0
283 andi. r3,r3,MMUCSR0_TLBFI@l
284 bne 1b
285ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_USE_TLBILX)
286 msync
287 isync
288 blr
289
290
291
292
293
294_GLOBAL(__tlbil_va)
295 mfmsr r10
296 wrteei 0
297 slwi r4,r4,16
298 ori r4,r4,(MAS6_ISIZE(BOOK3E_PAGESZ_4K))@l
299 mtspr SPRN_MAS6,r4
300BEGIN_MMU_FTR_SECTION
301 tlbsx 0,r3
302 mfspr r4,SPRN_MAS1
303 andis. r3,r4,MAS1_VALID@h
304 beq 1f
305 rlwinm r4,r4,0,1,31
306 mtspr SPRN_MAS1,r4
307 tlbwe
308MMU_FTR_SECTION_ELSE
309 PPC_TLBILX_VA(0,R3)
310ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_USE_TLBILX)
311 msync
312 isync
3131: wrtee r10
314 blr
315
316
317
318
319
320
321
322_GLOBAL(_tlbil_pid)
323 slwi r4,r3,MAS6_SPID_SHIFT
324 mfmsr r10
325 wrteei 0
326 mtspr SPRN_MAS6,r4
327 PPC_TLBILX_PID(0,R0)
328 wrtee r10
329 msync
330 isync
331 blr
332
333_GLOBAL(_tlbil_pid_noind)
334 slwi r4,r3,MAS6_SPID_SHIFT
335 mfmsr r10
336 ori r4,r4,MAS6_SIND
337 wrteei 0
338 mtspr SPRN_MAS6,r4
339 PPC_TLBILX_PID(0,R0)
340 wrtee r10
341 msync
342 isync
343 blr
344
345_GLOBAL(_tlbil_all)
346 PPC_TLBILX_ALL(0,R0)
347 msync
348 isync
349 blr
350
351_GLOBAL(_tlbil_va)
352 mfmsr r10
353 wrteei 0
354 cmpwi cr0,r6,0
355 slwi r4,r4,MAS6_SPID_SHIFT
356 rlwimi r4,r5,MAS6_ISIZE_SHIFT,MAS6_ISIZE_MASK
357 beq 1f
358 rlwimi r4,r6,MAS6_SIND_SHIFT,MAS6_SIND
3591: mtspr SPRN_MAS6,r4
360 PPC_TLBILX_VA(0,R3)
361 msync
362 isync
363 wrtee r10
364 blr
365
366_GLOBAL(_tlbivax_bcast)
367 mfmsr r10
368 wrteei 0
369 cmpwi cr0,r6,0
370 slwi r4,r4,MAS6_SPID_SHIFT
371 rlwimi r4,r5,MAS6_ISIZE_SHIFT,MAS6_ISIZE_MASK
372 beq 1f
373 rlwimi r4,r6,MAS6_SIND_SHIFT,MAS6_SIND
3741: mtspr SPRN_MAS6,r4
375 PPC_TLBIVAX(0,R3)
376 eieio
377 tlbsync
378 sync
379 wrtee r10
380 blr
381
382_GLOBAL(set_context)
383#ifdef CONFIG_BDI_SWITCH
384
385
386
387 lis r5, abatron_pteptrs@h
388 ori r5, r5, abatron_pteptrs@l
389 stw r4, 0x4(r5)
390#endif
391 mtspr SPRN_PID,r3
392 isync
393 blr
394#else
395
396#endif
397
398
399
400
401
402
403
404
405_GLOBAL(loadcam_entry)
406 mflr r5
407 LOAD_REG_ADDR_PIC(r4, TLBCAM)
408 mtlr r5
409 mulli r5,r3,TLBCAM_SIZE
410 add r3,r5,r4
411 lwz r4,TLBCAM_MAS0(r3)
412 mtspr SPRN_MAS0,r4
413 lwz r4,TLBCAM_MAS1(r3)
414 mtspr SPRN_MAS1,r4
415 PPC_LL r4,TLBCAM_MAS2(r3)
416 mtspr SPRN_MAS2,r4
417 lwz r4,TLBCAM_MAS3(r3)
418 mtspr SPRN_MAS3,r4
419BEGIN_MMU_FTR_SECTION
420 lwz r4,TLBCAM_MAS7(r3)
421 mtspr SPRN_MAS7,r4
422END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS)
423 isync
424 tlbwe
425 isync
426 blr
427
428
429
430
431
432
433
434
435
436
437_GLOBAL(loadcam_multi)
438 mflr r8
439
440
441
442
443
444 bl 1f
4451: mflr r6
446 tlbsx 0,r8
447 mfspr r6,SPRN_MAS1
448 ori r6,r6,MAS1_TS
449 mtspr SPRN_MAS1,r6
450 mfspr r6,SPRN_MAS0
451 rlwimi r6,r5,MAS0_ESEL_SHIFT,MAS0_ESEL_MASK
452 mr r7,r5
453 mtspr SPRN_MAS0,r6
454 isync
455 tlbwe
456 isync
457
458
459 mfmsr r6
460 ori r6,r6,MSR_IS|MSR_DS
461 mtmsr r6
462 isync
463
464 mr r9,r3
465 add r10,r3,r4
4662: bl loadcam_entry
467 addi r9,r9,1
468 cmpw r9,r10
469 mr r3,r9
470 blt 2b
471
472
473 mfmsr r6
474 rlwinm. r6,r6,0,~(MSR_IS|MSR_DS)
475 mtmsr r6
476 isync
477
478 li r6,0
479 mtspr SPRN_MAS1,r6
480 rlwinm r6,r7,MAS0_ESEL_SHIFT,MAS0_ESEL_MASK
481 oris r6,r6,MAS0_TLBSEL(1)@h
482 mtspr SPRN_MAS0,r6
483 isync
484 tlbwe
485 isync
486
487 mtlr r8
488 blr
489#endif
490