From 8b950f4d7abed355c4d6ee88483a463d20f2da9d Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Wed, 16 Feb 2022 12:08:16 +0100 Subject: src/acpi: Add macro for FADT Minor Version and use it Change-Id: I6a0e9b33c6a1045a3a4a6717487525b82d41e558 Signed-off-by: Elyes Haouas Reviewed-on: https://review.coreboot.org/c/coreboot/+/62036 Tested-by: build bot (Jenkins) Reviewed-by: Lance Zhao --- src/acpi/acpi.c | 7 ++++++- src/include/acpi/acpi.h | 24 +++++++++++++++++------- src/soc/amd/picasso/acpi.c | 2 +- src/soc/amd/stoneyridge/acpi.c | 2 +- src/southbridge/amd/agesa/hudson/fadt.c | 2 +- src/southbridge/amd/cimx/sb800/fadt.c | 2 +- src/southbridge/amd/pi/hudson/fadt.c | 2 +- 7 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index 3bf57c6ff2..e3f77e0f6a 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -1944,11 +1944,16 @@ __weak int acpi_get_gpe(int gpe) return -1; /* implemented by SOC */ } +u8 get_acpi_fadt_minor_version(void) +{ + return ACPI_FADT_MINOR_VERSION_0; +} + int get_acpi_table_revision(enum acpi_tables table) { switch (table) { case FADT: - return ACPI_FADT_REV_ACPI_6_0; + return ACPI_FADT_REV_ACPI_6; case MADT: /* ACPI 3.0: 2, ACPI 4.0/5.0: 3, ACPI 6.2b/6.3: 5 */ return 3; case MCFG: diff --git a/src/include/acpi/acpi.h b/src/include/acpi/acpi.h index b5421e74cb..c5a04f0acc 100644 --- a/src/include/acpi/acpi.h +++ b/src/include/acpi/acpi.h @@ -747,7 +747,7 @@ typedef struct acpi_fadt { acpi_addr_t reset_reg; u8 reset_value; u16 ARM_boot_arch; /* Revision 6 only, Revision 5: Must be zero */ - u8 FADT_MinorVersion; /* Revision 6 only, Revision 5: Must be zero */ + u8 FADT_MinorVersion; /* Must be zero if ACPI Revision <= 5.0 */ u32 x_firmware_ctl_l; u32 x_firmware_ctl_h; u32 x_dsdt_l; @@ -768,12 +768,21 @@ typedef struct acpi_fadt { } __packed acpi_fadt_t; /* FADT TABLE Revision values */ -#define ACPI_FADT_REV_ACPI_1_0 1 -#define ACPI_FADT_REV_ACPI_2_0 3 -#define ACPI_FADT_REV_ACPI_3_0 4 -#define ACPI_FADT_REV_ACPI_4_0 4 -#define ACPI_FADT_REV_ACPI_5_0 5 -#define ACPI_FADT_REV_ACPI_6_0 6 +#define ACPI_FADT_REV_ACPI_1 1 +#define ACPI_FADT_REV_ACPI_2 3 +#define ACPI_FADT_REV_ACPI_3 4 +#define ACPI_FADT_REV_ACPI_4 4 +#define ACPI_FADT_REV_ACPI_5 5 +#define ACPI_FADT_REV_ACPI_6 6 + +/* FADT Minor Version value: + * Bits 0-3: minor version + * Bits 4-7: Errata + * value of 1 means this is compatible with Errata A, + * value of 2 would be compatible with Errata B, and so on + * Version 6.3 Errata A would be: (1 << 4) | 3 + */ +#define ACPI_FADT_MINOR_VERSION_0 0 /* coreboot currently use this version */ /* Flags for p_lvl2_lat and p_lvl3_lat */ #define ACPI_FADT_C2_NOT_SUPPORTED 101 @@ -1434,6 +1443,7 @@ static inline uintptr_t acpi_align_current(uintptr_t current) * be made into a weak function if there is ever a need to override the * coreboot default ACPI spec version supported. */ int get_acpi_table_revision(enum acpi_tables table); +u8 get_acpi_fadt_minor_version(void); #endif // !defined(__ASSEMBLER__) && !defined(__ACPI__) diff --git a/src/soc/amd/picasso/acpi.c b/src/soc/amd/picasso/acpi.c index 622aa1645e..bab563c26e 100644 --- a/src/soc/amd/picasso/acpi.c +++ b/src/soc/amd/picasso/acpi.c @@ -106,7 +106,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt) fadt->flags |= cfg->fadt_flags; /* additional board-specific flags */ fadt->ARM_boot_arch = 0; /* MUST be 0 ACPI 3.0 */ - fadt->FADT_MinorVersion = 0; /* MUST be 0 ACPI 3.0 */ + fadt->FADT_MinorVersion = get_acpi_fadt_minor_version(); fadt->x_firmware_ctl_l = 0; /* set to 0 if firmware_ctrl is used */ fadt->x_firmware_ctl_h = 0; diff --git a/src/soc/amd/stoneyridge/acpi.c b/src/soc/amd/stoneyridge/acpi.c index dda50b7c0e..c3c77fca13 100644 --- a/src/soc/amd/stoneyridge/acpi.c +++ b/src/soc/amd/stoneyridge/acpi.c @@ -98,7 +98,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt) ACPI_FADT_REMOTE_POWER_ON; fadt->ARM_boot_arch = 0; /* MUST be 0 ACPI 3.0 */ - fadt->FADT_MinorVersion = 0; /* MUST be 0 ACPI 3.0 */ + fadt->FADT_MinorVersion = get_acpi_fadt_minor_version(); fadt->x_firmware_ctl_l = 0; /* set to 0 if firmware_ctrl is used */ fadt->x_firmware_ctl_h = 0; diff --git a/src/southbridge/amd/agesa/hudson/fadt.c b/src/southbridge/amd/agesa/hudson/fadt.c index c9962be894..7461fe0f76 100644 --- a/src/southbridge/amd/agesa/hudson/fadt.c +++ b/src/southbridge/amd/agesa/hudson/fadt.c @@ -63,7 +63,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt) ACPI_FADT_REMOTE_POWER_ON; fadt->ARM_boot_arch = 0; /* MUST be 0 ACPI 3.0 */ - fadt->FADT_MinorVersion = 0; /* MUST be 0 ACPI 3.0 */ + fadt->FADT_MinorVersion = get_acpi_fadt_minor_version(); fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO; fadt->x_pm1a_evt_blk.bit_width = 32; diff --git a/src/southbridge/amd/cimx/sb800/fadt.c b/src/southbridge/amd/cimx/sb800/fadt.c index 25600c081e..8fe8bfde8e 100644 --- a/src/southbridge/amd/cimx/sb800/fadt.c +++ b/src/southbridge/amd/cimx/sb800/fadt.c @@ -87,7 +87,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt) ACPI_FADT_REMOTE_POWER_ON; fadt->ARM_boot_arch = 0; /* MUST be 0 ACPI 3.0 */ - fadt->FADT_MinorVersion = 0; /* MUST be 0 ACPI 3.0 */ + fadt->FADT_MinorVersion = get_acpi_fadt_minor_version(); fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO; fadt->x_pm1a_evt_blk.bit_width = 32; diff --git a/src/southbridge/amd/pi/hudson/fadt.c b/src/southbridge/amd/pi/hudson/fadt.c index e2f3bbad7d..3f4f0cb891 100644 --- a/src/southbridge/amd/pi/hudson/fadt.c +++ b/src/southbridge/amd/pi/hudson/fadt.c @@ -63,7 +63,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt) ACPI_FADT_REMOTE_POWER_ON; fadt->ARM_boot_arch = 0; /* MUST be 0 ACPI 3.0 */ - fadt->FADT_MinorVersion = 0; /* MUST be 0 ACPI 3.0 */ + fadt->FADT_MinorVersion = get_acpi_fadt_minor_version(); fadt->x_firmware_ctl_l = 0; /* set to 0 if firmware_ctrl is used */ fadt->x_firmware_ctl_h = 0; -- cgit v1.2.3