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:c09::242; helo=mail-wm0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::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 390DE21106FCB for ; Thu, 7 Jun 2018 23:58:22 -0700 (PDT) Received: by mail-wm0-x242.google.com with SMTP id v16-v6so1382752wmh.5 for ; Thu, 07 Jun 2018 23:58:22 -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=Q9G4PpnS3BIJu/0hNkN72JkwkzYhKcEVFra6o/+dWAc=; b=XiFno4oG6HnXXER7o665NDwpcrhS/D9UaEtm8XhIOvSBVNO77eKRpyFUsP5qceegYY 0zbMz7vWzHTNp74IfL2cc2lhiQDnslxHsA2+AG8o/Q7pqBJPLcnmApqdVO7tG7FVd+wc +pMWc9bJ0MIkz31fiKGtx9aJux13pN9rwsRV4= 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=Q9G4PpnS3BIJu/0hNkN72JkwkzYhKcEVFra6o/+dWAc=; b=EoNeCeVqo/K46pN4bRXuPJ8OhhXURJxhbXKxU22Zo1mJBf3a8EF6uqfhPfGtlpxOyO EH1jGroEzvbxOT90CJZ1cf4iYcoRVBDH6XewHG26ljg9ouErvYJkaxxj4lqFAq9xXOHW ry4pvUG1AnJZgMnEC/FtRByuMgukS7hN+8I8OJdKzCqV/yjeC+73bLBd7MgCxmHQPq03 TlWmubTp6nzhYM+FqW85Nfr/eFKUAPo/MH1D998sllTUNaRyXNp3xJ3Tgft+j0pN2N/N VhVhWTGosCuBYneyl5cV1yZMdPYJ9OTqyPIX6agSf0kdNzfXhUAVtZm4WxNUOOirK9vL 97Mg== X-Gm-Message-State: APt69E1HsofaXumosZ0SP6EUwlNuTr/YsqQCjrpGUP4yNS/pcdI0v60d d82cciqsxUC9Cel36LH3wZE81mZ9s2w= X-Google-Smtp-Source: ADUXVKKVK2lSdeZCsVjNKC9gRzTlkpf/7RnIim51Kzou2en0E2BJO6eTPu1XV2R7r64MlNk45EKECw== X-Received: by 2002:a1c:d482:: with SMTP id l124-v6mr578066wmg.22.1528441100527; Thu, 07 Jun 2018 23:58:20 -0700 (PDT) Received: from dogfood.home (LFbn-NIC-1-75-91.w2-15.abo.wanadoo.fr. [2.15.165.91]) by smtp.gmail.com with ESMTPSA id x130-v6sm892491wme.24.2018.06.07.23.58.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 23:58:19 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, star.zeng@intel.com, jiewen.yao@intel.com, michael.d.kinney@intel.com, Ard Biesheuvel Date: Fri, 8 Jun 2018 08:58:08 +0200 Message-Id: <20180608065811.2065-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180608065811.2065-1-ard.biesheuvel@linaro.org> References: <20180608065811.2065-1-ard.biesheuvel@linaro.org> Subject: [PATCH v2 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: Fri, 08 Jun 2018 06:58:22 -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 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c index 26ca4e295f20..ad83660f1737 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,11 @@ 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] FirstRound Whether this is the first invocation + @param[in] LastRound Whether this is the last invocation + FALSE: First of 2 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 +377,8 @@ PopulateCapsuleInConfigurationTable ( **/ EFI_STATUS ProcessTheseCapsules ( - IN BOOLEAN FirstRound + IN BOOLEAN FirstRound, + IN BOOLEAN LastRound ) { EFI_STATUS Status; @@ -453,7 +458,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 +551,7 @@ ProcessCapsules ( EFI_STATUS Status; if (!mDxeCapsuleLibEndOfDxe) { - Status = ProcessTheseCapsules(TRUE); + Status = ProcessTheseCapsules(TRUE, FALSE); // // Reboot System if and only if all capsule processed. @@ -555,8 +560,9 @@ ProcessCapsules ( if (mNeedReset && AreAllImagesProcessed()) { DoResetSystem(); } + mFirstRound = FALSE; } else { - Status = ProcessTheseCapsules(FALSE); + Status = ProcessTheseCapsules(mFirstRound, TRUE); // // Reboot System if required after all capsule processed // -- 2.17.0