]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/sparc64/sparc64/identcpu.c
This commit was generated by cvs2svn to compensate for changes in r159952,
[FreeBSD/FreeBSD.git] / sys / sparc64 / sparc64 / identcpu.c
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$
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 setPQL2(int *const size, int *const ways);
31
32 void
33 setPQL2(int *const size, int *const ways)
34 {
35         return;
36 }
37
38 void
39 cpu_identify(u_long vers, u_int freq, u_int id)
40 {
41         const char *manus;
42         const char *impls;
43
44         switch (VER_MANUF(vers)) {
45         case 0x04:
46                 manus = "HAL";
47                 break;
48         case 0x13:
49         case 0x17:
50         case 0x22:
51         case 0x3e:
52                 manus = "Sun Microsystems";
53                 break;
54         default:
55                 manus = NULL;
56                 break;
57         }
58         switch (VER_IMPL(vers)) {
59         case CPU_IMPL_SPARC64:
60                 impls = "SPARC64";
61                 break;
62         case CPU_IMPL_ULTRASPARCI:
63                 impls = "UltraSparc-I";
64                 break;
65         case CPU_IMPL_ULTRASPARCII:
66                 impls = "UltraSparc-II";
67                 break;
68         case CPU_IMPL_ULTRASPARCIIi:
69                 impls = "UltraSparc-IIi";
70                 break;
71         case CPU_IMPL_ULTRASPARCIIe:
72                 /* V9 Manual says `UltraSparc-e'.  I assume this is wrong. */
73                 impls = "UltraSparc-IIe";
74                 break;
75         case CPU_IMPL_ULTRASPARCIII:
76                 impls = "UltraSparc-III";
77                 break;
78         case CPU_IMPL_ULTRASPARCIIIp:
79                 impls = "UltraSparc-III+";
80                 break;
81         case CPU_IMPL_ULTRASPARCIIIi:
82                 impls = "UltraSparc-IIIi";
83                 break;
84         default:
85                 impls = NULL;
86                 break;
87         }
88         if (manus == NULL || impls == NULL) {
89                 printf(
90                     "CPU: unknown; please e-mail the following value together\n"
91                     "     with the exact name of your processor to "
92                     "<freebsd-sparc64@FreeBSD.org>.\n"
93                     "     version register: <0x%lx>\n", vers);
94                 return;
95         }
96
97         snprintf(cpu_model, sizeof(cpu_model), "%s %s", manus, impls);
98         printf("cpu%d: %s %s Processor (%d.%02d MHz CPU)\n", id, manus, impls,
99             (freq + 4999) / 1000000, ((freq + 4999) / 10000) % 100);
100         if (bootverbose) {
101                 printf("  mask=0x%lx maxtl=%ld maxwin=%ld\n", VER_MASK(vers),
102                     VER_MAXTL(vers), VER_MAXWIN(vers));
103         }
104 }