Compare commits

...

5 Commits

Author SHA1 Message Date
Tim Newsome f401f2304f Deal with busy status on dbus_read() request.
Change-Id: I3699bde01887dfba37d7f420737988248c7fca5b
2018-01-04 12:53:09 -08:00
Tim Newsome 2ffa3f3382 Comment busy behavior.
Change-Id: I95e4a70eea636a41f0206b738b1b991d4a3e9249
2018-01-03 12:34:52 -08:00
Tim Newsome 89481491a7 Properly fix dbus_read()
Read once, and then get the value that was read in a nop scan.
If it didn't work, increase the time and try again.

Change-Id: Ic0aaa44f5a858526c4b65d546ab2e7267fd17ef5
2018-01-02 14:32:18 -08:00
Megan Wachs bf22cae558
Update riscv-011.c
Update comment and remove redundant check
2018-01-02 12:02:02 -08:00
Tim Newsome e36a16701d In dmi_read(), ignore stale data.
Fixes Issue #39. Reduces performance about 1%.

Change-Id: I3bfc71cb8e632ecce35c6adeb744177300d54b98
2017-12-28 15:59:55 -08:00
1 changed files with 19 additions and 7 deletions

View File

@ -455,16 +455,28 @@ static uint64_t dbus_read(struct target *target, uint16_t address)
dbus_status_t status; dbus_status_t status;
uint16_t address_in; uint16_t address_in;
unsigned i = 0; /* Assume dbus is idle and there aren't any busy/error states pending.
do { * If there happens to be a busy state pending, we will clear it after we
status = dbus_scan(target, &address_in, &value, DBUS_OP_READ, address, 0); * discover it as part of the NOP scan. */
for (unsigned i = 0; i < 256; i++) {
status = dbus_scan(target, NULL, NULL, DBUS_OP_READ, address, 0);
if (status == DBUS_STATUS_BUSY) {
increase_dbus_busy_delay(target);
continue;
}
status = dbus_scan(target, &address_in, &value, DBUS_OP_NOP, address, 0);
if (status == DBUS_STATUS_BUSY) if (status == DBUS_STATUS_BUSY)
increase_dbus_busy_delay(target); increase_dbus_busy_delay(target);
} while (((status == DBUS_STATUS_BUSY) || (address_in != address)) && else if (address_in != address)
i++ < 256); LOG_ERROR("Tried to read from 0x%x, but actually read from 0x%x",
address, address_in);
else
break;
}
if (status != DBUS_STATUS_SUCCESS) if (status != DBUS_STATUS_SUCCESS)
LOG_ERROR("failed read from 0x%x; value=0x%" PRIx64 ", status=%d\n", address, value, status); LOG_ERROR("failed read from 0x%x; value=0x%" PRIx64 ", status=%d",
address, value, status);
return value; return value;
} }
@ -479,7 +491,7 @@ static void dbus_write(struct target *target, uint16_t address, uint64_t value)
increase_dbus_busy_delay(target); increase_dbus_busy_delay(target);
} }
if (status != DBUS_STATUS_SUCCESS) if (status != DBUS_STATUS_SUCCESS)
LOG_ERROR("failed to write 0x%" PRIx64 " to 0x%x; status=%d\n", value, address, status); LOG_ERROR("failed to write 0x%" PRIx64 " to 0x%x; status=%d", value, address, status);
} }
/*** scans "class" ***/ /*** scans "class" ***/