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/lib/extensions/amu/aarch32/amu.c b/lib/extensions/amu/aarch32/amu.c
index 585d908..82d2e18 100644
--- a/lib/extensions/amu/aarch32/amu.c
+++ b/lib/extensions/amu/aarch32/amu.c
@@ -4,13 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <amu.h>
-#include <amu_private.h>
+#include <stdbool.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <platform.h>
-#include <pubsub_events.h>
-#include <stdbool.h>
+#include <lib/el3_runtime/pubsub_events.h>
+#include <lib/extensions/amu.h>
+#include <lib/extensions/amu_private.h>
+#include <plat/common/platform.h>
#define AMU_GROUP0_NR_COUNTERS 4
diff --git a/lib/extensions/amu/aarch64/amu.c b/lib/extensions/amu/aarch64/amu.c
index 1564e84..85f7007 100644
--- a/lib/extensions/amu/aarch64/amu.c
+++ b/lib/extensions/amu/aarch64/amu.c
@@ -4,14 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <amu.h>
-#include <amu_private.h>
+#include <assert.h>
+#include <stdbool.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <assert.h>
-#include <platform.h>
-#include <pubsub_events.h>
-#include <stdbool.h>
+#include <lib/el3_runtime/pubsub_events.h>
+#include <lib/extensions/amu.h>
+#include <lib/extensions/amu_private.h>
+#include <plat/common/platform.h>
#define AMU_GROUP0_NR_COUNTERS 4
diff --git a/lib/extensions/mpam/mpam.c b/lib/extensions/mpam/mpam.c
index d57bb47..0166707 100644
--- a/lib/extensions/mpam/mpam.c
+++ b/lib/extensions/mpam/mpam.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <stdbool.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <mpam.h>
-#include <stdbool.h>
+#include <lib/extensions/mpam.h>
bool mpam_supported(void)
{
diff --git a/lib/extensions/ras/ras_common.c b/lib/extensions/ras/ras_common.c
index f39e5f5..be8bece 100644
--- a/lib/extensions/ras/ras_common.c
+++ b/lib/extensions/ras/ras_common.c
@@ -4,15 +4,16 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <debug.h>
-#include <ea_handle.h>
-#include <ehf.h>
-#include <platform.h>
-#include <ras.h>
-#include <ras_arch.h>
#include <stdbool.h>
+#include <arch_helpers.h>
+#include <bl31/ea_handle.h>
+#include <bl31/ehf.h>
+#include <common/debug.h>
+#include <lib/extensions/ras.h>
+#include <lib/extensions/ras_arch.h>
+#include <plat/common/platform.h>
+
#ifndef PLAT_RAS_PRI
# error Platform must define RAS priority value
#endif
diff --git a/lib/extensions/ras/std_err_record.c b/lib/extensions/ras/std_err_record.c
index 9fdfd6b..c03fbbe 100644
--- a/lib/extensions/ras/std_err_record.c
+++ b/lib/extensions/ras/std_err_record.c
@@ -3,8 +3,9 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <ras_arch.h>
-#include <utils_def.h>
+
+#include <lib/extensions/ras_arch.h>
+#include <lib/utils_def.h>
/*
* Probe for error in memory-mapped registers containing error records
diff --git a/lib/extensions/spe/spe.c b/lib/extensions/spe/spe.c
index e5df015..78876c6 100644
--- a/lib/extensions/spe/spe.c
+++ b/lib/extensions/spe/spe.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <stdbool.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <pubsub.h>
-#include <spe.h>
-#include <stdbool.h>
+#include <lib/el3_runtime/pubsub.h>
+#include <lib/extensions/spe.h>
static inline void psb_csync(void)
{
diff --git a/lib/extensions/sve/sve.c b/lib/extensions/sve/sve.c
index e031bf6..fa4ac77 100644
--- a/lib/extensions/sve/sve.c
+++ b/lib/extensions/sve/sve.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <stdbool.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <pubsub.h>
-#include <stdbool.h>
-#include <sve.h>
+#include <lib/el3_runtime/pubsub.h>
+#include <lib/extensions/sve.h>
bool sve_supported(void)
{