diff options
| author | Nick Hibma <n_hibma@FreeBSD.org> | 2006-12-15 21:44:49 +0000 |
|---|---|---|
| committer | Nick Hibma <n_hibma@FreeBSD.org> | 2006-12-15 21:44:49 +0000 |
| commit | 9079fff5504650793319895e16f3f9cd431c5ec5 (patch) | |
| tree | 787bbfce7ce18dfa578e01e209a342d73f933983 /sys/arm | |
| parent | 2cd19db26a49002206f71dfa91a0278aa7b43977 (diff) | |
Notes
Diffstat (limited to 'sys/arm')
| -rw-r--r-- | sys/arm/at91/at91_st.c | 9 | ||||
| -rw-r--r-- | sys/arm/xscale/i80321/i80321_wdog.c | 26 |
2 files changed, 22 insertions, 13 deletions
diff --git a/sys/arm/at91/at91_st.c b/sys/arm/at91/at91_st.c index 7b63af1fa76e..8b61c789653d 100644 --- a/sys/arm/at91/at91_st.c +++ b/sys/arm/at91/at91_st.c @@ -170,10 +170,15 @@ at91st_watchdog(void *argp, u_int cmd, int *error) uint32_t wdog; int t; - wdog = 0; t = cmd & WD_INTERVAL; - if (cmd != 0 && t >= 22 && t <= 37) + if (cmd > 0 && t >= 22 && t <= 37) { wdog = (1 << (t - 22)) | ST_WDMR_RSTEN; + *error = 0; + } else { + wdog = 0; + if (cmd > 0) + *error = EINVAL; + } WR4(ST_WDMR, wdog); WR4(ST_CR, ST_CR_WDRST); } diff --git a/sys/arm/xscale/i80321/i80321_wdog.c b/sys/arm/xscale/i80321/i80321_wdog.c index a33812cc71c5..c6c749c2ce2c 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 |
