From 18552d2a7288afd6f125b4ac99e5c27690c129b4 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 17 Jan 2023 10:48:13 -0700 Subject: bootstd: Add a hunter for the extension feature This needs to run before any bootdev is used, so add a hunter for it. Signed-off-by: Simon Glass --- cmd/extension_board.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'cmd/extension_board.c') diff --git a/cmd/extension_board.c b/cmd/extension_board.c index f7685d47b8b7..2b672d888c68 100644 --- a/cmd/extension_board.c +++ b/cmd/extension_board.c @@ -5,7 +5,9 @@ */ #include +#include #include +#include #include #include #include @@ -176,3 +178,26 @@ U_BOOT_CMD(extension, 3, 1, do_extensionops, "extension list - lists available extension(s) board(s)\n" "extension apply - applies DT overlays corresponding to extension boards\n" ); + +static int extension_bootdev_hunt(struct bootdev_hunter *info, bool show) +{ + int ret; + + ret = env_set_hex("extension_overlay_addr", + env_get_hex("fdtoverlay_addr_r", 0)); + if (ret) + return log_msg_ret("env", ret); + + ret = extension_scan(show); + if (ret < 0) + return log_msg_ret("ext", ret); + + return 0; +} + +/* extensions should have a uclass - for now we use UCLASS_SIMPLE_BUS uclass */ +BOOTDEV_HUNTER(extension_bootdev_hunter) = { + .prio = BOOTDEVP_1_PRE_SCAN, + .uclass = UCLASS_SIMPLE_BUS, + .hunt = extension_bootdev_hunt, +}; -- cgit v1.2.3