Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Add a pmf resume function to put the hardware in...
details: https://anonhg.NetBSD.org/src/rev/6d6fe4b56c2a
branches: trunk
changeset: 768762:6d6fe4b56c2a
user: mbalmer <mbalmer%NetBSD.org@localhost>
date: Fri Aug 26 13:29:56 2011 +0000
description:
Add a pmf resume function to put the hardware in a defined state after
resume. Problem found by jmcneill@.
diffstat:
sys/dev/pci/pwdog.c | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
diffs (58 lines):
diff -r af3a0d2216d9 -r 6d6fe4b56c2a sys/dev/pci/pwdog.c
--- a/sys/dev/pci/pwdog.c Fri Aug 26 12:52:01 2011 +0000
+++ b/sys/dev/pci/pwdog.c Fri Aug 26 13:29:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $$NetBSD: pwdog.c,v 1.3 2011/08/26 10:30:47 mbalmer Exp $ */
+/* $$NetBSD: pwdog.c,v 1.4 2011/08/26 13:29:56 mbalmer Exp $ */
/* $OpenBSD: pwdog.c,v 1.7 2010/04/08 00:23:53 tedu Exp $ */
/*
@@ -54,6 +54,7 @@
static void pwdog_attach(device_t, device_t, void *);
static int pwdog_detach(device_t, int);
static bool pwdog_suspend(device_t, const pmf_qual_t *);
+static bool pwdog_resume(device_t, const pmf_qual_t *);
static int pwdog_setmode(struct sysmon_wdog *);
static int pwdog_tickle(struct sysmon_wdog *);
@@ -96,7 +97,7 @@
sc->sc_dev = self;
- pmf_device_register(self, pwdog_suspend, NULL);
+ pmf_device_register(self, pwdog_suspend, pwdog_resume);
bus_space_write_1(sc->sc_iot, sc->sc_ioh, PWDOG_DISABLE, 0);
sc->sc_smw.smw_name = device_xname(self);
@@ -116,6 +117,7 @@
{
struct pwdog_softc *sc = device_private(self);
+ /* XXX check flags & DETACH_FORCE (or DETACH_SHUTDOWN)? */
if (sc->sc_smw_valid) {
if ((sc->sc_smw.smw_mode & WDOG_MODE_MASK)
!= WDOG_MODE_DISARMED)
@@ -133,6 +135,23 @@
}
static bool
+pwdog_resume(device_t self, const pmf_qual_t *qual)
+{
+ struct pwdog_softc *sc = device_private(self);
+
+ if (sc->sc_smw_valid == false)
+ return true;
+
+ /*
+ * suspend is inhibited when the watchdog timer was armed,
+ * so when we end up here, the watchdog is disabled; program the
+ * hardware accordingly.
+ */
+ bus_space_write_1(sc->sc_iot, sc->sc_ioh, PWDOG_DISABLE, 0);
+ return true;
+}
+
+static bool
pwdog_suspend(device_t self, const pmf_qual_t *qual)
{
struct pwdog_softc *sc = device_private(self);
Home |
Main Index |
Thread Index |
Old Index