]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
fix(msm8916): print \r before \n on UART console
authorStephan Gerhold <stephan@gerhold.net>
Tue, 23 Aug 2022 20:33:11 +0000 (22:33 +0200)
committerManish V Badarkhe <manish.badarkhe@arm.com>
Tue, 9 May 2023 19:44:29 +0000 (21:44 +0200)
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>
plat/qti/msm8916/aarch64/uartdm_console.S

index c69c1932abb985d22f530ec5f36d5a4e092e9d33..e142179399553f310754944f60af6271be8115b9 100644 (file)
@@ -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