public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Leif Lindholm <leif.lindholm@linaro.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: edk2-devel@lists.01.org, michael.d.kinney@intel.com
Subject: Re: [PATCH edk2-platforms 3/3] Silicon/SynQuacerPlatformFlashAccessLib: replace progress indication
Date: Tue, 12 Jun 2018 23:52:33 +0100	[thread overview]
Message-ID: <20180612225233.mxicdnyce2yfwj3i@bivouac.eciton.net> (raw)
In-Reply-To: <20180607113203.27606-4-ard.biesheuvel@linaro.org>

On Thu, Jun 07, 2018 at 01:32:03PM +0200, Ard Biesheuvel wrote:
> Replace the home cooked progress indication with calls into the new
> (*Progress)() argument to PerformFlashWriteWithProgress(), which
> allows the flash access routine to report progress via a platform
> provided callback.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

I think 1-2 depends on changes that aren't currently happening based
on discussions. If I'm wrong, set me straight.

However, does this one not make sense on its own?
If so, it has
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
>  Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c                        |  1 +
>  Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c   | 44 ++++++--------------
>  Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.inf |  1 -
>  3 files changed, 14 insertions(+), 32 deletions(-)
> 
> diff --git a/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c b/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c
> index 38f1830b5c2e..c5e46dcd4ddf 100644
> --- a/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c
> +++ b/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c
> @@ -72,6 +72,7 @@ PerformFlashWriteWithProgress (
>  {
>    EFI_STATUS                      Status;
>    AMD_ISCP_DXE_PROTOCOL           *IscpDxeProtocol;
> +  UINTN                           Remaining;
>  
>    if (FlashAddressType != FlashAddressTypeRelativeAddress) {
>      DEBUG ((DEBUG_ERROR, "%a: only FlashAddressTypeRelativeAddress supported\n",
> diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c
> index 48d385993b38..ebb6ce189aa5 100644
> --- a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c
> +++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c
> @@ -17,7 +17,6 @@
>  #include <PiDxe.h>
>  
>  #include <Library/BaseMemoryLib.h>
> -#include <Library/BootLogoLib.h>
>  #include <Library/DebugLib.h>
>  #include <Library/DxeServicesTableLib.h>
>  #include <Library/MemoryAllocationLib.h>
> @@ -195,17 +194,7 @@ PerformFlashWriteWithProgress (
>    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                               CurrentProgress;
> -  BOOLEAN                             HaveBootGraphics;
> -
> -  Black.Raw = 0x00000000;
> -  White.Raw = 0x00FFFFFF;
> -
> -  Status = BootLogoEnableLogo ();
> -  HaveBootGraphics = !EFI_ERROR (Status);
> +  UINTN                               Remaining;
>  
>    if (FlashAddressType != FlashAddressTypeAbsoluteAddress) {
>      DEBUG ((DEBUG_ERROR, "%a: only FlashAddressTypeAbsoluteAddress supported\n",
> @@ -274,14 +263,8 @@ PerformFlashWriteWithProgress (
>      return Status;
>    }
>  
> -  if (HaveBootGraphics) {
> -    Resolution = (BlockSize * 100) / Length + 1;
> -    CurrentProgress = 0;
> -
> -    Status = BootLogoUpdateProgress (White.Pixel, Black.Pixel,
> -               L"Updating firmware - please wait", Black.Pixel, 100, 0);
> -  } else {
> -    Print (L"Updating firmware - please wait ");
> +  if (Progress == NULL) {
> +    Print (L"\n\nUpdating firmware - please wait ");
>    }
>  
>    //
> @@ -298,7 +281,8 @@ PerformFlashWriteWithProgress (
>      return Status;
>    }
>  
> -  while (Length > 0) {
> +  Remaining = Length;
> +  while (Remaining > 0) {
>      //
>      // Write the new data
>      //
> @@ -315,20 +299,18 @@ PerformFlashWriteWithProgress (
>        }
>      }
>  
> -    if (HaveBootGraphics) {
> -      Status = BootLogoUpdateProgress (White.Pixel, Black.Pixel,
> -                L"Updating firmware - please wait", White.Pixel,
> -                CurrentProgress + Resolution, CurrentProgress);
> -      CurrentProgress += Resolution;
> +    Buffer += BlockSize;
> +    Remaining -= BlockSize;
> +    Lba++;
> +
> +    if (Progress != NULL) {
> +      Progress (EndPercentage -
> +                (Remaining * (EndPercentage - StartPercentage)) / Length);
>      } else {
>        Print (L".");
>      }
> -
> -    Buffer += BlockSize;
> -    Length -= BlockSize;
> -    Lba++;
>    }
> -  if (!HaveBootGraphics) {
> +  if (Progress == NULL) {
>      Print (L"\n");
>    }
>  
> diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.inf b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.inf
> index 4dfa11372a38..6ca34ada1d03 100644
> --- a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.inf
> +++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.inf
> @@ -33,7 +33,6 @@ [Protocols]
>  
>  [LibraryClasses]
>    BaseMemoryLib
> -  BootLogoLib
>    DebugLib
>    DxeServicesTableLib
>    UefiBootServicesTableLib
> -- 
> 2.17.0
> 


  reply	other threads:[~2018-06-12 22:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07 11:32 [PATCH edk2-platforms 0/3] DeveloperBox capsule update changes for progress reporting Ard Biesheuvel
2018-06-07 11:32 ` [PATCH edk2-platforms 1/3] Platform/Socionext/DeveloperBox: add support for persistent capsules Ard Biesheuvel
2018-06-15 17:22   ` Leif Lindholm
2018-06-18  6:43     ` Ard Biesheuvel
2018-06-07 11:32 ` [PATCH edk2-platforms 2/3] Platform/Socionext/DeveloperBox: switch to PersistAcrossReset capsules Ard Biesheuvel
2018-06-07 11:32 ` [PATCH edk2-platforms 3/3] Silicon/SynQuacerPlatformFlashAccessLib: replace progress indication Ard Biesheuvel
2018-06-12 22:52   ` Leif Lindholm [this message]
2018-06-13  7:16     ` Ard Biesheuvel

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=20180612225233.mxicdnyce2yfwj3i@bivouac.eciton.net \
    --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