if_iwn.c (266545) | if_iwn.c (266546) |
---|---|
1/*- 2 * Copyright (c) 2007-2009 Damien Bergamini <damien.bergamini@free.fr> 3 * Copyright (c) 2008 Benjamin Close <benjsc@FreeBSD.org> 4 * Copyright (c) 2008 Sam Leffler, Errno Consulting 5 * Copyright (c) 2011 Intel Corporation 6 * Copyright (c) 2013 Cedric GROSS <c.gross@kreiz-it.fr> 7 * Copyright (c) 2013 Adrian Chadd <adrian@FreeBSD.org> 8 * --- 11 unchanged lines hidden (view full) --- 20 */ 21 22/* 23 * Driver for Intel WiFi Link 4965 and 1000/5000/6000 Series 802.11 network 24 * adapters. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2007-2009 Damien Bergamini <damien.bergamini@free.fr> 3 * Copyright (c) 2008 Benjamin Close <benjsc@FreeBSD.org> 4 * Copyright (c) 2008 Sam Leffler, Errno Consulting 5 * Copyright (c) 2011 Intel Corporation 6 * Copyright (c) 2013 Cedric GROSS <c.gross@kreiz-it.fr> 7 * Copyright (c) 2013 Adrian Chadd <adrian@FreeBSD.org> 8 * --- 11 unchanged lines hidden (view full) --- 20 */ 21 22/* 23 * Driver for Intel WiFi Link 4965 and 1000/5000/6000 Series 802.11 network 24 * adapters. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/iwn/if_iwn.c 266545 2014-05-22 15:00:32Z trasz $"); | 28__FBSDID("$FreeBSD: head/sys/dev/iwn/if_iwn.c 266546 2014-05-22 15:29:25Z trasz $"); |
29 30#include "opt_wlan.h" 31#include "opt_iwn.h" 32 33#include <sys/param.h> 34#include <sys/sockio.h> 35#include <sys/sysctl.h> 36#include <sys/mbuf.h> --- 290 unchanged lines hidden (view full) --- 327static void iwn_apm_stop(struct iwn_softc *); 328static int iwn4965_nic_config(struct iwn_softc *); 329static int iwn5000_nic_config(struct iwn_softc *); 330static int iwn_hw_prepare(struct iwn_softc *); 331static int iwn_hw_init(struct iwn_softc *); 332static void iwn_hw_stop(struct iwn_softc *); 333static void iwn_radio_on(void *, int); 334static void iwn_radio_off(void *, int); | 29 30#include "opt_wlan.h" 31#include "opt_iwn.h" 32 33#include <sys/param.h> 34#include <sys/sockio.h> 35#include <sys/sysctl.h> 36#include <sys/mbuf.h> --- 290 unchanged lines hidden (view full) --- 327static void iwn_apm_stop(struct iwn_softc *); 328static int iwn4965_nic_config(struct iwn_softc *); 329static int iwn5000_nic_config(struct iwn_softc *); 330static int iwn_hw_prepare(struct iwn_softc *); 331static int iwn_hw_init(struct iwn_softc *); 332static void iwn_hw_stop(struct iwn_softc *); 333static void iwn_radio_on(void *, int); 334static void iwn_radio_off(void *, int); |
335static void iwn_panicked(void *, int); |
|
335static void iwn_init_locked(struct iwn_softc *); 336static void iwn_init(void *); 337static void iwn_stop_locked(struct iwn_softc *); 338static void iwn_stop(struct iwn_softc *); 339static void iwn_scan_start(struct ieee80211com *); 340static void iwn_scan_end(struct ieee80211com *); 341static void iwn_set_channel(struct ieee80211com *); 342static void iwn_scan_curchan(struct ieee80211_scan_state *, unsigned long); --- 323 unchanged lines hidden (view full) --- 666 667 iwn_radiotap_attach(sc); 668 669 callout_init_mtx(&sc->calib_to, &sc->sc_mtx, 0); 670 callout_init_mtx(&sc->watchdog_to, &sc->sc_mtx, 0); 671 TASK_INIT(&sc->sc_reinit_task, 0, iwn_hw_reset, sc); 672 TASK_INIT(&sc->sc_radioon_task, 0, iwn_radio_on, sc); 673 TASK_INIT(&sc->sc_radiooff_task, 0, iwn_radio_off, sc); | 336static void iwn_init_locked(struct iwn_softc *); 337static void iwn_init(void *); 338static void iwn_stop_locked(struct iwn_softc *); 339static void iwn_stop(struct iwn_softc *); 340static void iwn_scan_start(struct ieee80211com *); 341static void iwn_scan_end(struct ieee80211com *); 342static void iwn_set_channel(struct ieee80211com *); 343static void iwn_scan_curchan(struct ieee80211_scan_state *, unsigned long); --- 323 unchanged lines hidden (view full) --- 667 668 iwn_radiotap_attach(sc); 669 670 callout_init_mtx(&sc->calib_to, &sc->sc_mtx, 0); 671 callout_init_mtx(&sc->watchdog_to, &sc->sc_mtx, 0); 672 TASK_INIT(&sc->sc_reinit_task, 0, iwn_hw_reset, sc); 673 TASK_INIT(&sc->sc_radioon_task, 0, iwn_radio_on, sc); 674 TASK_INIT(&sc->sc_radiooff_task, 0, iwn_radio_off, sc); |
675 TASK_INIT(&sc->sc_panic_task, 0, iwn_panicked, sc); |
|
674 | 676 |
677 sc->sc_tq = taskqueue_create("iwn_taskq", M_WAITOK, 678 taskqueue_thread_enqueue, &sc->sc_tq); 679 error = taskqueue_start_threads(&sc->sc_tq, 1, 0, "iwn_taskq"); 680 if (error != 0) { 681 device_printf(dev, "can't start threads, error %d\n", error); 682 goto fail; 683 } 684 |
|
675 iwn_sysctlattach(sc); 676 677 /* 678 * Hook our interrupt after all initialization is complete. 679 */ 680 error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, 681 NULL, iwn_intr, sc, &sc->sc_ih); 682 if (error != 0) { --- 646 unchanged lines hidden (view full) --- 1329 if (ifp != NULL) { 1330 ic = ifp->if_l2com; 1331 1332 ieee80211_draintask(ic, &sc->sc_reinit_task); 1333 ieee80211_draintask(ic, &sc->sc_radioon_task); 1334 ieee80211_draintask(ic, &sc->sc_radiooff_task); 1335 1336 iwn_stop(sc); | 685 iwn_sysctlattach(sc); 686 687 /* 688 * Hook our interrupt after all initialization is complete. 689 */ 690 error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, 691 NULL, iwn_intr, sc, &sc->sc_ih); 692 if (error != 0) { --- 646 unchanged lines hidden (view full) --- 1339 if (ifp != NULL) { 1340 ic = ifp->if_l2com; 1341 1342 ieee80211_draintask(ic, &sc->sc_reinit_task); 1343 ieee80211_draintask(ic, &sc->sc_radioon_task); 1344 ieee80211_draintask(ic, &sc->sc_radiooff_task); 1345 1346 iwn_stop(sc); |
1347 1348 taskqueue_drain_all(sc->sc_tq); 1349 taskqueue_free(sc->sc_tq); 1350 |
|
1337 callout_drain(&sc->watchdog_to); 1338 callout_drain(&sc->calib_to); 1339 ieee80211_ifdetach(ic); 1340 } 1341 1342 /* Uninstall interrupt handler. */ 1343 if (sc->irq != NULL) { 1344 bus_teardown_intr(dev, sc->irq, sc->sc_ih); --- 2594 unchanged lines hidden (view full) --- 3939 if (r1 & (IWN_INT_SW_ERR | IWN_INT_HW_ERR)) { 3940 device_printf(sc->sc_dev, "%s: fatal firmware error\n", 3941 __func__); 3942#ifdef IWN_DEBUG 3943 iwn_debug_register(sc); 3944#endif 3945 /* Dump firmware error log and stop. */ 3946 iwn_fatal_intr(sc); | 1351 callout_drain(&sc->watchdog_to); 1352 callout_drain(&sc->calib_to); 1353 ieee80211_ifdetach(ic); 1354 } 1355 1356 /* Uninstall interrupt handler. */ 1357 if (sc->irq != NULL) { 1358 bus_teardown_intr(dev, sc->irq, sc->sc_ih); --- 2594 unchanged lines hidden (view full) --- 3953 if (r1 & (IWN_INT_SW_ERR | IWN_INT_HW_ERR)) { 3954 device_printf(sc->sc_dev, "%s: fatal firmware error\n", 3955 __func__); 3956#ifdef IWN_DEBUG 3957 iwn_debug_register(sc); 3958#endif 3959 /* Dump firmware error log and stop. */ 3960 iwn_fatal_intr(sc); |
3947 ifp->if_flags &= ~IFF_UP; 3948 iwn_stop_locked(sc); | 3961 3962 taskqueue_enqueue(sc->sc_tq, &sc->sc_panic_task); |
3949 goto done; 3950 } 3951 if ((r1 & (IWN_INT_FH_RX | IWN_INT_SW_RX | IWN_INT_RX_PERIODIC)) || 3952 (r2 & IWN_FH_INT_RX)) { 3953 if (sc->sc_flags & IWN_FLAG_USE_ICT) { 3954 if (r1 & (IWN_INT_FH_RX | IWN_INT_SW_RX)) 3955 IWN_WRITE(sc, IWN_FH_INT, IWN_FH_INT_RX); 3956 IWN_WRITE_1(sc, IWN_INT_PERIODIC, --- 4450 unchanged lines hidden (view full) --- 8407 /* Enable interrupts to get RF toggle notification. */ 8408 IWN_LOCK(sc); 8409 IWN_WRITE(sc, IWN_INT, 0xffffffff); 8410 IWN_WRITE(sc, IWN_INT_MASK, sc->int_mask); 8411 IWN_UNLOCK(sc); 8412} 8413 8414static void | 3963 goto done; 3964 } 3965 if ((r1 & (IWN_INT_FH_RX | IWN_INT_SW_RX | IWN_INT_RX_PERIODIC)) || 3966 (r2 & IWN_FH_INT_RX)) { 3967 if (sc->sc_flags & IWN_FLAG_USE_ICT) { 3968 if (r1 & (IWN_INT_FH_RX | IWN_INT_SW_RX)) 3969 IWN_WRITE(sc, IWN_FH_INT, IWN_FH_INT_RX); 3970 IWN_WRITE_1(sc, IWN_INT_PERIODIC, --- 4450 unchanged lines hidden (view full) --- 8421 /* Enable interrupts to get RF toggle notification. */ 8422 IWN_LOCK(sc); 8423 IWN_WRITE(sc, IWN_INT, 0xffffffff); 8424 IWN_WRITE(sc, IWN_INT_MASK, sc->int_mask); 8425 IWN_UNLOCK(sc); 8426} 8427 8428static void |
8429iwn_panicked(void *arg0, int pending) 8430{ 8431 struct iwn_softc *sc = arg0; 8432 struct ifnet *ifp = sc->sc_ifp; 8433 struct ieee80211com *ic = ifp->if_l2com; 8434 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); 8435 int error; 8436 8437 if (vap == NULL) { 8438 printf("%s: null vap\n", __func__); 8439 return; 8440 } 8441 8442 device_printf(sc->sc_dev, "%s: controller panicked, iv_state = %d; " 8443 "resetting...\n", __func__, vap->iv_state); 8444 8445 iwn_stop(sc); 8446 iwn_init(sc); 8447 iwn_start(sc->sc_ifp); 8448 if (vap->iv_state >= IEEE80211_S_AUTH && 8449 (error = iwn_auth(sc, vap)) != 0) { 8450 device_printf(sc->sc_dev, 8451 "%s: could not move to auth state\n", __func__); 8452 } 8453 if (vap->iv_state >= IEEE80211_S_RUN && 8454 (error = iwn_run(sc, vap)) != 0) { 8455 device_printf(sc->sc_dev, 8456 "%s: could not move to run state\n", __func__); 8457 } 8458} 8459 8460static void |
|
8415iwn_init_locked(struct iwn_softc *sc) 8416{ 8417 struct ifnet *ifp = sc->sc_ifp; 8418 int error; 8419 8420 DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__); 8421 8422 IWN_LOCK_ASSERT(sc); --- 290 unchanged lines hidden --- | 8461iwn_init_locked(struct iwn_softc *sc) 8462{ 8463 struct ifnet *ifp = sc->sc_ifp; 8464 int error; 8465 8466 DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__); 8467 8468 IWN_LOCK_ASSERT(sc); --- 290 unchanged lines hidden --- |