From patchwork Wed Dec 30 13:57:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 355267 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp11351976jai; Wed, 30 Dec 2020 06:00:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJzuvUeXl0beBdL8+ScuRofVqEPw5viS7kAflfPay+fceEfAw33UEvkWiTPbyDn6u9m2m76r X-Received: by 2002:a05:6402:41:: with SMTP id f1mr39188322edu.286.1609336829042; Wed, 30 Dec 2020 06:00:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609336829; cv=none; d=google.com; s=arc-20160816; b=ZV3Q59Xw/1/CHxPUKkfbHlGKb5Wcd7bqAbJLFhzbyMmathTxvilmYm24nFBFyXNHb1 oYeHc+eyrAi1kKq0fXQ8zpld6MRsfoWmyUyb5lpydeH6TkaOPw74cT83C/VuAJgnGsjq GIKoAmTZEOXEBvz/0iOdmOY8ZCluQg9z8YMq+sWWve9mzDpEezrtLNIxD/MoB3U3ocT7 7rET6+IiSDhwcNvLNMW4LX4NCrebmvPkDl0SA8DwtIdmIZ5T1YXxmLZvuwmweKuzp8UX 41oZTUU9NOca59nK3fpUby19XEQKnAazHvJDZi4w+DwWZQkmtpIlW2QlDejvj1P9exGj 5+jA== 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=BW3Qlv8ICDUaauljPuBq15rLf5ZxnpCilHXkN/8RQVA=; b=TB8iedaEW9yDZuc+BSlr0rWpf6M89ysP5bpmAOGDe3ClBQC3y25u1AHuJBJ7EeqU9L gyTZdZcsTbvRIP+fzmv4L8k5ydx+gz7ht9NYZqlka1iMAszH2NRUojxpBvajzQ/xj1vl LySREh+8U04QE9QscgBvP6HnXGTsqFH3KJfI/czWixb1mwqBFtPebt6GrwJl/w6m0m8Q hTx1RhKnRxq8phJzu4E7sTkNXHH3KZYLzGIbElWaoie67+jTccsGOLCkqSNCCLP2lKES Z6l7lWc+Usw12mYQMMaOV341rojUe3dfr2n21mxQZzkZakbx/qVDfr/Oye1/MeuLdCHX DS0A== 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 t21si28948605edi.2.2020.12.30.06.00.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Dec 2020 06:00:29 -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 7B36182646; Wed, 30 Dec 2020 14:58:55 +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 DED9F82573; Wed, 30 Dec 2020 14:58:15 +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 1AE1C82611 for ; Wed, 30 Dec 2020 14:58:12 +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 9A0D71063; Wed, 30 Dec 2020 05:58:11 -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 034953F6CF; Wed, 30 Dec 2020 05:58:08 -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 v4 13/14] efidebug: capsule: Add a command to update capsule on disk Date: Wed, 30 Dec 2020 19:27:11 +0530 Message-Id: <20201230135712.5289-14-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201230135712.5289-1-sughosh.ganu@linaro.org> References: <20201230135712.5289-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 V3: 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"