Module Name:    src
Committed By:   pgoyette
Date:           Sat Jul 17 21:36:26 UTC 2010

Modified Files:
        src/sys/dev/isa: itesio_isa.c

Log Message:
If this itesio(4) has a watchdog, then set up a real suspend handler to
make sure we don't suspend when the wdog time is active.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/isa/itesio_isa.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/dev/isa/itesio_isa.c
diff -u src/sys/dev/isa/itesio_isa.c:1.18 src/sys/dev/isa/itesio_isa.c:1.19
--- src/sys/dev/isa/itesio_isa.c:1.18	Sun May  2 18:49:13 2010
+++ src/sys/dev/isa/itesio_isa.c	Sat Jul 17 21:36:26 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: itesio_isa.c,v 1.18 2010/05/02 18:49:13 jakllsch Exp $ */
+/*	$NetBSD: itesio_isa.c,v 1.19 2010/07/17 21:36:26 pgoyette Exp $ */
 /*	Derived from $OpenBSD: it.c,v 1.19 2006/04/10 00:57:54 deraadt Exp $	*/
 
 /*
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: itesio_isa.c,v 1.18 2010/05/02 18:49:13 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: itesio_isa.c,v 1.19 2010/07/17 21:36:26 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -92,6 +92,7 @@
 static void	itesio_refresh(struct sysmon_envsys *, envsys_data_t *);
 
 /* sysmon_wdog glue */
+static bool	itesio_wdt_suspend(device_t, const pmf_qual_t *);
 static int	itesio_wdt_setmode(struct sysmon_wdog *);
 static int 	itesio_wdt_tickle(struct sysmon_wdog *);
 
@@ -250,9 +251,6 @@
 	}
 	sc->sc_hwmon_enabled = true;
 
-	if (!pmf_device_register(self, NULL, NULL))
-		aprint_error_dev(self, "couldn't establish power handler\n");
-
 	/* The IT8705 doesn't support the WDT */
 	if (sc->sc_chipid == ITESIO_ID8705)
 		goto out2;
@@ -272,12 +270,20 @@
 	}
 	sc->sc_wdt_enabled = true;
 	aprint_normal_dev(self, "Watchdog Timer present\n");
+
+	if (!pmf_device_register(self, itesio_wdt_suspend, NULL))
+		aprint_error_dev(self, "couldn't establish power handler\n");
+
 	return;
 
 out:
 	bus_space_unmap(sc->sc_iot, sc->sc_ec_ioh, 8);
 out2:
 	bus_space_unmap(sc->sc_iot, sc->sc_pnp_ioh, 2);
+
+	if (!pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, "couldn't establish power handler\n");
+
 }
 
 static int
@@ -297,6 +303,17 @@
 	return 0;
 }
 
+static bool
+itesio_wdt_suspend(device_t dev, const pmf_qual_t *qual)
+{
+	struct itesio_softc *sc = device_private(dev);
+
+	/* Don't allow suspend if watchdog is armed */
+	if ((sc->sc_smw.smw_mode & WDOG_MODE_MASK) != WDOG_MODE_DISARMED)
+		return false;
+	return true;
+}
+
 /*
  * Functions to read/write to the Environmental Controller.
  */

Reply via email to