summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog
diff options
context:
space:
mode:
authorEd Tanous <ed.tanous@intel.com>2019-07-31 20:43:37 +0300
committerEd Tanous <ed.tanous@intel.com>2019-08-01 18:19:38 +0300
commitd0f63ef62c76c932a2003eaa42c0b250065ae06f (patch)
tree4c0e3cb32dc80f80460bdbf82ff6d401d4ff194f /meta-openbmc-mods/meta-common/recipes-phosphor/watchdog
parentb4f66bacb1b8e661d794fa7a189e2f66f5092e2e (diff)
downloadopenbmc-d0f63ef62c76c932a2003eaa42c0b250065ae06f.tar.xz
Update to internal 7-31-19
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/watchdog')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Add-redfish-log-support-for-IPMI-watchdog-timeout-ac.patch51
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Move-Phosphor-Watchdog-to-Not-Use-Service-Files.patch198
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Add-restart-cause-support.patch82
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Stop-the-watchdog-when-the-host-is-going-to-off.patch118
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0003-Add-redfish-log-support-for-IPMI-watchdog-pre-timeou.patch48
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/obmc-enable-host-watchdog@.service14
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog.service16
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog@.service12
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend7
9 files changed, 336 insertions, 210 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Add-redfish-log-support-for-IPMI-watchdog-timeout-ac.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Add-redfish-log-support-for-IPMI-watchdog-timeout-ac.patch
deleted file mode 100644
index 28995d14b..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Add-redfish-log-support-for-IPMI-watchdog-timeout-ac.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 38faf5c040660e752741dcf7f03e4bb1e9f3411b Mon Sep 17 00:00:00 2001
-From: Yong Li <yong.b.li@linux.intel.com>
-Date: Thu, 4 Apr 2019 18:24:54 +0800
-Subject: [PATCH] Add redfish log support for IPMI watchdog timeout actions
-
-The current plan is that only threshold sensor events
-will be logged to the IPMI SEL,
-and all other events will be logged to the Redfish Event Log.
-
-Tested:
-Config IPMI watchdog: OEM hard reset after 10 seconds:
-ipmitool raw 0x06 0x24 0x5 0x1 0x0 0x0 0x64 0x00
-Start watchdog:
-Ipmitool mc watchdog reset
-Check the redfish logs in 10 seconds:
-https://BMCIP/redfish/v1/Systems/system/LogServices/EventLog/Entries
-
-Signed-off-by: Yong Li <yong.b.li@linux.intel.com>
----
- watchdog.cpp | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/watchdog.cpp b/watchdog.cpp
-index bc3ba95..4774fd8 100644
---- a/watchdog.cpp
-+++ b/watchdog.cpp
-@@ -1,5 +1,7 @@
- #include "watchdog.hpp"
-
-+#include <systemd/sd-journal.h>
-+
- #include <chrono>
- #include <phosphor-logging/elog.hpp>
- #include <phosphor-logging/log.hpp>
-@@ -101,6 +103,13 @@ void Watchdog::timeOutHandler()
- action = fallback->action;
- }
-
-+ // Log into redfish event log
-+ sd_journal_send("MESSAGE=IPMIWatchdog: Timed out ACTION=%s",
-+ convertForMessage(action).c_str(), "PRIORITY=%i", LOG_INFO,
-+ "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.IPMIWatchdog",
-+ "REDFISH_MESSAGE_ARGS=%s",
-+ convertForMessage(action).c_str(), NULL);
-+
- expiredTimerUse(currentTimerUse());
-
- auto target = actionTargetMap.find(action);
---
-2.7.4
-
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Move-Phosphor-Watchdog-to-Not-Use-Service-Files.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Move-Phosphor-Watchdog-to-Not-Use-Service-Files.patch
new file mode 100644
index 000000000..627dacef1
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Move-Phosphor-Watchdog-to-Not-Use-Service-Files.patch
@@ -0,0 +1,198 @@
+From d15cf914ad51207021451b12863d4b7585f4666c Mon Sep 17 00:00:00 2001
+From: James Feist <james.feist@linux.intel.com>
+Date: Mon, 17 Jun 2019 12:00:58 -0700
+Subject: [PATCH] Move Phosphor-Watchdog to Not Use Service Files
+
+Our power control does not use service files, update it
+so that it calls properties directly.
+
+According to EPS, change the messageArgs in redfish about watchdog
+action and pre-interrupt action.
+
+Tested: used ipmi to create watchdog event and system
+was restarted.
+
+Set a watchdog (Timer action and pre-interrupt action both are none).
+ ipmitool raw 0x06 0x24 0x05 0x00 0x00 0x00 0x30 0x00
+Get the watchdog.
+ ipmitool mc watchdog get
+Start the watchdog.
+ ipmitool mc watchdog reset
+When timer expired, check messageArgs in Redfish with below url:
+https://IP/redfish/v1/Systems/system/LogServices/EventLog/Entries.
+
+Signed-off-by: James Feist <james.feist@linux.intel.com>
+Signed-off-by: Ren Yu <yux.ren@intel.com>
+---
+ watchdog.cpp | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 108 insertions(+), 8 deletions(-)
+
+diff --git a/watchdog.cpp b/watchdog.cpp
+index 9090760..4c8e480 100644
+--- a/watchdog.cpp
++++ b/watchdog.cpp
+@@ -1,11 +1,14 @@
+ #include "watchdog.hpp"
+
++#include <systemd/sd-journal.h>
++
+ #include <algorithm>
+ #include <chrono>
+ #include <phosphor-logging/elog.hpp>
+ #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
+ {
+@@ -18,10 +21,44 @@ using namespace phosphor::logging;
+ using sdbusplus::exception::SdBusError;
+ using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
+
+-// systemd service to kick start a target.
+-constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1";
+-constexpr auto SYSTEMD_ROOT = "/org/freedesktop/systemd1";
+-constexpr auto SYSTEMD_INTERFACE = "org.freedesktop.systemd1.Manager";
++const static constexpr char* powerActionHardReset =
++ "xyz.openbmc_project.State.Watchdog.Action.HardReset";
++const static constexpr char* powerActionOff =
++ "xyz.openbmc_project.State.Watchdog.Action.PowerOff";
++const static constexpr char* powerActionPowerCycle =
++ "xyz.openbmc_project.State.Watchdog.Action.PowerCycle";
++const static constexpr char* powerActionNone =
++ "xyz.openbmc_project.State.Watchdog.Action.None";
++const static constexpr char* preInterruptNoAction =
++ "xyz.openbmc_project.State.Watchdog.PreTimeoutInterruptAction.None";
++
++const static constexpr char* hardResteDescription =
++ "Hard Reset - System reset due to Watchdog timeout";
++const static constexpr char* powerOffDescription =
++ "Power Down - System power down due to Watchdog timeout";
++const static constexpr char* powerCycleDescription =
++ "Power Cycle - System power cycle due to Watchdog timeout";
++const static constexpr char* timerExpiredDescription = "Timer expired";
++const static constexpr char* preInterruptDescription = "Timer interrupt";
++
++namespace restart
++{
++static constexpr const char* busName = "xyz.openbmc_project.Settings";
++static constexpr const char* path =
++ "/xyz/openbmc_project/control/host0/restart_cause";
++static constexpr const char* interface =
++ "xyz.openbmc_project.Common.RestartCause";
++static constexpr const char* property = "RestartCause";
++} // namespace restart
++
++// chassis state manager service
++namespace chassis
++{
++static constexpr const char* busName = "xyz.openbmc_project.State.Chassis";
++static constexpr const char* path = "/xyz/openbmc_project/state/chassis0";
++static constexpr const char* interface = "xyz.openbmc_project.State.Chassis";
++static constexpr const char* request = "RequestedPowerTransition";
++} // namespace chassis
+
+ void Watchdog::resetTimeRemaining(bool enableWatchdog)
+ {
+@@ -102,12 +139,51 @@ uint64_t Watchdog::interval(uint64_t value)
+ // Optional callback function on timer expiration
+ void Watchdog::timeOutHandler()
+ {
++ PreTimeoutInterruptAction preTimeoutInterruptAction = preTimeoutInterrupt();
+ Action action = expireAction();
++ std::string actionMessageArgs{};
++
+ if (!this->enabled())
+ {
+ action = fallback->action;
+ }
+
++ if (convertForMessage(action) == powerActionHardReset)
++ {
++ actionMessageArgs = hardResteDescription;
++ }
++ else if (convertForMessage(action) == powerActionOff)
++ {
++ actionMessageArgs = powerOffDescription;
++ }
++ else if (convertForMessage(action) == powerActionPowerCycle)
++ {
++ actionMessageArgs = powerCycleDescription;
++ }
++ else if (convertForMessage(action) == powerActionNone)
++ {
++ actionMessageArgs = timerExpiredDescription;
++ }
++ else
++ {
++ actionMessageArgs = "Reserved";
++ }
++
++ // Log into redfish event log
++ sd_journal_send("MESSAGE=IPMIWatchdog: Timed out ACTION=%s",
++ convertForMessage(action).c_str(), "PRIORITY=%i", LOG_INFO,
++ "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.IPMIWatchdog",
++ "REDFISH_MESSAGE_ARGS=%s", actionMessageArgs.c_str(), NULL);
++
++ if (preInterruptNoAction != convertForMessage(preTimeoutInterruptAction))
++ {
++ sd_journal_send("MESSAGE=IPMIWatchdog: Pre Timed out Interrupt=%s",
++ convertForMessage(preTimeoutInterruptAction).c_str(),
++ "PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s",
++ "OpenBMC.0.1.IPMIWatchdog", "REDFISH_MESSAGE_ARGS=%s",
++ preInterruptDescription, NULL);
++ }
++
+ expiredTimerUse(currentTimerUse());
+
+ auto target = actionTargetMap.find(action);
+@@ -128,10 +204,11 @@ void Watchdog::timeOutHandler()
+
+ try
+ {
+- auto method = bus.new_method_call(SYSTEMD_SERVICE, SYSTEMD_ROOT,
+- SYSTEMD_INTERFACE, "StartUnit");
+- method.append(target->second);
+- method.append("replace");
++ auto method =
++ bus.new_method_call(chassis::busName, chassis::path,
++ "org.freedesktop.DBus.Properties", "Set");
++ method.append(chassis::interface, chassis::request,
++ std::variant<std::string>(target->second));
+
+ bus.call_noreply(method);
+ }
+@@ -142,6 +219,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))
++ {
++ try
++ {
++ auto method = bus.new_method_call(
++ restart::busName, restart::path,
++ "org.freedesktop.DBus.Properties", "Set");
++ method.append(
++ restart::interface, restart::property,
++ std::variant<std::string>("xyz.openbmc_project.State.Host."
++ "RestartCause.WatchdogTimer"));
++ 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
+
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
deleted file mode 100644
index 05374e9db..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Add-restart-cause-support.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-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
-
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Stop-the-watchdog-when-the-host-is-going-to-off.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Stop-the-watchdog-when-the-host-is-going-to-off.patch
new file mode 100644
index 000000000..016cf063a
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Stop-the-watchdog-when-the-host-is-going-to-off.patch
@@ -0,0 +1,118 @@
+From b05da90d7023199e23daf8fbb49455138332f241 Mon Sep 17 00:00:00 2001
+From: Ren Yu <yux.ren@intel.com>
+Date: Wed, 24 Jul 2019 16:21:13 +0800
+Subject: [PATCH] Stop the watchdog when the host is going to off
+
+After the host is off, check the WDT status, if it is running,
+needs to stop it
+
+Tested:
+Set a watchdog with a long time expiration(Timer action is none,
+Timer Use is OEM and Initial Countdown is 435.1 second).
+ ipmitool raw 0x06 0x24 0x05 0x00 0x00 0x00 0xff 0x10
+Get the watchdog.
+ ipmitool mc watchdog get
+Start the watchdog.
+ ipmitool mc watchdog reset
+Host off.
+ ipmitool chassis power off
+Get the watchdog.
+ ipmitool mc watchdog get
+Check the watchdog status, expect watchdog is stoped.
+
+Signed-off-by: Ren Yu <yux.ren@intel.com>
+---
+ watchdog.cpp | 21 +++++++++++++++++++++
+ watchdog.hpp | 23 ++++++++++++++++++++++-
+ 2 files changed, 43 insertions(+), 1 deletion(-)
+
+diff --git a/watchdog.cpp b/watchdog.cpp
+index 4c8e480..fa58ef4 100644
+--- a/watchdog.cpp
++++ b/watchdog.cpp
+@@ -21,6 +21,10 @@ using namespace phosphor::logging;
+ using sdbusplus::exception::SdBusError;
+ using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
+
++const static constexpr char* currentPowerState = "CurrentPowerState";
++const static constexpr char* powerStatusOff =
++ "xyz.openbmc_project.State.Chassis.PowerState.Off";
++
+ const static constexpr char* powerActionHardReset =
+ "xyz.openbmc_project.State.Watchdog.Action.HardReset";
+ const static constexpr char* powerActionOff =
+@@ -60,6 +64,23 @@ static constexpr const char* interface = "xyz.openbmc_project.State.Chassis";
+ static constexpr const char* request = "RequestedPowerTransition";
+ } // namespace chassis
+
++void Watchdog::powerStateChangedHandler(
++ const std::map<std::string, std::variant<std::string>>& props)
++{
++ const auto iter = props.find(currentPowerState);
++ if (iter != props.end())
++ {
++ const std::string* powerState = std::get_if<std::string>(&iter->second);
++ if (powerState && (*powerState == powerStatusOff))
++ {
++ if (timerEnabled())
++ {
++ enabled(false);
++ }
++ }
++ }
++}
++
+ void Watchdog::resetTimeRemaining(bool enableWatchdog)
+ {
+ timeRemaining(interval());
+diff --git a/watchdog.hpp b/watchdog.hpp
+index 7de9bb3..dcbecd1 100644
+--- a/watchdog.hpp
++++ b/watchdog.hpp
+@@ -68,7 +68,18 @@ class Watchdog : public WatchdogInherits
+ WatchdogInherits(bus, objPath),
+ bus(bus), actionTargetMap(std::move(actionTargetMap)),
+ fallback(std::move(fallback)), minInterval(minInterval),
+- timer(event, std::bind(&Watchdog::timeOutHandler, this))
++ timer(event, std::bind(&Watchdog::timeOutHandler, this)),
++ powerStateChangedSignal(
++ bus,
++ sdbusplus::bus::match::rules::propertiesChanged(
++ "/xyz/openbmc_project/state/chassis0",
++ "xyz.openbmc_project.State.Chassis"),
++ [this](sdbusplus::message::message& msg) {
++ std::string objectName;
++ std::map<std::string, std::variant<std::string>> props;
++ msg.read(objectName, props);
++ powerStateChangedHandler(props);
++ })
+ {
+ // We set the watchdog interval with the default value.
+ interval(interval());
+@@ -77,6 +88,12 @@ class Watchdog : public WatchdogInherits
+ tryFallbackOrDisable();
+ }
+
++ /** @brief Disable watchdog when power status change meet
++ * the specific requirement
++ */
++ void powerStateChangedHandler(
++ const std::map<std::string, std::variant<std::string>>& props);
++
+ /** @brief Resets the TimeRemaining to the configured Interval
+ * Optionally enables the watchdog.
+ *
+@@ -165,6 +182,10 @@ class Watchdog : public WatchdogInherits
+ /** @brief Contained timer object */
+ sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> timer;
+
++ /** @brief Optional Callback handler when power status change meet
++ * the specific requirement */
++ sdbusplus::bus::match_t powerStateChangedSignal;
++
+ /** @brief Optional Callback handler on timer expirartion */
+ void timeOutHandler();
+
+--
+2.7.4
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0003-Add-redfish-log-support-for-IPMI-watchdog-pre-timeou.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0003-Add-redfish-log-support-for-IPMI-watchdog-pre-timeou.patch
deleted file mode 100644
index 309a8c646..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0003-Add-redfish-log-support-for-IPMI-watchdog-pre-timeou.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From 46e8e4fe6cb48145152e37380a4064c8957d2ff7 Mon Sep 17 00:00:00 2001
-From: Ren Yu <yux.ren@intel.com>
-Date: Tue, 28 May 2019 17:04:10 +0800
-Subject: [PATCH] Add redfish log support for IPMI watchdog pre-timeout
- interrupt
-
-Tested:
-Config IPMI watchdog: BIOS FRB2 Power Cycle after 1 seconds:
-ipmitool raw 0x06 0x24 0x01 0x13 0x0 0x2 0xa 0x00
-Start watchdog:
-Ipmitool mc watchdog reset
-Check the redfish logs in 1 seconds:
-https://BMCIP/redfish/v1/Systems/system/LogServices/EventLog/Entries
-
-Signed-off-by: Ren Yu <yux.ren@intel.com>
----
- watchdog.cpp | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/watchdog.cpp b/watchdog.cpp
-index d893237..5062049 100644
---- a/watchdog.cpp
-+++ b/watchdog.cpp
-@@ -104,6 +104,8 @@ uint64_t Watchdog::timeRemaining(uint64_t value)
- // Optional callback function on timer expiration
- void Watchdog::timeOutHandler()
- {
-+ PreTimeoutInterruptAction preTimeoutInterruptAction = preTimeoutInterrupt();
-+
- Action action = expireAction();
- if (!this->enabled())
- {
-@@ -117,6 +119,12 @@ void Watchdog::timeOutHandler()
- "REDFISH_MESSAGE_ARGS=%s",
- convertForMessage(action).c_str(), NULL);
-
-+ sd_journal_send("MESSAGE=IPMIWatchdog: Pre Timed out Interrupt=%s",
-+ convertForMessage(preTimeoutInterruptAction).c_str(),
-+ "PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s",
-+ "OpenBMC.0.1.IPMIWatchdog", "REDFISH_MESSAGE_ARGS=%s",
-+ convertForMessage(preTimeoutInterruptAction).c_str(), NULL);
-+
- expiredTimerUse(currentTimerUse());
-
- auto target = actionTargetMap.find(action);
---
-2.7.4
-
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/obmc-enable-host-watchdog@.service b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/obmc-enable-host-watchdog@.service
deleted file mode 100644
index 87a662f7c..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/obmc-enable-host-watchdog@.service
+++ /dev/null
@@ -1,14 +0,0 @@
-[Unit]
-Description=Start FRB2 Watchdog%i
-Wants=obmc-host-started@%i.target
-After=obmc-host-started@%i.target
-Wants=mapper-wait@-xyz-openbmc_project-watchdog-host%i.service
-After=mapper-wait@-xyz-openbmc_project-watchdog-host%i.service
-Conflicts=obmc-host-stop@%i.target
-ConditionPathExists=!/run/openbmc/host@%i-on
-
-[Service]
-Restart=always
-ExecStart=/usr/bin/env frb2-watchdog
-ExecStopPost=/bin/sh -c "busctl call `mapper get-service /xyz/openbmc_project/watchdog/host%i` /xyz/openbmc_project/watchdog/host%i org.freedesktop.DBus.Properties Set ssv xyz.openbmc_project.State.Watchdog Enabled b false"
-SyslogIdentifier=obmc-enable-host-watchdog
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog.service b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog.service
new file mode 100644
index 000000000..5ef1a4179
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Phosphor Watchdog
+
+[Service]
+ExecStart=/usr/bin/env phosphor-watchdog --continue --service=xyz.openbmc_project.Watchdog \
+ --path=/xyz/openbmc_project/watchdog/host0 \
+ --action_target=xyz.openbmc_project.State.Watchdog.Action.HardReset=xyz.openbmc_project.State.Chassis.Transition.Reset \
+ --action_target=xyz.openbmc_project.State.Watchdog.Action.PowerOff=xyz.openbmc_project.State.Chassis.Transition.Off \
+ --action_target=xyz.openbmc_project.State.Watchdog.Action.PowerCycle=xyz.openbmc_project.State.Chassis.Transition.PowerCycle
+
+SyslogIdentifier=phosphor-watchdog
+BusName =xyz.openbmc_project.Watchdog
+Type=dbus
+
+[Install]
+WantedBy=basic.target
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog@.service b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog@.service
deleted file mode 100644
index 251c2257b..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog@.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=Phosphor %I watchdog
-
-[Service]
-Restart=no
-EnvironmentFile={envfiledir}/obmc/watchdog/%I
-ExecStart=/usr/bin/env phosphor-watchdog --continue --service=${{SERVICE}} --path=${{DEVPATH}} \
- --action_target=xyz.openbmc_project.State.Watchdog.Action.HardReset=obmc-host-warm-reset@0.target \
- --action_target=xyz.openbmc_project.State.Watchdog.Action.PowerOff=obmc-host-shutdown@0.target \
- --action_target=xyz.openbmc_project.State.Watchdog.Action.PowerCycle=obmc-host-reboot@0.target
-
-SyslogIdentifier=phosphor-watchdog
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend
index c117102ee..caaca2670 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend
@@ -1,9 +1,10 @@
FILESEXTRAPATHS_append := ":${THISDIR}/${PN}"
-SRC_URI += "file://0001-Add-redfish-log-support-for-IPMI-watchdog-timeout-ac.patch \
- file://0002-Add-restart-cause-support.patch \
- file://0003-Add-redfish-log-support-for-IPMI-watchdog-pre-timeou.patch \
+SRCREV = "c35135d32f9cb84b62de7b72eee3a2e87b4b3d4d"
+SRC_URI += "file://0001-Move-Phosphor-Watchdog-to-Not-Use-Service-Files.patch \
+ file://0002-Stop-the-watchdog-when-the-host-is-going-to-off.patch \
"
# Remove the override to keep service running after DC cycle
SYSTEMD_OVERRIDE_${PN}_remove = "poweron.conf:phosphor-watchdog@poweron.service.d/poweron.conf"
+SYSTEMD_SERVICE_${PN} = "phosphor-watchdog.service"