summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--control/zone.cpp24
-rw-r--r--control/zone.hpp28
2 files changed, 51 insertions, 1 deletions
diff --git a/control/zone.cpp b/control/zone.cpp
index 6efbe73..fddca53 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -638,6 +638,25 @@ const std::string& Zone::addServices(const std::string& path,
return empty;
}
+auto Zone::getPersisted(const std::string& intf,
+ const std::string& prop)
+{
+ auto persisted = false;
+
+ auto it = _persisted.find(intf);
+ if (it != _persisted.end())
+ {
+ return std::any_of(it->second.begin(),
+ it->second.end(),
+ [&prop](auto& p)
+ {
+ return prop == p;
+ });
+ }
+
+ return persisted;
+}
+
std::string Zone::current(std::string value)
{
auto current = ThermalObject::current();
@@ -656,7 +675,10 @@ std::string Zone::current(std::string value)
if (value != current && isSupported)
{
current = ThermalObject::current(value);
- saveCurrentMode();
+ if (getPersisted("xyz.openbmc_project.Control.ThermalMode", "Current"))
+ {
+ saveCurrentMode();
+ }
// Trigger event(s) for current mode property change
auto eData = _objects[_path]
["xyz.openbmc_project.Control.ThermalMode"]
diff --git a/control/zone.hpp b/control/zone.hpp
index 2633902..6da3091 100644
--- a/control/zone.hpp
+++ b/control/zone.hpp
@@ -470,6 +470,29 @@ class Zone : public ThermalObject
int32_t depth);
/**
+ * @brief Set a property to be persisted
+ *
+ * @param[in] intf - Interface containing property
+ * @param[in] prop - Property to be persisted
+ */
+ inline void setPersisted(const std::string& intf,
+ const std::string& prop)
+ {
+ _persisted[intf].emplace_back(prop);
+ }
+
+ /**
+ * @brief Get persisted property
+ *
+ * @param[in] intf - Interface containing property
+ * @param[in] prop - Property persisted
+ *
+ * @return - True if property is to be persisted, false otherwise
+ */
+ auto getPersisted(const std::string& intf,
+ const std::string& prop);
+
+ /**
* @brief Get a property value from the zone object or the bus when
* the property requested is not on the zone object
*
@@ -653,6 +676,11 @@ class Zone : public ThermalObject
EventData*>>> _objects;
/**
+ * @brief Map of interfaces to persisted properties
+ */
+ std::map<std::string, std::vector<std::string>> _persisted;
+
+ /**
* @brief Map of active fan control allowed by groups
*/
std::map<const Group, bool> _active;
OpenPOWER on IntegriCloud