From 8473e8fd5fd861da1e511dc143d9cf199d9dd89a Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Thu, 29 Jun 2023 20:26:39 +0200 Subject: acpi.c: Fill in >4G FADT entries correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Arthur Heymans Change-Id: I84ab0068e8409a5e525ddc781347087680d80640 Reviewed-on: https://review.coreboot.org/c/coreboot/+/76179 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber Reviewed-by: Kyösti Mälkki --- src/acpi/acpi.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index 0bb49f6ff7..dea4c27a70 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -1086,13 +1086,17 @@ static void acpi_create_fadt(acpi_header_t *header, void *arg1) return; fadt->FADT_MinorVersion = get_acpi_fadt_minor_version(); - fadt->firmware_ctrl = (unsigned long)facs; - fadt->x_firmware_ctl_l = (unsigned long)facs; - fadt->x_firmware_ctl_h = 0; + if ((uintptr_t)facs <= UINT32_MAX) + fadt->firmware_ctrl = (uintptr_t)facs; + else + fadt->x_firmware_ctl_h = (uint32_t)((uint64_t)(uintptr_t)facs >> 32); + fadt->x_firmware_ctl_l = (uint32_t)(uintptr_t)facs; - fadt->dsdt = (unsigned long)dsdt; - fadt->x_dsdt_l = (unsigned long)dsdt; - fadt->x_dsdt_h = 0; + if ((uintptr_t)dsdt <= UINT32_MAX) + fadt->dsdt = (uintptr_t)dsdt; + else + fadt->x_dsdt_h = (uint32_t)((uint64_t)(uintptr_t)dsdt >> 32); + fadt->x_dsdt_l = (uint32_t)(uintptr_t)dsdt; /* should be 0 ACPI 3.0 */ fadt->reserved = 0; -- cgit v1.2.3