psu-ng: Add in detection of PGOOD fault
If STATUS_WORD has bit 11 high (POWER_GOOD# is inactive) or bit 6 high
(unit is OFF), consider that a PGOOD fault. Lowest priority error to
check, log an error if a power supply has a PGOOD fault, call out the
power supply.
Tested:
Simulated POWER_GOOD# / OFF and verified error logged.
Verified normal operations on real hardware do not log error.
Get power supply in bad state via i2cset commands:
1. Write 0x19 to 0x02 (ON_OFF_CONFIG, OPERATION command only).
2. Write 0x00 to 0x01 (Immediate off OPERATION command).
3. Restart service, error logged for STATUS_WORD = 0x0800.
4. Write 0x19 to 0x02, 0x00 to 0x01 while powered on.
5. Error logged for STATUS_WORD=0x0840.
Change-Id: I24dd1db780510d39dc245e76977099f790a2e59e
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 2cef368..8183e37 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -276,6 +276,22 @@
tempFault = true;
}
+ if ((statusWord & status_word::POWER_GOOD_NEGATED) ||
+ (statusWord & status_word::UNIT_IS_OFF))
+ {
+ if (!pgoodFault)
+ {
+ log<level::ERR>(
+ fmt::format("PGOOD fault: "
+ "STATUS_WORD = {:#04x}, "
+ "STATUS_MFR_SPECIFIC = {:#02x}",
+ statusWord, statusMFR)
+ .c_str());
+ }
+
+ pgoodFault = true;
+ }
+
if (statusWord & status_word::MFR_SPECIFIC_FAULT)
{
if (!mfrFault)
@@ -314,6 +330,7 @@
vinUVFault = false;
voutOVFault = false;
tempFault = false;
+ pgoodFault = false;
}
}
catch (const ReadFailure& e)
@@ -366,6 +383,7 @@
cmlFault = false;
voutOVFault = false;
tempFault = false;
+ pgoodFault = false;
readFail = 0;
try