From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF980C433EF for ; Mon, 31 Jan 2022 09:19:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B3D4283035; Mon, 31 Jan 2022 10:19:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="GoSUPYzT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 807FE82F5A; Mon, 31 Jan 2022 10:19:02 +0100 (CET) Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3984E83102 for ; Mon, 31 Jan 2022 10:18:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masami.hiramatsu@linaro.org Received: by mail-pf1-x42b.google.com with SMTP id a8so12345311pfa.6 for ; Mon, 31 Jan 2022 01:18:56 -0800 (PST) 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 :user-agent:mime-version:content-transfer-encoding; bh=HfZl83iKDo2+VVEewWr4yfcFjeVxEn3Z024ZTCG+dBc=; b=GoSUPYzTr80FM62EK0XjoEEsjGmNYwN9xxnr/NMKVUC4T4RWhyFd1fOwEchdVdVNZz SLlKLNlhvMw5X5ZZSEC4DUk0HQKIOnN0sZz4nZLO/xnlVn7ciue3n3mFXtyD2W5z6iL7 FE8ZNmSnI4QMnynpnL7vXpGkBq7FViDutt9XdtqY8tIdxg36Rhwe8vSoRQ7J+cgX5E5G VSq2OxBEd595zmgWwkrkLHTk0sPmASLljkSUowlZkp1bt5i/pzNJErygC7U30NdfwMiG PLIBKx213V4boMgP1H3ankZpc0BfrcDqMYqnY41pMFiWd30Rm6ANiHCvkB1NWpWjuaSt Z9vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=HfZl83iKDo2+VVEewWr4yfcFjeVxEn3Z024ZTCG+dBc=; b=pwGIYC2Vp8ealR5qIcWCuGeF1KpU0Lix/zLOq9v41BjqgMetVCNnN7RDndcMin729f nX5/Hh3c+rhCWrNqOWPVNSbbkwzB7jqHAS6W8vtAGQO1QBwuQnQ+dnM28QR9ey5cZUrv h6pLiF0+o3JnmpgzDnFdhE8IEDFzQvQSa61Fx8JLEbyN+nQL0uU1CWn+aG8dfKC3PxDp HgGtKDzjrAkGKC7wFkBZ1aJWp987wbpykKDhZ+CLLznYS8Q0vopuft40B5D7Lk4bTJSd ijJskD32IQKdr58Yw5Rz/gp1HSff+YOWyMp/yn1ZCfEiBhjTnum6Brm04HOEbXMqQwPz xNKA== X-Gm-Message-State: AOAM533nSCHO7nY7De5RhemkYwgxzr9Q7zn18CeIYLxK+sIrAcUm2pse uL1XOJAVgEGMQXRX6Eizcarx4c2u94TOzg== X-Google-Smtp-Source: ABdhPJzh5VT7e9kaxB0sKFtnGlpSgSME++F7ZvbkochV4QPJVcF8JKAlmQI3m31M6i+z8Wow74DHQQ== X-Received: by 2002:a63:dc42:: with SMTP id f2mr15727899pgj.477.1643620734474; Mon, 31 Jan 2022 01:18:54 -0800 (PST) Received: from localhost.localdomain (113x37x226x201.ap113.ftth.ucom.ne.jp. [113.37.226.201]) by smtp.gmail.com with ESMTPSA id nl12sm11248381pjb.1.2022.01.31.01.18.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 01:18:54 -0800 (PST) From: Masami Hiramatsu To: u-boot@lists.denx.de Cc: Masami Hiramatsu , Patrick Delaunay , Patrice Chotard , Heinrich Schuchardt , Alexander Graf , AKASHI Takahiro , Simon Glass , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Tom Rini , Etienne Carriere , Sughosh Ganu , Paul Liu Subject: [PATCH 1/2] efi_loader: Avoid using efi_update_capsule() from update capsule on disk Date: Mon, 31 Jan 2022 18:18:49 +0900 Message-Id: <164362072975.312714.5769638615920735810.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <164362071931.312714.14793570668139727572.stgit@localhost> References: <164362071931.312714.14793570668139727572.stgit@localhost> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean The efi_update_capsule() may have to handle the capsule flags as an UEFI runtime and boottime service, but the capsule-on-disk process doesn't. Thus, the capsule-on-disk should use the efi_capsule_update_firmware() directly instead of efi_update_capsule(). To keep the consistency ESRT also will be updated after all capsule updates are completed. Suggested-by: AKASHI Takahiro Signed-off-by: Masami Hiramatsu --- lib/efi_loader/efi_capsule.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 4463ae00fd..98dab1c6f5 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -1118,7 +1118,7 @@ efi_status_t efi_launch_capsules(void) index = 0; ret = efi_capsule_read_file(files[i], &capsule); if (ret == EFI_SUCCESS) { - ret = EFI_CALL(efi_update_capsule(&capsule, 1, 0)); + ret = efi_capsule_update_firmware(&capsule); if (ret != EFI_SUCCESS) log_err("Applying capsule %ls failed\n", files[i]); @@ -1142,6 +1142,13 @@ efi_status_t efi_launch_capsules(void) free(files[i]); free(files); + if (IS_ENABLED(CONFIG_EFI_ESRT)) { + /* Rebuild the ESRT to reflect any updated FW images. */ + ret = efi_esrt_populate(); + if (ret != EFI_SUCCESS) + log_warning("ESRT update failed\n"); + } + return ret; } #endif /* CONFIG_EFI_CAPSULE_ON_DISK */