plat/arm: Fix header dependencies
From now on, platform_def.h must include any header with definitions that
are platform-specific (like arm_def.h) and the included headers mustn't
include back platform_def.h, and shouldn't be used by other files. Only
platform_def.h should be included in other files. This will ensure that all
needed definitions are present, rather than needing to include all the
headers in all the definitions' headers just in case.
This also prevents problems like cyclic dependencies.
Change-Id: I9d3cf4d1de4b956fa035c79545222697acdaf5ca
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
diff --git a/plat/arm/board/juno/aarch32/juno_helpers.S b/plat/arm/board/juno/aarch32/juno_helpers.S
index 080a8dd..8f9561c 100644
--- a/plat/arm/board/juno/aarch32/juno_helpers.S
+++ b/plat/arm/board/juno/aarch32/juno_helpers.S
@@ -11,9 +11,7 @@
#include <cortex_a57.h>
#include <cortex_a72.h>
#include <cpu_macros.S>
-#include <v2m_def.h>
-#include "../juno_def.h"
-
+#include <platform_def.h>
.globl plat_reset_handler
.globl plat_arm_calc_core_pos
diff --git a/plat/arm/board/juno/aarch64/juno_helpers.S b/plat/arm/board/juno/aarch64/juno_helpers.S
index 373f2fc..c94fa3e 100644
--- a/plat/arm/board/juno/aarch64/juno_helpers.S
+++ b/plat/arm/board/juno/aarch64/juno_helpers.S
@@ -11,10 +11,7 @@
#include <cortex_a57.h>
#include <cortex_a72.h>
#include <cpu_macros.S>
-#include <css_def.h>
-#include <v2m_def.h>
-#include "../juno_def.h"
-
+#include <platform_def.h>
.globl plat_reset_handler
.globl plat_arm_calc_core_pos
diff --git a/plat/arm/board/juno/juno_bl1_setup.c b/plat/arm/board/juno/juno_bl1_setup.c
index e751ab6..383409d 100644
--- a/plat/arm/board/juno/juno_bl1_setup.c
+++ b/plat/arm/board/juno/juno_bl1_setup.c
@@ -11,10 +11,10 @@
#include <common/tbbr/tbbr_img_def.h>
#include <drivers/arm/sp805.h>
#include <plat/common/platform.h>
+#include <platform_def.h>
#include <plat_arm.h>
#include <sds.h>
-#include <v2m_def.h>
void juno_reset_to_aarch32_state(void);
diff --git a/plat/arm/board/juno/juno_common.c b/plat/arm/board/juno/juno_common.c
index 2e6b011..e134108 100644
--- a/plat/arm/board/juno/juno_common.c
+++ b/plat/arm/board/juno/juno_common.c
@@ -3,7 +3,8 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arm_def.h>
+
+#include <platform_def.h>
#include <plat_arm.h>
/*
diff --git a/plat/arm/board/juno/juno_err.c b/plat/arm/board/juno/juno_err.c
index 69daa1a..f80ff24 100644
--- a/plat/arm/board/juno/juno_err.c
+++ b/plat/arm/board/juno/juno_err.c
@@ -8,8 +8,7 @@
#include <arch_helpers.h>
#include <plat/common/platform.h>
-
-#include <v2m_def.h>
+#include <platform_def.h>
/*
* Juno error handler
diff --git a/plat/arm/board/juno/juno_security.c b/plat/arm/board/juno/juno_security.c
index b0df837..51c8669 100644
--- a/plat/arm/board/juno/juno_security.c
+++ b/plat/arm/board/juno/juno_security.c
@@ -7,10 +7,10 @@
#include <common/debug.h>
#include <drivers/arm/nic_400.h>
#include <lib/mmio.h>
+#include <platform_def.h>
#include <plat_arm.h>
#include <soc_css.h>
-#include "juno_def.h"
#include "juno_tzmp1_def.h"
#ifdef JUNO_TZMP1
diff --git a/plat/arm/board/juno/juno_stack_protector.c b/plat/arm/board/juno/juno_stack_protector.c
index ff05b5d..236eb5b 100644
--- a/plat/arm/board/juno/juno_stack_protector.c
+++ b/plat/arm/board/juno/juno_stack_protector.c
@@ -7,9 +7,9 @@
#include <arch_helpers.h>
#include <common/debug.h>
#include <lib/utils.h>
+#include <platform_def.h>
#include "juno_decl.h"
-#include "juno_def.h"
u_register_t plat_get_stack_protector_canary(void)
{
diff --git a/plat/arm/board/juno/juno_topology.c b/plat/arm/board/juno/juno_topology.c
index 51b99ac..e70cbdc 100644
--- a/plat/arm/board/juno/juno_topology.c
+++ b/plat/arm/board/juno/juno_topology.c
@@ -5,11 +5,10 @@
*/
#include <plat/common/platform.h>
+#include <platform_def.h>
-#include <arm_def.h>
#include <css_pm.h>
#include <plat_arm.h>
-#include "juno_def.h"
#include "../../css/drivers/scmi/scmi.h"
#include "../../css/drivers/mhu/css_mhu_doorbell.h"
diff --git a/plat/arm/board/juno/juno_trng.c b/plat/arm/board/juno/juno_trng.c
index 505fb02..7869d3e 100644
--- a/plat/arm/board/juno/juno_trng.c
+++ b/plat/arm/board/juno/juno_trng.c
@@ -9,9 +9,9 @@
#include <lib/mmio.h>
#include <lib/utils_def.h>
+#include <platform_def.h>
#include "juno_decl.h"
-#include "juno_def.h"
#define NSAMPLE_CLOCKS 1 /* min 1 cycle, max 231 cycles */
#define NRETRIES 5
diff --git a/plat/arm/board/juno/juno_tzmp1_def.h b/plat/arm/board/juno/juno_tzmp1_def.h
index 5d0978c..4186d02 100644
--- a/plat/arm/board/juno/juno_tzmp1_def.h
+++ b/plat/arm/board/juno/juno_tzmp1_def.h
@@ -7,8 +7,6 @@
#ifndef JUNO_TZMP1_DEF_H
#define JUNO_TZMP1_DEF_H
-#include <plat_arm.h>
-
/*
* Public memory regions for both protected and non-protected mode
*