blob: 4cbbf15d684428237534c3f3f547212c58422f52 [file] [log] [blame]
Chris Cain78e86012021-03-04 16:15:31 -06001#pragma once
2
Chris Cain78e86012021-03-04 16:15:31 -06003#include "config.h"
4
George Liubddcf852021-09-08 08:46:22 +08005#ifdef POWER10
Chris Cain36f9cde2021-11-22 11:18:21 -06006#include "occ_command.hpp"
Chris Cain78e86012021-03-04 16:15:31 -06007
Chris Cain36f9cde2021-11-22 11:18:21 -06008#include <cereal/archives/json.hpp>
9//#include <cereal/archives/binary.hpp>
10#include <cereal/cereal.hpp>
11#include <cereal/types/string.hpp>
12#include <cereal/types/tuple.hpp>
13#include <cereal/types/vector.hpp>
Chris Cain78e86012021-03-04 16:15:31 -060014#include <sdbusplus/bus.hpp>
15#include <sdbusplus/bus/match.hpp>
Chris Cain1be43372021-12-09 19:29:37 -060016#include <xyz/openbmc_project/Control/Power/IdlePowerSaver/server.hpp>
17#include <xyz/openbmc_project/Control/Power/Mode/server.hpp>
Chris Cain78e86012021-03-04 16:15:31 -060018
George Liubcef3b42021-09-10 12:39:02 +080019#include <filesystem>
George Liub5ca1012021-09-10 12:53:11 +080020
Chris Cain78e86012021-03-04 16:15:31 -060021namespace open_power
22{
23namespace occ
24{
Chris Cain36f9cde2021-11-22 11:18:21 -060025
26class Manager;
27
Chris Cain78e86012021-03-04 16:15:31 -060028namespace powermode
29{
Chris Cain1be43372021-12-09 19:29:37 -060030namespace Base = sdbusplus::xyz::openbmc_project::Control::Power::server;
31using ModeInterface = sdbusplus::server::object::object<Base::Mode>;
32using IpsInterface = sdbusplus::server::object::object<Base::IdlePowerSaver>;
33using namespace std::literals::string_literals;
Chris Cain78e86012021-03-04 16:15:31 -060034
35constexpr auto PMODE_PATH = "/xyz/openbmc_project/control/host0/power_mode";
36constexpr auto PMODE_INTERFACE = "xyz.openbmc_project.Control.Power.Mode";
37constexpr auto POWER_MODE_PROP = "PowerMode";
Sheldon Bailey31a2f132022-05-20 11:31:52 -050038constexpr auto POWER_SAFE_MODE_PROP = "SafeMode";
Chris Cain78e86012021-03-04 16:15:31 -060039
Chris Cain1d51da22021-09-21 14:13:41 -050040constexpr auto PIPS_PATH = "/xyz/openbmc_project/control/host0/power_ips";
41constexpr auto PIPS_INTERFACE =
42 "xyz.openbmc_project.Control.Power.IdlePowerSaver";
Sheldon Baileyea2b22e2022-04-04 12:24:46 -050043constexpr auto IPS_ACTIVE_PROP = "Active";
Chris Cain1d51da22021-09-21 14:13:41 -050044constexpr auto IPS_ENABLED_PROP = "Enabled";
45constexpr auto IPS_ENTER_UTIL = "EnterUtilizationPercent";
46constexpr auto IPS_ENTER_TIME = "EnterDwellTime";
47constexpr auto IPS_EXIT_UTIL = "ExitUtilizationPercent";
48constexpr auto IPS_EXIT_TIME = "ExitDwellTime";
49
Chris Cain1be43372021-12-09 19:29:37 -060050const auto PMODE_DEFAULT_INTERFACE =
51 "xyz.openbmc_project.Configuration.PowerModeProperties"s;
52
Chris Cain36f9cde2021-11-22 11:18:21 -060053/** @brief Query the current Hypervisor target
54 * @return true if the current Hypervisor target is PowerVM
55 */
56bool isPowerVM();
57
Chris Cain78e86012021-03-04 16:15:31 -060058/** @brief Convert power mode string to OCC SysPwrMode value
59 *
60 * @param[in] i_modeString - power mode string
61 *
62 * @return SysPwrMode or SysPwrMode::NO_CHANGE if not found
63 */
64SysPwrMode convertStringToMode(const std::string& i_modeString);
65
Chris Cain1be43372021-12-09 19:29:37 -060066struct PowerModeData
Chris Cain36f9cde2021-11-22 11:18:21 -060067{
Chris Cain1be43372021-12-09 19:29:37 -060068 bool modeInitialized = false;
69 SysPwrMode mode = SysPwrMode::NO_CHANGE;
70 uint16_t oemModeData = 0x0000;
71 bool ipsInitialized = false;
72 bool ipsEnabled = true;
73 uint8_t ipsEnterUtil = 0;
74 uint16_t ipsEnterTime = 0;
75 uint8_t ipsExitUtil = 0;
76 uint16_t ipsExitTime = 0;
Ben Tyner3576d652022-05-22 18:05:53 -050077 bool modeLocked = false;
Chris Cain36f9cde2021-11-22 11:18:21 -060078
79 /** @brief Function specifying data to archive for cereal.
80 */
81 template <class Archive>
82 void serialize(Archive& archive)
83 {
Chris Cain1be43372021-12-09 19:29:37 -060084 archive(modeInitialized, mode, oemModeData, ipsInitialized, ipsEnabled,
Ben Tyner3576d652022-05-22 18:05:53 -050085 ipsEnterUtil, ipsEnterTime, ipsExitUtil, ipsExitTime,
86 modeLocked);
Chris Cain36f9cde2021-11-22 11:18:21 -060087 }
88};
89
90/** @class OccPersistData
91 * @brief Provides persistent container to store data for OCC
92 *
93 * Data is stored via cereal
94 */
95class OccPersistData
96{
97 public:
98 ~OccPersistData() = default;
99 OccPersistData(const OccPersistData&) = default;
100 OccPersistData& operator=(const OccPersistData&) = default;
101 OccPersistData(OccPersistData&&) = default;
102 OccPersistData& operator=(OccPersistData&&) = default;
103
Chris Cain1be43372021-12-09 19:29:37 -0600104 /** @brief Loads any saved power mode data */
Chris Cain36f9cde2021-11-22 11:18:21 -0600105 OccPersistData()
106 {
107 load();
108 }
109
110 /** @brief Save Power Mode data to persistent file
111 *
Chris Cain1be43372021-12-09 19:29:37 -0600112 * @param[in] newMode - desired System Power Mode
113 * @param[in] oemModeData - data required by some OEM Power Modes
Chris Cain36f9cde2021-11-22 11:18:21 -0600114 */
Chris Cain1be43372021-12-09 19:29:37 -0600115 void updateMode(const SysPwrMode newMode, const uint16_t oemModeData)
Chris Cain36f9cde2021-11-22 11:18:21 -0600116 {
Chris Cain1be43372021-12-09 19:29:37 -0600117 modeData.mode = newMode;
118 modeData.oemModeData = oemModeData;
119 modeData.modeInitialized = true;
Chris Cain36f9cde2021-11-22 11:18:21 -0600120 save();
121 }
122
Ben Tyner3576d652022-05-22 18:05:53 -0500123 /** @brief Save Power Mode Lock value to persistent file
124 *
125 * @param[in] modeLock - desired System Power Mode Lock
126 */
127 void updateModeLock(const bool modeLock)
128 {
129 modeData.modeLocked = modeLock;
130 save();
131 }
Chris Cain1be43372021-12-09 19:29:37 -0600132 /** @brief Write Idle Power Saver parameters to persistent file
Chris Cain36f9cde2021-11-22 11:18:21 -0600133 *
Chris Cain1be43372021-12-09 19:29:37 -0600134 * @param[in] enabled - Idle Power Save status (true = enabled)
135 * @param[in] enterUtil - IPS Enter Utilization (%)
136 * @param[in] enterTime - IPS Enter Time (seconds)
137 * @param[in] exitUtil - IPS Exit Utilization (%)
138 * @param[in] exitTime - IPS Exit Time (seconds)
Chris Cain36f9cde2021-11-22 11:18:21 -0600139 */
Chris Cain1be43372021-12-09 19:29:37 -0600140 void updateIPS(const bool enabled, const uint8_t enterUtil,
141 const uint16_t enterTime, const uint8_t exitUtil,
142 const uint16_t exitTime)
Chris Cain36f9cde2021-11-22 11:18:21 -0600143 {
Chris Cain1be43372021-12-09 19:29:37 -0600144 modeData.ipsEnabled = enabled;
145 modeData.ipsEnterUtil = enterUtil;
146 modeData.ipsEnterTime = enterTime;
147 modeData.ipsExitUtil = exitUtil;
148 modeData.ipsExitTime = exitTime;
149 modeData.ipsInitialized = true;
150 save();
151 }
152
153 /** @brief Return the Power Mode and mode data
154 *
155 * @param[out] mode - current system power mode
156 * @param[out] oemModeData - frequency data for some OEM mode
157 *
158 * @returns true if mode was available
159 */
160 bool getMode(SysPwrMode& mode, uint16_t& oemModeData) const
161 {
162 if (!modeData.modeInitialized)
Chris Cain36f9cde2021-11-22 11:18:21 -0600163 {
164 return false;
165 }
166
Chris Cain1be43372021-12-09 19:29:37 -0600167 mode = modeData.mode;
168 oemModeData = modeData.oemModeData;
Chris Cain36f9cde2021-11-22 11:18:21 -0600169 return true;
170 }
171
Chris Cain1be43372021-12-09 19:29:37 -0600172 /** @brief Get the Idle Power Saver properties from DBus
173 *
174 * @param[out] enabled - Idle Power Save status (true = enabled)
175 * @param[out] enterUtil - IPS Enter Utilization (%)
176 * @param[out] enterTime - IPS Enter Time (seconds)
177 * @param[out] exitUtil - IPS Exit Utilization (%)
178 * @param[out] exitTime - IPS Exit Time (seconds)
179 *
180 * @return true if parameters were read successfully
181 */
182 bool getIPS(bool& enabled, uint8_t& enterUtil, uint16_t& enterTime,
183 uint8_t& exitUtil, uint16_t& exitTime)
184 {
185 if (!modeData.ipsInitialized)
186 {
187 return false;
188 }
189
190 enabled = modeData.ipsEnabled;
191 enterUtil = modeData.ipsEnterUtil;
192 enterTime = modeData.ipsEnterTime;
193 exitUtil = modeData.ipsExitUtil;
194 exitTime = modeData.ipsExitTime;
195 return true;
196 }
197
Ben Tyner3576d652022-05-22 18:05:53 -0500198 /** @brief Return persisted mode lock */
199 bool getModeLock()
200 {
201 return modeData.modeLocked;
202 }
203
Chris Cain1be43372021-12-09 19:29:37 -0600204 /** @brief Return true if the power mode is available */
205 bool modeAvailable()
206 {
207 return (modeData.modeInitialized);
208 }
209
Chris Caincde7bea2022-01-28 15:54:24 -0600210 /** @brief Return true if the IPS data is available */
Chris Cain1be43372021-12-09 19:29:37 -0600211 bool ipsAvailable()
212 {
213 return (modeData.ipsInitialized);
214 }
215
Chris Cain36f9cde2021-11-22 11:18:21 -0600216 /** @brief Saves the Power Mode data in the filesystem using cereal. */
217 void save();
218
Chris Cain1be43372021-12-09 19:29:37 -0600219 /** @brief Trace the Power Mode and IPS parameters. */
220 void print();
Chris Cain36f9cde2021-11-22 11:18:21 -0600221
222 private:
Chris Cain1be43372021-12-09 19:29:37 -0600223 /** @brief Power Mode data filename to store persistent data */
224 static constexpr auto powerModeFilename = "powerModeData";
Chris Cain36f9cde2021-11-22 11:18:21 -0600225
Chris Cain1be43372021-12-09 19:29:37 -0600226 /** @brief Power Mode data object to be persisted */
227 PowerModeData modeData;
Chris Cain36f9cde2021-11-22 11:18:21 -0600228
229 /** @brief Loads the OEM mode data in the filesystem using cereal. */
230 void load();
231};
232
Chris Cain78e86012021-03-04 16:15:31 -0600233/** @class PowerMode
234 * @brief Monitors for changes to the power mode and notifies occ
235 *
236 * The customer power mode is provided to the OCC by host TMGT when the occ
237 * first goes active or is reset. This code is responsible for sending
238 * the power mode to the OCC if the mode is changed while the occ is active.
239 */
240
Chris Cain1be43372021-12-09 19:29:37 -0600241class PowerMode : public ModeInterface, public IpsInterface
Chris Cain78e86012021-03-04 16:15:31 -0600242{
243 public:
244 /** @brief PowerMode object to inform occ of changes to mode
245 *
246 * This object will monitor for changes to the power mode setting.
247 * If a change is detected, and the occ is active, then this object will
248 * notify the OCC of the change.
249 *
Chris Cain1be43372021-12-09 19:29:37 -0600250 * @param[in] managerRef - manager object reference
251 * @param[in] modePath - Power Mode dbus path
252 * @param[in] ipsPath - Idle Power Saver dbus path
Chris Cain78e86012021-03-04 16:15:31 -0600253 */
Chris Cain1be43372021-12-09 19:29:37 -0600254 explicit PowerMode(const Manager& managerRef, const char* modePath,
Sheldon Baileyea2b22e2022-04-04 12:24:46 -0500255 const char* ipsPath
256#ifdef POWER10
257 ,
258 EventPtr& event
259#endif
260 ) :
Chris Cain1be43372021-12-09 19:29:37 -0600261 ModeInterface(utils::getBus(), modePath, false),
262 IpsInterface(utils::getBus(), ipsPath, false), manager(managerRef),
Chris Cain78e86012021-03-04 16:15:31 -0600263 pmodeMatch(utils::getBus(),
264 sdbusplus::bus::match::rules::propertiesChanged(
265 PMODE_PATH, PMODE_INTERFACE),
Chris Cain36f9cde2021-11-22 11:18:21 -0600266 [this](auto& msg) { this->modeChanged(msg); }),
267 ipsMatch(utils::getBus(),
268 sdbusplus::bus::match::rules::propertiesChanged(
269 PIPS_PATH, PIPS_INTERFACE),
270 [this](auto& msg) { this->ipsChanged(msg); }),
Chris Cain1be43372021-12-09 19:29:37 -0600271 defaultsUpdateMatch(
272 utils::getBus(),
273 sdbusplus::bus::match::rules::propertiesChangedNamespace(
274 "/xyz/openbmc_project/inventory", PMODE_DEFAULT_INTERFACE),
275 [this](auto& msg) { this->defaultsReady(msg); }),
276 masterOccSet(false), masterActive(false)
Sheldon Baileyea2b22e2022-04-04 12:24:46 -0500277#ifdef POWER10
278 ,
279 event(event)
280#endif
Chris Cain1be43372021-12-09 19:29:37 -0600281 {
282 // restore Power Mode to DBus
283 SysPwrMode currentMode;
284 uint16_t oemModeData = 0;
285 if (getMode(currentMode, oemModeData))
286 {
287 updateDbusMode(currentMode);
288 }
289 // restore Idle Power Saver parameters to DBus
290 uint8_t enterUtil, exitUtil;
291 uint16_t enterTime, exitTime;
292 bool ipsEnabled;
293 if (getIPSParms(ipsEnabled, enterUtil, enterTime, exitUtil, exitTime))
294 {
295 updateDbusIPS(ipsEnabled, enterUtil, enterTime, exitUtil, exitTime);
296 }
297 };
Chris Cain36f9cde2021-11-22 11:18:21 -0600298
Chris Cain1be43372021-12-09 19:29:37 -0600299 /** @brief Initialize the persistent data with default values
300 *
301 * @return true if initialization completed
302 */
303 bool initPersistentData();
304
Ben Tyner3576d652022-05-22 18:05:53 -0500305 /** @brief Set the power mode lock (dbus method)
306 *
307 * @return true if successful
308 */
309 bool powerModeLock();
310
311 /** @brief Get the power mode lock status (dbus method)
312 *
313 * @return true if locked
314 */
315 bool powerModeLockStatus();
316
Chris Cain1be43372021-12-09 19:29:37 -0600317 /** @brief Set the current power mode property
318 *
319 * @param[in] newMode - desired system power mode
320 * @param[in] oemModeData - data required by some OEM Power Modes
321 *
322 * @return true if mode accepted
323 */
324 bool setMode(const SysPwrMode newMode, const uint16_t oemModeData);
Chris Cain36f9cde2021-11-22 11:18:21 -0600325
326 /** @brief Send mode change command to the master OCC
327 * @return SUCCESS on success
328 */
329 CmdStatus sendModeChange();
330
331 /** @brief Send Idle Power Saver config data to the master OCC
332 * @return SUCCESS on success
333 */
334 CmdStatus sendIpsData();
335
Chris Cain6fa848a2022-01-24 14:54:38 -0600336 /** @brief Set the master OCC path
337 *
338 * @param[in] occPath - hwmon path for master OCC
339 */
340 void setMasterOcc(const std::string& occPath);
341
Chris Cain36f9cde2021-11-22 11:18:21 -0600342 /** @brief Notify object of master OCC state. If not acitve, no
343 * commands will be sent to the master OCC
344 *
345 * @param[in] isActive - true when master OCC is active
346 */
347 void setMasterActive(const bool isActive = true)
348 {
349 masterActive = isActive;
350 };
Chris Cain78e86012021-03-04 16:15:31 -0600351
Sheldon Baileyea2b22e2022-04-04 12:24:46 -0500352#ifdef POWER10
353 /** @brief Starts to monitor for IPS active state change conditions
354 *
355 * @param[in] poll - Indicates whether or not the IPS state file should
356 * actually be read for changes.
357 */
358 void addIpsWatch(bool poll = true);
359
360 /** @brief Removes IPS active watch */
361 void removeIpsWatch();
362#endif
363
Sheldon Bailey31a2f132022-05-20 11:31:52 -0500364 /** @brief Set dbus property to SAFE Mode(true) or clear SAFE Mode(false)*/
365 void updateDbusSafeMode(const bool safeMode);
366
Ben Tyner3576d652022-05-22 18:05:53 -0500367 /** @brief override the set/get MODE function
368 *
369 * @param[in] value - Intended value
370 *
371 * @return - the value or Updated value of the property
372 */
373 Base::Mode::PowerMode powerMode(Base::Mode::PowerMode value) override;
374
Chris Cain78e86012021-03-04 16:15:31 -0600375 private:
Chris Cain36f9cde2021-11-22 11:18:21 -0600376 /** @brief OCC manager object */
377 const Manager& manager;
378
379 /** @brief Pass-through occ path on the bus */
380 std::string path;
381
382 /** @brief OCC instance number */
383 int occInstance;
384
385 /** @brief Object to send commands to the OCC */
Chris Cain6fa848a2022-01-24 14:54:38 -0600386 std::unique_ptr<open_power::occ::OccCommand> occCmd;
Chris Cain36f9cde2021-11-22 11:18:21 -0600387
388 /** @brief Used to subscribe to dbus pmode property changes **/
389 sdbusplus::bus::match_t pmodeMatch;
390
391 /** @brief Used to subscribe to dbus IPS property changes **/
392 sdbusplus::bus::match_t ipsMatch;
393
Chris Cain1be43372021-12-09 19:29:37 -0600394 /** @brief Used to subscribe to dbus defaults property changes **/
395 sdbusplus::bus::match_t defaultsUpdateMatch;
396
Chris Cain36f9cde2021-11-22 11:18:21 -0600397 OccPersistData persistedData;
398
Chris Cain6fa848a2022-01-24 14:54:38 -0600399 /** @brief True when the master OCC has been established */
400 bool masterOccSet;
401
402 /** @brief True when the master OCC is active */
Chris Cain36f9cde2021-11-22 11:18:21 -0600403 bool masterActive;
404
Sheldon Baileyea2b22e2022-04-04 12:24:46 -0500405#ifdef POWER10
406 /** @brief IPS status data filename to read */
407 const fs::path ipsStatusFile = std::filesystem::path{OCC_HWMON_PATH} /
408 std::filesystem::path{OCC_MASTER_NAME} /
409 "occ_ips_status";
410
411 /** @brief Current state of error watching */
412 bool watching = false;
413
414 /** @brief register for the callback from the POLL IPS changed event */
415 void registerIpsStatusCallBack();
416#endif
417
Chris Cain78e86012021-03-04 16:15:31 -0600418 /** @brief Callback for pmode setting changes
419 *
420 * Process change and inform OCC
421 *
422 * @param[in] msg - Data associated with pmode change signal
423 *
424 */
425 void modeChanged(sdbusplus::message::message& msg);
426
Chris Cain1be43372021-12-09 19:29:37 -0600427 /** @brief Get the current power mode property
428 *
429 * @param[out] currentMode - current system power mode
430 * @param[out] oemModeData - frequency data for some OEM mode
431 *
432 * @return true if data read successfully
Chris Cain1d51da22021-09-21 14:13:41 -0500433 */
Chris Cain1be43372021-12-09 19:29:37 -0600434 bool getMode(SysPwrMode& currentMode, uint16_t& oemModeData);
Chris Cain1d51da22021-09-21 14:13:41 -0500435
Chris Cain36f9cde2021-11-22 11:18:21 -0600436 /** @brief Update the power mode property on DBus
437 *
438 * @param[in] newMode - desired power mode
439 *
440 * @return true on success
441 */
442 bool updateDbusMode(const SysPwrMode newMode);
443
Chris Cain1d51da22021-09-21 14:13:41 -0500444 /** @brief Callback for IPS setting changes
445 *
446 * Process change and inform OCC
447 *
Chris Cain36f9cde2021-11-22 11:18:21 -0600448 * @param[in] msg - Data associated with IPS change signal
Chris Cain1d51da22021-09-21 14:13:41 -0500449 *
450 */
451 void ipsChanged(sdbusplus::message::message& msg);
452
Chris Cain1be43372021-12-09 19:29:37 -0600453 /** @brief Get the Idle Power Saver properties
454 *
455 * @param[out] enabled - Idle Power Save status (true = enabled)
456 * @param[out] enterUtil - IPS Enter Utilization (%)
457 * @param[out] enterTime - IPS Enter Time (seconds)
458 * @param[out] exitUtil - IPS Exit Utilization (%)
459 * @param[out] exitTime - IPS Exit Time (seconds)
460 *
461 * @return true if data read successfully
Chris Cain36f9cde2021-11-22 11:18:21 -0600462 */
Chris Cain1be43372021-12-09 19:29:37 -0600463 bool getIPSParms(bool& enabled, uint8_t& enterUtil, uint16_t& enterTime,
464 uint8_t& exitUtil, uint16_t& exitTime);
465
466 /** Update the Idle Power Saver data on DBus
467 *
468 * @param[in] enabled - Idle Power Save status (true = enabled)
469 * @param[in] enterUtil - IPS Enter Utilization (%)
470 * @param[in] enterTime - IPS Enter Time (seconds)
471 * @param[in] exitUtil - IPS Exit Utilization (%)
472 * @param[in] exitTime - IPS Exit Time (seconds)
473 *
474 * @return true if parameters were set successfully
475 */
476 bool updateDbusIPS(const bool enabled, const uint8_t enterUtil,
477 const uint16_t enterTime, const uint8_t exitUtil,
478 const uint16_t exitTime);
479
480 /** @brief Callback for entity manager default changes
481 *
482 * Called when PowerModeProperties defaults are available
483 */
484 void defaultsReady(sdbusplus::message::message& msg);
485
486 /** @brief Get the default power mode property for this system type
487 *
488 * @param[out] defaultMode - default system power mode
489 *
490 * @return true if data read successfully
491 */
492 bool getDefaultMode(SysPwrMode& defaultMode);
493
494 /** @brief Get the default Idle Power Saver properties for this system type
495 *
496 * @param[out] enabled - Idle Power Save status (true = enabled)
497 * @param[out] enterUtil - IPS Enter Utilization (%)
498 * @param[out] enterTime - IPS Enter Time (seconds)
499 * @param[out] exitUtil - IPS Exit Utilization (%)
500 * @param[out] exitTime - IPS Exit Time (seconds)
501 *
502 * @return true if parameters were read successfully
503 */
504 bool getDefaultIPSParms(bool& enabled, uint8_t& enterUtil,
505 uint16_t& enterTime, uint8_t& exitUtil,
506 uint16_t& exitTime);
Chris Caincde7bea2022-01-28 15:54:24 -0600507
508 /** @brief Read the default Idle Power Saver parameters and save them to the
509 * DBUS so they will get used
510 *
511 * @return true if restore was successful
512 */
513 bool useDefaultIPSParms();
Sheldon Baileyea2b22e2022-04-04 12:24:46 -0500514
515#ifdef POWER10
516 /** @brief callback for the POLL IPS changed event
517 *
518 * @param[in] es - Populated event source
519 * @param[in] fd - Associated File descriptor
520 * @param[in] revents - Type of event
521 * @param[in] userData - User data that was passed during registration
522 */
523 static int ipsStatusCallBack(sd_event_source* es, int fd, uint32_t revents,
524 void* userData);
525
526 /** @brief Opens the IPS file and populates fd */
527 bool openIpsFile();
528
529 /** @brief sd_event wrapped in unique_ptr */
530 EventPtr& event;
531
532 /** @brief event source wrapped in unique_ptr */
533 EventSourcePtr eventSource;
534
535 /** @brief When the ips status event is received, analyzes it */
536 virtual void analyzeIpsEvent();
537
538 protected:
539 /** @brief File descriptor to watch for errors */
540 int fd = -1;
541#endif
Chris Cain1d51da22021-09-21 14:13:41 -0500542};
543
Chris Cain78e86012021-03-04 16:15:31 -0600544} // namespace powermode
545
546} // namespace occ
547
548} // namespace open_power
549#endif