diff options
Diffstat (limited to 'services/std_svc')
-rw-r--r-- | services/std_svc/psci/psci_common.c | 6 | ||||
-rw-r--r-- | services/std_svc/psci/psci_private.h | 25 | ||||
-rw-r--r-- | services/std_svc/psci/psci_setup.c | 2 |
3 files changed, 24 insertions, 9 deletions
diff --git a/services/std_svc/psci/psci_common.c b/services/std_svc/psci/psci_common.c index 155f842e..c984e9ec 100644 --- a/services/std_svc/psci/psci_common.c +++ b/services/std_svc/psci/psci_common.c @@ -246,7 +246,8 @@ void psci_acquire_afflvl_locks(int start_afflvl, for (level = start_afflvl; level <= end_afflvl; level++) { if (mpidr_nodes[level] == NULL) continue; - bakery_lock_get(&mpidr_nodes[level]->lock); + + psci_lock_get(mpidr_nodes[level]); } } @@ -264,7 +265,8 @@ void psci_release_afflvl_locks(int start_afflvl, for (level = end_afflvl; level >= start_afflvl; level--) { if (mpidr_nodes[level] == NULL) continue; - bakery_lock_release(&mpidr_nodes[level]->lock); + + psci_lock_release(mpidr_nodes[level]); } } diff --git a/services/std_svc/psci/psci_private.h b/services/std_svc/psci/psci_private.h index 24a5604e..9a8ef73d 100644 --- a/services/std_svc/psci/psci_private.h +++ b/services/std_svc/psci/psci_private.h @@ -33,14 +33,22 @@ #include <arch.h> #include <bakery_lock.h> -#include <platform_def.h> /* for PLATFORM_NUM_AFFS */ #include <psci.h> -/* Number of affinity instances whose state this psci imp. can track */ -#ifdef PLATFORM_NUM_AFFS -#define PSCI_NUM_AFFS PLATFORM_NUM_AFFS +/* + * The following helper macros abstract the interface to the Bakery + * Lock API. + */ +#if USE_COHERENT_MEM +#define psci_lock_init(aff_map, idx) bakery_lock_init(&(aff_map)[(idx)].lock) +#define psci_lock_get(node) bakery_lock_get(&((node)->lock)) +#define psci_lock_release(node) bakery_lock_release(&((node)->lock)) #else -#define PSCI_NUM_AFFS (2 * PLATFORM_CORE_COUNT) +#define psci_lock_init(aff_map, idx) ((aff_map)[(idx)].aff_map_index = (idx)) +#define psci_lock_get(node) bakery_lock_get((node)->aff_map_index, \ + CPU_DATA_PSCI_LOCK_OFFSET) +#define psci_lock_release(node) bakery_lock_release((node)->aff_map_index,\ + CPU_DATA_PSCI_LOCK_OFFSET) #endif /******************************************************************************* @@ -49,10 +57,15 @@ ******************************************************************************/ typedef struct aff_map_node { unsigned long mpidr; - unsigned short ref_count; + unsigned char ref_count; unsigned char state; unsigned char level; +#if USE_COHERENT_MEM bakery_lock_t lock; +#else + /* For indexing the bakery_info array in per CPU data */ + unsigned char aff_map_index; +#endif } aff_map_node_t; typedef struct aff_limits_node { diff --git a/services/std_svc/psci/psci_setup.c b/services/std_svc/psci/psci_setup.c index e0bc8331..a750256e 100644 --- a/services/std_svc/psci/psci_setup.c +++ b/services/std_svc/psci/psci_setup.c @@ -181,7 +181,7 @@ static void psci_init_aff_map_node(unsigned long mpidr, uint32_t linear_id; psci_aff_map[idx].mpidr = mpidr; psci_aff_map[idx].level = level; - bakery_lock_init(&psci_aff_map[idx].lock); + psci_lock_init(psci_aff_map, idx); /* * If an affinity instance is present then mark it as OFF to begin with. |