diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2012-05-25 17:20:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-28 02:52:45 -0400 |
commit | d87d8c11f347e743f0223d16c8ec57ef7e0274b2 (patch) | |
tree | 0de090f63821b0acbcc1d197b48485ff8ed919e5 | |
parent | b08b5c9c9b35c938e8a94d9232e05a7f69a1dba5 (diff) |
sparc32: handle leon in cpu.c
A few hardcoded constant were replaced by symbolic
versions to improve readability
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Hellstrom <daniel@gaisler.com>
Cc: Konrad Eisele <konrad@gaisler.com>
-rw-r--r-- | arch/sparc/include/asm/psr.h | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/cpu.c | 18 |
2 files changed, 11 insertions, 9 deletions
diff --git a/arch/sparc/include/asm/psr.h b/arch/sparc/include/asm/psr.h index c02c735d4ebe..cee7ed9c927d 100644 --- a/arch/sparc/include/asm/psr.h +++ b/arch/sparc/include/asm/psr.h | |||
@@ -35,7 +35,9 @@ | |||
35 | #define PSR_VERS 0x0f000000 /* cpu-version field */ | 35 | #define PSR_VERS 0x0f000000 /* cpu-version field */ |
36 | #define PSR_IMPL 0xf0000000 /* cpu-implementation field */ | 36 | #define PSR_IMPL 0xf0000000 /* cpu-implementation field */ |
37 | 37 | ||
38 | #define PSR_VERS_SHIFT 24 | ||
38 | #define PSR_IMPL_SHIFT 28 | 39 | #define PSR_IMPL_SHIFT 28 |
40 | #define PSR_VERS_SHIFTED_MASK 0xf | ||
39 | #define PSR_IMPL_SHIFTED_MASK 0xf | 41 | #define PSR_IMPL_SHIFTED_MASK 0xf |
40 | 42 | ||
41 | #define PSR_IMPL_TI 0x4 | 43 | #define PSR_IMPL_TI 0x4 |
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c index 2d1819641769..a6c94a2bf9d4 100644 --- a/arch/sparc/kernel/cpu.c +++ b/arch/sparc/kernel/cpu.c | |||
@@ -121,7 +121,7 @@ static const struct manufacturer_info __initconst manufacturer_info[] = { | |||
121 | FPU(-1, NULL) | 121 | FPU(-1, NULL) |
122 | } | 122 | } |
123 | },{ | 123 | },{ |
124 | 4, | 124 | PSR_IMPL_TI, |
125 | .cpu_info = { | 125 | .cpu_info = { |
126 | CPU(0, "Texas Instruments, Inc. - SuperSparc-(II)"), | 126 | CPU(0, "Texas Instruments, Inc. - SuperSparc-(II)"), |
127 | /* SparcClassic -- borned STP1010TAB-50*/ | 127 | /* SparcClassic -- borned STP1010TAB-50*/ |
@@ -191,7 +191,7 @@ static const struct manufacturer_info __initconst manufacturer_info[] = { | |||
191 | FPU(-1, NULL) | 191 | FPU(-1, NULL) |
192 | } | 192 | } |
193 | },{ | 193 | },{ |
194 | 0xF, /* Aeroflex Gaisler */ | 194 | PSR_IMPL_LEON, /* Aeroflex Gaisler */ |
195 | .cpu_info = { | 195 | .cpu_info = { |
196 | CPU(3, "LEON"), | 196 | CPU(3, "LEON"), |
197 | CPU(-1, NULL) | 197 | CPU(-1, NULL) |
@@ -440,16 +440,16 @@ static int __init cpu_type_probe(void) | |||
440 | int psr_impl, psr_vers, fpu_vers; | 440 | int psr_impl, psr_vers, fpu_vers; |
441 | int psr; | 441 | int psr; |
442 | 442 | ||
443 | psr_impl = ((get_psr() >> 28) & 0xf); | 443 | psr_impl = ((get_psr() >> PSR_IMPL_SHIFT) & PSR_IMPL_SHIFTED_MASK); |
444 | psr_vers = ((get_psr() >> 24) & 0xf); | 444 | psr_vers = ((get_psr() >> PSR_VERS_SHIFT) & PSR_VERS_SHIFTED_MASK); |
445 | 445 | ||
446 | psr = get_psr(); | 446 | psr = get_psr(); |
447 | put_psr(psr | PSR_EF); | 447 | put_psr(psr | PSR_EF); |
448 | #ifdef CONFIG_SPARC_LEON | 448 | |
449 | fpu_vers = get_psr() & PSR_EF ? ((get_fsr() >> 17) & 0x7) : 7; | 449 | if (psr_impl == PSR_IMPL_LEON) |
450 | #else | 450 | fpu_vers = get_psr() & PSR_EF ? ((get_fsr() >> 17) & 0x7) : 7; |
451 | fpu_vers = ((get_fsr() >> 17) & 0x7); | 451 | else |
452 | #endif | 452 | fpu_vers = ((get_fsr() >> 17) & 0x7); |
453 | 453 | ||
454 | put_psr(psr); | 454 | put_psr(psr); |
455 | 455 | ||