summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorBin Meng <bmeng@tinylab.org>2022-12-09 23:04:35 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-19 14:58:19 +0100
commit8890717526c8e13801f7e866329a2bfce3a62240 (patch)
tree7f35fa7623aca392b44cc4460e93fb0de1ec342a /drivers/tty/serial
parent41000b03af9e15075061cdbeea461cfa5e12a8eb (diff)
downloadlinux-stable-8890717526c8e13801f7e866329a2bfce3a62240.tar.gz
linux-stable-8890717526c8e13801f7e866329a2bfce3a62240.tar.bz2
linux-stable-8890717526c8e13801f7e866329a2bfce3a62240.zip
serial: earlycon-arm-semihost: Move smh_putc() variants in respective arch's semihost.h
Move smh_putc() variants in respective arch/*/include/asm/semihost.h, in preparation to add RISC-V support. Signed-off-by: Bin Meng <bmeng@tinylab.org> Tested-by: Sergey Matyukevich <sergey.matyukevich@syntacore.com> Acked-by: Palmer Dabbelt <palmer@rivosinc.com> Link: https://lore.kernel.org/r/20221209150437.795918-2-bmeng@tinylab.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/earlycon-arm-semihost.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/drivers/tty/serial/earlycon-arm-semihost.c b/drivers/tty/serial/earlycon-arm-semihost.c
index fcdec5f42376..e4692a8433f9 100644
--- a/drivers/tty/serial/earlycon-arm-semihost.c
+++ b/drivers/tty/serial/earlycon-arm-semihost.c
@@ -11,30 +11,7 @@
#include <linux/console.h>
#include <linux/init.h>
#include <linux/serial_core.h>
-
-#ifdef CONFIG_THUMB2_KERNEL
-#define SEMIHOST_SWI "0xab"
-#else
-#define SEMIHOST_SWI "0x123456"
-#endif
-
-/*
- * Semihosting-based debug console
- */
-static void smh_putc(struct uart_port *port, unsigned char c)
-{
-#ifdef CONFIG_ARM64
- asm volatile("mov x1, %0\n"
- "mov x0, #3\n"
- "hlt 0xf000\n"
- : : "r" (&c) : "x0", "x1", "memory");
-#else
- asm volatile("mov r1, %0\n"
- "mov r0, #3\n"
- "svc " SEMIHOST_SWI "\n"
- : : "r" (&c) : "r0", "r1", "memory");
-#endif
-}
+#include <asm/semihost.h>
static void smh_write(struct console *con, const char *s, unsigned n)
{