summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cpu/x86/smm/Makefile.inc1
-rw-r--r--src/cpu/x86/smm/smi_trigger.c43
-rw-r--r--src/include/cpu/x86/smm.h3
-rw-r--r--src/soc/intel/broadwell/lpc.c4
-rw-r--r--src/soc/intel/cannonlake/finalize.c4
-rw-r--r--src/soc/intel/common/block/pmc/pmc.c4
-rw-r--r--src/soc/intel/denverton_ns/lpc.c3
-rw-r--r--src/soc/intel/denverton_ns/pmc.c4
-rw-r--r--src/soc/intel/icelake/finalize.c4
-rw-r--r--src/soc/intel/jasperlake/finalize.c4
-rw-r--r--src/soc/intel/skylake/finalize.c4
-rw-r--r--src/soc/intel/tigerlake/finalize.c4
-rw-r--r--src/southbridge/intel/bd82x6x/lpc.c6
-rw-r--r--src/southbridge/intel/i82801gx/lpc.c7
-rw-r--r--src/southbridge/intel/i82801ix/lpc.c7
-rw-r--r--src/southbridge/intel/i82801jx/lpc.c7
-rw-r--r--src/southbridge/intel/ibexpeak/lpc.c6
-rw-r--r--src/southbridge/intel/lynxpoint/lpc.c6
18 files changed, 68 insertions, 53 deletions
diff --git a/src/cpu/x86/smm/Makefile.inc b/src/cpu/x86/smm/Makefile.inc
index 500f169edb..dbe567a8a2 100644
--- a/src/cpu/x86/smm/Makefile.inc
+++ b/src/cpu/x86/smm/Makefile.inc
@@ -1,6 +1,7 @@
## SPDX-License-Identifier: GPL-2.0-only
ramstage-y += smm_module_loader.c
+ramstage-y += smi_trigger.c
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
$(eval $(call create_class_compiler,smm,x86_32))
diff --git a/src/cpu/x86/smm/smi_trigger.c b/src/cpu/x86/smm/smi_trigger.c
new file mode 100644
index 0000000000..f1031a00f6
--- /dev/null
+++ b/src/cpu/x86/smm/smi_trigger.c
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <arch/io.h>
+#include <console/console.h>
+#include <cpu/x86/smm.h>
+
+int apm_control(u8 cmd)
+{
+ if (!CONFIG(HAVE_SMI_HANDLER))
+ return -1;
+
+ switch (cmd) {
+ case APM_CNT_CST_CONTROL:
+ break;
+ case APM_CNT_PST_CONTROL:
+ break;
+ case APM_CNT_ACPI_DISABLE:
+ printk(BIOS_DEBUG, "Disabling ACPI via APMC.\n");
+ break;
+ case APM_CNT_ACPI_ENABLE:
+ printk(BIOS_DEBUG, "Enabling ACPI via APMC.\n");
+ break;
+ case APM_CNT_GNVS_UPDATE:
+ break;
+ case APM_CNT_FINALIZE:
+ printk(BIOS_DEBUG, "Finalizing SMM.\n");
+ break;
+ case APM_CNT_ELOG_GSMI:
+ break;
+ case APM_CNT_SMMSTORE:
+ break;
+ case APM_CNT_SMMINFO:
+ break;
+ default:
+ break;
+ }
+
+ /* Now raise the SMI. */
+ outb(cmd, APM_CNT);
+
+ printk(BIOS_DEBUG, "APMC done.\n");
+ return 0;
+}
diff --git a/src/include/cpu/x86/smm.h b/src/include/cpu/x86/smm.h
index d7b68e5db8..67f958b8af 100644
--- a/src/include/cpu/x86/smm.h
+++ b/src/include/cpu/x86/smm.h
@@ -29,6 +29,9 @@
#define APM_CNT_ELOG_GSMI 0xef
#define APM_STS 0xb3
+/* Send cmd to APM_CNT with HAVE_SMI_HANDLER checking. */
+int apm_control(u8 cmd);
+
void io_trap_handler(int smif);
int southbridge_io_trap_handler(int smif);
int mainboard_io_trap_handler(int smif);
diff --git a/src/soc/intel/broadwell/lpc.c b/src/soc/intel/broadwell/lpc.c
index 5cfeb5fe22..d5f8451272 100644
--- a/src/soc/intel/broadwell/lpc.c
+++ b/src/soc/intel/broadwell/lpc.c
@@ -410,9 +410,7 @@ static void pch_cg_init(struct device *dev)
static void pch_set_acpi_mode(void)
{
if (CONFIG(HAVE_SMI_HANDLER) && !acpi_is_wakeup_s3()) {
- printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n");
- outb(APM_CNT_ACPI_DISABLE, APM_CNT);
- printk(BIOS_DEBUG, "done.\n");
+ apm_control(APM_CNT_ACPI_DISABLE);
}
}
diff --git a/src/soc/intel/cannonlake/finalize.c b/src/soc/intel/cannonlake/finalize.c
index a693735ac3..49e9d7f66a 100644
--- a/src/soc/intel/cannonlake/finalize.c
+++ b/src/soc/intel/cannonlake/finalize.c
@@ -101,9 +101,7 @@ static void soc_finalize(void *unused)
printk(BIOS_DEBUG, "Finalizing chipset.\n");
pch_finalize();
-
- printk(BIOS_DEBUG, "Finalizing SMM.\n");
- outb(APM_CNT_FINALIZE, APM_CNT);
+ apm_control(APM_CNT_FINALIZE);
/* Indicate finalize step with post code */
post_code(POST_OS_BOOT);
diff --git a/src/soc/intel/common/block/pmc/pmc.c b/src/soc/intel/common/block/pmc/pmc.c
index 524e36a554..cc004191ef 100644
--- a/src/soc/intel/common/block/pmc/pmc.c
+++ b/src/soc/intel/common/block/pmc/pmc.c
@@ -94,9 +94,7 @@ static void pch_pmc_read_resources(struct device *dev)
void pmc_set_acpi_mode(void)
{
if (CONFIG(HAVE_SMI_HANDLER) && !acpi_is_wakeup_s3()) {
- printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n");
- outb(APM_CNT_ACPI_DISABLE, APM_CNT);
- printk(BIOS_DEBUG, "done.\n");
+ apm_control(APM_CNT_ACPI_DISABLE);
}
}
diff --git a/src/soc/intel/denverton_ns/lpc.c b/src/soc/intel/denverton_ns/lpc.c
index 05c648438c..228e0f65ae 100644
--- a/src/soc/intel/denverton_ns/lpc.c
+++ b/src/soc/intel/denverton_ns/lpc.c
@@ -555,8 +555,7 @@ static const struct pci_driver lpc_driver __pci_driver = {
static void finalize_chipset(void *unused)
{
- printk(BIOS_DEBUG, "Finalizing SMM.\n");
- outb(APM_CNT_FINALIZE, APM_CNT);
+ apm_control(APM_CNT_FINALIZE);
}
BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, finalize_chipset, NULL);
diff --git a/src/soc/intel/denverton_ns/pmc.c b/src/soc/intel/denverton_ns/pmc.c
index 25a0e59ba5..3c592fe05f 100644
--- a/src/soc/intel/denverton_ns/pmc.c
+++ b/src/soc/intel/denverton_ns/pmc.c
@@ -25,9 +25,7 @@ static void pch_power_options(struct device *dev) { /* TODO */ }
static void pch_set_acpi_mode(void)
{
if (CONFIG(HAVE_SMI_HANDLER) && !acpi_is_wakeup_s3()) {
- printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n");
- outb(APM_CNT_ACPI_DISABLE, APM_CNT);
- printk(BIOS_DEBUG, "done.\n");
+ apm_control(APM_CNT_ACPI_DISABLE);
}
}
diff --git a/src/soc/intel/icelake/finalize.c b/src/soc/intel/icelake/finalize.c
index 78a3108423..fdeaaaddde 100644
--- a/src/soc/intel/icelake/finalize.c
+++ b/src/soc/intel/icelake/finalize.c
@@ -94,9 +94,7 @@ static void soc_finalize(void *unused)
printk(BIOS_DEBUG, "Finalizing chipset.\n");
pch_finalize();
-
- printk(BIOS_DEBUG, "Finalizing SMM.\n");
- outb(APM_CNT_FINALIZE, APM_CNT);
+ apm_control(APM_CNT_FINALIZE);
/* Indicate finalize step with post code */
post_code(POST_OS_BOOT);
diff --git a/src/soc/intel/jasperlake/finalize.c b/src/soc/intel/jasperlake/finalize.c
index f801960a12..d16080fd50 100644
--- a/src/soc/intel/jasperlake/finalize.c
+++ b/src/soc/intel/jasperlake/finalize.c
@@ -87,9 +87,7 @@ static void soc_finalize(void *unused)
printk(BIOS_DEBUG, "Finalizing chipset.\n");
pch_finalize();
-
- printk(BIOS_DEBUG, "Finalizing SMM.\n");
- outb(APM_CNT_FINALIZE, APM_CNT);
+ apm_control(APM_CNT_FINALIZE);
/* Indicate finalize step with post code */
post_code(POST_OS_BOOT);
diff --git a/src/soc/intel/skylake/finalize.c b/src/soc/intel/skylake/finalize.c
index b20f391f8d..dbb451c6be 100644
--- a/src/soc/intel/skylake/finalize.c
+++ b/src/soc/intel/skylake/finalize.c
@@ -128,9 +128,7 @@ static void soc_finalize(void *unused)
pch_finalize_script(dev);
soc_lockdown(dev);
-
- printk(BIOS_DEBUG, "Finalizing SMM.\n");
- outb(APM_CNT_FINALIZE, APM_CNT);
+ apm_control(APM_CNT_FINALIZE);
/* Indicate finalize step with post code */
post_code(POST_OS_BOOT);
diff --git a/src/soc/intel/tigerlake/finalize.c b/src/soc/intel/tigerlake/finalize.c
index a402625799..d0dc30e056 100644
--- a/src/soc/intel/tigerlake/finalize.c
+++ b/src/soc/intel/tigerlake/finalize.c
@@ -73,9 +73,7 @@ static void soc_finalize(void *unused)
printk(BIOS_DEBUG, "Finalizing chipset.\n");
pch_finalize();
-
- printk(BIOS_DEBUG, "Finalizing SMM.\n");
- outb(APM_CNT_FINALIZE, APM_CNT);
+ apm_control(APM_CNT_FINALIZE);
/* Indicate finalize step with post code */
post_code(POST_OS_BOOT);
diff --git a/src/southbridge/intel/bd82x6x/lpc.c b/src/southbridge/intel/bd82x6x/lpc.c
index 5e28cd2bc2..200463268f 100644
--- a/src/southbridge/intel/bd82x6x/lpc.c
+++ b/src/southbridge/intel/bd82x6x/lpc.c
@@ -405,9 +405,7 @@ static void enable_clock_gating(struct device *dev)
static void pch_set_acpi_mode(void)
{
if (!acpi_is_wakeup_s3() && CONFIG(HAVE_SMI_HANDLER)) {
- printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n");
- outb(APM_CNT_ACPI_DISABLE, APM_CNT); // Disable ACPI mode
- printk(BIOS_DEBUG, "done.\n");
+ apm_control(APM_CNT_ACPI_DISABLE);
}
}
@@ -827,7 +825,7 @@ static void lpc_final(struct device *dev)
if (CONFIG(HAVE_SMI_HANDLER)) {
if (CONFIG(INTEL_CHIPSET_LOCKDOWN) ||
acpi_is_wakeup_s3()) {
- outb(APM_CNT_FINALIZE, APM_CNT);
+ apm_control(APM_CNT_FINALIZE);
}
}
}
diff --git a/src/southbridge/intel/i82801gx/lpc.c b/src/southbridge/intel/i82801gx/lpc.c
index e3bddf9aa1..9e1efac236 100644
--- a/src/southbridge/intel/i82801gx/lpc.c
+++ b/src/southbridge/intel/i82801gx/lpc.c
@@ -316,12 +316,9 @@ static void i82801gx_set_acpi_mode(struct device *dev)
{
if (CONFIG(HAVE_SMI_HANDLER)) {
if (!acpi_is_wakeup_s3()) {
- printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n");
- outb(APM_CNT_ACPI_DISABLE, APM_CNT); // Disable ACPI mode
- printk(BIOS_DEBUG, "done.\n");
+ apm_control(APM_CNT_ACPI_DISABLE);
} else {
- printk(BIOS_DEBUG, "S3 wakeup, enabling ACPI via APMC\n");
- outb(APM_CNT_ACPI_ENABLE, APM_CNT);
+ apm_control(APM_CNT_ACPI_ENABLE);
}
}
}
diff --git a/src/southbridge/intel/i82801ix/lpc.c b/src/southbridge/intel/i82801ix/lpc.c
index 732e69a385..2966b78b5e 100644
--- a/src/southbridge/intel/i82801ix/lpc.c
+++ b/src/southbridge/intel/i82801ix/lpc.c
@@ -345,12 +345,9 @@ static void i82801ix_set_acpi_mode(struct device *dev)
{
if (CONFIG(HAVE_SMI_HANDLER)) {
if (!acpi_is_wakeup_s3()) {
- printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n");
- outb(APM_CNT_ACPI_DISABLE, APM_CNT); // Disable ACPI mode
- printk(BIOS_DEBUG, "done.\n");
+ apm_control(APM_CNT_ACPI_DISABLE);
} else {
- printk(BIOS_DEBUG, "S3 wakeup, enabling ACPI via APMC\n");
- outb(APM_CNT_ACPI_ENABLE, APM_CNT);
+ apm_control(APM_CNT_ACPI_ENABLE);
}
}
}
diff --git a/src/southbridge/intel/i82801jx/lpc.c b/src/southbridge/intel/i82801jx/lpc.c
index 07cf5274a5..d12e061226 100644
--- a/src/southbridge/intel/i82801jx/lpc.c
+++ b/src/southbridge/intel/i82801jx/lpc.c
@@ -349,12 +349,9 @@ static void i82801jx_set_acpi_mode(struct device *dev)
{
if (CONFIG(HAVE_SMI_HANDLER)) {
if (!acpi_is_wakeup_s3()) {
- printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n");
- outb(APM_CNT_ACPI_DISABLE, APM_CNT); // Disable ACPI mode
- printk(BIOS_DEBUG, "done.\n");
+ apm_control(APM_CNT_ACPI_DISABLE);
} else {
- printk(BIOS_DEBUG, "S3 wakeup, enabling ACPI via APMC\n");
- outb(APM_CNT_ACPI_ENABLE, APM_CNT);
+ apm_control(APM_CNT_ACPI_ENABLE);
}
}
}
diff --git a/src/southbridge/intel/ibexpeak/lpc.c b/src/southbridge/intel/ibexpeak/lpc.c
index b57e30ec8a..2362649ae6 100644
--- a/src/southbridge/intel/ibexpeak/lpc.c
+++ b/src/southbridge/intel/ibexpeak/lpc.c
@@ -409,9 +409,7 @@ static void enable_clock_gating(struct device *dev)
static void pch_set_acpi_mode(void)
{
if (!acpi_is_wakeup_s3() && CONFIG(HAVE_SMI_HANDLER)) {
- printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n");
- outb(APM_CNT_ACPI_DISABLE, APM_CNT); // Disable ACPI mode
- printk(BIOS_DEBUG, "done.\n");
+ apm_control(APM_CNT_ACPI_DISABLE); // Disable ACPI mode
}
}
@@ -727,7 +725,7 @@ static void lpc_final(struct device *dev)
if (CONFIG(HAVE_SMI_HANDLER)) {
if (CONFIG(INTEL_CHIPSET_LOCKDOWN) ||
acpi_is_wakeup_s3()) {
- outb(APM_CNT_FINALIZE, APM_CNT);
+ apm_control(APM_CNT_FINALIZE);
}
}
}
diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c
index 8a61b295ae..bf03125a8a 100644
--- a/src/southbridge/intel/lynxpoint/lpc.c
+++ b/src/southbridge/intel/lynxpoint/lpc.c
@@ -474,9 +474,7 @@ static void enable_lp_clock_gating(struct device *dev)
static void pch_set_acpi_mode(void)
{
if (CONFIG(HAVE_SMI_HANDLER) && !acpi_is_wakeup_s3()) {
- printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n");
- outb(APM_CNT_ACPI_DISABLE, APM_CNT);
- printk(BIOS_DEBUG, "done.\n");
+ apm_control(APM_CNT_ACPI_DISABLE);
}
}
@@ -923,7 +921,7 @@ static void lpc_final(struct device *dev)
spi_finalize_ops();
if (acpi_is_wakeup_s3() || CONFIG(INTEL_CHIPSET_LOCKDOWN))
- outb(APM_CNT_FINALIZE, APM_CNT);
+ apm_control(APM_CNT_FINALIZE);
}
static struct device_operations device_ops = {