Merge pull request #1773 from grandpaul/rpi3-gpio-driver

Rpi3 gpio driver
diff --git a/plat/arm/css/drivers/mhu/css_mhu.c b/drivers/arm/css/mhu/css_mhu.c
similarity index 96%
rename from plat/arm/css/drivers/mhu/css_mhu.c
rename to drivers/arm/css/mhu/css_mhu.c
index 981df9c..b7faf7e 100644
--- a/plat/arm/css/drivers/mhu/css_mhu.c
+++ b/drivers/arm/css/mhu/css_mhu.c
@@ -9,12 +9,10 @@
 #include <platform_def.h>
 
 #include <arch_helpers.h>
+#include <drivers/arm/css/css_mhu.h>
 #include <lib/bakery_lock.h>
 #include <lib/mmio.h>
-
-#include <plat_arm.h>
-
-#include "css_mhu.h"
+#include <plat/arm/common/plat_arm.h>
 
 /* SCP MHU secure channel registers */
 #define SCP_INTR_S_STAT		0x200
diff --git a/plat/arm/css/drivers/mhu/css_mhu_doorbell.c b/drivers/arm/css/mhu/css_mhu_doorbell.c
similarity index 90%
rename from plat/arm/css/drivers/mhu/css_mhu_doorbell.c
rename to drivers/arm/css/mhu/css_mhu_doorbell.c
index 964428b..8858742 100644
--- a/plat/arm/css/drivers/mhu/css_mhu_doorbell.c
+++ b/drivers/arm/css/mhu/css_mhu_doorbell.c
@@ -7,9 +7,8 @@
 #include <platform_def.h>
 
 #include <arch_helpers.h>
