From 005cfbe1d76492c28ae6770cc6c109dee15a19c3 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Mon, 29 Jan 2018 15:16:09 +0000 Subject: Silicon/SynQuacerPlatformFlashAccessLib: add capsule update progress bar Reuse the BootLogoLib graphical progress bar to show the progress of a capsule update, and in absence of a graphical console, write a period to the text console for each block updated. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- .../SynQuacerPlatformFlashAccessLib.c | 35 ++++++++++++++++++++++ .../SynQuacerPlatformFlashAccessLib.inf | 3 ++ 2 files changed, 38 insertions(+) (limited to 'Silicon') diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c index 5a67f8c009..fbb8f1f9e4 100644 --- a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c +++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c @@ -16,11 +16,13 @@ #include #include +#include #include #include #include #include #include +#include #include @@ -145,6 +147,17 @@ PerformFlashWrite ( EFI_LBA Lba; EFI_PHYSICAL_ADDRESS FvbBaseAddress; UINTN NumBytes; + EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Black; + EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION White; + UINTN Resolution; + UINTN Progress; + BOOLEAN HaveBootGraphics; + + Black.Raw = 0x00000000; + White.Raw = 0x00FFFFFF; + + Status = BootLogoEnableLogo (); + HaveBootGraphics = !EFI_ERROR (Status); if (FlashAddressType != FlashAddressTypeAbsoluteAddress) { DEBUG ((DEBUG_ERROR, "%a: only FlashAddressTypeAbsoluteAddress supported\n", @@ -213,6 +226,16 @@ PerformFlashWrite ( return Status; } + if (HaveBootGraphics) { + Resolution = (BlockSize * 100) / Length + 1; + Progress = 0; + + Status = BootLogoUpdateProgress (White.Pixel, Black.Pixel, + L"Updating firmware - please wait", Black.Pixel, 100, 0); + } else { + Print (L"Updating firmware - please wait "); + } + // // Erase the region // @@ -242,10 +265,22 @@ PerformFlashWrite ( __FUNCTION__, Lba, Status, NumBytes)); } + if (HaveBootGraphics) { + Status = BootLogoUpdateProgress (White.Pixel, Black.Pixel, + L"Updating firmware - please wait", White.Pixel, + Progress + Resolution, Progress); + Progress += Resolution; + } else { + Print (L"."); + } + Buffer += BlockSize; Length -= BlockSize; Lba++; } + if (!HaveBootGraphics) { + Print (L"\n"); + } return EFI_SUCCESS; } diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.inf b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.inf index 33f4795ddc..4dfa11372a 100644 --- a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.inf +++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.inf @@ -24,6 +24,7 @@ SynQuacerPlatformFlashAccessLib.c [Packages] + MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec SignedCapsulePkg/SignedCapsulePkg.dec @@ -32,7 +33,9 @@ [LibraryClasses] BaseMemoryLib + BootLogoLib DebugLib DxeServicesTableLib UefiBootServicesTableLib + UefiLib -- cgit v1.2.3