Add power fault check to checkstop handler
If a power fault is being reported during a
checkstop condition we will not call the
analyzer.
Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: I9813a55b80eb1b94c6ad2d5cddb2e56b1daa67f4
diff --git a/attn/attn_handler.cpp b/attn/attn_handler.cpp
index 3252078..a0e428e 100644
--- a/attn/attn_handler.cpp
+++ b/attn/attn_handler.cpp
@@ -33,7 +33,6 @@
namespace attn
{
-
/**
* @brief Handle checkstop attention
*
@@ -247,23 +246,25 @@
}
else
{
- // wait for power fault handling before starting analyses
+ // check for power fault before starting analyses
sleepSeconds(POWER_FAULT_WAIT);
-
- // Look for any attentions found in hardware. This will generate and
- // commit a PEL if any errors are found.
- DumpParameters dumpParameters;
- auto logid = analyzer::analyzeHardware(
- analyzer::AnalysisType::SYSTEM_CHECKSTOP, dumpParameters);
- if (0 == logid)
+ if (!util::dbus::powerFault())
{
- // A PEL should exist for a checkstop attention.
- rc = RC_ANALYZER_ERROR;
- }
- else
- {
- requestDump(logid, dumpParameters);
- util::dbus::transitionHost(util::dbus::HostState::Quiesce);
+ // Look for any attentions found in hardware. This will generate and
+ // commit a PEL if any errors are found.
+ DumpParameters dumpParameters;
+ auto logid = analyzer::analyzeHardware(
+ analyzer::AnalysisType::SYSTEM_CHECKSTOP, dumpParameters);
+ if (0 == logid)
+ {
+ // A PEL should exist for a checkstop attention.
+ rc = RC_ANALYZER_ERROR;
+ }
+ else
+ {
+ requestDump(logid, dumpParameters);
+ util::dbus::transitionHost(util::dbus::HostState::Quiesce);
+ }
}
}
diff --git a/util/dbus.cpp b/util/dbus.cpp
index f9370d4..ca5ccc4 100644
--- a/util/dbus.cpp
+++ b/util/dbus.cpp
@@ -530,5 +530,34 @@
return true;
}
+/** @brief Determine if power fault was detected */
+bool powerFault()
+{
+ // power fault based on pgood property
+ int32_t pgood = 0; // assume fault or unknown
+
+ constexpr auto interface = "org.openbmc.control.Power";
+
+ DBusService service;
+ DBusPath path;
+
+ // find a dbus service and object path that implements the interface
+ if (0 == find(interface, path, service))
+ {
+ DBusValue value;
+
+ // chassis pgood is implemented as a property
+ constexpr auto property = "pgood";
+
+ if (0 == getProperty(interface, path, service, property, value))
+ {
+ // return value is a variant, int32 == 1 for pgood OK
+ pgood = std::get<int32_t>(value);
+ }
+ }
+
+ return pgood != 1 ? true : false; // if not pgood then power fault
+}
+
} // namespace dbus
} // namespace util
diff --git a/util/dbus.hpp b/util/dbus.hpp
index 39041e2..6c1a554 100644
--- a/util/dbus.hpp
+++ b/util/dbus.hpp
@@ -12,7 +12,7 @@
namespace dbus
{
using DBusValue = std::variant<std::string, bool, std::vector<uint8_t>,
- std::vector<std::string>>;
+ std::vector<std::string>, int32_t>;
using DBusProperty = std::string;
using DBusInterface = std::string;
using DBusService = std::string;
@@ -179,5 +179,12 @@
*/
bool getMctpInstance(uint8_t& mctpInstance, uint8_t Eid);
+/**
+ * @brief Determine if power fault was detected
+ *
+ * @return true if power fault or unknown, false otherwise
+ */
+bool powerFault();
+
} // namespace dbus
} // namespace util