summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_iwm.c
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2017-06-14 16:56:05 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2017-06-14 16:56:05 +0000
commitdb528aef9a16c61ebcb3b38865005d729ece21c0 (patch)
treec48b38d3fee821433b5e02fd12b7cdb35c2e391e /sys/dev/pci/if_iwm.c
parent772a4bb4e0b8c1349aa2d4a17aa9368884fd98f3 (diff)
Make iwm(4) wait for the PHY calibration result notification during HW init.
Code inspection revealed that Linux does this, and so should we. ok deraadt@
Diffstat (limited to 'sys/dev/pci/if_iwm.c')
-rw-r--r--sys/dev/pci/if_iwm.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c
index 062919b59cc..9478ce76dec 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.192 2017/06/09 13:47:26 stsp Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.193 2017/06/14 16:56:04 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -3126,6 +3126,7 @@ iwm_load_ucode_wait_alive(struct iwm_softc *sc,
int
iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justnvm)
{
+ const int wait_flags = (IWM_INIT_COMPLETE | IWM_CALIB_COMPLETE);
int err;
if ((sc->sc_flags & IWM_FLAG_RFKILL) && !justnvm) {
@@ -3177,10 +3178,10 @@ iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justnvm)
return err;
/*
- * Nothing to do but wait for the init complete notification
- * from the firmware
+ * Nothing to do but wait for the init complete and phy DB
+ * notifications from the firmware.
*/
- while (!sc->sc_init_complete) {
+ while ((sc->sc_init_complete & wait_flags) != wait_flags) {
err = tsleep(&sc->sc_init_complete, 0, "iwminit", 2*hz);
if (err)
break;
@@ -6680,6 +6681,8 @@ iwm_notif_intr(struct iwm_softc *sc)
struct iwm_calib_res_notif_phy_db *phy_db_notif;
SYNC_RESP_STRUCT(phy_db_notif, pkt);
iwm_phy_db_set_section(sc, phy_db_notif);
+ sc->sc_init_complete |= IWM_CALIB_COMPLETE;
+ wakeup(&sc->sc_init_complete);
break;
}
@@ -6746,7 +6749,7 @@ iwm_notif_intr(struct iwm_softc *sc)
break;
case IWM_INIT_COMPLETE_NOTIF:
- sc->sc_init_complete = 1;
+ sc->sc_init_complete |= IWM_INIT_COMPLETE;
wakeup(&sc->sc_init_complete);
break;