summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoby Mathew <soby.mathew@arm.com>2016-03-24 16:56:29 +0000
committerSoby Mathew <soby.mathew@arm.com>2016-07-18 17:52:15 +0100
commit532ed6183868036e4a4f83cd7a71b93266a3bdb7 (patch)
treef49b622aa47b6b94eebfb58de1f59df30dd6c423
parentda554d7439b1e9b64d06dd50c6eb29bf1c952805 (diff)
Introduce `el3_runtime` and `PSCI` libraries
This patch moves the PSCI services and BL31 frameworks like context management and per-cpu data into new library components `PSCI` and `el3_runtime` respectively. This enables PSCI to be built independently from BL31. A new `psci_lib.mk` makefile is introduced which adds the relevant PSCI library sources and gets included by `bl31.mk`. Other changes which are done as part of this patch are: * The runtime services framework is now moved to the `common/` folder to enable reuse. * The `asm_macros.S` and `assert_macros.S` helpers are moved to architecture specific folder. * The `plat_psci_common.c` is moved from the `plat/common/aarch64/` folder to `plat/common` folder. The original file location now has a stub which just includes the file from new location to maintain platform compatibility. Most of the changes wouldn't affect platform builds as they just involve changes to the generic bl1.mk and bl31.mk makefiles. NOTE: THE `plat_psci_common.c` FILE HAS MOVED LOCATION AND THE STUB FILE AT THE ORIGINAL LOCATION IS NOW DEPRECATED. PLATFORMS SHOULD MODIFY THEIR MAKEFILES TO INCLUDE THE FILE FROM THE NEW LOCATION. Change-Id: I6bd87d5b59424995c6a65ef8076d4fda91ad5e86
-rw-r--r--Makefile32
-rw-r--r--bl1/bl1.mk6
-rw-r--r--bl31/bl31.mk30
-rw-r--r--bl31/bl31_context_mgmt.c5
-rw-r--r--common/runtime_svc.c (renamed from bl31/runtime_svc.c)0
-rw-r--r--docs/firmware-design.md5
-rw-r--r--docs/rt-svc-writers-guide.md10
-rw-r--r--include/common/aarch64/asm_macros.S (renamed from include/common/asm_macros.S)2
-rw-r--r--include/common/aarch64/assert_macros.S (renamed from include/common/assert_macros.S)2
-rw-r--r--include/common/runtime_svc.h (renamed from include/bl31/runtime_svc.h)0
-rw-r--r--include/lib/el3_runtime/aarch64/context.h (renamed from include/common/context.h)0
-rw-r--r--include/lib/el3_runtime/context_mgmt.h (renamed from include/common/context_mgmt.h)1
-rw-r--r--include/lib/el3_runtime/cpu_data.h (renamed from include/bl31/cpu_data.h)0
-rw-r--r--include/lib/psci/psci.h (renamed from include/bl31/services/psci.h)0
-rw-r--r--include/lib/psci/psci_compat.h (renamed from include/bl31/services/psci_compat.h)2
-rw-r--r--include/services/std_svc.h (renamed from include/bl31/services/std_svc.h)2
-rw-r--r--lib/el3_runtime/aarch64/context.S (renamed from common/aarch64/context.S)2
-rw-r--r--lib/el3_runtime/aarch64/context_mgmt.c (renamed from common/context_mgmt.c)0
-rw-r--r--lib/el3_runtime/aarch64/cpu_data.S (renamed from bl31/aarch64/cpu_data.S)2
-rw-r--r--lib/el3_runtime/cpu_data_array.c (renamed from bl31/cpu_data_array.c)2
-rw-r--r--lib/psci/aarch64/psci_entry.S (renamed from services/std_svc/psci/psci_entry.S)2
-rw-r--r--lib/psci/aarch64/psci_helpers.S (renamed from services/std_svc/psci/psci_helpers.S)2
-rw-r--r--lib/psci/psci_common.c (renamed from services/std_svc/psci/psci_common.c)0
-rw-r--r--lib/psci/psci_lib.mk55
-rw-r--r--lib/psci/psci_main.c (renamed from services/std_svc/psci/psci_main.c)0
-rw-r--r--lib/psci/psci_off.c (renamed from services/std_svc/psci/psci_off.c)2
-rw-r--r--lib/psci/psci_on.c (renamed from services/std_svc/psci/psci_on.c)2
-rw-r--r--lib/psci/psci_private.h (renamed from services/std_svc/psci/psci_private.h)0
-rw-r--r--lib/psci/psci_setup.c (renamed from services/std_svc/psci/psci_setup.c)2
-rw-r--r--lib/psci/psci_stat.c (renamed from services/std_svc/psci/psci_stat.c)0
-rw-r--r--lib/psci/psci_suspend.c (renamed from services/std_svc/psci/psci_suspend.c)2
-rw-r--r--lib/psci/psci_system_off.c (renamed from services/std_svc/psci/psci_system_off.c)2
-rw-r--r--plat/common/aarch64/plat_psci_common.c38
-rw-r--r--plat/common/plat_psci_common.c63
34 files changed, 171 insertions, 102 deletions
diff --git a/Makefile b/Makefile
index 800312c94..bb5098b23 100644
--- a/Makefile
+++ b/Makefile
@@ -226,20 +226,24 @@ BL_COMMON_SOURCES += common/bl_common.c \
plat/common/aarch64/platform_helpers.S \
${STDLIB_SRCS}
-INCLUDES += -Iinclude/bl1 \
- -Iinclude/bl31 \
- -Iinclude/bl31/services \
- -Iinclude/common \
- -Iinclude/drivers \
- -Iinclude/drivers/arm \
- -Iinclude/drivers/auth \
- -Iinclude/drivers/io \
- -Iinclude/drivers/ti/uart \
- -Iinclude/lib \
- -Iinclude/lib/aarch64 \
- -Iinclude/lib/cpus/aarch64 \
- -Iinclude/plat/common \
- ${PLAT_INCLUDES} \
+INCLUDES += -Iinclude/bl1 \
+ -Iinclude/bl31 \
+ -Iinclude/common \
+ -Iinclude/common/aarch64 \
+ -Iinclude/drivers \
+ -Iinclude/drivers/arm \
+ -Iinclude/drivers/auth \
+ -Iinclude/drivers/io \
+ -Iinclude/drivers/ti/uart \
+ -Iinclude/lib \
+ -Iinclude/lib/aarch64 \
+ -Iinclude/lib/cpus/aarch64 \
+ -Iinclude/lib/el3_runtime \
+ -Iinclude/lib/el3_runtime/aarch64 \
+ -Iinclude/lib/psci \
+ -Iinclude/plat/common \
+ -Iinclude/services \
+ ${PLAT_INCLUDES} \
${SPD_INCLUDES}
diff --git a/bl1/bl1.mk b/bl1/bl1.mk
index 21e87c79c..591e047b4 100644
--- a/bl1/bl1.mk
+++ b/bl1/bl1.mk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2013-2016, 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:
@@ -33,9 +33,9 @@ BL1_SOURCES += bl1/bl1_main.c \
bl1/aarch64/bl1_entrypoint.S \
bl1/aarch64/bl1_exceptions.S \
bl1/bl1_context_mgmt.c \
- common/aarch64/context.S \
- common/context_mgmt.c \
lib/cpus/aarch64/cpu_helpers.S \
+ lib/el3_runtime/aarch64/context.S \
+ lib/el3_runtime/aarch64/context_mgmt.c \
plat/common/plat_bl1_common.c
ifeq (${TRUSTED_BOARD_BOOT},1)
diff --git a/bl31/bl31.mk b/bl31/bl31.mk
index 8a7fccb0d..dd3e4cf19 100644
--- a/bl31/bl31.mk
+++ b/bl31/bl31.mk
@@ -28,45 +28,23 @@
# POSSIBILITY OF SUCH DAMAGE.
#
+include lib/psci/psci_lib.mk
+
BL31_SOURCES += bl31/bl31_main.c \
- bl31/cpu_data_array.c \
- bl31/runtime_svc.c \
bl31/interrupt_mgmt.c \
bl31/aarch64/bl31_arch_setup.c \
bl31/aarch64/bl31_entrypoint.S \
- bl31/aarch64/cpu_data.S \
bl31/aarch64/runtime_exceptions.S \
bl31/aarch64/crash_reporting.S \
bl31/bl31_context_mgmt.c \
- common/aarch64/context.S \
- common/context_mgmt.c \
- lib/cpus/aarch64/cpu_helpers.S \
- lib/locks/exclusive/spinlock.S \
+ common/runtime_svc.c \
services/std_svc/std_svc_setup.c \
- services/std_svc/psci/psci_off.c \
- services/std_svc/psci/psci_on.c \
- services/std_svc/psci/psci_suspend.c \
- services/std_svc/psci/psci_common.c \
- services/std_svc/psci/psci_entry.S \
- services/std_svc/psci/psci_helpers.S \
- services/std_svc/psci/psci_main.c \
- services/std_svc/psci/psci_setup.c \
- services/std_svc/psci/psci_system_off.c
-
-ifeq (${USE_COHERENT_MEM}, 1)
-BL31_SOURCES += lib/locks/bakery/bakery_lock_coherent.c
-else
-BL31_SOURCES += lib/locks/bakery/bakery_lock_normal.c
-endif
+ ${PSCI_LIB_SOURCES}
ifeq (${ENABLE_PMF}, 1)
BL31_SOURCES += lib/pmf/pmf_main.c
endif
-ifeq (${ENABLE_PSCI_STAT}, 1)
-BL31_SOURCES += services/std_svc/psci/psci_stat.c
-endif
-
BL31_LINKERFILE := bl31/bl31.ld.S
# Flag used to indicate if Crash reporting via console should be included
diff --git a/bl31/bl31_context_mgmt.c b/bl31/bl31_context_mgmt.c
index ae2442471..f8751c2ab 100644
--- a/bl31/bl31_context_mgmt.c
+++ b/bl31/bl31_context_mgmt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2016, 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:
@@ -30,6 +30,7 @@
#include <assert.h>
#include <bl31.h>
+#include <bl_common.h>
#include <context.h>
#include <context_mgmt.h>
#include <cpu_data.h>
@@ -130,4 +131,4 @@ void cm_init_context(unsigned long mpidr, const entry_point_info_t *ep)
else
cm_init_context_by_index(platform_get_core_pos(mpidr), ep);
}
-#endif \ No newline at end of file
+#endif
diff --git a/bl31/runtime_svc.c b/common/runtime_svc.c
index 8729e2920..8729e2920 100644
--- a/bl31/runtime_svc.c
+++ b/common/runtime_svc.c
diff --git a/docs/firmware-design.md b/docs/firmware-design.md
index b99a2838f..d9f9ff025 100644
--- a/docs/firmware-design.md
+++ b/docs/firmware-design.md
@@ -1779,10 +1779,11 @@ following categories (present as directories in the source code):
the platform.
* **Common code.** This is platform and architecture agnostic code.
* **Library code.** This code comprises of functionality commonly used by all
- other code.
+ other code. The PSCI implementation and other EL3 runtime frameworks reside
+ as Library components.
* **Stage specific.** Code specific to a boot stage.
* **Drivers.**
-* **Services.** EL3 runtime services, e.g. PSCI or SPD. Specific SPD services
+* **Services.** EL3 runtime services (eg: SPD). Specific SPD services
reside in the `services/spd` directory (e.g. `services/spd/tspd`).
Each boot loader stage uses code from one or more of the above mentioned
diff --git a/docs/rt-svc-writers-guide.md b/docs/rt-svc-writers-guide.md
index 856e8feba..7fe718515 100644
--- a/docs/rt-svc-writers-guide.md
+++ b/docs/rt-svc-writers-guide.md
@@ -95,8 +95,7 @@ handler will be responsible for all SMC Functions within a given service type.
ARM Trusted Firmware has a [`services`] directory in the source tree under which
each owning entity can place the implementation of its runtime service. The
-[PSCI] implementation is located here in the [`services/std_svc/psci`]
-directory.
+[PSCI] implementation is located here in the [`lib/psci`] directory.
Runtime service sources will need to include the [`runtime_svc.h`] header file.
@@ -299,12 +298,11 @@ provide this information....
_Copyright (c) 2014-2015, ARM Limited and Contributors. All rights reserved._
-[Firmware Design]: ./firmware-design.md
-
+[Firmware Design]: ./firmware-design.md
[`services`]: ../services
-[`services/std_svc/psci`]: ../services/std_svc/psci
+[`lib/psci`]: ../lib/psci
[`std_svc_setup.c`]: ../services/std_svc/std_svc_setup.c
-[`runtime_svc.h`]: ../include/bl31/runtime_svc.h
+[`runtime_svc.h`]: ../include/common/runtime_svc.h
[`smcc_helpers.h`]: ../include/common/smcc_helpers.h
[PSCI]: http://infocenter.arm.com/help/topic/com.arm.doc.den0022c/DEN0022C_Power_State_Coordination_Interface.pdf "Power State Coordination Interface PDD (ARM DEN 0022C)"
[SMCCC]: http://infocenter.arm.com/help/topic/com.arm.doc.den0028a/index.html "SMC Calling Convention PDD (ARM DEN 0028A)"
diff --git a/include/common/asm_macros.S b/include/common/aarch64/asm_macros.S
index bd8bb7090..e76698990 100644
--- a/include/common/asm_macros.S
+++ b/include/common/aarch64/asm_macros.S
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2016, 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:
diff --git a/include/common/assert_macros.S b/include/common/aarch64/assert_macros.S
index cb6c78b8a..b7e536c62 100644
--- a/include/common/assert_macros.S
+++ b/include/common/aarch64/assert_macros.S
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2016, 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:
diff --git a/include/bl31/runtime_svc.h b/include/common/runtime_svc.h
index adafcee49..adafcee49 100644
--- a/include/bl31/runtime_svc.h
+++ b/include/common/runtime_svc.h
diff --git a/include/common/context.h b/include/lib/el3_runtime/aarch64/context.h
index b528c03b7..b528c03b7 100644
--- a/include/common/context.h
+++ b/include/lib/el3_runtime/aarch64/context.h
diff --git a/include/common/context_mgmt.h b/include/lib/el3_runtime/context_mgmt.h
index 8a38ee5df..672ea11e7 100644
--- a/include/common/context_mgmt.h
+++ b/include/lib/el3_runtime/context_mgmt.h
@@ -32,7 +32,6 @@
#define __CM_H__
#include <arch.h>
-#include <bl_common.h>
/*******************************************************************************
* Forward declarations
diff --git a/include/bl31/cpu_data.h b/include/lib/el3_runtime/cpu_data.h
index 4fc801bf4..4fc801bf4 100644
--- a/include/bl31/cpu_data.h
+++ b/include/lib/el3_runtime/cpu_data.h
diff --git a/include/bl31/services/psci.h b/include/lib/psci/psci.h
index b6d6d4eac..b6d6d4eac 100644
--- a/include/bl31/services/psci.h
+++ b/include/lib/psci/psci.h
diff --git a/include/bl31/services/psci_compat.h b/include/lib/psci/psci_compat.h
index 24bd8dcca..3554667e5 100644
--- a/include/bl31/services/psci_compat.h
+++ b/include/lib/psci/psci_compat.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2016, 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:
diff --git a/include/bl31/services/std_svc.h b/include/services/std_svc.h
index cbd5b6208..49d79f8a6 100644
--- a/include/bl31/services/std_svc.h
+++ b/include/services/std_svc.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2016, 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:
diff --git a/common/aarch64/context.S b/lib/el3_runtime/aarch64/context.S
index d51daa78c..7982e50ba 100644
--- a/common/aarch64/context.S
+++ b/lib/el3_runtime/aarch64/context.S
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2016, 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:
diff --git a/common/context_mgmt.c b/lib/el3_runtime/aarch64/context_mgmt.c
index 4527aa340..4527aa340 100644
--- a/common/context_mgmt.c
+++ b/lib/el3_runtime/aarch64/context_mgmt.c
diff --git a/bl31/aarch64/cpu_data.S b/lib/el3_runtime/aarch64/cpu_data.S
index 0842825cb..2cc07ba54 100644
--- a/bl31/aarch64/cpu_data.S
+++ b/lib/el3_runtime/aarch64/cpu_data.S
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2016, 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:
diff --git a/bl31/cpu_data_array.c b/lib/el3_runtime/cpu_data_array.c
index 4cba11849..eba21a500 100644
--- a/bl31/cpu_data_array.c
+++ b/lib/el3_runtime/cpu_data_array.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2016, 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:
diff --git a/services/std_svc/psci/psci_entry.S b/lib/psci/aarch64/psci_entry.S
index f8c0afa25..646ebcf80 100644
--- a/services/std_svc/psci/psci_entry.S
+++ b/lib/psci/aarch64/psci_entry.S
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2016, 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:
diff --git a/services/std_svc/psci/psci_helpers.S b/lib/psci/aarch64/psci_helpers.S
index 6ccf943c0..87144dd93 100644
--- a/services/std_svc/psci/psci_helpers.S
+++ b/lib/psci/aarch64/psci_helpers.S
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2016, 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:
diff --git a/services/std_svc/psci/psci_common.c b/lib/psci/psci_common.c
index 2a0afb4c3..2a0afb4c3 100644
--- a/services/std_svc/psci/psci_common.c
+++ b/lib/psci/psci_common.c
diff --git a/lib/psci/psci_lib.mk b/lib/psci/psci_lib.mk
new file mode 100644
index 000000000..93c783295
--- /dev/null
+++ b/lib/psci/psci_lib.mk
@@ -0,0 +1,55 @@
+#
+# Copyright (c) 2016, 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.
+#
+
+PSCI_LIB_SOURCES := lib/el3_runtime/cpu_data_array.c \
+ lib/el3_runtime/aarch64/context.S \
+ lib/el3_runtime/aarch64/cpu_data.S \
+ lib/el3_runtime/aarch64/context_mgmt.c \
+ lib/cpus/aarch64/cpu_helpers.S \
+ lib/locks/exclusive/spinlock.S \
+ lib/psci/psci_off.c \
+ lib/psci/psci_on.c \
+ lib/psci/psci_suspend.c \
+ lib/psci/psci_common.c \
+ lib/psci/psci_main.c \
+ lib/psci/psci_setup.c \
+ lib/psci/psci_system_off.c \
+ lib/psci/aarch64/psci_entry.S \
+ lib/psci/aarch64/psci_helpers.S \
+
+ifeq (${USE_COHERENT_MEM}, 1)
+PSCI_LIB_SOURCES += lib/locks/bakery/bakery_lock_coherent.c
+else
+PSCI_LIB_SOURCES += lib/locks/bakery/bakery_lock_normal.c
+endif
+
+ifeq (${ENABLE_PSCI_STAT}, 1)
+PSCI_LIB_SOURCES += lib/psci/psci_stat.c
+endif
diff --git a/services/std_svc/psci/psci_main.c b/lib/psci/psci_main.c
index 04ef10e77..04ef10e77 100644
--- a/services/std_svc/psci/psci_main.c
+++ b/lib/psci/psci_main.c
diff --git a/services/std_svc/psci/psci_off.c b/lib/psci/psci_off.c
index 36dab4972..471141dd7 100644
--- a/services/std_svc/psci/psci_off.c
+++ b/lib/psci/psci_off.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2016, 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:
diff --git a/services/std_svc/psci/psci_on.c b/lib/psci/psci_on.c
index c8c36cd0f..d4826ed8a 100644
--- a/services/std_svc/psci/psci_on.c
+++ b/lib/psci/psci_on.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2016, 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:
diff --git a/services/std_svc/psci/psci_private.h b/lib/psci/psci_private.h
index f42ce551f..f42ce551f 100644
--- a/services/std_svc/psci/psci_private.h
+++ b/lib/psci/psci_private.h
diff --git a/services/std_svc/psci/psci_setup.c b/lib/psci/psci_setup.c
index 975b25713..fac0edeca 100644
--- a/services/std_svc/psci/psci_setup.c
+++ b/lib/psci/psci_setup.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2016, 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:
diff --git a/services/std_svc/psci/psci_stat.c b/lib/psci/psci_stat.c
index 155bbb07d..155bbb07d 100644
--- a/services/std_svc/psci/psci_stat.c
+++ b/lib/psci/psci_stat.c
diff --git a/services/std_svc/psci/psci_suspend.c b/lib/psci/psci_suspend.c
index e6c8cd992..ee1ccef2f 100644
--- a/services/std_svc/psci/psci_suspend.c
+++ b/lib/psci/psci_suspend.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2016, 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:
diff --git a/services/std_svc/psci/psci_system_off.c b/lib/psci/psci_system_off.c
index 28315d6b5..de9ec6436 100644
--- a/services/std_svc/psci/psci_system_off.c
+++ b/lib/psci/psci_system_off.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2016, 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:
diff --git a/plat/common/aarch64/plat_psci_common.c b/plat/common/aarch64/plat_psci_common.c
index 0748ef4de..804da9304 100644
--- a/plat/common/aarch64/plat_psci_common.c
+++ b/plat/common/aarch64/plat_psci_common.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2016, 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:
@@ -28,36 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <arch.h>
-#include <assert.h>
-#include <platform.h>
-#include <psci.h>
-
-/*
- * The PSCI generic code uses this API to let the platform participate in state
- * coordination during a power management operation. It compares the platform
- * specific local power states requested by each cpu for a given power domain
- * and returns the coordinated target power state that the domain should
- * enter. A platform assigns a number to a local power state. This default
- * implementation assumes that the platform assigns these numbers in order of
- * increasing depth of the power state i.e. for two power states X & Y, if X < Y
- * then X represents a shallower power state than Y. As a result, the
- * coordinated target local power state for a power domain will be the minimum
- * of the requested local power states.
- */
-plat_local_state_t plat_get_target_pwr_state(unsigned int lvl,
- const plat_local_state_t *states,
- unsigned int ncpu)
-{
- plat_local_state_t target = PLAT_MAX_OFF_STATE, temp;
-
- assert(ncpu);
-
- do {
- temp = *states++;
- if (temp < target)
- target = temp;
- } while (--ncpu);
-
- return target;
-}
+#if !ERROR_DEPRECATED
+#include "../plat_psci_common.c"
+#endif
diff --git a/plat/common/plat_psci_common.c b/plat/common/plat_psci_common.c
new file mode 100644
index 000000000..3eb6886ed
--- /dev/null
+++ b/plat/common/plat_psci_common.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016, 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.
+ */
+
+#include <arch.h>
+#include <assert.h>
+#include <platform.h>
+#include <psci.h>
+
+/*
+ * The PSCI generic code uses this API to let the platform participate in state
+ * coordination during a power management operation. It compares the platform
+ * specific local power states requested by each cpu for a given power domain
+ * and returns the coordinated target power state that the domain should
+ * enter. A platform assigns a number to a local power state. This default
+ * implementation assumes that the platform assigns these numbers in order of
+ * increasing depth of the power state i.e. for two power states X & Y, if X < Y
+ * then X represents a shallower power state than Y. As a result, the
+ * coordinated target local power state for a power domain will be the minimum
+ * of the requested local power states.
+ */
+plat_local_state_t plat_get_target_pwr_state(unsigned int lvl,
+ const plat_local_state_t *states,
+ unsigned int ncpu)
+{
+ plat_local_state_t target = PLAT_MAX_OFF_STATE, temp;
+
+ assert(ncpu);
+
+ do {
+ temp = *states++;
+ if (temp < target)
+ target = temp;
+ } while (--ncpu);
+
+ return target;
+}