board_f: Add a new struct to hold pre-relocation info

Quite a few of the members of struct global_data are only used before
reloction, or have little meaning afterwards, yet they hang around in
struct global_data for the lifetime of U-Boot. This uses up precious
pre-relocation SRAM on many boards.

To help with this, start a new struct which exists only before
relocation. Move new_fdt into this new struct. Drop the display of it
in the 'bdinfo' command as it is probably not very useful.

Note that the field does not exist in SPL builds.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2024-08-21 10:19:09 -06:00
committed by Tom Rini
parent 52cd51c02f
commit 6abd992ada
5 changed files with 37 additions and 11 deletions

View File

@@ -578,7 +578,7 @@ static int reserve_fdt(void)
gd->fdt_size = ALIGN(fdt_totalsize(gd->fdt_blob), 32);
gd->start_addr_sp = reserve_stack_aligned(gd->fdt_size);
gd->new_fdt = map_sysmem(gd->start_addr_sp, gd->fdt_size);
gd->boardf->new_fdt = map_sysmem(gd->start_addr_sp, gd->fdt_size);
debug("Reserving %lu Bytes for FDT at: %08lx\n",
gd->fdt_size, gd->start_addr_sp);
}
@@ -668,10 +668,10 @@ static int init_post(void)
static int reloc_fdt(void)
{
if (!IS_ENABLED(CONFIG_OF_EMBED)) {
if (gd->new_fdt) {
memcpy(gd->new_fdt, gd->fdt_blob,
if (gd->boardf->new_fdt) {
memcpy(gd->boardf->new_fdt, gd->fdt_blob,
fdt_totalsize(gd->fdt_blob));
gd->fdt_blob = gd->new_fdt;
gd->fdt_blob = gd->boardf->new_fdt;
}
}
@@ -1021,8 +1021,11 @@ static const init_fnc_t init_sequence_f[] = {
void board_init_f(ulong boot_flags)
{
struct board_f boardf;
gd->flags = boot_flags;
gd->flags &= ~GD_FLG_HAVE_CONSOLE;
gd->boardf = &boardf;
if (initcall_run_list(init_sequence_f))
hang();