summaryrefslogtreecommitdiff
path: root/Silicon
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2018-01-29 15:16:09 +0000
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2018-01-29 16:06:57 +0000
commit005cfbe1d76492c28ae6770cc6c109dee15a19c3 (patch)
tree05059840faacdb9cdf2107ed088366b41f4990d0 /Silicon
parent265bb85cdfb8d9f43fa9a112bfb549bb6ad68123 (diff)
downloadedk2-platforms-005cfbe1d76492c28ae6770cc6c109dee15a19c3.tar.xz
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 <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'Silicon')
-rw-r--r--Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c35
-rw-r--r--Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.inf3
2 files changed, 38 insertions, 0 deletions
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 <PiDxe.h>
#include <Library/BaseMemoryLib.h>
+#include <Library/BootLogoLib.h>
#include <Library/DebugLib.h>
#include <Library/DxeServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PlatformFlashAccessLib.h>
#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
#include <Protocol/FirmwareVolumeBlock.h>
@@ -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