sparc32: implement proper LEON support in head_32 (before highmem)
PATCH 2/5 sparc32: implement proper LEON support in head_32 (before highmem)
Use PSR to check if the PCU is LEON and jump to LEON specific code in this case.
Added a few constants to psr.h to increase readability.
--- arch/sparc/include/asm/psr.h | 5 ++++ arch/sparc/kernel/head_32.S | 54 +++++++++++++++++++++++++++++++++++------- 2 files changed, 50 insertions(+), 9 deletions(-)
arch/sparc/include/asm/psr.h +5 -0
@@ -35,6 +35,11 @@#define PSR_VERS 0x0f000000/* cpu-version field */ #define PSR_IMPL 0xf0000000/* cpu-implementation field */ +#define PSR_IMPL_SHIFT 28 + +#define PSR_IMPL_TEXAS 0x4 +#define PSR_IMPL_LEON 0xf +#ifdef __KERNEL__#ifndef __ASSEMBLY__
arch/sparc/kernel/head_32.S +45 -9
88 lines not on this page · raw message
Signature · 1 line
1.6.0.6
David Miller
maintainerFrom: Sam Ravnborg <[email protected]>
Date: Tue, 22 May 2012 22:10:40 +0200
Quoted 1 line
Use PSR to check if the PCU is LEON and jump to
^^^
"CPU" :-)
arch/sparc/kernel/head_32.S halt_sun4_or_sun4c: · line 217
Quoted 6 lines
arch/sparc/kernel/head_32.S +6
-0+ /* Check if this is a LEON CPU */ + rd %psr, %g3 + set PSR_IMPL, %g2 + and %g2, %g3, %g3 + srl %g3, PSR_IMPL_SHIFT, %g3 + cmp %g3, PSR_IMPL_LEON
I would code this like:
rd %psr, %g3 srl %g3, PSR_IMPL_SHIFT, %g3 and %g3, 0xf /* PST_IMPL_WHATEVER_MASK */, %g3 cmp %g3, PSR_IMPL_LEON
arch/sparc/kernel/head_32.S halt_sun4_or_sun4c: · line 230
Quoted 4 lines
arch/sparc/kernel/head_32.S +3
-0+ /* Check for a viking (TI) module. */ + cmp %g3, PSR_IMPL_TEXAS + bne srmmu_not_viking nop
PSR_IMPL_TI is probably a better name fo this macro.
arch/sparc/kernel/head_32.S srmmu_nviking: · line 334
Quoted 10 lines
arch/sparc/kernel/head_32.S +6
-0@@ -313,6 +326,29 @@ srmmu_nviking: nop ! wheee.... +leon_remap: + /* Sanity-check, is MMU enabled */ + lda [%g0] ASI_LEON_MMUREGS, %g1 + andcc %g1, 1, %g0 + be halt_sun4_or_sun4c + nop
Checking that the MMU is disabled is correct, but branching to the sun4c-not-supported error message is probably not. :-)
Otherwise looks OK.
Quoted 34 lines · David Miller
From: Sam Ravnborg <[email protected]>
Date: Tue, 22 May 2012 22:10:40 +0200Quoted 1 line
Use PSR to check if the PCU is LEON and jump to
^^^"CPU" :-)
arch/sparc/kernel/head_32.S halt_sun4_or_sun4c: · line 217
Quoted 6 lines
arch/sparc/kernel/head_32.S +6
-0+ /* Check if this is a LEON CPU */ + rd %psr, %g3 + set PSR_IMPL, %g2 + and %g2, %g3, %g3 + srl %g3, PSR_IMPL_SHIFT, %g3 + cmp %g3, PSR_IMPL_LEONI would code this like:
rd %psr, %g3 srl %g3, PSR_IMPL_SHIFT, %g3 and %g3, 0xf /* PST_IMPL_WHATEVER_MASK */, %g3 cmp %g3, PSR_IMPL_LEONarch/sparc/kernel/head_32.S halt_sun4_or_sun4c: · line 230
Quoted 4 lines
arch/sparc/kernel/head_32.S +3
-0+ /* Check for a viking (TI) module. */ + cmp %g3, PSR_IMPL_TEXAS + bne srmmu_not_viking nop
PSR_IMPL_TIis probably a better name fo this macro.Quoted 4 lines
arch/sparc/kernel/head_32.S +0
-0@@ -313,6 +326,29 @@ srmmu_nviking: nop ! wheee....
Quoted 9 lines
arch/sparc/kernel/head_32.S srmmu_nviking: · line 334
Quoted 6 lines
arch/sparc/kernel/head_32.S +6
-0+leon_remap: + /* Sanity-check, is MMU enabled */ + lda [%g0] ASI_LEON_MMUREGS, %g1 + andcc %g1, 1, %g0 + be halt_sun4_or_sun4c + nopChecking that the MMU is disabled is correct, but branching to the sun4c-not-supported error message is probably not. :-)
I did not like it either - but this was a straight copy from the old code with proper replacement of the MMUREGS. I actually considered to just drop it.
I will rephrase the text in a separate commit.
Quoted 3 lines
Otherwise looks OK.
Thanks for the quick feedback!
I will address it all and get back. Will take a couple of days as weather is too good to do serious coding ;-)
Sam