PEL: Write terminating SRC to the progress SRC

Check for incoming pels for severity type 0x51 - Critical error,
System termination. If found, fetch the SRC and add this SRC to
progress SRC interface on dbus. In addition set the terminate bit
in BMC created pels only.

Signed-off-by: Sumit Kumar <sumit_kumar@in.ibm.com>
Change-Id: I26194a26743263183dcb61e097c745c4705fa006
diff --git a/extensions/openpower-pels/pel.cpp b/extensions/openpower-pels/pel.cpp
index ed4c3f3..a6f0af3 100644
--- a/extensions/openpower-pels/pel.cpp
+++ b/extensions/openpower-pels/pel.cpp
@@ -123,6 +123,10 @@
     auto ud = util::makeSysInfoUserDataSection(additionalData, dataIface);
     addUserDataSection(std::move(ud));
 
+    //  Check for pel severity of type - 0x51 = critical error, system
+    //  termination and update terminate bit in SRC for pels
+    updateTerminateBitInSRCSection();
+
     // Create a UserData section from AdditionalData.
     if (!additionalData.empty())
     {
@@ -571,6 +575,21 @@
     }
 }
 
+void PEL::updateTerminateBitInSRCSection()
+{
+    //  Check for pel severity of type - 0x51 = critical error, system
+    //  termination
+    if (_uh->severity() == 0x51)
+    {
+        // Get the primary SRC section
+        auto pSRC = primarySRC();
+        if (pSRC)
+        {
+            (*pSRC)->setTerminateBit();
+        }
+    }
+}
+
 namespace util
 {