Attn: Submit event logs before transitioning host

For terminating events we will generate and submit the events logs
before we request to transition the host.

Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: Ie600bbdbb34eb18154ea080fe1ac7d1861691e04
diff --git a/attn/ti_handler.cpp b/attn/ti_handler.cpp
index ff66289..8b8fa7d 100644
--- a/attn/ti_handler.cpp
+++ b/attn/ti_handler.cpp
@@ -66,17 +66,6 @@
 {
     trace<level::INFO>("PHYP TI");
 
-    if (autoRebootEnabled())
-    {
-        // If autoreboot is enabled we will start crash (mpipl) mode target
-        transitionHost(HostState::Crash);
-    }
-    else
-    {
-        // If autoreboot is disabled we will quiesce the host
-        transitionHost(HostState::Quiesce);
-    }
-
     // gather additional data for PEL
     std::map<std::string, std::string> tiAdditionalData;
 
@@ -102,6 +91,19 @@
         // a default TI info in the case where get TI info was not successful.
         eventAttentionFail((int)AttnSection::handlePhypTi | ATTN_INFO_NULL);
     }
+
+    // We are finished creating the event log entries so transition host to
+    // the required state.
+    if (autoRebootEnabled())
+    {
+        // If autoreboot is enabled we will start crash (mpipl) mode target
+        transitionHost(HostState::Crash);
+    }
+    else
+    {
+        // If autoreboot is disabled we will quiesce the host
+        transitionHost(HostState::Quiesce);
+    }
 }
 
 /**
@@ -213,24 +215,6 @@
         }
     }
 
-    if (true == terminateHost)
-    {
-        // if hostboot dump is requested initiate dump
-        if (hbDumpRequested)
-        {
-            // Until HB dump support available just quiesce the host - once
-            // dump support is available the dump component will transition
-            // (ipl/halt) the host.
-            transitionHost(HostState::Quiesce);
-        }
-        else
-        {
-            // Quiese the host - when the host is quiesced it will either
-            // "halt" or IPL depending on autoreboot setting.
-            transitionHost(HostState::Quiesce);
-        }
-    }
-
     // gather additional data for PEL
     std::map<std::string, std::string> tiAdditionalData;
 
@@ -259,6 +243,24 @@
         // a default TI info in the case where get TI info was not successful.
         eventAttentionFail((int)AttnSection::handleHbTi | ATTN_INFO_NULL);
     }
+
+    if (true == terminateHost)
+    {
+        // if hostboot dump is requested initiate dump
+        if (hbDumpRequested)
+        {
+            // Until HB dump support available just quiesce the host - once
+            // dump support is available the dump component will transition
+            // (ipl/halt) the host.
+            transitionHost(HostState::Quiesce);
+        }
+        else
+        {
+            // Quiese the host - when the host is quiesced it will either
+            // "halt" or IPL depending on autoreboot setting.
+            transitionHost(HostState::Quiesce);
+        }
+    }
 }
 
 /** @brief Parse the TI info data area into map as PHYP/OPAL data */