[U-Boot] [PATCH v4 4/8] main: Use autoconf to remove #ifdefs around process_boot_delay()
Michal Simek
monstr at monstr.eu
Mon Oct 28 15:19:13 CET 2013
On 06/17/2013 04:44 PM, Simon Glass wrote:
> Use autoconf to make process_boot_delay() be compiled always, and adjust
> the caller and related functions as needed.
>
> Signed-off-by: Simon Glass <sjg at 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.
> + */
This indentation doesn't look good to me.
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131028/84c268eb/attachment.pgp>
More information about the U-Boot
mailing list