From patchwork Thu Jun 7 11:08: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: 137876 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1950596lji; Thu, 7 Jun 2018 04:08:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ8Orbi0yccMb4w2WRqiBUpXAeiBQBqMd1O0pqAa5cPukQor/2jWAPKzWZtHmNkdqoIIP0Y X-Received: by 2002:a62:830e:: with SMTP id h14-v6mr1406115pfe.64.1528369703748; Thu, 07 Jun 2018 04:08:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528369703; cv=none; d=google.com; s=arc-20160816; b=VFTjzrPL3BDno11f3IGlPNSYnOsDhPKg42Et9PSEcqZMdphSH4LeAwJ/KH6TbNsyzg 9uW/VM0c5g+0m8Ji1Gry5uIB4HsioLJPOiFLvTgVt5CFsaq5YlVnr13GQNUvKr2w31Q8 IBCL0//TlzBC5LpsGOLOsTRYuC8DhG+jG4+KeNArBwxpL9zzTVWzsMMksFdBO1WYaeFD TPA6r1bwloXLiJuwEC2BlrMUPc2EaptZPRPq6GZhOwgpiNojctItTIR/HdE40cq4KxMf d64ya0U+AywRBBGFrPGtbujGWYthWZy/DY0b1JRbold4Zlk9oXLLpDO4eyk+3JywH6Ft 2HAQ== 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=7TUk1c3rUeFFk5MbRKov2sG2Jr4BmS8MGO9B9mkaqKQ=; b=eLI934h2bExVavPGPaP0LNdvggAknM+W6ksHVKui6x7el9IjAkXmLgcv6EZuxLlkbn F/lPyEWxJuyGFqcgIyr+mjv/pxn2DTBDE5eQTX4oDTLFI4rsxIcxjyb0I+lt42Y20Fjw jVSJmtI22d4yEftr1fWIrjOExqD2expOo6PaA5ShKiLtGIF2JL33MtKwkO6q7EWYulkv pYqjpxCmZBLAgEzQdvR/AZ7twbxS5YvbFyPgsCbjnfweDVVnkpZpMRlseUzzexh5/5Li DpxJ4VcAASmW/u7zkPFkTf/aIDuMDfIEB9hvnbbY7heHJIirJxe3hYNJoDh3sSILWYYo vibA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=WGp+2kQZ; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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. [198.145.21.10]) by mx.google.com with ESMTPS id p8-v6si53021911plk.441.2018.06.07.04.08.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 04:08:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=WGp+2kQZ; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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 763ED211CFFC6; 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::241; helo=mail-wr0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) (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 30A5D211C3F47 for ; Thu, 7 Jun 2018 04:08:19 -0700 (PDT) Received: by mail-wr0-x241.google.com with SMTP id x4-v6so1485913wro.11 for ; Thu, 07 Jun 2018 04:08:19 -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=ykjohDSxVLRy+E3pzXwoHmYP9tKZIFAMNmg1ZKUUmpk=; b=WGp+2kQZ8CSOD7nspSn5cpELZMNp6YwA7nE4MwBeHyNFw5OyJcn8s4oAsxX84fYjE+ XA89e6O4gSAuuFzgaByGongWTfMXaTjoL0Tasy2O+U+A6+19HtHPXeU+ITPxWomqKYMM TaWqo4oGmn+1BgF0zJnQCrGHEIcAcbj3v6NMM= 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=ykjohDSxVLRy+E3pzXwoHmYP9tKZIFAMNmg1ZKUUmpk=; b=C7Nlibj5gbtlrrjy7VICeyE9Dk4hLTILLAuMXxwrh8PixP24SpTICG3H6Utwa0D8sj QLc/Wsvc15KCGH3/x6BtMboCNTNiFOOEbYP28HuKY/x0FJAJac0E7ctLuUPSOLlvAmBI PYCUg3hkHbNOb3/eUnYKgORG8aDVGB6qI5oWCBESE2DrqDdumf4m3P9eTVGQsofO941F irwIGtKPjYo13e58V29GM0KIPrUag9UQwzQMYI7byHV7s+/GCzd57TQ0OM0tBHzhuOwS KDngscMa3fTTWyviGwbHmt4UbMPgC/9pJf+dqC2gRmRrmWZr0fHpyRLF10NSvzXkoDdk sGpw== X-Gm-Message-State: APt69E2Tuwk4hiB6mF9mq1zvDFBLJqyLUeOTXTmpUZmYSijWSPmT8Qlm hgnG+3Qz+xOz24D33ucGWcjP6MQfMVU= X-Received: by 2002:adf:98cf:: with SMTP id w73-v6mr1373017wrb.209.1528369697541; Thu, 07 Jun 2018 04:08:17 -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.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 04:08:16 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 7 Jun 2018 13:08:09 +0200 Message-Id: <20180607110812.26778-3-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 2/5] MdeModulePkg/DxeCapsuleLibFmp: permit ProcessCapsules () to be called once 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" Permit ProcessCapsules () to be called only a single time, after EndOfDxe. This allows platforms that are able to update system firmware after EndOfDxe (e.g., because the flash ROM is not locked down) to do so at a time when a non-trusted console is up and running, and progress can be reported to the user. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Signed-off-by: Ard Biesheuvel diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c index 26ca4e295f20..52691fa68be4 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c @@ -100,6 +100,7 @@ IsValidCapsuleHeader ( extern BOOLEAN mDxeCapsuleLibEndOfDxe; BOOLEAN mNeedReset; +BOOLEAN mFirstRound = TRUE; VOID **mCapsulePtr; EFI_STATUS *mCapsuleStatusArray; @@ -364,8 +365,10 @@ PopulateCapsuleInConfigurationTable ( Each individual capsule result is recorded in capsule record variable. - @param[in] FirstRound TRUE: First round. Need skip the FMP capsules with non zero EmbeddedDriverCount. - FALSE: Process rest FMP capsules. + @param[in] LastRound FALSE: First of multiple rounds. Need skip the + FMP capsules with non zero + EmbeddedDriverCount. + TRUE: Process rest FMP capsules. @retval EFI_SUCCESS There is no error when processing capsules. @retval EFI_OUT_OF_RESOURCES No enough resource to process capsules. @@ -373,7 +376,7 @@ PopulateCapsuleInConfigurationTable ( **/ EFI_STATUS ProcessTheseCapsules ( - IN BOOLEAN FirstRound + IN BOOLEAN LastRound ) { EFI_STATUS Status; @@ -384,8 +387,9 @@ ProcessTheseCapsules ( REPORT_STATUS_CODE(EFI_PROGRESS_CODE, (EFI_SOFTWARE | PcdGet32(PcdStatusCodeSubClassCapsule) | PcdGet32(PcdCapsuleStatusCodeProcessCapsulesBegin))); - if (FirstRound) { + if (mFirstRound) { InitCapsulePtr (); + mFirstRound = FALSE; } if (mCapsuleTotalNumber == 0) { @@ -404,7 +408,7 @@ ProcessTheseCapsules ( // Check the capsule flags,if contains CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE, install // capsuleTable to configure table with EFI_CAPSULE_GUID // - if (FirstRound) { + if (LastRound) { PopulateCapsuleInConfigurationTable (); } @@ -453,7 +457,7 @@ ProcessTheseCapsules ( continue; } - if ((!FirstRound) || (EmbeddedDriverCount == 0)) { + if (LastRound || (EmbeddedDriverCount == 0)) { DEBUG((DEBUG_INFO, "ProcessCapsuleImage - 0x%x\n", CapsuleHeader)); Status = ProcessCapsuleImage (CapsuleHeader); mCapsuleStatusArray [Index] = Status; @@ -546,7 +550,7 @@ ProcessCapsules ( EFI_STATUS Status; if (!mDxeCapsuleLibEndOfDxe) { - Status = ProcessTheseCapsules(TRUE); + Status = ProcessTheseCapsules(FALSE); // // Reboot System if and only if all capsule processed. @@ -556,7 +560,7 @@ ProcessCapsules ( DoResetSystem(); } } else { - Status = ProcessTheseCapsules(FALSE); + Status = ProcessTheseCapsules(TRUE); // // Reboot System if required after all capsule processed //