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