From patchwork Wed Jun 13 08:08:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 138425 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp401591lji; Wed, 13 Jun 2018 01:09:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKlenh5Hil3f3Sjgjn1WRutYpgFOnwz5Pvy5Ml25vRjVDsxWPtmQ5og8FkeorYIeCms61/Q X-Received: by 2002:a17:902:44a4:: with SMTP id l33-v6mr4093972pld.134.1528877351764; Wed, 13 Jun 2018 01:09:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528877351; cv=none; d=google.com; s=arc-20160816; b=mqAfGIAKQ6+FV0NGCJmZT7sCEm+gMyXYmOR74XEaJFXFh6muIWMwOfDOn4TCJ+hkD7 oM4TkW38gNNFWMZzcqRraQclEv5LGzknhamQb1GprC00Qtb9KafKna9c2k6w2ekI9nVH Ewc8Dr44ywGsh0++arqGiRY448oFIxROLz2Tc8nXIsxnIJrR/0wbe0dKPk21U/DgaFSt 6gLFpfTOKND3pz1MKGAfvNGSeIl+p2/aM0QvkN8b5Y4UuiCRmjVXyLoHjeq0m4KU/RoZ 1H2MgtMG+Px+o7CNBkRZylNUhS/gvXWOJj3ocjgvnQsFcqOhyqnBFLmF3bniD0uOPpkA SJrw== 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=CORltqMmBRfcEF+PVyGG03sVeTtmTwGyCalFHKuwFmgLn2Vyww0SrHt+NR7FAzMpui MLwCJuhTxx1YuGZZDsvtw6WYoycHRJZ7scFD58mkDvPLrufLXkHb2iT2wC3PjQWsT0Oz NozD+Lv/VfgBet5/CdbN1Aiol903gMH4KrLky2ckYVnAeQxtWcFC+Io4/uaS9qpA2/6m wIpKk6SRhltaQX0cTXR/pxzjUIEibgrssvU8t+TmCYjkFnCXIO16ZYytLwWI+6JDy0lQ n0E0GwwEP/m61mJgFwMuFx4iOoxwWhTdxk/CQ3QK9lyJkR2GrB8hPMixlvoTOO9n/wxz 01bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Ug+dL0yZ; 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 u17-v6si2251795plq.405.2018.06.13.01.09.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 01:09:11 -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=Ug+dL0yZ; 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 E11E4212C01F5; Wed, 13 Jun 2018 01:09:10 -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::233; helo=mail-wr0-x233.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x233.google.com (mail-wr0-x233.google.com [IPv6:2a00:1450:400c:c0c::233]) (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 0FF20212532FC for ; Wed, 13 Jun 2018 01:09:08 -0700 (PDT) Received: by mail-wr0-x233.google.com with SMTP id a12-v6so1711539wro.1 for ; Wed, 13 Jun 2018 01:09:08 -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=Ug+dL0yZ+b36ZFMBh/XexL6Ekfs0SCBJGU3757tFGqNr9OGL2qMK5erCRMZTOF5yBS WlkxfQOpmEsI7GITzHAuVCaxy+MK/Vh2Brs6nvMJOwJX/1343NKOa5vOy7RHuz0fISmr 56QrZnCMIVKj090TyknFa/mmICVxcmlpHvn8g= 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=RRW55anbwSPQkxUM9l+JCJZdyYBPmPuAvS7nozETNlIBl3rktYnRqu+gKND3hec49A cyf0cAlc7L7a680FtrEz/n7rm1+BV6hFpywcOSSQX7EEd0qEG//oNV+W8dbyiJMbjmhj wlUeAGFTDfEo6y+TQm4Gv3CZghApdCj9ljZCsThQS7uz831NKpPRXP8gv97SpxZi3C25 Z+gCqz/Wb3Ce77jA71DQzfX/7SFOyMZFMrcp2LlZsV0/+cuOJomW6ktxrQURV3M2yA5k K2hUP4p2JBTHz2etMtCIho9T3+aonOBq6A5swryoaITqX7h1C4vvEOhOs/oNHbjrOfcw rD0A== X-Gm-Message-State: APt69E2z+nhktGaZTcOpH99WNDuqUX0mWQR4lcVvtOao4fXt69Gs+O45 czS6P7QbFaJMw/rSIfd2B0jJVZDMLls= X-Received: by 2002:adf:ea44:: with SMTP id j4-v6mr3327635wrn.224.1528877347174; Wed, 13 Jun 2018 01:09:07 -0700 (PDT) Received: from dogfood.home ([2a01:cb1d:112:6f00:6dfc:b76c:4240:35ff]) by smtp.gmail.com with ESMTPSA id v31-v6sm4974772wrc.80.2018.06.13.01.09.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 01:09:06 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 13 Jun 2018 10:08:59 +0200 Message-Id: <20180613080901.7156-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180613080901.7156-1-ard.biesheuvel@linaro.org> References: <20180613080901.7156-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v4 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 Reviewed-by: Star Zeng Signed-off-by: Ard Biesheuvel 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) {