aboutsummaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-04-24 13:49:47 +1200
committerTom Rini <trini@konsulko.com>2023-04-26 08:43:04 -0400
commit1736b4af0e8a30aa3e9d0720c07dfb70fb16dceb (patch)
tree0db21dfe1280e1247cd6578d7e71ca7ecd5247f3 /boot
parentd80bb4f958b01b6e1a3e904fe8e5e40584113938 (diff)
downloadu-boot-1736b4af0e8a30aa3e9d0720c07dfb70fb16dceb.zip
u-boot-1736b4af0e8a30aa3e9d0720c07dfb70fb16dceb.tar.gz
u-boot-1736b4af0e8a30aa3e9d0720c07dfb70fb16dceb.tar.bz2
bootstd: Report missing labels only when asked
Use the -l flag to indicate whether to report missing uclasses. Also try to be more helpful when no devices are found. For example, when we see something 'scsi0' requested and nothing was found, this indicates that there are no SCSI devices, so show a suitable message. Move messages out of the low-level functions so that silent operation is possible. This means they are never reported unless BOOTSTD_FULL is enabled, since the -l flag cannot otherwise be set. Suggested-by: Tom Rini <trini@konsulko.com> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot')
-rw-r--r--boot/bootdev-uclass.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c
index d34b7e3..9108798 100644
--- a/boot/bootdev-uclass.c
+++ b/boot/bootdev-uclass.c
@@ -364,7 +364,8 @@ int bootdev_unbind_dev(struct udevice *parent)
* @seqp: Returns the sequence number, or -1 if none
* @method_flagsp: If non-NULL, returns any flags implied by the label
* (enum bootflow_meth_flags_t), 0 if none
- * Returns: sequence number on success, else -ve error code
+ * Returns: sequence number on success, -EPFNOSUPPORT is the uclass is not
+ * known, other -ve error code on other error
*/
static int label_to_uclass(const char *label, int *seqp, int *method_flagsp)
{
@@ -394,8 +395,7 @@ static int label_to_uclass(const char *label, int *seqp, int *method_flagsp)
id = UCLASS_ETH;
method_flags |= BOOTFLOW_METHF_DHCP_ONLY;
} else {
- log_warning("Unknown uclass '%s' in label\n", label);
- return -EINVAL;
+ return -EPFNOSUPPORT;
}
}
if (id == UCLASS_USB)
@@ -458,7 +458,6 @@ int bootdev_find_by_label(const char *label, struct udevice **devp,
}
log_debug("- no device in %s\n", media->name);
}
- log_warning("Unknown seq %d for label '%s'\n", seq, label);
return -ENOENT;
}
@@ -577,9 +576,28 @@ int bootdev_next_label(struct bootflow_iter *iter, struct udevice **devp,
log_debug("next\n");
for (dev = NULL; !dev && iter->labels[++iter->cur_label];) {
- log_debug("Scanning: %s\n", iter->labels[iter->cur_label]);
- bootdev_hunt_and_find_by_label(iter->labels[iter->cur_label],
- &dev, method_flagsp);
+ const char *label = iter->labels[iter->cur_label];
+ int ret;
+
+ log_debug("Scanning: %s\n", label);
+ ret = bootdev_hunt_and_find_by_label(label, &dev,
+ method_flagsp);
+ if (iter->flags & BOOTFLOWIF_SHOW) {
+ if (ret == -EPFNOSUPPORT) {
+ log_warning("Unknown uclass '%s' in label\n",
+ label);
+ } else if (ret == -ENOENT) {
+ /*
+ * looking for, e.g. 'scsi0' should find
+ * something if SCSI is present
+ */
+ if (!trailing_strtol(label)) {
+ log_warning("No bootdevs for '%s'\n",
+ label);
+ }
+ }
+ }
+
}
if (!dev)