pldm: Implement PCIeDevice interface
Adding support to host PCIeDevice dbus interface.
Based on the PDRs received from remote PLDM terminus,
PLDM hosts the dbus interface based on the entity type.
The PCIe Device interface is defined at [1].
Tested:
Functional test passed
[1]: https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Inventory/Item/PCIeDevice.interface.yaml
Change-Id: I69472efef33c3ad030ba4c831f07f60833b2c40b
Signed-off-by: Archana Kakani <archana.kakani@ibm.com>
diff --git a/host-bmc/dbus/custom_dbus.cpp b/host-bmc/dbus/custom_dbus.cpp
index b1cae11..cfe3a42 100644
--- a/host-bmc/dbus/custom_dbus.cpp
+++ b/host-bmc/dbus/custom_dbus.cpp
@@ -75,5 +75,28 @@
pcieSlot.at(path)->slotType(typeOfSlot);
}
}
+
+void CustomDBus::implementPCIeDeviceInterface(const std::string& path)
+{
+ if (!pcieDevice.contains(path))
+ {
+ pcieDevice.emplace(path, std::make_unique<PCIeDevice>(
+ pldm::utils::DBusHandler::getBus(), path));
+ }
+}
+
+void CustomDBus::setPCIeDeviceProps(const std::string& path, size_t lanesInUse,
+ const std::string& value)
+{
+ Generations generationsInUse =
+ pldm::dbus::PCIeSlot::convertGenerationsFromString(value);
+
+ if (pcieDevice.contains(path))
+ {
+ pcieDevice.at(path)->lanesInUse(lanesInUse);
+ pcieDevice.at(path)->generationInUse(generationsInUse);
+ }
+}
+
} // namespace dbus
} // namespace pldm