From 4ecca33988b90de43ec4f4a929094a38a23fda31 Mon Sep 17 00:00:00 2001
From: Dan Handley <dan.handley@arm.com>
Date: Wed, 9 Apr 2014 12:48:25 +0100
Subject: [PATCH] Move include and source files to logical locations

Move almost all system include files to a logical sub-directory
under ./include. The only remaining system include directories
not under ./include are specific to the platform. Move the
corresponding source files to match the include directory
structure.

Also remove pm.h as it is no longer used.

Change-Id: Ie5ea6368ec5fad459f3e8a802ad129135527f0b3
---
 Makefile                                      | 18 +++--
 bl1/bl1.mk                                    |  9 +--
 bl2/bl2.mk                                    |  6 +-
 bl31/bl31.mk                                  | 12 ++--
 {common => bl31}/runtime_svc.c                |  0
 bl32/tsp/tsp.mk                               |  6 +-
 .../{interconnect/cci-400 => cci400}/cci400.c |  6 +-
 .../arm}/gic/aarch64/gic_v3_sysregs.S         |  0
 {arch/system => drivers/arm}/gic/gic_v2.c     |  0
 {arch/system => drivers/arm}/gic/gic_v3.c     |  0
 drivers/arm/{peripherals => }/pl011/pl011.c   |  0
 .../{peripherals => }/pl011/pl011_console.c   |  0
 .../{interconnect/tzc-400 => tzc400}/tzc400.c |  0
 include/{ => bl1}/bl1.h                       |  0
 include/{ => bl2}/bl2.h                       |  0
 include/{ => bl31}/bl31.h                     |  0
 include/{ => bl31}/cm_macros.S                |  0
 include/{ => bl31}/context.h                  |  0
 include/{ => bl31}/context_mgmt.h             |  0
 include/{ => bl31}/runtime_svc.h              |  0
 include/{ => bl31/services}/psci.h            |  0
 include/{ => bl31/services}/std_svc.h         |  0
 include/{ => bl32}/bl32.h                     |  0
 include/{ => bl32/payloads}/tsp.h             |  0
 include/{ => common}/asm_macros.S             |  0
 include/{ => common}/bl_common.h              | 23 ++++---
 include/{ => common}/debug.h                  |  0
 include/{ => common}/firmware_image_package.h |  0
 .../cci-400 => include/drivers/arm}/cci400.h  |  0
 .../system/gic => include/drivers/arm}/gic.h  |  0
 .../gic => include/drivers/arm}/gic_v2.h      |  0
 .../gic => include/drivers/arm}/gic_v3.h      |  0
 .../pl011 => include/drivers/arm}/pl011.h     |  0
 .../tzc-400 => include/drivers/arm}/tzc400.h  |  0
 .../console => include/drivers}/console.h     |  0
 {drivers/power => include/drivers}/fvp_pwrc.h |  0
 {drivers/io => include/drivers}/io_driver.h   |  0
 {drivers/io => include/drivers}/io_fip.h      |  0
 {drivers/io => include/drivers}/io_memmap.h   |  0
 .../io => include/drivers}/io_semihosting.h   |  0
 include/{ => lib}/aarch64/arch.h              |  0
 include/{ => lib}/aarch64/arch_helpers.h      |  0
 include/{ => lib}/aarch64/xlat_tables.h       |  0
 include/{ => lib}/bakery_lock.h               |  8 +--
 include/{ => lib}/io_storage.h                |  0
 include/{ => lib}/mmio.h                      |  0
 include/{ => lib}/semihosting.h               |  0
 include/{ => lib}/spinlock.h                  |  0
 include/pm.h                                  | 66 -------------------
 lib/{arch => }/aarch64/cache_helpers.S        |  0
 .../aarch64/cpu => lib/aarch64}/cpu_helpers.S |  0
 lib/{arch => }/aarch64/misc_helpers.S         |  0
 lib/{arch => }/aarch64/sysreg_helpers.S       |  0
 lib/{arch => }/aarch64/tlb_helpers.S          |  0
 lib/{arch => }/aarch64/xlat_helpers.c         |  0
 lib/{arch => }/aarch64/xlat_tables.c          |  0
 lib/{sync => }/locks/bakery/bakery_lock.c     |  6 +-
 lib/{sync => }/locks/exclusive/spinlock.S     |  0
 plat/fvp/platform.mk                          | 29 ++++----
 services/spd/tspd/tspd.mk                     |  2 +-
 tools/fip_create/firmware_image_package.h     |  2 +-
 61 files changed, 64 insertions(+), 129 deletions(-)
 rename {common => bl31}/runtime_svc.c (100%)
 rename drivers/arm/{interconnect/cci-400 => cci400}/cci400.c (99%)
 rename {arch/system => drivers/arm}/gic/aarch64/gic_v3_sysregs.S (100%)
 rename {arch/system => drivers/arm}/gic/gic_v2.c (100%)
 rename {arch/system => drivers/arm}/gic/gic_v3.c (100%)
 rename drivers/arm/{peripherals => }/pl011/pl011.c (100%)
 rename drivers/arm/{peripherals => }/pl011/pl011_console.c (100%)
 rename drivers/arm/{interconnect/tzc-400 => tzc400}/tzc400.c (100%)
 rename include/{ => bl1}/bl1.h (100%)
 rename include/{ => bl2}/bl2.h (100%)
 rename include/{ => bl31}/bl31.h (100%)
 rename include/{ => bl31}/cm_macros.S (100%)
 rename include/{ => bl31}/context.h (100%)
 rename include/{ => bl31}/context_mgmt.h (100%)
 rename include/{ => bl31}/runtime_svc.h (100%)
 rename include/{ => bl31/services}/psci.h (100%)
 rename include/{ => bl31/services}/std_svc.h (100%)
 rename include/{ => bl32}/bl32.h (100%)
 rename include/{ => bl32/payloads}/tsp.h (100%)
 rename include/{ => common}/asm_macros.S (100%)
 rename include/{ => common}/bl_common.h (94%)
 rename include/{ => common}/debug.h (100%)
 rename include/{ => common}/firmware_image_package.h (100%)
 rename {drivers/arm/interconnect/cci-400 => include/drivers/arm}/cci400.h (100%)
 rename {arch/system/gic => include/drivers/arm}/gic.h (100%)
 rename {arch/system/gic => include/drivers/arm}/gic_v2.h (100%)
 rename {arch/system/gic => include/drivers/arm}/gic_v3.h (100%)
 rename {drivers/arm/peripherals/pl011 => include/drivers/arm}/pl011.h (100%)
 rename {drivers/arm/interconnect/tzc-400 => include/drivers/arm}/tzc400.h (100%)
 rename {drivers/console => include/drivers}/console.h (100%)
 rename {drivers/power => include/drivers}/fvp_pwrc.h (100%)
 rename {drivers/io => include/drivers}/io_driver.h (100%)
 rename {drivers/io => include/drivers}/io_fip.h (100%)
 rename {drivers/io => include/drivers}/io_memmap.h (100%)
 rename {drivers/io => include/drivers}/io_semihosting.h (100%)
 rename include/{ => lib}/aarch64/arch.h (100%)
 rename include/{ => lib}/aarch64/arch_helpers.h (100%)
 rename include/{ => lib}/aarch64/xlat_tables.h (100%)
 rename include/{ => lib}/bakery_lock.h (89%)
 rename include/{ => lib}/io_storage.h (100%)
 rename include/{ => lib}/mmio.h (100%)
 rename include/{ => lib}/semihosting.h (100%)
 rename include/{ => lib}/spinlock.h (100%)
 delete mode 100644 include/pm.h
 rename lib/{arch => }/aarch64/cache_helpers.S (100%)
 rename {arch/aarch64/cpu => lib/aarch64}/cpu_helpers.S (100%)
 rename lib/{arch => }/aarch64/misc_helpers.S (100%)
 rename lib/{arch => }/aarch64/sysreg_helpers.S (100%)
 rename lib/{arch => }/aarch64/tlb_helpers.S (100%)
 rename lib/{arch => }/aarch64/xlat_helpers.c (100%)
 rename lib/{arch => }/aarch64/xlat_tables.c (100%)
 rename lib/{sync => }/locks/bakery/bakery_lock.c (98%)
 rename lib/{sync => }/locks/exclusive/spinlock.S (100%)

