Use autoconf to make process_boot_delay() be compiled always, and adjust the caller and related functions as needed.
Signed-off-by: Simon Glass <s...@chromium.org> --- Changes in v4: - Split out new patch to remove #ifdefs around process_boot_delay() Changes in v3: None Changes in v2: None common/main.c | 71 ++++++++++++++++++++++++++--------------------------------- 1 file changed, 31 insertions(+), 40 deletions(-) diff --git a/common/main.c b/common/main.c index 3a4754d..dba6cee 100644 --- a/common/main.c +++ b/common/main.c @@ -79,8 +79,6 @@ extern void mdm_init(void); /* defined in board.c */ * Watch for 'delay' seconds for autoboot stop or autoboot delay string. * returns: 0 - no key string, allow autoboot 1 - got key string, abort */ -#if defined(CONFIG_BOOTDELAY) -# if defined(CONFIG_AUTOBOOT_KEYED) static int abortboot_keyed(int bootdelay) { int abort = 0; @@ -173,8 +171,6 @@ static int abortboot_keyed(int bootdelay) return abort; } -# else /* !defined(CONFIG_AUTOBOOT_KEYED) */ - static int menukey; static int abortboot_normal(int bootdelay) @@ -228,17 +224,14 @@ static int abortboot_normal(int bootdelay) return abort; } -# endif /* CONFIG_AUTOBOOT_KEYED */ static int abortboot(int bootdelay) { -#ifdef CONFIG_AUTOBOOT_KEYED - return abortboot_keyed(bootdelay); -#else - return abortboot_normal(bootdelay); -#endif + if (autoconf_autoboot_keyed()) + return abortboot_keyed(bootdelay); + else + return abortboot_normal(bootdelay); } -#endif /* CONFIG_BOOTDELAY */ /* * Runs the given boot command securely. Specifically: @@ -254,7 +247,6 @@ static int abortboot(int bootdelay) * printing the error message to console. */ -#if defined(CONFIG_BOOTDELAY) && defined(CONFIG_OF_CONTROL) static void secure_boot_cmd(char *cmd) { cmd_tbl_t *cmdtp; @@ -295,22 +287,21 @@ static void process_fdt_options(const void *blob) /* Add an env variable to point to a kernel payload, if available */ addr = fdtdec_get_config_int(gd->fdt_blob, "kernel-offset", 0); - if (addr) - setenv_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr)); + if (addr) { + setenv_addr("kernaddr", + (void *)(autoconf_sys_text_base() + addr)); + } /* Add an env variable to point to a root disk, if available */ addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0); - if (addr) - setenv_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr)); + if (addr) { + setenv_addr("rootaddr", + (void *)(autoconf_sys_text_base() + addr)); + } } -#endif /* CONFIG_OF_CONTROL */ -#ifdef CONFIG_BOOTDELAY static void process_boot_delay(void) { -#ifdef CONFIG_OF_CONTROL - char *env; -#endif char *s; int bootdelay; #ifdef CONFIG_BOOTCOUNT_LIMIT @@ -327,7 +318,7 @@ static void process_boot_delay(void) #endif /* CONFIG_BOOTCOUNT_LIMIT */ s = getenv ("bootdelay"); - bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY; + bootdelay = s ? (int)simple_strtol(s, NULL, 10) : autoconf_bootdelay(); #ifdef CONFIG_OF_CONTROL bootdelay = fdtdec_get_config_int(gd->fdt_blob, "bootdelay", @@ -357,23 +348,24 @@ static void process_boot_delay(void) else #endif /* CONFIG_BOOTCOUNT_LIMIT */ s = getenv ("bootcmd"); -#ifdef CONFIG_OF_CONTROL - /* Allow the fdt to override the boot command */ - env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd"); - if (env) - s = env; + if (autoconf_of_control()) { + char *env; - process_fdt_options(gd->fdt_blob); + /* Allow the fdt to override the boot command */ + env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd"); + if (env) + s = env; - /* - * If the bootsecure option was chosen, use secure_boot_cmd(). - * Always use 'env' in this case, since bootsecure requres that the - * bootcmd was specified in the FDT too. - */ - if (fdtdec_get_config_int(gd->fdt_blob, "bootsecure", 0)) - secure_boot_cmd(env); + process_fdt_options(gd->fdt_blob); -#endif /* CONFIG_OF_CONTROL */ + /* + * If the bootsecure option was chosen, use secure_boot_cmd(). + * Always use 'env' in this case, since bootsecure requres that + * the bootcmd was specified in the FDT too. + */ + if (fdtdec_get_config_int(gd->fdt_blob, "bootsecure", 0)) + secure_boot_cmd(env); + } debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>"); @@ -397,7 +389,6 @@ static void process_boot_delay(void) } #endif /* CONFIG_MENUKEY */ } -#endif /* CONFIG_BOOTDELAY */ void main_loop(void) { @@ -457,9 +448,9 @@ void main_loop(void) update_tftp(0UL); #endif /* CONFIG_UPDATE_TFTP */ -#ifdef CONFIG_BOOTDELAY - process_boot_delay(); -#endif + if (autoconf_has_bootdelay() && autoconf_bootdelay() >= 0) + process_boot_delay(); + /* * Main Loop for Monitor Command Processing */ -- 1.8.3 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot