summaryrefslogtreecommitdiff
path: root/test/dm
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-04-25 23:02:27 +0300
committerTom Rini <trini@konsulko.com>2022-04-25 23:02:27 +0300
commit8cfac237b9814d52c843e939a05fc211ba3906de (patch)
tree975bba394b3c71a225283c2cb04ecda5c4bb189d /test/dm
parentbc9da9fb50ac3ba7603487a0366d4db60b984812 (diff)
parente7b2ce191ecab558b130b3b926dddcfc7231deb0 (diff)
downloadu-boot-8cfac237b9814d52c843e939a05fc211ba3906de.tar.xz
Merge branch '2022-04-25-initial-implementation-of-stdboot'
To quote the author: The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting. It introduces the following concepts: - bootdev - a device which can hold a distro - bootmeth - a method to scan a bootdev to find bootflows (owned by U-Boot) - bootflow - a description of how to boot (owned by the distro) This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot. With this we can boot on a Raspberry Pi 3 with just one command: bootflow scan -lb which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this. With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only. ... The design is described in these two documents: https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
Diffstat (limited to 'test/dm')
-rw-r--r--test/dm/blk.c6
-rw-r--r--test/dm/core.c17
-rw-r--r--test/dm/fastboot.c4
3 files changed, 25 insertions, 2 deletions
diff --git a/test/dm/blk.c b/test/dm/blk.c
index 8556cc7159..85c3a3bd45 100644
--- a/test/dm/blk.c
+++ b/test/dm/blk.c
@@ -15,6 +15,9 @@
DECLARE_GLOBAL_DATA_PTR;
+/* Allow resetting the USB-started flag */
+extern char usb_started;
+
/* Test that block devices can be created */
static int dm_test_blk_base(struct unit_test_state *uts)
{
@@ -66,8 +69,11 @@ static int dm_test_blk_usb(struct unit_test_state *uts)
struct udevice *usb_dev, *dev;
struct blk_desc *dev_desc;
+ usb_started = false;
+
/* Get a flash device */
state_set_skip_delays(true);
+ ut_assertok(usb_stop());
ut_assertok(usb_init());
ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 0, &usb_dev));
ut_assertok(blk_get_device_by_str("usb", "0", &dev_desc));
diff --git a/test/dm/core.c b/test/dm/core.c
index 0ce0b3c4a2..ebd504427d 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -1161,6 +1161,8 @@ static int dm_test_uclass_names(struct unit_test_state *uts)
ut_asserteq_str("test", uclass_get_name(UCLASS_TEST));
ut_asserteq(UCLASS_TEST, uclass_get_by_name("test"));
+ ut_asserteq(UCLASS_SPI, uclass_get_by_name("spi"));
+
return 0;
}
DM_TEST(dm_test_uclass_names, UT_TESTF_SCAN_PDATA);
@@ -1258,3 +1260,18 @@ static int dm_test_get_stats(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_get_stats, UT_TESTF_SCAN_FDT);
+
+/* Test uclass_find_device_by_name() */
+static int dm_test_uclass_find_device(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+
+ ut_assertok(uclass_find_device_by_name(UCLASS_I2C, "i2c@0", &dev));
+ ut_asserteq(-ENODEV,
+ uclass_find_device_by_name(UCLASS_I2C, "i2c@0x", &dev));
+ ut_assertok(uclass_find_device_by_namelen(UCLASS_I2C, "i2c@0x", 5,
+ &dev));
+
+ return 0;
+}
+DM_TEST(dm_test_uclass_find_device, UT_TESTF_SCAN_FDT);
diff --git a/test/dm/fastboot.c b/test/dm/fastboot.c
index e7f8c362b8..758538d0e8 100644
--- a/test/dm/fastboot.c
+++ b/test/dm/fastboot.c
@@ -81,9 +81,9 @@ static int dm_test_fastboot_mmc_part(struct unit_test_state *uts)
&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,
+ ut_asserteq(0, fastboot_mmc_get_part_info("2", &fb_dev_desc,
&part_info, response));
- ut_asserteq(0, fastboot_mmc_get_part_info("1.0", &fb_dev_desc,
+ ut_asserteq(0, fastboot_mmc_get_part_info("2.0", &fb_dev_desc,
&part_info, response));
ut_asserteq(1, fastboot_mmc_get_part_info(":1", &fb_dev_desc,
&part_info, response));