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>
This commit is contained in:
parent
5e6e5c11c7
commit
9a1620f4ed
|
@ -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)
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue