Attention is currently required from: Lance Zhao, Tim Wawrzynczak.
Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/74762 )
Change subject: acpi: Add a runtime method to override exposed _Sx sleep states ......................................................................
acpi: Add a runtime method to override exposed _Sx sleep states
This allows mainboards to override available sleep states at runtime. This is done by adding a IntObj in SSDT that DSDT consumes to override the available _Sx states.
Signed-off-by: Arthur Heymans arthur@aheymans.xyz Change-Id: Ic21830c1ef9c183b1e3005cc1f8b7daf7e9ea998 --- M src/acpi/Kconfig M src/acpi/acpi.c M src/include/acpi/acpi.h M src/southbridge/intel/common/acpi/sleepstates.asl 4 files changed, 41 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/62/74762/1
diff --git a/src/acpi/Kconfig b/src/acpi/Kconfig index 5af8b22..236bb9f 100644 --- a/src/acpi/Kconfig +++ b/src/acpi/Kconfig @@ -61,3 +61,10 @@ depends on HAVE_ACPI_TABLES help Selected by platforms that support and fill Intel Low Power Idle Table. + +config OVERRIDE_ENABLED_SLEEP_STATES + bool + depends on HAVE_ACPI_TABLES + help + Select this on platforms that want a way to override the enabled + _Sx states during runtime. diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index 492d043..38b1b63 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -517,6 +517,20 @@ acpigen_pop_len(); }
+void acpi_ssdt_override_sleep_states(bool enable_s1, bool enable_s2, bool enable_s3, bool enable_s4) +{ + assert(CONFIG(OVERRIDE_ENABLED_SLEEP_STATES)); + assert(!(enable_s1 && CONFIG(PLATFORM_LACKS_ACPI_S1))); + assert(!(enable_s3 && !CONFIG(HAVE_ACPI_RESUME))); + assert(!(enable_s4 && CONFIG(DISABLE_ACPI_HIBERNATE))); + + acpigen_write_scope("\"); + uint32_t sleep_enable = (enable_s1 << 0) | (enable_s2 << 1) + | (enable_s3 << 2) | (enable_s4 << 3); + acpigen_write_name_dword("OSFG", sleep_enable); + acpigen_pop_len(); +} + void acpi_create_ssdt_generator(acpi_header_t *ssdt, const char *oem_table_id) { unsigned long current = (unsigned long)ssdt + sizeof(acpi_header_t); diff --git a/src/include/acpi/acpi.h b/src/include/acpi/acpi.h index 77f73ae..1aa195c 100644 --- a/src/include/acpi/acpi.h +++ b/src/include/acpi/acpi.h @@ -1308,6 +1308,7 @@ unsigned long write_acpi_tables(unsigned long addr); unsigned long acpi_fill_madt(unsigned long current); unsigned long acpi_fill_ivrs_ioapic(acpi_ivrs_t *ivrs, unsigned long current); +void acpi_ssdt_override_sleep_states(bool enable_s1, bool enable_s2, bool enable_s3, bool enable_s4); void acpi_create_ssdt_generator(acpi_header_t *ssdt, const char *oem_table_id); void acpi_write_bert(acpi_bert_t *bert, uintptr_t region, size_t length); void acpi_create_fadt(acpi_fadt_t *fadt, acpi_facs_t *facs, void *dsdt); diff --git a/src/southbridge/intel/common/acpi/sleepstates.asl b/src/southbridge/intel/common/acpi/sleepstates.asl index baee300..5f86e79 100644 --- a/src/southbridge/intel/common/acpi/sleepstates.asl +++ b/src/southbridge/intel/common/acpi/sleepstates.asl @@ -15,6 +15,11 @@ SSFG &= 0xf7 }
+if (CONFIG(OVERRIDE_ENABLED_SLEEP_STATES)) { + External (\OSFG, IntObj) + SSFG = \OSFG +} + /* Supported sleep states: */ Name(_S0, Package () {0x00, 0x00, 0x00, 0x00} ) /* (S0) - working state */