Attn: Procedure specific error codes in error logs

When creating error logs for attention handler failures an error code is
presented in the error log. Make these specific to the attention handler
procedure that encountered the error.

Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: Ic65343c2cc231ad6340cb5182a1fa75da7c76bcb
diff --git a/attn/attn_handler.cpp b/attn/attn_handler.cpp
index c41e231..693e4c8 100644
--- a/attn/attn_handler.cpp
+++ b/attn/attn_handler.cpp
@@ -100,7 +100,8 @@
                 {
                     // log cfam read error
                     trace<level::INFO>("Error! cfam read 0x1007 FAILED");
-                    eventAttentionFail(RC_CFAM_ERROR);
+                    eventAttentionFail((int)AttnSection::attnHandler |
+                                       ATTN_PDBG_CFAM);
                 }
                 else if (0xffffffff == isr_val)
                 {
@@ -123,7 +124,8 @@
                     {
                         // log cfam read error
                         trace<level::INFO>("Error! cfam read 0x100d FAILED");
-                        eventAttentionFail(RC_CFAM_ERROR);
+                        eventAttentionFail((int)AttnSection::attnHandler |
+                                           ATTN_PDBG_CFAM);
                     }
                     else if (0xffffffff == isr_mask)
                     {
@@ -292,9 +294,8 @@
             // trace some more data since TI info appears valid
             ss.str(std::string()); // empty the stream
             ss.clear();            // clear the stream
-            ss << "TI data hb_terminate_type = 0x" << std::setw(2)
-               << std::setfill('0') << std::hex
-               << (int)tiDataArea->hbTerminateType;
+            ss << "TI data term-type = 0x" << std::setw(2) << std::setfill('0')
+               << std::hex << (int)tiDataArea->hbTerminateType;
             strobj = ss.str();
             trace<level::INFO>(strobj.c_str());
 
@@ -337,8 +338,6 @@
         // if configured to handle TI as default special attention
         else
         {
-            trace<level::INFO>("assuming TI");
-
             if (true == (i_attention->getConfig()->getFlag(enTerminate)))
             {
                 // Call TI special attention handler
diff --git a/attn/attn_handler.hpp b/attn/attn_handler.hpp
index ad3181d..c969523 100644
--- a/attn/attn_handler.hpp
+++ b/attn/attn_handler.hpp
@@ -14,11 +14,22 @@
     RC_CFAM_ERROR
 };
 
-/** @brief Attention handler return codes */
+/** @brief Code seciton for error reporing */
+enum class AttnSection
+{
+    reserved     = 0x0000,
+    attnHandler  = 0x0100,
+    tiHandler    = 0x0200,
+    handlePhypTi = 0x0300,
+    handleHbTi   = 0x0400
+};
+
+/** @brief Attention handler error reason codes */
 enum AttnCodes
 {
     ATTN_NO_ERROR  = 0,
-    ATTN_INFO_NULL = 1
+    ATTN_INFO_NULL = 1,
+    ATTN_PDBG_CFAM = 2
 };
 
 /** @brief Attention global status bits */
@@ -44,14 +55,14 @@
  * @brief The main attention handler logic
  *
  * Check each processor for active attentions of type SBE Vital (vital),
- * System Checkstop (checkstop) and Special Attention (special) and
- * handle each as follows:
+ * System Checkstop (checkstop) and Special Attention (special) and handle
+ * each as follows:
  *
  * checkstop: Call hardware error analyzer
  * vital:     TBD
  * special:   Determine if the special attention is a Breakpoint (BP),
- *            Terminate Immediately (TI) or CoreCodeToSp (corecode). For
- * each special attention type, do the following:
+ *            Terminate Immediately (TI) or CoreCodeToSp (corecode). For each
+ *            special attention type, do the following:
  *
  *            BP:          Notify Cronus
  *            TI:          Start host diagnostics mode systemd unit
diff --git a/attn/ti_handler.cpp b/attn/ti_handler.cpp
index fc58d49..c1e2d2e 100644
--- a/attn/ti_handler.cpp
+++ b/attn/ti_handler.cpp
@@ -45,7 +45,7 @@
     {
         // TI data was not available This should not happen since we provide
         // a default TI info in the case where get TI info was not successful.
-        eventAttentionFail(ATTN_INFO_NULL);
+        eventAttentionFail((int)AttnSection::tiHandler | ATTN_INFO_NULL);
         rc = RC_NOT_HANDLED;
     }
 
@@ -100,7 +100,7 @@
     {
         // TI data was not available This should not happen since we provide
         // a default TI info in the case where get TI info was not successful.
-        eventAttentionFail(ATTN_INFO_NULL);
+        eventAttentionFail((int)AttnSection::handlePhypTi | ATTN_INFO_NULL);
     }
 }
 
@@ -257,7 +257,7 @@
     {
         // TI data was not available This should not happen since we provide
         // a default TI info in the case where get TI info was not successful.
-        eventAttentionFail(ATTN_INFO_NULL);
+        eventAttentionFail((int)AttnSection::handleHbTi | ATTN_INFO_NULL);
     }
 }