[PATCH 1/2] ARM: add diagnostic register access helpers

Shawn Guo shawn.guo at linaro.org
Tue Apr 16 10:30:42 EDT 2013


The CP15 diagnostic register holds many ARM errata bits.  Add a pair of
access helpers for it.

Signed-off-by: Shawn Guo <shawn.guo at linaro.org>
---
 arch/arm/include/asm/cp15.h |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/include/asm/cp15.h b/arch/arm/include/asm/cp15.h
index 5ef4d80..0b14dfb 100644
--- a/arch/arm/include/asm/cp15.h
+++ b/arch/arm/include/asm/cp15.h
@@ -82,6 +82,19 @@ static inline void set_copro_access(unsigned int val)
 	isb();
 }
 
+static inline unsigned int get_diag_reg(void)
+{
+	unsigned int val;
+	asm("mrc p15, 0, %0, c15, c0, 1" : "=r" (val) : : "cc");
+	return val;
+}
+
+static inline void set_diag_reg(unsigned int val)
+{
+	asm volatile("mcr p15, 0, %0, c15, c0, 1" : : "r" (val) : "cc");
+	isb();
+}
+
 #endif
 
 #endif
-- 
1.7.9.5





More information about the linux-arm-kernel mailing list