blob: 9721bc14f6e96e509d6df037f03529dd2b134e17 [file] [log] [blame]
Sampa Misraaea5dde2020-08-31 08:33:47 -05001#include "oem_ibm_handler.hpp"
2
Manojkiran Edaa31ceb92021-07-22 09:19:02 +05303#include "collect_slot_vpd.hpp"
Sagar Srinivascfdbca72020-09-22 10:03:35 -05004#include "file_io_type_lid.hpp"
5#include "libpldmresponder/file_io.hpp"
Sagar Srinivas78a225a2020-08-27 00:52:20 -05006#include "libpldmresponder/pdr_utils.hpp"
Brad Bishop5079ac42021-08-19 18:35:06 -04007
George Liuc453e162022-12-21 17:16:23 +08008#include <libpldm/entity.h>
Andrew Jeffery21f128d2024-01-15 15:34:26 +10309#include <libpldm/oem/ibm/entity.h>
Manojkiran Edaa31ceb92021-07-22 09:19:02 +053010#include <libpldm/pldm.h>
Brad Bishop27403f42021-12-01 21:37:44 -050011
Riya Dixit49cfb132023-03-02 04:26:53 -060012#include <phosphor-logging/lg2.hpp>
Pavithra Barithaya7b4d59a2024-02-05 09:09:30 -060013#include <xyz/openbmc_project/State/BMC/client.hpp>
Riya Dixit49cfb132023-03-02 04:26:53 -060014
15PHOSPHOR_LOG2_USING;
16
Brad Bishop5079ac42021-08-19 18:35:06 -040017using namespace pldm::pdr;
18using namespace pldm::utils;
19
Sampa Misraaea5dde2020-08-31 08:33:47 -050020namespace pldm
21{
Sampa Misraaea5dde2020-08-31 08:33:47 -050022namespace responder
23{
Sampa Misraaea5dde2020-08-31 08:33:47 -050024namespace oem_ibm_platform
25{
Sampa Misraaea5dde2020-08-31 08:33:47 -050026int pldm::responder::oem_ibm_platform::Handler::
27 getOemStateSensorReadingsHandler(
Kamalkumar Patel7d427f12024-05-16 03:44:00 -050028 pldm::pdr::EntityType entityType, EntityInstance entityInstance,
Manojkiran Edaa31ceb92021-07-22 09:19:02 +053029 ContainerID containerId, StateSetId stateSetId,
30 CompositeCount compSensorCnt, uint16_t /*sensorId*/,
Sampa Misraaea5dde2020-08-31 08:33:47 -050031 std::vector<get_sensor_state_field>& stateField)
32{
Manojkiran Edaa31ceb92021-07-22 09:19:02 +053033 auto& entityAssociationMap = getAssociateEntityMap();
Sampa Misraaea5dde2020-08-31 08:33:47 -050034 int rc = PLDM_SUCCESS;
35 stateField.clear();
36
37 for (size_t i = 0; i < compSensorCnt; i++)
38 {
39 uint8_t sensorOpState{};
Sagar Srinivas78a225a2020-08-27 00:52:20 -050040 if (entityType == PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE &&
Sampa Misraaea5dde2020-08-31 08:33:47 -050041 stateSetId == PLDM_OEM_IBM_BOOT_STATE)
42 {
43 sensorOpState = fetchBootSide(entityInstance, codeUpdate);
44 }
Manojkiran Edaa31ceb92021-07-22 09:19:02 +053045 else if (entityType == PLDM_ENTITY_SLOT &&
46 stateSetId == PLDM_OEM_IBM_PCIE_SLOT_SENSOR_STATE)
47 {
48 for (const auto& [key, value] : entityAssociationMap)
49 {
50 if (value.entity_type == entityType &&
51 value.entity_instance_num == entityInstance &&
52 value.entity_container_id == containerId)
53 {
54 sensorOpState = slotHandler->fetchSlotSensorState(key);
55 break;
56 }
57 }
58 }
Sampa Misraaea5dde2020-08-31 08:33:47 -050059 else
60 {
61 rc = PLDM_PLATFORM_INVALID_STATE_VALUE;
62 break;
63 }
64 stateField.push_back({PLDM_SENSOR_ENABLED, PLDM_SENSOR_UNKNOWN,
65 PLDM_SENSOR_UNKNOWN, sensorOpState});
66 }
67 return rc;
68}
69
70int pldm::responder::oem_ibm_platform::Handler::
Sampa Misra3a0e3b92020-10-21 05:58:00 -050071 oemSetStateEffecterStatesHandler(
Varsha Kaverappa3fbd39e2020-09-28 01:40:22 -050072 uint16_t entityType, uint16_t entityInstance, uint16_t stateSetId,
73 uint8_t compEffecterCnt,
Manojkiran Edaa31ceb92021-07-22 09:19:02 +053074 std::vector<set_effecter_state_field>& stateField, uint16_t effecterId)
Sampa Misraaea5dde2020-08-31 08:33:47 -050075{
76 int rc = PLDM_SUCCESS;
Manojkiran Edaa31ceb92021-07-22 09:19:02 +053077 auto& entityAssociationMap = getAssociateEntityMap();
Sampa Misraaea5dde2020-08-31 08:33:47 -050078
79 for (uint8_t currState = 0; currState < compEffecterCnt; ++currState)
80 {
81 if (stateField[currState].set_request == PLDM_REQUEST_SET)
82 {
Sagar Srinivas78a225a2020-08-27 00:52:20 -050083 if (entityType == PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE &&
Sampa Misraaea5dde2020-08-31 08:33:47 -050084 stateSetId == PLDM_OEM_IBM_BOOT_STATE)
85 {
86 rc = setBootSide(entityInstance, currState, stateField,
87 codeUpdate);
88 }
Sagar Srinivascfdbca72020-09-22 10:03:35 -050089 else if (entityType == PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE &&
90 stateSetId == PLDM_OEM_IBM_FIRMWARE_UPDATE_STATE)
91 {
92 if (stateField[currState].effecter_state ==
93 uint8_t(CodeUpdateState::START))
94 {
95 codeUpdate->setCodeUpdateProgress(true);
Sampa Misra3a0e3b92020-10-21 05:58:00 -050096 startUpdateEvent =
97 std::make_unique<sdeventplus::source::Defer>(
98 event,
99 std::bind(std::mem_fn(&oem_ibm_platform::Handler::
100 _processStartUpdate),
101 this, std::placeholders::_1));
Sagar Srinivascfdbca72020-09-22 10:03:35 -0500102 }
103 else if (stateField[currState].effecter_state ==
104 uint8_t(CodeUpdateState::END))
105 {
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500106 rc = PLDM_SUCCESS;
107 assembleImageEvent = std::make_unique<
108 sdeventplus::source::Defer>(
109 event,
110 std::bind(
111 std::mem_fn(
112 &oem_ibm_platform::Handler::_processEndUpdate),
113 this, std::placeholders::_1));
114
115 // sendCodeUpdateEvent(effecterId, END, START);
Sagar Srinivascfdbca72020-09-22 10:03:35 -0500116 }
117 else if (stateField[currState].effecter_state ==
118 uint8_t(CodeUpdateState::ABORT))
119 {
120 codeUpdate->setCodeUpdateProgress(false);
121 codeUpdate->clearDirPath(LID_STAGING_DIR);
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500122 auto sensorId = codeUpdate->getFirmwareUpdateSensor();
123 sendStateSensorEvent(sensorId, PLDM_STATE_SENSOR_STATE, 0,
124 uint8_t(CodeUpdateState::ABORT),
125 uint8_t(CodeUpdateState::START));
126 // sendCodeUpdateEvent(effecterId, ABORT, END);
Sagar Srinivascfdbca72020-09-22 10:03:35 -0500127 }
128 else if (stateField[currState].effecter_state ==
129 uint8_t(CodeUpdateState::ACCEPT))
130 {
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500131 auto sensorId = codeUpdate->getFirmwareUpdateSensor();
132 sendStateSensorEvent(sensorId, PLDM_STATE_SENSOR_STATE, 0,
133 uint8_t(CodeUpdateState::ACCEPT),
134 uint8_t(CodeUpdateState::END));
Sagar Srinivascfdbca72020-09-22 10:03:35 -0500135 // TODO Set new Dbus property provided by code update app
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500136 // sendCodeUpdateEvent(effecterId, ACCEPT, END);
Sagar Srinivascfdbca72020-09-22 10:03:35 -0500137 }
138 else if (stateField[currState].effecter_state ==
139 uint8_t(CodeUpdateState::REJECT))
140 {
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500141 auto sensorId = codeUpdate->getFirmwareUpdateSensor();
142 sendStateSensorEvent(sensorId, PLDM_STATE_SENSOR_STATE, 0,
143 uint8_t(CodeUpdateState::REJECT),
144 uint8_t(CodeUpdateState::END));
Sagar Srinivascfdbca72020-09-22 10:03:35 -0500145 // TODO Set new Dbus property provided by code update app
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500146 // sendCodeUpdateEvent(effecterId, REJECT, END);
Sagar Srinivascfdbca72020-09-22 10:03:35 -0500147 }
148 }
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600149 else if (entityType == PLDM_ENTITY_SYSTEM_CHASSIS &&
150 stateSetId == PLDM_OEM_IBM_SYSTEM_POWER_STATE)
151 {
152 if (stateField[currState].effecter_state == POWER_CYCLE_HARD)
153 {
154 systemRebootEvent =
155 std::make_unique<sdeventplus::source::Defer>(
156 event,
157 std::bind(std::mem_fn(&oem_ibm_platform::Handler::
158 _processSystemReboot),
159 this, std::placeholders::_1));
160 }
161 }
Manojkiran Edaa31ceb92021-07-22 09:19:02 +0530162 else if (stateSetId == PLDM_OEM_IBM_PCIE_SLOT_EFFECTER_STATE)
163 {
164 slotHandler->enableSlot(effecterId, entityAssociationMap,
165 stateField[currState].effecter_state);
166 }
Sampa Misraaea5dde2020-08-31 08:33:47 -0500167 else
168 {
169 rc = PLDM_PLATFORM_SET_EFFECTER_UNSUPPORTED_SENSORSTATE;
170 }
171 }
172 if (rc != PLDM_SUCCESS)
173 {
174 break;
175 }
176 }
177 return rc;
178}
179
Manojkiran Eda6b1d8832021-03-27 11:25:06 +0530180void buildAllCodeUpdateEffecterPDR(oem_ibm_platform::Handler* platformHandler,
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600181 uint16_t entityType, uint16_t entityInstance,
182 uint16_t stateSetID, pdr_utils::Repo& repo)
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500183{
184 size_t pdrSize = 0;
185 pdrSize = sizeof(pldm_state_effecter_pdr) +
186 sizeof(state_effecter_possible_states);
187 std::vector<uint8_t> entry{};
188 entry.resize(pdrSize);
189 pldm_state_effecter_pdr* pdr =
190 reinterpret_cast<pldm_state_effecter_pdr*>(entry.data());
191 if (!pdr)
192 {
Riya Dixitfc84f632024-04-06 14:00:02 -0500193 error("Failed to get record by PDR type, error - {ERROR}", "ERROR",
Riya Dixit49cfb132023-03-02 04:26:53 -0600194 lg2::hex,
195 static_cast<unsigned>(PLDM_PLATFORM_INVALID_EFFECTER_ID));
Manojkiran Edabcf91ac2021-03-14 13:50:48 +0530196 return;
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500197 }
198 pdr->hdr.record_handle = 0;
199 pdr->hdr.version = 1;
200 pdr->hdr.type = PLDM_STATE_EFFECTER_PDR;
201 pdr->hdr.record_change_num = 0;
202 pdr->hdr.length = sizeof(pldm_state_effecter_pdr) - sizeof(pldm_pdr_hdr);
Manojkiran Edacc5f1582021-09-29 17:03:06 +0530203 pdr->terminus_handle = TERMINUS_HANDLE;
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500204 pdr->effecter_id = platformHandler->getNextEffecterId();
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600205 pdr->entity_type = entityType;
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500206 pdr->entity_instance = entityInstance;
Sagar Srinivas97296e02021-08-26 09:40:41 -0500207 pdr->container_id = 1;
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500208 pdr->effecter_semantic_id = 0;
209 pdr->effecter_init = PLDM_NO_INIT;
210 pdr->has_description_pdr = false;
211 pdr->composite_effecter_count = 1;
212
213 auto* possibleStatesPtr = pdr->possible_states;
214 auto possibleStates =
215 reinterpret_cast<state_effecter_possible_states*>(possibleStatesPtr);
216 possibleStates->state_set_id = stateSetID;
217 possibleStates->possible_states_size = 2;
218 auto state =
219 reinterpret_cast<state_effecter_possible_states*>(possibleStates);
220 if (stateSetID == PLDM_OEM_IBM_BOOT_STATE)
221 state->states[0].byte = 6;
222 else if (stateSetID == PLDM_OEM_IBM_FIRMWARE_UPDATE_STATE)
223 state->states[0].byte = 126;
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600224 else if (stateSetID == PLDM_OEM_IBM_SYSTEM_POWER_STATE)
225 state->states[0].byte = 2;
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500226 pldm::responder::pdr_utils::PdrEntry pdrEntry{};
227 pdrEntry.data = entry.data();
228 pdrEntry.size = pdrSize;
229 repo.addRecord(pdrEntry);
230}
231
Manojkiran Edaa31ceb92021-07-22 09:19:02 +0530232void buildAllSlotEnableEffecterPDR(oem_ibm_platform::Handler* platformHandler,
233 pdr_utils::Repo& repo,
234 const std::vector<std::string>& slotobjpaths)
235{
236 size_t pdrSize = 0;
237 pdrSize = sizeof(pldm_state_effecter_pdr) +
238 sizeof(state_effecter_possible_states);
239 std::vector<uint8_t> entry{};
240 entry.resize(pdrSize);
241 pldm_state_effecter_pdr* pdr =
242 reinterpret_cast<pldm_state_effecter_pdr*>(entry.data());
243 if (!pdr)
244 {
245 error("Failed to get record by PDR type, ERROR:{ERR}", "ERR", lg2::hex,
246 static_cast<unsigned>(PLDM_PLATFORM_INVALID_EFFECTER_ID));
247 return;
248 }
249
250 auto& associatedEntityMap = platformHandler->getAssociateEntityMap();
251 for (const auto& entity_path : slotobjpaths)
252 {
253 pdr->hdr.record_handle = 0;
254 pdr->hdr.version = 1;
255 pdr->hdr.type = PLDM_STATE_EFFECTER_PDR;
256 pdr->hdr.record_change_num = 0;
257 pdr->hdr.length =
258 sizeof(pldm_state_effecter_pdr) - sizeof(pldm_pdr_hdr);
259 pdr->terminus_handle = TERMINUS_HANDLE;
260 pdr->effecter_id = platformHandler->getNextEffecterId();
261
262 if (entity_path != "" && associatedEntityMap.contains(entity_path))
263 {
264 pdr->entity_type = associatedEntityMap.at(entity_path).entity_type;
265 pdr->entity_instance =
266 associatedEntityMap.at(entity_path).entity_instance_num;
267 pdr->container_id =
268 associatedEntityMap.at(entity_path).entity_container_id;
269 platformHandler->effecterIdToDbusMap[pdr->effecter_id] =
270 entity_path;
271 }
272 else
273 {
274 // the slots are not present, dont create the PDR
275 continue;
276 }
277 pdr->effecter_semantic_id = 0;
278 pdr->effecter_init = PLDM_NO_INIT;
279 pdr->has_description_pdr = false;
280 pdr->composite_effecter_count = 1;
281
282 auto* possibleStatesPtr = pdr->possible_states;
283 auto possibleStates = reinterpret_cast<state_effecter_possible_states*>(
284 possibleStatesPtr);
285 possibleStates->state_set_id = PLDM_OEM_IBM_PCIE_SLOT_EFFECTER_STATE;
286 possibleStates->possible_states_size = 2;
287 auto state =
288 reinterpret_cast<state_effecter_possible_states*>(possibleStates);
289 state->states[0].byte = 14;
290 pldm::responder::pdr_utils::PdrEntry pdrEntry{};
291 pdrEntry.data = entry.data();
292 pdrEntry.size = pdrSize;
293 repo.addRecord(pdrEntry);
294 }
295}
296
Manojkiran Eda6b1d8832021-03-27 11:25:06 +0530297void buildAllCodeUpdateSensorPDR(oem_ibm_platform::Handler* platformHandler,
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500298 uint16_t entityType, uint16_t entityInstance,
299 uint16_t stateSetID, pdr_utils::Repo& repo)
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500300{
301 size_t pdrSize = 0;
Patrick Williams6da4f912023-05-10 07:50:53 -0500302 pdrSize = sizeof(pldm_state_sensor_pdr) +
303 sizeof(state_sensor_possible_states);
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500304 std::vector<uint8_t> entry{};
305 entry.resize(pdrSize);
306 pldm_state_sensor_pdr* pdr =
307 reinterpret_cast<pldm_state_sensor_pdr*>(entry.data());
308 if (!pdr)
309 {
Riya Dixitfc84f632024-04-06 14:00:02 -0500310 error("Failed to get record by PDR type, error - {ERROR}", "ERROR",
Riya Dixit49cfb132023-03-02 04:26:53 -0600311 lg2::hex, static_cast<unsigned>(PLDM_PLATFORM_INVALID_SENSOR_ID));
Manojkiran Edabcf91ac2021-03-14 13:50:48 +0530312 return;
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500313 }
314 pdr->hdr.record_handle = 0;
315 pdr->hdr.version = 1;
316 pdr->hdr.type = PLDM_STATE_SENSOR_PDR;
317 pdr->hdr.record_change_num = 0;
318 pdr->hdr.length = sizeof(pldm_state_sensor_pdr) - sizeof(pldm_pdr_hdr);
Manojkiran Edacc5f1582021-09-29 17:03:06 +0530319 pdr->terminus_handle = TERMINUS_HANDLE;
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500320 pdr->sensor_id = platformHandler->getNextSensorId();
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500321 pdr->entity_type = entityType;
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500322 pdr->entity_instance = entityInstance;
Sagar Srinivas97296e02021-08-26 09:40:41 -0500323 pdr->container_id = 1;
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500324 pdr->sensor_init = PLDM_NO_INIT;
325 pdr->sensor_auxiliary_names_pdr = false;
326 pdr->composite_sensor_count = 1;
327
328 auto* possibleStatesPtr = pdr->possible_states;
329 auto possibleStates =
330 reinterpret_cast<state_sensor_possible_states*>(possibleStatesPtr);
331 possibleStates->state_set_id = stateSetID;
332 possibleStates->possible_states_size = 2;
333 auto state =
334 reinterpret_cast<state_sensor_possible_states*>(possibleStates);
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500335 if ((stateSetID == PLDM_OEM_IBM_BOOT_STATE) ||
Christian Geddes7f9523c2021-08-03 13:44:38 -0500336 (stateSetID == PLDM_OEM_IBM_VERIFICATION_STATE))
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500337 state->states[0].byte = 6;
338 else if (stateSetID == PLDM_OEM_IBM_FIRMWARE_UPDATE_STATE)
339 state->states[0].byte = 126;
340 pldm::responder::pdr_utils::PdrEntry pdrEntry{};
341 pdrEntry.data = entry.data();
342 pdrEntry.size = pdrSize;
343 repo.addRecord(pdrEntry);
344}
345
Manojkiran Edaa31ceb92021-07-22 09:19:02 +0530346void buildAllSlotEnableSensorPDR(oem_ibm_platform::Handler* platformHandler,
347 pdr_utils::Repo& repo,
348 const std::vector<std::string>& slotobjpaths)
349{
350 size_t pdrSize = 0;
351 pdrSize = sizeof(pldm_state_sensor_pdr) +
352 sizeof(state_sensor_possible_states);
353 std::vector<uint8_t> entry{};
354 entry.resize(pdrSize);
355 pldm_state_sensor_pdr* pdr =
356 reinterpret_cast<pldm_state_sensor_pdr*>(entry.data());
357 if (!pdr)
358 {
359 error("Failed to get record by PDR type, ERROR:{ERR}", "ERR", lg2::hex,
360 static_cast<unsigned>(PLDM_PLATFORM_INVALID_SENSOR_ID));
361 return;
362 }
363 auto& associatedEntityMap = platformHandler->getAssociateEntityMap();
364 for (const auto& entity_path : slotobjpaths)
365 {
366 pdr->hdr.record_handle = 0;
367 pdr->hdr.version = 1;
368 pdr->hdr.type = PLDM_STATE_SENSOR_PDR;
369 pdr->hdr.record_change_num = 0;
370 pdr->hdr.length = sizeof(pldm_state_sensor_pdr) - sizeof(pldm_pdr_hdr);
371 pdr->terminus_handle = TERMINUS_HANDLE;
372 pdr->sensor_id = platformHandler->getNextSensorId();
373 if (entity_path != "" && associatedEntityMap.contains(entity_path))
374 {
375 pdr->entity_type = associatedEntityMap.at(entity_path).entity_type;
376 pdr->entity_instance =
377 associatedEntityMap.at(entity_path).entity_instance_num;
378 pdr->container_id =
379 associatedEntityMap.at(entity_path).entity_container_id;
380 }
381 else
382 {
383 // the slots are not present, dont create the PDR
384 continue;
385 }
386
387 pdr->sensor_init = PLDM_NO_INIT;
388 pdr->sensor_auxiliary_names_pdr = false;
389 pdr->composite_sensor_count = 1;
390
391 auto* possibleStatesPtr = pdr->possible_states;
392 auto possibleStates =
393 reinterpret_cast<state_sensor_possible_states*>(possibleStatesPtr);
394 possibleStates->state_set_id = PLDM_OEM_IBM_PCIE_SLOT_SENSOR_STATE;
395 possibleStates->possible_states_size = 1;
396 auto state =
397 reinterpret_cast<state_sensor_possible_states*>(possibleStates);
398 state->states[0].byte = 15;
399 pldm::responder::pdr_utils::PdrEntry pdrEntry{};
400 pdrEntry.data = entry.data();
401 pdrEntry.size = pdrSize;
402 repo.addRecord(pdrEntry);
403 }
404}
405
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500406void pldm::responder::oem_ibm_platform::Handler::buildOEMPDR(
407 pdr_utils::Repo& repo)
408{
Manojkiran Eda6b1d8832021-03-27 11:25:06 +0530409 buildAllCodeUpdateEffecterPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
410 ENTITY_INSTANCE_0, PLDM_OEM_IBM_BOOT_STATE,
411 repo);
412 buildAllCodeUpdateEffecterPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
413 ENTITY_INSTANCE_1, PLDM_OEM_IBM_BOOT_STATE,
414 repo);
415 buildAllCodeUpdateEffecterPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
416 ENTITY_INSTANCE_0,
417 PLDM_OEM_IBM_FIRMWARE_UPDATE_STATE, repo);
418 buildAllCodeUpdateEffecterPDR(this, PLDM_ENTITY_SYSTEM_CHASSIS,
Sagar Srinivas1b8d35f2021-11-10 10:54:40 -0600419 ENTITY_INSTANCE_1,
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600420 PLDM_OEM_IBM_SYSTEM_POWER_STATE, repo);
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500421
Manojkiran Edaa31ceb92021-07-22 09:19:02 +0530422 static constexpr auto objectPath = "/xyz/openbmc_project/inventory/system";
423 const std::vector<std::string> slotInterface = {
424 "xyz.openbmc_project.Inventory.Item.PCIeSlot"};
425 auto slotPaths = dBusIntf->getSubTreePaths(objectPath, 0, slotInterface);
426 buildAllSlotEnableEffecterPDR(this, repo, slotPaths);
427 buildAllSlotEnableSensorPDR(this, repo, slotPaths);
428
Manojkiran Eda6b1d8832021-03-27 11:25:06 +0530429 buildAllCodeUpdateSensorPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
430 ENTITY_INSTANCE_0, PLDM_OEM_IBM_BOOT_STATE,
431 repo);
432 buildAllCodeUpdateSensorPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
433 ENTITY_INSTANCE_1, PLDM_OEM_IBM_BOOT_STATE,
434 repo);
435 buildAllCodeUpdateSensorPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
436 ENTITY_INSTANCE_0,
437 PLDM_OEM_IBM_FIRMWARE_UPDATE_STATE, repo);
438 buildAllCodeUpdateSensorPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
439 ENTITY_INSTANCE_0,
440 PLDM_OEM_IBM_VERIFICATION_STATE, repo);
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500441 auto sensorId = findStateSensorId(
442 repo.getPdr(), 0, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
Sagar Srinivasf4a7dd72021-10-20 04:45:37 -0500443 ENTITY_INSTANCE_0, 1, PLDM_OEM_IBM_VERIFICATION_STATE);
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500444 codeUpdate->setMarkerLidSensor(sensorId);
445 sensorId = findStateSensorId(
446 repo.getPdr(), 0, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
Sagar Srinivasf4a7dd72021-10-20 04:45:37 -0500447 ENTITY_INSTANCE_0, 1, PLDM_OEM_IBM_FIRMWARE_UPDATE_STATE);
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500448 codeUpdate->setFirmwareUpdateSensor(sensorId);
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500449}
450
Sampa Misraaea5dde2020-08-31 08:33:47 -0500451void pldm::responder::oem_ibm_platform::Handler::setPlatformHandler(
452 pldm::responder::platform::Handler* handler)
453{
454 platformHandler = handler;
455}
456
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500457int pldm::responder::oem_ibm_platform::Handler::sendEventToHost(
Sampa Misrac0c79482021-06-02 08:01:54 -0500458 std::vector<uint8_t>& requestMsg, uint8_t instanceId)
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500459{
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500460 if (requestMsg.size())
461 {
462 std::ostringstream tempStream;
463 for (int byte : requestMsg)
464 {
465 tempStream << std::setfill('0') << std::setw(2) << std::hex << byte
466 << " ";
467 }
468 std::cout << tempStream.str() << std::endl;
469 }
Patrick Williams16c2a0a2024-08-16 15:20:59 -0400470 auto oemPlatformEventMessageResponseHandler = [](mctp_eid_t /*eid*/,
471 const pldm_msg* response,
472 size_t respMsgLen) {
Riya Dixit49cfb132023-03-02 04:26:53 -0600473 uint8_t completionCode{};
474 uint8_t status{};
475 auto rc = decode_platform_event_message_resp(response, respMsgLen,
476 &completionCode, &status);
477 if (rc || completionCode)
478 {
479 error(
Riya Dixitfc84f632024-04-06 14:00:02 -0500480 "Failed to decode platform event message response for code update event with response code '{RC}' and completion code '{CC}'",
Riya Dixit1e5c81e2024-05-03 07:54:00 -0500481 "RC", rc, "CC", completionCode);
Riya Dixit49cfb132023-03-02 04:26:53 -0600482 }
483 };
Sampa Misrac0c79482021-06-02 08:01:54 -0500484 auto rc = handler->registerRequest(
485 mctp_eid, instanceId, PLDM_PLATFORM, PLDM_PLATFORM_EVENT_MESSAGE,
486 std::move(requestMsg),
487 std::move(oemPlatformEventMessageResponseHandler));
488 if (rc)
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500489 {
Riya Dixit49cfb132023-03-02 04:26:53 -0600490 error("Failed to send BIOS attribute change event message ");
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500491 }
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500492
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500493 return rc;
494}
495
496int encodeEventMsg(uint8_t eventType, const std::vector<uint8_t>& eventDataVec,
497 std::vector<uint8_t>& requestMsg, uint8_t instanceId)
498{
499 auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
500
501 auto rc = encode_platform_event_message_req(
ArchanaKakani6c39c7a2022-12-05 04:36:35 -0600502 instanceId, 1 /*formatVersion*/, TERMINUS_ID /*tId*/, eventType,
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500503 eventDataVec.data(), eventDataVec.size(), request,
504 eventDataVec.size() + PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES);
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500505
506 return rc;
507}
508
509void pldm::responder::oem_ibm_platform::Handler::sendStateSensorEvent(
510 uint16_t sensorId, enum sensor_event_class_states sensorEventClass,
511 uint8_t sensorOffset, uint8_t eventState, uint8_t prevEventState)
512{
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500513 std::vector<uint8_t> sensorEventDataVec{};
514 size_t sensorEventSize = PLDM_SENSOR_EVENT_DATA_MIN_LENGTH + 1;
515 sensorEventDataVec.resize(sensorEventSize);
516 auto eventData = reinterpret_cast<struct pldm_sensor_event_data*>(
517 sensorEventDataVec.data());
518 eventData->sensor_id = sensorId;
519 eventData->sensor_event_class_type = sensorEventClass;
520 auto eventClassStart = eventData->event_class;
521 auto eventClass =
522 reinterpret_cast<struct pldm_sensor_event_state_sensor_state*>(
523 eventClassStart);
524 eventClass->sensor_offset = sensorOffset;
525 eventClass->event_state = eventState;
526 eventClass->previous_event_state = prevEventState;
Andrew Jefferya330b2f2023-05-04 14:55:37 +0930527 auto instanceId = instanceIdDb.next(mctp_eid);
Patrick Williams16c2a0a2024-08-16 15:20:59 -0400528 std::vector<uint8_t> requestMsg(
529 sizeof(pldm_msg_hdr) + PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
530 sensorEventDataVec.size());
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500531 auto rc = encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg,
532 instanceId);
533 if (rc != PLDM_SUCCESS)
534 {
Riya Dixitfc84f632024-04-06 14:00:02 -0500535 error("Failed to encode state sensor event with response code '{RC}'",
536 "RC", rc);
Andrew Jefferya330b2f2023-05-04 14:55:37 +0930537 instanceIdDb.free(mctp_eid, instanceId);
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500538 return;
539 }
Sampa Misrac0c79482021-06-02 08:01:54 -0500540 rc = sendEventToHost(requestMsg, instanceId);
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500541 if (rc != PLDM_SUCCESS)
542 {
Riya Dixitfc84f632024-04-06 14:00:02 -0500543 error(
544 "Failed to send event to remote terminus with response code '{RC}'",
545 "RC", rc);
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500546 }
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500547 return;
548}
549
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500550void pldm::responder::oem_ibm_platform::Handler::_processEndUpdate(
551 sdeventplus::source::EventBase& /*source */)
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500552{
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500553 assembleImageEvent.reset();
Adriana Kobylak9296f242021-09-22 15:52:00 +0000554 int retc = codeUpdate->assembleCodeUpdateImage();
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500555 if (retc != PLDM_SUCCESS)
556 {
557 codeUpdate->setCodeUpdateProgress(false);
558 auto sensorId = codeUpdate->getFirmwareUpdateSensor();
559 sendStateSensorEvent(sensorId, PLDM_STATE_SENSOR_STATE, 0,
560 uint8_t(CodeUpdateState::FAIL),
561 uint8_t(CodeUpdateState::START));
562 }
563}
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500564
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500565void pldm::responder::oem_ibm_platform::Handler::_processStartUpdate(
566 sdeventplus::source::EventBase& /*source */)
567{
568 codeUpdate->deleteImage();
569 CodeUpdateState state = CodeUpdateState::START;
570 auto rc = codeUpdate->setRequestedApplyTime();
571 if (rc != PLDM_SUCCESS)
572 {
Riya Dixit49cfb132023-03-02 04:26:53 -0600573 error("setRequestedApplyTime failed");
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500574 state = CodeUpdateState::FAIL;
575 }
576 auto sensorId = codeUpdate->getFirmwareUpdateSensor();
577 sendStateSensorEvent(sensorId, PLDM_STATE_SENSOR_STATE, 0, uint8_t(state),
578 uint8_t(CodeUpdateState::END));
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500579}
580
Kamalkumar Patel15ce5a12024-05-07 11:45:11 -0500581void pldm::responder::oem_ibm_platform::Handler::updateOemDbusPaths(
582 std::string& dbusPath)
583{
584 std::string toFind("system1/chassis1/motherboard1");
585 if (dbusPath.find(toFind) != std::string::npos)
586 {
587 size_t pos = dbusPath.find(toFind);
588 dbusPath.replace(pos, toFind.length(), "system/chassis/motherboard");
589 }
590 toFind = "system1";
591 if (dbusPath.find(toFind) != std::string::npos)
592 {
593 size_t pos = dbusPath.find(toFind);
594 dbusPath.replace(pos, toFind.length(), "system");
595 }
596 /* below logic to replace path 'motherboard/socket/chassis' to
597 'motherboard/chassis' or 'motherboard/socket123/chassis' to
598 'motherboard/chassis' */
599 toFind = "socket";
600 size_t pos1 = dbusPath.find(toFind);
601 // while loop to detect multiple substring 'socket' in the path
602 while (pos1 != std::string::npos)
603 {
604 size_t pos2 = dbusPath.substr(pos1 + 1).find('/') + 1;
Manojkiran Eda2576aec2024-06-17 12:05:17 +0530605 // Replacing starting from substring to next occurrence of char '/'
Kamalkumar Patel15ce5a12024-05-07 11:45:11 -0500606 dbusPath.replace(pos1, pos2 + 1, "");
607 pos1 = dbusPath.find(toFind);
608 }
609}
610
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600611void pldm::responder::oem_ibm_platform::Handler::_processSystemReboot(
612 sdeventplus::source::EventBase& /*source */)
613{
614 pldm::utils::PropertyValue value =
615 "xyz.openbmc_project.State.Chassis.Transition.Off";
616 pldm::utils::DBusMapping dbusMapping{"/xyz/openbmc_project/state/chassis0",
617 "xyz.openbmc_project.State.Chassis",
618 "RequestedPowerTransition", "string"};
619 try
620 {
621 dBusIntf->setDbusProperty(dbusMapping, value);
622 }
623 catch (const std::exception& e)
624 {
Riya Dixit49cfb132023-03-02 04:26:53 -0600625 error(
Riya Dixitfc84f632024-04-06 14:00:02 -0500626 "Failure in chassis State transition to Off, unable to set property RequestedPowerTransition, error - {ERROR}",
627 "ERROR", e);
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600628 }
629
630 using namespace sdbusplus::bus::match::rules;
Patrick Williams84b790c2022-07-22 19:26:56 -0500631 chassisOffMatch = std::make_unique<sdbusplus::bus::match_t>(
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600632 pldm::utils::DBusHandler::getBus(),
633 propertiesChanged("/xyz/openbmc_project/state/chassis0",
634 "xyz.openbmc_project.State.Chassis"),
Patrick Williams84b790c2022-07-22 19:26:56 -0500635 [this](sdbusplus::message_t& msg) {
Patrick Williams16c2a0a2024-08-16 15:20:59 -0400636 DbusChangedProps props{};
637 std::string intf;
638 msg.read(intf, props);
639 const auto itr = props.find("CurrentPowerState");
640 if (itr != props.end())
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600641 {
Patrick Williams16c2a0a2024-08-16 15:20:59 -0400642 PropertyValue value = itr->second;
643 auto propVal = std::get<std::string>(value);
644 if (propVal ==
645 "xyz.openbmc_project.State.Chassis.PowerState.Off")
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600646 {
Patrick Williams16c2a0a2024-08-16 15:20:59 -0400647 pldm::utils::DBusMapping dbusMapping{
648 "/xyz/openbmc_project/control/host0/"
649 "power_restore_policy/one_time",
650 "xyz.openbmc_project.Control.Power.RestorePolicy",
651 "PowerRestorePolicy", "string"};
652 value = "xyz.openbmc_project.Control.Power.RestorePolicy."
653 "Policy.AlwaysOn";
654 try
655 {
656 dBusIntf->setDbusProperty(dbusMapping, value);
657 }
658 catch (const std::exception& e)
659 {
660 error(
661 "Failure in setting one-time restore policy, unable to set property PowerRestorePolicy, error - {ERROR}",
662 "ERROR", e);
663 }
664 dbusMapping = pldm::utils::DBusMapping{
665 "/xyz/openbmc_project/state/bmc0",
666 "xyz.openbmc_project.State.BMC",
667 "RequestedBMCTransition", "string"};
668 value = "xyz.openbmc_project.State.BMC.Transition.Reboot";
669 try
670 {
671 dBusIntf->setDbusProperty(dbusMapping, value);
672 }
673 catch (const std::exception& e)
674 {
675 error(
676 "Failure in BMC state transition to reboot, unable to set property RequestedBMCTransition , error - {ERROR}",
677 "ERROR", e);
678 }
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600679 }
680 }
Patrick Williams16c2a0a2024-08-16 15:20:59 -0400681 });
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600682}
Sagar Srinivas79669c92021-04-28 15:43:30 -0500683
Sagar Srinivas7f760b32021-05-12 07:46:56 -0500684void pldm::responder::oem_ibm_platform::Handler::checkAndDisableWatchDog()
685{
686 if (!hostOff && setEventReceiverCnt == SET_EVENT_RECEIVER_SENT)
687 {
688 disableWatchDogTimer();
689 }
690
691 return;
692}
693
Sagar Srinivas79669c92021-04-28 15:43:30 -0500694bool pldm::responder::oem_ibm_platform::Handler::watchDogRunning()
695{
696 static constexpr auto watchDogObjectPath =
697 "/xyz/openbmc_project/watchdog/host0";
698 static constexpr auto watchDogEnablePropName = "Enabled";
699 static constexpr auto watchDogInterface =
700 "xyz.openbmc_project.State.Watchdog";
701 bool isWatchDogRunning = false;
702 try
703 {
704 isWatchDogRunning = pldm::utils::DBusHandler().getDbusProperty<bool>(
705 watchDogObjectPath, watchDogEnablePropName, watchDogInterface);
706 }
Kamalkumar Patel58cbcaf2023-10-06 03:48:25 -0500707 catch (const std::exception&)
Sagar Srinivas79669c92021-04-28 15:43:30 -0500708 {
709 return false;
710 }
711 return isWatchDogRunning;
712}
713
714void pldm::responder::oem_ibm_platform::Handler::resetWatchDogTimer()
715{
716 static constexpr auto watchDogService = "xyz.openbmc_project.Watchdog";
717 static constexpr auto watchDogObjectPath =
718 "/xyz/openbmc_project/watchdog/host0";
719 static constexpr auto watchDogInterface =
720 "xyz.openbmc_project.State.Watchdog";
721 static constexpr auto watchDogResetPropName = "ResetTimeRemaining";
722
723 bool wdStatus = watchDogRunning();
724 if (wdStatus == false)
725 {
726 return;
727 }
728 try
729 {
730 auto& bus = pldm::utils::DBusHandler::getBus();
731 auto resetMethod =
732 bus.new_method_call(watchDogService, watchDogObjectPath,
733 watchDogInterface, watchDogResetPropName);
734 resetMethod.append(true);
vkaverap@in.ibm.com5b71b862023-08-21 05:19:04 +0000735 bus.call_noreply(resetMethod, dbusTimeout);
Sagar Srinivas79669c92021-04-28 15:43:30 -0500736 }
737 catch (const std::exception& e)
738 {
Riya Dixitfc84f632024-04-06 14:00:02 -0500739 error("Failed to reset watchdog timer, error - {ERROR}", "ERROR", e);
Sagar Srinivas79669c92021-04-28 15:43:30 -0500740 return;
741 }
742}
Sagar Srinivas7f760b32021-05-12 07:46:56 -0500743
744void pldm::responder::oem_ibm_platform::Handler::disableWatchDogTimer()
745{
746 setEventReceiverCnt = 0;
Patrick Williams16c2a0a2024-08-16 15:20:59 -0400747 pldm::utils::DBusMapping dbusMapping{
748 "/xyz/openbmc_project/watchdog/host0",
749 "xyz.openbmc_project.State.Watchdog", "Enabled", "bool"};
Sagar Srinivas7f760b32021-05-12 07:46:56 -0500750 bool wdStatus = watchDogRunning();
751
752 if (!wdStatus)
753 {
754 return;
755 }
756 try
757 {
758 pldm::utils::DBusHandler().setDbusProperty(dbusMapping, false);
759 }
760 catch (const std::exception& e)
761 {
Riya Dixitfc84f632024-04-06 14:00:02 -0500762 error("Failed to disable watchdog timer, error - {ERROR}", "ERROR", e);
Sagar Srinivas7f760b32021-05-12 07:46:56 -0500763 }
764}
Pavithra Barithaya99854a72021-09-29 06:58:11 -0500765int pldm::responder::oem_ibm_platform::Handler::checkBMCState()
766{
Pavithra Barithaya7b4d59a2024-02-05 09:09:30 -0600767 using BMC = sdbusplus::client::xyz::openbmc_project::state::BMC<>;
768 auto bmcPath = sdbusplus::message::object_path(BMC::namespace_path::value) /
769 BMC::namespace_path::bmc;
Pavithra Barithaya99854a72021-09-29 06:58:11 -0500770 try
771 {
772 pldm::utils::PropertyValue propertyValue =
773 pldm::utils::DBusHandler().getDbusPropertyVariant(
Pavithra Barithaya7b4d59a2024-02-05 09:09:30 -0600774 bmcPath.str.c_str(), "CurrentBMCState", BMC::interface);
Pavithra Barithaya99854a72021-09-29 06:58:11 -0500775
776 if (std::get<std::string>(propertyValue) ==
777 "xyz.openbmc_project.State.BMC.BMCState.NotReady")
778 {
Riya Dixit49cfb132023-03-02 04:26:53 -0600779 error("GetPDR : PLDM stack is not ready for PDR exchange");
Pavithra Barithaya99854a72021-09-29 06:58:11 -0500780 return PLDM_ERROR_NOT_READY;
781 }
782 }
783 catch (const std::exception& e)
784 {
Riya Dixitfc84f632024-04-06 14:00:02 -0500785 error("Error getting the current BMC state, error - {ERROR}", "ERROR",
786 e);
Pavithra Barithaya99854a72021-09-29 06:58:11 -0500787 return PLDM_ERROR;
788 }
789 return PLDM_SUCCESS;
790}
791
Sagar Srinivas3687e2b2023-04-10 05:08:28 -0500792const pldm_pdr_record*
793 pldm::responder::oem_ibm_platform::Handler::fetchLastBMCRecord(
794 const pldm_pdr* repo)
795{
796 return pldm_pdr_find_last_in_range(repo, BMC_PDR_START_RANGE,
797 BMC_PDR_END_RANGE);
798}
799
800bool pldm::responder::oem_ibm_platform::Handler::checkRecordHandleInRange(
801 const uint32_t& record_handle)
802{
803 return record_handle >= HOST_PDR_START_RANGE &&
804 record_handle <= HOST_PDR_END_RANGE;
805}
806
Sagar Srinivas90314a32023-10-17 10:38:03 -0500807void Handler::processSetEventReceiver()
808{
809 this->setEventReceiver();
810}
811
Sagar Srinivas18145f72022-04-11 07:38:26 -0500812void pldm::responder::oem_ibm_platform::Handler::startStopTimer(bool value)
813{
814 if (value)
815 {
816 timer.restart(
817 std::chrono::seconds(HEARTBEAT_TIMEOUT + HEARTBEAT_TIMEOUT_DELTA));
818 }
819 else
820 {
821 timer.setEnabled(value);
822 }
823}
824
825void pldm::responder::oem_ibm_platform::Handler::setSurvTimer(uint8_t tid,
826 bool value)
827{
828 if ((hostOff || hostTransitioningToOff || (tid != HYPERVISOR_TID)) &&
829 timer.isEnabled())
830 {
831 startStopTimer(false);
832 return;
833 }
834 if (value)
835 {
836 startStopTimer(value);
837 }
838 else if (timer.isEnabled())
839 {
840 info(
841 "Failed to stop surveillance timer while remote terminus status is ‘{HOST_TRANST_OFF}’ with Terminus ID ‘{TID}’ ",
842 "HOST_TRANST_OFF", hostTransitioningToOff, "TID", tid);
843 startStopTimer(value);
844 pldm::utils::reportError(
845 "xyz.openbmc_project.PLDM.Error.setSurvTimer.RecvSurveillancePingFail");
846 }
847}
848
Sampa Misraaea5dde2020-08-31 08:33:47 -0500849} // namespace oem_ibm_platform
Sampa Misraaea5dde2020-08-31 08:33:47 -0500850} // namespace responder
Sampa Misraaea5dde2020-08-31 08:33:47 -0500851} // namespace pldm