Add support for collecting Self Boot Engine(SBE) dump

SBE is a microcontroller that sits inside the processor
to initialize it to start the booting procedure. It also acts as
a secure channel for accessing certain control functions on
the processor. During the booting or other hardware access operations
SBE can encounter errors and become unresponsive. In such situations,
the debug data needs to be collected from such SBEs to find out
the root cause of the error.
This data may include hardware state, configuration, memory, etc.
The collected data is then packaged into the OpenPOWER dump format
and which is to be called as SBE dump.

The SBE dump is collected from an responsive SBE using special
procedures which is executing hardware access instructions
to get the memory and other hardware states. This commit adds
support for calling such procedure implementations.

Test:
   Execute SBE dump collection during dump-collect

Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Change-Id: I020406b2d53d9d1f0a677a7defc4e55009c5e266
diff --git a/dump/dump_collect_main.cpp b/dump/dump_collect_main.cpp
index c77b089..158b6cf 100644
--- a/dump/dump_collect_main.cpp
+++ b/dump/dump_collect_main.cpp
@@ -1,6 +1,8 @@
 #include "sbe_consts.hpp"
 #include "sbe_dump_collector.hpp"
 
+#include <libphal.H>
+
 #include <CLI/App.hpp>
 #include <CLI/Config.hpp>
 #include <CLI/Formatter.hpp>
@@ -13,6 +15,7 @@
     using namespace openpower::dump::sbe_chipop;
     using std::filesystem::path;
     using namespace openpower::dump::SBE;
+    using namespace openpower::phal::dump;
 
     CLI::App app{"Dump Collector Application", "dump-collect"};
     app.description(
@@ -27,8 +30,8 @@
 
     app.add_option("--type, -t", type, "Type of the dump")
         ->required()
-        ->check(
-            CLI::IsMember({SBE_DUMP_TYPE_HARDWARE, SBE_DUMP_TYPE_HOSTBOOT}));
+        ->check(CLI::IsMember({SBE_DUMP_TYPE_HARDWARE, SBE_DUMP_TYPE_HOSTBOOT,
+                               SBE_DUMP_TYPE_SBE}));
 
     app.add_option("--id, -i", id, "ID of the dump")->required();
 
@@ -47,9 +50,11 @@
         return app.exit(e);
     }
 
-    if (type == SBE_DUMP_TYPE_HARDWARE && !failingUnit.has_value())
+    if (((type == SBE_DUMP_TYPE_HARDWARE) || (type == SBE_DUMP_TYPE_SBE)) &&
+        !failingUnit.has_value())
     {
-        std::cerr << "Failing unit ID is required for Hardware type dumps\n";
+        std::cerr
+            << "Failing unit ID is required for Hardware and SBE type dumps\n";
         return EXIT_FAILURE;
     }
 
@@ -70,7 +75,14 @@
 
     try
     {
-        dumpCollector.collectDump(type, id, failingUnitId, pathStr);
+        if (type == SBE_DUMP_TYPE_SBE)
+        {
+            collectSBEDump(id, failingUnitId, pathStr, type);
+        }
+        else
+        {
+            dumpCollector.collectDump(type, id, failingUnitId, pathStr);
+        }
     }
     catch (const std::exception& e)
     {