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: 781839 Delivered-To: patch@linaro.org Received: by 2002:adf:cf01:0:b0:33e:7753:30bd with SMTP id o1csp1273675wrj; Fri, 22 Mar 2024 03:59:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWg4lcllnIcOM4lHfyuK8HBPQak+80taELe8aowoZhSAEwzjdVRo7dktmAZxkd3CxnSJtI6dJjHBKWmGYKUq6Ur X-Google-Smtp-Source: AGHT+IHjnUYNiUSqxty3eGs5rI4GIRwf0sGO0F/hb8thBTL0ytwKPJ027IVKJMdCb5d6z1AVXLO5 X-Received: by 2002:a05:600c:470c:b0:414:6cc9:6dac with SMTP id v12-20020a05600c470c00b004146cc96dacmr1442281wmo.29.1711105169710; Fri, 22 Mar 2024 03:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711105169; cv=none; d=google.com; s=arc-20160816; b=p/HPqFqym8ms+41wwm8Tf1Ynyl2H+s9S47FUWlHFjYSYkFQRXnGvxLN1vCZSZVX8Rv XnRf7zmxOnTO3X+AutKRjVE/HNgvhZXqD6t6/t18xw1Z93dmKHWwuoZj1ReXaO3fDW8d jaMvIO+X66vwKzF353KRWNs6JIhJuqfgRRra6AP0juRLZN7QRj60IMlkPowjqBLbgLtI 0+dtDisiee7KX2jOb9QYPFgzYPte93tVo7gtDvvBKqHRixkDXqtf/nOLpS9wZ2HkDxsL PMeMLMj8SJW5rNeE/Uyoyv+MrRg8uLdPs+13zN2RSLuOFLPw70YmNDHuYNzTf1yiDHBF E3+w== 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=eYKkjuV0mglCC+KnhJd2bJQi2sOBIARLzt5S6sOYPKQ=; fh=0OBOeNvG1YwOz62VjCAPxJsyowuZOMIwtNTktJXXBMY=; b=yaELRj5AHHi8BlgKWT3jl+MkKtCSP1l51jfsTFsqh4g4fhYESe9H6NKKDkjvvvl1Sl 2dOmNAxQdKq5rZGhFO9UpiLyTJg+VmiPCzUE45IR/hse6xCyHgOGqP/Gf2QJhQqL7paW kJUcBmjDPmxV+lZwnNAbH5va1jki0jEaQaw/iXGST+d0COS4FZQXX5fSTGl3Xu2Pa0lK K59LP7f7ScPganjqdwLro6Izd9HtpeVVB7iPkRKG0nwG3QRU81UTo0qRzjeBQpiHWx/n yLcwfrKkZdx6Vz4QAGM9WYCVr0dWTd1xJQk8FQ5NEyAYMp14xPkdEOXf147tfA31hZdA kzvg==; dara=google.com 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 d5-20020a05600c34c500b004147ddd4f71si255817wmq.231.2024.03.22.03.59.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 03:59:29 -0700 (PDT) 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 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