pseq: Standard pgood fault detection algorithm
Create a StandardDevice class for the phosphor-power-sequencer
application. This class implements the standard pgood (power good)
fault detection algorithm.
When adding support for a new power sequencer device type, a sub-class
of StandardDevice should be created if possible. This will ensure that
pgood fault detection works consistently across device types.
Tested:
* Verified all new and existing gtests ran successfully
Change-Id: I80c0b36429f1d84fa1e317889803429927797fdc
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
diff --git a/phosphor-power-sequencer/src/power_sequencer_device.hpp b/phosphor-power-sequencer/src/power_sequencer_device.hpp
index f6ebb48..7a8c1b3 100644
--- a/phosphor-power-sequencer/src/power_sequencer_device.hpp
+++ b/phosphor-power-sequencer/src/power_sequencer_device.hpp
@@ -129,9 +129,13 @@
virtual double getVoutUVFaultLimit(uint8_t page) = 0;
/**
- * Returns whether a pgood fault has occurred on one of the rails being
+ * Checks whether a pgood fault has occurred on one of the rails being
* monitored by this device.
*
+ * If a pgood fault was found, this method returns a string containing the
+ * error that should be logged. If no fault was found, an empty string is
+ * returned.
+ *
* Throws an exception if an error occurs while trying to obtain the status
* of the rails.
*
@@ -141,16 +145,14 @@
* supply error occurred. This error may be the
* root cause if a pgood fault occurred on a power
* supply rail monitored by this device.
- * @param error Error that should be logged if this method returns true.
* @param additionalData Additional data to include in the error log if
- * this method returns true.
- * @return true if a pgood fault was found on a rail monitored by this
- * device, false otherwise
+ * a pgood fault was found
+ * @return error that should be logged if a pgood fault was found, or an
+ * empty string if no pgood fault was found
*/
- virtual bool
- hasPgoodFault(Services& services, const std::string& powerSupplyError,
- std::string& error,
- std::map<std::string, std::string>& additionalData) = 0;
+ virtual std::string
+ findPgoodFault(Services& services, const std::string& powerSupplyError,
+ std::map<std::string, std::string>& additionalData) = 0;
};
} // namespace phosphor::power::sequencer