Subject: Re: port-i386/32864 (Pentium M 760 speedstep support)
To: None <port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: Neil Ludban <nludban@columbus.rr.com>
List: netbsd-bugs
Date: 03/05/2006 21:45:02
The following reply was made to PR port-i386/32864; it has been noted by GNATS.

From: Neil Ludban <nludban@columbus.rr.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-i386/32864 (Pentium M 760 speedstep support)
Date: Sun, 5 Mar 2006 16:38:22 -0500

 On Mon, 27 Feb 2006 19:27:35 +0000 (UTC)
 xtraeme@netbsd.org wrote:
 
 > Synopsis: Pentium M 760 speedstep support
 > 
 > State-Changed-From-To: open->closed
 > State-Changed-By: xtraeme@netbsd.org
 > State-Changed-When: Mon, 27 Feb 2006 19:27:34 +0000
 > State-Changed-Why:
 > Code committed. I've changed the Mhz values, please test -current!
 > thanks.
 
 
 Today I got a chance to checkout -current and build GENERIC_LAPTOP,
 and est failed to detect the processor:
 
 cpu0: Intel Pentium M (Dothan) (686-class), 1995.17 MHz, id 0x6d8
 cpu0: features afe9fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR>
 cpu0: features afe9fbff<PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX>
 cpu0: features afe9fbff<FXSR,SSE,SSE2,SS,TM,SBF>
 cpu0: features2 180<EST,TM2>
 cpu0: "Intel(R) Pentium(R) M processor 2.00GHz"
 cpu0: I-cache 32 KB 64B/line 8-way, D-cache 32 KB 64B/line 8-way
 cpu0: L2 cache 2 MB 64B/line 8-way
 cpu0: using thermal monitor 2
 cpu0: Enhanced SpeedStep running at 1500 MHz (1356 mV)
 cpu0: unknown Enhanced SpeedStep CPU
 
 
 After several rounds of hacking (see final diff below), I get:
 
 cpu0: Enhanced SpeedStep running at 1500 MHz (1356 mV)
 cpu0: looking for brand_string=(Intel(R) Pentium(R) M processor 2.00GHz) ci_cpuid=0
 cpu0: is not tag= 900 cpuid=0
 ...
 cpu0: is not tag=1.80 cpuid=0
 cpu0: Enhanced SpeedStep frequencies available (MHz): 1500 1200 1000 800 600
 
 
 The frequencies need to be reverted to the values in the original patch,
 otherwise it complains:
 
 cpu0: Enhanced SpeedStep operating point not in table
 
 
 Note that ci->ci_cpuid appears to be uninitialized, I hacked around
 it since I don't have time to investigate why that's happening.
 
 
 
 Index: sys/arch/i386/i386/est.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/i386/i386/est.c,v
 retrieving revision 1.18
 diff -u -r1.18 est.c
 --- sys/arch/i386/i386/est.c    27 Feb 2006 19:25:45 -0000      1.18
 +++ sys/arch/i386/i386/est.c    5 Mar 2006 21:12:29 -0000
 @@ -337,11 +337,11 @@
  
  /* Intel Pentium M processor 760 2.0Ghz */
  static const struct fq_info pentium_m_n760[] = {
 -       { 2000, 1356 },
 -       { 1600, 1244 },
 -       { 1333, 1164 },
 -       { 1066, 1084 },
 -       {  800,  988 }
 +       { 1500, 1356 },
 +       { 1200, 1244 },
 +       { 1000, 1164 },
 +       {  800, 1084 },
 +       {  600,  988 }
  };
  
  /* Intel Pentium M processor 765 2.1 GHz */
 @@ -402,8 +402,8 @@
         ENTRY("1.70", 0, pentium_m_n735),
         ENTRY("1.73", 0, pentium_m_n740),
         ENTRY("1.80", 0, pentium_m_n745),
 -       ENTRY("2.00", 0x06d6, pentium_m_n755),
         ENTRY("2.00", 0x06d8, pentium_m_n760),
 +       ENTRY("2.00", 0x06d6, pentium_m_n755),
         ENTRY("2.10", 0, pentium_m_n765),
         ENTRY("2.13", 0, pentium_m_n770),
  };
 @@ -505,6 +505,8 @@
         mv = MSR2MV(msr);
         aprint_normal("%s: %s running at %d MHz (%d mV)\n",
                ci->ci_dev->dv_xname, est_desc, mhz, mv);
 +       aprint_normal("%s: looking for brand_string=(%s) ci_cpuid=%x\n",
 +                     ci->ci_dev->dv_xname, cpu_brand_string, (unsigned)ci->ci_cpuid);
  
         /*
          * Look for a CPU matching cpu_brand_string.
 @@ -512,18 +514,25 @@
         for (i = 0; est_fqlist == NULL && i < NESTCPUS; i++) {
                 ccpu = &est_cpus[i];
                 len = strlen(ccpu->brand_prefix);
 -               if (strncmp(ccpu->brand_prefix, cpu_brand_string, len) != 0)
 +               if (strncmp(ccpu->brand_prefix, cpu_brand_string, len) != 0) {
 +                       aprint_normal("%s: brand is not (%s)\n",
 +                                     ci->ci_dev->dv_xname, ccpu->brand_prefix);
                         continue;
 +               }
                 tag = cpu_brand_string + len;
                 for (j = 0; j < ccpu->listc; j++) {
                         fql = &ccpu->list[j];
                         len = strlen(fql->brand_tag);
                         if (!strncmp(fql->brand_tag, tag, len) &&
                             !strcmp(ccpu->brand_suffix, tag + len) &&
 -                           (fql->cpu_id == 0 || fql->cpu_id == ci->ci_cpuid)) {
 +                           (fql->cpu_id == 0
 +                            || ci->ci_cpuid == 0
 +                            || fql->cpu_id == ci->ci_cpuid)) {
                                 est_fqlist = fql;
                                 break;
                         }
 +                       aprint_normal("%s: is not tag=%s cpuid=%x\n",
 +                                     ci->ci_dev->dv_xname, fql->brand_tag, fql->cpu_id);
                 }
         }
         if (est_fqlist == NULL) {