]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
Introduce the new BL handover interface
authorSoby Mathew <soby.mathew@arm.com>
Tue, 9 Jan 2018 14:36:14 +0000 (14:36 +0000)
committerSoby Mathew <soby.mathew@arm.com>
Mon, 26 Feb 2018 16:31:10 +0000 (16:31 +0000)
This patch introduces a new BL handover interface. It essentially allows
passing 4 arguments between the different BL stages. Effort has been made
so as to be compatible with the previous handover interface. The previous
blx_early_platform_setup() platform API is now deprecated and the new
blx_early_platform_setup2() variant is introduced. The weak compatiblity
implementation for the new API is done in the `plat_bl_common.c` file.
Some of the new arguments in the new API will be reserved for generic
code use when dynamic configuration support is implemented. Otherwise
the other registers are available for platform use.

Change-Id: Ifddfe2ea8e32497fe1beb565cac155ad9d50d404
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
bl2/aarch32/bl2_entrypoint.S
bl2/aarch64/bl2_entrypoint.S
bl31/aarch64/bl31_entrypoint.S
bl32/sp_min/aarch32/entrypoint.S
include/bl32/sp_min/platform_sp_min.h
include/plat/common/platform.h
plat/common/aarch32/plat_common.c
plat/common/aarch64/plat_common.c
plat/common/plat_bl_common.c

index e6fa5b98853afd52e284304e0593fca21591eb25..d215f484b72574334e93f8eab8aebc809a4623b5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -26,12 +26,14 @@ vector_base bl2_vector_table
 
 func bl2_entrypoint
        /*---------------------------------------------
-        * Save from r1 the extents of the trusted ram
-        * available to BL2 for future use.
-        * r0 is not currently used.
+        * Save arguments x0 - x3 from BL1 for future
+        * use.
         * ---------------------------------------------
         */
-       mov     r11, r1
+       mov     r9, r0
+       mov     r10, r1
+       mov     r11, r2
+       mov     r12, r3
 
        /* ---------------------------------------------
         * Set the exception vector to something sane.
@@ -111,8 +113,11 @@ func bl2_entrypoint
         * specific early arch. setup e.g. mmu setup
         * ---------------------------------------------
         */
-       mov     r0, r11
-       bl      bl2_early_platform_setup
+       mov     r0, r9
+       mov     r1, r10
+       mov     r2, r11
+       mov     r3, r12
+       bl      bl2_early_platform_setup2
        bl      bl2_plat_arch_setup
 
        /* ---------------------------------------------
index 3ab8b5abc13b3d4b2b0bb985da9f943d955b3c90..bc8cbfd653601935e92ff47672a6ccad86ffb2e8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
 func bl2_entrypoint
        /*---------------------------------------------
-        * Save from x1 the extents of the tzram
-        * available to BL2 for future use.
-        * x0 is not currently used.
+        * Save arguments x0 - x3 from BL1 for future
+        * use.
         * ---------------------------------------------
         */
-       mov     x20, x1
+       mov     x20, x0
+       mov     x21, x1
+       mov     x22, x2
+       mov     x23, x3
 
        /* ---------------------------------------------
         * Set the exception vector to something sane.
@@ -103,7 +105,11 @@ func bl2_entrypoint
         * ---------------------------------------------
         */
        mov     x0, x20
-       bl      bl2_early_platform_setup
+       mov     x1, x21
+       mov     x2, x22
+       mov     x3, x23
+       bl      bl2_early_platform_setup2
+
        bl      bl2_plat_arch_setup
 
        /* ---------------------------------------------
index 419927d8eb2d43b4121c4d4348478f0bd185acea..924f295affb916cbad36d043802330ee0a84e1d9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
 func bl31_entrypoint
 #if !RESET_TO_BL31
        /* ---------------------------------------------------------------
-        * Preceding bootloader has populated x0 with a pointer to a
-        * 'bl31_params' structure & x1 with a pointer to platform
-        * specific structure
+        * Stash the previous bootloader arguments x0 - x3 for later use.
         * ---------------------------------------------------------------
         */
        mov     x20, x0
        mov     x21, x1
