1d0c50e91SJohannes Hofmann /* $FreeBSD$ */ 24db7dd1bSJoe Talbott 34db7dd1bSJoe Talbott /*- 44db7dd1bSJoe Talbott * Copyright (c) 2006,2007 54db7dd1bSJoe Talbott * Damien Bergamini <damien.bergamini@free.fr> 64db7dd1bSJoe Talbott * 74db7dd1bSJoe Talbott * Permission to use, copy, modify, and distribute this software for any 84db7dd1bSJoe Talbott * purpose with or without fee is hereby granted, provided that the above 94db7dd1bSJoe Talbott * copyright notice and this permission notice appear in all copies. 104db7dd1bSJoe Talbott * 114db7dd1bSJoe Talbott * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 124db7dd1bSJoe Talbott * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 134db7dd1bSJoe Talbott * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 144db7dd1bSJoe Talbott * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 154db7dd1bSJoe Talbott * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 164db7dd1bSJoe Talbott * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 174db7dd1bSJoe Talbott * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 184db7dd1bSJoe Talbott */ 194db7dd1bSJoe Talbott struct wpi_rx_radiotap_header { 204db7dd1bSJoe Talbott struct ieee80211_radiotap_header wr_ihdr; 214db7dd1bSJoe Talbott uint64_t wr_tsft; 224db7dd1bSJoe Talbott uint8_t wr_flags; 234db7dd1bSJoe Talbott uint8_t wr_rate; 244db7dd1bSJoe Talbott uint16_t wr_chan_freq; 254db7dd1bSJoe Talbott uint16_t wr_chan_flags; 264db7dd1bSJoe Talbott int8_t wr_dbm_antsignal; 274db7dd1bSJoe Talbott int8_t wr_dbm_antnoise; 284db7dd1bSJoe Talbott uint8_t wr_antenna; 297370bffcSMatthew Dillon } __packed; 304db7dd1bSJoe Talbott 314db7dd1bSJoe Talbott #define WPI_RX_RADIOTAP_PRESENT \ 324db7dd1bSJoe Talbott ((1 << IEEE80211_RADIOTAP_TSFT) | \ 334db7dd1bSJoe Talbott (1 << IEEE80211_RADIOTAP_FLAGS) | \ 344db7dd1bSJoe Talbott (1 << IEEE80211_RADIOTAP_RATE) | \ 354db7dd1bSJoe Talbott (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 364db7dd1bSJoe Talbott (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \ 374db7dd1bSJoe Talbott (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | \ 384db7dd1bSJoe Talbott (1 << IEEE80211_RADIOTAP_ANTENNA)) 394db7dd1bSJoe Talbott 404db7dd1bSJoe Talbott struct wpi_tx_radiotap_header { 414db7dd1bSJoe Talbott struct ieee80211_radiotap_header wt_ihdr; 424db7dd1bSJoe Talbott uint8_t wt_flags; 434db7dd1bSJoe Talbott uint8_t wt_rate; 444db7dd1bSJoe Talbott uint16_t wt_chan_freq; 454db7dd1bSJoe Talbott uint16_t wt_chan_flags; 467370bffcSMatthew Dillon } __packed; 474db7dd1bSJoe Talbott 484db7dd1bSJoe Talbott #define WPI_TX_RADIOTAP_PRESENT \ 494db7dd1bSJoe Talbott ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 504db7dd1bSJoe Talbott (1 << IEEE80211_RADIOTAP_RATE) | \ 514db7dd1bSJoe Talbott (1 << IEEE80211_RADIOTAP_CHANNEL)) 524db7dd1bSJoe Talbott 534db7dd1bSJoe Talbott struct wpi_dma_info { 544db7dd1bSJoe Talbott bus_dma_tag_t tag; 554db7dd1bSJoe Talbott bus_dmamap_t map; 567370bffcSMatthew Dillon bus_addr_t paddr; 577370bffcSMatthew Dillon caddr_t vaddr; 584db7dd1bSJoe Talbott bus_size_t size; 594db7dd1bSJoe Talbott }; 604db7dd1bSJoe Talbott 614db7dd1bSJoe Talbott struct wpi_tx_data { 624db7dd1bSJoe Talbott bus_dmamap_t map; 637370bffcSMatthew Dillon bus_addr_t cmd_paddr; 644db7dd1bSJoe Talbott struct mbuf *m; 654db7dd1bSJoe Talbott struct ieee80211_node *ni; 664db7dd1bSJoe Talbott }; 674db7dd1bSJoe Talbott 684db7dd1bSJoe Talbott struct wpi_tx_ring { 694db7dd1bSJoe Talbott struct wpi_dma_info desc_dma; 704db7dd1bSJoe Talbott struct wpi_dma_info cmd_dma; 714db7dd1bSJoe Talbott struct wpi_tx_desc *desc; 724db7dd1bSJoe Talbott struct wpi_tx_cmd *cmd; 737370bffcSMatthew Dillon struct wpi_tx_data data[WPI_TX_RING_COUNT]; 744db7dd1bSJoe Talbott bus_dma_tag_t data_dmat; 757370bffcSMatthew Dillon uint8_t qid; 767370bffcSMatthew Dillon uint8_t cur; 777370bffcSMatthew Dillon uint8_t pending; 787370bffcSMatthew Dillon int16_t queued; 797370bffcSMatthew Dillon int update:1; 804db7dd1bSJoe Talbott }; 814db7dd1bSJoe Talbott 824db7dd1bSJoe Talbott struct wpi_rx_data { 834db7dd1bSJoe Talbott struct mbuf *m; 847370bffcSMatthew Dillon bus_dmamap_t map; 854db7dd1bSJoe Talbott }; 864db7dd1bSJoe Talbott 874db7dd1bSJoe Talbott struct wpi_rx_ring { 884db7dd1bSJoe Talbott struct wpi_dma_info desc_dma; 894db7dd1bSJoe Talbott uint32_t *desc; 904db7dd1bSJoe Talbott struct wpi_rx_data data[WPI_RX_RING_COUNT]; 914db7dd1bSJoe Talbott bus_dma_tag_t data_dmat; 927370bffcSMatthew Dillon uint16_t cur; 937370bffcSMatthew Dillon int update; 944db7dd1bSJoe Talbott }; 954db7dd1bSJoe Talbott 967370bffcSMatthew Dillon struct wpi_node { 974db7dd1bSJoe Talbott struct ieee80211_node ni; /* must be the first */ 987370bffcSMatthew Dillon uint8_t id; 994db7dd1bSJoe Talbott }; 1007370bffcSMatthew Dillon #define WPI_NODE(ni) ((struct wpi_node *)(ni)) 1014db7dd1bSJoe Talbott 1024db7dd1bSJoe Talbott struct wpi_power_sample { 1034db7dd1bSJoe Talbott uint8_t index; 1044db7dd1bSJoe Talbott int8_t power; 1054db7dd1bSJoe Talbott }; 1064db7dd1bSJoe Talbott 1074db7dd1bSJoe Talbott struct wpi_power_group { 1084db7dd1bSJoe Talbott #define WPI_SAMPLES_COUNT 5 1094db7dd1bSJoe Talbott struct wpi_power_sample samples[WPI_SAMPLES_COUNT]; 1104db7dd1bSJoe Talbott uint8_t chan; 1114db7dd1bSJoe Talbott int8_t maxpwr; 1124db7dd1bSJoe Talbott int16_t temp; 1134db7dd1bSJoe Talbott }; 1144db7dd1bSJoe Talbott 1157370bffcSMatthew Dillon struct wpi_buf { 1167370bffcSMatthew Dillon uint8_t data[56]; /* sizeof(struct wpi_cmd_beacon) */ 1177370bffcSMatthew Dillon struct ieee80211_node *ni; 1187370bffcSMatthew Dillon struct mbuf *m; 1197370bffcSMatthew Dillon size_t size; 1207370bffcSMatthew Dillon uint8_t code; 1217370bffcSMatthew Dillon uint16_t ac; 1227370bffcSMatthew Dillon }; 1234db7dd1bSJoe Talbott 1247370bffcSMatthew Dillon struct wpi_vap { 1257370bffcSMatthew Dillon struct ieee80211vap wv_vap; 1267370bffcSMatthew Dillon 1277370bffcSMatthew Dillon struct wpi_buf wv_bcbuf; 1287370bffcSMatthew Dillon #if defined(__DragonFly__) 1297370bffcSMatthew Dillon struct lock wv_mtx; 1307370bffcSMatthew Dillon #else 1317370bffcSMatthew Dillon struct mtx wv_mtx; 1327370bffcSMatthew Dillon #endif 1337370bffcSMatthew Dillon 1347370bffcSMatthew Dillon uint8_t wv_gtk; 1357370bffcSMatthew Dillon #define WPI_VAP_KEY(kid) (1 << kid) 1367370bffcSMatthew Dillon 1377370bffcSMatthew Dillon int (*wv_newstate)(struct ieee80211vap *, 1384db7dd1bSJoe Talbott enum ieee80211_state, int); 1397370bffcSMatthew Dillon void (*wv_recv_mgmt)(struct ieee80211_node *, 1407370bffcSMatthew Dillon struct mbuf *, int, 1417370bffcSMatthew Dillon const struct ieee80211_rx_stats *, 1427370bffcSMatthew Dillon int, int); 1434db7dd1bSJoe Talbott }; 1444db7dd1bSJoe Talbott #define WPI_VAP(vap) ((struct wpi_vap *)(vap)) 1454db7dd1bSJoe Talbott 1467370bffcSMatthew Dillon #define WPI_VAP_LOCK_INIT(_wvp) \ 1477370bffcSMatthew Dillon lockinit(&(_wvp)->wv_mtx, "lock for wv_bcbuf/wv_boff structures", 0, 0) 1487370bffcSMatthew Dillon #define WPI_VAP_LOCK(_wvp) lockmgr(&(_wvp)->wv_mtx, LK_EXCLUSIVE) 1497370bffcSMatthew Dillon #define WPI_VAP_UNLOCK(_wvp) lockmgr(&(_wvp)->wv_mtx, LK_RELEASE) 150*aaa67c6aSMatthew Dillon #define WPI_VAP_LOCK_ASSERT(_wvp) KKASSERT(lockstatus(&(_wvp)->wv_mtx, curthread) == LK_EXCLUSIVE) 1517370bffcSMatthew Dillon #define WPI_VAP_LOCK_DESTROY(_wvp) lockuninit(&(_wvp)->wv_mtx) 1527370bffcSMatthew Dillon 1537370bffcSMatthew Dillon struct wpi_fw_part { 1547370bffcSMatthew Dillon const uint8_t *text; 1557370bffcSMatthew Dillon uint32_t textsz; 1567370bffcSMatthew Dillon const uint8_t *data; 1577370bffcSMatthew Dillon uint32_t datasz; 1587370bffcSMatthew Dillon }; 1597370bffcSMatthew Dillon 1607370bffcSMatthew Dillon struct wpi_fw_info { 1617370bffcSMatthew Dillon const uint8_t *data; 1627370bffcSMatthew Dillon size_t size; 1637370bffcSMatthew Dillon struct wpi_fw_part init; 1647370bffcSMatthew Dillon struct wpi_fw_part main; 1657370bffcSMatthew Dillon struct wpi_fw_part boot; 1667370bffcSMatthew Dillon }; 1677370bffcSMatthew Dillon 1684db7dd1bSJoe Talbott struct wpi_softc { 169dad604b8SJoe Talbott device_t sc_dev; 1707370bffcSMatthew Dillon int sc_debug; 1717370bffcSMatthew Dillon 1727370bffcSMatthew Dillon int sc_running; 1737370bffcSMatthew Dillon 1747370bffcSMatthew Dillon #if defined(__DragonFly__) 175d0c50e91SJohannes Hofmann struct lock sc_mtx; 1767370bffcSMatthew Dillon #else 1777370bffcSMatthew Dillon struct mtx sc_mtx; 1787370bffcSMatthew Dillon #endif 1797370bffcSMatthew Dillon struct ieee80211com sc_ic; 1804db7dd1bSJoe Talbott 1817370bffcSMatthew Dillon #if defined(__DragonFly__) 1827370bffcSMatthew Dillon struct lock tx_mtx; 1837370bffcSMatthew Dillon #else 1847370bffcSMatthew Dillon struct mtx tx_mtx; 1857370bffcSMatthew Dillon #endif 1864db7dd1bSJoe Talbott 1877370bffcSMatthew Dillon /* Shared area. */ 1884db7dd1bSJoe Talbott struct wpi_dma_info shared_dma; 1894db7dd1bSJoe Talbott struct wpi_shared *shared; 1904db7dd1bSJoe Talbott 1917370bffcSMatthew Dillon struct wpi_tx_ring txq[WPI_DRV_NTXQUEUES]; 1927370bffcSMatthew Dillon #if defined(__DragonFly__) 1937370bffcSMatthew Dillon struct lock txq_mtx; 1947370bffcSMatthew Dillon struct lock txq_state_mtx; 1957370bffcSMatthew Dillon #else 1967370bffcSMatthew Dillon struct mtx txq_mtx; 1977370bffcSMatthew Dillon struct mtx txq_state_mtx; 1987370bffcSMatthew Dillon #endif 1997370bffcSMatthew Dillon 2004db7dd1bSJoe Talbott struct wpi_rx_ring rxq; 2017370bffcSMatthew Dillon uint64_t rx_tstamp; 2024db7dd1bSJoe Talbott 2037370bffcSMatthew Dillon /* TX Thermal Callibration. */ 204d0c50e91SJohannes Hofmann struct callout calib_to; 2054db7dd1bSJoe Talbott 2067370bffcSMatthew Dillon struct callout scan_timeout; 2077370bffcSMatthew Dillon struct callout tx_timeout; 2087370bffcSMatthew Dillon 2097370bffcSMatthew Dillon /* Watch dog timer. */ 2107370bffcSMatthew Dillon struct callout watchdog_rfkill; 2117370bffcSMatthew Dillon 2127370bffcSMatthew Dillon /* Firmware image. */ 2137370bffcSMatthew Dillon struct wpi_fw_info fw; 2147370bffcSMatthew Dillon uint32_t errptr; 2154db7dd1bSJoe Talbott 2164db7dd1bSJoe Talbott struct resource *irq; 2174db7dd1bSJoe Talbott struct resource *mem; 2184db7dd1bSJoe Talbott bus_space_tag_t sc_st; 2194db7dd1bSJoe Talbott bus_space_handle_t sc_sh; 2204db7dd1bSJoe Talbott void *sc_ih; 2217370bffcSMatthew Dillon bus_size_t sc_sz; 2227370bffcSMatthew Dillon int sc_cap_off; /* PCIe Capabilities. */ 2234db7dd1bSJoe Talbott 2247370bffcSMatthew Dillon struct wpi_rxon rxon; 2257370bffcSMatthew Dillon #if defined(__DragonFly__) 2267370bffcSMatthew Dillon struct lock rxon_mtx; 2277370bffcSMatthew Dillon #else 2287370bffcSMatthew Dillon struct mtx rxon_mtx; 2297370bffcSMatthew Dillon #endif 2307370bffcSMatthew Dillon 2314db7dd1bSJoe Talbott int temp; 2324db7dd1bSJoe Talbott 2337370bffcSMatthew Dillon uint32_t nodesmsk; 2347370bffcSMatthew Dillon #if defined(__DragonFly__) 2357370bffcSMatthew Dillon struct lock nt_mtx; 2367370bffcSMatthew Dillon #else 2377370bffcSMatthew Dillon struct mtx nt_mtx; 2387370bffcSMatthew Dillon #endif 2394db7dd1bSJoe Talbott 2407370bffcSMatthew Dillon void (*sc_node_free)(struct ieee80211_node *); 2417370bffcSMatthew Dillon void (*sc_update_rx_ring)(struct wpi_softc *); 2427370bffcSMatthew Dillon void (*sc_update_tx_ring)(struct wpi_softc *, 2437370bffcSMatthew Dillon struct wpi_tx_ring *); 2444db7dd1bSJoe Talbott 2454db7dd1bSJoe Talbott struct wpi_rx_radiotap_header sc_rxtap; 2464db7dd1bSJoe Talbott struct wpi_tx_radiotap_header sc_txtap; 2474db7dd1bSJoe Talbott 2487370bffcSMatthew Dillon /* Firmware image. */ 2494db7dd1bSJoe Talbott const struct firmware *fw_fp; 2504db7dd1bSJoe Talbott 2517370bffcSMatthew Dillon /* Firmware DMA transfer. */ 2524db7dd1bSJoe Talbott struct wpi_dma_info fw_dma; 2534db7dd1bSJoe Talbott 2547370bffcSMatthew Dillon /* Tasks used by the driver. */ 2557370bffcSMatthew Dillon struct task sc_radiooff_task; 2567370bffcSMatthew Dillon struct task sc_radioon_task; 2574db7dd1bSJoe Talbott 2587370bffcSMatthew Dillon /* Eeprom info. */ 2594db7dd1bSJoe Talbott uint8_t cap; 2604db7dd1bSJoe Talbott uint16_t rev; 2614db7dd1bSJoe Talbott uint8_t type; 2627370bffcSMatthew Dillon struct wpi_eeprom_chan 2637370bffcSMatthew Dillon eeprom_channels[WPI_CHAN_BANDS_COUNT][WPI_MAX_CHAN_PER_BAND]; 2644db7dd1bSJoe Talbott struct wpi_power_group groups[WPI_POWER_GROUPS_COUNT]; 2654db7dd1bSJoe Talbott int8_t maxpwr[IEEE80211_CHAN_MAX]; 2667370bffcSMatthew Dillon char domain[4]; /* Regulatory domain. */ 2674db7dd1bSJoe Talbott }; 2681a657da7SJoe Talbott 2697370bffcSMatthew Dillon /* 2707370bffcSMatthew Dillon * Locking order: 2717370bffcSMatthew Dillon * 1. WPI_LOCK; 2727370bffcSMatthew Dillon * 2. WPI_RXON_LOCK; 2737370bffcSMatthew Dillon * 3. WPI_TX_LOCK; 2747370bffcSMatthew Dillon * 4. WPI_NT_LOCK / WPI_VAP_LOCK; 2757370bffcSMatthew Dillon * 5. WPI_TXQ_LOCK; 2767370bffcSMatthew Dillon * 6. WPI_TXQ_STATE_LOCK; 2777370bffcSMatthew Dillon */ 2787370bffcSMatthew Dillon 2797370bffcSMatthew Dillon #if defined(__DragonFly__) 2807370bffcSMatthew Dillon 281d0c50e91SJohannes Hofmann #define WPI_LOCK_INIT(_sc) \ 2827370bffcSMatthew Dillon lockinit(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), 0, 0); 283d0c50e91SJohannes Hofmann #define WPI_LOCK(_sc) lockmgr(&(_sc)->sc_mtx, LK_EXCLUSIVE) 284d0c50e91SJohannes Hofmann #define WPI_UNLOCK(_sc) lockmgr(&(_sc)->sc_mtx, LK_RELEASE) 285*aaa67c6aSMatthew Dillon #define WPI_LOCK_ASSERT(_sc) KKASSERT(lockstatus(&(_sc)->sc_mtx, curthread) == LK_EXCLUSIVE) 286d0c50e91SJohannes Hofmann #define WPI_LOCK_DESTROY(_sc) lockuninit(&(_sc)->sc_mtx) 287d0c50e91SJohannes Hofmann 2887370bffcSMatthew Dillon #define WPI_RXON_LOCK_INIT(_sc) \ 2897370bffcSMatthew Dillon lockinit(&(_sc)->rxon_mtx, "lock for wpi_rxon structure", 0, 0) 2907370bffcSMatthew Dillon #define WPI_RXON_LOCK(_sc) lockmgr(&(_sc)->rxon_mtx, LK_EXCLUSIVE) 2917370bffcSMatthew Dillon #define WPI_RXON_UNLOCK(_sc) lockmgr(&(_sc)->rxon_mtx, LK_RELEASE) 292*aaa67c6aSMatthew Dillon #define WPI_RXON_LOCK_ASSERT(_sc) KKASSERT(lockstatus(&(_sc)->rxon_mtx, curthread) == LK_EXCLUSIVE) 2937370bffcSMatthew Dillon #define WPI_RXON_LOCK_DESTROY(_sc) lockuninit(&(_sc)->rxon_mtx) 2947370bffcSMatthew Dillon 2957370bffcSMatthew Dillon #define WPI_TX_LOCK_INIT(_sc) \ 2967370bffcSMatthew Dillon lockinit(&(_sc)->tx_mtx, "tx path lock", 0, 0) 2977370bffcSMatthew Dillon #define WPI_TX_LOCK(_sc) lockmgr(&(_sc)->tx_mtx, LK_EXCLUSIVE) 2987370bffcSMatthew Dillon #define WPI_TX_UNLOCK(_sc) lockmgr(&(_sc)->tx_mtx, LK_RELEASE) 2997370bffcSMatthew Dillon #define WPI_TX_LOCK_DESTROY(_sc) lockuninit(&(_sc)->tx_mtx) 3007370bffcSMatthew Dillon 3017370bffcSMatthew Dillon #define WPI_NT_LOCK_INIT(_sc) \ 3027370bffcSMatthew Dillon lockinit(&(_sc)->nt_mtx, "node table lock", 0, 0) 3037370bffcSMatthew Dillon #define WPI_NT_LOCK(_sc) lockmgr(&(_sc)->nt_mtx, LK_EXCLUSIVE) 3047370bffcSMatthew Dillon #define WPI_NT_UNLOCK(_sc) lockmgr(&(_sc)->nt_mtx, LK_RELEASE) 3057370bffcSMatthew Dillon #define WPI_NT_LOCK_DESTROY(_sc) lockuninit(&(_sc)->nt_mtx) 3067370bffcSMatthew Dillon 3077370bffcSMatthew Dillon #define WPI_TXQ_LOCK_INIT(_sc) \ 3087370bffcSMatthew Dillon lockinit(&(_sc)->txq_mtx, "txq/cmdq lock", 0, 0) 3097370bffcSMatthew Dillon #define WPI_TXQ_LOCK(_sc) lockmgr(&(_sc)->txq_mtx, LK_EXCLUSIVE) 3107370bffcSMatthew Dillon #define WPI_TXQ_UNLOCK(_sc) lockmgr(&(_sc)->txq_mtx, LK_RELEASE) 3117370bffcSMatthew Dillon #define WPI_TXQ_LOCK_DESTROY(_sc) lockuninit(&(_sc)->txq_mtx) 3127370bffcSMatthew Dillon 3137370bffcSMatthew Dillon #define WPI_TXQ_STATE_LOCK_INIT(_sc) \ 3147370bffcSMatthew Dillon lockinit(&(_sc)->txq_state_mtx, "txq state lock", 0, 0) 3157370bffcSMatthew Dillon #define WPI_TXQ_STATE_LOCK(_sc) lockmgr(&(_sc)->txq_state_mtx, LK_EXCLUSIVE) 3167370bffcSMatthew Dillon #define WPI_TXQ_STATE_UNLOCK(_sc) lockmgr(&(_sc)->txq_state_mtx, LK_RELEASE) 3177370bffcSMatthew Dillon #define WPI_TXQ_STATE_LOCK_DESTROY(_sc) lockuninit(&(_sc)->txq_state_mtx) 3187370bffcSMatthew Dillon 3197370bffcSMatthew Dillon #else 3207370bffcSMatthew Dillon 3217370bffcSMatthew Dillon #define WPI_LOCK_INIT(_sc) \ 3227370bffcSMatthew Dillon mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \ 3237370bffcSMatthew Dillon MTX_NETWORK_LOCK, MTX_DEF) 3247370bffcSMatthew Dillon #define WPI_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) 3257370bffcSMatthew Dillon #define WPI_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) 3267370bffcSMatthew Dillon #define WPI_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) 3277370bffcSMatthew Dillon #define WPI_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx) 3287370bffcSMatthew Dillon 3297370bffcSMatthew Dillon #define WPI_RXON_LOCK_INIT(_sc) \ 3307370bffcSMatthew Dillon mtx_init(&(_sc)->rxon_mtx, "lock for wpi_rxon structure", NULL, MTX_DEF) 3317370bffcSMatthew Dillon #define WPI_RXON_LOCK(_sc) mtx_lock(&(_sc)->rxon_mtx) 3327370bffcSMatthew Dillon #define WPI_RXON_UNLOCK(_sc) mtx_unlock(&(_sc)->rxon_mtx) 3337370bffcSMatthew Dillon #define WPI_RXON_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->rxon_mtx, MA_OWNED) 3347370bffcSMatthew Dillon #define WPI_RXON_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->rxon_mtx) 3357370bffcSMatthew Dillon 3367370bffcSMatthew Dillon #define WPI_TX_LOCK_INIT(_sc) \ 3377370bffcSMatthew Dillon mtx_init(&(_sc)->tx_mtx, "tx path lock", NULL, MTX_DEF) 3387370bffcSMatthew Dillon #define WPI_TX_LOCK(_sc) mtx_lock(&(_sc)->tx_mtx) 3397370bffcSMatthew Dillon #define WPI_TX_UNLOCK(_sc) mtx_unlock(&(_sc)->tx_mtx) 3407370bffcSMatthew Dillon #define WPI_TX_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->tx_mtx) 3417370bffcSMatthew Dillon 3427370bffcSMatthew Dillon #define WPI_NT_LOCK_INIT(_sc) \ 3437370bffcSMatthew Dillon mtx_init(&(_sc)->nt_mtx, "node table lock", NULL, MTX_DEF) 3447370bffcSMatthew Dillon #define WPI_NT_LOCK(_sc) mtx_lock(&(_sc)->nt_mtx) 3457370bffcSMatthew Dillon #define WPI_NT_UNLOCK(_sc) mtx_unlock(&(_sc)->nt_mtx) 3467370bffcSMatthew Dillon #define WPI_NT_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->nt_mtx) 3477370bffcSMatthew Dillon 3487370bffcSMatthew Dillon #define WPI_TXQ_LOCK_INIT(_sc) \ 3497370bffcSMatthew Dillon mtx_init(&(_sc)->txq_mtx, "txq/cmdq lock", NULL, MTX_DEF) 3507370bffcSMatthew Dillon #define WPI_TXQ_LOCK(_sc) mtx_lock(&(_sc)->txq_mtx) 3517370bffcSMatthew Dillon #define WPI_TXQ_UNLOCK(_sc) mtx_unlock(&(_sc)->txq_mtx) 3527370bffcSMatthew Dillon #define WPI_TXQ_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->txq_mtx) 3537370bffcSMatthew Dillon 3547370bffcSMatthew Dillon #define WPI_TXQ_STATE_LOCK_INIT(_sc) \ 3557370bffcSMatthew Dillon mtx_init(&(_sc)->txq_state_mtx, "txq state lock", NULL, MTX_DEF) 3567370bffcSMatthew Dillon #define WPI_TXQ_STATE_LOCK(_sc) mtx_lock(&(_sc)->txq_state_mtx) 3577370bffcSMatthew Dillon #define WPI_TXQ_STATE_UNLOCK(_sc) mtx_unlock(&(_sc)->txq_state_mtx) 3587370bffcSMatthew Dillon #define WPI_TXQ_STATE_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->txq_state_mtx) 3597370bffcSMatthew Dillon 3607370bffcSMatthew Dillon #endif 361