aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass2023-01-17 10:48:15 -0700
committerTom Rini2023-01-23 18:11:41 -0500
commit91943ff7038f9c47fb310dbc22150b5664c8fbf7 (patch)
tree34db142da2cb42b692d8589502234594ee7bc078 /include
parent47aedc29dcb9871e076f6e4aa82004633af513ef (diff)
bootstd: Allow scanning a single bootdev label
We want to support scanning a single label, like 'mmc' or 'usb0'. Add this feature by plumbing the label through to the iterator, setting a flag to indicate that only siblings of the initial device should be used. This means that scanning a bootdev by its name is not supported anymore. That feature doesn't seem very useful in practice, so it is no great loss. Add a test for bootdev_find_by_any() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/bootdev.h11
-rw-r--r--include/bootflow.h10
2 files changed, 14 insertions, 7 deletions
diff --git a/include/bootdev.h b/include/bootdev.h
index 8fa67487c63..b92ff4d4f15 100644
--- a/include/bootdev.h
+++ b/include/bootdev.h
@@ -267,10 +267,13 @@ int bootdev_find_by_any(const char *name, struct udevice **devp,
/**
* bootdev_setup_iter() - Set up iteration through bootdevs
*
- * This sets up the an interation, based on the priority of each bootdev, the
- * bootdev-order property in the bootstd node (or the boot_targets env var).
+ * This sets up the an interation, based on the provided device or label. If
+ * neither is provided, the iteration is based on the priority of each bootdev,
+ * the * bootdev-order property in the bootstd node (or the boot_targets env
+ * var).
*
* @iter: Iterator to update with the order
+ * @label: label to scan, or NULL to scan all
* @devp: On entry, *devp is NULL to scan all, otherwise this is the (single)
* device to scan. Returns the first device to use, which is the passed-in
* @devp if it was non-NULL
@@ -279,8 +282,8 @@ int bootdev_find_by_any(const char *name, struct udevice **devp,
* Return: 0 if OK, -ENOENT if no bootdevs, -ENOMEM if out of memory, other -ve
* on other error
*/
-int bootdev_setup_iter(struct bootflow_iter *iter, struct udevice **devp,
- int *method_flagsp);
+int bootdev_setup_iter(struct bootflow_iter *iter, const char *label,
+ struct udevice **devp, int *method_flagsp);
/**
* bootdev_list_hunters() - List the available bootdev hunters
diff --git a/include/bootflow.h b/include/bootflow.h
index bdb37352ab9..1b7920a9572 100644
--- a/include/bootflow.h
+++ b/include/bootflow.h
@@ -255,14 +255,18 @@ int bootflow_iter_drop_bootmeth(struct bootflow_iter *iter,
*
* @dev: Boot device to scan, NULL to work through all of them until it
* finds one that can supply a bootflow
+ * @label: Label to control the scan, NULL to work through all devices
+ * until it finds one that can supply a bootflow
* @iter: Place to store private info (inited by this call)
- * @flags: Flags for iterator (enum bootflow_flags_t)
+ * @flags: Flags for iterator (enum bootflow_flags_t). Note that if @dev
+ * is NULL, then BOOTFLOWF_SKIP_GLOBAL is set automatically by this function
* @bflow: Place to put the bootflow if found
* Return: 0 if found, -ENODEV if no device, other -ve on other error
* (iteration can continue)
*/
-int bootflow_scan_bootdev(struct udevice *dev, struct bootflow_iter *iter,
- int flags, struct bootflow *bflow);
+int bootflow_scan_bootdev(struct udevice *dev, const char *label,
+ struct bootflow_iter *iter, int flags,
+ struct bootflow *bflow);
/**
* bootflow_scan_first() - find the first bootflow