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_status.hpp b/occ_status.hpp
index e8e4530..32041c7 100644
--- a/occ_status.hpp
+++ b/occ_status.hpp
@@ -5,6 +5,7 @@
 #include "occ_command.hpp"
 #include "occ_device.hpp"
 #include "occ_events.hpp"
+#include "powermode.hpp"
 #include "utils.hpp"
 
 #include <org/open_power/Control/Host/server.hpp>
@@ -74,6 +75,9 @@
      *                             protocol
      */
     Status(EventPtr& event, const char* path, Manager& managerRef,
+#ifdef POWER10
+           std::unique_ptr<open_power::occ::powermode::PowerMode>& powerModeRef,
+#endif
            std::function<void(bool)> callBack = nullptr
 #ifdef PLDM
            ,
@@ -84,6 +88,9 @@
         Interface(utils::getBus(), getDbusPath(path).c_str(), true),
         path(path), callBack(callBack), instance(getInstance(path)),
         manager(managerRef),
+#ifdef POWER10
+        pmode(powerModeRef),
+#endif
         device(event,
 #ifdef I2C_OCC
                fs::path(DEV_PATH) / i2c_occ::getI2cDeviceName(path),
@@ -180,16 +187,6 @@
     /** @brief Handle additional tasks when the OCCs reach active state */
     void occsWentActive();
 
-    /** @brief Send mode change command to the master OCC
-     *  @return SUCCESS on success
-     */
-    CmdStatus sendModeChange();
-
-    /** @brief Send Idle Power Saver config data to the master OCC
-     *  @return SUCCESS on success
-     */
-    CmdStatus sendIpsData();
-
     /** @brief Send Ambient & Altitude data to OCC
      *
      *  @param[in] ambient - temperature to send (0xFF will force read
@@ -223,6 +220,11 @@
     /** @brief OCC manager object */
     const Manager& manager;
 
+#ifdef POWER10
+    /** @brief OCC PowerMode object */
+    std::unique_ptr<open_power::occ::powermode::PowerMode>& pmode;
+#endif
+
     /** @brief OCC device object to do bind and unbind */
     Device device;
 
@@ -262,22 +264,6 @@
     }
 
 #ifdef POWER10
-    /** @brief Query the current Hypervisor target
-     * @return true if the current Hypervisor target is PowerVM
-     */
-    bool isPowerVM();
-
-    /** @brief Get the requested power mode property
-     * @return Power mode
-     */
-    SysPwrMode getMode();
-
-    /** @brief Get the Idle Power Saver properties
-     * @return true if IPS is enabled
-     */
-    bool getIPSParms(uint8_t& enterUtil, uint16_t& enterTime, uint8_t& exitUtil,
-                     uint16_t& exitTime);
-
     /**
      * @brief Timer that is started when OCC is detected to be in safe mode
      */