fru: Add support to insert hot-plug PDRs into repository
This API helps to insert PDRs that are added or modified
during concurrent maintenance operations into the PDR repository.
The function assigns a new record handle (based on the last
BMC side PDR handle) and appends the provided PDR entry to the
repository.
Change-Id: I48989b8828837579e8eeb360d3e5d456612c9f05
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/libpldmresponder/fru.hpp b/libpldmresponder/fru.hpp
index 6586fad..781227a 100644
--- a/libpldmresponder/fru.hpp
+++ b/libpldmresponder/fru.hpp
@@ -15,6 +15,7 @@
#include <variant>
#include <vector>
+using namespace pldm::utils;
namespace pldm
{
@@ -69,7 +70,8 @@
pldm_entity_association_tree* entityTree,
pldm_entity_association_tree* bmcEntityTree) :
parser(configPath, fruMasterJsonPath), pdrRepo(pdrRepo),
- entityTree(entityTree), bmcEntityTree(bmcEntityTree)
+ entityTree(entityTree), bmcEntityTree(bmcEntityTree),
+ oemUtilsHandler(nullptr)
{}
/** @brief Total length of the FRU table in bytes, this includes the pad
@@ -150,6 +152,15 @@
return associatedEntityMap;
}
+ /* @brief Method to set the oem utils handler in FRU handler class
+ *
+ * @param[in] handler - oem utils handler
+ */
+ inline void setOemUtilsHandler(pldm::responder::oem_utils::Handler* handler)
+ {
+ oemUtilsHandler = handler;
+ }
+
/** @brief Get pldm entity by the object path
*
* @param[in] intfMaps - D-Bus interfaces and the associated property
@@ -236,6 +247,8 @@
dbus::ObjectValueTree objects;
std::map<dbus::ObjectPath, pldm_entity_node*> objToEntityNode{};
+ /** @OEM Utils handler */
+ pldm::responder::oem_utils::Handler* oemUtilsHandler;
/** @brief populateRecord builds the FRU records for an instance of FRU and
* updates the FRU table with the FRU records.
@@ -256,6 +269,16 @@
*/
void deleteFRURecord(uint16_t rsi);
+ /** @brief Add hotplug record that was modified or added to the PDR entry
+ * HotPlug is a feature where a FRU can be removed or added when
+ * the system is running, without needing it to power off.
+ *
+ * @param[in] pdrEntry - PDR record structure in PDR repository
+ *
+ * @return record handle of added or modified hotplug record
+ */
+ uint32_t addHotPlugRecord(pldm::responder::pdr_utils::PdrEntry pdrEntry);
+
/** @brief Associate sensor/effecter to FRU entity
*/
dbus::AssociatedEntityMap associatedEntityMap;
@@ -334,6 +357,15 @@
return impl.getAssociateEntityMap();
}
+ /* @brief Method to set the oem utils handler in host pdr handler class
+ *
+ * @param[in] handler - oem utils handler
+ */
+ void setOemUtilsHandler(pldm::responder::oem_utils::Handler* handler)
+ {
+ return impl.setOemUtilsHandler(handler);
+ }
+
/** @brief Handler for GetFRURecordByOption
*
* @param[in] request - Request message payload