summaryrefslogtreecommitdiff
path: root/include/common
diff options
context:
space:
mode:
authorDaniel Boulby <daniel.boulby@arm.com>2018-09-19 13:58:20 +0100
committerDaniel Boulby <daniel.boulby@arm.com>2018-09-21 13:04:07 +0100
commit7e2bbef9f979233bb6fc3d3cdce244dec2d9e18d (patch)
tree9c338d950a72141737c8981df40e085c943558a3 /include/common
parent09d2be11a1bd94ca46a04dd0b25cd94d5abf62c5 (diff)
pl011: Add support in AArch32 for MULTI_CONSOLE_API
Allow AArch32 to use the multi console driver by adding the required functions Change-Id: I9e69f18965f320074cf75442d6b0de891aef7936 Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Diffstat (limited to 'include/common')
-rw-r--r--include/common/aarch32/console_macros.S43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/common/aarch32/console_macros.S b/include/common/aarch32/console_macros.S
new file mode 100644
index 00000000..480e3c29
--- /dev/null
+++ b/include/common/aarch32/console_macros.S
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+#ifndef __CONSOLE_MACROS_S__
+#define __CONSOLE_MACROS_S__
+
+#include <console.h>
+
+/*
+ * This macro encapsulates the common setup that has to be done at the end of
+ * a console driver's register function. It will register all of the driver's
+ * callbacks in the console_t structure and initialize the flags field (by
+ * default consoles are enabled for the "boot" and "crash" states, this can be
+ * changed after registration with the console_set_scope() function). It ends
+ * with a tail call that will include return to the caller.
+ * REQUIRES console_t pointer in x0 and a valid return address in x30.
+ */
+ .macro finish_console_register _driver
+ /*
+ * Add these weak definitions so we will automatically write a 0 if the
+ * function doesn't exist. I'd rather use .ifdef but that only works if
+ * the function was defined (not just declared .global) above this point
+ * in the file, which we can't guarantee.
+ */
+ .weak console_\_driver\()_putc
+ .weak console_\_driver\()_getc
+ .weak console_\_driver\()_flush
+
+ /* Don't use adrp on weak funcs! See GNU ld bugzilla issue 22589. */
+ ldr r1, =console_\_driver\()_putc
+ str r1, [r0, #CONSOLE_T_PUTC]
+ ldr r1, =console_\_driver\()_getc
+ str r1, [r0, #CONSOLE_T_GETC]
+ ldr r1, =console_\_driver\()_flush
+ str r1, [r0, #CONSOLE_T_FLUSH]
+ mov r1, #(CONSOLE_FLAG_BOOT | CONSOLE_FLAG_CRASH)
+ str r1, [r0, #CONSOLE_T_FLAGS]
+ b console_register
+ .endm
+
+#endif /* __CONSOLE_MACROS_S__ */