blob: a2f1b8a6f7d67b7bf1f7062d2b72ba2e6a6cca85 [file] [log] [blame]
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +05301#pragma once
2
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +05303#include "occ_pass_through.hpp"
Vishwanatha Subbanna307d80b2017-06-28 15:56:09 +05304#include "occ_status.hpp"
Tom Joseph815f9f52020-07-27 12:12:13 +05305#include "pldm.hpp"
Eddie Jamescbad2192021-10-07 09:39:39 -05006
Chris Cain720a3842025-01-09 10:23:36 -06007#ifdef PHAL_SUPPORT
Eddie Jamescbad2192021-10-07 09:39:39 -05008#include <libphal.H>
Tom Joseph815f9f52020-07-27 12:12:13 +05309#endif
Chris Cain40501a22022-03-14 17:33:27 -050010#include "powercap.hpp"
Chris Cain78e86012021-03-04 16:15:31 -060011#include "powermode.hpp"
Sheldon Bailey16a5adb2025-06-10 14:10:06 -050012#include "utils.hpp"
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +053013
Gunnar Mills94df8c92018-09-14 14:50:03 -050014#include <sdbusplus/bus.hpp>
Chris Caina8857c52021-01-27 11:53:05 -060015#include <sdeventplus/event.hpp>
16#include <sdeventplus/utility/timer.hpp>
George Liub5ca1012021-09-10 12:53:11 +080017
18#include <cstring>
19#include <functional>
Gunnar Mills94df8c92018-09-14 14:50:03 -050020#include <vector>
21
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +053022namespace sdbusRule = sdbusplus::bus::match::rules;
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +053023namespace open_power
24{
25namespace occ
26{
27
Chicago Duanbb895cb2021-06-18 19:37:16 +080028enum occFruType
29{
30 processorCore = 0,
31 internalMemCtlr = 1,
32 dimm = 2,
33 memCtrlAndDimm = 3,
34 VRMVdd = 6,
35 PMIC = 7,
Matt Spinlerace67d82021-10-18 13:41:57 -050036 memCtlrExSensor = 8,
37 processorIoRing = 9
Chicago Duanbb895cb2021-06-18 19:37:16 +080038};
Chicago Duanbb895cb2021-06-18 19:37:16 +080039
Chris Caina8857c52021-01-27 11:53:05 -060040/** @brief Default time, in seconds, between OCC poll commands */
Matt Spinler37923462021-09-24 11:38:05 -050041constexpr unsigned int defaultPollingInterval = 5;
Chris Caina8857c52021-01-27 11:53:05 -060042
Chris Cain17257672021-10-22 13:41:03 -050043constexpr auto AMBIENT_PATH =
44 "/xyz/openbmc_project/sensors/temperature/Ambient_Virtual_Temp";
45constexpr auto AMBIENT_INTERFACE = "xyz.openbmc_project.Sensor.Value";
46constexpr auto AMBIENT_PROP = "Value";
47constexpr auto ALTITUDE_PATH = "/xyz/openbmc_project/sensors/altitude/Altitude";
48constexpr auto ALTITUDE_INTERFACE = "xyz.openbmc_project.Sensor.Value";
49constexpr auto ALTITUDE_PROP = "Value";
50
Sheldon Baileyd2b044f2025-02-12 11:50:24 -060051constexpr auto EXTN_LABEL_PWRM_MEMORY_POWER = "5057524d";
52constexpr auto EXTN_LABEL_PWRP_PROCESSOR_POWER = "50575250";
53
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +053054/** @class Manager
55 * @brief Builds and manages OCC objects
56 */
57struct Manager
58{
Gunnar Mills94df8c92018-09-14 14:50:03 -050059 public:
60 Manager() = delete;
61 Manager(const Manager&) = delete;
62 Manager& operator=(const Manager&) = delete;
63 Manager(Manager&&) = delete;
64 Manager& operator=(Manager&&) = delete;
65 ~Manager() = default;
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +053066
Gunnar Mills94df8c92018-09-14 14:50:03 -050067 /** @brief Adds OCC pass-through and status objects on the bus
68 * when corresponding CPU inventory is created.
69 *
Gunnar Mills94df8c92018-09-14 14:50:03 -050070 * @param[in] event - Unique ptr reference to sd_event
71 */
George Liuf3a4a692021-12-28 13:59:51 +080072 explicit Manager(EventPtr& event) :
George Liuf3b75142021-06-10 11:22:50 +080073 event(event), pollInterval(defaultPollingInterval),
Chris Caina8857c52021-01-27 11:53:05 -060074 sdpEvent(sdeventplus::Event::get_default()),
75 _pollTimer(
76 std::make_unique<
77 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>(
Chris Cain17257672021-10-22 13:41:03 -050078 sdpEvent, std::bind(&Manager::pollerTimerExpired, this))),
79 ambientPropChanged(
80 utils::getBus(),
81 sdbusRule::member("PropertiesChanged") +
82 sdbusRule::path(AMBIENT_PATH) +
83 sdbusRule::argN(0, AMBIENT_INTERFACE) +
84 sdbusRule::interface("org.freedesktop.DBus.Properties"),
Sheldon Bailey16a5adb2025-06-10 14:10:06 -050085 std::bind(&Manager::ambientCallback, this, std::placeholders::_1)),
Matt Spinlerd267cec2021-09-01 14:49:19 -050086 discoverTimer(
87 std::make_unique<
88 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>(
Chris Caina7b74dc2021-11-10 17:03:43 -060089 sdpEvent, std::bind(&Manager::findAndCreateObjects, this))),
90 waitForAllOccsTimer(
91 std::make_unique<
92 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>(
Sheldon Bailey16a5adb2025-06-10 14:10:06 -050093 sdpEvent, std::bind(&Manager::occsNotAllRunning, this))),
Chris Cainc33171b2024-05-24 16:14:50 -050094 throttlePldmTraceTimer(
Chris Cain755af102024-02-27 16:09:51 -060095 std::make_unique<
96 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>(
Chris Cainc33171b2024-05-24 16:14:50 -050097 sdpEvent, std::bind(&Manager::throttlePldmTraceExpired, this)))
Gunnar Mills94df8c92018-09-14 14:50:03 -050098 {
Gunnar Mills94df8c92018-09-14 14:50:03 -050099 findAndCreateObjects();
Sheldon Bailey16a5adb2025-06-10 14:10:06 -0500100
Chris Cain17257672021-10-22 13:41:03 -0500101 readAltitude();
Gunnar Mills94df8c92018-09-14 14:50:03 -0500102 }
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +0530103
Chris Cain720a3842025-01-09 10:23:36 -0600104 void createPldmHandle();
105
Chris Caina8857c52021-01-27 11:53:05 -0600106 /** @brief Return the number of bound OCCs */
Gunnar Mills94df8c92018-09-14 14:50:03 -0500107 inline auto getNumOCCs() const
108 {
109 return activeCount;
110 }
Edward A. James636577f2017-10-06 10:53:55 -0500111
Eddie Jamescbad2192021-10-07 09:39:39 -0500112 /** @brief Called by a Device to report that the SBE timed out
113 * and appropriate action should be taken
114 *
115 * @param[in] instance - the OCC instance id
116 */
117 void sbeTimeout(unsigned int instance);
Eddie Jamescbad2192021-10-07 09:39:39 -0500118
Chris Cain17257672021-10-22 13:41:03 -0500119 /** @brief Return the latest ambient and altitude readings
120 *
121 * @param[out] ambientValid - true if ambientTemp is valid
122 * @param[out] ambient - ambient temperature in degrees C
123 * @param[out] altitude - altitude in meters
124 */
125 void getAmbientData(bool& ambientValid, uint8_t& ambientTemp,
126 uint16_t& altitude) const;
127
Chris Cain40501a22022-03-14 17:33:27 -0500128 /** @brief Notify pcap object to update bounds */
129 void updatePcapBounds() const;
130
Sheldon Baileyc8dd4592022-05-12 10:15:14 -0500131 /**
132 * @brief Set all sensor values of this OCC to NaN.
133 * @param[in] id - Id of the OCC.
134 * */
135 void setSensorValueToNaN(uint32_t id) const;
136
Sheldon Bailey373af752022-02-21 15:14:00 -0600137 /** @brief Set all sensor values of this OCC to NaN and non functional.
138 *
139 * @param[in] id - Id of the OCC.
140 */
141 void setSensorValueToNonFunctional(uint32_t id) const;
142
Chris Cainc488bac2025-03-17 09:01:15 -0500143 /** @brief Clear any state flags that need to be reset when the host state
144 * is off */
145 void hostPoweredOff();
146
Gunnar Mills94df8c92018-09-14 14:50:03 -0500147 private:
Matt Spinlerd267cec2021-09-01 14:49:19 -0500148 /** @brief Creates the OCC D-Bus objects.
Gunnar Mills94df8c92018-09-14 14:50:03 -0500149 */
150 void findAndCreateObjects();
Vishwanatha Subbannadfc7ec72017-09-07 18:18:01 +0530151
Gunnar Mills94df8c92018-09-14 14:50:03 -0500152 /** @brief Callback that responds to cpu creation in the inventory -
153 * by creating the needed objects.
154 *
155 * @param[in] msg - bus message
156 *
157 * @returns 0 to indicate success
158 */
Patrick Williamsaf408082022-07-22 19:26:54 -0500159 int cpuCreated(sdbusplus::message_t& msg);
Deepak Kodihalli5f031f32017-07-26 08:25:59 -0500160
Gunnar Mills94df8c92018-09-14 14:50:03 -0500161 /** @brief Create child OCC objects.
162 *
163 * @param[in] occ - the occ name, such as occ0.
164 */
165 void createObjects(const std::string& occ);
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +0530166
Gunnar Mills94df8c92018-09-14 14:50:03 -0500167 /** @brief Callback handler invoked by Status object when the OccActive
168 * property is changed. This is needed to make sure that the
169 * error detection is started only after all the OCCs are bound.
170 * Similarly, when one of the OCC gets its OccActive property
171 * un-set, then the OCC error detection needs to be stopped on
172 * all the OCCs
173 *
174 * @param[in] status - OccActive status
175 */
Sheldon Bailey373af752022-02-21 15:14:00 -0600176 void statusCallBack(instanceID instance, bool status);
Vishwanatha Subbanna2dc9b1a2017-08-18 18:29:41 +0530177
Chris Cainf0295f52024-09-12 15:41:14 -0500178 /** @brief Set flag that a PM Complex reset is needed (to be initiated
179 * later) */
180 void resetOccRequest(instanceID instance);
181
182 /** @brief Initiate the request to reset the PM Complex (PLDM -> HBRT) */
183 void initiateOccRequest(instanceID instance);
184
Gunnar Mills94df8c92018-09-14 14:50:03 -0500185 /** @brief Sends a Heartbeat command to host control command handler */
186 void sendHeartBeat();
Vishwanatha Subbanna2dc9b1a2017-08-18 18:29:41 +0530187
Gunnar Mills94df8c92018-09-14 14:50:03 -0500188 /** @brief reference to sd_event wrapped in unique_ptr */
189 EventPtr& event;
Vishwanatha Subbannaee4d83d2017-06-29 18:35:00 +0530190
Gunnar Mills94df8c92018-09-14 14:50:03 -0500191 /** @brief OCC pass-through objects */
192 std::vector<std::unique_ptr<PassThrough>> passThroughObjects;
Vishwanatha Subbanna307d80b2017-06-28 15:56:09 +0530193
Gunnar Mills94df8c92018-09-14 14:50:03 -0500194 /** @brief OCC Status objects */
195 std::vector<std::unique_ptr<Status>> statusObjects;
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +0530196
Chris Cain40501a22022-03-14 17:33:27 -0500197 /** @brief Power cap monitor and occ notification object */
198 std::unique_ptr<open_power::occ::powercap::PowerCap> pcap;
199
Chris Cain78e86012021-03-04 16:15:31 -0600200 /** @brief Power mode monitor and notification object */
201 std::unique_ptr<open_power::occ::powermode::PowerMode> pmode;
Chris Cain78e86012021-03-04 16:15:31 -0600202
Gunnar Mills94df8c92018-09-14 14:50:03 -0500203 /** @brief sbdbusplus match objects */
204 std::vector<sdbusplus::bus::match_t> cpuMatches;
Vishwanatha Subbanna2dc9b1a2017-08-18 18:29:41 +0530205
Gunnar Mills94df8c92018-09-14 14:50:03 -0500206 /** @brief Number of OCCs that are bound */
207 uint8_t activeCount = 0;
Lei YU0ab90ca2017-07-13 17:02:23 +0800208
Chris Caina8857c52021-01-27 11:53:05 -0600209 /** @brief Number of seconds between poll commands */
210 uint8_t pollInterval;
211
Chris Cain17257672021-10-22 13:41:03 -0500212 /** @brief Ambient temperature of the system in degrees C */
213 uint8_t ambient = 0xFF; // default: not available
214
215 /** @brief Altitude of the system in meters */
216 uint16_t altitude = 0xFFFF; // default: not available
217
Chris Caina8857c52021-01-27 11:53:05 -0600218 /** @brief Poll timer event */
219 sdeventplus::Event sdpEvent;
220
Chris Cainbae4d072022-02-28 09:46:50 -0600221 /** @brief Flags to indicate if waiting for all of the OCC active sensors to
222 * come online */
223 bool waitingForAllOccActiveSensors = false;
224
Chris Cainbd551de2022-04-26 13:41:16 -0500225 /** @brief Set containing intance numbers of any OCCs that became active
226 * while waiting for status objects to be created */
227 std::set<uint8_t> queuedActiveState;
228
Chris Caina8857c52021-01-27 11:53:05 -0600229 /**
230 * @brief The timer to be used once the OCC goes active. When it expires,
231 * a POLL command will be sent to the OCC and then timer restarted.
232 */
233 std::unique_ptr<
234 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>
235 _pollTimer;
236
Chris Cain17257672021-10-22 13:41:03 -0500237 /** @brief Subscribe to ambient temperature changed events */
238 sdbusplus::bus::match_t ambientPropChanged;
239
Chris Cainf0295f52024-09-12 15:41:14 -0500240 /** @brief Flag to indicate that a PM complex reset needs to happen */
241 bool resetRequired = false;
242 /** @brief Instance number of the OCC/processor that triggered the reset */
243 uint8_t resetInstance = 255;
244 /** @brief Set when a PM complex reset has been issued (to prevent multiple
245 * requests) */
246 bool resetInProgress = false;
247
Tom Joseph815f9f52020-07-27 12:12:13 +0530248 /** @brief Callback handler invoked by the PLDM event handler when state of
249 * the OCC is toggled by the host. The caller passes the instance
250 * of the OCC and state of the OCC.
251 *
252 * @param[in] instance - instance of the OCC
253 * @param[in] status - true when the OCC goes active and false when the OCC
254 * goes inactive
255 *
256 * @return true if setting the state of OCC is successful and false if it
257 * fails.
258 */
259 bool updateOCCActive(instanceID instance, bool status);
260
Sheldon Bailey31a2f132022-05-20 11:31:52 -0500261 /** @brief Callback handler invoked by the PLDM event handler when mode of
262 * the OCC SAFE MODE is inacted or cleared.
263 */
264 void updateOccSafeMode(bool safeState);
265
Eddie Jamescbad2192021-10-07 09:39:39 -0500266 /** @brief Callback handler invoked by PLDM sensor change when
267 * the HRESET succeeds or fails.
268 *
269 * @param[in] instance - the SBE instance id
270 * @param[in] success - true if the HRESET succeeded, otherwise false
271 */
272 void sbeHRESETResult(instanceID instance, bool success);
273
Chris Cain720a3842025-01-09 10:23:36 -0600274#ifdef PHAL_SUPPORT
Eddie Jamescbad2192021-10-07 09:39:39 -0500275 /** @brief Helper function to check whether an SBE dump should be collected
276 * now.
277 *
278 * @param[in] instance - the SBE instance id
279 *
280 * @return true if an SBE dump should be collected and false if not
281 */
282 bool sbeCanDump(unsigned int instance);
283
284 /** @brief Helper function to set the SBE state through PDBG/PHAL
285 *
286 * @param[in] instance - instance of the SBE
287 * @param[in] state - the state to which the SBE should be set
288 *
289 */
290 void setSBEState(unsigned int instance, enum sbe_state state);
291
292 /** @brief Helper function to get the SBE instance PDBG processor target
293 *
294 * @param[in] instance - the SBE instance id
295 *
296 * @return a pointer to the PDBG target
297 */
298 struct pdbg_target* getPdbgTarget(unsigned int instance);
299
300 /** @brief Whether pdbg_targets_init has been called */
301 bool pdbgInitialized = false;
Chris Cain720a3842025-01-09 10:23:36 -0600302#endif
Eddie Jamescbad2192021-10-07 09:39:39 -0500303
Tom Joseph815f9f52020-07-27 12:12:13 +0530304 std::unique_ptr<pldm::Interface> pldmHandle = nullptr;
Chris Caina8857c52021-01-27 11:53:05 -0600305
Matt Spinlerd267cec2021-09-01 14:49:19 -0500306 /**
307 * @brief Timer used when discovering OCCs in /dev.
308 */
309 std::unique_ptr<
310 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>
311 discoverTimer;
312
313 /**
314 * @brief Used when discovering /dev/occ objects to know if
315 * any were added since the last check.
316 */
317 std::vector<int> prevOCCSearch;
Chris Caina7b74dc2021-11-10 17:03:43 -0600318
319 /**
320 * @brief Timer used when waiting for OCCs to go active.
321 */
322 std::unique_ptr<
323 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>
324 waitForAllOccsTimer;
325
Chris Cain755af102024-02-27 16:09:51 -0600326 /**
327 * @brief Timer used to throttle PLDM traces when there are problems
Chris Cainc488bac2025-03-17 09:01:15 -0500328 determining the OCC status via pldm. Used to prevent excessive
329 journal traces.
Chris Cain755af102024-02-27 16:09:51 -0600330 */
331 std::unique_ptr<
332 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>
Chris Cainc33171b2024-05-24 16:14:50 -0500333 throttlePldmTraceTimer;
334 /**
335 * @brief onPldmTimeoutCreatePel flag will be used to indicate if
336 * a PEL should get created when the throttlePldmTraceTimer expires.
337 * The first time the throttlePldmTraceTimer expires, the traces
338 * will be throttled and then the timer gets restarted. The
339 * next time the timer expires, a PEL will get created.
340 */
341 bool onPldmTimeoutCreatePel = false;
Chris Cain755af102024-02-27 16:09:51 -0600342
343 /** @brief Check if all of the OCC Active sensors are available and if not
344 * restart the discoverTimer
345 */
Chris Cainc33171b2024-05-24 16:14:50 -0500346 void throttlePldmTraceExpired();
Chris Cain4b82f3e2024-04-22 14:44:29 -0500347
348 /** @brief Create a PEL when the code is not able to obtain the OCC PDRs
Chris Cainc33171b2024-05-24 16:14:50 -0500349 * via PLDM. This is called when the throttlePldmTraceTimer expires.
Chris Cain4b82f3e2024-04-22 14:44:29 -0500350 */
351 void createPldmSensorPEL();
Chris Cain755af102024-02-27 16:09:51 -0600352
Chris Caina7b74dc2021-11-10 17:03:43 -0600353 /** @brief Called when code times out waiting for all OCCs to be running or
354 * after the app is restarted (Status does not callback into
355 * Manager).
356 */
357 void occsNotAllRunning();
Chris Cainbae4d072022-02-28 09:46:50 -0600358
359 /** @brief Check if all of the OCC Active sensors are available and if not
360 * restart the discoverTimer
361 */
362 void checkAllActiveSensors();
Matt Spinlerd267cec2021-09-01 14:49:19 -0500363
Chris Caina8857c52021-01-27 11:53:05 -0600364 /**
365 * @brief Called when poll timer expires and forces a POLL command to the
366 * OCC. The poll timer will then be restarted.
367 * */
368 void pollerTimerExpired();
Chicago Duanbb895cb2021-06-18 19:37:16 +0800369
Matt Spinlerd267cec2021-09-01 14:49:19 -0500370 /**
371 * @brief Finds the OCC devices in /dev
372 *
373 * @return The IDs of the OCCs - 0, 1, etc.
374 */
375 std::vector<int> findOCCsInDev();
376
Chicago Duanbb895cb2021-06-18 19:37:16 +0800377 /**
378 * @brief Gets the occ sensor values.
Chris Cain5d66a0a2022-02-09 08:52:10 -0600379 * @param[in] occ - pointer to OCCs Status object
Chicago Duanbb895cb2021-06-18 19:37:16 +0800380 * */
Chris Cain5d66a0a2022-02-09 08:52:10 -0600381 void getSensorValues(std::unique_ptr<Status>& occ);
Chicago Duanbb895cb2021-06-18 19:37:16 +0800382
383 /**
384 * @brief Trigger OCC driver to read the temperature sensors.
385 * @param[in] path - path of the OCC sensors.
386 * @param[in] id - Id of the OCC.
387 * */
388 void readTempSensors(const fs::path& path, uint32_t id);
389
390 /**
Sheldon Baileyd2b044f2025-02-12 11:50:24 -0600391 * @brief Trigger OCC driver to read the extended sensors.
392 * @param[in] path - path of the OCC sensors.
393 * @param[in] id - Id of the OCC.
394 * */
395 void readExtnSensors(const fs::path& path, uint32_t id);
396
397 /**
Chicago Duanbb895cb2021-06-18 19:37:16 +0800398 * @brief Trigger OCC driver to read the power sensors.
399 * @param[in] path - path of the OCC sensors.
400 * @param[in] id - Id of the OCC.
401 * */
402 void readPowerSensors(const fs::path& path, uint32_t id);
403
Chicago Duanbb895cb2021-06-18 19:37:16 +0800404 /** @brief Store the existing OCC sensors on D-BUS */
405 std::map<std::string, uint32_t> existingSensors;
406
407 /** @brief Get FunctionID from the `powerX_label` file.
408 * @param[in] value - the value of the `powerX_label` file.
409 * @returns FunctionID of the power sensors.
410 */
Patrick Williams2d6ec902025-02-01 08:22:13 -0500411 std::optional<std::string> getPowerLabelFunctionID(
412 const std::string& value);
Chicago Duanbb895cb2021-06-18 19:37:16 +0800413
414 /** @brief The power sensor names map */
415 const std::map<std::string, std::string> powerSensorName = {
416 {"system", "total_power"}, {"1", "p0_mem_power"},
417 {"2", "p1_mem_power"}, {"3", "p2_mem_power"},
418 {"4", "p3_mem_power"}, {"5", "p0_power"},
419 {"6", "p1_power"}, {"7", "p2_power"},
420 {"8", "p3_power"}, {"9", "p0_cache_power"},
421 {"10", "p1_cache_power"}, {"11", "p2_cache_power"},
422 {"12", "p3_cache_power"}, {"13", "io_a_power"},
423 {"14", "io_b_power"}, {"15", "io_c_power"},
424 {"16", "fans_a_power"}, {"17", "fans_b_power"},
425 {"18", "storage_a_power"}, {"19", "storage_b_power"},
426 {"23", "mem_cache_power"}, {"25", "p0_mem_0_power"},
Sheldon Bailey11fd1312022-04-19 10:16:58 -0500427 {"26", "p0_mem_1_power"}, {"27", "p0_mem_2_power"},
428 {"35", "pcie_dcm0_power"}, {"36", "pcie_dcm1_power"},
429 {"37", "pcie_dcm2_power"}, {"38", "pcie_dcm3_power"},
430 {"39", "io_dcm0_power"}, {"40", "io_dcm1_power"},
431 {"41", "io_dcm2_power"}, {"42", "io_dcm3_power"},
432 {"43", "avdd_total_power"}};
Chicago Duanbb895cb2021-06-18 19:37:16 +0800433
Sheldon Bailey11fd1312022-04-19 10:16:58 -0500434 /** @brief The dimm temperature sensor names map */
Chicago Duanbb895cb2021-06-18 19:37:16 +0800435 const std::map<uint32_t, std::string> dimmTempSensorName = {
436 {internalMemCtlr, "_intmb_temp"},
437 {dimm, "_dram_temp"},
438 {memCtrlAndDimm, "_dram_extmb_temp"},
439 {PMIC, "_pmic_temp"},
440 {memCtlrExSensor, "_extmb_temp"}};
Matt Spinlerad8f4522023-10-25 11:14:46 -0500441
442 /** @brief The dimm DVFS temperature sensor names map */
443 const std::map<uint32_t, std::string> dimmDVFSSensorName = {
444 {internalMemCtlr, "dimm_intmb_dvfs_temp"},
445 {dimm, "dimm_dram_dvfs_temp"},
446 {memCtrlAndDimm, "dimm_dram_extmb_dvfs_temp"},
447 {PMIC, "dimm_pmic_dvfs_temp"},
448 {memCtlrExSensor, "dimm_extmb_dvfs_temp"}};
Chris Cain17257672021-10-22 13:41:03 -0500449
450 /** @brief Read the altitude from DBus */
451 void readAltitude();
452
453 /** @brief Callback function when ambient temperature changes
454 *
455 * @param[in] msg - Data associated with subscribed signal
456 */
Patrick Williamsaf408082022-07-22 19:26:54 -0500457 void ambientCallback(sdbusplus::message_t& msg);
Chris Caina7b74dc2021-11-10 17:03:43 -0600458
459 /** @brief Confirm that a single OCC master was found and start presence
460 * monitoring
461 */
462 void validateOccMaster();
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +0530463};
464
465} // namespace occ
466} // namespace open_power