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/bl31/aarch64/bl31_entrypoint.S b/bl31/aarch64/bl31_entrypoint.S
index 7c116a2..c41773b 100644
--- a/bl31/aarch64/bl31_entrypoint.S
+++ b/bl31/aarch64/bl31_entrypoint.S
@@ -4,13 +4,14 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#include <arch.h>
-#include <bl_common.h>
-#include <el3_common_macros.S>
 #include <platform_def.h>
-#include <pmf_asm_macros.S>
-#include <runtime_instr.h>
-#include <xlat_mmu_helpers.h>
+
+#include <arch.h>
+#include <common/bl_common.h>
+#include <el3_common_macros.S>
+#include <lib/pmf/pmf_asm_macros.S>
+#include <lib/runtime_instr.h>
+#include <lib/xlat_tables/xlat_mmu_helpers.h>
 
 	.globl	bl31_entrypoint
 	.globl	bl31_warm_entrypoint
diff --git a/bl31/aarch64/crash_reporting.S b/bl31/aarch64/crash_reporting.S
index 0986a0a..b3f5979 100644
--- a/bl31/aarch64/crash_reporting.S
+++ b/bl31/aarch64/crash_reporting.S
@@ -3,13 +3,15 @@
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
+
+#include <plat_macros.S>
+#include <platform_def.h>
+
 #include <arch.h>
 #include <asm_macros.S>
 #include <context.h>
-#include <cpu_data.h>
-#include <plat_macros.S>
-#include <platform_def.h>
-#include <utils_def.h>
+#include <lib/el3_runtime/cpu_data.h>
+#include <lib/utils_def.h>
 
 	.globl	report_unhandled_exception
 	.globl	report_unhandled_interrupt
diff --git a/bl31/aarch64/ea_delegate.S b/bl31/aarch64/ea_delegate.S
index 9d7c5e8..0c8cfa8 100644
--- a/bl31/aarch64/ea_delegate.S
+++ b/bl31/aarch64/ea_delegate.S
@@ -8,9 +8,9 @@
 #include <assert_macros.S>
 #include <asm_macros.S>
 #include <assert_macros.S>
+#include <bl31/ea_handle.h>
 #include <context.h>
-#include <ea_handle.h>
-#include <ras_arch.h>
+#include <lib/extensions/ras_arch.h>
 
 
 	.globl	handle_lower_el_ea_esb
diff --git a/bl31/aarch64/runtime_exceptions.S b/bl31/aarch64/runtime_exceptions.S
index ab61e8c..e7abd50 100644
--- a/bl31/aarch64/runtime_exceptions.S
+++ b/bl31/aarch64/runtime_exceptions.S
@@ -4,15 +4,16 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+#include <platform_def.h>
+
 #include <arch.h>
 #include <asm_macros.S>
+#include <bl31/ea_handle.h>
+#include <bl31/interrupt_mgmt.h>
+#include <common/runtime_svc.h>
 #include <context.h>
-#include <cpu_data.h>
-#include <ea_handle.h>
-#include <interrupt_mgmt.h>
-#include <platform_def.h>
-#include <runtime_svc.h>
-#include <smccc.h>
+#include <lib/el3_runtime/cpu_data.h>
+#include <lib/smccc.h>
 
 	.globl	runtime_exceptions
 
diff --git a/bl31/bl31.ld.S b/bl31/bl31.ld.S
index fd53ed8..5925e0c 100644
--- a/bl31/bl31.ld.S
+++ b/bl31/bl31.ld.S
@@ -5,7 +5,8 @@
  */
 
 #include <platform_def.h>
-#include <xlat_tables_defs.h>
+
+#include <lib/xlat_tables/xlat_tables_defs.h>
 
 OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT)
 OUTPUT_ARCH(PLATFORM_LINKER_ARCH)
@@ -77,7 +78,7 @@
 
         /* Place pubsub sections for events */
         . = ALIGN(8);
-#include <pubsub_events.h>
+#include <lib/el3_runtime/pubsub_events.h>
 
         . = ALIGN(PAGE_SIZE);
         __RODATA_END__ = .;
