diff options
author | Simon Glass <sjg@chromium.org> | 2023-01-17 10:48:09 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-01-23 18:11:41 -0500 |
commit | 66e3dce78750f6fc4f6a402ce62c20ba95976dd1 (patch) | |
tree | ea4d629072d737d7ddfcc88e9af34e83ca5960a9 /test/boot/bootstd_common.c | |
parent | eacc261178b9c8024cb8de89ee4ca6c68d80d96a (diff) |
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>
Diffstat (limited to 'test/boot/bootstd_common.c')
-rw-r--r-- | test/boot/bootstd_common.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/boot/bootstd_common.c b/test/boot/bootstd_common.c index 7a40836507a..e71a2975c53 100644 --- a/test/boot/bootstd_common.c +++ b/test/boot/bootstd_common.c @@ -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); |