From 25472de89ee3b98cd466f69d1f419f943dcbcb0f Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Mon, 29 Apr 2019 10:44:15 +0530 Subject: firmware: Allow firmwares to provide next mode and options This patch extends existing firmwares (i.e. fw_jump and fw_payload) to explicitly provide next mode and options to fw_base. We also introduce fw_save_info() which is called by fw_base very early on boot HART. This function can be used by existing firmwares (i.e. fw_jump and fw_payload) to save information passed by previous booting stage. Overall, this is a preparatory patch for implementing fw_dynamic. Signed-off-by: Anup Patel Reviewed-by: Alistair Francis Reviewed-by: Atish Patra --- firmware/fw_payload.S | 56 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 6 deletions(-) (limited to 'firmware/fw_payload.S') diff --git a/firmware/fw_payload.S b/firmware/fw_payload.S index b86b63c..4b4527a 100644 --- a/firmware/fw_payload.S +++ b/firmware/fw_payload.S @@ -9,11 +9,26 @@ #include "fw_base.S" - .align 4 + .align 3 + .section .entry, "ax", %progbits + .global fw_save_info + /* + * We can only use a0, a1, a2, a3, and a4 registers here. + * The a0, a1, and a2 registers will be same as passed by + * previous booting stage. + * Nothing to be returned here. + */ +fw_save_info: + ret + + .align 3 .section .entry, "ax", %progbits .global fw_prev_arg1 + /* + * We can only use a0, a1, and a2 registers here. + * The previous arg1 should be returned in 'a0'. + */ fw_prev_arg1: - /* We return previous arg1 in 'a0' */ #ifdef FW_PAYLOAD_FDT_PATH la a0, fdt_bin #else @@ -21,11 +36,14 @@ fw_prev_arg1: #endif ret - .align 4 + .align 3 .section .entry, "ax", %progbits .global fw_next_arg1 + /* + * We can only use a0, a1, and a2 registers here. + * The next arg1 should be returned in 'a0'. + */ fw_next_arg1: - /* We return next arg1 in 'a0' */ #ifdef FW_PAYLOAD_FDT_ADDR li a0, FW_PAYLOAD_FDT_ADDR #else @@ -33,14 +51,40 @@ fw_next_arg1: #endif ret - .align 4 + .align 3 .section .entry, "ax", %progbits .global fw_next_addr + /* + * We can only use a0, a1, and a2 registers here. + * The next address should be returned in 'a0'. + */ fw_next_addr: - /* We return next address in 'a0' */ la a0, payload_bin ret + .align 3 + .section .entry, "ax", %progbits + .global fw_next_mode + /* + * We can only use a0, a1, and a2 registers here. + * The next address should be returned in 'a0'. + */ +fw_next_mode: + li a0, PRV_S + ret + + .align 3 + .section .entry, "ax", %progbits + .global fw_options + /* + * We can only use a0, a1, and a2 registers here. + * The 'a4' register will have default options. + * The next address should be returned in 'a0'. + */ +fw_options: + add a0, zero, zero + ret + #ifdef FW_PAYLOAD_FDT_PATH .align 4 .section .text, "ax", %progbits -- cgit v1.2.3