1 /* cpu.c: Dinky routines to look for the kind of Sparc cpu
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
7 #include <linux/kernel.h>
8 #include <linux/init.h>
9 #include <linux/sched.h>
10 #include <linux/smp.h>
12 #include <asm/system.h>
13 #include <asm/fpumacro.h>
18 char* cpu_name
; /* should be enough I hope... */
28 /* In order to get the fpu type correct, you need to take the IDPROM's
29 * machine type value into consideration too. I will fix this.
31 struct cpu_fp_info linux_sparc_fpu
[] = {
32 { 0x17, 0x10, 0, "UltraSparc I integrated FPU"},
33 { 0x22, 0x10, 0, "UltraSparc II integrated FPU"},
34 { 0x17, 0x11, 0, "UltraSparc II integrated FPU"},
35 { 0x17, 0x12, 0, "UltraSparc IIi integrated FPU"},
36 { 0x17, 0x14, 0, "UltraSparc III integrated FPU"},
39 #define NSPARCFPU (sizeof(linux_sparc_fpu)/sizeof(struct cpu_fp_info))
41 struct cpu_iu_info linux_sparc_chips
[] = {
42 { 0x17, 0x10, "TI UltraSparc I (SpitFire)"},
43 { 0x22, 0x10, "TI UltraSparc II (BlackBird)"},
44 { 0x17, 0x11, "TI UltraSparc II (BlackBird)"},
45 { 0x17, 0x12, "TI UltraSparc IIi"},
46 { 0x17, 0x14, "TI UltraSparc III (Cheetah)"}, /* A guess... */
49 #define NSPARCCHIPS (sizeof(linux_sparc_chips)/sizeof(struct cpu_iu_info))
52 char *sparc_cpu_type
[64] = { "cpu-oops", "cpu-oops1", "cpu-oops2", "cpu-oops3" };
53 char *sparc_fpu_type
[64] = { "fpu-oops", "fpu-oops1", "fpu-oops2", "fpu-oops3" };
55 char *sparc_cpu_type
[64] = { "cpu-oops", };
56 char *sparc_fpu_type
[64] = { "fpu-oops", };
59 unsigned int fsr_storage
;
61 void __init
cpu_probe(void)
68 cpuid
= hard_smp_processor_id();
71 fprs_write (FPRS_FEF
);
72 __asm__
__volatile__ ("rdpr %%ver, %0; stx %%fsr, [%1]" : "=&r" (ver
) : "r" (&fpu_vers
));
75 manuf
= ((ver
>> 48)&0xffff);
76 impl
= ((ver
>> 32)&0xffff);
78 fpu_vers
= ((fpu_vers
>>17)&0x7);
80 for(i
= 0; i
<NSPARCCHIPS
; i
++) {
81 if(linux_sparc_chips
[i
].manuf
== manuf
)
82 if(linux_sparc_chips
[i
].impl
== impl
) {
83 sparc_cpu_type
[cpuid
] = linux_sparc_chips
[i
].cpu_name
;
89 printk("DEBUG: manuf = 0x%x impl = 0x%x\n", manuf
,
91 sparc_cpu_type
[cpuid
] = "Unknown CPU";
94 for(i
= 0; i
<NSPARCFPU
; i
++) {
95 if(linux_sparc_fpu
[i
].manuf
== manuf
&& linux_sparc_fpu
[i
].impl
== impl
)
96 if(linux_sparc_fpu
[i
].fpu_vers
== fpu_vers
) {
97 sparc_fpu_type
[cpuid
] = linux_sparc_fpu
[i
].fp_name
;
103 printk("DEBUG: manuf = 0x%x impl = 0x%x fsr.vers = 0x%x\n", manuf
, impl
,
105 sparc_fpu_type
[cpuid
] = "Unknown FPU";