tech-kern archive

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

re: adding machdep frequency support?



   $ sudo cpuctl identify 0 
   cpu0: Intel Pentium III (Katmai) (686-class), 2261.35 MHz, id 0x10676
   
   ** I think this is identified partially wrong **

i've got a patch that sort-of helps this but it's really gross and
i do not like it very much.  i've included it at the end.
   
   cpu0: features 
   0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR>
   cpu0: features 0xbfebfbff<PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX>
   cpu0: features 0xbfebfbff<FXSR,SSE,SSE2,SS,HTT,TM,SBF>
   cpu0: features2 
   
0x8e3fd<SSE3,DTES64,MONITOR,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE41>
   
   ** Has EST **
   
   cpu0: features3 0x20100800<SYSCALL/SYSRET,XD,EM64T>
   cpu0: "Intel(R) Core(TM)2 Duo CPU     P8400  @ 2.26GHz"
   
   ** P8400 is correct according to Toshiba's webpage for this laptop **

yeah this looks right -- also a "Penryn-3M".
   
   cpu0: I-cache 32KB 64B/line 8-way, D-cache 32KB 64B/line 8-way
   cpu0: ITLB 128 4KB entries 4-way
   cpu0: DTLB 256 4KB entries 4-way, 32 4MB entries 4-way
   cpu0: Initial APIC ID 0
   cpu0: Cluster/Package ID 0
   cpu0: Core ID 0
   cpu0: family 06 model 07 extfamily 00 extmodel 01
   
   I started looking at sys/arch/x86/x86/est.c but I am not sure what is 
   needed for this.
   
   Also my tests are with NetBSD/amd64 5.0_RC3, have not tried HEAD yet.

my yorkfield system has entirely broken EST in it, among other
issues...:

cpu0 at mainbus0 apid 0: Intel 686-class, 43624MHz, id 0x10677
cpu0: Enhanced SpeedStep (1148 mV) 800 MHz
cpu0: Enhanced SpeedStep frequencies available (MHz): 800 800 700
cpu1 at mainbus0 apid 1: Intel 686-class, 43624MHz, id 0x10677
cpu2 at mainbus0 apid 2: Intel 686-class, 43624MHz, id 0x10677
cpu3 at mainbus0 apid 3: Intel 686-class, 43624MHz, id 0x10677

it should be 2.66ghz, as most prior boots show, but the EST lines
are really wrong.  i don't know what it really should be capable
of running at, and have not had any desire to look closer...


.mrg.


Index: usr.sbin/cpuctl/arch/i386.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/cpuctl/arch/i386.c,v
retrieving revision 1.16
diff -p -r1.16 i386.c
*** usr.sbin/cpuctl/arch/i386.c 16 Mar 2009 12:25:40 -0000      1.16
--- usr.sbin/cpuctl/arch/i386.c 1 Apr 2009 06:02:38 -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