libpldm: Add decode API for ComponentParameterTable entry

ComponentParameterTable is present in the response of
GetFirmwareParameters command. ComponentParameterTable is a table that
contains component entries for all of the updateable components which
reside on the firmware device.

decode_get_firmware_parameters_resp_comp_entry decodes each entry in
the ComponentParameterTable.

Tested: Unit tests passed

Signed-off-by: gokulsanker <gokul.sanker.v.g@intel.com>
Change-Id: I3698b268cf42345d80d7d218919d42ffad0b011f
diff --git a/libpldm/firmware_update.h b/libpldm/firmware_update.h
index dc6d7d6..1c3e21b 100644
--- a/libpldm/firmware_update.h
+++ b/libpldm/firmware_update.h
@@ -45,6 +45,26 @@
 	uint8_t pending_comp_image_set_ver_str_len;

 } __attribute__((packed));

 

+/** @struct pldm_component_parameter_entry

+ *

+ *  Structure representing component parameter table entry.

+ */

+struct pldm_component_parameter_entry {

+	uint16_t comp_classification;

+	uint16_t comp_identifier;

+	uint8_t comp_classification_index;

+	uint32_t active_comp_comparison_stamp;

+	uint8_t active_comp_ver_str_type;

+	uint8_t active_comp_ver_str_len;

+	uint8_t active_comp_release_date[8];

+	uint32_t pending_comp_comparison_stamp;

+	uint8_t pending_comp_ver_str_type;

+	uint8_t pending_comp_ver_str_len;

+	uint8_t pending_comp_release_date[8];

+	bitfield16_t comp_activation_methods;

+	bitfield32_t capabilities_during_update;

+} __attribute__((packed));

+

 /** @brief Create a PLDM request message for QueryDeviceIdentifiers

  *

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

@@ -112,6 +132,24 @@
     struct variable_field *active_comp_image_set_ver_str,

     struct variable_field *pending_comp_image_set_ver_str);

 

+/** @brief Decode component entries in the component parameter table which is

+ *         part of the response of GetFirmwareParameters command

+ *

+ *  @param[in] data - Component entry

+ *  @param[in] length - Length of component entry

+ *  @param[out] component_data - Pointer to component parameter table

+ *  @param[out] active_comp_ver_str - Pointer to active component version string

+ *  @param[out] pending_comp_ver_str - Pointer to pending component version

+ *                                     string

+ *

+ *  @return pldm_completion_codes

+ */

+int decode_get_firmware_parameters_resp_comp_entry(

+    const uint8_t *data, size_t length,

+    struct pldm_component_parameter_entry *component_data,

+    struct variable_field *active_comp_ver_str,

+    struct variable_field *pending_comp_ver_str);

+

 #ifdef __cplusplus

 }

 #endif