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...@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
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to