blob: 9745682bc9ac8ad5486346bfaa284e132b8ef17b [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#ifdef PLDM
6#include "pldm.hpp"
Eddie Jamescbad2192021-10-07 09:39:39 -05007
8#include <libphal.H>
Tom Joseph815f9f52020-07-27 12:12:13 +05309#endif
Chris Cain40501a22022-03-14 17:33:27 -050010#include "powercap.hpp"
George Liuf3b75142021-06-10 11:22:50 +080011#include "utils.hpp"
Chris Cain78e86012021-03-04 16:15:31 -060012#ifdef POWER10
13#include "powermode.hpp"
14#endif
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +053015
Gunnar Mills94df8c92018-09-14 14:50:03 -050016#include <sdbusplus/bus.hpp>
Chris Caina8857c52021-01-27 11:53:05 -060017#include <sdeventplus/event.hpp>
18#include <sdeventplus/utility/timer.hpp>
George Liub5ca1012021-09-10 12:53:11 +080019
20#include <cstring>
21#include <functional>
Gunnar Mills94df8c92018-09-14 14:50:03 -050022#include <vector>
23
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +053024namespace sdbusRule = sdbusplus::bus::match::rules;
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +053025namespace open_power
26{
27namespace occ
28{
29
Chicago Duanbb895cb2021-06-18 19:37:16 +080030#ifdef READ_OCC_SENSORS
31enum occFruType
32{
33 processorCore = 0,
34 internalMemCtlr = 1,
35 dimm = 2,
36 memCtrlAndDimm = 3,
37 VRMVdd = 6,
38 PMIC = 7,
Matt Spinlerace67d82021-10-18 13:41:57 -050039 memCtlrExSensor = 8,
40 processorIoRing = 9
Chicago Duanbb895cb2021-06-18 19:37:16 +080041};
42#endif
43
Chris Caina8857c52021-01-27 11:53:05 -060044/** @brief Default time, in seconds, between OCC poll commands */
Matt Spinler37923462021-09-24 11:38:05 -050045#ifndef POWER10
Chicago Duanbb895cb2021-06-18 19:37:16 +080046constexpr unsigned int defaultPollingInterval = 1;
Matt Spinler37923462021-09-24 11:38:05 -050047#else
48constexpr unsigned int defaultPollingInterval = 5;
49#endif
Chris Caina8857c52021-01-27 11:53:05 -060050
Chris Cain17257672021-10-22 13:41:03 -050051constexpr auto AMBIENT_PATH =
52 "/xyz/openbmc_project/sensors/temperature/Ambient_Virtual_Temp";
53constexpr auto AMBIENT_INTERFACE = "xyz.openbmc_project.Sensor.Value";
54constexpr auto AMBIENT_PROP = "Value";
55constexpr auto ALTITUDE_PATH = "/xyz/openbmc_project/sensors/altitude/Altitude";
56constexpr auto ALTITUDE_INTERFACE = "xyz.openbmc_project.Sensor.Value";
57constexpr auto ALTITUDE_PROP = "Value";
58
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +053059/** @class Manager
60 * @brief Builds and manages OCC objects
61 */
62struct Manager
63{
Gunnar Mills94df8c92018-09-14 14:50:03 -050064 public:
65 Manager() = delete;
66 Manager(const Manager&) = delete;
67 Manager& operator=(const Manager&) = delete;
68 Manager(Manager&&) = delete;
69 Manager& operator=(Manager&&) = delete;
70 ~Manager() = default;
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +053071
Gunnar Mills94df8c92018-09-14 14:50:03 -050072 /** @brief Adds OCC pass-through and status objects on the bus
73 * when corresponding CPU inventory is created.
74 *
Gunnar Mills94df8c92018-09-14 14:50:03 -050075 * @param[in] event - Unique ptr reference to sd_event
76 */
George Liuf3a4a692021-12-28 13:59:51 +080077 explicit Manager(EventPtr& event) :
George Liuf3b75142021-06-10 11:22:50 +080078 event(event), pollInterval(defaultPollingInterval),
Chris Caina8857c52021-01-27 11:53:05 -060079 sdpEvent(sdeventplus::Event::get_default()),
80 _pollTimer(
81 std::make_unique<
82 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>(
Chris Cain17257672021-10-22 13:41:03 -050083 sdpEvent, std::bind(&Manager::pollerTimerExpired, this))),
84 ambientPropChanged(
85 utils::getBus(),
86 sdbusRule::member("PropertiesChanged") +
87 sdbusRule::path(AMBIENT_PATH) +
88 sdbusRule::argN(0, AMBIENT_INTERFACE) +
89 sdbusRule::interface("org.freedesktop.DBus.Properties"),
90 std::bind(&Manager::ambientCallback, this, std::placeholders::_1))
Tom Joseph815f9f52020-07-27 12:12:13 +053091#ifdef PLDM
92 ,
93 pldmHandle(std::make_unique<pldm::Interface>(
George Liuf3b75142021-06-10 11:22:50 +080094 std::bind(std::mem_fn(&Manager::updateOCCActive), this,
Eddie Jamescbad2192021-10-07 09:39:39 -050095 std::placeholders::_1, std::placeholders::_2),
96 std::bind(std::mem_fn(&Manager::sbeHRESETResult), this,
Chris Cainbae4d072022-02-28 09:46:50 -060097 std::placeholders::_1, std::placeholders::_2),
Sheldon Bailey31a2f132022-05-20 11:31:52 -050098 std::bind(std::mem_fn(&Manager::updateOccSafeMode), this,
99 std::placeholders::_1),
Chris Cainbae4d072022-02-28 09:46:50 -0600100 event))
Tom Joseph815f9f52020-07-27 12:12:13 +0530101#endif
Matt Spinlerd267cec2021-09-01 14:49:19 -0500102#ifdef POWER10
103 ,
104 discoverTimer(
105 std::make_unique<
106 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>(
Chris Caina7b74dc2021-11-10 17:03:43 -0600107 sdpEvent, std::bind(&Manager::findAndCreateObjects, this))),
108 waitForAllOccsTimer(
109 std::make_unique<
110 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>(
111 sdpEvent, std::bind(&Manager::occsNotAllRunning, this)))
Chris Cain755af102024-02-27 16:09:51 -0600112#ifdef PLDM
113 ,
Chris Cainc33171b2024-05-24 16:14:50 -0500114 throttlePldmTraceTimer(
Chris Cain755af102024-02-27 16:09:51 -0600115 std::make_unique<
116 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>(
Chris Cainc33171b2024-05-24 16:14:50 -0500117 sdpEvent, std::bind(&Manager::throttlePldmTraceExpired, this)))
Matt Spinlerd267cec2021-09-01 14:49:19 -0500118#endif
Chris Cain755af102024-02-27 16:09:51 -0600119#endif // POWER10
Gunnar Mills94df8c92018-09-14 14:50:03 -0500120 {
Lei YU0ab90ca2017-07-13 17:02:23 +0800121#ifdef I2C_OCC
Gunnar Mills94df8c92018-09-14 14:50:03 -0500122 // I2C OCC status objects are initialized directly
123 initStatusObjects();
Lei YU0ab90ca2017-07-13 17:02:23 +0800124#else
Gunnar Mills94df8c92018-09-14 14:50:03 -0500125 findAndCreateObjects();
Lei YU0ab90ca2017-07-13 17:02:23 +0800126#endif
Chris Cain17257672021-10-22 13:41:03 -0500127 readAltitude();
Gunnar Mills94df8c92018-09-14 14:50:03 -0500128 }
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +0530129
Chris Caina8857c52021-01-27 11:53:05 -0600130 /** @brief Return the number of bound OCCs */
Gunnar Mills94df8c92018-09-14 14:50:03 -0500131 inline auto getNumOCCs() const
132 {
133 return activeCount;
134 }
Edward A. James636577f2017-10-06 10:53:55 -0500135
Eddie Jamescbad2192021-10-07 09:39:39 -0500136#ifdef PLDM
137 /** @brief Called by a Device to report that the SBE timed out
138 * and appropriate action should be taken
139 *
140 * @param[in] instance - the OCC instance id
141 */
142 void sbeTimeout(unsigned int instance);
143#endif
144
Chris Cain17257672021-10-22 13:41:03 -0500145 /** @brief Return the latest ambient and altitude readings
146 *
147 * @param[out] ambientValid - true if ambientTemp is valid
148 * @param[out] ambient - ambient temperature in degrees C
149 * @param[out] altitude - altitude in meters
150 */
151 void getAmbientData(bool& ambientValid, uint8_t& ambientTemp,
152 uint16_t& altitude) const;
153
Chris Cain40501a22022-03-14 17:33:27 -0500154 /** @brief Notify pcap object to update bounds */
155 void updatePcapBounds() const;
156
Sheldon Baileyc8dd4592022-05-12 10:15:14 -0500157 /**
158 * @brief Set all sensor values of this OCC to NaN.
159 * @param[in] id - Id of the OCC.
160 * */
161 void setSensorValueToNaN(uint32_t id) const;
162
Sheldon Bailey373af752022-02-21 15:14:00 -0600163 /** @brief Set all sensor values of this OCC to NaN and non functional.
164 *
165 * @param[in] id - Id of the OCC.
166 */
167 void setSensorValueToNonFunctional(uint32_t id) const;
168
Gunnar Mills94df8c92018-09-14 14:50:03 -0500169 private:
Matt Spinlerd267cec2021-09-01 14:49:19 -0500170 /** @brief Creates the OCC D-Bus objects.
Gunnar Mills94df8c92018-09-14 14:50:03 -0500171 */
172 void findAndCreateObjects();
Vishwanatha Subbannadfc7ec72017-09-07 18:18:01 +0530173
Gunnar Mills94df8c92018-09-14 14:50:03 -0500174 /** @brief Callback that responds to cpu creation in the inventory -
175 * by creating the needed objects.
176 *
177 * @param[in] msg - bus message
178 *
179 * @returns 0 to indicate success
180 */
Patrick Williamsaf408082022-07-22 19:26:54 -0500181 int cpuCreated(sdbusplus::message_t& msg);
Deepak Kodihalli5f031f32017-07-26 08:25:59 -0500182
Gunnar Mills94df8c92018-09-14 14:50:03 -0500183 /** @brief Create child OCC objects.
184 *
185 * @param[in] occ - the occ name, such as occ0.
186 */
187 void createObjects(const std::string& occ);
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +0530188
Gunnar Mills94df8c92018-09-14 14:50:03 -0500189 /** @brief Callback handler invoked by Status object when the OccActive
190 * property is changed. This is needed to make sure that the
191 * error detection is started only after all the OCCs are bound.
192 * Similarly, when one of the OCC gets its OccActive property
193 * un-set, then the OCC error detection needs to be stopped on
194 * all the OCCs
195 *
196 * @param[in] status - OccActive status
197 */
Sheldon Bailey373af752022-02-21 15:14:00 -0600198 void statusCallBack(instanceID instance, bool status);
Vishwanatha Subbanna2dc9b1a2017-08-18 18:29:41 +0530199
Gunnar Mills94df8c92018-09-14 14:50:03 -0500200 /** @brief Sends a Heartbeat command to host control command handler */
201 void sendHeartBeat();
Vishwanatha Subbanna2dc9b1a2017-08-18 18:29:41 +0530202
Gunnar Mills94df8c92018-09-14 14:50:03 -0500203 /** @brief reference to sd_event wrapped in unique_ptr */
204 EventPtr& event;
Vishwanatha Subbannaee4d83d2017-06-29 18:35:00 +0530205
Gunnar Mills94df8c92018-09-14 14:50:03 -0500206 /** @brief OCC pass-through objects */
207 std::vector<std::unique_ptr<PassThrough>> passThroughObjects;
Vishwanatha Subbanna307d80b2017-06-28 15:56:09 +0530208
Gunnar Mills94df8c92018-09-14 14:50:03 -0500209 /** @brief OCC Status objects */
210 std::vector<std::unique_ptr<Status>> statusObjects;
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +0530211
Chris Cain40501a22022-03-14 17:33:27 -0500212 /** @brief Power cap monitor and occ notification object */
213 std::unique_ptr<open_power::occ::powercap::PowerCap> pcap;
214
Chris Cain78e86012021-03-04 16:15:31 -0600215#ifdef POWER10
216 /** @brief Power mode monitor and notification object */
217 std::unique_ptr<open_power::occ::powermode::PowerMode> pmode;
218#endif
219
Gunnar Mills94df8c92018-09-14 14:50:03 -0500220 /** @brief sbdbusplus match objects */
221 std::vector<sdbusplus::bus::match_t> cpuMatches;
Vishwanatha Subbanna2dc9b1a2017-08-18 18:29:41 +0530222
Gunnar Mills94df8c92018-09-14 14:50:03 -0500223 /** @brief Number of OCCs that are bound */
224 uint8_t activeCount = 0;
Lei YU0ab90ca2017-07-13 17:02:23 +0800225
Chris Caina8857c52021-01-27 11:53:05 -0600226 /** @brief Number of seconds between poll commands */
227 uint8_t pollInterval;
228
Chris Cain17257672021-10-22 13:41:03 -0500229 /** @brief Ambient temperature of the system in degrees C */
230 uint8_t ambient = 0xFF; // default: not available
231
232 /** @brief Altitude of the system in meters */
233 uint16_t altitude = 0xFFFF; // default: not available
234
Chris Caina8857c52021-01-27 11:53:05 -0600235 /** @brief Poll timer event */
236 sdeventplus::Event sdpEvent;
237
Chris Cainbae4d072022-02-28 09:46:50 -0600238 /** @brief Flags to indicate if waiting for all of the OCC active sensors to
239 * come online */
240 bool waitingForAllOccActiveSensors = false;
241
Chris Cainbd551de2022-04-26 13:41:16 -0500242 /** @brief Set containing intance numbers of any OCCs that became active
243 * while waiting for status objects to be created */
244 std::set<uint8_t> queuedActiveState;
245
Chris Caina8857c52021-01-27 11:53:05 -0600246 /**
247 * @brief The timer to be used once the OCC goes active. When it expires,
248 * a POLL command will be sent to the OCC and then timer restarted.
249 */
250 std::unique_ptr<
251 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>
252 _pollTimer;
253
Chris Cain17257672021-10-22 13:41:03 -0500254 /** @brief Subscribe to ambient temperature changed events */
255 sdbusplus::bus::match_t ambientPropChanged;
256
Lei YU0ab90ca2017-07-13 17:02:23 +0800257#ifdef I2C_OCC
Gunnar Mills94df8c92018-09-14 14:50:03 -0500258 /** @brief Init Status objects for I2C OCC devices
259 *
260 * It iterates in /sys/bus/i2c/devices, finds all occ hwmon devices
261 * and creates status objects.
262 */
263 void initStatusObjects();
Lei YU0ab90ca2017-07-13 17:02:23 +0800264#endif
Tom Joseph815f9f52020-07-27 12:12:13 +0530265
266#ifdef PLDM
267 /** @brief Callback handler invoked by the PLDM event handler when state of
268 * the OCC is toggled by the host. The caller passes the instance
269 * of the OCC and state of the OCC.
270 *
271 * @param[in] instance - instance of the OCC
272 * @param[in] status - true when the OCC goes active and false when the OCC
273 * goes inactive
274 *
275 * @return true if setting the state of OCC is successful and false if it
276 * fails.
277 */
278 bool updateOCCActive(instanceID instance, bool status);
279
Sheldon Bailey31a2f132022-05-20 11:31:52 -0500280 /** @brief Callback handler invoked by the PLDM event handler when mode of
281 * the OCC SAFE MODE is inacted or cleared.
282 */
283 void updateOccSafeMode(bool safeState);
284
Eddie Jamescbad2192021-10-07 09:39:39 -0500285 /** @brief Callback handler invoked by PLDM sensor change when
286 * the HRESET succeeds or fails.
287 *
288 * @param[in] instance - the SBE instance id
289 * @param[in] success - true if the HRESET succeeded, otherwise false
290 */
291 void sbeHRESETResult(instanceID instance, bool success);
292
293 /** @brief Helper function to check whether an SBE dump should be collected
294 * now.
295 *
296 * @param[in] instance - the SBE instance id
297 *
298 * @return true if an SBE dump should be collected and false if not
299 */
300 bool sbeCanDump(unsigned int instance);
301
302 /** @brief Helper function to set the SBE state through PDBG/PHAL
303 *
304 * @param[in] instance - instance of the SBE
305 * @param[in] state - the state to which the SBE should be set
306 *
307 */
308 void setSBEState(unsigned int instance, enum sbe_state state);
309
310 /** @brief Helper function to get the SBE instance PDBG processor target
311 *
312 * @param[in] instance - the SBE instance id
313 *
314 * @return a pointer to the PDBG target
315 */
316 struct pdbg_target* getPdbgTarget(unsigned int instance);
317
318 /** @brief Whether pdbg_targets_init has been called */
319 bool pdbgInitialized = false;
320
Tom Joseph815f9f52020-07-27 12:12:13 +0530321 std::unique_ptr<pldm::Interface> pldmHandle = nullptr;
322#endif
Chris Caina8857c52021-01-27 11:53:05 -0600323
Matt Spinlerd267cec2021-09-01 14:49:19 -0500324#ifdef POWER10
325 /**
326 * @brief Timer used when discovering OCCs in /dev.
327 */
328 std::unique_ptr<
329 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>
330 discoverTimer;
331
332 /**
333 * @brief Used when discovering /dev/occ objects to know if
334 * any were added since the last check.
335 */
336 std::vector<int> prevOCCSearch;
Chris Caina7b74dc2021-11-10 17:03:43 -0600337
338 /**
339 * @brief Timer used when waiting for OCCs to go active.
340 */
341 std::unique_ptr<
342 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>
343 waitForAllOccsTimer;
344
Chris Cain755af102024-02-27 16:09:51 -0600345#ifdef PLDM
346 /**
347 * @brief Timer used to throttle PLDM traces when there are problems
348 determining the OCC status via pldm. Used to prevent excessive
349 journal traces.
350 */
351 std::unique_ptr<
352 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>
Chris Cainc33171b2024-05-24 16:14:50 -0500353 throttlePldmTraceTimer;
354 /**
355 * @brief onPldmTimeoutCreatePel flag will be used to indicate if
356 * a PEL should get created when the throttlePldmTraceTimer expires.
357 * The first time the throttlePldmTraceTimer expires, the traces
358 * will be throttled and then the timer gets restarted. The
359 * next time the timer expires, a PEL will get created.
360 */
361 bool onPldmTimeoutCreatePel = false;
Chris Cain755af102024-02-27 16:09:51 -0600362
363 /** @brief Check if all of the OCC Active sensors are available and if not
364 * restart the discoverTimer
365 */
Chris Cainc33171b2024-05-24 16:14:50 -0500366 void throttlePldmTraceExpired();
Chris Cain4b82f3e2024-04-22 14:44:29 -0500367
368 /** @brief Create a PEL when the code is not able to obtain the OCC PDRs
Chris Cainc33171b2024-05-24 16:14:50 -0500369 * via PLDM. This is called when the throttlePldmTraceTimer expires.
Chris Cain4b82f3e2024-04-22 14:44:29 -0500370 */
371 void createPldmSensorPEL();
Chris Cain755af102024-02-27 16:09:51 -0600372#endif
373
Chris Caina7b74dc2021-11-10 17:03:43 -0600374 /** @brief Called when code times out waiting for all OCCs to be running or
375 * after the app is restarted (Status does not callback into
376 * Manager).
377 */
378 void occsNotAllRunning();
Chris Cainbae4d072022-02-28 09:46:50 -0600379
380 /** @brief Check if all of the OCC Active sensors are available and if not
381 * restart the discoverTimer
382 */
383 void checkAllActiveSensors();
Chris Cain755af102024-02-27 16:09:51 -0600384#endif // POWER10
Matt Spinlerd267cec2021-09-01 14:49:19 -0500385
Chris Caina8857c52021-01-27 11:53:05 -0600386 /**
387 * @brief Called when poll timer expires and forces a POLL command to the
388 * OCC. The poll timer will then be restarted.
389 * */
390 void pollerTimerExpired();
Chicago Duanbb895cb2021-06-18 19:37:16 +0800391
Matt Spinlerd267cec2021-09-01 14:49:19 -0500392 /**
393 * @brief Finds the OCC devices in /dev
394 *
395 * @return The IDs of the OCCs - 0, 1, etc.
396 */
397 std::vector<int> findOCCsInDev();
398
Chicago Duanbb895cb2021-06-18 19:37:16 +0800399#ifdef READ_OCC_SENSORS
400 /**
401 * @brief Gets the occ sensor values.
Chris Cain5d66a0a2022-02-09 08:52:10 -0600402 * @param[in] occ - pointer to OCCs Status object
Chicago Duanbb895cb2021-06-18 19:37:16 +0800403 * */
Chris Cain5d66a0a2022-02-09 08:52:10 -0600404 void getSensorValues(std::unique_ptr<Status>& occ);
Chicago Duanbb895cb2021-06-18 19:37:16 +0800405
406 /**
407 * @brief Trigger OCC driver to read the temperature sensors.
408 * @param[in] path - path of the OCC sensors.
409 * @param[in] id - Id of the OCC.
410 * */
411 void readTempSensors(const fs::path& path, uint32_t id);
412
413 /**
414 * @brief Trigger OCC driver to read the power sensors.
415 * @param[in] path - path of the OCC sensors.
416 * @param[in] id - Id of the OCC.
417 * */
418 void readPowerSensors(const fs::path& path, uint32_t id);
419
Chicago Duanbb895cb2021-06-18 19:37:16 +0800420 /** @brief Store the existing OCC sensors on D-BUS */
421 std::map<std::string, uint32_t> existingSensors;
422
423 /** @brief Get FunctionID from the `powerX_label` file.
424 * @param[in] value - the value of the `powerX_label` file.
425 * @returns FunctionID of the power sensors.
426 */
427 std::optional<std::string>
428 getPowerLabelFunctionID(const std::string& value);
429
430 /** @brief The power sensor names map */
431 const std::map<std::string, std::string> powerSensorName = {
432 {"system", "total_power"}, {"1", "p0_mem_power"},
433 {"2", "p1_mem_power"}, {"3", "p2_mem_power"},
434 {"4", "p3_mem_power"}, {"5", "p0_power"},
435 {"6", "p1_power"}, {"7", "p2_power"},
436 {"8", "p3_power"}, {"9", "p0_cache_power"},
437 {"10", "p1_cache_power"}, {"11", "p2_cache_power"},
438 {"12", "p3_cache_power"}, {"13", "io_a_power"},
439 {"14", "io_b_power"}, {"15", "io_c_power"},
440 {"16", "fans_a_power"}, {"17", "fans_b_power"},
441 {"18", "storage_a_power"}, {"19", "storage_b_power"},
442 {"23", "mem_cache_power"}, {"25", "p0_mem_0_power"},
Sheldon Bailey11fd1312022-04-19 10:16:58 -0500443 {"26", "p0_mem_1_power"}, {"27", "p0_mem_2_power"},
444 {"35", "pcie_dcm0_power"}, {"36", "pcie_dcm1_power"},
445 {"37", "pcie_dcm2_power"}, {"38", "pcie_dcm3_power"},
446 {"39", "io_dcm0_power"}, {"40", "io_dcm1_power"},
447 {"41", "io_dcm2_power"}, {"42", "io_dcm3_power"},
448 {"43", "avdd_total_power"}};
Chicago Duanbb895cb2021-06-18 19:37:16 +0800449
Sheldon Bailey11fd1312022-04-19 10:16:58 -0500450 /** @brief The dimm temperature sensor names map */
Chicago Duanbb895cb2021-06-18 19:37:16 +0800451 const std::map<uint32_t, std::string> dimmTempSensorName = {
452 {internalMemCtlr, "_intmb_temp"},
453 {dimm, "_dram_temp"},
454 {memCtrlAndDimm, "_dram_extmb_temp"},
455 {PMIC, "_pmic_temp"},
456 {memCtlrExSensor, "_extmb_temp"}};
Matt Spinlerad8f4522023-10-25 11:14:46 -0500457
458 /** @brief The dimm DVFS temperature sensor names map */
459 const std::map<uint32_t, std::string> dimmDVFSSensorName = {
460 {internalMemCtlr, "dimm_intmb_dvfs_temp"},
461 {dimm, "dimm_dram_dvfs_temp"},
462 {memCtrlAndDimm, "dimm_dram_extmb_dvfs_temp"},
463 {PMIC, "dimm_pmic_dvfs_temp"},
464 {memCtlrExSensor, "dimm_extmb_dvfs_temp"}};
Chicago Duanbb895cb2021-06-18 19:37:16 +0800465#endif
Chris Cain17257672021-10-22 13:41:03 -0500466
467 /** @brief Read the altitude from DBus */
468 void readAltitude();
469
470 /** @brief Callback function when ambient temperature changes
471 *
472 * @param[in] msg - Data associated with subscribed signal
473 */
Patrick Williamsaf408082022-07-22 19:26:54 -0500474 void ambientCallback(sdbusplus::message_t& msg);
Chris Caina7b74dc2021-11-10 17:03:43 -0600475
476 /** @brief Confirm that a single OCC master was found and start presence
477 * monitoring
478 */
479 void validateOccMaster();
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +0530480};
481
482} // namespace occ
483} // namespace open_power