From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org
Cc: leif.lindholm@linaro.org, Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH edk2-platforms 4/4] Silicon/SynQuacerPlatformFlashAccessLib: add capsule update progress bar
Date: Mon, 29 Jan 2018 15:44:16 +0000 [thread overview]
Message-ID: <20180129154416.3622-5-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20180129154416.3622-1-ard.biesheuvel@linaro.org>
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>
---
Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c | 35 ++++++++++++++++++++
Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.inf | 3 ++
2 files changed, 38 insertions(+)
diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c
index 5a67f8c00995..fbb8f1f9e48c 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 33f4795ddcf9..4dfa11372a38 100644
--- a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.inf
+++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.inf
@@ -24,6 +24,7 @@ [Sources]
SynQuacerPlatformFlashAccessLib.c
[Packages]
+ MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec
SignedCapsulePkg/SignedCapsulePkg.dec
@@ -32,7 +33,9 @@ [Protocols]
[LibraryClasses]
BaseMemoryLib
+ BootLogoLib
DebugLib
DxeServicesTableLib
UefiBootServicesTableLib
+ UefiLib
--
2.11.0
next prev parent reply other threads:[~2018-01-29 15:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-29 15:44 [PATCH edk2-platforms 0/4] SynQuacer: assorted updates Ard Biesheuvel
2018-01-29 15:44 ` [PATCH edk2-platforms 1/4] Platform/SynQuacerEvalBoard: add RamDiskDxe driver to build Ard Biesheuvel
2018-01-29 15:44 ` [PATCH edk2-platforms 2/4] Platform/SynQuacerEvalBoard: add BGRT and ConsolePrefDxe drivers Ard Biesheuvel
2018-01-29 15:44 ` [PATCH edk2-platforms 3/4] Silicon/SynQuacer: set CNTFRQ field of MMIO timer frame Ard Biesheuvel
2018-01-29 15:44 ` Ard Biesheuvel [this message]
2018-01-29 15:50 ` [PATCH edk2-platforms 0/4] SynQuacer: assorted updates Leif Lindholm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180129154416.3622-5-ard.biesheuvel@linaro.org \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox