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