Commit 97043ac9 authored by Dan Handley's avatar Dan Handley
Browse files

Reduce deep nesting of header files

Reduce the number of header files included from other header
files as much as possible without splitting the files. Use forward
declarations where possible. This allows removal of some unnecessary
"#ifndef __ASSEMBLY__" statements.

Also, review the .c and .S files for which header files really need
including and reorder the #include statements alphabetically.

Fixes ARM-software/tf-issues#31

Change-Id: Iec92fb976334c77453e010b60bcf56f3be72bd3e
parent fb037bfb
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
*/ */
#include <arch.h> #include <arch.h>
#include <platform.h>
#include <asm_macros.S> #include <asm_macros.S>
#include <platform.h>
.local pcpu_dv_mem_stack .local pcpu_dv_mem_stack
......
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
*/ */
#include <arch.h> #include <arch.h>
#include <platform.h>
#include <asm_macros.S> #include <asm_macros.S>
#include <platform.h>
.local pcpu_dv_mem_stack .local pcpu_dv_mem_stack
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
*/ */
#include <arch.h> #include <arch.h>
#include <platform.h>
#include <gic_v2.h>
#include <asm_macros.S> #include <asm_macros.S>
#include <gic_v2.h>
#include <platform.h>
#include "../drivers/pwrc/fvp_pwrc.h" #include "../drivers/pwrc/fvp_pwrc.h"
.globl platform_get_entrypoint .globl platform_get_entrypoint
......
...@@ -28,9 +28,12 @@ ...@@ -28,9 +28,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <assert.h> #include <arch.h>
#include <arch_helpers.h> #include <arch_helpers.h>
#include <assert.h>
#include <bl_common.h>
#include <debug.h> #include <debug.h>
#include <mmio.h>
#include <platform.h> #include <platform.h>
#include <xlat_tables.h> #include <xlat_tables.h>
......
...@@ -29,8 +29,9 @@ ...@@ -29,8 +29,9 @@
*/ */
#include <arch.h> #include <arch.h>
#include <platform.h>
#include <asm_macros.S> #include <asm_macros.S>
#include <bl_common.h>
#include <platform.h>
.globl plat_report_exception .globl plat_report_exception
......
...@@ -28,12 +28,14 @@ ...@@ -28,12 +28,14 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <assert.h>
#include <arch_helpers.h> #include <arch_helpers.h>
#include <platform.h> #include <assert.h>
#include <bl_common.h>
#include <bl1.h> #include <bl1.h>
#include <console.h> #include <console.h>
#include <cci400.h> #include <cci400.h>
#include <mmio.h>
#include <platform.h>
/******************************************************************************* /*******************************************************************************
* Declarations of linker defined symbols which will help us find the layout * Declarations of linker defined symbols which will help us find the layout
......
...@@ -28,12 +28,12 @@ ...@@ -28,12 +28,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <assert.h>
#include <arch_helpers.h> #include <arch_helpers.h>
#include <platform.h> #include <assert.h>
#include <bl2.h>
#include <bl_common.h> #include <bl_common.h>
#include <bl2.h>
#include <console.h> #include <console.h>
#include <platform.h>
/******************************************************************************* /*******************************************************************************
* Declarations of linker defined symbols which will help us find the layout * Declarations of linker defined symbols which will help us find the layout
......
...@@ -28,9 +28,13 @@ ...@@ -28,9 +28,13 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <platform.h>
#include <arch.h> #include <arch.h>
#include <bl_common.h>
#include <bl31.h>
#include <console.h> #include <console.h>
#include <mmio.h>
#include <platform.h>
#include <stddef.h>
#include "drivers/pwrc/fvp_pwrc.h" #include "drivers/pwrc/fvp_pwrc.h"
/******************************************************************************* /*******************************************************************************
......
...@@ -28,13 +28,11 @@ ...@@ -28,13 +28,11 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <string.h>
#include <assert.h>
#include <arch_helpers.h> #include <arch_helpers.h>
#include <platform.h>
#include <bl32.h>
#include <bl_common.h> #include <bl_common.h>
#include <bl32.h>
#include <console.h> #include <console.h>
#include <platform.h>
/******************************************************************************* /*******************************************************************************
* Declarations of linker defined symbols which will help us find the layout * Declarations of linker defined symbols which will help us find the layout
......
...@@ -28,13 +28,8 @@ ...@@ -28,13 +28,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <arch_helpers.h>
#include <platform.h>
#include <bakery_lock.h> #include <bakery_lock.h>
#include <mmio.h>
#include "fvp_pwrc.h" #include "fvp_pwrc.h"
/* /*
......
...@@ -28,12 +28,12 @@ ...@@ -28,12 +28,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <stdint.h>
#include <arch_helpers.h> #include <arch_helpers.h>
#include <platform.h> #include <debug.h>
#include <gic_v2.h> #include <gic_v2.h>
#include <gic_v3.h> #include <gic_v3.h>
#include <debug.h> #include <platform.h>
#include <stdint.h>
/******************************************************************************* /*******************************************************************************
......
...@@ -29,15 +29,15 @@ ...@@ -29,15 +29,15 @@
*/ */
#include <assert.h> #include <assert.h>
#include <string.h> #include <debug.h>
#include <platform.h>
#include <io_storage.h>
#include <io_driver.h> #include <io_driver.h>
#include <io_semihosting.h>
#include <semihosting.h> /* For FOPEN_MODE_... */
#include <io_fip.h> #include <io_fip.h>
#include <io_memmap.h> #include <io_memmap.h>
#include <debug.h> #include <io_storage.h>
#include <io_semihosting.h>
#include <platform.h>
#include <semihosting.h> /* For FOPEN_MODE_... */
#include <string.h>
/* IO devices */ /* IO devices */
static io_plat_data_t io_data; static io_plat_data_t io_data;
......
...@@ -28,18 +28,12 @@ ...@@ -28,18 +28,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <arch_helpers.h> #include <arch_helpers.h>
#include <console.h> #include <assert.h>
#include <platform.h>
#include <bl_common.h>
#include <bl31.h>
#include <bakery_lock.h> #include <bakery_lock.h>
#include <cci400.h> #include <cci400.h>
#include <gic_v2.h> #include <mmio.h>
/* Only included for error codes */ #include <platform.h>
#include <psci.h> #include <psci.h>
#include "drivers/pwrc/fvp_pwrc.h" #include "drivers/pwrc/fvp_pwrc.h"
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <string.h>
#include <assert.h> #include <assert.h>
#include <platform.h> #include <platform.h>
/* TODO: Reusing psci error codes & state information. Get our own! */ /* TODO: Reusing psci error codes & state information. Get our own! */
......
...@@ -32,10 +32,6 @@ ...@@ -32,10 +32,6 @@
#define __PLATFORM_H__ #define __PLATFORM_H__
#include <arch.h> #include <arch.h>
#include <mmio.h>
#include <psci.h>
#include <bl_common.h>
#include <io_storage.h>
/******************************************************************************* /*******************************************************************************
...@@ -340,11 +336,21 @@ ...@@ -340,11 +336,21 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <stdint.h>
typedef volatile struct mailbox { typedef volatile struct mailbox {
unsigned long value unsigned long value
__attribute__((__aligned__(CACHE_WRITEBACK_GRANULE))); __attribute__((__aligned__(CACHE_WRITEBACK_GRANULE)));
} mailbox_t; } mailbox_t;
/*******************************************************************************
* Forward declarations
******************************************************************************/
struct plat_pm_ops;
struct meminfo;
struct io_dev_info;
/******************************************************************************* /*******************************************************************************
* Function and variable prototypes * Function and variable prototypes
******************************************************************************/ ******************************************************************************/
...@@ -364,11 +370,11 @@ extern unsigned long warm_boot_entrypoint; ...@@ -364,11 +370,11 @@ extern unsigned long warm_boot_entrypoint;
extern void bl1_plat_arch_setup(void); extern void bl1_plat_arch_setup(void);
extern void bl2_plat_arch_setup(void); extern void bl2_plat_arch_setup(void);
extern void bl31_plat_arch_setup(void); extern void bl31_plat_arch_setup(void);
extern int platform_setup_pm(plat_pm_ops_t **); extern int platform_setup_pm(struct plat_pm_ops **);
extern unsigned int platform_get_core_pos(unsigned long mpidr); extern unsigned int platform_get_core_pos(unsigned long mpidr);
extern void disable_mmu(void); extern void disable_mmu(void);
extern void enable_mmu(void); extern void enable_mmu(void);
extern void configure_mmu(meminfo_t *, extern void configure_mmu(struct meminfo *,
unsigned long, unsigned long,
unsigned long, unsigned long,
unsigned long, unsigned long,
...@@ -395,7 +401,7 @@ extern unsigned int plat_get_aff_state(unsigned int, unsigned long); ...@@ -395,7 +401,7 @@ extern unsigned int plat_get_aff_state(unsigned int, unsigned long);
/* Declarations for plat_io_storage.c */ /* Declarations for plat_io_storage.c */
extern void io_setup(void); extern void io_setup(void);
extern int plat_get_image_source(const char *image_name, extern int plat_get_image_source(const char *image_name,
io_dev_handle *dev_handle, void **image_spec); struct io_dev_info **dev_handle, void **image_spec);
/* Declarations for plat_security.c */ /* Declarations for plat_security.c */
extern void plat_security_setup(void); extern void plat_security_setup(void);
......
...@@ -28,15 +28,12 @@ ...@@ -28,15 +28,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
#include <arch_helpers.h> #include <arch_helpers.h>
#include <platform.h> #include <assert.h>
#include <bl_common.h> #include <bl_common.h>
#include <runtime_svc.h>
#include <context_mgmt.h> #include <context_mgmt.h>
#include <platform.h>
#include <string.h>
#include "tspd_private.h" #include "tspd_private.h"
/******************************************************************************* /*******************************************************************************
......
...@@ -28,9 +28,7 @@ ...@@ -28,9 +28,7 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <context.h>
#include <asm_macros.S> #include <asm_macros.S>
#include <cm_macros.S>
#include "tspd_private.h" #include "tspd_private.h"
.global tspd_enter_sp .global tspd_enter_sp
......
...@@ -38,18 +38,14 @@ ...@@ -38,18 +38,14 @@
* handle the request locally or delegate it to the Secure Payload. It is also * handle the request locally or delegate it to the Secure Payload. It is also
* responsible for initialising and maintaining communication with the SP. * responsible for initialising and maintaining communication with the SP.
******************************************************************************/ ******************************************************************************/
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <arch_helpers.h> #include <arch_helpers.h>
#include <console.h> #include <assert.h>
#include <platform.h> #include <bl_common.h>
#include <bl31.h>
#include <context_mgmt.h> #include <context_mgmt.h>
#include <runtime_svc.h> #include <runtime_svc.h>
#include <bl31.h> #include <stddef.h>
#include <tsp.h> #include <tsp.h>
#include <psci.h>
#include <debug.h>
#include <uuid.h> #include <uuid.h>
#include "tspd_private.h" #include "tspd_private.h"
......
...@@ -28,18 +28,12 @@ ...@@ -28,18 +28,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <arch_helpers.h> #include <arch_helpers.h>
#include <console.h> #include <assert.h>
#include <platform.h> #include <bl_common.h>
#include <context_mgmt.h> #include <context_mgmt.h>
#include <runtime_svc.h>
#include <bl31.h>
#include <bl32.h>
#include <psci.h>
#include <debug.h> #include <debug.h>
#include <tsp.h>
#include "tspd_private.h" #include "tspd_private.h"
/******************************************************************************* /*******************************************************************************
......
...@@ -28,14 +28,13 @@ ...@@ -28,14 +28,13 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef __SPD_PRIVATE_H__ #ifndef __TSPD_PRIVATE_H__
#define __SPD_PRIVATE_H__ #define __TSPD_PRIVATE_H__
#include <context.h>
#include <arch.h> #include <arch.h>
#include <context.h>
#include <platform.h>
#include <psci.h> #include <psci.h>
#include <tsp.h>
#include <cassert.h>
/******************************************************************************* /*******************************************************************************
* Secure Payload PM state information e.g. SP is suspended, uninitialised etc * Secure Payload PM state information e.g. SP is suspended, uninitialised etc
...@@ -91,6 +90,9 @@ ...@@ -91,6 +90,9 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <cassert.h>
#include <stdint.h>
/* AArch64 callee saved general purpose register context structure. */ /* AArch64 callee saved general purpose register context structure. */
DEFINE_REG_STRUCT(c_rt_regs, TSPD_C_RT_CTX_ENTRIES); DEFINE_REG_STRUCT(c_rt_regs, TSPD_C_RT_CTX_ENTRIES);
...@@ -120,6 +122,11 @@ typedef struct tsp_context { ...@@ -120,6 +122,11 @@ typedef struct tsp_context {
/* TSPD power management handlers */ /* TSPD power management handlers */
extern const spd_pm_ops_t tspd_pm; extern const spd_pm_ops_t tspd_pm;
/*******************************************************************************
* Forward declarations
******************************************************************************/
struct entry_info;
/******************************************************************************* /*******************************************************************************
* Function & Data prototypes * Function & Data prototypes
******************************************************************************/ ******************************************************************************/
...@@ -132,7 +139,7 @@ extern int32_t tspd_init_secure_context(uint64_t entrypoint, ...@@ -132,7 +139,7 @@ extern int32_t tspd_init_secure_context(uint64_t entrypoint,
uint64_t mpidr, uint64_t mpidr,
tsp_context_t *tsp_ctx); tsp_context_t *tsp_ctx);
extern tsp_context_t tspd_sp_context[TSPD_CORE_COUNT]; extern tsp_context_t tspd_sp_context[TSPD_CORE_COUNT];
extern entry_info_t *tsp_entry_info; extern struct entry_info *tsp_entry_info;
#endif /*__ASSEMBLY__*/ #endif /*__ASSEMBLY__*/
#endif /* __SPD_PRIVATE_H__ */ #endif /* __TSPD_PRIVATE_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment