PHAL: improved boot failure reason code based logging

Added support to all newly added ipl failures.
 - IPL_ERR_HWP reports hwp procedure failures
 - IPL_ERR_SBE_CHIPOP reports during continue mpipl chip-op
 - IPL_ERR_SBE_BOOT reports sbe_start step.
 - All remaining failures log generic boot failure now

Tested: Manually verified.

Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
Change-Id: If103d53abd163ba4995a23b91700dbccfb81e2f9
diff --git a/extensions/phal/phal_error.cpp b/extensions/phal/phal_error.cpp
index 2ef0cc0..b15a56e 100644
--- a/extensions/phal/phal_error.cpp
+++ b/extensions/phal/phal_error.cpp
@@ -272,15 +272,29 @@
         return;
     }
 
-    if (errInfo.type == IPL_ERR_SBE_BOOT)
+    if ((errInfo.type == IPL_ERR_SBE_BOOT) ||
+        (errInfo.type == IPL_ERR_SBE_CHIPOP))
     {
+        // handle SBE related failures.
         processSbeBootError();
         return;
     }
 
-    // TODO: Keeping the existing behaviour now
-    // Handle errors based on special reason codes once support is available
-    processBootError(false);
+    if (errInfo.type == IPL_ERR_HWP)
+    {
+        // Handle hwp failure
+        processBootError(false);
+        return;
+    }
+
+    // Log PEL for any other failures
+    if (errInfo.type != IPL_ERR_OK)
+    {
+        createPEL("org.open_power.PHAL.Error.Boot");
+        // reset trace log and exit
+        reset();
+        return;
+    }
 }
 
 void processBootError(bool status)
@@ -548,11 +562,12 @@
         // Capture FFDC information on primary processor
         sbeError = captureFFDC(procTarget);
     }
-    catch (const std::exception& e)
+    catch (const phalError_t& phalError)
     {
         // Fail to collect FFDC information , trigger Dump
         log<level::ERR>(
-            fmt::format("captureFFDC: Exception{}", e.what()).c_str());
+            fmt::format("captureFFDC: Exception({})", phalError.what())
+                .c_str());
         dumpIsRequired = true;
     }