identcpu.c revision 179229
1/*- 2 * Initial implementation: 3 * Copyright (c) 2001 Robert Drehmel 4 * All rights reserved. 5 * 6 * As long as the above copyright statement and this notice remain 7 * unchanged, you can do what ever you want with this file. 8 */ 9 10#include <sys/cdefs.h> 11__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/identcpu.c 179229 2008-05-23 04:03:54Z alc $"); 12 13#include <sys/param.h> 14#include <sys/systm.h> 15#include <sys/kernel.h> 16#include <sys/sysctl.h> 17 18#include <machine/cpufunc.h> 19#include <machine/md_var.h> 20#include <machine/ver.h> 21 22char machine[] = MACHINE; 23SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, 24 machine, 0, "Machine class"); 25 26static char cpu_model[128]; 27SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, 28 cpu_model, 0, "Machine model"); 29 30int cpu_impl; 31 32void 33cpu_identify(u_long vers, u_int freq, u_int id) 34{ 35 const char *manus; 36 const char *impls; 37 38 switch (VER_MANUF(vers)) { 39 case 0x04: 40 manus = "HAL"; 41 break; 42 case 0x13: 43 case 0x17: 44 case 0x22: 45 case 0x3e: 46 manus = "Sun Microsystems"; 47 break; 48 default: 49 manus = NULL; 50 break; 51 } 52 switch (VER_IMPL(vers)) { 53 case CPU_IMPL_SPARC64: 54 impls = "SPARC64"; 55 break; 56 case CPU_IMPL_ULTRASPARCI: 57 impls = "UltraSparc-I"; 58 break; 59 case CPU_IMPL_ULTRASPARCII: 60 impls = "UltraSparc-II"; 61 break; 62 case CPU_IMPL_ULTRASPARCIIi: 63 impls = "UltraSparc-IIi"; 64 break; 65 case CPU_IMPL_ULTRASPARCIIe: 66 /* V9 Manual says `UltraSparc-e'. I assume this is wrong. */ 67 impls = "UltraSparc-IIe"; 68 break; 69 case CPU_IMPL_ULTRASPARCIII: 70 impls = "UltraSparc-III"; 71 break; 72 case CPU_IMPL_ULTRASPARCIIIp: 73 impls = "UltraSparc-III+"; 74 break; 75 case CPU_IMPL_ULTRASPARCIIIi: 76 impls = "UltraSparc-IIIi"; 77 break; 78 case CPU_IMPL_ULTRASPARCIV: 79 impls = "UltraSparc-IV"; 80 break; 81 case CPU_IMPL_ULTRASPARCIVp: 82 impls = "UltraSparc-IV+"; 83 break; 84 case CPU_IMPL_ULTRASPARCIIIip: 85 impls = "UltraSparc-IIIi+"; 86 break; 87 default: 88 impls = NULL; 89 break; 90 } 91 if (manus == NULL || impls == NULL) { 92 printf( 93 "CPU: unknown; please e-mail the following value together\n" 94 " with the exact name of your processor to " 95 "<freebsd-sparc64@FreeBSD.org>.\n" 96 " version register: <0x%lx>\n", vers); 97 return; 98 } 99 100 snprintf(cpu_model, sizeof(cpu_model), "%s %s", manus, impls); 101 printf("cpu%d: %s %s Processor (%d.%02d MHz CPU)\n", id, manus, impls, 102 (freq + 4999) / 1000000, ((freq + 4999) / 10000) % 100); 103 if (bootverbose) { 104 printf(" mask=0x%lx maxtl=%ld maxwin=%ld\n", VER_MASK(vers), 105 VER_MAXTL(vers), VER_MAXWIN(vers)); 106 } 107} 108