pseq: Prevent multiple failures
Multiple failures can occur when the power down sequence is slow. Add a
flag to threshold the failures. Clear the flag at power on.
Signed-off-by: Jim Wright <jlwright@us.ibm.com>
Change-Id: I1b476feff1967b4fa60f29bd719bf6ee14fba103
diff --git a/phosphor-power-sequencer/src/power_control.cpp b/phosphor-power-sequencer/src/power_control.cpp
index 838078e..7f6ef9f 100644
--- a/phosphor-power-sequencer/src/power_control.cpp
+++ b/phosphor-power-sequencer/src/power_control.cpp
@@ -170,6 +170,7 @@
additionalData);
}
+ failureFound = true;
return;
}
}
@@ -186,8 +187,9 @@
else
{
emitPowerGoodSignal();
- // Clear any power supply error on the transition to power on
+ // Clear any errors on the transition to power on
powerSupplyError.clear();
+ failureFound = false;
}
emitPropertyChangedSignal("pgood");
}
@@ -196,10 +198,11 @@
// Power good matches requested state
inStateTransition = false;
}
- else if (!inStateTransition && (pgoodState == 0))
+ else if (!inStateTransition && (pgoodState == 0) && !failureFound)
{
// Not in power off state, not changing state, and power good is off
device->onFailure(false, powerSupplyError);
+ failureFound = true;
// Power good has failed, call for chassis hard power off
log<level::ERR>("Chassis pgood failure");
diff --git a/phosphor-power-sequencer/src/power_control.hpp b/phosphor-power-sequencer/src/power_control.hpp
index 5bd5e47..560a5f9 100644
--- a/phosphor-power-sequencer/src/power_control.hpp
+++ b/phosphor-power-sequencer/src/power_control.hpp
@@ -83,7 +83,12 @@
bool deviceFound{false};
/**
- * Indicates if a state transistion is taking place
+ * Indicates if a failure has already been found. Cleared at power on.
+ */
+ bool failureFound{false};
+
+ /**
+ * Indicates if a state transition is taking place
*/
bool inStateTransition{false};
@@ -125,7 +130,7 @@
gpiod::line powerControlLine;
/**
- * Power supply error
+ * Power supply error. Cleared at power on.
*/
std::string powerSupplyError;