xref: /openbmc/linux/arch/arm/include/asm/dcc.h (revision 97fb5e8d)
197fb5e8dSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
24061f498SChristopher Covington /* Copyright (c) 2010, 2014 The Linux Foundation. All rights reserved.
34061f498SChristopher Covington  */
44061f498SChristopher Covington 
54061f498SChristopher Covington #include <asm/barrier.h>
64061f498SChristopher Covington 
__dcc_getstatus(void)74061f498SChristopher Covington static inline u32 __dcc_getstatus(void)
84061f498SChristopher Covington {
94061f498SChristopher Covington 	u32 __ret;
104061f498SChristopher Covington 	asm volatile("mrc p14, 0, %0, c0, c1, 0	@ read comms ctrl reg"
114061f498SChristopher Covington 		: "=r" (__ret) : : "cc");
124061f498SChristopher Covington 
134061f498SChristopher Covington 	return __ret;
144061f498SChristopher Covington }
154061f498SChristopher Covington 
__dcc_getchar(void)164061f498SChristopher Covington static inline char __dcc_getchar(void)
174061f498SChristopher Covington {
184061f498SChristopher Covington 	char __c;
194061f498SChristopher Covington 
204061f498SChristopher Covington 	asm volatile("mrc p14, 0, %0, c0, c5, 0	@ read comms data reg"
214061f498SChristopher Covington 		: "=r" (__c));
224061f498SChristopher Covington 	isb();
234061f498SChristopher Covington 
244061f498SChristopher Covington 	return __c;
254061f498SChristopher Covington }
264061f498SChristopher Covington 
__dcc_putchar(char c)274061f498SChristopher Covington static inline void __dcc_putchar(char c)
284061f498SChristopher Covington {
294061f498SChristopher Covington 	asm volatile("mcr p14, 0, %0, c0, c5, 0	@ write a char"
304061f498SChristopher Covington 		: /* no output register */
314061f498SChristopher Covington 		: "r" (c));
324061f498SChristopher Covington 	isb();
334061f498SChristopher Covington }
34