]> www.infradead.org Git - users/borneoa/openocd-next.git/commitdiff
target: Add TARGET_UNAVAILABLE state
authorTim Newsome <tim@sifive.com>
Thu, 27 Oct 2022 22:21:31 +0000 (15:21 -0700)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 7 Jun 2025 08:15:30 +0000 (08:15 +0000)
This is added for future RISC-V changes. The RISC-V debug interface can
explicitly tell a debugger when a hart is unavailable. This is used for
instance when that hart is powered down (or yet to be powered up out of
reset).

Imported from
https://github.com/riscv-collab/riscv-openocd/pull/752

Change-Id: I8a062d59eea1e5b3c788281a75159592db024683
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8911
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Bernhard Rosenkränzer <bero@baylibre.com>
src/target/target.c
src/target/target.h

index 6653c381c0671420c3ccb974678d8dc9187afa56..fd0e0116b58a7d59951ec66799c9180904cb113a 100644 (file)
@@ -220,6 +220,7 @@ static const struct nvp nvp_target_state[] = {
        { .name = "halted",  .value = TARGET_HALTED },
        { .name = "reset",   .value = TARGET_RESET },
        { .name = "debug-running", .value = TARGET_DEBUG_RUNNING },
+       { .name = "unavailable", .value = TARGET_UNAVAILABLE },
        { .name = NULL, .value = -1 },
 };
 
index b698f250ced2f48309dc5647c2694e765ae70347..b850b49cf3614930404e2cf48b918103ec2c6a26 100644 (file)
@@ -46,6 +46,8 @@ struct gdb_fileio_info;
  * not sure how this is used with all the recent changes)
  * TARGET_DEBUG_RUNNING = 4: the target is running, but it is executing code on
  * behalf of the debugger (e.g. algorithm for flashing)
+ * TARGET_UNAVAILABLE = 5: The target is unavailable for some reason. It might
+ * be powered down, for instance.
  *
  * also see: target_state_name();
  */
@@ -56,6 +58,7 @@ enum target_state {
        TARGET_HALTED = 2,
        TARGET_RESET = 3,
        TARGET_DEBUG_RUNNING = 4,
+       TARGET_UNAVAILABLE = 5
 };
 
 enum target_reset_mode {