From 9417c448f81272a975d93043a88588ff5a625c14 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Wed, 1 Mar 2017 05:18:43 +0000 Subject: Fixed TCO v3 tick convert TCO v3's internal timer is stored as seconds. Submitted by: Denir Li Pull Request: https://github.com/freebsd/freebsd/pull/51 Pull Request: https://github.com/freebsd/freebsd/pull/52 --- sys/dev/ichwd/ichwd.c | 8 +++++++- sys/dev/ichwd/ichwd.h | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'sys/dev/ichwd') diff --git a/sys/dev/ichwd/ichwd.c b/sys/dev/ichwd/ichwd.c index 75c41b74e31b..42f330d17200 100644 --- a/sys/dev/ichwd/ichwd.c +++ b/sys/dev/ichwd/ichwd.c @@ -512,7 +512,13 @@ ichwd_event(void *arg, unsigned int cmd, int *error) /* convert from power-of-two-ns to WDT ticks */ cmd &= WD_INTERVAL; - timeout = ((uint64_t)1 << cmd) / ICHWD_TICK; + + if (sc->tco_version == 3) { + timeout = ((uint64_t)1 << cmd) / ICHWD_TCO_V3_TICK; + } else { + timeout = ((uint64_t)1 << cmd) / ICHWD_TICK; + } + if (cmd) { if (!sc->active) ichwd_tmr_enable(sc); diff --git a/sys/dev/ichwd/ichwd.h b/sys/dev/ichwd/ichwd.h index dc24a9d605ce..33ae66c7bc8a 100644 --- a/sys/dev/ichwd/ichwd.h +++ b/sys/dev/ichwd/ichwd.h @@ -345,7 +345,9 @@ struct ichwd_softc { #define TCO_RLD1_TMR_MAX 0x003f #define TCO_RLD2_TMR_MAX 0x03ff -/* approximate length in nanoseconds of one WDT tick (about 0.6 sec) */ +/* approximate length in nanoseconds of one WDT tick (about 0.6 sec) for TCO v1/v2 */ #define ICHWD_TICK 600000000 +/* approximate length in nanoseconds of one WDT tick (about 1.0 sec) for TCO v3 */ +#define ICHWD_TCO_V3_TICK 1000000000 #endif -- cgit v1.2.3