PEL: Print component names in peltool

Every PEL section has a 2 byte component ID field in its header that
peltool prints.  Currently, it just prints the hex version, like
"0x1000".

There are JSON files in the flash already that contain mappings of
component IDs to to component names, and this commit starts looking
up the component names from those files and using those in the peltool
output.

An example of a file is:
/usr/share/phosphor-logging/pels/O_component_ids.json:
{
    "1000": "bmc common function",
    "2000": "bmc error logging",
    ...
}

Where the 'O' in the filename is the creator ID field of the PEL.  There
is also a file for hostboot, which is B_component_ids.json.

Also, for PELs with a PHYP creator ID, just convert the ID to two
characters, like 0x4552 - > "ER" as that is what they are.

peltool output examples:
    "Created by": "bmc error logging",
    "Created by": "hostboot: errl",
    "Created by": "IO",

This matches what is already done by the python peltool.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Id616739e1b7ca67c85dc7efa85dc34acf6aca9b5
diff --git a/extensions/openpower-pels/json_utils.hpp b/extensions/openpower-pels/json_utils.hpp
index 02b8a83..4ee32f4 100644
--- a/extensions/openpower-pels/json_utils.hpp
+++ b/extensions/openpower-pels/json_utils.hpp
@@ -93,5 +93,19 @@
  */
 std::string trimEnd(std::string s);
 
+/**
+ * @brief Returns the component name for the component ID.
+ *
+ * It will try to look up the name to use in JSON files based on
+ * the creator ID.  If PHYP, will convert the component ID to
+ * two characters.
+ *
+ * If nothing else, it will just return the name as a string like
+ * "0x1234".
+ *
+ * @return std::string - The component name
+ */
+std::string getComponentName(uint16_t compID, uint8_t creatorID);
+
 } // namespace pels
 } // namespace openpower