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

From: Pawel Jakub Dawidek <pjd_at_FreeBSD.org>
Date: Wed, 7 Dec 2011 10:29:07 +0100
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

Received on Wed Dec 07 2011 - 08:30:10 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:21 UTC