gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 1 | #ifndef FW_UPDATE_H
|
| 2 | #define FW_UPDATE_H
|
| 3 |
|
| 4 | #ifdef __cplusplus
|
| 5 | extern "C" {
|
| 6 | #endif
|
| 7 | #include "base.h"
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 8 | #include "utils.h"
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 9 |
|
Tom Joseph | 568e470 | 2021-06-07 22:15:49 -0700 | [diff] [blame] | 10 | #define PLDM_FWUP_COMPONENT_BITMAP_MULTIPLE 8
|
Tom Joseph | 58cc172 | 2021-06-09 07:15:49 -0700 | [diff] [blame] | 11 | #define PLDM_FWUP_INVALID_COMPONENT_COMPARISON_TIMESTAMP 0xFFFFFFFF
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 12 | #define PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES 0
|
gokulsanker | eca3e19 | 2021-04-05 14:57:41 +0530 | [diff] [blame] | 13 | /** @brief Minimum length of device descriptor, 2 bytes for descriptor type,
|
| 14 | * 2 bytes for descriptor length and atleast 1 byte of descriptor data
|
| 15 | */
|
| 16 | #define PLDM_FWUP_DEVICE_DESCRIPTOR_MIN_LEN 5
|
gokulsanker | 981fbfb | 2021-04-05 15:17:25 +0530 | [diff] [blame] | 17 | #define PLDM_GET_FIRMWARE_PARAMETERS_REQ_BYTES 0
|
gokulsanker | d434edc | 2021-04-05 16:36:04 +0530 | [diff] [blame] | 18 | #define PLDM_FWUP_BASELINE_TRANSFER_SIZE 32
|
| 19 | #define PLDM_FWUP_MIN_OUTSTANDING_REQ 1
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 20 |
|
| 21 | /** @brief PLDM Firmware update commands
|
| 22 | */
|
gokulsanker | 981fbfb | 2021-04-05 15:17:25 +0530 | [diff] [blame] | 23 | enum pldm_firmware_update_commands {
|
| 24 | PLDM_QUERY_DEVICE_IDENTIFIERS = 0x01,
|
gokulsanker | d434edc | 2021-04-05 16:36:04 +0530 | [diff] [blame] | 25 | PLDM_GET_FIRMWARE_PARAMETERS = 0x02,
|
| 26 | PLDM_REQUEST_UPDATE = 0x10
|
gokulsanker | 981fbfb | 2021-04-05 15:17:25 +0530 | [diff] [blame] | 27 | };
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 28 |
|
gokulsanker | 611238c | 2021-04-05 16:50:44 +0530 | [diff] [blame] | 29 | /** @brief PLDM Firmware update completion codes
|
| 30 | */
|
| 31 | enum pldm_firmware_update_completion_codes {
|
| 32 | PLDM_FWUP_NOT_IN_UPDATE_MODE = 0x80,
|
| 33 | PLDM_FWUP_ALREADY_IN_UPDATE_MODE = 0x81,
|
| 34 | PLDM_FWUP_DATA_OUT_OF_RANGE = 0x82,
|
| 35 | PLDM_FWUP_INVALID_TRANSFER_LENGTH = 0x83,
|
| 36 | PLDM_FWUP_INVALID_STATE_FOR_COMMAND = 0x84,
|
| 37 | PLDM_FWUP_INCOMPLETE_UPDATE = 0x85,
|
| 38 | PLDM_FWUP_BUSY_IN_BACKGROUND = 0x86,
|
| 39 | PLDM_FWUP_CANCEL_PENDING = 0x87,
|
| 40 | PLDM_FWUP_COMMAND_NOT_EXPECTED = 0x87,
|
| 41 | PLDM_FWUP_RETRY_REQUEST_FW_DATA = 0x89,
|
| 42 | PLDM_FWUP_UNABLE_TO_INITIATE_UPDATE = 0x8A,
|
| 43 | PLDM_FWUP_ACTIVATION_NOT_REQUIRED = 0x8B,
|
| 44 | PLDM_FWUP_SELF_CONTAINED_ACTIVATION_NOT_PERMITTED = 0x8C,
|
| 45 | PLDM_FWUP_NO_DEVICE_METADATA = 0x8D,
|
| 46 | PLDM_FWUP_RETRY_REQUEST_UPDATE = 0x8E,
|
| 47 | PLDM_FWUP_NO_PACKAGE_DATA = 0x8F,
|
| 48 | PLDM_FWUP_INVALID_TRANSFER_HANDLE = 0x90,
|
| 49 | PLDM_FWUP_INVALID_TRANSFER_OPERATION_FLAG = 0x91,
|
| 50 | PLDM_FWUP_ACTIVATE_PENDING_IMAGE_NOT_PERMITTED = 0x92,
|
| 51 | PLDM_FWUP_PACKAGE_DATA_ERROR = 0x93
|
| 52 | };
|
| 53 |
|
Tom Joseph | 763b51e | 2021-06-05 04:50:47 -0700 | [diff] [blame] | 54 | /** @brief String type values defined in the PLDM firmware update specification
|
| 55 | */
|
| 56 | enum pldm_firmware_update_string_type {
|
| 57 | PLDM_STR_TYPE_UNKNOWN = 0,
|
| 58 | PLDM_STR_TYPE_ASCII = 1,
|
| 59 | PLDM_STR_TYPE_UTF_8 = 2,
|
| 60 | PLDM_STR_TYPE_UTF_16 = 3,
|
| 61 | PLDM_STR_TYPE_UTF_16LE = 4,
|
| 62 | PLDM_STR_TYPE_UTF_16BE = 5
|
| 63 | };
|
| 64 |
|
| 65 | /** @brief Descriptor types defined in PLDM firmware update specification
|
| 66 | */
|
| 67 | enum pldm_firmware_update_descriptor_types {
|
| 68 | PLDM_FWUP_PCI_VENDOR_ID = 0x0000,
|
| 69 | PLDM_FWUP_IANA_ENTERPRISE_ID = 0x0001,
|
| 70 | PLDM_FWUP_UUID = 0x0002,
|
| 71 | PLDM_FWUP_PNP_VENDOR_ID = 0x0003,
|
| 72 | PLDM_FWUP_ACPI_VENDOR_ID = 0x0004,
|
| 73 | PLDM_FWUP_IEEE_ASSIGNED_COMPANY_ID = 0x0005,
|
| 74 | PLDM_FWUP_SCSI_VENDOR_ID = 0x0006,
|
| 75 | PLDM_FWUP_PCI_DEVICE_ID = 0x0100,
|
| 76 | PLDM_FWUP_PCI_SUBSYSTEM_VENDOR_ID = 0x0101,
|
| 77 | PLDM_FWUP_PCI_SUBSYSTEM_ID = 0x0102,
|
| 78 | PLDM_FWUP_PCI_REVISION_ID = 0x0103,
|
| 79 | PLDM_FWUP_PNP_PRODUCT_IDENTIFIER = 0x0104,
|
| 80 | PLDM_FWUP_ACPI_PRODUCT_IDENTIFIER = 0x0105,
|
| 81 | PLDM_FWUP_ASCII_MODEL_NUMBER_LONG_STRING = 0x0106,
|
| 82 | PLDM_FWUP_ASCII_MODEL_NUMBER_SHORT_STRING = 0x0107,
|
| 83 | PLDM_FWUP_SCSI_PRODUCT_ID = 0x0108,
|
| 84 | PLDM_FWUP_UBM_CONTROLLER_DEVICE_CODE = 0x0109,
|
| 85 | PLDM_FWUP_VENDOR_DEFINED = 0xFFFF
|
| 86 | };
|
| 87 |
|
| 88 | /** @brief Descriptor types length defined in PLDM firmware update specification
|
| 89 | */
|
| 90 | enum pldm_firmware_update_descriptor_types_length {
|
| 91 | PLDM_FWUP_PCI_VENDOR_ID_LENGTH = 2,
|
| 92 | PLDM_FWUP_IANA_ENTERPRISE_ID_LENGTH = 4,
|
| 93 | PLDM_FWUP_UUID_LENGTH = 16,
|
| 94 | PLDM_FWUP_PNP_VENDOR_ID_LENGTH = 3,
|
| 95 | PLDM_FWUP_ACPI_VENDOR_ID_LENGTH = 4,
|
| 96 | PLDM_FWUP_IEEE_ASSIGNED_COMPANY_ID_LENGTH = 3,
|
| 97 | PLDM_FWUP_SCSI_VENDOR_ID_LENGTH = 8,
|
| 98 | PLDM_FWUP_PCI_DEVICE_ID_LENGTH = 2,
|
| 99 | PLDM_FWUP_PCI_SUBSYSTEM_VENDOR_ID_LENGTH = 2,
|
| 100 | PLDM_FWUP_PCI_SUBSYSTEM_ID_LENGTH = 2,
|
| 101 | PLDM_FWUP_PCI_REVISION_ID_LENGTH = 1,
|
| 102 | PLDM_FWUP_PNP_PRODUCT_IDENTIFIER_LENGTH = 4,
|
| 103 | PLDM_FWUP_ACPI_PRODUCT_IDENTIFIER_LENGTH = 4,
|
| 104 | PLDM_FWUP_ASCII_MODEL_NUMBER_LONG_STRING_LENGTH = 40,
|
| 105 | PLDM_FWUP_ASCII_MODEL_NUMBER_SHORT_STRING_LENGTH = 10,
|
| 106 | PLDM_FWUP_SCSI_PRODUCT_ID_LENGTH = 16,
|
| 107 | PLDM_FWUP_UBM_CONTROLLER_DEVICE_CODE_LENGTH = 4
|
| 108 | };
|
| 109 |
|
Tom Joseph | 568e470 | 2021-06-07 22:15:49 -0700 | [diff] [blame] | 110 | /** @struct pldm_package_header_information
|
| 111 | *
|
| 112 | * Structure representing fixed part of package header information
|
| 113 | */
|
| 114 | struct pldm_package_header_information {
|
| 115 | uint8_t uuid[PLDM_FWUP_UUID_LENGTH];
|
| 116 | uint8_t package_header_format_version;
|
| 117 | uint16_t package_header_size;
|
| 118 | uint8_t timestamp104[PLDM_TIMESTAMP104_SIZE];
|
| 119 | uint16_t component_bitmap_bit_length;
|
| 120 | uint8_t package_version_string_type;
|
| 121 | uint8_t package_version_string_length;
|
| 122 | } __attribute__((packed));
|
| 123 |
|
Tom Joseph | 64af345 | 2021-06-08 04:05:28 -0700 | [diff] [blame] | 124 | /** @struct pldm_firmware_device_id_record
|
| 125 | *
|
| 126 | * Structure representing firmware device ID record
|
| 127 | */
|
| 128 | struct pldm_firmware_device_id_record {
|
| 129 | uint16_t record_length;
|
| 130 | uint8_t descriptor_count;
|
| 131 | bitfield32_t device_update_option_flags;
|
| 132 | uint8_t comp_image_set_version_string_type;
|
| 133 | uint8_t comp_image_set_version_string_length;
|
| 134 | uint16_t fw_device_pkg_data_length;
|
| 135 | } __attribute__((packed));
|
| 136 |
|
Tom Joseph | 763b51e | 2021-06-05 04:50:47 -0700 | [diff] [blame] | 137 | /** @struct pldm_descriptor_tlv
|
| 138 | *
|
| 139 | * Structure representing descriptor type, length and value
|
| 140 | */
|
| 141 | struct pldm_descriptor_tlv {
|
| 142 | uint16_t descriptor_type;
|
| 143 | uint16_t descriptor_length;
|
| 144 | uint8_t descriptor_data[1];
|
| 145 | } __attribute__((packed));
|
| 146 |
|
| 147 | /** @struct pldm_vendor_defined_descriptor_title_data
|
| 148 | *
|
| 149 | * Structure representing vendor defined descriptor title sections
|
| 150 | */
|
| 151 | struct pldm_vendor_defined_descriptor_title_data {
|
| 152 | uint8_t vendor_defined_descriptor_title_str_type;
|
| 153 | uint8_t vendor_defined_descriptor_title_str_len;
|
| 154 | uint8_t vendor_defined_descriptor_title_str[1];
|
| 155 | } __attribute__((packed));
|
| 156 |
|
Tom Joseph | 58cc172 | 2021-06-09 07:15:49 -0700 | [diff] [blame] | 157 | /** @struct pldm_component_image_information
|
| 158 | *
|
| 159 | * Structure representing fixed part of individual component information in
|
| 160 | * PLDM firmware update package
|
| 161 | */
|
| 162 | struct pldm_component_image_information {
|
| 163 | uint16_t comp_classification;
|
| 164 | uint16_t comp_identifier;
|
| 165 | uint32_t comp_comparison_stamp;
|
| 166 | bitfield16_t comp_options;
|
| 167 | bitfield16_t requested_comp_activation_method;
|
| 168 | uint32_t comp_location_offset;
|
| 169 | uint32_t comp_size;
|
| 170 | uint8_t comp_version_string_type;
|
| 171 | uint8_t comp_version_string_length;
|
| 172 | } __attribute__((packed));
|
| 173 |
|
gokulsanker | eca3e19 | 2021-04-05 14:57:41 +0530 | [diff] [blame] | 174 | /** @struct pldm_query_device_identifiers_resp
|
| 175 | *
|
| 176 | * Structure representing query device identifiers response.
|
| 177 | */
|
| 178 | struct pldm_query_device_identifiers_resp {
|
| 179 | uint8_t completion_code;
|
| 180 | uint32_t device_identifiers_len;
|
| 181 | uint8_t descriptor_count;
|
| 182 | } __attribute__((packed));
|
| 183 |
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 184 | /** @struct pldm_get_firmware_parameters_resp
|
| 185 | *
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 186 | * Structure representing the fixed part of GetFirmwareParameters response
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 187 | */
|
| 188 | struct pldm_get_firmware_parameters_resp {
|
| 189 | uint8_t completion_code;
|
| 190 | bitfield32_t capabilities_during_update;
|
| 191 | uint16_t comp_count;
|
| 192 | uint8_t active_comp_image_set_ver_str_type;
|
| 193 | uint8_t active_comp_image_set_ver_str_len;
|
| 194 | uint8_t pending_comp_image_set_ver_str_type;
|
| 195 | uint8_t pending_comp_image_set_ver_str_len;
|
| 196 | } __attribute__((packed));
|
| 197 |
|
gokulsanker | e1fb7a8 | 2021-04-05 16:09:29 +0530 | [diff] [blame] | 198 | /** @struct pldm_component_parameter_entry
|
| 199 | *
|
| 200 | * Structure representing component parameter table entry.
|
| 201 | */
|
| 202 | struct pldm_component_parameter_entry {
|
| 203 | uint16_t comp_classification;
|
| 204 | uint16_t comp_identifier;
|
| 205 | uint8_t comp_classification_index;
|
| 206 | uint32_t active_comp_comparison_stamp;
|
| 207 | uint8_t active_comp_ver_str_type;
|
| 208 | uint8_t active_comp_ver_str_len;
|
| 209 | uint8_t active_comp_release_date[8];
|
| 210 | uint32_t pending_comp_comparison_stamp;
|
| 211 | uint8_t pending_comp_ver_str_type;
|
| 212 | uint8_t pending_comp_ver_str_len;
|
| 213 | uint8_t pending_comp_release_date[8];
|
| 214 | bitfield16_t comp_activation_methods;
|
| 215 | bitfield32_t capabilities_during_update;
|
| 216 | } __attribute__((packed));
|
| 217 |
|
gokulsanker | d434edc | 2021-04-05 16:36:04 +0530 | [diff] [blame] | 218 | /** @struct pldm_request_update_req
|
| 219 | *
|
| 220 | * Structure representing fixed part of Request Update request
|
| 221 | */
|
| 222 | struct pldm_request_update_req {
|
| 223 | uint32_t max_transfer_size;
|
| 224 | uint16_t num_of_comp;
|
| 225 | uint8_t max_outstanding_transfer_req;
|
| 226 | uint16_t pkg_data_len;
|
| 227 | uint8_t comp_image_set_ver_str_type;
|
| 228 | uint8_t comp_image_set_ver_str_len;
|
| 229 | } __attribute__((packed));
|
| 230 |
|
gokulsanker | 611238c | 2021-04-05 16:50:44 +0530 | [diff] [blame] | 231 | /** @struct pldm_request_update_resp
|
| 232 | *
|
| 233 | * Structure representing Request Update response
|
| 234 | */
|
| 235 | struct pldm_request_update_resp {
|
| 236 | uint8_t completion_code;
|
| 237 | uint16_t fd_meta_data_len;
|
| 238 | uint8_t fd_will_send_pkg_data;
|
| 239 | } __attribute__((packed));
|
| 240 |
|
Tom Joseph | 568e470 | 2021-06-07 22:15:49 -0700 | [diff] [blame] | 241 | /** @brief Decode the PLDM package header information
|
| 242 | *
|
| 243 | * @param[in] data - pointer to package header information
|
| 244 | * @param[in] length - available length in the firmware update package
|
| 245 | * @param[out] package_header_info - pointer to fixed part of PLDM package
|
| 246 | * header information
|
| 247 | * @param[out] package_version_str - pointer to package version string
|
| 248 | *
|
| 249 | * @return pldm_completion_codes
|
| 250 | */
|
| 251 | int decode_pldm_package_header_info(
|
| 252 | const uint8_t *data, size_t length,
|
| 253 | struct pldm_package_header_information *package_header_info,
|
| 254 | struct variable_field *package_version_str);
|
| 255 |
|
Tom Joseph | 64af345 | 2021-06-08 04:05:28 -0700 | [diff] [blame] | 256 | /** @brief Decode individual firmware device ID record
|
| 257 | *
|
| 258 | * @param[in] data - pointer to firmware device ID record
|
| 259 | * @param[in] length - available length in the firmware update package
|
| 260 | * @param[in] component_bitmap_bit_length - ComponentBitmapBitLengthfield
|
| 261 | * parsed from the package header info
|
| 262 | * @param[out] fw_device_id_record - pointer to fixed part of firmware device
|
| 263 | * id record
|
| 264 | * @param[out] applicable_components - pointer to ApplicableComponents
|
| 265 | * @param[out] comp_image_set_version_str - pointer to
|
| 266 | * ComponentImageSetVersionString
|
| 267 | * @param[out] record_descriptors - pointer to RecordDescriptors
|
| 268 | * @param[out] fw_device_pkg_data - pointer to FirmwareDevicePackageData
|
| 269 | *
|
| 270 | * @return pldm_completion_codes
|
| 271 | */
|
| 272 | int decode_firmware_device_id_record(
|
| 273 | const uint8_t *data, size_t length, uint16_t component_bitmap_bit_length,
|
| 274 | struct pldm_firmware_device_id_record *fw_device_id_record,
|
| 275 | struct variable_field *applicable_components,
|
| 276 | struct variable_field *comp_image_set_version_str,
|
| 277 | struct variable_field *record_descriptors,
|
| 278 | struct variable_field *fw_device_pkg_data);
|
| 279 |
|
Tom Joseph | 763b51e | 2021-06-05 04:50:47 -0700 | [diff] [blame] | 280 | /** @brief Decode the record descriptor entries in the firmware update package
|
| 281 | * and the Descriptors in the QueryDeviceIDentifiers command
|
| 282 | *
|
| 283 | * @param[in] data - pointer to descriptor entry
|
| 284 | * @param[in] length - remaining length of the descriptor data
|
| 285 | * @param[out] descriptor_type - pointer to descriptor type
|
| 286 | * @param[out] descriptor_data - pointer to descriptor data
|
| 287 | *
|
| 288 | * @return pldm_completion_codes
|
| 289 | */
|
| 290 | int decode_descriptor_type_length_value(const uint8_t *data, size_t length,
|
| 291 | uint16_t *descriptor_type,
|
| 292 | struct variable_field *descriptor_data);
|
| 293 |
|
| 294 | /** @brief Decode the vendor defined descriptor value
|
| 295 | *
|
| 296 | * @param[in] data - pointer to vendor defined descriptor value
|
| 297 | * @param[in] length - length of the vendor defined descriptor value
|
| 298 | * @param[out] descriptor_title_str_type - pointer to vendor defined descriptor
|
| 299 | * title string type
|
| 300 | * @param[out] descriptor_title_str - pointer to vendor defined descriptor
|
| 301 | * title string
|
| 302 | * @param[out] descriptor_data - pointer to vendor defined descriptor data
|
| 303 | *
|
| 304 | * @return pldm_completion_codes
|
| 305 | */
|
| 306 | int decode_vendor_defined_descriptor_value(
|
| 307 | const uint8_t *data, size_t length, uint8_t *descriptor_title_str_type,
|
| 308 | struct variable_field *descriptor_title_str,
|
| 309 | struct variable_field *descriptor_data);
|
| 310 |
|
Tom Joseph | 58cc172 | 2021-06-09 07:15:49 -0700 | [diff] [blame] | 311 | /** @brief Decode individual component image information
|
| 312 | *
|
| 313 | * @param[in] data - pointer to component image information
|
| 314 | * @param[in] length - available length in the firmware update package
|
| 315 | * @param[out] pldm_comp_image_info - pointer to fixed part of component image
|
| 316 | * information
|
| 317 | * @param[out] comp_version_str - pointer to component version string
|
| 318 | *
|
| 319 | * @return pldm_completion_codes
|
| 320 | */
|
| 321 | int decode_pldm_comp_image_info(
|
| 322 | const uint8_t *data, size_t length,
|
| 323 | struct pldm_component_image_information *pldm_comp_image_info,
|
| 324 | struct variable_field *comp_version_str);
|
| 325 |
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 326 | /** @brief Create a PLDM request message for QueryDeviceIdentifiers
|
| 327 | *
|
| 328 | * @param[in] instance_id - Message's instance id
|
| 329 | * @param[in] payload_length - Length of the request message payload
|
| 330 | * @param[in,out] msg - Message will be written to this
|
| 331 | *
|
| 332 | * @return pldm_completion_codes
|
| 333 | *
|
| 334 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 335 | * 'msg.payload'
|
| 336 | */
|
| 337 | int encode_query_device_identifiers_req(uint8_t instance_id,
|
| 338 | size_t payload_length,
|
| 339 | struct pldm_msg *msg);
|
gokulsanker | eca3e19 | 2021-04-05 14:57:41 +0530 | [diff] [blame] | 340 |
|
| 341 | /** @brief Decode QueryDeviceIdentifiers response message
|
| 342 | *
|
| 343 | * @param[in] msg - Response message
|
| 344 | * @param[in] payload_length - Length of response message payload
|
| 345 | * @param[out] completion_code - Pointer to response msg's PLDM completion code
|
| 346 | * @param[out] device_identifiers_len - Pointer to device identifiers length
|
| 347 | * @param[out] descriptor_count - Pointer to descriptor count
|
| 348 | * @param[out] descriptor_data - Pointer to descriptor data
|
| 349 | *
|
| 350 | * @return pldm_completion_codes
|
| 351 | */
|
| 352 | int decode_query_device_identifiers_resp(const struct pldm_msg *msg,
|
| 353 | size_t payload_length,
|
| 354 | uint8_t *completion_code,
|
| 355 | uint32_t *device_identifiers_len,
|
| 356 | uint8_t *descriptor_count,
|
| 357 | uint8_t **descriptor_data);
|
gokulsanker | 981fbfb | 2021-04-05 15:17:25 +0530 | [diff] [blame] | 358 |
|
| 359 | /** @brief Create a PLDM request message for GetFirmwareParameters
|
| 360 | *
|
| 361 | * @param[in] instance_id - Message's instance id
|
| 362 | * @param[in] payload_length - Length of the request message payload
|
| 363 | * @param[in,out] msg - Message will be written to this
|
| 364 | *
|
| 365 | * @return pldm_completion_codes
|
| 366 | *
|
| 367 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 368 | * 'msg.payload'
|
| 369 | */
|
| 370 | int encode_get_firmware_parameters_req(uint8_t instance_id,
|
| 371 | size_t payload_length,
|
| 372 | struct pldm_msg *msg);
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 373 |
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 374 | /** @brief Decode GetFirmwareParameters response
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 375 | *
|
| 376 | * @param[in] msg - Response message
|
| 377 | * @param[in] payload_length - Length of response message payload
|
| 378 | * @param[out] resp_data - Pointer to get firmware parameters response
|
| 379 | * @param[out] active_comp_image_set_ver_str - Pointer to active component
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 380 | * image set version string
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 381 | * @param[out] pending_comp_image_set_ver_str - Pointer to pending component
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 382 | * image set version string
|
| 383 | * @param[out] comp_parameter_table - Pointer to component parameter table
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 384 | *
|
| 385 | * @return pldm_completion_codes
|
| 386 | */
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 387 | int decode_get_firmware_parameters_resp(
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 388 | const struct pldm_msg *msg, size_t payload_length,
|
| 389 | struct pldm_get_firmware_parameters_resp *resp_data,
|
| 390 | struct variable_field *active_comp_image_set_ver_str,
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 391 | struct variable_field *pending_comp_image_set_ver_str,
|
| 392 | struct variable_field *comp_parameter_table);
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 393 |
|
gokulsanker | e1fb7a8 | 2021-04-05 16:09:29 +0530 | [diff] [blame] | 394 | /** @brief Decode component entries in the component parameter table which is
|
| 395 | * part of the response of GetFirmwareParameters command
|
| 396 | *
|
| 397 | * @param[in] data - Component entry
|
| 398 | * @param[in] length - Length of component entry
|
| 399 | * @param[out] component_data - Pointer to component parameter table
|
| 400 | * @param[out] active_comp_ver_str - Pointer to active component version string
|
| 401 | * @param[out] pending_comp_ver_str - Pointer to pending component version
|
| 402 | * string
|
| 403 | *
|
| 404 | * @return pldm_completion_codes
|
| 405 | */
|
| 406 | int decode_get_firmware_parameters_resp_comp_entry(
|
| 407 | const uint8_t *data, size_t length,
|
| 408 | struct pldm_component_parameter_entry *component_data,
|
| 409 | struct variable_field *active_comp_ver_str,
|
| 410 | struct variable_field *pending_comp_ver_str);
|
| 411 |
|
gokulsanker | d434edc | 2021-04-05 16:36:04 +0530 | [diff] [blame] | 412 | /** @brief Create PLDM request message for RequestUpdate
|
| 413 | *
|
| 414 | * @param[in] instance_id - Message's instance id
|
| 415 | * @param[in] max_transfer_size - Maximum size of the variable payload allowed
|
| 416 | * to be requested via RequestFirmwareData
|
| 417 | * command
|
| 418 | * @param[in] num_of_comp - Total number of components that will be passed to
|
| 419 | * the FD during the update
|
| 420 | * @param[in] max_outstanding_transfer_req - Total number of outstanding
|
| 421 | * RequestFirmwareData
|
| 422 | * commands that can be sent by the FD
|
| 423 | * @param[in] pkg_data_len - Value of the FirmwareDevicePackageDataLength field
|
| 424 | * present in firmware package header
|
| 425 | * @param[in] comp_image_set_ver_str_type - StringType of
|
| 426 | * ComponentImageSetVersionString
|
| 427 | * @param[in] comp_image_set_ver_str_len - The length of the
|
| 428 | * ComponentImageSetVersionString
|
| 429 | * @param[in] comp_img_set_ver_str - Component Image Set version information
|
| 430 | * @param[in,out] msg - Message will be written to this
|
| 431 | * @param[in] payload_length - Length of request message payload
|
| 432 | *
|
| 433 | * @return pldm_completion_codes
|
| 434 | *
|
| 435 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 436 | * 'msg.payload'
|
| 437 | */
|
| 438 | int encode_request_update_req(uint8_t instance_id, uint32_t max_transfer_size,
|
| 439 | uint16_t num_of_comp,
|
| 440 | uint8_t max_outstanding_transfer_req,
|
| 441 | uint16_t pkg_data_len,
|
| 442 | uint8_t comp_image_set_ver_str_type,
|
| 443 | uint8_t comp_image_set_ver_str_len,
|
| 444 | const struct variable_field *comp_img_set_ver_str,
|
| 445 | struct pldm_msg *msg, size_t payload_length);
|
gokulsanker | 611238c | 2021-04-05 16:50:44 +0530 | [diff] [blame] | 446 |
|
| 447 | /** @brief Decode a RequestUpdate response message
|
| 448 | *
|
| 449 | * @param[in] msg - Response message
|
| 450 | * @param[in] payload_length - Length of response message payload
|
| 451 | * @param[out] completion_code - Pointer to hold the completion code
|
| 452 | * @param[out] fd_meta_data_len - Pointer to hold the length of FD metadata
|
| 453 | * @param[out] fd_will_send_pkg_data - Pointer to hold information whether FD
|
| 454 | * will send GetPackageData command
|
| 455 | * @return pldm_completion_codes
|
| 456 | */
|
| 457 | int decode_request_update_resp(const struct pldm_msg *msg,
|
| 458 | size_t payload_length, uint8_t *completion_code,
|
| 459 | uint16_t *fd_meta_data_len,
|
| 460 | uint8_t *fd_will_send_pkg_data);
|
| 461 |
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 462 | #ifdef __cplusplus
|
| 463 | }
|
| 464 | #endif
|
| 465 |
|
| 466 | #endif // End of FW_UPDATE_H
|