libpldm: Add decode API for CancelUpdateComponent response
Update agent send this command to FD/FDP during firmware component
transfer process.The FD/FDP, upon receiving this command shall stop
sending RequestFirmwareData commands to the UA, and cancel the
current component update procedure. The FD/FDP controller shall
transition to the READY XFER state of update mode and be ready to
accept another UpdateComponent command. This implementation works
with DSP0267_1.1.0, DSP0267_1.0.1 and DSP0267_1.0.0.
Tested: Unit tests passed
Signed-off-by: gokulsanker <gokul.sanker.v.g@intel.com>
Change-Id: I1625489bd78729367439e3c495c91c9699341007
diff --git a/libpldm/firmware_update.c b/libpldm/firmware_update.c
index 0df6aaf..6714136 100644
--- a/libpldm/firmware_update.c
+++ b/libpldm/firmware_update.c
@@ -1467,3 +1467,19 @@
return PLDM_SUCCESS;
}
+
+int decode_cancel_update_component_resp(const struct pldm_msg *msg,
+ size_t payload_length,
+ uint8_t *completion_code)
+{
+ if (msg == NULL || completion_code == NULL) {
+ return PLDM_ERROR_INVALID_DATA;
+ }
+
+ if (payload_length != sizeof(*completion_code)) {
+ return PLDM_ERROR_INVALID_LENGTH;
+ }
+
+ *completion_code = msg->payload[0];
+ return PLDM_SUCCESS;
+}