Add system IM keyword to PEL userdata0 section

Read the system IM keyword via dbus and add it to the PEL userdata0 section.

Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: I6a45e0450928e49c8789cc2f93baad03cccf90c7
diff --git a/extensions/openpower-pels/pel.cpp b/extensions/openpower-pels/pel.cpp
index a53f8f6..1add587 100644
--- a/extensions/openpower-pels/pel.cpp
+++ b/extensions/openpower-pels/pel.cpp
@@ -28,6 +28,7 @@
 #include "stream.hpp"
 #include "user_data_formats.hpp"
 
+#include <fmt/format.h>
 #include <sys/stat.h>
 #include <unistd.h>
 
@@ -624,6 +625,19 @@
     return data;
 }
 
+void addIMKeyword(nlohmann::json& json, const DataInterfaceBase& dataIface)
+{
+    auto keyword = dataIface.getSystemIMKeyword();
+
+    std::string value{};
+
+    std::for_each(keyword.begin(), keyword.end(), [&](const auto& byte) {
+        value += fmt::format("{:02X}", byte);
+    });
+
+    json["System IM"] = value;
+}
+
 void addStatesToJSON(nlohmann::json& json, const DataInterfaceBase& dataIface)
 {
     json["BMCState"] = lastSegment('.', dataIface.getBMCState());
@@ -639,6 +653,7 @@
 
     addProcessNameToJSON(json, ad.getValue("_PID"), dataIface);
     addBMCFWVersionIDToJSON(json, dataIface);
+    addIMKeyword(json, dataIface);
     addStatesToJSON(json, dataIface);
 
     return makeJSONUserDataSection(json);