Define constants for the CPU implementation id; export the dectected id

as cpu_impl.
This commit is contained in:
Thomas Moestl 2002-02-13 15:47:12 +00:00
parent 95c7d7d47e
commit 68716de3ec
2 changed files with 18 additions and 6 deletions

View File

@ -58,4 +58,13 @@
#define VER_MAXWIN(ver) \
(((ver) & VER_MAXWIN_MASK) >> VER_MAXWIN_SHIFT)
extern int cpu_impl;
/* Known implementations. */
#define CPU_IMPL_SPARC64 0x01
#define CPU_IMPL_ULTRASPARCI 0x10
#define CPU_IMPL_ULTRASPARCII 0x11
#define CPU_IMPL_ULTRASPARCIIi 0x12
#define CPU_IMPL_ULTRASPARCIIe 0x13
#endif /* !_MACHINE_VER_H_ */

View File

@ -25,6 +25,8 @@ static char cpu_model[128];
SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD,
cpu_model, 0, "Machine model");
int cpu_impl;
void
cpu_identify(unsigned int freq)
{
@ -46,20 +48,21 @@ cpu_identify(unsigned int freq)
manus = "Sun Microsystems";
break;
}
switch (VER_IMPL(vers)) {
case 0x01:
cpu_impl = VER_IMPL(vers);
switch (cpu_impl) {
case CPU_IMPL_SPARC64:
impls = "SPARC64";
break;
case 0x10:
case CPU_IMPL_ULTRASPARCI:
impls = "UltraSparc-I";
break;
case 0x11:
case CPU_IMPL_ULTRASPARCII:
impls = "UltraSparc-II";
break;
case 0x12:
case CPU_IMPL_ULTRASPARCIIi:
impls = "UltraSparc-IIi";
break;
case 0x13:
case CPU_IMPL_ULTRASPARCIIe:
/* V9 Manual says `UltraSparc-e'. I assume this is wrong. */
impls = "UltraSparc-IIe";
break;