From patchwork Mon Feb 12 07:46:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772024 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000293wre; Sun, 11 Feb 2024 23:48:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVesqK/QCtGmpFAe6XR28VmuNm+RV04kEFJHipKf8+I8LBYb1hyErY7ICMYQo6LnbmtysniQ1Sj0y5yKUuatRsC X-Google-Smtp-Source: AGHT+IED0i6VaCT9gjTeWitaOFGgepMvKk8dIWn+9kHOYIObVr7OyBGKcAgUrWtW5vphRg38+Bby X-Received: by 2002:a05:6402:3596:b0:55f:95ac:d698 with SMTP id y22-20020a056402359600b0055f95acd698mr3868992edc.32.1707724080066; Sun, 11 Feb 2024 23:48:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724080; cv=none; d=google.com; s=arc-20160816; b=J76HoCqQRCPKucRX1f/23I/3+jizBoqikzVoU+9BJ7A5eYDFy+l30D/lAUC5+GosM6 4b7y7G6gC99jyWs94Hz+79ODvBmXkRWXKUIX064+4meZhajweXtur+Jyyq1TYY9PQXEQ SjwZJdRGzUFfiakqpvWjiZFxEgCL97k7u9WJzqOP8+ebyQXmQlCdQl+UXqJraoO/1xp1 awzgyibCk3ahrFoUF++7p14BPDjlq6QvaWTE04qR1jHKfcGKT261xosjL17HGrsNncPO Y87U5wo8VNIqzr/qOwhRZdYxA1y9VUMlaeCiy6m/jUR0YxOW5C+se3121iz6A3LZHPPL DBoA== 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=JKMUXNnKmJqgK5HSYJdZmUx6n/LU+Uwn2/1K7yXCKVo=; fh=OnrRLZFWhxnHB6tKWyz5tIu2+M7n98ZbxH8ylTwXp64=; b=ChBpmWleNE1PkA05BFH808nvYlcAB919WoXBevT6V9Qpg5l94ryk0owSnYsw5R7bNI hbpRn/V/bM5xVQZGC2nh3FxFvP416++u64+GGjKrJq1hnXLg0tmKEtqcFZXAx52oGb/p KCHSekM0eCC1KYdXVKGj79FBfejJnyXXD4oPQG9hpEd3c0+M6lbt2npKcUjWEtDpwhvx HdevmslzUWeALrwU6QBbufKRhjNMgPn1HiTKdONzxQKmeyiUeTKksax0ftISpdBRmyLU Jwy294+0HW3W9vN1H5WobwkyyLYmgDwQ4RugZ43SSnaeeowVfQV70aEgODEaAIMJTr+m oBYQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=1; AJvYcCWjt/m3dcDxSL+q957MmUlBuB6VOB/cpgRAT1mSLlXeV/u3tmGavXZhSJqITVu396+trwwXS68jtC3rYNRMJxD3UPeqOwgaoM3Wl5cDCZyGSjgdNbAKwjolUfVzGc+NT3HJOhFvJXtFSMceWg1ExPcqoGOpek9rW/I4279J8NydyE9dv23Mafn7AeEqOquERB3rjLQB3Vqu91NTWVbTqjA6re88IdTdEAkzGre5MrAlk463UHcL+ZRnbRQkdmtsxi1MAIwz7VgyuDr4WOg4I2CeKF3TFvrN9gs6f2h7HR23nwWI32rVN5SBjdcO6CmLQD27udNoYKGiRSeXh7C5qmW4L6wgabDRet0aO8QMCX98cLobSLyyVrm+GCNo6obWff07X6NsDUhAWMvZ0x/JrJBfJBbPX/hhzR6fzrCYkalJAp/dekWExibtNLpdzQnv3ELHjQl8NV2dQbtn2YaAlNbXl27V6NrD1HVh0Yeyh89up8K/YILlbtN2/+UcRBnURUznD2WY/tWg6cQnJ4JWpouZSRPce3A1UnGHQM96xoh97Z5eSrFfgr32AVphI/XVjSoAXunGCCJyB4gKsO611OfC0d9n8KY8GHYJWHokBzI2vDqxbfIXUZmdnzsDOzyanNrzQKI3NyHzFeUsgqPBsqRrCed52guI0fXEYzuFnJtt3MnS0k1hFAzISsKIIukUHxU4zc/5c2idRg6HKcRI40mUAQp9LSbmDoPp3UPa+bEY12LPxOvMQyVNxIFTe0otR4oBtfAHdviNKo5ysW8IVsy/V0bPLVRvP3WCuavNNiT3KxOPuwXh8RJOmzvz4jXp8MrPAt23NaMFhr/qxUlA0qYqXMEWGV9AopW+B2+UENulVR8= Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id q1-20020aa7d441000000b00560f1a77a03si2492719edr.302.2024.02.11.23.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:48:00 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 D266987ED6; Mon, 12 Feb 2024 08:47:44 +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 487B087C80; Mon, 12 Feb 2024 08:47: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 C874987EC9 for ; Mon, 12 Feb 2024 08:47:41 +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 D4E22DA7; Sun, 11 Feb 2024 23:48:22 -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 127EC3F7BD; Sun, 11 Feb 2024 23:47: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 , Michal Simek , Jassi Brar , Sughosh Ganu Subject: [PATCH v2 02/21] fwu: metadata: migrate to version 2 of the structure Date: Mon, 12 Feb 2024 13:16:53 +0530 Message-Id: <20240212074712.3657076-3-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240212074712.3657076-1-sughosh.ganu@linaro.org> References: <20240212074712.3657076-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 latest version of the FWU specification [1] has changes to the metadata structure. This is version 2 of the structure. Primary changes include - bank_state field in the top level structure - Total metadata size in the top level structure - Image description structures now optional - Number of banks and images per bank values part of the structure Migrate to the version 2 of the metadata structure. [1] - https://developer.arm.com/documentation/den0118/latest/ Signed-off-by: Sughosh Ganu --- Changes since V1: * Do not define flexible array members inside the structures. include/fwu_mdata.h | 56 +++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/include/fwu_mdata.h b/include/fwu_mdata.h index 56189e2f40..9008bbc93f 100644 --- a/include/fwu_mdata.h +++ b/include/fwu_mdata.h @@ -11,7 +11,7 @@ /** * struct fwu_image_bank_info - firmware image information - * @image_uuid: Guid value of the image in this bank + * @image_guid: Guid value of the image in this bank * @accepted: Acceptance status of the image * @reserved: Reserved * @@ -20,15 +20,15 @@ * acceptance status */ struct fwu_image_bank_info { - efi_guid_t image_uuid; + efi_guid_t image_guid; uint32_t accepted; uint32_t reserved; } __packed; /** * struct fwu_image_entry - information for a particular type of image - * @image_type_uuid: Guid value for identifying the image type - * @location_uuid: Guid of the storage volume where the image is located + * @image_type_guid: Guid value for identifying the image type + * @location_guid: Guid of the storage volume where the image is located * @img_bank_info: Array containing properties of images * * This structure contains information on various types of updatable @@ -36,9 +36,30 @@ struct fwu_image_bank_info { * information per bank. */ struct fwu_image_entry { - efi_guid_t image_type_uuid; - efi_guid_t location_uuid; - struct fwu_image_bank_info img_bank_info[CONFIG_FWU_NUM_BANKS]; + efi_guid_t image_type_guid; + efi_guid_t location_guid; + // struct fwu_image_bank_info img_bank_info[]; +} __packed; + +/** + * struct fwu_fw_desc_store - FWU updatable image information + * @num_banks: Number of firmware banks + * num_images: Number of images per bank + * @img_entry_size: The size of the img_entry array + * @bank_info_entry_size: The size of the img_bank_info array + * @img_entry: Array of image entries each giving information on a image + * + * This image descriptor structure contains information on the number of + * updatable banks and images per bank. It also gives the total sizes of + * the fwu_image_entry and fwu_image_bank_info arrays. + */ +struct fwu_fw_store_desc { + uint8_t num_banks; + uint8_t reserved; + uint16_t num_images; + uint16_t img_entry_size; + uint16_t bank_info_entry_size; + // struct fwu_image_entry img_entry[]; } __packed; /** @@ -48,21 +69,28 @@ struct fwu_image_entry { * @active_index: Index of the bank currently used for booting images * @previous_active_inde: Index of the bank used before the current bank * being used for booting - * @img_entry: Array of information on various firmware images that can - * be updated + * @metadata_size: Size of the entire metadata structure, including the + * image descriptors + * @desc_offset: The offset from the start of this structure where the + * image descriptor structure starts. 0 if absent + * @bank_state: State of each bank, valid, invalid or accepted + * @fw_desc: The structure describing the FWU updatable images * - * This structure is used to store all the needed information for performing + * This is the top level structure used to store all information for performing * multi bank updates on the platform. This contains info on the bank being - * used to boot along with the information needed for identification of - * individual images + * used to boot along with the information on state of individual banks. */ struct fwu_mdata { uint32_t crc32; uint32_t version; uint32_t active_index; uint32_t previous_active_index; - - struct fwu_image_entry img_entry[CONFIG_FWU_NUM_IMAGES_PER_BANK]; + uint32_t metadata_size; + uint16_t desc_offset; + uint16_t reserved1; + uint8_t bank_state[4]; + uint32_t reserved2; + // struct fwu_fw_store_desc fw_desc[]; } __packed; #endif /* _FWU_MDATA_H_ */