blob: eb02558ac9648861cebe7d431b02d681c42cf160 [file] [log] [blame]
Andrew Jeffery9c766792022-08-10 23:12:49 +09301#ifndef FW_UPDATE_H
2#define FW_UPDATE_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
Manojkiran Eda9a8e4972022-11-28 16:38:21 +05307
Andrew Jeffery9c766792022-08-10 23:12:49 +09308#include "base.h"
Manojkiran Eda9a8e4972022-11-28 16:38:21 +05309#include "pldm_types.h"
Andrew Jeffery9c766792022-08-10 23:12:49 +093010#include "stdbool.h"
Manojkiran Eda9a8e4972022-11-28 16:38:21 +053011#include <stddef.h>
12#include <stdint.h>
13struct variable_field;
Andrew Jeffery9c766792022-08-10 23:12:49 +093014
15#define PLDM_FWUP_COMPONENT_BITMAP_MULTIPLE 8
16#define PLDM_FWUP_INVALID_COMPONENT_COMPARISON_TIMESTAMP 0xFFFFFFFF
17#define PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES 0
18/** @brief Minimum length of device descriptor, 2 bytes for descriptor type,
19 * 2 bytes for descriptor length and atleast 1 byte of descriptor data
20 */
21#define PLDM_FWUP_DEVICE_DESCRIPTOR_MIN_LEN 5
22#define PLDM_GET_FIRMWARE_PARAMETERS_REQ_BYTES 0
23#define PLDM_FWUP_BASELINE_TRANSFER_SIZE 32
24#define PLDM_FWUP_MIN_OUTSTANDING_REQ 1
25#define PLDM_GET_STATUS_REQ_BYTES 0
26/* Maximum progress percentage value*/
27#define PLDM_FWUP_MAX_PROGRESS_PERCENT 0x65
28#define PLDM_CANCEL_UPDATE_COMPONENT_REQ_BYTES 0
29#define PLDM_CANCEL_UPDATE_REQ_BYTES 0
30
31/** @brief PLDM Firmware update commands
32 */
33enum pldm_firmware_update_commands {
34 PLDM_QUERY_DEVICE_IDENTIFIERS = 0x01,
35 PLDM_GET_FIRMWARE_PARAMETERS = 0x02,
36 PLDM_REQUEST_UPDATE = 0x10,
37 PLDM_PASS_COMPONENT_TABLE = 0x13,
38 PLDM_UPDATE_COMPONENT = 0x14,
39 PLDM_REQUEST_FIRMWARE_DATA = 0x15,
40 PLDM_TRANSFER_COMPLETE = 0x16,
41 PLDM_VERIFY_COMPLETE = 0x17,
42 PLDM_APPLY_COMPLETE = 0x18,
43 PLDM_ACTIVATE_FIRMWARE = 0x1A,
44 PLDM_GET_STATUS = 0x1B,
45 PLDM_CANCEL_UPDATE_COMPONENT = 0x1C,
46 PLDM_CANCEL_UPDATE = 0x1D
47};
48
49/** @brief PLDM Firmware update completion codes
50 */
51enum pldm_firmware_update_completion_codes {
52 PLDM_FWUP_NOT_IN_UPDATE_MODE = 0x80,
53 PLDM_FWUP_ALREADY_IN_UPDATE_MODE = 0x81,
54 PLDM_FWUP_DATA_OUT_OF_RANGE = 0x82,
55 PLDM_FWUP_INVALID_TRANSFER_LENGTH = 0x83,
56 PLDM_FWUP_INVALID_STATE_FOR_COMMAND = 0x84,
57 PLDM_FWUP_INCOMPLETE_UPDATE = 0x85,
58 PLDM_FWUP_BUSY_IN_BACKGROUND = 0x86,
59 PLDM_FWUP_CANCEL_PENDING = 0x87,
60 PLDM_FWUP_COMMAND_NOT_EXPECTED = 0x88,
61 PLDM_FWUP_RETRY_REQUEST_FW_DATA = 0x89,
62 PLDM_FWUP_UNABLE_TO_INITIATE_UPDATE = 0x8A,
63 PLDM_FWUP_ACTIVATION_NOT_REQUIRED = 0x8B,
64 PLDM_FWUP_SELF_CONTAINED_ACTIVATION_NOT_PERMITTED = 0x8C,
65 PLDM_FWUP_NO_DEVICE_METADATA = 0x8D,
66 PLDM_FWUP_RETRY_REQUEST_UPDATE = 0x8E,
67 PLDM_FWUP_NO_PACKAGE_DATA = 0x8F,
68 PLDM_FWUP_INVALID_TRANSFER_HANDLE = 0x90,
69 PLDM_FWUP_INVALID_TRANSFER_OPERATION_FLAG = 0x91,
70 PLDM_FWUP_ACTIVATE_PENDING_IMAGE_NOT_PERMITTED = 0x92,
71 PLDM_FWUP_PACKAGE_DATA_ERROR = 0x93
72};
73
74/** @brief String type values defined in the PLDM firmware update specification
75 */
76enum pldm_firmware_update_string_type {
77 PLDM_STR_TYPE_UNKNOWN = 0,
78 PLDM_STR_TYPE_ASCII = 1,
79 PLDM_STR_TYPE_UTF_8 = 2,
80 PLDM_STR_TYPE_UTF_16 = 3,
81 PLDM_STR_TYPE_UTF_16LE = 4,
82 PLDM_STR_TYPE_UTF_16BE = 5
83};
84
85/** @brief Descriptor types defined in PLDM firmware update specification
86 */
87enum pldm_firmware_update_descriptor_types {
88 PLDM_FWUP_PCI_VENDOR_ID = 0x0000,
89 PLDM_FWUP_IANA_ENTERPRISE_ID = 0x0001,
90 PLDM_FWUP_UUID = 0x0002,
91 PLDM_FWUP_PNP_VENDOR_ID = 0x0003,
92 PLDM_FWUP_ACPI_VENDOR_ID = 0x0004,
93 PLDM_FWUP_IEEE_ASSIGNED_COMPANY_ID = 0x0005,
94 PLDM_FWUP_SCSI_VENDOR_ID = 0x0006,
95 PLDM_FWUP_PCI_DEVICE_ID = 0x0100,
96 PLDM_FWUP_PCI_SUBSYSTEM_VENDOR_ID = 0x0101,
97 PLDM_FWUP_PCI_SUBSYSTEM_ID = 0x0102,
98 PLDM_FWUP_PCI_REVISION_ID = 0x0103,
99 PLDM_FWUP_PNP_PRODUCT_IDENTIFIER = 0x0104,
100 PLDM_FWUP_ACPI_PRODUCT_IDENTIFIER = 0x0105,
101 PLDM_FWUP_ASCII_MODEL_NUMBER_LONG_STRING = 0x0106,
102 PLDM_FWUP_ASCII_MODEL_NUMBER_SHORT_STRING = 0x0107,
103 PLDM_FWUP_SCSI_PRODUCT_ID = 0x0108,
104 PLDM_FWUP_UBM_CONTROLLER_DEVICE_CODE = 0x0109,
105 PLDM_FWUP_VENDOR_DEFINED = 0xFFFF
106};
107
108/** @brief Descriptor types length defined in PLDM firmware update specification
109 */
110enum pldm_firmware_update_descriptor_types_length {
111 PLDM_FWUP_PCI_VENDOR_ID_LENGTH = 2,
112 PLDM_FWUP_IANA_ENTERPRISE_ID_LENGTH = 4,
113 PLDM_FWUP_UUID_LENGTH = 16,
114 PLDM_FWUP_PNP_VENDOR_ID_LENGTH = 3,
115 PLDM_FWUP_ACPI_VENDOR_ID_LENGTH = 4,
116 PLDM_FWUP_IEEE_ASSIGNED_COMPANY_ID_LENGTH = 3,
117 PLDM_FWUP_SCSI_VENDOR_ID_LENGTH = 8,
118 PLDM_FWUP_PCI_DEVICE_ID_LENGTH = 2,
119 PLDM_FWUP_PCI_SUBSYSTEM_VENDOR_ID_LENGTH = 2,
120 PLDM_FWUP_PCI_SUBSYSTEM_ID_LENGTH = 2,
121 PLDM_FWUP_PCI_REVISION_ID_LENGTH = 1,
122 PLDM_FWUP_PNP_PRODUCT_IDENTIFIER_LENGTH = 4,
123 PLDM_FWUP_ACPI_PRODUCT_IDENTIFIER_LENGTH = 4,
124 PLDM_FWUP_ASCII_MODEL_NUMBER_LONG_STRING_LENGTH = 40,
125 PLDM_FWUP_ASCII_MODEL_NUMBER_SHORT_STRING_LENGTH = 10,
126 PLDM_FWUP_SCSI_PRODUCT_ID_LENGTH = 16,
127 PLDM_FWUP_UBM_CONTROLLER_DEVICE_CODE_LENGTH = 4
128};
129
130/** @brief ComponentClassification values defined in firmware update
131 * specification
132 */
133enum pldm_component_classification_values {
134 PLDM_COMP_UNKNOWN = 0x0000,
135 PLDM_COMP_OTHER = 0x0001,
136 PLDM_COMP_DRIVER = 0x0002,
137 PLDM_COMP_CONFIGURATION_SOFTWARE = 0x0003,
138 PLDM_COMP_APPLICATION_SOFTWARE = 0x0004,
139 PLDM_COMP_INSTRUMENTATION = 0x0005,
140 PLDM_COMP_FIRMWARE_OR_BIOS = 0x0006,
141 PLDM_COMP_DIAGNOSTIC_SOFTWARE = 0x0007,
142 PLDM_COMP_OPERATING_SYSTEM = 0x0008,
143 PLDM_COMP_MIDDLEWARE = 0x0009,
144 PLDM_COMP_FIRMWARE = 0x000A,
145 PLDM_COMP_BIOS_OR_FCODE = 0x000B,
146 PLDM_COMP_SUPPORT_OR_SERVICEPACK = 0x000C,
147 PLDM_COMP_SOFTWARE_BUNDLE = 0x000D,
148 PLDM_COMP_DOWNSTREAM_DEVICE = 0xFFFF
149};
150
151/** @brief ComponentActivationMethods is the bit position in the bitfield that
152 * provides the capability of the FD for firmware activation. Multiple
153 * activation methods can be supported.
154 */
155enum pldm_comp_activation_methods {
156 PLDM_ACTIVATION_AUTOMATIC = 0,
157 PLDM_ACTIVATION_SELF_CONTAINED = 1,
158 PLDM_ACTIVATION_MEDIUM_SPECIFIC_RESET = 2,
159 PLDM_ACTIVATION_SYSTEM_REBOOT = 3,
160 PLDM_ACTIVATION_DC_POWER_CYCLE = 4,
161 PLDM_ACTIVATION_AC_POWER_CYCLE = 5,
162 PLDM_SUPPORTS_ACTIVATE_PENDING_IMAGE = 6,
163 PLDM_SUPPORTS_ACTIVATE_PENDING_IMAGE_SET = 7
164};
165
166/** @brief ComponentResponse values in the response of PassComponentTable
167 */
168enum pldm_component_responses {
169 PLDM_CR_COMP_CAN_BE_UPDATED = 0,
170 PLDM_CR_COMP_MAY_BE_UPDATEABLE = 1
171};
172
173/** @brief ComponentResponseCode values in the response of PassComponentTable
174 */
175enum pldm_component_response_codes {
176 PLDM_CRC_COMP_CAN_BE_UPDATED = 0x00,
177 PLDM_CRC_COMP_COMPARISON_STAMP_IDENTICAL = 0x01,
178 PLDM_CRC_COMP_COMPARISON_STAMP_LOWER = 0x02,
179 PLDM_CRC_INVALID_COMP_COMPARISON_STAMP = 0x03,
180 PLDM_CRC_COMP_CONFLICT = 0x04,
181 PLDM_CRC_COMP_PREREQUISITES_NOT_MET = 0x05,
182 PLDM_CRC_COMP_NOT_SUPPORTED = 0x06,
183 PLDM_CRC_COMP_SECURITY_RESTRICTIONS = 0x07,
184 PLDM_CRC_INCOMPLETE_COMP_IMAGE_SET = 0x08,
185 PLDM_CRC_ACTIVE_IMAGE_NOT_UPDATEABLE_SUBSEQUENTLY = 0x09,
186 PLDM_CRC_COMP_VER_STR_IDENTICAL = 0x0A,
187 PLDM_CRC_COMP_VER_STR_LOWER = 0x0B,
188 PLDM_CRC_VENDOR_COMP_RESP_CODE_RANGE_MIN = 0xD0,
189 PLDM_CRC_VENDOR_COMP_RESP_CODE_RANGE_MAX = 0xEF
190};
191
192/** @brief ComponentCompatibilityResponse values in the response of
193 * UpdateComponent
194 */
195enum pldm_component_compatibility_responses {
196 PLDM_CCR_COMP_CAN_BE_UPDATED = 0,
197 PLDM_CCR_COMP_CANNOT_BE_UPDATED = 1
198};
199
200/** @brief ComponentCompatibilityResponse Code values in the response of
201 * UpdateComponent
202 */
203enum pldm_component_compatibility_response_codes {
204 PLDM_CCRC_NO_RESPONSE_CODE = 0x00,
205 PLDM_CCRC_COMP_COMPARISON_STAMP_IDENTICAL = 0x01,
206 PLDM_CCRC_COMP_COMPARISON_STAMP_LOWER = 0x02,
207 PLDM_CCRC_INVALID_COMP_COMPARISON_STAMP = 0x03,
208 PLDM_CCRC_COMP_CONFLICT = 0x04,
209 PLDM_CCRC_COMP_PREREQUISITES_NOT_MET = 0x05,
210 PLDM_CCRC_COMP_NOT_SUPPORTED = 0x06,
211 PLDM_CCRC_COMP_SECURITY_RESTRICTIONS = 0x07,
212 PLDM_CCRC_INCOMPLETE_COMP_IMAGE_SET = 0x08,
213 PLDM_CCRC_COMP_INFO_NO_MATCH = 0x09,
214 PLDM_CCRC_COMP_VER_STR_IDENTICAL = 0x0A,
215 PLDM_CCRC_COMP_VER_STR_LOWER = 0x0B,
216 PLDM_CCRC_VENDOR_COMP_RESP_CODE_RANGE_MIN = 0xD0,
217 PLDM_CCRC_VENDOR_COMP_RESP_CODE_RANGE_MAX = 0xEF
218};
219
220/** @brief Common error codes in TransferComplete, VerifyComplete and
221 * ApplyComplete request
222 */
223enum pldm_firmware_update_common_error_codes {
224 PLDM_FWUP_TIME_OUT = 0x09,
225 PLDM_FWUP_GENERIC_ERROR = 0x0A
226};
227
228/** @brief TransferResult values in the request of TransferComplete
229 */
230enum pldm_firmware_update_transfer_result_values {
231 PLDM_FWUP_TRANSFER_SUCCESS = 0x00,
232 PLDM_FWUP_TRANSFER_ERROR_IMAGE_CORRUPT = 0x02,
233 PLDM_FWUP_TRANSFER_ERROR_VERSION_MISMATCH = 0x02,
234 PLDM_FWUP_FD_ABORTED_TRANSFER = 0x03,
235 PLDM_FWUP_FD_ABORTED_TRANSFER_LOW_POWER_STATE = 0x0B,
236 PLDM_FWUP_FD_ABORTED_TRANSFER_RESET_NEEDED = 0x0C,
237 PLDM_FWUP_FD_ABORTED_TRANSFER_STORAGE_ISSUE = 0x0D,
238 PLDM_FWUP_VENDOR_TRANSFER_RESULT_RANGE_MIN = 0x70,
239 PLDM_FWUP_VENDOR_TRANSFER_RESULT_RANGE_MAX = 0x8F
240};
241
242/**@brief VerifyResult values in the request of VerifyComplete
243 */
244enum pldm_firmware_update_verify_result_values {
245 PLDM_FWUP_VERIFY_SUCCESS = 0x00,
246 PLDM_FWUP_VERIFY_ERROR_VERIFICATION_FAILURE = 0x01,
247 PLDM_FWUP_VERIFY_ERROR_VERSION_MISMATCH = 0x02,
248 PLDM_FWUP_VERIFY_FAILED_FD_SECURITY_CHECKS = 0x03,
249 PLDM_FWUP_VERIFY_ERROR_IMAGE_INCOMPLETE = 0x04,
250 PLDM_FWUP_VENDOR_VERIFY_RESULT_RANGE_MIN = 0x90,
251 PLDM_FWUP_VENDOR_VERIFY_RESULT_RANGE_MAX = 0xAF
252};
253
254/**@brief ApplyResult values in the request of ApplyComplete
255 */
256enum pldm_firmware_update_apply_result_values {
257 PLDM_FWUP_APPLY_SUCCESS = 0x00,
258 PLDM_FWUP_APPLY_SUCCESS_WITH_ACTIVATION_METHOD = 0x01,
259 PLDM_FWUP_APPLY_FAILURE_MEMORY_ISSUE = 0x02,
260 PLDM_FWUP_VENDOR_APPLY_RESULT_RANGE_MIN = 0xB0,
261 PLDM_FWUP_VENDOR_APPLY_RESULT_RANGE_MAX = 0xCF
262};
263
264/** @brief SelfContainedActivationRequest in the request of ActivateFirmware
265 */
266enum pldm_self_contained_activation_req {
267 PLDM_NOT_ACTIVATE_SELF_CONTAINED_COMPONENTS = false,
268 PLDM_ACTIVATE_SELF_CONTAINED_COMPONENTS = true
269};
270
271/** @brief Current state/previous state of the FD or FDP returned in GetStatus
272 * response
273 */
274enum pldm_firmware_device_states {
275 PLDM_FD_STATE_IDLE = 0,
276 PLDM_FD_STATE_LEARN_COMPONENTS = 1,
277 PLDM_FD_STATE_READY_XFER = 2,
278 PLDM_FD_STATE_DOWNLOAD = 3,
279 PLDM_FD_STATE_VERIFY = 4,
280 PLDM_FD_STATE_APPLY = 5,
281 PLDM_FD_STATE_ACTIVATE = 6
282};
283
284/** @brief Firmware device aux state in GetStatus response
285 */
286enum pldm_get_status_aux_states {
287 PLDM_FD_OPERATION_IN_PROGRESS = 0,
288 PLDM_FD_OPERATION_SUCCESSFUL = 1,
289 PLDM_FD_OPERATION_FAILED = 2,
290 PLDM_FD_IDLE_LEARN_COMPONENTS_READ_XFER = 3
291};
292
293/** @brief Firmware device aux state status in GetStatus response
294 */
295enum pldm_get_status_aux_state_status_values {
296 PLDM_FD_AUX_STATE_IN_PROGRESS_OR_SUCCESS = 0x00,
297 PLDM_FD_TIMEOUT = 0x09,
298 PLDM_FD_GENERIC_ERROR = 0x0A,
299 PLDM_FD_VENDOR_DEFINED_STATUS_CODE_START = 0x70,
300 PLDM_FD_VENDOR_DEFINED_STATUS_CODE_END = 0xEF
301};
302
303/** @brief Firmware device reason code in GetStatus response
304 */
305enum pldm_get_status_reason_code_values {
306 PLDM_FD_INITIALIZATION = 0,
307 PLDM_FD_ACTIVATE_FW = 1,
308 PLDM_FD_CANCEL_UPDATE = 2,
309 PLDM_FD_TIMEOUT_LEARN_COMPONENT = 3,
310 PLDM_FD_TIMEOUT_READY_XFER = 4,
311 PLDM_FD_TIMEOUT_DOWNLOAD = 5,
312 PLDM_FD_TIMEOUT_VERIFY = 6,
313 PLDM_FD_TIMEOUT_APPLY = 7,
314 PLDM_FD_STATUS_VENDOR_DEFINED_MIN = 200,
315 PLDM_FD_STATUS_VENDOR_DEFINED_MAX = 255
316};
317
318/** @brief Components functional indicator in CancelUpdate response
319 */
320enum pldm_firmware_update_non_functioning_component_indication {
321 PLDM_FWUP_COMPONENTS_FUNCTIONING = 0,
322 PLDM_FWUP_COMPONENTS_NOT_FUNCTIONING = 1
323};
324
325/** @struct pldm_package_header_information
326 *
327 * Structure representing fixed part of package header information
328 */
329struct pldm_package_header_information {
330 uint8_t uuid[PLDM_FWUP_UUID_LENGTH];
331 uint8_t package_header_format_version;
332 uint16_t package_header_size;
333 uint8_t package_release_date_time[PLDM_TIMESTAMP104_SIZE];
334 uint16_t component_bitmap_bit_length;
335 uint8_t package_version_string_type;
336 uint8_t package_version_string_length;
337} __attribute__((packed));
338
339/** @struct pldm_firmware_device_id_record
340 *
341 * Structure representing firmware device ID record
342 */
343struct pldm_firmware_device_id_record {
344 uint16_t record_length;
345 uint8_t descriptor_count;
346 bitfield32_t device_update_option_flags;
347 uint8_t comp_image_set_version_string_type;
348 uint8_t comp_image_set_version_string_length;
349 uint16_t fw_device_pkg_data_length;
350} __attribute__((packed));
351
352/** @struct pldm_descriptor_tlv
353 *
354 * Structure representing descriptor type, length and value
355 */
356struct pldm_descriptor_tlv {
357 uint16_t descriptor_type;
358 uint16_t descriptor_length;
359 uint8_t descriptor_data[1];
360} __attribute__((packed));
361
362/** @struct pldm_vendor_defined_descriptor_title_data
363 *
364 * Structure representing vendor defined descriptor title sections
365 */
366struct pldm_vendor_defined_descriptor_title_data {
367 uint8_t vendor_defined_descriptor_title_str_type;
368 uint8_t vendor_defined_descriptor_title_str_len;
369 uint8_t vendor_defined_descriptor_title_str[1];
370} __attribute__((packed));
371
372/** @struct pldm_component_image_information
373 *
374 * Structure representing fixed part of individual component information in
375 * PLDM firmware update package
376 */
377struct pldm_component_image_information {
378 uint16_t comp_classification;
379 uint16_t comp_identifier;
380 uint32_t comp_comparison_stamp;
381 bitfield16_t comp_options;
382 bitfield16_t requested_comp_activation_method;
383 uint32_t comp_location_offset;
384 uint32_t comp_size;
385 uint8_t comp_version_string_type;
386 uint8_t comp_version_string_length;
387} __attribute__((packed));
388
389/** @struct pldm_query_device_identifiers_resp
390 *
391 * Structure representing query device identifiers response.
392 */
393struct pldm_query_device_identifiers_resp {
394 uint8_t completion_code;
395 uint32_t device_identifiers_len;
396 uint8_t descriptor_count;
397} __attribute__((packed));
398
399/** @struct pldm_get_firmware_parameters_resp
400 *
401 * Structure representing the fixed part of GetFirmwareParameters response
402 */
403struct pldm_get_firmware_parameters_resp {
404 uint8_t completion_code;
405 bitfield32_t capabilities_during_update;
406 uint16_t comp_count;
407 uint8_t active_comp_image_set_ver_str_type;
408 uint8_t active_comp_image_set_ver_str_len;
409 uint8_t pending_comp_image_set_ver_str_type;
410 uint8_t pending_comp_image_set_ver_str_len;
411} __attribute__((packed));
412
413/** @struct pldm_component_parameter_entry
414 *
415 * Structure representing component parameter table entry.
416 */
417struct pldm_component_parameter_entry {
418 uint16_t comp_classification;
419 uint16_t comp_identifier;
420 uint8_t comp_classification_index;
421 uint32_t active_comp_comparison_stamp;
422 uint8_t active_comp_ver_str_type;
423 uint8_t active_comp_ver_str_len;
424 uint8_t active_comp_release_date[8];
425 uint32_t pending_comp_comparison_stamp;
426 uint8_t pending_comp_ver_str_type;
427 uint8_t pending_comp_ver_str_len;
428 uint8_t pending_comp_release_date[8];
429 bitfield16_t comp_activation_methods;
430 bitfield32_t capabilities_during_update;
431} __attribute__((packed));
432
433/** @struct pldm_request_update_req
434 *
435 * Structure representing fixed part of Request Update request
436 */
437struct pldm_request_update_req {
438 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} __attribute__((packed));
445
446/** @struct pldm_request_update_resp
447 *
448 * Structure representing Request Update response
449 */
450struct pldm_request_update_resp {
451 uint8_t completion_code;
452 uint16_t fd_meta_data_len;
453 uint8_t fd_will_send_pkg_data;
454} __attribute__((packed));
455
456/** @struct pldm_pass_component_table_req
457 *
458 * Structure representing PassComponentTable request
459 */
460struct pldm_pass_component_table_req {
461 uint8_t transfer_flag;
462 uint16_t comp_classification;
463 uint16_t comp_identifier;
464 uint8_t comp_classification_index;
465 uint32_t comp_comparison_stamp;
466 uint8_t comp_ver_str_type;
467 uint8_t comp_ver_str_len;
468} __attribute__((packed));
469
470/** @struct pldm_pass_component_table_resp
471 *
472 * Structure representing PassComponentTable response
473 */
474struct pldm_pass_component_table_resp {
475 uint8_t completion_code;
476 uint8_t comp_resp;
477 uint8_t comp_resp_code;
478} __attribute__((packed));
479
480/** @struct pldm_update_component_req
481 *
482 * Structure representing UpdateComponent request
483 */
484struct pldm_update_component_req {
485 uint16_t comp_classification;
486 uint16_t comp_identifier;
487 uint8_t comp_classification_index;
488 uint32_t comp_comparison_stamp;
489 uint32_t comp_image_size;
490 bitfield32_t update_option_flags;
491 uint8_t comp_ver_str_type;
492 uint8_t comp_ver_str_len;
493} __attribute__((packed));
494
495/** @struct pldm_update_component_resp
496 *
497 * Structure representing UpdateComponent response
498 */
499struct pldm_update_component_resp {
500 uint8_t completion_code;
501 uint8_t comp_compatibility_resp;
502 uint8_t comp_compatibility_resp_code;
503 bitfield32_t update_option_flags_enabled;
504 uint16_t time_before_req_fw_data;
505} __attribute__((packed));
506
507/** @struct pldm_request_firmware_data_req
508 *
509 * Structure representing RequestFirmwareData request.
510 */
511struct pldm_request_firmware_data_req {
512 uint32_t offset;
513 uint32_t length;
514} __attribute__((packed));
515
516/** @struct pldm_apply_complete_req
517 *
518 * Structure representing ApplyComplete request.
519 */
520struct pldm_apply_complete_req {
521 uint8_t apply_result;
522 bitfield16_t comp_activation_methods_modification;
523} __attribute__((packed));
524
525/** @struct pldm_activate_firmware_req
526 *
527 * Structure representing ActivateFirmware request
528 */
529struct pldm_activate_firmware_req {
530 bool8_t self_contained_activation_req;
531} __attribute__((packed));
532
533/** @struct activate_firmware_resp
534 *
535 * Structure representing Activate Firmware response
536 */
537struct pldm_activate_firmware_resp {
538 uint8_t completion_code;
539 uint16_t estimated_time_activation;
540} __attribute__((packed));
541
542/** @struct pldm_get_status_resp
543 *
544 * Structure representing GetStatus response.
545 */
546struct pldm_get_status_resp {
547 uint8_t completion_code;
548 uint8_t current_state;
549 uint8_t previous_state;
550 uint8_t aux_state;
551 uint8_t aux_state_status;
552 uint8_t progress_percent;
553 uint8_t reason_code;
554 bitfield32_t update_option_flags_enabled;
555} __attribute__((packed));
556
557/** @struct pldm_cancel_update_resp
558 *
559 * Structure representing CancelUpdate response.
560 */
561struct pldm_cancel_update_resp {
562 uint8_t completion_code;
563 bool8_t non_functioning_component_indication;
564 uint64_t non_functioning_component_bitmap;
565} __attribute__((packed));
566
567/** @brief Decode the PLDM package header information
568 *
569 * @param[in] data - pointer to package header information
570 * @param[in] length - available length in the firmware update package
571 * @param[out] package_header_info - pointer to fixed part of PLDM package
572 * header information
573 * @param[out] package_version_str - pointer to package version string
574 *
575 * @return pldm_completion_codes
576 */
577int decode_pldm_package_header_info(
578 const uint8_t *data, size_t length,
579 struct pldm_package_header_information *package_header_info,
580 struct variable_field *package_version_str);
581
582/** @brief Decode individual firmware device ID record
583 *
584 * @param[in] data - pointer to firmware device ID record
585 * @param[in] length - available length in the firmware update package
586 * @param[in] component_bitmap_bit_length - ComponentBitmapBitLengthfield
587 * parsed from the package header info
588 * @param[out] fw_device_id_record - pointer to fixed part of firmware device
589 * id record
590 * @param[out] applicable_components - pointer to ApplicableComponents
591 * @param[out] comp_image_set_version_str - pointer to
592 * ComponentImageSetVersionString
593 * @param[out] record_descriptors - pointer to RecordDescriptors
594 * @param[out] fw_device_pkg_data - pointer to FirmwareDevicePackageData
595 *
596 * @return pldm_completion_codes
597 */
598int decode_firmware_device_id_record(
599 const uint8_t *data, size_t length, uint16_t component_bitmap_bit_length,
600 struct pldm_firmware_device_id_record *fw_device_id_record,
601 struct variable_field *applicable_components,
602 struct variable_field *comp_image_set_version_str,
603 struct variable_field *record_descriptors,
604 struct variable_field *fw_device_pkg_data);
605
606/** @brief Decode the record descriptor entries in the firmware update package
607 * and the Descriptors in the QueryDeviceIDentifiers command
608 *
609 * @param[in] data - pointer to descriptor entry
610 * @param[in] length - remaining length of the descriptor data
611 * @param[out] descriptor_type - pointer to descriptor type
612 * @param[out] descriptor_data - pointer to descriptor data
613 *
614 * @return pldm_completion_codes
615 */
616int decode_descriptor_type_length_value(const uint8_t *data, size_t length,
617 uint16_t *descriptor_type,
618 struct variable_field *descriptor_data);
619
620/** @brief Decode the vendor defined descriptor value
621 *
622 * @param[in] data - pointer to vendor defined descriptor value
623 * @param[in] length - length of the vendor defined descriptor value
624 * @param[out] descriptor_title_str_type - pointer to vendor defined descriptor
625 * title string type
626 * @param[out] descriptor_title_str - pointer to vendor defined descriptor
627 * title string
628 * @param[out] descriptor_data - pointer to vendor defined descriptor data
629 *
630 * @return pldm_completion_codes
631 */
632int decode_vendor_defined_descriptor_value(
633 const uint8_t *data, size_t length, uint8_t *descriptor_title_str_type,
634 struct variable_field *descriptor_title_str,
635 struct variable_field *descriptor_data);
636
637/** @brief Decode individual component image information
638 *
639 * @param[in] data - pointer to component image information
640 * @param[in] length - available length in the firmware update package
641 * @param[out] pldm_comp_image_info - pointer to fixed part of component image
642 * information
643 * @param[out] comp_version_str - pointer to component version string
644 *
645 * @return pldm_completion_codes
646 */
647int decode_pldm_comp_image_info(
648 const uint8_t *data, size_t length,
649 struct pldm_component_image_information *pldm_comp_image_info,
650 struct variable_field *comp_version_str);
651
652/** @brief Create a PLDM request message for QueryDeviceIdentifiers
653 *
654 * @param[in] instance_id - Message's instance id
655 * @param[in] payload_length - Length of the request message payload
656 * @param[in,out] msg - Message will be written to this
657 *
658 * @return pldm_completion_codes
659 *
660 * @note Caller is responsible for memory alloc and dealloc of param
661 * 'msg.payload'
662 */
663int encode_query_device_identifiers_req(uint8_t instance_id,
664 size_t payload_length,
665 struct pldm_msg *msg);
666
667/** @brief Decode QueryDeviceIdentifiers response message
668 *
669 * @param[in] msg - Response message
670 * @param[in] payload_length - Length of response message payload
671 * @param[out] completion_code - Pointer to response msg's PLDM completion code
672 * @param[out] device_identifiers_len - Pointer to device identifiers length
673 * @param[out] descriptor_count - Pointer to descriptor count
674 * @param[out] descriptor_data - Pointer to descriptor data
675 *
676 * @return pldm_completion_codes
677 */
678int decode_query_device_identifiers_resp(const struct pldm_msg *msg,
679 size_t payload_length,
680 uint8_t *completion_code,
681 uint32_t *device_identifiers_len,
682 uint8_t *descriptor_count,
683 uint8_t **descriptor_data);
684
685/** @brief Create a PLDM request message for GetFirmwareParameters
686 *
687 * @param[in] instance_id - Message's instance id
688 * @param[in] payload_length - Length of the request message payload
689 * @param[in,out] msg - Message will be written to this
690 *
691 * @return pldm_completion_codes
692 *
693 * @note Caller is responsible for memory alloc and dealloc of param
694 * 'msg.payload'
695 */
696int encode_get_firmware_parameters_req(uint8_t instance_id,
697 size_t payload_length,
698 struct pldm_msg *msg);
699
700/** @brief Decode GetFirmwareParameters response
701 *
702 * @param[in] msg - Response message
703 * @param[in] payload_length - Length of response message payload
704 * @param[out] resp_data - Pointer to get firmware parameters response
705 * @param[out] active_comp_image_set_ver_str - Pointer to active component
706 * image set version string
707 * @param[out] pending_comp_image_set_ver_str - Pointer to pending component
708 * image set version string
709 * @param[out] comp_parameter_table - Pointer to component parameter table
710 *
711 * @return pldm_completion_codes
712 */
713int decode_get_firmware_parameters_resp(
714 const struct pldm_msg *msg, size_t payload_length,
715 struct pldm_get_firmware_parameters_resp *resp_data,
716 struct variable_field *active_comp_image_set_ver_str,
717 struct variable_field *pending_comp_image_set_ver_str,
718 struct variable_field *comp_parameter_table);
719
720/** @brief Decode component entries in the component parameter table which is
721 * part of the response of GetFirmwareParameters command
722 *
723 * @param[in] data - Component entry
724 * @param[in] length - Length of component entry
725 * @param[out] component_data - Pointer to component parameter table
726 * @param[out] active_comp_ver_str - Pointer to active component version string
727 * @param[out] pending_comp_ver_str - Pointer to pending component version
728 * string
729 *
730 * @return pldm_completion_codes
731 */
732int decode_get_firmware_parameters_resp_comp_entry(
733 const uint8_t *data, size_t length,
734 struct pldm_component_parameter_entry *component_data,
735 struct variable_field *active_comp_ver_str,
736 struct variable_field *pending_comp_ver_str);
737
738/** @brief Create PLDM request message for RequestUpdate
739 *
740 * @param[in] instance_id - Message's instance id
741 * @param[in] max_transfer_size - Maximum size of the variable payload allowed
742 * to be requested via RequestFirmwareData
743 * command
744 * @param[in] num_of_comp - Total number of components that will be passed to
745 * the FD during the update
746 * @param[in] max_outstanding_transfer_req - Total number of outstanding
747 * RequestFirmwareData
748 * commands that can be sent by the FD
749 * @param[in] pkg_data_len - Value of the FirmwareDevicePackageDataLength field
750 * present in firmware package header
751 * @param[in] comp_image_set_ver_str_type - StringType of
752 * ComponentImageSetVersionString
753 * @param[in] comp_image_set_ver_str_len - The length of the
754 * ComponentImageSetVersionString
755 * @param[in] comp_img_set_ver_str - Component Image Set version information
756 * @param[in,out] msg - Message will be written to this
757 * @param[in] payload_length - Length of request message payload
758 *
759 * @return pldm_completion_codes
760 *
761 * @note Caller is responsible for memory alloc and dealloc of param
762 * 'msg.payload'
763 */
764int encode_request_update_req(uint8_t instance_id, uint32_t max_transfer_size,
765 uint16_t num_of_comp,
766 uint8_t max_outstanding_transfer_req,
767 uint16_t pkg_data_len,
768 uint8_t comp_image_set_ver_str_type,
769 uint8_t comp_image_set_ver_str_len,
770 const struct variable_field *comp_img_set_ver_str,
771 struct pldm_msg *msg, size_t payload_length);
772
773/** @brief Decode a RequestUpdate response message
774 *
775 * @param[in] msg - Response message
776 * @param[in] payload_length - Length of response message payload
777 * @param[out] completion_code - Pointer to hold the completion code
778 * @param[out] fd_meta_data_len - Pointer to hold the length of FD metadata
779 * @param[out] fd_will_send_pkg_data - Pointer to hold information whether FD
780 * will send GetPackageData command
781 * @return pldm_completion_codes
782 */
783int decode_request_update_resp(const struct pldm_msg *msg,
784 size_t payload_length, uint8_t *completion_code,
785 uint16_t *fd_meta_data_len,
786 uint8_t *fd_will_send_pkg_data);
787
788/** @brief Create PLDM request message for PassComponentTable
789 *
790 * @param[in] instance_id - Message's instance id
791 * @param[in] transfer_flag - TransferFlag
792 * @param[in] comp_classification - ComponentClassification
793 * @param[in] comp_identifier - ComponentIdentifier
794 * @param[in] comp_classification_index - ComponentClassificationIndex
795 * @param[in] comp_comparison_stamp - ComponentComparisonStamp
796 * @param[in] comp_ver_str_type - ComponentVersionStringType
797 * @param[in] comp_ver_str_len - ComponentVersionStringLength
798 * @param[in] comp_ver_str - ComponentVersionString
799 * @param[in,out] msg - Message will be written to this
800 * @param[in] payload_length - Length of request message payload
801 * information
802 *
803 * @return pldm_completion_codes
804 *
805 * @note Caller is responsible for memory alloc and dealloc of param
806 * 'msg.payload'
807 */
808int encode_pass_component_table_req(
809 uint8_t instance_id, uint8_t transfer_flag, uint16_t comp_classification,
810 uint16_t comp_identifier, uint8_t comp_classification_index,
811 uint32_t comp_comparison_stamp, uint8_t comp_ver_str_type,
812 uint8_t comp_ver_str_len, const struct variable_field *comp_ver_str,
813 struct pldm_msg *msg, size_t payload_length);
814
815/** @brief Decode PassComponentTable response message
816 *
817 * @param[in] msg - Response message
818 * @param[in] payload_length - Length of response message payload
819 * @param[out] completion_code - Pointer to hold completion code
820 * @param[out] comp_resp - Pointer to hold component response
821 * @param[out] comp_resp_code - Pointer to hold component response code
822 *
823 * @return pldm_completion_codes
824 */
825int decode_pass_component_table_resp(const struct pldm_msg *msg,
826 size_t payload_length,
827 uint8_t *completion_code,
828 uint8_t *comp_resp,
829 uint8_t *comp_resp_code);
830
831/** @brief Create PLDM request message for UpdateComponent
832 *
833 * @param[in] instance_id - Message's instance id
834 * @param[in] comp_classification - ComponentClassification
835 * @param[in] comp_identifier - ComponentIdentifier
836 * @param[in] comp_classification_index - ComponentClassificationIndex
837 * @param[in] comp_comparison_stamp - ComponentComparisonStamp
838 * @param[in] comp_image_size - ComponentImageSize
839 * @param[in] update_option_flags - UpdateOptionFlags
840 * @param[in] comp_ver_str_type - ComponentVersionStringType
841 * @param[in] comp_ver_str_len - ComponentVersionStringLength
842 * @param[in] comp_ver_str - ComponentVersionString
843 * @param[in,out] msg - Message will be written to this
844 * @param[in] payload_length - Length of request message payload
845 * information
846 *
847 * @return pldm_completion_codes
848 *
849 * @note Caller is responsible for memory alloc and dealloc of param
850 * 'msg.payload'
851 */
852int encode_update_component_req(
853 uint8_t instance_id, uint16_t comp_classification, uint16_t comp_identifier,
854 uint8_t comp_classification_index, uint32_t comp_comparison_stamp,
855 uint32_t comp_image_size, bitfield32_t update_option_flags,
856 uint8_t comp_ver_str_type, uint8_t comp_ver_str_len,
857 const struct variable_field *comp_ver_str, struct pldm_msg *msg,
858 size_t payload_length);
859
860/** @brief Decode UpdateComponent response message
861 *
862 * @param[in] msg - Response message
863 * @param[in] payload_length - Length of response message payload
864 * @param[out] completion_code - Pointer to hold completion code
865 * @param[out] comp_compatibility_resp - Pointer to hold component
866 * compatibility response
867 * @param[out] comp_compatibility_resp_code - Pointer to hold component
868 * compatibility response code
869 * @param[out] update_option_flags_enabled - Pointer to hold
870 * UpdateOptionsFlagEnabled
871 * @param[out] time_before_req_fw_data - Pointer to hold the estimated time
872 * before sending RequestFirmwareData
873 *
874 * @return pldm_completion_codes
875 */
876int decode_update_component_resp(const struct pldm_msg *msg,
877 size_t payload_length,
878 uint8_t *completion_code,
879 uint8_t *comp_compatibility_resp,
880 uint8_t *comp_compatibility_resp_code,
881 bitfield32_t *update_option_flags_enabled,
882 uint16_t *time_before_req_fw_data);
883
884/** @brief Decode RequestFirmwareData request message
885 *
886 * @param[in] msg - Request message
887 * @param[in] payload_length - Length of request message payload
888 * @param[out] offset - Pointer to hold offset
889 * @param[out] length - Pointer to hold the size of the component image
890 * segment requested by the FD/FDP
891 *
892 * @return pldm_completion_codes
893 */
894int decode_request_firmware_data_req(const struct pldm_msg *msg,
895 size_t payload_length, uint32_t *offset,
896 uint32_t *length);
897
898/** @brief Create PLDM response message for RequestFirmwareData
899 *
900 * The ComponentImagePortion is not encoded in the PLDM response message
901 * by encode_request_firmware_data_resp to avoid an additional copy. Populating
902 * ComponentImagePortion in the PLDM response message is handled by the user
903 * of this API. The payload_length validation considers only the
904 * CompletionCode.
905 *
906 * @param[in] instance_id - Message's instance id
907 * @param[in] completion_code - CompletionCode
908 * @param[in,out] msg - Message will be written to this
909 * @param[in] payload_length - Length of response message payload
910 *
911 * @return pldm_completion_codes
912 *
913 * @note Caller is responsible for memory alloc and dealloc of param
914 * 'msg.payload'
915 */
916int encode_request_firmware_data_resp(uint8_t instance_id,
917 uint8_t completion_code,
918 struct pldm_msg *msg,
919 size_t payload_length);
920
921/** @brief Decode TransferComplete request message
922 *
923 * @param[in] msg - Request message
924 * @param[in] payload_length - Length of request message payload
925 * @param[out] transfer_result - Pointer to hold TransferResult
926 *
927 * @return pldm_completion_codes
928 */
929int decode_transfer_complete_req(const struct pldm_msg *msg,
930 size_t payload_length,
931 uint8_t *transfer_result);
932
933/** @brief Create PLDM response message for TransferComplete
934 *
935 * @param[in] instance_id - Message's instance id
936 * @param[in] completion_code - CompletionCode
937 * @param[in,out] msg - Message will be written to this
938 * @param[in] payload_length - Length of response message payload
939 *
940 * @return pldm_completion_codes
941 *
942 * @note Caller is responsible for memory alloc and dealloc of param
943 * 'msg.payload'
944 */
945int encode_transfer_complete_resp(uint8_t instance_id, uint8_t completion_code,
946 struct pldm_msg *msg, size_t payload_length);
947
948/** @brief Decode VerifyComplete request message
949 *
950 * @param[in] msg - Request message
951 * @param[in] payload_length - Length of request message payload
952 * @param[in] verify_result - Pointer to hold VerifyResult
953 *
954 * @return pldm_completion_codes
955 */
956int decode_verify_complete_req(const struct pldm_msg *msg,
957 size_t payload_length, uint8_t *verify_result);
958
959/** @brief Create PLDM response message for VerifyComplete
960 *
961 * @param[in] instance_id - Message's instance id
962 * @param[in] completion_code - CompletionCode
963 * @param[in,out] msg - Message will be written to this
964 * @param[in] payload_length - Length of response message payload
965 *
966 * @return pldm_completion_codes
967 *
968 * @note Caller is responsible for memory alloc and dealloc of param
969 * 'msg.payload'
970 */
971int encode_verify_complete_resp(uint8_t instance_id, uint8_t completion_code,
972 struct pldm_msg *msg, size_t payload_length);
973
974/** @brief Decode ApplyComplete request message
975 *
976 * @param[in] msg - Request message
977 * @param[in] payload_length - Length of request message payload
978 * @param[in] apply_result - Pointer to hold ApplyResult
979 * @param[in] comp_activation_methods_modification - Pointer to hold the
980 * ComponentActivationMethodsModification
981 *
982 * @return pldm_completion_codes
983 */
984int decode_apply_complete_req(
985 const struct pldm_msg *msg, size_t payload_length, uint8_t *apply_result,
986 bitfield16_t *comp_activation_methods_modification);
987
988/** @brief Create PLDM response message for ApplyComplete
989 *
990 * @param[in] instance_id - Message's instance id
991 * @param[in] completion_code - CompletionCode
992 * @param[in,out] msg - Message will be written to this
993 * @param[in] payload_length - Length of response message payload
994 *
995 * @return pldm_completion_codes
996 *
997 * @note Caller is responsible for memory alloc and dealloc of param
998 * 'msg.payload'
999 */
1000int encode_apply_complete_resp(uint8_t instance_id, uint8_t completion_code,
1001 struct pldm_msg *msg, size_t payload_length);
1002
1003/** @brief Create PLDM request message for ActivateFirmware
1004 *
1005 * @param[in] instance_id - Message's instance id
1006 * @param[in] self_contained_activation_req SelfContainedActivationRequest
1007 * @param[in,out] msg - Message will be written to this
1008 * @param[in] payload_length - Length of request message payload
1009 *
1010 * @return pldm_completion_codes
1011 *
1012 * @note Caller is responsible for memory alloc and dealloc of param
1013 * 'msg.payload'
1014 */
1015int encode_activate_firmware_req(uint8_t instance_id,
1016 bool8_t self_contained_activation_req,
1017 struct pldm_msg *msg, size_t payload_length);
1018
1019/** @brief Decode ActivateFirmware response message
1020 *
1021 * @param[in] msg - Response message
1022 * @param[in] payload_length - Length of response message payload
1023 * @param[out] completion_code - Pointer to hold CompletionCode
1024 * @param[out] estimated_time_activation - Pointer to hold
1025 * EstimatedTimeForSelfContainedActivation
1026 *
1027 * @return pldm_completion_codes
1028 */
1029int decode_activate_firmware_resp(const struct pldm_msg *msg,
1030 size_t payload_length,
1031 uint8_t *completion_code,
1032 uint16_t *estimated_time_activation);
1033
1034/** @brief Create PLDM request message for GetStatus
1035 *
1036 * @param[in] instance_id - Message's instance id
1037 * @param[in,out] msg - Message will be written to this
1038 * @param[in] payload_length - Length of request message payload
1039 *
1040 * @return pldm_completion_codes
1041 *
1042 * @note Caller is responsible for memory alloc and dealloc of param
1043 * 'msg.payload'
1044 */
1045int encode_get_status_req(uint8_t instance_id, struct pldm_msg *msg,
1046 size_t payload_length);
1047
1048/** @brief Decode GetStatus response message
1049 *
1050 * @param[in] msg - Response message
1051 * @param[in] payload_length - Length of response message payload
1052 * @param[out] completion_code - Pointer to completion code
1053 * @param[out] current_state - Pointer to current state machine state
1054 * @param[out] previous_state - Pointer to previous different state machine
1055 * state
1056 * @param[out] aux_state - Pointer to current operation state of FD/FDP
1057 * @param[out] aux_state_status - Pointer to aux state status
1058 * @param[out] progress_percent - Pointer to progress percentage
1059 * @param[out] reason_code - Pointer to reason for entering current state
1060 * @param[out] update_option_flags_enabled - Pointer to update option flags
1061 * enabled
1062 *
1063 * @return pldm_completion_codes
1064 */
1065int decode_get_status_resp(const struct pldm_msg *msg, size_t payload_length,
1066 uint8_t *completion_code, uint8_t *current_state,
1067 uint8_t *previous_state, uint8_t *aux_state,
1068 uint8_t *aux_state_status, uint8_t *progress_percent,
1069 uint8_t *reason_code,
1070 bitfield32_t *update_option_flags_enabled);
1071
1072/** @brief Create PLDM request message for CancelUpdateComponent
1073 *
1074 * @param[in] instance_id - Message's instance id
1075 * @param[in,out] msg - Message will be written to this
1076 * @param[in] payload_length - Length of request message payload
1077 *
1078 * @return pldm_completion_codes
1079 *
1080 * @note Caller is responsible for memory alloc and dealloc of param
1081 * 'msg.payload'
1082 */
1083int encode_cancel_update_component_req(uint8_t instance_id,
1084 struct pldm_msg *msg,
1085 size_t payload_length);
1086
1087/** @brief Decode CancelUpdateComponent response message
1088 *
1089 * @param[in] msg - Response message
1090 * @param[in] payload_length - Length of response message payload
1091 * @param[out] completion_code - Pointer to the completion code
1092 *
1093 * @return pldm_completion_codes
1094 */
1095int decode_cancel_update_component_resp(const struct pldm_msg *msg,
1096 size_t payload_length,
1097 uint8_t *completion_code);
1098
1099/** @brief Create PLDM request message for CancelUpdate
1100 *
1101 * @param[in] instance_id - Message's instance id
1102 * @param[in,out] msg - Message will be written to this
1103 * @param[in] payload_length - Length of request message payload
1104 *
1105 * @return pldm_completion_codes
1106 *
1107 * @note Caller is responsible for memory alloc and dealloc of param
1108 * 'msg.payload'
1109 */
1110int encode_cancel_update_req(uint8_t instance_id, struct pldm_msg *msg,
1111 size_t payload_length);
1112
1113/** @brief Decode CancelUpdate response message
1114 *
1115 * @param[in] msg - Response message
1116 * @param[in] payload_length - Length of response message payload
1117 * @param[out] completion_code - Pointer to completion code
1118 * @param[out] non_functioning_component_indication - Pointer to non
1119 functioning
1120 * component indication
1121 * @param[out] non_functioning_component_bitmap - Pointer to non
1122 functioning
1123 * component bitmap
1124 *
1125 * @return pldm_completion_codes
1126 */
1127int decode_cancel_update_resp(const struct pldm_msg *msg, size_t payload_length,
1128 uint8_t *completion_code,
1129 bool8_t *non_functioning_component_indication,
1130 bitfield64_t *non_functioning_component_bitmap);
1131
1132#ifdef __cplusplus
1133}
1134#endif
1135
1136#endif // End of FW_UPDATE_H