-
-#include "css_mhu_doorbell.h"
-#include "../scmi/scmi.h"
+#include <drivers/arm/css/css_mhu_doorbell.h>
+#include <drivers/arm/css/scmi.h>
 
 void mhu_ring_doorbell(struct scmi_channel_plat_info *plat_info)
 {
diff --git a/plat/arm/css/drivers/scmi/scmi_ap_core_proto.c b/drivers/arm/css/scmi/scmi_ap_core_proto.c
similarity index 97%
rename from plat/arm/css/drivers/scmi/scmi_ap_core_proto.c
rename to drivers/arm/css/scmi/scmi_ap_core_proto.c
index e495dcc..2caccc2 100644
--- a/plat/arm/css/drivers/scmi/scmi_ap_core_proto.c
+++ b/drivers/arm/css/scmi/scmi_ap_core_proto.c
@@ -8,8 +8,8 @@
 
 #include <arch_helpers.h>
 #include <common/debug.h>
+#include <drivers/arm/css/scmi.h>
 
-#include "scmi.h"
 #include "scmi_private.h"
 
 /*
diff --git a/plat/arm/css/drivers/scmi/scmi_common.c b/drivers/arm/css/scmi/scmi_common.c
similarity index 98%
rename from plat/arm/css/drivers/scmi/scmi_common.c
rename to drivers/arm/css/scmi/scmi_common.c
index 1b4ecb2..e2c353d 100644
--- a/plat/arm/css/drivers/scmi/scmi_common.c
+++ b/drivers/arm/css/scmi/scmi_common.c
@@ -8,8 +8,8 @@
 
 #include <arch_helpers.h>
 #include <common/debug.h>
+#include <drivers/arm/css/scmi.h>
 
-#include "scmi.h"
 #include "scmi_private.h"
 
 #if HW_ASSISTED_COHERENCY
diff --git a/plat/arm/css/drivers/scmi/scmi_private.h b/drivers/arm/css/scmi/scmi_private.h
similarity index 100%
rename from plat/arm/css/drivers/scmi/scmi_private.h
rename to drivers/arm/css/scmi/scmi_private.h
diff --git a/plat/arm/css/drivers/scmi/scmi_pwr_dmn_proto.c b/drivers/arm/css/scmi/scmi_pwr_dmn_proto.c
similarity index 97%
rename from plat/arm/css/drivers/scmi/scmi_pwr_dmn_proto.c
rename to drivers/arm/css/scmi/scmi_pwr_dmn_proto.c
index f315621..70165de 100644
--- a/plat/arm/css/drivers/scmi/scmi_pwr_dmn_proto.c
+++ b/drivers/arm/css/scmi/scmi_pwr_dmn_proto.c
@@ -8,8 +8,8 @@
 
 #include <arch_helpers.h>
 #include <common/debug.h>
+#include <drivers/arm/css/scmi.h>
 
-#include "scmi.h"
 #include "scmi_private.h"
 
 /*
diff --git a/plat/arm/css/drivers/scmi/scmi_sys_pwr_proto.c b/drivers/arm/css/scmi/scmi_sys_pwr_proto.c
similarity index 97%
rename from plat/arm/css/drivers/scmi/scmi_sys_pwr_proto.c
rename to drivers/arm/css/scmi/scmi_sys_pwr_proto.c
index 03c3c06..a27c4a5 100644
--- a/plat/arm/css/drivers/scmi/scmi_sys_pwr_proto.c
+++ b/drivers/arm/css/scmi/scmi_sys_pwr_proto.c
@@ -8,8 +8,8 @@
 
 #include <arch_helpers.h>
 #include <common/debug.h>
+#include <drivers/arm/css/scmi.h>
 
-#include "scmi.h"
 #include "scmi_private.h"
 
 /*
diff --git a/plat/arm/css/drivers/scp/css_bom_bootloader.c b/drivers/arm/css/scp/css_bom_bootloader.c
similarity index 97%
rename from plat/arm/css/drivers/scp/css_bom_bootloader.c
rename to drivers/arm/css/scp/css_bom_bootloader.c
index ca40c30..1fc1270 100644
--- a/plat/arm/css/drivers/scp/css_bom_bootloader.c
+++ b/drivers/arm/css/scp/css_bom_bootloader.c
@@ -9,13 +9,12 @@
 
 #include <arch_helpers.h>
 #include <common/debug.h>
+#include <drivers/arm/css/css_mhu.h>
+#include <drivers/arm/css/css_scp.h>
+#include <drivers/arm/css/css_scpi.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
 
-#include "../mhu/css_mhu.h"
-#include "../scpi/css_scpi.h"
-#include "css_scp.h"
-
 /* ID of the MHU slot used for the BOM protocol */
 #define BOM_MHU_SLOT_ID		0
 
diff --git a/plat/arm/css/drivers/scp/css_pm_scmi.c b/drivers/arm/css/scp/css_pm_scmi.c
similarity index 98%
rename from plat/arm/css/drivers/scp/css_pm_scmi.c
rename to drivers/arm/css/scp/css_pm_scmi.c
index fa4dd8a..1966c44 100644
--- a/plat/arm/css/drivers/scp/css_pm_scmi.c
+++ b/drivers/arm/css/scp/css_pm_scmi.c
@@ -9,15 +9,13 @@
 
 #include <arch_helpers.h>
 #include <common/debug.h>
+#include <drivers/arm/css/css_scp.h>
+#include <drivers/arm/css/scmi.h>
+#include <plat/arm/common/plat_arm.h>
+#include <plat/arm/css/common/css_pm.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
 
-#include <css_pm.h>
-#include <plat_arm.h>
-
-#include "../scmi/scmi.h"
-#include "css_scp.h"
-
 /*
  * This file implements the SCP helper functions using SCMI protocol.
  */
diff --git a/plat/arm/css/drivers/scp/css_pm_scpi.c b/drivers/arm/css/scp/css_pm_scpi.c
similarity index 96%
rename from plat/arm/css/drivers/scp/css_pm_scpi.c
rename to drivers/arm/css/scp/css_pm_scpi.c
index f53ac30..b4019ce 100644
--- a/plat/arm/css/drivers/scp/css_pm_scpi.c
+++ b/drivers/arm/css/scp/css_pm_scpi.c
@@ -8,12 +8,10 @@
 
 #include <arch_helpers.h>
 #include <common/debug.h>
-
-#include <css_pm.h>
-#include <plat_arm.h>
-
-#include "../scpi/css_scpi.h"
-#include "css_scp.h"
+#include <drivers/arm/css/css_scp.h>
+#include <drivers/arm/css/css_scpi.h>
+#include <plat/arm/common/plat_arm.h>
+#include <plat/arm/css/common/css_pm.h>
 
 /*
  * This file implements the SCP power management functions using SCPI protocol.
diff --git a/plat/arm/css/drivers/scp/css_sds.c b/drivers/arm/css/scp/css_sds.c
similarity index 96%
rename from plat/arm/css/drivers/scp/css_sds.c
rename to drivers/arm/css/scp/css_sds.c
index e3f6102..e42ee10 100644
--- a/plat/arm/css/drivers/scp/css_sds.c
+++ b/drivers/arm/css/scp/css_sds.c
@@ -9,13 +9,12 @@
 
 #include <arch_helpers.h>
 #include <common/debug.h>
+#include <drivers/arm/css/css_scp.h>
+#include <drivers/arm/css/sds.h>
 #include <drivers/delay_timer.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
 
-#include "css_scp.h"
-#include "../sds/sds.h"
-
 int css_scp_boot_image_xfer(void *image, unsigned int image_size)
 {
 	int ret;
diff --git a/plat/arm/css/drivers/scpi/css_scpi.c b/drivers/arm/css/scpi/css_scpi.c
similarity index 98%
rename from plat/arm/css/drivers/scpi/css_scpi.c
rename to drivers/arm/css/scpi/css_scpi.c
index d64bfa2..4b73265 100644
--- a/plat/arm/css/drivers/scpi/css_scpi.c
+++ b/drivers/arm/css/scpi/css_scpi.c
@@ -9,13 +9,12 @@
 
 #include <arch_helpers.h>
 #include <common/debug.h>
+#include <drivers/arm/css/css_mhu.h>
+#include <drivers/arm/css/css_scpi.h>
 #include <lib/utils.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
 
-#include "../mhu/css_mhu.h"
-#include "css_scpi.h"
-
 #define SCPI_SHARED_MEM_SCP_TO_AP	PLAT_CSS_SCP_COM_SHARED_MEM_BASE
 #define SCPI_SHARED_MEM_AP_TO_SCP	(PLAT_CSS_SCP_COM_SHARED_MEM_BASE \
 								 + 0x100)
diff --git a/plat/arm/css/drivers/sds/aarch32/sds_helpers.S b/drivers/arm/css/sds/aarch32/sds_helpers.S
similarity index 97%
rename from plat/arm/css/drivers/sds/aarch32/sds_helpers.S
rename to drivers/arm/css/sds/aarch32/sds_helpers.S
index f68cb35..13ff0e1 100644
--- a/plat/arm/css/drivers/sds/aarch32/sds_helpers.S
+++ b/drivers/arm/css/sds/aarch32/sds_helpers.S
@@ -6,8 +6,9 @@
 
 #include <arch.h>
 #include <asm_macros.S>
+#include <drivers/arm/css/sds.h>
 #include <platform_def.h>
-#include "../sds.h"
+
 #include "../sds_private.h"
 
 	.globl	sds_get_primary_cpu_id
diff --git a/plat/arm/css/drivers/sds/aarch64/sds_helpers.S b/drivers/arm/css/sds/aarch64/sds_helpers.S
similarity index 97%
rename from plat/arm/css/drivers/sds/aarch64/sds_helpers.S
rename to drivers/arm/css/sds/aarch64/sds_helpers.S
index 3b9c562..3256c2b 100644
--- a/plat/arm/css/drivers/sds/aarch64/sds_helpers.S
+++ b/drivers/arm/css/sds/aarch64/sds_helpers.S
@@ -6,8 +6,9 @@
 
 #include <arch.h>
 #include <asm_macros.S>
+#include <drivers/arm/css/sds.h>
 #include <platform_def.h>
-#include "../sds.h"
+
 #include "../sds_private.h"
 
 	.globl	sds_get_primary_cpu_id
diff --git a/plat/arm/css/drivers/sds/sds.c b/drivers/arm/css/sds/sds.c
similarity index 99%
rename from plat/arm/css/drivers/sds/sds.c
rename to drivers/arm/css/sds/sds.c
index eb2f48e..1fb196c 100644
--- a/plat/arm/css/drivers/sds/sds.c
+++ b/drivers/arm/css/sds/sds.c
@@ -10,9 +10,9 @@
 
 #include <arch_helpers.h>
 #include <common/debug.h>
+#include <drivers/arm/css/sds.h>
 #include <platform_def.h>
 
-#include "sds.h"
 #include "sds_private.h"
 
 /*
diff --git a/plat/arm/css/drivers/sds/sds_private.h b/drivers/arm/css/sds/sds_private.h
similarity index 100%
rename from plat/arm/css/drivers/sds/sds_private.h
rename to drivers/arm/css/sds/sds_private.h
diff --git a/plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c b/drivers/arm/fvp/fvp_pwrc.c
similarity index 95%
rename from plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c
rename to drivers/arm/fvp/fvp_pwrc.c
index cae9827..75a2b66 100644
--- a/plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c
+++ b/drivers/arm/fvp/fvp_pwrc.c
@@ -4,14 +4,12 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+#include <drivers/arm/fvp/fvp_pwrc.h>
 #include <lib/bakery_lock.h>
 #include <lib/mmio.h>
+#include <plat/arm/common/plat_arm.h>
 #include <platform_def.h>
 
-#include <plat_arm.h>
-#include "../../fvp_private.h"
-#include "fvp_pwrc.h"
-
 /*
  * TODO: Someday there will be a generic power controller api. At the moment
  * each platform has its own pwrc so just exporting functions is fine.
diff --git a/drivers/console/multi_console.c b/drivers/console/multi_console.c
index e94de35..a135959 100644
--- a/drivers/console/multi_console.c
+++ b/drivers/console/multi_console.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -76,7 +76,7 @@
 	console_t *console;
 
 	for (console = console_list; console != NULL; console = console->next)
-		if (console->flags & console_state) {
+		if ((console->flags & console_state) && console->putc) {
 			int ret = console->putc(c, console);
 			if ((err == ERROR_NO_VALID_CONSOLE) || (ret < err))
 				err = ret;
@@ -93,7 +93,7 @@
 	do {	/* Keep polling while at least one console works correctly. */
 		for (console = console_list; console != NULL;
 		     console = console->next)
-			if (console->flags & console_state) {
+			if ((console->flags & console_state) && console->getc) {
 				int ret = console->getc(console);
 				if (ret >= 0)
 					return ret;
@@ -111,7 +111,7 @@
 	console_t *console;
 
 	for (console = console_list; console != NULL; console = console->next)
-		if (console->flags & console_state) {
+		if ((console->flags & console_state) && console->flush) {
 			int ret = console->flush(console);
 			if ((err == ERROR_NO_VALID_CONSOLE) || (ret < err))
 				err = ret;
diff --git a/plat/arm/css/drivers/mhu/css_mhu.h b/include/drivers/arm/css/css_mhu.h
similarity index 100%
rename from plat/arm/css/drivers/mhu/css_mhu.h
rename to include/drivers/arm/css/css_mhu.h
diff --git a/plat/arm/css/drivers/mhu/css_mhu_doorbell.h b/include/drivers/arm/css/css_mhu_doorbell.h
similarity index 100%
rename from plat/arm/css/drivers/mhu/css_mhu_doorbell.h
rename to include/drivers/arm/css/css_mhu_doorbell.h
diff --git a/plat/arm/css/drivers/scp/css_scp.h b/include/drivers/arm/css/css_scp.h
similarity index 100%
rename from plat/arm/css/drivers/scp/css_scp.h
rename to include/drivers/arm/css/css_scp.h
diff --git a/plat/arm/css/drivers/scpi/css_scpi.h b/include/drivers/arm/css/css_scpi.h
similarity index 100%
rename from plat/arm/css/drivers/scpi/css_scpi.h
rename to include/drivers/arm/css/css_scpi.h
diff --git a/plat/arm/css/drivers/scmi/scmi.h b/include/drivers/arm/css/scmi.h
similarity index 100%
rename from plat/arm/css/drivers/scmi/scmi.h
rename to include/drivers/arm/css/scmi.h
diff --git a/plat/arm/css/drivers/sds/sds.h b/include/drivers/arm/css/sds.h
similarity index 100%
rename from plat/arm/css/drivers/sds/sds.h
rename to include/drivers/arm/css/sds.h
diff --git a/plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.h b/include/drivers/arm/fvp/fvp_pwrc.h
similarity index 98%
rename from plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.h
rename to include/drivers/arm/fvp/fvp_pwrc.h
index 324f3e2..ca173f3 100644
--- a/plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.h
+++ b/include/drivers/arm/fvp/fvp_pwrc.h
@@ -37,6 +37,8 @@
 
 #ifndef __ASSEMBLY__
 
+#include <stdint.h>
+
 /*******************************************************************************
  * Function & variable prototypes
  ******************************************************************************/
diff --git a/include/plat/arm/board/common/board_css_def.h b/include/plat/arm/board/common/board_css_def.h
index 6cca389..a77ea96 100644
--- a/include/plat/arm/board/common/board_css_def.h
+++ b/include/plat/arm/board/common/board_css_def.h
@@ -8,11 +8,10 @@
 #define BOARD_CSS_DEF_H
 
 #include <lib/utils_def.h>
+#include <plat/arm/board/common/v2m_def.h>
+#include <plat/arm/soc/common/soc_css_def.h>
 #include <plat/common/common_def.h>
 
-#include <soc_css_def.h>
-#include <v2m_def.h>
-
 /*
  * Definitions common to all ARM CSS-based development platforms
  */
diff --git a/include/plat/arm/board/common/v2m_def.h b/include/plat/arm/board/common/v2m_def.h
index c5de407..6a6979c 100644
--- a/include/plat/arm/board/common/v2m_def.h
+++ b/include/plat/arm/board/common/v2m_def.h
@@ -6,7 +6,7 @@
 #ifndef V2M_DEF_H
 #define V2M_DEF_H
 
-#include <lib/xlat_tables/xlat_tables_compat.h>
+#include <lib/utils_def.h>
 
 /* V2M motherboard system registers & offsets */
 #define V2M_SYSREGS_BASE		UL(0x1c010000)
diff --git a/lib/utils/mem_region.c b/lib/utils/mem_region.c
index 662f6a0..08bccf6 100644
--- a/lib/utils/mem_region.c
+++ b/lib/utils/mem_region.c
@@ -6,7 +6,9 @@
 
 #include <assert.h>
 
+#include <common/debug.h>
 #include <lib/utils.h>
+#include <lib/xlat_tables/xlat_tables_compat.h>
 
 /*
  * All the regions defined in mem_region_t must have the following properties
diff --git a/plat/arm/board/common/board_common.mk b/plat/arm/board/common/board_common.mk
index 487aad7..b98dfd4 100644
--- a/plat/arm/board/common/board_common.mk
+++ b/plat/arm/board/common/board_common.mk
@@ -4,8 +4,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 #
 
-PLAT_INCLUDES		+=	-Iinclude/plat/arm/board/common/
-
 PLAT_BL_COMMON_SOURCES	+=	drivers/arm/pl011/${ARCH}/pl011_console.S	\
 				plat/arm/board/common/${ARCH}/board_arm_helpers.S
 
diff --git a/plat/arm/board/fvp/aarch32/fvp_helpers.S b/plat/arm/board/fvp/aarch32/fvp_helpers.S
index f689557..9985c1d 100644
--- a/plat/arm/board/fvp/aarch32/fvp_helpers.S
+++ b/plat/arm/board/fvp/aarch32/fvp_helpers.S
@@ -6,10 +6,9 @@
 
 #include <arch.h>
 #include <asm_macros.S>
+#include <drivers/arm/fvp/fvp_pwrc.h>
 #include <platform_def.h>
 
-#include "../drivers/pwrc/fvp_pwrc.h"
-
 	.globl	plat_secondary_cold_boot_setup
 	.globl	plat_get_my_entrypoint
 	.globl	plat_is_my_cpu_primary
diff --git a/plat/arm/board/fvp/aarch64/fvp_helpers.S b/plat/arm/board/fvp/aarch64/fvp_helpers.S
index 02a3c7c..09f19f6 100644
--- a/plat/arm/board/fvp/aarch64/fvp_helpers.S
+++ b/plat/arm/board/fvp/aarch64/fvp_helpers.S
@@ -8,10 +8,9 @@
 #include <asm_macros.S>
 #include <drivers/arm/gicv2.h>
 #include <drivers/arm/gicv3.h>
+#include <drivers/arm/fvp/fvp_pwrc.h>
 #include <platform_def.h>
 
-#include "../drivers/pwrc/fvp_pwrc.h"
-
 	.globl	plat_secondary_cold_boot_setup
 	.globl	plat_get_my_entrypoint
 	.globl	plat_is_my_cpu_primary
diff --git a/plat/arm/board/fvp/fvp_bl1_setup.c b/plat/arm/board/fvp/fvp_bl1_setup.c
index d6e82f5..75090e8 100644
--- a/plat/arm/board/fvp/fvp_bl1_setup.c
+++ b/plat/arm/board/fvp/fvp_bl1_setup.c
@@ -5,10 +5,9 @@
  */
 
 #include <common/tbbr/tbbr_img_def.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-
 #include "fvp_private.h"
 
 /*******************************************************************************
diff --git a/plat/arm/board/fvp/fvp_bl2_el3_setup.c b/plat/arm/board/fvp/fvp_bl2_el3_setup.c
index 69f2f7a..7def56a 100644
--- a/plat/arm/board/fvp/fvp_bl2_el3_setup.c
+++ b/plat/arm/board/fvp/fvp_bl2_el3_setup.c
@@ -4,7 +4,8 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
+
 #include "fvp_private.h"
 
 void bl2_el3_early_platform_setup(u_register_t arg0 __unused,
diff --git a/plat/arm/board/fvp/fvp_bl2_setup.c b/plat/arm/board/fvp/fvp_bl2_setup.c
index 7aa620b..d280949 100644
--- a/plat/arm/board/fvp/fvp_bl2_setup.c
+++ b/plat/arm/board/fvp/fvp_bl2_setup.c
@@ -7,10 +7,10 @@
 #include <drivers/arm/sp804_delay_timer.h>
 #include <drivers/generic_delay_timer.h>
 #include <lib/mmio.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
 
-#include <plat_arm.h>
 #include "fvp_private.h"
 
 void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3)
diff --git a/plat/arm/board/fvp/fvp_bl2u_setup.c b/plat/arm/board/fvp/fvp_bl2u_setup.c
index 6367be6..a8db055 100644
--- a/plat/arm/board/fvp/fvp_bl2u_setup.c
+++ b/plat/arm/board/fvp/fvp_bl2u_setup.c
@@ -4,10 +4,10 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
 
-#include <plat_arm.h>
 #include "fvp_private.h"
 
 void bl2u_early_platform_setup(struct meminfo *mem_layout, void *plat_info)
diff --git a/plat/arm/board/fvp/fvp_bl31_setup.c b/plat/arm/board/fvp/fvp_bl31_setup.c
index 5f2121c..7f28b20 100644
--- a/plat/arm/board/fvp/fvp_bl31_setup.c
+++ b/plat/arm/board/fvp/fvp_bl31_setup.c
@@ -5,10 +5,10 @@
  */
 
 #include <drivers/arm/smmu_v3.h>
+#include <plat/arm/common/arm_config.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <arm_config.h>
-#include <plat_arm.h>
 #include "fvp_private.h"
 
 void __init bl31_early_platform_setup2(u_register_t arg0,
diff --git a/plat/arm/board/fvp/fvp_common.c b/plat/arm/board/fvp/fvp_common.c
index fdf82f4..b885b47 100644
--- a/plat/arm/board/fvp/fvp_common.c
+++ b/plat/arm/board/fvp/fvp_common.c
@@ -12,13 +12,12 @@
 #include <drivers/arm/gicv2.h>
 #include <lib/mmio.h>
 #include <lib/xlat_tables/xlat_tables_compat.h>
+#include <plat/arm/common/arm_config.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
 #include <services/secure_partition.h>
 
-#include <arm_config.h>
-#include <plat_arm.h>
-
 #include "fvp_private.h"
 
 /* Defines for GIC Driver build time selection */
diff --git a/plat/arm/board/fvp/fvp_io_storage.c b/plat/arm/board/fvp/fvp_io_storage.c
index e186b30..9c4c1d5 100644
--- a/plat/arm/board/fvp/fvp_io_storage.c
+++ b/plat/arm/board/fvp/fvp_io_storage.c
@@ -11,10 +11,9 @@
 #include <drivers/io/io_semihosting.h>
 #include <drivers/io/io_storage.h>
 #include <lib/semihosting.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/common_def.h>
 
-#include <plat_arm.h>
-
 /* Semihosting filenames */
 #define BL2_IMAGE_NAME			"bl2.bin"
 #define BL31_IMAGE_NAME			"bl31.bin"
diff --git a/plat/arm/board/fvp/fvp_pm.c b/plat/arm/board/fvp/fvp_pm.c
index 8ba8281..ecf0b01 100644
--- a/plat/arm/board/fvp/fvp_pm.c
+++ b/plat/arm/board/fvp/fvp_pm.c
@@ -10,17 +10,15 @@
 #include <arch_helpers.h>
 #include <common/debug.h>
 #include <drivers/arm/gicv3.h>
+#include <drivers/arm/fvp/fvp_pwrc.h>
 #include <lib/extensions/spe.h>
 #include <lib/mmio.h>
 #include <lib/psci/psci.h>
+#include <plat/arm/common/arm_config.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
 
-#include <arm_config.h>
-#include <plat_arm.h>
-
-#include "../../../../drivers/arm/gic/v3/gicv3_private.h"
-#include "drivers/pwrc/fvp_pwrc.h"
 #include "fvp_private.h"
 
 
diff --git a/plat/arm/board/fvp/fvp_private.h b/plat/arm/board/fvp/fvp_private.h
index e7dea99..3d96537 100644
--- a/plat/arm/board/fvp/fvp_private.h
+++ b/plat/arm/board/fvp/fvp_private.h
@@ -7,7 +7,7 @@
 #ifndef FVP_PRIVATE_H
 #define FVP_PRIVATE_H
 
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
 
 /*******************************************************************************
  * Function and variable prototypes
diff --git a/plat/arm/board/fvp/fvp_security.c b/plat/arm/board/fvp/fvp_security.c
index 028522c..80ec217 100644
--- a/plat/arm/board/fvp/fvp_security.c
+++ b/plat/arm/board/fvp/fvp_security.c
@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#include <arm_config.h>
-#include <plat_arm.h>
+#include <plat/arm/common/arm_config.h>
+#include <plat/arm/common/plat_arm.h>
 
 /*
  * We assume that all security programming is done by the primary core.
diff --git a/plat/arm/board/fvp/fvp_topology.c b/plat/arm/board/fvp/fvp_topology.c
index 3384a2f..9823fb3 100644
--- a/plat/arm/board/fvp/fvp_topology.c
+++ b/plat/arm/board/fvp/fvp_topology.c
@@ -7,13 +7,12 @@
 #include <platform_def.h>
 
 #include <arch.h>
+#include <drivers/arm/fvp/fvp_pwrc.h>
 #include <lib/cassert.h>
+#include <plat/arm/common/arm_config.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-#include <arm_config.h>
-#include "drivers/pwrc/fvp_pwrc.h"
-
 /* The FVP power domain tree descriptor */
 static unsigned char fvp_power_domain_tree_desc[FVP_CLUSTER_COUNT + 2];
 
diff --git a/plat/arm/board/fvp/include/plat.ld.S b/plat/arm/board/fvp/include/plat.ld.S
index ad2d46c..f024f55 100644
--- a/plat/arm/board/fvp/include/plat.ld.S
+++ b/plat/arm/board/fvp/include/plat.ld.S
@@ -6,7 +6,7 @@
 #ifndef PLAT_LD_S
 #define PLAT_LD_S
 
-#include <arm_tzc_dram.ld.S>
-#include <arm_reclaim_init.ld.S>
+#include <plat/arm/common/arm_tzc_dram.ld.S>
+#include <plat/arm/common/arm_reclaim_init.ld.S>
 
 #endif /* PLAT_LD_S */
diff --git a/plat/arm/board/fvp/include/platform_def.h b/plat/arm/board/fvp/include/platform_def.h
index 8c0daf1..fcf363d 100644
--- a/plat/arm/board/fvp/include/platform_def.h
+++ b/plat/arm/board/fvp/include/platform_def.h
@@ -7,25 +7,13 @@
 #ifndef PLATFORM_DEF_H
 #define PLATFORM_DEF_H
 
-/* Enable the dynamic translation tables library. */
-#ifdef AARCH32
-# if defined(IMAGE_BL32) && RESET_TO_SP_MIN
-#  define PLAT_XLAT_TABLES_DYNAMIC     1
-# endif
-#else
-# if defined(IMAGE_BL31) && (RESET_TO_BL31 || (ENABLE_SPM && !SPM_MM))
-#  define PLAT_XLAT_TABLES_DYNAMIC     1
-# endif
-#endif /* AARCH32 */
-
 #include <drivers/arm/tzc400.h>
 #include <lib/utils_def.h>
+#include <plat/arm/board/common/v2m_def.h>
+#include <plat/arm/common/arm_def.h>
+#include <plat/arm/common/arm_spm_def.h>
 #include <plat/common/common_def.h>
 
-#include <arm_def.h>
-#include <arm_spm_def.h>
-#include <v2m_def.h>
-
 #include "../fvp_def.h"
 
 /* Required platform porting definitions */
diff --git a/plat/arm/board/fvp/platform.mk b/plat/arm/board/fvp/platform.mk
index 3b60daa..f79ac46 100644
--- a/plat/arm/board/fvp/platform.mk
+++ b/plat/arm/board/fvp/platform.mk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -146,14 +146,14 @@
 BL2U_SOURCES		+=	plat/arm/board/fvp/fvp_bl2u_setup.c		\
 				${FVP_SECURITY_SOURCES}
 
-BL31_SOURCES		+=	drivers/arm/smmu/smmu_v3.c			\
+BL31_SOURCES		+=	drivers/arm/fvp/fvp_pwrc.c			\
+				drivers/arm/smmu/smmu_v3.c			\
 				drivers/cfi/v2m/v2m_flash.c			\
 				lib/utils/mem_region.c				\
 				plat/arm/board/fvp/fvp_bl31_setup.c		\
 				plat/arm/board/fvp/fvp_pm.c			\
 				plat/arm/board/fvp/fvp_topology.c		\
 				plat/arm/board/fvp/aarch64/fvp_helpers.S	\
-				plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c	\
 				plat/arm/common/arm_nor_psci_mem_protect.c	\
 				${FVP_CPU_LIBS}					\
 				${FVP_GIC_SOURCES}				\
@@ -231,6 +231,22 @@
     NEED_BL32 := yes
 endif
 
+# Enable the dynamic translation tables library.
+ifeq (${ARCH},aarch32)
+    ifeq (${RESET_TO_SP_MIN},1)
+        BL32_CFLAGS	+=	-DPLAT_XLAT_TABLES_DYNAMIC=1
+    endif
+else
+    ifeq (${RESET_TO_BL31},1)
+        BL31_CFLAGS	+=	-DPLAT_XLAT_TABLES_DYNAMIC=1
+    endif
+    ifeq (${ENABLE_SPM},1)
+        ifeq (${SPM_MM},0)
+            BL31_CFLAGS	+=	-DPLAT_XLAT_TABLES_DYNAMIC=1
+        endif
+    endif
+endif
+
 # Add support for platform supplied linker script for BL31 build
 $(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT))
 
diff --git a/plat/arm/board/fvp/sp_min/fvp_sp_min_setup.c b/plat/arm/board/fvp/sp_min/fvp_sp_min_setup.c
index 7c89c27..88c91e6 100644
--- a/plat/arm/board/fvp/sp_min/fvp_sp_min_setup.c
+++ b/plat/arm/board/fvp/sp_min/fvp_sp_min_setup.c
@@ -4,7 +4,8 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
+
 #include "../fvp_private.h"
 
 void plat_arm_sp_min_early_platform_setup(u_register_t arg0, u_register_t arg1,
diff --git a/plat/arm/board/fvp/sp_min/sp_min-fvp.mk b/plat/arm/board/fvp/sp_min/sp_min-fvp.mk
index 8b17c9b..0250a5f 100644
--- a/plat/arm/board/fvp/sp_min/sp_min-fvp.mk
+++ b/plat/arm/board/fvp/sp_min/sp_min-fvp.mk
@@ -5,10 +5,10 @@
 #
 
 # SP_MIN source files specific to FVP platform
-BL32_SOURCES		+=	drivers/cfi/v2m/v2m_flash.c			\
+BL32_SOURCES		+=	drivers/arm/fvp/fvp_pwrc.c			\
+				drivers/cfi/v2m/v2m_flash.c			\
 				lib/utils/mem_region.c				\
 				plat/arm/board/fvp/aarch32/fvp_helpers.S	\
-				plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c	\
 				plat/arm/board/fvp/fvp_pm.c			\
 				plat/arm/board/fvp/fvp_topology.c		\
 				plat/arm/board/fvp/sp_min/fvp_sp_min_setup.c	\
diff --git a/plat/arm/board/fvp/tsp/fvp_tsp_setup.c b/plat/arm/board/fvp/tsp/fvp_tsp_setup.c
index 86d265a..3c8a963 100644
--- a/plat/arm/board/fvp/tsp/fvp_tsp_setup.c
+++ b/plat/arm/board/fvp/tsp/fvp_tsp_setup.c
@@ -4,7 +4,8 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
+
 #include "../fvp_private.h"
 
 void tsp_early_platform_setup(void)
diff --git a/plat/arm/board/fvp/tsp/tsp-fvp.mk b/plat/arm/board/fvp/tsp/tsp-fvp.mk
index 861fe72..ab3f225 100644
--- a/plat/arm/board/fvp/tsp/tsp-fvp.mk
+++ b/plat/arm/board/fvp/tsp/tsp-fvp.mk
@@ -5,8 +5,8 @@
 #
 
 # TSP source files specific to FVP platform
-BL32_SOURCES		+=	plat/arm/board/fvp/aarch64/fvp_helpers.S	\
-				plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c	\
+BL32_SOURCES		+=	drivers/arm/fvp/fvp_pwrc.c			\
+				plat/arm/board/fvp/aarch64/fvp_helpers.S	\
 				plat/arm/board/fvp/fvp_topology.c		\
 				plat/arm/board/fvp/tsp/fvp_tsp_setup.c		\
 				${FVP_GIC_SOURCES}
diff --git a/plat/arm/board/juno/include/platform_def.h b/plat/arm/board/juno/include/platform_def.h
index b10cfdc..ddbc9b7 100644
--- a/plat/arm/board/juno/include/platform_def.h
+++ b/plat/arm/board/juno/include/platform_def.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -7,29 +7,17 @@
 #ifndef PLATFORM_DEF_H
 #define PLATFORM_DEF_H
 
-/* Enable the dynamic translation tables library. */
-#ifdef AARCH32
-# if defined(IMAGE_BL32) && RESET_TO_SP_MIN
-#  define PLAT_XLAT_TABLES_DYNAMIC     1
-# endif
-#else
-# if defined(IMAGE_BL31) && RESET_TO_BL31
-#  define PLAT_XLAT_TABLES_DYNAMIC     1
-# endif
-#endif /* AARCH32 */
-
-
 #include <drivers/arm/tzc400.h>
 #if TRUSTED_BOARD_BOOT
 #include <drivers/auth/mbedtls/mbedtls_config.h>
 #endif
+#include <plat/arm/board/common/board_css_def.h>
+#include <plat/arm/board/common/v2m_def.h>
+#include <plat/arm/common/arm_def.h>
+#include <plat/arm/css/common/css_def.h>
+#include <plat/arm/soc/common/soc_css_def.h>
 #include <plat/common/common_def.h>
 
-#include <arm_def.h>
-#include <board_css_def.h>
-#include <css_def.h>
-#include <soc_css_def.h>
-#include <v2m_def.h>
 #include "../juno_def.h"
 
 /* Required platform porting definitions */
diff --git a/plat/arm/board/juno/juno_bl1_setup.c b/plat/arm/board/juno/juno_bl1_setup.c
index 383409d..f72a6ff 100644
--- a/plat/arm/board/juno/juno_bl1_setup.c
+++ b/plat/arm/board/juno/juno_bl1_setup.c
@@ -9,13 +9,12 @@
 #include <common/bl_common.h>
 #include <common/debug.h>
 #include <common/tbbr/tbbr_img_def.h>
+#include <drivers/arm/css/sds.h>
 #include <drivers/arm/sp805.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
 
-#include <plat_arm.h>
-#include <sds.h>
-
 void juno_reset_to_aarch32_state(void);
 
 static int is_watchdog_reset(void)
diff --git a/plat/arm/board/juno/juno_bl2_setup.c b/plat/arm/board/juno/juno_bl2_setup.c
index 56f05eb..95ef77c 100644
--- a/plat/arm/board/juno/juno_bl2_setup.c
+++ b/plat/arm/board/juno/juno_bl2_setup.c
@@ -8,8 +8,7 @@
 
 #include <common/bl_common.h>
 #include <common/desc_image_load.h>
-
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
 
 #if JUNO_AARCH32_EL3_RUNTIME
 /*******************************************************************************
diff --git a/plat/arm/board/juno/juno_common.c b/plat/arm/board/juno/juno_common.c
index e134108..118c19a 100644
--- a/plat/arm/board/juno/juno_common.c
+++ b/plat/arm/board/juno/juno_common.c
@@ -5,7 +5,7 @@
  */
 
 #include <platform_def.h>
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
 
 /*
  * Table of memory regions for different BL stages to map using the MMU.
diff --git a/plat/arm/board/juno/juno_pm.c b/plat/arm/board/juno/juno_pm.c
index dbf7b6c..cc80651 100644
--- a/plat/arm/board/juno/juno_pm.c
+++ b/plat/arm/board/juno/juno_pm.c
@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#include <plat_arm.h>
-#include <scmi.h>
+#include <drivers/arm/css/scmi.h>
+#include <plat/arm/common/plat_arm.h>
 
 const plat_psci_ops_t *plat_arm_psci_override_pm_ops(plat_psci_ops_t *ops)
 {
diff --git a/plat/arm/board/juno/juno_security.c b/plat/arm/board/juno/juno_security.c
index 51c8669..9d7f0e4 100644
--- a/plat/arm/board/juno/juno_security.c
+++ b/plat/arm/board/juno/juno_security.c
@@ -8,9 +8,9 @@
 #include <drivers/arm/nic_400.h>
 #include <lib/mmio.h>
 #include <platform_def.h>
+#include <plat/arm/common/plat_arm.h>
+#include <plat/arm/soc/common/soc_css.h>
 
-#include <plat_arm.h>
-#include <soc_css.h>
 #include "juno_tzmp1_def.h"
 
 #ifdef JUNO_TZMP1
diff --git a/plat/arm/board/juno/juno_topology.c b/plat/arm/board/juno/juno_topology.c
index e70cbdc..ca5c344 100644
--- a/plat/arm/board/juno/juno_topology.c
+++ b/plat/arm/board/juno/juno_topology.c
@@ -4,14 +4,13 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+#include <drivers/arm/css/css_mhu_doorbell.h>
+#include <drivers/arm/css/scmi.h>
+#include <plat/arm/common/plat_arm.h>
+#include <plat/arm/css/common/css_pm.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
 
-#include <css_pm.h>
-#include <plat_arm.h>
-#include "../../css/drivers/scmi/scmi.h"
-#include "../../css/drivers/mhu/css_mhu_doorbell.h"
-
 #if CSS_USE_SCMI_SDS_DRIVER
 static scmi_channel_plat_info_t juno_scmi_plat_info = {
 		.scmi_mbx_mem = CSS_SCMI_PAYLOAD_BASE,
diff --git a/plat/arm/board/juno/platform.mk b/plat/arm/board/juno/platform.mk
index aec2b9b..6575811 100644
--- a/plat/arm/board/juno/platform.mk
+++ b/plat/arm/board/juno/platform.mk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -26,9 +26,7 @@
 # SCP during power management operations and for SCP RAM Firmware transfer.
 CSS_USE_SCMI_SDS_DRIVER		:=	1
 
-PLAT_INCLUDES		:=	-Iplat/arm/board/juno/include		\
-				-Iplat/arm/css/drivers/scmi		\
-				-Iplat/arm/css/drivers/sds
+PLAT_INCLUDES		:=	-Iplat/arm/board/juno/include
 
 PLAT_BL_COMMON_SOURCES	:=	plat/arm/board/juno/${ARCH}/juno_helpers.S \
 				plat/arm/board/juno/juno_common.c
@@ -88,7 +86,7 @@
 				${JUNO_SECURITY_SOURCES}
 
 ifeq (${CSS_USE_SCMI_SDS_DRIVER},1)
-BL1_SOURCES		+=	plat/arm/css/drivers/sds/sds.c
+BL1_SOURCES		+=	drivers/arm/css/sds/sds.c
 endif
 
 endif
@@ -134,6 +132,17 @@
 # Do not enable SVE
 ENABLE_SVE_FOR_NS		:=	0
 
+# Enable the dynamic translation tables library.
+ifeq (${ARCH},aarch32)
+    ifeq (${RESET_TO_SP_MIN},1)
+        BL32_CFLAGS	+=	-DPLAT_XLAT_TABLES_DYNAMIC=1
+    endif
+else
+    ifeq (${RESET_TO_BL31},1)
+        BL31_CFLAGS	+=	-DPLAT_XLAT_TABLES_DYNAMIC=1
+    endif
+endif
+
 include plat/arm/board/common/board_common.mk
 include plat/arm/common/arm_common.mk
 include plat/arm/soc/common/soc_css.mk
diff --git a/plat/arm/board/n1sdp/include/platform_def.h b/plat/arm/board/n1sdp/include/platform_def.h
index 68d0f93..7b8c367 100644
--- a/plat/arm/board/n1sdp/include/platform_def.h
+++ b/plat/arm/board/n1sdp/include/platform_def.h
@@ -7,9 +7,9 @@
 #ifndef PLATFORM_DEF_H
 #define PLATFORM_DEF_H
 
-#include <arm_def.h>
-#include <css_def.h>
-#include <v2m_def.h>
+#include <plat/arm/board/common/v2m_def.h>
+#include <plat/arm/common/arm_def.h>
+#include <plat/arm/css/common/css_def.h>
 
 /* UART related constants */
 #define PLAT_ARM_BOOT_UART_BASE			0x2A400000
diff --git a/plat/arm/board/n1sdp/n1sdp_bl31_setup.c b/plat/arm/board/n1sdp/n1sdp_bl31_setup.c
index d044b7c..18a0dea 100644
--- a/plat/arm/board/n1sdp/n1sdp_bl31_setup.c
+++ b/plat/arm/board/n1sdp/n1sdp_bl31_setup.c
@@ -6,9 +6,9 @@
 
 #include <platform_def.h>
 
-#include "../../css/drivers/scmi/scmi.h"
-#include "../../css/drivers/mhu/css_mhu_doorbell.h"
-#include <plat_arm.h>
+#include <drivers/arm/css/css_mhu_doorbell.h>
+#include <drivers/arm/css/scmi.h>
+#include <plat/arm/common/plat_arm.h>
 
 static scmi_channel_plat_info_t n1sdp_scmi_plat_info = {
 		.scmi_mbx_mem = N1SDP_SCMI_PAYLOAD_BASE,
diff --git a/plat/arm/board/n1sdp/n1sdp_plat.c b/plat/arm/board/n1sdp/n1sdp_plat.c
index 87e1511..6905896 100644
--- a/plat/arm/board/n1sdp/n1sdp_plat.c
+++ b/plat/arm/board/n1sdp/n1sdp_plat.c
@@ -8,10 +8,9 @@
 
 #include <common/bl_common.h>
 #include <common/debug.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-
 /*
  * Table of regions to map using the MMU.
  * Replace or extend the below regions as required
diff --git a/plat/arm/board/n1sdp/n1sdp_topology.c b/plat/arm/board/n1sdp/n1sdp_topology.c
index c3b4550..edf1170 100644
--- a/plat/arm/board/n1sdp/n1sdp_topology.c
+++ b/plat/arm/board/n1sdp/n1sdp_topology.c
@@ -4,7 +4,7 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
 
 /* Topology */
 typedef struct n1sdp_topology {
diff --git a/plat/arm/common/arm_bl1_fwu.c b/plat/arm/common/arm_bl1_fwu.c
index cd92aa8..124c1af 100644
--- a/plat/arm/common/arm_bl1_fwu.c
+++ b/plat/arm/common/arm_bl1_fwu.c
@@ -13,10 +13,9 @@
 #include <common/bl_common.h>
 #include <common/debug.h>
 #include <lib/utils.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-
 /* Struct to keep track of usable memory */
 typedef struct bl1_mem_info {
 	uintptr_t mem_base;
diff --git a/plat/arm/common/arm_bl1_setup.c b/plat/arm/common/arm_bl1_setup.c
index 3a8b5c2..fd4809c 100644
--- a/plat/arm/common/arm_bl1_setup.c
+++ b/plat/arm/common/arm_bl1_setup.c
@@ -14,10 +14,9 @@
 #include <drivers/arm/sp805.h>
 #include <lib/utils.h>
 #include <lib/xlat_tables/xlat_tables_compat.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-
 /* Weak definitions may be overridden in specific ARM standard platform */
 #pragma weak bl1_early_platform_setup
 #pragma weak bl1_plat_arch_setup
diff --git a/plat/arm/common/arm_bl2_el3_setup.c b/plat/arm/common/arm_bl2_el3_setup.c
index c38f2ec..0c01c87 100644
--- a/plat/arm/common/arm_bl2_el3_setup.c
+++ b/plat/arm/common/arm_bl2_el3_setup.c
@@ -7,11 +7,10 @@
 #include <assert.h>
 
 #include <drivers/generic_delay_timer.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
 
-#include <plat_arm.h>
-
 #pragma weak bl2_el3_early_platform_setup
 #pragma weak bl2_el3_plat_arch_setup
 #pragma weak bl2_el3_plat_prepare_exit
diff --git a/plat/arm/common/arm_bl2_setup.c b/plat/arm/common/arm_bl2_setup.c
index b661eb1..32617f6 100644
--- a/plat/arm/common/arm_bl2_setup.c
+++ b/plat/arm/common/arm_bl2_setup.c
@@ -18,10 +18,9 @@
 #include <lib/optee_utils.h>
 #endif
 #include <lib/utils.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-
 /* Data structure which holds the extents of the trusted SRAM for BL2 */
 static meminfo_t bl2_tzram_layout __aligned(CACHE_WRITEBACK_GRANULE);
 
diff --git a/plat/arm/common/arm_bl2u_setup.c b/plat/arm/common/arm_bl2u_setup.c
index 332ed14..9f44b9e 100644
--- a/plat/arm/common/arm_bl2u_setup.c
+++ b/plat/arm/common/arm_bl2u_setup.c
@@ -12,10 +12,9 @@
 #include <arch_helpers.h>
 #include <common/bl_common.h>
 #include <drivers/generic_delay_timer.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-
 /* Weak definitions may be overridden in specific ARM standard platform */
 #pragma weak bl2u_platform_setup
 #pragma weak bl2u_early_platform_setup
diff --git a/plat/arm/common/arm_bl31_setup.c b/plat/arm/common/arm_bl31_setup.c
index dacefc4..8e1a263 100644
--- a/plat/arm/common/arm_bl31_setup.c
+++ b/plat/arm/common/arm_bl31_setup.c
@@ -15,11 +15,10 @@
 #include <lib/mmio.h>
 #include <lib/utils.h>
 #include <lib/xlat_tables/xlat_tables_compat.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
 
-#include <plat_arm.h>
-
 /*
  * Placeholder variables for copying the arguments that have been passed to
  * BL31 from BL2.
diff --git a/plat/arm/common/arm_cci.c b/plat/arm/common/arm_cci.c
index 7ee997e..3795fc5 100644
--- a/plat/arm/common/arm_cci.c
+++ b/plat/arm/common/arm_cci.c
@@ -9,8 +9,7 @@
 #include <arch.h>
 #include <drivers/arm/cci.h>
 #include <lib/utils.h>
-
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
 
 static const int cci_map[] = {
 	PLAT_ARM_CCI_CLUSTER0_SL_IFACE_IX,
diff --git a/plat/arm/common/arm_ccn.c b/plat/arm/common/arm_ccn.c
index 6aa56f2..2e681ca 100644
--- a/plat/arm/common/arm_ccn.c
+++ b/plat/arm/common/arm_ccn.c
@@ -8,8 +8,7 @@
 
 #include <arch.h>
 #include <drivers/arm/ccn.h>
-
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
 
 static const unsigned char master_to_rn_id_map[] = {
 	PLAT_ARM_CLUSTER_TO_CCN_ID_MAP
diff --git a/plat/arm/common/arm_common.c b/plat/arm/common/arm_common.c
index 4cd2ce3..5361d4a 100644
--- a/plat/arm/common/arm_common.c
+++ b/plat/arm/common/arm_common.c
@@ -14,11 +14,10 @@
 #include <common/romlib.h>
 #include <lib/mmio.h>
 #include <lib/xlat_tables/xlat_tables_compat.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 #include <services/secure_partition.h>
 
-#include <plat_arm.h>
-
 /* Weak definitions may be overridden in specific ARM standard platform */
 #pragma weak plat_get_ns_image_entrypoint
 #pragma weak plat_arm_get_mmap
diff --git a/plat/arm/common/arm_common.mk b/plat/arm/common/arm_common.mk
index 9ad7bd7..f18a9af 100644
--- a/plat/arm/common/arm_common.mk
+++ b/plat/arm/common/arm_common.mk
@@ -141,9 +141,6 @@
     endif
 endif
 
-PLAT_INCLUDES		+=	-Iinclude/common/tbbr				\
-				-Iinclude/plat/arm/common
-
 ifeq (${ARCH}, aarch64)
 PLAT_INCLUDES		+=	-Iinclude/plat/arm/common/aarch64
 endif
@@ -257,8 +254,6 @@
 				drivers/auth/img_parser_mod.c			\
 				drivers/auth/tbbr/tbbr_cot.c			\
 
-    PLAT_INCLUDES	+=	-Iinclude/bl1/tbbr
-
     BL1_SOURCES		+=	${AUTH_SOURCES}					\
 				bl1/tbbr/tbbr_img_desc.c			\
 				plat/arm/common/arm_bl1_fwu.c			\
diff --git a/plat/arm/common/arm_console.c b/plat/arm/common/arm_console.c
index 29cb378..0367085 100644
--- a/plat/arm/common/arm_console.c
+++ b/plat/arm/common/arm_console.c
@@ -11,8 +11,7 @@
 #include <common/debug.h>
 #include <drivers/arm/pl011.h>
 #include <drivers/console.h>
-
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
 
 /*******************************************************************************
  * Functions that set up the console
diff --git a/plat/arm/common/arm_dyn_cfg.c b/plat/arm/common/arm_dyn_cfg.c
index 6c6dc56..1c58649 100644
--- a/plat/arm/common/arm_dyn_cfg.c
+++ b/plat/arm/common/arm_dyn_cfg.c
@@ -15,11 +15,10 @@
 #if TRUSTED_BOARD_BOOT
 #include <drivers/auth/mbedtls/mbedtls_config.h>
 #endif
+#include <plat/arm/common/arm_dyn_cfg_helpers.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <arm_dyn_cfg_helpers.h>
-#include <plat_arm.h>
-
 /* Variable to store the address to TB_FW_CONFIG passed from BL1 */
 static void *tb_fw_cfg_dtb;
 static size_t tb_fw_cfg_dtb_size;
diff --git a/plat/arm/common/arm_dyn_cfg_helpers.c b/plat/arm/common/arm_dyn_cfg_helpers.c
index bf2f156..36d37f8 100644
--- a/plat/arm/common/arm_dyn_cfg_helpers.c
+++ b/plat/arm/common/arm_dyn_cfg_helpers.c
@@ -10,9 +10,8 @@
 
 #include <common/desc_image_load.h>
 #include <common/fdt_wrappers.h>
-
-#include <arm_dyn_cfg_helpers.h>
-#include <plat_arm.h>
+#include <plat/arm/common/arm_dyn_cfg_helpers.h>
+#include <plat/arm/common/plat_arm.h>
 
 #define DTB_PROP_MBEDTLS_HEAP_ADDR "mbedtls_heap_addr"
 #define DTB_PROP_MBEDTLS_HEAP_SIZE "mbedtls_heap_size"
diff --git a/plat/arm/common/arm_err.c b/plat/arm/common/arm_err.c
index 8650d48..e77f5dc 100644
--- a/plat/arm/common/arm_err.c
+++ b/plat/arm/common/arm_err.c
@@ -13,10 +13,9 @@
 #include <common/debug.h>
 #include <drivers/cfi/v2m_flash.h>
 #include <drivers/console.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-
 #pragma weak plat_arm_error_handler
 
 /*
diff --git a/plat/arm/common/arm_gicv2.c b/plat/arm/common/arm_gicv2.c
index fc848c1..80a845f 100644
--- a/plat/arm/common/arm_gicv2.c
+++ b/plat/arm/common/arm_gicv2.c
@@ -7,10 +7,9 @@
 #include <platform_def.h>
 
 #include <drivers/arm/gicv2.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-
 /******************************************************************************
  * The following functions are defined as weak to allow a platform to override
  * the way the GICv2 driver is initialised and used.
diff --git a/plat/arm/common/arm_gicv3.c b/plat/arm/common/arm_gicv3.c
index e16e13d..93bebf3 100644
--- a/plat/arm/common/arm_gicv3.c
+++ b/plat/arm/common/arm_gicv3.c
@@ -9,10 +9,9 @@
 #include <common/interrupt_props.h>
 #include <drivers/arm/gicv3.h>
 #include <lib/utils.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-
 /******************************************************************************
  * The following functions are defined as weak to allow a platform to override
  * the way the GICv3 driver is initialised and used.
diff --git a/plat/arm/common/arm_image_load.c b/plat/arm/common/arm_image_load.c
index 74018d2..2faaa76 100644
--- a/plat/arm/common/arm_image_load.c
+++ b/plat/arm/common/arm_image_load.c
@@ -7,10 +7,9 @@
 #include <assert.h>
 #include <common/bl_common.h>
 #include <common/desc_image_load.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-
 #pragma weak plat_flush_next_bl_params
 #pragma weak plat_get_bl_image_load_info
 #pragma weak plat_get_next_bl_params
diff --git a/plat/arm/common/arm_io_storage.c b/plat/arm/common/arm_io_storage.c
index d7c5cac..fc1eb49 100644
--- a/plat/arm/common/arm_io_storage.c
+++ b/plat/arm/common/arm_io_storage.c
@@ -15,11 +15,10 @@
 #include <drivers/io/io_memmap.h>
 #include <drivers/io/io_storage.h>
 #include <lib/utils.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 #include <tools_share/firmware_image_package.h>
 
-#include <plat_arm.h>
-
 /* IO devices */
 static const io_dev_connector_t *fip_dev_con;
 static uintptr_t fip_dev_handle;
diff --git a/plat/arm/common/arm_nor_psci_mem_protect.c b/plat/arm/common/arm_nor_psci_mem_protect.c
index 4ae57e5..dfbd129 100644
--- a/plat/arm/common/arm_nor_psci_mem_protect.c
+++ b/plat/arm/common/arm_nor_psci_mem_protect.c
@@ -11,8 +11,7 @@
 #include <lib/psci/psci.h>
 #include <lib/mmio.h>
 #include <lib/utils.h>
-
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
 
 /*
  * DRAM1 is used also to load the NS boot loader. For this reason we
diff --git a/plat/arm/common/arm_pm.c b/plat/arm/common/arm_pm.c
index 4ce13aa..cb87baf 100644
--- a/plat/arm/common/arm_pm.c
+++ b/plat/arm/common/arm_pm.c
@@ -11,10 +11,9 @@
 
 #include <arch_helpers.h>
 #include <lib/psci/psci.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-
 /* Allow ARM Standard platforms to override these functions */
 #pragma weak plat_arm_program_trusted_mailbox
 
diff --git a/plat/arm/common/arm_sip_svc.c b/plat/arm/common/arm_sip_svc.c
index 6b0f7e7..3d308a3 100644
--- a/plat/arm/common/arm_sip_svc.c
+++ b/plat/arm/common/arm_sip_svc.c
@@ -9,11 +9,10 @@
 #include <common/debug.h>
 #include <common/runtime_svc.h>
 #include <lib/pmf/pmf.h>
+#include <plat/arm/common/arm_sip_svc.h>
+#include <plat/arm/common/plat_arm.h>
 #include <tools_share/uuid.h>
 
-#include <arm_sip_svc.h>
-#include <plat_arm.h>
-
 /* ARM SiP Service UUID */
 DEFINE_SVC_UUID2(arm_sip_svc_uid,
 	0x556d75e2, 0x6033, 0xb54b, 0xb5, 0x75,
diff --git a/plat/arm/common/arm_topology.c b/plat/arm/common/arm_topology.c
index 6986e52..37047bc 100644
--- a/plat/arm/common/arm_topology.c
+++ b/plat/arm/common/arm_topology.c
@@ -7,8 +7,7 @@
 #include <platform_def.h>
 
 #include <arch.h>
-
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
 
 /*******************************************************************************
  * This function validates an MPIDR by checking whether it falls within the
diff --git a/plat/arm/common/arm_tzc400.c b/plat/arm/common/arm_tzc400.c
index 322713b..34e650f 100644
--- a/plat/arm/common/arm_tzc400.c
+++ b/plat/arm/common/arm_tzc400.c
@@ -8,8 +8,7 @@
 
 #include <common/debug.h>
 #include <drivers/arm/tzc400.h>
-
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
 
 /* Weak definitions may be overridden in specific ARM standard platform */
 #pragma weak plat_arm_security_setup
diff --git a/plat/arm/common/arm_tzc_dmc500.c b/plat/arm/common/arm_tzc_dmc500.c
index 07260a7..e9f897f 100644
--- a/plat/arm/common/arm_tzc_dmc500.c
+++ b/plat/arm/common/arm_tzc_dmc500.c
@@ -10,8 +10,7 @@
 
 #include <common/debug.h>
 #include <drivers/arm/tzc_dmc500.h>
-
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
 
 /*******************************************************************************
  * Initialize the DMC500-TrustZone Controller for ARM standard platforms.
diff --git a/plat/arm/common/execution_state_switch.c b/plat/arm/common/execution_state_switch.c
index e313410..d471130 100644
--- a/plat/arm/common/execution_state_switch.c
+++ b/plat/arm/common/execution_state_switch.c
@@ -12,11 +12,10 @@
 #include <lib/el3_runtime/context_mgmt.h>
 #include <lib/psci/psci.h>
 #include <lib/utils.h>
+#include <plat/arm/common/arm_sip_svc.h>
+#include <plat/arm/common/plat_arm.h>
 #include <smccc_helpers.h>
 
-#include <arm_sip_svc.h>
-#include <plat_arm.h>
-
 /*
  * Handle SMC from a lower exception level to switch its execution state
  * (either from AArch64 to AArch32, or vice versa).
diff --git a/plat/arm/common/sp_min/arm_sp_min_setup.c b/plat/arm/common/sp_min/arm_sp_min_setup.c
index 967b551..c0ea027 100644
--- a/plat/arm/common/sp_min/arm_sp_min_setup.c
+++ b/plat/arm/common/sp_min/arm_sp_min_setup.c
@@ -14,10 +14,9 @@
 #include <drivers/arm/pl011.h>
 #include <drivers/console.h>
 #include <lib/mmio.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-
 static entry_point_info_t bl33_image_ep_info;
 
 /* Weak definitions may be overridden in specific ARM standard platform */
diff --git a/plat/arm/common/tsp/arm_tsp_setup.c b/plat/arm/common/tsp/arm_tsp_setup.c
index 2937697..2965ccd 100644
--- a/plat/arm/common/tsp/arm_tsp_setup.c
+++ b/plat/arm/common/tsp/arm_tsp_setup.c
@@ -13,8 +13,7 @@
 #include <common/debug.h>
 #include <drivers/arm/pl011.h>
 #include <drivers/console.h>
-
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
 
 #define BL32_END (unsigned long)(&__BL32_END__)
 
diff --git a/plat/arm/css/common/css_bl1_setup.c b/plat/arm/css/common/css_bl1_setup.c
index ae0f011..596cc3d 100644
--- a/plat/arm/css/common/css_bl1_setup.c
+++ b/plat/arm/css/common/css_bl1_setup.c
@@ -6,11 +6,10 @@
 
 #include <common/bl_common.h>
 #include <common/debug.h>
+#include <plat/arm/common/plat_arm.h>
+#include <plat/arm/soc/common/soc_css.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-#include <soc_css.h>
-
 void bl1_platform_setup(void)
 {
 	arm_bl1_platform_setup();
diff --git a/plat/arm/css/common/css_bl2_setup.c b/plat/arm/css/common/css_bl2_setup.c
index 6aefe03..002c6eb 100644
--- a/plat/arm/css/common/css_bl2_setup.c
+++ b/plat/arm/css/common/css_bl2_setup.c
@@ -8,14 +8,12 @@
 
 #include <common/bl_common.h>
 #include <common/debug.h>
+#include <drivers/arm/css/css_scp.h>
 #include <lib/mmio.h>
 #include <lib/utils.h>
+#include <plat/arm/common/plat_arm.h>
 #include <platform_def.h>
 
-#include <plat_arm.h>
-
-#include "../drivers/scp/css_scp.h"
-
 /* Weak definition may be overridden in specific CSS based platform */
 #pragma weak plat_arm_bl2_handle_scp_bl2
 
diff --git a/plat/arm/css/common/css_bl2u_setup.c b/plat/arm/css/common/css_bl2u_setup.c
index 564e98f..15cf4f6 100644
--- a/plat/arm/css/common/css_bl2u_setup.c
+++ b/plat/arm/css/common/css_bl2u_setup.c
@@ -6,12 +6,10 @@
 
 #include <common/bl_common.h>
 #include <common/debug.h>
+#include <drivers/arm/css/css_scp.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-
-#include "../drivers/scp/css_scp.h"
-
 /* Weak definition may be overridden in specific CSS based platform */
 #pragma weak bl2u_plat_handle_scp_bl2u
 
diff --git a/plat/arm/css/common/css_common.mk b/plat/arm/css/common/css_common.mk
index ca1edab..2fbbe45 100644
--- a/plat/arm/css/common/css_common.mk
+++ b/plat/arm/css/common/css_common.mk
@@ -11,8 +11,7 @@
 # By default, SCMI driver is disabled for CSS platforms
 CSS_USE_SCMI_SDS_DRIVER	?=	0
 
-PLAT_INCLUDES		+=	-Iinclude/plat/arm/css/common			\
-				-Iinclude/plat/arm/css/common/aarch64
+PLAT_INCLUDES		+=	-Iinclude/plat/arm/css/common/aarch64
 
 
 PLAT_BL_COMMON_SOURCES	+=	plat/arm/css/common/${ARCH}/css_helpers.S
@@ -27,16 +26,16 @@
 				plat/arm/css/common/css_topology.c
 
 ifeq (${CSS_USE_SCMI_SDS_DRIVER},0)
-BL31_SOURCES		+=	plat/arm/css/drivers/scp/css_pm_scpi.c		\
-				plat/arm/css/drivers/mhu/css_mhu.c		\
-				plat/arm/css/drivers/scpi/css_scpi.c
+BL31_SOURCES		+=	drivers/arm/css/mhu/css_mhu.c			\
+				drivers/arm/css/scp/css_pm_scpi.c		\
+				drivers/arm/css/scpi/css_scpi.c
 else
-BL31_SOURCES		+=	plat/arm/css/drivers/scp/css_pm_scmi.c		\
-				plat/arm/css/drivers/scmi/scmi_ap_core_proto.c	\
-				plat/arm/css/drivers/scmi/scmi_common.c		\
-				plat/arm/css/drivers/scmi/scmi_pwr_dmn_proto.c	\
-				plat/arm/css/drivers/scmi/scmi_sys_pwr_proto.c	\
-				plat/arm/css/drivers/mhu/css_mhu_doorbell.c
+BL31_SOURCES		+=	drivers/arm/css/mhu/css_mhu_doorbell.c		\
+				drivers/arm/css/scmi/scmi_ap_core_proto.c	\
+				drivers/arm/css/scmi/scmi_common.c		\
+				drivers/arm/css/scmi/scmi_pwr_dmn_proto.c	\
+				drivers/arm/css/scmi/scmi_sys_pwr_proto.c	\
+				drivers/arm/css/scp/css_pm_scmi.c
 endif
 
 # Process CSS_LOAD_SCP_IMAGES flag
@@ -50,19 +49,19 @@
   endif
 
   ifeq (${CSS_USE_SCMI_SDS_DRIVER},1)
-    BL2U_SOURCES	+=	plat/arm/css/drivers/scp/css_sds.c	\
-				plat/arm/css/drivers/sds/sds.c
+    BL2U_SOURCES	+=	drivers/arm/css/scp/css_sds.c			\
+				drivers/arm/css/sds/sds.c
 
-    BL2_SOURCES		+=	plat/arm/css/drivers/scp/css_sds.c	\
-				plat/arm/css/drivers/sds/sds.c
+    BL2_SOURCES		+=	drivers/arm/css/scp/css_sds.c			\
+				drivers/arm/css/sds/sds.c
   else
-    BL2U_SOURCES	+=	plat/arm/css/drivers/scp/css_bom_bootloader.c	\
-				plat/arm/css/drivers/mhu/css_mhu.c		\
-				plat/arm/css/drivers/scpi/css_scpi.c
+    BL2U_SOURCES	+=	drivers/arm/css/mhu/css_mhu.c			\
+				drivers/arm/css/scp/css_bom_bootloader.c	\
+				drivers/arm/css/scpi/css_scpi.c
 
-    BL2_SOURCES		+=	plat/arm/css/drivers/scp/css_bom_bootloader.c	\
-				plat/arm/css/drivers/mhu/css_mhu.c		\
-				plat/arm/css/drivers/scpi/css_scpi.c
+    BL2_SOURCES		+=	drivers/arm/css/mhu/css_mhu.c			\
+				drivers/arm/css/scp/css_bom_bootloader.c	\
+				drivers/arm/css/scpi/css_scpi.c
     # Enable option to detect whether the SCP ROM firmware in use predates version
     # 1.7.0 and therefore, is incompatible.
     CSS_DETECT_PRE_1_7_0_SCP	:=	1
@@ -74,7 +73,7 @@
 endif
 
 ifeq (${CSS_USE_SCMI_SDS_DRIVER},1)
-  PLAT_BL_COMMON_SOURCES	+=	plat/arm/css/drivers/sds/${ARCH}/sds_helpers.S
+  PLAT_BL_COMMON_SOURCES	+=	drivers/arm/css/sds/${ARCH}/sds_helpers.S
 endif
 
 # Process CSS_USE_SCMI_SDS_DRIVER flag
diff --git a/plat/arm/css/common/css_pm.c b/plat/arm/css/common/css_pm.c
index 8a156e6..f6fc6aa 100644
--- a/plat/arm/css/common/css_pm.c
+++ b/plat/arm/css/common/css_pm.c
@@ -11,14 +11,12 @@
 
 #include <arch_helpers.h>
 #include <common/debug.h>
+#include <drivers/arm/css/css_scp.h>
 #include <lib/cassert.h>
+#include <plat/arm/common/plat_arm.h>
+#include <plat/arm/css/common/css_pm.h>
 #include <plat/common/platform.h>
 
-#include <css_pm.h>
-#include <plat_arm.h>
-
-#include "../drivers/scp/css_scp.h"
-
 /* Allow CSS platforms to override `plat_arm_psci_pm_ops` */
 #pragma weak plat_arm_psci_pm_ops
 
diff --git a/plat/arm/css/common/css_topology.c b/plat/arm/css/common/css_topology.c
index 8ac2232..8aca744 100644
--- a/plat/arm/css/common/css_topology.c
+++ b/plat/arm/css/common/css_topology.c
@@ -6,10 +6,9 @@
 
 #include <assert.h>
 
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
-
 #if ARM_PLAT_MT
 #pragma weak plat_arm_get_cpu_pe_count
 #endif
diff --git a/plat/arm/css/common/sp_min/css_sp_min.mk b/plat/arm/css/common/sp_min/css_sp_min.mk
index 9fb280c..6523a16 100644
--- a/plat/arm/css/common/sp_min/css_sp_min.mk
+++ b/plat/arm/css/common/sp_min/css_sp_min.mk
@@ -9,13 +9,13 @@
 				plat/arm/css/common/css_topology.c
 
 ifeq (${CSS_USE_SCMI_SDS_DRIVER},0)
-BL32_SOURCES		+=	plat/arm/css/drivers/scp/css_pm_scpi.c		\
-				plat/arm/css/drivers/mhu/css_mhu.c		\
-				plat/arm/css/drivers/scpi/css_scpi.c
+BL32_SOURCES		+=	drivers/arm/css/mhu/css_mhu.c			\
+				drivers/arm/css/scp/css_pm_scpi.c		\
+				drivers/arm/css/scpi/css_scpi.c
 else
-BL32_SOURCES		+=	plat/arm/css/drivers/scp/css_pm_scmi.c		\
-				plat/arm/css/drivers/scmi/scmi_common.c		\
-				plat/arm/css/drivers/scmi/scmi_pwr_dmn_proto.c	\
-				plat/arm/css/drivers/scmi/scmi_sys_pwr_proto.c	\
-				plat/arm/css/drivers/mhu/css_mhu_doorbell.c
+BL32_SOURCES		+=	drivers/arm/css/mhu/css_mhu_doorbell.c		\
+				drivers/arm/css/scp/css_pm_scmi.c		\
+				drivers/arm/css/scmi/scmi_common.c		\
+				drivers/arm/css/scmi/scmi_pwr_dmn_proto.c	\
+				drivers/arm/css/scmi/scmi_sys_pwr_proto.c
 endif
diff --git a/plat/arm/css/sgi/include/sgi_base_platform_def.h b/plat/arm/css/sgi/include/sgi_base_platform_def.h
index 4afaae1..c0e6555 100644
--- a/plat/arm/css/sgi/include/sgi_base_platform_def.h
+++ b/plat/arm/css/sgi/include/sgi_base_platform_def.h
@@ -9,15 +9,14 @@
 
 #include <lib/utils_def.h>
 #include <lib/xlat_tables/xlat_tables_defs.h>
+#include <plat/arm/board/common/board_css_def.h>
+#include <plat/arm/board/common/v2m_def.h>
+#include <plat/arm/common/arm_def.h>
+#include <plat/arm/common/arm_spm_def.h>
+#include <plat/arm/css/common/css_def.h>
+#include <plat/arm/soc/common/soc_css_def.h>
 #include <plat/common/common_def.h>
 
-#include <arm_def.h>
-#include <arm_spm_def.h>
-#include <board_css_def.h>
-#include <css_def.h>
-#include <soc_css_def.h>
-#include <v2m_def.h>
-
 #define PLATFORM_CORE_COUNT		(PLAT_ARM_CLUSTER_COUNT *	\
 					CSS_SGI_MAX_CPUS_PER_CLUSTER * \
 					CSS_SGI_MAX_PE_PER_CPU)
diff --git a/plat/arm/css/sgi/sgi_bl31_setup.c b/plat/arm/css/sgi/sgi_bl31_setup.c
index 617a62b..bfcb521 100644
--- a/plat/arm/css/sgi/sgi_bl31_setup.c
+++ b/plat/arm/css/sgi/sgi_bl31_setup.c
@@ -10,14 +10,13 @@
 
 #include <common/bl_common.h>
 #include <common/debug.h>
+#include <drivers/arm/css/css_mhu_doorbell.h>
+#include <drivers/arm/css/scmi.h>
+#include <plat/arm/common/plat_arm.h>
 
-#include <plat_arm.h>
 #include <sgi_ras.h>
 #include <sgi_variant.h>
 
-#include "../../css/drivers/scmi/scmi.h"
-#include "../../css/drivers/mhu/css_mhu_doorbell.h"
-
 sgi_platform_info_t sgi_plat_info;
 
 static scmi_channel_plat_info_t sgi575_scmi_plat_info = {
diff --git a/plat/arm/css/sgi/sgi_image_load.c b/plat/arm/css/sgi/sgi_image_load.c
index e52124f..a2f10dc 100644
--- a/plat/arm/css/sgi/sgi_image_load.c
+++ b/plat/arm/css/sgi/sgi_image_load.c
@@ -9,9 +9,9 @@
 #include <arch_helpers.h>
 #include <common/debug.h>
 #include <common/desc_image_load.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
 #include <sgi_variant.h>
 
 /*******************************************************************************
diff --git a/plat/arm/css/sgi/sgi_plat.c b/plat/arm/css/sgi/sgi_plat.c
index 72cda7f..83ca30c 100644
--- a/plat/arm/css/sgi/sgi_plat.c
+++ b/plat/arm/css/sgi/sgi_plat.c
@@ -11,11 +11,10 @@
 #include <common/bl_common.h>
 #include <common/debug.h>
 #include <drivers/arm/ccn.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 #include <services/secure_partition.h>
 
-#include <plat_arm.h>
-
 #if USE_COHERENT_MEM
 /*
  * The next 2 constants identify the extents of the coherent memory region.
diff --git a/plat/arm/css/sgi/sgi_ras.c b/plat/arm/css/sgi/sgi_ras.c
index a6a32d1..0001ffd 100644
--- a/plat/arm/css/sgi/sgi_ras.c
+++ b/plat/arm/css/sgi/sgi_ras.c
@@ -10,12 +10,12 @@
 #include <bl31/interrupt_mgmt.h>
 #include <lib/el3_runtime/context_mgmt.h>
 #include <lib/extensions/ras.h>
+#include <plat/arm/common/arm_spm_def.h>
 #include <plat/common/platform.h>
 #include <services/mm_svc.h>
 #include <services/sdei.h>
 #include <services/spm_svc.h>
 
-#include <arm_spm_def.h>
 #include <sgi_ras.h>
 
 static int sgi_ras_intr_handler(const struct err_record_info *err_rec,
diff --git a/plat/arm/css/sgi/sgi_topology.c b/plat/arm/css/sgi/sgi_topology.c
index 2921c0c..dafaf40 100644
--- a/plat/arm/css/sgi/sgi_topology.c
+++ b/plat/arm/css/sgi/sgi_topology.c
@@ -4,7 +4,8 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
+
 #include <sgi_variant.h>
 
 /* Topology */
diff --git a/plat/arm/css/sgm/include/platform_oid.h b/plat/arm/css/sgm/include/platform_oid.h
index 18d41e3..fd1854a 100644
--- a/plat/arm/css/sgm/include/platform_oid.h
+++ b/plat/arm/css/sgm/include/platform_oid.h
@@ -3,7 +3,8 @@
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
-#include "../../../../../include/plat/arm/board/common/board_arm_oid.h"
+
+#include <plat/arm/board/common/board_arm_oid.h>
 
 /*
  * Required platform OIDs
diff --git a/plat/arm/css/sgm/include/sgm_base_platform_def.h b/plat/arm/css/sgm/include/sgm_base_platform_def.h
index e3fa3f3..4647e74 100644
--- a/plat/arm/css/sgm/include/sgm_base_platform_def.h
+++ b/plat/arm/css/sgm/include/sgm_base_platform_def.h
@@ -9,14 +9,13 @@
 
 #include <drivers/arm/tzc400.h>
 #include <drivers/arm/tzc_common.h>
+#include <plat/arm/board/common/board_css_def.h>
+#include <plat/arm/board/common/v2m_def.h>
+#include <plat/arm/common/arm_def.h>
+#include <plat/arm/css/common/css_def.h>
+#include <plat/arm/soc/common/soc_css_def.h>
 #include <plat/common/common_def.h>
 
-#include <arm_def.h>
-#include <board_css_def.h>
-#include <css_def.h>
-#include <soc_css_def.h>
-#include <v2m_def.h>
-
 /* CPU topology */
 #define PLAT_ARM_CLUSTER_COUNT		1
 #define PLAT_ARM_CLUSTER_CORE_COUNT	8
diff --git a/plat/arm/css/sgm/sgm_bl1_setup.c b/plat/arm/css/sgm/sgm_bl1_setup.c
index 8b7c5da..2036515 100644
--- a/plat/arm/css/sgm/sgm_bl1_setup.c
+++ b/plat/arm/css/sgm/sgm_bl1_setup.c
@@ -6,10 +6,10 @@
 
 #include <common/bl_common.h>
 #include <common/debug.h>
+#include <plat/arm/common/plat_arm.h>
+#include <plat/arm/soc/common/soc_css.h>
 
-#include <plat_arm.h>
 #include <sgm_plat_config.h>
-#include <soc_css.h>
 
 void bl1_early_platform_setup(void)
 {
diff --git a/plat/arm/css/sgm/sgm_bl31_setup.c b/plat/arm/css/sgm/sgm_bl31_setup.c
index 7967cb5..7e92ac8 100644
--- a/plat/arm/css/sgm/sgm_bl31_setup.c
+++ b/plat/arm/css/sgm/sgm_bl31_setup.c
@@ -6,13 +6,12 @@
 
 #include <common/bl_common.h>
 #include <common/debug.h>
+#include <drivers/arm/css/css_mhu_doorbell.h>
+#include <drivers/arm/css/scmi.h>
+#include <plat/arm/common/plat_arm.h>
 
-#include <plat_arm.h>
 #include <sgm_plat_config.h>
 
-#include "../../css/drivers/scmi/scmi.h"
-#include "../../css/drivers/mhu/css_mhu_doorbell.h"
-
 static scmi_channel_plat_info_t sgm775_scmi_plat_info = {
 		.scmi_mbx_mem = CSS_SCMI_PAYLOAD_BASE,
 		.db_reg_addr = PLAT_CSS_MHU_BASE + CSS_SCMI_MHU_DB_REG_OFF,
diff --git a/plat/arm/css/sgm/sgm_mmap_config.c b/plat/arm/css/sgm/sgm_mmap_config.c
index 763f36a..e5b4b03 100644
--- a/plat/arm/css/sgm/sgm_mmap_config.c
+++ b/plat/arm/css/sgm/sgm_mmap_config.c
@@ -8,8 +8,8 @@
 
 #include <common/bl_common.h>
 #include <common/debug.h>
+#include <plat/arm/common/plat_arm.h>
 
-#include <plat_arm.h>
 #include <sgm_variant.h>
 
 /*
diff --git a/plat/arm/css/sgm/sgm_plat_config.c b/plat/arm/css/sgm/sgm_plat_config.c
index 2a43487..d9e65c5 100644
--- a/plat/arm/css/sgm/sgm_plat_config.c
+++ b/plat/arm/css/sgm/sgm_plat_config.c
@@ -10,8 +10,8 @@
 #include <platform_def.h>
 
 #include <common/debug.h>
+#include <plat/arm/common/plat_arm.h>
 
-#include <plat_arm.h>
 #include <sgm_plat_config.h>
 #include <sgm_variant.h>
 
diff --git a/plat/arm/css/sgm/sgm_security.c b/plat/arm/css/sgm/sgm_security.c
index 548ec7b..21d5306 100644
--- a/plat/arm/css/sgm/sgm_security.c
+++ b/plat/arm/css/sgm/sgm_security.c
@@ -6,10 +6,10 @@
 
 #include <common/debug.h>
 #include <drivers/arm/tzc_dmc500.h>
+#include <plat/arm/common/plat_arm.h>
+#include <plat/arm/soc/common/soc_css.h>
 
-#include <plat_arm.h>
 #include <sgm_variant.h>
-#include <soc_css.h>
 
 /* Is populated with the DMC-500 controllers base addresses */
 static tzc_dmc500_driver_data_t plat_driver_data;
diff --git a/plat/arm/css/sgm/sgm_topology.c b/plat/arm/css/sgm/sgm_topology.c
index ce72464..2d9552d 100644
--- a/plat/arm/css/sgm/sgm_topology.c
+++ b/plat/arm/css/sgm/sgm_topology.c
@@ -4,7 +4,8 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
+
 #include <sgm_plat_config.h>
 
 /*******************************************************************************
diff --git a/plat/arm/css/sgm/tsp/sgm_tsp_setup.c b/plat/arm/css/sgm/tsp/sgm_tsp_setup.c
index 39bba94..5f40c4c 100644
--- a/plat/arm/css/sgm/tsp/sgm_tsp_setup.c
+++ b/plat/arm/css/sgm/tsp/sgm_tsp_setup.c
@@ -4,7 +4,8 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#include <plat_arm.h>
+#include <plat/arm/common/plat_arm.h>
+
 #include <sgm_plat_config.h>
 
 void tsp_early_platform_setup(void)
diff --git a/plat/arm/soc/common/soc_css.mk b/plat/arm/soc/common/soc_css.mk
index e009467..8cad2a5 100644
--- a/plat/arm/soc/common/soc_css.mk
+++ b/plat/arm/soc/common/soc_css.mk
@@ -4,8 +4,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 #
 
-PLAT_INCLUDES		+=	-Iinclude/plat/arm/soc/common/
-
 #PLAT_BL_COMMON_SOURCES	+=
 
 BL1_SOURCES		+=	plat/arm/soc/common/soc_css_security.c
diff --git a/plat/arm/soc/common/soc_css_security.c b/plat/arm/soc/common/soc_css_security.c
index b48357a..4f6bf61 100644
--- a/plat/arm/soc/common/soc_css_security.c
+++ b/plat/arm/soc/common/soc_css_security.c
@@ -8,8 +8,7 @@
 
 #include <drivers/arm/nic_400.h>
 #include <lib/mmio.h>
-
-#include <soc_css.h>
+#include <plat/arm/soc/common/soc_css.h>
 
 void soc_css_init_nic400(void)
 {
diff --git a/plat/mediatek/mt8173/bl31_plat_setup.c b/plat/mediatek/mt8173/bl31_plat_setup.c
index bd384a1..dd23e63 100644
--- a/plat/mediatek/mt8173/bl31_plat_setup.c
+++ b/plat/mediatek/mt8173/bl31_plat_setup.c
@@ -11,13 +11,13 @@
 #include <drivers/console.h>
 #include <drivers/generic_delay_timer.h>
 #include <lib/mmio.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/common_def.h>
 #include <plat/common/platform.h>
 
 #include <mcucfg.h>
 #include <mtcmos.h>
 #include <mtk_plat_common.h>
-#include <plat_arm.h>
 #include <plat_private.h>
 #include <spm.h>
 
diff --git a/plat/mediatek/mt8173/plat_pm.c b/plat/mediatek/mt8173/plat_pm.c
index 9673d2c..1b52470 100644
--- a/plat/mediatek/mt8173/plat_pm.c
+++ b/plat/mediatek/mt8173/plat_pm.c
@@ -15,11 +15,11 @@
 #include <lib/bakery_lock.h>
 #include <lib/mmio.h>
 #include <lib/psci/psci.h>
+#include <plat/arm/common/plat_arm.h>
 
 #include <mcucfg.h>
 #include <mt8173_def.h>
 #include <mt_cpuxgpt.h> /* generic_timer_backup() */
-#include <plat_arm.h>
 #include <plat_private.h>
 #include <power_tracer.h>
 #include <rtc.h>
diff --git a/plat/mediatek/mt8173/platform.mk b/plat/mediatek/mt8173/platform.mk
index 294aea4..0726efe 100644
--- a/plat/mediatek/mt8173/platform.mk
+++ b/plat/mediatek/mt8173/platform.mk
@@ -9,7 +9,6 @@
 
 PLAT_INCLUDES		:=	-I${MTK_PLAT}/common/				\
 				-I${MTK_PLAT}/common/drivers/uart/		\
-				-Iinclude/plat/arm/common			\
 				-Iinclude/plat/arm/common/aarch64		\
 				-I${MTK_PLAT_SOC}/drivers/crypt/		\
 				-I${MTK_PLAT_SOC}/drivers/mtcmos/		\
diff --git a/plat/xilinx/zynqmp/bl31_zynqmp_setup.c b/plat/xilinx/zynqmp/bl31_zynqmp_setup.c
index 8ecd6d7..b0eb66c 100644
--- a/plat/xilinx/zynqmp/bl31_zynqmp_setup.c
+++ b/plat/xilinx/zynqmp/bl31_zynqmp_setup.c
@@ -11,10 +11,11 @@
 #include <common/bl_common.h>
 #include <common/debug.h>
 #include <drivers/console.h>
-#include <plat_arm.h>
-#include <plat_private.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
+#include <plat_private.h>
+
 #define BL31_END (unsigned long)(&__BL31_END__)
 
 static entry_point_info_t bl32_image_ep_info;
diff --git a/plat/xilinx/zynqmp/plat_psci.c b/plat/xilinx/zynqmp/plat_psci.c
index 8522d3e..a32e089 100644
--- a/plat/xilinx/zynqmp/plat_psci.c
+++ b/plat/xilinx/zynqmp/plat_psci.c
@@ -12,10 +12,10 @@
 #include <drivers/arm/gicv2.h>
 #include <lib/mmio.h>
 #include <lib/psci/psci.h>
-#include <plat_private.h>
+#include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 
-#include <plat_arm.h>
+#include <plat_private.h>
 #include "pm_api_sys.h"
 #include "pm_client.h"
 
diff --git a/plat/xilinx/zynqmp/platform.mk b/plat/xilinx/zynqmp/platform.mk
index d147916..b2f91cd 100644
--- a/plat/xilinx/zynqmp/platform.mk
+++ b/plat/xilinx/zynqmp/platform.mk
@@ -45,8 +45,7 @@
 $(eval $(call add_define,ZYNQMP_WDT_RESTART))
 endif
 
-PLAT_INCLUDES		:=	-Iinclude/plat/arm/common/			\
-				-Iinclude/plat/arm/common/aarch64/		\
+PLAT_INCLUDES		:=	-Iinclude/plat/arm/common/aarch64/		\
 				-Iplat/xilinx/common/include/			\
 				-Iplat/xilinx/zynqmp/include/			\
 				-Iplat/xilinx/zynqmp/pm_service/		\
diff --git a/plat/xilinx/zynqmp/tsp/tsp_plat_setup.c b/plat/xilinx/zynqmp/tsp/tsp_plat_setup.c
index 97718d6..902e4b3 100644
--- a/plat/xilinx/zynqmp/tsp/tsp_plat_setup.c
+++ b/plat/xilinx/zynqmp/tsp/tsp_plat_setup.c
@@ -7,8 +7,8 @@
 #include <common/bl_common.h>
 #include <common/debug.h>
 #include <drivers/console.h>
+#include <plat/arm/common/plat_arm.h>
 
-#include <plat_arm.h>
 #include <plat_private.h>
 #include <platform_tsp.h>