From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: ADUXVKLPGtQsmjASmMqiHoFVhGRW5Wc9lgNzFyv9WY+x73yNclgDW7u7mIQi4EyXPeb1gZqb248vgg== 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 Cc: leif.lindholm@linaro.org, michael.d.kinney@intel.com, jiewen.yao@intel.com, star.zeng@intel.com, Ard Biesheuvel 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: [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: , X-List-Received-Date: Thu, 07 Jun 2018 11:08:19 -0000 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(-) 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 // -- 2.17.0