aboutsummaryrefslogtreecommitdiff
path: root/plat
diff options
context:
space:
mode:
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-12-14 00:18:21 +0000
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2019-01-04 10:43:17 +0000
commit09d40e0e08283a249e7dce0e106c07c5141f9b7e (patch)
tree46e7af7b5be2738948b359b2a07078e4cf1bbec1 /plat
parentf5478dedf9e096d9539362b38ceb096b940ba3e2 (diff)
downloadarm-trusted-firmware-09d40e0e08283a249e7dce0e106c07c5141f9b7e.tar.gz
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>
Diffstat (limited to 'plat')
-rw-r--r--plat/allwinner/common/include/platform_def.h7
-rw-r--r--plat/allwinner/common/sunxi_bl31_setup.c20
-rw-r--r--plat/allwinner/common/sunxi_common.c13
-rw-r--r--plat/allwinner/common/sunxi_cpu_ops.c17
-rw-r--r--plat/allwinner/common/sunxi_pm.c17
-rw-r--r--plat/allwinner/common/sunxi_security.c5
-rw-r--r--plat/allwinner/common/sunxi_topology.c5
-rw-r--r--plat/allwinner/sun50i_a64/sunxi_power.c14
-rw-r--r--plat/allwinner/sun50i_h6/sunxi_power.c12
-rw-r--r--plat/arm/board/common/aarch32/board_arm_helpers.S3
-rw-r--r--plat/arm/board/common/aarch64/board_arm_helpers.S3
-rw-r--r--plat/arm/board/common/board_arm_trusted_boot.c16
-rw-r--r--plat/arm/board/common/board_common.mk3
-rw-r--r--plat/arm/board/fvp/aarch64/fvp_helpers.S4
-rw-r--r--plat/arm/board/fvp/aarch64/fvp_ras.c2
-rw-r--r--plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c6
-rw-r--r--plat/arm/board/fvp/fvp_bl1_setup.c7
-rw-r--r--plat/arm/board/fvp/fvp_bl2_setup.c9
-rw-r--r--plat/arm/board/fvp/fvp_bl2u_setup.c3
-rw-r--r--plat/arm/board/fvp/fvp_bl31_setup.c5
-rw-r--r--plat/arm/board/fvp/fvp_common.c20
-rw-r--r--plat/arm/board/fvp/fvp_def.h2
-rw-r--r--plat/arm/board/fvp/fvp_io_storage.c14
-rw-r--r--plat/arm/board/fvp/fvp_pm.c19
-rw-r--r--plat/arm/board/fvp/fvp_stack_protector.c5
-rw-r--r--plat/arm/board/fvp/fvp_topology.c10
-rw-r--r--plat/arm/board/fvp/fvp_trusted_boot.c5
-rw-r--r--plat/arm/board/fvp/include/platform_def.h8
-rw-r--r--plat/arm/board/juno/aarch32/juno_helpers.S2
-rw-r--r--plat/arm/board/juno/aarch64/juno_helpers.S2
-rw-r--r--plat/arm/board/juno/include/platform_def.h11
-rw-r--r--plat/arm/board/juno/juno_bl1_setup.c12
-rw-r--r--plat/arm/board/juno/juno_bl2_setup.c6
-rw-r--r--plat/arm/board/juno/juno_def.h2
-rw-r--r--plat/arm/board/juno/juno_err.c6
-rw-r--r--plat/arm/board/juno/juno_security.c8
-rw-r--r--plat/arm/board/juno/juno_stack_protector.c5
-rw-r--r--plat/arm/board/juno/juno_topology.c3
-rw-r--r--plat/arm/board/juno/juno_trng.c6
-rw-r--r--plat/arm/board/n1sdp/n1sdp_bl31_setup.c3
-rw-r--r--plat/arm/board/n1sdp/n1sdp_plat.c10
-rw-r--r--plat/arm/board/sgi575/include/platform_def.h3
-rw-r--r--plat/arm/board/sgi575/sgi575_plat.c2
-rw-r--r--plat/arm/board/sgi575/sgi575_security.c5
-rw-r--r--plat/arm/board/sgiclarka/include/platform_def.h3
-rw-r--r--plat/arm/board/sgiclarka/sgiclarka_plat.c2
-rw-r--r--plat/arm/board/sgiclarka/sgiclarka_security.c5
-rw-r--r--plat/arm/board/sgiclarkh/include/platform_def.h3
-rw-r--r--plat/arm/board/sgiclarkh/sgiclarkh_plat.c2
-rw-r--r--plat/arm/board/sgiclarkh/sgiclarkh_security.c5
-rw-r--r--plat/arm/common/aarch32/arm_bl2_mem_params_desc.c6
-rw-r--r--plat/arm/common/aarch64/arm_bl2_mem_params_desc.c6
-rw-r--r--plat/arm/common/aarch64/arm_ehf.c3
-rw-r--r--plat/arm/common/aarch64/arm_sdei.c5
-rw-r--r--plat/arm/common/arm_bl1_fwu.c15
-rw-r--r--plat/arm/common/arm_bl1_setup.c19
-rw-r--r--plat/arm/common/arm_bl2_el3_setup.c9
-rw-r--r--plat/arm/common/arm_bl2_setup.c25
-rw-r--r--plat/arm/common/arm_bl2u_setup.c15
-rw-r--r--plat/arm/common/arm_bl31_setup.c20
-rw-r--r--plat/arm/common/arm_cci.c8
-rw-r--r--plat/arm/common/arm_ccn.c6
-rw-r--r--plat/arm/common/arm_common.c20
-rw-r--r--plat/arm/common/arm_console.c12
-rw-r--r--plat/arm/common/arm_dyn_cfg.c20
-rw-r--r--plat/arm/common/arm_dyn_cfg_helpers.c9
-rw-r--r--plat/arm/common/arm_err.c17
-rw-r--r--plat/arm/common/arm_gicv2.c8
-rw-r--r--plat/arm/common/arm_gicv3.c12
-rw-r--r--plat/arm/common/arm_image_load.c8
-rw-r--r--plat/arm/common/arm_io_storage.c24
-rw-r--r--plat/arm/common/arm_nor_psci_mem_protect.c14
-rw-r--r--plat/arm/common/arm_pm.c13
-rw-r--r--plat/arm/common/arm_sip_svc.c13
-rw-r--r--plat/arm/common/arm_topology.c4
-rw-r--r--plat/arm/common/arm_tzc400.c9
-rw-r--r--plat/arm/common/arm_tzc_dmc500.c11
-rw-r--r--plat/arm/common/execution_state_switch.c16
-rw-r--r--plat/arm/common/sp_min/arm_sp_min_setup.c19
-rw-r--r--plat/arm/common/tsp/arm_tsp_setup.c17
-rw-r--r--plat/arm/css/common/css_bl1_setup.c7
-rw-r--r--plat/arm/css/common/css_bl2_setup.c13
-rw-r--r--plat/arm/css/common/css_bl2u_setup.c8
-rw-r--r--plat/arm/css/common/css_pm.c16
-rw-r--r--plat/arm/css/common/css_topology.c6
-rw-r--r--plat/arm/css/drivers/mhu/css_mhu.c12
-rw-r--r--plat/arm/css/drivers/mhu/css_mhu_doorbell.c4
-rw-r--r--plat/arm/css/drivers/mhu/css_mhu_doorbell.h3
-rw-r--r--plat/arm/css/drivers/scmi/scmi.h7
-rw-r--r--plat/arm/css/drivers/scmi/scmi_ap_core_proto.c6
-rw-r--r--plat/arm/css/drivers/scmi/scmi_common.c7
-rw-r--r--plat/arm/css/drivers/scmi/scmi_pwr_dmn_proto.c6
-rw-r--r--plat/arm/css/drivers/scmi/scmi_sys_pwr_proto.c6
-rw-r--r--plat/arm/css/drivers/scp/css_bom_bootloader.c11
-rw-r--r--plat/arm/css/drivers/scp/css_pm_scmi.c11
-rw-r--r--plat/arm/css/drivers/scp/css_pm_scpi.c7
-rw-r--r--plat/arm/css/drivers/scp/css_scp.h6
-rw-r--r--plat/arm/css/drivers/scp/css_sds.c13
-rw-r--r--plat/arm/css/drivers/scpi/css_scpi.c13
-rw-r--r--plat/arm/css/drivers/sds/sds.c7
-rw-r--r--plat/arm/css/sgi/include/sgi_base_platform_def.h7
-rw-r--r--plat/arm/css/sgi/sgi_bl31_setup.c8
-rw-r--r--plat/arm/css/sgi/sgi_image_load.c10
-rw-r--r--plat/arm/css/sgi/sgi_interconnect.c2
-rw-r--r--plat/arm/css/sgi/sgi_plat.c17
-rw-r--r--plat/arm/css/sgi/sgi_ras.c20
-rw-r--r--plat/arm/css/sgm/include/sgm_base_platform_def.h7
-rw-r--r--plat/arm/css/sgm/include/sgm_plat_config.h4
-rw-r--r--plat/arm/css/sgm/sgm_bl1_setup.c5
-rw-r--r--plat/arm/css/sgm/sgm_bl31_setup.c6
-rw-r--r--plat/arm/css/sgm/sgm_mmap_config.c8
-rw-r--r--plat/arm/css/sgm/sgm_plat_config.c9
-rw-r--r--plat/arm/css/sgm/sgm_security.c5
-rw-r--r--plat/arm/soc/common/soc_css_security.c8
-rw-r--r--plat/common/aarch32/crash_console_helpers.S2
-rw-r--r--plat/common/aarch32/plat_common.c4
-rw-r--r--plat/common/aarch32/plat_sp_min_common.c4
-rw-r--r--plat/common/aarch64/crash_console_helpers.S2
-rw-r--r--plat/common/aarch64/plat_common.c11
-rw-r--r--plat/common/aarch64/platform_helpers.S2
-rw-r--r--plat/common/plat_bl1_common.c12
-rw-r--r--plat/common/plat_bl_common.c13
-rw-r--r--plat/common/plat_gicv2.c10
-rw-r--r--plat/common/plat_gicv3.c16
-rw-r--r--plat/common/plat_log_common.c4
-rw-r--r--plat/common/plat_psci_common.c9
-rw-r--r--plat/common/plat_spm_rd.c13
-rw-r--r--plat/common/plat_spm_sp.c6
-rw-r--r--plat/common/tbbr/plat_tbbr.c9
-rw-r--r--plat/hisilicon/hikey/aarch64/hikey_common.c14
-rw-r--r--plat/hisilicon/hikey/hikey_bl1_setup.c24
-rw-r--r--plat/hisilicon/hikey/hikey_bl2_mem_params_desc.c6
-rw-r--r--plat/hisilicon/hikey/hikey_bl2_setup.c34
-rw-r--r--plat/hisilicon/hikey/hikey_bl31_setup.c21
-rw-r--r--plat/hisilicon/hikey/hikey_bl_common.c10
-rw-r--r--plat/hisilicon/hikey/hikey_ddr.c11
-rw-r--r--plat/hisilicon/hikey/hikey_image_load.c6
-rw-r--r--plat/hisilicon/hikey/hikey_io_storage.c27
-rw-r--r--plat/hisilicon/hikey/hikey_pm.c16
-rw-r--r--plat/hisilicon/hikey/hikey_private.h2
-rw-r--r--plat/hisilicon/hikey/hikey_security.c9
-rw-r--r--plat/hisilicon/hikey/hikey_tbbr.c2
-rw-r--r--plat/hisilicon/hikey/hikey_topology.c6
-rw-r--r--plat/hisilicon/hikey/hisi_dvfs.c19
-rw-r--r--plat/hisilicon/hikey/hisi_ipc.c15
-rw-r--r--plat/hisilicon/hikey/hisi_mcu.c19
-rw-r--r--plat/hisilicon/hikey/hisi_pwrc.c15
-rw-r--r--plat/hisilicon/hikey/hisi_sip_svc.c11
-rw-r--r--plat/hisilicon/hikey/include/hi6553.h3
-rw-r--r--plat/hisilicon/hikey/include/plat_macros.S4
-rw-r--r--plat/hisilicon/hikey/include/platform_def.h7
-rw-r--r--plat/hisilicon/hikey/platform.mk1
-rw-r--r--plat/hisilicon/hikey960/aarch64/hikey960_common.c14
-rw-r--r--plat/hisilicon/hikey960/drivers/ipc/hisi_ipc.c14
-rw-r--r--plat/hisilicon/hikey960/drivers/pwrc/hisi_pwrc.c11
-rw-r--r--plat/hisilicon/hikey960/hikey960_bl1_setup.c34
-rw-r--r--plat/hisilicon/hikey960/hikey960_bl2_mem_params_desc.c6
-rw-r--r--plat/hisilicon/hikey960/hikey960_bl2_setup.c30
-rw-r--r--plat/hisilicon/hikey960/hikey960_bl31_setup.c30
-rw-r--r--plat/hisilicon/hikey960/hikey960_bl_common.c10
-rw-r--r--plat/hisilicon/hikey960/hikey960_boardid.c9
-rw-r--r--plat/hisilicon/hikey960/hikey960_def.h4
-rw-r--r--plat/hisilicon/hikey960/hikey960_image_load.c6
-rw-r--r--plat/hisilicon/hikey960/hikey960_io_storage.c26
-rw-r--r--plat/hisilicon/hikey960/hikey960_mcu_load.c14
-rw-r--r--plat/hisilicon/hikey960/hikey960_pm.c20
-rw-r--r--plat/hisilicon/hikey960/hikey960_private.h2
-rw-r--r--plat/hisilicon/hikey960/hikey960_tbbr.c2
-rw-r--r--plat/hisilicon/hikey960/hikey960_topology.c6
-rw-r--r--plat/hisilicon/hikey960/include/plat_macros.S4
-rw-r--r--plat/hisilicon/hikey960/include/platform_def.h3
-rw-r--r--plat/hisilicon/poplar/aarch64/platform_common.c16
-rw-r--r--plat/hisilicon/poplar/bl1_plat_setup.c29
-rw-r--r--plat/hisilicon/poplar/bl2_plat_mem_params_desc.c6
-rw-r--r--plat/hisilicon/poplar/bl2_plat_setup.c26
-rw-r--r--plat/hisilicon/poplar/bl31_plat_setup.c25
-rw-r--r--plat/hisilicon/poplar/include/hi3798cv200.h2
-rw-r--r--plat/hisilicon/poplar/include/plat_private.h3
-rw-r--r--plat/hisilicon/poplar/include/platform_def.h11
-rw-r--r--plat/hisilicon/poplar/plat_pm.c19
-rw-r--r--plat/hisilicon/poplar/plat_storage.c32
-rw-r--r--plat/hisilicon/poplar/plat_topology.c6
-rw-r--r--plat/hisilicon/poplar/platform.mk4
-rw-r--r--plat/hisilicon/poplar/poplar_gicv2.c5
-rw-r--r--plat/hisilicon/poplar/poplar_image_load.c6
-rw-r--r--plat/imx/common/imx8_psci.c6
-rw-r--r--plat/imx/common/imx8_topology.c2
-rw-r--r--plat/imx/common/imx_aips.c5
-rw-r--r--plat/imx/common/imx_caam.c5
-rw-r--r--plat/imx/common/imx_clock.c7
-rw-r--r--plat/imx/common/imx_csu.c4
-rw-r--r--plat/imx/common/imx_io_mux.c3
-rw-r--r--plat/imx/common/imx_snvs.c3
-rw-r--r--plat/imx/common/imx_wdog.c3
-rw-r--r--plat/imx/common/include/imx8_lpuart.h2
-rw-r--r--plat/imx/common/include/imx_snvs.h1
-rw-r--r--plat/imx/common/include/imx_uart.h2
-rw-r--r--plat/imx/common/include/imx_wdog.h3
-rw-r--r--plat/imx/common/include/plat_imx8.h4
-rw-r--r--plat/imx/common/include/sci/sci_rpc.h3
-rw-r--r--plat/imx/common/plat_imx8_gic.c14
-rw-r--r--plat/imx/common/sci/imx8_mu.c3
-rw-r--r--plat/imx/common/sci/ipc.c6
-rw-r--r--plat/imx/common/sci/svc/pad/pad_rpc_clnt.c3
-rw-r--r--plat/imx/common/sci/svc/pm/pm_rpc_clnt.c4
-rw-r--r--plat/imx/common/sci/svc/rm/rm_rpc_clnt.c4
-rw-r--r--plat/imx/imx7/warp7/include/platform_def.h4
-rw-r--r--plat/imx/imx7/warp7/warp7_bl2_el3_setup.c26
-rw-r--r--plat/imx/imx7/warp7/warp7_bl2_mem_params_desc.c7
-rw-r--r--plat/imx/imx7/warp7/warp7_image_load.c6
-rw-r--r--plat/imx/imx7/warp7/warp7_io_storage.c17
-rw-r--r--plat/imx/imx8m/imx8mq/gpc.c14
-rw-r--r--plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c25
-rw-r--r--plat/imx/imx8m/imx8mq/imx8mq_psci.c10
-rw-r--r--plat/imx/imx8qm/imx8qm_bl31_setup.c25
-rw-r--r--plat/imx/imx8qm/imx8qm_psci.c14
-rw-r--r--plat/imx/imx8qm/include/platform_def.h2
-rw-r--r--plat/imx/imx8qx/imx8qx_bl31_setup.c25
-rw-r--r--plat/imx/imx8qx/imx8qx_psci.c12
-rw-r--r--plat/imx/imx8qx/include/platform_def.h2
-rw-r--r--plat/layerscape/board/ls1043/include/ls_def.h10
-rw-r--r--plat/layerscape/board/ls1043/include/platform_def.h7
-rw-r--r--plat/layerscape/board/ls1043/ls1043_bl1_setup.c7
-rw-r--r--plat/layerscape/board/ls1043/ls1043_bl2_setup.c5
-rw-r--r--plat/layerscape/board/ls1043/ls1043_bl31_setup.c5
-rw-r--r--plat/layerscape/board/ls1043/ls1043_err.c5
-rw-r--r--plat/layerscape/board/ls1043/ls1043_psci.c18
-rw-r--r--plat/layerscape/board/ls1043/ls1043_stack_protector.c3
-rw-r--r--plat/layerscape/board/ls1043/ls1043_topology.c4
-rw-r--r--plat/layerscape/board/ls1043/ls_gic.c9
-rw-r--r--plat/layerscape/board/ls1043/platform.mk4
-rw-r--r--plat/layerscape/common/aarch64/ls_bl2_mem_params_desc.c10
-rw-r--r--plat/layerscape/common/aarch64/ls_helpers.S2
-rw-r--r--plat/layerscape/common/include/ls_16550.h2
-rw-r--r--plat/layerscape/common/include/plat_ls.h3
-rw-r--r--plat/layerscape/common/ls_bl1_setup.c3
-rw-r--r--plat/layerscape/common/ls_bl2_setup.c6
-rw-r--r--plat/layerscape/common/ls_bl31_setup.c11
-rw-r--r--plat/layerscape/common/ls_common.c13
-rw-r--r--plat/layerscape/common/ls_image_load.c3
-rw-r--r--plat/layerscape/common/ls_io_storage.c17
-rw-r--r--plat/layerscape/common/ls_timer.c4
-rw-r--r--plat/layerscape/common/ls_tzc380.c9
-rw-r--r--plat/layerscape/common/ns_access.c9
-rw-r--r--plat/layerscape/common/tsp/ls_tsp_setup.c6
-rw-r--r--plat/marvell/a3700/a3700/board/pm_src.c1
-rw-r--r--plat/marvell/a3700/a3700/plat_bl31_setup.c3
-rw-r--r--plat/marvell/a3700/common/a3700_common.mk4
-rw-r--r--plat/marvell/a3700/common/a3700_sip_svc.c8
-rw-r--r--plat/marvell/a3700/common/dram_win.c6
-rw-r--r--plat/marvell/a3700/common/include/dram_win.h3
-rw-r--r--plat/marvell/a3700/common/include/platform_def.h5
-rw-r--r--plat/marvell/a3700/common/io_addr_dec.c6
-rw-r--r--plat/marvell/a3700/common/marvell_plat_config.c3
-rw-r--r--plat/marvell/a3700/common/plat_pm.c15
-rw-r--r--plat/marvell/a8k/a70x0/board/dram_port.c3
-rw-r--r--plat/marvell/a8k/a70x0_amc/board/dram_port.c3
-rw-r--r--plat/marvell/a8k/a80x0/board/dram_port.c7
-rw-r--r--plat/marvell/a8k/a80x0_mcbin/board/dram_port.c7
-rw-r--r--plat/marvell/a8k/a80x0_mcbin/board/marvell_plat_config.c5
-rw-r--r--plat/marvell/a8k/common/a8k_common.mk2
-rw-r--r--plat/marvell/a8k/common/aarch64/plat_arch_config.c9
-rw-r--r--plat/marvell/a8k/common/ble/ble.mk2
-rw-r--r--plat/marvell/a8k/common/ble/ble_main.c11
-rw-r--r--plat/marvell/a8k/common/include/platform_def.h10
-rw-r--r--plat/marvell/a8k/common/mss/mss_bl2_setup.c14
-rw-r--r--plat/marvell/a8k/common/mss/mss_pm_ipc.c7
-rw-r--r--plat/marvell/a8k/common/plat_bl1_setup.c3
-rw-r--r--plat/marvell/a8k/common/plat_bl31_setup.c12
-rw-r--r--plat/marvell/a8k/common/plat_ble_setup.c15
-rw-r--r--plat/marvell/a8k/common/plat_pm.c20
-rw-r--r--plat/marvell/a8k/common/plat_pm_trace.c5
-rw-r--r--plat/marvell/a8k/common/plat_thermal.c9
-rw-r--r--plat/marvell/common/aarch64/marvell_bl2_mem_params_desc.c8
-rw-r--r--plat/marvell/common/aarch64/marvell_common.c14
-rw-r--r--plat/marvell/common/aarch64/marvell_helpers.S8
-rw-r--r--plat/marvell/common/marvell_bl1_setup.c16
-rw-r--r--plat/marvell/common/marvell_bl2_setup.c19
-rw-r--r--plat/marvell/common/marvell_bl31_setup.c17
-rw-r--r--plat/marvell/common/marvell_cci.c3
-rw-r--r--plat/marvell/common/marvell_console.c13
-rw-r--r--plat/marvell/common/marvell_ddr_info.c6
-rw-r--r--plat/marvell/common/marvell_gicv2.c16
-rw-r--r--plat/marvell/common/marvell_gicv3.c12
-rw-r--r--plat/marvell/common/marvell_image_load.c7
-rw-r--r--plat/marvell/common/marvell_io_storage.c18
-rw-r--r--plat/marvell/common/marvell_pm.c6
-rw-r--r--plat/marvell/common/mrvl_sip_svc.c12
-rw-r--r--plat/marvell/common/mss/mss_ipc_drv.c8
-rw-r--r--plat/marvell/common/mss/mss_ipc_drv.h2
-rw-r--r--plat/marvell/common/mss/mss_scp_bootloader.c10
-rw-r--r--plat/marvell/common/plat_delay_timer.c3
-rw-r--r--plat/mediatek/common/custom/oem_svc.c15
-rw-r--r--plat/mediatek/common/mtk_plat_common.c16
-rw-r--r--plat/mediatek/common/mtk_plat_common.h5
-rw-r--r--plat/mediatek/common/mtk_sip_svc.c13
-rw-r--r--plat/mediatek/mt6795/bl31.ld.S2
-rw-r--r--plat/mediatek/mt6795/bl31_plat_setup.c29
-rw-r--r--plat/mediatek/mt6795/drivers/timer/mt_cpuxgpt.c10
-rw-r--r--plat/mediatek/mt6795/include/mcucfg.h3
-rw-r--r--plat/mediatek/mt6795/include/plat_macros.S2
-rw-r--r--plat/mediatek/mt6795/include/plat_private.h3
-rw-r--r--plat/mediatek/mt6795/include/platform_def.h2
-rw-r--r--plat/mediatek/mt6795/plat_delay_timer.c5
-rw-r--r--plat/mediatek/mt6795/plat_mt_gic.c7
-rw-r--r--plat/mediatek/mt6795/plat_pm.c19
-rw-r--r--plat/mediatek/mt6795/plat_topology.c5
-rw-r--r--plat/mediatek/mt6795/power_tracer.c3
-rw-r--r--plat/mediatek/mt6795/scu.c3
-rw-r--r--plat/mediatek/mt8173/aarch64/platform_common.c15
-rw-r--r--plat/mediatek/mt8173/bl31_plat_setup.c17
-rw-r--r--plat/mediatek/mt8173/drivers/crypt/crypt.c11
-rw-r--r--plat/mediatek/mt8173/drivers/mtcmos/mtcmos.c7
-rw-r--r--plat/mediatek/mt8173/drivers/pmic/pmic_wrap_init.c8
-rw-r--r--plat/mediatek/mt8173/drivers/rtc/rtc.c7
-rw-r--r--plat/mediatek/mt8173/drivers/spm/spm.c8
-rw-r--r--plat/mediatek/mt8173/drivers/spm/spm_hotplug.c6
-rw-r--r--plat/mediatek/mt8173/drivers/spm/spm_mcdi.c11
-rw-r--r--plat/mediatek/mt8173/drivers/spm/spm_suspend.c10
-rw-r--r--plat/mediatek/mt8173/drivers/timer/mt_cpuxgpt.c4
-rw-r--r--plat/mediatek/mt8173/include/mcucfg.h3
-rw-r--r--plat/mediatek/mt8173/include/plat_macros.S6
-rw-r--r--plat/mediatek/mt8173/include/platform_def.h7
-rw-r--r--plat/mediatek/mt8173/plat_mt_gic.c5
-rw-r--r--plat/mediatek/mt8173/plat_pm.c18
-rw-r--r--plat/mediatek/mt8173/plat_sip_calls.c8
-rw-r--r--plat/mediatek/mt8173/plat_topology.c5
-rw-r--r--plat/mediatek/mt8173/power_tracer.c3
-rw-r--r--plat/mediatek/mt8173/scu.c3
-rw-r--r--plat/meson/gxbb/gxbb_bl31_setup.c12
-rw-r--r--plat/meson/gxbb/gxbb_common.c18
-rw-r--r--plat/meson/gxbb/gxbb_def.h2
-rw-r--r--plat/meson/gxbb/gxbb_mhu.c5
-rw-r--r--plat/meson/gxbb/gxbb_pm.c16
-rw-r--r--plat/meson/gxbb/gxbb_scpi.c8
-rw-r--r--plat/meson/gxbb/gxbb_sip_svc.c10
-rw-r--r--plat/meson/gxbb/gxbb_topology.c6
-rw-r--r--plat/meson/gxbb/include/plat_macros.S2
-rw-r--r--plat/meson/gxbb/include/platform_def.h2
-rw-r--r--plat/meson/gxbb/platform.mk3
-rw-r--r--plat/nvidia/tegra/common/drivers/flowctrl/flowctrl.c10
-rw-r--r--plat/nvidia/tegra/common/drivers/memctrl/memctrl_v1.c14
-rw-r--r--plat/nvidia/tegra/common/drivers/memctrl/memctrl_v2.c16
-rw-r--r--plat/nvidia/tegra/common/drivers/pmc/pmc.c8
-rw-r--r--plat/nvidia/tegra/common/drivers/smmu/smmu.c9
-rw-r--r--plat/nvidia/tegra/common/tegra_bl31_setup.c29
-rw-r--r--plat/nvidia/tegra/common/tegra_delay_timer.c5
-rw-r--r--plat/nvidia/tegra/common/tegra_fiq_glue.c16
-rw-r--r--plat/nvidia/tegra/common/tegra_gicv2.c9
-rw-r--r--plat/nvidia/tegra/common/tegra_platform.c3
-rw-r--r--plat/nvidia/tegra/common/tegra_pm.c21
-rw-r--r--plat/nvidia/tegra/common/tegra_sip_calls.c14
-rw-r--r--plat/nvidia/tegra/common/tegra_topology.c5
-rw-r--r--plat/nvidia/tegra/include/drivers/flowctrl.h3
-rw-r--r--plat/nvidia/tegra/include/drivers/mce.h3
-rw-r--r--plat/nvidia/tegra/include/drivers/memctrl_v1.h3
-rw-r--r--plat/nvidia/tegra/include/drivers/memctrl_v2.h2
-rw-r--r--plat/nvidia/tegra/include/drivers/pmc.h5
-rw-r--r--plat/nvidia/tegra/include/drivers/smmu.h3
-rw-r--r--plat/nvidia/tegra/include/drivers/tegra_gic.h2
-rw-r--r--plat/nvidia/tegra/include/platform_def.h5
-rw-r--r--plat/nvidia/tegra/include/t132/tegra_def.h2
-rw-r--r--plat/nvidia/tegra/include/t186/tegra_def.h2
-rw-r--r--plat/nvidia/tegra/include/t210/tegra_def.h2
-rw-r--r--plat/nvidia/tegra/include/tegra_private.h8
-rw-r--r--plat/nvidia/tegra/soc/t132/plat_psci_handlers.c15
-rw-r--r--plat/nvidia/tegra/soc/t132/plat_secondary.c12
-rw-r--r--plat/nvidia/tegra/soc/t132/plat_setup.c5
-rw-r--r--plat/nvidia/tegra/soc/t132/plat_sip_calls.c12
-rw-r--r--plat/nvidia/tegra/soc/t186/drivers/include/mce_private.h3
-rw-r--r--plat/nvidia/tegra/soc/t186/drivers/mce/ari.c14
-rw-r--r--plat/nvidia/tegra/soc/t186/drivers/mce/mce.c16
-rw-r--r--plat/nvidia/tegra/soc/t186/drivers/mce/nvg.c8
-rw-r--r--plat/nvidia/tegra/soc/t186/plat_memctrl.c3
-rw-r--r--plat/nvidia/tegra/soc/t186/plat_psci_handlers.c16
-rw-r--r--plat/nvidia/tegra/soc/t186/plat_secondary.c8
-rw-r--r--plat/nvidia/tegra/soc/t186/plat_setup.c26
-rw-r--r--plat/nvidia/tegra/soc/t186/plat_sip_calls.c14
-rw-r--r--plat/nvidia/tegra/soc/t186/plat_smmu.c3
-rw-r--r--plat/nvidia/tegra/soc/t186/plat_trampoline.S2
-rw-r--r--plat/nvidia/tegra/soc/t210/plat_psci_handlers.c17
-rw-r--r--plat/nvidia/tegra/soc/t210/plat_secondary.c5
-rw-r--r--plat/nvidia/tegra/soc/t210/plat_setup.c7
-rw-r--r--plat/qemu/dt.c12
-rw-r--r--plat/qemu/include/platform_def.h6
-rw-r--r--plat/qemu/qemu_bl1_setup.c9
-rw-r--r--plat/qemu/qemu_bl2_mem_params_desc.c5
-rw-r--r--plat/qemu/qemu_bl2_setup.c21
-rw-r--r--plat/qemu/qemu_bl31_setup.c11
-rw-r--r--plat/qemu/qemu_common.c7
-rw-r--r--plat/qemu/qemu_console.c6
-rw-r--r--plat/qemu/qemu_image_load.c2
-rw-r--r--plat/qemu/qemu_io_storage.c22
-rw-r--r--plat/qemu/qemu_pm.c12
-rw-r--r--plat/qemu/qemu_stack_protector.c5
-rw-r--r--plat/qemu/qemu_trusted_boot.c2
-rw-r--r--plat/qemu/sp_min/sp_min_setup.c23
-rw-r--r--plat/qemu/topology.c7
-rw-r--r--plat/renesas/rcar/aarch64/plat_helpers.S5
-rw-r--r--plat/renesas/rcar/aarch64/platform_common.c20
-rw-r--r--plat/renesas/rcar/bl2_cpg_init.c5
-rw-r--r--plat/renesas/rcar/bl2_interrupt_error.c11
-rw-r--r--plat/renesas/rcar/bl2_plat_mem_params_desc.c9
-rw-r--r--plat/renesas/rcar/bl2_plat_setup.c23
-rw-r--r--plat/renesas/rcar/bl2_secure_setting.c5
-rw-r--r--plat/renesas/rcar/bl31_plat_setup.c18
-rw-r--r--plat/renesas/rcar/include/plat.ld.S2
-rw-r--r--plat/renesas/rcar/include/plat_macros.S7
-rw-r--r--plat/renesas/rcar/include/platform_def.h4
-rw-r--r--plat/renesas/rcar/include/rcar_def.h4
-rw-r--r--plat/renesas/rcar/include/rcar_private.h7
-rw-r--r--plat/renesas/rcar/plat_image_load.c6
-rw-r--r--plat/renesas/rcar/plat_pm.c20
-rw-r--r--plat/renesas/rcar/plat_storage.c13
-rw-r--r--plat/renesas/rcar/plat_topology.c5
-rw-r--r--plat/rockchip/common/aarch64/plat_helpers.S5
-rw-r--r--plat/rockchip/common/aarch64/platform_common.c17
-rw-r--r--plat/rockchip/common/bl31_plat_setup.c20
-rw-r--r--plat/rockchip/common/drivers/parameter/ddr_parameter.c16
-rw-r--r--plat/rockchip/common/drivers/parameter/ddr_parameter.h15
-rw-r--r--plat/rockchip/common/include/plat_macros.S8
-rw-r--r--plat/rockchip/common/include/plat_private.h8
-rw-r--r--plat/rockchip/common/params_setup.c18
-rw-r--r--plat/rockchip/common/plat_pm.c15
-rw-r--r--plat/rockchip/common/plat_topology.c6
-rw-r--r--plat/rockchip/common/rockchip_gicv2.c9
-rw-r--r--plat/rockchip/common/rockchip_gicv3.c11
-rw-r--r--plat/rockchip/common/rockchip_sip_svc.c10
-rw-r--r--plat/rockchip/rk3328/drivers/pmu/pmu.c21
-rw-r--r--plat/rockchip/rk3328/drivers/soc/soc.c12
-rw-r--r--plat/rockchip/rk3328/include/platform_def.h3
-rw-r--r--plat/rockchip/rk3368/drivers/ddr/ddr_rk3368.c13
-rw-r--r--plat/rockchip/rk3368/drivers/pmu/pmu.c17
-rw-r--r--plat/rockchip/rk3368/drivers/soc/soc.c8
-rw-r--r--plat/rockchip/rk3368/include/platform_def.h5
-rw-r--r--plat/rockchip/rk3368/plat_sip_calls.c7
-rw-r--r--plat/rockchip/rk3399/drivers/dp/cdn_dp.c6
-rw-r--r--plat/rockchip/rk3399/drivers/dram/dfs.c7
-rw-r--r--plat/rockchip/rk3399/drivers/dram/dram.h3
-rw-r--r--plat/rockchip/rk3399/drivers/dram/dram_spec_timing.c7
-rw-r--r--plat/rockchip/rk3399/drivers/dram/suspend.c6
-rw-r--r--plat/rockchip/rk3399/drivers/gpio/rk3399_gpio.c16
-rw-r--r--plat/rockchip/rk3399/drivers/pmu/m0_ctl.c10
-rw-r--r--plat/rockchip/rk3399/drivers/pmu/pmu.c27
-rw-r--r--plat/rockchip/rk3399/drivers/secure/secure.c8
-rw-r--r--plat/rockchip/rk3399/drivers/soc/soc.c13
-rw-r--r--plat/rockchip/rk3399/drivers/soc/soc.h2
-rw-r--r--plat/rockchip/rk3399/include/plat.ld.S2
-rw-r--r--plat/rockchip/rk3399/include/platform_def.h5
-rw-r--r--plat/rockchip/rk3399/plat_sip_calls.c7
-rw-r--r--plat/rpi3/aarch64/rpi3_bl2_mem_params_desc.c7
-rw-r--r--plat/rpi3/include/platform_def.h6
-rw-r--r--plat/rpi3/rpi3_bl1_setup.c11
-rw-r--r--plat/rpi3/rpi3_bl2_setup.c16
-rw-r--r--plat/rpi3/rpi3_bl31_setup.c11
-rw-r--r--plat/rpi3/rpi3_common.c16
-rw-r--r--plat/rpi3/rpi3_hw.h2
-rw-r--r--plat/rpi3/rpi3_image_load.c7
-rw-r--r--plat/rpi3/rpi3_io_storage.c16
-rw-r--r--plat/rpi3/rpi3_mbox.c8
-rw-r--r--plat/rpi3/rpi3_pm.c14
-rw-r--r--plat/rpi3/rpi3_rng.c3
-rw-r--r--plat/rpi3/rpi3_stack_protector.c3
-rw-r--r--plat/rpi3/rpi3_topology.c6
-rw-r--r--plat/rpi3/rpi3_trusted_boot.c2
-rw-r--r--plat/socionext/synquacer/drivers/mhu/sq_mhu.c9
-rw-r--r--plat/socionext/synquacer/drivers/scpi/sq_scpi.c9
-rw-r--r--plat/socionext/synquacer/include/platform_def.h4
-rw-r--r--plat/socionext/synquacer/include/sq_common.h3
-rw-r--r--plat/socionext/synquacer/sq_bl31_setup.c15
-rw-r--r--plat/socionext/synquacer/sq_ccn.c5
-rw-r--r--plat/socionext/synquacer/sq_gicv3.c8
-rw-r--r--plat/socionext/synquacer/sq_psci.c15
-rw-r--r--plat/socionext/synquacer/sq_topology.c4
-rw-r--r--plat/socionext/synquacer/sq_xlat_setup.c5
-rw-r--r--plat/socionext/uniphier/include/platform_def.h6
-rw-r--r--plat/socionext/uniphier/tsp/uniphier_tsp_setup.c3
-rw-r--r--plat/socionext/uniphier/uniphier_bl2_setup.c16
-rw-r--r--plat/socionext/uniphier/uniphier_bl31_setup.c16
-rw-r--r--plat/socionext/uniphier/uniphier_boot_device.c5
-rw-r--r--plat/socionext/uniphier/uniphier_cci.c7
-rw-r--r--plat/socionext/uniphier/uniphier_emmc.c12
-rw-r--r--plat/socionext/uniphier/uniphier_gicv3.c8
-rw-r--r--plat/socionext/uniphier/uniphier_image_desc.c6
-rw-r--r--plat/socionext/uniphier/uniphier_io_storage.c18
-rw-r--r--plat/socionext/uniphier/uniphier_nand.c14
-rw-r--r--plat/socionext/uniphier/uniphier_psci.c6
-rw-r--r--plat/socionext/uniphier/uniphier_scp.c4
-rw-r--r--plat/socionext/uniphier/uniphier_soc_info.c2
-rw-r--r--plat/socionext/uniphier/uniphier_syscnt.c2
-rw-r--r--plat/socionext/uniphier/uniphier_tbbr.c2
-rw-r--r--plat/socionext/uniphier/uniphier_topology.c2
-rw-r--r--plat/socionext/uniphier/uniphier_usb.c12
-rw-r--r--plat/socionext/uniphier/uniphier_xlat_setup.c5
-rw-r--r--plat/st/stm32mp1/bl2_io_storage.c37
-rw-r--r--plat/st/stm32mp1/bl2_plat_setup.c39
-rw-r--r--plat/st/stm32mp1/include/platform_def.h7
-rw-r--r--plat/st/stm32mp1/plat_bl2_mem_params_desc.c7
-rw-r--r--plat/st/stm32mp1/plat_image_load.c4
-rw-r--r--plat/st/stm32mp1/platform.mk3
-rw-r--r--plat/st/stm32mp1/sp_min/sp_min_setup.c29
-rw-r--r--plat/st/stm32mp1/stm32mp1.ld.S2
-rw-r--r--plat/st/stm32mp1/stm32mp1_common.c17
-rw-r--r--plat/st/stm32mp1/stm32mp1_context.c9
-rw-r--r--plat/st/stm32mp1/stm32mp1_def.h6
-rw-r--r--plat/st/stm32mp1/stm32mp1_dt.c16
-rw-r--r--plat/st/stm32mp1/stm32mp1_gic.c9
-rw-r--r--plat/st/stm32mp1/stm32mp1_helper.S9
-rw-r--r--plat/st/stm32mp1/stm32mp1_pm.c25
-rw-r--r--plat/st/stm32mp1/stm32mp1_security.c17
-rw-r--r--plat/st/stm32mp1/stm32mp1_stack_protector.c5
-rw-r--r--plat/st/stm32mp1/stm32mp1_topology.c5
-rw-r--r--plat/ti/k3/board/generic/include/board_def.h2
-rw-r--r--plat/ti/k3/common/drivers/sec_proxy/sec_proxy.c14
-rw-r--r--plat/ti/k3/common/drivers/ti_sci/ti_sci.c5
-rw-r--r--plat/ti/k3/common/k3_bl31_setup.c15
-rw-r--r--plat/ti/k3/common/k3_console.c8
-rw-r--r--plat/ti/k3/common/k3_gicv3.c14
-rw-r--r--plat/ti/k3/common/k3_psci.c18
-rw-r--r--plat/ti/k3/common/k3_topology.c3
-rw-r--r--plat/ti/k3/include/platform_def.h3
-rw-r--r--plat/xilinx/versal/aarch64/versal_common.c11
-rw-r--r--plat/xilinx/versal/aarch64/versal_helpers.S2
-rw-r--r--plat/xilinx/versal/bl31_versal_setup.c16
-rw-r--r--plat/xilinx/versal/include/plat_macros.S7
-rw-r--r--plat/xilinx/versal/include/platform_def.h1
-rw-r--r--plat/xilinx/versal/plat_psci.c9
-rw-r--r--plat/xilinx/versal/plat_versal.c4
-rw-r--r--plat/xilinx/versal/sip_svc_setup.c6
-rw-r--r--plat/xilinx/versal/versal_def.h2
-rw-r--r--plat/xilinx/versal/versal_gicv3.c10
-rw-r--r--plat/xilinx/versal/versal_private.h2
-rw-r--r--plat/xilinx/zynqmp/aarch64/zynqmp_common.c12
-rw-r--r--plat/xilinx/zynqmp/aarch64/zynqmp_helpers.S2
-rw-r--r--plat/xilinx/zynqmp/bl31_zynqmp_setup.c12
-rw-r--r--plat/xilinx/zynqmp/include/platform_def.h7
-rw-r--r--plat/xilinx/zynqmp/ipi_mailbox_service/ipi_mailbox_svc.c10
-rw-r--r--plat/xilinx/zynqmp/plat_psci.c14
-rw-r--r--plat/xilinx/zynqmp/plat_startup.c8
-rw-r--r--plat/xilinx/zynqmp/plat_zynqmp.c3
-rw-r--r--plat/xilinx/zynqmp/pm_service/pm_api_clock.c8
-rw-r--r--plat/xilinx/zynqmp/pm_service/pm_api_clock.h3
-rw-r--r--plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c7
-rw-r--r--plat/xilinx/zynqmp/pm_service/pm_api_pinctrl.c6
-rw-r--r--plat/xilinx/zynqmp/pm_service/pm_api_sys.c3
-rw-r--r--plat/xilinx/zynqmp/pm_service/pm_api_sys.h1
-rw-r--r--plat/xilinx/zynqmp/pm_service/pm_client.c14
-rw-r--r--plat/xilinx/zynqmp/pm_service/pm_common.h4
-rw-r--r--plat/xilinx/zynqmp/pm_service/pm_ipi.c7
-rw-r--r--plat/xilinx/zynqmp/pm_service/pm_svc_main.c18
-rw-r--r--plat/xilinx/zynqmp/sip_svc_setup.c5
-rw-r--r--plat/xilinx/zynqmp/tsp/tsp_plat_setup.c8
-rw-r--r--plat/xilinx/zynqmp/zynqmp_def.h2
-rw-r--r--plat/xilinx/zynqmp/zynqmp_ipi.c10
-rw-r--r--plat/xilinx/zynqmp/zynqmp_private.h5
555 files changed, 2952 insertions, 2125 deletions
diff --git a/plat/allwinner/common/include/platform_def.h b/plat/allwinner/common/include/platform_def.h
index 08eb5cf2b..ede3881a7 100644
--- a/plat/allwinner/common/include/platform_def.h
+++ b/plat/allwinner/common/include/platform_def.h
@@ -7,10 +7,11 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
-#include <common_def.h>
+#include <common/tbbr/tbbr_img_def.h>
+#include <lib/utils_def.h>
+#include <plat/common/common_def.h>
+
#include <sunxi_mmap.h>
-#include <tbbr/tbbr_img_def.h>
-#include <utils_def.h>
#define BL31_BASE SUNXI_SRAM_A2_BASE
#define BL31_LIMIT (SUNXI_SRAM_A2_BASE + SUNXI_SRAM_A2_SIZE)
diff --git a/plat/allwinner/common/sunxi_bl31_setup.c b/plat/allwinner/common/sunxi_bl31_setup.c
index 2c6632912..7ffa65821 100644
--- a/plat/allwinner/common/sunxi_bl31_setup.c
+++ b/plat/allwinner/common/sunxi_bl31_setup.c
@@ -4,20 +4,24 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
#include <assert.h>
-#include <console.h>
-#include <debug.h>
-#include <generic_delay_timer.h>
-#include <gicv2.h>
+
#include <libfdt.h>
-#include <mmio.h>
-#include <platform.h>
+
#include <platform_def.h>
+
+#include <arch.h>
+#include <common/debug.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/console.h>
+#include <drivers/generic_delay_timer.h>
+#include <drivers/ti/uart/uart_16550.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include <sunxi_def.h>
#include <sunxi_mmap.h>
#include <sunxi_private.h>
-#include <uart_16550.h>
static entry_point_info_t bl32_image_ep_info;
diff --git a/plat/allwinner/common/sunxi_common.c b/plat/allwinner/common/sunxi_common.c
index 2eb26a91b..6bb8968ce 100644
--- a/plat/allwinner/common/sunxi_common.c
+++ b/plat/allwinner/common/sunxi_common.c
@@ -4,16 +4,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <debug.h>
#include <errno.h>
-#include <mmio.h>
-#include <platform.h>
+
#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
+#include <plat/common/platform.h>
+
#include <sunxi_def.h>
#include <sunxi_mmap.h>
#include <sunxi_private.h>
-#include <xlat_tables_v2.h>
static mmap_region_t sunxi_mmap[PLATFORM_MMAP_REGIONS + 1] = {
MAP_REGION_FLAT(SUNXI_SRAM_BASE, SUNXI_SRAM_SIZE,
diff --git a/plat/allwinner/common/sunxi_cpu_ops.c b/plat/allwinner/common/sunxi_cpu_ops.c
index 3b732b5d1..8c086030a 100644
--- a/plat/allwinner/common/sunxi_cpu_ops.c
+++ b/plat/allwinner/common/sunxi_cpu_ops.c
@@ -4,18 +4,21 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <core_off_arisc.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <mmio.h>
-#include <platform.h>
+
#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+#include <lib/utils_def.h>
+#include <plat/common/platform.h>
+
+#include <core_off_arisc.h>
#include <sunxi_cpucfg.h>
#include <sunxi_mmap.h>
#include <sunxi_private.h>
-#include <utils_def.h>
static void sunxi_cpu_disable_power(unsigned int cluster, unsigned int core)
{
diff --git a/plat/allwinner/common/sunxi_pm.c b/plat/allwinner/common/sunxi_pm.c
index 7d13cdad1..8cc715c27 100644
--- a/plat/allwinner/common/sunxi_pm.c
+++ b/plat/allwinner/common/sunxi_pm.c
@@ -4,15 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <gicv2.h>
-#include <mmio.h>
-#include <platform.h>
+
#include <platform_def.h>
-#include <psci.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
+
#include <sunxi_cpucfg.h>
#include <sunxi_mmap.h>
#include <sunxi_private.h>
diff --git a/plat/allwinner/common/sunxi_security.c b/plat/allwinner/common/sunxi_security.c
index 905372887..1f16a0b72 100644
--- a/plat/allwinner/common/sunxi_security.c
+++ b/plat/allwinner/common/sunxi_security.c
@@ -4,8 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+
#include <sunxi_mmap.h>
#include <sunxi_private.h>
diff --git a/plat/allwinner/common/sunxi_topology.c b/plat/allwinner/common/sunxi_topology.c
index 98cf63c8c..7acc77a9a 100644
--- a/plat/allwinner/common/sunxi_topology.c
+++ b/plat/allwinner/common/sunxi_topology.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
-#include <platform.h>
#include <platform_def.h>
+#include <arch.h>
+#include <plat/common/platform.h>
+
static unsigned char plat_power_domain_tree_desc[PLAT_MAX_PWR_LVL + 1] = {
/* One root node for the SoC */
1,
diff --git a/plat/allwinner/sun50i_a64/sunxi_power.c b/plat/allwinner/sun50i_a64/sunxi_power.c
index 59feed789..706bfcecb 100644
--- a/plat/allwinner/sun50i_a64/sunxi_power.c
+++ b/plat/allwinner/sun50i_a64/sunxi_power.c
@@ -5,14 +5,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <allwinner/sunxi_rsb.h>
-#include <arch_helpers.h>
-#include <debug.h>
-#include <delay_timer.h>
#include <errno.h>
+
#include <libfdt.h>
-#include <mmio.h>
+
#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/allwinner/sunxi_rsb.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <sunxi_def.h>
#include <sunxi_mmap.h>
#include <sunxi_private.h>
diff --git a/plat/allwinner/sun50i_h6/sunxi_power.c b/plat/allwinner/sun50i_h6/sunxi_power.c
index 7bdac8ab0..5b5bad177 100644
--- a/plat/allwinner/sun50i_h6/sunxi_power.c
+++ b/plat/allwinner/sun50i_h6/sunxi_power.c
@@ -5,13 +5,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <debug.h>
-#include <delay_timer.h>
#include <errno.h>
-#include <mmio.h>
-#include <mentor/mi2cv.h>
#include <string.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <drivers/mentor/mi2cv.h>
+#include <lib/mmio.h>
+
#include <sunxi_def.h>
#include <sunxi_mmap.h>
#include <sunxi_private.h>
diff --git a/plat/arm/board/common/aarch32/board_arm_helpers.S b/plat/arm/board/common/aarch32/board_arm_helpers.S
index d64da292a..320bfb3c3 100644
--- a/plat/arm/board/common/aarch32/board_arm_helpers.S
+++ b/plat/arm/board/common/aarch32/board_arm_helpers.S
@@ -3,8 +3,9 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <asm_macros.S>
-#include <bl_common.h>
+#include <common/bl_common.h>
#include <v2m_def.h>
.globl plat_report_exception
diff --git a/plat/arm/board/common/aarch64/board_arm_helpers.S b/plat/arm/board/common/aarch64/board_arm_helpers.S
index 4385e62ba..5a905244f 100644
--- a/plat/arm/board/common/aarch64/board_arm_helpers.S
+++ b/plat/arm/board/common/aarch64/board_arm_helpers.S
@@ -3,8 +3,9 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <asm_macros.S>
-#include <bl_common.h>
+#include <common/bl_common.h>
#include <v2m_def.h>
.globl plat_report_exception
diff --git a/plat/arm/board/common/board_arm_trusted_boot.c b/plat/arm/board/common/board_arm_trusted_boot.c
index 6c03c91b5..64ca3c36d 100644
--- a/plat/arm/board/common/board_arm_trusted_boot.c
+++ b/plat/arm/board/common/board_arm_trusted_boot.c
@@ -4,13 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arm_def.h>
#include <assert.h>
-#include <cassert.h>
-#include <platform.h>
#include <stdint.h>
#include <string.h>
-#include <tbbr_oid.h>
+
+#include <lib/cassert.h>
+#include <plat/common/platform.h>
+#include <tools_share/tbbr_oid.h>
+
+#include <arm_def.h>
/* SHA256 algorithm */
#define SHA256_BYTES 32
@@ -180,9 +182,9 @@ int plat_set_nv_ctr(void *cookie, unsigned int nv_ctr)
}
#else /* ARM_CRYPTOCELL_INTEG */
-#include <nvm.h>
-#include <nvm_otp.h>
-#include <sbrom_bsv_api.h>
+#include <drivers/arm/cryptocell/nvm.h>
+#include <drivers/arm/cryptocell/nvm_otp.h>
+#include <drivers/arm/cryptocell/sbrom_bsv_api.h>
CASSERT(HASH_RESULT_SIZE_IN_BYTES == SHA256_BYTES,
assert_mismatch_in_hash_result_size);
diff --git a/plat/arm/board/common/board_common.mk b/plat/arm/board/common/board_common.mk
index 2556fc04a..487aad739 100644
--- a/plat/arm/board/common/board_common.mk
+++ b/plat/arm/board/common/board_common.mk
@@ -4,8 +4,7 @@
# SPDX-License-Identifier: BSD-3-Clause
#
-PLAT_INCLUDES += -Iinclude/drivers/cfi/ \
- -Iinclude/plat/arm/board/common/
+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/aarch64/fvp_helpers.S b/plat/arm/board/fvp/aarch64/fvp_helpers.S
index abc3ceb00..0f905151b 100644
--- a/plat/arm/board/fvp/aarch64/fvp_helpers.S
+++ b/plat/arm/board/fvp/aarch64/fvp_helpers.S
@@ -6,8 +6,8 @@
#include <arch.h>
#include <asm_macros.S>
-#include <gicv2.h>
-#include <gicv3.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/arm/gicv3.h>
#include <platform_def.h>
#include <v2m_def.h>
#include "../drivers/pwrc/fvp_pwrc.h"
diff --git a/plat/arm/board/fvp/aarch64/fvp_ras.c b/plat/arm/board/fvp/aarch64/fvp_ras.c
index fb80a8a0b..759f6d0d8 100644
--- a/plat/arm/board/fvp/aarch64/fvp_ras.c
+++ b/plat/arm/board/fvp/aarch64/fvp_ras.c
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <ras.h>
+#include <lib/extensions/ras.h>
struct ras_interrupt fvp_ras_interrupts[] = {
};
diff --git a/plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c b/plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c
index b17446c10..c48bb07a3 100644
--- a/plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c
+++ b/plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c
@@ -4,9 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bakery_lock.h>
-#include <mmio.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+
#include <plat_arm.h>
+
#include "../../fvp_def.h"
#include "../../fvp_private.h"
#include "fvp_pwrc.h"
diff --git a/plat/arm/board/fvp/fvp_bl1_setup.c b/plat/arm/board/fvp/fvp_bl1_setup.c
index 4b2a340b0..d6e82f50d 100644
--- a/plat/arm/board/fvp/fvp_bl1_setup.c
+++ b/plat/arm/board/fvp/fvp_bl1_setup.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <common/tbbr/tbbr_img_def.h>
+#include <plat/common/platform.h>
+
#include <plat_arm.h>
-#include <platform.h>
-#include <tbbr_img_def.h>
-#include "fvp_private.h"
+#include "fvp_private.h"
/*******************************************************************************
* Perform any BL1 specific platform actions.
diff --git a/plat/arm/board/fvp/fvp_bl2_setup.c b/plat/arm/board/fvp/fvp_bl2_setup.c
index 0a3b67d39..13e74fd9a 100644
--- a/plat/arm/board/fvp/fvp_bl2_setup.c
+++ b/plat/arm/board/fvp/fvp_bl2_setup.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <generic_delay_timer.h>
-#include <mmio.h>
+#include <drivers/arm/sp804_delay_timer.h>
+#include <drivers/generic_delay_timer.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include <plat_arm.h>
-#include <platform.h>
-#include <sp804_delay_timer.h>
#include <v2m_def.h>
#include "fvp_def.h"
#include "fvp_private.h"
diff --git a/plat/arm/board/fvp/fvp_bl2u_setup.c b/plat/arm/board/fvp/fvp_bl2u_setup.c
index b9ab3f36e..c51e287f6 100644
--- a/plat/arm/board/fvp/fvp_bl2u_setup.c
+++ b/plat/arm/board/fvp/fvp_bl2u_setup.c
@@ -4,8 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <plat/common/platform.h>
+
#include <plat_arm.h>
-#include <platform.h>
#include "fvp_def.h"
#include "fvp_private.h"
diff --git a/plat/arm/board/fvp/fvp_bl31_setup.c b/plat/arm/board/fvp/fvp_bl31_setup.c
index 1c8804f10..5f2121c52 100644
--- a/plat/arm/board/fvp/fvp_bl31_setup.c
+++ b/plat/arm/board/fvp/fvp_bl31_setup.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <drivers/arm/smmu_v3.h>
+#include <plat/common/platform.h>
+
#include <arm_config.h>
#include <plat_arm.h>
-#include <platform.h>
-#include <smmu_v3.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 f36b637ef..31a61de4e 100644
--- a/plat/arm/board/fvp/fvp_common.c
+++ b/plat/arm/board/fvp/fvp_common.c
@@ -4,20 +4,22 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <assert.h>
+
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/arm/ccn.h>
+#include <drivers/arm/gicv2.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables_compat.h>
+#include <plat/common/platform.h>
+#include <services/secure_partition.h>
+
#include <arm_config.h>
#include <arm_def.h>
#include <arm_spm_def.h>
-#include <assert.h>
-#include <cci.h>
-#include <ccn.h>
-#include <debug.h>
-#include <gicv2.h>
-#include <mmio.h>
#include <plat_arm.h>
-#include <platform.h>
-#include <secure_partition.h>
#include <v2m_def.h>
-#include <xlat_tables_compat.h>
#include "../fvp_def.h"
#include "fvp_private.h"
diff --git a/plat/arm/board/fvp/fvp_def.h b/plat/arm/board/fvp/fvp_def.h
index a8ed9d324..1b9f84b00 100644
--- a/plat/arm/board/fvp/fvp_def.h
+++ b/plat/arm/board/fvp/fvp_def.h
@@ -7,7 +7,7 @@
#ifndef FVP_DEF_H
#define FVP_DEF_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
#ifndef FVP_CLUSTER_COUNT
#define FVP_CLUSTER_COUNT 2
diff --git a/plat/arm/board/fvp/fvp_io_storage.c b/plat/arm/board/fvp/fvp_io_storage.c
index 11c7c3bcd..e186b3083 100644
--- a/plat/arm/board/fvp/fvp_io_storage.c
+++ b/plat/arm/board/fvp/fvp_io_storage.c
@@ -5,13 +5,15 @@
*/
#include <assert.h>
-#include <common_def.h>
-#include <debug.h>
-#include <io_driver.h>
-#include <io_semihosting.h>
-#include <io_storage.h>
+
+#include <common/debug.h>
+#include <drivers/io/io_driver.h>
+#include <drivers/io/io_semihosting.h>
+#include <drivers/io/io_storage.h>
+#include <lib/semihosting.h>
+#include <plat/common/common_def.h>
+
#include <plat_arm.h>
-#include <semihosting.h> /* For FOPEN_MODE_... */
/* Semihosting filenames */
#define BL2_IMAGE_NAME "bl2.bin"
diff --git a/plat/arm/board/fvp/fvp_pm.c b/plat/arm/board/fvp/fvp_pm.c
index 78d302555..7da246bd6 100644
--- a/plat/arm/board/fvp/fvp_pm.c
+++ b/plat/arm/board/fvp/fvp_pm.c
@@ -4,18 +4,21 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <arm_config.h>
#include <assert.h>
-#include <debug.h>
#include <errno.h>
-#include <gicv3.h>
-#include <mmio.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/arm/gicv3.h>
+#include <lib/extensions/spe.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
+
+#include <arm_config.h>
#include <plat_arm.h>
-#include <platform.h>
-#include <psci.h>
-#include <spe.h>
#include <v2m_def.h>
+
#include "../../../../drivers/arm/gic/v3/gicv3_private.h"
#include "drivers/pwrc/fvp_pwrc.h"
#include "fvp_def.h"
diff --git a/plat/arm/board/fvp/fvp_stack_protector.c b/plat/arm/board/fvp/fvp_stack_protector.c
index 1e8e3010f..e940a1291 100644
--- a/plat/arm/board/fvp/fvp_stack_protector.c
+++ b/plat/arm/board/fvp/fvp_stack_protector.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <platform.h>
#include <stdint.h>
+#include <arch_helpers.h>
+#include <plat/common/platform.h>
+
#define RANDOM_CANARY_VALUE ((u_register_t) 3288484550995823360ULL)
u_register_t plat_get_stack_protector_canary(void)
diff --git a/plat/arm/board/fvp/fvp_topology.c b/plat/arm/board/fvp/fvp_topology.c
index e21b9d28c..3384a2f70 100644
--- a/plat/arm/board/fvp/fvp_topology.c
+++ b/plat/arm/board/fvp/fvp_topology.c
@@ -4,12 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include <arch.h>
-#include <arm_config.h>
-#include <cassert.h>
+#include <lib/cassert.h>
+#include <plat/common/platform.h>
+
#include <plat_arm.h>
-#include <platform.h>
-#include <platform_def.h>
+#include <arm_config.h>
#include "drivers/pwrc/fvp_pwrc.h"
/* The FVP power domain tree descriptor */
diff --git a/plat/arm/board/fvp/fvp_trusted_boot.c b/plat/arm/board/fvp/fvp_trusted_boot.c
index 39be4a6e7..c18bfb213 100644
--- a/plat/arm/board/fvp/fvp_trusted_boot.c
+++ b/plat/arm/board/fvp/fvp_trusted_boot.c
@@ -7,8 +7,9 @@
#include <assert.h>
#include <stdint.h>
#include <string.h>
-#include <platform.h>
-#include <tbbr_oid.h>
+
+#include <plat/common/platform.h>
+#include <tools_share/tbbr_oid.h>
#include "fvp_def.h"
diff --git a/plat/arm/board/fvp/include/platform_def.h b/plat/arm/board/fvp/include/platform_def.h
index 3097f909b..ca4bd5399 100644
--- a/plat/arm/board/fvp/include/platform_def.h
+++ b/plat/arm/board/fvp/include/platform_def.h
@@ -18,12 +18,14 @@
# endif
#endif /* AARCH32 */
+#include <drivers/arm/tzc400.h>
+#include <lib/utils_def.h>
+#include <plat/common/common_def.h>
+
#include <arm_def.h>
#include <arm_spm_def.h>
-#include <common_def.h>
-#include <tzc400.h>
-#include <utils_def.h>
#include <v2m_def.h>
+
#include "../fvp_def.h"
/* Required platform porting definitions */
diff --git a/plat/arm/board/juno/aarch32/juno_helpers.S b/plat/arm/board/juno/aarch32/juno_helpers.S
index 1bc4e309a..080a8ddcc 100644
--- a/plat/arm/board/juno/aarch32/juno_helpers.S
+++ b/plat/arm/board/juno/aarch32/juno_helpers.S
@@ -6,7 +6,7 @@
#include <arch.h>
#include <asm_macros.S>
-#include <bl_common.h>
+#include <common/bl_common.h>
#include <cortex_a53.h>
#include <cortex_a57.h>
#include <cortex_a72.h>
diff --git a/plat/arm/board/juno/aarch64/juno_helpers.S b/plat/arm/board/juno/aarch64/juno_helpers.S
index edcfc7449..373f2fc89 100644
--- a/plat/arm/board/juno/aarch64/juno_helpers.S
+++ b/plat/arm/board/juno/aarch64/juno_helpers.S
@@ -6,7 +6,7 @@
#include <arch.h>
#include <asm_macros.S>
-#include <bl_common.h>
+#include <common/bl_common.h>
#include <cortex_a53.h>
#include <cortex_a57.h>
#include <cortex_a72.h>
diff --git a/plat/arm/board/juno/include/platform_def.h b/plat/arm/board/juno/include/platform_def.h
index 8098bc3fe..ed82879af 100644
--- a/plat/arm/board/juno/include/platform_def.h
+++ b/plat/arm/board/juno/include/platform_def.h
@@ -19,15 +19,16 @@
#endif /* AARCH32 */
+#include <drivers/arm/tzc400.h>
+#if TRUSTED_BOARD_BOOT
+#include <drivers/auth/mbedtls/mbedtls_config.h>
+#endif
+#include <plat/common/common_def.h>
+
#include <arm_def.h>
#include <board_css_def.h>
-#include <common_def.h>
#include <css_def.h>
-#if TRUSTED_BOARD_BOOT
-#include <mbedtls_config.h>
-#endif
#include <soc_css_def.h>
-#include <tzc400.h>
#include <v2m_def.h>
#include "../juno_def.h"
diff --git a/plat/arm/board/juno/juno_bl1_setup.c b/plat/arm/board/juno/juno_bl1_setup.c
index 3dd2a227c..e751ab69c 100644
--- a/plat/arm/board/juno/juno_bl1_setup.c
+++ b/plat/arm/board/juno/juno_bl1_setup.c
@@ -4,14 +4,16 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <debug.h>
#include <errno.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/tbbr/tbbr_img_def.h>
+#include <drivers/arm/sp805.h>
+#include <plat/common/platform.h>
+
#include <plat_arm.h>
-#include <platform.h>
#include <sds.h>
-#include <sp805.h>
-#include <tbbr_img_def.h>
#include <v2m_def.h>
void juno_reset_to_aarch32_state(void);
diff --git a/plat/arm/board/juno/juno_bl2_setup.c b/plat/arm/board/juno/juno_bl2_setup.c
index 1f483d63d..56f05eb18 100644
--- a/plat/arm/board/juno/juno_bl2_setup.c
+++ b/plat/arm/board/juno/juno_bl2_setup.c
@@ -5,8 +5,10 @@
*/
#include <assert.h>
-#include <bl_common.h>
-#include <desc_image_load.h>
+
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+
#include <plat_arm.h>
#if JUNO_AARCH32_EL3_RUNTIME
diff --git a/plat/arm/board/juno/juno_def.h b/plat/arm/board/juno/juno_def.h
index 5301886fb..7a8bedf5a 100644
--- a/plat/arm/board/juno/juno_def.h
+++ b/plat/arm/board/juno/juno_def.h
@@ -7,7 +7,7 @@
#ifndef JUNO_DEF_H
#define JUNO_DEF_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
/*******************************************************************************
* Juno memory map related constants
diff --git a/plat/arm/board/juno/juno_err.c b/plat/arm/board/juno/juno_err.c
index dd8e27881..69daa1ae0 100644
--- a/plat/arm/board/juno/juno_err.c
+++ b/plat/arm/board/juno/juno_err.c
@@ -4,9 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <errno.h>
-#include <platform.h>
+
+#include <arch_helpers.h>
+#include <plat/common/platform.h>
+
#include <v2m_def.h>
/*
diff --git a/plat/arm/board/juno/juno_security.c b/plat/arm/board/juno/juno_security.c
index b6cfe7817..b0df83791 100644
--- a/plat/arm/board/juno/juno_security.c
+++ b/plat/arm/board/juno/juno_security.c
@@ -4,12 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <mmio.h>
-#include <nic_400.h>
+#include <common/debug.h>
+#include <drivers/arm/nic_400.h>
+#include <lib/mmio.h>
+
#include <plat_arm.h>
#include <soc_css.h>
-
#include "juno_def.h"
#include "juno_tzmp1_def.h"
diff --git a/plat/arm/board/juno/juno_stack_protector.c b/plat/arm/board/juno/juno_stack_protector.c
index ec0b1fbee..ff05b5d46 100644
--- a/plat/arm/board/juno/juno_stack_protector.c
+++ b/plat/arm/board/juno/juno_stack_protector.c
@@ -5,8 +5,9 @@
*/
#include <arch_helpers.h>
-#include <debug.h>
-#include <utils.h>
+#include <common/debug.h>
+#include <lib/utils.h>
+
#include "juno_decl.h"
#include "juno_def.h"
diff --git a/plat/arm/board/juno/juno_topology.c b/plat/arm/board/juno/juno_topology.c
index c8a759824..51b99aca7 100644
--- a/plat/arm/board/juno/juno_topology.c
+++ b/plat/arm/board/juno/juno_topology.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <plat/common/platform.h>
+
#include <arm_def.h>
#include <css_pm.h>
#include <plat_arm.h>
-#include <platform.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 d9ad1d4eb..505fb0266 100644
--- a/plat/arm/board/juno/juno_trng.c
+++ b/plat/arm/board/juno/juno_trng.c
@@ -5,9 +5,11 @@
*/
#include <assert.h>
-#include <mmio.h>
#include <string.h>
-#include <utils_def.h>
+
+#include <lib/mmio.h>
+#include <lib/utils_def.h>
+
#include "juno_decl.h"
#include "juno_def.h"
diff --git a/plat/arm/board/n1sdp/n1sdp_bl31_setup.c b/plat/arm/board/n1sdp/n1sdp_bl31_setup.c
index cdd0b63da..d044b7ccf 100644
--- a/plat/arm/board/n1sdp/n1sdp_bl31_setup.c
+++ b/plat/arm/board/n1sdp/n1sdp_bl31_setup.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include "../../css/drivers/scmi/scmi.h"
#include "../../css/drivers/mhu/css_mhu_doorbell.h"
#include <plat_arm.h>
-#include <platform_def.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 8c057c55e..5aaa7376a 100644
--- a/plat/arm/board/n1sdp/n1sdp_plat.c
+++ b/plat/arm/board/n1sdp/n1sdp_plat.c
@@ -4,12 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <plat/common/platform.h>
+
#include <arm_def.h>
-#include <bl_common.h>
-#include <debug.h>
#include <plat_arm.h>
-#include <platform.h>
-#include <platform_def.h>
/*
* Table of regions to map using the MMU.
diff --git a/plat/arm/board/sgi575/include/platform_def.h b/plat/arm/board/sgi575/include/platform_def.h
index 16e2898de..6aea522f0 100644
--- a/plat/arm/board/sgi575/include/platform_def.h
+++ b/plat/arm/board/sgi575/include/platform_def.h
@@ -7,8 +7,9 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
+#include <lib/utils_def.h>
+
#include <sgi_base_platform_def.h>
-#include <utils_def.h>
#define PLAT_ARM_CLUSTER_COUNT 2
#define CSS_SGI_MAX_CPUS_PER_CLUSTER 4
diff --git a/plat/arm/board/sgi575/sgi575_plat.c b/plat/arm/board/sgi575/sgi575_plat.c
index a8ca916d9..d1a1fbf46 100644
--- a/plat/arm/board/sgi575/sgi575_plat.c
+++ b/plat/arm/board/sgi575/sgi575_plat.c
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <platform.h>
+#include <plat/common/platform.h>
unsigned int plat_arm_sgi_get_platform_id(void)
{
diff --git a/plat/arm/board/sgi575/sgi575_security.c b/plat/arm/board/sgi575/sgi575_security.c
index 7ccc59a7b..8417e1008 100644
--- a/plat/arm/board/sgi575/sgi575_security.c
+++ b/plat/arm/board/sgi575/sgi575_security.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
#include <platform_def.h>
-#include <tzc_dmc620.h>
+
+#include <common/debug.h>
+#include <drivers/arm/tzc_dmc620.h>
uintptr_t sgi575_dmc_base[] = {
SGI575_DMC620_BASE0,
diff --git a/plat/arm/board/sgiclarka/include/platform_def.h b/plat/arm/board/sgiclarka/include/platform_def.h
index 39907e8bc..d2cdb4974 100644
--- a/plat/arm/board/sgiclarka/include/platform_def.h
+++ b/plat/arm/board/sgiclarka/include/platform_def.h
@@ -7,8 +7,9 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
+#include <lib/utils_def.h>
+
#include <sgi_base_platform_def.h>
-#include <utils_def.h>
#define PLAT_ARM_CLUSTER_COUNT 2
#define CSS_SGI_MAX_CPUS_PER_CLUSTER 4
diff --git a/plat/arm/board/sgiclarka/sgiclarka_plat.c b/plat/arm/board/sgiclarka/sgiclarka_plat.c
index 3df2da666..3b7e5ee4e 100644
--- a/plat/arm/board/sgiclarka/sgiclarka_plat.c
+++ b/plat/arm/board/sgiclarka/sgiclarka_plat.c
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <platform.h>
+#include <plat/common/platform.h>
unsigned int plat_arm_sgi_get_platform_id(void)
{
diff --git a/plat/arm/board/sgiclarka/sgiclarka_security.c b/plat/arm/board/sgiclarka/sgiclarka_security.c
index 29cd75474..c455111d1 100644
--- a/plat/arm/board/sgiclarka/sgiclarka_security.c
+++ b/plat/arm/board/sgiclarka/sgiclarka_security.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
#include <platform_def.h>
-#include <tzc_dmc620.h>
+
+#include <common/debug.h>
+#include <drivers/arm/tzc_dmc620.h>
uintptr_t sgiclarka_dmc_base[] = {
SGICLARKA_DMC620_BASE0,
diff --git a/plat/arm/board/sgiclarkh/include/platform_def.h b/plat/arm/board/sgiclarkh/include/platform_def.h
index 544ad90f3..fe8907bee 100644
--- a/plat/arm/board/sgiclarkh/include/platform_def.h
+++ b/plat/arm/board/sgiclarkh/include/platform_def.h
@@ -7,8 +7,9 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
+#include <lib/utils_def.h>
+
#include <sgi_base_platform_def.h>
-#include <utils_def.h>
#define PLAT_ARM_CLUSTER_COUNT 2
#define CSS_SGI_MAX_CPUS_PER_CLUSTER 8
diff --git a/plat/arm/board/sgiclarkh/sgiclarkh_plat.c b/plat/arm/board/sgiclarkh/sgiclarkh_plat.c
index 437592dbd..a1b8d621d 100644
--- a/plat/arm/board/sgiclarkh/sgiclarkh_plat.c
+++ b/plat/arm/board/sgiclarkh/sgiclarkh_plat.c
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <platform.h>
+#include <plat/common/platform.h>
unsigned int plat_arm_sgi_get_platform_id(void)
{
diff --git a/plat/arm/board/sgiclarkh/sgiclarkh_security.c b/plat/arm/board/sgiclarkh/sgiclarkh_security.c
index 5ae0b8284..aaf9691ce 100644
--- a/plat/arm/board/sgiclarkh/sgiclarkh_security.c
+++ b/plat/arm/board/sgiclarkh/sgiclarkh_security.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
#include <platform_def.h>
-#include <tzc_dmc620.h>
+
+#include <common/debug.h>
+#include <drivers/arm/tzc_dmc620.h>
uintptr_t sgiclarkh_dmc_base[] = {
SGICLARKH_DMC620_BASE0,
diff --git a/plat/arm/common/aarch32/arm_bl2_mem_params_desc.c b/plat/arm/common/aarch32/arm_bl2_mem_params_desc.c
index 890f2c960..e23dd258b 100644
--- a/plat/arm/common/aarch32/arm_bl2_mem_params_desc.c
+++ b/plat/arm/common/aarch32/arm_bl2_mem_params_desc.c
@@ -4,11 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
#include <platform_def.h>
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
/*******************************************************************************
* Following descriptor provides BL image/ep information that gets used
diff --git a/plat/arm/common/aarch64/arm_bl2_mem_params_desc.c b/plat/arm/common/aarch64/arm_bl2_mem_params_desc.c
index 8e6d00d05..c0f42f310 100644
--- a/plat/arm/common/aarch64/arm_bl2_mem_params_desc.c
+++ b/plat/arm/common/aarch64/arm_bl2_mem_params_desc.c
@@ -4,11 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
#include <platform_def.h>
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
/*******************************************************************************
* Following descriptor provides BL image/ep information that gets used
diff --git a/plat/arm/common/aarch64/arm_ehf.c b/plat/arm/common/aarch64/arm_ehf.c
index f31385185..4ae992c95 100644
--- a/plat/arm/common/aarch64/arm_ehf.c
+++ b/plat/arm/common/aarch64/arm_ehf.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <ehf.h>
#include <platform_def.h>
+#include <bl31/ehf.h>
+
/*
* Enumeration of priority levels on ARM platforms.
*/
diff --git a/plat/arm/common/aarch64/arm_sdei.c b/plat/arm/common/aarch64/arm_sdei.c
index 687b21d43..493134b6a 100644
--- a/plat/arm/common/aarch64/arm_sdei.c
+++ b/plat/arm/common/aarch64/arm_sdei.c
@@ -6,9 +6,10 @@
/* SDEI configuration for ARM platforms */
-#include <ehf.h>
#include <platform_def.h>
-#include <sdei.h>
+
+#include <bl31/ehf.h>
+#include <services/sdei.h>
/* Private event mappings */
static sdei_ev_map_t arm_sdei_private[] = {
diff --git a/plat/arm/common/arm_bl1_fwu.c b/plat/arm/common/arm_bl1_fwu.c
index f2be47792..cd92aa8ed 100644
--- a/plat/arm/common/arm_bl1_fwu.c
+++ b/plat/arm/common/arm_bl1_fwu.c
@@ -5,14 +5,17 @@
*/
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
#include <errno.h>
-#include <plat_arm.h>
-#include <platform.h>
+
#include <platform_def.h>
-#include <tbbr_img_desc.h>
-#include <utils.h>
+
+#include <bl1/tbbr/tbbr_img_desc.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <lib/utils.h>
+#include <plat/common/platform.h>
+
+#include <plat_arm.h>
/* Struct to keep track of usable memory */
typedef struct bl1_mem_info {
diff --git a/plat/arm/common/arm_bl1_setup.c b/plat/arm/common/arm_bl1_setup.c
index f760e18dc..e28211cfa 100644
--- a/plat/arm/common/arm_bl1_setup.c
+++ b/plat/arm/common/arm_bl1_setup.c
@@ -4,17 +4,20 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <assert.h>
+
+#include <platform_def.h>
+
#include <arch.h>
+#include <bl1/bl1.h>
+#include <common/bl_common.h>
+#include <drivers/arm/sp805.h>
+#include <lib/utils.h>
+#include <lib/xlat_tables/xlat_tables_compat.h>
+#include <plat/common/platform.h>
+
#include <arm_def.h>
-#include <assert.h>
-#include <bl1.h>
-#include <bl_common.h>
#include <plat_arm.h>
-#include <platform.h>
-#include <platform_def.h>
-#include <sp805.h>
-#include <utils.h>
-#include <xlat_tables_compat.h>
#include "../../../bl1/bl1_private.h"
diff --git a/plat/arm/common/arm_bl2_el3_setup.c b/plat/arm/common/arm_bl2_el3_setup.c
index 4f5e6a9e6..0c1f63ed4 100644
--- a/plat/arm/common/arm_bl2_el3_setup.c
+++ b/plat/arm/common/arm_bl2_el3_setup.c
@@ -3,11 +3,14 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arm_def.h>
+
#include <assert.h>
-#include <generic_delay_timer.h>
+
+#include <drivers/generic_delay_timer.h>
+#include <plat/common/platform.h>
+
+#include <arm_def.h>
#include <plat_arm.h>
-#include <platform.h>
#pragma weak bl2_el3_early_platform_setup
#pragma weak bl2_el3_plat_arch_setup
diff --git a/plat/arm/common/arm_bl2_setup.c b/plat/arm/common/arm_bl2_setup.c
index 628a50def..9319004ea 100644
--- a/plat/arm/common/arm_bl2_setup.c
+++ b/plat/arm/common/arm_bl2_setup.c
@@ -4,21 +4,24 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <arm_def.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <desc_image_load.h>
-#include <generic_delay_timer.h>
+#include <string.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/desc_image_load.h>
+#include <drivers/generic_delay_timer.h>
#ifdef SPD_opteed
-#include <optee_utils.h>
+#include <lib/optee_utils.h>
#endif
+#include <lib/utils.h>
+#include <plat/common/platform.h>
+
+#include <arm_def.h>
#include <plat_arm.h>
-#include <platform.h>
-#include <platform_def.h>
-#include <string.h>
-#include <utils.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 3848aa065..0dc66e647 100644
--- a/plat/arm/common/arm_bl2u_setup.c
+++ b/plat/arm/common/arm_bl2u_setup.c
@@ -4,15 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <assert.h>
+#include <string.h>
+
+#include <platform_def.h>
+
#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <drivers/generic_delay_timer.h>
+#include <plat/common/platform.h>
+
#include <arm_def.h>
-#include <assert.h>
-#include <bl_common.h>
-#include <generic_delay_timer.h>
#include <plat_arm.h>
-#include <platform_def.h>
-#include <platform.h>
-#include <string.h>
/* Weak definitions may be overridden in specific ARM standard platform */
#pragma weak bl2u_platform_setup
diff --git a/plat/arm/common/arm_bl31_setup.c b/plat/arm/common/arm_bl31_setup.c
index 1b05f46e9..41151c2c8 100644
--- a/plat/arm/common/arm_bl31_setup.c
+++ b/plat/arm/common/arm_bl31_setup.c
@@ -4,19 +4,21 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <assert.h>
+
#include <arch.h>
#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+#include <lib/extensions/ras.h>
+#include <lib/mmio.h>
+#include <lib/utils.h>
+#include <lib/xlat_tables/xlat_tables_compat.h>
+#include <plat/common/platform.h>
+
#include <arm_def.h>
-#include <assert.h>
-#include <bl_common.h>
-#include <console.h>
-#include <debug.h>
-#include <mmio.h>
#include <plat_arm.h>
-#include <platform.h>
-#include <ras.h>
-#include <utils.h>
-#include <xlat_tables_compat.h>
/*
* Placeholder variables for copying the arguments that have been passed to
diff --git a/plat/arm/common/arm_cci.c b/plat/arm/common/arm_cci.c
index 6505b9174..7ee997e29 100644
--- a/plat/arm/common/arm_cci.c
+++ b/plat/arm/common/arm_cci.c
@@ -4,11 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include <arch.h>
-#include <cci.h>
+#include <drivers/arm/cci.h>
+#include <lib/utils.h>
+
#include <plat_arm.h>
-#include <platform_def.h>
-#include <utils.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 ddf3286d7..6aa56f217 100644
--- a/plat/arm/common/arm_ccn.c
+++ b/plat/arm/common/arm_ccn.c
@@ -4,10 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include <arch.h>
-#include <ccn.h>
+#include <drivers/arm/ccn.h>
+
#include <plat_arm.h>
-#include <platform_def.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 56ad8aeeb..4cd2ce3d6 100644
--- a/plat/arm/common/arm_common.c
+++ b/plat/arm/common/arm_common.c
@@ -3,17 +3,21 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
+#include <assert.h>
+
+#include <platform_def.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <assert.h>
-#include <debug.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <common/romlib.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables_compat.h>
+#include <plat/common/platform.h>
+#include <services/secure_partition.h>
+
#include <plat_arm.h>
-#include <platform.h>
-#include <platform_def.h>
-#include <romlib.h>
-#include <secure_partition.h>
-#include <xlat_tables_compat.h>
/* Weak definitions may be overridden in specific ARM standard platform */
#pragma weak plat_get_ns_image_entrypoint
diff --git a/plat/arm/common/arm_console.c b/plat/arm/common/arm_console.c
index bd3dca17f..29cb37827 100644
--- a/plat/arm/common/arm_console.c
+++ b/plat/arm/common/arm_console.c
@@ -3,13 +3,17 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <assert.h>
-#include <console.h>
-#include <debug.h>
-#include <pl011.h>
-#include <plat_arm.h>
+
#include <platform_def.h>
+#include <common/debug.h>
+#include <drivers/arm/pl011.h>
+#include <drivers/console.h>
+
+#include <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 c2a4bb1e6..6c6dc568c 100644
--- a/plat/arm/common/arm_dyn_cfg.c
+++ b/plat/arm/common/arm_dyn_cfg.c
@@ -4,19 +4,21 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arm_dyn_cfg_helpers.h>
#include <assert.h>
-#include <debug.h>
-#include <desc_image_load.h>
+#include <string.h>
+
+#include <platform_def.h>
+
+#include <common/debug.h>
+#include <common/desc_image_load.h>
+#include <common/tbbr/tbbr_img_def.h>
#if TRUSTED_BOARD_BOOT
-#include <mbedtls_config.h>
+#include <drivers/auth/mbedtls/mbedtls_config.h>
#endif
-#include <plat_arm.h>
-#include <platform.h>
-#include <platform_def.h>
-#include <string.h>
-#include <tbbr_img_def.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;
diff --git a/plat/arm/common/arm_dyn_cfg_helpers.c b/plat/arm/common/arm_dyn_cfg_helpers.c
index d12d09c7f..bf2f15643 100644
--- a/plat/arm/common/arm_dyn_cfg_helpers.c
+++ b/plat/arm/common/arm_dyn_cfg_helpers.c
@@ -4,11 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arm_dyn_cfg_helpers.h>
#include <assert.h>
-#include <desc_image_load.h>
-#include <fdt_wrappers.h>
+
#include <libfdt.h>
+
+#include <common/desc_image_load.h>
+#include <common/fdt_wrappers.h>
+
+#include <arm_dyn_cfg_helpers.h>
#include <plat_arm.h>
#define DTB_PROP_MBEDTLS_HEAP_ADDR "mbedtls_heap_addr"
diff --git a/plat/arm/common/arm_err.c b/plat/arm/common/arm_err.c
index aa65f4f33..8650d48a7 100644
--- a/plat/arm/common/arm_err.c
+++ b/plat/arm/common/arm_err.c
@@ -4,15 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <console.h>
-#include <debug.h>
#include <errno.h>
-#include <plat_arm.h>
-#include <platform.h>
-#include <platform_def.h>
#include <stdint.h>
-#include <v2m_flash.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/cfi/v2m_flash.h>
+#include <drivers/console.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 5644c6040..fc848c198 100644
--- a/plat/arm/common/arm_gicv2.c
+++ b/plat/arm/common/arm_gicv2.c
@@ -4,11 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <gicv2.h>
-#include <plat_arm.h>
-#include <platform.h>
#include <platform_def.h>
+#include <drivers/arm/gicv2.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 a43bff3d4..0f6690a0b 100644
--- a/plat/arm/common/arm_gicv3.c
+++ b/plat/arm/common/arm_gicv3.c
@@ -4,13 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
+#include <common/interrupt_props.h>
+#include <drivers/arm/gicv3.h>
+#include <lib/utils.h>
+#include <plat/common/platform.h>
+
#include <arm_def.h>
-#include <gicv3.h>
-#include <interrupt_props.h>
#include <plat_arm.h>
-#include <platform.h>
-#include <platform_def.h>
-#include <utils.h>
/******************************************************************************
* The following functions are defined as weak to allow a platform to override
diff --git a/plat/arm/common/arm_image_load.c b/plat/arm/common/arm_image_load.c
index 4f86efdf9..791f05ed7 100644
--- a/plat/arm/common/arm_image_load.c
+++ b/plat/arm/common/arm_image_load.c
@@ -4,12 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
+
#include <arm_def.h>
-#include <bl_common.h>
-#include <desc_image_load.h>
#include <plat_arm.h>
-#include <platform.h>
-
#pragma weak plat_flush_next_bl_params
#pragma weak plat_get_bl_image_load_info
diff --git a/plat/arm/common/arm_io_storage.c b/plat/arm/common/arm_io_storage.c
index cd58e4564..d7c5cac24 100644
--- a/plat/arm/common/arm_io_storage.c
+++ b/plat/arm/common/arm_io_storage.c
@@ -3,18 +3,22 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <assert.h>
-#include <debug.h>
-#include <firmware_image_package.h>
-#include <io_driver.h>
-#include <io_fip.h>
-#include <io_memmap.h>
-#include <io_storage.h>
-#include <plat_arm.h>
-#include <platform.h>
-#include <platform_def.h>
#include <string.h>
-#include <utils.h>
+
+#include <platform_def.h>
+
+#include <common/debug.h>
+#include <drivers/io/io_driver.h>
+#include <drivers/io/io_fip.h>
+#include <drivers/io/io_memmap.h>
+#include <drivers/io/io_storage.h>
+#include <lib/utils.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;
diff --git a/plat/arm/common/arm_nor_psci_mem_protect.c b/plat/arm/common/arm_nor_psci_mem_protect.c
index 2a46b95d6..4ae57e534 100644
--- a/plat/arm/common/arm_nor_psci_mem_protect.c
+++ b/plat/arm/common/arm_nor_psci_mem_protect.c
@@ -4,13 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <mmio.h>
-#include <plat_arm.h>
#include <platform_def.h>
-#include <psci.h>
-#include <utils.h>
-#include <v2m_flash.h>
+
+#include <common/debug.h>
+#include <drivers/cfi/v2m_flash.h>
+#include <lib/psci/psci.h>
+#include <lib/mmio.h>
+#include <lib/utils.h>
+
+#include <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 3be1b5d39..acfd90899 100644
--- a/plat/arm/common/arm_pm.c
+++ b/plat/arm/common/arm_pm.c
@@ -4,14 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <arm_def.h>
#include <assert.h>
#include <errno.h>
-#include <plat_arm.h>
-#include <platform.h>
+
#include <platform_def.h>
-#include <psci.h>
+
+#include <arch_helpers.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
+
+#include <arm_def.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 e482a8945..6b0f7e7be 100644
--- a/plat/arm/common/arm_sip_svc.c
+++ b/plat/arm/common/arm_sip_svc.c
@@ -4,14 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arm_sip_svc.h>
-#include <debug.h>
-#include <plat_arm.h>
-#include <pmf.h>
-#include <runtime_svc.h>
#include <stdint.h>
-#include <uuid.h>
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <lib/pmf/pmf.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,
diff --git a/plat/arm/common/arm_topology.c b/plat/arm/common/arm_topology.c
index b0ad4d1c6..6986e52b0 100644
--- a/plat/arm/common/arm_topology.c
+++ b/plat/arm/common/arm_topology.c
@@ -4,9 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include <arch.h>
+
#include <plat_arm.h>
-#include <platform_def.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 2ae084c7b..0346fa184 100644
--- a/plat/arm/common/arm_tzc400.c
+++ b/plat/arm/common/arm_tzc400.c
@@ -4,13 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
+#include <common/debug.h>
+#include <drivers/arm/tzc400.h>
+
#include <arm_def.h>
#include <arm_spm_def.h>
-#include <debug.h>
#include <plat_arm.h>
-#include <platform_def.h>
-#include <tzc400.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 6bd771b0e..bea3867d3 100644
--- a/plat/arm/common/arm_tzc_dmc500.c
+++ b/plat/arm/common/arm_tzc_dmc500.c
@@ -4,12 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arm_def.h>
#include <assert.h>
-#include <debug.h>
-#include <plat_arm.h>
+
#include <platform_def.h>
-#include <tzc_dmc500.h>
+
+#include <common/debug.h>
+#include <drivers/arm/tzc_dmc500.h>
+
+#include <arm_def.h>
+#include <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 8fa864d66..e3134102d 100644
--- a/plat/arm/common/execution_state_switch.c
+++ b/plat/arm/common/execution_state_switch.c
@@ -4,16 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <stdbool.h>
+#include <string.h>
+
#include <arch_helpers.h>
-#include <arm_sip_svc.h>
#include <context.h>
-#include <context_mgmt.h>
-#include <plat_arm.h>
-#include <psci.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/psci/psci.h>
+#include <lib/utils.h>
#include <smccc_helpers.h>
-#include <stdbool.h>
-#include <string.h>
-#include <utils.h>
+
+#include <arm_sip_svc.h>
+#include <plat_arm.h>
/*
* Handle SMC from a lower exception level to switch its execution state
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 ca427d58a..967b551e4 100644
--- a/plat/arm/common/sp_min/arm_sp_min_setup.c
+++ b/plat/arm/common/sp_min/arm_sp_min_setup.c
@@ -5,15 +5,18 @@
*/
#include <assert.h>
-#include <bl_common.h>
-#include <console.h>
-#include <debug.h>
-#include <mmio.h>
-#include <pl011.h>
-#include <plat_arm.h>
-#include <platform.h>
+
#include <platform_def.h>
-#include <platform_sp_min.h>
+
+#include <bl32/sp_min/platform_sp_min.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/pl011.h>
+#include <drivers/console.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
+#include <plat_arm.h>
static entry_point_info_t bl33_image_ep_info;
diff --git a/plat/arm/common/tsp/arm_tsp_setup.c b/plat/arm/common/tsp/arm_tsp_setup.c
index 3cf88251f..a3d2f7157 100644
--- a/plat/arm/common/tsp/arm_tsp_setup.c
+++ b/plat/arm/common/tsp/arm_tsp_setup.c
@@ -4,15 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arm_def.h>
#include <assert.h>
-#include <bl_common.h>
-#include <console.h>
-#include <debug.h>
-#include <pl011.h>
-#include <plat_arm.h>
+
#include <platform_def.h>
-#include <platform_tsp.h>
+
+#include <bl32/tsp/platform_tsp.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/pl011.h>
+#include <drivers/console.h>
+
+#include <arm_def.h>
+#include <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 b1b275c6e..ae0f01133 100644
--- a/plat/arm/css/common/css_bl1_setup.c
+++ b/plat/arm/css/common/css_bl1_setup.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <debug.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <plat/common/platform.h>
+
#include <plat_arm.h>
-#include <platform.h>
#include <soc_css.h>
void bl1_platform_setup(void)
diff --git a/plat/arm/css/common/css_bl2_setup.c b/plat/arm/css/common/css_bl2_setup.c
index e41b1ca0a..c1c7868b8 100644
--- a/plat/arm/css/common/css_bl2_setup.c
+++ b/plat/arm/css/common/css_bl2_setup.c
@@ -4,13 +4,16 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
+#include <string.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <lib/utils.h>
+
#include <css_def.h>
-#include <debug.h>
-#include <mmio.h>
#include <plat_arm.h>
-#include <string.h>
-#include <utils.h>
+
#include "../drivers/scp/css_scp.h"
/* Weak definition may be overridden in specific CSS based platform */
diff --git a/plat/arm/css/common/css_bl2u_setup.c b/plat/arm/css/common/css_bl2u_setup.c
index 4ceb5cda7..564e98f70 100644
--- a/plat/arm/css/common/css_bl2u_setup.c
+++ b/plat/arm/css/common/css_bl2u_setup.c
@@ -4,10 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <debug.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <plat/common/platform.h>
+
#include <plat_arm.h>
-#include <platform.h>
+
#include "../drivers/scp/css_scp.h"
/* Weak definition may be overridden in specific CSS based platform */
diff --git a/plat/arm/css/common/css_pm.c b/plat/arm/css/common/css_pm.c
index 4735a9dcc..8a156e675 100644
--- a/plat/arm/css/common/css_pm.c
+++ b/plat/arm/css/common/css_pm.c
@@ -4,15 +4,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <cassert.h>
-#include <css_pm.h>
-#include <debug.h>
#include <errno.h>
-#include <plat_arm.h>
-#include <platform.h>
+
#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <lib/cassert.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` */
diff --git a/plat/arm/css/common/css_topology.c b/plat/arm/css/common/css_topology.c
index d1f1c98f4..8ac223230 100644
--- a/plat/arm/css/common/css_topology.c
+++ b/plat/arm/css/common/css_topology.c
@@ -4,10 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <plat_arm.h>
-#include <platform.h>
#include <assert.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/drivers/mhu/css_mhu.c b/plat/arm/css/drivers/mhu/css_mhu.c
index 7b3331756..e13818f29 100644
--- a/plat/arm/css/drivers/mhu/css_mhu.c
+++ b/plat/arm/css/drivers/mhu/css_mhu.c
@@ -4,13 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bakery_lock.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+
#include <css_def.h>
-#include <mmio.h>
#include <plat_arm.h>
-#include <platform_def.h>
+
#include "css_mhu.h"
/* SCP MHU secure channel registers */
diff --git a/plat/arm/css/drivers/mhu/css_mhu_doorbell.c b/plat/arm/css/drivers/mhu/css_mhu_doorbell.c
index 54f3e057d..b3203c2a7 100644
--- a/plat/arm/css/drivers/mhu/css_mhu_doorbell.c
+++ b/plat/arm/css/drivers/mhu/css_mhu_doorbell.c
@@ -4,8 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <platform_def.h>
+
+#include <arch_helpers.h>
+
#include "css_mhu_doorbell.h"
#include "../scmi/scmi.h"
diff --git a/plat/arm/css/drivers/mhu/css_mhu_doorbell.h b/plat/arm/css/drivers/mhu/css_mhu_doorbell.h
index cb75ed050..ecee56361 100644
--- a/plat/arm/css/drivers/mhu/css_mhu_doorbell.h
+++ b/plat/arm/css/drivers/mhu/css_mhu_doorbell.h
@@ -7,9 +7,10 @@
#ifndef CSS_MHU_DOORBELL_H
#define CSS_MHU_DOORBELL_H
-#include <mmio.h>
#include <stdint.h>
+#include <lib/mmio.h>
+
/* MHUv2 Base Address */
#define MHUV2_BASE_ADDR PLAT_CSS_MHU_BASE
diff --git a/plat/arm/css/drivers/scmi/scmi.h b/plat/arm/css/drivers/scmi/scmi.h
index 28dfc9ac6..df259f76d 100644
--- a/plat/arm/css/drivers/scmi/scmi.h
+++ b/plat/arm/css/drivers/scmi/scmi.h
@@ -7,11 +7,12 @@
#ifndef SCMI_H
#define SCMI_H
-#include <bakery_lock.h>
-#include <psci.h>
#include <stddef.h>
#include <stdint.h>
-#include <spinlock.h>
+
+#include <lib/bakery_lock.h>
+#include <lib/psci/psci.h>
+#include <lib/spinlock.h>
/* Supported SCMI Protocol Versions */
#define SCMI_AP_CORE_PROTO_VER MAKE_SCMI_VERSION(1, 0)
diff --git a/plat/arm/css/drivers/scmi/scmi_ap_core_proto.c b/plat/arm/css/drivers/scmi/scmi_ap_core_proto.c
index 1438cba46..e495dccb0 100644
--- a/plat/arm/css/drivers/scmi/scmi_ap_core_proto.c
+++ b/plat/arm/css/drivers/scmi/scmi_ap_core_proto.c
@@ -4,9 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+
#include "scmi.h"
#include "scmi_private.h"
diff --git a/plat/arm/css/drivers/scmi/scmi_common.c b/plat/arm/css/drivers/scmi/scmi_common.c
index b34178ec3..1b4ecb239 100644
--- a/plat/arm/css/drivers/scmi/scmi_common.c
+++ b/plat/arm/css/drivers/scmi/scmi_common.c
@@ -4,13 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+
#include "scmi.h"
#include "scmi_private.h"
-
#if HW_ASSISTED_COHERENCY
#define scmi_lock_init(lock)
#define scmi_lock_get(lock) spin_lock(lock)
diff --git a/plat/arm/css/drivers/scmi/scmi_pwr_dmn_proto.c b/plat/arm/css/drivers/scmi/scmi_pwr_dmn_proto.c
index 90c5d6bc7..f31562131 100644
--- a/plat/arm/css/drivers/scmi/scmi_pwr_dmn_proto.c
+++ b/plat/arm/css/drivers/scmi/scmi_pwr_dmn_proto.c
@@ -4,9 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+
#include "scmi.h"
#include "scmi_private.h"
diff --git a/plat/arm/css/drivers/scmi/scmi_sys_pwr_proto.c b/plat/arm/css/drivers/scmi/scmi_sys_pwr_proto.c
index f6da39416..03c3c063d 100644
--- a/plat/arm/css/drivers/scmi/scmi_sys_pwr_proto.c
+++ b/plat/arm/css/drivers/scmi/scmi_sys_pwr_proto.c
@@ -4,9 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+
#include "scmi.h"
#include "scmi_private.h"
diff --git a/plat/arm/css/drivers/scp/css_bom_bootloader.c b/plat/arm/css/drivers/scp/css_bom_bootloader.c
index 5268510db..27c9e1d50 100644
--- a/plat/arm/css/drivers/scp/css_bom_bootloader.c
+++ b/plat/arm/css/drivers/scp/css_bom_bootloader.c
@@ -4,12 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <css_def.h>
-#include <debug.h>
-#include <platform.h>
#include <stdint.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <plat/common/platform.h>
+
+#include <css_def.h>
+
#include "../mhu/css_mhu.h"
#include "../scpi/css_scpi.h"
#include "css_scp.h"
diff --git a/plat/arm/css/drivers/scp/css_pm_scmi.c b/plat/arm/css/drivers/scp/css_pm_scmi.c
index 1397fd80c..bd6b59532 100644
--- a/plat/arm/css/drivers/scp/css_pm_scmi.c
+++ b/plat/arm/css/drivers/scp/css_pm_scmi.c
@@ -4,14 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
+#include <string.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <plat/common/platform.h>
+
#include <css_def.h>
#include <css_pm.h>
-#include <debug.h>
#include <plat_arm.h>
-#include <platform.h>
-#include <string.h>
+
#include "../scmi/scmi.h"
#include "css_scp.h"
diff --git a/plat/arm/css/drivers/scp/css_pm_scpi.c b/plat/arm/css/drivers/scp/css_pm_scpi.c
index 123d54f4e..f53ac3015 100644
--- a/plat/arm/css/drivers/scp/css_pm_scpi.c
+++ b/plat/arm/css/drivers/scp/css_pm_scpi.c
@@ -4,11 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+
#include <css_pm.h>
-#include <debug.h>
#include <plat_arm.h>
+
#include "../scpi/css_scpi.h"
#include "css_scp.h"
diff --git a/plat/arm/css/drivers/scp/css_scp.h b/plat/arm/css/drivers/scp/css_scp.h
index 84c1487d3..f3c08c52f 100644
--- a/plat/arm/css/drivers/scp/css_scp.h
+++ b/plat/arm/css/drivers/scp/css_scp.h
@@ -7,10 +7,12 @@
#ifndef CSS_SCP_H
#define CSS_SCP_H
-#include <cassert.h>
-#include <platform_def.h>
#include <stdint.h>
+#include <platform_def.h>
+
+#include <lib/cassert.h>
+
/* Forward declarations */
struct psci_power_state;
diff --git a/plat/arm/css/drivers/scp/css_sds.c b/plat/arm/css/drivers/scp/css_sds.c
index 561e97b2e..c152abca0 100644
--- a/plat/arm/css/drivers/scp/css_sds.c
+++ b/plat/arm/css/drivers/scp/css_sds.c
@@ -4,13 +4,16 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <css_def.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <platform.h>
#include <stdint.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <plat/common/platform.h>
+
+#include <css_def.h>
+
#include "css_scp.h"
#include "../sds/sds.h"
diff --git a/plat/arm/css/drivers/scpi/css_scpi.c b/plat/arm/css/drivers/scpi/css_scpi.c
index 2ed576011..42bf3b8e0 100644
--- a/plat/arm/css/drivers/scpi/css_scpi.c
+++ b/plat/arm/css/drivers/scpi/css_scpi.c
@@ -4,13 +4,16 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <css_def.h>
-#include <debug.h>
-#include <platform.h>
#include <string.h>
-#include <utils.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <lib/utils.h>
+#include <plat/common/platform.h>
+
+#include <css_def.h>
+
#include "../mhu/css_mhu.h"
#include "css_scpi.h"
diff --git a/plat/arm/css/drivers/sds/sds.c b/plat/arm/css/drivers/sds/sds.c
index e2fac54f3..3eeb0dc4d 100644
--- a/plat/arm/css/drivers/sds/sds.c
+++ b/plat/arm/css/drivers/sds/sds.c
@@ -4,13 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
-#include <css_def.h>
#include <stdint.h>
#include <string.h>
+#include <arch_helpers.h>
+#include <common/debug.h>
+
+#include <css_def.h>
#include "sds.h"
#include "sds_private.h"
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 8705d63b1..ad7ab81d9 100644
--- a/plat/arm/css/sgi/include/sgi_base_platform_def.h
+++ b/plat/arm/css/sgi/include/sgi_base_platform_def.h
@@ -7,15 +7,16 @@
#ifndef SGI_BASE_PLATFORM_DEF_H
#define SGI_BASE_PLATFORM_DEF_H
+#include <lib/utils_def.h>
+#include <lib/xlat_tables/xlat_tables_defs.h>
+#include <plat/common/common_def.h>
+
#include <arm_def.h>
#include <arm_spm_def.h>
#include <board_css_def.h>
-#include <common_def.h>
#include <css_def.h>
#include <soc_css_def.h>
-#include <utils_def.h>
#include <v2m_def.h>
-#include <xlat_tables_defs.h>
#define PLATFORM_CORE_COUNT (PLAT_ARM_CLUSTER_COUNT * \
CSS_SGI_MAX_CPUS_PER_CLUSTER * \
diff --git a/plat/arm/css/sgi/sgi_bl31_setup.c b/plat/arm/css/sgi/sgi_bl31_setup.c
index b1aa089b4..617a62b77 100644
--- a/plat/arm/css/sgi/sgi_bl31_setup.c
+++ b/plat/arm/css/sgi/sgi_bl31_setup.c
@@ -5,12 +5,16 @@
*/
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
+
#include <libfdt.h>
+
+#include <common/bl_common.h>
+#include <common/debug.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"
diff --git a/plat/arm/css/sgi/sgi_image_load.c b/plat/arm/css/sgi/sgi_image_load.c
index e078bd2af..1ed219d65 100644
--- a/plat/arm/css/sgi/sgi_image_load.c
+++ b/plat/arm/css/sgi/sgi_image_load.c
@@ -4,11 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <debug.h>
-#include <desc_image_load.h>
#include <libfdt.h>
-#include <platform.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
+
#include <sgi_variant.h>
/*******************************************************************************
diff --git a/plat/arm/css/sgi/sgi_interconnect.c b/plat/arm/css/sgi/sgi_interconnect.c
index 074f8a274..e86c760d1 100644
--- a/plat/arm/css/sgi/sgi_interconnect.c
+++ b/plat/arm/css/sgi/sgi_interconnect.c
@@ -5,7 +5,7 @@
*/
#include <arch_helpers.h>
-#include <debug.h>
+#include <common/debug.h>
/*
* For SGI575 which support FCM (with automatic interconnect enter/exit),
diff --git a/plat/arm/css/sgi/sgi_plat.c b/plat/arm/css/sgi/sgi_plat.c
index 710430bb7..79f3e5b55 100644
--- a/plat/arm/css/sgi/sgi_plat.c
+++ b/plat/arm/css/sgi/sgi_plat.c
@@ -4,16 +4,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <assert.h>
+
+#include <platform_def.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/ccn.h>
+#include <plat/common/platform.h>
+#include <services/secure_partition.h>
+
#include <arm_def.h>
#include <arm_spm_def.h>
-#include <assert.h>
-#include <bl_common.h>
-#include <ccn.h>
-#include <debug.h>
#include <plat_arm.h>
-#include <platform_def.h>
-#include <platform.h>
-#include <secure_partition.h>
#include "../../../../bl1/bl1_private.h"
#if USE_COHERENT_MEM
diff --git a/plat/arm/css/sgi/sgi_ras.c b/plat/arm/css/sgi/sgi_ras.c
index ac4610d21..a6a32d150 100644
--- a/plat/arm/css/sgi/sgi_ras.c
+++ b/plat/arm/css/sgi/sgi_ras.c
@@ -4,18 +4,20 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arm_spm_def.h>
#include <assert.h>
-#include <context_mgmt.h>
-#include <interrupt_mgmt.h>
-#include <mm_svc.h>
-#include <ras.h>
-#include <sgi_ras.h>
-#include <platform.h>
-#include <spm_svc.h>
-#include <sdei.h>
#include <string.h>
+#include <bl31/interrupt_mgmt.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/extensions/ras.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,
int probe_data,
const struct err_handler_data *const data);
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 2178f069a..e3fa3f30e 100644
--- a/plat/arm/css/sgm/include/sgm_base_platform_def.h
+++ b/plat/arm/css/sgm/include/sgm_base_platform_def.h
@@ -7,13 +7,14 @@
#ifndef SGM_BASE_PLATFORM_DEF_H
#define SGM_BASE_PLATFORM_DEF_H
+#include <drivers/arm/tzc400.h>
+#include <drivers/arm/tzc_common.h>
+#include <plat/common/common_def.h>
+
#include <arm_def.h>
#include <board_css_def.h>
-#include <common_def.h>
#include <css_def.h>
#include <soc_css_def.h>
-#include <tzc400.h>
-#include <tzc_common.h>
#include <v2m_def.h>
/* CPU topology */
diff --git a/plat/arm/css/sgm/include/sgm_plat_config.h b/plat/arm/css/sgm/include/sgm_plat_config.h
index 79e6b5c6a..29b98d49e 100644
--- a/plat/arm/css/sgm/include/sgm_plat_config.h
+++ b/plat/arm/css/sgm/include/sgm_plat_config.h
@@ -7,8 +7,8 @@
#ifndef SGM_PLAT_CONFIG_H
#define SGM_PLAT_CONFIG_H
-#include <ccn.h>
-#include <gicv3.h>
+#include <drivers/arm/ccn.h>
+#include <drivers/arm/gicv3.h>
/* The type of interconnect */
typedef enum {
diff --git a/plat/arm/css/sgm/sgm_bl1_setup.c b/plat/arm/css/sgm/sgm_bl1_setup.c
index dc3d71dd4..8b7c5dabb 100644
--- a/plat/arm/css/sgm/sgm_bl1_setup.c
+++ b/plat/arm/css/sgm/sgm_bl1_setup.c
@@ -4,8 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <debug.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+
#include <plat_arm.h>
#include <sgm_plat_config.h>
#include <soc_css.h>
diff --git a/plat/arm/css/sgm/sgm_bl31_setup.c b/plat/arm/css/sgm/sgm_bl31_setup.c
index 952572e3a..7967cb59c 100644
--- a/plat/arm/css/sgm/sgm_bl31_setup.c
+++ b/plat/arm/css/sgm/sgm_bl31_setup.c
@@ -4,10 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <debug.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+
#include <plat_arm.h>
#include <sgm_plat_config.h>
+
#include "../../css/drivers/scmi/scmi.h"
#include "../../css/drivers/mhu/css_mhu_doorbell.h"
diff --git a/plat/arm/css/sgm/sgm_mmap_config.c b/plat/arm/css/sgm/sgm_mmap_config.c
index 6800ac3cf..a4df9ab19 100644
--- a/plat/arm/css/sgm/sgm_mmap_config.c
+++ b/plat/arm/css/sgm/sgm_mmap_config.c
@@ -4,11 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+
#include <arm_def.h>
-#include <bl_common.h>
-#include <debug.h>
#include <plat_arm.h>
-#include <platform_def.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 e977e618b..2a43487f1 100644
--- a/plat/arm/css/sgm/sgm_plat_config.c
+++ b/plat/arm/css/sgm/sgm_plat_config.c
@@ -5,12 +5,15 @@
*/
#include <assert.h>
-#include <debug.h>
-#include <plat_arm.h>
+#include <string.h>
+
#include <platform_def.h>
+
+#include <common/debug.h>
+
+#include <plat_arm.h>
#include <sgm_plat_config.h>
#include <sgm_variant.h>
-#include <string.h>
static css_plat_config_t *css_plat_info;
diff --git a/plat/arm/css/sgm/sgm_security.c b/plat/arm/css/sgm/sgm_security.c
index 7f9806001..548ec7bd5 100644
--- a/plat/arm/css/sgm/sgm_security.c
+++ b/plat/arm/css/sgm/sgm_security.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
+#include <common/debug.h>
+#include <drivers/arm/tzc_dmc500.h>
+
#include <plat_arm.h>
#include <sgm_variant.h>
#include <soc_css.h>
-#include <tzc_dmc500.h>
/* Is populated with the DMC-500 controllers base addresses */
static tzc_dmc500_driver_data_t plat_driver_data;
diff --git a/plat/arm/soc/common/soc_css_security.c b/plat/arm/soc/common/soc_css_security.c
index f2296796c..bbc5dcdc5 100644
--- a/plat/arm/soc/common/soc_css_security.c
+++ b/plat/arm/soc/common/soc_css_security.c
@@ -4,10 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <board_css_def.h>
-#include <mmio.h>
-#include <nic_400.h>
#include <platform_def.h>
+
+#include <drivers/arm/nic_400.h>
+#include <lib/mmio.h>
+
+#include <board_css_def.h>
#include <soc_css.h>
#include <soc_css_def.h>
diff --git a/plat/common/aarch32/crash_console_helpers.S b/plat/common/aarch32/crash_console_helpers.S
index fc37c08fa..c9ad12cc4 100644
--- a/plat/common/aarch32/crash_console_helpers.S
+++ b/plat/common/aarch32/crash_console_helpers.S
@@ -10,7 +10,7 @@
*/
#include <asm_macros.S>
-#include <console.h>
+#include <drivers/console.h>
.globl plat_crash_console_init
.globl plat_crash_console_putc
diff --git a/plat/common/aarch32/plat_common.c b/plat/common/aarch32/plat_common.c
index 16c2b5c95..2c1a8fa09 100644
--- a/plat/common/aarch32/plat_common.c
+++ b/plat/common/aarch32/plat_common.c
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <platform.h>
-#include <xlat_mmu_helpers.h>
+#include <lib/xlat_tables/xlat_mmu_helpers.h>
+#include <plat/common/platform.h>
/*
* The following platform setup functions are weakly defined. They
diff --git a/plat/common/aarch32/plat_sp_min_common.c b/plat/common/aarch32/plat_sp_min_common.c
index f1b1e9c9f..3bc84b1ad 100644
--- a/plat/common/aarch32/plat_sp_min_common.c
+++ b/plat/common/aarch32/plat_sp_min_common.c
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <console.h>
-#include <platform.h>
+#include <drivers/console.h>
+#include <plat/common/platform.h>
#include <platform_sp_min.h>
/*
diff --git a/plat/common/aarch64/crash_console_helpers.S b/plat/common/aarch64/crash_console_helpers.S
index 8f8ca1124..491a99d36 100644
--- a/plat/common/aarch64/crash_console_helpers.S
+++ b/plat/common/aarch64/crash_console_helpers.S
@@ -10,7 +10,7 @@
*/
#include <asm_macros.S>
-#include <console.h>
+#include <drivers/console.h>
.globl plat_crash_console_init
.globl plat_crash_console_putc
diff --git a/plat/common/aarch64/plat_common.c b/plat/common/aarch64/plat_common.c
index e6f5f2045..1424c7894 100644
--- a/plat/common/aarch64/plat_common.c
+++ b/plat/common/aarch64/plat_common.c
@@ -4,14 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <console.h>
-#include <platform.h>
+
+#include <arch_helpers.h>
+#include <drivers/console.h>
#if RAS_EXTENSION
-#include <ras.h>
+#include <lib/extensions/ras.h>
#endif
-#include <xlat_mmu_helpers.h>
+#include <lib/xlat_tables/xlat_mmu_helpers.h>
+#include <plat/common/platform.h>
/*
* The following platform setup functions are weakly defined. They
diff --git a/plat/common/aarch64/platform_helpers.S b/plat/common/aarch64/platform_helpers.S
index 89523194d..b5788fba2 100644
--- a/plat/common/aarch64/platform_helpers.S
+++ b/plat/common/aarch64/platform_helpers.S
@@ -6,7 +6,7 @@
#include <arch.h>
#include <asm_macros.S>
-#include <console.h>
+#include <drivers/console.h>
#include <platform_def.h>
.weak plat_report_exception
diff --git a/plat/common/plat_bl1_common.c b/plat/common/plat_bl1_common.c
index 824f9e551..5733781ac 100644
--- a/plat/common/plat_bl1_common.c
+++ b/plat/common/plat_bl1_common.c
@@ -4,15 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <bl1.h>
-#include <debug.h>
#include <errno.h>
-#include <platform.h>
+
#include <platform_def.h>
+#include <arch_helpers.h>
+#include <bl1/bl1.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <plat/common/platform.h>
+
/*
* The following platform functions are weakly defined. They
* are default implementations that allow BL1 to compile in
diff --git a/plat/common/plat_bl_common.c b/plat/common/plat_bl_common.c
index 4cf1cc573..2357edfa9 100644
--- a/plat/common/plat_bl_common.c
+++ b/plat/common/plat_bl_common.c
@@ -4,16 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
#include <errno.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
#if TRUSTED_BOARD_BOOT
-#include <mbedtls_config.h>
+#include <drivers/auth/mbedtls/mbedtls_config.h>
#endif
-#include <platform.h>
-#include <xlat_tables_compat.h>
+#include <lib/xlat_tables/xlat_tables_compat.h>
+#include <plat/common/platform.h>
/*
* The following platform functions are weakly defined. The Platforms
diff --git a/plat/common/plat_gicv2.c b/plat/common/plat_gicv2.c
index 4b6687371..4c76f1bd1 100644
--- a/plat/common/plat_gicv2.c
+++ b/plat/common/plat_gicv2.c
@@ -3,13 +3,15 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <assert.h>
-#include <gic_common.h>
-#include <gicv2.h>
-#include <interrupt_mgmt.h>
-#include <platform.h>
#include <stdbool.h>
+#include <bl31/interrupt_mgmt.h>
+#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gicv2.h>
+#include <plat/common/platform.h>
+
/*
* The following platform GIC functions are weakly defined. They
* provide typical implementations that may be re-used by multiple
diff --git a/plat/common/plat_gicv3.c b/plat/common/plat_gicv3.c
index f8277fe54..f5ed6fc96 100644
--- a/plat/common/plat_gicv3.c
+++ b/plat/common/plat_gicv3.c
@@ -3,16 +3,18 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
+
#include <assert.h>
-#include <bl_common.h>
-#include <cassert.h>
-#include <gic_common.h>
-#include <gicv3.h>
-#include <interrupt_mgmt.h>
-#include <platform.h>
#include <stdbool.h>
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <bl31/interrupt_mgmt.h>
+#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gicv3.h>
+#include <lib/cassert.h>
+#include <plat/common/platform.h>
+
#ifdef IMAGE_BL31
/*
diff --git a/plat/common/plat_log_common.c b/plat/common/plat_log_common.c
index c757c6bf1..66b9758bc 100644
--- a/plat/common/plat_log_common.c
+++ b/plat/common/plat_log_common.c
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <platform.h>
+#include <common/debug.h>
+#include <plat/common/platform.h>
/* Allow platforms to override the log prefix string */
#pragma weak plat_log_get_prefix
diff --git a/plat/common/plat_psci_common.c b/plat/common/plat_psci_common.c
index fab3c770b..1a29d9ca4 100644
--- a/plat/common/plat_psci_common.c
+++ b/plat/common/plat_psci_common.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
#include <assert.h>
-#include <platform.h>
-#include <pmf.h>
-#include <psci.h>
+
+#include <arch.h>
+#include <lib/pmf/pmf.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
#if ENABLE_PSCI_STAT && ENABLE_PMF
#pragma weak plat_psci_stat_accounting_start
diff --git a/plat/common/plat_spm_rd.c b/plat/common/plat_spm_rd.c
index 69b9a23fb..0c72cb7aa 100644
--- a/plat/common/plat_spm_rd.c
+++ b/plat/common/plat_spm_rd.c
@@ -5,13 +5,16 @@
*/
#include <assert.h>
-#include <debug.h>
-#include <fdt_wrappers.h>
+#include <string.h>
+
#include <libfdt.h>
+
#include <platform_def.h>
-#include <sp_res_desc.h>
-#include <string.h>
-#include <object_pool.h>
+
+#include <common/debug.h>
+#include <common/fdt_wrappers.h>
+#include <lib/object_pool.h>
+#include <services/sp_res_desc.h>
/*******************************************************************************
* Resource pool
diff --git a/plat/common/plat_spm_sp.c b/plat/common/plat_spm_sp.c
index 7b7fbd987..ce4827992 100644
--- a/plat/common/plat_spm_sp.c
+++ b/plat/common/plat_spm_sp.c
@@ -5,9 +5,11 @@
*/
#include <assert.h>
-#include <debug.h>
+
#include <platform_def.h>
-#include <sptool.h>
+
+#include <common/debug.h>
+#include <tools_share/sptool.h>
static unsigned int sp_next;
diff --git a/plat/common/tbbr/plat_tbbr.c b/plat/common/tbbr/plat_tbbr.c
index f5a4f315c..12ab0a9e0 100644
--- a/plat/common/tbbr/plat_tbbr.c
+++ b/plat/common/tbbr/plat_tbbr.c
@@ -5,14 +5,15 @@
*/
#include <assert.h>
-#include <auth/auth_mod.h>
-#include <platform.h>
+#include <string.h>
+
+#include <drivers/auth/auth_mod.h>
+#include <plat/common/platform.h>
#if USE_TBBR_DEFS
-#include <tbbr_oid.h>
+#include <tools_share/tbbr_oid.h>
#else
#include <platform_oid.h>
#endif
-#include <string.h>
/*
* Store a new non-volatile counter value. This implementation
diff --git a/plat/hisilicon/hikey/aarch64/hikey_common.c b/plat/hisilicon/hikey/aarch64/hikey_common.c
index 60e4d867f..702fc2d86 100644
--- a/plat/hisilicon/hikey/aarch64/hikey_common.c
+++ b/plat/hisilicon/hikey/aarch64/hikey_common.c
@@ -4,15 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables.h>
+#include <plat/common/platform.h>
+
#include <hikey_def.h>
#include <hikey_layout.h>
-#include <mmio.h>
-#include <platform.h>
-#include <xlat_tables.h>
#define MAP_DDR MAP_REGION_FLAT(DDR_BASE, \
DDR_SIZE - DDR_SEC_SIZE, \
diff --git a/plat/hisilicon/hikey/hikey_bl1_setup.c b/plat/hisilicon/hikey/hikey_bl1_setup.c
index 6fcb59732..a08bdfa72 100644
--- a/plat/hisilicon/hikey/hikey_bl1_setup.c
+++ b/plat/hisilicon/hikey/hikey_bl1_setup.c
@@ -4,23 +4,25 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <dw_mmc.h>
#include <errno.h>
+#include <string.h>
+
+#include <arch_helpers.h>
+#include <bl1/tbbr/tbbr_img_desc.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/pl011.h>
+#include <drivers/mmc.h>
+#include <drivers/synopsys/dw_mmc.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include <hi6220.h>
#include <hikey_def.h>
#include <hikey_layout.h>
-#include <mmc.h>
-#include <mmio.h>
-#include <pl011.h>
-#include <platform.h>
-#include <string.h>
-#include <tbbr/tbbr_img_desc.h>
-#include "../../bl1/bl1_private.h"
+#include "../../../bl1/bl1_private.h"
#include "hikey_private.h"
/* Data structure which holds the extents of the trusted RAM for BL1 */
diff --git a/plat/hisilicon/hikey/hikey_bl2_mem_params_desc.c b/plat/hisilicon/hikey/hikey_bl2_mem_params_desc.c
index 23c16ed99..4e013a0f3 100644
--- a/plat/hisilicon/hikey/hikey_bl2_mem_params_desc.c
+++ b/plat/hisilicon/hikey/hikey_bl2_mem_params_desc.c
@@ -4,11 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
#include <platform_def.h> /* also includes hikey_def.h and hikey_layout.h*/
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
/*******************************************************************************
* Following descriptor provides BL image/ep information that gets used
diff --git a/plat/hisilicon/hikey/hikey_bl2_setup.c b/plat/hisilicon/hikey/hikey_bl2_setup.c
index 125d6654c..b87237373 100644
--- a/plat/hisilicon/hikey/hikey_bl2_setup.c
+++ b/plat/hisilicon/hikey/hikey_bl2_setup.c
@@ -4,27 +4,29 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <desc_image_load.h>
-#include <dw_mmc.h>
#include <errno.h>
-#include <hi6220.h>
-#include <hisi_mcu.h>
-#include <hisi_sram_map.h>
-#include <mmc.h>
-#include <mmio.h>
+#include <string.h>
+
+#include <platform_def.h> /* also includes hikey_def.h and hikey_layout.h*/
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/desc_image_load.h>
+#include <drivers/arm/pl011.h>
+#include <drivers/delay_timer.h>
+#include <drivers/mmc.h>
+#include <drivers/synopsys/dw_mmc.h>
+#include <lib/mmio.h>
#ifdef SPD_opteed
-#include <optee_utils.h>
+#include <lib/optee_utils.h>
#endif
-#include <pl011.h>
-#include <platform.h>
-#include <platform_def.h> /* also includes hikey_def.h and hikey_layout.h*/
-#include <string.h>
+#include <plat/common/platform.h>
+#include <hi6220.h>
+#include <hisi_mcu.h>
+#include <hisi_sram_map.h>
#include "hikey_private.h"
/*
diff --git a/plat/hisilicon/hikey/hikey_bl31_setup.c b/plat/hisilicon/hikey/hikey_bl31_setup.c
index 0e061e927..b2dcb6196 100644
--- a/plat/hisilicon/hikey/hikey_bl31_setup.c
+++ b/plat/hisilicon/hikey/hikey_bl31_setup.c
@@ -4,21 +4,24 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <cci.h>
-#include <debug.h>
#include <errno.h>
-#include <gicv2.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/cci.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/arm/pl011.h>
+#include <lib/mmio.h>
+
#include <hi6220.h>
#include <hikey_def.h>
#include <hisi_ipc.h>
#include <hisi_pwrc.h>
-#include <interrupt_props.h>
-#include <mmio.h>
-#include <pl011.h>
-#include <platform_def.h>
#include "hikey_private.h"
diff --git a/plat/hisilicon/hikey/hikey_bl_common.c b/plat/hisilicon/hikey/hikey_bl_common.c
index b254a900d..d062de455 100644
--- a/plat/hisilicon/hikey/hikey_bl_common.c
+++ b/plat/hisilicon/hikey/hikey_bl_common.c
@@ -5,13 +5,13 @@
*/
#include <arch_helpers.h>
-#include <gpio.h>
+#include <drivers/arm/pl061_gpio.h>
+#include <drivers/arm/sp804_delay_timer.h>
+#include <drivers/gpio.h>
+#include <lib/mmio.h>
+
#include <hi6220.h>
#include <hi6553.h>
-#include <mmio.h>
-#include <pl061_gpio.h>
-#include <sp804_delay_timer.h>
-
#include "hikey_private.h"
void hikey_sp804_init(void)
diff --git a/plat/hisilicon/hikey/hikey_ddr.c b/plat/hisilicon/hikey/hikey_ddr.c
index 43cece001..e688c157b 100644
--- a/plat/hisilicon/hikey/hikey_ddr.c
+++ b/plat/hisilicon/hikey/hikey_ddr.c
@@ -4,16 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
#include <errno.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/arm/sp804_delay_timer.h>
+#include <lib/mmio.h>
+
#include <hi6220.h>
#include <hi6553.h>
#include <hisi_sram_map.h>
-#include <mmio.h>
-#include <sp804_delay_timer.h>
-
#include "hikey_private.h"
static void init_pll(void)
diff --git a/plat/hisilicon/hikey/hikey_image_load.c b/plat/hisilicon/hikey/hikey_image_load.c
index 32ca36db0..0ab1ca496 100644
--- a/plat/hisilicon/hikey/hikey_image_load.c
+++ b/plat/hisilicon/hikey/hikey_image_load.c
@@ -4,9 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
/*******************************************************************************
* This function flushes the data structures so that they are visible
diff --git a/plat/hisilicon/hikey/hikey_io_storage.c b/plat/hisilicon/hikey/hikey_io_storage.c
index 3efbefe8c..11dd97334 100644
--- a/plat/hisilicon/hikey/hikey_io_storage.c
+++ b/plat/hisilicon/hikey/hikey_io_storage.c
@@ -4,21 +4,24 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
#include <errno.h>
-#include <firmware_image_package.h>
-#include <io_block.h>
-#include <io_driver.h>
-#include <io_fip.h>
-#include <io_memmap.h>
-#include <io_storage.h>
-#include <mmc.h>
-#include <mmio.h>
-#include <platform_def.h>
-#include <semihosting.h> /* For FOPEN_MODE_... */
#include <string.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/io/io_block.h>
+#include <drivers/io/io_driver.h>
+#include <drivers/io/io_fip.h>
+#include <drivers/io/io_memmap.h>
+#include <drivers/io/io_storage.h>
+#include <drivers/mmc.h>
+#include <lib/mmio.h>
+#include <lib/semihosting.h>
+#include <tools_share/firmware_image_package.h>
+
#include "hikey_private.h"
#define EMMC_BLOCK_SHIFT 9
diff --git a/plat/hisilicon/hikey/hikey_pm.c b/plat/hisilicon/hikey/hikey_pm.c
index 3128a3d12..05c1e7f22 100644
--- a/plat/hisilicon/hikey/hikey_pm.c
+++ b/plat/hisilicon/hikey/hikey_pm.c
@@ -4,19 +4,21 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <cci.h>
-#include <debug.h>
-#include <gicv2.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/arm/sp804_delay_timer.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+
#include <hi6220.h>
#include <hikey_def.h>
#include <hisi_ipc.h>
#include <hisi_pwrc.h>
#include <hisi_sram_map.h>
-#include <mmio.h>
-#include <psci.h>
-#include <sp804_delay_timer.h>
#define CORE_PWR_STATE(state) \
((state)->pwr_domain_state[MPIDR_AFFLVL0])
diff --git a/plat/hisilicon/hikey/hikey_private.h b/plat/hisilicon/hikey/hikey_private.h
index ca1baa3f5..d82a0794a 100644
--- a/plat/hisilicon/hikey/hikey_private.h
+++ b/plat/hisilicon/hikey/hikey_private.h
@@ -7,7 +7,7 @@
#ifndef HIKEY_PRIVATE_H
#define HIKEY_PRIVATE_H
-#include <bl_common.h>
+#include <common/bl_common.h>
#define RANDOM_MAX 0x7fffffffffffffff
#define RANDOM_MAGIC 0x9a4dbeaf
diff --git a/plat/hisilicon/hikey/hikey_security.c b/plat/hisilicon/hikey/hikey_security.c
index 43d7b7ad7..4b9593941 100644
--- a/plat/hisilicon/hikey/hikey_security.c
+++ b/plat/hisilicon/hikey/hikey_security.c
@@ -5,11 +5,14 @@
*/
#include <assert.h>
-#include <debug.h>
-#include <platform_def.h>
#include <stdint.h>
#include <string.h>
-#include <utils_def.h>
+
+#include <platform_def.h>
+
+#include <common/debug.h>
+#include <lib/utils_def.h>
+
#include "hikey_private.h"
#define PORTNUM_MAX 5
diff --git a/plat/hisilicon/hikey/hikey_tbbr.c b/plat/hisilicon/hikey/hikey_tbbr.c
index 20eda3619..1f05d18ea 100644
--- a/plat/hisilicon/hikey/hikey_tbbr.c
+++ b/plat/hisilicon/hikey/hikey_tbbr.c
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <platform.h>
+#include <plat/common/platform.h>
extern char hikey_rotpk_hash[], hikey_rotpk_hash_end[];
diff --git a/plat/hisilicon/hikey/hikey_topology.c b/plat/hisilicon/hikey/hikey_topology.c
index 95948b8d2..7890eb7ed 100644
--- a/plat/hisilicon/hikey/hikey_topology.c
+++ b/plat/hisilicon/hikey/hikey_topology.c
@@ -3,9 +3,11 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
+
#include <platform_def.h>
-#include <psci.h>
+
+#include <arch.h>
+#include <lib/psci/psci.h>
/*
* The HiKey power domain tree descriptor. The cluster power domains
diff --git a/plat/hisilicon/hikey/hisi_dvfs.c b/plat/hisilicon/hikey/hisi_dvfs.c
index 0d4f893b9..22a67fdca 100644
--- a/plat/hisilicon/hikey/hisi_dvfs.c
+++ b/plat/hisilicon/hikey/hisi_dvfs.c
@@ -4,18 +4,21 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <console.h>
-#include <debug.h>
+#include <string.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include <hi6220.h>
#include <hi6553.h>
#include <hisi_sram_map.h>
-#include <mmio.h>
-#include <platform.h>
-#include <platform_def.h>
-#include <string.h>
#define ACPU_FREQ_MAX_NUM 5
#define ACPU_OPP_NUM 7
diff --git a/plat/hisilicon/hikey/hisi_ipc.c b/plat/hisilicon/hikey/hisi_ipc.c
index 7e02f3ae1..43ee0b2ab 100644
--- a/plat/hisilicon/hikey/hisi_ipc.c
+++ b/plat/hisilicon/hikey/hisi_ipc.c
@@ -4,16 +4,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <debug.h>
-#include <hisi_ipc.h>
-#include <hisi_sram_map.h>
-#include <mmio.h>
-#include <platform_def.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+
+#include <hisi_ipc.h>
+#include <hisi_sram_map.h>
+
static int ipc_init;
static unsigned int cpu_ipc_num[PLATFORM_CLUSTER_COUNT][PLATFORM_CORE_COUNT_PER_CLUSTER] = {
diff --git a/plat/hisilicon/hikey/hisi_mcu.c b/plat/hisilicon/hikey/hisi_mcu.c
index 359b94d7b..ac83bd854 100644
--- a/plat/hisilicon/hikey/hisi_mcu.c
+++ b/plat/hisilicon/hikey/hisi_mcu.c
@@ -4,17 +4,20 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <console.h>
-#include <debug.h>
-#include <hi6220.h>
-#include <mmio.h>
-#include <platform.h>
-#include <platform_def.h>
#include <string.h>
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
+#include <hi6220.h>
+
#define MCU_SECTION_MAX 30
enum MCU_IMAGE_SEC_TYPE_ENUM {
diff --git a/plat/hisilicon/hikey/hisi_pwrc.c b/plat/hisilicon/hikey/hisi_pwrc.c
index b635fb16f..e2e3db752 100644
--- a/plat/hisilicon/hikey/hisi_pwrc.c
+++ b/plat/hisilicon/hikey/hisi_pwrc.c
@@ -4,8 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <mmio.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <platform_def.h>
+
+#include <common/debug.h>
+#include <lib/mmio.h>
#include <hi6220_regs_acpu.h>
#include <hi6220_regs_ao.h>
@@ -13,11 +19,6 @@
#include <hisi_pwrc.h>
#include <hisi_sram_map.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <platform_def.h>
-
#define CLUSTER_CORE_COUNT (4)
#define CLUSTER_CORE_MASK ((1 << CLUSTER_CORE_COUNT) - 1)
diff --git a/plat/hisilicon/hikey/hisi_sip_svc.c b/plat/hisilicon/hikey/hisi_sip_svc.c
index ffa490376..3cd1bd092 100644
--- a/plat/hisilicon/hikey/hisi_sip_svc.c
+++ b/plat/hisilicon/hikey/hisi_sip_svc.c
@@ -4,13 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <hisi_sip_svc.h>
-#include <pmf.h>
-#include <runtime_svc.h>
#include <stdint.h>
-#include <uuid.h>
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <lib/pmf/pmf.h>
+#include <tools_share/uuid.h>
+
+#include <hisi_sip_svc.h>
/* Hisi SiP Service UUID */
DEFINE_SVC_UUID2(hisi_sip_svc_uid,
diff --git a/plat/hisilicon/hikey/include/hi6553.h b/plat/hisilicon/hikey/include/hi6553.h
index 55ce91caf..fc991f842 100644
--- a/plat/hisilicon/hikey/include/hi6553.h
+++ b/plat/hisilicon/hikey/include/hi6553.h
@@ -7,8 +7,9 @@
#ifndef HI6553_H
#define HI6553_H
+#include <lib/mmio.h>
+
#include <hi6220.h>
-#include <mmio.h>
#define HI6553_DISABLE6_XO_CLK (PMUSSI_BASE + (0x036 << 2))
diff --git a/plat/hisilicon/hikey/include/plat_macros.S b/plat/hisilicon/hikey/include/plat_macros.S
index de38bd50b..9cd276a3e 100644
--- a/plat/hisilicon/hikey/include/plat_macros.S
+++ b/plat/hisilicon/hikey/include/plat_macros.S
@@ -7,8 +7,8 @@
#ifndef PLAT_MACROS_S
#define PLAT_MACROS_S
-#include <cci.h>
-#include <gicv2.h>
+#include <drivers/arm/cci.h>
+#include <drivers/arm/gicv2.h>
#include <hi6220.h>
#include <platform_def.h>
diff --git a/plat/hisilicon/hikey/include/platform_def.h b/plat/hisilicon/hikey/include/platform_def.h
index 485eb3800..2537ac66b 100644
--- a/plat/hisilicon/hikey/include/platform_def.h
+++ b/plat/hisilicon/hikey/include/platform_def.h
@@ -8,11 +8,12 @@
#define PLATFORM_DEF_H
#include <arch.h>
-#include <common_def.h>
+#include <common/tbbr/tbbr_img_def.h>
+#include <lib/utils_def.h>
+#include <plat/common/common_def.h>
+
#include <hikey_def.h>
#include <hikey_layout.h> /* BL memory region sizes, etc */
-#include <tbbr_img_def.h>
-#include <utils_def.h>
/* Special value used to verify platform parameters from BL2 to BL3-1 */
#define HIKEY_BL31_PLAT_PARAM_VAL 0x0f1e2d3c4b5a6978ULL
diff --git a/plat/hisilicon/hikey/platform.mk b/plat/hisilicon/hikey/platform.mk
index 398b224cf..6d077f746 100644
--- a/plat/hisilicon/hikey/platform.mk
+++ b/plat/hisilicon/hikey/platform.mk
@@ -46,7 +46,6 @@ endif
USE_COHERENT_MEM := 1
PLAT_INCLUDES := -Iinclude/common/tbbr \
- -Iinclude/drivers/synopsys \
-Iplat/hisilicon/hikey/include
PLAT_BL_COMMON_SOURCES := drivers/arm/pl011/aarch64/pl011_console.S \
diff --git a/plat/hisilicon/hikey960/aarch64/hikey960_common.c b/plat/hisilicon/hikey960/aarch64/hikey960_common.c
index 1ed3eaa67..612a7f21b 100644
--- a/plat/hisilicon/hikey960/aarch64/hikey960_common.c
+++ b/plat/hisilicon/hikey960/aarch64/hikey960_common.c
@@ -4,14 +4,16 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <mmio.h>
-#include <platform.h>
+
#include <platform_def.h>
-#include <xlat_tables.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables.h>
+#include <plat/common/platform.h>
#include "../hikey960_def.h"
#include "../hikey960_private.h"
diff --git a/plat/hisilicon/hikey960/drivers/ipc/hisi_ipc.c b/plat/hisilicon/hikey960/drivers/ipc/hisi_ipc.c
index 4c664d112..a6a494934 100644
--- a/plat/hisilicon/hikey960/drivers/ipc/hisi_ipc.c
+++ b/plat/hisilicon/hikey960/drivers/ipc/hisi_ipc.c
@@ -4,15 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
-#include <hi3660.h>
-#include <hisi_ipc.h>
-#include <mmio.h>
-#include <platform.h>
+
#include <platform_def.h>
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
+#include <hi3660.h>
+#include <hisi_ipc.h>
#include "../../hikey960_private.h"
#define IPC_MBX_SOURCE_REG(m) (IPC_BASE + ((m) << 6))
diff --git a/plat/hisilicon/hikey960/drivers/pwrc/hisi_pwrc.c b/plat/hisilicon/hikey960/drivers/pwrc/hisi_pwrc.c
index 45fcd42b4..659a1c4ad 100644
--- a/plat/hisilicon/hikey960/drivers/pwrc/hisi_pwrc.c
+++ b/plat/hisilicon/hikey960/drivers/pwrc/hisi_pwrc.c
@@ -4,15 +4,16 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <../hikey960_def.h>
-#include <arch_helpers.h>
#include <assert.h>
-#include <hisi_ipc.h>
-#include <mmio.h>
-#include <platform.h>
+
#include <platform_def.h>
+#include <arch_helpers.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+#include <../hikey960_def.h>
+#include <hisi_ipc.h>
#include "hisi_pwrc.h"
diff --git a/plat/hisilicon/hikey960/hikey960_bl1_setup.c b/plat/hisilicon/hikey960/hikey960_bl1_setup.c
index ff2c77a60..38bdbe417 100644
--- a/plat/hisilicon/hikey960/hikey960_bl1_setup.c
+++ b/plat/hisilicon/hikey960/hikey960_bl1_setup.c
@@ -4,26 +4,28 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <dw_ufs.h>
#include <errno.h>
-#include <generic_delay_timer.h>
-#include <gicv2.h>
-#include <hi3660.h>
-#include <interrupt_props.h>
-#include <mmio.h>
-#include <pl011.h>
-#include <platform.h>
-#include <platform_def.h>
#include <string.h>
-#include <tbbr/tbbr_img_desc.h>
-#include <ufs.h>
-#include "../../bl1/bl1_private.h"
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <bl1/tbbr/tbbr_img_desc.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/arm/pl011.h>
+#include <drivers/delay_timer.h>
+#include <drivers/dw_ufs.h>
+#include <drivers/generic_delay_timer.h>
+#include <drivers/ufs.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
+#include <hi3660.h>
+#include "../../../bl1/bl1_private.h"
#include "hikey960_def.h"
#include "hikey960_private.h"
diff --git a/plat/hisilicon/hikey960/hikey960_bl2_mem_params_desc.c b/plat/hisilicon/hikey960/hikey960_bl2_mem_params_desc.c
index 2944b1f7c..ba236d22f 100644
--- a/plat/hisilicon/hikey960/hikey960_bl2_mem_params_desc.c
+++ b/plat/hisilicon/hikey960/hikey960_bl2_mem_params_desc.c
@@ -4,11 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
#include <platform_def.h>
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
/*******************************************************************************
* Following descriptor provides BL image/ep information that gets used
diff --git a/plat/hisilicon/hikey960/hikey960_bl2_setup.c b/plat/hisilicon/hikey960/hikey960_bl2_setup.c
index 552356f1c..788392db7 100644
--- a/plat/hisilicon/hikey960/hikey960_bl2_setup.c
+++ b/plat/hisilicon/hikey960/hikey960_bl2_setup.c
@@ -4,25 +4,27 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <desc_image_load.h>
-#include <dw_ufs.h>
#include <errno.h>
-#include <generic_delay_timer.h>
-#include <hi3660.h>
-#include <mmio.h>
+#include <string.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/desc_image_load.h>
+#include <drivers/arm/pl011.h>
+#include <drivers/delay_timer.h>
+#include <drivers/dw_ufs.h>
+#include <drivers/generic_delay_timer.h>
+#include <drivers/ufs.h>
+#include <lib/mmio.h>
#ifdef SPD_opteed
-#include <optee_utils.h>
+#include <lib/optee_utils.h>
#endif
-#include <pl011.h>
-#include <platform_def.h>
-#include <string.h>
-#include <ufs.h>
+#include <hi3660.h>
#include "hikey960_def.h"
#include "hikey960_private.h"
diff --git a/plat/hisilicon/hikey960/hikey960_bl31_setup.c b/plat/hisilicon/hikey960/hikey960_bl31_setup.c
index 226147061..67b06f498 100644
--- a/plat/hisilicon/hikey960/hikey960_bl31_setup.c
+++ b/plat/hisilicon/hikey960/hikey960_bl31_setup.c
@@ -4,24 +4,26 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <cci.h>
-#include <console.h>
-#include <debug.h>
#include <errno.h>
-#include <generic_delay_timer.h>
-#include <gicv2.h>
-#include <hi3660.h>
-#include <mmio.h>
-#include <hisi_ipc.h>
-#include <interrupt_mgmt.h>
-#include <interrupt_props.h>
-#include <pl011.h>
-#include <platform.h>
+
#include <platform_def.h>
+#include <arch_helpers.h>
+#include <bl31/interrupt_mgmt.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/cci.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/arm/pl011.h>
+#include <drivers/console.h>
+#include <drivers/generic_delay_timer.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
+#include <hi3660.h>
+#include <hisi_ipc.h>
#include "hikey960_def.h"
#include "hikey960_private.h"
diff --git a/plat/hisilicon/hikey960/hikey960_bl_common.c b/plat/hisilicon/hikey960/hikey960_bl_common.c
index 0cee69f94..89adccb2b 100644
--- a/plat/hisilicon/hikey960/hikey960_bl_common.c
+++ b/plat/hisilicon/hikey960/hikey960_bl_common.c
@@ -4,12 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <delay_timer.h>
-#include <hi3660.h>
-#include <mmio.h>
-#include <pl061_gpio.h>
+#include <common/debug.h>
+#include <drivers/arm/pl061_gpio.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+#include <hi3660.h>
#include "hikey960_private.h"
void hikey960_clk_init(void)
diff --git a/plat/hisilicon/hikey960/hikey960_boardid.c b/plat/hisilicon/hikey960/hikey960_boardid.c
index f39c15385..1e1126fb1 100644
--- a/plat/hisilicon/hikey960/hikey960_boardid.c
+++ b/plat/hisilicon/hikey960/hikey960_boardid.c
@@ -5,12 +5,13 @@
*/
#include <assert.h>
-#include <debug.h>
-#include <delay_timer.h>
#include <errno.h>
-#include <hi3660.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
+#include <hi3660.h>
#include "hikey960_private.h"
#define ADC_ADCIN0 0
diff --git a/plat/hisilicon/hikey960/hikey960_def.h b/plat/hisilicon/hikey960/hikey960_def.h
index 91d0af3c0..d977c7989 100644
--- a/plat/hisilicon/hikey960/hikey960_def.h
+++ b/plat/hisilicon/hikey960/hikey960_def.h
@@ -7,8 +7,8 @@
#ifndef HIKEY960_DEF_H
#define HIKEY960_DEF_H
-#include <common_def.h>
-#include <tbbr_img_def.h>
+#include <common/tbbr/tbbr_img_def.h>
+#include <plat/common/common_def.h>
#define DDR_BASE 0x0
#define DDR_SIZE 0xC0000000
diff --git a/plat/hisilicon/hikey960/hikey960_image_load.c b/plat/hisilicon/hikey960/hikey960_image_load.c
index ad7be5081..57cb1b228 100644
--- a/plat/hisilicon/hikey960/hikey960_image_load.c
+++ b/plat/hisilicon/hikey960/hikey960_image_load.c
@@ -4,9 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
/*******************************************************************************
* This function flushes the data structures so that they are visible
diff --git a/plat/hisilicon/hikey960/hikey960_io_storage.c b/plat/hisilicon/hikey960/hikey960_io_storage.c
index cff3b0d23..a4e83897e 100644
--- a/plat/hisilicon/hikey960/hikey960_io_storage.c
+++ b/plat/hisilicon/hikey960/hikey960_io_storage.c
@@ -4,21 +4,23 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
#include <errno.h>
-#include <firmware_image_package.h>
-#include <io_block.h>
-#include <io_driver.h>
-#include <io_fip.h>
-#include <io_memmap.h>
-#include <io_storage.h>
-#include <mmio.h>
-#include <platform_def.h>
-#include <semihosting.h> /* For FOPEN_MODE_... */
#include <string.h>
-#include <ufs.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/ufs.h>
+#include <drivers/io/io_block.h>
+#include <drivers/io/io_driver.h>
+#include <drivers/io/io_fip.h>
+#include <drivers/io/io_memmap.h>
+#include <drivers/io/io_storage.h>
+#include <lib/mmio.h>
+#include <lib/semihosting.h>
+#include <tools_share/firmware_image_package.h>
struct plat_io_policy {
uintptr_t *dev_handle;
diff --git a/plat/hisilicon/hikey960/hikey960_mcu_load.c b/plat/hisilicon/hikey960/hikey960_mcu_load.c
index 7bf9a3d06..b9ae31368 100644
--- a/plat/hisilicon/hikey960/hikey960_mcu_load.c
+++ b/plat/hisilicon/hikey960/hikey960_mcu_load.c
@@ -4,16 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <delay_timer.h>
#include <errno.h>
-#include <hi3660.h>
-#include <mmio.h>
#include <string.h>
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
+#include <hi3660.h>
+
#define ADDR_CONVERT(addr) ((addr) < 0x40000 ? \
(addr) + 0xFFF30000 : \
(addr) + 0x40000000)
diff --git a/plat/hisilicon/hikey960/hikey960_pm.c b/plat/hisilicon/hikey960/hikey960_pm.c
index f1873eecd..676cfa3f3 100644
--- a/plat/hisilicon/hikey960/hikey960_pm.c
+++ b/plat/hisilicon/hikey960/hikey960_pm.c
@@ -4,19 +4,21 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <cci.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <gicv2.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/arm/pl011.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+
#include <hi3660.h>
#include <hi3660_crg.h>
-#include <mmio.h>
-#include <pl011.h>
-#include <psci.h>
-#include "drivers/pwrc/hisi_pwrc.h"
+#include "drivers/pwrc/hisi_pwrc.h"
#include "hikey960_def.h"
#include "hikey960_private.h"
diff --git a/plat/hisilicon/hikey960/hikey960_private.h b/plat/hisilicon/hikey960/hikey960_private.h
index 31d3a4ae3..9a18dd620 100644
--- a/plat/hisilicon/hikey960/hikey960_private.h
+++ b/plat/hisilicon/hikey960/hikey960_private.h
@@ -7,7 +7,7 @@
#ifndef HIKEY960_PRIVATE_H
#define HIKEY960_PRIVATE_H
-#include <bl_common.h>
+#include <common/bl_common.h>
/*
* Function and variable prototypes
diff --git a/plat/hisilicon/hikey960/hikey960_tbbr.c b/plat/hisilicon/hikey960/hikey960_tbbr.c
index e9f28b3bc..e435ec2e5 100644
--- a/plat/hisilicon/hikey960/hikey960_tbbr.c
+++ b/plat/hisilicon/hikey960/hikey960_tbbr.c
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <platform.h>
+#include <plat/common/platform.h>
extern char hikey960_rotpk_hash[], hikey960_rotpk_hash_end[];
diff --git a/plat/hisilicon/hikey960/hikey960_topology.c b/plat/hisilicon/hikey960/hikey960_topology.c
index 336372469..a242bb1d3 100644
--- a/plat/hisilicon/hikey960/hikey960_topology.c
+++ b/plat/hisilicon/hikey960/hikey960_topology.c
@@ -3,9 +3,11 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
+
#include <platform_def.h>
-#include <psci.h>
+
+#include <arch.h>
+#include <lib/psci/psci.h>
/*
* The HiKey power domain tree descriptor. The cluster power domains
diff --git a/plat/hisilicon/hikey960/include/plat_macros.S b/plat/hisilicon/hikey960/include/plat_macros.S
index 3b126f652..8765562a0 100644
--- a/plat/hisilicon/hikey960/include/plat_macros.S
+++ b/plat/hisilicon/hikey960/include/plat_macros.S
@@ -7,8 +7,8 @@
#ifndef PLAT_MACROS_S
#define PLAT_MACROS_S
-#include <cci.h>
-#include <gicv2.h>
+#include <drivers/arm/cci.h>
+#include <drivers/arm/gicv2.h>
#include <hi3660.h>
#include <platform_def.h>
diff --git a/plat/hisilicon/hikey960/include/platform_def.h b/plat/hisilicon/hikey960/include/platform_def.h
index 427a1e759..3e2d79daa 100644
--- a/plat/hisilicon/hikey960/include/platform_def.h
+++ b/plat/hisilicon/hikey960/include/platform_def.h
@@ -8,7 +8,8 @@
#define PLATFORM_DEF_H
#include <arch.h>
-#include <utils_def.h>
+#include <lib/utils_def.h>
+
#include "../hikey960_def.h"
/* Special value used to verify platform parameters from BL2 to BL3-1 */
diff --git a/plat/hisilicon/poplar/aarch64/platform_common.c b/plat/hisilicon/poplar/aarch64/platform_common.c
index d408209d8..fcd0a8bcf 100644
--- a/plat/hisilicon/poplar/aarch64/platform_common.c
+++ b/plat/hisilicon/poplar/aarch64/platform_common.c
@@ -4,15 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <delay_timer.h>
#include <errno.h>
-#include <mmio.h>
-#include <platform.h>
-#include <xlat_tables.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables.h>
+#include <plat/common/platform.h>
+
#include "hi3798cv200.h"
#include "platform_def.h"
diff --git a/plat/hisilicon/poplar/bl1_plat_setup.c b/plat/hisilicon/poplar/bl1_plat_setup.c
index d0b12ad2b..eb8ffe4fd 100644
--- a/plat/hisilicon/poplar/bl1_plat_setup.c
+++ b/plat/hisilicon/poplar/bl1_plat_setup.c
@@ -4,22 +4,25 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <dw_mmc.h>
#include <errno.h>
-#include <generic_delay_timer.h>
-#include <mmc.h>
-#include <mmio.h>
-#include <pl011.h>
-#include <pl061_gpio.h>
-#include <platform.h>
-#include <platform_def.h>
#include <string.h>
-#include <tbbr_img_def.h>
-#include "../../bl1/bl1_private.h"
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/tbbr/tbbr_img_def.h>
+#include <drivers/arm/pl011.h>
+#include <drivers/arm/pl061_gpio.h>
+#include <drivers/generic_delay_timer.h>
+#include <drivers/mmc.h>
+#include <drivers/synopsys/dw_mmc.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
+#include "../../../bl1/bl1_private.h"
#include "hi3798cv200.h"
#include "plat_private.h"
diff --git a/plat/hisilicon/poplar/bl2_plat_mem_params_desc.c b/plat/hisilicon/poplar/bl2_plat_mem_params_desc.c
index c73ead8d7..f683d750d 100644
--- a/plat/hisilicon/poplar/bl2_plat_mem_params_desc.c
+++ b/plat/hisilicon/poplar/bl2_plat_mem_params_desc.c
@@ -4,11 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
#include <platform_def.h>
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
/*******************************************************************************
* Following descriptor provides BL image/ep information that gets used
diff --git a/plat/hisilicon/poplar/bl2_plat_setup.c b/plat/hisilicon/poplar/bl2_plat_setup.c
index 3a3ed6a46..ff8e107db 100644
--- a/plat/hisilicon/poplar/bl2_plat_setup.c
+++ b/plat/hisilicon/poplar/bl2_plat_setup.c
@@ -4,21 +4,23 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <desc_image_load.h>
-#include <dw_mmc.h>
#include <errno.h>
-#include <generic_delay_timer.h>
-#include <mmc.h>
-#include <mmio.h>
-#include <optee_utils.h>
-#include <partition/partition.h>
-#include <pl011.h>
-#include <platform.h>
#include <string.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/desc_image_load.h>
+#include <drivers/arm/pl011.h>
+#include <drivers/generic_delay_timer.h>
+#include <drivers/partition/partition.h>
+#include <drivers/synopsys/dw_mmc.h>
+#include <drivers/mmc.h>
+#include <lib/mmio.h>
+#include <lib/optee_utils.h>
+#include <plat/common/platform.h>
+
#include "hi3798cv200.h"
#include "plat_private.h"
diff --git a/plat/hisilicon/poplar/bl31_plat_setup.c b/plat/hisilicon/poplar/bl31_plat_setup.c
index e2079f9ee..69911e8d5 100644
--- a/plat/hisilicon/poplar/bl31_plat_setup.c
+++ b/plat/hisilicon/poplar/bl31_plat_setup.c
@@ -4,21 +4,24 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl31.h>
-#include <bl_common.h>
-#include <cortex_a53.h>
-#include <debug.h>
#include <errno.h>
-#include <generic_delay_timer.h>
-#include <mmio.h>
-#include <pl011.h>
-#include <platform.h>
-#include <platform_def.h>
#include <stddef.h>
#include <string.h>
+
+#include <platform_def.h>
+
+#include <arch.h>
+#include <arch_helpers.h>
+#include <bl31/bl31.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <cortex_a53.h>
+#include <drivers/arm/pl011.h>
+#include <drivers/generic_delay_timer.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include "hi3798cv200.h"
#include "plat_private.h"
diff --git a/plat/hisilicon/poplar/include/hi3798cv200.h b/plat/hisilicon/poplar/include/hi3798cv200.h
index ddb43964c..e31f4b3e1 100644
--- a/plat/hisilicon/poplar/include/hi3798cv200.h
+++ b/plat/hisilicon/poplar/include/hi3798cv200.h
@@ -7,7 +7,7 @@
#ifndef HI3798CV200_H
#define HI3798CV200_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
/* PL011 */
#define PL011_UART0_BASE (0xF8B00000)
diff --git a/plat/hisilicon/poplar/include/plat_private.h b/plat/hisilicon/poplar/include/plat_private.h
index 3aeccc424..a34f13846 100644
--- a/plat/hisilicon/poplar/include/plat_private.h
+++ b/plat/hisilicon/poplar/include/plat_private.h
@@ -7,7 +7,8 @@
#ifndef PLAT_PRIVATE_H
#define PLAT_PRIVATE_H
-#include <bl_common.h>
+#include <common/bl_common.h>
+
#include "hi3798cv200.h"
void plat_configure_mmu_el3(unsigned long total_base,
diff --git a/plat/hisilicon/poplar/include/platform_def.h b/plat/hisilicon/poplar/include/platform_def.h
index e39d94471..8f7a1559b 100644
--- a/plat/hisilicon/poplar/include/platform_def.h
+++ b/plat/hisilicon/poplar/include/platform_def.h
@@ -8,11 +8,12 @@
#define PLATFORM_DEF_H
#include <arch.h>
-#include <common_def.h>
-#include <gic_common.h>
-#include <interrupt_props.h>
-#include <tbbr/tbbr_img_def.h>
-#include <utils_def.h>
+#include <common/interrupt_props.h>
+#include <common/tbbr/tbbr_img_def.h>
+#include <drivers/arm/gic_common.h>
+#include <lib/utils_def.h>
+#include <plat/common/common_def.h>
+
#include "hi3798cv200.h"
#include "poplar_layout.h" /* BL memory region sizes, etc */
diff --git a/plat/hisilicon/poplar/plat_pm.c b/plat/hisilicon/poplar/plat_pm.c
index eccb0b0d8..67ebca1ca 100644
--- a/plat/hisilicon/poplar/plat_pm.c
+++ b/plat/hisilicon/poplar/plat_pm.c
@@ -4,16 +4,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <context.h>
-#include <context_mgmt.h>
-#include <debug.h>
-#include <mmio.h>
-#include <platform.h>
+
#include <platform_def.h>
-#include <psci.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <context.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
+
#include "hi3798cv200.h"
#include "plat_private.h"
diff --git a/plat/hisilicon/poplar/plat_storage.c b/plat/hisilicon/poplar/plat_storage.c
index 925274ce4..a17e0f1a2 100644
--- a/plat/hisilicon/poplar/plat_storage.c
+++ b/plat/hisilicon/poplar/plat_storage.c
@@ -4,23 +4,25 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
-#include <firmware_image_package.h>
-#include <io_block.h>
-#include <io_driver.h>
-#include <io_fip.h>
-#include <io_memmap.h>
-#include <io_storage.h>
-#include <mmc.h>
-#include <mmio.h>
-#include <partition/partition.h>
-#include <semihosting.h>
#include <string.h>
-#include <tbbr_img_def.h>
-#include <utils.h>
-#include "platform_def.h"
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <common/tbbr/tbbr_img_def.h>
+#include <drivers/io/io_block.h>
+#include <drivers/io/io_driver.h>
+#include <drivers/io/io_fip.h>
+#include <drivers/io/io_memmap.h>
+#include <drivers/io/io_storage.h>
+#include <drivers/mmc.h>
+#include <drivers/partition/partition.h>
+#include <lib/mmio.h>
+#include <lib/semihosting.h>
+#include <lib/utils.h>
+#include <tools_share/firmware_image_package.h>
#if !POPLAR_RECOVERY
static const io_dev_connector_t *emmc_dev_con;
diff --git a/plat/hisilicon/poplar/plat_topology.c b/plat/hisilicon/poplar/plat_topology.c
index bb53c6b1f..764008e9e 100644
--- a/plat/hisilicon/poplar/plat_topology.c
+++ b/plat/hisilicon/poplar/plat_topology.c
@@ -4,9 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include <arch.h>
-#include <psci.h>
-#include "platform_def.h"
+#include <lib/psci/psci.h>
+
#include "plat_private.h"
const unsigned char hisi_power_domain_tree_desc[] = {
diff --git a/plat/hisilicon/poplar/platform.mk b/plat/hisilicon/poplar/platform.mk
index 0aaa7074a..eca14125e 100644
--- a/plat/hisilicon/poplar/platform.mk
+++ b/plat/hisilicon/poplar/platform.mk
@@ -54,9 +54,7 @@ $(eval $(call add_define,PLAT_PL061_MAX_GPIOS))
PLAT_INCLUDES := -Iplat/hisilicon/poplar/include \
-Iplat/hisilicon/poplar \
- -Iinclude/common/tbbr \
- -Iinclude/drivers/synopsys \
- -Iinclude/drivers/io
+ -Iinclude/common/tbbr
PLAT_BL_COMMON_SOURCES := \
lib/xlat_tables/aarch64/xlat_tables.c \
diff --git a/plat/hisilicon/poplar/poplar_gicv2.c b/plat/hisilicon/poplar/poplar_gicv2.c
index 1c1be47fb..59f7b76ee 100644
--- a/plat/hisilicon/poplar/poplar_gicv2.c
+++ b/plat/hisilicon/poplar/poplar_gicv2.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <gicv2.h>
-#include <platform.h>
#include <platform_def.h>
+#include <drivers/arm/gicv2.h>
+#include <plat/common/platform.h>
+
/******************************************************************************
* On a GICv2 system, the Group 1 secure interrupts are treated as Group 0
* interrupts.
diff --git a/plat/hisilicon/poplar/poplar_image_load.c b/plat/hisilicon/poplar/poplar_image_load.c
index 32ca36db0..0ab1ca496 100644
--- a/plat/hisilicon/poplar/poplar_image_load.c
+++ b/plat/hisilicon/poplar/poplar_image_load.c
@@ -4,9 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
/*******************************************************************************
* This function flushes the data structures so that they are visible
diff --git a/plat/imx/common/imx8_psci.c b/plat/imx/common/imx8_psci.c
index 22a531bf8..588d8b4e2 100644
--- a/plat/imx/common/imx8_psci.c
+++ b/plat/imx/common/imx8_psci.c
@@ -4,12 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <stdbool.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <debug.h>
+#include <common/debug.h>
+
#include <plat_imx8.h>
#include <sci/sci.h>
-#include <stdbool.h>
void __dead2 imx_system_off(void)
{
diff --git a/plat/imx/common/imx8_topology.c b/plat/imx/common/imx8_topology.c
index 64145c4ca..5e14d17fa 100644
--- a/plat/imx/common/imx8_topology.c
+++ b/plat/imx/common/imx8_topology.c
@@ -6,7 +6,7 @@
#include <arch.h>
#include <arch_helpers.h>
-#include <platform.h>
+#include <plat/common/platform.h>
const unsigned char imx_power_domain_tree_desc[] = {
PWR_DOMAIN_AT_MAX_LVL,
diff --git a/plat/imx/common/imx_aips.c b/plat/imx/common/imx_aips.c
index 991c262bc..532d9c0eb 100644
--- a/plat/imx/common/imx_aips.c
+++ b/plat/imx/common/imx_aips.c
@@ -4,8 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <mmio.h>
-#include <utils_def.h>
+#include <lib/mmio.h>
+#include <lib/utils_def.h>
+
#include <imx_aips.h>
#include <imx_regs.h>
diff --git a/plat/imx/common/imx_caam.c b/plat/imx/common/imx_caam.c
index 335e1ed8e..d9c141f56 100644
--- a/plat/imx/common/imx_caam.c
+++ b/plat/imx/common/imx_caam.c
@@ -3,8 +3,11 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <stdint.h>
-#include <mmio.h>
+
+#include <lib/mmio.h>
+
#include <imx_caam.h>
void imx_caam_init(void)
diff --git a/plat/imx/common/imx_clock.c b/plat/imx/common/imx_clock.c
index ccf2aeb13..743de553a 100644
--- a/plat/imx/common/imx_clock.c
+++ b/plat/imx/common/imx_clock.c
@@ -3,10 +3,13 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
-#include <mmio.h>
+
#include <stdint.h>
#include <stdbool.h>
+
+#include <arch.h>
+#include <lib/mmio.h>
+
#include <imx_regs.h>
#include <imx_clock.h>
diff --git a/plat/imx/common/imx_csu.c b/plat/imx/common/imx_csu.c
index 7c6a63e8a..7e165d928 100644
--- a/plat/imx/common/imx_csu.c
+++ b/plat/imx/common/imx_csu.c
@@ -3,7 +3,9 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <mmio.h>
+
+#include <lib/mmio.h>
+
#include <imx_csu.h>
#include <imx_regs.h>
diff --git a/plat/imx/common/imx_io_mux.c b/plat/imx/common/imx_io_mux.c
index 723064716..75de5d14e 100644
--- a/plat/imx/common/imx_io_mux.c
+++ b/plat/imx/common/imx_io_mux.c
@@ -4,7 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <mmio.h>
+#include <lib/mmio.h>
+
#include <imx_regs.h>
#include <imx_io_mux.h>
diff --git a/plat/imx/common/imx_snvs.c b/plat/imx/common/imx_snvs.c
index 4a2a7d725..9b3a73776 100644
--- a/plat/imx/common/imx_snvs.c
+++ b/plat/imx/common/imx_snvs.c
@@ -4,7 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <mmio.h>
+#include <lib/mmio.h>
+
#include <imx_regs.h>
#include <imx_snvs.h>
diff --git a/plat/imx/common/imx_wdog.c b/plat/imx/common/imx_wdog.c
index 86813dd01..af6d7678e 100644
--- a/plat/imx/common/imx_wdog.c
+++ b/plat/imx/common/imx_wdog.c
@@ -4,7 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <mmio.h>
+#include <lib/mmio.h>
+
#include <imx_regs.h>
#include <imx_wdog.h>
diff --git a/plat/imx/common/include/imx8_lpuart.h b/plat/imx/common/include/imx8_lpuart.h
index 8e1184f95..63449e7de 100644
--- a/plat/imx/common/include/imx8_lpuart.h
+++ b/plat/imx/common/include/imx8_lpuart.h
@@ -7,7 +7,7 @@
#ifndef IMX8_LPUART_H
#define IMX8_LPUART_H
-#include <console.h>
+#include <drivers/console.h>
#define VERID 0x0
#define PARAM 0x4
diff --git a/plat/imx/common/include/imx_snvs.h b/plat/imx/common/include/imx_snvs.h
index 0aed1e142..0b3d1085f 100644
--- a/plat/imx/common/include/imx_snvs.h
+++ b/plat/imx/common/include/imx_snvs.h
@@ -7,6 +7,7 @@
#define IMX_SNVS_H
#include <stdint.h>
+
#include <arch.h>
struct snvs {
diff --git a/plat/imx/common/include/imx_uart.h b/plat/imx/common/include/imx_uart.h
index d2c396888..a251024f1 100644
--- a/plat/imx/common/include/imx_uart.h
+++ b/plat/imx/common/include/imx_uart.h
@@ -7,7 +7,7 @@
#ifndef IMX_UART_H
#define IMX_UART_H
-#include <console.h>
+#include <drivers/console.h>
#ifndef __ASSEMBLY__
diff --git a/plat/imx/common/include/imx_wdog.h b/plat/imx/common/include/imx_wdog.h
index 7b3037dfe..75a729a99 100644
--- a/plat/imx/common/include/imx_wdog.h
+++ b/plat/imx/common/include/imx_wdog.h
@@ -7,9 +7,10 @@
#ifndef IMX_WDOG_H
#define IMX_WDOG_H
-#include <arch.h>
#include <stdint.h>
+#include <arch.h>
+
struct wdog_regs {
uint16_t wcr;
uint16_t wsr;
diff --git a/plat/imx/common/include/plat_imx8.h b/plat/imx/common/include/plat_imx8.h
index 03799c459..8d83173fd 100644
--- a/plat/imx/common/include/plat_imx8.h
+++ b/plat/imx/common/include/plat_imx8.h
@@ -7,8 +7,8 @@
#ifndef PLAT_IMX8_H
#define PLAT_IMX8_H
-#include <gicv3.h>
-#include <psci.h>
+#include <drivers/arm/gicv3.h>
+#include <lib/psci/psci.h>
unsigned int plat_calc_core_pos(uint64_t mpidr);
void imx_mailbox_init(uintptr_t base_addr);
diff --git a/plat/imx/common/include/sci/sci_rpc.h b/plat/imx/common/include/sci/sci_rpc.h
index 1771baed3..60dbc27b6 100644
--- a/plat/imx/common/include/sci/sci_rpc.h
+++ b/plat/imx/common/include/sci/sci_rpc.h
@@ -13,9 +13,10 @@
/* Includes */
+#include <stdbool.h>
+
#include <sci/sci_types.h>
#include <sci/sci_ipc.h>
-#include <stdbool.h>
/* Defines */
diff --git a/plat/imx/common/plat_imx8_gic.c b/plat/imx/common/plat_imx8_gic.c
index 2da9cc0d9..aec0b6c9b 100644
--- a/plat/imx/common/plat_imx8_gic.c
+++ b/plat/imx/common/plat_imx8_gic.c
@@ -4,13 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <gicv3.h>
-#include <interrupt_props.h>
-#include <plat_imx8.h>
-#include <platform.h>
#include <platform_def.h>
-#include <utils.h>
+
+#include <common/bl_common.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gicv3.h>
+#include <lib/utils.h>
+#include <plat/common/platform.h>
+
+#include <plat_imx8.h>
/* the GICv3 driver only needs to be initialized in EL3 */
uintptr_t rdistif_base_addrs[PLATFORM_CORE_COUNT];
diff --git a/plat/imx/common/sci/imx8_mu.c b/plat/imx/common/sci/imx8_mu.c
index 8028c76d6..26d9bdfef 100644
--- a/plat/imx/common/sci/imx8_mu.c
+++ b/plat/imx/common/sci/imx8_mu.c
@@ -4,7 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <mmio.h>
+#include <lib/mmio.h>
+
#include "imx8_mu.h"
void MU_EnableRxFullInt(uint32_t base, uint32_t index)
diff --git a/plat/imx/common/sci/ipc.c b/plat/imx/common/sci/ipc.c
index 2af256782..6491ca575 100644
--- a/plat/imx/common/sci/ipc.c
+++ b/plat/imx/common/sci/ipc.c
@@ -4,11 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bakery_lock.h>
+#include <stdlib.h>
+
+#include <lib/bakery_lock.h>
+
#include <sci/sci_scfw.h>
#include <sci/sci_ipc.h>
#include <sci/sci_rpc.h>
-#include <stdlib.h>
#include "imx8_mu.h"
DEFINE_BAKERY_LOCK(sc_ipc_bakery_lock);
diff --git a/plat/imx/common/sci/svc/pad/pad_rpc_clnt.c b/plat/imx/common/sci/svc/pad/pad_rpc_clnt.c
index 555e7047a..319d4696d 100644
--- a/plat/imx/common/sci/svc/pad/pad_rpc_clnt.c
+++ b/plat/imx/common/sci/svc/pad/pad_rpc_clnt.c
@@ -14,11 +14,12 @@
/* Includes */
+#include <stdlib.h>
+
#include <sci/sci_types.h>
#include <sci/svc/rm/sci_rm_api.h>
#include <sci/svc/pad/sci_pad_api.h>
#include <sci/sci_rpc.h>
-#include <stdlib.h>
#include "sci_pad_rpc.h"
/* Local Defines */
diff --git a/plat/imx/common/sci/svc/pm/pm_rpc_clnt.c b/plat/imx/common/sci/svc/pm/pm_rpc_clnt.c
index b108c499b..66a57a13d 100644
--- a/plat/imx/common/sci/svc/pm/pm_rpc_clnt.c
+++ b/plat/imx/common/sci/svc/pm/pm_rpc_clnt.c
@@ -14,11 +14,13 @@
/* Includes */
+#include <stdlib.h>
+
#include <sci/sci_types.h>
#include <sci/svc/rm/sci_rm_api.h>
#include <sci/svc/pm/sci_pm_api.h>
#include <sci/sci_rpc.h>
-#include <stdlib.h>
+
#include "sci_pm_rpc.h"
/* Local Defines */
diff --git a/plat/imx/common/sci/svc/rm/rm_rpc_clnt.c b/plat/imx/common/sci/svc/rm/rm_rpc_clnt.c
index 230956c7c..16771a583 100644
--- a/plat/imx/common/sci/svc/rm/rm_rpc_clnt.c
+++ b/plat/imx/common/sci/svc/rm/rm_rpc_clnt.c
@@ -14,10 +14,12 @@
/* Includes */
+#include <stdlib.h>
+
#include <sci/sci_types.h>
#include <sci/svc/rm/sci_rm_api.h>
#include <sci/sci_rpc.h>
-#include <stdlib.h>
+
#include "sci_rm_rpc.h"
/* Local Defines */
diff --git a/plat/imx/imx7/warp7/include/platform_def.h b/plat/imx/imx7/warp7/include/platform_def.h
index 4ee6fd37d..a931c8062 100644
--- a/plat/imx/imx7/warp7/include/platform_def.h
+++ b/plat/imx/imx7/warp7/include/platform_def.h
@@ -8,8 +8,8 @@
#define PLATFORM_DEF_H
#include <arch.h>
-#include <common_def.h>
-#include <tbbr_img_def.h>
+#include <common/tbbr/tbbr_img_def.h>
+#include <plat/common/common_def.h>
#define PLATFORM_STACK_SIZE 0x1000
diff --git a/plat/imx/imx7/warp7/warp7_bl2_el3_setup.c b/plat/imx/imx7/warp7/warp7_bl2_el3_setup.c
index 10c4160cf..032ed7b19 100644
--- a/plat/imx/imx7/warp7/warp7_bl2_el3_setup.c
+++ b/plat/imx/imx7/warp7/warp7_bl2_el3_setup.c
@@ -4,19 +4,22 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <console.h>
-#include <debug.h>
-#include <desc_image_load.h>
-#include <mmc.h>
-#include <mmio.h>
-#include <optee_utils.h>
+
#include <platform_def.h>
-#include <utils.h>
-#include <xlat_mmu_helpers.h>
-#include <xlat_tables_defs.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/desc_image_load.h>
+#include <drivers/console.h>
+#include <drivers/mmc.h>
+#include <lib/xlat_tables/xlat_mmu_helpers.h>
+#include <lib/xlat_tables/xlat_tables_defs.h>
+#include <lib/mmio.h>
+#include <lib/optee_utils.h>
+#include <lib/utils.h>
+
#include <imx_aips.h>
#include <imx_caam.h>
#include <imx_clock.h>
@@ -27,6 +30,7 @@
#include <imx_snvs.h>
#include <imx_usdhc.h>
#include <imx_wdog.h>
+
#include "warp7_private.h"
#define UART1_CLK_SELECT (CCM_TARGET_ROOT_ENABLE |\
diff --git a/plat/imx/imx7/warp7/warp7_bl2_mem_params_desc.c b/plat/imx/imx7/warp7/warp7_bl2_mem_params_desc.c
index 12254d46c..a29e14198 100644
--- a/plat/imx/imx7/warp7/warp7_bl2_mem_params_desc.c
+++ b/plat/imx/imx7/warp7/warp7_bl2_mem_params_desc.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
#include <platform_def.h>
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
+
static bl_mem_params_node_t bl2_mem_params_descs[] = {
{
.image_id = BL32_IMAGE_ID,
diff --git a/plat/imx/imx7/warp7/warp7_image_load.c b/plat/imx/imx7/warp7/warp7_image_load.c
index 1e3a2b0b5..c3e47b9d7 100644
--- a/plat/imx/imx7/warp7/warp7_image_load.c
+++ b/plat/imx/imx7/warp7/warp7_image_load.c
@@ -4,9 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
void plat_flush_next_bl_params(void)
{
diff --git a/plat/imx/imx7/warp7/warp7_io_storage.c b/plat/imx/imx7/warp7/warp7_io_storage.c
index 8354766ae..b9cace090 100644
--- a/plat/imx/imx7/warp7/warp7_io_storage.c
+++ b/plat/imx/imx7/warp7/warp7_io_storage.c
@@ -3,16 +3,19 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <assert.h>
-#include <debug.h>
-#include <mmc.h>
-#include <firmware_image_package.h>
-#include <io_block.h>
-#include <io_driver.h>
-#include <io_fip.h>
-#include <io_memmap.h>
+
#include <platform_def.h>
+#include <common/debug.h>
+#include <drivers/io/io_block.h>
+#include <drivers/io/io_driver.h>
+#include <drivers/io/io_fip.h>
+#include <drivers/io/io_memmap.h>
+#include <drivers/mmc.h>
+#include <tools_share/firmware_image_package.h>
+
static const io_dev_connector_t *fip_dev_con;
static uintptr_t fip_dev_handle;
diff --git a/plat/imx/imx8m/imx8mq/gpc.c b/plat/imx/imx8m/imx8mq/gpc.c
index 187a4ad1f..7fa5a3d1b 100644
--- a/plat/imx/imx8m/imx8mq/gpc.c
+++ b/plat/imx/imx8m/imx8mq/gpc.c
@@ -4,15 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <gpc.h>
-#include <mmio.h>
-#include <platform_def.h>
-#include <psci.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
-#include <std_svc.h>
+
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+#include <platform_def.h>
+#include <services/std_svc.h>
+
+#include <gpc.h>
void imx_set_cpu_secure_entry(unsigned int core_id, uintptr_t sec_entrypoint)
{
diff --git a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c
index 45d2a40f6..f4e6ee746 100644
--- a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c
+++ b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c
@@ -4,22 +4,25 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <console.h>
+#include <stdbool.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
#include <context.h>
-#include <context_mgmt.h>
-#include <debug.h>
+#include <drivers/arm/tzc380.h>
+#include <drivers/console.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables.h>
+#include <plat/common/platform.h>
+
#include <gpc.h>
#include <imx_uart.h>
-#include <stdbool.h>
-#include <mmio.h>
-#include <platform.h>
-#include <platform_def.h>
#include <plat_imx8.h>
-#include <xlat_tables.h>
-#include <tzc380.h>
IMPORT_SYM(uintptr_t, __COHERENT_RAM_START__, BL31_COHERENT_RAM_START);
IMPORT_SYM(uintptr_t, __COHERENT_RAM_END__, BL31_COHERENT_RAM_END);
diff --git a/plat/imx/imx8m/imx8mq/imx8mq_psci.c b/plat/imx/imx8m/imx8mq/imx8mq_psci.c
index 7afe52d3d..ee588656e 100644
--- a/plat/imx/imx8m/imx8mq/imx8mq_psci.c
+++ b/plat/imx/imx8m/imx8mq/imx8mq_psci.c
@@ -4,14 +4,16 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <stdbool.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <debug.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+
#include <gpc.h>
-#include <stdbool.h>
#include <plat_imx8.h>
-#include <psci.h>
-#include <mmio.h>
#define CORE_PWR_STATE(state) ((state)->pwr_domain_state[MPIDR_AFFLVL0])
#define CLUSTER_PWR_STATE(state) ((state)->pwr_domain_state[MPIDR_AFFLVL1])
diff --git a/plat/imx/imx8qm/imx8qm_bl31_setup.c b/plat/imx/imx8qm/imx8qm_bl31_setup.c
index 7410ac136..a00695cc3 100644
--- a/plat/imx/imx8qm/imx8qm_bl31_setup.c
+++ b/plat/imx/imx8qm/imx8qm_bl31_setup.c
@@ -4,25 +4,28 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <cci.h>
-#include <console.h>
+#include <stdbool.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
#include <context.h>
-#include <context_mgmt.h>
-#include <debug.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/console.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables.h>
+#include <plat/common/platform.h>
+
#include <imx8qm_pads.h>
#include <imx8_iomux.h>
#include <imx8_lpuart.h>
-#include <mmio.h>
-#include <platform.h>
-#include <platform_def.h>
#include <plat_imx8.h>
#include <sci/sci.h>
#include <sec_rsrc.h>
-#include <stdbool.h>
-#include <xlat_tables.h>
IMPORT_SYM(unsigned long, __COHERENT_RAM_START__, BL31_COHERENT_RAM_START);
IMPORT_SYM(unsigned long, __COHERENT_RAM_END__, BL31_COHERENT_RAM_END);
diff --git a/plat/imx/imx8qm/imx8qm_psci.c b/plat/imx/imx8qm/imx8qm_psci.c
index 8166546d4..833048dcf 100644
--- a/plat/imx/imx8qm/imx8qm_psci.c
+++ b/plat/imx/imx8qm/imx8qm_psci.c
@@ -4,16 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <stdbool.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <cci.h>
-#include <debug.h>
-#include <gicv3.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/arm/gicv3.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+
#include <plat_imx8.h>
-#include <psci.h>
#include <sci/sci.h>
-#include <stdbool.h>
#define CORE_PWR_STATE(state) \
((state)->pwr_domain_state[MPIDR_AFFLVL0])
diff --git a/plat/imx/imx8qm/include/platform_def.h b/plat/imx/imx8qm/include/platform_def.h
index 1cf7511a8..1d0bdf9a7 100644
--- a/plat/imx/imx8qm/include/platform_def.h
+++ b/plat/imx/imx8qm/include/platform_def.h
@@ -7,7 +7,7 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
#define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
#define PLATFORM_LINKER_ARCH aarch64
diff --git a/plat/imx/imx8qx/imx8qx_bl31_setup.c b/plat/imx/imx8qx/imx8qx_bl31_setup.c
index 6384a8566..c90794a89 100644
--- a/plat/imx/imx8qx/imx8qx_bl31_setup.c
+++ b/plat/imx/imx8qx/imx8qx_bl31_setup.c
@@ -4,25 +4,28 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <cci.h>
-#include <console.h>
+#include <stdbool.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
#include <context.h>
-#include <context_mgmt.h>
-#include <debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/console.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables.h>
+#include <plat/common/platform.h>
+
#include <imx8qx_pads.h>
#include <imx8_iomux.h>
#include <imx8_lpuart.h>
-#include <mmio.h>
-#include <platform.h>
-#include <platform_def.h>
#include <plat_imx8.h>
#include <sci/sci.h>
#include <sec_rsrc.h>
-#include <stdbool.h>
-#include <xlat_tables.h>
IMPORT_SYM(unsigned long, __COHERENT_RAM_START__, BL31_COHERENT_RAM_START);
IMPORT_SYM(unsigned long, __COHERENT_RAM_END__, BL31_COHERENT_RAM_END);
diff --git a/plat/imx/imx8qx/imx8qx_psci.c b/plat/imx/imx8qx/imx8qx_psci.c
index 46ea72486..94c2e2b1e 100644
--- a/plat/imx/imx8qx/imx8qx_psci.c
+++ b/plat/imx/imx8qx/imx8qx_psci.c
@@ -4,15 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <stdbool.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <debug.h>
-#include <gicv3.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <drivers/arm/gicv3.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+
#include <plat_imx8.h>
-#include <psci.h>
#include <sci/sci.h>
-#include <stdbool.h>
const static int ap_core_index[PLATFORM_CORE_COUNT] = {
SC_R_A35_0, SC_R_A35_1, SC_R_A35_2, SC_R_A35_3
diff --git a/plat/imx/imx8qx/include/platform_def.h b/plat/imx/imx8qx/include/platform_def.h
index b9fd96c0c..1239340d0 100644
--- a/plat/imx/imx8qx/include/platform_def.h
+++ b/plat/imx/imx8qx/include/platform_def.h
@@ -7,7 +7,7 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
#define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
#define PLATFORM_LINKER_ARCH aarch64
diff --git a/plat/layerscape/board/ls1043/include/ls_def.h b/plat/layerscape/board/ls1043/include/ls_def.h
index 9c837204e..d8c66e311 100644
--- a/plat/layerscape/board/ls1043/include/ls_def.h
+++ b/plat/layerscape/board/ls1043/include/ls_def.h
@@ -7,13 +7,13 @@
#ifndef LS_DEF_H
#define LS_DEF_H
-#include <arch.h>
-#include <common_def.h>
#include <platform_def.h>
-#include <tbbr_img_def.h>
-#include <utils_def.h>
-#include <xlat_tables_defs.h>
+#include <arch.h>
+#include <common/tbbr/tbbr_img_def.h>
+#include <lib/xlat_tables/xlat_tables_defs.h>
+#include <lib/utils_def.h>
+#include <plat/common/common_def.h>
/******************************************************************************
* Definitions common to all ARM standard platforms
diff --git a/plat/layerscape/board/ls1043/include/platform_def.h b/plat/layerscape/board/ls1043/include/platform_def.h
index 46b2031e1..b6130001c 100644
--- a/plat/layerscape/board/ls1043/include/platform_def.h
+++ b/plat/layerscape/board/ls1043/include/platform_def.h
@@ -7,9 +7,10 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
-#include <common_def.h>
-#include <tzc400.h>
-#include <utils.h>
+#include <drivers/arm/tzc400.h>
+#include <lib/utils.h>
+#include <plat/common/common_def.h>
+
#include "ls_def.h"
#define FIRMWARE_WELCOME_STR_LS1043 "Welcome to LS1043 BL1 Phase\n"
diff --git a/plat/layerscape/board/ls1043/ls1043_bl1_setup.c b/plat/layerscape/board/ls1043/ls1043_bl1_setup.c
index e82a1fb86..dfa472543 100644
--- a/plat/layerscape/board/ls1043/ls1043_bl1_setup.c
+++ b/plat/layerscape/board/ls1043/ls1043_bl1_setup.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <cci.h>
-#include <debug.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <lib/mmio.h>
+
#include "plat_ls.h"
static const int cci_map[] = {
diff --git a/plat/layerscape/board/ls1043/ls1043_bl2_setup.c b/plat/layerscape/board/ls1043/ls1043_bl2_setup.c
index b529aa50f..c9db81477 100644
--- a/plat/layerscape/board/ls1043/ls1043_bl2_setup.c
+++ b/plat/layerscape/board/ls1043/ls1043_bl2_setup.c
@@ -4,8 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <mmio.h>
-#include <debug.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+
#include "plat_ls.h"
void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1,
diff --git a/plat/layerscape/board/ls1043/ls1043_bl31_setup.c b/plat/layerscape/board/ls1043/ls1043_bl31_setup.c
index 3473d9883..6d15c1139 100644
--- a/plat/layerscape/board/ls1043/ls1043_bl31_setup.c
+++ b/plat/layerscape/board/ls1043/ls1043_bl31_setup.c
@@ -4,8 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <cci.h>
-#include <debug.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+
#include "plat_ls.h"
#include "fsl_csu.h"
diff --git a/plat/layerscape/board/ls1043/ls1043_err.c b/plat/layerscape/board/ls1043/ls1043_err.c
index e4a2cae4e..37077d4d8 100644
--- a/plat/layerscape/board/ls1043/ls1043_err.c
+++ b/plat/layerscape/board/ls1043/ls1043_err.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <debug.h>
#include <errno.h>
#include <stdint.h>
+#include <arch_helpers.h>
+#include <common/debug.h>
+
/*
* Error handler
*/
diff --git a/plat/layerscape/board/ls1043/ls1043_psci.c b/plat/layerscape/board/ls1043/ls1043_psci.c
index b402e7f77..d6429c326 100644
--- a/plat/layerscape/board/ls1043/ls1043_psci.c
+++ b/plat/layerscape/board/ls1043/ls1043_psci.c
@@ -4,17 +4,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
-#include <delay_timer.h>
#include <endian.h>
#include <errno.h>
-#include <gicv2.h>
-#include <mmio.h>
-#include <platform.h>
-#include <psci.h>
-#include "platform_def.h"
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
#define LS_SCFG_BASE 0x01570000
/* register to store warm boot entry, big endian, higher 32bit */
diff --git a/plat/layerscape/board/ls1043/ls1043_stack_protector.c b/plat/layerscape/board/ls1043/ls1043_stack_protector.c
index 50f463b9a..8a1a4e57d 100644
--- a/plat/layerscape/board/ls1043/ls1043_stack_protector.c
+++ b/plat/layerscape/board/ls1043/ls1043_stack_protector.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <stdint.h>
+#include <arch_helpers.h>
+
#define RANDOM_CANARY_VALUE ((u_register_t) 3288484550995823360ULL)
u_register_t plat_get_stack_protector_canary(void)
diff --git a/plat/layerscape/board/ls1043/ls1043_topology.c b/plat/layerscape/board/ls1043/ls1043_topology.c
index 12d2830fe..c9c6a9cc5 100644
--- a/plat/layerscape/board/ls1043/ls1043_topology.c
+++ b/plat/layerscape/board/ls1043/ls1043_topology.c
@@ -5,7 +5,9 @@
*/
#include <arch.h>
-#include <cassert.h>
+
+#include <lib/cassert.h>
+
#include "plat_ls.h"
#include "platform_def.h"
diff --git a/plat/layerscape/board/ls1043/ls_gic.c b/plat/layerscape/board/ls1043/ls_gic.c
index 3986153a2..3d8b262d2 100644
--- a/plat/layerscape/board/ls1043/ls_gic.c
+++ b/plat/layerscape/board/ls1043/ls_gic.c
@@ -4,10 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <mmio.h>
-#include <debug.h>
#include <endian.h>
-#include "platform_def.h"
+
+#include <platform_def.h>
+
+#include <common/debug.h>
+#include <lib/mmio.h>
+
#include "soc.h"
/*
diff --git a/plat/layerscape/board/ls1043/platform.mk b/plat/layerscape/board/ls1043/platform.mk
index 795d92482..91a14a445 100644
--- a/plat/layerscape/board/ls1043/platform.mk
+++ b/plat/layerscape/board/ls1043/platform.mk
@@ -23,9 +23,7 @@ LS1043_SECURITY_SOURCES := plat/layerscape/common/ls_tzc380.c \
PLAT_INCLUDES := -Iplat/layerscape/board/ls1043/include \
-Iplat/layerscape/common/include \
- -Iinclude/drivers/arm \
- -Iinclude/lib \
- -Iinclude/drivers/io
+ -Iinclude/lib
PLAT_BL_COMMON_SOURCES := plat/layerscape/common/aarch64/ls_console.S
diff --git a/plat/layerscape/common/aarch64/ls_bl2_mem_params_desc.c b/plat/layerscape/common/aarch64/ls_bl2_mem_params_desc.c
index a96e3901b..94107400a 100644
--- a/plat/layerscape/common/aarch64/ls_bl2_mem_params_desc.c
+++ b/plat/layerscape/common/aarch64/ls_bl2_mem_params_desc.c
@@ -4,11 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
#include <platform_def.h>
-#include <debug.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
+
#include <ls_def.h>
/*******************************************************************************
diff --git a/plat/layerscape/common/aarch64/ls_helpers.S b/plat/layerscape/common/aarch64/ls_helpers.S
index 7d71f4826..bbddd0b51 100644
--- a/plat/layerscape/common/aarch64/ls_helpers.S
+++ b/plat/layerscape/common/aarch64/ls_helpers.S
@@ -5,7 +5,7 @@
*/
#include <asm_macros.S>
-#include <console.h>
+#include <drivers/console.h>
#include <platform_def.h>
.weak plat_my_core_pos
diff --git a/plat/layerscape/common/include/ls_16550.h b/plat/layerscape/common/include/ls_16550.h
index 94694eef7..b0b1856f0 100644
--- a/plat/layerscape/common/include/ls_16550.h
+++ b/plat/layerscape/common/include/ls_16550.h
@@ -7,7 +7,7 @@
#ifndef LS_16550_H
#define LS_16550_H
-#include <console.h>
+#include <drivers/console.h>
/* UART16550 Registers */
#define UARTTX 0x0
diff --git a/plat/layerscape/common/include/plat_ls.h b/plat/layerscape/common/include/plat_ls.h
index 49526ca8b..e56670bf0 100644
--- a/plat/layerscape/common/include/plat_ls.h
+++ b/plat/layerscape/common/include/plat_ls.h
@@ -7,9 +7,10 @@
#ifndef PLAT_LS_H
#define PLAT_LS_H
-#include <cpu_data.h>
#include <stdint.h>
+#include <lib/el3_runtime/cpu_data.h>
+
/* BL1 utility functions */
void ls_bl1_platform_setup(void);
void ls_bl1_early_platform_setup(void);
diff --git a/plat/layerscape/common/ls_bl1_setup.c b/plat/layerscape/common/ls_bl1_setup.c
index 0642b5ef7..fb929fef1 100644
--- a/plat/layerscape/common/ls_bl1_setup.c
+++ b/plat/layerscape/common/ls_bl1_setup.c
@@ -4,7 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
+#include <common/debug.h>
+
#include "ls_16550.h"
#include "plat_ls.h"
#include "../../../bl1/bl1_private.h"
diff --git a/plat/layerscape/common/ls_bl2_setup.c b/plat/layerscape/common/ls_bl2_setup.c
index 4b2dc7245..192eaec46 100644
--- a/plat/layerscape/common/ls_bl2_setup.c
+++ b/plat/layerscape/common/ls_bl2_setup.c
@@ -5,8 +5,10 @@
*/
#include <assert.h>
-#include <bl_common.h>
-#include <desc_image_load.h>
+
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+
#include "ls_16550.h"
#include "plat_ls.h"
#include "ls_def.h"
diff --git a/plat/layerscape/common/ls_bl31_setup.c b/plat/layerscape/common/ls_bl31_setup.c
index 2067b9025..03e580768 100644
--- a/plat/layerscape/common/ls_bl31_setup.c
+++ b/plat/layerscape/common/ls_bl31_setup.c
@@ -5,11 +5,12 @@
*/
#include <assert.h>
-#include <bl_common.h>
-#include <console.h>
-#include <gicv2.h>
-#include <interrupt_props.h>
-#include <mmio.h>
+
+#include <common/bl_common.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/console.h>
+#include <lib/mmio.h>
#include "ls_16550.h"
#include "plat_ls.h"
diff --git a/plat/layerscape/common/ls_common.c b/plat/layerscape/common/ls_common.c
index afd5927cd..3b42909c7 100644
--- a/plat/layerscape/common/ls_common.c
+++ b/plat/layerscape/common/ls_common.c
@@ -3,13 +3,16 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
+#include <assert.h>
+
+#include <platform_def.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <xlat_tables_v2.h>
-#include <assert.h>
-#include <debug.h>
-#include <mmio.h>
-#include "platform_def.h"
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
const mmap_region_t *plat_ls_get_mmap(void);
diff --git a/plat/layerscape/common/ls_image_load.c b/plat/layerscape/common/ls_image_load.c
index 909bec2fa..70c01f2b2 100644
--- a/plat/layerscape/common/ls_image_load.c
+++ b/plat/layerscape/common/ls_image_load.c
@@ -4,7 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <desc_image_load.h>
+#include <common/desc_image_load.h>
+
#include "ls_def.h"
/*******************************************************************************
diff --git a/plat/layerscape/common/ls_io_storage.c b/plat/layerscape/common/ls_io_storage.c
index 740236637..71c2f45b3 100644
--- a/plat/layerscape/common/ls_io_storage.c
+++ b/plat/layerscape/common/ls_io_storage.c
@@ -3,14 +3,17 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <assert.h>
-#include <debug.h>
-#include <firmware_image_package.h>
-#include <io_driver.h>
-#include <io_fip.h>
-#include <io_memmap.h>
-#include <io_storage.h>
-#include "platform_def.h"
+
+#include <platform_def.h>
+
+#include <common/debug.h>
+#include <drivers/io/io_driver.h>
+#include <drivers/io/io_fip.h>
+#include <drivers/io/io_memmap.h>
+#include <drivers/io/io_storage.h>
+#include <tools_share/firmware_image_package.h>
/* IO devices */
static const io_dev_connector_t *fip_dev_con;
diff --git a/plat/layerscape/common/ls_timer.c b/plat/layerscape/common/ls_timer.c
index 25b5e6305..021890bb6 100644
--- a/plat/layerscape/common/ls_timer.c
+++ b/plat/layerscape/common/ls_timer.c
@@ -4,9 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <mmio.h>
-#include <delay_timer.h>
#include <arch_helpers.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
#define TIMER_BASE_ADDR 0x02B00000
diff --git a/plat/layerscape/common/ls_tzc380.c b/plat/layerscape/common/ls_tzc380.c
index b9f32ac36..44f3fcd94 100644
--- a/plat/layerscape/common/ls_tzc380.c
+++ b/plat/layerscape/common/ls_tzc380.c
@@ -4,10 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <mmio.h>
#include <endian.h>
-#include "platform_def.h"
+
+#include <platform_def.h>
+
+#include <common/debug.h>
+#include <lib/mmio.h>
+
#include "soc_tzasc.h"
int tzc380_set_region(unsigned int tzasc_base, unsigned int region_id,
diff --git a/plat/layerscape/common/ns_access.c b/plat/layerscape/common/ns_access.c
index e1daaed92..b84fdbd7e 100644
--- a/plat/layerscape/common/ns_access.c
+++ b/plat/layerscape/common/ns_access.c
@@ -4,11 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <mmio.h>
#include <endian.h>
-#include <debug.h>
+
+#include <platform_def.h>
+
+#include <common/debug.h>
+#include <lib/mmio.h>
+
#include "ns_access.h"
-#include "platform_def.h"
static void enable_devices_ns_access(struct csu_ns_dev *ns_dev, uint32_t num)
{
diff --git a/plat/layerscape/common/tsp/ls_tsp_setup.c b/plat/layerscape/common/tsp/ls_tsp_setup.c
index a046e2f2d..c6073619a 100644
--- a/plat/layerscape/common/tsp/ls_tsp_setup.c
+++ b/plat/layerscape/common/tsp/ls_tsp_setup.c
@@ -4,9 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <gicv2.h>
-#include <interrupt_props.h>
+#include <common/debug.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gicv2.h>
#include "ls_16550.h"
#include "plat_ls.h"
diff --git a/plat/marvell/a3700/a3700/board/pm_src.c b/plat/marvell/a3700/a3700/board/pm_src.c
index bc48ce8ca..d6eca5d16 100644
--- a/plat/marvell/a3700/a3700/board/pm_src.c
+++ b/plat/marvell/a3700/a3700/board/pm_src.c
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
* https://spdx.org/licenses
*/
+
#include <a3700_pm.h>
#include <plat_marvell.h>
diff --git a/plat/marvell/a3700/a3700/plat_bl31_setup.c b/plat/marvell/a3700/a3700/plat_bl31_setup.c
index 83db06f9d..6862a8670 100644
--- a/plat/marvell/a3700/a3700/plat_bl31_setup.c
+++ b/plat/marvell/a3700/a3700/plat_bl31_setup.c
@@ -5,10 +5,11 @@
* https://spdx.org/licenses
*/
+#include <lib/mmio.h>
+
#include <armada_common.h>
#include <dram_win.h>
#include <io_addr_dec.h>
-#include <mmio.h>
#include <marvell_plat_priv.h>
#include <plat_marvell.h>
diff --git a/plat/marvell/a3700/common/a3700_common.mk b/plat/marvell/a3700/common/a3700_common.mk
index e2ac97ffc..a4727d2ea 100644
--- a/plat/marvell/a3700/common/a3700_common.mk
+++ b/plat/marvell/a3700/common/a3700_common.mk
@@ -84,14 +84,12 @@ MARVELL_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \
plat/common/plat_gicv3.c \
drivers/arm/gic/v3/gic500.c
-ATF_INCLUDES := -Iinclude/common/tbbr \
- -Iinclude/drivers
+ATF_INCLUDES := -Iinclude/common/tbbr
PLAT_INCLUDES := -I$(PLAT_FAMILY_BASE)/$(PLAT) \
-I$(PLAT_COMMON_BASE)/include \
-I$(PLAT_INCLUDE_BASE)/common \
-I$(MARVELL_DRV_BASE) \
- -Iinclude/drivers/marvell/uart \
-I$/drivers/arm/gic/common/ \
$(ATF_INCLUDES)
diff --git a/plat/marvell/a3700/common/a3700_sip_svc.c b/plat/marvell/a3700/common/a3700_sip_svc.c
index 88d1fc2f7..e8ac5fc08 100644
--- a/plat/marvell/a3700/common/a3700_sip_svc.c
+++ b/plat/marvell/a3700/common/a3700_sip_svc.c
@@ -5,11 +5,13 @@
* https://spdx.org/licenses
*/
-#include <debug.h>
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <lib/smccc.h>
+
#include <marvell_plat_priv.h>
#include <plat_marvell.h>
-#include <runtime_svc.h>
-#include <smccc.h>
+
#include "comphy/phy-comphy-3700.h"
/* Comphy related FID's */
diff --git a/plat/marvell/a3700/common/dram_win.c b/plat/marvell/a3700/common/dram_win.c
index fb236d82d..694f6d480 100644
--- a/plat/marvell/a3700/common/dram_win.c
+++ b/plat/marvell/a3700/common/dram_win.c
@@ -5,12 +5,14 @@
* https://spdx.org/licenses
*/
+#include <string.h>
+
+#include <lib/mmio.h>
+
#include <dram_win.h>
#include <marvell_plat_priv.h>
-#include <mmio.h>
#include <mvebu.h>
#include <plat_marvell.h>
-#include <string.h>
/* Armada 3700 has 5 configurable windows */
#define MV_CPU_WIN_NUM 5
diff --git a/plat/marvell/a3700/common/include/dram_win.h b/plat/marvell/a3700/common/include/dram_win.h
index 6f345f945..26a013784 100644
--- a/plat/marvell/a3700/common/include/dram_win.h
+++ b/plat/marvell/a3700/common/include/dram_win.h
@@ -8,7 +8,8 @@
#ifndef DRAM_WIN_H
#define DRAM_WIN_H
-#include <bl_common.h>
+#include <common/bl_common.h>
+
#include <io_addr_dec.h>
void dram_win_map_build(struct dram_win_map *win_map);
diff --git a/plat/marvell/a3700/common/include/platform_def.h b/plat/marvell/a3700/common/include/platform_def.h
index ca2553c99..16865c4d2 100644
--- a/plat/marvell/a3700/common/include/platform_def.h
+++ b/plat/marvell/a3700/common/include/platform_def.h
@@ -8,12 +8,13 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
-#include <board_marvell_def.h>
-#include <mvebu_def.h>
#ifndef __ASSEMBLY__
#include <stdio.h>
#endif /* __ASSEMBLY__ */
+#include <board_marvell_def.h>
+#include <mvebu_def.h>
+
/*
* Most platform porting definitions provided by included headers
*/
diff --git a/plat/marvell/a3700/common/io_addr_dec.c b/plat/marvell/a3700/common/io_addr_dec.c
index f00959433..b27633cf2 100644
--- a/plat/marvell/a3700/common/io_addr_dec.c
+++ b/plat/marvell/a3700/common/io_addr_dec.c
@@ -4,9 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
* https://spdx.org/licenses
*/
-#include <debug.h>
+
+#include <common/debug.h>
+#include <lib/mmio.h>
+
#include <io_addr_dec.h>
-#include <mmio.h>
#include <plat_marvell.h>
#define MVEBU_DEC_WIN_CTRL_REG(base, win, off) (MVEBU_REGS_BASE + (base) + \
diff --git a/plat/marvell/a3700/common/marvell_plat_config.c b/plat/marvell/a3700/common/marvell_plat_config.c
index 85a420130..3bf3d96bd 100644
--- a/plat/marvell/a3700/common/marvell_plat_config.c
+++ b/plat/marvell/a3700/common/marvell_plat_config.c
@@ -5,7 +5,8 @@
* https://spdx.org/licenses
*/
-#include <bl_common.h>
+#include <common/bl_common.h>
+
#include <io_addr_dec.h>
#include <mvebu_def.h>
diff --git a/plat/marvell/a3700/common/plat_pm.c b/plat/marvell/a3700/common/plat_pm.c
index dce484168..f8ce6fe29 100644
--- a/plat/marvell/a3700/common/plat_pm.c
+++ b/plat/marvell/a3700/common/plat_pm.c
@@ -5,22 +5,23 @@
* https://spdx.org/licenses
*/
+#include <common/debug.h>
+#ifdef USE_CCI
+#include <drivers/arm/cci.h>
+#endif
+#include <lib/psci/psci.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include <a3700_pm.h>
#include <arch_helpers.h>
#include <armada_common.h>
-#include <debug.h>
#include <dram_win.h>
#include <io_addr_dec.h>
-#include <mmio.h>
#include <mvebu.h>
#include <mvebu_def.h>
#include <marvell_plat_priv.h>
-#include <platform.h>
#include <plat_marvell.h>
-#include <psci.h>
-#ifdef USE_CCI
-#include <cci.h>
-#endif
/* Warm reset register */
#define MVEBU_WARM_RESET_REG (MVEBU_NB_REGS_BASE + 0x840)
diff --git a/plat/marvell/a8k/a70x0/board/dram_port.c b/plat/marvell/a8k/a70x0/board/dram_port.c
index c67025899..4fca7e383 100644
--- a/plat/marvell/a8k/a70x0/board/dram_port.c
+++ b/plat/marvell/a8k/a70x0/board/dram_port.c
@@ -6,7 +6,8 @@
*/
#include <arch_helpers.h>
-#include <debug.h>
+#include <common/debug.h>
+
#include <mv_ddr_if.h>
#include <plat_marvell.h>
diff --git a/plat/marvell/a8k/a70x0_amc/board/dram_port.c b/plat/marvell/a8k/a70x0_amc/board/dram_port.c
index ab1df465e..aecf6c567 100644
--- a/plat/marvell/a8k/a70x0_amc/board/dram_port.c
+++ b/plat/marvell/a8k/a70x0_amc/board/dram_port.c
@@ -6,7 +6,8 @@
*/
#include <arch_helpers.h>
-#include <debug.h>
+#include <common/debug.h>
+
#include <mv_ddr_if.h>
#include <plat_marvell.h>
diff --git a/plat/marvell/a8k/a80x0/board/dram_port.c b/plat/marvell/a8k/a80x0/board/dram_port.c
index a99bf7c21..02f4ffb0a 100644
--- a/plat/marvell/a8k/a80x0/board/dram_port.c
+++ b/plat/marvell/a8k/a80x0/board/dram_port.c
@@ -6,9 +6,10 @@
*/
#include <arch_helpers.h>
-#include <debug.h>
-#include <mentor/mi2cv.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <drivers/mentor/mi2cv.h>
+#include <lib/mmio.h>
+
#include <mv_ddr_if.h>
#include <mvebu_def.h>
#include <plat_marvell.h>
diff --git a/plat/marvell/a8k/a80x0_mcbin/board/dram_port.c b/plat/marvell/a8k/a80x0_mcbin/board/dram_port.c
index fa222eecf..25808523c 100644
--- a/plat/marvell/a8k/a80x0_mcbin/board/dram_port.c
+++ b/plat/marvell/a8k/a80x0_mcbin/board/dram_port.c
@@ -6,9 +6,10 @@
*/
#include <arch_helpers.h>
-#include <debug.h>
-#include <mentor/mi2cv.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <drivers/mentor/mi2cv.h>
+#include <lib/mmio.h>
+
#include <mv_ddr_if.h>
#include <mvebu_def.h>
#include <plat_marvell.h>
diff --git a/plat/marvell/a8k/a80x0_mcbin/board/marvell_plat_config.c b/plat/marvell/a8k/a80x0_mcbin/board/marvell_plat_config.c
index 384d0f54b..fa4e144c9 100644
--- a/plat/marvell/a8k/a80x0_mcbin/board/marvell_plat_config.c
+++ b/plat/marvell/a8k/a80x0_mcbin/board/marvell_plat_config.c
@@ -5,9 +5,10 @@
* https://spdx.org/licenses
*/
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <armada_common.h>
-#include <delay_timer.h>
-#include <mmio.h>
/*
* If bootrom is currently at BLE there's no need to include the memory
diff --git a/plat/marvell/a8k/common/a8k_common.mk b/plat/marvell/a8k/common/a8k_common.mk
index e350d6ac9..efb05b8e2 100644
--- a/plat/marvell/a8k/common/a8k_common.mk
+++ b/plat/marvell/a8k/common/a8k_common.mk
@@ -50,8 +50,6 @@ ATF_INCLUDES := -Iinclude/common/tbbr
PLAT_INCLUDES := -I$(PLAT_FAMILY_BASE)/$(PLAT) \
-I$(PLAT_COMMON_BASE)/include \
-I$(PLAT_INCLUDE_BASE)/common \
- -Iinclude/drivers/marvell \
- -Iinclude/drivers/marvell/mochi \
$(ATF_INCLUDES)
PLAT_BL_COMMON_SOURCES := $(PLAT_COMMON_BASE)/aarch64/a8k_common.c \
diff --git a/plat/marvell/a8k/common/aarch64/plat_arch_config.c b/plat/marvell/a8k/common/aarch64/plat_arch_config.c
index 866733145..06dc84115 100644
--- a/plat/marvell/a8k/common/aarch64/plat_arch_config.c
+++ b/plat/marvell/a8k/common/aarch64/plat_arch_config.c
@@ -5,12 +5,11 @@
* https://spdx.org/licenses
*/
-#include <platform.h>
#include <arch_helpers.h>
-#include <mmio.h>
-#include <debug.h>
-#include <cache_llc.h>
-
+#include <common/debug.h>
+#include <drivers/marvell/cache_llc.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
#define CCU_HTC_ASET (MVEBU_CCU_BASE(MVEBU_AP0) + 0x264)
#define MVEBU_IO_AFFINITY (0xF00)
diff --git a/plat/marvell/a8k/common/ble/ble.mk b/plat/marvell/a8k/common/ble/ble.mk
index 5f24ced23..ed4ff3af2 100644
--- a/plat/marvell/a8k/common/ble/ble.mk
+++ b/plat/marvell/a8k/common/ble/ble.mk
@@ -13,12 +13,12 @@ PLAT_MARVELL = plat/marvell
BLE_SOURCES += $(BLE_PATH)/ble_main.c \
$(BLE_PATH)/ble_mem.S \
drivers/delay_timer/delay_timer.c \
+ $(PLAT_MARVELL)/common/aarch64/marvell_helpers.S \
$(PLAT_MARVELL)/common/plat_delay_timer.c \
$(PLAT_MARVELL)/common/marvell_console.c
PLAT_INCLUDES += -I$(MV_DDR_PATH) \
-I$(CURDIR)/include/ \
- -I$(CURDIR)/include/drivers \
-I$(CURDIR)/include/lib \
-I$(CURDIR)/include/lib/libc \
-I$(CURDIR)/include/lib/libc/aarch64 \
diff --git a/plat/marvell/a8k/common/ble/ble_main.c b/plat/marvell/a8k/common/ble/ble_main.c
index b04e8b7a6..5b3acec2d 100644
--- a/plat/marvell/a8k/common/ble/ble_main.c
+++ b/plat/marvell/a8k/common/ble/ble_main.c
@@ -5,14 +5,17 @@
* https://spdx.org/licenses
*/
+#include <string.h>
+
+#include <platform_def.h>
+
#include <arch_helpers.h>
-#include <debug.h>
-#include <console.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+
#include <marvell_plat_priv.h>
#include <marvell_pm.h>
-#include <platform_def.h>
#include <plat_marvell.h>
-#include <string.h>
#define BR_FLAG_SILENT 0x1
#define SKIP_IMAGE_CODE 0xDEADB002
diff --git a/plat/marvell/a8k/common/include/platform_def.h b/plat/marvell/a8k/common/include/platform_def.h
index 4c3e7a9ea..3f6154e75 100644
--- a/plat/marvell/a8k/common/include/platform_def.h
+++ b/plat/marvell/a8k/common/include/platform_def.h
@@ -8,14 +8,16 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
-#include <board_marvell_def.h>
-#include <gic_common.h>
-#include <interrupt_props.h>
-#include <mvebu_def.h>
#ifndef __ASSEMBLY__
#include <stdio.h>
#endif /* __ASSEMBLY__ */
+#include <common/interrupt_props.h>
+#include <drivers/arm/gic_common.h>
+
+#include <board_marvell_def.h>
+#include <mvebu_def.h>
+
/*
* Most platform porting definitions provided by included headers
*/
diff --git a/plat/marvell/a8k/common/mss/mss_bl2_setup.c b/plat/marvell/a8k/common/mss/mss_bl2_setup.c
index 973c56dc8..728ee54a0 100644
--- a/plat/marvell/a8k/common/mss/mss_bl2_setup.c
+++ b/plat/marvell/a8k/common/mss/mss_bl2_setup.c
@@ -5,14 +5,16 @@
* https://spdx.org/licenses
*/
+#include <platform_def.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/marvell/ccu.h>
+#include <drivers/marvell/mochi/cp110_setup.h>
+#include <lib/mmio.h>
+
#include <armada_common.h>
-#include <bl_common.h>
-#include <ccu.h>
-#include <cp110_setup.h>
-#include <debug.h>
#include <marvell_plat_priv.h> /* timer functionality */
-#include <mmio.h>
-#include <platform_def.h>
#include "mss_scp_bootloader.h"
diff --git a/plat/marvell/a8k/common/mss/mss_pm_ipc.c b/plat/marvell/a8k/common/mss/mss_pm_ipc.c
index d1297b07b..a0705832f 100644
--- a/plat/marvell/a8k/common/mss/mss_pm_ipc.c
+++ b/plat/marvell/a8k/common/mss/mss_pm_ipc.c
@@ -5,11 +5,12 @@
* https://spdx.org/licenses
*/
-#include <debug.h>
-#include <mmio.h>
-#include <psci.h>
#include <string.h>
+#include <common/debug.h>
+#include <lib/psci/psci.h>
+#include <lib/mmio.h>
+
#include <mss_pm_ipc.h>
/*
diff --git a/plat/marvell/a8k/common/plat_bl1_setup.c b/plat/marvell/a8k/common/plat_bl1_setup.c
index 5d8510279..f9521c871 100644
--- a/plat/marvell/a8k/common/plat_bl1_setup.c
+++ b/plat/marvell/a8k/common/plat_bl1_setup.c
@@ -5,7 +5,8 @@
* https://spdx.org/licenses
*/
-#include <mmio.h>
+#include <lib/mmio.h>
+
#include <plat_marvell.h>
void marvell_bl1_setup_mpps(void)
diff --git a/plat/marvell/a8k/common/plat_bl31_setup.c b/plat/marvell/a8k/common/plat_bl31_setup.c
index 6dfbcbb20..98b3966ae 100644
--- a/plat/marvell/a8k/common/plat_bl31_setup.c
+++ b/plat/marvell/a8k/common/plat_bl31_setup.c
@@ -5,17 +5,17 @@
* https://spdx.org/licenses
*/
+#include <common/debug.h>
+#include <drivers/marvell/mci.h>
+#include <drivers/marvell/mochi/ap_setup.h>
+#include <drivers/marvell/mochi/cp110_setup.h>
+#include <lib/mmio.h>
+
#include <armada_common.h>
-#include <ap_setup.h>
-#include <cp110_setup.h>
-#include <debug.h>
#include <marvell_plat_priv.h>
#include <marvell_pm.h>
#include <mc_trustzone/mc_trustzone.h>
-#include <mmio.h>
-#include <mci.h>
#include <plat_marvell.h>
-
#include <mss_ipc_drv.h>
#include <mss_mem.h>
diff --git a/plat/marvell/a8k/common/plat_ble_setup.c b/plat/marvell/a8k/common/plat_ble_setup.c
index dbadeb768..0590cc0ae 100644
--- a/plat/marvell/a8k/common/plat_ble_setup.c
+++ b/plat/marvell/a8k/common/plat_ble_setup.c
@@ -5,17 +5,18 @@
* https://spdx.org/licenses
*/
-#include <ap_setup.h>
+#include <common/debug.h>
+#include <drivers/marvell/ap807_clocks_init.h>
+#include <drivers/marvell/aro.h>
+#include <drivers/marvell/ccu.h>
+#include <drivers/marvell/io_win.h>
+#include <drivers/marvell/mochi/ap_setup.h>
+#include <drivers/marvell/mochi/cp110_setup.h>
+
#include <armada_common.h>
-#include <aro.h>
-#include <ccu.h>
-#include <cp110_setup.h>
-#include <debug.h>
-#include <io_win.h>
#include <mv_ddr_if.h>
#include <mvebu_def.h>
#include <plat_marvell.h>
-#include "ap807_clocks_init.h"
/* Register for skip image use */
#define SCRATCH_PAD_REG2 0xF06F00A8
diff --git a/plat/marvell/a8k/common/plat_pm.c b/plat/marvell/a8k/common/plat_pm.c
index 285441691..e2575b13c 100644
--- a/plat/marvell/a8k/common/plat_pm.c
+++ b/plat/marvell/a8k/common/plat_pm.c
@@ -5,19 +5,21 @@
* https://spdx.org/licenses
*/
-#include <armada_common.h>
#include <assert.h>
-#include <bakery_lock.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <cache_llc.h>
-#include <console.h>
-#include <gicv2.h>
+
+#include <common/debug.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/console.h>
+#include <drivers/delay_timer.h>
+#include <drivers/marvell/cache_llc.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
+#include <armada_common.h>
#include <marvell_pm.h>
-#include <mmio.h>
#include <mss_pm_ipc.h>
#include <plat_marvell.h>
-#include <platform.h>
#include <plat_pm_trace.h>
#define MVEBU_PRIVATE_UID_REG 0x30
diff --git a/plat/marvell/a8k/common/plat_pm_trace.c b/plat/marvell/a8k/common/plat_pm_trace.c
index 683e56f6a..f589ff31b 100644
--- a/plat/marvell/a8k/common/plat_pm_trace.c
+++ b/plat/marvell/a8k/common/plat_pm_trace.c
@@ -5,9 +5,10 @@
* https://spdx.org/licenses
*/
-#include <mmio.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include <mss_mem.h>
-#include <platform.h>
#include <plat_pm_trace.h>
#ifdef PM_TRACE_ENABLE
diff --git a/plat/marvell/a8k/common/plat_thermal.c b/plat/marvell/a8k/common/plat_thermal.c
index 02fe82097..a2fc0d0ab 100644
--- a/plat/marvell/a8k/common/plat_thermal.c
+++ b/plat/marvell/a8k/common/plat_thermal.c
@@ -5,11 +5,12 @@
* https://spdx.org/licenses
*/
-#include <debug.h>
-#include <delay_timer.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <drivers/marvell/thermal.h>
+#include <lib/mmio.h>
+
#include <mvebu_def.h>
-#include <thermal.h>
#define THERMAL_TIMEOUT 1200
diff --git a/plat/marvell/common/aarch64/marvell_bl2_mem_params_desc.c b/plat/marvell/common/aarch64/marvell_bl2_mem_params_desc.c
index 17f877123..6a8e11c90 100644
--- a/plat/marvell/common/aarch64/marvell_bl2_mem_params_desc.c
+++ b/plat/marvell/common/aarch64/marvell_bl2_mem_params_desc.c
@@ -4,12 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <marvell_def.h>
-#include <platform.h>
#include <platform_def.h>
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <marvell_def.h>
+#include <plat/common/platform.h>
/*******************************************************************************
* Following descriptor provides BL image/ep information that gets used
diff --git a/plat/marvell/common/aarch64/marvell_common.c b/plat/marvell/common/aarch64/marvell_common.c
index abc501a90..ea0902cc0 100644
--- a/plat/marvell/common/aarch64/marvell_common.c
+++ b/plat/marvell/common/aarch64/marvell_common.c
@@ -5,15 +5,17 @@
* https://spdx.org/licenses
*/
-#include <arch.h>
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
-#include <mmio.h>
-#include <plat_marvell.h>
+
#include <platform_def.h>
-#include <xlat_tables.h>
+#include <arch.h>
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables.h>
+
+#include <plat_marvell.h>
/* Weak definitions may be overridden in specific ARM standard platform */
#pragma weak plat_get_ns_image_entrypoint
diff --git a/plat/marvell/common/aarch64/marvell_helpers.S b/plat/marvell/common/aarch64/marvell_helpers.S
index fbd19cb61..6f625b95d 100644
--- a/plat/marvell/common/aarch64/marvell_helpers.S
+++ b/plat/marvell/common/aarch64/marvell_helpers.S
@@ -7,12 +7,12 @@
#include <asm_macros.S>
#include <cortex_a72.h>
-#include <marvell_def.h>
-#include <platform_def.h>
#ifndef PLAT_a3700
-#include <ccu.h>
-#include <cache_llc.h>
+#include <drivers/marvell/ccu.h>
+#include <drivers/marvell/cache_llc.h>
#endif
+#include <marvell_def.h>
+#include <platform_def.h>
.weak plat_marvell_calc_core_pos
.weak plat_my_core_pos
diff --git a/plat/marvell/common/marvell_bl1_setup.c b/plat/marvell/common/marvell_bl1_setup.c
index c96f00679..8f7221025 100644
--- a/plat/marvell/common/marvell_bl1_setup.c
+++ b/plat/marvell/common/marvell_bl1_setup.c
@@ -5,15 +5,17 @@
* https://spdx.org/licenses
*/
-#include <bl1.h>
-#include <bl1/bl1_private.h>
-#include <bl_common.h>
-#include <console.h>
-#include <debug.h>
-#include <platform.h>
#include <platform_def.h>
+
+#include <bl1/bl1.h>
+#include <bl1/bl1_private.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/sp805.h>
+#include <drivers/console.h>
+#include <plat/common/platform.h>
+
#include <plat_marvell.h>
-#include <sp805.h>
/* Weak definitions may be overridden in specific Marvell standard platform */
#pragma weak bl1_early_platform_setup
diff --git a/plat/marvell/common/marvell_bl2_setup.c b/plat/marvell/common/marvell_bl2_setup.c
index 883336f0d..3c1c39112 100644
--- a/plat/marvell/common/marvell_bl2_setup.c
+++ b/plat/marvell/common/marvell_bl2_setup.c
@@ -5,17 +5,20 @@
* https://spdx.org/licenses
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <console.h>
-#include <debug.h>
-#include <desc_image_load.h>
-#include <marvell_def.h>
+#include <string.h>
+
#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/desc_image_load.h>
+#include <drivers/console.h>
+#include <lib/utils.h>
+
+#include <marvell_def.h>
#include <plat_marvell.h>
-#include <string.h>
-#include <utils.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/marvell/common/marvell_bl31_setup.c b/plat/marvell/common/marvell_bl31_setup.c
index 3b1a6f130..802c01383 100644
--- a/plat/marvell/common/marvell_bl31_setup.c
+++ b/plat/marvell/common/marvell_bl31_setup.c
@@ -5,18 +5,19 @@
* https://spdx.org/licenses
*/
-#include <arch.h>
#include <assert.h>
-#include <console.h>
-#include <debug.h>
-#include <marvell_def.h>
-#include <marvell_plat_priv.h>
-#include <plat_marvell.h>
-#include <platform.h>
+#include <arch.h>
+#include <common/debug.h>
#ifdef USE_CCI
-#include <cci.h>
+#include <drivers/arm/cci.h>
#endif
+#include <drivers/console.h>
+#include <plat/common/platform.h>
+
+#include <marvell_def.h>
+#include <marvell_plat_priv.h>
+#include <plat_marvell.h>
/*
* The next 3 constants identify the extents of the code, RO data region and the
diff --git a/plat/marvell/common/marvell_cci.c b/plat/marvell/common/marvell_cci.c
index 2df480243..80351aedc 100644
--- a/plat/marvell/common/marvell_cci.c
+++ b/plat/marvell/common/marvell_cci.c
@@ -5,7 +5,8 @@
* https://spdx.org/licenses
*/
-#include <cci.h>
+#include <drivers/arm/cci.h>
+
#include <plat_marvell.h>
static const int cci_map[] = {
diff --git a/plat/marvell/common/marvell_console.c b/plat/marvell/common/marvell_console.c
index eba106dc1..22c5eb3af 100644
--- a/plat/marvell/common/marvell_console.c
+++ b/plat/marvell/common/marvell_console.c
@@ -4,18 +4,21 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <assert.h>
-#include <console.h>
-#include <debug.h>
-#include <plat_marvell.h>
+
#include <platform_def.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+
+#include <plat_marvell.h>
+
#ifdef PLAT_a3700
-#include <a3700_console.h>
+#include <drivers/marvell/uart/a3700_console.h>
static console_a3700_t marvell_boot_console;
static console_a3700_t marvell_runtime_console;
#else
-#include <uart_16550.h>
+#include <drivers/ti/uart/uart_16550.h>
static console_16550_t marvell_boot_console;
static console_16550_t marvell_runtime_console;
diff --git a/plat/marvell/common/marvell_ddr_info.c b/plat/marvell/common/marvell_ddr_info.c
index 68bff998b..734099652 100644
--- a/plat/marvell/common/marvell_ddr_info.c
+++ b/plat/marvell/common/marvell_ddr_info.c
@@ -5,10 +5,12 @@
* https://spdx.org/licenses
*/
-#include <debug.h>
#include <platform_def.h>
+
+#include <common/debug.h>
+#include <lib/mmio.h>
+
#include <ddr_info.h>
-#include <mmio.h>
#define DRAM_CH0_MMAP_LOW_REG(iface, cs, base) \
(base + DRAM_CH0_MMAP_LOW_OFFSET + (iface) * 0x10000 + (cs) * 0x8)
diff --git a/plat/marvell/common/marvell_gicv2.c b/plat/marvell/common/marvell_gicv2.c
index 19e1ec0f5..2505c9f84 100644
--- a/plat/marvell/common/marvell_gicv2.c
+++ b/plat/marvell/common/marvell_gicv2.c
@@ -5,15 +5,17 @@
* https://spdx.org/licenses
*/
-#include <bakery_lock.h>
-#include <debug.h>
-#include <gicv2.h>
-#include <interrupt_mgmt.h>
-#include <mmio.h>
-#include <plat_marvell.h>
-#include <platform.h>
#include <platform_def.h>
+#include <bl31/interrupt_mgmt.h>
+#include <common/debug.h>
+#include <drivers/arm/gicv2.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
+#include <plat_marvell.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/marvell/common/marvell_gicv3.c b/plat/marvell/common/marvell_gicv3.c
index 7cfefaf5c..0bd554570 100644
--- a/plat/marvell/common/marvell_gicv3.c
+++ b/plat/marvell/common/marvell_gicv3.c
@@ -5,13 +5,15 @@
* https://spdx.org/licenses
*/
-#include <debug.h>
-#include <gicv3.h>
-#include <interrupt_props.h>
+#include <platform_def.h>
+
+#include <common/debug.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gicv3.h>
+#include <plat/common/platform.h>
+
#include <marvell_def.h>
#include <plat_marvell.h>
-#include <platform.h>
-#include <platform_def.h>
/******************************************************************************
* The following functions are defined as weak to allow a platform to override
diff --git a/plat/marvell/common/marvell_image_load.c b/plat/marvell/common/marvell_image_load.c
index d69b1b121..be16b0898 100644
--- a/plat/marvell/common/marvell_image_load.c
+++ b/plat/marvell/common/marvell_image_load.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
#include <platform_def.h>
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
+
/*******************************************************************************
* This function flushes the data structures so that they are visible
* in memory for the next BL image.
diff --git a/plat/marvell/common/marvell_io_storage.c b/plat/marvell/common/marvell_io_storage.c
index cb9ece247..065f95688 100644
--- a/plat/marvell/common/marvell_io_storage.c
+++ b/plat/marvell/common/marvell_io_storage.c
@@ -6,16 +6,18 @@
*/
#include <assert.h>
-#include <bl_common.h> /* For ARRAY_SIZE */
-#include <debug.h>
-#include <firmware_image_package.h>
-#include <io_driver.h>
-#include <io_fip.h>
-#include <io_memmap.h>
-#include <io_storage.h>
-#include <platform_def.h>
#include <string.h>
+#include <platform_def.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/io/io_driver.h>
+#include <drivers/io/io_fip.h>
+#include <drivers/io/io_memmap.h>
+#include <drivers/io/io_storage.h>
+#include <tools_share/firmware_image_package.h>
+
/* IO devices */
static const io_dev_connector_t *fip_dev_con;
static uintptr_t fip_dev_handle;
diff --git a/plat/marvell/common/marvell_pm.c b/plat/marvell/common/marvell_pm.c
index 2a7579009..3c675b296 100644
--- a/plat/marvell/common/marvell_pm.c
+++ b/plat/marvell/common/marvell_pm.c
@@ -5,9 +5,11 @@
* https://spdx.org/licenses
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <psci.h>
+
+#include <arch_helpers.h>
+#include <lib/psci/psci.h>
+
#include <marvell_pm.h>
/* Standard ARM platforms are expected to export plat_arm_psci_pm_ops */
diff --git a/plat/marvell/common/mrvl_sip_svc.c b/plat/marvell/common/mrvl_sip_svc.c
index bc4b62113..df211059b 100644
--- a/plat/marvell/common/mrvl_sip_svc.c
+++ b/plat/marvell/common/mrvl_sip_svc.c
@@ -5,13 +5,15 @@
* https://spdx.org/licenses
*/
-#include <ap_setup.h>
-#include <cache_llc.h>
-#include <debug.h>
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <drivers/marvell/cache_llc.h>
+#include <drivers/marvell/mochi/ap_setup.h>
+#include <lib/smccc.h>
+
#include <marvell_plat_priv.h>
#include <plat_marvell.h>
-#include <runtime_svc.h>
-#include <smccc.h>
+
#include "comphy/phy-comphy-cp110.h"
/* #define DEBUG_COMPHY */
diff --git a/plat/marvell/common/mss/mss_ipc_drv.c b/plat/marvell/common/mss/mss_ipc_drv.c
index 731c315bf..70ccfa5ac 100644
--- a/plat/marvell/common/mss/mss_ipc_drv.c
+++ b/plat/marvell/common/mss/mss_ipc_drv.c
@@ -5,11 +5,13 @@
* https://spdx.org/licenses
*/
-#include <plat_marvell.h>
-#include <debug.h>
#include <string.h>
+
+#include <common/debug.h>
+#include <lib/mmio.h>
+
+#include <plat_marvell.h>
#include <mss_ipc_drv.h>
-#include <mmio.h>
#define IPC_MSG_BASE_MASK MVEBU_REGS_BASE_MASK
diff --git a/plat/marvell/common/mss/mss_ipc_drv.h b/plat/marvell/common/mss/mss_ipc_drv.h
index 7bb15d3f2..bcb4b2d8f 100644
--- a/plat/marvell/common/mss/mss_ipc_drv.h
+++ b/plat/marvell/common/mss/mss_ipc_drv.h
@@ -8,7 +8,7 @@
#ifndef MSS_IPC_DRV_H
#define MSS_IPC_DRV_H
-#include <psci.h>
+#include <lib/psci/psci.h>
#define MV_PM_FW_IPC_VERSION_MAGIC (0xCA530000) /* Do NOT change */
/* Increament for each version */
diff --git a/plat/marvell/common/mss/mss_scp_bootloader.c b/plat/marvell/common/mss/mss_scp_bootloader.c
index 334fcfc61..7e442c615 100644
--- a/plat/marvell/common/mss/mss_scp_bootloader.c
+++ b/plat/marvell/common/mss/mss_scp_bootloader.c
@@ -6,11 +6,13 @@
*/
#include <assert.h>
-#include <debug.h>
-#include <mmio.h>
-#include <arch_helpers.h> /* for cache maintanance operations */
+
#include <platform_def.h>
-#include <delay_timer.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
#include <plat_pm_trace.h>
#include <mss_scp_bootloader.h>
diff --git a/plat/marvell/common/plat_delay_timer.c b/plat/marvell/common/plat_delay_timer.c
index dfc77c7fe..253975264 100644
--- a/plat/marvell/common/plat_delay_timer.c
+++ b/plat/marvell/common/plat_delay_timer.c
@@ -6,7 +6,8 @@
*/
#include <arch_helpers.h>
-#include <delay_timer.h>
+#include <drivers/delay_timer.h>
+
#include <mvebu_def.h>
#define SYS_COUNTER_FREQ_IN_MHZ (COUNTER_FREQUENCY/1000000)
diff --git a/plat/mediatek/common/custom/oem_svc.c b/plat/mediatek/common/custom/oem_svc.c
index 18bda515a..27ee6aa7b 100644
--- a/plat/mediatek/common/custom/oem_svc.c
+++ b/plat/mediatek/common/custom/oem_svc.c
@@ -3,15 +3,18 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
+#include <assert.h>
+#include <stdint.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <assert.h>
-#include <debug.h>
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <plat/common/platform.h>
+#include <tools_share/uuid.h>
+
#include <oem_svc.h>
-#include <platform.h>
-#include <runtime_svc.h>
-#include <stdint.h>
-#include <uuid.h>
/* OEM Service UUID */
DEFINE_SVC_UUID2(oem_svc_uid,
diff --git a/plat/mediatek/common/mtk_plat_common.c b/plat/mediatek/common/mtk_plat_common.c
index bff83c734..a07a2981a 100644
--- a/plat/mediatek/common/mtk_plat_common.c
+++ b/plat/mediatek/common/mtk_plat_common.c
@@ -3,17 +3,19 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <arch_helpers.h>
-#include <bl_common.h>
-#include <cci.h>
-#include <console.h>
-#include <debug.h>
-#include <mmio.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/console.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables.h>
+#include <plat/common/platform.h>
+
#include <mtk_plat_common.h>
#include <mtk_sip_svc.h>
#include <plat_private.h>
-#include <platform.h>
-#include <xlat_tables.h>
struct atf_arg_t gteearg;
diff --git a/plat/mediatek/common/mtk_plat_common.h b/plat/mediatek/common/mtk_plat_common.h
index ff8e8c037..55f4c516e 100644
--- a/plat/mediatek/common/mtk_plat_common.h
+++ b/plat/mediatek/common/mtk_plat_common.h
@@ -6,10 +6,11 @@
#ifndef MTK_PLAT_COMMON_H
#define MTK_PLAT_COMMON_H
-#include <bl_common.h>
-#include <param_header.h>
#include <stdint.h>
+#include <common/bl_common.h>
+#include <common/param_header.h>
+
/*******************************************************************************
* Function and variable prototypes
******************************************************************************/
diff --git a/plat/mediatek/common/mtk_sip_svc.c b/plat/mediatek/common/mtk_sip_svc.c
index 71eddca31..dab0d4541 100644
--- a/plat/mediatek/common/mtk_sip_svc.c
+++ b/plat/mediatek/common/mtk_sip_svc.c
@@ -3,15 +3,18 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <assert.h>
-#include <console.h>
-#include <debug.h>
-#include <mmio.h>
+
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <drivers/console.h>
+#include <lib/mmio.h>
+#include <tools_share/uuid.h>
+
#include <mtk_plat_common.h>
#include <mtk_sip_svc.h>
#include <plat_sip_calls.h>
-#include <runtime_svc.h>
-#include <uuid.h>
/* Mediatek SiP Service UUID */
DEFINE_SVC_UUID2(mtk_sip_svc_uid,
diff --git a/plat/mediatek/mt6795/bl31.ld.S b/plat/mediatek/mt6795/bl31.ld.S
index 8f391df7e..6ec7a1ab4 100644
--- a/plat/mediatek/mt6795/bl31.ld.S
+++ b/plat/mediatek/mt6795/bl31.ld.S
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <lib/xlat_tables/xlat_tables_defs.h>
#include <platform_def.h>
-#include <xlat_tables_defs.h>
OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT)
OUTPUT_ARCH(PLATFORM_LINKER_ARCH)
diff --git a/plat/mediatek/mt6795/bl31_plat_setup.c b/plat/mediatek/mt6795/bl31_plat_setup.c
index 8df7dada8..2051fe763 100644
--- a/plat/mediatek/mt6795/bl31_plat_setup.c
+++ b/plat/mediatek/mt6795/bl31_plat_setup.c
@@ -3,25 +3,28 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
+
#include <assert.h>
-#include <bl_common.h>
-#include <cci.h>
-#include <common_def.h>
-#include <console.h>
-#include <context_mgmt.h>
-#include <debug.h>
-#include <generic_delay_timer.h>
+#include <string.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/console.h>
+#include <drivers/generic_delay_timer.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/mmio.h>
+#include <lib/utils_def.h>
+#include <lib/xlat_tables/xlat_tables.h>
+#include <plat/common/common_def.h>
+#include <plat/common/platform.h>
+
#include <mcucfg.h>
-#include <mmio.h>
#include <mt_cpuxgpt.h>
#include <mtk_plat_common.h>
#include <mtk_sip_svc.h>
#include <plat_private.h>
-#include <platform.h>
-#include <string.h>
-#include <utils_def.h>
-#include <xlat_tables.h>
/*******************************************************************************
* Declarations of linker defined symbols which will help us find the layout
diff --git a/plat/mediatek/mt6795/drivers/timer/mt_cpuxgpt.c b/plat/mediatek/mt6795/drivers/timer/mt_cpuxgpt.c
index b357972e4..3696f8eec 100644
--- a/plat/mediatek/mt6795/drivers/timer/mt_cpuxgpt.c
+++ b/plat/mediatek/mt6795/drivers/timer/mt_cpuxgpt.c
@@ -4,13 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <stdint.h>
#include <arch_helpers.h>
-#include <debug.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include <mt_cpuxgpt.h>
-#include <platform.h>
-#include <stdint.h>
+
#define CPUXGPT_BASE 0x10200000
#define INDEX_BASE (CPUXGPT_BASE+0x0674)
#define CTL_BASE (CPUXGPT_BASE+0x0670)
diff --git a/plat/mediatek/mt6795/include/mcucfg.h b/plat/mediatek/mt6795/include/mcucfg.h
index 7f6a78655..21c539462 100644
--- a/plat/mediatek/mt6795/include/mcucfg.h
+++ b/plat/mediatek/mt6795/include/mcucfg.h
@@ -7,9 +7,10 @@
#ifndef MCUCFG_H
#define MCUCFG_H
-#include <platform_def.h>
#include <stdint.h>
+#include <platform_def.h>
+
struct mt6795_mcucfg_regs {
uint32_t mp0_ca7l_cache_config;
struct {
diff --git a/plat/mediatek/mt6795/include/plat_macros.S b/plat/mediatek/mt6795/include/plat_macros.S
index 7485647f3..d198fdc11 100644
--- a/plat/mediatek/mt6795/include/plat_macros.S
+++ b/plat/mediatek/mt6795/include/plat_macros.S
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <cci.h>
+#include <drivers/arm/cci.h>
#include <platform_def.h>
.section .rodata.gic_reg_name, "aS"
diff --git a/plat/mediatek/mt6795/include/plat_private.h b/plat/mediatek/mt6795/include/plat_private.h
index 10baa23d9..f7450ca1c 100644
--- a/plat/mediatek/mt6795/include/plat_private.h
+++ b/plat/mediatek/mt6795/include/plat_private.h
@@ -8,7 +8,8 @@
#define PLAT_PRIVATE_H
#include <stdint.h>
-#include <xlat_tables.h>
+
+#include <lib/xlat_tables/xlat_tables.h>
void plat_configure_mmu_el3(unsigned long total_base,
unsigned long total_size,
diff --git a/plat/mediatek/mt6795/include/platform_def.h b/plat/mediatek/mt6795/include/platform_def.h
index 0110e192d..301610d4c 100644
--- a/plat/mediatek/mt6795/include/platform_def.h
+++ b/plat/mediatek/mt6795/include/platform_def.h
@@ -7,7 +7,7 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
#define PLAT_PRIMARY_CPU 0x0
diff --git a/plat/mediatek/mt6795/plat_delay_timer.c b/plat/mediatek/mt6795/plat_delay_timer.c
index 9df286771..965b65348 100644
--- a/plat/mediatek/mt6795/plat_delay_timer.c
+++ b/plat/mediatek/mt6795/plat_delay_timer.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <delay_timer.h>
#include <platform_def.h>
+#include <arch_helpers.h>
+#include <drivers/delay_timer.h>
+
static uint32_t plat_get_timer_value(void)
{
/*
diff --git a/plat/mediatek/mt6795/plat_mt_gic.c b/plat/mediatek/mt6795/plat_mt_gic.c
index 11282fc54..20cb26d5e 100644
--- a/plat/mediatek/mt6795/plat_mt_gic.c
+++ b/plat/mediatek/mt6795/plat_mt_gic.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <gicv2.h>
-#include <interrupt_props.h>
-#include <platform.h>
#include <platform_def.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gicv2.h>
+#include <plat/common/platform.h>
+
static const interrupt_prop_t g0_interrupt_props[] = {
INTR_PROP_DESC(FIQ_SMP_CALL_SGI, GIC_HIGHEST_SEC_PRIORITY,
GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
diff --git a/plat/mediatek/mt6795/plat_pm.c b/plat/mediatek/mt6795/plat_pm.c
index d0506645f..0dfbd1846 100644
--- a/plat/mediatek/mt6795/plat_pm.c
+++ b/plat/mediatek/mt6795/plat_pm.c
@@ -4,19 +4,22 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bakery_lock.h>
-#include <cci.h>
-#include <console.h>
-#include <debug.h>
#include <errno.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/console.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+
#include <mcucfg.h>
-#include <mmio.h>
#include <plat_private.h>
-#include <platform_def.h>
#include <power_tracer.h>
-#include <psci.h>
#include <scu.h>
struct core_context {
diff --git a/plat/mediatek/mt6795/plat_topology.c b/plat/mediatek/mt6795/plat_topology.c
index 0a0cf8d78..7425d2667 100644
--- a/plat/mediatek/mt6795/plat_topology.c
+++ b/plat/mediatek/mt6795/plat_topology.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
#include <platform_def.h>
-#include <psci.h>
+
+#include <arch.h>
+#include <lib/psci/psci.h>
unsigned int plat_get_aff_count(unsigned int aff_lvl, unsigned long mpidr)
{
diff --git a/plat/mediatek/mt6795/power_tracer.c b/plat/mediatek/mt6795/power_tracer.c
index 56e22402f..64d086d80 100644
--- a/plat/mediatek/mt6795/power_tracer.c
+++ b/plat/mediatek/mt6795/power_tracer.c
@@ -5,7 +5,8 @@
*/
#include <arch.h>
-#include <debug.h>
+#include <common/debug.h>
+
#include <power_tracer.h>
#define trace_log(...) INFO("psci: " __VA_ARGS__)
diff --git a/plat/mediatek/mt6795/scu.c b/plat/mediatek/mt6795/scu.c
index 9add19e5a..3b7452787 100644
--- a/plat/mediatek/mt6795/scu.c
+++ b/plat/mediatek/mt6795/scu.c
@@ -5,8 +5,9 @@
*/
#include <arch.h>
+#include <lib/mmio.h>
+
#include <mcucfg.h>
-#include <mmio.h>
void disable_scu(unsigned long mpidr)
{
diff --git a/plat/mediatek/mt8173/aarch64/platform_common.c b/plat/mediatek/mt8173/aarch64/platform_common.c
index a7619926a..a2dbe3e47 100644
--- a/plat/mediatek/mt8173/aarch64/platform_common.c
+++ b/plat/mediatek/mt8173/aarch64/platform_common.c
@@ -3,14 +3,17 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
+#include <platform_def.h>
+
#include <arch_helpers.h>
-#include <bl_common.h>
-#include <cci.h>
-#include <debug.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <lib/utils.h>
+#include <lib/xlat_tables/xlat_tables.h>
+
#include <mt8173_def.h>
-#include <platform_def.h>
-#include <utils.h>
-#include <xlat_tables.h>
static const int cci_map[] = {
PLAT_MT_CCI_CLUSTER0_SL_IFACE_IX,
diff --git a/plat/mediatek/mt8173/bl31_plat_setup.c b/plat/mediatek/mt8173/bl31_plat_setup.c
index c27de8295..bd384a1d4 100644
--- a/plat/mediatek/mt8173/bl31_plat_setup.c
+++ b/plat/mediatek/mt8173/bl31_plat_setup.c
@@ -3,19 +3,22 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <assert.h>
-#include <bl_common.h>
-#include <common_def.h>
-#include <console.h>
-#include <debug.h>
-#include <generic_delay_timer.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+#include <drivers/generic_delay_timer.h>
+#include <lib/mmio.h>
+#include <plat/common/common_def.h>
+#include <plat/common/platform.h>
+
#include <mcucfg.h>
-#include <mmio.h>
#include <mtcmos.h>
#include <mtk_plat_common.h>
#include <plat_arm.h>
#include <plat_private.h>
-#include <platform.h>
#include <spm.h>
static entry_point_info_t bl32_ep_info;
diff --git a/plat/mediatek/mt8173/drivers/crypt/crypt.c b/plat/mediatek/mt8173/drivers/crypt/crypt.c
index 74d7702ad..bfb3082ba 100644
--- a/plat/mediatek/mt8173/drivers/crypt/crypt.c
+++ b/plat/mediatek/mt8173/drivers/crypt/crypt.c
@@ -3,12 +3,15 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
+#include <assert.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <assert.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <mt8173_def.h>
#include <mtk_sip_svc.h>
diff --git a/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.c b/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.c
index 25f25097e..452ac224c 100644
--- a/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.c
+++ b/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <delay_timer.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <mt8173_def.h>
#include <mtcmos.h>
#include <spm.h>
diff --git a/plat/mediatek/mt8173/drivers/pmic/pmic_wrap_init.c b/plat/mediatek/mt8173/drivers/pmic/pmic_wrap_init.c
index c64fdf7c2..8120d9962 100644
--- a/plat/mediatek/mt8173/drivers/pmic/pmic_wrap_init.c
+++ b/plat/mediatek/mt8173/drivers/pmic/pmic_wrap_init.c
@@ -3,9 +3,11 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <delay_timer.h>
-#include <mmio.h>
+
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <mt8173_def.h>
#include <pmic_wrap_init.h>
diff --git a/plat/mediatek/mt8173/drivers/rtc/rtc.c b/plat/mediatek/mt8173/drivers/rtc/rtc.c
index 22fed9e64..2b9033ed9 100644
--- a/plat/mediatek/mt8173/drivers/rtc/rtc.c
+++ b/plat/mediatek/mt8173/drivers/rtc/rtc.c
@@ -3,9 +3,12 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <assert.h>
-#include <debug.h>
-#include <delay_timer.h>
+
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+
#include <mt8173_def.h>
#include <pmic_wrap_init.h>
#include <rtc.h>
diff --git a/plat/mediatek/mt8173/drivers/spm/spm.c b/plat/mediatek/mt8173/drivers/spm/spm.c
index eb40072b9..1caab3bdf 100644
--- a/plat/mediatek/mt8173/drivers/spm/spm.c
+++ b/plat/mediatek/mt8173/drivers/spm/spm.c
@@ -3,9 +3,11 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bakery_lock.h>
-#include <debug.h>
-#include <mmio.h>
+
+#include <common/debug.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+
#include <mt8173_def.h>
#include <spm.h>
#include <spm_suspend.h>
diff --git a/plat/mediatek/mt8173/drivers/spm/spm_hotplug.c b/plat/mediatek/mt8173/drivers/spm/spm_hotplug.c
index 6d275d043..b2b9adafe 100644
--- a/plat/mediatek/mt8173/drivers/spm/spm_hotplug.c
+++ b/plat/mediatek/mt8173/drivers/spm/spm_hotplug.c
@@ -3,10 +3,12 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <arch.h>
-#include <mmio.h>
+#include <lib/mmio.h>
#include <mt8173_def.h>
-#include <platform.h>
+#include <plat/common/platform.h>
+
#include <spm.h>
#include <spm_hotplug.h>
#include <spm_mcdi.h>
diff --git a/plat/mediatek/mt8173/drivers/spm/spm_mcdi.c b/plat/mediatek/mt8173/drivers/spm/spm_mcdi.c
index de8d73a51..ea5f2bb14 100644
--- a/plat/mediatek/mt8173/drivers/spm/spm_mcdi.c
+++ b/plat/mediatek/mt8173/drivers/spm/spm_mcdi.c
@@ -3,12 +3,15 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
+#include <platform_def.h>
+
#include <arch.h>
-#include <debug.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include <mt8173_def.h>
-#include <platform.h>
-#include <platform_def.h>
#include <spm.h>
#include <spm_hotplug.h>
#include <spm_mcdi.h>
diff --git a/plat/mediatek/mt8173/drivers/spm/spm_suspend.c b/plat/mediatek/mt8173/drivers/spm/spm_suspend.c
index 8c79b3b4e..5021695db 100644
--- a/plat/mediatek/mt8173/drivers/spm/spm_suspend.c
+++ b/plat/mediatek/mt8173/drivers/spm/spm_suspend.c
@@ -3,10 +3,12 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bakery_lock.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <mmio.h>
+
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+
#include <mt8173_def.h>
#include <spm.h>
#include <spm_suspend.h>
diff --git a/plat/mediatek/mt8173/drivers/timer/mt_cpuxgpt.c b/plat/mediatek/mt8173/drivers/timer/mt_cpuxgpt.c
index 8a30d8aef..174a24d88 100644
--- a/plat/mediatek/mt8173/drivers/timer/mt_cpuxgpt.c
+++ b/plat/mediatek/mt8173/drivers/timer/mt_cpuxgpt.c
@@ -3,9 +3,11 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <arch_helpers.h>
+#include <lib/mmio.h>
+
#include <mcucfg.h>
-#include <mmio.h>
#include <mt8173_def.h>
#include <mt_cpuxgpt.h>
diff --git a/plat/mediatek/mt8173/include/mcucfg.h b/plat/mediatek/mt8173/include/mcucfg.h
index 49d7c3e18..dedbc082f 100644
--- a/plat/mediatek/mt8173/include/mcucfg.h
+++ b/plat/mediatek/mt8173/include/mcucfg.h
@@ -6,9 +6,10 @@
#ifndef MCUCFG_H
#define MCUCFG_H
-#include <mt8173_def.h>
#include <stdint.h>
+#include <mt8173_def.h>
+
struct mt8173_mcucfg_regs {
uint32_t mp0_ca7l_cache_config;
struct {
diff --git a/plat/mediatek/mt8173/include/plat_macros.S b/plat/mediatek/mt8173/include/plat_macros.S
index 5eb4913f1..ac9fb160d 100644
--- a/plat/mediatek/mt8173/include/plat_macros.S
+++ b/plat/mediatek/mt8173/include/plat_macros.S
@@ -4,9 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <cci.h>
-#include <gic_common.h>
-#include <gicv2.h>
+#include <drivers/arm/cci.h>
+#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gicv2.h>
#include <mt8173_def.h>
.section .rodata.gic_reg_name, "aS"
diff --git a/plat/mediatek/mt8173/include/platform_def.h b/plat/mediatek/mt8173/include/platform_def.h
index 9bbed3c3b..205e26387 100644
--- a/plat/mediatek/mt8173/include/platform_def.h
+++ b/plat/mediatek/mt8173/include/platform_def.h
@@ -7,9 +7,10 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
-#include <gic_common.h>
-#include <interrupt_props.h>
-#include <utils_def.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gic_common.h>
+#include <lib/utils_def.h>
+
#include "mt8173_def.h"
/*******************************************************************************
diff --git a/plat/mediatek/mt8173/plat_mt_gic.c b/plat/mediatek/mt8173/plat_mt_gic.c
index 16e36afbf..80b9010c1 100644
--- a/plat/mediatek/mt8173/plat_mt_gic.c
+++ b/plat/mediatek/mt8173/plat_mt_gic.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
+#include <common/bl_common.h>
+#include <lib/utils.h>
+
#include <mt8173_def.h>
-#include <utils.h>
const unsigned int mt_irq_sec_array[] = {
MT_IRQ_SEC_SGI_0,
diff --git a/plat/mediatek/mt8173/plat_pm.c b/plat/mediatek/mt8173/plat_pm.c
index b19d3f307..9673d2c28 100644
--- a/plat/mediatek/mt8173/plat_pm.c
+++ b/plat/mediatek/mt8173/plat_pm.c
@@ -4,22 +4,24 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bakery_lock.h>
-#include <cci.h>
-#include <console.h>
-#include <debug.h>
#include <errno.h>
-#include <gicv2.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/console.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+
#include <mcucfg.h>
-#include <mmio.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 <psci.h>
#include <rtc.h>
#include <scu.h>
#include <spm_hotplug.h>
diff --git a/plat/mediatek/mt8173/plat_sip_calls.c b/plat/mediatek/mt8173/plat_sip_calls.c
index 1d51cb592..102feb22a 100644
--- a/plat/mediatek/mt8173/plat_sip_calls.c
+++ b/plat/mediatek/mt8173/plat_sip_calls.c
@@ -3,13 +3,15 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <lib/mmio.h>
+
#include <crypt.h>
-#include <debug.h>
-#include <mmio.h>
#include <mtcmos.h>
#include <mtk_sip_svc.h>
#include <plat_sip_calls.h>
-#include <runtime_svc.h>
/* Authorized secure register list */
enum {
diff --git a/plat/mediatek/mt8173/plat_topology.c b/plat/mediatek/mt8173/plat_topology.c
index d70fea522..23e7d2d3b 100644
--- a/plat/mediatek/mt8173/plat_topology.c
+++ b/plat/mediatek/mt8173/plat_topology.c
@@ -3,10 +3,11 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
+
#include <platform_def.h>
-#include <psci.h>
+#include <arch.h>
+#include <lib/psci/psci.h>
const unsigned char mtk_power_domain_tree_desc[] = {
/* No of root nodes */
diff --git a/plat/mediatek/mt8173/power_tracer.c b/plat/mediatek/mt8173/power_tracer.c
index 787dad13f..d1fcf9f26 100644
--- a/plat/mediatek/mt8173/power_tracer.c
+++ b/plat/mediatek/mt8173/power_tracer.c
@@ -5,7 +5,8 @@
*/
#include <arch.h>
-#include <debug.h>
+#include <common/debug.h>
+
#include <power_tracer.h>
#define trace_log(...) INFO("psci: " __VA_ARGS__)
diff --git a/plat/mediatek/mt8173/scu.c b/plat/mediatek/mt8173/scu.c
index 4daa9e5ff..2524d72e1 100644
--- a/plat/mediatek/mt8173/scu.c
+++ b/plat/mediatek/mt8173/scu.c
@@ -5,8 +5,9 @@
*/
#include <arch.h>
+#include <lib/mmio.h>
+
#include <mcucfg.h>
-#include <mmio.h>
void disable_scu(unsigned long mpidr)
{
diff --git a/plat/meson/gxbb/gxbb_bl31_setup.c b/plat/meson/gxbb/gxbb_bl31_setup.c
index 3e176f9a0..b867a5846 100644
--- a/plat/meson/gxbb/gxbb_bl31_setup.c
+++ b/plat/meson/gxbb/gxbb_bl31_setup.c
@@ -5,12 +5,14 @@
*/
#include <assert.h>
-#include <bl_common.h>
-#include <gicv2.h>
-#include <interrupt_props.h>
-#include <platform.h>
+
#include <platform_def.h>
-#include <xlat_mmu_helpers.h>
+
+#include <common/bl_common.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gicv2.h>
+#include <lib/xlat_tables/xlat_mmu_helpers.h>
+#include <plat/common/platform.h>
#include "gxbb_private.h"
diff --git a/plat/meson/gxbb/gxbb_common.c b/plat/meson/gxbb/gxbb_common.c
index 349d02f9e..0ca15e860 100644
--- a/plat/meson/gxbb/gxbb_common.c
+++ b/plat/meson/gxbb/gxbb_common.c
@@ -5,15 +5,17 @@
*/
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <ep_info.h>
-#include <interrupt_mgmt.h>
-#include <meson_console.h>
-#include <mmio.h>
-#include <platform_def.h>
#include <stdint.h>
-#include <xlat_tables_v2.h>
+
+#include <platform_def.h>
+
+#include <bl31/interrupt_mgmt.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/ep_info.h>
+#include <drivers/meson/meson_console.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
/*******************************************************************************
* Platform memory map regions
diff --git a/plat/meson/gxbb/gxbb_def.h b/plat/meson/gxbb/gxbb_def.h
index 0c73ac082..3e27097c3 100644
--- a/plat/meson/gxbb/gxbb_def.h
+++ b/plat/meson/gxbb/gxbb_def.h
@@ -7,7 +7,7 @@
#ifndef GXBB_DEF_H
#define GXBB_DEF_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
/*******************************************************************************
* System oscillator
diff --git a/plat/meson/gxbb/gxbb_mhu.c b/plat/meson/gxbb/gxbb_mhu.c
index 78b895c52..903ef411c 100644
--- a/plat/meson/gxbb/gxbb_mhu.c
+++ b/plat/meson/gxbb/gxbb_mhu.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bakery_lock.h>
-#include <mmio.h>
#include <platform_def.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+
static DEFINE_BAKERY_LOCK(mhu_lock);
void mhu_secure_message_start(void)
diff --git a/plat/meson/gxbb/gxbb_pm.c b/plat/meson/gxbb/gxbb_pm.c
index 930b5e168..59b9436fe 100644
--- a/plat/meson/gxbb/gxbb_pm.c
+++ b/plat/meson/gxbb/gxbb_pm.c
@@ -4,16 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <console.h>
-#include <debug.h>
#include <errno.h>
-#include <gicv2.h>
-#include <mmio.h>
-#include <platform.h>
+
#include <platform_def.h>
-#include <psci.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/console.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
#include "gxbb_private.h"
diff --git a/plat/meson/gxbb/gxbb_scpi.c b/plat/meson/gxbb/gxbb_scpi.c
index 2390bcad8..83eeda29d 100644
--- a/plat/meson/gxbb/gxbb_scpi.c
+++ b/plat/meson/gxbb/gxbb_scpi.c
@@ -5,11 +5,13 @@
*/
#include <assert.h>
-#include <mmio.h>
-#include <platform.h>
-#include <platform_def.h>
#include <string.h>
+#include <platform_def.h>
+
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include "gxbb_private.h"
#define SIZE_SHIFT 20
diff --git a/plat/meson/gxbb/gxbb_sip_svc.c b/plat/meson/gxbb/gxbb_sip_svc.c
index 82ed44935..63c7dba15 100644
--- a/plat/meson/gxbb/gxbb_sip_svc.c
+++ b/plat/meson/gxbb/gxbb_sip_svc.c
@@ -4,12 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <mmio.h>
-#include <platform_def.h>
-#include <runtime_svc.h>
#include <stdint.h>
+#include <platform_def.h>
+
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <lib/mmio.h>
+
#include "gxbb_private.h"
/*******************************************************************************
diff --git a/plat/meson/gxbb/gxbb_topology.c b/plat/meson/gxbb/gxbb_topology.c
index 49bb2dcad..eec2d34d4 100644
--- a/plat/meson/gxbb/gxbb_topology.c
+++ b/plat/meson/gxbb/gxbb_topology.c
@@ -4,10 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
-#include <platform_def.h>
#include <stdint.h>
+#include <platform_def.h>
+
+#include <arch.h>
+
#include "gxbb_private.h"
/* The power domain tree descriptor */
diff --git a/plat/meson/gxbb/include/plat_macros.S b/plat/meson/gxbb/include/plat_macros.S
index 948b5f98f..c721c21b6 100644
--- a/plat/meson/gxbb/include/plat_macros.S
+++ b/plat/meson/gxbb/include/plat_macros.S
@@ -7,7 +7,7 @@
#ifndef PLAT_MACROS_S
#define PLAT_MACROS_S
-#include <gicv2.h>
+#include <drivers/arm/gicv2.h>
#include <platform_def.h>
.section .rodata.gic_reg_name, "aS"
diff --git a/plat/meson/gxbb/include/platform_def.h b/plat/meson/gxbb/include/platform_def.h
index a85637fe2..da4aedde8 100644
--- a/plat/meson/gxbb/include/platform_def.h
+++ b/plat/meson/gxbb/include/platform_def.h
@@ -8,7 +8,7 @@
#define PLATFORM_DEF_H
#include <arch.h>
-#include <utils_def.h>
+#include <lib/utils_def.h>
#include "../gxbb_def.h"
diff --git a/plat/meson/gxbb/platform.mk b/plat/meson/gxbb/platform.mk
index 68ff40075..9669bf959 100644
--- a/plat/meson/gxbb/platform.mk
+++ b/plat/meson/gxbb/platform.mk
@@ -6,8 +6,7 @@
include lib/xlat_tables_v2/xlat_tables.mk
-PLAT_INCLUDES := -Iinclude/drivers/meson/ \
- -Iplat/meson/gxbb/include
+PLAT_INCLUDES := -Iplat/meson/gxbb/include
GXBB_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \
drivers/arm/gic/v2/gicv2_main.c \
diff --git a/plat/nvidia/tegra/common/drivers/flowctrl/flowctrl.c b/plat/nvidia/tegra/common/drivers/flowctrl/flowctrl.c
index 2d827da81..775ad30f6 100644
--- a/plat/nvidia/tegra/common/drivers/flowctrl/flowctrl.c
+++ b/plat/nvidia/tegra/common/drivers/flowctrl/flowctrl.c
@@ -4,13 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
+
+#include <arch_helpers.h>
#include <cortex_a53.h>
-#include <debug.h>
-#include <delay_timer.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <flowctrl.h>
-#include <mmio.h>
#include <pmc.h>
#include <tegra_def.h>
diff --git a/plat/nvidia/tegra/common/drivers/memctrl/memctrl_v1.c b/plat/nvidia/tegra/common/drivers/memctrl/memctrl_v1.c
index 9944e729d..58f49d05f 100644
--- a/plat/nvidia/tegra/common/drivers/memctrl/memctrl_v1.c
+++ b/plat/nvidia/tegra/common/drivers/memctrl/memctrl_v1.c
@@ -4,16 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
+#include <string.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <lib/utils.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
+
#include <memctrl.h>
#include <memctrl_v1.h>
-#include <mmio.h>
-#include <string.h>
#include <tegra_def.h>
-#include <utils.h>
-#include <xlat_tables_v2.h>
/* Video Memory base and size (live values) */
static uint64_t video_mem_base;
diff --git a/plat/nvidia/tegra/common/drivers/memctrl/memctrl_v2.c b/plat/nvidia/tegra/common/drivers/memctrl/memctrl_v2.c
index 92fdadcfa..55b915223 100644
--- a/plat/nvidia/tegra/common/drivers/memctrl/memctrl_v2.c
+++ b/plat/nvidia/tegra/common/drivers/memctrl/memctrl_v2.c
@@ -4,20 +4,22 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
+#include <string.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <lib/utils.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
+
#include <mce.h>
#include <memctrl.h>
#include <memctrl_v2.h>
-#include <mmio.h>
#include <smmu.h>
-#include <string.h>
#include <tegra_def.h>
#include <tegra_platform.h>
-#include <utils.h>
-#include <xlat_tables_v2.h>
/* Video Memory base and size (live values) */
static uint64_t video_mem_base;
diff --git a/plat/nvidia/tegra/common/drivers/pmc/pmc.c b/plat/nvidia/tegra/common/drivers/pmc/pmc.c
index d8827e101..b9ff5116d 100644
--- a/plat/nvidia/tegra/common/drivers/pmc/pmc.c
+++ b/plat/nvidia/tegra/common/drivers/pmc/pmc.c
@@ -4,10 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
-#include <mmio.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+
#include <pmc.h>
#include <tegra_def.h>
diff --git a/plat/nvidia/tegra/common/drivers/smmu/smmu.c b/plat/nvidia/tegra/common/drivers/smmu/smmu.c
index 4b9edb622..610f32f1e 100644
--- a/plat/nvidia/tegra/common/drivers/smmu/smmu.c
+++ b/plat/nvidia/tegra/common/drivers/smmu/smmu.c
@@ -5,11 +5,14 @@
*/
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
+#include <string.h>
+
#include <platform_def.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+
#include <smmu.h>
-#include <string.h>
#include <tegra_private.h>
extern void memcpy16(void *dest, const void *src, unsigned int length);
diff --git a/plat/nvidia/tegra/common/tegra_bl31_setup.c b/plat/nvidia/tegra/common/tegra_bl31_setup.c
index 9410d44fc..b49665027 100644
--- a/plat/nvidia/tegra/common/tegra_bl31_setup.c
+++ b/plat/nvidia/tegra/common/tegra_bl31_setup.c
@@ -4,27 +4,30 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <assert.h>
+#include <errno.h>
+#include <stddef.h>
+#include <string.h>
+
+#include <platform_def.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <assert.h>
-#include <bl31.h>
-#include <bl_common.h>
-#include <console.h>
+#include <bl31/bl31.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
#include <cortex_a53.h>
#include <cortex_a57.h>
-#include <debug.h>
#include <denver.h>
-#include <errno.h>
+#include <drivers/console.h>
+#include <lib/mmio.h>
+#include <lib/utils.h>
+#include <lib/utils_def.h>
+#include <plat/common/platform.h>
+
#include <memctrl.h>
-#include <mmio.h>
-#include <platform.h>
-#include <platform_def.h>
-#include <stddef.h>
-#include <string.h>
#include <tegra_def.h>
#include <tegra_private.h>
-#include <utils.h>
-#include <utils_def.h>
/* length of Trusty's input parameters (in bytes) */
#define TRUSTY_PARAMS_LEN_BYTES (4096*2)
diff --git a/plat/nvidia/tegra/common/tegra_delay_timer.c b/plat/nvidia/tegra/common/tegra_delay_timer.c
index 3bd2b0e24..63dcf410c 100644
--- a/plat/nvidia/tegra/common/tegra_delay_timer.c
+++ b/plat/nvidia/tegra/common/tegra_delay_timer.c
@@ -4,8 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <delay_timer.h>
-#include <mmio.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <tegra_def.h>
#include <tegra_private.h>
diff --git a/plat/nvidia/tegra/common/tegra_fiq_glue.c b/plat/nvidia/tegra/common/tegra_fiq_glue.c
index bc6d30546..0b663cef4 100644
--- a/plat/nvidia/tegra/common/tegra_fiq_glue.c
+++ b/plat/nvidia/tegra/common/tegra_fiq_glue.c
@@ -4,16 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bakery_lock.h>
-#include <bl_common.h>
+
+#include <arch_helpers.h>
+#include <bl31/interrupt_mgmt.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
#include <context.h>
-#include <context_mgmt.h>
-#include <debug.h>
#include <denver.h>
-#include <interrupt_mgmt.h>
-#include <platform.h>
+#include <lib/bakery_lock.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <plat/common/platform.h>
+
#include <tegra_def.h>
#include <tegra_private.h>
diff --git a/plat/nvidia/tegra/common/tegra_gicv2.c b/plat/nvidia/tegra/common/tegra_gicv2.c
index c42c5ec3f..293df8d4f 100644
--- a/plat/nvidia/tegra/common/tegra_gicv2.c
+++ b/plat/nvidia/tegra/common/tegra_gicv2.c
@@ -5,12 +5,15 @@
*/
#include <assert.h>
-#include <bl_common.h>
-#include <gicv2.h>
+
#include <platform_def.h>
+
+#include <common/bl_common.h>
+#include <drivers/arm/gicv2.h>
+#include <lib/utils.h>
+
#include <tegra_private.h>
#include <tegra_def.h>
-#include <utils.h>
/******************************************************************************
* Tegra common helper to setup the GICv2 driver data.
diff --git a/plat/nvidia/tegra/common/tegra_platform.c b/plat/nvidia/tegra/common/tegra_platform.c
index 6a906ae0b..10edf9229 100644
--- a/plat/nvidia/tegra/common/tegra_platform.c
+++ b/plat/nvidia/tegra/common/tegra_platform.c
@@ -5,7 +5,8 @@
*/
#include <arch_helpers.h>
-#include <mmio.h>
+#include <lib/mmio.h>
+
#include <tegra_def.h>
#include <tegra_platform.h>
#include <tegra_private.h>
diff --git a/plat/nvidia/tegra/common/tegra_pm.c b/plat/nvidia/tegra/common/tegra_pm.c
index 86021ba94..8361ddd3d 100644
--- a/plat/nvidia/tegra/common/tegra_pm.c
+++ b/plat/nvidia/tegra/common/tegra_pm.c
@@ -4,19 +4,22 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <console.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
#include <context.h>
-#include <context_mgmt.h>
-#include <debug.h>
+#include <drivers/console.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
+
#include <memctrl.h>
-#include <mmio.h>
-#include <platform.h>
-#include <platform_def.h>
#include <pmc.h>
-#include <psci.h>
#include <tegra_def.h>
#include <tegra_private.h>
diff --git a/plat/nvidia/tegra/common/tegra_sip_calls.c b/plat/nvidia/tegra/common/tegra_sip_calls.c
index a8184531f..e50d12faf 100644
--- a/plat/nvidia/tegra/common/tegra_sip_calls.c
+++ b/plat/nvidia/tegra/common/tegra_sip_calls.c
@@ -4,15 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
#include <errno.h>
+
+#include <arch.h>
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <lib/mmio.h>
+
#include <memctrl.h>
-#include <mmio.h>
-#include <runtime_svc.h>
#include <tegra_platform.h>
#include <tegra_private.h>
diff --git a/plat/nvidia/tegra/common/tegra_topology.c b/plat/nvidia/tegra/common/tegra_topology.c
index 059305351..893f28ff2 100644
--- a/plat/nvidia/tegra/common/tegra_topology.c
+++ b/plat/nvidia/tegra/common/tegra_topology.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
#include <platform_def.h>
-#include <psci.h>
+
+#include <arch.h>
+#include <lib/psci/psci.h>
extern const unsigned char tegra_power_domain_tree_desc[];
#pragma weak plat_core_pos_by_mpidr
diff --git a/plat/nvidia/tegra/include/drivers/flowctrl.h b/plat/nvidia/tegra/include/drivers/flowctrl.h
index d604c970d..31221810b 100644
--- a/plat/nvidia/tegra/include/drivers/flowctrl.h
+++ b/plat/nvidia/tegra/include/drivers/flowctrl.h
@@ -7,7 +7,8 @@
#ifndef FLOWCTRL_H
#define FLOWCTRL_H
-#include <mmio.h>
+#include <lib/mmio.h>
+
#include <tegra_def.h>
#define FLOWCTRL_HALT_CPU0_EVENTS 0x0U
diff --git a/plat/nvidia/tegra/include/drivers/mce.h b/plat/nvidia/tegra/include/drivers/mce.h
index 81408702f..4470b6b8b 100644
--- a/plat/nvidia/tegra/include/drivers/mce.h
+++ b/plat/nvidia/tegra/include/drivers/mce.h
@@ -7,7 +7,8 @@
#ifndef MCE_H
#define MCE_H
-#include <mmio.h>
+#include <lib/mmio.h>
+
#include <tegra_def.h>
/*******************************************************************************
diff --git a/plat/nvidia/tegra/include/drivers/memctrl_v1.h b/plat/nvidia/tegra/include/drivers/memctrl_v1.h
index 2553a1fd5..8e9f198e8 100644
--- a/plat/nvidia/tegra/include/drivers/memctrl_v1.h
+++ b/plat/nvidia/tegra/include/drivers/memctrl_v1.h
@@ -7,7 +7,8 @@
#ifndef MEMCTRL_V1_H
#define MEMCTRL_V1_H
-#include <mmio.h>
+#include <lib/mmio.h>
+
#include <tegra_def.h>
/* SMMU registers */
diff --git a/plat/nvidia/tegra/include/drivers/memctrl_v2.h b/plat/nvidia/tegra/include/drivers/memctrl_v2.h
index 9ae430232..957ff54c1 100644
--- a/plat/nvidia/tegra/include/drivers/memctrl_v2.h
+++ b/plat/nvidia/tegra/include/drivers/memctrl_v2.h
@@ -407,7 +407,7 @@ typedef struct tegra_mc_settings {
#ifndef __ASSEMBLY__
-#include <mmio.h>
+#include <lib/mmio.h>
static inline uint32_t tegra_mc_read_32(uint32_t off)
{
diff --git a/plat/nvidia/tegra/include/drivers/pmc.h b/plat/nvidia/tegra/include/drivers/pmc.h
index 14c922544..a01a4b64f 100644
--- a/plat/nvidia/tegra/include/drivers/pmc.h
+++ b/plat/nvidia/tegra/include/drivers/pmc.h
@@ -7,9 +7,10 @@
#ifndef PMC_H
#define PMC_H
-#include <mmio.h>
+#include <lib/mmio.h>
+#include <lib/utils_def.h>
+
#include <tegra_def.h>
-#include <utils_def.h>
#define PMC_CONFIG U(0x0)
#define PMC_PWRGATE_STATUS U(0x38)
diff --git a/plat/nvidia/tegra/include/drivers/smmu.h b/plat/nvidia/tegra/include/drivers/smmu.h
index 974aa3500..9582a67ed 100644
--- a/plat/nvidia/tegra/include/drivers/smmu.h
+++ b/plat/nvidia/tegra/include/drivers/smmu.h
@@ -7,8 +7,9 @@
#ifndef SMMU_H
#define SMMU_H
+#include <lib/mmio.h>
+
#include <memctrl_v2.h>
-#include <mmio.h>
#include <tegra_def.h>
/*******************************************************************************
diff --git a/plat/nvidia/tegra/include/drivers/tegra_gic.h b/plat/nvidia/tegra/include/drivers/tegra_gic.h
index 2fe316d2b..6106b40a7 100644
--- a/plat/nvidia/tegra/include/drivers/tegra_gic.h
+++ b/plat/nvidia/tegra/include/drivers/tegra_gic.h
@@ -7,7 +7,7 @@
#ifndef __TEGRA_GIC_H__
#define __TEGRA_GIC_H__
-#include <interrupt_props.h>
+#include <common/interrupt_props.h>
/*******************************************************************************
* Per-CPU struct describing FIQ state to be stored
diff --git a/plat/nvidia/tegra/include/platform_def.h b/plat/nvidia/tegra/include/platform_def.h
index 6a507d481..d10dc262a 100644
--- a/plat/nvidia/tegra/include/platform_def.h
+++ b/plat/nvidia/tegra/include/platform_def.h
@@ -8,9 +8,10 @@
#define PLATFORM_DEF_H
#include <arch.h>
-#include <common_def.h>
+#include <lib/utils_def.h>
+#include <plat/common/common_def.h>
+
#include <tegra_def.h>
-#include <utils_def.h>
/*******************************************************************************
* Generic platform constants
diff --git a/plat/nvidia/tegra/include/t132/tegra_def.h b/plat/nvidia/tegra/include/t132/tegra_def.h
index 277f91b63..1f58caabb 100644
--- a/plat/nvidia/tegra/include/t132/tegra_def.h
+++ b/plat/nvidia/tegra/include/t132/tegra_def.h
@@ -7,7 +7,7 @@
#ifndef TEGRA_DEF_H
#define TEGRA_DEF_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
/*******************************************************************************
* This value is used by the PSCI implementation during the `SYSTEM_SUSPEND`
diff --git a/plat/nvidia/tegra/include/t186/tegra_def.h b/plat/nvidia/tegra/include/t186/tegra_def.h
index 79aff5970..3abba5516 100644
--- a/plat/nvidia/tegra/include/t186/tegra_def.h
+++ b/plat/nvidia/tegra/include/t186/tegra_def.h
@@ -7,7 +7,7 @@
#ifndef TEGRA_DEF_H
#define TEGRA_DEF_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
/*******************************************************************************
* MCE apertures used by the ARI interface
diff --git a/plat/nvidia/tegra/include/t210/tegra_def.h b/plat/nvidia/tegra/include/t210/tegra_def.h
index 5d86224f9..14cdfd59d 100644
--- a/plat/nvidia/tegra/include/t210/tegra_def.h
+++ b/plat/nvidia/tegra/include/t210/tegra_def.h
@@ -7,7 +7,7 @@
#ifndef TEGRA_DEF_H
#define TEGRA_DEF_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
/*******************************************************************************
* Power down state IDs
diff --git a/plat/nvidia/tegra/include/tegra_private.h b/plat/nvidia/tegra/include/tegra_private.h
index 7ca32c3d3..93223cc24 100644
--- a/plat/nvidia/tegra/include/tegra_private.h
+++ b/plat/nvidia/tegra/include/tegra_private.h
@@ -7,12 +7,14 @@
#ifndef TEGRA_PRIVATE_H
#define TEGRA_PRIVATE_H
+#include <platform_def.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <platform_def.h>
-#include <psci.h>
+#include <lib/psci/psci.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
+
#include <tegra_gic.h>
-#include <xlat_tables_v2.h>
/*******************************************************************************
* Tegra DRAM memory base address
diff --git a/plat/nvidia/tegra/soc/t132/plat_psci_handlers.c b/plat/nvidia/tegra/soc/t132/plat_psci_handlers.c
index 1cffb741a..7226120b0 100644
--- a/plat/nvidia/tegra/soc/t132/plat_psci_handlers.c
+++ b/plat/nvidia/tegra/soc/t132/plat_psci_handlers.c
@@ -4,17 +4,20 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <assert.h>
+
+#include <platform_def.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <assert.h>
-#include <debug.h>
-#include <delay_timer.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
#include <denver.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+
#include <flowctrl.h>
-#include <mmio.h>
-#include <platform_def.h>
#include <pmc.h>
-#include <psci.h>
#include <tegra_def.h>
#include <tegra_private.h>
diff --git a/plat/nvidia/tegra/soc/t132/plat_secondary.c b/plat/nvidia/tegra/soc/t132/plat_secondary.c
index d5ca30c97..f46ad3bb6 100644
--- a/plat/nvidia/tegra/soc/t132/plat_secondary.c
+++ b/plat/nvidia/tegra/soc/t132/plat_secondary.c
@@ -4,14 +4,16 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
#include <denver.h>
-#include <mmio.h>
-#include <platform.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
+
#include <pmc.h>
-#include <psci.h>
#include <tegra_def.h>
#define SB_CSR 0x0
diff --git a/plat/nvidia/tegra/soc/t132/plat_setup.c b/plat/nvidia/tegra/soc/t132/plat_setup.c
index 4cbb3cc85..f72b73ed5 100644
--- a/plat/nvidia/tegra/soc/t132/plat_setup.c
+++ b/plat/nvidia/tegra/soc/t132/plat_setup.c
@@ -5,10 +5,11 @@
*/
#include <arch_helpers.h>
-#include <bl_common.h>
+#include <common/bl_common.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
+
#include <tegra_def.h>
#include <tegra_private.h>
-#include <xlat_tables_v2.h>
/*******************************************************************************
* The Tegra power domain tree has a single system level power domain i.e. a
diff --git a/plat/nvidia/tegra/soc/t132/plat_sip_calls.c b/plat/nvidia/tegra/soc/t132/plat_sip_calls.c
index adc1c7125..02dd1cd56 100644
--- a/plat/nvidia/tegra/soc/t132/plat_sip_calls.c
+++ b/plat/nvidia/tegra/soc/t132/plat_sip_calls.c
@@ -4,13 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <context_mgmt.h>
-#include <debug.h>
#include <errno.h>
+
+#include <arch.h>
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <lib/el3_runtime/context_mgmt.h>
+
#include <tegra_private.h>
#define NS_SWITCH_AARCH32 1
diff --git a/plat/nvidia/tegra/soc/t186/drivers/include/mce_private.h b/plat/nvidia/tegra/soc/t186/drivers/include/mce_private.h
index 27baab6d6..96a5525a6 100644
--- a/plat/nvidia/tegra/soc/t186/drivers/include/mce_private.h
+++ b/plat/nvidia/tegra/soc/t186/drivers/include/mce_private.h
@@ -7,7 +7,8 @@
#ifndef MCE_PRIVATE_H
#define MCE_PRIVATE_H
-#include <mmio.h>
+#include <lib/mmio.h>
+
#include <tegra_def.h>
/*******************************************************************************
diff --git a/plat/nvidia/tegra/soc/t186/drivers/mce/ari.c b/plat/nvidia/tegra/soc/t186/drivers/mce/ari.c
index 7126c3ba7..1429a6158 100644
--- a/plat/nvidia/tegra/soc/t186/drivers/mce/ari.c
+++ b/plat/nvidia/tegra/soc/t186/drivers/mce/ari.c
@@ -4,16 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <assert.h>
+#include <errno.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <assert.h>
-#include <debug.h>
-#include <delay_timer.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
#include <denver.h>
-#include <errno.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include <mce_private.h>
-#include <mmio.h>
-#include <platform.h>
#include <t18x_ari.h>
/*******************************************************************************
diff --git a/plat/nvidia/tegra/soc/t186/drivers/mce/mce.c b/plat/nvidia/tegra/soc/t186/drivers/mce/mce.c
index 712519f9f..828ad3cbd 100644
--- a/plat/nvidia/tegra/soc/t186/drivers/mce/mce.c
+++ b/plat/nvidia/tegra/soc/t186/drivers/mce/mce.c
@@ -4,19 +4,21 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <assert.h>
-#include <bl_common.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
#include <context.h>
-#include <context_mgmt.h>
-#include <debug.h>
#include <denver.h>
-#include <errno.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/mmio.h>
+
#include <mce.h>
#include <mce_private.h>
-#include <mmio.h>
-#include <string.h>
#include <t18x_ari.h>
#include <tegra_def.h>
#include <tegra_platform.h>
diff --git a/plat/nvidia/tegra/soc/t186/drivers/mce/nvg.c b/plat/nvidia/tegra/soc/t186/drivers/mce/nvg.c
index 857cfbb53..1ac3710da 100644
--- a/plat/nvidia/tegra/soc/t186/drivers/mce/nvg.c
+++ b/plat/nvidia/tegra/soc/t186/drivers/mce/nvg.c
@@ -4,13 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <errno.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <debug.h>
+#include <common/debug.h>
#include <denver.h>
-#include <errno.h>
+#include <lib/mmio.h>
+
#include <mce_private.h>
-#include <mmio.h>
#include <t18x_ari.h>
int32_t nvg_enter_cstate(uint32_t ari_base, uint32_t state, uint32_t wake_time)
diff --git a/plat/nvidia/tegra/soc/t186/plat_memctrl.c b/plat/nvidia/tegra/soc/t186/plat_memctrl.c
index 957ecf187..38dffb22e 100644
--- a/plat/nvidia/tegra/soc/t186/plat_memctrl.c
+++ b/plat/nvidia/tegra/soc/t186/plat_memctrl.c
@@ -4,7 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
+#include <common/bl_common.h>
+
#include <memctrl_v2.h>
/*******************************************************************************
diff --git a/plat/nvidia/tegra/soc/t186/plat_psci_handlers.c b/plat/nvidia/tegra/soc/t186/plat_psci_handlers.c
index 6eb18fa6c..fb94bcedf 100644
--- a/plat/nvidia/tegra/soc/t186/plat_psci_handlers.c
+++ b/plat/nvidia/tegra/soc/t186/plat_psci_handlers.c
@@ -4,19 +4,21 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <assert.h>
+#include <string.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <assert.h>
-#include <bl_common.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
#include <context.h>
-#include <context_mgmt.h>
-#include <debug.h>
#include <denver.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
+
#include <mce.h>
-#include <platform.h>
-#include <psci.h>
#include <smmu.h>
-#include <string.h>
#include <t18x_ari.h>
#include <tegra_private.h>
diff --git a/plat/nvidia/tegra/soc/t186/plat_secondary.c b/plat/nvidia/tegra/soc/t186/plat_secondary.c
index ebc2b46a2..4485e2733 100644
--- a/plat/nvidia/tegra/soc/t186/plat_secondary.c
+++ b/plat/nvidia/tegra/soc/t186/plat_secondary.c
@@ -4,11 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <string.h>
+
#include <arch_helpers.h>
-#include <debug.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+
#include <mce.h>
-#include <mmio.h>
-#include <string.h>
#include <tegra_def.h>
#include <tegra_private.h>
diff --git a/plat/nvidia/tegra/soc/t186/plat_setup.c b/plat/nvidia/tegra/soc/t186/plat_setup.c
index da5530f0b..15dbd1639 100644
--- a/plat/nvidia/tegra/soc/t186/plat_setup.c
+++ b/plat/nvidia/tegra/soc/t186/plat_setup.c
@@ -4,26 +4,28 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl31.h>
-#include <bl_common.h>
-#include <console.h>
+
+#include <arch_helpers.h>
+#include <bl31/bl31.h>
+#include <bl31/interrupt_mgmt.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/interrupt_props.h>
#include <context.h>
-#include <context_mgmt.h>
#include <cortex_a57.h>
-#include <debug.h>
#include <denver.h>
-#include <gic_common.h>
-#include <gicv2.h>
-#include <interrupt_mgmt.h>
-#include <interrupt_props.h>
+#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/console.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
+#include <plat/common/platform.h>
+
#include <mce.h>
-#include <platform.h>
#include <tegra_def.h>
#include <tegra_platform.h>
#include <tegra_private.h>
-#include <xlat_tables_v2.h>
DEFINE_RENAME_SYSREG_RW_FUNCS(l2ctlr_el1, CORTEX_A57_L2CTLR_EL1)
extern uint64_t tegra_enable_l2_ecc_parity_prot;
diff --git a/plat/nvidia/tegra/soc/t186/plat_sip_calls.c b/plat/nvidia/tegra/soc/t186/plat_sip_calls.c
index dfe1c7dbd..bf98fcf64 100644
--- a/plat/nvidia/tegra/soc/t186/plat_sip_calls.c
+++ b/plat/nvidia/tegra/soc/t186/plat_sip_calls.c
@@ -4,17 +4,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <assert.h>
+#include <errno.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <assert.h>
-#include <bl_common.h>
-#include <context_mgmt.h>
-#include <debug.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/runtime_svc.h>
#include <denver.h>
-#include <errno.h>
+#include <lib/el3_runtime/context_mgmt.h>
+
#include <mce.h>
#include <memctrl.h>
-#include <runtime_svc.h>
#include <t18x_ari.h>
#include <tegra_private.h>
diff --git a/plat/nvidia/tegra/soc/t186/plat_smmu.c b/plat/nvidia/tegra/soc/t186/plat_smmu.c
index ead4c22b8..19e065c18 100644
--- a/plat/nvidia/tegra/soc/t186/plat_smmu.c
+++ b/plat/nvidia/tegra/soc/t186/plat_smmu.c
@@ -4,7 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
+#include <common/bl_common.h>
+
#include <smmu.h>
#include <tegra_def.h>
diff --git a/plat/nvidia/tegra/soc/t186/plat_trampoline.S b/plat/nvidia/tegra/soc/t186/plat_trampoline.S
index 6a17c3328..69ca798f9 100644
--- a/plat/nvidia/tegra/soc/t186/plat_trampoline.S
+++ b/plat/nvidia/tegra/soc/t186/plat_trampoline.S
@@ -6,8 +6,8 @@
#include <arch.h>
#include <asm_macros.S>
-#include <common_def.h>
#include <memctrl_v2.h>
+#include <plat/common/common_def.h>
#include <tegra_def.h>
#define TEGRA186_SMMU_CTX_SIZE 0x420
diff --git a/plat/nvidia/tegra/soc/t210/plat_psci_handlers.c b/plat/nvidia/tegra/soc/t210/plat_psci_handlers.c
index f77746cae..27786d3ca 100644
--- a/plat/nvidia/tegra/soc/t210/plat_psci_handlers.c
+++ b/plat/nvidia/tegra/soc/t210/plat_psci_handlers.c
@@ -4,16 +4,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <flowctrl.h>
-#include <mmio.h>
-#include <platform.h>
+
#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
+
+#include <flowctrl.h>
#include <pmc.h>
-#include <psci.h>
#include <tegra_def.h>
#include <tegra_private.h>
diff --git a/plat/nvidia/tegra/soc/t210/plat_secondary.c b/plat/nvidia/tegra/soc/t210/plat_secondary.c
index ecb258b91..e0242cf0e 100644
--- a/plat/nvidia/tegra/soc/t210/plat_secondary.c
+++ b/plat/nvidia/tegra/soc/t210/plat_secondary.c
@@ -4,8 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+
#include <pmc.h>
#include <tegra_def.h>
diff --git a/plat/nvidia/tegra/soc/t210/plat_setup.c b/plat/nvidia/tegra/soc/t210/plat_setup.c
index c3fc7b4a5..c7f7165c0 100644
--- a/plat/nvidia/tegra/soc/t210/plat_setup.c
+++ b/plat/nvidia/tegra/soc/t210/plat_setup.c
@@ -5,11 +5,12 @@
*/
#include <arch_helpers.h>
-#include <bl_common.h>
-#include <console.h>
+#include <common/bl_common.h>
+#include <drivers/console.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
+
#include <tegra_def.h>
#include <tegra_private.h>
-#include <xlat_tables_v2.h>
/*******************************************************************************
* The Tegra power domain tree has a single system level power domain i.e. a
diff --git a/plat/qemu/dt.c b/plat/qemu/dt.c
index c544d9f44..b1cd368cb 100644
--- a/plat/qemu/dt.c
+++ b/plat/qemu/dt.c
@@ -3,11 +3,15 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <console.h>
-#include <debug.h>
-#include <libfdt.h>
-#include <psci.h>
+
#include <string.h>
+
+#include <libfdt.h>
+
+#include <common/debug.h>
+#include <drivers/console.h>
+#include <lib/psci/psci.h>
+
#include "qemu_private.h"
static int append_psci_compatible(void *fdt, int offs, const char *str)
diff --git a/plat/qemu/include/platform_def.h b/plat/qemu/include/platform_def.h
index c2289bc56..2dd10ad83 100644
--- a/plat/qemu/include/platform_def.h
+++ b/plat/qemu/include/platform_def.h
@@ -8,9 +8,9 @@
#define PLATFORM_DEF_H
#include <arch.h>
-#include <common_def.h>
-#include <tbbr_img_def.h>
-#include <utils_def.h>
+#include <common/tbbr/tbbr_img_def.h>
+#include <lib/utils_def.h>
+#include <plat/common/common_def.h>
/* Special value used to verify platform parameters from BL2 to BL3-1 */
#define QEMU_BL31_PLAT_PARAM_VAL 0x0f1e2d3c4b5a6978ULL
diff --git a/plat/qemu/qemu_bl1_setup.c b/plat/qemu/qemu_bl1_setup.c
index fd53495a6..b5821517a 100644
--- a/plat/qemu/qemu_bl1_setup.c
+++ b/plat/qemu/qemu_bl1_setup.c
@@ -4,11 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
+
#include <platform_def.h>
+
+#include <arch.h>
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+
#include "qemu_private.h"
/* Data structure which holds the extents of the trusted SRAM for BL1*/
diff --git a/plat/qemu/qemu_bl2_mem_params_desc.c b/plat/qemu/qemu_bl2_mem_params_desc.c
index 9965cfdb5..ba6a4db2d 100644
--- a/plat/qemu/qemu_bl2_mem_params_desc.c
+++ b/plat/qemu/qemu_bl2_mem_params_desc.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <desc_image_load.h>
-#include <platform.h>
#include <platform_def.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
+
/*******************************************************************************
* Following descriptor provides BL image/ep information that gets used
* by BL2 to load the images and also subset of this information is
diff --git a/plat/qemu/qemu_bl2_setup.c b/plat/qemu/qemu_bl2_setup.c
index b3c39605f..b8ca895f8 100644
--- a/plat/qemu/qemu_bl2_setup.c
+++ b/plat/qemu/qemu_bl2_setup.c
@@ -3,17 +3,22 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
+
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <desc_image_load.h>
-#include <optee_utils.h>
+#include <string.h>
+
#include <libfdt.h>
-#include <platform.h>
+
#include <platform_def.h>
-#include <string.h>
-#include <utils.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/desc_image_load.h>
+#include <lib/optee_utils.h>
+#include <lib/utils.h>
+#include <plat/common/platform.h>
+
#include "qemu_private.h"
diff --git a/plat/qemu/qemu_bl31_setup.c b/plat/qemu/qemu_bl31_setup.c
index 7542674ec..97468114a 100644
--- a/plat/qemu/qemu_bl31_setup.c
+++ b/plat/qemu/qemu_bl31_setup.c
@@ -5,11 +5,14 @@
*/
#include <assert.h>
-#include <bl_common.h>
-#include <gic_common.h>
-#include <gicv2.h>
+
#include <platform_def.h>
-#include <platform.h>
+
+#include <common/bl_common.h>
+#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gicv2.h>
+#include <plat/common/platform.h>
+
#include "qemu_private.h"
/*
diff --git a/plat/qemu/qemu_common.c b/plat/qemu/qemu_common.c
index 43a3f7012..aee8321cb 100644
--- a/plat/qemu/qemu_common.c
+++ b/plat/qemu/qemu_common.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <bl_common.h>
#include <platform_def.h>
-#include <xlat_tables_v2.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
#include "qemu_private.h"
diff --git a/plat/qemu/qemu_console.c b/plat/qemu/qemu_console.c
index a90c9a18c..759f997dc 100644
--- a/plat/qemu/qemu_console.c
+++ b/plat/qemu/qemu_console.c
@@ -3,10 +3,12 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <console.h>
-#include <pl011.h>
+
#include <platform_def.h>
+#include <drivers/console.h>
+#include <drivers/arm/pl011.h>
+
#if MULTI_CONSOLE_API
static console_pl011_t console;
#endif /* MULTI_CONSOLE_API */
diff --git a/plat/qemu/qemu_image_load.c b/plat/qemu/qemu_image_load.c
index 8e246477c..9970d1de7 100644
--- a/plat/qemu/qemu_image_load.c
+++ b/plat/qemu/qemu_image_load.c
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <desc_image_load.h>
+#include <common/desc_image_load.h>
/*******************************************************************************
* This function is a wrapper of a common function which flushes the data
diff --git a/plat/qemu/qemu_io_storage.c b/plat/qemu/qemu_io_storage.c
index 1918f21d5..0e81cd199 100644
--- a/plat/qemu/qemu_io_storage.c
+++ b/plat/qemu/qemu_io_storage.c
@@ -5,18 +5,20 @@
*/
#include <assert.h>
-#include <bl_common.h> /* For ARRAY_SIZE */
-#include <debug.h>
-#include <firmware_image_package.h>
-#include <io_driver.h>
-#include <io_fip.h>
-#include <io_memmap.h>
-#include <io_semihosting.h>
-#include <io_storage.h>
-#include <platform_def.h>
-#include <semihosting.h>
#include <string.h>
+#include <platform_def.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/io/io_driver.h>
+#include <drivers/io/io_fip.h>
+#include <drivers/io/io_memmap.h>
+#include <drivers/io/io_semihosting.h>
+#include <drivers/io/io_storage.h>
+#include <lib/semihosting.h>
+#include <tools_share/firmware_image_package.h>
+
/* Semihosting filenames */
#define BL2_IMAGE_NAME "bl2.bin"
#define BL31_IMAGE_NAME "bl31.bin"
diff --git a/plat/qemu/qemu_pm.c b/plat/qemu/qemu_pm.c
index c184f1c35..3249d6e27 100644
--- a/plat/qemu/qemu_pm.c
+++ b/plat/qemu/qemu_pm.c
@@ -4,13 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
-#include <gicv2.h>
-#include <platform.h>
+
#include <platform_def.h>
-#include <psci.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/arm/gicv2.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
/*
* The secure entry point to be used on warm reset.
diff --git a/plat/qemu/qemu_stack_protector.c b/plat/qemu/qemu_stack_protector.c
index 5b1982833..c226158ad 100644
--- a/plat/qemu/qemu_stack_protector.c
+++ b/plat/qemu/qemu_stack_protector.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <platform.h>
#include <stdint.h>
+#include <arch_helpers.h>
+#include <plat/common/platform.h>
+
#define RANDOM_CANARY_VALUE ((u_register_t) 3288484550995823360ULL)
u_register_t plat_get_stack_protector_canary(void)
diff --git a/plat/qemu/qemu_trusted_boot.c b/plat/qemu/qemu_trusted_boot.c
index 7d8fed209..17666b99e 100644
--- a/plat/qemu/qemu_trusted_boot.c
+++ b/plat/qemu/qemu_trusted_boot.c
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <platform.h>
+#include <plat/common/platform.h>
extern char qemu_rotpk_hash[], qemu_rotpk_hash_end[];
diff --git a/plat/qemu/sp_min/sp_min_setup.c b/plat/qemu/sp_min/sp_min_setup.c
index 5b98079bc..88decdf4d 100644
--- a/plat/qemu/sp_min/sp_min_setup.c
+++ b/plat/qemu/sp_min/sp_min_setup.c
@@ -4,18 +4,21 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <console.h>
-#include <debug.h>
-#include <gic_common.h>
-#include <gicv2.h>
-#include <mmio.h>
-#include <platform.h>
-#include <platform_def.h>
#include <string.h>
-#include <xlat_tables.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/console.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables.h>
+#include <plat/common/platform.h>
+
#include "../qemu_private.h"
#if RESET_TO_SP_MIN
diff --git a/plat/qemu/topology.c b/plat/qemu/topology.c
index 569d15f8c..6352706e9 100644
--- a/plat/qemu/topology.c
+++ b/plat/qemu/topology.c
@@ -4,9 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
-#include <platform_def.h>
#include <stdint.h>
+
+#include <platform_def.h>
+
+#include <arch.h>
+
#include "qemu_private.h"
/* The power domain tree descriptor */
diff --git a/plat/renesas/rcar/aarch64/plat_helpers.S b/plat/renesas/rcar/aarch64/plat_helpers.S
index 7e1ff8dda..d40f8f2e3 100644
--- a/plat/renesas/rcar/aarch64/plat_helpers.S
+++ b/plat/renesas/rcar/aarch64/plat_helpers.S
@@ -7,10 +7,11 @@
#include <arch.h>
#include <asm_macros.S>
-#include <bl_common.h>
+#include <common/bl_common.h>
+#include <common/runtime_svc.h>
#include <cortex_a57.h>
#include <platform_def.h>
-#include <runtime_svc.h>
+
#include "rcar_def.h"
.globl plat_get_my_entrypoint
diff --git a/plat/renesas/rcar/aarch64/platform_common.c b/plat/renesas/rcar/aarch64/platform_common.c
index f344b3752..647a562ce 100644
--- a/plat/renesas/rcar/aarch64/platform_common.c
+++ b/plat/renesas/rcar/aarch64/platform_common.c
@@ -5,17 +5,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <gicv2.h>
-#include <gic_common.h>
-#include <interrupt_props.h>
-#include <mmio.h>
-#include <platform.h>
-#include <platform_def.h>
-#include <xlat_tables_v2.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/arm/gic_common.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
+#include <plat/common/platform.h>
+
#include "rcar_def.h"
#include "rcar_private.h"
#include "rcar_version.h"
diff --git a/plat/renesas/rcar/bl2_cpg_init.c b/plat/renesas/rcar/bl2_cpg_init.c
index 880ad3604..883fc9a16 100644
--- a/plat/renesas/rcar/bl2_cpg_init.c
+++ b/plat/renesas/rcar/bl2_cpg_init.c
@@ -4,8 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+
#include "rcar_def.h"
#include "cpg_registers.h"
#include "rcar_private.h"
diff --git a/plat/renesas/rcar/bl2_interrupt_error.c b/plat/renesas/rcar/bl2_interrupt_error.c
index c50c60376..2346017d8 100644
--- a/plat/renesas/rcar/bl2_interrupt_error.c
+++ b/plat/renesas/rcar/bl2_interrupt_error.c
@@ -5,11 +5,12 @@
*/
#include <arch_helpers.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <gicv2.h>
-#include <mmio.h>
-#include <runtime_svc.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <drivers/arm/gicv2.h>
+#include <lib/mmio.h>
+
#include "rcar_def.h"
#define SWDT_ERROR_ID (1024U)
diff --git a/plat/renesas/rcar/bl2_plat_mem_params_desc.c b/plat/renesas/rcar/bl2_plat_mem_params_desc.c
index 3dc9eff59..3b124c789 100644
--- a/plat/renesas/rcar/bl2_plat_mem_params_desc.c
+++ b/plat/renesas/rcar/bl2_plat_mem_params_desc.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
#include <platform_def.h>
-#include <xlat_tables_defs.h>
+
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <lib/xlat_tables/xlat_tables_defs.h>
+#include <plat/common/platform.h>
#if (RCAR_BL33_EXECUTION_EL != 0) && (RCAR_BL33_EXECUTION_EL != 1)
#error
diff --git a/plat/renesas/rcar/bl2_plat_setup.c b/plat/renesas/rcar/bl2_plat_setup.c
index 7567813ca..77a5ed170 100644
--- a/plat/renesas/rcar/bl2_plat_setup.c
+++ b/plat/renesas/rcar/bl2_plat_setup.c
@@ -4,18 +4,21 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <desc_image_load.h>
-#include <arch_helpers.h>
-#include <bl_common.h>
-#include <bl1.h>
-#include <console.h>
-#include <debug.h>
+#include <string.h>
+
#include <libfdt.h>
-#include <mmio.h>
-#include <platform.h>
+
#include <platform_def.h>
-#include <string.h>
-#include <xlat_tables_defs.h>
+
+#include <arch_helpers.h>
+#include <bl1/bl1.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/desc_image_load.h>
+#include <drivers/console.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables_defs.h>
+#include <plat/common/platform.h>
#include "avs_driver.h"
#include "boot_init_dram.h"
diff --git a/plat/renesas/rcar/bl2_secure_setting.c b/plat/renesas/rcar/bl2_secure_setting.c
index c0d49debc..cbda1eb38 100644
--- a/plat/renesas/rcar/bl2_secure_setting.c
+++ b/plat/renesas/rcar/bl2_secure_setting.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <lib/mmio.h>
+#include <lib/utils_def.h>
+
#include "axi_registers.h"
#include "lifec_registers.h"
#include "micro_delay.h"
-#include "mmio.h"
-#include "utils_def.h"
static void lifec_security_setting(void);
static void axi_security_setting(void);
diff --git a/plat/renesas/rcar/bl31_plat_setup.c b/plat/renesas/rcar/bl31_plat_setup.c
index 00f6d100b..6f31417ba 100644
--- a/plat/renesas/rcar/bl31_plat_setup.c
+++ b/plat/renesas/rcar/bl31_plat_setup.c
@@ -5,16 +5,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <stddef.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <bl_common.h>
-#include <bl31.h>
-#include <cci.h>
-#include <console.h>
-#include <mmio.h>
-#include <platform.h>
-#include <stddef.h>
-#include <debug.h>
+#include <bl31/bl31.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/console.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include "pwrc.h"
#include "rcar_def.h"
#include "rcar_private.h"
diff --git a/plat/renesas/rcar/include/plat.ld.S b/plat/renesas/rcar/include/plat.ld.S
index 0461141fd..7aef324c4 100644
--- a/plat/renesas/rcar/include/plat.ld.S
+++ b/plat/renesas/rcar/include/plat.ld.S
@@ -6,8 +6,8 @@
#ifndef RCAR_PLAT_LD_S
#define RCAR_PLAT_LD_S
+#include <lib/xlat_tables/xlat_tables_defs.h>
#include <platform_def.h>
-#include <xlat_tables_defs.h>
MEMORY {
SRAM (rwx): ORIGIN = BL31_SRAM_BASE, LENGTH = DEVICE_SRAM_SIZE
diff --git a/plat/renesas/rcar/include/plat_macros.S b/plat/renesas/rcar/include/plat_macros.S
index eb109287c..927cd39e8 100644
--- a/plat/renesas/rcar/include/plat_macros.S
+++ b/plat/renesas/rcar/include/plat_macros.S
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <cci.h>
-#include <gic_common.h>
-#include <gicv2.h>
+#include <drivers/arm/cci.h>
+#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gicv2.h>
+
#include "rcar_def.h"
.section .rodata.gic_reg_name, "aS"
diff --git a/plat/renesas/rcar/include/platform_def.h b/plat/renesas/rcar/include/platform_def.h
index fa6e474c4..20fd71230 100644
--- a/plat/renesas/rcar/include/platform_def.h
+++ b/plat/renesas/rcar/include/platform_def.h
@@ -7,10 +7,12 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
-#include <arch.h>
#ifndef __ASSEMBLY__
#include <stdlib.h>
#endif
+
+#include <arch.h>
+
#include "rcar_def.h"
/*******************************************************************************
diff --git a/plat/renesas/rcar/include/rcar_def.h b/plat/renesas/rcar/include/rcar_def.h
index 61b95a436..242e007b5 100644
--- a/plat/renesas/rcar/include/rcar_def.h
+++ b/plat/renesas/rcar/include/rcar_def.h
@@ -7,8 +7,8 @@
#ifndef RCAR_DEF_H
#define RCAR_DEF_H
-#include <tbbr_img_def.h>
-#include <utils_def.h>
+#include <common/tbbr/tbbr_img_def.h>
+#include <lib/utils_def.h>
#define RCAR_PRIMARY_CPU 0x0
#define RCAR_TRUSTED_SRAM_BASE 0x44000000
diff --git a/plat/renesas/rcar/include/rcar_private.h b/plat/renesas/rcar/include/rcar_private.h
index e90fa08ad..def327605 100644
--- a/plat/renesas/rcar/include/rcar_private.h
+++ b/plat/renesas/rcar/include/rcar_private.h
@@ -7,11 +7,12 @@
#ifndef RCAR_PRIVATE_H
#define RCAR_PRIVATE_H
-#include <bakery_lock.h>
-#include <bl_common.h>
-#include <cpu_data.h>
#include <platform_def.h>
+#include <common/bl_common.h>
+#include <lib/bakery_lock.h>
+#include <lib/el3_runtime/cpu_data.h>
+
typedef volatile struct mailbox {
unsigned long value __aligned(CACHE_WRITEBACK_GRANULE);
} mailbox_t;
diff --git a/plat/renesas/rcar/plat_image_load.c b/plat/renesas/rcar/plat_image_load.c
index 469ac29c5..9d814a6e5 100644
--- a/plat/renesas/rcar/plat_image_load.c
+++ b/plat/renesas/rcar/plat_image_load.c
@@ -4,9 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
extern void bl2_plat_flush_bl31_params(void);
diff --git a/plat/renesas/rcar/plat_pm.c b/plat/renesas/rcar/plat_pm.c
index 84cc47e0d..7086613f8 100644
--- a/plat/renesas/rcar/plat_pm.c
+++ b/plat/renesas/rcar/plat_pm.c
@@ -4,17 +4,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <bakery_lock.h>
-#include <bl_common.h>
-#include <cci.h>
-#include <debug.h>
#include <errno.h>
-#include <gicv2.h>
-#include <mmio.h>
-#include <platform.h>
+
#include <platform_def.h>
-#include <psci.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/arm/gicv2.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
#include "iic_dvfs.h"
#include "pwrc.h"
diff --git a/plat/renesas/rcar/plat_storage.c b/plat/renesas/rcar/plat_storage.c
index 3b5d620dd..05e3d9f0d 100644
--- a/plat/renesas/rcar/plat_storage.c
+++ b/plat/renesas/rcar/plat_storage.c
@@ -4,12 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <io_driver.h>
-#include <io_storage.h>
-#include <io_semihosting.h>
-#include <platform_def.h>
#include <string.h>
+
+#include <platform_def.h>
+
+#include <common/debug.h>
+#include <drivers/io/io_driver.h>
+#include <drivers/io/io_storage.h>
+#include <drivers/io/io_semihosting.h>
+
#include "io_common.h"
#include "io_rcar.h"
#include "io_memdrv.h"
diff --git a/plat/renesas/rcar/plat_topology.c b/plat/renesas/rcar/plat_topology.c
index 3582c2bde..0d5880d7a 100644
--- a/plat/renesas/rcar/plat_topology.c
+++ b/plat/renesas/rcar/plat_topology.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
#include <platform_def.h>
-#include <psci.h>
+
+#include <common/debug.h>
+#include <lib/psci/psci.h>
static const unsigned char rcar_power_domain_tree_desc[] = {
1,
diff --git a/plat/rockchip/common/aarch64/plat_helpers.S b/plat/rockchip/common/aarch64/plat_helpers.S
index f0136b0d9..4af052b57 100644
--- a/plat/rockchip/common/aarch64/plat_helpers.S
+++ b/plat/rockchip/common/aarch64/plat_helpers.S
@@ -4,13 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include <arch.h>
#include <asm_macros.S>
-#include <bl_common.h>
+#include <common/bl_common.h>
#include <cortex_a53.h>
#include <cortex_a72.h>
#include <plat_private.h>
-#include <platform_def.h>
#include <plat_pmu_macros.S>
.globl cpuson_entry_point
diff --git a/plat/rockchip/common/aarch64/platform_common.c b/plat/rockchip/common/aarch64/platform_common.c
index 9a74314c9..81e852062 100644
--- a/plat/rockchip/common/aarch64/platform_common.c
+++ b/plat/rockchip/common/aarch64/platform_common.c
@@ -4,15 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <string.h>
+
+#include <platform_def.h>
+
#include <arch_helpers.h>
-#include <bl_common.h>
-#include <cci.h>
-#include <debug.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <lib/utils.h>
+#include <lib/xlat_tables/xlat_tables.h>
+
#include <plat_private.h>
-#include <platform_def.h>
-#include <string.h>
-#include <utils.h>
-#include <xlat_tables.h>
#ifdef PLAT_RK_CCI_BASE
static const int cci_map[] = {
diff --git a/plat/rockchip/common/bl31_plat_setup.c b/plat/rockchip/common/bl31_plat_setup.c
index 7a9f7a9d1..2c970eb8a 100644
--- a/plat/rockchip/common/bl31_plat_setup.c
+++ b/plat/rockchip/common/bl31_plat_setup.c
@@ -5,16 +5,18 @@
*/
#include <assert.h>
-#include <bl_common.h>
-#include <console.h>
-#include <coreboot.h>
-#include <debug.h>
-#include <generic_delay_timer.h>
-#include <mmio.h>
-#include <plat_private.h>
-#include <platform.h>
+
#include <platform_def.h>
-#include <uart_16550.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+#include <drivers/generic_delay_timer.h>
+#include <drivers/ti/uart/uart_16550.h>
+#include <lib/coreboot.h>
+#include <lib/mmio.h>
+#include <plat_private.h>
+#include <plat/common/platform.h>
/*
* The next 2 constants identify the extents of the code & RO data region.
diff --git a/plat/rockchip/common/drivers/parameter/ddr_parameter.c b/plat/rockchip/common/drivers/parameter/ddr_parameter.c
index ea77757f7..e89fe1e02 100644
--- a/plat/rockchip/common/drivers/parameter/ddr_parameter.c
+++ b/plat/rockchip/common/drivers/parameter/ddr_parameter.c
@@ -4,15 +4,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <string.h>
+
+#include <platform_def.h>
+
#include <arch_helpers.h>
-#include <console.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <plat_private.h>
-#include <platform_def.h>
#include <soc.h>
-#include <string.h>
+
#include "ddr_parameter.h"
/*
diff --git a/plat/rockchip/common/drivers/parameter/ddr_parameter.h b/plat/rockchip/common/drivers/parameter/ddr_parameter.h
index 69c4e18bd..61349c44c 100644
--- a/plat/rockchip/common/drivers/parameter/ddr_parameter.h
+++ b/plat/rockchip/common/drivers/parameter/ddr_parameter.h
@@ -7,15 +7,18 @@
#ifndef DDR_PARAMETER_H
#define DDR_PARAMETER_H
+#include <string.h>
+
+#include <platform_def.h>
+
#include <arch_helpers.h>
-#include <console.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <plat_private.h>
-#include <platform_def.h>
#include <soc.h>
-#include <string.h>
#define DDR_REGION_NR_MAX 10
#define REGION_NR_OFFSET 0
diff --git a/plat/rockchip/common/include/plat_macros.S b/plat/rockchip/common/include/plat_macros.S
index 9ee4e83e1..691beeb44 100644
--- a/plat/rockchip/common/include/plat_macros.S
+++ b/plat/rockchip/common/include/plat_macros.S
@@ -6,10 +6,10 @@
#ifndef ROCKCHIP_PLAT_MACROS_S
#define ROCKCHIP_PLAT_MACROS_S
-#include <cci.h>
-#include <gic_common.h>
-#include <gicv2.h>
-#include <gicv3.h>
+#include <drivers/arm/cci.h>
+#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/arm/gicv3.h>
#include <platform_def.h>
.section .rodata.gic_reg_name, "aS"
diff --git a/plat/rockchip/common/include/plat_private.h b/plat/rockchip/common/include/plat_private.h
index 955ca647c..e8750a5e9 100644
--- a/plat/rockchip/common/include/plat_private.h
+++ b/plat/rockchip/common/include/plat_private.h
@@ -8,10 +8,12 @@
#define PLAT_PRIVATE_H
#ifndef __ASSEMBLY__
-#include <mmio.h>
-#include <psci.h>
+
#include <stdint.h>
-#include <xlat_tables.h>
+
+#include <lib/psci/psci.h>
+#include <lib/xlat_tables/xlat_tables.h>
+#include <lib/mmio.h>
#define __sramdata __attribute__((section(".sram.data")))
#define __sramconst __attribute__((section(".sram.rodata")))
diff --git a/plat/rockchip/common/params_setup.c b/plat/rockchip/common/params_setup.c
index a7ba83e5a..3d1b40b3f 100644
--- a/plat/rockchip/common/params_setup.c
+++ b/plat/rockchip/common/params_setup.c
@@ -5,16 +5,18 @@
*/
#include <assert.h>
-#include <bl_common.h>
-#include <console.h>
-#include <coreboot.h>
-#include <debug.h>
-#include <gpio.h>
-#include <mmio.h>
+#include <string.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+#include <drivers/gpio.h>
+#include <lib/coreboot.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include <plat_params.h>
#include <plat_private.h>
-#include <platform.h>
-#include <string.h>
static struct gpio_info param_reset;
static struct gpio_info param_poweroff;
diff --git a/plat/rockchip/common/plat_pm.c b/plat/rockchip/common/plat_pm.c
index 352dbc842..c9563c9ed 100644
--- a/plat/rockchip/common/plat_pm.c
+++ b/plat/rockchip/common/plat_pm.c
@@ -4,15 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <console.h>
-#include <debug.h>
-#include <delay_timer.h>
#include <errno.h>
-#include <plat_private.h>
+
#include <platform_def.h>
-#include <psci.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+#include <drivers/delay_timer.h>
+#include <lib/psci/psci.h>
+
+#include <plat_private.h>
/* Macros to read the rk power domain state */
#define RK_CORE_PWR_STATE(state) \
diff --git a/plat/rockchip/common/plat_topology.c b/plat/rockchip/common/plat_topology.c
index 49d063cf5..a31e4103e 100644
--- a/plat/rockchip/common/plat_topology.c
+++ b/plat/rockchip/common/plat_topology.c
@@ -4,10 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include <arch.h>
+#include <lib/psci/psci.h>
+
#include <plat_private.h>
-#include <platform_def.h>
-#include <psci.h>
/*******************************************************************************
* This function returns the RockChip default topology tree information.
diff --git a/plat/rockchip/common/rockchip_gicv2.c b/plat/rockchip/common/rockchip_gicv2.c
index 4705042ba..222a88261 100644
--- a/plat/rockchip/common/rockchip_gicv2.c
+++ b/plat/rockchip/common/rockchip_gicv2.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <gicv2.h>
-#include <interrupt_props.h>
#include <platform_def.h>
-#include <utils.h>
+
+#include <common/bl_common.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gicv2.h>
+#include <lib/utils.h>
/******************************************************************************
* The following functions are defined as weak to allow a platform to override
diff --git a/plat/rockchip/common/rockchip_gicv3.c b/plat/rockchip/common/rockchip_gicv3.c
index efbf1d167..edae2efd0 100644
--- a/plat/rockchip/common/rockchip_gicv3.c
+++ b/plat/rockchip/common/rockchip_gicv3.c
@@ -4,12 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <gicv3.h>
-#include <interrupt_props.h>
-#include <platform.h>
#include <platform_def.h>
-#include <utils.h>
+
+#include <common/bl_common.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gicv3.h>
+#include <lib/utils.h>
+#include <plat/common/platform.h>
/******************************************************************************
* The following functions are defined as weak to allow a platform to override
diff --git a/plat/rockchip/common/rockchip_sip_svc.c b/plat/rockchip/common/rockchip_sip_svc.c
index d690e92fc..27ef042c3 100644
--- a/plat/rockchip/common/rockchip_sip_svc.c
+++ b/plat/rockchip/common/rockchip_sip_svc.c
@@ -5,12 +5,14 @@
*/
#include <assert.h>
-#include <debug.h>
-#include <mmio.h>
+
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <lib/mmio.h>
+#include <tools_share/uuid.h>
+
#include <plat_sip_calls.h>
#include <rockchip_sip_svc.h>
-#include <runtime_svc.h>
-#include <uuid.h>
/* Rockchip SiP Service UUID */
DEFINE_SVC_UUID2(rk_sip_svc_uid,
diff --git a/plat/rockchip/rk3328/drivers/pmu/pmu.c b/plat/rockchip/rk3328/drivers/pmu/pmu.c
index 835c3a6b6..c215ee240 100644
--- a/plat/rockchip/rk3328/drivers/pmu/pmu.c
+++ b/plat/rockchip/rk3328/drivers/pmu/pmu.c
@@ -4,18 +4,21 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bakery_lock.h>
-#include <bl31.h>
-#include <console.h>
-#include <debug.h>
-#include <delay_timer.h>
#include <errno.h>
-#include <mmio.h>
-#include <plat_private.h>
-#include <platform.h>
+
#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <bl31/bl31.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+#include <drivers/delay_timer.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
+#include <plat_private.h>
#include <pmu.h>
#include <pmu_com.h>
#include <rk3328_def.h>
diff --git a/plat/rockchip/rk3328/drivers/soc/soc.c b/plat/rockchip/rk3328/drivers/soc/soc.c
index ce344d66d..d216020c5 100644
--- a/plat/rockchip/rk3328/drivers/soc/soc.c
+++ b/plat/rockchip/rk3328/drivers/soc/soc.c
@@ -4,14 +4,16 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include <arch_helpers.h>
-#include <console.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <ddr_parameter.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <mmio.h>
#include <plat_private.h>
-#include <platform_def.h>
#include <rk3328_def.h>
#include <soc.h>
diff --git a/plat/rockchip/rk3328/include/platform_def.h b/plat/rockchip/rk3328/include/platform_def.h
index 9b20b41d3..b62c86869 100644
--- a/plat/rockchip/rk3328/include/platform_def.h
+++ b/plat/rockchip/rk3328/include/platform_def.h
@@ -8,7 +8,8 @@
#define PLATFORM_DEF_H
#include <arch.h>
-#include <common_def.h>
+#include <plat/common/common_def.h>
+
#include <rk3328_def.h>
/*******************************************************************************
diff --git a/plat/rockchip/rk3368/drivers/ddr/ddr_rk3368.c b/plat/rockchip/rk3368/drivers/ddr/ddr_rk3368.c
index 1c33763f3..84d265476 100644
--- a/plat/rockchip/rk3368/drivers/ddr/ddr_rk3368.c
+++ b/plat/rockchip/rk3368/drivers/ddr/ddr_rk3368.c
@@ -4,15 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <mmio.h>
-#include <ddr_rk3368.h>
-#include <debug.h>
+#include <stdint.h>
+#include <string.h>
+
#include <platform_def.h>
+
+#include <common/debug.h>
+#include <lib/mmio.h>
+
+#include <ddr_rk3368.h>
#include <pmu.h>
#include <rk3368_def.h>
#include <soc.h>
-#include <stdint.h>
-#include <string.h>
/* GRF_SOC_STATUS0 */
#define DPLL_LOCK (0x1 << 2)
diff --git a/plat/rockchip/rk3368/drivers/pmu/pmu.c b/plat/rockchip/rk3368/drivers/pmu/pmu.c
index cb323e6ee..e277a18ba 100644
--- a/plat/rockchip/rk3368/drivers/pmu/pmu.c
+++ b/plat/rockchip/rk3368/drivers/pmu/pmu.c
@@ -4,16 +4,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <ddr_rk3368.h>
-#include <debug.h>
-#include <delay_timer.h>
#include <errno.h>
-#include <mmio.h>
-#include <plat_private.h>
-#include <platform.h>
+
#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
+#include <ddr_rk3368.h>
+#include <plat_private.h>
#include <pmu.h>
#include <pmu_com.h>
#include <rk3368_def.h>
diff --git a/plat/rockchip/rk3368/drivers/soc/soc.c b/plat/rockchip/rk3368/drivers/soc/soc.c
index d6979a844..0c3455418 100644
--- a/plat/rockchip/rk3368/drivers/soc/soc.c
+++ b/plat/rockchip/rk3368/drivers/soc/soc.c
@@ -4,11 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include <arch_helpers.h>
-#include <debug.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+
#include <plat_private.h>
-#include <platform_def.h>
#include <rk3368_def.h>
#include <soc.h>
diff --git a/plat/rockchip/rk3368/include/platform_def.h b/plat/rockchip/rk3368/include/platform_def.h
index 4083938ef..815650fd3 100644
--- a/plat/rockchip/rk3368/include/platform_def.h
+++ b/plat/rockchip/rk3368/include/platform_def.h
@@ -8,9 +8,10 @@
#define PLATFORM_DEF_H
#include <arch.h>
-#include <common_def.h>
+#include <lib/utils_def.h>
+#include <plat/common/common_def.h>
+
#include <rk3368_def.h>
-#include <utils_def.h>
/*******************************************************************************
* Platform binary types for linking
diff --git a/plat/rockchip/rk3368/plat_sip_calls.c b/plat/rockchip/rk3368/plat_sip_calls.c
index c0f43dbfc..5918d58ce 100644
--- a/plat/rockchip/rk3368/plat_sip_calls.c
+++ b/plat/rockchip/rk3368/plat_sip_calls.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <lib/mmio.h>
+
#include <plat_sip_calls.h>
#include <rockchip_sip_svc.h>
-#include <runtime_svc.h>
uintptr_t rockchip_plat_sip_handler(uint32_t smc_fid,
u_register_t x1,
diff --git a/plat/rockchip/rk3399/drivers/dp/cdn_dp.c b/plat/rockchip/rk3399/drivers/dp/cdn_dp.c
index 73a75bb7c..aa71fdea6 100644
--- a/plat/rockchip/rk3399/drivers/dp/cdn_dp.c
+++ b/plat/rockchip/rk3399/drivers/dp/cdn_dp.c
@@ -6,11 +6,13 @@
#include <assert.h>
#include <cdefs.h>
-#include <cdn_dp.h>
-#include <smccc.h>
#include <stdlib.h>
#include <string.h>
+#include <lib/smccc.h>
+
+#include <cdn_dp.h>
+
__asm__(
".pushsection .text.hdcp_handler, \"ax\", %progbits\n"
".global hdcp_handler\n"
diff --git a/plat/rockchip/rk3399/drivers/dram/dfs.c b/plat/rockchip/rk3399/drivers/dram/dfs.c
index e6d39a1dd..45fd9240e 100644
--- a/plat/rockchip/rk3399/drivers/dram/dfs.c
+++ b/plat/rockchip/rk3399/drivers/dram/dfs.c
@@ -5,10 +5,11 @@
*/
#include <arch_helpers.h>
-#include <debug.h>
-#include <delay_timer.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <m0_ctl.h>
-#include <mmio.h>
#include <plat_private.h>
#include "dfs.h"
#include "dram.h"
diff --git a/plat/rockchip/rk3399/drivers/dram/dram.h b/plat/rockchip/rk3399/drivers/dram/dram.h
index ded511e02..0eb12cf29 100644
--- a/plat/rockchip/rk3399/drivers/dram/dram.h
+++ b/plat/rockchip/rk3399/drivers/dram/dram.h
@@ -7,9 +7,10 @@
#ifndef DRAM_H
#define DRAM_H
+#include <stdint.h>
+
#include <dram_regs.h>
#include <plat_private.h>
-#include <stdint.h>
enum {
DDR3 = 3,
diff --git a/plat/rockchip/rk3399/drivers/dram/dram_spec_timing.c b/plat/rockchip/rk3399/drivers/dram/dram_spec_timing.c
index 3527f0e5e..3cdb7a296 100644
--- a/plat/rockchip/rk3399/drivers/dram/dram_spec_timing.c
+++ b/plat/rockchip/rk3399/drivers/dram/dram_spec_timing.c
@@ -4,10 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <dram.h>
#include <stdint.h>
#include <string.h>
-#include <utils.h>
+
+#include <lib/utils.h>
+
+#include <dram.h>
+
#include "dram_spec_timing.h"
static const uint8_t ddr3_cl_cwl[][7] = {
diff --git a/plat/rockchip/rk3399/drivers/dram/suspend.c b/plat/rockchip/rk3399/drivers/dram/suspend.c
index dd97581db..8bc66e1bc 100644
--- a/plat/rockchip/rk3399/drivers/dram/suspend.c
+++ b/plat/rockchip/rk3399/drivers/dram/suspend.c
@@ -4,11 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include <arch_helpers.h>
-#include <debug.h>
+#include <common/debug.h>
+
#include <dram.h>
#include <plat_private.h>
-#include <platform_def.h>
#include <pmu.h>
#include <pmu_bits.h>
#include <pmu_regs.h>
diff --git a/plat/rockchip/rk3399/drivers/gpio/rk3399_gpio.c b/plat/rockchip/rk3399/drivers/gpio/rk3399_gpio.c
index e74c4d91a..b8cba6dd9 100644
--- a/plat/rockchip/rk3399/drivers/gpio/rk3399_gpio.c
+++ b/plat/rockchip/rk3399/drivers/gpio/rk3399_gpio.c
@@ -3,15 +3,19 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <assert.h>
-#include <debug.h>
-#include <delay_timer.h>
#include <errno.h>
-#include <gpio.h>
-#include <mmio.h>
-#include <plat_private.h>
-#include <platform.h>
+
#include <platform_def.h>
+
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <drivers/gpio.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
+#include <plat_private.h>
#include <soc.h>
uint32_t gpio_port[] = {
diff --git a/plat/rockchip/rk3399/drivers/pmu/m0_ctl.c b/plat/rockchip/rk3399/drivers/pmu/m0_ctl.c
index 3f258b789..d919fa1d2 100644
--- a/plat/rockchip/rk3399/drivers/pmu/m0_ctl.c
+++ b/plat/rockchip/rk3399/drivers/pmu/m0_ctl.c
@@ -4,12 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
-#include <delay_timer.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <m0_ctl.h>
-#include <mmio.h>
#include <plat_private.h>
#include <rk3399_def.h>
#include <secure.h>
diff --git a/plat/rockchip/rk3399/drivers/pmu/pmu.c b/plat/rockchip/rk3399/drivers/pmu/pmu.c
index 04446d606..42589b9b9 100644
--- a/plat/rockchip/rk3399/drivers/pmu/pmu.c
+++ b/plat/rockchip/rk3399/drivers/pmu/pmu.c
@@ -4,29 +4,32 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bakery_lock.h>
-#include <bl31.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <dfs.h>
#include <errno.h>
-#include <gicv3.h>
-#include <gpio.h>
+#include <string.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <bl31/bl31.h>
+#include <common/debug.h>
+#include <drivers/arm/gicv3.h>
+#include <drivers/delay_timer.h>
+#include <drivers/gpio.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
+#include <dfs.h>
#include <m0_ctl.h>
-#include <mmio.h>
#include <plat_params.h>
#include <plat_private.h>
-#include <platform.h>
-#include <platform_def.h>
#include <pmu.h>
#include <pmu_com.h>
#include <pwm.h>
#include <rk3399_def.h>
#include <secure.h>
#include <soc.h>
-#include <string.h>
#include <suspend.h>
DEFINE_BAKERY_LOCK(rockchip_pd_lock);
diff --git a/plat/rockchip/rk3399/drivers/secure/secure.c b/plat/rockchip/rk3399/drivers/secure/secure.c
index 1937b1380..8286f17c6 100644
--- a/plat/rockchip/rk3399/drivers/secure/secure.c
+++ b/plat/rockchip/rk3399/drivers/secure/secure.c
@@ -4,10 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
-#include <delay_timer.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+
#include <plat_private.h>
#include <secure.h>
#include <soc.h>
diff --git a/plat/rockchip/rk3399/drivers/soc/soc.c b/plat/rockchip/rk3399/drivers/soc/soc.c
index 741adde66..c877dbde8 100644
--- a/plat/rockchip/rk3399/drivers/soc/soc.c
+++ b/plat/rockchip/rk3399/drivers/soc/soc.c
@@ -4,16 +4,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
-#include <delay_timer.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <dfs.h>
#include <dram.h>
#include <m0_ctl.h>
-#include <mmio.h>
#include <plat_private.h>
-#include <platform_def.h>
#include <rk3399_def.h>
#include <secure.h>
#include <soc.h>
diff --git a/plat/rockchip/rk3399/drivers/soc/soc.h b/plat/rockchip/rk3399/drivers/soc/soc.h
index 1f7ec07f0..853933715 100644
--- a/plat/rockchip/rk3399/drivers/soc/soc.h
+++ b/plat/rockchip/rk3399/drivers/soc/soc.h
@@ -7,7 +7,7 @@
#ifndef SOC_H
#define SOC_H
-#include <utils.h>
+#include <lib/utils.h>
#define GLB_SRST_FST_CFG_VAL 0xfdb9
#define GLB_SRST_SND_CFG_VAL 0xeca8
diff --git a/plat/rockchip/rk3399/include/plat.ld.S b/plat/rockchip/rk3399/include/plat.ld.S
index 5045ba8c2..cfa912f72 100644
--- a/plat/rockchip/rk3399/include/plat.ld.S
+++ b/plat/rockchip/rk3399/include/plat.ld.S
@@ -6,7 +6,7 @@
#ifndef ROCKCHIP_PLAT_LD_S
#define ROCKCHIP_PLAT_LD_S
-#include <xlat_tables_defs.h>
+#include <lib/xlat_tables/xlat_tables_defs.h>
MEMORY {
SRAM (rwx): ORIGIN = SRAM_BASE, LENGTH = SRAM_SIZE
diff --git a/plat/rockchip/rk3399/include/platform_def.h b/plat/rockchip/rk3399/include/platform_def.h
index cb798fbcb..2861a7dd4 100644
--- a/plat/rockchip/rk3399/include/platform_def.h
+++ b/plat/rockchip/rk3399/include/platform_def.h
@@ -8,10 +8,11 @@
#define PLATFORM_DEF_H
#include <arch.h>
+#include <lib/utils_def.h>
+#include <plat/common/common_def.h>
+
#include <bl31_param.h>
-#include <common_def.h>
#include <rk3399_def.h>
-#include <utils_def.h>
/*******************************************************************************
* Platform binary types for linking
diff --git a/plat/rockchip/rk3399/plat_sip_calls.c b/plat/rockchip/rk3399/plat_sip_calls.c
index 3f0f619f2..c2cc5b11c 100644
--- a/plat/rockchip/rk3399/plat_sip_calls.c
+++ b/plat/rockchip/rk3399/plat_sip_calls.c
@@ -4,13 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <lib/mmio.h>
+
#include <cdn_dp.h>
-#include <debug.h>
#include <dfs.h>
-#include <mmio.h>
#include <plat_sip_calls.h>
#include <rockchip_sip_svc.h>
-#include <runtime_svc.h>
#define RK_SIP_DDR_CFG 0x82000008
#define DRAM_INIT 0x00
diff --git a/plat/rpi3/aarch64/rpi3_bl2_mem_params_desc.c b/plat/rpi3/aarch64/rpi3_bl2_mem_params_desc.c
index 6a3c1d604..715aec410 100644
--- a/plat/rpi3/aarch64/rpi3_bl2_mem_params_desc.c
+++ b/plat/rpi3/aarch64/rpi3_bl2_mem_params_desc.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
#include <platform_def.h>
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
+
/*******************************************************************************
* Following descriptor provides BL image/ep information that gets used
* by BL2 to load the images and also subset of this information is
diff --git a/plat/rpi3/include/platform_def.h b/plat/rpi3/include/platform_def.h
index 3b12c30d6..69ebdb372 100644
--- a/plat/rpi3/include/platform_def.h
+++ b/plat/rpi3/include/platform_def.h
@@ -8,9 +8,9 @@
#define PLATFORM_DEF_H
#include <arch.h>
-#include <common_def.h>
-#include <tbbr_img_def.h>
-#include <utils_def.h>
+#include <common/tbbr/tbbr_img_def.h>
+#include <lib/utils_def.h>
+#include <plat/common/common_def.h>
#include "../rpi3_hw.h"
diff --git a/plat/rpi3/rpi3_bl1_setup.c b/plat/rpi3/rpi3_bl1_setup.c
index 39bb33256..ea4215d83 100644
--- a/plat/rpi3/rpi3_bl1_setup.c
+++ b/plat/rpi3/rpi3_bl1_setup.c
@@ -4,13 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <platform_def.h>
-#include <xlat_mmu_helpers.h>
-#include <xlat_tables_defs.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <lib/xlat_tables/xlat_mmu_helpers.h>
+#include <lib/xlat_tables/xlat_tables_defs.h>
#include "../../bl1/bl1_private.h"
#include "rpi3_private.h"
diff --git a/plat/rpi3/rpi3_bl2_setup.c b/plat/rpi3/rpi3_bl2_setup.c
index c78024eaa..53a2c72b8 100644
--- a/plat/rpi3/rpi3_bl2_setup.c
+++ b/plat/rpi3/rpi3_bl2_setup.c
@@ -4,15 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <desc_image_load.h>
-#include <optee_utils.h>
+
#include <platform_def.h>
-#include <xlat_mmu_helpers.h>
-#include <xlat_tables_defs.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/desc_image_load.h>
+#include <lib/optee_utils.h>
+#include <lib/xlat_tables/xlat_mmu_helpers.h>
+#include <lib/xlat_tables/xlat_tables_defs.h>
#include "rpi3_private.h"
diff --git a/plat/rpi3/rpi3_bl31_setup.c b/plat/rpi3/rpi3_bl31_setup.c
index 483d150f0..af7f806cd 100644
--- a/plat/rpi3/rpi3_bl31_setup.c
+++ b/plat/rpi3/rpi3_bl31_setup.c
@@ -5,12 +5,15 @@
*/
#include <assert.h>
-#include <bl_common.h>
+
#include <libfdt.h>
-#include <platform.h>
+
#include <platform_def.h>
-#include <xlat_mmu_helpers.h>
-#include <xlat_tables_defs.h>
+
+#include <common/bl_common.h>
+#include <lib/xlat_tables/xlat_mmu_helpers.h>
+#include <lib/xlat_tables/xlat_tables_defs.h>
+#include <plat/common/platform.h>
#include "rpi3_private.h"
diff --git a/plat/rpi3/rpi3_common.c b/plat/rpi3/rpi3_common.c
index c7e8b3a75..9b10974ad 100644
--- a/plat/rpi3/rpi3_common.c
+++ b/plat/rpi3/rpi3_common.c
@@ -4,15 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <console.h>
-#include <debug.h>
-#include <interrupt_mgmt.h>
+
#include <platform_def.h>
-#include <uart_16550.h>
-#include <xlat_tables_v2.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <bl31/interrupt_mgmt.h>
+#include <drivers/console.h>
+#include <drivers/ti/uart/uart_16550.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
#include "rpi3_hw.h"
#include "rpi3_private.h"
diff --git a/plat/rpi3/rpi3_hw.h b/plat/rpi3/rpi3_hw.h
index 822644cd3..9d86eb880 100644
--- a/plat/rpi3/rpi3_hw.h
+++ b/plat/rpi3/rpi3_hw.h
@@ -7,7 +7,7 @@
#ifndef RPI3_HW_H
#define RPI3_HW_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
/*
* Peripherals
diff --git a/plat/rpi3/rpi3_image_load.c b/plat/rpi3/rpi3_image_load.c
index fad9e4f34..5394c6f7c 100644
--- a/plat/rpi3/rpi3_image_load.c
+++ b/plat/rpi3/rpi3_image_load.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
#include <platform_def.h>
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
+
/*******************************************************************************
* This function flushes the data structures so that they are visible
* in memory for the next BL image.
diff --git a/plat/rpi3/rpi3_io_storage.c b/plat/rpi3/rpi3_io_storage.c
index cafcf6dd5..7e66deb72 100644
--- a/plat/rpi3/rpi3_io_storage.c
+++ b/plat/rpi3/rpi3_io_storage.c
@@ -5,15 +5,17 @@
*/
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <firmware_image_package.h>
-#include <io_driver.h>
-#include <io_fip.h>
-#include <io_memmap.h>
-#include <platform_def.h>
#include <string.h>
+#include <platform_def.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/io/io_driver.h>
+#include <drivers/io/io_fip.h>
+#include <drivers/io/io_memmap.h>
+#include <tools_share/firmware_image_package.h>
+
/* Semihosting filenames */
#define BL2_IMAGE_NAME "bl2.bin"
#define BL31_IMAGE_NAME "bl31.bin"
diff --git a/plat/rpi3/rpi3_mbox.c b/plat/rpi3/rpi3_mbox.c
index 77e17af6b..2db605edf 100644
--- a/plat/rpi3/rpi3_mbox.c
+++ b/plat/rpi3/rpi3_mbox.c
@@ -5,11 +5,13 @@
*/
#include <assert.h>
-#include <arch_helpers.h>
-#include <debug.h>
-#include <mmio.h>
+
#include <platform_def.h>
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+
#include "rpi3_hw.h"
/* This struct must be aligned to 16 bytes */
diff --git a/plat/rpi3/rpi3_pm.c b/plat/rpi3/rpi3_pm.c
index b6adc8a53..3a077d37a 100644
--- a/plat/rpi3/rpi3_pm.c
+++ b/plat/rpi3/rpi3_pm.c
@@ -4,14 +4,16 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <console.h>
-#include <debug.h>
-#include <mmio.h>
+
#include <platform_def.h>
-#include <platform.h>
-#include <psci.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
#include "rpi3_hw.h"
diff --git a/plat/rpi3/rpi3_rng.c b/plat/rpi3/rpi3_rng.c
index 111b3b6c6..fd69adbf3 100644
--- a/plat/rpi3/rpi3_rng.c
+++ b/plat/rpi3/rpi3_rng.c
@@ -5,9 +5,10 @@
*/
#include <assert.h>
-#include <mmio.h>
#include <string.h>
+#include <lib/mmio.h>
+
#include "rpi3_hw.h"
/* Initial amount of values to discard */
diff --git a/plat/rpi3/rpi3_stack_protector.c b/plat/rpi3/rpi3_stack_protector.c
index 812f6edfa..815f73135 100644
--- a/plat/rpi3/rpi3_stack_protector.c
+++ b/plat/rpi3/rpi3_stack_protector.c
@@ -5,7 +5,8 @@
*/
#include <stdint.h>
-#include <utils.h>
+
+#include <lib/utils.h>
#include "rpi3_private.h"
diff --git a/plat/rpi3/rpi3_topology.c b/plat/rpi3/rpi3_topology.c
index 31a22a469..200d41dd1 100644
--- a/plat/rpi3/rpi3_topology.c
+++ b/plat/rpi3/rpi3_topology.c
@@ -4,10 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
-#include <platform_def.h>
#include <stdint.h>
+#include <platform_def.h>
+
+#include <arch.h>
+
#include "rpi3_private.h"
/* The power domain tree descriptor */
diff --git a/plat/rpi3/rpi3_trusted_boot.c b/plat/rpi3/rpi3_trusted_boot.c
index 2f528fc41..b306c45c2 100644
--- a/plat/rpi3/rpi3_trusted_boot.c
+++ b/plat/rpi3/rpi3_trusted_boot.c
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <platform.h>
+#include <plat/common/platform.h>
extern char rpi3_rotpk_hash[], rpi3_rotpk_hash_end[];
diff --git a/plat/socionext/synquacer/drivers/mhu/sq_mhu.c b/plat/socionext/synquacer/drivers/mhu/sq_mhu.c
index 5c2a635bb..925ed9704 100644
--- a/plat/socionext/synquacer/drivers/mhu/sq_mhu.c
+++ b/plat/socionext/synquacer/drivers/mhu/sq_mhu.c
@@ -4,11 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bakery_lock.h>
-#include <mmio.h>
+
#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+
#include <sq_common.h>
#include "sq_mhu.h"
diff --git a/plat/socionext/synquacer/drivers/scpi/sq_scpi.c b/plat/socionext/synquacer/drivers/scpi/sq_scpi.c
index 170b7e184..0cb75a02d 100644
--- a/plat/socionext/synquacer/drivers/scpi/sq_scpi.c
+++ b/plat/socionext/synquacer/drivers/scpi/sq_scpi.c
@@ -4,12 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
+#include <string.h>
+
#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
#include <sq_common.h>
-#include <debug.h>
-#include <string.h>
+
#include "sq_mhu.h"
#include "sq_scpi.h"
diff --git a/plat/socionext/synquacer/include/platform_def.h b/plat/socionext/synquacer/include/platform_def.h
index bde73485b..de6be7d23 100644
--- a/plat/socionext/synquacer/include/platform_def.h
+++ b/plat/socionext/synquacer/include/platform_def.h
@@ -7,8 +7,8 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
-#include <common_def.h>
-#include <utils_def.h>
+#include <lib/utils_def.h>
+#include <plat/common/common_def.h>
/* CPU topology */
#define PLAT_MAX_CORES_PER_CLUSTER 2
diff --git a/plat/socionext/synquacer/include/sq_common.h b/plat/socionext/synquacer/include/sq_common.h
index c39564034..abd90904d 100644
--- a/plat/socionext/synquacer/include/sq_common.h
+++ b/plat/socionext/synquacer/include/sq_common.h
@@ -8,7 +8,8 @@
#define SQ_COMMON_H
#include <stdint.h>
-#include <xlat_tables_v2.h>
+
+#include <lib/xlat_tables/xlat_tables_v2.h>
struct draminfo {
uint32_t num_regions;
diff --git a/plat/socionext/synquacer/sq_bl31_setup.c b/plat/socionext/synquacer/sq_bl31_setup.c
index 07c1f8997..f8d252622 100644
--- a/plat/socionext/synquacer/sq_bl31_setup.c
+++ b/plat/socionext/synquacer/sq_bl31_setup.c
@@ -4,14 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <assert.h>
+
+#include <platform_def.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <platform_def.h>
-#include <assert.h>
-#include <bl_common.h>
-#include <pl011.h>
-#include <debug.h>
-#include <mmio.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/pl011.h>
+#include <lib/mmio.h>
+
#include <sq_common.h>
static console_pl011_t console;
diff --git a/plat/socionext/synquacer/sq_ccn.c b/plat/socionext/synquacer/sq_ccn.c
index bb70d5d80..fa6ea87b2 100644
--- a/plat/socionext/synquacer/sq_ccn.c
+++ b/plat/socionext/synquacer/sq_ccn.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <ccn.h>
-#include <platform_def.h>
+#include <drivers/arm/ccn.h>
static const unsigned char master_to_rn_id_map[] = {
PLAT_SQ_CLUSTER_TO_CCN_ID_MAP
diff --git a/plat/socionext/synquacer/sq_gicv3.c b/plat/socionext/synquacer/sq_gicv3.c
index 94e5a66b6..05318e372 100644
--- a/plat/socionext/synquacer/sq_gicv3.c
+++ b/plat/socionext/synquacer/sq_gicv3.c
@@ -5,11 +5,13 @@
*/
#include <assert.h>
-#include <gicv3.h>
-#include <interrupt_props.h>
-#include <platform.h>
+
#include <platform_def.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gicv3.h>
+#include <plat/common/platform.h>
+
#include "sq_common.h"
static uintptr_t sq_rdistif_base_addrs[PLATFORM_CORE_COUNT];
diff --git a/plat/socionext/synquacer/sq_psci.c b/plat/socionext/synquacer/sq_psci.c
index c327f1d48..134224dce 100644
--- a/plat/socionext/synquacer/sq_psci.c
+++ b/plat/socionext/synquacer/sq_psci.c
@@ -4,17 +4,20 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <cassert.h>
-#include <debug.h>
-#include <delay_timer.h>
#include <errno.h>
-#include <generic_delay_timer.h>
+
#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <drivers/generic_delay_timer.h>
+#include <lib/cassert.h>
+#include <lib/psci/psci.h>
+
#include <sq_common.h>
#include "sq_scpi.h"
-#include <psci.h>
/* Macros to read the SQ power domain state */
#define SQ_PWR_LVL0 MPIDR_AFFLVL0
diff --git a/plat/socionext/synquacer/sq_topology.c b/plat/socionext/synquacer/sq_topology.c
index aa2035599..359997aae 100644
--- a/plat/socionext/synquacer/sq_topology.c
+++ b/plat/socionext/synquacer/sq_topology.c
@@ -4,9 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include <arch.h>
+
#include <sq_common.h>
-#include <platform_def.h>
unsigned char sq_pd_tree_desc[PLAT_CLUSTER_COUNT + 1];
diff --git a/plat/socionext/synquacer/sq_xlat_setup.c b/plat/socionext/synquacer/sq_xlat_setup.c
index ae147003a..5d1669d03 100644
--- a/plat/socionext/synquacer/sq_xlat_setup.c
+++ b/plat/socionext/synquacer/sq_xlat_setup.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
#include <platform_def.h>
-#include <xlat_tables_v2.h>
+
+#include <common/debug.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
#define SQ_REG_REGION_BASE 0x20000000ULL
#define SQ_REG_REGION_SIZE 0x60000000ULL
diff --git a/plat/socionext/uniphier/include/platform_def.h b/plat/socionext/uniphier/include/platform_def.h
index 6e9b98edb..d4db3f5b0 100644
--- a/plat/socionext/uniphier/include/platform_def.h
+++ b/plat/socionext/uniphier/include/platform_def.h
@@ -7,9 +7,9 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
-#include <common_def.h>
-#include <tbbr/tbbr_img_def.h>
-#include <utils_def.h>
+#include <common/tbbr/tbbr_img_def.h>
+#include <lib/utils_def.h>
+#include <plat/common/common_def.h>
#define PLATFORM_STACK_SIZE 0x1000
diff --git a/plat/socionext/uniphier/tsp/uniphier_tsp_setup.c b/plat/socionext/uniphier/tsp/uniphier_tsp_setup.c
index 7df17d3cd..e7dcc652d 100644
--- a/plat/socionext/uniphier/tsp/uniphier_tsp_setup.c
+++ b/plat/socionext/uniphier/tsp/uniphier_tsp_setup.c
@@ -5,7 +5,8 @@
*/
#include <platform_def.h>
-#include <xlat_mmu_helpers.h>
+
+#include <lib/xlat_tables/xlat_mmu_helpers.h>
#include "../uniphier.h"
diff --git a/plat/socionext/uniphier/uniphier_bl2_setup.c b/plat/socionext/uniphier/uniphier_bl2_setup.c
index fb7997c89..7109d21fe 100644
--- a/plat/socionext/uniphier/uniphier_bl2_setup.c
+++ b/plat/socionext/uniphier/uniphier_bl2_setup.c
@@ -4,18 +4,20 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <debug.h>
-#include <desc_image_load.h>
#include <errno.h>
-#include <io/io_storage.h>
-#include <image_decompress.h>
-#include <platform.h>
+
#include <platform_def.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/desc_image_load.h>
+#include <common/image_decompress.h>
+#include <drivers/io/io_storage.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
+#include <plat/common/platform.h>
#ifdef UNIPHIER_DECOMPRESS_GZIP
#include <tf_gunzip.h>
#endif
-#include <xlat_tables_v2.h>
#include "uniphier.h"
diff --git a/plat/socionext/uniphier/uniphier_bl31_setup.c b/plat/socionext/uniphier/uniphier_bl31_setup.c
index c5acdbd70..ce32d89c0 100644
--- a/plat/socionext/uniphier/uniphier_bl31_setup.c
+++ b/plat/socionext/uniphier/uniphier_bl31_setup.c
@@ -4,16 +4,18 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
#include <assert.h>
-#include <bl_common.h>
-#include <console.h>
-#include <debug.h>
#include <errno.h>
-#include <mmio.h>
-#include <platform.h>
+
#include <platform_def.h>
-#include <xlat_mmu_helpers.h>
+
+#include <arch.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_mmu_helpers.h>
+#include <plat/common/platform.h>
#include "uniphier.h"
diff --git a/plat/socionext/uniphier/uniphier_boot_device.c b/plat/socionext/uniphier/uniphier_boot_device.c
index 78ca8ef06..462c0859c 100644
--- a/plat/socionext/uniphier/uniphier_boot_device.c
+++ b/plat/socionext/uniphier/uniphier_boot_device.c
@@ -5,10 +5,11 @@
*/
#include <assert.h>
-#include <mmio.h>
#include <stdbool.h>
#include <stddef.h>
-#include <utils_def.h>
+
+#include <lib/mmio.h>
+#include <lib/utils_def.h>
#include "uniphier.h"
diff --git a/plat/socionext/uniphier/uniphier_cci.c b/plat/socionext/uniphier/uniphier_cci.c
index 9e00c56e3..3ca176895 100644
--- a/plat/socionext/uniphier/uniphier_cci.c
+++ b/plat/socionext/uniphier/uniphier_cci.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <cci.h>
#include <stddef.h>
-#include <utils_def.h>
+
+#include <arch_helpers.h>
+#include <drivers/arm/cci.h>
+#include <lib/utils_def.h>
#include "uniphier.h"
diff --git a/plat/socionext/uniphier/uniphier_emmc.c b/plat/socionext/uniphier/uniphier_emmc.c
index db87637b7..4ac1f5108 100644
--- a/plat/socionext/uniphier/uniphier_emmc.c
+++ b/plat/socionext/uniphier/uniphier_emmc.c
@@ -4,13 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <io/io_block.h>
-#include <mmio.h>
-#include <platform_def.h>
#include <stdint.h>
-#include <utils_def.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <drivers/io/io_block.h>
+#include <lib/mmio.h>
+#include <lib/utils_def.h>
#include "uniphier.h"
diff --git a/plat/socionext/uniphier/uniphier_gicv3.c b/plat/socionext/uniphier/uniphier_gicv3.c
index 93bc73ac2..5148e8f91 100644
--- a/plat/socionext/uniphier/uniphier_gicv3.c
+++ b/plat/socionext/uniphier/uniphier_gicv3.c
@@ -5,11 +5,13 @@
*/
#include <assert.h>
-#include <gicv3.h>
-#include <interrupt_props.h>
-#include <platform.h>
+
#include <platform_def.h>
+#include <drivers/arm/gicv3.h>
+#include <common/interrupt_props.h>
+#include <plat/common/platform.h>
+
#include "uniphier.h"
static uintptr_t uniphier_rdistif_base_addrs[PLATFORM_CORE_COUNT];
diff --git a/plat/socionext/uniphier/uniphier_image_desc.c b/plat/socionext/uniphier/uniphier_image_desc.c
index f4651db05..9e171e073 100644
--- a/plat/socionext/uniphier/uniphier_image_desc.c
+++ b/plat/socionext/uniphier/uniphier_image_desc.c
@@ -4,11 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
#include <assert.h>
-#include <desc_image_load.h>
+
#include <platform_def.h>
+#include <arch.h>
+#include <common/desc_image_load.h>
+
#include "uniphier.h"
static struct bl_mem_params_node uniphier_image_descs[] = {
diff --git a/plat/socionext/uniphier/uniphier_io_storage.c b/plat/socionext/uniphier/uniphier_io_storage.c
index 5d841ac00..451e84f9e 100644
--- a/plat/socionext/uniphier/uniphier_io_storage.c
+++ b/plat/socionext/uniphier/uniphier_io_storage.c
@@ -6,15 +6,17 @@
#include <assert.h>
#include <errno.h>
-#include <firmware_image_package.h>
-#include <io/io_block.h>
-#include <io/io_driver.h>
-#include <io/io_fip.h>
-#include <io/io_memmap.h>
-#include <platform_def.h>
#include <stdint.h>
-#include <utils_def.h>
-#include <xlat_tables_v2.h>
+
+#include <platform_def.h>
+
+#include <drivers/io/io_block.h>
+#include <drivers/io/io_driver.h>
+#include <drivers/io/io_fip.h>
+#include <drivers/io/io_memmap.h>
+#include <lib/utils_def.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
+#include <tools_share/firmware_image_package.h>
#include "uniphier.h"
diff --git a/plat/socionext/uniphier/uniphier_nand.c b/plat/socionext/uniphier/uniphier_nand.c
index c8e825d6a..271aa0f49 100644
--- a/plat/socionext/uniphier/uniphier_nand.c
+++ b/plat/socionext/uniphier/uniphier_nand.c
@@ -4,13 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <debug.h>
-#include <io/io_block.h>
-#include <mmio.h>
-#include <platform_def.h>
#include <stdint.h>
-#include <utils_def.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/io/io_block.h>
+#include <lib/mmio.h>
+#include <lib/utils_def.h>
#include "uniphier.h"
diff --git a/plat/socionext/uniphier/uniphier_psci.c b/plat/socionext/uniphier/uniphier_psci.c
index 82081a051..ce11aa7cb 100644
--- a/plat/socionext/uniphier/uniphier_psci.c
+++ b/plat/socionext/uniphier/uniphier_psci.c
@@ -5,9 +5,9 @@
*/
#include <arch_helpers.h>
-#include <debug.h>
-#include <mmio.h>
-#include <psci.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
#include "uniphier.h"
diff --git a/plat/socionext/uniphier/uniphier_scp.c b/plat/socionext/uniphier/uniphier_scp.c
index 58eb72eff..c608a255a 100644
--- a/plat/socionext/uniphier/uniphier_scp.c
+++ b/plat/socionext/uniphier/uniphier_scp.c
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <mmio.h>
-#include <utils_def.h>
+#include <lib/mmio.h>
+#include <lib/utils_def.h>
#include "uniphier.h"
diff --git a/plat/socionext/uniphier/uniphier_soc_info.c b/plat/socionext/uniphier/uniphier_soc_info.c
index 55688f319..377532deb 100644
--- a/plat/socionext/uniphier/uniphier_soc_info.c
+++ b/plat/socionext/uniphier/uniphier_soc_info.c
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <mmio.h>
+#include <lib/mmio.h>
#include "uniphier.h"
diff --git a/plat/socionext/uniphier/uniphier_syscnt.c b/plat/socionext/uniphier/uniphier_syscnt.c
index d7bcaf86f..19378430f 100644
--- a/plat/socionext/uniphier/uniphier_syscnt.c
+++ b/plat/socionext/uniphier/uniphier_syscnt.c
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <platform.h>
+#include <plat/common/platform.h>
unsigned int plat_get_syscnt_freq2(void)
{
diff --git a/plat/socionext/uniphier/uniphier_tbbr.c b/plat/socionext/uniphier/uniphier_tbbr.c
index 1c8341119..962a8d288 100644
--- a/plat/socionext/uniphier/uniphier_tbbr.c
+++ b/plat/socionext/uniphier/uniphier_tbbr.c
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <platform.h>
+#include <plat/common/platform.h>
extern char uniphier_rotpk_hash[], uniphier_rotpk_hash_end[];
diff --git a/plat/socionext/uniphier/uniphier_topology.c b/plat/socionext/uniphier/uniphier_topology.c
index 1f96f5851..c106c98b3 100644
--- a/plat/socionext/uniphier/uniphier_topology.c
+++ b/plat/socionext/uniphier/uniphier_topology.c
@@ -5,7 +5,7 @@
*/
#include <arch.h>
-#include <platform.h>
+#include <plat/common/platform.h>
#include "uniphier.h"
diff --git a/plat/socionext/uniphier/uniphier_usb.c b/plat/socionext/uniphier/uniphier_usb.c
index b51b60120..ef7079a5f 100644
--- a/plat/socionext/uniphier/uniphier_usb.c
+++ b/plat/socionext/uniphier/uniphier_usb.c
@@ -4,13 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <io/io_block.h>
-#include <mmio.h>
-#include <platform_def.h>
#include <stdint.h>
-#include <utils_def.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <drivers/io/io_block.h>
+#include <lib/mmio.h>
+#include <lib/utils_def.h>
#include "uniphier.h"
diff --git a/plat/socionext/uniphier/uniphier_xlat_setup.c b/plat/socionext/uniphier/uniphier_xlat_setup.c
index 3112ecd9d..0faebc993 100644
--- a/plat/socionext/uniphier/uniphier_xlat_setup.c
+++ b/plat/socionext/uniphier/uniphier_xlat_setup.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
#include <platform_def.h>
-#include <xlat_tables_v2.h>
+
+#include <common/debug.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
#define UNIPHIER_REG_REGION_BASE 0x50000000ULL
#define UNIPHIER_REG_REGION_SIZE 0x20000000ULL
diff --git a/plat/st/stm32mp1/bl2_io_storage.c b/plat/st/stm32mp1/bl2_io_storage.c
index b1125d15d..45a352e0c 100644
--- a/plat/st/stm32mp1/bl2_io_storage.c
+++ b/plat/st/stm32mp1/bl2_io_storage.c
@@ -4,26 +4,29 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <boot_api.h>
-#include <debug.h>
-#include <io_block.h>
-#include <io_driver.h>
-#include <io_dummy.h>
-#include <io_mmc.h>
-#include <io_stm32image.h>
-#include <io_storage.h>
-#include <mmc.h>
-#include <mmio.h>
-#include <partition.h>
-#include <platform.h>
+#include <string.h>
+
#include <platform_def.h>
-#include <stm32_sdmmc2.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/io/io_block.h>
+#include <drivers/io/io_driver.h>
+#include <drivers/io/io_dummy.h>
+#include <drivers/io/io_storage.h>
+#include <drivers/mmc.h>
+#include <drivers/partition/partition.h>
+#include <drivers/st/io_mmc.h>
+#include <drivers/st/io_stm32image.h>
+#include <drivers/st/stm32_sdmmc2.h>
+#include <drivers/st/stm32mp1_rcc.h>
+#include <lib/mmio.h>
+#include <lib/utils.h>
+#include <plat/common/platform.h>
+
+#include <boot_api.h>
#include <stm32mp1_private.h>
-#include <stm32mp1_rcc.h>
-#include <string.h>
-#include <utils.h>
/* IO devices */
static const io_dev_connector_t *dummy_dev_con;
diff --git a/plat/st/stm32mp1/bl2_plat_setup.c b/plat/st/stm32mp1/bl2_plat_setup.c
index d85ae96ef..6af65fd26 100644
--- a/plat/st/stm32mp1/bl2_plat_setup.c
+++ b/plat/st/stm32mp1/bl2_plat_setup.c
@@ -4,29 +4,32 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <boot_api.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <desc_image_load.h>
-#include <generic_delay_timer.h>
-#include <mmio.h>
-#include <platform.h>
+#include <string.h>
+
#include <platform_def.h>
-#include <stm32_console.h>
-#include <stm32mp1_clk.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <common/desc_image_load.h>
+#include <drivers/delay_timer.h>
+#include <drivers/generic_delay_timer.h>
+#include <drivers/st/stm32_console.h>
+#include <drivers/st/stm32mp1_clk.h>
+#include <drivers/st/stm32mp1_pmic.h>
+#include <drivers/st/stm32mp1_pwr.h>
+#include <drivers/st/stm32mp1_ram.h>
+#include <drivers/st/stm32mp1_rcc.h>
+#include <drivers/st/stm32mp1_reset.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
+#include <plat/common/platform.h>
+
+#include <boot_api.h>
#include <stm32mp1_context.h>
#include <stm32mp1_dt.h>
-#include <stm32mp1_pmic.h>
#include <stm32mp1_private.h>
-#include <stm32mp1_pwr.h>
-#include <stm32mp1_ram.h>
-#include <stm32mp1_rcc.h>
-#include <stm32mp1_reset.h>
-#include <string.h>
-#include <xlat_tables_v2.h>
static struct console_stm32 console;
diff --git a/plat/st/stm32mp1/include/platform_def.h b/plat/st/stm32mp1/include/platform_def.h
index 2ba6cc64a..1b4df163b 100644
--- a/plat/st/stm32mp1/include/platform_def.h
+++ b/plat/st/stm32mp1/include/platform_def.h
@@ -8,9 +8,10 @@
#define PLATFORM_DEF_H
#include <arch.h>
-#include <common_def.h>
-#include <gic_common.h>
-#include <utils_def.h>
+#include <drivers/arm/gic_common.h>
+#include <lib/utils_def.h>
+#include <plat/common/common_def.h>
+
#include "../stm32mp1_def.h"
/*******************************************************************************
diff --git a/plat/st/stm32mp1/plat_bl2_mem_params_desc.c b/plat/st/stm32mp1/plat_bl2_mem_params_desc.c
index 6f5bc4cc1..621419439 100644
--- a/plat/st/stm32mp1/plat_bl2_mem_params_desc.c
+++ b/plat/st/stm32mp1/plat_bl2_mem_params_desc.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <desc_image_load.h>
-#include <platform.h>
#include <platform_def.h>
+#include <common/bl_common.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
+
/*******************************************************************************
* Following descriptor provides BL image/ep information that gets used
* by BL2 to load the images and also subset of this information is
diff --git a/plat/st/stm32mp1/plat_image_load.c b/plat/st/stm32mp1/plat_image_load.c
index d5b328e3c..a52db6cac 100644
--- a/plat/st/stm32mp1/plat_image_load.c
+++ b/plat/st/stm32mp1/plat_image_load.c
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <desc_image_load.h>
-#include <platform.h>
+#include <common/desc_image_load.h>
+#include <plat/common/platform.h>
/*******************************************************************************
* This function flushes the data structures so that they are visible
diff --git a/plat/st/stm32mp1/platform.mk b/plat/st/stm32mp1/platform.mk
index 8890e8225..8bb7a80e1 100644
--- a/plat/st/stm32mp1/platform.mk
+++ b/plat/st/stm32mp1/platform.mk
@@ -22,9 +22,8 @@ PLAT_PARTITION_MAX_ENTRIES := $(shell echo $$(($(STM32_TF_A_COPIES) + 1)))
$(eval $(call add_define,PLAT_PARTITION_MAX_ENTRIES))
PLAT_INCLUDES := -Iplat/st/stm32mp1/include/
+PLAT_INCLUDES += -Iplat/st/stm32mp1/
PLAT_INCLUDES += -Iinclude/common/tbbr
-PLAT_INCLUDES += -Iinclude/drivers/partition
-PLAT_INCLUDES += -Iinclude/drivers/st
# Device tree
STM32_DTB_FILE_NAME ?= stm32mp157c-ev1.dtb
diff --git a/plat/st/stm32mp1/sp_min/sp_min_setup.c b/plat/st/stm32mp1/sp_min/sp_min_setup.c
index bd4f2ec01..f5413797c 100644
--- a/plat/st/stm32mp1/sp_min/sp_min_setup.c
+++ b/plat/st/stm32mp1/sp_min/sp_min_setup.c
@@ -4,25 +4,28 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
+#include <string.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
#include <context.h>
-#include <context_mgmt.h>
-#include <debug.h>
+#include <drivers/arm/tzc400.h>
+#include <drivers/generic_delay_timer.h>
+#include <drivers/st/stm32_console.h>
+#include <drivers/st/stm32mp1_clk.h>
#include <dt-bindings/clock/stm32mp1-clks.h>
-#include <generic_delay_timer.h>
-#include <mmio.h>
-#include <platform.h>
-#include <platform_def.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
+#include <plat/common/platform.h>
+
#include <platform_sp_min.h>
-#include <stm32_console.h>
-#include <stm32mp1_clk.h>
#include <stm32mp1_dt.h>
#include <stm32mp1_private.h>
-#include <string.h>
-#include <tzc400.h>
-#include <xlat_tables_v2.h>
/******************************************************************************
* Placeholder variables for copying the arguments that have been passed to
diff --git a/plat/st/stm32mp1/stm32mp1.ld.S b/plat/st/stm32mp1/stm32mp1.ld.S
index 50c926fb9..a8e822063 100644
--- a/plat/st/stm32mp1/stm32mp1.ld.S
+++ b/plat/st/stm32mp1/stm32mp1.ld.S
@@ -7,8 +7,8 @@
#ifndef STM32MP1_LD_S
#define STM32MP1_LD_S
+#include <lib/xlat_tables/xlat_tables_defs.h>
#include <platform_def.h>
-#include <xlat_tables_defs.h>
OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT)
OUTPUT_ARCH(PLATFORM_LINKER_ARCH)
diff --git a/plat/st/stm32mp1/stm32mp1_common.c b/plat/st/stm32mp1/stm32mp1_common.c
index 7d84da1f8..b54f313ff 100644
--- a/plat/st/stm32mp1/stm32mp1_common.c
+++ b/plat/st/stm32mp1/stm32mp1_common.c
@@ -4,16 +4,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
-#include <gicv2.h>
-#include <mmio.h>
+
#include <platform_def.h>
-#include <platform.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/gicv2.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
+#include <plat/common/platform.h>
+
#include <stm32mp1_private.h>
-#include <xlat_tables_v2.h>
#define MAP_SRAM MAP_REGION_FLAT(STM32MP1_SRAM_BASE, \
STM32MP1_SRAM_SIZE, \
diff --git a/plat/st/stm32mp1/stm32mp1_context.c b/plat/st/stm32mp1/stm32mp1_context.c
index 245fd17d7..a8f9bf46d 100644
--- a/plat/st/stm32mp1/stm32mp1_context.c
+++ b/plat/st/stm32mp1/stm32mp1_context.c
@@ -4,11 +4,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <dt-bindings/clock/stm32mp1-clks.h>
#include <errno.h>
-#include <mmio.h>
+
#include <platform_def.h>
-#include <stm32mp1_clk.h>
+
+#include <drivers/st/stm32mp1_clk.h>
+#include <dt-bindings/clock/stm32mp1-clks.h>
+#include <lib/mmio.h>
+
#include <stm32mp1_context.h>
#define TAMP_BOOT_ITF_BACKUP_REG_ID U(20)
diff --git a/plat/st/stm32mp1/stm32mp1_def.h b/plat/st/stm32mp1/stm32mp1_def.h
index 222449837..fb21accec 100644
--- a/plat/st/stm32mp1/stm32mp1_def.h
+++ b/plat/st/stm32mp1/stm32mp1_def.h
@@ -7,9 +7,9 @@
#ifndef STM32MP1_DEF_H
#define STM32MP1_DEF_H
-#include <tbbr_img_def.h>
-#include <utils_def.h>
-#include <xlat_tables_defs.h>
+#include <common/tbbr/tbbr_img_def.h>
+#include <lib/utils_def.h>
+#include <lib/xlat_tables/xlat_tables_defs.h>
/*******************************************************************************
* STM32MP1 memory map related constants
diff --git a/plat/st/stm32mp1/stm32mp1_dt.c b/plat/st/stm32mp1/stm32mp1_dt.c
index bde968a0b..29e936aff 100644
--- a/plat/st/stm32mp1/stm32mp1_dt.c
+++ b/plat/st/stm32mp1/stm32mp1_dt.c
@@ -5,15 +5,19 @@
*/
#include <assert.h>
-#include <debug.h>
+
#include <libfdt.h>
+
#include <platform_def.h>
-#include <stm32_gpio.h>
-#include <stm32mp1_clk.h>
-#include <stm32mp1_clkfunc.h>
-#include <stm32mp1_ddr.h>
+
+#include <common/debug.h>
+#include <drivers/st/stm32_gpio.h>
+#include <drivers/st/stm32mp1_clk.h>
+#include <drivers/st/stm32mp1_clkfunc.h>
+#include <drivers/st/stm32mp1_ddr.h>
+#include <drivers/st/stm32mp1_ram.h>
+
#include <stm32mp1_dt.h>
-#include <stm32mp1_ram.h>
#define DT_GPIO_BANK_SHIFT 12
#define DT_GPIO_BANK_MASK 0x1F000U
diff --git a/plat/st/stm32mp1/stm32mp1_gic.c b/plat/st/stm32mp1/stm32mp1_gic.c
index 11eb0a3e2..fabed370f 100644
--- a/plat/st/stm32mp1/stm32mp1_gic.c
+++ b/plat/st/stm32mp1/stm32mp1_gic.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <gicv2.h>
-#include <platform.h>
#include <platform_def.h>
-#include <utils.h>
+
+#include <common/bl_common.h>
+#include <drivers/arm/gicv2.h>
+#include <lib/utils.h>
+#include <plat/common/platform.h>
#include <stm32mp1_private.h>
diff --git a/plat/st/stm32mp1/stm32mp1_helper.S b/plat/st/stm32mp1/stm32mp1_helper.S
index 673706eed..61c587f4f 100644
--- a/plat/st/stm32mp1/stm32mp1_helper.S
+++ b/plat/st/stm32mp1/stm32mp1_helper.S
@@ -4,12 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <platform_def.h>
+
#include <arch.h>
#include <asm_macros.S>
-#include <bl_common.h>
-#include <platform_def.h>
-#include <stm32_gpio.h>
-#include <stm32mp1_rcc.h>
+#include <common/bl_common.h>
+#include <drivers/st/stm32_gpio.h>
+#include <drivers/st/stm32mp1_rcc.h>
#define GPIO_BANK_G_ADDRESS 0x50008000
#define GPIO_TX_PORT 11
diff --git a/plat/st/stm32mp1/stm32mp1_pm.c b/plat/st/stm32mp1/stm32mp1_pm.c
index e24af0e55..85189ff21 100644
--- a/plat/st/stm32mp1/stm32mp1_pm.c
+++ b/plat/st/stm32mp1/stm32mp1_pm.c
@@ -4,21 +4,24 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <boot_api.h>
-#include <debug.h>
-#include <dt-bindings/clock/stm32mp1-clks.h>
#include <errno.h>
-#include <gic_common.h>
-#include <gicv2.h>
-#include <mmio.h>
+
#include <platform_def.h>
-#include <platform.h>
-#include <psci.h>
-#include <stm32mp1_clk.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/st/stm32mp1_clk.h>
+#include <drivers/st/stm32mp1_rcc.h>
+#include <dt-bindings/clock/stm32mp1-clks.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
+
+#include <boot_api.h>
#include <stm32mp1_private.h>
-#include <stm32mp1_rcc.h>
static uint32_t stm32_sec_entrypoint;
static uint32_t cntfrq_core0;
diff --git a/plat/st/stm32mp1/stm32mp1_security.c b/plat/st/stm32mp1/stm32mp1_security.c
index e783c14e4..39927040a 100644
--- a/plat/st/stm32mp1/stm32mp1_security.c
+++ b/plat/st/stm32mp1/stm32mp1_security.c
@@ -4,16 +4,19 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <dt-bindings/clock/stm32mp1-clks.h>
-#include <mmio.h>
#include <stdint.h>
-#include <stm32mp1_clk.h>
+
+#include <platform_def.h>
+
+#include <common/debug.h>
+#include <drivers/arm/tzc400.h>
+#include <drivers/st/stm32mp1_clk.h>
+#include <drivers/st/stm32mp1_rcc.h>
+#include <dt-bindings/clock/stm32mp1-clks.h>
+#include <lib/mmio.h>
+
#include <stm32mp1_dt.h>
#include <stm32mp1_private.h>
-#include <stm32mp1_rcc.h>
-#include <tzc400.h>
-#include "platform_def.h"
/*******************************************************************************
* Initialize the TrustZone Controller. Configure Region 0 with Secure RW access
diff --git a/plat/st/stm32mp1/stm32mp1_stack_protector.c b/plat/st/stm32mp1/stm32mp1_stack_protector.c
index c68130097..14e8e1612 100644
--- a/plat/st/stm32mp1/stm32mp1_stack_protector.c
+++ b/plat/st/stm32mp1/stm32mp1_stack_protector.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <platform.h>
#include <stdint.h>
+#include <arch_helpers.h>
+#include <plat/common/platform.h>
+
#define RANDOM_CANARY_VALUE 2144346116U
u_register_t plat_get_stack_protector_canary(void)
diff --git a/plat/st/stm32mp1/stm32mp1_topology.c b/plat/st/stm32mp1/stm32mp1_topology.c
index 405aa33eb..59a0c17cf 100644
--- a/plat/st/stm32mp1/stm32mp1_topology.c
+++ b/plat/st/stm32mp1/stm32mp1_topology.c
@@ -5,8 +5,9 @@
*/
#include <platform_def.h>
-#include <platform.h>
-#include <psci.h>
+
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
/* 1 cluster, all cores into */
static const unsigned char stm32mp1_power_domain_tree_desc[] = {
diff --git a/plat/ti/k3/board/generic/include/board_def.h b/plat/ti/k3/board/generic/include/board_def.h
index 1bf58eda8..4c8f88220 100644
--- a/plat/ti/k3/board/generic/include/board_def.h
+++ b/plat/ti/k3/board/generic/include/board_def.h
@@ -7,7 +7,7 @@
#ifndef BOARD_DEF_H
#define BOARD_DEF_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
/* The ports must be in order and contiguous */
#define K3_CLUSTER0_CORE_COUNT 2
diff --git a/plat/ti/k3/common/drivers/sec_proxy/sec_proxy.c b/plat/ti/k3/common/drivers/sec_proxy/sec_proxy.c
index 92414b905..5dd54d4ff 100644
--- a/plat/ti/k3/common/drivers/sec_proxy/sec_proxy.c
+++ b/plat/ti/k3/common/drivers/sec_proxy/sec_proxy.c
@@ -7,14 +7,16 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <debug.h>
#include <errno.h>
-#include <mmio.h>
-#include <platform_def.h>
#include <stdlib.h>
-#include <utils.h>
-#include <utils_def.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <lib/utils.h>
+#include <lib/utils_def.h>
#include "sec_proxy.h"
diff --git a/plat/ti/k3/common/drivers/ti_sci/ti_sci.c b/plat/ti/k3/common/drivers/ti_sci/ti_sci.c
index 7ba0267dc..b211bdf60 100644
--- a/plat/ti/k3/common/drivers/ti_sci/ti_sci.c
+++ b/plat/ti/k3/common/drivers/ti_sci/ti_sci.c
@@ -7,13 +7,14 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
#include <errno.h>
-#include <platform_def.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
+#include <platform_def.h>
+
+#include <common/debug.h>
#include <sec_proxy.h>
#include "ti_sci_protocol.h"
diff --git a/plat/ti/k3/common/k3_bl31_setup.c b/plat/ti/k3/common/k3_bl31_setup.c
index c0cf5e2a8..3fa11b231 100644
--- a/plat/ti/k3/common/k3_bl31_setup.c
+++ b/plat/ti/k3/common/k3_bl31_setup.c
@@ -4,17 +4,20 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <assert.h>
+#include <string.h>
+
+#include <platform_def.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <assert.h>
-#include <bl_common.h>
-#include <debug.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <lib/xlat_tables/xlat_tables_v2.h>
+
#include <k3_console.h>
#include <k3_gicv3.h>
-#include <platform_def.h>
-#include <string.h>
#include <ti_sci.h>
-#include <xlat_tables_v2.h>
/* Table of regions to map using the MMU */
const mmap_region_t plat_k3_mmap[] = {
diff --git a/plat/ti/k3/common/k3_console.c b/plat/ti/k3/common/k3_console.c
index ff3ca61ce..31c963245 100644
--- a/plat/ti/k3/common/k3_console.c
+++ b/plat/ti/k3/common/k3_console.c
@@ -4,10 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <console.h>
-#include <k3_console.h>
#include <platform_def.h>
-#include <uart_16550.h>
+
+#include <drivers/console.h>
+#include <drivers/ti/uart/uart_16550.h>
+
+#include <k3_console.h>
void bl31_console_setup(void)
{
diff --git a/plat/ti/k3/common/k3_gicv3.c b/plat/ti/k3/common/k3_gicv3.c
index 3253130f6..b7c788014 100644
--- a/plat/ti/k3/common/k3_gicv3.c
+++ b/plat/ti/k3/common/k3_gicv3.c
@@ -4,13 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <gicv3.h>
-#include <interrupt_props.h>
-#include <k3_gicv3.h>
-#include <platform.h>
#include <platform_def.h>
-#include <utils.h>
+
+#include <common/bl_common.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gicv3.h>
+#include <lib/utils.h>
+#include <plat/common/platform.h>
+
+#include <k3_gicv3.h>
/* The GICv3 driver only needs to be initialized in EL3 */
uintptr_t rdistif_base_addrs[PLATFORM_CORE_COUNT];
diff --git a/plat/ti/k3/common/k3_psci.c b/plat/ti/k3/common/k3_psci.c
index 787cc82fd..cb75bf654 100644
--- a/plat/ti/k3/common/k3_psci.c
+++ b/plat/ti/k3/common/k3_psci.c
@@ -4,19 +4,21 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <cpu_data.h>
-#include <debug.h>
-#include <k3_gicv3.h>
-#include <psci.h>
-/* Need to flush psci internal locks before shutdown or their values are lost */
-#include <../../lib/psci/psci_private.h>
-#include <platform.h>
#include <stdbool.h>
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <lib/el3_runtime/cpu_data.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
+
+#include <k3_gicv3.h>
#include <ti_sci.h>
+/* Need to flush psci internal locks before shutdown or their values are lost */
+#include "../../../../lib/psci/psci_private.h"
+
#define STUB() ERROR("stub %s called\n", __func__)
uintptr_t k3_sec_entrypoint;
diff --git a/plat/ti/k3/common/k3_topology.c b/plat/ti/k3/common/k3_topology.c
index d7ac0a589..2b98acb27 100644
--- a/plat/ti/k3/common/k3_topology.c
+++ b/plat/ti/k3/common/k3_topology.c
@@ -5,7 +5,8 @@
*/
#include <platform_def.h>
-#include <psci.h>
+
+#include <lib/psci/psci.h>
/* The power domain tree descriptor */
static unsigned char power_domain_tree_desc[] = {
diff --git a/plat/ti/k3/include/platform_def.h b/plat/ti/k3/include/platform_def.h
index 7d1df0aef..5d563b6f0 100644
--- a/plat/ti/k3/include/platform_def.h
+++ b/plat/ti/k3/include/platform_def.h
@@ -8,8 +8,9 @@
#define PLATFORM_DEF_H
#include <arch.h>
+#include <plat/common/common_def.h>
+
#include <board_def.h>
-#include <common_def.h>
/*******************************************************************************
* Generic platform constants
diff --git a/plat/xilinx/versal/aarch64/versal_common.c b/plat/xilinx/versal/aarch64/versal_common.c
index c13b1b52a..587b797d7 100644
--- a/plat/xilinx/versal/aarch64/versal_common.c
+++ b/plat/xilinx/versal/aarch64/versal_common.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <generic_delay_timer.h>
-#include <mmio.h>
-#include <platform.h>
-#include <xlat_tables.h>
+#include <common/debug.h>
+#include <drivers/generic_delay_timer.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables.h>
+#include <plat/common/platform.h>
+
#include "../versal_def.h"
#include "../versal_private.h"
diff --git a/plat/xilinx/versal/aarch64/versal_helpers.S b/plat/xilinx/versal/aarch64/versal_helpers.S
index 1b7f95596..26eb05221 100644
--- a/plat/xilinx/versal/aarch64/versal_helpers.S
+++ b/plat/xilinx/versal/aarch64/versal_helpers.S
@@ -6,7 +6,7 @@
#include <arch.h>
#include <asm_macros.S>
-#include <gicv3.h>
+#include <drivers/arm/gicv3.h>
#include <platform_def.h>
.globl plat_secondary_cold_boot_setup
diff --git a/plat/xilinx/versal/bl31_versal_setup.c b/plat/xilinx/versal/bl31_versal_setup.c
index 9f71a1cc3..d7e07e036 100644
--- a/plat/xilinx/versal/bl31_versal_setup.c
+++ b/plat/xilinx/versal/bl31_versal_setup.c
@@ -5,14 +5,16 @@
*/
#include <assert.h>
-#include <bl_common.h>
-#include <bl31.h>
-#include <console.h>
-#include <debug.h>
#include <errno.h>
-#include <platform.h>
-#include <pl011.h>
-#include <xlat_tables.h>
+
+#include <bl31/bl31.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/pl011.h>
+#include <drivers/console.h>
+#include <lib/xlat_tables/xlat_tables.h>
+#include <plat/common/platform.h>
+
#include "versal_private.h"
static entry_point_info_t bl32_image_ep_info;
diff --git a/plat/xilinx/versal/include/plat_macros.S b/plat/xilinx/versal/include/plat_macros.S
index 4fc1315be..3a5221225 100644
--- a/plat/xilinx/versal/include/plat_macros.S
+++ b/plat/xilinx/versal/include/plat_macros.S
@@ -7,10 +7,11 @@
#ifndef PLAT_MACROS_S
#define PLAT_MACROS_S
+#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/arm/gicv3.h>
+
#include "../include/platform_def.h"
-#include <gic_common.h>
-#include <gicv2.h>
-#include <gicv3.h>
.section .rodata.gic_reg_name, "aS"
/* Applicable only to GICv2 and GICv3 with SRE disabled (legacy mode) */
diff --git a/plat/xilinx/versal/include/platform_def.h b/plat/xilinx/versal/include/platform_def.h
index 45aaa84be..0c4b9544f 100644
--- a/plat/xilinx/versal/include/platform_def.h
+++ b/plat/xilinx/versal/include/platform_def.h
@@ -8,6 +8,7 @@
#define PLATFORM_DEF_H
#include <arch.h>
+
#include "../versal_def.h"
/*******************************************************************************
diff --git a/plat/xilinx/versal/plat_psci.c b/plat/xilinx/versal/plat_psci.c
index 37d00f66c..4a443697f 100644
--- a/plat/xilinx/versal/plat_psci.c
+++ b/plat/xilinx/versal/plat_psci.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <mmio.h>
-#include <platform.h>
-#include <psci.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
+
#include "versal_private.h"
static uintptr_t versal_sec_entry;
diff --git a/plat/xilinx/versal/plat_versal.c b/plat/xilinx/versal/plat_versal.c
index 152cb3626..642867da2 100644
--- a/plat/xilinx/versal/plat_versal.c
+++ b/plat/xilinx/versal/plat_versal.c
@@ -3,7 +3,9 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <platform.h>
+
+#include <plat/common/platform.h>
+
#include "versal_private.h"
int plat_core_pos_by_mpidr(u_register_t mpidr)
diff --git a/plat/xilinx/versal/sip_svc_setup.c b/plat/xilinx/versal/sip_svc_setup.c
index 4007d5c8f..8f2180b21 100644
--- a/plat/xilinx/versal/sip_svc_setup.c
+++ b/plat/xilinx/versal/sip_svc_setup.c
@@ -6,9 +6,9 @@
/* Top level SMC handler for SiP calls. Dispatch PM calls to PM SMC handler. */
-#include <debug.h>
-#include <runtime_svc.h>
-#include <uuid.h>
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <tools_share/uuid.h>
/* SMC function IDs for SiP Service queries */
#define VERSAL_SIP_SVC_CALL_COUNT 0x8200ff00
diff --git a/plat/xilinx/versal/versal_def.h b/plat/xilinx/versal/versal_def.h
index 5e42bd784..41c65b94d 100644
--- a/plat/xilinx/versal/versal_def.h
+++ b/plat/xilinx/versal/versal_def.h
@@ -7,7 +7,7 @@
#ifndef VERSAL_DEF_H
#define VERSAL_DEF_H
-#include <common_def.h>
+#include <plat/common/common_def.h>
/* List all consoles */
#define VERSAL_CONSOLE_ID_pl011 1
diff --git a/plat/xilinx/versal/versal_gicv3.c b/plat/xilinx/versal/versal_gicv3.c
index 72374b53b..dcf23b425 100644
--- a/plat/xilinx/versal/versal_gicv3.c
+++ b/plat/xilinx/versal/versal_gicv3.c
@@ -4,11 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <gicv3.h>
-#include <interrupt_props.h>
-#include <platform.h>
#include <platform_def.h>
-#include <utils.h>
+
+#include <common/interrupt_props.h>
+#include <drivers/arm/gicv3.h>
+#include <lib/utils.h>
+#include <plat/common/platform.h>
+
#include "versal_private.h"
/******************************************************************************
diff --git a/plat/xilinx/versal/versal_private.h b/plat/xilinx/versal/versal_private.h
index 1e30ebc28..5d98d080c 100644
--- a/plat/xilinx/versal/versal_private.h
+++ b/plat/xilinx/versal/versal_private.h
@@ -7,7 +7,7 @@
#ifndef VERSAL_PRIVATE_H
#define VERSAL_PRIVATE_H
-#include <xlat_tables.h>
+#include <lib/xlat_tables/xlat_tables.h>
void versal_config_setup(void);
diff --git a/plat/xilinx/zynqmp/aarch64/zynqmp_common.c b/plat/xilinx/zynqmp/aarch64/zynqmp_common.c
index 2f4228fea..23c02e068 100644
--- a/plat/xilinx/zynqmp/aarch64/zynqmp_common.c
+++ b/plat/xilinx/zynqmp/aarch64/zynqmp_common.c
@@ -4,13 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <generic_delay_timer.h>
-#include <mmio.h>
-#include <platform.h>
#include <stdbool.h>
#include <string.h>
-#include <xlat_tables.h>
+
+#include <common/debug.h>
+#include <drivers/generic_delay_timer.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables.h>
+#include <plat/common/platform.h>
+
#include "../zynqmp_private.h"
#include "pm_api_sys.h"
diff --git a/plat/xilinx/zynqmp/aarch64/zynqmp_helpers.S b/plat/xilinx/zynqmp/aarch64/zynqmp_helpers.S
index 969d8faa1..8d8166538 100644
--- a/plat/xilinx/zynqmp/aarch64/zynqmp_helpers.S
+++ b/plat/xilinx/zynqmp/aarch64/zynqmp_helpers.S
@@ -5,7 +5,7 @@
*/
#include <asm_macros.S>
-#include <gicv2.h>
+#include <drivers/arm/gicv2.h>
#include <platform_def.h>
.globl plat_secondary_cold_boot_setup
diff --git a/plat/xilinx/zynqmp/bl31_zynqmp_setup.c b/plat/xilinx/zynqmp/bl31_zynqmp_setup.c
index 01634500a..01cd781ff 100644
--- a/plat/xilinx/zynqmp/bl31_zynqmp_setup.c
+++ b/plat/xilinx/zynqmp/bl31_zynqmp_setup.c
@@ -5,13 +5,15 @@
*/
#include <assert.h>
-#include <bl31.h>
-#include <bl_common.h>
-#include <console.h>
-#include <debug.h>
#include <errno.h>
+
+#include <bl31/bl31.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/console.h>
#include <plat_arm.h>
-#include <platform.h>
+#include <plat/common/platform.h>
+
#include "zynqmp_private.h"
#define BL31_END (unsigned long)(&__BL31_END__)
diff --git a/plat/xilinx/zynqmp/include/platform_def.h b/plat/xilinx/zynqmp/include/platform_def.h
index d721778d3..e3c9fcc17 100644
--- a/plat/xilinx/zynqmp/include/platform_def.h
+++ b/plat/xilinx/zynqmp/include/platform_def.h
@@ -8,9 +8,10 @@
#define PLATFORM_DEF_H
#include <arch.h>
-#include <gic_common.h>
-#include <interrupt_props.h>
-#include <utils_def.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gic_common.h>
+#include <lib/utils_def.h>
+
#include "../zynqmp_def.h"
/*******************************************************************************
diff --git a/plat/xilinx/zynqmp/ipi_mailbox_service/ipi_mailbox_svc.c b/plat/xilinx/zynqmp/ipi_mailbox_service/ipi_mailbox_svc.c
index bfc19d339..11f382a05 100644
--- a/plat/xilinx/zynqmp/ipi_mailbox_service/ipi_mailbox_svc.c
+++ b/plat/xilinx/zynqmp/ipi_mailbox_service/ipi_mailbox_svc.c
@@ -8,12 +8,14 @@
* Top-level SMC handler for ZynqMP IPI Mailbox doorbell functions.
*/
-#include <bakery_lock.h>
-#include <debug.h>
#include <errno.h>
-#include <mmio.h>
-#include <runtime_svc.h>
#include <string.h>
+
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+
#include "ipi_mailbox_svc.h"
#include "../zynqmp_ipi.h"
#include "../zynqmp_private.h"
diff --git a/plat/xilinx/zynqmp/plat_psci.c b/plat/xilinx/zynqmp/plat_psci.c
index a82f69677..4183979a2 100644
--- a/plat/xilinx/zynqmp/plat_psci.c
+++ b/plat/xilinx/zynqmp/plat_psci.c
@@ -4,15 +4,17 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
#include <errno.h>
-#include <gicv2.h>
-#include <mmio.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/arm/gicv2.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+#include <plat/common/platform.h>
+
#include <plat_arm.h>
-#include <platform.h>
-#include <psci.h>
#include "pm_api_sys.h"
#include "pm_client.h"
#include "zynqmp_private.h"
diff --git a/plat/xilinx/zynqmp/plat_startup.c b/plat/xilinx/zynqmp/plat_startup.c
index d3e182cac..03f0e3d82 100644
--- a/plat/xilinx/zynqmp/plat_startup.c
+++ b/plat/xilinx/zynqmp/plat_startup.c
@@ -4,10 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <debug.h>
-#include <mmio.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+
#include "zynqmp_def.h"
#include "zynqmp_private.h"
diff --git a/plat/xilinx/zynqmp/plat_zynqmp.c b/plat/xilinx/zynqmp/plat_zynqmp.c
index 2441630bd..ad18aafc3 100644
--- a/plat/xilinx/zynqmp/plat_zynqmp.c
+++ b/plat/xilinx/zynqmp/plat_zynqmp.c
@@ -4,7 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <platform.h>
+#include <plat/common/platform.h>
+
#include "zynqmp_private.h"
int plat_core_pos_by_mpidr(u_register_t mpidr)
diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_clock.c b/plat/xilinx/zynqmp/pm_service/pm_api_clock.c
index b175b78b3..04a58b488 100644
--- a/plat/xilinx/zynqmp/pm_service/pm_api_clock.c
+++ b/plat/xilinx/zynqmp/pm_service/pm_api_clock.c
@@ -8,11 +8,13 @@
* ZynqMP system level PM-API functions for clock control.
*/
-#include <arch_helpers.h>
-#include <mmio.h>
-#include <platform.h>
#include <stdbool.h>
#include <string.h>
+
+#include <arch_helpers.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include "pm_api_clock.h"
#include "pm_api_sys.h"
#include "pm_client.h"
diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_clock.h b/plat/xilinx/zynqmp/pm_service/pm_api_clock.h
index f7cbdbaf0..44e9773d0 100644
--- a/plat/xilinx/zynqmp/pm_service/pm_api_clock.h
+++ b/plat/xilinx/zynqmp/pm_service/pm_api_clock.h
@@ -11,7 +11,8 @@
#ifndef PM_API_CLOCK_H
#define PM_API_CLOCK_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
+
#include "pm_common.h"
#define CLK_NAME_LEN U(15)
diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c b/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c
index 16c08ae6d..fd9d7c070 100644
--- a/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c
+++ b/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c
@@ -9,9 +9,10 @@
*/
#include <arch_helpers.h>
-#include <delay_timer.h>
-#include <mmio.h>
-#include <platform.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include "pm_api_clock.h"
#include "pm_api_ioctl.h"
#include "pm_api_sys.h"
diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_pinctrl.c b/plat/xilinx/zynqmp/pm_service/pm_api_pinctrl.c
index 12b9c2d29..a900057e8 100644
--- a/plat/xilinx/zynqmp/pm_service/pm_api_pinctrl.c
+++ b/plat/xilinx/zynqmp/pm_service/pm_api_pinctrl.c
@@ -8,9 +8,11 @@
* ZynqMP system level PM-API functions for pin control.
*/
-#include <arch_helpers.h>
-#include <platform.h>
#include <string.h>
+
+#include <arch_helpers.h>
+#include <plat/common/platform.h>
+
#include "pm_api_pinctrl.h"
#include "pm_api_sys.h"
#include "pm_client.h"
diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_sys.c b/plat/xilinx/zynqmp/pm_service/pm_api_sys.c
index e85b2cee3..974dbb3d7 100644
--- a/plat/xilinx/zynqmp/pm_service/pm_api_sys.c
+++ b/plat/xilinx/zynqmp/pm_service/pm_api_sys.c
@@ -10,7 +10,8 @@
*/
#include <arch_helpers.h>
-#include <platform.h>
+#include <plat/common/platform.h>
+
#include "pm_api_clock.h"
#include "pm_api_ioctl.h"
#include "pm_api_pinctrl.h"
diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_sys.h b/plat/xilinx/zynqmp/pm_service/pm_api_sys.h
index fee91cdd9..a0040cf8d 100644
--- a/plat/xilinx/zynqmp/pm_service/pm_api_sys.h
+++ b/plat/xilinx/zynqmp/pm_service/pm_api_sys.h
@@ -8,6 +8,7 @@
#define PM_API_SYS_H
#include <stdint.h>
+
#include "pm_defs.h"
enum pm_query_id {
diff --git a/plat/xilinx/zynqmp/pm_service/pm_client.c b/plat/xilinx/zynqmp/pm_service/pm_client.c
index 874b8a9ea..bebb74ce7 100644
--- a/plat/xilinx/zynqmp/pm_service/pm_client.c
+++ b/plat/xilinx/zynqmp/pm_service/pm_client.c
@@ -10,13 +10,15 @@
*/
#include <assert.h>
-#include <bakery_lock.h>
-#include <bl_common.h>
-#include <gic_common.h>
-#include <gicv2.h>
-#include <mmio.h>
#include <string.h>
-#include <utils.h>
+
+#include <common/bl_common.h>
+#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gicv2.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+#include <lib/utils.h>
+
#include "../zynqmp_def.h"
#include "pm_api_sys.h"
#include "pm_client.h"
diff --git a/plat/xilinx/zynqmp/pm_service/pm_common.h b/plat/xilinx/zynqmp/pm_service/pm_common.h
index 54746271f..94e0568f6 100644
--- a/plat/xilinx/zynqmp/pm_service/pm_common.h
+++ b/plat/xilinx/zynqmp/pm_service/pm_common.h
@@ -12,8 +12,10 @@
#ifndef PM_COMMON_H
#define PM_COMMON_H
-#include <debug.h>
#include <stdint.h>
+
+#include <common/debug.h>
+
#include "pm_defs.h"
#define PAYLOAD_ARG_CNT 6U
diff --git a/plat/xilinx/zynqmp/pm_service/pm_ipi.c b/plat/xilinx/zynqmp/pm_service/pm_ipi.c
index dc1ea4d12..b3d833dfe 100644
--- a/plat/xilinx/zynqmp/pm_service/pm_ipi.c
+++ b/plat/xilinx/zynqmp/pm_service/pm_ipi.c
@@ -5,9 +5,10 @@
*/
#include <arch_helpers.h>
-#include <bakery_lock.h>
-#include <mmio.h>
-#include <platform.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include "../zynqmp_ipi.h"
#include "../zynqmp_private.h"
#include "pm_ipi.h"
diff --git a/plat/xilinx/zynqmp/pm_service/pm_svc_main.c b/plat/xilinx/zynqmp/pm_service/pm_svc_main.c
index 7790c979d..c88591552 100644
--- a/plat/xilinx/zynqmp/pm_service/pm_svc_main.c
+++ b/plat/xilinx/zynqmp/pm_service/pm_svc_main.c
@@ -10,18 +10,20 @@
*/
#include <errno.h>
-#include <runtime_svc.h>
+
+#include <common/runtime_svc.h>
+#if ZYNQMP_WDT_RESTART
+#include <arch_helpers.h>
+#include <drivers/arm/gicv2.h>
+#include <lib/mmio.h>
+#include <lib/spinlock.h>
+#include <plat/common/platform.h>
+#endif
+
#include "../zynqmp_private.h"
#include "pm_api_sys.h"
#include "pm_client.h"
#include "pm_ipi.h"
-#if ZYNQMP_WDT_RESTART
-#include <arch_helpers.h>
-#include <gicv2.h>
-#include <mmio.h>
-#include <platform.h>
-#include <spinlock.h>
-#endif
#define PM_SET_SUSPEND_MODE 0xa02
#define PM_GET_TRUSTZONE_VERSION 0xa03
diff --git a/plat/xilinx/zynqmp/sip_svc_setup.c b/plat/xilinx/zynqmp/sip_svc_setup.c
index 9fe709db9..8d23a014c 100644
--- a/plat/xilinx/zynqmp/sip_svc_setup.c
+++ b/plat/xilinx/zynqmp/sip_svc_setup.c
@@ -6,8 +6,9 @@
/* Top level SMC handler for SiP calls. Dispatch PM calls to PM SMC handler. */
-#include <runtime_svc.h>
-#include <uuid.h>
+#include <common/runtime_svc.h>
+#include <tools_share/uuid.h>
+
#include "ipi_mailbox_svc.h"
#include "pm_svc_main.h"
#include "zynqmp_ipi.h"
diff --git a/plat/xilinx/zynqmp/tsp/tsp_plat_setup.c b/plat/xilinx/zynqmp/tsp/tsp_plat_setup.c
index a27f34b45..25359f91a 100644
--- a/plat/xilinx/zynqmp/tsp/tsp_plat_setup.c
+++ b/plat/xilinx/zynqmp/tsp/tsp_plat_setup.c
@@ -4,11 +4,13 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
-#include <console.h>
-#include <debug.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+
#include <plat_arm.h>
#include <platform_tsp.h>
+
#include "../zynqmp_private.h"
#define BL32_END (unsigned long)(&__BL32_END__)
diff --git a/plat/xilinx/zynqmp/zynqmp_def.h b/plat/xilinx/zynqmp/zynqmp_def.h
index ba382dd8b..f75530e7f 100644
--- a/plat/xilinx/zynqmp/zynqmp_def.h
+++ b/plat/xilinx/zynqmp/zynqmp_def.h
@@ -7,7 +7,7 @@
#ifndef ZYNQMP_DEF_H
#define ZYNQMP_DEF_H
-#include <common_def.h>
+#include <plat/common/common_def.h>
#define ZYNQMP_CONSOLE_ID_cadence 1
#define ZYNQMP_CONSOLE_ID_cadence0 1
diff --git a/plat/xilinx/zynqmp/zynqmp_ipi.c b/plat/xilinx/zynqmp/zynqmp_ipi.c
index 5038f8477..54b18380d 100644
--- a/plat/xilinx/zynqmp/zynqmp_ipi.c
+++ b/plat/xilinx/zynqmp/zynqmp_ipi.c
@@ -8,12 +8,14 @@
* Zynq UltraScale+ MPSoC IPI agent registers access management
*/
-#include <bakery_lock.h>
-#include <debug.h>
#include <errno.h>
-#include <mmio.h>
-#include <runtime_svc.h>
#include <string.h>
+
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+
#include "zynqmp_ipi.h"
#include "../zynqmp_private.h"
diff --git a/plat/xilinx/zynqmp/zynqmp_private.h b/plat/xilinx/zynqmp/zynqmp_private.h
index 8a8d38abf..a8ebcebee 100644
--- a/plat/xilinx/zynqmp/zynqmp_private.h
+++ b/plat/xilinx/zynqmp/zynqmp_private.h
@@ -7,10 +7,11 @@
#ifndef ZYNQMP_PRIVATE_H
#define ZYNQMP_PRIVATE_H
-#include <bl_common.h>
-#include <interrupt_mgmt.h>
#include <stdint.h>
+#include <bl31/interrupt_mgmt.h>
+#include <common/bl_common.h>
+
void zynqmp_config_setup(void);
unsigned int zynqmp_calc_core_pos(u_register_t mpidr);