fw update: common code
new daemons to implement the flow as described in
https://github.com/openbmc/docs/blob/master/designs/code-update.md
- common/
common code folder
- common update flow
- base class for the device specific update daemons
The new daemons are all following the generic template of Code Updater
daemon as outlined in the design.
The idea is that they are separate daemons (per device, as outlined in
the design) but share all the code that's not device specific.
Tested: next patch in series
Change-Id: If2438b8506aceb8c5313ec13a0bf7cb68f3cc279
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/common/include/software_config.hpp b/common/include/software_config.hpp
new file mode 100644
index 0000000..f6d41ee
--- /dev/null
+++ b/common/include/software_config.hpp
@@ -0,0 +1,58 @@
+#pragma once
+
+#include "sdbusplus/async/context.hpp"
+
+#include <cstdint>
+#include <string>
+
+namespace phosphor::software::device
+{
+class Device;
+}
+
+using namespace phosphor::software::device;
+
+namespace phosphor::software::config
+{
+
+/* This class represents the device software configuration we get from
+ * entity-manager via D-Bus. Each Code Updater can create its own configuration
+ * class that inherits from this to store additional properties from their
+ * device configuration, like bus/address/...
+ */
+class SoftwareConfig
+{
+ public:
+ SoftwareConfig(const std::string& objPath, uint32_t vendorIANA,
+ const std::string& compatible, const std::string& configType,
+ const std::string& name);
+
+ // The dbus object path this configuration was fetched from
+ const std::string objectPath;
+
+ // https://github.com/openbmc/entity-manager/blob/master/schemas/firmware.json
+
+ // 'Name' field from the EM config
+ const std::string configName;
+
+ // 'Type' field from the EM config
+ const std::string configType;
+
+ // @returns the object path of the inventory item which
+ // can be associated with this device.
+ sdbusplus::async::task<std::string> getInventoryItemObjectPath(
+ sdbusplus::async::context& ctx);
+
+ private:
+ // 'VendorIANA' field from the EM config
+ const uint32_t vendorIANA; // e.g. "0x0000A015", 4 bytes as per PLDM spec
+
+ // 'CompatibleHardware' field from the EM config
+ const std::string
+ compatibleHardware; // e.g.
+ // "com.meta.Hardware.Yosemite4.MedusaBoard.CPLD.LCMX02_2000HC"
+
+ friend Device;
+};
+
+}; // namespace phosphor::software::config