aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/include/asm/hw_breakpoint.h3
-rw-r--r--arch/arm/kernel/hw_breakpoint.c28
2 files changed, 26 insertions, 5 deletions
diff --git a/arch/arm/include/asm/hw_breakpoint.h b/arch/arm/include/asm/hw_breakpoint.h
index 01169dd723f1..eef55ea9ef00 100644
--- a/arch/arm/include/asm/hw_breakpoint.h
+++ b/arch/arm/include/asm/hw_breakpoint.h
@@ -85,6 +85,9 @@ static inline void decode_ctrl_reg(u32 reg,
85#define ARM_DSCR_HDBGEN (1 << 14) 85#define ARM_DSCR_HDBGEN (1 << 14)
86#define ARM_DSCR_MDBGEN (1 << 15) 86#define ARM_DSCR_MDBGEN (1 << 15)
87 87
88/* OSLSR os lock model bits */
89#define ARM_OSLSR_OSLM0 (1 << 0)
90
88/* opcode2 numbers for the co-processor instructions. */ 91/* opcode2 numbers for the co-processor instructions. */
89#define ARM_OP2_BVR 4 92#define ARM_OP2_BVR 4
90#define ARM_OP2_BCR 5 93#define ARM_OP2_BCR 5
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index 34e9375d96a6..201d4406fe0d 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -50,6 +50,9 @@ static int core_num_wrps;
50/* Debug architecture version. */ 50/* Debug architecture version. */
51static u8 debug_arch; 51static u8 debug_arch;
52 52
53/* Does debug architecture support OS Save and Restore? */
54static bool has_ossr;
55
53/* Maximum supported watchpoint length. */ 56/* Maximum supported watchpoint length. */
54static u8 max_watchpoint_len; 57static u8 max_watchpoint_len;
55 58
@@ -904,6 +907,23 @@ static struct undef_hook debug_reg_hook = {
904 .fn = debug_reg_trap, 907 .fn = debug_reg_trap,
905}; 908};
906 909
910/* Does this core support OS Save and Restore? */
911static bool core_has_os_save_restore(void)
912{
913 u32 oslsr;
914
915 switch (get_debug_arch()) {
916 case ARM_DEBUG_ARCH_V7_1:
917 return true;
918 case ARM_DEBUG_ARCH_V7_ECP14:
919 ARM_DBG_READ(c1, c1, 4, oslsr);
920 if (oslsr & ARM_OSLSR_OSLM0)
921 return true;
922 default:
923 return false;
924 }
925}
926
907static void reset_ctrl_regs(void *unused) 927static void reset_ctrl_regs(void *unused)
908{ 928{
909 int i, raw_num_brps, err = 0, cpu = smp_processor_id(); 929 int i, raw_num_brps, err = 0, cpu = smp_processor_id();
@@ -931,11 +951,7 @@ static void reset_ctrl_regs(void *unused)
931 if ((val & 0x1) == 0) 951 if ((val & 0x1) == 0)
932 err = -EPERM; 952 err = -EPERM;
933 953
934 /* 954 if (!has_ossr)
935 * Check whether we implement OS save and restore.
936 */
937 ARM_DBG_READ(c1, c1, 4, val);
938 if ((val & 0x9) == 0)
939 goto clear_vcr; 955 goto clear_vcr;
940 break; 956 break;
941 case ARM_DEBUG_ARCH_V7_1: 957 case ARM_DEBUG_ARCH_V7_1:
@@ -1025,6 +1041,8 @@ static int __init arch_hw_breakpoint_init(void)
1025 return 0; 1041 return 0;
1026 } 1042 }
1027 1043
1044 has_ossr = core_has_os_save_restore();
1045
1028 /* Determine how many BRPs/WRPs are available. */ 1046 /* Determine how many BRPs/WRPs are available. */
1029 core_num_brps = get_num_brps(); 1047 core_num_brps = get_num_brps();
1030 core_num_wrps = get_num_wrps(); 1048 core_num_wrps = get_num_wrps();