From 1728a2f82361eaaa3a034258dafc67db02bf5b11 Mon Sep 17 00:00:00 2001 From: Mintsuki Date: Sat, 14 Jun 2025 00:43:42 +0200 Subject: [PATCH] ACPI: Prefer ACPI 2.0 over 1.0 table Before this, it would be random depending on table order. --- src/acpi.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/acpi.c b/src/acpi.c index e5a6888..bf8386b 100644 --- a/src/acpi.c +++ b/src/acpi.c @@ -369,12 +369,19 @@ bool acpi_init(struct csmwrap_priv *priv) { g_rsdp = (uintptr_t)table->VendorTable; break; } + } - if (!efi_guidcmp(table->VendorGuid, acpiGuid)) { - printf("Found ACPI 1.0 RSDT at %x, copied to %x\n", (uintptr_t)table->VendorTable, (uintptr_t)table_target); - memcpy(table_target, table->VendorTable, sizeof(EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER)); - g_rsdp = (uintptr_t)table->VendorTable; - break; + if (g_rsdp == 0) { + for (i = 0; i < gST->NumberOfTableEntries; i++) { + EFI_CONFIGURATION_TABLE *table; + table = gST->ConfigurationTable + i; + + if (!efi_guidcmp(table->VendorGuid, acpiGuid)) { + printf("Found ACPI 1.0 RSDT at %x, copied to %x\n", (uintptr_t)table->VendorTable, (uintptr_t)table_target); + memcpy(table_target, table->VendorTable, sizeof(EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER)); + g_rsdp = (uintptr_t)table->VendorTable; + break; + } } }