diff options
author | kn <kn@cvs.openbsd.org> | 2019-02-26 08:51:16 +0000 |
---|---|---|
committer | kn <kn@cvs.openbsd.org> | 2019-02-26 08:51:16 +0000 |
commit | 8b7c44fdfd62544312b38cf7248eb584f04c5271 (patch) | |
tree | 31acb964275b0021a1661e89ac2dbfd29407a59b | |
parent | e4046dded93745fe211aad28224032e9f8c62d28 (diff) |
Re-enable interrupts on resume with RF switch disabled
When disabling the switch, suspending and eventually resuming again with
wifi still off, re-enabling the switch has no effect due to interrupts
being disabled completely.
To ensure seemless operation, explicitly enable interrupts during hardware
initialization iff the switch is disabled.
While here, initialize the interrupt mask up front to avoid clearing the
previously set mask in any case.
OK mlarkin, Feedback and OK ststp
-rw-r--r-- | sys/dev/pci/if_iwn.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c index 1dab60807c0..caca6772afb 100644 --- a/sys/dev/pci/if_iwn.c +++ b/sys/dev/pci/if_iwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwn.c,v 1.206 2019/01/24 09:48:01 kn Exp $ */ +/* $OpenBSD: if_iwn.c,v 1.207 2019/02/26 08:51:15 kn Exp $ */ /*- * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr> @@ -6577,12 +6577,19 @@ iwn_init(struct ifnet *ifp) goto fail; } + /* Initialize interrupt mask to default value. */ + sc->int_mask = IWN_INT_MASK_DEF; + sc->sc_flags &= ~IWN_FLAG_USE_ICT; + /* Check that the radio is not disabled by hardware switch. */ if (!(IWN_READ(sc, IWN_GP_CNTRL) & IWN_GP_CNTRL_RFKILL)) { printf("%s: radio is disabled by hardware switch\n", sc->sc_dev.dv_xname); error = EPERM; /* :-) */ - goto fail; + /* Re-enable interrupts. */ + IWN_WRITE(sc, IWN_INT, 0xffffffff); + IWN_WRITE(sc, IWN_INT_MASK, sc->int_mask); + return error; } /* Read firmware images from the filesystem. */ @@ -6591,10 +6598,6 @@ iwn_init(struct ifnet *ifp) goto fail; } - /* Initialize interrupt mask to default value. */ - sc->int_mask = IWN_INT_MASK_DEF; - sc->sc_flags &= ~IWN_FLAG_USE_ICT; - /* Initialize hardware and upload firmware. */ error = iwn_hw_init(sc); free(sc->fw.data, M_DEVBUF, sc->fw.size); |