src/acpi: Add macro for FADT Minor Version and use it

Change-Id: I6a0e9b33c6a1045a3a4a6717487525b82d41e558
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/62036
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Lance Zhao
This commit is contained in:
Elyes Haouas 2022-02-16 12:08:16 +01:00 committed by Felix Held
parent e904d9ad67
commit 8b950f4d7a
7 changed files with 28 additions and 13 deletions

View File

@ -1944,11 +1944,16 @@ __weak int acpi_get_gpe(int gpe)
return -1; /* implemented by SOC */ 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) int get_acpi_table_revision(enum acpi_tables table)
{ {
switch (table) { switch (table) {
case FADT: 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 */ case MADT: /* ACPI 3.0: 2, ACPI 4.0/5.0: 3, ACPI 6.2b/6.3: 5 */
return 3; return 3;
case MCFG: case MCFG:

View File

@ -747,7 +747,7 @@ typedef struct acpi_fadt {
acpi_addr_t reset_reg; acpi_addr_t reset_reg;
u8 reset_value; u8 reset_value;
u16 ARM_boot_arch; /* Revision 6 only, Revision 5: Must be zero */ 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_l;
u32 x_firmware_ctl_h; u32 x_firmware_ctl_h;
u32 x_dsdt_l; u32 x_dsdt_l;
@ -768,12 +768,21 @@ typedef struct acpi_fadt {
} __packed acpi_fadt_t; } __packed acpi_fadt_t;
/* FADT TABLE Revision values */ /* FADT TABLE Revision values */
#define ACPI_FADT_REV_ACPI_1_0 1 #define ACPI_FADT_REV_ACPI_1 1
#define ACPI_FADT_REV_ACPI_2_0 3 #define ACPI_FADT_REV_ACPI_2 3
#define ACPI_FADT_REV_ACPI_3_0 4 #define ACPI_FADT_REV_ACPI_3 4
#define ACPI_FADT_REV_ACPI_4_0 4 #define ACPI_FADT_REV_ACPI_4 4
#define ACPI_FADT_REV_ACPI_5_0 5 #define ACPI_FADT_REV_ACPI_5 5
#define ACPI_FADT_REV_ACPI_6_0 6 #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 */ /* Flags for p_lvl2_lat and p_lvl3_lat */
#define ACPI_FADT_C2_NOT_SUPPORTED 101 #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 * be made into a weak function if there is ever a need to override the
* coreboot default ACPI spec version supported. */ * coreboot default ACPI spec version supported. */
int get_acpi_table_revision(enum acpi_tables table); int get_acpi_table_revision(enum acpi_tables table);
u8 get_acpi_fadt_minor_version(void);
#endif // !defined(__ASSEMBLER__) && !defined(__ACPI__) #endif // !defined(__ASSEMBLER__) && !defined(__ACPI__)

View File

@ -106,7 +106,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt)
fadt->flags |= cfg->fadt_flags; /* additional board-specific flags */ fadt->flags |= cfg->fadt_flags; /* additional board-specific flags */
fadt->ARM_boot_arch = 0; /* MUST be 0 ACPI 3.0 */ 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_l = 0; /* set to 0 if firmware_ctrl is used */
fadt->x_firmware_ctl_h = 0; fadt->x_firmware_ctl_h = 0;

View File

@ -98,7 +98,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt)
ACPI_FADT_REMOTE_POWER_ON; ACPI_FADT_REMOTE_POWER_ON;
fadt->ARM_boot_arch = 0; /* MUST be 0 ACPI 3.0 */ 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_l = 0; /* set to 0 if firmware_ctrl is used */
fadt->x_firmware_ctl_h = 0; fadt->x_firmware_ctl_h = 0;

View File

@ -63,7 +63,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt)
ACPI_FADT_REMOTE_POWER_ON; ACPI_FADT_REMOTE_POWER_ON;
fadt->ARM_boot_arch = 0; /* MUST be 0 ACPI 3.0 */ 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.space_id = ACPI_ADDRESS_SPACE_IO;
fadt->x_pm1a_evt_blk.bit_width = 32; fadt->x_pm1a_evt_blk.bit_width = 32;

View File

@ -87,7 +87,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt)
ACPI_FADT_REMOTE_POWER_ON; ACPI_FADT_REMOTE_POWER_ON;
fadt->ARM_boot_arch = 0; /* MUST be 0 ACPI 3.0 */ 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.space_id = ACPI_ADDRESS_SPACE_IO;
fadt->x_pm1a_evt_blk.bit_width = 32; fadt->x_pm1a_evt_blk.bit_width = 32;

View File

@ -63,7 +63,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt)
ACPI_FADT_REMOTE_POWER_ON; ACPI_FADT_REMOTE_POWER_ON;
fadt->ARM_boot_arch = 0; /* MUST be 0 ACPI 3.0 */ 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_l = 0; /* set to 0 if firmware_ctrl is used */
fadt->x_firmware_ctl_h = 0; fadt->x_firmware_ctl_h = 0;