From patchwork Thu Jun 7 11:08:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 137877 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1950664lji; Thu, 7 Jun 2018 04:08:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLN8vlJWaREc46x8YVoiKtk6S0Djw24MwlZQ3siUy3MyM2wBTaJGi57XgjXQQ85CMYSebm+ X-Received: by 2002:a17:902:28ab:: with SMTP id f40-v6mr1568683plb.208.1528369707353; Thu, 07 Jun 2018 04:08:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528369707; cv=none; d=google.com; s=arc-20160816; b=N0tnQI9T/UAgSAbvOWRTpK+/BYHnyGLmZ6XEcphbb8buFV6B6GLOe3YjvorJUE2iPg KQ5NhPvDsSZY4n2pSbzjH+PgsBS+SOqDvqdSpjOUb9ZmjaGFoPLW3IAlEeEaYTd5iDGn 247SwrGWhic4HhFZ645y+gLnV6bjynyUc0tKxOERUWgWdI5XvQ6vzBfGRveRSv8Q0GrD mytHlgRxKTr0oGk69lN4OGeoRuMViKh14Qvq9XQRKEJREXIMZY/OEGQnWbsenivygZ1K XTBBvYaBvCGXBazJpO3XSpJTGpsR2OL20OkvASOToRDZFIAkURUbsMm5WVf8orJUa5GA JRBw== 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=u2IDTaVm0EhJUqTVK8v5AyVEX3iefeoEI7MfSDadfyK4MeNoYixasksuIx/9jE2C4D 4bL1TiOqOyqb99FDoQ2JNNfOkDyqDAEX6+VfESUxFBiRU93VeTrvsyQ+CcvxswMCv4oQ YO53c8a09D65rugJm56exO3/6ucNN/VUU8AKx0tSRvgiRRac518RRTYtHCz2TvxP3CLN OgTsbj8/uG0OMnksRqIN2sJ3iCGx1KZDVEgypXTWCbB1kiTjw84P+E4rLVM8FGDcB5LH zTcWXDXLGvCG5MOXfRvkG9RkvPn8I5Vcbckd2oKiM2o3qEWylp5gUNk+liDHIrwi/R50 Zr/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hEED2FIR; 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 a22-v6si9962183pfn.19.2018.06.07.04.08.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 04:08:27 -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=hEED2FIR; 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 9F8F6211D67FD; Thu, 7 Jun 2018 04:08:21 -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:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (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 D1E61211C3F47 for ; Thu, 7 Jun 2018 04:08:20 -0700 (PDT) Received: by mail-wr0-x242.google.com with SMTP id l41-v6so9631580wre.7 for ; Thu, 07 Jun 2018 04:08:20 -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=hEED2FIRUBi/Kxcs1j5U+qmmmkUXoVA6jvC36nE2b3duY34VtulgI0s/6DJuDILVZQ JSjglTdbrgSjr0XHrfxChtL/vCB1azR1Tb7lXLv6WiAxnWrOHm8Ag+uHRd0tlHVRQQbj pZuFXWt5fhRgAEscCX6nTGfxnGdjV/pNf3zko= 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=dahC/ccGWpSAsdr047DGDxzb/ddG52e1cjAXM7hypkxsrqvcw5hVZQJiT/XxV/2i+f qxeakgUP+j8PdLScAAsPB7zACnOmYgCgoS3ckxEqUv3gg4amr5lhEP2NNsyYWGiHAHtD 9sGngSs+ehTbzEbgLwO/4LFYvI0IQFqtd7It8rN8FuPc9HdMhEr/1VxFgkMTHz+5KCmi FacIiVQPNvyqxYnoUyhBlTvbQEZTIikd7oLWIyuyJtkGOouvVWwFfA/ikfTfZSQ/XKGS p03VS+HHSNCxgKcUEEPE/fiFp5UkPYQJyVPGANblXTksLWE8UaLLT0HhDfBNjX77OezR xpbg== X-Gm-Message-State: APt69E3Y1RiWVbzK0RHY+UanjR0STIiNhLXuE+FpodAzMCaE726kM1/F F8h8SU+ZRhxwgOuPojvjkU9RxJ6tj38= X-Received: by 2002:adf:b60d:: with SMTP id f13-v6mr1276961wre.186.1528369698758; Thu, 07 Jun 2018 04:08:18 -0700 (PDT) Received: from dogfood.home ([2a01:cb1d:112:6f00:88ff:8f90:37f1:db91]) by smtp.gmail.com with ESMTPSA id 72-v6sm54997900wrb.22.2018.06.07.04.08.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 04:08:17 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 7 Jun 2018 13:08:10 +0200 Message-Id: <20180607110812.26778-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180607110812.26778-1-ard.biesheuvel@linaro.org> References: <20180607110812.26778-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 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) {