aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorManish Pandey <manish.pandey2@arm.com>2020-04-09 15:16:40 +0100
committerManish Pandey <manish.pandey2@arm.com>2020-04-27 10:39:35 +0100
commitf218ffeb19020ac0ecf8cedc7ec733ac8bd2d416 (patch)
tree72554d56c2a6814123ef81dccc381273f36ac0c2 /drivers
parent97de48df60e16c0889b41098beb138eaeff32362 (diff)
downloadtf-a-tests-f218ffeb19020ac0ecf8cedc7ec733ac8bd2d416.tar.gz
pl011: allow alternate stdout to be used
Till now only pl011 UART is available stdout but there is a usecase to redirect it to other channel. This patch decouples console_putc implementation from pl011. Signed-off-by: Manish Pandey <manish.pandey2@arm.com> Change-Id: I38e8c5c90421fad2425228f407e6f29bdf6b08c7
Diffstat (limited to 'drivers')
-rw-r--r--drivers/arm/pl011/aarch32/pl011_console.S14
-rw-r--r--drivers/arm/pl011/aarch64/pl011_console.S15
-rw-r--r--drivers/console/console.c12
3 files changed, 29 insertions, 12 deletions
diff --git a/drivers/arm/pl011/aarch32/pl011_console.S b/drivers/arm/pl011/aarch32/pl011_console.S
index c65c4f68..b201f047 100644
--- a/drivers/arm/pl011/aarch32/pl011_console.S
+++ b/drivers/arm/pl011/aarch32/pl011_console.S
@@ -10,7 +10,7 @@
#include <drivers/console.h>
.globl console_init
- .globl console_putc
+ .globl console_pl011_putc
.globl console_getc
.globl console_try_getc
.globl console_flush
@@ -97,17 +97,19 @@ core_init_fail:
bx lr
endfunc console_core_init
- /* ---------------------------------------------
- * int console_putc(int c)
+ /* -------------------------------------------------
+ * To allow alternate implementation of putc, pl011
+ * is appended in the function name.
+ * int console_pl011_putc(int c)
*
* Clobber list : r1, r2
- * ---------------------------------------------
+ * -------------------------------------------------
*/
-func console_putc
+func console_pl011_putc
ldr r1, =console_base
ldr r1, [r1]
b console_core_putc
-endfunc console_putc
+endfunc console_pl011_putc
/* --------------------------------------------------------
* int console_core_putc(int c, uintptr_t base_addr)
diff --git a/drivers/arm/pl011/aarch64/pl011_console.S b/drivers/arm/pl011/aarch64/pl011_console.S
index 8b1e0624..0d607b91 100644
--- a/drivers/arm/pl011/aarch64/pl011_console.S
+++ b/drivers/arm/pl011/aarch64/pl011_console.S
@@ -10,7 +10,7 @@
#include <drivers/console.h>
.globl console_init
- .globl console_putc
+ .globl console_pl011_putc
.globl console_getc
.globl console_try_getc
.globl console_flush
@@ -93,17 +93,20 @@ init_fail:
ret
endfunc console_core_init
- /* ---------------------------------------------
- * int console_putc(int c)
+ /* -------------------------------------------------
+ * To allow alternate implementation of putc, pl011
+ * is appended in the function name.
+ *
+ * int console_pl011_putc(int c)
*
* Clobber list : x1, x2
- * ---------------------------------------------
+ * -------------------------------------------------
*/
-func console_putc
+func console_pl011_putc
adrp x1, console_base
ldr x1, [x1, :lo12:console_base]
b console_core_putc
-endfunc console_putc
+endfunc console_pl011_putc
/* ---------------------------------------------
* int console_core_putc(int c, uintptr_t base_addr)
diff --git a/drivers/console/console.c b/drivers/console/console.c
new file mode 100644
index 00000000..b2bae284
--- /dev/null
+++ b/drivers/console/console.c
@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2020, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <drivers/arm/pl011.h>
+
+int console_putc(int c)
+{
+ return console_pl011_putc(c);
+}