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

From: Ard Biesheuvel
Date: Mon Apr 24 2023 - 12:58:07 EST


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@xxxxxxxxxx>
---
drivers/firmware/efi/libstub/x86-stub.c | 5 +++++
1 file changed, 5 insertions(+)

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.
--
2.39.2