Lines Matching +full:timeout +full:- +full:tap +full:- +full:ms

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2004-2006
33 /*-
202 nitems(ipw_ident_table) - 1);
211 for (ident = ipw_ident_table; ident->name != NULL; ident++) { in ipw_probe()
212 if (pci_get_vendor(dev) == ident->vendor && in ipw_probe()
213 pci_get_device(dev) == ident->device) { in ipw_probe()
214 device_set_desc(dev, ident->name); in ipw_probe()
226 struct ieee80211com *ic = &sc->sc_ic; in ipw_attach()
230 sc->sc_dev = dev; in ipw_attach()
232 mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, in ipw_attach()
234 mbufq_init(&sc->sc_snd, ifqmaxlen); in ipw_attach()
235 TASK_INIT(&sc->sc_init_task, 0, ipw_init_task, sc); in ipw_attach()
236 callout_init_mtx(&sc->sc_wdtimer, &sc->sc_mtx, 0); in ipw_attach()
240 /* enable bus-mastering */ in ipw_attach()
244 sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &i, RF_ACTIVE); in ipw_attach()
245 if (sc->mem == NULL) { in ipw_attach()
250 sc->sc_st = rman_get_bustag(sc->mem); in ipw_attach()
251 sc->sc_sh = rman_get_bushandle(sc->mem); in ipw_attach()
254 sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i, in ipw_attach()
256 if (sc->irq == NULL) { in ipw_attach()
271 ic->ic_softc = sc; in ipw_attach()
272 ic->ic_name = device_get_nameunit(dev); in ipw_attach()
273 ic->ic_opmode = IEEE80211_M_STA; in ipw_attach()
274 ic->ic_phytype = IEEE80211_T_DS; in ipw_attach()
277 ic->ic_caps = in ipw_attach()
286 ic->ic_flags_ext |= IEEE80211_FEXT_SEQNO_OFFLOAD; in ipw_attach()
290 ic->ic_macaddr[0] = val >> 8; in ipw_attach()
291 ic->ic_macaddr[1] = val & 0xff; in ipw_attach()
293 ic->ic_macaddr[2] = val >> 8; in ipw_attach()
294 ic->ic_macaddr[3] = val & 0xff; in ipw_attach()
296 ic->ic_macaddr[4] = val >> 8; in ipw_attach()
297 ic->ic_macaddr[5] = val & 0xff; in ipw_attach()
299 sc->chanmask = ipw_read_chanmask(sc); in ipw_attach()
300 ipw_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, in ipw_attach()
301 ic->ic_channels); in ipw_attach()
305 sc->flags |= IPW_FLAG_HAS_RADIO_SWITCH; in ipw_attach()
308 ic->ic_scan_start = ipw_scan_start; in ipw_attach()
309 ic->ic_scan_end = ipw_scan_end; in ipw_attach()
310 ic->ic_getradiocaps = ipw_getradiocaps; in ipw_attach()
311 ic->ic_set_channel = ipw_set_channel; in ipw_attach()
312 ic->ic_scan_curchan = ipw_scan_curchan; in ipw_attach()
313 ic->ic_scan_mindwell = ipw_scan_mindwell; in ipw_attach()
314 ic->ic_raw_xmit = ipw_raw_xmit; in ipw_attach()
315 ic->ic_vap_create = ipw_vap_create; in ipw_attach()
316 ic->ic_vap_delete = ipw_vap_delete; in ipw_attach()
317 ic->ic_transmit = ipw_transmit; in ipw_attach()
318 ic->ic_parent = ipw_parent; in ipw_attach()
321 &sc->sc_txtap.wt_ihdr, sizeof(sc->sc_txtap), in ipw_attach()
323 &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap), in ipw_attach()
343 error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, in ipw_attach()
344 NULL, ipw_intr, sc, &sc->sc_ih); in ipw_attach()
357 bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq), sc->irq); in ipw_attach()
359 bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(sc->mem), in ipw_attach()
360 sc->mem); in ipw_attach()
362 mtx_destroy(&sc->sc_mtx); in ipw_attach()
370 struct ieee80211com *ic = &sc->sc_ic; in ipw_detach()
372 bus_teardown_intr(dev, sc->irq, sc->sc_ih); in ipw_detach()
374 ieee80211_draintask(ic, &sc->sc_init_task); in ipw_detach()
379 callout_drain(&sc->sc_wdtimer); in ipw_detach()
380 mbufq_drain(&sc->sc_snd); in ipw_detach()
384 bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq), sc->irq); in ipw_detach()
386 bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(sc->mem), in ipw_detach()
387 sc->mem); in ipw_detach()
389 if (sc->sc_firmware != NULL) { in ipw_detach()
390 firmware_put(sc->sc_firmware, FIRMWARE_UNLOAD); in ipw_detach()
391 sc->sc_firmware = NULL; in ipw_detach()
394 mtx_destroy(&sc->sc_mtx); in ipw_detach()
405 struct ipw_softc *sc = ic->ic_softc; in ipw_vap_create()
412 if (!TAILQ_EMPTY(&ic->ic_vaps)) /* only one at a time */ in ipw_vap_create()
431 * this unlocked is ok since we're single-threaded by the in ipw_vap_create()
434 if (sc->sc_firmware == NULL || in ipw_vap_create()
435 strcmp(sc->sc_firmware->name, imagename) != 0) { in ipw_vap_create()
436 if (sc->sc_firmware != NULL) in ipw_vap_create()
437 firmware_put(sc->sc_firmware, FIRMWARE_UNLOAD); in ipw_vap_create()
438 sc->sc_firmware = firmware_get(imagename); in ipw_vap_create()
440 if (sc->sc_firmware == NULL) { in ipw_vap_create()
441 device_printf(sc->sc_dev, in ipw_vap_create()
445 fp = sc->sc_firmware; in ipw_vap_create()
446 if (fp->datasize < sizeof *hdr) { in ipw_vap_create()
447 device_printf(sc->sc_dev, in ipw_vap_create()
448 "firmware image too short %zu\n", fp->datasize); in ipw_vap_create()
449 firmware_put(sc->sc_firmware, FIRMWARE_UNLOAD); in ipw_vap_create()
450 sc->sc_firmware = NULL; in ipw_vap_create()
453 hdr = (const struct ipw_firmware_hdr *)fp->data; in ipw_vap_create()
454 if (fp->datasize < sizeof *hdr + le32toh(hdr->mainsz) + in ipw_vap_create()
455 le32toh(hdr->ucodesz)) { in ipw_vap_create()
456 device_printf(sc->sc_dev, in ipw_vap_create()
457 "firmware image too short %zu\n", fp->datasize); in ipw_vap_create()
458 firmware_put(sc->sc_firmware, FIRMWARE_UNLOAD); in ipw_vap_create()
459 sc->sc_firmware = NULL; in ipw_vap_create()
464 vap = &ivp->vap; in ipw_vap_create()
468 ivp->newstate = vap->iv_newstate; in ipw_vap_create()
469 vap->iv_newstate = ipw_newstate; in ipw_vap_create()
474 ic->ic_opmode = opmode; in ipw_vap_create()
499 error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, in ipw_dma_alloc()
502 BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, &sc->parent_dmat); in ipw_dma_alloc()
504 device_printf(sc->sc_dev, "could not create parent DMA tag\n"); in ipw_dma_alloc()
511 error = bus_dma_tag_create(sc->parent_dmat, 4, 0, BUS_SPACE_MAXADDR_32BIT, in ipw_dma_alloc()
513 NULL, &sc->tbd_dmat); in ipw_dma_alloc()
515 device_printf(sc->sc_dev, "could not create tx ring DMA tag\n"); in ipw_dma_alloc()
519 error = bus_dmamem_alloc(sc->tbd_dmat, (void **)&sc->tbd_list, in ipw_dma_alloc()
520 BUS_DMA_NOWAIT | BUS_DMA_ZERO, &sc->tbd_map); in ipw_dma_alloc()
522 device_printf(sc->sc_dev, in ipw_dma_alloc()
527 error = bus_dmamap_load(sc->tbd_dmat, sc->tbd_map, sc->tbd_list, in ipw_dma_alloc()
528 IPW_TBD_SZ, ipw_dma_map_addr, &sc->tbd_phys, 0); in ipw_dma_alloc()
530 device_printf(sc->sc_dev, "could not map tx ring DMA memory\n"); in ipw_dma_alloc()
537 error = bus_dma_tag_create(sc->parent_dmat, 4, 0, BUS_SPACE_MAXADDR_32BIT, in ipw_dma_alloc()
539 NULL, &sc->rbd_dmat); in ipw_dma_alloc()
541 device_printf(sc->sc_dev, "could not create rx ring DMA tag\n"); in ipw_dma_alloc()
545 error = bus_dmamem_alloc(sc->rbd_dmat, (void **)&sc->rbd_list, in ipw_dma_alloc()
546 BUS_DMA_NOWAIT | BUS_DMA_ZERO, &sc->rbd_map); in ipw_dma_alloc()
548 device_printf(sc->sc_dev, in ipw_dma_alloc()
553 error = bus_dmamap_load(sc->rbd_dmat, sc->rbd_map, sc->rbd_list, in ipw_dma_alloc()
554 IPW_RBD_SZ, ipw_dma_map_addr, &sc->rbd_phys, 0); in ipw_dma_alloc()
556 device_printf(sc->sc_dev, "could not map rx ring DMA memory\n"); in ipw_dma_alloc()
563 error = bus_dma_tag_create(sc->parent_dmat, 4, 0, BUS_SPACE_MAXADDR_32BIT, in ipw_dma_alloc()
565 NULL, NULL, &sc->status_dmat); in ipw_dma_alloc()
567 device_printf(sc->sc_dev, in ipw_dma_alloc()
572 error = bus_dmamem_alloc(sc->status_dmat, (void **)&sc->status_list, in ipw_dma_alloc()
573 BUS_DMA_NOWAIT | BUS_DMA_ZERO, &sc->status_map); in ipw_dma_alloc()
575 device_printf(sc->sc_dev, in ipw_dma_alloc()
580 error = bus_dmamap_load(sc->status_dmat, sc->status_map, in ipw_dma_alloc()
581 sc->status_list, IPW_STATUS_SZ, ipw_dma_map_addr, &sc->status_phys, in ipw_dma_alloc()
584 device_printf(sc->sc_dev, in ipw_dma_alloc()
592 error = bus_dma_tag_create(sc->parent_dmat, 1, 0, BUS_SPACE_MAXADDR_32BIT, in ipw_dma_alloc()
594 sizeof (struct ipw_cmd), 0, NULL, NULL, &sc->cmd_dmat); in ipw_dma_alloc()
596 device_printf(sc->sc_dev, "could not create command DMA tag\n"); in ipw_dma_alloc()
600 error = bus_dmamap_create(sc->cmd_dmat, 0, &sc->cmd_map); in ipw_dma_alloc()
602 device_printf(sc->sc_dev, in ipw_dma_alloc()
610 error = bus_dma_tag_create(sc->parent_dmat, 1, 0, BUS_SPACE_MAXADDR_32BIT, in ipw_dma_alloc()
612 sizeof (struct ipw_hdr), 0, NULL, NULL, &sc->hdr_dmat); in ipw_dma_alloc()
614 device_printf(sc->sc_dev, "could not create header DMA tag\n"); in ipw_dma_alloc()
618 SLIST_INIT(&sc->free_shdr); in ipw_dma_alloc()
620 shdr = &sc->shdr_list[i]; in ipw_dma_alloc()
621 error = bus_dmamap_create(sc->hdr_dmat, 0, &shdr->map); in ipw_dma_alloc()
623 device_printf(sc->sc_dev, in ipw_dma_alloc()
627 SLIST_INSERT_HEAD(&sc->free_shdr, shdr, next); in ipw_dma_alloc()
633 error = bus_dma_tag_create(sc->parent_dmat, 1, 0, BUS_SPACE_MAXADDR_32BIT, in ipw_dma_alloc()
635 NULL, NULL, &sc->txbuf_dmat); in ipw_dma_alloc()
637 device_printf(sc->sc_dev, "could not create tx DMA tag\n"); in ipw_dma_alloc()
641 SLIST_INIT(&sc->free_sbuf); in ipw_dma_alloc()
643 sbuf = &sc->tx_sbuf_list[i]; in ipw_dma_alloc()
644 error = bus_dmamap_create(sc->txbuf_dmat, 0, &sbuf->map); in ipw_dma_alloc()
646 device_printf(sc->sc_dev, in ipw_dma_alloc()
650 SLIST_INSERT_HEAD(&sc->free_sbuf, sbuf, next); in ipw_dma_alloc()
657 sbd = &sc->stbd_list[i]; in ipw_dma_alloc()
658 sbd->bd = &sc->tbd_list[i]; in ipw_dma_alloc()
659 sbd->type = IPW_SBD_TYPE_NOASSOC; in ipw_dma_alloc()
663 * Pre-allocate rx buffers and DMA maps. in ipw_dma_alloc()
665 error = bus_dma_tag_create(sc->parent_dmat, 1, 0, BUS_SPACE_MAXADDR_32BIT, in ipw_dma_alloc()
667 NULL, &sc->rxbuf_dmat); in ipw_dma_alloc()
669 device_printf(sc->sc_dev, "could not create rx DMA tag\n"); in ipw_dma_alloc()
674 sbd = &sc->srbd_list[i]; in ipw_dma_alloc()
675 sbuf = &sc->rx_sbuf_list[i]; in ipw_dma_alloc()
676 sbd->bd = &sc->rbd_list[i]; in ipw_dma_alloc()
678 sbuf->m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); in ipw_dma_alloc()
679 if (sbuf->m == NULL) { in ipw_dma_alloc()
680 device_printf(sc->sc_dev, in ipw_dma_alloc()
686 error = bus_dmamap_create(sc->rxbuf_dmat, 0, &sbuf->map); in ipw_dma_alloc()
688 device_printf(sc->sc_dev, in ipw_dma_alloc()
693 error = bus_dmamap_load(sc->rxbuf_dmat, sbuf->map, in ipw_dma_alloc()
694 mtod(sbuf->m, void *), MCLBYTES, ipw_dma_map_addr, in ipw_dma_alloc()
697 device_printf(sc->sc_dev, in ipw_dma_alloc()
702 sbd->type = IPW_SBD_TYPE_DATA; in ipw_dma_alloc()
703 sbd->priv = sbuf; in ipw_dma_alloc()
704 sbd->bd->physaddr = htole32(physaddr); in ipw_dma_alloc()
705 sbd->bd->len = htole32(MCLBYTES); in ipw_dma_alloc()
708 bus_dmamap_sync(sc->rbd_dmat, sc->rbd_map, BUS_DMASYNC_PREWRITE); in ipw_dma_alloc()
722 if (sc->parent_dmat != NULL) { in ipw_release()
723 bus_dma_tag_destroy(sc->parent_dmat); in ipw_release()
726 if (sc->tbd_dmat != NULL) { in ipw_release()
727 bus_dmamap_unload(sc->tbd_dmat, sc->tbd_map); in ipw_release()
728 bus_dmamem_free(sc->tbd_dmat, sc->tbd_list, sc->tbd_map); in ipw_release()
729 bus_dma_tag_destroy(sc->tbd_dmat); in ipw_release()
732 if (sc->rbd_dmat != NULL) { in ipw_release()
733 if (sc->rbd_list != NULL) { in ipw_release()
734 bus_dmamap_unload(sc->rbd_dmat, sc->rbd_map); in ipw_release()
735 bus_dmamem_free(sc->rbd_dmat, sc->rbd_list, in ipw_release()
736 sc->rbd_map); in ipw_release()
738 bus_dma_tag_destroy(sc->rbd_dmat); in ipw_release()
741 if (sc->status_dmat != NULL) { in ipw_release()
742 if (sc->status_list != NULL) { in ipw_release()
743 bus_dmamap_unload(sc->status_dmat, sc->status_map); in ipw_release()
744 bus_dmamem_free(sc->status_dmat, sc->status_list, in ipw_release()
745 sc->status_map); in ipw_release()
747 bus_dma_tag_destroy(sc->status_dmat); in ipw_release()
751 ipw_release_sbd(sc, &sc->stbd_list[i]); in ipw_release()
753 if (sc->cmd_dmat != NULL) { in ipw_release()
754 bus_dmamap_destroy(sc->cmd_dmat, sc->cmd_map); in ipw_release()
755 bus_dma_tag_destroy(sc->cmd_dmat); in ipw_release()
758 if (sc->hdr_dmat != NULL) { in ipw_release()
760 bus_dmamap_destroy(sc->hdr_dmat, sc->shdr_list[i].map); in ipw_release()
761 bus_dma_tag_destroy(sc->hdr_dmat); in ipw_release()
764 if (sc->txbuf_dmat != NULL) { in ipw_release()
766 bus_dmamap_destroy(sc->txbuf_dmat, in ipw_release()
767 sc->tx_sbuf_list[i].map); in ipw_release()
769 bus_dma_tag_destroy(sc->txbuf_dmat); in ipw_release()
772 if (sc->rxbuf_dmat != NULL) { in ipw_release()
774 sbuf = &sc->rx_sbuf_list[i]; in ipw_release()
775 if (sbuf->m != NULL) { in ipw_release()
776 bus_dmamap_sync(sc->rxbuf_dmat, sbuf->map, in ipw_release()
778 bus_dmamap_unload(sc->rxbuf_dmat, sbuf->map); in ipw_release()
779 m_freem(sbuf->m); in ipw_release()
781 bus_dmamap_destroy(sc->rxbuf_dmat, sbuf->map); in ipw_release()
783 bus_dma_tag_destroy(sc->rxbuf_dmat); in ipw_release()
801 struct ieee80211com *ic = &sc->sc_ic; in ipw_suspend()
811 struct ieee80211com *ic = &sc->sc_ic; in ipw_resume()
839 struct ieee80211com *ic = vap->iv_ic; in ipw_media_status()
840 struct ipw_softc *sc = ic->ic_softc; in ipw_media_status()
843 ieee80211_node_set_txrate_dot11rate(vap->iv_bss, in ipw_media_status()
852 struct ieee80211com *ic = vap->iv_ic; in ipw_newstate()
853 struct ipw_softc *sc = ic->ic_softc; in ipw_newstate()
856 DPRINTF(("%s: %s -> %s flags 0x%x\n", __func__, in ipw_newstate()
857 ieee80211_state_name[vap->iv_state], in ipw_newstate()
858 ieee80211_state_name[nstate], sc->flags)); in ipw_newstate()
860 ostate = vap->iv_state; in ipw_newstate()
865 if (ic->ic_opmode == IEEE80211_M_IBSS) { in ipw_newstate()
868 * with a SCAN -> RUN transition on scan complete. in ipw_newstate()
870 * join we are then called again with an AUTH -> RUN in ipw_newstate()
880 if (sc->flags & IPW_FLAG_ASSOCIATED) in ipw_newstate()
908 return ivp->newstate(vap, nstate, arg); in ipw_newstate()
937 /* write address A7-A0 */ in ipw_read_prom_word()
938 for (n = 7; n >= 0; n--) { in ipw_read_prom_word()
947 /* read data Q15-Q0 */ in ipw_read_prom_word()
949 for (n = 15; n >= 0; n--) { in ipw_read_prom_word()
973 val = 0x7ff; /* default to channels 1-11 */ in ipw_read_chanmask()
984 bus_dmamap_sync(sc->rxbuf_dmat, sbuf->map, BUS_DMASYNC_POSTREAD); in ipw_rx_cmd_intr()
986 cmd = mtod(sbuf->m, struct ipw_cmd *); in ipw_rx_cmd_intr()
989 ipw_cmdname(le32toh(cmd->type)), le32toh(cmd->type), in ipw_rx_cmd_intr()
990 le32toh(cmd->subtype), le32toh(cmd->seq), le32toh(cmd->len), in ipw_rx_cmd_intr()
991 le32toh(cmd->status))); in ipw_rx_cmd_intr()
993 sc->flags &= ~IPW_FLAG_BUSY; in ipw_rx_cmd_intr()
1000 #define IEEESTATE(vap) ieee80211_state_name[vap->iv_state] in ipw_rx_newstate_intr()
1001 struct ieee80211com *ic = &sc->sc_ic; in ipw_rx_newstate_intr()
1002 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); in ipw_rx_newstate_intr()
1005 bus_dmamap_sync(sc->rxbuf_dmat, sbuf->map, BUS_DMASYNC_POSTREAD); in ipw_rx_newstate_intr()
1007 state = le32toh(*mtod(sbuf->m, uint32_t *)); in ipw_rx_newstate_intr()
1012 IEEESTATE(vap), sc->flags)); in ipw_rx_newstate_intr()
1013 /* XXX suppress state change in case the fw auto-associates */ in ipw_rx_newstate_intr()
1014 if ((sc->flags & IPW_FLAG_ASSOCIATING) == 0) { in ipw_rx_newstate_intr()
1016 IEEESTATE(vap), sc->flags)); in ipw_rx_newstate_intr()
1019 sc->flags &= ~IPW_FLAG_ASSOCIATING; in ipw_rx_newstate_intr()
1020 sc->flags |= IPW_FLAG_ASSOCIATED; in ipw_rx_newstate_intr()
1025 IEEESTATE(vap), sc->flags)); in ipw_rx_newstate_intr()
1032 if (sc->flags & IPW_FLAG_ASSOCIATED) { in ipw_rx_newstate_intr()
1049 IEEESTATE(vap), sc->flags)); in ipw_rx_newstate_intr()
1050 if (sc->flags & IPW_FLAG_HACK) { in ipw_rx_newstate_intr()
1051 sc->flags &= ~IPW_FLAG_HACK; in ipw_rx_newstate_intr()
1054 if (sc->flags & IPW_FLAG_SCANNING) { in ipw_rx_newstate_intr()
1058 sc->flags &= ~IPW_FLAG_SCANNING; in ipw_rx_newstate_intr()
1059 sc->sc_scan_timer = 0; in ipw_rx_newstate_intr()
1065 IEEESTATE(vap), sc->flags)); in ipw_rx_newstate_intr()
1066 sc->flags &= ~(IPW_FLAG_ASSOCIATING | IPW_FLAG_ASSOCIATED); in ipw_rx_newstate_intr()
1067 if (vap->iv_state == IEEE80211_S_RUN) { in ipw_rx_newstate_intr()
1069 ieee80211_new_state(vap, IEEE80211_S_SCAN, -1); in ipw_rx_newstate_intr()
1076 sc->flags &= ~(IPW_FLAG_HACK | IPW_FLAG_SCANNING | in ipw_rx_newstate_intr()
1079 IEEESTATE(vap), sc->flags)); in ipw_rx_newstate_intr()
1083 device_printf(sc->sc_dev, "radio turned off\n"); in ipw_rx_newstate_intr()
1091 __func__, state, IEEESTATE(vap), sc->flags)); in ipw_rx_newstate_intr()
1103 struct ieee80211com *ic = &sc->sc_ic; in ipw_setcurchan()
1105 ic->ic_curchan = chan; in ipw_setcurchan()
1116 struct ieee80211com *ic = &sc->sc_ic; in ipw_fix_channel()
1127 subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; in ipw_fix_channel()
1135 efrm = mtod(m, uint8_t *) + m->m_len; in ipw_fix_channel()
1149 c = &ic->ic_channels[0]; in ipw_fix_channel()
1161 struct ieee80211com *ic = &sc->sc_ic; in ipw_rx_data_intr()
1168 DPRINTFN(5, ("received frame len=%u, rssi=%u\n", le32toh(status->len), in ipw_rx_data_intr()
1169 status->rssi)); in ipw_rx_data_intr()
1171 if (le32toh(status->len) < sizeof (struct ieee80211_frame_min) || in ipw_rx_data_intr()
1172 le32toh(status->len) > MCLBYTES) in ipw_rx_data_intr()
1183 counter_u64_add(ic->ic_ierrors, 1); in ipw_rx_data_intr()
1187 bus_dmamap_sync(sc->rxbuf_dmat, sbuf->map, BUS_DMASYNC_POSTREAD); in ipw_rx_data_intr()
1188 bus_dmamap_unload(sc->rxbuf_dmat, sbuf->map); in ipw_rx_data_intr()
1190 error = bus_dmamap_load(sc->rxbuf_dmat, sbuf->map, mtod(mnew, void *), in ipw_rx_data_intr()
1196 error = bus_dmamap_load(sc->rxbuf_dmat, sbuf->map, in ipw_rx_data_intr()
1197 mtod(sbuf->m, void *), MCLBYTES, ipw_dma_map_addr, in ipw_rx_data_intr()
1202 device_get_name(sc->sc_dev)); in ipw_rx_data_intr()
1204 counter_u64_add(ic->ic_ierrors, 1); in ipw_rx_data_intr()
1212 m = sbuf->m; in ipw_rx_data_intr()
1213 sbuf->m = mnew; in ipw_rx_data_intr()
1214 sbd->bd->physaddr = htole32(physaddr); in ipw_rx_data_intr()
1215 m->m_pkthdr.len = m->m_len = le32toh(status->len); in ipw_rx_data_intr()
1217 rssi = status->rssi + IPW_RSSI_TO_DBM; in ipw_rx_data_intr()
1218 nf = -95; in ipw_rx_data_intr()
1220 struct ipw_rx_radiotap_header *tap = &sc->sc_rxtap; in ipw_rx_data_intr() local
1222 tap->wr_flags = 0; in ipw_rx_data_intr()
1223 tap->wr_antsignal = rssi; in ipw_rx_data_intr()
1224 tap->wr_antnoise = nf; in ipw_rx_data_intr()
1227 if (sc->flags & IPW_FLAG_SCANNING) in ipw_rx_data_intr()
1233 (void) ieee80211_input(ni, m, rssi - nf, nf); in ipw_rx_data_intr()
1236 (void) ieee80211_input_all(ic, m, rssi - nf, nf); in ipw_rx_data_intr()
1239 bus_dmamap_sync(sc->rbd_dmat, sc->rbd_map, BUS_DMASYNC_PREWRITE); in ipw_rx_data_intr()
1250 if (!(sc->flags & IPW_FLAG_FW_INITED)) in ipw_rx_intr()
1255 bus_dmamap_sync(sc->status_dmat, sc->status_map, BUS_DMASYNC_POSTREAD); in ipw_rx_intr()
1257 for (i = (sc->rxcur + 1) % IPW_NRBD; i != r; i = (i + 1) % IPW_NRBD) { in ipw_rx_intr()
1258 status = &sc->status_list[i]; in ipw_rx_intr()
1259 sbd = &sc->srbd_list[i]; in ipw_rx_intr()
1260 sbuf = sbd->priv; in ipw_rx_intr()
1262 switch (le16toh(status->code) & 0xf) { in ipw_rx_intr()
1278 le32toh(status->len), status->flags)); in ipw_rx_intr()
1279 /* XXX maybe drive state machine AUTH->ASSOC? */ in ipw_rx_intr()
1283 device_printf(sc->sc_dev, "unexpected status code %u\n", in ipw_rx_intr()
1284 le16toh(status->code)); in ipw_rx_intr()
1288 if (!(sc->flags & IPW_FLAG_FW_INITED)) in ipw_rx_intr()
1291 sbd->bd->flags = 0; in ipw_rx_intr()
1294 bus_dmamap_sync(sc->rbd_dmat, sc->rbd_map, BUS_DMASYNC_PREWRITE); in ipw_rx_intr()
1297 sc->rxcur = (r == 0) ? IPW_NRBD - 1 : r - 1; in ipw_rx_intr()
1298 CSR_WRITE_4(sc, IPW_CSR_RX_WRITE, sc->rxcur); in ipw_rx_intr()
1307 switch (sbd->type) { in ipw_release_sbd()
1309 bus_dmamap_sync(sc->cmd_dmat, sc->cmd_map, in ipw_release_sbd()
1311 bus_dmamap_unload(sc->cmd_dmat, sc->cmd_map); in ipw_release_sbd()
1315 shdr = sbd->priv; in ipw_release_sbd()
1316 bus_dmamap_sync(sc->hdr_dmat, shdr->map, BUS_DMASYNC_POSTWRITE); in ipw_release_sbd()
1317 bus_dmamap_unload(sc->hdr_dmat, shdr->map); in ipw_release_sbd()
1318 SLIST_INSERT_HEAD(&sc->free_shdr, shdr, next); in ipw_release_sbd()
1322 sbuf = sbd->priv; in ipw_release_sbd()
1323 bus_dmamap_sync(sc->txbuf_dmat, sbuf->map, in ipw_release_sbd()
1325 bus_dmamap_unload(sc->txbuf_dmat, sbuf->map); in ipw_release_sbd()
1326 SLIST_INSERT_HEAD(&sc->free_sbuf, sbuf, next); in ipw_release_sbd()
1328 ieee80211_tx_complete(sbuf->ni, sbuf->m, 0/*XXX*/); in ipw_release_sbd()
1330 sc->sc_tx_timer = 0; in ipw_release_sbd()
1334 sbd->type = IPW_SBD_TYPE_NOASSOC; in ipw_release_sbd()
1343 if (!(sc->flags & IPW_FLAG_FW_INITED)) in ipw_tx_intr()
1348 for (i = (sc->txold + 1) % IPW_NTBD; i != r; i = (i + 1) % IPW_NTBD) { in ipw_tx_intr()
1349 sbd = &sc->stbd_list[i]; in ipw_tx_intr()
1351 sc->txfree++; in ipw_tx_intr()
1355 sc->txold = (r == 0) ? IPW_NTBD - 1 : r - 1; in ipw_tx_intr()
1363 struct ieee80211com *ic = &sc->sc_ic; in ipw_fatal_error_intr()
1364 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); in ipw_fatal_error_intr()
1366 device_printf(sc->sc_dev, "firmware error\n"); in ipw_fatal_error_intr()
1372 ieee80211_runtask(ic, &sc->sc_init_task); in ipw_fatal_error_intr()
1407 /* re-enable interrupts */ in ipw_intr()
1482 if (sc->flags & IPW_FLAG_BUSY) { in ipw_cmd()
1483 device_printf(sc->sc_dev, "%s: %s not sent, busy\n", in ipw_cmd()
1487 sc->flags |= IPW_FLAG_BUSY; in ipw_cmd()
1489 sbd = &sc->stbd_list[sc->txcur]; in ipw_cmd()
1491 error = bus_dmamap_load(sc->cmd_dmat, sc->cmd_map, &sc->cmd, in ipw_cmd()
1494 device_printf(sc->sc_dev, "could not map command DMA memory\n"); in ipw_cmd()
1495 sc->flags &= ~IPW_FLAG_BUSY; in ipw_cmd()
1499 sc->cmd.type = htole32(type); in ipw_cmd()
1500 sc->cmd.subtype = 0; in ipw_cmd()
1501 sc->cmd.len = htole32(len); in ipw_cmd()
1502 sc->cmd.seq = 0; in ipw_cmd()
1503 memcpy(sc->cmd.data, data, len); in ipw_cmd()
1505 sbd->type = IPW_SBD_TYPE_COMMAND; in ipw_cmd()
1506 sbd->bd->physaddr = htole32(physaddr); in ipw_cmd()
1507 sbd->bd->len = htole32(sizeof (struct ipw_cmd)); in ipw_cmd()
1508 sbd->bd->nfrag = 1; in ipw_cmd()
1509 sbd->bd->flags = IPW_BD_FLAG_TX_FRAME_COMMAND | in ipw_cmd()
1512 bus_dmamap_sync(sc->cmd_dmat, sc->cmd_map, BUS_DMASYNC_PREWRITE); in ipw_cmd()
1513 bus_dmamap_sync(sc->tbd_dmat, sc->tbd_map, BUS_DMASYNC_PREWRITE); in ipw_cmd()
1523 printf("%1D", (u_char *)data + len - i, ""); in ipw_cmd()
1530 sc->txfree--; in ipw_cmd()
1531 sc->txcur = (sc->txcur + 1) % IPW_NTBD; in ipw_cmd()
1532 CSR_WRITE_4(sc, IPW_CSR_TX_WRITE, sc->txcur); in ipw_cmd()
1535 error = msleep(sc, &sc->sc_mtx, 0, "ipwcmd", hz); in ipw_cmd()
1537 device_printf(sc->sc_dev, "%s: %s failed, timeout (error %u)\n", in ipw_cmd()
1539 sc->flags &= ~IPW_FLAG_BUSY; in ipw_cmd()
1548 struct ieee80211com *ic = &sc->sc_ic; in ipw_tx_start()
1549 struct ieee80211vap *vap = ni->ni_vap; in ipw_tx_start()
1562 ieee80211_output_seqno_assign(ni, -1, m0); in ipw_tx_start()
1563 if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { in ipw_tx_start()
1574 struct ipw_tx_radiotap_header *tap = &sc->sc_txtap; in ipw_tx_start() local
1576 tap->wt_flags = 0; in ipw_tx_start()
1581 shdr = SLIST_FIRST(&sc->free_shdr); in ipw_tx_start()
1582 sbuf = SLIST_FIRST(&sc->free_sbuf); in ipw_tx_start()
1585 shdr->hdr.type = htole32(IPW_HDR_TYPE_SEND); in ipw_tx_start()
1586 shdr->hdr.subtype = 0; in ipw_tx_start()
1587 shdr->hdr.encrypted = (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) ? 1 : 0; in ipw_tx_start()
1588 shdr->hdr.encrypt = 0; in ipw_tx_start()
1589 shdr->hdr.keyidx = 0; in ipw_tx_start()
1590 shdr->hdr.keysz = 0; in ipw_tx_start()
1591 shdr->hdr.fragmentsz = 0; in ipw_tx_start()
1592 IEEE80211_ADDR_COPY(shdr->hdr.src_addr, wh->i_addr2); in ipw_tx_start()
1593 if (ic->ic_opmode == IEEE80211_M_STA) in ipw_tx_start()
1594 IEEE80211_ADDR_COPY(shdr->hdr.dst_addr, wh->i_addr3); in ipw_tx_start()
1596 IEEE80211_ADDR_COPY(shdr->hdr.dst_addr, wh->i_addr1); in ipw_tx_start()
1601 error = bus_dmamap_load_mbuf_sg(sc->txbuf_dmat, sbuf->map, m0, segs, in ipw_tx_start()
1604 device_printf(sc->sc_dev, "could not map mbuf (error %d)\n", in ipw_tx_start()
1612 device_printf(sc->sc_dev, in ipw_tx_start()
1619 error = bus_dmamap_load_mbuf_sg(sc->txbuf_dmat, sbuf->map, m0, in ipw_tx_start()
1622 device_printf(sc->sc_dev, in ipw_tx_start()
1629 error = bus_dmamap_load(sc->hdr_dmat, shdr->map, &shdr->hdr, in ipw_tx_start()
1632 device_printf(sc->sc_dev, "could not map header DMA memory\n"); in ipw_tx_start()
1633 bus_dmamap_unload(sc->txbuf_dmat, sbuf->map); in ipw_tx_start()
1638 SLIST_REMOVE_HEAD(&sc->free_sbuf, next); in ipw_tx_start()
1639 SLIST_REMOVE_HEAD(&sc->free_shdr, next); in ipw_tx_start()
1641 sbd = &sc->stbd_list[sc->txcur]; in ipw_tx_start()
1642 sbd->type = IPW_SBD_TYPE_HEADER; in ipw_tx_start()
1643 sbd->priv = shdr; in ipw_tx_start()
1644 sbd->bd->physaddr = htole32(physaddr); in ipw_tx_start()
1645 sbd->bd->len = htole32(sizeof (struct ipw_hdr)); in ipw_tx_start()
1646 sbd->bd->nfrag = 1 + nsegs; in ipw_tx_start()
1647 sbd->bd->flags = IPW_BD_FLAG_TX_FRAME_802_3 | in ipw_tx_start()
1651 shdr->hdr.type, shdr->hdr.subtype, shdr->hdr.encrypted, in ipw_tx_start()
1652 shdr->hdr.encrypt, shdr->hdr.src_addr, ":", shdr->hdr.dst_addr, in ipw_tx_start()
1655 sc->txfree--; in ipw_tx_start()
1656 sc->txcur = (sc->txcur + 1) % IPW_NTBD; in ipw_tx_start()
1658 sbuf->m = m0; in ipw_tx_start()
1659 sbuf->ni = ni; in ipw_tx_start()
1662 sbd = &sc->stbd_list[sc->txcur]; in ipw_tx_start()
1664 sbd->bd->physaddr = htole32(segs[i].ds_addr); in ipw_tx_start()
1665 sbd->bd->len = htole32(segs[i].ds_len); in ipw_tx_start()
1666 sbd->bd->nfrag = 0; in ipw_tx_start()
1667 sbd->bd->flags = IPW_BD_FLAG_TX_FRAME_802_3; in ipw_tx_start()
1668 if (i == nsegs - 1) { in ipw_tx_start()
1669 sbd->type = IPW_SBD_TYPE_DATA; in ipw_tx_start()
1670 sbd->priv = sbuf; in ipw_tx_start()
1671 sbd->bd->flags |= IPW_BD_FLAG_TX_LAST_FRAGMENT; in ipw_tx_start()
1673 sbd->type = IPW_SBD_TYPE_NOASSOC; in ipw_tx_start()
1674 sbd->bd->flags |= IPW_BD_FLAG_TX_NOT_LAST_FRAGMENT; in ipw_tx_start()
1679 sc->txfree--; in ipw_tx_start()
1680 sc->txcur = (sc->txcur + 1) % IPW_NTBD; in ipw_tx_start()
1683 bus_dmamap_sync(sc->hdr_dmat, shdr->map, BUS_DMASYNC_PREWRITE); in ipw_tx_start()
1684 bus_dmamap_sync(sc->txbuf_dmat, sbuf->map, BUS_DMASYNC_PREWRITE); in ipw_tx_start()
1685 bus_dmamap_sync(sc->tbd_dmat, sc->tbd_map, BUS_DMASYNC_PREWRITE); in ipw_tx_start()
1688 CSR_WRITE_4(sc, IPW_CSR_TX_WRITE, sc->txcur); in ipw_tx_start()
1706 struct ipw_softc *sc = ic->ic_softc; in ipw_transmit()
1710 if ((sc->flags & IPW_FLAG_RUNNING) == 0) { in ipw_transmit()
1714 error = mbufq_enqueue(&sc->sc_snd, m); in ipw_transmit()
1732 while (sc->txfree >= 1 + IPW_MAX_NSEG && in ipw_start()
1733 (m = mbufq_dequeue(&sc->sc_snd)) != NULL) { in ipw_start()
1734 ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; in ipw_start()
1736 if_inc_counter(ni->ni_vap->iv_ifp, in ipw_start()
1742 sc->sc_tx_timer = 5; in ipw_start()
1750 struct ieee80211com *ic = &sc->sc_ic; in ipw_watchdog()
1754 if (sc->sc_tx_timer > 0) { in ipw_watchdog()
1755 if (--sc->sc_tx_timer == 0) { in ipw_watchdog()
1756 device_printf(sc->sc_dev, "device timeout\n"); in ipw_watchdog()
1757 counter_u64_add(ic->ic_oerrors, 1); in ipw_watchdog()
1758 taskqueue_enqueue(taskqueue_swi, &sc->sc_init_task); in ipw_watchdog()
1761 if (sc->sc_scan_timer > 0) { in ipw_watchdog()
1762 if (--sc->sc_scan_timer == 0) { in ipw_watchdog()
1763 DPRINTFN(3, ("Scan timeout\n")); in ipw_watchdog()
1765 if (sc->flags & IPW_FLAG_SCANNING) { in ipw_watchdog()
1767 ieee80211_scan_done(TAILQ_FIRST(&ic->ic_vaps)); in ipw_watchdog()
1769 sc->flags &= ~IPW_FLAG_SCANNING; in ipw_watchdog()
1773 if (sc->flags & IPW_FLAG_RUNNING) in ipw_watchdog()
1774 callout_reset(&sc->sc_wdtimer, hz, ipw_watchdog, sc); in ipw_watchdog()
1780 struct ipw_softc *sc = ic->ic_softc; in ipw_parent()
1784 if (ic->ic_nrunning > 0) { in ipw_parent()
1785 if (!(sc->flags & IPW_FLAG_RUNNING)) { in ipw_parent()
1789 } else if (sc->flags & IPW_FLAG_RUNNING) in ipw_parent()
1812 device_printf(sc->sc_dev, "timeout waiting for master\n"); in ipw_stop_master()
1818 sc->flags &= IPW_FLAG_HAS_RADIO_SWITCH; in ipw_stop_master()
1856 int ms = hz < 1000 ? 1 : hz/10; in ipw_waitfordisable() local
1862 error = msleep(sc, &sc->sc_mtx, PCATCH, __func__, ms); in ipw_waitfordisable()
1866 DPRINTF(("%s: timeout waiting for %s\n", in ipw_waitfordisable()
1876 if ((sc->flags & IPW_FLAG_ENABLED) == 0) { in ipw_enable()
1884 sc->flags |= IPW_FLAG_ENABLED; in ipw_enable()
1894 if (sc->flags & IPW_FLAG_ENABLED) { in ipw_disable()
1902 sc->flags &= ~IPW_FLAG_ENABLED; in ipw_disable()
1949 device_printf(sc->sc_dev, in ipw_load_ucode()
1950 "timeout waiting for ucode to initialize\n"); in ipw_load_ucode()
1993 if ((error = msleep(sc, &sc->sc_mtx, 0, "ipwinit", hz)) != 0) { in ipw_load_firmware()
1994 device_printf(sc->sc_dev, "timeout waiting for firmware " in ipw_load_firmware()
2009 struct ieee80211com *ic = &sc->sc_ic; in ipw_setwepkeys()
2010 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); in ipw_setwepkeys()
2016 wk = &vap->iv_nw_keys[i]; in ipw_setwepkeys()
2018 if (wk->wk_cipher == NULL || in ipw_setwepkeys()
2019 wk->wk_cipher->ic_cipher != IEEE80211_CIPHER_WEP) in ipw_setwepkeys()
2023 wepkey.len = wk->wk_keylen; in ipw_setwepkeys()
2025 memcpy(wepkey.key, wk->wk_key, wk->wk_keylen); in ipw_setwepkeys()
2109 DPRINTF(("%s: flags 0x%x\n", __func__, sc->flags)); in ipw_scan()
2111 if (sc->flags & IPW_FLAG_SCANNING) in ipw_scan()
2113 sc->flags |= IPW_FLAG_SCANNING | IPW_FLAG_HACK; in ipw_scan()
2131 * if so just re-enable it to kick off scanning. in ipw_scan()
2134 sc->sc_scan_timer = 3; in ipw_scan()
2135 if (sc->flags & IPW_FLAG_ENABLED) { in ipw_scan()
2144 sc->flags &= ~(IPW_FLAG_SCANNING | IPW_FLAG_HACK); in ipw_scan()
2152 struct ieee80211com *ic = &sc->sc_ic; in ipw_setchannel()
2167 struct ipw_softc *sc = ic->ic_softc; in ipw_assoc()
2168 struct ieee80211_node *ni = vap->iv_bss; in ipw_assoc()
2179 security.authmode = (ni->ni_authmode == IEEE80211_AUTH_SHARED) ? in ipw_assoc()
2188 data = htole32(vap->iv_rtsthreshold); in ipw_assoc()
2194 data = htole32(vap->iv_fragthreshold); in ipw_assoc()
2200 if (vap->iv_flags & IEEE80211_F_PRIVACY) { in ipw_assoc()
2205 if (vap->iv_def_txkey != IEEE80211_KEYIX_NONE) { in ipw_assoc()
2206 data = htole32(vap->iv_def_txkey); in ipw_assoc()
2216 data = htole32((vap->iv_flags & IEEE80211_F_PRIVACY) ? IPW_WEPON : 0); in ipw_assoc()
2222 error = ipw_setssid(sc, ni->ni_essid, ni->ni_esslen); in ipw_assoc()
2226 error = ipw_setbssid(sc, ni->ni_bssid); in ipw_assoc()
2230 if (vap->iv_appie_wpa != NULL) { in ipw_assoc()
2231 struct ieee80211_appie *ie = vap->iv_appie_wpa; in ipw_assoc()
2232 error = ipw_setwpaie(sc, ie->ie_data, ie->ie_len); in ipw_assoc()
2236 if (ic->ic_opmode == IEEE80211_M_IBSS) { in ipw_assoc()
2237 error = ipw_setchannel(sc, ni->ni_chan); in ipw_assoc()
2244 1<<(ieee80211_chan2ieee(ic, ni->ni_chan)-1), 0); in ipw_assoc()
2250 sc->flags |= IPW_FLAG_ASSOCIATING; in ipw_assoc()
2258 struct ieee80211_node *ni = vap->iv_bss; in ipw_disassoc()
2259 struct ipw_softc *sc = ic->ic_softc; in ipw_disassoc()
2262 DPRINTF(("Disassociate from %6D\n", ni->ni_bssid, ":")); in ipw_disassoc()
2267 if (sc->flags & IPW_FLAG_FW_INITED) { in ipw_disassoc()
2268 sc->flags &= ~IPW_FLAG_ASSOCIATED; in ipw_disassoc()
2274 ni->ni_bssid, IEEE80211_ADDR_LEN); in ipw_disassoc()
2293 struct ieee80211com *ic = &sc->sc_ic; in ipw_init()
2299 if (sc->flags & IPW_FLAG_RUNNING) in ipw_init()
2306 struct ieee80211com *ic = &sc->sc_ic; in ipw_init_locked()
2307 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); in ipw_init_locked()
2315 ieee80211_state_name[vap->iv_state], sc->flags)); in ipw_init_locked()
2318 * Avoid re-entrant calls. We need to release the mutex in ipw_init() in ipw_init_locked()
2322 if (sc->flags & IPW_FLAG_INIT_LOCKED) in ipw_init_locked()
2324 sc->flags |= IPW_FLAG_INIT_LOCKED; in ipw_init_locked()
2329 device_printf(sc->sc_dev, "could not reset adapter\n"); in ipw_init_locked()
2333 if (sc->sc_firmware == NULL) { in ipw_init_locked()
2334 device_printf(sc->sc_dev, "no firmware\n"); in ipw_init_locked()
2338 fp = sc->sc_firmware; in ipw_init_locked()
2339 hdr = (const struct ipw_firmware_hdr *)fp->data; in ipw_init_locked()
2341 DPRINTF(("Loading firmware image '%s'\n", fp->name)); in ipw_init_locked()
2342 fw = (const char *)fp->data + sizeof *hdr + le32toh(hdr->mainsz); in ipw_init_locked()
2343 if (ipw_load_ucode(sc, fw, le32toh(hdr->ucodesz)) != 0) { in ipw_init_locked()
2344 device_printf(sc->sc_dev, "could not load microcode\n"); in ipw_init_locked()
2353 sc->txold = IPW_NTBD - 1; in ipw_init_locked()
2354 sc->txcur = 0; in ipw_init_locked()
2355 sc->txfree = IPW_NTBD - 2; in ipw_init_locked()
2356 sc->rxcur = IPW_NRBD - 1; in ipw_init_locked()
2358 CSR_WRITE_4(sc, IPW_CSR_TX_BASE, sc->tbd_phys); in ipw_init_locked()
2361 CSR_WRITE_4(sc, IPW_CSR_TX_WRITE, sc->txcur); in ipw_init_locked()
2363 CSR_WRITE_4(sc, IPW_CSR_RX_BASE, sc->rbd_phys); in ipw_init_locked()
2366 CSR_WRITE_4(sc, IPW_CSR_RX_WRITE, sc->rxcur); in ipw_init_locked()
2368 CSR_WRITE_4(sc, IPW_CSR_STATUS_BASE, sc->status_phys); in ipw_init_locked()
2370 fw = (const char *)fp->data + sizeof *hdr; in ipw_init_locked()
2371 if (ipw_load_firmware(sc, fw, le32toh(hdr->mainsz)) != 0) { in ipw_init_locked()
2372 device_printf(sc->sc_dev, "could not load firmware\n"); in ipw_init_locked()
2376 sc->flags |= IPW_FLAG_FW_INITED; in ipw_init_locked()
2379 sc->table1_base = CSR_READ_4(sc, IPW_CSR_TABLE1_BASE); in ipw_init_locked()
2380 sc->table2_base = CSR_READ_4(sc, IPW_CSR_TABLE2_BASE); in ipw_init_locked()
2385 device_printf(sc->sc_dev, "device configuration failed\n"); in ipw_init_locked()
2389 callout_reset(&sc->sc_wdtimer, hz, ipw_watchdog, sc); in ipw_init_locked()
2390 sc->flags |= IPW_FLAG_RUNNING; in ipw_init_locked()
2391 sc->flags &= ~IPW_FLAG_INIT_LOCKED; in ipw_init_locked()
2396 sc->flags &= ~IPW_FLAG_INIT_LOCKED; in ipw_init_locked()
2402 struct ieee80211com *ic = &sc->sc_ic; in ipw_config()
2411 switch (ic->ic_opmode) { in ipw_config()
2425 device_printf(sc->sc_dev, "unknown opmode %d\n", ic->ic_opmode); in ipw_config()
2433 if (ic->ic_opmode == IEEE80211_M_IBSS || in ipw_config()
2434 ic->ic_opmode == IEEE80211_M_MONITOR) { in ipw_config()
2435 error = ipw_setchannel(sc, ic->ic_curchan); in ipw_config()
2440 if (ic->ic_opmode == IEEE80211_M_MONITOR) in ipw_config()
2445 if (ic->ic_opmode == IEEE80211_M_IBSS) in ipw_config()
2447 if (ic->ic_promisc > 0) in ipw_config()
2449 config.bss_chan = htole32(0x3fff); /* channels 1-14 */ in ipw_config()
2450 config.ibss_chan = htole32(0x7ff); /* channels 1-11 */ in ipw_config()
2480 if (ic->ic_opmode == IEEE80211_M_IBSS) { in ipw_config()
2509 callout_stop(&sc->sc_wdtimer); in ipw_stop_locked()
2518 ipw_release_sbd(sc, &sc->stbd_list[i]); in ipw_stop_locked()
2520 sc->sc_tx_timer = 0; in ipw_stop_locked()
2521 sc->flags &= ~IPW_FLAG_RUNNING; in ipw_stop_locked()
2532 if (!(sc->flags & IPW_FLAG_FW_INITED)) in ipw_sysctl_stats()
2535 CSR_WRITE_4(sc, IPW_CSR_AUTOINC_ADDR, sc->table1_base); in ipw_sysctl_stats()
2550 val = !((sc->flags & IPW_FLAG_HAS_RADIO_SWITCH) && in ipw_sysctl_radio()
2559 return MEM_READ_4(sc, MEM_READ_4(sc, sc->table1_base + off)); in ipw_read_table1()
2565 MEM_WRITE_4(sc, MEM_READ_4(sc, sc->table1_base + off), info); in ipw_write_table1()
2577 addr = MEM_READ_4(sc, sc->table2_base + off);
2578 info = MEM_READ_4(sc, sc->table2_base + off + 4);
2599 for (; count > 0; offset++, datap++, count--) {
2610 for (; count > 0; offset++, datap++, count--) { in ipw_write_mem_1()
2619 struct ipw_softc *sc = ic->ic_softc; in ipw_scan_start()
2630 struct ipw_softc *sc = ic->ic_softc; in ipw_getradiocaps()
2638 if (sc->chanmask & (1 << i)) { in ipw_getradiocaps()
2649 struct ipw_softc *sc = ic->ic_softc; in ipw_set_channel()
2652 if (ic->ic_opmode == IEEE80211_M_MONITOR) { in ipw_set_channel()
2654 ipw_setchannel(sc, ic->ic_curchan); in ipw_set_channel()
2675 struct ipw_softc *sc = ic->ic_softc; in ipw_scan_end()
2678 sc->flags &= ~IPW_FLAG_SCANNING; in ipw_scan_end()