add analysis type to analyzer main function

The analyzer behavior will vary depending on the type of event that
triggered analysis. For example, we do not want to perform any service
actions when manual analysis is done from the command line.

Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: Iecfbac7f680b3fefebb0e02a9caa5fc06b692c7a
diff --git a/analyzer/analyzer_main.cpp b/analyzer/analyzer_main.cpp
index c17a0ee..b569852 100644
--- a/analyzer/analyzer_main.cpp
+++ b/analyzer/analyzer_main.cpp
@@ -1,6 +1,7 @@
 #include <assert.h>
 #include <unistd.h>
 
+#include <analyzer/analyzer_main.hpp>
 #include <analyzer/ras-data/ras-data-parser.hpp>
 #include <analyzer/service_data.hpp>
 #include <attn/attn_dump.hpp>
@@ -41,10 +42,10 @@
 
 //------------------------------------------------------------------------------
 
-const char* __attn(libhei::AttentionType_t i_attnType)
+const char* __attn(libhei::AttentionType_t i_type)
 {
     const char* str = "";
-    switch (i_attnType)
+    switch (i_type)
     {
         case libhei::ATTN_TYPE_CHECKSTOP:
             str = "CHECKSTOP";
@@ -62,7 +63,7 @@
             str = "HOST_ATTN";
             break;
         default:
-            trace::err("Unsupported attention type: %u", i_attnType);
+            trace::err("Unsupported attention type: %u", i_type);
             assert(0);
     }
     return str;
@@ -70,7 +71,30 @@
 
 //------------------------------------------------------------------------------
 
-uint32_t analyzeHardware(attn::DumpParameters& o_dumpParameters)
+const char* __analysisType(AnalysisType i_type)
+{
+    const char* str = "";
+    switch (i_type)
+    {
+        case AnalysisType::SYSTEM_CHECKSTOP:
+            str = "SYSTEM_CHECKSTOP";
+            break;
+        case AnalysisType::TERMINATE_IMMEDIATE:
+            str = "TERMINATE_IMMEDIATE";
+            break;
+        case AnalysisType::MANUAL:
+            str = "MANUAL";
+            break;
+        default:
+            trace::err("Unsupported analysis type: %u", i_type);
+            assert(0);
+    }
+    return str;
+}
+
+//------------------------------------------------------------------------------
+
+uint32_t analyzeHardware(AnalysisType i_type, attn::DumpParameters& o_dump)
 {
     uint32_t o_plid = 0; // default, zero indicates PEL was not created
 
@@ -80,7 +104,7 @@
         return o_plid;
     }
 
-    trace::inf(">>> enter analyzeHardware()");
+    trace::inf(">>> enter analyzeHardware(%s)", __analysisType(i_type));
 
     // Initialize the isolator and get all of the chips to be analyzed.
     trace::inf("Initializing the isolator...");
@@ -139,8 +163,8 @@
             // will be reserved for MP-IPLs during TI analysis.
             // TODO: Need ID from root cause. At the moment, HUID does not exist
             //       in devtree. Will need a better ID definition.
-            o_dumpParameters.unitId   = 0;
-            o_dumpParameters.dumpType = attn::DumpType::Hardware;
+            o_dump.unitId   = 0;
+            o_dump.dumpType = attn::DumpType::Hardware;
         }
     }
 
diff --git a/analyzer/analyzer_main.hpp b/analyzer/analyzer_main.hpp
index 51399b0..96de902 100644
--- a/analyzer/analyzer_main.hpp
+++ b/analyzer/analyzer_main.hpp
@@ -5,16 +5,45 @@
 namespace analyzer
 {
 
+enum class AnalysisType
+{
+    /**
+     * Queries for the root cause of a system checkstop attention. An
+     * unrecoverable PEL will be logged containing any necessary service actions
+     * and the associated FFDC from analysis.
+     */
+    SYSTEM_CHECKSTOP,
+
+    /**
+     * Queries for any active recoverable or unit checkstop attentions that may
+     * be attributed to a Terminate Immediate (TI) event. If any are found, an
+     * predictive PEL will be logged containing any necessary service actions
+     * and the associated FFDC from analysis.
+     */
+    TERMINATE_IMMEDIATE,
+
+    /**
+     * Queries for any active attentions. If any are found, an informational PEL
+     * will be logged containing the FFDC from analysis (no service actions
+     * applied).
+     */
+    MANUAL,
+};
+
 /**
- * @brief  Queries the host hardware for all attentions reported by each active
- *         chip. Then it performs all approriate RAS actions based on the active
- *         attentions.
+ * @brief  Queries all chips in the host hardware for any active attentions.
+ *         Then, it will perform any required RAS service actions based on the
+ *         given analysis type.
  *
- * @param[out] o_dumpParameters Dump request parameters
+ * @param  i_type The type of analysis to perform. See enum above.
+ *
+ * @param  o_dump The returned dump data. This data is only set if the input
+ *                value of i_type is SYSTEM_CHECKSTOP.
+ *
  * @return The platform log ID (PLID) of the PEL generated during analysis. Will
  *         return zero if no PEL is generated.
  */
-uint32_t analyzeHardware(attn::DumpParameters& o_dumpParameters);
+uint32_t analyzeHardware(AnalysisType i_type, attn::DumpParameters& o_dump);
 
 /**
  * @brief Get error analyzer build information