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/common/utils.cpp b/common/utils.cpp
index 06ae48b..7406e1f 100644
--- a/common/utils.cpp
+++ b/common/utils.cpp
@@ -4,7 +4,6 @@
#include <libpldm/pldm_types.h>
#include <linux/mctp.h>
-#include <phosphor-logging/lg2.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
#include <xyz/openbmc_project/Logging/Create/client.hpp>
#include <xyz/openbmc_project/ObjectMapper/client.hpp>
@@ -910,5 +909,49 @@
return effecterIDs;
}
+void setBiosAttr(const PendingAttributesList& biosAttrList)
+{
+ static constexpr auto SYSTEMD_PROPERTY_INTERFACE =
+ "org.freedesktop.DBus.Properties";
+ constexpr auto biosConfigPath = "/xyz/openbmc_project/bios_config/manager";
+ constexpr auto biosConfigIntf = "xyz.openbmc_project.BIOSConfig.Manager";
+
+ for (const auto& [attrName, biosAttrDetails] : biosAttrList)
+ {
+ auto& bus = DBusHandler::getBus();
+ try
+ {
+ auto service = pldm::utils::DBusHandler().getService(
+ biosConfigPath, biosConfigIntf);
+ auto method =
+ bus.new_method_call(service.c_str(), biosConfigPath,
+ SYSTEMD_PROPERTY_INTERFACE, "Set");
+ method.append(biosConfigIntf, "PendingAttributes",
+ std::variant<PendingAttributesList>(biosAttrList));
+ bus.call_noreply(method, dbusTimeout);
+ }
+ catch (const sdbusplus::exception::SdBusError& e)
+ {
+ AttributeType attrType;
+ AttributeValue attrValue;
+ std::tie(attrType, attrValue) = biosAttrDetails;
+ if (attrType ==
+ "xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Integer")
+ {
+ info(
+ "Error setting the value {VALUE} to bios attribute {BIOS_ATTR}: {ERR_EXCEP}",
+ "VALUE", std::get<int64_t>(attrValue), "BIOS_ATTR",
+ attrName, "ERR_EXCEP", e);
+ }
+ else
+ {
+ info(
+ "Error setting the value {VALUE} to bios attribute {BIOS_ATTR}: {ERR_EXCEP}",
+ "VALUE", std::get<std::string>(attrValue), "BIOS_ATTR",
+ attrName, "ERR_EXCEP", e);
+ }
+ }
+ }
+}
} // namespace utils
} // namespace pldm