summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2019-12-09 13:55:10 -0600
committerMatt Spinler <spinler@us.ibm.com>2019-12-17 17:28:40 +0000
commitb3f5186e89a1ff8887e41863da39d30d373e3c08 (patch)
tree57bd3b1aa56f525bf5ae68e6415b294a95704c5e /extensions
parent6d51224bd46ae2fca3adfc32c94d14d31f3daed6 (diff)
downloadphosphor-logging-b3f5186e89a1ff8887e41863da39d30d373e3c08.tar.gz
phosphor-logging-b3f5186e89a1ff8887e41863da39d30d373e3c08.zip
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
Diffstat (limited to 'extensions')
-rw-r--r--extensions/openpower-pels/data_interface.cpp24
-rw-r--r--extensions/openpower-pels/data_interface.hpp25
2 files changed, 47 insertions, 2 deletions
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 @@ namespace object_path
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 dbusProperty = "org.freedesktop.DBus.Properties";
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 @@ void DataInterface::getProperty(const std::string& service,
}
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 @@ void DataInterface::osStatePropChanged(sdbusplus::message::message& msg)
}
}
+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};
diff --git a/extensions/openpower-pels/data_interface.hpp b/extensions/openpower-pels/data_interface.hpp
index ff0aa75..35e220c 100644
--- a/extensions/openpower-pels/data_interface.hpp
+++ b/extensions/openpower-pels/data_interface.hpp
@@ -63,6 +63,20 @@ class DataInterfaceBase
return _hostUp;
}
+ /**
+ * @brief Returns the PLDM instance ID to use for PLDM commands
+ *
+ * The base class implementation just returns zero.
+ *
+ * @param[in] eid - The PLDM EID
+ *
+ * @return uint8_t - The instance ID
+ */
+ virtual uint8_t getPLDMInstanceID(uint8_t eid) const
+ {
+ return 0;
+ }
+
using HostStateChangeFunc = std::function<void(bool)>;
/**
@@ -192,6 +206,15 @@ class DataInterface : public DataInterfaceBase
*/
explicit DataInterface(sdbusplus::bus::bus& bus);
+ /**
+ * @brief Returns the PLDM instance ID to use for PLDM commands
+ *
+ * @param[in] eid - The PLDM EID
+ *
+ * @return uint8_t - The instance ID
+ */
+ uint8_t getPLDMInstanceID(uint8_t eid) const override;
+
private:
/**
* @brief Reads the machine type/model and SN from D-Bus.
@@ -236,7 +259,7 @@ class DataInterface : public DataInterfaceBase
* @param[in] interface - The D-Bus interface
*/
DBusService getService(const std::string& objectPath,
- const std::string& interface);
+ const std::string& interface) const;
/**
* @brief Wrapper for the 'GetAll' properties method call
*
OpenPOWER on IntegriCloud