Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/wpi/if_wpi.c
Show First 20 Lines • Show All 2,175 Lines • ▼ Show 20 Lines | wpi_cmd_done(struct wpi_softc *sc, struct wpi_rx_desc *desc) | ||||
} | } | ||||
} | } | ||||
static void | static void | ||||
wpi_notif_intr(struct wpi_softc *sc) | wpi_notif_intr(struct wpi_softc *sc) | ||||
{ | { | ||||
struct ieee80211com *ic = &sc->sc_ic; | struct ieee80211com *ic = &sc->sc_ic; | ||||
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); | struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); | ||||
struct epoch_tracker et; | |||||
uint32_t hw; | uint32_t hw; | ||||
bus_dmamap_sync(sc->shared_dma.tag, sc->shared_dma.map, | bus_dmamap_sync(sc->shared_dma.tag, sc->shared_dma.map, | ||||
BUS_DMASYNC_POSTREAD); | BUS_DMASYNC_POSTREAD); | ||||
hw = le32toh(sc->shared->next) & 0xfff; | hw = le32toh(sc->shared->next) & 0xfff; | ||||
hw = (hw == 0) ? WPI_RX_RING_COUNT - 1 : hw - 1; | hw = (hw == 0) ? WPI_RX_RING_COUNT - 1 : hw - 1; | ||||
NET_EPOCH_ENTER(et); | |||||
while (sc->rxq.cur != hw) { | while (sc->rxq.cur != hw) { | ||||
sc->rxq.cur = (sc->rxq.cur + 1) % WPI_RX_RING_COUNT; | sc->rxq.cur = (sc->rxq.cur + 1) % WPI_RX_RING_COUNT; | ||||
struct wpi_rx_data *data = &sc->rxq.data[sc->rxq.cur]; | struct wpi_rx_data *data = &sc->rxq.data[sc->rxq.cur]; | ||||
struct wpi_rx_desc *desc; | struct wpi_rx_desc *desc; | ||||
bus_dmamap_sync(sc->rxq.data_dmat, data->map, | bus_dmamap_sync(sc->rxq.data_dmat, data->map, | ||||
BUS_DMASYNC_POSTREAD); | BUS_DMASYNC_POSTREAD); | ||||
Show All 11 Lines | while (sc->rxq.cur != hw) { | ||||
switch (desc->type) { | switch (desc->type) { | ||||
case WPI_RX_DONE: | case WPI_RX_DONE: | ||||
/* An 802.11 frame has been received. */ | /* An 802.11 frame has been received. */ | ||||
wpi_rx_done(sc, desc, data); | wpi_rx_done(sc, desc, data); | ||||
if (__predict_false(sc->sc_running == 0)) { | if (__predict_false(sc->sc_running == 0)) { | ||||
/* wpi_stop() was called. */ | /* wpi_stop() was called. */ | ||||
return; | goto done; | ||||
} | } | ||||
break; | break; | ||||
case WPI_TX_DONE: | case WPI_TX_DONE: | ||||
/* An 802.11 frame has been transmitted. */ | /* An 802.11 frame has been transmitted. */ | ||||
wpi_tx_done(sc, desc); | wpi_tx_done(sc, desc); | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | case WPI_UC_READY: | ||||
"microcode alive notification version=%d.%d " | "microcode alive notification version=%d.%d " | ||||
"subtype=%x alive=%x\n", uc->major, uc->minor, | "subtype=%x alive=%x\n", uc->major, uc->minor, | ||||
uc->subtype, le32toh(uc->valid)); | uc->subtype, le32toh(uc->valid)); | ||||
if (le32toh(uc->valid) != 1) { | if (le32toh(uc->valid) != 1) { | ||||
device_printf(sc->sc_dev, | device_printf(sc->sc_dev, | ||||
"microcontroller initialization failed\n"); | "microcontroller initialization failed\n"); | ||||
wpi_stop_locked(sc); | wpi_stop_locked(sc); | ||||
return; | goto done; | ||||
} | } | ||||
/* Save the address of the error log in SRAM. */ | /* Save the address of the error log in SRAM. */ | ||||
sc->errptr = le32toh(uc->errptr); | sc->errptr = le32toh(uc->errptr); | ||||
break; | break; | ||||
} | } | ||||
case WPI_STATE_CHANGED: | case WPI_STATE_CHANGED: | ||||
{ | { | ||||
bus_dmamap_sync(sc->rxq.data_dmat, data->map, | bus_dmamap_sync(sc->rxq.data_dmat, data->map, | ||||
BUS_DMASYNC_POSTREAD); | BUS_DMASYNC_POSTREAD); | ||||
uint32_t *status = (uint32_t *)(desc + 1); | uint32_t *status = (uint32_t *)(desc + 1); | ||||
DPRINTF(sc, WPI_DEBUG_STATE, "state changed to %x\n", | DPRINTF(sc, WPI_DEBUG_STATE, "state changed to %x\n", | ||||
le32toh(*status)); | le32toh(*status)); | ||||
if (le32toh(*status) & 1) { | if (le32toh(*status) & 1) { | ||||
WPI_NT_LOCK(sc); | WPI_NT_LOCK(sc); | ||||
wpi_clear_node_table(sc); | wpi_clear_node_table(sc); | ||||
WPI_NT_UNLOCK(sc); | WPI_NT_UNLOCK(sc); | ||||
ieee80211_runtask(ic, | ieee80211_runtask(ic, | ||||
&sc->sc_radiooff_task); | &sc->sc_radiooff_task); | ||||
return; | goto done; | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
#ifdef WPI_DEBUG | #ifdef WPI_DEBUG | ||||
case WPI_START_SCAN: | case WPI_START_SCAN: | ||||
{ | { | ||||
bus_dmamap_sync(sc->rxq.data_dmat, data->map, | bus_dmamap_sync(sc->rxq.data_dmat, data->map, | ||||
BUS_DMASYNC_POSTREAD); | BUS_DMASYNC_POSTREAD); | ||||
Show All 30 Lines | #endif | ||||
} | } | ||||
} | } | ||||
if (sc->rxq.cur % 8 == 0) { | if (sc->rxq.cur % 8 == 0) { | ||||
/* Tell the firmware what we have processed. */ | /* Tell the firmware what we have processed. */ | ||||
sc->sc_update_rx_ring(sc); | sc->sc_update_rx_ring(sc); | ||||
} | } | ||||
} | } | ||||
done: | |||||
NET_EPOCH_EXIT(et); | |||||
} | } | ||||
/* | /* | ||||
* Process an INT_WAKEUP interrupt raised when the microcontroller wakes up | * Process an INT_WAKEUP interrupt raised when the microcontroller wakes up | ||||
* from power-down sleep mode. | * from power-down sleep mode. | ||||
*/ | */ | ||||
static void | static void | ||||
wpi_wakeup_intr(struct wpi_softc *sc) | wpi_wakeup_intr(struct wpi_softc *sc) | ||||
▲ Show 20 Lines • Show All 3,267 Lines • Show Last 20 Lines |