diff options
author | Simon Glass | 2023-01-17 10:48:11 -0700 |
---|---|---|
committer | Tom Rini | 2023-01-23 18:11:41 -0500 |
commit | 43e89a306903117c8cb7105004f236acf1ec3d00 (patch) | |
tree | ee93685486c00044f29b976853ed8677515bcdf0 /include | |
parent | e4b694893f6cf1e4ac934f2ecb57c8e77a17e5b2 (diff) |
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 <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/bootdev.h | 14 | ||||
-rw-r--r-- | include/bootflow.h | 3 |
2 files changed, 17 insertions, 0 deletions
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) diff --git a/include/bootflow.h b/include/bootflow.h index 8ab32ffd666..69ac90483c6 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -7,6 +7,7 @@ #ifndef __bootflow_h #define __bootflow_h +#include <bootdev.h> #include <dm/ofnode_decl.h> #include <linux/list.h> @@ -180,6 +181,7 @@ enum bootflow_meth_flags_t { * @num_methods: Number of bootmeth devices in @method_order * @cur_method: Current method number, an index into @method_order * @first_glob_method: First global method, if any, else -1 + * @cur_prio: Current priority being scanned * @method_order: List of bootmeth devices to use, in order. The normal methods * appear first, then the global ones, if any * @doing_global: true if we are iterating through the global bootmeths (which @@ -203,6 +205,7 @@ struct bootflow_iter { int num_methods; int cur_method; int first_glob_method; + enum bootdev_prio_t cur_prio; struct udevice **method_order; bool doing_global; int method_flags; |