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