[U-Boot] [PATCH v3] Add board_pre_console_putc to deal with early console output
Simon Glass
sjg at chromium.org
Wed Oct 19 01:37:38 CEST 2011
Hi Graeme,
On Tue, Oct 18, 2011 at 4:31 PM, Graeme Russ <graeme.russ at gmail.com> wrote:
> Hi Simon,
>
> On Wed, Oct 19, 2011 at 9:57 AM, Simon Glass <sjg at chromium.org> wrote:
>> This patch adds support for console output before the console is inited.
>> The main purpose of this is to deal with a very early panic() which would
>> otherwise cause a silent hang.
>>
>> A new board_pre_console_putc() function is added to the board API. If
>> provided by the board it will be called in the event of console output
>> before the console is ready. This function should turn on all UARTs and
>> spray the character out if it possibly can.
>>
>> The feature is controlled by a new CONFIG_PRE_CONSOLE_PUTC option.
>>
>> Signed-off-by: Simon Glass <sjg at chromium.org>
>> ---
>
> [snip]
>
>> diff --git a/common/console.c b/common/console.c
>> index f17875e..d79bcf4 100644
>> --- a/common/console.c
>> +++ b/common/console.c
>> @@ -329,14 +329,30 @@ int tstc(void)
>> return serial_tstc();
>> }
>>
>> -#ifdef CONFIG_PRE_CONSOLE_BUFFER
>> +#ifdef CONFIG_PRE_CONSOLE_PUTC
>> +/* Provide a default function for when no console is available */
>> +static void __board_pre_console_putc(int ch)
>> +{
>> + /* Just return since we can't access the console */
>> +}
>> +
>> +void board_pre_console_putc(const char *msg) __attribute__((weak,
>> + alias("__board_pre_console_putc")));
>> +#endif
>> +
>> +#if defined(CONFIG_PRE_CONSOLE_BUFFER) || defined(CONFIG_PRE_CONSOLE_PUTC)
>
> I don't think we need this - If CONFIG_PRE_CONSOLE_PUTC then
> board_pre_console_putc() must also be defined - I would prefer a
> compilation due to undefined function that head-scratching as to why th
> output I expected did not occur
Yes definitely, will adjust.
Regards,
Simon
>
> [snip]
>
> Regards,
>
> Graeme
>
More information about the U-Boot
mailing list