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 D75F2C433F5 for ; Thu, 3 Feb 2022 09:23:40 +0000 (UTC) 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) 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-Google-Smtp-Source: ABdhPJwIis+vCvzpW57r7VyM5dO/xy0cZ0RNEbuopkdEgvby/tOyw3QWLJVFuL/PfxspHioh8UkzBA== 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 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 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 --- 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 */