#define LOG_CATEGORY UCLASS_BOOTSTD
-#include <common.h>
#include <bootdev.h>
#include <bootflow.h>
#include <bootmeth.h>
}
}
+ if (iter->flags & BOOTFLOWIF_SINGLE_PARTITION)
+ return BF_NO_MORE_DEVICES;
+
/* No more bootmeths; start at the first one, and... */
iter->cur_method = 0;
iter->method = iter->method_order[iter->cur_method];
} else {
log_debug("labels %p\n", iter->labels);
if (iter->labels) {
- ret = bootdev_next_label(iter, &dev,
- &method_flags);
+ /*
+ * when the label is "mmc" we want to scan all
+ * mmc bootdevs, not just the first. See
+ * bootdev_find_by_label() where this flag is
+ * set up
+ */
+ if (iter->method_flags &
+ BOOTFLOW_METHF_SINGLE_UCLASS) {
+ scan_next_in_uclass(&dev);
+ log_debug("looking for next device %s: %s\n",
+ iter->dev->name,
+ dev ? dev->name : "<none>");
+ } else {
+ dev = NULL;
+ }
+ if (!dev) {
+ log_debug("looking at next label\n");
+ ret = bootdev_next_label(iter, &dev,
+ &method_flags);
+ }
} else {
ret = bootdev_next_prio(iter, &dev);
method_flags = 0;
}
/* Unless there is nothing more to try, move to the next device */
- else if (ret != BF_NO_MORE_PARTS && ret != -ENOSYS) {
+ if (ret != BF_NO_MORE_PARTS && ret != -ENOSYS) {
log_debug("Bootdev '%s' part %d method '%s': Error %d\n",
dev->name, iter->part, iter->method->name, ret);
/*
if (iter->flags & BOOTFLOWIF_ALL)
return log_msg_ret("all", ret);
}
- if (ret)
- return log_msg_ret("check", ret);
- return 0;
+ return log_msg_ret("check", ret);
}
int bootflow_scan_first(struct udevice *dev, const char *label,
free(bflow->name);
free(bflow->subdir);
free(bflow->fname);
- free(bflow->buf);
+ if (!(bflow->flags & BOOTFLOWF_STATIC_BUF))
+ free(bflow->buf);
free(bflow->os_name);
free(bflow->fdt_fname);
free(bflow->bootmeth_priv);
return -ENOTSUPP;
}
+int bootflow_iter_check_mmc(const struct bootflow_iter *iter)
+{
+ const struct udevice *media = dev_get_parent(iter->dev);
+ enum uclass_id id = device_get_uclass_id(media);
+
+ log_debug("uclass %d: %s\n", id, uclass_get_name(id));
+ if (id == UCLASS_MMC)
+ return 0;
+
+ return -ENOTSUPP;
+}
+
int bootflow_iter_check_sf(const struct bootflow_iter *iter)
{
const struct udevice *media = dev_get_parent(iter->dev);
in_quote = false;
continue;
}
- if (*p == '=') {
+ if (*p == '=' && !arg_end) {
arg_end = p;
val = p + 1;
} else if (*p == '"') {
}
/* if this is the target arg, update it */
- if (!strncmp(from, set_arg, arg_end - from)) {
+ if (arg_end - from == set_arg_len &&
+ !strncmp(from, set_arg, set_arg_len)) {
if (!buf) {
bool has_quote = val_end[-1] == '"';