From 43e89a306903117c8cb7105004f236acf1ec3d00 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 17 Jan 2023 10:48:11 -0700 Subject: bootstd: Allow iterating to the next bootdev priortiy Add a function which moves to the next priority to be processed. This works by storing the current priority in the bootflow iterator. The logic to set this up is included in a subsequent commit. Signed-off-by: Simon Glass --- include/bootdev.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/bootdev.h') diff --git a/include/bootdev.h b/include/bootdev.h index 300bc736427..4b6a8eb8d8f 100644 --- a/include/bootdev.h +++ b/include/bootdev.h @@ -349,6 +349,20 @@ int bootdev_hunt_and_find_by_label(const char *label, struct udevice **devp, int bootdev_next_label(struct bootflow_iter *iter, struct udevice **devp, int *method_flagsp); +/** + * bootdev_next_prio() - Find the next bootdev in priority order + * + * This moves @devp to the next bootdev with the current priority. If there is + * none, then it moves to the next priority and scans for new bootdevs there. + * + * @iter: Interation info, containing iter->cur_prio + * @devp: On entry this is the previous bootdev that was considered. On exit + * this is the new bootdev, if any was found + * Returns 0 on success (*devp is updated), -ENODEV if there are no more + * bootdevs at any priority + */ +int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp); + #if CONFIG_IS_ENABLED(BOOTSTD) /** * bootdev_setup_for_dev() - Bind a new bootdev device (deprecated) -- cgit v1.2.3