blob: 380a25653d599b8b19d57f88a6a52cb1689bf330 [file] [log] [blame]
Sampa Misraaea5dde2020-08-31 08:33:47 -05001#pragma once
Varsha Kaverappabb585b22020-09-10 06:15:42 -05002
Manojkiran Edaa31ceb92021-07-22 09:19:02 +05303#include "collect_slot_vpd.hpp"
4#include "common/utils.hpp"
Sampa Misraaea5dde2020-08-31 08:33:47 -05005#include "inband_code_update.hpp"
Archana Kakani97a0f482025-03-10 05:39:38 -05006#include "libpldmresponder/bios_config.hpp"
Sampa Misraaea5dde2020-08-31 08:33:47 -05007#include "libpldmresponder/oem_handler.hpp"
Varsha Kaverappabb585b22020-09-10 06:15:42 -05008#include "libpldmresponder/pdr_utils.hpp"
Sampa Misraaea5dde2020-08-31 08:33:47 -05009#include "libpldmresponder/platform.hpp"
Sampa Misrac0c79482021-06-02 08:01:54 -050010#include "requester/handler.hpp"
Sampa Misraaea5dde2020-08-31 08:33:47 -050011
George Liuc453e162022-12-21 17:16:23 +080012#include <libpldm/entity.h>
Andrew Jeffery21f128d2024-01-15 15:34:26 +103013#include <libpldm/oem/ibm/state_set.h>
George Liuc453e162022-12-21 17:16:23 +080014#include <libpldm/platform.h>
George Liuc453e162022-12-21 17:16:23 +080015
Sagar Srinivas18145f72022-04-11 07:38:26 -050016#include <sdbusplus/bus/match.hpp>
17#include <sdeventplus/event.hpp>
18#include <sdeventplus/utility/timer.hpp>
19
Christian Geddes7f9523c2021-08-03 13:44:38 -050020typedef ibm_oem_pldm_state_set_firmware_update_state_values CodeUpdateState;
21
Sampa Misraaea5dde2020-08-31 08:33:47 -050022namespace pldm
23{
Sampa Misraaea5dde2020-08-31 08:33:47 -050024namespace responder
25{
Manojkiran Edaa31ceb92021-07-22 09:19:02 +053026using ObjectPath = std::string;
27using AssociatedEntityMap = std::map<ObjectPath, pldm_entity>;
Archana Kakani97a0f482025-03-10 05:39:38 -050028using namespace pldm::bios;
29using namespace pldm::utils;
30
Sampa Misraaea5dde2020-08-31 08:33:47 -050031namespace oem_ibm_platform
32{
Sagar Srinivas78a225a2020-08-27 00:52:20 -050033constexpr uint16_t ENTITY_INSTANCE_0 = 0;
34constexpr uint16_t ENTITY_INSTANCE_1 = 1;
35
Sagar Srinivas3687e2b2023-04-10 05:08:28 -050036constexpr uint32_t BMC_PDR_START_RANGE = 0x00000000;
37constexpr uint32_t BMC_PDR_END_RANGE = 0x00FFFFFF;
38constexpr uint32_t HOST_PDR_START_RANGE = 0x01000000;
39constexpr uint32_t HOST_PDR_END_RANGE = 0x01FFFFFF;
40
Sagar Srinivas18145f72022-04-11 07:38:26 -050041const pldm::pdr::TerminusID HYPERVISOR_TID = 208;
42
43static constexpr uint8_t HEARTBEAT_TIMEOUT_DELTA = 10;
44
Sagar Srinivas7f760b32021-05-12 07:46:56 -050045enum SetEventReceiverCount
46{
47 SET_EVENT_RECEIVER_SENT = 0x2,
48};
49
Sampa Misraaea5dde2020-08-31 08:33:47 -050050class Handler : public oem_platform::Handler
51{
52 public:
53 Handler(const pldm::utils::DBusHandler* dBusIntf,
Manojkiran Edaa31ceb92021-07-22 09:19:02 +053054 pldm::responder::CodeUpdate* codeUpdate,
55 pldm::responder::SlotHandler* slotHandler, int mctp_fd,
Andrew Jefferya330b2f2023-05-04 14:55:37 +093056 uint8_t mctp_eid, pldm::InstanceIdDb& instanceIdDb,
Brad Bishop5079ac42021-08-19 18:35:06 -040057 sdeventplus::Event& event,
Sampa Misrac0c79482021-06-02 08:01:54 -050058 pldm::requester::Handler<pldm::requester::Request>* handler) :
Patrick Williams16c2a0a2024-08-16 15:20:59 -040059 oem_platform::Handler(dBusIntf), codeUpdate(codeUpdate),
Manojkiran Edaa31ceb92021-07-22 09:19:02 +053060 slotHandler(slotHandler), platformHandler(nullptr), mctp_fd(mctp_fd),
61 mctp_eid(mctp_eid), instanceIdDb(instanceIdDb), event(event),
62 handler(handler),
Sagar Srinivas18145f72022-04-11 07:38:26 -050063 timer(event, std::bind(std::mem_fn(&Handler::setSurvTimer), this,
64 HYPERVISOR_TID, false)),
65 hostTransitioningToOff(true)
Sampa Misraaea5dde2020-08-31 08:33:47 -050066 {
67 codeUpdate->setVersions();
Sagar Srinivas7f760b32021-05-12 07:46:56 -050068 setEventReceiverCnt = 0;
69
70 using namespace sdbusplus::bus::match::rules;
Patrick Williams84b790c2022-07-22 19:26:56 -050071 hostOffMatch = std::make_unique<sdbusplus::bus::match_t>(
Sagar Srinivas7f760b32021-05-12 07:46:56 -050072 pldm::utils::DBusHandler::getBus(),
73 propertiesChanged("/xyz/openbmc_project/state/host0",
74 "xyz.openbmc_project.State.Host"),
Patrick Williams84b790c2022-07-22 19:26:56 -050075 [this](sdbusplus::message_t& msg) {
Patrick Williams16c2a0a2024-08-16 15:20:59 -040076 pldm::utils::DbusChangedProps props{};
77 std::string intf;
78 msg.read(intf, props);
79 const auto itr = props.find("CurrentHostState");
80 if (itr != props.end())
Sagar Srinivas7f760b32021-05-12 07:46:56 -050081 {
Patrick Williams16c2a0a2024-08-16 15:20:59 -040082 pldm::utils::PropertyValue value = itr->second;
83 auto propVal = std::get<std::string>(value);
84 if (propVal ==
85 "xyz.openbmc_project.State.Host.HostState.Off")
86 {
87 hostOff = true;
88 setEventReceiverCnt = 0;
89 disableWatchDogTimer();
90 startStopTimer(false);
91 }
92 else if (propVal ==
93 "xyz.openbmc_project.State.Host.HostState.Running")
94 {
95 hostOff = false;
96 hostTransitioningToOff = false;
97 }
98 else if (
99 propVal ==
100 "xyz.openbmc_project.State.Host.HostState.TransitioningToOff")
101 {
102 hostTransitioningToOff = true;
103 }
Sagar Srinivas7f760b32021-05-12 07:46:56 -0500104 }
Patrick Williams16c2a0a2024-08-16 15:20:59 -0400105 });
Pavithra Barithaya0fd6a092024-05-31 08:24:27 -0500106
Patrick Williams4f152f92024-06-18 02:38:34 -0500107 powerStateOffMatch = std::make_unique<sdbusplus::bus::match_t>(
Pavithra Barithaya0fd6a092024-05-31 08:24:27 -0500108 pldm::utils::DBusHandler::getBus(),
109 propertiesChanged("/xyz/openbmc_project/state/chassis0",
110 "xyz.openbmc_project.State.Chassis"),
Archana Kakani50554252025-03-17 01:37:29 -0500111 [this](sdbusplus::message_t& msg) {
Patrick Williams16c2a0a2024-08-16 15:20:59 -0400112 pldm::utils::DbusChangedProps props{};
113 std::string intf;
114 msg.read(intf, props);
115 const auto itr = props.find("CurrentPowerState");
116 if (itr != props.end())
Pavithra Barithaya0fd6a092024-05-31 08:24:27 -0500117 {
Patrick Williams16c2a0a2024-08-16 15:20:59 -0400118 pldm::utils::PropertyValue value = itr->second;
119 auto propVal = std::get<std::string>(value);
120 if (propVal ==
121 "xyz.openbmc_project.State.Chassis.PowerState.Off")
Pavithra Barithaya0fd6a092024-05-31 08:24:27 -0500122 {
Archana Kakani50554252025-03-17 01:37:29 -0500123 handleBootTypesAtChassisOff();
Patrick Williams16c2a0a2024-08-16 15:20:59 -0400124 static constexpr auto searchpath =
125 "/xyz/openbmc_project/inventory/system/chassis/motherboard";
126 int depth = 0;
127 std::vector<std::string> powerInterface = {
128 "xyz.openbmc_project.State.Decorator.PowerState"};
129 pldm::utils::GetSubTreeResponse response =
130 pldm::utils::DBusHandler().getSubtree(
131 searchpath, depth, powerInterface);
132 for (const auto& [objPath, serviceMap] : response)
Pavithra Barithaya0fd6a092024-05-31 08:24:27 -0500133 {
Patrick Williams16c2a0a2024-08-16 15:20:59 -0400134 pldm::utils::DBusMapping dbusMapping{
135 objPath,
136 "xyz.openbmc_project.State.Decorator.PowerState",
137 "PowerState", "string"};
138 value =
139 "xyz.openbmc_project.State.Decorator.PowerState.State.Off";
140 try
141 {
142 pldm::utils::DBusHandler().setDbusProperty(
143 dbusMapping, value);
144 }
145 catch (const std::exception& e)
146 {
147 error(
148 "Unable to set the slot power state to Off error - {ERROR}",
149 "ERROR", e);
150 }
Pavithra Barithaya0fd6a092024-05-31 08:24:27 -0500151 }
152 }
153 }
Patrick Williams16c2a0a2024-08-16 15:20:59 -0400154 });
Archana Kakanie26d13f2025-03-09 23:17:46 -0500155 updateBIOSMatch = std::make_unique<sdbusplus::bus::match_t>(
156 pldm::utils::DBusHandler::getBus(),
157 propertiesChanged("/xyz/openbmc_project/bios_config/manager",
158 "xyz.openbmc_project.BIOSConfig.Manager"),
159 [codeUpdate](sdbusplus::message_t& msg) {
160 constexpr auto propertyName = "PendingAttributes";
161 using Value =
162 std::variant<std::string, PendingAttributes, BaseBIOSTable>;
163 using Properties = std::map<pldm::utils::DbusProp, Value>;
164 Properties props{};
165 std::string intf;
166 msg.read(intf, props);
167 auto valPropMap = props.find(propertyName);
168 if (valPropMap == props.end())
169 {
170 return;
171 }
172
173 PendingAttributes pendingAttributes =
174 std::get<PendingAttributes>(valPropMap->second);
175 for (auto it : pendingAttributes)
176 {
177 if (it.first == "fw_boot_side")
178 {
179 auto& [attributeType, attributevalue] = it.second;
180 std::string nextBootSideAttr =
181 std::get<std::string>(attributevalue);
182 std::string nextBootSide =
183 (nextBootSideAttr == "Perm" ? Pside : Tside);
184 codeUpdate->setNextBootSide(nextBootSide);
185 }
186 }
187 });
Sampa Misraaea5dde2020-08-31 08:33:47 -0500188 }
189
190 int getOemStateSensorReadingsHandler(
Kamalkumar Patel7d427f12024-05-16 03:44:00 -0500191 pldm::pdr::EntityType entityType,
192 pldm::pdr::EntityInstance entityInstance,
Manojkiran Edaa31ceb92021-07-22 09:19:02 +0530193 pldm::pdr::ContainerID containerId, pldm::pdr::StateSetId stateSetId,
194 pldm::pdr::CompositeCount compSensorCnt, uint16_t sensorId,
Sampa Misraaea5dde2020-08-31 08:33:47 -0500195 std::vector<get_sensor_state_field>& stateField);
196
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500197 int oemSetStateEffecterStatesHandler(
Varsha Kaverappa3fbd39e2020-09-28 01:40:22 -0500198 uint16_t entityType, uint16_t entityInstance, uint16_t stateSetId,
199 uint8_t compEffecterCnt,
200 std::vector<set_effecter_state_field>& stateField, uint16_t effecterId);
Sampa Misraaea5dde2020-08-31 08:33:47 -0500201
202 /** @brief Method to set the platform handler in the
203 * oem_ibm_handler class
204 * @param[in] handler - pointer to PLDM platform handler
205 */
206 void setPlatformHandler(pldm::responder::platform::Handler* handler);
207
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500208 /** @brief Method to fetch the effecter ID of the code update PDRs
209 *
210 * @return platformHandler->getNextEffecterId() - returns the
211 * effecter ID from the platform handler
212 */
Manojkiran Eda6b1d8832021-03-27 11:25:06 +0530213 virtual uint16_t getNextEffecterId()
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500214 {
215 return platformHandler->getNextEffecterId();
216 }
217
218 /** @brief Method to fetch the sensor ID of the code update PDRs
219 *
220 * @return platformHandler->getNextSensorId() - returns the
221 * Sensor ID from the platform handler
222 */
Manojkiran Eda6b1d8832021-03-27 11:25:06 +0530223 virtual uint16_t getNextSensorId()
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500224 {
225 return platformHandler->getNextSensorId();
226 }
227
Manojkiran Edaa31ceb92021-07-22 09:19:02 +0530228 /** @brief Get std::map associated with the entity
229 * key: object path
230 * value: pldm_entity
231 *
232 * @return std::map<ObjectPath, pldm_entity>
233 */
234 virtual const AssociatedEntityMap& getAssociateEntityMap()
235 {
236 return platformHandler->getAssociateEntityMap();
237 }
238
Sagar Srinivas78a225a2020-08-27 00:52:20 -0500239 /** @brief Method to Generate the OEM PDRs
240 *
241 * @param[in] repo - instance of concrete implementation of Repo
242 */
243 void buildOEMPDR(pdr_utils::Repo& repo);
244
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500245 /** @brief Method to send code update event to host
246 * @param[in] sensorId - sendor ID
247 * @param[in] sensorEventClass - event class of sensor
248 * @param[in] sensorOffset - sensor offset
249 * @param[in] eventState - new code update event state
250 * @param[in] prevEventState - previous code update event state
251 * @return none
252 */
253 void sendStateSensorEvent(uint16_t sensorId,
254 enum sensor_event_class_states sensorEventClass,
255 uint8_t sensorOffset, uint8_t eventState,
256 uint8_t prevEventState);
257
258 /** @brief Method to send encoded request msg of code update event to host
259 * @param[in] requestMsg - encoded request msg
Sampa Misrac0c79482021-06-02 08:01:54 -0500260 * @param[in] instanceId - instance id of the message
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500261 * @return PLDM status code
262 */
Sampa Misrac0c79482021-06-02 08:01:54 -0500263 int sendEventToHost(std::vector<uint8_t>& requestMsg, uint8_t instanceId);
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500264
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500265 /** @brief _processEndUpdate processes the actual work that needs
266 * to be carried out after EndUpdate effecter is set. This is done async
267 * after sending response for EndUpdate set effecter
268 * @param[in] source - sdeventplus event source
269 */
270 void _processEndUpdate(sdeventplus::source::EventBase& source);
271
272 /** @brief _processStartUpdate processes the actual work that needs
273 * to be carried out after StartUpdate effecter is set. This is done async
274 * after sending response for StartUpdate set effecter
275 * @param[in] source - sdeventplus event source
276 */
277 void _processStartUpdate(sdeventplus::source::EventBase& source);
278
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600279 /** @brief _processSystemReboot processes the actual work that needs to be
280 * carried out after the System Power State effecter is set to reboot
281 * the system
282 * @param[in] source - sdeventplus event source
283 */
284 void _processSystemReboot(sdeventplus::source::EventBase& source);
285
Sagar Srinivas7f760b32021-05-12 07:46:56 -0500286 /*keeps track how many times setEventReceiver is sent */
287 void countSetEventReceiver()
288 {
289 setEventReceiverCnt++;
290 }
291
292 /* disables watchdog if running and Host is up */
293 void checkAndDisableWatchDog();
294
Sagar Srinivas79669c92021-04-28 15:43:30 -0500295 /** @brief To check if the watchdog app is running
296 *
297 * @return the running status of watchdog app
298 */
299 bool watchDogRunning();
300
301 /** @brief Method to reset the Watchdog timer on receiving platform Event
302 * Message for heartbeat elapsed time from Hostboot
303 */
304 void resetWatchDogTimer();
305
Sagar Srinivas7f760b32021-05-12 07:46:56 -0500306 /** @brief To disable to the watchdog timer on host poweron completion*/
307 void disableWatchDogTimer();
308
Pavithra Barithaya99854a72021-09-29 06:58:11 -0500309 /** @brief to check the BMC state*/
310 int checkBMCState();
311
Kamalkumar Patel15ce5a12024-05-07 11:45:11 -0500312 /** @brief update the dbus object paths */
313 void updateOemDbusPaths(std::string& dbusPath);
314
Sagar Srinivas3687e2b2023-04-10 05:08:28 -0500315 /** @brief Method to fetch the last BMC record from the PDR repo
316 *
317 * @param[in] repo - pointer to BMC's primary PDR repo
318 *
319 * @return the last BMC record from the repo
320 */
321 const pldm_pdr_record* fetchLastBMCRecord(const pldm_pdr* repo);
322
323 /** @brief Method to check if the record handle passed is in remote PDR
324 * record handle range
325 *
326 * @param[in] record_handle - record handle of the PDR
327 *
328 * @return true if record handle passed is in host PDR record handle range
329 */
330 bool checkRecordHandleInRange(const uint32_t& record_handle);
331
Sagar Srinivas90314a32023-10-17 10:38:03 -0500332 /** *brief Method to call the setEventReceiver command*/
333 void processSetEventReceiver();
334
335 /** @brief Method to call the setEventReceiver through the platform
336 * handler
337 */
338 virtual void setEventReceiver()
339 {
340 platformHandler->setEventReceiver();
341 }
342
Sagar Srinivas18145f72022-04-11 07:38:26 -0500343 /** @brief Method to Enable/Disable timer to see if remote terminus sends
344 * the surveillance ping and logs informational error if remote terminus
345 * fails to send the surveillance pings
346 *
347 * @param[in] tid - TID of the remote terminus
348 * @param[in] value - true or false, to indicate if the timer is
349 * running or not
350 */
351 void setSurvTimer(uint8_t tid, bool value);
352
Archana Kakani50554252025-03-17 01:37:29 -0500353 /** @brief To handle the boot types bios attributes at power on*/
354 void handleBootTypesAtPowerOn();
355
356 /** @brief To handle the boot types bios attributes at shutdown*/
357 void handleBootTypesAtChassisOff();
358
359 /** @brief To set the boot types bios attributes based on the RestartCause
360 * of host
361 *
362 * @param[in] RestartCause - Host restart cause
363 */
364 void setBootTypesBiosAttr(const std::string& restartCause);
365
Sampa Misraaea5dde2020-08-31 08:33:47 -0500366 ~Handler() = default;
367
368 pldm::responder::CodeUpdate* codeUpdate; //!< pointer to CodeUpdate object
Manojkiran Edaa31ceb92021-07-22 09:19:02 +0530369
370 pldm::responder::SlotHandler*
371 slotHandler; //!< pointer to SlotHandler object
372
Sampa Misraaea5dde2020-08-31 08:33:47 -0500373 pldm::responder::platform::Handler*
374 platformHandler; //!< pointer to PLDM platform handler
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500375
376 /** @brief fd of MCTP communications socket */
377 int mctp_fd;
378
379 /** @brief MCTP EID of host firmware */
380 uint8_t mctp_eid;
381
Andrew Jefferya330b2f2023-05-04 14:55:37 +0930382 /** @brief reference to an InstanceIdDb object, used to obtain a PLDM
383 * instance id. */
384 pldm::InstanceIdDb& instanceIdDb;
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500385 /** @brief sdeventplus event source */
386 std::unique_ptr<sdeventplus::source::Defer> assembleImageEvent;
387 std::unique_ptr<sdeventplus::source::Defer> startUpdateEvent;
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600388 std::unique_ptr<sdeventplus::source::Defer> systemRebootEvent;
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500389
Manojkiran Edaa31ceb92021-07-22 09:19:02 +0530390 /** @brief Effecterid to dbus object path map
391 */
392 std::unordered_map<uint16_t, std::string> effecterIdToDbusMap;
393
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500394 /** @brief reference of main event loop of pldmd, primarily used to schedule
395 * work
396 */
397 sdeventplus::Event& event;
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600398
399 private:
Sagar Srinivas18145f72022-04-11 07:38:26 -0500400 /** @brief Method to reset or stop the surveillance timer
401 *
402 * @param[in] value - true or false, to indicate if the timer
403 * should be reset or turned off
404 */
405 void startStopTimer(bool value);
406
Sagar Srinivas9a64b4a2021-02-09 07:55:38 -0600407 /** @brief D-Bus property changed signal match for CurrentPowerState*/
Patrick Williams84b790c2022-07-22 19:26:56 -0500408 std::unique_ptr<sdbusplus::bus::match_t> chassisOffMatch;
Sampa Misrac0c79482021-06-02 08:01:54 -0500409
410 /** @brief PLDM request handler */
411 pldm::requester::Handler<pldm::requester::Request>* handler;
Sagar Srinivas7f760b32021-05-12 07:46:56 -0500412
413 /** @brief D-Bus property changed signal match */
Archana Kakanie26d13f2025-03-09 23:17:46 -0500414 std::unique_ptr<sdbusplus::bus::match_t> updateBIOSMatch;
415
416 /** @brief D-Bus property changed signal match */
Patrick Williams84b790c2022-07-22 19:26:56 -0500417 std::unique_ptr<sdbusplus::bus::match_t> hostOffMatch;
Sagar Srinivas7f760b32021-05-12 07:46:56 -0500418
Pavithra Barithaya0fd6a092024-05-31 08:24:27 -0500419 /** @brief D-Bus property changed signal match */
420 std::unique_ptr<sdbusplus::bus::match_t> powerStateOffMatch;
421
Sagar Srinivas18145f72022-04-11 07:38:26 -0500422 /** @brief Timer used for monitoring surveillance pings from host */
423 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> timer;
424
Sagar Srinivas7f760b32021-05-12 07:46:56 -0500425 bool hostOff = true;
426
Sagar Srinivas18145f72022-04-11 07:38:26 -0500427 bool hostTransitioningToOff;
428
Sagar Srinivas7f760b32021-05-12 07:46:56 -0500429 int setEventReceiverCnt = 0;
Sampa Misraaea5dde2020-08-31 08:33:47 -0500430};
431
Varsha Kaverappabb585b22020-09-10 06:15:42 -0500432/** @brief Method to encode code update event msg
433 * @param[in] eventType - type of event
434 * @param[in] eventDataVec - vector of event data to be sent to host
435 * @param[in/out] requestMsg - request msg to be encoded
436 * @param[in] instanceId - instance ID
437 * @return PLDM status code
438 */
439int encodeEventMsg(uint8_t eventType, const std::vector<uint8_t>& eventDataVec,
440 std::vector<uint8_t>& requestMsg, uint8_t instanceId);
441
Sampa Misraaea5dde2020-08-31 08:33:47 -0500442} // namespace oem_ibm_platform
443
Archana Kakani97a0f482025-03-10 05:39:38 -0500444namespace oem_ibm_bios
445{
446/** @brief The file where bootside data will be saved */
447constexpr auto bootSideDirPath = "/var/lib/pldm/bootSide";
448
449class Handler : public oem_bios::Handler
450{
451 public:
452 Handler() {}
453
454 void processOEMBaseBiosTable(const BaseBIOSTable& biosTable)
455 {
456 for (const auto& [attrName, biostabObj] : biosTable)
457 {
458 // The additional check to see if /var/lib/pldm/bootSide file exists
459 // is added to make sure we are doing the fw_boot_side setting after
460 // the base bios table is initialised.
461 if ((attrName == "fw_boot_side") && fs::exists(bootSideDirPath))
462 {
463 PendingAttributesList biosAttrList;
464
465 std::string nextBootSide =
466 std::get<std::string>(std::get<5>(biostabObj));
467
468 std::string currNextBootSide;
469 auto attributeValue =
470 getBiosAttrValue<std::string>("fw_boot_side");
471
472 if (attributeValue.has_value())
473 {
474 currNextBootSide = attributeValue.value();
475 }
476 else
477 {
478 info(
479 "Boot side is not initialized yet, so setting default value");
480 currNextBootSide = "Temp";
481 }
482
483 if (currNextBootSide != nextBootSide)
484 {
485 biosAttrList.emplace_back(std::make_pair(
486 attrName,
487 std::make_tuple(EnumAttribute, nextBootSide)));
488 setBiosAttr(biosAttrList);
489 }
490 }
491 }
492 }
493};
494
495} // namespace oem_ibm_bios
496
Sampa Misraaea5dde2020-08-31 08:33:47 -0500497} // namespace responder
498
499} // namespace pldm