diff --git a/Makefile b/Makefile
index f4b74fee91..aa9b0a1dc4 100644
--- a/Makefile
+++ b/Makefile
@@ -132,14 +132,20 @@ endif
 .SUFFIXES:
 
 
-INCLUDES		+=	-Ilib/include/			\
-				-Idrivers/io			\
-				-Iinclude/${ARCH}/		\
-				-Iinclude/			\
-				-Iarch/system/gic		\
-				-Iservices/std_svc/psci		\
+INCLUDES		+=	-Iinclude/bl1			\
+				-Iinclude/bl2			\
+				-Iinclude/bl31			\
+				-Iinclude/bl31/services		\
+				-Iinclude/bl32			\
+				-Iinclude/bl32/payloads		\
+				-Iinclude/common		\
+				-Iinclude/drivers		\
+				-Iinclude/drivers/arm		\
+				-Iinclude/lib			\
+				-Iinclude/lib/aarch64		\
 				-Iinclude/stdlib		\
 				-Iinclude/stdlib/sys		\
+				-Iservices/std_svc/psci		\
 				-Iplat/${PLAT}			\
 				${PLAT_INCLUDES}		\
 				${SPD_INCLUDES}
diff --git a/bl1/bl1.mk b/bl1/bl1.mk
index c2101b0563..60609ea25e 100644
--- a/bl1/bl1.mk
+++ b/bl1/bl1.mk
@@ -32,15 +32,12 @@ vpath			%.c	plat/${PLAT}		\
 				plat/${PLAT}/${ARCH}	\
 				common			\
 				lib			\
