libpldm: Add encode API for CancelUpdate request

Update agent send this command to FD/FDP to exit from update mode
even if activation is required to begin operating at the new firmware
level. FD/FDP will transition to IDLE state on CancelUpdate. 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: Iab9c2f078c216c20c2432ac5ec0438fdae8da27d
diff --git a/libpldm/firmware_update.h b/libpldm/firmware_update.h
index 29bcc86..697a479 100644
--- a/libpldm/firmware_update.h
+++ b/libpldm/firmware_update.h
@@ -22,6 +22,7 @@
 /* Maximum progress percentage value*/

 #define PLDM_FWUP_MAX_PROGRESS_PERCENT 0x65

 #define PLDM_CANCEL_UPDATE_COMPONENT_REQ_BYTES 0

+#define PLDM_CANCEL_UPDATE_REQ_BYTES 0

 

 /** @brief PLDM Firmware update commands

  */

@@ -37,7 +38,8 @@
 	PLDM_APPLY_COMPLETE = 0x18,

 	PLDM_ACTIVATE_FIRMWARE = 0x1A,

 	PLDM_GET_STATUS = 0x1B,

-	PLDM_CANCEL_UPDATE_COMPONENT = 0x1C

+	PLDM_CANCEL_UPDATE_COMPONENT = 0x1C,

+	PLDM_CANCEL_UPDATE = 0x1D

 };

 

 /** @brief PLDM Firmware update completion codes

@@ -1073,6 +1075,20 @@
 					size_t payload_length,

 					uint8_t *completion_code);

 

+/** @brief Create PLDM request message for CancelUpdate

+ *

+ *	@param[in] instance_id - Message's instance id

+ *	@param[in,out] msg - Message will be written to this

+ *  @param[in] payload_length - Length of request message payload

+ *

+ *	@return pldm_completion_codes

+ *

+ *	@note  Caller is responsible for memory alloc and dealloc of param

+ *         'msg.payload'

+ */

+int encode_cancel_update_req(uint8_t instance_id, struct pldm_msg *msg,

+			     size_t payload_length);

+

 #ifdef __cplusplus

 }

 #endif