[Concept,13/15] boot: Run global bootmeths after all bootdevs are exhausted
Commit Message
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>
---
boot/bootflow.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
@@ -417,6 +417,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!
@@ -530,6 +542,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");