chassis-psu: ChassisManager class to manage chassis PSUs
Introduced the ChassisManager class to detect chassis and manage power
supply devices associated with chassis using D-Bus interfaces. This
includes:
- Subscribing to Entity Manager interface changes
- Implementing timers to validate power supply presence and status
- Scan the system for new chassis; if a chassis is new, add it to the
chassis list.
- Adding event loop integration for continuous monitoring
- Analysis of power supply status and error logging.
Test:
- On simulation system, verified chassis and their power supplies are
added to the chassis list, with each power supply correctly linked
to its corresponding chassis.
- Verified the power supplies in each chassis based on analysis
performed at the specified time interval.
Note: There are some commented code indicates future implementation,
please ignore for now, as they will be implemented soon.
Change-Id: I80c271783e71f668ca1405f7aca80c8ec112f531
Signed-off-by: Faisal Awada <faisal@us.ibm.com>
diff --git a/phosphor-power-supply/chassis.hpp b/phosphor-power-supply/chassis.hpp
index 527b0ff..e976921 100644
--- a/phosphor-power-supply/chassis.hpp
+++ b/phosphor-power-supply/chassis.hpp
@@ -29,7 +29,7 @@
namespace phosphor::power::chassis
{
-constexpr uint32_t invalidObjectPathUniqueId = 9999;
+constexpr uint64_t invalidObjectPathUniqueId = 9999;
using PowerSystemInputsInterface = sdbusplus::xyz::openbmc_project::State::
Decorator::server::PowerSystemInputs;
using PowerSystemInputsObject =
@@ -62,8 +62,26 @@
*
* @param[in] bus - D-Bus bus object
* @param[in] chassisPath - Chassis path
+ * @param[in] event - Event loop object
*/
- Chassis(sdbusplus::bus_t& bus, const std::string& chassisPath);
+ Chassis(sdbusplus::bus_t& bus, const std::string& chassisPath,
+ const sdeventplus::Event& e);
+
+ /**
+ * @brief Retrieves the unique identifier of the chassis.
+ *
+ * @return uint64_t The unique 64 bits identifier of the chassis.
+ */
+ uint64_t getChassisId()
+ {
+ return chassisPathUniqueId;
+ }
+
+ /**
+ * @brief Analyze the status of each of the power supplies. Log errors for
+ * faults, when and where appropriate.
+ */
+ void analyze();
/**
* @brief Get the status of Power on.
@@ -125,7 +143,13 @@
/**
* @brief The Chassis path unique ID
*/
- uint32_t chassisPathUniqueId = invalidObjectPathUniqueId;
+ uint64_t chassisPathUniqueId = invalidObjectPathUniqueId;
+
+ /**
+ * @brief Declares a constant reference to an sdeventplus::Event to manage
+ * async processing.
+ */
+ const sdeventplus::Event& eventLoop;
/**
* @brief Get PSU properties from D-Bus, use that to build a power supply
@@ -181,9 +205,10 @@
/**
* @brief Get chassis path unique ID.
*
- * @return uint32_t - Chassis path unique ID.
+ * @param [in] path - Chassis path.
+ * @return uint64_t - Chassis path unique ID.
*/
- uint32_t getChassisPathUniqueId();
+ uint64_t getChassisPathUniqueId(const std::string& path);
};
} // namespace phosphor::power::chassis