Commit 09d40e0e authored by Antonio Nino Diaz's avatar Antonio Nino Diaz
Browse files

Sanitise includes across codebase

Enforce full include path for includes. Deprecate old paths.

The following folders inside include/lib have been left unchanged:

- include/lib/cpus/${ARCH}
- include/lib/el3_runtime/${ARCH}

The reason for this change is that having a global namespace for
includes isn't a good idea. It defeats one of the advantages of having
folders and it introduces problems that are sometimes subtle (because
you may not know the header you are actually including if there are two
of them).

For example, this patch had to be created because two headers were
called the same way: e0ea0928 ("Fix gpio includes of mt8173 platform
to avoid collision."). More recently, this patch has had similar
problems: 46f9b2c3 ("drivers: add tzc380 support").

This problem was introduced in commit 4ecca339

 ("Move include and
source files to logical locations"). At that time, there weren't too
many headers so it wasn't a real issue. However, time has shown that
this creates problems.

Platforms that want to preserve the way they include headers may add the
removed paths to PLAT_INCLUDES, but this is discouraged.

Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8f
Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
parent f5478ded
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
#ifndef OBJECT_POOL_H #ifndef OBJECT_POOL_H
#define OBJECT_POOL_H #define OBJECT_POOL_H
#include <debug.h>
#include <stdlib.h> #include <stdlib.h>
#include <utils_def.h>
#include <common/debug.h>
#include <lib/utils_def.h>
/* /*
* Pool of statically allocated objects. * Pool of statically allocated objects.
......
...@@ -3,10 +3,11 @@ ...@@ -3,10 +3,11 @@
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#ifndef OPTEE_UTILS_H #ifndef OPTEE_UTILS_H
#define OPTEE_UTILS_H #define OPTEE_UTILS_H
#include <bl_common.h> #include <common/bl_common.h>
int parse_optee_header(entry_point_info_t *header_ep, int parse_optee_header(entry_point_info_t *header_ep,
image_info_t *pager_image_info, image_info_t *pager_image_info,
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
#ifndef PMF_H #ifndef PMF_H
#define PMF_H #define PMF_H
#include <cassert.h> #include <lib/cassert.h>
#include <pmf_helpers.h> #include <lib/pmf/pmf_helpers.h>
#include <utils_def.h> #include <lib/utils_def.h>
/* /*
* Constants used for/by PMF services. * Constants used for/by PMF services.
......
...@@ -7,13 +7,14 @@ ...@@ -7,13 +7,14 @@
#ifndef PMF_HELPERS_H #ifndef PMF_HELPERS_H
#define PMF_HELPERS_H #define PMF_HELPERS_H
#include <arch_helpers.h>
#include <assert.h> #include <assert.h>
#include <bl_common.h>
#include <platform.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <arch_helpers.h>
#include <common/bl_common.h>
#include <plat/common/platform.h>
/* /*
* Prototype for PMF service functions. * Prototype for PMF service functions.
*/ */
......
...@@ -7,11 +7,12 @@ ...@@ -7,11 +7,12 @@
#ifndef PSCI_H #ifndef PSCI_H
#define PSCI_H #define PSCI_H
#include <bakery_lock.h>
#include <bl_common.h>
#include <platform_def.h> /* for PLAT_NUM_PWR_DOMAINS */ #include <platform_def.h> /* for PLAT_NUM_PWR_DOMAINS */
#include <psci_lib.h> /* To maintain compatibility for SPDs */
#include <utils_def.h> #include <common/bl_common.h>
#include <lib/bakery_lock.h>
#include <lib/psci/psci_lib.h> /* To maintain compatibility for SPDs */
#include <lib/utils_def.h>
/******************************************************************************* /*******************************************************************************
* Number of power domains whose state this PSCI implementation can track * Number of power domains whose state this PSCI implementation can track
......
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
#ifndef PSCI_LIB_H #ifndef PSCI_LIB_H
#define PSCI_LIB_H #define PSCI_LIB_H
#include <ep_info.h> #include <common/ep_info.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <cdefs.h> #include <cdefs.h>
#include <stdint.h> #include <stdint.h>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#ifndef RUNTIME_INSTR_H #ifndef RUNTIME_INSTR_H
#define RUNTIME_INSTR_H #define RUNTIME_INSTR_H
#include <utils_def.h> #include <lib/utils_def.h>
#define RT_INSTR_ENTER_PSCI U(0) #define RT_INSTR_ENTER_PSCI U(0)
#define RT_INSTR_EXIT_PSCI U(1) #define RT_INSTR_EXIT_PSCI U(1)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#ifndef SMCCC_H #ifndef SMCCC_H
#define SMCCC_H #define SMCCC_H
#include <utils_def.h> #include <lib/utils_def.h>
#define SMCCC_VERSION_MAJOR_SHIFT U(16) #define SMCCC_VERSION_MAJOR_SHIFT U(16)
#define SMCCC_VERSION_MAJOR_MASK U(0x7FFF) #define SMCCC_VERSION_MAJOR_MASK U(0x7FFF)
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
#if SMCCC_MAJOR_VERSION == 1 #if SMCCC_MAJOR_VERSION == 1
# define SMCCC_MINOR_VERSION U(1) # define SMCCC_MINOR_VERSION U(1)
# include <smccc_v1.h> # include <lib/smccc_v1.h>
#elif SMCCC_MAJOR_VERSION == 2 #elif SMCCC_MAJOR_VERSION == 2
# define SMCCC_MINOR_VERSION U(0) # define SMCCC_MINOR_VERSION U(0)
# include <smccc_v2.h> # include <lib/smccc_v2.h>
#else #else
# error "Unsupported version of SMCCC." # error "Unsupported version of SMCCC."
#endif #endif
...@@ -35,9 +35,10 @@ ...@@ -35,9 +35,10 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <cassert.h>
#include <stdint.h> #include <stdint.h>
#include <lib/cassert.h>
#define is_caller_non_secure(_f) (((_f) & SMC_FROM_NON_SECURE) != U(0)) #define is_caller_non_secure(_f) (((_f) & SMC_FROM_NON_SECURE) != U(0))
#define is_caller_secure(_f) (!is_caller_non_secure(_f)) #define is_caller_secure(_f) (!is_caller_non_secure(_f))
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
*/ */
#if !(defined(__LINKER__) || defined(__ASSEMBLY__)) #if !(defined(__LINKER__) || defined(__ASSEMBLY__))
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
typedef struct mem_region { typedef struct mem_region {
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
#define XLAT_TABLES_AARCH32_H #define XLAT_TABLES_AARCH32_H
#include <arch.h> #include <arch.h>
#include <utils_def.h> #include <lib/utils_def.h>
#include <xlat_tables_defs.h> #include <lib/xlat_tables/xlat_tables_defs.h>
#if !defined(PAGE_SIZE) #if !defined(PAGE_SIZE)
#error "PAGE_SIZE is not defined." #error "PAGE_SIZE is not defined."
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
#define XLAT_TABLES_AARCH64_H #define XLAT_TABLES_AARCH64_H
#include <arch.h> #include <arch.h>
#include <utils_def.h> #include <lib/utils_def.h>
#include <xlat_tables_defs.h> #include <lib/xlat_tables/xlat_tables_defs.h>
#if !defined(PAGE_SIZE) #if !defined(PAGE_SIZE)
#error "PAGE_SIZE is not defined." #error "PAGE_SIZE is not defined."
......
...@@ -7,12 +7,13 @@ ...@@ -7,12 +7,13 @@
#ifndef XLAT_TABLES_H #ifndef XLAT_TABLES_H
#define XLAT_TABLES_H #define XLAT_TABLES_H
#include <xlat_tables_defs.h> #include <lib/xlat_tables/xlat_tables_defs.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <xlat_mmu_helpers.h>
#include <lib/xlat_tables/xlat_mmu_helpers.h>
/* Helper macro to define entries for mmap_region_t. It creates /* Helper macro to define entries for mmap_region_t. It creates
* identity mappings for each region. * identity mappings for each region.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
*/ */
#if XLAT_TABLES_LIB_V2 #if XLAT_TABLES_LIB_V2
#include <xlat_tables_v2.h> #include <lib/xlat_tables/xlat_tables_v2.h>
#else #else
#include <xlat_tables.h> #include <lib/xlat_tables/xlat_tables.h>
#endif #endif
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
#define XLAT_TABLES_DEFS_H #define XLAT_TABLES_DEFS_H
#include <arch.h> #include <arch.h>
#include <utils_def.h> #include <lib/utils_def.h>
#include <xlat_mmu_helpers.h> #include <lib/xlat_tables/xlat_mmu_helpers.h>
/* Miscellaneous MMU related constants */ /* Miscellaneous MMU related constants */
#define NUM_2MB_IN_GB (U(1) << 9) #define NUM_2MB_IN_GB (U(1) << 9)
......
...@@ -7,13 +7,14 @@ ...@@ -7,13 +7,14 @@
#ifndef XLAT_TABLES_V2_H #ifndef XLAT_TABLES_V2_H
#define XLAT_TABLES_V2_H #define XLAT_TABLES_V2_H
#include <xlat_tables_defs.h> #include <lib/xlat_tables/xlat_tables_defs.h>
#include <xlat_tables_v2_helpers.h> #include <lib/xlat_tables/xlat_tables_v2_helpers.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <xlat_mmu_helpers.h>
#include <lib/xlat_tables/xlat_mmu_helpers.h>
/* /*
* Default granularity size for an mmap_region_t. * Default granularity size for an mmap_region_t.
......
...@@ -18,12 +18,14 @@ ...@@ -18,12 +18,14 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <cassert.h>
#include <platform_def.h>
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <xlat_tables_arch.h>
#include <xlat_tables_defs.h> #include <platform_def.h>
#include <lib/cassert.h>
#include <lib/xlat_tables/xlat_tables_arch.h>
#include <lib/xlat_tables/xlat_tables_defs.h>
/* Forward declaration */ /* Forward declaration */
struct mmap_region; struct mmap_region;
......
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
#ifndef BOARD_CSS_DEF_H #ifndef BOARD_CSS_DEF_H
#define BOARD_CSS_DEF_H #define BOARD_CSS_DEF_H
#include <common_def.h> #include <lib/utils_def.h>
#include <plat/common/common_def.h>
#include <soc_css_def.h> #include <soc_css_def.h>
#include <utils_def.h>
#include <v2m_def.h> #include <v2m_def.h>
/* /*
...@@ -31,7 +32,7 @@ ...@@ -31,7 +32,7 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <mmio.h> #include <lib/mmio.h>
#define BOARD_CSS_GET_PLAT_TYPE(addr) \ #define BOARD_CSS_GET_PLAT_TYPE(addr) \
((mmio_read_32(addr) & BOARD_CSS_PLAT_ID_REG_ID_MASK) \ ((mmio_read_32(addr) & BOARD_CSS_PLAT_ID_REG_ID_MASK) \
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#ifndef V2M_DEF_H #ifndef V2M_DEF_H
#define V2M_DEF_H #define V2M_DEF_H
#include <xlat_tables_compat.h> #include <lib/xlat_tables/xlat_tables_compat.h>
/* V2M motherboard system registers & offsets */ /* V2M motherboard system registers & offsets */
#define V2M_SYSREGS_BASE UL(0x1c010000) #define V2M_SYSREGS_BASE UL(0x1c010000)
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
#ifndef ARM_MACROS_S #ifndef ARM_MACROS_S
#define ARM_MACROS_S #define ARM_MACROS_S
#include <gic_common.h> #include <drivers/arm/gic_common.h>
#include <gicv2.h> #include <drivers/arm/gicv2.h>
#include <gicv3.h> #include <drivers/arm/gicv3.h>
#include <platform_def.h> #include <platform_def.h>
.section .rodata.gic_reg_name, "aS" .section .rodata.gic_reg_name, "aS"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#ifndef CCI_MACROS_S #ifndef CCI_MACROS_S
#define CCI_MACROS_S #define CCI_MACROS_S
#include <cci.h> #include <drivers/arm/cci.h>
#include <platform_def.h> #include <platform_def.h>
.section .rodata.cci_reg_name, "aS" .section .rodata.cci_reg_name, "aS"
......
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