From owner-freebsd-current@FreeBSD.ORG Mon Dec 11 21:41:38 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7A62F16A403 for ; Mon, 11 Dec 2006 21:41:38 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4412D44CD8 for ; Mon, 11 Dec 2006 21:08:13 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id kBBL9Jxd010798; Mon, 11 Dec 2006 16:09:26 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-current@freebsd.org Date: Mon, 11 Dec 2006 16:08:06 -0500 User-Agent: KMail/1.9.1 References: <20061210110419.H42195@localhost> In-Reply-To: <20061210110419.H42195@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200612111608.06677.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 11 Dec 2006 16:09:27 -0500 (EST) X-Virus-Scanned: ClamAV 0.88.3/2315/Mon Dec 11 04:55:24 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Nick Hibma Subject: Re: Slight interface change on the watchdog fido X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Dec 2006 21:41:38 -0000 On Sunday 10 December 2006 05:04, Nick Hibma wrote: > I'm planning on committing the following change to make the implementations of > the various hardware watchdogs more consistent. A timeout of 0 passed to the > ioctl is now a valid input and will disable the watchdog. Previously it > produced an error for the Elan chip watchdog, which is _not_ what you want to > see when disarming a watchdog :-) I'd appreciate review of the individual > changes in the files by the following people. The change as a whole was > discussed with phk. > > cognet@freebsd.org i80321_wdog.c (*) > des ichwd.c (**) > ambrisko ipmi.c > marius mk48txx.c > phk kern_clock.c, elan-mmcr.c, watchdog.c (**) > > (*) The i80321_wdog.c cannot be disarmed. Is this correct? > (**) These have been tested to arm, disarm, and fire. Others have only been > compile tested. > > This change has been tested on 6.2-STABLE and 7-CURRENT. > > Index: sys/dev/ipmi/ipmi.c > =================================================================== > RCS file: /home/ncvs/src/sys/dev/ipmi/ipmi.c,v > retrieving revision 1.3.2.3 > diff -u -r1.3.2.3 ipmi.c > --- sys/dev/ipmi/ipmi.c 19 Oct 2006 14:50:48 -0000 1.3.2.3 > +++ sys/dev/ipmi/ipmi.c 9 Dec 2006 12:40:47 -0000 > @@ -649,25 +649,14 @@ > struct ipmi_softc *sc = arg; > unsigned int timeout; > > - /* disable / enable */ > - if (!(cmd & WD_ACTIVE)) { > - ipmi_set_watchdog(sc, 0); > - *error = 0; > - return; > - } > - > cmd &= WD_INTERVAL; > - /* convert from power-of-to-ns to WDT ticks */ > - if (cmd >= 64) { > - *error = EINVAL; > - return; > + if (cmd > 0 && cmd <= 63) { > + timeout = ((uint64_t)1 << cmd) / 1800000000; > + ipmi_set_watchdog(sc, timeout); > + *error = 0; > + } else { > + ipmi_set_watchdog(sc, 0); > } > - timeout = ((uint64_t)1 << cmd) / 1800000000; > - > - /* reload */ > - ipmi_set_watchdog(sc, timeout); > - > - *error = 0; > } > > #ifdef CLONING It would be nice to not lose the comments. Might also be nice to reduce the diff (so it doesn't have to reindent everything) by just adding a simple test after masking off WD_INTERVAL like so: if (cmd == 0 || cmd >= 64) { ipmi_set_watchdog(sc, 0); return; } -- John Baldwin