Skip to content

Commit 7af58e6

Browse files
authored
Merge pull request #60 from riscv/tim
Fix dmi_read() indentation; remove \n in LOG_ERROR
2 parents c3b344d + 6be6003 commit 7af58e6

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

src/target/riscv/riscv-013.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,9 @@ static uint64_t dmi_read(struct target *target, uint16_t address)
367367

368368
unsigned i = 0;
369369

370-
// This first loop ensures that the read request was actually sent
371-
// to the target. Note that if for some reason this stays busy,
372-
// it is actually due to the Previous dmi_read or dmi_write.
370+
// This first loop ensures that the read request was actually sent
371+
// to the target. Note that if for some reason this stays busy,
372+
// it is actually due to the Previous dmi_read or dmi_write.
373373
for (i = 0; i < 256; i++) {
374374
status = dmi_scan(target, NULL, NULL, DMI_OP_READ, address, 0,
375375
false);
@@ -378,35 +378,35 @@ static uint64_t dmi_read(struct target *target, uint16_t address)
378378
} else if (status == DMI_STATUS_SUCCESS) {
379379
break;
380380
} else {
381-
LOG_ERROR("failed read from 0x%x, status=%d\n", address, status);
381+
LOG_ERROR("failed read from 0x%x, status=%d", address, status);
382382
break;
383383
}
384384
}
385385

386-
if (status != DMI_STATUS_SUCCESS) {
387-
LOG_ERROR("Failed read from 0x%x; value=0x%" PRIx64 ", status=%d\n",
388-
address, value, status);
389-
abort();
390-
}
386+
if (status != DMI_STATUS_SUCCESS) {
387+
LOG_ERROR("Failed read from 0x%x; value=0x%" PRIx64 ", status=%d",
388+
address, value, status);
389+
abort();
390+
}
391391

392-
// This second loop ensures that we got the read
393-
// data back. Note that NOP can result in a 'busy' result as well, but
394-
// that would be noticed on the next DMI access we do.
395-
for (i = 0; i < 256; i++) {
396-
status = dmi_scan(target, &address_in, &value, DMI_OP_NOP, address, 0,
397-
false);
398-
if (status == DMI_STATUS_BUSY) {
399-
increase_dmi_busy_delay(target);
400-
} else if (status == DMI_STATUS_SUCCESS) {
401-
break;
402-
} else {
403-
LOG_ERROR("failed read (NOP) at 0x%x, status=%d\n", address, status);
404-
break;
405-
}
406-
}
392+
// This second loop ensures that we got the read
393+
// data back. Note that NOP can result in a 'busy' result as well, but
394+
// that would be noticed on the next DMI access we do.
395+
for (i = 0; i < 256; i++) {
396+
status = dmi_scan(target, &address_in, &value, DMI_OP_NOP, address, 0,
397+
false);
398+
if (status == DMI_STATUS_BUSY) {
399+
increase_dmi_busy_delay(target);
400+
} else if (status == DMI_STATUS_SUCCESS) {
401+
break;
402+
} else {
403+
LOG_ERROR("failed read (NOP) at 0x%x, status=%d\n", address, status);
404+
break;
405+
}
406+
}
407407

408408
if (status != DMI_STATUS_SUCCESS) {
409-
LOG_ERROR("Failed read (NOP) from 0x%x; value=0x%" PRIx64 ", status=%d\n",
409+
LOG_ERROR("Failed read (NOP) from 0x%x; value=0x%" PRIx64 ", status=%d",
410410
address, value, status);
411411
abort();
412412
}

0 commit comments

Comments
 (0)