[PATCH 21/34] x86: Move coreboot sysinfo parsing into generic x86 code

Simon Glass sjg at chromium.org
Mon Mar 15 06:00:21 CET 2021


It is useful to be able to parse coreboot tables on any x86 build which is
booted from coreboot. Add a new Kconfig option to enable this feature and
move the code so it can be used on any board, if enabled.

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

 arch/x86/Kconfig                              | 21 +++++++++++++++++++
 arch/x86/cpu/coreboot/Makefile                |  1 -
 arch/x86/lib/Makefile                         |  1 +
 arch/x86/lib/coreboot/Makefile                |  6 ++++++
 .../tables.c => lib/coreboot/cb_sysinfo.c}    |  0
 5 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 arch/x86/lib/coreboot/Makefile
 rename arch/x86/{cpu/coreboot/tables.c => lib/coreboot/cb_sysinfo.c} (100%)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index eddf2a774ef..ef2df10d38d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1023,4 +1023,25 @@ config INTEL_GMA_SWSMISCI
 	  Select this option for Atom-based platforms which use the SWSMISCI
 	  register (0xe0) rather than the SWSCI register (0xe8).
 
+config COREBOOT_SYSINFO
+	bool "Support reading coreboot sysinfo"
+	default y if SYS_COREBOOT
+	help
+	  Select this option to read the coreboot sysinfo table on start-up,
+	  if present. This is written by coreboot before it exits and provides
+	  various pieces of information about the running system, including
+	  display, memory and build information. It is stored in
+	  struct sysinfo_t after parsing by get_coreboot_info().
+
+config SPL_COREBOOT_SYSINFO
+	bool "Support reading coreboot sysinfo"
+	depends on SPL
+	default y if COREBOOT_SYSINFO
+	help
+	  Select this option to read the coreboot sysinfo table in SPL,
+	  if present. This is written by coreboot before it exits and provides
+	  various pieces of information about the running system, including
+	  display, memory and build information. It is stored in
+	  struct sysinfo_t after parsing by get_coreboot_info().
+
 endmenu
diff --git a/arch/x86/cpu/coreboot/Makefile b/arch/x86/cpu/coreboot/Makefile
index 605f90304e3..a6cdb9a1485 100644
--- a/arch/x86/cpu/coreboot/Makefile
+++ b/arch/x86/cpu/coreboot/Makefile
@@ -20,5 +20,4 @@ else
 obj-y += sdram.o
 endif
 obj-y += coreboot.o
-obj-y += tables.o
 obj-y += timestamp.o
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 1bcbb49a61f..65d9b3bd6a3 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -15,6 +15,7 @@ ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
 endif
 obj-y	+= cmd_boot.o
+obj-$(CONFIG_$(SPL_)COREBOOT_SYSINFO)	+= coreboot/
 obj-$(CONFIG_SEABIOS) += coreboot_table.o
 obj-y	+= early_cmos.o
 obj-y	+= e820.o
diff --git a/arch/x86/lib/coreboot/Makefile b/arch/x86/lib/coreboot/Makefile
new file mode 100644
index 00000000000..b5250d916b2
--- /dev/null
+++ b/arch/x86/lib/coreboot/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier:	GPL-2.0+
+#
+# Copyright 2021 Google LLC
+#
+
+obj-y += cb_sysinfo.o
diff --git a/arch/x86/cpu/coreboot/tables.c b/arch/x86/lib/coreboot/cb_sysinfo.c
similarity index 100%
rename from arch/x86/cpu/coreboot/tables.c
rename to arch/x86/lib/coreboot/cb_sysinfo.c
-- 
2.31.0.rc2.261.g7f71774620-goog



More information about the U-Boot mailing list