Avoid analyzing hardware on legacy processors

Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I4c041b9f2b5448b46efc792c2d793ebf15ba7adc
diff --git a/analyzer/analyzer_main.cpp b/analyzer/analyzer_main.cpp
index b68a375..a41425e 100644
--- a/analyzer/analyzer_main.cpp
+++ b/analyzer/analyzer_main.cpp
@@ -157,27 +157,34 @@
 
     trace::inf(">>> enter analyzeHardware()");
 
-    // Initialize the isolator and get all of the chips to be analyzed.
-    trace::inf("Initializing the isolator...");
-    std::vector<libhei::Chip> chips;
-    initializeIsolator(chips);
+    if (util::pdbg::queryHardwareAnalysisSupported())
+    {
+        // Initialize the isolator and get all of the chips to be analyzed.
+        trace::inf("Initializing the isolator...");
+        std::vector<libhei::Chip> chips;
+        initializeIsolator(chips);
 
-    // Isolate attentions.
-    trace::inf("Isolating errors: # of chips=%u", chips.size());
-    libhei::IsolationData isoData{};
-    libhei::isolate(chips, isoData);
+        // Isolate attentions.
+        trace::inf("Isolating errors: # of chips=%u", chips.size());
+        libhei::IsolationData isoData{};
+        libhei::isolate(chips, isoData);
 
-    // Filter signatures to determine root cause. We'll need to make a copy of
-    // the list so that the original list is maintained for the log.
-    std::vector<libhei::Signature> sigList{isoData.getSignatureList()};
-    __filterRootCause(sigList);
+        // Filter signatures to determine root cause. We'll need to make a copy
+        // of the list so that the original list is maintained for the log.
+        std::vector<libhei::Signature> sigList{isoData.getSignatureList()};
+        __filterRootCause(sigList);
 
-    // Create and commit a log.
-    attnFound = __logError(sigList, isoData);
+        // Create and commit a log.
+        attnFound = __logError(sigList, isoData);
 
-    // All done, clean up the isolator.
-    trace::inf("Uninitializing isolator...");
-    libhei::uninitialize();
+        // All done, clean up the isolator.
+        trace::inf("Uninitializing isolator...");
+        libhei::uninitialize();
+    }
+    else
+    {
+        trace::err("Hardware error analysis is not supported on this system");
+    }
 
     trace::inf("<<< exit analyzeHardware()");
 
diff --git a/attn/attn_handler.cpp b/attn/attn_handler.cpp
index db82ef5..6d64922 100644
--- a/attn/attn_handler.cpp
+++ b/attn/attn_handler.cpp
@@ -202,7 +202,7 @@
     else
     {
         // Look for any attentions found in hardware. This will generate and
-        // comment a PEL if any errors are found.
+        // commit a PEL if any errors are found.
         if (true != analyzer::analyzeHardware())
         {
             rc = RC_ANALYZER_ERROR;
diff --git a/util/pdbg.cpp b/util/pdbg.cpp
index e33098f..269c57b 100644
--- a/util/pdbg.cpp
+++ b/util/pdbg.cpp
@@ -1,5 +1,6 @@
 #include <assert.h>
 
+#include <hei_main.hpp>
 #include <util/pdbg.hpp>
 #include <util/trace.hpp>
 
@@ -170,6 +171,14 @@
 
 //------------------------------------------------------------------------------
 
+bool queryHardwareAnalysisSupported()
+{
+    // Hardware analysis is only supported on P10 systems and up.
+    return (PDBG_PROC_P10 <= pdbg_get_proc());
+}
+
+//------------------------------------------------------------------------------
+
 } // namespace pdbg
 
 } // namespace util
diff --git a/util/pdbg.hpp b/util/pdbg.hpp
index 2c95c28..3b293e0 100644
--- a/util/pdbg.hpp
+++ b/util/pdbg.hpp
@@ -2,7 +2,14 @@
 
 #include <libpdbg.h>
 
-#include <hei_main.hpp>
+#include <vector>
+
+// Forward reference to avoid pulling the libhei library into everything that
+// includes this header.
+namespace libhei
+{
+class Chip;
+}
 
 namespace util
 {
@@ -51,6 +58,14 @@
  */
 void getActiveChips(std::vector<libhei::Chip>& o_chips);
 
+/**
+ * @return True, if hardware analysis is supported on this system. False,
+ *         otherwise.
+ * @note   Support for hardware analysis from the BMC started with P10 systems
+ *         and is not supported on any older chip generations.
+ */
+bool queryHardwareAnalysisSupported();
+
 } // namespace pdbg
 
 } // namespace util