feat(handoff): add AArch32 handoff support
Add support for testing firmware handoff in AArch32 mode. This requires
some tweaks to enable the boot args from TF-A to be stashed for later
use.
Change-Id: Ib1b88688b6229b10020c936319605c7ed6307ca2
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
diff --git a/tftf/framework/aarch32/entrypoint.S b/tftf/framework/aarch32/entrypoint.S
index eaa0788..3e40ab9 100644
--- a/tftf/framework/aarch32/entrypoint.S
+++ b/tftf/framework/aarch32/entrypoint.S
@@ -16,6 +16,12 @@
* ----------------------------------------------------------------------------
*/
func tftf_entrypoint
+#if TRANSFER_LIST
+ mov r4, r0
+ mov r5, r1
+ mov r6, r2
+ mov r7, r3
+#endif
bl arch_init
/* --------------------------------------------------------------------
@@ -53,6 +59,19 @@
bl zeromem
/* --------------------------------------------------------------------
+ * Save transfer list and hw_config addresses passed in registers r0 to
+ * r3 from the previous bootloader.
+ * --------------------------------------------------------------------
+ */
+#if TRANSFER_LIST
+ mov r0, r4
+ mov r1, r5
+ mov r2, r6
+ mov r3, r7
+ bl save_handoff_params
+#endif
+
+ /* --------------------------------------------------------------------
* Give ourselves a small coherent stack to ease the pain of
* initializing the MMU
* --------------------------------------------------------------------
@@ -172,3 +191,18 @@
/* Primary core MPID already saved */
b panic
endfunc save_primary_mpid
+
+/* ----------------------------------------------------------------------------
+ * Save transfer list and hw_config addresses passed in registers r0 to r3 from
+ * the previous bootloader.
+ * ----------------------------------------------------------------------------
+ */
+func save_handoff_params
+ ldr r4, =ns_tl
+ str r3, [r4]
+ ldr r4, =tl_signature
+ str r1, [r4]
+ ldr r4, =hw_config_base
+ str r2, [r4]
+ bx lr
+endfunc save_handoff_params
diff --git a/tftf/tests/misc_tests/test_firmware_handoff.c b/tftf/tests/misc_tests/test_firmware_handoff.c
index 00cebd3..61091ae 100644
--- a/tftf/tests/misc_tests/test_firmware_handoff.c
+++ b/tftf/tests/misc_tests/test_firmware_handoff.c
@@ -20,8 +20,15 @@
{
struct transfer_list_header *tl = (struct transfer_list_header *)ns_tl;
- assert(tl_signature ==
- TRANSFER_LIST_HANDOFF_X1_VALUE(TRANSFER_LIST_VERSION));
+#if __aarch64__
+ uint64_t signature = TRANSFER_LIST_HANDOFF_X1_VALUE(TRANSFER_LIST_VERSION);
+#else
+ uint32_t signature = TRANSFER_LIST_HANDOFF_R1_VALUE(TRANSFER_LIST_VERSION);
+#endif /* __aarch64__ */
+
+ if (signature != tl_signature) {
+ return TEST_RESULT_FAIL;
+ }
if (transfer_list_check_header(tl) == TL_OPS_NON) {
return TEST_RESULT_FAIL;