* add p cc
[mascara-docs.git] / i386 / linux / linux-2.3.21 / arch / sparc64 / kernel / cpu.c
blobdbcc0d45f60cdb0ab88ef353b733657492833074
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/kernel.h>
8 #include <linux/init.h>
9 #include <linux/sched.h>
10 #include <linux/smp.h>
11 #include <asm/asi.h>
12 #include <asm/system.h>
13 #include <asm/fpumacro.h>
15 struct cpu_iu_info {
16 short manuf;
17 short impl;
18 char* cpu_name; /* should be enough I hope... */
21 struct cpu_fp_info {
22 short manuf;
23 short impl;
24 char fpu_vers;
25 char* fp_name;
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))
51 #ifdef __SMP__
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" };
54 #else
55 char *sparc_cpu_type[64] = { "cpu-oops", };
56 char *sparc_fpu_type[64] = { "fpu-oops", };
57 #endif
59 unsigned int fsr_storage;
61 void __init cpu_probe(void)
63 int manuf, impl;
64 unsigned i, cpuid;
65 long ver, fpu_vers;
66 long fprs;
68 cpuid = hard_smp_processor_id();
70 fprs = fprs_read ();
71 fprs_write (FPRS_FEF);
72 __asm__ __volatile__ ("rdpr %%ver, %0; stx %%fsr, [%1]" : "=&r" (ver) : "r" (&fpu_vers));
73 fprs_write (fprs);
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;
84 break;
88 if(i==NSPARCCHIPS) {
89 printk("DEBUG: manuf = 0x%x impl = 0x%x\n", manuf,
90 impl);
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;
98 break;
102 if(i == NSPARCFPU) {
103 printk("DEBUG: manuf = 0x%x impl = 0x%x fsr.vers = 0x%x\n", manuf, impl,
104 (unsigned)fpu_vers);
105 sparc_fpu_type[cpuid] = "Unknown FPU";