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: e0ea0928d5b7 ("Fix gpio includes of mt8173 platform
to avoid collision."). More recently, this patch has had similar
problems: 46f9b2c3a282 ("drivers: add tzc380 support").
This problem was introduced in commit 4ecca33988b9 ("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: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
diff --git a/include/common/bl_common.h b/include/common/bl_common.h
index 56c89fc..c12b08b 100644
--- a/include/common/bl_common.h
+++ b/include/common/bl_common.h
@@ -7,9 +7,9 @@
#ifndef BL_COMMON_H
#define BL_COMMON_H
-#include <ep_info.h>
-#include <param_header.h>
-#include <utils_def.h>
+#include <common/ep_info.h>
+#include <common/param_header.h>
+#include <lib/utils_def.h>
#define UP U(1)
#define DOWN U(0)
@@ -58,11 +58,11 @@
#define SERROR_AARCH32 U(0xf)
#ifndef __ASSEMBLY__
-#include <cassert.h>
+
#include <stddef.h>
#include <stdint.h>
-#include <utils_def.h> /* To retain compatibility */
+#include <lib/cassert.h>
/*
* Declarations of linker defined symbols to help determine memory layout of
diff --git a/include/common/debug.h b/include/common/debug.h
index a14a66e..f8faf68 100644
--- a/include/common/debug.h
+++ b/include/common/debug.h
@@ -7,7 +7,7 @@
#ifndef DEBUG_H
#define DEBUG_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
/*
* The log output macros print output to the console. These macros produce
@@ -28,12 +28,14 @@
#define LOG_LEVEL_VERBOSE U(50)
#ifndef __ASSEMBLY__
+
#include <cdefs.h>
-#include <console.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
+#include <drivers/console.h>
+
/*
* Define Log Markers corresponding to each log level which will
* be embedded in the format string and is expected by tf_log() to determine
diff --git a/include/common/desc_image_load.h b/include/common/desc_image_load.h
index 6254895..f2f26ea 100644
--- a/include/common/desc_image_load.h
+++ b/include/common/desc_image_load.h
@@ -6,7 +6,7 @@
#ifndef DESC_IMAGE_LOAD_H
#define DESC_IMAGE_LOAD_H
-#include <bl_common.h>
+#include <common/bl_common.h>
/* Following structure is used to store BL ep/image info. */
typedef struct bl_mem_params_node {
diff --git a/include/common/ep_info.h b/include/common/ep_info.h
index 0f67687..a09d03b 100644
--- a/include/common/ep_info.h
+++ b/include/common/ep_info.h
@@ -7,8 +7,8 @@
#ifndef EP_INFO_H
#define EP_INFO_H
-#include <param_header.h>
-#include <utils_def.h>
+#include <common/param_header.h>
+#include <lib/utils_def.h>
#define SECURE U(0x0)
#define NON_SECURE U(0x1)
@@ -64,9 +64,10 @@
#ifndef __ASSEMBLY__
-#include <cassert.h>
#include <stdint.h>
+#include <lib/cassert.h>
+
typedef struct aapcs64_params {
u_register_t arg0;
u_register_t arg1;
diff --git a/include/common/param_header.h b/include/common/param_header.h
index e9717cb..0c1503f 100644
--- a/include/common/param_header.h
+++ b/include/common/param_header.h
@@ -8,7 +8,8 @@
#define PARAM_HEADER_H
#include <stdbool.h>
-#include <utils_def.h>
+
+#include <lib/utils_def.h>
/* Param header types */
#define PARAM_EP U(0x01)
diff --git a/include/common/runtime_svc.h b/include/common/runtime_svc.h
index e32c287..59bf158 100644
--- a/include/common/runtime_svc.h
+++ b/include/common/runtime_svc.h
@@ -7,10 +7,10 @@
#ifndef RUNTIME_SVC_H
#define RUNTIME_SVC_H
-#include <bl_common.h> /* to include exception types */
-#include <cassert.h>
+#include <common/bl_common.h> /* to include exception types */
+#include <lib/cassert.h>
+#include <lib/utils_def.h>
#include <smccc_helpers.h> /* to include SMCCC definitions */
-#include <utils_def.h>
/*******************************************************************************
* Structure definition, typedefs & constants for the runtime service framework
diff --git a/include/common/tbbr/tbbr_img_def.h b/include/common/tbbr/tbbr_img_def.h
index bd8f5dc..672886d 100644
--- a/include/common/tbbr/tbbr_img_def.h
+++ b/include/common/tbbr/tbbr_img_def.h
@@ -7,7 +7,7 @@
#ifndef TBBR_IMG_DEF_H
#define TBBR_IMG_DEF_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
/* Firmware Image Package */
#define FIP_IMAGE_ID U(0)