aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/Kconfig15
-rw-r--r--common/bloblist.c16
-rw-r--r--common/board_f.c8
-rw-r--r--doc/develop/bloblist.rst16
4 files changed, 50 insertions, 5 deletions
diff --git a/common/Kconfig b/common/Kconfig
index 176fda9..50ac433 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -727,6 +727,8 @@ config TPL_BLOBLIST
This enables a bloblist in TPL. The bloblist is set up in TPL and
passed to SPL and U-Boot proper.
+if BLOBLIST
+
config BLOBLIST_SIZE
hex "Size of bloblist"
depends on BLOBLIST
@@ -737,17 +739,24 @@ config BLOBLIST_SIZE
is set up in the first part of U-Boot to run (TPL, SPL or U-Boot
proper), and this sane bloblist is used for subsequent stages.
+config BLOBLIST_ALLOC
+ bool "Allocate bloblist"
+ help
+ Allocate the bloblist using malloc(). This avoids the need to
+ specify a fixed address on systems where this is unknown or can
+ change at runtime.
+
config BLOBLIST_ADDR
hex "Address of bloblist"
- depends on BLOBLIST
default 0xc000 if SANDBOX
help
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.
+ This is not used if BLOBLIST_ALLOC is selected.
+
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
@@ -755,6 +764,8 @@ config BLOBLIST_SIZE_RELOC
size than the one set up by SPL. This bloblist is set up during the
relocation process.
+endif # BLOBLIST
+
endmenu
source "common/spl/Kconfig"
diff --git a/common/bloblist.c b/common/bloblist.c
index 1290fff..01b0410 100644
--- a/common/bloblist.c
+++ b/common/bloblist.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <bloblist.h>
#include <log.h>
+#include <malloc.h>
#include <mapmem.h>
#include <spl.h>
#include <asm/global_data.h>
@@ -416,10 +417,21 @@ int bloblist_init(void)
ret = bloblist_check(CONFIG_BLOBLIST_ADDR,
CONFIG_BLOBLIST_SIZE);
if (ret) {
+ ulong addr;
+
log(LOGC_BLOBLIST, expected ? LOGL_WARNING : LOGL_DEBUG,
"Existing bloblist not found: creating new bloblist\n");
- ret = bloblist_new(CONFIG_BLOBLIST_ADDR, CONFIG_BLOBLIST_SIZE,
- 0);
+ if (IS_ENABLED(CONFIG_BLOBLIST_ALLOC)) {
+ void *ptr = memalign(BLOBLIST_ALIGN,
+ CONFIG_BLOBLIST_SIZE);
+
+ if (!ptr)
+ return log_msg_ret("alloc", -ENOMEM);
+ addr = map_to_sysmem(ptr);
+ } else {
+ addr = CONFIG_BLOBLIST_ADDR;
+ }
+ ret = bloblist_new(addr, CONFIG_BLOBLIST_SIZE, 0);
} else {
log(LOGC_BLOBLIST, LOGL_DEBUG, "Found existing bloblist\n");
}
diff --git a/common/board_f.c b/common/board_f.c
index f7ea7c7..dd69c3b 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -655,8 +655,14 @@ static int reloc_bootstage(void)
static int reloc_bloblist(void)
{
#ifdef CONFIG_BLOBLIST
- if (gd->flags & GD_FLG_SKIP_RELOC)
+ /*
+ * Relocate only if we are supposed to send it
+ */
+ if ((gd->flags & GD_FLG_SKIP_RELOC) &&
+ CONFIG_BLOBLIST_SIZE == CONFIG_BLOBLIST_SIZE_RELOC) {
+ debug("Not relocating bloblist\n");
return 0;
+ }
if (gd->new_bloblist) {
int size = CONFIG_BLOBLIST_SIZE;
diff --git a/doc/develop/bloblist.rst b/doc/develop/bloblist.rst
index 317ebc4..47274cf 100644
--- a/doc/develop/bloblist.rst
+++ b/doc/develop/bloblist.rst
@@ -59,6 +59,22 @@ Bloblist provides a fairly simple API which allows blobs to be created and
found. All access is via the blob's tag. Blob records are zeroed when added.
+Placing the bloblist
+--------------------
+
+The bloblist is typically positioned at a fixed address by TPL, or SPL. This
+is controlled by `CONFIG_BLOBLIST_ADDR`. But in some cases it is preferable to
+allocate the bloblist in the malloc() space. Use the `CONFIG_BLOBLIST_ALLOC`
+option to enable this.
+
+The bloblist is automatically relocated as part of U-Boot relocation. Sometimes
+it is useful to expand the bloblist in U-Boot proper, since it may want to add
+information for use by Linux. Note that this does not mean that Linux needs to
+know anything about the bloblist format, just that it is convenient to use
+bloblist to place things contiguously in memory. Set
+`CONFIG_BLOBLIST_SIZE_RELOC` to define the expanded size, if needed.
+
+
Finishing the bloblist
----------------------