From 7c694af3fd5de372349f740b62cd3d909483fe2e Mon Sep 17 00:00:00 2001
From: Rui Miguel Silva <rui.silva@linaro.org>
Date: Wed, 1 Feb 2023 16:19:40 +0000
Subject: [PATCH 40/43] corstone1000: add nvmxip, fwu-mdata and gpt options

Enable the newest features: nvmxip, fwu-metadata and
gpt. Commands to print the partition info, gpt info
and fwu metadata will be available.

Upstream-Status: Pending
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
---
 configs/corstone1000_defconfig | 31 +++++++++++++++++++------------
 fs/fs.c                        |  5 +++++
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
index e009faee0252..711cf13592db 100644
--- a/configs/corstone1000_defconfig
+++ b/configs/corstone1000_defconfig
@@ -4,13 +4,15 @@ CONFIG_TARGET_CORSTONE1000=y
 CONFIG_TEXT_BASE=0x80000000
 CONFIG_SYS_MALLOC_LEN=0x2000000
 CONFIG_NR_DRAM_BANKS=1
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x83f00000
+CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="corstone1000-mps3"
 CONFIG_SYS_PROMPT="corstone1000# "
 CONFIG_IDENT_STRING=" corstone1000 aarch64 "
 CONFIG_SYS_LOAD_ADDR=0x82100000
+CONFIG_FWU_NUM_IMAGES_PER_BANK=4
 CONFIG_DISTRO_DEFAULTS=y
-CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x83f00000
 CONFIG_FIT=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
@@ -23,11 +25,16 @@ CONFIG_LOGLEVEL=7
 CONFIG_SYS_MAXARGS=64
 CONFIG_SYS_CBSIZE=512
 # CONFIG_CMD_CONSOLE is not set
+CONFIG_CMD_FWU_METADATA=y
 CONFIG_CMD_BOOTZ=y
 CONFIG_SYS_BOOTM_LEN=0x800000
 # CONFIG_CMD_XIMG is not set
+CONFIG_CMD_NVMXIP=y
+CONFIG_CMD_GPT=y
+# CONFIG_RANDOM_UUID is not set
 CONFIG_CMD_LOADM=y
 # CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 # CONFIG_CMD_NFS is not set
@@ -39,29 +46,29 @@ CONFIG_OF_CONTROL=y
 CONFIG_VERSION_VARIABLE=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_REGMAP=y
-CONFIG_MISC=y
+CONFIG_ARM_FFA_TRANSPORT=y
 CONFIG_CLK=y
-CONFIG_CMD_MMC=y
-CONFIG_DM_MMC=y
+CONFIG_FWU_MDATA=y
+CONFIG_FWU_MDATA_GPT_BLK=y
+CONFIG_MISC=y
 CONFIG_ARM_PL180_MMCI=y
-CONFIG_MMC_SDHCI_ADMA_HELPERS=y
-CONFIG_MMC_WRITE=y
-CONFIG_DM_GPIO=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_SMSC=y
 CONFIG_SMC911X=y
+CONFIG_NVMXIP_QSPI=y
 CONFIG_PHY=y
 CONFIG_RAM=y
 CONFIG_DM_RTC=y
 CONFIG_RTC_EMULATION=y
 CONFIG_DM_SERIAL=y
+CONFIG_SYSRESET=y
 CONFIG_USB=y
 CONFIG_USB_ISP1760=y
 CONFIG_ERRNO_STR=y
-CONFIG_NVMXIP_QSPI=y
-CONFIG_CMD_NVMXIP=y
 CONFIG_EFI_MM_COMM_TEE=y
-CONFIG_ARM_FFA_TRANSPORT=y
 CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_IGNORE_OSINDICATIONS=y
 CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
-CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+CONFIG_FWU_MULTI_BANK_UPDATE=y
+# CONFIG_TOOLS_MKEFICAPSULE is not set
diff --git a/fs/fs.c b/fs/fs.c
index 8324b4a22f20..f54955a2b7f6 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -437,11 +437,13 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
 	}
 #endif
 
+	log_err("RUI: fs_set_blk_dev fstype: %d\n", fstype);
 	part = part_get_info_by_dev_and_name_or_num(ifname, dev_part_str, &fs_dev_desc,
 						    &fs_partition, 1);
 	if (part < 0)
 		return -1;
 
+	log_err("RUI: fs_set_blk_dev 1\n");
 	for (i = 0, info = fstypes; i < ARRAY_SIZE(fstypes); i++, info++) {
 		if (fstype != FS_TYPE_ANY && info->fstype != FS_TYPE_ANY &&
 				fstype != info->fstype)
@@ -450,6 +452,8 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
 		if (!fs_dev_desc && !info->null_dev_desc_ok)
 			continue;
 
+		log_err("RUI: fs_set_blk_dev 2: info->fstype: %d part: %d\n",
+			info->fstype, part);
 		if (!info->probe(fs_dev_desc, &fs_partition)) {
 			fs_type = info->fstype;
 			fs_dev_part = part;
@@ -457,6 +461,7 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
 		}
 	}
 
+	log_err("RUI: fs_set_blk_dev 3\n");
 	return -1;
 }
 
-- 
2.39.2

