From patchwork Fri Mar 22 10:57:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 1914811 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V1K8g4rfPz1yWp for ; Fri, 22 Mar 2024 21:59:31 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B9299881D8; Fri, 22 Mar 2024 11:58:32 +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 26BAD881E2; Fri, 22 Mar 2024 11:58:31 +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 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 2B147881D5 for ; Fri, 22 Mar 2024 11:58:29 +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 BC3061007; Fri, 22 Mar 2024 03:59:02 -0700 (PDT) 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 A12553F64C; Fri, 22 Mar 2024 03:58:25 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Yann GAUTIER , Etienne Carriere , Patrick DELAUNAY - foss , Michal Simek , Masahisa Kojima , Michal Simek , Sughosh Ganu Subject: [PATCH v3 06/20] fwu: metadata: add a version agnostic structure Date: Fri, 22 Mar 2024 16:27:19 +0530 Message-Id: <20240322105733.203888-7-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240322105733.203888-1-sughosh.ganu@linaro.org> References: <20240322105733.203888-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 FWU specification now has two versions of the FWU metadata structure, and both are to be supported. Introduce a version agnostic structure for storing information about the FWU updatable images. This allows for a split of common version agnostic FWU code and version specific code. The version specific code is then responsible for arranging the data as per the corresponding metadata structure before it gets written to the metadata partitions. Signed-off-by: Sughosh Ganu --- Changes since V2: * New patch include/fwu.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/fwu.h b/include/fwu.h index 6c4d218e13..e681e91027 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -35,6 +36,23 @@ struct fwu_mdata_mtd_priv { struct fwu_mtd_image_info *fwu_mtd_images; }; +struct fwu_data { + uint32_t crc32; + uint32_t version; + uint32_t active_index; + uint32_t previous_active_index; + uint32_t metadata_size; + uint32_t boot_index; + uint32_t num_banks; + uint32_t num_images; + uint8_t bank_state[4]; + bool trial_state; + + struct fwu_mdata *fwu_mdata; + + struct fwu_image_entry fwu_images[CONFIG_FWU_NUM_IMAGES_PER_BANK]; +}; + struct fwu_mdata_ops { /** * read_mdata() - Populate the asked FWU metadata copy