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
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
*/ */
#include <stdint.h> #include <stdint.h>
#include <debug.h>
#include <common/debug.h>
#include "../qos_common.h" #include "../qos_common.h"
#include "../qos_reg.h" #include "../qos_reg.h"
#include "qos_init_m3_v11.h" #include "qos_init_m3_v11.h"
......
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
*/ */
#include <stdint.h> #include <stdint.h>
#include <debug.h>
#include <common/debug.h>
#include "../qos_common.h" #include "../qos_common.h"
#include "../qos_reg.h" #include "../qos_reg.h"
#include "qos_init_m3n_v10.h" #include "qos_init_m3n_v10.h"
......
...@@ -5,8 +5,10 @@ ...@@ -5,8 +5,10 @@
*/ */
#include <stdint.h> #include <stdint.h>
#include <debug.h>
#include <mmio.h> #include <common/debug.h>
#include <lib/mmio.h>
#include "qos_init.h" #include "qos_init.h"
#include "qos_common.h" #include "qos_common.h"
#if RCAR_LSI == RCAR_AUTO #if RCAR_LSI == RCAR_AUTO
......
...@@ -4,17 +4,18 @@ ...@@ -4,17 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <arch.h>
#include <arch_helpers.h>
#include <assert.h> #include <assert.h>
#include <debug.h>
#include <delay_timer.h>
#include <dw_mmc.h>
#include <errno.h> #include <errno.h>
#include <mmc.h>
#include <mmio.h>
#include <string.h> #include <string.h>
#include <arch.h>
#include <arch_helpers.h>
#include <common/debug.h>
#include <drivers/delay_timer.h>
#include <drivers/mmc.h>
#include <drivers/synopsys/dw_mmc.h>
#include <lib/mmio.h>
#define DWMMC_CTRL (0x00) #define DWMMC_CTRL (0x00)
#define CTRL_IDMAC_EN (1 << 25) #define CTRL_IDMAC_EN (1 << 25)
#define CTRL_DMA_EN (1 << 5) #define CTRL_DMA_EN (1 << 5)
......
...@@ -5,12 +5,13 @@ ...@@ -5,12 +5,13 @@
*/ */
#include <assert.h> #include <assert.h>
#include <debug.h>
#include <dw_ufs.h>
#include <mmio.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <ufs.h>
#include <common/debug.h>
#include <drivers/dw_ufs.h>
#include <drivers/ufs.h>
#include <lib/mmio.h>
static int dwufs_phy_init(ufs_params_t *params) static int dwufs_phy_init(ufs_params_t *params)
{ {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <assert_macros.S> #include <assert_macros.S>
#define USE_FINISH_CONSOLE_REG_2 #define USE_FINISH_CONSOLE_REG_2
#include <console_macros.S> #include <console_macros.S>
#include <uart_16550.h> #include <drivers/ti/uart/uart_16550.h>
/* /*
* "core" functions are low-level implementations that don't require * "core" functions are low-level implementations that don't require
......
...@@ -4,17 +4,19 @@ ...@@ -4,17 +4,19 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <arch_helpers.h>
#include <assert.h> #include <assert.h>
#include <debug.h>
#include <delay_timer.h>
#include <endian.h> #include <endian.h>
#include <errno.h> #include <errno.h>
#include <mmio.h>
#include <platform_def.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <ufs.h>
#include <platform_def.h>
#include <arch_helpers.h>
#include <common/debug.h>
#include <drivers/delay_timer.h>
#include <drivers/ufs.h>
#include <lib/mmio.h>
#define CDB_ADDR_MASK 127 #define CDB_ADDR_MASK 127
#define ALIGN_CDB(x) (((x) + CDB_ADDR_MASK) & ~CDB_ADDR_MASK) #define ALIGN_CDB(x) (((x) + CDB_ADDR_MASK) & ~CDB_ADDR_MASK)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#ifndef ARCH_H #ifndef ARCH_H
#define ARCH_H #define ARCH_H
#include <utils_def.h> #include <lib/utils_def.h>
/******************************************************************************* /*******************************************************************************
* MIDR bit definitions * MIDR bit definitions
......
...@@ -7,11 +7,12 @@ ...@@ -7,11 +7,12 @@
#ifndef ARCH_HELPERS_H #ifndef ARCH_HELPERS_H
#define ARCH_HELPERS_H #define ARCH_HELPERS_H
#include <arch.h>
#include <cdefs.h> #include <cdefs.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <arch.h>
/********************************************************************** /**********************************************************************
* Macros which create inline functions to read or write CPU system * Macros which create inline functions to read or write CPU system
* registers * registers
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#define ASM_MACROS_S #define ASM_MACROS_S
#include <arch.h> #include <arch.h>
#include <asm_macros_common.S> #include <common/asm_macros_common.S>
#include <spinlock.h> #include <lib/spinlock.h>
/* /*
* TLBI instruction with type specifier that implements the workaround for * TLBI instruction with type specifier that implements the workaround for
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#ifndef CONSOLE_MACROS_S #ifndef CONSOLE_MACROS_S
#define CONSOLE_MACROS_S #define CONSOLE_MACROS_S
#include <console.h> #include <drivers/console.h>
/* /*
* This macro encapsulates the common setup that has to be done at the end of * This macro encapsulates the common setup that has to be done at the end of
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#ifndef SMCCC_HELPERS_H #ifndef SMCCC_HELPERS_H
#define SMCCC_HELPERS_H #define SMCCC_HELPERS_H
#include <smccc.h> #include <lib/smccc.h>
/* These are offsets to registers in smc_ctx_t */ /* These are offsets to registers in smc_ctx_t */
#define SMC_CTX_GPREG_R0 U(0x0) #define SMC_CTX_GPREG_R0 U(0x0)
...@@ -25,9 +25,11 @@ ...@@ -25,9 +25,11 @@
#define SMC_CTX_SIZE U(0x90) #define SMC_CTX_SIZE U(0x90)
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <cassert.h>
#include <stdint.h> #include <stdint.h>
#include <lib/cassert.h>
/* /*
* The generic structure to save arguments and callee saved registers during * The generic structure to save arguments and callee saved registers during
* an SMC. Also this structure is used to store the result return values after * an SMC. Also this structure is used to store the result return values after
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#ifndef ARCH_H #ifndef ARCH_H
#define ARCH_H #define ARCH_H
#include <utils_def.h> #include <lib/utils_def.h>
/******************************************************************************* /*******************************************************************************
* MIDR bit definitions * MIDR bit definitions
......
...@@ -7,12 +7,13 @@ ...@@ -7,12 +7,13 @@
#ifndef ARCH_HELPERS_H #ifndef ARCH_HELPERS_H
#define ARCH_HELPERS_H #define ARCH_HELPERS_H
#include <arch.h>
#include <cdefs.h> #include <cdefs.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <arch.h>
/********************************************************************** /**********************************************************************
* Macros which create inline functions to read or write CPU system * Macros which create inline functions to read or write CPU system
* registers * registers
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#define ASM_MACROS_S #define ASM_MACROS_S
#include <arch.h> #include <arch.h>
#include <asm_macros_common.S> #include <common/asm_macros_common.S>
#include <spinlock.h> #include <lib/spinlock.h>
/* /*
* TLBI instruction with type specifier that implements the workaround for * TLBI instruction with type specifier that implements the workaround for
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#ifndef CONSOLE_MACROS_S #ifndef CONSOLE_MACROS_S
#define CONSOLE_MACROS_S #define CONSOLE_MACROS_S
#include <console.h> #include <drivers/console.h>
/* /*
* This macro encapsulates the common setup that has to be done at the end of * This macro encapsulates the common setup that has to be done at the end of
......
...@@ -7,12 +7,14 @@ ...@@ -7,12 +7,14 @@
#ifndef SMCCC_HELPERS_H #ifndef SMCCC_HELPERS_H
#define SMCCC_HELPERS_H #define SMCCC_HELPERS_H
#include <smccc.h> #include <lib/smccc.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <context.h>
#include <stdbool.h> #include <stdbool.h>
#include <context.h>
/* Convenience macros to return from SMC handler */ /* Convenience macros to return from SMC handler */
#define SMC_RET0(_h) { \ #define SMC_RET0(_h) { \
return (uint64_t) (_h); \ return (uint64_t) (_h); \
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#ifndef BL1_H #ifndef BL1_H
#define BL1_H #define BL1_H
#include <bl_common.h> #include <common/bl_common.h>
/* /*
* Defines for BL1 SMC function ids. * Defines for BL1 SMC function ids.
...@@ -62,7 +62,8 @@ ...@@ -62,7 +62,8 @@
((_fid >= FWU_SMC_FID_START) && (_fid <= FWU_SMC_FID_END)) ((_fid >= FWU_SMC_FID_START) && (_fid <= FWU_SMC_FID_END))
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <cassert.h>
#include <lib/cassert.h>
struct entry_point_info; struct entry_point_info;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#ifndef TBBR_IMG_DESC_H #ifndef TBBR_IMG_DESC_H
#define TBBR_IMG_DESC_H #define TBBR_IMG_DESC_H
#include <bl_common.h> #include <common/bl_common.h>
extern image_desc_t bl1_tbbr_image_descs[]; extern image_desc_t bl1_tbbr_image_descs[];
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
#include <cdefs.h> #include <cdefs.h>
#include <stdint.h> #include <stdint.h>
#include <utils_def.h>
#include <lib/utils_def.h>
/* Valid priorities set bit 0 of the priority handler. */ /* Valid priorities set bit 0 of the priority handler. */
#define EHF_PRI_VALID_ BIT(0) #define EHF_PRI_VALID_ BIT(0)
......
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