1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-30 15:01:27 +02:00

bootstd: Add a SPI flash bootdev

Add a bootdev for SPI flash so that these devices can be used with
standard boot. It only supports loading a script.

Add a special case for the label, since we want to use "spi", not
"spi_flash".

Enable the new bootdev on sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2023-01-17 10:48:03 -07:00
committed by Tom Rini
parent 081bdc52c1
commit 0c1f4a9fb1
10 changed files with 144 additions and 10 deletions

View File

@@ -243,9 +243,10 @@ static int bootdev_test_hunter(struct unit_test_state *uts)
ut_assert_nextline(" 10 mmc mmc_bootdev");
ut_assert_nextline(" 30 nvme nvme_bootdev");
ut_assert_nextline(" 30 scsi scsi_bootdev");
ut_assert_nextline(" 30 spi_flash sf_bootdev");
ut_assert_nextline(" 40 usb usb_bootdev");
ut_assert_nextline(" 30 virtio virtio_bootdev");
ut_assert_nextline("(total hunters: 7)");
ut_assert_nextline("(total hunters: 8)");
ut_assert_console_end();
ut_assertok(bootdev_hunt("usb1", false));
@@ -253,8 +254,8 @@ static int bootdev_test_hunter(struct unit_test_state *uts)
"Bus usb@1: scanning bus usb@1 for devices... 5 USB Device(s) found");
ut_assert_console_end();
/* USB is fifth in the list, so bit 5 */
ut_asserteq(BIT(5), std->hunters_used);
/* USB is fifth in the list, so bit 6 */
ut_asserteq(BIT(6), std->hunters_used);
return 0;
}
@@ -274,7 +275,7 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts)
ut_assertok(run_command("bootdev hunt -l", 0));
ut_assert_nextline("Prio Used Uclass Hunter");
ut_assert_nextlinen("----");
ut_assert_skip_to_line("(total hunters: 7)");
ut_assert_skip_to_line("(total hunters: 8)");
ut_assert_console_end();
/* Scan all hunters */
@@ -288,10 +289,11 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts)
ut_assert_nextline("Hunting with: nvme");
ut_assert_nextline("Hunting with: scsi");
ut_assert_nextline("scanning bus for devices...");
ut_assert_skip_to_line("Hunting with: usb");
ut_assert_skip_to_line("Hunting with: spi_flash");
ut_assert_nextline("Hunting with: usb");
ut_assert_nextline(
"Bus usb@1: scanning bus usb@1 for devices... 5 USB Device(s) found");
ut_assert_skip_to_line("Hunting with: virtio");
ut_assert_nextline("Hunting with: virtio");
ut_assert_console_end();
/* List available hunters */
@@ -303,12 +305,13 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts)
ut_assert_nextline(" 10 * mmc mmc_bootdev");
ut_assert_nextline(" 30 * nvme nvme_bootdev");
ut_assert_nextline(" 30 * scsi scsi_bootdev");
ut_assert_nextline(" 30 * spi_flash sf_bootdev");
ut_assert_nextline(" 40 * usb usb_bootdev");
ut_assert_nextline(" 30 * virtio virtio_bootdev");
ut_assert_nextline("(total hunters: 7)");
ut_assert_nextline("(total hunters: 8)");
ut_assert_console_end();
ut_asserteq(GENMASK(6, 0), std->hunters_used);
ut_asserteq(GENMASK(7, 0), std->hunters_used);
return 0;
}