Support "GenerationInUse" PCIe device property
This commit adds support for PCIe device property "GenerationInUse",
and let management APIs like redfish can expose the information.
New property:
GenerationInUse : The PCIe interface generation in use by the device.
Tested:
Ensure DBus is created and the value is correct of new property.
Dbus Sample output:
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
[...]
xyz.openbmc_project.PCIe.Device interface - - -
.DeviceType property s "SingleFunction" emits-change
.Function0ClassCode property s "0x060400" emits-change
[...]
.GenerationInUse property s "xyz.openbmc_project.Inventory.Item.PCIeSlot.Generations.Gen2" emits-change
Signed-off-by: Spencer Ku <Spencer.Ku@quantatw.com>
Change-Id: I2273b9529a16ca0229c5d0ad17befcd3f764a188
diff --git a/include/peci_pcie.hpp b/include/peci_pcie.hpp
index 74ea2da..1e10b46 100644
--- a/include/peci_pcie.hpp
+++ b/include/peci_pcie.hpp
@@ -33,4 +33,25 @@
static constexpr const int peciCheckInterval = 10;
static constexpr const int osStandbyDelaySeconds = 10;
+
+static constexpr const int pointToCapStruct = 0x34;
+static constexpr const int maskOfCLS = 0x0F;
+
+static constexpr const int capPointerOffset = 1;
+static constexpr const int linkStatusOffset = 18;
+
+// PCIe version
+// GEN1 : 0001b : transfer rate 2.5GB
+// GEN2 : 0010b : transfer rate 5GB
+// GEN3 : 0011b : transfer rate 8GB
+// GEN4 : 0100b : transfer rate 16GB
+// GEN5 : 0101b : transfer rate 32GB
+enum GenerationInUse : int
+{
+ pcieGen1 = 1,
+ pcieGen2,
+ pcieGen3,
+ pcieGen4,
+ pcieGen5
+};
} // namespace peci_pcie