target/arc: Introduce Actionpoints support

Actionpoint mechanism allows to setup HW breakpoints and watchpoints on Synopsys ARC CPUs.
This mechanism is controlled by DEBUG register and by a set of auxilary registers.
Each actionpoint is controlled by 3 aux registers: Actionpoint(AP) match mask(AP_AMM),
AP match value(AP_AMV) and AP control(AC).

Note: some fields of actionpoint_t structure will be used in further
support of watchpoints.

Change-Id: I4efb24675f247cc19d9122501c9e63c3126fcab4
Signed-off-by: Evgeniy Didin <didin@synopsys.com>
Reviewed-on: http://openocd.zylin.com/5763
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Evgeniy Didin
2020-07-10 14:52:35 +03:00
committed by Antonio Borneo
parent 07df04b3b1
commit 8fea8460db
4 changed files with 418 additions and 9 deletions

View File

@@ -78,6 +78,16 @@
#define SLC_AUX_CACHE_INV 0x905
#define L2_INV_IV BIT(0)
/* Action Point */
#define AP_AC_AT_INST_ADDR 0x0
#define AP_AC_AT_MEMORY_ADDR 0x2
#define AP_AC_AT_AUXREG_ADDR 0x4
#define AP_AC_TT_DISABLE 0x00
#define AP_AC_TT_WRITE 0x10
#define AP_AC_TT_READ 0x20
#define AP_AC_TT_READWRITE 0x30
struct arc_reg_bitfield {
struct reg_data_type_bitfield bitfield;
char name[REG_TYPE_MAX_NAME_LENGTH];
@@ -96,8 +106,6 @@ struct arc_reg_data_type {
};
};
/* Standard GDB register types */
static const struct reg_data_type standard_gdb_types[] = {
{ .type = REG_TYPE_INT, .id = "int" },
@@ -118,6 +126,18 @@ static const struct reg_data_type standard_gdb_types[] = {
{ .type = REG_TYPE_IEEE_DOUBLE, .id = "ieee_double" },
};
enum arc_actionpointype {
ARC_AP_BREAKPOINT,
ARC_AP_WATCHPOINT,
};
/* Actionpoint related fields */
struct arc_actionpoint {
int used;
uint32_t bp_value;
uint32_t reg_address;
enum arc_actionpointype type;
};
struct arc_common {
uint32_t common_magic;
@@ -172,6 +192,11 @@ struct arc_common {
unsigned long pc_index_in_cache;
/* DEBUG register location in register cache. */
unsigned long debug_index_in_cache;
/* Actionpoints */
unsigned int actionpoints_num;
unsigned int actionpoints_num_avail;
struct arc_actionpoint *actionpoints_list;
};
/* Borrowed from nds32.h */
@@ -284,4 +309,9 @@ int arc_reg_get_field(struct target *target, const char *reg_name,
int arc_cache_flush(struct target *target);
int arc_cache_invalidate(struct target *target);
int arc_add_auxreg_actionpoint(struct target *target,
uint32_t auxreg_addr, uint32_t transaction);
int arc_remove_auxreg_actionpoint(struct target *target, uint32_t auxreg_addr);
int arc_set_actionpoints_num(struct target *target, uint32_t ap_num);
#endif /* OPENOCD_TARGET_ARC_H */