-				arch/${ARCH}		\
-				lib/arch/${ARCH}	\
+				lib/${ARCH}		\
 				${PLAT_BL1_C_VPATH}
 
-vpath			%.S	arch/${ARCH}/cpu	\
-				plat/common/${ARCH}	\
+vpath			%.S	plat/common/${ARCH}	\
 				plat/${PLAT}/${ARCH}	\
-				include			\
-				lib/arch/${ARCH}	\
+				lib/${ARCH}		\
 				${PLAT_BL1_S_VPATH}
 
 BL1_SOURCES		+=	bl1_arch_setup.c	\
diff --git a/bl2/bl2.mk b/bl2/bl2.mk
index d53c1aa153..3ecaff9e5c 100644
--- a/bl2/bl2.mk
+++ b/bl2/bl2.mk
@@ -32,12 +32,10 @@ vpath			%.c	common				\
 				lib				\
 				plat/${PLAT}			\
 				plat/${PLAT}/${ARCH}		\
-				arch/${ARCH}			\
 				${PLAT_BL2_C_VPATH}
 
-vpath			%.S	lib/arch/${ARCH}		\
-				include				\
-				lib/sync/locks/exclusive	\
+vpath			%.S	lib/${ARCH}			\
+				lib/locks/exclusive		\
 				common/${ARCH}			\
 				${PLAT_BL2_S_VPATH}
 
diff --git a/bl31/bl31.mk b/bl31/bl31.mk
index 38765bcceb..420597c0ce 100644
--- a/bl31/bl31.mk
+++ b/bl31/bl31.mk
@@ -30,23 +30,21 @@
 
 vpath			%.c	common					\
 				lib					\
-				arch/system/gic				\
+				drivers/arm/gic				\
 				plat/${PLAT}				\
-				arch/${ARCH}				\
 				services/std_svc			\
 				services/std_svc/psci			\
-				lib/sync/locks/bakery			\
+				lib/locks/bakery			\
 				plat/${PLAT}/${ARCH}			\
 				${PLAT_BL31_C_VPATH}
 
-vpath			%.S	lib/arch/${ARCH}			\
+vpath			%.S	lib/${ARCH}				\
 				services/std_svc			\
 				services/std_svc/psci			\
-				include					\
 				plat/${PLAT}/${ARCH}			\
-				lib/sync/locks/exclusive		\
+				lib/locks/exclusive			\
 				plat/common/${ARCH}			\
-				arch/system/gic/${ARCH}			\
+				drivers/arm/gic/${ARCH}			\
 				common/${ARCH}				\
 				${PLAT_BL31_S_VPATH}
 
