coreboot/src/acpi
Patrick Rudolph 4b43dac16b acpi/acpi: Fix Qemu's XSDT patching code
Since Qemu doesn't provide an XSDT, coreboot adds one as separate ACPI
table. Qemu only provides the smaller ACPI 1.0 RSDP, but the XSDT can
only fit into the bigger ACPI 2.0 RSDP. Currently the exsting RSDP is
being reused, without a size check, which works fine on the first boot.
However after reboot the XSDT pointer seems to be valid, even though the
checksum isn't. Since the XSDT then isn't reserved again on reboot, the
memory it's pointing to is reused by other tables, causing the
payload/OS to see an invalid XSDT.

Instead of corrupting the smaller existing RSDP, allocate a new RSDP
structure and properly fill it with both, existing RSDT and XSDT.

In addition return the correct length of allocated ACPI tables to the
calling code. It was ommiting the size of the allocated XSDT and SSDT.

TEST: Run "qemu-system-x86_64 -M q35" and reboot the virtual machine.
      With this patch applied XSDT is always valid from the OS
      point of view.

Change-Id: Ie4972230c3654714f3dcbaab46a3f70152e75163
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83116
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-06-24 17:12:48 +00:00
..
acpi.c acpi/acpi: Fix Qemu's XSDT patching code 2024-06-24 17:12:48 +00:00
acpi_apic.c acpi/acpi_apic;arch/x86/acpi: better document ACPI_NO_PCAT_8259 case 2024-05-27 14:49:22 +00:00
acpi_dmar.c arch/x86/ioapic: use uintptr_t for IOAPIC base address 2024-02-23 15:13:37 +00:00
acpi_gic.c acpi: add missing device/device.h include 2023-12-07 13:19:47 +00:00
acpi_hpet.c acpi: add missing device/device.h include 2023-12-07 13:19:47 +00:00
acpi_pm.c ACPI: Add usb_charge_mode_from_gnvs() 2023-08-16 17:55:02 +00:00
acpi_pptt.c acpi: Add PPTT support 2023-12-02 19:16:26 +00:00
acpigen.c tree: Use <stdio.h> for snprintf 2024-05-29 10:33:54 +00:00
acpigen_dptf.c tree: Use <stdio.h> for snprintf 2024-05-29 10:33:54 +00:00
acpigen_dsm.c drivers/usb/acpi: Add USB _DSM method to enable/disable USB LPM per port 2023-01-19 05:58:33 +00:00
acpigen_extern.asl ChromeOS: Refactor ACPI CNVS generation 2021-12-23 21:18:25 +00:00
acpigen_pci.c acpi: Remove acpigen_write_OSC_pci_domain 2024-05-06 10:48:06 +00:00
acpigen_pci_root_resource_producer.c acpi/acpigen_pci_root_resource_producer: zero-pad ranges 2024-03-01 16:24:22 +00:00
acpigen_ps2_keybd.c acpigen_ps2_keybd: Support a Do Not Disturb key 2024-06-24 15:17:56 +00:00
acpigen_usb.c tree: Use <stdio.h> for snprintf 2024-05-29 10:33:54 +00:00
device.c tree: Use <stdio.h> for snprintf 2024-05-29 10:33:54 +00:00
dsdt_top.asl acpi: Enable 64bit ECAM resource 2023-11-27 21:10:41 +00:00
fadt_filler.c ACPI: Add helper fill_fadt_extended_pm_io() 2023-08-08 06:51:03 +00:00
gnvs.c acpi: Remove blank lines before '}' and after '{' 2024-03-30 07:42:12 +00:00
Kconfig acpigen_ps2_keybd: Add Fn key to linux,keymap 2024-04-19 17:22:48 +00:00
Makefile.mk soc/amd: move common pci_domain_fill_ssdt implementation to acpi/ 2024-02-29 15:39:06 +00:00
pld.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
sata.c src/acpi: Remove unused <acpi/acpi.h> 2022-01-10 17:22:47 +00:00
soundwire.c acpi/soundwire.[ch]: Fix dpn entry array overrun 2023-09-13 15:26:01 +00:00