blob: a9b01def63bb0a9652ac5a6a44d8d07cbe482110 [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>
Chris Cain36f9cde2021-11-22 11:18:21 -06009#include <cereal/cereal.hpp>
10#include <cereal/types/string.hpp>
11#include <cereal/types/tuple.hpp>
12#include <cereal/types/vector.hpp>
Chris Cain78e86012021-03-04 16:15:31 -060013#include <sdbusplus/bus.hpp>
14#include <sdbusplus/bus/match.hpp>
Chris Cain1be43372021-12-09 19:29:37 -060015#include <xyz/openbmc_project/Control/Power/IdlePowerSaver/server.hpp>
16#include <xyz/openbmc_project/Control/Power/Mode/server.hpp>
Chris Cain78e86012021-03-04 16:15:31 -060017
George Liubcef3b42021-09-10 12:39:02 +080018#include <filesystem>
George Liub5ca1012021-09-10 12:53:11 +080019
Chris Cain78e86012021-03-04 16:15:31 -060020namespace open_power
21{
22namespace occ
23{
Chris Cain36f9cde2021-11-22 11:18:21 -060024
25class Manager;
26
Chris Cain78e86012021-03-04 16:15:31 -060027namespace powermode
28{
Chris Cain1be43372021-12-09 19:29:37 -060029namespace Base = sdbusplus::xyz::openbmc_project::Control::Power::server;
Patrick Williamsaf408082022-07-22 19:26:54 -050030using ModeInterface = sdbusplus::server::object_t<Base::Mode>;
31using IpsInterface = sdbusplus::server::object_t<Base::IdlePowerSaver>;
Chris Cain1be43372021-12-09 19:29:37 -060032using namespace std::literals::string_literals;
Chris Cain78e86012021-03-04 16:15:31 -060033
34constexpr auto PMODE_PATH = "/xyz/openbmc_project/control/host0/power_mode";
35constexpr auto PMODE_INTERFACE = "xyz.openbmc_project.Control.Power.Mode";
36constexpr auto POWER_MODE_PROP = "PowerMode";
Sheldon Bailey31a2f132022-05-20 11:31:52 -050037constexpr auto POWER_SAFE_MODE_PROP = "SafeMode";
Chris Cain78e86012021-03-04 16:15:31 -060038
Chris Cain1d51da22021-09-21 14:13:41 -050039constexpr auto PIPS_PATH = "/xyz/openbmc_project/control/host0/power_ips";
40constexpr auto PIPS_INTERFACE =
41 "xyz.openbmc_project.Control.Power.IdlePowerSaver";
Sheldon Baileyea2b22e2022-04-04 12:24:46 -050042constexpr auto IPS_ACTIVE_PROP = "Active";
Chris Cain1d51da22021-09-21 14:13:41 -050043constexpr auto IPS_ENABLED_PROP = "Enabled";
44constexpr auto IPS_ENTER_UTIL = "EnterUtilizationPercent";
45constexpr auto IPS_ENTER_TIME = "EnterDwellTime";
46constexpr auto IPS_EXIT_UTIL = "ExitUtilizationPercent";
47constexpr auto IPS_EXIT_TIME = "ExitDwellTime";
48
Chris Cain1be43372021-12-09 19:29:37 -060049const auto PMODE_DEFAULT_INTERFACE =
50 "xyz.openbmc_project.Configuration.PowerModeProperties"s;
51
Chris Cain36f9cde2021-11-22 11:18:21 -060052/** @brief Query the current Hypervisor target
53 * @return true if the current Hypervisor target is PowerVM
54 */
55bool isPowerVM();
56
Chris Cain78e86012021-03-04 16:15:31 -060057/** @brief Convert power mode string to OCC SysPwrMode value
58 *
59 * @param[in] i_modeString - power mode string
60 *
61 * @return SysPwrMode or SysPwrMode::NO_CHANGE if not found
62 */
63SysPwrMode convertStringToMode(const std::string& i_modeString);
64
Chris Cain1be43372021-12-09 19:29:37 -060065struct PowerModeData
Chris Cain36f9cde2021-11-22 11:18:21 -060066{
Chris Cain1be43372021-12-09 19:29:37 -060067 bool modeInitialized = false;
68 SysPwrMode mode = SysPwrMode::NO_CHANGE;
69 uint16_t oemModeData = 0x0000;
70 bool ipsInitialized = false;
71 bool ipsEnabled = true;
72 uint8_t ipsEnterUtil = 0;
73 uint16_t ipsEnterTime = 0;
74 uint8_t ipsExitUtil = 0;
75 uint16_t ipsExitTime = 0;
Ben Tyner3576d652022-05-22 18:05:53 -050076 bool modeLocked = false;
Chris Cain36f9cde2021-11-22 11:18:21 -060077
78 /** @brief Function specifying data to archive for cereal.
79 */
80 template <class Archive>
81 void serialize(Archive& archive)
82 {
Chris Cain1be43372021-12-09 19:29:37 -060083 archive(modeInitialized, mode, oemModeData, ipsInitialized, ipsEnabled,
Ben Tyner3576d652022-05-22 18:05:53 -050084 ipsEnterUtil, ipsEnterTime, ipsExitUtil, ipsExitTime,
85 modeLocked);
Chris Cain36f9cde2021-11-22 11:18:21 -060086 }
87};
88
89/** @class OccPersistData
90 * @brief Provides persistent container to store data for OCC
91 *
92 * Data is stored via cereal
93 */
94class OccPersistData
95{
96 public:
97 ~OccPersistData() = default;
98 OccPersistData(const OccPersistData&) = default;
99 OccPersistData& operator=(const OccPersistData&) = default;
100 OccPersistData(OccPersistData&&) = default;
101 OccPersistData& operator=(OccPersistData&&) = default;
102
Chris Cain1be43372021-12-09 19:29:37 -0600103 /** @brief Loads any saved power mode data */
Chris Cain36f9cde2021-11-22 11:18:21 -0600104 OccPersistData()
105 {
106 load();
107 }
108
109 /** @brief Save Power Mode data to persistent file
110 *
Chris Cain1be43372021-12-09 19:29:37 -0600111 * @param[in] newMode - desired System Power Mode
112 * @param[in] oemModeData - data required by some OEM Power Modes
Chris Cain36f9cde2021-11-22 11:18:21 -0600113 */
Chris Cain1be43372021-12-09 19:29:37 -0600114 void updateMode(const SysPwrMode newMode, const uint16_t oemModeData)
Chris Cain36f9cde2021-11-22 11:18:21 -0600115 {
Chris Cain1be43372021-12-09 19:29:37 -0600116 modeData.mode = newMode;
117 modeData.oemModeData = oemModeData;
118 modeData.modeInitialized = true;
Chris Cain36f9cde2021-11-22 11:18:21 -0600119 save();
120 }
121
Ben Tyner3576d652022-05-22 18:05:53 -0500122 /** @brief Save Power Mode Lock value to persistent file
123 *
124 * @param[in] modeLock - desired System Power Mode Lock
125 */
126 void updateModeLock(const bool modeLock)
127 {
128 modeData.modeLocked = modeLock;
129 save();
130 }
Chris Cain1be43372021-12-09 19:29:37 -0600131 /** @brief Write Idle Power Saver parameters to persistent file
Chris Cain36f9cde2021-11-22 11:18:21 -0600132 *
Chris Cain1be43372021-12-09 19:29:37 -0600133 * @param[in] enabled - Idle Power Save status (true = enabled)
134 * @param[in] enterUtil - IPS Enter Utilization (%)
135 * @param[in] enterTime - IPS Enter Time (seconds)
136 * @param[in] exitUtil - IPS Exit Utilization (%)
137 * @param[in] exitTime - IPS Exit Time (seconds)
Chris Cain36f9cde2021-11-22 11:18:21 -0600138 */
Chris Cain1be43372021-12-09 19:29:37 -0600139 void updateIPS(const bool enabled, const uint8_t enterUtil,
140 const uint16_t enterTime, const uint8_t exitUtil,
141 const uint16_t exitTime)
Chris Cain36f9cde2021-11-22 11:18:21 -0600142 {
Chris Cain1be43372021-12-09 19:29:37 -0600143 modeData.ipsEnabled = enabled;
144 modeData.ipsEnterUtil = enterUtil;
145 modeData.ipsEnterTime = enterTime;
146 modeData.ipsExitUtil = exitUtil;
147 modeData.ipsExitTime = exitTime;
148 modeData.ipsInitialized = true;
149 save();
150 }
151
152 /** @brief Return the Power Mode and mode data
153 *
154 * @param[out] mode - current system power mode
155 * @param[out] oemModeData - frequency data for some OEM mode
156 *
157 * @returns true if mode was available
158 */
159 bool getMode(SysPwrMode& mode, uint16_t& oemModeData) const
160 {
Chris Cain30040d92024-06-19 16:50:34 -0500161 if (modeData.modeInitialized)
Chris Cain36f9cde2021-11-22 11:18:21 -0600162 {
Chris Cain30040d92024-06-19 16:50:34 -0500163 mode = modeData.mode;
164 oemModeData = modeData.oemModeData;
Chris Cain36f9cde2021-11-22 11:18:21 -0600165 }
Chris Cain30040d92024-06-19 16:50:34 -0500166 return modeData.modeInitialized;
Chris Cain36f9cde2021-11-22 11:18:21 -0600167 }
168
Chris Cain1be43372021-12-09 19:29:37 -0600169 /** @brief Get the Idle Power Saver properties from DBus
170 *
171 * @param[out] enabled - Idle Power Save status (true = enabled)
172 * @param[out] enterUtil - IPS Enter Utilization (%)
173 * @param[out] enterTime - IPS Enter Time (seconds)
174 * @param[out] exitUtil - IPS Exit Utilization (%)
175 * @param[out] exitTime - IPS Exit Time (seconds)
176 *
177 * @return true if parameters were read successfully
178 */
179 bool getIPS(bool& enabled, uint8_t& enterUtil, uint16_t& enterTime,
180 uint8_t& exitUtil, uint16_t& exitTime)
181 {
182 if (!modeData.ipsInitialized)
183 {
184 return false;
185 }
186
187 enabled = modeData.ipsEnabled;
188 enterUtil = modeData.ipsEnterUtil;
189 enterTime = modeData.ipsEnterTime;
190 exitUtil = modeData.ipsExitUtil;
191 exitTime = modeData.ipsExitTime;
192 return true;
193 }
194
Ben Tyner3576d652022-05-22 18:05:53 -0500195 /** @brief Return persisted mode lock */
196 bool getModeLock()
197 {
198 return modeData.modeLocked;
199 }
200
Chris Cain1be43372021-12-09 19:29:37 -0600201 /** @brief Return true if the power mode is available */
202 bool modeAvailable()
203 {
204 return (modeData.modeInitialized);
205 }
206
Chris Caincde7bea2022-01-28 15:54:24 -0600207 /** @brief Return true if the IPS data is available */
Chris Cain1be43372021-12-09 19:29:37 -0600208 bool ipsAvailable()
209 {
210 return (modeData.ipsInitialized);
211 }
212
Chris Cain36f9cde2021-11-22 11:18:21 -0600213 /** @brief Saves the Power Mode data in the filesystem using cereal. */
214 void save();
215
Chris Cain1be43372021-12-09 19:29:37 -0600216 /** @brief Trace the Power Mode and IPS parameters. */
217 void print();
Chris Cain36f9cde2021-11-22 11:18:21 -0600218
Chris Cain30040d92024-06-19 16:50:34 -0500219 /** @brief Invalidate the persisted mode */
220 void invalidateMode()
221 {
222 modeData.modeInitialized = false;
223 }
224
Chris Cain36f9cde2021-11-22 11:18:21 -0600225 private:
Chris Cain1be43372021-12-09 19:29:37 -0600226 /** @brief Power Mode data filename to store persistent data */
227 static constexpr auto powerModeFilename = "powerModeData";
Chris Cain36f9cde2021-11-22 11:18:21 -0600228
Chris Cain1be43372021-12-09 19:29:37 -0600229 /** @brief Power Mode data object to be persisted */
230 PowerModeData modeData;
Chris Cain36f9cde2021-11-22 11:18:21 -0600231
232 /** @brief Loads the OEM mode data in the filesystem using cereal. */
233 void load();
234};
235
Chris Cain78e86012021-03-04 16:15:31 -0600236/** @class PowerMode
237 * @brief Monitors for changes to the power mode and notifies occ
238 *
239 * The customer power mode is provided to the OCC by host TMGT when the occ
240 * first goes active or is reset. This code is responsible for sending
241 * the power mode to the OCC if the mode is changed while the occ is active.
242 */
243
Chris Cain1be43372021-12-09 19:29:37 -0600244class PowerMode : public ModeInterface, public IpsInterface
Chris Cain78e86012021-03-04 16:15:31 -0600245{
246 public:
247 /** @brief PowerMode object to inform occ of changes to mode
248 *
249 * This object will monitor for changes to the power mode setting.
250 * If a change is detected, and the occ is active, then this object will
251 * notify the OCC of the change.
252 *
Chris Cain1be43372021-12-09 19:29:37 -0600253 * @param[in] managerRef - manager object reference
254 * @param[in] modePath - Power Mode dbus path
255 * @param[in] ipsPath - Idle Power Saver dbus path
Chris Cain78e86012021-03-04 16:15:31 -0600256 */
Chris Cain1be43372021-12-09 19:29:37 -0600257 explicit PowerMode(const Manager& managerRef, const char* modePath,
Chris Cain30040d92024-06-19 16:50:34 -0500258 const char* ipsPath, EventPtr& event);
Chris Cain36f9cde2021-11-22 11:18:21 -0600259
Chris Cain1be43372021-12-09 19:29:37 -0600260 /** @brief Initialize the persistent data with default values
261 *
262 * @return true if initialization completed
263 */
264 bool initPersistentData();
265
Ben Tyner3576d652022-05-22 18:05:53 -0500266 /** @brief Set the power mode lock (dbus method)
267 *
268 * @return true if successful
269 */
270 bool powerModeLock();
271
272 /** @brief Get the power mode lock status (dbus method)
273 *
274 * @return true if locked
275 */
276 bool powerModeLockStatus();
277
Chris Cain1be43372021-12-09 19:29:37 -0600278 /** @brief Set the current power mode property
279 *
280 * @param[in] newMode - desired system power mode
281 * @param[in] oemModeData - data required by some OEM Power Modes
282 *
283 * @return true if mode accepted
284 */
285 bool setMode(const SysPwrMode newMode, const uint16_t oemModeData);
Chris Cain36f9cde2021-11-22 11:18:21 -0600286
287 /** @brief Send mode change command to the master OCC
288 * @return SUCCESS on success
289 */
290 CmdStatus sendModeChange();
291
292 /** @brief Send Idle Power Saver config data to the master OCC
293 * @return SUCCESS on success
294 */
295 CmdStatus sendIpsData();
296
Chris Cain6fa848a2022-01-24 14:54:38 -0600297 /** @brief Set the master OCC path
298 *
299 * @param[in] occPath - hwmon path for master OCC
300 */
301 void setMasterOcc(const std::string& occPath);
302
Chris Cain36f9cde2021-11-22 11:18:21 -0600303 /** @brief Notify object of master OCC state. If not acitve, no
304 * commands will be sent to the master OCC
305 *
306 * @param[in] isActive - true when master OCC is active
307 */
308 void setMasterActive(const bool isActive = true)
309 {
310 masterActive = isActive;
311 };
Chris Cain78e86012021-03-04 16:15:31 -0600312
Sheldon Baileyea2b22e2022-04-04 12:24:46 -0500313 /** @brief Starts to monitor for IPS active state change conditions
314 *
315 * @param[in] poll - Indicates whether or not the IPS state file should
316 * actually be read for changes.
317 */
318 void addIpsWatch(bool poll = true);
319
320 /** @brief Removes IPS active watch */
321 void removeIpsWatch();
Sheldon Baileyea2b22e2022-04-04 12:24:46 -0500322
Sheldon Bailey31a2f132022-05-20 11:31:52 -0500323 /** @brief Set dbus property to SAFE Mode(true) or clear SAFE Mode(false)*/
324 void updateDbusSafeMode(const bool safeMode);
325
Ben Tyner3576d652022-05-22 18:05:53 -0500326 /** @brief override the set/get MODE function
327 *
328 * @param[in] value - Intended value
329 *
330 * @return - the value or Updated value of the property
331 */
332 Base::Mode::PowerMode powerMode(Base::Mode::PowerMode value) override;
333
Chris Cain30040d92024-06-19 16:50:34 -0500334 /** @brief Determine if the supplied mode is valid for the system
335 *
336 * @param[in] mode - potential mode
337 *
338 * @return - true if the mode is valid
339 */
340 bool isValidMode(const SysPwrMode mode);
341
Chris Cain78e86012021-03-04 16:15:31 -0600342 private:
Chris Cain36f9cde2021-11-22 11:18:21 -0600343 /** @brief OCC manager object */
344 const Manager& manager;
345
346 /** @brief Pass-through occ path on the bus */
347 std::string path;
348
349 /** @brief OCC instance number */
350 int occInstance;
351
352 /** @brief Object to send commands to the OCC */
Chris Cain6fa848a2022-01-24 14:54:38 -0600353 std::unique_ptr<open_power::occ::OccCommand> occCmd;
Chris Cain36f9cde2021-11-22 11:18:21 -0600354
Chris Cain36f9cde2021-11-22 11:18:21 -0600355 /** @brief Used to subscribe to dbus IPS property changes **/
356 sdbusplus::bus::match_t ipsMatch;
357
Chris Cain1be43372021-12-09 19:29:37 -0600358 /** @brief Used to subscribe to dbus defaults property changes **/
359 sdbusplus::bus::match_t defaultsUpdateMatch;
360
Chris Cain36f9cde2021-11-22 11:18:21 -0600361 OccPersistData persistedData;
362
Chris Cain30040d92024-06-19 16:50:34 -0500363 /** @brief True when the master OCC has been established **/
Chris Cain6fa848a2022-01-24 14:54:38 -0600364 bool masterOccSet;
365
Chris Cain30040d92024-06-19 16:50:34 -0500366 /** @brief True when the master OCC is active **/
Chris Cain36f9cde2021-11-22 11:18:21 -0600367 bool masterActive;
368
Chris Cain30040d92024-06-19 16:50:34 -0500369 /** @brief True when the ecoModes are supported for this system **/
370 bool ecoModeSupport = false;
371
372 /** @brief List of customer supported power modes **/
373 std::set<SysPwrMode> customerModeList = {
374 SysPwrMode::STATIC, SysPwrMode::POWER_SAVING, SysPwrMode::MAX_PERF};
375
376 /** @brief List of OEM supported power modes **/
377 std::set<SysPwrMode> oemModeList = {SysPwrMode::SFP, SysPwrMode::FFO,
378 SysPwrMode::MAX_FREQ};
379
Sheldon Baileyea2b22e2022-04-04 12:24:46 -0500380 /** @brief IPS status data filename to read */
Patrick Williamsd7542c82024-08-16 15:20:28 -0400381 const fs::path ipsStatusFile =
382 std::filesystem::path{OCC_HWMON_PATH} /
383 std::filesystem::path{OCC_MASTER_NAME} / "occ_ips_status";
Sheldon Baileyea2b22e2022-04-04 12:24:46 -0500384
385 /** @brief Current state of error watching */
386 bool watching = false;
387
388 /** @brief register for the callback from the POLL IPS changed event */
389 void registerIpsStatusCallBack();
Chris Cain78e86012021-03-04 16:15:31 -0600390
Chris Cain1be43372021-12-09 19:29:37 -0600391 /** @brief Get the current power mode property
392 *
393 * @param[out] currentMode - current system power mode
394 * @param[out] oemModeData - frequency data for some OEM mode
395 *
396 * @return true if data read successfully
Chris Cain1d51da22021-09-21 14:13:41 -0500397 */
Chris Cain1be43372021-12-09 19:29:37 -0600398 bool getMode(SysPwrMode& currentMode, uint16_t& oemModeData);
Chris Cain1d51da22021-09-21 14:13:41 -0500399
Chris Cain36f9cde2021-11-22 11:18:21 -0600400 /** @brief Update the power mode property on DBus
401 *
402 * @param[in] newMode - desired power mode
403 *
404 * @return true on success
405 */
406 bool updateDbusMode(const SysPwrMode newMode);
407
Chris Cain1d51da22021-09-21 14:13:41 -0500408 /** @brief Callback for IPS setting changes
409 *
410 * Process change and inform OCC
411 *
Chris Cain36f9cde2021-11-22 11:18:21 -0600412 * @param[in] msg - Data associated with IPS change signal
Chris Cain1d51da22021-09-21 14:13:41 -0500413 *
414 */
Patrick Williamsaf408082022-07-22 19:26:54 -0500415 void ipsChanged(sdbusplus::message_t& msg);
Chris Cain1d51da22021-09-21 14:13:41 -0500416
Chris Cain1be43372021-12-09 19:29:37 -0600417 /** @brief Get the Idle Power Saver properties
418 *
419 * @param[out] enabled - Idle Power Save status (true = enabled)
420 * @param[out] enterUtil - IPS Enter Utilization (%)
421 * @param[out] enterTime - IPS Enter Time (seconds)
422 * @param[out] exitUtil - IPS Exit Utilization (%)
423 * @param[out] exitTime - IPS Exit Time (seconds)
424 *
425 * @return true if data read successfully
Chris Cain36f9cde2021-11-22 11:18:21 -0600426 */
Chris Cain1be43372021-12-09 19:29:37 -0600427 bool getIPSParms(bool& enabled, uint8_t& enterUtil, uint16_t& enterTime,
428 uint8_t& exitUtil, uint16_t& exitTime);
429
430 /** Update the Idle Power Saver data on DBus
431 *
432 * @param[in] enabled - Idle Power Save status (true = enabled)
433 * @param[in] enterUtil - IPS Enter Utilization (%)
434 * @param[in] enterTime - IPS Enter Time (seconds)
435 * @param[in] exitUtil - IPS Exit Utilization (%)
436 * @param[in] exitTime - IPS Exit Time (seconds)
437 *
438 * @return true if parameters were set successfully
439 */
440 bool updateDbusIPS(const bool enabled, const uint8_t enterUtil,
441 const uint16_t enterTime, const uint8_t exitUtil,
442 const uint16_t exitTime);
443
444 /** @brief Callback for entity manager default changes
445 *
446 * Called when PowerModeProperties defaults are available
447 */
Patrick Williamsaf408082022-07-22 19:26:54 -0500448 void defaultsReady(sdbusplus::message_t& msg);
Chris Cain1be43372021-12-09 19:29:37 -0600449
450 /** @brief Get the default power mode property for this system type
451 *
452 * @param[out] defaultMode - default system power mode
453 *
454 * @return true if data read successfully
455 */
456 bool getDefaultMode(SysPwrMode& defaultMode);
457
458 /** @brief Get the default Idle Power Saver properties for this system type
459 *
460 * @param[out] enabled - Idle Power Save status (true = enabled)
461 * @param[out] enterUtil - IPS Enter Utilization (%)
462 * @param[out] enterTime - IPS Enter Time (seconds)
463 * @param[out] exitUtil - IPS Exit Utilization (%)
464 * @param[out] exitTime - IPS Exit Time (seconds)
465 *
466 * @return true if parameters were read successfully
467 */
468 bool getDefaultIPSParms(bool& enabled, uint8_t& enterUtil,
469 uint16_t& enterTime, uint8_t& exitUtil,
470 uint16_t& exitTime);
Chris Caincde7bea2022-01-28 15:54:24 -0600471
472 /** @brief Read the default Idle Power Saver parameters and save them to the
473 * DBUS so they will get used
474 *
475 * @return true if restore was successful
476 */
477 bool useDefaultIPSParms();
Sheldon Baileyea2b22e2022-04-04 12:24:46 -0500478
Chris Cain30040d92024-06-19 16:50:34 -0500479 /** @brief Read the supported power modes from entity-manager and update
480 * AllowedPowerModes on dbus
481 *
482 * @return true if data was found/updated
483 */
484 bool getSupportedModes();
485
Sheldon Baileyea2b22e2022-04-04 12:24:46 -0500486 /** @brief callback for the POLL IPS changed event
487 *
488 * @param[in] es - Populated event source
489 * @param[in] fd - Associated File descriptor
490 * @param[in] revents - Type of event
491 * @param[in] userData - User data that was passed during registration
492 */
493 static int ipsStatusCallBack(sd_event_source* es, int fd, uint32_t revents,
494 void* userData);
495
496 /** @brief Opens the IPS file and populates fd */
497 bool openIpsFile();
498
499 /** @brief sd_event wrapped in unique_ptr */
500 EventPtr& event;
501
502 /** @brief event source wrapped in unique_ptr */
503 EventSourcePtr eventSource;
504
505 /** @brief When the ips status event is received, analyzes it */
506 virtual void analyzeIpsEvent();
507
508 protected:
509 /** @brief File descriptor to watch for errors */
510 int fd = -1;
Chris Cain1d51da22021-09-21 14:13:41 -0500511};
512
Chris Cain78e86012021-03-04 16:15:31 -0600513} // namespace powermode
514
515} // namespace occ
516
517} // namespace open_power
518#endif