From 7784fba59d7eb7992c2f0e2df24a819fe06c2828 Mon Sep 17 00:00:00 2001 From: Vijay Hiremath Date: Sat, 19 May 2018 00:12:40 -0700 Subject: APL/GLK: Clean up UART buffer before shutdown UART buffer gets overwritten by other tasks if it is not explicitly flushed before printing it on the console by same task. Hence, clean up the UART buffer so that all the debug messages are printed on the UART console before doing shutdown. BUG=b:79950369 BRANCH=none TEST=Manually tested on BIP, observed that UART logs are not lost on the terminal when apshutdown is issued. Change-Id: I420e9de9e2e71913ee3168267a6f3a2728b2690b Signed-off-by: Vijay Hiremath Reviewed-on: https://chromium-review.googlesource.com/1064977 Commit-Ready: Vijay Hiremath Tested-by: Vijay Hiremath Reviewed-by: Aaron Durbin Reviewed-by: Jett Rink --- power/apollolake.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/power/apollolake.c b/power/apollolake.c index c1fcbe8e17..dda74a29b9 100644 --- a/power/apollolake.c +++ b/power/apollolake.c @@ -28,6 +28,14 @@ __attribute__((weak)) void chipset_do_shutdown(void) static void internal_chipset_shutdown(void) { + /* + * UART buffer gets overwritten by other tasks if it is not explicitly + * flushed before printing it on the console by same task. Hence, clean + * up the UART buffer so that all the debug messages are printed on the + * UART console before doing shutdown. + */ + cflush(); + CPRINTS("%s()", __func__); force_shutdown = 0; -- cgit v1.2.1