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,
|
| 28 | PLDM_UPDATE_COMPONENT = 0x14
|
gokulsanker | 981fbfb | 2021-04-05 15:17:25 +0530 | [diff] [blame] | 29 | };
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 30 |
|
gokulsanker | 611238c | 2021-04-05 16:50:44 +0530 | [diff] [blame] | 31 | /** @brief PLDM Firmware update completion codes
|
| 32 | */
|
| 33 | enum pldm_firmware_update_completion_codes {
|
| 34 | PLDM_FWUP_NOT_IN_UPDATE_MODE = 0x80,
|
| 35 | PLDM_FWUP_ALREADY_IN_UPDATE_MODE = 0x81,
|
| 36 | PLDM_FWUP_DATA_OUT_OF_RANGE = 0x82,
|
| 37 | PLDM_FWUP_INVALID_TRANSFER_LENGTH = 0x83,
|
| 38 | PLDM_FWUP_INVALID_STATE_FOR_COMMAND = 0x84,
|
| 39 | PLDM_FWUP_INCOMPLETE_UPDATE = 0x85,
|
| 40 | PLDM_FWUP_BUSY_IN_BACKGROUND = 0x86,
|
| 41 | PLDM_FWUP_CANCEL_PENDING = 0x87,
|
| 42 | PLDM_FWUP_COMMAND_NOT_EXPECTED = 0x87,
|
| 43 | PLDM_FWUP_RETRY_REQUEST_FW_DATA = 0x89,
|
| 44 | PLDM_FWUP_UNABLE_TO_INITIATE_UPDATE = 0x8A,
|
| 45 | PLDM_FWUP_ACTIVATION_NOT_REQUIRED = 0x8B,
|
| 46 | PLDM_FWUP_SELF_CONTAINED_ACTIVATION_NOT_PERMITTED = 0x8C,
|
| 47 | PLDM_FWUP_NO_DEVICE_METADATA = 0x8D,
|
| 48 | PLDM_FWUP_RETRY_REQUEST_UPDATE = 0x8E,
|
| 49 | PLDM_FWUP_NO_PACKAGE_DATA = 0x8F,
|
| 50 | PLDM_FWUP_INVALID_TRANSFER_HANDLE = 0x90,
|
| 51 | PLDM_FWUP_INVALID_TRANSFER_OPERATION_FLAG = 0x91,
|
| 52 | PLDM_FWUP_ACTIVATE_PENDING_IMAGE_NOT_PERMITTED = 0x92,
|
| 53 | PLDM_FWUP_PACKAGE_DATA_ERROR = 0x93
|
| 54 | };
|
| 55 |
|
Tom Joseph | 763b51e | 2021-06-05 04:50:47 -0700 | [diff] [blame] | 56 | /** @brief String type values defined in the PLDM firmware update specification
|
| 57 | */
|
| 58 | enum pldm_firmware_update_string_type {
|
| 59 | PLDM_STR_TYPE_UNKNOWN = 0,
|
| 60 | PLDM_STR_TYPE_ASCII = 1,
|
| 61 | PLDM_STR_TYPE_UTF_8 = 2,
|
| 62 | PLDM_STR_TYPE_UTF_16 = 3,
|
| 63 | PLDM_STR_TYPE_UTF_16LE = 4,
|
| 64 | PLDM_STR_TYPE_UTF_16BE = 5
|
| 65 | };
|
| 66 |
|
| 67 | /** @brief Descriptor types defined in PLDM firmware update specification
|
| 68 | */
|
| 69 | enum pldm_firmware_update_descriptor_types {
|
| 70 | PLDM_FWUP_PCI_VENDOR_ID = 0x0000,
|
| 71 | PLDM_FWUP_IANA_ENTERPRISE_ID = 0x0001,
|
| 72 | PLDM_FWUP_UUID = 0x0002,
|
| 73 | PLDM_FWUP_PNP_VENDOR_ID = 0x0003,
|
| 74 | PLDM_FWUP_ACPI_VENDOR_ID = 0x0004,
|
| 75 | PLDM_FWUP_IEEE_ASSIGNED_COMPANY_ID = 0x0005,
|
| 76 | PLDM_FWUP_SCSI_VENDOR_ID = 0x0006,
|
| 77 | PLDM_FWUP_PCI_DEVICE_ID = 0x0100,
|
| 78 | PLDM_FWUP_PCI_SUBSYSTEM_VENDOR_ID = 0x0101,
|
| 79 | PLDM_FWUP_PCI_SUBSYSTEM_ID = 0x0102,
|
| 80 | PLDM_FWUP_PCI_REVISION_ID = 0x0103,
|
| 81 | PLDM_FWUP_PNP_PRODUCT_IDENTIFIER = 0x0104,
|
| 82 | PLDM_FWUP_ACPI_PRODUCT_IDENTIFIER = 0x0105,
|
| 83 | PLDM_FWUP_ASCII_MODEL_NUMBER_LONG_STRING = 0x0106,
|
| 84 | PLDM_FWUP_ASCII_MODEL_NUMBER_SHORT_STRING = 0x0107,
|
| 85 | PLDM_FWUP_SCSI_PRODUCT_ID = 0x0108,
|
| 86 | PLDM_FWUP_UBM_CONTROLLER_DEVICE_CODE = 0x0109,
|
| 87 | PLDM_FWUP_VENDOR_DEFINED = 0xFFFF
|
| 88 | };
|
| 89 |
|
| 90 | /** @brief Descriptor types length defined in PLDM firmware update specification
|
| 91 | */
|
| 92 | enum pldm_firmware_update_descriptor_types_length {
|
| 93 | PLDM_FWUP_PCI_VENDOR_ID_LENGTH = 2,
|
| 94 | PLDM_FWUP_IANA_ENTERPRISE_ID_LENGTH = 4,
|
| 95 | PLDM_FWUP_UUID_LENGTH = 16,
|
| 96 | PLDM_FWUP_PNP_VENDOR_ID_LENGTH = 3,
|
| 97 | PLDM_FWUP_ACPI_VENDOR_ID_LENGTH = 4,
|
| 98 | PLDM_FWUP_IEEE_ASSIGNED_COMPANY_ID_LENGTH = 3,
|
| 99 | PLDM_FWUP_SCSI_VENDOR_ID_LENGTH = 8,
|
| 100 | PLDM_FWUP_PCI_DEVICE_ID_LENGTH = 2,
|
| 101 | PLDM_FWUP_PCI_SUBSYSTEM_VENDOR_ID_LENGTH = 2,
|
| 102 | PLDM_FWUP_PCI_SUBSYSTEM_ID_LENGTH = 2,
|
| 103 | PLDM_FWUP_PCI_REVISION_ID_LENGTH = 1,
|
| 104 | PLDM_FWUP_PNP_PRODUCT_IDENTIFIER_LENGTH = 4,
|
| 105 | PLDM_FWUP_ACPI_PRODUCT_IDENTIFIER_LENGTH = 4,
|
| 106 | PLDM_FWUP_ASCII_MODEL_NUMBER_LONG_STRING_LENGTH = 40,
|
| 107 | PLDM_FWUP_ASCII_MODEL_NUMBER_SHORT_STRING_LENGTH = 10,
|
| 108 | PLDM_FWUP_SCSI_PRODUCT_ID_LENGTH = 16,
|
| 109 | PLDM_FWUP_UBM_CONTROLLER_DEVICE_CODE_LENGTH = 4
|
| 110 | };
|
| 111 |
|
gokulsanker | 1b909d8 | 2021-04-05 17:26:02 +0530 | [diff] [blame] | 112 | /** @brief ComponentClassification values defined in firmware update
|
| 113 | * specification
|
| 114 | */
|
| 115 | enum pldm_component_classification_values {
|
| 116 | PLDM_COMP_UNKNOWN = 0x0000,
|
| 117 | PLDM_COMP_OTHER = 0x0001,
|
| 118 | PLDM_COMP_DRIVER = 0x0002,
|
| 119 | PLDM_COMP_CONFIGURATION_SOFTWARE = 0x0003,
|
| 120 | PLDM_COMP_APPLICATION_SOFTWARE = 0x0004,
|
| 121 | PLDM_COMP_INSTRUMENTATION = 0x0005,
|
| 122 | PLDM_COMP_FIRMWARE_OR_BIOS = 0x0006,
|
| 123 | PLDM_COMP_DIAGNOSTIC_SOFTWARE = 0x0007,
|
| 124 | PLDM_COMP_OPERATING_SYSTEM = 0x0008,
|
| 125 | PLDM_COMP_MIDDLEWARE = 0x0009,
|
| 126 | PLDM_COMP_FIRMWARE = 0x000A,
|
| 127 | PLDM_COMP_BIOS_OR_FCODE = 0x000B,
|
| 128 | PLDM_COMP_SUPPORT_OR_SERVICEPACK = 0x000C,
|
| 129 | PLDM_COMP_SOFTWARE_BUNDLE = 0x000D,
|
| 130 | PLDM_COMP_DOWNSTREAM_DEVICE = 0xFFFF
|
| 131 | };
|
| 132 |
|
gokulsanker | 566784b | 2021-04-05 17:47:04 +0530 | [diff] [blame] | 133 | /** @brief ComponentResponse values in the response of PassComponentTable
|
| 134 | */
|
| 135 | enum pldm_component_responses {
|
| 136 | PLDM_CR_COMP_CAN_BE_UPDATED = 0,
|
| 137 | PLDM_CR_COMP_MAY_BE_UPDATEABLE = 1
|
| 138 | };
|
| 139 |
|
| 140 | /** @brief ComponentResponseCode values in the response of PassComponentTable
|
| 141 | */
|
| 142 | enum pldm_component_response_codes {
|
| 143 | PLDM_CRC_COMP_CAN_BE_UPDATED = 0x00,
|
| 144 | PLDM_CRC_COMP_COMPARISON_STAMP_IDENTICAL = 0x01,
|
| 145 | PLDM_CRC_COMP_COMPARISON_STAMP_LOWER = 0x02,
|
| 146 | PLDM_CRC_INVALID_COMP_COMPARISON_STAMP = 0x03,
|
| 147 | PLDM_CRC_COMP_CONFLICT = 0x04,
|
| 148 | PLDM_CRC_COMP_PREREQUISITES_NOT_MET = 0x05,
|
| 149 | PLDM_CRC_COMP_NOT_SUPPORTED = 0x06,
|
| 150 | PLDM_CRC_COMP_SECURITY_RESTRICTIONS = 0x07,
|
| 151 | PLDM_CRC_INCOMPLETE_COMP_IMAGE_SET = 0x08,
|
| 152 | PLDM_CRC_ACTIVE_IMAGE_NOT_UPDATEABLE_SUBSEQUENTLY = 0x09,
|
| 153 | PLDM_CRC_COMP_VER_STR_IDENTICAL = 0x0A,
|
| 154 | PLDM_CRC_COMP_VER_STR_LOWER = 0x0B,
|
| 155 | PLDM_CRC_VENDOR_COMP_RESP_CODE_RANGE_MIN = 0xD0,
|
| 156 | PLDM_CRC_VENDOR_COMP_RESP_CODE_RANGE_MAX = 0xEF
|
| 157 | };
|
| 158 |
|
gokulsanker | 4b533f2 | 2021-04-22 12:53:00 +0530 | [diff] [blame] | 159 | /** @brief ComponentCompatibilityResponse values in the response of
|
| 160 | * UpdateComponent
|
| 161 | */
|
| 162 | enum pldm_component_compatability_responses {
|
| 163 | PLDM_CCR_COMP_CAN_BE_UPDATED = 0,
|
| 164 | PLDM_CCR_COMP_CANNOT_BE_UPDATED = 1
|
| 165 | };
|
| 166 |
|
| 167 | /** @brief ComponentCompatibilityResponse Code values in the response of
|
| 168 | * UpdateComponent
|
| 169 | */
|
| 170 | enum pldm_component_compatability_response_codes {
|
| 171 | PLDM_CCRC_NO_RESPONSE_CODE = 0x00,
|
| 172 | PLDM_CCRC_COMP_COMPARISON_STAMP_IDENTICAL = 0x01,
|
| 173 | PLDM_CCRC_COMP_COMPARISON_STAMP_LOWER = 0x02,
|
| 174 | PLDM_CCRC_INVALID_COMP_COMPARISON_STAMP = 0x03,
|
| 175 | PLDM_CCRC_COMP_CONFLICT = 0x04,
|
| 176 | PLDM_CCRC_COMP_PREREQUISITES_NOT_MET = 0x05,
|
| 177 | PLDM_CCRC_COMP_NOT_SUPPORTED = 0x06,
|
| 178 | PLDM_CCRC_COMP_SECURITY_RESTRICTIONS = 0x07,
|
| 179 | PLDM_CCRC_INCOMPLETE_COMP_IMAGE_SET = 0x08,
|
| 180 | PLDM_CCRC_COMP_INFO_NO_MATCH = 0x09,
|
| 181 | PLDM_CCRC_COMP_VER_STR_IDENTICAL = 0x0A,
|
| 182 | PLDM_CCRC_COMP_VER_STR_LOWER = 0x0B,
|
| 183 | PLDM_CCRC_VENDOR_COMP_RESP_CODE_RANGE_MIN = 0xD0,
|
| 184 | PLDM_CCRC_VENDOR_COMP_RESP_CODE_RANGE_MAX = 0xEF
|
| 185 | };
|
| 186 |
|
Tom Joseph | 568e470 | 2021-06-07 22:15:49 -0700 | [diff] [blame] | 187 | /** @struct pldm_package_header_information
|
| 188 | *
|
| 189 | * Structure representing fixed part of package header information
|
| 190 | */
|
| 191 | struct pldm_package_header_information {
|
| 192 | uint8_t uuid[PLDM_FWUP_UUID_LENGTH];
|
| 193 | uint8_t package_header_format_version;
|
| 194 | uint16_t package_header_size;
|
| 195 | uint8_t timestamp104[PLDM_TIMESTAMP104_SIZE];
|
| 196 | uint16_t component_bitmap_bit_length;
|
| 197 | uint8_t package_version_string_type;
|
| 198 | uint8_t package_version_string_length;
|
| 199 | } __attribute__((packed));
|
| 200 |
|
Tom Joseph | 64af345 | 2021-06-08 04:05:28 -0700 | [diff] [blame] | 201 | /** @struct pldm_firmware_device_id_record
|
| 202 | *
|
| 203 | * Structure representing firmware device ID record
|
| 204 | */
|
| 205 | struct pldm_firmware_device_id_record {
|
| 206 | uint16_t record_length;
|
| 207 | uint8_t descriptor_count;
|
| 208 | bitfield32_t device_update_option_flags;
|
| 209 | uint8_t comp_image_set_version_string_type;
|
| 210 | uint8_t comp_image_set_version_string_length;
|
| 211 | uint16_t fw_device_pkg_data_length;
|
| 212 | } __attribute__((packed));
|
| 213 |
|
Tom Joseph | 763b51e | 2021-06-05 04:50:47 -0700 | [diff] [blame] | 214 | /** @struct pldm_descriptor_tlv
|
| 215 | *
|
| 216 | * Structure representing descriptor type, length and value
|
| 217 | */
|
| 218 | struct pldm_descriptor_tlv {
|
| 219 | uint16_t descriptor_type;
|
| 220 | uint16_t descriptor_length;
|
| 221 | uint8_t descriptor_data[1];
|
| 222 | } __attribute__((packed));
|
| 223 |
|
| 224 | /** @struct pldm_vendor_defined_descriptor_title_data
|
| 225 | *
|
| 226 | * Structure representing vendor defined descriptor title sections
|
| 227 | */
|
| 228 | struct pldm_vendor_defined_descriptor_title_data {
|
| 229 | uint8_t vendor_defined_descriptor_title_str_type;
|
| 230 | uint8_t vendor_defined_descriptor_title_str_len;
|
| 231 | uint8_t vendor_defined_descriptor_title_str[1];
|
| 232 | } __attribute__((packed));
|
| 233 |
|
Tom Joseph | 58cc172 | 2021-06-09 07:15:49 -0700 | [diff] [blame] | 234 | /** @struct pldm_component_image_information
|
| 235 | *
|
| 236 | * Structure representing fixed part of individual component information in
|
| 237 | * PLDM firmware update package
|
| 238 | */
|
| 239 | struct pldm_component_image_information {
|
| 240 | uint16_t comp_classification;
|
| 241 | uint16_t comp_identifier;
|
| 242 | uint32_t comp_comparison_stamp;
|
| 243 | bitfield16_t comp_options;
|
| 244 | bitfield16_t requested_comp_activation_method;
|
| 245 | uint32_t comp_location_offset;
|
| 246 | uint32_t comp_size;
|
| 247 | uint8_t comp_version_string_type;
|
| 248 | uint8_t comp_version_string_length;
|
| 249 | } __attribute__((packed));
|
| 250 |
|
gokulsanker | eca3e19 | 2021-04-05 14:57:41 +0530 | [diff] [blame] | 251 | /** @struct pldm_query_device_identifiers_resp
|
| 252 | *
|
| 253 | * Structure representing query device identifiers response.
|
| 254 | */
|
| 255 | struct pldm_query_device_identifiers_resp {
|
| 256 | uint8_t completion_code;
|
| 257 | uint32_t device_identifiers_len;
|
| 258 | uint8_t descriptor_count;
|
| 259 | } __attribute__((packed));
|
| 260 |
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 261 | /** @struct pldm_get_firmware_parameters_resp
|
| 262 | *
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 263 | * Structure representing the fixed part of GetFirmwareParameters response
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 264 | */
|
| 265 | struct pldm_get_firmware_parameters_resp {
|
| 266 | uint8_t completion_code;
|
| 267 | bitfield32_t capabilities_during_update;
|
| 268 | uint16_t comp_count;
|
| 269 | uint8_t active_comp_image_set_ver_str_type;
|
| 270 | uint8_t active_comp_image_set_ver_str_len;
|
| 271 | uint8_t pending_comp_image_set_ver_str_type;
|
| 272 | uint8_t pending_comp_image_set_ver_str_len;
|
| 273 | } __attribute__((packed));
|
| 274 |
|
gokulsanker | e1fb7a8 | 2021-04-05 16:09:29 +0530 | [diff] [blame] | 275 | /** @struct pldm_component_parameter_entry
|
| 276 | *
|
| 277 | * Structure representing component parameter table entry.
|
| 278 | */
|
| 279 | struct pldm_component_parameter_entry {
|
| 280 | uint16_t comp_classification;
|
| 281 | uint16_t comp_identifier;
|
| 282 | uint8_t comp_classification_index;
|
| 283 | uint32_t active_comp_comparison_stamp;
|
| 284 | uint8_t active_comp_ver_str_type;
|
| 285 | uint8_t active_comp_ver_str_len;
|
| 286 | uint8_t active_comp_release_date[8];
|
| 287 | uint32_t pending_comp_comparison_stamp;
|
| 288 | uint8_t pending_comp_ver_str_type;
|
| 289 | uint8_t pending_comp_ver_str_len;
|
| 290 | uint8_t pending_comp_release_date[8];
|
| 291 | bitfield16_t comp_activation_methods;
|
| 292 | bitfield32_t capabilities_during_update;
|
| 293 | } __attribute__((packed));
|
| 294 |
|
gokulsanker | d434edc | 2021-04-05 16:36:04 +0530 | [diff] [blame] | 295 | /** @struct pldm_request_update_req
|
| 296 | *
|
| 297 | * Structure representing fixed part of Request Update request
|
| 298 | */
|
| 299 | struct pldm_request_update_req {
|
| 300 | uint32_t max_transfer_size;
|
| 301 | uint16_t num_of_comp;
|
| 302 | uint8_t max_outstanding_transfer_req;
|
| 303 | uint16_t pkg_data_len;
|
| 304 | uint8_t comp_image_set_ver_str_type;
|
| 305 | uint8_t comp_image_set_ver_str_len;
|
| 306 | } __attribute__((packed));
|
| 307 |
|
gokulsanker | 611238c | 2021-04-05 16:50:44 +0530 | [diff] [blame] | 308 | /** @struct pldm_request_update_resp
|
| 309 | *
|
| 310 | * Structure representing Request Update response
|
| 311 | */
|
| 312 | struct pldm_request_update_resp {
|
| 313 | uint8_t completion_code;
|
| 314 | uint16_t fd_meta_data_len;
|
| 315 | uint8_t fd_will_send_pkg_data;
|
| 316 | } __attribute__((packed));
|
| 317 |
|
gokulsanker | 1b909d8 | 2021-04-05 17:26:02 +0530 | [diff] [blame] | 318 | /** @struct pldm_pass_component_table_req
|
| 319 | *
|
| 320 | * Structure representing PassComponentTable request
|
| 321 | */
|
| 322 | struct pldm_pass_component_table_req {
|
| 323 | uint8_t transfer_flag;
|
| 324 | uint16_t comp_classification;
|
| 325 | uint16_t comp_identifier;
|
| 326 | uint8_t comp_classification_index;
|
| 327 | uint32_t comp_comparison_stamp;
|
| 328 | uint8_t comp_ver_str_type;
|
| 329 | uint8_t comp_ver_str_len;
|
| 330 | } __attribute__((packed));
|
| 331 |
|
gokulsanker | 566784b | 2021-04-05 17:47:04 +0530 | [diff] [blame] | 332 | /** @struct pldm_pass_component_table_resp
|
| 333 | *
|
| 334 | * Structure representing PassComponentTable response
|
| 335 | */
|
| 336 | struct pldm_pass_component_table_resp {
|
| 337 | uint8_t completion_code;
|
| 338 | uint8_t comp_resp;
|
| 339 | uint8_t comp_resp_code;
|
| 340 | } __attribute__((packed));
|
| 341 |
|
gokulsanker | aa3a5cd | 2021-04-22 11:06:42 +0530 | [diff] [blame] | 342 | /** @struct pldm_update_component_req
|
| 343 | *
|
| 344 | * Structure representing UpdateComponent request
|
| 345 | */
|
| 346 | struct pldm_update_component_req {
|
| 347 | uint16_t comp_classification;
|
| 348 | uint16_t comp_identifier;
|
| 349 | uint8_t comp_classification_index;
|
| 350 | uint32_t comp_comparison_stamp;
|
| 351 | uint32_t comp_image_size;
|
| 352 | bitfield32_t update_option_flags;
|
| 353 | uint8_t comp_ver_str_type;
|
| 354 | uint8_t comp_ver_str_len;
|
| 355 | } __attribute__((packed));
|
| 356 |
|
gokulsanker | 4b533f2 | 2021-04-22 12:53:00 +0530 | [diff] [blame] | 357 | /** @struct pldm_update_component_resp
|
| 358 | *
|
| 359 | * Structure representing UpdateComponent response
|
| 360 | */
|
| 361 | struct pldm_update_component_resp {
|
| 362 | uint8_t completion_code;
|
| 363 | uint8_t comp_compatability_resp;
|
| 364 | uint8_t comp_compatability_resp_code;
|
| 365 | bitfield32_t update_option_flags_enabled;
|
| 366 | uint16_t time_before_req_fw_data;
|
| 367 | } __attribute__((packed));
|
| 368 |
|
Tom Joseph | 568e470 | 2021-06-07 22:15:49 -0700 | [diff] [blame] | 369 | /** @brief Decode the PLDM package header information
|
| 370 | *
|
| 371 | * @param[in] data - pointer to package header information
|
| 372 | * @param[in] length - available length in the firmware update package
|
| 373 | * @param[out] package_header_info - pointer to fixed part of PLDM package
|
| 374 | * header information
|
| 375 | * @param[out] package_version_str - pointer to package version string
|
| 376 | *
|
| 377 | * @return pldm_completion_codes
|
| 378 | */
|
| 379 | int decode_pldm_package_header_info(
|
| 380 | const uint8_t *data, size_t length,
|
| 381 | struct pldm_package_header_information *package_header_info,
|
| 382 | struct variable_field *package_version_str);
|
| 383 |
|
Tom Joseph | 64af345 | 2021-06-08 04:05:28 -0700 | [diff] [blame] | 384 | /** @brief Decode individual firmware device ID record
|
| 385 | *
|
| 386 | * @param[in] data - pointer to firmware device ID record
|
| 387 | * @param[in] length - available length in the firmware update package
|
| 388 | * @param[in] component_bitmap_bit_length - ComponentBitmapBitLengthfield
|
| 389 | * parsed from the package header info
|
| 390 | * @param[out] fw_device_id_record - pointer to fixed part of firmware device
|
| 391 | * id record
|
| 392 | * @param[out] applicable_components - pointer to ApplicableComponents
|
| 393 | * @param[out] comp_image_set_version_str - pointer to
|
| 394 | * ComponentImageSetVersionString
|
| 395 | * @param[out] record_descriptors - pointer to RecordDescriptors
|
| 396 | * @param[out] fw_device_pkg_data - pointer to FirmwareDevicePackageData
|
| 397 | *
|
| 398 | * @return pldm_completion_codes
|
| 399 | */
|
| 400 | int decode_firmware_device_id_record(
|
| 401 | const uint8_t *data, size_t length, uint16_t component_bitmap_bit_length,
|
| 402 | struct pldm_firmware_device_id_record *fw_device_id_record,
|
| 403 | struct variable_field *applicable_components,
|
| 404 | struct variable_field *comp_image_set_version_str,
|
| 405 | struct variable_field *record_descriptors,
|
| 406 | struct variable_field *fw_device_pkg_data);
|
| 407 |
|
Tom Joseph | 763b51e | 2021-06-05 04:50:47 -0700 | [diff] [blame] | 408 | /** @brief Decode the record descriptor entries in the firmware update package
|
| 409 | * and the Descriptors in the QueryDeviceIDentifiers command
|
| 410 | *
|
| 411 | * @param[in] data - pointer to descriptor entry
|
| 412 | * @param[in] length - remaining length of the descriptor data
|
| 413 | * @param[out] descriptor_type - pointer to descriptor type
|
| 414 | * @param[out] descriptor_data - pointer to descriptor data
|
| 415 | *
|
| 416 | * @return pldm_completion_codes
|
| 417 | */
|
| 418 | int decode_descriptor_type_length_value(const uint8_t *data, size_t length,
|
| 419 | uint16_t *descriptor_type,
|
| 420 | struct variable_field *descriptor_data);
|
| 421 |
|
| 422 | /** @brief Decode the vendor defined descriptor value
|
| 423 | *
|
| 424 | * @param[in] data - pointer to vendor defined descriptor value
|
| 425 | * @param[in] length - length of the vendor defined descriptor value
|
| 426 | * @param[out] descriptor_title_str_type - pointer to vendor defined descriptor
|
| 427 | * title string type
|
| 428 | * @param[out] descriptor_title_str - pointer to vendor defined descriptor
|
| 429 | * title string
|
| 430 | * @param[out] descriptor_data - pointer to vendor defined descriptor data
|
| 431 | *
|
| 432 | * @return pldm_completion_codes
|
| 433 | */
|
| 434 | int decode_vendor_defined_descriptor_value(
|
| 435 | const uint8_t *data, size_t length, uint8_t *descriptor_title_str_type,
|
| 436 | struct variable_field *descriptor_title_str,
|
| 437 | struct variable_field *descriptor_data);
|
| 438 |
|
Tom Joseph | 58cc172 | 2021-06-09 07:15:49 -0700 | [diff] [blame] | 439 | /** @brief Decode individual component image information
|
| 440 | *
|
| 441 | * @param[in] data - pointer to component image information
|
| 442 | * @param[in] length - available length in the firmware update package
|
| 443 | * @param[out] pldm_comp_image_info - pointer to fixed part of component image
|
| 444 | * information
|
| 445 | * @param[out] comp_version_str - pointer to component version string
|
| 446 | *
|
| 447 | * @return pldm_completion_codes
|
| 448 | */
|
| 449 | int decode_pldm_comp_image_info(
|
| 450 | const uint8_t *data, size_t length,
|
| 451 | struct pldm_component_image_information *pldm_comp_image_info,
|
| 452 | struct variable_field *comp_version_str);
|
| 453 |
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 454 | /** @brief Create a PLDM request message for QueryDeviceIdentifiers
|
| 455 | *
|
| 456 | * @param[in] instance_id - Message's instance id
|
| 457 | * @param[in] payload_length - Length of the request message payload
|
| 458 | * @param[in,out] msg - Message will be written to this
|
| 459 | *
|
| 460 | * @return pldm_completion_codes
|
| 461 | *
|
| 462 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 463 | * 'msg.payload'
|
| 464 | */
|
| 465 | int encode_query_device_identifiers_req(uint8_t instance_id,
|
| 466 | size_t payload_length,
|
| 467 | struct pldm_msg *msg);
|
gokulsanker | eca3e19 | 2021-04-05 14:57:41 +0530 | [diff] [blame] | 468 |
|
| 469 | /** @brief Decode QueryDeviceIdentifiers response message
|
| 470 | *
|
| 471 | * @param[in] msg - Response message
|
| 472 | * @param[in] payload_length - Length of response message payload
|
| 473 | * @param[out] completion_code - Pointer to response msg's PLDM completion code
|
| 474 | * @param[out] device_identifiers_len - Pointer to device identifiers length
|
| 475 | * @param[out] descriptor_count - Pointer to descriptor count
|
| 476 | * @param[out] descriptor_data - Pointer to descriptor data
|
| 477 | *
|
| 478 | * @return pldm_completion_codes
|
| 479 | */
|
| 480 | int decode_query_device_identifiers_resp(const struct pldm_msg *msg,
|
| 481 | size_t payload_length,
|
| 482 | uint8_t *completion_code,
|
| 483 | uint32_t *device_identifiers_len,
|
| 484 | uint8_t *descriptor_count,
|
| 485 | uint8_t **descriptor_data);
|
gokulsanker | 981fbfb | 2021-04-05 15:17:25 +0530 | [diff] [blame] | 486 |
|
| 487 | /** @brief Create a PLDM request message for GetFirmwareParameters
|
| 488 | *
|
| 489 | * @param[in] instance_id - Message's instance id
|
| 490 | * @param[in] payload_length - Length of the request message payload
|
| 491 | * @param[in,out] msg - Message will be written to this
|
| 492 | *
|
| 493 | * @return pldm_completion_codes
|
| 494 | *
|
| 495 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 496 | * 'msg.payload'
|
| 497 | */
|
| 498 | int encode_get_firmware_parameters_req(uint8_t instance_id,
|
| 499 | size_t payload_length,
|
| 500 | struct pldm_msg *msg);
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 501 |
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 502 | /** @brief Decode GetFirmwareParameters response
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 503 | *
|
| 504 | * @param[in] msg - Response message
|
| 505 | * @param[in] payload_length - Length of response message payload
|
| 506 | * @param[out] resp_data - Pointer to get firmware parameters response
|
| 507 | * @param[out] active_comp_image_set_ver_str - Pointer to active component
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 508 | * image set version string
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 509 | * @param[out] pending_comp_image_set_ver_str - Pointer to pending component
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 510 | * image set version string
|
| 511 | * @param[out] comp_parameter_table - Pointer to component parameter table
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 512 | *
|
| 513 | * @return pldm_completion_codes
|
| 514 | */
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 515 | int decode_get_firmware_parameters_resp(
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 516 | const struct pldm_msg *msg, size_t payload_length,
|
| 517 | struct pldm_get_firmware_parameters_resp *resp_data,
|
| 518 | struct variable_field *active_comp_image_set_ver_str,
|
Tom Joseph | 3fd3eb8 | 2021-06-18 04:13:29 -0700 | [diff] [blame] | 519 | struct variable_field *pending_comp_image_set_ver_str,
|
| 520 | struct variable_field *comp_parameter_table);
|
gokulsanker | 22fbb34 | 2021-04-05 15:55:06 +0530 | [diff] [blame] | 521 |
|
gokulsanker | e1fb7a8 | 2021-04-05 16:09:29 +0530 | [diff] [blame] | 522 | /** @brief Decode component entries in the component parameter table which is
|
| 523 | * part of the response of GetFirmwareParameters command
|
| 524 | *
|
| 525 | * @param[in] data - Component entry
|
| 526 | * @param[in] length - Length of component entry
|
| 527 | * @param[out] component_data - Pointer to component parameter table
|
| 528 | * @param[out] active_comp_ver_str - Pointer to active component version string
|
| 529 | * @param[out] pending_comp_ver_str - Pointer to pending component version
|
| 530 | * string
|
| 531 | *
|
| 532 | * @return pldm_completion_codes
|
| 533 | */
|
| 534 | int decode_get_firmware_parameters_resp_comp_entry(
|
| 535 | const uint8_t *data, size_t length,
|
| 536 | struct pldm_component_parameter_entry *component_data,
|
| 537 | struct variable_field *active_comp_ver_str,
|
| 538 | struct variable_field *pending_comp_ver_str);
|
| 539 |
|
gokulsanker | d434edc | 2021-04-05 16:36:04 +0530 | [diff] [blame] | 540 | /** @brief Create PLDM request message for RequestUpdate
|
| 541 | *
|
| 542 | * @param[in] instance_id - Message's instance id
|
| 543 | * @param[in] max_transfer_size - Maximum size of the variable payload allowed
|
| 544 | * to be requested via RequestFirmwareData
|
| 545 | * command
|
| 546 | * @param[in] num_of_comp - Total number of components that will be passed to
|
| 547 | * the FD during the update
|
| 548 | * @param[in] max_outstanding_transfer_req - Total number of outstanding
|
| 549 | * RequestFirmwareData
|
| 550 | * commands that can be sent by the FD
|
| 551 | * @param[in] pkg_data_len - Value of the FirmwareDevicePackageDataLength field
|
| 552 | * present in firmware package header
|
| 553 | * @param[in] comp_image_set_ver_str_type - StringType of
|
| 554 | * ComponentImageSetVersionString
|
| 555 | * @param[in] comp_image_set_ver_str_len - The length of the
|
| 556 | * ComponentImageSetVersionString
|
| 557 | * @param[in] comp_img_set_ver_str - Component Image Set version information
|
| 558 | * @param[in,out] msg - Message will be written to this
|
| 559 | * @param[in] payload_length - Length of request message payload
|
| 560 | *
|
| 561 | * @return pldm_completion_codes
|
| 562 | *
|
| 563 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 564 | * 'msg.payload'
|
| 565 | */
|
| 566 | int encode_request_update_req(uint8_t instance_id, uint32_t max_transfer_size,
|
| 567 | uint16_t num_of_comp,
|
| 568 | uint8_t max_outstanding_transfer_req,
|
| 569 | uint16_t pkg_data_len,
|
| 570 | uint8_t comp_image_set_ver_str_type,
|
| 571 | uint8_t comp_image_set_ver_str_len,
|
| 572 | const struct variable_field *comp_img_set_ver_str,
|
| 573 | struct pldm_msg *msg, size_t payload_length);
|
gokulsanker | 611238c | 2021-04-05 16:50:44 +0530 | [diff] [blame] | 574 |
|
| 575 | /** @brief Decode a RequestUpdate response message
|
| 576 | *
|
| 577 | * @param[in] msg - Response message
|
| 578 | * @param[in] payload_length - Length of response message payload
|
| 579 | * @param[out] completion_code - Pointer to hold the completion code
|
| 580 | * @param[out] fd_meta_data_len - Pointer to hold the length of FD metadata
|
| 581 | * @param[out] fd_will_send_pkg_data - Pointer to hold information whether FD
|
| 582 | * will send GetPackageData command
|
| 583 | * @return pldm_completion_codes
|
| 584 | */
|
| 585 | int decode_request_update_resp(const struct pldm_msg *msg,
|
| 586 | size_t payload_length, uint8_t *completion_code,
|
| 587 | uint16_t *fd_meta_data_len,
|
| 588 | uint8_t *fd_will_send_pkg_data);
|
| 589 |
|
gokulsanker | 1b909d8 | 2021-04-05 17:26:02 +0530 | [diff] [blame] | 590 | /** @brief Create PLDM request message for PassComponentTable
|
| 591 | *
|
| 592 | * @param[in] instance_id - Message's instance id
|
| 593 | * @param[in] transfer_flag - TransferFlag
|
| 594 | * @param[in] comp_classification - ComponentClassification
|
| 595 | * @param[in] comp_identifier - ComponentIdentifier
|
| 596 | * @param[in] comp_classification_index - ComponentClassificationIndex
|
| 597 | * @param[in] comp_comparison_stamp - ComponentComparisonStamp
|
| 598 | * @param[in] comp_ver_str_type - ComponentVersionStringType
|
| 599 | * @param[in] comp_ver_str_len - ComponentVersionStringLength
|
| 600 | * @param[in] comp_ver_str - ComponentVersionString
|
| 601 | * @param[in,out] msg - Message will be written to this
|
| 602 | * @param[in] payload_length - Length of request message payload
|
| 603 | * information
|
| 604 | *
|
| 605 | * @return pldm_completion_codes
|
| 606 | *
|
| 607 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 608 | * 'msg.payload'
|
| 609 | */
|
| 610 | int encode_pass_component_table_req(
|
| 611 | uint8_t instance_id, uint8_t transfer_flag, uint16_t comp_classification,
|
| 612 | uint16_t comp_identifier, uint8_t comp_classification_index,
|
| 613 | uint32_t comp_comparison_stamp, uint8_t comp_ver_str_type,
|
| 614 | uint8_t comp_ver_str_len, const struct variable_field *comp_ver_str,
|
| 615 | struct pldm_msg *msg, size_t payload_length);
|
| 616 |
|
gokulsanker | 566784b | 2021-04-05 17:47:04 +0530 | [diff] [blame] | 617 | /** @brief Decode PassComponentTable response message
|
| 618 | *
|
| 619 | * @param[in] msg - Response message
|
| 620 | * @param[in] payload_length - Length of response message payload
|
| 621 | * @param[out] completion_code - Pointer to hold completion code
|
| 622 | * @param[out] comp_resp - Pointer to hold component response
|
| 623 | * @param[out] comp_resp_code - Pointer to hold component response code
|
| 624 | *
|
| 625 | * @return pldm_completion_codes
|
| 626 | */
|
| 627 | int decode_pass_component_table_resp(const struct pldm_msg *msg,
|
| 628 | size_t payload_length,
|
| 629 | uint8_t *completion_code,
|
| 630 | uint8_t *comp_resp,
|
| 631 | uint8_t *comp_resp_code);
|
| 632 |
|
gokulsanker | aa3a5cd | 2021-04-22 11:06:42 +0530 | [diff] [blame] | 633 | /** @brief Create PLDM request message for UpdateComponent
|
| 634 | *
|
| 635 | * @param[in] instance_id - Message's instance id
|
| 636 | * @param[in] comp_classification - ComponentClassification
|
| 637 | * @param[in] comp_identifier - ComponentIdentifier
|
| 638 | * @param[in] comp_classification_index - ComponentClassificationIndex
|
| 639 | * @param[in] comp_comparison_stamp - ComponentComparisonStamp
|
| 640 | * @param[in] comp_image_size - ComponentImageSize
|
| 641 | * @param[in] update_option_flags - UpdateOptionFlags
|
| 642 | * @param[in] comp_ver_str_type - ComponentVersionStringType
|
| 643 | * @param[in] comp_ver_str_len - ComponentVersionStringLength
|
| 644 | * @param[in] comp_ver_str - ComponentVersionString
|
| 645 | * @param[in,out] msg - Message will be written to this
|
| 646 | * @param[in] payload_length - Length of request message payload
|
| 647 | * information
|
| 648 | *
|
| 649 | * @return pldm_completion_codes
|
| 650 | *
|
| 651 | * @note Caller is responsible for memory alloc and dealloc of param
|
| 652 | * 'msg.payload'
|
| 653 | */
|
| 654 | int encode_update_component_req(
|
| 655 | uint8_t instance_id, uint16_t comp_classification, uint16_t comp_identifier,
|
| 656 | uint8_t comp_classification_index, uint32_t comp_comparison_stamp,
|
| 657 | uint32_t comp_image_size, bitfield32_t update_option_flags,
|
| 658 | uint8_t comp_ver_str_type, uint8_t comp_ver_str_len,
|
| 659 | const struct variable_field *comp_ver_str, struct pldm_msg *msg,
|
| 660 | size_t payload_length);
|
| 661 |
|
gokulsanker | 4b533f2 | 2021-04-22 12:53:00 +0530 | [diff] [blame] | 662 | /** @brief Decode UpdateComponent response message
|
| 663 | *
|
| 664 | * @param[in] msg - Response message
|
| 665 | * @param[in] payload_length - Length of response message payload
|
| 666 | * @param[out] completion_code - Pointer to hold completion code
|
| 667 | * @param[out] comp_compatability_resp - Pointer to hold component
|
| 668 | * compatibility response
|
| 669 | * @param[out] comp_compatability_resp_code - Pointer to hold component
|
| 670 | * compatibility response code
|
| 671 | * @param[out] update_option_flags_enabled - Pointer to hold
|
| 672 | * UpdateOptionsFlagEnabled
|
| 673 | * @param[out] time_before_req_fw_data - Pointer to hold the estimated time
|
| 674 | * before sending RequestFirmwareData
|
| 675 | *
|
| 676 | * @return pldm_completion_codes
|
| 677 | */
|
| 678 | int decode_update_component_resp(const struct pldm_msg *msg,
|
| 679 | size_t payload_length,
|
| 680 | uint8_t *completion_code,
|
| 681 | uint8_t *comp_compatability_resp,
|
| 682 | uint8_t *comp_compatability_resp_code,
|
| 683 | bitfield32_t *update_option_flags_enabled,
|
| 684 | uint16_t *time_before_req_fw_data);
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 685 | #ifdef __cplusplus
|
| 686 | }
|
| 687 | #endif
|
| 688 |
|
| 689 | #endif // End of FW_UPDATE_H
|