diff options
Diffstat (limited to 'plat/juno/juno_private.h')
-rw-r--r-- | plat/juno/juno_private.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/plat/juno/juno_private.h b/plat/juno/juno_private.h index 14d7af4dad..b7ef4488a5 100644 --- a/plat/juno/juno_private.h +++ b/plat/juno/juno_private.h @@ -31,7 +31,9 @@ #ifndef __JUNO_PRIVATE_H__ #define __JUNO_PRIVATE_H__ +#include <bakery_lock.h> #include <bl_common.h> +#include <cpu_data.h> #include <platform_def.h> #include <stdint.h> @@ -59,6 +61,68 @@ typedef struct bl2_to_bl31_params_mem { struct entry_point_info bl31_ep_info; } bl2_to_bl31_params_mem_t; +#if IMAGE_BL31 +#if USE_COHERENT_MEM +/* + * These are wrapper macros to the Coherent Memory Bakery Lock API. + */ +#define juno_lock_init(_lock_arg) bakery_lock_init(_lock_arg) +#define juno_lock_get(_lock_arg) bakery_lock_get(_lock_arg) +#define juno_lock_release(_lock_arg) bakery_lock_release(_lock_arg) + +#else + +/******************************************************************************* + * Constants that specify how many bakeries this platform implements and bakery + * ids. + ******************************************************************************/ +#define JUNO_MAX_BAKERIES 1 +#define JUNO_MHU_BAKERY_ID 0 + +/******************************************************************************* + * Definition of structure which holds platform specific per-cpu data. Currently + * it holds only the bakery lock information for each cpu. Constants to specify + * how many bakeries this platform implements and bakery ids are specified in + * juno_def.h + ******************************************************************************/ +typedef struct juno_cpu_data { + bakery_info_t pcpu_bakery_info[JUNO_MAX_BAKERIES]; +} juno_cpu_data_t; + +/* Macro to define the offset of bakery_info_t in juno_cpu_data_t */ +#define JUNO_CPU_DATA_LOCK_OFFSET __builtin_offsetof\ + (juno_cpu_data_t, pcpu_bakery_info) + +/******************************************************************************* + * Helper macros for bakery lock api when using the above juno_cpu_data_t for + * bakery lock data structures. It assumes that the bakery_info is at the + * beginning of the platform specific per-cpu data. + ******************************************************************************/ +#define juno_lock_init(_lock_arg) /* No init required */ +#define juno_lock_get(_lock_arg) bakery_lock_get(_lock_arg, \ + CPU_DATA_PLAT_PCPU_OFFSET + \ + JUNO_CPU_DATA_LOCK_OFFSET) +#define juno_lock_release(_lock_arg) bakery_lock_release(_lock_arg, \ + CPU_DATA_PLAT_PCPU_OFFSET + \ + JUNO_CPU_DATA_LOCK_OFFSET) + +/* + * Ensure that the size of the Juno specific per-cpu data structure and the size + * of the memory allocated in generic per-cpu data for the platform are the same. + */ +CASSERT(PLAT_PCPU_DATA_SIZE == sizeof(juno_cpu_data_t), \ + juno_pcpu_data_size_mismatch); +#endif /* __USE_COHERENT_MEM__ */ +#else +/* + * Dummy wrapper macros for all other BL stages other than BL3-1 + */ +#define juno_lock_init(_lock_arg) +#define juno_lock_get(_lock_arg) +#define juno_lock_release(_lock_arg) + +#endif /* __IMAGE_BL31__ */ + /******************************************************************************* * Function and variable prototypes ******************************************************************************/ |