summaryrefslogtreecommitdiffstats
path: root/app/watchdog.cpp
diff options
context:
space:
mode:
authorYong Li <yong.b.li@linux.intel.com>2019-01-15 13:45:33 +0800
committerVernon Mauery <vernon.mauery@linux.intel.com>2019-02-12 21:15:41 +0000
commitf7c9db0acbd2c266d5468e3705850749bfaf9d86 (patch)
treec8ee2bcee3f0ead91e7d9ae69f0f27caf47041c4 /app/watchdog.cpp
parent118907ed5aff8ad5037f98bf8699c5105781e4dd (diff)
downloadphosphor-host-ipmid-f7c9db0acbd2c266d5468e3705850749bfaf9d86.tar.gz
phosphor-host-ipmid-f7c9db0acbd2c266d5468e3705850749bfaf9d86.zip
Get the correct present countdown value when watchdog is stopped
The timeRemaining property in watchdog service will return 0 if the watchdog is not started. Tested By: ipmitool raw 0x6 0x24 0x0 0x0 0x0 0x0 0xa 0xb ipmitool mc watchdog get Change-Id: I27992f25a0e2c75df398ec5e2702b467365e9a32 Signed-off-by: Yong Li <yong.b.li@linux.intel.com>
Diffstat (limited to 'app/watchdog.cpp')
-rw-r--r--app/watchdog.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/watchdog.cpp b/app/watchdog.cpp
index abdf8e4..1a5d19c 100644
--- a/app/watchdog.cpp
+++ b/app/watchdog.cpp
@@ -361,9 +361,17 @@ ipmi_ret_t ipmi_app_watchdog_get(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
res.timer_use = wd_dont_log;
res.timer_action =
static_cast<uint8_t>(wdActionToIpmiAction(wd_prop.expireAction));
+
+ // Interval and timeRemaining need converted from milli -> deci seconds
+ res.initial_countdown = htole16(wd_prop.interval / 100);
if (wd_prop.enabled)
{
res.timer_use |= wd_running;
+ res.present_countdown = htole16(wd_prop.timeRemaining / 100);
+ }
+ else
+ {
+ res.present_countdown = res.initial_countdown;
}
res.timer_use |=
@@ -372,10 +380,6 @@ ipmi_ret_t ipmi_app_watchdog_get(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
// TODO: Do something about having pretimeout support
res.pretimeout = 0;
res.expire_flags = 0;
- // Interval and timeRemaining need converted from milli -> deci seconds
- res.initial_countdown = htole16(wd_prop.interval / 100);
- res.present_countdown = htole16(wd_prop.timeRemaining / 100);
-
memcpy(response, &res, sizeof(res));
*data_len = sizeof(res);
lastCallSuccessful = true;
OpenPOWER on IntegriCloud