diff options
-rw-r--r-- | src/cpu/x86/smm/Makefile.inc | 1 | ||||
-rw-r--r-- | src/cpu/x86/smm/smi_trigger.c | 32 | ||||
-rw-r--r-- | src/include/cpu/x86/smm.h | 1 | ||||
-rw-r--r-- | src/mainboard/dell/optiplex_9010/smihandler.c | 2 | ||||
-rw-r--r-- | src/mainboard/google/butterfly/smihandler.c | 3 | ||||
-rw-r--r-- | src/mainboard/google/parrot/smihandler.c | 3 | ||||
-rw-r--r-- | src/mainboard/lenovo/s230u/smihandler.c | 4 | ||||
-rw-r--r-- | src/soc/intel/baytrail/smihandler.c | 8 | ||||
-rw-r--r-- | src/soc/intel/braswell/smihandler.c | 8 | ||||
-rw-r--r-- | src/soc/intel/broadwell/pch/smihandler.c | 8 | ||||
-rw-r--r-- | src/soc/intel/common/block/smm/smihandler.c | 8 | ||||
-rw-r--r-- | src/soc/intel/denverton_ns/smihandler.c | 8 | ||||
-rw-r--r-- | src/southbridge/intel/common/smihandler.c | 8 | ||||
-rw-r--r-- | src/southbridge/intel/i82801dx/smihandler.c | 10 | ||||
-rw-r--r-- | src/southbridge/intel/lynxpoint/smihandler.c | 8 |
15 files changed, 35 insertions, 77 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; +} diff --git a/src/include/cpu/x86/smm.h b/src/include/cpu/x86/smm.h index 9106842840..31827cfb3f 100644 --- a/src/include/cpu/x86/smm.h +++ b/src/include/cpu/x86/smm.h @@ -33,6 +33,7 @@ /* Send cmd to APM_CNT with HAVE_SMI_HANDLER checking. */ int apm_control(u8 cmd); +u8 apm_get_apmc(void); void io_trap_handler(int smif); int southbridge_io_trap_handler(int smif); diff --git a/src/mainboard/dell/optiplex_9010/smihandler.c b/src/mainboard/dell/optiplex_9010/smihandler.c index d3c83ef5e7..f3ba57cdd2 100644 --- a/src/mainboard/dell/optiplex_9010/smihandler.c +++ b/src/mainboard/dell/optiplex_9010/smihandler.c @@ -16,7 +16,6 @@ int mainboard_smi_apmc(u8 data) u8 val; switch (data) { case APM_CNT_ACPI_ENABLE: - printk(BIOS_SPEW, "%s: APM CNT EN: %02x\n", __func__, data); /* Enable wake on PS2 */ val = inb(SCH5545_RUNTIME_REG_BASE + SCH5545_RR_PME_EN1); val |= (SCH5545_KBD_PME_EN | SCH5545_MOUSE_PME_EN); @@ -26,7 +25,6 @@ int mainboard_smi_apmc(u8 data) outb(SCH5545_GLOBAL_PME_EN, SCH5545_RUNTIME_REG_BASE + SCH5545_RR_PME_EN); break; case APM_CNT_ACPI_DISABLE: - printk(BIOS_SPEW, "%s: APM CNT DIS: %02x\n", __func__, data); /* Disable wake on PS2 */ val = inb(SCH5545_RUNTIME_REG_BASE + SCH5545_RR_PME_EN1); val &= ~(SCH5545_KBD_PME_EN | SCH5545_MOUSE_PME_EN); diff --git a/src/mainboard/google/butterfly/smihandler.c b/src/mainboard/google/butterfly/smihandler.c index 1f45055b0e..f826bcf194 100644 --- a/src/mainboard/google/butterfly/smihandler.c +++ b/src/mainboard/google/butterfly/smihandler.c @@ -36,16 +36,13 @@ void mainboard_smi_sleep(u8 slp_typ) int mainboard_smi_apmc(u8 apmc) { - printk(BIOS_DEBUG, "mainboard_smi_apmc: %x\n", apmc); switch (apmc) { case APM_CNT_ACPI_ENABLE: - printk(BIOS_DEBUG, "APMC: ACPI_EN\n"); /* Clear all pending events and enable SCI */ ec_write_cmd(EC_CMD_ENABLE_ACPI_MODE); break; case APM_CNT_ACPI_DISABLE: - printk(BIOS_DEBUG, "APMC: ACPI_DIS\n"); /* Clear all pending events and tell the EC that ACPI is disabled */ ec_write_cmd(EC_CMD_DISABLE_ACPI_MODE); break; diff --git a/src/mainboard/google/parrot/smihandler.c b/src/mainboard/google/parrot/smihandler.c index c5fb853c36..95dce5057a 100644 --- a/src/mainboard/google/parrot/smihandler.c +++ b/src/mainboard/google/parrot/smihandler.c @@ -66,10 +66,8 @@ void mainboard_smi_sleep(u8 slp_typ) int mainboard_smi_apmc(u8 apmc) { - printk(BIOS_DEBUG, "%s: %x\n", __func__, apmc); switch (apmc) { case APM_CNT_ACPI_ENABLE: - printk(BIOS_DEBUG, "APMC: ACPI_EN\n"); /* Clear all pending events */ /* EC cmd:59 data:E8 */ ec_kbc_write_cmd(0x59); @@ -79,7 +77,6 @@ int mainboard_smi_apmc(u8 apmc) gpi_route_interrupt(EC_LID_GPI, GPI_IS_SCI); break; case APM_CNT_ACPI_DISABLE: - printk(BIOS_DEBUG, "APMC: ACPI_DIS\n"); /* Clear all pending events */ /* EC cmd:59 data:e9 */ ec_kbc_write_cmd(0x59); diff --git a/src/mainboard/lenovo/s230u/smihandler.c b/src/mainboard/lenovo/s230u/smihandler.c index 8f22063228..f5fb9b4a7d 100644 --- a/src/mainboard/lenovo/s230u/smihandler.c +++ b/src/mainboard/lenovo/s230u/smihandler.c @@ -74,18 +74,14 @@ void mainboard_smi_gpi(u32 gpi_sts) int mainboard_smi_apmc(u8 data) { - printk(BIOS_INFO, "%s(%02x)\n", __func__, data); - switch (data) { case APM_CNT_ACPI_ENABLE: - printk(BIOS_DEBUG, "Enable ACPI mode\n"); ec_enter_acpi_mode(); gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SCI); gpi_route_interrupt(GPE_PALMDET1, GPI_IS_SCI); gpi_route_interrupt(GPE_PALMDET2, GPI_IS_SCI); break; case APM_CNT_ACPI_DISABLE: - printk(BIOS_DEBUG, "Disable ACPI mode\n"); ec_enter_apm_mode(); gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SMI); break; diff --git a/src/soc/intel/baytrail/smihandler.c b/src/soc/intel/baytrail/smihandler.c index 6fedba7f69..1a33444ca4 100644 --- a/src/soc/intel/baytrail/smihandler.c +++ b/src/soc/intel/baytrail/smihandler.c @@ -281,9 +281,7 @@ static void southbridge_smi_apmc(void) { uint8_t reg8; - /* Emulate B2 register as the FADT / Linux expects it */ - - reg8 = inb(APM_CNT); + reg8 = apm_get_apmc(); switch (reg8) { case APM_CNT_CST_CONTROL: /* @@ -291,7 +289,6 @@ static void southbridge_smi_apmc(void) * some kind of race condition in Linux * and causes a kernel oops */ - printk(BIOS_DEBUG, "C-state control\n"); break; case APM_CNT_PST_CONTROL: /* @@ -299,15 +296,12 @@ static void southbridge_smi_apmc(void) * some kind of race condition in Linux * and causes a kernel oops */ - printk(BIOS_DEBUG, "P-state control\n"); break; case APM_CNT_ACPI_DISABLE: disable_pm1_control(SCI_EN); - printk(BIOS_DEBUG, "SMI#: ACPI disabled.\n"); break; case APM_CNT_ACPI_ENABLE: enable_pm1_control(SCI_EN); - printk(BIOS_DEBUG, "SMI#: ACPI enabled.\n"); break; case APM_CNT_ELOG_GSMI: if (CONFIG(ELOG_GSMI)) diff --git a/src/soc/intel/braswell/smihandler.c b/src/soc/intel/braswell/smihandler.c index a4fdb013cb..7343d47933 100644 --- a/src/soc/intel/braswell/smihandler.c +++ b/src/soc/intel/braswell/smihandler.c @@ -260,9 +260,7 @@ static void southbridge_smi_apmc(void) { uint8_t reg8; - /* Emulate B2 register as the FADT / Linux expects it */ - - reg8 = inb(APM_CNT); + reg8 = apm_get_apmc(); switch (reg8) { case APM_CNT_CST_CONTROL: /* @@ -270,7 +268,6 @@ static void southbridge_smi_apmc(void) * some kind of race condition in Linux * and causes a kernel oops */ - printk(BIOS_DEBUG, "C-state control\n"); break; case APM_CNT_PST_CONTROL: /* @@ -278,15 +275,12 @@ static void southbridge_smi_apmc(void) * some kind of race condition in Linux * and causes a kernel oops */ - printk(BIOS_DEBUG, "P-state control\n"); break; case APM_CNT_ACPI_DISABLE: disable_pm1_control(SCI_EN); - printk(BIOS_DEBUG, "SMI#: ACPI disabled.\n"); break; case APM_CNT_ACPI_ENABLE: enable_pm1_control(SCI_EN); - printk(BIOS_DEBUG, "SMI#: ACPI enabled.\n"); break; case APM_CNT_ELOG_GSMI: if (CONFIG(ELOG_GSMI)) diff --git a/src/soc/intel/broadwell/pch/smihandler.c b/src/soc/intel/broadwell/pch/smihandler.c index 5ed52d8fbd..02c795e411 100644 --- a/src/soc/intel/broadwell/pch/smihandler.c +++ b/src/soc/intel/broadwell/pch/smihandler.c @@ -312,23 +312,17 @@ static void southbridge_smi_apmc(void) { u8 reg8; - /* Emulate B2 register as the FADT / Linux expects it */ - - reg8 = inb(APM_CNT); + reg8 = apm_get_apmc(); switch (reg8) { case APM_CNT_CST_CONTROL: - printk(BIOS_DEBUG, "C-state control\n"); break; case APM_CNT_PST_CONTROL: - printk(BIOS_DEBUG, "P-state control\n"); break; case APM_CNT_ACPI_DISABLE: disable_pm1_control(SCI_EN); - printk(BIOS_DEBUG, "SMI#: ACPI disabled.\n"); break; case APM_CNT_ACPI_ENABLE: enable_pm1_control(SCI_EN); - printk(BIOS_DEBUG, "SMI#: ACPI enabled.\n"); break; case APM_CNT_ELOG_GSMI: if (CONFIG(ELOG_GSMI)) diff --git a/src/soc/intel/common/block/smm/smihandler.c b/src/soc/intel/common/block/smm/smihandler.c index 51a3003195..4aed3f8848 100644 --- a/src/soc/intel/common/block/smm/smihandler.c +++ b/src/soc/intel/common/block/smm/smihandler.c @@ -331,9 +331,7 @@ void smihandler_southbridge_apmc( { uint8_t reg8; - /* Emulate B2 register as the FADT / Linux expects it */ - - reg8 = inb(APM_CNT); + reg8 = apm_get_apmc(); switch (reg8) { case APM_CNT_CST_CONTROL: /* @@ -341,7 +339,6 @@ void smihandler_southbridge_apmc( * some kind of race condition in Linux * and causes a kernel oops */ - printk(BIOS_DEBUG, "C-state control\n"); break; case APM_CNT_PST_CONTROL: /* @@ -349,15 +346,12 @@ void smihandler_southbridge_apmc( * some kind of race condition in Linux * and causes a kernel oops */ - printk(BIOS_DEBUG, "P-state control\n"); break; case APM_CNT_ACPI_DISABLE: pmc_disable_pm1_control(SCI_EN); - printk(BIOS_DEBUG, "SMI#: ACPI disabled.\n"); break; case APM_CNT_ACPI_ENABLE: pmc_enable_pm1_control(SCI_EN); - printk(BIOS_DEBUG, "SMI#: ACPI enabled.\n"); break; case APM_CNT_ELOG_GSMI: if (CONFIG(ELOG_GSMI)) diff --git a/src/soc/intel/denverton_ns/smihandler.c b/src/soc/intel/denverton_ns/smihandler.c index ae15795db9..f00d9216ec 100644 --- a/src/soc/intel/denverton_ns/smihandler.c +++ b/src/soc/intel/denverton_ns/smihandler.c @@ -220,31 +220,25 @@ static void southbridge_smi_apmc(void) { uint8_t reg8; - /* Emulate B2 register as the FADT / Linux expects it */ - - reg8 = inb(APM_CNT); + reg8 = apm_get_apmc(); switch (reg8) { case APM_CNT_CST_CONTROL: /* Calling this function seems to cause * some kind of race condition in Linux * and causes a kernel oops */ - printk(BIOS_DEBUG, "C-state control\n"); break; case APM_CNT_PST_CONTROL: /* Calling this function seems to cause * some kind of race condition in Linux * and causes a kernel oops */ - printk(BIOS_DEBUG, "P-state control\n"); break; case APM_CNT_ACPI_DISABLE: disable_pm1_control(SCI_EN); - printk(BIOS_DEBUG, "SMI#: ACPI disabled.\n"); break; case APM_CNT_ACPI_ENABLE: enable_pm1_control(SCI_EN); - printk(BIOS_DEBUG, "SMI#: ACPI enabled.\n"); break; case APM_CNT_FINALIZE: finalize(); diff --git a/src/southbridge/intel/common/smihandler.c b/src/southbridge/intel/common/smihandler.c index d59e29cdd9..7256497c4f 100644 --- a/src/southbridge/intel/common/smihandler.c +++ b/src/southbridge/intel/common/smihandler.c @@ -274,31 +274,25 @@ static void southbridge_smi_apmc(void) { u8 reg8; - /* Emulate B2 register as the FADT / Linux expects it */ - - reg8 = inb(APM_CNT); + reg8 = apm_get_apmc(); switch (reg8) { case APM_CNT_CST_CONTROL: /* Calling this function seems to cause * some kind of race condition in Linux * and causes a kernel oops */ - printk(BIOS_DEBUG, "C-state control\n"); break; case APM_CNT_PST_CONTROL: /* Calling this function seems to cause * some kind of race condition in Linux * and causes a kernel oops */ - printk(BIOS_DEBUG, "P-state control\n"); break; case APM_CNT_ACPI_DISABLE: write_pmbase32(PM1_CNT, read_pmbase32(PM1_CNT) & ~SCI_EN); - printk(BIOS_DEBUG, "SMI#: ACPI disabled.\n"); break; case APM_CNT_ACPI_ENABLE: write_pmbase32(PM1_CNT, read_pmbase32(PM1_CNT) | SCI_EN); - printk(BIOS_DEBUG, "SMI#: ACPI enabled.\n"); break; case APM_CNT_FINALIZE: if (mainboard_finalized) { diff --git a/src/southbridge/intel/i82801dx/smihandler.c b/src/southbridge/intel/i82801dx/smihandler.c index 19fe5bba2a..d18f8b230e 100644 --- a/src/southbridge/intel/i82801dx/smihandler.c +++ b/src/southbridge/intel/i82801dx/smihandler.c @@ -297,38 +297,30 @@ static void southbridge_smi_apmc(void) u32 pmctrl; u8 reg8; - /* Emulate B2 register as the FADT / Linux expects it */ - - reg8 = inb(APM_CNT); + reg8 = apm_get_apmc(); switch (reg8) { case APM_CNT_CST_CONTROL: /* Calling this function seems to cause * some kind of race condition in Linux * and causes a kernel oops */ - printk(BIOS_DEBUG, "C-state control\n"); break; case APM_CNT_PST_CONTROL: /* Calling this function seems to cause * some kind of race condition in Linux * and causes a kernel oops */ - printk(BIOS_DEBUG, "P-state control\n"); break; case APM_CNT_ACPI_DISABLE: pmctrl = inl(pmbase + PM1_CNT); pmctrl &= ~SCI_EN; outl(pmctrl, pmbase + PM1_CNT); - printk(BIOS_DEBUG, "SMI#: ACPI disabled.\n"); break; case APM_CNT_ACPI_ENABLE: pmctrl = inl(pmbase + PM1_CNT); pmctrl |= SCI_EN; outl(pmctrl, pmbase + PM1_CNT); - printk(BIOS_DEBUG, "SMI#: ACPI enabled.\n"); break; - default: - printk(BIOS_DEBUG, "SMI#: Unknown function APM_CNT=%02x\n", reg8); } } diff --git a/src/southbridge/intel/lynxpoint/smihandler.c b/src/southbridge/intel/lynxpoint/smihandler.c index 22845ec518..8af5356e38 100644 --- a/src/southbridge/intel/lynxpoint/smihandler.c +++ b/src/southbridge/intel/lynxpoint/smihandler.c @@ -262,9 +262,7 @@ static void southbridge_smi_apmc(void) u8 reg8; static int chipset_finalized = 0; - /* Emulate B2 register as the FADT / Linux expects it */ - - reg8 = inb(APM_CNT); + reg8 = apm_get_apmc(); switch (reg8) { case APM_CNT_FINALIZE: if (chipset_finalized) { @@ -284,22 +282,18 @@ static void southbridge_smi_apmc(void) * some kind of race condition in Linux * and causes a kernel oops */ - printk(BIOS_DEBUG, "C-state control\n"); break; case APM_CNT_PST_CONTROL: /* Calling this function seems to cause * some kind of race condition in Linux * and causes a kernel oops */ - printk(BIOS_DEBUG, "P-state control\n"); break; case APM_CNT_ACPI_DISABLE: disable_pm1_control(SCI_EN); - printk(BIOS_DEBUG, "SMI#: ACPI disabled.\n"); break; case APM_CNT_ACPI_ENABLE: enable_pm1_control(SCI_EN); - printk(BIOS_DEBUG, "SMI#: ACPI enabled.\n"); break; case APM_CNT_ROUTE_ALL_XHCI: usb_xhci_route_all(); |