aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bl31/bl31_main.c2
-rw-r--r--plat/juno/aarch64/bl1_plat_helpers.S2
-rw-r--r--plat/juno/aarch64/plat_common.c8
-rw-r--r--plat/juno/aarch64/plat_helpers.S3
-rw-r--r--plat/juno/bl1_plat_setup.c14
-rw-r--r--plat/juno/bl2_plat_setup.c31
-rw-r--r--plat/juno/bl31_plat_setup.c20
-rw-r--r--plat/juno/mhu.c4
-rw-r--r--plat/juno/mhu.h1
-rw-r--r--plat/juno/plat_gic.c2
-rw-r--r--plat/juno/plat_io_storage.c110
-rw-r--r--plat/juno/plat_pm.c4
-rw-r--r--plat/juno/plat_topology.c1
-rw-r--r--plat/juno/platform.h19
-rw-r--r--plat/juno/platform.mk2
-rw-r--r--plat/juno/scpi.h2
-rw-r--r--plat/juno/smc_arm.c5
17 files changed, 130 insertions, 100 deletions
diff --git a/bl31/bl31_main.c b/bl31/bl31_main.c
index 19eccd5..40547fe 100644
--- a/bl31/bl31_main.c
+++ b/bl31/bl31_main.c
@@ -185,7 +185,7 @@ void bl31_prepare_next_image_entry()
/*
* Setup general purpose registers context for next image.
*/
- cpu_context *context = cm_get_context(read_mpidr(),
+ cpu_context_t *context = cm_get_context(read_mpidr(),
next_image_info->security_state);
memcpy(&context->gpregs_ctx, &next_image_info->args,
sizeof(next_image_info->args));
diff --git a/plat/juno/aarch64/bl1_plat_helpers.S b/plat/juno/aarch64/bl1_plat_helpers.S
index c9a581f..65b26cf 100644
--- a/plat/juno/aarch64/bl1_plat_helpers.S
+++ b/plat/juno/aarch64/bl1_plat_helpers.S
@@ -29,8 +29,8 @@
*/
#include <arch.h>
-#include <platform.h>
#include <asm_macros.S>
+#include <platform.h>
.globl platform_get_entrypoint
.globl platform_cold_boot_init
diff --git a/plat/juno/aarch64/plat_common.c b/plat/juno/aarch64/plat_common.c
index 9be2081..3cd9d89 100644
--- a/plat/juno/aarch64/plat_common.c
+++ b/plat/juno/aarch64/plat_common.c
@@ -29,9 +29,11 @@
*/
#include <arch_helpers.h>
+#include <assert.h>
+#include <bl_common.h>
+#include <mmio.h>
#include <platform.h>
#include <xlat_tables.h>
-#include <assert.h>
void enable_mmu()
@@ -104,7 +106,7 @@ void disable_mmu(void)
return;
}
-static const mmap_region juno_mmap[] = {
+static const mmap_region_t juno_mmap[] = {
{ TZROM_BASE, TZROM_SIZE, MT_MEMORY | MT_RO | MT_SECURE },
{ MHU_SECURE_BASE, MHU_SECURE_SIZE, (MHU_PAYLOAD_CACHED ? MT_MEMORY : MT_DEVICE)
| MT_RW | MT_SECURE },
@@ -121,7 +123,7 @@ static const mmap_region juno_mmap[] = {
{0}
};
-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,
diff --git a/plat/juno/aarch64/plat_helpers.S b/plat/juno/aarch64/plat_helpers.S
index c9cbb2d..ec6607b 100644
--- a/plat/juno/aarch64/plat_helpers.S
+++ b/plat/juno/aarch64/plat_helpers.S
@@ -29,8 +29,9 @@
*/
#include <arch.h>
-#include <platform.h>
#include <asm_macros.S>
+#include <bl_common.h>
+#include <platform.h>
.globl plat_report_exception
diff --git a/plat/juno/bl1_plat_setup.c b/plat/juno/bl1_plat_setup.c
index bfbc960..8e6ceea 100644
--- a/plat/juno/bl1_plat_setup.c
+++ b/plat/juno/bl1_plat_setup.c
@@ -28,13 +28,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <assert.h>
#include <arch_helpers.h>
-#include <platform.h>
+#include <assert.h>
+#include <bl_common.h>
#include <bl1.h>
-#include <console.h>
#include <cci400.h>
-#include <tzc400.h>
+#include <console.h>
+#include <mmio.h>
+#include <platform.h>
+#include "../../drivers/arm/trustzone/tzc-400/tzc400.h"
/*******************************************************************************
* Declarations of linker defined symbols which will help us find the layout
@@ -61,9 +63,9 @@ extern unsigned long __BL1_RAM_END__;
/* Data structure which holds the extents of the trusted RAM 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;
}
diff --git a/plat/juno/bl2_plat_setup.c b/plat/juno/bl2_plat_setup.c
index 3f26dd3..d1a5a9b 100644
--- a/plat/juno/bl2_plat_setup.c
+++ b/plat/juno/bl2_plat_setup.c
@@ -28,16 +28,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
#include <arch_helpers.h>
-#include <platform.h>
-#include <bl2.h>
+#include <assert.h>
#include <bl_common.h>
-#include <scp_bootloader.h>
-#include <debug.h>
+#include <bl2.h>
#include <console.h>
+#include <debug.h>
+#include <platform.h>
+#include <scp_bootloader.h>
+#include <string.h>
/*******************************************************************************
* Declarations of linker defined symbols which will help us find the layout
@@ -72,20 +71,20 @@ extern unsigned long __COHERENT_RAM_END__;
extern unsigned char **bl2_el_change_mem_ptr;
/* Data structure which holds the extents of the trusted RAM for BL2 */
-static meminfo bl2_tzram_layout
+static meminfo_t bl2_tzram_layout
__attribute__ ((aligned(PLATFORM_CACHE_LINE_SIZE),
section("tzfw_coherent_mem")));
-static bl31_args bl2_to_bl31_args
+static bl31_args_t bl2_to_bl31_args
__attribute__ ((aligned(PLATFORM_CACHE_LINE_SIZE),
section("tzfw_coherent_mem")));
-meminfo *bl2_plat_sec_mem_layout(void)
+meminfo_t *bl2_plat_sec_mem_layout(void)
{
return &bl2_tzram_layout;
}
-bl31_args *bl2_get_bl31_args_ptr(void)
+bl31_args_t *bl2_get_bl31_args_ptr(void)
{
return &bl2_to_bl31_args;
}
@@ -95,7 +94,7 @@ bl31_args *bl2_get_bl31_args_ptr(void)
* in x0. This memory layout is sitting at the base of the free trusted RAM.
* 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)
{
@@ -120,9 +119,9 @@ void bl2_early_platform_setup(meminfo *mem_layout,
******************************************************************************/
static int load_bl30(void)
{
- meminfo *bl2_tzram_layout;
- meminfo tzram_layout;
- meminfo *tmp_tzram_layout = &tzram_layout;
+ meminfo_t *bl2_tzram_layout;
+ meminfo_t tzram_layout;
+ meminfo_t *tmp_tzram_layout = &tzram_layout;
unsigned long bl30_base;
unsigned int image_len;
unsigned int bl2_load, bl30_load;
@@ -132,7 +131,7 @@ static int load_bl30(void)
bl2_tzram_layout = bl2_plat_sec_mem_layout();
/* copy the TZRAM layout and use it */
- memcpy(tmp_tzram_layout, bl2_tzram_layout, sizeof(meminfo));
+ memcpy(tmp_tzram_layout, bl2_tzram_layout, sizeof(meminfo_t));
/* Work out where to load BL3-0 before transferring to SCP */
bl2_load = tmp_tzram_layout->attr & LOAD_MASK;
diff --git a/plat/juno/bl31_plat_setup.c b/plat/juno/bl31_plat_setup.c
index 6ad8a66..1440ac3 100644
--- a/plat/juno/bl31_plat_setup.c
+++ b/plat/juno/bl31_plat_setup.c
@@ -28,10 +28,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <arch.h>
+#include <bl31.h>
+#include <bl_common.h>
+#include <console.h>
#include <mhu.h>
+#include <mmio.h>
#include <platform.h>
-#include <arch_helpers.h>
-#include <console.h>
+#include <stddef.h>
/*******************************************************************************
* Declarations of linker defined symbols which will help us find the layout
@@ -62,14 +66,14 @@ extern unsigned long __COHERENT_RAM_END__;
#define BL31_COHERENT_RAM_BASE (unsigned long)(&__COHERENT_RAM_START__)
#define BL31_COHERENT_RAM_LIMIT (unsigned long)(&__COHERENT_RAM_END__)
-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;
}
@@ -80,9 +84,9 @@ meminfo *bl31_plat_get_bl32_mem_layout(void)
* while BL3-2 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 :
@@ -104,7 +108,7 @@ el_change_info *bl31_get_next_image_info(uint32_t type)
* Also, BL2 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)
{
/* Initialize the console to provide early debug support */
diff --git a/plat/juno/mhu.c b/plat/juno/mhu.c
index 4d528fb..7ead09d 100644
--- a/plat/juno/mhu.c
+++ b/plat/juno/mhu.c
@@ -31,7 +31,7 @@
#include <arch_helpers.h>
#include <bakery_lock.h>
#include <mhu.h>
-#include <platform.h>
+#include <mmio.h>
/* SCP MHU secure channel registers */
#define SCP_INTR_S_STAT 0x200
@@ -44,7 +44,7 @@
#define CPU_INTR_S_CLEAR 0x310
-static bakery_lock mhu_secure_lock __attribute__ ((section("tzfw_coherent_mem")));
+static bakery_lock_t mhu_secure_lock __attribute__ ((section("tzfw_coherent_mem")));
void mhu_secure_message_start(void)
diff --git a/plat/juno/mhu.h b/plat/juno/mhu.h
index eeb97e1..5149c82 100644
--- a/plat/juno/mhu.h
+++ b/plat/juno/mhu.h
@@ -32,7 +32,6 @@
#define __MHU_H__
#include <stdint.h>
-#include <stddef.h>
extern void mhu_secure_message_start(void);
extern void mhu_secure_message_send(uint32_t command);
diff --git a/plat/juno/plat_gic.c b/plat/juno/plat_gic.c
index ad9384c..434360b 100644
--- a/plat/juno/plat_gic.c
+++ b/plat/juno/plat_gic.c
@@ -29,8 +29,8 @@
*/
#include <arch_helpers.h>
+#include <gic_v2.h>
#include <platform.h>
-#include <gic.h>
/* Value used to initialise Non-Secure irq priorities four at a time */
diff --git a/plat/juno/plat_io_storage.c b/plat/juno/plat_io_storage.c
index 54add7d..5893b5e 100644
--- a/plat/juno/plat_io_storage.c
+++ b/plat/juno/plat_io_storage.c
@@ -30,75 +30,97 @@
#include <assert.h>
#include <string.h>
-#include "platform.h"
-#include "io_storage.h"
-#include "io_driver.h"
-#include "semihosting.h" /* For FOPEN_MODE_... */
-#include "io_fip.h"
-#include "io_memmap.h"
-#include "debug.h"
+#include <platform.h>
+#include <io_storage.h>
+#include <io_driver.h>
+#include <semihosting.h> /* For FOPEN_MODE_... */
+#include <io_fip.h>
+#include <io_memmap.h>
+#include <debug.h>
/* IO devices */
-static struct io_plat_data io_data;
-static struct io_dev_connector *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 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_plat_data_t io_data;
+static const io_dev_connector_t *fip_dev_con;
+static uintptr_t fip_dev_spec;
+static uintptr_t fip_dev_handle;
+static const io_dev_connector_t *memmap_dev_con;
+static uintptr_t memmap_dev_spec;
+static uintptr_t memmap_init_params;
+static uintptr_t memmap_dev_handle;
+
+static io_block_spec_t fip_block_spec = {
.offset = FLASH_BASE,
.length = FLASH_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 bl30_file_spec = {
+static io_file_spec_t bl30_file_spec = {
.path = BL30_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 bl33_file_spec = {
+static io_file_spec_t bl33_file_spec = {
.path = BL33_IMAGE_NAME,
.mode = FOPEN_MODE_RB
};
-static int open_fip(void *spec);
-static int open_memmap(void *spec);
+static int open_fip(const uintptr_t spec);
+static int open_memmap(const uintptr_t spec);
-typedef struct {
+struct plat_io_policy {
char *image_name;
- io_dev_handle *dev_handle;
- void *image_spec;
- int (*check)(void *spec);
-} plat_io_policy;
-
-static plat_io_policy policies[] = {
- { FIP_IMAGE_NAME, &memmap_dev_handle, &fip_block_spec, open_memmap },
- { BL2_IMAGE_NAME, &fip_dev_handle, &bl2_file_spec, open_fip },
- { BL30_IMAGE_NAME, &fip_dev_handle, &bl30_file_spec, open_fip },
- { BL31_IMAGE_NAME, &fip_dev_handle, &bl31_file_spec, open_fip },
- { BL33_IMAGE_NAME, &fip_dev_handle, &bl33_file_spec, open_fip },
- {0, 0, 0}
+ uintptr_t *dev_handle;
+ uintptr_t image_spec;
+ int (*check)(const uintptr_t spec);
+};
+
+static struct plat_io_policy policies[] = {
+ {
+ FIP_IMAGE_NAME,
+ &memmap_dev_handle,
+ (uintptr_t)&fip_block_spec,
+ open_memmap
+ }, {
+ BL2_IMAGE_NAME,
+ &fip_dev_handle,
+ (uintptr_t)&bl2_file_spec,
+ open_fip
+ }, {
+ BL30_IMAGE_NAME,
+ &fip_dev_handle,
+ (uintptr_t)&bl30_file_spec,
+ open_fip
+ }, {
+ BL31_IMAGE_NAME,
+ &fip_dev_handle,
+ (uintptr_t)&bl31_file_spec,
+ open_fip
+ }, {
+ BL33_IMAGE_NAME,
+ &fip_dev_handle,
+ (uintptr_t)&bl33_file_spec,
+ open_fip
+ }, {
+ 0, 0, 0
+ }
};
-static int open_fip(void *spec)
+static int open_fip(const uintptr_t spec)
{
int result = IO_FAIL;
/* See if a Firmware Image Package is available */
- result = io_dev_init(fip_dev_handle, (void *)FIP_IMAGE_NAME);
+ result = io_dev_init(fip_dev_handle, (uintptr_t)FIP_IMAGE_NAME);
if (result == IO_SUCCESS) {
INFO("Using FIP\n");
/*TODO: Check image defined in spec is present in FIP. */
@@ -107,10 +129,10 @@ static int open_fip(void *spec)
}
-static int open_memmap(void *spec)
+static int open_memmap(const uintptr_t spec)
{
int result = IO_FAIL;
- io_handle local_image_handle;
+ uintptr_t local_image_handle;
result = io_dev_init(memmap_dev_handle, memmap_init_params);
if (result == IO_SUCCESS) {
@@ -152,11 +174,11 @@ void io_setup (void)
/* Return an IO device handle and specification which can be used to access
* an image. Use this to enforce platform load policy */
-int plat_get_image_source(const char *image_name, io_dev_handle *dev_handle,
- void **image_spec)
+int plat_get_image_source(const char *image_name, uintptr_t *dev_handle,
+ uintptr_t *image_spec)
{
int result = IO_FAIL;
- plat_io_policy *policy;
+ struct plat_io_policy *policy;
if ((image_name != NULL) && (dev_handle != NULL) &&
(image_spec != NULL)) {
@@ -165,7 +187,7 @@ int plat_get_image_source(const char *image_name, io_dev_handle *dev_handle,
if (strcmp(policy->image_name, image_name) == 0) {
result = policy->check(policy->image_spec);
if (result == IO_SUCCESS) {
- *(io_file_spec **)image_spec = policy->image_spec;
+ *image_spec = policy->image_spec;
*dev_handle = *(policy->dev_handle);
break;
}
diff --git a/plat/juno/plat_pm.c b/plat/juno/plat_pm.c
index d4b98fd..d301a74 100644
--- a/plat/juno/plat_pm.c
+++ b/plat/juno/plat_pm.c
@@ -145,7 +145,7 @@ int pm_off(unsigned long mpidr, unsigned int afflvl, unsigned int state)
/*******************************************************************************
* Export the platform handlers to enable psci to invoke them
******************************************************************************/
-static plat_pm_ops pm_ops = {
+static plat_pm_ops_t pm_ops = {
.affinst_on = pm_on,
.affinst_on_finish = pm_on_finish,
.affinst_off = pm_off
@@ -154,7 +154,7 @@ static plat_pm_ops pm_ops = {
/*******************************************************************************
* Export the platform specific power ops & initialize the fvp power controller
******************************************************************************/
-int platform_setup_pm(plat_pm_ops **plat_ops)
+int platform_setup_pm(const plat_pm_ops_t **plat_ops)
{
*plat_ops = &pm_ops;
return 0;
diff --git a/plat/juno/plat_topology.c b/plat/juno/plat_topology.c
index 205791b..4bc58ba 100644
--- a/plat/juno/plat_topology.c
+++ b/plat/juno/plat_topology.c
@@ -29,6 +29,7 @@
*/
#include <platform.h>
+#include <psci.h>
unsigned int plat_get_aff_count(unsigned int aff_lvl, unsigned long mpidr)
{
diff --git a/plat/juno/platform.h b/plat/juno/platform.h
index c2d9bd1..3738a28 100644
--- a/plat/juno/platform.h
+++ b/plat/juno/platform.h
@@ -32,11 +32,6 @@
#define __PLATFORM_H__
#include <arch.h>
-#include <mmio.h>
-#include <psci.h>
-#include <bl_common.h>
-#include "io_storage.h"
-
/*******************************************************************************
* Platform binary types for linking
@@ -316,6 +311,14 @@
#ifndef __ASSEMBLY__
+#include <stdint.h>
+
+/*******************************************************************************
+ * Forward declarations
+ ******************************************************************************/
+struct plat_pm_ops;
+struct meminfo;
+
/*******************************************************************************
* Function and variable prototypes
******************************************************************************/
@@ -335,11 +338,11 @@ extern unsigned long warm_boot_entrypoint;
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(const struct plat_pm_ops **);
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(struct meminfo *,
unsigned long,
unsigned long,
unsigned long,
@@ -364,7 +367,7 @@ extern unsigned int plat_get_aff_state(unsigned int, unsigned long);
/* Declarations for plat_io_storage.c */
extern void io_setup(void);
extern int plat_get_image_source(const char *image_name,
- io_dev_handle *dev_handle, void **image_spec);
+ uintptr_t *dev_handle, uintptr_t *image_spec);
#endif /*__ASSEMBLY__*/
diff --git a/plat/juno/platform.mk b/plat/juno/platform.mk
index ab0002a..6fdb276 100644
--- a/plat/juno/platform.mk
+++ b/plat/juno/platform.mk
@@ -36,7 +36,7 @@
PLAT_BL_COMMON_SOURCES := drivers/arm/pl011/pl011_console.c \
drivers/arm/pl011/pl011.c \
drivers/io/io_fip.c \
- drivers/ioio_memmap.c \
+ drivers/io/io_memmap.c \
lib/mmio.c \
lib/aarch64/xlat_tables.c \
lib/aarch64/sysreg_helpers.S \
diff --git a/plat/juno/scpi.h b/plat/juno/scpi.h
index 9d77a92..4ddbeea 100644
--- a/plat/juno/scpi.h
+++ b/plat/juno/scpi.h
@@ -31,8 +31,8 @@
#ifndef __SCPI_H__
#define __SCPI_H__
-#include <stdint.h>
#include <stddef.h>
+#include <stdint.h>
extern void *scpi_secure_message_start(void);
extern void scpi_secure_message_send(unsigned command, size_t size);
diff --git a/plat/juno/smc_arm.c b/plat/juno/smc_arm.c
index af9e8b4..c6b3c9b 100644
--- a/plat/juno/smc_arm.c
+++ b/plat/juno/smc_arm.c
@@ -28,11 +28,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <stdint.h>
-#include <context.h>
+#include <psci.h>
#include <runtime_svc.h>
-#include <psci_private.h>
-
#define ARM_SMC_ARM_CPU_SUSPEND 0x80100001
#define ARM_SMC_ARM_CPU_OFF 0x80100002