identcpu.c revision 86522
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 * $FreeBSD: head/sys/sparc64/sparc64/identcpu.c 86522 2001-11-18 03:05:56Z jake $ 10 */ 11#include <sys/param.h> 12#include <sys/systm.h> 13#include <sys/kernel.h> 14#include <sys/sysctl.h> 15 16#include <machine/cpufunc.h> 17#include <machine/md_var.h> 18#include <machine/ver.h> 19 20static char machine[] = "sparc64"; 21SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, 22 machine, 0, "Machine class"); 23 24static char cpu_model[128]; 25SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, 26 cpu_model, 0, "Machine model"); 27 28void 29cpu_identify(unsigned int freq) 30{ 31 const char *manus; 32 const char *impls; 33 unsigned long vers; 34 35 manus = NULL; 36 impls = NULL; 37 vers = rdpr(ver); 38 39 switch (VER_MANUF(vers)) { 40 case 0x04: 41 manus = "HAL"; 42 break; 43 case 0x13: 44 case 0x17: 45 manus = "Sun Microsystems"; 46 break; 47 } 48 switch (VER_IMPL(vers)) { 49 case 0x01: 50 impls = "SPARC64"; 51 break; 52 case 0x10: 53 impls = "UltraSparc-I"; 54 break; 55 case 0x11: 56 impls = "UltraSparc-II"; 57 break; 58 case 0x12: 59 impls = "UltraSparc-IIi"; 60 break; 61 case 0x13: 62 /* V9 Manual says `UltraSparc-e'. I assume this is wrong. */ 63 impls = "UltraSparc-IIe"; 64 break; 65 } 66 if (manus == NULL || impls == NULL) { 67 printf( 68 "CPU: unknown; please e-mail the following value together\n" 69 " with the exact name of your processor to " 70 "<freebsd-sparc@FreeBSD.org>.\n" 71 " version register: <0x%lx>\n", vers); 72 return; 73 } 74 75 snprintf(cpu_model, sizeof(cpu_model), "%s %s", manus, impls); 76 printf("CPU: %s %s Processor (%d.%02d MHZ CPU)\n", manus, impls, 77 (freq + 4999) / 1000000, ((freq + 4999) / 10000) % 100); 78 if (bootverbose) { 79 printf(" mask=0x%lx maxtl=%ld maxwin=%ld\n", VER_MASK(vers), 80 VER_MAXTL(vers), VER_MAXWIN(vers)); 81 } 82} 83