aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDietmar Eggemann <dietmar.eggemann@arm.com>2012-10-14 15:23:04 -0400
committerWill Deacon <will.deacon@arm.com>2013-01-10 16:13:05 -0500
commit02051ead976d854df1de726841c4a646826ec860 (patch)
tree6a2db29823171f8236b650361e97653481bc82b6 /arch
parent9931faca02c604c22335f5a935a501bb2ace6e20 (diff)
ARM: coresight: common definition for (OS) Lock Access Register key value
Coresight components and debug are using a common lock control mechansim. Writing 0xC5ACCE55 to the Lock Access Register (LAR) in case of a coresight components enables further access to the coresight device registers. Writing any other value to it removes the write access. Writing 0xC5ACCE55 to the OS Lock Access Register (OSLAR) in case of debug locks the debug register for further access to the debug registers. Writing any other value to it unlocks the debug registers. Unfortunately, the existing coresight code uses the terms lock and unlock the other way around. Unlocking stands for enabling write access and locking for removing write access. That is why the definition of the LAR and OSLAR key value has been changed to CS_LAR_KEY. Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/cti.h10
-rw-r--r--arch/arm/include/asm/hardware/coresight.h6
-rw-r--r--arch/arm/kernel/hw_breakpoint.c5
3 files changed, 9 insertions, 12 deletions
diff --git a/arch/arm/include/asm/cti.h b/arch/arm/include/asm/cti.h
index f2e5cad3f306..2381199acb7d 100644
--- a/arch/arm/include/asm/cti.h
+++ b/arch/arm/include/asm/cti.h
@@ -2,6 +2,7 @@
2#define __ASMARM_CTI_H 2#define __ASMARM_CTI_H
3 3
4#include <asm/io.h> 4#include <asm/io.h>
5#include <asm/hardware/coresight.h>
5 6
6/* The registers' definition is from section 3.2 of 7/* The registers' definition is from section 3.2 of
7 * Embedded Cross Trigger Revision: r0p0 8 * Embedded Cross Trigger Revision: r0p0
@@ -35,11 +36,6 @@
35#define LOCKACCESS 0xFB0 36#define LOCKACCESS 0xFB0
36#define LOCKSTATUS 0xFB4 37#define LOCKSTATUS 0xFB4
37 38
38/* write this value to LOCKACCESS will unlock the module, and
39 * other value will lock the module
40 */
41#define LOCKCODE 0xC5ACCE55
42
43/** 39/**
44 * struct cti - cross trigger interface struct 40 * struct cti - cross trigger interface struct
45 * @base: mapped virtual address for the cti base 41 * @base: mapped virtual address for the cti base
@@ -146,7 +142,7 @@ static inline void cti_irq_ack(struct cti *cti)
146 */ 142 */
147static inline void cti_unlock(struct cti *cti) 143static inline void cti_unlock(struct cti *cti)
148{ 144{
149 __raw_writel(LOCKCODE, cti->base + LOCKACCESS); 145 __raw_writel(CS_LAR_KEY, cti->base + LOCKACCESS);
150} 146}
151 147
152/** 148/**
@@ -158,6 +154,6 @@ static inline void cti_unlock(struct cti *cti)
158 */ 154 */
159static inline void cti_lock(struct cti *cti) 155static inline void cti_lock(struct cti *cti)
160{ 156{
161 __raw_writel(~LOCKCODE, cti->base + LOCKACCESS); 157 __raw_writel(~CS_LAR_KEY, cti->base + LOCKACCESS);
162} 158}
163#endif 159#endif
diff --git a/arch/arm/include/asm/hardware/coresight.h b/arch/arm/include/asm/hardware/coresight.h
index 7ecd793b8f5a..0cf7a6b842ff 100644
--- a/arch/arm/include/asm/hardware/coresight.h
+++ b/arch/arm/include/asm/hardware/coresight.h
@@ -36,7 +36,7 @@
36/* CoreSight Component Registers */ 36/* CoreSight Component Registers */
37#define CSCR_CLASS 0xff4 37#define CSCR_CLASS 0xff4
38 38
39#define UNLOCK_MAGIC 0xc5acce55 39#define CS_LAR_KEY 0xc5acce55
40 40
41/* ETM control register, "ETM Architecture", 3.3.1 */ 41/* ETM control register, "ETM Architecture", 3.3.1 */
42#define ETMR_CTRL 0 42#define ETMR_CTRL 0
@@ -147,11 +147,11 @@
147 147
148#define etm_lock(t) do { etm_writel((t), 0, CSMR_LOCKACCESS); } while (0) 148#define etm_lock(t) do { etm_writel((t), 0, CSMR_LOCKACCESS); } while (0)
149#define etm_unlock(t) \ 149#define etm_unlock(t) \
150 do { etm_writel((t), UNLOCK_MAGIC, CSMR_LOCKACCESS); } while (0) 150 do { etm_writel((t), CS_LAR_KEY, CSMR_LOCKACCESS); } while (0)
151 151
152#define etb_lock(t) do { etb_writel((t), 0, CSMR_LOCKACCESS); } while (0) 152#define etb_lock(t) do { etb_writel((t), 0, CSMR_LOCKACCESS); } while (0)
153#define etb_unlock(t) \ 153#define etb_unlock(t) \
154 do { etb_writel((t), UNLOCK_MAGIC, CSMR_LOCKACCESS); } while (0) 154 do { etb_writel((t), CS_LAR_KEY, CSMR_LOCKACCESS); } while (0)
155 155
156#endif /* __ASM_HARDWARE_CORESIGHT_H */ 156#endif /* __ASM_HARDWARE_CORESIGHT_H */
157 157
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index 5ff2e77782b1..34e9375d96a6 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -35,6 +35,7 @@
35#include <asm/hw_breakpoint.h> 35#include <asm/hw_breakpoint.h>
36#include <asm/kdebug.h> 36#include <asm/kdebug.h>
37#include <asm/traps.h> 37#include <asm/traps.h>
38#include <asm/hardware/coresight.h>
38 39
39/* Breakpoint currently in use for each BRP. */ 40/* Breakpoint currently in use for each BRP. */
40static DEFINE_PER_CPU(struct perf_event *, bp_on_reg[ARM_MAX_BRP]); 41static DEFINE_PER_CPU(struct perf_event *, bp_on_reg[ARM_MAX_BRP]);
@@ -955,9 +956,9 @@ static void reset_ctrl_regs(void *unused)
955 956
956 /* 957 /*
957 * Unconditionally clear the OS lock by writing a value 958 * Unconditionally clear the OS lock by writing a value
958 * other than 0xC5ACCE55 to the access register. 959 * other than CS_LAR_KEY to the access register.
959 */ 960 */
960 ARM_DBG_WRITE(c1, c0, 4, 0); 961 ARM_DBG_WRITE(c1, c0, 4, ~CS_LAR_KEY);
961 isb(); 962 isb();
962 963
963 /* 964 /*