Raul Rangel has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/58981 )
Change subject: console/printk: Add console_mutex ......................................................................
console/printk: Add console_mutex
Cooperative multitasking has only been used in ramstage. ramstage has spin locks enabled, while romstage and earlier don't. This means we can't rely on the console spin lock. This change adds a console mutex so printing can work correctly between threads in romstage.
BUG=b:179699789 TEST=Start a thread in romstage and verify console output is not garbled
Signed-off-by: Raul E Rangel rrangel@chromium.org Change-Id: I5858bb18723f32f6b1e6ef0ed31906d7c79d3fec --- M src/console/printk.c 1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/58981/1
diff --git a/src/console/printk.c b/src/console/printk.c index 1ed39cb..4e630ea 100644 --- a/src/console/printk.c +++ b/src/console/printk.c @@ -13,6 +13,7 @@ #include <timer.h>
DECLARE_SPIN_LOCK(console_lock) +struct thread_mutex console_mutex;
#define TRACK_CONSOLE_TIME (!ENV_SMM && CONFIG(HAVE_MONOTONIC_TIMER))
@@ -81,6 +82,7 @@ return 0;
spin_lock(&console_lock); + thread_mutex_lock(&console_mutex);
console_time_run();
@@ -93,6 +95,7 @@
console_time_stop();
+ thread_mutex_unlock(&console_mutex); spin_unlock(&console_lock);
return i;