Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Mar 2017 05:18:43 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r314477 - head/sys/dev/ichwd
Message-ID:  <201703010518.v215IhaM038730@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <denir-li@users.noreply.github.com>
  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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703010518.v215IhaM038730>