summaryrefslogtreecommitdiff
path: root/arch/arm/cpu
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2024-02-29 09:24:49 -0500
committerTom Rini <[email protected]>2024-02-29 09:24:49 -0500
commitea3348ebc215d2a9d6dd14f40fb7e8c86dc45e4a (patch)
tree095062630056cd16bd398e01d896c43b0d089090 /arch/arm/cpu
parentcfc3e1db499d7d4307559cc911aa914dd131f945 (diff)
parent2b71470628c035ce3ccc76d12e50bdc453bdbc93 (diff)
Merge patch series "Handoff bloblist from previous boot stage"
Raymond Mao <[email protected]> says: This patch set adds/adapts a few bloblist APIs and implements Arm arch custom function to retrieve the bloblist (aka. Transfer List) from previous loader via boot arguments when BLOBLIST option is enabled and all boot arguments are compliant to the register conventions defined in the Firmware Handoff spec v0.9. If an arch wishes to have different behaviors for loading bloblist from the previous boot stage, it is required to implement the custom function xferlist_from_boot_arg().
Diffstat (limited to 'arch/arm/cpu')
-rw-r--r--arch/arm/cpu/armv7/start.S29
-rw-r--r--arch/arm/cpu/armv8/start.S23
2 files changed, 52 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index 69e281b086a..7730a16e512 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -152,9 +152,38 @@ ENDPROC(c_runtime_cpu_setup)
*
*************************************************************************/
WEAK(save_boot_params)
+#if (IS_ENABLED(CONFIG_BLOBLIST))
+ /* Calculate the PC-relative address of saved_args */
+ adr r12, saved_args_offset
+ ldr r13, saved_args_offset
+ add r12, r12, r13
+
+ /*
+ * Intentionally swapping r0 with r2 in order to simplify the C
+ * function we use later.
+ */
+ str r2, [r12]
+ str r1, [r12, #4]
+ str r0, [r12, #8]
+ str r3, [r12, #12]
+#endif
b save_boot_params_ret @ back to my caller
ENDPROC(save_boot_params)
+#if (IS_ENABLED(CONFIG_BLOBLIST))
+saved_args_offset:
+ .long saved_args - . /* offset from current code to save_args */
+
+ .section .data
+ .align 2
+ .global saved_args
+saved_args:
+ .rept 4
+ .word 0
+ .endr
+END(saved_args)
+#endif
+
#ifdef CONFIG_ARMV7_LPAE
WEAK(switch_to_hypervisor)
b switch_to_hypervisor_ret
diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S
index 6cc1d26e5e2..74612802617 100644
--- a/arch/arm/cpu/armv8/start.S
+++ b/arch/arm/cpu/armv8/start.S
@@ -370,5 +370,28 @@ ENTRY(c_runtime_cpu_setup)
ENDPROC(c_runtime_cpu_setup)
WEAK(save_boot_params)
+#if (IS_ENABLED(CONFIG_BLOBLIST))
+ /* Calculate the PC-relative address of saved_args */
+ adr x9, saved_args_offset
+ ldr w10, saved_args_offset
+ add x9, x9, w10, sxtw
+
+ stp x0, x1, [x9]
+ stp x2, x3, [x9, #16]
+#endif
b save_boot_params_ret /* back to my caller */
ENDPROC(save_boot_params)
+
+#if (IS_ENABLED(CONFIG_BLOBLIST))
+saved_args_offset:
+ .long saved_args - . /* offset from current code to save_args */
+
+ .section .data
+ .align 2
+ .global saved_args
+saved_args:
+ .rept 4
+ .dword 0
+ .endr
+END(saved_args)
+#endif