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.hpp b/phosphor-power-supply/power_supply.hpp
index 8d072c7..c1f7e59 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -177,12 +177,20 @@
}
/**
+ * @brief Returns the last value read from STATUS_TEMPERATURE.
+ */
+ uint64_t getStatusTemperature() const
+ {
+ return statusTemperature;
+ }
+
+ /**
* @brief Returns true if a fault was found.
*/
bool isFaulted() const
{
return (hasCommFault() || vinUVFault || inputFault || voutOVFault ||
- mfrFault);
+ tempFault || mfrFault);
}
/**
@@ -234,6 +242,14 @@
}
/**
+ * @brief Returns true if TEMPERATURE fault occurred.
+ */
+ bool hasTempFault() const
+ {
+ return tempFault;
+ }
+
+ /**
* @brief Returns the device path
*
* This can be used for error call outs.
@@ -308,10 +324,14 @@
/** @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_TEMPERATURE.*/
+ uint64_t statusTemperature = 0;
+
/** @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. */
+ /** @brief True if bit 1 of STATUS_WORD low byte is on. */
bool cmlFault = false;
/** @brief True if bit 5 of STATUS_WORD high byte is on. */
@@ -326,6 +346,9 @@
/** @brief True if bit 5 of STATUS_WORD low byte is on. */
bool voutOVFault = false;
+ /** @brief True if bit 2 of STATUS_WORD low byte is on. */
+ bool tempFault = false;
+
/** @brief Count of the number of read failures. */
size_t readFail = 0;