diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2017-06-14 16:56:05 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2017-06-14 16:56:05 +0000 |
commit | db528aef9a16c61ebcb3b38865005d729ece21c0 (patch) | |
tree | c48b38d3fee821433b5e02fd12b7cdb35c2e391e | |
parent | 772a4bb4e0b8c1349aa2d4a17aa9368884fd98f3 (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@
-rw-r--r-- | sys/dev/pci/if_iwm.c | 13 | ||||
-rw-r--r-- | sys/dev/pci/if_iwmvar.h | 4 |
2 files changed, 11 insertions, 6 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; diff --git a/sys/dev/pci/if_iwmvar.h b/sys/dev/pci/if_iwmvar.h index a78c5eddd32..23f27c91019 100644 --- a/sys/dev/pci/if_iwmvar.h +++ b/sys/dev/pci/if_iwmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwmvar.h,v 1.27 2017/05/28 09:59:58 stsp Exp $ */ +/* $OpenBSD: if_iwmvar.h,v 1.28 2017/06/14 16:56:04 stsp Exp $ */ /* * Copyright (c) 2014 genua mbh <info@genua.de> @@ -407,6 +407,8 @@ struct iwm_softc { int sc_fw_chunk_done; int sc_init_complete; +#define IWM_INIT_COMPLETE 0x01 +#define IWM_CALIB_COMPLETE 0x02 struct iwm_ucode_status sc_uc; enum iwm_ucode_type sc_uc_current; |