summaryrefslogtreecommitdiff
path: root/framework/main.c
diff options
context:
space:
mode:
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>2016-04-29 09:29:22 +0100
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2016-04-29 09:29:22 +0100
commitdd92d653ee5d369cfb1d62a984e38ccbfd497b3c (patch)
tree9d9f1ab634e491140b28b86e1699e2ceab6fc9fe /framework/main.c
parent8eccdb813efc7ae14b389de3bcfdf56a90221a92 (diff)
Preserve context_id parameter set by CPU_ON
tftf_cpu_on() is passed a context_id parameter. It is passed to tftf_psci_cpu_on() which ensures that the target CPU enters TFTF in tftf_hotplug_entry(). The Trusted Firmware passes the preserved to context_id in x0 but tftf_hotplug_entry() overwrites it immediately. This patch prevents the context_id value from being overwritten and adds a new API to access that value. A new test case has been created to verify it. Change-Id: Ibd7850eaaacbf476df1a06dbaf55a30e6ba494fa
Diffstat (limited to 'framework/main.c')
-rw-r--r--framework/main.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/framework/main.c b/framework/main.c
index 02f37e3..7f50584 100644
--- a/framework/main.c
+++ b/framework/main.c
@@ -26,6 +26,7 @@
#include <psci.h>
#include <sgi.h>
#include <string.h>
+#include <sys/types.h>
#include <timer.h>
#include <tftf.h>
#include <tftf_lib.h>
@@ -41,6 +42,9 @@ extern test_function_t test_entrypoint[PLATFORM_CORE_COUNT];
/* Per-CPU results for the current test */
static test_result_t test_results[PLATFORM_CORE_COUNT];
+/* Context ID passed to tftf_psci_cpu_on() */
+static u_register_t cpu_on_ctx_id_arr[PLATFORM_CORE_COUNT];
+
static unsigned int test_is_rebooting;
static inline const test_suite_t *current_testsuite(void)
@@ -402,6 +406,20 @@ void __dead2 run_tests(void)
bug_unreachable();
}
+u_register_t tftf_get_cpu_on_ctx_id(unsigned int core_pos)
+{
+ assert(core_pos < PLATFORM_CORE_COUNT);
+
+ return cpu_on_ctx_id_arr[core_pos];
+}
+
+void tftf_set_cpu_on_ctx_id(unsigned int core_pos, u_register_t context_id)
+{
+ assert(core_pos < PLATFORM_CORE_COUNT);
+
+ cpu_on_ctx_id_arr[core_pos] = context_id;
+}
+
unsigned int tftf_is_rebooted(void)
{
return test_is_rebooting;