From patchwork Mon Jan 31 09:18:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 538479 Delivered-To: patch@linaro.org Received: by 2002:ac0:f7d2:0:0:0:0:0 with SMTP id i18csp1560673imr; Mon, 31 Jan 2022 01:19:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVTZL3WQrkbBBlVgyeaGfRM0um1AQbl6x/rX5Xbwgwo7GLVVHNHHDwz1oZ3JtHir5AJ1nn X-Received: by 2002:a05:6402:27d4:: with SMTP id c20mr13567123ede.182.1643620745910; Mon, 31 Jan 2022 01:19:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643620745; cv=none; d=google.com; s=arc-20160816; b=xxSQVgpIBXSXnwoB6jXWB6cbAw8G68e3G1zCQLd/z+d+JROH5+cPVkPDj814htsoGW G8cLZl2McHezlAcDyMyrFoQzrWME58hAetKEyQacdnsAbakcY6HzJnOzywZyBRPqwM8G Pmy7yQpuGxaIb6K0Q+oNWos8qmSL8RcYpV8SEJquJZtfyU5hE7JTCE9LDnodXmlZtddq o2WzBz/w7KO75CbRM46OdBxbYJTeoYqUOD3hhD2WD1iylAtIglv+0TEwoFInTdnjxUMm GqmOLkfTH1wWCPhTCs+lV35ACXQE/3UNeUVX1nTWquW6+h4lP0G1NHKAa+zVKQ1WRRHL pN0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=HfZl83iKDo2+VVEewWr4yfcFjeVxEn3Z024ZTCG+dBc=; b=cxLpv5Efzyw25uH8bMTU8kTLU8MfOdbbazqjNsi0b08OF/RhIjoWwHOSrahUXcMSyY 4yKF5dDhDoVrkwK2Oh803xiaIW/5I6HunPFRZhN8Faq6xIj+3k8k6yPQs1q+AjbTPzWj BTFc/j3gSVkYyLtvWQ1fkrqtlX/uboenawNxTX61j1gbyMFQslyMbpLovg7Mdw8eDRVE 91YMCRb7KlPgk5NAzkZhjwhNo3OMzEzxvUijwa9g75le8NX1ZZgb5USa3hQdhZm11dns rkbOtI7alDyAXWjaeWHj5PP199zK9PJ0sDF8v45obO3I7VF2MF9J2JTs1gdCkfyen+On ODIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GoSUPYzT; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id oz9si4369437ejc.814.2022.01.31.01.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 01:19:05 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GoSUPYzT; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 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-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 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 */