From patchwork Tue Mar 20 04:59:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 147740 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 204D4B6EEF for ; Tue, 20 Mar 2012 15:59:38 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5377C28082; Tue, 20 Mar 2012 05:59:34 +0100 (CET) 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 HHNPvqV02-uL; Tue, 20 Mar 2012 05:59:33 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 91E7E28077; Tue, 20 Mar 2012 05:59:31 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A377E28077 for ; Tue, 20 Mar 2012 05:59:28 +0100 (CET) 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 iV1xP0iyizC4 for ; Tue, 20 Mar 2012 05:59:27 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-yx0-f202.google.com (mail-yx0-f202.google.com [209.85.213.202]) by theia.denx.de (Postfix) with ESMTPS id 57A7228071 for ; Tue, 20 Mar 2012 05:59:25 +0100 (CET) Received: by yenq2 with SMTP id q2so1142273yen.3 for ; Mon, 19 Mar 2012 21:59:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=kQXALQA3hW0V/VJuGMF52ktNtuzfGJaebxeoF7c+UeY=; b=iwPydHYGlic1vkkW9n1pG5TpBdcI7ezBDOOu4uqAWcBNqkEEzmkle5sRFKztTXgzEh 9vd7gmFDwxtyfqoSt21FS8Ok5ijF9Jf99DM7V4n/CedJdBmtEn0noXWqb/F7uJhpGmN5 1Tk4RcS//TTFribxTdIe4B80vGYuxKbwKOQ/vgPz3X8EDaM05dHRFQx0lnVdJaMngk/z tAFpJCoavq7OS2NE/c8PJlOjA2azSjjOoWqsqh/xq9qcbgMldaZCSSsRqtM2txp563Zh Wqpedl3ep6jLyXLuc1h/BcYmVcGz8v9OMVT2RJDqNg67UeEFB8pwmgE8VRjtWbQR5rgn nuXQ== Received: by 10.236.146.106 with SMTP id q70mr19071537yhj.0.1332219563185; Mon, 19 Mar 2012 21:59:23 -0700 (PDT) Received: by 10.236.146.106 with SMTP id q70mr19071512yhj.0.1332219563118; Mon, 19 Mar 2012 21:59:23 -0700 (PDT) Received: from wpzn3.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id a33si100395anp.2.2012.03.19.21.59.23 (version=TLSv1/SSLv3 cipher=AES128-SHA); Mon, 19 Mar 2012 21:59:23 -0700 (PDT) Received: from sglass.mtv.corp.google.com (dhcp-172-22-162-38.mtv.corp.google.com [172.22.162.38]) by wpzn3.hot.corp.google.com (Postfix) with ESMTP id E48E510004D; Mon, 19 Mar 2012 21:59:22 -0700 (PDT) Received: by sglass.mtv.corp.google.com (Postfix, from userid 121222) id 8B84F1405B1; Mon, 19 Mar 2012 21:59:22 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Mon, 19 Mar 2012 21:59:14 -0700 Message-Id: <1332219558-9143-1-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 X-Gm-Message-State: ALoCoQmb2vh/EuSdS1dyY5JIbtnZrsilIIC+fIpIQ/jCdgDXOh9ypxxIlsuGFMst4/IdHQObXL0dLlfevh9I2s2uqBwFfH3g94nbjjDh8QSyPvONTGtXjts50Klbbz3LD+v5QfYHDacO+XYUR/K/bPKVGBgw45CPRMEHSXSv67BakN8rR8sFtPU= Cc: Tom Warren Subject: [U-Boot] [PATCH v2 1/5] Revert "Add board_pre_console_putc to deal with early console output" 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 This reverts commit 295d3942b806552503243f5cfb36aec6f1b5a9bf. It turns that this really doesn't work very nicely. Instead we should have a pre-console panic function so that we know that further execution is impossible and we don't need to worry about trampling on UARTs, etc. Signed-off-by: Simon Glass Tested-by: Stephen Warren --- README | 17 ----------------- common/console.c | 10 +--------- include/common.h | 7 ------- 3 files changed, 1 insertions(+), 33 deletions(-) diff --git a/README b/README index 7adf7c7..84757a5 100644 --- a/README +++ b/README @@ -638,23 +638,6 @@ The following options need to be configured: 'Sane' compilers will generate smaller code if CONFIG_PRE_CON_BUF_SZ is a power of 2 -- Pre-console putc(): - Prior to the console being initialised, console output is - normally silently discarded. This can be annoying if a - panic() happens in this time. - - If the CONFIG_PRE_CONSOLE_PUTC option is defined, then - U-Boot will call board_pre_console_putc() for each output - character in this case, This function should try to output - the character if possible, perhaps on all available UARTs - (it will need to do this directly, since the console code - is not functional yet). Note that if the panic happens - early enough, then it is possible that board_init_f() - (or even arch_cpu_init() on ARM) has not been called yet. - You should init all clocks, GPIOs, etc. that are needed - to get the character out. Baud rates will need to default - to something sensible. - - Safe printf() functions Define CONFIG_SYS_VSNPRINTF to compile in safe versions of the printf() functions. These are defined in diff --git a/common/console.c b/common/console.c index 1d9fd7f..1177f7d 100644 --- a/common/console.c +++ b/common/console.c @@ -329,19 +329,14 @@ int tstc(void) return serial_tstc(); } -#if defined(CONFIG_PRE_CONSOLE_BUFFER) || defined(CONFIG_PRE_CONSOLE_PUTC) +#ifdef CONFIG_PRE_CONSOLE_BUFFER #define CIRC_BUF_IDX(idx) ((idx) % (unsigned long)CONFIG_PRE_CON_BUF_SZ) static void pre_console_putc(const char c) { -#ifdef CONFIG_PRE_CONSOLE_BUFFER char *buffer = (char *)CONFIG_PRE_CON_BUF_ADDR; buffer[CIRC_BUF_IDX(gd->precon_buf_idx++)] = c; -#endif -#ifdef CONFIG_PRE_CONSOLE_PUTC - board_pre_console_putc(c); -#endif } static void pre_console_puts(const char *s) @@ -352,7 +347,6 @@ static void pre_console_puts(const char *s) static void print_pre_console_buffer(void) { -#ifdef CONFIG_PRE_CONSOLE_BUFFER unsigned long i = 0; char *buffer = (char *)CONFIG_PRE_CON_BUF_ADDR; @@ -361,9 +355,7 @@ static void print_pre_console_buffer(void) while (i < gd->precon_buf_idx) putc(buffer[CIRC_BUF_IDX(i++)]); -#endif } - #else static inline void pre_console_putc(const char c) {} static inline void pre_console_puts(const char *s) {} diff --git a/include/common.h b/include/common.h index 59e0b00..b588410 100644 --- a/include/common.h +++ b/include/common.h @@ -285,13 +285,6 @@ extern ulong monitor_flash_len; int mac_read_from_eeprom(void); extern u8 _binary_dt_dtb_start[]; /* embedded device tree blob */ -/* - * Called when console output is requested before the console is available. - * The board should do its best to get the character out to the user any way - * it can. - */ -void board_pre_console_putc(int ch); - /* common/flash.c */ void flash_perror (int);