Skip to content

Commit

Permalink
sparc32: handle leon in cpu.c
Browse files Browse the repository at this point in the history
A few hardcoded constant were replaced by symbolic
versions to improve readability

Signed-off-by: Sam Ravnborg <[email protected]>
Cc: Daniel Hellstrom <[email protected]>
Cc: Konrad Eisele <[email protected]>
  • Loading branch information
sravnborg authored and davem330 committed May 28, 2012
1 parent b08b5c9 commit d87d8c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions arch/sparc/include/asm/psr.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
#define PSR_VERS 0x0f000000 /* cpu-version field */
#define PSR_IMPL 0xf0000000 /* cpu-implementation field */

#define PSR_VERS_SHIFT 24
#define PSR_IMPL_SHIFT 28
#define PSR_VERS_SHIFTED_MASK 0xf
#define PSR_IMPL_SHIFTED_MASK 0xf

#define PSR_IMPL_TI 0x4
Expand Down
18 changes: 9 additions & 9 deletions arch/sparc/kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
FPU(-1, NULL)
}
},{
4,
PSR_IMPL_TI,
.cpu_info = {
CPU(0, "Texas Instruments, Inc. - SuperSparc-(II)"),
/* SparcClassic -- borned STP1010TAB-50*/
Expand Down Expand Up @@ -191,7 +191,7 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
FPU(-1, NULL)
}
},{
0xF, /* Aeroflex Gaisler */
PSR_IMPL_LEON, /* Aeroflex Gaisler */
.cpu_info = {
CPU(3, "LEON"),
CPU(-1, NULL)
Expand Down Expand Up @@ -440,16 +440,16 @@ static int __init cpu_type_probe(void)
int psr_impl, psr_vers, fpu_vers;
int psr;

psr_impl = ((get_psr() >> 28) & 0xf);
psr_vers = ((get_psr() >> 24) & 0xf);
psr_impl = ((get_psr() >> PSR_IMPL_SHIFT) & PSR_IMPL_SHIFTED_MASK);
psr_vers = ((get_psr() >> PSR_VERS_SHIFT) & PSR_VERS_SHIFTED_MASK);

psr = get_psr();
put_psr(psr | PSR_EF);
#ifdef CONFIG_SPARC_LEON
fpu_vers = get_psr() & PSR_EF ? ((get_fsr() >> 17) & 0x7) : 7;
#else
fpu_vers = ((get_fsr() >> 17) & 0x7);
#endif

if (psr_impl == PSR_IMPL_LEON)
fpu_vers = get_psr() & PSR_EF ? ((get_fsr() >> 17) & 0x7) : 7;
else
fpu_vers = ((get_fsr() >> 17) & 0x7);

put_psr(psr);

Expand Down

0 comments on commit d87d8c1

Please sign in to comment.