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.hpp b/libpldmresponder/platform.hpp
index a5dcc44..605c8ab 100644
--- a/libpldmresponder/platform.hpp
+++ b/libpldmresponder/platform.hpp
@@ -7,6 +7,7 @@
#include "host-bmc/host_pdr_handler.hpp"
#include "libpldmresponder/pdr.hpp"
#include "libpldmresponder/pdr_utils.hpp"
+#include "libpldmresponder/platform_config.hpp"
#include "oem_handler.hpp"
#include "pldmd/handler.hpp"
@@ -49,11 +50,12 @@
{
public:
Handler(const pldm::utils::DBusHandler* dBusIntf, uint8_t eid,
- pldm::InstanceIdDb* instanceIdDb, const std::string& pdrJsonsDir,
+ pldm::InstanceIdDb* instanceIdDb, const fs::path& pdrJsonDir,
pldm_pdr* repo, HostPDRHandler* hostPDRHandler,
pldm::state_sensor::DbusToPLDMEvent* dbusToPLDMEventHandler,
fru::Handler* fruHandler,
pldm::responder::oem_platform::Handler* oemPlatformHandler,
+ pldm::responder::platform_config::Handler* platformConfigHandler,
pldm::requester::Handler<pldm::requester::Request>* handler,
sdeventplus::Event& event, bool buildPDRLazily = false,
const std::optional<EventMap>& addOnHandlersMap = std::nullopt) :
@@ -62,8 +64,9 @@
hostPDRHandler(hostPDRHandler),
dbusToPLDMEventHandler(dbusToPLDMEventHandler), fruHandler(fruHandler),
dBusIntf(dBusIntf), oemPlatformHandler(oemPlatformHandler),
- handler(handler), event(event), pdrJsonsDir(pdrJsonsDir),
- pdrCreated(false)
+ platformConfigHandler(platformConfigHandler), handler(handler),
+ event(event), pdrJsonDir(pdrJsonDir), pdrCreated(false),
+ pdrJsonsDir({pdrJsonDir})
{
if (!buildPDRLazily)
{
@@ -192,7 +195,7 @@
* @param[in] repo - instance of concrete implementation of Repo
*/
void generate(const pldm::utils::DBusHandler& dBusIntf,
- const std::string& dir,
+ const std::vector<fs::path>& dir,
pldm::responder::pdr_utils::Repo& repo);
/** @brief Parse PDR JSONs and build state effecter PDR repository
@@ -483,10 +486,12 @@
fru::Handler* fruHandler;
const pldm::utils::DBusHandler* dBusIntf;
pldm::responder::oem_platform::Handler* oemPlatformHandler;
+ pldm::responder::platform_config::Handler* platformConfigHandler;
pldm::requester::Handler<pldm::requester::Request>* handler;
sdeventplus::Event& event;
- std::string pdrJsonsDir;
+ fs::path pdrJsonDir;
bool pdrCreated;
+ std::vector<fs::path> pdrJsonsDir;
std::unique_ptr<sdeventplus::source::Defer> deferredGetPDREvent;
};