aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/head_8xx.S
diff options
context:
space:
mode:
authorLEROY Christophe <christophe.leroy@c-s.fr>2014-09-19 04:36:09 -0400
committerScott Wood <scottwood@freescale.com>2014-11-07 19:10:42 -0500
commitd3e40262e7d05236bf4c2c4fdf007589ba8af97a (patch)
tree6a8175e21eed90263752a8d5375f76a7037ff44f /arch/powerpc/kernel/head_8xx.S
parent959d6173b5cccceff47cc2d25feeaac2f96df0e0 (diff)
powerpc/8xx: Better readibility of ERRATA CPU6 handling
This patch hiddes that SPR address needed for CPU6 ERRATA handling in the macro. Then we don't have to worry about this address directly in the code. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'arch/powerpc/kernel/head_8xx.S')
-rw-r--r--arch/powerpc/kernel/head_8xx.S29
1 files changed, 16 insertions, 13 deletions
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index 84b0b9778065..6e9124177f19 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -33,12 +33,19 @@
33 33
34/* Macro to make the code more readable. */ 34/* Macro to make the code more readable. */
35#ifdef CONFIG_8xx_CPU6 35#ifdef CONFIG_8xx_CPU6
36#define DO_8xx_CPU6(val, reg) \ 36#define SPRN_MI_TWC_ADDR 0x2b80
37 li reg, val; \ 37#define SPRN_MI_RPN_ADDR 0x2d80
38 stw reg, 12(r0); \ 38#define SPRN_MD_TWC_ADDR 0x3b80
39 lwz reg, 12(r0); 39#define SPRN_MD_RPN_ADDR 0x3d80
40
41#define MTSPR_CPU6(spr, reg, treg) \
42 li treg, spr##_ADDR; \
43 stw treg, 12(r0); \
44 lwz treg, 12(r0); \
45 mtspr spr, reg
40#else 46#else
41#define DO_8xx_CPU6(val, reg) 47#define MTSPR_CPU6(spr, reg, treg) \
48 mtspr spr, reg
42#endif 49#endif
43 50
44/* 51/*
@@ -336,8 +343,7 @@ InstructionTLBMiss:
336 * for this "segment." 343 * for this "segment."
337 */ 344 */
338 ori r11,r11,1 /* Set valid bit */ 345 ori r11,r11,1 /* Set valid bit */
339 DO_8xx_CPU6(0x2b80, r3) 346 MTSPR_CPU6(SPRN_MI_TWC, r11, r3) /* Set segment attributes */
340 mtspr SPRN_MI_TWC, r11 /* Set segment attributes */
341 mfspr r11, SPRN_SRR0 /* Get effective address of fault */ 347 mfspr r11, SPRN_SRR0 /* Get effective address of fault */
342 /* Extract level 2 index */ 348 /* Extract level 2 index */
343 rlwinm r11, r11, 32 - (PAGE_SHIFT - 2), 32 - PAGE_SHIFT, 29 349 rlwinm r11, r11, 32 - (PAGE_SHIFT - 2), 32 - PAGE_SHIFT, 29
@@ -356,8 +362,7 @@ InstructionTLBMiss:
356 */ 362 */
357 li r11, RPN_PATTERN 363 li r11, RPN_PATTERN
358 rlwimi r10, r11, 0, 0x07f8 /* Set 24-27, clear 21-23,28 */ 364 rlwimi r10, r11, 0, 0x07f8 /* Set 24-27, clear 21-23,28 */
359 DO_8xx_CPU6(0x2d80, r3) 365 MTSPR_CPU6(SPRN_MI_RPN, r10, r3) /* Update TLB entry */
360 mtspr SPRN_MI_RPN, r10 /* Update TLB entry */
361 366
362 /* Restore registers */ 367 /* Restore registers */
363#ifdef CONFIG_8xx_CPU6 368#ifdef CONFIG_8xx_CPU6
@@ -426,8 +431,7 @@ DataStoreTLBMiss:
426 * It is bit 25 in the Linux PTE and bit 30 in the TWC 431 * It is bit 25 in the Linux PTE and bit 30 in the TWC
427 */ 432 */
428 rlwimi r11, r10, 32-5, 30, 30 433 rlwimi r11, r10, 32-5, 30, 30
429 DO_8xx_CPU6(0x3b80, r3) 434 MTSPR_CPU6(SPRN_MD_TWC, r11, r3)
430 mtspr SPRN_MD_TWC, r11
431 435
432 /* Both _PAGE_ACCESSED and _PAGE_PRESENT has to be set. 436 /* Both _PAGE_ACCESSED and _PAGE_PRESENT has to be set.
433 * We also need to know if the insn is a load/store, so: 437 * We also need to know if the insn is a load/store, so:
@@ -460,8 +464,7 @@ DataStoreTLBMiss:
460 */ 464 */
4612: li r11, RPN_PATTERN 4652: li r11, RPN_PATTERN
462 rlwimi r10, r11, 0, 24, 28 /* Set 24-27, clear 28 */ 466 rlwimi r10, r11, 0, 24, 28 /* Set 24-27, clear 28 */
463 DO_8xx_CPU6(0x3d80, r3) 467 MTSPR_CPU6(SPRN_MD_RPN, r10, r3) /* Update TLB entry */
464 mtspr SPRN_MD_RPN, r10 /* Update TLB entry */
465 468
466 /* Restore registers */ 469 /* Restore registers */
467#ifdef CONFIG_8xx_CPU6 470#ifdef CONFIG_8xx_CPU6