[Skiboot] [PATCH] core/pldm: Fix pdr handle to add first pdr request

Abhishek Singh Tomar abhishek at linux.ibm.com
Fri Jun 14 17:20:13 AEST 2024


As per the specification:
To retrieve the first PDR record, use the
get_pdr_req function with handle 0.

On the BMC side, the first PDR is sent in
response, along with the next_record_hndl which
can be used to access consecutive PDR records.

However, it's important to note that the first
PDR may not necessarily have a handle of 1.

In the current scenario, providing a record_hndl
value of 0 to pldm_pdr_add() will always result
in the addition of a record to the repository
with a PDR handle of 1.

In current fix record handle is extracted from
pdr record data.

Signed-off-by: Abhishek Singh Tomar <abhishek at linux.ibm.com>
---
 core/pldm/pldm-platform-requests.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/core/pldm/pldm-platform-requests.c b/core/pldm/pldm-platform-requests.c
index cb0ff9443..01eb12925 100644
--- a/core/pldm/pldm-platform-requests.c
+++ b/core/pldm/pldm-platform-requests.c
@@ -993,6 +993,7 @@ static void get_pdr_req_complete(struct pldm_rx_data *rx,
 	struct pldm_pdrs *pdrs = (struct pldm_pdrs *)data;
 	uint32_t record_hndl = pdrs->record_hndl;
 	struct get_pdr_response response;
+	struct pldm_pdr_hdr *pdr_hdr;
 	size_t payload_len;
 	int rc, i;
 
@@ -1065,6 +1066,8 @@ static void get_pdr_req_complete(struct pldm_rx_data *rx,
 	if (response.transfer_flag != PLDM_START_AND_END)
 		prlog(PR_ERR, "Transfert GetPDRResp not complete, transfer_flag: %d\n",
 			      response.transfer_flag);
+	pdr_hdr = (struct pldm_pdr_hdr *)response.record_data;
+	record_hndl = pdr_hdr->record_handle;
 
 	prlog(PR_DEBUG, "%s - record_hndl: %d, next_record_hndl: %d, resp_cnt: %d\n",
 			__func__, record_hndl,
-- 
2.45.2



More information about the Skiboot mailing list