Skip to content

Commit

Permalink
obmc-mctp: handle multi-part PLDM updates
Browse files Browse the repository at this point in the history
Summary:
Apply multi-part PLDM update handling to the obmc-mctp
utility, as it is a copy/paste of the similar ncsi-util support.

Test Plan: Apply tested patch to another section of the code.

Reviewed By: lpradeepfb

Differential Revision: D49967016

fbshipit-source-id: 5591a7ebaf73d07ced04f0d8fb9871c872a9d2bc
  • Loading branch information
williamspatrick authored and facebook-github-bot committed Oct 6, 2023
1 parent 6a0417f commit 204d433
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions common/recipes-lib/obmc-mctp/files/obmc-mctp.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ int obmc_mctp_fw_update(struct obmc_mctp_binding *binding, uint8_t dst_eid,
int i = 0;
int waitTOsec = 0;
uint8_t pldmCmd = 0;
uint8_t applyCnt = 0;

pkgHdr = pldm_parse_fw_pkg(path);
if (!pkgHdr) {
Expand Down Expand Up @@ -578,16 +579,22 @@ int obmc_mctp_fw_update(struct obmc_mctp_binding *binding, uint8_t dst_eid,
(pldmCmd == CMD_APPLY_COMPLETE)) {
setPldmTimeout(pldmCmd, &waitTOsec);
mctpReq_to_pldmReq(&pldmReq, &obmc_req);
pldmCmdStatus = pldmFwUpdateCmdHandler(pkgHdr, &pldmReq, &pldmRes, 0);
pldmCmdStatus = pldmFwUpdateCmdHandler(pkgHdr, &pldmReq, &pldmRes, applyCnt);
pldmRes_to_mctpRes(&rsp, &pldmRes);

ret = mctp_smbus_send_data(mctp, dst_eid, tag,
smbus, &rsp, pldmRes.resp_size+1);
if (ret < 0) {
break;
}
if ((pldmCmd == CMD_APPLY_COMPLETE) || (pldmCmdStatus == -1))
if (pldmCmdStatus == -1)
break;
if (pldmCmd == CMD_APPLY_COMPLETE) {
applyCnt++;
if (applyCnt == pkgHdr->componentImageCnt) {
break;
}
}
} else {
printf("unknown PLDM cmd 0x%02X\n", pldmCmd);
break;
Expand Down

0 comments on commit 204d433

Please sign in to comment.