summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2019-08-11 01:22:28 +0300
committerPatrick Georgi <pgeorgi@google.com>2020-06-06 09:24:44 +0000
commit0a9e72e87e573183d713fca928c75464f829e5a8 (patch)
treeb117a6cad0872b4b9caee8878ea6b98432c3ef4d
parentc328a680def0f589536c24ff547465bd7eb3546d (diff)
arch/x86: Declare permanent_smi_handler()
Advertising SMI triggers in FADT is only valid if we exit with SMI installed. There has been some experiments to delay SMM installation to OS, yet there are new platforms that allow some configuration access only to be done inside SMM. Splitting static HAVE_SMI_HANDLER variable helps to manage cases where SMM might be both installed and cleared prior to entering payload. Change-Id: Iad92c4a180524e15199633693446a087787ad3a2 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41910 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
-rw-r--r--src/include/acpi/acpi.h7
-rw-r--r--src/mainboard/aopen/dxplplusu/fadt.c2
-rw-r--r--src/mainboard/emulation/qemu-q35/acpi_tables.c2
-rw-r--r--src/mainboard/lenovo/t400/fadt.c2
-rw-r--r--src/mainboard/lenovo/x200/fadt.c2
-rw-r--r--src/mainboard/roda/rk9/fadt.c2
-rw-r--r--src/soc/amd/picasso/acpi.c2
-rw-r--r--src/soc/amd/stoneyridge/acpi.c2
-rw-r--r--src/soc/intel/baytrail/acpi.c2
-rw-r--r--src/soc/intel/braswell/acpi.c2
-rw-r--r--src/soc/intel/broadwell/acpi.c2
-rw-r--r--src/soc/intel/common/block/acpi/acpi.c2
-rw-r--r--src/soc/intel/skylake/acpi.c2
-rw-r--r--src/soc/intel/xeon_sp/cpx/acpi.c2
-rw-r--r--src/soc/intel/xeon_sp/skx/acpi.c2
-rw-r--r--src/southbridge/amd/agesa/hudson/fadt.c2
-rw-r--r--src/southbridge/amd/pi/hudson/fadt.c2
-rw-r--r--src/southbridge/intel/bd82x6x/lpc.c2
-rw-r--r--src/southbridge/intel/i82371eb/fadt.c2
-rw-r--r--src/southbridge/intel/i82801gx/lpc.c2
-rw-r--r--src/southbridge/intel/i82801jx/lpc.c2
-rw-r--r--src/southbridge/intel/ibexpeak/lpc.c2
-rw-r--r--src/southbridge/intel/lynxpoint/lpc.c2
23 files changed, 29 insertions, 22 deletions
diff --git a/src/include/acpi/acpi.h b/src/include/acpi/acpi.h
index ba056c094f..e6c18c28a3 100644
--- a/src/include/acpi/acpi.h
+++ b/src/include/acpi/acpi.h
@@ -1019,6 +1019,13 @@ int acpi_get_sleep_type(void);
/* Read and clear GPE status */
int acpi_get_gpe(int gpe);
+/* Once we enter payload, is SMI handler installed and capable of
+ responding to APM_CNT Advanced Power Management Control commands. */
+static inline int permanent_smi_handler(void)
+{
+ return CONFIG(HAVE_SMI_HANDLER);
+}
+
static inline int acpi_s3_resume_allowed(void)
{
return CONFIG(HAVE_ACPI_RESUME);
diff --git a/src/mainboard/aopen/dxplplusu/fadt.c b/src/mainboard/aopen/dxplplusu/fadt.c
index 339c2437ff..ad522c409b 100644
--- a/src/mainboard/aopen/dxplplusu/fadt.c
+++ b/src/mainboard/aopen/dxplplusu/fadt.c
@@ -38,7 +38,7 @@ void acpi_create_fadt(acpi_fadt_t * fadt, acpi_facs_t * facs, void *dsdt)
fadt->sci_int = 0x9;
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = ACPI_ENABLE;
fadt->acpi_disable = ACPI_DISABLE;
diff --git a/src/mainboard/emulation/qemu-q35/acpi_tables.c b/src/mainboard/emulation/qemu-q35/acpi_tables.c
index 423625711b..9bf58a643a 100644
--- a/src/mainboard/emulation/qemu-q35/acpi_tables.c
+++ b/src/mainboard/emulation/qemu-q35/acpi_tables.c
@@ -43,7 +43,7 @@ void acpi_create_fadt(acpi_fadt_t * fadt, acpi_facs_t * facs, void *dsdt)
fadt->preferred_pm_profile = PM_MOBILE;
fadt->sci_int = 0x9;
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
/* Do not advertise SMI even if installed. */
fadt->smi_cmd = 0;
fadt->acpi_enable = 0;
diff --git a/src/mainboard/lenovo/t400/fadt.c b/src/mainboard/lenovo/t400/fadt.c
index d15b9b3920..257fb4193e 100644
--- a/src/mainboard/lenovo/t400/fadt.c
+++ b/src/mainboard/lenovo/t400/fadt.c
@@ -26,7 +26,7 @@ void acpi_create_fadt(acpi_fadt_t * fadt, acpi_facs_t * facs, void *dsdt)
fadt->preferred_pm_profile = PM_MOBILE;
fadt->sci_int = 0x9;
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/mainboard/lenovo/x200/fadt.c b/src/mainboard/lenovo/x200/fadt.c
index d15b9b3920..257fb4193e 100644
--- a/src/mainboard/lenovo/x200/fadt.c
+++ b/src/mainboard/lenovo/x200/fadt.c
@@ -26,7 +26,7 @@ void acpi_create_fadt(acpi_fadt_t * fadt, acpi_facs_t * facs, void *dsdt)
fadt->preferred_pm_profile = PM_MOBILE;
fadt->sci_int = 0x9;
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/mainboard/roda/rk9/fadt.c b/src/mainboard/roda/rk9/fadt.c
index 102865dd34..512754592f 100644
--- a/src/mainboard/roda/rk9/fadt.c
+++ b/src/mainboard/roda/rk9/fadt.c
@@ -26,7 +26,7 @@ void acpi_create_fadt(acpi_fadt_t * fadt, acpi_facs_t * facs, void *dsdt)
fadt->preferred_pm_profile = PM_MOBILE;
fadt->sci_int = 0x9;
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/soc/amd/picasso/acpi.c b/src/soc/amd/picasso/acpi.c
index d5a890b6e3..817ec51e4e 100644
--- a/src/soc/amd/picasso/acpi.c
+++ b/src/soc/amd/picasso/acpi.c
@@ -107,7 +107,7 @@ void acpi_create_fadt(acpi_fadt_t *fadt, acpi_facs_t *facs, void *dsdt)
fadt->preferred_pm_profile = FADT_PM_PROFILE;
fadt->sci_int = 9; /* IRQ 09 - ACPI SCI */
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/soc/amd/stoneyridge/acpi.c b/src/soc/amd/stoneyridge/acpi.c
index 47d12bf986..a7caa938a6 100644
--- a/src/soc/amd/stoneyridge/acpi.c
+++ b/src/soc/amd/stoneyridge/acpi.c
@@ -79,7 +79,7 @@ void acpi_create_fadt(acpi_fadt_t *fadt, acpi_facs_t *facs, void *dsdt)
fadt->preferred_pm_profile = FADT_PM_PROFILE;
fadt->sci_int = 9; /* IRQ 09 - ACPI SCI */
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/soc/intel/baytrail/acpi.c b/src/soc/intel/baytrail/acpi.c
index 66263e6748..f9eb50018b 100644
--- a/src/soc/intel/baytrail/acpi.c
+++ b/src/soc/intel/baytrail/acpi.c
@@ -129,7 +129,7 @@ void acpi_fill_in_fadt(acpi_fadt_t *fadt)
fadt->sci_int = acpi_sci_irq();
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/soc/intel/braswell/acpi.c b/src/soc/intel/braswell/acpi.c
index 4e3795e6ed..e6790a7e1e 100644
--- a/src/soc/intel/braswell/acpi.c
+++ b/src/soc/intel/braswell/acpi.c
@@ -133,7 +133,7 @@ void acpi_fill_in_fadt(acpi_fadt_t *fadt)
fadt->sci_int = acpi_sci_irq();
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/soc/intel/broadwell/acpi.c b/src/soc/intel/broadwell/acpi.c
index 9df7dee26b..081b08a934 100644
--- a/src/soc/intel/broadwell/acpi.c
+++ b/src/soc/intel/broadwell/acpi.c
@@ -185,7 +185,7 @@ void acpi_fill_in_fadt(acpi_fadt_t *fadt)
fadt->sci_int = acpi_sci_irq();
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/soc/intel/common/block/acpi/acpi.c b/src/soc/intel/common/block/acpi/acpi.c
index c4a069850d..bda2399ac9 100644
--- a/src/soc/intel/common/block/acpi/acpi.c
+++ b/src/soc/intel/common/block/acpi/acpi.c
@@ -101,7 +101,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt)
fadt->sci_int = acpi_sci_irq();
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/soc/intel/skylake/acpi.c b/src/soc/intel/skylake/acpi.c
index 34aed02ee8..bdfacd3e93 100644
--- a/src/soc/intel/skylake/acpi.c
+++ b/src/soc/intel/skylake/acpi.c
@@ -226,7 +226,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt)
fadt->sci_int = acpi_sci_irq();
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/soc/intel/xeon_sp/cpx/acpi.c b/src/soc/intel/xeon_sp/cpx/acpi.c
index d6d847bd8b..b090d12668 100644
--- a/src/soc/intel/xeon_sp/cpx/acpi.c
+++ b/src/soc/intel/xeon_sp/cpx/acpi.c
@@ -148,7 +148,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt)
fadt->x_gpe1_blk.space_id = 1;
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/soc/intel/xeon_sp/skx/acpi.c b/src/soc/intel/xeon_sp/skx/acpi.c
index 9cb36b8229..f5d4e7a188 100644
--- a/src/soc/intel/xeon_sp/skx/acpi.c
+++ b/src/soc/intel/xeon_sp/skx/acpi.c
@@ -340,7 +340,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt)
fadt->sci_int = acpi_sci_irq();
/* TODO: enabled SMM mode switch when SMM handlers are set up. */
- if (0 && CONFIG(HAVE_SMI_HANDLER)) {
+ if (0 && permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/southbridge/amd/agesa/hudson/fadt.c b/src/southbridge/amd/agesa/hudson/fadt.c
index 660598a0f9..a328a882f8 100644
--- a/src/southbridge/amd/agesa/hudson/fadt.c
+++ b/src/southbridge/amd/agesa/hudson/fadt.c
@@ -57,7 +57,7 @@ void acpi_create_fadt(acpi_fadt_t * fadt, acpi_facs_t * facs, void *dsdt)
fadt->preferred_pm_profile = FADT_PM_PROFILE;
fadt->sci_int = 9; /* HUDSON - IRQ 09 - ACPI SCI */
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = ACPI_SMI_CTL_PORT;
fadt->acpi_enable = ACPI_SMI_CMD_ENABLE;
fadt->acpi_disable = ACPI_SMI_CMD_DISABLE;
diff --git a/src/southbridge/amd/pi/hudson/fadt.c b/src/southbridge/amd/pi/hudson/fadt.c
index 100cfb6ac4..686b6699ae 100644
--- a/src/southbridge/amd/pi/hudson/fadt.c
+++ b/src/southbridge/amd/pi/hudson/fadt.c
@@ -49,7 +49,7 @@ void acpi_create_fadt(acpi_fadt_t * fadt, acpi_facs_t * facs, void *dsdt)
fadt->preferred_pm_profile = FADT_PM_PROFILE;
fadt->sci_int = 9; /* HUDSON - IRQ 09 - ACPI SCI */
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = ACPI_SMI_CTL_PORT;
fadt->acpi_enable = ACPI_SMI_CMD_ENABLE;
fadt->acpi_disable = ACPI_SMI_CMD_DISABLE;
diff --git a/src/southbridge/intel/bd82x6x/lpc.c b/src/southbridge/intel/bd82x6x/lpc.c
index 45215f1c94..0f1d33e1c8 100644
--- a/src/southbridge/intel/bd82x6x/lpc.c
+++ b/src/southbridge/intel/bd82x6x/lpc.c
@@ -698,7 +698,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt)
fadt->sci_int = 0x9;
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/southbridge/intel/i82371eb/fadt.c b/src/southbridge/intel/i82371eb/fadt.c
index 09e027f407..66781beedc 100644
--- a/src/southbridge/intel/i82371eb/fadt.c
+++ b/src/southbridge/intel/i82371eb/fadt.c
@@ -36,7 +36,7 @@ void acpi_create_fadt(acpi_fadt_t *fadt, acpi_facs_t *facs, void *dsdt)
fadt->preferred_pm_profile = 0; /* unspecified */
fadt->sci_int = 9;
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
/* TODO: SMI handler is not implemented. */
fadt->smi_cmd = 0x00;
}
diff --git a/src/southbridge/intel/i82801gx/lpc.c b/src/southbridge/intel/i82801gx/lpc.c
index 86c3e58750..d4aef55f43 100644
--- a/src/southbridge/intel/i82801gx/lpc.c
+++ b/src/southbridge/intel/i82801gx/lpc.c
@@ -522,7 +522,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt)
fadt->reserved = 0;
fadt->sci_int = 0x9;
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/southbridge/intel/i82801jx/lpc.c b/src/southbridge/intel/i82801jx/lpc.c
index b3aeda22f7..7a1b24b92b 100644
--- a/src/southbridge/intel/i82801jx/lpc.c
+++ b/src/southbridge/intel/i82801jx/lpc.c
@@ -533,7 +533,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt)
fadt->reserved = 0;
fadt->sci_int = 0x9;
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/southbridge/intel/ibexpeak/lpc.c b/src/southbridge/intel/ibexpeak/lpc.c
index 1209f9b685..742b86dfdf 100644
--- a/src/southbridge/intel/ibexpeak/lpc.c
+++ b/src/southbridge/intel/ibexpeak/lpc.c
@@ -592,7 +592,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt)
fadt->sci_int = 0x9;
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c
index da744bfa64..1d755555d3 100644
--- a/src/southbridge/intel/lynxpoint/lpc.c
+++ b/src/southbridge/intel/lynxpoint/lpc.c
@@ -741,7 +741,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt)
fadt->sci_int = 0x9;
- if (CONFIG(HAVE_SMI_HANDLER)) {
+ if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;