From 3b1d1ce1af684f5a94376a023980d6d94cb7972a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=BBygowski?= Date: Sun, 21 Nov 2021 17:00:02 +0100 Subject: [PATCH] superio/smsc/sch5545: Clear PMEs in the early init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disable PMEs and clear global PME status to avoid undesired wakeups or hangs in later stages. These bits are set by OS via ACPI can survive S5 state so it is necessary to set them back to defaults after an ungraceful shutdown. TEST=Dell OptiPlex 9010 does not hang anymore after ungraceful shutdown when configuring GPE0_EN register in southbridge LPC init Signed-off-by: Michał Żygowski Change-Id: I790cac3ce1101565b64ed54d9c6b50f5e9aa4cf6 Reviewed-on: https://review.coreboot.org/c/coreboot/+/59524 Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/superio/smsc/sch5545/sch5545_early_init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/superio/smsc/sch5545/sch5545_early_init.c b/src/superio/smsc/sch5545/sch5545_early_init.c index ed4fa5337b..d77ed0d750 100644 --- a/src/superio/smsc/sch5545/sch5545_early_init.c +++ b/src/superio/smsc/sch5545/sch5545_early_init.c @@ -100,6 +100,13 @@ void sch5545_early_init(unsigned int port) sch5545_set_led(SCH5545_RUNTIME_REG_BASE, SCH5545_LED_COLOR_GREEN, SCH5545_LED_BLINK_ON); + /* + * Clear global PME status and disable PME generation to avoid + * unexpected wakeups or hangs. OS will re-enable it via ACPI. + */ + outb(0, SCH5545_RUNTIME_REG_BASE + SCH5545_RR_PME_EN); + outb(1, SCH5545_RUNTIME_REG_BASE + SCH5545_RR_PME_STS); + /* Configure EMI */ dev = PNP_DEV(port, SCH5545_LDN_LPC); pnp_set_logical_device(dev);