oem-ibm: Maintain bootside Mapping and Set bios attribute

This commit adds code to maintain a mapping between running,
non-running and Temp, Perm side which would help the bmc
and remote PLDM terminus determine at any point in time if the
code update was successful and that remote PLDM terminus knows
exactly which side it is running on.

In the event the code update failed, then for that case
the new added bios attribute "fw_boot_side", which will
be set in the event. If BMC tries to boot from the new
"Temp" side (other side), and if it fails, then BMC must
update fw_boot_side to "Perm".

Change-Id: I9f1edad1e36850742aba88d93f8cf0fc8b9d8c8d
Signed-off-by: Archana Kakani <archana.kakani@ibm.com>
diff --git a/oem/ibm/libpldmresponder/inband_code_update.hpp b/oem/ibm/libpldmresponder/inband_code_update.hpp
index 9f67553..c29fe64 100644
--- a/oem/ibm/libpldmresponder/inband_code_update.hpp
+++ b/oem/ibm/libpldmresponder/inband_code_update.hpp
@@ -19,6 +19,24 @@
 static constexpr auto redundancyIntf =
     "xyz.openbmc_project.Software.RedundancyPriority";
 
+/**
+ * @struct pldm_boot_side_data
+ * @brief Holds PLDM current/next boot side and the boot side which has the
+ * active image.
+ *
+ * This structure stores the current and next boot side identifiers,
+ * as well as the running version information.
+ * The running version value is an alias to the currently active boot side.
+ * It contains either 'a' or 'b', mapping to the two available boot sides
+ * based on which side is active.
+ */
+struct pldm_boot_side_data
+{
+    std::string current_boot_side;
+    std::string next_boot_side;
+    std::string running_version_object;
+};
+
 /** @class CodeUpdate
  *
  *  @brief This class performs the necessary operation in pldm for
@@ -195,6 +213,20 @@
      * rename event notification to host when code update is initiated*/
     void processRenameEvent();
 
+    /* @brief Method to write the bootside information into mapping
+     *        file which would be stored on bmc
+     * @param[in] pldmBootSideData - bootside information such as
+     *        current boot side and running version
+     */
+    void writeBootSideFile(const pldm_boot_side_data& pldmBootSideData);
+
+    /* @brief Method to read the mapping file containing bootside
+     *        which is stored on bmc and stores that information
+     *        in a structure
+     * @return pldm_boot_side_data - the structure which holds information
+     * regarding bootside information */
+    pldm_boot_side_data readBootSideFile();
+
     virtual ~CodeUpdate() {}
 
   private: