[RFC] winbond watchdog driver for FreeBSD/i386 and FreeBSD/amd64

Pawel Jakub Dawidek pjd at FreeBSD.org
Wed Dec 7 09:30:10 UTC 2011


On Tue, Jun 28, 2011 at 03:32:41PM -0700, Xin LI wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Hi,
> 
> I'd like to request for comments on the attached driver, which supports
> watchdogs on several Winbond super I/O chip models and have been tested
> on a few of recent Supermicro motherboards.

Is there any reason this is not yet committed? Please commit, pretty
please.

One minor problem I found is described below. Other than that it works
for me, thanks!

[...]
> +static void
> +winbondwd_event(void *arg, unsigned int cmd, int *error)
> +{
> +	struct winbondwd_softc *sc = arg;
> +	unsigned char rtimeout;
> +	uint64_t timeout;
> +
> +	if (cmd == 0)
> +		winbondwd_set_timeout(sc, 0);
> +	else {
> +		timeout = (uint64_t)1 << (cmd & WD_INTERVAL);
> +		if (timeout < (uint64_t)0xff * 1000 * 1000 * 1000) {
> +			rtimeout = timeout / (1000 * 1000 * 1000);
> +			if (rtimeout == 0)
> +				rtimeout = 0xff;
> +			winbondwd_set_timeout(sc, rtimeout);
> +		} else {
> +			device_printf(sc->device,
> +			    "Value %u too big, disabling\n", cmd & WD_INTERVAL);
> +			/* Proposed timeout can not be satisified */
> +			winbondwd_set_timeout(sc, 0);
> +		}

You should add '*error = 0;' right here. Without it we return some
random error, in my case watchdgod is able to arm the watchdog but exits
when trying to pat it, as it gets an error, which leads to a reset short
aferwards.

> +	}
> +}

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://yomoli.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20111207/60abe569/attachment.pgp


More information about the freebsd-current mailing list