From patchwork Tue Jun 12 11:23:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 138320 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5218672lji; Tue, 12 Jun 2018 04:23:42 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJVCFF/QlcxJppC/oM08FVyHWewzQIHayikIVUwO0rRhLyFwyL/LLC/D+iHQWqcY7/7mmde X-Received: by 2002:a65:4cc3:: with SMTP id n3-v6mr2854418pgt.98.1528802622314; Tue, 12 Jun 2018 04:23:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528802622; cv=none; d=google.com; s=arc-20160816; b=omq9E3RoTOQs5OhYqLNROTD3V+qMzQcJkyA+9JsIsC2i+6fmq46Dj9FsszcApM+M3p k6a5rkd/4fHTUc9bQrmwnkvrB+v0AXO3wgq897GxROuocXa5s3WnbH+TRSJ1l9tNCFSe 4mIH0BrtY/EP+ZymwUPpw5ne9xWumfKB9NgUoW/ehB2rPNtRCVjSBFmuCkctGWuJN/Im g7yqd2zF0IjpOzrMaEaU9kJkYUMtF82JkPmvzXfZDIgS4OPbS5UsbjJTfp+ISWKKn2DB wkjHPCF/sTbnLTPj7PnJHgKNTHL9z427fJ72MYezdYUIxNQqW4JRWAzQo42V4M0IKGnj 8boA== 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=iz7urHGqiq6FqKtb48eeuE/r0G3f1mwQM8dEVJ4Ej1M=; b=sXeVmQQ0Yl8q0c3aM3Bx3Upsx937LYl/Z+ADt0leYvm+sdsTzK8c1EjDasqISnwMqK yewIgf1bkanxM4qKTOFJEPUqIo9lBCLeLbDZcOX0CULjFEf8I9ZOQJ01xGafMmSkvIa4 7dudESrxQEW9FP+Hz0ULJrCiYZUN4YLKEGnseM/raB7r0OIeeyr3l40qLR/P72/MJcaN KIk//Lhz0sGblqcs+GrABC32u56lFvjPtVRDVdKFvkzzHhtQilA9p2lmK9Q1ws60b4dN xhl/qmH1/9mvVb9tup9xtKXfYCeLw1ku2yJwIEXGsboY2KmIbyd2hEZtGLU3WL6lZdNB k30g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Aq7aEvsP; 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 z20-v6si690202pfl.209.2018.06.12.04.23.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 04:23:42 -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=Aq7aEvsP; 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 4104D2121797B; Tue, 12 Jun 2018 04:23:40 -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::22f; helo=mail-wm0-x22f.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x22f.google.com (mail-wm0-x22f.google.com [IPv6:2a00:1450:400c:c09::22f]) (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 24BFB21217973 for ; Tue, 12 Jun 2018 04:23:38 -0700 (PDT) Received: by mail-wm0-x22f.google.com with SMTP id e16-v6so19894893wmd.0 for ; Tue, 12 Jun 2018 04:23:37 -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=Stm2acX9qh4MQfaImdjYghbtDsBG3KO7q9Fu4ANawX0=; b=Aq7aEvsPpVR9+6UAuMCP1QDR+saBw51Ciz7Ow97bVlBjcJywcfDNGMYUjF8cYZ+Mrd Uw5hxQPSAKGu84Hj08yMXa+OTew9T8H2sK6pIJ96rrHLUYrlfxdPqBAsSzwKNniYFdi8 Ui0xFFXr0huDGaXBGqnxJGwAbReNJEFIEh8qA= 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=Stm2acX9qh4MQfaImdjYghbtDsBG3KO7q9Fu4ANawX0=; b=NhTdNsoBayIvuTFHLfJadeYvKR/shgJWcRVfLq76Va0z11SdFsXW8iGZ4Ulwg5Faob v9KUBi93u51chI1xjyrOnRy4JV6tMbj+HYoJYpBi7nuy16h8ZQy9mKDhC15Ok3jXRuIw /NaffJV0G3TzLhZFcojBsHLMWB84Hfi+k3G/wlGsruHlUkt9xaM7esukMGpClF3nCujE zDLiRyVqASGHwnuVikBZQG3STTxtWbUVWsJ2KTSYilHMahxqOE2uXf2OBotIEhpDXqy+ VQL/KIjCFD9KkG8GApabW9op/J/nbccmoSaQmA8Uu3eD1iGfUBGWl3avoI/JVnBbJHoR KwNg== X-Gm-Message-State: APt69E2ZolCz2GIrMGl61T2rjRslmB1Cq3jMLbfk3aWxoCOZikEQdcl7 N8hAvirafGhg7mJfUn/AJQqj3Fqw3SI= X-Received: by 2002:a1c:7153:: with SMTP id m80-v6mr1759509wmc.7.1528802616372; Tue, 12 Jun 2018 04:23:36 -0700 (PDT) Received: from dogfood.home ([2a01:cb1d:112:6f00:3c84:18ae:27f2:d03]) by smtp.gmail.com with ESMTPSA id o16-v6sm1177202wrp.8.2018.06.12.04.23.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 04:23:35 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 12 Jun 2018 13:23:27 +0200 Message-Id: <20180612112329.664-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180612112329.664-1-ard.biesheuvel@linaro.org> References: <20180612112329.664-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v3 2/4] 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.1 _______________________________________________ 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) {