psu-ng: Add in detection of PGOOD fault

If STATUS_WORD has bit 11 high (POWER_GOOD# is inactive) or bit 6 high
(unit is OFF), consider that a PGOOD fault. Lowest priority error to
check, log an error if a power supply has a PGOOD fault, call out the
power supply.

Tested:
    Simulated POWER_GOOD# / OFF and verified error logged.
    Verified normal operations on real hardware do not log error.
    Get power supply in bad state via i2cset commands:
     1. Write 0x19 to 0x02 (ON_OFF_CONFIG, OPERATION command only).
     2. Write 0x00 to 0x01 (Immediate off OPERATION command).
     3. Restart service, error logged for STATUS_WORD = 0x0800.
     4. Write 0x19 to 0x02, 0x00 to 0x01 while powered on.
     5. Error logged for STATUS_WORD=0x0840.

Change-Id: I24dd1db780510d39dc245e76977099f790a2e59e
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 b55d019..6d2815d 100644
--- a/phosphor-power-supply/psu_manager.cpp
+++ b/phosphor-power-supply/psu_manager.cpp
@@ -517,6 +517,18 @@
 
                     psu->setFaultLogged();
                 }
+                else if (psu->hasPgoodFault())
+                {
+                    /* POWER_GOOD# is not low, or OFF is on */
+                    additionalData["CALLOUT_INVENTORY_PATH"] =
+                        psu->getInventoryPath();
+
+                    createError(
+                        "xyz.openbmc_project.Power.PowerSupply.Error.Fault",
+                        additionalData);
+
+                    psu->setFaultLogged();
+                }
             }
         }
     }