1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
4 * A call to __dcc_getchar() or __dcc_putchar() is typically followed by
5 * a call to __dcc_getstatus(). We want to make sure that the CPU does
6 * not speculative read the DCC status before executing the read or write
7 * instruction. That's what the ISBs are for.
9 * The 'volatile' ensures that the compiler does not cache the status bits,
10 * and instead reads the DCC register every time.
15 #include <asm/barrier.h>
16 #include <asm/sysreg.h>
18 static inline u32
__dcc_getstatus(void)
20 return read_sysreg(mdccsr_el0
);
23 static inline char __dcc_getchar(void)
25 char c
= read_sysreg(dbgdtrrx_el0
);
31 static inline void __dcc_putchar(char c
)
34 * The typecast is to make absolutely certain that 'c' is
37 write_sysreg((unsigned char)c
, dbgdtrtx_el0
);