From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::22e; helo=mail-wm0-x22e.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x22e.google.com (mail-wm0-x22e.google.com [IPv6:2a00:1450:400c:c09::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3D4F221164C72 for ; Thu, 7 Jun 2018 04:32:13 -0700 (PDT) Received: by mail-wm0-x22e.google.com with SMTP id 69-v6so5129660wmf.3 for ; Thu, 07 Jun 2018 04:32:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PKwnXOnjHl+iKijjTbK8tkfogQXcu040lMuMV7fvQy8=; b=DFPT4d9sai7vOnVwei3LsdzY8qAumeV8cHTpq+QNX4qvmTqlysR/WrdU0znJZjjcjf UDbvGYpy29IH6xdprmezxUDU5YSiawnUl+p7QRlpECcr7zifjIFoP0aGUYyTanWSGcwc TKrsjDNVy9Kv7eBV069hB1wyYqY4C2f6kyVAA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PKwnXOnjHl+iKijjTbK8tkfogQXcu040lMuMV7fvQy8=; b=mg8jOgv7WunThUk8G8ucCN626VjTeKmrIyHKNEuk9GWckzb56+VfxLHbC1aKgMBE+q sKI12Wx3WCmxL21Gm5DEn99JJAMMKl1h2SWeJz0JCNxdr9hyXrK9iEei1HIcwrNud8c9 aI05Q0+vQj1FIfOVQ6IZ72azEP38vzFKWGYVy/Jzapk2t+ShpM+GurIRfrLpn3S9enFu 1UXHjz+e0GIpeGENYHCkJtnHjwyjl1F/B9hFznuG9sGHWpl2q1UoA+mhAg5ObQe8PSNZ ej/y2dNhxoLlXAEMspQyzolvOSm95eDTopCVe9SlYR6DiOtt1+PHs+OO941vM6Mf7gD1 giAQ== X-Gm-Message-State: APt69E3Rf/9znFyXsrcgbrhS5rY1EtsVPVaBce6DmrWoVndDQyrNv84m D9eiO6Yn3OYiwPY1MW7a6wim2vqP8PE= X-Google-Smtp-Source: ADUXVKJdkc+KvrEk3+GgHkSIB/LGJj5lY7xyKSEiOKeRgkNP8ACbrKDvulMcf8iY8X0SzL+3KWFcjw== X-Received: by 2002:a1c:afc3:: with SMTP id y186-v6mr1274982wme.87.1528371131528; Thu, 07 Jun 2018 04:32:11 -0700 (PDT) Received: from dogfood.home ([2a01:cb1d:112:6f00:88ff:8f90:37f1:db91]) by smtp.gmail.com with ESMTPSA id p3-v6sm39109483wrn.31.2018.06.07.04.32.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 04:32:10 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, michael.d.kinney@intel.com, Ard Biesheuvel Date: Thu, 7 Jun 2018 13:32:03 +0200 Message-Id: <20180607113203.27606-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180607113203.27606-1-ard.biesheuvel@linaro.org> References: <20180607113203.27606-1-ard.biesheuvel@linaro.org> Subject: [PATCH edk2-platforms 3/3] Silicon/SynQuacerPlatformFlashAccessLib: replace progress indication X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jun 2018 11:32:13 -0000 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 --- 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 #include -#include #include #include #include @@ -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