diff options
author | Jason M. Bills <jason.m.bills@intel.com> | 2019-08-19 21:05:51 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2019-09-06 03:12:31 +0300 |
commit | 0765f013c380af9ced4aa6c1b8556d6606735a01 (patch) | |
tree | cdcd838771a2867302f51d66c624dad675771772 | |
parent | 54974de2033fbbe1c34b1cffe6a3daae120fef2a (diff) | |
download | provingground-0765f013c380af9ced4aa6c1b8556d6606735a01.tar.xz |
Add ERR0 timeout monitoring and logging
This adds ERR0 timeout monitoring to the host error monitor. When
the ERR0 signal is asserted for more than 90 seconds, the BMC will
log which CPU asserted the ERR0 signal.
Tested:
Manually triggered an ERR0 timeout and confirmed that the event is
logged correctly.
Change-Id: I1d2811b5d020a554870e687b0926c3f9211147d0
Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
-rw-r--r-- | host_error_monitor/src/host_error_monitor.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/host_error_monitor/src/host_error_monitor.cpp b/host_error_monitor/src/host_error_monitor.cpp index 5464b04..b7e81f7 100644 --- a/host_error_monitor/src/host_error_monitor.cpp +++ b/host_error_monitor/src/host_error_monitor.cpp @@ -39,6 +39,8 @@ const static constexpr int crashdumpTimeoutS = 300; // Timers // Timer for CATERR asserted static boost::asio::steady_timer caterrAssertTimer(io); +// Timer for ERR0 asserted +static boost::asio::steady_timer err0AssertTimer(io); // Timer for ERR2 asserted static boost::asio::steady_timer err2AssertTimer(io); // Timer for SMI asserted @@ -47,6 +49,8 @@ static boost::asio::steady_timer smiAssertTimer(io); // GPIO Lines and Event Descriptors static gpiod::line caterrLine; static boost::asio::posix::stream_descriptor caterrEvent(io); +static gpiod::line err0Line; +static boost::asio::posix::stream_descriptor err0Event(io); static gpiod::line err2Line; static boost::asio::posix::stream_descriptor err2Event(io); static gpiod::line smiLine; @@ -174,6 +178,7 @@ static std::shared_ptr<sdbusplus::bus::match::match> startHostStateMonitor() if (hostOff) { caterrAssertTimer.cancel(); + err0AssertTimer.cancel(); err2AssertTimer.cancel(); smiAssertTimer.cancel(); } @@ -778,6 +783,42 @@ static void errXAssertHandler(const int errPin, }); } +static void err0AssertHandler() +{ + // Handle the standard ERR0 detection and logging + const static constexpr int err0 = 0; + errXAssertHandler(err0, err0AssertTimer); +} + +static void err0Handler() +{ + if (!hostOff) + { + gpiod::line_event gpioLineEvent = err0Line.event_read(); + + bool err0 = gpioLineEvent.event_type == gpiod::line_event::FALLING_EDGE; + if (err0) + { + err0AssertHandler(); + } + else + { + err0AssertTimer.cancel(); + } + } + err0Event.async_wait(boost::asio::posix::stream_descriptor::wait_read, + [](const boost::system::error_code ec) { + if (ec) + { + std::cerr + << "err0 handler error: " << ec.message() + << "\n"; + return; + } + err0Handler(); + }); +} + static void err2AssertHandler() { // Handle the standard ERR2 detection and logging @@ -924,6 +965,12 @@ static void initializeErrorState() caterrAssertHandler(); } + // Handle CPU_ERR0 if it's asserted now + if (err0Line.get_value() == 0) + { + err0AssertHandler(); + } + // Handle CPU_ERR2 if it's asserted now if (err2Line.get_value() == 0) { @@ -971,6 +1018,14 @@ int main(int argc, char* argv[]) return -1; } + // Request CPU_ERR0 GPIO events + if (!host_error_monitor::requestGPIOEvents( + "CPU_ERR0", host_error_monitor::err0Handler, + host_error_monitor::err0Line, host_error_monitor::err0Event)) + { + return -1; + } + // Request CPU_ERR2 GPIO events if (!host_error_monitor::requestGPIOEvents( "CPU_ERR2", host_error_monitor::err2Handler, |