From patchwork Thu Feb 3 09:23:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 539593 Delivered-To: patch@linaro.org Received: by 2002:ac0:f7d2:0:0:0:0:0 with SMTP id i18csp2253132imr; Thu, 3 Feb 2022 01:23:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzPVvThA7h0XEZdVTo/InWKW+kLTXBVD5sFj9KrYoV3B5RxDUZgFbj9ld0oUpnfH3GGf3iD X-Received: by 2002:a17:907:6d8e:: with SMTP id sb14mr29058322ejc.11.1643880220638; Thu, 03 Feb 2022 01:23:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643880220; cv=none; d=google.com; s=arc-20160816; b=MBeG14EGH34ZSeblMeVlACT1KgmgYeAy0PXRasfZfHkJSMTC+GaBPdL8OBOAak9Yl+ ek5FBJazZ5zPpilLqP+wpMt7I1OZfXdxTVrpkYxpagvJSZ0/D2XqRQjzB6xKhNBdfYoP QkD8WgWFoy30zdEYorKxP1n4aof3ohe0UKvz+tLxVm67RgA1vucgJbxZFBA46J9MFBj2 zFtLnFZf3U4fvVguBsEFfgG337rDzlI/NJj/jtdATVlUvz7wuHyQ60UzQygSXZCgAcAw yn+rsFUDn54Hdy9/V524R4jmIggbAizIyzNQR10VUUJGO95T8j1Nn+TeMxMhksGVVbyH f/qw== 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=H5Of4TxnrkJMIdwUOhPI+GskPutF0nUsm1ak5Cuaego=; b=jyI7eKu2GWrX+ZL1jQ3+NxysK5pYsvfQ9/WB0t8yQNLCpBjnim+Sza8BakVcYpBfLH NUxAn76st3Wm6L94ni6GDRRmT8R2dW/Bpwhbo2ODhMCm74jIzL8ZdxiPfaM1r3qBJyqo q6KHTSx0fMc4puT7av3xwcLmNCpp0ZBlynU8lNdQFRjjyz3RbeEI53EGOneFWak3eeRA kkcj9lzcnXkMmJHFYpWdCTKbJxL6RLHgmBx1X/1R5bLDURA4+OrnxmZXO62tTIyW8PEy e+Urb9BdlFo2lZYCFFNQ9a6n+1eIletC55p/2nI/+r/Khb+8CmPjoERIOm5g9ofyCiug ql/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QzoCzT3s; 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 f16si9357072edq.358.2022.02.03.01.23.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 01:23:40 -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=QzoCzT3s; 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 7F5B483922; Thu, 3 Feb 2022 10:23:38 +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="QzoCzT3s"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6B946839EF; Thu, 3 Feb 2022 10:23:37 +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-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) (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 09E0E838D3 for ; Thu, 3 Feb 2022 10:23:34 +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-pj1-x102b.google.com with SMTP id o64so1866897pjo.2 for ; Thu, 03 Feb 2022 01:23:33 -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=H5Of4TxnrkJMIdwUOhPI+GskPutF0nUsm1ak5Cuaego=; b=QzoCzT3spFeF1PZrr2OsM8Bw7DXksd6ALxuxDXS4XKNT8RLav99UoMBLqq/L4WAL9q 3QLp9oHkJ70Uujwq5nGz1KwtYpD0RH6c2iJIGVYcJlZK79DFQtWUyS7SEY5xOKXC05vA hVbDam3uC5PgSxXjSB1o1xbGUryy1JbmYdF5V0Z/85S0L9DxVgCtDuO1igK70kAB8xn1 9uEGeUzzOBUeIFtMw5ZUmR7OE+6FTKTH/xJxQXMXaRDlOzTE5YvKIbi+j6GmDOxmgj41 dTOKch/SijLaahBwtCdb0X3pU66wwNMfUy63iwZCEZOL06cgZ/rXg3w/2K4usrznvt67 tU4A== 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=H5Of4TxnrkJMIdwUOhPI+GskPutF0nUsm1ak5Cuaego=; b=mEw6R49oHyDzoTZdQEY7Ip/CXwtPggXhtTQJF9+/U31s9cn2IGfrlR3tFjGNLs9JNI zj5u2K7ybUz6lSzjCykFD8/HWhUNcdTv1yDrJF6De9SCQ1jY5S1xykikRxpnNfJLZIUN K5tfhlAGNawrUkfJPieT0KBpbPqHybP23RJSyOSqVPBlZV/cEZLi2Pc4PAuG4d/jDSId i3yxzgm/xkqKv/xoUPR+0K8n4d84RgczC34HJJIqA3w0bZcYK5O7ldLoZ0YSJ3F3tYLx Jahamj/6YUz0p4kLekepQawmr7uUKhsJ7THmewxT8ccTjrK1VqVOa59t+xqX6R/zK4gH 0LOA== X-Gm-Message-State: AOAM530zk9wm8l1UGiywNIrNoAE5z5Zs5nX9Wr3Rai5+6TVz/8RXjh5r NdZFNwtcRum2KXam8Wz1BiTKOWP6Q1aNqA== X-Received: by 2002:a17:903:1c6:: with SMTP id e6mr35484638plh.132.1643880212037; Thu, 03 Feb 2022 01:23:32 -0800 (PST) Received: from localhost.localdomain (113x37x226x201.ap113.ftth.ucom.ne.jp. [113.37.226.201]) by smtp.gmail.com with ESMTPSA id pg2sm10805383pjb.54.2022.02.03.01.23.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 01:23:31 -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 v4 2/2] efi_loader: Reset system after CapsuleUpdate on disk Date: Thu, 3 Feb 2022 18:23:27 +0900 Message-Id: <164388020701.446835.322529861013544459.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <164388018493.446835.11931101380744085380.stgit@localhost> References: <164388018493.446835.11931101380744085380.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 Add a cold reset soon after processing capsule update on disk. This is required in UEFI specification 2.9 Section 8.5.5 "Delivery of Capsules via file on Mass Storage device" as; In all cases that a capsule is identified for processing the system is restarted after capsule processing is completed. This also reports the result of each capsule update so that the user can notice that the capsule update has been succeeded or not from console log. Signed-off-by: Masami Hiramatsu Reviewed-by: Heinrich Schuchardt --- Changes in v4: - Do not use sysreset because that is a warm reset. - Fix patch description. --- lib/efi_loader/efi_capsule.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 1ec7ea29ff..20d9490dbd 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1120,8 +1121,11 @@ efi_status_t efi_launch_capsules(void) if (ret == EFI_SUCCESS) { ret = efi_capsule_update_firmware(capsule); if (ret != EFI_SUCCESS) - log_err("Applying capsule %ls failed\n", + log_err("Applying capsule %ls failed.\n", files[i]); + else + log_info("Applying capsule %ls succeeded.\n", + files[i]); /* create CapsuleXXXX */ set_capsule_result(index, capsule, ret); @@ -1142,6 +1146,16 @@ efi_status_t efi_launch_capsules(void) free(files[i]); free(files); - return ret; + /* + * UEFI spec requires to reset system after complete processing capsule + * update on the storage. + */ + log_info("Reboot after firmware update"); + /* Cold reset is required for loading the new firmware. */ + do_reset(NULL, 0, 0, NULL); + hang(); + /* not reach here */ + + return 0; } #endif /* CONFIG_EFI_CAPSULE_ON_DISK */