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/psu_manager.cpp b/phosphor-power-supply/psu_manager.cpp
index 257fdfb..b55d019 100644
--- a/phosphor-power-supply/psu_manager.cpp
+++ b/phosphor-power-supply/psu_manager.cpp
@@ -482,6 +482,21 @@
 
                     psu->setFaultLogged();
                 }
+                else if (psu->hasTempFault())
+                {
+                    // Include STATUS_TEMPERATURE for temperature faults.
+                    additionalData["STATUS_TEMPERATURE"] =
+                        fmt::format("{:#02x}", psu->getStatusTemperature());
+
+                    additionalData["CALLOUT_INVENTORY_PATH"] =
+                        psu->getInventoryPath();
+
+                    createError(
+                        "xyz.openbmc_project.Power.PowerSupply.Error.Fault",
+                        additionalData);
+
+                    psu->setFaultLogged();
+                }
                 else if (psu->hasMFRFault())
                 {
                     /* This can represent a variety of faults that result in