]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
AArch32: Support in SP_MIN to receive arguments from BL2
authorYatharth Kochar <yatharth.kochar@arm.com>
Thu, 30 Jun 2016 13:50:58 +0000 (14:50 +0100)
committerYatharth Kochar <yatharth.kochar@arm.com>
Wed, 21 Sep 2016 15:28:46 +0000 (16:28 +0100)
This patch adds support in SP_MIN to receive generic and
platform specific arguments from BL2.

The new signature is as following:
    void sp_min_early_platform_setup(void *from_bl2,
         void *plat_params_from_bl2);

ARM platforms have been modified to use this support.

Note: Platforms may break if using old signature.
      Default value for RESET_TO_SP_MIN is changed to 0.

Change-Id: I008d4b09fd3803c7b6231587ebf02a047bdba8d0

bl32/sp_min/sp_min.mk
include/bl32/sp_min/platform_sp_min.h
include/plat/arm/common/plat_arm.h
plat/arm/board/fvp/sp_min/fvp_sp_min_setup.c
plat/arm/common/sp_min/arm_sp_min_setup.c

index a8b572e02c7639967873c9d52ae4bf15d753bb53..ac7f03e941b8f90c69e30c7eb1671cafb030ea98 100644 (file)
@@ -58,6 +58,6 @@ else
   include ${SP_MIN_PLAT_MAKEFILE}
 endif
 
-RESET_TO_SP_MIN        := 1
+RESET_TO_SP_MIN        := 0
 $(eval $(call add_define,RESET_TO_SP_MIN))
 $(eval $(call assert_boolean,RESET_TO_SP_MIN))
index ae9dd58aa2bea13468972c47047280246bb15ad7..c8c3fc5e21f486cd719608e99e19e3336899b37c 100644 (file)
@@ -34,7 +34,8 @@
 /*******************************************************************************
  * Mandatory SP_MIN functions
  ******************************************************************************/
-void sp_min_early_platform_setup(void);
+void sp_min_early_platform_setup(void *from_bl2,
+               void *plat_params_from_bl2);
 void sp_min_plat_arch_setup(void);
 void sp_min_platform_setup(void);
 entry_point_info_t *sp_min_plat_get_bl33_ep_info(void);
index 581573b2df4d75bfa9a74c7f6ab443957177b843..29fcffec87a38c89a937ce2c019bce1493c737ae 100644 (file)
@@ -180,7 +180,8 @@ void arm_bl31_plat_arch_setup(void);
 void arm_tsp_early_platform_setup(void);
 
 /* SP_MIN utility functions */
-void arm_sp_min_early_platform_setup(void);
+void arm_sp_min_early_platform_setup(void *from_bl2,
+               void *plat_params_from_bl2);
 
 /* FIP TOC validity check */
 int arm_io_is_toc_valid(void);
index d3bef82f9472f4e4c087a9645b6dfd95092f31ac..735c4f06f892b7c552c8c4b0812bac3532fa4550 100644 (file)
 #include <plat_arm.h>
 #include "../fvp_private.h"
 
-void sp_min_early_platform_setup(void)
+void sp_min_early_platform_setup(void *from_bl2,
+               void *plat_params_from_bl2)
 {
-       arm_sp_min_early_platform_setup();
+       arm_sp_min_early_platform_setup(from_bl2, plat_params_from_bl2);
 
        /* Initialize the platform config for future decision making */
        fvp_config_setup();
index 927f30f5d05a86470268fa82ddcb5d182aa9d42d..d48556eeddbbfce8654de9c730c000fcfa4e81ae 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <assert.h>
 #include <console.h>
+#include <debug.h>
 #include <mmio.h>
 #include <plat_arm.h>
 #include <platform.h>
@@ -58,10 +59,6 @@ static entry_point_info_t bl33_image_ep_info;
 #pragma weak sp_min_platform_setup
 #pragma weak sp_min_plat_arch_setup
 
-#ifndef RESET_TO_SP_MIN
-#error (" RESET_TO_SP_MIN flag is expected to be set.")
-#endif
-
 
 /*******************************************************************************
  * Return a pointer to the 'entry_point_info' structure of the next image for the
@@ -86,15 +83,20 @@ entry_point_info_t *sp_min_plat_get_bl33_ep_info(void)
 }
 
 /*******************************************************************************
- * Perform early platform setup. We expect SP_MIN is the first boot loader
- * image and RESET_TO_SP_MIN build option to be set.
+ * Perform early platform setup.
  ******************************************************************************/
-void arm_sp_min_early_platform_setup(void)
+void arm_sp_min_early_platform_setup(void *from_bl2,
+               void *plat_params_from_bl2)
 {
        /* Initialize the console to provide early debug support */
        console_init(PLAT_ARM_BOOT_UART_BASE, PLAT_ARM_BOOT_UART_CLK_IN_HZ,
                                ARM_CONSOLE_BAUDRATE);
 
+#if RESET_TO_SP_MIN
+       /* There are no parameters from BL2 if SP_MIN is a reset vector */
+       assert(from_bl2 == NULL);
+       assert(plat_params_from_bl2 == NULL);
+
        /* Populate entry point information for BL33 */
        SET_PARAM_HEAD(&bl33_image_ep_info,
                                PARAM_EP,
@@ -104,18 +106,46 @@ void arm_sp_min_early_platform_setup(void)
         * Tell SP_MIN where the non-trusted software image
         * is located and the entry state information
         */
-#ifdef PRELOADED_BL33_BASE
-       bl33_image_ep_info.pc = PRELOADED_BL33_BASE;
-#else
        bl33_image_ep_info.pc = plat_get_ns_image_entrypoint();
-#endif
        bl33_image_ep_info.spsr = arm_get_spsr_for_bl33_entry();
        SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE);
+
+#else /* RESET_TO_SP_MIN */
+
+       /*
+        * Check params passed from BL2 should not be NULL,
+        */
+       bl_params_t *params_from_bl2 = (bl_params_t *)from_bl2;
+       assert(params_from_bl2 != NULL);
+       assert(params_from_bl2->h.type == PARAM_BL_PARAMS);
+       assert(params_from_bl2->h.version >= VERSION_2);
+
+       bl_params_node_t *bl_params = params_from_bl2->head;
+
+       /*
+        * Copy BL33 entry point information.
+        * They are stored in Secure RAM, in BL2's address space.
+        */
+       while (bl_params) {
+               if (bl_params->image_id == BL33_IMAGE_ID) {
+                       bl33_image_ep_info = *bl_params->ep_info;
+                       break;
+               }
+
+               bl_params = bl_params->next_params_info;
+       }
+
+       if (bl33_image_ep_info.pc == 0)
+               panic();
+
+#endif /* RESET_TO_SP_MIN */
+
 }
 
-void sp_min_early_platform_setup(void)
+void sp_min_early_platform_setup(void *from_bl2,
+               void *plat_params_from_bl2)
 {
-       arm_sp_min_early_platform_setup();
+       arm_sp_min_early_platform_setup(from_bl2, plat_params_from_bl2);
 
        /*
         * Initialize Interconnect for this cluster during cold boot.
@@ -146,10 +176,10 @@ void sp_min_platform_setup(void)
        /*
         * Do initial security configuration to allow DRAM/device access
         * (if earlier BL has not already done so).
-        * TODO: If RESET_TO_SP_MIN is not set, the security setup needs
-        * to be skipped.
         */
+#if RESET_TO_SP_MIN
        plat_arm_security_setup();
+#endif
 
        /* Enable and initialize the System level generic timer */
        mmio_write_32(ARM_SYS_CNTCTL_BASE + CNTCR_OFF,