+// SPDX-License-Identifier: GPL-2.0-or-later
+
/*
* MIPS64 generic target support
*
* Based on the work of:
* Copyright (C) 2008 by Spencer Oliver
* Copyright (C) 2008 by David T.L. Wong
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifdef HAVE_CONFIG_H
return ERROR_OK;
}
-static int mips_mips64_soft_reset_halt(struct target *target)
-{
- /* TODO */
- return ERROR_OK;
-}
-
static int mips_mips64_single_step_core(struct target *target)
{
struct mips64_common *mips64 = target->arch_info;
{
int retval;
- if (bp->set) {
+ if (bp->is_set) {
LOG_WARNING("breakpoint already set");
return ERROR_OK;
}
return retval;
}
- bp->set = true;
+ bp->is_set = true;
return ERROR_OK;
}
/* set any pending breakpoints */
while (bp) {
- if (!bp->set) {
+ if (!bp->is_set) {
retval = mips_mips64_set_breakpoint(target, bp);
if (retval != ERROR_OK)
return retval;
* and exclude both load and store accesses from watchpoint
* condition evaluation
*/
- int enable = EJTAG_DBCn_NOSB | EJTAG_DBCn_NOLB | EJTAG_DBCn_BE
- | (0xff << EJTAG_DBCn_BLM_SHIFT);
+ int enable = EJTAG_DBCN_NOSB | EJTAG_DBCN_NOLB | EJTAG_DBCN_BE
+ | (0xff << EJTAG_DBCN_BLM_SHIFT);
- if (watchpoint->set) {
+ if (watchpoint->is_set) {
LOG_WARNING("watchpoint already set");
return ERROR_OK;
}
switch (watchpoint->rw) {
case WPT_READ:
- enable &= ~EJTAG_DBCn_NOLB;
+ enable &= ~EJTAG_DBCN_NOLB;
break;
case WPT_WRITE:
- enable &= ~EJTAG_DBCn_NOSB;
+ enable &= ~EJTAG_DBCN_NOSB;
break;
case WPT_ACCESS:
- enable &= ~(EJTAG_DBCn_NOLB | EJTAG_DBCn_NOSB);
+ enable &= ~(EJTAG_DBCN_NOLB | EJTAG_DBCN_NOSB);
break;
default:
LOG_ERROR("BUG: watchpoint->rw neither read, write nor access");
}
c = &cl[wp_num];
- watchpoint->set = wp_num + 1;
+ watchpoint_set(watchpoint, wp_num);
c->used = true;
c->bp_value = watchpoint->address;
/* set any pending watchpoints */
while (watchpoint) {
- if (watchpoint->set == 0) {
+ if (!watchpoint->is_set) {
retval = mips_mips64_set_watchpoint(target, watchpoint);
if (retval != ERROR_OK)
return retval;
{
struct mips64_common *mips64 = target->arch_info;
struct mips64_comparator *comparator_list = mips64->inst_break_list;
- int bp_num;
- bp_num = bp->set - 1;
+ int bp_num = bp->number;
- if ((bp_num < 0) || (bp_num >= mips64->num_inst_bpoints)) {
+ if (bp_num >= mips64->num_inst_bpoints) {
LOG_DEBUG("Invalid FP Comparator number in breakpoint (bpid: %" PRIu32 ")",
bp->unique_id);
return ERROR_OK;
/* get pointers to arch-specific information */
int retval;
- if (!bp->set) {
+ if (!bp->is_set) {
LOG_WARNING("breakpoint not set");
return ERROR_OK;
}
return retval;
}
- bp->set = false;
+ bp->is_set = false;
return ERROR_OK;
}
return ERROR_TARGET_NOT_HALTED;
}
- if (bp->set)
+ if (bp->is_set)
retval = mips_mips64_unset_breakpoint(target, bp);
if (bp->type == BKPT_HARD)
struct mips64_common *mips64 = target->arch_info;
struct mips64_comparator *comparator_list = mips64->data_break_list;
- if (!watchpoint->set) {
+ if (!watchpoint->is_set) {
LOG_WARNING("watchpoint not set");
return ERROR_OK;
}
- int wp_num = watchpoint->set - 1;
- if ((wp_num < 0) || (wp_num >= mips64->num_data_bpoints)) {
+ int wp_num = watchpoint->number;
+ if (wp_num >= mips64->num_data_bpoints) {
LOG_DEBUG("Invalid FP Comparator number in watchpoint");
return ERROR_OK;
}
comparator_list[wp_num].used = false;
comparator_list[wp_num].bp_value = 0;
target_write_u64(target, comparator_list[wp_num].reg_address + 0x18, 0);
- watchpoint->set = 0;
+ watchpoint->is_set = false;
return ERROR_OK;
}
return ERROR_TARGET_NOT_HALTED;
}
- if (watchpoint->set)
+ if (watchpoint->is_set)
retval = mips_mips64_unset_watchpoint(target, watchpoint);
mips64->num_data_bpoints_avail++;
retval = mips64_pracc_read_mem(ejtag_info, address, size, count,
(void *)t);
- if (ERROR_OK != retval) {
+ if (retval != ERROR_OK) {
LOG_ERROR("mips64_pracc_read_mem filed");
goto read_done;
}
.assert_reset = mips_mips64_assert_reset,
.deassert_reset = mips_mips64_deassert_reset,
- .soft_reset_halt = mips_mips64_soft_reset_halt,
+ /* TODO: add .soft_reset_halt */
.get_gdb_reg_list = mips64_get_gdb_reg_list,