Fixed TCO v3 tick convert

TCO v3's internal timer is stored as seconds.

Submitted by:	Denir Li <denir-li@users.noreply.github.com>
Pull Request:	https://github.com/freebsd/freebsd/pull/51
Pull Request:	https://github.com/freebsd/freebsd/pull/52
This commit is contained in:
Warner Losh 2017-03-01 05:18:43 +00:00
parent 51abf0d5e3
commit 9417c448f8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=314477
2 changed files with 10 additions and 2 deletions

View File

@ -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);

View File

@ -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