From patchwork Wed Dec 23 07:03:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 346999 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp5971392jai; Tue, 22 Dec 2020 23:06:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxR22aQamRf+Ew2RaIyLjuvVDU/0AU6t8E2ZNQLZxNYvEC2/A1zKDlRkLu0okHKSFIgU/gH X-Received: by 2002:a17:906:aac1:: with SMTP id kt1mr21954647ejb.329.1608707178195; Tue, 22 Dec 2020 23:06:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608707178; cv=none; d=google.com; s=arc-20160816; b=s4OenzNtNJrlc1VghI/8LCNwqGiS4Nm1hBQcCh8tIZbbNxTEm6sgMxPUct0YQDVXGr cY9qKeoqv4gpYoYv9MMCm4fLV1JLBaPE13h5aOrz6+aOMoC14HZ9zNVYj6gMLvbaWzOv fK+cQ3T6SseYwrbuwHdO16xZuXk8cR4uN2JRb2RMpgac1aTliAP3O1G5C0snGHATG7pE Ezdg/+o/NNfERdwJ9lpSEHg7B3i6w1WFeM+BBuTxstPY8mbdAlEJzPwziVwOR/V8nPiI i7wN7fCnA5nmvQQftUoqu4HTCiUdKLWOt0+5fmwAE+GIQM5bGIVjI0f0L5eR1EnD5PU9 UR9w== 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=2lw6t9UCuE3y3RN3AvK42a/aBvFSFlwNJ7GdUg1OcS0=; b=EXH9DWtyZLvl7JuQy3Ihg0Y6e+Nascar+Pup+/lpZc79pBhm1ozQEsBBC+RvhxwzqX XEh5CRztMJXAn5/rQ9r9DZ2C5MKkXmcg8KBP0ylNdwO4AI1VLHxf8Rfd0lmmRYirvxjJ hFFY9AeLXSgli9zc6LtNYxTFt2NDsy+TzYoUArSauoL7yaggEAa7fvSyQxy+OQ9QqK/I 21CQBhVoXTg5YV0SbajD2mRdu8ELNbAar7g1BYAFM34BW0gTkEHsD5kayiTLFfrMbFNG G9CMAsAvC6vBajFzZ+ifLMJatCEqni9xI8uiB79Flzn9XoMk7YYSlTsDtmAhi/vdA2OZ IMIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id n17si11548133ejs.423.2020.12.22.23.06.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Dec 2020 23:06:18 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 AAA8782B35; Wed, 23 Dec 2020 08:04:40 +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 F29D582B27; Wed, 23 Dec 2020 08:04:27 +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=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, SPF_HELO_NONE 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 72F8482B1E for ; Wed, 23 Dec 2020 08:04:24 +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 D3EA030E; Tue, 22 Dec 2020 23:04:23 -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 404563F66E; Tue, 22 Dec 2020 23:04:21 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Takahiro Akashi , Heinrich Schuchardt , Alexander Graf , Lukasz Majewski , Tuomas Tynkkynen , Tom Rini , Ilias Apalodimas , Sughosh Ganu Subject: [PATCH v3 13/14] efidebug: capsule: Add a command to update capsule on disk Date: Wed, 23 Dec 2020 12:33:29 +0530 Message-Id: <20201223070330.21361-14-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201223070330.21361-1-sughosh.ganu@linaro.org> References: <20201223070330.21361-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 --- Changes since V2: None cmd/efidebug.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.17.1 diff --git a/cmd/efidebug.c b/cmd/efidebug.c index fa9d7fe757..5fb7b1e3c6 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, "", ""), }; @@ -1544,6 +1556,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"