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/test/openpower-pels/user_header_test.cpp b/test/openpower-pels/user_header_test.cpp
index a4bc3cb..59199fb 100644
--- a/test/openpower-pels/user_header_test.cpp
+++ b/test/openpower-pels/user_header_test.cpp
@@ -308,3 +308,24 @@
     EXPECT_EQ(uh.severity(), 0x20);
     EXPECT_EQ(uh.actionFlags(), 0xF000);
 }
+
+// Test that the PEL Subsystem omes from the event log if any
+TEST(UserHeaderTest, UseEventLogPELSubsystem)
+{
+    using namespace openpower::pels::message;
+    Entry regEntry;
+
+    regEntry.name = "test";
+    regEntry.subsystem = 5;
+    regEntry.actionFlags = 0xC000;
+    regEntry.eventType = 1;
+    regEntry.eventScope = 2;
+
+    MockDataInterface dataIface;
+    std::vector<std::string> adData{"PEL_SUBSYSTEM=0x25"};
+    AdditionalData ad{adData};
+
+    UserHeader uh(regEntry, phosphor::logging::Entry::Level::Critical, ad,
+                  dataIface);
+    ASSERT_EQ(uh.subsystem(), 0x25);
+}