Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 1 | #include "fru.hpp" |
| 2 | |
Pavithra Barithaya | 47180ac | 2020-10-28 02:12:05 -0500 | [diff] [blame] | 3 | #include "libpldm/entity.h" |
George Liu | 6492f52 | 2020-06-16 10:34:05 +0800 | [diff] [blame] | 4 | #include "libpldm/utils.h" |
| 5 | |
Deepak Kodihalli | d130e1a | 2020-06-17 05:55:32 -0500 | [diff] [blame] | 6 | #include "common/utils.hpp" |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 7 | |
Manojkiran Eda | cc5f158 | 2021-09-29 17:03:06 +0530 | [diff] [blame] | 8 | #include <config.h> |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 9 | #include <systemd/sd-journal.h> |
| 10 | |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 11 | #include <sdbusplus/bus.hpp> |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 12 | |
George Liu | 6492f52 | 2020-06-16 10:34:05 +0800 | [diff] [blame] | 13 | #include <iostream> |
| 14 | #include <set> |
George Liu | 077fea2 | 2020-04-08 16:47:14 +0800 | [diff] [blame] | 15 | |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 16 | namespace pldm |
| 17 | { |
| 18 | |
| 19 | namespace responder |
| 20 | { |
| 21 | |
Tom Joseph | 33e9c7e | 2020-06-11 22:09:52 +0530 | [diff] [blame] | 22 | void FruImpl::buildFRUTable() |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 23 | { |
Tom Joseph | 33e9c7e | 2020-06-11 22:09:52 +0530 | [diff] [blame] | 24 | |
| 25 | if (isBuilt) |
| 26 | { |
| 27 | return; |
| 28 | } |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 29 | |
Tom Joseph | f007633 | 2020-02-06 10:18:50 +0530 | [diff] [blame] | 30 | fru_parser::DBusLookupInfo dbusInfo; |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 31 | // Read the all the inventory D-Bus objects |
| 32 | auto& bus = pldm::utils::DBusHandler::getBus(); |
| 33 | dbus::ObjectValueTree objects; |
| 34 | |
| 35 | try |
| 36 | { |
Tom Joseph | 33e9c7e | 2020-06-11 22:09:52 +0530 | [diff] [blame] | 37 | dbusInfo = parser.inventoryLookup(); |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 38 | auto method = bus.new_method_call( |
| 39 | std::get<0>(dbusInfo).c_str(), std::get<1>(dbusInfo).c_str(), |
| 40 | "org.freedesktop.DBus.ObjectManager", "GetManagedObjects"); |
| 41 | auto reply = bus.call(method); |
| 42 | reply.read(objects); |
| 43 | } |
| 44 | catch (const std::exception& e) |
| 45 | { |
| 46 | std::cerr << "Look up of inventory objects failed and PLDM FRU table " |
Brad Bishop | 0b54073 | 2021-08-18 09:42:41 -0400 | [diff] [blame] | 47 | "creation failed\n"; |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 48 | return; |
| 49 | } |
| 50 | |
Deepak Kodihalli | 3cd6181 | 2020-03-10 06:38:45 -0500 | [diff] [blame] | 51 | auto itemIntfsLookup = std::get<2>(dbusInfo); |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 52 | |
| 53 | for (const auto& object : objects) |
| 54 | { |
| 55 | const auto& interfaces = object.second; |
| 56 | |
| 57 | for (const auto& interface : interfaces) |
| 58 | { |
| 59 | if (itemIntfsLookup.find(interface.first) != itemIntfsLookup.end()) |
| 60 | { |
| 61 | // An exception will be thrown by getRecordInfo, if the item |
| 62 | // D-Bus interface name specified in FRU_Master.json does |
| 63 | // not have corresponding config jsons |
| 64 | try |
| 65 | { |
Deepak Kodihalli | 3cd6181 | 2020-03-10 06:38:45 -0500 | [diff] [blame] | 66 | pldm_entity entity{}; |
Tom Joseph | 33e9c7e | 2020-06-11 22:09:52 +0530 | [diff] [blame] | 67 | entity.entity_type = parser.getEntityType(interface.first); |
Deepak Kodihalli | 3cd6181 | 2020-03-10 06:38:45 -0500 | [diff] [blame] | 68 | pldm_entity_node* parent = nullptr; |
| 69 | auto parentObj = pldm::utils::findParent(object.first.str); |
| 70 | // To add a FRU to the entity association tree, we need to |
| 71 | // determine if the FRU has a parent (D-Bus object). For eg |
| 72 | // /system/backplane's parent is /system. /system has no |
| 73 | // parent. Some D-Bus pathnames might just be namespaces |
| 74 | // (not D-Bus objects), so we need to iterate upwards until |
| 75 | // a parent is found, or we reach the root ("/"). |
| 76 | // Parents are always added first before children in the |
| 77 | // entity association tree. We're relying on the fact that |
| 78 | // the std::map containing object paths from the |
| 79 | // GetManagedObjects call will have a sorted pathname list. |
| 80 | do |
| 81 | { |
| 82 | auto iter = objToEntityNode.find(parentObj); |
| 83 | if (iter != objToEntityNode.end()) |
| 84 | { |
| 85 | parent = iter->second; |
| 86 | break; |
| 87 | } |
| 88 | parentObj = pldm::utils::findParent(parentObj); |
| 89 | } while (parentObj != "/"); |
| 90 | |
| 91 | auto node = pldm_entity_association_tree_add( |
George Liu | 64a8f0f | 2021-06-12 10:56:11 +0800 | [diff] [blame] | 92 | entityTree, &entity, 0xFFFF, parent, |
Deepak Kodihalli | 3cd6181 | 2020-03-10 06:38:45 -0500 | [diff] [blame] | 93 | PLDM_ENTITY_ASSOCIAION_PHYSICAL); |
| 94 | objToEntityNode[object.first.str] = node; |
| 95 | |
Tom Joseph | 33e9c7e | 2020-06-11 22:09:52 +0530 | [diff] [blame] | 96 | auto recordInfos = parser.getRecordInfo(interface.first); |
Deepak Kodihalli | 3cd6181 | 2020-03-10 06:38:45 -0500 | [diff] [blame] | 97 | populateRecords(interfaces, recordInfos, entity); |
George Liu | c4ea6a9 | 2020-07-14 15:48:44 +0800 | [diff] [blame] | 98 | |
| 99 | associatedEntityMap.emplace(object.first, entity); |
Deepak Kodihalli | 3cd6181 | 2020-03-10 06:38:45 -0500 | [diff] [blame] | 100 | break; |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 101 | } |
| 102 | catch (const std::exception& e) |
| 103 | { |
| 104 | std::cout << "Config JSONs missing for the item " |
| 105 | "interface type, interface = " |
| 106 | << interface.first << "\n"; |
| 107 | break; |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
Deepak Kodihalli | 87514cc | 2020-04-16 09:08:38 -0500 | [diff] [blame] | 113 | pldm_entity_association_pdr_add(entityTree, pdrRepo, false); |
Sampa Misra | c073a20 | 2021-05-08 10:56:05 -0500 | [diff] [blame] | 114 | // save a copy of bmc's entity association tree |
| 115 | pldm_entity_association_tree_copy_root(entityTree, bmcEntityTree); |
Deepak Kodihalli | 3cd6181 | 2020-03-10 06:38:45 -0500 | [diff] [blame] | 116 | |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 117 | if (table.size()) |
| 118 | { |
| 119 | padBytes = utils::getNumPadBytes(table.size()); |
| 120 | table.resize(table.size() + padBytes, 0); |
| 121 | |
| 122 | // Calculate the checksum |
George Liu | 077fea2 | 2020-04-08 16:47:14 +0800 | [diff] [blame] | 123 | checksum = crc32(table.data(), table.size()); |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 124 | } |
Tom Joseph | 33e9c7e | 2020-06-11 22:09:52 +0530 | [diff] [blame] | 125 | isBuilt = true; |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 126 | } |
Pavithra Barithaya | 47180ac | 2020-10-28 02:12:05 -0500 | [diff] [blame] | 127 | std::string FruImpl::populatefwVersion() |
| 128 | { |
| 129 | static constexpr auto fwFunctionalObjPath = |
| 130 | "/xyz/openbmc_project/software/functional"; |
| 131 | auto& bus = pldm::utils::DBusHandler::getBus(); |
| 132 | std::string currentBmcVersion; |
| 133 | try |
| 134 | { |
| 135 | auto method = |
| 136 | bus.new_method_call(pldm::utils::mapperService, fwFunctionalObjPath, |
| 137 | pldm::utils::dbusProperties, "Get"); |
| 138 | method.append("xyz.openbmc_project.Association", "endpoints"); |
| 139 | std::variant<std::vector<std::string>> paths; |
| 140 | auto reply = bus.call(method); |
| 141 | reply.read(paths); |
| 142 | auto fwRunningVersion = std::get<std::vector<std::string>>(paths)[0]; |
| 143 | constexpr auto versionIntf = "xyz.openbmc_project.Software.Version"; |
| 144 | auto version = pldm::utils::DBusHandler().getDbusPropertyVariant( |
| 145 | fwRunningVersion.c_str(), "Version", versionIntf); |
| 146 | currentBmcVersion = std::get<std::string>(version); |
| 147 | } |
| 148 | catch (const std::exception& e) |
| 149 | { |
| 150 | std::cerr << "failed to make a d-bus call " |
| 151 | "Asociation, ERROR= " |
| 152 | << e.what() << "\n"; |
| 153 | return {}; |
| 154 | } |
| 155 | return currentBmcVersion; |
| 156 | } |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 157 | void FruImpl::populateRecords( |
| 158 | const pldm::responder::dbus::InterfaceMap& interfaces, |
Deepak Kodihalli | 3cd6181 | 2020-03-10 06:38:45 -0500 | [diff] [blame] | 159 | const fru_parser::FruRecordInfos& recordInfos, const pldm_entity& entity) |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 160 | { |
| 161 | // recordSetIdentifier for the FRU will be set when the first record gets |
| 162 | // added for the FRU |
| 163 | uint16_t recordSetIdentifier = 0; |
| 164 | auto numRecsCount = numRecs; |
Pavithra Barithaya | 4f2538a | 2021-03-05 07:32:15 -0600 | [diff] [blame] | 165 | static uint32_t bmc_record_handle = 0; |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 166 | |
| 167 | for (auto const& [recType, encType, fieldInfos] : recordInfos) |
| 168 | { |
| 169 | std::vector<uint8_t> tlvs; |
| 170 | uint8_t numFRUFields = 0; |
| 171 | for (auto const& [intf, prop, propType, fieldTypeNum] : fieldInfos) |
| 172 | { |
Pavithra Barithaya | 47180ac | 2020-10-28 02:12:05 -0500 | [diff] [blame] | 173 | |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 174 | try |
| 175 | { |
Pavithra Barithaya | 47180ac | 2020-10-28 02:12:05 -0500 | [diff] [blame] | 176 | pldm::responder::dbus::Value propValue; |
Manojkiran Eda | 2b7c1bf | 2021-09-09 12:26:00 +0530 | [diff] [blame^] | 177 | |
| 178 | // Assuming that 0 container Id is assigned to the System (as |
| 179 | // that should be the top most container as per dbus hierarchy) |
| 180 | if (entity.entity_container_id == 0 && prop == "Version") |
Pavithra Barithaya | 47180ac | 2020-10-28 02:12:05 -0500 | [diff] [blame] | 181 | { |
| 182 | propValue = populatefwVersion(); |
| 183 | } |
| 184 | else |
| 185 | { |
| 186 | propValue = interfaces.at(intf).at(prop); |
| 187 | } |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 188 | if (propType == "bytearray") |
| 189 | { |
| 190 | auto byteArray = std::get<std::vector<uint8_t>>(propValue); |
| 191 | if (!byteArray.size()) |
| 192 | { |
| 193 | continue; |
| 194 | } |
| 195 | |
| 196 | numFRUFields++; |
| 197 | tlvs.emplace_back(fieldTypeNum); |
| 198 | tlvs.emplace_back(byteArray.size()); |
| 199 | std::move(std::begin(byteArray), std::end(byteArray), |
| 200 | std::back_inserter(tlvs)); |
| 201 | } |
| 202 | else if (propType == "string") |
| 203 | { |
| 204 | auto str = std::get<std::string>(propValue); |
| 205 | if (!str.size()) |
| 206 | { |
| 207 | continue; |
| 208 | } |
| 209 | |
| 210 | numFRUFields++; |
| 211 | tlvs.emplace_back(fieldTypeNum); |
| 212 | tlvs.emplace_back(str.size()); |
| 213 | std::move(std::begin(str), std::end(str), |
| 214 | std::back_inserter(tlvs)); |
| 215 | } |
| 216 | } |
| 217 | catch (const std::out_of_range& e) |
| 218 | { |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 219 | continue; |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | if (tlvs.size()) |
| 224 | { |
| 225 | if (numRecs == numRecsCount) |
| 226 | { |
| 227 | recordSetIdentifier = nextRSI(); |
Pavithra Barithaya | 4f2538a | 2021-03-05 07:32:15 -0600 | [diff] [blame] | 228 | bmc_record_handle = nextRecordHandle(); |
Deepak Kodihalli | 3cd6181 | 2020-03-10 06:38:45 -0500 | [diff] [blame] | 229 | pldm_pdr_add_fru_record_set( |
Manojkiran Eda | cc5f158 | 2021-09-29 17:03:06 +0530 | [diff] [blame] | 230 | pdrRepo, TERMINUS_HANDLE, recordSetIdentifier, |
| 231 | entity.entity_type, entity.entity_instance_num, |
| 232 | entity.entity_container_id, bmc_record_handle); |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 233 | } |
| 234 | auto curSize = table.size(); |
| 235 | table.resize(curSize + recHeaderSize + tlvs.size()); |
| 236 | encode_fru_record(table.data(), table.size(), &curSize, |
| 237 | recordSetIdentifier, recType, numFRUFields, |
| 238 | encType, tlvs.data(), tlvs.size()); |
| 239 | numRecs++; |
| 240 | } |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | void FruImpl::getFRUTable(Response& response) |
| 245 | { |
| 246 | auto hdrSize = response.size(); |
| 247 | |
| 248 | response.resize(hdrSize + table.size() + sizeof(checksum), 0); |
| 249 | std::copy(table.begin(), table.end(), response.begin() + hdrSize); |
| 250 | |
| 251 | // Copy the checksum to response data |
| 252 | auto iter = response.begin() + hdrSize + table.size(); |
| 253 | std::copy_n(reinterpret_cast<const uint8_t*>(&checksum), sizeof(checksum), |
| 254 | iter); |
| 255 | } |
| 256 | |
John Wang | 9e82ad1 | 2020-06-12 10:53:32 +0800 | [diff] [blame] | 257 | int FruImpl::getFRURecordByOption(std::vector<uint8_t>& fruData, |
| 258 | uint16_t /* fruTableHandle */, |
| 259 | uint16_t recordSetIdentifer, |
| 260 | uint8_t recordType, uint8_t fieldType) |
| 261 | { |
Manojkiran Eda | 31a7844 | 2021-09-12 15:18:25 +0530 | [diff] [blame] | 262 | using sum = uint32_t; |
| 263 | |
John Wang | 9e82ad1 | 2020-06-12 10:53:32 +0800 | [diff] [blame] | 264 | // FRU table is built lazily, build if not done. |
| 265 | buildFRUTable(); |
| 266 | |
| 267 | /* 7 is sizeof(checksum,4) + padBytesMax(3) |
| 268 | * We can not know size of the record table got by options in advance, but |
| 269 | * it must be less than the source table. So it's safe to use sizeof the |
| 270 | * source table + 7 as the buffer length |
| 271 | */ |
| 272 | size_t recordTableSize = table.size() - padBytes + 7; |
| 273 | fruData.resize(recordTableSize, 0); |
| 274 | |
| 275 | get_fru_record_by_option(table.data(), table.size() - padBytes, |
| 276 | fruData.data(), &recordTableSize, |
| 277 | recordSetIdentifer, recordType, fieldType); |
| 278 | |
| 279 | if (recordTableSize == 0) |
| 280 | { |
| 281 | return PLDM_FRU_DATA_STRUCTURE_TABLE_UNAVAILABLE; |
| 282 | } |
| 283 | |
| 284 | auto pads = utils::getNumPadBytes(recordTableSize); |
Manojkiran Eda | 31a7844 | 2021-09-12 15:18:25 +0530 | [diff] [blame] | 285 | crc32(fruData.data(), recordTableSize + pads); |
John Wang | 9e82ad1 | 2020-06-12 10:53:32 +0800 | [diff] [blame] | 286 | |
| 287 | auto iter = fruData.begin() + recordTableSize + pads; |
| 288 | std::copy_n(reinterpret_cast<const uint8_t*>(&checksum), sizeof(checksum), |
| 289 | iter); |
| 290 | fruData.resize(recordTableSize + pads + sizeof(sum)); |
| 291 | |
| 292 | return PLDM_SUCCESS; |
| 293 | } |
| 294 | |
Deepak Kodihalli | e60c582 | 2019-10-23 03:26:15 -0500 | [diff] [blame] | 295 | namespace fru |
| 296 | { |
| 297 | |
| 298 | Response Handler::getFRURecordTableMetadata(const pldm_msg* request, |
| 299 | size_t /*payloadLength*/) |
| 300 | { |
Tom Joseph | 33e9c7e | 2020-06-11 22:09:52 +0530 | [diff] [blame] | 301 | // FRU table is built lazily, build if not done. |
| 302 | buildFRUTable(); |
| 303 | |
Deepak Kodihalli | e60c582 | 2019-10-23 03:26:15 -0500 | [diff] [blame] | 304 | constexpr uint8_t major = 0x01; |
| 305 | constexpr uint8_t minor = 0x00; |
| 306 | constexpr uint32_t maxSize = 0xFFFFFFFF; |
| 307 | |
| 308 | Response response(sizeof(pldm_msg_hdr) + |
| 309 | PLDM_GET_FRU_RECORD_TABLE_METADATA_RESP_BYTES, |
| 310 | 0); |
| 311 | auto responsePtr = reinterpret_cast<pldm_msg*>(response.data()); |
| 312 | |
| 313 | auto rc = encode_get_fru_record_table_metadata_resp( |
| 314 | request->hdr.instance_id, PLDM_SUCCESS, major, minor, maxSize, |
| 315 | impl.size(), impl.numRSI(), impl.numRecords(), impl.checkSum(), |
| 316 | responsePtr); |
| 317 | if (rc != PLDM_SUCCESS) |
| 318 | { |
| 319 | return ccOnlyResponse(request, rc); |
| 320 | } |
| 321 | |
| 322 | return response; |
| 323 | } |
| 324 | |
| 325 | Response Handler::getFRURecordTable(const pldm_msg* request, |
| 326 | size_t payloadLength) |
| 327 | { |
Tom Joseph | 33e9c7e | 2020-06-11 22:09:52 +0530 | [diff] [blame] | 328 | // FRU table is built lazily, build if not done. |
| 329 | buildFRUTable(); |
| 330 | |
Deepak Kodihalli | e60c582 | 2019-10-23 03:26:15 -0500 | [diff] [blame] | 331 | if (payloadLength != PLDM_GET_FRU_RECORD_TABLE_REQ_BYTES) |
| 332 | { |
| 333 | return ccOnlyResponse(request, PLDM_ERROR_INVALID_LENGTH); |
| 334 | } |
| 335 | |
| 336 | Response response( |
| 337 | sizeof(pldm_msg_hdr) + PLDM_GET_FRU_RECORD_TABLE_MIN_RESP_BYTES, 0); |
| 338 | auto responsePtr = reinterpret_cast<pldm_msg*>(response.data()); |
| 339 | |
| 340 | auto rc = |
| 341 | encode_get_fru_record_table_resp(request->hdr.instance_id, PLDM_SUCCESS, |
| 342 | 0, PLDM_START_AND_END, responsePtr); |
| 343 | if (rc != PLDM_SUCCESS) |
| 344 | { |
| 345 | return ccOnlyResponse(request, rc); |
| 346 | } |
| 347 | |
| 348 | impl.getFRUTable(response); |
| 349 | |
| 350 | return response; |
| 351 | } |
| 352 | |
John Wang | 9e82ad1 | 2020-06-12 10:53:32 +0800 | [diff] [blame] | 353 | Response Handler::getFRURecordByOption(const pldm_msg* request, |
| 354 | size_t payloadLength) |
| 355 | { |
| 356 | if (payloadLength != sizeof(pldm_get_fru_record_by_option_req)) |
| 357 | { |
| 358 | return ccOnlyResponse(request, PLDM_ERROR_INVALID_LENGTH); |
| 359 | } |
| 360 | |
| 361 | uint32_t retDataTransferHandle{}; |
| 362 | uint16_t retFruTableHandle{}; |
| 363 | uint16_t retRecordSetIdentifier{}; |
| 364 | uint8_t retRecordType{}; |
| 365 | uint8_t retFieldType{}; |
| 366 | uint8_t retTransferOpFlag{}; |
| 367 | |
| 368 | auto rc = decode_get_fru_record_by_option_req( |
| 369 | request, payloadLength, &retDataTransferHandle, &retFruTableHandle, |
| 370 | &retRecordSetIdentifier, &retRecordType, &retFieldType, |
| 371 | &retTransferOpFlag); |
| 372 | |
| 373 | if (rc != PLDM_SUCCESS) |
| 374 | { |
| 375 | return ccOnlyResponse(request, rc); |
| 376 | } |
| 377 | |
| 378 | std::vector<uint8_t> fruData; |
| 379 | rc = impl.getFRURecordByOption(fruData, retFruTableHandle, |
| 380 | retRecordSetIdentifier, retRecordType, |
| 381 | retFieldType); |
| 382 | if (rc != PLDM_SUCCESS) |
| 383 | { |
| 384 | return ccOnlyResponse(request, rc); |
| 385 | } |
| 386 | |
| 387 | auto respPayloadLength = |
| 388 | PLDM_GET_FRU_RECORD_BY_OPTION_MIN_RESP_BYTES + fruData.size(); |
| 389 | Response response(sizeof(pldm_msg_hdr) + respPayloadLength, 0); |
| 390 | auto responsePtr = reinterpret_cast<pldm_msg*>(response.data()); |
| 391 | |
| 392 | rc = encode_get_fru_record_by_option_resp( |
| 393 | request->hdr.instance_id, PLDM_SUCCESS, 0, PLDM_START_AND_END, |
| 394 | fruData.data(), fruData.size(), responsePtr, respPayloadLength); |
| 395 | |
| 396 | if (rc != PLDM_SUCCESS) |
| 397 | { |
| 398 | return ccOnlyResponse(request, rc); |
| 399 | } |
| 400 | |
| 401 | return response; |
| 402 | } |
| 403 | |
Deepak Kodihalli | e60c582 | 2019-10-23 03:26:15 -0500 | [diff] [blame] | 404 | } // namespace fru |
| 405 | |
Deepak Kodihalli | 70e8db0 | 2019-10-21 00:59:46 -0500 | [diff] [blame] | 406 | } // namespace responder |
| 407 | |
| 408 | } // namespace pldm |