Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Brandon Wyman | a0f33ce | 2019-10-17 18:32:29 -0500 | [diff] [blame] | 3 | #include "power_supply.hpp" |
| 4 | #include "types.hpp" |
| 5 | #include "utility.hpp" |
| 6 | |
| 7 | #include <phosphor-logging/log.hpp> |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 8 | #include <sdbusplus/bus/match.hpp> |
Adriana Kobylak | c9b0573 | 2022-03-19 15:15:10 +0000 | [diff] [blame] | 9 | #include <sdbusplus/server/manager.hpp> |
| 10 | #include <sdbusplus/server/object.hpp> |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 11 | #include <sdeventplus/event.hpp> |
| 12 | #include <sdeventplus/utility/timer.hpp> |
Adriana Kobylak | c9b0573 | 2022-03-19 15:15:10 +0000 | [diff] [blame] | 13 | #include <xyz/openbmc_project/State/Decorator/PowerSystemInputs/server.hpp> |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 14 | |
Brandon Wyman | aed1f75 | 2019-11-25 18:10:52 -0600 | [diff] [blame] | 15 | struct sys_properties |
| 16 | { |
Adriana Kobylak | d3a70d9 | 2021-06-04 16:24:45 +0000 | [diff] [blame] | 17 | int powerSupplyCount; |
| 18 | std::vector<uint64_t> inputVoltage; |
Adriana Kobylak | 886574c | 2021-11-01 18:22:28 +0000 | [diff] [blame] | 19 | bool powerConfigFullLoad; |
Brandon Wyman | aed1f75 | 2019-11-25 18:10:52 -0600 | [diff] [blame] | 20 | }; |
| 21 | |
Brandon Wyman | a0f33ce | 2019-10-17 18:32:29 -0500 | [diff] [blame] | 22 | using namespace phosphor::power::psu; |
| 23 | using namespace phosphor::logging; |
| 24 | |
Brandon Wyman | 63ea78b | 2020-09-24 16:49:09 -0500 | [diff] [blame] | 25 | namespace phosphor::power::manager |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 26 | { |
| 27 | |
Adriana Kobylak | c9b0573 | 2022-03-19 15:15:10 +0000 | [diff] [blame] | 28 | using PowerSystemInputsInterface = sdbusplus::xyz::openbmc_project::State:: |
| 29 | Decorator::server::PowerSystemInputs; |
| 30 | using PowerSystemInputsObject = |
| 31 | sdbusplus::server::object_t<PowerSystemInputsInterface>; |
| 32 | |
Adriana Kobylak | 2aba2b2 | 2021-10-11 16:00:05 +0000 | [diff] [blame] | 33 | // Validation timeout. Allow 10s to detect if new EM interfaces show up in D-Bus |
| 34 | // before performing the validation. |
| 35 | constexpr auto validationTimeout = std::chrono::seconds(10); |
Adriana Kobylak | a4d38fa | 2021-10-05 19:57:47 +0000 | [diff] [blame] | 36 | |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 37 | /** |
Adriana Kobylak | c9b0573 | 2022-03-19 15:15:10 +0000 | [diff] [blame] | 38 | * @class PowerSystemInputs |
| 39 | * @brief A concrete implementation for the PowerSystemInputs interface. |
| 40 | */ |
| 41 | class PowerSystemInputs : public PowerSystemInputsObject |
| 42 | { |
| 43 | public: |
Patrick Williams | 7354ce6 | 2022-07-22 19:26:56 -0500 | [diff] [blame] | 44 | PowerSystemInputs(sdbusplus::bus_t& bus, const std::string& path) : |
Adriana Kobylak | c9b0573 | 2022-03-19 15:15:10 +0000 | [diff] [blame] | 45 | PowerSystemInputsObject(bus, path.c_str()) |
| 46 | {} |
| 47 | }; |
| 48 | |
| 49 | /** |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 50 | * @class PSUManager |
| 51 | * |
| 52 | * This class will create an object used to manage and monitor a list of power |
| 53 | * supply devices. |
| 54 | */ |
| 55 | class PSUManager |
| 56 | { |
| 57 | public: |
| 58 | PSUManager() = delete; |
| 59 | ~PSUManager() = default; |
| 60 | PSUManager(const PSUManager&) = delete; |
| 61 | PSUManager& operator=(const PSUManager&) = delete; |
| 62 | PSUManager(PSUManager&&) = delete; |
| 63 | PSUManager& operator=(PSUManager&&) = delete; |
| 64 | |
| 65 | /** |
Brandon Wyman | 510acaa | 2020-11-05 18:32:04 -0600 | [diff] [blame] | 66 | * Constructor to read configuration from D-Bus. |
| 67 | * |
| 68 | * @param[in] bus - D-Bus bus object |
| 69 | * @param[in] e - event object |
| 70 | */ |
Patrick Williams | 7354ce6 | 2022-07-22 19:26:56 -0500 | [diff] [blame] | 71 | PSUManager(sdbusplus::bus_t& bus, const sdeventplus::Event& e); |
Brandon Wyman | 510acaa | 2020-11-05 18:32:04 -0600 | [diff] [blame] | 72 | |
| 73 | /** |
Brandon Wyman | 510acaa | 2020-11-05 18:32:04 -0600 | [diff] [blame] | 74 | * Get PSU properties from D-Bus, use that to build a power supply |
| 75 | * object. |
| 76 | * |
| 77 | * @param[in] properties - A map of property names and values |
| 78 | * |
| 79 | */ |
| 80 | void getPSUProperties(util::DbusPropertyMap& properties); |
| 81 | |
| 82 | /** |
| 83 | * Get PSU configuration from D-Bus |
| 84 | */ |
| 85 | void getPSUConfiguration(); |
| 86 | |
| 87 | /** |
Adriana Kobylak | 9bab9e1 | 2021-02-24 15:32:03 -0600 | [diff] [blame] | 88 | * @brief Initialize the system properties from the Supported Configuration |
| 89 | * D-Bus object provided by Entity Manager. |
| 90 | */ |
| 91 | void getSystemProperties(); |
| 92 | |
| 93 | /** |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 94 | * Initializes the manager. |
| 95 | * |
| 96 | * Get current BMC state, ... |
| 97 | */ |
Jim Wright | aca86d0 | 2022-06-10 12:01:39 -0500 | [diff] [blame] | 98 | void initialize(); |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 99 | |
| 100 | /** |
| 101 | * Starts the timer to start monitoring the list of devices. |
| 102 | */ |
| 103 | int run() |
| 104 | { |
Brandon Wyman | 2fe5186 | 2019-11-25 16:43:21 -0600 | [diff] [blame] | 105 | return timer->get_event().loop(); |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | /** |
Brandon Wyman | 59a3579 | 2020-06-04 12:37:40 -0500 | [diff] [blame] | 109 | * Write PMBus ON_OFF_CONFIG |
| 110 | * |
| 111 | * This function will be called to cause the PMBus device driver to send the |
| 112 | * ON_OFF_CONFIG command. Takes one byte of data. |
| 113 | */ |
| 114 | void onOffConfig(const uint8_t data) |
| 115 | { |
| 116 | for (auto& psu : psus) |
| 117 | { |
| 118 | psu->onOffConfig(data); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | /** |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 123 | * This function will be called in various situations in order to clear |
| 124 | * any fault status bits that may have been set, in order to start over |
| 125 | * with a clean state. Presence changes and power state changes will want |
| 126 | * to clear any faults logged. |
| 127 | */ |
| 128 | void clearFaults() |
| 129 | { |
Brandon Wyman | 10fc6e8 | 2022-02-08 20:51:22 +0000 | [diff] [blame] | 130 | setPowerSupplyError(""); |
Brandon Wyman | a0f33ce | 2019-10-17 18:32:29 -0500 | [diff] [blame] | 131 | for (auto& psu : psus) |
| 132 | { |
Brandon Wyman | aed1f75 | 2019-11-25 18:10:52 -0600 | [diff] [blame] | 133 | psu->clearFaults(); |
Brandon Wyman | a0f33ce | 2019-10-17 18:32:29 -0500 | [diff] [blame] | 134 | } |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | private: |
| 138 | /** |
| 139 | * The D-Bus object |
| 140 | */ |
Patrick Williams | 7354ce6 | 2022-07-22 19:26:56 -0500 | [diff] [blame] | 141 | sdbusplus::bus_t& bus; |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 142 | |
| 143 | /** |
| 144 | * The timer that runs to periodically check the power supplies. |
| 145 | */ |
Brandon Wyman | 2fe5186 | 2019-11-25 16:43:21 -0600 | [diff] [blame] | 146 | std::unique_ptr< |
| 147 | sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>> |
| 148 | timer; |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 149 | |
| 150 | /** |
Adriana Kobylak | a4d38fa | 2021-10-05 19:57:47 +0000 | [diff] [blame] | 151 | * The timer that performs power supply validation as the entity manager |
| 152 | * interfaces show up in d-bus. |
| 153 | */ |
| 154 | std::unique_ptr< |
| 155 | sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>> |
| 156 | validationTimer; |
| 157 | |
| 158 | /** |
Brandon Wyman | 10fc6e8 | 2022-02-08 20:51:22 +0000 | [diff] [blame] | 159 | * Let power control/sequencer application know of PSU error(s). |
| 160 | * |
| 161 | * @param[in] psuErrorString - string for power supply error |
| 162 | */ |
| 163 | void setPowerSupplyError(const std::string& psuErrorString); |
| 164 | |
| 165 | /** |
Brandon Wyman | b76ab24 | 2020-09-16 18:06:06 -0500 | [diff] [blame] | 166 | * Create an error |
| 167 | * |
| 168 | * @param[in] faultName - 'name' message for the BMC error log entry |
Brandon Wyman | 8b66288 | 2021-10-08 17:31:51 +0000 | [diff] [blame] | 169 | * @param[in,out] additionalData - The AdditionalData property for the error |
Brandon Wyman | b76ab24 | 2020-09-16 18:06:06 -0500 | [diff] [blame] | 170 | */ |
| 171 | void createError(const std::string& faultName, |
Brandon Wyman | 8b66288 | 2021-10-08 17:31:51 +0000 | [diff] [blame] | 172 | std::map<std::string, std::string>& additionalData); |
Brandon Wyman | b76ab24 | 2020-09-16 18:06:06 -0500 | [diff] [blame] | 173 | |
| 174 | /** |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 175 | * Analyze the status of each of the power supplies. |
Brandon Wyman | b76ab24 | 2020-09-16 18:06:06 -0500 | [diff] [blame] | 176 | * |
| 177 | * Log errors for faults, when and where appropriate. |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 178 | */ |
Brandon Wyman | 63ea78b | 2020-09-24 16:49:09 -0500 | [diff] [blame] | 179 | void analyze(); |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 180 | |
| 181 | /** @brief True if the power is on. */ |
| 182 | bool powerOn = false; |
| 183 | |
Jim Wright | aca86d0 | 2022-06-10 12:01:39 -0500 | [diff] [blame] | 184 | /** @brief True if power control is in the window between chassis pgood loss |
| 185 | * and power off. */ |
| 186 | bool powerFaultOccurring = false; |
| 187 | |
Adriana Kobylak | 2549d79 | 2022-01-26 20:51:30 +0000 | [diff] [blame] | 188 | /** @brief True if an error for a brownout has already been logged. */ |
| 189 | bool brownoutLogged = false; |
| 190 | |
Brandon Wyman | a0f33ce | 2019-10-17 18:32:29 -0500 | [diff] [blame] | 191 | /** @brief Used as part of subscribing to power on state changes*/ |
| 192 | std::string powerService; |
| 193 | |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 194 | /** @brief Used to subscribe to D-Bus power on state changes */ |
| 195 | std::unique_ptr<sdbusplus::bus::match_t> powerOnMatch; |
| 196 | |
Adriana Kobylak | 9ba3823 | 2021-11-16 20:27:45 +0000 | [diff] [blame] | 197 | /** @brief Used to subscribe to D-Bus power supply presence changes */ |
| 198 | std::vector<std::unique_ptr<sdbusplus::bus::match_t>> presenceMatches; |
| 199 | |
Adriana Kobylak | 9bab9e1 | 2021-02-24 15:32:03 -0600 | [diff] [blame] | 200 | /** @brief Used to subscribe to Entity Manager interfaces added */ |
| 201 | std::unique_ptr<sdbusplus::bus::match_t> entityManagerIfacesAddedMatch; |
| 202 | |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 203 | /** |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 204 | * @brief Callback for power state property changes |
| 205 | * |
| 206 | * Process changes to the powered on state property for the system. |
| 207 | * |
| 208 | * @param[in] msg - Data associated with the power state signal |
| 209 | */ |
Patrick Williams | 7354ce6 | 2022-07-22 19:26:56 -0500 | [diff] [blame] | 210 | void powerStateChanged(sdbusplus::message_t& msg); |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 211 | |
| 212 | /** |
Adriana Kobylak | 9ba3823 | 2021-11-16 20:27:45 +0000 | [diff] [blame] | 213 | * @brief Callback for inventory property changes |
| 214 | * |
| 215 | * Process change of the Present property for power supply. |
| 216 | * |
| 217 | * @param[in] msg - Data associated with the Present change signal |
| 218 | **/ |
Patrick Williams | 7354ce6 | 2022-07-22 19:26:56 -0500 | [diff] [blame] | 219 | void presenceChanged(sdbusplus::message_t& msg); |
Adriana Kobylak | 9ba3823 | 2021-11-16 20:27:45 +0000 | [diff] [blame] | 220 | |
| 221 | /** |
Brandon Wyman | 3e42913 | 2021-03-18 18:03:14 -0500 | [diff] [blame] | 222 | * @brief Callback for entity-manager interface added |
Adriana Kobylak | 9bab9e1 | 2021-02-24 15:32:03 -0600 | [diff] [blame] | 223 | * |
Brandon Wyman | 3e42913 | 2021-03-18 18:03:14 -0500 | [diff] [blame] | 224 | * Process the information from the supported configuration and or IBM CFFPS |
| 225 | * Connector interface being added. |
Adriana Kobylak | 9bab9e1 | 2021-02-24 15:32:03 -0600 | [diff] [blame] | 226 | * |
| 227 | * @param[in] msg - Data associated with the interfaces added signal |
| 228 | */ |
Patrick Williams | 7354ce6 | 2022-07-22 19:26:56 -0500 | [diff] [blame] | 229 | void entityManagerIfaceAdded(sdbusplus::message_t& msg); |
Adriana Kobylak | 9bab9e1 | 2021-02-24 15:32:03 -0600 | [diff] [blame] | 230 | |
| 231 | /** |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 232 | * @brief Adds properties to the inventory. |
| 233 | * |
| 234 | * Reads the values from the devices and writes them to the associated |
| 235 | * power supply D-Bus inventory objects. |
| 236 | * |
| 237 | * This needs to be done on startup, and each time the presence state |
| 238 | * changes. |
| 239 | */ |
Brandon Wyman | a0f33ce | 2019-10-17 18:32:29 -0500 | [diff] [blame] | 240 | void updateInventory() |
| 241 | { |
| 242 | for (auto& psu : psus) |
| 243 | { |
Brandon Wyman | aed1f75 | 2019-11-25 18:10:52 -0600 | [diff] [blame] | 244 | psu->updateInventory(); |
Brandon Wyman | a0f33ce | 2019-10-17 18:32:29 -0500 | [diff] [blame] | 245 | } |
| 246 | } |
| 247 | |
| 248 | /** |
Adriana Kobylak | e1074d8 | 2021-03-16 20:46:44 +0000 | [diff] [blame] | 249 | * @brief Helper function to populate the system properties |
| 250 | * |
| 251 | * @param[in] properties - A map of property names and values |
| 252 | */ |
| 253 | void populateSysProperties(const util::DbusPropertyMap& properties); |
| 254 | |
| 255 | /** |
Brandon Wyman | 64e9775 | 2022-06-03 23:50:13 +0000 | [diff] [blame] | 256 | * @brief Update inventory for missing required power supplies |
| 257 | */ |
| 258 | void updateMissingPSUs(); |
| 259 | |
| 260 | /** |
Adriana Kobylak | 8f16fb5 | 2021-03-31 15:50:15 +0000 | [diff] [blame] | 261 | * @brief Perform power supply configuration validation. |
| 262 | * @details Validates if the existing power supply properties are a |
| 263 | * supported configuration, and acts on its findings such as logging errors. |
| 264 | */ |
| 265 | void validateConfig(); |
| 266 | |
| 267 | /** |
| 268 | * @brief Flag to indicate if the validateConfig() function should be run. |
| 269 | * Set to false once the configuration has been validated to avoid running |
| 270 | * multiple times due to interfaces added signal. Set to true during power |
| 271 | * off to trigger the validation on power on. |
| 272 | */ |
| 273 | bool runValidateConfig = true; |
| 274 | |
| 275 | /** |
Adriana Kobylak | 4d9aaf9 | 2021-06-30 15:27:42 +0000 | [diff] [blame] | 276 | * @brief Check that all PSUs have the same model name and that the system |
| 277 | * has the required number of PSUs present as specified in the Supported |
| 278 | * Configuration interface. |
| 279 | * |
| 280 | * @param[out] additionalData - Contains debug information on why the check |
| 281 | * might have failed. Can be used to fill in error logs. |
| 282 | * @return true if all the required PSUs are present, false otherwise. |
| 283 | */ |
| 284 | bool hasRequiredPSUs(std::map<std::string, std::string>& additionalData); |
| 285 | |
| 286 | /** |
Shawn McCarney | 9252b7e | 2022-06-10 12:47:38 -0500 | [diff] [blame] | 287 | * @brief Returns the number of PSUs that are required to be present. |
| 288 | * |
| 289 | * @return required number of PSUs, or 0 if the number could not be |
| 290 | * determined. |
| 291 | */ |
| 292 | unsigned int getRequiredPSUCount(); |
| 293 | |
| 294 | /** |
| 295 | * @brief Returns whether the specified PSU is required to be present. |
| 296 | * |
| 297 | * @param[in] psu - Power supply to check |
| 298 | * @return true if PSU is required, false otherwise. |
| 299 | */ |
| 300 | bool isRequiredPSU(const PowerSupply& psu); |
| 301 | |
| 302 | /** |
Adriana Kobylak | 523704d | 2021-09-21 15:55:41 +0000 | [diff] [blame] | 303 | * @brief Helper function to validate that all PSUs have the same model name |
| 304 | * |
| 305 | * @param[out] model - The model name. Empty if there is a mismatch. |
| 306 | * @param[out] additionalData - If there is a mismatch, it contains debug |
| 307 | * information such as the mismatched model name. |
| 308 | * @return true if all the PSUs have the same model name, false otherwise. |
| 309 | */ |
| 310 | bool validateModelName(std::string& model, |
| 311 | std::map<std::string, std::string>& additionalData); |
| 312 | |
| 313 | /** |
Adriana Kobylak | c0a0758 | 2021-10-13 15:52:25 +0000 | [diff] [blame] | 314 | * @brief Set the power-config-full-load GPIO depending on the EM full load |
| 315 | * property value. |
| 316 | */ |
| 317 | void setPowerConfigGPIO(); |
| 318 | |
| 319 | /** |
Adriana Kobylak | e5b1e08 | 2022-03-02 15:37:32 +0000 | [diff] [blame] | 320 | * @brief Indicate that the system is in a brownout condition by creating an |
| 321 | * error log and setting the PowerSystemInputs status property to Fault. |
| 322 | * |
| 323 | * @param[in] additionalData - Contains debug information on the number of |
| 324 | * PSUs in fault state or not present. |
| 325 | */ |
| 326 | void setBrownout(std::map<std::string, std::string>& additionalData); |
| 327 | |
| 328 | /** |
| 329 | * @brief Indicate that the system is no longer in a brownout condition by |
| 330 | * setting the PowerSystemInputs status property to Good. |
| 331 | */ |
| 332 | void clearBrownout(); |
| 333 | |
| 334 | /** |
Adriana Kobylak | 9ea66a6 | 2021-03-24 17:54:14 +0000 | [diff] [blame] | 335 | * @brief Map of supported PSU configurations that include the model name |
| 336 | * and their properties. |
Brandon Wyman | aed1f75 | 2019-11-25 18:10:52 -0600 | [diff] [blame] | 337 | */ |
Adriana Kobylak | d3a70d9 | 2021-06-04 16:24:45 +0000 | [diff] [blame] | 338 | std::map<std::string, sys_properties> supportedConfigs; |
Brandon Wyman | aed1f75 | 2019-11-25 18:10:52 -0600 | [diff] [blame] | 339 | |
| 340 | /** |
Brandon Wyman | a0f33ce | 2019-10-17 18:32:29 -0500 | [diff] [blame] | 341 | * @brief The vector for power supplies. |
| 342 | */ |
Brandon Wyman | aed1f75 | 2019-11-25 18:10:52 -0600 | [diff] [blame] | 343 | std::vector<std::unique_ptr<PowerSupply>> psus; |
Adriana Kobylak | c0a0758 | 2021-10-13 15:52:25 +0000 | [diff] [blame] | 344 | |
| 345 | /** |
| 346 | * @brief The libgpiod object for setting the power supply config |
| 347 | */ |
| 348 | std::unique_ptr<GPIOInterfaceBase> powerConfigGPIO = nullptr; |
Adriana Kobylak | c9b0573 | 2022-03-19 15:15:10 +0000 | [diff] [blame] | 349 | |
| 350 | /** |
| 351 | * @brief PowerSystemInputs object |
| 352 | */ |
| 353 | PowerSystemInputs powerSystemInputs; |
| 354 | |
| 355 | /** |
Brandon Wyman | c332442 | 2022-03-24 20:30:57 +0000 | [diff] [blame] | 356 | * @brief Implement the ObjectManager for PowerSystemInputs object. |
| 357 | * |
| 358 | * Implements the org.freedesktop.DBus.ObjectManager interface used to |
| 359 | * communicate updates to the PowerSystemInputs object on the |
| 360 | * /xyz/openbmc_project/power/power_supplies root D-Bus path. |
Adriana Kobylak | c9b0573 | 2022-03-19 15:15:10 +0000 | [diff] [blame] | 361 | */ |
| 362 | sdbusplus::server::manager_t objectManager; |
Brandon Wyman | c332442 | 2022-03-24 20:30:57 +0000 | [diff] [blame] | 363 | |
| 364 | /** |
| 365 | * @brief Implement the ObjectManager for power supply input history. |
| 366 | * |
| 367 | * Implements the org.freedesktop.DBus.ObjectManager interface used to |
| 368 | * communicate updates to the Average and Maximum interface properties on |
| 369 | * the /org/open_power/sensors root D-Bus path. |
| 370 | */ |
| 371 | sdbusplus::server::manager_t historyManager; |
Brandon Wyman | 18a24d9 | 2022-04-19 22:48:34 +0000 | [diff] [blame] | 372 | |
| 373 | /** |
| 374 | * @brief GPIO to toggle to 'sync' power supply input history. |
| 375 | */ |
| 376 | std::unique_ptr<GPIOInterfaceBase> syncHistoryGPIO = nullptr; |
| 377 | |
| 378 | /** |
| 379 | * @brief Toggles the GPIO to sync power supply input history readings |
| 380 | * |
| 381 | * This GPIO is connected to all supplies. This will clear the |
| 382 | * previous readings out of the supplies and restart them both at the |
| 383 | * same time zero and at record ID 0. The supplies will return 0 |
| 384 | * bytes of data for the input history command right after this until |
| 385 | * a new entry shows up. |
| 386 | * |
| 387 | * This will cause the code to delete all previous history data and |
| 388 | * start fresh. |
| 389 | */ |
| 390 | void syncHistory(); |
Brandon Wyman | 2bac860 | 2019-09-12 18:12:21 -0500 | [diff] [blame] | 391 | }; |
| 392 | |
Brandon Wyman | 63ea78b | 2020-09-24 16:49:09 -0500 | [diff] [blame] | 393 | } // namespace phosphor::power::manager |