summaryrefslogtreecommitdiff
path: root/plat/common
diff options
context:
space:
mode:
authorSoby Mathew <soby.mathew@arm.com>2015-07-13 16:26:11 +0100
committerAchin Gupta <achin.gupta@arm.com>2015-08-13 23:48:06 +0100
commit5c8babcd70149db57734a38be432fe6625f3888f (patch)
treef64760007309c083896eac83638a5df9b57f3de1 /plat/common
parent674878464a93bb6d6bf6cb746fc4b9dba6e101ac (diff)
PSCI: Add deprecated API for SPD when compatibility is disabled
This patch defines deprecated platform APIs to enable Trusted Firmware components like Secure Payload and their dispatchers(SPD) to continue to build and run when platform compatibility is disabled. This decouples the migration of platform ports to the new platform API from SPD and enables them to be migrated independently. The deprecated platform APIs defined in this patch are : platform_get_core_pos(), platform_get_stack() and platform_set_stack(). The patch also deprecates MPIDR based context management helpers like cm_get_context_by_mpidr(), cm_set_context_by_mpidr() and cm_init_context(). A mechanism to deprecate APIs and identify callers of these APIs during build is introduced, which is controlled by the build flag WARN_DEPRECATED. If WARN_DEPRECATED is defined to 1, the users of the deprecated APIs will be flagged either as a link error for assembly files or compile time warning for C files during build. Change-Id: Ib72c7d5dc956e1a74d2294a939205b200f055613
Diffstat (limited to 'plat/common')
-rw-r--r--plat/common/aarch64/plat_common.c18
-rw-r--r--plat/common/aarch64/platform_helpers.S27
-rw-r--r--plat/common/aarch64/platform_mp_stack.S53
-rw-r--r--plat/common/aarch64/platform_up_stack.S30
4 files changed, 121 insertions, 7 deletions
diff --git a/plat/common/aarch64/plat_common.c b/plat/common/aarch64/plat_common.c
index 90574fd6..a6a84765 100644
--- a/plat/common/aarch64/plat_common.c
+++ b/plat/common/aarch64/plat_common.c
@@ -27,7 +27,8 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-
+#include <assert.h>
+#include <platform.h>
#include <xlat_tables.h>
/*
@@ -47,3 +48,18 @@ void bl32_plat_enable_mmu(uint32_t flags)
{
enable_mmu_el1(flags);
}
+
+#if !ENABLE_PLAT_COMPAT
+/*
+ * Helper function for platform_get_pos() when platform compatibility is
+ * disabled. This is to enable SPDs using the older platform API to continue
+ * to work.
+ */
+unsigned int platform_core_pos_helper(unsigned long mpidr)
+{
+ int idx = plat_core_pos_by_mpidr(mpidr);
+ assert(idx >= 0);
+ return idx;
+}
+#endif
+
diff --git a/plat/common/aarch64/platform_helpers.S b/plat/common/aarch64/platform_helpers.S
index b88603c3..9f4b672a 100644
--- a/plat/common/aarch64/platform_helpers.S
+++ b/plat/common/aarch64/platform_helpers.S
@@ -38,6 +38,33 @@
.weak plat_reset_handler
.weak plat_disable_acp
+#if !ENABLE_PLAT_COMPAT
+ .globl platform_get_core_pos
+
+#define MPIDR_RES_BIT_MASK 0xff000000
+
+ /* ------------------------------------------------------------------
+ * int platform_get_core_pos(int mpidr)
+ * Returns the CPU index of the CPU specified by mpidr. This is
+ * defined when platform compatibility is disabled to enable Trusted
+ * Firmware components like SPD using the old platform API to work.
+ * This API is deprecated and it assumes that the mpidr specified is
+ * that of a valid and present CPU. Instead, plat_my_core_pos()
+ * should be used for CPU index of the current CPU and
+ * plat_core_pos_by_mpidr() should be used for CPU index of a
+ * CPU specified by its mpidr.
+ * ------------------------------------------------------------------
+ */
+func_deprecated platform_get_core_pos
+ bic x0, x0, #MPIDR_RES_BIT_MASK
+ mrs x1, mpidr_el1
+ bic x1, x1, #MPIDR_RES_BIT_MASK
+ cmp x0, x1
+ beq plat_my_core_pos
+ b platform_core_pos_helper
+endfunc_deprecated platform_get_core_pos
+#endif
+
/* -----------------------------------------------------
* Placeholder function which should be redefined by
* each platform.
diff --git a/plat/common/aarch64/platform_mp_stack.S b/plat/common/aarch64/platform_mp_stack.S
index 6cfa0697..c719019a 100644
--- a/plat/common/aarch64/platform_mp_stack.S
+++ b/plat/common/aarch64/platform_mp_stack.S
@@ -42,8 +42,9 @@
#else
.weak plat_get_my_stack
.weak plat_set_my_stack
-#endif /*__ENABLE_PLAT_COMPAT__*/
-
+ .globl platform_get_stack
+ .globl platform_set_stack
+#endif /* __ENABLE_PLAT_COMPAT__ */
#if ENABLE_PLAT_COMPAT
/* ---------------------------------------------------------------------
@@ -108,6 +109,54 @@ func platform_set_stack
endfunc platform_set_stack
#else
+ /* ---------------------------------------------------------------------
+ * When the compatility layer is disabled, the new platform APIs
+ * viz plat_get_my_stack() and plat_set_my_stack() are
+ * supported by the platform and the previous APIs platform_get_stack()
+ * and platform_set_stack() are defined in terms of new APIs making use
+ * of the fact that they are only ever invoked for the current CPU.
+ * This is to enable components of Trusted Firmware like SPDs using the
+ * old platform APIs to continue to work.
+ * --------------------------------------------------------------------
+ */
+
+ /* -------------------------------------------------------
+ * unsigned long platform_get_stack (unsigned long mpidr)
+ *
+ * For the current CPU, this function returns the stack
+ * pointer for a stack allocated in device memory. The
+ * 'mpidr' should correspond to that of the current CPU.
+ * This function is deprecated and plat_get_my_stack()
+ * should be used instead.
+ * -------------------------------------------------------
+ */
+func_deprecated platform_get_stack
+#if ASM_ASSERTION
+ mrs x1, mpidr_el1
+ cmp x0, x1
+ ASM_ASSERT(eq)
+#endif
+ b plat_get_my_stack
+endfunc_deprecated platform_get_stack
+
+ /* -----------------------------------------------------
+ * void platform_set_stack (unsigned long mpidr)
+ *
+ * For the current CPU, this function sets the stack pointer
+ * to a stack allocated in normal memory. The
+ * 'mpidr' should correspond to that of the current CPU.
+ * This function is deprecated and plat_get_my_stack()
+ * should be used instead.
+ * -----------------------------------------------------
+ */
+func_deprecated platform_set_stack
+#if ASM_ASSERTION
+ mrs x1, mpidr_el1
+ cmp x0, x1
+ ASM_ASSERT(eq)
+#endif
+ b plat_set_my_stack
+endfunc_deprecated platform_set_stack
/* -----------------------------------------------------
* unsigned long plat_get_my_stack ()
diff --git a/plat/common/aarch64/platform_up_stack.S b/plat/common/aarch64/platform_up_stack.S
index d6d6c6e2..c01534af 100644
--- a/plat/common/aarch64/platform_up_stack.S
+++ b/plat/common/aarch64/platform_up_stack.S
@@ -41,7 +41,6 @@
/* -----------------------------------------------------
* unsigned long plat_get_my_stack ()
- * unsigned long platform_get_stack (unsigned long)
*
* For cold-boot BL images, only the primary CPU needs a
* stack. This function returns the stack pointer for a
@@ -49,14 +48,12 @@
* -----------------------------------------------------
*/
func plat_get_my_stack
-platform_get_stack:
get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
ret
endfunc plat_get_my_stack
/* -----------------------------------------------------
* void plat_set_my_stack ()
- * void platform_set_stack (unsigned long)
*
* For cold-boot BL images, only the primary CPU needs a
* stack. This function sets the stack pointer to a stack
@@ -64,13 +61,38 @@ endfunc plat_get_my_stack
* -----------------------------------------------------
*/
func plat_set_my_stack
-platform_set_stack:
get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
mov sp, x0
ret
endfunc plat_set_my_stack
/* -----------------------------------------------------
+ * unsigned long platform_get_stack ()
+ *
+ * For cold-boot BL images, only the primary CPU needs a
+ * stack. This function returns the stack pointer for a
+ * stack allocated in device memory. This function
+ * is deprecated.
+ * -----------------------------------------------------
+ */
+func_deprecated platform_get_stack
+ b plat_get_my_stack
+endfunc_deprecated platform_get_stack
+
+ /* -----------------------------------------------------
+ * void platform_set_stack ()
+ *
+ * For cold-boot BL images, only the primary CPU needs a
+ * stack. This function sets the stack pointer to a stack
+ * allocated in normal memory.This function is
+ * deprecated.
+ * -----------------------------------------------------
+ */
+func_deprecated platform_set_stack
+ b plat_set_my_stack
+endfunc_deprecated platform_set_stack
+
+ /* -----------------------------------------------------
* Single cpu stack in normal memory.
* Used for C code during boot, PLATFORM_STACK_SIZE bytes
* are allocated