1 /* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
2 #ifndef FW_UPDATE_H
3 #define FW_UPDATE_H
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 #include <libpldm/api.h>
10 #include <libpldm/base.h>
11 #include <libpldm/pldm_types.h>
12 #include <libpldm/utils.h>
13
14 #include <stdbool.h>
15 #include <stddef.h>
16 #include <stdint.h>
17
18 #define PLDM_FWUP_COMPONENT_BITMAP_MULTIPLE 8
19 #define PLDM_FWUP_INVALID_COMPONENT_COMPARISON_TIMESTAMP 0xffffffff
20 #define PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES 0
21
22 /** @brief Length of QueryDownstreamDevices response defined in DSP0267_1.1.0
23 * Table 15 - QueryDownstreamDevices command format.
24 *
25 * 1 byte for completion code
26 * 1 byte for downstream device update supported
27 * 2 bytes for number of downstream devices
28 * 2 bytes for max number of downstream devices
29 * 4 bytes for capabilities
30 */
31 #define PLDM_QUERY_DOWNSTREAM_DEVICES_RESP_BYTES 10
32
33 /** @brief Length of QueryDownstreamIdentifiers request defined in DSP0267_1.1.0
34 * Table 16 - QueryDownstreamIdentifiers command format.
35 *
36 * 4 bytes for data transfer handle
37 * 1 byte for transfer operation flag
38 */
39 #define PLDM_QUERY_DOWNSTREAM_IDENTIFIERS_REQ_BYTES 5
40
41 /** @brief Minimum length of QueryDownstreamIdentifiers response from DSP0267_1.1.0
42 * if the complement code is success.
43 *
44 * 1 byte for completion code
45 * 4 bytes for next data transfer handle
46 * 1 byte for transfer flag
47 * 4 bytes for downstream devices length
48 * 2 bytes for number of downstream devices
49 */
50 #define PLDM_QUERY_DOWNSTREAM_IDENTIFIERS_RESP_MIN_LEN 12
51
52 /** @brief Minimum length of device descriptor, 2 bytes for descriptor type,
53 * 2 bytes for descriptor length and at least 1 byte of descriptor data
54 */
55 #define PLDM_FWUP_DEVICE_DESCRIPTOR_MIN_LEN 5
56
57 /** @brief Length of GetDownstreamFirmwareParameters request defined in DSP0267_1.1.0
58 *
59 * 4 bytes for Data Transfer Handle
60 * 1 byte for Transfer Operation Flag
61 */
62 #define PLDM_GET_DOWNSTREAM_FIRMWARE_PARAMS_REQ_BYTES 5
63
64 /** @brief Minimum length of GetDownstreamFirmwareParameters response from
65 * DSP0267_1.1.0 if the completion code is success.
66 *
67 * 1 byte for completion code
68 * 4 bytes for next data transfer handle
69 * 1 byte for transfer flag
70 * 4 bytes for FDP capabilities during update
71 * 2 bytes for downstream device count
72 */
73 #define PLDM_GET_DOWNSTREAM_FIRMWARE_PARAMS_RESP_MIN_LEN 12
74
75 /** @brief Minimum length of DownstreamDeviceParameterTable entry from
76 * DSP0267_1.1.0 table 21 - DownstreamDeviceParameterTable
77 *
78 * 2 bytes for Downstream Device Index
79 * 4 bytes for Active Component Comparison Stamp
80 * 1 byte for Active Component Version String Type
81 * 1 byte for Active Component Version String Length
82 * 8 bytes for Active Component Release Date
83 * 4 bytes for Pending Component Comparison Stamp
84 * 1 byte for Pending Component Version String Type
85 * 1 byte for Pending Component Version String Length
86 * 8 bytes for Pending Component Release Date
87 * 2 bytes for Component Activation Methods
88 * 4 bytes for Capabilities During Update
89 */
90 #define PLDM_DOWNSTREAM_DEVICE_PARAMETER_ENTRY_MIN_LEN 36
91
92 #define PLDM_GET_FIRMWARE_PARAMETERS_REQ_BYTES 0
93 #define PLDM_FWUP_BASELINE_TRANSFER_SIZE 32
94 #define PLDM_FWUP_MIN_OUTSTANDING_REQ 1
95 #define PLDM_GET_STATUS_REQ_BYTES 0
96 /* Maximum progress percentage value*/
97 #define PLDM_FWUP_MAX_PROGRESS_PERCENT 0x65
98 #define PLDM_CANCEL_UPDATE_COMPONENT_REQ_BYTES 0
99 #define PLDM_CANCEL_UPDATE_REQ_BYTES 0
100
101 /** @brief PLDM component release data size in bytes defined in DSP0267_1.1.0
102 * Table 14 - ComponentParameterTable and Table 21 - ComponentParameterTable
103 *
104 * The size can be used in `ASCII[8] - ActiveComponentReleaseDate` and
105 * `ASCII[8] - PendingComponentReleaseDate` fields in the tables above.
106 */
107 #define PLDM_FWUP_COMPONENT_RELEASE_DATA_LEN 8
108
109 /** @brief PLDM Firmware update commands
110 */
111 enum pldm_firmware_update_commands {
112 PLDM_QUERY_DEVICE_IDENTIFIERS = 0x01,
113 PLDM_GET_FIRMWARE_PARAMETERS = 0x02,
114 PLDM_QUERY_DOWNSTREAM_DEVICES = 0x03,
115 PLDM_QUERY_DOWNSTREAM_IDENTIFIERS = 0x04,
116 PLDM_QUERY_DOWNSTREAM_FIRMWARE_PARAMETERS = 0x05,
117 PLDM_REQUEST_UPDATE = 0x10,
118 PLDM_PASS_COMPONENT_TABLE = 0x13,
119 PLDM_UPDATE_COMPONENT = 0x14,
120 PLDM_REQUEST_FIRMWARE_DATA = 0x15,
121 PLDM_TRANSFER_COMPLETE = 0x16,
122 PLDM_VERIFY_COMPLETE = 0x17,
123 PLDM_APPLY_COMPLETE = 0x18,
124 PLDM_ACTIVATE_FIRMWARE = 0x1a,
125 PLDM_GET_STATUS = 0x1b,
126 PLDM_CANCEL_UPDATE_COMPONENT = 0x1c,
127 PLDM_CANCEL_UPDATE = 0x1d
128 };
129
130 /** @brief PLDM Firmware update completion codes
131 */
132 enum pldm_firmware_update_completion_codes {
133 PLDM_FWUP_NOT_IN_UPDATE_MODE = 0x80,
134 PLDM_FWUP_ALREADY_IN_UPDATE_MODE = 0x81,
135 PLDM_FWUP_DATA_OUT_OF_RANGE = 0x82,
136 PLDM_FWUP_INVALID_TRANSFER_LENGTH = 0x83,
137 PLDM_FWUP_INVALID_STATE_FOR_COMMAND = 0x84,
138 PLDM_FWUP_INCOMPLETE_UPDATE = 0x85,
139 PLDM_FWUP_BUSY_IN_BACKGROUND = 0x86,
140 PLDM_FWUP_CANCEL_PENDING = 0x87,
141 PLDM_FWUP_COMMAND_NOT_EXPECTED = 0x88,
142 PLDM_FWUP_RETRY_REQUEST_FW_DATA = 0x89,
143 PLDM_FWUP_UNABLE_TO_INITIATE_UPDATE = 0x8a,
144 PLDM_FWUP_ACTIVATION_NOT_REQUIRED = 0x8b,
145 PLDM_FWUP_SELF_CONTAINED_ACTIVATION_NOT_PERMITTED = 0x8c,
146 PLDM_FWUP_NO_DEVICE_METADATA = 0x8d,
147 PLDM_FWUP_RETRY_REQUEST_UPDATE = 0x8e,
148 PLDM_FWUP_NO_PACKAGE_DATA = 0x8f,
149 PLDM_FWUP_INVALID_TRANSFER_HANDLE = 0x90,
150 PLDM_FWUP_INVALID_TRANSFER_OPERATION_FLAG = 0x91,
151 PLDM_FWUP_ACTIVATE_PENDING_IMAGE_NOT_PERMITTED = 0x92,
152 PLDM_FWUP_PACKAGE_DATA_ERROR = 0x93
153 };
154
155 /** @brief String type values defined in the PLDM firmware update specification
156 */
157 enum pldm_firmware_update_string_type {
158 PLDM_STR_TYPE_UNKNOWN = 0,
159 PLDM_STR_TYPE_ASCII = 1,
160 PLDM_STR_TYPE_UTF_8 = 2,
161 PLDM_STR_TYPE_UTF_16 = 3,
162 PLDM_STR_TYPE_UTF_16LE = 4,
163 PLDM_STR_TYPE_UTF_16BE = 5
164 };
165
166 /** @brief Descriptor types defined in PLDM firmware update specification
167 */
168 enum pldm_firmware_update_descriptor_types {
169 PLDM_FWUP_PCI_VENDOR_ID = 0x0000,
170 PLDM_FWUP_IANA_ENTERPRISE_ID = 0x0001,
171 PLDM_FWUP_UUID = 0x0002,
172 PLDM_FWUP_PNP_VENDOR_ID = 0x0003,
173 PLDM_FWUP_ACPI_VENDOR_ID = 0x0004,
174 PLDM_FWUP_IEEE_ASSIGNED_COMPANY_ID = 0x0005,
175 PLDM_FWUP_SCSI_VENDOR_ID = 0x0006,
176 PLDM_FWUP_PCI_DEVICE_ID = 0x0100,
177 PLDM_FWUP_PCI_SUBSYSTEM_VENDOR_ID = 0x0101,
178 PLDM_FWUP_PCI_SUBSYSTEM_ID = 0x0102,
179 PLDM_FWUP_PCI_REVISION_ID = 0x0103,
180 PLDM_FWUP_PNP_PRODUCT_IDENTIFIER = 0x0104,
181 PLDM_FWUP_ACPI_PRODUCT_IDENTIFIER = 0x0105,
182 PLDM_FWUP_ASCII_MODEL_NUMBER_LONG_STRING = 0x0106,
183 PLDM_FWUP_ASCII_MODEL_NUMBER_SHORT_STRING = 0x0107,
184 PLDM_FWUP_SCSI_PRODUCT_ID = 0x0108,
185 PLDM_FWUP_UBM_CONTROLLER_DEVICE_CODE = 0x0109,
186 PLDM_FWUP_VENDOR_DEFINED = 0xffff
187 };
188
189 /** @brief Descriptor types length defined in PLDM firmware update specification
190 */
191 enum pldm_firmware_update_descriptor_types_length {
192 PLDM_FWUP_PCI_VENDOR_ID_LENGTH = 2,
193 PLDM_FWUP_IANA_ENTERPRISE_ID_LENGTH = 4,
194 PLDM_FWUP_UUID_LENGTH = 16,
195 PLDM_FWUP_PNP_VENDOR_ID_LENGTH = 3,
196 PLDM_FWUP_ACPI_VENDOR_ID_LENGTH = 4,
197 PLDM_FWUP_IEEE_ASSIGNED_COMPANY_ID_LENGTH = 3,
198 PLDM_FWUP_SCSI_VENDOR_ID_LENGTH = 8,
199 PLDM_FWUP_PCI_DEVICE_ID_LENGTH = 2,
200 PLDM_FWUP_PCI_SUBSYSTEM_VENDOR_ID_LENGTH = 2,
201 PLDM_FWUP_PCI_SUBSYSTEM_ID_LENGTH = 2,
202 PLDM_FWUP_PCI_REVISION_ID_LENGTH = 1,
203 PLDM_FWUP_PNP_PRODUCT_IDENTIFIER_LENGTH = 4,
204 PLDM_FWUP_ACPI_PRODUCT_IDENTIFIER_LENGTH = 4,
205 PLDM_FWUP_ASCII_MODEL_NUMBER_LONG_STRING_LENGTH = 40,
206 PLDM_FWUP_ASCII_MODEL_NUMBER_SHORT_STRING_LENGTH = 10,
207 PLDM_FWUP_SCSI_PRODUCT_ID_LENGTH = 16,
208 PLDM_FWUP_UBM_CONTROLLER_DEVICE_CODE_LENGTH = 4
209 };
210
211 /** @brief ComponentClassification values defined in firmware update
212 * specification
213 */
214 enum pldm_component_classification_values {
215 PLDM_COMP_UNKNOWN = 0x0000,
216 PLDM_COMP_OTHER = 0x0001,
217 PLDM_COMP_DRIVER = 0x0002,
218 PLDM_COMP_CONFIGURATION_SOFTWARE = 0x0003,
219 PLDM_COMP_APPLICATION_SOFTWARE = 0x0004,
220 PLDM_COMP_INSTRUMENTATION = 0x0005,
221 PLDM_COMP_FIRMWARE_OR_BIOS = 0x0006,
222 PLDM_COMP_DIAGNOSTIC_SOFTWARE = 0x0007,
223 PLDM_COMP_OPERATING_SYSTEM = 0x0008,
224 PLDM_COMP_MIDDLEWARE = 0x0009,
225 PLDM_COMP_FIRMWARE = 0x000a,
226 PLDM_COMP_BIOS_OR_FCODE = 0x000b,
227 PLDM_COMP_SUPPORT_OR_SERVICEPACK = 0x000c,
228 PLDM_COMP_SOFTWARE_BUNDLE = 0x000d,
229 PLDM_COMP_DOWNSTREAM_DEVICE = 0xffff
230 };
231
232 /** @brief ComponentActivationMethods is the bit position in the bitfield that
233 * provides the capability of the FD for firmware activation. Multiple
234 * activation methods can be supported.
235 */
236 enum pldm_comp_activation_methods {
237 PLDM_ACTIVATION_AUTOMATIC = 0,
238 PLDM_ACTIVATION_SELF_CONTAINED = 1,
239 PLDM_ACTIVATION_MEDIUM_SPECIFIC_RESET = 2,
240 PLDM_ACTIVATION_SYSTEM_REBOOT = 3,
241 PLDM_ACTIVATION_DC_POWER_CYCLE = 4,
242 PLDM_ACTIVATION_AC_POWER_CYCLE = 5,
243 PLDM_SUPPORTS_ACTIVATE_PENDING_IMAGE = 6,
244 PLDM_SUPPORTS_ACTIVATE_PENDING_IMAGE_SET = 7
245 };
246
247 /** @brief ComponentResponse values in the response of PassComponentTable
248 */
249 enum pldm_component_responses {
250 PLDM_CR_COMP_CAN_BE_UPDATED = 0,
251 PLDM_CR_COMP_MAY_BE_UPDATEABLE = 1
252 };
253
254 /** @brief ComponentResponseCode values in the response of PassComponentTable
255 */
256 enum pldm_component_response_codes {
257 PLDM_CRC_COMP_CAN_BE_UPDATED = 0x00,
258 PLDM_CRC_COMP_COMPARISON_STAMP_IDENTICAL = 0x01,
259 PLDM_CRC_COMP_COMPARISON_STAMP_LOWER = 0x02,
260 PLDM_CRC_INVALID_COMP_COMPARISON_STAMP = 0x03,
261 PLDM_CRC_COMP_CONFLICT = 0x04,
262 PLDM_CRC_COMP_PREREQUISITES_NOT_MET = 0x05,
263 PLDM_CRC_COMP_NOT_SUPPORTED = 0x06,
264 PLDM_CRC_COMP_SECURITY_RESTRICTIONS = 0x07,
265 PLDM_CRC_INCOMPLETE_COMP_IMAGE_SET = 0x08,
266 PLDM_CRC_ACTIVE_IMAGE_NOT_UPDATEABLE_SUBSEQUENTLY = 0x09,
267 PLDM_CRC_COMP_VER_STR_IDENTICAL = 0x0a,
268 PLDM_CRC_COMP_VER_STR_LOWER = 0x0b,
269 PLDM_CRC_VENDOR_COMP_RESP_CODE_RANGE_MIN = 0xd0,
270 PLDM_CRC_VENDOR_COMP_RESP_CODE_RANGE_MAX = 0xef
271 };
272
273 /** @brief ComponentCompatibilityResponse values in the response of
274 * UpdateComponent
275 */
276 enum pldm_component_compatibility_responses {
277 PLDM_CCR_COMP_CAN_BE_UPDATED = 0,
278 PLDM_CCR_COMP_CANNOT_BE_UPDATED = 1
279 };
280
281 /** @brief ComponentCompatibilityResponse Code values in the response of
282 * UpdateComponent
283 */
284 enum pldm_component_compatibility_response_codes {
285 PLDM_CCRC_NO_RESPONSE_CODE = 0x00,
286 PLDM_CCRC_COMP_COMPARISON_STAMP_IDENTICAL = 0x01,
287 PLDM_CCRC_COMP_COMPARISON_STAMP_LOWER = 0x02,
288 PLDM_CCRC_INVALID_COMP_COMPARISON_STAMP = 0x03,
289 PLDM_CCRC_COMP_CONFLICT = 0x04,
290 PLDM_CCRC_COMP_PREREQUISITES_NOT_MET = 0x05,
291 PLDM_CCRC_COMP_NOT_SUPPORTED = 0x06,
292 PLDM_CCRC_COMP_SECURITY_RESTRICTIONS = 0x07,
293 PLDM_CCRC_INCOMPLETE_COMP_IMAGE_SET = 0x08,
294 PLDM_CCRC_COMP_INFO_NO_MATCH = 0x09,
295 PLDM_CCRC_COMP_VER_STR_IDENTICAL = 0x0a,
296 PLDM_CCRC_COMP_VER_STR_LOWER = 0x0b,
297 PLDM_CCRC_VENDOR_COMP_RESP_CODE_RANGE_MIN = 0xd0,
298 PLDM_CCRC_VENDOR_COMP_RESP_CODE_RANGE_MAX = 0xef
299 };
300
301 /** @brief Common error codes in TransferComplete, VerifyComplete and
302 * ApplyComplete request
303 */
304 enum pldm_firmware_update_common_error_codes {
305 PLDM_FWUP_TIME_OUT = 0x09,
306 PLDM_FWUP_GENERIC_ERROR = 0x0a
307 };
308
309 /** @brief TransferResult values in the request of TransferComplete
310 */
311 enum pldm_firmware_update_transfer_result_values {
312 PLDM_FWUP_TRANSFER_SUCCESS = 0x00,
313 PLDM_FWUP_TRANSFER_ERROR_IMAGE_CORRUPT = 0x02,
314 PLDM_FWUP_TRANSFER_ERROR_VERSION_MISMATCH = 0x02,
315 PLDM_FWUP_FD_ABORTED_TRANSFER = 0x03,
316 PLDM_FWUP_FD_ABORTED_TRANSFER_LOW_POWER_STATE = 0x0b,
317 PLDM_FWUP_FD_ABORTED_TRANSFER_RESET_NEEDED = 0x0c,
318 PLDM_FWUP_FD_ABORTED_TRANSFER_STORAGE_ISSUE = 0x0d,
319 PLDM_FWUP_VENDOR_TRANSFER_RESULT_RANGE_MIN = 0x70,
320 PLDM_FWUP_VENDOR_TRANSFER_RESULT_RANGE_MAX = 0x8f
321 };
322
323 /**@brief VerifyResult values in the request of VerifyComplete
324 */
325 enum pldm_firmware_update_verify_result_values {
326 PLDM_FWUP_VERIFY_SUCCESS = 0x00,
327 PLDM_FWUP_VERIFY_ERROR_VERIFICATION_FAILURE = 0x01,
328 PLDM_FWUP_VERIFY_ERROR_VERSION_MISMATCH = 0x02,
329 PLDM_FWUP_VERIFY_FAILED_FD_SECURITY_CHECKS = 0x03,
330 PLDM_FWUP_VERIFY_ERROR_IMAGE_INCOMPLETE = 0x04,
331 PLDM_FWUP_VENDOR_VERIFY_RESULT_RANGE_MIN = 0x90,
332 PLDM_FWUP_VENDOR_VERIFY_RESULT_RANGE_MAX = 0xaf
333 };
334
335 /**@brief ApplyResult values in the request of ApplyComplete
336 */
337 enum pldm_firmware_update_apply_result_values {
338 PLDM_FWUP_APPLY_SUCCESS = 0x00,
339 PLDM_FWUP_APPLY_SUCCESS_WITH_ACTIVATION_METHOD = 0x01,
340 PLDM_FWUP_APPLY_FAILURE_MEMORY_ISSUE = 0x02,
341 PLDM_FWUP_VENDOR_APPLY_RESULT_RANGE_MIN = 0xb0,
342 PLDM_FWUP_VENDOR_APPLY_RESULT_RANGE_MAX = 0xcf
343 };
344
345 /** @brief SelfContainedActivationRequest in the request of ActivateFirmware
346 */
347 enum pldm_self_contained_activation_req {
348 PLDM_NOT_ACTIVATE_SELF_CONTAINED_COMPONENTS = false,
349 PLDM_ACTIVATE_SELF_CONTAINED_COMPONENTS = true
350 };
351
352 /** @brief Current state/previous state of the FD or FDP returned in GetStatus
353 * response
354 */
355 enum pldm_firmware_device_states {
356 PLDM_FD_STATE_IDLE = 0,
357 PLDM_FD_STATE_LEARN_COMPONENTS = 1,
358 PLDM_FD_STATE_READY_XFER = 2,
359 PLDM_FD_STATE_DOWNLOAD = 3,
360 PLDM_FD_STATE_VERIFY = 4,
361 PLDM_FD_STATE_APPLY = 5,
362 PLDM_FD_STATE_ACTIVATE = 6
363 };
364
365 /** @brief Firmware device aux state in GetStatus response
366 */
367 enum pldm_get_status_aux_states {
368 PLDM_FD_OPERATION_IN_PROGRESS = 0,
369 PLDM_FD_OPERATION_SUCCESSFUL = 1,
370 PLDM_FD_OPERATION_FAILED = 2,
371 PLDM_FD_IDLE_LEARN_COMPONENTS_READ_XFER = 3
372 };
373
374 /** @brief Firmware device aux state status in GetStatus response
375 */
376 enum pldm_get_status_aux_state_status_values {
377 PLDM_FD_AUX_STATE_IN_PROGRESS_OR_SUCCESS = 0x00,
378 PLDM_FD_TIMEOUT = 0x09,
379 PLDM_FD_GENERIC_ERROR = 0x0a,
380 PLDM_FD_VENDOR_DEFINED_STATUS_CODE_START = 0x70,
381 PLDM_FD_VENDOR_DEFINED_STATUS_CODE_END = 0xef
382 };
383
384 /** @brief Firmware device reason code in GetStatus response
385 */
386 enum pldm_get_status_reason_code_values {
387 PLDM_FD_INITIALIZATION = 0,
388 PLDM_FD_ACTIVATE_FW = 1,
389 PLDM_FD_CANCEL_UPDATE = 2,
390 PLDM_FD_TIMEOUT_LEARN_COMPONENT = 3,
391 PLDM_FD_TIMEOUT_READY_XFER = 4,
392 PLDM_FD_TIMEOUT_DOWNLOAD = 5,
393 PLDM_FD_TIMEOUT_VERIFY = 6,
394 PLDM_FD_TIMEOUT_APPLY = 7,
395 PLDM_FD_STATUS_VENDOR_DEFINED_MIN = 200,
396 PLDM_FD_STATUS_VENDOR_DEFINED_MAX = 255
397 };
398
399 /** @brief Components functional indicator in CancelUpdate response
400 */
401 enum pldm_firmware_update_non_functioning_component_indication {
402 PLDM_FWUP_COMPONENTS_FUNCTIONING = 0,
403 PLDM_FWUP_COMPONENTS_NOT_FUNCTIONING = 1
404 };
405
406 /** @brief Downstream device update supported in QueryDownstreamDevices response
407 * defined in DSP0267_1.1.0
408 */
409 enum pldm_firmware_update_downstream_device_update_supported {
410 PLDM_FWUP_DOWNSTREAM_DEVICE_UPDATE_NOT_SUPPORTED = 0,
411 PLDM_FWUP_DOWNSTREAM_DEVICE_UPDATE_SUPPORTED = 1
412 };
413
414 /** @struct pldm_package_header_information
415 *
416 * Structure representing fixed part of package header information
417 */
418 struct pldm_package_header_information {
419 uint8_t uuid[PLDM_FWUP_UUID_LENGTH];
420 uint8_t package_header_format_version;
421 uint16_t package_header_size;
422 uint8_t package_release_date_time[PLDM_TIMESTAMP104_SIZE];
423 uint16_t component_bitmap_bit_length;
424 uint8_t package_version_string_type;
425 uint8_t package_version_string_length;
426 } __attribute__((packed));
427
428 /** @struct pldm_firmware_device_id_record
429 *
430 * Structure representing firmware device ID record
431 */
432 struct pldm_firmware_device_id_record {
433 uint16_t record_length;
434 uint8_t descriptor_count;
435 bitfield32_t device_update_option_flags;
436 uint8_t comp_image_set_version_string_type;
437 uint8_t comp_image_set_version_string_length;
438 uint16_t fw_device_pkg_data_length;
439 } __attribute__((packed));
440
441 /** @struct pldm_descriptor_tlv
442 *
443 * Structure representing descriptor type, length and value
444 */
445 struct pldm_descriptor_tlv {
446 uint16_t descriptor_type;
447 uint16_t descriptor_length;
448 uint8_t descriptor_data[1];
449 } __attribute__((packed));
450
451 /** @struct pldm_vendor_defined_descriptor_title_data
452 *
453 * Structure representing vendor defined descriptor title sections
454 */
455 struct pldm_vendor_defined_descriptor_title_data {
456 uint8_t vendor_defined_descriptor_title_str_type;
457 uint8_t vendor_defined_descriptor_title_str_len;
458 uint8_t vendor_defined_descriptor_title_str[1];
459 } __attribute__((packed));
460
461 /** @struct pldm_component_image_information
462 *
463 * Structure representing fixed part of individual component information in
464 * PLDM firmware update package
465 */
466 struct pldm_component_image_information {
467 uint16_t comp_classification;
468 uint16_t comp_identifier;
469 uint32_t comp_comparison_stamp;
470 bitfield16_t comp_options;
471 bitfield16_t requested_comp_activation_method;
472 uint32_t comp_location_offset;
473 uint32_t comp_size;
474 uint8_t comp_version_string_type;
475 uint8_t comp_version_string_length;
476 } __attribute__((packed));
477
478 /** @struct pldm_query_device_identifiers_resp
479 *
480 * Structure representing query device identifiers response.
481 */
482 struct pldm_query_device_identifiers_resp {
483 uint8_t completion_code;
484 uint32_t device_identifiers_len;
485 uint8_t descriptor_count;
486 } __attribute__((packed));
487
488 /** @struct pldm_get_firmware_parameters_resp
489 *
490 * Structure representing the fixed part of GetFirmwareParameters response
491 */
492 struct pldm_get_firmware_parameters_resp {
493 uint8_t completion_code;
494 bitfield32_t capabilities_during_update;
495 uint16_t comp_count;
496 uint8_t active_comp_image_set_ver_str_type;
497 uint8_t active_comp_image_set_ver_str_len;
498 uint8_t pending_comp_image_set_ver_str_type;
499 uint8_t pending_comp_image_set_ver_str_len;
500 } __attribute__((packed));
501
502 /** @struct pldm_query_downstream_devices_resp
503 *
504 * Structure representing response of QueryDownstreamDevices.
505 * The definition can be found Table 15 - QueryDownstreamDevices command format
506 * in DSP0267_1.1.0
507 */
508 struct pldm_query_downstream_devices_resp {
509 uint8_t completion_code;
510 uint8_t downstream_device_update_supported;
511 uint16_t number_of_downstream_devices;
512 uint16_t max_number_of_downstream_devices;
513 bitfield32_t capabilities;
514 };
515
516 /** @struct pldm_component_parameter_entry
517 *
518 * Structure representing component parameter table entry.
519 */
520 struct pldm_component_parameter_entry {
521 uint16_t comp_classification;
522 uint16_t comp_identifier;
523 uint8_t comp_classification_index;
524 uint32_t active_comp_comparison_stamp;
525 uint8_t active_comp_ver_str_type;
526 uint8_t active_comp_ver_str_len;
527 uint8_t active_comp_release_date[8];
528 uint32_t pending_comp_comparison_stamp;
529 uint8_t pending_comp_ver_str_type;
530 uint8_t pending_comp_ver_str_len;
531 uint8_t pending_comp_release_date[8];
532 bitfield16_t comp_activation_methods;
533 bitfield32_t capabilities_during_update;
534 } __attribute__((packed));
535
536 /** @struct pldm_query_downstream_identifiers_req
537 *
538 * Structure for QueryDownstreamIdentifiers request defined in Table 16 -
539 * QueryDownstreamIdentifiers command format in DSP0267_1.1.0
540 */
541 struct pldm_query_downstream_identifiers_req {
542 uint32_t data_transfer_handle;
543 uint8_t transfer_operation_flag;
544 };
545
546 /** @struct pldm_query_downstream_identifiers_resp
547 *
548 * Structure representing the fixed part of QueryDownstreamIdentifiers response
549 * defined in Table 16 - QueryDownstreamIdentifiers command format, and
550 * Table 17 - QueryDownstreamIdentifiers response definition in DSP0267_1.1.0.
551 *
552 * Squash the two tables into one since the definition of
553 * Table 17 is `Portion of QueryDownstreamIdentifiers response`
554 */
555 struct pldm_query_downstream_identifiers_resp {
556 uint8_t completion_code;
557 uint32_t next_data_transfer_handle;
558 uint8_t transfer_flag;
559 uint32_t downstream_devices_length;
560 uint16_t number_of_downstream_devices;
561 };
562
563 /** @struct pldm_downstream_device
564 *
565 * Structure representing downstream device information defined in
566 * Table 18 - DownstreamDevice definition in DSP0267_1.1.0
567 */
568 struct pldm_downstream_device {
569 uint16_t downstream_device_index;
570 uint8_t downstream_descriptor_count;
571 };
572 #define PLDM_DOWNSTREAM_DEVICE_BYTES 3
573
574 struct pldm_downstream_device_iter {
575 struct variable_field field;
576 size_t devs;
577 };
578
579 LIBPLDM_ITERATOR
pldm_downstream_device_iter_end(const struct pldm_downstream_device_iter * iter)580 bool pldm_downstream_device_iter_end(
581 const struct pldm_downstream_device_iter *iter)
582 {
583 return !iter->devs;
584 }
585
586 LIBPLDM_ITERATOR
pldm_downstream_device_iter_next(struct pldm_downstream_device_iter * iter)587 bool pldm_downstream_device_iter_next(struct pldm_downstream_device_iter *iter)
588 {
589 if (!iter->devs) {
590 return false;
591 }
592
593 iter->devs--;
594 return true;
595 }
596
597 int decode_pldm_downstream_device_from_iter(
598 struct pldm_downstream_device_iter *iter,
599 struct pldm_downstream_device *dev);
600
601 /** @brief Iterate downstream devices in QueryDownstreamIdentifiers response
602 *
603 * @param devs The @ref "struct pldm_downstream_device_iter" lvalue used as the
604 * out-value from the corresponding call to @ref
605 * decode_query_downstream_identifiers_resp
606 * @param dev The @ref "struct pldm_downstream_device" lvalue into which the
607 * next device instance should be decoded.
608 * @param rc An lvalue of type int into which the return code from the decoding
609 * will be placed.
610 *
611 * Example use of the macro is as follows:
612 *
613 * @code
614 * struct pldm_query_downstream_identifiers_resp resp;
615 * struct pldm_downstream_device_iter devs;
616 * struct pldm_downstream_device dev;
617 * int rc;
618 *
619 * rc = decode_query_downstream_identifiers_resp(..., &resp, &devs);
620 * if (rc) {
621 * // Handle any error from decoding fixed-portion of response
622 * }
623 *
624 * foreach_pldm_downstream_device(devs, dev, rc) {
625 * // Do something with each decoded device placed in `dev`
626 * }
627 *
628 * if (rc) {
629 * // Handle any decoding error while iterating variable-length set of
630 * // devices
631 * }
632 * @endcode
633 */
634 #define foreach_pldm_downstream_device(devs, dev, rc) \
635 for ((rc) = 0; (!pldm_downstream_device_iter_end(&(devs)) && \
636 !((rc) = decode_pldm_downstream_device_from_iter( \
637 &(devs), &(dev)))); \
638 pldm_downstream_device_iter_next(&(devs)))
639
640 /** @struct pldm_descriptor
641 *
642 * Structure representing a type-length-value descriptor as defined in Table 7 -
643 * Descriptor Definition.
644 *
645 * Member values are always host-endian. When decoding messages, the
646 * descriptor_data member points into the message buffer.
647 */
648 struct pldm_descriptor {
649 uint16_t descriptor_type;
650 uint16_t descriptor_length;
651 const void *descriptor_data;
652 };
653
654 struct pldm_descriptor_iter {
655 struct variable_field *field;
656 size_t count;
657 };
658
659 LIBPLDM_ITERATOR
pldm_downstream_device_descriptor_iter_init(struct pldm_downstream_device_iter * devs,const struct pldm_downstream_device * dev)660 struct pldm_descriptor_iter pldm_downstream_device_descriptor_iter_init(
661 struct pldm_downstream_device_iter *devs,
662 const struct pldm_downstream_device *dev)
663 {
664 struct pldm_descriptor_iter iter = { &devs->field,
665 dev->downstream_descriptor_count };
666 return iter;
667 }
668
669 LIBPLDM_ITERATOR
pldm_descriptor_iter_end(const struct pldm_descriptor_iter * iter)670 bool pldm_descriptor_iter_end(const struct pldm_descriptor_iter *iter)
671 {
672 return !iter->count;
673 }
674
675 LIBPLDM_ITERATOR
pldm_descriptor_iter_next(struct pldm_descriptor_iter * iter)676 bool pldm_descriptor_iter_next(struct pldm_descriptor_iter *iter)
677 {
678 if (!iter->count) {
679 return false;
680 }
681
682 iter->count--;
683 return true;
684 }
685
686 int decode_pldm_descriptor_from_iter(struct pldm_descriptor_iter *iter,
687 struct pldm_descriptor *desc);
688
689 /** @brief Iterate a downstream device's descriptors in a
690 * QueryDownstreamIdentifiers response
691 *
692 * @param devs The @ref "struct pldm_downstream_device_iter" lvalue used as the
693 * out-value from the corresponding call to @ref
694 * decode_query_downstream_identifiers_resp
695 * @param dev The @ref "struct pldm_downstream_device" lvalue over whose
696 * descriptors to iterate
697 * @param desc The @ref "struct pldm_descriptor" lvalue into which the next
698 * descriptor instance should be decoded
699 * @param rc An lvalue of type int into which the return code from the decoding
700 * will be placed
701 *
702 * Example use of the macro is as follows:
703 *
704 * @code
705 * struct pldm_query_downstream_identifiers_resp resp;
706 * struct pldm_downstream_device_iter devs;
707 * struct pldm_downstream_device dev;
708 * int rc;
709 *
710 * rc = decode_query_downstream_identifiers_resp(..., &resp, &devs);
711 * if (rc) {
712 * // Handle any error from decoding fixed-portion of response
713 * }
714 *
715 * foreach_pldm_downstream_device(devs, dev, rc) {
716 * struct pldm_descriptor desc;
717 *
718 * foreach_pldm_downstream_device_descriptor(devs, dev, desc, rc) {
719 * // Do something with each decoded descriptor placed in `desc`
720 * }
721 *
722 * if (rc) {
723 * // Handle any decoding error while iterating on the variable-length
724 * // set of descriptors
725 * }
726 * }
727 *
728 * if (rc) {
729 * // Handle any decoding error while iterating variable-length set of
730 * // devices
731 * }
732 * @endcode
733 */
734 #define foreach_pldm_downstream_device_descriptor(devs, dev, desc, rc) \
735 for (struct pldm_descriptor_iter desc##_iter = \
736 ((rc) = 0, pldm_downstream_device_descriptor_iter_init( \
737 &(devs), &(dev))); \
738 (!pldm_descriptor_iter_end(&(desc##_iter)) && \
739 !((rc) = decode_pldm_descriptor_from_iter(&(desc##_iter), \
740 &(desc)))); \
741 pldm_descriptor_iter_next(&(desc##_iter)))
742
743 /** @struct pldm_query_downstream_firmware_param_req
744 *
745 * Structure representing QueryDownstreamFirmwareParameters request
746 */
747 struct pldm_get_downstream_firmware_params_req {
748 uint32_t data_transfer_handle;
749 uint8_t transfer_operation_flag;
750 };
751
752 /** @struct pldm_query_downstream_firmware_param_resp
753 *
754 * Structure representing the fixed part of QueryDownstreamFirmwareParameters
755 * response in Table 19 - GetDownstreamFirmwareParameters command format, and
756 * Table 20 - QueryDownstreamFirmwareParameters response definition in
757 * DSP0267_1.1.0.
758 *
759 * Squash the two tables into one since the definition of Table 20 is `Portion
760 * of GetDownstreamFirmwareParameters response`
761 */
762 struct pldm_get_downstream_firmware_params_resp {
763 uint8_t completion_code;
764 uint32_t next_data_transfer_handle;
765 uint8_t transfer_flag;
766 bitfield32_t fdp_capabilities_during_update;
767 uint16_t downstream_device_count;
768 };
769
770 /** @struct pldm_downstream_device_parameter_entry
771 *
772 * Structure representing downstream device parameter table entry defined in
773 * Table 21 - DownstreamDeviceParameterTable in DSP0267_1.1.0
774 *
775 * Clients should not allocate memory for this struct to decode the response,
776 * use `pldm_downstream_device_parameter_entry_versions` instead to make sure
777 * that the active and pending component version strings are copied from the
778 * message buffer.
779 */
780 struct pldm_downstream_device_parameter_entry {
781 uint16_t downstream_device_index;
782 uint32_t active_comp_comparison_stamp;
783 uint8_t active_comp_ver_str_type;
784 uint8_t active_comp_ver_str_len;
785 /* Append 1 bytes for null termination so that it can be used as a
786 * Null-terminated string.
787 */
788 char active_comp_release_date[PLDM_FWUP_COMPONENT_RELEASE_DATA_LEN + 1];
789 uint32_t pending_comp_comparison_stamp;
790 uint8_t pending_comp_ver_str_type;
791 uint8_t pending_comp_ver_str_len;
792 /* Append 1 bytes for null termination so that it can be used as a
793 * Null-terminated string.
794 */
795 char pending_comp_release_date[PLDM_FWUP_COMPONENT_RELEASE_DATA_LEN + 1];
796 bitfield16_t comp_activation_methods;
797 bitfield32_t capabilities_during_update;
798 const char *active_comp_ver_str;
799 const char *pending_comp_ver_str;
800 };
801
802 /** @struct pldm_downstream_device_parameter_entry_versions
803 *
804 * Structure representing downstream device parameter table entry with
805 * copies of active and pending component version strings to avoid the
806 * message buffer is subsequently freed.
807 *
808 * Clients should allocate memory for this struct then decode the response
809 * instead of using `pldm_downstream_device_parameter_entry`.
810 */
811 struct pldm_downstream_device_parameter_entry_versions {
812 struct pldm_downstream_device_parameter_entry entry;
813 /* The "Length of ComponentVersionString" field is 1 byte, so
814 * "ComponentVersionString" can be at most 255 characters, allocate
815 * memory for it and append 1 bytes for null termination so that it
816 * can be used as a Null-terminated string.
817 */
818 char active_comp_ver_str[UINT8_MAX + 1];
819 char pending_comp_ver_str[UINT8_MAX + 1];
820 };
821
822 /** @struct pldm_request_update_req
823 *
824 * Structure representing fixed part of Request Update request
825 */
826 struct pldm_request_update_req {
827 uint32_t max_transfer_size;
828 uint16_t num_of_comp;
829 uint8_t max_outstanding_transfer_req;
830 uint16_t pkg_data_len;
831 uint8_t comp_image_set_ver_str_type;
832 uint8_t comp_image_set_ver_str_len;
833 } __attribute__((packed));
834
835 /** @struct pldm_request_update_resp
836 *
837 * Structure representing Request Update response
838 */
839 struct pldm_request_update_resp {
840 uint8_t completion_code;
841 uint16_t fd_meta_data_len;
842 uint8_t fd_will_send_pkg_data;
843 } __attribute__((packed));
844
845 /** @struct pldm_pass_component_table_req
846 *
847 * Structure representing PassComponentTable request
848 */
849 struct pldm_pass_component_table_req {
850 uint8_t transfer_flag;
851 uint16_t comp_classification;
852 uint16_t comp_identifier;
853 uint8_t comp_classification_index;
854 uint32_t comp_comparison_stamp;
855 uint8_t comp_ver_str_type;
856 uint8_t comp_ver_str_len;
857 } __attribute__((packed));
858
859 /** @struct pldm_pass_component_table_resp
860 *
861 * Structure representing PassComponentTable response
862 */
863 struct pldm_pass_component_table_resp {
864 uint8_t completion_code;
865 uint8_t comp_resp;
866 uint8_t comp_resp_code;
867 } __attribute__((packed));
868
869 /** @struct pldm_update_component_req
870 *
871 * Structure representing UpdateComponent request
872 */
873 struct pldm_update_component_req {
874 uint16_t comp_classification;
875 uint16_t comp_identifier;
876 uint8_t comp_classification_index;
877 uint32_t comp_comparison_stamp;
878 uint32_t comp_image_size;
879 bitfield32_t update_option_flags;
880 uint8_t comp_ver_str_type;
881 uint8_t comp_ver_str_len;
882 } __attribute__((packed));
883
884 /** @struct pldm_update_component_resp
885 *
886 * Structure representing UpdateComponent response
887 */
888 struct pldm_update_component_resp {
889 uint8_t completion_code;
890 uint8_t comp_compatibility_resp;
891 uint8_t comp_compatibility_resp_code;
892 bitfield32_t update_option_flags_enabled;
893 uint16_t time_before_req_fw_data;
894 } __attribute__((packed));
895
896 /** @struct pldm_request_firmware_data_req
897 *
898 * Structure representing RequestFirmwareData request.
899 */
900 struct pldm_request_firmware_data_req {
901 uint32_t offset;
902 uint32_t length;
903 } __attribute__((packed));
904
905 /** @struct pldm_apply_complete_req
906 *
907 * Structure representing ApplyComplete request.
908 */
909 struct pldm_apply_complete_req {
910 uint8_t apply_result;
911 bitfield16_t comp_activation_methods_modification;
912 } __attribute__((packed));
913
914 /** @struct pldm_activate_firmware_req
915 *
916 * Structure representing ActivateFirmware request
917 */
918 struct pldm_activate_firmware_req {
919 bool8_t self_contained_activation_req;
920 } __attribute__((packed));
921
922 /** @struct activate_firmware_resp
923 *
924 * Structure representing Activate Firmware response
925 */
926 struct pldm_activate_firmware_resp {
927 uint8_t completion_code;
928 uint16_t estimated_time_activation;
929 } __attribute__((packed));
930
931 /** @struct pldm_get_status_resp
932 *
933 * Structure representing GetStatus response.
934 */
935 struct pldm_get_status_resp {
936 uint8_t completion_code;
937 uint8_t current_state;
938 uint8_t previous_state;
939 uint8_t aux_state;
940 uint8_t aux_state_status;
941 uint8_t progress_percent;
942 uint8_t reason_code;
943 bitfield32_t update_option_flags_enabled;
944 } __attribute__((packed));
945
946 /** @struct pldm_cancel_update_resp
947 *
948 * Structure representing CancelUpdate response.
949 */
950 struct pldm_cancel_update_resp {
951 uint8_t completion_code;
952 bool8_t non_functioning_component_indication;
953 uint64_t non_functioning_component_bitmap;
954 } __attribute__((packed));
955
956 /** @brief Decode the PLDM package header information
957 *
958 * @param[in] data - pointer to package header information
959 * @param[in] length - available length in the firmware update package
960 * @param[out] package_header_info - pointer to fixed part of PLDM package
961 * header information
962 * @param[out] package_version_str - pointer to package version string
963 *
964 * @return pldm_completion_codes
965 */
966 int decode_pldm_package_header_info(
967 const uint8_t *data, size_t length,
968 struct pldm_package_header_information *package_header_info,
969 struct variable_field *package_version_str);
970
971 /** @brief Decode individual firmware device ID record
972 *
973 * @param[in] data - pointer to firmware device ID record
974 * @param[in] length - available length in the firmware update package
975 * @param[in] component_bitmap_bit_length - ComponentBitmapBitLengthfield
976 * parsed from the package header info
977 * @param[out] fw_device_id_record - pointer to fixed part of firmware device
978 * id record
979 * @param[out] applicable_components - pointer to ApplicableComponents
980 * @param[out] comp_image_set_version_str - pointer to
981 * ComponentImageSetVersionString
982 * @param[out] record_descriptors - pointer to RecordDescriptors
983 * @param[out] fw_device_pkg_data - pointer to FirmwareDevicePackageData
984 *
985 * @return pldm_completion_codes
986 */
987 int decode_firmware_device_id_record(
988 const uint8_t *data, size_t length,
989 uint16_t component_bitmap_bit_length,
990 struct pldm_firmware_device_id_record *fw_device_id_record,
991 struct variable_field *applicable_components,
992 struct variable_field *comp_image_set_version_str,
993 struct variable_field *record_descriptors,
994 struct variable_field *fw_device_pkg_data);
995
996 /** @brief Decode the record descriptor entries in the firmware update package
997 * and the Descriptors in the QueryDeviceIDentifiers command
998 *
999 * @param[in] data - pointer to descriptor entry
1000 * @param[in] length - remaining length of the descriptor data
1001 * @param[out] descriptor_type - pointer to descriptor type
1002 * @param[out] descriptor_data - pointer to descriptor data
1003 *
1004 * @return pldm_completion_codes
1005 */
1006 int decode_descriptor_type_length_value(const uint8_t *data, size_t length,
1007 uint16_t *descriptor_type,
1008 struct variable_field *descriptor_data);
1009
1010 /** @brief Decode the vendor defined descriptor value
1011 *
1012 * @param[in] data - pointer to vendor defined descriptor value
1013 * @param[in] length - length of the vendor defined descriptor value
1014 * @param[out] descriptor_title_str_type - pointer to vendor defined descriptor
1015 * title string type
1016 * @param[out] descriptor_title_str - pointer to vendor defined descriptor
1017 * title string
1018 * @param[out] descriptor_data - pointer to vendor defined descriptor data
1019 *
1020 * @return pldm_completion_codes
1021 */
1022 int decode_vendor_defined_descriptor_value(
1023 const uint8_t *data, size_t length, uint8_t *descriptor_title_str_type,
1024 struct variable_field *descriptor_title_str,
1025 struct variable_field *descriptor_data);
1026
1027 /** @brief Decode individual component image information
1028 *
1029 * @param[in] data - pointer to component image information
1030 * @param[in] length - available length in the firmware update package
1031 * @param[out] pldm_comp_image_info - pointer to fixed part of component image
1032 * information
1033 * @param[out] comp_version_str - pointer to component version string
1034 *
1035 * @return pldm_completion_codes
1036 */
1037 int decode_pldm_comp_image_info(
1038 const uint8_t *data, size_t length,
1039 struct pldm_component_image_information *pldm_comp_image_info,
1040 struct variable_field *comp_version_str);
1041
1042 /** @brief Create a PLDM request message for QueryDeviceIdentifiers
1043 *
1044 * @param[in] instance_id - Message's instance id
1045 * @param[in] payload_length - Length of the request message payload
1046 * @param[in,out] msg - Message will be written to this
1047 *
1048 * @return pldm_completion_codes
1049 *
1050 * @note Caller is responsible for memory alloc and dealloc of param
1051 * 'msg.payload'
1052 */
1053 int encode_query_device_identifiers_req(uint8_t instance_id,
1054 size_t payload_length,
1055 struct pldm_msg *msg);
1056
1057 /** @brief Decode QueryDeviceIdentifiers response message
1058 *
1059 * @param[in] msg - Response message
1060 * @param[in] payload_length - Length of response message payload
1061 * @param[out] completion_code - Pointer to response msg's PLDM completion code
1062 * @param[out] device_identifiers_len - Pointer to device identifiers length
1063 * @param[out] descriptor_count - Pointer to descriptor count
1064 * @param[out] descriptor_data - Pointer to descriptor data
1065 *
1066 * @return pldm_completion_codes
1067 */
1068 int decode_query_device_identifiers_resp(const struct pldm_msg *msg,
1069 size_t payload_length,
1070 uint8_t *completion_code,
1071 uint32_t *device_identifiers_len,
1072 uint8_t *descriptor_count,
1073 uint8_t **descriptor_data);
1074
1075 /** @brief Create a PLDM request message for GetFirmwareParameters
1076 *
1077 * @param[in] instance_id - Message's instance id
1078 * @param[in] payload_length - Length of the request message payload
1079 * @param[in,out] msg - Message will be written to this
1080 *
1081 * @return pldm_completion_codes
1082 *
1083 * @note Caller is responsible for memory alloc and dealloc of param
1084 * 'msg.payload'
1085 */
1086 int encode_get_firmware_parameters_req(uint8_t instance_id,
1087 size_t payload_length,
1088 struct pldm_msg *msg);
1089
1090 /** @brief Decode GetFirmwareParameters response
1091 *
1092 * @param[in] msg - Response message
1093 * @param[in] payload_length - Length of response message payload
1094 * @param[out] resp_data - Pointer to get firmware parameters response
1095 * @param[out] active_comp_image_set_ver_str - Pointer to active component
1096 * image set version string
1097 * @param[out] pending_comp_image_set_ver_str - Pointer to pending component
1098 * image set version string
1099 * @param[out] comp_parameter_table - Pointer to component parameter table
1100 *
1101 * @return pldm_completion_codes
1102 */
1103 int decode_get_firmware_parameters_resp(
1104 const struct pldm_msg *msg, size_t payload_length,
1105 struct pldm_get_firmware_parameters_resp *resp_data,
1106 struct variable_field *active_comp_image_set_ver_str,
1107 struct variable_field *pending_comp_image_set_ver_str,
1108 struct variable_field *comp_parameter_table);
1109
1110 /** @brief Decode component entries in the component parameter table which is
1111 * part of the response of GetFirmwareParameters command
1112 *
1113 * @param[in] data - Component entry
1114 * @param[in] length - Length of component entry
1115 * @param[out] component_data - Pointer to component parameter table
1116 * @param[out] active_comp_ver_str - Pointer to active component version string
1117 * @param[out] pending_comp_ver_str - Pointer to pending component version
1118 * string
1119 *
1120 * @return pldm_completion_codes
1121 */
1122 int decode_get_firmware_parameters_resp_comp_entry(
1123 const uint8_t *data, size_t length,
1124 struct pldm_component_parameter_entry *component_data,
1125 struct variable_field *active_comp_ver_str,
1126 struct variable_field *pending_comp_ver_str);
1127
1128 /** @brief Create a PLDM request message for QueryDownstreamDevices
1129 *
1130 * @param[in] instance_id - Message's instance id
1131 * @param[out] msg - Message will be written to this
1132 *
1133 * @return pldm_completion_codes
1134 *
1135 * @note Caller is responsible for memory alloc and dealloc of param
1136 * 'msg.payload'
1137 */
1138 int encode_query_downstream_devices_req(uint8_t instance_id,
1139 struct pldm_msg *msg);
1140
1141 /**
1142 * @brief Decodes the response message for Querying Downstream Devices.
1143 *
1144 * @param[in] msg The PLDM message to decode.
1145 * @param[in] payload_length The length of the message payload.
1146 * @param[out] resp_data Pointer to the structure to store the decoded response data.
1147 * @return pldm_completion_codes
1148 *
1149 * @note Caller is responsible for memory alloc and dealloc of param
1150 * 'msg.payload'
1151 */
1152 int decode_query_downstream_devices_resp(
1153 const struct pldm_msg *msg, size_t payload_length,
1154 struct pldm_query_downstream_devices_resp *resp_data);
1155
1156 /**
1157 * @brief Encodes a request message for Query Downstream Identifiers.
1158 *
1159 * @param[in] instance_id The instance ID of the PLDM entity.
1160 * @param[in] data_transfer_handle The handle for the data transfer.
1161 * @param[in] transfer_operation_flag The flag indicating the transfer operation.
1162 * @param[out] msg Pointer to the PLDM message structure to store the encoded message.
1163 * @param[in] payload_length The length of the payload.
1164 * @return pldm_completion_codes
1165 *
1166 * @note Caller is responsible for memory alloc and dealloc of param
1167 * 'msg.payload'
1168 */
1169 int encode_query_downstream_identifiers_req(
1170 uint8_t instance_id, uint32_t data_transfer_handle,
1171 enum transfer_op_flag transfer_operation_flag, struct pldm_msg *msg,
1172 size_t payload_length);
1173
1174 /**
1175 * @brief Decodes the response message for Querying Downstream Identifiers.
1176 * @param[in] msg The PLDM message to decode.
1177 * @param[in] payload_length The length of the message payload.
1178 * @param[out] resp_data Pointer to the decoded response data.
1179 * @param[out] iter Pointer to the downstream device iterator structure.
1180 * @return pldm_completion_codes
1181 *
1182 * @note Caller is responsible for memory alloc and dealloc of pointer params
1183 */
1184 int decode_query_downstream_identifiers_resp(
1185 const struct pldm_msg *msg, size_t payload_length,
1186 struct pldm_query_downstream_identifiers_resp *resp_data,
1187 struct pldm_downstream_device_iter *iter);
1188
1189 /**
1190 * @brief Encodes request message for Get Downstream Firmware Parameters.
1191 *
1192 * @param[in] instance_id - The instance ID of the PLDM entity.
1193 * @param[in] data_transfer_handle - The handle for the data transfer.
1194 * @param[in] transfer_operation_flag - The flag indicating the transfer operation.
1195 * @param[in,out] msg - A pointer to the PLDM message structure to store the encoded message.
1196 * @param[in] payload_length - The length of the payload.
1197 *
1198 * @return 0 on success, otherwise -EINVAL if the input parameters' memory
1199 * are not allocated, -EOVERFLOW if the payload length is not enough
1200 * to encode the message, -EBADMSG if the message is not valid.
1201 *
1202 * @note Caller is responsible for memory alloc and dealloc of param
1203 * 'msg.payload'
1204 */
1205 int encode_get_downstream_firmware_params_req(
1206 uint8_t instance_id, uint32_t data_transfer_handle,
1207 enum transfer_op_flag transfer_operation_flag, struct pldm_msg *msg,
1208 size_t payload_length);
1209
1210 /**
1211 * @brief Decode response message for Get Downstream Firmware Parameters
1212 *
1213 * @param[in] msg - The PLDM message to decode
1214 * @param[in] payload_length - The length of the message payload
1215 * @param[out] resp_data - Pointer to the structure to store the decoded response data
1216 * @param[out] downstream_device_param_table - Pointer to the variable field structure
1217 * to store the decoded downstream device
1218 * parameter table
1219 * @return 0 on success, otherwise -EINVAL if the input parameters' memory
1220 * are not allocated, -EOVERFLOW if the payload length is not enough
1221 * to decode the message, -EBADMSG if the message is not valid.
1222 *
1223 * @note Caller is responsible for memory alloc and dealloc of param
1224 * 'resp_data' and 'downstream_device_param_table'
1225 */
1226 int decode_get_downstream_firmware_params_resp(
1227 const struct pldm_msg *msg, size_t payload_length,
1228 struct pldm_get_downstream_firmware_params_resp *resp_data,
1229 struct variable_field *downstream_device_param_table);
1230
1231 /**
1232 * @brief Decode the next downstream device parameter table entry
1233 *
1234 * @param[in,out] data - A variable field covering the table entries in the
1235 * response message data. @p data is updated to point to
1236 * the remaining entries once the current entry has been
1237 * decoded.
1238
1239 * @param[out] entry - The struct object into which the current table entry will
1240 * be decoded
1241
1242 * @param[out] versions - A variable field covering the active and
1243 * pending component version strings in the
1244 * response message data. The component version
1245 * strings can be decoded into @p entry using
1246 * decode_downstream_device_parameter_table_entry_versions()
1247 *
1248 * @return 0 on success, otherwise -EINVAL if the input parameters' memory
1249 * are not allocated, -EOVERFLOW if the payload length is not enough
1250 * to decode the entry.
1251 *
1252 * @note Caller is responsible for memory alloc and dealloc of param
1253 * 'entry', 'active_comp_ver_str' and 'pending_comp_ver_str'
1254 */
1255 int decode_downstream_device_parameter_table_entry(
1256 struct variable_field *data,
1257 struct pldm_downstream_device_parameter_entry *entry,
1258 struct variable_field *versions);
1259
1260 /**
1261 * @brief Decode the downstream device parameter table entry versions
1262 *
1263 * @param[in] versions - pointer to version strings raw data
1264 * @param[in,out] entry - pointer to the decoded downstream device parameter table entry
1265 * @param[out] active - pointer to active component version string container
1266 * @param[in] active_len - The size of the object pointed to by @p active
1267 * @param[out] pending - pointer to pending component version string container
1268 * @param[in] pending_len - The size of the object pointed to by @p pending
1269 *
1270 * @note Caller is responsible for memory alloc and dealloc of all the params,
1271 * and the param `entry` should be the instance which has successfully decoded
1272 * by `decode_downstream_device_parameter_table_entry()`.
1273 *
1274 */
1275 int decode_downstream_device_parameter_table_entry_versions(
1276 const struct variable_field *versions,
1277 struct pldm_downstream_device_parameter_entry *entry, char *active,
1278 size_t active_len, char *pending, size_t pending_len);
1279
1280 /** @brief Create PLDM request message for RequestUpdate
1281 *
1282 * @param[in] instance_id - Message's instance id
1283 * @param[in] max_transfer_size - Maximum size of the variable payload allowed
1284 * to be requested via RequestFirmwareData
1285 * command
1286 * @param[in] num_of_comp - Total number of components that will be passed to
1287 * the FD during the update
1288 * @param[in] max_outstanding_transfer_req - Total number of outstanding
1289 * RequestFirmwareData
1290 * commands that can be sent by the FD
1291 * @param[in] pkg_data_len - Value of the FirmwareDevicePackageDataLength field
1292 * present in firmware package header
1293 * @param[in] comp_image_set_ver_str_type - StringType of
1294 * ComponentImageSetVersionString
1295 * @param[in] comp_image_set_ver_str_len - The length of the
1296 * ComponentImageSetVersionString
1297 * @param[in] comp_img_set_ver_str - Component Image Set version information
1298 * @param[in,out] msg - Message will be written to this
1299 * @param[in] payload_length - Length of request message payload
1300 *
1301 * @return pldm_completion_codes
1302 *
1303 * @note Caller is responsible for memory alloc and dealloc of param
1304 * 'msg.payload'
1305 */
1306 int encode_request_update_req(uint8_t instance_id, uint32_t max_transfer_size,
1307 uint16_t num_of_comp,
1308 uint8_t max_outstanding_transfer_req,
1309 uint16_t pkg_data_len,
1310 uint8_t comp_image_set_ver_str_type,
1311 uint8_t comp_image_set_ver_str_len,
1312 const struct variable_field *comp_img_set_ver_str,
1313 struct pldm_msg *msg, size_t payload_length);
1314
1315 /** @brief Decode a RequestUpdate response message
1316 *
1317 * @param[in] msg - Response message
1318 * @param[in] payload_length - Length of response message payload
1319 * @param[out] completion_code - Pointer to hold the completion code
1320 * @param[out] fd_meta_data_len - Pointer to hold the length of FD metadata
1321 * @param[out] fd_will_send_pkg_data - Pointer to hold information whether FD
1322 * will send GetPackageData command
1323 * @return pldm_completion_codes
1324 */
1325 int decode_request_update_resp(const struct pldm_msg *msg,
1326 size_t payload_length, uint8_t *completion_code,
1327 uint16_t *fd_meta_data_len,
1328 uint8_t *fd_will_send_pkg_data);
1329
1330 /** @brief Create PLDM request message for PassComponentTable
1331 *
1332 * @param[in] instance_id - Message's instance id
1333 * @param[in] transfer_flag - TransferFlag
1334 * @param[in] comp_classification - ComponentClassification
1335 * @param[in] comp_identifier - ComponentIdentifier
1336 * @param[in] comp_classification_index - ComponentClassificationIndex
1337 * @param[in] comp_comparison_stamp - ComponentComparisonStamp
1338 * @param[in] comp_ver_str_type - ComponentVersionStringType
1339 * @param[in] comp_ver_str_len - ComponentVersionStringLength
1340 * @param[in] comp_ver_str - ComponentVersionString
1341 * @param[in,out] msg - Message will be written to this
1342 * @param[in] payload_length - Length of request message payload
1343 * information
1344 *
1345 * @return pldm_completion_codes
1346 *
1347 * @note Caller is responsible for memory alloc and dealloc of param
1348 * 'msg.payload'
1349 */
1350 int encode_pass_component_table_req(
1351 uint8_t instance_id, uint8_t transfer_flag,
1352 uint16_t comp_classification, uint16_t comp_identifier,
1353 uint8_t comp_classification_index, uint32_t comp_comparison_stamp,
1354 uint8_t comp_ver_str_type, uint8_t comp_ver_str_len,
1355 const struct variable_field *comp_ver_str, struct pldm_msg *msg,
1356 size_t payload_length);
1357
1358 /** @brief Decode PassComponentTable response message
1359 *
1360 * @param[in] msg - Response message
1361 * @param[in] payload_length - Length of response message payload
1362 * @param[out] completion_code - Pointer to hold completion code
1363 * @param[out] comp_resp - Pointer to hold component response
1364 * @param[out] comp_resp_code - Pointer to hold component response code
1365 *
1366 * @return pldm_completion_codes
1367 */
1368 int decode_pass_component_table_resp(const struct pldm_msg *msg,
1369 size_t payload_length,
1370 uint8_t *completion_code,
1371 uint8_t *comp_resp,
1372 uint8_t *comp_resp_code);
1373
1374 /** @brief Create PLDM request message for UpdateComponent
1375 *
1376 * @param[in] instance_id - Message's instance id
1377 * @param[in] comp_classification - ComponentClassification
1378 * @param[in] comp_identifier - ComponentIdentifier
1379 * @param[in] comp_classification_index - ComponentClassificationIndex
1380 * @param[in] comp_comparison_stamp - ComponentComparisonStamp
1381 * @param[in] comp_image_size - ComponentImageSize
1382 * @param[in] update_option_flags - UpdateOptionFlags
1383 * @param[in] comp_ver_str_type - ComponentVersionStringType
1384 * @param[in] comp_ver_str_len - ComponentVersionStringLength
1385 * @param[in] comp_ver_str - ComponentVersionString
1386 * @param[in,out] msg - Message will be written to this
1387 * @param[in] payload_length - Length of request message payload
1388 * information
1389 *
1390 * @return pldm_completion_codes
1391 *
1392 * @note Caller is responsible for memory alloc and dealloc of param
1393 * 'msg.payload'
1394 */
1395 int encode_update_component_req(
1396 uint8_t instance_id, uint16_t comp_classification,
1397 uint16_t comp_identifier, uint8_t comp_classification_index,
1398 uint32_t comp_comparison_stamp, uint32_t comp_image_size,
1399 bitfield32_t update_option_flags, uint8_t comp_ver_str_type,
1400 uint8_t comp_ver_str_len, const struct variable_field *comp_ver_str,
1401 struct pldm_msg *msg, size_t payload_length);
1402
1403 /** @brief Decode UpdateComponent response message
1404 *
1405 * @param[in] msg - Response message
1406 * @param[in] payload_length - Length of response message payload
1407 * @param[out] completion_code - Pointer to hold completion code
1408 * @param[out] comp_compatibility_resp - Pointer to hold component
1409 * compatibility response
1410 * @param[out] comp_compatibility_resp_code - Pointer to hold component
1411 * compatibility response code
1412 * @param[out] update_option_flags_enabled - Pointer to hold
1413 * UpdateOptionsFlagEnabled
1414 * @param[out] time_before_req_fw_data - Pointer to hold the estimated time
1415 * before sending RequestFirmwareData
1416 *
1417 * @return pldm_completion_codes
1418 */
1419 int decode_update_component_resp(const struct pldm_msg *msg,
1420 size_t payload_length,
1421 uint8_t *completion_code,
1422 uint8_t *comp_compatibility_resp,
1423 uint8_t *comp_compatibility_resp_code,
1424 bitfield32_t *update_option_flags_enabled,
1425 uint16_t *time_before_req_fw_data);
1426
1427 /** @brief Decode RequestFirmwareData request message
1428 *
1429 * @param[in] msg - Request message
1430 * @param[in] payload_length - Length of request message payload
1431 * @param[out] offset - Pointer to hold offset
1432 * @param[out] length - Pointer to hold the size of the component image
1433 * segment requested by the FD/FDP
1434 *
1435 * @return pldm_completion_codes
1436 */
1437 int decode_request_firmware_data_req(const struct pldm_msg *msg,
1438 size_t payload_length, uint32_t *offset,
1439 uint32_t *length);
1440
1441 /** @brief Create PLDM response message for RequestFirmwareData
1442 *
1443 * The ComponentImagePortion is not encoded in the PLDM response message
1444 * by encode_request_firmware_data_resp to avoid an additional copy. Populating
1445 * ComponentImagePortion in the PLDM response message is handled by the user
1446 * of this API. The payload_length validation considers only the
1447 * CompletionCode.
1448 *
1449 * @param[in] instance_id - Message's instance id
1450 * @param[in] completion_code - CompletionCode
1451 * @param[in,out] msg - Message will be written to this
1452 * @param[in] payload_length - Length of response message payload
1453 *
1454 * @return pldm_completion_codes
1455 *
1456 * @note Caller is responsible for memory alloc and dealloc of param
1457 * 'msg.payload'
1458 */
1459 int encode_request_firmware_data_resp(uint8_t instance_id,
1460 uint8_t completion_code,
1461 struct pldm_msg *msg,
1462 size_t payload_length);
1463
1464 /** @brief Decode TransferComplete request message
1465 *
1466 * @param[in] msg - Request message
1467 * @param[in] payload_length - Length of request message payload
1468 * @param[out] transfer_result - Pointer to hold TransferResult
1469 *
1470 * @return pldm_completion_codes
1471 */
1472 int decode_transfer_complete_req(const struct pldm_msg *msg,
1473 size_t payload_length,
1474 uint8_t *transfer_result);
1475
1476 /** @brief Create PLDM response message for TransferComplete
1477 *
1478 * @param[in] instance_id - Message's instance id
1479 * @param[in] completion_code - CompletionCode
1480 * @param[in,out] msg - Message will be written to this
1481 * @param[in] payload_length - Length of response message payload
1482 *
1483 * @return pldm_completion_codes
1484 *
1485 * @note Caller is responsible for memory alloc and dealloc of param
1486 * 'msg.payload'
1487 */
1488 int encode_transfer_complete_resp(uint8_t instance_id, uint8_t completion_code,
1489 struct pldm_msg *msg, size_t payload_length);
1490
1491 /** @brief Decode VerifyComplete request message
1492 *
1493 * @param[in] msg - Request message
1494 * @param[in] payload_length - Length of request message payload
1495 * @param[in] verify_result - Pointer to hold VerifyResult
1496 *
1497 * @return pldm_completion_codes
1498 */
1499 int decode_verify_complete_req(const struct pldm_msg *msg,
1500 size_t payload_length, uint8_t *verify_result);
1501
1502 /** @brief Create PLDM response message for VerifyComplete
1503 *
1504 * @param[in] instance_id - Message's instance id
1505 * @param[in] completion_code - CompletionCode
1506 * @param[in,out] msg - Message will be written to this
1507 * @param[in] payload_length - Length of response message payload
1508 *
1509 * @return pldm_completion_codes
1510 *
1511 * @note Caller is responsible for memory alloc and dealloc of param
1512 * 'msg.payload'
1513 */
1514 int encode_verify_complete_resp(uint8_t instance_id, uint8_t completion_code,
1515 struct pldm_msg *msg, size_t payload_length);
1516
1517 /** @brief Decode ApplyComplete request message
1518 *
1519 * @param[in] msg - Request message
1520 * @param[in] payload_length - Length of request message payload
1521 * @param[in] apply_result - Pointer to hold ApplyResult
1522 * @param[in] comp_activation_methods_modification - Pointer to hold the
1523 * ComponentActivationMethodsModification
1524 *
1525 * @return pldm_completion_codes
1526 */
1527 int decode_apply_complete_req(
1528 const struct pldm_msg *msg, size_t payload_length,
1529 uint8_t *apply_result,
1530 bitfield16_t *comp_activation_methods_modification);
1531
1532 /** @brief Create PLDM response message for ApplyComplete
1533 *
1534 * @param[in] instance_id - Message's instance id
1535 * @param[in] completion_code - CompletionCode
1536 * @param[in,out] msg - Message will be written to this
1537 * @param[in] payload_length - Length of response message payload
1538 *
1539 * @return pldm_completion_codes
1540 *
1541 * @note Caller is responsible for memory alloc and dealloc of param
1542 * 'msg.payload'
1543 */
1544 int encode_apply_complete_resp(uint8_t instance_id, uint8_t completion_code,
1545 struct pldm_msg *msg, size_t payload_length);
1546
1547 /** @brief Create PLDM request message for ActivateFirmware
1548 *
1549 * @param[in] instance_id - Message's instance id
1550 * @param[in] self_contained_activation_req SelfContainedActivationRequest
1551 * @param[in,out] msg - Message will be written to this
1552 * @param[in] payload_length - Length of request message payload
1553 *
1554 * @return pldm_completion_codes
1555 *
1556 * @note Caller is responsible for memory alloc and dealloc of param
1557 * 'msg.payload'
1558 */
1559 int encode_activate_firmware_req(uint8_t instance_id,
1560 bool8_t self_contained_activation_req,
1561 struct pldm_msg *msg, size_t payload_length);
1562
1563 /** @brief Decode ActivateFirmware response message
1564 *
1565 * @param[in] msg - Response message
1566 * @param[in] payload_length - Length of response message payload
1567 * @param[out] completion_code - Pointer to hold CompletionCode
1568 * @param[out] estimated_time_activation - Pointer to hold
1569 * EstimatedTimeForSelfContainedActivation
1570 *
1571 * @return pldm_completion_codes
1572 */
1573 int decode_activate_firmware_resp(const struct pldm_msg *msg,
1574 size_t payload_length,
1575 uint8_t *completion_code,
1576 uint16_t *estimated_time_activation);
1577
1578 /** @brief Create PLDM request message for GetStatus
1579 *
1580 * @param[in] instance_id - Message's instance id
1581 * @param[in,out] msg - Message will be written to this
1582 * @param[in] payload_length - Length of request message payload
1583 *
1584 * @return pldm_completion_codes
1585 *
1586 * @note Caller is responsible for memory alloc and dealloc of param
1587 * 'msg.payload'
1588 */
1589 int encode_get_status_req(uint8_t instance_id, struct pldm_msg *msg,
1590 size_t payload_length);
1591
1592 /** @brief Decode GetStatus response message
1593 *
1594 * @param[in] msg - Response message
1595 * @param[in] payload_length - Length of response message payload
1596 * @param[out] completion_code - Pointer to completion code
1597 * @param[out] current_state - Pointer to current state machine state
1598 * @param[out] previous_state - Pointer to previous different state machine
1599 * state
1600 * @param[out] aux_state - Pointer to current operation state of FD/FDP
1601 * @param[out] aux_state_status - Pointer to aux state status
1602 * @param[out] progress_percent - Pointer to progress percentage
1603 * @param[out] reason_code - Pointer to reason for entering current state
1604 * @param[out] update_option_flags_enabled - Pointer to update option flags
1605 * enabled
1606 *
1607 * @return pldm_completion_codes
1608 */
1609 int decode_get_status_resp(const struct pldm_msg *msg, size_t payload_length,
1610 uint8_t *completion_code, uint8_t *current_state,
1611 uint8_t *previous_state, uint8_t *aux_state,
1612 uint8_t *aux_state_status, uint8_t *progress_percent,
1613 uint8_t *reason_code,
1614 bitfield32_t *update_option_flags_enabled);
1615
1616 /** @brief Create PLDM request message for CancelUpdateComponent
1617 *
1618 * @param[in] instance_id - Message's instance id
1619 * @param[in,out] msg - Message will be written to this
1620 * @param[in] payload_length - Length of request message payload
1621 *
1622 * @return pldm_completion_codes
1623 *
1624 * @note Caller is responsible for memory alloc and dealloc of param
1625 * 'msg.payload'
1626 */
1627 int encode_cancel_update_component_req(uint8_t instance_id,
1628 struct pldm_msg *msg,
1629 size_t payload_length);
1630
1631 /** @brief Decode CancelUpdateComponent response message
1632 *
1633 * @param[in] msg - Response message
1634 * @param[in] payload_length - Length of response message payload
1635 * @param[out] completion_code - Pointer to the completion code
1636 *
1637 * @return pldm_completion_codes
1638 */
1639 int decode_cancel_update_component_resp(const struct pldm_msg *msg,
1640 size_t payload_length,
1641 uint8_t *completion_code);
1642
1643 /** @brief Create PLDM request message for CancelUpdate
1644 *
1645 * @param[in] instance_id - Message's instance id
1646 * @param[in,out] msg - Message will be written to this
1647 * @param[in] payload_length - Length of request message payload
1648 *
1649 * @return pldm_completion_codes
1650 *
1651 * @note Caller is responsible for memory alloc and dealloc of param
1652 * 'msg.payload'
1653 */
1654 int encode_cancel_update_req(uint8_t instance_id, struct pldm_msg *msg,
1655 size_t payload_length);
1656
1657 /** @brief Decode CancelUpdate response message
1658 *
1659 * @param[in] msg - Response message
1660 * @param[in] payload_length - Length of response message payload
1661 * @param[out] completion_code - Pointer to completion code
1662 * @param[out] non_functioning_component_indication - Pointer to non
1663 functioning
1664 * component indication
1665 * @param[out] non_functioning_component_bitmap - Pointer to non
1666 functioning
1667 * component bitmap
1668 *
1669 * @return pldm_completion_codes
1670 */
1671 int decode_cancel_update_resp(const struct pldm_msg *msg, size_t payload_length,
1672 uint8_t *completion_code,
1673 bool8_t *non_functioning_component_indication,
1674 bitfield64_t *non_functioning_component_bitmap);
1675
1676 #ifdef __cplusplus
1677 }
1678 #endif
1679
1680 #endif // End of FW_UPDATE_H
1681