@@ -124,7 +125,7 @@
 
         /* Place pubsub sections for events */
         . = ALIGN(8);
-#include <pubsub_events.h>
+#include <lib/el3_runtime/pubsub_events.h>
 
         *(.vectors)
         __RO_END_UNALIGNED__ = .;
diff --git a/bl31/bl31_context_mgmt.c b/bl31/bl31_context_mgmt.c
index f868372..d41979f 100644
--- a/bl31/bl31_context_mgmt.c
+++ b/bl31/bl31_context_mgmt.c
@@ -5,13 +5,13 @@
  */
 
 #include <assert.h>
-#include <bl31.h>
-#include <bl_common.h>
-#include <context.h>
-#include <context_mgmt.h>
-#include <cpu_data.h>
-#include <platform.h>
 
+#include <bl31/bl31.h>
+#include <common/bl_common.h>
+#include <context.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/el3_runtime/cpu_data.h>
+#include <plat/common/platform.h>
 
 /*******************************************************************************
  * This function returns a pointer to the most recent 'cpu_context' structure
diff --git a/bl31/bl31_main.c b/bl31/bl31_main.c
index 77b59ed..927cda2 100644
--- a/bl31/bl31_main.c
+++ b/bl31/bl31_main.c
@@ -4,21 +4,22 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+#include <assert.h>
+#include <string.h>
+
 #include <arch.h>
 #include <arch_helpers.h>
-#include <assert.h>
-#include <bl31.h>
-#include <bl_common.h>
-#include <console.h>
-#include <context_mgmt.h>
-#include <debug.h>
-#include <ehf.h>
-#include <platform.h>
-#include <pmf.h>
-#include <runtime_instr.h>
-#include <runtime_svc.h>
-#include <std_svc.h>
-#include <string.h>
+#include <bl31/bl31.h>
+#include <bl31/ehf.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <drivers/console.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/pmf/pmf.h>
+#include <lib/runtime_instr.h>
+#include <plat/common/platform.h>
+#include <services/std_svc.h>
 
 #if ENABLE_RUNTIME_INSTRUMENTATION
 PMF_REGISTER_SERVICE_SMC(rt_instr_svc, PMF_RT_INSTR_SVC_ID,
diff --git a/bl31/ehf.c b/bl31/ehf.c
index fa036cb..1bcebee 100644
--- a/bl31/ehf.c
+++ b/bl31/ehf.c
@@ -9,17 +9,18 @@
  */
 
 #include <assert.h>
-#include <context.h>
-#include <context_mgmt.h>
-#include <cpu_data.h>
-#include <debug.h>
-#include <ehf.h>
-#include <gic_common.h>
-#include <interrupt_mgmt.h>
-#include <platform.h>
-#include <pubsub_events.h>
 #include <stdbool.h>
 
+#include <bl31/ehf.h>
+#include <bl31/interrupt_mgmt.h>
+#include <context.h>
+#include <common/debug.h>
+#include <drivers/arm/gic_common.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/el3_runtime/cpu_data.h>
+#include <lib/el3_runtime/pubsub_events.h>
+#include <plat/common/platform.h>
+
 /* Output EHF logs as verbose */
 #define EHF_LOG(...)	VERBOSE("EHF: " __VA_ARGS__)
 
diff --git a/bl31/interrupt_mgmt.c b/bl31/interrupt_mgmt.c
index 0df50b6..e6efad3 100644
--- a/bl31/interrupt_mgmt.c
+++ b/bl31/interrupt_mgmt.c
@@ -5,11 +5,12 @@
  */
 
 #include <assert.h>
-#include <bl_common.h>
-#include <context_mgmt.h>
 #include <errno.h>
-#include <interrupt_mgmt.h>
-#include <platform.h>
+
+#include <common/bl_common.h>
+#include <bl31/interrupt_mgmt.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <plat/common/platform.h>
 
 /*******************************************************************************
  * Local structure and corresponding array to keep track of the state of the