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/seq_file.h>
8 #include <linux/kernel.h>
9 #include <linux/export.h>
10 #include <linux/init.h>
11 #include <linux/smp.h>
12 #include <linux/threads.h>
14 #include <asm/spitfire.h>
15 #include <asm/pgtable.h>
16 #include <asm/oplib.h>
17 #include <asm/setup.h>
22 #include <asm/cpudata.h>
27 DEFINE_PER_CPU(cpuinfo_sparc
, __cpu_data
) = { 0 };
28 EXPORT_PER_CPU_SYMBOL(__cpu_data
);
31 unsigned int fsr_storage
;
47 struct manufacturer_info
{
49 struct cpu_info cpu_info
[NOCPU
];
50 struct fpu_info fpu_info
[NOFPU
];
53 #define CPU(ver, _name) \
54 { .psr_vers = ver, .name = _name }
56 #define CPU_PMU(ver, _name, _pmu_name) \
57 { .psr_vers = ver, .name = _name, .pmu_name = _pmu_name }
59 #define FPU(ver, _name) \
60 { .fp_vers = ver, .name = _name }
62 static const struct manufacturer_info __initconst manufacturer_info
[] = {
65 /* Sun4/100, 4/200, SLC */
67 CPU(0, "Fujitsu MB86900/1A or LSI L64831 SparcKIT-40"),
68 /* borned STP1012PGA */
69 CPU(4, "Fujitsu MB86904"),
70 CPU(5, "Fujitsu TurboSparc MB86907"),
74 FPU(0, "Fujitsu MB86910 or Weitek WTL1164/5"),
75 FPU(1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"),
76 FPU(2, "LSI Logic L64802 or Texas Instruments ACT8847"),
77 /* SparcStation SLC, SparcStation1 */
78 FPU(3, "Weitek WTL3170/2"),
80 FPU(4, "Lsi Logic/Meiko L64804 or compatible"),
86 /* SparcStation2, SparcServer 490 & 690 */
87 CPU(0, "LSI Logic Corporation - L64811"),
89 CPU(1, "Cypress/ROSS CY7C601"),
90 /* Embedded controller */
91 CPU(3, "Cypress/ROSS CY7C611"),
92 /* Ross Technologies HyperSparc */
93 CPU(0xf, "ROSS HyperSparc RT620"),
94 CPU(0xe, "ROSS HyperSparc RT625 or RT626"),
98 FPU(0, "ROSS HyperSparc combined IU/FPU"),
99 FPU(1, "Lsi Logic L64814"),
100 FPU(2, "Texas Instruments TMS390-C602A"),
101 FPU(3, "Cypress CY7C602 FPU"),
107 /* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */
108 /* Someone please write the code to support this beast! ;) */
109 CPU(0, "Bipolar Integrated Technology - B5010"),
118 CPU(0, "LSI Logic Corporation - unknown-type"),
127 CPU(0, "Texas Instruments, Inc. - SuperSparc-(II)"),
128 /* SparcClassic -- borned STP1010TAB-50*/
129 CPU(1, "Texas Instruments, Inc. - MicroSparc"),
130 CPU(2, "Texas Instruments, Inc. - MicroSparc II"),
131 CPU(3, "Texas Instruments, Inc. - SuperSparc 51"),
132 CPU(4, "Texas Instruments, Inc. - SuperSparc 61"),
133 CPU(5, "Texas Instruments, Inc. - unknown"),
137 /* SuperSparc 50 module */
138 FPU(0, "SuperSparc on-chip FPU"),
140 FPU(4, "TI MicroSparc on chip FPU"),
146 CPU(0, "Matsushita - MN10501"),
150 FPU(0, "Matsushita MN10501"),
156 CPU(0, "Philips Corporation - unknown"),
165 CPU(0, "Harvest VLSI Design Center, Inc. - unknown"),
174 CPU(0, "Systems and Processes Engineering Corporation (SPEC)"),
183 /* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */
184 CPU(0, "Fujitsu or Weitek Power-UP"),
185 CPU(1, "Fujitsu or Weitek Power-UP"),
186 CPU(2, "Fujitsu or Weitek Power-UP"),
187 CPU(3, "Fujitsu or Weitek Power-UP"),
191 FPU(3, "Fujitsu or Weitek on-chip FPU"),
195 PSR_IMPL_LEON
, /* Aeroflex Gaisler */
202 FPU(3, "GRFPU-Lite"),
208 CPU_PMU(0x10, "TI UltraSparc I (SpitFire)", "ultra12"),
209 CPU_PMU(0x11, "TI UltraSparc II (BlackBird)", "ultra12"),
210 CPU_PMU(0x12, "TI UltraSparc IIi (Sabre)", "ultra12"),
211 CPU_PMU(0x13, "TI UltraSparc IIe (Hummingbird)", "ultra12"),
215 FPU(0x10, "UltraSparc I integrated FPU"),
216 FPU(0x11, "UltraSparc II integrated FPU"),
217 FPU(0x12, "UltraSparc IIi integrated FPU"),
218 FPU(0x13, "UltraSparc IIe integrated FPU"),
224 CPU_PMU(0x10, "TI UltraSparc I (SpitFire)", "ultra12"),
228 FPU(0x10, "UltraSparc I integrated FPU"),
234 CPU_PMU(0x14, "TI UltraSparc III (Cheetah)", "ultra3"),
235 CPU_PMU(0x15, "TI UltraSparc III+ (Cheetah+)", "ultra3+"),
236 CPU_PMU(0x16, "TI UltraSparc IIIi (Jalapeno)", "ultra3i"),
237 CPU_PMU(0x18, "TI UltraSparc IV (Jaguar)", "ultra3+"),
238 CPU_PMU(0x19, "TI UltraSparc IV+ (Panther)", "ultra4+"),
239 CPU_PMU(0x22, "TI UltraSparc IIIi+ (Serrano)", "ultra3i"),
243 FPU(0x14, "UltraSparc III integrated FPU"),
244 FPU(0x15, "UltraSparc III+ integrated FPU"),
245 FPU(0x16, "UltraSparc IIIi integrated FPU"),
246 FPU(0x18, "UltraSparc IV integrated FPU"),
247 FPU(0x19, "UltraSparc IV+ integrated FPU"),
248 FPU(0x22, "UltraSparc IIIi+ integrated FPU"),
253 /* In order to get the fpu type correct, you need to take the IDPROM's
254 * machine type value into consideration too. I will fix this.
257 static const char *sparc_cpu_type
;
258 static const char *sparc_fpu_type
;
259 const char *sparc_pmu_type
;
262 static void __init
set_cpu_and_fpu(int psr_impl
, int psr_vers
, int fpu_vers
)
264 const struct manufacturer_info
*manuf
;
267 sparc_cpu_type
= NULL
;
268 sparc_fpu_type
= NULL
;
269 sparc_pmu_type
= NULL
;
272 for (i
= 0; i
< ARRAY_SIZE(manufacturer_info
); i
++)
274 if (psr_impl
== manufacturer_info
[i
].psr_impl
) {
275 manuf
= &manufacturer_info
[i
];
281 const struct cpu_info
*cpu
;
282 const struct fpu_info
*fpu
;
284 cpu
= &manuf
->cpu_info
[0];
285 while (cpu
->psr_vers
!= -1)
287 if (cpu
->psr_vers
== psr_vers
) {
288 sparc_cpu_type
= cpu
->name
;
289 sparc_pmu_type
= cpu
->pmu_name
;
290 sparc_fpu_type
= "No FPU";
295 fpu
= &manuf
->fpu_info
[0];
296 while (fpu
->fp_vers
!= -1)
298 if (fpu
->fp_vers
== fpu_vers
) {
299 sparc_fpu_type
= fpu
->name
;
305 if (sparc_cpu_type
== NULL
)
307 printk(KERN_ERR
"CPU: Unknown chip, impl[0x%x] vers[0x%x]\n",
309 sparc_cpu_type
= "Unknown CPU";
311 if (sparc_fpu_type
== NULL
)
313 printk(KERN_ERR
"FPU: Unknown chip, impl[0x%x] vers[0x%x]\n",
315 sparc_fpu_type
= "Unknown FPU";
317 if (sparc_pmu_type
== NULL
)
318 sparc_pmu_type
= "Unknown PMU";
321 #ifdef CONFIG_SPARC32
322 static int show_cpuinfo(struct seq_file
*m
, void *__unused
)
327 "promlib\t\t: Version %d Revision %d\n"
330 "ncpus probed\t: %d\n"
331 "ncpus active\t: %d\n"
333 "CPU0Bogo\t: %lu.%02lu\n"
334 "CPU0ClkTck\t: %ld\n"
341 romvec
->pv_printrev
>> 16,
342 romvec
->pv_printrev
& 0xffff,
347 , cpu_data(0).udelay_val
/(500000/HZ
),
348 (cpu_data(0).udelay_val
/(5000/HZ
)) % 100,
349 cpu_data(0).clock_tick
362 #endif /* CONFIG_SPARC32 */
364 #ifdef CONFIG_SPARC64
365 unsigned int dcache_parity_tl1_occurred
;
366 unsigned int icache_parity_tl1_occurred
;
369 static int show_cpuinfo(struct seq_file
*m
, void *__unused
)
377 "ncpus probed\t: %d\n"
378 "ncpus active\t: %d\n"
379 "D$ parity tl1\t: %u\n"
380 "I$ parity tl1\t: %u\n"
382 "Cpu0ClkTck\t: %016lx\n"
389 ((tlb_type
== hypervisor
) ?
394 dcache_parity_tl1_occurred
,
395 icache_parity_tl1_occurred
397 , cpu_data(0).clock_tick
410 #endif /* CONFIG_SPARC64 */
412 static void *c_start(struct seq_file
*m
, loff_t
*pos
)
414 /* The pointer we are returning is arbitrary,
415 * it just has to be non-NULL and not IS_ERR
416 * in the success case.
418 return *pos
== 0 ? &c_start
: NULL
;
421 static void *c_next(struct seq_file
*m
, void *v
, loff_t
*pos
)
424 return c_start(m
, pos
);
427 static void c_stop(struct seq_file
*m
, void *v
)
431 const struct seq_operations cpuinfo_op
= {
435 .show
= show_cpuinfo
,
438 #ifdef CONFIG_SPARC32
439 static int __init
cpu_type_probe(void)
441 int psr_impl
, psr_vers
, fpu_vers
;
444 psr_impl
= ((get_psr() >> PSR_IMPL_SHIFT
) & PSR_IMPL_SHIFTED_MASK
);
445 psr_vers
= ((get_psr() >> PSR_VERS_SHIFT
) & PSR_VERS_SHIFTED_MASK
);
448 put_psr(psr
| PSR_EF
);
450 if (psr_impl
== PSR_IMPL_LEON
)
451 fpu_vers
= get_psr() & PSR_EF
? ((get_fsr() >> 17) & 0x7) : 7;
453 fpu_vers
= ((get_fsr() >> 17) & 0x7);
457 set_cpu_and_fpu(psr_impl
, psr_vers
, fpu_vers
);
461 #endif /* CONFIG_SPARC32 */
463 #ifdef CONFIG_SPARC64
464 static void __init
sun4v_cpu_probe(void)
466 switch (sun4v_chip_type
) {
467 case SUN4V_CHIP_NIAGARA1
:
468 sparc_cpu_type
= "UltraSparc T1 (Niagara)";
469 sparc_fpu_type
= "UltraSparc T1 integrated FPU";
470 sparc_pmu_type
= "niagara";
473 case SUN4V_CHIP_NIAGARA2
:
474 sparc_cpu_type
= "UltraSparc T2 (Niagara2)";
475 sparc_fpu_type
= "UltraSparc T2 integrated FPU";
476 sparc_pmu_type
= "niagara2";
479 case SUN4V_CHIP_NIAGARA3
:
480 sparc_cpu_type
= "UltraSparc T3 (Niagara3)";
481 sparc_fpu_type
= "UltraSparc T3 integrated FPU";
482 sparc_pmu_type
= "niagara3";
485 case SUN4V_CHIP_NIAGARA4
:
486 sparc_cpu_type
= "UltraSparc T4 (Niagara4)";
487 sparc_fpu_type
= "UltraSparc T4 integrated FPU";
488 sparc_pmu_type
= "niagara4";
491 case SUN4V_CHIP_NIAGARA5
:
492 sparc_cpu_type
= "UltraSparc T5 (Niagara5)";
493 sparc_fpu_type
= "UltraSparc T5 integrated FPU";
494 sparc_pmu_type
= "niagara5";
497 case SUN4V_CHIP_SPARC_M6
:
498 sparc_cpu_type
= "SPARC-M6";
499 sparc_fpu_type
= "SPARC-M6 integrated FPU";
500 sparc_pmu_type
= "sparc-m6";
503 case SUN4V_CHIP_SPARC_M7
:
504 sparc_cpu_type
= "SPARC-M7";
505 sparc_fpu_type
= "SPARC-M7 integrated FPU";
506 sparc_pmu_type
= "sparc-m7";
509 case SUN4V_CHIP_SPARC64X
:
510 sparc_cpu_type
= "SPARC64-X";
511 sparc_fpu_type
= "SPARC64-X integrated FPU";
512 sparc_pmu_type
= "sparc64-x";
516 printk(KERN_WARNING
"CPU: Unknown sun4v cpu type [%s]\n",
517 prom_cpu_compatible
);
518 sparc_cpu_type
= "Unknown SUN4V CPU";
519 sparc_fpu_type
= "Unknown SUN4V FPU";
520 sparc_pmu_type
= "Unknown SUN4V PMU";
525 static int __init
cpu_type_probe(void)
527 if (tlb_type
== hypervisor
) {
533 __asm__
__volatile__("rdpr %%ver, %0" : "=r" (ver
));
535 manuf
= ((ver
>> 48) & 0xffff);
536 impl
= ((ver
>> 32) & 0xffff);
537 set_cpu_and_fpu(manuf
, impl
, impl
);
541 #endif /* CONFIG_SPARC64 */
543 early_initcall(cpu_type_probe
);