target/riscv-013: clear sticky error when DMI operation fails 88/7688/2
authorAmaury Pouly <amaury.pouly@lowrisc.org>
Wed, 17 May 2023 11:09:32 +0000 (12:09 +0100)
committerTomas Vanek <vanekt@fbl.cz>
Thu, 25 May 2023 16:19:12 +0000 (16:19 +0000)
When a DMI operation does not succeed (either because of a timeout
or an error), the specification says that the error in the `op`
field is sticky and needs to cleared by writing `dmireset` in `dtmcs`.
This is already done for timeouts in increase_dmi_busy_delay
but not for errors.

Change-Id: I7c5f27a5cf145511a1a8b64a45a586521e1cbe41
Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org>
Reviewed-on: https://review.openocd.org/c/openocd/+/7688
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
src/target/riscv/riscv-013.c

index 4e6c8dc36d3be7fd7a1f463ebb3a1b3efa6aed76..2f4a8fe2e6f1dd67a473587fd6740534789eaaca 100644 (file)
@@ -598,6 +598,7 @@ static int dmi_op_timeout(struct target *target, uint32_t *data_in,
                        break;
                } else {
                        LOG_ERROR("failed %s at 0x%x, status=%d", op_name, address, status);
+                       dtmcontrol_scan(target, DTM_DTMCS_DMIRESET);
                        return ERROR_FAIL;
                }
                if (time(NULL) - start > timeout_sec)
@@ -630,6 +631,7 @@ static int dmi_op_timeout(struct target *target, uint32_t *data_in,
                                        LOG_ERROR("Failed %s (NOP) at 0x%x; status=%d", op_name, address,
                                                        status);
                                }
+                               dtmcontrol_scan(target, DTM_DTMCS_DMIRESET);
                                return ERROR_FAIL;
                        }
                        if (time(NULL) - start > timeout_sec)

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)