From patchwork Mon Jan 22 11:54:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 764627 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1059277wrx; Mon, 22 Jan 2024 03:56:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqni3HP/A7gguE1joRMmPF+3qOGyVUT4jKXue4Cs7J8Vrwm6/rY4SvyVg1PKJmJcIJzMff X-Received: by 2002:a5d:4706:0:b0:337:c4e9:1203 with SMTP id y6-20020a5d4706000000b00337c4e91203mr2244634wrq.89.1705924604665; Mon, 22 Jan 2024 03:56:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705924604; cv=none; d=google.com; s=arc-20160816; b=kJYoIdTiQd85LyMnI6nxgQ0Nb6Oi29R3SwQ4EeTLKyMnWnz2KzC4uam+NatCNPZlsi snLfIkVqsJp0ihHJbvsWbmTvqUkM9kzYKZgJ8MIu9V1tZp8d/MWbaWpXDDSbni3FNRTc 8hRxDpqLXbvr6xMuT84mTahQ6o8Shz0CC8/2hubES0CPTPXAx8nRriyA+c+uQi73Pw7C A3DyIlRvicyI7r25dvJ1eo/GXIrGjI90urhGXoLlqma21wAeZaq+bCYqJpupFMnYpJBA 1yWEDk86Wa8zhedq0aSZyW7HDq/1vgn1speYjqF1lODqbJCTUF3aP9TnxZqrJQT8WIQi wB8w== 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:references:in-reply-to:message-id:date:subject:cc:to :from; bh=KHoC3fY1GnNVqdjcAsrXpIKQFjVFhJC5GQqelLGF9ww=; fh=rhmJ78R78zNUSUA9Nt0a5TbZO4CVsI4vi5GcqSIe+nI=; b=F6/d8AgsNEn0hUmYo3o2ruoKurbT/s7qvCw1SnK7Y9zgDKeDgGO8+gmC7onlXJ8S35 KASCFpmMWn0/uHrM7NDPAg/GnG+KqQ8XwXdHqOH4mXPjPn4qhnlCYYyjXnycdLUpuvOW IRDOgUysIVO4ZOr8cFsIEYJ8DuHx5OIFoTCjrH6c4hZR13OVLDoP5NiNx4Ftswf7u8eY +D6aCvuhpycsPPEGqp34oPTow8DtEjTfH3pQiWxw6U1cXKMFnjAQlO90Of83B+BhHGWG 0HY1DexhJlFOHNdfom4Ew3J3fjyLJIr7Y/HVlVUvb83xZJcdSTm1C4g0OPZXkprmHPQS cUPw== 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 s10-20020adfea8a000000b0033927cd7d6fsi2634004wrm.1019.2024.01.22.03.56.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 03:56:44 -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 710748797C; Mon, 22 Jan 2024 12:55:46 +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 A91B287950; Mon, 22 Jan 2024 12:55:44 +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.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no 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 D7CE487B1F for ; Mon, 22 Jan 2024 12:55:40 +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 621DB1FB; Mon, 22 Jan 2024 03:56:26 -0800 (PST) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AA14D3F73F; Mon, 22 Jan 2024 03:55:37 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Masahisa Kojima , Patrice Chotard , Patrick Delaunay , Yann Gautier , Etienne Carriere , Sughosh Ganu Subject: [PATCH 09/18] capsule: Accept a bank on a successful update Date: Mon, 22 Jan 2024 17:24:30 +0530 Message-Id: <20240122115439.653871-10-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122115439.653871-1-sughosh.ganu@linaro.org> References: <20240122115439.653871-1-sughosh.ganu@linaro.org> 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.8 at phobos.denx.de X-Virus-Status: Clean The version 2 of the FWU metadata maintains a bank_state field per bank, which keeps an aggregate status of the bank. A bank can either be in a valid, invalid, or accepted state. Update the bank_state field of the metadata once the update has gone through successfully(when skipping Trial State), or once the images in the bank have been accepted. Signed-off-by: Sughosh Ganu --- lib/efi_loader/efi_capsule.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 0e6a38b441..422bb11162 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -480,6 +480,12 @@ static __maybe_unused efi_status_t fwu_empty_capsule_process( if (ret != EFI_SUCCESS) log_err("Unable to set the Accept bit for the image %pUs\n", image_guid); + + status = fwu_bank_state_update(active_idx); + ret = fwu_to_efi_error(status); + if (ret != EFI_SUCCESS) + log_err("Unable to update the bank_state for bank %u\n", + active_idx); } return ret; @@ -525,6 +531,10 @@ static __maybe_unused efi_status_t fwu_post_update_process(bool fw_accept_os) status = fwu_trial_state_start(update_index); if (status < 0) ret = EFI_DEVICE_ERROR; + } else { + status = fwu_bank_state_update(update_index); + if (status < 0) + ret = EFI_DEVICE_ERROR; } }