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