forked from auracaster/openocd
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:
@@ -27,6 +27,7 @@
|
||||
#include <helper/time_support.h>
|
||||
#include "target.h"
|
||||
#include "target_type.h"
|
||||
#include "smp.h"
|
||||
|
||||
static int arm7a_l2x_sanity_check(struct target *target)
|
||||
{
|
||||
@@ -194,8 +195,7 @@ static int arm7a_handle_l2x_cache_info_command(struct command_invocation *cmd,
|
||||
static int armv7a_l2x_cache_init(struct target *target, uint32_t base, uint32_t way)
|
||||
{
|
||||
struct armv7a_l2x_cache *l2x_cache;
|
||||
struct target_list *head = target->head;
|
||||
struct target *curr;
|
||||
struct target_list *head;
|
||||
|
||||
struct armv7a_common *armv7a = target_to_armv7a(target);
|
||||
if (armv7a->armv7a_mmu.armv7a_cache.outer_cache) {
|
||||
@@ -210,8 +210,8 @@ static int armv7a_l2x_cache_init(struct target *target, uint32_t base, uint32_t
|
||||
|
||||
/* initialize all targets in this cluster (smp target)
|
||||
* l2 cache must be configured after smp declaration */
|
||||
while (head) {
|
||||
curr = head->target;
|
||||
foreach_smp_target(head, target->smp_targets) {
|
||||
struct target *curr = head->target;
|
||||
if (curr != target) {
|
||||
armv7a = target_to_armv7a(curr);
|
||||
if (armv7a->armv7a_mmu.armv7a_cache.outer_cache) {
|
||||
@@ -220,7 +220,6 @@ static int armv7a_l2x_cache_init(struct target *target, uint32_t base, uint32_t
|
||||
}
|
||||
armv7a->armv7a_mmu.armv7a_cache.outer_cache = l2x_cache;
|
||||
}
|
||||
head = head->next;
|
||||
}
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user