mips: mips32_pracc_exec error propagation fixes

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
This commit is contained in:
Øyvind Harboe 2011-03-31 23:46:32 +02:00
parent 83ab5ad240
commit 0c1ebf2673
2 changed files with 21 additions and 29 deletions

View File

@ -446,7 +446,7 @@ static int mips32_pracc_read_mem16(struct mips_ejtag *ejtag_info, uint32_t addr,
uint32_t *param_out = malloc(count * sizeof(uint32_t));
int i;
// int retval;
int retval = ERROR_OK;
int blocksize;
int bytesread;
uint32_t param_in[2];
@ -462,7 +462,7 @@ static int mips32_pracc_read_mem16(struct mips_ejtag *ejtag_info, uint32_t addr,
param_in[0] = addr;
param_in[1] = blocksize;
mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code,
ARRAY_SIZE(param_in), param_in, count, param_out, 1);
// count -= blocksize;
@ -477,7 +477,7 @@ static int mips32_pracc_read_mem16(struct mips_ejtag *ejtag_info, uint32_t addr,
free(param_out);
return ERROR_OK;
return retval;
}
static int mips32_pracc_read_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint8_t *buf)
@ -523,7 +523,7 @@ static int mips32_pracc_read_mem8(struct mips_ejtag *ejtag_info, uint32_t addr,
uint32_t *param_out = malloc(count * sizeof(uint32_t));
int i;
// int retval;
int retval = ERROR_OK;
int blocksize;
int bytesread;
uint32_t param_in[2];
@ -539,7 +539,7 @@ static int mips32_pracc_read_mem8(struct mips_ejtag *ejtag_info, uint32_t addr,
param_in[0] = addr;
param_in[1] = blocksize;
mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code,
ARRAY_SIZE(param_in), param_in, count, param_out, 1);
// count -= blocksize;
@ -554,7 +554,7 @@ static int mips32_pracc_read_mem8(struct mips_ejtag *ejtag_info, uint32_t addr,
free(param_out);
return ERROR_OK;
return retval;
}
int mips32_pracc_write_mem(struct mips_ejtag *ejtag_info, uint32_t addr, int size, int count, void *buf)
@ -616,12 +616,13 @@ static int mips32_pracc_write_mem32(struct mips_ejtag *ejtag_info, uint32_t addr
memcpy(&param_in[2], buf, count * sizeof(uint32_t));
mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
int retval;
retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code,
count + 2, param_in, 0, NULL, 1);
free(param_in);
return ERROR_OK;
return retval;
}
static int mips32_pracc_write_u32(struct mips_ejtag *ejtag_info, uint32_t addr, uint32_t *buf)
@ -650,10 +651,8 @@ static int mips32_pracc_write_u32(struct mips_ejtag *ejtag_info, uint32_t addr,
param_in[0] = addr;
param_in[1] = *buf;
mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
return mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code,
ARRAY_SIZE(param_in), param_in, 0, NULL, 1);
return ERROR_OK;
}
static int mips32_pracc_write_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint16_t *buf)
@ -706,12 +705,13 @@ static int mips32_pracc_write_mem16(struct mips_ejtag *ejtag_info, uint32_t addr
param_in[i + 2] = buf[i];
}
mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
int retval;
retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code,
count + 2, param_in, 0, NULL, 1);
free(param_in);
return ERROR_OK;
return retval;
}
static int mips32_pracc_write_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint8_t *buf)
@ -765,7 +765,7 @@ static int mips32_pracc_write_mem8(struct mips_ejtag *ejtag_info, uint32_t addr,
param_in[i + 2] = buf[i];
}
retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code,
count + 2, param_in, 0, NULL, 1);
free(param_in);
@ -837,7 +837,7 @@ int mips32_pracc_write_regs(struct mips_ejtag *ejtag_info, uint32_t *regs)
int retval;
retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code,
MIPS32NUMCOREREGS, regs, 0, NULL, 1);
return retval;
@ -912,7 +912,7 @@ int mips32_pracc_read_regs(struct mips_ejtag *ejtag_info, uint32_t *regs)
int retval;
retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code,
0, NULL, MIPS32NUMCOREREGS, regs, 1);
return retval;

View File

@ -162,10 +162,8 @@ static int mips_ejtag_step_enable(struct mips_ejtag *ejtag_info)
MIPS32_MFC0(1,31,0), /* move COP0 DeSave to $1 */
};
mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
0, NULL, 0, NULL, 1);
return ERROR_OK;
return mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code,
0, NULL, 0, NULL, 1);
}
static int mips_ejtag_step_disable(struct mips_ejtag *ejtag_info)
@ -187,10 +185,8 @@ static int mips_ejtag_step_disable(struct mips_ejtag *ejtag_info)
MIPS32_MFC0(15,31,0), /* move COP0 DeSave to $15 */
};
mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
return mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code,
0, NULL, 0, NULL, 1);
return ERROR_OK;
}
int mips_ejtag_config_step(struct mips_ejtag *ejtag_info, int enable_step)
@ -228,9 +224,7 @@ int mips_ejtag_exit_debug(struct mips_ejtag *ejtag_info)
inst = MIPS32_DRET;
/* execute our dret instruction */
mips32_pracc_exec(ejtag_info, 1, &inst, 0, NULL, 0, NULL, 0);
return ERROR_OK;
return mips32_pracc_exec(ejtag_info, 1, &inst, 0, NULL, 0, NULL, 0);
}
int mips_ejtag_read_debug(struct mips_ejtag *ejtag_info, uint32_t* debug_reg)
@ -252,10 +246,8 @@ int mips_ejtag_read_debug(struct mips_ejtag *ejtag_info, uint32_t* debug_reg)
MIPS32_MFC0(15,31,0), /* move COP0 DeSave to $15 */
};
mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \
return mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code,
0, NULL, 1, debug_reg, 1);
return ERROR_OK;
}
int mips_ejtag_init(struct mips_ejtag *ejtag_info)