diff options
Diffstat (limited to 'arch/sh/include/asm')
-rw-r--r-- | arch/sh/include/asm/Kbuild | 4 | ||||
-rw-r--r-- | arch/sh/include/asm/hw_breakpoint.h | 67 | ||||
-rw-r--r-- | arch/sh/include/asm/kdebug.h | 2 | ||||
-rw-r--r-- | arch/sh/include/asm/processor_32.h | 8 | ||||
-rw-r--r-- | arch/sh/include/asm/ptrace.h | 6 | ||||
-rw-r--r-- | arch/sh/include/asm/system.h | 4 | ||||
-rw-r--r-- | arch/sh/include/asm/ubc.h | 64 |
7 files changed, 82 insertions, 73 deletions
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild index e121c30f797d..46cb93477bcb 100644 --- a/arch/sh/include/asm/Kbuild +++ b/arch/sh/include/asm/Kbuild | |||
@@ -1,6 +1,8 @@ | |||
1 | include include/asm-generic/Kbuild.asm | 1 | include include/asm-generic/Kbuild.asm |
2 | 2 | ||
3 | header-y += cachectl.h cpu-features.h | 3 | header-y += cachectl.h |
4 | header-y += cpu-features.h | ||
5 | header-y += hw_breakpoint.h | ||
4 | 6 | ||
5 | unifdef-y += unistd_32.h | 7 | unifdef-y += unistd_32.h |
6 | unifdef-y += unistd_64.h | 8 | unifdef-y += unistd_64.h |
diff --git a/arch/sh/include/asm/hw_breakpoint.h b/arch/sh/include/asm/hw_breakpoint.h new file mode 100644 index 000000000000..7295d6290249 --- /dev/null +++ b/arch/sh/include/asm/hw_breakpoint.h | |||
@@ -0,0 +1,67 @@ | |||
1 | #ifndef __ASM_SH_HW_BREAKPOINT_H | ||
2 | #define __ASM_SH_HW_BREAKPOINT_H | ||
3 | |||
4 | #include <linux/kdebug.h> | ||
5 | #include <linux/types.h> | ||
6 | |||
7 | #ifdef __KERNEL__ | ||
8 | #define __ARCH_HW_BREAKPOINT_H | ||
9 | |||
10 | struct arch_hw_breakpoint { | ||
11 | char *name; /* Contains name of the symbol to set bkpt */ | ||
12 | unsigned long address; | ||
13 | u16 len; | ||
14 | u16 type; | ||
15 | }; | ||
16 | |||
17 | enum { | ||
18 | SH_BREAKPOINT_READ = (1 << 1), | ||
19 | SH_BREAKPOINT_WRITE = (1 << 2), | ||
20 | SH_BREAKPOINT_RW = SH_BREAKPOINT_READ | SH_BREAKPOINT_WRITE, | ||
21 | |||
22 | SH_BREAKPOINT_LEN_1 = (1 << 12), | ||
23 | SH_BREAKPOINT_LEN_2 = (1 << 13), | ||
24 | SH_BREAKPOINT_LEN_4 = SH_BREAKPOINT_LEN_1 | SH_BREAKPOINT_LEN_2, | ||
25 | SH_BREAKPOINT_LEN_8 = (1 << 14), | ||
26 | }; | ||
27 | |||
28 | struct sh_ubc { | ||
29 | const char *name; | ||
30 | unsigned int num_events; | ||
31 | unsigned int trap_nr; | ||
32 | void (*enable)(struct arch_hw_breakpoint *, int); | ||
33 | void (*disable)(struct arch_hw_breakpoint *, int); | ||
34 | void (*enable_all)(unsigned long); | ||
35 | void (*disable_all)(void); | ||
36 | unsigned long (*active_mask)(void); | ||
37 | unsigned long (*triggered_mask)(void); | ||
38 | void (*clear_triggered_mask)(unsigned long); | ||
39 | struct clk *clk; /* optional interface clock / MSTP bit */ | ||
40 | }; | ||
41 | |||
42 | struct perf_event; | ||
43 | struct task_struct; | ||
44 | struct pmu; | ||
45 | |||
46 | /* Maximum number of UBC channels */ | ||
47 | #define HBP_NUM 2 | ||
48 | |||
49 | /* arch/sh/kernel/hw_breakpoint.c */ | ||
50 | extern int arch_check_va_in_userspace(unsigned long va, u16 hbp_len); | ||
51 | extern int arch_validate_hwbkpt_settings(struct perf_event *bp, | ||
52 | struct task_struct *tsk); | ||
53 | extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused, | ||
54 | unsigned long val, void *data); | ||
55 | |||
56 | int arch_install_hw_breakpoint(struct perf_event *bp); | ||
57 | void arch_uninstall_hw_breakpoint(struct perf_event *bp); | ||
58 | void hw_breakpoint_pmu_read(struct perf_event *bp); | ||
59 | void hw_breakpoint_pmu_unthrottle(struct perf_event *bp); | ||
60 | |||
61 | extern void arch_fill_perf_breakpoint(struct perf_event *bp); | ||
62 | extern int register_sh_ubc(struct sh_ubc *); | ||
63 | |||
64 | extern struct pmu perf_ops_bp; | ||
65 | |||
66 | #endif /* __KERNEL__ */ | ||
67 | #endif /* __ASM_SH_HW_BREAKPOINT_H */ | ||
diff --git a/arch/sh/include/asm/kdebug.h b/arch/sh/include/asm/kdebug.h index 985219f9759e..5f6d2e9ccb7c 100644 --- a/arch/sh/include/asm/kdebug.h +++ b/arch/sh/include/asm/kdebug.h | |||
@@ -6,6 +6,8 @@ enum die_val { | |||
6 | DIE_TRAP, | 6 | DIE_TRAP, |
7 | DIE_NMI, | 7 | DIE_NMI, |
8 | DIE_OOPS, | 8 | DIE_OOPS, |
9 | DIE_BREAKPOINT, | ||
10 | DIE_SSTEP, | ||
9 | }; | 11 | }; |
10 | 12 | ||
11 | #endif /* __ASM_SH_KDEBUG_H */ | 13 | #endif /* __ASM_SH_KDEBUG_H */ |
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h index a359898206e8..5fd83125fb89 100644 --- a/arch/sh/include/asm/processor_32.h +++ b/arch/sh/include/asm/processor_32.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <asm/page.h> | 14 | #include <asm/page.h> |
15 | #include <asm/types.h> | 15 | #include <asm/types.h> |
16 | #include <asm/ptrace.h> | 16 | #include <asm/ptrace.h> |
17 | #include <asm/hw_breakpoint.h> | ||
17 | 18 | ||
18 | /* | 19 | /* |
19 | * Default implementation of macro that returns current | 20 | * Default implementation of macro that returns current |
@@ -104,8 +105,8 @@ struct thread_struct { | |||
104 | unsigned long sp; | 105 | unsigned long sp; |
105 | unsigned long pc; | 106 | unsigned long pc; |
106 | 107 | ||
107 | /* Hardware debugging registers */ | 108 | /* Save middle states of ptrace breakpoints */ |
108 | unsigned long ubc_pc; | 109 | struct perf_event *ptrace_bps[HBP_NUM]; |
109 | 110 | ||
110 | #ifdef CONFIG_SH_DSP | 111 | #ifdef CONFIG_SH_DSP |
111 | /* Dsp status information */ | 112 | /* Dsp status information */ |
@@ -116,9 +117,6 @@ struct thread_struct { | |||
116 | union thread_xstate *xstate; | 117 | union thread_xstate *xstate; |
117 | }; | 118 | }; |
118 | 119 | ||
119 | /* Count of active tasks with UBC settings */ | ||
120 | extern int ubc_usercnt; | ||
121 | |||
122 | #define INIT_THREAD { \ | 120 | #define INIT_THREAD { \ |
123 | .sp = sizeof(init_stack) + (long) &init_stack, \ | 121 | .sp = sizeof(init_stack) + (long) &init_stack, \ |
124 | } | 122 | } |
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h index 1dc12cb44a2d..201d11ef211f 100644 --- a/arch/sh/include/asm/ptrace.h +++ b/arch/sh/include/asm/ptrace.h | |||
@@ -124,6 +124,12 @@ struct task_struct; | |||
124 | extern void user_enable_single_step(struct task_struct *); | 124 | extern void user_enable_single_step(struct task_struct *); |
125 | extern void user_disable_single_step(struct task_struct *); | 125 | extern void user_disable_single_step(struct task_struct *); |
126 | 126 | ||
127 | struct perf_event; | ||
128 | struct perf_sample_data; | ||
129 | |||
130 | extern void ptrace_triggered(struct perf_event *bp, int nmi, | ||
131 | struct perf_sample_data *data, struct pt_regs *regs); | ||
132 | |||
127 | #define task_pt_regs(task) \ | 133 | #define task_pt_regs(task) \ |
128 | ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE) - 1) | 134 | ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE) - 1) |
129 | 135 | ||
diff --git a/arch/sh/include/asm/system.h b/arch/sh/include/asm/system.h index c15415b4b169..62e4fc1e4409 100644 --- a/arch/sh/include/asm/system.h +++ b/arch/sh/include/asm/system.h | |||
@@ -32,7 +32,7 @@ | |||
32 | #define mb() __asm__ __volatile__ ("synco": : :"memory") | 32 | #define mb() __asm__ __volatile__ ("synco": : :"memory") |
33 | #define rmb() mb() | 33 | #define rmb() mb() |
34 | #define wmb() __asm__ __volatile__ ("synco": : :"memory") | 34 | #define wmb() __asm__ __volatile__ ("synco": : :"memory") |
35 | #define ctrl_barrier() __icbi(0xa8000000) | 35 | #define ctrl_barrier() __icbi(PAGE_OFFSET) |
36 | #define read_barrier_depends() do { } while(0) | 36 | #define read_barrier_depends() do { } while(0) |
37 | #else | 37 | #else |
38 | #define mb() __asm__ __volatile__ ("": : :"memory") | 38 | #define mb() __asm__ __volatile__ ("": : :"memory") |
@@ -144,8 +144,6 @@ void per_cpu_trap_init(void); | |||
144 | void default_idle(void); | 144 | void default_idle(void); |
145 | void cpu_idle_wait(void); | 145 | void cpu_idle_wait(void); |
146 | 146 | ||
147 | asmlinkage void break_point_trap(void); | ||
148 | |||
149 | #ifdef CONFIG_SUPERH32 | 147 | #ifdef CONFIG_SUPERH32 |
150 | #define BUILD_TRAP_HANDLER(name) \ | 148 | #define BUILD_TRAP_HANDLER(name) \ |
151 | asmlinkage void name##_trap_handler(unsigned long r4, unsigned long r5, \ | 149 | asmlinkage void name##_trap_handler(unsigned long r4, unsigned long r5, \ |
diff --git a/arch/sh/include/asm/ubc.h b/arch/sh/include/asm/ubc.h deleted file mode 100644 index 9bf961684431..000000000000 --- a/arch/sh/include/asm/ubc.h +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-sh/ubc.h | ||
3 | * | ||
4 | * Copyright (C) 1999 Niibe Yutaka | ||
5 | * Copyright (C) 2002, 2003 Paul Mundt | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | #ifndef __ASM_SH_UBC_H | ||
12 | #define __ASM_SH_UBC_H | ||
13 | #ifdef __KERNEL__ | ||
14 | |||
15 | #include <cpu/ubc.h> | ||
16 | |||
17 | /* User Break Controller */ | ||
18 | #if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709) | ||
19 | #define UBC_TYPE_SH7729 (current_cpu_data.type == CPU_SH7729) | ||
20 | #else | ||
21 | #define UBC_TYPE_SH7729 0 | ||
22 | #endif | ||
23 | |||
24 | #define BAMR_ASID (1 << 2) | ||
25 | #define BAMR_NONE 0 | ||
26 | #define BAMR_10 0x1 | ||
27 | #define BAMR_12 0x2 | ||
28 | #define BAMR_ALL 0x3 | ||
29 | #define BAMR_16 0x8 | ||
30 | #define BAMR_20 0x9 | ||
31 | |||
32 | #define BBR_INST (1 << 4) | ||
33 | #define BBR_DATA (2 << 4) | ||
34 | #define BBR_READ (1 << 2) | ||
35 | #define BBR_WRITE (2 << 2) | ||
36 | #define BBR_BYTE 0x1 | ||
37 | #define BBR_HALF 0x2 | ||
38 | #define BBR_LONG 0x3 | ||
39 | #define BBR_QUAD (1 << 6) /* SH7750 */ | ||
40 | #define BBR_CPU (1 << 6) /* SH7709A,SH7729 */ | ||
41 | #define BBR_DMA (2 << 6) /* SH7709A,SH7729 */ | ||
42 | |||
43 | #define BRCR_CMFA (1 << 15) | ||
44 | #define BRCR_CMFB (1 << 14) | ||
45 | |||
46 | #if defined CONFIG_CPU_SH2A | ||
47 | #define BRCR_CMFCA (1 << 15) | ||
48 | #define BRCR_CMFCB (1 << 14) | ||
49 | #define BRCR_CMFDA (1 << 13) | ||
50 | #define BRCR_CMFDB (1 << 12) | ||
51 | #define BRCR_PCBB (1 << 6) /* 1: after execution */ | ||
52 | #define BRCR_PCBA (1 << 5) /* 1: after execution */ | ||
53 | #define BRCR_PCTE 0 | ||
54 | #else | ||
55 | #define BRCR_PCTE (1 << 11) | ||
56 | #define BRCR_PCBA (1 << 10) /* 1: after execution */ | ||
57 | #define BRCR_DBEB (1 << 7) | ||
58 | #define BRCR_PCBB (1 << 6) | ||
59 | #define BRCR_SEQ (1 << 3) | ||
60 | #define BRCR_UBDE (1 << 0) | ||
61 | #endif | ||
62 | |||
63 | #endif /* __KERNEL__ */ | ||
64 | #endif /* __ASM_SH_UBC_H */ | ||