mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Extend identifycpu():
o Differentiate between CPU family and CPU model. There are multiple Itanium 2 models and it's nice to differentiate between them. o Seperately export the CPU family and CPU model with sysctl. o Merced is the only model in the Itanium family. o Add Madison to the Itanium 2 family. We already knew about McKinley. o Print the CPU family between parenthesis, like we do with the i386 CPU class. My prototype now identifies itself as: CPU: Merced (800.03-Mhz Itanium) pluto1 and pluto2 will eventually identify themselves as: CPU: McKinley (900.00-Mhz Itanium 2)
This commit is contained in:
parent
b29699fe04
commit
75cf31a016
1 changed files with 36 additions and 17 deletions
|
|
@ -117,8 +117,13 @@ u_int64_t ia64_port_base;
|
|||
char machine[] = MACHINE;
|
||||
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, "");
|
||||
|
||||
static char cpu_model[128];
|
||||
SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, cpu_model, 0, "");
|
||||
static char cpu_model[64];
|
||||
SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, cpu_model, 0,
|
||||
"The CPU model name");
|
||||
|
||||
static char cpu_family[64];
|
||||
SYSCTL_STRING(_hw, OID_AUTO, family, CTLFLAG_RD, cpu_family, 0,
|
||||
"The CPU family name");
|
||||
|
||||
#ifdef DDB
|
||||
/* start and end of kernel symbol table */
|
||||
|
|
@ -145,6 +150,7 @@ static void
|
|||
identifycpu(void)
|
||||
{
|
||||
char vendor[17];
|
||||
char *family_name, *model_name;
|
||||
u_int64_t t;
|
||||
int number, revision, model, family, archrev;
|
||||
u_int64_t features;
|
||||
|
|
@ -163,24 +169,37 @@ identifycpu(void)
|
|||
family = (t >> 24) & 0xff;
|
||||
archrev = (t >> 32) & 0xff;
|
||||
|
||||
if (family == 0x7)
|
||||
strcpy(cpu_model, "Itanium");
|
||||
else if (family == 0x1f)
|
||||
strcpy(cpu_model, "Itanium 2"); /* McKinley */
|
||||
else
|
||||
snprintf(cpu_model, sizeof(cpu_model), "Family=%d", family);
|
||||
family_name = model_name = "unknown";
|
||||
switch (family) {
|
||||
case 0x07:
|
||||
family_name = "Itanium";
|
||||
model_name = "Merced";
|
||||
break;
|
||||
case 0x1f:
|
||||
family_name = "Itanium 2";
|
||||
switch (model) {
|
||||
case 0x00:
|
||||
model_name = "McKinley";
|
||||
break;
|
||||
case 0x01:
|
||||
model_name = "Madison";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
snprintf(cpu_family, sizeof(cpu_family), "%s", family_name);
|
||||
snprintf(cpu_model, sizeof(cpu_model), "%s", model_name);
|
||||
|
||||
features = ia64_get_cpuid(4);
|
||||
|
||||
printf("CPU: %s", cpu_model);
|
||||
if (processor_frequency)
|
||||
printf(" (%ld.%02ld-Mhz)\n",
|
||||
(processor_frequency + 4999) / 1000000,
|
||||
((processor_frequency + 4999) / 10000) % 100);
|
||||
else
|
||||
printf("\n");
|
||||
printf(" Origin = \"%s\" Model = %d Revision = %d\n",
|
||||
vendor, model, revision);
|
||||
printf("CPU: %s (", model_name);
|
||||
if (processor_frequency) {
|
||||
printf("%ld.%02ld-Mhz ",
|
||||
(processor_frequency + 4999) / 1000000,
|
||||
((processor_frequency + 4999) / 10000) % 100);
|
||||
}
|
||||
printf("%s)\n", family_name);
|
||||
printf(" Origin = \"%s\" Revision = %d\n", vendor, revision);
|
||||
printf(" Features = 0x%b\n", (u_int32_t) features,
|
||||
"\020"
|
||||
"\001LB" /* long branch (brl) instruction. */
|
||||
|
|
|
|||
Loading…
Reference in a new issue