aboutsummaryrefslogtreecommitdiffstats
path: root/include/bootdev.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-01-17 10:48:09 -0700
committerTom Rini <trini@konsulko.com>2023-01-23 18:11:41 -0500
commit66e3dce78750f6fc4f6a402ce62c20ba95976dd1 (patch)
treeea4d629072d737d7ddfcc88e9af34e83ca5960a9 /include/bootdev.h
parenteacc261178b9c8024cb8de89ee4ca6c68d80d96a (diff)
downloadu-boot-66e3dce78750f6fc4f6a402ce62c20ba95976dd1.tar.gz
bootstd: Allow hunting for a bootdev by label
Add a function to hunt for a bootdev label and find the bootdev produced by the hunter (or already present). Add a few extra flags so that we can distinguish between "mmc1", "mmc" and "1" which all need to be handled differently. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/bootdev.h')
-rw-r--r--include/bootdev.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/bootdev.h b/include/bootdev.h
index 65d14f24686..b1e320a7d8e 100644
--- a/include/bootdev.h
+++ b/include/bootdev.h
@@ -316,6 +316,23 @@ int bootdev_hunt(const char *spec, bool show);
*/
int bootdev_hunt_prio(enum bootdev_prio_t prio, bool show);
+/**
+ * bootdev_hunt_and_find_by_label() - Hunt for bootdevs by label
+ *
+ * Runs the hunter for the label, then tries to find the bootdev, possible
+ * created by the hunter
+ *
+ * @label: Label to look up (e.g. "mmc1" or "mmc0")
+ * @devp: Returns the bootdev device found, or NULL if none (note it does not
+ * return the media device, but its bootdev child)
+ * @method_flagsp: If non-NULL, returns any flags implied by the label
+ * (enum bootflow_meth_flags_t), 0 if none. Unset if function fails
+ * Return: 0 if OK, -EINVAL if the uclass is not supported by this board,
+ * -ENOENT if there is no device with that number
+ */
+int bootdev_hunt_and_find_by_label(const char *label, struct udevice **devp,
+ int *method_flagsp);
+
#if CONFIG_IS_ENABLED(BOOTSTD)
/**
* bootdev_setup_for_dev() - Bind a new bootdev device (deprecated)