summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Redfish.md2
-rw-r--r--redfish-core/lib/pcie.hpp36
2 files changed, 36 insertions, 2 deletions
diff --git a/Redfish.md b/Redfish.md
index a7b3445d82..f2fb141916 100644
--- a/Redfish.md
+++ b/Redfish.md
@@ -861,6 +861,8 @@ other.
- PCIeInterface
- DeviceType
- LanesInUse
+ - MaxLanes
+ - MaxPCIeType
- PCIeType
- SerialNumber
- Slot
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index f5c5303554..195ec8727a 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -418,12 +418,14 @@ inline void addPCIeDeviceProperties(
{
const std::string* deviceType = nullptr;
const std::string* generationInUse = nullptr;
+ const std::string* generationSupported = nullptr;
const size_t* lanesInUse = nullptr;
+ const size_t* maxLanes = nullptr;
const bool success = sdbusplus::unpackPropertiesNoThrow(
dbus_utils::UnpackErrorPrinter(), pcieDevProperties, "DeviceType",
- deviceType, "GenerationInUse", generationInUse, "LanesInUse",
- lanesInUse);
+ deviceType, "GenerationInUse", generationInUse, "GenerationSupported",
+ generationSupported, "LanesInUse", lanesInUse, "MaxLanes", maxLanes);
if (!success)
{
@@ -460,12 +462,42 @@ inline void addPCIeDeviceProperties(
}
}
+ if (generationSupported != nullptr)
+ {
+ std::optional<pcie_device::PCIeTypes> redfishGenerationSupported =
+ pcie_util::redfishPcieGenerationFromDbus(*generationSupported);
+
+ if (!redfishGenerationSupported)
+ {
+ BMCWEB_LOG_WARNING << "Unknown PCIe Device Generation: "
+ << *generationSupported;
+ }
+ else
+ {
+ if (*redfishGenerationSupported == pcie_device::PCIeTypes::Invalid)
+ {
+ BMCWEB_LOG_ERROR << "Invalid PCIe Device Generation: "
+ << *generationSupported;
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ asyncResp->res.jsonValue["PCIeInterface"]["MaxPCIeType"] =
+ *redfishGenerationSupported;
+ }
+ }
+
// The default value of LanesInUse is 0, and the field will be
// left as off if it is a default value.
if (lanesInUse != nullptr && *lanesInUse != 0)
{
asyncResp->res.jsonValue["PCIeInterface"]["LanesInUse"] = *lanesInUse;
}
+ // The default value of MaxLanes is 0, and the field will be
+ // left as off if it is a default value.
+ if (maxLanes != nullptr && *maxLanes != 0)
+ {
+ asyncResp->res.jsonValue["PCIeInterface"]["MaxLanes"] = *maxLanes;
+ }
asyncResp->res.jsonValue["PCIeFunctions"]["@odata.id"] =
boost::urls::format(