bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2018-11-15 18:43:52 -07:00 committed by Tom Rini
parent e945a72623
commit f0293d33b7
2 changed files with 38 additions and 0 deletions

View File

@ -10,6 +10,7 @@
*/ */
#include <common.h> #include <common.h>
#include <bloblist.h>
#include <console.h> #include <console.h>
#include <cpu.h> #include <cpu.h>
#include <dm.h> #include <dm.h>
@ -560,6 +561,16 @@ static int reserve_stacks(void)
return arch_reserve_stacks(); return arch_reserve_stacks();
} }
static int reserve_bloblist(void)
{
#ifdef CONFIG_BLOBLIST
gd->start_addr_sp -= CONFIG_BLOBLIST_SIZE;
gd->new_bloblist = map_sysmem(gd->start_addr_sp, CONFIG_BLOBLIST_SIZE);
#endif
return 0;
}
static int display_new_sp(void) static int display_new_sp(void)
{ {
debug("New Stack Pointer is: %08lx\n", gd->start_addr_sp); debug("New Stack Pointer is: %08lx\n", gd->start_addr_sp);
@ -666,6 +677,24 @@ static int reloc_bootstage(void)
return 0; return 0;
} }
static int reloc_bloblist(void)
{
#ifdef CONFIG_BLOBLIST
if (gd->flags & GD_FLG_SKIP_RELOC)
return 0;
if (gd->new_bloblist) {
int size = CONFIG_BLOBLIST_SIZE;
debug("Copying bloblist from %p to %p, size %x\n",
gd->bloblist, gd->new_bloblist, size);
memcpy(gd->new_bloblist, gd->bloblist, size);
gd->bloblist = gd->new_bloblist;
}
#endif
return 0;
}
static int setup_reloc(void) static int setup_reloc(void)
{ {
if (gd->flags & GD_FLG_SKIP_RELOC) { if (gd->flags & GD_FLG_SKIP_RELOC) {
@ -813,6 +842,9 @@ static const init_fnc_t init_sequence_f[] = {
initf_malloc, initf_malloc,
log_init, log_init,
initf_bootstage, /* uses its own timer, so does not need DM */ initf_bootstage, /* uses its own timer, so does not need DM */
#ifdef CONFIG_BLOBLIST
bloblist_init,
#endif
initf_console_record, initf_console_record,
#if defined(CONFIG_HAVE_FSP) #if defined(CONFIG_HAVE_FSP)
arch_fsp_init, arch_fsp_init,
@ -913,6 +945,7 @@ static const init_fnc_t init_sequence_f[] = {
reserve_global_data, reserve_global_data,
reserve_fdt, reserve_fdt,
reserve_bootstage, reserve_bootstage,
reserve_bloblist,
reserve_arch, reserve_arch,
reserve_stacks, reserve_stacks,
dram_init_banksize, dram_init_banksize,
@ -932,6 +965,7 @@ static const init_fnc_t init_sequence_f[] = {
INIT_FUNC_WATCHDOG_RESET INIT_FUNC_WATCHDOG_RESET
reloc_fdt, reloc_fdt,
reloc_bootstage, reloc_bootstage,
reloc_bloblist,
setup_reloc, setup_reloc,
#if defined(CONFIG_X86) || defined(CONFIG_ARC) #if defined(CONFIG_X86) || defined(CONFIG_ARC)
copy_uboot_to_ram, copy_uboot_to_ram,

View File

@ -122,6 +122,10 @@ typedef struct global_data {
struct list_head log_head; /* List of struct log_device */ struct list_head log_head; /* List of struct log_device */
int log_fmt; /* Mask containing log format info */ int log_fmt; /* Mask containing log format info */
#endif #endif
#if CONFIG_IS_ENABLED(BLOBLIST)
struct bloblist_hdr *bloblist; /* Bloblist information */
struct bloblist_hdr *new_bloblist; /* Relocated blolist info */
#endif
} gd_t; } gd_t;
#endif #endif