Commit fb037bfb authored by Dan Handley's avatar Dan Handley
Browse files

Always use named structs in header files

Add tag names to all unnamed structs in header files. This
allows forward declaration of structs, which is necessary to
reduce header file nesting (to be implemented in a subsequent
commit).

Also change the typedef names across the codebase to use the _t
suffix to be more conformant with the Linux coding style. The
coding style actually prefers us not to use typedefs at all but
this is considered a step too far for Trusted Firmware.

Also change the IO framework structs defintions to use typedef'd
structs to be consistent with the rest of the codebase.

Change-Id: I722b2c86fc0d92e4da3b15e5cab20373dd26786f
parent c5945735
...@@ -46,20 +46,20 @@ ...@@ -46,20 +46,20 @@
* marks the absent affinity level instances as PSCI_AFF_ABSENT e.g. there is no * marks the absent affinity level instances as PSCI_AFF_ABSENT e.g. there is no
* cluster 1 on the Foundation FVP. The 'data' field is currently unused. * cluster 1 on the Foundation FVP. The 'data' field is currently unused.
******************************************************************************/ ******************************************************************************/
typedef struct { typedef struct affinity_info {
unsigned char sibling; unsigned char sibling;
unsigned char child; unsigned char child;
unsigned char state; unsigned char state;
unsigned int data; unsigned int data;
} affinity_info; } affinity_info_t;
/******************************************************************************* /*******************************************************************************
* The following two data structures store the topology tree for the fvp. There * The following two data structures store the topology tree for the fvp. There
* is a separate array for each affinity level i.e. cpus and clusters. The child * is a separate array for each affinity level i.e. cpus and clusters. The child
* and sibling references allow traversal inside and in between the two arrays. * and sibling references allow traversal inside and in between the two arrays.
******************************************************************************/ ******************************************************************************/
static affinity_info fvp_aff1_topology_map[PLATFORM_CLUSTER_COUNT]; static affinity_info_t fvp_aff1_topology_map[PLATFORM_CLUSTER_COUNT];
static affinity_info fvp_aff0_topology_map[PLATFORM_CORE_COUNT]; static affinity_info_t fvp_aff0_topology_map[PLATFORM_CORE_COUNT];
/* Simple global variable to safeguard us from stupidity */ /* Simple global variable to safeguard us from stupidity */
static unsigned int topology_setup_done; static unsigned int topology_setup_done;
......
...@@ -340,10 +340,10 @@ ...@@ -340,10 +340,10 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
typedef volatile struct { typedef volatile struct mailbox {
unsigned long value unsigned long value
__attribute__((__aligned__(CACHE_WRITEBACK_GRANULE))); __attribute__((__aligned__(CACHE_WRITEBACK_GRANULE)));
} mailbox; } mailbox_t;
/******************************************************************************* /*******************************************************************************
* Function and variable prototypes * Function and variable prototypes
...@@ -364,11 +364,11 @@ extern unsigned long warm_boot_entrypoint; ...@@ -364,11 +364,11 @@ extern unsigned long warm_boot_entrypoint;
extern void bl1_plat_arch_setup(void); extern void bl1_plat_arch_setup(void);
extern void bl2_plat_arch_setup(void); extern void bl2_plat_arch_setup(void);
extern void bl31_plat_arch_setup(void); extern void bl31_plat_arch_setup(void);
extern int platform_setup_pm(plat_pm_ops **); extern int platform_setup_pm(plat_pm_ops_t **);
extern unsigned int platform_get_core_pos(unsigned long mpidr); extern unsigned int platform_get_core_pos(unsigned long mpidr);
extern void disable_mmu(void); extern void disable_mmu(void);
extern void enable_mmu(void); extern void enable_mmu(void);
extern void configure_mmu(meminfo *, extern void configure_mmu(meminfo_t *,
unsigned long, unsigned long,
unsigned long, unsigned long,
unsigned long, unsigned long,
......
...@@ -47,10 +47,10 @@ ...@@ -47,10 +47,10 @@
int32_t tspd_init_secure_context(uint64_t entrypoint, int32_t tspd_init_secure_context(uint64_t entrypoint,
uint32_t rw, uint32_t rw,
uint64_t mpidr, uint64_t mpidr,
tsp_context *tsp_ctx) tsp_context_t *tsp_ctx)
{ {
uint32_t scr, sctlr; uint32_t scr, sctlr;
el1_sys_regs *el1_state; el1_sys_regs_t *el1_state;
uint32_t spsr; uint32_t spsr;
/* Passing a NULL context is a critical programming error */ /* Passing a NULL context is a critical programming error */
...@@ -110,7 +110,7 @@ int32_t tspd_init_secure_context(uint64_t entrypoint, ...@@ -110,7 +110,7 @@ int32_t tspd_init_secure_context(uint64_t entrypoint,
* 3. Calls el3_exit() so that the EL3 system and general purpose registers * 3. Calls el3_exit() so that the EL3 system and general purpose registers
* from the tsp_ctx->cpu_ctx are used to enter the secure payload image. * from the tsp_ctx->cpu_ctx are used to enter the secure payload image.
******************************************************************************/ ******************************************************************************/
uint64_t tspd_synchronous_sp_entry(tsp_context *tsp_ctx) uint64_t tspd_synchronous_sp_entry(tsp_context_t *tsp_ctx)
{ {
uint64_t rc; uint64_t rc;
...@@ -138,7 +138,7 @@ uint64_t tspd_synchronous_sp_entry(tsp_context *tsp_ctx) ...@@ -138,7 +138,7 @@ uint64_t tspd_synchronous_sp_entry(tsp_context *tsp_ctx)
* 3. It does not need to save any general purpose or EL3 system register state * 3. It does not need to save any general purpose or EL3 system register state
* as the generic smc entry routine should have saved those. * as the generic smc entry routine should have saved those.
******************************************************************************/ ******************************************************************************/
void tspd_synchronous_sp_exit(tsp_context *tsp_ctx, uint64_t ret) void tspd_synchronous_sp_exit(tsp_context_t *tsp_ctx, uint64_t ret)
{ {
/* Save the Secure EL1 system register context */ /* Save the Secure EL1 system register context */
assert(cm_get_context(read_mpidr(), SECURE) == &tsp_ctx->cpu_ctx); assert(cm_get_context(read_mpidr(), SECURE) == &tsp_ctx->cpu_ctx);
......
...@@ -57,12 +57,12 @@ ...@@ -57,12 +57,12 @@
* Single structure to hold information about the various entry points into the * Single structure to hold information about the various entry points into the
* Secure Payload. It is initialised once on the primary core after a cold boot. * Secure Payload. It is initialised once on the primary core after a cold boot.
******************************************************************************/ ******************************************************************************/
entry_info *tsp_entry_info; entry_info_t *tsp_entry_info;
/******************************************************************************* /*******************************************************************************
* Array to keep track of per-cpu Secure Payload state * Array to keep track of per-cpu Secure Payload state
******************************************************************************/ ******************************************************************************/
tsp_context tspd_sp_context[TSPD_CORE_COUNT]; tsp_context_t tspd_sp_context[TSPD_CORE_COUNT];
/* TSP UID */ /* TSP UID */
...@@ -70,7 +70,7 @@ DEFINE_SVC_UUID(tsp_uuid, ...@@ -70,7 +70,7 @@ DEFINE_SVC_UUID(tsp_uuid,
0x5b3056a0, 0x3291, 0x427b, 0x98, 0x11, 0x5b3056a0, 0x3291, 0x427b, 0x98, 0x11,
0x71, 0x68, 0xca, 0x50, 0xf3, 0xfa); 0x71, 0x68, 0xca, 0x50, 0xf3, 0xfa);
int32_t tspd_init(meminfo *bl32_meminfo); int32_t tspd_init(meminfo_t *bl32_meminfo);
/******************************************************************************* /*******************************************************************************
...@@ -80,7 +80,7 @@ int32_t tspd_init(meminfo *bl32_meminfo); ...@@ -80,7 +80,7 @@ int32_t tspd_init(meminfo *bl32_meminfo);
******************************************************************************/ ******************************************************************************/
int32_t tspd_setup(void) int32_t tspd_setup(void)
{ {
el_change_info *image_info; el_change_info_t *image_info;
int32_t rc; int32_t rc;
uint64_t mpidr = read_mpidr(); uint64_t mpidr = read_mpidr();
uint32_t linear_id; uint32_t linear_id;
...@@ -133,12 +133,12 @@ int32_t tspd_setup(void) ...@@ -133,12 +133,12 @@ int32_t tspd_setup(void)
* back to this routine through a SMC. It also passes the extents of memory made * back to this routine through a SMC. It also passes the extents of memory made
* available to BL32 by BL31. * available to BL32 by BL31.
******************************************************************************/ ******************************************************************************/
int32_t tspd_init(meminfo *bl32_meminfo) int32_t tspd_init(meminfo_t *bl32_meminfo)
{ {
uint64_t mpidr = read_mpidr(); uint64_t mpidr = read_mpidr();
uint32_t linear_id = platform_get_core_pos(mpidr); uint32_t linear_id = platform_get_core_pos(mpidr);
uint64_t rc; uint64_t rc;
tsp_context *tsp_ctx = &tspd_sp_context[linear_id]; tsp_context_t *tsp_ctx = &tspd_sp_context[linear_id];
/* /*
* Arrange for passing a pointer to the meminfo structure * Arrange for passing a pointer to the meminfo structure
...@@ -189,11 +189,11 @@ uint64_t tspd_smc_handler(uint32_t smc_fid, ...@@ -189,11 +189,11 @@ uint64_t tspd_smc_handler(uint32_t smc_fid,
void *handle, void *handle,
uint64_t flags) uint64_t flags)
{ {
cpu_context *ns_cpu_context; cpu_context_t *ns_cpu_context;
gp_regs *ns_gp_regs; gp_regs_t *ns_gp_regs;
unsigned long mpidr = read_mpidr(); unsigned long mpidr = read_mpidr();
uint32_t linear_id = platform_get_core_pos(mpidr), ns; uint32_t linear_id = platform_get_core_pos(mpidr), ns;
tsp_context *tsp_ctx = &tspd_sp_context[linear_id]; tsp_context_t *tsp_ctx = &tspd_sp_context[linear_id];
/* Determine which security state this SMC originated from */ /* Determine which security state this SMC originated from */
ns = is_caller_non_secure(flags); ns = is_caller_non_secure(flags);
...@@ -213,7 +213,7 @@ uint64_t tspd_smc_handler(uint32_t smc_fid, ...@@ -213,7 +213,7 @@ uint64_t tspd_smc_handler(uint32_t smc_fid,
* only once on the primary cpu * only once on the primary cpu
*/ */
assert(tsp_entry_info == NULL); assert(tsp_entry_info == NULL);
tsp_entry_info = (entry_info *) x1; tsp_entry_info = (entry_info_t *) x1;
/* /*
* SP reports completion. The SPD must have initiated * SP reports completion. The SPD must have initiated
......
...@@ -59,7 +59,7 @@ static int32_t tspd_cpu_off_handler(uint64_t cookie) ...@@ -59,7 +59,7 @@ static int32_t tspd_cpu_off_handler(uint64_t cookie)
int32_t rc = 0; int32_t rc = 0;
uint64_t mpidr = read_mpidr(); uint64_t mpidr = read_mpidr();
uint32_t linear_id = platform_get_core_pos(mpidr); uint32_t linear_id = platform_get_core_pos(mpidr);
tsp_context *tsp_ctx = &tspd_sp_context[linear_id]; tsp_context_t *tsp_ctx = &tspd_sp_context[linear_id];
assert(tsp_entry_info); assert(tsp_entry_info);
assert(tsp_ctx->state == TSP_STATE_ON); assert(tsp_ctx->state == TSP_STATE_ON);
...@@ -93,7 +93,7 @@ static void tspd_cpu_suspend_handler(uint64_t power_state) ...@@ -93,7 +93,7 @@ static void tspd_cpu_suspend_handler(uint64_t power_state)
int32_t rc = 0; int32_t rc = 0;
uint64_t mpidr = read_mpidr(); uint64_t mpidr = read_mpidr();
uint32_t linear_id = platform_get_core_pos(mpidr); uint32_t linear_id = platform_get_core_pos(mpidr);
tsp_context *tsp_ctx = &tspd_sp_context[linear_id]; tsp_context_t *tsp_ctx = &tspd_sp_context[linear_id];
assert(tsp_entry_info); assert(tsp_entry_info);
assert(tsp_ctx->state == TSP_STATE_ON); assert(tsp_ctx->state == TSP_STATE_ON);
...@@ -127,7 +127,7 @@ static void tspd_cpu_on_finish_handler(uint64_t cookie) ...@@ -127,7 +127,7 @@ static void tspd_cpu_on_finish_handler(uint64_t cookie)
int32_t rc = 0; int32_t rc = 0;
uint64_t mpidr = read_mpidr(); uint64_t mpidr = read_mpidr();
uint32_t linear_id = platform_get_core_pos(mpidr); uint32_t linear_id = platform_get_core_pos(mpidr);
tsp_context *tsp_ctx = &tspd_sp_context[linear_id]; tsp_context_t *tsp_ctx = &tspd_sp_context[linear_id];
assert(tsp_entry_info); assert(tsp_entry_info);
assert(tsp_ctx->state == TSP_STATE_OFF); assert(tsp_ctx->state == TSP_STATE_OFF);
...@@ -162,7 +162,7 @@ static void tspd_cpu_suspend_finish_handler(uint64_t suspend_level) ...@@ -162,7 +162,7 @@ static void tspd_cpu_suspend_finish_handler(uint64_t suspend_level)
int32_t rc = 0; int32_t rc = 0;
uint64_t mpidr = read_mpidr(); uint64_t mpidr = read_mpidr();
uint32_t linear_id = platform_get_core_pos(mpidr); uint32_t linear_id = platform_get_core_pos(mpidr);
tsp_context *tsp_ctx = &tspd_sp_context[linear_id]; tsp_context_t *tsp_ctx = &tspd_sp_context[linear_id];
assert(tsp_entry_info); assert(tsp_entry_info);
assert(tsp_ctx->state == TSP_STATE_SUSPEND); assert(tsp_ctx->state == TSP_STATE_SUSPEND);
...@@ -198,7 +198,7 @@ static int32_t tspd_cpu_migrate_info(uint64_t *resident_cpu) ...@@ -198,7 +198,7 @@ static int32_t tspd_cpu_migrate_info(uint64_t *resident_cpu)
* Structure populated by the TSP Dispatcher to be given a chance to perform any * Structure populated by the TSP Dispatcher to be given a chance to perform any
* TSP bookkeeping before PSCI executes a power mgmt. operation. * TSP bookkeeping before PSCI executes a power mgmt. operation.
******************************************************************************/ ******************************************************************************/
const spd_pm_ops tspd_pm = { const spd_pm_ops_t tspd_pm = {
tspd_cpu_on_handler, tspd_cpu_on_handler,
tspd_cpu_off_handler, tspd_cpu_off_handler,
tspd_cpu_suspend_handler, tspd_cpu_suspend_handler,
......
...@@ -99,7 +99,7 @@ DEFINE_REG_STRUCT(c_rt_regs, TSPD_C_RT_CTX_ENTRIES); ...@@ -99,7 +99,7 @@ DEFINE_REG_STRUCT(c_rt_regs, TSPD_C_RT_CTX_ENTRIES);
* have the same double word aligned view of the size of the C runtime * have the same double word aligned view of the size of the C runtime
* register context. * register context.
*/ */
CASSERT(TSPD_C_RT_CTX_SIZE == sizeof(c_rt_regs), \ CASSERT(TSPD_C_RT_CTX_SIZE == sizeof(c_rt_regs_t), \
assert_spd_c_rt_regs_size_mismatch); assert_spd_c_rt_regs_size_mismatch);
/******************************************************************************* /*******************************************************************************
...@@ -110,29 +110,29 @@ CASSERT(TSPD_C_RT_CTX_SIZE == sizeof(c_rt_regs), \ ...@@ -110,29 +110,29 @@ CASSERT(TSPD_C_RT_CTX_SIZE == sizeof(c_rt_regs), \
* from a synchronous entry into the SP. * from a synchronous entry into the SP.
* 'cpu_ctx' - space to maintain SP architectural state * 'cpu_ctx' - space to maintain SP architectural state
******************************************************************************/ ******************************************************************************/
typedef struct { typedef struct tsp_context {
uint32_t state; uint32_t state;
uint64_t mpidr; uint64_t mpidr;
uint64_t c_rt_ctx; uint64_t c_rt_ctx;
cpu_context cpu_ctx; cpu_context_t cpu_ctx;
} tsp_context; } tsp_context_t;
/* TSPD power management handlers */ /* TSPD power management handlers */
extern const spd_pm_ops tspd_pm; extern const spd_pm_ops_t tspd_pm;
/******************************************************************************* /*******************************************************************************
* Function & Data prototypes * Function & Data prototypes
******************************************************************************/ ******************************************************************************/
extern uint64_t tspd_enter_sp(uint64_t *c_rt_ctx); extern uint64_t tspd_enter_sp(uint64_t *c_rt_ctx);
extern void __dead2 tspd_exit_sp(uint64_t c_rt_ctx, uint64_t ret); extern void __dead2 tspd_exit_sp(uint64_t c_rt_ctx, uint64_t ret);
extern uint64_t tspd_synchronous_sp_entry(tsp_context *tsp_ctx); extern uint64_t tspd_synchronous_sp_entry(tsp_context_t *tsp_ctx);
extern void __dead2 tspd_synchronous_sp_exit(tsp_context *tsp_ctx, uint64_t ret); extern void __dead2 tspd_synchronous_sp_exit(tsp_context_t *tsp_ctx, uint64_t ret);
extern int32_t tspd_init_secure_context(uint64_t entrypoint, extern int32_t tspd_init_secure_context(uint64_t entrypoint,
uint32_t rw, uint32_t rw,
uint64_t mpidr, uint64_t mpidr,
tsp_context *tsp_ctx); tsp_context_t *tsp_ctx);
extern tsp_context tspd_sp_context[TSPD_CORE_COUNT]; extern tsp_context_t tspd_sp_context[TSPD_CORE_COUNT];
extern entry_info *tsp_entry_info; extern entry_info_t *tsp_entry_info;
#endif /*__ASSEMBLY__*/ #endif /*__ASSEMBLY__*/
#endif /* __SPD_PRIVATE_H__ */ #endif /* __SPD_PRIVATE_H__ */
...@@ -38,13 +38,13 @@ ...@@ -38,13 +38,13 @@
#include <psci.h> #include <psci.h>
#include "psci_private.h" #include "psci_private.h"
typedef int (*afflvl_off_handler)(unsigned long, aff_map_node *); typedef int (*afflvl_off_handler_t)(unsigned long, aff_map_node_t *);
/******************************************************************************* /*******************************************************************************
* The next three functions implement a handler for each supported affinity * The next three functions implement a handler for each supported affinity
* level which is called when that affinity level is turned off. * level which is called when that affinity level is turned off.
******************************************************************************/ ******************************************************************************/
static int psci_afflvl0_off(unsigned long mpidr, aff_map_node *cpu_node) static int psci_afflvl0_off(unsigned long mpidr, aff_map_node_t *cpu_node)
{ {
unsigned int index, plat_state; unsigned int index, plat_state;
int rc = PSCI_E_SUCCESS; int rc = PSCI_E_SUCCESS;
...@@ -111,7 +111,7 @@ static int psci_afflvl0_off(unsigned long mpidr, aff_map_node *cpu_node) ...@@ -111,7 +111,7 @@ static int psci_afflvl0_off(unsigned long mpidr, aff_map_node *cpu_node)
return rc; return rc;
} }
static int psci_afflvl1_off(unsigned long mpidr, aff_map_node *cluster_node) static int psci_afflvl1_off(unsigned long mpidr, aff_map_node_t *cluster_node)
{ {
int rc = PSCI_E_SUCCESS; int rc = PSCI_E_SUCCESS;
unsigned int plat_state; unsigned int plat_state;
...@@ -148,7 +148,7 @@ static int psci_afflvl1_off(unsigned long mpidr, aff_map_node *cluster_node) ...@@ -148,7 +148,7 @@ static int psci_afflvl1_off(unsigned long mpidr, aff_map_node *cluster_node)
return rc; return rc;
} }
static int psci_afflvl2_off(unsigned long mpidr, aff_map_node *system_node) static int psci_afflvl2_off(unsigned long mpidr, aff_map_node_t *system_node)
{ {
int rc = PSCI_E_SUCCESS; int rc = PSCI_E_SUCCESS;
unsigned int plat_state; unsigned int plat_state;
...@@ -178,7 +178,7 @@ static int psci_afflvl2_off(unsigned long mpidr, aff_map_node *system_node) ...@@ -178,7 +178,7 @@ static int psci_afflvl2_off(unsigned long mpidr, aff_map_node *system_node)
return rc; return rc;
} }
static const afflvl_off_handler psci_afflvl_off_handlers[] = { static const afflvl_off_handler_t psci_afflvl_off_handlers[] = {
psci_afflvl0_off, psci_afflvl0_off,
psci_afflvl1_off, psci_afflvl1_off,
psci_afflvl2_off, psci_afflvl2_off,
...@@ -189,13 +189,13 @@ static const afflvl_off_handler psci_afflvl_off_handlers[] = { ...@@ -189,13 +189,13 @@ static const afflvl_off_handler psci_afflvl_off_handlers[] = {
* topology tree and calls the off handler for the corresponding affinity * topology tree and calls the off handler for the corresponding affinity
* levels * levels
******************************************************************************/ ******************************************************************************/
static int psci_call_off_handlers(mpidr_aff_map_nodes mpidr_nodes, static int psci_call_off_handlers(mpidr_aff_map_nodes_t mpidr_nodes,
int start_afflvl, int start_afflvl,
int end_afflvl, int end_afflvl,
unsigned long mpidr) unsigned long mpidr)
{ {
int rc = PSCI_E_INVALID_PARAMS, level; int rc = PSCI_E_INVALID_PARAMS, level;
aff_map_node *node; aff_map_node_t *node;
for (level = start_afflvl; level <= end_afflvl; level++) { for (level = start_afflvl; level <= end_afflvl; level++) {
node = mpidr_nodes[level]; node = mpidr_nodes[level];
...@@ -242,7 +242,7 @@ int psci_afflvl_off(unsigned long mpidr, ...@@ -242,7 +242,7 @@ int psci_afflvl_off(unsigned long mpidr,
int end_afflvl) int end_afflvl)
{ {
int rc = PSCI_E_SUCCESS; int rc = PSCI_E_SUCCESS;
mpidr_aff_map_nodes mpidr_nodes; mpidr_aff_map_nodes_t mpidr_nodes;
mpidr &= MPIDR_AFFINITY_MASK;; mpidr &= MPIDR_AFFINITY_MASK;;
......
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
#include <runtime_svc.h> #include <runtime_svc.h>
#include "psci_private.h" #include "psci_private.h"
typedef int (*afflvl_on_handler)(unsigned long, typedef int (*afflvl_on_handler_t)(unsigned long,
aff_map_node *, aff_map_node_t *,
unsigned long, unsigned long,
unsigned long); unsigned long);
...@@ -51,7 +51,7 @@ typedef int (*afflvl_on_handler)(unsigned long, ...@@ -51,7 +51,7 @@ typedef int (*afflvl_on_handler)(unsigned long,
* This function checks whether a cpu which has been requested to be turned on * This function checks whether a cpu which has been requested to be turned on
* is OFF to begin with. * is OFF to begin with.
******************************************************************************/ ******************************************************************************/
static int cpu_on_validate_state(aff_map_node *node) static int cpu_on_validate_state(aff_map_node_t *node)
{ {
unsigned int psci_state; unsigned int psci_state;
...@@ -74,7 +74,7 @@ static int cpu_on_validate_state(aff_map_node *node) ...@@ -74,7 +74,7 @@ static int cpu_on_validate_state(aff_map_node *node)
* TODO: Split this code across separate handlers for each type of setup? * TODO: Split this code across separate handlers for each type of setup?
******************************************************************************/ ******************************************************************************/
static int psci_afflvl0_on(unsigned long target_cpu, static int psci_afflvl0_on(unsigned long target_cpu,
aff_map_node *cpu_node, aff_map_node_t *cpu_node,
unsigned long ns_entrypoint, unsigned long ns_entrypoint,
unsigned long context_id) unsigned long context_id)
{ {
...@@ -142,7 +142,7 @@ static int psci_afflvl0_on(unsigned long target_cpu, ...@@ -142,7 +142,7 @@ static int psci_afflvl0_on(unsigned long target_cpu,
* TODO: Split this code across separate handlers for each type of setup? * TODO: Split this code across separate handlers for each type of setup?
******************************************************************************/ ******************************************************************************/
static int psci_afflvl1_on(unsigned long target_cpu, static int psci_afflvl1_on(unsigned long target_cpu,
aff_map_node *cluster_node, aff_map_node_t *cluster_node,
unsigned long ns_entrypoint, unsigned long ns_entrypoint,
unsigned long context_id) unsigned long context_id)
{ {
...@@ -183,7 +183,7 @@ static int psci_afflvl1_on(unsigned long target_cpu, ...@@ -183,7 +183,7 @@ static int psci_afflvl1_on(unsigned long target_cpu,
* TODO: Split this code across separate handlers for each type of setup? * TODO: Split this code across separate handlers for each type of setup?
******************************************************************************/ ******************************************************************************/
static int psci_afflvl2_on(unsigned long target_cpu, static int psci_afflvl2_on(unsigned long target_cpu,
aff_map_node *system_node, aff_map_node_t *system_node,
unsigned long ns_entrypoint, unsigned long ns_entrypoint,
unsigned long context_id) unsigned long context_id)
{ {
...@@ -220,7 +220,7 @@ static int psci_afflvl2_on(unsigned long target_cpu, ...@@ -220,7 +220,7 @@ static int psci_afflvl2_on(unsigned long target_cpu,
} }
/* Private data structure to make this handlers accessible through indexing */ /* Private data structure to make this handlers accessible through indexing */
static const afflvl_on_handler psci_afflvl_on_handlers[] = { static const afflvl_on_handler_t psci_afflvl_on_handlers[] = {
psci_afflvl0_on, psci_afflvl0_on,
psci_afflvl1_on, psci_afflvl1_on,
psci_afflvl2_on, psci_afflvl2_on,
...@@ -231,7 +231,7 @@ static const afflvl_on_handler psci_afflvl_on_handlers[] = { ...@@ -231,7 +231,7 @@ static const afflvl_on_handler psci_afflvl_on_handlers[] = {
* topology tree and calls the on handler for the corresponding affinity * topology tree and calls the on handler for the corresponding affinity
* levels * levels
******************************************************************************/ ******************************************************************************/
static int psci_call_on_handlers(mpidr_aff_map_nodes target_cpu_nodes, static int psci_call_on_handlers(mpidr_aff_map_nodes_t target_cpu_nodes,
int start_afflvl, int start_afflvl,
int end_afflvl, int end_afflvl,
unsigned long target_cpu, unsigned long target_cpu,
...@@ -239,7 +239,7 @@ static int psci_call_on_handlers(mpidr_aff_map_nodes target_cpu_nodes, ...@@ -239,7 +239,7 @@ static int psci_call_on_handlers(mpidr_aff_map_nodes target_cpu_nodes,
unsigned long context_id) unsigned long context_id)
{ {
int rc = PSCI_E_INVALID_PARAMS, level; int rc = PSCI_E_INVALID_PARAMS, level;
aff_map_node *node; aff_map_node_t *node;
for (level = end_afflvl; level >= start_afflvl; level--) { for (level = end_afflvl; level >= start_afflvl; level--) {
node = target_cpu_nodes[level]; node = target_cpu_nodes[level];
...@@ -285,7 +285,7 @@ int psci_afflvl_on(unsigned long target_cpu, ...@@ -285,7 +285,7 @@ int psci_afflvl_on(unsigned long target_cpu,
int end_afflvl) int end_afflvl)
{ {
int rc = PSCI_E_SUCCESS; int rc = PSCI_E_SUCCESS;
mpidr_aff_map_nodes target_cpu_nodes; mpidr_aff_map_nodes_t target_cpu_nodes;
unsigned long mpidr = read_mpidr() & MPIDR_AFFINITY_MASK; unsigned long mpidr = read_mpidr() & MPIDR_AFFINITY_MASK;
/* /*
...@@ -337,7 +337,7 @@ int psci_afflvl_on(unsigned long target_cpu, ...@@ -337,7 +337,7 @@ int psci_afflvl_on(unsigned long target_cpu,
* are called by the common finisher routine in psci_common.c. * are called by the common finisher routine in psci_common.c.
******************************************************************************/ ******************************************************************************/
static unsigned int psci_afflvl0_on_finish(unsigned long mpidr, static unsigned int psci_afflvl0_on_finish(unsigned long mpidr,
aff_map_node *cpu_node) aff_map_node_t *cpu_node)
{ {
unsigned int index, plat_state, state, rc = PSCI_E_SUCCESS; unsigned int index, plat_state, state, rc = PSCI_E_SUCCESS;
...@@ -412,7 +412,7 @@ static unsigned int psci_afflvl0_on_finish(unsigned long mpidr, ...@@ -412,7 +412,7 @@ static unsigned int psci_afflvl0_on_finish(unsigned long mpidr,
} }
static unsigned int psci_afflvl1_on_finish(unsigned long mpidr, static unsigned int psci_afflvl1_on_finish(unsigned long mpidr,
aff_map_node *cluster_node) aff_map_node_t *cluster_node)
{ {
unsigned int plat_state, rc = PSCI_E_SUCCESS; unsigned int plat_state, rc = PSCI_E_SUCCESS;
...@@ -444,7 +444,7 @@ static unsigned int psci_afflvl1_on_finish(unsigned long mpidr, ...@@ -444,7 +444,7 @@ static unsigned int psci_afflvl1_on_finish(unsigned long mpidr,
static unsigned int psci_afflvl2_on_finish(unsigned long mpidr, static unsigned int psci_afflvl2_on_finish(unsigned long mpidr,
aff_map_node *system_node) aff_map_node_t *system_node)
{ {
unsigned int plat_state, rc = PSCI_E_SUCCESS; unsigned int plat_state, rc = PSCI_E_SUCCESS;
...@@ -480,7 +480,7 @@ static unsigned int psci_afflvl2_on_finish(unsigned long mpidr, ...@@ -480,7 +480,7 @@ static unsigned int psci_afflvl2_on_finish(unsigned long mpidr,
return rc; return rc;
} }
const afflvl_power_on_finisher psci_afflvl_on_finishers[] = { const afflvl_power_on_finisher_t psci_afflvl_on_finishers[] = {
psci_afflvl0_on_finish, psci_afflvl0_on_finish,
psci_afflvl1_on_finish, psci_afflvl1_on_finish,
psci_afflvl2_on_finish, psci_afflvl2_on_finish,
......
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
#include <runtime_svc.h> #include <runtime_svc.h>
#include "psci_private.h" #include "psci_private.h"
typedef int (*afflvl_suspend_handler)(unsigned long, typedef int (*afflvl_suspend_handler_t)(unsigned long,
aff_map_node *, aff_map_node_t *,
unsigned long, unsigned long,
unsigned long, unsigned long,
unsigned int); unsigned int);
...@@ -50,7 +50,7 @@ typedef int (*afflvl_suspend_handler)(unsigned long, ...@@ -50,7 +50,7 @@ typedef int (*afflvl_suspend_handler)(unsigned long,
* This function sets the power state of the current cpu while * This function sets the power state of the current cpu while
* powering down during a cpu_suspend call * powering down during a cpu_suspend call
******************************************************************************/ ******************************************************************************/
void psci_set_suspend_power_state(aff_map_node *node, unsigned int power_state) void psci_set_suspend_power_state(aff_map_node_t *node, unsigned int power_state)
{ {
/* /*
* Check that nobody else is calling this function on our behalf & * Check that nobody else is calling this function on our behalf &
...@@ -68,7 +68,7 @@ void psci_set_suspend_power_state(aff_map_node *node, unsigned int power_state) ...@@ -68,7 +68,7 @@ void psci_set_suspend_power_state(aff_map_node *node, unsigned int power_state)
*/ */
flush_dcache_range( flush_dcache_range(
(unsigned long)&psci_suspend_context[node->data], (unsigned long)&psci_suspend_context[node->data],
sizeof(suspend_context)); sizeof(suspend_context_t));
} }
/******************************************************************************* /*******************************************************************************
...@@ -78,7 +78,7 @@ void psci_set_suspend_power_state(aff_map_node *node, unsigned int power_state) ...@@ -78,7 +78,7 @@ void psci_set_suspend_power_state(aff_map_node *node, unsigned int power_state)
******************************************************************************/ ******************************************************************************/
int psci_get_suspend_afflvl(unsigned long mpidr) int psci_get_suspend_afflvl(unsigned long mpidr)
{ {
aff_map_node *node; aff_map_node_t *node;
node = psci_get_aff_map_node(mpidr & MPIDR_AFFINITY_MASK, node = psci_get_aff_map_node(mpidr & MPIDR_AFFINITY_MASK,
MPIDR_AFFLVL0); MPIDR_AFFLVL0);
...@@ -93,7 +93,7 @@ int psci_get_suspend_afflvl(unsigned long mpidr) ...@@ -93,7 +93,7 @@ int psci_get_suspend_afflvl(unsigned long mpidr)
* down during a cpu_suspend call. Returns PSCI_INVALID_DATA if the * down during a cpu_suspend call. Returns PSCI_INVALID_DATA if the
* power state saved for the node is invalid * power state saved for the node is invalid
******************************************************************************/ ******************************************************************************/
int psci_get_aff_map_node_suspend_afflvl(aff_map_node *node) int psci_get_aff_map_node_suspend_afflvl(aff_map_node_t *node)
{ {
unsigned int power_state; unsigned int power_state;
...@@ -111,7 +111,7 @@ int psci_get_aff_map_node_suspend_afflvl(aff_map_node *node) ...@@ -111,7 +111,7 @@ int psci_get_aff_map_node_suspend_afflvl(aff_map_node *node)
******************************************************************************/ ******************************************************************************/
int psci_get_suspend_stateid(unsigned long mpidr) int psci_get_suspend_stateid(unsigned long mpidr)
{ {
aff_map_node *node; aff_map_node_t *node;
unsigned int power_state; unsigned int power_state;
node = psci_get_aff_map_node(mpidr & MPIDR_AFFINITY_MASK, node = psci_get_aff_map_node(mpidr & MPIDR_AFFINITY_MASK,
...@@ -129,14 +129,14 @@ int psci_get_suspend_stateid(unsigned long mpidr) ...@@ -129,14 +129,14 @@ int psci_get_suspend_stateid(unsigned long mpidr)
* level which is called when that affinity level is about to be suspended. * level which is called when that affinity level is about to be suspended.
******************************************************************************/ ******************************************************************************/
static int psci_afflvl0_suspend(unsigned long mpidr, static int psci_afflvl0_suspend(unsigned long mpidr,
aff_map_node *cpu_node, aff_map_node_t *cpu_node,
unsigned long ns_entrypoint, unsigned long ns_entrypoint,
unsigned long context_id, unsigned long context_id,
unsigned int power_state) unsigned int power_state)
{ {
unsigned int index, plat_state; unsigned int index, plat_state;
unsigned long psci_entrypoint, sctlr; unsigned long psci_entrypoint, sctlr;
el3_state *saved_el3_state; el3_state_t *saved_el3_state;
int rc = PSCI_E_SUCCESS; int rc = PSCI_E_SUCCESS;
/* Sanity check to safeguard against data corruption */ /* Sanity check to safeguard against data corruption */
...@@ -228,7 +228,7 @@ static int psci_afflvl0_suspend(unsigned long mpidr, ...@@ -228,7 +228,7 @@ static int psci_afflvl0_suspend(unsigned long mpidr,
} }
static int psci_afflvl1_suspend(unsigned long mpidr, static int psci_afflvl1_suspend(unsigned long mpidr,
aff_map_node *cluster_node, aff_map_node_t *cluster_node,
unsigned long ns_entrypoint, unsigned long ns_entrypoint,
unsigned long context_id, unsigned long context_id,
unsigned int power_state) unsigned int power_state)
...@@ -282,7 +282,7 @@ static int psci_afflvl1_suspend(unsigned long mpidr, ...@@ -282,7 +282,7 @@ static int psci_afflvl1_suspend(unsigned long mpidr,
static int psci_afflvl2_suspend(unsigned long mpidr, static int psci_afflvl2_suspend(unsigned long mpidr,
aff_map_node *system_node, aff_map_node_t *system_node,
unsigned long ns_entrypoint, unsigned long ns_entrypoint,
unsigned long context_id, unsigned long context_id,
unsigned int power_state) unsigned int power_state)
...@@ -326,7 +326,7 @@ static int psci_afflvl2_suspend(unsigned long mpidr, ...@@ -326,7 +326,7 @@ static int psci_afflvl2_suspend(unsigned long mpidr,
return rc; return rc;
} }
static const afflvl_suspend_handler psci_afflvl_suspend_handlers[] = { static const afflvl_suspend_handler_t psci_afflvl_suspend_handlers[] = {
psci_afflvl0_suspend, psci_afflvl0_suspend,
psci_afflvl1_suspend, psci_afflvl1_suspend,
psci_afflvl2_suspend, psci_afflvl2_suspend,
...@@ -337,7 +337,7 @@ static const afflvl_suspend_handler psci_afflvl_suspend_handlers[] = { ...@@ -337,7 +337,7 @@ static const afflvl_suspend_handler psci_afflvl_suspend_handlers[] = {
* topology tree and calls the suspend handler for the corresponding affinity * topology tree and calls the suspend handler for the corresponding affinity
* levels * levels
******************************************************************************/ ******************************************************************************/
static int psci_call_suspend_handlers(mpidr_aff_map_nodes mpidr_nodes, static int psci_call_suspend_handlers(mpidr_aff_map_nodes_t mpidr_nodes,
int start_afflvl, int start_afflvl,
int end_afflvl, int end_afflvl,
unsigned long mpidr, unsigned long mpidr,
...@@ -346,7 +346,7 @@ static int psci_call_suspend_handlers(mpidr_aff_map_nodes mpidr_nodes, ...@@ -346,7 +346,7 @@ static int psci_call_suspend_handlers(mpidr_aff_map_nodes mpidr_nodes,
unsigned int power_state) unsigned int power_state)
{ {
int rc = PSCI_E_INVALID_PARAMS, level; int rc = PSCI_E_INVALID_PARAMS, level;
aff_map_node *node; aff_map_node_t *node;
for (level = start_afflvl; level <= end_afflvl; level++) { for (level = start_afflvl; level <= end_afflvl; level++) {
node = mpidr_nodes[level]; node = mpidr_nodes[level];
...@@ -400,7 +400,7 @@ int psci_afflvl_suspend(unsigned long mpidr, ...@@ -400,7 +400,7 @@ int psci_afflvl_suspend(unsigned long mpidr,
int end_afflvl) int end_afflvl)
{ {
int rc = PSCI_E_SUCCESS; int rc = PSCI_E_SUCCESS;
mpidr_aff_map_nodes mpidr_nodes; mpidr_aff_map_nodes_t mpidr_nodes;
mpidr &= MPIDR_AFFINITY_MASK; mpidr &= MPIDR_AFFINITY_MASK;
...@@ -453,7 +453,7 @@ int psci_afflvl_suspend(unsigned long mpidr, ...@@ -453,7 +453,7 @@ int psci_afflvl_suspend(unsigned long mpidr,
* are called by the common finisher routine in psci_common.c. * are called by the common finisher routine in psci_common.c.
******************************************************************************/ ******************************************************************************/
static unsigned int psci_afflvl0_suspend_finish(unsigned long mpidr, static unsigned int psci_afflvl0_suspend_finish(unsigned long mpidr,
aff_map_node *cpu_node) aff_map_node_t *cpu_node)
{ {
unsigned int index, plat_state, state, rc = PSCI_E_SUCCESS; unsigned int index, plat_state, state, rc = PSCI_E_SUCCESS;
int32_t suspend_level; int32_t suspend_level;
...@@ -533,7 +533,7 @@ static unsigned int psci_afflvl0_suspend_finish(unsigned long mpidr, ...@@ -533,7 +533,7 @@ static unsigned int psci_afflvl0_suspend_finish(unsigned long mpidr,
} }
static unsigned int psci_afflvl1_suspend_finish(unsigned long mpidr, static unsigned int psci_afflvl1_suspend_finish(unsigned long mpidr,
aff_map_node *cluster_node) aff_map_node_t *cluster_node)
{ {
unsigned int plat_state, rc = PSCI_E_SUCCESS; unsigned int plat_state, rc = PSCI_E_SUCCESS;
...@@ -565,7 +565,7 @@ static unsigned int psci_afflvl1_suspend_finish(unsigned long mpidr, ...@@ -565,7 +565,7 @@ static unsigned int psci_afflvl1_suspend_finish(unsigned long mpidr,
static unsigned int psci_afflvl2_suspend_finish(unsigned long mpidr, static unsigned int psci_afflvl2_suspend_finish(unsigned long mpidr,
aff_map_node *system_node) aff_map_node_t *system_node)
{ {
unsigned int plat_state, rc = PSCI_E_SUCCESS;; unsigned int plat_state, rc = PSCI_E_SUCCESS;;
...@@ -601,7 +601,7 @@ static unsigned int psci_afflvl2_suspend_finish(unsigned long mpidr, ...@@ -601,7 +601,7 @@ static unsigned int psci_afflvl2_suspend_finish(unsigned long mpidr,
return rc; return rc;
} }
const afflvl_power_on_finisher psci_afflvl_suspend_finishers[] = { const afflvl_power_on_finisher_t psci_afflvl_suspend_finishers[] = {
psci_afflvl0_suspend_finish, psci_afflvl0_suspend_finish,
psci_afflvl1_suspend_finish, psci_afflvl1_suspend_finish,
psci_afflvl2_suspend_finish, psci_afflvl2_suspend_finish,
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
* SPD power management operations, expected to be supplied by the registered * SPD power management operations, expected to be supplied by the registered
* SPD on successful SP initialization * SPD on successful SP initialization
*/ */
const spd_pm_ops *psci_spd_pm; const spd_pm_ops_t *psci_spd_pm;
/******************************************************************************* /*******************************************************************************
* Arrays that contains information needs to resume a cpu's execution when woken * Arrays that contains information needs to resume a cpu's execution when woken
...@@ -52,8 +52,8 @@ const spd_pm_ops *psci_spd_pm; ...@@ -52,8 +52,8 @@ const spd_pm_ops *psci_spd_pm;
* free index in the 'psci_ns_entry_info' & 'psci_suspend_context' arrays. Each * free index in the 'psci_ns_entry_info' & 'psci_suspend_context' arrays. Each
* cpu is allocated a single entry in each array during startup. * cpu is allocated a single entry in each array during startup.
******************************************************************************/ ******************************************************************************/
suspend_context psci_suspend_context[PSCI_NUM_AFFS]; suspend_context_t psci_suspend_context[PSCI_NUM_AFFS];
ns_entry_info psci_ns_entry_info[PSCI_NUM_AFFS]; ns_entry_info_t psci_ns_entry_info[PSCI_NUM_AFFS];
unsigned int psci_ns_einfo_idx; unsigned int psci_ns_einfo_idx;
/******************************************************************************* /*******************************************************************************
...@@ -61,7 +61,7 @@ unsigned int psci_ns_einfo_idx; ...@@ -61,7 +61,7 @@ unsigned int psci_ns_einfo_idx;
* management of affinity instances. Each node (aff_map_node) in the array * management of affinity instances. Each node (aff_map_node) in the array
* corresponds to an affinity instance e.g. cluster, cpu within an mpidr * corresponds to an affinity instance e.g. cluster, cpu within an mpidr
******************************************************************************/ ******************************************************************************/
aff_map_node psci_aff_map[PSCI_NUM_AFFS] aff_map_node_t psci_aff_map[PSCI_NUM_AFFS]
__attribute__ ((section("tzfw_coherent_mem"))); __attribute__ ((section("tzfw_coherent_mem")));
/******************************************************************************* /*******************************************************************************
...@@ -72,12 +72,12 @@ __attribute__ ((section("tzfw_coherent_mem"))); ...@@ -72,12 +72,12 @@ __attribute__ ((section("tzfw_coherent_mem")));
* level i.e. start index and end index needs to be present. 'psci_aff_limits' * level i.e. start index and end index needs to be present. 'psci_aff_limits'
* stores this information. * stores this information.
******************************************************************************/ ******************************************************************************/
aff_limits_node psci_aff_limits[MPIDR_MAX_AFFLVL + 1]; aff_limits_node_t psci_aff_limits[MPIDR_MAX_AFFLVL + 1];
/******************************************************************************* /*******************************************************************************
* Pointer to functions exported by the platform to complete power mgmt. ops * Pointer to functions exported by the platform to complete power mgmt. ops
******************************************************************************/ ******************************************************************************/
plat_pm_ops *psci_plat_pm_ops; plat_pm_ops_t *psci_plat_pm_ops;
/******************************************************************************* /*******************************************************************************
* Routine to return the maximum affinity level to traverse to after a cpu has * Routine to return the maximum affinity level to traverse to after a cpu has
...@@ -89,7 +89,7 @@ plat_pm_ops *psci_plat_pm_ops; ...@@ -89,7 +89,7 @@ plat_pm_ops *psci_plat_pm_ops;
******************************************************************************/ ******************************************************************************/
int get_power_on_target_afflvl(unsigned long mpidr) int get_power_on_target_afflvl(unsigned long mpidr)
{ {
aff_map_node *node; aff_map_node_t *node;
unsigned int state; unsigned int state;
int afflvl; int afflvl;
...@@ -180,7 +180,7 @@ int psci_check_afflvl_range(int start_afflvl, int end_afflvl) ...@@ -180,7 +180,7 @@ int psci_check_afflvl_range(int start_afflvl, int end_afflvl)
void psci_acquire_afflvl_locks(unsigned long mpidr, void psci_acquire_afflvl_locks(unsigned long mpidr,
int start_afflvl, int start_afflvl,
int end_afflvl, int end_afflvl,
mpidr_aff_map_nodes mpidr_nodes) mpidr_aff_map_nodes_t mpidr_nodes)
{ {
int level; int level;
...@@ -199,7 +199,7 @@ void psci_acquire_afflvl_locks(unsigned long mpidr, ...@@ -199,7 +199,7 @@ void psci_acquire_afflvl_locks(unsigned long mpidr,
void psci_release_afflvl_locks(unsigned long mpidr, void psci_release_afflvl_locks(unsigned long mpidr,
int start_afflvl, int start_afflvl,
int end_afflvl, int end_afflvl,
mpidr_aff_map_nodes mpidr_nodes) mpidr_aff_map_nodes_t mpidr_nodes)
{ {
int level; int level;
...@@ -216,7 +216,7 @@ void psci_release_afflvl_locks(unsigned long mpidr, ...@@ -216,7 +216,7 @@ void psci_release_afflvl_locks(unsigned long mpidr,
******************************************************************************/ ******************************************************************************/
int psci_validate_mpidr(unsigned long mpidr, int level) int psci_validate_mpidr(unsigned long mpidr, int level)
{ {
aff_map_node *node; aff_map_node_t *node;
node = psci_get_aff_map_node(mpidr, level); node = psci_get_aff_map_node(mpidr, level);
if (node && (node->state & PSCI_AFF_PRESENT)) if (node && (node->state & PSCI_AFF_PRESENT))
...@@ -234,8 +234,8 @@ void psci_get_ns_entry_info(unsigned int index) ...@@ -234,8 +234,8 @@ void psci_get_ns_entry_info(unsigned int index)
{ {
unsigned long sctlr = 0, scr, el_status, id_aa64pfr0; unsigned long sctlr = 0, scr, el_status, id_aa64pfr0;
uint64_t mpidr = read_mpidr(); uint64_t mpidr = read_mpidr();
cpu_context *ns_entry_context; cpu_context_t *ns_entry_context;
gp_regs *ns_entry_gpregs; gp_regs_t *ns_entry_gpregs;
scr = read_scr(); scr = read_scr();
...@@ -267,7 +267,7 @@ void psci_get_ns_entry_info(unsigned int index) ...@@ -267,7 +267,7 @@ void psci_get_ns_entry_info(unsigned int index)
write_sctlr_el1(sctlr); write_sctlr_el1(sctlr);
/* Fulfill the cpu_on entry reqs. as per the psci spec */ /* Fulfill the cpu_on entry reqs. as per the psci spec */
ns_entry_context = (cpu_context *) cm_get_context(mpidr, NON_SECURE); ns_entry_context = (cpu_context_t *) cm_get_context(mpidr, NON_SECURE);
assert(ns_entry_context); assert(ns_entry_context);
/* /*
...@@ -380,7 +380,7 @@ int psci_set_ns_entry_info(unsigned int index, ...@@ -380,7 +380,7 @@ int psci_set_ns_entry_info(unsigned int index,
* This function takes a pointer to an affinity node in the topology tree and * This function takes a pointer to an affinity node in the topology tree and
* returns its state. State of a non-leaf node needs to be calculated. * returns its state. State of a non-leaf node needs to be calculated.
******************************************************************************/ ******************************************************************************/
unsigned short psci_get_state(aff_map_node *node) unsigned short psci_get_state(aff_map_node_t *node)
{ {
assert(node->level >= MPIDR_AFFLVL0 && node->level <= MPIDR_MAX_AFFLVL); assert(node->level >= MPIDR_AFFLVL0 && node->level <= MPIDR_MAX_AFFLVL);
...@@ -407,7 +407,7 @@ unsigned short psci_get_state(aff_map_node *node) ...@@ -407,7 +407,7 @@ unsigned short psci_get_state(aff_map_node *node)
* a target state. State of a non-leaf node needs to be converted to a reference * a target state. State of a non-leaf node needs to be converted to a reference
* count. State of a leaf node can be set directly. * count. State of a leaf node can be set directly.
******************************************************************************/ ******************************************************************************/
void psci_set_state(aff_map_node *node, unsigned short state) void psci_set_state(aff_map_node_t *node, unsigned short state)
{ {
assert(node->level >= MPIDR_AFFLVL0 && node->level <= MPIDR_MAX_AFFLVL); assert(node->level >= MPIDR_AFFLVL0 && node->level <= MPIDR_MAX_AFFLVL);
...@@ -448,7 +448,7 @@ void psci_set_state(aff_map_node *node, unsigned short state) ...@@ -448,7 +448,7 @@ void psci_set_state(aff_map_node *node, unsigned short state)
* tell whether that's actually happenned or not. So we err on the side of * tell whether that's actually happenned or not. So we err on the side of
* caution & treat the affinity level as being turned off. * caution & treat the affinity level as being turned off.
******************************************************************************/ ******************************************************************************/
unsigned short psci_get_phys_state(aff_map_node *node) unsigned short psci_get_phys_state(aff_map_node_t *node)
{ {
unsigned int state; unsigned int state;
...@@ -461,14 +461,14 @@ unsigned short psci_get_phys_state(aff_map_node *node) ...@@ -461,14 +461,14 @@ unsigned short psci_get_phys_state(aff_map_node *node)
* topology tree and calls the physical power on handler for the corresponding * topology tree and calls the physical power on handler for the corresponding
* affinity levels * affinity levels
******************************************************************************/ ******************************************************************************/
static int psci_call_power_on_handlers(mpidr_aff_map_nodes mpidr_nodes, static int psci_call_power_on_handlers(mpidr_aff_map_nodes_t mpidr_nodes,
int start_afflvl, int start_afflvl,
int end_afflvl, int end_afflvl,
afflvl_power_on_finisher *pon_handlers, afflvl_power_on_finisher_t *pon_handlers,
unsigned long mpidr) unsigned long mpidr)
{ {
int rc = PSCI_E_INVALID_PARAMS, level; int rc = PSCI_E_INVALID_PARAMS, level;
aff_map_node *node; aff_map_node_t *node;
for (level = end_afflvl; level >= start_afflvl; level--) { for (level = end_afflvl; level >= start_afflvl; level--) {
node = mpidr_nodes[level]; node = mpidr_nodes[level];
...@@ -511,9 +511,9 @@ static int psci_call_power_on_handlers(mpidr_aff_map_nodes mpidr_nodes, ...@@ -511,9 +511,9 @@ static int psci_call_power_on_handlers(mpidr_aff_map_nodes mpidr_nodes,
void psci_afflvl_power_on_finish(unsigned long mpidr, void psci_afflvl_power_on_finish(unsigned long mpidr,
int start_afflvl, int start_afflvl,
int end_afflvl, int end_afflvl,
afflvl_power_on_finisher *pon_handlers) afflvl_power_on_finisher_t *pon_handlers)
{ {
mpidr_aff_map_nodes mpidr_nodes; mpidr_aff_map_nodes_t mpidr_nodes;
int rc; int rc;
mpidr &= MPIDR_AFFINITY_MASK; mpidr &= MPIDR_AFFINITY_MASK;
...@@ -565,7 +565,7 @@ void psci_afflvl_power_on_finish(unsigned long mpidr, ...@@ -565,7 +565,7 @@ void psci_afflvl_power_on_finish(unsigned long mpidr,
* management operation. The power management hooks are expected to be provided * management operation. The power management hooks are expected to be provided
* by the SPD, after it finishes all its initialization * by the SPD, after it finishes all its initialization
******************************************************************************/ ******************************************************************************/
void psci_register_spd_pm_hook(const spd_pm_ops *pm) void psci_register_spd_pm_hook(const spd_pm_ops_t *pm)
{ {
psci_spd_pm = pm; psci_spd_pm = pm;
} }
...@@ -144,7 +144,7 @@ int psci_affinity_info(unsigned long target_affinity, ...@@ -144,7 +144,7 @@ int psci_affinity_info(unsigned long target_affinity,
{ {
int rc = PSCI_E_INVALID_PARAMS; int rc = PSCI_E_INVALID_PARAMS;
unsigned int aff_state; unsigned int aff_state;
aff_map_node *node; aff_map_node_t *node;
if (lowest_affinity_level > get_max_afflvl()) if (lowest_affinity_level > get_max_afflvl())
return rc; return rc;
......
...@@ -39,73 +39,73 @@ ...@@ -39,73 +39,73 @@
* The following two data structures hold the generic information to bringup * The following two data structures hold the generic information to bringup
* a suspended/hotplugged out cpu * a suspended/hotplugged out cpu
******************************************************************************/ ******************************************************************************/
typedef struct { typedef struct eret_params {
unsigned long entrypoint; unsigned long entrypoint;
unsigned long spsr; unsigned long spsr;
} eret_params; } eret_params_t;
typedef struct { typedef struct ns_entry_info {
eret_params eret_info; eret_params_t eret_info;
unsigned long context_id; unsigned long context_id;
unsigned int scr; unsigned int scr;
unsigned int sctlr; unsigned int sctlr;
} ns_entry_info; } ns_entry_info_t;
/******************************************************************************* /*******************************************************************************
* The following two data structures hold the topology tree which in turn tracks * The following two data structures hold the topology tree which in turn tracks
* the state of the all the affinity instances supported by the platform. * the state of the all the affinity instances supported by the platform.
******************************************************************************/ ******************************************************************************/
typedef struct { typedef struct aff_map_node {
unsigned long mpidr; unsigned long mpidr;
unsigned short ref_count; unsigned short ref_count;
unsigned char state; unsigned char state;
unsigned char level; unsigned char level;
unsigned int data; unsigned int data;
bakery_lock lock; bakery_lock_t lock;
} aff_map_node; } aff_map_node_t;
typedef struct { typedef struct aff_limits_node {
int min; int min;
int max; int max;
} aff_limits_node; } aff_limits_node_t;
/******************************************************************************* /*******************************************************************************
* This data structure holds secure world context that needs to be preserved * This data structure holds secure world context that needs to be preserved
* across cpu_suspend calls which enter the power down state. * across cpu_suspend calls which enter the power down state.
******************************************************************************/ ******************************************************************************/
typedef struct { typedef struct suspend_context {
unsigned int power_state; unsigned int power_state;
} __aligned(CACHE_WRITEBACK_GRANULE) suspend_context; } __aligned(CACHE_WRITEBACK_GRANULE) suspend_context_t;
typedef aff_map_node (*mpidr_aff_map_nodes[MPIDR_MAX_AFFLVL]); typedef aff_map_node_t (*mpidr_aff_map_nodes_t[MPIDR_MAX_AFFLVL]);
typedef unsigned int (*afflvl_power_on_finisher)(unsigned long, typedef unsigned int (*afflvl_power_on_finisher_t)(unsigned long,
aff_map_node *); aff_map_node_t *);
/******************************************************************************* /*******************************************************************************
* Data prototypes * Data prototypes
******************************************************************************/ ******************************************************************************/
extern suspend_context psci_suspend_context[PSCI_NUM_AFFS]; extern suspend_context_t psci_suspend_context[PSCI_NUM_AFFS];
extern ns_entry_info psci_ns_entry_info[PSCI_NUM_AFFS]; extern ns_entry_info_t psci_ns_entry_info[PSCI_NUM_AFFS];
extern unsigned int psci_ns_einfo_idx; extern unsigned int psci_ns_einfo_idx;
extern aff_limits_node psci_aff_limits[MPIDR_MAX_AFFLVL + 1]; extern aff_limits_node_t psci_aff_limits[MPIDR_MAX_AFFLVL + 1];
extern plat_pm_ops *psci_plat_pm_ops; extern plat_pm_ops_t *psci_plat_pm_ops;
extern aff_map_node psci_aff_map[PSCI_NUM_AFFS]; extern aff_map_node_t psci_aff_map[PSCI_NUM_AFFS];
extern afflvl_power_on_finisher psci_afflvl_off_finish_handlers[]; extern afflvl_power_on_finisher_t psci_afflvl_off_finish_handlers[];
extern afflvl_power_on_finisher psci_afflvl_sus_finish_handlers[]; extern afflvl_power_on_finisher_t psci_afflvl_sus_finish_handlers[];
/******************************************************************************* /*******************************************************************************
* SPD's power management hooks registered with PSCI * SPD's power management hooks registered with PSCI
******************************************************************************/ ******************************************************************************/
extern const spd_pm_ops *psci_spd_pm; extern const spd_pm_ops_t *psci_spd_pm;
/******************************************************************************* /*******************************************************************************
* Function prototypes * Function prototypes
******************************************************************************/ ******************************************************************************/
/* Private exported functions from psci_common.c */ /* Private exported functions from psci_common.c */
extern int get_max_afflvl(void); extern int get_max_afflvl(void);
extern unsigned short psci_get_state(aff_map_node *node); extern unsigned short psci_get_state(aff_map_node_t *node);
extern unsigned short psci_get_phys_state(aff_map_node *node); extern unsigned short psci_get_phys_state(aff_map_node_t *node);
extern void psci_set_state(aff_map_node *node, unsigned short state); extern void psci_set_state(aff_map_node_t *node, unsigned short state);
extern void psci_get_ns_entry_info(unsigned int index); extern void psci_get_ns_entry_info(unsigned int index);
extern unsigned long mpidr_set_aff_inst(unsigned long, unsigned char, int); extern unsigned long mpidr_set_aff_inst(unsigned long, unsigned char, int);
extern int psci_validate_mpidr(unsigned long, int); extern int psci_validate_mpidr(unsigned long, int);
...@@ -113,7 +113,7 @@ extern int get_power_on_target_afflvl(unsigned long mpidr); ...@@ -113,7 +113,7 @@ extern int get_power_on_target_afflvl(unsigned long mpidr);
extern void psci_afflvl_power_on_finish(unsigned long, extern void psci_afflvl_power_on_finish(unsigned long,
int, int,
int, int,
afflvl_power_on_finisher *); afflvl_power_on_finisher_t *);
extern int psci_set_ns_entry_info(unsigned int index, extern int psci_set_ns_entry_info(unsigned int index,
unsigned long entrypoint, unsigned long entrypoint,
unsigned long context_id); unsigned long context_id);
...@@ -121,18 +121,18 @@ extern int psci_check_afflvl_range(int start_afflvl, int end_afflvl); ...@@ -121,18 +121,18 @@ extern int psci_check_afflvl_range(int start_afflvl, int end_afflvl);
extern void psci_acquire_afflvl_locks(unsigned long mpidr, extern void psci_acquire_afflvl_locks(unsigned long mpidr,
int start_afflvl, int start_afflvl,
int end_afflvl, int end_afflvl,
mpidr_aff_map_nodes mpidr_nodes); mpidr_aff_map_nodes_t mpidr_nodes);
extern void psci_release_afflvl_locks(unsigned long mpidr, extern void psci_release_afflvl_locks(unsigned long mpidr,
int start_afflvl, int start_afflvl,
int end_afflvl, int end_afflvl,
mpidr_aff_map_nodes mpidr_nodes); mpidr_aff_map_nodes_t mpidr_nodes);
/* Private exported functions from psci_setup.c */ /* Private exported functions from psci_setup.c */
extern int psci_get_aff_map_nodes(unsigned long mpidr, extern int psci_get_aff_map_nodes(unsigned long mpidr,
int start_afflvl, int start_afflvl,
int end_afflvl, int end_afflvl,
mpidr_aff_map_nodes mpidr_nodes); mpidr_aff_map_nodes_t mpidr_nodes);
extern aff_map_node *psci_get_aff_map_node(unsigned long, int); extern aff_map_node_t *psci_get_aff_map_node(unsigned long, int);
/* Private exported functions from psci_affinity_on.c */ /* Private exported functions from psci_affinity_on.c */
extern int psci_afflvl_on(unsigned long, extern int psci_afflvl_on(unsigned long,
...@@ -145,9 +145,9 @@ extern int psci_afflvl_on(unsigned long, ...@@ -145,9 +145,9 @@ extern int psci_afflvl_on(unsigned long,
extern int psci_afflvl_off(unsigned long, int, int); extern int psci_afflvl_off(unsigned long, int, int);
/* Private exported functions from psci_affinity_suspend.c */ /* Private exported functions from psci_affinity_suspend.c */
extern void psci_set_suspend_power_state(aff_map_node *node, extern void psci_set_suspend_power_state(aff_map_node_t *node,
unsigned int power_state); unsigned int power_state);
extern int psci_get_aff_map_node_suspend_afflvl(aff_map_node *node); extern int psci_get_aff_map_node_suspend_afflvl(aff_map_node_t *node);
extern int psci_afflvl_suspend(unsigned long, extern int psci_afflvl_suspend(unsigned long,
unsigned long, unsigned long,
unsigned long, unsigned long,
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
* of relying on platform defined constants. Using PSCI_NUM_AFFS will be an * of relying on platform defined constants. Using PSCI_NUM_AFFS will be an
* overkill. * overkill.
******************************************************************************/ ******************************************************************************/
static cpu_context psci_ns_context[PLATFORM_CORE_COUNT]; static cpu_context_t psci_ns_context[PLATFORM_CORE_COUNT];
/******************************************************************************* /*******************************************************************************
* Routines for retrieving the node corresponding to an affinity level instance * Routines for retrieving the node corresponding to an affinity level instance
...@@ -81,7 +81,7 @@ static int psci_aff_map_get_idx(unsigned long key, ...@@ -81,7 +81,7 @@ static int psci_aff_map_get_idx(unsigned long key,
return mid; return mid;
} }
aff_map_node *psci_get_aff_map_node(unsigned long mpidr, int aff_lvl) aff_map_node_t *psci_get_aff_map_node(unsigned long mpidr, int aff_lvl)
{ {
int rc; int rc;
...@@ -106,10 +106,10 @@ aff_map_node *psci_get_aff_map_node(unsigned long mpidr, int aff_lvl) ...@@ -106,10 +106,10 @@ aff_map_node *psci_get_aff_map_node(unsigned long mpidr, int aff_lvl)
int psci_get_aff_map_nodes(unsigned long mpidr, int psci_get_aff_map_nodes(unsigned long mpidr,
int start_afflvl, int start_afflvl,
int end_afflvl, int end_afflvl,
mpidr_aff_map_nodes mpidr_nodes) mpidr_aff_map_nodes_t mpidr_nodes)
{ {
int rc = PSCI_E_INVALID_PARAMS, level; int rc = PSCI_E_INVALID_PARAMS, level;
aff_map_node *node; aff_map_node_t *node;
rc = psci_check_afflvl_range(start_afflvl, end_afflvl); rc = psci_check_afflvl_range(start_afflvl, end_afflvl);
if (rc != PSCI_E_SUCCESS) if (rc != PSCI_E_SUCCESS)
...@@ -285,7 +285,7 @@ int32_t psci_setup(void) ...@@ -285,7 +285,7 @@ int32_t psci_setup(void)
{ {
unsigned long mpidr = read_mpidr(); unsigned long mpidr = read_mpidr();
int afflvl, affmap_idx, max_afflvl; int afflvl, affmap_idx, max_afflvl;
aff_map_node *node; aff_map_node_t *node;
psci_ns_einfo_idx = 0; psci_ns_einfo_idx = 0;
psci_plat_pm_ops = NULL; psci_plat_pm_ops = NULL;
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#define OPT_DUMP 1 #define OPT_DUMP 1
#define OPT_HELP 2 #define OPT_HELP 2
file_info files[MAX_FILES]; file_info_t files[MAX_FILES];
unsigned file_info_count = 0; unsigned file_info_count = 0;
uuid_t uuid_null = {0}; uuid_t uuid_null = {0};
...@@ -54,7 +54,7 @@ uuid_t uuid_null = {0}; ...@@ -54,7 +54,7 @@ uuid_t uuid_null = {0};
*/ */
/* Currently only BL2 and BL31 images are supported. */ /* Currently only BL2 and BL31 images are supported. */
static entry_lookup_list toc_entry_lookup_list[] = { static entry_lookup_list_t toc_entry_lookup_list[] = {
{ "Trusted Boot Firmware BL2", UUID_TRUSTED_BOOT_FIRMWARE_BL2, { "Trusted Boot Firmware BL2", UUID_TRUSTED_BOOT_FIRMWARE_BL2,
"bl2", NULL, FLAG_FILENAME }, "bl2", NULL, FLAG_FILENAME },
{ "SCP Firmware BL3-0", UUID_SCP_FIRMWARE_BL30, { "SCP Firmware BL3-0", UUID_SCP_FIRMWARE_BL30,
...@@ -84,7 +84,7 @@ static inline void copy_uuid(uuid_t *to_uuid, const uuid_t *from_uuid) ...@@ -84,7 +84,7 @@ static inline void copy_uuid(uuid_t *to_uuid, const uuid_t *from_uuid)
static void print_usage(void) static void print_usage(void)
{ {
entry_lookup_list *entry = toc_entry_lookup_list; entry_lookup_list_t *entry = toc_entry_lookup_list;
printf("Usage: fip_create [options] FIP_FILENAME\n\n"); printf("Usage: fip_create [options] FIP_FILENAME\n\n");
printf("\tThis tool is used to create a Firmware Image Package.\n\n"); printf("\tThis tool is used to create a Firmware Image Package.\n\n");
...@@ -102,7 +102,7 @@ static void print_usage(void) ...@@ -102,7 +102,7 @@ static void print_usage(void)
} }
static entry_lookup_list *get_entry_lookup_from_uuid(const uuid_t *uuid) static entry_lookup_list_t *get_entry_lookup_from_uuid(const uuid_t *uuid)
{ {
unsigned int lookup_index = 0; unsigned int lookup_index = 0;
...@@ -117,7 +117,7 @@ static entry_lookup_list *get_entry_lookup_from_uuid(const uuid_t *uuid) ...@@ -117,7 +117,7 @@ static entry_lookup_list *get_entry_lookup_from_uuid(const uuid_t *uuid)
} }
static file_info *find_file_info_from_uuid(const uuid_t *uuid) static file_info_t *find_file_info_from_uuid(const uuid_t *uuid)
{ {
int index; int index;
...@@ -130,9 +130,9 @@ static file_info *find_file_info_from_uuid(const uuid_t *uuid) ...@@ -130,9 +130,9 @@ static file_info *find_file_info_from_uuid(const uuid_t *uuid)
} }
static int add_file_info_entry(entry_lookup_list *lookup_entry, char *filename) static int add_file_info_entry(entry_lookup_list_t *lookup_entry, char *filename)
{ {
file_info *file_info_entry; file_info_t *file_info_entry;
int error; int error;
struct stat file_status; struct stat file_status;
bool is_new_entry = false; bool is_new_entry = false;
...@@ -213,7 +213,7 @@ static int write_memory_to_file(const uint8_t *start, const char *filename, ...@@ -213,7 +213,7 @@ static int write_memory_to_file(const uint8_t *start, const char *filename,
} }
static int read_file_to_memory(void *memory, const file_info *info) static int read_file_to_memory(void *memory, const file_info_t *info)
{ {
FILE *stream; FILE *stream;
unsigned int bytes_read; unsigned int bytes_read;
...@@ -258,8 +258,8 @@ static int pack_images(const char *fip_filename) ...@@ -258,8 +258,8 @@ static int pack_images(const char *fip_filename)
int status; int status;
uint8_t *fip_base_address; uint8_t *fip_base_address;
void *entry_address; void *entry_address;
fip_toc_header *toc_header; fip_toc_header_t *toc_header;
fip_toc_entry *toc_entry; fip_toc_entry_t *toc_entry;
unsigned int entry_index; unsigned int entry_index;
unsigned int toc_size; unsigned int toc_size;
unsigned int fip_size; unsigned int fip_size;
...@@ -277,8 +277,8 @@ static int pack_images(const char *fip_filename) ...@@ -277,8 +277,8 @@ static int pack_images(const char *fip_filename)
} }
/* Allocate memory for entire package, including the final null entry */ /* Allocate memory for entire package, including the final null entry */
toc_size = (sizeof(fip_toc_header) + toc_size = (sizeof(fip_toc_header_t) +
(sizeof(fip_toc_entry) * (file_info_count + 1))); (sizeof(fip_toc_entry_t) * (file_info_count + 1)));
fip_size = toc_size + payload_size; fip_size = toc_size + payload_size;
fip_base_address = malloc(fip_size); fip_base_address = malloc(fip_size);
if (fip_base_address == NULL) { if (fip_base_address == NULL) {
...@@ -289,13 +289,13 @@ static int pack_images(const char *fip_filename) ...@@ -289,13 +289,13 @@ static int pack_images(const char *fip_filename)
memset(fip_base_address, 0, fip_size); memset(fip_base_address, 0, fip_size);
/* Create ToC Header */ /* Create ToC Header */
toc_header = (fip_toc_header *)fip_base_address; toc_header = (fip_toc_header_t *)fip_base_address;
toc_header->name = TOC_HEADER_NAME; toc_header->name = TOC_HEADER_NAME;
toc_header->serial_number = TOC_HEADER_SERIAL_NUMBER; toc_header->serial_number = TOC_HEADER_SERIAL_NUMBER;
toc_header->flags = 0; toc_header->flags = 0;
toc_entry = (fip_toc_entry *)(fip_base_address + toc_entry = (fip_toc_entry_t *)(fip_base_address +
sizeof(fip_toc_header)); sizeof(fip_toc_header_t));
/* Calculate the starting address of the first image, right after the /* Calculate the starting address of the first image, right after the
* toc header. * toc header.
...@@ -345,8 +345,8 @@ static void dump_toc(void) ...@@ -345,8 +345,8 @@ static void dump_toc(void)
unsigned int image_offset; unsigned int image_offset;
unsigned int image_size = 0; unsigned int image_size = 0;
image_offset = sizeof(fip_toc_header) + image_offset = sizeof(fip_toc_header_t) +
(sizeof(fip_toc_entry) * (file_info_count + 1)); (sizeof(fip_toc_entry_t) * (file_info_count + 1));
printf("Firmware Image Package ToC:\n"); printf("Firmware Image Package ToC:\n");
printf("---------------------------\n"); printf("---------------------------\n");
...@@ -376,10 +376,10 @@ static int parse_fip(const char *fip_filename) ...@@ -376,10 +376,10 @@ static int parse_fip(const char *fip_filename)
char *fip_buffer; char *fip_buffer;
char *fip_buffer_end; char *fip_buffer_end;
int fip_size, read_fip_size; int fip_size, read_fip_size;
fip_toc_header *toc_header; fip_toc_header_t *toc_header;
fip_toc_entry *toc_entry; fip_toc_entry_t *toc_entry;
bool found_last_toc_entry = false; bool found_last_toc_entry = false;
file_info *file_info_entry; file_info_t *file_info_entry;
int status = -1; int status = -1;
struct stat st; struct stat st;
...@@ -419,19 +419,19 @@ static int parse_fip(const char *fip_filename) ...@@ -419,19 +419,19 @@ static int parse_fip(const char *fip_filename)
fip = NULL; fip = NULL;
/* The package must at least contain the ToC Header */ /* The package must at least contain the ToC Header */
if (fip_size < sizeof(fip_toc_header)) { if (fip_size < sizeof(fip_toc_header_t)) {
printf("ERROR: Given FIP is smaller than the ToC header.\n"); printf("ERROR: Given FIP is smaller than the ToC header.\n");
status = EINVAL; status = EINVAL;
goto parse_fip_free; goto parse_fip_free;
} }
/* Set the ToC Header at the base of the buffer */ /* Set the ToC Header at the base of the buffer */
toc_header = (fip_toc_header *)fip_buffer; toc_header = (fip_toc_header_t *)fip_buffer;
/* The first toc entry should be just after the ToC header */ /* The first toc entry should be just after the ToC header */
toc_entry = (fip_toc_entry *)(toc_header + 1); toc_entry = (fip_toc_entry_t *)(toc_header + 1);
/* While the ToC entry is contained into the buffer */ /* While the ToC entry is contained into the buffer */
int cnt = 0; int cnt = 0;
while (((char *)toc_entry + sizeof(fip_toc_entry)) < fip_buffer_end) { while (((char *)toc_entry + sizeof(fip_toc_entry_t)) < fip_buffer_end) {
cnt++; cnt++;
/* Check if the ToC Entry is the last one */ /* Check if the ToC Entry is the last one */
if (compare_uuids(&toc_entry->uuid, &uuid_null) == 0) { if (compare_uuids(&toc_entry->uuid, &uuid_null) == 0) {
...@@ -444,7 +444,7 @@ static int parse_fip(const char *fip_filename) ...@@ -444,7 +444,7 @@ static int parse_fip(const char *fip_filename)
/* Get the new entry in the array and clear it */ /* Get the new entry in the array and clear it */
file_info_entry = &files[file_info_count++]; file_info_entry = &files[file_info_count++];
memset(file_info_entry, 0, sizeof(file_info)); memset(file_info_entry, 0, sizeof(file_info_t));
/* Copy the info from the ToC entry */ /* Copy the info from the ToC entry */
copy_uuid(&file_info_entry->name_uuid, &toc_entry->uuid); copy_uuid(&file_info_entry->name_uuid, &toc_entry->uuid);
...@@ -523,7 +523,7 @@ static int parse_cmdline(int argc, char **argv, struct option *options, ...@@ -523,7 +523,7 @@ static int parse_cmdline(int argc, char **argv, struct option *options,
int c; int c;
int status = 0; int status = 0;
int option_index = 0; int option_index = 0;
entry_lookup_list *lookup_entry; entry_lookup_list_t *lookup_entry;
int do_dump = 0; int do_dump = 0;
/* restart parse to process all options. starts at 1. */ /* restart parse to process all options. starts at 1. */
...@@ -591,11 +591,11 @@ int main(int argc, char **argv) ...@@ -591,11 +591,11 @@ int main(int argc, char **argv)
* Add 'dump' option, 'help' option and end marker. * Add 'dump' option, 'help' option and end marker.
*/ */
static struct option long_options[(sizeof(toc_entry_lookup_list)/ static struct option long_options[(sizeof(toc_entry_lookup_list)/
sizeof(entry_lookup_list)) + 2]; sizeof(entry_lookup_list_t)) + 2];
for (i = 0; for (i = 0;
/* -1 because we dont want to process end marker in toc table */ /* -1 because we dont want to process end marker in toc table */
i < sizeof(toc_entry_lookup_list)/sizeof(entry_lookup_list) - 1; i < sizeof(toc_entry_lookup_list)/sizeof(entry_lookup_list_t) - 1;
i++) { i++) {
long_options[i].name = toc_entry_lookup_list[i].command_line_name; long_options[i].name = toc_entry_lookup_list[i].command_line_name;
/* The only flag defined at the moment is for a FILENAME */ /* The only flag defined at the moment is for a FILENAME */
......
...@@ -41,20 +41,20 @@ ...@@ -41,20 +41,20 @@
#define FLAG_FILENAME (1 << 0) #define FLAG_FILENAME (1 << 0)
typedef struct { typedef struct entry_lookup_list {
const char *name; const char *name;
uuid_t name_uuid; uuid_t name_uuid;
const char *command_line_name; const char *command_line_name;
struct file_info *info; struct file_info *info;
unsigned int flags; unsigned int flags;
} entry_lookup_list; } entry_lookup_list_t;
typedef struct { typedef struct file_info {
uuid_t name_uuid; uuid_t name_uuid;
const char *filename; const char *filename;
unsigned int size; unsigned int size;
void *image_buffer; void *image_buffer;
entry_lookup_list *entry; entry_lookup_list_t *entry;
} file_info; } file_info_t;
#endif /* __FIP_CREATE_H__ */ #endif /* __FIP_CREATE_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment