From patchwork Mon Jan 29 15:44:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 126175 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp2542643ljd; Mon, 29 Jan 2018 07:44:57 -0800 (PST) X-Google-Smtp-Source: AH8x225PgiHP5LnsqSPeCTUTUwWibuBiJGhgG7f8olFICEueI0v2hUP+OGSb03FVJJzgBZGfUxzw X-Received: by 10.99.174.69 with SMTP id e5mr22093422pgp.263.1517240697219; Mon, 29 Jan 2018 07:44:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517240697; cv=none; d=google.com; s=arc-20160816; b=GyWhZfMZKg/mb56hm+Pwp14Dp4XMH9piDy3N3HdrKaazo0InWVPSV2EoAnWyWRLsAg NUCcO5W99i6IfNPKmuAXg3Ufu+OAZbNeX3MTkFqeXevyxHBxfcLnR236XiWpzg7I9kC3 aS48gzpwlcLM/UXcg5aOlUFv0eWDj06EvrFyUkY++OSKkSaPxTk7vxAx0+m6Cmdxhch+ qNBPGh9EutVVYk5q2oGIwOfc4TSe6CFFXxI1le2Z1LQMyu5rrES3Tcqct5T4DTauQ+qq QlGUzfAbbG0MDGxbdyUPkKDfNK20sfs1JwxICIyTmXWvYlr9p4BsT7gghKfVzeiMxZTC Ce5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=9YfW+DpI3dYi1InIIX0xeltTq/iJ5EQz508m/ws4rs0=; b=MEtf9YoHuvM2mpMvmQkHrAl8EXxQKc8Q/iKLqQxWCHtQUZG8R7hftKXzYDXcAdOxsW f5F8AqMW5wEXfJDAIelHxJls027ZpgUSe7Act9wWvT+3OAqtbpS6HC8D/kw9pqCoFyNx dsGzexOQ/e38kwkGNc57I4XIQn03YSUDkKYunO6rjraAmSvNEQnribu77sJatsJG/JDX VoiHMjyjEq6FGOGBMJNo/KW9QRX4LPTHZnILmye2U5plZtZUjfSMZdIx+BD+W1KU1G4z Gkt8UNnVxF7cARKrw7XP0N8dHCnyav6/WV5gj/p9QseqLUN/4YMNHav0xMNitqEEEmPs 87Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=C9yNP3Nt; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id x32-v6si9161838pld.441.2018.01.29.07.44.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jan 2018 07:44:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=C9yNP3Nt; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A95992035D315; Mon, 29 Jan 2018 07:39:21 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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-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 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: [edk2] [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: , Cc: leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(+) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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