superio/smsc/sch5545: Clear PMEs in the early init
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 <michal.zygowski@3mdeb.com>
Change-Id: I790cac3ce1101565b64ed54d9c6b50f5e9aa4cf6
Reviewed-on: https://review.coreboot.org/c/coreboot/+/59524
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/superio/smsc/sch5545/sch5545_early_init.c b/src/superio/smsc/sch5545/sch5545_early_init.c
index ed4fa53..d77ed0d 100644
--- a/src/superio/smsc/sch5545/sch5545_early_init.c
+++ b/src/superio/smsc/sch5545/sch5545_early_init.c
@@ -100,6 +100,13 @@
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);