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
This commit is contained in:
Antonio Borneo
2021-12-16 01:59:14 +01:00
parent 5ab74bde06
commit 16cc853bcf
16 changed files with 136 additions and 178 deletions

View File

@@ -26,6 +26,7 @@
#include "armv7a_cache.h"
#include <helper/time_support.h>
#include "arm_opcodes.h"
#include "smp.h"
static int armv7a_l1_d_cache_sanity_check(struct target *target)
{
@@ -138,14 +139,10 @@ int armv7a_cache_auto_flush_all_data(struct target *target)
if (target->smp) {
struct target_list *head;
struct target *curr;
head = target->head;
while (head) {
curr = head->target;
foreach_smp_target(head, target->smp_targets) {
struct target *curr = head->target;
if (curr->state == TARGET_HALTED)
retval = armv7a_l1_d_cache_clean_inval_all(curr);
head = head->next;
}
} else
retval = armv7a_l1_d_cache_clean_inval_all(target);