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: releng/5.2/sys/sparc64/sparc64/identcpu.c 119291 2003-08-22 07:39:05Z imp $
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
20 char machine[] = "sparc64";
21 SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD,
22 machine, 0, "Machine class");
23
24 static char cpu_model[128];
25 SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD,
26 cpu_model, 0, "Machine model");
27
28 int cpu_impl;
29
30 void
31 cpu_identify(u_long vers, u_int freq, u_int id)
32 {
33 const char *manus;
34 const char *impls;
35
36 switch (VER_MANUF(vers)) {
37 case 0x04:
38 manus = "HAL";
39 break;
40 case 0x13:
41 case 0x17:
42 case 0x22:
43 case 0x3e:
44 manus = "Sun Microsystems";
45 break;
46 default:
47 manus = NULL;
48 break;
49 }
50 switch (VER_IMPL(vers)) {
51 case CPU_IMPL_SPARC64:
52 impls = "SPARC64";
53 break;
54 case CPU_IMPL_ULTRASPARCI:
55 impls = "UltraSparc-I";
56 break;
57 case CPU_IMPL_ULTRASPARCII:
58 impls = "UltraSparc-II";
59 break;
60 case CPU_IMPL_ULTRASPARCIIi:
61 impls = "UltraSparc-IIi";
62 break;
63 case CPU_IMPL_ULTRASPARCIIe:
64 /* V9 Manual says `UltraSparc-e'. I assume this is wrong. */
65 impls = "UltraSparc-IIe";
66 break;
67 case CPU_IMPL_ULTRASPARCIII:
68 impls = "UltraSparc-III";
69 break;
70 case CPU_IMPL_ULTRASPARCIIIp:
71 impls = "UltraSparc-III+";
72 break;
73 default:
74 impls = NULL;
75 break;
76 }
77 if (manus == NULL || impls == NULL) {
78 printf(
79 "CPU: unknown; please e-mail the following value together\n"
80 " with the exact name of your processor to "
81 "<freebsd-sparc@FreeBSD.org>.\n"
82 " version register: <0x%lx>\n", vers);
83 return;
84 }
85
86 snprintf(cpu_model, sizeof(cpu_model), "%s %s", manus, impls);
87 printf("cpu%d: %s %s Processor (%d.%02d MHz CPU)\n", id, manus, impls,
88 (freq + 4999) / 1000000, ((freq + 4999) / 10000) % 100);
89 if (bootverbose) {
90 printf(" mask=0x%lx maxtl=%ld maxwin=%ld\n", VER_MASK(vers),
91 VER_MAXTL(vers), VER_MAXWIN(vers));
92 }
93 }
Cache object: 3094348781ceae7790060af2d66d9e19
|