You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

187 lines
4.8 KiB

  1. /***************************************************************************
  2. * Copyright (C) 2005 by Dominic Rath *
  3. * Dominic.Rath@gmx.de *
  4. * *
  5. * Copyright (C) 2007,2008 Øyvind Harboe *
  6. * oyvind.harboe@zylin.com *
  7. * *
  8. * This program is free software; you can redistribute it and/or modify *
  9. * it under the terms of the GNU General Public License as published by *
  10. * the Free Software Foundation; either version 2 of the License, or *
  11. * (at your option) any later version. *
  12. * *
  13. * This program is distributed in the hope that it will be useful, *
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  16. * GNU General Public License for more details. *
  17. * *
  18. * You should have received a copy of the GNU General Public License *
  19. * along with this program; if not, write to the *
  20. * Free Software Foundation, Inc., *
  21. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  22. ***************************************************************************/
  23. #ifndef XSCALE_H
  24. #define XSCALE_H
  25. #include "target.h"
  26. #include "register.h"
  27. #include "armv4_5.h"
  28. #include "armv4_5_mmu.h"
  29. #include "trace.h"
  30. #include "image.h"
  31. #define XSCALE_COMMON_MAGIC 0x58534341
  32. typedef struct xscale_jtag_s
  33. {
  34. /* position in JTAG scan chain */
  35. jtag_tap_t *tap;
  36. /* IR length and instructions */
  37. int ir_length;
  38. u32 dbgrx;
  39. u32 dbgtx;
  40. u32 ldic;
  41. u32 dcsr;
  42. } xscale_jtag_t;
  43. enum xscale_debug_reason
  44. {
  45. XSCALE_DBG_REASON_GENERIC,
  46. XSCALE_DBG_REASON_RESET,
  47. XSCALE_DBG_REASON_TB_FULL,
  48. };
  49. enum xscale_trace_entry_type
  50. {
  51. XSCALE_TRACE_MESSAGE = 0x0,
  52. XSCALE_TRACE_ADDRESS = 0x1,
  53. };
  54. typedef struct xscale_trace_entry_s
  55. {
  56. u8 data;
  57. enum xscale_trace_entry_type type;
  58. } xscale_trace_entry_t;
  59. typedef struct xscale_trace_data_s
  60. {
  61. xscale_trace_entry_t *entries;
  62. int depth;
  63. u32 chkpt0;
  64. u32 chkpt1;
  65. u32 last_instruction;
  66. struct xscale_trace_data_s *next;
  67. } xscale_trace_data_t;
  68. typedef struct xscale_trace_s
  69. {
  70. trace_status_t capture_status; /* current state of capture run */
  71. image_t *image; /* source for target opcodes */
  72. xscale_trace_data_t *data; /* linked list of collected trace data */
  73. int buffer_enabled; /* whether trace buffer is enabled */
  74. int buffer_fill; /* maximum number of trace runs to read (-1 for wrap-around) */
  75. int pc_ok;
  76. u32 current_pc;
  77. armv4_5_state_t core_state; /* current core state (ARM, Thumb, Jazelle) */
  78. } xscale_trace_t;
  79. typedef struct xscale_common_s
  80. {
  81. int common_magic;
  82. /* XScale registers (CP15, DBG) */
  83. reg_cache_t *reg_cache;
  84. /* pxa250, pxa255, pxa27x, ixp42x, ... */
  85. char *variant;
  86. xscale_jtag_t jtag_info;
  87. /* current state of the debug handler */
  88. int handler_installed;
  89. int handler_running;
  90. u32 handler_address;
  91. /* target-endian buffers with exception vectors */
  92. u32 low_vectors[8];
  93. u32 high_vectors[8];
  94. /* static low vectors */
  95. u8 static_low_vectors_set; /* bit field with static vectors set by the user */
  96. u8 static_high_vectors_set; /* bit field with static vectors set by the user */
  97. u32 static_low_vectors[8];
  98. u32 static_high_vectors[8];
  99. /* DCache cleaning */
  100. u32 cache_clean_address;
  101. /* whether hold_rst and ext_dbg_break should be set */
  102. int hold_rst;
  103. int external_debug_break;
  104. /* breakpoint / watchpoint handling */
  105. int dbr_available;
  106. int dbr0_used;
  107. int dbr1_used;
  108. int ibcr_available;
  109. int ibcr0_used;
  110. int ibcr1_used;
  111. u32 arm_bkpt;
  112. u16 thumb_bkpt;
  113. u8 vector_catch;
  114. xscale_trace_t trace;
  115. int arch_debug_reason;
  116. /* armv4/5 common stuff */
  117. armv4_5_common_t armv4_5_common;
  118. /* MMU/Caches */
  119. armv4_5_mmu_common_t armv4_5_mmu;
  120. u32 cp15_control_reg;
  121. /* possible future enhancements that go beyond XScale common stuff */
  122. void *arch_info;
  123. int fast_memory_access;
  124. } xscale_common_t;
  125. typedef struct xscale_reg_s
  126. {
  127. int dbg_handler_number;
  128. target_t *target;
  129. } xscale_reg_t;
  130. enum
  131. {
  132. XSCALE_MAINID, /* 0 */
  133. XSCALE_CACHETYPE,
  134. XSCALE_CTRL,
  135. XSCALE_AUXCTRL,
  136. XSCALE_TTB,
  137. XSCALE_DAC,
  138. XSCALE_FSR,
  139. XSCALE_FAR,
  140. XSCALE_PID,
  141. XSCALE_CPACCESS,
  142. XSCALE_IBCR0, /* 10 */
  143. XSCALE_IBCR1,
  144. XSCALE_DBR0,
  145. XSCALE_DBR1,
  146. XSCALE_DBCON,
  147. XSCALE_TBREG,
  148. XSCALE_CHKPT0,
  149. XSCALE_CHKPT1,
  150. XSCALE_DCSR,
  151. XSCALE_TX,
  152. XSCALE_RX, /* 20 */
  153. XSCALE_TXRXCTRL,
  154. };
  155. #define ERROR_XSCALE_NO_TRACE_DATA (-1500)
  156. #endif /* XSCALE_H */