From patchwork Mon Jan 22 11:54:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 764620 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1058893wrx; Mon, 22 Jan 2024 03:55:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEe1H2BeYcX/gkC4h4GLtjtC1NtUiKn7yq3zyhSblxDkRZi7HnlJDpYJzB/Rw1DGz0vXp4H X-Received: by 2002:a05:600c:35d3:b0:40e:8fe8:a173 with SMTP id r19-20020a05600c35d300b0040e8fe8a173mr2098536wmq.4.1705924535978; Mon, 22 Jan 2024 03:55:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705924535; cv=none; d=google.com; s=arc-20160816; b=XQ/0qyZhQ/Q5xw7JP2zyvNEGKOEWfojT7mFTRQiiQnB2+a8dpkyqKS19whaQYQnfxY GckLux0Ci/FlYvUwcFWlVZGqTe5nEfXaCafXe+WzsPiVMoYjuerUI0KzoRX7xt2pOijC SRtu66mgn5hbTBTUnhEP7/7ZepY2Q2Va3hrgFn1hNsbMCwv35QaxD5y+sJuh/nHrIeax 3goNlP2pIjXz8XpqF3HKug/NtjtMdUiQn8PoKTM3Q23/tLuVcRwsamI6dTdL2SXgFY8V sm/fyKHeXDncf9ZMzPs+412M2vOOF3p+Rf9oEFpKuCQl0DjAgVv/fpjECO2mAlpxXzkq AUew== 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=nDfnerEW0lOgyEcxPLshS5AQ8mtXwcICEin69qjbtng=; fh=rhmJ78R78zNUSUA9Nt0a5TbZO4CVsI4vi5GcqSIe+nI=; b=VaTX/3sQS1rCqKxz4MK8MzUYE85cDTt+6XqslR1zyRpj8iZhvSAcM4o7m0IFboAbRh Ao7YFyflh6MV3mEayi6+r2q4fV56OX+1Z5Hh1W5Q0dQY+u1RbxM5TX3ODEC5tFWial82 XVhcHPFf956o/XpKnY/DtmVMlKZGbaQyl0NaXgRcYAkOfn90lmsh5KyLLMLmRoF7EVGG zmCNHJCyYyWT5ZCHSkuhCWxARgMMFPKtCNOqaYvRszu9LTHZDjNUsKeY03YyF6BWUuMe pncv5CZanxl9m7t3F++ZRfOAeysZlIaoGkpM7hVpsmwJzJJ4USgdLeUEIbOdnWVPRtGN 4vUA== 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-20020adfe885000000b0033936219a34si1162987wrm.570.2024.01.22.03.55.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 03:55:35 -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 9A64C879FC; Mon, 22 Jan 2024 12:55:21 +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 F1F85879FC; Mon, 22 Jan 2024 12:55:20 +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 8B89587950 for ; Mon, 22 Jan 2024 12:55:18 +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 16C141FB; Mon, 22 Jan 2024 03:56:04 -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 65D923F73F; Mon, 22 Jan 2024 03:55:15 -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 02/18] fwu: metadata: Migrate to version 2 of the structure Date: Mon, 22 Jan 2024 17:24:23 +0530 Message-Id: <20240122115439.653871-3-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 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 --- 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..050ee969e3 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_ */