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
...@@ -147,8 +147,6 @@ ...@@ -147,8 +147,6 @@
/* Filters are bit mapped 0 to 3. */ /* Filters are bit mapped 0 to 3. */
#define TZC400_COMPONENT_ID 0xb105f00d #define TZC400_COMPONENT_ID 0xb105f00d
#ifndef __ASSEMBLY__
/******************************************************************************* /*******************************************************************************
* Function & variable prototypes * Function & variable prototypes
******************************************************************************/ ******************************************************************************/
...@@ -205,6 +203,5 @@ void tzc_enable_filters(const tzc_instance_t *controller); ...@@ -205,6 +203,5 @@ void tzc_enable_filters(const tzc_instance_t *controller);
void tzc_disable_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); void tzc_set_action(const tzc_instance_t *controller, tzc_action_t action);
#endif /*__ASSEMBLY__*/
#endif /* __TZC400__ */ #endif /* __TZC400__ */
...@@ -31,7 +31,9 @@ ...@@ -31,7 +31,9 @@
#ifndef __IO_DRIVER_H__ #ifndef __IO_DRIVER_H__
#define __IO_DRIVER_H__ #define __IO_DRIVER_H__
#include <io_storage.h>
#include <platform.h> /* For MAX_IO_DEVICES */ #include <platform.h> /* For MAX_IO_DEVICES */
#include <stdint.h>
/* Generic IO entity structure,representing an accessible IO construct on the /* Generic IO entity structure,representing an accessible IO construct on the
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#ifndef __IO_FIP_H__ #ifndef __IO_FIP_H__
#define __IO_FIP_H__ #define __IO_FIP_H__
struct io_dev_connector;
int register_io_dev_fip(struct io_dev_connector **dev_con); int register_io_dev_fip(struct io_dev_connector **dev_con);
#endif /* __IO_FIP_H__ */ #endif /* __IO_FIP_H__ */
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#ifndef __IO_MEMMAP_H__ #ifndef __IO_MEMMAP_H__
#define __IO_MEMMAP_H__ #define __IO_MEMMAP_H__
struct io_dev_connector;
int register_io_dev_memmap(struct io_dev_connector **dev_con); int register_io_dev_memmap(struct io_dev_connector **dev_con);
#endif /* __IO_MEMMAP_H__ */ #endif /* __IO_MEMMAP_H__ */
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#ifndef __IO_SH_H__ #ifndef __IO_SH_H__
#define __IO_SH_H__ #define __IO_SH_H__
struct io_dev_connector;
int register_io_dev_sh(struct io_dev_connector **dev_con); int register_io_dev_sh(struct io_dev_connector **dev_con);
#endif /* __IO_SH_H__ */ #endif /* __IO_SH_H__ */
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#ifndef __ARCH_H__ #ifndef __ARCH_H__
#define __ARCH_H__ #define __ARCH_H__
#include <bl_common.h>
/******************************************************************************* /*******************************************************************************
* MIDR bit definitions * MIDR bit definitions
......
...@@ -31,10 +31,8 @@ ...@@ -31,10 +31,8 @@
#ifndef __ARCH_HELPERS_H__ #ifndef __ARCH_HELPERS_H__
#define __ARCH_HELPERS_H__ #define __ARCH_HELPERS_H__
#include <arch.h> #include <cdefs.h> /* For __dead2 */
#ifndef __ASSEMBLY__
#include <stdio.h>
/******************************************************************************* /*******************************************************************************
* Aarch64 translation tables manipulation helper prototypes * Aarch64 translation tables manipulation helper prototypes
...@@ -268,6 +266,5 @@ extern void write_cpuectlr(unsigned long); ...@@ -268,6 +266,5 @@ extern void write_cpuectlr(unsigned long);
extern void write_cptr_el2(unsigned long); extern void write_cptr_el2(unsigned long);
extern void write_cptr_el3(unsigned long); extern void write_cptr_el3(unsigned long);
#endif /*__ASSEMBLY__*/
#endif /* __ARCH_HELPERS_H__ */ #endif /* __ARCH_HELPERS_H__ */
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#define BAKERY_LOCK_MAX_CPUS PLATFORM_CORE_COUNT #define BAKERY_LOCK_MAX_CPUS PLATFORM_CORE_COUNT
#ifndef __ASSEMBLY__
typedef struct bakery_lock { typedef struct bakery_lock {
int owner; int owner;
volatile char entering[BAKERY_LOCK_MAX_CPUS]; volatile char entering[BAKERY_LOCK_MAX_CPUS];
...@@ -48,6 +47,5 @@ void bakery_lock_init(bakery_lock_t *bakery); ...@@ -48,6 +47,5 @@ void bakery_lock_init(bakery_lock_t *bakery);
void bakery_lock_get(unsigned long mpidr, 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); void bakery_lock_release(unsigned long mpidr, bakery_lock_t *bakery);
int bakery_lock_try(unsigned long mpidr, bakery_lock_t *bakery); int bakery_lock_try(unsigned long mpidr, bakery_lock_t *bakery);
#endif /*__ASSEMBLY__*/
#endif /* __BAKERY_LOCK_H__ */ #endif /* __BAKERY_LOCK_H__ */
...@@ -31,10 +31,7 @@ ...@@ -31,10 +31,7 @@
#ifndef __IO_H__ #ifndef __IO_H__
#define __IO_H__ #define __IO_H__
#ifndef __ASSEMBLY__ #include <stdio.h> /* For ssize_t */
#include <stdint.h>
#include <stdio.h> /* For ssize_t */
/* Device type which can be used to enable policy decisions about which device /* Device type which can be used to enable policy decisions about which device
...@@ -128,5 +125,4 @@ int io_write(io_handle handle, const void *buffer, size_t length, ...@@ -128,5 +125,4 @@ int io_write(io_handle handle, const void *buffer, size_t length,
int io_close(io_handle handle); int io_close(io_handle handle);
#endif /* __ASSEMBLY__ */
#endif /* __IO_H__ */ #endif /* __IO_H__ */
...@@ -31,8 +31,6 @@ ...@@ -31,8 +31,6 @@
#ifndef __MMIO_H__ #ifndef __MMIO_H__
#define __MMIO_H__ #define __MMIO_H__
#ifndef __ASSEMBLY__
#include <stdint.h> #include <stdint.h>
extern void mmio_write_8(uintptr_t addr, uint8_t value); extern void mmio_write_8(uintptr_t addr, uint8_t value);
...@@ -44,6 +42,4 @@ extern uint32_t mmio_read_32(uintptr_t addr); ...@@ -44,6 +42,4 @@ extern uint32_t mmio_read_32(uintptr_t addr);
extern void mmio_write_64(uintptr_t addr, uint64_t value); extern void mmio_write_64(uintptr_t addr, uint64_t value);
extern uint64_t mmio_read_64(uintptr_t addr); extern uint64_t mmio_read_64(uintptr_t addr);
#endif /*__ASSEMBLY__*/
#endif /* __MMIO_H__ */ #endif /* __MMIO_H__ */
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
#ifndef __SEMIHOSTING_H__ #ifndef __SEMIHOSTING_H__
#define __SEMIHOSTING_H__ #define __SEMIHOSTING_H__
#include <stdio.h> /* For ssize_t */
#define SEMIHOSTING_SYS_OPEN 0x01 #define SEMIHOSTING_SYS_OPEN 0x01
#define SEMIHOSTING_SYS_CLOSE 0x02 #define SEMIHOSTING_SYS_CLOSE 0x02
#define SEMIHOSTING_SYS_WRITE0 0x04 #define SEMIHOSTING_SYS_WRITE0 0x04
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <arch_helpers.h> #include <arch.h>
#include <asm_macros.S> #include <asm_macros.S>
.globl dcisw .globl dcisw
......
...@@ -28,8 +28,7 @@ ...@@ -28,8 +28,7 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <arch_helpers.h> #include <arch.h>
#include <runtime_svc.h>
#include <asm_macros.S> #include <asm_macros.S>
.globl enable_irq .globl enable_irq
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <arch_helpers.h> #include <arch.h>
#include <asm_macros.S> #include <asm_macros.S>
.globl read_vbar_el1 .globl read_vbar_el1
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <arch_helpers.h>
#include <asm_macros.S> #include <asm_macros.S>
.globl tlbialle1 .globl tlbialle1
......
...@@ -28,9 +28,8 @@ ...@@ -28,9 +28,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <string.h>
#include <assert.h>
#include <arch.h> #include <arch.h>
#include <assert.h>
/******************************************************************************* /*******************************************************************************
* Helper to create a level 1/2 table descriptor which points to a level 2/3 * Helper to create a level 1/2 table descriptor which points to a level 2/3
......
...@@ -28,11 +28,10 @@ ...@@ -28,11 +28,10 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <stddef.h>
#include <assert.h> #include <assert.h>
#include <io_storage.h>
#include <io_driver.h> #include <io_driver.h>
#include <io_storage.h>
#include <stddef.h>
#define MAX_DEVICES(plat_data) \ #define MAX_DEVICES(plat_data) \
......
...@@ -28,11 +28,10 @@ ...@@ -28,11 +28,10 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <arch_helpers.h>
#include <assert.h> #include <assert.h>
#include <string.h>
#include <bakery_lock.h> #include <bakery_lock.h>
#include <arch_helpers.h> #include <string.h>
/* /*
* Functions in this file implement Bakery Algorithm for mutual exclusion. * Functions in this file implement Bakery Algorithm for mutual exclusion.
......
...@@ -29,10 +29,9 @@ ...@@ -29,10 +29,9 @@
*/ */
#include <assert.h> #include <assert.h>
#include <string.h>
#include <errno.h> #include <errno.h>
#include <stdio.h>
#include <semihosting.h> #include <semihosting.h>
#include <string.h>
#ifndef SEMIHOSTING_SUPPORTED #ifndef SEMIHOSTING_SUPPORTED
#define SEMIHOSTING_SUPPORTED 1 #define SEMIHOSTING_SUPPORTED 1
......
...@@ -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>
.weak platform_get_core_pos .weak platform_get_core_pos
......
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