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