summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2015-06-04 08:42:48 -0700
committerPatrick Georgi <pgeorgi@google.com>2015-06-30 08:11:16 +0200
commita51815119f7fe282a84a4e4db941019ca5dd918e (patch)
tree704c5a8d2e25076f6408ef72b5d69598001ff80b /src
parentfbc45a60eb66aaee54f7496336d090c4497eb8cc (diff)
hardwaremain: Move init_timer() call to before console init
The 8250 MMIO uart driver calls udelay, and if that is the first call then it will also call printk in init_timer() which can result in a deadlock trying to acquire the console lock. There are a few options to prevent this: 1) remove the printk in init_timer which removes a useful debug message 2) change the udelay() to cpu_relax() in uart8250mem.c 3- move the init_timer() call in ramstage main() to be called earlier Since hardwaremain.c:main() already has an explicit call to init_timer() on x86 it is an easy change to move this to happen before the console is initialized. BUG=chrome-os-partner:40857 BRANCH=none TEST=boot on glados with serial output through ramstage Change-Id: I8a8d8cccdd0b53de9de44600076bfad75e4f5514 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 744610f72628a944582925933b286f65bde630d9 Original-Change-Id: Ic1fdafaea5541c6d7b1bb6f15399c759f484aa74 Original-Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/275157 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/10698 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src')
-rw-r--r--src/lib/hardwaremain.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c
index 56f3f29f97..b3c0c351af 100644
--- a/src/lib/hardwaremain.c
+++ b/src/lib/hardwaremain.c
@@ -432,6 +432,11 @@ static void boot_state_schedule_static_entries(void)
void main(void)
{
+ /* TODO: Understand why this is here and move to arch/platform code. */
+ /* For MMIO UART this needs to be called before any other printk. */
+ if (IS_ENABLED(CONFIG_ARCH_X86))
+ init_timer();
+
/* console_init() MUST PRECEDE ALL printk()! Additionally, ensure
* it is the very first thing done in ramstage.*/
console_init();
@@ -463,10 +468,6 @@ void main(void)
/* Schedule the static boot state entries. */
boot_state_schedule_static_entries();
- /* TODO: Understand why this is here and move to arch/platform code. */
- if (IS_ENABLED(CONFIG_ARCH_X86))
- init_timer();
-
bs_walk_state_machine();
die("Boot state machine failure.\n");