Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/iwm/if_iwm.c
Show First 20 Lines • Show All 4,086 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Process an IWM_CSR_INT_BIT_FH_RX or IWM_CSR_INT_BIT_SW_RX interrupt. | * Process an IWM_CSR_INT_BIT_FH_RX or IWM_CSR_INT_BIT_SW_RX interrupt. | ||||
* Basic structure from if_iwn | * Basic structure from if_iwn | ||||
*/ | */ | ||||
static void | static void | ||||
iwm_notif_intr(struct iwm_softc *sc) | iwm_notif_intr(struct iwm_softc *sc) | ||||
{ | { | ||||
struct ieee80211com *ic = &sc->sc_ic; | |||||
uint16_t hw; | uint16_t hw; | ||||
bus_dmamap_sync(sc->rxq.stat_dma.tag, sc->rxq.stat_dma.map, | bus_dmamap_sync(sc->rxq.stat_dma.tag, sc->rxq.stat_dma.map, | ||||
BUS_DMASYNC_POSTREAD); | BUS_DMASYNC_POSTREAD); | ||||
hw = le16toh(sc->rxq.stat->closed_rb_num) & 0xfff; | hw = le16toh(sc->rxq.stat->closed_rb_num) & 0xfff; | ||||
while (sc->rxq.cur != hw) { | while (sc->rxq.cur != hw) { | ||||
struct iwm_rx_ring *ring = &sc->rxq; | struct iwm_rx_ring *ring = &sc->rxq; | ||||
Show All 37 Lines | case IWM_TX_CMD: | ||||
iwm_mvm_rx_tx_cmd(sc, pkt, data); | iwm_mvm_rx_tx_cmd(sc, pkt, data); | ||||
break; | break; | ||||
case IWM_MISSED_BEACONS_NOTIFICATION: { | case IWM_MISSED_BEACONS_NOTIFICATION: { | ||||
struct iwm_missed_beacons_notif *resp; | struct iwm_missed_beacons_notif *resp; | ||||
int missed; | int missed; | ||||
/* XXX look at mac_id to determine interface ID */ | /* XXX look at mac_id to determine interface ID */ | ||||
struct ieee80211com *ic = &sc->sc_ic; | |||||
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); | struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); | ||||
SYNC_RESP_STRUCT(resp, pkt); | SYNC_RESP_STRUCT(resp, pkt); | ||||
missed = le32toh(resp->consec_missed_beacons); | missed = le32toh(resp->consec_missed_beacons); | ||||
IWM_DPRINTF(sc, IWM_DEBUG_BEACON | IWM_DEBUG_STATE, | IWM_DPRINTF(sc, IWM_DEBUG_BEACON | IWM_DEBUG_STATE, | ||||
"%s: MISSED_BEACON: mac_id=%d, " | "%s: MISSED_BEACON: mac_id=%d, " | ||||
"consec_since_last_rx=%d, consec=%d, num_expect=%d " | "consec_since_last_rx=%d, consec=%d, num_expect=%d " | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | while (sc->rxq.cur != hw) { | ||||
case IWM_INIT_COMPLETE_NOTIF: | case IWM_INIT_COMPLETE_NOTIF: | ||||
sc->sc_init_complete = 1; | sc->sc_init_complete = 1; | ||||
wakeup(&sc->sc_init_complete); | wakeup(&sc->sc_init_complete); | ||||
break; | break; | ||||
case IWM_SCAN_COMPLETE_NOTIFICATION: { | case IWM_SCAN_COMPLETE_NOTIFICATION: { | ||||
struct iwm_scan_complete_notif *notif; | struct iwm_scan_complete_notif *notif; | ||||
SYNC_RESP_STRUCT(notif, pkt); | SYNC_RESP_STRUCT(notif, pkt); | ||||
taskqueue_enqueue(sc->sc_tq, &sc->sc_es_task); | ieee80211_runtask(ic, &sc->sc_es_task); | ||||
break; } | break; } | ||||
case IWM_REPLY_ERROR: { | case IWM_REPLY_ERROR: { | ||||
struct iwm_error_resp *resp; | struct iwm_error_resp *resp; | ||||
SYNC_RESP_STRUCT(resp, pkt); | SYNC_RESP_STRUCT(resp, pkt); | ||||
device_printf(sc->sc_dev, | device_printf(sc->sc_dev, | ||||
"firmware error 0x%x, cmd 0x%x\n", | "firmware error 0x%x, cmd 0x%x\n", | ||||
▲ Show 20 Lines • Show All 357 Lines • ▼ Show 20 Lines | iwm_attach(device_t dev) | ||||
int txq_i, i; | int txq_i, i; | ||||
sc->sc_dev = dev; | sc->sc_dev = dev; | ||||
IWM_LOCK_INIT(sc); | IWM_LOCK_INIT(sc); | ||||
mbufq_init(&sc->sc_snd, ifqmaxlen); | mbufq_init(&sc->sc_snd, ifqmaxlen); | ||||
callout_init_mtx(&sc->sc_watchdog_to, &sc->sc_mtx, 0); | callout_init_mtx(&sc->sc_watchdog_to, &sc->sc_mtx, 0); | ||||
callout_init_mtx(&sc->sc_led_blink_to, &sc->sc_mtx, 0); | callout_init_mtx(&sc->sc_led_blink_to, &sc->sc_mtx, 0); | ||||
TASK_INIT(&sc->sc_es_task, 0, iwm_endscan_cb, sc); | TASK_INIT(&sc->sc_es_task, 0, iwm_endscan_cb, sc); | ||||
sc->sc_tq = taskqueue_create("iwm_taskq", M_WAITOK, | |||||
taskqueue_thread_enqueue, &sc->sc_tq); | |||||
error = taskqueue_start_threads(&sc->sc_tq, 1, 0, "iwm_taskq"); | |||||
if (error != 0) { | |||||
device_printf(dev, "can't start threads, error %d\n", | |||||
error); | |||||
goto fail; | |||||
} | |||||
/* PCI attach */ | /* PCI attach */ | ||||
error = iwm_pci_attach(dev); | error = iwm_pci_attach(dev); | ||||
if (error != 0) | if (error != 0) | ||||
goto fail; | goto fail; | ||||
sc->sc_wantresp = -1; | sc->sc_wantresp = -1; | ||||
▲ Show 20 Lines • Show All 364 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
iwm_detach_local(struct iwm_softc *sc, int do_net80211) | iwm_detach_local(struct iwm_softc *sc, int do_net80211) | ||||
{ | { | ||||
struct iwm_fw_info *fw = &sc->sc_fw; | struct iwm_fw_info *fw = &sc->sc_fw; | ||||
device_t dev = sc->sc_dev; | device_t dev = sc->sc_dev; | ||||
int i; | int i; | ||||
if (sc->sc_tq) { | ieee80211_draintask(&sc->sc_ic, &sc->sc_es_task); | ||||
taskqueue_drain_all(sc->sc_tq); | |||||
taskqueue_free(sc->sc_tq); | |||||
} | |||||
callout_drain(&sc->sc_led_blink_to); | callout_drain(&sc->sc_led_blink_to); | ||||
callout_drain(&sc->sc_watchdog_to); | callout_drain(&sc->sc_watchdog_to); | ||||
iwm_stop_device(sc); | iwm_stop_device(sc); | ||||
if (do_net80211) | if (do_net80211) | ||||
ieee80211_ifdetach(&sc->sc_ic); | ieee80211_ifdetach(&sc->sc_ic); | ||||
iwm_phy_db_free(sc); | iwm_phy_db_free(sc); | ||||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |