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/pcie_device.hpp b/host-bmc/dbus/pcie_device.hpp
new file mode 100644
index 0000000..036e078
--- /dev/null
+++ b/host-bmc/dbus/pcie_device.hpp
@@ -0,0 +1,51 @@
+#pragma once
+
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/server.hpp>
+#include <sdbusplus/server/object.hpp>
+#include <xyz/openbmc_project/Inventory/Item/PCIeDevice/server.hpp>
+#include <xyz/openbmc_project/Inventory/Item/PCIeSlot/common.hpp>
+
+#include <string>
+
+namespace pldm
+{
+namespace dbus
+{
+using ItemDevice = sdbusplus::server::object_t<
+ sdbusplus::xyz::openbmc_project::Inventory::Item::server::PCIeDevice>;
+using Generations = sdbusplus::common::xyz::openbmc_project::inventory::item::
+ PCIeSlot::Generations;
+
+/**
+ * @class PCIeDevice
+ * @brief PCIeDevice DBUS support, also includes the device properties
+ */
+
+class PCIeDevice : public ItemDevice
+{
+ public:
+ PCIeDevice() = delete;
+ ~PCIeDevice() = default;
+ PCIeDevice(const PCIeDevice&) = delete;
+ PCIeDevice& operator=(const PCIeDevice&) = delete;
+
+ PCIeDevice(sdbusplus::bus_t& bus, const std::string& objPath) :
+ ItemDevice(bus, objPath.c_str())
+ {}
+
+ /** Get lanes in use */
+ size_t lanesInUse() const override;
+
+ /** Set lanes in use */
+ size_t lanesInUse(size_t value) override;
+
+ /** Get Generation in use */
+ Generations generationInUse() const override;
+
+ /** Set Generation in use */
+ Generations generationInUse(Generations value) override;
+};
+
+} // namespace dbus
+} // namespace pldm