Ed Tanous | 40e9b92 | 2024-09-10 13:50:16 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // SPDX-FileCopyrightText: Copyright OpenBMC Authors |
| 3 | // SPDX-FileCopyrightText: Copyright 2018 Intel Corporation |
Rapkiewicz, Pawel | 443c293 | 2018-10-22 15:08:49 +0200 | [diff] [blame] | 4 | #pragma once |
| 5 | |
Willy Tu | 13451e3 | 2023-05-24 16:08:18 -0700 | [diff] [blame] | 6 | #include "bmcweb_config.h" |
| 7 | |
Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 8 | #include "app.hpp" |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 9 | #include "async_resp.hpp" |
Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 10 | #include "dbus_utility.hpp" |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 11 | #include "error_messages.hpp" |
Ed Tanous | 539d8c6 | 2024-06-19 14:38:27 -0700 | [diff] [blame] | 12 | #include "generated/enums/memory.hpp" |
| 13 | #include "generated/enums/resource.hpp" |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 14 | #include "http_request.hpp" |
| 15 | #include "logging.hpp" |
Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 16 | #include "query.hpp" |
| 17 | #include "registries/privilege_registry.hpp" |
| 18 | #include "utils/collection.hpp" |
| 19 | #include "utils/dbus_utils.hpp" |
| 20 | #include "utils/hex_utils.hpp" |
James Feist | 35e257a | 2020-06-05 13:30:51 -0700 | [diff] [blame] | 21 | |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 22 | #include <boost/beast/http/verb.hpp> |
George Liu | e99073f | 2022-12-09 11:06:16 +0800 | [diff] [blame] | 23 | #include <boost/system/error_code.hpp> |
Ed Tanous | ef4c65b | 2023-04-24 15:28:50 -0700 | [diff] [blame] | 24 | #include <boost/url/format.hpp> |
Nan Zhou | d7f04fd | 2022-05-01 01:11:07 +0000 | [diff] [blame] | 25 | #include <nlohmann/json.hpp> |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 26 | #include <sdbusplus/message/native_types.hpp> |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 27 | #include <sdbusplus/unpack_properties.hpp> |
Rapkiewicz, Pawel | 443c293 | 2018-10-22 15:08:49 +0200 | [diff] [blame] | 28 | |
George Liu | 7a1dbc4 | 2022-12-07 16:03:22 +0800 | [diff] [blame] | 29 | #include <array> |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 30 | #include <cstddef> |
| 31 | #include <cstdint> |
| 32 | #include <memory> |
| 33 | #include <string> |
George Liu | 7a1dbc4 | 2022-12-07 16:03:22 +0800 | [diff] [blame] | 34 | #include <string_view> |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 35 | #include <utility> |
| 36 | #include <vector> |
George Liu | 7a1dbc4 | 2022-12-07 16:03:22 +0800 | [diff] [blame] | 37 | |
Rapkiewicz, Pawel | 443c293 | 2018-10-22 15:08:49 +0200 | [diff] [blame] | 38 | namespace redfish |
| 39 | { |
| 40 | |
Gunnar Mills | 313efb1 | 2020-10-26 16:05:08 -0500 | [diff] [blame] | 41 | inline std::string translateMemoryTypeToRedfish(const std::string& memoryType) |
| 42 | { |
| 43 | if (memoryType == "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.DDR") |
| 44 | { |
| 45 | return "DDR"; |
| 46 | } |
| 47 | if (memoryType == "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.DDR2") |
| 48 | { |
| 49 | return "DDR2"; |
| 50 | } |
| 51 | if (memoryType == "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.DDR3") |
| 52 | { |
| 53 | return "DDR3"; |
| 54 | } |
| 55 | if (memoryType == "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.DDR4") |
| 56 | { |
| 57 | return "DDR4"; |
| 58 | } |
| 59 | if (memoryType == |
| 60 | "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.DDR4E_SDRAM") |
| 61 | { |
| 62 | return "DDR4E_SDRAM"; |
| 63 | } |
Mansi Joshi | 11a2f0f | 2021-07-19 14:33:27 +0530 | [diff] [blame] | 64 | if (memoryType == "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.DDR5") |
| 65 | { |
| 66 | return "DDR5"; |
| 67 | } |
Gunnar Mills | 313efb1 | 2020-10-26 16:05:08 -0500 | [diff] [blame] | 68 | if (memoryType == |
| 69 | "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.LPDDR4_SDRAM") |
| 70 | { |
| 71 | return "LPDDR4_SDRAM"; |
| 72 | } |
| 73 | if (memoryType == |
| 74 | "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.LPDDR3_SDRAM") |
| 75 | { |
| 76 | return "LPDDR3_SDRAM"; |
| 77 | } |
| 78 | if (memoryType == |
| 79 | "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.DDR2_SDRAM_FB_DIMM") |
| 80 | { |
| 81 | return "DDR2_SDRAM_FB_DIMM"; |
| 82 | } |
George Liu | 0fda0f1 | 2021-11-16 10:06:17 +0800 | [diff] [blame] | 83 | if (memoryType == |
| 84 | "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.DDR2_SDRAM_FB_DIMM_PROB") |
Gunnar Mills | 313efb1 | 2020-10-26 16:05:08 -0500 | [diff] [blame] | 85 | { |
| 86 | return "DDR2_SDRAM_FB_DIMM_PROBE"; |
| 87 | } |
| 88 | if (memoryType == |
| 89 | "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.DDR_SGRAM") |
| 90 | { |
| 91 | return "DDR_SGRAM"; |
| 92 | } |
| 93 | if (memoryType == "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.ROM") |
| 94 | { |
| 95 | return "ROM"; |
| 96 | } |
| 97 | if (memoryType == |
| 98 | "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.SDRAM") |
| 99 | { |
| 100 | return "SDRAM"; |
| 101 | } |
| 102 | if (memoryType == "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.EDO") |
| 103 | { |
| 104 | return "EDO"; |
| 105 | } |
| 106 | if (memoryType == |
| 107 | "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.FastPageMode") |
| 108 | { |
| 109 | return "FastPageMode"; |
| 110 | } |
| 111 | if (memoryType == |
| 112 | "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.PipelinedNibble") |
| 113 | { |
| 114 | return "PipelinedNibble"; |
| 115 | } |
| 116 | if (memoryType == |
| 117 | "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.Logical") |
| 118 | { |
| 119 | return "Logical"; |
| 120 | } |
| 121 | if (memoryType == "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.HBM") |
| 122 | { |
| 123 | return "HBM"; |
| 124 | } |
| 125 | if (memoryType == "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.HBM2") |
| 126 | { |
| 127 | return "HBM2"; |
| 128 | } |
Tyson Tuckerbear | ce34d51 | 2022-09-13 16:26:15 -0700 | [diff] [blame] | 129 | if (memoryType == "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.HBM3") |
| 130 | { |
| 131 | return "HBM3"; |
| 132 | } |
Gunnar Mills | 313efb1 | 2020-10-26 16:05:08 -0500 | [diff] [blame] | 133 | // This is values like Other or Unknown |
| 134 | // Also D-Bus values: |
| 135 | // DRAM |
| 136 | // EDRAM |
| 137 | // VRAM |
| 138 | // SRAM |
| 139 | // RAM |
| 140 | // FLASH |
| 141 | // EEPROM |
| 142 | // FEPROM |
| 143 | // EPROM |
| 144 | // CDRAM |
| 145 | // ThreeDRAM |
| 146 | // RDRAM |
| 147 | // FBD2 |
| 148 | // LPDDR_SDRAM |
| 149 | // LPDDR2_SDRAM |
Mansi Joshi | 11a2f0f | 2021-07-19 14:33:27 +0530 | [diff] [blame] | 150 | // LPDDR5_SDRAM |
Gunnar Mills | 313efb1 | 2020-10-26 16:05:08 -0500 | [diff] [blame] | 151 | return ""; |
| 152 | } |
| 153 | |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 154 | inline void dimmPropToHex(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 155 | const char* key, const uint16_t* value, |
| 156 | const nlohmann::json::json_pointer& jsonPtr) |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 157 | { |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 158 | if (value == nullptr) |
| 159 | { |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 160 | return; |
| 161 | } |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 162 | asyncResp->res.jsonValue[jsonPtr][key] = "0x" + intToHexString(*value, 4); |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 163 | } |
| 164 | |
zhanghch05 | 8d1b46d | 2021-04-01 11:18:24 +0800 | [diff] [blame] | 165 | inline void getPersistentMemoryProperties( |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 166 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 167 | const dbus::utility::DBusPropertiesMap& properties, |
Nan Zhou | d7f04fd | 2022-05-01 01:11:07 +0000 | [diff] [blame] | 168 | const nlohmann::json::json_pointer& jsonPtr) |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 169 | { |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 170 | const uint16_t* moduleManufacturerID = nullptr; |
| 171 | const uint16_t* moduleProductID = nullptr; |
| 172 | const uint16_t* subsystemVendorID = nullptr; |
| 173 | const uint16_t* subsystemDeviceID = nullptr; |
| 174 | const uint64_t* volatileRegionSizeLimitInKiB = nullptr; |
| 175 | const uint64_t* pmRegionSizeLimitInKiB = nullptr; |
| 176 | const uint64_t* volatileSizeInKiB = nullptr; |
| 177 | const uint64_t* pmSizeInKiB = nullptr; |
| 178 | const uint64_t* cacheSizeInKB = nullptr; |
| 179 | const uint64_t* voltaileRegionMaxSizeInKib = nullptr; |
| 180 | const uint64_t* pmRegionMaxSizeInKiB = nullptr; |
| 181 | const uint64_t* allocationIncrementInKiB = nullptr; |
| 182 | const uint64_t* allocationAlignmentInKiB = nullptr; |
| 183 | const uint64_t* volatileRegionNumberLimit = nullptr; |
| 184 | const uint64_t* pmRegionNumberLimit = nullptr; |
| 185 | const uint64_t* spareDeviceCount = nullptr; |
| 186 | const bool* isSpareDeviceInUse = nullptr; |
| 187 | const bool* isRankSpareEnabled = nullptr; |
| 188 | const std::vector<uint32_t>* maxAveragePowerLimitmW = nullptr; |
| 189 | const bool* configurationLocked = nullptr; |
| 190 | const std::string* allowedMemoryModes = nullptr; |
| 191 | const std::string* memoryMedia = nullptr; |
| 192 | const bool* configurationLockCapable = nullptr; |
| 193 | const bool* dataLockCapable = nullptr; |
| 194 | const bool* passphraseCapable = nullptr; |
| 195 | const uint64_t* maxPassphraseCount = nullptr; |
| 196 | const uint64_t* passphraseLockLimit = nullptr; |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 197 | |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 198 | const bool success = sdbusplus::unpackPropertiesNoThrow( |
| 199 | dbus_utils::UnpackErrorPrinter(), properties, "ModuleManufacturerID", |
| 200 | moduleManufacturerID, "ModuleProductID", moduleProductID, |
| 201 | "SubsystemVendorID", subsystemVendorID, "SubsystemDeviceID", |
| 202 | subsystemDeviceID, "VolatileRegionSizeLimitInKiB", |
| 203 | volatileRegionSizeLimitInKiB, "PmRegionSizeLimitInKiB", |
| 204 | pmRegionSizeLimitInKiB, "VolatileSizeInKiB", volatileSizeInKiB, |
| 205 | "PmSizeInKiB", pmSizeInKiB, "CacheSizeInKB", cacheSizeInKB, |
| 206 | "VoltaileRegionMaxSizeInKib", voltaileRegionMaxSizeInKib, |
| 207 | "PmRegionMaxSizeInKiB", pmRegionMaxSizeInKiB, |
| 208 | "AllocationIncrementInKiB", allocationIncrementInKiB, |
| 209 | "AllocationAlignmentInKiB", allocationAlignmentInKiB, |
| 210 | "VolatileRegionNumberLimit", volatileRegionNumberLimit, |
| 211 | "PmRegionNumberLimit", pmRegionNumberLimit, "SpareDeviceCount", |
| 212 | spareDeviceCount, "IsSpareDeviceInUse", isSpareDeviceInUse, |
| 213 | "IsRankSpareEnabled", isRankSpareEnabled, "MaxAveragePowerLimitmW", |
| 214 | maxAveragePowerLimitmW, "ConfigurationLocked", configurationLocked, |
| 215 | "AllowedMemoryModes", allowedMemoryModes, "MemoryMedia", memoryMedia, |
| 216 | "ConfigurationLockCapable", configurationLockCapable, "DataLockCapable", |
| 217 | dataLockCapable, "PassphraseCapable", passphraseCapable, |
| 218 | "MaxPassphraseCount", maxPassphraseCount, "PassphraseLockLimit", |
| 219 | passphraseLockLimit); |
| 220 | |
| 221 | if (!success) |
| 222 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 223 | messages::internalError(asyncResp->res); |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 224 | return; |
| 225 | } |
| 226 | |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 227 | dimmPropToHex(asyncResp, "ModuleManufacturerID", moduleManufacturerID, |
| 228 | jsonPtr); |
| 229 | dimmPropToHex(asyncResp, "ModuleProductID", moduleProductID, jsonPtr); |
| 230 | dimmPropToHex(asyncResp, "MemorySubsystemControllerManufacturerID", |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 231 | subsystemVendorID, jsonPtr); |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 232 | dimmPropToHex(asyncResp, "MemorySubsystemControllerProductID", |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 233 | subsystemDeviceID, jsonPtr); |
| 234 | |
| 235 | if (volatileRegionSizeLimitInKiB != nullptr) |
| 236 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 237 | asyncResp->res.jsonValue[jsonPtr]["VolatileRegionSizeLimitMiB"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 238 | (*volatileRegionSizeLimitInKiB) >> 10; |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 239 | } |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 240 | |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 241 | if (pmRegionSizeLimitInKiB != nullptr) |
| 242 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 243 | asyncResp->res.jsonValue[jsonPtr]["PersistentRegionSizeLimitMiB"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 244 | (*pmRegionSizeLimitInKiB) >> 10; |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 245 | } |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 246 | |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 247 | if (volatileSizeInKiB != nullptr) |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 248 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 249 | asyncResp->res.jsonValue[jsonPtr]["VolatileSizeMiB"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 250 | (*volatileSizeInKiB) >> 10; |
| 251 | } |
| 252 | |
| 253 | if (pmSizeInKiB != nullptr) |
| 254 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 255 | asyncResp->res.jsonValue[jsonPtr]["NonVolatileSizeMiB"] = |
| 256 | (*pmSizeInKiB) >> 10; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | if (cacheSizeInKB != nullptr) |
| 260 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 261 | asyncResp->res.jsonValue[jsonPtr]["CacheSizeMiB"] = |
| 262 | (*cacheSizeInKB >> 10); |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | if (voltaileRegionMaxSizeInKib != nullptr) |
| 266 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 267 | asyncResp->res.jsonValue[jsonPtr]["VolatileRegionSizeMaxMiB"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 268 | (*voltaileRegionMaxSizeInKib) >> 10; |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 269 | } |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 270 | |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 271 | if (pmRegionMaxSizeInKiB != nullptr) |
| 272 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 273 | asyncResp->res.jsonValue[jsonPtr]["PersistentRegionSizeMaxMiB"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 274 | (*pmRegionMaxSizeInKiB) >> 10; |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 275 | } |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 276 | |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 277 | if (allocationIncrementInKiB != nullptr) |
| 278 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 279 | asyncResp->res.jsonValue[jsonPtr]["AllocationIncrementMiB"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 280 | (*allocationIncrementInKiB) >> 10; |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 281 | } |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 282 | |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 283 | if (allocationAlignmentInKiB != nullptr) |
| 284 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 285 | asyncResp->res.jsonValue[jsonPtr]["AllocationAlignmentMiB"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 286 | (*allocationAlignmentInKiB) >> 10; |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 287 | } |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 288 | |
| 289 | if (volatileRegionNumberLimit != nullptr) |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 290 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 291 | asyncResp->res.jsonValue[jsonPtr]["VolatileRegionNumberLimit"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 292 | *volatileRegionNumberLimit; |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 293 | } |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 294 | |
| 295 | if (pmRegionNumberLimit != nullptr) |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 296 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 297 | asyncResp->res.jsonValue[jsonPtr]["PersistentRegionNumberLimit"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 298 | *pmRegionNumberLimit; |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 299 | } |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 300 | |
| 301 | if (spareDeviceCount != nullptr) |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 302 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 303 | asyncResp->res.jsonValue[jsonPtr]["SpareDeviceCount"] = |
| 304 | *spareDeviceCount; |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 305 | } |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 306 | |
| 307 | if (isSpareDeviceInUse != nullptr) |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 308 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 309 | asyncResp->res.jsonValue[jsonPtr]["IsSpareDeviceEnabled"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 310 | *isSpareDeviceInUse; |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 311 | } |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 312 | |
| 313 | if (isRankSpareEnabled != nullptr) |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 314 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 315 | asyncResp->res.jsonValue[jsonPtr]["IsRankSpareEnabled"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 316 | *isRankSpareEnabled; |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 317 | } |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 318 | |
| 319 | if (maxAveragePowerLimitmW != nullptr) |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 320 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 321 | asyncResp->res.jsonValue[jsonPtr]["MaxTDPMilliWatts"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 322 | *maxAveragePowerLimitmW; |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 323 | } |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 324 | |
| 325 | if (configurationLocked != nullptr) |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 326 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 327 | asyncResp->res.jsonValue[jsonPtr]["ConfigurationLocked"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 328 | *configurationLocked; |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 329 | } |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 330 | |
| 331 | if (allowedMemoryModes != nullptr) |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 332 | { |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 333 | constexpr const std::array<const char*, 3> values{"Volatile", "PMEM", |
| 334 | "Block"}; |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 335 | |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 336 | for (const char* v : values) |
| 337 | { |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 338 | if (allowedMemoryModes->ends_with(v)) |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 339 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 340 | asyncResp->res.jsonValue[jsonPtr]["OperatingMemoryModes"] |
| 341 | .push_back(v); |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 342 | break; |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 343 | } |
| 344 | } |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 345 | } |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 346 | |
| 347 | if (memoryMedia != nullptr) |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 348 | { |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 349 | constexpr const std::array<const char*, 3> values{"DRAM", "NAND", |
| 350 | "Intel3DXPoint"}; |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 351 | |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 352 | for (const char* v : values) |
Ed Tanous | 5fb91ba | 2020-09-28 15:41:28 -0700 | [diff] [blame] | 353 | { |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 354 | if (memoryMedia->ends_with(v)) |
Ed Tanous | 5fb91ba | 2020-09-28 15:41:28 -0700 | [diff] [blame] | 355 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 356 | asyncResp->res.jsonValue[jsonPtr]["MemoryMedia"].push_back(v); |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 357 | break; |
Ed Tanous | 5fb91ba | 2020-09-28 15:41:28 -0700 | [diff] [blame] | 358 | } |
Ed Tanous | 5fb91ba | 2020-09-28 15:41:28 -0700 | [diff] [blame] | 359 | } |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 360 | } |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 361 | |
| 362 | if (configurationLockCapable != nullptr) |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 363 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 364 | asyncResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] |
| 365 | ["ConfigurationLockCapable"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 366 | *configurationLockCapable; |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 367 | } |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 368 | |
| 369 | if (dataLockCapable != nullptr) |
Jiaqing Zhao | 80badf7 | 2022-03-18 17:48:53 +0800 | [diff] [blame] | 370 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 371 | asyncResp->res |
| 372 | .jsonValue[jsonPtr]["SecurityCapabilities"]["DataLockCapable"] = |
| 373 | *dataLockCapable; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 374 | } |
| 375 | |
| 376 | if (passphraseCapable != nullptr) |
| 377 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 378 | asyncResp->res |
| 379 | .jsonValue[jsonPtr]["SecurityCapabilities"]["PassphraseCapable"] = |
| 380 | *passphraseCapable; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 381 | } |
| 382 | |
| 383 | if (maxPassphraseCount != nullptr) |
| 384 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 385 | asyncResp->res |
| 386 | .jsonValue[jsonPtr]["SecurityCapabilities"]["MaxPassphraseCount"] = |
| 387 | *maxPassphraseCount; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 388 | } |
| 389 | |
| 390 | if (passphraseLockLimit != nullptr) |
| 391 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 392 | asyncResp->res |
| 393 | .jsonValue[jsonPtr]["SecurityCapabilities"]["PassphraseLockLimit"] = |
| 394 | *passphraseLockLimit; |
James Feist | c50e7c6 | 2020-07-27 15:39:36 -0700 | [diff] [blame] | 395 | } |
| 396 | } |
| 397 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 398 | inline void assembleDimmProperties( |
| 399 | std::string_view dimmId, |
| 400 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 401 | const dbus::utility::DBusPropertiesMap& properties, |
| 402 | const nlohmann::json::json_pointer& jsonPtr) |
Nan Zhou | 9a5acea | 2022-05-17 21:12:43 +0000 | [diff] [blame] | 403 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 404 | asyncResp->res.jsonValue[jsonPtr]["Id"] = dimmId; |
| 405 | asyncResp->res.jsonValue[jsonPtr]["Name"] = "DIMM Slot"; |
Ed Tanous | 539d8c6 | 2024-06-19 14:38:27 -0700 | [diff] [blame] | 406 | asyncResp->res.jsonValue[jsonPtr]["Status"]["State"] = |
| 407 | resource::State::Enabled; |
| 408 | asyncResp->res.jsonValue[jsonPtr]["Status"]["Health"] = |
| 409 | resource::Health::OK; |
Nan Zhou | 9a5acea | 2022-05-17 21:12:43 +0000 | [diff] [blame] | 410 | |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 411 | const uint16_t* memoryDataWidth = nullptr; |
| 412 | const size_t* memorySizeInKB = nullptr; |
| 413 | const std::string* partNumber = nullptr; |
| 414 | const std::string* serialNumber = nullptr; |
| 415 | const std::string* manufacturer = nullptr; |
| 416 | const uint16_t* revisionCode = nullptr; |
| 417 | const bool* present = nullptr; |
| 418 | const uint16_t* memoryTotalWidth = nullptr; |
| 419 | const std::string* ecc = nullptr; |
| 420 | const std::string* formFactor = nullptr; |
| 421 | const std::vector<uint16_t>* allowedSpeedsMT = nullptr; |
George Liu | 6995c1c | 2023-06-15 08:53:11 +0800 | [diff] [blame] | 422 | const size_t* memoryAttributes = nullptr; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 423 | const uint16_t* memoryConfiguredSpeedInMhz = nullptr; |
| 424 | const std::string* memoryType = nullptr; |
Jayaprakash Mutyala | 6fde597 | 2023-06-15 07:56:58 +0000 | [diff] [blame] | 425 | const std::uint8_t* channel = nullptr; |
| 426 | const std::uint8_t* memoryController = nullptr; |
| 427 | const std::uint8_t* slot = nullptr; |
| 428 | const std::uint8_t* socket = nullptr; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 429 | const std::string* sparePartNumber = nullptr; |
| 430 | const std::string* model = nullptr; |
| 431 | const std::string* locationCode = nullptr; |
| 432 | |
| 433 | const bool success = sdbusplus::unpackPropertiesNoThrow( |
| 434 | dbus_utils::UnpackErrorPrinter(), properties, "MemoryDataWidth", |
| 435 | memoryDataWidth, "MemorySizeInKB", memorySizeInKB, "PartNumber", |
Nikhil Namjoshi | 656472d | 2022-09-13 20:54:44 +0000 | [diff] [blame] | 436 | partNumber, "SerialNumber", serialNumber, "Manufacturer", manufacturer, |
| 437 | "RevisionCode", revisionCode, "Present", present, "MemoryTotalWidth", |
| 438 | memoryTotalWidth, "ECC", ecc, "FormFactor", formFactor, |
| 439 | "AllowedSpeedsMT", allowedSpeedsMT, "MemoryAttributes", |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 440 | memoryAttributes, "MemoryConfiguredSpeedInMhz", |
| 441 | memoryConfiguredSpeedInMhz, "MemoryType", memoryType, "Channel", |
| 442 | channel, "MemoryController", memoryController, "Slot", slot, "Socket", |
| 443 | socket, "SparePartNumber", sparePartNumber, "Model", model, |
| 444 | "LocationCode", locationCode); |
| 445 | |
| 446 | if (!success) |
Nan Zhou | 9a5acea | 2022-05-17 21:12:43 +0000 | [diff] [blame] | 447 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 448 | messages::internalError(asyncResp->res); |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 449 | return; |
| 450 | } |
Nan Zhou | 9a5acea | 2022-05-17 21:12:43 +0000 | [diff] [blame] | 451 | |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 452 | if (memoryDataWidth != nullptr) |
| 453 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 454 | asyncResp->res.jsonValue[jsonPtr]["DataWidthBits"] = *memoryDataWidth; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 455 | } |
Nan Zhou | 9a5acea | 2022-05-17 21:12:43 +0000 | [diff] [blame] | 456 | |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 457 | if (memorySizeInKB != nullptr) |
| 458 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 459 | asyncResp->res.jsonValue[jsonPtr]["CapacityMiB"] = |
| 460 | (*memorySizeInKB >> 10); |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 461 | } |
Nan Zhou | 9a5acea | 2022-05-17 21:12:43 +0000 | [diff] [blame] | 462 | |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 463 | if (partNumber != nullptr) |
| 464 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 465 | asyncResp->res.jsonValue[jsonPtr]["PartNumber"] = *partNumber; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 466 | } |
Nan Zhou | 9a5acea | 2022-05-17 21:12:43 +0000 | [diff] [blame] | 467 | |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 468 | if (serialNumber != nullptr) |
| 469 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 470 | asyncResp->res.jsonValue[jsonPtr]["SerialNumber"] = *serialNumber; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 471 | } |
| 472 | |
| 473 | if (manufacturer != nullptr) |
| 474 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 475 | asyncResp->res.jsonValue[jsonPtr]["Manufacturer"] = *manufacturer; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 476 | } |
| 477 | |
| 478 | if (revisionCode != nullptr) |
| 479 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 480 | asyncResp->res.jsonValue[jsonPtr]["FirmwareRevision"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 481 | std::to_string(*revisionCode); |
| 482 | } |
| 483 | |
| 484 | if (present != nullptr && !*present) |
| 485 | { |
Ed Tanous | 539d8c6 | 2024-06-19 14:38:27 -0700 | [diff] [blame] | 486 | asyncResp->res.jsonValue[jsonPtr]["Status"]["State"] = |
| 487 | resource::State::Absent; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 488 | } |
| 489 | |
| 490 | if (memoryTotalWidth != nullptr) |
| 491 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 492 | asyncResp->res.jsonValue[jsonPtr]["BusWidthBits"] = *memoryTotalWidth; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 493 | } |
| 494 | |
| 495 | if (ecc != nullptr) |
| 496 | { |
| 497 | constexpr const std::array<const char*, 4> values{ |
| 498 | "NoECC", "SingleBitECC", "MultiBitECC", "AddressParity"}; |
| 499 | |
| 500 | for (const char* v : values) |
Nan Zhou | 9a5acea | 2022-05-17 21:12:43 +0000 | [diff] [blame] | 501 | { |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 502 | if (ecc->ends_with(v)) |
Nan Zhou | 9a5acea | 2022-05-17 21:12:43 +0000 | [diff] [blame] | 503 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 504 | asyncResp->res.jsonValue[jsonPtr]["ErrorCorrection"] = v; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 505 | break; |
Nan Zhou | 9a5acea | 2022-05-17 21:12:43 +0000 | [diff] [blame] | 506 | } |
Nan Zhou | 9a5acea | 2022-05-17 21:12:43 +0000 | [diff] [blame] | 507 | } |
| 508 | } |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 509 | |
| 510 | if (formFactor != nullptr) |
| 511 | { |
| 512 | constexpr const std::array<const char*, 11> values{ |
| 513 | "RDIMM", "UDIMM", "SO_DIMM", "LRDIMM", |
| 514 | "Mini_RDIMM", "Mini_UDIMM", "SO_RDIMM_72b", "SO_UDIMM_72b", |
| 515 | "SO_DIMM_16b", "SO_DIMM_32b", "Die"}; |
| 516 | |
| 517 | for (const char* v : values) |
| 518 | { |
| 519 | if (formFactor->ends_with(v)) |
| 520 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 521 | asyncResp->res.jsonValue[jsonPtr]["BaseModuleType"] = v; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 522 | break; |
| 523 | } |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | if (allowedSpeedsMT != nullptr) |
| 528 | { |
| 529 | nlohmann::json& jValue = |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 530 | asyncResp->res.jsonValue[jsonPtr]["AllowedSpeedsMHz"]; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 531 | jValue = nlohmann::json::array(); |
| 532 | for (uint16_t subVal : *allowedSpeedsMT) |
| 533 | { |
| 534 | jValue.push_back(subVal); |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | if (memoryAttributes != nullptr) |
| 539 | { |
George Liu | 6995c1c | 2023-06-15 08:53:11 +0800 | [diff] [blame] | 540 | asyncResp->res.jsonValue[jsonPtr]["RankCount"] = *memoryAttributes; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 541 | } |
| 542 | |
| 543 | if (memoryConfiguredSpeedInMhz != nullptr) |
| 544 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 545 | asyncResp->res.jsonValue[jsonPtr]["OperatingSpeedMhz"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 546 | *memoryConfiguredSpeedInMhz; |
| 547 | } |
| 548 | |
| 549 | if (memoryType != nullptr) |
| 550 | { |
| 551 | std::string memoryDeviceType = |
| 552 | translateMemoryTypeToRedfish(*memoryType); |
| 553 | // Values like "Unknown" or "Other" will return empty |
| 554 | // so just leave off |
| 555 | if (!memoryDeviceType.empty()) |
| 556 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 557 | asyncResp->res.jsonValue[jsonPtr]["MemoryDeviceType"] = |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 558 | memoryDeviceType; |
| 559 | } |
| 560 | if (memoryType->find("DDR") != std::string::npos) |
| 561 | { |
Ed Tanous | 539d8c6 | 2024-06-19 14:38:27 -0700 | [diff] [blame] | 562 | asyncResp->res.jsonValue[jsonPtr]["MemoryType"] = |
| 563 | memory::MemoryType::DRAM; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 564 | } |
| 565 | else if (memoryType->ends_with("Logical")) |
| 566 | { |
Ed Tanous | 539d8c6 | 2024-06-19 14:38:27 -0700 | [diff] [blame] | 567 | asyncResp->res.jsonValue[jsonPtr]["MemoryType"] = |
| 568 | memory::MemoryType::IntelOptane; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 569 | } |
| 570 | } |
| 571 | |
| 572 | if (channel != nullptr) |
| 573 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 574 | asyncResp->res.jsonValue[jsonPtr]["MemoryLocation"]["Channel"] = |
| 575 | *channel; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 576 | } |
| 577 | |
| 578 | if (memoryController != nullptr) |
| 579 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 580 | asyncResp->res |
| 581 | .jsonValue[jsonPtr]["MemoryLocation"]["MemoryController"] = |
| 582 | *memoryController; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 583 | } |
| 584 | |
| 585 | if (slot != nullptr) |
| 586 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 587 | asyncResp->res.jsonValue[jsonPtr]["MemoryLocation"]["Slot"] = *slot; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 588 | } |
| 589 | |
| 590 | if (socket != nullptr) |
| 591 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 592 | asyncResp->res.jsonValue[jsonPtr]["MemoryLocation"]["Socket"] = *socket; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 593 | } |
| 594 | |
| 595 | if (sparePartNumber != nullptr) |
| 596 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 597 | asyncResp->res.jsonValue[jsonPtr]["SparePartNumber"] = *sparePartNumber; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 598 | } |
| 599 | |
| 600 | if (model != nullptr) |
| 601 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 602 | asyncResp->res.jsonValue[jsonPtr]["Model"] = *model; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 603 | } |
| 604 | |
| 605 | if (locationCode != nullptr) |
| 606 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 607 | asyncResp->res |
| 608 | .jsonValue[jsonPtr]["Location"]["PartLocation"]["ServiceLabel"] = |
| 609 | *locationCode; |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 610 | } |
| 611 | |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 612 | getPersistentMemoryProperties(asyncResp, properties, jsonPtr); |
Nan Zhou | 9a5acea | 2022-05-17 21:12:43 +0000 | [diff] [blame] | 613 | } |
| 614 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 615 | inline void getDimmDataByService( |
| 616 | std::shared_ptr<bmcweb::AsyncResp> asyncResp, const std::string& dimmId, |
| 617 | const std::string& service, const std::string& objPath) |
Rapkiewicz, Pawel | 443c293 | 2018-10-22 15:08:49 +0200 | [diff] [blame] | 618 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 619 | BMCWEB_LOG_DEBUG("Get available system components."); |
Ed Tanous | deae6a7 | 2024-11-11 21:58:57 -0800 | [diff] [blame] | 620 | dbus::utility::getAllProperties( |
| 621 | service, objPath, "", |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 622 | [dimmId, asyncResp{std::move(asyncResp)}]( |
Ed Tanous | 5e7e2dc | 2023-02-16 10:37:01 -0800 | [diff] [blame] | 623 | const boost::system::error_code& ec, |
Ed Tanous | b9d36b4 | 2022-02-26 21:42:46 -0800 | [diff] [blame] | 624 | const dbus::utility::DBusPropertiesMap& properties) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 625 | if (ec) |
| 626 | { |
| 627 | BMCWEB_LOG_DEBUG("DBUS response error"); |
| 628 | messages::internalError(asyncResp->res); |
| 629 | return; |
| 630 | } |
| 631 | assembleDimmProperties(dimmId, asyncResp, properties, |
| 632 | ""_json_pointer); |
| 633 | }); |
Rapkiewicz, Pawel | 443c293 | 2018-10-22 15:08:49 +0200 | [diff] [blame] | 634 | } |
| 635 | |
Nan Zhou | ef00d7d | 2022-05-20 21:22:32 +0000 | [diff] [blame] | 636 | inline void assembleDimmPartitionData( |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 637 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
Nan Zhou | d7f04fd | 2022-05-01 01:11:07 +0000 | [diff] [blame] | 638 | const dbus::utility::DBusPropertiesMap& properties, |
| 639 | const nlohmann::json::json_pointer& regionPtr) |
Nan Zhou | ef00d7d | 2022-05-20 21:22:32 +0000 | [diff] [blame] | 640 | { |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 641 | const std::string* memoryClassification = nullptr; |
| 642 | const uint64_t* offsetInKiB = nullptr; |
| 643 | const std::string* partitionId = nullptr; |
| 644 | const bool* passphraseState = nullptr; |
| 645 | const uint64_t* sizeInKiB = nullptr; |
| 646 | |
| 647 | const bool success = sdbusplus::unpackPropertiesNoThrow( |
| 648 | dbus_utils::UnpackErrorPrinter(), properties, "MemoryClassification", |
| 649 | memoryClassification, "OffsetInKiB", offsetInKiB, "PartitionId", |
| 650 | partitionId, "PassphraseState", passphraseState, "SizeInKiB", |
| 651 | sizeInKiB); |
| 652 | |
| 653 | if (!success) |
Nan Zhou | ef00d7d | 2022-05-20 21:22:32 +0000 | [diff] [blame] | 654 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 655 | messages::internalError(asyncResp->res); |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 656 | return; |
Nan Zhou | ef00d7d | 2022-05-20 21:22:32 +0000 | [diff] [blame] | 657 | } |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 658 | |
| 659 | nlohmann::json::object_t partition; |
| 660 | |
| 661 | if (memoryClassification != nullptr) |
| 662 | { |
| 663 | partition["MemoryClassification"] = *memoryClassification; |
| 664 | } |
| 665 | |
| 666 | if (offsetInKiB != nullptr) |
| 667 | { |
| 668 | partition["OffsetMiB"] = (*offsetInKiB >> 10); |
| 669 | } |
| 670 | |
| 671 | if (partitionId != nullptr) |
| 672 | { |
| 673 | partition["RegionId"] = *partitionId; |
| 674 | } |
| 675 | |
| 676 | if (passphraseState != nullptr) |
| 677 | { |
| 678 | partition["PassphraseEnabled"] = *passphraseState; |
| 679 | } |
| 680 | |
| 681 | if (sizeInKiB != nullptr) |
| 682 | { |
| 683 | partition["SizeMiB"] = (*sizeInKiB >> 10); |
| 684 | } |
| 685 | |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 686 | asyncResp->res.jsonValue[regionPtr].emplace_back(std::move(partition)); |
Nan Zhou | ef00d7d | 2022-05-20 21:22:32 +0000 | [diff] [blame] | 687 | } |
| 688 | |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 689 | inline void getDimmPartitionData(std::shared_ptr<bmcweb::AsyncResp> asyncResp, |
Ed Tanous | 23a21a1 | 2020-07-25 04:45:05 +0000 | [diff] [blame] | 690 | const std::string& service, |
| 691 | const std::string& path) |
James Feist | 45094ad | 2020-04-29 14:02:30 -0700 | [diff] [blame] | 692 | { |
Ed Tanous | deae6a7 | 2024-11-11 21:58:57 -0800 | [diff] [blame] | 693 | dbus::utility::getAllProperties( |
| 694 | service, path, |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 695 | "xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition", |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 696 | [asyncResp{std::move(asyncResp)}]( |
Ed Tanous | 5e7e2dc | 2023-02-16 10:37:01 -0800 | [diff] [blame] | 697 | const boost::system::error_code& ec, |
Ed Tanous | b9d36b4 | 2022-02-26 21:42:46 -0800 | [diff] [blame] | 698 | const dbus::utility::DBusPropertiesMap& properties) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 699 | if (ec) |
| 700 | { |
| 701 | BMCWEB_LOG_DEBUG("DBUS response error"); |
| 702 | messages::internalError(asyncResp->res); |
James Feist | 45094ad | 2020-04-29 14:02:30 -0700 | [diff] [blame] | 703 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 704 | return; |
| 705 | } |
| 706 | nlohmann::json::json_pointer regionPtr = "/Regions"_json_pointer; |
| 707 | assembleDimmPartitionData(asyncResp, properties, regionPtr); |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 708 | } |
James Feist | 45094ad | 2020-04-29 14:02:30 -0700 | [diff] [blame] | 709 | |
Krzysztof Grobelny | c1343bf | 2022-08-31 13:15:26 +0200 | [diff] [blame] | 710 | ); |
James Feist | 45094ad | 2020-04-29 14:02:30 -0700 | [diff] [blame] | 711 | } |
| 712 | |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 713 | inline void getDimmData(std::shared_ptr<bmcweb::AsyncResp> asyncResp, |
Ed Tanous | 23a21a1 | 2020-07-25 04:45:05 +0000 | [diff] [blame] | 714 | const std::string& dimmId) |
Rapkiewicz, Pawel | 443c293 | 2018-10-22 15:08:49 +0200 | [diff] [blame] | 715 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 716 | BMCWEB_LOG_DEBUG("Get available system dimm resources."); |
George Liu | e99073f | 2022-12-09 11:06:16 +0800 | [diff] [blame] | 717 | constexpr std::array<std::string_view, 2> dimmInterfaces = { |
| 718 | "xyz.openbmc_project.Inventory.Item.Dimm", |
| 719 | "xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition"}; |
| 720 | dbus::utility::getSubTree( |
| 721 | "/xyz/openbmc_project/inventory", 0, dimmInterfaces, |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 722 | [dimmId, asyncResp{std::move(asyncResp)}]( |
George Liu | e99073f | 2022-12-09 11:06:16 +0800 | [diff] [blame] | 723 | const boost::system::error_code& ec, |
Ed Tanous | b9d36b4 | 2022-02-26 21:42:46 -0800 | [diff] [blame] | 724 | const dbus::utility::MapperGetSubTreeResponse& subtree) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 725 | if (ec) |
Rapkiewicz, Pawel | 443c293 | 2018-10-22 15:08:49 +0200 | [diff] [blame] | 726 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 727 | BMCWEB_LOG_DEBUG("DBUS response error"); |
| 728 | messages::internalError(asyncResp->res); |
James Feist | 45094ad | 2020-04-29 14:02:30 -0700 | [diff] [blame] | 729 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 730 | return; |
| 731 | } |
| 732 | bool found = false; |
| 733 | for (const auto& [rawPath, object] : subtree) |
| 734 | { |
| 735 | sdbusplus::message::object_path path(rawPath); |
| 736 | for (const auto& [service, interfaces] : object) |
| 737 | { |
| 738 | for (const auto& interface : interfaces) |
Nan Zhou | 76686dc | 2022-06-17 23:01:51 +0000 | [diff] [blame] | 739 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 740 | if (interface == |
| 741 | "xyz.openbmc_project.Inventory.Item.Dimm" && |
| 742 | path.filename() == dimmId) |
| 743 | { |
| 744 | getDimmDataByService(asyncResp, dimmId, service, |
| 745 | rawPath); |
| 746 | found = true; |
| 747 | } |
| 748 | |
| 749 | // partitions are separate as there can be multiple |
| 750 | // per |
| 751 | // device, i.e. |
| 752 | // /xyz/openbmc_project/Inventory/Item/Dimm1/Partition1 |
| 753 | // /xyz/openbmc_project/Inventory/Item/Dimm1/Partition2 |
| 754 | if (interface == |
| 755 | "xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition" && |
| 756 | path.parent_path().filename() == dimmId) |
| 757 | { |
| 758 | getDimmPartitionData(asyncResp, service, rawPath); |
| 759 | } |
Rapkiewicz, Pawel | 443c293 | 2018-10-22 15:08:49 +0200 | [diff] [blame] | 760 | } |
| 761 | } |
| 762 | } |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 763 | // Object not found |
| 764 | if (!found) |
| 765 | { |
| 766 | messages::resourceNotFound(asyncResp->res, "Memory", dimmId); |
| 767 | return; |
| 768 | } |
| 769 | // Set @odata only if object is found |
| 770 | asyncResp->res.jsonValue["@odata.type"] = "#Memory.v1_11_0.Memory"; |
| 771 | asyncResp->res.jsonValue["@odata.id"] = |
| 772 | boost::urls::format("/redfish/v1/Systems/{}/Memory/{}", |
| 773 | BMCWEB_REDFISH_SYSTEM_URI_NAME, dimmId); |
Rapkiewicz, Pawel | 443c293 | 2018-10-22 15:08:49 +0200 | [diff] [blame] | 774 | return; |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 775 | }); |
Ed Tanous | 271584a | 2019-07-09 16:24:22 -0700 | [diff] [blame] | 776 | } |
Rapkiewicz, Pawel | 443c293 | 2018-10-22 15:08:49 +0200 | [diff] [blame] | 777 | |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 778 | inline void requestRoutesMemoryCollection(App& app) |
Ed Tanous | 029573d | 2019-02-01 10:57:49 -0800 | [diff] [blame] | 779 | { |
Ed Tanous | 029573d | 2019-02-01 10:57:49 -0800 | [diff] [blame] | 780 | /** |
| 781 | * Functions triggers appropriate requests on DBus |
| 782 | */ |
Ed Tanous | 22d268c | 2022-05-19 09:39:07 -0700 | [diff] [blame] | 783 | BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Memory/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 784 | .privileges(redfish::privileges::getMemoryCollection) |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 785 | .methods(boost::beast::http::verb::get)( |
Ed Tanous | 45ca1b8 | 2022-03-25 13:07:27 -0700 | [diff] [blame] | 786 | [&app](const crow::Request& req, |
Ed Tanous | 22d268c | 2022-05-19 09:39:07 -0700 | [diff] [blame] | 787 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 788 | const std::string& systemName) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 789 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 790 | { |
| 791 | return; |
| 792 | } |
| 793 | if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM) |
| 794 | { |
| 795 | // Option currently returns no systems. TBD |
| 796 | messages::resourceNotFound(asyncResp->res, "ComputerSystem", |
| 797 | systemName); |
| 798 | return; |
| 799 | } |
| 800 | if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME) |
| 801 | { |
| 802 | messages::resourceNotFound(asyncResp->res, "ComputerSystem", |
| 803 | systemName); |
| 804 | return; |
| 805 | } |
Ed Tanous | 22d268c | 2022-05-19 09:39:07 -0700 | [diff] [blame] | 806 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 807 | asyncResp->res.jsonValue["@odata.type"] = |
| 808 | "#MemoryCollection.MemoryCollection"; |
| 809 | asyncResp->res.jsonValue["Name"] = "Memory Module Collection"; |
| 810 | asyncResp->res.jsonValue["@odata.id"] = |
| 811 | boost::urls::format("/redfish/v1/Systems/{}/Memory", |
| 812 | BMCWEB_REDFISH_SYSTEM_URI_NAME); |
Rapkiewicz, Pawel | 443c293 | 2018-10-22 15:08:49 +0200 | [diff] [blame] | 813 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 814 | constexpr std::array<std::string_view, 1> interfaces{ |
| 815 | "xyz.openbmc_project.Inventory.Item.Dimm"}; |
| 816 | collection_util::getCollectionMembers( |
| 817 | asyncResp, |
| 818 | boost::urls::format("/redfish/v1/Systems/{}/Memory", |
| 819 | BMCWEB_REDFISH_SYSTEM_URI_NAME), |
| 820 | interfaces, "/xyz/openbmc_project/inventory"); |
| 821 | }); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 822 | } |
Rapkiewicz, Pawel | 443c293 | 2018-10-22 15:08:49 +0200 | [diff] [blame] | 823 | |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 824 | inline void requestRoutesMemory(App& app) |
Rapkiewicz, Pawel | 443c293 | 2018-10-22 15:08:49 +0200 | [diff] [blame] | 825 | { |
Rapkiewicz, Pawel | 443c293 | 2018-10-22 15:08:49 +0200 | [diff] [blame] | 826 | /** |
| 827 | * Functions triggers appropriate requests on DBus |
| 828 | */ |
Ed Tanous | 22d268c | 2022-05-19 09:39:07 -0700 | [diff] [blame] | 829 | BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Memory/<str>/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 830 | .privileges(redfish::privileges::getMemory) |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 831 | .methods(boost::beast::http::verb::get)( |
Ed Tanous | 45ca1b8 | 2022-03-25 13:07:27 -0700 | [diff] [blame] | 832 | [&app](const crow::Request& req, |
| 833 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
Ed Tanous | 22d268c | 2022-05-19 09:39:07 -0700 | [diff] [blame] | 834 | const std::string& systemName, const std::string& dimmId) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 835 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 836 | { |
| 837 | return; |
| 838 | } |
Ed Tanous | 7f3e84a | 2022-12-28 16:22:54 -0800 | [diff] [blame] | 839 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 840 | if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM) |
| 841 | { |
| 842 | // Option currently returns no systems. TBD |
| 843 | messages::resourceNotFound(asyncResp->res, "ComputerSystem", |
| 844 | systemName); |
| 845 | return; |
| 846 | } |
Ed Tanous | 7f3e84a | 2022-12-28 16:22:54 -0800 | [diff] [blame] | 847 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 848 | if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME) |
| 849 | { |
| 850 | messages::resourceNotFound(asyncResp->res, "ComputerSystem", |
| 851 | systemName); |
| 852 | return; |
| 853 | } |
Ed Tanous | 22d268c | 2022-05-19 09:39:07 -0700 | [diff] [blame] | 854 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 855 | getDimmData(asyncResp, dimmId); |
| 856 | }); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 857 | } |
Rapkiewicz, Pawel | 443c293 | 2018-10-22 15:08:49 +0200 | [diff] [blame] | 858 | |
| 859 | } // namespace redfish |