From 1b1d36ec58f43585081b387ee44053278e480171 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 20 Sep 2023 07:29:49 -0600 Subject: bootstd: Keep track of use of usb stop When 'usb stop' is run, doing 'bootflow scan' does not run the USB hunter again so does not see any devices. Fix this by telling bootstd about the state of USB. Signed-off-by: Simon Glass --- boot/bootdev-uclass.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'boot/bootdev-uclass.c') diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index 69506e3865f..974ddee5d2f 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -830,6 +830,33 @@ int bootdev_hunt(const char *spec, bool show) return result; } +int bootdev_unhunt(enum uclass_id id) +{ + struct bootdev_hunter *start; + int n_ent, i; + + start = ll_entry_start(struct bootdev_hunter, bootdev_hunter); + n_ent = ll_entry_count(struct bootdev_hunter, bootdev_hunter); + for (i = 0; i < n_ent; i++) { + struct bootdev_hunter *info = start + i; + + if (info->uclass == id) { + struct bootstd_priv *std; + int ret; + + ret = bootstd_get_priv(&std); + if (ret) + return log_msg_ret("std", ret); + if (!(std->hunters_used & BIT(i))) + return -EALREADY; + std->hunters_used &= ~BIT(i); + return 0; + } + } + + return -ENOENT; +} + int bootdev_hunt_prio(enum bootdev_prio_t prio, bool show) { struct bootdev_hunter *start; -- cgit v1.2.3