psu-ng: Add in detection of fan faults
If the FANS bit in the STATUS_WORD turns on (A fan or airflow fault or
warning has occurred), set a fan fault indicator in the power supply
object. During analysis of the power supplies, if a fan fault has
occurred, prioritize that over a temperature fault, include the
STATUS_TEMPERATURE and STATUS_FANS_1_2 command responses in the error
created. Call out the power supply with the fault.
Tested:
Verify no faults detected or logged on real hardware (Rainier 2S4U).
Simulate fan 1 fault on Rainier 2S2U, 110015FF PEL created.
Change-Id: Ifff5b4d96efe44b081a33caa01d70fdb578e57e3
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/phosphor-power-supply/psu_manager.cpp b/phosphor-power-supply/psu_manager.cpp
index 1c9378b..5a4af4b 100644
--- a/phosphor-power-supply/psu_manager.cpp
+++ b/phosphor-power-supply/psu_manager.cpp
@@ -509,6 +509,25 @@
psu->setFaultLogged();
}
+ // A fan fault should have priority over a temperature fault,
+ // since a failed fan may lead to a temperature problem.
+ else if (psu->hasFanFault())
+ {
+ // Include STATUS_TEMPERATURE and STATUS_FANS_1_2
+ additionalData["STATUS_TEMPERATURE"] =
+ fmt::format("{:#02x}", psu->getStatusTemperature());
+ additionalData["STATUS_FANS_1_2"] =
+ fmt::format("{:#02x}", psu->getStatusFans12());
+
+ additionalData["CALLOUT_INVENTORY_PATH"] =
+ psu->getInventoryPath();
+
+ createError(
+ "xyz.openbmc_project.Power.PowerSupply.Error.FanFault",
+ additionalData);
+
+ psu->setFaultLogged();
+ }
else if (psu->hasTempFault())
{
// Include STATUS_TEMPERATURE for temperature faults.