Skip to content

Commit

Permalink
core/pldm: Fix pdr handle to add first pdr request
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Reza Arbab <[email protected]>
  • Loading branch information
abhisheksinghtomar authored and rarbab committed Aug 2, 2024
1 parent 1a8b300 commit 6d1fb19
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/pldm/pldm-platform-requests.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 6d1fb19

Please sign in to comment.