OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | dm013_info_t |
struct | riscv013_info_t |
struct | scratch_mem_t |
struct | target_list_t |
struct | trigger |
Macros | |
#define | CMDERR_BUSY 1 |
#define | CMDERR_EXCEPTION 3 |
#define | CMDERR_HALT_RESUME 4 |
#define | CMDERR_NONE 0 |
#define | CMDERR_NOT_SUPPORTED 2 |
#define | CMDERR_OTHER 7 |
#define | CSR_DCSR_CAUSE_DEBUGINT 3 |
#define | CSR_DCSR_CAUSE_GROUP 6 |
#define | CSR_DCSR_CAUSE_HALT 5 |
#define | CSR_DCSR_CAUSE_STEP 4 |
#define | CSR_DCSR_CAUSE_SWBP 1 |
#define | CSR_DCSR_CAUSE_TRIGGER 2 |
#define | get_field(reg, mask) (((reg) & (mask)) / ((mask) & ~((mask) << 1))) |
Since almost everything can be accomplish by scanning the dbus register, all functions here assume dbus is already selected. More... | |
#define | RISCV013_INFO(r) riscv013_info_t *r = get_info(target) |
#define | set_field(reg, mask, val) (((reg) & ~(mask)) | (((val) * ((mask) & ~((mask) << 1))) & (mask))) |
Typedefs | |
typedef enum slot | slot_t |
Enumerations | |
enum | dmi_op_t { DMI_OP_NOP = 0 , DMI_OP_READ = 1 , DMI_OP_WRITE = 2 } |
enum | dmi_status_t { DMI_STATUS_SUCCESS = 0 , DMI_STATUS_FAILED = 2 , DMI_STATUS_BUSY = 3 } |
enum | memory_space_t { SPACE_DM_DATA , SPACE_DMI_PROGBUF , SPACE_DMI_RAM } |
enum | slot { SLOT0 , SLOT1 , SLOT_LAST , SLOT0 , SLOT1 , SLOT_LAST , SLOT0 , SLOT1 , SLOT_LAST } |
enum | yes_no_maybe_t { YNM_MAYBE , YNM_YES , YNM_NO } |
Functions | |
static uint32_t | __attribute__ ((unused)) |
static uint32_t | abstract_memory_size (unsigned width) |
static uint32_t | access_memory_command (struct target *target, bool virtual, unsigned width, bool postincrement, bool write) |
static uint32_t | access_register_command (struct target *target, uint32_t number, unsigned size, uint32_t flags) |
static int | arch_state (struct target *target) |
static int | assert_reset (struct target *target) |
static int | batch_run (const struct target *target, struct riscv_batch *batch) |
static int | cleanup_after_register_access (struct target *target, uint64_t mstatus, int regno) |
static int | cleanup_after_vector_access (struct target *target, uint64_t vtype, uint64_t vl) |
static | COMMAND_HELPER (riscv013_print_info, struct target *target) |
static int | deassert_reset (struct target *target) |
static void | decode_dmi (char *text, unsigned address, unsigned data) |
static void | deinit_target (struct target *target) |
static int | discover_vlenb (struct target *target) |
static int | dmi_op (struct target *target, uint32_t *data_in, bool *dmi_busy_encountered, int dmi_op, uint32_t address, uint32_t data_out, bool exec, bool ensure_success) |
static int | dmi_op_timeout (struct target *target, uint32_t *data_in, bool *dmi_busy_encountered, int dmi_op, uint32_t address, uint32_t data_out, int timeout_sec, bool exec, bool ensure_success) |
static int | dmi_read (struct target *target, uint32_t *value, uint32_t address) |
static int | dmi_read_exec (struct target *target, uint32_t *value, uint32_t address) |
static dmi_status_t | dmi_scan (struct target *target, uint32_t *address_in, uint32_t *data_in, dmi_op_t op, uint32_t address_out, uint32_t data_out, bool exec) |
exec: If this is set, assume the scan results in an execution, so more run-test/idle cycles may be required. More... | |
static int | dmi_write (struct target *target, uint32_t address, uint32_t value) |
static int | dmi_write_exec (struct target *target, uint32_t address, uint32_t value, bool ensure_success) |
static int | dmstatus_read (struct target *target, uint32_t *dmstatus, bool authenticated) |
static int | dmstatus_read_timeout (struct target *target, uint32_t *dmstatus, bool authenticated, unsigned timeout_sec) |
static uint32_t | dtmcontrol_scan (struct target *target, uint32_t out) |
static void | dump_field (int idle, const struct scan_field *field) |
static int | examine (struct target *target) |
static int | examine_progbuf (struct target *target) |
static int | execute_abstract_command (struct target *target, uint32_t command) |
static int | execute_fence (struct target *target) |
static dm013_info_t * | get_dm (struct target *target) |
Return the DM structure for this target. More... | |
static riscv013_info_t * | get_info (const struct target *target) |
static bool | has_sufficient_progbuf (struct target *target, unsigned size) |
static void | increase_ac_busy_delay (struct target *target) |
static void | increase_dmi_busy_delay (struct target *target) |
static int | init_target (struct command_context *cmd_ctx, struct target *target) |
static int | is_fpu_reg (uint32_t gdb_regno) |
static int | is_vector_reg (uint32_t gdb_regno) |
static | LIST_HEAD (dm_list) |
static void | log_mem_access_result (struct target *target, bool success, int method, bool read) |
static void | log_memory_access (target_addr_t address, uint64_t value, unsigned size_bytes, bool read) |
static int | maybe_execute_fence_i (struct target *target) |
static bool | mem_should_skip_abstract (struct target *target, target_addr_t address, uint32_t size, uint32_t increment, bool read, char **skip_reason) |
static bool | mem_should_skip_progbuf (struct target *target, target_addr_t address, uint32_t size, bool read, char **skip_reason) |
static bool | mem_should_skip_sysbus (struct target *target, target_addr_t address, uint32_t size, uint32_t increment, bool read, char **skip_reason) |
static int | modify_privilege (struct target *target, uint64_t *mstatus, uint64_t *mstatus_old) |
static int | prep_for_register_access (struct target *target, uint64_t *mstatus, int regno) |
static int | prep_for_vector_access (struct target *target, uint64_t *vtype, uint64_t *vl, unsigned *debug_vl) |
static riscv_reg_t | read_abstract_arg (struct target *target, unsigned index, unsigned size_bits) |
static int | read_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer, uint32_t increment) |
static int | read_memory_abstract (struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer, uint32_t increment) |
static int | read_memory_bus_v0 (struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer, uint32_t increment) |
static int | read_memory_bus_v1 (struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer, uint32_t increment) |
Read the requested memory using the system bus interface. More... | |
static int | read_memory_bus_word (struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer) |
static int | read_memory_progbuf (struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer, uint32_t increment) |
Read the requested memory, silently handling memory access errors. More... | |
static int | read_memory_progbuf_inner (struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer, uint32_t increment) |
Read the requested memory, taking care to execute every read exactly once, even if cmderr=busy is encountered. More... | |
static int | read_memory_progbuf_one (struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer) |
static int | read_sbcs_nonbusy (struct target *target, uint32_t *sbcs) |
static int | register_read (struct target *target, uint64_t *value, uint32_t number) |
Read register value from the target. More... | |
static int | register_read_abstract (struct target *target, uint64_t *value, uint32_t number, unsigned size) |
static int | register_read_direct (struct target *target, uint64_t *value, uint32_t number) |
Actually read registers from the target right now. More... | |
static unsigned | register_size (struct target *target, unsigned number) |
Return register size in bits. More... | |
static int | register_write_abstract (struct target *target, uint32_t number, uint64_t value, unsigned size) |
static int | register_write_direct (struct target *target, unsigned number, uint64_t value) |
Immediately write the new value to the requested register. More... | |
static int | riscv013_authdata_read (struct target *target, uint32_t *value, unsigned int index) |
static int | riscv013_authdata_write (struct target *target, uint32_t value, unsigned int index) |
static void | riscv013_clear_abstract_error (struct target *target) |
static unsigned | riscv013_data_bits (struct target *target) |
static int | riscv013_dmi_write_u64_bits (struct target *target) |
static int | riscv013_execute_debug_buffer (struct target *target) |
static void | riscv013_fill_dmi_nop_u64 (struct target *target, char *buf) |
static void | riscv013_fill_dmi_read_u64 (struct target *target, char *buf, int a) |
static void | riscv013_fill_dmi_write_u64 (struct target *target, char *buf, int a, uint64_t d) |
static int | riscv013_get_register (struct target *target, riscv_reg_t *value, int rid) |
static int | riscv013_get_register_buf (struct target *target, uint8_t *value, int regno) |
static int | riscv013_halt_go (struct target *target) |
static int | riscv013_halt_prep (struct target *target) |
static enum riscv_halt_reason | riscv013_halt_reason (struct target *target) |
static int | riscv013_hart_count (struct target *target) |
static bool | riscv013_is_halted (struct target *target) |
static int | riscv013_on_halt (struct target *target) |
static int | riscv013_on_step (struct target *target) |
static int | riscv013_on_step_or_resume (struct target *target, bool step) |
static riscv_insn_t | riscv013_read_debug_buffer (struct target *target, unsigned index) |
static int | riscv013_resume_go (struct target *target) |
static int | riscv013_resume_prep (struct target *target) |
static int | riscv013_select_current_hart (struct target *target) |
static int | riscv013_set_register (struct target *target, int regid, uint64_t value) |
static int | riscv013_set_register_buf (struct target *target, int regno, const uint8_t *value) |
static int | riscv013_step_current_hart (struct target *target) |
static int | riscv013_step_or_resume_current_hart (struct target *target, bool step, bool use_hasel) |
static int | riscv013_write_debug_buffer (struct target *target, unsigned index, riscv_insn_t d) |
static int | sample_memory (struct target *target, struct riscv_sample_buf *buf, riscv_sample_config_t *config, int64_t until_ms) |
static int | sample_memory_bus_v1 (struct target *target, struct riscv_sample_buf *buf, const riscv_sample_config_t *config, int64_t until_ms) |
static target_addr_t | sb_read_address (struct target *target) |
static uint32_t | sb_sbaccess (unsigned int size_bytes) |
static int | sb_write_address (struct target *target, target_addr_t address, bool ensure_success) |
static int | sba_supports_access (struct target *target, unsigned int size_bytes) |
static int | scratch_read64 (struct target *target, scratch_mem_t *scratch, uint64_t *value) |
static int | scratch_release (struct target *target, scratch_mem_t *scratch) |
static int | scratch_reserve (struct target *target, scratch_mem_t *scratch, struct riscv_program *program, unsigned size_bytes) |
Find some scratch memory to be used with the given program. More... | |
static int | scratch_write64 (struct target *target, scratch_mem_t *scratch, uint64_t value) |
static void | select_dmi (struct target *target) |
static int | select_prepped_harts (struct target *target, bool *use_hasel) |
static int | set_haltgroup (struct target *target, bool *supported) |
static uint32_t | set_hartsel (uint32_t initial, uint32_t index) |
static int | wait_for_authbusy (struct target *target, uint32_t *dmstatus) |
static int | wait_for_idle (struct target *target, uint32_t *abstractcs) |
static int | write_abstract_arg (struct target *target, unsigned index, riscv_reg_t value, unsigned size_bits) |
static int | write_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer) |
static int | write_memory_abstract (struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer) |
static int | write_memory_bus_v0 (struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer) |
static int | write_memory_bus_v1 (struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer) |
static int | write_memory_progbuf (struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer) |
Variables | |
struct target_type | riscv013_target |
#define CMDERR_BUSY 1 |
Definition at line 110 of file riscv-013.c.
#define CMDERR_EXCEPTION 3 |
Definition at line 112 of file riscv-013.c.
#define CMDERR_HALT_RESUME 4 |
Definition at line 113 of file riscv-013.c.
#define CMDERR_NONE 0 |
Definition at line 109 of file riscv-013.c.
#define CMDERR_NOT_SUPPORTED 2 |
Definition at line 111 of file riscv-013.c.
#define CMDERR_OTHER 7 |
Definition at line 114 of file riscv-013.c.
#define CSR_DCSR_CAUSE_DEBUGINT 3 |
Definition at line 81 of file riscv-013.c.
#define CSR_DCSR_CAUSE_GROUP 6 |
Definition at line 84 of file riscv-013.c.
#define CSR_DCSR_CAUSE_HALT 5 |
Definition at line 83 of file riscv-013.c.
#define CSR_DCSR_CAUSE_STEP 4 |
Definition at line 82 of file riscv-013.c.
#define CSR_DCSR_CAUSE_SWBP 1 |
Definition at line 79 of file riscv-013.c.
#define CSR_DCSR_CAUSE_TRIGGER 2 |
Definition at line 80 of file riscv-013.c.
Since almost everything can be accomplish by scanning the dbus register, all functions here assume dbus is already selected.
The exception are functions called directly by OpenOCD, which can't assume anything about what's currently in IR. They should set IR to dbus explicitly.
Definition at line 76 of file riscv-013.c.
#define RISCV013_INFO | ( | r | ) | riscv013_info_t *r = get_info(target) |
Definition at line 86 of file riscv-013.c.
#define set_field | ( | reg, | |
mask, | |||
val | |||
) | (((reg) & ~(mask)) | (((val) * ((mask) & ~((mask) << 1))) & (mask))) |
Definition at line 77 of file riscv-013.c.
enum dmi_op_t |
Enumerator | |
---|---|
DMI_OP_NOP | |
DMI_OP_READ | |
DMI_OP_WRITE |
Definition at line 90 of file riscv-013.c.
enum dmi_status_t |
Enumerator | |
---|---|
DMI_STATUS_SUCCESS | |
DMI_STATUS_FAILED | |
DMI_STATUS_BUSY |
Definition at line 95 of file riscv-013.c.
enum memory_space_t |
Enumerator | |
---|---|
SPACE_DM_DATA | |
SPACE_DMI_PROGBUF | |
SPACE_DMI_RAM |
Definition at line 1115 of file riscv-013.c.
enum slot |
Enumerator | |
---|---|
SLOT0 | |
SLOT1 | |
SLOT_LAST | |
SLOT0 | |
SLOT1 | |
SLOT_LAST | |
SLOT0 | |
SLOT1 | |
SLOT_LAST |
Definition at line 101 of file riscv-013.c.
enum yes_no_maybe_t |
Enumerator | |
---|---|
YNM_MAYBE | |
YNM_YES | |
YNM_NO |
Definition at line 127 of file riscv-013.c.
|
staticpure virtual |
Definition at line 720 of file riscv-013.c.
References AC_ACCESS_REGISTER_AARSIZE, LOG_ERROR, set_field, and width.
|
static |
Definition at line 971 of file riscv-013.c.
References AC_ACCESS_MEMORY_AAMSIZE, LOG_ERROR, set_field, and width.
Referenced by access_memory_command().
|
static |
Definition at line 993 of file riscv-013.c.
References abstract_memory_size(), AC_ACCESS_MEMORY_AAMPOSTINCREMENT, AC_ACCESS_MEMORY_AAMVIRTUAL, AC_ACCESS_MEMORY_CMDTYPE, AC_ACCESS_MEMORY_WRITE, set_field, and width.
Referenced by read_memory_abstract(), and write_memory_abstract().
|
static |
Definition at line 851 of file riscv-013.c.
References AC_ACCESS_REGISTER_AARSIZE, AC_ACCESS_REGISTER_REGNO, reg::arch_info, riscv_reg_info_t::custom_number, DM_COMMAND_CMDTYPE, GDB_REGNO_COUNT, GDB_REGNO_CSR0, GDB_REGNO_CSR4095, GDB_REGNO_FPR0, GDB_REGNO_FPR31, gdb_regno_name(), GDB_REGNO_XPR31, GDB_REGNO_ZERO, LOG_ERROR, number, target::reg_cache, reg_cache::reg_list, set_field, and size.
Referenced by read_memory_progbuf_inner(), read_memory_progbuf_one(), register_read_abstract(), register_write_abstract(), and write_memory_progbuf().
|
static |
Definition at line 4042 of file riscv-013.c.
References ERROR_OK.
|
static |
Definition at line 2339 of file riscv-013.c.
References target::coreid, DM_DMCONTROL, DM_DMCONTROL_DMACTIVE, DM_DMCONTROL_HALTREQ, DM_DMCONTROL_NDMRESET, dmi_write(), ERROR_FAIL, ERROR_OK, get_dm(), dm013_info_t::progbuf_cache, target::reset_halt, RISCV_INFO, target::rtos, select_dmi(), set_field, set_hartsel(), target::state, TARGET_EVENT_RESET_ASSERT, target_handle_event(), target_has_event_action(), and TARGET_RESET.
|
static |
Definition at line 2092 of file riscv-013.c.
References riscv_batch::idle_count, info, RISCV013_INFO, riscv_batch_run(), RISCV_INFO, and riscv_batch::used_scans.
Referenced by read_memory_progbuf_inner(), sample_memory_bus_v1(), write_memory_bus_v1(), and write_memory_progbuf().
|
static |
Definition at line 1105 of file riscv-013.c.
References ERROR_FAIL, ERROR_OK, GDB_REGNO_MSTATUS, is_fpu_reg(), is_vector_reg(), MSTATUS_FS, MSTATUS_VS, and register_write_direct().
Referenced by register_read_direct(), register_write_direct(), riscv013_get_register_buf(), and riscv013_set_register_buf().
|
static |
Definition at line 1940 of file riscv-013.c.
References ERROR_FAIL, ERROR_OK, GDB_REGNO_VL, GDB_REGNO_VTYPE, and register_write_direct().
Referenced by riscv013_get_register_buf(), and riscv013_set_register_buf().
|
static |
Definition at line 1872 of file riscv-013.c.
References CMD, DM_DMSTATUS_AUTHENTICATED, DM_SBCS_SBACCESS128, DM_SBCS_SBACCESS16, DM_SBCS_SBACCESS32, DM_SBCS_SBACCESS64, DM_SBCS_SBACCESS8, DM_SBCS_SBASIZE, DM_SBCS_SBVERSION, dmstatus_read(), ERROR_OK, get_field, info, and RISCV013_INFO.
|
static |
Definition at line 2389 of file riscv-013.c.
References target::coreid, DM_DMCONTROL, DM_DMCONTROL_ACKHAVERESET, DM_DMCONTROL_DMACTIVE, DM_DMCONTROL_HALTREQ, DM_DMSTATUS_ALLHAVERESET, DM_DMSTATUS_ALLUNAVAIL, dmi_write(), dmstatus_read_timeout(), ERROR_FAIL, ERROR_OK, ERROR_TIMEOUT_REACHED, get_field, info, LOG_DEBUG, LOG_ERROR, NULL, target::reset_halt, RISCV013_INFO, riscv_count_harts(), RISCV_INFO, riscv_reset_timeout_sec, target::rtos, select_dmi(), set_field, set_hartsel(), start, target::state, and TARGET_HALTED.
|
static |
Definition at line 293 of file riscv-013.c.
References ARRAY_SIZE, description, DM_ABSTRACTCS, DM_ABSTRACTCS_BUSY, DM_ABSTRACTCS_CMDERR, DM_ABSTRACTCS_DATACOUNT, DM_ABSTRACTCS_PROGBUFSIZE, DM_COMMAND, DM_COMMAND_CMDTYPE, DM_DMCONTROL, DM_DMCONTROL_ACKHAVERESET, DM_DMCONTROL_DMACTIVE, DM_DMCONTROL_HALTREQ, DM_DMCONTROL_HARTRESET, DM_DMCONTROL_HARTSELHI, DM_DMCONTROL_HARTSELLO, DM_DMCONTROL_HASEL, DM_DMCONTROL_NDMRESET, DM_DMCONTROL_RESUMEREQ, DM_DMSTATUS, DM_DMSTATUS_ALLHALTED, DM_DMSTATUS_ALLHAVERESET, DM_DMSTATUS_ALLNONEXISTENT, DM_DMSTATUS_ALLRESUMEACK, DM_DMSTATUS_ALLRUNNING, DM_DMSTATUS_ALLUNAVAIL, DM_DMSTATUS_ANYHALTED, DM_DMSTATUS_ANYHAVERESET, DM_DMSTATUS_ANYNONEXISTENT, DM_DMSTATUS_ANYRESUMEACK, DM_DMSTATUS_ANYRUNNING, DM_DMSTATUS_ANYUNAVAIL, DM_DMSTATUS_AUTHBUSY, DM_DMSTATUS_AUTHENTICATED, DM_DMSTATUS_CONFSTRPTRVALID, DM_DMSTATUS_HASRESETHALTREQ, DM_DMSTATUS_IMPEBREAK, DM_DMSTATUS_VERSION, DM_SBCS, DM_SBCS_SBACCESS, DM_SBCS_SBACCESS128, DM_SBCS_SBACCESS16, DM_SBCS_SBACCESS32, DM_SBCS_SBACCESS64, DM_SBCS_SBACCESS8, DM_SBCS_SBASIZE, DM_SBCS_SBAUTOINCREMENT, DM_SBCS_SBBUSY, DM_SBCS_SBBUSYERROR, DM_SBCS_SBERROR, DM_SBCS_SBREADONADDR, DM_SBCS_SBREADONDATA, DM_SBCS_SBVERSION, get_field, mask, and name.
Referenced by dump_field().
|
static |
Definition at line 1520 of file riscv-013.c.
References target::arch_info, info, LOG_DEBUG, and NULL.
|
static |
Definition at line 1544 of file riscv-013.c.
References ERROR_OK, GDB_REGNO_VLENB, LOG_INFO, LOG_WARNING, register_read(), RISCV_INFO, target_name(), and riscv_info::vlenb.
Referenced by examine().
|
static |
Definition at line 645 of file riscv-013.c.
References dmi_op_timeout(), ERROR_FAIL, ERROR_TIMEOUT_REACHED, LOG_ERROR, and riscv_command_timeout_sec.
Referenced by dmi_op_timeout(), dmi_read(), dmi_read_exec(), dmi_write(), dmi_write_exec(), read_memory_bus_word(), sb_write_address(), write_memory_bus_v1(), and write_memory_progbuf().
|
static |
target | |
data_in | The data we received from the target. |
dmi_busy_encountered | If non-NULL, will be updated to reflect whether DMI busy was encountered while executing this operation or not. |
dmi_op | The operation to perform (read/write/nop). |
address | The address argument to that operation. |
data_out | The data to send to the target. |
timeout_sec | |
exec | When true, this scan will execute something, so extra RTI cycles may be added. |
ensure_success | Scan a nop after the requested operation, ensuring the DMI operation succeeded. |
Definition at line 557 of file riscv-013.c.
References dmi_op(), DMI_OP_NOP, DMI_OP_READ, DMI_OP_WRITE, dmi_scan(), DMI_STATUS_BUSY, DMI_STATUS_SUCCESS, DTM_DTMCS_DMIRESET, dtmcontrol_scan(), ERROR_FAIL, ERROR_OK, ERROR_TIMEOUT_REACHED, increase_dmi_busy_delay(), keep_alive(), LOG_ERROR, NULL, select_dmi(), start, and status.
Referenced by dmi_op(), and dmstatus_read_timeout().
|
static |
Definition at line 661 of file riscv-013.c.
References dmi_op(), DMI_OP_READ, and NULL.
Referenced by examine(), examine_progbuf(), init_target(), read_abstract_arg(), read_memory_bus_v0(), read_memory_progbuf_inner(), read_sbcs_nonbusy(), riscv013_authdata_read(), riscv013_clear_abstract_error(), riscv013_halt_go(), riscv013_read_debug_buffer(), riscv013_select_current_hart(), sb_read_address(), scratch_read64(), set_haltgroup(), wait_for_idle(), write_memory_bus_v1(), and write_memory_progbuf().
|
static |
Definition at line 666 of file riscv-013.c.
References dmi_op(), DMI_OP_READ, and NULL.
Referenced by read_memory_progbuf_inner().
|
static |
exec: If this is set, assume the scan results in an execution, so more run-test/idle cycles may be required.
Definition at line 465 of file riscv-013.c.
References bscan_tunnel_ir_width, buf_get_u32(), buf_set_u32(), buffer_shr(), DMI_STATUS_FAILED, DTM_DMI_ADDRESS_OFFSET, DTM_DMI_DATA_LENGTH, DTM_DMI_DATA_OFFSET, DTM_DMI_OP_LENGTH, DTM_DMI_OP_OFFSET, dump_field(), ERROR_OK, get_info(), info, jtag_add_dr_scan(), jtag_add_runtest(), jtag_execute_queue(), LOG_ERROR, scan_field::num_bits, op, riscv_add_bscan_tunneled_scan(), RISCV_INFO, target::tap, and TAP_IDLE.
Referenced by dmi_op_timeout(), and read_memory_bus_v1().
|
static |
Definition at line 671 of file riscv-013.c.
References dmi_op(), DMI_OP_WRITE, and NULL.
Referenced by assert_reset(), deassert_reset(), examine(), execute_abstract_command(), init_target(), read_memory_bus_v0(), read_memory_bus_v1(), read_memory_progbuf_inner(), riscv013_authdata_write(), riscv013_clear_abstract_error(), riscv013_halt_go(), riscv013_halt_reason(), riscv013_select_current_hart(), riscv013_step_or_resume_current_hart(), riscv013_write_debug_buffer(), sample_memory_bus_v1(), scratch_write64(), select_prepped_harts(), set_haltgroup(), write_abstract_arg(), write_memory_bus_v0(), write_memory_bus_v1(), and write_memory_progbuf().
|
static |
Definition at line 676 of file riscv-013.c.
References dmi_op(), DMI_OP_WRITE, and NULL.
Referenced by execute_abstract_command(), and read_memory_progbuf_inner().
|
static |
Definition at line 704 of file riscv-013.c.
References dmstatus_read_timeout(), and riscv_command_timeout_sec.
Referenced by COMMAND_HELPER(), examine(), riscv013_halt_go(), riscv013_halt_reason(), riscv013_step_or_resume_current_hart(), and wait_for_authbusy().
|
static |
Definition at line 682 of file riscv-013.c.
References DM_DMSTATUS, DM_DMSTATUS_AUTHENTICATED, DM_DMSTATUS_VERSION, DMI_OP_READ, dmi_op_timeout(), ERROR_FAIL, ERROR_OK, get_field, LOG_ERROR, and NULL.
Referenced by deassert_reset(), and dmstatus_read().
|
static |
Definition at line 417 of file riscv-013.c.
References bscan_tunnel_ir_width, buf_get_u32(), buf_set_u32(), dtmcontrol_scan_via_bscan(), ERROR_OK, scan_field::in_value, jtag_add_dr_scan(), jtag_add_ir_scan(), jtag_execute_queue(), LOG_DEBUG, LOG_ERROR, scan_field::num_bits, scan_field::out_value, select_dmi(), select_dtmcontrol, target::tap, and TAP_IDLE.
Referenced by dmi_op_timeout(), examine(), and increase_dmi_busy_delay().
|
static |
Definition at line 372 of file riscv-013.c.
References buf_get_u64(), debug_level, decode_dmi(), DTM_DMI_ADDRESS_OFFSET, DTM_DMI_DATA, DTM_DMI_OP, get_field, scan_field::in_value, LOG_LVL_DEBUG, log_printf_lf(), scan_field::num_bits, and scan_field::out_value.
Referenced by dmi_scan().
|
static |
Definition at line 1562 of file riscv-013.c.
References target::coreid, discover_vlenb(), DM_ABSTRACTCS, DM_ABSTRACTCS_DATACOUNT, DM_ABSTRACTCS_PROGBUFSIZE, DM_DMCONTROL, DM_DMCONTROL_ACKHAVERESET, DM_DMCONTROL_DMACTIVE, DM_DMCONTROL_HARTSELHI, DM_DMCONTROL_HARTSELLO, DM_DMCONTROL_HARTSELLO_LENGTH, DM_DMCONTROL_HASEL, DM_DMSTATUS_ANYHAVERESET, DM_DMSTATUS_ANYNONEXISTENT, DM_DMSTATUS_AUTHENTICATED, DM_DMSTATUS_IMPEBREAK, DM_DMSTATUS_VERSION, DM_HARTINFO, DM_HARTINFO_DATAACCESS, DM_HARTINFO_DATAADDR, DM_HARTINFO_DATASIZE, DM_SBCS, dmi_read(), dmi_write(), dmstatus_read(), DTM_DTMCS_ABITS, DTM_DTMCS_DMIRESET, DTM_DTMCS_DMISTAT, DTM_DTMCS_IDLE, DTM_DTMCS_VERSION, dtmcontrol_scan(), ERROR_FAIL, ERROR_OK, GDB_REGNO_MISA, GDB_REGNO_S0, get_dm(), get_field, get_info(), halted(), dm013_info_t::hart_count, has_sufficient_progbuf(), dm013_info_t::hasel_supported, info, LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING, MIN, NULL, register_read(), register_read_abstract(), riscv013_halt_go(), riscv013_select_current_hart(), riscv013_step_or_resume_current_hart(), riscv_count_harts(), riscv_enable_virtual, RISCV_INFO, riscv_init_registers(), riscv_is_halted(), RISCV_MAX_HARTS, riscv_supports_extension(), set_haltgroup(), set_hartsel(), target::smp, target_set_examined(), and dm013_info_t::was_reset.
Referenced by riscv013_authdata_write().
|
static |
Definition at line 1006 of file riscv-013.c.
References auipc(), DM_PROGBUF0, dmi_read(), ERROR_FAIL, ERROR_OK, GDB_REGNO_S0, get_info(), info, LOG_INFO, register_read(), register_read_direct(), register_write_direct(), riscv_program_exec(), riscv_program_init(), riscv_program_insert(), s0, S0, sw(), YNM_MAYBE, YNM_NO, and YNM_YES.
Referenced by scratch_reserve().
|
static |
Definition at line 772 of file riscv-013.c.
References AC_ACCESS_REGISTER_AARSIZE, AC_ACCESS_REGISTER_POSTEXEC, AC_ACCESS_REGISTER_REGNO, AC_ACCESS_REGISTER_TRANSFER, AC_ACCESS_REGISTER_WRITE, debug_level, DM_ABSTRACTCS, DM_ABSTRACTCS_CMDERR, DM_COMMAND, DM_COMMAND_CMDTYPE, dmi_write(), dmi_write_exec(), ERROR_FAIL, ERROR_OK, get_field, info, LOG_DEBUG, LOG_LVL_DEBUG, RISCV013_INFO, and wait_for_idle().
Referenced by read_memory_abstract(), read_memory_progbuf_inner(), read_memory_progbuf_one(), register_read_abstract(), register_write_abstract(), riscv013_execute_debug_buffer(), write_memory_abstract(), and write_memory_progbuf().
|
static |
Definition at line 2461 of file riscv-013.c.
References ERROR_OK, LOG_DEBUG, riscv_program_exec(), riscv_program_fence(), riscv_program_fence_i(), and riscv_program_init().
Referenced by maybe_execute_fence_i(), read_memory_progbuf(), and write_memory_progbuf().
|
static |
Return the DM structure for this target.
If there isn't one, find it in the global list of DMs. If it's not in there, then create one and initialize it to 0.
Definition at line 233 of file riscv-013.c.
References jtag_tap::abs_chain_position, dm013_info_t::abs_chain_position, target::coreid, dm013_info_t::current_hartid, dm013_info_t::hart_count, info, INIT_LIST_HEAD(), dm013_info_t::list, target_list_t::list, list_add(), list_for_each_entry, LOG_DEBUG, NULL, RISCV013_INFO, target::tap, target, target_list_t::target, and dm013_info_t::target_list.
Referenced by assert_reset(), examine(), riscv013_authdata_write(), riscv013_halt_go(), riscv013_hart_count(), riscv013_select_current_hart(), riscv013_write_debug_buffer(), and select_prepped_harts().
|
static |
Definition at line 220 of file riscv-013.c.
References target::arch_info, and info.
Referenced by dmi_scan(), examine(), examine_progbuf(), increase_ac_busy_delay(), increase_dmi_busy_delay(), init_target(), scratch_reserve(), and select_prepped_harts().
|
static |
Definition at line 1284 of file riscv-013.c.
References info, RISCV013_INFO, RISCV_INFO, and size.
Referenced by examine(), maybe_execute_fence_i(), mem_should_skip_progbuf(), modify_privilege(), read_memory_progbuf(), read_memory_progbuf_one(), register_read_direct(), register_write_direct(), riscv013_data_bits(), and write_memory_progbuf().
|
static |
Definition at line 711 of file riscv-013.c.
References get_info(), info, and LOG_DEBUG.
Referenced by read_memory_progbuf_inner(), and write_memory_progbuf().
|
static |
Definition at line 450 of file riscv-013.c.
References DTM_DTMCS_DMIRESET, dtmcontrol_scan(), get_info(), info, and LOG_DEBUG.
Referenced by dmi_op_timeout(), and read_memory_bus_v1().
|
static |
Definition at line 2274 of file riscv-013.c.
References dmi_read(), dmi_write(), ERROR_FAIL, ERROR_OK, get_info(), info, LOG_DEBUG, read_memory(), riscv013_authdata_read(), riscv013_authdata_write(), riscv013_data_bits(), riscv013_dmi_write_u64_bits(), riscv013_execute_debug_buffer(), riscv013_fill_dmi_nop_u64(), riscv013_fill_dmi_read_u64(), riscv013_fill_dmi_write_u64(), riscv013_get_register(), riscv013_get_register_buf(), riscv013_halt_go(), riscv013_halt_prep(), riscv013_halt_reason(), riscv013_hart_count(), riscv013_is_halted(), riscv013_on_halt(), riscv013_on_step(), riscv013_read_debug_buffer(), riscv013_resume_go(), riscv013_resume_prep(), riscv013_select_current_hart(), riscv013_set_register(), riscv013_set_register_buf(), riscv013_step_current_hart(), riscv013_write_debug_buffer(), RISCV_INFO, sample_memory(), and YNM_MAYBE.
|
static |
Definition at line 1065 of file riscv-013.c.
References CSR_FCSR, CSR_FFLAGS, CSR_FRM, GDB_REGNO_CSR0, GDB_REGNO_FPR0, and GDB_REGNO_FPR31.
Referenced by cleanup_after_register_access(), and prep_for_register_access().
|
static |
Definition at line 1073 of file riscv-013.c.
References GDB_REGNO_V0, GDB_REGNO_V31, GDB_REGNO_VL, GDB_REGNO_VLENB, GDB_REGNO_VSTART, GDB_REGNO_VTYPE, GDB_REGNO_VXRM, and GDB_REGNO_VXSAT.
Referenced by cleanup_after_register_access(), and prep_for_register_access().
|
static |
|
static |
Definition at line 2811 of file riscv-013.c.
References LOG_DEBUG, LOG_WARNING, RISCV_INFO, RISCV_MEM_ACCESS_ABSTRACT, RISCV_MEM_ACCESS_PROGBUF, and RISCV_MEM_ACCESS_SYSBUS.
Referenced by read_memory(), and write_memory().
|
static |
Definition at line 2478 of file riscv-013.c.
References debug_level, LOG_DEBUG, LOG_LVL_DEBUG, and TARGET_PRIxADDR.
Referenced by read_memory_bus_v1(), read_memory_bus_word(), read_memory_progbuf_inner(), read_memory_progbuf_one(), write_memory_bus_v1(), and write_memory_progbuf().
|
static |
Definition at line 4412 of file riscv-013.c.
References ERROR_OK, execute_fence(), and has_sufficient_progbuf().
Referenced by riscv013_on_step_or_resume().
|
static |
Definition at line 2914 of file riscv-013.c.
References LOG_DEBUG, LOG_ERROR, riscv_xlen(), and size.
Referenced by read_memory(), and write_memory().
|
static |
Definition at line 2846 of file riscv-013.c.
References has_sufficient_progbuf(), LOG_DEBUG, riscv_xlen(), size, target::state, and TARGET_HALTED.
Referenced by read_memory(), and write_memory().
|
static |
Definition at line 2885 of file riscv-013.c.
References DM_SBCS_SBASIZE, DM_SBCS_SBVERSION, get_field, info, LOG_DEBUG, RISCV013_INFO, sba_supports_access(), and size.
Referenced by read_memory(), and write_memory().
|
static |
Definition at line 2557 of file riscv-013.c.
References DCSR_PRV, ERROR_FAIL, ERROR_OK, GDB_REGNO_DCSR, GDB_REGNO_MSTATUS, get_field, has_sufficient_progbuf(), MSTATUS_MPP, MSTATUS_MPRV, register_read(), register_write_direct(), riscv_enable_virtual, and set_field.
Referenced by read_memory_progbuf(), read_memory_progbuf_one(), and write_memory_progbuf().
|
static |
Definition at line 1084 of file riscv-013.c.
References ERROR_FAIL, ERROR_OK, GDB_REGNO_MSTATUS, is_fpu_reg(), is_vector_reg(), MSTATUS_FS, MSTATUS_VS, register_read(), register_write_direct(), and set_field.
Referenced by register_read_direct(), register_write_direct(), riscv013_get_register_buf(), and riscv013_set_register_buf().
|
static |
Definition at line 1906 of file riscv-013.c.
References DIV_ROUND_UP, ERROR_FAIL, ERROR_OK, GDB_REGNO_VL, GDB_REGNO_VTYPE, LOG_ERROR, register_read(), register_write_direct(), RISCV_INFO, and riscv_xlen().
Referenced by riscv013_get_register_buf(), and riscv013_set_register_buf().
|
static |
Definition at line 810 of file riscv-013.c.
References DM_DATA0, dmi_read(), LOG_ERROR, and offset.
Referenced by read_memory_abstract(), register_read_abstract(), and write_memory_abstract().
|
static |
Definition at line 3532 of file riscv-013.c.
References buffer, count, DM_SBCS_SBVERSION, ERROR_FAIL, ERROR_OK, get_field, info, LOG_ERROR, log_mem_access_result(), mem_should_skip_abstract(), mem_should_skip_progbuf(), mem_should_skip_sysbus(), read_memory_abstract(), read_memory_bus_v0(), read_memory_bus_v1(), read_memory_progbuf(), RISCV013_INFO, RISCV_INFO, RISCV_MEM_ACCESS_ABSTRACT, RISCV_MEM_ACCESS_PROGBUF, RISCV_MEM_ACCESS_SYSBUS, RISCV_MEM_ACCESS_UNSPECIFIED, RISCV_NUM_MEM_ACCESS_METHODS, size, and target_name().
Referenced by init_target(), and scratch_read64().
|
static |
Definition at line 2948 of file riscv-013.c.
References access_memory_command(), buf_set_u64(), buffer, count, ERROR_OK, execute_abstract_command(), info, LOG_DEBUG, LOG_ERROR, LOG_WARNING, read_abstract_arg(), RISCV013_INFO, riscv_xlen(), size, TARGET_PRIxADDR, width, write_abstract_arg(), YNM_MAYBE, YNM_NO, and YNM_YES.
Referenced by read_memory().
|
static |
Definition at line 2588 of file riscv-013.c.
References buf_set_u32(), buffer, count, DM_SBADDRESS0, DM_SBCS, DM_SBCS_SBACCESS, DM_SBCS_SBAUTOINCREMENT, DM_SBDATA0, dmi_read(), dmi_write(), ERROR_FAIL, ERROR_NOT_IMPLEMENTED, ERROR_OK, LOG_DEBUG, LOG_ERROR, set_field, size, and TARGET_PRIxADDR.
Referenced by read_memory().
|
static |
Read the requested memory using the system bus interface.
Definition at line 2677 of file riscv-013.c.
References buf_set_u32(), buffer, count, DM_SBCS, DM_SBCS_SBAUTOINCREMENT, DM_SBCS_SBBUSYERROR, DM_SBCS_SBERROR, DM_SBCS_SBREADONADDR, DM_SBCS_SBREADONDATA, DM_SBDATA0, DM_SBDATA1, DM_SBDATA2, DM_SBDATA3, DMI_OP_NOP, DMI_OP_READ, dmi_scan(), DMI_STATUS_BUSY, DMI_STATUS_SUCCESS, dmi_write(), ERROR_FAIL, ERROR_NOT_IMPLEMENTED, ERROR_OK, get_field, increase_dmi_busy_delay(), info, jtag_add_runtest(), jtag_execute_queue(), keep_alive(), LOG_ERROR, log_memory_access(), MIN, NULL, read_memory_bus_word(), read_sbcs_nonbusy(), RISCV013_INFO, sb_read_address(), sb_sbaccess(), sb_write_address(), set_field, size, status, TAP_IDLE, and TARGET_ADDR_FMT.
Referenced by read_memory().
|
static |
Definition at line 2507 of file riscv-013.c.
References buf_set_u32(), buffer, DM_SBDATA0, DM_SBDATA1, DM_SBDATA2, DM_SBDATA3, dmi_op(), DMI_OP_READ, ERROR_OK, log_memory_access(), MIN, NULL, and size.
Referenced by read_memory_bus_v1().
|
static |
Read the requested memory, silently handling memory access errors.
Definition at line 3416 of file riscv-013.c.
References buf_set_u64(), buffer, count, CSR_DCSR_MPRVEN, ERROR_FAIL, ERROR_OK, execute_fence(), GDB_REGNO_DCSR, GDB_REGNO_MSTATUS, GDB_REGNO_S0, GDB_REGNO_S1, GDB_REGNO_S2, GDB_REGNO_ZERO, get_field, has_sufficient_progbuf(), LOG_DEBUG, LOG_ERROR, modify_privilege(), MSTATUS_MPRV, read_memory_progbuf_inner(), read_memory_progbuf_one(), register_read(), register_write_direct(), riscv_enable_virtual, riscv_program_addi(), riscv_program_csrrci(), riscv_program_csrrsi(), riscv_program_ebreak(), riscv_program_init(), riscv_program_lbr(), riscv_program_ldr(), riscv_program_lhr(), riscv_program_lwr(), riscv_program_write(), riscv_set_register(), riscv_xlen(), s0, s1, s2, select_dmi(), size, and TARGET_PRIxADDR.
Referenced by read_memory().
|
static |
Read the requested memory, taking care to execute every read exactly once, even if cmderr=busy is encountered.
Definition at line 3105 of file riscv-013.c.
References AC_ACCESS_REGISTER_POSTEXEC, AC_ACCESS_REGISTER_TRANSFER, access_register_command(), batch_run(), buf_set_u64(), buffer, CMDERR_BUSY, CMDERR_NONE, count, DM_ABSTRACTAUTO, DM_ABSTRACTAUTO_AUTOEXECDATA_OFFSET, DM_ABSTRACTCS, DM_ABSTRACTCS_BUSY, DM_ABSTRACTCS_CMDERR, DM_COMMAND, DM_DATA0, DM_DATA1, dmi_read(), dmi_read_exec(), DMI_STATUS_SUCCESS, dmi_write(), dmi_write_exec(), ERROR_FAIL, ERROR_OK, execute_abstract_command(), GDB_REGNO_S0, GDB_REGNO_S1, GDB_REGNO_S2, get_field, increase_ac_busy_delay(), info, LOG_DEBUG, log_memory_access(), LOG_WARNING, NULL, offset, register_read_direct(), register_write_direct(), riscv013_clear_abstract_error(), RISCV013_INFO, riscv_batch_add_dmi_read(), riscv_batch_alloc(), riscv_batch_free(), riscv_batch_full(), riscv_batch_get_dmi_read_data(), riscv_batch_get_dmi_read_op(), riscv_xlen(), size, and status.
Referenced by read_memory_progbuf().
|
static |
Definition at line 3341 of file riscv-013.c.
References AC_ACCESS_REGISTER_POSTEXEC, AC_ACCESS_REGISTER_TRANSFER, AC_ACCESS_REGISTER_WRITE, access_register_command(), buf_set_u64(), buffer, CSR_DCSR_MPRVEN, ERROR_FAIL, ERROR_OK, execute_abstract_command(), GDB_REGNO_DCSR, GDB_REGNO_MSTATUS, GDB_REGNO_S0, GDB_REGNO_ZERO, get_field, has_sufficient_progbuf(), LOG_ERROR, log_memory_access(), modify_privilege(), MSTATUS_MPRV, register_read(), register_write_direct(), riscv_enable_virtual, riscv_program_csrrci(), riscv_program_csrrsi(), riscv_program_ebreak(), riscv_program_init(), riscv_program_lbr(), riscv_program_ldr(), riscv_program_lhr(), riscv_program_lwr(), riscv_program_write(), riscv_set_register(), riscv_xlen(), s0, size, and write_abstract_arg().
Referenced by read_memory_progbuf().
|
static |
Definition at line 2540 of file riscv-013.c.
References DM_SBCS, DM_SBCS_SBBUSY, dmi_read(), ERROR_FAIL, ERROR_OK, get_field, LOG_ERROR, NULL, riscv_command_timeout_sec, and start.
Referenced by read_memory_bus_v1().
|
static |
Read register value from the target.
Also update the cached value.
Definition at line 1394 of file riscv-013.c.
References buf_set_u64(), ERROR_FAIL, ERROR_OK, GDB_REGNO_ZERO, number, target::reg_cache, reg_cache::reg_list, register_read_direct(), reg::size, and reg::value.
Referenced by discover_vlenb(), examine(), examine_progbuf(), modify_privilege(), prep_for_register_access(), prep_for_vector_access(), read_memory_progbuf(), read_memory_progbuf_one(), register_read_direct(), register_write_direct(), riscv013_get_register(), riscv013_get_register_buf(), riscv013_on_step_or_resume(), riscv013_set_register(), riscv013_set_register_buf(), and write_memory_progbuf().
|
static |
Definition at line 893 of file riscv-013.c.
References AC_ACCESS_REGISTER_TRANSFER, access_register_command(), CMDERR_NOT_SUPPORTED, ERROR_FAIL, ERROR_OK, execute_abstract_command(), GDB_REGNO_CSR0, GDB_REGNO_CSR4095, GDB_REGNO_FPR0, GDB_REGNO_FPR31, GDB_REGNO_V0, GDB_REGNO_V31, info, LOG_INFO, number, read_abstract_arg(), RISCV013_INFO, and size.
Referenced by examine(), and register_read_direct().
|
static |
Actually read registers from the target right now.
Definition at line 1411 of file riscv-013.c.
References cleanup_after_register_access(), ERROR_FAIL, ERROR_OK, fmv_x_d(), fmv_x_w(), fsd(), GDB_REGNO_CSR0, GDB_REGNO_CSR4095, GDB_REGNO_FPR0, GDB_REGNO_FPR31, gdb_regno_name(), GDB_REGNO_S0, GDB_REGNO_XPR31, scratch_mem_t::hart_address, has_sufficient_progbuf(), LOG_DEBUG, LOG_ERROR, number, prep_for_register_access(), register_read(), register_read_abstract(), register_size(), register_write_direct(), riscv_current_hartid(), riscv_program_csrr(), riscv_program_exec(), riscv_program_init(), riscv_program_insert(), riscv_supports_extension(), riscv_xlen(), s0, S0, scratch_read64(), scratch_release(), scratch_reserve(), and reg::value.
Referenced by examine_progbuf(), read_memory_progbuf_inner(), register_read(), riscv013_get_register_buf(), riscv013_set_register(), and write_memory_progbuf().
|
static |
Return register size in bits.
Definition at line 1274 of file riscv-013.c.
References number, target::reg_cache, reg_cache::reg_list, riscv_xlen(), and reg::size.
Referenced by register_read_direct(), and register_write_direct().
|
static |
Definition at line 931 of file riscv-013.c.
References AC_ACCESS_REGISTER_TRANSFER, AC_ACCESS_REGISTER_WRITE, access_register_command(), CMDERR_NOT_SUPPORTED, ERROR_FAIL, ERROR_OK, execute_abstract_command(), GDB_REGNO_CSR0, GDB_REGNO_CSR4095, GDB_REGNO_FPR0, GDB_REGNO_FPR31, info, LOG_INFO, number, RISCV013_INFO, size, and write_abstract_arg().
Referenced by register_write_direct().
|
static |
Immediately write the new value to the requested register.
This mechanism bypasses any caches.
Definition at line 1296 of file riscv-013.c.
References buf_set_u64(), cleanup_after_register_access(), CSR_VL, csrr(), ERROR_FAIL, ERROR_OK, fld(), fmv_d_x(), fmv_w_x(), GDB_REGNO_CSR0, GDB_REGNO_CSR4095, GDB_REGNO_FPR0, GDB_REGNO_FPR31, gdb_regno_name(), GDB_REGNO_S0, GDB_REGNO_VL, GDB_REGNO_VTYPE, scratch_mem_t::hart_address, has_sufficient_progbuf(), LOG_DEBUG, LOG_ERROR, number, prep_for_register_access(), target::reg_cache, reg_cache::reg_list, register_read(), register_size(), register_write_abstract(), riscv_current_hartid(), riscv_is_halted(), riscv_program_csrw(), riscv_program_exec(), riscv_program_init(), riscv_program_insert(), riscv_supports_extension(), riscv_xlen(), s0, S0, scratch_release(), scratch_reserve(), scratch_write64(), reg::size, reg::value, vsetvli(), and ZERO.
Referenced by cleanup_after_register_access(), cleanup_after_vector_access(), examine_progbuf(), modify_privilege(), prep_for_register_access(), prep_for_vector_access(), read_memory_progbuf(), read_memory_progbuf_inner(), read_memory_progbuf_one(), register_read_direct(), riscv013_get_register_buf(), riscv013_set_register(), riscv013_set_register_buf(), and write_memory_progbuf().
|
static |
Definition at line 1782 of file riscv-013.c.
References DM_AUTHDATA, dmi_read(), ERROR_FAIL, ERROR_OK, LOG_ERROR, NULL, and wait_for_authbusy().
Referenced by init_target().
|
static |
Definition at line 1795 of file riscv-013.c.
References DM_AUTHDATA, DM_DMSTATUS_AUTHENTICATED, dmi_write(), ERROR_FAIL, ERROR_OK, examine(), get_dm(), get_field, list_for_each_entry, LOG_ERROR, LOG_INFO, target_list_t::target, dm013_info_t::target_list, and wait_for_authbusy().
Referenced by init_target().
|
static |
Definition at line 4487 of file riscv-013.c.
References DM_ABSTRACTCS, DM_ABSTRACTCS_BUSY, DM_ABSTRACTCS_CMDERR, dmi_read(), dmi_write(), get_field, LOG_ERROR, NULL, riscv_command_timeout_sec, and start.
Referenced by read_memory_progbuf_inner(), and write_memory_progbuf().
|
static |
Definition at line 1837 of file riscv-013.c.
References DM_SBCS_SBACCESS128, DM_SBCS_SBACCESS16, DM_SBCS_SBACCESS32, DM_SBCS_SBACCESS64, DM_SBCS_SBACCESS8, get_field, has_sufficient_progbuf(), info, LOG_ERROR, RISCV013_INFO, RISCV_INFO, RISCV_MEM_ACCESS_ABSTRACT, RISCV_MEM_ACCESS_PROGBUF, RISCV_MEM_ACCESS_SYSBUS, RISCV_MEM_ACCESS_UNSPECIFIED, RISCV_NUM_MEM_ACCESS_METHODS, and riscv_xlen().
Referenced by init_target().
|
static |
Definition at line 4406 of file riscv-013.c.
References DTM_DMI_DATA_LENGTH, DTM_DMI_OP_LENGTH, info, and RISCV013_INFO.
Referenced by init_target().
|
static |
Definition at line 4371 of file riscv-013.c.
References AC_ACCESS_REGISTER_AARSIZE, AC_ACCESS_REGISTER_POSTEXEC, AC_ACCESS_REGISTER_REGNO, AC_ACCESS_REGISTER_TRANSFER, execute_abstract_command(), and set_field.
Referenced by init_target().
|
static |
Definition at line 4398 of file riscv-013.c.
References buf_set_u64(), DMI_OP_NOP, DTM_DMI_ADDRESS_OFFSET, DTM_DMI_DATA_LENGTH, DTM_DMI_DATA_OFFSET, DTM_DMI_OP_LENGTH, DTM_DMI_OP_OFFSET, info, and RISCV013_INFO.
Referenced by init_target().
|
static |
Definition at line 4390 of file riscv-013.c.
References buf_set_u64(), DMI_OP_READ, DTM_DMI_ADDRESS_OFFSET, DTM_DMI_DATA_LENGTH, DTM_DMI_DATA_OFFSET, DTM_DMI_OP_LENGTH, DTM_DMI_OP_OFFSET, info, and RISCV013_INFO.
Referenced by init_target().
|
static |
Definition at line 4382 of file riscv-013.c.
References buf_set_u64(), DMI_OP_WRITE, DTM_DMI_ADDRESS_OFFSET, DTM_DMI_DATA_LENGTH, DTM_DMI_DATA_OFFSET, DTM_DMI_OP_LENGTH, DTM_DMI_OP_OFFSET, info, and RISCV013_INFO.
Referenced by init_target().
|
static |
Definition at line 4067 of file riscv-013.c.
References target::coreid, CSR_DCSR_PRV, CSR_DCSR_V, ERROR_FAIL, ERROR_OK, GDB_REGNO_DCSR, GDB_REGNO_DPC, gdb_regno_name(), GDB_REGNO_PC, GDB_REGNO_PRIV, get_field, LOG_DEBUG, register_read(), rid, riscv_select_current_hart(), set_field, target_name(), VIRT_PRIV_PRV, and VIRT_PRIV_V.
Referenced by init_target().
|
static |
Definition at line 1951 of file riscv-013.c.
References buf_set_u64(), cleanup_after_register_access(), cleanup_after_vector_access(), ERROR_FAIL, ERROR_OK, GDB_REGNO_S0, GDB_REGNO_V0, GDB_REGNO_V31, prep_for_register_access(), prep_for_vector_access(), register_read(), register_read_direct(), register_write_direct(), riscv_program_exec(), riscv_program_init(), riscv_program_insert(), riscv_select_current_hart(), riscv_xlen(), s0, S0, vmv_x_s(), vslide1down_vx(), and riscv_info::xlen.
Referenced by init_target().
|
static |
Definition at line 4207 of file riscv-013.c.
References DBG_REASON_DBGRQ, DBG_REASON_NOTHALTED, target::debug_reason, DM_DMCONTROL, DM_DMCONTROL_DMACTIVE, DM_DMCONTROL_HALTREQ, DM_DMCONTROL_HASEL, dmi_read(), dmi_write(), dmstatus_read(), ERROR_FAIL, ERROR_OK, get_dm(), list_for_each_entry, LOG_DEBUG, LOG_ERROR, RISCV_INFO, riscv_is_halted(), select_prepped_harts(), set_field, set_hartsel(), target::state, target_list_t::target, TARGET_HALTED, and dm013_info_t::target_list.
Referenced by examine(), and init_target().
|
static |
|
static |
Definition at line 4288 of file riscv-013.c.
References DM_DMCONTROL, DM_DMCONTROL_ACKHAVERESET, DM_DMCONTROL_DMACTIVE, DM_DMCONTROL_HALTREQ, DM_DMSTATUS_ALLHALTED, DM_DMSTATUS_ANYHAVERESET, DM_DMSTATUS_ANYNONEXISTENT, DM_DMSTATUS_ANYUNAVAIL, dmi_write(), dmstatus_read(), ERROR_OK, get_field, LOG_ERROR, LOG_INFO, riscv_current_hartid(), set_hartsel(), target::state, and TARGET_HALTED.
Referenced by init_target().
|
static |
Definition at line 1829 of file riscv-013.c.
References get_dm(), and dm013_info_t::hart_count.
Referenced by init_target().
|
static |
Definition at line 4288 of file riscv-013.c.
Referenced by init_target().
|
static |
|
static |
Definition at line 4278 of file riscv-013.c.
References riscv013_on_step_or_resume().
Referenced by init_target().
|
static |
Definition at line 4420 of file riscv-013.c.
References CSR_DCSR_EBREAKM, CSR_DCSR_EBREAKS, CSR_DCSR_EBREAKU, CSR_DCSR_STEP, ERROR_FAIL, ERROR_OK, GDB_REGNO_DCSR, maybe_execute_fence_i(), register_read(), riscv_ebreakm, riscv_ebreaks, riscv_ebreaku, riscv_set_register(), set_field, and step().
Referenced by riscv013_on_step(), and riscv013_resume_prep().
|
static |
Definition at line 4364 of file riscv-013.c.
References DM_PROGBUF0, and dmi_read().
Referenced by init_target().
|
static |
Definition at line 4259 of file riscv-013.c.
References ERROR_FAIL, ERROR_OK, riscv013_step_or_resume_current_hart(), and select_prepped_harts().
Referenced by init_target().
|
static |
Definition at line 4273 of file riscv-013.c.
References riscv013_on_step_or_resume().
Referenced by init_target().
|
static |
Definition at line 4128 of file riscv-013.c.
References dm013_info_t::current_hartid, DM_DMCONTROL, dmi_read(), dmi_write(), ERROR_FAIL, ERROR_OK, get_dm(), RISCV_INFO, and set_hartsel().
Referenced by examine(), init_target(), and riscv013_set_register().
|
static |
Definition at line 4096 of file riscv-013.c.
References target::coreid, CSR_DCSR_PRV, CSR_DCSR_V, ERROR_FAIL, ERROR_OK, GDB_REGNO_DCSR, GDB_REGNO_DPC, gdb_regno_name(), GDB_REGNO_PC, GDB_REGNO_PRIV, GDB_REGNO_XPR31, get_field, LOG_DEBUG, LOG_ERROR, register_read(), register_read_direct(), register_write_direct(), rid, riscv013_select_current_hart(), set_field, VIRT_PRIV_PRV, and VIRT_PRIV_V.
Referenced by init_target().
|
static |
Definition at line 2010 of file riscv-013.c.
References buf_get_u64(), cleanup_after_register_access(), cleanup_after_vector_access(), ERROR_FAIL, ERROR_OK, GDB_REGNO_S0, GDB_REGNO_V0, GDB_REGNO_V31, prep_for_register_access(), prep_for_vector_access(), register_read(), register_write_direct(), riscv_program_exec(), riscv_program_init(), riscv_program_insert(), riscv_select_current_hart(), riscv_xlen(), s0, S0, and vslide1down_vx().
Referenced by init_target().
|
static |
Definition at line 4268 of file riscv-013.c.
References riscv013_step_or_resume_current_hart().
Referenced by init_target().
|
static |
Definition at line 4437 of file riscv-013.c.
References DM_DMCONTROL, DM_DMCONTROL_DMACTIVE, DM_DMCONTROL_HASEL, DM_DMCONTROL_RESUMEREQ, DM_DMSTATUS_ALLHALTED, DM_DMSTATUS_ALLRESUMEACK, dmi_write(), dmstatus_read(), ERROR_FAIL, ERROR_OK, get_field, LOG_DEBUG, LOG_ERROR, riscv_halt(), RISCV_INFO, riscv_is_halted(), set_field, set_hartsel(), and step().
Referenced by examine(), riscv013_resume_go(), and riscv013_step_current_hart().
|
static |
Definition at line 4349 of file riscv-013.c.
References DM_PROGBUF0, dmi_write(), ERROR_FAIL, ERROR_OK, get_dm(), LOG_DEBUG, and dm013_info_t::progbuf_cache.
Referenced by init_target().
|
static |
Definition at line 2263 of file riscv-013.c.
References config, ERROR_OK, and sample_memory_bus_v1().
Referenced by init_target().
|
static |
Definition at line 2126 of file riscv-013.c.
References ARRAY_SIZE, batch_run(), riscv_sample_buf::buf, buf_set_u64(), config, DM_SBADDRESS0, DM_SBADDRESS1, DM_SBCS, DM_SBCS_SBASIZE, DM_SBCS_SBBUSYERROR, DM_SBCS_SBERROR, DM_SBCS_SBREADONADDR, DM_SBCS_SBREADONDATA, DM_SBCS_SBVERSION, DM_SBDATA0, DM_SBDATA1, dmi_write(), ERROR_FAIL, ERROR_NOT_IMPLEMENTED, ERROR_OK, get_field, info, LOG_ERROR, RISCV013_INFO, riscv_batch_add_dmi_read(), riscv_batch_add_dmi_write(), riscv_batch_alloc(), riscv_batch_free(), riscv_batch_get_dmi_read_data(), RISCV_SAMPLE_BUF_TIMESTAMP_BEFORE, sb_sbaccess(), sba_supports_access(), riscv_sample_buf::size, timeval_ms(), and riscv_sample_buf::used.
Referenced by sample_memory().
|
static |
Definition at line 2524 of file riscv-013.c.
References DM_SBADDRESS0, DM_SBADDRESS1, DM_SBCS_SBASIZE, dmi_read(), get_field, info, and RISCV013_INFO.
Referenced by read_memory_bus_v1(), and write_memory_bus_v1().
|
static |
Definition at line 2058 of file riscv-013.c.
References DM_SBCS_SBACCESS, and set_field.
Referenced by read_memory_bus_v1(), sample_memory_bus_v1(), and write_memory_bus_v1().
|
static |
Definition at line 2076 of file riscv-013.c.
References DM_SBADDRESS0, DM_SBADDRESS1, DM_SBADDRESS2, DM_SBADDRESS3, DM_SBCS_SBASIZE, dmi_op(), DMI_OP_WRITE, get_field, info, NULL, and RISCV013_INFO.
Referenced by read_memory_bus_v1(), and write_memory_bus_v1().
|
static |
Definition at line 2107 of file riscv-013.c.
References DM_SBCS_SBACCESS128, DM_SBCS_SBACCESS16, DM_SBCS_SBACCESS32, DM_SBCS_SBACCESS64, DM_SBCS_SBACCESS8, get_field, info, and RISCV013_INFO.
Referenced by mem_should_skip_sysbus(), and sample_memory_bus_v1().
|
static |
Definition at line 1201 of file riscv-013.c.
References buffer, scratch_mem_t::debug_address, DM_DATA0, DM_DATA1, DM_PROGBUF0, DM_PROGBUF1, dmi_read(), ERROR_FAIL, ERROR_OK, scratch_mem_t::memory_space, read_memory(), SPACE_DM_DATA, SPACE_DMI_PROGBUF, and SPACE_DMI_RAM.
Referenced by register_read_direct().
|
static |
Definition at line 1195 of file riscv-013.c.
References scratch_mem_t::area, and target_free_working_area().
Referenced by register_read_direct(), and register_write_direct().
|
static |
Find some scratch memory to be used with the given program.
Definition at line 1134 of file riscv-013.c.
References working_area::address, scratch_mem_t::area, scratch_mem_t::debug_address, ERROR_FAIL, ERROR_OK, examine_progbuf(), get_info(), scratch_mem_t::hart_address, info, riscv_program::instruction_count, LOG_ERROR, scratch_mem_t::memory_space, NULL, SPACE_DM_DATA, SPACE_DMI_PROGBUF, SPACE_DMI_RAM, target_alloc_working_area(), and YNM_YES.
Referenced by register_read_direct(), and register_write_direct().
|
static |
Definition at line 1241 of file riscv-013.c.
References buffer, scratch_mem_t::debug_address, DM_DATA0, DM_DATA1, DM_PROGBUF0, DM_PROGBUF1, dmi_write(), ERROR_FAIL, ERROR_OK, scratch_mem_t::memory_space, SPACE_DM_DATA, SPACE_DMI_PROGBUF, SPACE_DMI_RAM, and write_memory().
Referenced by register_write_direct().
|
static |
Definition at line 408 of file riscv-013.c.
References bscan_tunnel_ir_width, jtag_add_ir_scan(), select_dbus, select_dmi_via_bscan(), target::tap, and TAP_IDLE.
Referenced by assert_reset(), deassert_reset(), dmi_op_timeout(), dtmcontrol_scan(), read_memory_progbuf(), and write_memory_progbuf().
|
static |
Definition at line 4150 of file riscv-013.c.
References target::coreid, DM_HAWINDOW, DM_HAWINDOWSEL, dmi_write(), ERROR_FAIL, ERROR_OK, get_dm(), get_info(), dm013_info_t::hart_count, dm013_info_t::hasel_supported, info, list_for_each_entry, LOG_DEBUG, riscv_info::prepped, riscv_info(), RISCV_INFO, riscv_info::selected, target_list_t::target, and dm013_info_t::target_list.
Referenced by riscv013_halt_go(), and riscv013_resume_go().
|
static |
Definition at line 1532 of file riscv-013.c.
References DM_DMCS2, DM_DMCS2_GROUP, DM_DMCS2_HGWRITE, dmi_read(), dmi_write(), ERROR_FAIL, ERROR_OK, get_field, set_field, and target::smp.
Referenced by examine().
|
static |
Definition at line 279 of file riscv-013.c.
References DM_DMCONTROL_HARTSELHI, DM_DMCONTROL_HARTSELHI_LENGTH, DM_DMCONTROL_HARTSELHI_OFFSET, DM_DMCONTROL_HARTSELLO, DM_DMCONTROL_HARTSELLO_LENGTH, and DM_DMCONTROL_HARTSELLO_OFFSET.
Referenced by assert_reset(), deassert_reset(), examine(), riscv013_halt_go(), riscv013_halt_reason(), riscv013_select_current_hart(), and riscv013_step_or_resume_current_hart().
|
static |
Definition at line 1495 of file riscv-013.c.
References DM_DMSTATUS_AUTHBUSY, dmstatus_read(), ERROR_FAIL, ERROR_OK, get_field, LOG_ERROR, NULL, riscv_command_timeout_sec, and start.
Referenced by riscv013_authdata_read(), and riscv013_authdata_write().
|
static |
Definition at line 735 of file riscv-013.c.
References CMDERR_NONE, DM_ABSTRACTCS, DM_ABSTRACTCS_BUSY, DM_ABSTRACTCS_CMDERR, dmi_read(), ERROR_FAIL, ERROR_OK, get_field, info, LOG_ERROR, NULL, RISCV013_INFO, riscv_command_timeout_sec, and start.
Referenced by execute_abstract_command().
|
static |
Definition at line 831 of file riscv-013.c.
References DM_DATA0, dmi_write(), ERROR_FAIL, ERROR_OK, LOG_ERROR, and offset.
Referenced by read_memory_abstract(), read_memory_progbuf_one(), register_write_abstract(), and write_memory_abstract().
|
static |
Definition at line 3981 of file riscv-013.c.
References buffer, count, DM_SBCS_SBVERSION, ERROR_FAIL, ERROR_OK, get_field, info, LOG_ERROR, log_mem_access_result(), mem_should_skip_abstract(), mem_should_skip_progbuf(), mem_should_skip_sysbus(), RISCV013_INFO, RISCV_INFO, RISCV_MEM_ACCESS_ABSTRACT, RISCV_MEM_ACCESS_PROGBUF, RISCV_MEM_ACCESS_SYSBUS, RISCV_MEM_ACCESS_UNSPECIFIED, RISCV_NUM_MEM_ACCESS_METHODS, size, target_name(), write_memory_abstract(), write_memory_bus_v0(), write_memory_bus_v1(), and write_memory_progbuf().
Referenced by scratch_write64().
|
static |
Definition at line 3027 of file riscv-013.c.
References access_memory_command(), buf_get_u64(), buffer, count, ERROR_OK, execute_abstract_command(), info, LOG_DEBUG, LOG_ERROR, LOG_WARNING, read_abstract_arg(), RISCV013_INFO, riscv_xlen(), size, TARGET_PRIxADDR, width, write_abstract_arg(), YNM_MAYBE, YNM_NO, and YNM_YES.
Referenced by write_memory().
|
static |
Definition at line 3596 of file riscv-013.c.
References buf_get_u64(), buffer, count, DM_SBADDRESS0, DM_SBCS, DM_SBCS_SBACCESS, DM_SBCS_SBAUTOINCREMENT, DM_SBDATA0, dmi_write(), ERROR_OK, LOG_DEBUG, offset, set_field, size, and TARGET_PRIxADDR.
Referenced by write_memory().
|
static |
Definition at line 3649 of file riscv-013.c.
References batch_run(), buffer, count, DM_SBCS, DM_SBCS_SBAUTOINCREMENT, DM_SBCS_SBBUSY, DM_SBCS_SBBUSYERROR, DM_SBCS_SBERROR, DM_SBDATA0, DM_SBDATA1, DM_SBDATA2, DM_SBDATA3, dmi_op(), DMI_OP_READ, dmi_read(), dmi_write(), ERROR_FAIL, ERROR_OK, get_field, info, LOG_DEBUG, LOG_ERROR, log_memory_access(), NULL, RISCV013_INFO, riscv_batch_add_dmi_write(), riscv_batch_alloc(), riscv_batch_available_scans(), riscv_batch_free(), riscv_command_timeout_sec, sb_read_address(), sb_sbaccess(), sb_write_address(), set_field, size, start, and TARGET_PRIxADDR.
Referenced by write_memory().
|
static |
Definition at line 3789 of file riscv-013.c.
References AC_ACCESS_REGISTER_POSTEXEC, AC_ACCESS_REGISTER_TRANSFER, AC_ACCESS_REGISTER_WRITE, access_register_command(), batch_run(), buf_get_u64(), buffer, CMDERR_BUSY, CMDERR_NONE, count, CSR_DCSR_MPRVEN, DM_ABSTRACTAUTO, DM_ABSTRACTAUTO_AUTOEXECDATA_OFFSET, DM_ABSTRACTCS, DM_ABSTRACTCS_BUSY, DM_ABSTRACTCS_CMDERR, DM_DATA0, DM_DATA1, dmi_op(), DMI_OP_READ, dmi_read(), dmi_write(), ERROR_FAIL, ERROR_OK, execute_abstract_command(), execute_fence(), GDB_REGNO_DCSR, GDB_REGNO_MSTATUS, GDB_REGNO_S0, GDB_REGNO_S1, GDB_REGNO_ZERO, get_field, has_sufficient_progbuf(), increase_ac_busy_delay(), info, LOG_DEBUG, LOG_ERROR, log_memory_access(), modify_privilege(), MSTATUS_MPRV, offset, register_read(), register_read_direct(), register_write_direct(), riscv013_clear_abstract_error(), RISCV013_INFO, riscv_batch_add_dmi_write(), riscv_batch_alloc(), riscv_batch_free(), riscv_batch_full(), riscv_enable_virtual, riscv_program_addi(), riscv_program_csrrci(), riscv_program_csrrsi(), riscv_program_ebreak(), riscv_program_init(), riscv_program_sbr(), riscv_program_sdr(), riscv_program_shr(), riscv_program_swr(), riscv_program_write(), riscv_xlen(), s0, s1, select_dmi(), size, and start.
Referenced by write_memory().
struct target_type riscv013_target |
Definition at line 4042 of file riscv-013.c.
Referenced by get_target_type().