acpi: use 64-bit addresses in FADT table

Fields X_FIRMWAE_CTRL and X_DSDT must be 64bit wide. Convert pointers to
to uintptr_t to fill these.

If field X_FIRMWARE_CTRL is filled, field FIRMWARE must be ignored. If
field X_DSDT is filled, field DSDT must be ignored. We should not fill
unused fields.

See the field definitions in chapter "5.2.9 Fixed ACPI Description Table
(FADT)" of the ACPI Specification 6.5.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Heinrich Schuchardt 2023-12-16 09:11:57 +01:00 committed by Simon Glass
parent 70fe238594
commit a083ae71e0
5 changed files with 13 additions and 29 deletions

View file

@ -7,6 +7,7 @@
#include <cpu.h> #include <cpu.h>
#include <dm.h> #include <dm.h>
#include <log.h> #include <log.h>
#include <mapmem.h>
#include <acpi/acpi_s3.h> #include <acpi/acpi_s3.h>
#include <acpi/acpi_table.h> #include <acpi/acpi_table.h>
#include <asm/io.h> #include <asm/io.h>
@ -31,8 +32,6 @@ static int baytrail_write_fadt(struct acpi_ctx *ctx,
header->length = sizeof(struct acpi_fadt); header->length = sizeof(struct acpi_fadt);
header->revision = 4; header->revision = 4;
fadt->firmware_ctrl = (u32)ctx->facs;
fadt->dsdt = (u32)ctx->dsdt;
fadt->preferred_pm_profile = ACPI_PM_MOBILE; fadt->preferred_pm_profile = ACPI_PM_MOBILE;
fadt->sci_int = 9; fadt->sci_int = 9;
fadt->smi_cmd = 0; fadt->smi_cmd = 0;
@ -79,10 +78,8 @@ static int baytrail_write_fadt(struct acpi_ctx *ctx,
fadt->reset_reg.addrh = 0; fadt->reset_reg.addrh = 0;
fadt->reset_value = SYS_RST | RST_CPU | FULL_RST; fadt->reset_value = SYS_RST | RST_CPU | FULL_RST;
fadt->x_firmware_ctl_l = (u32)ctx->facs; fadt->x_firmware_ctrl = map_to_sysmem(ctx->facs);
fadt->x_firmware_ctl_h = 0; fadt->x_dsdt = map_to_sysmem(ctx->dsdt);
fadt->x_dsdt_l = (u32)ctx->dsdt;
fadt->x_dsdt_h = 0;
fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO; fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
fadt->x_pm1a_evt_blk.bit_width = fadt->pm1_evt_len * 8; fadt->x_pm1a_evt_blk.bit_width = fadt->pm1_evt_len * 8;

View file

@ -4,6 +4,7 @@
*/ */
#include <common.h> #include <common.h>
#include <mapmem.h>
#include <acpi/acpi_table.h> #include <acpi/acpi_table.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/tables.h> #include <asm/tables.h>
@ -26,8 +27,6 @@ static int quark_write_fadt(struct acpi_ctx *ctx,
header->length = sizeof(struct acpi_fadt); header->length = sizeof(struct acpi_fadt);
header->revision = 4; header->revision = 4;
fadt->firmware_ctrl = (u32)ctx->facs;
fadt->dsdt = (u32)ctx->dsdt;
fadt->preferred_pm_profile = ACPI_PM_UNSPECIFIED; fadt->preferred_pm_profile = ACPI_PM_UNSPECIFIED;
fadt->sci_int = 9; fadt->sci_int = 9;
fadt->smi_cmd = 0; fadt->smi_cmd = 0;
@ -74,10 +73,8 @@ static int quark_write_fadt(struct acpi_ctx *ctx,
fadt->reset_reg.addrh = 0; fadt->reset_reg.addrh = 0;
fadt->reset_value = SYS_RST | RST_CPU | FULL_RST; fadt->reset_value = SYS_RST | RST_CPU | FULL_RST;
fadt->x_firmware_ctl_l = (u32)ctx->facs; fadt->x_firmware_ctrl = map_to_sysmem(ctx->facs);
fadt->x_firmware_ctl_h = 0; fadt->x_dsdt = map_to_sysmem(ctx->dsdt);
fadt->x_dsdt_l = (u32)ctx->dsdt;
fadt->x_dsdt_h = 0;
fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO; fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
fadt->x_pm1a_evt_blk.bit_width = fadt->pm1_evt_len * 8; fadt->x_pm1a_evt_blk.bit_width = fadt->pm1_evt_len * 8;

View file

@ -8,6 +8,7 @@
#include <common.h> #include <common.h>
#include <cpu.h> #include <cpu.h>
#include <dm.h> #include <dm.h>
#include <mapmem.h>
#include <acpi/acpi_table.h> #include <acpi/acpi_table.h>
#include <asm/ioapic.h> #include <asm/ioapic.h>
#include <asm/mpspec.h> #include <asm/mpspec.h>
@ -31,8 +32,6 @@ static int tangier_write_fadt(struct acpi_ctx *ctx,
header->length = sizeof(struct acpi_fadt); header->length = sizeof(struct acpi_fadt);
header->revision = 6; header->revision = 6;
fadt->firmware_ctrl = (u32)ctx->facs;
fadt->dsdt = (u32)ctx->dsdt;
fadt->preferred_pm_profile = ACPI_PM_UNSPECIFIED; fadt->preferred_pm_profile = ACPI_PM_UNSPECIFIED;
fadt->iapc_boot_arch = ACPI_FADT_VGA_NOT_PRESENT | fadt->iapc_boot_arch = ACPI_FADT_VGA_NOT_PRESENT |
@ -45,10 +44,8 @@ static int tangier_write_fadt(struct acpi_ctx *ctx,
fadt->minor_revision = 2; fadt->minor_revision = 2;
fadt->x_firmware_ctl_l = (u32)ctx->facs; fadt->x_firmware_ctrl = map_to_sysmem(ctx->facs);
fadt->x_firmware_ctl_h = 0; fadt->x_dsdt = map_to_sysmem(ctx->dsdt);
fadt->x_dsdt_l = (u32)ctx->dsdt;
fadt->x_dsdt_h = 0;
header->checksum = table_compute_checksum(fadt, header->length); header->checksum = table_compute_checksum(fadt, header->length);

View file

@ -572,13 +572,8 @@ void acpi_fadt_common(struct acpi_fadt *fadt, struct acpi_facs *facs,
memcpy(header->aslc_id, ASLC_ID, 4); memcpy(header->aslc_id, ASLC_ID, 4);
header->aslc_revision = 1; header->aslc_revision = 1;
fadt->firmware_ctrl = (unsigned long)facs; fadt->x_firmware_ctrl = map_to_sysmem(facs);
fadt->dsdt = (unsigned long)dsdt; fadt->x_dsdt = map_to_sysmem(dsdt);
fadt->x_firmware_ctl_l = (unsigned long)facs;
fadt->x_firmware_ctl_h = 0;
fadt->x_dsdt_l = (unsigned long)dsdt;
fadt->x_dsdt_h = 0;
fadt->preferred_pm_profile = ACPI_PM_MOBILE; fadt->preferred_pm_profile = ACPI_PM_MOBILE;

View file

@ -228,10 +228,8 @@ struct __packed acpi_fadt {
u8 reset_value; u8 reset_value;
u16 arm_boot_arch; u16 arm_boot_arch;
u8 minor_revision; u8 minor_revision;
u32 x_firmware_ctl_l; u64 x_firmware_ctrl;
u32 x_firmware_ctl_h; u64 x_dsdt;
u32 x_dsdt_l;
u32 x_dsdt_h;
struct acpi_gen_regaddr x_pm1a_evt_blk; struct acpi_gen_regaddr x_pm1a_evt_blk;
struct acpi_gen_regaddr x_pm1b_evt_blk; struct acpi_gen_regaddr x_pm1b_evt_blk;
struct acpi_gen_regaddr x_pm1a_cnt_blk; struct acpi_gen_regaddr x_pm1a_cnt_blk;