Revert "Add board_pre_console_putc to deal with early console output"
This reverts commit 295d3942b8
.
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 <sjg@chromium.org>
Signed-off-by: Wolfgang Denk <wd@denx.de>
This commit is contained in:
parent
9692fd0f70
commit
3fa4977a9e
17
README
17
README
|
@ -644,23 +644,6 @@ The following options need to be configured:
|
||||||
'Sane' compilers will generate smaller code if
|
'Sane' compilers will generate smaller code if
|
||||||
CONFIG_PRE_CON_BUF_SZ is a power of 2
|
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
|
- Safe printf() functions
|
||||||
Define CONFIG_SYS_VSNPRINTF to compile in safe versions of
|
Define CONFIG_SYS_VSNPRINTF to compile in safe versions of
|
||||||
the printf() functions. These are defined in
|
the printf() functions. These are defined in
|
||||||
|
|
|
@ -329,19 +329,14 @@ int tstc(void)
|
||||||
return serial_tstc();
|
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)
|
#define CIRC_BUF_IDX(idx) ((idx) % (unsigned long)CONFIG_PRE_CON_BUF_SZ)
|
||||||
|
|
||||||
static void pre_console_putc(const char c)
|
static void pre_console_putc(const char c)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_PRE_CONSOLE_BUFFER
|
|
||||||
char *buffer = (char *)CONFIG_PRE_CON_BUF_ADDR;
|
char *buffer = (char *)CONFIG_PRE_CON_BUF_ADDR;
|
||||||
|
|
||||||
buffer[CIRC_BUF_IDX(gd->precon_buf_idx++)] = c;
|
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)
|
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)
|
static void print_pre_console_buffer(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_PRE_CONSOLE_BUFFER
|
|
||||||
unsigned long i = 0;
|
unsigned long i = 0;
|
||||||
char *buffer = (char *)CONFIG_PRE_CON_BUF_ADDR;
|
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)
|
while (i < gd->precon_buf_idx)
|
||||||
putc(buffer[CIRC_BUF_IDX(i++)]);
|
putc(buffer[CIRC_BUF_IDX(i++)]);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static inline void pre_console_putc(const char c) {}
|
static inline void pre_console_putc(const char c) {}
|
||||||
static inline void pre_console_puts(const char *s) {}
|
static inline void pre_console_puts(const char *s) {}
|
||||||
|
|
|
@ -291,13 +291,6 @@ int mac_read_from_eeprom(void);
|
||||||
extern u8 _binary_dt_dtb_start[]; /* embedded device tree blob */
|
extern u8 _binary_dt_dtb_start[]; /* embedded device tree blob */
|
||||||
int set_cpu_clk_info(void);
|
int set_cpu_clk_info(void);
|
||||||
|
|
||||||
/*
|
|
||||||
* 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 */
|
/* common/flash.c */
|
||||||
void flash_perror (int);
|
void flash_perror (int);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue