diff options
author | Ed Tanous <ed.tanous@intel.com> | 2019-05-29 20:29:58 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2019-06-06 04:30:22 +0300 |
commit | 87a65e63bac789bca0607e0b4ab09d62517b95e7 (patch) | |
tree | 3254b912d6468012543e127a19ba2f1cd13b108f /meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog | |
parent | 5364646cb66fa75cdcbf148e039e0383cda94f2a (diff) | |
download | openbmc-87a65e63bac789bca0607e0b4ab09d62517b95e7.tar.xz |
Update to internal
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog')
-rw-r--r-- | meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Add-restart-cause-support.patch | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Add-restart-cause-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Add-restart-cause-support.patch new file mode 100644 index 000000000..05374e9db --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Add-restart-cause-support.patch @@ -0,0 +1,82 @@ +From af3a7d07b801c22a03350897c2186b1ee9507ff2 Mon Sep 17 00:00:00 2001 +From: Yong Li <yong.b.li@linux.intel.com> +Date: Sun, 14 Apr 2019 11:14:09 +0800 +Subject: [PATCH] Add restart cause support + +Add restart cause support for watchdog expiration, to support +Get system restart cause command defined in IPMI spec + +Tested: +Set a hard reset watchdog: +ipmitool raw 0x06 0x24 0x5 0x1 0x0 0x0 0x64 0x00 + +Start the timer: +ipmitool mc watchdog reset + +Wait for 10 seconds, host will be restart, query the restart cause: +Ipmitool chassis restart_cause +System restart cause: watchdog expired + +Signed-off-by: Yong Li <yong.b.li@linux.intel.com> +--- + watchdog.cpp | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +diff --git a/watchdog.cpp b/watchdog.cpp +index 008cde5..7f1ec05 100644 +--- a/watchdog.cpp ++++ b/watchdog.cpp +@@ -7,6 +7,7 @@ + #include <phosphor-logging/log.hpp> + #include <sdbusplus/exception.hpp> + #include <xyz/openbmc_project/Common/error.hpp> ++#include <xyz/openbmc_project/State/Host/server.hpp> + + namespace phosphor + { +@@ -24,6 +25,12 @@ constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1"; + constexpr auto SYSTEMD_ROOT = "/org/freedesktop/systemd1"; + constexpr auto SYSTEMD_INTERFACE = "org.freedesktop.systemd1.Manager"; + ++// host state manager service ++static constexpr const char* hostService = "xyz.openbmc_project.State.Host"; ++static constexpr const char* hostPath = "/xyz/openbmc_project/state/host0"; ++static constexpr const char* hostInterface = "xyz.openbmc_project.State.Host"; ++static constexpr const char* dbusPropIf = "org.freedesktop.DBus.Properties"; ++ + void Watchdog::resetTimeRemaining(bool enableWatchdog) + { + timeRemaining(interval()); +@@ -139,6 +146,29 @@ void Watchdog::timeOutHandler() + entry("ERROR=%s", e.what())); + commit<InternalFailure>(); + } ++ ++ // set restart cause for watchdog HardReset & PowerCycle actions ++ if ((action == Watchdog::Action::HardReset) || ++ (action == Watchdog::Action::PowerCycle)) ++ { ++ sdbusplus::message::variant<std::string> property = ++ convertForMessage( ++ (sdbusplus::xyz::openbmc_project::State::server::Host:: ++ RestartCause::WatchdogTimer)); ++ try ++ { ++ auto method = bus.new_method_call(hostService, hostPath, ++ dbusPropIf, "Set"); ++ method.append(hostInterface, "HostRestartCause", property); ++ bus.call(method); ++ } ++ catch (sdbusplus::exception_t& e) ++ { ++ log<level::ERR>("Failed to set HostRestartCause property", ++ entry("ERROR=%s", e.what())); ++ commit<InternalFailure>(); ++ } ++ } + } + + tryFallbackOrDisable(); +-- +2.7.4 + |