[PATCH 37/40] RFC: Allow passing ACPI tables to bootefi

Simon Glass sjg at chromium.org
Wed Dec 1 17:03:11 CET 2021


At present it seems possible to pass ACPI tables using bootefi but
in practice an error is produced about not beling allowed to pass
devicetree as well.

Add some workarounds for this. Presumably I am missing something and
this should already work. Perhaps fdt should be set to 0?

Not to be applied.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 cmd/bootefi.c           | 44 +++++++++++++++++------------------------
 lib/efi_loader/Makefile |  2 --
 2 files changed, 18 insertions(+), 28 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 83eab0bd7f1..9815f5766cc 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -142,8 +142,6 @@ static efi_status_t efi_env_set_load_options(efi_handle_t handle,
 	return ret;
 }
 
-#if !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE)
-
 /**
  * copy_fdt() - Copy the device tree to a new location available to EFI
  *
@@ -230,8 +228,6 @@ static void *get_config_table(const efi_guid_t *guid)
 	return NULL;
 }
 
-#endif /* !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) */
-
 /**
  * efi_install_fdt() - install device tree
  *
@@ -251,16 +247,6 @@ static void *get_config_table(const efi_guid_t *guid)
  */
 efi_status_t efi_install_fdt(void *fdt)
 {
-	/*
-	 * The EBBR spec requires that we have either an FDT or an ACPI table
-	 * but not both.
-	 */
-#if CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE)
-	if (fdt) {
-		log_err("ERROR: can't have ACPI table and device tree.\n");
-		return EFI_LOAD_ERROR;
-	}
-#else
 	bootm_headers_t img = { 0 };
 	efi_status_t ret;
 
@@ -316,7 +302,6 @@ efi_status_t efi_install_fdt(void *fdt)
 		log_err("ERROR: failed to install device tree\n");
 		return ret;
 	}
-#endif /* GENERATE_ACPI_TABLE */
 
 	return EFI_SUCCESS;
 }
@@ -625,19 +610,26 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,
 		return CMD_RET_FAILURE;
 	}
 
-	if (argc > 2) {
-		uintptr_t fdt_addr;
+	/*
+	 * The EBBR spec requires that we have either an FDT or an ACPI table
+	 * but not both.
+	 */
+	if (!IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE)) {
+		if (argc > 2) {
+			uintptr_t fdt_addr;
+
+			fdt_addr = hextoul(argv[2], NULL);
+			fdt = map_sysmem(fdt_addr, 0);
+		} else {
+			fdt = EFI_FDT_USE_INTERNAL;
+		}
 
-		fdt_addr = hextoul(argv[2], NULL);
-		fdt = map_sysmem(fdt_addr, 0);
-	} else {
-		fdt = EFI_FDT_USE_INTERNAL;
+		ret = efi_install_fdt(fdt);
+		if (ret == EFI_INVALID_PARAMETER)
+			return CMD_RET_USAGE;
+		else if (ret != EFI_SUCCESS)
+			return CMD_RET_FAILURE;
 	}
-	ret = efi_install_fdt(fdt);
-	if (ret == EFI_INVALID_PARAMETER)
-		return CMD_RET_USAGE;
-	else if (ret != EFI_SUCCESS)
-		return CMD_RET_FAILURE;
 
 	if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) {
 		if (!strcmp(argv[1], "bootmgr"))
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index fd344cea29b..1f8edecb983 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -30,9 +30,7 @@ obj-y += efi_console.o
 obj-y += efi_device_path.o
 obj-$(CONFIG_EFI_DEVICE_PATH_TO_TEXT) += efi_device_path_to_text.o
 obj-$(CONFIG_EFI_DEVICE_PATH_UTIL) += efi_device_path_utilities.o
-ifeq ($(CONFIG_GENERATE_ACPI_TABLE),)
 obj-y += efi_dt_fixup.o
-endif
 obj-y += efi_file.o
 obj-$(CONFIG_EFI_LOADER_HII) += efi_hii.o
 obj-y += efi_image_loader.o
-- 
2.34.0.rc2.393.gf8c9666880-goog



More information about the U-Boot mailing list