mips32, mips32_pracc_finish() queued only 10/4010/3
authorSalvador Arroyo <sarroyofdez@yahoo.es>
Thu, 23 Feb 2017 14:14:46 +0000 (15:14 +0100)
committerFreddie Chopin <freddie.chopin@gmail.com>
Tue, 25 Apr 2017 15:59:44 +0000 (16:59 +0100)
In most of the cases there is no need to request execution,
the check for a new pracc access already does it.
Requesting execution if not needed makes execution slower and
code larger due the additional checks.
Reduce code in fasdata transfer function.
Call for execution when exiting debug.

Change-Id: I3b45f6d1f62da5fad3e3db84f82a9299b16e1bd9
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/4010
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
src/target/mips32_pracc.c

index 69d9a0079ada108a6008c626a3b5ae159ef97cee..caa566b5ba5a147bef1ac39699d5de1f9c5d3581 100644 (file)
@@ -116,24 +116,21 @@ static int mips32_pracc_read_ctrl_addr(struct mips_ejtag *ejtag_info)
 }
 
 /* Finish processor access */
 }
 
 /* Finish processor access */
-static int mips32_pracc_finish(struct mips_ejtag *ejtag_info)
+static void mips32_pracc_finish(struct mips_ejtag *ejtag_info)
 {
        uint32_t ctrl = ejtag_info->ejtag_ctrl & ~EJTAG_CTRL_PRACC;
        mips_ejtag_set_instr(ejtag_info, EJTAG_INST_CONTROL);
        mips_ejtag_drscan_32_out(ejtag_info, ctrl);
 {
        uint32_t ctrl = ejtag_info->ejtag_ctrl & ~EJTAG_CTRL_PRACC;
        mips_ejtag_set_instr(ejtag_info, EJTAG_INST_CONTROL);
        mips_ejtag_drscan_32_out(ejtag_info, ctrl);
-
-       return jtag_execute_queue();
 }
 
 int mips32_pracc_clean_text_jump(struct mips_ejtag *ejtag_info)
 {
        uint32_t jt_code = MIPS32_J((0x0FFFFFFF & MIPS32_PRACC_TEXT) >> 2);
 }
 
 int mips32_pracc_clean_text_jump(struct mips_ejtag *ejtag_info)
 {
        uint32_t jt_code = MIPS32_J((0x0FFFFFFF & MIPS32_PRACC_TEXT) >> 2);
-       int retval;
 
        /* do 3 0/nops to clean pipeline before a jump to pracc text, NOP in delay slot */
        for (int i = 0; i != 5; i++) {
                /* Wait for pracc */
 
        /* do 3 0/nops to clean pipeline before a jump to pracc text, NOP in delay slot */
        for (int i = 0; i != 5; i++) {
                /* Wait for pracc */
-               retval = wait_for_pracc_rw(ejtag_info, &ejtag_info->pa_ctrl);
+               int retval = wait_for_pracc_rw(ejtag_info, &ejtag_info->pa_ctrl);
                if (retval != ERROR_OK)
                        return retval;
 
                if (retval != ERROR_OK)
                        return retval;
 
@@ -143,25 +140,21 @@ int mips32_pracc_clean_text_jump(struct mips_ejtag *ejtag_info)
                mips_ejtag_drscan_32_out(ejtag_info, data);
 
                /* finish pa */
                mips_ejtag_drscan_32_out(ejtag_info, data);
 
                /* finish pa */
-               retval = mips32_pracc_finish(ejtag_info);
-               if (retval != ERROR_OK)
-                       return retval;
+               mips32_pracc_finish(ejtag_info);
        }
 
        if (ejtag_info->mode != 0)      /* async mode support only for MIPS ... */
                return ERROR_OK;
 
        for (int i = 0; i != 2; i++) {
        }
 
        if (ejtag_info->mode != 0)      /* async mode support only for MIPS ... */
                return ERROR_OK;
 
        for (int i = 0; i != 2; i++) {
-               retval = mips32_pracc_read_ctrl_addr(ejtag_info);
+               int retval = mips32_pracc_read_ctrl_addr(ejtag_info);
                if (retval != ERROR_OK)
                        return retval;
 
                if (ejtag_info->pa_addr != MIPS32_PRACC_TEXT) {         /* LEXRA/BMIPS ?, shift out another NOP, max 2 */
                        mips_ejtag_set_instr(ejtag_info, EJTAG_INST_DATA);
                        mips_ejtag_drscan_32_out(ejtag_info, MIPS32_NOP);
                if (retval != ERROR_OK)
                        return retval;
 
                if (ejtag_info->pa_addr != MIPS32_PRACC_TEXT) {         /* LEXRA/BMIPS ?, shift out another NOP, max 2 */
                        mips_ejtag_set_instr(ejtag_info, EJTAG_INST_DATA);
                        mips_ejtag_drscan_32_out(ejtag_info, MIPS32_NOP);
-                       retval = mips32_pracc_finish(ejtag_info);
-                       if (retval != ERROR_OK)
-                               return retval;
+                       mips32_pracc_finish(ejtag_info);
                } else
                        break;
        }
                } else
                        break;
        }
@@ -298,12 +291,10 @@ int mips32_pracc_exec(struct mips_ejtag *ejtag_info, struct pracc_queue_info *ct
                        mips_ejtag_drscan_32_out(ejtag_info, instr);
                }
                /* finish processor access, let the processor eat! */
                        mips_ejtag_drscan_32_out(ejtag_info, instr);
                }
                /* finish processor access, let the processor eat! */
-               retval = mips32_pracc_finish(ejtag_info);
-               if (retval != ERROR_OK)
-                       return retval;
+               mips32_pracc_finish(ejtag_info);
 
                if (instr == MIPS32_DRET)       /* after leaving debug mode nothing to do */
 
                if (instr == MIPS32_DRET)       /* after leaving debug mode nothing to do */
-                       return ERROR_OK;
+                       return jtag_execute_queue();
 
                if (store_pending == 0 && pass) {       /* store access done, but after passing pracc text */
                        LOG_DEBUG("warning: store access pass pracc text");
 
                if (store_pending == 0 && pass) {       /* store access done, but after passing pracc text */
                        LOG_DEBUG("warning: store access pass pracc text");
@@ -1013,9 +1004,7 @@ int mips32_pracc_fastdata_xfer(struct mips_ejtag *ejtag_info, struct working_are
                mips_ejtag_drscan_32_out(ejtag_info, jmp_code[i]);
 
                /* Clear the access pending bit (let the processor eat!) */
                mips_ejtag_drscan_32_out(ejtag_info, jmp_code[i]);
 
                /* Clear the access pending bit (let the processor eat!) */
-               ejtag_ctrl = ejtag_info->ejtag_ctrl & ~EJTAG_CTRL_PRACC;
-               mips_ejtag_set_instr(ejtag_info, EJTAG_INST_CONTROL);
-               mips_ejtag_drscan_32_out(ejtag_info, ejtag_ctrl);
+               mips32_pracc_finish(ejtag_info);
        }
 
        /* wait PrAcc pending bit for FASTDATA write, read address */
        }
 
        /* wait PrAcc pending bit for FASTDATA write, read address */

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)