libpldm: Add decode API for CancelUpdate response

Update agent sends 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: I302418f85dd0b870c4d3ace7e04fcc4b873f54a7
diff --git a/libpldm/firmware_update.h b/libpldm/firmware_update.h
index 697a479..ed403bb 100644
--- a/libpldm/firmware_update.h
+++ b/libpldm/firmware_update.h
@@ -311,6 +311,13 @@
 	PLDM_FD_STATUS_VENDOR_DEFINED_MAX = 255

 };

 

+/** @brief Components functional indicator in CancelUpdate response

+ */

+enum pldm_firmware_update_non_functioning_component_indication {

+	PLDM_FWUP_COMPONENTS_FUNCTIONING = 0,

+	PLDM_FWUP_COMPONENTS_NOT_FUNCTIONING = 1

+};

+

 /** @struct pldm_package_header_information

  *

  *  Structure representing fixed part of package header information

@@ -543,6 +550,16 @@
 	bitfield32_t update_option_flags_enabled;

 } __attribute__((packed));

 

+/** @struct pldm_cancel_update_resp

+ *

+ *  Structure representing CancelUpdate response.

+ */

+struct pldm_cancel_update_resp {

+	uint8_t completion_code;

+	bool8_t non_functioning_component_indication;

+	uint64_t non_functioning_component_bitmap;

+} __attribute__((packed));

+

 /** @brief Decode the PLDM package header information

  *

  *  @param[in] data - pointer to package header information

@@ -1089,6 +1106,25 @@
 int encode_cancel_update_req(uint8_t instance_id, struct pldm_msg *msg,

 			     size_t payload_length);

 

+/** @brief Decode CancelUpdate response message

+ *

+ *	@param[in] msg - Response message

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

+ *	@param[out] completion_code - Pointer to completion code

+ *	@param[out] non_functioning_component_indication - Pointer to non

+						       functioning

+ *                                                     component indication

+ *	@param[out] non_functioning_component_bitmap - Pointer to non

+ functioning

+ *                                                 component bitmap

+ *

+ *	@return pldm_completion_codes

+ */

+int decode_cancel_update_resp(const struct pldm_msg *msg, size_t payload_length,

+			      uint8_t *completion_code,

+			      bool8_t *non_functioning_component_indication,

+			      bitfield64_t *non_functioning_component_bitmap);

+

 #ifdef __cplusplus

 }

 #endif