xref: /openbmc/pldm/host-bmc/dbus/pcie_device.hpp (revision 90f28d7b)
1 #pragma once
2 
3 #include <sdbusplus/bus.hpp>
4 #include <sdbusplus/server.hpp>
5 #include <sdbusplus/server/object.hpp>
6 #include <xyz/openbmc_project/Inventory/Item/PCIeDevice/server.hpp>
7 #include <xyz/openbmc_project/Inventory/Item/PCIeSlot/common.hpp>
8 
9 #include <string>
10 
11 namespace pldm
12 {
13 namespace dbus
14 {
15 using ItemDevice = sdbusplus::server::object_t<
16     sdbusplus::xyz::openbmc_project::Inventory::Item::server::PCIeDevice>;
17 using Generations = sdbusplus::common::xyz::openbmc_project::inventory::item::
18     PCIeSlot::Generations;
19 
20 /**
21  * @class PCIeDevice
22  * @brief PCIeDevice DBUS support, also includes the device properties
23  */
24 
25 class PCIeDevice : public ItemDevice
26 {
27   public:
28     PCIeDevice() = delete;
29     ~PCIeDevice() = default;
30     PCIeDevice(const PCIeDevice&) = delete;
31     PCIeDevice& operator=(const PCIeDevice&) = delete;
32 
33     PCIeDevice(sdbusplus::bus_t& bus, const std::string& objPath) :
34         ItemDevice(bus, objPath.c_str())
35     {}
36 
37     /** Get lanes in use */
38     size_t lanesInUse() const override;
39 
40     /** Set lanes in use */
41     size_t lanesInUse(size_t value) override;
42 
43     /** Get Generation in use */
44     Generations generationInUse() const override;
45 
46     /** Set Generation in use */
47     Generations generationInUse(Generations value) override;
48 };
49 
50 } // namespace dbus
51 } // namespace pldm
52