]>
Commit | Line | Data |
---|---|---|
252b9c7a | 1 | /** @file\r |
2 | UEFI Firmware Management Protocol definition\r | |
6e746540 HW |
3 | Firmware Management Protocol provides an abstraction for device to provide firmware\r |
4 | management support. The base requirements for managing device firmware images include\r | |
252b9c7a | 5 | identifying firmware image revision level and programming the image into the device.\r |
6 | \r | |
6e746540 HW |
7 | GetImageInfo() is the only required function. GetImage(), SetImage(),\r |
8 | CheckImage(), GetPackageInfo(), and SetPackageInfo() shall return\r | |
252b9c7a | 9 | EFI_UNSUPPORTED if not supported by the driver.\r |
6e746540 | 10 | \r |
48997fe4 | 11 | Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR>\r |
6e746540 | 12 | Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.<BR>\r |
9344f092 | 13 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
252b9c7a | 14 | \r |
6e746540 HW |
15 | @par Revision Reference:\r |
16 | This Protocol is introduced in UEFI Specification 2.3\r | |
252b9c7a | 17 | \r |
18 | **/\r | |
19 | \r | |
20 | #ifndef __EFI_FIRMWARE_MANAGEMENT_PROTOCOL_H__\r | |
21 | #define __EFI_FIRMWARE_MANAGEMENT_PROTOCOL_H__\r | |
22 | \r | |
252b9c7a | 23 | #define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GUID \\r |
24 | { \\r | |
25 | 0x86c77a67, 0xb97, 0x4633, {0xa1, 0x87, 0x49, 0x10, 0x4d, 0x6, 0x85, 0xc7 } \\r | |
26 | }\r | |
27 | \r | |
28 | typedef struct _EFI_FIRMWARE_MANAGEMENT_PROTOCOL EFI_FIRMWARE_MANAGEMENT_PROTOCOL;\r | |
29 | \r | |
48997fe4 WX |
30 | ///\r |
31 | /// Dependency Expression Opcode\r | |
32 | ///\r | |
2f88bd3a MK |
33 | #define EFI_FMP_DEP_PUSH_GUID 0x00\r |
34 | #define EFI_FMP_DEP_PUSH_VERSION 0x01\r | |
35 | #define EFI_FMP_DEP_VERSION_STR 0x02\r | |
36 | #define EFI_FMP_DEP_AND 0x03\r | |
37 | #define EFI_FMP_DEP_OR 0x04\r | |
38 | #define EFI_FMP_DEP_NOT 0x05\r | |
39 | #define EFI_FMP_DEP_TRUE 0x06\r | |
40 | #define EFI_FMP_DEP_FALSE 0x07\r | |
41 | #define EFI_FMP_DEP_EQ 0x08\r | |
42 | #define EFI_FMP_DEP_GT 0x09\r | |
43 | #define EFI_FMP_DEP_GTE 0x0A\r | |
44 | #define EFI_FMP_DEP_LT 0x0B\r | |
45 | #define EFI_FMP_DEP_LTE 0x0C\r | |
46 | #define EFI_FMP_DEP_END 0x0D\r | |
48997fe4 WX |
47 | \r |
48 | ///\r | |
49 | /// Image Attribute - Dependency\r | |
50 | ///\r | |
51 | typedef struct {\r | |
2f88bd3a | 52 | UINT8 Dependencies[1];\r |
48997fe4 WX |
53 | } EFI_FIRMWARE_IMAGE_DEP;\r |
54 | \r | |
252b9c7a | 55 | ///\r |
56 | /// EFI_FIRMWARE_IMAGE_DESCRIPTOR\r | |
57 | ///\r | |
58 | typedef struct {\r | |
6e746540 HW |
59 | ///\r |
60 | /// A unique number identifying the firmware image within the device. The number is\r | |
252b9c7a | 61 | /// between 1 and DescriptorCount.\r |
6e746540 | 62 | ///\r |
2f88bd3a | 63 | UINT8 ImageIndex;\r |
252b9c7a | 64 | ///\r |
2ca32f8d HW |
65 | /// A unique GUID identifying the firmware image type.\r |
66 | ///\r | |
2f88bd3a | 67 | EFI_GUID ImageTypeId;\r |
6e746540 HW |
68 | ///\r |
69 | /// A unique number identifying the firmware image.\r | |
70 | ///\r | |
2f88bd3a | 71 | UINT64 ImageId;\r |
6e746540 HW |
72 | ///\r |
73 | /// A pointer to a null-terminated string representing the firmware image name.\r | |
74 | ///\r | |
2f88bd3a | 75 | CHAR16 *ImageIdName;\r |
6e746540 HW |
76 | ///\r |
77 | /// Identifies the version of the device firmware. The format is vendor specific and new\r | |
252b9c7a | 78 | /// version must have a greater value than an old version.\r |
6e746540 | 79 | ///\r |
2f88bd3a | 80 | UINT32 Version;\r |
6e746540 | 81 | ///\r |
4f077902 | 82 | /// A pointer to a null-terminated string representing the firmware image version name.\r |
6e746540 | 83 | ///\r |
2f88bd3a | 84 | CHAR16 *VersionName;\r |
6e746540 HW |
85 | ///\r |
86 | /// Size of the image in bytes. If size=0, then only ImageIndex and ImageTypeId are valid.\r | |
87 | ///\r | |
2f88bd3a | 88 | UINTN Size;\r |
6e746540 HW |
89 | ///\r |
90 | /// Image attributes that are supported by this device. See 'Image Attribute Definitions'\r | |
91 | /// for possible returned values of this parameter. A value of 1 indicates the attribute is\r | |
92 | /// supported and the current setting value is indicated in AttributesSetting. A\r | |
93 | /// value of 0 indicates the attribute is not supported and the current setting value in\r | |
252b9c7a | 94 | /// AttributesSetting is meaningless.\r |
6e746540 | 95 | ///\r |
2f88bd3a | 96 | UINT64 AttributesSupported;\r |
6e746540 HW |
97 | ///\r |
98 | /// Image attributes. See 'Image Attribute Definitions' for possible returned values of\r | |
252b9c7a | 99 | /// this parameter.\r |
6e746540 | 100 | ///\r |
2f88bd3a | 101 | UINT64 AttributesSetting;\r |
6e746540 HW |
102 | ///\r |
103 | /// Image compatibilities. See 'Image Compatibility Definitions' for possible returned\r | |
252b9c7a | 104 | /// values of this parameter.\r |
6e746540 | 105 | ///\r |
2f88bd3a | 106 | UINT64 Compatibilities;\r |
7076ecdb SQ |
107 | ///\r |
108 | /// Describes the lowest ImageDescriptor version that the device will accept. Only\r | |
109 | /// present in version 2 or higher.\r | |
110 | ///\r | |
2f88bd3a | 111 | UINT32 LowestSupportedImageVersion;\r |
2ca32f8d HW |
112 | ///\r |
113 | /// Describes the version that was last attempted to update. If no update attempted the\r | |
114 | /// value will be 0. If the update attempted was improperly formatted and no version\r | |
115 | /// number was available then the value will be zero. Only present in version 3 or higher.\r | |
2f88bd3a | 116 | UINT32 LastAttemptVersion;\r |
2ca32f8d HW |
117 | ///\r |
118 | /// Describes the status that was last attempted to update. If no update has been attempted\r | |
119 | /// the value will be LAST_ATTEMPT_STATUS_SUCCESS. Only present in version 3 or higher.\r | |
120 | ///\r | |
2f88bd3a | 121 | UINT32 LastAttemptStatus;\r |
2ca32f8d HW |
122 | ///\r |
123 | /// An optional number to identify the unique hardware instance within the system for\r | |
124 | /// devices that may have multiple instances (Example: a plug in pci network card). This\r | |
125 | /// number must be unique within the namespace of the ImageTypeId GUID and\r | |
126 | /// ImageIndex. For FMP instances that have multiple descriptors for a single\r | |
127 | /// hardware instance, all descriptors must have the same HardwareInstance value.\r | |
128 | /// This number must be consistent between boots and should be based on some sort of\r | |
129 | /// hardware identified unique id (serial number, etc) whenever possible. If a hardware\r | |
130 | /// based number is not available the FMP provider may use some other characteristic\r | |
131 | /// such as device path, bus/dev/function, slot num, etc for generating the\r | |
132 | /// HardwareInstance. For implementations that will never have more than one\r | |
133 | /// instance a zero can be used. A zero means the FMP provider is not able to determine a\r | |
134 | /// unique hardware instance number or a hardware instance number is not needed. Only\r | |
135 | /// present in version 3 or higher.\r | |
136 | ///\r | |
2f88bd3a MK |
137 | UINT64 HardwareInstance;\r |
138 | EFI_FIRMWARE_IMAGE_DEP *Dependencies;\r | |
252b9c7a | 139 | } EFI_FIRMWARE_IMAGE_DESCRIPTOR;\r |
140 | \r | |
252b9c7a | 141 | //\r |
142 | // Image Attribute Definitions\r | |
143 | //\r | |
144 | ///\r | |
6e746540 | 145 | /// The attribute IMAGE_ATTRIBUTE_IMAGE_UPDATABLE indicates this device supports firmware\r |
252b9c7a | 146 | /// image update.\r |
147 | ///\r | |
2f88bd3a | 148 | #define IMAGE_ATTRIBUTE_IMAGE_UPDATABLE 0x0000000000000001\r |
252b9c7a | 149 | ///\r |
6e746540 HW |
150 | /// The attribute IMAGE_ATTRIBUTE_RESET_REQUIRED indicates a reset of the device is required\r |
151 | /// for the new firmware image to take effect after a firmware update. The device is the device hosting\r | |
252b9c7a | 152 | /// the firmware image.\r |
6e746540 | 153 | ///\r |
2f88bd3a | 154 | #define IMAGE_ATTRIBUTE_RESET_REQUIRED 0x0000000000000002\r |
252b9c7a | 155 | ///\r |
6e746540 HW |
156 | /// The attribute IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED indicates authentication is\r |
157 | /// required to perform the following image operations: GetImage(), SetImage(), and\r | |
252b9c7a | 158 | /// CheckImage(). See 'Image Attribute - Authentication'.\r |
6e746540 | 159 | ///\r |
2f88bd3a | 160 | #define IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED 0x0000000000000004\r |
252b9c7a | 161 | ///\r |
6e746540 HW |
162 | /// The attribute IMAGE_ATTRIBUTE_IN_USE indicates the current state of the firmware image.\r |
163 | /// This distinguishes firmware images in a device that supports redundant images.\r | |
164 | ///\r | |
2f88bd3a | 165 | #define IMAGE_ATTRIBUTE_IN_USE 0x0000000000000008\r |
cb9ec399 SEHM |
166 | ///\r |
167 | /// The attribute IMAGE_ATTRIBUTE_UEFI_IMAGE indicates that this image is an EFI compatible image.\r | |
168 | ///\r | |
2f88bd3a | 169 | #define IMAGE_ATTRIBUTE_UEFI_IMAGE 0x0000000000000010\r |
48997fe4 WX |
170 | ///\r |
171 | /// The attribute IMAGE_ATTRIBUTE_DEPENDENCY indicates that there is an EFI_FIRMWARE_IMAGE_DEP\r | |
172 | /// section associated with the image.\r | |
173 | ///\r | |
2f88bd3a | 174 | #define IMAGE_ATTRIBUTE_DEPENDENCY 0x0000000000000020\r |
252b9c7a | 175 | \r |
176 | //\r | |
177 | // Image Compatibility Definitions\r | |
178 | //\r | |
58fe2772 | 179 | ///\r |
252b9c7a | 180 | /// Values from 0x0000000000000002 thru 0x000000000000FFFF are reserved for future assignments.\r |
6e746540 | 181 | /// Values from 0x0000000000010000 thru 0xFFFFFFFFFFFFFFFF are used by firmware vendor for\r |
252b9c7a | 182 | /// compatibility check.\r |
183 | ///\r | |
2f88bd3a | 184 | #define IMAGE_COMPATIBILITY_CHECK_SUPPORTED 0x0000000000000001\r |
252b9c7a | 185 | \r |
186 | ///\r | |
9938c13d | 187 | /// Descriptor Version exposed by GetImageInfo() function\r |
252b9c7a | 188 | ///\r |
2f88bd3a | 189 | #define EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION 4\r |
252b9c7a | 190 | \r |
191 | ///\r | |
58fe2772 | 192 | /// Image Attribute - Authentication Required\r |
252b9c7a | 193 | ///\r |
194 | typedef struct {\r | |
195 | ///\r | |
6e746540 HW |
196 | /// It is included in the signature of AuthInfo. It is used to ensure freshness/no replay.\r |
197 | /// It is incremented during each firmware image operation.\r | |
198 | ///\r | |
2f88bd3a | 199 | UINT64 MonotonicCount;\r |
252b9c7a | 200 | ///\r |
6e746540 HW |
201 | /// Provides the authorization for the firmware image operations. It is a signature across\r |
202 | /// the image data and the Monotonic Count value. Caller uses the private key that is\r | |
203 | /// associated with a public key that has been provisioned via the key exchange.\r | |
9938c13d LG |
204 | /// Because this is defined as a signature, WIN_CERTIFICATE_UEFI_GUID.CertType must\r |
205 | /// be EFI_CERT_TYPE_PKCS7_GUID.\r | |
252b9c7a | 206 | ///\r |
2f88bd3a | 207 | WIN_CERTIFICATE_UEFI_GUID AuthInfo;\r |
252b9c7a | 208 | } EFI_FIRMWARE_IMAGE_AUTHENTICATION;\r |
209 | \r | |
252b9c7a | 210 | //\r |
211 | // ImageUpdatable Definitions\r | |
212 | //\r | |
213 | ///\r | |
6e746540 | 214 | /// IMAGE_UPDATABLE_VALID indicates SetImage() will accept the new image and update the\r |
18baa558 HW |
215 | /// device with the new image. The version of the new image could be higher or lower than\r |
216 | /// the current image. SetImage VendorCode is optional but can be used for vendor\r | |
217 | /// specific action.\r | |
252b9c7a | 218 | ///\r |
2f88bd3a | 219 | #define IMAGE_UPDATABLE_VALID 0x0000000000000001\r |
252b9c7a | 220 | ///\r |
6e746540 | 221 | /// IMAGE_UPDATABLE_INVALID indicates SetImage() will reject the new image. No additional\r |
252b9c7a | 222 | /// information is provided for the rejection.\r |
223 | ///\r | |
2f88bd3a | 224 | #define IMAGE_UPDATABLE_INVALID 0x0000000000000002\r |
252b9c7a | 225 | ///\r |
6e746540 | 226 | /// IMAGE_UPDATABLE_INVALID_TYPE indicates SetImage() will reject the new image. The\r |
252b9c7a | 227 | /// rejection is due to the new image is not a firmware image recognized for this device.\r |
228 | ///\r | |
2f88bd3a | 229 | #define IMAGE_UPDATABLE_INVALID_TYPE 0x0000000000000004\r |
252b9c7a | 230 | ///\r |
6e746540 | 231 | /// IMAGE_UPDATABLE_INVALID_OLD indicates SetImage() will reject the new image. The\r |
252b9c7a | 232 | /// rejection is due to the new image version is older than the current firmware image\r |
6e746540 | 233 | /// version in the device. The device firmware update policy does not support firmware\r |
252b9c7a | 234 | /// version downgrade.\r |
235 | ///\r | |
2f88bd3a | 236 | #define IMAGE_UPDATABLE_INVALID_OLD 0x0000000000000008\r |
18baa558 HW |
237 | ///\r |
238 | /// IMAGE_UPDATABLE_VALID_WITH_VENDOR_CODE indicates SetImage() will accept and update\r | |
239 | /// the new image only if a correct VendorCode is provided or else image would be\r | |
240 | /// rejected and SetImage will return appropriate error.\r | |
241 | ///\r | |
2f88bd3a | 242 | #define IMAGE_UPDATABLE_VALID_WITH_VENDOR_CODE 0x0000000000000010\r |
252b9c7a | 243 | \r |
244 | //\r | |
245 | // Package Attribute Definitions\r | |
246 | //\r | |
247 | ///\r | |
6e746540 | 248 | /// The attribute PACKAGE_ATTRIBUTE_VERSION_UPDATABLE indicates this device supports the\r |
252b9c7a | 249 | /// update of the firmware package version.\r |
250 | ///\r | |
2f88bd3a | 251 | #define PACKAGE_ATTRIBUTE_VERSION_UPDATABLE 0x0000000000000001\r |
252b9c7a | 252 | ///\r |
6e746540 | 253 | /// The attribute PACKAGE_ATTRIBUTE_RESET_REQUIRED indicates a reset of the device is\r |
252b9c7a | 254 | /// required for the new package info to take effect after an update.\r |
255 | ///\r | |
2f88bd3a | 256 | #define PACKAGE_ATTRIBUTE_RESET_REQUIRED 0x0000000000000002\r |
252b9c7a | 257 | ///\r |
6e746540 | 258 | /// The attribute PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED indicates authentication\r |
252b9c7a | 259 | /// is required to update the package info.\r |
260 | ///\r | |
2f88bd3a | 261 | #define PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED 0x0000000000000004\r |
252b9c7a | 262 | \r |
6e746540 | 263 | /**\r |
00b7cc0f | 264 | Callback function to report the process of the firmware updating.\r |
252b9c7a | 265 | \r |
266 | @param[in] Completion A value between 1 and 100 indicating the current completion\r | |
6e746540 | 267 | progress of the firmware update. Completion progress is\r |
252b9c7a | 268 | reported as from 1 to 100 percent. A value of 0 is used by\r |
269 | the driver to indicate that progress reporting is not supported.\r | |
270 | \r | |
271 | @retval EFI_SUCCESS SetImage() continues to do the callback if supported.\r | |
272 | @retval other SetImage() discontinues the callback and completes\r | |
273 | the update and returns.\r | |
274 | \r | |
275 | **/\r | |
276 | typedef\r | |
277 | EFI_STATUS\r | |
278 | (EFIAPI *EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS)(\r | |
279 | IN UINTN Completion\r | |
280 | );\r | |
281 | \r | |
282 | /**\r | |
283 | Returns information about the current firmware image(s) of the device.\r | |
284 | \r | |
285 | This function allows a copy of the current firmware image to be created and saved.\r | |
286 | The saved copy could later been used, for example, in firmware image recovery or rollback.\r | |
287 | \r | |
288 | @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.\r | |
6e746540 | 289 | @param[in, out] ImageInfoSize A pointer to the size, in bytes, of the ImageInfo buffer.\r |
252b9c7a | 290 | On input, this is the size of the buffer allocated by the caller.\r |
6e746540 | 291 | On output, it is the size of the buffer returned by the firmware\r |
252b9c7a | 292 | if the buffer was large enough, or the size of the buffer needed\r |
293 | to contain the image(s) information if the buffer was too small.\r | |
294 | @param[in, out] ImageInfo A pointer to the buffer in which firmware places the current image(s)\r | |
295 | information. The information is an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.\r | |
296 | @param[out] DescriptorVersion A pointer to the location in which firmware returns the version number\r | |
6e746540 | 297 | associated with the EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r |
252b9c7a | 298 | @param[out] DescriptorCount A pointer to the location in which firmware returns the number of\r |
299 | descriptors or firmware images within this device.\r | |
300 | @param[out] DescriptorSize A pointer to the location in which firmware returns the size, in bytes,\r | |
301 | of an individual EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r | |
302 | @param[out] PackageVersion A version number that represents all the firmware images in the device.\r | |
303 | The format is vendor specific and new version must have a greater value\r | |
304 | than the old version. If PackageVersion is not supported, the value is\r | |
305 | 0xFFFFFFFF. A value of 0xFFFFFFFE indicates that package version comparison\r | |
306 | is to be performed using PackageVersionName. A value of 0xFFFFFFFD indicates\r | |
307 | that package version update is in progress.\r | |
4f077902 | 308 | @param[out] PackageVersionName A pointer to a pointer to a null-terminated string representing the\r |
6e746540 | 309 | package version name. The buffer is allocated by this function with\r |
252b9c7a | 310 | AllocatePool(), and it is the caller's responsibility to free it with a call\r |
311 | to FreePool().\r | |
312 | \r | |
313 | @retval EFI_SUCCESS The device was successfully updated with the new image.\r | |
6e746540 HW |
314 | @retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too small. The current buffer size\r |
315 | needed to hold the image(s) information is returned in ImageInfoSize.\r | |
252b9c7a | 316 | @retval EFI_INVALID_PARAMETER ImageInfoSize is NULL.\r |
317 | @retval EFI_DEVICE_ERROR Valid information could not be returned. Possible corrupted image.\r | |
318 | \r | |
6e746540 | 319 | **/\r |
252b9c7a | 320 | typedef\r |
321 | EFI_STATUS\r | |
322 | (EFIAPI *EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GET_IMAGE_INFO)(\r | |
323 | IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,\r | |
324 | IN OUT UINTN *ImageInfoSize,\r | |
325 | IN OUT EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo,\r | |
326 | OUT UINT32 *DescriptorVersion,\r | |
327 | OUT UINT8 *DescriptorCount,\r | |
328 | OUT UINTN *DescriptorSize,\r | |
329 | OUT UINT32 *PackageVersion,\r | |
330 | OUT CHAR16 **PackageVersionName\r | |
331 | );\r | |
332 | \r | |
333 | /**\r | |
6e746540 | 334 | Retrieves a copy of the current firmware image of the device.\r |
252b9c7a | 335 | \r |
336 | This function allows a copy of the current firmware image to be created and saved.\r | |
337 | The saved copy could later been used, for example, in firmware image recovery or rollback.\r | |
338 | \r | |
52437cb7 SZ |
339 | @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.\r |
340 | @param[in] ImageIndex A unique number identifying the firmware image(s) within the device.\r | |
252b9c7a | 341 | The number is between 1 and DescriptorCount.\r |
ff95c0fc | 342 | @param[out] Image Points to the buffer where the current image is copied to.\r |
52437cb7 | 343 | @param[in, out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes.\r |
252b9c7a | 344 | On return, points to the length of the image, in bytes.\r |
345 | \r | |
346 | @retval EFI_SUCCESS The device was successfully updated with the new image.\r | |
6e746540 HW |
347 | @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to hold the\r |
348 | image. The current buffer size needed to hold the image is returned\r | |
252b9c7a | 349 | in ImageSize.\r |
350 | @retval EFI_INVALID_PARAMETER The Image was NULL.\r | |
351 | @retval EFI_NOT_FOUND The current image is not copied to the buffer.\r | |
352 | @retval EFI_UNSUPPORTED The operation is not supported.\r | |
58fe2772 | 353 | @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.\r |
252b9c7a | 354 | \r |
6e746540 | 355 | **/\r |
252b9c7a | 356 | typedef\r |
357 | EFI_STATUS\r | |
358 | (EFIAPI *EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GET_IMAGE)(\r | |
359 | IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,\r | |
360 | IN UINT8 ImageIndex,\r | |
ff95c0fc | 361 | OUT VOID *Image,\r |
252b9c7a | 362 | IN OUT UINTN *ImageSize\r |
363 | );\r | |
364 | \r | |
365 | /**\r | |
366 | Updates the firmware image of the device.\r | |
367 | \r | |
368 | This function updates the hardware with the new firmware image.\r | |
369 | This function returns EFI_UNSUPPORTED if the firmware image is not updatable.\r | |
370 | If the firmware image is updatable, the function should perform the following minimal validations\r | |
371 | before proceeding to do the firmware image update.\r | |
6e746540 HW |
372 | - Validate the image authentication if image has attribute\r |
373 | IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED. The function returns\r | |
252b9c7a | 374 | EFI_SECURITY_VIOLATION if the validation fails.\r |
6e746540 HW |
375 | - Validate the image is a supported image for this device. The function returns EFI_ABORTED if\r |
376 | the image is unsupported. The function can optionally provide more detailed information on\r | |
252b9c7a | 377 | why the image is not a supported image.\r |
6e746540 HW |
378 | - Validate the data from VendorCode if not null. Image validation must be performed before\r |
379 | VendorCode data validation. VendorCode data is ignored or considered invalid if image\r | |
380 | validation failed. The function returns EFI_ABORTED if the data is invalid.\r | |
381 | \r | |
382 | VendorCode enables vendor to implement vendor-specific firmware image update policy. Null if\r | |
383 | the caller did not specify the policy or use the default policy. As an example, vendor can implement\r | |
384 | a policy to allow an option to force a firmware image update when the abort reason is due to the new\r | |
385 | firmware image version is older than the current firmware image version or bad image checksum.\r | |
252b9c7a | 386 | Sensitive operations such as those wiping the entire firmware image and render the device to be\r |
387 | non-functional should be encoded in the image itself rather than passed with the VendorCode.\r | |
388 | AbortReason enables vendor to have the option to provide a more detailed description of the abort\r | |
389 | reason to the caller.\r | |
390 | \r | |
391 | @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.\r | |
392 | @param[in] ImageIndex A unique number identifying the firmware image(s) within the device.\r | |
393 | The number is between 1 and DescriptorCount.\r | |
394 | @param[in] Image Points to the new image.\r | |
395 | @param[in] ImageSize Size of the new image in bytes.\r | |
6e746540 | 396 | @param[in] VendorCode This enables vendor to implement vendor-specific firmware image update policy.\r |
252b9c7a | 397 | Null indicates the caller did not specify the policy or use the default policy.\r |
398 | @param[in] Progress A function used by the driver to report the progress of the firmware update.\r | |
4f077902 | 399 | @param[out] AbortReason A pointer to a pointer to a null-terminated string providing more\r |
6e746540 | 400 | details for the aborted operation. The buffer is allocated by this function\r |
252b9c7a | 401 | with AllocatePool(), and it is the caller's responsibility to free it with a\r |
402 | call to FreePool().\r | |
403 | \r | |
404 | @retval EFI_SUCCESS The device was successfully updated with the new image.\r | |
405 | @retval EFI_ABORTED The operation is aborted.\r | |
406 | @retval EFI_INVALID_PARAMETER The Image was NULL.\r | |
407 | @retval EFI_UNSUPPORTED The operation is not supported.\r | |
58fe2772 | 408 | @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.\r |
252b9c7a | 409 | \r |
6e746540 | 410 | **/\r |
252b9c7a | 411 | typedef\r |
412 | EFI_STATUS\r | |
413 | (EFIAPI *EFI_FIRMWARE_MANAGEMENT_PROTOCOL_SET_IMAGE)(\r | |
414 | IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,\r | |
415 | IN UINT8 ImageIndex,\r | |
416 | IN CONST VOID *Image,\r | |
417 | IN UINTN ImageSize,\r | |
418 | IN CONST VOID *VendorCode,\r | |
419 | IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress,\r | |
420 | OUT CHAR16 **AbortReason\r | |
421 | );\r | |
422 | \r | |
423 | /**\r | |
424 | Checks if the firmware image is valid for the device.\r | |
425 | \r | |
6e746540 | 426 | This function allows firmware update application to validate the firmware image without\r |
252b9c7a | 427 | invoking the SetImage() first.\r |
428 | \r | |
429 | @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.\r | |
430 | @param[in] ImageIndex A unique number identifying the firmware image(s) within the device.\r | |
431 | The number is between 1 and DescriptorCount.\r | |
432 | @param[in] Image Points to the new image.\r | |
433 | @param[in] ImageSize Size of the new image in bytes.\r | |
434 | @param[out] ImageUpdatable Indicates if the new image is valid for update. It also provides,\r | |
6e746540 | 435 | if available, additional information if the image is invalid.\r |
252b9c7a | 436 | \r |
437 | @retval EFI_SUCCESS The image was successfully checked.\r | |
438 | @retval EFI_INVALID_PARAMETER The Image was NULL.\r | |
439 | @retval EFI_UNSUPPORTED The operation is not supported.\r | |
58fe2772 | 440 | @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.\r |
252b9c7a | 441 | \r |
6e746540 | 442 | **/\r |
252b9c7a | 443 | typedef\r |
444 | EFI_STATUS\r | |
445 | (EFIAPI *EFI_FIRMWARE_MANAGEMENT_PROTOCOL_CHECK_IMAGE)(\r | |
446 | IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,\r | |
447 | IN UINT8 ImageIndex,\r | |
448 | IN CONST VOID *Image,\r | |
449 | IN UINTN ImageSize,\r | |
450 | OUT UINT32 *ImageUpdatable\r | |
451 | );\r | |
452 | \r | |
453 | /**\r | |
6e746540 | 454 | Returns information about the firmware package.\r |
252b9c7a | 455 | \r |
456 | This function returns package information.\r | |
457 | \r | |
458 | @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.\r | |
459 | @param[out] PackageVersion A version number that represents all the firmware images in the device.\r | |
460 | The format is vendor specific and new version must have a greater value\r | |
461 | than the old version. If PackageVersion is not supported, the value is\r | |
462 | 0xFFFFFFFF. A value of 0xFFFFFFFE indicates that package version\r | |
463 | comparison is to be performed using PackageVersionName. A value of\r | |
464 | 0xFFFFFFFD indicates that package version update is in progress.\r | |
4f077902 | 465 | @param[out] PackageVersionName A pointer to a pointer to a null-terminated string representing\r |
252b9c7a | 466 | the package version name. The buffer is allocated by this function with\r |
467 | AllocatePool(), and it is the caller's responsibility to free it with a\r | |
468 | call to FreePool().\r | |
469 | @param[out] PackageVersionNameMaxLen The maximum length of package version name if device supports update of\r | |
470 | package version name. A value of 0 indicates the device does not support\r | |
471 | update of package version name. Length is the number of Unicode characters,\r | |
472 | including the terminating null character.\r | |
6e746540 HW |
473 | @param[out] AttributesSupported Package attributes that are supported by this device. See 'Package Attribute\r |
474 | Definitions' for possible returned values of this parameter. A value of 1\r | |
252b9c7a | 475 | indicates the attribute is supported and the current setting value is\r |
476 | indicated in AttributesSetting. A value of 0 indicates the attribute is not\r | |
477 | supported and the current setting value in AttributesSetting is meaningless.\r | |
478 | @param[out] AttributesSetting Package attributes. See 'Package Attribute Definitions' for possible returned\r | |
479 | values of this parameter\r | |
480 | \r | |
481 | @retval EFI_SUCCESS The package information was successfully returned.\r | |
482 | @retval EFI_UNSUPPORTED The operation is not supported.\r | |
483 | \r | |
484 | **/\r | |
485 | typedef\r | |
486 | EFI_STATUS\r | |
487 | (EFIAPI *EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GET_PACKAGE_INFO)(\r | |
488 | IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,\r | |
489 | OUT UINT32 *PackageVersion,\r | |
490 | OUT CHAR16 **PackageVersionName,\r | |
491 | OUT UINT32 *PackageVersionNameMaxLen,\r | |
492 | OUT UINT64 *AttributesSupported,\r | |
493 | OUT UINT64 *AttributesSetting\r | |
494 | );\r | |
495 | \r | |
496 | /**\r | |
497 | Updates information about the firmware package.\r | |
498 | \r | |
499 | This function updates package information.\r | |
500 | This function returns EFI_UNSUPPORTED if the package information is not updatable.\r | |
501 | VendorCode enables vendor to implement vendor-specific package information update policy.\r | |
502 | Null if the caller did not specify this policy or use the default policy.\r | |
503 | \r | |
504 | @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.\r | |
505 | @param[in] Image Points to the authentication image.\r | |
506 | Null if authentication is not required.\r | |
507 | @param[in] ImageSize Size of the authentication image in bytes.\r | |
508 | 0 if authentication is not required.\r | |
509 | @param[in] VendorCode This enables vendor to implement vendor-specific firmware\r | |
6e746540 | 510 | image update policy.\r |
252b9c7a | 511 | Null indicates the caller did not specify this policy or use\r |
512 | the default policy.\r | |
513 | @param[in] PackageVersion The new package version.\r | |
514 | @param[in] PackageVersionName A pointer to the new null-terminated Unicode string representing\r | |
6e746540 HW |
515 | the package version name.\r |
516 | The string length is equal to or less than the value returned in\r | |
252b9c7a | 517 | PackageVersionNameMaxLen.\r |
518 | \r | |
519 | @retval EFI_SUCCESS The device was successfully updated with the new package\r | |
520 | information.\r | |
6e746540 | 521 | @retval EFI_INVALID_PARAMETER The PackageVersionName length is longer than the value\r |
252b9c7a | 522 | returned in PackageVersionNameMaxLen.\r |
523 | @retval EFI_UNSUPPORTED The operation is not supported.\r | |
58fe2772 | 524 | @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.\r |
252b9c7a | 525 | \r |
526 | **/\r | |
527 | typedef\r | |
528 | EFI_STATUS\r | |
529 | (EFIAPI *EFI_FIRMWARE_MANAGEMENT_PROTOCOL_SET_PACKAGE_INFO)(\r | |
530 | IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,\r | |
531 | IN CONST VOID *Image,\r | |
532 | IN UINTN ImageSize,\r | |
533 | IN CONST VOID *VendorCode,\r | |
534 | IN UINT32 PackageVersion,\r | |
535 | IN CONST CHAR16 *PackageVersionName\r | |
536 | );\r | |
537 | \r | |
538 | ///\r | |
539 | /// EFI_FIRMWARE_MANAGEMENT_PROTOCOL\r | |
540 | /// The protocol for managing firmware provides the following services.\r | |
541 | /// - Get the attributes of the current firmware image. Attributes include revision level.\r | |
6e746540 | 542 | /// - Get a copy of the current firmware image. As an example, this service could be used by a\r |
252b9c7a | 543 | /// management application to facilitate a firmware roll-back.\r |
544 | /// - Program the device with a firmware image supplied by the user.\r | |
545 | /// - Label all the firmware images within a device with a single version.\r | |
546 | ///\r | |
547 | struct _EFI_FIRMWARE_MANAGEMENT_PROTOCOL {\r | |
2f88bd3a MK |
548 | EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GET_IMAGE_INFO GetImageInfo;\r |
549 | EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GET_IMAGE GetImage;\r | |
550 | EFI_FIRMWARE_MANAGEMENT_PROTOCOL_SET_IMAGE SetImage;\r | |
551 | EFI_FIRMWARE_MANAGEMENT_PROTOCOL_CHECK_IMAGE CheckImage;\r | |
552 | EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GET_PACKAGE_INFO GetPackageInfo;\r | |
553 | EFI_FIRMWARE_MANAGEMENT_PROTOCOL_SET_PACKAGE_INFO SetPackageInfo;\r | |
252b9c7a | 554 | };\r |
555 | \r | |
2f88bd3a | 556 | extern EFI_GUID gEfiFirmwareManagementProtocolGuid;\r |
252b9c7a | 557 | \r |
558 | #endif\r |