Signed-off-by: Laszlo Ersek lersek@redhat.com --- src/acpi.c | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/acpi.c b/src/acpi.c index 8bbc92b..611553e 100644 --- a/src/acpi.c +++ b/src/acpi.c @@ -797,13 +797,13 @@ acpi_setup(void) struct fadt_descriptor_rev1 *fadt = build_fadt(pci); ACPI_INIT_TABLE(fadt); ACPI_INIT_TABLE(build_ssdt()); - ACPI_INIT_TABLE(build_madt()); ACPI_INIT_TABLE(build_hpet()); ACPI_INIT_TABLE(build_srat()); if (pci->device == PCI_DEVICE_ID_INTEL_ICH9_LPC) ACPI_INIT_TABLE(build_mcfg_q35());
struct romfile_s *file = NULL; + int madt_found = 0; for (;;) { file = romfile_findprefix("acpi/", file); if (!file) @@ -816,13 +816,19 @@ acpi_setup(void) int ret = file->copy(file, table, file->size); if (ret <= sizeof(*table)) continue; - if (table->signature == DSDT_SIGNATURE) { + switch (table->signature) { + case DSDT_SIGNATURE: if (fadt) { fill_dsdt(fadt, table); } - } else { + break; + case APIC_SIGNATURE: + madt_found = 1; + /* fall through */ + default: ACPI_INIT_TABLE(table); } + if (tbl_idx == MAX_ACPI_TABLES) { warn_noalloc(); break; @@ -838,6 +844,13 @@ acpi_setup(void) memcpy(dsdt, AmlCode, sizeof(AmlCode)); fill_dsdt(fadt, dsdt); } + if (!madt_found) { + if (tbl_idx == MAX_ACPI_TABLES) { + warn_noalloc(); + return; + } + ACPI_INIT_TABLE(build_madt()); + }
// Build final rsdt table struct rsdt_descriptor_rev1 *rsdt;