aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass2016-03-11 22:06:51 -0700
committerBin Meng2016-03-17 10:27:24 +0800
commite4d6ab0c2cb8456f80d0ee4e123a34029d5a5c41 (patch)
tree5be75f2ce6cb4cf73183817fe8b301032c8f775d
parent8226a3e99f1c1e7ded648721d1e16118453761e5 (diff)
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>
-rw-r--r--common/board_f.c7
-rw-r--r--drivers/serial/serial-uclass.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/common/board_f.c b/common/board_f.c
index 622093a3915..109025a68d6 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -1096,6 +1096,13 @@ void board_init_f_r(void)
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.
* Transfer execution from Flash to RAM by calculating the address
* of the in-RAM copy of board_init_r() and calling it
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index f154eb156ca..0ce5c44f331 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -115,7 +115,7 @@ int serial_init(void)
/* Called after relocation */
void serial_initialize(void)
{
- serial_find_console_or_panic();
+ serial_init();
}
static void _serial_putc(struct udevice *dev, char ch)