diff options
Diffstat (limited to 'src/cpu/x86/smm')
-rw-r--r-- | src/cpu/x86/smm/Makefile.inc | 1 | ||||
-rw-r--r-- | src/cpu/x86/smm/smi_trigger.c | 32 |
2 files changed, 26 insertions, 7 deletions
diff --git a/src/cpu/x86/smm/Makefile.inc b/src/cpu/x86/smm/Makefile.inc index 1ed018d1be..9d74558670 100644 --- a/src/cpu/x86/smm/Makefile.inc +++ b/src/cpu/x86/smm/Makefile.inc @@ -33,6 +33,7 @@ ramstage-srcs += $(obj)/cpu/x86/smm/smm.manual endif smm-y += save_state.c +smm-y += smi_trigger.c ifeq ($(CONFIG_SMM_TSEG),y) diff --git a/src/cpu/x86/smm/smi_trigger.c b/src/cpu/x86/smm/smi_trigger.c index 7e3ddb1613..ff5eeae778 100644 --- a/src/cpu/x86/smm/smi_trigger.c +++ b/src/cpu/x86/smm/smi_trigger.c @@ -4,24 +4,23 @@ #include <console/console.h> #include <cpu/x86/smm.h> -int apm_control(u8 cmd) +static void apmc_log(const char *fn, u8 cmd) { - if (!CONFIG(HAVE_SMI_HANDLER)) - return -1; - switch (cmd) { case APM_CNT_CST_CONTROL: + printk(BIOS_DEBUG, "%s: C-state control.\n", fn); break; case APM_CNT_PST_CONTROL: + printk(BIOS_DEBUG, "%s: P-state control.\n", fn); break; case APM_CNT_ACPI_DISABLE: - printk(BIOS_DEBUG, "Disabling ACPI via APMC.\n"); + printk(BIOS_DEBUG, "%s: Disabling ACPI.\n", fn); break; case APM_CNT_ACPI_ENABLE: - printk(BIOS_DEBUG, "Enabling ACPI via APMC.\n"); + printk(BIOS_DEBUG, "%s: Enabling ACPI.\n", fn); break; case APM_CNT_FINALIZE: - printk(BIOS_DEBUG, "Finalizing SMM.\n"); + printk(BIOS_DEBUG, "%s: Finalizing SMM.\n", fn); break; case APM_CNT_ELOG_GSMI: break; @@ -30,8 +29,18 @@ int apm_control(u8 cmd) case APM_CNT_SMMINFO: break; default: + printk(BIOS_DEBUG, "%s: Unknown APMC 0x%02x.\n", fn, cmd); break; } +} + +int apm_control(u8 cmd) +{ + /* Never proceed inside SMI handler or without one. */ + if (ENV_SMM || !CONFIG(HAVE_SMI_HANDLER)) + return -1; + + apmc_log(__func__, cmd); /* Now raise the SMI. */ outb(cmd, APM_CNT); @@ -39,3 +48,12 @@ int apm_control(u8 cmd) printk(BIOS_DEBUG, "APMC done.\n"); return 0; } + +u8 apm_get_apmc(void) +{ + /* Emulate B2 register as the FADT / Linux expects it */ + u8 cmd = inb(APM_CNT); + + apmc_log("SMI#", cmd); + return cmd; +} |