1 /* cpu.c: Dinky routines to look for the kind of Sparc cpu
4 * Copyright (C) 1996, 2007, 2008 David S. Miller (davem@davemloft.net)
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>
14 #include <asm/cpudata.h>
15 #include <asm/spitfire.h>
16 #include <asm/oplib.h>
20 DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
22 struct cpu_chip_info {
29 static const struct cpu_chip_info cpu_chips[] = {
33 .cpu_name = "TI UltraSparc I (SpitFire)",
34 .fp_name = "UltraSparc I integrated FPU",
39 .cpu_name = "TI UltraSparc I (SpitFire)",
40 .fp_name = "UltraSparc I integrated FPU",
45 .cpu_name = "TI UltraSparc II (BlackBird)",
46 .fp_name = "UltraSparc II integrated FPU",
51 .cpu_name = "TI UltraSparc IIi (Sabre)",
52 .fp_name = "UltraSparc IIi integrated FPU",
57 .cpu_name = "TI UltraSparc IIe (Hummingbird)",
58 .fp_name = "UltraSparc IIe integrated FPU",
63 .cpu_name = "TI UltraSparc III (Cheetah)",
64 .fp_name = "UltraSparc III integrated FPU",
69 .cpu_name = "TI UltraSparc III+ (Cheetah+)",
70 .fp_name = "UltraSparc III+ integrated FPU",
75 .cpu_name = "TI UltraSparc IIIi (Jalapeno)",
76 .fp_name = "UltraSparc IIIi integrated FPU",
81 .cpu_name = "TI UltraSparc IV (Jaguar)",
82 .fp_name = "UltraSparc IV integrated FPU",
87 .cpu_name = "TI UltraSparc IV+ (Panther)",
88 .fp_name = "UltraSparc IV+ integrated FPU",
93 .cpu_name = "TI UltraSparc IIIi+ (Serrano)",
94 .fp_name = "UltraSparc IIIi+ integrated FPU",
98 #define NSPARCCHIPS ARRAY_SIZE(linux_sparc_chips)
100 const char *sparc_cpu_type;
101 const char *sparc_fpu_type;
103 static void __init sun4v_cpu_probe(void)
105 switch (sun4v_chip_type) {
106 case SUN4V_CHIP_NIAGARA1:
107 sparc_cpu_type = "UltraSparc T1 (Niagara)";
108 sparc_fpu_type = "UltraSparc T1 integrated FPU";
111 case SUN4V_CHIP_NIAGARA2:
112 sparc_cpu_type = "UltraSparc T2 (Niagara2)";
113 sparc_fpu_type = "UltraSparc T2 integrated FPU";
117 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
118 prom_cpu_compatible);
119 sparc_cpu_type = "Unknown SUN4V CPU";
120 sparc_fpu_type = "Unknown SUN4V FPU";
125 static const struct cpu_chip_info * __init find_cpu_chip(unsigned short manuf,
130 for (i = 0; i < ARRAY_SIZE(cpu_chips); i++) {
131 const struct cpu_chip_info *p = &cpu_chips[i];
133 if (p->manuf == manuf && p->impl == impl)
139 static int __init cpu_type_probe(void)
141 if (tlb_type == hypervisor) {
144 unsigned long ver, manuf, impl;
145 const struct cpu_chip_info *p;
147 __asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver));
149 manuf = ((ver >> 48) & 0xffff);
150 impl = ((ver >> 32) & 0xffff);
152 p = find_cpu_chip(manuf, impl);
154 sparc_cpu_type = p->cpu_name;
155 sparc_fpu_type = p->fp_name;
157 printk(KERN_ERR "CPU: Unknown chip, manuf[%lx] impl[%lx]\n",
159 sparc_cpu_type = "Unknown CPU";
160 sparc_fpu_type = "Unknown FPU";
166 arch_initcall(cpu_type_probe);