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>
10 #include <linux/threads.h>
12 #include <asm/spitfire.h>
13 #include <asm/oplib.h>
18 #include <asm/cpudata.h>
22 DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
37 struct manufacturer_info {
39 struct cpu_info cpu_info[NOCPU];
40 struct fpu_info fpu_info[NOFPU];
43 #define CPU(ver, _name) \
44 { .psr_vers = ver, .name = _name }
46 #define FPU(ver, _name) \
47 { .fp_vers = ver, .name = _name }
49 static const struct manufacturer_info __initconst manufacturer_info[] = {
52 /* Sun4/100, 4/200, SLC */
54 CPU(0, "Fujitsu MB86900/1A or LSI L64831 SparcKIT-40"),
55 /* borned STP1012PGA */
56 CPU(4, "Fujitsu MB86904"),
57 CPU(5, "Fujitsu TurboSparc MB86907"),
61 FPU(0, "Fujitsu MB86910 or Weitek WTL1164/5"),
62 FPU(1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"),
63 FPU(2, "LSI Logic L64802 or Texas Instruments ACT8847"),
64 /* SparcStation SLC, SparcStation1 */
65 FPU(3, "Weitek WTL3170/2"),
67 FPU(4, "Lsi Logic/Meiko L64804 or compatible"),
73 /* SparcStation2, SparcServer 490 & 690 */
74 CPU(0, "LSI Logic Corporation - L64811"),
76 CPU(1, "Cypress/ROSS CY7C601"),
77 /* Embedded controller */
78 CPU(3, "Cypress/ROSS CY7C611"),
79 /* Ross Technologies HyperSparc */
80 CPU(0xf, "ROSS HyperSparc RT620"),
81 CPU(0xe, "ROSS HyperSparc RT625 or RT626"),
85 FPU(0, "ROSS HyperSparc combined IU/FPU"),
86 FPU(1, "Lsi Logic L64814"),
87 FPU(2, "Texas Instruments TMS390-C602A"),
88 FPU(3, "Cypress CY7C602 FPU"),
94 /* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */
95 /* Someone please write the code to support this beast! ;) */
96 CPU(0, "Bipolar Integrated Technology - B5010"),
105 CPU(0, "LSI Logic Corporation - unknown-type"),
114 CPU(0, "Texas Instruments, Inc. - SuperSparc-(II)"),
115 /* SparcClassic -- borned STP1010TAB-50*/
116 CPU(1, "Texas Instruments, Inc. - MicroSparc"),
117 CPU(2, "Texas Instruments, Inc. - MicroSparc II"),
118 CPU(3, "Texas Instruments, Inc. - SuperSparc 51"),
119 CPU(4, "Texas Instruments, Inc. - SuperSparc 61"),
120 CPU(5, "Texas Instruments, Inc. - unknown"),
124 /* SuperSparc 50 module */
125 FPU(0, "SuperSparc on-chip FPU"),
127 FPU(4, "TI MicroSparc on chip FPU"),
133 CPU(0, "Matsushita - MN10501"),
137 FPU(0, "Matsushita MN10501"),
143 CPU(0, "Philips Corporation - unknown"),
152 CPU(0, "Harvest VLSI Design Center, Inc. - unknown"),
161 CPU(0, "Systems and Processes Engineering Corporation (SPEC)"),
170 /* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */
171 CPU(0, "Fujitsu or Weitek Power-UP"),
172 CPU(1, "Fujitsu or Weitek Power-UP"),
173 CPU(2, "Fujitsu or Weitek Power-UP"),
174 CPU(3, "Fujitsu or Weitek Power-UP"),
178 FPU(3, "Fujitsu or Weitek on-chip FPU"),
184 CPU(0x10, "TI UltraSparc I (SpitFire)"),
185 CPU(0x11, "TI UltraSparc II (BlackBird)"),
186 CPU(0x12, "TI UltraSparc IIi (Sabre)"),
187 CPU(0x13, "TI UltraSparc IIe (Hummingbird)"),
191 FPU(0x10, "UltraSparc I integrated FPU"),
192 FPU(0x11, "UltraSparc II integrated FPU"),
193 FPU(0x12, "UltraSparc IIi integrated FPU"),
194 FPU(0x13, "UltraSparc IIe integrated FPU"),
200 CPU(0x10, "TI UltraSparc I (SpitFire)"),
204 FPU(0x10, "UltraSparc I integrated FPU"),
210 CPU(0x14, "TI UltraSparc III (Cheetah)"),
211 CPU(0x15, "TI UltraSparc III+ (Cheetah+)"),
212 CPU(0x16, "TI UltraSparc IIIi (Jalapeno)"),
213 CPU(0x18, "TI UltraSparc IV (Jaguar)"),
214 CPU(0x19, "TI UltraSparc IV+ (Panther)"),
215 CPU(0x22, "TI UltraSparc IIIi+ (Serrano)"),
219 FPU(0x14, "UltraSparc III integrated FPU"),
220 FPU(0x15, "UltraSparc III+ integrated FPU"),
221 FPU(0x16, "UltraSparc IIIi integrated FPU"),
222 FPU(0x18, "UltraSparc IV integrated FPU"),
223 FPU(0x19, "UltraSparc IV+ integrated FPU"),
224 FPU(0x22, "UltraSparc IIIi+ integrated FPU"),
229 /* In order to get the fpu type correct, you need to take the IDPROM's
230 * machine type value into consideration too. I will fix this.
233 const char *sparc_cpu_type;
234 const char *sparc_fpu_type;
236 unsigned int fsr_storage;
238 static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
240 sparc_cpu_type = NULL;
241 sparc_fpu_type = NULL;
242 if (psr_impl < ARRAY_SIZE(manufacturer_info))
244 const struct cpu_info *cpu;
245 const struct fpu_info *fpu;
247 cpu = &manufacturer_info[psr_impl].cpu_info[0];
248 while (cpu->psr_vers != -1)
250 if (cpu->psr_vers == psr_vers) {
251 sparc_cpu_type = cpu->name;
252 sparc_fpu_type = "No FPU";
257 fpu = &manufacturer_info[psr_impl].fpu_info[0];
258 while (fpu->fp_vers != -1)
260 if (fpu->fp_vers == fpu_vers) {
261 sparc_fpu_type = fpu->name;
267 if (sparc_cpu_type == NULL)
269 printk(KERN_ERR "CPU: Unknown chip, impl[0x%x] vers[0x%x]\n",
271 sparc_cpu_type = "Unknown CPU";
273 if (sparc_fpu_type == NULL)
275 printk(KERN_ERR "FPU: Unknown chip, impl[0x%x] vers[0x%x]\n",
277 sparc_fpu_type = "Unknown FPU";
281 #ifdef CONFIG_SPARC32
282 void __cpuinit cpu_probe(void)
284 int psr_impl, psr_vers, fpu_vers;
287 psr_impl = ((get_psr() >> 28) & 0xf);
288 psr_vers = ((get_psr() >> 24) & 0xf);
291 put_psr(psr | PSR_EF);
292 fpu_vers = ((get_fsr() >> 17) & 0x7);
295 set_cpu_and_fpu(psr_impl, psr_vers, fpu_vers);
298 static void __init sun4v_cpu_probe(void)
300 switch (sun4v_chip_type) {
301 case SUN4V_CHIP_NIAGARA1:
302 sparc_cpu_type = "UltraSparc T1 (Niagara)";
303 sparc_fpu_type = "UltraSparc T1 integrated FPU";
306 case SUN4V_CHIP_NIAGARA2:
307 sparc_cpu_type = "UltraSparc T2 (Niagara2)";
308 sparc_fpu_type = "UltraSparc T2 integrated FPU";
312 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
313 prom_cpu_compatible);
314 sparc_cpu_type = "Unknown SUN4V CPU";
315 sparc_fpu_type = "Unknown SUN4V FPU";
320 static int __init cpu_type_probe(void)
322 if (tlb_type == hypervisor) {
328 __asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver));
330 manuf = ((ver >> 48) & 0xffff);
331 impl = ((ver >> 32) & 0xffff);
332 set_cpu_and_fpu(manuf, impl, impl);
337 arch_initcall(cpu_type_probe);