Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/cpuctl/arch Use full model number to index name str...



details:   https://anonhg.NetBSD.org/src/rev/c0b003a6ef4e
branches:  trunk
changeset: 783746:c0b003a6ef4e
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sun Jan 06 23:17:35 2013 +0000

description:
Use full model number to index name strings - a lot of 256 element arrays
don't matter in usespace.
Update list of intel family 6 model names (all current cpus) to include
everything upto and including sandy bridge and ivy bridge.
My i7 is no longer reported as a random P II.

diffstat:

 usr.sbin/cpuctl/arch/i386.c |  206 ++++++++++++++++---------------------------
 1 files changed, 76 insertions(+), 130 deletions(-)

diffs (truncated from 540 to 300 lines):

diff -r 6bc307d628c2 -r c0b003a6ef4e usr.sbin/cpuctl/arch/i386.c
--- a/usr.sbin/cpuctl/arch/i386.c       Sun Jan 06 22:37:36 2013 +0000
+++ b/usr.sbin/cpuctl/arch/i386.c       Sun Jan 06 23:17:35 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i386.c,v 1.36 2013/01/05 21:16:22 dsl Exp $    */
+/*     $NetBSD: i386.c,v 1.37 2013/01/06 23:17:35 dsl Exp $    */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.36 2013/01/05 21:16:22 dsl Exp $");
+__RCSID("$NetBSD: i386.c,v 1.37 2013/01/06 23:17:35 dsl Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -127,22 +127,17 @@
        void (*cpu_info)(struct cpu_info *);
 };
 
-struct cpu_extend_nameclass {
-       int ext_model;
-       const char *cpu_models[CPU_MAXMODEL+1];
-};
-
 struct cpu_cpuid_nameclass {
        const char *cpu_id;
        int cpu_vendor;
        const char *cpu_vendorname;
        struct cpu_cpuid_family {
                int cpu_class;
-               const char *cpu_models[CPU_MAXMODEL+2];
+               const char *cpu_models[256];
+               const char *cpu_model_default;
                void (*cpu_setup)(struct cpu_info *);
                void (*cpu_probe)(struct cpu_info *);
                void (*cpu_info)(struct cpu_info *);
-               struct cpu_extend_nameclass *cpu_extended_names;
        } cpu_family[CPU_MAXFAMILY - CPU_MINFAMILY + 1];
 };
 
@@ -248,21 +243,6 @@
        ""
 };
 
-struct cpu_extend_nameclass intel_family6_ext_models[] = {
-       { /* Extended models 1x */
-         0x01, { NULL,                 NULL,
-                 NULL,                 NULL,
-                 NULL,                 "EP80579 Integrated Processor",
-                 "Celeron (45nm)",     "Core 2 Extreme",
-                 NULL,                 NULL,
-                 "Core i7 (Nehalem)",  NULL,
-                 "Atom",               "XeonMP (Nehalem)",
-                  NULL,                NULL} },
-       { /* End of list */
-         0x00, { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} }
-};
-
 const struct cpu_cpuid_nameclass i386_cpuid_cpus[] = {
        {
                "GenuineIntel",
@@ -275,9 +255,8 @@
                                "486DX", "486DX", "486SX", "486DX2", "486SL",
                                "486SX2", 0, "486DX2 W/B Enhanced",
                                "486DX4", 0, 0, 0, 0, 0, 0, 0,
-                               "486"           /* Default */
                        },
-                       NULL,
+                       "486",          /* Default */
                        NULL,
                        NULL,
                        NULL,
@@ -291,9 +270,8 @@
                                "Pentium/MMX", "Pentium", 0,
                                "Pentium (P54C)", "Pentium/MMX (Tillamook)",
                                0, 0, 0, 0, 0, 0, 0,
-                               "Pentium"       /* Default */
                        },
-                       NULL,
+                       "Pentium",      /* Default */
                        NULL,
                        NULL,
                        NULL,