diff --git a/common/runtime_svc.c b/bl31/runtime_svc.c
similarity index 100%
rename from common/runtime_svc.c
rename to bl31/runtime_svc.c
diff --git a/bl32/tsp/tsp.mk b/bl32/tsp/tsp.mk
index 2aedf61a70..d07b18b85c 100644
--- a/bl32/tsp/tsp.mk
+++ b/bl32/tsp/tsp.mk
@@ -32,11 +32,9 @@ vpath			%.c	common				\
 				lib				\
 				plat/${PLAT}			\
 				plat/${PLAT}/${ARCH}		\
-				arch/${ARCH}
 
-vpath			%.S	lib/arch/${ARCH}		\
-				include				\
-				lib/sync/locks/exclusive	\
+vpath			%.S	lib/${ARCH}			\
+				lib/locks/exclusive		\
 				common/${ARCH}
 
 BL32_SOURCES		+=	tsp_entrypoint.S		\
diff --git a/drivers/arm/interconnect/cci-400/cci400.c b/drivers/arm/cci400/cci400.c
similarity index 99%
rename from drivers/arm/interconnect/cci-400/cci400.c
rename to drivers/arm/cci400/cci400.c
index cd5446fad4..4ca55b18bf 100644
--- a/drivers/arm/interconnect/cci-400/cci400.c
+++ b/drivers/arm/cci400/cci400.c
@@ -44,7 +44,8 @@ void cci_enable_coherency(unsigned long mpidr)
 		      DVM_EN_BIT | SNOOP_EN_BIT);
 
 	/* Wait for the dust to settle down */
-	while (mmio_read_32(CCI400_BASE + STATUS_REG) & CHANGE_PENDING_BIT);
+	while (mmio_read_32(CCI400_BASE + STATUS_REG) & CHANGE_PENDING_BIT)
+		;
 }
 
 void cci_disable_coherency(unsigned long mpidr)
@@ -54,6 +55,7 @@ void cci_disable_coherency(unsigned long mpidr)
 		      ~(DVM_EN_BIT | SNOOP_EN_BIT));
 
 	/* Wait for the dust to settle down */
-	while (mmio_read_32(CCI400_BASE + STATUS_REG) & CHANGE_PENDING_BIT);
+	while (mmio_read_32(CCI400_BASE + STATUS_REG) & CHANGE_PENDING_BIT)
+		;
 }
 
