Module Name:    src
Committed By:   jruoho
Date:           Sat Aug 21 15:37:35 UTC 2010

Modified Files:
        src/sys/arch/x86/acpi: acpi_cpu_md.c

Log Message:
When we do the sanity check that a P- or T-state transition was successful,
compare also against the control-field. There appears to be many BIOSes in
the field that report a zero value in the status-field. It is unclear whether
this should be taken as a hint that the status-check is not necessary also
during P-state transitions. If we still see timeouts (EAGAIN), this should
be reverted and the status-check should be bypassed if ps->ps_status is 0.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/x86/acpi/acpi_cpu_md.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/acpi/acpi_cpu_md.c
diff -u src/sys/arch/x86/acpi/acpi_cpu_md.c:1.27 src/sys/arch/x86/acpi/acpi_cpu_md.c:1.28
--- src/sys/arch/x86/acpi/acpi_cpu_md.c:1.27	Sat Aug 21 09:16:28 2010
+++ src/sys/arch/x86/acpi/acpi_cpu_md.c	Sat Aug 21 15:37:35 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.27 2010/08/21 09:16:28 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.28 2010/08/21 15:37:35 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen <[email protected]>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.27 2010/08/21 09:16:28 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.28 2010/08/21 15:37:35 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -466,12 +466,12 @@
 	if (__predict_false(ps == NULL))
 		return ENODEV;
 
-	if (ps->ps_status_addr == 0)
+	if (__predict_false(ps->ps_status_addr == 0))
 		return EINVAL;
 
 	val = rdmsr(ps->ps_status_addr);
 
-	if (ps->ps_status_mask != 0)
+	if (__predict_true(ps->ps_status_mask != 0))
 		val = val & ps->ps_status_mask;
 
 	for (i = 0; i < sc->sc_pstate_count; i++) {
@@ -481,7 +481,7 @@
 		if (ps->ps_freq == 0)
 			continue;
 
-		if (val == ps->ps_status) {
+		if (val == ps->ps_status || val == ps->ps_control) {
 			*freq = ps->ps_freq;
 			return 0;
 		}
@@ -535,7 +535,7 @@
 		if (__predict_true(ps->ps_status_mask != 0))
 			val = val & ps->ps_status_mask;
 
-		if (val == ps->ps_status)
+		if (val == ps->ps_status || val == ps->ps_control)
 			return;
 
 		DELAY(ps->ps_latency);
@@ -560,7 +560,7 @@
 		if (ts->ts_percent == 0)
 			continue;
 
-		if (val == ts->ts_control || val == ts->ts_status) {
+		if (val == ts->ts_status || val == ts->ts_control) {
 			*percent = ts->ts_percent;
 			return 0;
 		}
@@ -604,7 +604,7 @@
 
 		val = rdmsr(MSR_THERM_CONTROL);
 
-		if (val == ts->ts_status)
+		if (val == ts->ts_status || val == ts->ts_control)
 			return;
 
 		DELAY(ts->ts_latency);

Reply via email to