PEL: Pass in subsystem to use with additional data

There is a requirement to pass in the subsystem to use with
the additional data field. In the process update the user
header code and SRC with the passed-in subsystem value
instead from the message registry.

Signed-off-by: Sumit Kumar <sumit_kumar@in.ibm.com>
Change-Id: I08c8c3bab100fec581df9043f4bb27b28cb556e1
diff --git a/extensions/openpower-pels/src.cpp b/extensions/openpower-pels/src.cpp
index 5984287..f4807f5 100644
--- a/extensions/openpower-pels/src.cpp
+++ b/extensions/openpower-pels/src.cpp
@@ -363,6 +363,26 @@
 
     _asciiString = std::make_unique<src::AsciiString>(regEntry);
 
+    // Check for additional data - PEL_SUBSYSTEM
+    auto ss = additionalData.getValue("PEL_SUBSYSTEM");
+    if (ss)
+    {
+        auto eventSubsystem = std::stoul(*ss, NULL, 16);
+        std::string subsystem =
+            pv::getValue(eventSubsystem, pel_values::subsystemValues);
+        if (subsystem == "invalid")
+        {
+            log<level::WARNING>(
+                fmt::format("SRC: Invalid SubSystem value:{:#X}",
+                            eventSubsystem)
+                    .c_str());
+        }
+        else
+        {
+            _asciiString->setByte(2, eventSubsystem);
+        }
+    }
+
     addCallouts(regEntry, additionalData, jsonCallouts, dataIface);
 
     _size = baseSRCSize;