pldm: Build BIOS Table Lazily
Entity manager service hosts the compatible interface and populates the
Names property with the chassis type. It is seen that the Names property
is updated pretty late on the way to BMC ready state. And by that time
pldmd is already creating the bios table assuming that the system type
is not detected.
To fix this behavior, rather than creating the bios table early, we need
to wait until we get the system type from the entity manager daemon.
System Type is fetched from Entity Manager Decorator.Compatible
interface [1].
PLDM registers the service name only after building the BIOS tables, to
avoids failures to bios updates from other applications
Tested: Power off/On successfully in Simulator
[1] https://github.com/openbmc/entity-manager/commit/9bac6409d4bd684f058517f41de33ba1d17e5666
Change-Id: I4d431061eaaf8842f6382c2e83807f725653e19b
Signed-off-by: Archana Kakani <archana.kakani@ibm.com>
diff --git a/pldmd/pldmd.cpp b/pldmd/pldmd.cpp
index 21e2933..3bd9e90 100644
--- a/pldmd/pldmd.cpp
+++ b/pldmd/pldmd.cpp
@@ -83,6 +83,12 @@
FlightRecorder::GetInstance().playRecorder();
}
+void requestPLDMServiceName()
+{
+ auto& bus = pldm::utils::DBusHandler::getBus();
+ bus.request_name("xyz.openbmc_project.PLDM");
+}
+
static std::optional<Response>
processRxMsg(const std::vector<uint8_t>& requestMsg, Invoker& invoker,
requester::Handler<requester::Request>& handler,
@@ -262,7 +268,7 @@
}
auto biosHandler = std::make_unique<bios::Handler>(
pldmTransport.getEventSource(), hostEID, &instanceIdDb, &reqHandler,
- platformConfigHandler.get());
+ platformConfigHandler.get(), requestPLDMServiceName);
auto fruHandler = std::make_unique<fru::Handler>(
FRU_JSONS_DIR, FRU_MASTER_JSON, pdrRepo.get(), entityTree.get(),
@@ -370,7 +376,6 @@
};
bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
- bus.request_name("xyz.openbmc_project.PLDM");
IO io(event, pldmTransport.getEventSource(), EPOLLIN, std::move(callback));
#ifdef LIBPLDMRESPONDER
if (hostPDRHandler)