@@ -302,24 +280,46 @@
                {
                        CPUCLASS_686,
                        {
-                               "Pentium Pro (A-step)", "Pentium Pro", 0,
-                               "Pentium II (Klamath)", "Pentium Pro",
-                               "Pentium II/Celeron (Deschutes)",
-                               "Celeron (Mendocino)",
-                               "Pentium III (Katmai)",
-                               "Pentium III (Coppermine)",
-                               "Pentium M (Banias)", 
-                               "Pentium III Xeon (Cascades)",
-                               "Pentium III (Tualatin)", 0,
-                               "Pentium M (Dothan)", 
-                               "Pentium M (Yonah)",
-                               "Core 2",
-                               "Pentium Pro, II or III"        /* Default */
+                               /* Updated from intel_x86_325486.pdf Aug 2012 */
+                               [0x00] = "Pentium Pro (A-step)",
+                               [0x01] = "Pentium Pro",
+                               [0x03] = "Pentium II (Klamath)",
+                               [0x04] = "Pentium Pro",
+                               [0x05] = "Pentium II/Celeron (Deschutes)",
+                               [0x06] = "Celeron (Mendocino)",
+                               [0x07] = "Pentium III (Katmai)",
+                               [0x08] = "Pentium III (Coppermine)",
+                               [0x09] = "Pentium M (Banias)", 
+                               [0x0a] = "Pentium III Xeon (Cascades)",
+                               [0x0b] = "Pentium III (Tualatin)",
+                               [0x0d] = "Pentium M (Dothan)", 
+                               [0x0e] = "Pentium Core Duo", // "M (Yonah)",
+                               [0x0f] = "Core 2",
+                               [0x15] = "EP80579 Integrated Processor",
+                               [0x16] = "Celeron (45nm)",
+                               [0x17] = "Core 2 Extreme",
+                               [0x1a] = "Core i7 (Nehalem)",
+                               [0x1c] = "Atom Family",
+                               [0x1d] = "XeonMP 74xx (Nehalem)",
+                               [0x1e] = "Core i7 and i5",
+                               [0x1f] = "Core i7 and i5",
+                               [0x25] = "Xeon 36xx & 56xx, i7, i5 and i3",
+                               [0x26] = "Atom Family",
+                               [0x27] = "Atom Family",
+                               [0x2a] = "Xeon E3-12xx, 2nd gen i7, i5, i3 2xxx",
+                               [0x2c] = "Xeon 36xx & 56xx, i7, i5 and i3",
+                               [0x2e] = "Xeon 75xx & 65xx",
+                               [0x2d] = "Xeon E5 Sandy bridy family",
+                               [0x2f] = "Xeon E7 family",
+                               [0x3a] = "Xeon E3-1200v2 and 3rd gen core, Ivy bridge",
+                               [0x3c] = "Next Intel Core",
+                               [0x3e] = "Next gen Xeon E5, Ivy bridge",
+                               [0x45] = "Next Intel Core",
                        },
+                       "Pentium Pro, II or III",       /* Default */
                        NULL,
                        intel_family_new_probe,
                        NULL,
-                       &intel_family6_ext_models[0],
                },
                /* Family > 6 */
                {
@@ -327,12 +327,11 @@
                        {
                                0, 0, 0, 0, 0, 0, 0, 0,
                                0, 0, 0, 0, 0, 0, 0, 0,
-                               "Pentium 4"     /* Default */
                        },
+                       "Pentium 4",    /* Default */
                        NULL,
                        intel_family_new_probe,
                        NULL,
-                       NULL,
                } }
        },
        {
@@ -349,9 +348,8 @@
                                "Am486DX4 W/B or Am5x86 W/B 150", 0, 0,
                                0, 0, "Am5x86 W/T 133/160",
                                "Am5x86 W/B 133/160",
-                               "Am486 or Am5x86"       /* Default */
                        },
-                       NULL,
+                       "Am486 or Am5x86",      /* Default */
                        NULL,
                        NULL,
                        NULL,
