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:c0c::244; helo=mail-wr0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) (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 A284821E48F2B for ; Mon, 29 Jan 2018 07:39:19 -0800 (PST) Received: by mail-wr0-x244.google.com with SMTP id g21so7702690wrb.13 for ; Mon, 29 Jan 2018 07:44:53 -0800 (PST) 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=iNAOdb3XWRVWX4YCO9O/FHMGe6RxWsxYOo6032STq1M=; b=C9yNP3NtR5haO/XioQrgGAKf2EX0fiI2guYpUISTr78OIYsaOZTu85Rn9qHGtBsogQ sPXExzcCF8PCq/ICyNnVtJYQ14aCW9+Tes4Dtmby1uSn6TiR+b95Xl2YpypwpW9vKZzI oCdO6y/kRJ1d6Jc7W8dqc7A1bQICs2QXOSqhE= 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=iNAOdb3XWRVWX4YCO9O/FHMGe6RxWsxYOo6032STq1M=; b=Uoq4H8PdWjwjOZde7JlEeTnK4QyiR7lttblBbtrHYy3Cle5vUEDaXDgvHEQMt+BFQK 4LZr49G3mWW5A5xn+S9oq9tEK77PLKqMtXiseKR7TSBxQ8ul4Vl1qBxTg+X5jyDhdg0h FnEivNSYCFNqlYEDKcw/ckqUuWLccCRpprd6yu6Y84n5cQiDsbirMxPjcyqccktnmbT1 +2RamMSr0LUR9F9pvilwjEs+MJlDbQx/RVPF39EIPATChFftObbWSpIlwO2Ae/5sDFIZ A9nICKu4dBe0sPQ35fUNQAOXknlmQ/7gdeSVZ5DU8bLS61sufOJjqyuTSy819Xqf/AP2 Fmkg== X-Gm-Message-State: AKwxytfySImpR9TM4rjCp1NRRuggveGE/DPnGijbnh0Wio+jrMyDPnfe qtCQfoqesoiq74JgDwS5ok0dhcI3Pqw= X-Google-Smtp-Source: AH8x224RPfCpLlqJEqBpkrfA2/3j4rhMkWrhYhtjgij7s0F2gK3zTMdkNxIasDDeh3eHRJi527mcQA== X-Received: by 10.223.199.207 with SMTP id y15mr18538986wrg.114.1517240691809; Mon, 29 Jan 2018 07:44:51 -0800 (PST) Received: from localhost.localdomain ([160.90.205.229]) by smtp.gmail.com with ESMTPSA id m191sm8670928wma.42.2018.01.29.07.44.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jan 2018 07:44:50 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, Ard Biesheuvel Date: Mon, 29 Jan 2018 15:44:16 +0000 Message-Id: <20180129154416.3622-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180129154416.3622-1-ard.biesheuvel@linaro.org> References: <20180129154416.3622-1-ard.biesheuvel@linaro.org> Subject: [PATCH edk2-platforms 4/4] Silicon/SynQuacerPlatformFlashAccessLib: add capsule update progress bar X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 15:39:20 -0000 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 --- 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 #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 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