hw_watchpoint_aarch32.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #ifndef __HW_BREAKPOINT_32_H
  2. #define __HW_BREAKPOINT_32_H
  3. #include <asm/io.h>
  4. #include <mt-plat/mt_io.h>
  5. #include <mt-plat/sync_write.h>
  6. #include <mt-plat/hw_watchpoint.h>
  7. #define MAX_NR_WATCH_POINT 4
  8. struct wp_trace_context_t {
  9. void __iomem **debug_regs;
  10. struct wp_event wp_events[MAX_NR_WATCH_POINT];
  11. unsigned int wp_nr;
  12. unsigned int bp_nr;
  13. unsigned long dbgdidr;
  14. unsigned int nr_dbg;
  15. };
  16. struct dbgreg_set {
  17. unsigned long regs[28];
  18. };
  19. #define SDSR regs[22]
  20. #define DBGVCR regs[21]
  21. #define DBGWCR3 regs[20]
  22. #define DBGWCR2 regs[19]
  23. #define DBGWCR1 regs[18]
  24. #define DBGWCR0 regs[17]
  25. #define DBGWVR3 regs[16]
  26. #define DBGWVR2 regs[15]
  27. #define DBGWVR1 regs[14]
  28. #define DBGWVR0 regs[13]
  29. #define DBGBCR5 regs[12]
  30. #define DBGBCR4 regs[11]
  31. #define DBGBCR3 regs[10]
  32. #define DBGBCR2 regs[9]
  33. #define DBGBCR1 regs[8]
  34. #define DBGBCR0 regs[7]
  35. #define DBGBVR5 regs[6]
  36. #define DBGBVR4 regs[5]
  37. #define DBGBVR3 regs[4]
  38. #define DBGBVR2 regs[3]
  39. #define DBGBVR1 regs[2]
  40. #define DBGBVR0 regs[1]
  41. #define DBGDSCRext regs[0]
  42. #define DBGWVR 0x800
  43. #define DBGWCR 0x808
  44. #define DBGBVR 0x400
  45. #define DBGBCR 0x408
  46. #define DBGLAR 0xFB0
  47. #define DBGLSR 0xFB4
  48. #define DBGOSLAR 0x300
  49. /*
  50. #define NUM_CPU 4 // max cpu# per cluster
  51. */
  52. #define UNLOCK_KEY 0xC5ACCE55
  53. #define HDBGEN (1 << 14)
  54. #define MDBGEN (1 << 15)
  55. #define DBGWCR_VAL 0x000001E7
  56. /**/
  57. #define WP_EN (1 << 0)
  58. #define LSC_LDR (1 << 3)
  59. #define LSC_STR (2 << 3)
  60. #define LSC_ALL (3 << 3)
  61. /*
  62. #define WATCHPOINT_TEST_SUIT
  63. */
  64. #define dbg_mem_read(addr) readl(IOMEM(addr))
  65. #define dbg_mem_write(addr, val) mt_reg_sync_writel(val, addr)
  66. #define dbg_reg_copy(offset, base_to, base_from) \
  67. dbg_mem_write((base_to) + (offset), dbg_mem_read((base_from) + (offset)))
  68. static inline void cs_cpu_write(void __iomem *addr_base, u32 offset, u32 wdata)
  69. {
  70. /* TINFO="Write addr %h, with data %h", addr_base+offset, wdata */
  71. mt_reg_sync_writel(wdata, addr_base + offset);
  72. }
  73. static inline u32 cs_cpu_read(const void __iomem *addr_base, u32 offset)
  74. {
  75. u32 actual;
  76. /* TINFO="Read addr %h, with data %h", addr_base+offset, actual */
  77. actual = readl(addr_base + offset);
  78. return actual;
  79. }
  80. void smp_read_dbgsdsr_callback(void *info);
  81. void smp_write_dbgsdsr_callback(void *info);
  82. void smp_read_dbgdscr_callback(void *info);
  83. void smp_write_dbgdscr_callback(void *info);
  84. void smp_read_dbgoslsr_callback(void *info);
  85. void smp_write_dbgoslsr_callback(void *info);
  86. void smp_read_dbgvcr_callback(void *info);
  87. void smp_write_dbgvcr_callback(void *info);
  88. int register_wp_context(struct wp_trace_context_t **wp_tracer_context);
  89. void __iomem *get_wp_base(void);
  90. void smp_read_dbgdscr_callback(void *info);
  91. void smp_write_dbgdscr_callback(void *info);
  92. void smp_read_dbgoslsr_callback(void *info);
  93. void smp_write_dbgoslsr_callback(void *info);
  94. extern unsigned read_clusterid(void);
  95. #endif /* !__HW_BREAKPOINT_32_H */