hi tech@,

here is patch for ipmi(4).

watchdog timer on ipmi(4) is 16bit, and unit is 100ms. round down a
value greater than (UINT16_MAX / 10) to the maximum value.

--
FUKAUMI Naoki

Index: sys/dev/ipmi.c
===================================================================
RCS file: /cvs/src/sys/dev/ipmi.c,v
retrieving revision 1.102
diff -u -p -r1.102 ipmi.c
--- sys/dev/ipmi.c      15 Jun 2018 12:21:41 -0000      1.102
+++ sys/dev/ipmi.c      7 Jun 2019 09:53:50 -0000
@@ -37,6 +37,7 @@
 #include <sys/malloc.h>
 #include <sys/kthread.h>
 #include <sys/task.h>
+#include <sys/stdint.h>
 
 #include <machine/bus.h>
 #include <machine/smbiosvar.h>
@@ -1884,12 +1885,18 @@ reset:
 }
 
 #define                MIN_PERIOD      10
+#define                MAX_PERIOD      (UINT16_MAX / 10)
 
 int
 ipmi_watchdog(void *arg, int period)
 {
        struct ipmi_softc       *sc = arg;
 
+       if (period < MIN_PERIOD && period > 0)
+               period = MIN_PERIOD;
+       else if (period > MAX_PERIOD)
+               period = MAX_PERIOD;
+
        if (sc->sc_wdog_period == period) {
                if (period != 0) {
                        struct task *t;
@@ -1903,8 +1910,6 @@ ipmi_watchdog(void *arg, int period)
                return (period);
        }
 
-       if (period < MIN_PERIOD && period > 0)
-               period = MIN_PERIOD;
        sc->sc_wdog_period = period;
        ipmi_watchdog_set(sc);
        printf("%s: watchdog %sabled\n", DEVNAME(sc),

Reply via email to