bootstd: Allow hunting for a bootdev by label

Add a function to hunt for a bootdev label and find the bootdev produced
by the hunter (or already present).

Add a few extra flags so that we can distinguish between "mmc1", "mmc" and
"1" which all need to be handled differently.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2023-01-17 10:48:09 -07:00 committed by Tom Rini
parent eacc261178
commit 66e3dce787
6 changed files with 195 additions and 5 deletions

View file

@ -7,6 +7,7 @@
*/
#include <common.h>
#include <bootdev.h>
#include <bootstd.h>
#include <dm.h>
#include <memalign.h>
@ -67,6 +68,24 @@ int bootstd_test_drop_bootdev_order(struct unit_test_state *uts)
return 0;
}
int bootstd_test_check_mmc_hunter(struct unit_test_state *uts)
{
struct bootdev_hunter *start, *mmc;
struct bootstd_priv *std;
uint seq;
/* get access to the used hunters */
ut_assertok(bootstd_get_priv(&std));
/* check that the hunter was used */
start = ll_entry_start(struct bootdev_hunter, bootdev_hunter);
mmc = BOOTDEV_HUNTER_GET(mmc_bootdev_hunter);
seq = mmc - start;
ut_asserteq(BIT(seq), std->hunters_used);
return 0;
}
int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
struct unit_test *tests = UNIT_TEST_SUITE_START(bootstd_test);