attn: Add support for hbNotVisibleFlag in TI info

Hostboot defined a new flag in the TI info data. This flag is used to
indicate to the attention handler that a PEL created by attention
handler for a TI with SRC event should have the hidden-flag set in the
action flags.

Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: I8090085274635109510e1af0513b39afa994781b
diff --git a/attn/attn_logging.cpp b/attn/attn_logging.cpp
index 52e39bc..a88a85e 100644
--- a/attn/attn_logging.cpp
+++ b/attn/attn_logging.cpp
@@ -220,9 +220,18 @@
     // set severity, event type and action flags
     tiPel->setSeverity(static_cast<uint8_t>(pel::Severity::termination));
     tiPel->setType(static_cast<uint8_t>(pel::EventType::na));
-    tiPel->setAction(static_cast<uint16_t>(pel::ActionFlags::service |
-                                           pel::ActionFlags::report |
-                                           pel::ActionFlags::call));
+
+    auto actionFlags = pel::ActionFlags::service | pel::ActionFlags::report |
+                       pel::ActionFlags::call;
+
+    it = i_additional.find("hidden");
+    if (it != i_additional.end() && "true" == it->second)
+    {
+        trace::inf("making HB TI PEL hidden");
+        actionFlags = actionFlags | pel::ActionFlags::hidden;
+    }
+
+    tiPel->setAction(static_cast<uint16_t>(actionFlags));
 
     // The raw PEL that we used as the basis for this custom PEL contains the
     // attention handler trace data and does not needed to be in this PEL so
diff --git a/attn/pel/pel_common.hpp b/attn/pel/pel_common.hpp
index 3dbce5c..1d99015 100644
--- a/attn/pel/pel_common.hpp
+++ b/attn/pel/pel_common.hpp
@@ -49,6 +49,7 @@
 enum class ActionFlags
 {
     service = 0x8000,
+    hidden  = 0x4000,
     report  = 0x2000,
     call    = 0x0800
 };
diff --git a/attn/ti_handler.cpp b/attn/ti_handler.cpp
index 0ae0db8..b2c4085 100644
--- a/attn/ti_handler.cpp
+++ b/attn/ti_handler.cpp
@@ -136,7 +136,7 @@
     if (nullptr != i_tiDataArea)
     {
         // see if HB dump is requested
-        if (0 != i_tiDataArea->hbDumpFlag)
+        if (i_tiDataArea->hbFlags & hbDumpFlag)
         {
             // retrieve log ID from TI info data
             uint32_t logId = be32toh(i_tiDataArea->asciiData1);
@@ -193,6 +193,12 @@
             trace::inf("Ignoring TI info dump flag for HB TI with SRC");
             tiAdditionalData["Dump"] = "true";
 
+            // TI with SRC will honor hbNotVisibleFlag
+            if (i_tiDataArea->hbFlags & hbNotVisibleFlag)
+            {
+                tiAdditionalData["hidden"] = "true";
+            }
+
             // Generate event log
             eventTerminate(tiAdditionalData, (char*)i_tiDataArea);
         }
@@ -325,9 +331,8 @@
     i_map["0x04 Reserved"] = fmt::format("{:02x}", i_tiDataArea->reserved1);
     i_map["0x05 HB_Term. Type"] =
         fmt::format("{:02x}", i_tiDataArea->hbTerminateType);
-    i_map["0x0c HB Dump Flag"] =
-        fmt::format("{:02x}", i_tiDataArea->hbDumpFlag);
-    i_map["0x0d Source"] = fmt::format("{:02x}", i_tiDataArea->source);
+    i_map["0x0c HB Flags"] = fmt::format("{:02x}", i_tiDataArea->hbFlags);
+    i_map["0x0d Source"]   = fmt::format("{:02x}", i_tiDataArea->source);
     i_map["0x10 HB Word 0"] =
         fmt::format("{:08x}", be32toh(i_tiDataArea->srcWord12HbWord0));
     i_map["0x14 HB Word 2"] =
diff --git a/attn/ti_handler.hpp b/attn/ti_handler.hpp
index 9f70070..4841795 100644
--- a/attn/ti_handler.hpp
+++ b/attn/ti_handler.hpp
@@ -28,7 +28,7 @@
     uint8_t srcFlags;          // 0x09, phyp/opal
     uint8_t numAsciiWords;     // 0x0a, phyp/opal
     uint8_t numHexWords;       // 0x0b, phyp/opal
-    uint8_t hbDumpFlag;        // 0x0c, hostboot only
+    uint8_t hbFlags;           // 0x0c, hostboot only
     uint8_t source;            // 0x0d, hostboot only
     uint16_t lenSrc;           // 0x0e, phyp/opal
     uint32_t srcWord12HbWord0; // 0x10, common
@@ -54,6 +54,10 @@
 };
 #pragma pack(pop)
 
+// TI info defines
+constexpr uint8_t hbDumpFlag       = 0x01;
+constexpr uint8_t hbNotVisibleFlag = 0x02;
+
 // miscellaneous defines
 constexpr uint8_t TI_WITH_PLID = 0x01;
 constexpr uint8_t TI_WITH_SRC  = 0x02;
diff --git a/test/test-ti-handler.cpp b/test/test-ti-handler.cpp
index 5941985..ecef146 100644
--- a/test/test-ti-handler.cpp
+++ b/test/test-ti-handler.cpp
@@ -110,8 +110,8 @@
     EXPECT_EQ(tiMap["0x04 Reserved"], "30");
     // hbTerminateType, offset: 0x05, size: 1, 0x31
     EXPECT_EQ(tiMap["0x05 HB_Term. Type"], "31");
-    // hbDumpFlag, offset: 0x0c, size: 1, 0x38
-    EXPECT_EQ(tiMap["0x0c HB Dump Flag"], "38");
+    // hbFlags, offset: 0x0c, size: 1, 0x38
+    EXPECT_EQ(tiMap["0x0c HB Flags"], "38");
     // source, offset: 0x0d, size: 1, 0x39
     EXPECT_EQ(tiMap["0x0d Source"], "39");
     // srcWord12HbWord0, offset: 0x10, size: 4, 0x3c 0x3d 0x3e 0x3f