diff options
| author | Kory Maincent (TI.com) <[email protected]> | 2025-10-30 17:45:00 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-11-03 10:02:39 -0600 |
| commit | b7edeac950dae10759527a1ed0d1c306710ec9de (patch) | |
| tree | c20b8e538a35e294d7411361f41b2a32bb321ea3 /cmd | |
| parent | 79cd6e78ff6387685e0ccb5f7382d808478155dc (diff) | |
boot: Move extension board support from cmd/ to boot/
Relocate extension board support from cmd/ to boot/ directory in
preparation for converting the extension framework to use UCLASS.
Also improve code style by applying reverse xmas tree ordering.
Signed-off-by: Kory Maincent (TI.com) <[email protected]>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/Kconfig | 3 | ||||
| -rw-r--r-- | cmd/extension_board.c | 99 |
2 files changed, 3 insertions, 99 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig index 29de857ba7c..986eeeba807 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -545,9 +545,6 @@ config CMD_FDT help Do FDT related setup before booting into the Operating System. -config SUPPORT_EXTENSION_SCAN - bool - config CMD_EXTENSION bool "Extension board management command" select CMD_FDT diff --git a/cmd/extension_board.c b/cmd/extension_board.c index 317b260bf36..129f3db9e4c 100644 --- a/cmd/extension_board.c +++ b/cmd/extension_board.c @@ -4,68 +4,15 @@ * Köry Maincent, Bootlin, <[email protected]> */ -#include <bootdev.h> +#include <exports.h> #include <command.h> -#include <dm.h> -#include <env.h> -#include <malloc.h> #include <extension_board.h> -#include <mapmem.h> -#include <linux/libfdt.h> -#include <fdt_support.h> - -static LIST_HEAD(extension_list); - -static int extension_apply(struct extension *extension) -{ - char *overlay_cmd; - ulong extrasize, overlay_addr; - struct fdt_header *blob; - - if (!working_fdt) { - printf("No FDT memory address configured. Please configure\n" - "the FDT address via \"fdt addr <address>\" command.\n"); - return CMD_RET_FAILURE; - } - - overlay_cmd = env_get("extension_overlay_cmd"); - if (!overlay_cmd) { - printf("Environment extension_overlay_cmd is missing\n"); - return CMD_RET_FAILURE; - } - - overlay_addr = env_get_hex("extension_overlay_addr", 0); - if (!overlay_addr) { - printf("Environment extension_overlay_addr is missing\n"); - return CMD_RET_FAILURE; - } - - env_set("extension_overlay_name", extension->overlay); - if (run_command(overlay_cmd, 0) != 0) - return CMD_RET_FAILURE; - - extrasize = env_get_hex("filesize", 0); - if (!extrasize) - return CMD_RET_FAILURE; - - fdt_shrink_to_minimum(working_fdt, extrasize); - - blob = map_sysmem(overlay_addr, 0); - if (!fdt_valid(&blob)) - return CMD_RET_FAILURE; - - /* apply method prints messages on error */ - if (fdt_overlay_apply_verbose(working_fdt, blob)) - return CMD_RET_FAILURE; - - return CMD_RET_SUCCESS; -} static int do_extension_list(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - int i = 0; struct extension *extension; + int i = 0; if (list_empty(&extension_list)) { printf("No extension registered - Please run \"extension scan\"\n"); @@ -82,23 +29,6 @@ static int do_extension_list(struct cmd_tbl *cmdtp, int flag, return CMD_RET_SUCCESS; } -static int extension_scan(bool show) -{ - struct extension *extension, *next; - int extension_num; - - list_for_each_entry_safe(extension, next, &extension_list, list) { - list_del(&extension->list); - free(extension); - } - extension_num = extension_board_scan(&extension_list); - if (show && extension_num >= 0) - printf("Found %d extension board(s).\n", extension_num); - - /* either the number of extensions, or -ve for error */ - return extension_num; -} - static int do_extension_scan(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -115,8 +45,8 @@ static int do_extension_apply(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct extension *extension = NULL; - struct list_head *entry; int i = 0, extension_id, ret; + struct list_head *entry; if (argc < 2) return CMD_RET_USAGE; @@ -177,26 +107,3 @@ U_BOOT_CMD(extension, 3, 1, do_extensionops, "extension list - lists available extension(s) board(s)\n" "extension apply <extension number|all> - 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, -}; |
