
From: Simon Glass <sjg@chromium.org> When there are no more bootdevs we should still go through the global bootmeths, since some may not have yet been used, if their priority has not yet come up. Add a final check for this at the end of the iterator. Signed-off-by: Simon Glass <sjg@chromium.org> --- (no changes since v1) boot/bootflow.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/boot/bootflow.c b/boot/bootflow.c index 98d57ef017e..30e0644a09e 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -419,6 +419,18 @@ static int iter_incr(struct bootflow_iter *iter) return 0; } + /* if this was the final global bootmeth check, we are done */ + if (iter->cur_prio == BOOTDEVP_COUNT) { + log_debug("-> done global bootmeths\n"); + + /* print the same message as bootflow_iter_set_dev() */ + if ((iter->flags & (BOOTFLOWIF_SHOW | + BOOTFLOWIF_SINGLE_DEV)) == + BOOTFLOWIF_SHOW) + printf("No more bootdevs\n"); + return BF_NO_MORE_DEVICES; + } + /* * Don't move to the next dev as we haven't tried this * one yet! @@ -532,6 +544,17 @@ static int iter_incr(struct bootflow_iter *iter) ret = prepare_bootdev(iter, dev, method_flags, true); } + if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) && ret) { + log_debug("no more bootdevs, trying global\n"); + + /* allow global bootmeths with any priority */ + iter->cur_prio = BOOTDEVP_COUNT; + if (!next_glob_bootmeth(iter)) { + log_debug("-> next method '%s'\n", iter->method->name); + return 0; + } + } + /* if there are no more bootdevs, give up */ if (ret) { log_debug("-> no more bootdevs\n"); -- 2.43.0