From af45b3b445209421650304c9d9aa65833f564362 Mon Sep 17 00:00:00 2001 From: deraadt Date: Tue, 13 Aug 2024 22:32:58 +0000 Subject: [PATCH] Be more aggressive about disabling interrupts in both DVACT_QUIESCE and DVACT_SUSPEND, because we are seeing false interrupts during S0 resume. Other problems remain, and ratchov has some clues he'll dig into in the coming weeks. For now, this is a good enough improvement. ok ratchov --- sys/dev/pci/azalia.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c index b23a01aba97..97bd1de3874 100644 --- a/sys/dev/pci/azalia.c +++ b/sys/dev/pci/azalia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: azalia.c,v 1.287 2024/05/17 19:43:45 kettenis Exp $ */ +/* $OpenBSD: azalia.c,v 1.288 2024/08/13 22:32:58 deraadt Exp $ */ /* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */ /*- @@ -599,6 +599,18 @@ azalia_pci_activate(struct device *self, int act) int rv = 0; switch (act) { + case DVACT_QUIESCE: + rv = config_activate_children(self, act); + + if (sc->detached) + break; + + /* stop interrupts and clear status registers */ + AZ_WRITE_4(sc, INTCTL, 0); + AZ_WRITE_2(sc, STATESTS, HDA_STATESTS_SDIWAKE); + AZ_WRITE_1(sc, RIRBSTS, HDA_RIRBSTS_RINTFL | HDA_RIRBSTS_RIRBOIS); + (void) AZ_READ_4(sc, INTSTS); + break; case DVACT_SUSPEND: azalia_suspend(sc); break; @@ -1388,6 +1400,12 @@ azalia_suspend(azalia_t *az) if (az->detached) return 0; + /* stop interrupts and clear status registers */ + AZ_WRITE_4(az, INTCTL, 0); + AZ_WRITE_2(az, STATESTS, HDA_STATESTS_SDIWAKE); + AZ_WRITE_1(az, RIRBSTS, HDA_RIRBSTS_RINTFL | HDA_RIRBSTS_RIRBOIS); + (void) AZ_READ_4(az, INTSTS); + /* disable unsolicited responses */ AZ_WRITE_4(az, GCTL, AZ_READ_4(az, GCTL) & ~HDA_GCTL_UNSOL); -- 2.20.1