bootstd: Drop the old bootflow_scan_first()

This function is not used outside tests. Drop it and rename
bootflow_scan_dev() since it is how we start a scan now.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2023-01-17 10:48:16 -07:00
committed by Tom Rini
parent 91943ff703
commit 4b7cb058df
5 changed files with 19 additions and 45 deletions

View File

@@ -324,9 +324,9 @@ static int bootflow_check(struct bootflow_iter *iter, struct bootflow *bflow)
return 0;
}
int bootflow_scan_bootdev(struct udevice *dev, const char *label,
struct bootflow_iter *iter, int flags,
struct bootflow *bflow)
int bootflow_scan_first(struct udevice *dev, const char *label,
struct bootflow_iter *iter, int flags,
struct bootflow *bflow)
{
int ret;
@@ -371,18 +371,6 @@ int bootflow_scan_bootdev(struct udevice *dev, const char *label,
return 0;
}
int bootflow_scan_first(struct bootflow_iter *iter, int flags,
struct bootflow *bflow)
{
int ret;
ret = bootflow_scan_bootdev(NULL, NULL, iter, flags, bflow);
if (ret)
return log_msg_ret("start", ret);
return 0;
}
int bootflow_scan_next(struct bootflow_iter *iter, struct bootflow *bflow)
{
int ret;

View File

@@ -161,7 +161,7 @@ static int do_bootflow_scan(struct cmd_tbl *cmdtp, int flag, int argc,
else
bootstd_clear_glob();
for (i = 0,
ret = bootflow_scan_bootdev(dev, label, &iter, flags, &bflow);
ret = bootflow_scan_first(dev, label, &iter, flags, &bflow);
i < 1000 && ret != -ENODEV;
i++, ret = bootflow_scan_next(&iter, &bflow)) {
bflow.err = ret;

View File

@@ -249,7 +249,7 @@ int bootflow_iter_drop_bootmeth(struct bootflow_iter *iter,
const struct udevice *bmeth);
/**
* bootflow_scan_bootdev() - find the first bootflow in a bootdev
* bootflow_scan_first() - find the first bootflow for a device or label
*
* If @flags includes BOOTFLOWF_ALL then bootflows with errors are returned too
*
@@ -264,25 +264,8 @@ int bootflow_iter_drop_bootmeth(struct bootflow_iter *iter,
* Return: 0 if found, -ENODEV if no device, other -ve on other error
* (iteration can continue)
*/
int bootflow_scan_bootdev(struct udevice *dev, const char *label,
struct bootflow_iter *iter, int flags,
struct bootflow *bflow);
/**
* bootflow_scan_first() - find the first bootflow
*
* This works through the available bootdev devices until it finds one that
* can supply a bootflow. It then returns that
*
* If @flags includes BOOTFLOWF_ALL then bootflows with errors are returned too
*
* @iter: Place to store private info (inited by this call), with
* @flags: Flags for bootdev (enum bootflow_flags_t)
* @bflow: Place to put the bootflow if found
* Return: 0 if found, -ENODEV if no device, other -ve on other error (iteration
* can continue)
*/
int bootflow_scan_first(struct bootflow_iter *iter, int flags,
int bootflow_scan_first(struct udevice *dev, const char *label,
struct bootflow_iter *iter, int flags,
struct bootflow *bflow);
/**

View File

@@ -203,7 +203,7 @@ static int bootdev_test_order(struct unit_test_state *uts)
* mmc2 - nothing connected
*/
ut_assertok(env_set("boot_targets", NULL));
ut_assertok(bootflow_scan_first(&iter, 0, &bflow));
ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
ut_asserteq(2, iter.num_devs);
ut_asserteq_str("mmc2.bootdev", iter.dev_order[0]->name);
ut_asserteq_str("mmc1.bootdev", iter.dev_order[1]->name);
@@ -211,7 +211,7 @@ static int bootdev_test_order(struct unit_test_state *uts)
/* Use the environment variable to override it */
ut_assertok(env_set("boot_targets", "mmc1 mmc2"));
ut_assertok(bootflow_scan_first(&iter, 0, &bflow));
ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
ut_asserteq(2, iter.num_devs);
ut_asserteq_str("mmc1.bootdev", iter.dev_order[0]->name);
ut_asserteq_str("mmc2.bootdev", iter.dev_order[1]->name);
@@ -224,7 +224,7 @@ static int bootdev_test_order(struct unit_test_state *uts)
ut_assertok(env_set("boot_targets", NULL));
ut_assertok(bootstd_test_drop_bootdev_order(uts));
ut_assertok(bootflow_scan_first(&iter, 0, &bflow));
ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
ut_asserteq(3, iter.num_devs);
ut_asserteq_str("mmc2.bootdev", iter.dev_order[0]->name);
ut_asserteq_str("mmc1.bootdev", iter.dev_order[1]->name);
@@ -239,7 +239,7 @@ static int bootdev_test_order(struct unit_test_state *uts)
iter.dev_order[2]->seq_ = 2;
bootflow_iter_uninit(&iter);
ut_assertok(bootflow_scan_first(&iter, 0, &bflow));
ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
ut_asserteq(3, iter.num_devs);
ut_asserteq_str("mmc2.bootdev", iter.dev_order[0]->name);
ut_asserteq_str("mmc0.bootdev", iter.dev_order[1]->name);
@@ -268,7 +268,7 @@ static int bootdev_test_prio(struct unit_test_state *uts)
/* 3 MMC and 3 USB bootdevs: MMC should come before USB */
console_record_reset_enable();
ut_assertok(bootflow_scan_first(&iter, 0, &bflow));
ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
ut_asserteq(6, iter.num_devs);
ut_asserteq_str("mmc2.bootdev", iter.dev_order[0]->name);
ut_asserteq_str("usb_mass_storage.lun0.bootdev",
@@ -282,7 +282,8 @@ static int bootdev_test_prio(struct unit_test_state *uts)
ucp->prio = 1;
bootflow_iter_uninit(&iter);
ut_assertok(bootflow_scan_first(&iter, 0, &bflow));
ut_assertok(bootflow_scan_first(NULL, NULL, &iter, BOOTFLOWF_HUNT,
&bflow));
ut_asserteq(6, iter.num_devs);
ut_asserteq_str("usb_mass_storage.lun0.bootdev",
iter.dev_order[0]->name);
@@ -415,7 +416,8 @@ static int bootdev_test_hunt_scan(struct unit_test_state *uts)
ut_assertok(bootstd_get_priv(&std));
ut_assertok(bootstd_test_drop_bootdev_order(uts));
ut_assertok(bootflow_scan_first(&iter, BOOTFLOWF_SHOW | BOOTFLOWF_HUNT |
ut_assertok(bootflow_scan_first(NULL, NULL, &iter,
BOOTFLOWF_SHOW | BOOTFLOWF_HUNT |
BOOTFLOWF_SKIP_GLOBAL, &bflow));
ut_asserteq(BIT(MMC_HUNTER) | BIT(1), std->hunters_used);

View File

@@ -276,7 +276,8 @@ static int bootflow_iter(struct unit_test_state *uts)
/* The first device is mmc2.bootdev which has no media */
ut_asserteq(-EPROTONOSUPPORT,
bootflow_scan_first(&iter, BOOTFLOWF_ALL | BOOTFLOWF_SKIP_GLOBAL, &bflow));
bootflow_scan_first(NULL, NULL, &iter,
BOOTFLOWF_ALL | BOOTFLOWF_SKIP_GLOBAL, &bflow));
ut_asserteq(2, iter.num_methods);
ut_asserteq(0, iter.cur_method);
ut_asserteq(0, iter.part);
@@ -415,7 +416,7 @@ static int bootflow_iter_disable(struct unit_test_state *uts)
/* Try to boot the bootmgr flow, which will fail */
console_record_reset_enable();
ut_assertok(bootflow_scan_first(&iter, 0, &bflow));
ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
ut_asserteq(3, iter.num_methods);
ut_asserteq_str("sandbox", iter.method->name);
ut_assertok(inject_response(uts));