psu-ng: Add code to detect VOUT_OV_FAULT
If the output voltage hits an overvoltage condition, the VOUT_OV_FAULT
bit (bit 5 of STATUS_WORD low byte) should turn on. The PMBus spec
indicates that VOUT fault/warning (bit 7 high byte) and VOUT_OV_FAULT
are associated with status in the STATUS_VOUT command response.
Check for VOUT_OV_FAULT after check for VIN_UV_FAULT, create error if
the fault is indicated.
Change-Id: Ia68b4f986393f0ba0184401deb29b4f5d25a2ed0
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 d322043..0cc80d9 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -169,6 +169,14 @@
}
/**
+ * @brief Returns the last read value from STATUS_VOUT.
+ */
+ uint64_t getStatusVout() const
+ {
+ return statusVout;
+ }
+
+ /**
* @brief Returns true if a fault was found.
*/
bool isFaulted() const
@@ -217,6 +225,14 @@
}
/**
+ * @brief Returns true if VOUT_OV_FAULT occurred.
+ */
+ bool hasVoutOVFault() const
+ {
+ return voutOVFault;
+ }
+
+ /**
* @brief Returns the device path
*
* This can be used for error call outs.
@@ -288,6 +304,9 @@
/** @brief Will be updated to the latest/last value read from STATUS_CML.*/
uint64_t statusCML = 0;
+ /** @brief Will be updated to the latest/last value read from STATUS_VOUT.*/
+ uint64_t statusVout = 0;
+
/** @brief True if a fault has already been found and not cleared */
bool faultFound = false;
@@ -306,6 +325,9 @@
/** @brief True if bit 3 of STATUS_WORD low byte is on. */
bool vinUVFault = false;
+ /** @brief True if bit 5 of STATUS_WORD low byte is on. */
+ bool voutOVFault = false;
+
/** @brief Count of the number of read failures. */
size_t readFail = 0;