#include <Protocol/GraphicsOutput.h>\r
#include <Protocol/EsrtManagement.h>\r
#include <Protocol/FirmwareManagement.h>\r
+#include <Protocol/FirmwareManagementProgress.h>\r
#include <Protocol/DevicePath.h>\r
\r
EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable = NULL;\r
BOOLEAN mDxeCapsuleLibEndOfDxe = FALSE;\r
EFI_EVENT mDxeCapsuleLibEndOfDxeEvent = NULL;\r
\r
+EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL *mFmpProgress = NULL;\r
+\r
/**\r
Initialize capsule related variables.\r
**/\r
Function indicate the current completion progress of the firmware\r
update. Platform may override with own specific progress function.\r
\r
- @param[in] Completion A value between 1 and 100 indicating the current completion progress of the firmware update\r
+ @param[in] Completion A value between 1 and 100 indicating the current\r
+ completion progress of the firmware update\r
\r
- @retval EFI_SUCESS Input capsule is a correct FMP capsule.\r
+ @retval EFI_SUCESS The capsule update progress was updated.\r
+ @retval EFI_INVALID_PARAMETER Completion is greater than 100%.\r
**/\r
EFI_STATUS\r
EFIAPI\r
-Update_Image_Progress (\r
+UpdateImageProgress (\r
IN UINTN Completion\r
- )\r
-{\r
- return EFI_SUCCESS;\r
-}\r
+ );\r
\r
/**\r
Return if this CapsuleGuid is a FMP capsule GUID or not.\r
return Status;\r
}\r
\r
+ //\r
+ // Lookup Firmware Management Progress Protocol before SetImage() is called\r
+ // This is an optional protocol that may not be present on Handle.\r
+ //\r
+ Status = gBS->HandleProtocol (\r
+ Handle,\r
+ &gEdkiiFirmwareManagementProgressProtocolGuid,\r
+ (VOID **)&mFmpProgress\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ mFmpProgress = NULL;\r
+ }\r
+\r
if (ImageHeader->Version >= EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION) {\r
Image = (UINT8 *)(ImageHeader + 1);\r
} else {\r
DEBUG((DEBUG_INFO, "(UpdateHardwareInstance - 0x%x)", ImageHeader->UpdateHardwareInstance));\r
}\r
DEBUG((DEBUG_INFO, "\n"));\r
+\r
+ //\r
+ // Before calling SetImage(), reset the progress bar to 0%\r
+ //\r
+ UpdateImageProgress (0);\r
+\r
Status = Fmp->SetImage(\r
Fmp,\r
ImageHeader->UpdateImageIndex, // ImageIndex\r
Image, // Image\r
ImageHeader->UpdateImageSize, // ImageSize\r
VendorCode, // VendorCode\r
- Update_Image_Progress, // Progress\r
+ UpdateImageProgress, // Progress\r
&AbortReason // AbortReason\r
);\r
+ //\r
+ // Set the progress bar to 100% after returning from SetImage()\r
+ //\r
+ UpdateImageProgress (100);\r
+\r
DEBUG((DEBUG_INFO, "Fmp->SetImage - %r\n", Status));\r
if (AbortReason != NULL) {\r
DEBUG ((DEBUG_ERROR, "%s\n", AbortReason));\r
FreePool(AbortReason);\r
}\r
\r
+ //\r
+ // Clear mFmpProgress after SetImage() returns\r
+ //\r
+ mFmpProgress = NULL;\r
+\r
return Status;\r
}\r
\r