From patchwork Sat Oct 26 15:14:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 286284 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 512802C00AB for ; Sun, 27 Oct 2013 02:16:32 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2CD114A1D7; Sat, 26 Oct 2013 17:16:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2ZGcUlJgCxs1; Sat, 26 Oct 2013 17:16:29 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AEEF64A1F6; Sat, 26 Oct 2013 17:16:20 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 10E314A217 for ; Sat, 26 Oct 2013 17:16:18 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v3rkngNu9UOA for ; Sat, 26 Oct 2013 17:16:12 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 BL_NJABL=SKIP(-1.5) (only DNSBL check requested) Received: from mail-ie0-f201.google.com (mail-ie0-f201.google.com [209.85.223.201]) by theia.denx.de (Postfix) with ESMTPS id 31D974A1D9 for ; Sat, 26 Oct 2013 17:16:09 +0200 (CEST) Received: by mail-ie0-f201.google.com with SMTP id u16so970588iet.2 for ; Sat, 26 Oct 2013 08:16:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=J7oXwTy67+DES5UTg46OOMZ+vojvCs/ySrgVF3T77gM=; b=IGZI7OCGHvh8AVCkMF86uyWjMtQ+P1Qe37SivW52/PguldIRJ/Ibx68tOTfnBIMakP I7xr4iJRCwU74P9kmy/Nm6iLNrhFswOY3IVXSGL/kKQ5ZYxjoZ1qxJ8u0YiQR6lNp/Rk nklht/Kur1zG6esfB7qs5hIRjHpv/Q56VfTMfj0seG5Glcvw2TJTDBHMaMnDFlHvOlsi LVTUCL1xyNu990rtwaFzLIDHE3kN308nBHa5APCZ74dXqOVRwXuJyhe0rVg9B/K8s7c4 idjc0+bDGfkIPeehUBbhoSS7eCiRUb7qKBXBabKlnBHH6+CpfmQI67YWiTiApM/jLIPe vCfA== X-Gm-Message-State: ALoCoQnCUPNhVYGC5SbRAw+HyWnVfI3uvSn0bcLOObhOZjR555TKl5UWKL+YP7FtMhdI6YIpZ5FpopdlDIH83dOGOtKB5Re3K5P9jiWeCQRZnSMWtBNNVJmt32P9aEXilGe46S/ePCCtkJ20lP6pcVfyc3BDCZVitRgWGzdRqdSBgfXiOsrZ39ZINyrVX/J7qKQfc/X/8/DK X-Received: by 10.182.118.194 with SMTP id ko2mr3598539obb.32.1382800568698; Sat, 26 Oct 2013 08:16:08 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id k47si674752yha.2.2013.10.26.08.16.08 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 26 Oct 2013 08:16:08 -0700 (PDT) Received: from kaki.bld.corp.google.com (kaki.bld.corp.google.com [172.29.216.32]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 6FDE65A429B; Sat, 26 Oct 2013 08:16:08 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id B9362221040; Sat, 26 Oct 2013 09:15:23 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Sat, 26 Oct 2013 09:14:13 -0600 Message-Id: <1382800457-26608-5-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.4.1 In-Reply-To: <1382800457-26608-1-git-send-email-sjg@chromium.org> References: <1382800457-26608-1-git-send-email-sjg@chromium.org> Cc: David Hendrix , Joe Hershberger , Tom Rini , Vadim Bendebury Subject: [U-Boot] [PATCH v4 4/8] main: Use autoconf to remove #ifdefs around process_boot_delay() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Use autoconf to make process_boot_delay() be compiled always, and adjust the caller and related functions as needed. Signed-off-by: Simon Glass --- 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 5768a16..824f5f7 100644 --- a/common/main.c +++ b/common/main.c @@ -63,8 +63,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; @@ -157,8 +155,6 @@ static int abortboot_keyed(int bootdelay) return abort; } -# else /* !defined(CONFIG_AUTOBOOT_KEYED) */ - static int menukey; static int abortboot_normal(int bootdelay) @@ -212,17 +208,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: @@ -238,7 +231,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; @@ -279,22 +271,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 @@ -311,7 +302,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", @@ -341,23 +332,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 : ""); @@ -381,7 +373,6 @@ static void process_boot_delay(void) } #endif /* CONFIG_MENUKEY */ } -#endif /* CONFIG_BOOTDELAY */ void main_loop(void) { @@ -441,9 +432,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 */