TF-TF: Store boot parameters

This patch adds support for storing fw_config and hw_config
addresses passed as arg0 and arg1 parameters in x0, x1 from
BL31.

Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Change-Id: I58ae379bb4a7ef1b6ce60a4e252c65d34dc14464
diff --git a/tftf/framework/aarch64/entrypoint.S b/tftf/framework/aarch64/entrypoint.S
index 81fd207..6aa5645 100644
--- a/tftf/framework/aarch64/entrypoint.S
+++ b/tftf/framework/aarch64/entrypoint.S
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -17,6 +17,13 @@
  * ----------------------------------------------------------------------------
  */
 func tftf_entrypoint
+	/* --------------------------------------------------------------------
+	 * Save arguments x0, x1 from the previous Boot loader
+	 * --------------------------------------------------------------------
+	 */
+	mov	x20, x0
+	mov	x21, x1
+
 	bl	arch_init
 
 	/* --------------------------------------------------------------------
@@ -72,6 +79,15 @@
 	bl	platform_set_stack
 
 	/* --------------------------------------------------------------------
+	 * Save fw_config and hw_config addresses passed in x0, x1 from the
+	 * previous boot loader
+	 * --------------------------------------------------------------------
+	 */
+	mov	x0, x20
+	mov	x1, x21
+	bl	save_fw_hw_configs
+
+	/* --------------------------------------------------------------------
 	 * tftf_cold_boot_main() will perform the remaining architectural and
 	 * platform setup, initialise the test framework's state, then run the
 	 * tests.
@@ -187,3 +203,11 @@
 	isb
 	ret
 endfunc arch_init
+
+/* Set fw_config and hw_config addresses passed in x0, x1 */
+func save_fw_hw_configs
+	adrp	x2, fw_config_base
+	str	x0, [x2, :lo12:fw_config_base]
+	str	x1, [x2, :lo12:hw_config_base]
+	ret
+endfunc save_fw_hw_configs
diff --git a/tftf/framework/main.c b/tftf/framework/main.c
index a2e84b7..2523a97 100644
--- a/tftf/framework/main.c
+++ b/tftf/framework/main.c
@@ -41,6 +41,10 @@
 
 static unsigned int test_is_rebooting;
 
+/* Parameters arg0 and arg1 passed from BL31 */
+u_register_t fw_config_base;
+u_register_t hw_config_base;
+
 static inline const test_suite_t *current_testsuite(void)
 {
 	test_ref_t test_to_run;