psu-ng: Detect CML fault
If the STATUS_WORD has the CML (Communication, Memory, Logic) fault bit
on, bit 1 in lower byte of STATUS_WORD, then read STATUS_CML, and treat
the fault as another variety of a communication fault/error.
Change-Id: Iba368683734777874ba54ec845cbc94b00010b68
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/phosphor-power-supply/power_supply.hpp b/phosphor-power-supply/power_supply.hpp
index 86ce57c..d322043 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -161,6 +161,14 @@
}
/**
+ * @brief Returns the last read value from STATUS_CML.
+ */
+ uint64_t getStatusCML() const
+ {
+ return statusCML;
+ }
+
+ /**
* @brief Returns true if a fault was found.
*/
bool isFaulted() const
@@ -252,7 +260,7 @@
*/
bool hasCommFault() const
{
- return readFail >= LOG_LIMIT;
+ return ((readFail >= LOG_LIMIT) || (cmlFault));
}
/**
@@ -277,12 +285,18 @@
/** @brief Will be updated to the latest/lastvalue read from STATUS_MFR.*/
uint64_t statusMFR = 0;
+ /** @brief Will be updated to the latest/last value read from STATUS_CML.*/
+ uint64_t statusCML = 0;
+
/** @brief True if a fault has already been found and not cleared */
bool faultFound = false;
/** @brief True if an error for a fault has already been logged. */
bool faultLogged = false;
+ /** @brief True if bit 2 of STATUS_WORD low byte is on. */
+ bool cmlFault = false;
+
/** @brief True if bit 5 of STATUS_WORD high byte is on. */
bool inputFault = false;