+       mov     x22, x2
+       mov     x23, x3
 
        /* ---------------------------------------------------------------------
         * For !RESET_TO_BL31 systems, only the primary CPU ever reaches
@@ -47,13 +47,6 @@ func bl31_entrypoint
                _init_memory=0                                  \
                _init_c_runtime=1                               \
                _exception_vectors=runtime_exceptions
-
-       /* ---------------------------------------------------------------------
-        * Relay the previous bootloader's arguments to the platform layer
-        * ---------------------------------------------------------------------
-        */
-       mov     x0, x20
-       mov     x1, x21
 #else
        /* ---------------------------------------------------------------------
         * For RESET_TO_BL31 systems which have a programmable reset address,
@@ -75,15 +68,20 @@ func bl31_entrypoint
         * arguments passed to the platform layer to reflect that.
         * ---------------------------------------------------------------------
         */
-       mov     x0, 0
-       mov     x1, 0
+       mov     x20, 0
+       mov     x21, 0
+       mov     x22, 0
+       mov     x23, 0
 #endif /* RESET_TO_BL31 */
-
        /* ---------------------------------------------
         * Perform platform specific early arch. setup
         * ---------------------------------------------
         */
-       bl      bl31_early_platform_setup
+       mov     x0, x20
+       mov     x1, x21
+       mov     x2, x22
+       mov     x3, x23
+       bl      bl31_early_platform_setup2
        bl      bl31_plat_arch_setup
 
        /* ---------------------------------------------
index e7528d38eac79747b2623265c8244b091a3aa4ca..3dd23696277ad7d63a236ea73d6e7d70e6585899 100644 (file)
@@ -64,8 +64,10 @@ func sp_min_entrypoint
         * specific structure
         * ---------------------------------------------------------------
         */
-       mov     r11, r0
-       mov     r12, r1
+       mov     r9, r0
+       mov     r10, r1
+       mov     r11, r2
+       mov     r12, r3
 
        /* ---------------------------------------------------------------------
         * For !RESET_TO_SP_MIN systems, only the primary CPU ever reaches
@@ -88,8 +90,6 @@ func sp_min_entrypoint
         * Relay the previous bootloader's arguments to the platform layer
         * ---------------------------------------------------------------------
         */
-       mov     r0, r11
-       mov     r1, r12
 #else
        /* ---------------------------------------------------------------------
         * For RESET_TO_SP_MIN systems which have a programmable reset address,
@@ -111,15 +111,22 @@ func sp_min_entrypoint
         * Zero the arguments passed to the platform layer to reflect that.
         * ---------------------------------------------------------------------
         */
-       mov     r0, #0
-       mov     r1, #0
+       mov     r9, #0
+       mov     r10, #0
+       mov     r11, #0
+       mov     r12, #0
+
 #endif /* RESET_TO_SP_MIN */
 
 #if SP_MIN_WITH_SECURE_FIQ
        route_fiq_to_sp_min r4
 #endif
 
-       bl      sp_min_early_platform_setup
+       mov     r0, r9
+       mov     r1, r10
+       mov     r2, r11
+       mov     r3, r12
+       bl      sp_min_early_platform_setup2
        bl      sp_min_plat_arch_setup
 
        /* Jump to the main function */
index 6c7e0cc0ca598b0cc211349b9bf6ca0e354231cd..8f6a82d90896c187ab9506b190b2dc775a637f10 100644 (file)
 /*******************************************************************************
  * Mandatory SP_MIN functions
  ******************************************************************************/
+#if !ERROR_DEPRECATED
 void sp_min_early_platform_setup(void *from_bl2,
                void *plat_params_from_bl2);
+#endif
+void sp_min_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+               u_register_t arg2, u_register_t arg3);
 void sp_min_platform_setup(void);
 void sp_min_plat_runtime_setup(void);
 void sp_min_plat_arch_setup(void);
