From patchwork Mon Feb 12 07:46:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772023 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000242wre; Sun, 11 Feb 2024 23:47:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHX6mHnVlH6HgnoShLwmkO5JIpGFCV3yz96cs+tcNCHUmTynXppANwYgbFYQbQ257vrh3zE X-Received: by 2002:a17:906:cb88:b0:a35:88ad:e607 with SMTP id mf8-20020a170906cb8800b00a3588ade607mr4843590ejb.31.1707724069918; Sun, 11 Feb 2024 23:47:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724069; cv=none; d=google.com; s=arc-20160816; b=OHqdigjfmkmlE25haNmKssi06tlbr/yIZVyGDLopVJZ7/1e9H24B5P7LyFjLG5C3yL hbYcZKBdwIGTwje1jh9IAQejZmDUhMlDSXHaaNUEmNmnurMOJHYUupZDfyU9lyQ0Avjw ETCZ7LyAqzSzGaGcuH4oLlnl97Q9AFJ5c9CCGcOpjRkU+8U6Sm5S6HUyETpCYkCmzSA3 m3ZviF0ZO9lR9uKCpqnN4wgpCaWwthsCoSGiisZ+53iW5CPQrDCQpXge31DtTB95YQ/z fifiu/IRW4Inm9f7HfBTY3UDiy/xB1XTiSjaJqdX4xEmLkN6D1CDA4e0IP9hGJj+uaPW zCbg== 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=2pbKPGrAjrYFtC/9ms7SiaPSI6v/RQX1lFcI+MfpvaY=; fh=u0PoRnfleOuKcnKzxY0p9WM1+/uPvIRdF+yxPsVz3n0=; b=YZL3xtrQluKSpfhnqkOMgKNarffZG5HbJMZJ2NQm77DHzEHwk2qVQDCL8Bx7pc9ljB jS8ysHKLbEVJf+pgf/N9WuDw30bEP8m+9iXAWq4G2u83jSHpRfxbCMD1BAyJOzG51SHy O4HZ0kRcETal7LsJir8ITGKqUczFNVpWcpEN/ArwPy22bjid+o+a6XC+wjDq0A+zlZjW U5+V0EBo0IoVU5HhI795mgEvXYG97MaQmBn4rg+pqrp/7PDvpiEduB431mpHIfvh6fuk eJLGswFeAreI4sxMKjsO7dXLFAEMT0wLZ6iIKxuj7xBjDK3sfy69VZuG075+pW/1MeN3 qYEw==; darn=linaro.org 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 X-Forwarded-Encrypted: i=1; AJvYcCXsYsDd/yY8Ks+PGKIwihb+aBJfW9xEuB0NdVEp9X8Vo54gLz2vEpnhp9l5VAe8akpw2A8AqTWqhJLbu/4y6sftIyj0Ju1KMVf5oBEKN2R/ifka9agbH4u4EdBjZ+VOxy7Ck5yNRSc/8fJp9F90zUHvgjL/DGlv6QKQAgnTNPWW7Kewnkc8Y8qzUSYENHF8xT4Ca1fFvW6FqN9y3I3k9BNNVqz/+wr118tAUQVDfIzOVAInCB1gOIesNOnzEq1IyRNTMCghZnluNRv8yq6oNtpLVZivuXdBo4slLdU8j3mxCbpleyW1vBm2xpU7KE+tGXnP3A0lBK9BZ3BFm9hTD6a4BsC05XsnFPiP/sr/L9jaLPPRlDARlYfPyx5pL8r4rDloX9FVVSJfISb6KYeWk5HO7+Qm5BYeYaBkrePbXXxgNRrdnw21FygtevQHCDjeakpyfLtwLfY3ERYHltyfHh0pDg61mdw1YanhzdMxVzjBOzxJbpk7sCmLFeFrPkmyJfOwtepfB7l6lZ6G2vIB2ydOiV7GZEgAS4OjLgAYP74yWSGMuGRIibCRVW3+gbkEXKNpZSu553koKN1d5z6WNh+bwuKROR0YlVEVfm60bmj9FF6Oeg4AImh4hxRMNRysaZrhCiCKdYosuuXq+0K39RCMq9ITVsgkB8tsX2b9GPyrYedKLjYkqx8XVYv97SvchSLQLsb0VoD5bn+SgGZ8OQRWAzqb5b8G72sONd2m3aMQrNwSEviu7eNMulO3pY8gGsOiZlU8N9AndGlX6OD8XDFAwKdQnWl7ICEWBfOJ1vbHmMN4J/8W4+Lgpk+iq90vwPRhX7Xs1n1Jfon0yOyBuo/m9dzp35Yp9caXT2OXEaf6dF0= Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id y15-20020a170906470f00b00a372761f7ccsi3590165ejq.760.2024.02.11.23.47.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:47:49 -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 60CB687E52; 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=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 03ECB87EC4; Mon, 12 Feb 2024 08:47:40 +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 104D287C80 for ; Mon, 12 Feb 2024 08:47:38 +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 1C16BDA7; Sun, 11 Feb 2024 23:48:19 -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 4F9193F7BD; Sun, 11 Feb 2024 23:47:34 -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 01/21] configs: fwu: remove FWU configs for metadata V2 migration Date: Mon, 12 Feb 2024 13:16:52 +0530 Message-Id: <20240212074712.3657076-2-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 FWU metadata is to be migrated to version 2. Disable the FWU feature on platforms that enable it for the migration. Signed-off-by: Sughosh Ganu Reviewed-by: Ilias Apalodimas --- Changes since V1: None configs/corstone1000_defconfig | 2 -- configs/sandbox64_defconfig | 1 - configs/synquacer_developerbox_defconfig | 4 ---- 3 files changed, 7 deletions(-) diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig index a86ac12732..c26a621175 100644 --- a/configs/corstone1000_defconfig +++ b/configs/corstone1000_defconfig @@ -25,7 +25,6 @@ CONFIG_BOARD_LATE_INIT=y CONFIG_SYS_PROMPT="corstone1000# " CONFIG_SYS_MAXARGS=64 # CONFIG_CMD_CONSOLE is not set -CONFIG_CMD_FWU_METADATA=y CONFIG_CMD_BOOTZ=y # CONFIG_CMD_XIMG is not set CONFIG_CMD_GPT=y @@ -68,4 +67,3 @@ CONFIG_FFA_SHARED_MM_BUF_OFFSET=0 CONFIG_FFA_SHARED_MM_BUF_ADDR=0x02000000 CONFIG_EFI_CAPSULE_ON_DISK=y CONFIG_EFI_IGNORE_OSINDICATIONS=y -CONFIG_FWU_MULTI_BANK_UPDATE=y diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index d101cca6a7..2863f9b189 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -273,7 +273,6 @@ CONFIG_EFI_CAPSULE_ON_DISK=y CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y CONFIG_EFI_SECURE_BOOT=y CONFIG_TEST_FDTDEC=y -CONFIG_FWU_MULTI_BANK_UPDATE=y CONFIG_UNIT_TEST=y CONFIG_UT_TIME=y CONFIG_UT_DM=y diff --git a/configs/synquacer_developerbox_defconfig b/configs/synquacer_developerbox_defconfig index 2a0407de40..616d410074 100644 --- a/configs/synquacer_developerbox_defconfig +++ b/configs/synquacer_developerbox_defconfig @@ -11,14 +11,12 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="synquacer-sc2a11-developerbox" CONFIG_SYS_LOAD_ADDR=0x80000000 CONFIG_TARGET_DEVELOPERBOX=y -CONFIG_FWU_NUM_IMAGES_PER_BANK=1 CONFIG_AHCI=y CONFIG_FIT=y CONFIG_SYS_BOOTM_LEN=0x800000 CONFIG_BOOTSTAGE_STASH_SIZE=4096 CONFIG_HUSH_PARSER=y CONFIG_SYS_MAXARGS=128 -CONFIG_CMD_FWU_METADATA=y CONFIG_CMD_IMLS=y CONFIG_CMD_ERASEENV=y CONFIG_CMD_NVEDIT_EFI=y @@ -53,7 +51,6 @@ CONFIG_DFU_TFTP=y CONFIG_DFU_MTD=y CONFIG_DFU_RAM=y CONFIG_DFU_SF=y -CONFIG_FWU_MDATA_MTD=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_SYNQUACER=y CONFIG_MMC_SDHCI=y @@ -96,4 +93,3 @@ CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y CONFIG_EFI_CAPSULE_ON_DISK=y CONFIG_EFI_IGNORE_OSINDICATIONS=y CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y -CONFIG_FWU_MULTI_BANK_UPDATE=y 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_ */ From patchwork Mon Feb 12 07:46:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772025 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000358wre; Sun, 11 Feb 2024 23:48:10 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU3574Zv4zu/dLFbVcUQGNtxvXHSY/Q8ce5TuzE1mbE3XiWUJlUATj+jkFCQU4VIPJVb7ljztB87By062szIT1c X-Google-Smtp-Source: AGHT+IEWz/VgfLtLqOnJD6z83QFz346TXMy3AD0+zufOZzS9legk60yFB9X/1W2Zg5ELQuE8fjTM X-Received: by 2002:aa7:d6ca:0:b0:560:de8e:692b with SMTP id x10-20020aa7d6ca000000b00560de8e692bmr4159636edr.39.1707724090692; Sun, 11 Feb 2024 23:48:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724090; cv=none; d=google.com; s=arc-20160816; b=ei4NjipQjBX68VHf8eUGu/W03Rg6O103kx6V294hIV9SEosh4VN3QeL+zndin+ZO3U 4KsBYB0AhPT3F+AQakyM5xK+tlUKyM6o+HpknfJA4rtzATeBHepSwCaqZUMzVHFRi3eg +i+YsEolccHnMNo/d4CuavKoK1kOgwZ565c3m7DXsA5Q9O4J3w0OJ0VwVSGEudBw41fn zDwvvXCHZd+ffJxRfRwTN2EOvGGMjmDyrIbnd7eHYQgSqGdZ0wO6ZLy9ag/jsYhC1I6G vzYUONU1gV/URPO5B+rWv+VJTGAvb5o83dxGcoGeywgGZhvAJbaFGnEAS8TgGX/33nju WKXA== 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=CGTruMi4RP0gNToyrmuPBwAND2B34oGkKc/X5wNNNE0=; fh=3a0Zn0ejEV6XKe1AoutG8vd8GMi04OWWSU8fyyoFnKA=; b=vvzsD8JDyYMFvT/ygKYrLQ+A7xkAHbPxyfZuYmzyG/FgqCVPKpYGnq38/vJGICJxqv QQCfZ28EuyeVKDWcQ3S4f7XD7t1wm3iFxat9ixBNunnrId5M2qaXbfR+dnmvQ8e3L5/U yvgr4Uo9r00F8DsyDAu3ezzcBg65Z39xBLL7H19N9oP6BY9vuFscBZTDvT6wxVrHzkfz hj51w6HXU4WkKX/qrquMAMfKiHd3BF60ja7c/kL+YOTVCuPDVLRvS6kDOfLhlDkvp9sd kO/T4m4+uIMSxXBJ9v1VvQey+3kBWVocBqoDEmUetDzyiKB37CjuyvJCuT8ZC8vRXD+R 8hzg==; darn=linaro.org 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 X-Forwarded-Encrypted: i=1; AJvYcCW7Qs3R8PPOrZCDl1XolxGyHhNvhFP9oWudHfKHIfHDkQeQjm9z5rhnRtNO0De2dqDPO3CS0ZZDumqACfhFks0593DrCU7p/4YciEAdGAf7qb+BSgGMCBFvV0Zfe8JZ+0Cyo/WC1nMj2sGjH3dqD4QhcfG/er0lTgb356B6miDvfGyze0RXoLtBh8HGlX9lhqgxe5lbE6i/IA9PvVb4opBQjhidBCWfQf8f6DbfBvt913rvKhqy/xPOLfiolLK4ocW/vJp1TFEuRf4NSji376WD/5Ri39D7E0mqYyJjBkzGb05hLnwCpMAio7p+MXW3nucYIlK8ELk01i2tc3hesWJf34TAXl3CaP1OORQrToYjSYC5O2oOwLX6XwEL6RULoSwB0gIoMpw88el+UASDhQIpl72SLuxxaiB9JCYmYXjRe/GH4LyNg3YPTH5HUISMPB4EKvZv15ll/k2obu93lWmpEd3sE1FFd3aJvnrw1cBCb8vuvuG0P9vs+y/+XpbPmDQbfsi+7oD8N+FCnOSVhpA/i88Tqmu17ts9fH2at4P99CSZHHoUeho1yByj3Dz/thP1QQZ6mQ263G3DO2KdIbt86frORLKIOXSnzKMgdddzUJ431cIyhB4Ji7ZmSaO36ezzo8y7//S3RsX1M52cFP/5CkQMFmPbHlNG+RI55W2/SXR4t1AvltTaOvy0ZrSOFp97DuWjkjjHrWkEB9vQHmiLsQ4DGipMQ+puR3iR3rw2xwWMy/DOnKzu+P6H4GQESOx/lmmzZ5HpZnME/H3Oy6eAzf6ip8mqOYqTiXlHFdF2xDX67NqXj+FQwrdr9dnyDYfLLKIs8Kc/132ZvdiV8GTy6khFKDLJbInFkK3DZIgk5Gk= Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id dg19-20020a0564021d1300b0055fce5a5981si2595028edb.471.2024.02.11.23.48.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:48:10 -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 2052487ECA; Mon, 12 Feb 2024 08:47:50 +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 C102987C80; Mon, 12 Feb 2024 08:47:47 +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 8A08287ECC for ; Mon, 12 Feb 2024 08:47:45 +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 96800DA7; Sun, 11 Feb 2024 23:48: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 C97473F7CE; Sun, 11 Feb 2024 23:47:41 -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 03/21] drivers: fwu: add the size parameter to the metadata access API's Date: Mon, 12 Feb 2024 13:16:54 +0530 Message-Id: <20240212074712.3657076-4-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 In version 2 of the metadata structure, the size of the structure cannot be determined statically at build time. The structure is now broken into the top level structure which contains a field indicating the total size of the structure. Add a size parameter to the metadata access API functions to indicate the number of bytes to be accessed. This is then used to either read the entire structure, or only the top level structure. Signed-off-by: Sughosh Ganu --- Changes since V1: None drivers/fwu-mdata/fwu-mdata-uclass.c | 10 ++++++---- drivers/fwu-mdata/gpt_blk.c | 23 +++++++++++++---------- drivers/fwu-mdata/raw_mtd.c | 10 ++++++---- include/fwu.h | 14 ++++++++++---- 4 files changed, 35 insertions(+), 22 deletions(-) diff --git a/drivers/fwu-mdata/fwu-mdata-uclass.c b/drivers/fwu-mdata/fwu-mdata-uclass.c index 0a8edaaa41..145479bab0 100644 --- a/drivers/fwu-mdata/fwu-mdata-uclass.c +++ b/drivers/fwu-mdata/fwu-mdata-uclass.c @@ -20,7 +20,8 @@ * * Return: 0 if OK, -ve on error */ -int fwu_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary) +int fwu_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary, + uint32_t size) { const struct fwu_mdata_ops *ops = device_get_ops(dev); @@ -29,7 +30,7 @@ int fwu_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary) return -ENOSYS; } - return ops->read_mdata(dev, mdata, primary); + return ops->read_mdata(dev, mdata, primary, size); } /** @@ -37,7 +38,8 @@ int fwu_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary) * * Return: 0 if OK, -ve on error */ -int fwu_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary) +int fwu_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary, + uint32_t size) { const struct fwu_mdata_ops *ops = device_get_ops(dev); @@ -46,7 +48,7 @@ int fwu_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary) return -ENOSYS; } - return ops->write_mdata(dev, mdata, primary); + return ops->write_mdata(dev, mdata, primary, size); } UCLASS_DRIVER(fwu_mdata) = { diff --git a/drivers/fwu-mdata/gpt_blk.c b/drivers/fwu-mdata/gpt_blk.c index c7284916c4..97eac3611f 100644 --- a/drivers/fwu-mdata/gpt_blk.c +++ b/drivers/fwu-mdata/gpt_blk.c @@ -81,15 +81,14 @@ static int gpt_get_mdata_disk_part(struct blk_desc *desc, return -ENOENT; } -static int gpt_read_write_mdata(struct blk_desc *desc, - struct fwu_mdata *mdata, - u8 access, u32 part_num) +static int gpt_read_write_mdata(struct blk_desc *desc, struct fwu_mdata *mdata, + u8 access, u32 part_num, u32 size) { int ret; u32 len, blk_start, blkcnt; struct disk_partition info; - ALLOC_CACHE_ALIGN_BUFFER_PAD(struct fwu_mdata, mdata_aligned, 1, + ALLOC_CACHE_ALIGN_BUFFER_PAD(u8, mdata_aligned, size, desc->blksz); if (!mdata) @@ -101,7 +100,7 @@ static int gpt_read_write_mdata(struct blk_desc *desc, return -ENOENT; } - len = sizeof(*mdata); + len = size; blkcnt = BLOCK_CNT(len, desc); if (blkcnt > info.size) { log_debug("Block count exceeds FWU metadata partition size\n"); @@ -114,7 +113,7 @@ static int gpt_read_write_mdata(struct blk_desc *desc, log_debug("Error reading FWU metadata from the device\n"); return -EIO; } - memcpy(mdata, mdata_aligned, sizeof(struct fwu_mdata)); + memcpy(mdata, mdata_aligned, size); } else { if (blk_dwrite(desc, blk_start, blkcnt, mdata) != blkcnt) { log_debug("Error writing FWU metadata to the device\n"); @@ -164,7 +163,7 @@ static int fwu_mdata_gpt_blk_probe(struct udevice *dev) } static int fwu_gpt_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, - bool primary) + bool primary, u32 size) { struct fwu_mdata_gpt_blk_priv *priv = dev_get_priv(dev); struct blk_desc *desc = dev_get_uclass_plat(priv->blk_dev); @@ -177,11 +176,13 @@ static int fwu_gpt_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, } return gpt_read_write_mdata(desc, mdata, MDATA_READ, - primary ? g_mdata_part[0] : g_mdata_part[1]); + primary ? + g_mdata_part[0] : g_mdata_part[1], + size); } static int fwu_gpt_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, - bool primary) + bool primary, u32 size) { struct fwu_mdata_gpt_blk_priv *priv = dev_get_priv(dev); struct blk_desc *desc = dev_get_uclass_plat(priv->blk_dev); @@ -194,7 +195,9 @@ static int fwu_gpt_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, } return gpt_read_write_mdata(desc, mdata, MDATA_WRITE, - primary ? g_mdata_part[0] : g_mdata_part[1]); + primary ? + g_mdata_part[0] : g_mdata_part[1], + size); } static const struct fwu_mdata_ops fwu_gpt_blk_ops = { diff --git a/drivers/fwu-mdata/raw_mtd.c b/drivers/fwu-mdata/raw_mtd.c index 17e4517973..9f3f1dc213 100644 --- a/drivers/fwu-mdata/raw_mtd.c +++ b/drivers/fwu-mdata/raw_mtd.c @@ -97,22 +97,24 @@ lock: return ret; } -static int fwu_mtd_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary) +static int fwu_mtd_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, + bool primary, u32 size) { struct fwu_mdata_mtd_priv *mtd_priv = dev_get_priv(dev); struct mtd_info *mtd = mtd_priv->mtd; u32 offs = primary ? mtd_priv->pri_offset : mtd_priv->sec_offset; - return mtd_io_data(mtd, offs, sizeof(struct fwu_mdata), mdata, FWU_MTD_READ); + return mtd_io_data(mtd, offs, size, mdata, FWU_MTD_READ); } -static int fwu_mtd_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary) +static int fwu_mtd_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, + bool primary, u32 size) { struct fwu_mdata_mtd_priv *mtd_priv = dev_get_priv(dev); struct mtd_info *mtd = mtd_priv->mtd; u32 offs = primary ? mtd_priv->pri_offset : mtd_priv->sec_offset; - return mtd_io_data(mtd, offs, sizeof(struct fwu_mdata), mdata, FWU_MTD_WRITE); + return mtd_io_data(mtd, offs, size, mdata, FWU_MTD_WRITE); } static int flash_partition_offset(struct udevice *dev, const char *part_name, fdt_addr_t *offset) diff --git a/include/fwu.h b/include/fwu.h index eb5638f4f3..1815bd0064 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -32,20 +32,24 @@ struct fwu_mdata_ops { * @dev: FWU metadata device * @mdata: Output FWU mdata read * @primary: If primary or secondary copy of metadata is to be read + * @size: Size in bytes of the metadata to be read * * Return: 0 if OK, -ve on error */ - int (*read_mdata)(struct udevice *dev, struct fwu_mdata *mdata, bool primary); + int (*read_mdata)(struct udevice *dev, struct fwu_mdata *mdata, + bool primary, uint32_t size); /** * write_mdata() - Write the given FWU metadata copy * @dev: FWU metadata device * @mdata: Copy of the FWU metadata to write * @primary: If primary or secondary copy of metadata is to be written + * @size: Size in bytes of the metadata to be written * * Return: 0 if OK, -ve on error */ - int (*write_mdata)(struct udevice *dev, struct fwu_mdata *mdata, bool primary); + int (*write_mdata)(struct udevice *dev, struct fwu_mdata *mdata, + bool primary, uint32_t size); }; #define FWU_MDATA_VERSION 0x1 @@ -80,12 +84,14 @@ struct fwu_mdata_ops { /** * fwu_read_mdata() - Wrapper around fwu_mdata_ops.read_mdata() */ -int fwu_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary); +int fwu_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, + bool primary, uint32_t size); /** * fwu_write_mdata() - Wrapper around fwu_mdata_ops.write_mdata() */ -int fwu_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary); +int fwu_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, + bool primary, uint32_t size); /** * fwu_get_mdata() - Read, verify and return the FWU metadata From patchwork Mon Feb 12 07:46:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772026 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000402wre; Sun, 11 Feb 2024 23:48:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IF1QHOJQOtojyFiU1NP2zDeYXC8hxoYgIHXClWianGZnWrhD5wvloTuTc+7RWvrjmaXD8P7 X-Received: by 2002:a17:906:aacc:b0:a3c:bad6:7685 with SMTP id kt12-20020a170906aacc00b00a3cbad67685mr638227ejb.46.1707724102023; Sun, 11 Feb 2024 23:48:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724102; cv=none; d=google.com; s=arc-20160816; b=RfS4KLxt7du4xOXeZKs61xfT9DZunRM0Oek6hp94JullBuuLr4zzVnvvLgQCHM+9Qd inq/vWpYz5mgcngJee1GubRR/4Q5fvcj85PmhH9Cd7s5HasfgdybHlGUepS/kzHC4eJp 0emYjallRuTMjfq5ZFaFRuGLS9mQ/0guVKiLNWyFMfMzNmJijKAZSZsdEQ22qBD6+TfA u/m5CY8/hdpW8xzuBIEYhKDXBwyLRYK5rvW8ykVZiXW3VQeoFXdLf2I6i9d9rMtxJJj7 SOUeu1skcPk7GPYiOrFNxAS9ZaRFPpPEy8tc9Cw9zEt2+8e5z3M0wohY9IoFrs2qe1wl AHZg== 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=mE9xITILK9rBql73I6O28FWnkhFNfNP8v+TXOTy789w=; fh=/6NQxHDn1PUPHDnUUo7f2dw9hTxjrHBua5wYRDWdiIg=; b=q5tEBoU33zNl/O7BqoAtmqTremU7ffFVi9zMjkXhKD/b9hJl0w/5O/KjClfSs7JtOu Z958Ih8s8QMxWRZPadBzJa0qQFLb2bZQrUaWmVUbhW2uAxmNQz3hL4vbDLzXXY1Q1LzZ RnfzFmLO/4bkGeRRt6UCCChZoNS+b9n3cBPvqJeotxPX0WZz6kbP3Jpx13MjtwxQXvQJ sk5+Uk5QSlQkkQLsaEhI/YrIPtSGoVDmp4WSu8Q3TNKLGgob+oNdXS34buupUMEFalpZ z++0VaXLiILxpmvV9QIQZgZS5GUCxNpS31gVTGROoD9pGyIj/ku7Zv2SRYrZqb1xDxkb fuHA==; darn=linaro.org 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 X-Forwarded-Encrypted: i=1; AJvYcCUIm3EhbnQAZA1Vx1Iv8NR7YhQ4MVfh9y0PaMGWvTU5XeK5mVsmDaeseLnZFcQQPQsNh6k9+856zNJbVCkJq35vbjez14arNJyPXsTgtVYUNtlLuyAifp4t+7D0UPu/bWeREfSOsgvmBOaJOPsbuBnY3kNXtWu82eG/kvp228guigNmyu+R3tLt1191IrN6Vic119bBzwUlxHGLY7x39FDgWUX4MjcAbyIukW6hiWbhyW3dDQH+rfG8J2HrWuqdDeagzFBAXgxQty435ommlwDyCJPFmlQHrzYr4OpBDpUsTpy9sN2TRewenvH1M4CxvDMcFU+3ze4cUGuxhQQWeDQQdnA8Tvw9dgZkQrW9PV1agaNNCuk1abIOnKUDfNV8dF7W5rGPBctKNx/iUyy/MNyjF2rgF3KxzJ2sIELH0ja7PtP3v98gJECwmhLZ3q1HWnqvMNDIfgtYW9G2tQol1AFoWPL3Titk1dc8T8q1/ApJ3J/46UM2r6SO2A6g/snqshQ1EWtUV/4POZXTXqDdvJXDs7S6EN95PAHsnUX0mZ7U6jjupjTsC3qg6KAM1wrBHyRN35jLb6PzHhVPpBWQ8JkVCTenjJBXrhNBh/x+SUpOHhPtSFuVL7wfKMFH+vJBxh5mnrQ/aII4pLGR84SLkluVbMcJb0EHCChdpziPU6Vx/QE4TgQjTUXjs2nWlGr+nYf6hY9PPtrEV6k8WrtboNhMSelD/UE47PK30po2wtXUKtpY6lAmO5tITIQJYRoEQnbHCX94B6dIz4V6irn7qIapkHaXhf9eENJfNWmAdqNJxlPkUeNc8zs9AfLwRGsfdvFG2JmR9naM1AuwrfTrQN222uZy6h+UrQTAZgmsREgz2wk= Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a13-20020a1709066d4d00b00a3612401eb0si3622164ejt.484.2024.02.11.23.48.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:48:22 -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 B656887ECC; Mon, 12 Feb 2024 08:47:52 +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 EDB1987ED1; Mon, 12 Feb 2024 08:47:51 +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 4D96787C80 for ; Mon, 12 Feb 2024 08:47:49 +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 58CCEDA7; Sun, 11 Feb 2024 23:48:30 -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 8C9643F7BD; Sun, 11 Feb 2024 23:47:45 -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 04/21] fwu: add helper functions for getting image description offsets Date: Mon, 12 Feb 2024 13:16:55 +0530 Message-Id: <20240212074712.3657076-5-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 With migration of the FWU metadata structure to version 2, the size of the structure is not determined at build time, but at run time. This means, that the offsets for the structures describing firmware images which are part of the FWU metadata(struct fwu_fw_store_desc, struct fwu_image_entry and struct fwu_image_bank_info) need to be computed at runtime. Add helper functions to get addresses of these structures. Signed-off-by: Sughosh Ganu --- Changes since V1: * New patch needed based on comments from Ilias on the earlier version. include/fwu.h | 45 +++++++++++++++++++++++++++++++++ lib/fwu_updates/fwu.c | 58 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) diff --git a/include/fwu.h b/include/fwu.h index 1815bd0064..7de462548c 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -81,6 +82,50 @@ struct fwu_mdata_ops { EFI_GUID(0x0c996046, 0xbcc0, 0x4d04, 0x85, 0xec, \ 0xe1, 0xfc, 0xed, 0xf1, 0xc6, 0xf8) + +/** + * fwu_get_fw_desc() - Return pointer to firmware descriptor store struct + * @mdata: Pointer to the FWU metadata + * + * Returns pointer to the firmware store descriptor of the FWU metadata + * containing information on updatable images. + * + * Return: Pointer to the struct fwu_fw_store_desc + */ +static inline struct fwu_fw_store_desc *fwu_get_fw_desc(struct fwu_mdata *mdata) +{ + return (struct fwu_fw_store_desc *)((u8 *)mdata + sizeof(*mdata)); +} + +/** + * fwu_img_entry_offset() - Get pointer to struct fwu_image_entry + * @mdata: Pointer to the FWU metadata + * @idx: Image index for which pointer is to be returned + * + * Fetches pointer to am array element of type struct fwu_image_entry. + * This returns back a pointer to a structure which is providing + * information on a updatable image. + * + * Return: Pointer to an array element of type struct fwu_image_entry + * + */ +struct fwu_image_entry *fwu_img_entry_offset(struct fwu_mdata *mdata, u16 idx); + +/** + * fwu_img_bank_info_offset() - Get pointer to struct fwu_image_bank_info + * @mdata: Pointer to the FWU metadata + * @idx: Image index for which information is needed + * @bank: Bank for which pointer is to be returned + * + * Fetches pointer to an array element of type struct fwu_image_bank_info + * for a given image. This returns back a pointer to a structure which + * is providing information for a given bank for a particular image. + * + * Return: Pointer to an array element of type fwu_image_bank_info + * + */ +struct fwu_image_bank_info *fwu_img_bank_info_offset(struct fwu_mdata *mdata, + u16 idx, u8 bank); /** * fwu_read_mdata() - Wrapper around fwu_mdata_ops.read_mdata() */ diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c index 86518108c2..5f1182a764 100644 --- a/lib/fwu_updates/fwu.c +++ b/lib/fwu_updates/fwu.c @@ -141,6 +141,64 @@ static int fwu_get_image_type_id(u8 image_index, efi_guid_t *image_type_id) return -ENOENT; } +/** + * fwu_img_entry_offset() - Get pointer to struct fwu_image_entry + * @mdata: Pointer to the FWU metadata + * @idx: Image index for which pointer is to be returned + * + * Fetches pointer to am array element of type struct fwu_image_entry. + * This returns back a pointer to a structure which is providing + * information on a updatable image. + * + * Return: Pointer to an array element of type struct fwu_image_entry + * + */ +struct fwu_image_entry *fwu_img_entry_offset(struct fwu_mdata *mdata, u16 idx) +{ + u8 num_banks; + size_t offset; + + num_banks = fwu_get_fw_desc(mdata)->num_banks; + + offset = sizeof(struct fwu_mdata) + + sizeof(struct fwu_fw_store_desc) + + (sizeof(struct fwu_image_entry) + + sizeof(struct fwu_image_bank_info) * num_banks) * idx; + + return (struct fwu_image_entry *)((char *)mdata + offset); +} + +/** + * fwu_img_bank_info_offset() - Get pointer to struct fwu_image_bank_info + * @mdata: Pointer to the FWU metadata + * @idx: Image index for which information is needed + * @bank: Bank for which pointer is to be returned + * + * Fetches pointer to an array element of type struct fwu_image_bank_info + * for a given image. This returns back a pointer to a structure which + * is providing information for a given bank for a particular image. + * + * Return: Pointer to an array element of type fwu_image_bank_info + * + */ +struct fwu_image_bank_info *fwu_img_bank_info_offset(struct fwu_mdata *mdata, + u16 idx, u8 bank) +{ + u8 num_banks; + size_t offset; + + num_banks = fwu_get_fw_desc(mdata)->num_banks; + + offset = sizeof(struct fwu_mdata) + + sizeof(struct fwu_fw_store_desc) + + (sizeof(struct fwu_image_entry) + + sizeof(struct fwu_image_bank_info) * num_banks) * idx + + sizeof(struct fwu_image_entry) + + sizeof(struct fwu_image_bank_info) * bank; + + return (struct fwu_image_bank_info *)((char *)mdata + offset); +} + /** * fwu_sync_mdata() - Update given meta-data partition(s) with the copy provided * @mdata: FWU metadata structure From patchwork Mon Feb 12 07:46:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772027 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000451wre; Sun, 11 Feb 2024 23:48:31 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUQTs6WC7hekjBE1A3l6J5fbv0yYEIC/+D0v2lPTIcUSFdLG6WrMG4o2JlB0Axb/ttWUUKQRnDzL6V74ScbXgw5 X-Google-Smtp-Source: AGHT+IEmK9HOq4tLMmQ+qpt7upUZv/aJCPKZdcRjZ89A+6vsvGo2fwx92kXDJsLoWnMqT1aevLDM X-Received: by 2002:aa7:d443:0:b0:560:c888:9cf4 with SMTP id q3-20020aa7d443000000b00560c8889cf4mr3807284edr.28.1707724111776; Sun, 11 Feb 2024 23:48:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724111; cv=none; d=google.com; s=arc-20160816; b=FqQTLdsal8ke2Q/E2bfq8Wbf7DKqzeANLnTAX6InVjDFqGC45rjiKRPHY4VPq9GTM4 mSj5C1IHUdUDBtoH4RebRT0DXn2PoEDnpMo5XdHyr8O8d2hOlNHxiQ6JSfgRVg3rfRPA nGy4U1qjgj5a9kRV5QEK9rsIWBHWPeAOILeUf0XB3tYxK3Z1OiHSXMV9pf8wpdWQ8Xvr qHLk4pzW+nySQ0lHWS5YcOrmG7ioQDNYCOaqxGuQr1p1tbA5+vkTXZcSU+w7Ux8Yj83S cZ4L7+gOaFgr13tAXGmrt0fFR3JehdpwQgjrN63hF0bm+hQgMuz838cqygjhb/HB3r71 J86Q== 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=qPkAv5cYWuj1TEQmpmjQTrj0XdeD6H2AcZkamghovBY=; fh=345ofqkAtdm7OuWdNOqkqY+9Ngum0rg6lgFTgbuyka4=; b=Im9j5N0so3oNASzlIblMnN2qjwr3JQGpmTfgkOAl1W+gHPG+0/nWL/awzs1mgIUsVs +BQ89O3sAaO0LoPDdEV5fyqEmhaQELirD8Q5RxaCGQWA1pYKeoGVO4O1Qm+3q6IXd4JP psxRlQPO1XaXdVn2t8QLV0H3Mr7TeMOW4y42+XAWhsal0NTr4QbXYMJYvHB6yGa3n5JT 3c7FvsHorOjb9nXSCrPcjIg6uOPis98dnMsGD+VLho+RCjAt07iBqGxw/1hth6bc1Gf7 kvgQzUwtkvZYKd2Fng1SvMoFw5yBUgi9g90G8eR6jH31PZIJ2nL2bVjWRHKW5YVfYRKF Vdxw==; darn=linaro.org 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 X-Forwarded-Encrypted: i=1; AJvYcCVUPnX+IvhZOu7FHZA6P+PkQ+TbRInWjG5NGvVCnBUwRpknZDUrC557KUKYGNLrIIDLEMTYoBxaZALJe53n2xOJSW1+lnnsuOFvk9fjvL7lUFwoD+XhG6C4lmVZoa9bn80XWDWNqnm2wdYbHnxJutAAjBUx968uLi2jcAQe308qmR/5Nh5EqgCIwqYyUM8895h5UzzAJ0YpqlvtobcIUYDzxncJKTcMkJrmpf5SlihrVPZUEsG3HBgZ6dDVXhoH1lzE+7CpEUQkrI4dF+thA1vnyu0hu4v9vVZe0uB3bjgdDB7PVXhGsCL3qry0MVi3lp1bdZV+ED9LrMzqkTXjxyxj5x5MUvuTZ7eeM1ZnmeT9pJZOy2LKEJaupt/qpRX/KchiBEHYCi5n6k8wN9l/Ep8/vjMXHbe2FCFYv/CT5XMAHolMqO5NLxQ5ojhxlhrgLbwI9P1pl3JaabgSB4mSQMppPQ7NEUMRo0bxRCy7plujsxkHUB0+IwDlJr9Tl3fQkBzqSaib7JU7/bFKrFMx8qEhTyaFbUyIp+Rl0J4KznNgaJOu6pTBDxI3xynp9+dN6QX4Vhdw82WKaOVrAspDWTzXIpopfvLHVEOkHAQ2dj6CUP1lnKUWgJDefjulL0uGaFi7yV3RDkuSi5Ls9GVnKuOXnjaAFwFdKkFAcTHH4Dv6+AcfpbuhGONovg8+rgdjaQGrKUjy2NBU4hhuI/f2zhs8ni/ZnH4hG58hascbon0a8UnyWj0LFeMwyxErzBcJel2lWefJ4z56Q/LvA1P2SEUZrVFKPFqLi0AeJ1zZ2fsrrya0ED56Y1MXU8EvuYTxNl0XU8018oznAu1lNyIAxj76blnaMHYeuXNCS5pSL1pSsPU= Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id b3-20020a509f03000000b00560c95157b8si2490700edf.56.2024.02.11.23.48.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:48:31 -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 55B0887ED1; Mon, 12 Feb 2024 08:47:57 +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 9E8D287EE3; Mon, 12 Feb 2024 08:47:55 +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 4C90087ED9 for ; Mon, 12 Feb 2024 08:47:53 +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 58152DA7; Sun, 11 Feb 2024 23:48:34 -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 4EEF13F7BD; Sun, 11 Feb 2024 23:47:49 -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 05/21] fwu: make changes to support version 2 of FWU metadata Date: Mon, 12 Feb 2024 13:16:56 +0530 Message-Id: <20240212074712.3657076-6-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 Make changes to the FWU library functions which are used to access the metadata structure to support version 2 of the metadata. At a broad level, the following are the changes made - Use a pointer g_mdata instead of a variable, and allocate space for it at runtime. - Obtain the number of banks and number of images per bank from the metadata at runtime, instead of using config values. - Obtain the pointers to the fwu_image_entry and fwu_image_bank_info structures at runtime by pointer arithmetic using the helper functions. - Get the size of the metadata from the metadata structure, instead of using build-time value. Signed-off-by: Sughosh Ganu --- Changes since V1: * Use the helper functions from the previous patch to access the image information in the metadata. include/fwu.h | 6 +- lib/fwu_updates/fwu.c | 145 +++++++++++++++++++++++++++--------------- 2 files changed, 98 insertions(+), 53 deletions(-) diff --git a/include/fwu.h b/include/fwu.h index 7de462548c..8f2492bb7e 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -53,9 +53,13 @@ struct fwu_mdata_ops { bool primary, uint32_t size); }; -#define FWU_MDATA_VERSION 0x1 +#define FWU_MDATA_VERSION 0x2 #define FWU_IMAGE_ACCEPTED 0x1 +#define FWU_BANK_INVALID 0xFF +#define FWU_BANK_VALID 0xFE +#define FWU_BANK_ACCEPTED 0xFC + /* * GUID value defined in the FWU specification for identification * of the FWU metadata partition. diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c index 5f1182a764..2da19c9003 100644 --- a/lib/fwu_updates/fwu.c +++ b/lib/fwu_updates/fwu.c @@ -17,7 +17,7 @@ #include -static struct fwu_mdata g_mdata; /* = {0} makes uninit crc32 always invalid */ +static struct fwu_mdata *g_mdata; static struct udevice *g_dev; static u8 in_trial; static u8 boottime_check; @@ -108,21 +108,9 @@ out: static int in_trial_state(struct fwu_mdata *mdata) { - u32 i, active_bank; - struct fwu_image_entry *img_entry; - struct fwu_image_bank_info *img_bank_info; - - active_bank = mdata->active_index; - img_entry = &mdata->img_entry[0]; - for (i = 0; i < CONFIG_FWU_NUM_IMAGES_PER_BANK; i++) { - img_bank_info = &img_entry[i].img_bank_info[active_bank]; - if (!img_bank_info->accepted) { - log_info("System booting in Trial State\n"); - return 1; - } - } + u32 active_bank = mdata->active_index; - return 0; + return mdata->bank_state[active_bank] == FWU_BANK_VALID ? 1 : 0; } static int fwu_get_image_type_id(u8 image_index, efi_guid_t *image_type_id) @@ -208,8 +196,9 @@ struct fwu_image_bank_info *fwu_img_bank_info_offset(struct fwu_mdata *mdata, */ static int fwu_sync_mdata(struct fwu_mdata *mdata, int part) { - void *buf = &mdata->version; int err; + uint32_t mdata_size; + void *buf = &mdata->version; if (part == BOTH_PARTS) { err = fwu_sync_mdata(mdata, SECONDARY_PART); @@ -223,9 +212,10 @@ static int fwu_sync_mdata(struct fwu_mdata *mdata, int part) * and put the updated value in the FWU metadata crc32 * field */ - mdata->crc32 = crc32(0, buf, sizeof(*mdata) - sizeof(u32)); + mdata_size = mdata->metadata_size; + mdata->crc32 = crc32(0, buf, mdata_size - sizeof(u32)); - err = fwu_write_mdata(g_dev, mdata, part == PRIMARY_PART); + err = fwu_write_mdata(g_dev, mdata, part == PRIMARY_PART, mdata_size); if (err) { log_err("Unable to write %s mdata\n", part == PRIMARY_PART ? "primary" : "secondary"); @@ -233,7 +223,7 @@ static int fwu_sync_mdata(struct fwu_mdata *mdata, int part) } /* update the cached copy of meta-data */ - memcpy(&g_mdata, mdata, sizeof(struct fwu_mdata)); + memcpy(g_mdata, mdata, mdata_size); return 0; } @@ -241,8 +231,12 @@ static int fwu_sync_mdata(struct fwu_mdata *mdata, int part) static inline int mdata_crc_check(struct fwu_mdata *mdata) { void *buf = &mdata->version; - u32 calc_crc32 = crc32(0, buf, sizeof(*mdata) - sizeof(u32)); + u32 calc_crc32; + if (!mdata->metadata_size) + return -EINVAL; + + calc_crc32 = crc32(0, buf, mdata->metadata_size - sizeof(u32)); return calc_crc32 == mdata->crc32 ? 0 : -EINVAL; } @@ -259,27 +253,32 @@ static inline int mdata_crc_check(struct fwu_mdata *mdata) int fwu_get_mdata(struct fwu_mdata *mdata) { int err; + uint32_t mdata_size; bool parts_ok[2] = { false }; - struct fwu_mdata s, *parts_mdata[2]; + struct fwu_mdata *parts_mdata[2]; + + err = fwu_get_mdata_size(&mdata_size); + if (err) + return err; - parts_mdata[0] = &g_mdata; - parts_mdata[1] = &s; + parts_mdata[0] = g_mdata; + parts_mdata[1] = (struct fwu_mdata *)((char *)g_mdata + mdata_size); /* if mdata already read and ready */ - err = mdata_crc_check(parts_mdata[0]); - if (!err) + if (!mdata_crc_check(parts_mdata[0])) goto ret_mdata; - /* else read, verify and, if needed, fix mdata */ + /* else read, verify and, if needed, fix mdata */ for (int i = 0; i < 2; i++) { parts_ok[i] = false; - err = fwu_read_mdata(g_dev, parts_mdata[i], !i); + err = fwu_read_mdata(g_dev, parts_mdata[i], !i, mdata_size); if (!err) { err = mdata_crc_check(parts_mdata[i]); if (!err) parts_ok[i] = true; else - log_debug("mdata : %s crc32 failed\n", i ? "secondary" : "primary"); + log_debug("mdata : %s crc32 failed\n", + i ? "secondary" : "primary"); } } @@ -288,7 +287,8 @@ int fwu_get_mdata(struct fwu_mdata *mdata) * Before returning, check that both the * FWU metadata copies are the same. */ - err = memcmp(parts_mdata[0], parts_mdata[1], sizeof(struct fwu_mdata)); + err = memcmp(parts_mdata[0], parts_mdata[1], + mdata_size); if (!err) goto ret_mdata; @@ -305,7 +305,8 @@ int fwu_get_mdata(struct fwu_mdata *mdata) if (parts_ok[i]) continue; - memcpy(parts_mdata[i], parts_mdata[1 - i], sizeof(struct fwu_mdata)); + memcpy(parts_mdata[i], parts_mdata[1 - i], + mdata_size); err = fwu_sync_mdata(parts_mdata[i], i ? SECONDARY_PART : PRIMARY_PART); if (err) { log_debug("mdata : %s write failed\n", i ? "secondary" : "primary"); @@ -315,7 +316,7 @@ int fwu_get_mdata(struct fwu_mdata *mdata) ret_mdata: if (!err && mdata) - memcpy(mdata, parts_mdata[0], sizeof(struct fwu_mdata)); + memcpy(mdata, parts_mdata[0], mdata_size); return err; } @@ -333,14 +334,19 @@ ret_mdata: int fwu_get_active_index(uint *active_idx) { int ret = 0; - struct fwu_mdata *mdata = &g_mdata; + u8 num_banks; + struct fwu_mdata *mdata = g_mdata; + + if (!mdata) + return -EINVAL; /* * Found the FWU metadata partition, now read the active_index * value */ *active_idx = mdata->active_index; - if (*active_idx >= CONFIG_FWU_NUM_BANKS) { + num_banks = fwu_get_fw_desc(mdata)->num_banks; + if (*active_idx >= num_banks) { log_debug("Active index value read is incorrect\n"); ret = -EINVAL; } @@ -360,9 +366,14 @@ int fwu_get_active_index(uint *active_idx) int fwu_set_active_index(uint active_idx) { int ret; - struct fwu_mdata *mdata = &g_mdata; + u8 num_banks; + struct fwu_mdata *mdata = g_mdata; - if (active_idx >= CONFIG_FWU_NUM_BANKS) { + if (!mdata) + return -EINVAL; + + num_banks = fwu_get_fw_desc(mdata)->num_banks; + if (active_idx >= num_banks) { log_debug("Invalid active index value\n"); return -EINVAL; } @@ -402,12 +413,16 @@ int fwu_set_active_index(uint active_idx) int fwu_get_dfu_alt_num(u8 image_index, u8 *alt_num) { int ret, i; + u16 num_images; uint update_bank; efi_guid_t *image_guid, image_type_id; - struct fwu_mdata *mdata = &g_mdata; + struct fwu_mdata *mdata = g_mdata; struct fwu_image_entry *img_entry; struct fwu_image_bank_info *img_bank_info; + if (!mdata) + return -EINVAL; + ret = fwu_plat_get_update_index(&update_bank); if (ret) { log_debug("Failed to get the FWU update bank\n"); @@ -423,15 +438,20 @@ int fwu_get_dfu_alt_num(u8 image_index, u8 *alt_num) ret = -EINVAL; /* - * The FWU metadata has been read. Now get the image_uuid for the + * The FWU metadata has been read. Now get the image_guid for the * image with the update_bank. */ - for (i = 0; i < CONFIG_FWU_NUM_IMAGES_PER_BANK; i++) { - if (!guidcmp(&image_type_id, - &mdata->img_entry[i].image_type_uuid)) { - img_entry = &mdata->img_entry[i]; - img_bank_info = &img_entry->img_bank_info[update_bank]; - image_guid = &img_bank_info->image_uuid; + num_images = fwu_get_fw_desc(mdata)->num_images; + for (i = 0; i < num_images; i++) { + img_entry = fwu_img_entry_offset(mdata, i); + if (img_entry && + !guidcmp(&image_type_id, &img_entry->image_type_guid)) { + img_bank_info = fwu_img_bank_info_offset(mdata, i, + update_bank); + if (!img_bank_info) + return -EINVAL; + + image_guid = &img_bank_info->image_guid; ret = fwu_plat_get_alt_num(g_dev, image_guid, alt_num); if (ret) log_debug("alt_num not found for partition with GUID %pUs\n", @@ -465,7 +485,10 @@ int fwu_revert_boot_index(void) { int ret; u32 cur_active_index; - struct fwu_mdata *mdata = &g_mdata; + struct fwu_mdata *mdata = g_mdata; + + if (!mdata) + return -EINVAL; /* * Swap the active index and previous_active_index fields @@ -506,14 +529,24 @@ int fwu_revert_boot_index(void) static int fwu_clrset_image_accept(efi_guid_t *img_type_id, u32 bank, u8 action) { int ret, i; - struct fwu_mdata *mdata = &g_mdata; + u16 num_images; + struct fwu_mdata *mdata = g_mdata; struct fwu_image_entry *img_entry; struct fwu_image_bank_info *img_bank_info; - img_entry = &mdata->img_entry[0]; - for (i = 0; i < CONFIG_FWU_NUM_IMAGES_PER_BANK; i++) { - if (!guidcmp(&img_entry[i].image_type_uuid, img_type_id)) { - img_bank_info = &img_entry[i].img_bank_info[bank]; + if (!mdata) + return -EINVAL; + + num_images = fwu_get_fw_desc(mdata)->num_images; + for (i = 0; i < num_images; i++) { + img_entry = fwu_img_entry_offset(mdata, i); + if (img_entry && + !guidcmp(&img_entry->image_type_guid, img_type_id)) { + img_bank_info = fwu_img_bank_info_offset(mdata, i, + bank); + if (!img_bank_info) + return -ENOENT; + if (action == IMAGE_ACCEPT_SET) img_bank_info->accepted |= FWU_IMAGE_ACCEPTED; else @@ -587,12 +620,18 @@ __weak int fwu_plat_get_update_index(uint *update_idx) { int ret; u32 active_idx; + u8 num_banks; + struct fwu_mdata *mdata = g_mdata; + + if (!mdata) + return -EINVAL; ret = fwu_get_active_index(&active_idx); if (ret < 0) return -1; - *update_idx = (active_idx + 1) % CONFIG_FWU_NUM_BANKS; + num_banks = fwu_get_fw_desc(mdata)->num_banks; + *update_idx = (active_idx + 1) % num_banks; return ret; } @@ -671,6 +710,7 @@ int fwu_trial_state_ctr_start(void) static int fwu_boottime_checks(void) { int ret; + u8 num_banks; u32 boot_idx, active_idx; ret = uclass_first_device_err(UCLASS_FWU_MDATA, &g_dev); @@ -701,7 +741,8 @@ static int fwu_boottime_checks(void) * update the active_index. */ fwu_plat_get_bootidx(&boot_idx); - if (boot_idx >= CONFIG_FWU_NUM_BANKS) { + num_banks = fwu_get_fw_desc(g_mdata)->num_banks; + if (boot_idx >= num_banks) { log_err("Received incorrect value of boot_index\n"); return 0; } @@ -723,7 +764,7 @@ static int fwu_boottime_checks(void) if (efi_init_obj_list() != EFI_SUCCESS) return 0; - in_trial = in_trial_state(&g_mdata); + in_trial = in_trial_state(g_mdata); if (!in_trial || (ret = fwu_trial_count_update()) > 0) ret = trial_counter_update(NULL); From patchwork Mon Feb 12 07:46:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772028 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000491wre; Sun, 11 Feb 2024 23:48:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IFwRR16K6y3E2fg9YBWpkQMc+qREWeFZOU+ec+kDFy3k5TbWrpyQ0pkEh222Nb0AXBf/Xqa X-Received: by 2002:a17:906:138b:b0:a3c:c75e:df60 with SMTP id f11-20020a170906138b00b00a3cc75edf60mr461334ejc.14.1707724121408; Sun, 11 Feb 2024 23:48:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724121; cv=none; d=google.com; s=arc-20160816; b=absZt0lYYvik0wuFB3/0zBoax6Emn96V9ne4F//Xq3VUpIN4LQ0+GoF8q8WKUnJlvf xy/8rsWPHB+I+f07nZrapVvPW6ayeDZq+XuY9psKMiEsDeCwyfPARnWMR+iQp0OctfLz 7PnIJhTrYKy5rcZ3+nLsrYDIBk1gZlEX3oM9My+LKV7C8PAKJXuMtKfYHjWpe/EdXQFk 2fAC7SV9veHFd8YpMTi4uhAFFhJZmJNVOL0+by/gQz5N2JGGebeaLR1L/w5l410I/rd9 DgVM+JBvyvWim93GJ8eQHqCdvdCdrH1sC/qpHof0vD2mP4R9WIYiYgEaQqQ5tmOQWsjt AEVA== 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=yPx2gNHGAttfODFfpA+YHe/VtL2ODE0uWRlqhGVoo9k=; fh=t3R/nFVSxKfmnVlW35tzlMor9J0O+CsbPpotZiPIN3s=; b=Zk0t/l8bPIHgE2tgIwLfS5zrChU8e7z+zmPh7Syo95W1Nw0NM/tW4Hcc41b8mBXkSH 3WguSgfL/9qdG3ntEKYm5Pdf0Yd0vmIxFtnsWDL0cRt52UXaLcO0DCcVPTcCinaPcpPp O2+ddZoH9ZSPREN5IZIbYwu1IKMriMyax4pnFalwMazlGuJuhKF1oLs011dHdCYvEa4z hdUMJtnL7CTRgNU7kU6PThEc2XYVHn8EA1N7ay/GgDzKLrfP6E/OvrTNU5do2/hUbcg2 u2OrvYHjwDvq3VIMz2nN3K+GquJyccpgtgRD35U1b8CvzcztQqCdn2VCpqyYUVrOPdvx tW6Q==; darn=linaro.org 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 X-Forwarded-Encrypted: i=1; AJvYcCWKftDkBAQRVfd2zAJv8aDoP9iSVm3F9gaiFfDZ6fVtIPgsaQFfxXlAHGv9XeQrSDOjXtEpaXFYpylE+Wikie/40GfE0kBsb6e3r9sCIW+F+jLHFeBaN4kqjVWJfJWM1GI1+NI5BoU/U7cmME99uqxq0cFiET1k+qouKTtHZ1WlNDGL1hOuVCLkMTCLRJCeztbOg+zydVMBSgFbHLTMAyxQWqxvBw7EPJ2KXI0rdApZrnvgV0/GlNFL+5Ed3BSWFHlZEUP+i/okxxl+xcgxIvV696WKJAjqonY79tHXQzMdKbhuk6O5ExkngKT22AhsmxWByoD9xijNgMom/SEbqOiyjR9pi8BjRVZPEAp7eZErKMN7cZZIDCYd/X+T92dhZ0T+CW3Zp1dLBJm3n8yIKYyPRH0Pc0UcJxIZnqNtUjGRpvvuBE2VpWRKH4F3cOkp7aggu4fCRUgIFfHeT8mXzk+JhK1JYtqLkMY8mrtnT/9yimLVOV8C7hpcwQBElMQv+/X6c8Is10kQP33P4qKVXpGX5LjH9cJWfUhNLT7vtfTq51FTxiY6JwadkBhjNsYvbdXhnSzEQUjMwzeuyLZxEIN9nALQimIw8WrBPyqRQhDSbJtGNqYxhRJgI539/UQb7ViFu6huYY8fh9Pv58gcK+LLTIwIYwpN+TDbTcU549+aqN30IgVORuc/dDDfGsNVnlLq2cB2yNKDcZp8l5nYNw8FrQ60rfiU8py7bHoi3Y7mvEehSfzBh+PKT+F/QX5supULIC1u0hoojbgwdl3sYtYmz2/gcr8CC/dtd6o6Y0p3s/dMEKkpCj1wcVaB0Kd37114WOe1Lw8Nn1WjulhWttHEkPtxzT3kNHA3oknRx33W9lA= Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id f15-20020a170906048f00b00a31619d6350si3338409eja.493.2024.02.11.23.48.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:48:41 -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 DCC2987ED2; Mon, 12 Feb 2024 08:47:59 +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 4DC0D87EDE; Mon, 12 Feb 2024 08:47:59 +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 120E287808 for ; Mon, 12 Feb 2024 08:47:57 +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 1AF3EDA7; Sun, 11 Feb 2024 23:48:38 -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 4E7E03F7BD; Sun, 11 Feb 2024 23:47:53 -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 06/21] fwu: add some API's for metadata version 2 access Date: Mon, 12 Feb 2024 13:16:57 +0530 Message-Id: <20240212074712.3657076-7-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 There are certain fields added in version 2 of the FWU metadata structure. Also, information like number of banks and number of images per bank are also part of the metadata structure. Add functions to access fields of the version 2 of the metadata structure. Signed-off-by: Sughosh Ganu --- Changes since V1: * Use the helper functions from the previous patch to access the image information in the metadata. include/fwu.h | 53 ++++++++++++++++ lib/fwu_updates/fwu.c | 144 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 197 insertions(+) diff --git a/include/fwu.h b/include/fwu.h index 8f2492bb7e..ce8c98921a 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -153,6 +153,26 @@ int fwu_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, */ int fwu_get_mdata(struct fwu_mdata *mdata); +/** + * fwu_mdata_copies_allocate() - Allocate memory for metadata + * + * Allocate memory for storing both the copies of the FWU metadata. The + * copies are then used as a cache for storing FWU metadata contents. + * + * Return: 0 if OK, -ve on error + */ +int fwu_mdata_copies_allocate(void); + +/** + * fwu_get_mdata_size() - Get the FWU metadata size + * + * Get the size of the FWU metadata from the structure. This is later used + * to allocate memory for the structure. + * + * Return: 0 if OK, -ve on error + */ +int fwu_get_mdata_size(uint32_t *mdata_size); + /** * fwu_get_active_index() - Get active_index from the FWU metadata * @active_idxp: active_index value to be read @@ -202,6 +222,18 @@ int fwu_get_dfu_alt_num(u8 image_index, u8 *alt_num); */ int fwu_revert_boot_index(void); +/** + * fwu_bank_state_update() - Check and update the bank_state of the metadata + * @update_index: Bank for which the bank_state needs to be updated + * + * Check that all the images for the given bank have been accepted, and if + * they are, set the status of the bank to Accepted in the bank_state field + * of the metadata. + * + * Return: 0 if OK, -ve on error + */ +int fwu_bank_state_update(uint update_index); + /** * fwu_accept_image() - Set the Acceptance bit for the image * @img_type_id: GUID of the image type for which the accepted bit is to be @@ -335,4 +367,25 @@ int fwu_gen_alt_info_from_mtd(char *buf, size_t len, struct mtd_info *mtd); */ int fwu_mtd_get_alt_num(efi_guid_t *image_guid, u8 *alt_num, const char *mtd_dev); +/** + * fwu_get_banks_images() - Get the number of banks and images from the metadata + * @nbanks: Number of banks + * @nimages: Number of images per bank + * + * Get the values of number of banks and number of images per bank from the + * metadata. + * + * Return: 0 if OK, -ve on error + */ +int fwu_get_banks_images(u8 *nbanks, u16 *nimages); + +/** + * fwu_get_dev() - Return the FWU metadata device + * + * Return the pointer to the FWU metadata device. + * + * Return: Pointer to the FWU metadata dev + */ +__maybe_unused struct udevice *fwu_get_dev(void); + #endif /* _FWU_H_ */ diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c index 2da19c9003..587ca779d3 100644 --- a/lib/fwu_updates/fwu.c +++ b/lib/fwu_updates/fwu.c @@ -240,6 +240,114 @@ static inline int mdata_crc_check(struct fwu_mdata *mdata) return calc_crc32 == mdata->crc32 ? 0 : -EINVAL; } +/** + * fwu_mdata_copies_allocate() - Allocate memory for metadata + * + * Allocate memory for storing both the copies of the FWU metadata. The + * copies are then used as a cache for storing FWU metadata contents. + * + * Return: 0 if OK, -ve on error + */ +int fwu_mdata_copies_allocate(void) +{ + int err; + uint32_t mdata_size; + + if (g_mdata) + return 0; + + err = fwu_get_mdata_size(&mdata_size); + if (err) + return err; + + /* + * Now allocate the total memory that would be needed for both + * the copies. + */ + g_mdata = calloc(2, mdata_size); + if (!g_mdata) { + log_err("Unable to allocate space for FWU metadata\n"); + return -ENOMEM; + } + + return 0; +} + +/** + * fwu_get_mdata_size() - Get the FWU metadata size + * + * Get the size of the FWU metadata from the structure. This is later used + * to allocate memory for the structure. + * + * Return: 0 if OK, -ve on error + */ +int fwu_get_mdata_size(uint32_t *mdata_size) +{ + int err = 0; + struct fwu_mdata mdata = { 0 }; + + if (g_mdata && !mdata_crc_check(g_mdata)) { + *mdata_size = g_mdata->metadata_size; + return 0; + } + + err = fwu_read_mdata(g_dev, &mdata, 1, sizeof(struct fwu_mdata)); + if (err) { + log_err("FWU metadata read failed\n"); + return err; + } + + if (mdata.version != 0x2) { + log_err("FWU metadata version %u. Expected value of 2\n", + mdata.version); + return -EINVAL; + } + + *mdata_size = mdata.metadata_size; + if (!*mdata_size) + return -EINVAL; + + return 0; +} + +/** + * fwu_get_dev() - Return the FWU metadata device + * + * Return the pointer to the FWU metadata device. + * + * Return: Pointer to the FWU metadata dev + */ +__maybe_unused struct udevice *fwu_get_dev(void) +{ + return g_dev; +} + +/** + * fwu_get_banks_images() - Get the number of banks and images from the metadata + * @nbanks: Number of banks + * @nimages: Number of images per bank + * + * Get the values of number of banks and number of images per bank from the + * metadata. + * + * Return: 0 if OK, -ve on error + */ +int fwu_get_banks_images(u8 *nbanks, u16 *nimages) +{ + int ret; + + if (mdata_crc_check(g_mdata)) { + ret = fwu_get_mdata(NULL); + if (ret) + return ret; + } + + *nbanks = fwu_get_fw_desc(g_mdata)->num_banks; + *nimages = fwu_get_fw_desc(g_mdata)->num_images; + + return 0; +} + /** * fwu_get_mdata() - Read, verify and return the FWU metadata * @mdata: Output FWU metadata read or NULL @@ -564,6 +672,42 @@ out: return ret; } +/** + * fwu_bank_state_update() - Check and update the bank_state of the metadata + * @update_index: Bank for which the bank_state needs to be updated + * + * Check that all the images for the given bank have been accepted, and if + * they are, set the status of the bank to Accepted in the bank_state field + * of the metadata. + * + * Return: 0 if OK, -ve on error + */ +int fwu_bank_state_update(uint update_index) +{ + int ret = 0, i; + u16 num_images; + struct fwu_mdata *mdata = g_mdata; + struct fwu_image_bank_info *img_bank_info; + + if (!mdata) + return -EINVAL; + + num_images = fwu_get_fw_desc(mdata)->num_images; + for (i = 0; i < num_images; i++) { + img_bank_info = fwu_img_bank_info_offset(g_mdata, i, + update_index); + if (!(img_bank_info->accepted & FWU_IMAGE_ACCEPTED)) + return 0; + } + + mdata->bank_state[update_index] = FWU_BANK_ACCEPTED; + ret = fwu_sync_mdata(mdata, BOTH_PARTS); + if (ret) + log_err("Unable to set bank_state for bank %u\n", update_index); + + return ret; +} + /** * fwu_accept_image() - Set the Acceptance bit for the image * @img_type_id: GUID of the image type for which the accepted bit is to be From patchwork Mon Feb 12 07:46:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772029 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000533wre; Sun, 11 Feb 2024 23:48:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHaKEGb48sPFI4NPbe8vZ2UZc0nuAUi4bPDU0T/zCtlQKohUieBOwB8dQWnSeeH4vHN9eWK X-Received: by 2002:a17:906:fc13:b0:a38:40eb:9fe6 with SMTP id ov19-20020a170906fc1300b00a3840eb9fe6mr6522420ejb.33.1707724133413; Sun, 11 Feb 2024 23:48:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724133; cv=none; d=google.com; s=arc-20160816; b=eF0MXGuImpW7ImHqun2TvEWmtJxKBW+MA5QkuqgcUpIcwR3ai4iXq7wYamnhKHqo4E I2jAYapPCHk61qnZF+eU4QldkQim+Gsb0gXOiM+VwkI5UZIXT9Z9u1BgKRBhL+Mr157d dBIBpT65N1XoTj9Ru2tFRA2vD87YLpQEKzovCFYgfpaF0gRLBdrSnb0bws4BBNRZi84L 6bNGBPQbWDjr2KzONAHg/9UxwxqTkABSBEydMx/nJtSiUftMJ/T44t3nbvG9Jqxd5bLh SIWKhXBbUgT/cV0Umhe2cfhVqmdy9H3udVeDze+/tuJHc2EPWASMzOAoClOCemUFFZBp SSAw== 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=7HTu3BUq+G8HibyudYouyXk5uKM5QjiJk5ujjuKrjII=; fh=mi7J6cZjilAFpBBsdiJVJiY+MrfsjxkQEbeIfSPmPbw=; b=FQ3YBLz7PbH4CGXFsann3UwAeYx1MDXAfK7f+b5L8b6EYxhX6Eqt2ENeIQsaz8rMrm 5liXYkxwOlnvrKRzKy69PDSU23d7HLWv4bMZm5iA1HFZ4FMJ8sCR03S3TxxgZPSxnxWy w4EzqH7Xop+YD0wB4Tsenmn7wB7p0ODPoe53Br/Kv3l61YHIOK6Xeb4F2XxBRZ66vq0j kNK0Yosxedl2R+NNy0pUQdRpJjL1Ni0828UHwZagGUPCj0p3uDHGEKsDsJ1+fvuS7HO2 xWcVwb/pTYEyj1BUUvp7kO+F3J3TNcrwV5tOwJaQj9gRi+YcnHPTrlGnQTDNylTWCEUx FBXA==; 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; AJvYcCWsEQsOBvOIkTmT/BDhwzomfbBsd6jPPJ15wNVH0zZzGllEjAVGVlClcDamo5aasp2XoGJbR7dSnBs2kGf+x8HEVYV27f2XjJMH6k2SsDuBbDh6+hcUw5QeXyH5jzZomKc+FU6nHnFog6u8Soep2EYeh8YZD1kAJYPJr9TYUV4J3LRL0e9H4bBNw0DDAt1AfsF7fe/ljpgDlyPy5KXXQGScGYZrSGMFDCoxFsH7NYnOq6HWleOFtZdHSWHM/IId2ZFBJoZ6DQNg4AUBxll7ccq5kC6Uud4kPBXRNIiUT70YPW/znD/UV+cN0JtQ0W2HQ3eqzAzMZXibH1xT4/u3rjLPj8V5csEhTDOtS48EqGiv9+JzwbFVEEIV/IqKdGKepjccmGmEWUNq4aQfKvfu3JDJlQ9P6gfjgU6VnFt/p7yYg9LN8gvfmFFkvVj72GCc7sP+0WH5JRjBraGNMuUHYPTEPLSwvYXBiTjts3DYW9rkD9uqEfjOpCveGV7w7MT13YmijO+T48RHkR0OCXLWK6HhGnHAw5dsMvWp/mFeLJIgmnU56k+3ahkgmz1bMbXweX1SaKIihv3+L/V5IPLCkKV8f+OZwSvN/3aPApm7fe6+XOFIxRQQV7vM+Pa3wo22g3yG5e1lXFaQYvKaD6RVyWBqOOOQ6zUI0cQcamrvoSHwiVGcYHUJQsFW7HObHirMlgFPBKDRaRVQ6fony6nDydC6G1ZEX2+14c8lWifUuaU/SvGyRi0TqV5LgiBcnKfqlOAYMbcZATgjJcu4BXj0gGG27WN46+7XWk6/lhQAjD5x3aANw/5YbXCv3oAovqBGFcOcWvm3SD5Wo/1EM1nCq9+xc/5FukcNUnmBl3t2KTaxhcI= 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 qw18-20020a170906fcb200b00a3c9abc9b56si770018ejb.892.2024.02.11.23.48.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:48:53 -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 75A0987EE4; Mon, 12 Feb 2024 08:48:04 +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 186FF87EE6; Mon, 12 Feb 2024 08:48:03 +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 C424387EE2 for ; Mon, 12 Feb 2024 08:48:00 +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 D1C79DA7; Sun, 11 Feb 2024 23:48:41 -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 115103F762; Sun, 11 Feb 2024 23:47:56 -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 07/21] drivers: fwu: mtd: allocate buffer for image info dynamically Date: Mon, 12 Feb 2024 13:16:58 +0530 Message-Id: <20240212074712.3657076-8-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 FWU metadata access driver for MTD partitioned devices currently uses a statically allocated array for storing the updatable image information. This array depends on the number of banks and images per bank. With migration of the FWU metadata to version 2, these parameters are now obtained at runtime from the metadata. Make changes to the FWU metadata access driver for MTD devices to allocate memory for the image information dynamically in the driver's probe function, after having obtained the number of banks and images per bank by reading the metadata. Move the image information as part of the driver's private structure, instead of using a global variable. Signed-off-by: Sughosh Ganu --- Changes since V1: None drivers/fwu-mdata/raw_mtd.c | 71 ++++++++++++++++++++++++------------- include/fwu.h | 9 +++++ 2 files changed, 55 insertions(+), 25 deletions(-) diff --git a/drivers/fwu-mdata/raw_mtd.c b/drivers/fwu-mdata/raw_mtd.c index 9f3f1dc213..da36094644 100644 --- a/drivers/fwu-mdata/raw_mtd.c +++ b/drivers/fwu-mdata/raw_mtd.c @@ -12,22 +12,11 @@ #include #include -/* Internal helper structure to move data around */ -struct fwu_mdata_mtd_priv { - struct mtd_info *mtd; - char pri_label[50]; - char sec_label[50]; - u32 pri_offset; - u32 sec_offset; -}; - enum fwu_mtd_op { FWU_MTD_READ, FWU_MTD_WRITE, }; -extern struct fwu_mtd_image_info fwu_mtd_images[]; - static bool mtd_is_aligned_with_block_size(struct mtd_info *mtd, u64 size) { return !do_div(size, mtd->erasesize); @@ -134,7 +123,7 @@ static int flash_partition_offset(struct udevice *dev, const char *part_name, fd return (int)size; } -static int fwu_mdata_mtd_of_to_plat(struct udevice *dev) +static int get_fwu_mdata_dev(struct udevice *dev) { struct fwu_mdata_mtd_priv *mtd_priv = dev_get_priv(dev); const fdt32_t *phandle_p = NULL; @@ -144,8 +133,6 @@ static int fwu_mdata_mtd_of_to_plat(struct udevice *dev) fdt_addr_t offset; int ret, size; u32 phandle; - ofnode bank; - int off_img; /* Find the FWU mdata storage device */ phandle_p = ofnode_get_property(dev_ofnode(dev), @@ -199,8 +186,28 @@ static int fwu_mdata_mtd_of_to_plat(struct udevice *dev) return ret; mtd_priv->sec_offset = offset; - off_img = 0; + return 0; +} + +static int fwu_mtd_image_info_populate(struct udevice *dev, u8 nbanks, + u16 nimages) +{ + struct fwu_mtd_image_info *mtd_images; + struct fwu_mdata_mtd_priv *mtd_priv = dev_get_priv(dev); + struct udevice *mtd_dev = mtd_priv->mtd->dev; + fdt_addr_t offset; + ofnode bank; + int off_img; + u32 total_images; + total_images = nbanks * nimages; + mtd_priv->fwu_mtd_images = malloc(sizeof(struct fwu_mtd_image_info) * + total_images); + if (!mtd_priv->fwu_mtd_images) + return -ENOMEM; + + off_img = 0; + mtd_images = mtd_priv->fwu_mtd_images; ofnode_for_each_subnode(bank, dev_ofnode(dev)) { int bank_num, bank_offset, bank_size; const char *bank_name; @@ -219,8 +226,7 @@ static int fwu_mdata_mtd_of_to_plat(struct udevice *dev) int image_num, image_offset, image_size; const char *uuid; - if (off_img == CONFIG_FWU_NUM_BANKS * - CONFIG_FWU_NUM_IMAGES_PER_BANK) { + if (off_img == total_images) { log_err("DT provides more images than configured!\n"); break; } @@ -230,11 +236,11 @@ static int fwu_mdata_mtd_of_to_plat(struct udevice *dev) ofnode_read_u32(image, "offset", &image_offset); ofnode_read_u32(image, "size", &image_size); - fwu_mtd_images[off_img].start = bank_offset + image_offset; - fwu_mtd_images[off_img].size = image_size; - fwu_mtd_images[off_img].bank_num = bank_num; - fwu_mtd_images[off_img].image_num = image_num; - strcpy(fwu_mtd_images[off_img].uuidbuf, uuid); + mtd_images[off_img].start = bank_offset + image_offset; + mtd_images[off_img].size = image_size; + mtd_images[off_img].bank_num = bank_num; + mtd_images[off_img].image_num = image_num; + strcpy(mtd_images[off_img].uuidbuf, uuid); log_debug("\tImage%d: %s @0x%x\n\n", image_num, uuid, bank_offset + image_offset); off_img++; @@ -246,8 +252,24 @@ static int fwu_mdata_mtd_of_to_plat(struct udevice *dev) static int fwu_mdata_mtd_probe(struct udevice *dev) { - /* Ensure the metadata can be read. */ - return fwu_get_mdata(NULL); + u8 nbanks; + u16 nimages; + int ret; + + ret = get_fwu_mdata_dev(dev); + if (ret) + return ret; + + /* Read the metadata to get number of banks and images */ + ret = fwu_get_banks_images(&nbanks, &nimages); + if (ret) + return ret; + + ret = fwu_mtd_image_info_populate(dev, nbanks, nimages); + if (ret) + return ret; + + return 0; } static struct fwu_mdata_ops fwu_mtd_ops = { @@ -266,6 +288,5 @@ U_BOOT_DRIVER(fwu_mdata_mtd) = { .of_match = fwu_mdata_ids, .ops = &fwu_mtd_ops, .probe = fwu_mdata_mtd_probe, - .of_to_plat = fwu_mdata_mtd_of_to_plat, .priv_auto = sizeof(struct fwu_mdata_mtd_priv), }; diff --git a/include/fwu.h b/include/fwu.h index ce8c98921a..109ceb2610 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -27,6 +27,15 @@ struct fwu_mtd_image_info { char uuidbuf[UUID_STR_LEN + 1]; }; +struct fwu_mdata_mtd_priv { + struct mtd_info *mtd; + char pri_label[50]; + char sec_label[50]; + u32 pri_offset; + u32 sec_offset; + struct fwu_mtd_image_info *fwu_mtd_images; +}; + struct fwu_mdata_ops { /** * read_mdata() - Populate the asked FWU metadata copy From patchwork Mon Feb 12 07:46:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772030 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000557wre; Sun, 11 Feb 2024 23:49:03 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWw3ZJvwaFAFMbiiR/tzDjJSFjQyYTh90V6jISCMmEFLORswotM+Q+nva54aogEtO4cg97rYcmAQm5YOf5Tox1o X-Google-Smtp-Source: AGHT+IGeeRmPFvBX9Sz5lzZ9NKeDDztDQ8e+d/5N6YiO8+BfsDftWkRC8JV5SwnhOehR84H0sLNv X-Received: by 2002:a2e:9216:0:b0:2d0:b70a:a947 with SMTP id k22-20020a2e9216000000b002d0b70aa947mr3439736ljg.23.1707724143157; Sun, 11 Feb 2024 23:49:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724143; cv=none; d=google.com; s=arc-20160816; b=WSy2VPnOaARaBxzEqbg25stL1mJY9E0B9Y7jRI5xKG7X4o9CQ0ZXhirly/nUwFHVd2 xNAIVLlK0cMBQSDwEViPvMzTBKiBCZKNvQ1cSrqxf4wARIkroR1uWpoR/F77s1ynqHs4 2jDksr+magmdiiO0fD5mt9P0UJ1tPuimXLplJjERZLKDyql2RG3UexnyqlfX/0jRO1jo RfdNlKEhqtB+zi8e8u2k6EZ9rq1uMteZB18/OXKW5VVbezFu6Pw6nCnURStHrtByW4RC anDMvamgoKTUwJDCltnpSYmlf4V2d/s8m9QLzkYetP8hD3lw6faukaBnlt9znA0yWC4n FW8g== 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=DpbalCHCeg3f3kUfgKHZlSXYMRFGyv8y+AcWHeYj/bc=; fh=t0JPhh+tqCynDEqWdOhrBHUGOxqktxVJOd5jMLpzpgI=; b=ShbXPGgDf8IwpRHAFrhLJwwhK813bxPEJo+TRArNGoa+EQgznSQu7niqC5ALGuHaGe ra6VVXOb/3vKUVUBdsm6MpnyK+Jkhnhceot2WtmjdijLMjIMNScq/0E/pCXDnFGSa77V YR5djI6jUH2rmTEHYiOKGjxShqn2TMUOtLyzNd4A4egiSVJNSM49i8P3JmhA7YIELdKc ofCxEi+JjH/HYxqonoVcuHQkFJUKMt4tsug4T7zU+zpMhkNTSAgfEX2II6/SgL7afX3W kJDfdb4EbBjJffv6AQeroGm/kB8z1v/g3c1VF2syV6XCcW4CZr+K9Uwd1YwW2RV0J499 D1kg==; 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; AJvYcCVp87t9i3B96jBzqSYoXAUuJN1Wnc+eqGiDZGkNyOQzWPi316re8kxeRv6InXdzxzyEDz26s0CkDeeXAXquWkVbRCtLxCQORThpGMCVUJ9WZSEYkbJeVnta1zKmZViKNZepO4I9O5wCp9fUv0ySwq3Ro+lrwoovoIJ603k5NzX1joauydL2lLEOXTDmM0aT/JZqshPDliykZ4qR4WISilCf/CFUEAbaXRKmPHcJ08qkXW/UEwNNhl7WT+l503Q0D0mGqaPIonHLi+bmTUhHjVbWvK8Ng9+Q9CK6wkD64QgQl5V20tFUT5lgMTktxRkiTaUibFhNlmUU6gp0KJODRCnwf2uFeJNtT0qQBKtdGa0MH6A4oAwJiKnFD5DFRl2UkPL40a21cq7zwWAT9ukJtlqqIagkzdM1VbPu//8zc4UiGUW0GlO8K9uu4blt5It60zoMzmdpSPPJMoSYN7WWZpLOImMtWI3W33mNU/c8vbB5+jxhC/RNX+CiFdK74/y0bb0zKdgfHnrfKBuIZ7Qw75F4S3zx8aX9KuBK/FVqADV0Z5qn8tPwkdUcaj/kFGyMs/E8SUaT4nV2KMk+MsjASs0NUtltH6y/1BQkUQEBLe04F/SjqCZhdyD4lg+Qq22c2pdWWJrmXrH/ti324xC13HHIsntIG9dRqxV3IUO9NBgu+TzvErjAmbGhaoU15zOaaCn2ABfxDkayfsab4mRBJOAk//3fH/F3A9SzIHM8JJwitHx1kszac4ex3FsoQ060MKtDFcsGOmDw2AJ+jPIVAuWxd1KVKu8thPYCoF+sl8xFCba7w0C0zezBdBiWojQmPvw+w7+RdVbddKZ8a0oFdNOQZEqkd9SMubtxsGh9Jy4RiOk= 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 k19-20020a17090646d300b00a3bf0da9219si3264915ejs.1020.2024.02.11.23.49.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:49:03 -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 0923D87EDC; Mon, 12 Feb 2024 08:48:07 +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 7C1A787EF0; Mon, 12 Feb 2024 08:48:06 +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 87BCE87EE7 for ; Mon, 12 Feb 2024 08:48:04 +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 944DBDA7; Sun, 11 Feb 2024 23:48:45 -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 C804B3F762; Sun, 11 Feb 2024 23:48:00 -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 08/21] drivers: fwu: allocate memory for metadata copies Date: Mon, 12 Feb 2024 13:16:59 +0530 Message-Id: <20240212074712.3657076-9-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 With migration of the FWU metadata access code to version 2, the size of the metadata is obtained at runtime. Allocate memory for both the metadata copies from the driver's probe function. Signed-off-by: Sughosh Ganu --- Changes since V1: None drivers/fwu-mdata/gpt_blk.c | 4 ++++ drivers/fwu-mdata/raw_mtd.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/drivers/fwu-mdata/gpt_blk.c b/drivers/fwu-mdata/gpt_blk.c index 97eac3611f..c2cb7ef7c3 100644 --- a/drivers/fwu-mdata/gpt_blk.c +++ b/drivers/fwu-mdata/gpt_blk.c @@ -159,6 +159,10 @@ static int fwu_mdata_gpt_blk_probe(struct udevice *dev) priv->blk_dev = mdata_dev; + ret = fwu_mdata_copies_allocate(); + if (ret) + return ret; + return 0; } diff --git a/drivers/fwu-mdata/raw_mtd.c b/drivers/fwu-mdata/raw_mtd.c index da36094644..d91518bf0a 100644 --- a/drivers/fwu-mdata/raw_mtd.c +++ b/drivers/fwu-mdata/raw_mtd.c @@ -260,6 +260,10 @@ static int fwu_mdata_mtd_probe(struct udevice *dev) if (ret) return ret; + ret = fwu_mdata_copies_allocate(); + if (ret) + return ret; + /* Read the metadata to get number of banks and images */ ret = fwu_get_banks_images(&nbanks, &nimages); if (ret) From patchwork Mon Feb 12 07:47:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772031 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000591wre; Sun, 11 Feb 2024 23:49:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVs+B7fj6CihCnESeWMheK7JSpJdxNQpnqyHIpItwn/3uwjc5mY2291kp5qX1T+onfUmA2 X-Received: by 2002:a17:906:f8da:b0:a3c:a677:fc1e with SMTP id lh26-20020a170906f8da00b00a3ca677fc1emr1032331ejb.40.1707724152606; Sun, 11 Feb 2024 23:49:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724152; cv=none; d=google.com; s=arc-20160816; b=GUwWhdBmGmH2WKPwYNvOP9M08EpFMkFlbSykZAaPU919MSjXyEj6a8uQxHxtMsN97w AA7eGlO3AWapSQZD7XQsqRl2VhJcym8xFGi+BEA/+LhSgf8BR6Ox8v1FHoRotc0IV1Sy 9+rD8vHXIWo7H1if036iEpQncLfhx3TlGc9EqjrferVb6NJp6zTzIUV1qMBdry7nSXZO vWd6kzrvHNKTuh4fao/Rh9P/NF0QLH1kG893YuHlCMaeWTaS35NITDT0KCgHTPOi5UhS SvKhX6AGUywer/rph7lm13lmkdqACs0Mp7IsZy0G6T65+x76Z7d+6Lzkm1+Rjg/wzX8W Z3pA== 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=UpFkeafqXTPlpnvruoBbjayea3FtZop1wKuEhkyGybw=; fh=vTY1W+dwg/uYkx8YFYqtKjzkODrNthDN1CctwTadm0I=; b=oheAoB3f/ZJvN6toFDhWrKhxZF1otd+D2NjqbvFCNmsaNPTJzO8MrwPkiLvao+c+Ww lSZAaJNIUnswhLw9gCCvnjx3YXEKAavcXcZ0b6xj2qCYeionDgHUNPv9RdihXHbFTIyJ h2HObqbN8W6j4aJgOUETdsDiQckmKush4/qOz+Yi2UmKlYXeqMdYrXQNN+xw2q1c1Ug9 lqo+ZXvMUMYrdX+HnP2FXwN44uiThbpplA6YdxZ2QXKspPTjBJJqigdG1ipII4AmaPjj LeW1A6cAqYJhISu3KI0+VjLNicVJimP10w4GZ/ATan4K8FyYD+TTJ7XoKJX8E8t8m2b4 sD6A==; 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; AJvYcCVzSg9QtSyosXD7lffCcEPHstXjEum6THTR+imBf7qC6qOXHW+iQI55t9yQhIMHnUPOagkOVSPpfd5FdN52ku+vrm8+CEF7uUKToFLSSuxCiRB4M7y6MlI49vNvNMJ5/jnN3B8qrbqZ5Ar/TZGv86+tU0ChVV8QUKBk4Vq1FvChvGL+iCDir12DFTrhwFfrkRzfz8K4sBDaDbbSQXs82mo23Y/PUAgjgYVZyId26TPqu+p5gySB3LPX1JyYuTP+SGOr7zev7wQ5zjpycyp8teI0Gnxyh758cIFzutr9EdY3eBAjPoUkUka4R7uRWLW0gw+DZhq2oZ8NBJgNYhjOpRLDfnpBwRwyB9w0Wi7VwINGV/qrf7zMrSy/nq+h7QdXk0kYseAbOWO8iZXGDCyAX7Mp8iTUipSab8QMBbFaWLESnj4dex+Fm4ZHSwG9q7CMNWtsj1w+g6aU+dTcjGGAb+pYjfP7zXIJVcRYF08bO50o4zrSDO5FR4u0Zi7N3yXjRCPtCXte/SACDloHMIbtch7w52rYB4UyUh8dNuSYa0SckntKUanf3DKnEpIw2EKwzUnWF3GGajJ0HTPdH7gnEk5QFhZkn5CYNDp5TwbWL9o+S6uAvTCPKU0HpDvNEPjLyegpagDUG0Ur5wPYtX/M5RCSrn0toxwl8XOdtv0is6TqCaXj6Z+UQjaPZiq7FV4X8MjLUrYVgZjAZIq/u4+20X/b6uGZXC9IT3OXhy4ZYClQRPDUr4zETH3RnrPA4H1GffhzlQFgadzpvQA8BXYYihhkUCtCj0gki/cbP7xV1EvD3cySCXIsEfLKUpeWHMfQE2/Jny7+UJkj06mreXhrt+vE70ZyYGASZChNDvs8wJi0eV8= 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 u23-20020a1709064ad700b00a352247f161si3571338ejt.545.2024.02.11.23.49.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:49:12 -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 9C3E087EE7; Mon, 12 Feb 2024 08:48:11 +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 6BB2887EC9; Mon, 12 Feb 2024 08:48:10 +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 4ABAE87EED for ; Mon, 12 Feb 2024 08:48:08 +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 56FF2DA7; Sun, 11 Feb 2024 23:48:49 -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 8A9753F762; Sun, 11 Feb 2024 23:48:04 -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 09/21] fwu: add a function to put a bank in Trial State Date: Mon, 12 Feb 2024 13:17:00 +0530 Message-Id: <20240212074712.3657076-10-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 version 2 of the FWU metadata has a field in the top level structure, called bank_state. This is used to keep the state a given bank is in, either of valid(for trial state), invalid, or accepted. Update this field when putting the platform in Trial State, in addition to starting the TrialStateCtr variable by calling the fwu_trial_state_start() function. Signed-off-by: Sughosh Ganu --- Changes since V1: None include/fwu.h | 12 +++++--- lib/efi_loader/efi_capsule.c | 2 +- lib/fwu_updates/fwu.c | 54 ++++++++++++++++++++++++++++++------ 3 files changed, 54 insertions(+), 14 deletions(-) diff --git a/include/fwu.h b/include/fwu.h index 109ceb2610..1c6a5fcda9 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -342,15 +342,19 @@ u8 fwu_update_checks_pass(void); u8 fwu_empty_capsule_checks_pass(void); /** - * fwu_trial_state_ctr_start() - Start the Trial State counter + * fwu_trial_state_start() - Put the platform in Trial State + * @update_index: Bank number to which images have been updated * - * Start the counter to identify the platform booting in the - * Trial State. The counter is implemented as an EFI variable. + * Put the platform in Trial State by starting the counter to + * identify the platform booting in the Trial State. The + * counter is implemented as an EFI variable. Secondly, set + * the bank_state in the metadata for the updated bank to Valid + * state. * * Return: 0 if OK, -ve on error * */ -int fwu_trial_state_ctr_start(void); +int fwu_trial_state_start(uint update_index); /** * fwu_gen_alt_info_from_mtd() - Parse dfu_alt_info from metadata in mtd diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index de0d49ebeb..0e6a38b441 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -522,7 +522,7 @@ static __maybe_unused efi_status_t fwu_post_update_process(bool fw_accept_os) } else { log_debug("Successfully updated the active_index\n"); if (fw_accept_os) { - status = fwu_trial_state_ctr_start(); + status = fwu_trial_state_start(update_index); if (status < 0) ret = EFI_DEVICE_ERROR; } diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c index 587ca779d3..a58c42bee2 100644 --- a/lib/fwu_updates/fwu.c +++ b/lib/fwu_updates/fwu.c @@ -672,6 +672,36 @@ out: return ret; } +static int fwu_trial_state_ctr_start(void) +{ + int ret; + u16 trial_state_ctr; + + printf("%s: starting the TrialStateCtr\n", __func__); + trial_state_ctr = 0; + ret = trial_counter_update(&trial_state_ctr); + if (ret) + log_err("Unable to initialise TrialStateCtr\n"); + + return ret; +} + +static int fwu_set_bank_state_trial(uint update_index) +{ + int ret; + struct fwu_mdata *mdata = g_mdata; + + mdata->bank_state[update_index] = FWU_BANK_VALID; + + ret = fwu_sync_mdata(mdata, BOTH_PARTS); + if (ret) { + log_err("Unable to set bank_state for %d bank\n", update_index); + return ret; + } + + return 0; +} + /** * fwu_bank_state_update() - Check and update the bank_state of the metadata * @update_index: Bank for which the bank_state needs to be updated @@ -830,25 +860,31 @@ u8 fwu_empty_capsule_checks_pass(void) } /** - * fwu_trial_state_ctr_start() - Start the Trial State counter + * fwu_trial_state_start() - Put the platform in Trial State + * @update_index: Bank number to which images have been updated * - * Start the counter to identify the platform booting in the - * Trial State. The counter is implemented as an EFI variable. + * Put the platform in Trial State by starting the counter to + * identify the platform booting in the Trial State. The + * counter is implemented as an EFI variable. Secondly, set + * the bank_state in the metadata for the updated bank to Valid + * state. * * Return: 0 if OK, -ve on error * */ -int fwu_trial_state_ctr_start(void) +int fwu_trial_state_start(uint update_index) { int ret; - u16 trial_state_ctr; - trial_state_ctr = 0; - ret = trial_counter_update(&trial_state_ctr); + ret = fwu_trial_state_ctr_start(); if (ret) - log_err("Unable to initialise TrialStateCtr\n"); + return ret; - return ret; + ret = fwu_set_bank_state_trial(update_index); + if (ret) + return ret; + + return 0; } static int fwu_boottime_checks(void) From patchwork Mon Feb 12 07:47:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772032 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000621wre; Sun, 11 Feb 2024 23:49:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IEfsSwHAvutCuadTXebxf/M9XrfH/72W7m9kTmR9i29XAGGt8mpIOnJYz7gyeLwg/QOF+tu X-Received: by 2002:a17:906:6bc8:b0:a38:51c2:68a5 with SMTP id t8-20020a1709066bc800b00a3851c268a5mr4155976ejs.7.1707724161889; Sun, 11 Feb 2024 23:49:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724161; cv=none; d=google.com; s=arc-20160816; b=mYBjPlzqaTaYkkOvIFtn7j2W0aspdPsF+S6af7hCU0XR7TOzhZZ8hvsLIqVduvsbbZ 39J5r49Vg8Ci1lQuJvzYqLbB4WzhvUBV0izzKTRNO+JdTGiXZcqfej45nTjx50q3P3DM r23YfMr2W6vNS0nrk3ov6JxhdHD1pp+3pOYfZ5q9oV3HxBYGRWyhfq9r222Yim+Q6MLP oIO+3wrIkU7lP0JbzAt19dD8VhgkjWj2NjKeNTi1g1GKSxyAHMD/dqelRxUJ+S0Hpz7H ep5W8JzzWWdr0+VYHmz3/W9VkCztrIxiAGht5jZ2OWCH43pn3HKZcgCZEELnH/yxa3rD /4Nw== 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=hKfccGPwyQvSy6DW6EdrLAcho+TBMbk+K9vLaVSughg=; fh=fEg8tQO37IJtiU2MrYFwth8Mlwr8t5PaKaFCgOyFBo4=; b=l17vF0bCrhyrWtuVEpWIZRegtuJCAuJco7DjdjDKt8WWhwHmd1sqntCziQqhjqjwqB 8+ubi+fRJVCPLQbnWQZ+ScVr8bRaXEaTn59O9Deuf1M4NvKDlH2A0UKGw+Nvbiwsm1Mk hW8wZk9c+l1GqFaiPmubQRiD6MbRCsQZp94D08jrIAikn4lxOBDo6Oyh0R/7fEfJOALf BRMZLJniU1wWUJX/8tekWHC6/R2aNHxLlw2IJC2+SxHefKPh6uqM9CFN9RlFuIdUGrLR rPeBo+maoBcei3q7vBt5WaqNUickfDoBu3YUmD9KjZS5RZceg75UriQjfd6v/bsOkIN0 6OXg==; 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; AJvYcCUmyJ0pR7rkmbmBrFWUZ/aYZ+7VqATOMElTrjcy5bmOKsUgw6O+Rky1Pqucu5NwIzi2VYMuwH/hZYXG+MwuWRo02sZKvOpozeQ4G5cs6+Du58og+owtk6OrfcnjTf2/gC+CZe4j4Aes2A5Fxo5M52Rz8uhVgRnnJFUuucT70wGIOkjGPadPzqfOWWn9de6NePHRN+APN/ZvTIDRk8uiN6xoEcJwe7fWIMKJ5N0Z9RkrIZqnOBLlThGPmpRd/YX0T2hgNChOUDYvkjDWUd3kcFZcWYI3sFJ+QUxVLYryqFOU1WDWNb/WNYqBz2qWb7cPSm1SQQaPmXWklc9qx3+fafvrN/yxtne2SXtY6FfIcaf/ZCjsDcEPpiDoTUYptoDJ0XgEidu1vPFXjwxmyXdWU+/QAyPmox9CSca3k3v2eVtOe9/si2jQ3anscagau4Defl2wdofv6gNLsxVMJtuSZqiOlyt6QSsLDi+4yxE+IgwZJWcOK0pz8T91ooA7IrAkQg5EtnmLLz4qJVQRCASpQtGjKdWCuZ/0aRvz8c6ZxViJC5nbhbrk/zYqWEQbAVvUqsnM8qR+uK+qZlLIUwqWrJ5Ys1Yt2KEfbweobnrpm/oGCdMbhqXJbJj2yoJK2l6tmpH1bO/+EPHaix7nQbjGK1dG8pZMZm3GM8mMbwxq6SiLT4fhlSSTL+96mQbSjN4yLFJr+GXOmxQ6O8OpDO31ogkYqkti7/sjbkBYqivQ1oVyTCIAPUKONMHNXM6Mlg71R1rWG+eKZCKthjJQe3jpDXq/cb0fJ+M8Rv9miIjYTczrHekffUhHeLBtA3A3fXS4afKmYfMdb8urWb0w4CXsx6XBZjKOHAMR7rqQTPezQGo3Uhw= 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 x6-20020a1709064a8600b00a35dce64af7si3717465eju.211.2024.02.11.23.49.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:49:21 -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 3AC2A87EED; Mon, 12 Feb 2024 08:48:15 +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 9B9BE87EC9; Mon, 12 Feb 2024 08:48:14 +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 8072A87EED for ; Mon, 12 Feb 2024 08:48:12 +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 19555DA7; Sun, 11 Feb 2024 23:48:53 -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 4D09C3F762; Sun, 11 Feb 2024 23:48:08 -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 10/21] capsule: accept a bank on a successful update Date: Mon, 12 Feb 2024 13:17:01 +0530 Message-Id: <20240212074712.3657076-11-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 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 --- Changes since V1: None 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; } } From patchwork Mon Feb 12 07:47:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772033 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000665wre; Sun, 11 Feb 2024 23:49:31 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWNDhPqQyLvGjk2Lu8SZNndX8XpG7ulldgYypPd7TThv6mF5DSgUK8AvkEgsjwVW7X6Ij7YkjQCTxheRSvNqMHR X-Google-Smtp-Source: AGHT+IHUNadYsloKbbo4LLn84KgQwQjF+cLBvGl5V7ZwyaXxwYuciTj92G/b/gHvUTx0kL/zMCzV X-Received: by 2002:aa7:c909:0:b0:561:bcbc:7c96 with SMTP id b9-20020aa7c909000000b00561bcbc7c96mr1073213edt.31.1707724171052; Sun, 11 Feb 2024 23:49:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724171; cv=none; d=google.com; s=arc-20160816; b=D7iY0jP4FdMsiFi2RT6iWUoNSnSl2PAPz4K9gb+Z2zLjk/cgXicCtRDBF1BRc/76bC Ajk1eL3RG/2r+zICSTvWLuarciYo2JAKmzhSFKZS93/5VAS18ZKoDwBHVvhio5KQAzor jWn6+YV98GAh8slZbupyDay30xfsTxDs6BLzDL/ZxS+b6jQZU9npYOoOjWe0VfPVRZFY 11VHdItQPOEJozUJZahAaRxykRMPzU2d1MQYiCSHf1J2FXdds+OK/N/xJQLpLPtQLIT2 zlvVh7xQX6jLtHx+3JtK7c0k/BFrs8+dbhF/DNiqmxDKQCIZwME2USGSoRMkGc9eyS6C 7ZkQ== 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=diPQDN5UK8bhh35j/lvr2pLsl0ZFDbZM/AnS6aKR2gU=; fh=8tEjx/KtaLOcnAbiIAsn0D0GchDv2Ez4lJrbnoRR0eA=; b=utco2nlnY8r6DS3UVmUbPqS3/bXTTyDxDRgCNAR83i2FkffHryzXJ3s3rVnzgsDqHV q6AHqtEhLANV56pNUZB/fYYfrU5adMPXaDRWyHHOSGMj4o580qJiMGgWGjQd/oUrHYf2 l4EnaAA9L0VvZ6tyvXytkDCCuigsdpt5slSMJMo3jPqs/9bCLBubLtmmU2TaLgHjDTaa ylRWxTI7Z0fAbYBos3235dFvXuvI6Qp6cOZcodHkjvWsU2MYUbIUSQ9/z2VR8ZjFYVyz i/cZJv+REwfm5ZMxf2IL7TO8UFxIZHsFPNJvR58sSw9hHxYFX1sqsqyfGMERYZJwZk0A txnA==; 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; AJvYcCUR7aeaw3SIpSwOpln2SkrBW4lrN9jFUmVIRyu5jqdI1OLE0Uj4sJJxbPcehWFFvjfrqT0W4EclMx+6U49ct4U3eyBuk1Lmv1Ad832O2w9NjaFs6GaZbjn87+iCeV0zvjhhNMkeca7Low+gcjCBuupYSG0sUm3BE1GKOaochz0oHgFfjvMCaFYuPXPe3Pc6HvrYbe1XQmplWEA+AEg5Z/st3z0h0GOPJLXW1IH/FHEz6HS4Fn7YbnJ83jfC6kf23qiwQIqDaLeR2cVnPUzxGamq+aLtiVKbA/PukRacILosFvKehvCnh+uosp+Nwtokk5+5gwJ3+n9LWWyCgv1R/E4wO3n2NBx3bfh4WnuBXtg1bgi+0busgWyQ4pghF/tgZIqHTfcCTIgujM6YkpPeLS9XDVTK3MIh2tIxVgkryfOfi/0F90nO9zhyoXSWq9FlAwIPHasFXojz7nKGzAfbbPanxHNh6cSFCp07o1iW3KF3UL+IcfhbAtBU86XOkkxmSNSeEAlCRgNxTP5TEpYg+YkbNgyh5wbGak5ik7FZVxdUTWB5Skwo0XBELnv5kZKxWODMduqDMoy31Yyv+QLkNq8QGt26F1IFM/COJ9JOaBGvqERmDD4SBgSYIsVa27arIzkffC+ib4Ga7h93jij9WosMZN/iKAC4TcaA0Zg2EnTQAv+cjAeX9Q3Pd9tqE3xTUyhlxvXCa4cCDHqV0tID34CDWgF5U1L634RSAd2dV96JMM2CSDQyvbgpdyTonVVSiLVxuEN9uf9Ltp9/HEWvBNpCXRHI2TH1TzFUyrpvU0sHwV6H7OgNK5E9CfmH43mvBCTQ3aBF91RIVlm2qvIcMWe3VTkKPmj7peKpK3W5UeUuav0= 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 i10-20020aa7dd0a000000b0055fed500e30si2481191edv.677.2024.02.11.23.49.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:49:31 -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 6EA9487EF2; Mon, 12 Feb 2024 08:48:19 +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 0059487808; Mon, 12 Feb 2024 08:48:17 +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 C4C9587EC9 for ; Mon, 12 Feb 2024 08:48:15 +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 D0579DA7; Sun, 11 Feb 2024 23:48:56 -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 0F7AB3F762; Sun, 11 Feb 2024 23:48:11 -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 11/21] fwu: mtd: modify the DFU API's to align with metadata version 2 Date: Mon, 12 Feb 2024 13:17:02 +0530 Message-Id: <20240212074712.3657076-12-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 Make changes to the functions used for generating the DFU's alt variable so that they are aligned with changes to the metadata version 2. These changes include getting the number of banks and images per bank at runtime from the metadata, as well as accessing the updatable image information from the FWU MTD driver's private structure. Signed-off-by: Sughosh Ganu --- Changes since V1: * Use the helper functions from the previous patch to access the image information in the metadata. lib/fwu_updates/fwu_mtd.c | 81 +++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 20 deletions(-) diff --git a/lib/fwu_updates/fwu_mtd.c b/lib/fwu_updates/fwu_mtd.c index 69cd3d7001..50ff0d692d 100644 --- a/lib/fwu_updates/fwu_mtd.c +++ b/lib/fwu_updates/fwu_mtd.c @@ -15,16 +15,51 @@ #include -struct fwu_mtd_image_info -fwu_mtd_images[CONFIG_FWU_NUM_BANKS * CONFIG_FWU_NUM_IMAGES_PER_BANK]; +static struct fwu_mdata *mdata; + +static int read_mdata(void) +{ + int ret = 0; + u32 mdata_size; + + ret = fwu_get_mdata_size(&mdata_size); + if (ret) + return ret; + + mdata = malloc(mdata_size); + if (!mdata) + return -ENOMEM; + + ret = fwu_get_mdata(mdata); + if (ret < 0) { + log_err("Failed to get the FWU mdata\n"); + free(mdata); + mdata = NULL; + } + + return ret; +} static struct fwu_mtd_image_info *mtd_img_by_uuid(const char *uuidbuf) { - int num_images = ARRAY_SIZE(fwu_mtd_images); + u8 nbanks; + u16 nimages; + int num_images, ret; + struct fwu_mdata_mtd_priv *mtd_priv = dev_get_priv(fwu_get_dev()); + struct fwu_mtd_image_info *image_info = mtd_priv->fwu_mtd_images; + + if (!image_info) + return NULL; + + ret = fwu_get_banks_images(&nbanks, &nimages); + if (ret) + return NULL; + + num_images = nbanks * nimages; for (int i = 0; i < num_images; i++) - if (!strcmp(uuidbuf, fwu_mtd_images[i].uuidbuf)) - return &fwu_mtd_images[i]; + if (!strcmp(uuidbuf, image_info[i].uuidbuf)) + return &image_info[i]; return NULL; } @@ -107,8 +142,9 @@ __weak int fwu_plat_get_alt_num(struct udevice *dev, efi_guid_t *image_id, return fwu_mtd_get_alt_num(image_id, alt_num, "nor1"); } -static int gen_image_alt_info(char *buf, size_t len, int sidx, - struct fwu_image_entry *img, struct mtd_info *mtd) +static int gen_image_alt_info(char *buf, size_t len, int idx, + struct fwu_image_entry *img, + struct mtd_info *mtd, uint8_t num_banks) { char *p = buf, *end = buf + len; int i; @@ -123,15 +159,15 @@ static int gen_image_alt_info(char *buf, size_t len, int sidx, * List the image banks in the FWU mdata and search the corresponding * partition based on partition's uuid. */ - for (i = 0; i < CONFIG_FWU_NUM_BANKS; i++) { + for (i = 0; i < num_banks; i++) { struct fwu_mtd_image_info *mtd_img_info; struct fwu_image_bank_info *bank; char uuidbuf[UUID_STR_LEN + 1]; u32 offset, size; /* Query a partition by image UUID */ - bank = &img->img_bank_info[i]; - uuid_bin_to_str(bank->image_uuid.b, uuidbuf, UUID_STR_FORMAT_STD); + bank = fwu_img_bank_info_offset(mdata, idx, i); + uuid_bin_to_str(bank->image_guid.b, uuidbuf, UUID_STR_FORMAT_STD); mtd_img_info = mtd_img_by_uuid(uuidbuf); if (!mtd_img_info) { @@ -150,7 +186,7 @@ static int gen_image_alt_info(char *buf, size_t len, int sidx, } } - if (i == CONFIG_FWU_NUM_BANKS) + if (i == num_banks) return 0; return -ENOENT; @@ -158,24 +194,29 @@ static int gen_image_alt_info(char *buf, size_t len, int sidx, int fwu_gen_alt_info_from_mtd(char *buf, size_t len, struct mtd_info *mtd) { - struct fwu_mdata mdata; + u8 num_banks; + u16 num_images; int i, l, ret; + struct fwu_image_entry *img_entry; - ret = fwu_get_mdata(&mdata); - if (ret < 0) { - log_err("Failed to get the FWU mdata.\n"); - return ret; + if (!mdata) { + ret = read_mdata(); + if (ret) + return ret; } - for (i = 0; i < CONFIG_FWU_NUM_IMAGES_PER_BANK; i++) { - ret = gen_image_alt_info(buf, len, i * CONFIG_FWU_NUM_BANKS, - &mdata.img_entry[i], mtd); + num_banks = fwu_get_fw_desc(mdata)->num_banks; + num_images = fwu_get_fw_desc(mdata)->num_images; + for (i = 0; i < num_images; i++) { + img_entry = fwu_img_entry_offset(mdata, i); + ret = gen_image_alt_info(buf, len, i, + img_entry, mtd, num_banks); if (ret) break; l = strlen(buf); /* Replace the last ';' with '&' if there is another image. */ - if (i != CONFIG_FWU_NUM_IMAGES_PER_BANK - 1 && l) { + if (i != num_images - 1 && l) { buf[l] = '&'; buf++; } From patchwork Mon Feb 12 07:47:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772034 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000695wre; Sun, 11 Feb 2024 23:49:41 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUcyG6reU1oNj1wu+EZTTRmtSWRW6COsLDIFjTVtbS7wqTivEV2Ns5PRzl09ZMBPf15AL2qjWub8ev3meWP6quh X-Google-Smtp-Source: AGHT+IEDhPQB/sPd6bx3Hc2Y0aSvIy0lfjxPaWqJkc+nnObcTk2Jdz7uvsD+vqBPVJQWnaR/Dv+m X-Received: by 2002:a17:906:d79b:b0:a3c:d669:648e with SMTP id pj27-20020a170906d79b00b00a3cd669648emr30477ejb.16.1707724181308; Sun, 11 Feb 2024 23:49:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724181; cv=none; d=google.com; s=arc-20160816; b=LJGqYV0mFAqid1D5rpXFm8o1s3Yn4/0++jYsgEyXCVRDByqLcCAPfwPazKIkK8MyAg sZ9ygG2r9uhWiPAQpLM4oIdOeahfj+5XSef3g3xxqTQOzRpTcPr1H91vuF5V1FcQdbS+ l0WqHN3TWfdob8394mG/6KOuytwo9VqQ4z8Uqbalutv+7TVdtiNOK2v0eWyxSgWCLJQj TXiGUhC3IiuCVbk80qljRDRXkPID4DWw+hMn94eYHRAu3F3istdJCOA0pcj+gBQqswsf N17wqWyf0xIGb2ePEvsrlcTParfB9r8YkH97imLcGXX4AuIV/czDZP0+uh+nAxP2GCGe 7WDg== 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=6dTfX3T/fzKLmXNKrhikrLjgpNsSVllz0jeu7/hYWB4=; fh=aMrBxOJtx7G6Wdb1F9P9GwUflynnJIk9KvO7AsKsxGQ=; b=dJYUdO1vt1NplhJ6hCV+6ixsTkx9qXSbwMpkqX/zz7pjp+9UwjtYxR0SXyQH51EeVd b1qDFnVOguKJtsHVxNqZ+DYVFatSuxQsIyW/AZ72QVrSKV8RCwm2gejlZbjfxo8kKxTf EFORr5kbOUDUhZOapquuf6mu6NRhRGNjLmog70O5A5akTK/YS5KCfq77t9KvTpSU10kt SFcM38kzQO0vk5NTwUeFRcziNS+q867Wavi5z1JWb2K2Hm0TlP3xZQyEpQNeJQ1KReMx cKWAkv9Pvwuwgz9tkAtePJesUzF6l5TxVJNAbEhzPwRi5wtb99d5Vemm6+euYUI0kscq eqog==; 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; AJvYcCUf0l1SCeO5c4e8cr/nAu74KrfAEVYBYPfLb8Ia1+BT0FqMmoscH43wdBux1CidU1zVbJOkJiyJSKjpLXp6e43fI4BCAhYw5/sN3M0EyFzb+NSqxgkW3gt5cgDjAE7t+w9V9ibpRqnGq8PJM28ur/bEZYOW05Hu+MooCt/+fkhj9GjS+yDmt2cqRWfq8o5RtXlAkQnAhM3s/PSxd+wT7BsO8HjTPBIRAsa5wCv2CMt5URj0TVINzRv9pOUqAirkzJeA549nfkOTM6zRhqZr6xr/6dX/Dga0ZGvO9pcQymIyV1B/IW87uTPxsyAazn1eQzH3L5LMVqZRigPpCgbO6trRMU+mpj4gnaT6axnAdPzo2NoEgYOn1R5/h/rey1qDX8XNISpK3zwWQe2WmxJ/p/RF+QkRkCZXgi697b+H2x+APdFOTuwwoSsPwGihfuubvFA/4ULvpxWEGDh+tbeteV191/XaMpKgm3WFgu7svzzxuYJAE9XaoYF6P8eEibYbV9EX7BalcLN54OyO5VV/KLy7a16NQdasH6Yz2LAIMNvQIanKSzpHsaxMcwbQbD2S+xtR0Ovg/eq+dWTA5F2zWK74tqFjH1rpnOF7Mk+AP2Qp4M3WpmdRGUg8Ojyq0cd++4wlX1KmvcyKsF5rf+WUW1wIpCzV+GjMKW1A0ktYl+hBaR4Y/Xyl0+rhePzcQG8SPLbADi95eB9i9SdstPbrky5kHQm54WS704V4pJt7+Vj4au9FzhSziEnMzkrRswaGYhwNeSDM9+c1CsuX3vnzSdRLHYtneK7G/heF14LarZzpKikAp2+V9JrOBK5SFlZcqYE2lqEyPlkTV6fDdTaocTWeBWM7dJEt8x1ccTHf0WKJj/s= 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 k19-20020a17090646d300b00a3bf0da9219si3265334ejs.1020.2024.02.11.23.49.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:49:41 -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 089BA87E52; Mon, 12 Feb 2024 08:48:22 +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 852D787E52; Mon, 12 Feb 2024 08:48:21 +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 84ED587EFD for ; Mon, 12 Feb 2024 08:48:19 +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 92CF6DA7; Sun, 11 Feb 2024 23:49:00 -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 C6A543F762; Sun, 11 Feb 2024 23:48: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 , Michal Simek , Jassi Brar , Sughosh Ganu Subject: [PATCH v2 12/21] efi_firmware: fwu: do not read FWU metadata on sandbox Date: Mon, 12 Feb 2024 13:17:03 +0530 Message-Id: <20240212074712.3657076-13-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 FWU metadata is being read for populating the firmware image's version information. The sandbox platform does not have the FWU metadata on any of it's storage devices. Skip attempting to read the FWU metadata on the sandbox platform. Signed-off-by: Sughosh Ganu --- Changes since V1: None lib/efi_loader/efi_firmware.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index ba5aba098c..c742e23268 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -223,7 +223,8 @@ void efi_firmware_fill_version_info(struct efi_firmware_image_descriptor *image_ /* get the fw_version */ efi_create_indexed_name(varname, sizeof(varname), "FmpState", fw_array->image_index); - if (IS_ENABLED(CONFIG_FWU_MULTI_BANK_UPDATE)) { + if (!IS_ENABLED(CONFIG_SANDBOX) && + IS_ENABLED(CONFIG_FWU_MULTI_BANK_UPDATE)) { ret = fwu_get_active_index(&active_index); if (ret) return; @@ -391,7 +392,8 @@ efi_status_t efi_firmware_set_fmp_state_var(struct fmp_state *state, u8 image_in efi_create_indexed_name(varname, sizeof(varname), "FmpState", image_index); - if (IS_ENABLED(CONFIG_FWU_MULTI_BANK_UPDATE)) { + if (!IS_ENABLED(CONFIG_SANDBOX) && + IS_ENABLED(CONFIG_FWU_MULTI_BANK_UPDATE)) { ret = fwu_plat_get_update_index(&update_bank); if (ret) return EFI_INVALID_PARAMETER; From patchwork Mon Feb 12 07:47:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772035 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000732wre; Sun, 11 Feb 2024 23:49:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IEOUWcP93MLG+D3KGAxaHybtDN2AUadlzbdT8HsgeD2DQlmZ126mf+J12oNdl4jciyg0P16 X-Received: by 2002:a17:906:fb91:b0:a3c:8e78:8b59 with SMTP id lr17-20020a170906fb9100b00a3c8e788b59mr2185865ejb.15.1707724190475; Sun, 11 Feb 2024 23:49:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724190; cv=none; d=google.com; s=arc-20160816; b=yopa4cm0SOVyqZ+YQPh5qxlYAksK18hafa5SawjJAC/s11G7UAHF+xQ2b87x00WmTd LZke6e90RLFJTKd1ojpXSA97JpfPznnyKd9bjPRSJDoLzLLh1G77CO8xlHZ26moT5vh2 1rGa8EODgOE1lRroU1uApH80RqV38uO/dyCqjT9tSPjVcJAgJb0Ji3u81j1hZHy6M6GA 496VvLa5KWqkw8/Y5eVRidf4iulrQ7/1DKZzG2wATeGM7Wf/1kU/61S6az3WJNqOabXa 8wZgM41vmb8Hk0F+BnTcjXisdnKe5TuukTCyiTwmSeCqG0D4zpwIZA57ON/0wFLxOSB/ TO4g== 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=XQ+Je8cNHWJ3PTly8nrDE2q4TQfl8iwdG+2xdTCcAcU=; fh=D3bFdOmJcMUdGZFNSA+qVq0LaWny8rzHVSf56m18rSw=; b=T/Ay8vL7Y8rKMue7FGX4rnipq1C9EXA641GPbEdJGY4mpktO9Pb8Uuf2Zedpem3SHB VdQqzoT/oNuaZanbFvXzWwGbnAfDk0yW4krz5tvyejfVhXG5JjQCWvTHp1g1ExQDuBwK Kyot1U1zn+c+NGLFRMKEUfd17C87WjvI6ucVQKWOHuuWuRpB6fmFYsV11wr2Q1Lbk2Fi GrHTfzSSMiv5cYtgPNJhiznc+OmJkDXVTIf0VowrTWxqQWN0CRuS6eodndOFPJOLoE5K 0hG5fD1wXL3WYd2p+4yd+XLYbf3W8Pm79ipxc9ji/khtFMUCrBBwwJ8KipBX1xgmR0RK yiiQ==; darn=linaro.org 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 X-Forwarded-Encrypted: i=1; AJvYcCXG+X79gZReMqmY70TGI4qw1fnjwVef1GOt62AyrYKvXEZV5BmC51bgVlTzlA5ZtIXSxNTEkXuAe05CxkdZ09OcLxiddG/Ha44bG4Vwmm0UQtBT2N1ctwN3CsijXvn+s/vpsmkRLqqyj8CmyVqFLBsvf+ZZn27FDsirZRojy9QIgWNWXG/HetUsQ3cilNNlO3puNuzR7S0i37kxIf7DAes8aYzRqiVI2KPSrU5pnlghjX7J5TMo5kppY0v/Mfy+wKUJkC6tc9ou6t7N6joYAe3x0VRSOU2Ti2PWw7tFC08lGtTjwxPiKJmHRjhzuYGwGnRAdqxYb6FR01N8rNUdMIDcM8zGFhrRmeSDM6uuGexQ6jrIRltlj/p8FmJOvAUOHRv12Gk/t8gzL+Sbhwz0CAUOa22Hfywc0cAaquRsoAqxCDKGUgkQBgik2gJrV0mAWaKGWuynVQuhnhYPXv+6BT9q7Rmml5YWKALJE9boaqOj73uPFYuiyANdiLOvogw9rSsacfW7oJS36T0PZlxByGKdIhIx1Ej2u4AQoXPqWN2EnY8wWpxhixUdyXqq02SFfzRWu6E1BJitjdXa/em4bmswtlmtYgpRbadwJO164K5YD7mLj600dvE0Cadof4amlHIFWY6wldi6fCag95CJljcdOCxXxTTO5s6wtLCSB+/teaxtR67MPYI5Eek1yDO+uoPJugrz51OBQrrUR8mv20COUnYk/qNCX+3ht4vPXCEuk3cNAZ9JUxYOE+SDTH0pBph98FkjXiDLCuK+qZjFt046A4QvX8emnow8niv5phdx5eB2fjidooCwv64nBQGSuF9fX1RHQ/rq2HT6/x0mgAPjMpvM2NnEuT+lYiMsxwyDFwU= Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id y19-20020a170906559300b00a3723f1f1c3si3700038ejp.33.2024.02.11.23.49.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:49:50 -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 8384A87EF6; Mon, 12 Feb 2024 08:48:26 +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 4353C87EFB; Mon, 12 Feb 2024 08:48:25 +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 4A00687EF4 for ; Mon, 12 Feb 2024 08:48:23 +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 5652ADA7; Sun, 11 Feb 2024 23:49: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 894473F762; Sun, 11 Feb 2024 23:48:19 -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 13/21] efi_firmware: fwu: get the number of FWU banks at runtime Date: Mon, 12 Feb 2024 13:17:04 +0530 Message-Id: <20240212074712.3657076-14-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 With the migration of the FWU metadata to version 2, the number of banks are now obtained at runtime, instead of the config symbols. Make use of the API to get the number of banks in the versioning functions. Signed-off-by: Sughosh Ganu --- Changes since V1: None lib/efi_loader/efi_firmware.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index c742e23268..26d2916ee1 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -207,7 +207,8 @@ void efi_firmware_fill_version_info(struct efi_firmware_image_descriptor *image_ u16 varname[13]; /* u"FmpStateXXXX" */ efi_status_t ret; efi_uintn_t size, expected_size; - uint num_banks = 1; + u8 num_banks = 1; + u16 __maybe_unused num_images; uint active_index = 0; struct fmp_state *var_state; @@ -229,7 +230,9 @@ void efi_firmware_fill_version_info(struct efi_firmware_image_descriptor *image_ if (ret) return; - num_banks = CONFIG_FWU_NUM_BANKS; + ret = fwu_get_banks_images(&num_banks, &num_images); + if (ret) + return; } size = num_banks * sizeof(*var_state); @@ -379,7 +382,8 @@ efi_status_t efi_firmware_set_fmp_state_var(struct fmp_state *state, u8 image_in { u16 varname[13]; /* u"FmpStateXXXX" */ efi_status_t ret; - uint num_banks = 1; + u8 num_banks = 1; + u16 __maybe_unused num_images; uint update_bank = 0; efi_uintn_t size; efi_guid_t *image_type_id; @@ -398,7 +402,9 @@ efi_status_t efi_firmware_set_fmp_state_var(struct fmp_state *state, u8 image_in if (ret) return EFI_INVALID_PARAMETER; - num_banks = CONFIG_FWU_NUM_BANKS; + ret = fwu_get_banks_images(&num_banks, &num_images); + if (ret) + return EFI_INVALID_PARAMETER; } size = num_banks * sizeof(*var_state); From patchwork Mon Feb 12 07:47:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772036 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000759wre; Sun, 11 Feb 2024 23:49:59 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWlyVqhLnH+xuEE9z9ygOuaUGH0D86rW7AugRDtQ8dsApKs6DwJEJsrzNN/8gzg4Mj2CeM6YT2q2GTuLes0Ynvw X-Google-Smtp-Source: AGHT+IF166ptPH5zzuuB+gFJykN4pF5QwFDSiFfXsgMfqWVrZStUbxTe843sGUoE6p1SiG1Ox5+j X-Received: by 2002:aa7:df13:0:b0:561:ae42:cb20 with SMTP id c19-20020aa7df13000000b00561ae42cb20mr1390861edy.9.1707724199651; Sun, 11 Feb 2024 23:49:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724199; cv=none; d=google.com; s=arc-20160816; b=EmignItzjstY9ljIRpzzY1C8hS2l+9DDYm9NP0AtysOM8okeFCYGTyoqTkqDy7aKmm S2GKVIdWCckHiV4ua4H6fKihyz6+ba0qexRmgZ8lH32INN1bQz/e52ve8FvKUo9OShwA TctFnDSwKBaLjLS+Hpai5ht88m5uTgje7ck13mTaozlm/8P0rsfn7hD2yOQ6EI+to560 papGwrRVTdE/1mx1i8rNyxRQTF9MwJVS/I2CMUl+Ek1zYasop8YVEUVMvSENIRUdfbHH VccSWHmKFHtOpcIpSZ2aM70iwnDp8+Es/LhrN8AaGH0Cbt8LmeA4sSP3CLEsLTQljcOl GFEA== 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=1yg+H6nLcbECGH1uXclyW7334eWKM7pEeGu+CKtmCss=; fh=UvV102NEPPkYo5FFCG2E/6Z0JAhYBuQKPP+ICMvC3n8=; b=tK/MAqAPLtCZE28jgxxjkniGK9Ny1fTDYvntiZSUFMaEuRH4avVlABBjO8yUPS2X2u MuxthhXVaFfrKwl61tUHU/juKre3no8OtGaDw5idMkUyYcuoFZ6uLbWN3JyHUXzUxZCI YWvMD8TfAYRmRAsSBhi+4exeWuyB/JC78SgmLSZ39RkpGqRxRuQHme7SyiBz4iJPAF0x 8D6UrNImd1l7oH+jgRiv2/pVUgzNwU3FvyP8Z/iydZ7IB8CUlcveT6eKdK8CJqxftON+ An8KXocaJmwfSy6Sru1XypjQiJPFX/+wBfop+zF5KY1bBUrlksCADj2F1RJmqFxioUp9 mxNQ==; darn=linaro.org 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 X-Forwarded-Encrypted: i=1; AJvYcCWR9+smPW3pNg/gNmeIGgNwVD3SYxLNY7b3Zlg3L1gGnlzMocaiowxaBUPE2Mukq4Q3s/FFqUrGa8UFTr3WQSKwquCV/I1MN4i+tGJV5dv97yg5JYEkuXJ5cNzAW0XKLAoqCcuCkH6HpUgpcFFBYE1Psn12c/JMu9awu3m/E9V0najNkkNHdlO6GlnRpubce5NX5aDRmEx1nIwC45PYh7FZvC8igq0V5tAuvWYTtEXcZGnMqXDqWC/RaHqACdJwYXZyT9Xl6HEfrPMl3szGLVXHnejU46jL85kpb/iAmEdAA2SvyOccp0zhmcUmGk+CL6GxS6O1MgxETD4prr4zHo6hUNP+sYGCg0ZoK6VDt6f6RCo7VBznnLE4o+TknSDga4j+g74zNGlIwH2MM+IghEDtASEvJ/Zm9+b/A1SIES1rA+x2SR79j6ekka5ZHb3ueKgp+eGrE/bq6yPN+vaHZLHtQ+y9jnpkpH76PwbWcodYr3VyqP1pLxGMR8QIVwu5Qe2BlNKV7bg07CnPSe9jTqMKY5WYLeOi2oEt4h5clRJWSqw9JSZ05OW5Fcc+V4iclw0i4vvPvfdqW9w6GV/HvKhk3owWQa5fd0T0B0hEUoweJ/MoLObGKjS4GMyy2oOuLx7mXCifUfH3wr+iQ3RNR40GOhg+8M0ZTyKkUuA+sfSxQ4bxuwoBqdTBJUD/MlAivSb/RJo6LG2gftau/kogDb2FiHiTAESKxxP7gMiOps0EVL7K812SckzdMiq85etOPhpbV+UgtoS7KVCjsuwQAcR0TjwruSZIAOkPGftYiWOmH4NXgZVmqUd/jM+1hN3t3tu9AGd5WBxViVANz1JFMCGtTLxJ1MhSpaOmKh3wZdsaWhQ= Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id x20-20020aa7d6d4000000b00560ef5203cfsi2428923edr.98.2024.02.11.23.49.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:49:59 -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 05D6087EF7; Mon, 12 Feb 2024 08:48:31 +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 4AEE487EF4; Mon, 12 Feb 2024 08:48:30 +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 0BEA987F06 for ; Mon, 12 Feb 2024 08:48:27 +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 186D8DA7; Sun, 11 Feb 2024 23:49:08 -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 4C67F3F762; Sun, 11 Feb 2024 23:48:23 -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 14/21] cmd: fwu: align the command with metadata version 2 Date: Mon, 12 Feb 2024 13:17:05 +0530 Message-Id: <20240212074712.3657076-15-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 Make changes to the fwu_mdata_read command to have it align with the metadata version 2. Signed-off-by: Sughosh Ganu --- Changes since V1: * Use the helper functions from the previous patch to access the image information in the metadata. cmd/fwu_mdata.c | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/cmd/fwu_mdata.c b/cmd/fwu_mdata.c index 5ecda455df..6d5ed7a187 100644 --- a/cmd/fwu_mdata.c +++ b/cmd/fwu_mdata.c @@ -16,6 +16,8 @@ static void print_mdata(struct fwu_mdata *mdata) { int i, j; + uint8_t num_banks; + uint16_t num_images; struct fwu_image_entry *img_entry; struct fwu_image_bank_info *img_info; @@ -25,15 +27,22 @@ static void print_mdata(struct fwu_mdata *mdata) printf("active_index: %#x\n", mdata->active_index); printf("previous_active_index: %#x\n", mdata->previous_active_index); + num_banks = fwu_get_fw_desc(mdata)->num_banks; + num_images = fwu_get_fw_desc(mdata)->num_images; + + for (i = 0; i < 4; i++) + printf("bank_state[%d]: %#x\n", i, mdata->bank_state[i]); + printf("\tImage Info\n"); - for (i = 0; i < CONFIG_FWU_NUM_IMAGES_PER_BANK; i++) { - img_entry = &mdata->img_entry[i]; + + for (i = 0; i < num_images; i++) { + img_entry = fwu_img_entry_offset(mdata, i); printf("\nImage Type Guid: %pUL\n", - &img_entry->image_type_uuid); - printf("Location Guid: %pUL\n", &img_entry->location_uuid); - for (j = 0; j < CONFIG_FWU_NUM_BANKS; j++) { - img_info = &img_entry->img_bank_info[j]; - printf("Image Guid: %pUL\n", &img_info->image_uuid); + &img_entry->image_type_guid); + printf("Location Guid: %pUL\n", &img_entry->location_guid); + for (j = 0; j < num_banks; j++) { + img_info = fwu_img_bank_info_offset(mdata, i, j); + printf("Image Guid: %pUL\n", &img_info->image_guid); printf("Image Acceptance: %s\n", img_info->accepted == 0x1 ? "yes" : "no"); } @@ -43,19 +52,35 @@ static void print_mdata(struct fwu_mdata *mdata) int do_fwu_mdata_read(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) { + uint32_t mdata_size; + struct fwu_mdata *mdata = NULL; int ret = CMD_RET_SUCCESS, res; - struct fwu_mdata mdata; - res = fwu_get_mdata(&mdata); + res = fwu_get_mdata_size(&mdata_size); + if (res) { + log_err("Unable to get FWU metadata size\n"); + ret = CMD_RET_FAILURE; + goto out; + } + + mdata = malloc(mdata_size); + if (!mdata) { + log_err("Unable to allocate memory for FWU metadata\n"); + ret = CMD_RET_FAILURE; + goto out; + } + + res = fwu_get_mdata(mdata); if (res < 0) { log_err("Unable to get valid FWU metadata\n"); ret = CMD_RET_FAILURE; goto out; } - print_mdata(&mdata); + print_mdata(mdata); out: + free(mdata); return ret; } From patchwork Mon Feb 12 07:47:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772037 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000813wre; Sun, 11 Feb 2024 23:50:10 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWlXNCLRKouLQRcwIhbxuwF/J/9FCHbxuB/SFM3/ihAPb155gAkNaL5ECKp7uHoYTEgcbH8/Wk0WlOO7Rz1iAPX X-Google-Smtp-Source: AGHT+IGP+K5uKRi/ZoaAs+Axg6rVEkmArhjNSaqMSFonZe/1pW14kt7ObUTwQQTptcw83qviLJU4 X-Received: by 2002:a17:906:2787:b0:a3c:c451:2115 with SMTP id j7-20020a170906278700b00a3cc4512115mr439212ejc.77.1707724209996; Sun, 11 Feb 2024 23:50:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724209; cv=none; d=google.com; s=arc-20160816; b=fP552jMiHYIZQlbHP7HF1jOOuxBQIQKwMPTB5D26RsdMJ76kd0rl3xVLubwk/hHVzr ZozRsOMwlhBuLv56kqGLmqleLHNyX/qkZt0xxoNzvbAP9NTvUlUAmlvtNb87xIor7l34 bwo8rxXwaNLsBcKGEBY6ksl7UUf7HsW2v6y1QR1W4s4BH8+n1lntc0MrKCgM0ifSbGEb 0sVWoyE67brc3w5ncxL+3wRDgRlODXdJZ5Fmpy7pAofoGElZ6Wd170nhGTn/OvFlHVaD tLOIehXtWZsuV+m4peOXMILVrgd3bsqH8j0nyg4WaQNqj3IY7nK3RCXoJmEqi24fZuH+ Y5pA== 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=4kj8hfnlgF2+ZFBvqI09I9XqU66x2HrKdA5VCUFrUOs=; fh=CUhVuoCrNmjWwy43aX97ykL2KqCRiJmVYRnHRuXErhE=; b=xsLBnqKhf2YY8ReN4zAS/676fDZAaavkR5Y9MRaD38eenqEFoMwNk0W5T0lTaxRnZQ CUG2wNjqAyCVxILYbMpjfxIiZizFZTAS5CkVpTFuCJTpOvixkWklD5aiZes95pGwxIAF JGZbTb+lGNYKDDCnvkFkbrxlnpt00iJRPckyZy1Y85FToNbt+xEWkcJV69JbMc3XzuVt gnbhbY888qNBVTMFE10OV6VGv+vYGzUqi8h+SJfVNvklaKnjuM3288/6KJGVmtTZCuoJ 5PUQtn5FE4Y96IxiMjIpe1mfBrVa/il/OxClyU+Z1WCuAXfMusow4FuzGfDp61HaKw5l m1JQ==; darn=linaro.org 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 X-Forwarded-Encrypted: i=1; AJvYcCXMY+ThGXMq0X4N90XdJgFGe1QEkRNCOl4xXry4W/ljxjjqAli34IJNze59ESDrmZd4n8HN2QaUB53vOLqd5S3dSM6911V3ek5fJwNXm44Z1dnlaFEOyhacSP+/WFvq5msi4b3XgrgW5Na7hkPcYY5MAn+cpWghKE044aJxaFtgug63+sDnYgstvIjUi1UT7edEjUU8U/OQG8bEWNk4f4z4GInDN58WHforPm1wFmnni6Evz0Q7PKNTxlbBLVhnpfaT14HvIKX/GdK7op0OTrjVh04yzThR+hDe/18f6HWr+rDI1xLaddBhFRx7FtgtBX/eZKnSqF7r2mGrGoqqnWXxsOLvrdXrmnwXYNqGp3ejPU/oUkx5YBA+hfufoQGFKvz3d4uhoDu7Z48CzNrjaUH16ASXNC0O70gNojgrpJYFTgBtLbsdxB3RpdEi7Gz0GSIdP9sh+k1ZGUkhoZyaED1x7q/6HmeXVHV9yTY6dZsk6Oi9eDRHcHCijdHNbrId/4p5Ek3kNDH/nvvUNKECtyi/fCsr1HcXreRIzSgm56iU+6XZ8Q+oJzeRggzc1Eg5m89S104RhJFVKuSfdJMssO/KxKIWU/UYHSbGYoQaNW5hLD+MNAqW9yHjtOV6RgGuNeuEL/fo69E051KDdsYqCA6Tg8s92th5E7tlxKvI1A64n5/n3qhCoGVvmAwHQJDRyArrY/DUJK6Jou0T9A7ETUrnNL624uMs/Zcdmyf9zJtwFu4302NhQlBwrmFDIl9rOuZ7DV7GAX5UbHhY2BttOc1iJWpvtW8YP0OqdLUCuA9le4wvUGeIz3B7UjP4eBEMlOfGcWdNmOUr5zRp8jlML5KPQ0ikqa4EkAp0vLEPitB4wpU= Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id v25-20020a170906565900b00a3c7d1eb3bdsi1223952ejr.644.2024.02.11.23.50.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:50:09 -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 9E51487F02; Mon, 12 Feb 2024 08:48:34 +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 3A96A87808; Mon, 12 Feb 2024 08:48:33 +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 C480A87EF4 for ; Mon, 12 Feb 2024 08:48:30 +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 D0290FEC; Sun, 11 Feb 2024 23:49:11 -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 0EC2F3F762; Sun, 11 Feb 2024 23:48:26 -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 15/21] test: fwu: align the FWU metadata access test with version 2 Date: Mon, 12 Feb 2024 13:17:06 +0530 Message-Id: <20240212074712.3657076-16-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 With the FWU metadata support having been migrated to version 2, make corresponding changes to the test for accessing the FWU metadata. Signed-off-by: Sughosh Ganu --- Changes since V1: * Use the helper functions from the previous patch to access the image information in the metadata. test/dm/fwu_mdata.c | 56 ++++++++------- test/dm/fwu_mdata_disk_image.h | 124 ++++++++++++++------------------- 2 files changed, 83 insertions(+), 97 deletions(-) diff --git a/test/dm/fwu_mdata.c b/test/dm/fwu_mdata.c index 52018f610f..cbeceaee93 100644 --- a/test/dm/fwu_mdata.c +++ b/test/dm/fwu_mdata.c @@ -88,10 +88,15 @@ static int write_mmc_blk_device(struct unit_test_state *uts) return 0; } -static int dm_test_fwu_mdata_read(struct unit_test_state *uts) +static int fwu_mdata_access_setup(struct unit_test_state *uts, + struct fwu_mdata **mdata) { + u32 mdata_size; struct udevice *dev; - struct fwu_mdata mdata = { 0 }; + + ut_assertok(setup_blk_device(uts)); + ut_assertok(populate_mmc_disk_image(uts)); + ut_assertok(write_mmc_blk_device(uts)); /* * Trigger lib/fwu_updates/fwu.c fwu_boottime_checks() @@ -100,13 +105,24 @@ static int dm_test_fwu_mdata_read(struct unit_test_state *uts) event_notify_null(EVT_MAIN_LOOP); ut_assertok(uclass_first_device_err(UCLASS_FWU_MDATA, &dev)); - ut_assertok(setup_blk_device(uts)); - ut_assertok(populate_mmc_disk_image(uts)); - ut_assertok(write_mmc_blk_device(uts)); - ut_assertok(fwu_get_mdata(&mdata)); + ut_assertok(fwu_get_mdata_size(&mdata_size)); - ut_asserteq(mdata.version, 0x1); + *mdata = malloc(mdata_size); + ut_assertnonnull(*mdata); + + return 0; +} + +static int dm_test_fwu_mdata_read(struct unit_test_state *uts) +{ + struct fwu_mdata *mdata = NULL; + + fwu_mdata_access_setup(uts, &mdata); + + ut_assertok(fwu_get_mdata(mdata)); + + ut_asserteq(mdata->version, 0x2); return 0; } @@ -114,29 +130,21 @@ DM_TEST(dm_test_fwu_mdata_read, UT_TESTF_SCAN_FDT); static int dm_test_fwu_mdata_write(struct unit_test_state *uts) { + u8 num_banks; u32 active_idx; - struct udevice *dev; - struct fwu_mdata mdata = { 0 }; - - /* - * Trigger lib/fwu_updates/fwu.c fwu_boottime_checks() - * to populate g_dev global pointer in that library. - */ - event_notify_null(EVT_MAIN_LOOP); + struct fwu_mdata *mdata = NULL; - ut_assertok(setup_blk_device(uts)); - ut_assertok(populate_mmc_disk_image(uts)); - ut_assertok(write_mmc_blk_device(uts)); - - ut_assertok(uclass_first_device_err(UCLASS_FWU_MDATA, &dev)); + fwu_mdata_access_setup(uts, &mdata); - ut_assertok(fwu_get_mdata(&mdata)); + ut_assertok(fwu_get_mdata(mdata)); + num_banks = fwu_get_fw_desc(mdata)->num_banks; + ut_asserteq(2, num_banks); - active_idx = (mdata.active_index + 1) % CONFIG_FWU_NUM_BANKS; + active_idx = (mdata->active_index + 1) % num_banks; ut_assertok(fwu_set_active_index(active_idx)); - ut_assertok(fwu_get_mdata(&mdata)); - ut_asserteq(mdata.active_index, active_idx); + ut_assertok(fwu_get_mdata(mdata)); + ut_asserteq(mdata->active_index, active_idx); return 0; } diff --git a/test/dm/fwu_mdata_disk_image.h b/test/dm/fwu_mdata_disk_image.h index b9803417c8..b15b06b9de 100644 --- a/test/dm/fwu_mdata_disk_image.h +++ b/test/dm/fwu_mdata_disk_image.h @@ -6,107 +6,85 @@ */ #define FWU_MDATA_DISK_IMG { 0x00010000, { \ - {0x000001c0, "\x02\x00\xee\x02\x02\x00\x01\x00"}, /* ........ */ \ + {0x000001c0, "\x02\x00\xee\xff\xff\xff\x01\x00"}, /* ........ */ \ {0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \ {0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \ {0x00000200, "\x45\x46\x49\x20\x50\x41\x52\x54"}, /* EFI PART */ \ {0x00000208, "\x00\x00\x01\x00\x5c\x00\x00\x00"}, /* ....\... */ \ - {0x00000210, "\xa6\xf6\x92\x20\x00\x00\x00\x00"}, /* ... .... */ \ + {0x00000210, "\x52\x5f\x3a\xa1\x00\x00\x00\x00"}, /* R_:..... */ \ {0x00000218, "\x01\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ {0x00000220, "\x7f\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ {0x00000228, "\x22\x00\x00\x00\x00\x00\x00\x00"}, /* "....... */ \ {0x00000230, "\x5e\x00\x00\x00\x00\x00\x00\x00"}, /* ^....... */ \ - {0x00000238, "\xde\x99\xa2\x7e\x46\x34\xeb\x47"}, /* ...~F4.G */ \ - {0x00000240, "\x87\xf6\x4f\x75\xe8\xd5\x7d\xc7"}, /* ..Ou..}. */ \ + {0x00000238, "\xf5\xf3\x9d\xb9\x92\xdd\x48\x60"}, /* ......H` */ \ + {0x00000240, "\x9a\x04\xe5\x2b\x11\xcb\x42\x61"}, /* ...+..Ba */ \ {0x00000248, "\x02\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ {0x00000250, "\x80\x00\x00\x00\x80\x00\x00\x00"}, /* ........ */ \ - {0x00000258, "\x2a\x64\x03\x83\x00\x00\x00\x00"}, /* .d...... */ \ + {0x00000258, "\xc4\x80\x68\xad\x00\x00\x00\x00"}, /* ..h..... */ \ {0x00000400, "\xa0\x84\x7a\x8a\x87\x83\xf6\x40"}, /* ..z....@ */ \ {0x00000408, "\xab\x41\xa8\xb9\xa5\xa6\x0d\x23"}, /* .A.....# */ \ - {0x00000410, "\x3d\x6c\xb9\xaa\x20\xb2\x18\x4c"}, /* =l.. ..L */ \ - {0x00000418, "\xbc\x87\x1c\x9f\xe0\x35\x9b\x73"}, /* .....5.s */ \ + {0x00000410, "\x02\xa0\xf1\x31\xc0\x4c\x42\xd1"}, /* ...1.LB. */ \ + {0x00000418, "\xbd\x0b\xa0\xa3\xd9\xe8\x4b\x64"}, /* ......Kd */ \ {0x00000420, "\x22\x00\x00\x00\x00\x00\x00\x00"}, /* "....... */ \ - {0x00000428, "\x31\x00\x00\x00\x00\x00\x00\x00"}, /* 1....... */ \ - {0x00000438, "\x55\x00\x6e\x00\x6b\x00\x6e\x00"}, /* U.n.k.n. */ \ - {0x00000440, "\x6f\x00\x77\x00\x6e\x00\x00\x00"}, /* o.w.n... */ \ + {0x00000428, "\x23\x00\x00\x00\x00\x00\x00\x00"}, /* #....... */ \ {0x00000480, "\xa0\x84\x7a\x8a\x87\x83\xf6\x40"}, /* ..z....@ */ \ {0x00000488, "\xab\x41\xa8\xb9\xa5\xa6\x0d\x23"}, /* .A.....# */ \ - {0x00000490, "\x57\x24\xf6\xe6\x0b\x6f\x66\x4e"}, /* W$...ofN */ \ - {0x00000498, "\xb3\xd5\x99\x50\xa5\xc6\x4e\xc1"}, /* ...P..N. */ \ - {0x000004a0, "\x32\x00\x00\x00\x00\x00\x00\x00"}, /* 2....... */ \ - {0x000004a8, "\x41\x00\x00\x00\x00\x00\x00\x00"}, /* A....... */ \ - {0x000004b8, "\x55\x00\x6e\x00\x6b\x00\x6e\x00"}, /* U.n.k.n. */ \ - {0x000004c0, "\x6f\x00\x77\x00\x6e\x00\x00\x00"}, /* o.w.n... */ \ - {0x00004400, "\x4e\xd5\x3f\x43\x01\x00\x00\x00"}, /* N.?C.... */ \ + {0x00000490, "\x55\x2e\xe8\x5c\x7f\x10\x4b\xe7"}, /* U..\..K. */ \ + {0x00000498, "\xb1\xb8\x3a\x84\xb7\x63\x1d\xcd"}, /* ..:..c.. */ \ + {0x000004a0, "\x24\x00\x00\x00\x00\x00\x00\x00"}, /* $....... */ \ + {0x000004a8, "\x25\x00\x00\x00\x00\x00\x00\x00"}, /* %....... */ \ + {0x00004400, "\x71\x30\xcf\xf7\x02\x00\x00\x00"}, /* q0...... */ \ {0x00004408, "\x00\x00\x00\x00\x01\x00\x00\x00"}, /* ........ */ \ - {0x00004410, "\x52\xcf\xd7\x09\x20\x07\x10\x47"}, /* R... ..G */ \ - {0x00004418, "\x91\xd1\x08\x46\x9b\x7f\xe9\xc8"}, /* ...F.... */ \ - {0x00004420, "\xeb\x2b\x27\x49\xd8\x8d\xdf\x46"}, /* .+'I...F */ \ - {0x00004428, "\x8d\x75\x35\x6c\x65\xef\xf4\x17"}, /* .u5le... */ \ - {0x00004430, "\x86\x7a\x05\x10\xf1\xda\x93\x4f"}, /* .z.....O */ \ - {0x00004438, "\xba\x7f\xb1\x95\xf7\xfa\x41\x70"}, /* ......Ap */ \ - {0x00004440, "\x01\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ - {0x00004448, "\x3e\xed\x62\xdb\x37\x62\xb4\x4f"}, /* >.b.7b.O */ \ - {0x00004450, "\x80\xc4\x1b\x74\xd8\x46\xa8\xe7"}, /* ...t.F.. */ \ + {0x00004410, "\x78\x00\x00\x00\x20\x00\x00\x00"}, /* x... ... */ \ + {0x00004418, "\xfc\xfc\xff\xff\x00\x00\x00\x00"}, /* ........ */ \ + {0x00004420, "\x02\x00\x01\x00\x50\x00\x18\x00"}, /* ....P... */ \ + {0x00004428, "\x83\xdf\xd5\x19\xb0\x11\x7b\x45"}, /* ......{E */ \ + {0x00004430, "\xbe\x2c\x75\x59\xc1\x31\x42\xa5"}, /* .,uY.1B. */ \ + {0x00004438, "\x17\xc7\xa9\x08\x4a\xb0\x6b\x45"}, /* ....J.kE */ \ + {0x00004440, "\x8c\x82\x6f\x8e\x19\x39\xc5\x8b"}, /* ..o..9.. */ \ + {0x00004448, "\xcc\x28\x74\xd5\x9a\xbb\xe0\x42"}, /* .(t....B */ \ + {0x00004450, "\xaa\x36\x3f\x5a\x13\x20\x59\xc7"}, /* .6?Z. Y. */ \ {0x00004458, "\x01\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ - {0x00004460, "\xf5\x21\x70\x5a\xf2\xfe\xb4\x48"}, /* .!pZ...H */ \ - {0x00004468, "\xaa\xba\x83\x2e\x77\x74\x18\xc0"}, /* ....wt.. */ \ - {0x00004470, "\xeb\x2b\x27\x49\xd8\x8d\xdf\x46"}, /* .+'I...F */ \ - {0x00004478, "\x8d\x75\x35\x6c\x65\xef\xf4\x17"}, /* .u5le... */ \ - {0x00004480, "\x3b\x0e\xd2\x0b\x9f\xab\x86\x49"}, /* ;......I */ \ - {0x00004488, "\xb7\x90\x8d\xf3\x9c\x9c\xa3\x82"}, /* ........ */ \ - {0x00004490, "\x01\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ - {0x00004498, "\x6d\xe4\x25\x0e\x15\xb6\xd3\x4c"}, /* m.%....L */ \ - {0x000044a0, "\x94\xda\x51\x79\x8f\xb1\x9e\xb1"}, /* ..Qy.... */ \ - {0x000044a8, "\x01\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ - {0x00006400, "\x4e\xd5\x3f\x43\x01\x00\x00\x00"}, /* N.?C.... */ \ - {0x00006408, "\x00\x00\x00\x00\x01\x00\x00\x00"}, /* ........ */ \ - {0x00006410, "\x52\xcf\xd7\x09\x20\x07\x10\x47"}, /* R... ..G */ \ - {0x00006418, "\x91\xd1\x08\x46\x9b\x7f\xe9\xc8"}, /* ...F.... */ \ - {0x00006420, "\xeb\x2b\x27\x49\xd8\x8d\xdf\x46"}, /* .+'I...F */ \ - {0x00006428, "\x8d\x75\x35\x6c\x65\xef\xf4\x17"}, /* .u5le... */ \ - {0x00006430, "\x86\x7a\x05\x10\xf1\xda\x93\x4f"}, /* .z.....O */ \ - {0x00006438, "\xba\x7f\xb1\x95\xf7\xfa\x41\x70"}, /* ......Ap */ \ - {0x00006440, "\x01\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ - {0x00006448, "\x3e\xed\x62\xdb\x37\x62\xb4\x4f"}, /* >.b.7b.O */ \ - {0x00006450, "\x80\xc4\x1b\x74\xd8\x46\xa8\xe7"}, /* ...t.F.. */ \ - {0x00006458, "\x01\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ - {0x00006460, "\xf5\x21\x70\x5a\xf2\xfe\xb4\x48"}, /* .!pZ...H */ \ - {0x00006468, "\xaa\xba\x83\x2e\x77\x74\x18\xc0"}, /* ....wt.. */ \ - {0x00006470, "\xeb\x2b\x27\x49\xd8\x8d\xdf\x46"}, /* .+'I...F */ \ - {0x00006478, "\x8d\x75\x35\x6c\x65\xef\xf4\x17"}, /* .u5le... */ \ - {0x00006480, "\x3b\x0e\xd2\x0b\x9f\xab\x86\x49"}, /* ;......I */ \ - {0x00006488, "\xb7\x90\x8d\xf3\x9c\x9c\xa3\x82"}, /* ........ */ \ - {0x00006490, "\x01\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ - {0x00006498, "\x6d\xe4\x25\x0e\x15\xb6\xd3\x4c"}, /* m.%....L */ \ - {0x000064a0, "\x94\xda\x51\x79\x8f\xb1\x9e\xb1"}, /* ..Qy.... */ \ - {0x000064a8, "\x01\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ + {0x00004460, "\x6d\x7d\xe3\x2b\x81\x82\x38\x49"}, /* m}.+..8I */ \ + {0x00004468, "\xbd\x7b\x9a\x5b\xbf\x80\x86\x9f"}, /* .{.[.... */ \ + {0x00004470, "\x01\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ + {0x00004800, "\x71\x30\xcf\xf7\x02\x00\x00\x00"}, /* q0...... */ \ + {0x00004808, "\x00\x00\x00\x00\x01\x00\x00\x00"}, /* ........ */ \ + {0x00004810, "\x78\x00\x00\x00\x20\x00\x00\x00"}, /* x... ... */ \ + {0x00004818, "\xfc\xfc\xff\xff\x00\x00\x00\x00"}, /* ........ */ \ + {0x00004820, "\x02\x00\x01\x00\x50\x00\x18\x00"}, /* ....P... */ \ + {0x00004828, "\x83\xdf\xd5\x19\xb0\x11\x7b\x45"}, /* ......{E */ \ + {0x00004830, "\xbe\x2c\x75\x59\xc1\x31\x42\xa5"}, /* .,uY.1B. */ \ + {0x00004838, "\x17\xc7\xa9\x08\x4a\xb0\x6b\x45"}, /* ....J.kE */ \ + {0x00004840, "\x8c\x82\x6f\x8e\x19\x39\xc5\x8b"}, /* ..o..9.. */ \ + {0x00004848, "\xcc\x28\x74\xd5\x9a\xbb\xe0\x42"}, /* .(t....B */ \ + {0x00004850, "\xaa\x36\x3f\x5a\x13\x20\x59\xc7"}, /* .6?Z. Y. */ \ + {0x00004858, "\x01\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ + {0x00004860, "\x6d\x7d\xe3\x2b\x81\x82\x38\x49"}, /* m}.+..8I */ \ + {0x00004868, "\xbd\x7b\x9a\x5b\xbf\x80\x86\x9f"}, /* .{.[.... */ \ + {0x00004870, "\x01\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ {0x0000be00, "\xa0\x84\x7a\x8a\x87\x83\xf6\x40"}, /* ..z....@ */ \ {0x0000be08, "\xab\x41\xa8\xb9\xa5\xa6\x0d\x23"}, /* .A.....# */ \ - {0x0000be10, "\x3d\x6c\xb9\xaa\x20\xb2\x18\x4c"}, /* =l.. ..L */ \ - {0x0000be18, "\xbc\x87\x1c\x9f\xe0\x35\x9b\x73"}, /* .....5.s */ \ + {0x0000be10, "\x02\xa0\xf1\x31\xc0\x4c\x42\xd1"}, /* ...1.LB. */ \ + {0x0000be18, "\xbd\x0b\xa0\xa3\xd9\xe8\x4b\x64"}, /* ......Kd */ \ {0x0000be20, "\x22\x00\x00\x00\x00\x00\x00\x00"}, /* "....... */ \ - {0x0000be28, "\x31\x00\x00\x00\x00\x00\x00\x00"}, /* 1....... */ \ - {0x0000be38, "\x55\x00\x6e\x00\x6b\x00\x6e\x00"}, /* U.n.k.n. */ \ - {0x0000be40, "\x6f\x00\x77\x00\x6e\x00\x00\x00"}, /* o.w.n... */ \ + {0x0000be28, "\x23\x00\x00\x00\x00\x00\x00\x00"}, /* #....... */ \ {0x0000be80, "\xa0\x84\x7a\x8a\x87\x83\xf6\x40"}, /* ..z....@ */ \ {0x0000be88, "\xab\x41\xa8\xb9\xa5\xa6\x0d\x23"}, /* .A.....# */ \ - {0x0000be90, "\x57\x24\xf6\xe6\x0b\x6f\x66\x4e"}, /* W$...ofN */ \ - {0x0000be98, "\xb3\xd5\x99\x50\xa5\xc6\x4e\xc1"}, /* ...P..N. */ \ - {0x0000bea0, "\x32\x00\x00\x00\x00\x00\x00\x00"}, /* 2....... */ \ - {0x0000bea8, "\x41\x00\x00\x00\x00\x00\x00\x00"}, /* A....... */ \ - {0x0000beb8, "\x55\x00\x6e\x00\x6b\x00\x6e\x00"}, /* U.n.k.n. */ \ - {0x0000bec0, "\x6f\x00\x77\x00\x6e\x00\x00\x00"}, /* o.w.n... */ \ + {0x0000be90, "\x55\x2e\xe8\x5c\x7f\x10\x4b\xe7"}, /* U..\..K. */ \ + {0x0000be98, "\xb1\xb8\x3a\x84\xb7\x63\x1d\xcd"}, /* ..:..c.. */ \ + {0x0000bea0, "\x24\x00\x00\x00\x00\x00\x00\x00"}, /* $....... */ \ + {0x0000bea8, "\x25\x00\x00\x00\x00\x00\x00\x00"}, /* %....... */ \ {0x0000fe00, "\x45\x46\x49\x20\x50\x41\x52\x54"}, /* EFI PART */ \ {0x0000fe08, "\x00\x00\x01\x00\x5c\x00\x00\x00"}, /* ....\... */ \ - {0x0000fe10, "\xa2\xce\x23\xfc\x00\x00\x00\x00"}, /* ..#..... */ \ + {0x0000fe10, "\x56\x67\x8b\x7d\x00\x00\x00\x00"}, /* Vg.}.... */ \ {0x0000fe18, "\x7f\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ {0x0000fe20, "\x01\x00\x00\x00\x00\x00\x00\x00"}, /* ........ */ \ {0x0000fe28, "\x22\x00\x00\x00\x00\x00\x00\x00"}, /* "....... */ \ {0x0000fe30, "\x5e\x00\x00\x00\x00\x00\x00\x00"}, /* ^....... */ \ - {0x0000fe38, "\xde\x99\xa2\x7e\x46\x34\xeb\x47"}, /* ...~F4.G */ \ - {0x0000fe40, "\x87\xf6\x4f\x75\xe8\xd5\x7d\xc7"}, /* ..Ou..}. */ \ + {0x0000fe38, "\xf5\xf3\x9d\xb9\x92\xdd\x48\x60"}, /* ......H` */ \ + {0x0000fe40, "\x9a\x04\xe5\x2b\x11\xcb\x42\x61"}, /* ...+..Ba */ \ {0x0000fe48, "\x5f\x00\x00\x00\x00\x00\x00\x00"}, /* _....... */ \ {0x0000fe50, "\x80\x00\x00\x00\x80\x00\x00\x00"}, /* ........ */ \ - {0x0000fe58, "\x2a\x64\x03\x83\x00\x00\x00\x00"}, /* .d...... */ \ + {0x0000fe58, "\xc4\x80\x68\xad\x00\x00\x00\x00"}, /* ..h..... */ \ {0, NULL} } } From patchwork Mon Feb 12 07:47:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772038 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000852wre; Sun, 11 Feb 2024 23:50:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IEL0zEMht+zbdTLEfFpnbheOw2IhMeXzXyObmoVN1lPNelwHlJh/0GS4y7zhjuKHvSofoB8 X-Received: by 2002:a17:906:1b42:b0:a3c:c674:ccd7 with SMTP id p2-20020a1709061b4200b00a3cc674ccd7mr455897ejg.23.1707724220417; Sun, 11 Feb 2024 23:50:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724220; cv=none; d=google.com; s=arc-20160816; b=aZhpkHp931FYkQxsAfnGFEmX1dEpiqO+LUL2853SylDI8th7kqXwAxcJLgKgx8kHlp qbLjFbGFIC91CN8VpnNJONkC+OATnEyJndDct+rhmQijPZRVB9QGtFDzzQ8QAV+KrTRY ArH/4LWe7hvBtWSr/eZ5PULmca/GAwdhqK6/bjYEofvykSczsC54EGONVAY5nux7wXu3 ljk0I6/MOq3uqJ++DgWdWfIJAeQ9lWXO1uT36sHK+2OD5LzEPaXUDX3pi3v8sCuaH6O0 Ln/NDXMxDd8ivjnoUuzcy3IUtnE0/EbCskqv4iVQJsukRXoYEo59hq+ENCyiATUHLl25 58lQ== 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=AtK6Qi5UM7Qg3AX/ti6qb25Q3uV7ztPw+xitm7+z7/A=; fh=XXtXJzdBgEtZrB9pQbRZBAq44Y6zQuZlzpZDRqA+3g8=; b=p591PV7GOShB6Cg6fM6KkpiausKPiNvrkdBKWQwwO4aNgRJ0VmhNR9gEz7XvnWRDuP veQHQyBT5/cdw9YQaqI5oI8flGDL+y9nbMg7cRHGbIZRQD8cBF0WpqS7/NzfN5A5jP7T 4u5o2f2JPRJIPetzpqM8jB0H5WIt+/tFx1bpmq4P3QWVFHx04Amnr/M5bxYAhfh2tj+o XoPU4W7lTpQ8VGvlGzjzJY6/zcTeNObvi8OYP7OslGFyqg85lNwxnFoNWnHlmlfIxYnF Uey9gZbMwuEyf5+rsoqST1uMOGnE0RunyW+cY68ufFOIqFqUD5M3tIEdM6RQE6Y0vxUs PxYg==; 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; AJvYcCVN+cFfilun0cbBOg/umnsEnvu0i1jGMUotTmAmA4RO0Tz5csG05d3Xbfnvn51xGDDWDDmSERe1wOgdyJLvwl6G4WX7i+zIjppY/1UIZrQu44g6VbQzyRm+F5sPyb6RTGI3LX8hrOyxEqGc35UvWSmeRncxHOKfFEPjlYTcsNc6cDCVhFYt3ijXwDUT1VjvJIWhhQHBpCzZMxvvshn71uhqgxyGTHfvaGVrmEwkLbX3mDqiqASd6AS2Q54UbkjFHGx9KT//pTsbDyL7K1XUu4XZKdBojuxkTINbRhLyzbAwgulM/qZE4KNtJjSGM3WJssek0EdqizvMxjuSKN5WQXPgUuUHXdQtwxfA9yuHZkYRdx/z0qlmYvcWtPpbnZh+Jc2AlANMGZpOFcr/b0zex5x3XeU0Ia0ZOjhTmPaZkMZMdnPdMDLMpFhiqDmuD+qh/VpIZNZSqmOg/HUREqcQ15K6D4P+NMfYJ9nZo+nHMC5ttN3shokuJRICsCuPEkJ1ZgGmcX3wc65hMeenpeTHN9MbRP1udFMBGm5CXzNONsuJp2ojC5TcbRj0MwYkOa0yY3VYJKSaj1n0u9hYXGjR+BsYg5ea6PXyalAXScilyW24FtsMCoNGRNLAr63upskXdS06iNZD7u3cixxKsUUEMxUFElNUgMMYmF8JoPt3IGTtD91FUKFwctPB2WvVheN1kyP2B+aystuZMgZ8RwSUqvjIeg155A/MiFyM8JfNTKnTXGbNcXKgJLiuac/WgW3G2u5uO+71QkdKsYWLEfgGiXm8UHmh5HZBt+T4BD6dM3Jv2fdY/jSr/GLi+PT4j64evJ509vJ1W3XCPKk4uVXFAngmDzpkRtJV9E+TjfSHwUDoOt8= 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 ss16-20020a170907039000b00a35256143f4si3579744ejb.447.2024.02.11.23.50.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:50:20 -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 2B70987F10; Mon, 12 Feb 2024 08:48:37 +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 7688287F10; Mon, 12 Feb 2024 08:48:36 +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 8416587EF9 for ; Mon, 12 Feb 2024 08:48:34 +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 930D0FEC; Sun, 11 Feb 2024 23:49:15 -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 C68843F762; Sun, 11 Feb 2024 23:48:30 -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 16/21] fwu: remove the config symbols for number of banks and images Date: Mon, 12 Feb 2024 13:17:07 +0530 Message-Id: <20240212074712.3657076-17-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 With the migration to the FWU metadata version 2 structure, the values of number of banks and number of images per bank are now obtained from the metadata at runtime. Remove the now superfluous config symbols. Signed-off-by: Sughosh Ganu --- Changes since V1: None arch/sandbox/Kconfig | 6 ------ board/armltd/corstone1000/corstone1000.c | 2 +- lib/fwu_updates/Kconfig | 11 ----------- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index 0ce77de2fc..29013a5673 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -79,9 +79,3 @@ config SYS_FDT_LOAD_ADDR See `doc/arch/sandbox.rst` for more information. endmenu - -config FWU_NUM_BANKS - default 2 - -config FWU_NUM_IMAGES_PER_BANK - default 2 diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c index 01c80aaf9d..15de738154 100644 --- a/board/armltd/corstone1000/corstone1000.c +++ b/board/armltd/corstone1000/corstone1000.c @@ -109,7 +109,7 @@ void fwu_plat_get_bootidx(uint *boot_idx) */ ret = fwu_get_active_index(boot_idx); if (ret < 0) { - *boot_idx = CONFIG_FWU_NUM_BANKS; + *boot_idx = 0; log_err("corstone1000: failed to read active index\n"); } } diff --git a/lib/fwu_updates/Kconfig b/lib/fwu_updates/Kconfig index d35247d0e5..6bb94f88d3 100644 --- a/lib/fwu_updates/Kconfig +++ b/lib/fwu_updates/Kconfig @@ -12,17 +12,6 @@ menuconfig FWU_MULTI_BANK_UPDATE if FWU_MULTI_BANK_UPDATE -config FWU_NUM_BANKS - int "Number of Banks defined by the platform" - help - Define the number of banks of firmware images on a platform - -config FWU_NUM_IMAGES_PER_BANK - int "Number of firmware images per bank" - help - Define the number of firmware images per bank. This value - should be the same for all the banks. - config FWU_TRIAL_STATE_CNT int "Number of times system boots in Trial State" default 3 From patchwork Mon Feb 12 07:47:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772039 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000886wre; Sun, 11 Feb 2024 23:50:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IEuhw0I4zk5IXOWk+2VfJKW4t3gukeKUuQGYORoTOcIDUDnpMUK/jCKbzPW07K7gRHzcK3n X-Received: by 2002:aa7:d5c2:0:b0:560:cae:53f7 with SMTP id d2-20020aa7d5c2000000b005600cae53f7mr4193104eds.35.1707724230239; Sun, 11 Feb 2024 23:50:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724230; cv=none; d=google.com; s=arc-20160816; b=Hg04mlQJaf8Oq3SUT979wFkSQ0Yl9z0D843g2ZKYaeoQUJJStKdCOvI1+ojO4y1t/g zYMA6nexlsWGUUswVVpRE+T/S6CyFTRP51VIsI6nZ0egCsMjm2x/3Pj86NpFXlEm4Oy7 Rw3OUYO03G7rbrCsfc1WmIkGloFEzj0JQAqcDSuX4BElLmLbvLO2rAppM9uv/T178TVM wHWcpBQxnm4dk7Z1N6DlJ32gBljjlNLL5FPcTR3I/KXlDILNkEi6+WVeYjaSa4blm3n3 OvAljvaj+FIlWKCM/XmQRWc9gB5ZernoLLaiGVUBYWazmMLf8eufeyUF4dG0U+SHpczs 5zyg== 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=EfSSKdCkctdxO/j7gdeAOVwiMZKei5VnyHFdUh0Su8M=; fh=VgvH5y+8QqoDHLgS8ZqmSn7UsvteKWCjtDmGhOlsE20=; b=j8HBO0jsnDTLo29iTEZ75uVjFbClp82V5MQ+nlThHQGQOapKm+Y3CXljsjn75dQ4If +6zkVw8XHv4pzM3aq+EYKPfDA5Tw3d0v1/m+zzhHwOsyOcFcK9HfKqfY77jk4q3Vs8ty /Rp01b+O7xvM0zOe+zWE2JW7tvR56jCF6lJOfqBT7P38tIMa07Hvm32DB2YHxg+fD5Ei 4gECrWoEX+scccUTS+8kVAZlhLRbFI7aoOjEbZaRKkDBHtPzjtkwHWS9VxtS7yXBbCqn gzffpJ1XOJbfC7rGKwRLT4GT7SJuXHSuVQD8qpvWRL0uE/7JkBZNpBKlGkZdayCAfVY7 96qQ==; 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; AJvYcCUJKZ82yDEL9DxVZHdtiT+N0ph8TrgnDGK/J0thdYMnVshOaPpPOiV6RaVadcw8xFd3q1c9xen6ZmSPIVFZDyVTboCNeul47c5Lj4Eq6EKMm2loW1Hjvz2QusRC91YwJiYSW80imxN7wXzBeRvm16HT5Z4y87/GHn135ueYvL/5bK+l7JIDXZ0LALDRvw+djDMjRlVorWqFjcSXk3D72o1QQV0e+qQ3Y8pALgv4+UibD9Cf+Q2mPGl9EeR966lV7tCX/iQoR7tggNCG3zF4WqPRmW9UBpa6TG2VZ1XEow+i3efE0508af+jzvZgBEVcWghiJ9tcItXypMiQQu/8sPQXKGQenP3sjsilaUTG13/j8WFbslAV12Vbw8sp3OIDbk5hWIpodSjFBqmqasubb5GOueP5UvK9MUaN5thM9pACUNh6iZQyDXh6r5ERIHKmyfUxO3509Ps2N6Oq0mynhlXHUEfUO68yZYmysBrrvuXi0zy1h2fDP3KLApu+TBVutRFPLlRmBjGQlQE+moGkmFLUih89kEjeiKd+jKp/ltLU2J0rdktMn/c5Er7V+3U5zKyJOeaMovC+GUSlPd70EiKO03GLafBsx4lioSGOfv8taiIMCH+wVIUqLs0toT5vpTZbsN7co8A2GgWfDl1mpXSNCIT814XfSaZh1Hz2CTiulOixks82Kg//z+u7yoG0Ai4KadHVeFInxr18LAR9yewfAsFK34bc6cYTHxbK36hoygQcQnlCh9kRmjyg304oZ6uJHAay/RFHDt6r5oWrEHBMWTMJ/+2A5DDwzkrCaeNEmrI2yYZ0vvvTfqO4uf0dgePIsJ4PFdDUUyIeZrJtViF6hm+MUWftKrxL482+Baft7Ck= 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 w12-20020aa7cb4c000000b005615b840203si2517353edt.513.2024.02.11.23.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:50:30 -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 B07F887ECA; Mon, 12 Feb 2024 08:48:41 +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 9B0AF87F03; Mon, 12 Feb 2024 08:48:40 +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 49B7187808 for ; Mon, 12 Feb 2024 08:48:38 +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 55B3ADA7; Sun, 11 Feb 2024 23:49:19 -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 898693F762; Sun, 11 Feb 2024 23:48:34 -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 17/21] tools: mkfwumdata: migrate to metadata version 2 Date: Mon, 12 Feb 2024 13:17:08 +0530 Message-Id: <20240212074712.3657076-18-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 Migrate the metadata generation tool to generate the version 2 metadata. Signed-off-by: Sughosh Ganu --- Changes since V1: * Compute location of struct fwu_fw_store_desc using pointer arithmetic. tools/mkfwumdata.c | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/tools/mkfwumdata.c b/tools/mkfwumdata.c index 9732a8ddc5..fb847e3a78 100644 --- a/tools/mkfwumdata.c +++ b/tools/mkfwumdata.c @@ -14,12 +14,13 @@ #include #include -/* This will dynamically allocate the fwu_mdata */ -#define CONFIG_FWU_NUM_BANKS 0 -#define CONFIG_FWU_NUM_IMAGES_PER_BANK 0 - /* Since we can not include fwu.h, redefine version here. */ -#define FWU_MDATA_VERSION 1 +#define FWU_MDATA_VERSION 2 + +#define MAX_BANKS 4 + +#define BANK_INVALID 0xFF +#define BANK_ACCEPTED 0xFC typedef uint8_t u8; typedef int16_t s16; @@ -29,8 +30,6 @@ typedef uint64_t u64; #include -/* TODO: Endianness conversion may be required for some arch. */ - static const char *opts_short = "b:i:a:p:gh"; static struct option options[] = { @@ -48,7 +47,7 @@ static void print_usage(void) fprintf(stderr, "Usage: mkfwumdata [options] \n"); fprintf(stderr, "Options:\n" "\t-i, --images Number of images (mandatory)\n" - "\t-b, --banks Number of banks (mandatory)\n" + "\t-b, --banks Number of banks(1-4) (mandatory)\n" "\t-a, --active-bank Active bank (default=0)\n" "\t-p, --previous-bank Previous active bank (default=active_bank - 1)\n" "\t-g, --guid Use GUID instead of UUID\n" @@ -85,6 +84,7 @@ static struct fwu_mdata_object *fwu_alloc_mdata(size_t images, size_t banks) return NULL; mobj->size = sizeof(struct fwu_mdata) + + sizeof(struct fwu_fw_store_desc) + (sizeof(struct fwu_image_entry) + sizeof(struct fwu_image_bank_info) * banks) * images; mobj->images = images; @@ -105,6 +105,7 @@ fwu_get_image(struct fwu_mdata_object *mobj, size_t idx) size_t offset; offset = sizeof(struct fwu_mdata) + + sizeof(struct fwu_fw_store_desc) + (sizeof(struct fwu_image_entry) + sizeof(struct fwu_image_bank_info) * mobj->banks) * idx; @@ -117,6 +118,7 @@ fwu_get_bank(struct fwu_mdata_object *mobj, size_t img_idx, size_t bnk_idx) size_t offset; offset = sizeof(struct fwu_mdata) + + sizeof(struct fwu_fw_store_desc) + (sizeof(struct fwu_image_entry) + sizeof(struct fwu_image_bank_info) * mobj->banks) * img_idx + sizeof(struct fwu_image_entry) + @@ -188,7 +190,7 @@ fwu_parse_fill_image_uuid(struct fwu_mdata_object *mobj, return -EINVAL; if (strcmp(uuid, "0") && - uuid_guid_parse(uuid, (unsigned char *)&image->location_uuid) < 0) + uuid_guid_parse(uuid, (unsigned char *)&image->location_guid) < 0) return -EINVAL; /* Image type UUID */ @@ -196,7 +198,7 @@ fwu_parse_fill_image_uuid(struct fwu_mdata_object *mobj, if (!uuid) return -EINVAL; - if (uuid_guid_parse(uuid, (unsigned char *)&image->image_type_uuid) < 0) + if (uuid_guid_parse(uuid, (unsigned char *)&image->image_type_guid) < 0) return -EINVAL; /* Fill bank image-UUID */ @@ -210,7 +212,7 @@ fwu_parse_fill_image_uuid(struct fwu_mdata_object *mobj, return -EINVAL; if (strcmp(uuid, "0") && - uuid_guid_parse(uuid, (unsigned char *)&bank->image_uuid) < 0) + uuid_guid_parse(uuid, (unsigned char *)&bank->image_guid) < 0) return -EINVAL; } return 0; @@ -220,11 +222,26 @@ fwu_parse_fill_image_uuid(struct fwu_mdata_object *mobj, static int fwu_parse_fill_uuids(struct fwu_mdata_object *mobj, char *uuids[]) { struct fwu_mdata *mdata = mobj->mdata; + struct fwu_fw_store_desc *fw_desc; int i, ret; mdata->version = FWU_MDATA_VERSION; mdata->active_index = active_bank; mdata->previous_active_index = previous_bank; + mdata->metadata_size = mobj->size; + mdata->desc_offset = sizeof(struct fwu_mdata); + + for (i = 0; i < MAX_BANKS; i++) + mdata->bank_state[i] = i < mobj->banks ? + BANK_ACCEPTED : BANK_INVALID; + + fw_desc = (struct fwu_fw_store_desc *)((u8 *)mdata + sizeof(*mdata)); + fw_desc->num_banks = mobj->banks; + fw_desc->num_images = mobj->images; + fw_desc->img_entry_size = sizeof(struct fwu_image_entry) + + (sizeof(struct fwu_image_bank_info) * mobj->banks); + fw_desc->bank_info_entry_size = + sizeof(struct fwu_image_bank_info); for (i = 0; i < mobj->images; i++) { ret = fwu_parse_fill_image_uuid(mobj, i, uuids[i]); @@ -313,6 +330,12 @@ int main(int argc, char *argv[]) return -EINVAL; } + if (banks > MAX_BANKS) { + fprintf(stderr, "Error: The number of banks must not be more than %u.\n", + MAX_BANKS); + return -EINVAL; + } + /* This command takes UUIDs * images and output file. */ if (optind + images + 1 != argc) { fprintf(stderr, "Error: UUID list or output file is not specified or too much.\n"); From patchwork Mon Feb 12 07:47:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772040 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000925wre; Sun, 11 Feb 2024 23:50:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGY7FR6xkNvX0SUmy3hdfBY+Dii4kntrhfN1pPuQMS75+x46TIMpqUhJlS562sFOYG/rzil X-Received: by 2002:a05:6402:3118:b0:561:8452:3634 with SMTP id dc24-20020a056402311800b0056184523634mr2709762edb.36.1707724239247; Sun, 11 Feb 2024 23:50:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724239; cv=none; d=google.com; s=arc-20160816; b=M8VPiEioY9uCSXFUwUTMW/DBKOjbl6trxcnCxNvwK/DqyE9ZDMwuE9V/D4rBOyTHqx r0jwpL8SiQkvcapsJlVjiBlX/Eq5qNNl2qF5TIo9vDBkgbjCntXQps4+eoSxID/D7+m8 S9ayWLBxGtL2zG1F83J2Ii3+W2hfhZkLfYiU0zkFzWEuoFSVe3ixZx4myjcU9QqggNTG DT5wCY4P8gkw4YKG9Ycx/AVZeiS0H1pWKBd1dnNlvFskQq+whF+vMB7VWwq+yo7wdsBv ue73t1EXABuJmoiY9rrRMKZNtFKdt9Hf62YNvRq3ZAB1ztDmwMHZyQbqCPT9UrsHCs7e Kj2g== 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=dp203O8EndYo+Zs7a9rRbaZIAbCKOmpbXXqzCxcDwJ0=; fh=6d7uZNGxCDYKtszZs2IIDnmbLiCE2GbDjDyd8931oJE=; b=yQPQxqfM6pWEMGmRKIKvk8M9Odt4gESfQaLSnDb+zCUiTj1O/6KHotkBlfdSDVBDDf pj6yPl9R6rsB+0h9uwTRnPJa9QqC1X7c4x9Uk9sGDcZ/8vzFktyyN5TvHGTLXBksJpQk 40C2C5llhHBROb25vELOzm/6v1K/NIR0k2EU0nYuOOUqYXeIJtU/Qp5IKZikpqOrmvKU 9naueZqta/6UHokkiYwA44ha82Sixj2NLRV0lUsbe6tE2ZggZJBdQ8Jy5Oo4lkH4/Pv3 jpuFuC0AtUcySBtTMtC3o6SKuu0bJnm6/yg1SkduzauqEUsnL0RRXJBAvDuWKMlQi6aG 9YAA==; 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; AJvYcCXn9dEhWZYXYCQAgI3rly50PXR9f4JvmD3Y8nfWmgTLVmoH9XYXyAQWDPuej/hNiFRcjSHCCPWURuK4Mq2khtaWp0VnXq6iv1SH8sAo6Tw3G3jlxj5tUDS7S8txqRgalRAxObWY72quvT/DjPhcJqm5zp7KX6bYJOfimQGaBzHg8L4bC77NSZvWUN+hAHDIGck8sZDZwxHhUB1pakb+5MSBppsnkDxLRmAbfOyt1zqtq1MXNiJ+9b6vA1yxa9c2IhUA9UozP/HUKTFyA3+Be2qFYrIXS+EcJicLhXrkxMbkYY8N7hKwRZnsr9WDfRH0Md9QbO2DJxERvHKwsnasLFO6Ic3gNGcpXImJfVzJ12rsVc6HJKapjsVcF1c86FCx7NJI6FBsYn7DiLQj65YluZmkV1jmaK7GoXymKmTo71bwlI9kdgh0LXP5oM9NRrV9J9UlNt6C/P2b+8lIr9t/afftYoWHGgVCCp17QA1OktWxQg0SOQ+x5uHDc0oW6Tb9eOqiS3oxBgAqtWgtkIpCCXJUcRoYeZV30Wr95jclHrYndEeoOcOCwpP92oL8lKzEHu9mD6Qa3WIHijFp4CeMjyfG/N83dH69BRRMnNGV1UJHFlcUgQ+xJTzyZqXrC9iZBDqNZCHrEEtqVwgiHUxvK7HnofVP7aXKMvRYoLfidYZcnRuMp2x661gy7ZxxXqSUzWuh6XXk8/Hks/b4b/UOC9ST4yYVZn7B/SdEAURgmY/sYuHjryuoccVO7RMlhn3qGmeT27GzbKdT1ZidDJKIU8mAPvjpZjRZctW8wniMu8LyVM7j5FIoALV/Tmbfqj33bYefPwklAuySGFsl2RHCas5dSlxHGLNsh84nQieRC0O+n2w= 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 cz21-20020a0564021cb500b00560a8f116cfsi2585023edb.154.2024.02.11.23.50.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:50:39 -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 4C57487F14; Mon, 12 Feb 2024 08:48: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 3D31F87F0C; Mon, 12 Feb 2024 08:48: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 0C4C487EF9 for ; Mon, 12 Feb 2024 08:48:42 +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 18F2EDA7; Sun, 11 Feb 2024 23:49:23 -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 4C23E3F762; Sun, 11 Feb 2024 23:48:38 -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 18/21] tools: mkfwumdata: add logic to append vendor data to the FWU metadata Date: Mon, 12 Feb 2024 13:17:09 +0530 Message-Id: <20240212074712.3657076-19-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 version 2 of the FWU metadata allows for appending opaque vendor specific data to the metadata structure. Add support for appending this data to the metadata. The vendor specific data needs to be provided through a file, passed through a command-line parameter. Signed-off-by: Sughosh Ganu Tested-by: Michal Simek --- Changes since V1: New patch tools/mkfwumdata.c | 85 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 77 insertions(+), 8 deletions(-) diff --git a/tools/mkfwumdata.c b/tools/mkfwumdata.c index fb847e3a78..ab07623e25 100644 --- a/tools/mkfwumdata.c +++ b/tools/mkfwumdata.c @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include /* Since we can not include fwu.h, redefine version here. */ @@ -30,7 +32,7 @@ typedef uint64_t u64; #include -static const char *opts_short = "b:i:a:p:gh"; +static const char *opts_short = "b:i:a:p:v:gh"; static struct option options[] = { {"banks", required_argument, NULL, 'b'}, @@ -38,6 +40,7 @@ static struct option options[] = { {"guid", required_argument, NULL, 'g'}, {"active-bank", required_argument, NULL, 'a'}, {"previous-bank", required_argument, NULL, 'p'}, + {"vendor-file", required_argument, NULL, 'v'}, {"help", no_argument, NULL, 'h'}, {NULL, 0, NULL, 0}, }; @@ -51,6 +54,7 @@ static void print_usage(void) "\t-a, --active-bank Active bank (default=0)\n" "\t-p, --previous-bank Previous active bank (default=active_bank - 1)\n" "\t-g, --guid Use GUID instead of UUID\n" + "\t-v, --vendor-file Vendor data file to append to the metadata\n" "\t-h, --help print a help message\n" ); fprintf(stderr, " UUIDs list syntax:\n" @@ -69,13 +73,16 @@ struct fwu_mdata_object { size_t images; size_t banks; size_t size; + size_t vsize; + void *vbuf; struct fwu_mdata *mdata; }; static int previous_bank, active_bank; static bool __use_guid; -static struct fwu_mdata_object *fwu_alloc_mdata(size_t images, size_t banks) +static struct fwu_mdata_object *fwu_alloc_mdata(size_t images, size_t banks, + size_t vendor_size) { struct fwu_mdata_object *mobj; @@ -87,16 +94,28 @@ static struct fwu_mdata_object *fwu_alloc_mdata(size_t images, size_t banks) sizeof(struct fwu_fw_store_desc) + (sizeof(struct fwu_image_entry) + sizeof(struct fwu_image_bank_info) * banks) * images; + + mobj->size += vendor_size; + mobj->vsize = vendor_size; mobj->images = images; mobj->banks = banks; mobj->mdata = calloc(1, mobj->size); - if (!mobj->mdata) { - free(mobj); - return NULL; + if (!mobj->mdata) + goto alloc_err; + + if (vendor_size) { + mobj->vbuf = calloc(1, mobj->vsize); + if (!mobj->vbuf) + goto alloc_err; } return mobj; + +alloc_err: + free(mobj->mdata); + free(mobj); + return NULL; } static struct fwu_image_entry * @@ -223,6 +242,7 @@ static int fwu_parse_fill_uuids(struct fwu_mdata_object *mobj, char *uuids[]) { struct fwu_mdata *mdata = mobj->mdata; struct fwu_fw_store_desc *fw_desc; + char *vdata; int i, ret; mdata->version = FWU_MDATA_VERSION; @@ -249,23 +269,65 @@ static int fwu_parse_fill_uuids(struct fwu_mdata_object *mobj, char *uuids[]) return ret; } + if (mobj->vsize) { + vdata = (char *)mobj->mdata + (mobj->size - mobj->vsize); + memcpy(vdata, mobj->vbuf, mobj->vsize); + } + mdata->crc32 = crc32(0, (const unsigned char *)&mdata->version, mobj->size - sizeof(uint32_t)); return 0; } +static int fwu_read_vendor_data(struct fwu_mdata_object *mobj, + const char *vendor_file) +{ + int ret = 0; + FILE *vfile = NULL; + + vfile = fopen(vendor_file, "r"); + if (!vfile) { + ret = -1; + goto out; + } + + if (fread(mobj->vbuf, 1, mobj->vsize, vfile) != mobj->vsize) + ret = -1; + +out: + fclose(vfile); + return ret; +} + static int -fwu_make_mdata(size_t images, size_t banks, char *uuids[], char *output) +fwu_make_mdata(size_t images, size_t banks, const char *vendor_file, + char *uuids[], char *output) { struct fwu_mdata_object *mobj; FILE *file; + struct stat sbuf; + size_t vendor_size = 0; int ret; - mobj = fwu_alloc_mdata(images, banks); + if (vendor_file) { + ret = stat(vendor_file, &sbuf); + if (ret) + return -errno; + + vendor_size = sbuf.st_size; + } + + mobj = fwu_alloc_mdata(images, banks, vendor_size); if (!mobj) return -ENOMEM; + if (vendor_file) { + ret = fwu_read_vendor_data(mobj, vendor_file); + if (ret) + goto done_make; + } + ret = fwu_parse_fill_uuids(mobj, uuids); if (ret < 0) goto done_make; @@ -286,6 +348,7 @@ fwu_make_mdata(size_t images, size_t banks, char *uuids[], char *output) done_make: free(mobj->mdata); + free(mobj->vbuf); free(mobj); return ret; @@ -295,11 +358,13 @@ int main(int argc, char *argv[]) { unsigned long banks = 0, images = 0; int c, ret; + const char *vendor_file; /* Explicitly initialize defaults */ active_bank = 0; __use_guid = false; previous_bank = INT_MAX; + vendor_file = NULL; do { c = getopt_long(argc, argv, opts_short, options, NULL); @@ -322,6 +387,9 @@ int main(int argc, char *argv[]) case 'a': active_bank = strtoul(optarg, NULL, 0); break; + case 'v': + vendor_file = optarg; + break; } } while (c != -1); @@ -348,7 +416,8 @@ int main(int argc, char *argv[]) previous_bank = active_bank > 0 ? active_bank - 1 : banks - 1; } - ret = fwu_make_mdata(images, banks, argv + optind, argv[argc - 1]); + ret = fwu_make_mdata(images, banks, vendor_file, argv + optind, + argv[argc - 1]); if (ret < 0) fprintf(stderr, "Error: Failed to parse and write image: %s\n", strerror(-ret)); From patchwork Mon Feb 12 07:47:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772041 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000971wre; Sun, 11 Feb 2024 23:50:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUi8S/Xs3cek9i6JEu7hkDmJYQkJmXfIfSo3HgzDACxMrEuYhDOJMv+4PhQacLfun1JW8YdCQXainSHQiOzWZs0 X-Google-Smtp-Source: AGHT+IE+TWKK1U8knrjK83OsGPiKMSLuZS/USh+daL7Ci5NTeIj+Cn1AajTFPt/ugdHZCWgCiaRW X-Received: by 2002:a17:906:4ad7:b0:a3c:1ed2:7c4e with SMTP id u23-20020a1709064ad700b00a3c1ed27c4emr5010243ejt.58.1707724248749; Sun, 11 Feb 2024 23:50:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724248; cv=none; d=google.com; s=arc-20160816; b=EMCMi9qyaBbtRFiaM9lArOWSvWJakJRk3MELY+cBRbACM1cogngnJXFpAGa/thrtwY /UMAmuoW0LUmw6HPrL6A79S4WlLiNr6ET6F4c6BPwbywJoKuYkCh5S/aBJtJWk/X6C3T H+11CFTByTpmQ9Adog/0Dl6hJjXUTPrd43PqGWX9JeQ6js6VKuSa2B5PumbSrZEpgqe1 uoG5lUD49doBArplekF57RG06KMJ+QfaX4/X7QCGW4rVZFXMlWDbGYCK0IEfcYIOSNNa Igpiop8ywf2XXqyQVaHWan35B3ZePjCnPnWLAMPZbGy+MM/hJz13XydecUj4TUEMHFSA Rxew== 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=pDuTCbFDG0irzDW5vfbmKfGo8VGdH4XL6WzaHyLMV40=; fh=REBV+iRojLHRVOJpQG0LPn5qpjEdAu2yHvIZ66cQexg=; b=Rv1ogKeQxNqie7yRxbG81L1uCYZFKTQAjhmNLWKI49qtsN08WQpEZMhy2QvdwCxsjT R6YE+txYlBQuHheC9x8Th53U+ahqm6TdJmwIGVEPX67zn5TVmbXUmgjrW9dEKFdQ3l4l fxUW8uNGs0ER5PM42abYE4KczOteEwSLTQBCTG8GZqxCcvhUDQsyvCs0xX4Mq9WRltLm rhbWnGFjFTDssiCIvpyWTOBEJpU2X3UDQfzBXtAvnJ1WZFHeWWAZoKoQvxiOe7cIzrtc HZXyE/VN2eLbV5dTu6zcHhpiR0puvSt5dfRdMxRlJyn1IPuiUuZJxUtdeCmdZLrWsVJS MWBA==; 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; AJvYcCWVXHzsAOtBPUwWxE6kJOXjspCFZq7PAuLH99A9c3tDzb4AxilbF9aYhR4UGgnq7yPKGUsVD6NJl4PFrKNHHGoJUkvaOmlUD0rtTLEkjpdlAnUrn2FKgg7ikeLLogCiG0hGJr2/Xrudlr+84lSnD69fml9HGhJ7IjWkIA/pcHbW4fIzE5m7Ponop7c5Gw1fJHrJ887mePs71JfDCt9lloU07Z8U6QVkjS9ZYHBTGP6IcvCdFhtTTxwm9Xhl0tLogNjvx3HhhWp9o6a0aBObXEAxcrcamvZIx6H/asSQ4rjSlzXf5cYAhAgxsst+hX96RCsWe0YMDwTJr8DAw4aa2qUUUIlySy+dT3T6y4KYv6TGbgfd/12GU9ibFk0QGM4o+oMacDircnwWb72MYjUPTYKYrj8tY+lrU0Im8keVWlfqQHDPJbvYOL8T5ufKkSdGuzoiu1rZYGyjfGRSJxxp2gaID+LE5vVlwPvXDMxs9Oe82Vt/1wH5rEZpD5lBmnWbPciSMYStjc7+UoybRh4yc4jibKfpwJSCUxVXkYWP/0ycZcI6HiYnCxjmliMnbTbTOn0JfhRTQ2tuo9iWVSMr3ajE9jnCzU3aE0EJLQ+bQwEmgzDyfpgOyc8YSfAernnMQV9Cg79w1Q32i1pWJ2n5BFnadNzL07b9sj8TZugOUXwiUY09oXDfPX/XkW0ta+Uml2R+4pXLUPgVoQc8+tfyIk8PJc1lzBo5aP+WzdD1u/0rc5+wG1w6jIghD2rK1DzumqrEYn1Bj1gkeq3jxM2rXPAvnk6NkcHcKuhiU8uu9BgZAD0Br/h+1O/jtxULf1T/KVF+/yI4owilkD1e0oM1wSLXjN7f0NYKe93LLp9g9SzkqeA= 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 f8-20020a170906084800b00a372fa51315si3706777ejd.998.2024.02.11.23.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:50:48 -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 C354B87F1C; Mon, 12 Feb 2024 08:48:49 +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 15A5787F1B; Mon, 12 Feb 2024 08:48:48 +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 CDFD687F08 for ; Mon, 12 Feb 2024 08:48:45 +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 D0166DA7; Sun, 11 Feb 2024 23:49: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 0F6333F762; Sun, 11 Feb 2024 23:48:41 -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 19/21] tools: mkfwumdata: fix the size parameter to the fwrite call Date: Mon, 12 Feb 2024 13:17:10 +0530 Message-Id: <20240212074712.3657076-20-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 fwrite call returns the number of bytes transferred as part of the write only when the size parameter is 1. Pass the size parameter to the library call as 1 so that the correct number of bytes transferred are returned. Fixes: fdd56bfd3ad ("tools: Add mkfwumdata tool for FWU metadata image") Signed-off-by: Sughosh Ganu --- Changes since V1: New patch tools/mkfwumdata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mkfwumdata.c b/tools/mkfwumdata.c index ab07623e25..426d221ac7 100644 --- a/tools/mkfwumdata.c +++ b/tools/mkfwumdata.c @@ -338,7 +338,7 @@ fwu_make_mdata(size_t images, size_t banks, const char *vendor_file, goto done_make; } - ret = fwrite(mobj->mdata, mobj->size, 1, file); + ret = fwrite(mobj->mdata, 1, mobj->size, file); if (ret != mobj->size) ret = -errno; else From patchwork Mon Feb 12 07:47:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772042 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2001007wre; Sun, 11 Feb 2024 23:50:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVZFCAwpGc9Lg97to8V26dtQB7mhBzutPa/Nlf4B0GTKGBmp35MZq7Lvo0Y1EnhG3x6yLvP1kfUIpV0LC0BZ+WR X-Google-Smtp-Source: AGHT+IGgES5HxO0Ur5YBXiQ+yp4aFPwAXDQpqSssjWh+6UYOyiPOU4poLbS6O5B8tru5jEciyIYn X-Received: by 2002:a17:906:e296:b0:a3c:b9b7:8064 with SMTP id gg22-20020a170906e29600b00a3cb9b78064mr592280ejb.43.1707724257701; Sun, 11 Feb 2024 23:50:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724257; cv=none; d=google.com; s=arc-20160816; b=ALQoH5t6Z3Yl3/cboODcTWetLoxvB5EKwBSR23/JivU8NNWwSfcp1cq7jAYmOPsHkK w410YY4FlJxb0xFMSssfUF4i+o5wyG/7SLN3Nnwmtw0NypnaUCgp83XZcKrLqAHiMIFL XvTku8ADW6nWsrGyIoj883v1dT5Qgl6VU3P5sJ+JMxWvQAu1U9AB6FdbyznTMQFDLn/n 7DpXjkYrt5O954ZBdhB00DTMxF2FNf5IH6YijP/F/+BJvS2HHHkQZNXIVbbXj3Cq3pmq u9DC66QPP3Aiqp+s82WDBt9cqt8MCkiwpK5tZnzMdJpGD40OJ55ZWCZPTaN+eqJ3LO0d J1WA== 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=cKRCXBcQ1Wf8HDcUaTXadv8JUy2PmCAyO+gXaK8vDd4=; fh=ZOj0NOIMSLPb/o/oiruexRCUQz1G0uvTWtsAgRD8WZY=; b=GbRLESFkzqf7l3xVKuggBn1u1RKfkAicrEDcP3+Sb8lya/azxOguv60KgkS/KS7shX GvnLUmsfdUlYMl6g+7HAdpEK1/wGg8NUjffCK9im0whARtZDSWGx9fhEYamYgyy+PCjz HJT5SZggouhD+RiyrjxTugeyYVVm0fGKlBhGeOBsRPDcpc8KCYw+cCVDi1QJYaa3s5kt MqJxa9r9oiJJiknWvk3L0X4rD41y28yxEmWgksSOhZpg8rtseSpSeZlZfWI0s34mnkSI yLUH6Vew2L+fATk2Gx2hk1a7q4ROT++Ii5ct/b8nWgwDdIW8e+dbit9wJ8JgERw1zXPP IpWA==; darn=linaro.org 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 X-Forwarded-Encrypted: i=1; AJvYcCWYJh7wqPDvAvxHxHi0dRcVaKS9X60eWfZ709n2tKxn2NKY/cYg3/BtzmDqxc8YNo2Oc/M/xLgDo4pDKQuTZxTjEdZzLVpl8LQecOXW7WDhjyBWfUGYMlY4EeAGz1xUwTTcKXACpIAyQcbhz+zhYCOnqnKArZqZw/uod6ovpwg0JuldERFw0mRyCVpZQN0NdTkJbTJ+gHRJlzOceMVD4eB31L1ViVTXTFoNl4t5qFetZMThfUjCJc3KMt3kL2bO7EZYA2jmWyuhH879i2xauFe0N9JTf75WVlcU2zqgNxO4fTgoQ29U3jdqsGxIIDI3cwuuoIBLZPN13R7tnP5iKfUz4pU9P/8zSzwJK5IfVZbvmMmWoTf7i8id16AeuS59WCiO8xU0igCEKXiE/dHhbXBzx4sy9E1i53/kcTVoxCvMGgottHeyxU+F+0qldJWHQuZxsQe0W+qU0pTcD+BiKJm0eIuJgxMdX7L+sXeca/P952gScYpZAGKG7yJ69MLW2TFW6XxM54bSoCqSUdgOu3Fw/1LaBAth0hruLkXcE0RxkM771vjMmwkErP8Szt1zGeq5hU8ifgwo5svDP+S1QFqj+loe7hE4dgjCXzS2yd8gjwthnxxm4Z8ApHxs8OQf5PGkjEqC+b4ncYZmJox+vh6NP1Y5g4AYlrNv9CRXpy5Q8H0135TQmtnFU758sLVcrUe9K8KpX4N7DTHODQ4MNLpNDUMQK3PrBzmhfmXsohbAH08t2RL/bvKiverR6YbjcfW9kIFlJrkC6t0v/cBczyOs9ja5KGJL9zRmQSl4PAl0tz3X90TLX2Z8z9P5Gir/+rfDsf58sxOyvZypZTuGUj9mX7TIFkYki+igcjL1d4clR5g= Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id s7-20020a170906bc4700b00a3bbf7245a4si3615250ejv.599.2024.02.11.23.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:50:57 -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 D73B287EF9; Mon, 12 Feb 2024 08:48:53 +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 EA03387F08; Mon, 12 Feb 2024 08:48:51 +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 847D187F0E for ; Mon, 12 Feb 2024 08:48:49 +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 92AF5DA7; Sun, 11 Feb 2024 23:49:30 -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 C61C43F762; Sun, 11 Feb 2024 23:48:45 -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 20/21] configs: fwu: re-enable FWU configs Date: Mon, 12 Feb 2024 13:17:11 +0530 Message-Id: <20240212074712.3657076-21-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 Now that the migration to the FWU metadata version 2 is complete, the feature can be re-enabled on platforms which had it enabled. Signed-off-by: Sughosh Ganu --- Changes since V1: None configs/corstone1000_defconfig | 2 ++ configs/sandbox64_defconfig | 1 + configs/synquacer_developerbox_defconfig | 3 +++ 3 files changed, 6 insertions(+) diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig index c26a621175..a86ac12732 100644 --- a/configs/corstone1000_defconfig +++ b/configs/corstone1000_defconfig @@ -25,6 +25,7 @@ CONFIG_BOARD_LATE_INIT=y CONFIG_SYS_PROMPT="corstone1000# " CONFIG_SYS_MAXARGS=64 # CONFIG_CMD_CONSOLE is not set +CONFIG_CMD_FWU_METADATA=y CONFIG_CMD_BOOTZ=y # CONFIG_CMD_XIMG is not set CONFIG_CMD_GPT=y @@ -67,3 +68,4 @@ CONFIG_FFA_SHARED_MM_BUF_OFFSET=0 CONFIG_FFA_SHARED_MM_BUF_ADDR=0x02000000 CONFIG_EFI_CAPSULE_ON_DISK=y CONFIG_EFI_IGNORE_OSINDICATIONS=y +CONFIG_FWU_MULTI_BANK_UPDATE=y diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 2863f9b189..d101cca6a7 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -273,6 +273,7 @@ CONFIG_EFI_CAPSULE_ON_DISK=y CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y CONFIG_EFI_SECURE_BOOT=y CONFIG_TEST_FDTDEC=y +CONFIG_FWU_MULTI_BANK_UPDATE=y CONFIG_UNIT_TEST=y CONFIG_UT_TIME=y CONFIG_UT_DM=y diff --git a/configs/synquacer_developerbox_defconfig b/configs/synquacer_developerbox_defconfig index 616d410074..1bb55be0a7 100644 --- a/configs/synquacer_developerbox_defconfig +++ b/configs/synquacer_developerbox_defconfig @@ -17,6 +17,7 @@ CONFIG_SYS_BOOTM_LEN=0x800000 CONFIG_BOOTSTAGE_STASH_SIZE=4096 CONFIG_HUSH_PARSER=y CONFIG_SYS_MAXARGS=128 +CONFIG_CMD_FWU_METADATA=y CONFIG_CMD_IMLS=y CONFIG_CMD_ERASEENV=y CONFIG_CMD_NVEDIT_EFI=y @@ -51,6 +52,7 @@ CONFIG_DFU_TFTP=y CONFIG_DFU_MTD=y CONFIG_DFU_RAM=y CONFIG_DFU_SF=y +CONFIG_FWU_MDATA_MTD=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_SYNQUACER=y CONFIG_MMC_SDHCI=y @@ -93,3 +95,4 @@ CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y CONFIG_EFI_CAPSULE_ON_DISK=y CONFIG_EFI_IGNORE_OSINDICATIONS=y CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y +CONFIG_FWU_MULTI_BANK_UPDATE=y From patchwork Mon Feb 12 07:47:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772043 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2001051wre; Sun, 11 Feb 2024 23:51:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXir4LBUbTjsjD70uMrneNZx+jdMEJwj8nKb0FtftkEGg17eXS6cGGkvjnMz3I/sRHEA4oVLQGNh2t6MvIzuURs X-Google-Smtp-Source: AGHT+IFg2f7uMOfjVWCaKzEuOv26IuKRmgi8ieK9A7oFPMEjX9ZViaugjDmUqBSF5bq4wReA6PyV X-Received: by 2002:a17:906:552:b0:a38:a174:1316 with SMTP id k18-20020a170906055200b00a38a1741316mr4796843eja.72.1707724268182; Sun, 11 Feb 2024 23:51:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724268; cv=none; d=google.com; s=arc-20160816; b=jYKrE78ODf7lhP0nH1ehaPFfX/zh/5KsipySteYrjdeEKNS5Sff58i3tAXxDDR4Hj9 uzyHBadKjon5NRx6V3Jrxfjt0GjKXQgJPNDBJOA2tEaDrZy17TRvUd3e4a2d2fDud+6d YMo8aIp38QnYUFzdu6pb2BsvoC62k40oa8vIdoWDb4nwmcYfIK2XPZTKvZR64JokRWZ1 BDABdEB1Th81c3i3cLmuj3r1p1+OuQfRmlweMZMJAR5Tqk4/Wpkc7twglnoQir7Q37XH E0Q/3Zum/jlFkE/x5FnrMb9ZBmAjTsk78mJjaT+Z2Qltz2fmEEhY6FFd3E9Zx8SM65P9 uZBA== 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=fBdT9YGMDt41jr/idPnszGetZNrVC6K6T3Kr+ITe0Vk=; fh=6Dd4NlVKI7ZC94T8G4HNieUf/tn/VeIZdapt665fUtI=; b=jrQdIX39snvM1aG3tQ8PnCLxOkcU07G0szJChL4yLNvSOLuzsZoXu/3vj80D0gkO9H VIcWjwE5PjN3Ta772PCbpz/dXKenzFlQve/5VaFjRiNmo5fYhw+rZ+8jJMy4PqI214u7 49qWUVPQvckZ+v38HR5RihcECOYqoleDhtXY20g5xC8w/vBAZrbPphOR/+Gg4EkD9Cd4 xu71coB1n5++/dHQ2bfONnjSjgtxADrWJxqkE7qnPgQryhDIxmsWYfmh63TlKVFgz0EG Y3ptF1pgKBnYR0A8a7ZK7bfcH24iy3bfyCw8l2yhcQDc9lv6wT8v/gBrsGPE0MwRZIp2 8a8w==; 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; AJvYcCX++YZboSOXOMwj3v4Ih+RW7K+B6YFDKTXLwnBviYsD1LvaPUIKRixgxHcWeOQyh58DPhaebUzDD6nz/8fro1ucF41dD/17qZuwzAkmj5Q0T4ajyrgnkN0w18zooB83ve+OeVqqahgy1TwEe5PkID8fnQF+bps1PuePIx7o4FlXLE1z70AVmMWx0kpxTsw7N0iXME/BuYEkn69hpD18nfAXtC9PVcAisS29hxX4wiHv7RouUFbgc3uhXUIdBCJonoeXp3TjvBMcBSXOHNgpu1bbIgPCaCW0nV34pWbEA/f8NSPSGFwQGkos0EP10beblH/XzHNzjA0QUeUic0R1yChr4X2TaVubEMw8jBCO+cftsqJT5GmfBUk7RyPY8XpyYz0NUtWv9k6j50es6AE5Ew+NGBWfyPxbVJVTSLhdATRQTHX5OhWz/nm1Mb3WigbYC5Stfdt1+EgBwDNfdowWO5HPH2vE+JNqH1/Jk8whrmXJbP1/BPpj/EAOB/ZPmaiNbWoahmMXmhWHLNwAJyJyNJoJDvqEbhM+HiFpJQizsO8wA89Abpf16nGJrjlmTzAJMk8hVILi6k5uJImkwRA8qpl3JT+iX5C97v5gFRnKxH2hoZDR9ocCU2zIZCNlhZFOxOnnXuM3DEVxzGINeN/GQKPC+E+GWYqD5CSqpSCNBm3yZl36S1P2vDGjvY3am/8T93Mv9LOMQN7e+DO9vN9VRdb2SHJGRsG8jTmvGzkjDeZb91AfyRVr/h+vUXkUJ78Maig+gDP/IELh7aeZYatR6TFrtr3QpXsecdvhMjmq8xSM7Y47I0gGDzI14wTgUD3ntQPvT82ED9BssbWxQpxqF33luNvfCXtqcVgE+cWmU/1xVFI= 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 h26-20020a170906261a00b00a39e2f9cecdsi3564927ejc.559.2024.02.11.23.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:51:08 -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 4F21E87ECD; Mon, 12 Feb 2024 08:48:57 +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 4387A87ECD; Mon, 12 Feb 2024 08:48:56 +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 47BA387ECC for ; Mon, 12 Feb 2024 08:48:53 +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 555EADA7; Sun, 11 Feb 2024 23:49:34 -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 88DFF3F762; Sun, 11 Feb 2024 23:48:49 -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 21/21] doc: fwu: make changes for supporting FWU Metadata version 2 Date: Mon, 12 Feb 2024 13:17:12 +0530 Message-Id: <20240212074712.3657076-22-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 Make changes to the FWU documentation to reflect the changes made with migration of the FWU metadata to version 2. Signed-off-by: Sughosh Ganu --- Changes since V1: None doc/board/socionext/developerbox.rst | 9 +++------ doc/develop/uefi/fwu_updates.rst | 12 +++++------- doc/usage/cmd/fwu_mdata.rst | 12 ++++++++---- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/doc/board/socionext/developerbox.rst b/doc/board/socionext/developerbox.rst index 46712c379b..d8c1bb4986 100644 --- a/doc/board/socionext/developerbox.rst +++ b/doc/board/socionext/developerbox.rst @@ -113,8 +113,6 @@ configs/synquacer_developerbox_defconfig enables default FWU configuration :: CONFIG_FWU_MULTI_BANK_UPDATE=y CONFIG_FWU_MDATA=y CONFIG_FWU_MDATA_MTD=y - CONFIG_FWU_NUM_BANKS=2 - CONFIG_FWU_NUM_IMAGES_PER_BANK=1 CONFIG_CMD_FWU_METADATA=y And build it:: @@ -126,10 +124,9 @@ And build it:: make -j `noproc` cd ../ -By default, the CONFIG_FWU_NUM_BANKS and CONFIG_FWU_NUM_IMAGES_PER_BANKS are -set to 2 and 1 respectively. This uses FIP (Firmware Image Package) type image -which contains TF-A, U-Boot and OP-TEE (the OP-TEE is optional). -You can use fiptool to compose the FIP image from those firmware images. +This uses FIP (Firmware Image Package) type image which contains TF-A, +U-Boot and OP-TEE (the OP-TEE is optional). You can use fiptool to +compose the FIP image from those firmware images. Rebuild SCP firmware -------------------- diff --git a/doc/develop/uefi/fwu_updates.rst b/doc/develop/uefi/fwu_updates.rst index e4709d82b4..7911c954d9 100644 --- a/doc/develop/uefi/fwu_updates.rst +++ b/doc/develop/uefi/fwu_updates.rst @@ -43,8 +43,6 @@ The feature can be enabled by specifying the following configs:: CONFIG_FWU_MULTI_BANK_UPDATE=y CONFIG_FWU_MDATA=y CONFIG_FWU_MDATA_GPT_BLK=y - CONFIG_FWU_NUM_BANKS= - CONFIG_FWU_NUM_IMAGES_PER_BANK= in the .config file @@ -94,12 +92,12 @@ of. Each GPT partition entry in the GPT header has two GUIDs:: * UniquePartitionGUID The PartitionTypeGUID value should correspond to the -``image_type_uuid`` field of the FWU metadata. This field is used to +``image_type_guid`` field of the FWU metadata. This field is used to identify a given type of updatable firmware image, e.g. U-Boot, OP-TEE, FIP etc. This GUID should also be used for specifying the `--guid` parameter when generating the capsule. -The UniquePartitionGUID value should correspond to the ``image_uuid`` +The UniquePartitionGUID value should correspond to the ``image_guid`` field in the FWU metadata. This GUID is used to identify images of a given image type in different banks. @@ -108,8 +106,8 @@ metadata partitions. This would be the PartitionTypeGUID for the metadata partitions. Similarly, the UEFI specification defines the ESP GUID to be be used. -When generating the metadata, the ``image_type_uuid`` and the -``image_uuid`` values should match the *PartitionTypeGUID* and the +When generating the metadata, the ``image_type_guid`` and the +``image_guid`` values should match the *PartitionTypeGUID* and the *UniquePartitionGUID* values respectively. Performing the Update @@ -181,5 +179,5 @@ empty capsule would be:: Links ----- -* [1] https://developer.arm.com/documentation/den0118/a/ - FWU Specification +* [1] https://developer.arm.com/documentation/den0118/ - FWU Specification * [2] https://git.codelinaro.org/linaro/dependable-boot/mbfw/uploads/6f7ddfe3be24e18d4319e108a758d02e/mbfw.pdf - Dependable Boot Specification diff --git a/doc/usage/cmd/fwu_mdata.rst b/doc/usage/cmd/fwu_mdata.rst index f1bf08fde1..1804422b33 100644 --- a/doc/usage/cmd/fwu_mdata.rst +++ b/doc/usage/cmd/fwu_mdata.rst @@ -26,10 +26,14 @@ The output may look like: => fwu_mdata_read FWU Metadata - crc32: 0xec4fb997 - version: 0x1 - active_index: 0x0 - previous_active_index: 0x1 + crc32: 0x13c330 + version: 0x2 + active_index: 0x1 + previous_active_index: 0x0 + bank_state[0]: 0xfc + bank_state[1]: 0xfc + bank_state[2]: 0xff + bank_state[3]: 0xff Image Info Image Type Guid: 19D5DF83-11B0-457B-BE2C-7559C13142A5