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.cpp b/phosphor-power-supply/power_supply.cpp
index 8183e37..dcf6177 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -213,6 +213,7 @@
                 statusCML = pmbusIntf->read(STATUS_CML, Type::Debug);
                 auto status0Vout = pmbusIntf->insertPageNum(STATUS_VOUT, 0);
                 statusVout = pmbusIntf->read(status0Vout, Type::Debug);
+                statusIout = pmbusIntf->read(STATUS_IOUT, Type::Debug);
                 statusTemperature =
                     pmbusIntf->read(STATUS_TEMPERATURE, Type::Debug);
                 if (statusWord & status_word::CML_FAULT)
@@ -259,6 +260,21 @@
                     voutOVFault = true;
                 }
 
+                if (statusWord & status_word::IOUT_OC_FAULT)
+                {
+                    if (!ioutOCFault)
+                    {
+                        log<level::ERR>(
+                            fmt::format("IOUT fault: STATUS_WORD = {:#04x}, "
+                                        "STATUS_MFR_SPECIFIC = {:#02x}, "
+                                        "STATUS_IOUT = {:#02x}",
+                                        statusWord, statusMFR, statusIout)
+                                .c_str());
+                    }
+
+                    ioutOCFault = true;
+                }
+
                 if (statusWord & status_word::TEMPERATURE_FAULT_WARN)
                 {
                     if (!tempFault)
@@ -329,6 +345,7 @@
                 mfrFault = false;
                 vinUVFault = false;
                 voutOVFault = false;
+                ioutOCFault = false;
                 tempFault = false;
                 pgoodFault = false;
             }
@@ -382,6 +399,7 @@
         vinUVFault = false;
         cmlFault = false;
         voutOVFault = false;
+        ioutOCFault = false;
         tempFault = false;
         pgoodFault = false;
         readFail = 0;