OpenOCD
riscv.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #ifndef OPENOCD_TARGET_RISCV_RISCV_H
4 #define OPENOCD_TARGET_RISCV_RISCV_H
5 
6 struct riscv_program;
7 
8 #include <stdint.h>
9 #include "opcodes.h"
10 #include "gdb_regs.h"
11 #include "jtag/jtag.h"
13 #include "target/target.h"
14 #include "target/register.h"
15 #include <helper/command.h>
16 #include <helper/bits.h>
17 
18 #define RISCV_COMMON_MAGIC 0x52495356U
19 
20 #define RISCV_MAX_HARTS ((int)BIT(20))
21 #define RISCV_MAX_TRIGGERS 32
22 #define RISCV_MAX_HWBPS 16
23 #define RISCV_MAX_DMS 100
24 
25 #define DEFAULT_COMMAND_TIMEOUT_SEC 5
26 
27 #define RISCV_SATP_MODE(xlen) ((xlen) == 32 ? SATP32_MODE : SATP64_MODE)
28 #define RISCV_SATP_PPN(xlen) ((xlen) == 32 ? SATP32_PPN : SATP64_PPN)
29 #define RISCV_HGATP_MODE(xlen) ((xlen) == 32 ? HGATP32_MODE : HGATP64_MODE)
30 #define RISCV_HGATP_PPN(xlen) ((xlen) == 32 ? HGATP32_PPN : HGATP64_PPN)
31 #define RISCV_PGSHIFT 12
32 #define RISCV_PGSIZE BIT(RISCV_PGSHIFT)
33 #define RISCV_PGBASE(addr) ((addr) & ~(RISCV_PGSIZE - 1))
34 #define RISCV_PGOFFSET(addr) ((addr) & (RISCV_PGSIZE - 1))
35 
36 #define PG_MAX_LEVEL 5
37 
38 #define RISCV_BATCH_ALLOC_SIZE 128
39 
40 extern struct target_type riscv011_target;
41 extern struct target_type riscv013_target;
42 
43 /*
44  * Definitions shared by code supporting all RISC-V versions.
45  */
46 typedef uint64_t riscv_reg_t;
47 typedef uint32_t riscv_insn_t;
48 typedef uint64_t riscv_addr_t;
49 
53  YNM_NO
54 };
55 
61 };
62 
67 };
68 
70 
79 };
80 
82  /* RISCV_ISRMASK_AUTO, */ /* not supported yet */
84  /* RISCV_ISRMASK_ON, */ /* not supported yet */
86 };
87 
93 };
94 
95 /* RISC-V-specific data assigned to a register. */
96 typedef struct {
97  struct target *target;
98  /* Abstract command's regno for a custom register. */
99  unsigned int custom_number;
101 
102 #define RISCV_SAMPLE_BUF_TIMESTAMP_BEFORE 0x80
103 #define RISCV_SAMPLE_BUF_TIMESTAMP_AFTER 0x81
105  uint8_t *buf;
106  unsigned int used;
107  unsigned int size;
108 };
109 
110 typedef struct {
111  bool enabled;
112  struct {
113  bool enabled;
115  uint32_t size_bytes;
116  } bucket[16];
118 
119 typedef struct {
120  struct list_head list;
121  uint16_t low, high;
122  char *name;
123 } range_list_t;
124 
125 #define DTM_DTMCS_VERSION_UNKNOWN ((unsigned int)-1)
126 #define RISCV_TINFO_VERSION_UNKNOWN (-1)
127 
128 #define RISCV013_DTMCS_ABITS_MIN 7
129 #define RISCV013_DTMCS_ABITS_MAX 32
130 
132  unsigned int num_entries;
133  char **reg_names;
134 };
135 
138 
139  const uint8_t *write_buffer;
140  uint8_t *read_buffer;
141 
142  uint32_t size;
143  uint32_t count;
144  uint32_t increment;
145 };
146 
147 static inline bool
149 {
150  return !args.read_buffer != !args.write_buffer;
151 }
152 
153 static inline bool
155 {
156  assert(riscv_mem_access_is_valid(args));
157  return !args.write_buffer && args.read_buffer;
158 }
159 
160 static inline bool
162 {
163  assert(riscv_mem_access_is_valid(args));
164  return !args.read_buffer && args.write_buffer;
165 }
166 
167 
168 struct riscv_info {
169  unsigned int common_magic;
170 
171  unsigned int dtm_version;
172 
175 
177  char **reg_names;
178 
179  /* It's possible that each core has a different supported ISA set. */
180  int xlen;
181  /* TODO: use the value from the register cache instead. */
183  /* TODO: use the value from the register cache instead.
184  * Cached value of vlenb. 0 indicates there is no vector support.
185  * Note that you can have vector support without misa.V set, because
186  * Zve* extensions implement vector registers without setting misa.V. */
187  unsigned int vlenb;
188 
189  /* The number of triggers per hart. */
190  unsigned int trigger_count;
191 
192  /* Data structure to record known unsupported tdata1+tdata2 trigger CSR values.
193  * This is to avoid repetitive attempts to set trigger configurations that are already
194  * known to be unsupported in the HW.
195  * A separate data structure is created for each trigger. */
197 
198  /* record the tinfo of each trigger */
200 
201  /* Version of the implemented Sdtrig extension */
203 
204  /* Record if single-step is needed prior to resuming
205  * from a software breakpoint or trigger.
206  * Single-step is needed if the instruction that
207  * caused the halt was not retired. That is,
208  * when we halted "before" that instruction.
209  */
211 
212  /* For each physical trigger contains:
213  * -1: the hwbp is available
214  * -4: The trigger is used by the itrigger command
215  * -5: The trigger is used by the etrigger command
216  * >= 0: unique_id of the breakpoint/watchpoint that is using it.
217  * Note that in RTOS mode the triggers are the same across all harts the
218  * target controls, while otherwise only a single hart is controlled. */
220 
221  /* The unique id of the trigger that caused the most recent halt. If the
222  * most recent halt was not caused by a trigger, then this is -1. */
223  int64_t trigger_hit;
224 
225  /* The configured approach to translate virtual addresses to physical */
227 
229 
230  /* Decremented every scan, and when it reaches 0 we clear the learned
231  * delays, causing them to be relearned. Used for testing. */
233 
234  /* This target has been prepped and is ready to step/resume. */
235  bool prepped;
236  /* This target was selected using hasel. */
237  bool selected;
238 
239  /* Used by riscv_openocd_poll(). */
243 
245 
246  /* Helper functions that target the various RISC-V debug spec
247  * implementations. */
248  int (*select_target)(struct target *target);
250  /* Resume this target, as well as every other prepped target that can be
251  * resumed near-simultaneously. Clear the prepped flag on any target that
252  * was resumed. */
253  int (*resume_go)(struct target *target);
254  int (*step_current_hart)(struct target *target);
255 
256  /* These get called from riscv_poll_hart(), which is a house of cards
257  * together with openocd_poll(), so be careful not to upset things too
258  * much. */
260  enum riscv_hart_state previous_riscv_state);
262  enum riscv_hart_state previous_riscv_state);
264  enum riscv_hart_state previous_riscv_state);
265 
266  /* Called periodically (no guarantees about frequency), while there's
267  * nothing else going on. */
268  int (*tick)(struct target *target);
269 
270  /* Get this target as ready as possible to resume, without actually
271  * resuming. */
272  int (*resume_prep)(struct target *target);
273  int (*halt_prep)(struct target *target);
274  int (*halt_go)(struct target *target);
275  int (*on_step)(struct target *target);
276  enum riscv_halt_reason (*halt_reason)(struct target *target);
277  int (*write_progbuf)(struct target *target, unsigned int index, riscv_insn_t d);
278  riscv_insn_t (*read_progbuf)(struct target *target, unsigned int index);
279  int (*execute_progbuf)(struct target *target, uint32_t *cmderr);
281  unsigned int (*get_dmi_address_bits)(const struct target *target);
282  void (*fill_dmi_write)(const struct target *target, uint8_t *buf, uint32_t a, uint32_t d);
283  void (*fill_dmi_read)(const struct target *target, uint8_t *buf, uint32_t a);
284  void (*fill_dm_nop)(const struct target *target, uint8_t *buf);
285 
286  int (*authdata_read)(struct target *target, uint32_t *value, unsigned int index);
287  int (*authdata_write)(struct target *target, uint32_t value, unsigned int index);
288 
289  int (*dmi_read)(struct target *target, uint32_t *value, uint32_t address);
290  int (*dmi_write)(struct target *target, uint32_t address, uint32_t value);
291 
292  bool (*get_impebreak)(const struct target *target);
293  unsigned int (*get_progbufsize)(const struct target *target);
294 
295  /* Get the DMI address of target's DM's register.
296  * The function should return the passed address
297  * if the target is not assigned a DM yet.
298  */
299  uint32_t (*get_dmi_address)(const struct target *target, uint32_t dm_address);
300 
301  int (*sample_memory)(struct target *target,
302  struct riscv_sample_buf *buf,
304  int64_t until_ms);
305 
306  int (*access_memory)(struct target *target, const struct riscv_mem_access_args args);
307 
308  unsigned int (*data_bits)(struct target *target);
309 
310  COMMAND_HELPER((*print_info), struct target *target);
311 
312  /* Storage for arch_info of non-custom registers. */
314 
315  /* Storage for vector register types. */
328  struct reg_data_type type_vector;
329 
331 
332  /* Memory access methods to use, ordered by priority, highest to lowest. */
334 
336 
337  /* Different memory regions may need different methods but single configuration is applied
338  * for all. Following flags are used to warn only once about failing memory access method. */
340 
341  /* In addition to the ones in the standard spec, we'll also expose additional
342  * CSRs in this list. */
343  struct list_head expose_csr;
344  /* Same, but for custom registers.
345  * Custom registers are for non-standard extensions and use abstract register numbers
346  * from range 0xc000 ... 0xffff. */
347  struct list_head expose_custom;
348 
349  /* The list of registers to mark as "hidden". Hidden registers are available
350  * but do not appear in gdb targets description or reg command output. */
351  struct list_head hide_csr;
352 
355 
356  /* Track when we were last asked to do something substantial. */
357  int64_t last_activity;
358 
360 
362 
366 
367  bool autofence;
368 };
369 
377 };
378 
381 };
382 
383 static inline struct riscv_private_config
385 {
386  assert(target->private_config);
387  return target->private_config;
388 }
389 
390 COMMAND_HELPER(riscv_print_info_line, const char *section, const char *key,
391  unsigned int value);
392 
393 typedef struct {
394  uint8_t tunneled_dr_width;
395  struct scan_field tunneled_dr[4];
397 
398 typedef struct {
399  const char *name;
400  int level;
401  unsigned int va_bits;
402  /* log2(PTESIZE) */
403  unsigned int pte_shift;
404  unsigned int vpn_shift[PG_MAX_LEVEL];
405  unsigned int vpn_mask[PG_MAX_LEVEL];
406  unsigned int pte_ppn_shift[PG_MAX_LEVEL];
407  unsigned int pte_ppn_mask[PG_MAX_LEVEL];
408  unsigned int pa_ppn_shift[PG_MAX_LEVEL];
409  unsigned int pa_ppn_mask[PG_MAX_LEVEL];
411 
412 bool riscv_virt2phys_mode_is_hw(const struct target *target);
413 bool riscv_virt2phys_mode_is_sw(const struct target *target);
414 
415 /* Wall-clock timeout for a command/access. Settable via RISC-V Target commands.*/
417 
418 /* Everything needs the RISC-V specific info structure, so here's a nice macro
419  * that provides that. */
420 static inline struct riscv_info *riscv_info(const struct target *target) __attribute__((unused));
421 static inline struct riscv_info *riscv_info(const struct target *target)
422 {
423  assert(target->arch_info);
424  return target->arch_info;
425 }
426 #define RISCV_INFO(R) struct riscv_info *R = riscv_info(target);
427 
428 static inline bool is_riscv(const struct riscv_info *riscv_info)
429 {
431 }
432 
433 extern struct scan_field select_dtmcontrol;
434 extern struct scan_field select_dbus;
435 extern struct scan_field select_idcode;
436 
437 int dtmcs_scan(struct jtag_tap *tap, uint32_t out, uint32_t *in_ptr);
438 
442 extern uint8_t bscan_tunnel_ir_width;
443 
444 void select_dmi_via_bscan(struct jtag_tap *tap);
445 
446 /*** OpenOCD Interface */
447 int riscv_openocd_poll(struct target *target);
448 
449 int riscv_halt(struct target *target);
450 
452  struct target *target,
453  bool current,
455  bool handle_breakpoints
456 );
457 
458 /*** RISC-V Interface ***/
459 
460 bool riscv_supports_extension(const struct target *target, char letter);
461 
462 /* Returns XLEN for the given (or current) hart. */
463 unsigned int riscv_xlen(const struct target *target);
464 
465 /* Returns VLENB for the given (or current) hart. */
466 unsigned int riscv_vlenb(const struct target *target);
467 
468 /*** Support functions for the RISC-V 'RTOS', which provides multihart support
469  * without requiring multiple targets. */
470 
471 /* Checks the state of the current hart -- "is_halted" checks the actual
472  * on-device register. */
474 
475 /* These helper functions let the generic program interface get target-specific
476  * information. */
477 unsigned int riscv_progbuf_size(struct target *target);
478 
479 riscv_insn_t riscv_read_progbuf(struct target *target, int index);
480 int riscv_write_progbuf(struct target *target, unsigned int index, riscv_insn_t insn);
481 int riscv_execute_progbuf(struct target *target, uint32_t *cmderr);
482 
483 void riscv_fill_dm_nop(const struct target *target, uint8_t *buf);
484 void riscv_fill_dmi_write(const struct target *target, uint8_t *buf, uint32_t a, uint32_t d);
485 void riscv_fill_dmi_read(const struct target *target, uint8_t *buf, uint32_t a);
486 unsigned int riscv_get_dmi_address_bits(const struct target *target);
487 
488 uint32_t riscv_get_dmi_address(const struct target *target, uint32_t dm_address);
489 
491 
494  struct watchpoint *watchpoint);
495 
496 void riscv_semihosting_init(struct target *target);
497 
498 enum semihosting_result riscv_semihosting(struct target *target, int *retval);
499 
500 void riscv_add_bscan_tunneled_scan(struct jtag_tap *tap, const struct scan_field *field,
502 
503 int riscv_read_by_any_size(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer);
504 int riscv_write_by_any_size(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer);
505 
506 #endif /* OPENOCD_TARGET_RISCV_RISCV_H */
enum arm_mode mode
Definition: armv4_5.c:281
uint64_t buffer
Pointer to data buffer to send over SPI.
Definition: dw-spi-helper.h:0
uint32_t size
Size of dw_spi_transaction::buffer.
Definition: dw-spi-helper.h:4
uint32_t address
Starting address. Sector aligned.
Definition: dw-spi-helper.h:0
The JTAG interface can be implemented with a software or hardware fifo.
struct qn908x_flash_bank __attribute__
Definition: armv8.c:1054
static bool riscv_mem_access_is_valid(const struct riscv_mem_access_args args)
Definition: riscv.h:148
struct scan_field select_idcode
Definition: riscv.c:53
unsigned int riscv_xlen(const struct target *target)
Definition: riscv.c:6060
struct target_type riscv011_target
Definition: riscv-011.c:2459
uint32_t bscan_tunneled_select_dmi_num_fields
struct scan_field select_dbus
Definition: riscv.c:48
void riscv_add_bscan_tunneled_scan(struct jtag_tap *tap, const struct scan_field *field, riscv_bscan_tunneled_scan_context_t *ctxt)
Definition: riscv.c:6292
static struct riscv_info * riscv_info(const struct target *target) __attribute__((unused))
Definition: riscv.h:421
static bool is_riscv(const struct riscv_info *riscv_info)
Definition: riscv.h:428
#define PG_MAX_LEVEL
Definition: riscv.h:36
unsigned int riscv_get_dmi_address_bits(const struct target *target)
Definition: riscv.c:6131
bool riscv_supports_extension(const struct target *target, char letter)
Definition: riscv.c:6047
void select_dmi_via_bscan(struct jtag_tap *tap)
Definition: riscv.c:319
int riscv_read_by_any_size(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
Read one memory item using any memory access size that will work.
Definition: riscv.c:1579
void riscv_semihosting_init(struct target *target)
Initialize RISC-V semihosting.
int riscv_halt(struct target *target)
Definition: riscv.c:2708
riscv_mem_access_method
Definition: riscv.h:56
@ RISCV_MEM_ACCESS_MAX_METHODS_NUM
Definition: riscv.h:60
@ RISCV_MEM_ACCESS_SYSBUS
Definition: riscv.h:58
@ RISCV_MEM_ACCESS_PROGBUF
Definition: riscv.h:57
@ RISCV_MEM_ACCESS_ABSTRACT
Definition: riscv.h:59
int riscv_write_by_any_size(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
Write one memory item using any memory access size that will work.
Definition: riscv.c:1547
unsigned int riscv_vlenb(const struct target *target)
Definition: riscv.c:6066
int riscv_get_hart_state(struct target *target, enum riscv_hart_state *state)
Definition: riscv.c:6072
riscv_hart_state
Definition: riscv.h:88
@ RISCV_STATE_RUNNING
Definition: riscv.h:90
@ RISCV_STATE_UNAVAILABLE
Definition: riscv.h:92
@ RISCV_STATE_NON_EXISTENT
Definition: riscv.h:89
@ RISCV_STATE_HALTED
Definition: riscv.h:91
struct target_type riscv013_target
Definition: riscv-013.c:5092
bool riscv_virt2phys_mode_is_hw(const struct target *target)
Definition: riscv.c:144
COMMAND_HELPER(riscv_print_info_line, const char *section, const char *key, unsigned int value)
Definition: riscv.c:5378
unsigned int riscv_progbuf_size(struct target *target)
Definition: riscv.c:6089
#define RISCV_MAX_HWBPS
Definition: riscv.h:22
enum semihosting_result riscv_semihosting(struct target *target, int *retval)
Check for and process a semihosting request using the ARM protocol).
#define RISCV_MAX_TRIGGERS
Definition: riscv.h:21
uint8_t bscan_tunnel_ir_width
Definition: riscv.c:60
struct scan_field * bscan_tunneled_select_dmi
riscv_priv_mode
Definition: riscv.h:370
@ RISCV_MODE_M
Definition: riscv.h:371
@ RISCV_MODE_U
Definition: riscv.h:373
@ N_RISCV_MODE
Definition: riscv.h:376
@ RISCV_MODE_VU
Definition: riscv.h:375
@ RISCV_MODE_VS
Definition: riscv.h:374
@ RISCV_MODE_S
Definition: riscv.h:372
struct scan_field select_dtmcontrol
Definition: riscv.c:43
void riscv_fill_dmi_write(const struct target *target, uint8_t *buf, uint32_t a, uint32_t d)
Definition: riscv.c:6113
uint64_t riscv_reg_t
Definition: riscv.h:46
int dtmcs_scan(struct jtag_tap *tap, uint32_t out, uint32_t *in_ptr)
Definition: riscv.c:416
const char * riscv_virt2phys_mode_to_str(enum riscv_virt2phys_mode mode)
Definition: riscv.c:158
int riscv_openocd_poll(struct target *target)
Definition: riscv.c:4016
int riscv_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
Definition: riscv.c:1735
#define RISCV_COMMON_MAGIC
Definition: riscv.h:18
uint32_t riscv_get_dmi_address(const struct target *target, uint32_t dm_address)
Definition: riscv.c:4649
static bool riscv_mem_access_is_write(const struct riscv_mem_access_args args)
Definition: riscv.h:161
int riscv_write_progbuf(struct target *target, unsigned int index, riscv_insn_t insn)
Definition: riscv.c:6095
riscv_insn_t riscv_read_progbuf(struct target *target, int index)
Definition: riscv.c:6101
bscan_tunnel_type_t
Definition: riscv.h:441
@ BSCAN_TUNNEL_NESTED_TAP
Definition: riscv.h:441
@ BSCAN_TUNNEL_DATA_REGISTER
Definition: riscv.h:441
void riscv_fill_dm_nop(const struct target *target, uint8_t *buf)
Definition: riscv.c:6125
static bool riscv_mem_access_is_read(const struct riscv_mem_access_args args)
Definition: riscv.h:154
void riscv_fill_dmi_read(const struct target *target, uint8_t *buf, uint32_t a)
Definition: riscv.c:6119
int riscv_execute_progbuf(struct target *target, uint32_t *cmderr)
Definition: riscv.c:6107
static struct riscv_private_config * riscv_private_config(const struct target *target)
Definition: riscv.h:384
bool riscv_virt2phys_mode_is_sw(const struct target *target)
Definition: riscv.c:151
yes_no_maybe
Definition: riscv.h:50
@ YNM_YES
Definition: riscv.h:52
@ YNM_MAYBE
Definition: riscv.h:51
@ YNM_NO
Definition: riscv.h:53
int riscv_remove_watchpoint(struct target *target, struct watchpoint *watchpoint)
Definition: riscv.c:1755
uint32_t riscv_insn_t
Definition: riscv.h:47
riscv_halt_reason
Definition: riscv.h:71
@ RISCV_HALT_INTERRUPT
Definition: riscv.h:72
@ RISCV_HALT_SINGLESTEP
Definition: riscv.h:74
@ RISCV_HALT_EBREAK
Definition: riscv.h:73
@ RISCV_HALT_UNKNOWN
Definition: riscv.h:76
@ RISCV_HALT_ERROR
Definition: riscv.h:78
@ RISCV_HALT_GROUP
Definition: riscv.h:77
@ RISCV_HALT_TRIGGER
Definition: riscv.h:75
int riscv_get_command_timeout_sec(void)
Definition: riscv.c:179
int riscv_enumerate_triggers(struct target *target)
Count triggers, and initialize trigger_count for each hart.
Definition: riscv.c:6216
uint64_t riscv_addr_t
Definition: riscv.h:48
int riscv_openocd_step(struct target *target, bool current, target_addr_t address, bool handle_breakpoints)
Definition: riscv.c:4287
riscv_virt2phys_mode
Definition: riscv.h:63
@ RISCV_VIRT2PHYS_MODE_HW
Definition: riscv.h:64
@ RISCV_VIRT2PHYS_MODE_OFF
Definition: riscv.h:66
@ RISCV_VIRT2PHYS_MODE_SW
Definition: riscv.h:65
riscv_isrmasking_mode
Definition: riscv.h:81
@ RISCV_ISRMASK_OFF
Definition: riscv.h:83
@ RISCV_ISRMASK_STEPONLY
Definition: riscv.h:85
struct target * target
Definition: rtt/rtt.c:26
semihosting_result
Definition: jtag.h:101
Definition: list.h:41
char * name
Definition: riscv.h:122
uint16_t high
Definition: riscv.h:121
char ** reg_names
Definition: riscv.h:133
unsigned int num_entries
Definition: riscv.h:132
int(* on_step)(struct target *target)
Definition: riscv.h:275
bool(* get_impebreak)(const struct target *target)
Definition: riscv.h:292
void * version_specific
Definition: riscv.h:174
int(* tick)(struct target *target)
Definition: riscv.h:268
int(* dmi_read)(struct target *target, uint32_t *value, uint32_t address)
Definition: riscv.h:289
struct reg_data_type_vector vector_uint8
Definition: riscv.h:316
enum target_event halted_callback_event
Definition: riscv.h:241
int(* select_target)(struct target *target)
Definition: riscv.h:248
enum riscv_virt2phys_mode virt2phys_mode
Definition: riscv.h:226
struct reg_data_type type_uint64_vector
Definition: riscv.h:324
unsigned int trigger_tinfo[RISCV_MAX_TRIGGERS]
Definition: riscv.h:199
struct reg_data_type type_uint16_vector
Definition: riscv.h:322
bool wp_allow_equality_match_trigger
Definition: riscv.h:363
struct list_head expose_custom
Definition: riscv.h:347
struct reg_data_type_vector vector_uint16
Definition: riscv.h:317
struct list_head * wp_triggers_negative_cache
Definition: riscv.h:196
int(* handle_became_unavailable)(struct target *target, enum riscv_hart_state previous_riscv_state)
Definition: riscv.h:263
int(* halt_go)(struct target *target)
Definition: riscv.h:274
struct reg_data_type type_vector
Definition: riscv.h:328
int tinfo_version
Definition: riscv.h:202
int(* handle_became_halted)(struct target *target, enum riscv_hart_state previous_riscv_state)
Definition: riscv.h:259
struct reg_data_type_union_field vector_fields[5]
Definition: riscv.h:326
unsigned int(* get_progbufsize)(const struct target *target)
Definition: riscv.h:293
int64_t trigger_unique_id[RISCV_MAX_HWBPS]
Definition: riscv.h:219
riscv_insn_t(* read_progbuf)(struct target *target, unsigned int index)
Definition: riscv.h:278
bool selected
Definition: riscv.h:237
bool * reserved_triggers
Definition: riscv.h:330
bool triggers_enumerated
Definition: riscv.h:228
int xlen
Definition: riscv.h:180
struct reg_data_type type_uint128_vector
Definition: riscv.h:325
unsigned int vlenb
Definition: riscv.h:187
bool prepped
Definition: riscv.h:235
unsigned int num_enabled_mem_access_methods
Definition: riscv.h:335
enum riscv_isrmasking_mode isrmask_mode
Definition: riscv.h:244
int(* handle_became_running)(struct target *target, enum riscv_hart_state previous_riscv_state)
Definition: riscv.h:261
unsigned int(* get_dmi_address_bits)(const struct target *target)
Definition: riscv.h:281
int(* authdata_write)(struct target *target, uint32_t value, unsigned int index)
Definition: riscv.h:287
int(* write_progbuf)(struct target *target, unsigned int index, riscv_insn_t d)
Definition: riscv.h:277
int64_t last_activity
Definition: riscv.h:357
unsigned int dtm_version
Definition: riscv.h:171
struct reg_name_table custom_register_names
Definition: riscv.h:176
int(* execute_progbuf)(struct target *target, uint32_t *cmderr)
Definition: riscv.h:279
unsigned int halt_group_repoll_count
Definition: riscv.h:242
unsigned int(* data_bits)(struct target *target)
Definition: riscv.h:308
struct list_head expose_csr
Definition: riscv.h:343
bool halted_needs_event_callback
Definition: riscv.h:240
struct reg_data_type type_uint32_vector
Definition: riscv.h:323
int(* resume_prep)(struct target *target)
Definition: riscv.h:272
int(* halt_prep)(struct target *target)
Definition: riscv.h:273
int64_t trigger_hit
Definition: riscv.h:223
int reset_delays_wait
Definition: riscv.h:232
enum yes_no_maybe vsew64_supported
Definition: riscv.h:359
int(* dmi_write)(struct target *target, uint32_t address, uint32_t value)
Definition: riscv.h:290
bool autofence
Definition: riscv.h:367
void(* fill_dmi_write)(const struct target *target, uint8_t *buf, uint32_t a, uint32_t d)
Definition: riscv.h:282
riscv_reg_t misa
Definition: riscv.h:182
void(* fill_dmi_read)(const struct target *target, uint8_t *buf, uint32_t a)
Definition: riscv.h:283
riscv_sample_config_t sample_config
Definition: riscv.h:353
COMMAND_HELPER((*print_info), struct target *target)
bool range_trigger_fallback_encountered
Definition: riscv.h:361
unsigned int common_magic
Definition: riscv.h:169
bool mem_access_warn[RISCV_MEM_ACCESS_MAX_METHODS_NUM]
Definition: riscv.h:339
int(* sample_memory)(struct target *target, struct riscv_sample_buf *buf, riscv_sample_config_t *config, int64_t until_ms)
Definition: riscv.h:301
int(* authdata_read)(struct target *target, uint32_t *value, unsigned int index)
Definition: riscv.h:286
int(* access_memory)(struct target *target, const struct riscv_mem_access_args args)
Definition: riscv.h:306
uint32_t(* get_dmi_address)(const struct target *target, uint32_t dm_address)
Definition: riscv.h:299
struct reg_data_type type_uint8_vector
Definition: riscv.h:321
bool wp_allow_ge_lt_trigger
Definition: riscv.h:365
int(* get_hart_state)(struct target *target, enum riscv_hart_state *state)
Definition: riscv.h:249
riscv_reg_info_t shared_reg_info
Definition: riscv.h:313
struct reg_data_type_vector vector_uint32
Definition: riscv.h:318
struct riscv_sample_buf sample_buf
Definition: riscv.h:354
char ** reg_names
Definition: riscv.h:177
struct reg_data_type_union vector_union
Definition: riscv.h:327
unsigned int trigger_count
Definition: riscv.h:190
int(* step_current_hart)(struct target *target)
Definition: riscv.h:254
struct reg_data_type_vector vector_uint64
Definition: riscv.h:319
struct command_context * cmd_ctx
Definition: riscv.h:173
void(* fill_dm_nop)(const struct target *target, uint8_t *buf)
Definition: riscv.h:284
enum riscv_halt_reason(* halt_reason)(struct target *target)
Definition: riscv.h:276
int(* invalidate_cached_progbuf)(struct target *target)
Definition: riscv.h:280
enum riscv_mem_access_method mem_access_methods[RISCV_MEM_ACCESS_MAX_METHODS_NUM]
Definition: riscv.h:333
bool wp_allow_napot_trigger
Definition: riscv.h:364
struct list_head hide_csr
Definition: riscv.h:351
bool need_single_step
Definition: riscv.h:210
struct reg_data_type_vector vector_uint128
Definition: riscv.h:320
int(* resume_go)(struct target *target)
Definition: riscv.h:253
uint32_t increment
Definition: riscv.h:144
uint8_t * read_buffer
Definition: riscv.h:140
const uint8_t * write_buffer
Definition: riscv.h:139
target_addr_t address
Definition: riscv.h:137
uint32_t count
Definition: riscv.h:143
bool dcsr_ebreak_fields[N_RISCV_MODE]
Definition: riscv.h:380
struct target * target
Definition: riscv.h:97
unsigned int custom_number
Definition: riscv.h:99
unsigned int size
Definition: riscv.h:107
uint8_t * buf
Definition: riscv.h:105
unsigned int used
Definition: riscv.h:106
target_addr_t address
Definition: riscv.h:114
This structure defines a single scan field in the scan.
Definition: jtag.h:87
This holds methods shared between all instances of a given target type.
Definition: target_type.h:26
Definition: target.h:119
void * private_config
Definition: target.h:168
void * arch_info
Definition: target.h:167
unsigned int pte_shift
Definition: riscv.h:403
const char * name
Definition: riscv.h:399
unsigned int va_bits
Definition: riscv.h:401
target_event
Definition: target.h:243
uint64_t target_addr_t
Definition: types.h:279
static struct ublast_lowlevel low
uint8_t state[4]
Definition: vdebug.c:21