Adding CPUCore interface support
This commit introduces essential D-Bus infrastructure support for
hosting the `Item.CPUCore` D-Bus object. Additionally, it includes
getter and setter functions to enable get/set properties within the
`CPUCore` interface, such as core count and microcode.
Testing:
Unit test passed
Change-Id: I728522b34e96ee7d6609efb5746b40cf923812e8
Signed-off-by: Kamalkumar Patel <kamalkumar.patel@ibm.com>
diff --git a/host-bmc/dbus/custom_dbus.cpp b/host-bmc/dbus/custom_dbus.cpp
index 6427a93..435d574 100644
--- a/host-bmc/dbus/custom_dbus.cpp
+++ b/host-bmc/dbus/custom_dbus.cpp
@@ -27,5 +27,33 @@
return std::nullopt;
}
+void CustomDBus::implementCpuCoreInterface(const std::string& path)
+{
+ if (!cpuCore.contains(path))
+ {
+ cpuCore.emplace(path, std::make_unique<CPUCore>(
+ pldm::utils::DBusHandler::getBus(), path));
+ }
+}
+
+void CustomDBus::setMicroCode(const std::string& path, uint32_t value)
+{
+ if (!cpuCore.contains(path))
+ {
+ cpuCore.emplace(path, std::make_unique<CPUCore>(
+ pldm::utils::DBusHandler::getBus(), path));
+ }
+ cpuCore.at(path)->microcode(value);
+}
+
+std::optional<uint32_t> CustomDBus::getMicroCode(const std::string& path) const
+{
+ if (cpuCore.contains(path))
+ {
+ return cpuCore.at(path)->microcode();
+ }
+
+ return std::nullopt;
+}
} // namespace dbus
} // namespace pldm