psu-ng: Add in detection of IOUT_OC fault
If bit 4 of STATUS_BYTE (lower byte of STATUS_WORD) turns on, there is
an output over-current fault. Add in code to detect that and log an
error, has priority after VOUT_OV fault.
Change-Id: Ia9cdb04a16a9f980aa699a8fff247d0c47e0aa93
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 ca73959..8bd2a30 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -177,6 +177,14 @@
}
/**
+ * @brief Returns the last value read from STATUS_IOUT.
+ */
+ uint64_t getStatusIout() const
+ {
+ return statusIout;
+ }
+
+ /**
* @brief Returns the last value read from STATUS_TEMPERATURE.
*/
uint64_t getStatusTemperature() const
@@ -190,7 +198,7 @@
bool isFaulted() const
{
return (hasCommFault() || vinUVFault || inputFault || voutOVFault ||
- tempFault || pgoodFault || mfrFault);
+ ioutOCFault || tempFault || pgoodFault || mfrFault);
}
/**
@@ -242,6 +250,14 @@
}
/**
+ * @brief Returns true if IOUT_OC fault occurred (bit 4 STATUS_BYTE).
+ */
+ bool hasIoutOCFault() const
+ {
+ return ioutOCFault;
+ }
+
+ /**
* @brief Returns true if TEMPERATURE fault occurred.
*/
bool hasTempFault() const
@@ -333,6 +349,9 @@
/** @brief Will be updated to the latest/last value read from STATUS_VOUT.*/
uint64_t statusVout = 0;
+ /** @brief Will be updated to the latest/last value read from STATUS_IOUT.*/
+ uint64_t statusIout = 0;
+
/** @brief Will be updated to the latest/last value read from
* STATUS_TEMPERATURE.*/
uint64_t statusTemperature = 0;
@@ -355,6 +374,9 @@
/** @brief True if bit 5 of STATUS_WORD low byte is on. */
bool voutOVFault = false;
+ /** @brief True if bit 4 of STATUS_WORD low byte is on. */
+ bool ioutOCFault = false;
+
/** @brief True if bit 2 of STATUS_WORD low byte is on. */
bool tempFault = false;