diff options
author | Simon Glass <sjg@chromium.org> | 2021-01-14 06:29:43 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-01-28 01:03:16 +0300 |
commit | 9fe064646d2c9f3914cd5ceae51c34020aa77599 (patch) | |
tree | 971f208a76257181d735a00c200ff04a7c2591b1 /common | |
parent | 09d9ba9097ceb374f2802506c9e755fd8d5dd861 (diff) | |
download | u-boot-9fe064646d2c9f3914cd5ceae51c34020aa77599.tar.xz |
bloblist: Support relocating to a larger space
Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.
Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 10 | ||||
-rw-r--r-- | common/bloblist.c | 11 | ||||
-rw-r--r-- | common/board_f.c | 10 |
3 files changed, 27 insertions, 4 deletions
diff --git a/common/Kconfig b/common/Kconfig index d8982ba377..45535e3501 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -697,6 +697,16 @@ config BLOBLIST_ADDR Sets the address of the bloblist, set up by the first part of U-Boot which runs. Subsequent U-Boot stages typically use the same address. +config BLOBLIST_SIZE_RELOC + hex "Size of bloblist after relocation" + depends on BLOBLIST + default BLOBLIST_SIZE + help + Sets the size of the bloblist in bytes after relocation. Since U-Boot + has a lot more memory available then, it is possible to use a larger + size than the one set up by SPL. This bloblist is set up during the + relocation process. + endmenu source "common/spl/Kconfig" diff --git a/common/bloblist.c b/common/bloblist.c index 33b5862380..e32f551e27 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -317,6 +317,15 @@ void bloblist_show_list(void) } } +void bloblist_reloc(void *to, uint to_size, void *from, uint from_size) +{ + struct bloblist_hdr *hdr; + + memcpy(to, from, from_size); + hdr = to; + hdr->size = to_size; +} + int bloblist_init(void) { bool expected; @@ -327,6 +336,8 @@ int bloblist_init(void) * that runs */ expected = !u_boot_first_phase(); + if (spl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST)) + expected = false; if (expected) ret = bloblist_check(CONFIG_BLOBLIST_ADDR, CONFIG_BLOBLIST_SIZE); diff --git a/common/board_f.c b/common/board_f.c index ae3001bed1..4327a43a33 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -568,9 +568,10 @@ static int reserve_bloblist(void) { #ifdef CONFIG_BLOBLIST /* Align to a 4KB boundary for easier reading of addresses */ - gd->start_addr_sp = ALIGN_DOWN(gd->start_addr_sp - CONFIG_BLOBLIST_SIZE, - 0x1000); - gd->new_bloblist = map_sysmem(gd->start_addr_sp, CONFIG_BLOBLIST_SIZE); + gd->start_addr_sp = ALIGN_DOWN(gd->start_addr_sp - + CONFIG_BLOBLIST_SIZE_RELOC, 0x1000); + gd->new_bloblist = map_sysmem(gd->start_addr_sp, + CONFIG_BLOBLIST_SIZE_RELOC); #endif return 0; @@ -658,7 +659,8 @@ static int reloc_bloblist(void) debug("Copying bloblist from %p to %p, size %x\n", gd->bloblist, gd->new_bloblist, size); - memcpy(gd->new_bloblist, gd->bloblist, size); + bloblist_reloc(gd->new_bloblist, CONFIG_BLOBLIST_SIZE_RELOC, + gd->bloblist, size); gd->bloblist = gd->new_bloblist; } #endif |