#endif
unsigned long bl2_base;
unsigned int load_type = TOP_LOAD, spsr;
- meminfo *bl1_tzram_layout;
- meminfo *bl2_tzram_layout = 0x0;
+ meminfo_t *bl1_tzram_layout;
+ meminfo_t *bl2_tzram_layout = 0x0;
/*
* Ensure that MMU/Caches and coherency are turned on
* to BL2. BL2 will read the memory layout before using its
* memory for other purposes.
*/
- bl2_tzram_layout = (meminfo *) bl1_tzram_layout->free_base;
+ bl2_tzram_layout = (meminfo_t *) bl1_tzram_layout->free_base;
init_bl2_mem_layout(bl1_tzram_layout,
bl2_tzram_layout,
load_type,
******************************************************************************/
void bl2_main(void)
{
- meminfo *bl2_tzram_layout;
- bl31_args *bl2_to_bl31_args;
+ meminfo_t *bl2_tzram_layout;
+ bl31_args_t *bl2_to_bl31_args;
unsigned long bl31_base, bl32_base = 0, bl33_base, el_status;
unsigned int bl2_load, bl31_load, mode;
* for SP execution. In cases where both SPD and SP are absent, or when SPD
* finds it impossible to execute SP, this pointer is left as NULL
******************************************************************************/
-static int32_t (*bl32_init)(meminfo *);
+static int32_t (*bl32_init)(meminfo_t *);
/*******************************************************************************
* Variable to indicate whether next image to execute after BL31 is BL33
******************************************************************************/
void bl31_prepare_next_image_entry()
{
- el_change_info *next_image_info;
+ el_change_info_t *next_image_info;
uint32_t scr, image_type;
/* Determine which image to execute next */
* This function initializes the pointer to BL32 init function. This is expected
* to be called by the SPD after it finishes all its initialization
******************************************************************************/
-void bl31_register_bl32_init(int32_t (*func)(meminfo *))
+void bl31_register_bl32_init(int32_t (*func)(meminfo_t *))
{
bl32_init = func;
}
******************************************************************************/
typedef struct {
void *ptr[2];
-} __aligned (CACHE_WRITEBACK_GRANULE) context_info;
+} __aligned (CACHE_WRITEBACK_GRANULE) context_info_t;
-static context_info cm_context_info[PLATFORM_CORE_COUNT];
+static context_info_t cm_context_info[PLATFORM_CORE_COUNT];
/*******************************************************************************
* Context management library initialisation routine. This library is used by
******************************************************************************/
void cm_el3_sysregs_context_save(uint32_t security_state)
{
- cpu_context *ctx;
+ cpu_context_t *ctx;
ctx = cm_get_context(read_mpidr(), security_state);
assert(ctx);
void cm_el3_sysregs_context_restore(uint32_t security_state)
{
- cpu_context *ctx;
+ cpu_context_t *ctx;
ctx = cm_get_context(read_mpidr(), security_state);
assert(ctx);
void cm_el1_sysregs_context_save(uint32_t security_state)
{
- cpu_context *ctx;
+ cpu_context_t *ctx;
ctx = cm_get_context(read_mpidr(), security_state);
assert(ctx);
void cm_el1_sysregs_context_restore(uint32_t security_state)
{
- cpu_context *ctx;
+ cpu_context_t *ctx;
ctx = cm_get_context(read_mpidr(), security_state);
assert(ctx);
void cm_set_el3_eret_context(uint32_t security_state, uint64_t entrypoint,
uint32_t spsr, uint32_t scr)
{
- cpu_context *ctx;
- el3_state *state;
+ cpu_context_t *ctx;
+ el3_state_t *state;
ctx = cm_get_context(read_mpidr(), security_state);
assert(ctx);
******************************************************************************/
void cm_set_el3_elr(uint32_t security_state, uint64_t entrypoint)
{
- cpu_context *ctx;
- el3_state *state;
+ cpu_context_t *ctx;
+ el3_state_t *state;
ctx = cm_get_context(read_mpidr(), security_state);
assert(ctx);
******************************************************************************/
void cm_set_next_eret_context(uint32_t security_state)
{
- cpu_context *ctx;
+ cpu_context_t *ctx;
#if DEBUG
uint64_t sp_mode;
#endif
******************************************************************************/
void cm_init_exception_stack(uint64_t mpidr, uint32_t security_state)
{
- cpu_context *ctx;
- el3_state *state;
+ cpu_context_t *ctx;
+ el3_state_t *state;
ctx = cm_get_context(mpidr, security_state);
assert(ctx);
#define RT_SVC_DESCS_START ((uint64_t) (&__RT_SVC_DESCS_START__))
#define RT_SVC_DESCS_END ((uint64_t) (&__RT_SVC_DESCS_END__))
uint8_t rt_svc_descs_indices[MAX_RT_SVCS];
-static rt_svc_desc *rt_svc_descs;
+static rt_svc_desc_t *rt_svc_descs;
/*******************************************************************************
* Simple routine to sanity check a runtime service descriptor before using it
******************************************************************************/
-static int32_t validate_rt_svc_desc(rt_svc_desc *desc)
+static int32_t validate_rt_svc_desc(rt_svc_desc_t *desc)
{
if (desc == NULL)
return -EINVAL;
/* If no runtime services are implemented then simply bail out */
rt_svc_descs_num = RT_SVC_DESCS_END - RT_SVC_DESCS_START;
- rt_svc_descs_num /= sizeof(rt_svc_desc);
+ rt_svc_descs_num /= sizeof(rt_svc_desc_t);
if (rt_svc_descs_num == 0)
return;
/* Initialise internal variables to invalid state */
memset(rt_svc_descs_indices, -1, sizeof(rt_svc_descs_indices));
- rt_svc_descs = (rt_svc_desc *) RT_SVC_DESCS_START;
+ rt_svc_descs = (rt_svc_desc_t *) RT_SVC_DESCS_START;
for (index = 0; index < rt_svc_descs_num; index++) {
/*
void fault_handler(void *handle)
{
- gp_regs *gpregs_ctx = get_gpregs_ctx(handle);
+ gp_regs_t *gpregs_ctx = get_gpregs_ctx(handle);
ERROR("Unhandled synchronous fault. Register dump @ 0x%x \n",
gpregs_ctx);
panic();
* Per cpu data structure to populate parameters for an SMC in C code and use
* a pointer to this structure in assembler code to populate x0-x7
******************************************************************************/
-static tsp_args tsp_smc_args[PLATFORM_CORE_COUNT];
+static tsp_args_t tsp_smc_args[PLATFORM_CORE_COUNT];
/*******************************************************************************
* Per cpu data structure to keep track of TSP activity
******************************************************************************/
-static work_statistics tsp_stats[PLATFORM_CORE_COUNT];
+static work_statistics_t tsp_stats[PLATFORM_CORE_COUNT];
/*******************************************************************************
* Single reference to the various entry points exported by the test secure
* payload. A single copy should suffice for all cpus as they are not expected
* to change.
******************************************************************************/
-static const entry_info tsp_entry_info = {
+static const entry_info_t tsp_entry_info = {
tsp_fast_smc_entry,
tsp_cpu_on_entry,
tsp_cpu_off_entry,
tsp_cpu_suspend_entry,
};
-static tsp_args *set_smc_args(uint64_t arg0,
+static tsp_args_t *set_smc_args(uint64_t arg0,
uint64_t arg1,
uint64_t arg2,
uint64_t arg3,
{
uint64_t mpidr = read_mpidr();
uint32_t linear_id;
- tsp_args *pcpu_smc_args;
+ tsp_args_t *pcpu_smc_args;
/*
* Return to Secure Monitor by raising an SMC. The results of the
uint32_t linear_id = platform_get_core_pos(mpidr);
#if DEBUG
- meminfo *mem_layout = bl32_plat_sec_mem_layout();
+ meminfo_t *mem_layout = bl32_plat_sec_mem_layout();
#endif
/* Initialize the platform */
* after this cpu's architectural state has been setup in response to an earlier
* psci cpu_on request.
******************************************************************************/
-tsp_args *tsp_cpu_on_main(void)
+tsp_args_t *tsp_cpu_on_main(void)
{
uint64_t mpidr = read_mpidr();
uint32_t linear_id = platform_get_core_pos(mpidr);
* This function performs any remaining book keeping in the test secure payload
* before this cpu is turned off in response to a psci cpu_off request.
******************************************************************************/
-tsp_args *tsp_cpu_off_main(uint64_t arg0,
+tsp_args_t *tsp_cpu_off_main(uint64_t arg0,
uint64_t arg1,
uint64_t arg2,
uint64_t arg3,
* this cpu's architectural state is saved in response to an earlier psci
* cpu_suspend request.
******************************************************************************/
-tsp_args *tsp_cpu_suspend_main(uint64_t power_state,
+tsp_args_t *tsp_cpu_suspend_main(uint64_t power_state,
uint64_t arg1,
uint64_t arg2,
uint64_t arg3,
* cpu's architectural state has been restored after wakeup from an earlier psci
* cpu_suspend request.
******************************************************************************/
-tsp_args *tsp_cpu_resume_main(uint64_t suspend_level,
+tsp_args_t *tsp_cpu_resume_main(uint64_t suspend_level,
uint64_t arg1,
uint64_t arg2,
uint64_t arg3,
* in the function arguments in order. Once the service is rendered, this
* function returns to Secure Monitor by raising SMC
******************************************************************************/
-tsp_args *tsp_fast_smc_handler(uint64_t func,
+tsp_args_t *tsp_fast_smc_handler(uint64_t func,
uint64_t arg1,
uint64_t arg2,
uint64_t arg3,
write_scr(scr);
}
-void __dead2 drop_el(aapcs64_params *args,
+void __dead2 drop_el(aapcs64_params_t *args,
unsigned long spsr,
unsigned long entrypoint)
{
args->arg7);
}
-void __dead2 raise_el(aapcs64_params *args)
+void __dead2 raise_el(aapcs64_params_t *args)
{
smc(args->arg0,
args->arg1,
* Add support for dropping into EL0 etc. Consider adding support
* for switching from S-EL1 to S-EL0/1 etc.
*/
-void __dead2 change_el(el_change_info *info)
+void __dead2 change_el(el_change_info_t *info)
{
unsigned long current_el = read_current_el();
* TODO: Revisit if this and init_bl2_mem_layout can be replaced by a single
* routine.
******************************************************************************/
-void init_bl31_mem_layout(const meminfo *bl2_mem_layout,
- meminfo *bl31_mem_layout,
+void init_bl31_mem_layout(const meminfo_t *bl2_mem_layout,
+ meminfo_t *bl31_mem_layout,
unsigned int load_type)
{
if (load_type == BOT_LOAD) {
bl31_mem_layout->total_size = bl2_mem_layout->total_size;
bl31_mem_layout->attr = load_type;
- flush_dcache_range((unsigned long) bl31_mem_layout, sizeof(meminfo));
+ flush_dcache_range((unsigned long) bl31_mem_layout, sizeof(meminfo_t));
return;
}
* this information, it populates bl2_mem_layout to tell BL2 how much memory
* it has access to and how much is available for use.
******************************************************************************/
-void init_bl2_mem_layout(meminfo *bl1_mem_layout,
- meminfo *bl2_mem_layout,
+void init_bl2_mem_layout(meminfo_t *bl1_mem_layout,
+ meminfo_t *bl2_mem_layout,
unsigned int load_type,
unsigned long bl2_base)
{
bl2_mem_layout->free_size = bl1_mem_layout->free_size;
bl2_mem_layout->attr = load_type;
- flush_dcache_range((unsigned long) bl2_mem_layout, sizeof(meminfo));
+ flush_dcache_range((unsigned long) bl2_mem_layout, sizeof(meminfo_t));
return;
}
static void dump_load_info(unsigned long image_load_addr,
unsigned long image_size,
- const meminfo *mem_layout)
+ const meminfo_t *mem_layout)
{
#if DEBUG
printf("Trying to load image at address 0x%lx, size = 0x%lx\r\n",
* the bottom or top of the free memory. It updates the memory layout if the
* load is successful.
******************************************************************************/
-unsigned long load_image(meminfo *mem_layout,
+unsigned long load_image(meminfo_t *mem_layout,
const char *image_name,
unsigned int load_type,
unsigned long fixed_addr)
void *first_arg,
void *second_arg)
{
- el_change_info run_image_info;
+ el_change_info_t run_image_info;
unsigned long current_el = read_current_el();
/* Tell next EL what we want done */
mmio_write_32(base + GATE_KEEPER_OFF, val);
}
-static void tzc_write_action(uint64_t base, enum tzc_action action)
+static void tzc_write_action(uint64_t base, tzc_action_t action)
{
mmio_write_32(base + ACTION_OFF, action);
}
}
-void tzc_init(struct tzc_instance *controller)
+void tzc_init(tzc_instance_t *controller)
{
uint32_t tzc_id, tzc_build;
* this cannot be changed. It is, however, possible to change some region 0
* permissions.
*/
-void tzc_configure_region(const struct tzc_instance *controller,
+void tzc_configure_region(const tzc_instance_t *controller,
uint32_t filters,
uint8_t region,
uint64_t region_base,
uint64_t region_top,
- enum tzc_region_attributes sec_attr,
+ tzc_region_attributes_t sec_attr,
uint32_t ns_device_access)
{
uint64_t max_addr;
}
-void tzc_set_action(const struct tzc_instance *controller, enum tzc_action action)
+void tzc_set_action(const tzc_instance_t *controller, tzc_action_t action)
{
assert(controller != NULL);
}
-void tzc_enable_filters(const struct tzc_instance *controller)
+void tzc_enable_filters(const tzc_instance_t *controller)
{
uint32_t state;
uint32_t filter;
}
-void tzc_disable_filters(const struct tzc_instance *controller)
+void tzc_disable_filters(const tzc_instance_t *controller)
{
uint32_t filter;
typedef struct {
const char *name;
const uuid_t uuid;
-} plat_fip_name_uuid;
+} plat_fip_name_uuid_t;
typedef struct {
/* Put file_pos above the struct to allow {0} on static init.
* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
*/
unsigned int file_pos;
- fip_toc_entry entry;
-} file_state;
+ fip_toc_entry_t entry;
+} file_state_t;
-static plat_fip_name_uuid name_uuid[] = {
+static plat_fip_name_uuid_t name_uuid[] = {
{BL2_IMAGE_NAME, UUID_TRUSTED_BOOT_FIRMWARE_BL2},
{BL31_IMAGE_NAME, UUID_EL3_RUNTIME_FIRMWARE_BL31},
{BL32_IMAGE_NAME, UUID_SECURE_PAYLOAD_BL32},
};
static const uuid_t uuid_null = {0};
-static file_state current_file = {0};
+static file_state_t current_file = {0};
static io_dev_handle backend_dev_handle;
static void *backend_image_spec;
/* Firmware Image Package driver functions */
-static int fip_dev_open(void *spec, struct io_dev_info **dev_info);
-static int fip_file_open(struct io_dev_info *dev_info, const void *spec,
- struct io_entity *entity);
-static int fip_file_len(struct io_entity *entity, size_t *length);
-static int fip_file_read(struct io_entity *entity, void *buffer, size_t length,
+static int fip_dev_open(void *spec, io_dev_info_t **dev_info);
+static int fip_file_open(io_dev_info_t *dev_info, const void *spec,
+ io_entity_t *entity);
+static int fip_file_len(io_entity_t *entity, size_t *length);
+static int fip_file_read(io_entity_t *entity, void *buffer, size_t length,
size_t *length_read);
-static int fip_file_close(struct io_entity *entity);
-static int fip_dev_init(struct io_dev_info *dev_info, const void *init_params);
-static int fip_dev_close(struct io_dev_info *dev_info);
+static int fip_file_close(io_entity_t *entity);
+static int fip_dev_init(io_dev_info_t *dev_info, const void *init_params);
+static int fip_dev_close(io_dev_info_t *dev_info);
static inline int copy_uuid(uuid_t *dst, const uuid_t *src)
/* TODO: We could check version numbers or do a package checksum? */
-static inline int is_valid_header(fip_toc_header *header)
+static inline int is_valid_header(fip_toc_header_t *header)
{
if ((header->name == TOC_HEADER_NAME) && (header->serial_number != 0)) {
return 1;
/* Identify the device type as a virtual driver */
-io_type device_type_fip(void)
+io_type_t device_type_fip(void)
{
return IO_TYPE_FIRMWARE_IMAGE_PACKAGE;
}
/* Open a connection to the FIP device */
static int fip_dev_open(void *spec __attribute__((unused)),
- struct io_dev_info **dev_info)
+ io_dev_info_t **dev_info)
{
assert(dev_info != NULL);
*dev_info = &fip_dev_info;
/* Do some basic package checks. */
-static int fip_dev_init(struct io_dev_info *dev_info, const void *init_params)
+static int fip_dev_init(io_dev_info_t *dev_info, const void *init_params)
{
int result = IO_FAIL;
char *image_name = (char *)init_params;
io_handle backend_handle;
- fip_toc_header header;
+ fip_toc_header_t header;
size_t bytes_read;
/* Obtain a reference to the image by querying the platform layer */
}
/* Close a connection to the FIP device */
-static int fip_dev_close(struct io_dev_info *dev_info)
+static int fip_dev_close(io_dev_info_t *dev_info)
{
/* TODO: Consider tracking open files and cleaning them up here */
/* Open a file for access from package. */
-static int fip_file_open(struct io_dev_info *dev_info, const void *spec,
- struct io_entity *entity)
+static int fip_file_open(io_dev_info_t *dev_info, const void *spec,
+ io_entity_t *entity)
{
int result = IO_FAIL;
io_handle backend_handle;
uuid_t file_uuid;
- const io_file_spec *file_spec = (io_file_spec *)spec;
+ const io_file_spec_t *file_spec = (io_file_spec_t *)spec;
size_t bytes_read;
int found_file = 0;
}
/* Seek past the FIP header into the Table of Contents */
- result = io_seek(backend_handle, IO_SEEK_SET, sizeof(fip_toc_header));
+ result = io_seek(backend_handle, IO_SEEK_SET, sizeof(fip_toc_header_t));
if (result != IO_SUCCESS) {
WARN("fip_file_open: failed to seek\n");
result = IO_FAIL;
/* Return the size of a file in package */
-static int fip_file_len(struct io_entity *entity, size_t *length)
+static int fip_file_len(io_entity_t *entity, size_t *length)
{
assert(entity != NULL);
assert(length != NULL);
- *length = ((file_state *)entity->info)->entry.size;
+ *length = ((file_state_t *)entity->info)->entry.size;
return IO_SUCCESS;
}
/* Read data from a file in package */
-static int fip_file_read(struct io_entity *entity, void *buffer, size_t length,
+static int fip_file_read(io_entity_t *entity, void *buffer, size_t length,
size_t *length_read)
{
int result = IO_FAIL;
- file_state *fp;
+ file_state_t *fp;
size_t file_offset;
size_t bytes_read;
io_handle backend_handle;
goto fip_file_read_exit;
}
- fp = (file_state *)entity->info;
+ fp = (file_state_t *)entity->info;
/* Seek to the position in the FIP where the payload lives */
file_offset = fp->entry.offset_address + fp->file_pos;
/* Close a file in package */
-static int fip_file_close(struct io_entity *entity)
+static int fip_file_close(io_entity_t *entity)
{
/* Clear our current file pointer.
* If we had malloc() we would free() here.
/* Exported functions */
/* Register the Firmware Image Package driver with the IO abstraction */
-int register_io_dev_fip(struct io_dev_connector **dev_con)
+int register_io_dev_fip(io_dev_connector_t **dev_con)
{
int result = IO_FAIL;
assert(dev_con != NULL);
int in_use;
size_t base;
size_t file_pos;
-} file_state;
+} file_state_t;
-static file_state current_file = {0};
+static file_state_t current_file = {0};
/* Identify the device type as memmap */
-io_type device_type_memmap(void)
+io_type_t device_type_memmap(void)
{
return IO_TYPE_MEMMAP;
}
/* Memmap device functions */
-static int memmap_dev_open(void *spec, struct io_dev_info **dev_info);
-static int memmap_block_open(struct io_dev_info *dev_info, const void *spec,
- struct io_entity *entity);
-static int memmap_block_seek(struct io_entity *entity, int mode,
+static int memmap_dev_open(void *spec, io_dev_info_t **dev_info);
+static int memmap_block_open(io_dev_info_t *dev_info, const void *spec,
+ io_entity_t *entity);
+static int memmap_block_seek(io_entity_t *entity, int mode,
ssize_t offset);
-static int memmap_block_read(struct io_entity *entity, void *buffer,
+static int memmap_block_read(io_entity_t *entity, void *buffer,
size_t length, size_t *length_read);
-static int memmap_block_write(struct io_entity *entity, const void *buffer,
+static int memmap_block_write(io_entity_t *entity, const void *buffer,
size_t length, size_t *length_written);
-static int memmap_block_close(struct io_entity *entity);
-static int memmap_dev_close(struct io_dev_info *dev_info);
+static int memmap_block_close(io_entity_t *entity);
+static int memmap_dev_close(io_dev_info_t *dev_info);
static struct io_dev_connector memmap_dev_connector = {
/* Open a connection to the memmap device */
static int memmap_dev_open(void *spec __attribute__((unused)),
- struct io_dev_info **dev_info)
+ io_dev_info_t **dev_info)
{
assert(dev_info != NULL);
*dev_info = &memmap_dev_info;
/* Close a connection to the memmap device */
-static int memmap_dev_close(struct io_dev_info *dev_info)
+static int memmap_dev_close(io_dev_info_t *dev_info)
{
/* NOP */
/* TODO: Consider tracking open files and cleaning them up here */
/* Open a file on the memmap device */
/* TODO: Can we do any sensible limit checks on requested memory */
-static int memmap_block_open(struct io_dev_info *dev_info, const void *spec,
- struct io_entity *entity)
+static int memmap_block_open(io_dev_info_t *dev_info, const void *spec,
+ io_entity_t *entity)
{
int result = IO_FAIL;
- const io_block_spec *block_spec = (io_block_spec *)spec;
+ const io_block_spec_t *block_spec = (io_block_spec_t *)spec;
/* Since we need to track open state for seek() we only allow one open
* spec at a time. When we have dynamic memory we can malloc and set
/* Seek to a particular file offset on the memmap device */
-static int memmap_block_seek(struct io_entity *entity, int mode, ssize_t offset)
+static int memmap_block_seek(io_entity_t *entity, int mode, ssize_t offset)
{
int result = IO_FAIL;
assert(entity != NULL);
/* TODO: can we do some basic limit checks on seek? */
- ((file_state *)entity->info)->file_pos = offset;
+ ((file_state_t *)entity->info)->file_pos = offset;
result = IO_SUCCESS;
} else {
result = IO_FAIL;
/* Read data from a file on the memmap device */
-static int memmap_block_read(struct io_entity *entity, void *buffer,
+static int memmap_block_read(io_entity_t *entity, void *buffer,
size_t length, size_t *length_read)
{
- file_state *fp;
+ file_state_t *fp;
assert(entity != NULL);
assert(buffer != NULL);
assert(length_read != NULL);
- fp = (file_state *)entity->info;
+ fp = (file_state_t *)entity->info;
memcpy(buffer, (void *)(fp->base + fp->file_pos), length);
/* Write data to a file on the memmap device */
-static int memmap_block_write(struct io_entity *entity, const void *buffer,
+static int memmap_block_write(io_entity_t *entity, const void *buffer,
size_t length, size_t *length_written)
{
- file_state *fp;
+ file_state_t *fp;
assert(entity != NULL);
assert(buffer != NULL);
assert(length_written != NULL);
- fp = (file_state *)entity->info;
+ fp = (file_state_t *)entity->info;
memcpy((void *)(fp->base + fp->file_pos), buffer, length);
/* Close a file on the memmap device */
-static int memmap_block_close(struct io_entity *entity)
+static int memmap_block_close(io_entity_t *entity)
{
assert(entity != NULL);
/* Exported functions */
/* Register the memmap driver with the IO abstraction */
-int register_io_dev_memmap(struct io_dev_connector **dev_con)
+int register_io_dev_memmap(io_dev_connector_t **dev_con)
{
int result = IO_FAIL;
assert(dev_con != NULL);
/* Identify the device type as semihosting */
-static io_type device_type_sh(void)
+static io_type_t device_type_sh(void)
{
return IO_TYPE_SEMIHOSTING;
}
/* Semi-hosting functions, device info and handle */
-static int sh_dev_open(void *spec, struct io_dev_info **dev_info);
-static int sh_file_open(struct io_dev_info *dev_info, const void *spec,
- struct io_entity *entity);
-static int sh_file_seek(struct io_entity *entity, int mode, ssize_t offset);
-static int sh_file_len(struct io_entity *entity, size_t *length);
-static int sh_file_read(struct io_entity *entity, void *buffer, size_t length,
+static int sh_dev_open(void *spec, io_dev_info_t **dev_info);
+static int sh_file_open(io_dev_info_t *dev_info, const void *spec,
+ io_entity_t *entity);
+static int sh_file_seek(io_entity_t *entity, int mode, ssize_t offset);
+static int sh_file_len(io_entity_t *entity, size_t *length);
+static int sh_file_read(io_entity_t *entity, void *buffer, size_t length,
size_t *length_read);
-static int sh_file_write(struct io_entity *entity, const void *buffer,
+static int sh_file_write(io_entity_t *entity, const void *buffer,
size_t length, size_t *length_written);
-static int sh_file_close(struct io_entity *entity);
+static int sh_file_close(io_entity_t *entity);
static struct io_dev_connector sh_dev_connector = {
.dev_open = sh_dev_open
/* Open a connection to the semi-hosting device */
-static int sh_dev_open(void *spec __unused, struct io_dev_info **dev_info)
+static int sh_dev_open(void *spec __unused, io_dev_info_t **dev_info)
{
int result = IO_SUCCESS;
assert(dev_info != NULL);
/* Open a file on the semi-hosting device */
-static int sh_file_open(struct io_dev_info *dev_info __attribute__((unused)),
- const void *spec, struct io_entity *entity)
+static int sh_file_open(io_dev_info_t *dev_info __attribute__((unused)),
+ const void *spec, io_entity_t *entity)
{
int result = IO_FAIL;
long sh_result = -1;
- const io_file_spec *file_spec = (io_file_spec *)spec;
+ const io_file_spec_t *file_spec = (io_file_spec_t *)spec;
assert(file_spec != NULL);
assert(entity != NULL);
/* Seek to a particular file offset on the semi-hosting device */
-static int sh_file_seek(struct io_entity *entity, int mode, ssize_t offset)
+static int sh_file_seek(io_entity_t *entity, int mode, ssize_t offset)
{
int result = IO_FAIL;
long file_handle, sh_result;
/* Return the size of a file on the semi-hosting device */
-static int sh_file_len(struct io_entity *entity, size_t *length)
+static int sh_file_len(io_entity_t *entity, size_t *length)
{
int result = IO_FAIL;
/* Read data from a file on the semi-hosting device */
-static int sh_file_read(struct io_entity *entity, void *buffer, size_t length,
+static int sh_file_read(io_entity_t *entity, void *buffer, size_t length,
size_t *length_read)
{
int result = IO_FAIL;
/* Write data to a file on the semi-hosting device */
-static int sh_file_write(struct io_entity *entity, const void *buffer,
+static int sh_file_write(io_entity_t *entity, const void *buffer,
size_t length, size_t *length_written)
{
int result = IO_FAIL;
/* Close a file on the semi-hosting device */
-static int sh_file_close(struct io_entity *entity)
+static int sh_file_close(io_entity_t *entity)
{
int result = IO_FAIL;
long sh_result = -1;
/* Exported functions */
/* Register the semi-hosting driver with the IO abstraction */
-int register_io_dev_sh(struct io_dev_connector **dev_con)
+int register_io_dev_sh(io_dev_connector_t **dev_con)
{
int result = IO_FAIL;
assert(dev_con != NULL);
* Function prototypes
*****************************************/
extern void bl1_platform_setup(void);
-extern meminfo *bl1_plat_sec_mem_layout(void);
+extern meminfo_t *bl1_plat_sec_mem_layout(void);
#endif /*__ASSEMBLY__*/
* Function prototypes
*****************************************/
extern void bl2_platform_setup(void);
-extern meminfo *bl2_plat_sec_mem_layout(void);
-extern bl31_args *bl2_get_bl31_args_ptr(void);
+extern meminfo_t *bl2_plat_sec_mem_layout(void);
+extern bl31_args_t *bl2_get_bl31_args_ptr(void);
#endif /* __BL2_H__ */
extern void bl31_set_next_image_type(uint32_t type);
extern uint32_t bl31_get_next_image_type(void);
extern void bl31_prepare_next_image_entry();
-extern el_change_info *bl31_get_next_image_info(uint32_t type);
+extern el_change_info_t *bl31_get_next_image_info(uint32_t type);
extern void bl31_platform_setup(void);
-extern meminfo *bl31_plat_get_bl32_mem_layout(void);
-extern meminfo *bl31_plat_sec_mem_layout(void);
-extern void bl31_register_bl32_init(int32_t (*)(meminfo *));
+extern meminfo_t *bl31_plat_get_bl32_mem_layout(void);
+extern meminfo_t *bl31_plat_sec_mem_layout(void);
+extern void bl31_register_bl32_init(int32_t (*)(meminfo_t *));
#endif /* __BL31_H__ */
*/
#define DWORD_SHIFT 3
#define DEFINE_REG_STRUCT(name, num_regs) \
- typedef struct { \
+ typedef struct name { \
uint64_t _regs[num_regs]; \
- } __aligned(16) name
+ } __aligned(16) name##_t
/* Constants to determine the size of individual context structures */
#define CTX_GPREG_ALL (CTX_GPREGS_END >> DWORD_SHIFT)
* structure at exception entry and exit. Each instance will
* correspond to either the secure or the non-secure state.
*/
-typedef struct {
- gp_regs gpregs_ctx;
- el3_state el3state_ctx;
- el1_sys_regs sysregs_ctx;
- fp_regs fpregs_ctx;
-} cpu_context;
+typedef struct cpu_context {
+ gp_regs_t gpregs_ctx;
+ el3_state_t el3state_ctx;
+ el1_sys_regs_t sysregs_ctx;
+ fp_regs_t fpregs_ctx;
+} cpu_context_t;
-/* Macros to access members of the 'cpu_context' structure */
-#define get_el3state_ctx(h) (&((cpu_context *) h)->el3state_ctx)
-#define get_fpregs_ctx(h) (&((cpu_context *) h)->fpregs_ctx)
-#define get_sysregs_ctx(h) (&((cpu_context *) h)->sysregs_ctx)
-#define get_gpregs_ctx(h) (&((cpu_context *) h)->gpregs_ctx)
+/* Macros to access members of the 'cpu_context_t' structure */
+#define get_el3state_ctx(h) (&((cpu_context_t *) h)->el3state_ctx)
+#define get_fpregs_ctx(h) (&((cpu_context_t *) h)->fpregs_ctx)
+#define get_sysregs_ctx(h) (&((cpu_context_t *) h)->sysregs_ctx)
+#define get_gpregs_ctx(h) (&((cpu_context_t *) h)->gpregs_ctx)
/*
* Compile time assertions related to the 'cpu_context' structure to
* ensure that the assembler and the compiler view of the offsets of
* the structure members is the same.
*/
-CASSERT(CTX_GPREGS_OFFSET == __builtin_offsetof(cpu_context, gpregs_ctx), \
+CASSERT(CTX_GPREGS_OFFSET == __builtin_offsetof(cpu_context_t, gpregs_ctx), \
assert_core_context_gp_offset_mismatch);
-CASSERT(CTX_SYSREGS_OFFSET == __builtin_offsetof(cpu_context, sysregs_ctx), \
+CASSERT(CTX_SYSREGS_OFFSET == __builtin_offsetof(cpu_context_t, sysregs_ctx), \
assert_core_context_sys_offset_mismatch);
-CASSERT(CTX_FPREGS_OFFSET == __builtin_offsetof(cpu_context, fpregs_ctx), \
+CASSERT(CTX_FPREGS_OFFSET == __builtin_offsetof(cpu_context_t, fpregs_ctx), \
assert_core_context_fp_offset_mismatch);
-CASSERT(CTX_EL3STATE_OFFSET == __builtin_offsetof(cpu_context, el3state_ctx), \
+CASSERT(CTX_EL3STATE_OFFSET == __builtin_offsetof(cpu_context_t, el3state_ctx), \
assert_core_context_el3state_offset_mismatch);
/*
/*******************************************************************************
* Function prototypes
******************************************************************************/
-void el3_sysregs_context_save(el3_state *regs);
-void el3_sysregs_context_restore(el3_state *regs);
-void el1_sysregs_context_save(el1_sys_regs *regs);
-void el1_sysregs_context_restore(el1_sys_regs *regs);
-void fpregs_context_save(fp_regs *regs);
-void fpregs_context_restore(fp_regs *regs);
+void el3_sysregs_context_save(el3_state_t *regs);
+void el3_sysregs_context_restore(el3_state_t *regs);
+void el1_sysregs_context_save(el1_sys_regs_t *regs);
+void el1_sysregs_context_restore(el1_sys_regs_t *regs);
+void fpregs_context_save(fp_regs_t *regs);
+void fpregs_context_restore(fp_regs_t *regs);
#undef CTX_SYSREG_ALL
#undef CTX_FP_ALL
#define is_caller_secure(_f) (!(is_caller_non_secure(_f)))
/* Prototype for runtime service initializing function */
-typedef int32_t (*rt_svc_init)(void);
+typedef int32_t (*rt_svc_init_t)(void);
/* Convenience macros to return from SMC handler */
#define SMC_RET1(_h, _x0) { \
* can be accessed using the handle pointer. The cookie parameter is reserved
* for future use
*/
-typedef uint64_t (*rt_svc_handle)(uint32_t smc_fid,
+typedef uint64_t (*rt_svc_handle_t)(uint32_t smc_fid,
uint64_t x1,
uint64_t x2,
uint64_t x3,
void *cookie,
void *handle,
uint64_t flags);
-typedef struct {
+typedef struct rt_svc_desc {
uint8_t start_oen;
uint8_t end_oen;
uint8_t call_type;
const char *name;
- rt_svc_init init;
- rt_svc_handle handle;
-} rt_svc_desc;
+ rt_svc_init_t init;
+ rt_svc_handle_t handle;
+} rt_svc_desc_t;
/*
* Convenience macro to declare a service descriptor
*/
#define DECLARE_RT_SVC(_name, _start, _end, _type, _setup, _smch) \
- static const rt_svc_desc __svc_desc_ ## _name \
+ static const rt_svc_desc_t __svc_desc_ ## _name \
__attribute__ ((section("rt_svc_descs"), used)) = { \
_start, \
_end, \
* 3. ensure that the assembler and the compiler see the handler
* routine at the same offset.
*/
-CASSERT((sizeof(rt_svc_desc) == SIZEOF_RT_SVC_DESC), \
+CASSERT((sizeof(rt_svc_desc_t) == SIZEOF_RT_SVC_DESC), \
assert_sizeof_rt_svc_desc_mismatch);
-CASSERT(RT_SVC_DESC_INIT == __builtin_offsetof(rt_svc_desc, init), \
+CASSERT(RT_SVC_DESC_INIT == __builtin_offsetof(rt_svc_desc_t, init), \
assert_rt_svc_desc_init_offset_mismatch);
-CASSERT(RT_SVC_DESC_HANDLE == __builtin_offsetof(rt_svc_desc, handle), \
+CASSERT(RT_SVC_DESC_HANDLE == __builtin_offsetof(rt_svc_desc_t, handle), \
assert_rt_svc_desc_handle_offset_mismatch);
* Structure populated by platform specific code to export routines which
* perform common low level pm functions
******************************************************************************/
-typedef struct {
+typedef struct plat_pm_ops {
int (*affinst_standby)(unsigned int);
int (*affinst_on)(unsigned long,
unsigned long,
int (*affinst_suspend_finish)(unsigned long,
unsigned int,
unsigned int);
-} plat_pm_ops;
+} plat_pm_ops_t;
/*******************************************************************************
* Optional structure populated by the Secure Payload Dispatcher to be given a
* operation. It also allows PSCI to determine certain properties of the SP e.g.
* migrate capability etc.
******************************************************************************/
-typedef struct {
+typedef struct spd_pm_ops {
void (*svc_on)(uint64_t target_cpu);
int32_t (*svc_off)(uint64_t __unused);
void (*svc_suspend)(uint64_t power_state);
void (*svc_suspend_finish)(uint64_t suspend_level);
void (*svc_migrate)(uint64_t __unused1, uint64_t __unused2);
int32_t (*svc_migrate_info)(uint64_t *__unused);
-} spd_pm_ops;
+} spd_pm_ops_t;
/*******************************************************************************
* Function & Data prototypes
unsigned long);
extern void psci_aff_on_finish_entry(void);
extern void psci_aff_suspend_finish_entry(void);
-extern void psci_register_spd_pm_hook(const spd_pm_ops *);
+extern void psci_register_spd_pm_hook(const spd_pm_ops_t *);
extern int psci_get_suspend_stateid(unsigned long mpidr);
extern int psci_get_suspend_afflvl(unsigned long mpidr);
#include <bl_common.h>
extern void bl32_platform_setup(void);
-extern meminfo *bl32_plat_sec_mem_layout(void);
+extern meminfo_t *bl32_plat_sec_mem_layout(void);
extern uint64_t bl32_main(void);
#endif /* __ASSEMBLY__ */
#ifndef __ASSEMBLY__
#include <stdint.h>
-typedef void (*tsp_generic_fptr)(uint64_t arg0,
+typedef void (*tsp_generic_fptr_t)(uint64_t arg0,
uint64_t arg1,
uint64_t arg2,
uint64_t arg3,
uint64_t arg6,
uint64_t arg7);
-typedef struct {
- tsp_generic_fptr fast_smc_entry;
- tsp_generic_fptr cpu_on_entry;
- tsp_generic_fptr cpu_off_entry;
- tsp_generic_fptr cpu_resume_entry;
- tsp_generic_fptr cpu_suspend_entry;
-} entry_info;
+typedef struct entry_info {
+ tsp_generic_fptr_t fast_smc_entry;
+ tsp_generic_fptr_t cpu_on_entry;
+ tsp_generic_fptr_t cpu_off_entry;
+ tsp_generic_fptr_t cpu_resume_entry;
+ tsp_generic_fptr_t cpu_suspend_entry;
+} entry_info_t;
-typedef struct {
+typedef struct work_statistics {
uint32_t smc_count; /* Number of returns on this cpu */
uint32_t eret_count; /* Number of entries on this cpu */
uint32_t cpu_on_count; /* Number of cpu on requests */
uint32_t cpu_off_count; /* Number of cpu off requests */
uint32_t cpu_suspend_count; /* Number of cpu suspend requests */
uint32_t cpu_resume_count; /* Number of cpu resume requests */
-} __aligned(CACHE_WRITEBACK_GRANULE) work_statistics;
+} __aligned(CACHE_WRITEBACK_GRANULE) work_statistics_t;
-typedef struct {
+typedef struct tsp_args {
uint64_t _regs[TSP_ARGS_END >> 3];
-} __aligned(CACHE_WRITEBACK_GRANULE) tsp_args;
+} __aligned(CACHE_WRITEBACK_GRANULE) tsp_args_t;
/* Macros to access members of the above structure using their offsets */
#define read_sp_arg(args, offset) ((args)->_regs[offset >> 3])
* Ensure that the assembler's view of the size of the tsp_args is the
* same as the compilers
*/
-CASSERT(TSP_ARGS_SIZE == sizeof(tsp_args), assert_sp_args_size_mismatch);
+CASSERT(TSP_ARGS_SIZE == sizeof(tsp_args_t), assert_sp_args_size_mismatch);
extern void tsp_get_magic(uint64_t args[4]);
uint64_t arg5,
uint64_t arg6,
uint64_t arg7);
-extern tsp_args *tsp_cpu_resume_main(uint64_t arg0,
+extern tsp_args_t *tsp_cpu_resume_main(uint64_t arg0,
uint64_t arg1,
uint64_t arg2,
uint64_t arg3,
uint64_t arg5,
uint64_t arg6,
uint64_t arg7);
-extern tsp_args *tsp_cpu_suspend_main(uint64_t arg0,
+extern tsp_args_t *tsp_cpu_suspend_main(uint64_t arg0,
uint64_t arg1,
uint64_t arg2,
uint64_t arg3,
uint64_t arg5,
uint64_t arg6,
uint64_t arg7);
-extern tsp_args *tsp_cpu_on_main(void);
+extern tsp_args_t *tsp_cpu_on_main(void);
extern void tsp_cpu_off_entry(uint64_t arg0,
uint64_t arg1,
uint64_t arg2,
uint64_t arg5,
uint64_t arg6,
uint64_t arg7);
-extern tsp_args *tsp_cpu_off_main(uint64_t arg0,
+extern tsp_args_t *tsp_cpu_off_main(uint64_t arg0,
uint64_t arg1,
uint64_t arg2,
uint64_t arg3,
* Structure used for telling the next BL how much of a particular type of
* memory is available for its use and how much is already used.
******************************************************************************/
-typedef struct {
+typedef struct meminfo {
unsigned long total_base;
long total_size;
unsigned long free_base;
long free_size;
unsigned long attr;
unsigned long next;
-} meminfo;
+} meminfo_t;
-typedef struct {
+typedef struct aapcs64_params {
unsigned long arg0;
unsigned long arg1;
unsigned long arg2;
unsigned long arg5;
unsigned long arg6;
unsigned long arg7;
-} aapcs64_params;
+} aapcs64_params_t;
/*******************************************************************************
* This structure represents the superset of information needed while switching
* exception levels. The only two mechanisms to do so are ERET & SMC. In case of
* SMC all members apart from 'aapcs64_params' will be ignored.
******************************************************************************/
-typedef struct {
+typedef struct el_change_info {
unsigned long entrypoint;
unsigned long spsr;
unsigned long security_state;
- aapcs64_params args;
-} el_change_info;
+ aapcs64_params_t args;
+} el_change_info_t;
/*******************************************************************************
* This structure represents the superset of information that can be passed to
* BL31 e.g. while passing control to it from BL2. The BL32 parameters will be
* populated only if BL2 detects its presence.
******************************************************************************/
-typedef struct {
- meminfo bl31_meminfo;
- el_change_info bl32_image_info;
- meminfo bl32_meminfo;
- el_change_info bl33_image_info;
- meminfo bl33_meminfo;
-} bl31_args;
+typedef struct bl31_args {
+ meminfo_t bl31_meminfo;
+ el_change_info_t bl32_image_info;
+ meminfo_t bl32_meminfo;
+ el_change_info_t bl33_image_info;
+ meminfo_t bl33_meminfo;
+} bl31_args_t;
/*******************************************************************************
* Function & variable prototypes
******************************************************************************/
extern unsigned long page_align(unsigned long, unsigned);
extern void change_security_state(unsigned int);
-extern void __dead2 drop_el(aapcs64_params *, unsigned long, unsigned long);
-extern void __dead2 raise_el(aapcs64_params *);
-extern void __dead2 change_el(el_change_info *);
+extern void __dead2 drop_el(aapcs64_params_t *, unsigned long, unsigned long);
+extern void __dead2 raise_el(aapcs64_params_t *);
+extern void __dead2 change_el(el_change_info_t *);
extern unsigned long make_spsr(unsigned long, unsigned long, unsigned long);
-extern void init_bl2_mem_layout(meminfo *,
- meminfo *,
+extern void init_bl2_mem_layout(meminfo_t *,
+ meminfo_t *,
unsigned int,
unsigned long) __attribute__((weak));
-extern void init_bl31_mem_layout(const meminfo *,
- meminfo *,
+extern void init_bl31_mem_layout(const meminfo_t *,
+ meminfo_t *,
unsigned int) __attribute__((weak));
extern unsigned long image_size(const char *);
-extern unsigned long load_image(meminfo *,
+extern unsigned long load_image(meminfo_t *,
const char *,
unsigned int,
unsigned long);
#define UUID_NON_TRUSTED_FIRMWARE_BL33 \
{0xa7eed0d6, 0xeafc, 0x4bd5, 0x97, 0x82, {0x99, 0x34, 0xf2, 0x34, 0xb6, 0xe4} }
-typedef struct {
+typedef struct fip_toc_header {
uint32_t name;
uint32_t serial_number;
uint64_t flags;
-} fip_toc_header;
+} fip_toc_header_t;
-typedef struct {
+typedef struct fip_toc_entry {
uuid_t uuid;
uint64_t offset_address;
uint64_t size;
uint64_t flags;
-} fip_toc_entry;
+} fip_toc_entry_t;
#endif /* __FIRMWARE_IMAGE_PACKAGE_H__ */
* TZC_ACTION_ERR_INT - Raise interrupt, raise exception -> sync
* external data abort
*/
-enum tzc_action {
+typedef enum {
TZC_ACTION_NONE = 0,
TZC_ACTION_ERR = 1,
TZC_ACTION_INT = 2,
TZC_ACTION_ERR_INT = (TZC_ACTION_ERR | TZC_ACTION_INT)
-};
+} tzc_action_t;
/*
* Controls secure access to a region. If not enabled secure access is not
* allowed to region.
*/
-enum tzc_region_attributes {
+typedef enum {
TZC_REGION_S_NONE = 0,
TZC_REGION_S_RD = 1,
TZC_REGION_S_WR = 2,
TZC_REGION_S_RDWR = (TZC_REGION_S_RD | TZC_REGION_S_WR)
-};
+} tzc_region_attributes_t;
/*
* Implementation defined values used to validate inputs later.
* Regions : max of 9 ; 0 to 8
* Address width : Values between 32 to 64
*/
-struct tzc_instance {
+typedef struct tzc_instance {
uint64_t base;
uint32_t aid_width;
uint8_t addr_width;
uint8_t num_filters;
uint8_t num_regions;
-};
+} tzc_instance_t ;
-void tzc_init(struct tzc_instance *controller);
-void tzc_configure_region(const struct tzc_instance *controller, uint32_t filters,
+void tzc_init(tzc_instance_t *controller);
+void tzc_configure_region(const tzc_instance_t *controller, uint32_t filters,
uint8_t region, uint64_t region_base, uint64_t region_top,
- enum tzc_region_attributes sec_attr, uint32_t ns_device_access);
-void tzc_enable_filters(const struct tzc_instance *controller);
-void tzc_disable_filters(const struct tzc_instance *controller);
-void tzc_set_action(const struct tzc_instance *controller,
- enum tzc_action action);
+ tzc_region_attributes_t sec_attr, uint32_t ns_device_access);
+void tzc_enable_filters(const tzc_instance_t *controller);
+void tzc_disable_filters(const tzc_instance_t *controller);
+void tzc_set_action(const tzc_instance_t *controller, tzc_action_t action);
#endif /*__ASSEMBLY__*/
/* Generic IO entity structure,representing an accessible IO construct on the
* device, such as a file */
-struct io_entity {
+typedef struct io_entity {
io_dev_handle dev_handle;
uintptr_t info;
-};
+} io_entity_t;
/* Device info structure, providing device-specific functions and a means of
* adding driver-specific state */
-struct io_dev_info {
+typedef struct io_dev_info {
struct io_dev_funcs *funcs;
uintptr_t info;
-};
+} io_dev_info_t;
/* Structure used to create a connection to a type of device */
-struct io_dev_connector {
+typedef struct io_dev_connector {
/* dev_open opens a connection to a particular device driver */
- int (*dev_open)(void *spec, struct io_dev_info **dev_info);
-};
+ int (*dev_open)(void *spec, io_dev_info_t **dev_info);
+} io_dev_connector_t;
/* Structure to hold device driver function pointers */
-struct io_dev_funcs {
- io_type (*type)(void);
- int (*open)(struct io_dev_info *dev_info, const void *spec,
- struct io_entity *entity);
- int (*seek)(struct io_entity *entity, int mode, ssize_t offset);
- int (*size)(struct io_entity *entity, size_t *length);
- int (*read)(struct io_entity *entity, void *buffer, size_t length,
+typedef struct io_dev_funcs {
+ io_type_t (*type)(void);
+ int (*open)(io_dev_info_t *dev_info, const void *spec,
+ io_entity_t *entity);
+ int (*seek)(io_entity_t *entity, int mode, ssize_t offset);
+ int (*size)(io_entity_t *entity, size_t *length);
+ int (*read)(io_entity_t *entity, void *buffer, size_t length,
size_t *length_read);
- int (*write)(struct io_entity *entity, const void *buffer,
+ int (*write)(io_entity_t *entity, const void *buffer,
size_t length, size_t *length_written);
- int (*close)(struct io_entity *entity);
- int (*dev_init)(struct io_dev_info *dev_info, const void *init_params);
- int (*dev_close)(struct io_dev_info *dev_info);
-};
+ int (*close)(io_entity_t *entity);
+ int (*dev_init)(io_dev_info_t *dev_info, const void *init_params);
+ int (*dev_close)(io_dev_info_t *dev_info);
+} io_dev_funcs_t;
/* IO platform data - used to track devices registered for a specific
* platform */
-struct io_plat_data {
- struct io_dev_info *devices[MAX_IO_DEVICES];
+typedef struct io_plat_data {
+ io_dev_info_t *devices[MAX_IO_DEVICES];
unsigned int dev_count;
-};
+} io_plat_data_t;
/* Operations intended to be performed during platform initialisation */
/* Initialise the IO layer */
-void io_init(struct io_plat_data *data);
+void io_init(io_plat_data_t *data);
/* Register a device driver */
-int io_register_device(struct io_dev_info *dev_info);
+int io_register_device(io_dev_info_t *dev_info);
#endif /* __IO_DRIVER_H__ */
MT_SECURE = 0 << 2,
MT_NS = 1 << 2
-} mmap_attr;
+} mmap_attr_t;
/*
* Structure for specifying a single region of memory.
*/
-typedef struct {
+typedef struct mmap_region {
unsigned long base;
unsigned long size;
- mmap_attr attr;
-} mmap_region;
+ mmap_attr_t attr;
+} mmap_region_t;
extern void mmap_add_region(unsigned long base, unsigned long size,
unsigned attr);
-extern void mmap_add(const mmap_region *mm);
+extern void mmap_add(const mmap_region_t *mm);
extern void init_xlat_tables(void);
#define BAKERY_LOCK_MAX_CPUS PLATFORM_CORE_COUNT
#ifndef __ASSEMBLY__
-typedef struct {
+typedef struct bakery_lock {
int owner;
volatile char entering[BAKERY_LOCK_MAX_CPUS];
volatile unsigned number[BAKERY_LOCK_MAX_CPUS];
-} bakery_lock;
+} bakery_lock_t;
#define NO_OWNER (-1)
-void bakery_lock_init(bakery_lock *bakery);
-void bakery_lock_get(unsigned long mpidr, bakery_lock *bakery);
-void bakery_lock_release(unsigned long mpidr, bakery_lock *bakery);
-int bakery_lock_try(unsigned long mpidr, bakery_lock *bakery);
+void bakery_lock_init(bakery_lock_t *bakery);
+void bakery_lock_get(unsigned long mpidr, bakery_lock_t *bakery);
+void bakery_lock_release(unsigned long mpidr, bakery_lock_t *bakery);
+int bakery_lock_try(unsigned long mpidr, bakery_lock_t *bakery);
#endif /*__ASSEMBLY__*/
#endif /* __BAKERY_LOCK_H__ */
IO_TYPE_MEMMAP,
IO_TYPE_FIRMWARE_IMAGE_PACKAGE,
IO_TYPE_MAX
-} io_type;
+} io_type_t;
/* Modes used when seeking data on a supported device */
IO_SEEK_END,
IO_SEEK_CUR,
IO_SEEK_MAX
-} io_seek_mode;
+} io_seek_mode_t;
/* Connector type, providing a means of identifying a device to open */
/* File specification - used to refer to data on a device supporting file-like
* entities */
-typedef struct {
+typedef struct io_file_spec {
const char *path;
unsigned int mode;
-} io_file_spec;
+} io_file_spec_t;
/* Block specification - used to refer to data on a device supporting
* block-like entities */
-typedef struct {
+typedef struct io_block_spec {
unsigned long offset;
size_t length;
-} io_block_spec;
+} io_block_spec_t;
/* Access modes used when accessing data on a device */
/* Synchronous operations */
int io_open(io_dev_handle dev_handle, const void *spec, io_handle *handle);
-int io_seek(io_handle handle, io_seek_mode mode, ssize_t offset);
+int io_seek(io_handle handle, io_seek_mode_t mode, ssize_t offset);
int io_size(io_handle handle, size_t *length);
#ifndef __SPINLOCK_H__
#define __SPINLOCK_H__
-typedef struct {
+typedef struct spinlock {
volatile unsigned int lock;
} spinlock_t;
* Array of all memory regions stored in order of ascending base address.
* The list is terminated by the first entry with size == 0.
*/
-static mmap_region mmap[MAX_MMAP_REGIONS + 1];
+static mmap_region_t mmap[MAX_MMAP_REGIONS + 1];
static void print_mmap(void)
{
#if DEBUG_XLAT_TABLE
debug_print("mmap:\n");
- mmap_region *mm = mmap;
+ mmap_region_t *mm = mmap;
while (mm->size) {
debug_print(" %010lx %10lx %x\n", mm->base, mm->size, mm->attr);
++mm;
void mmap_add_region(unsigned long base, unsigned long size, unsigned attr)
{
- mmap_region *mm = mmap;
- mmap_region *mm_last = mm + sizeof(mmap) / sizeof(mmap[0]) - 1;
+ mmap_region_t *mm = mmap;
+ mmap_region_t *mm_last = mm + sizeof(mmap) / sizeof(mmap[0]) - 1;
assert(IS_PAGE_ALIGNED(base));
assert(IS_PAGE_ALIGNED(size));
mm->attr = attr;
}
-void mmap_add(const mmap_region *mm)
+void mmap_add(const mmap_region_t *mm)
{
while (mm->size) {
mmap_add_region(mm->base, mm->size, mm->attr);
return desc;
}
-static int mmap_region_attr(mmap_region *mm, unsigned long base,
+static int mmap_region_attr(mmap_region_t *mm, unsigned long base,
unsigned long size)
{
int attr = mm->attr;
}
}
-static mmap_region *init_xlation_table(mmap_region *mm, unsigned long base,
+static mmap_region_t *init_xlation_table(mmap_region_t *mm, unsigned long base,
unsigned long *table, unsigned level)
{
unsigned level_size_shift = L1_XLAT_ADDRESS_SHIFT - (level - 1) *
/* Storage for a fixed maximum number of IO entities, definable by platform */
-static struct io_entity entity_pool[MAX_IO_HANDLES];
+static io_entity_t entity_pool[MAX_IO_HANDLES];
/* Simple way of tracking used storage - each entry is NULL or a pointer to an
* entity */
-static struct io_entity *entity_map[MAX_IO_HANDLES];
+static io_entity_t *entity_map[MAX_IO_HANDLES];
/* Track number of allocated entities */
static unsigned int entity_count;
/* Used to keep a reference to platform-specific data */
-static struct io_plat_data *platform_data;
+static io_plat_data_t *platform_data;
#if DEBUG /* Extra validation functions only used in debug builds */
/* Return a boolean value indicating whether a device connector is valid */
-static int is_valid_dev_connector(const struct io_dev_connector *dev_con)
+static int is_valid_dev_connector(const io_dev_connector_t *dev_con)
{
int result = (dev_con != NULL) && (dev_con->dev_open != NULL);
return result;
/* Return a boolean value indicating whether a device handle is valid */
static int is_valid_dev(io_dev_handle handle)
{
- const struct io_dev_info *dev = handle;
+ const io_dev_info_t *dev = handle;
int result = (dev != NULL) && (dev->funcs != NULL) &&
(dev->funcs->type != NULL) &&
(dev->funcs->type() < IO_TYPE_MAX);
/* Return a boolean value indicating whether an IO entity is valid */
static int is_valid_entity(io_handle handle)
{
- const struct io_entity *entity = handle;
+ const io_entity_t *entity = handle;
int result = (entity != NULL) && (is_valid_dev(entity->dev_handle));
return result;
}
/* Return a boolean value indicating whether a seek mode is valid */
-static int is_valid_seek_mode(io_seek_mode mode)
+static int is_valid_seek_mode(io_seek_mode_t mode)
{
return ((mode != IO_SEEK_INVALID) && (mode < IO_SEEK_MAX));
}
/* Open a connection to a specific device */
-static int dev_open(const struct io_dev_connector *dev_con, void *dev_spec,
- struct io_dev_info **dev_info)
+static int dev_open(const io_dev_connector_t *dev_con, void *dev_spec,
+ io_dev_info_t **dev_info)
{
int result = IO_FAIL;
assert(dev_info != NULL);
/* Set a handle to track an entity */
-static void set_handle(io_handle *handle, struct io_entity *entity)
+static void set_handle(io_handle *handle, io_entity_t *entity)
{
assert(handle != NULL);
*handle = entity;
assert(dev_handle != NULL);
assert(is_valid_dev(dev_handle));
- struct io_dev_info *dev = dev_handle;
+ io_dev_info_t *dev = dev_handle;
if (dev->funcs->dev_init != NULL) {
result = dev->funcs->dev_init(dev, init_params);
assert(dev_handle != NULL);
assert(is_valid_dev(dev_handle));
- struct io_dev_info *dev = dev_handle;
+ io_dev_info_t *dev = dev_handle;
if (dev->funcs->dev_close != NULL) {
result = dev->funcs->dev_close(dev);
assert((spec != NULL) && (handle != NULL));
assert(is_valid_dev(dev_handle));
- struct io_dev_info *dev = dev_handle;
- struct io_entity *entity;
+ io_dev_info_t *dev = dev_handle;
+ io_entity_t *entity;
result = allocate_entity(&entity);
/* Seek to a specific position in an IO entity */
-int io_seek(io_handle handle, io_seek_mode mode, ssize_t offset)
+int io_seek(io_handle handle, io_seek_mode_t mode, ssize_t offset)
{
int result = IO_FAIL;
assert(is_valid_entity(handle) && is_valid_seek_mode(mode));
- struct io_entity *entity = handle;
+ io_entity_t *entity = handle;
- struct io_dev_info *dev = entity->dev_handle;
+ io_dev_info_t *dev = entity->dev_handle;
if (dev->funcs->seek != NULL)
result = dev->funcs->seek(entity, mode, offset);
int result = IO_FAIL;
assert(is_valid_entity(handle) && (length != NULL));
- struct io_entity *entity = handle;
+ io_entity_t *entity = handle;
- struct io_dev_info *dev = entity->dev_handle;
+ io_dev_info_t *dev = entity->dev_handle;
if (dev->funcs->size != NULL)
result = dev->funcs->size(entity, length);
int result = IO_FAIL;
assert(is_valid_entity(handle) && (buffer != NULL));
- struct io_entity *entity = handle;
+ io_entity_t *entity = handle;
- struct io_dev_info *dev = entity->dev_handle;
+ io_dev_info_t *dev = entity->dev_handle;
if (dev->funcs->read != NULL)
result = dev->funcs->read(entity, buffer, length, length_read);
int result = IO_FAIL;
assert(is_valid_entity(handle) && (buffer != NULL));
- struct io_entity *entity = handle;
+ io_entity_t *entity = handle;
- struct io_dev_info *dev = entity->dev_handle;
+ io_dev_info_t *dev = entity->dev_handle;
if (dev->funcs->write != NULL) {
result = dev->funcs->write(entity, buffer, length,
int result = IO_FAIL;
assert(is_valid_entity(handle));
- struct io_entity *entity = handle;
+ io_entity_t *entity = handle;
- struct io_dev_info *dev = entity->dev_handle;
+ io_dev_info_t *dev = entity->dev_handle;
if (dev->funcs->close != NULL)
result = dev->funcs->close(entity);
/* Initialize Bakery Lock to reset ownership and all ticket values */
-void bakery_lock_init(bakery_lock *bakery)
+void bakery_lock_init(bakery_lock_t *bakery)
{
assert(bakery);
/* Obtain a ticket for a given CPU */
-static unsigned int bakery_get_ticket(bakery_lock *bakery, unsigned int me)
+static unsigned int bakery_get_ticket(bakery_lock_t *bakery, unsigned int me)
{
unsigned int my_ticket, their_ticket;
unsigned int they;
* of others'. The CPU with the highest priority (lowest numerical value)
* acquires the lock
*/
-void bakery_lock_get(unsigned long mpidr, bakery_lock *bakery)
+void bakery_lock_get(unsigned long mpidr, bakery_lock_t *bakery)
{
unsigned int they, me;
unsigned int my_ticket, my_prio, their_ticket;
/* Release the lock and signal contenders */
-void bakery_lock_release(unsigned long mpidr, bakery_lock *bakery)
+void bakery_lock_release(unsigned long mpidr, bakery_lock_t *bakery)
{
unsigned int me = platform_get_core_pos(mpidr);
const char *file_name;
unsigned long mode;
size_t name_length;
-} smh_file_open_block;
+} smh_file_open_block_t;
typedef struct {
long handle;
void *buffer;
size_t length;
-} smh_file_read_write_block;
+} smh_file_read_write_block_t;
typedef struct {
long handle;
ssize_t location;
-} smh_file_seek_block;
+} smh_file_seek_block_t;
typedef struct {
char *command_line;
size_t command_length;
-} smh_system_block;
+} smh_system_block_t;
long semihosting_connection_supported(void)
{
long semihosting_file_open(const char *file_name, size_t mode)
{
- smh_file_open_block open_block;
+ smh_file_open_block_t open_block;
open_block.file_name = file_name;
open_block.mode = mode;
long semihosting_file_seek(long file_handle, ssize_t offset)
{
- smh_file_seek_block seek_block;
+ smh_file_seek_block_t seek_block;
long result;
seek_block.handle = file_handle;
long semihosting_file_read(long file_handle, size_t *length, void *buffer)
{
- smh_file_read_write_block read_block;
+ smh_file_read_write_block_t read_block;
long result = -EINVAL;
if ((length == NULL) || (buffer == NULL))
size_t *length,
const void *buffer)
{
- smh_file_read_write_block write_block;
+ smh_file_read_write_block_t write_block;
if ((length == NULL) || (buffer == NULL))
return -EINVAL;
long semihosting_system(char *command_line)
{
- smh_system_block system_block;
+ smh_system_block_t system_block;
system_block.command_line = command_line;
system_block.command_length = strlen(command_line);
* This doesn't include TZRAM as the 'mem_layout' argument passed to to
* configure_mmu() will give the available subset of that,
*/
-const mmap_region fvp_mmap[] = {
+const mmap_region_t fvp_mmap[] = {
{ TZROM_BASE, TZROM_SIZE, MT_MEMORY | MT_RO | MT_SECURE },
{ TZDRAM_BASE, TZDRAM_SIZE, MT_MEMORY | MT_RW | MT_SECURE },
{ FLASH0_BASE, FLASH0_SIZE, MT_MEMORY | MT_RO | MT_SECURE },
/*******************************************************************************
* Setup the pagetables as per the platform memory map & initialize the mmu
*******************************************************************************/
-void configure_mmu(meminfo *mem_layout,
+void configure_mmu(meminfo_t *mem_layout,
unsigned long ro_start,
unsigned long ro_limit,
unsigned long coh_start,
/* Data structure which holds the extents of the trusted SRAM for BL1*/
-static meminfo bl1_tzram_layout;
+static meminfo_t bl1_tzram_layout;
-meminfo *bl1_plat_sec_mem_layout(void)
+meminfo_t *bl1_plat_sec_mem_layout(void)
{
return &bl1_tzram_layout;
}
extern unsigned char **bl2_el_change_mem_ptr;
/* Data structure which holds the extents of the trusted SRAM for BL2 */
-static meminfo bl2_tzram_layout
+static meminfo_t bl2_tzram_layout
__attribute__ ((aligned(PLATFORM_CACHE_LINE_SIZE),
section("tzfw_coherent_mem")));
* Reference to structure which holds the arguments which need to be passed
* to BL31
******************************************************************************/
-static bl31_args *bl2_to_bl31_args;
+static bl31_args_t *bl2_to_bl31_args;
-meminfo *bl2_plat_sec_mem_layout(void)
+meminfo_t *bl2_plat_sec_mem_layout(void)
{
return &bl2_tzram_layout;
}
* This function returns a pointer to the memory that the platform has kept
* aside to pass all the information that BL31 could need.
******************************************************************************/
-bl31_args *bl2_get_bl31_args_ptr(void)
+bl31_args_t *bl2_get_bl31_args_ptr(void)
{
return bl2_to_bl31_args;
}
* in x0. This memory layout is sitting at the base of the free trusted SRAM.
* Copy it to a safe loaction before its reclaimed by later BL2 functionality.
******************************************************************************/
-void bl2_early_platform_setup(meminfo *mem_layout,
+void bl2_early_platform_setup(meminfo_t *mem_layout,
void *data)
{
/* Setup the BL2 memory layout */
* Ensure that the secure DRAM memory used for passing BL31 arguments
* does not overlap with the BL32_BASE.
*/
- assert (BL32_BASE > TZDRAM_BASE + sizeof(bl31_args));
+ assert (BL32_BASE > TZDRAM_BASE + sizeof(bl31_args_t));
/* Use the Trusted DRAM for passing args to BL31 */
- bl2_to_bl31_args = (bl31_args *) TZDRAM_BASE;
+ bl2_to_bl31_args = (bl31_args_t *) TZDRAM_BASE;
/* Populate the extents of memory available for loading BL33 */
bl2_to_bl31_args->bl33_meminfo.total_base = DRAM_BASE;
* Reference to structure which holds the arguments that have been passed to
* BL31 from BL2.
******************************************************************************/
-static bl31_args *bl2_to_bl31_args;
+static bl31_args_t *bl2_to_bl31_args;
-meminfo *bl31_plat_sec_mem_layout(void)
+meminfo_t *bl31_plat_sec_mem_layout(void)
{
return &bl2_to_bl31_args->bl31_meminfo;
}
-meminfo *bl31_plat_get_bl32_mem_layout(void)
+meminfo_t *bl31_plat_get_bl32_mem_layout(void)
{
return &bl2_to_bl31_args->bl32_meminfo;
}
* while BL32 corresponds to the secure image type. A NULL pointer is returned
* if the image does not exist.
******************************************************************************/
-el_change_info *bl31_get_next_image_info(uint32_t type)
+el_change_info_t *bl31_get_next_image_info(uint32_t type)
{
- el_change_info *next_image_info;
+ el_change_info_t *next_image_info;
next_image_info = (type == NON_SECURE) ?
&bl2_to_bl31_args->bl33_image_info :
* has flushed this information to memory, so we are guaranteed to pick up good
* data
******************************************************************************/
-void bl31_early_platform_setup(bl31_args *from_bl2,
+void bl31_early_platform_setup(bl31_args_t *from_bl2,
void *data)
{
bl2_to_bl31_args = from_bl2;
#define BL32_COHERENT_RAM_LIMIT (unsigned long)(&__COHERENT_RAM_END__)
/* Data structure which holds the extents of the trusted SRAM for BL32 */
-static meminfo bl32_tzdram_layout
+static meminfo_t bl32_tzdram_layout
__attribute__ ((aligned(PLATFORM_CACHE_LINE_SIZE),
section("tzfw_coherent_mem")));
-meminfo *bl32_plat_sec_mem_layout(void)
+meminfo_t *bl32_plat_sec_mem_layout(void)
{
return &bl32_tzdram_layout;
}
* BL1 has passed the extents of the trusted SRAM that's at BL32's disposal.
* Initialize the BL32 data structure with the memory extends
******************************************************************************/
-void bl32_early_platform_setup(meminfo *mem_layout,
+void bl32_early_platform_setup(meminfo_t *mem_layout,
void *data)
{
/* Setup the BL32 memory layout */
* TODO: Someday there will be a generic power controller api. At the moment
* each platform has its own pwrc so just exporting functions is fine.
*/
-static bakery_lock pwrc_lock __attribute__ ((section("tzfw_coherent_mem")));
+static bakery_lock_t pwrc_lock __attribute__ ((section("tzfw_coherent_mem")));
unsigned int fvp_pwrc_get_cpu_wkr(unsigned long mpidr)
{
#include <debug.h>
/* IO devices */
-static struct io_plat_data io_data;
-static struct io_dev_connector *sh_dev_con;
+static io_plat_data_t io_data;
+static io_dev_connector_t *sh_dev_con;
static void *const sh_dev_spec;
static void *const sh_init_params;
static io_dev_handle sh_dev_handle;
-static struct io_dev_connector *fip_dev_con;
+static io_dev_connector_t *fip_dev_con;
static void *const fip_dev_spec;
static io_dev_handle fip_dev_handle;
-static struct io_dev_connector *memmap_dev_con;
+static io_dev_connector_t *memmap_dev_con;
static void *const memmap_dev_spec;
static void *const memmap_init_params;
static io_dev_handle memmap_dev_handle;
-static io_block_spec fip_block_spec = {
+static io_block_spec_t fip_block_spec = {
.offset = FLASH0_BASE,
.length = FLASH0_SIZE
};
-static io_file_spec bl2_file_spec = {
+static io_file_spec_t bl2_file_spec = {
.path = BL2_IMAGE_NAME,
.mode = FOPEN_MODE_RB
};
-static io_file_spec bl31_file_spec = {
+static io_file_spec_t bl31_file_spec = {
.path = BL31_IMAGE_NAME,
.mode = FOPEN_MODE_RB
};
-static io_file_spec bl32_file_spec = {
+static io_file_spec_t bl32_file_spec = {
.path = BL32_IMAGE_NAME,
.mode = FOPEN_MODE_RB
};
-static io_file_spec bl33_file_spec = {
+static io_file_spec_t bl33_file_spec = {
.path = BL33_IMAGE_NAME,
.mode = FOPEN_MODE_RB
};
if (strcmp(policy->image_name, image_name) == 0) {
result = policy->check(policy->image_spec);
if (result == IO_SUCCESS) {
- *(io_file_spec **)image_spec =
+ *(io_file_spec_t **)image_spec =
policy->image_spec;
*dev_handle = *(policy->dev_handle);
break;
policy->image_spec);
if (result == IO_SUCCESS) {
*dev_handle = sh_dev_handle;
- *(io_file_spec **)image_spec =
+ *(io_file_spec_t **)image_spec =
policy->image_spec;
}
}
{
int rc = PSCI_E_SUCCESS;
unsigned long linear_id;
- mailbox *fvp_mboxes;
+ mailbox_t *fvp_mboxes;
unsigned int psysr;
/*
} while (psysr & PSYSR_AFF_L0);
linear_id = platform_get_core_pos(mpidr);
- fvp_mboxes = (mailbox *) (TZDRAM_BASE + MBOX_OFF);
+ fvp_mboxes = (mailbox_t *) (TZDRAM_BASE + MBOX_OFF);
fvp_mboxes[linear_id].value = sec_entrypoint;
flush_dcache_range((unsigned long) &fvp_mboxes[linear_id],
sizeof(unsigned long));
int rc = PSCI_E_SUCCESS;
unsigned int gicc_base, ectlr;
unsigned long cpu_setup, cci_setup, linear_id;
- mailbox *fvp_mboxes;
+ mailbox_t *fvp_mboxes;
switch (afflvl) {
case MPIDR_AFFLVL1:
/* Program the jump address for the target cpu */
linear_id = platform_get_core_pos(mpidr);
- fvp_mboxes = (mailbox *) (TZDRAM_BASE + MBOX_OFF);
+ fvp_mboxes = (mailbox_t *) (TZDRAM_BASE + MBOX_OFF);
fvp_mboxes[linear_id].value = sec_entrypoint;
flush_dcache_range((unsigned long) &fvp_mboxes[linear_id],
sizeof(unsigned long));
{
int rc = PSCI_E_SUCCESS;
unsigned long linear_id, cpu_setup, cci_setup;
- mailbox *fvp_mboxes;
+ mailbox_t *fvp_mboxes;
unsigned int gicd_base, gicc_base, reg_val, ectlr;
switch (afflvl) {
fvp_pwrc_clr_wen(mpidr);
/* Zero the jump address in the mailbox for this cpu */
- fvp_mboxes = (mailbox *) (TZDRAM_BASE + MBOX_OFF);
+ fvp_mboxes = (mailbox_t *) (TZDRAM_BASE + MBOX_OFF);
linear_id = platform_get_core_pos(mpidr);
fvp_mboxes[linear_id].value = 0;
flush_dcache_range((unsigned long) &fvp_mboxes[linear_id],
/*******************************************************************************
* Export the platform handlers to enable psci to invoke them
******************************************************************************/
-static plat_pm_ops fvp_plat_pm_ops = {
+static plat_pm_ops_t fvp_plat_pm_ops = {
fvp_affinst_standby,
fvp_affinst_on,
fvp_affinst_off,
/*******************************************************************************
* Export the platform specific power ops & initialize the fvp power controller
******************************************************************************/
-int platform_setup_pm(plat_pm_ops **plat_ops)
+int platform_setup_pm(plat_pm_ops_t **plat_ops)
{
*plat_ops = &fvp_plat_pm_ops;
return 0;
*/
void plat_security_setup(void)
{
- struct tzc_instance controller;
+ tzc_instance_t controller;
/*
* The Base FVP has a TrustZone address space controller, the Foundation
* 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.
******************************************************************************/
-typedef struct {
+typedef struct affinity_info {
unsigned char sibling;
unsigned char child;
unsigned char state;
unsigned int data;
-} affinity_info;
+} affinity_info_t;
/*******************************************************************************
* 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
* 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 fvp_aff0_topology_map[PLATFORM_CORE_COUNT];
+static affinity_info_t fvp_aff1_topology_map[PLATFORM_CLUSTER_COUNT];
+static affinity_info_t fvp_aff0_topology_map[PLATFORM_CORE_COUNT];
/* Simple global variable to safeguard us from stupidity */
static unsigned int topology_setup_done;
#ifndef __ASSEMBLY__
-typedef volatile struct {
+typedef volatile struct mailbox {
unsigned long value
__attribute__((__aligned__(CACHE_WRITEBACK_GRANULE)));
-} mailbox;
+} mailbox_t;
/*******************************************************************************
* Function and variable prototypes
extern void bl1_plat_arch_setup(void);
extern void bl2_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 void disable_mmu(void);
extern void enable_mmu(void);
-extern void configure_mmu(meminfo *,
+extern void configure_mmu(meminfo_t *,
unsigned long,
unsigned long,
unsigned long,
int32_t tspd_init_secure_context(uint64_t entrypoint,
uint32_t rw,
uint64_t mpidr,
- tsp_context *tsp_ctx)
+ tsp_context_t *tsp_ctx)
{
uint32_t scr, sctlr;
- el1_sys_regs *el1_state;
+ el1_sys_regs_t *el1_state;
uint32_t spsr;
/* Passing a NULL context is a critical programming error */
* 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.
******************************************************************************/
-uint64_t tspd_synchronous_sp_entry(tsp_context *tsp_ctx)
+uint64_t tspd_synchronous_sp_entry(tsp_context_t *tsp_ctx)
{
uint64_t rc;
* 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.
******************************************************************************/
-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 */
assert(cm_get_context(read_mpidr(), SECURE) == &tsp_ctx->cpu_ctx);
* 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.
******************************************************************************/
-entry_info *tsp_entry_info;
+entry_info_t *tsp_entry_info;
/*******************************************************************************
* 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 */
0x5b3056a0, 0x3291, 0x427b, 0x98, 0x11,
0x71, 0x68, 0xca, 0x50, 0xf3, 0xfa);
-int32_t tspd_init(meminfo *bl32_meminfo);
+int32_t tspd_init(meminfo_t *bl32_meminfo);
/*******************************************************************************
******************************************************************************/
int32_t tspd_setup(void)
{
- el_change_info *image_info;
+ el_change_info_t *image_info;
int32_t rc;
uint64_t mpidr = read_mpidr();
uint32_t linear_id;
* back to this routine through a SMC. It also passes the extents of memory made
* 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();
uint32_t linear_id = platform_get_core_pos(mpidr);
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
void *handle,
uint64_t flags)
{
- cpu_context *ns_cpu_context;
- gp_regs *ns_gp_regs;
+ cpu_context_t *ns_cpu_context;
+ gp_regs_t *ns_gp_regs;
unsigned long mpidr = read_mpidr();
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 */
ns = is_caller_non_secure(flags);
* only once on the primary cpu
*/
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
int32_t rc = 0;
uint64_t mpidr = read_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_ctx->state == TSP_STATE_ON);
int32_t rc = 0;
uint64_t mpidr = read_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_ctx->state == TSP_STATE_ON);
int32_t rc = 0;
uint64_t mpidr = read_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_ctx->state == TSP_STATE_OFF);
int32_t rc = 0;
uint64_t mpidr = read_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_ctx->state == TSP_STATE_SUSPEND);
* Structure populated by the TSP Dispatcher to be given a chance to perform any
* 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_off_handler,
tspd_cpu_suspend_handler,
* have the same double word aligned view of the size of the C runtime
* 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);
/*******************************************************************************
* from a synchronous entry into the SP.
* 'cpu_ctx' - space to maintain SP architectural state
******************************************************************************/
-typedef struct {
+typedef struct tsp_context {
uint32_t state;
uint64_t mpidr;
uint64_t c_rt_ctx;
- cpu_context cpu_ctx;
-} tsp_context;
+ cpu_context_t cpu_ctx;
+} tsp_context_t;
/* TSPD power management handlers */
-extern const spd_pm_ops tspd_pm;
+extern const spd_pm_ops_t tspd_pm;
/*******************************************************************************
* Function & Data prototypes
******************************************************************************/
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 uint64_t tspd_synchronous_sp_entry(tsp_context *tsp_ctx);
-extern void __dead2 tspd_synchronous_sp_exit(tsp_context *tsp_ctx, uint64_t ret);
+extern uint64_t tspd_synchronous_sp_entry(tsp_context_t *tsp_ctx);
+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,
uint32_t rw,
uint64_t mpidr,
- tsp_context *tsp_ctx);
-extern tsp_context tspd_sp_context[TSPD_CORE_COUNT];
-extern entry_info *tsp_entry_info;
+ tsp_context_t *tsp_ctx);
+extern tsp_context_t tspd_sp_context[TSPD_CORE_COUNT];
+extern entry_info_t *tsp_entry_info;
#endif /*__ASSEMBLY__*/
#endif /* __SPD_PRIVATE_H__ */
#include <psci.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
* 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;
int rc = PSCI_E_SUCCESS;
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;
unsigned int plat_state;
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;
unsigned int plat_state;
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_afflvl1_off,
psci_afflvl2_off,
* topology tree and calls the off handler for the corresponding affinity
* 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 end_afflvl,
unsigned long mpidr)
{
int rc = PSCI_E_INVALID_PARAMS, level;
- aff_map_node *node;
+ aff_map_node_t *node;
for (level = start_afflvl; level <= end_afflvl; level++) {
node = mpidr_nodes[level];
int end_afflvl)
{
int rc = PSCI_E_SUCCESS;
- mpidr_aff_map_nodes mpidr_nodes;
+ mpidr_aff_map_nodes_t mpidr_nodes;
mpidr &= MPIDR_AFFINITY_MASK;;
#include <runtime_svc.h>
#include "psci_private.h"
-typedef int (*afflvl_on_handler)(unsigned long,
- aff_map_node *,
+typedef int (*afflvl_on_handler_t)(unsigned long,
+ aff_map_node_t *,
unsigned long,
unsigned long);
* This function checks whether a cpu which has been requested to be turned on
* 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;
* TODO: Split this code across separate handlers for each type of setup?
******************************************************************************/
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 context_id)
{
* TODO: Split this code across separate handlers for each type of setup?
******************************************************************************/
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 context_id)
{
* TODO: Split this code across separate handlers for each type of setup?
******************************************************************************/
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 context_id)
{
}
/* 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_afflvl1_on,
psci_afflvl2_on,
* topology tree and calls the on handler for the corresponding affinity
* 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 end_afflvl,
unsigned long target_cpu,
unsigned long context_id)
{
int rc = PSCI_E_INVALID_PARAMS, level;
- aff_map_node *node;
+ aff_map_node_t *node;
for (level = end_afflvl; level >= start_afflvl; level--) {
node = target_cpu_nodes[level];
int end_afflvl)
{
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;
/*
* are called by the common finisher routine in psci_common.c.
******************************************************************************/
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;
}
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;
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;
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_afflvl1_on_finish,
psci_afflvl2_on_finish,
#include <runtime_svc.h>
#include "psci_private.h"
-typedef int (*afflvl_suspend_handler)(unsigned long,
- aff_map_node *,
+typedef int (*afflvl_suspend_handler_t)(unsigned long,
+ aff_map_node_t *,
unsigned long,
unsigned long,
unsigned int);
* This function sets the power state of the current cpu while
* 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 &
*/
flush_dcache_range(
(unsigned long)&psci_suspend_context[node->data],
- sizeof(suspend_context));
+ sizeof(suspend_context_t));
}
/*******************************************************************************
******************************************************************************/
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,
MPIDR_AFFLVL0);
* down during a cpu_suspend call. Returns PSCI_INVALID_DATA if the
* 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;
******************************************************************************/
int psci_get_suspend_stateid(unsigned long mpidr)
{
- aff_map_node *node;
+ aff_map_node_t *node;
unsigned int power_state;
node = psci_get_aff_map_node(mpidr & MPIDR_AFFINITY_MASK,
* level which is called when that affinity level is about to be suspended.
******************************************************************************/
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 context_id,
unsigned int power_state)
{
unsigned int index, plat_state;
unsigned long psci_entrypoint, sctlr;
- el3_state *saved_el3_state;
+ el3_state_t *saved_el3_state;
int rc = PSCI_E_SUCCESS;
/* Sanity check to safeguard against data corruption */
}
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 context_id,
unsigned int power_state)
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 context_id,
unsigned int power_state)
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_afflvl1_suspend,
psci_afflvl2_suspend,
* topology tree and calls the suspend handler for the corresponding affinity
* 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 end_afflvl,
unsigned long mpidr,
unsigned int power_state)
{
int rc = PSCI_E_INVALID_PARAMS, level;
- aff_map_node *node;
+ aff_map_node_t *node;
for (level = start_afflvl; level <= end_afflvl; level++) {
node = mpidr_nodes[level];
int end_afflvl)
{
int rc = PSCI_E_SUCCESS;
- mpidr_aff_map_nodes mpidr_nodes;
+ mpidr_aff_map_nodes_t mpidr_nodes;
mpidr &= MPIDR_AFFINITY_MASK;
* are called by the common finisher routine in psci_common.c.
******************************************************************************/
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;
int32_t suspend_level;
}
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;
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;;
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_afflvl1_suspend_finish,
psci_afflvl2_suspend_finish,
* SPD power management operations, expected to be supplied by the registered
* 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
* free index in the 'psci_ns_entry_info' & 'psci_suspend_context' arrays. Each
* cpu is allocated a single entry in each array during startup.
******************************************************************************/
-suspend_context psci_suspend_context[PSCI_NUM_AFFS];
-ns_entry_info psci_ns_entry_info[PSCI_NUM_AFFS];
+suspend_context_t psci_suspend_context[PSCI_NUM_AFFS];
+ns_entry_info_t psci_ns_entry_info[PSCI_NUM_AFFS];
unsigned int psci_ns_einfo_idx;
/*******************************************************************************
* management of affinity instances. Each node (aff_map_node) in the array
* 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")));
/*******************************************************************************
* level i.e. start index and end index needs to be present. 'psci_aff_limits'
* 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
******************************************************************************/
-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
******************************************************************************/
int get_power_on_target_afflvl(unsigned long mpidr)
{
- aff_map_node *node;
+ aff_map_node_t *node;
unsigned int state;
int afflvl;
void psci_acquire_afflvl_locks(unsigned long mpidr,
int start_afflvl,
int end_afflvl,
- mpidr_aff_map_nodes mpidr_nodes)
+ mpidr_aff_map_nodes_t mpidr_nodes)
{
int level;
void psci_release_afflvl_locks(unsigned long mpidr,
int start_afflvl,
int end_afflvl,
- mpidr_aff_map_nodes mpidr_nodes)
+ mpidr_aff_map_nodes_t mpidr_nodes)
{
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);
if (node && (node->state & PSCI_AFF_PRESENT))
{
unsigned long sctlr = 0, scr, el_status, id_aa64pfr0;
uint64_t mpidr = read_mpidr();
- cpu_context *ns_entry_context;
- gp_regs *ns_entry_gpregs;
+ cpu_context_t *ns_entry_context;
+ gp_regs_t *ns_entry_gpregs;
scr = read_scr();
write_sctlr_el1(sctlr);
/* 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);
/*
* 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.
******************************************************************************/
-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);
* 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.
******************************************************************************/
-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);
* tell whether that's actually happenned or not. So we err on the side of
* 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;
* topology tree and calls the physical power on handler for the corresponding
* 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 end_afflvl,
- afflvl_power_on_finisher *pon_handlers,
+ afflvl_power_on_finisher_t *pon_handlers,
unsigned long mpidr)
{
int rc = PSCI_E_INVALID_PARAMS, level;
- aff_map_node *node;
+ aff_map_node_t *node;
for (level = end_afflvl; level >= start_afflvl; level--) {
node = mpidr_nodes[level];
void psci_afflvl_power_on_finish(unsigned long mpidr,
int start_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;
mpidr &= MPIDR_AFFINITY_MASK;
* management operation. The power management hooks are expected to be provided
* 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;
}
{
int rc = PSCI_E_INVALID_PARAMS;
unsigned int aff_state;
- aff_map_node *node;
+ aff_map_node_t *node;
if (lowest_affinity_level > get_max_afflvl())
return rc;
* The following two data structures hold the generic information to bringup
* a suspended/hotplugged out cpu
******************************************************************************/
-typedef struct {
+typedef struct eret_params {
unsigned long entrypoint;
unsigned long spsr;
-} eret_params;
+} eret_params_t;
-typedef struct {
- eret_params eret_info;
+typedef struct ns_entry_info {
+ eret_params_t eret_info;
unsigned long context_id;
unsigned int scr;
unsigned int sctlr;
-} ns_entry_info;
+} ns_entry_info_t;
/*******************************************************************************
* 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.
******************************************************************************/
-typedef struct {
+typedef struct aff_map_node {
unsigned long mpidr;
unsigned short ref_count;
unsigned char state;
unsigned char level;
unsigned int data;
- bakery_lock lock;
-} aff_map_node;
+ bakery_lock_t lock;
+} aff_map_node_t;
-typedef struct {
+typedef struct aff_limits_node {
int min;
int max;
-} aff_limits_node;
+} aff_limits_node_t;
/*******************************************************************************
* This data structure holds secure world context that needs to be preserved
* across cpu_suspend calls which enter the power down state.
******************************************************************************/
-typedef struct {
+typedef struct suspend_context {
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 unsigned int (*afflvl_power_on_finisher)(unsigned long,
- aff_map_node *);
+typedef aff_map_node_t (*mpidr_aff_map_nodes_t[MPIDR_MAX_AFFLVL]);
+typedef unsigned int (*afflvl_power_on_finisher_t)(unsigned long,
+ aff_map_node_t *);
/*******************************************************************************
* Data prototypes
******************************************************************************/
-extern suspend_context psci_suspend_context[PSCI_NUM_AFFS];
-extern ns_entry_info psci_ns_entry_info[PSCI_NUM_AFFS];
+extern suspend_context_t psci_suspend_context[PSCI_NUM_AFFS];
+extern ns_entry_info_t psci_ns_entry_info[PSCI_NUM_AFFS];
extern unsigned int psci_ns_einfo_idx;
-extern aff_limits_node psci_aff_limits[MPIDR_MAX_AFFLVL + 1];
-extern plat_pm_ops *psci_plat_pm_ops;
-extern aff_map_node psci_aff_map[PSCI_NUM_AFFS];
-extern afflvl_power_on_finisher psci_afflvl_off_finish_handlers[];
-extern afflvl_power_on_finisher psci_afflvl_sus_finish_handlers[];
+extern aff_limits_node_t psci_aff_limits[MPIDR_MAX_AFFLVL + 1];
+extern plat_pm_ops_t *psci_plat_pm_ops;
+extern aff_map_node_t psci_aff_map[PSCI_NUM_AFFS];
+extern afflvl_power_on_finisher_t psci_afflvl_off_finish_handlers[];
+extern afflvl_power_on_finisher_t psci_afflvl_sus_finish_handlers[];
/*******************************************************************************
* 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
******************************************************************************/
/* Private exported functions from psci_common.c */
extern int get_max_afflvl(void);
-extern unsigned short psci_get_state(aff_map_node *node);
-extern unsigned short psci_get_phys_state(aff_map_node *node);
-extern void psci_set_state(aff_map_node *node, unsigned short state);
+extern unsigned short psci_get_state(aff_map_node_t *node);
+extern unsigned short psci_get_phys_state(aff_map_node_t *node);
+extern void psci_set_state(aff_map_node_t *node, unsigned short state);
extern void psci_get_ns_entry_info(unsigned int index);
extern unsigned long mpidr_set_aff_inst(unsigned long, unsigned char, int);
extern int psci_validate_mpidr(unsigned long, int);
extern void psci_afflvl_power_on_finish(unsigned long,
int,
int,
- afflvl_power_on_finisher *);
+ afflvl_power_on_finisher_t *);
extern int psci_set_ns_entry_info(unsigned int index,
unsigned long entrypoint,
unsigned long context_id);
extern void psci_acquire_afflvl_locks(unsigned long mpidr,
int start_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,
int start_afflvl,
int end_afflvl,
- mpidr_aff_map_nodes mpidr_nodes);
+ mpidr_aff_map_nodes_t mpidr_nodes);
/* Private exported functions from psci_setup.c */
extern int psci_get_aff_map_nodes(unsigned long mpidr,
int start_afflvl,
int end_afflvl,
- mpidr_aff_map_nodes mpidr_nodes);
-extern aff_map_node *psci_get_aff_map_node(unsigned long, int);
+ mpidr_aff_map_nodes_t mpidr_nodes);
+extern aff_map_node_t *psci_get_aff_map_node(unsigned long, int);
/* Private exported functions from psci_affinity_on.c */
extern int psci_afflvl_on(unsigned long,
extern int psci_afflvl_off(unsigned long, int, int);
/* 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);
-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,
unsigned long,
unsigned long,
* of relying on platform defined constants. Using PSCI_NUM_AFFS will be an
* 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
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 psci_get_aff_map_nodes(unsigned long mpidr,
int start_afflvl,
int end_afflvl,
- mpidr_aff_map_nodes mpidr_nodes)
+ mpidr_aff_map_nodes_t mpidr_nodes)
{
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);
if (rc != PSCI_E_SUCCESS)
{
unsigned long mpidr = read_mpidr();
int afflvl, affmap_idx, max_afflvl;
- aff_map_node *node;
+ aff_map_node_t *node;
psci_ns_einfo_idx = 0;
psci_plat_pm_ops = NULL;
#define OPT_DUMP 1
#define OPT_HELP 2
-file_info files[MAX_FILES];
+file_info_t files[MAX_FILES];
unsigned file_info_count = 0;
uuid_t uuid_null = {0};
*/
/* 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,
"bl2", NULL, FLAG_FILENAME },
{ "SCP Firmware BL3-0", UUID_SCP_FIRMWARE_BL30,
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("\tThis tool is used to create a Firmware Image Package.\n\n");
}
-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;
}
-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;
}
-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;
struct stat file_status;
bool is_new_entry = false;
}
-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;
unsigned int bytes_read;
int status;
uint8_t *fip_base_address;
void *entry_address;
- fip_toc_header *toc_header;
- fip_toc_entry *toc_entry;
+ fip_toc_header_t *toc_header;
+ fip_toc_entry_t *toc_entry;
unsigned int entry_index;
unsigned int toc_size;
unsigned int fip_size;
}
/* Allocate memory for entire package, including the final null entry */
- toc_size = (sizeof(fip_toc_header) +
- (sizeof(fip_toc_entry) * (file_info_count + 1)));
+ toc_size = (sizeof(fip_toc_header_t) +
+ (sizeof(fip_toc_entry_t) * (file_info_count + 1)));
fip_size = toc_size + payload_size;
fip_base_address = malloc(fip_size);
if (fip_base_address == NULL) {
memset(fip_base_address, 0, fip_size);
/* 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->serial_number = TOC_HEADER_SERIAL_NUMBER;
toc_header->flags = 0;
- toc_entry = (fip_toc_entry *)(fip_base_address +
- sizeof(fip_toc_header));
+ toc_entry = (fip_toc_entry_t *)(fip_base_address +
+ sizeof(fip_toc_header_t));
/* Calculate the starting address of the first image, right after the
* toc header.
unsigned int image_offset;
unsigned int image_size = 0;
- image_offset = sizeof(fip_toc_header) +
- (sizeof(fip_toc_entry) * (file_info_count + 1));
+ image_offset = sizeof(fip_toc_header_t) +
+ (sizeof(fip_toc_entry_t) * (file_info_count + 1));
printf("Firmware Image Package ToC:\n");
printf("---------------------------\n");
char *fip_buffer;
char *fip_buffer_end;
int fip_size, read_fip_size;
- fip_toc_header *toc_header;
- fip_toc_entry *toc_entry;
+ fip_toc_header_t *toc_header;
+ fip_toc_entry_t *toc_entry;
bool found_last_toc_entry = false;
- file_info *file_info_entry;
+ file_info_t *file_info_entry;
int status = -1;
struct stat st;
fip = NULL;
/* 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");
status = EINVAL;
goto parse_fip_free;
}
/* 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 */
- 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 */
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++;
/* Check if the ToC Entry is the last one */
if (compare_uuids(&toc_entry->uuid, &uuid_null) == 0) {
/* Get the new entry in the array and clear it */
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_uuid(&file_info_entry->name_uuid, &toc_entry->uuid);
int c;
int status = 0;
int option_index = 0;
- entry_lookup_list *lookup_entry;
+ entry_lookup_list_t *lookup_entry;
int do_dump = 0;
/* restart parse to process all options. starts at 1. */
* Add 'dump' option, 'help' option and end marker.
*/
static struct option long_options[(sizeof(toc_entry_lookup_list)/
- sizeof(entry_lookup_list)) + 2];
+ sizeof(entry_lookup_list_t)) + 2];
for (i = 0;
/* -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++) {
long_options[i].name = toc_entry_lookup_list[i].command_line_name;
/* The only flag defined at the moment is for a FILENAME */
#define FLAG_FILENAME (1 << 0)
-typedef struct {
+typedef struct entry_lookup_list {
const char *name;
uuid_t name_uuid;
const char *command_line_name;
struct file_info *info;
unsigned int flags;
-} entry_lookup_list;
+} entry_lookup_list_t;
-typedef struct {
+typedef struct file_info {
uuid_t name_uuid;
const char *filename;
unsigned int size;
void *image_buffer;
- entry_lookup_list *entry;
-} file_info;
+ entry_lookup_list_t *entry;
+} file_info_t;
#endif /* __FIP_CREATE_H__ */