aboutsummaryrefslogtreecommitdiff
path: root/src/target/aarch64.c
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2021-12-16 01:59:14 +0100
committerAntonio Borneo <borneo.antonio@gmail.com>2022-02-14 15:10:10 +0000
commit16cc853bcfbcc8dba6eadd91b434c05387034c0a (patch)
treecee31fec1a5bb238ab7d1e9b0170edbfdfc2ffa2 /src/target/aarch64.c
parent5ab74bde06541ce199390ead348a3e107ee9c0f4 (diff)
downloadriscv-openocd-16cc853bcfbcc8dba6eadd91b434c05387034c0a.zip
riscv-openocd-16cc853bcfbcc8dba6eadd91b434c05387034c0a.tar.gz
riscv-openocd-16cc853bcfbcc8dba6eadd91b434c05387034c0a.tar.bz2
target/smp: use a struct list_head to hold the smp targets
Instead of reinventing a simply linked list, reuse the list helper for the list of targets in a smp cluster. Using the existing helper, that implements a double linked list, makes trivial going through the list in reverse order. Change-Id: Ib36ad2955f15cd2a601b0b9e36ca6d948b12d00f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6783 Tested-by: jenkins
Diffstat (limited to 'src/target/aarch64.c')
-rw-r--r--src/target/aarch64.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/target/aarch64.c b/src/target/aarch64.c
index d11fd94..a45322d 100644
--- a/src/target/aarch64.c
+++ b/src/target/aarch64.c
@@ -333,15 +333,14 @@ static int aarch64_wait_halt_one(struct target *target)
static int aarch64_prepare_halt_smp(struct target *target, bool exc_target, struct target **p_first)
{
int retval = ERROR_OK;
- struct target_list *head = target->head;
+ struct target_list *head;
struct target *first = NULL;
LOG_DEBUG("target %s exc %i", target_name(target), exc_target);
- while (head) {
+ foreach_smp_target(head, target->smp_targets) {
struct target *curr = head->target;
struct armv8_common *armv8 = target_to_armv8(curr);
- head = head->next;
if (exc_target && curr == target)
continue;
@@ -430,7 +429,7 @@ static int aarch64_halt_smp(struct target *target, bool exc_target)
struct target_list *head;
struct target *curr;
- foreach_smp_target(head, target->head) {
+ foreach_smp_target(head, target->smp_targets) {
int halted;
curr = head->target;
@@ -480,7 +479,7 @@ static int update_halt_gdb(struct target *target, enum target_debug_reason debug
}
/* poll all targets in the group, but skip the target that serves GDB */
- foreach_smp_target(head, target->head) {
+ foreach_smp_target(head, target->smp_targets) {
curr = head->target;
/* skip calling context */
if (curr == target)
@@ -745,7 +744,7 @@ static int aarch64_prep_restart_smp(struct target *target, int handle_breakpoint
struct target *first = NULL;
uint64_t address;
- foreach_smp_target(head, target->head) {
+ foreach_smp_target(head, target->smp_targets) {
struct target *curr = head->target;
/* skip calling target */
@@ -800,7 +799,7 @@ static int aarch64_step_restart_smp(struct target *target)
struct target *curr = target;
bool all_resumed = true;
- foreach_smp_target(head, target->head) {
+ foreach_smp_target(head, target->smp_targets) {
uint32_t prsr;
int resumed;
@@ -888,7 +887,7 @@ static int aarch64_resume(struct target *target, int current,
struct target_list *head;
bool all_resumed = true;
- foreach_smp_target(head, target->head) {
+ foreach_smp_target(head, target->smp_targets) {
uint32_t prsr;
int resumed;