Attention is currently required from: Cliff Huang, Lance Zhao, Tim Wawrzynczak.
Krystian Hebel has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/82698?usp=email )
Change subject: acpi/acpi.c: fix XSDT handling on QEMU ......................................................................
acpi/acpi.c: fix XSDT handling on QEMU
c2830c9 "acpi.c: Add XSDT on QEMU" added a code that copied RSDT to XSDT since QEMU doesn't generate the latter. However, this new code didn't move 'current' pointer forward if XSDT pointer was already non-zero, such as after warm reset. As a result, SSDT was written in place of XSDT, which resulted in panic in edk2 after a reboot.
This change covers SSDT generation with the same check for existing XSDT address as is used for tables generated by QEMU.
Change-Id: I7f38467b7de3f35fc3ec3854a840de8345cd0fe5 Signed-off-by: Krystian Hebel krystian.hebel@3mdeb.com --- M src/acpi/acpi.c 1 file changed, 29 insertions(+), 29 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/98/82698/1
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index 39eadc3..61ce5d9 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -1506,37 +1506,37 @@ */ for (int i = 0; existing_rsdt->entry[i]; i++) acpi_add_table(rsdp, (void *)(uintptr_t)existing_rsdt->entry[i]); + + /* Add BOOT0000 for Linux google firmware driver */ + printk(BIOS_DEBUG, "ACPI: * SSDT\n"); + ssdt = (acpi_header_t *)current; + current += sizeof(acpi_header_t); + + memset((void *)ssdt, 0, sizeof(acpi_header_t)); + + memcpy(&ssdt->signature, "SSDT", 4); + ssdt->revision = get_acpi_table_revision(SSDT); + memcpy(&ssdt->oem_id, OEM_ID, 6); + memcpy(&ssdt->oem_table_id, oem_table_id, 8); + ssdt->oem_revision = 42; + memcpy(&ssdt->asl_compiler_id, ASLC, 4); + ssdt->asl_compiler_revision = asl_revision; + ssdt->length = sizeof(acpi_header_t); + + acpigen_set_current((char *)current); + + /* Write object to declare coreboot tables */ + acpi_ssdt_write_cbtable(); + + /* (Re)calculate length and checksum. */ + ssdt->length = current - (unsigned long)ssdt; + ssdt->checksum = acpi_checksum((void *)ssdt, ssdt->length); + + acpi_create_ssdt_generator(ssdt, NULL); + + acpi_add_table(rsdp, ssdt); }
- /* Add BOOT0000 for Linux google firmware driver */ - printk(BIOS_DEBUG, "ACPI: * SSDT\n"); - ssdt = (acpi_header_t *)current; - current += sizeof(acpi_header_t); - - memset((void *)ssdt, 0, sizeof(acpi_header_t)); - - memcpy(&ssdt->signature, "SSDT", 4); - ssdt->revision = get_acpi_table_revision(SSDT); - memcpy(&ssdt->oem_id, OEM_ID, 6); - memcpy(&ssdt->oem_table_id, oem_table_id, 8); - ssdt->oem_revision = 42; - memcpy(&ssdt->asl_compiler_id, ASLC, 4); - ssdt->asl_compiler_revision = asl_revision; - ssdt->length = sizeof(acpi_header_t); - - acpigen_set_current((char *)current); - - /* Write object to declare coreboot tables */ - acpi_ssdt_write_cbtable(); - - /* (Re)calculate length and checksum. */ - ssdt->length = current - (unsigned long)ssdt; - ssdt->checksum = acpi_checksum((void *)ssdt, ssdt->length); - - acpi_create_ssdt_generator(ssdt, NULL); - - acpi_add_table(rsdp, ssdt); - return fw; }