gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 1 | #ifndef FW_UPDATE_H
|
| 2 | #define FW_UPDATE_H
|
| 3 |
|
| 4 | #ifdef __cplusplus
|
| 5 | extern "C" {
|
| 6 | #endif
|
| 7 | #include "base.h"
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 8 | #include "utils.h"
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 9 |
|
Tom Joseph | 568e470 | 2021-06-07 22:15:49 -0700 | [diff] [blame] | 10 | #define PLDM_FWUP_COMPONENT_BITMAP_MULTIPLE 8
|
Tom Joseph | 58cc172 | 2021-06-09 07:15:49 -0700 | [diff] [blame] | 11 | #define PLDM_FWUP_INVALID_COMPONENT_COMPARISON_TIMESTAMP 0xFFFFFFFF
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 12 | #define PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES 0
|
gokulsanker | eca3e19 | 2021-04-05 14:57:41 +0530 | [diff] [blame] | 13 | /** @brief Minimum length of device descriptor, 2 bytes for descriptor type,
|
| 14 | * 2 bytes for descriptor length and atleast 1 byte of descriptor data
|
| 15 | */
|
| 16 | #define PLDM_FWUP_DEVICE_DESCRIPTOR_MIN_LEN 5
|
gokulsanker | 981fbfb | 2021-04-05 15:17:25 +0530 | [diff] [blame] | 17 | #define PLDM_GET_FIRMWARE_PARAMETERS_REQ_BYTES 0
|
gokulsanker | d434edc | 2021-04-05 16:36:04 +0530 | [diff] [blame] | 18 | #define PLDM_FWUP_BASELINE_TRANSFER_SIZE 32
|
| 19 | #define PLDM_FWUP_MIN_OUTSTANDING_REQ 1
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 20 |
|
| 21 | /** @brief PLDM Firmware update commands
|
| 22 | */
|
gokulsanker | 981fbfb | 2021-04-05 15:17:25 +0530 | [diff] [blame] | 23 | enum pldm_firmware_update_commands {
|
| 24 | PLDM_QUERY_DEVICE_IDENTIFIERS = 0x01,
|
gokulsanker | d434edc | 2021-04-05 16:36:04 +0530 | [diff] [blame] | 25 | PLDM_GET_FIRMWARE_PARAMETERS = 0x02,
|
gokulsanker | 1b909d8 | 2021-04-05 17:26:02 +0530 | [diff] [blame] | 26 | PLDM_REQUEST_UPDATE = 0x10,
|
gokulsanker | aa3a5cd | 2021-04-22 11:06:42 +0530 | [diff] [blame] | 27 | PLDM_PASS_COMPONENT_TABLE = 0x13,
|
gokulsanker | 9c440d0 | 2021-06-03 09:54:02 +0530 | [diff] [blame] | 28 | PLDM_UPDATE_COMPONENT = 0x14,
|
gokulsanker | 50107cf | 2021-06-27 09:44:12 +0530 | [diff] [blame] | 29 | PLDM_REQUEST_FIRMWARE_DATA = 0x15,
|
gokulsanker | 9a69358 | 2021-06-27 11:35:09 +0530 | [diff] [blame] | 30 | PLDM_TRANSFER_COMPLETE = 0x16,
|
| 31 | PLDM_VERIFY_COMPLETE = 0x17
|
gokulsanker | 981fbfb | 2021-04-05 15:17:25 +0530 | [diff] [blame] | 32 | };
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 33 |
|
gokulsanker | 611238c | 2021-04-05 16:50:44 +0530 | [diff] [blame] | 34 | /** @brief PLDM Firmware update completion codes
|
| 35 | */
|
| 36 | enum pldm_firmware_update_completion_codes {
|
| 37 | PLDM_FWUP_NOT_IN_UPDATE_MODE = 0x80,
|
| 38 | PLDM_FWUP_ALREADY_IN_UPDATE_MODE = 0x81,
|
| 39 | PLDM_FWUP_DATA_OUT_OF_RANGE = 0x82,
|
| 40 | PLDM_FWUP_INVALID_TRANSFER_LENGTH = 0x83,
|
| 41 | PLDM_FWUP_INVALID_STATE_FOR_COMMAND = 0x84,
|
| 42 | PLDM_FWUP_INCOMPLETE_UPDATE = 0x85,
|
| 43 | PLDM_FWUP_BUSY_IN_BACKGROUND = 0x86,
|
| 44 | PLDM_FWUP_CANCEL_PENDING = 0x87,
|
| 45 | PLDM_FWUP_COMMAND_NOT_EXPECTED = 0x87,
|
| 46 | PLDM_FWUP_RETRY_REQUEST_FW_DATA = 0x89,
|
| 47 | PLDM_FWUP_UNABLE_TO_INITIATE_UPDATE = 0x8A,
|
| 48 | PLDM_FWUP_ACTIVATION_NOT_REQUIRED = 0x8B,
|
| 49 | PLDM_FWUP_SELF_CONTAINED_ACTIVATION_NOT_PERMITTED = 0x8C,
|
| 50 | PLDM_FWUP_NO_DEVICE_METADATA = 0x8D,
|
| 51 | PLDM_FWUP_RETRY_REQUEST_UPDATE = 0x8E,
|
| 52 | PLDM_FWUP_NO_PACKAGE_DATA = 0x8F,
|
| 53 | PLDM_FWUP_INVALID_TRANSFER_HANDLE = 0x90,
|
| 54 | PLDM_FWUP_INVALID_TRANSFER_OPERATION_FLAG = 0x91,
|
| 55 | PLDM_FWUP_ACTIVATE_PENDING_IMAGE_NOT_PERMITTED = 0x92,
|
| 56 | PLDM_FWUP_PACKAGE_DATA_ERROR = 0x93
|
| 57 | };
|
| 58 |
|
Tom Joseph | 763b51e | 2021-06-05 04:50:47 -0700 | [diff] [blame] | 59 | /** @brief String type values defined in the PLDM firmware update specification
|
| 60 | */
|
| 61 | enum pldm_firmware_update_string_type {
|
| 62 | PLDM_STR_TYPE_UNKNOWN = 0,
|
| 63 | PLDM_STR_TYPE_ASCII = 1,
|
| 64 | PLDM_STR_TYPE_UTF_8 = 2,
|
| 65 | PLDM_STR_TYPE_UTF_16 = 3,
|
| 66 | PLDM_STR_TYPE_UTF_16LE = 4,
|
| 67 | PLDM_STR_TYPE_UTF_16BE = 5
|
| 68 | };
|
| 69 |
|
| 70 | /** @brief Descriptor types defined in PLDM firmware update specification
|
| 71 | */
|
| 72 | enum pldm_firmware_update_descriptor_types {
|
| 73 | PLDM_FWUP_PCI_VENDOR_ID = 0x0000,
|
| 74 | PLDM_FWUP_IANA_ENTERPRISE_ID = 0x0001,
|
| 75 | PLDM_FWUP_UUID = 0x0002,
|
| 76 | PLDM_FWUP_PNP_VENDOR_ID = 0x0003,
|
| 77 | PLDM_FWUP_ACPI_VENDOR_ID = 0x0004,
|
| 78 | PLDM_FWUP_IEEE_ASSIGNED_COMPANY_ID = 0x0005,
|
| 79 | PLDM_FWUP_SCSI_VENDOR_ID = 0x0006,
|
| 80 | PLDM_FWUP_PCI_DEVICE_ID = 0x0100,
|
| 81 | PLDM_FWUP_PCI_SUBSYSTEM_VENDOR_ID = 0x0101,
|
| 82 | PLDM_FWUP_PCI_SUBSYSTEM_ID = 0x0102,
|
| 83 | PLDM_FWUP_PCI_REVISION_ID = 0x0103,
|
| 84 | PLDM_FWUP_PNP_PRODUCT_IDENTIFIER = 0x0104,
|
| 85 | PLDM_FWUP_ACPI_PRODUCT_IDENTIFIER = 0x0105,
|
| 86 | PLDM_FWUP_ASCII_MODEL_NUMBER_LONG_STRING = 0x0106,
|
| 87 | PLDM_FWUP_ASCII_MODEL_NUMBER_SHORT_STRING = 0x0107,
|
| 88 | PLDM_FWUP_SCSI_PRODUCT_ID = 0x0108,
|
| 89 | PLDM_FWUP_UBM_CONTROLLER_DEVICE_CODE = 0x0109,
|
| 90 | PLDM_FWUP_VENDOR_DEFINED = 0xFFFF
|
| 91 | };
|
| 92 |
|
| 93 | /** @brief Descriptor types length defined in PLDM firmware update specification
|
| 94 | */
|
| 95 | enum pldm_firmware_update_descriptor_types_length {
|
| 96 | PLDM_FWUP_PCI_VENDOR_ID_LENGTH = 2,
|
| 97 | PLDM_FWUP_IANA_ENTERPRISE_ID_LENGTH = 4,
|
| 98 | PLDM_FWUP_UUID_LENGTH = 16,
|
| 99 | PLDM_FWUP_PNP_VENDOR_ID_LENGTH = 3,
|
| 100 | PLDM_FWUP_ACPI_VENDOR_ID_LENGTH = 4,
|
| 101 | PLDM_FWUP_IEEE_ASSIGNED_COMPANY_ID_LENGTH = 3,
|
| 102 | PLDM_FWUP_SCSI_VENDOR_ID_LENGTH = 8,
|
| 103 | PLDM_FWUP_PCI_DEVICE_ID_LENGTH = 2,
|
| 104 | PLDM_FWUP_PCI_SUBSYSTEM_VENDOR_ID_LENGTH = 2,
|
| 105 | PLDM_FWUP_PCI_SUBSYSTEM_ID_LENGTH = 2,
|
| 106 | PLDM_FWUP_PCI_REVISION_ID_LENGTH = 1,
|
| 107 | PLDM_FWUP_PNP_PRODUCT_IDENTIFIER_LENGTH = 4,
|
| 108 | PLDM_FWUP_ACPI_PRODUCT_IDENTIFIER_LENGTH = 4,
|
| 109 | PLDM_FWUP_ASCII_MODEL_NUMBER_LONG_STRING_LENGTH = 40,
|
| 110 | PLDM_FWUP_ASCII_MODEL_NUMBER_SHORT_STRING_LENGTH = 10,
|
| 111 | PLDM_FWUP_SCSI_PRODUCT_ID_LENGTH = 16,
|
| 112 | PLDM_FWUP_UBM_CONTROLLER_DEVICE_CODE_LENGTH = 4
|
| 113 | };
|
| 114 |
|
gokulsanker | 1b909d8 | 2021-04-05 17:26:02 +0530 | [diff] [blame] | 115 | /** @brief ComponentClassification values defined in firmware update
|
| 116 | * specification
|
| 117 | */
|
| 118 | enum pldm_component_classification_values {
|
| 119 | PLDM_COMP_UNKNOWN = 0x0000,
|
| 120 | PLDM_COMP_OTHER = 0x0001,
|
| 121 | PLDM_COMP_DRIVER = 0x0002,
|
| 122 | PLDM_COMP_CONFIGURATION_SOFTWARE = 0x0003,
|
| 123 | PLDM_COMP_APPLICATION_SOFTWARE = 0x0004,
|
| 124 | PLDM_COMP_INSTRUMENTATION = 0x0005,
|
| 125 | PLDM_COMP_FIRMWARE_OR_BIOS = 0x0006,
|
| 126 | PLDM_COMP_DIAGNOSTIC_SOFTWARE = 0x0007,
|
| 127 | PLDM_COMP_OPERATING_SYSTEM = 0x0008,
|
| 128 | PLDM_COMP_MIDDLEWARE = 0x0009,
|
| 129 | PLDM_COMP_FIRMWARE = 0x000A,
|
| 130 | PLDM_COMP_BIOS_OR_FCODE = 0x000B,
|
| 131 | PLDM_COMP_SUPPORT_OR_SERVICEPACK = 0x000C,
|
| 132 | PLDM_COMP_SOFTWARE_BUNDLE = 0x000D,
|
| 133 | PLDM_COMP_DOWNSTREAM_DEVICE = 0xFFFF
|
| 134 | };
|
| 135 |
|
gokulsanker | 4687f24 | 2021-06-27 11:50:26 +0530 | [diff] [blame^] | 136 | /** @brief ComponentActivationMethods is the bit position in the bitfield that
|
| 137 | * provides the capability of the FD for firmware activation. Multiple
|
| 138 | * activation methods can be supported.
|
| 139 | */
|
| 140 | enum pldm_comp_activation_methods {
|
| 141 | PLDM_ACTIVATION_AUTOMATIC = 0,
|
| 142 | PLDM_ACTIVATION_SELF_CONTAINED = 1,
|
| 143 | PLDM_ACTIVATION_MEDIUM_SPECIFIC_RESET = 2,
|
| 144 | PLDM_ACTIVATION_SYSTEM_REBOOT = 3,
|
| 145 | PLDM_ACTIVATION_DC_POWER_CYCLE = 4,
|
| 146 | PLDM_ACTIVATION_AC_POWER_CYCLE = 5,
|
| 147 | PLDM_SUPPORTS_ACTIVATE_PENDING_IMAGE = 6,
|
| 148 | PLDM_SUPPORTS_ACTIVATE_PENDING_IMAGE_SET = 7
|
| 149 | };
|
| 150 |
|
gokulsanker | 566784b | 2021-04-05 17:47:04 +0530 | [diff] [blame] | 151 | /** @brief ComponentResponse values in the response of PassComponentTable
|
| 152 | */
|
| 153 | enum pldm_component_responses {
|
| 154 | PLDM_CR_COMP_CAN_BE_UPDATED = 0,
|
| 155 | PLDM_CR_COMP_MAY_BE_UPDATEABLE = 1
|
| 156 | };
|
| 157 |
|
| 158 | /** @brief ComponentResponseCode values in the response of PassComponentTable
|
| 159 | */
|
| 160 | enum pldm_component_response_codes {
|
| 161 | PLDM_CRC_COMP_CAN_BE_UPDATED = 0x00,
|
| 162 | PLDM_CRC_COMP_COMPARISON_STAMP_IDENTICAL = 0x01,
|
| 163 | PLDM_CRC_COMP_COMPARISON_STAMP_LOWER = 0x02,
|
| 164 | PLDM_CRC_INVALID_COMP_COMPARISON_STAMP = 0x03,
|
| 165 | PLDM_CRC_COMP_CONFLICT = 0x04,
|
| 166 | PLDM_CRC_COMP_PREREQUISITES_NOT_MET = 0x05,
|
| 167 | PLDM_CRC_COMP_NOT_SUPPORTED = 0x06,
|
| 168 | PLDM_CRC_COMP_SECURITY_RESTRICTIONS = 0x07,
|
| 169 | PLDM_CRC_INCOMPLETE_COMP_IMAGE_SET = 0x08,
|
| 170 | PLDM_CRC_ACTIVE_IMAGE_NOT_UPDATEABLE_SUBSEQUENTLY = 0x09,
|
| 171 | PLDM_CRC_COMP_VER_STR_IDENTICAL = 0x0A,
|
| 172 | PLDM_CRC_COMP_VER_STR_LOWER = 0x0B,
|
| 173 | PLDM_CRC_VENDOR_COMP_RESP_CODE_RANGE_MIN = 0xD0,
|
| 174 | PLDM_CRC_VENDOR_COMP_RESP_CODE_RANGE_MAX = 0xEF
|
| 175 | };
|
| 176 |
|
gokulsanker | 4b533f2 | 2021-04-22 12:53:00 +0530 | [diff] [blame] | 177 | /** @brief ComponentCompatibilityResponse values in the response of
|
| 178 | * UpdateComponent
|
| 179 | */
|
| 180 | enum pldm_component_compatability_responses {
|
| 181 | PLDM_CCR_COMP_CAN_BE_UPDATED = 0,
|
| 182 | PLDM_CCR_COMP_CANNOT_BE_UPDATED = 1
|
| 183 | };
|
| 184 |
|
| 185 | /** @brief ComponentCompatibilityResponse Code values in the response of
|
| 186 | * UpdateComponent
|
| 187 | */
|
| 188 | enum pldm_component_compatability_response_codes {
|
| 189 | PLDM_CCRC_NO_RESPONSE_CODE = 0x00,
|
| 190 | PLDM_CCRC_COMP_COMPARISON_STAMP_IDENTICAL = 0x01,
|
| 191 | PLDM_CCRC_COMP_COMPARISON_STAMP_LOWER = 0x02,
|
| 192 | PLDM_CCRC_INVALID_COMP_COMPARISON_STAMP = 0x03,
|
| 193 | PLDM_CCRC_COMP_CONFLICT = 0x04,
|
| 194 | PLDM_CCRC_COMP_PREREQUISITES_NOT_MET = 0x05,
|
| 195 | PLDM_CCRC_COMP_NOT_SUPPORTED = 0x06,
|
| 196 | PLDM_CCRC_COMP_SECURITY_RESTRICTIONS = 0x07,
|
| 197 | PLDM_CCRC_INCOMPLETE_COMP_IMAGE_SET = 0x08,
|
| 198 | PLDM_CCRC_COMP_INFO_NO_MATCH = 0x09,
|
| 199 | PLDM_CCRC_COMP_VER_STR_IDENTICAL = 0x0A,
|
| 200 | PLDM_CCRC_COMP_VER_STR_LOWER = 0x0B,
|
| 201 | PLDM_CCRC_VENDOR_COMP_RESP_CODE_RANGE_MIN = 0xD0,
|
| 202 | PLDM_CCRC_VENDOR_COMP_RESP_CODE_RANGE_MAX = 0xEF
|
| 203 | };
|
| 204 |
|
gokulsanker | e380702 | 2021-06-26 19:12:01 +0530 | [diff] [blame] | 205 | /** @brief Common error codes in TransferComplete, VerifyComplete and
|
| 206 | * ApplyComplete request
|
| 207 | */
|
| 208 | enum pldm_firmware_update_common_error_codes {
|
| 209 | PLDM_FWUP_TIME_OUT = 0x09,
|
| 210 | PLDM_FWUP_GENERIC_ERROR = 0x0A
|
| 211 | };
|
| 212 |
|
gokulsanker | 50107cf | 2021-06-27 09:44:12 +0530 | [diff] [blame] | 213 | /** @brief TransferResult values in the request of TransferComplete
|
gokulsanker | e380702 | 2021-06-26 19:12:01 +0530 | [diff] [blame] | 214 | */
|
gokulsanker | 50107cf | 2021-06-27 09:44:12 +0530 | [diff] [blame] | 215 | enum pldm_firmware_update_transfer_result_values {
|
gokulsanker | e380702 | 2021-06-26 19:12:01 +0530 | [diff] [blame] | 216 | PLDM_FWUP_TRANSFER_SUCCESS = 0x00,
|
| 217 | PLDM_FWUP_TRANSFER_ERROR_IMAGE_CORRUPT = 0x02,
|
| 218 | PLDM_FWUP_TRANSFER_ERROR_VERSION_MISMATCH = 0x02,
|
| 219 | PLDM_FWUP_FD_ABORTED_TRANSFER = 0x03,
|
| 220 | PLDM_FWUP_FD_ABORTED_TRANSFER_LOW_POWER_STATE = 0x0B,
|
| 221 | PLDM_FWUP_FD_ABORTED_TRANSFER_RESET_NEEDED = 0x0C,
|
| 222 | PLDM_FWUP_FD_ABORTED_TRANSFER_STORAGE_ISSUE = 0x0D,
|
| 223 | PLDM_FWUP_VENDOR_TRANSFER_RESULT_RANGE_MIN = 0x70,
|
| 224 | PLDM_FWUP_VENDOR_TRANSFER_RESULT_RANGE_MAX = 0x8F
|
| 225 | };
|
| 226 |
|
gokulsanker | 9a69358 | 2021-06-27 11:35:09 +0530 | [diff] [blame] | 227 | /**@brief VerifyResult values in the request of VerifyComplete
|
gokulsanker | b79b91a | 2021-06-27 11:26:36 +0530 | [diff] [blame] | 228 | */
|
| 229 | enum pldm_firmware_update_verify_result_values {
|
| 230 | PLDM_FWUP_VERIFY_SUCCESS = 0x00,
|
| 231 | PLDM_FWUP_VERIFY_ERROR_VERIFICATION_FAILURE = 0x01,
|
| 232 | PLDM_FWUP_VERIFY_ERROR_VERSION_MISMATCH = 0x02,
|
| 233 | PLDM_FWUP_VERIFY_FAILED_FD_SECURITY_CHECKS = 0x03,
|
| 234 | PLDM_FWUP_VERIFY_ERROR_IMAGE_INCOMPLETE = 0x04,
|
| 235 | PLDM_FWUP_VENDOR_VERIFY_RESULT_RANGE_MIN = 0x90,
|
| 236 | PLDM_FWUP_VENDOR_VERIFY_RESULT_RANGE_MAX = 0xAF
|
| 237 | };
|
| 238 |
|
gokulsanker | 4687f24 | 2021-06-27 11:50:26 +0530 | [diff] [blame^] | 239 | /**@brief ApplyResult values in the response of ApplyComplete
|
| 240 | */
|
| 241 | enum pldm_firmware_update_apply_result_values {
|
| 242 | PLDM_FWUP_APPLY_SUCCESS = 0x00,
|
| 243 | PLDM_FWUP_APPLY_SUCCESS_WITH_ACTIVATION_METHOD = 0x01,
|
| 244 | PLDM_FWUP_APPLY_FAILURE_MEMORY_ISSUE = 0x02,
|
| 245 | PLDM_FWUP_VENDOR_APPLY_RESULT_RANGE_MIN = 0xB0,
|
| 246 | PLDM_FWUP_VENDOR_APPLY_RESULT_RANGE_MAX = 0xCF
|
| 247 | };
|
| 248 |
|
Tom Joseph | 568e470 | 2021-06-07 22:15:49 -0700 | [diff] [blame] | 249 | /** @struct pldm_package_header_information
|
| 250 | *
|
| 251 | * Structure representing fixed part of package header information
|
| 252 | */
|
| 253 | struct pldm_package_header_information {
|
| 254 | uint8_t uuid[PLDM_FWUP_UUID_LENGTH];
|
| 255 | uint8_t package_header_format_version;
|
| 256 | uint16_t package_header_size;
|
| 257 | uint8_t timestamp104[PLDM_TIMESTAMP104_SIZE];
|
| 258 | uint16_t component_bitmap_bit_length;
|
| 259 | uint8_t package_version_string_type;
|
| 260 | uint8_t package_version_string_length;
|
| 261 | } __attribute__((packed));
|
| 262 |
|
Tom Joseph | 64af345 | 2021-06-08 04:05:28 -0700 | [diff] [blame] | 263 | /** @struct pldm_firmware_device_id_record
|
| 264 | *
|
| 265 | * Structure representing firmware device ID record
|
| 266 | */
|
| 267 | struct pldm_firmware_device_id_record {
|
| 268 | uint16_t record_length;
|
| 269 | uint8_t descriptor_count;
|
| 270 | bitfield32_t device_update_option_flags;
|
| 271 | uint8_t comp_image_set_version_string_type;
|
| 272 | uint8_t comp_image_set_version_string_length;
|
| 273 | uint16_t fw_device_pkg_data_length;
|
| 274 | } __attribute__((packed));
|
| 275 |
|
Tom Joseph | 763b51e | 2021-06-05 04:50:47 -0700 | [diff] [blame] | 276 | /** @struct pldm_descriptor_tlv
|
| 277 | *
|
| 278 | * Structure representing descriptor type, length and value
|
| 279 | */
|
| 280 | struct pldm_descriptor_tlv {
|
| 281 | uint16_t descriptor_type;
|
| 282 | uint16_t descriptor_length;
|
| 283 | uint8_t descriptor_data[1];
|
| 284 | } __attribute__((packed));
|
| 285 |
|
| 286 | /** @struct pldm_vendor_defined_descriptor_title_data
|
| 287 | *
|
| 288 | * Structure representing vendor defined descriptor title sections
|
| 289 | */
|
| 290 | struct pldm_vendor_defined_descriptor_title_data {
|
| 291 | uint8_t vendor_defined_descriptor_title_str_type;
|
| 292 | uint8_t vendor_defined_descriptor_title_str_len;
|
| 293 | uint8_t vendor_defined_descriptor_title_str[1];
|
| 294 | } __attribute__((packed));
|
| 295 |
|
Tom Joseph | 58cc172 | 2021-06-09 07:15:49 -0700 | [diff] [blame] | 296 | /** @struct pldm_component_image_information
|
| 297 | *
|
| 298 | * Structure representing fixed part of individual component information in
|
| 299 | * PLDM firmware update package
|
| 300 | */
|
| 301 | struct pldm_component_image_information {
|
| 302 | uint16_t comp_classification;
|
| 303 | uint16_t comp_identifier;
|
| 304 | uint32_t comp_comparison_stamp;
|
| 305 | bitfield16_t comp_options;
|
| 306 | bitfield16_t requested_comp_activation_method;
|
| 307 | uint32_t comp_location_offset;
|
| 308 | uint32_t comp_size;
|
| 309 | uint8_t comp_version_string_type;
|
| 310 | uint8_t comp_version_string_length;
|
| 311 | } __attribute__((packed));
|
| 312 |
|
gokulsanker | eca3e19 | 2021-04-05 14:57:41 +0530 | [diff] [blame] | 313 | /** @struct pldm_query_device_identifiers_resp
|
| 314 | *
|
| 315 | * Structure representing query device identifiers response.
|
| 316 | */
|
| 317 | struct pldm_query_device_identifiers_resp {
|
| 318 | uint8_t completion_code;
|
| 319 | uint32_t device_identifiers_len;
|
| 320 | uint8_t descriptor_count;
|
| 321 | } __attribute__((packed));
|
| 322 |
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 323 | /** @struct pldm_get_firmware_parameters_resp
|
| 324 | *
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 325 | * Structure representing the fixed part of GetFirmwareParameters response
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 326 | */
|
| 327 | struct pldm_get_firmware_parameters_resp {
|
| 328 | uint8_t completion_code;
|
| 329 | bitfield32_t capabilities_during_update;
|
| 330 | uint16_t comp_count;
|
| 331 | uint8_t active_comp_image_set_ver_str_type;
|
| 332 | uint8_t active_comp_image_set_ver_str_len;
|
| 333 | uint8_t pending_comp_image_set_ver_str_type;
|
| 334 | uint8_t pending_comp_image_set_ver_str_len;
|
| 335 | } __attribute__((packed));
|
| 336 |
|
gokulsanker | e1fb7a8 | 2021-04-05 16:09:29 +0530 | [diff] [blame] | 337 | /** @struct pldm_component_parameter_entry
|
| 338 | *
|
| 339 | * Structure representing component parameter table entry.
|
| 340 | */
|
| 341 | struct pldm_component_parameter_entry {
|
| 342 | uint16_t comp_classification;
|
| 343 | uint16_t comp_identifier;
|
| 344 | uint8_t comp_classification_index;
|
| 345 | uint32_t active_comp_comparison_stamp;
|
| 346 | uint8_t active_comp_ver_str_type;
|
| 347 | uint8_t active_comp_ver_str_len;
|
| 348 | uint8_t active_comp_release_date[8];
|
| 349 | uint32_t pending_comp_comparison_stamp;
|
| 350 | uint8_t pending_comp_ver_str_type;
|
| 351 | uint8_t pending_comp_ver_str_len;
|
| 352 | uint8_t pending_comp_release_date[8];
|
| 353 | bitfield16_t comp_activation_methods;
|
| 354 | bitfield32_t capabilities_during_update;
|
| 355 | } __attribute__((packed));
|
| 356 |
|
gokulsanker | d434edc | 2021-04-05 16:36:04 +0530 | [diff] [blame] | 357 | /** @struct pldm_request_update_req
|
| 358 | *
|
| 359 | * Structure representing fixed part of Request Update request
|
| 360 | */
|
| 361 | struct pldm_request_update_req {
|
| 362 | uint32_t max_transfer_size;
|
| 363 | uint16_t num_of_comp;
|
| 364 | uint8_t max_outstanding_transfer_req;
|
| 365 | uint16_t pkg_data_len;
|
| 366 | uint8_t comp_image_set_ver_str_type;
|
| 367 | uint8_t comp_image_set_ver_str_len;
|
| 368 | } __attribute__((packed));
|
| 369 |
|
gokulsanker | 611238c | 2021-04-05 16:50:44 +0530 | [diff] [blame] | 370 | /** @struct pldm_request_update_resp
|
| 371 | *
|
| 372 | * Structure representing Request Update response
|
| 373 | */
|
| 374 | struct pldm_request_update_resp {
|
| 375 | uint8_t completion_code;
|
| 376 | uint16_t fd_meta_data_len;
|
| 377 | uint8_t fd_will_send_pkg_data;
|
| 378 | } __attribute__((packed));
|
| 379 |
|
gokulsanker | 1b909d8 | 2021-04-05 17:26:02 +0530 | [diff] [blame] | 380 | /** @struct pldm_pass_component_table_req
|
| 381 | *
|
| 382 | * Structure representing PassComponentTable request
|
| 383 | */
|
| 384 | struct pldm_pass_component_table_req {
|
| 385 | uint8_t transfer_flag;
|
| 386 | uint16_t comp_classification;
|
| 387 | uint16_t comp_identifier;
|
| 388 | uint8_t comp_classification_index;
|
| 389 | uint32_t comp_comparison_stamp;
|
| 390 | uint8_t comp_ver_str_type;
|
| 391 | uint8_t comp_ver_str_len;
|
| 392 | } __attribute__((packed));
|
| 393 |
|
gokulsanker | 566784b | 2021-04-05 17:47:04 +0530 | [diff] [blame] | 394 | /** @struct pldm_pass_component_table_resp
|
| 395 | *
|
| 396 | * Structure representing PassComponentTable response
|
| 397 | */
|
| 398 | struct pldm_pass_component_table_resp {
|
| 399 | uint8_t completion_code;
|
| 400 | uint8_t comp_resp;
|
| 401 | uint8_t comp_resp_code;
|
| 402 | } __attribute__((packed));
|
| 403 |
|
gokulsanker | aa3a5cd | 2021-04-22 11:06:42 +0530 | [diff] [blame] | 404 | /** @struct pldm_update_component_req
|
| 405 | *
|
| 406 | * Structure representing UpdateComponent request
|
| 407 | */
|
| 408 | struct pldm_update_component_req {
|
| 409 | uint16_t comp_classification;
|
| 410 | uint16_t comp_identifier;
|
| 411 | uint8_t comp_classification_index;
|
| 412 | uint32_t comp_comparison_stamp;
|
| 413 | uint32_t comp_image_size;
|
| 414 | bitfield32_t update_option_flags;
|
| 415 | uint8_t comp_ver_str_type;
|
| 416 | uint8_t comp_ver_str_len;
|
| 417 | } __attribute__((packed));
|
| 418 |
|
gokulsanker | 4b533f2 | 2021-04-22 12:53:00 +0530 | [diff] [blame] | 419 | /** @struct pldm_update_component_resp
|
| 420 | *
|
| 421 | * Structure representing UpdateComponent response
|
| 422 | */
|
| 423 | struct pldm_update_component_resp {
|
| 424 | uint8_t completion_code;
|
| 425 | uint8_t comp_compatability_resp;
|
| 426 | uint8_t comp_compatability_resp_code;
|
| 427 | bitfield32_t update_option_flags_enabled;
|
| 428 | uint16_t time_before_req_fw_data;
|
| 429 | } __attribute__((packed));
|
| 430 |
|
gokulsanker | a4e6b29 | 2021-06-02 16:35:39 +0530 | [diff] [blame] | 431 | /** @struct pldm_request_firmware_data_req
|
| 432 | *
|
| 433 | * Structure representing RequestFirmwareData request.
|
| 434 | */
|
| 435 | struct pldm_request_firmware_data_req {
|
| 436 | uint32_t offset;
|
| 437 | uint32_t length;
|
| 438 | } __attribute__((packed));
|
| 439 |
|
gokulsanker | 4687f24 | 2021-06-27 11:50:26 +0530 | [diff] [blame^] | 440 | /** @struct pldm_apply_complete_req
|
| 441 | *
|
| 442 | * Structure representing ApplyComplete request.
|
| 443 | */
|
| 444 | struct pldm_apply_complete_req {
|
| 445 | uint8_t apply_result;
|
| 446 | bitfield16_t comp_activation_methods_modification;
|
| 447 | } __attribute__((packed));
|
| 448 |
|
Tom Joseph | 568e470 | 2021-06-07 22:15:49 -0700 | [diff] [blame] | 449 | /** @brief Decode the PLDM package header information
|
| 450 | *
|
| 451 | * @param[in] data - pointer to package header information
|
| 452 | * @param[in] length - available length in the firmware update package
|
| 453 | * @param[out] package_header_info - pointer to fixed part of PLDM package
|
| 454 | * header information
|
| 455 | * @param[out] package_version_str - pointer to package version string
|
| 456 | *
|
| 457 | * @return pldm_completion_codes
|
| 458 | */
|
| 459 | int decode_pldm_package_header_info(
|
| 460 | const uint8_t *data, size_t length,
|
| 461 | struct pldm_package_header_information *package_header_info,
|
| 462 | struct variable_field *package_version_str);
|
| 463 |
|
Tom Joseph | 64af345 | 2021-06-08 04:05:28 -0700 | [diff] [blame] | 464 | /** @brief Decode individual firmware device ID record
|
| 465 | *
|
| 466 | * @param[in] data - pointer to firmware device ID record
|
| 467 | * @param[in] length - available length in the firmware update package
|
| 468 | * @param[in] component_bitmap_bit_length - ComponentBitmapBitLengthfield
|
| 469 | * parsed from the package header info
|
| 470 | * @param[out] fw_device_id_record - pointer to fixed part of firmware device
|
| 471 | * id record
|
| 472 | * @param[out] applicable_components - pointer to ApplicableComponents
|
| 473 | * @param[out] comp_image_set_version_str - pointer to
|
| 474 | * ComponentImageSetVersionString
|
| 475 | * @param[out] record_descriptors - pointer to RecordDescriptors
|
| 476 | * @param[out] fw_device_pkg_data - pointer to FirmwareDevicePackageData
|
| 477 | *
|
| 478 | * @return pldm_completion_codes
|
| 479 | */
|
| 480 | int decode_firmware_device_id_record(
|
| 481 | const uint8_t *data, size_t length, uint16_t component_bitmap_bit_length,
|
| 482 | struct pldm_firmware_device_id_record *fw_device_id_record,
|
| 483 | struct variable_field *applicable_components,
|
| 484 | struct variable_field *comp_image_set_version_str,
|
| 485 | struct variable_field *record_descriptors,
|
| 486 | struct variable_field *fw_device_pkg_data);
|
| 487 |
|
Tom Joseph | 763b51e | 2021-06-05 04:50:47 -0700 | [diff] [blame] | 488 | /** @brief Decode the record descriptor entries in the firmware update package
|
| 489 | * and the Descriptors in the QueryDeviceIDentifiers command
|
| 490 | *
|
| 491 | * @param[in] data - pointer to descriptor entry
|
| 492 | * @param[in] length - remaining length of the descriptor data
|
| 493 | * @param[out] descriptor_type - pointer to descriptor type
|
| 494 | * @param[out] descriptor_data - pointer to descriptor data
|
| 495 | *
|
| 496 | * @return pldm_completion_codes
|
| 497 | */
|
| 498 | int decode_descriptor_type_length_value(const uint8_t *data, size_t length,
|
| 499 | uint16_t *descriptor_type,
|
| 500 | struct variable_field *descriptor_data);
|
| 501 |
|
| 502 | /** @brief Decode the vendor defined descriptor value
|
| 503 | *
|
| 504 | * @param[in] data - pointer to vendor defined descriptor value
|
| 505 | * @param[in] length - length of the vendor defined descriptor value
|
| 506 | * @param[out] descriptor_title_str_type - pointer to vendor defined descriptor
|
| 507 | * title string type
|
| 508 | * @param[out] descriptor_title_str - pointer to vendor defined descriptor
|
| 509 | * title string
|
| 510 | * @param[out] descriptor_data - pointer to vendor defined descriptor data
|
| 511 | *
|
| 512 | * @return pldm_completion_codes
|
| 513 | */
|
| 514 | int decode_vendor_defined_descriptor_value(
|
| 515 | const uint8_t *data, size_t length, uint8_t *descriptor_title_str_type,
|
| 516 | struct variable_field *descriptor_title_str,
|
| 517 | struct variable_field *descriptor_data);
|
| 518 |
|
Tom Joseph | 58cc172 | 2021-06-09 07:15:49 -0700 | [diff] [blame] | 519 | /** @brief Decode individual component image information
|
| 520 | *
|
| 521 | * @param[in] data - pointer to component image information
|
| 522 | * @param[in] length - available length in the firmware update package
|
| 523 | * @param[out] pldm_comp_image_info - pointer to fixed part of component image
|
| 524 | * information
|
| 525 | * @param[out] comp_version_str - pointer to component version string
|
| 526 | *
|
| 527 | * @return pldm_completion_codes
|
| 528 | */
|
| 529 | int decode_pldm_comp_image_info(
|
| 530 | const uint8_t *data, size_t length,
|
| 531 | struct pldm_component_image_information *pldm_comp_image_info,
|
| 532 | struct variable_field *comp_version_str);
|
| 533 |
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 534 | /** @brief Create a PLDM request message for QueryDeviceIdentifiers
|
| 535 | *
|
| 536 | * @param[in] instance_id - Message's instance id
|
| 537 | * @param[in] payload_length - Length of the request message payload
|
| 538 | * @param[in,out] msg - Message will be written to this
|
| 539 | *
|
| 540 | * @return pldm_completion_codes
|
| 541 | *
|
| 542 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 543 | * 'msg.payload'
|
| 544 | */
|
| 545 | int encode_query_device_identifiers_req(uint8_t instance_id,
|
| 546 | size_t payload_length,
|
| 547 | struct pldm_msg *msg);
|
gokulsanker | eca3e19 | 2021-04-05 14:57:41 +0530 | [diff] [blame] | 548 |
|
| 549 | /** @brief Decode QueryDeviceIdentifiers response message
|
| 550 | *
|
| 551 | * @param[in] msg - Response message
|
| 552 | * @param[in] payload_length - Length of response message payload
|
| 553 | * @param[out] completion_code - Pointer to response msg's PLDM completion code
|
| 554 | * @param[out] device_identifiers_len - Pointer to device identifiers length
|
| 555 | * @param[out] descriptor_count - Pointer to descriptor count
|
| 556 | * @param[out] descriptor_data - Pointer to descriptor data
|
| 557 | *
|
| 558 | * @return pldm_completion_codes
|
| 559 | */
|
| 560 | int decode_query_device_identifiers_resp(const struct pldm_msg *msg,
|
| 561 | size_t payload_length,
|
| 562 | uint8_t *completion_code,
|
| 563 | uint32_t *device_identifiers_len,
|
| 564 | uint8_t *descriptor_count,
|
| 565 | uint8_t **descriptor_data);
|
gokulsanker | 981fbfb | 2021-04-05 15:17:25 +0530 | [diff] [blame] | 566 |
|
| 567 | /** @brief Create a PLDM request message for GetFirmwareParameters
|
| 568 | *
|
| 569 | * @param[in] instance_id - Message's instance id
|
| 570 | * @param[in] payload_length - Length of the request message payload
|
| 571 | * @param[in,out] msg - Message will be written to this
|
| 572 | *
|
| 573 | * @return pldm_completion_codes
|
| 574 | *
|
| 575 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 576 | * 'msg.payload'
|
| 577 | */
|
| 578 | int encode_get_firmware_parameters_req(uint8_t instance_id,
|
| 579 | size_t payload_length,
|
| 580 | struct pldm_msg *msg);
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 581 |
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 582 | /** @brief Decode GetFirmwareParameters response
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 583 | *
|
| 584 | * @param[in] msg - Response message
|
| 585 | * @param[in] payload_length - Length of response message payload
|
| 586 | * @param[out] resp_data - Pointer to get firmware parameters response
|
| 587 | * @param[out] active_comp_image_set_ver_str - Pointer to active component
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 588 | * image set version string
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 589 | * @param[out] pending_comp_image_set_ver_str - Pointer to pending component
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 590 | * image set version string
|
| 591 | * @param[out] comp_parameter_table - Pointer to component parameter table
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 592 | *
|
| 593 | * @return pldm_completion_codes
|
| 594 | */
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 595 | int decode_get_firmware_parameters_resp(
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 596 | const struct pldm_msg *msg, size_t payload_length,
|
| 597 | struct pldm_get_firmware_parameters_resp *resp_data,
|
| 598 | struct variable_field *active_comp_image_set_ver_str,
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 599 | struct variable_field *pending_comp_image_set_ver_str,
|
| 600 | struct variable_field *comp_parameter_table);
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 601 |
|
gokulsanker | e1fb7a8 | 2021-04-05 16:09:29 +0530 | [diff] [blame] | 602 | /** @brief Decode component entries in the component parameter table which is
|
| 603 | * part of the response of GetFirmwareParameters command
|
| 604 | *
|
| 605 | * @param[in] data - Component entry
|
| 606 | * @param[in] length - Length of component entry
|
| 607 | * @param[out] component_data - Pointer to component parameter table
|
| 608 | * @param[out] active_comp_ver_str - Pointer to active component version string
|
| 609 | * @param[out] pending_comp_ver_str - Pointer to pending component version
|
| 610 | * string
|
| 611 | *
|
| 612 | * @return pldm_completion_codes
|
| 613 | */
|
| 614 | int decode_get_firmware_parameters_resp_comp_entry(
|
| 615 | const uint8_t *data, size_t length,
|
| 616 | struct pldm_component_parameter_entry *component_data,
|
| 617 | struct variable_field *active_comp_ver_str,
|
| 618 | struct variable_field *pending_comp_ver_str);
|
| 619 |
|
gokulsanker | d434edc | 2021-04-05 16:36:04 +0530 | [diff] [blame] | 620 | /** @brief Create PLDM request message for RequestUpdate
|
| 621 | *
|
| 622 | * @param[in] instance_id - Message's instance id
|
| 623 | * @param[in] max_transfer_size - Maximum size of the variable payload allowed
|
| 624 | * to be requested via RequestFirmwareData
|
| 625 | * command
|
| 626 | * @param[in] num_of_comp - Total number of components that will be passed to
|
| 627 | * the FD during the update
|
| 628 | * @param[in] max_outstanding_transfer_req - Total number of outstanding
|
| 629 | * RequestFirmwareData
|
| 630 | * commands that can be sent by the FD
|
| 631 | * @param[in] pkg_data_len - Value of the FirmwareDevicePackageDataLength field
|
| 632 | * present in firmware package header
|
| 633 | * @param[in] comp_image_set_ver_str_type - StringType of
|
| 634 | * ComponentImageSetVersionString
|
| 635 | * @param[in] comp_image_set_ver_str_len - The length of the
|
| 636 | * ComponentImageSetVersionString
|
| 637 | * @param[in] comp_img_set_ver_str - Component Image Set version information
|
| 638 | * @param[in,out] msg - Message will be written to this
|
| 639 | * @param[in] payload_length - Length of request message payload
|
| 640 | *
|
| 641 | * @return pldm_completion_codes
|
| 642 | *
|
| 643 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 644 | * 'msg.payload'
|
| 645 | */
|
| 646 | int encode_request_update_req(uint8_t instance_id, uint32_t max_transfer_size,
|
| 647 | uint16_t num_of_comp,
|
| 648 | uint8_t max_outstanding_transfer_req,
|
| 649 | uint16_t pkg_data_len,
|
| 650 | uint8_t comp_image_set_ver_str_type,
|
| 651 | uint8_t comp_image_set_ver_str_len,
|
| 652 | const struct variable_field *comp_img_set_ver_str,
|
| 653 | struct pldm_msg *msg, size_t payload_length);
|
gokulsanker | 611238c | 2021-04-05 16:50:44 +0530 | [diff] [blame] | 654 |
|
| 655 | /** @brief Decode a RequestUpdate response message
|
| 656 | *
|
| 657 | * @param[in] msg - Response message
|
| 658 | * @param[in] payload_length - Length of response message payload
|
| 659 | * @param[out] completion_code - Pointer to hold the completion code
|
| 660 | * @param[out] fd_meta_data_len - Pointer to hold the length of FD metadata
|
| 661 | * @param[out] fd_will_send_pkg_data - Pointer to hold information whether FD
|
| 662 | * will send GetPackageData command
|
| 663 | * @return pldm_completion_codes
|
| 664 | */
|
| 665 | int decode_request_update_resp(const struct pldm_msg *msg,
|
| 666 | size_t payload_length, uint8_t *completion_code,
|
| 667 | uint16_t *fd_meta_data_len,
|
| 668 | uint8_t *fd_will_send_pkg_data);
|
| 669 |
|
gokulsanker | 1b909d8 | 2021-04-05 17:26:02 +0530 | [diff] [blame] | 670 | /** @brief Create PLDM request message for PassComponentTable
|
| 671 | *
|
| 672 | * @param[in] instance_id - Message's instance id
|
| 673 | * @param[in] transfer_flag - TransferFlag
|
| 674 | * @param[in] comp_classification - ComponentClassification
|
| 675 | * @param[in] comp_identifier - ComponentIdentifier
|
| 676 | * @param[in] comp_classification_index - ComponentClassificationIndex
|
| 677 | * @param[in] comp_comparison_stamp - ComponentComparisonStamp
|
| 678 | * @param[in] comp_ver_str_type - ComponentVersionStringType
|
| 679 | * @param[in] comp_ver_str_len - ComponentVersionStringLength
|
| 680 | * @param[in] comp_ver_str - ComponentVersionString
|
| 681 | * @param[in,out] msg - Message will be written to this
|
| 682 | * @param[in] payload_length - Length of request message payload
|
| 683 | * information
|
| 684 | *
|
| 685 | * @return pldm_completion_codes
|
| 686 | *
|
| 687 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 688 | * 'msg.payload'
|
| 689 | */
|
| 690 | int encode_pass_component_table_req(
|
| 691 | uint8_t instance_id, uint8_t transfer_flag, uint16_t comp_classification,
|
| 692 | uint16_t comp_identifier, uint8_t comp_classification_index,
|
| 693 | uint32_t comp_comparison_stamp, uint8_t comp_ver_str_type,
|
| 694 | uint8_t comp_ver_str_len, const struct variable_field *comp_ver_str,
|
| 695 | struct pldm_msg *msg, size_t payload_length);
|
| 696 |
|
gokulsanker | 566784b | 2021-04-05 17:47:04 +0530 | [diff] [blame] | 697 | /** @brief Decode PassComponentTable response message
|
| 698 | *
|
| 699 | * @param[in] msg - Response message
|
| 700 | * @param[in] payload_length - Length of response message payload
|
| 701 | * @param[out] completion_code - Pointer to hold completion code
|
| 702 | * @param[out] comp_resp - Pointer to hold component response
|
| 703 | * @param[out] comp_resp_code - Pointer to hold component response code
|
| 704 | *
|
| 705 | * @return pldm_completion_codes
|
| 706 | */
|
| 707 | int decode_pass_component_table_resp(const struct pldm_msg *msg,
|
| 708 | size_t payload_length,
|
| 709 | uint8_t *completion_code,
|
| 710 | uint8_t *comp_resp,
|
| 711 | uint8_t *comp_resp_code);
|
| 712 |
|
gokulsanker | aa3a5cd | 2021-04-22 11:06:42 +0530 | [diff] [blame] | 713 | /** @brief Create PLDM request message for UpdateComponent
|
| 714 | *
|
| 715 | * @param[in] instance_id - Message's instance id
|
| 716 | * @param[in] comp_classification - ComponentClassification
|
| 717 | * @param[in] comp_identifier - ComponentIdentifier
|
| 718 | * @param[in] comp_classification_index - ComponentClassificationIndex
|
| 719 | * @param[in] comp_comparison_stamp - ComponentComparisonStamp
|
| 720 | * @param[in] comp_image_size - ComponentImageSize
|
| 721 | * @param[in] update_option_flags - UpdateOptionFlags
|
| 722 | * @param[in] comp_ver_str_type - ComponentVersionStringType
|
| 723 | * @param[in] comp_ver_str_len - ComponentVersionStringLength
|
| 724 | * @param[in] comp_ver_str - ComponentVersionString
|
| 725 | * @param[in,out] msg - Message will be written to this
|
| 726 | * @param[in] payload_length - Length of request message payload
|
| 727 | * information
|
| 728 | *
|
| 729 | * @return pldm_completion_codes
|
| 730 | *
|
| 731 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 732 | * 'msg.payload'
|
| 733 | */
|
| 734 | int encode_update_component_req(
|
| 735 | uint8_t instance_id, uint16_t comp_classification, uint16_t comp_identifier,
|
| 736 | uint8_t comp_classification_index, uint32_t comp_comparison_stamp,
|
| 737 | uint32_t comp_image_size, bitfield32_t update_option_flags,
|
| 738 | uint8_t comp_ver_str_type, uint8_t comp_ver_str_len,
|
| 739 | const struct variable_field *comp_ver_str, struct pldm_msg *msg,
|
| 740 | size_t payload_length);
|
| 741 |
|
gokulsanker | 4b533f2 | 2021-04-22 12:53:00 +0530 | [diff] [blame] | 742 | /** @brief Decode UpdateComponent response message
|
| 743 | *
|
| 744 | * @param[in] msg - Response message
|
| 745 | * @param[in] payload_length - Length of response message payload
|
| 746 | * @param[out] completion_code - Pointer to hold completion code
|
| 747 | * @param[out] comp_compatability_resp - Pointer to hold component
|
| 748 | * compatibility response
|
| 749 | * @param[out] comp_compatability_resp_code - Pointer to hold component
|
| 750 | * compatibility response code
|
| 751 | * @param[out] update_option_flags_enabled - Pointer to hold
|
| 752 | * UpdateOptionsFlagEnabled
|
| 753 | * @param[out] time_before_req_fw_data - Pointer to hold the estimated time
|
| 754 | * before sending RequestFirmwareData
|
| 755 | *
|
| 756 | * @return pldm_completion_codes
|
| 757 | */
|
| 758 | int decode_update_component_resp(const struct pldm_msg *msg,
|
| 759 | size_t payload_length,
|
| 760 | uint8_t *completion_code,
|
| 761 | uint8_t *comp_compatability_resp,
|
| 762 | uint8_t *comp_compatability_resp_code,
|
| 763 | bitfield32_t *update_option_flags_enabled,
|
| 764 | uint16_t *time_before_req_fw_data);
|
gokulsanker | a4e6b29 | 2021-06-02 16:35:39 +0530 | [diff] [blame] | 765 |
|
| 766 | /** @brief Decode RequestFirmwareData request message
|
| 767 | *
|
| 768 | * @param[in] msg - Request message
|
| 769 | * @param[in] payload_length - Length of request message payload
|
| 770 | * @param[out] offset - Pointer to hold offset
|
| 771 | * @param[out] length - Pointer to hold the size of the component image
|
| 772 | * segment requested by the FD/FDP
|
| 773 | *
|
| 774 | * @return pldm_completion_codes
|
| 775 | */
|
| 776 | int decode_request_firmware_data_req(const struct pldm_msg *msg,
|
| 777 | size_t payload_length, uint32_t *offset,
|
| 778 | uint32_t *length);
|
gokulsanker | 9c440d0 | 2021-06-03 09:54:02 +0530 | [diff] [blame] | 779 |
|
| 780 | /** @brief Create PLDM response message for RequestFirmwareData
|
| 781 | *
|
| 782 | * The ComponentImagePortion is not encoded in the PLDM response message
|
| 783 | * by encode_request_firmware_data_resp to avoid an additional copy. Populating
|
| 784 | * ComponentImagePortion in the PLDM response message is handled by the user
|
| 785 | * of this API. The payload_length validation considers only the
|
| 786 | * CompletionCode.
|
| 787 | *
|
| 788 | * @param[in] instance_id - Message's instance id
|
| 789 | * @param[in] completion_code - CompletionCode
|
| 790 | * @param[in,out] msg - Message will be written to this
|
| 791 | * @param[in] payload_length - Length of response message payload
|
| 792 | *
|
| 793 | * @return pldm_completion_codes
|
| 794 | *
|
| 795 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 796 | * 'msg.payload'
|
| 797 | */
|
| 798 | int encode_request_firmware_data_resp(uint8_t instance_id,
|
| 799 | uint8_t completion_code,
|
| 800 | struct pldm_msg *msg,
|
| 801 | size_t payload_length);
|
| 802 |
|
gokulsanker | e380702 | 2021-06-26 19:12:01 +0530 | [diff] [blame] | 803 | /** @brief Decode TransferComplete request message
|
| 804 | *
|
| 805 | * @param[in] msg - Request message
|
| 806 | * @param[in] payload_length - Length of request message payload
|
| 807 | * @param[out] transfer_result - Pointer to hold TransferResult
|
| 808 | *
|
| 809 | * @return pldm_completion_codes
|
| 810 | */
|
| 811 | int decode_transfer_complete_req(const struct pldm_msg *msg,
|
| 812 | size_t payload_length,
|
| 813 | uint8_t *transfer_result);
|
gokulsanker | 50107cf | 2021-06-27 09:44:12 +0530 | [diff] [blame] | 814 |
|
| 815 | /** @brief Create PLDM response message for TransferComplete
|
| 816 | *
|
| 817 | * @param[in] instance_id - Message's instance id
|
| 818 | * @param[in] completion_code - CompletionCode
|
| 819 | * @param[in,out] msg - Message will be written to this
|
| 820 | * @param[in] payload_length - Length of response message payload
|
| 821 | *
|
| 822 | * @return pldm_completion_codes
|
| 823 | *
|
| 824 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 825 | * 'msg.payload'
|
| 826 | */
|
| 827 | int encode_transfer_complete_resp(uint8_t instance_id, uint8_t completion_code,
|
| 828 | struct pldm_msg *msg, size_t payload_length);
|
gokulsanker | b79b91a | 2021-06-27 11:26:36 +0530 | [diff] [blame] | 829 |
|
| 830 | /** @brief Decode VerifyComplete request message
|
| 831 | *
|
| 832 | * @param[in] msg - Request message
|
| 833 | * @param[in] payload_length - Length of request message payload
|
| 834 | * @param[in] verify_result - Pointer to hold VerifyResult
|
| 835 | *
|
| 836 | * @return pldm_completion_codes
|
| 837 | */
|
| 838 | int decode_verify_complete_req(const struct pldm_msg *msg,
|
| 839 | size_t payload_length, uint8_t *verify_result);
|
| 840 |
|
gokulsanker | 9a69358 | 2021-06-27 11:35:09 +0530 | [diff] [blame] | 841 | /** @brief Create PLDM response message for VerifyComplete
|
| 842 | *
|
| 843 | * @param[in] instance_id - Message's instance id
|
| 844 | * @param[in] completion_code - CompletionCode
|
| 845 | * @param[in,out] msg - Message will be written to this
|
| 846 | * @param[in] payload_length - Length of response message payload
|
| 847 | *
|
| 848 | * @return pldm_completion_codes
|
| 849 | *
|
| 850 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 851 | * 'msg.payload'
|
| 852 | */
|
| 853 | int encode_verify_complete_resp(uint8_t instance_id, uint8_t completion_code,
|
| 854 | struct pldm_msg *msg, size_t payload_length);
|
| 855 |
|
gokulsanker | 4687f24 | 2021-06-27 11:50:26 +0530 | [diff] [blame^] | 856 | /** @brief Decode ApplyComplete request message
|
| 857 | *
|
| 858 | * @param[in] msg - Request message
|
| 859 | * @param[in] payload_length - Length of request message payload
|
| 860 | * @param[in] apply_result - Pointer to hold ApplyResult
|
| 861 | * @param[in] comp_activation_methods_modification - Pointer to hold the
|
| 862 | * ComponentActivationMethodsModification
|
| 863 | *
|
| 864 | * @return pldm_completion_codes
|
| 865 | */
|
| 866 | int decode_apply_complete_req(
|
| 867 | const struct pldm_msg *msg, size_t payload_length, uint8_t *apply_result,
|
| 868 | bitfield16_t *comp_activation_methods_modification);
|
| 869 |
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 870 | #ifdef __cplusplus
|
| 871 | }
|
| 872 | #endif
|
| 873 |
|
| 874 | #endif // End of FW_UPDATE_H
|