blob: 89890f61a7b91d495a0cf4c72a45780fe6f389be [file] [log] [blame]
Paul Mundt09a07292009-11-09 16:27:40 +09001#ifndef __ASM_SH_HW_BREAKPOINT_H
2#define __ASM_SH_HW_BREAKPOINT_H
3
Paul Mundt09a07292009-11-09 16:27:40 +09004#ifdef __KERNEL__
5#define __ARCH_HW_BREAKPOINT_H
6
Paul Mundt31a090a2010-01-30 11:29:56 +09007#include <linux/kdebug.h>
8#include <linux/types.h>
9
Paul Mundt09a07292009-11-09 16:27:40 +090010struct arch_hw_breakpoint {
11 char *name; /* Contains name of the symbol to set bkpt */
12 unsigned long address;
Paul Mundt09a07292009-11-09 16:27:40 +090013 u16 len;
14 u16 type;
15};
16
17enum {
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
Paul Mundt4352fc12010-01-05 19:06:45 +090028struct 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};
Paul Mundt09a07292009-11-09 16:27:40 +090041
42struct perf_event;
43struct task_struct;
44struct pmu;
45
Paul Mundt4352fc12010-01-05 19:06:45 +090046/* Maximum number of UBC channels */
47#define HBP_NUM 2
48
Frederic Weisbeckerfeef47d2010-04-23 05:59:55 +020049static inline int hw_breakpoint_slots(int type)
50{
51 return HBP_NUM;
52}
53
Paul Mundt4352fc12010-01-05 19:06:45 +090054/* arch/sh/kernel/hw_breakpoint.c */
Frederic Weisbeckerb2812d02010-04-18 18:11:53 +020055extern int arch_check_bp_in_kernelspace(struct perf_event *bp);
56extern int arch_validate_hwbkpt_settings(struct perf_event *bp);
Paul Mundt09a07292009-11-09 16:27:40 +090057extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
58 unsigned long val, void *data);
59
60int arch_install_hw_breakpoint(struct perf_event *bp);
61void arch_uninstall_hw_breakpoint(struct perf_event *bp);
62void hw_breakpoint_pmu_read(struct perf_event *bp);
Paul Mundt09a07292009-11-09 16:27:40 +090063
64extern void arch_fill_perf_breakpoint(struct perf_event *bp);
Paul Mundt4352fc12010-01-05 19:06:45 +090065extern int register_sh_ubc(struct sh_ubc *);
Paul Mundt09a07292009-11-09 16:27:40 +090066
67extern struct pmu perf_ops_bp;
68
69#endif /* __KERNEL__ */
70#endif /* __ASM_SH_HW_BREAKPOINT_H */