arm64: dcc: simplify accessors

A while back we added {read,write}_sysreg accessors to handle accesses
to system registers, without the usual boilerplate asm volatile,
temporary variable, etc.

This patch makes use of these in the arm64 DCC accessors to make the
code shorter and clearer.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
This commit is contained in:
Mark Rutland 2016-09-08 13:55:36 +01:00 committed by Will Deacon
parent cd5f22d796
commit d0a69d9f38
1 changed files with 4 additions and 10 deletions

View File

@ -21,21 +21,16 @@
#define __ASM_DCC_H #define __ASM_DCC_H
#include <asm/barrier.h> #include <asm/barrier.h>
#include <asm/sysreg.h>
static inline u32 __dcc_getstatus(void) static inline u32 __dcc_getstatus(void)
{ {
u32 ret; return read_sysreg(mdccsr_el0);
asm volatile("mrs %0, mdccsr_el0" : "=r" (ret));
return ret;
} }
static inline char __dcc_getchar(void) static inline char __dcc_getchar(void)
{ {
char c; char c = read_sysreg(dbgdtrrx_el0);
asm volatile("mrs %0, dbgdtrrx_el0" : "=r" (c));
isb(); isb();
return c; return c;
@ -47,8 +42,7 @@ static inline void __dcc_putchar(char c)
* The typecast is to make absolutely certain that 'c' is * The typecast is to make absolutely certain that 'c' is
* zero-extended. * zero-extended.
*/ */
asm volatile("msr dbgdtrtx_el0, %0" write_sysreg((unsigned char)c, dbgdtrtx_el0);
: : "r" ((unsigned long)(unsigned char)c));
isb(); isb();
} }