diff --git a/arch/system/gic/aarch64/gic_v3_sysregs.S b/drivers/arm/gic/aarch64/gic_v3_sysregs.S
similarity index 100%
rename from arch/system/gic/aarch64/gic_v3_sysregs.S
rename to drivers/arm/gic/aarch64/gic_v3_sysregs.S
diff --git a/arch/system/gic/gic_v2.c b/drivers/arm/gic/gic_v2.c
similarity index 100%
rename from arch/system/gic/gic_v2.c
rename to drivers/arm/gic/gic_v2.c
diff --git a/arch/system/gic/gic_v3.c b/drivers/arm/gic/gic_v3.c
similarity index 100%
rename from arch/system/gic/gic_v3.c
rename to drivers/arm/gic/gic_v3.c
diff --git a/drivers/arm/peripherals/pl011/pl011.c b/drivers/arm/pl011/pl011.c
similarity index 100%
rename from drivers/arm/peripherals/pl011/pl011.c
rename to drivers/arm/pl011/pl011.c
diff --git a/drivers/arm/peripherals/pl011/pl011_console.c b/drivers/arm/pl011/pl011_console.c
similarity index 100%
rename from drivers/arm/peripherals/pl011/pl011_console.c
rename to drivers/arm/pl011/pl011_console.c
diff --git a/drivers/arm/interconnect/tzc-400/tzc400.c b/drivers/arm/tzc400/tzc400.c
similarity index 100%
rename from drivers/arm/interconnect/tzc-400/tzc400.c
rename to drivers/arm/tzc400/tzc400.c
diff --git a/include/bl1.h b/include/bl1/bl1.h
similarity index 100%
rename from include/bl1.h
rename to include/bl1/bl1.h
diff --git a/include/bl2.h b/include/bl2/bl2.h
similarity index 100%
rename from include/bl2.h
rename to include/bl2/bl2.h
diff --git a/include/bl31.h b/include/bl31/bl31.h
similarity index 100%
rename from include/bl31.h
rename to include/bl31/bl31.h
diff --git a/include/cm_macros.S b/include/bl31/cm_macros.S
similarity index 100%
rename from include/cm_macros.S
rename to include/bl31/cm_macros.S
diff --git a/include/context.h b/include/bl31/context.h
similarity index 100%
rename from include/context.h
rename to include/bl31/context.h
diff --git a/include/context_mgmt.h b/include/bl31/context_mgmt.h
similarity index 100%
rename from include/context_mgmt.h
rename to include/bl31/context_mgmt.h
diff --git a/include/runtime_svc.h b/include/bl31/runtime_svc.h
similarity index 100%
rename from include/runtime_svc.h
rename to include/bl31/runtime_svc.h
diff --git a/include/psci.h b/include/bl31/services/psci.h
similarity index 100%
rename from include/psci.h
rename to include/bl31/services/psci.h
diff --git a/include/std_svc.h b/include/bl31/services/std_svc.h
similarity index 100%
rename from include/std_svc.h
rename to include/bl31/services/std_svc.h
diff --git a/include/bl32.h b/include/bl32/bl32.h
similarity index 100%
rename from include/bl32.h
rename to include/bl32/bl32.h
diff --git a/include/tsp.h b/include/bl32/payloads/tsp.h
similarity index 100%
rename from include/tsp.h
rename to include/bl32/payloads/tsp.h
diff --git a/include/asm_macros.S b/include/common/asm_macros.S
similarity index 100%
rename from include/asm_macros.S
rename to include/common/asm_macros.S
diff --git a/include/bl_common.h b/include/common/bl_common.h
similarity index 94%
rename from include/bl_common.h
rename to include/common/bl_common.h
index ba6dc11018..a751d78a8b 100644
--- a/include/bl_common.h
+++ b/include/common/bl_common.h
@@ -127,19 +127,22 @@ extern void __dead2 raise_el(aapcs64_params *);
 extern void __dead2 change_el(el_change_info *);
 extern unsigned long make_spsr(unsigned long, unsigned long, unsigned long);
 extern void init_bl2_mem_layout(meminfo *,
-			        meminfo *,
-			        unsigned int,
-			        unsigned long) __attribute__((weak));
+				meminfo *,
+				unsigned int,
+				unsigned long) __attribute__((weak));
 extern void init_bl31_mem_layout(const meminfo *,
-				 meminfo *,
-				 unsigned int) __attribute__((weak));
+				meminfo *,
+				unsigned int) __attribute__((weak));
 extern unsigned long image_size(const char *);
-extern unsigned long load_image(meminfo *, const char *, unsigned int, unsigned long);
+extern unsigned long load_image(meminfo *,
+				const char *,
+				unsigned int,
+				unsigned long);
 extern void __dead2 run_image(unsigned long entrypoint,
-			      unsigned long spsr,
-			      unsigned long security_state,
-			      void *first_arg,
-			      void *second_arg);
+				unsigned long spsr,
+				unsigned long security_state,
+				void *first_arg,
+				void *second_arg);
 extern unsigned long *get_el_change_mem_ptr(void);
 extern const char build_message[];
 
