From owner-svn-src-head@freebsd.org Wed Mar 1 05:18:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B907CF497E; Wed, 1 Mar 2017 05:18:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B544AF; Wed, 1 Mar 2017 05:18:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v215IhqE038732; Wed, 1 Mar 2017 05:18:43 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v215IhaM038730; Wed, 1 Mar 2017 05:18:43 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201703010518.v215IhaM038730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 1 Mar 2017 05:18:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314477 - head/sys/dev/ichwd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Mar 2017 05:18:44 -0000 Author: imp Date: Wed Mar 1 05:18:43 2017 New Revision: 314477 URL: https://svnweb.freebsd.org/changeset/base/314477 Log: 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 Modified: head/sys/dev/ichwd/ichwd.c head/sys/dev/ichwd/ichwd.h Modified: head/sys/dev/ichwd/ichwd.c ============================================================================== --- head/sys/dev/ichwd/ichwd.c Wed Mar 1 05:18:22 2017 (r314476) +++ head/sys/dev/ichwd/ichwd.c Wed Mar 1 05:18:43 2017 (r314477) @@ -512,7 +512,13 @@ ichwd_event(void *arg, unsigned int cmd, /* 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); Modified: head/sys/dev/ichwd/ichwd.h ============================================================================== --- head/sys/dev/ichwd/ichwd.h Wed Mar 1 05:18:22 2017 (r314476) +++ head/sys/dev/ichwd/ichwd.h Wed Mar 1 05:18:43 2017 (r314477) @@ -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