1d34dd829SSam Ravnborg /* cpu.c: Dinky routines to look for the kind of Sparc cpu 2d34dd829SSam Ravnborg * we are on. 3d34dd829SSam Ravnborg * 4d34dd829SSam Ravnborg * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 5d34dd829SSam Ravnborg */ 6d34dd829SSam Ravnborg 7cb1b8209SSam Ravnborg #include <linux/seq_file.h> 8d34dd829SSam Ravnborg #include <linux/kernel.h> 9066bcacaSPaul Gortmaker #include <linux/export.h> 10d34dd829SSam Ravnborg #include <linux/init.h> 11d34dd829SSam Ravnborg #include <linux/smp.h> 12d34dd829SSam Ravnborg #include <linux/threads.h> 13d34dd829SSam Ravnborg 14d34dd829SSam Ravnborg #include <asm/spitfire.h> 15cb1b8209SSam Ravnborg #include <asm/pgtable.h> 16d34dd829SSam Ravnborg #include <asm/oplib.h> 17cb1b8209SSam Ravnborg #include <asm/setup.h> 18d34dd829SSam Ravnborg #include <asm/page.h> 19d34dd829SSam Ravnborg #include <asm/head.h> 20d34dd829SSam Ravnborg #include <asm/psr.h> 21d34dd829SSam Ravnborg #include <asm/mbus.h> 22d34dd829SSam Ravnborg #include <asm/cpudata.h> 23d34dd829SSam Ravnborg 24d34dd829SSam Ravnborg #include "kernel.h" 25d34dd829SSam Ravnborg 26d34dd829SSam Ravnborg DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; 276943f3daSSam Ravnborg EXPORT_PER_CPU_SYMBOL(__cpu_data); 28d34dd829SSam Ravnborg 29cb1b8209SSam Ravnborg int ncpus_probed; 30cb1b8209SSam Ravnborg unsigned int fsr_storage; 31cb1b8209SSam Ravnborg 32d34dd829SSam Ravnborg struct cpu_info { 33d34dd829SSam Ravnborg int psr_vers; 34d34dd829SSam Ravnborg const char *name; 35c3cf5e8cSDavid S. Miller const char *pmu_name; 36d34dd829SSam Ravnborg }; 37d34dd829SSam Ravnborg 38d34dd829SSam Ravnborg struct fpu_info { 39d34dd829SSam Ravnborg int fp_vers; 40d34dd829SSam Ravnborg const char *name; 41d34dd829SSam Ravnborg }; 42d34dd829SSam Ravnborg 43d34dd829SSam Ravnborg #define NOCPU 8 44d34dd829SSam Ravnborg #define NOFPU 8 45d34dd829SSam Ravnborg 46d34dd829SSam Ravnborg struct manufacturer_info { 47d34dd829SSam Ravnborg int psr_impl; 48d34dd829SSam Ravnborg struct cpu_info cpu_info[NOCPU]; 49d34dd829SSam Ravnborg struct fpu_info fpu_info[NOFPU]; 50d34dd829SSam Ravnborg }; 51d34dd829SSam Ravnborg 52d34dd829SSam Ravnborg #define CPU(ver, _name) \ 53d34dd829SSam Ravnborg { .psr_vers = ver, .name = _name } 54d34dd829SSam Ravnborg 55c3cf5e8cSDavid S. Miller #define CPU_PMU(ver, _name, _pmu_name) \ 56c3cf5e8cSDavid S. Miller { .psr_vers = ver, .name = _name, .pmu_name = _pmu_name } 57c3cf5e8cSDavid S. Miller 58d34dd829SSam Ravnborg #define FPU(ver, _name) \ 59d34dd829SSam Ravnborg { .fp_vers = ver, .name = _name } 60d34dd829SSam Ravnborg 61d34dd829SSam Ravnborg static const struct manufacturer_info __initconst manufacturer_info[] = { 62d34dd829SSam Ravnborg { 63d34dd829SSam Ravnborg 0, 64d34dd829SSam Ravnborg /* Sun4/100, 4/200, SLC */ 65d34dd829SSam Ravnborg .cpu_info = { 66d34dd829SSam Ravnborg CPU(0, "Fujitsu MB86900/1A or LSI L64831 SparcKIT-40"), 67d34dd829SSam Ravnborg /* borned STP1012PGA */ 68d34dd829SSam Ravnborg CPU(4, "Fujitsu MB86904"), 69d34dd829SSam Ravnborg CPU(5, "Fujitsu TurboSparc MB86907"), 70d34dd829SSam Ravnborg CPU(-1, NULL) 71d34dd829SSam Ravnborg }, 72d34dd829SSam Ravnborg .fpu_info = { 73d34dd829SSam Ravnborg FPU(0, "Fujitsu MB86910 or Weitek WTL1164/5"), 74d34dd829SSam Ravnborg FPU(1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"), 75d34dd829SSam Ravnborg FPU(2, "LSI Logic L64802 or Texas Instruments ACT8847"), 76d34dd829SSam Ravnborg /* SparcStation SLC, SparcStation1 */ 77d34dd829SSam Ravnborg FPU(3, "Weitek WTL3170/2"), 78d34dd829SSam Ravnborg /* SPARCstation-5 */ 79d34dd829SSam Ravnborg FPU(4, "Lsi Logic/Meiko L64804 or compatible"), 80d34dd829SSam Ravnborg FPU(-1, NULL) 81d34dd829SSam Ravnborg } 82d34dd829SSam Ravnborg },{ 83d34dd829SSam Ravnborg 1, 84d34dd829SSam Ravnborg .cpu_info = { 85d34dd829SSam Ravnborg /* SparcStation2, SparcServer 490 & 690 */ 86d34dd829SSam Ravnborg CPU(0, "LSI Logic Corporation - L64811"), 87d34dd829SSam Ravnborg /* SparcStation2 */ 88d34dd829SSam Ravnborg CPU(1, "Cypress/ROSS CY7C601"), 89d34dd829SSam Ravnborg /* Embedded controller */ 90d34dd829SSam Ravnborg CPU(3, "Cypress/ROSS CY7C611"), 91d34dd829SSam Ravnborg /* Ross Technologies HyperSparc */ 92d34dd829SSam Ravnborg CPU(0xf, "ROSS HyperSparc RT620"), 93d34dd829SSam Ravnborg CPU(0xe, "ROSS HyperSparc RT625 or RT626"), 94d34dd829SSam Ravnborg CPU(-1, NULL) 95d34dd829SSam Ravnborg }, 96d34dd829SSam Ravnborg .fpu_info = { 97d34dd829SSam Ravnborg FPU(0, "ROSS HyperSparc combined IU/FPU"), 98d34dd829SSam Ravnborg FPU(1, "Lsi Logic L64814"), 99d34dd829SSam Ravnborg FPU(2, "Texas Instruments TMS390-C602A"), 100d34dd829SSam Ravnborg FPU(3, "Cypress CY7C602 FPU"), 101d34dd829SSam Ravnborg FPU(-1, NULL) 102d34dd829SSam Ravnborg } 103d34dd829SSam Ravnborg },{ 104d34dd829SSam Ravnborg 2, 105d34dd829SSam Ravnborg .cpu_info = { 106d34dd829SSam Ravnborg /* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */ 107d34dd829SSam Ravnborg /* Someone please write the code to support this beast! ;) */ 108d34dd829SSam Ravnborg CPU(0, "Bipolar Integrated Technology - B5010"), 109d34dd829SSam Ravnborg CPU(-1, NULL) 110d34dd829SSam Ravnborg }, 111d34dd829SSam Ravnborg .fpu_info = { 112d34dd829SSam Ravnborg FPU(-1, NULL) 113d34dd829SSam Ravnborg } 114d34dd829SSam Ravnborg },{ 115d34dd829SSam Ravnborg 3, 116d34dd829SSam Ravnborg .cpu_info = { 117d34dd829SSam Ravnborg CPU(0, "LSI Logic Corporation - unknown-type"), 118d34dd829SSam Ravnborg CPU(-1, NULL) 119d34dd829SSam Ravnborg }, 120d34dd829SSam Ravnborg .fpu_info = { 121d34dd829SSam Ravnborg FPU(-1, NULL) 122d34dd829SSam Ravnborg } 123d34dd829SSam Ravnborg },{ 124*d87d8c11SSam Ravnborg PSR_IMPL_TI, 125d34dd829SSam Ravnborg .cpu_info = { 126d34dd829SSam Ravnborg CPU(0, "Texas Instruments, Inc. - SuperSparc-(II)"), 127d34dd829SSam Ravnborg /* SparcClassic -- borned STP1010TAB-50*/ 128d34dd829SSam Ravnborg CPU(1, "Texas Instruments, Inc. - MicroSparc"), 129d34dd829SSam Ravnborg CPU(2, "Texas Instruments, Inc. - MicroSparc II"), 130d34dd829SSam Ravnborg CPU(3, "Texas Instruments, Inc. - SuperSparc 51"), 131d34dd829SSam Ravnborg CPU(4, "Texas Instruments, Inc. - SuperSparc 61"), 132d34dd829SSam Ravnborg CPU(5, "Texas Instruments, Inc. - unknown"), 133d34dd829SSam Ravnborg CPU(-1, NULL) 134d34dd829SSam Ravnborg }, 135d34dd829SSam Ravnborg .fpu_info = { 136d34dd829SSam Ravnborg /* SuperSparc 50 module */ 137d34dd829SSam Ravnborg FPU(0, "SuperSparc on-chip FPU"), 138d34dd829SSam Ravnborg /* SparcClassic */ 139d34dd829SSam Ravnborg FPU(4, "TI MicroSparc on chip FPU"), 140d34dd829SSam Ravnborg FPU(-1, NULL) 141d34dd829SSam Ravnborg } 142d34dd829SSam Ravnborg },{ 143d34dd829SSam Ravnborg 5, 144d34dd829SSam Ravnborg .cpu_info = { 145d34dd829SSam Ravnborg CPU(0, "Matsushita - MN10501"), 146d34dd829SSam Ravnborg CPU(-1, NULL) 147d34dd829SSam Ravnborg }, 148d34dd829SSam Ravnborg .fpu_info = { 149d34dd829SSam Ravnborg FPU(0, "Matsushita MN10501"), 150d34dd829SSam Ravnborg FPU(-1, NULL) 151d34dd829SSam Ravnborg } 152d34dd829SSam Ravnborg },{ 153d34dd829SSam Ravnborg 6, 154d34dd829SSam Ravnborg .cpu_info = { 155d34dd829SSam Ravnborg CPU(0, "Philips Corporation - unknown"), 156d34dd829SSam Ravnborg CPU(-1, NULL) 157d34dd829SSam Ravnborg }, 158d34dd829SSam Ravnborg .fpu_info = { 159d34dd829SSam Ravnborg FPU(-1, NULL) 160d34dd829SSam Ravnborg } 161d34dd829SSam Ravnborg },{ 162d34dd829SSam Ravnborg 7, 163d34dd829SSam Ravnborg .cpu_info = { 164d34dd829SSam Ravnborg CPU(0, "Harvest VLSI Design Center, Inc. - unknown"), 165d34dd829SSam Ravnborg CPU(-1, NULL) 166d34dd829SSam Ravnborg }, 167d34dd829SSam Ravnborg .fpu_info = { 168d34dd829SSam Ravnborg FPU(-1, NULL) 169d34dd829SSam Ravnborg } 170d34dd829SSam Ravnborg },{ 171d34dd829SSam Ravnborg 8, 172d34dd829SSam Ravnborg .cpu_info = { 173d34dd829SSam Ravnborg CPU(0, "Systems and Processes Engineering Corporation (SPEC)"), 174d34dd829SSam Ravnborg CPU(-1, NULL) 175d34dd829SSam Ravnborg }, 176d34dd829SSam Ravnborg .fpu_info = { 177d34dd829SSam Ravnborg FPU(-1, NULL) 178d34dd829SSam Ravnborg } 179d34dd829SSam Ravnborg },{ 180d34dd829SSam Ravnborg 9, 181d34dd829SSam Ravnborg .cpu_info = { 182d34dd829SSam Ravnborg /* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */ 183d34dd829SSam Ravnborg CPU(0, "Fujitsu or Weitek Power-UP"), 184d34dd829SSam Ravnborg CPU(1, "Fujitsu or Weitek Power-UP"), 185d34dd829SSam Ravnborg CPU(2, "Fujitsu or Weitek Power-UP"), 186d34dd829SSam Ravnborg CPU(3, "Fujitsu or Weitek Power-UP"), 187d34dd829SSam Ravnborg CPU(-1, NULL) 188d34dd829SSam Ravnborg }, 189d34dd829SSam Ravnborg .fpu_info = { 190d34dd829SSam Ravnborg FPU(3, "Fujitsu or Weitek on-chip FPU"), 191d34dd829SSam Ravnborg FPU(-1, NULL) 192d34dd829SSam Ravnborg } 193d34dd829SSam Ravnborg },{ 194*d87d8c11SSam Ravnborg PSR_IMPL_LEON, /* Aeroflex Gaisler */ 1953560f788SKristoffer Glembo .cpu_info = { 1963560f788SKristoffer Glembo CPU(3, "LEON"), 1973560f788SKristoffer Glembo CPU(-1, NULL) 1983560f788SKristoffer Glembo }, 1993560f788SKristoffer Glembo .fpu_info = { 2003560f788SKristoffer Glembo FPU(2, "GRFPU"), 2013560f788SKristoffer Glembo FPU(3, "GRFPU-Lite"), 2023560f788SKristoffer Glembo FPU(-1, NULL) 2033560f788SKristoffer Glembo } 2043560f788SKristoffer Glembo },{ 205d34dd829SSam Ravnborg 0x17, 206d34dd829SSam Ravnborg .cpu_info = { 207c3cf5e8cSDavid S. Miller CPU_PMU(0x10, "TI UltraSparc I (SpitFire)", "ultra12"), 208c3cf5e8cSDavid S. Miller CPU_PMU(0x11, "TI UltraSparc II (BlackBird)", "ultra12"), 209c3cf5e8cSDavid S. Miller CPU_PMU(0x12, "TI UltraSparc IIi (Sabre)", "ultra12"), 210c3cf5e8cSDavid S. Miller CPU_PMU(0x13, "TI UltraSparc IIe (Hummingbird)", "ultra12"), 211d34dd829SSam Ravnborg CPU(-1, NULL) 212d34dd829SSam Ravnborg }, 213d34dd829SSam Ravnborg .fpu_info = { 214d34dd829SSam Ravnborg FPU(0x10, "UltraSparc I integrated FPU"), 215d34dd829SSam Ravnborg FPU(0x11, "UltraSparc II integrated FPU"), 216d34dd829SSam Ravnborg FPU(0x12, "UltraSparc IIi integrated FPU"), 217d34dd829SSam Ravnborg FPU(0x13, "UltraSparc IIe integrated FPU"), 218d34dd829SSam Ravnborg FPU(-1, NULL) 219d34dd829SSam Ravnborg } 220d34dd829SSam Ravnborg },{ 221d34dd829SSam Ravnborg 0x22, 222d34dd829SSam Ravnborg .cpu_info = { 223c3cf5e8cSDavid S. Miller CPU_PMU(0x10, "TI UltraSparc I (SpitFire)", "ultra12"), 224d34dd829SSam Ravnborg CPU(-1, NULL) 225d34dd829SSam Ravnborg }, 226d34dd829SSam Ravnborg .fpu_info = { 227d34dd829SSam Ravnborg FPU(0x10, "UltraSparc I integrated FPU"), 228d34dd829SSam Ravnborg FPU(-1, NULL) 229d34dd829SSam Ravnborg } 230d34dd829SSam Ravnborg },{ 231d34dd829SSam Ravnborg 0x3e, 232d34dd829SSam Ravnborg .cpu_info = { 233c3cf5e8cSDavid S. Miller CPU_PMU(0x14, "TI UltraSparc III (Cheetah)", "ultra3"), 234c3cf5e8cSDavid S. Miller CPU_PMU(0x15, "TI UltraSparc III+ (Cheetah+)", "ultra3+"), 235c3cf5e8cSDavid S. Miller CPU_PMU(0x16, "TI UltraSparc IIIi (Jalapeno)", "ultra3i"), 236c3cf5e8cSDavid S. Miller CPU_PMU(0x18, "TI UltraSparc IV (Jaguar)", "ultra3+"), 237c3cf5e8cSDavid S. Miller CPU_PMU(0x19, "TI UltraSparc IV+ (Panther)", "ultra4+"), 238c3cf5e8cSDavid S. Miller CPU_PMU(0x22, "TI UltraSparc IIIi+ (Serrano)", "ultra3i"), 239d34dd829SSam Ravnborg CPU(-1, NULL) 240d34dd829SSam Ravnborg }, 241d34dd829SSam Ravnborg .fpu_info = { 242d34dd829SSam Ravnborg FPU(0x14, "UltraSparc III integrated FPU"), 243d34dd829SSam Ravnborg FPU(0x15, "UltraSparc III+ integrated FPU"), 244d34dd829SSam Ravnborg FPU(0x16, "UltraSparc IIIi integrated FPU"), 245d34dd829SSam Ravnborg FPU(0x18, "UltraSparc IV integrated FPU"), 246d34dd829SSam Ravnborg FPU(0x19, "UltraSparc IV+ integrated FPU"), 247d34dd829SSam Ravnborg FPU(0x22, "UltraSparc IIIi+ integrated FPU"), 248d34dd829SSam Ravnborg FPU(-1, NULL) 249d34dd829SSam Ravnborg } 250d34dd829SSam Ravnborg }}; 251d34dd829SSam Ravnborg 252d34dd829SSam Ravnborg /* In order to get the fpu type correct, you need to take the IDPROM's 253d34dd829SSam Ravnborg * machine type value into consideration too. I will fix this. 254d34dd829SSam Ravnborg */ 255d34dd829SSam Ravnborg 256cb1b8209SSam Ravnborg static const char *sparc_cpu_type; 257cb1b8209SSam Ravnborg static const char *sparc_fpu_type; 258c3cf5e8cSDavid S. Miller const char *sparc_pmu_type; 259d34dd829SSam Ravnborg 260d34dd829SSam Ravnborg 2619c2853afSSam Ravnborg static void __init set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers) 262d34dd829SSam Ravnborg { 263c275ce44SSam Ravnborg const struct manufacturer_info *manuf; 264c275ce44SSam Ravnborg int i; 265c275ce44SSam Ravnborg 266d34dd829SSam Ravnborg sparc_cpu_type = NULL; 267d34dd829SSam Ravnborg sparc_fpu_type = NULL; 268c3cf5e8cSDavid S. Miller sparc_pmu_type = NULL; 269c275ce44SSam Ravnborg manuf = NULL; 270c275ce44SSam Ravnborg 271c275ce44SSam Ravnborg for (i = 0; i < ARRAY_SIZE(manufacturer_info); i++) 272c275ce44SSam Ravnborg { 273c275ce44SSam Ravnborg if (psr_impl == manufacturer_info[i].psr_impl) { 274c275ce44SSam Ravnborg manuf = &manufacturer_info[i]; 275c275ce44SSam Ravnborg break; 276c275ce44SSam Ravnborg } 277c275ce44SSam Ravnborg } 278c275ce44SSam Ravnborg if (manuf != NULL) 279d34dd829SSam Ravnborg { 280d34dd829SSam Ravnborg const struct cpu_info *cpu; 281d34dd829SSam Ravnborg const struct fpu_info *fpu; 282d34dd829SSam Ravnborg 283c275ce44SSam Ravnborg cpu = &manuf->cpu_info[0]; 284d34dd829SSam Ravnborg while (cpu->psr_vers != -1) 285d34dd829SSam Ravnborg { 286d34dd829SSam Ravnborg if (cpu->psr_vers == psr_vers) { 287d34dd829SSam Ravnborg sparc_cpu_type = cpu->name; 288c3cf5e8cSDavid S. Miller sparc_pmu_type = cpu->pmu_name; 289d34dd829SSam Ravnborg sparc_fpu_type = "No FPU"; 290d34dd829SSam Ravnborg break; 291d34dd829SSam Ravnborg } 292d34dd829SSam Ravnborg cpu++; 293d34dd829SSam Ravnborg } 294c275ce44SSam Ravnborg fpu = &manuf->fpu_info[0]; 295d34dd829SSam Ravnborg while (fpu->fp_vers != -1) 296d34dd829SSam Ravnborg { 297d34dd829SSam Ravnborg if (fpu->fp_vers == fpu_vers) { 298d34dd829SSam Ravnborg sparc_fpu_type = fpu->name; 299d34dd829SSam Ravnborg break; 300d34dd829SSam Ravnborg } 301d34dd829SSam Ravnborg fpu++; 302d34dd829SSam Ravnborg } 303d34dd829SSam Ravnborg } 304d34dd829SSam Ravnborg if (sparc_cpu_type == NULL) 305d34dd829SSam Ravnborg { 306d34dd829SSam Ravnborg printk(KERN_ERR "CPU: Unknown chip, impl[0x%x] vers[0x%x]\n", 307d34dd829SSam Ravnborg psr_impl, psr_vers); 308d34dd829SSam Ravnborg sparc_cpu_type = "Unknown CPU"; 309d34dd829SSam Ravnborg } 310d34dd829SSam Ravnborg if (sparc_fpu_type == NULL) 311d34dd829SSam Ravnborg { 312d34dd829SSam Ravnborg printk(KERN_ERR "FPU: Unknown chip, impl[0x%x] vers[0x%x]\n", 313d34dd829SSam Ravnborg psr_impl, fpu_vers); 314d34dd829SSam Ravnborg sparc_fpu_type = "Unknown FPU"; 315d34dd829SSam Ravnborg } 316c3cf5e8cSDavid S. Miller if (sparc_pmu_type == NULL) 317c3cf5e8cSDavid S. Miller sparc_pmu_type = "Unknown PMU"; 318d34dd829SSam Ravnborg } 319d34dd829SSam Ravnborg 320d34dd829SSam Ravnborg #ifdef CONFIG_SPARC32 321cb1b8209SSam Ravnborg static int show_cpuinfo(struct seq_file *m, void *__unused) 322cb1b8209SSam Ravnborg { 323cb1b8209SSam Ravnborg seq_printf(m, 324cb1b8209SSam Ravnborg "cpu\t\t: %s\n" 325cb1b8209SSam Ravnborg "fpu\t\t: %s\n" 326cb1b8209SSam Ravnborg "promlib\t\t: Version %d Revision %d\n" 327cb1b8209SSam Ravnborg "prom\t\t: %d.%d\n" 328cb1b8209SSam Ravnborg "type\t\t: %s\n" 329cb1b8209SSam Ravnborg "ncpus probed\t: %d\n" 330cb1b8209SSam Ravnborg "ncpus active\t: %d\n" 331cb1b8209SSam Ravnborg #ifndef CONFIG_SMP 332cb1b8209SSam Ravnborg "CPU0Bogo\t: %lu.%02lu\n" 333cb1b8209SSam Ravnborg "CPU0ClkTck\t: %ld\n" 334cb1b8209SSam Ravnborg #endif 335cb1b8209SSam Ravnborg , 336cb1b8209SSam Ravnborg sparc_cpu_type, 337cb1b8209SSam Ravnborg sparc_fpu_type , 338cb1b8209SSam Ravnborg romvec->pv_romvers, 339cb1b8209SSam Ravnborg prom_rev, 340cb1b8209SSam Ravnborg romvec->pv_printrev >> 16, 341cb1b8209SSam Ravnborg romvec->pv_printrev & 0xffff, 342cb1b8209SSam Ravnborg &cputypval[0], 343cb1b8209SSam Ravnborg ncpus_probed, 344cb1b8209SSam Ravnborg num_online_cpus() 345cb1b8209SSam Ravnborg #ifndef CONFIG_SMP 346cb1b8209SSam Ravnborg , cpu_data(0).udelay_val/(500000/HZ), 347cb1b8209SSam Ravnborg (cpu_data(0).udelay_val/(5000/HZ)) % 100, 348cb1b8209SSam Ravnborg cpu_data(0).clock_tick 349cb1b8209SSam Ravnborg #endif 350cb1b8209SSam Ravnborg ); 351cb1b8209SSam Ravnborg 352cb1b8209SSam Ravnborg #ifdef CONFIG_SMP 353cb1b8209SSam Ravnborg smp_bogo(m); 354cb1b8209SSam Ravnborg #endif 355cb1b8209SSam Ravnborg mmu_info(m); 356cb1b8209SSam Ravnborg #ifdef CONFIG_SMP 357cb1b8209SSam Ravnborg smp_info(m); 358cb1b8209SSam Ravnborg #endif 359cb1b8209SSam Ravnborg return 0; 360cb1b8209SSam Ravnborg } 361cb1b8209SSam Ravnborg #endif /* CONFIG_SPARC32 */ 362cb1b8209SSam Ravnborg 363cb1b8209SSam Ravnborg #ifdef CONFIG_SPARC64 364cb1b8209SSam Ravnborg unsigned int dcache_parity_tl1_occurred; 365cb1b8209SSam Ravnborg unsigned int icache_parity_tl1_occurred; 366cb1b8209SSam Ravnborg 367cb1b8209SSam Ravnborg 368cb1b8209SSam Ravnborg static int show_cpuinfo(struct seq_file *m, void *__unused) 369cb1b8209SSam Ravnborg { 370cb1b8209SSam Ravnborg seq_printf(m, 371cb1b8209SSam Ravnborg "cpu\t\t: %s\n" 372cb1b8209SSam Ravnborg "fpu\t\t: %s\n" 373cb1b8209SSam Ravnborg "pmu\t\t: %s\n" 374cb1b8209SSam Ravnborg "prom\t\t: %s\n" 375cb1b8209SSam Ravnborg "type\t\t: %s\n" 376cb1b8209SSam Ravnborg "ncpus probed\t: %d\n" 377cb1b8209SSam Ravnborg "ncpus active\t: %d\n" 378cb1b8209SSam Ravnborg "D$ parity tl1\t: %u\n" 379cb1b8209SSam Ravnborg "I$ parity tl1\t: %u\n" 380cb1b8209SSam Ravnborg #ifndef CONFIG_SMP 381cb1b8209SSam Ravnborg "Cpu0ClkTck\t: %016lx\n" 382cb1b8209SSam Ravnborg #endif 383cb1b8209SSam Ravnborg , 384cb1b8209SSam Ravnborg sparc_cpu_type, 385cb1b8209SSam Ravnborg sparc_fpu_type, 386cb1b8209SSam Ravnborg sparc_pmu_type, 387cb1b8209SSam Ravnborg prom_version, 388cb1b8209SSam Ravnborg ((tlb_type == hypervisor) ? 389cb1b8209SSam Ravnborg "sun4v" : 390cb1b8209SSam Ravnborg "sun4u"), 391cb1b8209SSam Ravnborg ncpus_probed, 392cb1b8209SSam Ravnborg num_online_cpus(), 393cb1b8209SSam Ravnborg dcache_parity_tl1_occurred, 394cb1b8209SSam Ravnborg icache_parity_tl1_occurred 395cb1b8209SSam Ravnborg #ifndef CONFIG_SMP 396cb1b8209SSam Ravnborg , cpu_data(0).clock_tick 397cb1b8209SSam Ravnborg #endif 398cb1b8209SSam Ravnborg ); 399ac85fe8bSDavid S. Miller cpucap_info(m); 400cb1b8209SSam Ravnborg #ifdef CONFIG_SMP 401cb1b8209SSam Ravnborg smp_bogo(m); 402cb1b8209SSam Ravnborg #endif 403cb1b8209SSam Ravnborg mmu_info(m); 404cb1b8209SSam Ravnborg #ifdef CONFIG_SMP 405cb1b8209SSam Ravnborg smp_info(m); 406cb1b8209SSam Ravnborg #endif 407cb1b8209SSam Ravnborg return 0; 408cb1b8209SSam Ravnborg } 409cb1b8209SSam Ravnborg #endif /* CONFIG_SPARC64 */ 410cb1b8209SSam Ravnborg 411cb1b8209SSam Ravnborg static void *c_start(struct seq_file *m, loff_t *pos) 412cb1b8209SSam Ravnborg { 413cb1b8209SSam Ravnborg /* The pointer we are returning is arbitrary, 414cb1b8209SSam Ravnborg * it just has to be non-NULL and not IS_ERR 415cb1b8209SSam Ravnborg * in the success case. 416cb1b8209SSam Ravnborg */ 417cb1b8209SSam Ravnborg return *pos == 0 ? &c_start : NULL; 418cb1b8209SSam Ravnborg } 419cb1b8209SSam Ravnborg 420cb1b8209SSam Ravnborg static void *c_next(struct seq_file *m, void *v, loff_t *pos) 421cb1b8209SSam Ravnborg { 422cb1b8209SSam Ravnborg ++*pos; 423cb1b8209SSam Ravnborg return c_start(m, pos); 424cb1b8209SSam Ravnborg } 425cb1b8209SSam Ravnborg 426cb1b8209SSam Ravnborg static void c_stop(struct seq_file *m, void *v) 427cb1b8209SSam Ravnborg { 428cb1b8209SSam Ravnborg } 429cb1b8209SSam Ravnborg 430cb1b8209SSam Ravnborg const struct seq_operations cpuinfo_op = { 431cb1b8209SSam Ravnborg .start =c_start, 432cb1b8209SSam Ravnborg .next = c_next, 433cb1b8209SSam Ravnborg .stop = c_stop, 434cb1b8209SSam Ravnborg .show = show_cpuinfo, 435cb1b8209SSam Ravnborg }; 436cb1b8209SSam Ravnborg 437cb1b8209SSam Ravnborg #ifdef CONFIG_SPARC32 4389c2853afSSam Ravnborg static int __init cpu_type_probe(void) 439d34dd829SSam Ravnborg { 440d34dd829SSam Ravnborg int psr_impl, psr_vers, fpu_vers; 441d34dd829SSam Ravnborg int psr; 442d34dd829SSam Ravnborg 443*d87d8c11SSam Ravnborg psr_impl = ((get_psr() >> PSR_IMPL_SHIFT) & PSR_IMPL_SHIFTED_MASK); 444*d87d8c11SSam Ravnborg psr_vers = ((get_psr() >> PSR_VERS_SHIFT) & PSR_VERS_SHIFTED_MASK); 445d34dd829SSam Ravnborg 446d34dd829SSam Ravnborg psr = get_psr(); 447d34dd829SSam Ravnborg put_psr(psr | PSR_EF); 448*d87d8c11SSam Ravnborg 449*d87d8c11SSam Ravnborg if (psr_impl == PSR_IMPL_LEON) 4502666e476SDaniel Hellstrom fpu_vers = get_psr() & PSR_EF ? ((get_fsr() >> 17) & 0x7) : 7; 451*d87d8c11SSam Ravnborg else 452d34dd829SSam Ravnborg fpu_vers = ((get_fsr() >> 17) & 0x7); 4530fd7ef1fSKonrad Eisele 454d34dd829SSam Ravnborg put_psr(psr); 455d34dd829SSam Ravnborg 456d34dd829SSam Ravnborg set_cpu_and_fpu(psr_impl, psr_vers, fpu_vers); 4579c2853afSSam Ravnborg 4589c2853afSSam Ravnborg return 0; 459d34dd829SSam Ravnborg } 4609c2853afSSam Ravnborg #endif /* CONFIG_SPARC32 */ 4619c2853afSSam Ravnborg 4629c2853afSSam Ravnborg #ifdef CONFIG_SPARC64 463d34dd829SSam Ravnborg static void __init sun4v_cpu_probe(void) 464d34dd829SSam Ravnborg { 465d34dd829SSam Ravnborg switch (sun4v_chip_type) { 466d34dd829SSam Ravnborg case SUN4V_CHIP_NIAGARA1: 467d34dd829SSam Ravnborg sparc_cpu_type = "UltraSparc T1 (Niagara)"; 468d34dd829SSam Ravnborg sparc_fpu_type = "UltraSparc T1 integrated FPU"; 469c3cf5e8cSDavid S. Miller sparc_pmu_type = "niagara"; 470d34dd829SSam Ravnborg break; 471d34dd829SSam Ravnborg 472d34dd829SSam Ravnborg case SUN4V_CHIP_NIAGARA2: 473d34dd829SSam Ravnborg sparc_cpu_type = "UltraSparc T2 (Niagara2)"; 474d34dd829SSam Ravnborg sparc_fpu_type = "UltraSparc T2 integrated FPU"; 475c3cf5e8cSDavid S. Miller sparc_pmu_type = "niagara2"; 476d34dd829SSam Ravnborg break; 477d34dd829SSam Ravnborg 4784ba991d3SDavid S. Miller case SUN4V_CHIP_NIAGARA3: 4794ba991d3SDavid S. Miller sparc_cpu_type = "UltraSparc T3 (Niagara3)"; 4804ba991d3SDavid S. Miller sparc_fpu_type = "UltraSparc T3 integrated FPU"; 4814ba991d3SDavid S. Miller sparc_pmu_type = "niagara3"; 4824ba991d3SDavid S. Miller break; 4834ba991d3SDavid S. Miller 48408cefa9fSDavid S. Miller case SUN4V_CHIP_NIAGARA4: 48508cefa9fSDavid S. Miller sparc_cpu_type = "UltraSparc T4 (Niagara4)"; 48608cefa9fSDavid S. Miller sparc_fpu_type = "UltraSparc T4 integrated FPU"; 48708cefa9fSDavid S. Miller sparc_pmu_type = "niagara4"; 48808cefa9fSDavid S. Miller break; 48908cefa9fSDavid S. Miller 49008cefa9fSDavid S. Miller case SUN4V_CHIP_NIAGARA5: 49108cefa9fSDavid S. Miller sparc_cpu_type = "UltraSparc T5 (Niagara5)"; 49208cefa9fSDavid S. Miller sparc_fpu_type = "UltraSparc T5 integrated FPU"; 49308cefa9fSDavid S. Miller sparc_pmu_type = "niagara5"; 49408cefa9fSDavid S. Miller break; 49508cefa9fSDavid S. Miller 496d34dd829SSam Ravnborg default: 497d34dd829SSam Ravnborg printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n", 498d34dd829SSam Ravnborg prom_cpu_compatible); 499d34dd829SSam Ravnborg sparc_cpu_type = "Unknown SUN4V CPU"; 500d34dd829SSam Ravnborg sparc_fpu_type = "Unknown SUN4V FPU"; 501facfddefSDavid S. Miller sparc_pmu_type = "Unknown SUN4V PMU"; 502d34dd829SSam Ravnborg break; 503d34dd829SSam Ravnborg } 504d34dd829SSam Ravnborg } 505d34dd829SSam Ravnborg 506d34dd829SSam Ravnborg static int __init cpu_type_probe(void) 507d34dd829SSam Ravnborg { 508d34dd829SSam Ravnborg if (tlb_type == hypervisor) { 509d34dd829SSam Ravnborg sun4v_cpu_probe(); 510d34dd829SSam Ravnborg } else { 511d34dd829SSam Ravnborg unsigned long ver; 512d34dd829SSam Ravnborg int manuf, impl; 513d34dd829SSam Ravnborg 514d34dd829SSam Ravnborg __asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver)); 515d34dd829SSam Ravnborg 516d34dd829SSam Ravnborg manuf = ((ver >> 48) & 0xffff); 517d34dd829SSam Ravnborg impl = ((ver >> 32) & 0xffff); 518d34dd829SSam Ravnborg set_cpu_and_fpu(manuf, impl, impl); 519d34dd829SSam Ravnborg } 520d34dd829SSam Ravnborg return 0; 521d34dd829SSam Ravnborg } 5229c2853afSSam Ravnborg #endif /* CONFIG_SPARC64 */ 523d34dd829SSam Ravnborg 5245edddaabSDavid S. Miller early_initcall(cpu_type_probe); 525