X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Ftarget%2Farm720t.c;h=96e0baaf5c21f2a74d9aff874c5b74b229d37674;hb=f0c0256b1f05a04a58d857e9d865a0be0dd1680d;hp=b269f9488eda5acd43ed8bb652df6eea3f6f1024;hpb=70fee9207b5fd1c6f499b790591446adc4d4467c;p=openocd.git diff --git a/src/target/arm720t.c b/src/target/arm720t.c index b269f9488e..96e0baaf5c 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -154,14 +154,19 @@ static int arm720t_get_ttb(struct target *target, uint32_t *result) return ERROR_OK; } -static void arm720t_disable_mmu_caches(struct target *target, +static int arm720t_disable_mmu_caches(struct target *target, int mmu, int d_u_cache, int i_cache) { uint32_t cp15_control; + int retval; /* read cp15 control register */ - arm720t_read_cp15(target, 0xee110f10, &cp15_control); - jtag_execute_queue(); + retval = arm720t_read_cp15(target, 0xee110f10, &cp15_control); + if (retval != ERROR_OK) + return retval; + retval = jtag_execute_queue(); + if (retval != ERROR_OK) + return retval; if (mmu) cp15_control &= ~0x1U; @@ -169,17 +174,23 @@ static void arm720t_disable_mmu_caches(struct target *target, if (d_u_cache || i_cache) cp15_control &= ~0x4U; - arm720t_write_cp15(target, 0xee010f10, cp15_control); + retval = arm720t_write_cp15(target, 0xee010f10, cp15_control); + return retval; } -static void arm720t_enable_mmu_caches(struct target *target, +static int arm720t_enable_mmu_caches(struct target *target, int mmu, int d_u_cache, int i_cache) { uint32_t cp15_control; + int retval; /* read cp15 control register */ - arm720t_read_cp15(target, 0xee110f10, &cp15_control); - jtag_execute_queue(); + retval = arm720t_read_cp15(target, 0xee110f10, &cp15_control); + if (retval != ERROR_OK) + return retval; + retval = jtag_execute_queue(); + if (retval != ERROR_OK) + return retval; if (mmu) cp15_control |= 0x1U; @@ -187,16 +198,22 @@ static void arm720t_enable_mmu_caches(struct target *target, if (d_u_cache || i_cache) cp15_control |= 0x4U; - arm720t_write_cp15(target, 0xee010f10, cp15_control); + retval = arm720t_write_cp15(target, 0xee010f10, cp15_control); + return retval; } -static void arm720t_post_debug_entry(struct target *target) +static int arm720t_post_debug_entry(struct target *target) { struct arm720t_common *arm720t = target_to_arm720(target); + int retval; /* examine cp15 control reg */ - arm720t_read_cp15(target, 0xee110f10, &arm720t->cp15_control_reg); - jtag_execute_queue(); + retval = arm720t_read_cp15(target, 0xee110f10, &arm720t->cp15_control_reg); + if (retval != ERROR_OK) + return retval; + retval = jtag_execute_queue(); + if (retval != ERROR_OK) + return retval; LOG_DEBUG("cp15_control_reg: %8.8" PRIx32 "", arm720t->cp15_control_reg); arm720t->armv4_5_mmu.mmu_enabled = (arm720t->cp15_control_reg & 0x1U) ? 1 : 0; @@ -204,9 +221,14 @@ static void arm720t_post_debug_entry(struct target *target) arm720t->armv4_5_mmu.armv4_5_cache.i_cache_enabled = 0; /* save i/d fault status and address register */ - arm720t_read_cp15(target, 0xee150f10, &arm720t->fsr_reg); - arm720t_read_cp15(target, 0xee160f10, &arm720t->far_reg); - jtag_execute_queue(); + retval = arm720t_read_cp15(target, 0xee150f10, &arm720t->fsr_reg); + if (retval != ERROR_OK) + return retval; + retval = arm720t_read_cp15(target, 0xee160f10, &arm720t->far_reg); + if (retval != ERROR_OK) + return retval; + retval = jtag_execute_queue(); + return retval; } static void arm720t_pre_restore_context(struct target *target) @@ -282,12 +304,19 @@ static int arm720t_read_memory(struct target *target, /* disable cache, but leave MMU enabled */ if (arm720t->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled) - arm720t_disable_mmu_caches(target, 0, 1, 0); - + { + retval = arm720t_disable_mmu_caches(target, 0, 1, 0); + if (retval != ERROR_OK) + return retval; + } retval = arm7_9_read_memory(target, address, size, count, buffer); if (arm720t->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled) - arm720t_enable_mmu_caches(target, 0, 1, 0); + { + retval = arm720t_enable_mmu_caches(target, 0, 1, 0); + if (retval != ERROR_OK) + return retval; + } return retval; } @@ -367,7 +396,9 @@ static int arm720t_soft_reset_halt(struct target *target) armv4_5->pc->dirty = 1; armv4_5->pc->valid = 1; - arm720t_disable_mmu_caches(target, 1, 1, 1); + retval = arm720t_disable_mmu_caches(target, 1, 1, 1); + if (retval != ERROR_OK) + return retval; arm720t->armv4_5_mmu.mmu_enabled = 0; arm720t->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled = 0; arm720t->armv4_5_mmu.armv4_5_cache.i_cache_enabled = 0;