/* SPDX-License-Identifier: GPL-2.0-only */1/* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.2*3* A call to __dcc_getchar() or __dcc_putchar() is typically followed by4* a call to __dcc_getstatus(). We want to make sure that the CPU does5* not speculative read the DCC status before executing the read or write6* instruction. That's what the ISBs are for.7*8* The 'volatile' ensures that the compiler does not cache the status bits,9* and instead reads the DCC register every time.10*/11#ifndef __ASM_DCC_H12#define __ASM_DCC_H1314#include <asm/barrier.h>15#include <asm/sysreg.h>1617static inline u32 __dcc_getstatus(void)18{19return read_sysreg(mdccsr_el0);20}2122static inline char __dcc_getchar(void)23{24char c = read_sysreg(dbgdtrrx_el0);25isb();2627return c;28}2930static inline void __dcc_putchar(char c)31{32/*33* The typecast is to make absolutely certain that 'c' is34* zero-extended.35*/36write_sysreg((unsigned char)c, dbgdtrtx_el0);37isb();38}3940#endif414243