blob: fe89b410d441f1a4fad8241b5fdbf3e43f144f08 [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
Andrew Jeffery37dd6a32023-05-12 16:04:06 +093015#define PLDM_FWUP_COMPONENT_BITMAP_MULTIPLE 8
Andrew Jeffery9c766792022-08-10 23:12:49 +093016#define PLDM_FWUP_INVALID_COMPONENT_COMPARISON_TIMESTAMP 0xFFFFFFFF
Andrew Jeffery37dd6a32023-05-12 16:04:06 +093017#define PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES 0
Andrew Jeffery9c766792022-08-10 23:12:49 +093018/** @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 */
Andrew Jeffery37dd6a32023-05-12 16:04:06 +093021#define PLDM_FWUP_DEVICE_DESCRIPTOR_MIN_LEN 5
Andrew Jeffery9c766792022-08-10 23:12:49 +093022#define PLDM_GET_FIRMWARE_PARAMETERS_REQ_BYTES 0
Andrew Jeffery37dd6a32023-05-12 16:04:06 +093023#define PLDM_FWUP_BASELINE_TRANSFER_SIZE 32
24#define PLDM_FWUP_MIN_OUTSTANDING_REQ 1
25#define PLDM_GET_STATUS_REQ_BYTES 0
Andrew Jeffery9c766792022-08-10 23:12:49 +093026/* Maximum progress percentage value*/
Andrew Jeffery37dd6a32023-05-12 16:04:06 +093027#define PLDM_FWUP_MAX_PROGRESS_PERCENT 0x65
Andrew Jeffery9c766792022-08-10 23:12:49 +093028#define PLDM_CANCEL_UPDATE_COMPONENT_REQ_BYTES 0
Andrew Jeffery37dd6a32023-05-12 16:04:06 +093029#define PLDM_CANCEL_UPDATE_REQ_BYTES 0
Andrew Jeffery9c766792022-08-10 23:12:49 +093030
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(
Andrew Jeffery37dd6a32023-05-12 16:04:06 +0930578 const uint8_t *data, size_t length,
579 struct pldm_package_header_information *package_header_info,
580 struct variable_field *package_version_str);
Andrew Jeffery9c766792022-08-10 23:12:49 +0930581
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(
Andrew Jeffery37dd6a32023-05-12 16:04:06 +0930599 const uint8_t *data, size_t length,
600 uint16_t component_bitmap_bit_length,
601 struct pldm_firmware_device_id_record *fw_device_id_record,
602 struct variable_field *applicable_components,
603 struct variable_field *comp_image_set_version_str,
604 struct variable_field *record_descriptors,
605 struct variable_field *fw_device_pkg_data);
Andrew Jeffery9c766792022-08-10 23:12:49 +0930606
607/** @brief Decode the record descriptor entries in the firmware update package
608 * and the Descriptors in the QueryDeviceIDentifiers command
609 *
610 * @param[in] data - pointer to descriptor entry
611 * @param[in] length - remaining length of the descriptor data
612 * @param[out] descriptor_type - pointer to descriptor type
613 * @param[out] descriptor_data - pointer to descriptor data
614 *
615 * @return pldm_completion_codes
616 */
617int decode_descriptor_type_length_value(const uint8_t *data, size_t length,
618 uint16_t *descriptor_type,
619 struct variable_field *descriptor_data);
620
621/** @brief Decode the vendor defined descriptor value
622 *
623 * @param[in] data - pointer to vendor defined descriptor value
624 * @param[in] length - length of the vendor defined descriptor value
625 * @param[out] descriptor_title_str_type - pointer to vendor defined descriptor
626 * title string type
627 * @param[out] descriptor_title_str - pointer to vendor defined descriptor
628 * title string
629 * @param[out] descriptor_data - pointer to vendor defined descriptor data
630 *
631 * @return pldm_completion_codes
632 */
633int decode_vendor_defined_descriptor_value(
Andrew Jeffery37dd6a32023-05-12 16:04:06 +0930634 const uint8_t *data, size_t length, uint8_t *descriptor_title_str_type,
635 struct variable_field *descriptor_title_str,
636 struct variable_field *descriptor_data);
Andrew Jeffery9c766792022-08-10 23:12:49 +0930637
638/** @brief Decode individual component image information
639 *
640 * @param[in] data - pointer to component image information
641 * @param[in] length - available length in the firmware update package
642 * @param[out] pldm_comp_image_info - pointer to fixed part of component image
643 * information
644 * @param[out] comp_version_str - pointer to component version string
645 *
646 * @return pldm_completion_codes
647 */
648int decode_pldm_comp_image_info(
Andrew Jeffery37dd6a32023-05-12 16:04:06 +0930649 const uint8_t *data, size_t length,
650 struct pldm_component_image_information *pldm_comp_image_info,
651 struct variable_field *comp_version_str);
Andrew Jeffery9c766792022-08-10 23:12:49 +0930652
653/** @brief Create a PLDM request message for QueryDeviceIdentifiers
654 *
655 * @param[in] instance_id - Message's instance id
656 * @param[in] payload_length - Length of the request message payload
657 * @param[in,out] msg - Message will be written to this
658 *
659 * @return pldm_completion_codes
660 *
661 * @note Caller is responsible for memory alloc and dealloc of param
662 * 'msg.payload'
663 */
664int encode_query_device_identifiers_req(uint8_t instance_id,
665 size_t payload_length,
666 struct pldm_msg *msg);
667
668/** @brief Decode QueryDeviceIdentifiers response message
669 *
670 * @param[in] msg - Response message
671 * @param[in] payload_length - Length of response message payload
672 * @param[out] completion_code - Pointer to response msg's PLDM completion code
673 * @param[out] device_identifiers_len - Pointer to device identifiers length
674 * @param[out] descriptor_count - Pointer to descriptor count
675 * @param[out] descriptor_data - Pointer to descriptor data
676 *
677 * @return pldm_completion_codes
678 */
679int decode_query_device_identifiers_resp(const struct pldm_msg *msg,
680 size_t payload_length,
681 uint8_t *completion_code,
682 uint32_t *device_identifiers_len,
683 uint8_t *descriptor_count,
684 uint8_t **descriptor_data);
685
686/** @brief Create a PLDM request message for GetFirmwareParameters
687 *
688 * @param[in] instance_id - Message's instance id
689 * @param[in] payload_length - Length of the request message payload
690 * @param[in,out] msg - Message will be written to this
691 *
692 * @return pldm_completion_codes
693 *
694 * @note Caller is responsible for memory alloc and dealloc of param
695 * 'msg.payload'
696 */
697int encode_get_firmware_parameters_req(uint8_t instance_id,
698 size_t payload_length,
699 struct pldm_msg *msg);
700
701/** @brief Decode GetFirmwareParameters response
702 *
703 * @param[in] msg - Response message
704 * @param[in] payload_length - Length of response message payload
705 * @param[out] resp_data - Pointer to get firmware parameters response
706 * @param[out] active_comp_image_set_ver_str - Pointer to active component
707 * image set version string
708 * @param[out] pending_comp_image_set_ver_str - Pointer to pending component
709 * image set version string
710 * @param[out] comp_parameter_table - Pointer to component parameter table
711 *
712 * @return pldm_completion_codes
713 */
714int decode_get_firmware_parameters_resp(
Andrew Jeffery37dd6a32023-05-12 16:04:06 +0930715 const struct pldm_msg *msg, size_t payload_length,
716 struct pldm_get_firmware_parameters_resp *resp_data,
717 struct variable_field *active_comp_image_set_ver_str,
718 struct variable_field *pending_comp_image_set_ver_str,
719 struct variable_field *comp_parameter_table);
Andrew Jeffery9c766792022-08-10 23:12:49 +0930720
721/** @brief Decode component entries in the component parameter table which is
722 * part of the response of GetFirmwareParameters command
723 *
724 * @param[in] data - Component entry
725 * @param[in] length - Length of component entry
726 * @param[out] component_data - Pointer to component parameter table
727 * @param[out] active_comp_ver_str - Pointer to active component version string
728 * @param[out] pending_comp_ver_str - Pointer to pending component version
729 * string
730 *
731 * @return pldm_completion_codes
732 */
733int decode_get_firmware_parameters_resp_comp_entry(
Andrew Jeffery37dd6a32023-05-12 16:04:06 +0930734 const uint8_t *data, size_t length,
735 struct pldm_component_parameter_entry *component_data,
736 struct variable_field *active_comp_ver_str,
737 struct variable_field *pending_comp_ver_str);
Andrew Jeffery9c766792022-08-10 23:12:49 +0930738
739/** @brief Create PLDM request message for RequestUpdate
740 *
741 * @param[in] instance_id - Message's instance id
742 * @param[in] max_transfer_size - Maximum size of the variable payload allowed
743 * to be requested via RequestFirmwareData
744 * command
745 * @param[in] num_of_comp - Total number of components that will be passed to
746 * the FD during the update
747 * @param[in] max_outstanding_transfer_req - Total number of outstanding
748 * RequestFirmwareData
749 * commands that can be sent by the FD
750 * @param[in] pkg_data_len - Value of the FirmwareDevicePackageDataLength field
751 * present in firmware package header
752 * @param[in] comp_image_set_ver_str_type - StringType of
753 * ComponentImageSetVersionString
754 * @param[in] comp_image_set_ver_str_len - The length of the
755 * ComponentImageSetVersionString
756 * @param[in] comp_img_set_ver_str - Component Image Set version information
757 * @param[in,out] msg - Message will be written to this
758 * @param[in] payload_length - Length of request message payload
759 *
760 * @return pldm_completion_codes
761 *
762 * @note Caller is responsible for memory alloc and dealloc of param
763 * 'msg.payload'
764 */
765int encode_request_update_req(uint8_t instance_id, uint32_t max_transfer_size,
766 uint16_t num_of_comp,
767 uint8_t max_outstanding_transfer_req,
768 uint16_t pkg_data_len,
769 uint8_t comp_image_set_ver_str_type,
770 uint8_t comp_image_set_ver_str_len,
771 const struct variable_field *comp_img_set_ver_str,
772 struct pldm_msg *msg, size_t payload_length);
773
774/** @brief Decode a RequestUpdate response message
775 *
776 * @param[in] msg - Response message
777 * @param[in] payload_length - Length of response message payload
778 * @param[out] completion_code - Pointer to hold the completion code
779 * @param[out] fd_meta_data_len - Pointer to hold the length of FD metadata
780 * @param[out] fd_will_send_pkg_data - Pointer to hold information whether FD
781 * will send GetPackageData command
782 * @return pldm_completion_codes
783 */
784int decode_request_update_resp(const struct pldm_msg *msg,
785 size_t payload_length, uint8_t *completion_code,
786 uint16_t *fd_meta_data_len,
787 uint8_t *fd_will_send_pkg_data);
788
789/** @brief Create PLDM request message for PassComponentTable
790 *
791 * @param[in] instance_id - Message's instance id
792 * @param[in] transfer_flag - TransferFlag
793 * @param[in] comp_classification - ComponentClassification
794 * @param[in] comp_identifier - ComponentIdentifier
795 * @param[in] comp_classification_index - ComponentClassificationIndex
796 * @param[in] comp_comparison_stamp - ComponentComparisonStamp
797 * @param[in] comp_ver_str_type - ComponentVersionStringType
798 * @param[in] comp_ver_str_len - ComponentVersionStringLength
799 * @param[in] comp_ver_str - ComponentVersionString
800 * @param[in,out] msg - Message will be written to this
801 * @param[in] payload_length - Length of request message payload
802 * information
803 *
804 * @return pldm_completion_codes
805 *
806 * @note Caller is responsible for memory alloc and dealloc of param
807 * 'msg.payload'
808 */
809int encode_pass_component_table_req(
Andrew Jeffery37dd6a32023-05-12 16:04:06 +0930810 uint8_t instance_id, uint8_t transfer_flag,
811 uint16_t comp_classification, uint16_t comp_identifier,
812 uint8_t comp_classification_index, uint32_t comp_comparison_stamp,
813 uint8_t comp_ver_str_type, uint8_t comp_ver_str_len,
814 const struct variable_field *comp_ver_str, struct pldm_msg *msg,
815 size_t payload_length);
Andrew Jeffery9c766792022-08-10 23:12:49 +0930816
817/** @brief Decode PassComponentTable response message
818 *
819 * @param[in] msg - Response message
820 * @param[in] payload_length - Length of response message payload
821 * @param[out] completion_code - Pointer to hold completion code
822 * @param[out] comp_resp - Pointer to hold component response
823 * @param[out] comp_resp_code - Pointer to hold component response code
824 *
825 * @return pldm_completion_codes
826 */
827int decode_pass_component_table_resp(const struct pldm_msg *msg,
828 size_t payload_length,
829 uint8_t *completion_code,
830 uint8_t *comp_resp,
831 uint8_t *comp_resp_code);
832
833/** @brief Create PLDM request message for UpdateComponent
834 *
835 * @param[in] instance_id - Message's instance id
836 * @param[in] comp_classification - ComponentClassification
837 * @param[in] comp_identifier - ComponentIdentifier
838 * @param[in] comp_classification_index - ComponentClassificationIndex
839 * @param[in] comp_comparison_stamp - ComponentComparisonStamp
840 * @param[in] comp_image_size - ComponentImageSize
841 * @param[in] update_option_flags - UpdateOptionFlags
842 * @param[in] comp_ver_str_type - ComponentVersionStringType
843 * @param[in] comp_ver_str_len - ComponentVersionStringLength
844 * @param[in] comp_ver_str - ComponentVersionString
845 * @param[in,out] msg - Message will be written to this
846 * @param[in] payload_length - Length of request message payload
847 * information
848 *
849 * @return pldm_completion_codes
850 *
851 * @note Caller is responsible for memory alloc and dealloc of param
852 * 'msg.payload'
853 */
854int encode_update_component_req(
Andrew Jeffery37dd6a32023-05-12 16:04:06 +0930855 uint8_t instance_id, uint16_t comp_classification,
856 uint16_t comp_identifier, uint8_t comp_classification_index,
857 uint32_t comp_comparison_stamp, uint32_t comp_image_size,
858 bitfield32_t update_option_flags, uint8_t comp_ver_str_type,
859 uint8_t comp_ver_str_len, const struct variable_field *comp_ver_str,
860 struct pldm_msg *msg, size_t payload_length);
Andrew Jeffery9c766792022-08-10 23:12:49 +0930861
862/** @brief Decode UpdateComponent response message
863 *
864 * @param[in] msg - Response message
865 * @param[in] payload_length - Length of response message payload
866 * @param[out] completion_code - Pointer to hold completion code
867 * @param[out] comp_compatibility_resp - Pointer to hold component
868 * compatibility response
869 * @param[out] comp_compatibility_resp_code - Pointer to hold component
870 * compatibility response code
871 * @param[out] update_option_flags_enabled - Pointer to hold
872 * UpdateOptionsFlagEnabled
873 * @param[out] time_before_req_fw_data - Pointer to hold the estimated time
874 * before sending RequestFirmwareData
875 *
876 * @return pldm_completion_codes
877 */
878int decode_update_component_resp(const struct pldm_msg *msg,
879 size_t payload_length,
880 uint8_t *completion_code,
881 uint8_t *comp_compatibility_resp,
882 uint8_t *comp_compatibility_resp_code,
883 bitfield32_t *update_option_flags_enabled,
884 uint16_t *time_before_req_fw_data);
885
886/** @brief Decode RequestFirmwareData request message
887 *
888 * @param[in] msg - Request message
889 * @param[in] payload_length - Length of request message payload
890 * @param[out] offset - Pointer to hold offset
891 * @param[out] length - Pointer to hold the size of the component image
892 * segment requested by the FD/FDP
893 *
894 * @return pldm_completion_codes
895 */
896int decode_request_firmware_data_req(const struct pldm_msg *msg,
897 size_t payload_length, uint32_t *offset,
898 uint32_t *length);
899
900/** @brief Create PLDM response message for RequestFirmwareData
901 *
902 * The ComponentImagePortion is not encoded in the PLDM response message
903 * by encode_request_firmware_data_resp to avoid an additional copy. Populating
904 * ComponentImagePortion in the PLDM response message is handled by the user
905 * of this API. The payload_length validation considers only the
906 * CompletionCode.
907 *
908 * @param[in] instance_id - Message's instance id
909 * @param[in] completion_code - CompletionCode
910 * @param[in,out] msg - Message will be written to this
911 * @param[in] payload_length - Length of response message payload
912 *
913 * @return pldm_completion_codes
914 *
915 * @note Caller is responsible for memory alloc and dealloc of param
916 * 'msg.payload'
917 */
918int encode_request_firmware_data_resp(uint8_t instance_id,
919 uint8_t completion_code,
920 struct pldm_msg *msg,
921 size_t payload_length);
922
923/** @brief Decode TransferComplete request message
924 *
925 * @param[in] msg - Request message
926 * @param[in] payload_length - Length of request message payload
927 * @param[out] transfer_result - Pointer to hold TransferResult
928 *
929 * @return pldm_completion_codes
930 */
931int decode_transfer_complete_req(const struct pldm_msg *msg,
932 size_t payload_length,
933 uint8_t *transfer_result);
934
935/** @brief Create PLDM response message for TransferComplete
936 *
937 * @param[in] instance_id - Message's instance id
938 * @param[in] completion_code - CompletionCode
939 * @param[in,out] msg - Message will be written to this
940 * @param[in] payload_length - Length of response message payload
941 *
942 * @return pldm_completion_codes
943 *
944 * @note Caller is responsible for memory alloc and dealloc of param
945 * 'msg.payload'
946 */
947int encode_transfer_complete_resp(uint8_t instance_id, uint8_t completion_code,
948 struct pldm_msg *msg, size_t payload_length);
949
950/** @brief Decode VerifyComplete request message
951 *
952 * @param[in] msg - Request message
953 * @param[in] payload_length - Length of request message payload
954 * @param[in] verify_result - Pointer to hold VerifyResult
955 *
956 * @return pldm_completion_codes
957 */
958int decode_verify_complete_req(const struct pldm_msg *msg,
959 size_t payload_length, uint8_t *verify_result);
960
961/** @brief Create PLDM response message for VerifyComplete
962 *
963 * @param[in] instance_id - Message's instance id
964 * @param[in] completion_code - CompletionCode
965 * @param[in,out] msg - Message will be written to this
966 * @param[in] payload_length - Length of response message payload
967 *
968 * @return pldm_completion_codes
969 *
970 * @note Caller is responsible for memory alloc and dealloc of param
971 * 'msg.payload'
972 */
973int encode_verify_complete_resp(uint8_t instance_id, uint8_t completion_code,
974 struct pldm_msg *msg, size_t payload_length);
975
976/** @brief Decode ApplyComplete request message
977 *
978 * @param[in] msg - Request message
979 * @param[in] payload_length - Length of request message payload
980 * @param[in] apply_result - Pointer to hold ApplyResult
981 * @param[in] comp_activation_methods_modification - Pointer to hold the
982 * ComponentActivationMethodsModification
983 *
984 * @return pldm_completion_codes
985 */
986int decode_apply_complete_req(
Andrew Jeffery37dd6a32023-05-12 16:04:06 +0930987 const struct pldm_msg *msg, size_t payload_length,
988 uint8_t *apply_result,
989 bitfield16_t *comp_activation_methods_modification);
Andrew Jeffery9c766792022-08-10 23:12:49 +0930990
991/** @brief Create PLDM response message for ApplyComplete
992 *
993 * @param[in] instance_id - Message's instance id
994 * @param[in] completion_code - CompletionCode
995 * @param[in,out] msg - Message will be written to this
996 * @param[in] payload_length - Length of response message payload
997 *
998 * @return pldm_completion_codes
999 *
1000 * @note Caller is responsible for memory alloc and dealloc of param
1001 * 'msg.payload'
1002 */
1003int encode_apply_complete_resp(uint8_t instance_id, uint8_t completion_code,
1004 struct pldm_msg *msg, size_t payload_length);
1005
1006/** @brief Create PLDM request message for ActivateFirmware
1007 *
1008 * @param[in] instance_id - Message's instance id
1009 * @param[in] self_contained_activation_req SelfContainedActivationRequest
1010 * @param[in,out] msg - Message will be written to this
1011 * @param[in] payload_length - Length of request message payload
1012 *
1013 * @return pldm_completion_codes
1014 *
1015 * @note Caller is responsible for memory alloc and dealloc of param
1016 * 'msg.payload'
1017 */
1018int encode_activate_firmware_req(uint8_t instance_id,
1019 bool8_t self_contained_activation_req,
1020 struct pldm_msg *msg, size_t payload_length);
1021
1022/** @brief Decode ActivateFirmware response message
1023 *
1024 * @param[in] msg - Response message
1025 * @param[in] payload_length - Length of response message payload
1026 * @param[out] completion_code - Pointer to hold CompletionCode
1027 * @param[out] estimated_time_activation - Pointer to hold
1028 * EstimatedTimeForSelfContainedActivation
1029 *
1030 * @return pldm_completion_codes
1031 */
1032int decode_activate_firmware_resp(const struct pldm_msg *msg,
1033 size_t payload_length,
1034 uint8_t *completion_code,
1035 uint16_t *estimated_time_activation);
1036
1037/** @brief Create PLDM request message for GetStatus
1038 *
1039 * @param[in] instance_id - Message's instance id
1040 * @param[in,out] msg - Message will be written to this
1041 * @param[in] payload_length - Length of request message payload
1042 *
1043 * @return pldm_completion_codes
1044 *
1045 * @note Caller is responsible for memory alloc and dealloc of param
1046 * 'msg.payload'
1047 */
1048int encode_get_status_req(uint8_t instance_id, struct pldm_msg *msg,
1049 size_t payload_length);
1050
1051/** @brief Decode GetStatus response message
1052 *
1053 * @param[in] msg - Response message
1054 * @param[in] payload_length - Length of response message payload
1055 * @param[out] completion_code - Pointer to completion code
1056 * @param[out] current_state - Pointer to current state machine state
1057 * @param[out] previous_state - Pointer to previous different state machine
1058 * state
1059 * @param[out] aux_state - Pointer to current operation state of FD/FDP
1060 * @param[out] aux_state_status - Pointer to aux state status
1061 * @param[out] progress_percent - Pointer to progress percentage
1062 * @param[out] reason_code - Pointer to reason for entering current state
1063 * @param[out] update_option_flags_enabled - Pointer to update option flags
1064 * enabled
1065 *
1066 * @return pldm_completion_codes
1067 */
1068int decode_get_status_resp(const struct pldm_msg *msg, size_t payload_length,
1069 uint8_t *completion_code, uint8_t *current_state,
1070 uint8_t *previous_state, uint8_t *aux_state,
1071 uint8_t *aux_state_status, uint8_t *progress_percent,
1072 uint8_t *reason_code,
1073 bitfield32_t *update_option_flags_enabled);
1074
1075/** @brief Create PLDM request message for CancelUpdateComponent
1076 *
1077 * @param[in] instance_id - Message's instance id
1078 * @param[in,out] msg - Message will be written to this
1079 * @param[in] payload_length - Length of request message payload
1080 *
1081 * @return pldm_completion_codes
1082 *
1083 * @note Caller is responsible for memory alloc and dealloc of param
1084 * 'msg.payload'
1085 */
1086int encode_cancel_update_component_req(uint8_t instance_id,
1087 struct pldm_msg *msg,
1088 size_t payload_length);
1089
1090/** @brief Decode CancelUpdateComponent response message
1091 *
1092 * @param[in] msg - Response message
1093 * @param[in] payload_length - Length of response message payload
1094 * @param[out] completion_code - Pointer to the completion code
1095 *
1096 * @return pldm_completion_codes
1097 */
1098int decode_cancel_update_component_resp(const struct pldm_msg *msg,
1099 size_t payload_length,
1100 uint8_t *completion_code);
1101
1102/** @brief Create PLDM request message for CancelUpdate
1103 *
1104 * @param[in] instance_id - Message's instance id
1105 * @param[in,out] msg - Message will be written to this
1106 * @param[in] payload_length - Length of request message payload
1107 *
1108 * @return pldm_completion_codes
1109 *
1110 * @note Caller is responsible for memory alloc and dealloc of param
1111 * 'msg.payload'
1112 */
1113int encode_cancel_update_req(uint8_t instance_id, struct pldm_msg *msg,
1114 size_t payload_length);
1115
1116/** @brief Decode CancelUpdate response message
1117 *
1118 * @param[in] msg - Response message
1119 * @param[in] payload_length - Length of response message payload
1120 * @param[out] completion_code - Pointer to completion code
1121 * @param[out] non_functioning_component_indication - Pointer to non
1122 functioning
1123 * component indication
1124 * @param[out] non_functioning_component_bitmap - Pointer to non
1125 functioning
1126 * component bitmap
1127 *
1128 * @return pldm_completion_codes
1129 */
1130int decode_cancel_update_resp(const struct pldm_msg *msg, size_t payload_length,
1131 uint8_t *completion_code,
1132 bool8_t *non_functioning_component_indication,
1133 bitfield64_t *non_functioning_component_bitmap);
1134
1135#ifdef __cplusplus
1136}
1137#endif
1138
1139#endif // End of FW_UPDATE_H