blob: 9533f22d0f16711214cb09d0e8ae031d8f93ec46 [file] [log] [blame]
gokulsanker138ceba2021-04-05 13:25:25 +05301#ifndef FW_UPDATE_H
2#define FW_UPDATE_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7#include "base.h"
gokulsanker22fbb342021-04-05 15:55:06 +05308#include "utils.h"
gokulsanker138ceba2021-04-05 13:25:25 +05309
Tom Joseph568e4702021-06-07 22:15:49 -070010#define PLDM_FWUP_COMPONENT_BITMAP_MULTIPLE 8
Tom Joseph58cc1722021-06-09 07:15:49 -070011#define PLDM_FWUP_INVALID_COMPONENT_COMPARISON_TIMESTAMP 0xFFFFFFFF
gokulsanker138ceba2021-04-05 13:25:25 +053012#define PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES 0
gokulsankereca3e192021-04-05 14:57:41 +053013/** @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
gokulsanker981fbfb2021-04-05 15:17:25 +053017#define PLDM_GET_FIRMWARE_PARAMETERS_REQ_BYTES 0
gokulsankerd434edc2021-04-05 16:36:04 +053018#define PLDM_FWUP_BASELINE_TRANSFER_SIZE 32
19#define PLDM_FWUP_MIN_OUTSTANDING_REQ 1
gokulsanker138ceba2021-04-05 13:25:25 +053020
21/** @brief PLDM Firmware update commands
22 */
gokulsanker981fbfb2021-04-05 15:17:25 +053023enum pldm_firmware_update_commands {
24 PLDM_QUERY_DEVICE_IDENTIFIERS = 0x01,
gokulsankerd434edc2021-04-05 16:36:04 +053025 PLDM_GET_FIRMWARE_PARAMETERS = 0x02,
gokulsanker1b909d82021-04-05 17:26:02 +053026 PLDM_REQUEST_UPDATE = 0x10,
27 PLDM_PASS_COMPONENT_TABLE = 0x13
gokulsanker981fbfb2021-04-05 15:17:25 +053028};
gokulsanker138ceba2021-04-05 13:25:25 +053029
gokulsanker611238c2021-04-05 16:50:44 +053030/** @brief PLDM Firmware update completion codes
31 */
32enum pldm_firmware_update_completion_codes {
33 PLDM_FWUP_NOT_IN_UPDATE_MODE = 0x80,
34 PLDM_FWUP_ALREADY_IN_UPDATE_MODE = 0x81,
35 PLDM_FWUP_DATA_OUT_OF_RANGE = 0x82,
36 PLDM_FWUP_INVALID_TRANSFER_LENGTH = 0x83,
37 PLDM_FWUP_INVALID_STATE_FOR_COMMAND = 0x84,
38 PLDM_FWUP_INCOMPLETE_UPDATE = 0x85,
39 PLDM_FWUP_BUSY_IN_BACKGROUND = 0x86,
40 PLDM_FWUP_CANCEL_PENDING = 0x87,
41 PLDM_FWUP_COMMAND_NOT_EXPECTED = 0x87,
42 PLDM_FWUP_RETRY_REQUEST_FW_DATA = 0x89,
43 PLDM_FWUP_UNABLE_TO_INITIATE_UPDATE = 0x8A,
44 PLDM_FWUP_ACTIVATION_NOT_REQUIRED = 0x8B,
45 PLDM_FWUP_SELF_CONTAINED_ACTIVATION_NOT_PERMITTED = 0x8C,
46 PLDM_FWUP_NO_DEVICE_METADATA = 0x8D,
47 PLDM_FWUP_RETRY_REQUEST_UPDATE = 0x8E,
48 PLDM_FWUP_NO_PACKAGE_DATA = 0x8F,
49 PLDM_FWUP_INVALID_TRANSFER_HANDLE = 0x90,
50 PLDM_FWUP_INVALID_TRANSFER_OPERATION_FLAG = 0x91,
51 PLDM_FWUP_ACTIVATE_PENDING_IMAGE_NOT_PERMITTED = 0x92,
52 PLDM_FWUP_PACKAGE_DATA_ERROR = 0x93
53};
54
Tom Joseph763b51e2021-06-05 04:50:47 -070055/** @brief String type values defined in the PLDM firmware update specification
56 */
57enum pldm_firmware_update_string_type {
58 PLDM_STR_TYPE_UNKNOWN = 0,
59 PLDM_STR_TYPE_ASCII = 1,
60 PLDM_STR_TYPE_UTF_8 = 2,
61 PLDM_STR_TYPE_UTF_16 = 3,
62 PLDM_STR_TYPE_UTF_16LE = 4,
63 PLDM_STR_TYPE_UTF_16BE = 5
64};
65
66/** @brief Descriptor types defined in PLDM firmware update specification
67 */
68enum pldm_firmware_update_descriptor_types {
69 PLDM_FWUP_PCI_VENDOR_ID = 0x0000,
70 PLDM_FWUP_IANA_ENTERPRISE_ID = 0x0001,
71 PLDM_FWUP_UUID = 0x0002,
72 PLDM_FWUP_PNP_VENDOR_ID = 0x0003,
73 PLDM_FWUP_ACPI_VENDOR_ID = 0x0004,
74 PLDM_FWUP_IEEE_ASSIGNED_COMPANY_ID = 0x0005,
75 PLDM_FWUP_SCSI_VENDOR_ID = 0x0006,
76 PLDM_FWUP_PCI_DEVICE_ID = 0x0100,
77 PLDM_FWUP_PCI_SUBSYSTEM_VENDOR_ID = 0x0101,
78 PLDM_FWUP_PCI_SUBSYSTEM_ID = 0x0102,
79 PLDM_FWUP_PCI_REVISION_ID = 0x0103,
80 PLDM_FWUP_PNP_PRODUCT_IDENTIFIER = 0x0104,
81 PLDM_FWUP_ACPI_PRODUCT_IDENTIFIER = 0x0105,
82 PLDM_FWUP_ASCII_MODEL_NUMBER_LONG_STRING = 0x0106,
83 PLDM_FWUP_ASCII_MODEL_NUMBER_SHORT_STRING = 0x0107,
84 PLDM_FWUP_SCSI_PRODUCT_ID = 0x0108,
85 PLDM_FWUP_UBM_CONTROLLER_DEVICE_CODE = 0x0109,
86 PLDM_FWUP_VENDOR_DEFINED = 0xFFFF
87};
88
89/** @brief Descriptor types length defined in PLDM firmware update specification
90 */
91enum pldm_firmware_update_descriptor_types_length {
92 PLDM_FWUP_PCI_VENDOR_ID_LENGTH = 2,
93 PLDM_FWUP_IANA_ENTERPRISE_ID_LENGTH = 4,
94 PLDM_FWUP_UUID_LENGTH = 16,
95 PLDM_FWUP_PNP_VENDOR_ID_LENGTH = 3,
96 PLDM_FWUP_ACPI_VENDOR_ID_LENGTH = 4,
97 PLDM_FWUP_IEEE_ASSIGNED_COMPANY_ID_LENGTH = 3,
98 PLDM_FWUP_SCSI_VENDOR_ID_LENGTH = 8,
99 PLDM_FWUP_PCI_DEVICE_ID_LENGTH = 2,
100 PLDM_FWUP_PCI_SUBSYSTEM_VENDOR_ID_LENGTH = 2,
101 PLDM_FWUP_PCI_SUBSYSTEM_ID_LENGTH = 2,
102 PLDM_FWUP_PCI_REVISION_ID_LENGTH = 1,
103 PLDM_FWUP_PNP_PRODUCT_IDENTIFIER_LENGTH = 4,
104 PLDM_FWUP_ACPI_PRODUCT_IDENTIFIER_LENGTH = 4,
105 PLDM_FWUP_ASCII_MODEL_NUMBER_LONG_STRING_LENGTH = 40,
106 PLDM_FWUP_ASCII_MODEL_NUMBER_SHORT_STRING_LENGTH = 10,
107 PLDM_FWUP_SCSI_PRODUCT_ID_LENGTH = 16,
108 PLDM_FWUP_UBM_CONTROLLER_DEVICE_CODE_LENGTH = 4
109};
110
gokulsanker1b909d82021-04-05 17:26:02 +0530111/** @brief ComponentClassification values defined in firmware update
112 * specification
113 */
114enum pldm_component_classification_values {
115 PLDM_COMP_UNKNOWN = 0x0000,
116 PLDM_COMP_OTHER = 0x0001,
117 PLDM_COMP_DRIVER = 0x0002,
118 PLDM_COMP_CONFIGURATION_SOFTWARE = 0x0003,
119 PLDM_COMP_APPLICATION_SOFTWARE = 0x0004,
120 PLDM_COMP_INSTRUMENTATION = 0x0005,
121 PLDM_COMP_FIRMWARE_OR_BIOS = 0x0006,
122 PLDM_COMP_DIAGNOSTIC_SOFTWARE = 0x0007,
123 PLDM_COMP_OPERATING_SYSTEM = 0x0008,
124 PLDM_COMP_MIDDLEWARE = 0x0009,
125 PLDM_COMP_FIRMWARE = 0x000A,
126 PLDM_COMP_BIOS_OR_FCODE = 0x000B,
127 PLDM_COMP_SUPPORT_OR_SERVICEPACK = 0x000C,
128 PLDM_COMP_SOFTWARE_BUNDLE = 0x000D,
129 PLDM_COMP_DOWNSTREAM_DEVICE = 0xFFFF
130};
131
Tom Joseph568e4702021-06-07 22:15:49 -0700132/** @struct pldm_package_header_information
133 *
134 * Structure representing fixed part of package header information
135 */
136struct pldm_package_header_information {
137 uint8_t uuid[PLDM_FWUP_UUID_LENGTH];
138 uint8_t package_header_format_version;
139 uint16_t package_header_size;
140 uint8_t timestamp104[PLDM_TIMESTAMP104_SIZE];
141 uint16_t component_bitmap_bit_length;
142 uint8_t package_version_string_type;
143 uint8_t package_version_string_length;
144} __attribute__((packed));
145
Tom Joseph64af3452021-06-08 04:05:28 -0700146/** @struct pldm_firmware_device_id_record
147 *
148 * Structure representing firmware device ID record
149 */
150struct pldm_firmware_device_id_record {
151 uint16_t record_length;
152 uint8_t descriptor_count;
153 bitfield32_t device_update_option_flags;
154 uint8_t comp_image_set_version_string_type;
155 uint8_t comp_image_set_version_string_length;
156 uint16_t fw_device_pkg_data_length;
157} __attribute__((packed));
158
Tom Joseph763b51e2021-06-05 04:50:47 -0700159/** @struct pldm_descriptor_tlv
160 *
161 * Structure representing descriptor type, length and value
162 */
163struct pldm_descriptor_tlv {
164 uint16_t descriptor_type;
165 uint16_t descriptor_length;
166 uint8_t descriptor_data[1];
167} __attribute__((packed));
168
169/** @struct pldm_vendor_defined_descriptor_title_data
170 *
171 * Structure representing vendor defined descriptor title sections
172 */
173struct pldm_vendor_defined_descriptor_title_data {
174 uint8_t vendor_defined_descriptor_title_str_type;
175 uint8_t vendor_defined_descriptor_title_str_len;
176 uint8_t vendor_defined_descriptor_title_str[1];
177} __attribute__((packed));
178
Tom Joseph58cc1722021-06-09 07:15:49 -0700179/** @struct pldm_component_image_information
180 *
181 * Structure representing fixed part of individual component information in
182 * PLDM firmware update package
183 */
184struct pldm_component_image_information {
185 uint16_t comp_classification;
186 uint16_t comp_identifier;
187 uint32_t comp_comparison_stamp;
188 bitfield16_t comp_options;
189 bitfield16_t requested_comp_activation_method;
190 uint32_t comp_location_offset;
191 uint32_t comp_size;
192 uint8_t comp_version_string_type;
193 uint8_t comp_version_string_length;
194} __attribute__((packed));
195
gokulsankereca3e192021-04-05 14:57:41 +0530196/** @struct pldm_query_device_identifiers_resp
197 *
198 * Structure representing query device identifiers response.
199 */
200struct pldm_query_device_identifiers_resp {
201 uint8_t completion_code;
202 uint32_t device_identifiers_len;
203 uint8_t descriptor_count;
204} __attribute__((packed));
205
gokulsanker22fbb342021-04-05 15:55:06 +0530206/** @struct pldm_get_firmware_parameters_resp
207 *
Tom Joseph3fd3eb82021-06-18 04:13:29 -0700208 * Structure representing the fixed part of GetFirmwareParameters response
gokulsanker22fbb342021-04-05 15:55:06 +0530209 */
210struct pldm_get_firmware_parameters_resp {
211 uint8_t completion_code;
212 bitfield32_t capabilities_during_update;
213 uint16_t comp_count;
214 uint8_t active_comp_image_set_ver_str_type;
215 uint8_t active_comp_image_set_ver_str_len;
216 uint8_t pending_comp_image_set_ver_str_type;
217 uint8_t pending_comp_image_set_ver_str_len;
218} __attribute__((packed));
219
gokulsankere1fb7a82021-04-05 16:09:29 +0530220/** @struct pldm_component_parameter_entry
221 *
222 * Structure representing component parameter table entry.
223 */
224struct pldm_component_parameter_entry {
225 uint16_t comp_classification;
226 uint16_t comp_identifier;
227 uint8_t comp_classification_index;
228 uint32_t active_comp_comparison_stamp;
229 uint8_t active_comp_ver_str_type;
230 uint8_t active_comp_ver_str_len;
231 uint8_t active_comp_release_date[8];
232 uint32_t pending_comp_comparison_stamp;
233 uint8_t pending_comp_ver_str_type;
234 uint8_t pending_comp_ver_str_len;
235 uint8_t pending_comp_release_date[8];
236 bitfield16_t comp_activation_methods;
237 bitfield32_t capabilities_during_update;
238} __attribute__((packed));
239
gokulsankerd434edc2021-04-05 16:36:04 +0530240/** @struct pldm_request_update_req
241 *
242 * Structure representing fixed part of Request Update request
243 */
244struct pldm_request_update_req {
245 uint32_t max_transfer_size;
246 uint16_t num_of_comp;
247 uint8_t max_outstanding_transfer_req;
248 uint16_t pkg_data_len;
249 uint8_t comp_image_set_ver_str_type;
250 uint8_t comp_image_set_ver_str_len;
251} __attribute__((packed));
252
gokulsanker611238c2021-04-05 16:50:44 +0530253/** @struct pldm_request_update_resp
254 *
255 * Structure representing Request Update response
256 */
257struct pldm_request_update_resp {
258 uint8_t completion_code;
259 uint16_t fd_meta_data_len;
260 uint8_t fd_will_send_pkg_data;
261} __attribute__((packed));
262
gokulsanker1b909d82021-04-05 17:26:02 +0530263/** @struct pldm_pass_component_table_req
264 *
265 * Structure representing PassComponentTable request
266 */
267struct pldm_pass_component_table_req {
268 uint8_t transfer_flag;
269 uint16_t comp_classification;
270 uint16_t comp_identifier;
271 uint8_t comp_classification_index;
272 uint32_t comp_comparison_stamp;
273 uint8_t comp_ver_str_type;
274 uint8_t comp_ver_str_len;
275} __attribute__((packed));
276
Tom Joseph568e4702021-06-07 22:15:49 -0700277/** @brief Decode the PLDM package header information
278 *
279 * @param[in] data - pointer to package header information
280 * @param[in] length - available length in the firmware update package
281 * @param[out] package_header_info - pointer to fixed part of PLDM package
282 * header information
283 * @param[out] package_version_str - pointer to package version string
284 *
285 * @return pldm_completion_codes
286 */
287int decode_pldm_package_header_info(
288 const uint8_t *data, size_t length,
289 struct pldm_package_header_information *package_header_info,
290 struct variable_field *package_version_str);
291
Tom Joseph64af3452021-06-08 04:05:28 -0700292/** @brief Decode individual firmware device ID record
293 *
294 * @param[in] data - pointer to firmware device ID record
295 * @param[in] length - available length in the firmware update package
296 * @param[in] component_bitmap_bit_length - ComponentBitmapBitLengthfield
297 * parsed from the package header info
298 * @param[out] fw_device_id_record - pointer to fixed part of firmware device
299 * id record
300 * @param[out] applicable_components - pointer to ApplicableComponents
301 * @param[out] comp_image_set_version_str - pointer to
302 * ComponentImageSetVersionString
303 * @param[out] record_descriptors - pointer to RecordDescriptors
304 * @param[out] fw_device_pkg_data - pointer to FirmwareDevicePackageData
305 *
306 * @return pldm_completion_codes
307 */
308int decode_firmware_device_id_record(
309 const uint8_t *data, size_t length, uint16_t component_bitmap_bit_length,
310 struct pldm_firmware_device_id_record *fw_device_id_record,
311 struct variable_field *applicable_components,
312 struct variable_field *comp_image_set_version_str,
313 struct variable_field *record_descriptors,
314 struct variable_field *fw_device_pkg_data);
315
Tom Joseph763b51e2021-06-05 04:50:47 -0700316/** @brief Decode the record descriptor entries in the firmware update package
317 * and the Descriptors in the QueryDeviceIDentifiers command
318 *
319 * @param[in] data - pointer to descriptor entry
320 * @param[in] length - remaining length of the descriptor data
321 * @param[out] descriptor_type - pointer to descriptor type
322 * @param[out] descriptor_data - pointer to descriptor data
323 *
324 * @return pldm_completion_codes
325 */
326int decode_descriptor_type_length_value(const uint8_t *data, size_t length,
327 uint16_t *descriptor_type,
328 struct variable_field *descriptor_data);
329
330/** @brief Decode the vendor defined descriptor value
331 *
332 * @param[in] data - pointer to vendor defined descriptor value
333 * @param[in] length - length of the vendor defined descriptor value
334 * @param[out] descriptor_title_str_type - pointer to vendor defined descriptor
335 * title string type
336 * @param[out] descriptor_title_str - pointer to vendor defined descriptor
337 * title string
338 * @param[out] descriptor_data - pointer to vendor defined descriptor data
339 *
340 * @return pldm_completion_codes
341 */
342int decode_vendor_defined_descriptor_value(
343 const uint8_t *data, size_t length, uint8_t *descriptor_title_str_type,
344 struct variable_field *descriptor_title_str,
345 struct variable_field *descriptor_data);
346
Tom Joseph58cc1722021-06-09 07:15:49 -0700347/** @brief Decode individual component image information
348 *
349 * @param[in] data - pointer to component image information
350 * @param[in] length - available length in the firmware update package
351 * @param[out] pldm_comp_image_info - pointer to fixed part of component image
352 * information
353 * @param[out] comp_version_str - pointer to component version string
354 *
355 * @return pldm_completion_codes
356 */
357int decode_pldm_comp_image_info(
358 const uint8_t *data, size_t length,
359 struct pldm_component_image_information *pldm_comp_image_info,
360 struct variable_field *comp_version_str);
361
gokulsanker138ceba2021-04-05 13:25:25 +0530362/** @brief Create a PLDM request message for QueryDeviceIdentifiers
363 *
364 * @param[in] instance_id - Message's instance id
365 * @param[in] payload_length - Length of the request message payload
366 * @param[in,out] msg - Message will be written to this
367 *
368 * @return pldm_completion_codes
369 *
370 * @note Caller is responsible for memory alloc and dealloc of param
371 * 'msg.payload'
372 */
373int encode_query_device_identifiers_req(uint8_t instance_id,
374 size_t payload_length,
375 struct pldm_msg *msg);
gokulsankereca3e192021-04-05 14:57:41 +0530376
377/** @brief Decode QueryDeviceIdentifiers response message
378 *
379 * @param[in] msg - Response message
380 * @param[in] payload_length - Length of response message payload
381 * @param[out] completion_code - Pointer to response msg's PLDM completion code
382 * @param[out] device_identifiers_len - Pointer to device identifiers length
383 * @param[out] descriptor_count - Pointer to descriptor count
384 * @param[out] descriptor_data - Pointer to descriptor data
385 *
386 * @return pldm_completion_codes
387 */
388int decode_query_device_identifiers_resp(const struct pldm_msg *msg,
389 size_t payload_length,
390 uint8_t *completion_code,
391 uint32_t *device_identifiers_len,
392 uint8_t *descriptor_count,
393 uint8_t **descriptor_data);
gokulsanker981fbfb2021-04-05 15:17:25 +0530394
395/** @brief Create a PLDM request message for GetFirmwareParameters
396 *
397 * @param[in] instance_id - Message's instance id
398 * @param[in] payload_length - Length of the request message payload
399 * @param[in,out] msg - Message will be written to this
400 *
401 * @return pldm_completion_codes
402 *
403 * @note Caller is responsible for memory alloc and dealloc of param
404 * 'msg.payload'
405 */
406int encode_get_firmware_parameters_req(uint8_t instance_id,
407 size_t payload_length,
408 struct pldm_msg *msg);
gokulsanker22fbb342021-04-05 15:55:06 +0530409
Tom Joseph3fd3eb82021-06-18 04:13:29 -0700410/** @brief Decode GetFirmwareParameters response
gokulsanker22fbb342021-04-05 15:55:06 +0530411 *
412 * @param[in] msg - Response message
413 * @param[in] payload_length - Length of response message payload
414 * @param[out] resp_data - Pointer to get firmware parameters response
415 * @param[out] active_comp_image_set_ver_str - Pointer to active component
Tom Joseph3fd3eb82021-06-18 04:13:29 -0700416 * image set version string
gokulsanker22fbb342021-04-05 15:55:06 +0530417 * @param[out] pending_comp_image_set_ver_str - Pointer to pending component
Tom Joseph3fd3eb82021-06-18 04:13:29 -0700418 * image set version string
419 * @param[out] comp_parameter_table - Pointer to component parameter table
gokulsanker22fbb342021-04-05 15:55:06 +0530420 *
421 * @return pldm_completion_codes
422 */
Tom Joseph3fd3eb82021-06-18 04:13:29 -0700423int decode_get_firmware_parameters_resp(
gokulsanker22fbb342021-04-05 15:55:06 +0530424 const struct pldm_msg *msg, size_t payload_length,
425 struct pldm_get_firmware_parameters_resp *resp_data,
426 struct variable_field *active_comp_image_set_ver_str,
Tom Joseph3fd3eb82021-06-18 04:13:29 -0700427 struct variable_field *pending_comp_image_set_ver_str,
428 struct variable_field *comp_parameter_table);
gokulsanker22fbb342021-04-05 15:55:06 +0530429
gokulsankere1fb7a82021-04-05 16:09:29 +0530430/** @brief Decode component entries in the component parameter table which is
431 * part of the response of GetFirmwareParameters command
432 *
433 * @param[in] data - Component entry
434 * @param[in] length - Length of component entry
435 * @param[out] component_data - Pointer to component parameter table
436 * @param[out] active_comp_ver_str - Pointer to active component version string
437 * @param[out] pending_comp_ver_str - Pointer to pending component version
438 * string
439 *
440 * @return pldm_completion_codes
441 */
442int decode_get_firmware_parameters_resp_comp_entry(
443 const uint8_t *data, size_t length,
444 struct pldm_component_parameter_entry *component_data,
445 struct variable_field *active_comp_ver_str,
446 struct variable_field *pending_comp_ver_str);
447
gokulsankerd434edc2021-04-05 16:36:04 +0530448/** @brief Create PLDM request message for RequestUpdate
449 *
450 * @param[in] instance_id - Message's instance id
451 * @param[in] max_transfer_size - Maximum size of the variable payload allowed
452 * to be requested via RequestFirmwareData
453 * command
454 * @param[in] num_of_comp - Total number of components that will be passed to
455 * the FD during the update
456 * @param[in] max_outstanding_transfer_req - Total number of outstanding
457 * RequestFirmwareData
458 * commands that can be sent by the FD
459 * @param[in] pkg_data_len - Value of the FirmwareDevicePackageDataLength field
460 * present in firmware package header
461 * @param[in] comp_image_set_ver_str_type - StringType of
462 * ComponentImageSetVersionString
463 * @param[in] comp_image_set_ver_str_len - The length of the
464 * ComponentImageSetVersionString
465 * @param[in] comp_img_set_ver_str - Component Image Set version information
466 * @param[in,out] msg - Message will be written to this
467 * @param[in] payload_length - Length of request message payload
468 *
469 * @return pldm_completion_codes
470 *
471 * @note Caller is responsible for memory alloc and dealloc of param
472 * 'msg.payload'
473 */
474int encode_request_update_req(uint8_t instance_id, uint32_t max_transfer_size,
475 uint16_t num_of_comp,
476 uint8_t max_outstanding_transfer_req,
477 uint16_t pkg_data_len,
478 uint8_t comp_image_set_ver_str_type,
479 uint8_t comp_image_set_ver_str_len,
480 const struct variable_field *comp_img_set_ver_str,
481 struct pldm_msg *msg, size_t payload_length);
gokulsanker611238c2021-04-05 16:50:44 +0530482
483/** @brief Decode a RequestUpdate response message
484 *
485 * @param[in] msg - Response message
486 * @param[in] payload_length - Length of response message payload
487 * @param[out] completion_code - Pointer to hold the completion code
488 * @param[out] fd_meta_data_len - Pointer to hold the length of FD metadata
489 * @param[out] fd_will_send_pkg_data - Pointer to hold information whether FD
490 * will send GetPackageData command
491 * @return pldm_completion_codes
492 */
493int decode_request_update_resp(const struct pldm_msg *msg,
494 size_t payload_length, uint8_t *completion_code,
495 uint16_t *fd_meta_data_len,
496 uint8_t *fd_will_send_pkg_data);
497
gokulsanker1b909d82021-04-05 17:26:02 +0530498/** @brief Create PLDM request message for PassComponentTable
499 *
500 * @param[in] instance_id - Message's instance id
501 * @param[in] transfer_flag - TransferFlag
502 * @param[in] comp_classification - ComponentClassification
503 * @param[in] comp_identifier - ComponentIdentifier
504 * @param[in] comp_classification_index - ComponentClassificationIndex
505 * @param[in] comp_comparison_stamp - ComponentComparisonStamp
506 * @param[in] comp_ver_str_type - ComponentVersionStringType
507 * @param[in] comp_ver_str_len - ComponentVersionStringLength
508 * @param[in] comp_ver_str - ComponentVersionString
509 * @param[in,out] msg - Message will be written to this
510 * @param[in] payload_length - Length of request message payload
511 * information
512 *
513 * @return pldm_completion_codes
514 *
515 * @note Caller is responsible for memory alloc and dealloc of param
516 * 'msg.payload'
517 */
518int encode_pass_component_table_req(
519 uint8_t instance_id, uint8_t transfer_flag, uint16_t comp_classification,
520 uint16_t comp_identifier, uint8_t comp_classification_index,
521 uint32_t comp_comparison_stamp, uint8_t comp_ver_str_type,
522 uint8_t comp_ver_str_len, const struct variable_field *comp_ver_str,
523 struct pldm_msg *msg, size_t payload_length);
524
gokulsanker138ceba2021-04-05 13:25:25 +0530525#ifdef __cplusplus
526}
527#endif
528
529#endif // End of FW_UPDATE_H