From 26eef26c97beec18d0f96fd1cd792229caded542 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Thu, 4 Apr 2019 15:30:30 -0700 Subject: 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 --- mainapp.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 +#include #include #include #include @@ -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 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()); -- cgit v1.2.1