From: stsp Date: Thu, 19 Aug 2021 18:45:11 +0000 (+0000) Subject: Run more device init code when resuming iwm(4) and iwx(4) devices. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ef08b94522f8aa88dd6f1b171a9c42a0853757fe;p=openbsd Run more device init code when resuming iwm(4) and iwx(4) devices. deraadt@ pointed out that the resume code path only ran a small part of the entire hardware init sequence which runs when the device is first attached at boot time. In particular, we didn't wait for device stabilization, and MSI-X initialization was attempted too early, and the "persistence bit" workaround was skipped (which, ironically, is supposed to address a known hardware bug during resume). Tested by jcs on AX201 and by myself on 8265 with no regressions seen. --- diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index f76a648473f..cfa97343e2f 100644 --- a/sys/dev/pci/if_iwm.c +++ b/sys/dev/pci/if_iwm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwm.c,v 1.358 2021/08/19 06:02:04 stsp Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.359 2021/08/19 18:45:11 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -11425,13 +11425,7 @@ iwm_resume(struct iwm_softc *sc) reg = pci_conf_read(sc->sc_pct, sc->sc_pcitag, 0x40); pci_conf_write(sc->sc_pct, sc->sc_pcitag, 0x40, reg & ~0xff00); - /* reconfigure the MSI-X mapping to get the correct IRQ for rfkill */ - iwm_conf_msix_hw(sc, 0); - - iwm_enable_rfkill_int(sc); - iwm_check_rfkill(sc); - - return iwm_prepare_card_hw(sc); + return iwm_start_hw(sc); } int diff --git a/sys/dev/pci/if_iwx.c b/sys/dev/pci/if_iwx.c index e43ee9d51e5..dfe5373d610 100644 --- a/sys/dev/pci/if_iwx.c +++ b/sys/dev/pci/if_iwx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwx.c,v 1.92 2021/08/19 06:02:04 stsp Exp $ */ +/* $OpenBSD: if_iwx.c,v 1.93 2021/08/19 18:45:11 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -9556,13 +9556,7 @@ iwx_resume(struct iwx_softc *sc) reg = pci_conf_read(sc->sc_pct, sc->sc_pcitag, 0x40); pci_conf_write(sc->sc_pct, sc->sc_pcitag, 0x40, reg & ~0xff00); - /* reconfigure the MSI-X mapping to get the correct IRQ for rfkill */ - iwx_conf_msix_hw(sc, 0); - - iwx_enable_rfkill_int(sc); - iwx_check_rfkill(sc); - - return iwx_prepare_card_hw(sc); + return iwx_start_hw(sc); } int