hw_breakpoint.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef __ASM_SH_HW_BREAKPOINT_H
  2. #define __ASM_SH_HW_BREAKPOINT_H
  3. #include <uapi/asm/hw_breakpoint.h>
  4. #define __ARCH_HW_BREAKPOINT_H
  5. #include <linux/kdebug.h>
  6. #include <linux/types.h>
  7. struct arch_hw_breakpoint {
  8. char *name; /* Contains name of the symbol to set bkpt */
  9. unsigned long address;
  10. u16 len;
  11. u16 type;
  12. };
  13. enum {
  14. SH_BREAKPOINT_READ = (1 << 1),
  15. SH_BREAKPOINT_WRITE = (1 << 2),
  16. SH_BREAKPOINT_RW = SH_BREAKPOINT_READ | SH_BREAKPOINT_WRITE,
  17. SH_BREAKPOINT_LEN_1 = (1 << 12),
  18. SH_BREAKPOINT_LEN_2 = (1 << 13),
  19. SH_BREAKPOINT_LEN_4 = SH_BREAKPOINT_LEN_1 | SH_BREAKPOINT_LEN_2,
  20. SH_BREAKPOINT_LEN_8 = (1 << 14),
  21. };
  22. struct sh_ubc {
  23. const char *name;
  24. unsigned int num_events;
  25. unsigned int trap_nr;
  26. void (*enable)(struct arch_hw_breakpoint *, int);
  27. void (*disable)(struct arch_hw_breakpoint *, int);
  28. void (*enable_all)(unsigned long);
  29. void (*disable_all)(void);
  30. unsigned long (*active_mask)(void);
  31. unsigned long (*triggered_mask)(void);
  32. void (*clear_triggered_mask)(unsigned long);
  33. struct clk *clk; /* optional interface clock / MSTP bit */
  34. };
  35. struct perf_event;
  36. struct task_struct;
  37. struct pmu;
  38. /* Maximum number of UBC channels */
  39. #define HBP_NUM 2
  40. static inline int hw_breakpoint_slots(int type)
  41. {
  42. return HBP_NUM;
  43. }
  44. /* arch/sh/kernel/hw_breakpoint.c */
  45. extern int arch_check_bp_in_kernelspace(struct perf_event *bp);
  46. extern int arch_validate_hwbkpt_settings(struct perf_event *bp);
  47. extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
  48. unsigned long val, void *data);
  49. int arch_install_hw_breakpoint(struct perf_event *bp);
  50. void arch_uninstall_hw_breakpoint(struct perf_event *bp);
  51. void hw_breakpoint_pmu_read(struct perf_event *bp);
  52. extern void arch_fill_perf_breakpoint(struct perf_event *bp);
  53. extern int register_sh_ubc(struct sh_ubc *);
  54. extern struct pmu perf_ops_bp;
  55. #endif /* __ASM_SH_HW_BREAKPOINT_H */