PEL: Add API to get the PLDM instance ID
In order to send a PLDM command, one must get the instance ID parameter
to use for that command from the PLDM daemon via a D-Bus method.
Implement this API in the DataInterface class, though leave the body of
it stubbed out until the PLDM daemon switches to using async D-Bus
operations as right now the logging daemon and PLDM daemon can deadlock
with each calling into the other.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I592e7bad922c725edee67003e9957388df5f195c
diff --git a/extensions/openpower-pels/data_interface.cpp b/extensions/openpower-pels/data_interface.cpp
index 7342dc0..6ad8b6e 100644
--- a/extensions/openpower-pels/data_interface.cpp
+++ b/extensions/openpower-pels/data_interface.cpp
@@ -35,6 +35,7 @@
constexpr auto objectMapper = "/xyz/openbmc_project/object_mapper";
constexpr auto systemInv = "/xyz/openbmc_project/inventory/system";
constexpr auto hostState = "/xyz/openbmc_project/state/host0";
+constexpr auto pldm = "/xyz/openbmc_project/pldm";
} // namespace object_path
namespace interface
@@ -43,6 +44,7 @@
constexpr auto objectMapper = "xyz.openbmc_project.ObjectMapper";
constexpr auto invAsset = "xyz.openbmc_project.Inventory.Decorator.Asset";
constexpr auto osStatus = "xyz.openbmc_project.State.OperatingSystem.Status";
+constexpr auto pldmRequester = "xyz.openbmc_project.PLDM.Requester";
} // namespace interface
using namespace sdbusplus::xyz::openbmc_project::State::OperatingSystem::server;
@@ -140,7 +142,7 @@
}
DBusService DataInterface::getService(const std::string& objectPath,
- const std::string& interface)
+ const std::string& interface) const
{
auto method = _bus.new_method_call(service_name::objectMapper,
object_path::objectMapper,
@@ -222,6 +224,26 @@
}
}
+uint8_t DataInterface::getPLDMInstanceID(uint8_t eid) const
+{
+ return 0;
+// Don't use until PLDM switches to async D-Bus.
+#if 0
+ auto service = getService(object_path::pldm, interface::pldmRequester);
+
+ auto method =
+ _bus.new_method_call(service.c_str(), object_path::pldm,
+ interface::pldmRequester, "GetInstanceId");
+ method.append(eid);
+ auto reply = _bus.call(method);
+
+ uint8_t instanceID = 0;
+ reply.read(instanceID);
+
+ return instanceID;
+#endif
+}
+
void DataInterface::readBMCFWVersion()
{
std::ifstream versionFile{BMC_VERSION_FILE};