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,7 +7,7 @@
#ifndef GPT_H
#define GPT_H
#include <partition.h>
#include <drivers/partition/partition.h>
#define PARTITION_TYPE_GPT 0xee
#define GPT_HEADER_OFFSET PARTITION_BLOCK_SIZE
......
......@@ -7,9 +7,10 @@
#ifndef PARTITION_H
#define PARTITION_H
#include <cassert.h>
#include <stdint.h>
#include <lib/cassert.h>
#if !PLAT_PARTITION_MAX_ENTRIES
# define PLAT_PARTITION_MAX_ENTRIES 128
#endif /* PLAT_PARTITION_MAX_ENTRIES */
......
......@@ -7,7 +7,7 @@
#ifndef IO_MMC_H
#define IO_MMC_H
#include <io_driver.h>
#include <drivers/io/io_driver.h>
int register_io_dev_mmc(const io_dev_connector_t **dev_con);
......
......@@ -7,8 +7,8 @@
#ifndef IO_STM32IMAGE_H
#define IO_STM32IMAGE_H
#include <io_driver.h>
#include <partition.h>
#include <drivers/io/io_driver.h>
#include <drivers/partition/partition.h>
#define MAX_LBA_SIZE 512
#define MAX_PART_NAME_SIZE (EFI_NAMELEN + 1)
......
......@@ -7,7 +7,7 @@
#ifndef STM32_CONSOLE_H
#define STM32_CONSOLE_H
#include <console.h>
#include <drivers/console.h>
#define CONSOLE_T_STM32_BASE CONSOLE_T_DRVDATA
......
......@@ -7,7 +7,7 @@
#ifndef STM32_GPIO_H
#define STM32_GPIO_H
#include <utils_def.h>
#include <lib/utils_def.h>
#define STM32_GPIOA_BANK U(0x50002000)
#define STM32_GPIOZ_BANK U(0x54004000)
......
......@@ -8,7 +8,8 @@
#define STM32_I2C_H
#include <stdint.h>
#include <utils_def.h>
#include <lib/utils_def.h>
/* Bit definition for I2C_CR1 register */
#define I2C_CR1_PE BIT(0)
......
......@@ -7,9 +7,10 @@
#ifndef STM32_SDMMC2_H
#define STM32_SDMMC2_H
#include <mmc.h>
#include <stdbool.h>
#include <drivers/mmc.h>
struct stm32_sdmmc2_params {
uintptr_t reg_base;
unsigned int clk_rate;
......
......@@ -7,7 +7,7 @@
#ifndef STM32_UART_REGS_H
#define STM32_UART_REGS_H
#include <utils_def.h>
#include <lib/utils_def.h>
#define USART_CR1 U(0x00)
#define USART_CR2 U(0x04)
......
......@@ -7,9 +7,10 @@
#ifndef STM32MP1_CLK_H
#define STM32MP1_CLK_H
#include <arch_helpers.h>
#include <stdbool.h>
#include <arch_helpers.h>
int stm32mp1_clk_probe(void);
int stm32mp1_clk_init(void);
bool stm32mp1_clk_is_enabled(unsigned long id);
......
......@@ -7,9 +7,10 @@
#ifndef STM32MP1_CLKFUNC_H
#define STM32MP1_CLKFUNC_H
#include <libfdt.h>
#include <stdbool.h>
#include <libfdt.h>
enum stm32mp_osc_id {
_HSI,
_HSE,
......
......@@ -7,7 +7,7 @@
#ifndef STM32MP1_DDR_REGS_H
#define STM32MP1_DDR_REGS_H
#include <utils_def.h>
#include <lib/utils_def.h>
/* DDR3/LPDDR2/LPDDR3 Controller (DDRCTRL) registers */
struct stm32mp1_ddrctl {
......
......@@ -9,6 +9,8 @@
#include <stdbool.h>
#include <stm32mp1_def.h>
bool dt_check_pmic(void);
int dt_pmic_enable_boot_on_regulators(void);
void initialize_pmic_i2c(void);
......
......@@ -7,7 +7,7 @@
#ifndef STM32MP1_PWR_H
#define STM32MP1_PWR_H
#include <utils_def.h>
#include <lib/utils_def.h>
#define PWR_CR1 U(0x00)
#define PWR_CR2 U(0x08)
......
......@@ -7,7 +7,7 @@
#ifndef STM32MP1_RCC_H
#define STM32MP1_RCC_H
#include <utils_def.h>
#include <lib/utils_def.h>
#define RCC_TZCR U(0x00)
#define RCC_OCENSETR U(0x0C)
......
......@@ -7,8 +7,8 @@
#ifndef STPMU1_H
#define STPMU1_H
#include <stm32_i2c.h>
#include <utils_def.h>
#include <drivers/st/stm32_i2c.h>
#include <lib/utils_def.h>
#define TURN_ON_REG 0x1U
#define TURN_OFF_REG 0x2U
......
......@@ -7,7 +7,7 @@
#ifndef DW_MMC_H
#define DW_MMC_H
#include <mmc.h>
#include <drivers/mmc.h>
typedef struct dw_mmc_params {
uintptr_t reg_base;
......
......@@ -7,7 +7,7 @@
#ifndef UART_16550_H
#define UART_16550_H
#include <console.h>
#include <drivers/console.h>
/* UART16550 Registers */
#define UARTTX 0x0
......
......@@ -7,7 +7,7 @@
#ifndef UFS_H
#define UFS_H
#include <utils_def.h>
#include <lib/utils_def.h>
/* register map of UFSHCI */
/* Controller Capabilities */
......
......@@ -15,7 +15,8 @@
#include <cdefs.h>
#include <stdbool.h>
#include <stdint.h>
#include <utils_def.h>
#include <lib/utils_def.h>
/*****************************************************************************
* Internal helpers used by the bakery lock implementation.
......
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