Commit d87d8c11f347e743f0223d16c8ec57ef7e0274b2
Committed by
David S. Miller
1 parent
b08b5c9c9b
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 2 changed files with 11 additions and 9 deletions Side-by-side Diff
arch/sparc/include/asm/psr.h
... | ... | @@ -35,7 +35,9 @@ |
35 | 35 | #define PSR_VERS 0x0f000000 /* cpu-version field */ |
36 | 36 | #define PSR_IMPL 0xf0000000 /* cpu-implementation field */ |
37 | 37 | |
38 | +#define PSR_VERS_SHIFT 24 | |
38 | 39 | #define PSR_IMPL_SHIFT 28 |
40 | +#define PSR_VERS_SHIFTED_MASK 0xf | |
39 | 41 | #define PSR_IMPL_SHIFTED_MASK 0xf |
40 | 42 | |
41 | 43 | #define PSR_IMPL_TI 0x4 |
arch/sparc/kernel/cpu.c
... | ... | @@ -121,7 +121,7 @@ |
121 | 121 | FPU(-1, NULL) |
122 | 122 | } |
123 | 123 | },{ |
124 | - 4, | |
124 | + PSR_IMPL_TI, | |
125 | 125 | .cpu_info = { |
126 | 126 | CPU(0, "Texas Instruments, Inc. - SuperSparc-(II)"), |
127 | 127 | /* SparcClassic -- borned STP1010TAB-50*/ |
... | ... | @@ -191,7 +191,7 @@ |
191 | 191 | FPU(-1, NULL) |
192 | 192 | } |
193 | 193 | },{ |
194 | - 0xF, /* Aeroflex Gaisler */ | |
194 | + PSR_IMPL_LEON, /* Aeroflex Gaisler */ | |
195 | 195 | .cpu_info = { |
196 | 196 | CPU(3, "LEON"), |
197 | 197 | CPU(-1, NULL) |
198 | 198 | |
... | ... | @@ -440,16 +440,16 @@ |
440 | 440 | int psr_impl, psr_vers, fpu_vers; |
441 | 441 | int psr; |
442 | 442 | |
443 | - psr_impl = ((get_psr() >> 28) & 0xf); | |
444 | - psr_vers = ((get_psr() >> 24) & 0xf); | |
443 | + psr_impl = ((get_psr() >> PSR_IMPL_SHIFT) & PSR_IMPL_SHIFTED_MASK); | |
444 | + psr_vers = ((get_psr() >> PSR_VERS_SHIFT) & PSR_VERS_SHIFTED_MASK); | |
445 | 445 | |
446 | 446 | psr = get_psr(); |
447 | 447 | put_psr(psr | PSR_EF); |
448 | -#ifdef CONFIG_SPARC_LEON | |
449 | - fpu_vers = get_psr() & PSR_EF ? ((get_fsr() >> 17) & 0x7) : 7; | |
450 | -#else | |
451 | - fpu_vers = ((get_fsr() >> 17) & 0x7); | |
452 | -#endif | |
448 | + | |
449 | + if (psr_impl == PSR_IMPL_LEON) | |
450 | + fpu_vers = get_psr() & PSR_EF ? ((get_fsr() >> 17) & 0x7) : 7; | |
451 | + else | |
452 | + fpu_vers = ((get_fsr() >> 17) & 0x7); | |
453 | 453 | |
454 | 454 | put_psr(psr); |
455 | 455 |