Commit 83c17ba3 authored by LEROY Christophe's avatar LEROY Christophe Committed by Scott Wood

powerpc/8xx: Use DAR to save r3 for CPU6 ERRATA

As we are not using anymore DAR to save registers, it is now available for
saving the r3 register used for CPU6 ERRATA handling. Therefore we can
remove the major hack which was to use memory location 0 to save r3.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarScott Wood <scottwood@freescale.com>
parent b0168eb9
...@@ -83,13 +83,6 @@ _ENTRY(_start); ...@@ -83,13 +83,6 @@ _ENTRY(_start);
* 8M 1:1. I also mapped an additional I/O space 1:1 so we can get to * 8M 1:1. I also mapped an additional I/O space 1:1 so we can get to
* the "internal" processor registers before MMU_init is called. * the "internal" processor registers before MMU_init is called.
* *
* The TLB code currently contains a major hack. Since I use the condition
* code register, I have to save and restore it. I am out of registers, so
* I just store it in memory location 0 (the TLB handlers are not reentrant).
* To avoid making any decisions, I need to use the "segment" valid bit
* in the first level table, but that would require many changes to the
* Linux page directory/table functions that I don't want to do right now.
*
* -- Dan * -- Dan
*/ */
.globl __start .globl __start
...@@ -306,7 +299,7 @@ SystemCall: ...@@ -306,7 +299,7 @@ SystemCall:
*/ */
InstructionTLBMiss: InstructionTLBMiss:
#ifdef CONFIG_8xx_CPU6 #ifdef CONFIG_8xx_CPU6
stw r3, 8(r0) mtspr SPRN_DAR, r3
#endif #endif
EXCEPTION_PROLOG_0 EXCEPTION_PROLOG_0
mtspr SPRN_SPRG_SCRATCH2, r10 mtspr SPRN_SPRG_SCRATCH2, r10
...@@ -351,7 +344,10 @@ InstructionTLBMiss: ...@@ -351,7 +344,10 @@ InstructionTLBMiss:
#ifdef CONFIG_SWAP #ifdef CONFIG_SWAP
andi. r11, r10, _PAGE_ACCESSED | _PAGE_PRESENT andi. r11, r10, _PAGE_ACCESSED | _PAGE_PRESENT
cmpwi cr0, r11, _PAGE_ACCESSED | _PAGE_PRESENT cmpwi cr0, r11, _PAGE_ACCESSED | _PAGE_PRESENT
li r11, RPN_PATTERN
bne- cr0, 2f bne- cr0, 2f
#else
li r11, RPN_PATTERN
#endif #endif
/* The Linux PTE won't go exactly into the MMU TLB. /* The Linux PTE won't go exactly into the MMU TLB.
* Software indicator bits 21 and 28 must be clear. * Software indicator bits 21 and 28 must be clear.
...@@ -359,28 +355,29 @@ InstructionTLBMiss: ...@@ -359,28 +355,29 @@ InstructionTLBMiss:
* set. All other Linux PTE bits control the behavior * set. All other Linux PTE bits control the behavior
* of the MMU. * of the MMU.
*/ */
li r11, RPN_PATTERN
rlwimi r10, r11, 0, 0x07f8 /* Set 24-27, clear 21-23,28 */ rlwimi r10, r11, 0, 0x07f8 /* Set 24-27, clear 21-23,28 */
MTSPR_CPU6(SPRN_MI_RPN, r10, r3) /* Update TLB entry */ MTSPR_CPU6(SPRN_MI_RPN, r10, r3) /* Update TLB entry */
/* Restore registers */ /* Restore registers */
#ifdef CONFIG_8xx_CPU6 #ifdef CONFIG_8xx_CPU6
lwz r3, 8(r0) mfspr r3, SPRN_DAR
mtspr SPRN_DAR, r11 /* Tag DAR */
#endif #endif
mfspr r10, SPRN_SPRG_SCRATCH2 mfspr r10, SPRN_SPRG_SCRATCH2
EXCEPTION_EPILOG_0 EXCEPTION_EPILOG_0
rfi rfi
2: 2:
mfspr r11, SPRN_SRR1 mfspr r10, SPRN_SRR1
/* clear all error bits as TLB Miss /* clear all error bits as TLB Miss
* sets a few unconditionally * sets a few unconditionally
*/ */
rlwinm r11, r11, 0, 0xffff rlwinm r10, r10, 0, 0xffff
mtspr SPRN_SRR1, r11 mtspr SPRN_SRR1, r10
/* Restore registers */ /* Restore registers */
#ifdef CONFIG_8xx_CPU6 #ifdef CONFIG_8xx_CPU6
lwz r3, 8(r0) mfspr r3, SPRN_DAR
mtspr SPRN_DAR, r11 /* Tag DAR */
#endif #endif
mfspr r10, SPRN_SPRG_SCRATCH2 mfspr r10, SPRN_SPRG_SCRATCH2
b InstructionTLBError1 b InstructionTLBError1
...@@ -388,7 +385,7 @@ InstructionTLBMiss: ...@@ -388,7 +385,7 @@ InstructionTLBMiss:
. = 0x1200 . = 0x1200
DataStoreTLBMiss: DataStoreTLBMiss:
#ifdef CONFIG_8xx_CPU6 #ifdef CONFIG_8xx_CPU6
stw r3, 8(r0) mtspr SPRN_DAR, r3
#endif #endif
EXCEPTION_PROLOG_0 EXCEPTION_PROLOG_0
mtspr SPRN_SPRG_SCRATCH2, r10 mtspr SPRN_SPRG_SCRATCH2, r10
...@@ -459,7 +456,7 @@ DataStoreTLBMiss: ...@@ -459,7 +456,7 @@ DataStoreTLBMiss:
/* Restore registers */ /* Restore registers */
#ifdef CONFIG_8xx_CPU6 #ifdef CONFIG_8xx_CPU6
lwz r3, 8(r0) mfspr r3, SPRN_DAR
#endif #endif
mtspr SPRN_DAR, r11 /* Tag DAR */ mtspr SPRN_DAR, r11 /* Tag DAR */
mfspr r10, SPRN_SPRG_SCRATCH2 mfspr r10, SPRN_SPRG_SCRATCH2
...@@ -531,7 +528,7 @@ DARFixed:/* Return from dcbx instruction bug workaround */ ...@@ -531,7 +528,7 @@ DARFixed:/* Return from dcbx instruction bug workaround */
#define NO_SELF_MODIFYING_CODE #define NO_SELF_MODIFYING_CODE
FixupDAR:/* Entry point for dcbx workaround. */ FixupDAR:/* Entry point for dcbx workaround. */
#ifdef CONFIG_8xx_CPU6 #ifdef CONFIG_8xx_CPU6
stw r3, 8(r0) mtspr SPRN_DAR, r3
#endif #endif
mtspr SPRN_SPRG_SCRATCH2, r10 mtspr SPRN_SPRG_SCRATCH2, r10
/* fetch instruction from memory. */ /* fetch instruction from memory. */
...@@ -550,7 +547,7 @@ FixupDAR:/* Entry point for dcbx workaround. */ ...@@ -550,7 +547,7 @@ FixupDAR:/* Entry point for dcbx workaround. */
rlwinm r11, r11, 32 - (PAGE_SHIFT - 2), 32 - PAGE_SHIFT, 29 rlwinm r11, r11, 32 - (PAGE_SHIFT - 2), 32 - PAGE_SHIFT, 29
lwzx r11, r10, r11 /* Get the pte */ lwzx r11, r10, r11 /* Get the pte */
#ifdef CONFIG_8xx_CPU6 #ifdef CONFIG_8xx_CPU6
lwz r3, 8(r0) /* restore r3 from memory */ mfspr r3, SPRN_DAR
#endif #endif
/* concat physical page address(r11) and page offset(r10) */ /* concat physical page address(r11) and page offset(r10) */
mfspr r10, SPRN_SRR0 mfspr r10, SPRN_SRR0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment