Jason M. Bills | f5c9f8b | 2018-12-18 16:51:18 -0800 | [diff] [blame] | 1 | /* |
| 2 | // Copyright (c) 2018 Intel Corporation |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 19 | #include "app.hpp" |
George Liu | 7a1dbc4 | 2022-12-07 16:03:22 +0800 | [diff] [blame] | 20 | #include "dbus_utility.hpp" |
Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 21 | #include "query.hpp" |
| 22 | #include "registries/privilege_registry.hpp" |
Lakshmi Yadlapati | b38fa2a | 2023-03-10 16:19:46 -0600 | [diff] [blame] | 23 | #include "utils/collection.hpp" |
Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 24 | #include "utils/dbus_utils.hpp" |
Lakshmi Yadlapati | c49c329 | 2023-04-19 16:42:35 -0500 | [diff] [blame] | 25 | #include "utils/pcie_util.hpp" |
Ed Tanous | 0ec8b83 | 2022-03-14 14:56:47 -0700 | [diff] [blame] | 26 | |
Jason M. Bills | f5c9f8b | 2018-12-18 16:51:18 -0800 | [diff] [blame] | 27 | #include <boost/system/linux_error.hpp> |
Ed Tanous | ef4c65b | 2023-04-24 15:28:50 -0700 | [diff] [blame] | 28 | #include <boost/url/format.hpp> |
Krzysztof Grobelny | d1bde9e | 2022-09-07 10:40:51 +0200 | [diff] [blame] | 29 | #include <sdbusplus/asio/property.hpp> |
| 30 | #include <sdbusplus/unpack_properties.hpp> |
Jason M. Bills | f5c9f8b | 2018-12-18 16:51:18 -0800 | [diff] [blame] | 31 | |
Myung Bae | 8c1d054 | 2024-03-12 17:50:48 -0500 | [diff] [blame^] | 32 | #include <limits> |
| 33 | |
Jason M. Bills | f5c9f8b | 2018-12-18 16:51:18 -0800 | [diff] [blame] | 34 | namespace redfish |
| 35 | { |
| 36 | |
Patrick Williams | 89492a1 | 2023-05-10 07:51:34 -0500 | [diff] [blame] | 37 | static constexpr const char* inventoryPath = "/xyz/openbmc_project/inventory"; |
Lakshmi Yadlapati | 94c3a10 | 2023-04-05 18:11:22 -0500 | [diff] [blame] | 38 | static constexpr std::array<std::string_view, 1> pcieDeviceInterface = { |
| 39 | "xyz.openbmc_project.Inventory.Item.PCIeDevice"}; |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 40 | static constexpr std::array<std::string_view, 1> pcieSlotInterface = { |
| 41 | "xyz.openbmc_project.Inventory.Item.PCIeSlot"}; |
Jason M. Bills | f5c9f8b | 2018-12-18 16:51:18 -0800 | [diff] [blame] | 42 | |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 43 | static inline void handlePCIeDevicePath( |
| 44 | const std::string& pcieDeviceId, |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 45 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 46 | const dbus::utility::MapperGetSubTreePathsResponse& pcieDevicePaths, |
| 47 | const std::function<void(const std::string& pcieDevicePath, |
| 48 | const std::string& service)>& callback) |
| 49 | |
| 50 | { |
| 51 | for (const std::string& pcieDevicePath : pcieDevicePaths) |
| 52 | { |
| 53 | std::string pciecDeviceName = |
| 54 | sdbusplus::message::object_path(pcieDevicePath).filename(); |
| 55 | if (pciecDeviceName.empty() || pciecDeviceName != pcieDeviceId) |
| 56 | { |
| 57 | continue; |
| 58 | } |
| 59 | |
| 60 | dbus::utility::getDbusObject( |
| 61 | pcieDevicePath, {}, |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 62 | [pcieDevicePath, asyncResp, |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 63 | callback](const boost::system::error_code& ec, |
| 64 | const dbus::utility::MapperGetObject& object) { |
| 65 | if (ec || object.empty()) |
| 66 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 67 | BMCWEB_LOG_ERROR("DBUS response error {}", ec); |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 68 | messages::internalError(asyncResp->res); |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 69 | return; |
| 70 | } |
| 71 | callback(pcieDevicePath, object.begin()->first); |
Patrick Williams | 5a39f77 | 2023-10-20 11:20:21 -0500 | [diff] [blame] | 72 | }); |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 73 | return; |
| 74 | } |
| 75 | |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 76 | BMCWEB_LOG_WARNING("PCIe Device not found"); |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 77 | messages::resourceNotFound(asyncResp->res, "PCIeDevice", pcieDeviceId); |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 78 | } |
| 79 | |
| 80 | static inline void getValidPCIeDevicePath( |
| 81 | const std::string& pcieDeviceId, |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 82 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 83 | const std::function<void(const std::string& pcieDevicePath, |
| 84 | const std::string& service)>& callback) |
| 85 | { |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 86 | dbus::utility::getSubTreePaths( |
Lakshmi Yadlapati | 94c3a10 | 2023-04-05 18:11:22 -0500 | [diff] [blame] | 87 | inventoryPath, 0, pcieDeviceInterface, |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 88 | [pcieDeviceId, asyncResp, |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 89 | callback](const boost::system::error_code& ec, |
| 90 | const dbus::utility::MapperGetSubTreePathsResponse& |
| 91 | pcieDevicePaths) { |
| 92 | if (ec) |
| 93 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 94 | BMCWEB_LOG_ERROR("D-Bus response error on GetSubTree {}", ec); |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 95 | messages::internalError(asyncResp->res); |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 96 | return; |
| 97 | } |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 98 | handlePCIeDevicePath(pcieDeviceId, asyncResp, pcieDevicePaths, |
| 99 | callback); |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 100 | return; |
Patrick Williams | 5a39f77 | 2023-10-20 11:20:21 -0500 | [diff] [blame] | 101 | }); |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 102 | } |
| 103 | |
Lakshmi Yadlapati | b38fa2a | 2023-03-10 16:19:46 -0600 | [diff] [blame] | 104 | static inline void handlePCIeDeviceCollectionGet( |
| 105 | crow::App& app, const crow::Request& req, |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 106 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
Lakshmi Yadlapati | b38fa2a | 2023-03-10 16:19:46 -0600 | [diff] [blame] | 107 | const std::string& systemName) |
| 108 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 109 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
Lakshmi Yadlapati | b38fa2a | 2023-03-10 16:19:46 -0600 | [diff] [blame] | 110 | { |
| 111 | return; |
| 112 | } |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 113 | if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM) |
Ed Tanous | 7f3e84a | 2022-12-28 16:22:54 -0800 | [diff] [blame] | 114 | { |
| 115 | // Option currently returns no systems. TBD |
| 116 | messages::resourceNotFound(asyncResp->res, "ComputerSystem", |
| 117 | systemName); |
| 118 | return; |
| 119 | } |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 120 | if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME) |
Lakshmi Yadlapati | b38fa2a | 2023-03-10 16:19:46 -0600 | [diff] [blame] | 121 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 122 | messages::resourceNotFound(asyncResp->res, "ComputerSystem", |
| 123 | systemName); |
Lakshmi Yadlapati | b38fa2a | 2023-03-10 16:19:46 -0600 | [diff] [blame] | 124 | return; |
| 125 | } |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 126 | |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 127 | asyncResp->res.addHeader(boost::beast::http::field::link, |
| 128 | "</redfish/v1/JsonSchemas/PCIeDeviceCollection/" |
| 129 | "PCIeDeviceCollection.json>; rel=describedby"); |
| 130 | asyncResp->res.jsonValue["@odata.type"] = |
Lakshmi Yadlapati | b38fa2a | 2023-03-10 16:19:46 -0600 | [diff] [blame] | 131 | "#PCIeDeviceCollection.PCIeDeviceCollection"; |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 132 | asyncResp->res.jsonValue["@odata.id"] = std::format( |
| 133 | "/redfish/v1/Systems/{}/PCIeDevices", BMCWEB_REDFISH_SYSTEM_URI_NAME); |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 134 | asyncResp->res.jsonValue["Name"] = "PCIe Device Collection"; |
| 135 | asyncResp->res.jsonValue["Description"] = "Collection of PCIe Devices"; |
Lakshmi Yadlapati | b38fa2a | 2023-03-10 16:19:46 -0600 | [diff] [blame] | 136 | |
Lakshmi Yadlapati | 70c4d54 | 2023-06-08 04:37:18 -0500 | [diff] [blame] | 137 | pcie_util::getPCIeDeviceList(asyncResp, |
| 138 | nlohmann::json::json_pointer("/Members")); |
Lakshmi Yadlapati | b38fa2a | 2023-03-10 16:19:46 -0600 | [diff] [blame] | 139 | } |
| 140 | |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 141 | inline void requestRoutesSystemPCIeDeviceCollection(App& app) |
Jason M. Bills | adbe192 | 2019-10-14 15:44:35 -0700 | [diff] [blame] | 142 | { |
Jason M. Bills | adbe192 | 2019-10-14 15:44:35 -0700 | [diff] [blame] | 143 | /** |
| 144 | * Functions triggers appropriate requests on DBus |
| 145 | */ |
Ed Tanous | 22d268c | 2022-05-19 09:39:07 -0700 | [diff] [blame] | 146 | BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/PCIeDevices/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 147 | .privileges(redfish::privileges::getPCIeDeviceCollection) |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 148 | .methods(boost::beast::http::verb::get)( |
Lakshmi Yadlapati | b38fa2a | 2023-03-10 16:19:46 -0600 | [diff] [blame] | 149 | std::bind_front(handlePCIeDeviceCollectionGet, std::ref(app))); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 150 | } |
| 151 | |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 152 | inline void addPCIeSlotProperties( |
| 153 | crow::Response& res, const boost::system::error_code& ec, |
| 154 | const dbus::utility::DBusPropertiesMap& pcieSlotProperties) |
| 155 | { |
| 156 | if (ec) |
| 157 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 158 | BMCWEB_LOG_ERROR("DBUS response error for getAllProperties{}", |
| 159 | ec.value()); |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 160 | messages::internalError(res); |
| 161 | return; |
| 162 | } |
| 163 | std::string generation; |
| 164 | size_t lanes = 0; |
| 165 | std::string slotType; |
| 166 | |
| 167 | bool success = sdbusplus::unpackPropertiesNoThrow( |
| 168 | dbus_utils::UnpackErrorPrinter(), pcieSlotProperties, "Generation", |
| 169 | generation, "Lanes", lanes, "SlotType", slotType); |
| 170 | |
| 171 | if (!success) |
| 172 | { |
| 173 | messages::internalError(res); |
| 174 | return; |
| 175 | } |
| 176 | |
| 177 | std::optional<pcie_device::PCIeTypes> pcieType = |
| 178 | pcie_util::redfishPcieGenerationFromDbus(generation); |
| 179 | if (!pcieType) |
| 180 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 181 | BMCWEB_LOG_WARNING("Unknown PCIeType: {}", generation); |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 182 | } |
| 183 | else |
| 184 | { |
| 185 | if (*pcieType == pcie_device::PCIeTypes::Invalid) |
| 186 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 187 | BMCWEB_LOG_ERROR("Invalid PCIeType: {}", generation); |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 188 | messages::internalError(res); |
| 189 | return; |
| 190 | } |
| 191 | res.jsonValue["Slot"]["PCIeType"] = *pcieType; |
| 192 | } |
| 193 | |
Konstantin Aladyshev | 82f8032 | 2023-07-10 15:00:38 +0300 | [diff] [blame] | 194 | if (lanes != 0) |
| 195 | { |
| 196 | res.jsonValue["Slot"]["Lanes"] = lanes; |
| 197 | } |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 198 | |
| 199 | std::optional<pcie_slots::SlotTypes> redfishSlotType = |
| 200 | pcie_util::dbusSlotTypeToRf(slotType); |
| 201 | if (!redfishSlotType) |
| 202 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 203 | BMCWEB_LOG_WARNING("Unknown PCIeSlot Type: {}", slotType); |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 204 | } |
| 205 | else |
| 206 | { |
| 207 | if (*redfishSlotType == pcie_slots::SlotTypes::Invalid) |
| 208 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 209 | BMCWEB_LOG_ERROR("Invalid PCIeSlot type: {}", slotType); |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 210 | messages::internalError(res); |
| 211 | return; |
| 212 | } |
| 213 | res.jsonValue["Slot"]["SlotType"] = *redfishSlotType; |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | inline void getPCIeDeviceSlotPath( |
| 218 | const std::string& pcieDevicePath, |
| 219 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 220 | std::function<void(const std::string& pcieDeviceSlot)>&& callback) |
| 221 | { |
| 222 | std::string associationPath = pcieDevicePath + "/contained_by"; |
| 223 | dbus::utility::getAssociatedSubTreePaths( |
| 224 | associationPath, sdbusplus::message::object_path(inventoryPath), 0, |
| 225 | pcieSlotInterface, |
Ed Tanous | 8cb2c02 | 2024-03-27 16:31:46 -0700 | [diff] [blame] | 226 | [callback = std::move(callback), asyncResp, pcieDevicePath]( |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 227 | const boost::system::error_code& ec, |
| 228 | const dbus::utility::MapperGetSubTreePathsResponse& endpoints) { |
| 229 | if (ec) |
| 230 | { |
| 231 | if (ec.value() == EBADR) |
| 232 | { |
| 233 | // Missing association is not an error |
| 234 | return; |
| 235 | } |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 236 | BMCWEB_LOG_ERROR( |
| 237 | "DBUS response error for getAssociatedSubTreePaths {}", |
| 238 | ec.value()); |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 239 | messages::internalError(asyncResp->res); |
| 240 | return; |
| 241 | } |
| 242 | if (endpoints.size() > 1) |
| 243 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 244 | BMCWEB_LOG_ERROR( |
| 245 | "PCIeDevice is associated with more than one PCIeSlot: {}", |
| 246 | endpoints.size()); |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 247 | messages::internalError(asyncResp->res); |
| 248 | return; |
| 249 | } |
| 250 | if (endpoints.empty()) |
| 251 | { |
| 252 | // If the device doesn't have an association, return without PCIe |
| 253 | // Slot properties |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 254 | BMCWEB_LOG_DEBUG("PCIeDevice is not associated with PCIeSlot"); |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 255 | return; |
| 256 | } |
| 257 | callback(endpoints[0]); |
Patrick Williams | 5a39f77 | 2023-10-20 11:20:21 -0500 | [diff] [blame] | 258 | }); |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 259 | } |
| 260 | |
| 261 | inline void |
| 262 | afterGetDbusObject(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 263 | const std::string& pcieDeviceSlot, |
| 264 | const boost::system::error_code& ec, |
| 265 | const dbus::utility::MapperGetObject& object) |
| 266 | { |
| 267 | if (ec || object.empty()) |
| 268 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 269 | BMCWEB_LOG_ERROR("DBUS response error for getDbusObject {}", |
| 270 | ec.value()); |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 271 | messages::internalError(asyncResp->res); |
| 272 | return; |
| 273 | } |
| 274 | sdbusplus::asio::getAllProperties( |
| 275 | *crow::connections::systemBus, object.begin()->first, pcieDeviceSlot, |
| 276 | "xyz.openbmc_project.Inventory.Item.PCIeSlot", |
| 277 | [asyncResp]( |
| 278 | const boost::system::error_code& ec2, |
| 279 | const dbus::utility::DBusPropertiesMap& pcieSlotProperties) { |
| 280 | addPCIeSlotProperties(asyncResp->res, ec2, pcieSlotProperties); |
Patrick Williams | 5a39f77 | 2023-10-20 11:20:21 -0500 | [diff] [blame] | 281 | }); |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | inline void afterGetPCIeDeviceSlotPath( |
| 285 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 286 | const std::string& pcieDeviceSlot) |
| 287 | { |
| 288 | dbus::utility::getDbusObject( |
| 289 | pcieDeviceSlot, pcieSlotInterface, |
| 290 | [asyncResp, |
| 291 | pcieDeviceSlot](const boost::system::error_code& ec, |
| 292 | const dbus::utility::MapperGetObject& object) { |
| 293 | afterGetDbusObject(asyncResp, pcieDeviceSlot, ec, object); |
Patrick Williams | 5a39f77 | 2023-10-20 11:20:21 -0500 | [diff] [blame] | 294 | }); |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 295 | } |
| 296 | |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 297 | inline void |
Lakshmi Yadlapati | e164f1b | 2023-04-12 17:01:34 -0500 | [diff] [blame] | 298 | getPCIeDeviceHealth(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 299 | const std::string& pcieDevicePath, |
| 300 | const std::string& service) |
| 301 | { |
| 302 | sdbusplus::asio::getProperty<bool>( |
| 303 | *crow::connections::systemBus, service, pcieDevicePath, |
| 304 | "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional", |
| 305 | [asyncResp](const boost::system::error_code& ec, const bool value) { |
| 306 | if (ec) |
| 307 | { |
| 308 | if (ec.value() != EBADR) |
| 309 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 310 | BMCWEB_LOG_ERROR("DBUS response error for Health {}", |
| 311 | ec.value()); |
Lakshmi Yadlapati | e164f1b | 2023-04-12 17:01:34 -0500 | [diff] [blame] | 312 | messages::internalError(asyncResp->res); |
| 313 | } |
| 314 | return; |
| 315 | } |
| 316 | |
| 317 | if (!value) |
| 318 | { |
| 319 | asyncResp->res.jsonValue["Status"]["Health"] = "Critical"; |
| 320 | } |
Patrick Williams | 5a39f77 | 2023-10-20 11:20:21 -0500 | [diff] [blame] | 321 | }); |
Lakshmi Yadlapati | e164f1b | 2023-04-12 17:01:34 -0500 | [diff] [blame] | 322 | } |
| 323 | |
| 324 | inline void |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 325 | getPCIeDeviceState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 326 | const std::string& pcieDevicePath, |
| 327 | const std::string& service) |
Lakshmi Yadlapati | c6bb328 | 2023-04-12 16:56:49 -0500 | [diff] [blame] | 328 | { |
| 329 | sdbusplus::asio::getProperty<bool>( |
| 330 | *crow::connections::systemBus, service, pcieDevicePath, |
| 331 | "xyz.openbmc_project.Inventory.Item", "Present", |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 332 | [asyncResp](const boost::system::error_code& ec, bool value) { |
Lakshmi Yadlapati | c6bb328 | 2023-04-12 16:56:49 -0500 | [diff] [blame] | 333 | if (ec) |
| 334 | { |
| 335 | if (ec.value() != EBADR) |
| 336 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 337 | BMCWEB_LOG_ERROR("DBUS response error for State"); |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 338 | messages::internalError(asyncResp->res); |
Lakshmi Yadlapati | c6bb328 | 2023-04-12 16:56:49 -0500 | [diff] [blame] | 339 | } |
| 340 | return; |
| 341 | } |
| 342 | |
| 343 | if (!value) |
| 344 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 345 | asyncResp->res.jsonValue["Status"]["State"] = "Absent"; |
Lakshmi Yadlapati | c6bb328 | 2023-04-12 16:56:49 -0500 | [diff] [blame] | 346 | } |
Patrick Williams | 5a39f77 | 2023-10-20 11:20:21 -0500 | [diff] [blame] | 347 | }); |
Lakshmi Yadlapati | c6bb328 | 2023-04-12 16:56:49 -0500 | [diff] [blame] | 348 | } |
| 349 | |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 350 | inline void |
| 351 | getPCIeDeviceAsset(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 352 | const std::string& pcieDevicePath, |
| 353 | const std::string& service) |
SunnySrivastava1984 | 913e773 | 2021-01-27 06:23:24 -0600 | [diff] [blame] | 354 | { |
| 355 | sdbusplus::asio::getAllProperties( |
| 356 | *crow::connections::systemBus, service, pcieDevicePath, |
| 357 | "xyz.openbmc_project.Inventory.Decorator.Asset", |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 358 | [pcieDevicePath, asyncResp{asyncResp}]( |
| 359 | const boost::system::error_code& ec, |
| 360 | const dbus::utility::DBusPropertiesMap& assetList) { |
SunnySrivastava1984 | 913e773 | 2021-01-27 06:23:24 -0600 | [diff] [blame] | 361 | if (ec) |
| 362 | { |
| 363 | if (ec.value() != EBADR) |
| 364 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 365 | BMCWEB_LOG_ERROR("DBUS response error for Properties{}", |
| 366 | ec.value()); |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 367 | messages::internalError(asyncResp->res); |
SunnySrivastava1984 | 913e773 | 2021-01-27 06:23:24 -0600 | [diff] [blame] | 368 | } |
| 369 | return; |
| 370 | } |
| 371 | |
| 372 | const std::string* manufacturer = nullptr; |
| 373 | const std::string* model = nullptr; |
| 374 | const std::string* partNumber = nullptr; |
| 375 | const std::string* serialNumber = nullptr; |
| 376 | const std::string* sparePartNumber = nullptr; |
| 377 | |
| 378 | const bool success = sdbusplus::unpackPropertiesNoThrow( |
| 379 | dbus_utils::UnpackErrorPrinter(), assetList, "Manufacturer", |
| 380 | manufacturer, "Model", model, "PartNumber", partNumber, |
| 381 | "SerialNumber", serialNumber, "SparePartNumber", sparePartNumber); |
| 382 | |
| 383 | if (!success) |
| 384 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 385 | messages::internalError(asyncResp->res); |
SunnySrivastava1984 | 913e773 | 2021-01-27 06:23:24 -0600 | [diff] [blame] | 386 | return; |
| 387 | } |
| 388 | |
| 389 | if (manufacturer != nullptr) |
| 390 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 391 | asyncResp->res.jsonValue["Manufacturer"] = *manufacturer; |
SunnySrivastava1984 | 913e773 | 2021-01-27 06:23:24 -0600 | [diff] [blame] | 392 | } |
| 393 | if (model != nullptr) |
| 394 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 395 | asyncResp->res.jsonValue["Model"] = *model; |
SunnySrivastava1984 | 913e773 | 2021-01-27 06:23:24 -0600 | [diff] [blame] | 396 | } |
| 397 | |
| 398 | if (partNumber != nullptr) |
| 399 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 400 | asyncResp->res.jsonValue["PartNumber"] = *partNumber; |
SunnySrivastava1984 | 913e773 | 2021-01-27 06:23:24 -0600 | [diff] [blame] | 401 | } |
| 402 | |
| 403 | if (serialNumber != nullptr) |
| 404 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 405 | asyncResp->res.jsonValue["SerialNumber"] = *serialNumber; |
SunnySrivastava1984 | 913e773 | 2021-01-27 06:23:24 -0600 | [diff] [blame] | 406 | } |
| 407 | |
| 408 | if (sparePartNumber != nullptr && !sparePartNumber->empty()) |
| 409 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 410 | asyncResp->res.jsonValue["SparePartNumber"] = *sparePartNumber; |
SunnySrivastava1984 | 913e773 | 2021-01-27 06:23:24 -0600 | [diff] [blame] | 411 | } |
Patrick Williams | 5a39f77 | 2023-10-20 11:20:21 -0500 | [diff] [blame] | 412 | }); |
SunnySrivastava1984 | 913e773 | 2021-01-27 06:23:24 -0600 | [diff] [blame] | 413 | } |
| 414 | |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 415 | inline void addPCIeDeviceProperties( |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 416 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 417 | const std::string& pcieDeviceId, |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 418 | const dbus::utility::DBusPropertiesMap& pcieDevProperties) |
| 419 | { |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 420 | const std::string* generationInUse = nullptr; |
Konstantin Aladyshev | 814bf20 | 2023-07-04 16:30:10 +0300 | [diff] [blame] | 421 | const std::string* generationSupported = nullptr; |
Konstantin Aladyshev | 9bb0a7f | 2023-07-04 12:59:34 +0300 | [diff] [blame] | 422 | const size_t* lanesInUse = nullptr; |
Konstantin Aladyshev | 814bf20 | 2023-07-04 16:30:10 +0300 | [diff] [blame] | 423 | const size_t* maxLanes = nullptr; |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 424 | |
| 425 | const bool success = sdbusplus::unpackPropertiesNoThrow( |
Ed Tanous | 609ba4c | 2023-07-11 09:14:24 -0700 | [diff] [blame] | 426 | dbus_utils::UnpackErrorPrinter(), pcieDevProperties, "GenerationInUse", |
| 427 | generationInUse, "GenerationSupported", generationSupported, |
| 428 | "LanesInUse", lanesInUse, "MaxLanes", maxLanes); |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 429 | |
| 430 | if (!success) |
| 431 | { |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 432 | messages::internalError(asyncResp->res); |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 433 | return; |
| 434 | } |
| 435 | |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 436 | if (generationInUse != nullptr) |
| 437 | { |
| 438 | std::optional<pcie_device::PCIeTypes> redfishGenerationInUse = |
Lakshmi Yadlapati | c49c329 | 2023-04-19 16:42:35 -0500 | [diff] [blame] | 439 | pcie_util::redfishPcieGenerationFromDbus(*generationInUse); |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 440 | |
| 441 | if (!redfishGenerationInUse) |
| 442 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 443 | BMCWEB_LOG_WARNING("Unknown PCIe Device Generation: {}", |
| 444 | *generationInUse); |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 445 | } |
Lakshmi Yadlapati | cf3b484 | 2023-06-27 02:36:53 -0500 | [diff] [blame] | 446 | else |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 447 | { |
Lakshmi Yadlapati | cf3b484 | 2023-06-27 02:36:53 -0500 | [diff] [blame] | 448 | if (*redfishGenerationInUse == pcie_device::PCIeTypes::Invalid) |
| 449 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 450 | BMCWEB_LOG_ERROR("Invalid PCIe Device Generation: {}", |
| 451 | *generationInUse); |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 452 | messages::internalError(asyncResp->res); |
Lakshmi Yadlapati | cf3b484 | 2023-06-27 02:36:53 -0500 | [diff] [blame] | 453 | return; |
| 454 | } |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 455 | asyncResp->res.jsonValue["PCIeInterface"]["PCIeType"] = |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 456 | *redfishGenerationInUse; |
| 457 | } |
| 458 | } |
| 459 | |
Konstantin Aladyshev | 814bf20 | 2023-07-04 16:30:10 +0300 | [diff] [blame] | 460 | if (generationSupported != nullptr) |
| 461 | { |
| 462 | std::optional<pcie_device::PCIeTypes> redfishGenerationSupported = |
| 463 | pcie_util::redfishPcieGenerationFromDbus(*generationSupported); |
| 464 | |
| 465 | if (!redfishGenerationSupported) |
| 466 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 467 | BMCWEB_LOG_WARNING("Unknown PCIe Device Generation: {}", |
| 468 | *generationSupported); |
Konstantin Aladyshev | 814bf20 | 2023-07-04 16:30:10 +0300 | [diff] [blame] | 469 | } |
| 470 | else |
| 471 | { |
| 472 | if (*redfishGenerationSupported == pcie_device::PCIeTypes::Invalid) |
| 473 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 474 | BMCWEB_LOG_ERROR("Invalid PCIe Device Generation: {}", |
| 475 | *generationSupported); |
Konstantin Aladyshev | 814bf20 | 2023-07-04 16:30:10 +0300 | [diff] [blame] | 476 | messages::internalError(asyncResp->res); |
| 477 | return; |
| 478 | } |
| 479 | asyncResp->res.jsonValue["PCIeInterface"]["MaxPCIeType"] = |
| 480 | *redfishGenerationSupported; |
| 481 | } |
| 482 | } |
| 483 | |
Myung Bae | 8c1d054 | 2024-03-12 17:50:48 -0500 | [diff] [blame^] | 484 | if (lanesInUse != nullptr) |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 485 | { |
Myung Bae | 8c1d054 | 2024-03-12 17:50:48 -0500 | [diff] [blame^] | 486 | if (*lanesInUse == std::numeric_limits<size_t>::max()) |
| 487 | { |
| 488 | // The default value of LanesInUse is "maxint", and the field will |
| 489 | // be null if it is a default value. |
| 490 | asyncResp->res.jsonValue["PCIeInterface"]["LanesInUse"] = nullptr; |
| 491 | } |
| 492 | else |
| 493 | { |
| 494 | asyncResp->res.jsonValue["PCIeInterface"]["LanesInUse"] = |
| 495 | *lanesInUse; |
| 496 | } |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 497 | } |
Konstantin Aladyshev | 814bf20 | 2023-07-04 16:30:10 +0300 | [diff] [blame] | 498 | // The default value of MaxLanes is 0, and the field will be |
| 499 | // left as off if it is a default value. |
| 500 | if (maxLanes != nullptr && *maxLanes != 0) |
| 501 | { |
| 502 | asyncResp->res.jsonValue["PCIeInterface"]["MaxLanes"] = *maxLanes; |
| 503 | } |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 504 | |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 505 | asyncResp->res.jsonValue["PCIeFunctions"]["@odata.id"] = |
| 506 | boost::urls::format( |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 507 | "/redfish/v1/Systems/{}/PCIeDevices/{}/PCIeFunctions", |
| 508 | BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId); |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 509 | } |
| 510 | |
| 511 | inline void getPCIeDeviceProperties( |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 512 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 513 | const std::string& pcieDevicePath, const std::string& service, |
| 514 | const std::function<void( |
| 515 | const dbus::utility::DBusPropertiesMap& pcieDevProperties)>&& callback) |
| 516 | { |
| 517 | sdbusplus::asio::getAllProperties( |
| 518 | *crow::connections::systemBus, service, pcieDevicePath, |
| 519 | "xyz.openbmc_project.Inventory.Item.PCIeDevice", |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 520 | [asyncResp, |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 521 | callback](const boost::system::error_code& ec, |
| 522 | const dbus::utility::DBusPropertiesMap& pcieDevProperties) { |
| 523 | if (ec) |
| 524 | { |
| 525 | if (ec.value() != EBADR) |
| 526 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 527 | BMCWEB_LOG_ERROR("DBUS response error for Properties"); |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 528 | messages::internalError(asyncResp->res); |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 529 | } |
| 530 | return; |
| 531 | } |
| 532 | callback(pcieDevProperties); |
Patrick Williams | 5a39f77 | 2023-10-20 11:20:21 -0500 | [diff] [blame] | 533 | }); |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 534 | } |
| 535 | |
| 536 | inline void addPCIeDeviceCommonProperties( |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 537 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 538 | const std::string& pcieDeviceId) |
| 539 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 540 | asyncResp->res.addHeader( |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 541 | boost::beast::http::field::link, |
| 542 | "</redfish/v1/JsonSchemas/PCIeDevice/PCIeDevice.json>; rel=describedby"); |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 543 | asyncResp->res.jsonValue["@odata.type"] = "#PCIeDevice.v1_9_0.PCIeDevice"; |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 544 | asyncResp->res.jsonValue["@odata.id"] = |
| 545 | boost::urls::format("/redfish/v1/Systems/{}/PCIeDevices/{}", |
| 546 | BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId); |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 547 | asyncResp->res.jsonValue["Name"] = "PCIe Device"; |
| 548 | asyncResp->res.jsonValue["Id"] = pcieDeviceId; |
| 549 | asyncResp->res.jsonValue["Status"]["State"] = "Enabled"; |
Lakshmi Yadlapati | e164f1b | 2023-04-12 17:01:34 -0500 | [diff] [blame] | 550 | asyncResp->res.jsonValue["Status"]["Health"] = "OK"; |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 551 | } |
| 552 | |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 553 | inline void afterGetValidPcieDevicePath( |
| 554 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 555 | const std::string& pcieDeviceId, const std::string& pcieDevicePath, |
| 556 | const std::string& service) |
| 557 | { |
| 558 | addPCIeDeviceCommonProperties(asyncResp, pcieDeviceId); |
| 559 | getPCIeDeviceAsset(asyncResp, pcieDevicePath, service); |
| 560 | getPCIeDeviceState(asyncResp, pcieDevicePath, service); |
| 561 | getPCIeDeviceHealth(asyncResp, pcieDevicePath, service); |
| 562 | getPCIeDeviceProperties( |
| 563 | asyncResp, pcieDevicePath, service, |
| 564 | std::bind_front(addPCIeDeviceProperties, asyncResp, pcieDeviceId)); |
| 565 | getPCIeDeviceSlotPath( |
| 566 | pcieDevicePath, asyncResp, |
| 567 | std::bind_front(afterGetPCIeDeviceSlotPath, asyncResp)); |
| 568 | } |
| 569 | |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 570 | inline void |
| 571 | handlePCIeDeviceGet(App& app, const crow::Request& req, |
| 572 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 573 | const std::string& systemName, |
| 574 | const std::string& pcieDeviceId) |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 575 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 576 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 577 | { |
| 578 | return; |
| 579 | } |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 580 | if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM) |
Ed Tanous | 7f3e84a | 2022-12-28 16:22:54 -0800 | [diff] [blame] | 581 | { |
| 582 | // Option currently returns no systems. TBD |
| 583 | messages::resourceNotFound(asyncResp->res, "ComputerSystem", |
| 584 | systemName); |
| 585 | return; |
| 586 | } |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 587 | if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME) |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 588 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 589 | messages::resourceNotFound(asyncResp->res, "ComputerSystem", |
| 590 | systemName); |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 591 | return; |
| 592 | } |
| 593 | |
| 594 | getValidPCIeDevicePath( |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 595 | pcieDeviceId, asyncResp, |
Lakshmi Yadlapati | a540999 | 2023-04-20 16:53:59 -0500 | [diff] [blame] | 596 | std::bind_front(afterGetValidPcieDevicePath, asyncResp, pcieDeviceId)); |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 597 | } |
| 598 | |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 599 | inline void requestRoutesSystemPCIeDevice(App& app) |
Jason M. Bills | f5c9f8b | 2018-12-18 16:51:18 -0800 | [diff] [blame] | 600 | { |
Ed Tanous | 22d268c | 2022-05-19 09:39:07 -0700 | [diff] [blame] | 601 | BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/PCIeDevices/<str>/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 602 | .privileges(redfish::privileges::getPCIeDevice) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 603 | .methods(boost::beast::http::verb::get)( |
Lakshmi Yadlapati | 543f9a7 | 2023-03-10 17:06:05 -0600 | [diff] [blame] | 604 | std::bind_front(handlePCIeDeviceGet, std::ref(app))); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 605 | } |
| 606 | |
Lakshmi Yadlapati | 35ad613 | 2023-03-10 22:31:49 -0600 | [diff] [blame] | 607 | inline void addPCIeFunctionList( |
| 608 | crow::Response& res, const std::string& pcieDeviceId, |
| 609 | const dbus::utility::DBusPropertiesMap& pcieDevProperties) |
| 610 | { |
| 611 | nlohmann::json& pcieFunctionList = res.jsonValue["Members"]; |
| 612 | pcieFunctionList = nlohmann::json::array(); |
| 613 | static constexpr const int maxPciFunctionNum = 8; |
| 614 | |
| 615 | for (int functionNum = 0; functionNum < maxPciFunctionNum; functionNum++) |
| 616 | { |
| 617 | // Check if this function exists by |
| 618 | // looking for a device ID |
Patrick Williams | 89492a1 | 2023-05-10 07:51:34 -0500 | [diff] [blame] | 619 | std::string devIDProperty = "Function" + std::to_string(functionNum) + |
| 620 | "DeviceId"; |
Lakshmi Yadlapati | 35ad613 | 2023-03-10 22:31:49 -0600 | [diff] [blame] | 621 | const std::string* property = nullptr; |
| 622 | for (const auto& propEntry : pcieDevProperties) |
| 623 | { |
| 624 | if (propEntry.first == devIDProperty) |
| 625 | { |
| 626 | property = std::get_if<std::string>(&propEntry.second); |
| 627 | break; |
| 628 | } |
| 629 | } |
| 630 | if (property == nullptr || property->empty()) |
| 631 | { |
| 632 | continue; |
| 633 | } |
| 634 | |
| 635 | nlohmann::json::object_t pcieFunction; |
Ed Tanous | ef4c65b | 2023-04-24 15:28:50 -0700 | [diff] [blame] | 636 | pcieFunction["@odata.id"] = boost::urls::format( |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 637 | "/redfish/v1/Systems/{}/PCIeDevices/{}/PCIeFunctions/{}", |
| 638 | BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId, |
| 639 | std::to_string(functionNum)); |
Patrick Williams | b2ba307 | 2023-05-12 10:27:39 -0500 | [diff] [blame] | 640 | pcieFunctionList.emplace_back(std::move(pcieFunction)); |
Lakshmi Yadlapati | 35ad613 | 2023-03-10 22:31:49 -0600 | [diff] [blame] | 641 | } |
| 642 | res.jsonValue["PCIeFunctions@odata.count"] = pcieFunctionList.size(); |
| 643 | } |
| 644 | |
| 645 | inline void handlePCIeFunctionCollectionGet( |
| 646 | App& app, const crow::Request& req, |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 647 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
Ed Tanous | 7f3e84a | 2022-12-28 16:22:54 -0800 | [diff] [blame] | 648 | const std::string& systemName, const std::string& pcieDeviceId) |
Lakshmi Yadlapati | 35ad613 | 2023-03-10 22:31:49 -0600 | [diff] [blame] | 649 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 650 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
Lakshmi Yadlapati | 35ad613 | 2023-03-10 22:31:49 -0600 | [diff] [blame] | 651 | { |
| 652 | return; |
| 653 | } |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 654 | if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM) |
Ed Tanous | 7f3e84a | 2022-12-28 16:22:54 -0800 | [diff] [blame] | 655 | { |
| 656 | // Option currently returns no systems. TBD |
| 657 | messages::resourceNotFound(asyncResp->res, "ComputerSystem", |
| 658 | systemName); |
| 659 | return; |
| 660 | } |
Lakshmi Yadlapati | 35ad613 | 2023-03-10 22:31:49 -0600 | [diff] [blame] | 661 | |
| 662 | getValidPCIeDevicePath( |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 663 | pcieDeviceId, asyncResp, |
| 664 | [asyncResp, pcieDeviceId](const std::string& pcieDevicePath, |
| 665 | const std::string& service) { |
| 666 | asyncResp->res.addHeader( |
Lakshmi Yadlapati | 35ad613 | 2023-03-10 22:31:49 -0600 | [diff] [blame] | 667 | boost::beast::http::field::link, |
| 668 | "</redfish/v1/JsonSchemas/PCIeFunctionCollection/PCIeFunctionCollection.json>; rel=describedby"); |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 669 | asyncResp->res.jsonValue["@odata.type"] = |
Lakshmi Yadlapati | 35ad613 | 2023-03-10 22:31:49 -0600 | [diff] [blame] | 670 | "#PCIeFunctionCollection.PCIeFunctionCollection"; |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 671 | asyncResp->res.jsonValue["@odata.id"] = boost::urls::format( |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 672 | "/redfish/v1/Systems/{}/PCIeDevices/{}/PCIeFunctions", |
| 673 | BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId); |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 674 | asyncResp->res.jsonValue["Name"] = "PCIe Function Collection"; |
| 675 | asyncResp->res.jsonValue["Description"] = |
Lakshmi Yadlapati | 35ad613 | 2023-03-10 22:31:49 -0600 | [diff] [blame] | 676 | "Collection of PCIe Functions for PCIe Device " + pcieDeviceId; |
| 677 | getPCIeDeviceProperties( |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 678 | asyncResp, pcieDevicePath, service, |
| 679 | [asyncResp, pcieDeviceId]( |
Lakshmi Yadlapati | 35ad613 | 2023-03-10 22:31:49 -0600 | [diff] [blame] | 680 | const dbus::utility::DBusPropertiesMap& pcieDevProperties) { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 681 | addPCIeFunctionList(asyncResp->res, pcieDeviceId, |
| 682 | pcieDevProperties); |
Lakshmi Yadlapati | 35ad613 | 2023-03-10 22:31:49 -0600 | [diff] [blame] | 683 | }); |
Patrick Williams | 5a39f77 | 2023-10-20 11:20:21 -0500 | [diff] [blame] | 684 | }); |
Lakshmi Yadlapati | 35ad613 | 2023-03-10 22:31:49 -0600 | [diff] [blame] | 685 | } |
| 686 | |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 687 | inline void requestRoutesSystemPCIeFunctionCollection(App& app) |
| 688 | { |
| 689 | /** |
| 690 | * Functions triggers appropriate requests on DBus |
| 691 | */ |
| 692 | BMCWEB_ROUTE(app, |
Ed Tanous | 7f3e84a | 2022-12-28 16:22:54 -0800 | [diff] [blame] | 693 | "/redfish/v1/Systems/<str>/PCIeDevices/<str>/PCIeFunctions/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 694 | .privileges(redfish::privileges::getPCIeFunctionCollection) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 695 | .methods(boost::beast::http::verb::get)( |
Lakshmi Yadlapati | 35ad613 | 2023-03-10 22:31:49 -0600 | [diff] [blame] | 696 | std::bind_front(handlePCIeFunctionCollectionGet, std::ref(app))); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 697 | } |
| 698 | |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 699 | inline bool validatePCIeFunctionId( |
Myung Bae | d5e74b8 | 2023-05-31 11:28:02 -0500 | [diff] [blame] | 700 | uint64_t pcieFunctionId, |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 701 | const dbus::utility::DBusPropertiesMap& pcieDevProperties) |
| 702 | { |
Myung Bae | d5e74b8 | 2023-05-31 11:28:02 -0500 | [diff] [blame] | 703 | std::string functionName = "Function" + std::to_string(pcieFunctionId); |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 704 | std::string devIDProperty = functionName + "DeviceId"; |
| 705 | |
| 706 | const std::string* devIdProperty = nullptr; |
| 707 | for (const auto& property : pcieDevProperties) |
| 708 | { |
| 709 | if (property.first == devIDProperty) |
| 710 | { |
| 711 | devIdProperty = std::get_if<std::string>(&property.second); |
| 712 | break; |
| 713 | } |
| 714 | } |
| 715 | return (devIdProperty != nullptr && !devIdProperty->empty()); |
| 716 | } |
| 717 | |
| 718 | inline void addPCIeFunctionProperties( |
Ed Tanous | e14742c | 2023-05-31 10:27:49 -0700 | [diff] [blame] | 719 | crow::Response& resp, uint64_t pcieFunctionId, |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 720 | const dbus::utility::DBusPropertiesMap& pcieDevProperties) |
| 721 | { |
Ed Tanous | e14742c | 2023-05-31 10:27:49 -0700 | [diff] [blame] | 722 | std::string functionName = "Function" + std::to_string(pcieFunctionId); |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 723 | for (const auto& property : pcieDevProperties) |
| 724 | { |
| 725 | const std::string* strProperty = |
| 726 | std::get_if<std::string>(&property.second); |
Ed Tanous | dc8cfa6 | 2024-04-07 13:37:25 -0700 | [diff] [blame] | 727 | if (strProperty == nullptr) |
| 728 | { |
| 729 | BMCWEB_LOG_ERROR("Function wasn't a string?"); |
| 730 | continue; |
| 731 | } |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 732 | if (property.first == functionName + "DeviceId") |
| 733 | { |
| 734 | resp.jsonValue["DeviceId"] = *strProperty; |
| 735 | } |
| 736 | if (property.first == functionName + "VendorId") |
| 737 | { |
| 738 | resp.jsonValue["VendorId"] = *strProperty; |
| 739 | } |
| 740 | // TODO: FunctionType and DeviceClass are Redfish enums. The D-Bus |
| 741 | // property strings should be mapped correctly to ensure these |
| 742 | // strings are Redfish enum values. For now just check for empty. |
| 743 | if (property.first == functionName + "FunctionType") |
| 744 | { |
| 745 | if (!strProperty->empty()) |
| 746 | { |
| 747 | resp.jsonValue["FunctionType"] = *strProperty; |
| 748 | } |
| 749 | } |
| 750 | if (property.first == functionName + "DeviceClass") |
| 751 | { |
| 752 | if (!strProperty->empty()) |
| 753 | { |
| 754 | resp.jsonValue["DeviceClass"] = *strProperty; |
| 755 | } |
| 756 | } |
| 757 | if (property.first == functionName + "ClassCode") |
| 758 | { |
| 759 | resp.jsonValue["ClassCode"] = *strProperty; |
| 760 | } |
| 761 | if (property.first == functionName + "RevisionId") |
| 762 | { |
| 763 | resp.jsonValue["RevisionId"] = *strProperty; |
| 764 | } |
| 765 | if (property.first == functionName + "SubsystemId") |
| 766 | { |
| 767 | resp.jsonValue["SubsystemId"] = *strProperty; |
| 768 | } |
| 769 | if (property.first == functionName + "SubsystemVendorId") |
| 770 | { |
| 771 | resp.jsonValue["SubsystemVendorId"] = *strProperty; |
| 772 | } |
| 773 | } |
| 774 | } |
| 775 | |
| 776 | inline void addPCIeFunctionCommonProperties(crow::Response& resp, |
| 777 | const std::string& pcieDeviceId, |
Ed Tanous | e14742c | 2023-05-31 10:27:49 -0700 | [diff] [blame] | 778 | uint64_t pcieFunctionId) |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 779 | { |
| 780 | resp.addHeader( |
| 781 | boost::beast::http::field::link, |
| 782 | "</redfish/v1/JsonSchemas/PCIeFunction/PCIeFunction.json>; rel=describedby"); |
| 783 | resp.jsonValue["@odata.type"] = "#PCIeFunction.v1_2_3.PCIeFunction"; |
Ed Tanous | ef4c65b | 2023-04-24 15:28:50 -0700 | [diff] [blame] | 784 | resp.jsonValue["@odata.id"] = boost::urls::format( |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 785 | "/redfish/v1/Systems/{}/PCIeDevices/{}/PCIeFunctions/{}", |
| 786 | BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId, |
| 787 | std::to_string(pcieFunctionId)); |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 788 | resp.jsonValue["Name"] = "PCIe Function"; |
Ed Tanous | e14742c | 2023-05-31 10:27:49 -0700 | [diff] [blame] | 789 | resp.jsonValue["Id"] = std::to_string(pcieFunctionId); |
| 790 | resp.jsonValue["FunctionId"] = pcieFunctionId; |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 791 | resp.jsonValue["Links"]["PCIeDevice"]["@odata.id"] = |
| 792 | boost::urls::format("/redfish/v1/Systems/{}/PCIeDevices/{}", |
| 793 | BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId); |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 794 | } |
| 795 | |
| 796 | inline void |
| 797 | handlePCIeFunctionGet(App& app, const crow::Request& req, |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 798 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
Ed Tanous | 7f3e84a | 2022-12-28 16:22:54 -0800 | [diff] [blame] | 799 | const std::string& systemName, |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 800 | const std::string& pcieDeviceId, |
Ed Tanous | e14742c | 2023-05-31 10:27:49 -0700 | [diff] [blame] | 801 | const std::string& pcieFunctionIdStr) |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 802 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 803 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 804 | { |
| 805 | return; |
| 806 | } |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 807 | if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM) |
Ed Tanous | 7f3e84a | 2022-12-28 16:22:54 -0800 | [diff] [blame] | 808 | { |
| 809 | // Option currently returns no systems. TBD |
| 810 | messages::resourceNotFound(asyncResp->res, "ComputerSystem", |
| 811 | systemName); |
| 812 | return; |
| 813 | } |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 814 | if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME) |
Ed Tanous | 7f3e84a | 2022-12-28 16:22:54 -0800 | [diff] [blame] | 815 | { |
| 816 | messages::resourceNotFound(asyncResp->res, "ComputerSystem", |
| 817 | systemName); |
| 818 | return; |
| 819 | } |
Ed Tanous | dc8cfa6 | 2024-04-07 13:37:25 -0700 | [diff] [blame] | 820 | std::string_view pcieFunctionIdView = pcieFunctionIdStr; |
Ed Tanous | 7f3e84a | 2022-12-28 16:22:54 -0800 | [diff] [blame] | 821 | |
Ed Tanous | e14742c | 2023-05-31 10:27:49 -0700 | [diff] [blame] | 822 | uint64_t pcieFunctionId = 0; |
| 823 | std::from_chars_result result = std::from_chars( |
Ed Tanous | dc8cfa6 | 2024-04-07 13:37:25 -0700 | [diff] [blame] | 824 | pcieFunctionIdView.begin(), pcieFunctionIdView.end(), pcieFunctionId); |
| 825 | if (result.ec != std::errc{} || result.ptr != pcieFunctionIdView.end()) |
Ed Tanous | e14742c | 2023-05-31 10:27:49 -0700 | [diff] [blame] | 826 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 827 | messages::resourceNotFound(asyncResp->res, "PCIeFunction", |
Ed Tanous | e14742c | 2023-05-31 10:27:49 -0700 | [diff] [blame] | 828 | pcieFunctionIdStr); |
| 829 | return; |
| 830 | } |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 831 | |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 832 | getValidPCIeDevicePath(pcieDeviceId, asyncResp, |
| 833 | [asyncResp, pcieDeviceId, |
| 834 | pcieFunctionId](const std::string& pcieDevicePath, |
| 835 | const std::string& service) { |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 836 | getPCIeDeviceProperties( |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 837 | asyncResp, pcieDevicePath, service, |
| 838 | [asyncResp, pcieDeviceId, pcieFunctionId]( |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 839 | const dbus::utility::DBusPropertiesMap& pcieDevProperties) { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 840 | addPCIeFunctionCommonProperties(asyncResp->res, pcieDeviceId, |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 841 | pcieFunctionId); |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 842 | addPCIeFunctionProperties(asyncResp->res, pcieFunctionId, |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 843 | pcieDevProperties); |
Patrick Williams | 5a39f77 | 2023-10-20 11:20:21 -0500 | [diff] [blame] | 844 | }); |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 845 | }); |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 846 | } |
| 847 | |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 848 | inline void requestRoutesSystemPCIeFunction(App& app) |
| 849 | { |
| 850 | BMCWEB_ROUTE( |
Ed Tanous | 7f3e84a | 2022-12-28 16:22:54 -0800 | [diff] [blame] | 851 | app, "/redfish/v1/Systems/<str>/PCIeDevices/<str>/PCIeFunctions/<str>/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 852 | .privileges(redfish::privileges::getPCIeFunction) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 853 | .methods(boost::beast::http::verb::get)( |
Lakshmi Yadlapati | 727a046 | 2023-03-10 23:49:00 -0600 | [diff] [blame] | 854 | std::bind_front(handlePCIeFunctionGet, std::ref(app))); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 855 | } |
Jason M. Bills | f5c9f8b | 2018-12-18 16:51:18 -0800 | [diff] [blame] | 856 | |
| 857 | } // namespace redfish |