When the configuration option CONFIG_BLOBLIST_PASSAGE is selected, the
bloblist present in the incoming standard passage is utilised in-place.
There is no need to specify the size of the bloblist as the system
automatically detects it using the header information.

Signed-off-by: Harrison Mutai <harrison.mu...@arm.com>
---
 common/Kconfig    | 7 +++++++
 common/bloblist.c | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/common/Kconfig b/common/Kconfig
index 9e89ccd390..11066ec643 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1056,6 +1056,12 @@ config BLOBLIST_ALLOC
          specify a fixed address on systems where this is unknown or can
          change at runtime.

+config BLOBLIST_PASSAGE
+       bool "Use bloblist in-place"
+       help
+         Use a bloblist in the incoming standard passage. The size is detected
+         automatically so CONFIG_BLOBLIST_SIZE can be 0.
+
 endchoice

 config BLOBLIST_ADDR
@@ -1070,6 +1076,7 @@ config BLOBLIST_ADDR

 config BLOBLIST_SIZE
        hex "Size of bloblist"
+       default 0x0 if BLOBLIST_PASSAGE
        default 0x400
        help
          Sets the size of the bloblist in bytes. This must include all
diff --git a/common/bloblist.c b/common/bloblist.c
index ec6ff7a5a9..db0091dc0e 100644
--- a/common/bloblist.c
+++ b/common/bloblist.c
@@ -475,6 +475,9 @@ int bloblist_reloc(void *to, uint to_size)
 {
        struct bloblist_hdr *hdr;

+       if (to_size == 0)
+               return 0;
+
        if (to_size < gd->bloblist->total_size)
                return -ENOSPC;

@@ -510,7 +513,7 @@ int bloblist_init(void)
         * install the bloblist passed from previous loader to this fixed
         * address.
         */
-       bool from_boot_arg = fixed && xpl_is_first_phase();
+       bool from_boot_arg = xpl_is_first_phase();

        if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
                from_addr = false;
--
2.46.2

Reply via email to