Date: Sat, 27 Dec 2014 04:51:22 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r276286 - stable/10/sys/arm/broadcom/bcm2835 Message-ID: <201412270451.sBR4pMUI048292@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ian Date: Sat Dec 27 04:51:21 2014 New Revision: 276286 URL: https://svnweb.freebsd.org/changeset/base/276286 Log: MFC r275660: Fix the watchdog timeout calculation to prevent wrap. Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_wdog.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_wdog.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_wdog.c Sat Dec 27 04:35:18 2014 (r276285) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_wdog.c Sat Dec 27 04:51:21 2014 (r276286) @@ -142,14 +142,13 @@ bcmwd_watchdog_fn(void *private, u_int c if (cmd > 0) { sec = ((uint64_t)1 << (cmd & WD_INTERVAL)) / 1000000000; - ticks = (sec << 16) & BCM2835_WDOG_TIME_MASK; - if (ticks == 0) { + if (sec == 0 || sec > 15) { /* * Can't arm * disable watchdog as watchdog(9) requires */ device_printf(sc->dev, - "Can't arm, timeout is less than 1 second\n"); + "Can't arm, timeout must be between 1-15 seconds\n"); WRITE(sc, BCM2835_RSTC_REG, (BCM2835_PASWORD << BCM2835_PASSWORD_SHIFT) | BCM2835_RSTC_RESET); @@ -157,6 +156,7 @@ bcmwd_watchdog_fn(void *private, u_int c return; } + ticks = (sec << 16) & BCM2835_WDOG_TIME_MASK; reg = (BCM2835_PASWORD << BCM2835_PASSWORD_SHIFT) | ticks; WRITE(sc, BCM2835_WDOG_REG, reg);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412270451.sBR4pMUI048292>