aboutsummaryrefslogtreecommitdiff
path: root/boot/bootflow.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-10-23 00:02:13 -0700
committerTom Rini <trini@konsulko.com>2023-10-23 13:05:13 -0400
commit7a790f018a812b5897fc144c46291de8df633429 (patch)
treefeab7d03d542bdf555462b311e75080e029388a4 /boot/bootflow.c
parent16e19350d91e3c7e916b85b84c0364b20ac193d2 (diff)
bootstd: Scan all bootdevs in a boot_targets entry (take 2)
When the boot_targets environment variable is used with the distro-boot scripts, each device is included individually. For example, if there are three mmc devices, then we will have something like: boot_targets="mmc0 mmc1 mmc2" In contrast, standard boot supports specifying just the uclass, i.e.: boot_targets="mmc" The intention is that this should scan all MMC devices, but in fact it currently only scans the first. Update the logic to handle this case, without required BOOTSTD_FULL to be enabled. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Date Huang <tjjh89017@hotmail.com> Reported-by: Vincent Stehlé <vincent.stehle@arm.com> Reported-by: Ivan Ivanov <ivan.ivanov@suse.com> Tested-by: Ivan T.Ivanov <iivanov@suse.de>
Diffstat (limited to 'boot/bootflow.c')
-rw-r--r--boot/bootflow.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/boot/bootflow.c b/boot/bootflow.c
index 7f5b0e9420..be543c8588 100644
--- a/boot/bootflow.c
+++ b/boot/bootflow.c
@@ -280,8 +280,26 @@ static int iter_incr(struct bootflow_iter *iter)
} else {
log_debug("labels %p\n", iter->labels);
if (iter->labels) {
- ret = bootdev_next_label(iter, &dev,
- &method_flags);
+ /*
+ * when the label is "mmc" we want to scan all
+ * mmc bootdevs, not just the first. See
+ * bootdev_find_by_label() where this flag is
+ * set up
+ */
+ if (iter->method_flags &
+ BOOTFLOW_METHF_SINGLE_UCLASS) {
+ scan_next_in_uclass(&dev);
+ log_debug("looking for next device %s: %s\n",
+ iter->dev->name,
+ dev ? dev->name : "<none>");
+ } else {
+ dev = NULL;
+ }
+ if (!dev) {
+ log_debug("looking at next label\n");
+ ret = bootdev_next_label(iter, &dev,
+ &method_flags);
+ }
} else {
ret = bootdev_next_prio(iter, &dev);
method_flags = 0;