oem-ibm: Support bios attributes for boot types
This commit adds support to two bios attributes, boot
initiator and boot type, which lets the host know who
initiated the boot through boot initiator, and what type of
boot(boot or reboot) through the boot type attribute
Change-Id: Iec4bc4ceec3a48ffd3f59b4d31f419c8806187ac
Signed-off-by: Archana Kakani <archana.kakani@ibm.com>
diff --git a/softoff/softoff.cpp b/softoff/softoff.cpp
index 9721c7e..71fa9dc 100644
--- a/softoff/softoff.cpp
+++ b/softoff/softoff.cpp
@@ -14,6 +14,7 @@
#include <sdeventplus/exception.hpp>
#include <sdeventplus/source/io.hpp>
#include <sdeventplus/source/time.hpp>
+#include <xyz/openbmc_project/State/Host/common.hpp>
#include <array>
#include <filesystem>
@@ -278,13 +279,27 @@
// TODO: fix mapping to work around OpenBMC ecosystem deficiencies
pldm_tid_t pldmTID = static_cast<pldm_tid_t>(mctpEID);
+ uint8_t effecterState;
+ auto requestHostTransition =
+ pldm::utils::DBusHandler().getDbusProperty<std::string>(
+ "/xyz/openbmc_project/state/host0", "RequestedHostTransition",
+ sdbusplus::common::xyz::openbmc_project::state::Host::interface);
+ if (requestHostTransition !=
+ "xyz.openbmc_project.State.Host.Transition.Off")
+ {
+ effecterState = PLDM_SW_TERM_GRACEFUL_RESTART_REQUESTED;
+ }
+ else
+ {
+ effecterState = PLDM_SW_TERM_GRACEFUL_SHUTDOWN_REQUESTED;
+ }
+
std::array<uint8_t,
sizeof(pldm_msg_hdr) + sizeof(effecterID) +
sizeof(effecterCount) + sizeof(set_effecter_state_field)>
requestMsg{};
auto request = new (requestMsg.data()) pldm_msg;
- set_effecter_state_field stateField{
- PLDM_REQUEST_SET, PLDM_SW_TERM_GRACEFUL_SHUTDOWN_REQUESTED};
+ set_effecter_state_field stateField{PLDM_REQUEST_SET, effecterState};
instanceID = instanceIdDb.next(pldmTID);
auto rc = encode_set_state_effecter_states_req(
instanceID, effecterID, effecterCount, &stateField, request);