diff options
author | Tony Luck <tony.luck@intel.com> | 2006-06-05 16:54:14 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2006-06-05 16:54:14 -0400 |
commit | 76d08bb3f09054edc45326ce5c698a3f6c45f5d0 (patch) | |
tree | 5d0197f8ad8e4f778d6f117bcf49f9467fcdc0dd /arch | |
parent | 672c6108a51bf559d19595d9f8193dfd81f0f752 (diff) |
[IA64] Add "model name" to /proc/cpuinfo
Linux ia64 port tried to decode the processor family number
to something human-readable, but Intel brandnames don't change
synchronously with updates to the family number. Adopt a more
i386-like approach and just print the family number in decimal.
Add a new field "model name" that uses PAL_BRAND_INFO to find
the official name for the cpu, or on older systems, falls back
to using the well-known codenames (Merced, McKinley, Madison).
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ia64/kernel/setup.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index e4dfda1eb7dd..3f7067c68b08 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c | |||
@@ -509,7 +509,7 @@ show_cpuinfo (struct seq_file *m, void *v) | |||
509 | { 1UL << 1, "spontaneous deferral"}, | 509 | { 1UL << 1, "spontaneous deferral"}, |
510 | { 1UL << 2, "16-byte atomic ops" } | 510 | { 1UL << 2, "16-byte atomic ops" } |
511 | }; | 511 | }; |
512 | char family[32], features[128], *cp, sep; | 512 | char features[128], *cp, sep; |
513 | struct cpuinfo_ia64 *c = v; | 513 | struct cpuinfo_ia64 *c = v; |
514 | unsigned long mask; | 514 | unsigned long mask; |
515 | unsigned long proc_freq; | 515 | unsigned long proc_freq; |
@@ -517,12 +517,6 @@ show_cpuinfo (struct seq_file *m, void *v) | |||
517 | 517 | ||
518 | mask = c->features; | 518 | mask = c->features; |
519 | 519 | ||
520 | switch (c->family) { | ||
521 | case 0x07: memcpy(family, "Itanium", 8); break; | ||
522 | case 0x1f: memcpy(family, "Itanium 2", 10); break; | ||
523 | default: sprintf(family, "%u", c->family); break; | ||
524 | } | ||
525 | |||
526 | /* build the feature string: */ | 520 | /* build the feature string: */ |
527 | memcpy(features, " standard", 10); | 521 | memcpy(features, " standard", 10); |
528 | cp = features; | 522 | cp = features; |
@@ -553,8 +547,9 @@ show_cpuinfo (struct seq_file *m, void *v) | |||
553 | "processor : %d\n" | 547 | "processor : %d\n" |
554 | "vendor : %s\n" | 548 | "vendor : %s\n" |
555 | "arch : IA-64\n" | 549 | "arch : IA-64\n" |
556 | "family : %s\n" | 550 | "family : %u\n" |
557 | "model : %u\n" | 551 | "model : %u\n" |
552 | "model name : %s\n" | ||
558 | "revision : %u\n" | 553 | "revision : %u\n" |
559 | "archrev : %u\n" | 554 | "archrev : %u\n" |
560 | "features :%s\n" /* don't change this---it _is_ right! */ | 555 | "features :%s\n" /* don't change this---it _is_ right! */ |
@@ -563,7 +558,8 @@ show_cpuinfo (struct seq_file *m, void *v) | |||
563 | "cpu MHz : %lu.%06lu\n" | 558 | "cpu MHz : %lu.%06lu\n" |
564 | "itc MHz : %lu.%06lu\n" | 559 | "itc MHz : %lu.%06lu\n" |
565 | "BogoMIPS : %lu.%02lu\n", | 560 | "BogoMIPS : %lu.%02lu\n", |
566 | cpunum, c->vendor, family, c->model, c->revision, c->archrev, | 561 | cpunum, c->vendor, c->family, c->model, |
562 | c->model_name, c->revision, c->archrev, | ||
567 | features, c->ppn, c->number, | 563 | features, c->ppn, c->number, |
568 | proc_freq / 1000, proc_freq % 1000, | 564 | proc_freq / 1000, proc_freq % 1000, |
569 | c->itc_freq / 1000000, c->itc_freq % 1000000, | 565 | c->itc_freq / 1000000, c->itc_freq % 1000000, |
@@ -611,6 +607,31 @@ struct seq_operations cpuinfo_op = { | |||
611 | .show = show_cpuinfo | 607 | .show = show_cpuinfo |
612 | }; | 608 | }; |
613 | 609 | ||
610 | static char brandname[128]; | ||
611 | |||
612 | static char * __cpuinit | ||
613 | get_model_name(__u8 family, __u8 model) | ||
614 | { | ||
615 | char brand[128]; | ||
616 | |||
617 | if (ia64_pal_get_brand_info(brand)) { | ||
618 | if (family == 0x7) | ||
619 | memcpy(brand, "Merced", 7); | ||
620 | else if (family == 0x1f) switch (model) { | ||
621 | case 0: memcpy(brand, "McKinley", 9); break; | ||
622 | case 1: memcpy(brand, "Madison", 8); break; | ||
623 | case 2: memcpy(brand, "Madison up to 9M cache", 23); break; | ||
624 | } else | ||
625 | memcpy(brand, "Unknown", 8); | ||
626 | } | ||
627 | if (brandname[0] == '\0') | ||
628 | return strcpy(brandname, brand); | ||
629 | else if (strcmp(brandname, brand) == 0) | ||
630 | return brandname; | ||
631 | else | ||
632 | return kstrdup(brand, GFP_KERNEL); | ||
633 | } | ||
634 | |||
614 | static void __cpuinit | 635 | static void __cpuinit |
615 | identify_cpu (struct cpuinfo_ia64 *c) | 636 | identify_cpu (struct cpuinfo_ia64 *c) |
616 | { | 637 | { |
@@ -640,7 +661,6 @@ identify_cpu (struct cpuinfo_ia64 *c) | |||
640 | pal_status_t status; | 661 | pal_status_t status; |
641 | unsigned long impl_va_msb = 50, phys_addr_size = 44; /* Itanium defaults */ | 662 | unsigned long impl_va_msb = 50, phys_addr_size = 44; /* Itanium defaults */ |
642 | int i; | 663 | int i; |
643 | |||
644 | for (i = 0; i < 5; ++i) | 664 | for (i = 0; i < 5; ++i) |
645 | cpuid.bits[i] = ia64_get_cpuid(i); | 665 | cpuid.bits[i] = ia64_get_cpuid(i); |
646 | 666 | ||
@@ -663,6 +683,7 @@ identify_cpu (struct cpuinfo_ia64 *c) | |||
663 | c->family = cpuid.field.family; | 683 | c->family = cpuid.field.family; |
664 | c->archrev = cpuid.field.archrev; | 684 | c->archrev = cpuid.field.archrev; |
665 | c->features = cpuid.field.features; | 685 | c->features = cpuid.field.features; |
686 | c->model_name = get_model_name(c->family, c->model); | ||
666 | 687 | ||
667 | status = ia64_pal_vm_summary(&vm1, &vm2); | 688 | status = ia64_pal_vm_summary(&vm1, &vm2); |
668 | if (status == PAL_STATUS_SUCCESS) { | 689 | if (status == PAL_STATUS_SUCCESS) { |