summaryrefslogtreecommitdiffstats
path: root/sys/arm/xscale/i80321
diff options
context:
space:
mode:
authorn_hibma <n_hibma@FreeBSD.org>2006-12-15 21:44:49 +0000
committern_hibma <n_hibma@FreeBSD.org>2006-12-15 21:44:49 +0000
commitc98f016084f145e9f139ad1dfbc2cf59f8188f5e (patch)
tree787bbfce7ce18dfa578e01e209a342d73f933983 /sys/arm/xscale/i80321
parent705f242eca7e1a52b43a762cced4eaa8de4c0818 (diff)
downloadFreeBSD-src-c98f016084f145e9f139ad1dfbc2cf59f8188f5e.zip
FreeBSD-src-c98f016084f145e9f139ad1dfbc2cf59f8188f5e.tar.gz
Align the interfaces for the various watchdogs and make the interface
behave as expected. Also: - Return an error if WD_PASSIVE is passed in to the ioctl as only WD_ACTIVE is implemented at the moment. See sys/watchdog.h for an explanation of the difference between WD_ACTIVE and WD_PASSIVE. - Remove the I_HAVE_TOTALLY_LOST_MY_SENSE_OF_HUMOR define. If you've lost your sense of humor, than don't add a define. Specific changes: i80321_wdog.c Don't roll your own passive watchdog tickle as this would defeat the purpose of an active (userland) watchdog tickle. ichwd.c / ipmi.c: WD_ACTIVE means active patting of the watchdog by a userland process, not whether the watchdog is active. See sys/watchdog.h. kern_clock.c: (software watchdog) Remove a check for WD_ACTIVE as this does not make sense here. This reverts r1.181.
Diffstat (limited to 'sys/arm/xscale/i80321')
-rw-r--r--sys/arm/xscale/i80321/i80321_wdog.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/sys/arm/xscale/i80321/i80321_wdog.c b/sys/arm/xscale/i80321/i80321_wdog.c
index a33812c..c6c749c 100644
--- a/sys/arm/xscale/i80321/i80321_wdog.c
+++ b/sys/arm/xscale/i80321/i80321_wdog.c
@@ -62,7 +62,6 @@ struct iopwdog_softc {
device_t dev;
int armed;
int wdog_period;
- struct callout_handle wdog_callout;
};
static __inline void
@@ -83,8 +82,6 @@ iopwdog_tickle(void *arg)
return;
wdtcr_write(WDTCR_ENABLE1);
wdtcr_write(WDTCR_ENABLE2);
- sc->wdog_callout = timeout(iopwdog_tickle, sc,
- hz * (sc->wdog_period - 1));
}
static int
@@ -112,14 +109,21 @@ iopwdog_watchdog_fn(void *private, u_int cmd, int *error)
{
struct iopwdog_softc *sc = private;
- if (cmd == 0)
- return;
- if ((((uint64_t)1 << (cmd & WD_INTERVAL))) >
- (uint64_t)sc->wdog_period * 1000000000)
- return;
- sc->armed = 1;
- iopwdog_tickle(sc);
- *error = 0;
+ cmd &= WD_INTERVAL;
+ if (cmd > 0 && cmd <= 63
+ && (uint64_t)1 << (cmd & WD_INTERVAL) <=
+ (uint64_t)sc->wdog_period * 1000000000) {
+ /* Valid value -> Enable watchdog */
+ iopwdog_tickle(sc);
+ sc->armed = 1;
+ *error = 0;
+ } else {
+ /* XXX Can't disable this watchdog? */
+ if (sc->armed)
+ *error = EOPNOTSUPP;
+ else if (cmd > 0)
+ *error = EINVAL;
+ }
}
static int
OpenPOWER on IntegriCloud