[U-Boot] [PATCH V4] console: Implement pre-console buffer

Simon Glass sjg at chromium.org
Wed Aug 31 18:58:38 CEST 2011


Hi Graeme,

On Wed, Aug 31, 2011 at 5:58 AM, Graeme Russ <graeme.russ at gmail.com> wrote:
> Allow redirection of console output prior to console initialisation to a
> temporary buffer.
>
> To enable this functionality, the board configuration file must define:
>  - CONFIG_PRE_CONSOLE_BUFFER - Enable pre-console buffer
>  - CONFIG_PRE_CON_BUF_ADDR - Base address of pre-console buffer
>  - CONFIG_PRE_CON_BUF_SZ - Size of pre-console buffer (in bytes)
>
> The pre-console buffer will buffer the last CONFIG_PRE_CON_BUF_SZ bytes
> Any earlier characters are silently dropped.
>
> Signed-off-by: Graeme Russ <graeme.russ at gmail.com>
> ---
> Changes since V3
>  - Fixed  blank subject caused by gap between the Cc: list and Date:
>
> Changes since V2
>  - Cast buffer size to unsigned long to help compilers produce tighter
>   code
>  - Use inline stub functions to reduce #ifdef clutter
>  - Add documentation to README
>
> Changes Since V1
>  - Implemented circular buffer
>  - Trivial code styl corrections
>
>  README                                    |   14 +++++++++
>  arch/arm/include/asm/global_data.h        |    3 ++
>  arch/avr32/include/asm/global_data.h      |    3 ++
>  arch/blackfin/include/asm/global_data.h   |    3 ++
>  arch/m68k/include/asm/global_data.h       |    3 ++
>  arch/microblaze/include/asm/global_data.h |    3 ++
>  arch/mips/include/asm/global_data.h       |    3 ++
>  arch/nios2/include/asm/global_data.h      |    3 ++
>  arch/powerpc/include/asm/global_data.h    |    3 ++
>  arch/sh/include/asm/global_data.h         |    3 ++
>  arch/sparc/include/asm/global_data.h      |    3 ++
>  arch/x86/include/asm/global_data.h        |    3 ++
>  common/console.c                          |   43 +++++++++++++++++++++++++++-
>  13 files changed, 88 insertions(+), 2 deletions(-)
>
> diff --git a/README b/README
> index 0886987..170e67b 100644
> --- a/README
> +++ b/README
> @@ -619,6 +619,20 @@ The following options need to be configured:
>                must be defined, to setup the maximum idle timeout for
>                the SMC.
>
> +- Pre-Console Buffer:
> +                Prior to the console being initialised (i.e. serial UART
> +                initialised etc) all console output is silently discarded.
> +                Defining CONFIG_PRE_CONSOLE_BUFFER will cause U-Boot to
> +                buffer any console messages prior to the console being
> +                initialised to a buffer of size CONFIG_PRE_CON_BUF_SZ
> +                bytes located at CONFIG_PRE_CON_BUF_ADDR. The buffer is
> +                a cicular buffer, so if more than CONFIG_PRE_CON_BUF_SZ

nit: circular. Just a suggestion if you like: you could also offer
guidance for the location of the buffer, something like:

You can place the buffer at the top of memory by adding something like
this in your board config file:

#define CONFIG_PRE_CON_BUF_ADDR		(CONFIG_SYS_INIT_RAM_ADDR + \
					CONFIG_SYS_INIT_RAM_SIZE - \
					CONFIG_PRE_CON_BUF_SZ)
#define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_PRE_CON_BUF_ADDR - \
						GENERATED_GBL_DATA_SIZE)

> +                bytes are output before the console is  initialised, the
> +                earlier bytes are discarded.
> +

Anyway:

Acked-by: Simon Glass <sjg at chromium.org>

Regards,
Simon


More information about the U-Boot mailing list