index 5c0672554d01f6f5d67805f9f03582ed148c66ab..088c3c8254b73b814a77a91681378407dbadbdcb 100644 (file)
@@ -165,7 +165,10 @@ int bl1_plat_handle_post_image_load(unsigned int image_id);
 /*******************************************************************************
  * Mandatory BL2 functions
  ******************************************************************************/
+void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3);
+#if !ERROR_DEPRECATED
 void bl2_early_platform_setup(struct meminfo *mem_layout);
+#endif
 void bl2_plat_arch_setup(void);
 void bl2_platform_setup(void);
 struct meminfo *bl2_plat_sec_mem_layout(void);
@@ -277,6 +280,7 @@ int bl2u_plat_handle_scp_bl2u(void);
 /*******************************************************************************
  * Mandatory BL31 functions
  ******************************************************************************/
+#if !ERROR_DEPRECATED
 #if LOAD_IMAGE_V2
 void bl31_early_platform_setup(void *from_bl2,
                                void *plat_params_from_bl2);
@@ -284,6 +288,9 @@ void bl31_early_platform_setup(void *from_bl2,
 void bl31_early_platform_setup(struct bl31_params *from_bl2,
                                void *plat_params_from_bl2);
 #endif
+#endif /* ERROR_DEPRECATED */
+void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+               u_register_t arg2, u_register_t arg3);
 void bl31_plat_arch_setup(void);
 void bl31_platform_setup(void);
 void bl31_plat_runtime_setup(void);
index d3799d28bce533a1396f260c4f1edaab7049d50c..c02386983cb08c80012b5d385333b87c10c644dd 100644 (file)
@@ -1,11 +1,12 @@
 /*
- * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
 #include <console.h>
 #include <platform.h>
+#include <platform_sp_min.h>
 #include <xlat_mmu_helpers.h>
 
 /*
@@ -29,3 +30,14 @@ void sp_min_plat_runtime_setup(void)
         */
        console_uninit();
 }
+
+#if !ERROR_DEPRECATED
+
+#pragma weak sp_min_early_platform_setup2
+
+void sp_min_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+                       u_register_t arg2, u_register_t arg3)
+{
+       sp_min_early_platform_setup((void *) arg0, (void *)arg1);
+}
+#endif
index cfc0c4f41da246231f27920bdf1f9fcf3faacc76..080d3569819842ffa0b6644c518031495890e4d3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -20,6 +20,7 @@
 #pragma weak bl31_plat_runtime_setup
 #if !ERROR_DEPRECATED
 #pragma weak plat_get_syscnt_freq2
+#pragma weak bl31_early_platform_setup2
 #endif /* ERROR_DEPRECATED */
 
 #if SDEI_SUPPORT
@@ -70,6 +71,12 @@ unsigned int plat_get_syscnt_freq2(void)
 
        return (unsigned int)freq;
 }
+
+void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+                       u_register_t arg2, u_register_t arg3)
+{
+       bl31_early_platform_setup((void *) arg0, (void *)arg1);
+}
 #endif /* ERROR_DEPRECATED */
 
 #if SDEI_SUPPORT
index 4123df38c0a7869f1fad46915d5d10d3dedf6f20..502bb540508c3de934e0330135c97a22cffb0012 100644 (file)
@@ -9,6 +9,7 @@
 #include <bl_common.h>
 #include <debug.h>
 #include <errno.h>
+#include <platform.h>
 
 /*
  * The following platform functions are weakly defined. The Platforms
@@ -49,3 +50,17 @@ int plat_try_next_boot_source(void)
 {
        return 0;
 }
+
+#if !ERROR_DEPRECATED
+#pragma weak bl2_early_platform_setup2
+
+/*
+ * The following platform API implementation that allow compatibility for
+ * the older platform APIs.
+ */
+void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+                       u_register_t arg2, u_register_t arg3)
+{
+       bl2_early_platform_setup((void *)arg1);
+}
+#endif