x86: Allow use of serial soon after relocation
At present on x86 machines with use cache-as-RAM, the memory goes away just before board_init_r() is called. This means that serial drivers are no-longer unavailable, until initr_dm() it called, etc. Any attempt to use printf() within this period will cause a hang. To fix this, mark the serial devices as 'unavailable' when it is no-longer available. Bring it back when serial_initialize() is called. This means that the debug UART will be used instead for this period. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>utp
parent
8226a3e99f
commit
e4d6ab0c2c
|
@ -1095,6 +1095,13 @@ void board_init_f_r(void)
|
||||||
if (initcall_run_list(init_sequence_f_r))
|
if (initcall_run_list(init_sequence_f_r))
|
||||||
hang();
|
hang();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The pre-relocation drivers may be using memory that has now gone
|
||||||
|
* away. Mark serial as unavailable - this will fall back to the debug
|
||||||
|
* UART if available.
|
||||||
|
*/
|
||||||
|
gd->flags &= ~GD_FLG_SERIAL_READY;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* U-Boot has been copied into SDRAM, the BSS has been cleared etc.
|
* U-Boot has been copied into SDRAM, the BSS has been cleared etc.
|
||||||
* Transfer execution from Flash to RAM by calculating the address
|
* Transfer execution from Flash to RAM by calculating the address
|
||||||
|
|
|
@ -115,7 +115,7 @@ int serial_init(void)
|
||||||
/* Called after relocation */
|
/* Called after relocation */
|
||||||
void serial_initialize(void)
|
void serial_initialize(void)
|
||||||
{
|
{
|
||||||
serial_find_console_or_panic();
|
serial_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _serial_putc(struct udevice *dev, char ch)
|
static void _serial_putc(struct udevice *dev, char ch)
|
||||||
|
|
Loading…
Reference in New Issue