pldm: Adding support to find system type
This commit adds support to find the system type by checking the JSON
directory presence when entity manager sends the system names. Once
system type is set then PLDM continues the further operations like pdr
generation, system specific bios etc...
Testing:
Tested on real hardware
Change-Id: I3b0a7725a72cd3a3c8fe0a4c6ff6b38510a2a2ea
Signed-off-by: Kamalkumar Patel <kamalkumar.patel@ibm.com>
diff --git a/libpldmresponder/platform_config.hpp b/libpldmresponder/platform_config.hpp
index b8a8b6e..578751b 100644
--- a/libpldmresponder/platform_config.hpp
+++ b/libpldmresponder/platform_config.hpp
@@ -20,7 +20,7 @@
class Handler : public CmdHandler
{
public:
- Handler()
+ Handler(const fs::path sysDirPath = {}) : sysDirPath(sysDirPath)
{
systemCompatibleMatchCallBack =
std::make_unique<sdbusplus::bus::match_t>(
@@ -46,6 +46,17 @@
void registerSystemTypeCallback(SystemTypeCallback callback);
private:
+ /** @brief Interface to get the first available directory
+ * from the received list
+ *
+ * @param[in] dirPath - Directory path to search system specific directory
+ * @param[in] dirNames - System names retrieved from remote application
+ * @return - The system type information
+ */
+ std::optional<std::string>
+ getSysSpecificJsonDir(const fs::path& dirPath,
+ const std::vector<std::string>& dirNames);
+
/** @brief system type/model */
std::string systemType;
@@ -54,6 +65,9 @@
/** @brief Registered Callback */
SystemTypeCallback sysTypeCallback;
+
+ /** @brief system specific json file directory path */
+ fs::path sysDirPath;
};
} // namespace platform_config