From: Heinrich Schuchardt Date: Wed, 4 Dec 2019 11:31:12 +0000 (+0100) Subject: efi_loader: use hardware device tree by default X-Git-Tag: v2020.10~423^2~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=753aa18f176af214b8f054c45f99bc20dfb15938;p=platform%2Fkernel%2Fu-boot.git efi_loader: use hardware device tree by default If the bootefi command is called without passing the address of a device tree, the internal device tree is used. For devices with a hardware device tree it is preferable to used the hardware device tree in this case. Signed-off-by: Heinrich Schuchardt --- diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 2b190a3..a3e2a05 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -200,14 +200,16 @@ static void *get_config_table(const efi_guid_t *guid) * * If fdt_addr is available, the device tree located at that memory address will * will be installed as configuration table, otherwise the device tree located - * at the address indicated by environment variable fdtcontroladdr will be used. + * at the address indicated by environment variable fdt_addr or as fallback + * fdtcontroladdr will be used. * * On architectures using ACPI tables device trees shall not be installed as * configuration table. * * @fdt_addr: address of device tree or EFI_FDT_USE_INTERNAL to use the - * internal device tree as indicated by environment variable - * fdtcontroladdr + * the hardware device tree as indicated by environment variable + * fdt_addr or as fallback the internal device tree as indicated by + * the environment variable fdtcontroladdr * Return: status code */ static efi_status_t efi_install_fdt(uintptr_t fdt_addr) @@ -232,15 +234,19 @@ static efi_status_t efi_install_fdt(uintptr_t fdt_addr) /* Look for device tree that is already installed */ if (get_config_table(&efi_guid_fdt)) return EFI_SUCCESS; - /* Use our own device tree as default */ - fdt_opt = env_get("fdtcontroladdr"); + /* Check if there is a hardware device tree */ + fdt_opt = env_get("fdt_addr"); + /* Use our own device tree as fallback */ if (!fdt_opt) { - printf("ERROR: need device tree\n"); - return EFI_NOT_FOUND; + fdt_opt = env_get("fdtcontroladdr"); + if (!fdt_opt) { + printf("ERROR: need device tree\n"); + return EFI_NOT_FOUND; + } } fdt_addr = simple_strtoul(fdt_opt, NULL, 16); if (!fdt_addr) { - printf("ERROR: invalid $fdtcontroladdr\n"); + printf("ERROR: invalid $fdt_addr or $fdtcontroladdr\n"); return EFI_LOAD_ERROR; } }