[PATCH 04/13] x86: coreboot: Allow ACPI tables to be recorded

Simon Glass sjg at chromium.org
Mon Feb 20 20:49:18 CET 2023


At present any ACPI tables created by prior-stage firmware are ignored.
It is useful to be able to view these in U-Boot.

Add the acpi command for coreboot and use that to allow recording the
ACPI-table start.

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

 cmd/Kconfig                       | 3 +--
 cmd/acpi.c                        | 4 ++++
 include/asm-generic/global_data.h | 4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index b2d75987170..97c8610e461 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -109,8 +109,7 @@ menu "Info commands"
 
 config CMD_ACPI
 	bool "acpi"
-	depends on ACPIGEN
-	default y
+	default y if TARGET_COREBOOT || ACPIGEN
 	help
 	  List and dump ACPI tables. ACPI (Advanced Configuration and Power
 	  Interface) is used mostly on x86 for providing information to the
diff --git a/cmd/acpi.c b/cmd/acpi.c
index d0fc062ef8c..991b5235e28 100644
--- a/cmd/acpi.c
+++ b/cmd/acpi.c
@@ -162,6 +162,10 @@ static int do_acpi_items(struct cmd_tbl *cmdtp, int flag, int argc,
 	bool dump_contents;
 
 	dump_contents = argc >= 2 && !strcmp("-d", argv[1]);
+	if (!IS_ENABLED(CONFIG_ACPIGEN)) {
+		printf("Not supported (enable ACPIGEN)\n");
+		return CMD_RET_FAILURE;
+	}
 	acpi_dump_items(dump_contents ? ACPI_DUMP_CONTENTS : ACPI_DUMP_LIST);
 
 	return 0;
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index da17ac8cbc8..2e3feb5a8c0 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -457,7 +457,7 @@ struct global_data {
 	 */
 	fdt_addr_t translation_offset;
 #endif
-#ifdef CONFIG_GENERATE_ACPI_TABLE
+#if defined(CONFIG_GENERATE_ACPI_TABLE) || defined(CONFIG_CMD_ACPI)
 	/**
 	 * @acpi_ctx: ACPI context pointer
 	 */
@@ -536,7 +536,7 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
 #define gd_dm_priv_base()		NULL
 #endif
 
-#ifdef CONFIG_GENERATE_ACPI_TABLE
+#if defined(CONFIG_GENERATE_ACPI_TABLE) || defined(CONFIG_CMD_ACPI)
 #define gd_acpi_ctx()		gd->acpi_ctx
 #define gd_acpi_start()		gd->acpi_start
 #define gd_set_acpi_start(addr)	gd->acpi_start = addr
-- 
2.39.2.637.g21b0678d19-goog



More information about the U-Boot mailing list