summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Gerhold <stephan@gerhold.net>2022-08-23 22:33:11 +0200
committerManish V Badarkhe <manish.badarkhe@arm.com>2023-05-09 21:44:29 +0200
commit3fb7e40a21b1570a8ce1cd1708134fa7a05d94fb (patch)
tree032da96e8667fb4ac352aecb3325a05cfabb4f75
parentfdf9d768ea0d288aad56e627fda54f881fda606e (diff)
downloadarm-trusted-firmware-3fb7e40a21b1570a8ce1cd1708134fa7a05d94fb.tar.gz
fix(msm8916): print \r before \n on UART console
UART drivers in TF-A are expected to print \r before \n. Some terminal emulators expect \r\n as line endings by default so not doing this causes broken line breaks. Change-Id: I271a35a7c6907441bc71713b0b6a1da19da96878 Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
-rw-r--r--plat/qti/msm8916/aarch64/uartdm_console.S13
1 files changed, 12 insertions, 1 deletions
diff --git a/plat/qti/msm8916/aarch64/uartdm_console.S b/plat/qti/msm8916/aarch64/uartdm_console.S
index c69c1932a..e14217939 100644
--- a/plat/qti/msm8916/aarch64/uartdm_console.S
+++ b/plat/qti/msm8916/aarch64/uartdm_console.S
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Stephan Gerhold <stephan@gerhold.net>
+ * Copyright (c) 2021-2022, Stephan Gerhold <stephan@gerhold.net>
*
* Based on aarch64/skeleton_console.S:
* Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
@@ -113,10 +113,21 @@ endfunc console_uartdm_putc
* -----------------------------------------------------------
*/
func console_uartdm_core_putc
+ cmp w0, #'\n'
+ b.ne 2f
+
1: /* Loop until TX FIFO has space */
ldr w2, [x1, #UART_DM_SR]
tbz w2, #UART_DM_SR_TXRDY_BIT, 1b
+ /* Prepend '\r' to '\n' */
+ mov w2, #'\r'
+ str w2, [x1, #UART_DM_TF]
+
+2: /* Loop until TX FIFO has space */
+ ldr w2, [x1, #UART_DM_SR]
+ tbz w2, #UART_DM_SR_TXRDY_BIT, 2b
+
/* Write character to FIFO */
str w0, [x1, #UART_DM_TF]
ret