summaryrefslogtreecommitdiff
path: root/boot/bootflow.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2025-10-15 16:44:08 +0100
committerTom Rini <trini@konsulko.com>2025-10-22 14:16:56 -0600
commitbef963cb751049cacc86f2754452efadd03ae2f0 (patch)
tree8d3ab1a17fb3204b9d978bfc91caac75d6690a31 /boot/bootflow.c
parent0fe6de0dc5b137a2def3a8cc0baa2fb73a3f8541 (diff)
boot: Keep track of which bootmeths have been used
Add a bitfield which tracks when bootmeths have been used. This will be needed when global bootmeths can be used later in the iteration. Fix a missing bootflow_free() while here. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/bootflow.c')
-rw-r--r--boot/bootflow.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/boot/bootflow.c b/boot/bootflow.c
index 62634a59a94..2e4d1a345cd 100644
--- a/boot/bootflow.c
+++ b/boot/bootflow.c
@@ -17,6 +17,10 @@
#include <dm/device-internal.h>
#include <dm/uclass-internal.h>
+/* ensure BOOTMETH_MAX_COUNT fits in method_flags field */
+static_assert(BOOTMETH_MAX_COUNT <=
+ (sizeof(((struct bootflow_iter *)NULL)->method_flags) * 8));
+
/* error codes used to signal running out of things */
enum {
BF_NO_MORE_PARTS = -ESHUTDOWN,
@@ -433,6 +437,10 @@ int bootflow_scan_first(struct udevice *dev, const char *label,
bootflow_iter_set_dev(iter, dev, method_flags);
}
+ if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL)) {
+ iter->methods_done |= BIT(iter->cur_method);
+ log_debug("methods_done now %x\n", iter->cur_method);
+ }
ret = bootflow_check(iter, bflow);
if (ret) {
log_debug("check - ret=%d\n", ret);
@@ -460,6 +468,11 @@ int bootflow_scan_next(struct bootflow_iter *iter, struct bootflow *bflow)
return log_msg_ret("done", ret);
if (!ret) {
+ if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL)) {
+ iter->methods_done |= BIT(iter->cur_method);
+ log_debug("methods_done now %x\n",
+ iter->cur_method);
+ }
ret = bootflow_check(iter, bflow);
log_debug("check - ret=%d\n", ret);
if (!ret)