psu-ng: Refactor VOUT_UV_FAULT detection
Split off code checking for VOUT_UV fault in STATUS_WORD to its own
function.
Change-Id: I3b5e898a7d4f1ad21317c66b7fcb97c211581dcd
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/phosphor-power-supply/power_supply.cpp b/phosphor-power-supply/power_supply.cpp
index 9e58ff2..5be801a 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -257,6 +257,25 @@
}
}
+void PowerSupply::analyzeVoutUVFault()
+{
+ if ((statusWord & phosphor::pmbus::status_word::VOUT_FAULT) &&
+ !(statusWord & phosphor::pmbus::status_word::VOUT_OV_FAULT))
+ {
+ if (!voutUVFault)
+ {
+ log<level::ERR>(
+ fmt::format("VOUT_UV_FAULT fault: STATUS_WORD = {:#04x}, "
+ "STATUS_MFR_SPECIFIC = {:#02x}, "
+ "STATUS_VOUT = {:#02x}",
+ statusWord, statusMFR, statusVout)
+ .c_str());
+ }
+
+ voutUVFault = true;
+ }
+}
+
void PowerSupply::analyzeTemperatureFault()
{
if (statusWord & phosphor::pmbus::status_word::TEMPERATURE_FAULT_WARN)
@@ -375,22 +394,7 @@
analyzeIoutOCFault();
- if ((statusWord & status_word::VOUT_FAULT) &&
- !(statusWord & status_word::VOUT_OV_FAULT))
- {
- if (!voutUVFault)
- {
- log<level::ERR>(
- fmt::format(
- "VOUT_UV_FAULT fault: STATUS_WORD = {:#04x}, "
- "STATUS_MFR_SPECIFIC = {:#02x}, "
- "STATUS_VOUT = {:#02x}",
- statusWord, statusMFR, statusVout)
- .c_str());
- }
-
- voutUVFault = true;
- }
+ analyzeVoutUVFault();
if (statusWord & status_word::FAN_FAULT)
{
diff --git a/phosphor-power-supply/power_supply.hpp b/phosphor-power-supply/power_supply.hpp
index ae4a02c..1e1e0fe 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -520,6 +520,15 @@
void analyzeIoutOCFault();
/**
+ * @brief Examines STATUS_WORD value read to see if there is a UV fault.
+ *
+ * Checks if the VOUT bit is on, indicating "An output voltage fault or
+ * warning has occurred", if it is on, but VOUT_OV_FAULT is off, it is
+ * determined to be an indication of an output under-voltage fault.
+ */
+ void analyzeVoutUVFault();
+
+ /**
* @brief Examine STATUS_WORD for temperature fault.
*/
void analyzeTemperatureFault();