Adding Platform specific PDR support
- Adding platform check to generate pdr based on platform type.
- Currently PDR generation is happening based on default
configuration, so this commit adds support to generate PDR's based
in the platform type.
Testing:
- Added traces and check from which path the files has been taken for
pdr generation.
- Removed power supply from default path and oem layer and identified
that power supply pdr is not generating.
Change-Id: I6bedf06be7392e02c1ad32af7a552a5a4d6d42c0
Signed-off-by: Kamalkumar Patel <kamalkumar.patel@ibm.com>
diff --git a/libpldmresponder/platform_config.hpp b/libpldmresponder/platform_config.hpp
new file mode 100644
index 0000000..5a5b2a7
--- /dev/null
+++ b/libpldmresponder/platform_config.hpp
@@ -0,0 +1,58 @@
+#pragma once
+#include "common/utils.hpp"
+#include "pldmd/handler.hpp"
+
+#include <phosphor-logging/lg2.hpp>
+
+PHOSPHOR_LOG2_USING;
+
+namespace pldm
+{
+namespace responder
+{
+
+namespace platform_config
+{
+using namespace pldm::utils;
+
+static constexpr auto compatibleInterface =
+ "xyz.openbmc_project.Inventory.Decorator.Compatible";
+static constexpr auto namesProperty = "Names";
+
+class Handler : public CmdHandler
+{
+ public:
+ Handler()
+ {
+ systemCompatibleMatchCallBack =
+ std::make_unique<sdbusplus::bus::match::match>(
+ pldm::utils::DBusHandler::getBus(),
+ sdbusplus::bus::match::rules::interfacesAdded() +
+ sdbusplus::bus::match::rules::sender(
+ "xyz.openbmc_project.EntityManager"),
+ std::bind(&Handler::systemCompatibleCallback, this,
+ std::placeholders::_1));
+ }
+
+ /** @brief Interface to get the system type information
+ *
+ * @return - the system type information
+ */
+ virtual std::optional<std::filesystem::path> getPlatformName();
+
+ /** @brief D-Bus Interface added signal match for Entity Manager */
+ void systemCompatibleCallback(sdbusplus::message_t& msg);
+
+ private:
+ /** @brief system type/model */
+ std::string systemType;
+
+ /** @brief D-Bus Interface added signal match for Entity Manager */
+ std::unique_ptr<sdbusplus::bus::match_t> systemCompatibleMatchCallBack;
+};
+
+} // namespace platform_config
+
+} // namespace responder
+
+} // namespace pldm