libpldm: Add decode API for RequestFirmwareData request

In order for the FD to retrieve a section of a component image, the
FD sends RequestFirmwareData request message to the UA, specifying
its offset and length. The UA will send a response message that
includes the component image portion specified by the offset and
length from the request message. 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: Ifa4ef11dab4cef90bbe11d7c906e9414f637a8d1
diff --git a/libpldm/firmware_update.h b/libpldm/firmware_update.h
index e213ea0..ccb2b28 100644
--- a/libpldm/firmware_update.h
+++ b/libpldm/firmware_update.h
@@ -366,6 +366,15 @@
 	uint16_t time_before_req_fw_data;

 } __attribute__((packed));

 

+/** @struct pldm_request_firmware_data_req

+ *

+ *  Structure representing RequestFirmwareData request.

+ */

+struct pldm_request_firmware_data_req {

+	uint32_t offset;

+	uint32_t length;

+} __attribute__((packed));

+

 /** @brief Decode the PLDM package header information

  *

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

@@ -682,6 +691,20 @@
 				 uint8_t *comp_compatability_resp_code,

 				 bitfield32_t *update_option_flags_enabled,

 				 uint16_t *time_before_req_fw_data);

+

+/** @brief Decode RequestFirmwareData request message

+ *

+ *	@param[in] msg - Request message

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

+ *	@param[out] offset - Pointer to hold offset

+ *	@param[out] length - Pointer to hold the size of the component image

+ *                       segment requested by the FD/FDP

+ *

+ *	@return pldm_completion_codes

+ */

+int decode_request_firmware_data_req(const struct pldm_msg *msg,

+				     size_t payload_length, uint32_t *offset,

+				     uint32_t *length);

 #ifdef __cplusplus

 }

 #endif