[Concept,v2,14/22] efi: app: Pick up the SMBIOS table

Message ID 20250819185900.835939-15-sjg@u-boot.org
State New
Headers
Series efi: Improvements for the EFI app on ARM |

Commit Message

Simon Glass Aug. 19, 2025, 6:58 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

If an SMBIOS table is available, pick it up so that it can be parsed, or
examined with the 'smbios' command.

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

(no changes since v1)

 lib/Kconfig              | 3 ++-
 lib/efi_client/efi_app.c | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)
  

Patch

diff --git a/lib/Kconfig b/lib/Kconfig
index 0834d46fbb4..ed35c1f0b30 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -1168,7 +1168,7 @@  config SPL_OID_REGISTRY
 
 config SMBIOS
 	bool "SMBIOS support"
-	depends on X86 || EFI_LOADER
+	depends on X86 || EFI_LOADER || EFI_APP
 	default y
 	select LAST_STAGE_INIT
 	imply CMD_SMBIOS if X86
@@ -1183,6 +1183,7 @@  config SMBIOS
 
 config SMBIOS_PARSER
 	bool "SMBIOS parser"
+	default y if EFI_APP
 	help
 	  A simple parser for SMBIOS data.
 
diff --git a/lib/efi_client/efi_app.c b/lib/efi_client/efi_app.c
index 92aee94a695..00022b0ab9f 100644
--- a/lib/efi_client/efi_app.c
+++ b/lib/efi_client/efi_app.c
@@ -159,6 +159,7 @@  static void free_memory(struct efi_priv *priv)
 static void scan_tables(struct efi_system_table *sys_table)
 {
 	efi_guid_t acpi = EFI_ACPI_TABLE_GUID;
+	efi_guid_t smbios = SMBIOS3_TABLE_GUID;
 	uint i;
 
 	for (i = 0; i < sys_table->nr_tables; i++) {
@@ -166,6 +167,8 @@  static void scan_tables(struct efi_system_table *sys_table)
 
 		if (!memcmp(&tab->guid, &acpi, sizeof(efi_guid_t)))
 			gd_set_acpi_start(map_to_sysmem(tab->table));
+		else if (!memcmp(&tab->guid, &smbios, sizeof(efi_guid_t)))
+			gd->arch.smbios_start = map_to_sysmem(tab->table);
 	}
 }