summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSean Anderson <sean.anderson@seco.com>2021-02-05 09:39:00 -0500
committerMarek Vasut <marex@denx.de>2021-02-26 15:30:55 +0100
commitde1728ce4c86e77fd77e0b4f4f16eecaf8c00f8d (patch)
treeb70dbbf4ccf997341056d7c3afd673a85161b3e6 /test
parentae5e6b4e8f91c4de7814c0308097b05c8e5358a1 (diff)
downloadu-boot-de1728ce4c86e77fd77e0b4f4f16eecaf8c00f8d.tar.gz
u-boot-de1728ce4c86e77fd77e0b4f4f16eecaf8c00f8d.tar.xz
u-boot-de1728ce4c86e77fd77e0b4f4f16eecaf8c00f8d.zip
fastboot: Allow u-boot-style partitions
This adds support for partitions of the form "dev.hwpart:part" and "dev#partname". This allows one to flash to eMMC boot partitions without having to use CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT. It also allows one to flash to an entire device without needing CONFIG_FASTBOOT_MMC_USER_NAME. Lastly, one can also flash MMC devices other than CONFIG_FASTBOOT_FLASH_MMC_DEV. Because devices can be specified explicitly, CONFIG_FASTBOOT_FLASH_MMC_DEV is used only when necessary for existing functionality. For those cases, fastboot_mmc_get_dev has been added as a helper function. This allows There should be no conflicts with the existing system, but just in case, I have ordered detection of these names after all existing names. The fastboot_mmc_part test has been updated for these new names. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/dm/fastboot.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/test/dm/fastboot.c b/test/dm/fastboot.c
index 8f905d8fa8..e7f8c362b8 100644
--- a/test/dm/fastboot.c
+++ b/test/dm/fastboot.c
@@ -35,9 +35,12 @@ static int dm_test_fastboot_mmc_part(struct unit_test_state *uts)
},
};
- ut_assertok(blk_get_device_by_str("mmc",
- __stringify(CONFIG_FASTBOOT_FLASH_MMC_DEV),
- &mmc_dev_desc));
+ /*
+ * There are a lot of literal 0s I don't want to have to construct from
+ * MMC_DEV.
+ */
+ ut_asserteq(0, CONFIG_FASTBOOT_FLASH_MMC_DEV);
+ ut_assertok(blk_get_device_by_str("mmc", "0", &mmc_dev_desc));
if (CONFIG_IS_ENABLED(RANDOM_UUID)) {
gen_rand_uuid_str(parts[0].uuid, UUID_STR_FORMAT_STD);
gen_rand_uuid_str(parts[1].uuid, UUID_STR_FORMAT_STD);
@@ -59,6 +62,34 @@ static int dm_test_fastboot_mmc_part(struct unit_test_state *uts)
&part_info, response));
ut_assertok(env_set(FB_ALIAS_PREFIX "test3", NULL));
+ /* "New" partition labels */
+ ut_asserteq(1, fastboot_mmc_get_part_info("#test1", &fb_dev_desc,
+ &part_info, response));
+ ut_asserteq(1, fastboot_mmc_get_part_info("0#test1", &fb_dev_desc,
+ &part_info, response));
+ ut_asserteq(1, fastboot_mmc_get_part_info("0.0#test1", &fb_dev_desc,
+ &part_info, response));
+ ut_asserteq(1, fastboot_mmc_get_part_info("0:1", &fb_dev_desc,
+ &part_info, response));
+ ut_asserteq(1, fastboot_mmc_get_part_info("0.0:1", &fb_dev_desc,
+ &part_info, response));
+ ut_asserteq(1, fastboot_mmc_get_part_info("0", &fb_dev_desc,
+ &part_info, response));
+ ut_asserteq(1, fastboot_mmc_get_part_info("0.0", &fb_dev_desc,
+ &part_info, response));
+ ut_asserteq(0, fastboot_mmc_get_part_info("0:0", &fb_dev_desc,
+ &part_info, response));
+ ut_asserteq(0, fastboot_mmc_get_part_info("0.0:0", &fb_dev_desc,
+ &part_info, response));
+ ut_asserteq(0, fastboot_mmc_get_part_info("1", &fb_dev_desc,
+ &part_info, response));
+ ut_asserteq(0, fastboot_mmc_get_part_info("1.0", &fb_dev_desc,
+ &part_info, response));
+ ut_asserteq(1, fastboot_mmc_get_part_info(":1", &fb_dev_desc,
+ &part_info, response));
+ ut_asserteq(0, fastboot_mmc_get_part_info(":0", &fb_dev_desc,
+ &part_info, response));
+
return 0;
}
DM_TEST(dm_test_fastboot_mmc_part, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);