From e91b68fd6b83d6e4c862000630d240b339cc5a7b Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 26 Apr 2024 16:13:21 +0200 Subject: efi_loader: load distro dtb in bootmgr If no device-tree is specified, try to load a device-tree from the boot device use the $fdtfile concatenated to either of the paths '/dtb/', '/', '/dtb/current/'. Signed-off-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- lib/efi_loader/efi_bootmgr.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/efi_loader/efi_bootmgr.c') diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c index 2c140bb70cd..304ed43595c 100644 --- a/lib/efi_loader/efi_bootmgr.c +++ b/lib/efi_loader/efi_bootmgr.c @@ -1253,7 +1253,8 @@ efi_status_t efi_bootmgr_run(void *fdt) efi_handle_t handle; void *load_options; efi_status_t ret; - void *fdt_lo; + void *fdt_lo, *fdt_distro = NULL; + efi_uintn_t fdt_size; /* Initialize EFI drivers */ ret = efi_init_obj_list(); @@ -1275,6 +1276,10 @@ efi_status_t efi_bootmgr_run(void *fdt) return ret; if (fdt_lo) fdt = fdt_lo; + if (!fdt) { + efi_load_distro_fdt(&fdt_distro, &fdt_size); + fdt = fdt_distro; + } } /* @@ -1283,8 +1288,12 @@ efi_status_t efi_bootmgr_run(void *fdt) */ ret = efi_install_fdt(fdt); - if (!IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE)) + if (!IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE)) { free(fdt_lo); + if (fdt_distro) + efi_free_pages((uintptr_t)fdt_distro, + efi_size_in_pages(fdt_size)); + } if (ret != EFI_SUCCESS) { if (EFI_CALL(efi_unload_image(handle)) == EFI_SUCCESS) -- cgit v1.2.3