From patchwork Fri Jun 8 06:58:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 137924 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp511884lji; Thu, 7 Jun 2018 23:58:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJGpBsCIjYh24J611QbT0ifs2/eI/0vsLYK236ed6y9tGq4XiTaVXY+oANSq5SRW50ZwsVv X-Received: by 2002:a63:6e44:: with SMTP id j65-v6mr4283431pgc.14.1528441109078; Thu, 07 Jun 2018 23:58:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528441109; cv=none; d=google.com; s=arc-20160816; b=GlP7mnFpXVwcqfjUY/npLzZuRfl2z1fhclCC4fhGkea1i5MTJTlkDiPw4jWYbbKReD kHFJmzMCiDb2J6hm+Van/pBPCaUPESIWY5GHlggkgIzPGTTURcFYcCqidhkGMAv7/iZa Vqf1HQnisxROfGNbFBSW510xmGP1MfC8DUbem4u8X+CTwqhWKYg2+PaTzoclHheVTCe3 NVdpnWJjwvaTd+T6cXUyX6LJSq4KoFZCjpv7WeXWKX9gJCJRMK/cmUMzXFO4Bs+vAWXa 4OhkYR2GELMHCJAeLHzk/LPeIq8fVLJ5jp6o2ShkdtfhoQCtVnw0pu86euEeLSglWXLI kqJQ== 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=JcgbqxOz9B2WRrz0M8ygdzgcrGBoQ/rSO1K1Oo873Jg=; b=MFCctYC6w/mIGhGMcgCU37QB68Vo+Do40b+LdFaqXgBjBDQzwJSqdyUN3zh/p1nUP3 3hFBicvG2yqCK7HW8FLQb68Wbyxn68SDTJL7dRkdY4aKU1coidXWFH3fRQ7LHVvVPy+z gSTHok6hty/iNxx81m64Jr6SiiN3WR+w+TsPZsD0rEzqnBVyPUG8lsuph0eAnOQbUhDR VMrFQewElrqWBxiGR/vkeiBJ2RPmt/+NgKtON+tNBJG1or2rwJRt0dUB3BbbGwrs9Qwn xYw0XR+CaQWEPosOvw8lNGgTW6RA1Qxtko0nTQcf9ahzyzJDgFfUNTGoiijCUpBql3qe LoXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ix0FBXn7; 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 g63-v6si44541425pgc.40.2018.06.07.23.58.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 23:58:29 -0700 (PDT) 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=ix0FBXn7; 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 2E7D421106FDC; Thu, 7 Jun 2018 23:58:26 -0700 (PDT) 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: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 7554E21106FCB for ; Thu, 7 Jun 2018 23:58:23 -0700 (PDT) Received: by mail-wm0-x22e.google.com with SMTP id p11-v6so1563118wmc.4 for ; Thu, 07 Jun 2018 23:58:23 -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=FspWq5+qPhF63i9or4drgtMsbF6v8QDNI43SSAS41n0=; b=ix0FBXn7k83oG4817oeXdvYTI6OBIErKILr15fppAmAfytGyFvqV0RWDcgtg0nLrQY R3Gmh1uxGtH07RkuglL1REAfvkngpfEf4O8M8QkoeiMZouueK8NXHGeEKvP9+iBBhRM8 w7F22RiO1Wv7ZOuuVg1ggFcMKAv9zhP6YInyM= 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=FspWq5+qPhF63i9or4drgtMsbF6v8QDNI43SSAS41n0=; b=I1yHcHu/mzHxyAm6pE3BkwUD3TjvjHlqT/dPRpJnzmTNKR2MvOosweDOX8za7euMJ6 9JPOlJDsry5kxVX5knG8kJWbVWl0F0lpL2x7kOSD3qm8tutQ2wcgxF6q1brq548KycYY TJ8v13lXSpDfN4UgBoxeykwhbyG0Zq9Y3BY1aRFmtZHOp7+FPpXScTZnkoD3euqJ71cW uiGHaJK1Oq+rbhNglT7dSCpp97H+usObupqR8s8ADhkdU1q3/xUs3Sz1IPInBP5wEG7s KaHIpbUTDYNopLZNehJvBfQnxj13XWNZCdp/LRqBBGkW5Fjm8S4nRlvKEnZFOWrdPX79 nL2A== X-Gm-Message-State: APt69E36GF9DDGciA0kI0uIvfJ+D6VZ9Dr8Yp5/KJmvOVrl4crIXFzoo 5fyNdqlTLSyqJcCMG7mJjNDui8FI6Ro= X-Received: by 2002:a1c:d884:: with SMTP id p126-v6mr578818wmg.110.1528441101751; Thu, 07 Jun 2018 23:58:21 -0700 (PDT) Received: from dogfood.home (LFbn-NIC-1-75-91.w2-15.abo.wanadoo.fr. [2.15.165.91]) by smtp.gmail.com with ESMTPSA id x130-v6sm892491wme.24.2018.06.07.23.58.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 23:58:21 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 8 Jun 2018 08:58:09 +0200 Message-Id: <20180608065811.2065-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180608065811.2065-1-ard.biesheuvel@linaro.org> References: <20180608065811.2065-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 3/5] MdeModulePkg/DxeCapsuleLibFmp: pass progress callback only if it works 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: , Cc: michael.d.kinney@intel.com, jiewen.yao@intel.com, star.zeng@intel.com, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" If the first call to UpdateImageProgress() fails, there is no point in passing a pointer to it to Fmp->SetImage(), since it is highly unlikely to succeed on any subsequent calls. This permits the FMP implementation to fall back to an alternate means of providing feedback to the user, e.g., via the console. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c index f0226eafa576..ab41df0eb0a4 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c @@ -841,6 +841,7 @@ SetFmpImageData ( UINT8 *Image; VOID *VendorCode; CHAR16 *AbortReason; + EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS ProgressCallback; Status = gBS->HandleProtocol( Handle, @@ -892,7 +893,11 @@ SetFmpImageData ( // // Before calling SetImage(), reset the progress bar to 0% // - UpdateImageProgress (0); + ProgressCallback = UpdateImageProgress; + Status = UpdateImageProgress (0); + if (EFI_ERROR (Status)) { + ProgressCallback = NULL; + } Status = Fmp->SetImage( Fmp, @@ -900,13 +905,15 @@ SetFmpImageData ( Image, // Image ImageHeader->UpdateImageSize, // ImageSize VendorCode, // VendorCode - UpdateImageProgress, // Progress + ProgressCallback, // Progress &AbortReason // AbortReason ); // // Set the progress bar to 100% after returning from SetImage() // - UpdateImageProgress (100); + if (ProgressCallback != NULL) { + UpdateImageProgress (100); + } DEBUG((DEBUG_INFO, "Fmp->SetImage - %r\n", Status)); if (AbortReason != NULL) {