diff --git a/include/debug.h b/include/common/debug.h
similarity index 100%
rename from include/debug.h
rename to include/common/debug.h
diff --git a/include/firmware_image_package.h b/include/common/firmware_image_package.h
similarity index 100%
rename from include/firmware_image_package.h
rename to include/common/firmware_image_package.h
diff --git a/drivers/arm/interconnect/cci-400/cci400.h b/include/drivers/arm/cci400.h
similarity index 100%
rename from drivers/arm/interconnect/cci-400/cci400.h
rename to include/drivers/arm/cci400.h
diff --git a/arch/system/gic/gic.h b/include/drivers/arm/gic.h
similarity index 100%
rename from arch/system/gic/gic.h
rename to include/drivers/arm/gic.h
diff --git a/arch/system/gic/gic_v2.h b/include/drivers/arm/gic_v2.h
similarity index 100%
rename from arch/system/gic/gic_v2.h
rename to include/drivers/arm/gic_v2.h
diff --git a/arch/system/gic/gic_v3.h b/include/drivers/arm/gic_v3.h
similarity index 100%
rename from arch/system/gic/gic_v3.h
rename to include/drivers/arm/gic_v3.h
diff --git a/drivers/arm/peripherals/pl011/pl011.h b/include/drivers/arm/pl011.h
similarity index 100%
rename from drivers/arm/peripherals/pl011/pl011.h
rename to include/drivers/arm/pl011.h
diff --git a/drivers/arm/interconnect/tzc-400/tzc400.h b/include/drivers/arm/tzc400.h
similarity index 100%
rename from drivers/arm/interconnect/tzc-400/tzc400.h
rename to include/drivers/arm/tzc400.h
diff --git a/drivers/console/console.h b/include/drivers/console.h
similarity index 100%
rename from drivers/console/console.h
rename to include/drivers/console.h
diff --git a/drivers/power/fvp_pwrc.h b/include/drivers/fvp_pwrc.h
similarity index 100%
rename from drivers/power/fvp_pwrc.h
rename to include/drivers/fvp_pwrc.h
diff --git a/drivers/io/io_driver.h b/include/drivers/io_driver.h
similarity index 100%
rename from drivers/io/io_driver.h
rename to include/drivers/io_driver.h
diff --git a/drivers/io/io_fip.h b/include/drivers/io_fip.h
similarity index 100%
rename from drivers/io/io_fip.h
rename to include/drivers/io_fip.h
diff --git a/drivers/io/io_memmap.h b/include/drivers/io_memmap.h
similarity index 100%
rename from drivers/io/io_memmap.h
rename to include/drivers/io_memmap.h
diff --git a/drivers/io/io_semihosting.h b/include/drivers/io_semihosting.h
similarity index 100%
rename from drivers/io/io_semihosting.h
rename to include/drivers/io_semihosting.h
diff --git a/include/aarch64/arch.h b/include/lib/aarch64/arch.h
similarity index 100%
rename from include/aarch64/arch.h
rename to include/lib/aarch64/arch.h
diff --git a/include/aarch64/arch_helpers.h b/include/lib/aarch64/arch_helpers.h
similarity index 100%
rename from include/aarch64/arch_helpers.h
rename to include/lib/aarch64/arch_helpers.h
diff --git a/include/aarch64/xlat_tables.h b/include/lib/aarch64/xlat_tables.h
similarity index 100%
rename from include/aarch64/xlat_tables.h
rename to include/lib/aarch64/xlat_tables.h
diff --git a/include/bakery_lock.h b/include/lib/bakery_lock.h
similarity index 89%
rename from include/bakery_lock.h
rename to include/lib/bakery_lock.h
index da5d9dd162..6e6e966350 100644
--- a/include/bakery_lock.h
+++ b/include/lib/bakery_lock.h
@@ -44,10 +44,10 @@ typedef struct {
 
 #define NO_OWNER (-1)
 
-void bakery_lock_init(bakery_lock* bakery);
-void bakery_lock_get(unsigned long mpidr, bakery_lock* bakery);
-void bakery_lock_release(unsigned long mpidr, bakery_lock* bakery);
-int bakery_lock_try(unsigned long mpidr, bakery_lock* bakery);
+void bakery_lock_init(bakery_lock *bakery);
+void bakery_lock_get(unsigned long mpidr, bakery_lock *bakery);
+void bakery_lock_release(unsigned long mpidr, bakery_lock *bakery);
+int bakery_lock_try(unsigned long mpidr, bakery_lock *bakery);
 #endif /*__ASSEMBLY__*/
 
 #endif /* __BAKERY_LOCK_H__ */
diff --git a/include/io_storage.h b/include/lib/io_storage.h
similarity index 100%
rename from include/io_storage.h
rename to include/lib/io_storage.h
diff --git a/include/mmio.h b/include/lib/mmio.h
similarity index 100%
rename from include/mmio.h
rename to include/lib/mmio.h
diff --git a/include/semihosting.h b/include/lib/semihosting.h
similarity index 100%
rename from include/semihosting.h
rename to include/lib/semihosting.h
diff --git a/include/spinlock.h b/include/lib/spinlock.h
similarity index 100%
rename from include/spinlock.h
rename to include/lib/spinlock.h
diff --git a/include/pm.h b/include/pm.h
deleted file mode 100644
index bfdbf672cf..0000000000
--- a/include/pm.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * Neither the name of ARM nor the names of its contributors may be used
- * to endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __PM_H__
-#define __PM_H__
-
-#ifndef __ASSEMBLY__
-
-/*******************************************************************************
- * Structure populated by platform specific code to export routines which
- * perform common low level pm functions
- ******************************************************************************/
-typedef struct {
-	int (*cpu_on)(unsigned long);
-	int (*cpu_off)(unsigned long);
-	int (*cpu_suspend)(unsigned long);
-	int (*affinity_info)(unsigned long, unsigned int);
-} pm_frontend_ops;
-
-/*******************************************************************************
- * Structure populated by a generic power management api implementation e.g.
- * psci to perform api specific bits after a cpu has been turned on.
- ******************************************************************************/
-typedef struct {
-	unsigned long (*cpu_off_finisher)(unsigned long);
-	unsigned long (*cpu_suspend_finisher)(unsigned long);
-} pm_backend_ops;
-
-/*******************************************************************************
- * Function & variable prototypes
- ******************************************************************************/
-extern pm_frontend_ops *get_pm_frontend_ops(void);
-extern pm_backend_ops *get_pm_backend_ops(void);
-extern void set_pm_frontend_ops(pm_frontend_ops *);
-extern void set_pm_backend_ops(pm_backend_ops *);
-
-#endif /*__ASSEMBLY__*/
-
-#endif /* __PM_H__ */
diff --git a/lib/arch/aarch64/cache_helpers.S b/lib/aarch64/cache_helpers.S
similarity index 100%
rename from lib/arch/aarch64/cache_helpers.S
rename to lib/aarch64/cache_helpers.S
diff --git a/arch/aarch64/cpu/cpu_helpers.S b/lib/aarch64/cpu_helpers.S
similarity index 100%
rename from arch/aarch64/cpu/cpu_helpers.S
rename to lib/aarch64/cpu_helpers.S
diff --git a/lib/arch/aarch64/misc_helpers.S b/lib/aarch64/misc_helpers.S
similarity index 100%
rename from lib/arch/aarch64/misc_helpers.S
rename to lib/aarch64/misc_helpers.S
diff --git a/lib/arch/aarch64/sysreg_helpers.S b/lib/aarch64/sysreg_helpers.S
similarity index 100%
rename from lib/arch/aarch64/sysreg_helpers.S
rename to lib/aarch64/sysreg_helpers.S
diff --git a/lib/arch/aarch64/tlb_helpers.S b/lib/aarch64/tlb_helpers.S
similarity index 100%
rename from lib/arch/aarch64/tlb_helpers.S
rename to lib/aarch64/tlb_helpers.S
diff --git a/lib/arch/aarch64/xlat_helpers.c b/lib/aarch64/xlat_helpers.c
similarity index 100%
rename from lib/arch/aarch64/xlat_helpers.c
rename to lib/aarch64/xlat_helpers.c
diff --git a/lib/arch/aarch64/xlat_tables.c b/lib/aarch64/xlat_tables.c
similarity index 100%
rename from lib/arch/aarch64/xlat_tables.c
rename to lib/aarch64/xlat_tables.c
diff --git a/lib/sync/locks/bakery/bakery_lock.c b/lib/locks/bakery/bakery_lock.c
similarity index 98%
rename from lib/sync/locks/bakery/bakery_lock.c
rename to lib/locks/bakery/bakery_lock.c
index ec081352fe..03f1e74b0b 100644
--- a/lib/sync/locks/bakery/bakery_lock.c
+++ b/lib/locks/bakery/bakery_lock.c
@@ -59,14 +59,14 @@
 #define assert_bakery_entry_valid(entry, bakery) do {	\
 	assert(bakery);					\
 	assert(entry < BAKERY_LOCK_MAX_CPUS);		\
-} while(0)
+} while (0)
 
 /* Convert a ticket to priority */
 #define PRIORITY(t, pos)	(((t) << 8) | (pos))
 
 
 /* Initialize Bakery Lock to reset ownership and all ticket values */
