Skip to content

Commit a450a7d

Browse files
committed
Fix data types around batch.{c,h}
Check that the value of dtmcs.abits is in the expected range. Make corrections of data types in batch.{c,h} and in related code. Some of the issues were found by activating "-Wconversion" in GCC, others by inspecting the code manually. This is an initial step towards being able to use "-Wconversion" on RISC-V target code, which will give us bit more confidence when refactoring or merging new patches. Changes made: - Check `dtmcs.abits` during examination. - DMI address is no larger than 32-bits per the debug spec. Changed address parameters of multiple functions from uint64_t to uint32_t. - The value passed to jtag_add_runtest() is now `unsigned int`, not `int`. No need for `assert(idle <= INT_MAX)` anymore. - `get_delay()` in batch.c can return an unsigned value. - Added few assertions around `field->num_bits` in batch.c. Change-Id: Ibfccd62d552063df6ab9b5a2d4ea4ed23617d3db Signed-off-by: Jan Matyas <[email protected]>
1 parent f82c5a7 commit a450a7d

File tree

5 files changed

+124
-64
lines changed

5 files changed

+124
-64
lines changed

src/target/riscv/batch.c

Lines changed: 62 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,24 @@
1010
#include "riscv.h"
1111
#include "field_helpers.h"
1212

13+
// TODO: DTM_DMI_MAX_ADDRESS_LENGTH should be reduced to 32 (per the debug spec)
1314
#define DTM_DMI_MAX_ADDRESS_LENGTH ((1<<DTM_DTMCS_ABITS_LENGTH)-1)
1415
#define DMI_SCAN_MAX_BIT_LENGTH (DTM_DMI_MAX_ADDRESS_LENGTH + DTM_DMI_DATA_LENGTH + DTM_DMI_OP_LENGTH)
16+
1517
#define DMI_SCAN_BUF_SIZE (DIV_ROUND_UP(DMI_SCAN_MAX_BIT_LENGTH, 8))
1618

1719
/* Reserve extra room in the batch (needed for the last NOP operation) */
1820
#define BATCH_RESERVED_SCANS 1
1921

