PEL: Support creator supplied power fault flag

User can supply POWER_THERMAL_CRITICAL_FAULT=TRUE as part
of AdditionalData entry in the event log to set the power
fault bit in PEL

Tested: I ran unit test using docker. Also tested manually
by setting D-bus event log

Change-Id: Ifa03f091a7d1efcc67f181c2be1cc0a6240891e1
Signed-off-by: Vijay Lobo <vijaylobo@gmail.com>
diff --git a/extensions/openpower-pels/README.md b/extensions/openpower-pels/README.md
index 3fdb43a..1aba263 100644
--- a/extensions/openpower-pels/README.md
+++ b/extensions/openpower-pels/README.md
@@ -34,6 +34,17 @@
 The code will assign its own error log ID to this PEL, and also update the
 commit timestamp field to the current time.
 
+#### POWER_THERMAL_CRITICAL_FAULT
+
+This keyword is used to set the power fault bit in PEL. The syntax is:
+```
+POWER_THERMAL_CRITICAL_FAULT=<FLAG>
+e.g.
+POWER_THERMAL_CRITICAL_FAULT=TRUE
+```
+
+Note that TRUE is the only value supported.
+
 #### ESEL
 
 This keyword's data contains a full PEL in string format.  This is how hostboot
diff --git a/extensions/openpower-pels/src.cpp b/extensions/openpower-pels/src.cpp
index 9257036..398cfaa 100644
--- a/extensions/openpower-pels/src.cpp
+++ b/extensions/openpower-pels/src.cpp
@@ -291,7 +291,10 @@
     _version = srcVersion;
 
     _flags = 0;
-    if (regEntry.src.powerFault.value_or(false))
+
+    auto item = additionalData.getValue("POWER_THERMAL_CRITICAL_FAULT");
+    if ((regEntry.src.powerFault.value_or(false)) ||
+        (item.value_or("") == "TRUE"))
     {
         _flags |= powerFaultEvent;
     }