[Skiboot] [PATCH V6 06/15] core/pldm: Find PDR record by record handle

Christophe Lombard clombard at linux.ibm.com
Tue Aug 29 19:24:00 AEST 2023


Add a wrapper for the libpldm api: pldm_pdr_find_record()

Signed-off-by: Christophe Lombard <clombard at linux.ibm.com>
---
 core/pldm/pldm-platform-requests.c | 25 +++++++++++++++++++++++++
 core/pldm/pldm.h                   |  4 ++++
 2 files changed, 29 insertions(+)

diff --git a/core/pldm/pldm-platform-requests.c b/core/pldm/pldm-platform-requests.c
index 568ed2323..eeb202807 100644
--- a/core/pldm/pldm-platform-requests.c
+++ b/core/pldm/pldm-platform-requests.c
@@ -44,6 +44,31 @@ static void pdr_init_complete(bool success)
 	pdr_ready = true;
 }
 
+/*
+ * Find PDR record by record handle.
+ */
+int pldm_platform_pdr_find_record(uint32_t record_handle,
+				  uint8_t **pdr_data,
+				  uint32_t *pdr_data_size,
+				  uint32_t *next_record_handle)
+{
+	const pldm_pdr_record *pdr_record;
+
+	if (!pdr_ready)
+		return OPAL_HARDWARE;
+
+	pdr_record = pldm_pdr_find_record(pdrs_repo,
+					  record_handle,
+					  pdr_data,
+					  pdr_data_size,
+					  next_record_handle);
+
+	if (!pdr_record)
+		return OPAL_PARAMETER;
+
+	return OPAL_SUCCESS;
+}
+
 /*
  * Search the matching record and return the effecter id.
  * PDR type = PLDM_STATE_EFFECTER_PDR
diff --git a/core/pldm/pldm.h b/core/pldm/pldm.h
index f4e1617ec..ee4d49322 100644
--- a/core/pldm/pldm.h
+++ b/core/pldm/pldm.h
@@ -78,6 +78,10 @@ int pldm_platform_reload_pdrs(void);
 int pldm_platform_init(void);
 void pldm_platform_exit(void);
 
+int pldm_platform_pdr_find_record(uint32_t record_handle,
+				  uint8_t **pdr_data,
+				  uint32_t *pdr_data_size,
+				  uint32_t *next_record_handle);
 int pldm_requester_handle_response(struct pldm_rx_data *rx);
 int pldm_requester_queue(struct pldm_tx_data *tx,
 			 void (*complete)(struct pldm_rx_data *rx, void *data),
-- 
2.41.0



More information about the Skiboot mailing list