Tegra: get BL31 arguments from previous bootloader
authorVarun Wadekar <vwadekar@nvidia.com>
Mon, 23 May 2016 18:41:07 +0000 (11:41 -0700)
committerVarun Wadekar <vwadekar@nvidia.com>
Tue, 28 Feb 2017 16:50:01 +0000 (08:50 -0800)
This patch implements handlers which platforms can override to
get the BL31 arguments passed by the previous bootloader.

Change-Id: I6b9628a984644ce1b5de5aa6d7cd890e57241d89
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
plat/nvidia/tegra/common/tegra_bl31_setup.c
plat/nvidia/tegra/include/tegra_private.h

index 6237c805b2b25d430b8aed31d708c7b3fbc62095..5ad3e7958f3f990e62a41658fb76c549cee8e27a 100644 (file)
@@ -84,12 +84,24 @@ extern uint64_t ns_image_entrypoint;
  * provide typical implementations that will be overridden by a SoC.
  ******************************************************************************/
 #pragma weak plat_early_platform_setup
+#pragma weak plat_get_bl31_params
+#pragma weak plat_get_bl31_plat_params
 
 void plat_early_platform_setup(void)
 {
        ; /* do nothing */
 }
 
+bl31_params_t *plat_get_bl31_params(void)
+{
+       return NULL;
+}
+
+plat_params_from_bl2_t *plat_get_bl31_plat_params(void)
+{
+       return NULL;
+}
+
 /*******************************************************************************
  * Return a pointer to the 'entry_point_info' structure of the next image for
  * security state specified. BL33 corresponds to the non-secure image type
@@ -129,10 +141,22 @@ void bl31_early_platform_setup(bl31_params_t *from_bl2,
        int impl = (read_midr() >> MIDR_IMPL_SHIFT) & MIDR_IMPL_MASK;
 #endif
 
+       /*
+        * For RESET_TO_BL31 systems, BL31 is the first bootloader to run so
+        * there's no argument to relay from a previous bootloader. Platforms
+        * might use custom ways to get arguments, so provide handlers which
+        * they can override.
+        */
+       if (from_bl2 == NULL)
+               from_bl2 = plat_get_bl31_params();
+       if (plat_params == NULL)
+               plat_params = plat_get_bl31_plat_params();
+
        /*
         * Copy BL3-3, BL3-2 entry point information.
         * They are stored in Secure RAM, in BL2's address space.
         */
+       assert(from_bl2);
        assert(from_bl2->bl33_ep_info);
        bl33_image_ep_info = *from_bl2->bl33_ep_info;
 
index c09a153ca4f2acaef213bffc42eb26c5b7cd0044..012bfd77bce81645768f01e91e611573b94507b2 100644 (file)
@@ -82,6 +82,8 @@ int32_t tegra_soc_validate_power_state(unsigned int power_state,
 const mmap_region_t *plat_get_mmio_map(void);
 uint32_t plat_get_console_from_id(int id);
 void plat_gic_setup(void);
+bl31_params_t *plat_get_bl31_params(void);
+plat_params_from_bl2_t *plat_get_bl31_plat_params(void);
 
 /* Declarations for plat_secondary.c */
 void plat_secondary_setup(void);