diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2021-01-08 13:27:33 +0200 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2021-01-25 10:35:23 +0000 |
commit | 9a1620f4ed5a17bde351142d3ca5489f3c95c61f (patch) | |
tree | 500105e777ce31219fa741d4e3bebb96f119cce8 /src/cpu | |
parent | 5e6e5c11c7841d5a1df8e7a33466df1a8a2a6314 (diff) |
cpu/x86/smm: Use common APMC logging
Unify the debug messages on raised SMIs.
Change-Id: I34eeb41d929bfb18730ac821a63bde95ef9a0b3e
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49248
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/cpu')
-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; +} |