summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-09-07 16:57:38 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-09-07 16:57:38 +0000
commit5dcfe22895ce0c31607b0583131e1015d1c6bad7 (patch)
treeb50f69d3d84f9efc1add3f4d7bf6ab0860e03862 /sys/arch
parentbe8a92e83b3d6ef73fea916ded236a1fe71ddbc7 (diff)
Restore msr unconditionnaly, why bother checking if they have changed; deraadt
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/loongson/dev/glxpcib.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/sys/arch/loongson/dev/glxpcib.c b/sys/arch/loongson/dev/glxpcib.c
index 4f175005828..39a45324eb3 100644
--- a/sys/arch/loongson/dev/glxpcib.c
+++ b/sys/arch/loongson/dev/glxpcib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: glxpcib.c,v 1.7 2010/09/07 16:52:04 miod Exp $ */
+/* $OpenBSD: glxpcib.c,v 1.8 2010/09/07 16:57:37 miod Exp $ */
/*
* Copyright (c) 2007 Marc Balmer <mbalmer@openbsd.org>
@@ -124,6 +124,15 @@
#define AMD5536_GPIO_IN_INVRT_EN 0x24 /* invert input */
#define AMD5536_GPIO_READ_BACK 0x30 /* read back value */
+/*
+ * MSR registers we want to preserve accross suspend/resume
+ */
+const uint32_t glxpcib_msrlist[] = {
+ GLIU_PAE,
+ GLCP_GLD_MSR_PM,
+ DIVIL_BALL_OPTS
+};
+
struct glxpcib_softc {
struct device sc_dev;
@@ -131,6 +140,8 @@ struct glxpcib_softc {
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
+ uint64_t sc_msrsave[nitems(glxpcib_msrlist)];
+
#if NGPIO > 0
/* GPIO interface */
bus_space_tag_t sc_gpio_iot;
@@ -270,28 +281,19 @@ glxpcib_attach(struct device *parent, struct device *self, void *aux)
int
glxpcib_activate(struct device *dv, int act)
{
+ struct glxpcib_softc *sc = (struct glxpcib_softc *)dv;
int rv = 0;
- const uint32_t msrlist[] = {
- GLIU_PAE,
- GLCP_GLD_MSR_PM,
- DIVIL_BALL_OPTS
- };
- static uint64_t msrsave[nitems(msrlist)];
- uint64_t msr;
uint i;
switch (act) {
case DVACT_SUSPEND:
rv = config_activate_children(dv, act);
- for (i = 0; i < nitems(msrlist); i++)
- msrsave[i] = rdmsr(msrlist[i]);
+ for (i = 0; i < nitems(glxpcib_msrlist); i++)
+ sc->sc_msrsave[i] = rdmsr(glxpcib_msrlist[i]);
break;
case DVACT_RESUME:
- for (i = 0; i < nitems(msrlist); i++) {
- msr = rdmsr(msrlist[i]);
- if (msr != msrsave[i])
- wrmsr(msrlist[i], msr);
- }
+ for (i = 0; i < nitems(glxpcib_msrlist); i++)
+ wrmsr(glxpcib_msrlist[i], sc->sc_msrsave[i]);
rv = config_activate_children(dv, act);
break;
}