oem_ibm: Persist the remote PDRs before merging

This commit persists the remote range PDRs in the repo
before they are merged. This change was needed as the
remote terminus would not send down to BMC the entity
Association PDRs of the remote terminus after the BMC
takes a reset after the PDR exchange as the PDRs will be
in BMC range of record handles.

TESTED: Tested by triggering a PDR exchange with the
remote terminus by doing poweron test and also reset the
BMC after the PDR exchange.

Change-Id: Iec2109073f984e5980d9b6e445ce0fa4198d4a0f
Signed-off-by: Sagar Srinivas <sagar.srinivas@ibm.com>
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
index 964534e..03369a4 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
@@ -21,6 +21,11 @@
 constexpr uint16_t ENTITY_INSTANCE_0 = 0;
 constexpr uint16_t ENTITY_INSTANCE_1 = 1;
 
+constexpr uint32_t BMC_PDR_START_RANGE = 0x00000000;
+constexpr uint32_t BMC_PDR_END_RANGE = 0x00FFFFFF;
+constexpr uint32_t HOST_PDR_START_RANGE = 0x01000000;
+constexpr uint32_t HOST_PDR_END_RANGE = 0x01FFFFFF;
+
 enum SetEventReceiverCount
 {
     SET_EVENT_RECEIVER_SENT = 0x2,
@@ -181,6 +186,23 @@
     /** @brief to check the BMC state*/
     int checkBMCState();
 
+    /** @brief Method to fetch the last BMC record from the PDR repo
+     *
+     * @param[in] repo - pointer to BMC's primary PDR repo
+     *
+     * @return the last BMC record from the repo
+     */
+    const pldm_pdr_record* fetchLastBMCRecord(const pldm_pdr* repo);
+
+    /** @brief Method to check if the record handle passed is in remote PDR
+     *         record handle range
+     *
+     *  @param[in] record_handle - record handle of the PDR
+     *
+     *  @return true if record handle passed is in host PDR record handle range
+     */
+    bool checkRecordHandleInRange(const uint32_t& record_handle);
+
     ~Handler() = default;
 
     pldm::responder::CodeUpdate* codeUpdate; //!< pointer to CodeUpdate object