diff mbox series

[2/2] efi_loader: Fix configuration table override

Message ID 20170726114105.51159-2-agraf@suse.de
State Accepted
Commit f4f9993f7ed0384f110324bb048a6cafb535378a
Headers show
Series [1/2] efi_loader: Improve install_configuration_table | expand

Commit Message

Alexander Graf July 26, 2017, 11:41 a.m. UTC
Before commit 7cbc12415d ("efi_loader: initalize EFI object list
only once") we recreated the world on every bootefi invocation.

That included the object tree as well as the configuration tables.

Now however we don't recreate them, which means we must not explicitly
override the configuration tables, as otherwise we may lose our SMBIOS
table from the configuration table list on second bootefi invocation.

This patch makes bootefi call our normal configuration table modification
APIs to add/remove the FDT instead of recreating all tables from scratch.
That way the SMBIOS table gets preserved across multiple invocations.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 cmd/bootefi.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Alexander Graf July 28, 2017, 10:25 p.m. UTC | #1
> Before commit 7cbc12415d ("efi_loader: initalize EFI object list
> only once") we recreated the world on every bootefi invocation.
> 
> That included the object tree as well as the configuration tables.
> 
> Now however we don't recreate them, which means we must not explicitly
> override the configuration tables, as otherwise we may lose our SMBIOS
> table from the configuration table list on second bootefi invocation.
> 
> This patch makes bootefi call our normal configuration table modification
> APIs to add/remove the FDT instead of recreating all tables from scratch.
> That way the SMBIOS table gets preserved across multiple invocations.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>

Thanks, applied to efi-next

Alex
diff mbox series

Patch

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 9526f6c60d..d20775eccd 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -215,6 +215,7 @@  static unsigned long do_bootefi_exec(void *efi, void *fdt)
 	ulong (*entry)(void *image_handle, struct efi_system_table *st)
 		asmlinkage;
 	ulong fdt_pages, fdt_size, fdt_start, fdt_end;
+	const efi_guid_t fdt_guid = EFI_FDT_GUID;
 	bootm_headers_t img = { 0 };
 
 	/*
@@ -233,9 +234,7 @@  static unsigned long do_bootefi_exec(void *efi, void *fdt)
 		}
 
 		/* Link to it in the efi tables */
-		systab.tables[0].guid = EFI_FDT_GUID;
-		systab.tables[0].table = fdt;
-		systab.nr_tables = 1;
+		efi_install_configuration_table(&fdt_guid, fdt);
 
 		/* And reserve the space in the memory map */
 		fdt_start = ((ulong)fdt) & ~EFI_PAGE_MASK;
@@ -248,7 +247,7 @@  static unsigned long do_bootefi_exec(void *efi, void *fdt)
 				   EFI_BOOT_SERVICES_DATA, true);
 	} else {
 		printf("WARNING: Invalid device tree, expect boot to fail\n");
-		systab.nr_tables = 0;
+		efi_install_configuration_table(&fdt_guid, NULL);
 	}
 
 	/* Load the EFI payload */