diff options
author | Oleksij Rempel <bug-track@fisher-privat.net> | 2013-04-15 12:10:04 +0200 |
---|---|---|
committer | Spencer Oliver <spen@spen-soft.co.uk> | 2013-07-17 14:33:34 +0000 |
commit | d18807e7bc43228e214563ba15fd7b24acb2f8f3 (patch) | |
tree | 769f2d54e10dbb9250f4943d5d1b0dcd7caa451d /src/target/mips32.c | |
parent | 6a5848faeb8415a5524ca6fc8c77c9ea89d0165c (diff) | |
download | riscv-openocd-d18807e7bc43228e214563ba15fd7b24acb2f8f3.zip riscv-openocd-d18807e7bc43228e214563ba15fd7b24acb2f8f3.tar.gz riscv-openocd-d18807e7bc43228e214563ba15fd7b24acb2f8f3.tar.bz2 |
mips: add breakpoint support for EJTAG 2.0
EJTAG 1.5, 2.0 and 2.5 have different breakpoint register addresses.
This patch add support of EJTAG 2.0, which is part some broadcom
SoCs.
This work was testet on Broadcom BCM7401.
Change-Id: I4b0ee23871fa9205f9001b7c9165e7b6ebe9ccbf
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-on: http://openocd.zylin.com/1464
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/target/mips32.c')
-rw-r--r-- | src/target/mips32.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/target/mips32.c b/src/target/mips32.c index 16988b5..1067f7b 100644 --- a/src/target/mips32.c +++ b/src/target/mips32.c @@ -472,11 +472,12 @@ int mips32_examine(struct target *target) static int mips32_configure_ibs(struct target *target) { struct mips32_common *mips32 = target_to_mips32(target); + struct mips_ejtag *ejtag_info = &mips32->ejtag_info; int retval, i; uint32_t bpinfo; /* get number of inst breakpoints */ - retval = target_read_u32(target, EJTAG_IBS, &bpinfo); + retval = target_read_u32(target, ejtag_info->ejtag_ibs_addr, &bpinfo); if (retval != ERROR_OK) return retval; @@ -487,21 +488,23 @@ static int mips32_configure_ibs(struct target *target) for (i = 0; i < mips32->num_inst_bpoints; i++) mips32->inst_break_list[i].reg_address = - EJTAG_IBA1 + (0x100 * i); + ejtag_info->ejtag_iba0_addr + + (ejtag_info->ejtag_iba_step_size * i); /* clear IBIS reg */ - retval = target_write_u32(target, EJTAG_IBS, 0); + retval = target_write_u32(target, ejtag_info->ejtag_ibs_addr, 0); return retval; } static int mips32_configure_dbs(struct target *target) { struct mips32_common *mips32 = target_to_mips32(target); + struct mips_ejtag *ejtag_info = &mips32->ejtag_info; int retval, i; uint32_t bpinfo; /* get number of data breakpoints */ - retval = target_read_u32(target, EJTAG_DBS, &bpinfo); + retval = target_read_u32(target, ejtag_info->ejtag_dbs_addr, &bpinfo); if (retval != ERROR_OK) return retval; @@ -512,10 +515,11 @@ static int mips32_configure_dbs(struct target *target) for (i = 0; i < mips32->num_data_bpoints; i++) mips32->data_break_list[i].reg_address = - EJTAG_DBA1 + (0x100 * i); + ejtag_info->ejtag_dba0_addr + + (ejtag_info->ejtag_dba_step_size * i); /* clear DBIS reg */ - retval = target_write_u32(target, EJTAG_DBS, 0); + retval = target_write_u32(target, ejtag_info->ejtag_dbs_addr, 0); return retval; } @@ -523,6 +527,7 @@ int mips32_configure_break_unit(struct target *target) { /* get pointers to arch-specific information */ struct mips32_common *mips32 = target_to_mips32(target); + struct mips_ejtag *ejtag_info = &mips32->ejtag_info; int retval; uint32_t dcr; @@ -534,6 +539,11 @@ int mips32_configure_break_unit(struct target *target) if (retval != ERROR_OK) return retval; + /* EJTAG 2.0 does not specify EJTAG_DCR_IB and EJTAG_DCR_DB bits, + * assume IB and DB registers are always present. */ + if (ejtag_info->ejtag_version == EJTAG_VERSION_20) + dcr |= EJTAG_DCR_IB | EJTAG_DCR_DB; + if (dcr & EJTAG_DCR_IB) { retval = mips32_configure_ibs(target); if (retval != ERROR_OK) |