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/power_supply.hpp b/phosphor-power-supply/power_supply.hpp
index c1f7e59..ca73959 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -190,7 +190,7 @@
     bool isFaulted() const
     {
         return (hasCommFault() || vinUVFault || inputFault || voutOVFault ||
-                tempFault || mfrFault);
+                tempFault || pgoodFault || mfrFault);
     }
 
     /**
@@ -250,6 +250,15 @@
     }
 
     /**
+     * @brief Returns true if there is a PGood fault (PGOOD# inactive, or OFF
+     * bit on).
+     */
+    bool hasPgoodFault() const
+    {
+        return pgoodFault;
+    }
+
+    /**
      * @brief Returns the device path
      *
      * This can be used for error call outs.
@@ -349,6 +358,11 @@
     /** @brief True if bit 2 of STATUS_WORD low byte is on. */
     bool tempFault = false;
 
+    /** @brief True if bit 11 or 6 of STATUS_WORD is on. PGOOD# is inactive, or
+     * the unit is off.
+     */
+    bool pgoodFault = false;
+
     /** @brief Count of the number of read failures. */
     size_t readFail = 0;