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/module.h>
9 #include <linux/init.h>
10 #include <linux/smp.h>
11 #include <linux/threads.h>
13 #include <asm/spitfire.h>
14 #include <asm/oplib.h>
19 #include <asm/cpudata.h>
23 DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
24 EXPORT_PER_CPU_SYMBOL(__cpu_data);
39 struct manufacturer_info {
41 struct cpu_info cpu_info[NOCPU];
42 struct fpu_info fpu_info[NOFPU];
45 #define CPU(ver, _name) \
46 { .psr_vers = ver, .name = _name }
48 #define FPU(ver, _name) \
49 { .fp_vers = ver, .name = _name }
51 static const struct manufacturer_info __initconst manufacturer_info[] = {
54 /* Sun4/100, 4/200, SLC */
56 CPU(0, "Fujitsu MB86900/1A or LSI L64831 SparcKIT-40"),
57 /* borned STP1012PGA */
58 CPU(4, "Fujitsu MB86904"),
59 CPU(5, "Fujitsu TurboSparc MB86907"),
63 FPU(0, "Fujitsu MB86910 or Weitek WTL1164/5"),
64 FPU(1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"),
65 FPU(2, "LSI Logic L64802 or Texas Instruments ACT8847"),
66 /* SparcStation SLC, SparcStation1 */
67 FPU(3, "Weitek WTL3170/2"),
69 FPU(4, "Lsi Logic/Meiko L64804 or compatible"),
75 /* SparcStation2, SparcServer 490 & 690 */
76 CPU(0, "LSI Logic Corporation - L64811"),
78 CPU(1, "Cypress/ROSS CY7C601"),
79 /* Embedded controller */
80 CPU(3, "Cypress/ROSS CY7C611"),
81 /* Ross Technologies HyperSparc */
82 CPU(0xf, "ROSS HyperSparc RT620"),
83 CPU(0xe, "ROSS HyperSparc RT625 or RT626"),
87 FPU(0, "ROSS HyperSparc combined IU/FPU"),
88 FPU(1, "Lsi Logic L64814"),
89 FPU(2, "Texas Instruments TMS390-C602A"),
90 FPU(3, "Cypress CY7C602 FPU"),
96 /* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */
97 /* Someone please write the code to support this beast! ;) */
98 CPU(0, "Bipolar Integrated Technology - B5010"),
107 CPU(0, "LSI Logic Corporation - unknown-type"),
116 CPU(0, "Texas Instruments, Inc. - SuperSparc-(II)"),
117 /* SparcClassic -- borned STP1010TAB-50*/
118 CPU(1, "Texas Instruments, Inc. - MicroSparc"),
119 CPU(2, "Texas Instruments, Inc. - MicroSparc II"),
120 CPU(3, "Texas Instruments, Inc. - SuperSparc 51"),
121 CPU(4, "Texas Instruments, Inc. - SuperSparc 61"),
122 CPU(5, "Texas Instruments, Inc. - unknown"),
126 /* SuperSparc 50 module */
127 FPU(0, "SuperSparc on-chip FPU"),
129 FPU(4, "TI MicroSparc on chip FPU"),
135 CPU(0, "Matsushita - MN10501"),
139 FPU(0, "Matsushita MN10501"),
145 CPU(0, "Philips Corporation - unknown"),
154 CPU(0, "Harvest VLSI Design Center, Inc. - unknown"),
163 CPU(0, "Systems and Processes Engineering Corporation (SPEC)"),
172 /* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */
173 CPU(0, "Fujitsu or Weitek Power-UP"),
174 CPU(1, "Fujitsu or Weitek Power-UP"),
175 CPU(2, "Fujitsu or Weitek Power-UP"),
176 CPU(3, "Fujitsu or Weitek Power-UP"),
180 FPU(3, "Fujitsu or Weitek on-chip FPU"),
186 CPU(0x10, "TI UltraSparc I (SpitFire)"),
187 CPU(0x11, "TI UltraSparc II (BlackBird)"),
188 CPU(0x12, "TI UltraSparc IIi (Sabre)"),
189 CPU(0x13, "TI UltraSparc IIe (Hummingbird)"),
193 FPU(0x10, "UltraSparc I integrated FPU"),
194 FPU(0x11, "UltraSparc II integrated FPU"),
195 FPU(0x12, "UltraSparc IIi integrated FPU"),
196 FPU(0x13, "UltraSparc IIe integrated FPU"),
202 CPU(0x10, "TI UltraSparc I (SpitFire)"),
206 FPU(0x10, "UltraSparc I integrated FPU"),
212 CPU(0x14, "TI UltraSparc III (Cheetah)"),
213 CPU(0x15, "TI UltraSparc III+ (Cheetah+)"),
214 CPU(0x16, "TI UltraSparc IIIi (Jalapeno)"),
215 CPU(0x18, "TI UltraSparc IV (Jaguar)"),
216 CPU(0x19, "TI UltraSparc IV+ (Panther)"),
217 CPU(0x22, "TI UltraSparc IIIi+ (Serrano)"),
221 FPU(0x14, "UltraSparc III integrated FPU"),
222 FPU(0x15, "UltraSparc III+ integrated FPU"),
223 FPU(0x16, "UltraSparc IIIi integrated FPU"),
224 FPU(0x18, "UltraSparc IV integrated FPU"),
225 FPU(0x19, "UltraSparc IV+ integrated FPU"),
226 FPU(0x22, "UltraSparc IIIi+ integrated FPU"),
231 /* In order to get the fpu type correct, you need to take the IDPROM's
232 * machine type value into consideration too. I will fix this.
235 const char *sparc_cpu_type;
236 const char *sparc_fpu_type;
238 unsigned int fsr_storage;
240 static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
242 sparc_cpu_type = NULL;
243 sparc_fpu_type = NULL;
244 if (psr_impl < ARRAY_SIZE(manufacturer_info))
246 const struct cpu_info *cpu;
247 const struct fpu_info *fpu;
249 cpu = &manufacturer_info[psr_impl].cpu_info[0];
250 while (cpu->psr_vers != -1)
252 if (cpu->psr_vers == psr_vers) {
253 sparc_cpu_type = cpu->name;
254 sparc_fpu_type = "No FPU";
259 fpu = &manufacturer_info[psr_impl].fpu_info[0];
260 while (fpu->fp_vers != -1)
262 if (fpu->fp_vers == fpu_vers) {
263 sparc_fpu_type = fpu->name;
269 if (sparc_cpu_type == NULL)
271 printk(KERN_ERR "CPU: Unknown chip, impl[0x%x] vers[0x%x]\n",
273 sparc_cpu_type = "Unknown CPU";
275 if (sparc_fpu_type == NULL)
277 printk(KERN_ERR "FPU: Unknown chip, impl[0x%x] vers[0x%x]\n",
279 sparc_fpu_type = "Unknown FPU";
283 #ifdef CONFIG_SPARC32
284 void __cpuinit cpu_probe(void)
286 int psr_impl, psr_vers, fpu_vers;
289 psr_impl = ((get_psr() >> 28) & 0xf);
290 psr_vers = ((get_psr() >> 24) & 0xf);
293 put_psr(psr | PSR_EF);
294 fpu_vers = ((get_fsr() >> 17) & 0x7);
297 set_cpu_and_fpu(psr_impl, psr_vers, fpu_vers);
300 static void __init sun4v_cpu_probe(void)
302 switch (sun4v_chip_type) {
303 case SUN4V_CHIP_NIAGARA1:
304 sparc_cpu_type = "UltraSparc T1 (Niagara)";
305 sparc_fpu_type = "UltraSparc T1 integrated FPU";
308 case SUN4V_CHIP_NIAGARA2:
309 sparc_cpu_type = "UltraSparc T2 (Niagara2)";
310 sparc_fpu_type = "UltraSparc T2 integrated FPU";
314 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
315 prom_cpu_compatible);
316 sparc_cpu_type = "Unknown SUN4V CPU";
317 sparc_fpu_type = "Unknown SUN4V FPU";
322 static int __init cpu_type_probe(void)
324 if (tlb_type == hypervisor) {
330 __asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver));
332 manuf = ((ver >> 48) & 0xffff);
333 impl = ((ver >> 32) & 0xffff);
334 set_cpu_and_fpu(manuf, impl, impl);
339 arch_initcall(cpu_type_probe);