diff options
author | Simon Glass <sjg@chromium.org> | 2023-01-17 10:48:10 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-01-23 18:11:41 -0500 |
commit | e4b694893f6cf1e4ac934f2ecb57c8e77a17e5b2 (patch) | |
tree | 6e416edec8454b22ebc3c459898b56742b857c40 /boot | |
parent | 66e3dce78750f6fc4f6a402ce62c20ba95976dd1 (diff) | |
download | u-boot-e4b694893f6cf1e4ac934f2ecb57c8e77a17e5b2.zip u-boot-e4b694893f6cf1e4ac934f2ecb57c8e77a17e5b2.tar.gz u-boot-e4b694893f6cf1e4ac934f2ecb57c8e77a17e5b2.tar.bz2 |
bootstd: Allow iterating to the next label in a list
Add a function which moves to the next label in a list of labels. This
allows processing the boot_targets environment variable.
This works using a new label list in the bootflow iterator. The logic to
set this up is included in a subsequent commit.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot')
-rw-r--r-- | boot/bootdev-uclass.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index dcaed4c..ae08430 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -566,6 +566,25 @@ void bootdev_clear_bootflows(struct udevice *dev) } } +int bootdev_next_label(struct bootflow_iter *iter, struct udevice **devp, + int *method_flagsp) +{ + struct udevice *dev; + + log_debug("next\n"); + for (dev = NULL; !dev && iter->labels[++iter->cur_label];) { + log_debug("Scanning: %s\n", iter->labels[iter->cur_label]); + bootdev_hunt_and_find_by_label(iter->labels[iter->cur_label], + &dev, method_flagsp); + } + + if (!dev) + return log_msg_ret("fin", -ENODEV); + *devp = dev; + + return 0; +} + /** * h_cmp_bootdev() - Compare two bootdevs to find out which should go first * @@ -763,8 +782,11 @@ int bootdev_hunt(const char *spec, bool show) log_debug("looking at %.*s for %s\n", (int)max(strlen(name), len), spec, name); - if (spec && strncmp(spec, name, max(strlen(name), len))) - continue; + if (spec && strncmp(spec, name, max(strlen(name), len))) { + if (info->uclass != UCLASS_ETH || + (strcmp("dhcp", spec) && strcmp("pxe", spec))) + continue; + } ret = bootdev_hunt_drv(info, i, show); if (ret) result = ret; |