PEL: Store transmission states in UserHeader

Use a reserved word in the UserHeader section to store some
PEL states:

* Host Transmission State:
  - States involving the progression of a PEL being sent to the
    operating system.

* HMC Transmission State:
  - States involving the progression of a PEL being sent to the
    hardware management console, if there is one attached.

  - Usually, an HMC refers to a specific set of hardware and software
    sold by IBM that connects to OpenPower systems which has specific
    software to deal with receiving PELs.

It is possible that there is an implementation that won't need to send
PELs to either of these entities, in which case these states will
just be unused and left at zero.

This is the same location that other service processor implementations
have stored transmission states.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I6a2bfee15336dbd564aeaded88effa55ede0d6c4
diff --git a/extensions/openpower-pels/user_header.hpp b/extensions/openpower-pels/user_header.hpp
index 14407dc..f1fc66d 100644
--- a/extensions/openpower-pels/user_header.hpp
+++ b/extensions/openpower-pels/user_header.hpp
@@ -153,6 +153,51 @@
     }
 
     /**
+     * @brief Returns the host transmission state
+     *
+     * @return uint8_t - the host transmission state
+     */
+    uint8_t hostTransmissionState() const
+    {
+        return _states & 0xFF;
+    }
+
+    /**
+     * @brief Sets the host transmission state
+     *
+     * @param[in] state - the new state
+     */
+    void setHostTransmissionState(uint8_t state)
+    {
+        _states &= 0xFFFFFF00;
+        _states |= state;
+    }
+
+    /**
+     * @brief Returns the HMC transmission state
+     *
+     * (HMC = Hardware Management Console)
+     *
+     * @return uint8_t - the HMC transmission state
+     */
+    uint8_t hmcTransmissionState() const
+    {
+        return (_states & 0x0000FF00) >> 8;
+    }
+
+    /**
+     * @brief Sets the HMC transmission state
+     *
+     * @param[in] state - the new state
+     */
+    void setHMCTransmissionState(uint8_t state)
+    {
+        uint32_t newState = state << 8;
+        _states &= 0xFFFF00FF;
+        _states |= newState;
+    }
+
+    /**
      * @brief Returns the size of this section when flattened into a PEL
      *
      * @return size_t - the size of the section
@@ -163,7 +208,7 @@
                sizeof(_eventScope) + sizeof(_eventSeverity) +
                sizeof(_eventType) + sizeof(_reserved4Byte1) +
                sizeof(_problemDomain) + sizeof(_problemVector) +
-               sizeof(_actionFlags) + sizeof(_reserved4Byte2);
+               sizeof(_actionFlags) + sizeof(_states);
     }
 
     /**
@@ -228,9 +273,15 @@
     uint16_t _actionFlags;
 
     /**
-     * @brief The second reserved word placeholder.
+     * @brief The second reserved word that we are
+     *        using for storing state information.
+     *
+     * 0x0000AABB
+     *   Where:
+     *      0xAA = HMC transmission state
+     *      0xBB = Host transmission state
      */
-    uint32_t _reserved4Byte2;
+    uint32_t _states;
 };
 
 } // namespace pels