NetBSD-Bugs archive

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

re: bin/41289: usr.sbin/cpuctl does not correctly identify new Intel CPUs



hmm, i thought i send a PR about this already, but apparently not.

this is an ugly patch i've been using... it needs work before i was
even going to consider commiting it however..


.mrg.


Index: arch/i386.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/cpuctl/arch/i386.c,v
retrieving revision 1.16
diff -p -r1.16 i386.c
*** arch/i386.c 16 Mar 2009 12:25:40 -0000      1.16
--- arch/i386.c 28 Apr 2009 00:06:24 -0000
*************** struct cpu_cpuid_nameclass {
*** 133,139 ****
                void (*cpu_setup)(struct cpu_info *);
                void (*cpu_probe)(struct cpu_info *);
                void (*cpu_info)(struct cpu_info *);
!       } cpu_family[CPU_MAXFAMILY - CPU_MINFAMILY + 1];
  };
  
  static const struct x86_cache_info intel_cpuid_cache_info[] = 
INTEL_CACHE_INFO;
--- 133,139 ----
                void (*cpu_setup)(struct cpu_info *);
                void (*cpu_probe)(struct cpu_info *);
                void (*cpu_info)(struct cpu_info *);
!       } cpu_family[CPU_MAXFAMILY - CPU_MINFAMILY + 1 /* XXX */ + 1];
  };
  
  static const struct x86_cache_info intel_cpuid_cache_info[] = 
INTEL_CACHE_INFO;
*************** const struct cpu_cpuid_nameclass i386_cp
*** 303,308 ****
--- 303,323 ----
                        NULL,
                        intel_family_new_probe,
                        NULL,
+               },
+               /* Extended Model 1, Family 6 */
+               {
+                       CPUCLASS_686,
+                       {
+                               0, 0, 0, 0, 0, 0, 0,
+                               "Core2 (Yorkfield)",
+                               0, 0, 
+                               "Core2 (Wolfdale)",
+                               0, 0, 0, 0, 0,
+                               "Core2" /* Default */
+                       },
+                       NULL,
+                       intel_family_new_probe,
+                       NULL,
                } }
        },
        {
*************** identifycpu(const char *cpuname)
*** 1183,1189 ****
  {
        const char *name, *modifier, *vendorname, *brand = "";
        int class = CPUCLASS_386, i, xmax;
!       int modif, family, model;
        const struct cpu_cpuid_nameclass *cpup = NULL;
        const struct cpu_cpuid_family *cpufam;
        const char *feature_str[5];
--- 1198,1204 ----
  {
        const char *name, *modifier, *vendorname, *brand = "";
        int class = CPUCLASS_386, i, xmax;
!       int modif, family, model, extmodel;
        const struct cpu_cpuid_nameclass *cpup = NULL;
        const struct cpu_cpuid_family *cpufam;
        const char *feature_str[5];
*************** identifycpu(const char *cpuname)
*** 1216,1221 ****
--- 1231,1237 ----
                family = CPUID2FAMILY(ci->ci_signature);
                if (family < CPU_MINFAMILY)
                        errx(1, "identifycpu: strange family value");
+               extmodel = CPUID2EXTMODEL(ci->ci_signature);
                model = CPUID2MODEL(ci->ci_signature);
  
                for (i = 0; i < xmax; i++) {
*************** identifycpu(const char *cpuname)
*** 1242,1248 ****
                        cpu_vendor = cpup->cpu_vendor;
                        vendorname = cpup->cpu_vendorname;
                        modifier = modifiers[modif];
!                       if (family > CPU_MAXFAMILY) {
                                family = CPU_MAXFAMILY;
                                model = CPU_DEFMODEL;
                        } else if (model > CPU_MAXMODEL)
--- 1258,1270 ----
                        cpu_vendor = cpup->cpu_vendor;
                        vendorname = cpup->cpu_vendorname;
                        modifier = modifiers[modif];
!                       if (cpu_vendor == CPUVENDOR_INTEL) {
!                               /* XXX */
!                               if (extmodel == 1 && family == 6) {
!                                       family = CPU_MAXFAMILY + 1;
!                                       model = 
CPUID2STEPPING(ci->ci_signature);
!                               }
!                       } else if (family > CPU_MAXFAMILY) {
                                family = CPU_MAXFAMILY;
                                model = CPU_DEFMODEL;
                        } else if (model > CPU_MAXMODEL)


Home | Main Index | Thread Index | Old Index