On Sat, Jul 03, 2010 at 12:57:15PM +1000, Jonathan Gray wrote:
> On Sat, Jun 26, 2010 at 11:48:15PM -0600, Gordon Willem Klok wrote:
> > Hello this should make speedstep work on nehalem cpu's (i3, i5, i7s) where
> > est uses acpi to get the available states. Please let me know of any
> > issues
> 
> This is not changing the places where it interprets PERF_STATUS
> on processors it shouldn't, I'd prefer something like this:

make this compile on amd64 as pointed out by oga

Index: amd64/amd64/est.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/amd64/est.c,v
retrieving revision 1.20
diff -u -p -r1.20 est.c
--- amd64/amd64/est.c   4 Jun 2010 15:03:34 -0000       1.20
+++ amd64/amd64/est.c   5 Jul 2010 21:12:34 -0000
@@ -314,7 +314,7 @@ est_init(struct cpu_info *ci)
 {
        const char *cpu_device = ci->ci_dev->dv_xname;
        int vendor = -1;
-       int i, low, high, family;
+       int i, low, high;
        u_int64_t msr;
        u_int16_t idhi, idlo, cur;
        u_int8_t crhi, crlo, crcur;
@@ -324,30 +324,20 @@ est_init(struct cpu_info *ci)
        if (setperf_prio > 3)
                return;
 
-       family = (ci->ci_signature >> 8) & 15;
-       if (family == 0xf) {
-               p4_get_bus_clock(ci);
-       } else if (family == 6) {
-               p3_get_bus_clock(ci);
-       }
-
-       if (bus_clock == 0) {
-               printf("%s: EST: PSS not yet available for this processor\n",
-                   cpu_device);
-               return;
-       }
-
 #if NACPICPU > 0
        est_fqlist = est_acpi_init();
 #endif
+       if (ci->ci_family == 0xf) {
+               p4_get_bus_clock(ci);
+       } else if (ci->ci_family == 6) {
+               p3_get_bus_clock(ci);
+       }
 
-       if (est_fqlist == NULL) {
-               if (bus_clock == 0) {
-                       printf("%s: EST: unknown system bus clock\n",
-                           cpu_device);
-                       return;
-               }
-
+       /*
+        * Interpreting the values of PERF_STATUS is not valid
+        * on recent processors so don't do it on anything unknown
+        */
+       if (est_fqlist == NULL && bus_clock != 0) {
                msr = rdmsr(MSR_PERF_STATUS);
                idhi = (msr >> 32) & 0xffff;
                idlo = (msr >> 48) & 0xffff;
Index: i386/i386/est.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/est.c,v
retrieving revision 1.35
diff -u -p -r1.35 est.c
--- i386/i386/est.c     20 Apr 2010 22:05:41 -0000      1.35
+++ i386/i386/est.c     5 Jul 2010 21:12:34 -0000
@@ -1062,12 +1062,6 @@ est_init(const char *cpu_device, int ven
        if ((cpu_ecxfeature & CPUIDECX_EST) == 0)
                return;
 
-       if (bus_clock == 0) {
-               printf("%s: EST: PSS not yet available for this processor\n",
-                   cpu_device);
-               return;
-       }
-
        msr = rdmsr(MSR_PERF_STATUS);
        idhi = (msr >> 32) & 0xffff;
        idlo = (msr >> 48) & 0xffff;
@@ -1080,7 +1074,11 @@ est_init(const char *cpu_device, int ven
        est_fqlist = est_acpi_init();
 #endif
 
-       if (est_fqlist == NULL) {
+       /*
+        * Interpreting the values of PERF_STATUS is not valid
+        * on recent processors so don't do it on anything unknown
+        */
+       if (est_fqlist == NULL && bus_clock != 0) {
                /*
                 * Find an entry which matches (vendor, bus_clock, idhi, idlo)
                 */
@@ -1095,12 +1093,7 @@ est_init(const char *cpu_device, int ven
                }
        }
 
-       if (est_fqlist == NULL) {
-               if (bus_clock == 0) {
-                       printf("%s: EST: unknown system bus clock\n",
-                           cpu_device);
-                       return;
-               }
+       if (est_fqlist == NULL && bus_clock != 0) {
                if (crhi == 0 || crcur == 0 || crlo > crhi ||
                    crcur < crlo || crcur > crhi) {
                        /*

Reply via email to