This is an automated email from Gerrit. "Paul Fertser <fercer...@gmail.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7857
-- gerrit commit e1db008a131f3093189a33edd3b85029861e2e95 Author: Artur Rojek <cont...@artur-rojek.eu> Date: Sat Aug 12 18:29:46 2023 +0200 mips32: pracc: remove last instruction check skip There are no longer any callers of mips32_pracc_exec() that set the check_last parameter to false. As such, remove the code path that allowed the last instruction check to be skipped. Signed-off-by: Artur Rojek <cont...@artur-rojek.eu> Signed-off-by: Paul Fertser <fercer...@gmail.com> Change-Id: I1c5cc3341c8efba7a3f7923a0e23150a17267216 diff --git a/src/flash/nor/ath79.c b/src/flash/nor/ath79.c index 1d1ec02b33..3fdce8b3aa 100644 --- a/src/flash/nor/ath79.c +++ b/src/flash/nor/ath79.c @@ -275,7 +275,7 @@ static int ath79_spi_bitbang_chunk(struct flash_bank *bank, LOG_DEBUG("Assembled %d instructions, %d stores", ctx.code_count, ctx.store_count); - ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, out, 1); + ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, out); if (ctx.retval != ERROR_OK) goto exit; diff --git a/src/target/mips32_pracc.c b/src/target/mips32_pracc.c index c4704b5a5d..27a5bb9ae7 100644 --- a/src/target/mips32_pracc.c +++ b/src/target/mips32_pracc.c @@ -151,7 +151,7 @@ static int mips32_pracc_clean_text_jump(struct mips_ejtag *ejtag_info) } static int mips32_pracc_exec(struct mips_ejtag *ejtag_info, struct pracc_queue_info *ctx, - uint32_t *param_out, bool check_last) + uint32_t *param_out) { int code_count = 0; int store_pending = 0; /* increases with every store instr at dmseg, decreases with every store pa */ @@ -283,9 +283,6 @@ static int mips32_pracc_exec(struct mips_ejtag *ejtag_info, struct pracc_queue_i /* finish processor access, let the processor eat! */ mips32_pracc_finish(ejtag_info); - if (final_check && !check_last) /* last instr, don't check, execute and exit */ - 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"); return ERROR_OK; @@ -341,7 +338,7 @@ inline void pracc_queue_free(struct pracc_queue_info *ctx) } int mips32_pracc_queue_exec(struct mips_ejtag *ejtag_info, struct pracc_queue_info *ctx, - uint32_t *buf, bool check_last) + uint32_t *buf) { if (ctx->retval != ERROR_OK) { LOG_ERROR("Out of memory"); @@ -353,7 +350,7 @@ int mips32_pracc_queue_exec(struct mips_ejtag *ejtag_info, struct pracc_queue_in ctx->pracc_list[i].instr = SWAP16(ctx->pracc_list[i].instr); if (ejtag_info->mode == 0) - return mips32_pracc_exec(ejtag_info, ctx, buf, check_last); + return mips32_pracc_exec(ejtag_info, ctx, buf); union scan_in { uint8_t scan_96[12]; @@ -458,7 +455,7 @@ static int mips32_pracc_read_u32(struct mips_ejtag *ejtag_info, uint32_t addr, u pracc_add(&ctx, 0, MIPS32_B(ctx.isa, NEG16((ctx.code_count + 1) << ctx.isa))); /* jump to start */ pracc_add(&ctx, 0, MIPS32_MFC0(ctx.isa, 15, 31, 0)); /* move COP0 DeSave to $15 */ - ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, buf, 1); + ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, buf); pracc_queue_free(&ctx); return ctx.retval; } @@ -519,12 +516,12 @@ int mips32_pracc_read_mem(struct mips_ejtag *ejtag_info, uint32_t addr, int size pracc_add(&ctx, 0, MIPS32_MFC0(ctx.isa, 15, 31, 0)); /* restore $15 from DeSave */ if (size == 4) { - ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, buf32, 1); + ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, buf32); if (ctx.retval != ERROR_OK) goto exit; buf32 += this_round_count; } else { - ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, data, 1); + ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, data); if (ctx.retval != ERROR_OK) goto exit; @@ -558,7 +555,7 @@ int mips32_cp0_read(struct mips_ejtag *ejtag_info, uint32_t *val, uint32_t cp0_r pracc_add(&ctx, 0, MIPS32_B(ctx.isa, NEG16((ctx.code_count + 1) << ctx.isa))); /* jump to start */ pracc_add(&ctx, 0, MIPS32_ORI(ctx.isa, 8, 8, LOWER16(ejtag_info->reg8))); /* restore lower 16 bits of $8 */ - ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, val, 1); + ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, val); pracc_queue_free(&ctx); return ctx.retval; } @@ -574,7 +571,7 @@ int mips32_cp0_write(struct mips_ejtag *ejtag_info, uint32_t val, uint32_t cp0_r pracc_add(&ctx, 0, MIPS32_B(ctx.isa, NEG16((ctx.code_count + 1) << ctx.isa))); /* jump to start */ pracc_add(&ctx, 0, MIPS32_MFC0(ctx.isa, 15, 31, 0)); /* restore $15 from DeSave */ - ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL, 1); + ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL); pracc_queue_free(&ctx); return ctx.retval; } @@ -627,7 +624,7 @@ static int mips32_pracc_synchronize_cache(struct mips_ejtag *ejtag_info, pracc_add(&ctx, 0, MIPS32_B(ctx.isa, NEG16((ctx.code_count + 1) << ctx.isa))); /* jump to start */ pracc_add(&ctx, 0, MIPS32_MFC0(ctx.isa, 15, 31, 0)); /* restore $15 from DeSave */ - ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, &clsiz, 1); + ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, &clsiz); if (ctx.retval != ERROR_OK) goto exit; @@ -690,7 +687,7 @@ static int mips32_pracc_synchronize_cache(struct mips_ejtag *ejtag_info, pracc_add(&ctx, 0, MIPS32_B(ctx.isa, NEG16((ctx.code_count + 1) << ctx.isa))); /* to start */ pracc_add(&ctx, 0, MIPS32_NOP); /* nop in delay slot */ - ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL, 1); + ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL); if (ctx.retval != ERROR_OK) goto exit; @@ -703,7 +700,7 @@ static int mips32_pracc_synchronize_cache(struct mips_ejtag *ejtag_info, pracc_add(&ctx, 0, MIPS32_B(ctx.isa, NEG16((ctx.code_count + 1) << ctx.isa))); /* jump to start */ pracc_add(&ctx, 0, MIPS32_MFC0(ctx.isa, 15, 31, 0)); /* restore $15 from DeSave*/ - ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL, 1); + ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL); exit: pracc_queue_free(&ctx); return ctx.retval; @@ -758,7 +755,7 @@ static int mips32_pracc_write_mem_generic(struct mips_ejtag *ejtag_info, pracc_add(&ctx, 0, MIPS32_B(ctx.isa, NEG16((ctx.code_count + 1) << ctx.isa))); /* jump to start */ pracc_add(&ctx, 0, MIPS32_MFC0(ctx.isa, 15, 31, 0)); /* restore $15 from DeSave */ - ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL, 1); + ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL); if (ctx.retval != ERROR_OK) goto exit; count -= this_round_count; @@ -850,7 +847,7 @@ int mips32_pracc_write_regs(struct mips_ejtag *ejtag_info, uint32_t *regs) pracc_add(&ctx, 0, MIPS32_B(ctx.isa, NEG16((ctx.code_count + 1) << ctx.isa))); /* jump to start */ pracc_add(&ctx, 0, MIPS32_ORI(ctx.isa, 1, 1, LOWER16((regs[1])))); /* load lower half word in $1 */ - ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL, 1); + ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL); ejtag_info->reg8 = regs[8]; ejtag_info->reg9 = regs[9]; @@ -892,7 +889,7 @@ int mips32_pracc_read_regs(struct mips_ejtag *ejtag_info, uint32_t *regs) pracc_add(&ctx, 0, MIPS32_B(ctx.isa, NEG16((ctx.code_count + 1) << ctx.isa))); /* jump to start */ pracc_add(&ctx, 0, MIPS32_MTC0(ctx.isa, 15, 31, 0)); /* load $15 in DeSave */ - ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, regs, 1); + ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, regs); ejtag_info->reg8 = regs[8]; /* reg8 is saved but not restored, next called function should restore it */ ejtag_info->reg9 = regs[9]; diff --git a/src/target/mips32_pracc.h b/src/target/mips32_pracc.h index 1b00768676..da81b04d09 100644 --- a/src/target/mips32_pracc.h +++ b/src/target/mips32_pracc.h @@ -55,7 +55,7 @@ void pracc_queue_init(struct pracc_queue_info *ctx); void pracc_add(struct pracc_queue_info *ctx, uint32_t addr, uint32_t instr); void pracc_queue_free(struct pracc_queue_info *ctx); int mips32_pracc_queue_exec(struct mips_ejtag *ejtag_info, - struct pracc_queue_info *ctx, uint32_t *buf, bool check_last); + struct pracc_queue_info *ctx, uint32_t *buf); int mips32_pracc_read_mem(struct mips_ejtag *ejtag_info, uint32_t addr, int size, int count, void *buf); diff --git a/src/target/mips_ejtag.c b/src/target/mips_ejtag.c index 22e9e3a7e8..92387f598a 100644 --- a/src/target/mips_ejtag.c +++ b/src/target/mips_ejtag.c @@ -198,7 +198,7 @@ int mips_ejtag_config_step(struct mips_ejtag *ejtag_info, int enable_step) pracc_add(&ctx, 0, MIPS32_B(ctx.isa, NEG16((ctx.code_count + 1) << ctx.isa))); /* jump to start */ pracc_add(&ctx, 0, MIPS32_ORI(ctx.isa, 8, 8, LOWER16(ejtag_info->reg8))); /* restore lower 16 bits of $8 */ - ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL, 1); + ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL); pracc_queue_free(&ctx); return ctx.retval; } @@ -261,7 +261,7 @@ int mips_ejtag_exit_debug(struct mips_ejtag *ejtag_info) struct pracc_queue_info ctx = {.max_code = 1, .pracc_list = &pracc_list, .code_count = 1, .store_count = 0}; /* execute our dret instruction */ - ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL, 1); + ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL); /* pic32mx workaround, false pending at low core clock */ jtag_add_sleep(1000); --