blob: ec9ad593c3da743bacbd5875a577709a94e3333b [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
David Howells0a9426d2012-10-09 09:47:37 +01004#include <uapi/asm/hw_breakpoint.h>
5
Paul Mundt09a07292009-11-09 16:27:40 +09006#define __ARCH_HW_BREAKPOINT_H
7
Paul Mundt31a090a2010-01-30 11:29:56 +09008#include <linux/kdebug.h>
9#include <linux/types.h>
10
Paul Mundt09a07292009-11-09 16:27:40 +090011struct arch_hw_breakpoint {
12 char *name; /* Contains name of the symbol to set bkpt */
13 unsigned long address;
Paul Mundt09a07292009-11-09 16:27:40 +090014 u16 len;
15 u16 type;
16};
17
18enum {
19 SH_BREAKPOINT_READ = (1 << 1),
20 SH_BREAKPOINT_WRITE = (1 << 2),
21 SH_BREAKPOINT_RW = SH_BREAKPOINT_READ | SH_BREAKPOINT_WRITE,
22
23 SH_BREAKPOINT_LEN_1 = (1 << 12),
24 SH_BREAKPOINT_LEN_2 = (1 << 13),
25 SH_BREAKPOINT_LEN_4 = SH_BREAKPOINT_LEN_1 | SH_BREAKPOINT_LEN_2,
26 SH_BREAKPOINT_LEN_8 = (1 << 14),
27};
28
Paul Mundt4352fc12010-01-05 19:06:45 +090029struct sh_ubc {
30 const char *name;
31 unsigned int num_events;
32 unsigned int trap_nr;
33 void (*enable)(struct arch_hw_breakpoint *, int);
34 void (*disable)(struct arch_hw_breakpoint *, int);
35 void (*enable_all)(unsigned long);
36 void (*disable_all)(void);
37 unsigned long (*active_mask)(void);
38 unsigned long (*triggered_mask)(void);
39 void (*clear_triggered_mask)(unsigned long);
40 struct clk *clk; /* optional interface clock / MSTP bit */
41};
Paul Mundt09a07292009-11-09 16:27:40 +090042
43struct perf_event;
44struct task_struct;
45struct pmu;
46
Paul Mundt4352fc12010-01-05 19:06:45 +090047/* Maximum number of UBC channels */
48#define HBP_NUM 2
49
Frederic Weisbeckerfeef47d2010-04-23 05:59:55 +020050static inline int hw_breakpoint_slots(int type)
51{
52 return HBP_NUM;
53}
54
Paul Mundt4352fc12010-01-05 19:06:45 +090055/* arch/sh/kernel/hw_breakpoint.c */
Frederic Weisbeckerb2812d02010-04-18 18:11:53 +020056extern int arch_check_bp_in_kernelspace(struct perf_event *bp);
57extern int arch_validate_hwbkpt_settings(struct perf_event *bp);
Paul Mundt09a07292009-11-09 16:27:40 +090058extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
59 unsigned long val, void *data);
60
61int arch_install_hw_breakpoint(struct perf_event *bp);
62void arch_uninstall_hw_breakpoint(struct perf_event *bp);
63void hw_breakpoint_pmu_read(struct perf_event *bp);
Paul Mundt09a07292009-11-09 16:27:40 +090064
65extern void arch_fill_perf_breakpoint(struct perf_event *bp);
Paul Mundt4352fc12010-01-05 19:06:45 +090066extern int register_sh_ubc(struct sh_ubc *);
Paul Mundt09a07292009-11-09 16:27:40 +090067
68extern struct pmu perf_ops_bp;
69
Paul Mundt09a07292009-11-09 16:27:40 +090070#endif /* __ASM_SH_HW_BREAKPOINT_H */