Module Name: src
Committed By: bouyer
Date: Tue Aug 11 17:15:32 UTC 2009
Modified Files:
src/sys/arch/x86/pci: ichlpcib.c
Log Message:
Fix watchdog code:
- the timer bound constants are in tick, so convert period to tick before
checking it against the bounds
- for ICH5 or older, fix code that would have always written a 0 period
to the register.
To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/pci/ichlpcib.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/pci/ichlpcib.c
diff -u src/sys/arch/x86/pci/ichlpcib.c:1.17 src/sys/arch/x86/pci/ichlpcib.c:1.18
--- src/sys/arch/x86/pci/ichlpcib.c:1.17 Wed Apr 29 14:55:36 2009
+++ src/sys/arch/x86/pci/ichlpcib.c Tue Aug 11 17:15:32 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: ichlpcib.c,v 1.17 2009/04/29 14:55:36 njoly Exp $ */
+/* $NetBSD: ichlpcib.c,v 1.18 2009/08/11 17:15:32 bouyer Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.17 2009/04/29 14:55:36 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.18 2009/08/11 17:15:32 bouyer Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -414,6 +414,7 @@
struct lpcib_softc *sc = smw->smw_cookie;
unsigned int period;
uint16_t ich6period = 0;
+ uint8_t ich5period = 0;
if ((smw->smw_mode & WDOG_MODE_MASK) == WDOG_MODE_DISARMED) {
/* Stop the TCO timer. */
@@ -423,16 +424,16 @@
* ICH6 or newer are limited to 2s min and 613s max.
* ICH5 or older are limited to 4s min and 39s max.
*/
+ period = lpcib_tcotimer_second_to_tick(smw->smw_period);
if (sc->sc_has_rcba) {
- if (smw->smw_period < LPCIB_TCOTIMER2_MIN_TICK ||
- smw->smw_period > LPCIB_TCOTIMER2_MAX_TICK)
+ if (period < LPCIB_TCOTIMER2_MIN_TICK ||
+ period > LPCIB_TCOTIMER2_MAX_TICK)
return EINVAL;
} else {
- if (smw->smw_period < LPCIB_TCOTIMER_MIN_TICK ||
- smw->smw_period > LPCIB_TCOTIMER_MAX_TICK)
+ if (period < LPCIB_TCOTIMER_MIN_TICK ||
+ period > LPCIB_TCOTIMER_MAX_TICK)
return EINVAL;
}
- period = lpcib_tcotimer_second_to_tick(smw->smw_period);
/* Stop the TCO timer, */
tcotimer_stop(sc);
@@ -447,11 +448,11 @@
LPCIB_TCO_TMR2, ich6period | period);
} else {
/* ICH5 or older */
- period |= bus_space_read_1(sc->sc_iot, sc->sc_ioh,
+ ich5period = bus_space_read_1(sc->sc_iot, sc->sc_ioh,
LPCIB_TCO_TMR);
- period &= 0xc0;
+ ich5period &= 0xc0;
bus_space_write_1(sc->sc_iot, sc->sc_ioh,
- LPCIB_TCO_TMR, period);
+ LPCIB_TCO_TMR, ich5period | period);
}
/* and start/reload the timer. */