Ok. I didn't make 2.4.0 in 2000. Tough. I tried, but we had some
[davej-history.git] / arch / sparc64 / kernel / cpu.c
blob8e1a0367ca18094cee95fde9138336206d10b6ae
1 /* cpu.c: Dinky routines to look for the kind of Sparc cpu
2 * we are on.
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
5 */
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>
12 #include <asm/asi.h>
13 #include <asm/system.h>
14 #include <asm/fpumacro.h>
16 struct cpu_iu_info {
17 short manuf;
18 short impl;
19 char* cpu_name; /* should be enough I hope... */
22 struct cpu_fp_info {
23 short manuf;
24 short impl;
25 char fpu_vers;
26 char* fp_name;
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))
52 #ifdef CONFIG_SMP
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" };
55 #else
56 char *sparc_cpu_type[64] = { "cpu-oops", };
57 char *sparc_fpu_type[64] = { "fpu-oops", };
58 #endif
60 unsigned int fsr_storage;
62 void __init cpu_probe(void)
64 int manuf, impl;
65 unsigned i, cpuid;
66 long ver, fpu_vers;
67 long fprs;
69 cpuid = hard_smp_processor_id();
71 fprs = fprs_read ();
72 fprs_write (FPRS_FEF);
73 __asm__ __volatile__ ("rdpr %%ver, %0; stx %%fsr, [%1]" : "=&r" (ver) : "r" (&fpu_vers));
74 fprs_write (fprs);
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;
85 break;
89 if(i==NSPARCCHIPS) {
90 printk("DEBUG: manuf = 0x%x impl = 0x%x\n", manuf,
91 impl);
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;
99 break;
103 if(i == NSPARCFPU) {
104 printk("DEBUG: manuf = 0x%x impl = 0x%x fsr.vers = 0x%x\n", manuf, impl,
105 (unsigned)fpu_vers);
106 sparc_fpu_type[cpuid] = "Unknown FPU";