]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
plat/arm: Use only fw_config between bl2 and bl31
authorManish V Badarkhe <Manish.Badarkhe@arm.com>
Sat, 30 May 2020 16:40:44 +0000 (17:40 +0100)
committerManish V Badarkhe <Manish.Badarkhe@arm.com>
Fri, 26 Jun 2020 07:24:34 +0000 (08:24 +0100)
Passed the address of fw_config instead of soc_fw_config
as arg1 to BL31 from BL2 for ARM fvp platform.

BL31 then retrieve load-address of other device trees
from fw_config device tree.

Signed-off-by: Louis Mayencourt <louis.mayencourt@arm.com>
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Change-Id: Ib7e9581cd765d76111dcc3b7e0dafc12503c83c1

plat/arm/board/fvp/fdts/fvp_fw_config.dts
plat/arm/board/fvp/fvp_bl2_setup.c
plat/arm/board/fvp/fvp_bl31_setup.c
plat/arm/board/fvp/platform.mk

index 605b70c2d89b99e7cb4ef5aab21187cefae8551b..09f2730d90b83d91dcbba610fd0c3bb2d4510cef 100644 (file)
                 * is loaded at base of DRAM.
                 */
                soc_fw-config {
-                       load-address = <0x0 0x04001000>;
+                       load-address = <0x0 0x04001300>;
                        max-size = <0x200>;
                        id = <SOC_FW_CONFIG_ID>;
                };
 
                tos_fw-config {
-                       load-address = <0x0 0x04001200>;
-                       max-size = <0x1000>;
+                       load-address = <0x0 0x04001500>;
+                       max-size = <0xB00>;
                        id = <TOS_FW_CONFIG_ID>;
                };
 
index 43b1374811870bd0c18c2583ff914a63d6223d79..d5618d99bc1b2be77b265bca80c615c3edeaa190 100644 (file)
@@ -4,7 +4,13 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+#include <assert.h>
+
+#include <common/desc_image_load.h>
 #include <drivers/arm/sp804_delay_timer.h>
+#include <lib/fconf/fconf.h>
+#include <lib/fconf/fconf_dyn_cfg_getter.h>
+
 #include <plat/arm/common/plat_arm.h>
 #include <plat/common/platform.h>
 #include <platform_def.h>
@@ -26,3 +32,40 @@ void bl2_platform_setup(void)
        /* Initialize System level generic or SP804 timer */
        fvp_timer_init();
 }
+
+/*******************************************************************************
+ * This function returns the list of executable images
+ ******************************************************************************/
+struct bl_params *plat_get_next_bl_params(void)
+{
+       struct bl_params *arm_bl_params;
+
+       arm_bl_params = arm_get_next_bl_params();
+
+#if __aarch64__ && !BL2_AT_EL3
+       const struct dyn_cfg_dtb_info_t *fw_config_info;
+       bl_mem_params_node_t *param_node;
+       uintptr_t fw_config_base = 0U;
+       entry_point_info_t *ep_info;
+
+       /* Get BL31 image node */
+       param_node = get_bl_mem_params_node(BL31_IMAGE_ID);
+       assert(param_node != NULL);
+
+       /* get fw_config load address */
+       fw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, FW_CONFIG_ID);
+       assert(fw_config_info != NULL);
+
+       fw_config_base = fw_config_info->config_addr;
+       assert(fw_config_base != 0U);
+
+       /*
+        * Get the entry point info of BL31 image and override
+        * arg1 of entry point info with fw_config base address
+        */
+       ep_info = &param_node->ep_info;
+       ep_info->args.arg1 = (uint32_t)fw_config_base;
+#endif /* __aarch64__ && !BL2_AT_EL3 */
+
+       return arm_bl_params;
+}
index 4cc1c1b93d30c76cef9b9f35d6d2a506fcbd654e..f9ee4492f5d080b8b25a66ad354f174b9cbd0779 100644 (file)
@@ -9,6 +9,7 @@
 #include <drivers/arm/smmu_v3.h>
 #include <fconf_hw_config_getter.h>
 #include <lib/fconf/fconf.h>
+#include <lib/fconf/fconf_dyn_cfg_getter.h>
 #include <lib/mmio.h>
 #include <plat/arm/common/arm_config.h>
 #include <plat/arm/common/plat_arm.h>
 
 #include "fvp_private.h"
 
-uintptr_t hw_config_dtb;
-
 void __init bl31_early_platform_setup2(u_register_t arg0,
                u_register_t arg1, u_register_t arg2, u_register_t arg3)
 {
+#if !RESET_TO_BL31 && !BL2_AT_EL3
+       const struct dyn_cfg_dtb_info_t *soc_fw_config_info;
+
+       INFO("BL31 FCONF: FW_CONFIG address = %lx\n", (uintptr_t)arg1);
+       /* Fill the properties struct with the info from the config dtb */
+       fconf_populate("FW_CONFIG", arg1);
+
+       soc_fw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, SOC_FW_CONFIG_ID);
+       if (soc_fw_config_info != NULL) {
+               arg1 = soc_fw_config_info->config_addr;
+       }
+#endif /* !RESET_TO_BL31 && !BL2_AT_EL3 */
+
        arm_bl31_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3);
 
        /* Initialize the platform config for future decision making */
@@ -47,8 +59,6 @@ void __init bl31_early_platform_setup2(u_register_t arg0,
        /* On FVP RevC, initialize SMMUv3 */
        if ((arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3) != 0U)
                smmuv3_init(PLAT_FVP_SMMUV3_BASE);
-
-       hw_config_dtb = arg2;
 }
 
 void __init bl31_plat_arch_setup(void)
@@ -61,10 +71,13 @@ void __init bl31_plat_arch_setup(void)
         * control is passed to BL31.
         */
 #if !RESET_TO_BL31 && !BL2_AT_EL3
-       assert(hw_config_dtb != 0U);
+       /* HW_CONFIG was also loaded by BL2 */
+       const struct dyn_cfg_dtb_info_t *hw_config_info;
+
+       hw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, HW_CONFIG_ID);
+       assert(hw_config_info != NULL);
 
-       INFO("BL31 FCONF: HW_CONFIG address = %p\n", (void *)hw_config_dtb);
-       fconf_populate("HW_CONFIG", hw_config_dtb);
+       fconf_populate("HW_CONFIG", hw_config_info->config_addr);
 #endif
 }
 
index 4925865a555f5c6ec6cca974dde9a4034e582d41..c3b49bb581d20d533fdd1865a5963b7767cb395d 100644 (file)
@@ -217,6 +217,7 @@ BL31_SOURCES                +=      drivers/arm/fvp/fvp_pwrc.c                      \
 ifeq ($(filter 1,${BL2_AT_EL3} ${RESET_TO_BL31}),)
 BL31_SOURCES           +=      common/fdt_wrappers.c                           \
                                lib/fconf/fconf.c                               \
+                               lib/fconf/fconf_dyn_cfg_getter.c                \
                                plat/arm/board/fvp/fconf/fconf_hw_config_getter.c
 
 ifeq (${SEC_INT_DESC_IN_FCONF},1)