From bf22cae558c64840d6fc973f58eb30f4d9e669e4 Mon Sep 17 00:00:00 2001 From: Megan Wachs Date: Tue, 2 Jan 2018 12:02:02 -0800 Subject: [PATCH] Update riscv-011.c Update comment and remove redundant check --- src/target/riscv/riscv-011.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/target/riscv/riscv-011.c b/src/target/riscv/riscv-011.c index 5f902f4ab..1ee7ba73f 100644 --- a/src/target/riscv/riscv-011.c +++ b/src/target/riscv/riscv-011.c @@ -455,7 +455,11 @@ static uint64_t dbus_read(struct target *target, uint16_t address) dbus_status_t status; uint16_t address_in; - // First, discard stale data + // First scan sends the desired address/operation. This is + // slightly inefficient as, if the previous read was to the same + // address, one could have simply used the data directly. However, + // that data may may have been captured significantly earlier, + // and could be considered stale at the start of this operation. dbus_scan(target, &address_in, &value, DBUS_OP_READ, address, 0); unsigned i = 0; @@ -463,7 +467,7 @@ static uint64_t dbus_read(struct target *target, uint16_t address) status = dbus_scan(target, &address_in, &value, DBUS_OP_READ, address, 0); if (status == DBUS_STATUS_BUSY) increase_dbus_busy_delay(target); - } while (((status == DBUS_STATUS_BUSY) || (address_in != address)) && + } while (((status == DBUS_STATUS_BUSY)) && i++ < 256); if (status != DBUS_STATUS_SUCCESS)