Merge pull request #60 from riscv/tim

Fix dmi_read() indentation; remove \n in LOG_ERROR
This commit is contained in:
Tim Newsome 2017-06-08 12:39:30 -07:00 committed by GitHub
commit 7af58e6283
1 changed files with 25 additions and 25 deletions

View File

@ -367,9 +367,9 @@ static uint64_t dmi_read(struct target *target, uint16_t address)
unsigned i = 0; unsigned i = 0;
// This first loop ensures that the read request was actually sent // This first loop ensures that the read request was actually sent
// to the target. Note that if for some reason this stays busy, // to the target. Note that if for some reason this stays busy,
// it is actually due to the Previous dmi_read or dmi_write. // it is actually due to the Previous dmi_read or dmi_write.
for (i = 0; i < 256; i++) { for (i = 0; i < 256; i++) {
status = dmi_scan(target, NULL, NULL, DMI_OP_READ, address, 0, status = dmi_scan(target, NULL, NULL, DMI_OP_READ, address, 0,
false); false);
@ -378,35 +378,35 @@ static uint64_t dmi_read(struct target *target, uint16_t address)
} else if (status == DMI_STATUS_SUCCESS) { } else if (status == DMI_STATUS_SUCCESS) {
break; break;
} else { } else {
LOG_ERROR("failed read from 0x%x, status=%d\n", address, status); LOG_ERROR("failed read from 0x%x, status=%d", address, status);
break; break;
} }
} }
if (status != DMI_STATUS_SUCCESS) { if (status != DMI_STATUS_SUCCESS) {
LOG_ERROR("Failed read from 0x%x; value=0x%" PRIx64 ", status=%d\n", LOG_ERROR("Failed read from 0x%x; value=0x%" PRIx64 ", status=%d",
address, value, status); address, value, status);
abort(); abort();
} }
// This second loop ensures that we got the read // This second loop ensures that we got the read
// data back. Note that NOP can result in a 'busy' result as well, but // data back. Note that NOP can result in a 'busy' result as well, but
// that would be noticed on the next DMI access we do. // that would be noticed on the next DMI access we do.
for (i = 0; i < 256; i++) { for (i = 0; i < 256; i++) {
status = dmi_scan(target, &address_in, &value, DMI_OP_NOP, address, 0, status = dmi_scan(target, &address_in, &value, DMI_OP_NOP, address, 0,
false); false);
if (status == DMI_STATUS_BUSY) { if (status == DMI_STATUS_BUSY) {
increase_dmi_busy_delay(target); increase_dmi_busy_delay(target);
} else if (status == DMI_STATUS_SUCCESS) { } else if (status == DMI_STATUS_SUCCESS) {
break; break;
} else { } else {
LOG_ERROR("failed read (NOP) at 0x%x, status=%d\n", address, status); LOG_ERROR("failed read (NOP) at 0x%x, status=%d\n", address, status);
break; break;
} }
} }
if (status != DMI_STATUS_SUCCESS) { if (status != DMI_STATUS_SUCCESS) {
LOG_ERROR("Failed read (NOP) from 0x%x; value=0x%" PRIx64 ", status=%d\n", LOG_ERROR("Failed read (NOP) from 0x%x; value=0x%" PRIx64 ", status=%d",
address, value, status); address, value, status);
abort(); abort();
} }