psu-ng: Add code to detect temperature fault
If the low byte of STATUS_WORD has bit 2 on/1, there is a temperature
fault or warning.
Tested:
Verify no error logged for temperature fault during normal operation
on real hardware.
Verify temperature fault error logged when simulated
over-temperature fault.
Change-Id: Ib5b0fe849699e72e517ea4d59a69bbb6de1e5283
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 73998f3..2cef368 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -213,6 +213,8 @@
statusCML = pmbusIntf->read(STATUS_CML, Type::Debug);
auto status0Vout = pmbusIntf->insertPageNum(STATUS_VOUT, 0);
statusVout = pmbusIntf->read(status0Vout, Type::Debug);
+ statusTemperature =
+ pmbusIntf->read(STATUS_TEMPERATURE, Type::Debug);
if (statusWord & status_word::CML_FAULT)
{
if (!cmlFault)
@@ -257,6 +259,23 @@
voutOVFault = 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;
+ }
+
if (statusWord & status_word::MFR_SPECIFIC_FAULT)
{
if (!mfrFault)
@@ -294,6 +313,7 @@
mfrFault = false;
vinUVFault = false;
voutOVFault = false;
+ tempFault = false;
}
}
catch (const ReadFailure& e)
@@ -345,6 +365,7 @@
vinUVFault = false;
cmlFault = false;
voutOVFault = false;
+ tempFault = false;
readFail = 0;
try