22+
static unsigned int get_dmi_scan_length(const struct target *target)
23+
{
24+
const unsigned int abits = riscv_get_dmi_address_bits(target);
25+
assert(abits > 0);
26+
assert(abits <= DTM_DMI_MAX_ADDRESS_LENGTH);
27+
28+
return abits + DTM_DMI_DATA_LENGTH + DTM_DMI_OP_LENGTH;
29+
}
30+
2031
struct riscv_batch *riscv_batch_alloc(struct target *target, size_t scans)
2132
{
2233
scans += BATCH_RESERVED_SCANS;
@@ -127,11 +138,10 @@ static void add_idle_before_batch(const struct riscv_batch *batch, size_t start_
127138
const unsigned int idle_change = new_delay - batch->last_scan_delay;
128139
LOG_TARGET_DEBUG(batch->target, "Adding %u idle cycles before the batch.",
129140
idle_change);
130-
assert(idle_change <= INT_MAX);
131141
jtag_add_runtest(idle_change, TAP_IDLE);
132142
}
133143

134-
static int get_delay(const struct riscv_batch *batch, size_t scan_idx,
144+
static unsigned int get_delay(const struct riscv_batch *batch, size_t scan_idx,
135145
const struct riscv_scan_delays *delays, bool resets_delays,
136146
size_t reset_delays_after)
137147
{
@@ -142,7 +152,6 @@ static int get_delay(const struct riscv_batch *batch, size_t scan_idx,
142152
const enum riscv_scan_delay_class delay_class =
143153
batch->delay_classes[scan_idx];
144154
const unsigned int delay = riscv_scan_get_delay(delays, delay_class);
145-
assert(delay <= INT_MAX);
146155
return delays_were_reset ? 0 : delay;
147156
}
148157

@@ -198,10 +207,7 @@ static void log_batch(const struct riscv_batch *batch, size_t start_idx,
198207
if (debug_level < LOG_LVL_DEBUG)
199208
return;
200209

201-
const unsigned int scan_bits = batch->fields->num_bits;
202-
assert(scan_bits == (unsigned int)riscv_get_dmi_scan_length(batch->target));
203-
const unsigned int abits = scan_bits - DTM_DMI_OP_LENGTH
204-
- DTM_DMI_DATA_LENGTH;
210+
const unsigned int abits = riscv_get_dmi_address_bits(batch->target);
205211

206212
/* Determine the "op" and "address" of the scan that preceded the first
207213
* executed scan.
@@ -211,7 +217,7 @@ static void log_batch(const struct riscv_batch *batch, size_t start_idx,
211217
* would be a more robust solution.
212218
*/
213219
bool last_scan_was_read = false;
214-
uint32_t last_scan_address = -1 /* to silence maybe-uninitialized */;
220+
uint32_t last_scan_address = (uint32_t)(-1) /* to silence maybe-uninitialized */;
215221
if (start_idx > 0) {
216222
const struct scan_field * const field = &batch->fields[start_idx - 1];
217223
assert(field->out_value);
@@ -224,7 +230,7 @@ static void log_batch(const struct riscv_batch *batch, size_t start_idx,
224230
/* Decode and log every executed scan */
225231
for (size_t i = start_idx; i < batch->used_scans; ++i) {
226232
static const char * const op_string[] = {"-", "r", "w", "?"};
227-
const int delay = get_delay(batch, i, delays, resets_delays,
233+
const unsigned int delay = get_delay(batch, i, delays, resets_delays,
228234
reset_delays_after);
229235
const struct scan_field * const field = &batch->fields[i];
230236

@@ -247,15 +253,15 @@ static void log_batch(const struct riscv_batch *batch, size_t start_idx,
247253
DTM_DMI_ADDRESS_OFFSET, abits);
248254

249255
LOG_DEBUG("%db %s %08" PRIx32 " @%02" PRIx32
250-
" -> %s %08" PRIx32 " @%02" PRIx32 "; %di",
256+
" -> %s %08" PRIx32 " @%02" PRIx32 "; %ui",
251257
field->num_bits, op_string[out_op], out_data, out_address,
252258
status_string[in_op], in_data, in_address, delay);
253259

254260
if (last_scan_was_read && in_op == DTM_DMI_OP_SUCCESS)
255261
log_dmi_decoded(batch, /*write*/ false,
256262
last_scan_address, in_data);
257263
} else {
258-
LOG_DEBUG("%db %s %08" PRIx32 " @%02" PRIx32 " -> ?; %di",
264+
LOG_DEBUG("%db %s %08" PRIx32 " @%02" PRIx32 " -> ?; %ui",
259265
field->num_bits, op_string[out_op], out_data, out_address,
260266
delay);
261267
}
@@ -321,35 +327,56 @@ int riscv_batch_run_from(struct riscv_batch *batch, size_t start_idx,
321327
return ERROR_OK;
322328
}
323329

324-
void riscv_batch_add_dmi_write(struct riscv_batch *batch, uint64_t address, uint32_t data,
330+
void riscv_batch_add_dmi_write(struct riscv_batch *batch, uint32_t address, uint32_t data,
325331
bool read_back, enum riscv_scan_delay_class delay_class)
326332
{
333+
// TODO: Check that the bit width of "address" is no more than dtmcs.abits,
334+
// otherwise return an error (during batch creation or when the batch is executed).
335+
327336
assert(batch->used_scans < batch->allocated_scans);
328337
struct scan_field *field = batch->fields + batch->used_scans;
329-
field->num_bits = riscv_get_dmi_scan_length(batch->target);
330-
field->out_value = (void *)(batch->data_out + batch->used_scans * DMI_SCAN_BUF_SIZE);
331-
riscv_fill_dmi_write(batch->target, (char *)field->out_value, address, data);
338+
339+
field->num_bits = get_dmi_scan_length(batch->target);
340+
assert(field->num_bits <= DMI_SCAN_MAX_BIT_LENGTH);
341+
342+
uint8_t *out_value = batch->data_out + batch->used_scans * DMI_SCAN_BUF_SIZE;
343+
uint8_t *in_value = batch->data_in + batch->used_scans * DMI_SCAN_BUF_SIZE;
344+
345+
field->out_value = out_value;
346+
riscv_fill_dmi_write(batch->target, out_value, address, data);
347+
332348
if (read_back) {
333-
field->in_value = (void *)(batch->data_in + batch->used_scans * DMI_SCAN_BUF_SIZE);
334-
riscv_fill_dm_nop(batch->target, (char *)field->in_value);
349+
field->in_value = in_value;
350+
riscv_fill_dm_nop(batch->target, in_value);
335351
} else {
336352
field->in_value = NULL;
337353
}
354+
338355
batch->delay_classes[batch->used_scans] = delay_class;
339356
batch->last_scan = RISCV_SCAN_TYPE_WRITE;
340357
batch->used_scans++;
341358
}
342359

343-
size_t riscv_batch_add_dmi_read(struct riscv_batch *batch, uint64_t address,
360+
size_t riscv_batch_add_dmi_read(struct riscv_batch *batch, uint32_t address,
344361
enum riscv_scan_delay_class delay_class)
345362
{
363+
// TODO: Check that the bit width of "address" is no more than dtmcs.abits,
364+
// otherwise return an error (during batch creation or when the batch is executed).
365+
346366
assert(batch->used_scans < batch->allocated_scans);
347367
struct scan_field *field = batch->fields + batch->used_scans;
348-
field->num_bits = riscv_get_dmi_scan_length(batch->target);
349-
field->out_value = (void *)(batch->data_out + batch->used_scans * DMI_SCAN_BUF_SIZE);
350-
field->in_value = (void *)(batch->data_in + batch->used_scans * DMI_SCAN_BUF_SIZE);
351-
riscv_fill_dmi_read(batch->target, (char *)field->out_value, address);
352-
riscv_fill_dm_nop(batch->target, (char *)field->in_value);
368+
369+
field->num_bits = get_dmi_scan_length(batch->target);
370+
assert(field->num_bits <= DMI_SCAN_MAX_BIT_LENGTH);
371+
372+
uint8_t *out_value = batch->data_out + batch->used_scans * DMI_SCAN_BUF_SIZE;
373+
uint8_t *in_value = batch->data_in + batch->used_scans * DMI_SCAN_BUF_SIZE;
374+
375+
field->out_value = out_value;
376+
field->in_value = in_value;
377+
riscv_fill_dmi_read(batch->target, out_value, address);
378+
riscv_fill_dm_nop(batch->target, in_value);
379+
353380
batch->delay_classes[batch->used_scans] = delay_class;
354381
batch->last_scan = RISCV_SCAN_TYPE_READ;
355382
batch->used_scans++;
@@ -382,11 +409,18 @@ void riscv_batch_add_nop(struct riscv_batch *batch)
382409
{
383410
assert(batch->used_scans < batch->allocated_scans);
384411
struct scan_field *field = batch->fields + batch->used_scans;
385-
field->num_bits = riscv_get_dmi_scan_length(batch->target);
386-
field->out_value = (void *)(batch->data_out + batch->used_scans * DMI_SCAN_BUF_SIZE);
387-
field->in_value = (void *)(batch->data_in + batch->used_scans * DMI_SCAN_BUF_SIZE);
388-
riscv_fill_dm_nop(batch->target, (char *)field->out_value);
389-
riscv_fill_dm_nop(batch->target, (char *)field->in_value);
412+
413+
field->num_bits = get_dmi_scan_length(batch->target);
414+
assert(field->num_bits <= DMI_SCAN_MAX_BIT_LENGTH);
415+
416+
uint8_t *out_value = batch->data_out + batch->used_scans * DMI_SCAN_BUF_SIZE;
417+
uint8_t *in_value = batch->data_in + batch->used_scans * DMI_SCAN_BUF_SIZE;
418+
419+
field->out_value = out_value;
420+
field->in_value = in_value;
421+
riscv_fill_dm_nop(batch->target, out_value);
422+
riscv_fill_dm_nop(batch->target, in_value);
423+
390424
/* DMI NOP never triggers any debug module operation,
391425
* so the shortest (base) delay can be used. */
392426
batch->delay_classes[batch->used_scans] = RISCV_DELAY_BASE;

src/target/riscv/batch.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,11 @@ int riscv_batch_run_from(struct riscv_batch *batch, size_t start_idx,
190190
size_t riscv_batch_finished_scans(const struct riscv_batch *batch);
191191

192192
/* Adds a DM register write to this batch. */
193-
void riscv_batch_add_dmi_write(struct riscv_batch *batch, uint64_t address, uint32_t data,
193+
void riscv_batch_add_dmi_write(struct riscv_batch *batch, uint32_t address, uint32_t data,
194194
bool read_back, enum riscv_scan_delay_class delay_class);
195195

196196
static inline void
197-
riscv_batch_add_dm_write(struct riscv_batch *batch, uint64_t address, uint32_t data,
197+
riscv_batch_add_dm_write(struct riscv_batch *batch, uint32_t address, uint32_t data,
198198
bool read_back, enum riscv_scan_delay_class delay_type)
199199
{
200200
return riscv_batch_add_dmi_write(batch,
@@ -205,11 +205,11 @@ riscv_batch_add_dm_write(struct riscv_batch *batch, uint64_t address, uint32_t d
205205
/* DM register reads must be handled in two parts: the first one schedules a read and
206206
* provides a key, the second one actually obtains the result of the read -
207207
* status (op) and the actual data. */
208-
size_t riscv_batch_add_dmi_read(struct riscv_batch *batch, uint64_t address,
208+
size_t riscv_batch_add_dmi_read(struct riscv_batch *batch, uint32_t address,
209209
enum riscv_scan_delay_class delay_class);
210210

211211
static inline size_t
212-
riscv_batch_add_dm_read(struct riscv_batch *batch, uint64_t address,
212+
riscv_batch_add_dm_read(struct riscv_batch *batch, uint32_t address,
213213
enum riscv_scan_delay_class delay_type)
214214
{
215215
return riscv_batch_add_dmi_read(batch,

src/target/riscv/riscv-013.c

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ static riscv_insn_t riscv013_read_progbuf(struct target *target, unsigned int
5656
index);
5757
static int riscv013_invalidate_cached_progbuf(struct target *target);
5858
static int riscv013_execute_progbuf(struct target *target, uint32_t *cmderr);
59-
static void riscv013_fill_dmi_write(struct target *target, char *buf, uint64_t a, uint32_t d);
60-
static void riscv013_fill_dmi_read(struct target *target, char *buf, uint64_t a);
61-
static int riscv013_get_dmi_scan_length(struct target *target);
62-
static void riscv013_fill_dm_nop(struct target *target, char *buf);
59+
static void riscv013_fill_dmi_write(const struct target *target, uint8_t *buf, uint32_t a, uint32_t d);
60+
static void riscv013_fill_dmi_read(const struct target *target, uint8_t *buf, uint32_t a);
61+
static unsigned int riscv013_get_dmi_address_bits(const struct target *target);
62+
static void riscv013_fill_dm_nop(const struct target *target, uint8_t *buf);
6363
static unsigned int register_size(struct target *target, enum gdb_regno number);
6464
static int register_read_direct(struct target *target, riscv_reg_t *value,
6565
enum gdb_regno number);
@@ -1941,6 +1941,29 @@ static int examine(struct target *target)
19411941
info->abits = get_field(dtmcontrol, DTM_DTMCS_ABITS);
19421942
info->dtmcs_idle = get_field(dtmcontrol, DTM_DTMCS_IDLE);
19431943

1944+
if (info->abits > RISCV013_DTMCS_ABITS_MAX) {
1945+
/* Max. address width given by the debug specification is exceeded */
1946+
LOG_TARGET_ERROR(target, "The target's debug bus (DMI) address width exceeds "
1947+
"the maximum:");
1948+
LOG_TARGET_ERROR(target, " found dtmcs.abits = %d; maximum is abits = %d.",
1949+
info->abits, RISCV013_DTMCS_ABITS_MAX);
1950+
return ERROR_FAIL;
1951+
}
1952+
1953+
if (info->abits < RISCV013_DTMCS_ABITS_MIN) {
1954+
/* The requirement for minimum DMI address width of 7 bits is part of
1955+
* the RISC-V Debug spec since Jan-20-2017 (commit 03df6ee7). However,
1956+
* implementations exist that implement narrower DMI address. For example
1957+
* Spike as of Q1/2025 uses dmi.abits = 6.
1958+
*
1959+
* For that reason, warn the user but continue.
1960+
*/
1961+
LOG_TARGET_WARNING(target, "The target's debug bus (DMI) address width is "
1962+
"lower than the minimum:");
1963+
LOG_TARGET_WARNING(target, " found dtmcs.abits = %d; minimum is abits = %d.",
1964+
info->abits, RISCV013_DTMCS_ABITS_MIN);
1965+
}
1966+
19441967
if (!check_dbgbase_exists(target)) {
19451968
LOG_TARGET_ERROR(target, "Could not find debug module with DMI base address (dbgbase) = 0x%x", target->dbgbase);
19461969
return ERROR_FAIL;
@@ -2771,7 +2794,7 @@ static int init_target(struct command_context *cmd_ctx,
27712794
generic_info->fill_dmi_write = &riscv013_fill_dmi_write;
27722795
generic_info->fill_dmi_read = &riscv013_fill_dmi_read;
27732796
generic_info->fill_dm_nop = &riscv013_fill_dm_nop;
2774-
generic_info->get_dmi_scan_length = &riscv013_get_dmi_scan_length;
2797+
generic_info->get_dmi_address_bits = &riscv013_get_dmi_address_bits;
27752798
generic_info->authdata_read = &riscv013_authdata_read;
27762799
generic_info->authdata_write = &riscv013_authdata_write;
27772800
generic_info->dmi_read = &dmi_read;
@@ -5390,34 +5413,34 @@ static int riscv013_execute_progbuf(struct target *target, uint32_t *cmderr)
53905413
return riscv013_execute_abstract_command(target, run_program, cmderr);
53915414
}
53925415

5393-
static void riscv013_fill_dmi_write(struct target *target, char *buf, uint64_t a, uint32_t d)
5416+
static void riscv013_fill_dmi_write(const struct target *target, uint8_t *buf, uint32_t a, uint32_t d)
53945417
{
53955418
RISCV013_INFO(info);
5396-
buf_set_u64((unsigned char *)buf, DTM_DMI_OP_OFFSET, DTM_DMI_OP_LENGTH, DMI_OP_WRITE);
5397-
buf_set_u64((unsigned char *)buf, DTM_DMI_DATA_OFFSET, DTM_DMI_DATA_LENGTH, d);
5398-
buf_set_u64((unsigned char *)buf, DTM_DMI_ADDRESS_OFFSET, info->abits, a);
5419+
buf_set_u32(buf, DTM_DMI_OP_OFFSET, DTM_DMI_OP_LENGTH, DMI_OP_WRITE);
5420+
buf_set_u32(buf, DTM_DMI_DATA_OFFSET, DTM_DMI_DATA_LENGTH, d);
5421+
buf_set_u32(buf, DTM_DMI_ADDRESS_OFFSET, info->abits, a);
53995422
}
54005423

5401-
static void riscv013_fill_dmi_read(struct target *target, char *buf, uint64_t a)
5424+
static void riscv013_fill_dmi_read(const struct target *target, uint8_t *buf, uint32_t a)
54025425
{
54035426
RISCV013_INFO(info);
5404-
buf_set_u64((unsigned char *)buf, DTM_DMI_OP_OFFSET, DTM_DMI_OP_LENGTH, DMI_OP_READ);
5405-
buf_set_u64((unsigned char *)buf, DTM_DMI_DATA_OFFSET, DTM_DMI_DATA_LENGTH, 0);
5406-
buf_set_u64((unsigned char *)buf, DTM_DMI_ADDRESS_OFFSET, info->abits, a);
5427+
buf_set_u32(buf, DTM_DMI_OP_OFFSET, DTM_DMI_OP_LENGTH, DMI_OP_READ);
5428+
buf_set_u32(buf, DTM_DMI_DATA_OFFSET, DTM_DMI_DATA_LENGTH, 0);
5429+
buf_set_u32(buf, DTM_DMI_ADDRESS_OFFSET, info->abits, a);
54075430
}
54085431

5409-
static void riscv013_fill_dm_nop(struct target *target, char *buf)
5432+
static void riscv013_fill_dm_nop(const struct target *target, uint8_t *buf)
54105433
{
54115434
RISCV013_INFO(info);
5412-
buf_set_u64((unsigned char *)buf, DTM_DMI_OP_OFFSET, DTM_DMI_OP_LENGTH, DMI_OP_NOP);
5413-
buf_set_u64((unsigned char *)buf, DTM_DMI_DATA_OFFSET, DTM_DMI_DATA_LENGTH, 0);
5414-
buf_set_u64((unsigned char *)buf, DTM_DMI_ADDRESS_OFFSET, info->abits, 0);
5435+
buf_set_u32(buf, DTM_DMI_OP_OFFSET, DTM_DMI_OP_LENGTH, DMI_OP_NOP);
5436+
buf_set_u32(buf, DTM_DMI_DATA_OFFSET, DTM_DMI_DATA_LENGTH, 0);
5437+
buf_set_u32(buf, DTM_DMI_ADDRESS_OFFSET, info->abits, 0);
54155438
}
54165439

5417-
static int riscv013_get_dmi_scan_length(struct target *target)
5440+
static unsigned int riscv013_get_dmi_address_bits(const struct target *target)
54185441
{
54195442
RISCV013_INFO(info);
5420-
return info->abits + DTM_DMI_DATA_LENGTH + DTM_DMI_OP_LENGTH;
5443+
return info->abits;
54215444
}
54225445

54235446
/* Helper Functions. */

src/target/riscv/riscv.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5890,28 +5890,28 @@ int riscv_execute_progbuf(struct target *target, uint32_t *cmderr)
58905890
return r->execute_progbuf(target, cmderr);
58915891
}
58925892

5893-
void riscv_fill_dmi_write(struct target *target, char *buf, uint64_t a, uint32_t d)
5893+
void riscv_fill_dmi_write(const struct target *target, uint8_t *buf, uint32_t a, uint32_t d)
58945894
{
58955895
RISCV_INFO(r);
58965896
r->fill_dmi_write(target, buf, a, d);
58975897
}
58985898

5899-
void riscv_fill_dmi_read(struct target *target, char *buf, uint64_t a)
5899+
void riscv_fill_dmi_read(const struct target *target, uint8_t *buf, uint32_t a)
59005900
{
59015901
RISCV_INFO(r);
59025902
r->fill_dmi_read(target, buf, a);
59035903
}
59045904

5905-
void riscv_fill_dm_nop(struct target *target, char *buf)
5905+
void riscv_fill_dm_nop(const struct target *target, uint8_t *buf)
59065906
{
59075907
RISCV_INFO(r);
59085908
r->fill_dm_nop(target, buf);
59095909
}
59105910

5911-
int riscv_get_dmi_scan_length(struct target *target)
5911+
unsigned int riscv_get_dmi_address_bits(const struct target *target)
59125912
{
59135913
RISCV_INFO(r);
5914-
return r->get_dmi_scan_length(target);
5914+
return r->get_dmi_address_bits(target);
59155915
}
59165916

59175917
static int check_if_trigger_exists(struct target *target, unsigned int index)

src/target/riscv/riscv.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ typedef struct {
125125
#define DTM_DTMCS_VERSION_UNKNOWN ((unsigned int)-1)
126126
#define RISCV_TINFO_VERSION_UNKNOWN (-1)
127127

128+
#define RISCV013_DTMCS_ABITS_MIN 7
129+
#define RISCV013_DTMCS_ABITS_MAX 32
130+
128131
struct reg_name_table {
129132
unsigned int num_entries;
130133
char **reg_names;
@@ -275,10 +278,10 @@ struct riscv_info {
275278
riscv_insn_t (*read_progbuf)(struct target *target, unsigned int index);
276279
int (*execute_progbuf)(struct target *target, uint32_t *cmderr);
277280
int (*invalidate_cached_progbuf)(struct target *target);
278-
int (*get_dmi_scan_length)(struct target *target);
279-
void (*fill_dmi_write)(struct target *target, char *buf, uint64_t a, uint32_t d);
280-
void (*fill_dmi_read)(struct target *target, char *buf, uint64_t a);
281-
void (*fill_dm_nop)(struct target *target, char *buf);
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);
282285

283286
int (*authdata_read)(struct target *target, uint32_t *value, unsigned int index);
284287
int (*authdata_write)(struct target *target, uint32_t value, unsigned int index);
@@ -462,10 +465,10 @@ riscv_insn_t riscv_read_progbuf(struct target *target, int index);
462465
int riscv_write_progbuf(struct target *target, int index, riscv_insn_t insn);
463466
int riscv_execute_progbuf(struct target *target, uint32_t *cmderr);
464467

465-
void riscv_fill_dm_nop(struct target *target, char *buf);
466-
void riscv_fill_dmi_write(struct target *target, char *buf, uint64_t a, uint32_t d);
467-
void riscv_fill_dmi_read(struct target *target, char *buf, uint64_t a);
468-
int riscv_get_dmi_scan_length(struct target *target);
468+
void riscv_fill_dm_nop(const struct target *target, uint8_t *buf);
469+
void riscv_fill_dmi_write(const struct target *target, uint8_t *buf, uint32_t a, uint32_t d);
470+
void riscv_fill_dmi_read(const struct target *target, uint8_t *buf, uint32_t a);
471+
unsigned int riscv_get_dmi_address_bits(const struct target *target);
469472

470473
uint32_t riscv_get_dmi_address(const struct target *target, uint32_t dm_address);
471474

0 commit comments

Comments
 (0)