@@ -363,12 +361,11 @@
                                "K5", "K5", "K5", "K5", 0, 0, "K6",
                                "K6", "K6-2", "K6-III", "Geode LX", 0, 0,
                                "K6-2+/III+", 0, 0,
-                               "K5 or K6"              /* Default */
                        },
+                       "K5 or K6",             /* Default */
                        amd_family5_setup,
                        NULL,
                        amd_cpu_cacheinfo,
-                       NULL,
                },
                /* Family 6 */
                {
@@ -378,12 +375,11 @@
                                "Duron", "Athlon Model 4 (Thunderbird)",
                                0, "Athlon", "Duron", "Athlon", 0,
                                "Athlon", 0, 0, 0, 0, 0,
-                               "K7 (Athlon)"   /* Default */
                        },
+                       "K7 (Athlon)",  /* Default */
                        NULL,
                        amd_family6_probe,
                        amd_cpu_cacheinfo,
-                       NULL,
                },
                /* Family > 6 */
                {
@@ -391,12 +387,11 @@
                        {
                                0, 0, 0, 0, 0, 0, 0, 0,
                                0, 0, 0, 0, 0, 0, 0, 0,
-                               "Unknown K8 (Athlon)"   /* Default */
                        },
+                       "Unknown K8 (Athlon)",  /* Default */
                        NULL,
                        amd_family6_probe,
                        amd_cpu_cacheinfo,
-                       NULL,
                } }
        },
        {
@@ -410,12 +405,11 @@
                                0, 0, 0,
                                "MediaGX",
                                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                               "486"           /* Default */
                        },
+                       "486",          /* Default */
                        cyrix6x86_cpu_setup, /* XXX ?? */
                        NULL,
                        NULL,
-                       NULL,
                },
                /* Family 5 */
                {
@@ -424,12 +418,11 @@
                                0, 0, "6x86", 0,
                                "MMX-enhanced MediaGX (GXm)", /* or Geode? */
                                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                               "6x86"          /* Default */
                        },
+                       "6x86",         /* Default */
                        cyrix6x86_cpu_setup,
                        NULL,
                        NULL,
-                       NULL,
                },
                /* Family 6 */
                {
@@ -437,12 +430,11 @@
                        {
                                "6x86MX", 0, 0, 0, 0, 0, 0, 0,
                                0, 0, 0, 0, 0, 0, 0, 0,
-                               "6x86MX"                /* Default */
                        },
+                       "6x86MX",               /* Default */
                        cyrix6x86_cpu_setup,
                        NULL,
                        NULL,
-                       NULL,
                },
                /* Family > 6 */
                {
@@ -450,9 +442,8 @@
                        {
                                0, 0, 0, 0, 0, 0, 0, 0,
                                0, 0, 0, 0, 0, 0, 0, 0,
-                               "Unknown 6x86MX"                /* Default */
                        },
-                       NULL,
+                       "Unknown 6x86MX",               /* Default */
                        NULL,
                        NULL,
                        NULL,
@@ -468,9 +459,8 @@
                        {
                                0, 0, 0, 0, 0, 0, 0, 0,
                                0, 0, 0, 0, 0, 0, 0, 0,
-                               "486 compatible"        /* Default */
                        },
-                       NULL,
+                       "486 compatible",       /* Default */
                        NULL,
                        NULL,
                        NULL,
@@ -482,12 +472,11 @@
                                0, 0, 0, 0,
                                "Geode GX1",
                                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                               "Geode"         /* Default */
                        },
+                       "Geode",                /* Default */
                        cyrix6x86_cpu_setup,
                        NULL,
                        amd_cpu_cacheinfo,
-                       NULL,
                },
                /* Family 6, not yet available from NSC */
                {
@@ -495,9 +484,8 @@
                        {
                                0, 0, 0, 0, 0, 0, 0, 0,
                                0, 0, 0, 0, 0, 0, 0, 0,
-                               "Pentium Pro compatible" /* Default */
                        },
-                       NULL,



Home | Main Index | Thread Index | Old Index