summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2019-12-04 12:31:12 +0100
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2020-01-07 18:08:20 +0100
commit753aa18f176af214b8f054c45f99bc20dfb15938 (patch)
treeba61cad334dbdf1391ba17c5f979d81c3f7ab8b4 /cmd
parent7a597259d26f84a63350b6a1af5b29445e9d451b (diff)
downloadu-boot-753aa18f176af214b8f054c45f99bc20dfb15938.tar.gz
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 <xypron.glpk@gmx.de>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/bootefi.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 2b190a3edd..a3e2a05126 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;
}
}