Commit f0293d33b729955feb379aeab8a5e055c703526f

Authored by Simon Glass
Committed by Tom Rini
1 parent e945a72623

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>

Showing 2 changed files with 38 additions and 0 deletions Side-by-side Diff

... ... @@ -10,6 +10,7 @@
10 10 */
11 11  
12 12 #include <common.h>
  13 +#include <bloblist.h>
13 14 #include <console.h>
14 15 #include <cpu.h>
15 16 #include <dm.h>
... ... @@ -560,6 +561,16 @@
560 561 return arch_reserve_stacks();
561 562 }
562 563  
  564 +static int reserve_bloblist(void)
  565 +{
  566 +#ifdef CONFIG_BLOBLIST
  567 + gd->start_addr_sp -= CONFIG_BLOBLIST_SIZE;
  568 + gd->new_bloblist = map_sysmem(gd->start_addr_sp, CONFIG_BLOBLIST_SIZE);
  569 +#endif
  570 +
  571 + return 0;
  572 +}
  573 +
563 574 static int display_new_sp(void)
564 575 {
565 576 debug("New Stack Pointer is: %08lx\n", gd->start_addr_sp);
... ... @@ -666,6 +677,24 @@
666 677 return 0;
667 678 }
668 679  
  680 +static int reloc_bloblist(void)
  681 +{
  682 +#ifdef CONFIG_BLOBLIST
  683 + if (gd->flags & GD_FLG_SKIP_RELOC)
  684 + return 0;
  685 + if (gd->new_bloblist) {
  686 + int size = CONFIG_BLOBLIST_SIZE;
  687 +
  688 + debug("Copying bloblist from %p to %p, size %x\n",
  689 + gd->bloblist, gd->new_bloblist, size);
  690 + memcpy(gd->new_bloblist, gd->bloblist, size);
  691 + gd->bloblist = gd->new_bloblist;
  692 + }
  693 +#endif
  694 +
  695 + return 0;
  696 +}
  697 +
669 698 static int setup_reloc(void)
670 699 {
671 700 if (gd->flags & GD_FLG_SKIP_RELOC) {
... ... @@ -813,6 +842,9 @@
813 842 initf_malloc,
814 843 log_init,
815 844 initf_bootstage, /* uses its own timer, so does not need DM */
  845 +#ifdef CONFIG_BLOBLIST
  846 + bloblist_init,
  847 +#endif
816 848 initf_console_record,
817 849 #if defined(CONFIG_HAVE_FSP)
818 850 arch_fsp_init,
... ... @@ -913,6 +945,7 @@
913 945 reserve_global_data,
914 946 reserve_fdt,
915 947 reserve_bootstage,
  948 + reserve_bloblist,
916 949 reserve_arch,
917 950 reserve_stacks,
918 951 dram_init_banksize,
... ... @@ -932,6 +965,7 @@
932 965 INIT_FUNC_WATCHDOG_RESET
933 966 reloc_fdt,
934 967 reloc_bootstage,
  968 + reloc_bloblist,
935 969 setup_reloc,
936 970 #if defined(CONFIG_X86) || defined(CONFIG_ARC)
937 971 copy_uboot_to_ram,
include/asm-generic/global_data.h
... ... @@ -122,6 +122,10 @@
122 122 struct list_head log_head; /* List of struct log_device */
123 123 int log_fmt; /* Mask containing log format info */
124 124 #endif
  125 +#if CONFIG_IS_ENABLED(BLOBLIST)
  126 + struct bloblist_hdr *bloblist; /* Bloblist information */
  127 + struct bloblist_hdr *new_bloblist; /* Relocated blolist info */
  128 +#endif
125 129 } gd_t;
126 130 #endif
127 131