oem-ibm: Sync boot side file with bios attributes

This change adds support to update the boot side file to keep it
in sync with boot side bios attributes

Change-Id: I2bea293500c69a883f400ddaadc436705bbe5ab4
Signed-off-by: Archana Kakani <archana.kakani@ibm.com>
diff --git a/libpldmresponder/bios.hpp b/libpldmresponder/bios.hpp
index eab143e..d6d7bbb 100644
--- a/libpldmresponder/bios.hpp
+++ b/libpldmresponder/bios.hpp
@@ -92,6 +92,17 @@
     Response setBIOSAttributeCurrentValue(const pldm_msg* request,
                                           size_t payloadLength);
 
+    pldm::responder::oem_bios::Handler* oemBiosHandler = nullptr;
+
+    /** @brief Set OEM bios handler
+     *
+     *  @param[in] oemBiosHandler - OEM Bios handler
+     */
+    inline void setOemBiosHandler(pldm::responder::oem_bios::Handler* handler)
+    {
+        biosConfig.setOemBiosHandler(handler);
+    }
+
   private:
     BIOSConfig biosConfig;
 };
diff --git a/libpldmresponder/bios_config.cpp b/libpldmresponder/bios_config.cpp
index cabb0bd..6b1b918 100644
--- a/libpldmresponder/bios_config.cpp
+++ b/libpldmresponder/bios_config.cpp
@@ -522,6 +522,10 @@
         auto method = bus.new_method_call(service.c_str(), biosConfigPath,
                                           dbusProperties, "Set");
         std::variant<BaseBIOSTable> value = baseBIOSTableMaps;
+        if (oemBiosHandler)
+        {
+            oemBiosHandler->processOEMBaseBiosTable(baseBIOSTableMaps);
+        }
         method.append(biosConfigInterface, biosConfigPropertyName, value);
         bus.call_noreply(method, dbusTimeout);
     }
diff --git a/libpldmresponder/bios_config.hpp b/libpldmresponder/bios_config.hpp
index 05f960d..db8b303 100644
--- a/libpldmresponder/bios_config.hpp
+++ b/libpldmresponder/bios_config.hpp
@@ -3,6 +3,7 @@
 #include "bios_attribute.hpp"
 #include "bios_table.hpp"
 #include "common/instance_id.hpp"
+#include "common/types.hpp"
 #include "oem_handler.hpp"
 #include "platform_config.hpp"
 #include "requester/handler.hpp"
@@ -12,7 +13,6 @@
 #include <nlohmann/json.hpp>
 #include <phosphor-logging/lg2.hpp>
 
-#include <functional>
 #include <iostream>
 #include <memory>
 #include <optional>
@@ -38,27 +38,7 @@
     OneOf
 };
 
-using AttributeName = std::string;
-using AttributeType = std::string;
-using ReadonlyStatus = bool;
-using DisplayName = std::string;
-using Description = std::string;
-using MenuPath = std::string;
-using CurrentValue = std::variant<int64_t, std::string>;
-using DefaultValue = std::variant<int64_t, std::string>;
-using OptionString = std::string;
-using OptionValue = std::variant<int64_t, std::string>;
-using ValueDisplayName = std::string;
-using Option =
-    std::vector<std::tuple<OptionString, OptionValue, ValueDisplayName>>;
-using BIOSTableObj =
-    std::tuple<AttributeType, ReadonlyStatus, DisplayName, Description,
-               MenuPath, CurrentValue, DefaultValue, Option>;
-using BaseBIOSTable = std::map<AttributeName, BIOSTableObj>;
-
-using PendingObj = std::tuple<AttributeType, CurrentValue>;
-using PendingAttributes = std::map<AttributeName, PendingObj>;
-using Callback = std::function<void()>;
+using namespace pldm::bios;
 
 /** @class BIOSConfig
  *  @brief Manager BIOS Attributes
@@ -140,6 +120,15 @@
      */
     void initBIOSAttributes(const std::string& sysType, bool registerService);
 
+    /** @brief Set OEM bios handler
+     *
+     *  @param[in] oemBiosHandler - OEM Bios handler
+     */
+    inline void setOemBiosHandler(pldm::responder::oem_bios::Handler* handler)
+    {
+        oemBiosHandler = handler;
+    }
+
   private:
     /** @enum Index into the fields in the BaseBIOSTable
      */
@@ -159,6 +148,7 @@
     const fs::path tableDir;
     pldm::utils::DBusHandler* const dbusHandler;
     BaseBIOSTable baseBIOSTableMaps;
+    pldm::responder::oem_bios::Handler* oemBiosHandler = nullptr;
 
     /** @brief MCTP EID of host firmware */
     uint8_t eid;
diff --git a/libpldmresponder/oem_handler.hpp b/libpldmresponder/oem_handler.hpp
index d8ca132..9e131ee 100644
--- a/libpldmresponder/oem_handler.hpp
+++ b/libpldmresponder/oem_handler.hpp
@@ -185,6 +185,26 @@
 
 } // namespace oem_utils
 
+namespace oem_bios
+{
+using namespace pldm::utils;
+
+class Handler : public CmdHandler
+{
+  public:
+    Handler() {}
+
+    /** @brief Process BaseBiosTable and update the locally cached attributes
+     *  @param[in] biosTable - Bios table
+     */
+    virtual void processOEMBaseBiosTable(
+        const pldm::bios::BaseBIOSTable& biosTable) = 0;
+
+    virtual ~Handler() = default;
+};
+
+} // namespace oem_bios
+
 } // namespace responder
 
 } // namespace pldm