diff --git a/sys/arm64/apple/apple_wdog.c b/sys/arm64/apple/apple_wdog.c index c2463fa6d34..8c34bcfff70 100644 --- a/sys/arm64/apple/apple_wdog.c +++ b/sys/arm64/apple/apple_wdog.c @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -83,7 +84,6 @@ struct aplwd_softc { static struct aplwd_softc *aplwd_lsc = NULL; static struct ofw_compat_data compat_data[] = { - {"apple,reboot-v0", 1}, {"apple,wdt", 1}, {NULL, 0} }; @@ -143,9 +143,6 @@ aplwd_attach(device_t dev) device_printf(dev, "cannot get base frequency\n"); goto fail; } -// temp/debug: -device_printf(dev, "base frequency %jd\n", (intmax_t) sc->clk_freq); -sc->clk_freq = 24000000; aplwd_lsc = sc; mtx_init(&sc->mtx, "Apple Watchdog", "aplwd", MTX_DEF); @@ -167,7 +164,7 @@ aplwd_watchdog_fn(void *private, u_int cmd, int *error) { struct aplwd_softc *sc; uint64_t sec; - uint32_t ticks; + uint32_t ticks, sec_max; sc = private; mtx_lock(&sc->mtx); @@ -176,20 +173,20 @@ aplwd_watchdog_fn(void *private, u_int cmd, int *error) if (cmd > 0) { sec = ((uint64_t)1 << (cmd & WD_INTERVAL)) / 1000000000; -#if 0 - if (sec == 0 || sec > 15) { + sec_max = UINT_MAX / sc->clk_freq; + if (sec == 0 || sec > sec_max) { /* * Can't arm * disable watchdog as watchdog(9) requires */ device_printf(sc->dev, - "Can't arm, timeout must be between 1-15 seconds\n"); + "Can't arm, timeout must be between 1-%d seconds\n", + sec_max); WRITE(sc, APLWD_WD1_CNTL, 0); mtx_unlock(&sc->mtx); *error = EINVAL; return; } -#endif ticks = sec * sc->clk_freq; WRITE(sc, APLWD_WD1_TIMER, 0);