PEL: Add boot progress code to SRC hex data

Add the first 8 characters from the ASCII string field of the current
progress SRC, taken from the xyz.openbmc_project.State.Boot.Raw D-Bus
interface, to SRC hex word 4 when creating a PEL.

This is how the field is defined in the PEL spec, and is to help with
debug so that one can know which part of the boot was occurring when
the PEL was created.  Note that at this point most progress codes are
sent down from one of the host firmware subsystems and not created by
the BMC.

The field is only inserted into the SRC if those characters are present
and represent a valid 4 byte number, such as "C7004000".  This is then
represented as 0xC7004000 in the SRC word. Otherwise, the word is left
at a value of zero.

For example:
...
    "Valid Word Count":         "0x09",
    "Reference Code":           "BD8D1001",
    "Hex Word 2":               "00080455",
    "Hex Word 3":               "2E2D0010",
    "Hex Word 4":               "C7004000", <---Progress code
    "Hex Word 5":               "00000000",
    "Hex Word 6":               "00000005",
    "Hex Word 7":               "00000000",
    "Hex Word 8":               "00000000",
    "Hex Word 9":               "00000000"
...

Signed-off-by: Vijay Lobo <vijaylobo@gmail.com>
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Iba41e88626c0e081e5759b994e3630ef8b12daf4
diff --git a/extensions/openpower-pels/src.hpp b/extensions/openpower-pels/src.hpp
index 62b7699..3e6e519 100644
--- a/extensions/openpower-pels/src.hpp
+++ b/extensions/openpower-pels/src.hpp
@@ -298,6 +298,16 @@
      */
     std::vector<uint8_t> getSrcStruct();
 
+    /**
+     * @brief Extracts the first 8 characters of the ASCII String field
+     *        from the raw progress SRC and converts it to a uint32_t.
+     *
+     * @param[in] rawProgressSRC - The progress SRC bytes
+     *
+     * @return uint32_t - The code, like 0xCC0099EE from "CC0099EE"
+     */
+    static uint32_t getProgressCode(std::vector<uint8_t>& rawProgressSRC);
+
   private:
     /**
      * @brief Fills in the user defined hex words from the
@@ -367,6 +377,13 @@
     void setMotherboardCCIN(const DataInterfaceBase& dataIface);
 
     /**
+     * @brief Sets the progress code hex word field
+     *
+     * @param[in] dataIface - The DataInterface object
+     */
+    void setProgressCode(const DataInterfaceBase& dataIface);
+
+    /**
      * @brief Sets an error status bit in the SRC.
      *
      * @param[in] flag - The flag to set