Implement support for POZ FFDC with multiple FFDC packets

This commit implements support for POZ FFDC, where multiple FFDC packets
can be returned after executing an SBE chip-op. This differs from the
processor SBE chip-op, which typically returns only a single FFDC packet
upon a chip-op failure.

Key aspects of the implementation:
- Each FFDC packet is associated with a unique SLID id, allowing for the
  identification of separate and unrelated FFDC packets within the
collection.
- Each unique SLID is treated as an independent PEL, ensuring that each
  FFDC packet is logged separately.
- FFDC data may be present even if the chip-op completes successfully.
  In such cases, PELs are logged, but the chip-op is not considered a
  failure.

Tests:
  Testing the proc FFDC to make sure no regression
  Testing POZ FFDC and making sure multiple PELs are logged
  Testing FFDC with chip-op success

Change-Id: I8c70bc8df9249c5b9841baef7b5dbe0a6f22e08d
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
diff --git a/dump/create_pel.hpp b/dump/create_pel.hpp
index a5287ea..5af80f8 100644
--- a/dump/create_pel.hpp
+++ b/dump/create_pel.hpp
@@ -5,9 +5,13 @@
 #include <phal_exception.H>
 
 #include <nlohmann/json.hpp>
+#include <xyz/openbmc_project/Logging/Create/server.hpp>
 
+#include <optional>
 #include <string>
+#include <tuple>
 #include <vector>
+
 namespace openpower::dump::pel
 {
 
@@ -19,6 +23,10 @@
 
 using namespace openpower::phal;
 
+using PELFFDCInfo = std::vector<std::tuple<
+    sdbusplus::xyz::openbmc_project::Logging::server::Create::FFDCFormat,
+    uint8_t, uint8_t, sdbusplus::message::unix_fd>>;
+
 /**
  * @brief Create SBE boot error PEL and return id
  *
@@ -28,9 +36,30 @@
  * @param[in] severity - severity of the log
  * @return Platform log id
  */
-uint32_t createSbeErrorPEL(const std::string& event, const sbeError_t& sbeError,
-                           const FFDCData& ffdcData,
-                           const Severity severity = Severity::Error);
+uint32_t createSbeErrorPEL(
+    const std::string& event, const sbeError_t& sbeError,
+    const FFDCData& ffdcData, const Severity severity = Severity::Error,
+    const std::optional<PELFFDCInfo>& pelFFDCInfoOpt = std::nullopt);
+
+/**
+ * @brief Convert a FAPI2 severity code to PEL severity.
+ *
+ * @param[in] severity - Severity code from FAPI2 error logs.
+ * @return Severity - The corresponding Severity enumeration value.
+ */
+openpower::dump::pel::Severity convertSeverityToEnum(uint8_t severity);
+
+/**
+ * @brief Process FFDC packets and create PELs for each packet.
+ *
+ * @param[in] sbeError - An SBE error object containing FFDC packet information.
+ * @param[in] event - The event identifier associated with the PELs.
+ * @param[out] pelAdditionalData - A reference to additional PEL data to be
+ *                                 included in the PEL.
+ */
+void processFFDCPackets(const openpower::phal::sbeError_t& sbeError,
+                        const std::string& event,
+                        openpower::dump::pel::FFDCData& pelAdditionalData);
 
 /**
  * @class FFDCFile