From patchwork Thu Nov 26 18:41:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 333050 Delivered-To: patch@linaro.org Received: by 2002:a92:5e16:0:0:0:0:0 with SMTP id s22csp1543810ilb; Thu, 26 Nov 2020 10:44:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhUZd/Xt9t/28PvThP9212zOn4sAAkeG83IEX3Gl5bj3JqQ1IfxU3DuVXVL2yVTDfBKHQW X-Received: by 2002:a17:906:c7d9:: with SMTP id dc25mr3892146ejb.309.1606416284039; Thu, 26 Nov 2020 10:44:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606416284; cv=none; d=google.com; s=arc-20160816; b=WtzWR0SomULi742+FDdZAYLoaLFlSEgF3+QW2OCpB0hmKd//MenOnxjitvzcYQEKaV kB6oktnTiPnFWgFxioQp/oXAktdzKVcQHGGqLA2JEMCq4dM1dceABUsEYK4i2yZp00E6 CPNsvLGKqY7Z8YVrkG2vj9FfFIwd7trIw58Elkubnj+fsphE14+9NchobUCcrPaJvyD9 ey7mcNMR1vnb8y3n+GkyyxUS3DeOEtMIgGaWo/RJUUZd3UyXSeqmW2P+1lcXq5Ntf/Mp swVjFdBqy/bzKpVetX9If8onRSjI6uHg5QIAnbdREQwoWZRwkH1XKQYdg3Fqd9TqQXEw /zew== 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:references:in-reply-to :message-id:date:subject:cc:to:from; bh=90TEn/uexgAbatgMfxQYNXOGIzhTQJHbEJwQ2j8PHdQ=; b=084GJlNB0eJ/mb8lHnpbiEOP3u4AdwkXqEeh5UzEp35p/rmngZYKnyBmYcwl+EYPFX lKffMdIO+lNAPLR8R59EtH0OG5/27v4IzMdjpgVnjF5ni1cR48kE2Lu1rCjtvhAVXA0k Oo59GZ+DXG6lP5Zp/B3VvGCJbZMpNx3S0ek7SgEhtIW1UOGjC1sTkFlMkyAcPtfp8xYP Px8+LibB+5gTH3co0xbOBMbnRKQORavbktECN+oAE3Nu6C6U+T6mSt9lnhhpTL9vY0R9 muraJTPxBiqtOAzW4nEJ00wk23o+OR2IPxCu2/GzWd1XgnuVVK0TGzDRNxXg62IQ1WK1 Lkfw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 d64si3694107edd.257.2020.11.26.10.44.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 10:44:44 -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; 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=fail (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 6D12A8271B; Thu, 26 Nov 2020 19:42:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 4534182700; Thu, 26 Nov 2020 19:42:33 +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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 59C35826FC for ; Thu, 26 Nov 2020 19:42:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2103F168F; Thu, 26 Nov 2020 10:42:27 -0800 (PST) Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AD3133F23F; Thu, 26 Nov 2020 10:42:24 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Takahiro Akashi , Heinrich Schuchardt , Alexander Graf , Lukasz Majewski , Tuomas Tynkkynen , Tom Rini , Sughosh Ganu Subject: [PATCH 13/14] efidebug: capsule: Add a command to update capsule on disk Date: Fri, 27 Nov 2020 00:11:09 +0530 Message-Id: <20201126184110.30521-14-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201126184110.30521-1-sughosh.ganu@linaro.org> References: <20201126184110.30521-1-sughosh.ganu@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Add a efidebug subcommand to initiate a firmware update using the efi firmware management protocol(fmp) set_image routine. The firmware update can be initiated through 'efidebug capsule disk-update' This would locate the efi capsule file on the efi system partition, and call the platform's set_image fmp routine to initiate the firmware update. Signed-off-by: Sughosh Ganu --- cmd/efidebug.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.17.1 diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 7d327c8268..b8fe9ad6d5 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -79,6 +79,16 @@ static int do_efi_capsule_update(struct cmd_tbl *cmdtp, int flag, return CMD_RET_SUCCESS; } +static int do_efi_capsule_on_disk_update(struct cmd_tbl *cmdtp, int flag, + int argc, char * const argv[]) +{ + efi_status_t ret; + + ret = efi_launch_capsules(); + + return ret == EFI_SUCCESS ? CMD_RET_SUCCESS : CMD_RET_FAILURE; +} + /** * do_efi_capsule_show() - show capsule information * @@ -207,6 +217,8 @@ static struct cmd_tbl cmd_efidebug_capsule_sub[] = { "", ""), U_BOOT_CMD_MKENT(show, CONFIG_SYS_MAXARGS, 1, do_efi_capsule_show, "", ""), + U_BOOT_CMD_MKENT(disk-update, 0, 0, do_efi_capsule_on_disk_update, + "", ""), U_BOOT_CMD_MKENT(result, CONFIG_SYS_MAXARGS, 1, do_efi_capsule_res, "", ""), }; @@ -1540,6 +1552,8 @@ static char efidebug_help_text[] = #ifdef CONFIG_EFI_HAVE_CAPSULE_SUPPORT "efidebug capsule update [-v] \n" " - process a capsule\n" + "efidebug capsule disk-update\n" + " - update a capsule from disk\n" "efidebug capsule show \n" " - show capsule information\n" "efidebug capsule result []\n"