change analyzerHardware() to return PEL PLID is created

Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: Icee2909e5060c79cb95ead8fc08a5e359df42829
diff --git a/attn/attn_dump.cpp b/attn/attn_dump.cpp
index 3f325bd..52bfca0 100644
--- a/attn/attn_dump.cpp
+++ b/attn/attn_dump.cpp
@@ -78,7 +78,7 @@
 }
 
 /** Request a dump from the dump manager */
-void requestDump(const DumpParameters& i_dumpParameters)
+void requestDump(uint32_t i_logId, const DumpParameters& i_dumpParameters)
 {
     constexpr auto path      = "/org/openpower/dump";
     constexpr auto interface = "xyz.openbmc_project.Dump.Create";
@@ -94,7 +94,7 @@
             std::map<std::string, std::variant<std::string, uint64_t>>
                 createParams;
             createParams["com.ibm.Dump.Create.CreateParameters.ErrorLogId"] =
-                uint64_t(i_dumpParameters.logId);
+                uint64_t(i_logId);
             if (DumpType::Hostboot == i_dumpParameters.dumpType)
             {
                 createParams["com.ibm.Dump.Create.CreateParameters.DumpType"] =
diff --git a/attn/attn_dump.hpp b/attn/attn_dump.hpp
index d7cdfac..289aea5 100644
--- a/attn/attn_dump.hpp
+++ b/attn/attn_dump.hpp
@@ -16,7 +16,6 @@
 class DumpParameters
 {
   public:
-    uint32_t logId;
     uint32_t unitId;
     DumpType dumpType;
 };
@@ -27,8 +26,9 @@
  * Request a dump from the dump manager and register a monitor for observing
  * the dump progress.
  *
+ * @param i_logId        The platform log ID associated with the dump request.
  * @param dumpParameters Parameters for the dump request
  */
-void requestDump(const DumpParameters& dumpParameters);
+void requestDump(uint32_t i_logId, const DumpParameters& dumpParameters);
 
 } // namespace attn
diff --git a/attn/attn_handler.cpp b/attn/attn_handler.cpp
index 4022d06..65bf7f9 100644
--- a/attn/attn_handler.cpp
+++ b/attn/attn_handler.cpp
@@ -249,13 +249,15 @@
         // Look for any attentions found in hardware. This will generate and
         // commit a PEL if any errors are found.
         DumpParameters dumpParameters;
-        if (true != analyzer::analyzeHardware(dumpParameters))
+        auto logid = analyzer::analyzeHardware(dumpParameters);
+        if (0 == logid)
         {
+            // A PEL should exist for a checkstop attention.
             rc = RC_ANALYZER_ERROR;
         }
         else
         {
-            requestDump(dumpParameters);
+            requestDump(logid, dumpParameters);
             util::dbus::transitionHost(util::dbus::HostState::Quiesce);
         }
     }
diff --git a/attn/attn_logging.cpp b/attn/attn_logging.cpp
index 3fb0572..279d212 100644
--- a/attn/attn_logging.cpp
+++ b/attn/attn_logging.cpp
@@ -219,9 +219,11 @@
     if (it != i_additional.end() && "true" == it->second)
     {
         DumpParameters dumpParameters;
-        if (analyzer::analyzeHardware(dumpParameters))
+        auto plid = analyzer::analyzeHardware(dumpParameters);
+        if (0 != plid)
         {
-            tiPel->setPlid(dumpParameters.logId);
+            // Link the PLID if an attention was found and a PEL was generated.
+            tiPel->setPlid(plid);
         }
     }
 
@@ -436,7 +438,7 @@
                 if ("true" == i_additional["Dump"])
                 {
                     // will not return until dump is complete
-                    requestDump(DumpParameters{pelId, 0, DumpType::Hostboot});
+                    requestDump(pelId, DumpParameters{0, DumpType::Hostboot});
                 }
             }
         }
diff --git a/attn/ti_handler.cpp b/attn/ti_handler.cpp
index 6d28458..3a82bb4 100644
--- a/attn/ti_handler.cpp
+++ b/attn/ti_handler.cpp
@@ -137,7 +137,7 @@
         {
             // retrieve log ID from TI info data
             uint32_t logId = be32toh(i_tiDataArea->asciiData1);
-            requestDump(DumpParameters{logId, 0, DumpType::Hostboot});
+            requestDump(logId, DumpParameters{0, DumpType::Hostboot});
         }
     }
 
diff --git a/attn/vital_handler.cpp b/attn/vital_handler.cpp
index c07dfc7..4d4b0ce 100644
--- a/attn/vital_handler.cpp
+++ b/attn/vital_handler.cpp
@@ -36,7 +36,7 @@
         if ((0 != pelId) && (util::dbus::HostRunningState::NotStarted ==
                              util::dbus::hostRunningState()))
         {
-            requestDump(DumpParameters{pelId, 0, DumpType::SBE});
+            requestDump(pelId, DumpParameters{0, DumpType::SBE});
         }
 
         // transition host