bloblist: add support for CONFIG_BLOBLIST_PASSAGE
authorHarrison Mutai <harrison.mutai@arm.com>
Tue, 4 Feb 2025 17:58:41 +0000 (17:58 +0000)
committerTom Rini <trini@konsulko.com>
Wed, 12 Feb 2025 00:08:58 +0000 (18:08 -0600)
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.mutai@arm.com>
common/Kconfig
common/bloblist.c

index f948987..7b2db46 100644 (file)
@@ -1066,6 +1066,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
@@ -1080,6 +1086,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
@@ -1090,7 +1097,6 @@ config BLOBLIST_SIZE
 config BLOBLIST_SIZE_RELOC
        hex "Size of bloblist after relocation"
        default BLOBLIST_SIZE if BLOBLIST_FIXED || BLOBLIST_ALLOC
-       default 0x0 if BLOBLIST_PASSAGE
        default 0x20000 if (ARM && EFI_LOADER && GENERATE_ACPI_TABLE)
        help
          Sets the size of the bloblist in bytes after relocation. Since U-Boot
index 110bb9d..1fcd387 100644 (file)
@@ -475,6 +475,9 @@ int bloblist_reloc(void *to, uint to_size)
 {
        struct bloblist_hdr *hdr;
 
+       if (!to_size)
+               return 0;
+
        if (to_size < gd->bloblist->total_size)
                return -ENOSPC;
 
@@ -505,13 +508,6 @@ int bloblist_init(void)
         * at a fixed address.
         */
        bool from_addr = fixed && !xpl_is_first_phase();
-       /*
-        * If U-Boot is in the first phase that an arch custom routine should
-        * install the bloblist passed from previous loader to this fixed
-        * address.
-        */
-       bool from_boot_arg = fixed && xpl_is_first_phase();
-
        if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
                from_addr = false;
        if (fixed)
@@ -519,7 +515,13 @@ int bloblist_init(void)
                                      CONFIG_BLOBLIST_ADDR);
        size = CONFIG_BLOBLIST_SIZE;
 
-       if (from_boot_arg)
+
+       /*
+        * If the current boot stage is the first phase of U-Boot, then an
+        * architecture-specific routine should be used to handle the bloblist
+        * passed from the previous boot loader
+        */
+       if (xpl_is_first_phase() && !IS_ENABLED(CONFIG_BLOBLIST_ALLOC))
                ret = xferlist_from_boot_arg(addr, size);
        else if (from_addr)
                ret = bloblist_check(addr, size);