Commit 9814bfc1 authored by Louis Mayencourt's avatar Louis Mayencourt
Browse files

fconf: Populate properties from dtb during bl2 setup



Use the dtb provided by bl1 as configuration file for fconf.

Change-Id: I3f466ad9b7047e1a361d94e71ac6d693e31496d9
Signed-off-by: default avatarLouis Mayencourt <louis.mayencourt@arm.com>
parent 3b5ea741
...@@ -47,4 +47,15 @@ void fconf_load_config(void); ...@@ -47,4 +47,15 @@ void fconf_load_config(void);
*/ */
void fconf_populate(uintptr_t config); void fconf_populate(uintptr_t config);
/* FCONF specific getter */
#define fconf__dtb_getter(prop) fconf_dtb_info.prop
/* Structure used to locally keep a reference to the config dtb. */
struct fconf_dtb_info_t {
uintptr_t base_addr;
size_t size;
};
extern struct fconf_dtb_info_t fconf_dtb_info;
#endif /* FCONF_H */ #endif /* FCONF_H */
...@@ -7,18 +7,17 @@ ...@@ -7,18 +7,17 @@
#include <assert.h> #include <assert.h>
#include <common/debug.h> #include <common/debug.h>
#include <common/fdt_wrappers.h>
#include <lib/fconf/fconf.h> #include <lib/fconf/fconf.h>
#include <libfdt.h> #include <libfdt.h>
#include <plat/common/platform.h> #include <plat/common/platform.h>
#include <platform_def.h> #include <platform_def.h>
static uintptr_t tb_fw_cfg_dtb; struct fconf_dtb_info_t fconf_dtb_info;
static size_t tb_fw_cfg_dtb_size;
void fconf_load_config(void) void fconf_load_config(void)
{ {
int err; int err;
image_desc_t *desc;
image_info_t arm_tb_fw_info = { image_info_t arm_tb_fw_info = {
.h.type = (uint8_t)PARAM_IMAGE_BINARY, .h.type = (uint8_t)PARAM_IMAGE_BINARY,
...@@ -27,7 +26,7 @@ void fconf_load_config(void) ...@@ -27,7 +26,7 @@ void fconf_load_config(void)
.h.attr = 0, .h.attr = 0,
.image_base = ARM_TB_FW_CONFIG_BASE, .image_base = ARM_TB_FW_CONFIG_BASE,
.image_max_size = (uint32_t) .image_max_size = (uint32_t)
(ARM_TB_FW_CONFIG_LIMIT - ARM_TB_FW_CONFIG_BASE) (ARM_TB_FW_CONFIG_LIMIT - ARM_TB_FW_CONFIG_BASE)
}; };
VERBOSE("FCONF: Loading FW_CONFIG\n"); VERBOSE("FCONF: Loading FW_CONFIG\n");
...@@ -39,15 +38,19 @@ void fconf_load_config(void) ...@@ -39,15 +38,19 @@ void fconf_load_config(void)
} }
/* At this point we know that a DTB is indeed available */ /* At this point we know that a DTB is indeed available */
tb_fw_cfg_dtb = arm_tb_fw_info.image_base; fconf_dtb_info.base_addr = arm_tb_fw_info.image_base;
tb_fw_cfg_dtb_size = (size_t)arm_tb_fw_info.image_size; fconf_dtb_info.size = (size_t)arm_tb_fw_info.image_size;
#if !BL2_AT_EL3
image_desc_t *desc;
/* The BL2 ep_info arg0 is modified to point to FW_CONFIG */ /* The BL2 ep_info arg0 is modified to point to FW_CONFIG */
desc = bl1_plat_get_image_desc(BL2_IMAGE_ID); desc = bl1_plat_get_image_desc(BL2_IMAGE_ID);
assert(desc != NULL); assert(desc != NULL);
desc->ep_info.args.arg0 = tb_fw_cfg_dtb; desc->ep_info.args.arg0 = arm_tb_fw_info.image_base;
#endif
INFO("FCONF: FW_CONFIG loaded at address = 0x%lx\n", tb_fw_cfg_dtb); INFO("FCONF: FW_CONFIG loaded at address = 0x%lx\n", arm_tb_fw_info.image_base);
} }
void fconf_populate(uintptr_t config) void fconf_populate(uintptr_t config)
...@@ -76,4 +79,7 @@ void fconf_populate(uintptr_t config) ...@@ -76,4 +79,7 @@ void fconf_populate(uintptr_t config)
panic(); panic();
} }
} }
/* save local pointer to the config dtb */
fconf_dtb_info.base_addr = config;
} }
/* /*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <common/debug.h> #include <common/debug.h>
#include <common/desc_image_load.h> #include <common/desc_image_load.h>
#include <drivers/generic_delay_timer.h> #include <drivers/generic_delay_timer.h>
#include <lib/fconf/fconf.h>
#ifdef SPD_opteed #ifdef SPD_opteed
#include <lib/optee_utils.h> #include <lib/optee_utils.h>
#endif #endif
...@@ -58,11 +59,13 @@ void arm_bl2_early_platform_setup(uintptr_t tb_fw_config, ...@@ -58,11 +59,13 @@ void arm_bl2_early_platform_setup(uintptr_t tb_fw_config,
/* Setup the BL2 memory layout */ /* Setup the BL2 memory layout */
bl2_tzram_layout = *mem_layout; bl2_tzram_layout = *mem_layout;
/* Fill the properties struct with the info from the config dtb */
if (tb_fw_config != 0U) {
fconf_populate(tb_fw_config);
}
/* Initialise the IO layer and register platform IO devices */ /* Initialise the IO layer and register platform IO devices */
plat_arm_io_setup(); plat_arm_io_setup();
if (tb_fw_config != 0U)
arm_bl2_set_tb_cfg_addr((void *)tb_fw_config);
} }
void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3) void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment