]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: Call fdt preparation functions
authorAlexander Graf <agraf@suse.de>
Fri, 4 Mar 2016 00:10:13 +0000 (01:10 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 16 Mar 2016 01:30:14 +0000 (21:30 -0400)
We have a nice framework around image fils to prepare a device tree
for OS execution. That one patches in missing device tree nodes and
fixes up the memory range bits.

We need to call that one from the EFI boot path too to get all those
nice fixups. This patch adds the call.

Signed-off-by: Alexander Graf <agraf@suse.de>
cmd/bootefi.c
common/image-fdt.c

index 98d1fcaba2d3a10b420df2538e5e29f66dd6abd7..2b104d4908489b17382e8e1c2418f348a36095b9 100644 (file)
@@ -92,6 +92,7 @@ static unsigned long do_bootefi_exec(void *efi)
 {
        ulong (*entry)(void *image_handle, struct efi_system_table *st);
        ulong fdt_pages, fdt_size, fdt_start, fdt_end;
+       bootm_headers_t img = { 0 };
 
        /*
         * gd lives in a fixed register which may get clobbered while we execute
@@ -102,6 +103,13 @@ static unsigned long do_bootefi_exec(void *efi)
        /* Update system table to point to our currently loaded FDT */
 
        if (working_fdt) {
+               /* Prepare fdt for payload */
+               if (image_setup_libfdt(&img, working_fdt, 0, NULL)) {
+                       printf("ERROR: Failed to process device tree\n");
+                       return -EINVAL;
+               }
+
+               /* Link to it in the efi tables */
                systab.tables[0].guid = EFI_FDT_GUID;
                systab.tables[0].table = working_fdt;
                systab.nr_tables = 1;
index 8c3f3e63740c08db668bcd6a6d9f96c68bdf2696..6cac7dbb7f8b2ff0fe5114b9d65ba655e3bf2fc3 100644 (file)
@@ -502,8 +502,9 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
        fdt_fixup_ethernet(blob);
 
        /* Delete the old LMB reservation */
-       lmb_free(lmb, (phys_addr_t)(u32)(uintptr_t)blob,
-                (phys_size_t)fdt_totalsize(blob));
+       if (lmb)
+               lmb_free(lmb, (phys_addr_t)(u32)(uintptr_t)blob,
+                        (phys_size_t)fdt_totalsize(blob));
 
        ret = fdt_shrink_to_minimum(blob);
        if (ret < 0)
@@ -515,7 +516,8 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
                fdt_set_totalsize(blob, of_size);
        }
        /* Create a new LMB reservation */
-       lmb_reserve(lmb, (ulong)blob, of_size);
+       if (lmb)
+               lmb_reserve(lmb, (ulong)blob, of_size);
 
        fdt_initrd(blob, *initrd_start, *initrd_end);
        if (!ft_verify_fdt(blob))