[3/6] x86: efistub: Obtain ACPI RSDP address while running in the stub

Message ID 20230424165726.2245548-4-ardb@kernel.org
State New
Headers
Series efi/x86: Avoid legacy decompressor during EFI boot |

Commit Message

Ard Biesheuvel April 24, 2023, 4:57 p.m. UTC
  One of the actions performed by the decompressor is populating the RSDP
address field in the boot_params struct, and when doing EFI boot, EFI
configuration tables are the preferred source for this information.

In preparation for removing the decompressor code from the EFI stub boot
path, set this field from the EFI stub code.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/libstub/x86-stub.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Patch

diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
index a0bfd31358ba97b1..e136c94037dda8d3 100644
--- a/drivers/firmware/efi/libstub/x86-stub.c
+++ b/drivers/firmware/efi/libstub/x86-stub.c
@@ -787,6 +787,11 @@  asmlinkage unsigned long efi_main(efi_handle_t handle,
 		efi_dxe_table = NULL;
 	}
 
+	if (!boot_params->acpi_rsdp_addr)
+		boot_params->acpi_rsdp_addr = (unsigned long)
+				(get_efi_config_table(ACPI_20_TABLE_GUID) ?:
+				 get_efi_config_table(ACPI_TABLE_GUID));
+
 	/*
 	 * If the kernel isn't already loaded at a suitable address,
 	 * relocate it.