diff options
author | Bin Meng <bmeng@tinylab.org> | 2022-12-09 23:04:35 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-19 14:58:19 +0100 |
commit | 8890717526c8e13801f7e866329a2bfce3a62240 (patch) | |
tree | 7f35fa7623aca392b44cc4460e93fb0de1ec342a /arch/arm64/include/asm/semihost.h | |
parent | 41000b03af9e15075061cdbeea461cfa5e12a8eb (diff) | |
download | linux-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 'arch/arm64/include/asm/semihost.h')
-rw-r--r-- | arch/arm64/include/asm/semihost.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/semihost.h b/arch/arm64/include/asm/semihost.h new file mode 100644 index 000000000000..87e353dab868 --- /dev/null +++ b/arch/arm64/include/asm/semihost.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2012 ARM Ltd. + * Author: Marc Zyngier <marc.zyngier@arm.com> + * + * Adapted for ARM and earlycon: + * Copyright (C) 2014 Linaro Ltd. + * Author: Rob Herring <robh@kernel.org> + */ + +#ifndef _ARM64_SEMIHOST_H_ +#define _ARM64_SEMIHOST_H_ + +struct uart_port; + +static inline void smh_putc(struct uart_port *port, unsigned char c) +{ + asm volatile("mov x1, %0\n" + "mov x0, #3\n" + "hlt 0xf000\n" + : : "r" (&c) : "x0", "x1", "memory"); +} + +#endif /* _ARM64_SEMIHOST_H_ */ |