From e4b694893f6cf1e4ac934f2ecb57c8e77a17e5b2 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 17 Jan 2023 10:48:10 -0700 Subject: 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 --- include/bootdev.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/bootdev.h') diff --git a/include/bootdev.h b/include/bootdev.h index b1e320a7d8e..300bc736427 100644 --- a/include/bootdev.h +++ b/include/bootdev.h @@ -333,6 +333,22 @@ int bootdev_hunt_prio(enum bootdev_prio_t prio, bool show); int bootdev_hunt_and_find_by_label(const char *label, struct udevice **devp, int *method_flagsp); +/** + * bootdev_next_label() - Move to the next bootdev in the label sequence + * + * Looks through the remaining labels until it finds one that matches a bootdev. + * Bootdev scanners are used as needed. For example a label "mmc1" results in + * running the "mmc" bootdrv. + * + * @iter: Interation info, containing iter->cur_label + * @devp: New bootdev found, if any was found + * @method_flagsp: If non-NULL, returns any flags implied by the label + * (enum bootflow_meth_flags_t), 0 if none + * Returns 0 if OK, -ENODEV if no bootdev was found + */ +int bootdev_next_label(struct bootflow_iter *iter, struct udevice **devp, + int *method_flagsp); + #if CONFIG_IS_ENABLED(BOOTSTD) /** * bootdev_setup_for_dev() - Bind a new bootdev device (deprecated) -- cgit v1.2.3