-void bakery_lock_init(bakery_lock * bakery)
+void bakery_lock_init(bakery_lock *bakery)
 {
 	assert(bakery);
 
@@ -176,7 +176,7 @@ void bakery_lock_get(unsigned long mpidr, bakery_lock *bakery)
 
 
 /* Release the lock and signal contenders */
-void bakery_lock_release(unsigned long mpidr, bakery_lock * bakery)
+void bakery_lock_release(unsigned long mpidr, bakery_lock *bakery)
 {
 	unsigned int me = platform_get_core_pos(mpidr);
 
diff --git a/lib/sync/locks/exclusive/spinlock.S b/lib/locks/exclusive/spinlock.S
similarity index 100%
rename from lib/sync/locks/exclusive/spinlock.S
rename to lib/locks/exclusive/spinlock.S
diff --git a/plat/fvp/platform.mk b/plat/fvp/platform.mk
index 0fc45de68c..2b904ee0da 100644
--- a/plat/fvp/platform.mk
+++ b/plat/fvp/platform.mk
@@ -28,34 +28,33 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-PLAT_INCLUDES		:=	-Idrivers/arm/interconnect/cci-400	\
-				-Idrivers/arm/interconnect/tzc-400	\
-				-Idrivers/console			\
-				-Idrivers/arm/peripherals/pl011		\
-				-Idrivers/power
+#
+# No additional platform system include directories required
+#
+# PLAT_INCLUDES		:=
 
-PLAT_BL1_C_VPATH	:=	drivers/arm/interconnect/cci-400	\
-				drivers/arm/peripherals/pl011		\
-				lib/arch/${ARCH}			\
+PLAT_BL1_C_VPATH	:=	drivers/arm/cci400			\
+				drivers/arm/pl011			\
+				lib/${ARCH}				\
 				lib/semihosting				\
 				lib/stdlib				\
 				drivers/io
 
 PLAT_BL1_S_VPATH	:=	lib/semihosting/${ARCH}
 
-PLAT_BL2_C_VPATH	:=	drivers/arm/interconnect/cci-400	\
-				drivers/arm/interconnect/tzc-400	\
-				drivers/arm/peripherals/pl011		\
-				lib/arch/${ARCH}			\
+PLAT_BL2_C_VPATH	:=	drivers/arm/cci400			\
+				drivers/arm/pl011			\
+				drivers/arm/tzc400			\
+				lib/${ARCH}				\
 				lib/stdlib				\
 				lib/semihosting				\
 				drivers/io
 
 PLAT_BL2_S_VPATH	:=	lib/semihosting/${ARCH}
 
-PLAT_BL31_C_VPATH	:=	drivers/arm/interconnect/cci-400	\
-				drivers/arm/peripherals/pl011		\
-				lib/arch/${ARCH}			\
+PLAT_BL31_C_VPATH	:=	drivers/arm/cci-400			\
+				drivers/arm/pl011			\
+				lib/${ARCH}				\
 				lib/semihosting				\
 				lib/stdlib				\
 				drivers/power				\
diff --git a/services/spd/tspd/tspd.mk b/services/spd/tspd/tspd.mk
index bbf9f6717b..532e168d00 100644
--- a/services/spd/tspd/tspd.mk
+++ b/services/spd/tspd/tspd.mk
@@ -29,7 +29,7 @@
 #
 
 TSPD_DIR		:=	services/spd/tspd
-SPD_INCLUDES		:=	-Iinclude/spd/tspd	\
+SPD_INCLUDES		:=	-Iinclude/bl32/payloads	\
 				-I${TSPD_DIR}
 
 SPD_SOURCES		:=	tspd_common.c		\
diff --git a/tools/fip_create/firmware_image_package.h b/tools/fip_create/firmware_image_package.h
index 2c0d0177ad..cc61903ed0 120000
--- a/tools/fip_create/firmware_image_package.h
+++ b/tools/fip_create/firmware_image_package.h
@@ -1 +1 @@
-../../include/firmware_image_package.h
\ No newline at end of file
+../../include/common/firmware_image_package.h
\ No newline at end of file
-- 
GitLab