Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Maintain the state properly during firmware-bas...
details: https://anonhg.NetBSD.org/src/rev/a077f4c7c8d0
branches: trunk
changeset: 763729:a077f4c7c8d0
user: jruoho <jruoho%NetBSD.org@localhost>
date: Fri Apr 01 11:46:57 2011 +0000
description:
Maintain the state properly during firmware-based DVFS.
diffstat:
sys/dev/acpi/acpi_cpu_pstate.c | 41 ++++++++++++++++++++++-------------------
1 files changed, 22 insertions(+), 19 deletions(-)
diffs (82 lines):
diff -r 0aa62b78dc78 -r a077f4c7c8d0 sys/dev/acpi/acpi_cpu_pstate.c
--- a/sys/dev/acpi/acpi_cpu_pstate.c Fri Apr 01 10:32:37 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu_pstate.c Fri Apr 01 11:46:57 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_pstate.c,v 1.47 2011/03/19 12:57:31 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_pstate.c,v 1.48 2011/04/01 11:46:57 jruoho Exp $ */
/*-
* Copyright (c) 2010, 2011 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.47 2011/03/19 12:57:31 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.48 2011/04/01 11:46:57 jruoho Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@@ -247,13 +247,17 @@
}
}
- mutex_exit(&sc->sc_mtx);
-
- if (__predict_false(ps == NULL))
+ if (__predict_false(ps == NULL)) {
+ mutex_exit(&sc->sc_mtx);
return;
+ }
- if (sc->sc_pstate_saved == ps->ps_freq)
+ if (sc->sc_pstate_saved == ps->ps_freq) {
+ mutex_exit(&sc->sc_mtx);
return;
+ }
+
+ mutex_exit(&sc->sc_mtx);
xc = xc_unicast(0, acpicpu_pstate_set_xcall, &ps->ps_freq, NULL, ci);
xc_wait(xc);
@@ -279,29 +283,28 @@
{
struct acpicpu_softc *sc;
device_t self = aux;
- uint32_t old, new;
+ uint32_t freq;
+ uint64_t xc;
sc = device_private(self);
mutex_enter(&sc->sc_mtx);
+ acpicpu_pstate_change(sc);
- old = sc->sc_pstate_max;
- acpicpu_pstate_change(sc);
- new = sc->sc_pstate_max;
+ freq = sc->sc_pstate[sc->sc_pstate_max].ps_freq;
- if (old == new) {
- mutex_exit(&sc->sc_mtx);
- return;
+ if (sc->sc_pstate_saved == 0)
+ sc->sc_pstate_saved = sc->sc_pstate_current;
+
+ if (sc->sc_pstate_saved <= freq) {
+ freq = sc->sc_pstate_saved;
+ sc->sc_pstate_saved = 0;
}
mutex_exit(&sc->sc_mtx);
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "maximum frequency "
- "changed from P%u (%u MHz) to P%u (%u MHz)\n",
- old, sc->sc_pstate[old].ps_freq, new,
- sc->sc_pstate[sc->sc_pstate_max].ps_freq));
-
- acpicpu_pstate_set(sc->sc_ci, sc->sc_pstate[new].ps_freq);
+ xc = xc_unicast(0, acpicpu_pstate_set_xcall, &freq, NULL, sc->sc_ci);
+ xc_wait(xc);
}
ACPI_STATUS
Home |
Main Index |
Thread Index |
Old Index