]> git.proxmox.com Git - mirror_edk2.git/blame - FmpDevicePkg/Include/Library/FmpDeviceLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / FmpDevicePkg / Include / Library / FmpDeviceLib.h
CommitLineData
a6d73269 1/** @file\r
cec7b8fb
KM
2 Provides firmware device specific services to support updates of a firmware\r
3 image stored in a firmware device.\r
4\r
6ad819c1 5 Copyright (c) Microsoft Corporation.<BR>\r
8d01f2f4 6 Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>\r
cec7b8fb 7\r
bcef758c 8 SPDX-License-Identifier: BSD-2-Clause-Patent\r
cec7b8fb
KM
9\r
10**/\r
11\r
12#ifndef __FMP_DEVICE_LIB__\r
13#define __FMP_DEVICE_LIB__\r
14\r
15#include <Protocol/FirmwareManagement.h>\r
16\r
17/**\r
18 Callback function that installs a Firmware Management Protocol instance onto\r
19 a handle.\r
20\r
21 @param[in] Handle The device handle to install a Firmware Management\r
22 Protocol instance.\r
23\r
24 @retval EFI_SUCCESS A Firmware Management Protocol instance was\r
25 installed onto Handle.\r
26 @retval EFI_INVALID_PARAMETER Handle is invalid\r
27 @retval other A Firmware Management Protocol instance could\r
28 not be installed onto Handle.\r
29\r
30**/\r
31typedef\r
32EFI_STATUS\r
33(EFIAPI *FMP_DEVICE_LIB_REGISTER_FMP_INSTALLER)(\r
34 IN EFI_HANDLE Handle\r
35 );\r
36\r
8d01f2f4
EJ
37/**\r
38 Callback function that uninstalls a Firmware Management Protocol instance from\r
39 a handle.\r
40\r
41 @param[in] Handle The device handle to uninstall a Firmware Management\r
42 Protocol instance.\r
43\r
44 @retval EFI_SUCCESS A Firmware Management Protocol instance was\r
45 uninstalled from Handle.\r
46 @retval EFI_INVALID_PARAMETER Handle is invalid\r
47 @retval other A Firmware Management Protocol instance could\r
48 not be uninstalled from Handle.\r
49\r
50**/\r
51typedef\r
52EFI_STATUS\r
53(EFIAPI *FMP_DEVICE_LIB_REGISTER_FMP_UNINSTALLER)(\r
54 IN EFI_HANDLE Handle\r
55 );\r
56\r
cec7b8fb
KM
57/**\r
58 Provide a function to install the Firmware Management Protocol instance onto a\r
59 device handle when the device is managed by a driver that follows the UEFI\r
60 Driver Model. If the device is not managed by a driver that follows the UEFI\r
61 Driver Model, then EFI_UNSUPPORTED is returned.\r
62\r
63 @param[in] FmpInstaller Function that installs the Firmware Management\r
64 Protocol.\r
65\r
66 @retval EFI_SUCCESS The device is managed by a driver that follows the\r
67 UEFI Driver Model. FmpInstaller must be called on\r
68 each Driver Binding Start().\r
69 @retval EFI_UNSUPPORTED The device is not managed by a driver that follows\r
70 the UEFI Driver Model.\r
71 @retval other The Firmware Management Protocol for this firmware\r
72 device is not installed. The firmware device is\r
73 still locked using FmpDeviceLock().\r
74\r
75**/\r
76EFI_STATUS\r
77EFIAPI\r
78RegisterFmpInstaller (\r
79 IN FMP_DEVICE_LIB_REGISTER_FMP_INSTALLER FmpInstaller\r
80 );\r
81\r
8d01f2f4
EJ
82/**\r
83 Provide a function to uninstall the Firmware Management Protocol instance from a\r
84 device handle when the device is managed by a driver that follows the UEFI\r
85 Driver Model. If the device is not managed by a driver that follows the UEFI\r
86 Driver Model, then EFI_UNSUPPORTED is returned.\r
87\r
88 @param[in] FmpUninstaller Function that installs the Firmware Management\r
89 Protocol.\r
90\r
91 @retval EFI_SUCCESS The device is managed by a driver that follows the\r
95d28836 92 UEFI Driver Model. FmpUninstaller must be called on\r
8d01f2f4
EJ
93 each Driver Binding Stop().\r
94 @retval EFI_UNSUPPORTED The device is not managed by a driver that follows\r
95 the UEFI Driver Model.\r
96 @retval other The Firmware Management Protocol for this firmware\r
97 device is not installed. The firmware device is\r
98 still locked using FmpDeviceLock().\r
99\r
100**/\r
101EFI_STATUS\r
102EFIAPI\r
103RegisterFmpUninstaller (\r
104 IN FMP_DEVICE_LIB_REGISTER_FMP_UNINSTALLER FmpUninstaller\r
105 );\r
106\r
107/**\r
108 Set the device context for the FmpDeviceLib services when the device is\r
109 managed by a driver that follows the UEFI Driver Model. If the device is not\r
110 managed by a driver that follows the UEFI Driver Model, then EFI_UNSUPPORTED\r
111 is returned. Once a device context is set, the FmpDeviceLib services\r
112 operate on the currently set device context.\r
113\r
114 @param[in] Handle Device handle for the FmpDeviceLib services.\r
115 If Handle is NULL, then Context is freed.\r
116 @param[in, out] Context Device context for the FmpDeviceLib services.\r
117 If Context is NULL, then a new context is allocated\r
118 for Handle and the current device context is set and\r
119 returned in Context. If Context is not NULL, then\r
120 the current device context is set.\r
121\r
122 @retval EFI_SUCCESS The device is managed by a driver that follows the\r
123 UEFI Driver Model.\r
124 @retval EFI_UNSUPPORTED The device is not managed by a driver that follows\r
125 the UEFI Driver Model.\r
126 @retval other The Firmware Management Protocol for this firmware\r
127 device is not installed. The firmware device is\r
128 still locked using FmpDeviceLock().\r
129\r
130**/\r
131EFI_STATUS\r
132EFIAPI\r
133FmpDeviceSetContext (\r
134 IN EFI_HANDLE Handle,\r
135 IN OUT VOID **Context\r
136 );\r
137\r
cec7b8fb
KM
138/**\r
139 Returns the size, in bytes, of the firmware image currently stored in the\r
140 firmware device. This function is used to by the GetImage() and\r
141 GetImageInfo() services of the Firmware Management Protocol. If the image\r
142 size can not be determined from the firmware device, then 0 must be returned.\r
143\r
144 @param[out] Size Pointer to the size, in bytes, of the firmware image\r
145 currently stored in the firmware device.\r
146\r
147 @retval EFI_SUCCESS The size of the firmware image currently\r
148 stored in the firmware device was returned.\r
149 @retval EFI_INVALID_PARAMETER Size is NULL.\r
150 @retval EFI_UNSUPPORTED The firmware device does not support reporting\r
151 the size of the currently stored firmware image.\r
43622317 152 @retval EFI_DEVICE_ERROR An error occurred attempting to determine the\r
cec7b8fb
KM
153 size of the firmware image currently stored in\r
154 in the firmware device.\r
155\r
156**/\r
157EFI_STATUS\r
158EFIAPI\r
159FmpDeviceGetSize (\r
160 OUT UINTN *Size\r
161 );\r
162\r
163/**\r
164 Returns the GUID value used to fill in the ImageTypeId field of the\r
165 EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo()\r
166 service of the Firmware Management Protocol. If EFI_UNSUPPORTED is returned,\r
167 then the ImageTypeId field is set to gEfiCallerIdGuid. If EFI_SUCCESS is\r
168 returned, then ImageTypeId is set to the Guid returned from this function.\r
169\r
170 @param[out] Guid Double pointer to a GUID value that is updated to point to\r
171 to a GUID value. The GUID value is not allocated and must\r
172 not be modified or freed by the caller.\r
173\r
174 @retval EFI_SUCCESS EFI_FIRMWARE_IMAGE_DESCRIPTOR ImageTypeId GUID is set\r
175 to the returned Guid value.\r
176 @retval EFI_UNSUPPORTED EFI_FIRMWARE_IMAGE_DESCRIPTOR ImageTypeId GUID is set\r
177 to gEfiCallerIdGuid.\r
178\r
179**/\r
180EFI_STATUS\r
181EFIAPI\r
182FmpDeviceGetImageTypeIdGuidPtr (\r
183 OUT EFI_GUID **Guid\r
184 );\r
185\r
186/**\r
187 Returns values used to fill in the AttributesSupported and AttributesSettings\r
188 fields of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the\r
189 GetImageInfo() service of the Firmware Management Protocol. The following\r
190 bit values from the Firmware Management Protocol may be combined:\r
191 IMAGE_ATTRIBUTE_IMAGE_UPDATABLE\r
192 IMAGE_ATTRIBUTE_RESET_REQUIRED\r
193 IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED\r
194 IMAGE_ATTRIBUTE_IN_USE\r
195 IMAGE_ATTRIBUTE_UEFI_IMAGE\r
196\r
197 @param[out] Supported Attributes supported by this firmware device.\r
198 @param[out] Setting Attributes settings for this firmware device.\r
199\r
200 @retval EFI_SUCCESS The attributes supported by the firmware\r
201 device were returned.\r
202 @retval EFI_INVALID_PARAMETER Supported is NULL.\r
203 @retval EFI_INVALID_PARAMETER Setting is NULL.\r
204\r
205**/\r
206EFI_STATUS\r
207EFIAPI\r
208FmpDeviceGetAttributes (\r
45ce0a67
MK
209 OUT UINT64 *Supported,\r
210 OUT UINT64 *Setting\r
cec7b8fb
KM
211 );\r
212\r
213/**\r
214 Returns the value used to fill in the LowestSupportedVersion field of the\r
215 EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo()\r
216 service of the Firmware Management Protocol. If EFI_SUCCESS is returned, then\r
217 the firmware device supports a method to report the LowestSupportedVersion\r
218 value from the currently stored firmware image. If the value can not be\r
219 reported for the firmware image currently stored in the firmware device, then\r
220 EFI_UNSUPPORTED must be returned. EFI_DEVICE_ERROR is returned if an error\r
221 occurs attempting to retrieve the LowestSupportedVersion value for the\r
222 currently stored firmware image.\r
223\r
224 @note It is recommended that all firmware devices support a method to report\r
225 the LowestSupportedVersion value from the currently stored firmware\r
226 image.\r
227\r
228 @param[out] LowestSupportedVersion LowestSupportedVersion value retrieved\r
229 from the currently stored firmware image.\r
230\r
231 @retval EFI_SUCCESS The lowest supported version of currently stored\r
232 firmware image was returned in LowestSupportedVersion.\r
233 @retval EFI_UNSUPPORTED The firmware device does not support a method to\r
234 report the lowest supported version of the currently\r
235 stored firmware image.\r
236 @retval EFI_DEVICE_ERROR An error occurred attempting to retrieve the lowest\r
237 supported version of the currently stored firmware\r
238 image.\r
239\r
240**/\r
241EFI_STATUS\r
242EFIAPI\r
243FmpDeviceGetLowestSupportedVersion (\r
244 OUT UINT32 *LowestSupportedVersion\r
245 );\r
246\r
247/**\r
248 Returns the Null-terminated Unicode string that is used to fill in the\r
249 VersionName field of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is\r
250 returned by the GetImageInfo() service of the Firmware Management Protocol.\r
251 The returned string must be allocated using EFI_BOOT_SERVICES.AllocatePool().\r
252\r
253 @note It is recommended that all firmware devices support a method to report\r
254 the VersionName string from the currently stored firmware image.\r
255\r
256 @param[out] VersionString The version string retrieved from the currently\r
257 stored firmware image.\r
258\r
259 @retval EFI_SUCCESS The version string of currently stored\r
260 firmware image was returned in Version.\r
261 @retval EFI_INVALID_PARAMETER VersionString is NULL.\r
262 @retval EFI_UNSUPPORTED The firmware device does not support a method\r
263 to report the version string of the currently\r
264 stored firmware image.\r
265 @retval EFI_DEVICE_ERROR An error occurred attempting to retrieve the\r
266 version string of the currently stored\r
267 firmware image.\r
268 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate the\r
269 buffer for the version string of the currently\r
270 stored firmware image.\r
271\r
272**/\r
273EFI_STATUS\r
274EFIAPI\r
275FmpDeviceGetVersionString (\r
276 OUT CHAR16 **VersionString\r
277 );\r
278\r
279/**\r
280 Returns the value used to fill in the Version field of the\r
281 EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo()\r
282 service of the Firmware Management Protocol. If EFI_SUCCESS is returned, then\r
283 the firmware device supports a method to report the Version value from the\r
284 currently stored firmware image. If the value can not be reported for the\r
285 firmware image currently stored in the firmware device, then EFI_UNSUPPORTED\r
286 must be returned. EFI_DEVICE_ERROR is returned if an error occurs attempting\r
287 to retrieve the LowestSupportedVersion value for the currently stored firmware\r
288 image.\r
289\r
290 @note It is recommended that all firmware devices support a method to report\r
291 the Version value from the currently stored firmware image.\r
292\r
293 @param[out] Version The version value retrieved from the currently stored\r
294 firmware image.\r
295\r
296 @retval EFI_SUCCESS The version of currently stored firmware image was\r
297 returned in Version.\r
298 @retval EFI_UNSUPPORTED The firmware device does not support a method to\r
299 report the version of the currently stored firmware\r
300 image.\r
301 @retval EFI_DEVICE_ERROR An error occurred attempting to retrieve the version\r
302 of the currently stored firmware image.\r
303\r
304**/\r
305EFI_STATUS\r
306EFIAPI\r
307FmpDeviceGetVersion (\r
308 OUT UINT32 *Version\r
309 );\r
310\r
8d01f2f4
EJ
311/**\r
312 Returns the value used to fill in the HardwareInstance field of the\r
313 EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo()\r
314 service of the Firmware Management Protocol. If EFI_SUCCESS is returned, then\r
315 the firmware device supports a method to report the HardwareInstance value.\r
316 If the value can not be reported for the firmware device, then EFI_UNSUPPORTED\r
317 must be returned. EFI_DEVICE_ERROR is returned if an error occurs attempting\r
318 to retrieve the HardwareInstance value for the firmware device.\r
319\r
320 @param[out] HardwareInstance The hardware instance value for the firmware\r
321 device.\r
322\r
323 @retval EFI_SUCCESS The hardware instance for the current firmware\r
95d28836 324 device is returned in HardwareInstance.\r
8d01f2f4
EJ
325 @retval EFI_UNSUPPORTED The firmware device does not support a method to\r
326 report the hardware instance value.\r
327 @retval EFI_DEVICE_ERROR An error occurred attempting to retrieve the hardware\r
328 instance value.\r
329\r
330**/\r
331EFI_STATUS\r
332EFIAPI\r
333FmpDeviceGetHardwareInstance (\r
334 OUT UINT64 *HardwareInstance\r
335 );\r
336\r
cec7b8fb
KM
337/**\r
338 Returns a copy of the firmware image currently stored in the firmware device.\r
339\r
340 @note It is recommended that all firmware devices support a method to retrieve\r
341 a copy currently stored firmware image. This can be used to support\r
342 features such as recovery and rollback.\r
343\r
a6d73269 344 @param[out] Image Pointer to a caller allocated buffer where the\r
cec7b8fb 345 currently stored firmware image is copied to.\r
a6d73269 346 @param[in, out] ImageSize Pointer the size, in bytes, of the Image buffer.\r
cec7b8fb
KM
347 On return, points to the size, in bytes, of firmware\r
348 image currently stored in the firmware device.\r
349\r
350 @retval EFI_SUCCESS Image contains a copy of the firmware image\r
351 currently stored in the firmware device, and\r
352 ImageSize contains the size, in bytes, of the\r
353 firmware image currently stored in the\r
354 firmware device.\r
355 @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small\r
356 to hold the firmware image currently stored in\r
357 the firmware device. The buffer size required\r
358 is returned in ImageSize.\r
359 @retval EFI_INVALID_PARAMETER The Image is NULL.\r
360 @retval EFI_INVALID_PARAMETER The ImageSize is NULL.\r
361 @retval EFI_UNSUPPORTED The operation is not supported.\r
362 @retval EFI_DEVICE_ERROR An error occurred attempting to retrieve the\r
363 firmware image currently stored in the firmware\r
364 device.\r
365\r
366**/\r
367EFI_STATUS\r
368EFIAPI\r
369FmpDeviceGetImage (\r
a6d73269
SZ
370 OUT VOID *Image,\r
371 IN OUT UINTN *ImageSize\r
cec7b8fb
KM
372 );\r
373\r
374/**\r
375 Checks if a new firmware image is valid for the firmware device. This\r
376 function allows firmware update operation to validate the firmware image\r
377 before FmpDeviceSetImage() is called.\r
378\r
379 @param[in] Image Points to a new firmware image.\r
380 @param[in] ImageSize Size, in bytes, of a new firmware image.\r
381 @param[out] ImageUpdatable Indicates if a new firmware image is valid for\r
382 a firmware update to the firmware device. The\r
383 following values from the Firmware Management\r
384 Protocol are supported:\r
385 IMAGE_UPDATABLE_VALID\r
386 IMAGE_UPDATABLE_INVALID\r
387 IMAGE_UPDATABLE_INVALID_TYPE\r
388 IMAGE_UPDATABLE_INVALID_OLD\r
389 IMAGE_UPDATABLE_VALID_WITH_VENDOR_CODE\r
390\r
391 @retval EFI_SUCCESS The image was successfully checked. Additional\r
392 status information is returned in\r
a6d73269 393 ImageUpdatable.\r
cec7b8fb 394 @retval EFI_INVALID_PARAMETER Image is NULL.\r
a6d73269 395 @retval EFI_INVALID_PARAMETER ImageUpdatable is NULL.\r
cec7b8fb
KM
396\r
397**/\r
398EFI_STATUS\r
399EFIAPI\r
400FmpDeviceCheckImage (\r
401 IN CONST VOID *Image,\r
402 IN UINTN ImageSize,\r
a6d73269 403 OUT UINT32 *ImageUpdatable\r
cec7b8fb
KM
404 );\r
405\r
6ad819c1
MK
406/**\r
407 Checks if a new firmware image is valid for the firmware device. This\r
408 function allows firmware update operation to validate the firmware image\r
409 before FmpDeviceSetImage() is called.\r
410\r
411 @param[in] Image Points to a new firmware image.\r
412 @param[in] ImageSize Size, in bytes, of a new firmware image.\r
413 @param[out] ImageUpdatable Indicates if a new firmware image is valid for\r
414 a firmware update to the firmware device. The\r
415 following values from the Firmware Management\r
416 Protocol are supported:\r
417 IMAGE_UPDATABLE_VALID\r
418 IMAGE_UPDATABLE_INVALID\r
419 IMAGE_UPDATABLE_INVALID_TYPE\r
420 IMAGE_UPDATABLE_INVALID_OLD\r
421 IMAGE_UPDATABLE_VALID_WITH_VENDOR_CODE\r
422 @param[out] LastAttemptStatus A pointer to a UINT32 that holds the last attempt\r
423 status to report back to the ESRT table in case\r
772c5bb8 424 of error.\r
6ad819c1
MK
425\r
426 The return status code must fall in the range of\r
427 LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE to\r
428 LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE.\r
429\r
430 If the value falls outside this range, it will be converted\r
431 to LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL.\r
432\r
433 @retval EFI_SUCCESS The image was successfully checked. Additional\r
434 status information is returned in\r
435 ImageUpdatable.\r
436 @retval EFI_INVALID_PARAMETER Image is NULL.\r
437 @retval EFI_INVALID_PARAMETER ImageUpdatable is NULL.\r
438\r
439**/\r
440EFI_STATUS\r
441EFIAPI\r
442FmpDeviceCheckImageWithStatus (\r
443 IN CONST VOID *Image,\r
444 IN UINTN ImageSize,\r
445 OUT UINT32 *ImageUpdatable,\r
446 OUT UINT32 *LastAttemptStatus\r
447 );\r
448\r
cec7b8fb
KM
449/**\r
450 Updates a firmware device with a new firmware image. This function returns\r
451 EFI_UNSUPPORTED if the firmware image is not updatable. If the firmware image\r
452 is updatable, the function should perform the following minimal validations\r
453 before proceeding to do the firmware image update.\r
454 - Validate that the image is a supported image for this firmware device.\r
455 Return EFI_ABORTED if the image is not supported. Additional details\r
456 on why the image is not a supported image may be returned in AbortReason.\r
457 - Validate the data from VendorCode if is not NULL. Firmware image\r
458 validation must be performed before VendorCode data validation.\r
459 VendorCode data is ignored or considered invalid if image validation\r
460 fails. Return EFI_ABORTED if the VendorCode data is invalid.\r
461\r
462 VendorCode enables vendor to implement vendor-specific firmware image update\r
463 policy. Null if the caller did not specify the policy or use the default\r
464 policy. As an example, vendor can implement a policy to allow an option to\r
465 force a firmware image update when the abort reason is due to the new firmware\r
466 image version is older than the current firmware image version or bad image\r
467 checksum. Sensitive operations such as those wiping the entire firmware image\r
468 and render the device to be non-functional should be encoded in the image\r
469 itself rather than passed with the VendorCode. AbortReason enables vendor to\r
470 have the option to provide a more detailed description of the abort reason to\r
471 the caller.\r
472\r
473 @param[in] Image Points to the new firmware image.\r
474 @param[in] ImageSize Size, in bytes, of the new firmware image.\r
475 @param[in] VendorCode This enables vendor to implement vendor-specific\r
476 firmware image update policy. NULL indicates\r
477 the caller did not specify the policy or use the\r
478 default policy.\r
479 @param[in] Progress A function used to report the progress of\r
480 updating the firmware device with the new\r
481 firmware image.\r
482 @param[in] CapsuleFwVersion The version of the new firmware image from the\r
483 update capsule that provided the new firmware\r
484 image.\r
485 @param[out] AbortReason A pointer to a pointer to a Null-terminated\r
486 Unicode string providing more details on an\r
487 aborted operation. The buffer is allocated by\r
488 this function with\r
489 EFI_BOOT_SERVICES.AllocatePool(). It is the\r
490 caller's responsibility to free this buffer with\r
491 EFI_BOOT_SERVICES.FreePool().\r
492\r
493 @retval EFI_SUCCESS The firmware device was successfully updated\r
494 with the new firmware image.\r
495 @retval EFI_ABORTED The operation is aborted. Additional details\r
496 are provided in AbortReason.\r
497 @retval EFI_INVALID_PARAMETER The Image was NULL.\r
498 @retval EFI_UNSUPPORTED The operation is not supported.\r
499\r
500**/\r
501EFI_STATUS\r
502EFIAPI\r
503FmpDeviceSetImage (\r
504 IN CONST VOID *Image,\r
505 IN UINTN ImageSize,\r
9c721071
MK
506 IN CONST VOID *VendorCode OPTIONAL,\r
507 IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress OPTIONAL,\r
cec7b8fb
KM
508 IN UINT32 CapsuleFwVersion,\r
509 OUT CHAR16 **AbortReason\r
510 );\r
511\r
6ad819c1
MK
512/**\r
513 Updates a firmware device with a new firmware image. This function returns\r
514 EFI_UNSUPPORTED if the firmware image is not updatable. If the firmware image\r
515 is updatable, the function should perform the following minimal validations\r
516 before proceeding to do the firmware image update.\r
517 - Validate that the image is a supported image for this firmware device.\r
518 Return EFI_ABORTED if the image is not supported. Additional details\r
519 on why the image is not a supported image may be returned in AbortReason.\r
520 - Validate the data from VendorCode if is not NULL. Firmware image\r
521 validation must be performed before VendorCode data validation.\r
522 VendorCode data is ignored or considered invalid if image validation\r
523 fails. Return EFI_ABORTED if the VendorCode data is invalid.\r
524\r
525 VendorCode enables vendor to implement vendor-specific firmware image update\r
526 policy. Null if the caller did not specify the policy or use the default\r
527 policy. As an example, vendor can implement a policy to allow an option to\r
528 force a firmware image update when the abort reason is due to the new firmware\r
529 image version is older than the current firmware image version or bad image\r
530 checksum. Sensitive operations such as those wiping the entire firmware image\r
531 and render the device to be non-functional should be encoded in the image\r
532 itself rather than passed with the VendorCode. AbortReason enables vendor to\r
533 have the option to provide a more detailed description of the abort reason to\r
534 the caller.\r
535\r
536 @param[in] Image Points to the new firmware image.\r
537 @param[in] ImageSize Size, in bytes, of the new firmware image.\r
538 @param[in] VendorCode This enables vendor to implement vendor-specific\r
539 firmware image update policy. NULL indicates\r
540 the caller did not specify the policy or use the\r
541 default policy.\r
542 @param[in] Progress A function used to report the progress of\r
543 updating the firmware device with the new\r
544 firmware image.\r
545 @param[in] CapsuleFwVersion The version of the new firmware image from the\r
546 update capsule that provided the new firmware\r
547 image.\r
548 @param[out] AbortReason A pointer to a pointer to a Null-terminated\r
549 Unicode string providing more details on an\r
550 aborted operation. The buffer is allocated by\r
551 this function with\r
552 EFI_BOOT_SERVICES.AllocatePool(). It is the\r
553 caller's responsibility to free this buffer with\r
554 EFI_BOOT_SERVICES.FreePool().\r
555 @param[out] LastAttemptStatus A pointer to a UINT32 that holds the last attempt\r
556 status to report back to the ESRT table in case\r
557 of error. This value will only be checked when this\r
558 function returns an error.\r
559\r
560 The return status code must fall in the range of\r
561 LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE to\r
562 LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE.\r
563\r
564 If the value falls outside this range, it will be converted\r
565 to LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL.\r
566\r
567 @retval EFI_SUCCESS The firmware device was successfully updated\r
568 with the new firmware image.\r
569 @retval EFI_ABORTED The operation is aborted. Additional details\r
570 are provided in AbortReason.\r
571 @retval EFI_INVALID_PARAMETER The Image was NULL.\r
572 @retval EFI_UNSUPPORTED The operation is not supported.\r
573\r
574**/\r
575EFI_STATUS\r
576EFIAPI\r
577FmpDeviceSetImageWithStatus (\r
578 IN CONST VOID *Image,\r
579 IN UINTN ImageSize,\r
9c721071
MK
580 IN CONST VOID *VendorCode OPTIONAL,\r
581 IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress OPTIONAL,\r
6ad819c1
MK
582 IN UINT32 CapsuleFwVersion,\r
583 OUT CHAR16 **AbortReason,\r
584 OUT UINT32 *LastAttemptStatus\r
585 );\r
586\r
cec7b8fb
KM
587/**\r
588 Lock the firmware device that contains a firmware image. Once a firmware\r
589 device is locked, any attempts to modify the firmware image contents in the\r
590 firmware device must fail.\r
591\r
592 @note It is recommended that all firmware devices support a lock method to\r
593 prevent modifications to a stored firmware image.\r
594\r
595 @note A firmware device lock mechanism is typically only cleared by a full\r
596 system reset (not just sleep state/low power mode).\r
597\r
598 @retval EFI_SUCCESS The firmware device was locked.\r
599 @retval EFI_UNSUPPORTED The firmware device does not support locking\r
600\r
601**/\r
602EFI_STATUS\r
603EFIAPI\r
604FmpDeviceLock (\r
605 VOID\r
606 );\r
607\r
608#endif\r