blob: 4095cce52f37df73c4244015f584a2df7e022b9e [file] [log] [blame]
Matt Spinlerc8705e22019-09-11 12:36:07 -05001#pragma once
2
Matt Spinler2a28c932020-02-03 14:23:40 -06003#include "dbus_types.hpp"
4#include "dbus_watcher.hpp"
5
Matt Spinler4dcd3f42020-01-22 14:55:07 -06006#include <filesystem>
Matt Spinlera7d9d962019-11-06 15:01:25 -06007#include <phosphor-logging/log.hpp>
Matt Spinlerc8705e22019-09-11 12:36:07 -05008#include <sdbusplus/bus.hpp>
9#include <sdbusplus/bus/match.hpp>
10
11namespace openpower
12{
13namespace pels
14{
15
Matt Spinlerc8705e22019-09-11 12:36:07 -050016/**
17 * @class DataInterface
18 *
Matt Spinler19e89ce2019-11-06 13:02:23 -060019 * A base class for gathering data about the system for use
20 * in PELs. Implemented this way to facilitate mocking.
Matt Spinlerc8705e22019-09-11 12:36:07 -050021 */
22class DataInterfaceBase
23{
24 public:
25 DataInterfaceBase() = default;
26 virtual ~DataInterfaceBase() = default;
27 DataInterfaceBase(const DataInterfaceBase&) = default;
28 DataInterfaceBase& operator=(const DataInterfaceBase&) = default;
29 DataInterfaceBase(DataInterfaceBase&&) = default;
30 DataInterfaceBase& operator=(DataInterfaceBase&&) = default;
31
32 /**
Matt Spinler19e89ce2019-11-06 13:02:23 -060033 * @brief Returns the machine Type/Model
Matt Spinlerc8705e22019-09-11 12:36:07 -050034 *
35 * @return string - The machine Type/Model string
36 */
Vijay Lobo81b4dca2021-04-29 00:04:00 -050037 virtual std::string getMachineTypeModel() const = 0;
Matt Spinlerc8705e22019-09-11 12:36:07 -050038
39 /**
Matt Spinler19e89ce2019-11-06 13:02:23 -060040 * @brief Returns the machine serial number
Matt Spinlerc8705e22019-09-11 12:36:07 -050041 *
42 * @return string - The machine serial number
43 */
Vijay Lobo81b4dca2021-04-29 00:04:00 -050044 virtual std::string getMachineSerialNumber() const = 0;
Matt Spinler19e89ce2019-11-06 13:02:23 -060045
Matt Spinlera7d9d962019-11-06 15:01:25 -060046 /**
Matt Spinlercce14112019-12-11 14:20:36 -060047 * @brief Says if the system is managed by a hardware
48 * management console.
49 * @return bool - If the system is HMC managed
50 */
51 virtual bool isHMCManaged() const
52 {
53 return _hmcManaged;
54 }
55
56 /**
Matt Spinlera7d9d962019-11-06 15:01:25 -060057 * @brief Says if the host is up and running
58 *
59 * @return bool - If the host is running
60 */
61 virtual bool isHostUp() const
62 {
63 return _hostUp;
64 }
65
66 using HostStateChangeFunc = std::function<void(bool)>;
67
68 /**
69 * @brief Register a callback function that will get
70 * called on all host on/off transitions.
71 *
72 * The void(bool) function will get passed the new
73 * value of the host state.
74 *
75 * @param[in] name - The subscription name
76 * @param[in] func - The function to run
77 */
78 void subscribeToHostStateChange(const std::string& name,
79 HostStateChangeFunc func)
80 {
81 _hostChangeCallbacks[name] = func;
82 }
83
84 /**
85 * @brief Unsubscribe from host state changes.
86 *
87 * @param[in] name - The subscription name
88 */
89 void unsubscribeFromHostStateChange(const std::string& name)
90 {
91 _hostChangeCallbacks.erase(name);
92 }
93
Matt Spinlercad9c2b2019-12-02 15:42:01 -060094 /**
95 * @brief Returns the BMC firmware version
96 *
97 * @return std::string - The BMC version
98 */
99 virtual std::string getBMCFWVersion() const
100 {
101 return _bmcFWVersion;
102 }
103
104 /**
105 * @brief Returns the server firmware version
106 *
107 * @return std::string - The server firmware version
108 */
109 virtual std::string getServerFWVersion() const
110 {
111 return _serverFWVersion;
112 }
113
Matt Spinler4dcd3f42020-01-22 14:55:07 -0600114 /**
Matt Spinler677381b2020-01-23 10:04:29 -0600115 * @brief Returns the BMC FW version ID
116 *
117 * @return std::string - The BMC FW version ID
118 */
119 virtual std::string getBMCFWVersionID() const
120 {
121 return _bmcFWVersionID;
122 }
123
124 /**
Matt Spinler4dcd3f42020-01-22 14:55:07 -0600125 * @brief Returns the process name given its PID.
126 *
127 * @param[in] pid - The PID value as a string
128 *
129 * @return std::optional<std::string> - The name, or std::nullopt
130 */
131 std::optional<std::string> getProcessName(const std::string& pid) const
132 {
133 namespace fs = std::filesystem;
134
135 fs::path path{"/proc"};
136 path /= fs::path{pid} / "exe";
137
138 if (fs::exists(path))
139 {
140 return fs::read_symlink(path);
141 }
142
143 return std::nullopt;
144 }
145
Matt Spinler9cf3cfd2020-02-03 14:41:55 -0600146 /**
147 * @brief Returns the 'send event logs to host' setting.
148 *
149 * @return bool - If sending PELs to the host is enabled.
150 */
151 virtual bool getHostPELEnablement() const
152 {
153 return _sendPELsToHost;
154 }
155
Matt Spinler4aa23a12020-02-03 15:05:09 -0600156 /**
157 * @brief Returns the BMC state
158 *
159 * @return std::string - The BMC state property value
160 */
161 virtual std::string getBMCState() const
162 {
163 return _bmcState;
164 }
165
166 /**
167 * @brief Returns the Chassis state
168 *
169 * @return std::string - The chassis state property value
170 */
171 virtual std::string getChassisState() const
172 {
173 return _chassisState;
174 }
175
176 /**
177 * @brief Returns the chassis requested power
178 * transition value.
179 *
180 * @return std::string - The chassis transition property
181 */
182 virtual std::string getChassisTransition() const
183 {
184 return _chassisTransition;
185 }
186
187 /**
188 * @brief Returns the Host state
189 *
190 * @return std::string - The Host state property value
191 */
192 virtual std::string getHostState() const
193 {
194 return _hostState;
195 }
196
Matt Spinlerb3d488f2020-02-21 15:30:46 -0600197 /**
Sumit Kumar2c36fdd2021-09-21 03:12:11 -0500198 * @brief Returns the Boot state
199 *
200 * @return std::string - The Boot state property value
201 */
202 virtual std::string getBootState() const
203 {
204 return _bootState;
205 }
206
207 /**
Matt Spinlerb3d488f2020-02-21 15:30:46 -0600208 * @brief Returns the motherboard CCIN
209 *
210 * @return std::string The motherboard CCIN
211 */
Vijay Lobo81b4dca2021-04-29 00:04:00 -0500212 virtual std::string getMotherboardCCIN() const = 0;
Matt Spinlerb3d488f2020-02-21 15:30:46 -0600213
Matt Spinler60c4e792020-03-13 13:45:36 -0500214 /**
Ben Tynere32b7e72021-05-18 12:38:40 -0500215 * @brief Returns the system IM
216 *
217 * @return std::string The system IM
218 */
219 virtual std::vector<uint8_t> getSystemIMKeyword() const = 0;
220
221 /**
Matt Spinler60c4e792020-03-13 13:45:36 -0500222 * @brief Get the fields from the inventory necessary for doing
223 * a callout on an inventory path.
224 *
225 * @param[in] inventoryPath - The item to get the data for
Matt Spinler60c4e792020-03-13 13:45:36 -0500226 * @param[out] fruPartNumber - Filled in with the VINI/FN keyword
227 * @param[out] ccin - Filled in with the VINI/CC keyword
228 * @param[out] serialNumber - Filled in with the VINI/SN keyword
229 */
230 virtual void getHWCalloutFields(const std::string& inventoryPath,
Matt Spinler60c4e792020-03-13 13:45:36 -0500231 std::string& fruPartNumber,
232 std::string& ccin,
233 std::string& serialNumber) const = 0;
234
Matt Spinler03984582020-04-09 13:17:58 -0500235 /**
Matt Spinler9b90e2a2020-04-14 10:59:04 -0500236 * @brief Get the location code for an inventory item.
237 *
238 * @param[in] inventoryPath - The item to get the data for
239 *
240 * @return std::string - The location code
241 */
242 virtual std::string
243 getLocationCode(const std::string& inventoryPath) const = 0;
244
245 /**
Matt Spinler6ea4d5f2020-05-20 13:31:07 -0500246 * @brief Get the list of system type names the system is called.
Matt Spinler03984582020-04-09 13:17:58 -0500247 *
Matt Spinler6ea4d5f2020-05-20 13:31:07 -0500248 * @return std::vector<std::string> - The list of names
Matt Spinler03984582020-04-09 13:17:58 -0500249 */
Matt Spinler1ab66962020-10-29 13:21:44 -0500250 virtual std::vector<std::string> getSystemNames() const = 0;
Matt Spinler03984582020-04-09 13:17:58 -0500251
Matt Spinler5fb24c12020-06-04 11:21:33 -0500252 /**
253 * @brief Fills in the placeholder 'Ufcs' in the passed in location
254 * code with the machine feature code and serial number, which
255 * is needed to create a valid location code.
256 *
257 * @param[in] locationCode - Location code value starting with Ufcs-, and
258 * if that isn't present it will be added first.
259 *
260 * @param[in] node - The node number the location is on.
261 *
262 * @return std::string - The expanded location code
263 */
264 virtual std::string expandLocationCode(const std::string& locationCode,
265 uint16_t node) const = 0;
266
267 /**
268 * @brief Returns the inventory path for the FRU that the location
269 * code represents.
270 *
Matt Spinler2f9225a2020-08-05 12:58:49 -0500271 * @param[in] locationCode - If an expanded location code, then the
272 * full location code.
273 * If not expanded, a location code value
274 * starting with Ufcs-, and if that isn't
275 * present it will be added first.
Matt Spinler5fb24c12020-06-04 11:21:33 -0500276 *
Matt Spinler2f9225a2020-08-05 12:58:49 -0500277 * @param[in] node - The node number the location is on. Ignored if the
278 * expanded location code is passed in.
279 *
280 * @param[in] expanded - If the location code already has the relevent
281 * VPD fields embedded in it.
Matt Spinler5fb24c12020-06-04 11:21:33 -0500282 *
283 * @return std::string - The inventory D-Bus object
284 */
Matt Spinler2f9225a2020-08-05 12:58:49 -0500285 virtual std::string getInventoryFromLocCode(const std::string& LocationCode,
286 uint16_t node,
287 bool expanded) const = 0;
Matt Spinler5fb24c12020-06-04 11:21:33 -0500288
Matt Spinler34a904c2020-08-05 14:53:28 -0500289 /**
Matt Spinler34a904c2020-08-05 14:53:28 -0500290 * @brief Sets the Asserted property on the LED group passed in.
291 *
292 * @param[in] ledGroup - The LED group D-Bus path
293 * @param[in] value - The value to set it to
294 */
295 virtual void assertLEDGroup(const std::string& ledGroup,
296 bool value) const = 0;
297
Matt Spinler993168d2021-04-07 16:05:03 -0500298 /**
299 * @brief Sets the Functional property on the OperationalStatus
300 * interface on a D-Bus object.
301 *
302 * @param[in] objectPath - The D-Bus object path
303 * @param[in] functional - The value
304 */
305 virtual void setFunctional(const std::string& objectPath,
306 bool functional) const = 0;
307
Sumit Kumar3b8ed7f2021-05-18 12:38:35 -0500308 /**
Sumit Kumar76198a22021-07-15 05:59:57 -0500309 * @brief Sets the critical association on the D-Bus object.
310 *
311 * @param[in] objectPath - The D-Bus object path
312 */
313 virtual void
314 setCriticalAssociation(const std::string& objectPath) const = 0;
315
316 /**
Sumit Kumar3b8ed7f2021-05-18 12:38:35 -0500317 * @brief Returns the manufacturing QuiesceOnError property
318 *
319 * @return bool - Manufacturing QuiesceOnError property
320 */
321 virtual bool getQuiesceOnError() const = 0;
322
Matt Spinler0d92b522021-06-16 13:28:17 -0600323 /**
324 * @brief Split location code into base and connector segments
325 *
326 * A location code that ends in '-Tx', where 'x' is a number,
327 * represents a connector, such as a USB cable connector.
328 *
329 * This function splits the passed in location code into a
330 * base and connector segment. e.g.:
331 * P0-T1 -> ['P0', '-T1']
332 * P0 -> ['P0', '']
333 *
334 * @param[in] locationCode - location code to split
335 * @return pair<string, string> - The base and connector segments
336 */
337 static std::pair<std::string, std::string>
338 extractConnectorFromLocCode(const std::string& locationCode);
339
Sumit Kumar9d43a722021-08-24 09:46:19 -0500340 /**
341 * @brief Returns the dump status
342 *
343 * @return bool dump status
344 */
345 virtual std::vector<bool>
346 checkDumpStatus(const std::vector<std::string>& type) const = 0;
347
Jayanth Othayothecaa2fc2021-11-05 02:02:52 -0500348 /**
349 * @brief Create guard record
350 *
351 * @param[in] binPath: phal devtree binary path used as key
352 * @param[in] type: Guard type
353 * @param[in] logPath: error log entry object path
354 */
355 virtual void createGuardRecord(const std::vector<uint8_t>& binPath,
356 const std::string& type,
357 const std::string& logPath) const = 0;
358
Sumit Kumar3e274432021-09-14 06:37:56 -0500359 /**
360 * @brief Create Progress SRC property on the boot progress
361 * interface on a D-Bus object.
362 *
363 * @param[in] priSRC - Primary SRC value (e.g. BD8D1001)
364 * @param[in] srcStruct - Full SRC base structure
365 */
366 virtual void
367 createProgressSRC(const uint64_t& priSRC,
368 const std::vector<uint8_t>& srcStruct) const = 0;
369
Sumit Kumar027bf282022-01-24 11:25:19 -0600370 /**
371 * @brief Get the list of unresolved OpenBMC event log ids that have an
372 * associated hardware isolation entry.
373 *
374 * @return std::vector<uint32_t> - The list of log ids
375 */
376 virtual std::vector<uint32_t> getLogIDWithHwIsolation() const = 0;
377
Matt Spinler19e89ce2019-11-06 13:02:23 -0600378 protected:
379 /**
Matt Spinlera7d9d962019-11-06 15:01:25 -0600380 * @brief Sets the host on/off state and runs any
381 * callback functions (if there was a change).
382 */
Matt Spinler4aa23a12020-02-03 15:05:09 -0600383 void setHostUp(bool hostUp)
Matt Spinlera7d9d962019-11-06 15:01:25 -0600384 {
Matt Spinler4aa23a12020-02-03 15:05:09 -0600385 if (_hostUp != hostUp)
Matt Spinlera7d9d962019-11-06 15:01:25 -0600386 {
Matt Spinler4aa23a12020-02-03 15:05:09 -0600387 _hostUp = hostUp;
Matt Spinlera7d9d962019-11-06 15:01:25 -0600388
389 for (auto& [name, func] : _hostChangeCallbacks)
390 {
391 try
392 {
393 func(_hostUp);
394 }
Patrick Williams66491c62021-10-06 12:23:37 -0500395 catch (const std::exception& e)
Matt Spinlera7d9d962019-11-06 15:01:25 -0600396 {
397 using namespace phosphor::logging;
398 log<level::ERR>("A host state change callback threw "
399 "an exception");
400 }
401 }
402 }
403 }
404
405 /**
Matt Spinlercce14112019-12-11 14:20:36 -0600406 * @brief The hardware management console status. Always kept
407 * up to date.
408 */
409 bool _hmcManaged = false;
410
411 /**
Matt Spinlera7d9d962019-11-06 15:01:25 -0600412 * @brief The host up status. Always kept up to date.
413 */
414 bool _hostUp = false;
415
416 /**
417 * @brief The map of host state change subscriber
418 * names to callback functions.
419 */
420 std::map<std::string, HostStateChangeFunc> _hostChangeCallbacks;
Matt Spinlercad9c2b2019-12-02 15:42:01 -0600421
422 /**
423 * @brief The BMC firmware version string
424 */
425 std::string _bmcFWVersion;
426
427 /**
428 * @brief The server firmware version string
429 */
430 std::string _serverFWVersion;
Matt Spinler677381b2020-01-23 10:04:29 -0600431
432 /**
433 * @brief The BMC firmware version ID string
434 */
435 std::string _bmcFWVersionID;
Matt Spinler9cf3cfd2020-02-03 14:41:55 -0600436
437 /**
438 * @brief If sending PELs is enabled.
439 *
440 * This is usually set to false in manufacturing test.
441 */
442 bool _sendPELsToHost = true;
Matt Spinler4aa23a12020-02-03 15:05:09 -0600443
444 /**
445 * @brief The BMC state property
446 */
447 std::string _bmcState;
448
449 /**
450 * @brief The Chassis current power state property
451 */
452 std::string _chassisState;
453
454 /**
455 * @brief The Chassis requested power transition property
456 */
457 std::string _chassisTransition;
458
459 /**
460 * @brief The host state property
461 */
462 std::string _hostState;
Sumit Kumar2c36fdd2021-09-21 03:12:11 -0500463
464 /**
465 * @brief The boot state property
466 */
467 std::string _bootState;
Matt Spinlerc8705e22019-09-11 12:36:07 -0500468};
469
470/**
471 * @class DataInterface
472 *
473 * Concrete implementation of DataInterfaceBase.
474 */
475class DataInterface : public DataInterfaceBase
476{
477 public:
478 DataInterface() = delete;
479 ~DataInterface() = default;
480 DataInterface(const DataInterface&) = default;
481 DataInterface& operator=(const DataInterface&) = default;
482 DataInterface(DataInterface&&) = default;
483 DataInterface& operator=(DataInterface&&) = default;
484
485 /**
486 * @brief Constructor
487 *
488 * @param[in] bus - The sdbusplus bus object
489 */
490 explicit DataInterface(sdbusplus::bus::bus& bus);
491
Matt Spinlerb3f51862019-12-09 13:55:10 -0600492 /**
Matt Spinlerc8705e22019-09-11 12:36:07 -0500493 * @brief Finds the D-Bus service name that hosts the
494 * passed in path and interface.
495 *
496 * @param[in] objectPath - The D-Bus object path
497 * @param[in] interface - The D-Bus interface
498 */
499 DBusService getService(const std::string& objectPath,
Matt Spinlerb3f51862019-12-09 13:55:10 -0600500 const std::string& interface) const;
Matt Spinler9cf3cfd2020-02-03 14:41:55 -0600501
Matt Spinlerc8705e22019-09-11 12:36:07 -0500502 /**
503 * @brief Wrapper for the 'GetAll' properties method call
504 *
505 * @param[in] service - The D-Bus service to call it on
506 * @param[in] objectPath - The D-Bus object path
507 * @param[in] interface - The interface to get the props on
508 *
509 * @return DBusPropertyMap - The property results
510 */
511 DBusPropertyMap getAllProperties(const std::string& service,
512 const std::string& objectPath,
Matt Spinler2a28c932020-02-03 14:23:40 -0600513 const std::string& interface) const;
Matt Spinlerc8705e22019-09-11 12:36:07 -0500514 /**
Matt Spinlera7d9d962019-11-06 15:01:25 -0600515 * @brief Wrapper for the 'Get' properties method call
516 *
517 * @param[in] service - The D-Bus service to call it on
518 * @param[in] objectPath - The D-Bus object path
519 * @param[in] interface - The interface to get the property on
520 * @param[in] property - The property name
521 * @param[out] value - Filled in with the property value.
522 */
523 void getProperty(const std::string& service, const std::string& objectPath,
524 const std::string& interface, const std::string& property,
Matt Spinler2a28c932020-02-03 14:23:40 -0600525 DBusValue& value) const;
Vijay Lobo81b4dca2021-04-29 00:04:00 -0500526 /**
527 * @brief Returns the machine Type/Model
528 *
529 * @return string - The machine Type/Model string
530 */
531 std::string getMachineTypeModel() const override;
532
533 /**
534 * @brief Returns the machine serial number
535 *
536 * @return string - The machine serial number
537 */
538 std::string getMachineSerialNumber() const override;
539
540 /**
541 * @brief Returns the motherboard CCIN
542 *
543 * @return std::string The motherboard CCIN
544 */
545 std::string getMotherboardCCIN() const override;
Matt Spinler2a28c932020-02-03 14:23:40 -0600546
Matt Spinler60c4e792020-03-13 13:45:36 -0500547 /**
Ben Tynere32b7e72021-05-18 12:38:40 -0500548 * @brief Returns the system IM
549 *
550 * @return std::vector The system IM keyword in 4 byte vector
551 */
552 std::vector<uint8_t> getSystemIMKeyword() const override;
553
554 /**
Matt Spinler60c4e792020-03-13 13:45:36 -0500555 * @brief Get the fields from the inventory necessary for doing
556 * a callout on an inventory path.
557 *
558 * @param[in] inventoryPath - The item to get the data for
Matt Spinler60c4e792020-03-13 13:45:36 -0500559 * @param[out] fruPartNumber - Filled in with the VINI/FN keyword
560 * @param[out] ccin - Filled in with the VINI/CC keyword
561 * @param[out] serialNumber - Filled in with the VINI/SN keyword
562 */
563 void getHWCalloutFields(const std::string& inventoryPath,
Matt Spinler60c4e792020-03-13 13:45:36 -0500564 std::string& fruPartNumber, std::string& ccin,
565 std::string& serialNumber) const override;
566
Matt Spinler9b90e2a2020-04-14 10:59:04 -0500567 /**
568 * @brief Get the location code for an inventory item.
569 *
570 * Throws an exception if the inventory item doesn't have the
571 * location code interface.
572 *
573 * @param[in] inventoryPath - The item to get the data for
574 *
575 * @return std::string - The location code
576 */
577 std::string
578 getLocationCode(const std::string& inventoryPath) const override;
579
Matt Spinler5fb24c12020-06-04 11:21:33 -0500580 /**
Matt Spinler1ab66962020-10-29 13:21:44 -0500581 * @brief Get the list of system type names the system is called.
582 *
583 * @return std::vector<std::string> - The list of names
584 */
585 std::vector<std::string> getSystemNames() const override;
586
587 /**
Matt Spinler5fb24c12020-06-04 11:21:33 -0500588 * @brief Fills in the placeholder 'Ufcs' in the passed in location
589 * code with the machine feature code and serial number, which
590 * is needed to create a valid location code.
591 *
592 * @param[in] locationCode - Location code value starting with Ufcs-, and
593 * if that isn't present it will be added first.
594 *
595 * @param[in] node - The node number the location is one.
596 *
597 * @return std::string - The expanded location code
598 */
599 std::string expandLocationCode(const std::string& locationCode,
600 uint16_t node) const override;
601
602 /**
603 * @brief Returns the inventory path for the FRU that the location
604 * code represents.
605 *
Matt Spinler2f9225a2020-08-05 12:58:49 -0500606 * @param[in] locationCode - If an expanded location code, then the
607 * full location code.
608 * If not expanded, a location code value
609 * starting with Ufcs-, and if that isn't
610 * present it will be added first.
Matt Spinler5fb24c12020-06-04 11:21:33 -0500611 *
Matt Spinler2f9225a2020-08-05 12:58:49 -0500612 * @param[in] node - The node number the location is on. Ignored if the
613 * expanded location code is passed in.
614 *
615 * @param[in] expanded - If the location code already has the relevent
616 * VPD fields embedded in it.
Matt Spinler5fb24c12020-06-04 11:21:33 -0500617 *
618 * @return std::string - The inventory D-Bus object
619 */
Matt Spinler2f9225a2020-08-05 12:58:49 -0500620 std::string getInventoryFromLocCode(const std::string& locationCode,
621 uint16_t node,
622 bool expanded) const override;
Matt Spinler5fb24c12020-06-04 11:21:33 -0500623
Matt Spinler34a904c2020-08-05 14:53:28 -0500624 /**
Matt Spinler34a904c2020-08-05 14:53:28 -0500625 * @brief Sets the Asserted property on the LED group passed in.
626 *
627 * @param[in] ledGroup - The LED group D-Bus path
628 * @param[in] value - The value to set it to
629 */
630 void assertLEDGroup(const std::string& ledGroup, bool value) const override;
631
Matt Spinler993168d2021-04-07 16:05:03 -0500632 /**
633 * @brief Sets the Functional property on the OperationalStatus
634 * interface on a D-Bus object.
635 *
636 * @param[in] objectPath - The D-Bus object path
637 * @param[in] functional - The value
638 */
639 void setFunctional(const std::string& objectPath,
640 bool functional) const override;
641
Sumit Kumar3b8ed7f2021-05-18 12:38:35 -0500642 /**
Sumit Kumar76198a22021-07-15 05:59:57 -0500643 * @brief Sets the critical association on the D-Bus object.
644 *
645 * @param[in] objectPath - The D-Bus object path
646 */
647 void setCriticalAssociation(const std::string& objectPath) const override;
648
649 /**
Sumit Kumar3b8ed7f2021-05-18 12:38:35 -0500650 * @brief Returns the manufacturing QuiesceOnError property
651 *
652 * @return bool - Manufacturing QuiesceOnError property
653 */
654 bool getQuiesceOnError() const override;
655
Sumit Kumar9d43a722021-08-24 09:46:19 -0500656 /**
657 * @brief Returns the dump status
658 *
659 * @param[in] type - The dump type to check for
660 *
661 * @return bool dump status
662 */
663 std::vector<bool>
664 checkDumpStatus(const std::vector<std::string>& type) const override;
665
Jayanth Othayothecaa2fc2021-11-05 02:02:52 -0500666 /**
667 * @brief Create guard record
668 *
669 * @param[in] binPath: phal devtree binary path used as key
670 * @param[in] type: Guard type
671 * @param[in] logPath: error log entry object path
672 */
673 void createGuardRecord(const std::vector<uint8_t>& binPath,
674 const std::string& type,
675 const std::string& logPath) const override;
676
Sumit Kumar3e274432021-09-14 06:37:56 -0500677 /**
678 * @brief Create Progress SRC property on the boot progress
679 * interface on a D-Bus object.
680 *
681 * @param[in] priSRC - Primary SRC value
682 * @param[in] srcStruct - Full SRC base structure
683 */
684 void
685 createProgressSRC(const uint64_t& priSRC,
686 const std::vector<uint8_t>& srcStruct) const override;
687
Sumit Kumar027bf282022-01-24 11:25:19 -0600688 /**
689 * @brief Get the list of unresolved OpenBMC event log ids that have an
690 * associated hardware isolation entry.
691 *
692 * @return std::vector<uint32_t> - The list of log ids
693 */
694 std::vector<uint32_t> getLogIDWithHwIsolation() const override;
695
Matt Spinler2a28c932020-02-03 14:23:40 -0600696 private:
697 /**
698 * @brief Reads the BMC firmware version string and puts it into
699 * _bmcFWVersion.
700 */
701 void readBMCFWVersion();
Matt Spinlera7d9d962019-11-06 15:01:25 -0600702
703 /**
Matt Spinler2a28c932020-02-03 14:23:40 -0600704 * @brief Reads the server firmware version string and puts it into
705 * _serverFWVersion.
Matt Spinlerc8705e22019-09-11 12:36:07 -0500706 */
Matt Spinler2a28c932020-02-03 14:23:40 -0600707 void readServerFWVersion();
Matt Spinlerc8705e22019-09-11 12:36:07 -0500708
709 /**
Matt Spinler2a28c932020-02-03 14:23:40 -0600710 * @brief Reads the BMC firmware version ID and puts it into
711 * _bmcFWVersionID.
Matt Spinlera7d9d962019-11-06 15:01:25 -0600712 */
Matt Spinler2a28c932020-02-03 14:23:40 -0600713 void readBMCFWVersionID();
Matt Spinlera7d9d962019-11-06 15:01:25 -0600714
715 /**
Matt Spinlerb3d488f2020-02-21 15:30:46 -0600716 * @brief Finds all D-Bus paths that contain any of the interfaces
717 * passed in, by using GetSubTreePaths.
718 *
719 * @param[in] interfaces - The desired interfaces
720 *
721 * @return The D-Bus paths.
722 */
723 DBusPathList getPaths(const DBusInterfaceList& interfaces) const;
724
725 /**
726 * @brief The interfacesAdded callback used on the inventory to
727 * find the D-Bus object that has the motherboard interface.
728 * When the motherboard is found, it then adds a PropertyWatcher
729 * for the motherboard CCIN.
730 */
731 void motherboardIfaceAdded(sdbusplus::message::message& msg);
732
733 /**
Matt Spinler0e4d72e2020-08-05 12:36:53 -0500734 * @brief Adds the Ufcs- prefix to the location code passed in
735 * if necessary.
Matt Spinler5fb24c12020-06-04 11:21:33 -0500736 *
Matt Spinler0e4d72e2020-08-05 12:36:53 -0500737 * Needed because the location codes that come back from the
Matt Spinler5fb24c12020-06-04 11:21:33 -0500738 * message registry and device callout JSON don't have it.
739 *
740 * @param[in] - The location code without a prefix, like P1-C1
741 *
742 * @return std::string - The location code with the prefix
743 */
744 static std::string addLocationCodePrefix(const std::string& locationCode);
745
746 /**
Matt Spinler2a28c932020-02-03 14:23:40 -0600747 * @brief The D-Bus property or interface watchers that have callbacks
748 * registered that will set members in this class when
749 * they change.
Matt Spinlerc8705e22019-09-11 12:36:07 -0500750 */
Matt Spinler2a28c932020-02-03 14:23:40 -0600751 std::vector<std::unique_ptr<DBusWatcher>> _properties;
Matt Spinlera7d9d962019-11-06 15:01:25 -0600752
753 /**
Matt Spinlerc8705e22019-09-11 12:36:07 -0500754 * @brief The sdbusplus bus object for making D-Bus calls.
755 */
756 sdbusplus::bus::bus& _bus;
Matt Spinlerb3d488f2020-02-21 15:30:46 -0600757
758 /**
759 * @brief The interfacesAdded match object used to wait for inventory
760 * interfaces to show up, so that the object with the motherboard
761 * interface can be found. After it is found, this object is
762 * deleted.
763 */
764 std::unique_ptr<sdbusplus::bus::match_t> _inventoryIfacesAddedMatch;
Matt Spinlerc8705e22019-09-11 12:36:07 -0500765};
766
767} // namespace pels
768} // namespace openpower