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>
* @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)
{
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)
}
log_debug("- no device in %s\n", media->name);
}
- log_warning("Unknown seq %d for label '%s'\n", seq, label);
return -ENOENT;
}
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)
* @devp: returns the device found, on success
* @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,
+ * Return: 0 if OK, -EPFNOSUPPORT if the uclass is not supported by this board,
* -ENOENT if there is no device with that number
*/
int bootdev_find_by_any(const char *name, struct udevice **devp,
mflags);
/* Check invalid uclass */
- ut_asserteq(-EINVAL, bootdev_find_by_label("fred0", &dev, &mflags));
+ ut_asserteq(-EPFNOSUPPORT,
+ bootdev_find_by_label("fred0", &dev, &mflags));
/* Check unknown sequence number */
ut_asserteq(-ENOENT, bootdev_find_by_label("mmc6", &dev, &mflags));
/* Check invalid uclass */
mflags = 123;
- ut_asserteq(-EINVAL, bootdev_find_by_any("fred0", &dev, &mflags));
- ut_assert_nextline("Unknown uclass 'fred0' in label");
- ut_assert_nextline("Cannot find bootdev 'fred0' (err=-22)");
+ ut_asserteq(-EPFNOSUPPORT, bootdev_find_by_any("fred0", &dev, &mflags));
+ ut_assert_nextline("Cannot find bootdev 'fred0' (err=-96)");
ut_asserteq(123, mflags);
ut_assert_console_end();
old = (void *)&mflags; /* arbitrary pointer to check against dev */
dev = old;
mflags = 123;
- ut_asserteq(-EINVAL,
+ ut_asserteq(-EPFNOSUPPORT,
bootdev_hunt_and_find_by_label("fred", &dev, &mflags));
- ut_assert_nextline("Unknown uclass 'fred' in label");
ut_asserteq_ptr(old, dev);
ut_asserteq(123, mflags);
ut_assert_console_end();
bootdev_hunt_and_find_by_label("mmc4", &dev, &mflags));
ut_asserteq_ptr(old, dev);
ut_asserteq(123, mflags);
- ut_assert_nextline("Unknown seq 4 for label 'mmc4'");
ut_assert_console_end();
ut_assertok(bootstd_test_check_mmc_hunter(uts));