Add method to turn off UCD90160 hardware accesses
As the fault monitoring functionality is going in toward
the end of a release, a flag is being provided to quickly
turn off the hardware accesses while still leaving the
ability to create general errors on PGOOD fails, as
well as issuing a shutdown on a runtime PGOOD fail.
This is meant to used if it turns out there are problems
with the hardware that end up taking a lot of time to debug.
The flag is --enable-turn-off-ucd90160-access.
Change-Id: I03f0ab5dc4010bf20ef2871f2e737ce310b4398f
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/configure.ac b/configure.ac
index 28719bd..cb986cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,6 +38,18 @@
# Checks for library functions.
LT_INIT # Required for systemd linking
+AC_ARG_ENABLE([turn-off-ucd90160-access],
+ AS_HELP_STRING([--enable-turn-off-ucd90160-access], [Turn off UCD90160 hardware access])
+)
+
+AC_ARG_VAR(UCD90160_DEVICE_ACCESS, [Turn off UCD90160 hardware access])
+
+# Always define UCD90160_DEVICE_ACCESS unless explicitly turned off
+AS_IF([test "x$enable_turn_off_ucd90160_access" != "xyes"],
+ [UCD90160_DEVICE_ACCESS="yes"]
+ AC_DEFINE_UNQUOTED([UCD90160_DEVICE_ACCESS], ["$UCD90160_DEVICE_ACCESS"], [Turn off UCD90160 hardware access])
+)
+
# Create configured output
AC_CONFIG_FILES([Makefile power-sequencer/Makefile])
AC_OUTPUT
diff --git a/power-sequencer/pgood_monitor.cpp b/power-sequencer/pgood_monitor.cpp
index 2cafee6..9e8abba 100644
--- a/power-sequencer/pgood_monitor.cpp
+++ b/power-sequencer/pgood_monitor.cpp
@@ -15,6 +15,7 @@
*/
#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Power/Fault/error.hpp>
+#include "config.h"
#include "elog-errors.hpp"
#include "pgood_monitor.hpp"
#include "utility.hpp"
@@ -84,7 +85,9 @@
if (pgoodPending())
{
+#ifdef UCD90160_DEVICE_ACCESS
device->onFailure();
+#endif
report<PowerOnFailure>();
}
diff --git a/power-sequencer/runtime_monitor.cpp b/power-sequencer/runtime_monitor.cpp
index 3873ac0..4c64c52 100644
--- a/power-sequencer/runtime_monitor.cpp
+++ b/power-sequencer/runtime_monitor.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
#include <phosphor-logging/log.hpp>
+#include "config.h"
#include "runtime_monitor.hpp"
#include "utility.hpp"
@@ -26,9 +27,13 @@
int RuntimeMonitor::run()
{
+#ifdef UCD90160_DEVICE_ACCESS
device->clearFaults();
return DeviceMonitor::run();
+#else
+ return EXIT_SUCCESS;
+#endif
}
void RuntimeMonitor::onPowerLost(sdbusplus::message::message& msg)
@@ -39,8 +44,9 @@
{
timer.stop();
+#ifdef UCD90160_DEVICE_ACCESS
device->onFailure();
-
+#endif
//Note: This application only runs when the system has
//power, so it will be killed by systemd sometime shortly
//after this power off is issued.