提交 d0a69d9f 编写于 作者: M Mark Rutland 提交者: Will Deacon

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: NMark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: NWill Deacon <will.deacon@arm.com>
上级 cd5f22d7
...@@ -21,21 +21,16 @@ ...@@ -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) ...@@ -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();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册