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/config.h>
8 #include <linux/kernel.h>
9 #include <linux/init.h>
10 #include <linux/sched.h>
11 #include <linux/smp.h>
13 #include <asm/system.h>
14 #include <asm/fpumacro.h>
19 char* cpu_name
; /* should be enough I hope... */
29 /* In order to get the fpu type correct, you need to take the IDPROM's
30 * machine type value into consideration too. I will fix this.
32 struct cpu_fp_info linux_sparc_fpu
[] = {
33 { 0x17, 0x10, 0, "UltraSparc I integrated FPU"},
34 { 0x22, 0x10, 0, "UltraSparc II integrated FPU"},
35 { 0x17, 0x11, 0, "UltraSparc II integrated FPU"},
36 { 0x17, 0x12, 0, "UltraSparc IIi integrated FPU"},
37 { 0x17, 0x14, 0, "UltraSparc III integrated FPU"},
40 #define NSPARCFPU (sizeof(linux_sparc_fpu)/sizeof(struct cpu_fp_info))
42 struct cpu_iu_info linux_sparc_chips
[] = {
43 { 0x17, 0x10, "TI UltraSparc I (SpitFire)"},
44 { 0x22, 0x10, "TI UltraSparc II (BlackBird)"},
45 { 0x17, 0x11, "TI UltraSparc II (BlackBird)"},
46 { 0x17, 0x12, "TI UltraSparc IIi"},
47 { 0x17, 0x14, "TI UltraSparc III (Cheetah)"}, /* A guess... */
50 #define NSPARCCHIPS (sizeof(linux_sparc_chips)/sizeof(struct cpu_iu_info))
53 char *sparc_cpu_type
[64] = { "cpu-oops", "cpu-oops1", "cpu-oops2", "cpu-oops3" };
54 char *sparc_fpu_type
[64] = { "fpu-oops", "fpu-oops1", "fpu-oops2", "fpu-oops3" };
56 char *sparc_cpu_type
[64] = { "cpu-oops", };
57 char *sparc_fpu_type
[64] = { "fpu-oops", };
60 unsigned int fsr_storage
;
62 void __init
cpu_probe(void)
69 cpuid
= hard_smp_processor_id();
72 fprs_write (FPRS_FEF
);
73 __asm__
__volatile__ ("rdpr %%ver, %0; stx %%fsr, [%1]" : "=&r" (ver
) : "r" (&fpu_vers
));
76 manuf
= ((ver
>> 48)&0xffff);
77 impl
= ((ver
>> 32)&0xffff);
79 fpu_vers
= ((fpu_vers
>>17)&0x7);
81 for(i
= 0; i
<NSPARCCHIPS
; i
++) {
82 if(linux_sparc_chips
[i
].manuf
== manuf
)
83 if(linux_sparc_chips
[i
].impl
== impl
) {
84 sparc_cpu_type
[cpuid
] = linux_sparc_chips
[i
].cpu_name
;
90 printk("DEBUG: manuf = 0x%x impl = 0x%x\n", manuf
,
92 sparc_cpu_type
[cpuid
] = "Unknown CPU";
95 for(i
= 0; i
<NSPARCFPU
; i
++) {
96 if(linux_sparc_fpu
[i
].manuf
== manuf
&& linux_sparc_fpu
[i
].impl
== impl
)
97 if(linux_sparc_fpu
[i
].fpu_vers
== fpu_vers
) {
98 sparc_fpu_type
[cpuid
] = linux_sparc_fpu
[i
].fp_name
;
104 printk("DEBUG: manuf = 0x%x impl = 0x%x fsr.vers = 0x%x\n", manuf
, impl
,
106 sparc_fpu_type
[cpuid
] = "Unknown FPU";