Add support for OEM Power Modes
- Allow mode to be set via PassThrough interface
- Allow non-customer OEM power modes to be persisted
- Persist any OEM power mode settings
- moved mode related code from Status to PowerMode object
- merged PowerIPS into PowerMode object
Tested on Everest and Rainier.
Setting mode through PassThrough/ce-login:
busctl call org.open_power.OCC.Control /org/open_power/control/occ0 org.open_power.OCC.PassThrough SetMode yq 11 3600
Trace (via PassThrough interface)
openpower-occ-control[4440]: PassThrough::setMode() Setting Power Mode 11 (data: 3600)
openpower-occ-control[4440]: PowerMode::sendModeChange: SET_MODE(11,3600) command to OCC0 (9 bytes)
Trace (setting mode via GUI/Redfish):
openpower-occ-control[4440]: Power Mode Change Requested: xyz.openbmc_project.Control.Power.Mode.PowerMode.MaximumPerformance
openpower-occ-control[4440]: PowerMode::sendModeChange: SET_MODE(12,0) command to OCC0 (9 bytes)
Verified when system in any OEM mode that Redfish also reports OEM
Verified all modes are persisted across PM Complex resets and reboots
Change-Id: Idd0be05cb6fd74dbd0776145f212c49addd1c365
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/occ_pass_through.hpp b/occ_pass_through.hpp
index a1e1e91..52a8f71 100644
--- a/occ_pass_through.hpp
+++ b/occ_pass_through.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "occ_command.hpp"
+#include "powermode.hpp"
#include "utils.hpp"
#include <fmt/core.h>
@@ -39,7 +40,13 @@
/** @brief Ctor to put pass-through d-bus object on the bus
* @param[in] path - Path to attach at
*/
- explicit PassThrough(const char* path);
+ explicit PassThrough(
+ const char* path
+#ifdef POWER10
+ ,
+ std::unique_ptr<open_power::occ::powermode::PowerMode>& powerModeRef
+#endif
+ );
/** @brief Pass through command to OCC from dbus
* @param[in] command - command to pass-through
@@ -53,10 +60,24 @@
*/
std::vector<std::uint8_t> send(std::vector<std::uint8_t> command);
+ /** @brief Set a Power Mode
+ *
+ * @param[in] mode - desired System Power Mode
+ * @param[in] modeData - data associated some Power Modes
+ *
+ * @returns true if mode change was accepted
+ */
+ bool setMode(const uint8_t mode, const uint16_t modeData);
+
private:
/** @brief Pass-through occ path on the bus */
std::string path;
+#ifdef POWER10
+ /** @brief OCC PowerMode object */
+ std::unique_ptr<open_power::occ::powermode::PowerMode>& pmode;
+#endif
+
/** @brief OCC device path
* For now, here is the hard-coded mapping until
* the udev rule is in.