From 1736b4af0e8a30aa3e9d0720c07dfb70fb16dceb Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 24 Apr 2023 13:49:47 +1200 Subject: bootstd: Report missing labels only when asked Use the -l flag to indicate whether to report missing uclasses. Also try to be more helpful when no devices are found. For example, when we see something 'scsi0' requested and nothing was found, this indicates that there are no SCSI devices, so show a suitable message. Move messages out of the low-level functions so that silent operation is possible. This means they are never reported unless BOOTSTD_FULL is enabled, since the -l flag cannot otherwise be set. Suggested-by: Tom Rini Signed-off-by: Simon Glass --- test/boot/bootdev.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'test/boot/bootdev.c') diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c index 4fe9fd72208..0899c78c2c4 100644 --- a/test/boot/bootdev.c +++ b/test/boot/bootdev.c @@ -124,7 +124,8 @@ static int bootdev_test_labels(struct unit_test_state *uts) mflags); /* Check invalid uclass */ - ut_asserteq(-EINVAL, bootdev_find_by_label("fred0", &dev, &mflags)); + ut_asserteq(-EPFNOSUPPORT, + bootdev_find_by_label("fred0", &dev, &mflags)); /* Check unknown sequence number */ ut_asserteq(-ENOENT, bootdev_find_by_label("mmc6", &dev, &mflags)); @@ -179,9 +180,8 @@ static int bootdev_test_any(struct unit_test_state *uts) /* Check invalid uclass */ mflags = 123; - ut_asserteq(-EINVAL, bootdev_find_by_any("fred0", &dev, &mflags)); - ut_assert_nextline("Unknown uclass 'fred0' in label"); - ut_assert_nextline("Cannot find bootdev 'fred0' (err=-22)"); + ut_asserteq(-EPFNOSUPPORT, bootdev_find_by_any("fred0", &dev, &mflags)); + ut_assert_nextline("Cannot find bootdev 'fred0' (err=-96)"); ut_asserteq(123, mflags); ut_assert_console_end(); @@ -512,9 +512,8 @@ static int bootdev_test_hunt_label(struct unit_test_state *uts) old = (void *)&mflags; /* arbitrary pointer to check against dev */ dev = old; mflags = 123; - ut_asserteq(-EINVAL, + ut_asserteq(-EPFNOSUPPORT, bootdev_hunt_and_find_by_label("fred", &dev, &mflags)); - ut_assert_nextline("Unknown uclass 'fred' in label"); ut_asserteq_ptr(old, dev); ut_asserteq(123, mflags); ut_assert_console_end(); @@ -525,7 +524,6 @@ static int bootdev_test_hunt_label(struct unit_test_state *uts) bootdev_hunt_and_find_by_label("mmc4", &dev, &mflags)); ut_asserteq_ptr(old, dev); ut_asserteq(123, mflags); - ut_assert_nextline("Unknown seq 4 for label 'mmc4'"); ut_assert_console_end(); ut_assertok(bootstd_test_check_mmc_hunter(uts)); -- cgit v1.2.3 From 80778f505c8c7ee18c24cfbcfe011f8a2abf7bcd Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 25 Apr 2023 10:54:30 -0600 Subject: ide: Move ide_init() into probing At present the code does ide_init() as a separate operation, then calls device_probe() to copy over the information. We can call ide_init() from probe just as easily. The only difference is that using 'ide init' twice will do nothing. However it already fails to copy over the new data in that case, so the effect is the same. For now, unbind the block devices and remove the IDE device, which causes the bus to be probed again. Later patches will fix this up fully, so that all blk_desc data is copied across. Since ide_reset() is only called from ide_init(), there is no need to init the ide_dev_desc[] array. This is already done at the end of ide_init() so drop this code. The call to uclass_first_device() is now within the probe() function of the same device, so does nothing. Drop it. Signed-off-by: Simon Glass --- test/boot/bootdev.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'test/boot/bootdev.c') diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c index 0899c78c2c4..8cf3f30e0f7 100644 --- a/test/boot/bootdev.c +++ b/test/boot/bootdev.c @@ -376,7 +376,6 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts) ut_assert_nextline("Hunting with: simple_bus"); ut_assert_nextline("Found 2 extension board(s)."); ut_assert_nextline("Hunting with: ide"); - ut_assert_nextline("Bus 0: not available "); /* mmc hunter has already been used so should not run again */ @@ -487,7 +486,6 @@ static int bootdev_test_hunt_prio(struct unit_test_state *uts) /* now try a different priority, verbosely */ ut_assertok(bootdev_hunt_prio(BOOTDEVP_5_SCAN_SLOW, true)); ut_assert_nextline("Hunting with: ide"); - ut_assert_nextline("Bus 0: not available "); ut_assert_nextline("Hunting with: usb"); ut_assert_nextline( "Bus usb@1: scanning bus usb@1 for devices... 5 USB Device(s) found"); -- cgit v1.2.3