From patchwork Fri Jun 8 06:58:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 137923 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp511840lji; Thu, 7 Jun 2018 23:58:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJm/5vB6gDfqABT4hhN7hahyFWjD4BjBweF7nm3Ik9GzCvWa9a6Wf1zU/KlOy8m3PqLB/g6 X-Received: by 2002:a62:cf44:: with SMTP id b65-v6mr4757282pfg.80.1528441106051; Thu, 07 Jun 2018 23:58:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528441106; cv=none; d=google.com; s=arc-20160816; b=jwwrS4I32BSlYlesFgWt+cmpQeOaMEjQvR8cP6gSY2/TsfTKTp4juu4cDtasq5ezHA riGb8VEC14QZDU1rY9MIFSlN6P4Yhw6IJq8b8a6k5/Hm4/mSDC7xRd0ZI6620qfibuD2 +f9Q8Xam6rmYdwgeDi52UTklenHkkRGpN8EglBjR6QaV4Kw4yhwC535P3dURcyn8jAmY hby48GSw+Jnh5Q0RNH3MQ4jHKdh9+BekiBAg6yFoSwSeQ2/jo1KC5kk/1v/aIt1tvTFr PnAnvnPgurSdcQHeDcRyrEVMPoQqXRlzNUIPGm/2N0lKJkh2+akDJFIumBwqGgD1HZbo AISQ== 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=DRLsit8+k2cX0C2Uu1D0rxYE/mUzrzsyd1SV1SrYPD8=; b=mpUN0wd1jCsPAc0pyJ7sjkV4nraHErFfW1+uwl/Wh+11FlPdiOyn8vdOBpVQhnyLT+ 04hGU8aN2f9NeQrEWm0i7AtjxQ9Xw1EDbiVCwt/VVOfabbj4PPcuKaL06cyq3S/KzKf2 TLzjPNqthxyJR6EBOaFN+TTMlW9dmodc/Vwgc/UBe6DDXGG+r9WDULqopJFTbuwe3R6z 4zMEabQ8f597hxtEb31LvzoZBTsR2sXOsgOtpHQnD8e2zsyqqpuJtThQRvaPXZLb8u97 IK6PoPgWyavJhSfNhkfwONTVn4UvglEXLPQL6GfCOODkMuGJM84ero9ciZKF56WSiyUB OmAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XiFno4oG; 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 s193-v6si9660570pgc.372.2018.06.07.23.58.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 23:58:26 -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=XiFno4oG; 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 EE0BF21106FD6; Thu, 7 Jun 2018 23:58:23 -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::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-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 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: [edk2] [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: , 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 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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 //