summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2019-04-04 15:30:30 -0700
committerWilliam A. Kennington III <wak@google.com>2019-04-05 13:45:34 -0700
commit26eef26c97beec18d0f96fd1cd792229caded542 (patch)
tree441193a5a33bac7b9762de96e8a5573254da8872
parent8c8072aa4a084aace4ee16614fad9c626c8f8a44 (diff)
downloadphosphor-watchdog-26eef26c97beec18d0f96fd1cd792229caded542.tar.gz
phosphor-watchdog-26eef26c97beec18d0f96fd1cd792229caded542.zip
mainapp: Add an option for watching post codes
We have some machines that use an IPMI watchdog, but can sometimes take so long to reboot that the watchdog ends up tripping during the boot process. Unfortunately the boot firmware has no method of talking IPMI to pet the watchdog, but does emit post codes during the boot up process when it makes forward progress. This change adds a flag to instruct the watchdog that it should reset the TimeRemaining on the watchdog any time new post codes are seen from the host. Tested: Verified that post codes signals were received during the boot process and the watchdog TimeRemaining was updated accordingly. Change-Id: Ie0616f0fe4ee6601f9afdc4eba71f34968780794 Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r--mainapp.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/mainapp.cpp b/mainapp.cpp
index b8c84c9..35ef255 100644
--- a/mainapp.cpp
+++ b/mainapp.cpp
@@ -17,6 +17,7 @@
#include "watchdog.hpp"
#include <CLI/CLI.hpp>
+#include <functional>
#include <iostream>
#include <optional>
#include <phosphor-logging/elog-errors.hpp>
@@ -123,6 +124,12 @@ int main(int argc, char* argv[])
->needs(fallbackActionOpt)
->needs(fallbackIntervalOpt);
+ // Should we watch for postcodes
+ bool watchPostcodes;
+ app.add_flag("-w,--watch_postcodes", watchPostcodes,
+ "Should we reset the time remaining any time a postcode "
+ "is signaled.");
+
CLI11_PARSE(app, argc, argv);
// Put together a list of actions and associated systemd targets
@@ -213,6 +220,18 @@ int main(int argc, char* argv[])
Watchdog watchdog(bus, path.c_str(), event, std::move(actionTargetMap),
std::move(maybeFallback));
+ std::optional<sdbusplus::bus::match::match> watchPostcodeMatch;
+ if (watchPostcodes)
+ {
+ watchPostcodeMatch.emplace(
+ bus,
+ sdbusplus::bus::match::rules::propertiesChanged(
+ "/xyz/openbmc_project/state/boot/raw",
+ "xyz.openbmc_project.State.Boot.Raw"),
+ std::bind(&Watchdog::resetTimeRemaining, std::ref(watchdog),
+ false));
+ }
+
// Claim the bus
bus.request_name(service.c_str());
OpenPOWER on IntegriCloud