xref: /openbmc/linux/arch/arm/include/asm/semihost.h (revision 71de0a05)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2012 ARM Ltd.
4  * Author: Marc Zyngier <marc.zyngier@arm.com>
5  *
6  * Adapted for ARM and earlycon:
7  * Copyright (C) 2014 Linaro Ltd.
8  * Author: Rob Herring <robh@kernel.org>
9  */
10 
11 #ifndef _ARM_SEMIHOST_H_
12 #define _ARM_SEMIHOST_H_
13 
14 #ifdef CONFIG_THUMB2_KERNEL
15 #define SEMIHOST_SWI	"0xab"
16 #else
17 #define SEMIHOST_SWI	"0x123456"
18 #endif
19 
20 struct uart_port;
21 
22 static inline void smh_putc(struct uart_port *port, unsigned char c)
23 {
24 	asm volatile("mov  r1, %0\n"
25 		     "mov  r0, #3\n"
26 		     "svc  " SEMIHOST_SWI "\n"
27 		     : : "r" (&c) : "r0", "r1", "memory");
28 }
29 
30 #endif /* _ARM_SEMIHOST_H_ */
31