From cce7fa4e1e03862b1a8e6445a23743fa9b76a8e1 Mon Sep 17 00:00:00 2001 From: Andy-Python-Programmer Date: Tue, 5 Oct 2021 09:34:51 +1100 Subject: [PATCH] acpi_get_rsdp: UEFI RSDP lookup return RSDPv1 * This commit makes the acpi_get_rsdp function to return the RSDPv1 if avaliable (in UEFI) to match this functions behaviour under BIOS where it returns the XSDP or the RSDP depending on which one is avaliable. Signed-off-by: Andy-Python-Programmer --- stage23/lib/acpi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stage23/lib/acpi.c b/stage23/lib/acpi.c index 0cf01160..65589f5d 100644 --- a/stage23/lib/acpi.c +++ b/stage23/lib/acpi.c @@ -64,14 +64,18 @@ void acpi_get_smbios(void **smbios32, void **smbios64) { #include void *acpi_get_rsdp(void) { + EFI_GUID acpi_2_guid = ACPI_20_TABLE_GUID; + EFI_GUID acpi_1_guid = ACPI_TABLE_GUID; + for (size_t i = 0; i < gST->NumberOfTableEntries; i++) { EFI_CONFIGURATION_TABLE *cur_table = &gST->ConfigurationTable[i]; - EFI_GUID acpi_2_guid = ACPI_20_TABLE_GUID; - if (memcmp(&cur_table->VendorGuid, &acpi_2_guid, sizeof(EFI_GUID)) != 0) + if (memcmp(&cur_table->VendorGuid, &acpi_2_guid, sizeof(EFI_GUID)) != 0 || // XSDP + memcmp(&cur_table->VendorGuid, &acpi_1_guid, sizeof(EFI_GUID)) != 0) // RSDP continue; - if (acpi_checksum(cur_table->VendorTable, sizeof(struct rsdp)) != 0) + if (acpi_checksum(cur_table->VendorTable, sizeof(struct rsdp)) != 0 || // XSDP is 36 bytes wide + acpi_checksum(cur_table->VendorTable, 20) != 0) // RSDP is 20 bytes wide continue; printv("acpi: Found RSDP at %X\n", cur_table->VendorTable);