mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
bootstd: Switch bootdev scanning to use labels
At present we set up the bootdev order at the start, then scan the bootdevs one by one. However this approach cannot be used with hunters, since the bootdevs may not exist until the hunter is used. Nor can we just run all the hunters at the start, since that violate's U-Boot's 'lazy init' requirement. It also increases boot time. So we need to adjust the algorithm to scan by labels instead. As a first step, drop the dev_order[] array in favour of a list of labels. Update the name of bootdev_setup_iter_order() to better reflect what it does. Update some related comments and log messages. Also disable a few tests until a later commit where we can use them. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
18552d2a72
commit
47aedc29dc
6 changed files with 147 additions and 152 deletions
|
@ -55,7 +55,10 @@ static int bootflow_cmd(struct unit_test_state *uts)
|
|||
ut_assert_nextline("Scanning for bootflows in bootdev 'mmc1.bootdev'");
|
||||
ut_assert_nextline("Seq Method State Uclass Part Name Filename");
|
||||
ut_assert_nextlinen("---");
|
||||
ut_assert_nextline("Scanning bootdev 'mmc2.bootdev':");
|
||||
ut_assert_nextline("Scanning bootdev 'mmc1.bootdev':");
|
||||
ut_assert_nextline(" 0 syslinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf");
|
||||
ut_assert_nextline("No more bootdevs");
|
||||
ut_assert_nextlinen("---");
|
||||
ut_assert_nextline("(1 bootflow, 1 valid)");
|
||||
ut_assert_console_end();
|
||||
|
@ -73,28 +76,55 @@ static int bootflow_cmd(struct unit_test_state *uts)
|
|||
}
|
||||
BOOTSTD_TEST(bootflow_cmd, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
|
||||
|
||||
/* Check 'bootflow scan' with a name / label / seq */
|
||||
#if 0 /* disable for now */
|
||||
/* Check 'bootflow scan' with a label / seq */
|
||||
static int bootflow_cmd_label(struct unit_test_state *uts)
|
||||
{
|
||||
test_set_eth_enable(false);
|
||||
|
||||
console_record_reset_enable();
|
||||
ut_assertok(run_command("bootflow scan -lH mmc1", 0));
|
||||
ut_assert_nextline("Scanning for bootflows in bootdev 'mmc1.bootdev'");
|
||||
ut_assert_nextline("Scanning for bootflows with label 'mmc1'");
|
||||
ut_assert_skip_to_line("(1 bootflow, 1 valid)");
|
||||
ut_assert_console_end();
|
||||
|
||||
ut_assertok(run_command("bootflow scan -lH mmc0.bootdev", 0));
|
||||
ut_assert_nextline("Scanning for bootflows in bootdev 'mmc0.bootdev'");
|
||||
ut_assertok(run_command("bootflow scan -lH 0", 0));
|
||||
ut_assert_nextline("Scanning for bootflows with label '0'");
|
||||
ut_assert_skip_to_line("(0 bootflows, 0 valid)");
|
||||
ut_assert_console_end();
|
||||
|
||||
/*
|
||||
* with ethernet enabled we have 8 devices ahead of the mmc ones:
|
||||
*
|
||||
* ut_assertok(run_command("bootdev list", 0));
|
||||
* Seq Probed Status Uclass Name
|
||||
* --- ------ ------ -------- ------------------
|
||||
* 0 [ + ] OK ethernet eth@10002000.bootdev
|
||||
* 1 [ ] OK ethernet eth@10003000.bootdev
|
||||
* 2 [ ] OK ethernet sbe5.bootdev
|
||||
* 3 [ ] OK ethernet eth@10004000.bootdev
|
||||
* 4 [ ] OK ethernet phy-test-eth.bootdev
|
||||
* 5 [ ] OK ethernet dsa-test-eth.bootdev
|
||||
* 6 [ ] OK ethernet dsa-test@0.bootdev
|
||||
* 7 [ ] OK ethernet dsa-test@1.bootdev
|
||||
* 8 [ ] OK mmc mmc2.bootdev
|
||||
* 9 [ + ] OK mmc mmc1.bootdev
|
||||
* a [ ] OK mmc mmc0.bootdev
|
||||
*/
|
||||
ut_assertok(run_command("bootflow scan -lH 9", 0));
|
||||
ut_assert_nextline("Scanning for bootflows with label '9'");
|
||||
ut_assert_skip_to_line("(1 bootflow, 1 valid)");
|
||||
|
||||
ut_assertok(run_command("bootflow scan -lH 0", 0));
|
||||
ut_assert_nextline("Scanning for bootflows in bootdev 'mmc2.bootdev'");
|
||||
ut_assert_nextline("Scanning for bootflows with label '0'");
|
||||
ut_assert_skip_to_line("(0 bootflows, 0 valid)");
|
||||
ut_assert_console_end();
|
||||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_cmd_label, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
|
||||
BOOTSTD_TEST(bootflow_cmd_label, UT_TESTF_DM | UT_TESTF_SCAN_FDT |
|
||||
UT_TESTF_ETH_BOOTDEV);
|
||||
#endif
|
||||
|
||||
/* Check 'bootflow scan/list' commands using all bootdevs */
|
||||
static int bootflow_cmd_glob(struct unit_test_state *uts)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue