psu-ng: Refactor temperature fault detection
Split off temperature fault checking of STATUS_WORD into its own
function.
Change-Id: Ia7dc08af12647cc7ca76356c9e9d2b75e2e95f56
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 6fd412a..b5eeb2f 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -189,6 +189,25 @@
}
}
+void PowerSupply::analyzeTemperatureFault()
+{
+ if (statusWord & phosphor::pmbus::status_word::TEMPERATURE_FAULT_WARN)
+ {
+ if (!tempFault)
+ {
+ log<level::ERR>(fmt::format("TEMPERATURE fault/warning: "
+ "STATUS_WORD = {:#04x}, "
+ "STATUS_MFR_SPECIFIC = {:#02x}, "
+ "STATUS_TEMPERATURE = {:#02x}",
+ statusWord, statusMFR,
+ statusTemperature)
+ .c_str());
+ }
+
+ tempFault = true;
+ }
+}
+
void PowerSupply::analyzePgoodFault()
{
if ((statusWord & phosphor::pmbus::status_word::POWER_GOOD_NEGATED) ||
@@ -372,22 +391,7 @@
fanFault = true;
}
- if (statusWord & status_word::TEMPERATURE_FAULT_WARN)
- {
- if (!tempFault)
- {
- log<level::ERR>(
- fmt::format("TEMPERATURE fault/warning: "
- "STATUS_WORD = {:#04x}, "
- "STATUS_MFR_SPECIFIC = {:#02x}, "
- "STATUS_TEMPERATURE = {:#02x}",
- statusWord, statusMFR,
- statusTemperature)
- .c_str());
- }
-
- tempFault = true;
- }
+ analyzeTemperatureFault();
analyzePgoodFault();
diff --git a/phosphor-power-supply/power_supply.hpp b/phosphor-power-supply/power_supply.hpp
index 3cb5a6d..04d73f7 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -491,6 +491,11 @@
size_t readFail = 0;
/**
+ * @brief Examine STATUS_WORD for temperature fault.
+ */
+ void analyzeTemperatureFault();
+
+ /**
* @brief Examine STATUS_WORD for pgood or unit off faults.
*/
void analyzePgoodFault();