diff options
author | marcel <marcel@FreeBSD.org> | 2003-08-12 08:10:16 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2003-08-12 08:10:16 +0000 |
commit | cb02f3b09ac035998dd09825ae517ffa44cac0bd (patch) | |
tree | 178ec090922e60984c25dc43bd6f4420fcf883b4 /sys/ia64 | |
parent | c5eb02d5020a375e2b5a9469337208f0453d4118 (diff) | |
download | FreeBSD-src-cb02f3b09ac035998dd09825ae517ffa44cac0bd.zip FreeBSD-src-cb02f3b09ac035998dd09825ae517ffa44cac0bd.tar.gz |
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)
Diffstat (limited to 'sys/ia64')
-rw-r--r-- | sys/ia64/ia64/machdep.c | 53 |
1 files changed, 36 insertions, 17 deletions
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c index ec3c33f..653ceec 100644 --- a/sys/ia64/ia64/machdep.c +++ b/sys/ia64/ia64/machdep.c @@ -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. */ |