add bios update support

The BIOS would be updated using multipart-form update as HTTP Push URI
is being default used for BMC updates.

Tested:
```
> curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/UpdateService/FirmwareInventory/bios_active
{
  "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active",
  "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
  "Description": "Host image",
  "Id": "bios_active",
  "Name": "Software Inventory",
  "RelatedItem": [
    {
      "@odata.id": "/redfish/v1/Systems/system/Bios"
    }
  ],
  "RelatedItem@odata.count": 1,
  "Status": {
    "Health": "OK",
    "HealthRollup": "OK",
    "State": "Enabled"
  },
  "Updateable": true,
  "Version": "null"
}

> curl -k -H "X-Auth-Token: $token" -H "Content-Type:multipart/form-data" -X POST -F UpdateParameters="{\"Targets\":[\"/redfish/v1/UpdateService/FirmwareInventory/bios_active\"],\"@Redfish.OperationApplyTime\":\"OnReset\"};type=appli
cation/json" -F "UpdateFile=@bios_image.tar;type=application/octet-stream" https://${bmc}/redfish/v1/UpdateService/update
{
  "@odata.id": "/redfish/v1/TaskService/Tasks/0",
  "@odata.type": "#Task.v1_4_3.Task",
  "Id": "0",
  "TaskState": "Running",
  "TaskStatus": "OK"
}

> curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/UpdateService/FirmwareInventory/bios_active
{
  "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active",
  "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
  "Description": "Host image",
  "Id": "bios_active",
  "Name": "Software Inventory",
  "RelatedItem": [
    {
      "@odata.id": "/redfish/v1/Systems/system/Bios"
    }
  ],
  "RelatedItem@odata.count": 1,
  "Status": {
    "Health": "OK",
    "HealthRollup": "OK",
    "State": "Enabled"
  },
  "Updateable": true,
  "Version": "2.17.0-dev-703-g61fd99b720-TestBios"
}
```

Change-Id: I213e28d7d1a00aa15f695ab855a96961113548ae
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/item_updater.hpp b/item_updater.hpp
index e1a8d3f..fac41f3 100644
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -74,11 +74,20 @@
         active
     };
 
+    /** @brief Types of Updater. */
+    enum class UpdaterType
+    {
+        BMC,
+        BIOS,
+        ALL
+    };
+
     /** @brief Constructs ItemUpdater
      *
      * @param[in] bus    - The D-Bus bus object
      */
     ItemUpdater(sdbusplus::async::context& ctx, const std::string& path,
+                UpdaterType type = UpdaterType::ALL,
                 bool useUpdateDBusInterface = true) :
         ItemUpdaterInherit(ctx.get_bus(), path.c_str(),
                            ItemUpdaterInherit::action::defer_emit),
@@ -96,11 +105,17 @@
         }
         getRunningSlot();
         setBMCInventoryPath();
-        processBMCImage();
-        restoreFieldModeStatus();
+        if (type == UpdaterType::BMC || type == UpdaterType::ALL)
+        {
+            processBMCImage();
+        }
+        if (type == UpdaterType::BIOS || type == UpdaterType::ALL)
+        {
 #ifdef HOST_BIOS_UPGRADE
-        createBIOSObject();
+            createBIOSObject();
 #endif
+        }
+        restoreFieldModeStatus();
         emit_object_added();
     };
 
diff --git a/item_updater_main.cpp b/item_updater_main.cpp
index 3d725b7..7709ec9 100644
--- a/item_updater_main.cpp
+++ b/item_updater_main.cpp
@@ -7,6 +7,8 @@
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server/manager.hpp>
 
+using ItemUpdaterIntf = phosphor::software::updater::ItemUpdater;
+
 int main()
 {
     sdbusplus::async::context ctx;
@@ -14,8 +16,8 @@
     // Add sdbusplus ObjectManager.
     sdbusplus::server::manager_t objManager(ctx, SOFTWARE_OBJPATH);
 
-    phosphor::software::updater::ItemUpdater updater(ctx, SOFTWARE_OBJPATH,
-                                                     false);
+    ItemUpdaterIntf updater(ctx, SOFTWARE_OBJPATH,
+                            ItemUpdaterIntf::UpdaterType::ALL, false);
 
     ctx.request_name(BUSNAME_UPDATER);
 
diff --git a/software_manager.cpp b/software_manager.cpp
index 3ee9f1a..651b758 100644
--- a/software_manager.cpp
+++ b/software_manager.cpp
@@ -1,8 +1,12 @@
+#include "config.h"
+
 #include "item_updater.hpp"
 
 #include <phosphor-logging/lg2.hpp>
 #include <sdbusplus/async.hpp>
 
+#include <string>
+
 using ItemUpdaterIntf = phosphor::software::updater::ItemUpdater;
 
 PHOSPHOR_LOG2_USING;
@@ -10,13 +14,19 @@
 int main()
 {
     info("Creating Software Manager");
-    auto path = std::string(SOFTWARE_OBJPATH) + "/bmc";
+    auto bmcPath = std::string(SOFTWARE_OBJPATH) + "/bmc";
+    auto biosPath = std::string(SOFTWARE_OBJPATH) + "/bios";
     sdbusplus::async::context ctx;
     sdbusplus::server::manager_t manager{ctx, SOFTWARE_OBJPATH};
 
     constexpr auto serviceName = "xyz.openbmc_project.Software.Manager";
 
-    ItemUpdaterIntf itemUpdater{ctx, path};
+    ItemUpdaterIntf bmcItemUpdater{ctx, bmcPath,
+                                   ItemUpdaterIntf::UpdaterType::BMC};
+#ifdef HOST_BIOS_UPGRADE
+    ItemUpdaterIntf biosItemUpdater{ctx, biosPath,
+                                    ItemUpdaterIntf::UpdaterType::BIOS};
+#endif // HOST_BIOS_UPGRADE
     ctx.request_name(serviceName);
 
     ctx.run();