Skip to content

Commit 459b39e

Browse files
mwachs5palmer-dabbelt
authored andcommitted
riscv: v13 -- dmi_write must still check for the OP result
1 parent 11008ba commit 459b39e

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

src/target/riscv/riscv-013.c

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -198,23 +198,18 @@ static void dump_field(const struct scan_field *field)
198198
unsigned int out_data = get_field(out, DTM_DMI_DATA);
199199
unsigned int out_address = out >> DTM_DMI_ADDRESS_OFFSET;
200200

201-
if (field->in_value) {
202-
uint64_t in = buf_get_u64(field->in_value, 0, field->num_bits);
203-
unsigned int in_op = get_field(in, DTM_DMI_OP);
204-
unsigned int in_data = get_field(in, DTM_DMI_DATA);
205-
unsigned int in_address = in >> DTM_DMI_ADDRESS_OFFSET;
206-
207-
log_printf_lf(LOG_LVL_DEBUG,
208-
__FILE__, __LINE__, "scan",
209-
"%db %s %08x @%02x -> %s %08x @%02x",
210-
field->num_bits,
211-
op_string[out_op], out_data, out_address,
212-
status_string[in_op], in_data, in_address);
213-
} else {
214-
log_printf_lf(LOG_LVL_DEBUG,
215-
__FILE__, __LINE__, "scan", "%db %s %08x @%02x -> ?",
216-
field->num_bits, op_string[out_op], out_data, out_address);
217-
}
201+
uint64_t in = buf_get_u64(field->in_value, 0, field->num_bits);
202+
unsigned int in_op = get_field(in, DTM_DMI_OP);
203+
unsigned int in_data = get_field(in, DTM_DMI_DATA);
204+
unsigned int in_address = in >> DTM_DMI_ADDRESS_OFFSET;
205+
206+
log_printf_lf(LOG_LVL_DEBUG,
207+
__FILE__, __LINE__, "scan",
208+
"%db %s %08x @%02x -> %s %08x @%02x",
209+
field->num_bits,
210+
op_string[out_op], out_data, out_address,
211+
status_string[in_op], in_data, in_address);
212+
218213
}
219214

220215
static riscv013_info_t *get_info(const struct target *target)
@@ -325,9 +320,10 @@ static dmi_status_t dmi_scan(struct target *target, uint16_t *address_in,
325320
.out_value = out,
326321
};
327322

328-
if (address_in || data_in) {
329-
field.in_value = in;
330-
}
323+
// We need to always do this so that we can
324+
// get the OP result, even if we don't care about
325+
// the data itself.
326+
field.in_value = in;
331327

332328
assert(info->abits != 0);
333329

@@ -380,7 +376,7 @@ static uint64_t dmi_read(struct target *target, uint16_t address)
380376
// it is actually due to the Previous dmi_read or dmi_write.
381377
for (i = 0; i < 256; i++) {
382378
status = dmi_scan(target, NULL, NULL, DMI_OP_READ, address, 0,
383-
false);
379+
false);
384380
if (status == DMI_STATUS_BUSY) {
385381
increase_dmi_busy_delay(target);
386382
} else if (status == DMI_STATUS_SUCCESS) {

0 commit comments

Comments
 (0)