mips: add breakpoint support for EJTAG 2.0
[openocd.git] / src / target / mips32.c
index 16988b5a212d6b61399338bcc3b261c0e052bb1f..1067f7b631bdc078312e7808563c8a219bc29249 100644 (file)
@@ -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)

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)