17282444bSPedro F. Giffuni /*- 27282444bSPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 37282444bSPedro F. Giffuni * 412e36acbSWarner Losh * Copyright (c) 2007 The DragonFly Project. All rights reserved. 512e36acbSWarner Losh * 612e36acbSWarner Losh * This code is derived from software contributed to The DragonFly Project 712e36acbSWarner Losh * by Sepherosa Ziehau <sepherosa@gmail.com> 812e36acbSWarner Losh * 912e36acbSWarner Losh * Redistribution and use in source and binary forms, with or without 1012e36acbSWarner Losh * modification, are permitted provided that the following conditions 1112e36acbSWarner Losh * are met: 1212e36acbSWarner Losh * 1312e36acbSWarner Losh * 1. Redistributions of source code must retain the above copyright 1412e36acbSWarner Losh * notice, this list of conditions and the following disclaimer. 1512e36acbSWarner Losh * 2. Redistributions in binary form must reproduce the above copyright 1612e36acbSWarner Losh * notice, this list of conditions and the following disclaimer in 1712e36acbSWarner Losh * the documentation and/or other materials provided with the 1812e36acbSWarner Losh * distribution. 1912e36acbSWarner Losh * 3. Neither the name of The DragonFly Project nor the names of its 2012e36acbSWarner Losh * contributors may be used to endorse or promote products derived 2112e36acbSWarner Losh * from this software without specific, prior written permission. 2212e36acbSWarner Losh * 2312e36acbSWarner Losh * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2412e36acbSWarner Losh * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2512e36acbSWarner Losh * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 2612e36acbSWarner Losh * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 2712e36acbSWarner Losh * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 2812e36acbSWarner Losh * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, 2912e36acbSWarner Losh * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 3012e36acbSWarner Losh * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 3112e36acbSWarner Losh * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 3212e36acbSWarner Losh * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 3312e36acbSWarner Losh * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3412e36acbSWarner Losh * SUCH DAMAGE. 3512e36acbSWarner Losh * 3612e36acbSWarner Losh * $DragonFly: src/sys/dev/netif/bwi/if_bwivar.h,v 1.14 2008/02/15 11:15:38 sephe Exp $ 3712e36acbSWarner Losh */ 3812e36acbSWarner Losh 3912e36acbSWarner Losh #ifndef _IF_BWIVAR_H 4012e36acbSWarner Losh #define _IF_BWIVAR_H 4112e36acbSWarner Losh 4212e36acbSWarner Losh #define BWI_ALIGN 0x1000 4312e36acbSWarner Losh #define BWI_RING_ALIGN BWI_ALIGN 4412e36acbSWarner Losh #define BWI_BUS_SPACE_MAXADDR 0x3fffffff 4512e36acbSWarner Losh 4612e36acbSWarner Losh #define BWI_TX_NRING 6 4712e36acbSWarner Losh #define BWI_TXRX_NRING 6 4812e36acbSWarner Losh #define BWI_TX_NDESC 128 4912e36acbSWarner Losh #define BWI_RX_NDESC 64 5012e36acbSWarner Losh #define BWI_TXSTATS_NDESC 64 5112e36acbSWarner Losh #define BWI_TX_NSPRDESC 2 5212e36acbSWarner Losh #define BWI_TX_DATA_RING 1 5312e36acbSWarner Losh 5412e36acbSWarner Losh /* XXX Onoe/Sample/AMRR probably need different configuration */ 5512e36acbSWarner Losh #define BWI_SHRETRY 7 5612e36acbSWarner Losh #define BWI_LGRETRY 4 5712e36acbSWarner Losh #define BWI_SHRETRY_FB 3 5812e36acbSWarner Losh #define BWI_LGRETRY_FB 2 5912e36acbSWarner Losh 6012e36acbSWarner Losh #define BWI_LED_EVENT_NONE -1 6112e36acbSWarner Losh #define BWI_LED_EVENT_POLL 0 6212e36acbSWarner Losh #define BWI_LED_EVENT_TX 1 6312e36acbSWarner Losh #define BWI_LED_EVENT_RX 2 6412e36acbSWarner Losh #define BWI_LED_SLOWDOWN(dur) (dur) = (((dur) * 3) / 2) 6512e36acbSWarner Losh 6612e36acbSWarner Losh enum bwi_txpwrcb_type { 6712e36acbSWarner Losh BWI_TXPWR_INIT = 0, 6812e36acbSWarner Losh BWI_TXPWR_FORCE = 1, 6912e36acbSWarner Losh BWI_TXPWR_CALIB = 2 7012e36acbSWarner Losh }; 7112e36acbSWarner Losh 7212e36acbSWarner Losh #define BWI_NOISE_FLOOR -95 /* TODO: noise floor calc */ 7312e36acbSWarner Losh #define BWI_FRAME_MIN_LEN(hdr) \ 7412e36acbSWarner Losh ((hdr) + sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN) 7512e36acbSWarner Losh 7612e36acbSWarner Losh #define CSR_READ_4(sc, reg) \ 7712e36acbSWarner Losh bus_space_read_4((sc)->sc_mem_bt, (sc)->sc_mem_bh, (reg)) 7812e36acbSWarner Losh #define CSR_READ_2(sc, reg) \ 7912e36acbSWarner Losh bus_space_read_2((sc)->sc_mem_bt, (sc)->sc_mem_bh, (reg)) 8012e36acbSWarner Losh 8112e36acbSWarner Losh #define CSR_WRITE_4(sc, reg, val) \ 8212e36acbSWarner Losh bus_space_write_4((sc)->sc_mem_bt, (sc)->sc_mem_bh, (reg), (val)) 8312e36acbSWarner Losh #define CSR_WRITE_2(sc, reg, val) \ 8412e36acbSWarner Losh bus_space_write_2((sc)->sc_mem_bt, (sc)->sc_mem_bh, (reg), (val)) 8512e36acbSWarner Losh 8612e36acbSWarner Losh #define CSR_SETBITS_4(sc, reg, bits) \ 8712e36acbSWarner Losh CSR_WRITE_4((sc), (reg), CSR_READ_4((sc), (reg)) | (bits)) 8812e36acbSWarner Losh #define CSR_SETBITS_2(sc, reg, bits) \ 8912e36acbSWarner Losh CSR_WRITE_2((sc), (reg), CSR_READ_2((sc), (reg)) | (bits)) 9012e36acbSWarner Losh 9112e36acbSWarner Losh #define CSR_FILT_SETBITS_4(sc, reg, filt, bits) \ 9212e36acbSWarner Losh CSR_WRITE_4((sc), (reg), (CSR_READ_4((sc), (reg)) & (filt)) | (bits)) 9312e36acbSWarner Losh #define CSR_FILT_SETBITS_2(sc, reg, filt, bits) \ 9412e36acbSWarner Losh CSR_WRITE_2((sc), (reg), (CSR_READ_2((sc), (reg)) & (filt)) | (bits)) 9512e36acbSWarner Losh 9612e36acbSWarner Losh #define CSR_CLRBITS_4(sc, reg, bits) \ 9712e36acbSWarner Losh CSR_WRITE_4((sc), (reg), CSR_READ_4((sc), (reg)) & ~(bits)) 9812e36acbSWarner Losh #define CSR_CLRBITS_2(sc, reg, bits) \ 9912e36acbSWarner Losh CSR_WRITE_2((sc), (reg), CSR_READ_2((sc), (reg)) & ~(bits)) 10012e36acbSWarner Losh 10112e36acbSWarner Losh #ifdef BWI_DEBUG 10212e36acbSWarner Losh 10312e36acbSWarner Losh #define DPRINTF(sc, dbg, fmt, ...) \ 10412e36acbSWarner Losh do { \ 10512e36acbSWarner Losh if ((sc)->sc_debug & (dbg)) \ 10612e36acbSWarner Losh device_printf((sc)->sc_dev, fmt, __VA_ARGS__); \ 10712e36acbSWarner Losh } while (0) 10812e36acbSWarner Losh 10912e36acbSWarner Losh #define _DPRINTF(sc, dbg, fmt, ...) \ 11012e36acbSWarner Losh do { \ 11112e36acbSWarner Losh if ((sc)->sc_debug & (dbg)) \ 11212e36acbSWarner Losh printf(fmt, __VA_ARGS__); \ 11312e36acbSWarner Losh } while (0) 11412e36acbSWarner Losh 11512e36acbSWarner Losh #else /* !BWI_DEBUG */ 11612e36acbSWarner Losh 11712e36acbSWarner Losh #define DPRINTF(sc, dbg, fmt, ...) ((void)0) 11812e36acbSWarner Losh #define _DPRINTF(sc, dbg, fmt, ...) ((void)0) 11912e36acbSWarner Losh 12012e36acbSWarner Losh #endif /* BWI_DEBUG */ 12112e36acbSWarner Losh 12212e36acbSWarner Losh struct bwi_desc32 { 12312e36acbSWarner Losh /* Little endian */ 12412e36acbSWarner Losh uint32_t ctrl; 12512e36acbSWarner Losh uint32_t addr; /* BWI_DESC32_A_ */ 12612e36acbSWarner Losh } __packed; 12712e36acbSWarner Losh 12812e36acbSWarner Losh #define BWI_DESC32_A_FUNC_TXRX 0x1 12912e36acbSWarner Losh #define BWI_DESC32_A_FUNC_MASK __BITS(31, 30) 13012e36acbSWarner Losh #define BWI_DESC32_A_ADDR_MASK __BITS(29, 0) 13112e36acbSWarner Losh 13212e36acbSWarner Losh #define BWI_DESC32_C_BUFLEN_MASK __BITS(12, 0) 13312e36acbSWarner Losh #define BWI_DESC32_C_ADDRHI_MASK __BITS(17, 16) 13412e36acbSWarner Losh #define BWI_DESC32_C_EOR __BIT(28) 13512e36acbSWarner Losh #define BWI_DESC32_C_INTR __BIT(29) 13612e36acbSWarner Losh #define BWI_DESC32_C_FRAME_END __BIT(30) 13712e36acbSWarner Losh #define BWI_DESC32_C_FRAME_START __BIT(31) 13812e36acbSWarner Losh 13912e36acbSWarner Losh struct bwi_desc64 { 14012e36acbSWarner Losh /* Little endian */ 14112e36acbSWarner Losh uint32_t ctrl0; 14212e36acbSWarner Losh uint32_t ctrl1; 14312e36acbSWarner Losh uint32_t addr_lo; 14412e36acbSWarner Losh uint32_t addr_hi; 14512e36acbSWarner Losh } __packed; 14612e36acbSWarner Losh 14712e36acbSWarner Losh struct bwi_rxbuf_hdr { 14812e36acbSWarner Losh /* Little endian */ 14912e36acbSWarner Losh uint16_t rxh_buflen; /* exclude bwi_rxbuf_hdr */ 15012e36acbSWarner Losh uint8_t rxh_pad1[2]; 15112e36acbSWarner Losh uint16_t rxh_flags1; /* BWI_RXH_F1_ */ 15212e36acbSWarner Losh uint8_t rxh_rssi; 15312e36acbSWarner Losh uint8_t rxh_sq; 15412e36acbSWarner Losh uint16_t rxh_phyinfo; /* BWI_RXH_PHYINFO_ */ 15512e36acbSWarner Losh uint16_t rxh_flags3; /* BWI_RXH_F3_ */ 15612e36acbSWarner Losh uint16_t rxh_flags2; /* BWI_RXH_F2_ */ 15712e36acbSWarner Losh uint16_t rxh_tsf; 15812e36acbSWarner Losh uint8_t rxh_pad3[14]; /* Padded to 30bytes */ 15912e36acbSWarner Losh } __packed; 16012e36acbSWarner Losh 16112e36acbSWarner Losh #define BWI_RXH_F1_BCM2053_RSSI __BIT(14) 16212e36acbSWarner Losh #define BWI_RXH_F1_SHPREAMBLE __BIT(7) 16312e36acbSWarner Losh #define BWI_RXH_F1_OFDM __BIT(0) 16412e36acbSWarner Losh 16512e36acbSWarner Losh #define BWI_RXH_F2_TYPE2FRAME __BIT(2) 16612e36acbSWarner Losh 16712e36acbSWarner Losh #define BWI_RXH_F3_BCM2050_RSSI __BIT(10) 16812e36acbSWarner Losh 16912e36acbSWarner Losh #define BWI_RXH_PHYINFO_LNAGAIN __BITS(15, 14) 17012e36acbSWarner Losh 17112e36acbSWarner Losh struct bwi_txbuf_hdr { 17212e36acbSWarner Losh /* Little endian */ 17312e36acbSWarner Losh uint32_t txh_mac_ctrl; /* BWI_TXH_MAC_C_ */ 17412e36acbSWarner Losh uint8_t txh_fc[2]; 17512e36acbSWarner Losh uint16_t txh_unknown1; 17612e36acbSWarner Losh uint16_t txh_phy_ctrl; /* BWI_TXH_PHY_C_ */ 17712e36acbSWarner Losh uint8_t txh_ivs[16]; 17812e36acbSWarner Losh uint8_t txh_addr1[IEEE80211_ADDR_LEN]; 17912e36acbSWarner Losh uint16_t txh_unknown2; 18012e36acbSWarner Losh uint8_t txh_rts_fb_plcp[4]; 18112e36acbSWarner Losh uint16_t txh_rts_fb_duration; 18212e36acbSWarner Losh uint8_t txh_fb_plcp[4]; 18312e36acbSWarner Losh uint16_t txh_fb_duration; 18412e36acbSWarner Losh uint8_t txh_pad2[2]; 18512e36acbSWarner Losh uint16_t txh_id; /* BWI_TXH_ID_ */ 18612e36acbSWarner Losh uint16_t txh_unknown3; 18712e36acbSWarner Losh uint8_t txh_rts_plcp[6]; 18812e36acbSWarner Losh uint8_t txh_rts_fc[2]; 18912e36acbSWarner Losh uint16_t txh_rts_duration; 19012e36acbSWarner Losh uint8_t txh_rts_ra[IEEE80211_ADDR_LEN]; 19112e36acbSWarner Losh uint8_t txh_rts_ta[IEEE80211_ADDR_LEN]; 19212e36acbSWarner Losh uint8_t txh_pad3[2]; 19312e36acbSWarner Losh uint8_t txh_plcp[6]; 19412e36acbSWarner Losh } __packed; 19512e36acbSWarner Losh 19612e36acbSWarner Losh #define BWI_TXH_ID_RING_MASK __BITS(15, 13) 19712e36acbSWarner Losh #define BWI_TXH_ID_IDX_MASK __BITS(12, 0) 19812e36acbSWarner Losh 19912e36acbSWarner Losh #define BWI_TXH_PHY_C_OFDM __BIT(0) 20012e36acbSWarner Losh #define BWI_TXH_PHY_C_SHPREAMBLE __BIT(4) 20112e36acbSWarner Losh #define BWI_TXH_PHY_C_ANTMODE_MASK __BITS(9, 8) 20212e36acbSWarner Losh 20312e36acbSWarner Losh #define BWI_TXH_MAC_C_ACK __BIT(0) 20412e36acbSWarner Losh #define BWI_TXH_MAC_C_FIRST_FRAG __BIT(3) 20512e36acbSWarner Losh #define BWI_TXH_MAC_C_HWSEQ __BIT(4) 20612e36acbSWarner Losh #define BWI_TXH_MAC_C_FB_OFDM __BIT(8) 20712e36acbSWarner Losh 20812e36acbSWarner Losh struct bwi_txstats { 20912e36acbSWarner Losh /* Little endian */ 21012e36acbSWarner Losh uint8_t txs_pad1[4]; 21112e36acbSWarner Losh uint16_t txs_id; 21212e36acbSWarner Losh uint8_t txs_flags; /* BWI_TXS_F_ */ 21312e36acbSWarner Losh uint8_t txs_txcnt; /* BWI_TXS_TXCNT_ */ 21412e36acbSWarner Losh uint8_t txs_pad2[2]; 21512e36acbSWarner Losh uint16_t txs_seq; 21612e36acbSWarner Losh uint16_t txs_unknown; 21712e36acbSWarner Losh uint8_t txs_pad3[2]; /* Padded to 16bytes */ 21812e36acbSWarner Losh } __packed; 21912e36acbSWarner Losh 22012e36acbSWarner Losh #define BWI_TXS_TXCNT_DATA __BITS(7, 4) 22112e36acbSWarner Losh 22212e36acbSWarner Losh #define BWI_TXS_F_ACKED __BIT(0) 22312e36acbSWarner Losh #define BWI_TXS_F_PENDING __BIT(5) 22412e36acbSWarner Losh 22512e36acbSWarner Losh struct bwi_ring_data { 22612e36acbSWarner Losh uint32_t rdata_txrx_ctrl; 22712e36acbSWarner Losh bus_dmamap_t rdata_dmap; 22812e36acbSWarner Losh bus_addr_t rdata_paddr; 22912e36acbSWarner Losh void *rdata_desc; 23012e36acbSWarner Losh }; 23112e36acbSWarner Losh 23212e36acbSWarner Losh struct bwi_txbuf { 23312e36acbSWarner Losh struct mbuf *tb_mbuf; 23412e36acbSWarner Losh bus_dmamap_t tb_dmap; 23512e36acbSWarner Losh 23612e36acbSWarner Losh struct ieee80211_node *tb_ni; 23712e36acbSWarner Losh int tb_rate[2]; 23812e36acbSWarner Losh }; 23912e36acbSWarner Losh 24012e36acbSWarner Losh struct bwi_txbuf_data { 24112e36acbSWarner Losh struct bwi_txbuf tbd_buf[BWI_TX_NDESC]; 24212e36acbSWarner Losh int tbd_used; 24312e36acbSWarner Losh int tbd_idx; 24412e36acbSWarner Losh }; 24512e36acbSWarner Losh 24612e36acbSWarner Losh struct bwi_rxbuf { 24712e36acbSWarner Losh struct mbuf *rb_mbuf; 24812e36acbSWarner Losh bus_addr_t rb_paddr; 24912e36acbSWarner Losh bus_dmamap_t rb_dmap; 25012e36acbSWarner Losh }; 25112e36acbSWarner Losh 25212e36acbSWarner Losh struct bwi_rxbuf_data { 25312e36acbSWarner Losh struct bwi_rxbuf rbd_buf[BWI_RX_NDESC]; 25412e36acbSWarner Losh bus_dmamap_t rbd_tmp_dmap; 25512e36acbSWarner Losh int rbd_idx; 25612e36acbSWarner Losh }; 25712e36acbSWarner Losh 25812e36acbSWarner Losh struct bwi_txstats_data { 25912e36acbSWarner Losh bus_dma_tag_t stats_ring_dtag; 26012e36acbSWarner Losh bus_dmamap_t stats_ring_dmap; 26112e36acbSWarner Losh bus_addr_t stats_ring_paddr; 26212e36acbSWarner Losh void *stats_ring; 26312e36acbSWarner Losh 26412e36acbSWarner Losh bus_dma_tag_t stats_dtag; 26512e36acbSWarner Losh bus_dmamap_t stats_dmap; 26612e36acbSWarner Losh bus_addr_t stats_paddr; 26712e36acbSWarner Losh struct bwi_txstats *stats; 26812e36acbSWarner Losh 26912e36acbSWarner Losh uint32_t stats_ctrl_base; 27012e36acbSWarner Losh int stats_idx; 27112e36acbSWarner Losh }; 27212e36acbSWarner Losh 27312e36acbSWarner Losh struct bwi_fwhdr { 27412e36acbSWarner Losh /* Big endian */ 27512e36acbSWarner Losh uint8_t fw_type; /* BWI_FW_T_ */ 27612e36acbSWarner Losh uint8_t fw_gen; /* BWI_FW_GEN */ 27712e36acbSWarner Losh uint8_t fw_pad[2]; 27812e36acbSWarner Losh uint32_t fw_size; 27912e36acbSWarner Losh #define fw_iv_cnt fw_size 28012e36acbSWarner Losh } __packed; 28112e36acbSWarner Losh 28212e36acbSWarner Losh #define BWI_FWHDR_SZ sizeof(struct bwi_fwhdr) 28312e36acbSWarner Losh 28412e36acbSWarner Losh #define BWI_FW_T_UCODE 'u' 28512e36acbSWarner Losh #define BWI_FW_T_PCM 'p' 28612e36acbSWarner Losh #define BWI_FW_T_IV 'i' 28712e36acbSWarner Losh 28812e36acbSWarner Losh #define BWI_FW_GEN_1 1 28912e36acbSWarner Losh 29012e36acbSWarner Losh #define BWI_FW_VERSION3 3 29112e36acbSWarner Losh #define BWI_FW_VERSION4 4 29212e36acbSWarner Losh #define BWI_FW_VERSION3_REVMAX 0x128 29312e36acbSWarner Losh 29412e36acbSWarner Losh #define BWI_FW_PATH "bwi_v%d_" 29512e36acbSWarner Losh #define BWI_FW_STUB_PATH BWI_FW_PATH "ucode" 29612e36acbSWarner Losh #define BWI_FW_UCODE_PATH BWI_FW_PATH "ucode%d" 29712e36acbSWarner Losh #define BWI_FW_PCM_PATH BWI_FW_PATH "pcm%d" 29812e36acbSWarner Losh #define BWI_FW_IV_PATH BWI_FW_PATH "b0g0initvals%d" 29912e36acbSWarner Losh #define BWI_FW_IV_EXT_PATH BWI_FW_PATH "b0g0bsinitvals%d" 30012e36acbSWarner Losh 30112e36acbSWarner Losh struct bwi_fw_iv { 30212e36acbSWarner Losh /* Big endian */ 30312e36acbSWarner Losh uint16_t iv_ofs; 30412e36acbSWarner Losh union { 30512e36acbSWarner Losh uint32_t val32; 30612e36acbSWarner Losh uint16_t val16; 307*09d0a0fbSDimitry Andric } __packed iv_val; 30812e36acbSWarner Losh } __packed; 30912e36acbSWarner Losh 31012e36acbSWarner Losh #define BWI_FW_IV_OFS_MASK __BITS(14, 0) 31112e36acbSWarner Losh #define BWI_FW_IV_IS_32BIT __BIT(15) 31212e36acbSWarner Losh 31312e36acbSWarner Losh struct bwi_led { 31412e36acbSWarner Losh uint8_t l_flags; /* BWI_LED_F_ */ 31512e36acbSWarner Losh uint8_t l_act; /* BWI_LED_ACT_ */ 31612e36acbSWarner Losh uint8_t l_mask; 31712e36acbSWarner Losh }; 31812e36acbSWarner Losh 31912e36acbSWarner Losh #define BWI_LED_F_ACTLOW 0x1 32012e36acbSWarner Losh #define BWI_LED_F_BLINK 0x2 32112e36acbSWarner Losh #define BWI_LED_F_POLLABLE 0x4 32212e36acbSWarner Losh #define BWI_LED_F_SLOW 0x8 32312e36acbSWarner Losh 32412e36acbSWarner Losh enum bwi_clock_mode { 32512e36acbSWarner Losh BWI_CLOCK_MODE_SLOW, 32612e36acbSWarner Losh BWI_CLOCK_MODE_FAST, 32712e36acbSWarner Losh BWI_CLOCK_MODE_DYN 32812e36acbSWarner Losh }; 32912e36acbSWarner Losh 33012e36acbSWarner Losh struct bwi_regwin { 33112e36acbSWarner Losh uint32_t rw_flags; /* BWI_REGWIN_F_ */ 33212e36acbSWarner Losh uint16_t rw_type; /* BWI_REGWIN_T_ */ 33312e36acbSWarner Losh uint8_t rw_id; 33412e36acbSWarner Losh uint8_t rw_rev; 33512e36acbSWarner Losh }; 33612e36acbSWarner Losh 33712e36acbSWarner Losh #define BWI_REGWIN_F_EXIST 0x1 33812e36acbSWarner Losh 33912e36acbSWarner Losh #define BWI_CREATE_REGWIN(rw, id, type, rev) \ 34012e36acbSWarner Losh do { \ 34112e36acbSWarner Losh (rw)->rw_flags = BWI_REGWIN_F_EXIST; \ 34212e36acbSWarner Losh (rw)->rw_type = (type); \ 34312e36acbSWarner Losh (rw)->rw_id = (id); \ 34412e36acbSWarner Losh (rw)->rw_rev = (rev); \ 34512e36acbSWarner Losh } while (0) 34612e36acbSWarner Losh 34712e36acbSWarner Losh #define BWI_REGWIN_EXIST(rw) ((rw)->rw_flags & BWI_REGWIN_F_EXIST) 34812e36acbSWarner Losh #define BWI_GPIO_REGWIN(sc) \ 34912e36acbSWarner Losh (BWI_REGWIN_EXIST(&(sc)->sc_com_regwin) ? \ 35012e36acbSWarner Losh &(sc)->sc_com_regwin : &(sc)->sc_bus_regwin) 35112e36acbSWarner Losh 35212e36acbSWarner Losh struct bwi_mac; 35312e36acbSWarner Losh 35412e36acbSWarner Losh struct bwi_phy { 35512e36acbSWarner Losh enum ieee80211_phymode phy_mode; 35612e36acbSWarner Losh int phy_rev; 35712e36acbSWarner Losh int phy_version; 35812e36acbSWarner Losh 35912e36acbSWarner Losh uint32_t phy_flags; /* BWI_PHY_F_ */ 36012e36acbSWarner Losh uint16_t phy_tbl_ctrl; 36112e36acbSWarner Losh uint16_t phy_tbl_data_lo; 36212e36acbSWarner Losh uint16_t phy_tbl_data_hi; 36312e36acbSWarner Losh 36412e36acbSWarner Losh void (*phy_init)(struct bwi_mac *); 36512e36acbSWarner Losh }; 36612e36acbSWarner Losh 36712e36acbSWarner Losh #define BWI_PHY_F_CALIBRATED 0x1 36812e36acbSWarner Losh #define BWI_PHY_F_LINKED 0x2 36912e36acbSWarner Losh #define BWI_CLEAR_PHY_FLAGS (BWI_PHY_F_CALIBRATED) 37012e36acbSWarner Losh 37112e36acbSWarner Losh /* TX power control */ 37212e36acbSWarner Losh struct bwi_tpctl { 37312e36acbSWarner Losh uint16_t bbp_atten; /* BBP attenuation: 4bits */ 37412e36acbSWarner Losh uint16_t rf_atten; /* RF attenuation */ 37512e36acbSWarner Losh uint16_t tp_ctrl1; /* ??: 3bits */ 37612e36acbSWarner Losh uint16_t tp_ctrl2; /* ??: 4bits */ 37712e36acbSWarner Losh }; 37812e36acbSWarner Losh 37912e36acbSWarner Losh #define BWI_RF_ATTEN_FACTOR 4 38012e36acbSWarner Losh #define BWI_RF_ATTEN_MAX0 9 38112e36acbSWarner Losh #define BWI_RF_ATTEN_MAX1 31 38212e36acbSWarner Losh #define BWI_BBP_ATTEN_MAX 11 38312e36acbSWarner Losh #define BWI_TPCTL1_MAX 7 38412e36acbSWarner Losh 38512e36acbSWarner Losh struct bwi_rf_lo { 38612e36acbSWarner Losh int8_t ctrl_lo; 38712e36acbSWarner Losh int8_t ctrl_hi; 38812e36acbSWarner Losh }; 38912e36acbSWarner Losh 39012e36acbSWarner Losh struct bwi_rf { 39112e36acbSWarner Losh uint16_t rf_type; /* BWI_RF_T_ */ 39212e36acbSWarner Losh uint16_t rf_manu; 39312e36acbSWarner Losh int rf_rev; 39412e36acbSWarner Losh 39512e36acbSWarner Losh uint32_t rf_flags; /* BWI_RF_F_ */ 39612e36acbSWarner Losh 39712e36acbSWarner Losh #define BWI_RFLO_MAX 56 39812e36acbSWarner Losh struct bwi_rf_lo rf_lo[BWI_RFLO_MAX]; 39912e36acbSWarner Losh uint8_t rf_lo_used[8]; 40012e36acbSWarner Losh 40112e36acbSWarner Losh #define BWI_INVALID_NRSSI -1000 40212e36acbSWarner Losh int16_t rf_nrssi[2]; /* Narrow RSSI */ 40312e36acbSWarner Losh int32_t rf_nrssi_slope; 40412e36acbSWarner Losh 40512e36acbSWarner Losh #define BWI_NRSSI_TBLSZ 64 40612e36acbSWarner Losh int8_t rf_nrssi_table[BWI_NRSSI_TBLSZ]; 40712e36acbSWarner Losh 40812e36acbSWarner Losh uint16_t rf_lo_gain; /* loopback gain */ 40912e36acbSWarner Losh uint16_t rf_rx_gain; /* TRSW RX gain */ 41012e36acbSWarner Losh 41112e36acbSWarner Losh uint16_t rf_calib; /* RF calibration value */ 41212e36acbSWarner Losh u_int rf_curchan; /* current channel */ 41312e36acbSWarner Losh 41412e36acbSWarner Losh uint16_t rf_ctrl_rd; 41512e36acbSWarner Losh int rf_ctrl_adj; 41612e36acbSWarner Losh void (*rf_off)(struct bwi_mac *); 41712e36acbSWarner Losh void (*rf_on)(struct bwi_mac *); 41812e36acbSWarner Losh 41912e36acbSWarner Losh void (*rf_set_nrssi_thr)(struct bwi_mac *); 42012e36acbSWarner Losh void (*rf_calc_nrssi_slope)(struct bwi_mac *); 42112e36acbSWarner Losh int (*rf_calc_rssi) 42212e36acbSWarner Losh (struct bwi_mac *, 42312e36acbSWarner Losh const struct bwi_rxbuf_hdr *); 42412e36acbSWarner Losh int (*rf_calc_noise)(struct bwi_mac *); 42512e36acbSWarner Losh 42612e36acbSWarner Losh void (*rf_lo_update)(struct bwi_mac *); 42712e36acbSWarner Losh 42812e36acbSWarner Losh #define BWI_TSSI_MAX 64 42912e36acbSWarner Losh int8_t rf_txpower_map0[BWI_TSSI_MAX]; 43012e36acbSWarner Losh /* Indexed by TSSI */ 43112e36acbSWarner Losh int rf_idle_tssi0; 43212e36acbSWarner Losh 43312e36acbSWarner Losh int8_t rf_txpower_map[BWI_TSSI_MAX]; 43412e36acbSWarner Losh int rf_idle_tssi; 43512e36acbSWarner Losh 43612e36acbSWarner Losh int rf_base_tssi; 43712e36acbSWarner Losh 43812e36acbSWarner Losh int rf_txpower_max; /* dBm */ 43912e36acbSWarner Losh 44012e36acbSWarner Losh int rf_ant_mode; /* BWI_ANT_MODE_ */ 44112e36acbSWarner Losh }; 44212e36acbSWarner Losh 44312e36acbSWarner Losh #define BWI_RF_F_INITED 0x1 44412e36acbSWarner Losh #define BWI_RF_F_ON 0x2 44512e36acbSWarner Losh #define BWI_RF_CLEAR_FLAGS (BWI_RF_F_INITED) 44612e36acbSWarner Losh 44712e36acbSWarner Losh #define BWI_ANT_MODE_0 0 44812e36acbSWarner Losh #define BWI_ANT_MODE_1 1 44912e36acbSWarner Losh #define BWI_ANT_MODE_UNKN 2 45012e36acbSWarner Losh #define BWI_ANT_MODE_AUTO 3 45112e36acbSWarner Losh 45212e36acbSWarner Losh struct bwi_softc; 45312e36acbSWarner Losh struct firmware; 45412e36acbSWarner Losh 45512e36acbSWarner Losh struct bwi_mac { 45612e36acbSWarner Losh struct bwi_regwin mac_regwin; /* MUST be first field */ 45712e36acbSWarner Losh #define mac_rw_flags mac_regwin.rw_flags 45812e36acbSWarner Losh #define mac_type mac_regwin.rw_type 45912e36acbSWarner Losh #define mac_id mac_regwin.rw_id 46012e36acbSWarner Losh #define mac_rev mac_regwin.rw_rev 46112e36acbSWarner Losh 46212e36acbSWarner Losh struct bwi_softc *mac_sc; 46312e36acbSWarner Losh 46412e36acbSWarner Losh struct bwi_phy mac_phy; /* PHY I/F */ 46512e36acbSWarner Losh struct bwi_rf mac_rf; /* RF I/F */ 46612e36acbSWarner Losh 46712e36acbSWarner Losh struct bwi_tpctl mac_tpctl; /* TX power control */ 46812e36acbSWarner Losh uint32_t mac_flags; /* BWI_MAC_F_ */ 46912e36acbSWarner Losh 47012e36acbSWarner Losh const struct firmware *mac_stub; 47112e36acbSWarner Losh const struct firmware *mac_ucode; 47212e36acbSWarner Losh const struct firmware *mac_pcm; 47312e36acbSWarner Losh const struct firmware *mac_iv; 47412e36acbSWarner Losh const struct firmware *mac_iv_ext; 47512e36acbSWarner Losh }; 47612e36acbSWarner Losh 47712e36acbSWarner Losh #define BWI_MAC_F_BSWAP 0x1 47812e36acbSWarner Losh #define BWI_MAC_F_TPCTL_INITED 0x2 47912e36acbSWarner Losh #define BWI_MAC_F_HAS_TXSTATS 0x4 48012e36acbSWarner Losh #define BWI_MAC_F_INITED 0x8 48112e36acbSWarner Losh #define BWI_MAC_F_ENABLED 0x10 48212e36acbSWarner Losh #define BWI_MAC_F_LOCKED 0x20 /* for debug */ 48312e36acbSWarner Losh #define BWI_MAC_F_TPCTL_ERROR 0x40 48412e36acbSWarner Losh #define BWI_MAC_F_PHYE_RESET 0x80 48512e36acbSWarner Losh 48612e36acbSWarner Losh #define BWI_CREATE_MAC(mac, sc, id, rev) \ 48712e36acbSWarner Losh do { \ 48812e36acbSWarner Losh BWI_CREATE_REGWIN(&(mac)->mac_regwin, \ 48912e36acbSWarner Losh (id), \ 49012e36acbSWarner Losh BWI_REGWIN_T_MAC, \ 49112e36acbSWarner Losh (rev)); \ 49212e36acbSWarner Losh (mac)->mac_sc = (sc); \ 49312e36acbSWarner Losh } while (0) 49412e36acbSWarner Losh 49512e36acbSWarner Losh #define BWI_MAC_MAX 2 49612e36acbSWarner Losh #define BWI_LED_MAX 4 49712e36acbSWarner Losh 49812e36acbSWarner Losh enum bwi_bus_space { 49912e36acbSWarner Losh BWI_BUS_SPACE_30BIT = 1, 50012e36acbSWarner Losh BWI_BUS_SPACE_32BIT, 50112e36acbSWarner Losh BWI_BUS_SPACE_64BIT 50212e36acbSWarner Losh }; 50312e36acbSWarner Losh 50412e36acbSWarner Losh #define BWI_TX_RADIOTAP_PRESENT \ 50512e36acbSWarner Losh ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 50612e36acbSWarner Losh (1 << IEEE80211_RADIOTAP_RATE) | \ 50712e36acbSWarner Losh (1 << IEEE80211_RADIOTAP_CHANNEL)) 50812e36acbSWarner Losh 50912e36acbSWarner Losh struct bwi_tx_radiotap_hdr { 51012e36acbSWarner Losh struct ieee80211_radiotap_header wt_ihdr; 51112e36acbSWarner Losh uint8_t wt_flags; 51212e36acbSWarner Losh uint8_t wt_rate; 51312e36acbSWarner Losh uint16_t wt_chan_freq; 51412e36acbSWarner Losh uint16_t wt_chan_flags; 515786ac703SAndriy Voskoboinyk } __packed; 51612e36acbSWarner Losh 51712e36acbSWarner Losh #define BWI_RX_RADIOTAP_PRESENT \ 51812e36acbSWarner Losh ((1 << IEEE80211_RADIOTAP_TSFT) | \ 51912e36acbSWarner Losh (1 << IEEE80211_RADIOTAP_FLAGS) | \ 52012e36acbSWarner Losh (1 << IEEE80211_RADIOTAP_RATE) | \ 52112e36acbSWarner Losh (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 52212e36acbSWarner Losh (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \ 52312e36acbSWarner Losh (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)) 52412e36acbSWarner Losh 52512e36acbSWarner Losh struct bwi_rx_radiotap_hdr { 52612e36acbSWarner Losh struct ieee80211_radiotap_header wr_ihdr; 52712e36acbSWarner Losh uint64_t wr_tsf; 52812e36acbSWarner Losh uint8_t wr_flags; 52912e36acbSWarner Losh uint8_t wr_rate; 53012e36acbSWarner Losh uint16_t wr_chan_freq; 53112e36acbSWarner Losh uint16_t wr_chan_flags; 53212e36acbSWarner Losh int8_t wr_antsignal; 53312e36acbSWarner Losh int8_t wr_antnoise; 53412e36acbSWarner Losh /* TODO: sq */ 535786ac703SAndriy Voskoboinyk } __packed __aligned(8); 53612e36acbSWarner Losh 53712e36acbSWarner Losh struct bwi_vap { 53812e36acbSWarner Losh struct ieee80211vap bv_vap; 53912e36acbSWarner Losh int (*bv_newstate)(struct ieee80211vap *, 54012e36acbSWarner Losh enum ieee80211_state, int); 54112e36acbSWarner Losh }; 54212e36acbSWarner Losh #define BWI_VAP(vap) ((struct bwi_vap *)(vap)) 54312e36acbSWarner Losh 54412e36acbSWarner Losh struct bwi_softc { 54512e36acbSWarner Losh uint32_t sc_flags; /* BWI_F_ */ 54612e36acbSWarner Losh device_t sc_dev; 54712e36acbSWarner Losh struct mtx sc_mtx; 5487a79cebfSGleb Smirnoff struct ieee80211com sc_ic; 5497a79cebfSGleb Smirnoff struct mbufq sc_snd; 55012e36acbSWarner Losh int sc_invalid; 55112e36acbSWarner Losh 55212e36acbSWarner Losh uint32_t sc_cap; /* BWI_CAP_ */ 55312e36acbSWarner Losh uint16_t sc_bbp_id; /* BWI_BBPID_ */ 55412e36acbSWarner Losh uint8_t sc_bbp_rev; 55512e36acbSWarner Losh uint8_t sc_bbp_pkg; 55612e36acbSWarner Losh 55712e36acbSWarner Losh uint8_t sc_pci_revid; 55812e36acbSWarner Losh uint16_t sc_pci_did; 55912e36acbSWarner Losh uint16_t sc_pci_subvid; 56012e36acbSWarner Losh uint16_t sc_pci_subdid; 56112e36acbSWarner Losh 56212e36acbSWarner Losh uint16_t sc_card_flags; /* BWI_CARD_F_ */ 56312e36acbSWarner Losh uint16_t sc_pwron_delay; 56412e36acbSWarner Losh int sc_locale; 56512e36acbSWarner Losh 56612e36acbSWarner Losh int sc_irq_rid; 56712e36acbSWarner Losh struct resource *sc_irq_res; 56812e36acbSWarner Losh void *sc_irq_handle; 56912e36acbSWarner Losh 57012e36acbSWarner Losh int sc_mem_rid; 57112e36acbSWarner Losh struct resource *sc_mem_res; 57212e36acbSWarner Losh bus_space_tag_t sc_mem_bt; 57312e36acbSWarner Losh bus_space_handle_t sc_mem_bh; 57412e36acbSWarner Losh 57512e36acbSWarner Losh struct callout sc_calib_ch; 57658fbe5abSJohn Baldwin struct callout sc_watchdog_timer; 57712e36acbSWarner Losh 57812e36acbSWarner Losh struct bwi_regwin *sc_cur_regwin; 57912e36acbSWarner Losh struct bwi_regwin sc_com_regwin; 58012e36acbSWarner Losh struct bwi_regwin sc_bus_regwin; 58112e36acbSWarner Losh 58212e36acbSWarner Losh int sc_nmac; 58312e36acbSWarner Losh struct bwi_mac sc_mac[BWI_MAC_MAX]; 58412e36acbSWarner Losh 58512e36acbSWarner Losh int sc_rx_rate; 58612e36acbSWarner Losh int sc_tx_rate; 58712e36acbSWarner Losh enum bwi_txpwrcb_type sc_txpwrcb_type; 58812e36acbSWarner Losh 58912e36acbSWarner Losh int sc_led_blinking; 59012e36acbSWarner Losh int sc_led_ticks; 59112e36acbSWarner Losh struct bwi_led *sc_blink_led; 59212e36acbSWarner Losh struct callout sc_led_blink_ch; 59312e36acbSWarner Losh int sc_led_blink_offdur; 59412e36acbSWarner Losh struct bwi_led sc_leds[BWI_LED_MAX]; 59512e36acbSWarner Losh 59612e36acbSWarner Losh enum bwi_bus_space sc_bus_space; 59712e36acbSWarner Losh bus_dma_tag_t sc_parent_dtag; 59812e36acbSWarner Losh 59912e36acbSWarner Losh bus_dma_tag_t sc_buf_dtag; 60012e36acbSWarner Losh struct bwi_txbuf_data sc_tx_bdata[BWI_TX_NRING]; 60112e36acbSWarner Losh struct bwi_rxbuf_data sc_rx_bdata; 60212e36acbSWarner Losh 60312e36acbSWarner Losh bus_dma_tag_t sc_txring_dtag; 60412e36acbSWarner Losh struct bwi_ring_data sc_tx_rdata[BWI_TX_NRING]; 60512e36acbSWarner Losh bus_dma_tag_t sc_rxring_dtag; 60612e36acbSWarner Losh struct bwi_ring_data sc_rx_rdata; 60712e36acbSWarner Losh 60812e36acbSWarner Losh struct bwi_txstats_data *sc_txstats; 60912e36acbSWarner Losh 61012e36acbSWarner Losh int sc_tx_timer; 61112e36acbSWarner Losh const struct ieee80211_rate_table *sc_rates; 61212e36acbSWarner Losh 61312e36acbSWarner Losh struct bwi_tx_radiotap_hdr sc_tx_th; 61412e36acbSWarner Losh struct bwi_rx_radiotap_hdr sc_rx_th; 61512e36acbSWarner Losh 61612e36acbSWarner Losh struct taskqueue *sc_tq; 61712e36acbSWarner Losh struct task sc_restart_task; 61812e36acbSWarner Losh 61912e36acbSWarner Losh int (*sc_init_tx_ring)(struct bwi_softc *, int); 62012e36acbSWarner Losh void (*sc_free_tx_ring)(struct bwi_softc *, int); 62112e36acbSWarner Losh 62212e36acbSWarner Losh int (*sc_init_rx_ring)(struct bwi_softc *); 62312e36acbSWarner Losh void (*sc_free_rx_ring)(struct bwi_softc *); 62412e36acbSWarner Losh 62512e36acbSWarner Losh int (*sc_init_txstats)(struct bwi_softc *); 62612e36acbSWarner Losh void (*sc_free_txstats)(struct bwi_softc *); 62712e36acbSWarner Losh 62812e36acbSWarner Losh void (*sc_setup_rxdesc) 62912e36acbSWarner Losh (struct bwi_softc *, int, bus_addr_t, int); 63012e36acbSWarner Losh int (*sc_rxeof)(struct bwi_softc *); 63112e36acbSWarner Losh 63212e36acbSWarner Losh void (*sc_setup_txdesc) 63312e36acbSWarner Losh (struct bwi_softc *, struct bwi_ring_data *, 63412e36acbSWarner Losh int, bus_addr_t, int); 63512e36acbSWarner Losh void (*sc_start_tx) 63612e36acbSWarner Losh (struct bwi_softc *, uint32_t, int); 63712e36acbSWarner Losh 63812e36acbSWarner Losh void (*sc_txeof_status)(struct bwi_softc *); 63912e36acbSWarner Losh 64012e36acbSWarner Losh /* Sysctl variables */ 64112e36acbSWarner Losh int sc_fw_version; /* BWI_FW_VERSION[34] */ 64212e36acbSWarner Losh int sc_dwell_time; /* milliseconds */ 64312e36acbSWarner Losh int sc_led_idle; 64412e36acbSWarner Losh int sc_led_blink; 64512e36acbSWarner Losh int sc_txpwr_calib; 64612e36acbSWarner Losh uint32_t sc_debug; /* BWI_DBG_ */ 64712e36acbSWarner Losh }; 64812e36acbSWarner Losh 64912e36acbSWarner Losh #define BWI_F_BUS_INITED 0x1 65012e36acbSWarner Losh #define BWI_F_PROMISC 0x2 65112e36acbSWarner Losh #define BWI_F_STOP 0x4 6527a79cebfSGleb Smirnoff #define BWI_F_RUNNING 0x8 65312e36acbSWarner Losh 65412e36acbSWarner Losh #define BWI_DBG_MAC 0x00000001 65512e36acbSWarner Losh #define BWI_DBG_RF 0x00000002 65612e36acbSWarner Losh #define BWI_DBG_PHY 0x00000004 65712e36acbSWarner Losh #define BWI_DBG_MISC 0x00000008 65812e36acbSWarner Losh 65912e36acbSWarner Losh #define BWI_DBG_ATTACH 0x00000010 66012e36acbSWarner Losh #define BWI_DBG_INIT 0x00000020 66112e36acbSWarner Losh #define BWI_DBG_FIRMWARE 0x00000040 66212e36acbSWarner Losh #define BWI_DBG_80211 0x00000080 66312e36acbSWarner Losh #define BWI_DBG_TXPOWER 0x00000100 66412e36acbSWarner Losh #define BWI_DBG_INTR 0x00000200 66512e36acbSWarner Losh #define BWI_DBG_RX 0x00000400 66612e36acbSWarner Losh #define BWI_DBG_TX 0x00000800 66712e36acbSWarner Losh #define BWI_DBG_TXEOF 0x00001000 66812e36acbSWarner Losh #define BWI_DBG_LED 0x00002000 66912e36acbSWarner Losh 67012e36acbSWarner Losh #define BWI_LOCK_INIT(sc) \ 67112e36acbSWarner Losh mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->sc_dev), \ 67212e36acbSWarner Losh MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE) 67312e36acbSWarner Losh #define BWI_LOCK_DESTROY(sc) mtx_destroy(&(sc)->sc_mtx) 67412e36acbSWarner Losh #define BWI_LOCK(sc) mtx_lock(&(sc)->sc_mtx) 67512e36acbSWarner Losh #define BWI_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) 67612e36acbSWarner Losh #define BWI_ASSERT_LOCKED(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) 67712e36acbSWarner Losh 67812e36acbSWarner Losh int bwi_attach(struct bwi_softc *); 67912e36acbSWarner Losh int bwi_detach(struct bwi_softc *); 68012e36acbSWarner Losh void bwi_suspend(struct bwi_softc *); 68112e36acbSWarner Losh void bwi_resume(struct bwi_softc *); 68212e36acbSWarner Losh int bwi_shutdown(struct bwi_softc *); 68312e36acbSWarner Losh void bwi_intr(void *); 68412e36acbSWarner Losh 68512e36acbSWarner Losh int bwi_bus_init(struct bwi_softc *, struct bwi_mac *mac); 68612e36acbSWarner Losh 68712e36acbSWarner Losh uint16_t bwi_read_sprom(struct bwi_softc *, uint16_t); 68812e36acbSWarner Losh int bwi_regwin_switch(struct bwi_softc *, struct bwi_regwin *, 68912e36acbSWarner Losh struct bwi_regwin **); 69012e36acbSWarner Losh int bwi_regwin_is_enabled(struct bwi_softc *, struct bwi_regwin *); 69112e36acbSWarner Losh void bwi_regwin_enable(struct bwi_softc *, struct bwi_regwin *, 69212e36acbSWarner Losh uint32_t); 69312e36acbSWarner Losh void bwi_regwin_disable(struct bwi_softc *, struct bwi_regwin *, 69412e36acbSWarner Losh uint32_t); 69512e36acbSWarner Losh 69612e36acbSWarner Losh #define abs(a) __builtin_abs(a) 69712e36acbSWarner Losh 69812e36acbSWarner Losh /* XXX does not belong here */ 69912e36acbSWarner Losh struct ieee80211_ds_plcp_hdr { 70012e36acbSWarner Losh uint8_t i_signal; 70112e36acbSWarner Losh uint8_t i_service; 70212e36acbSWarner Losh uint16_t i_length; 70312e36acbSWarner Losh uint16_t i_crc; 70412e36acbSWarner Losh } __packed; 70512e36acbSWarner Losh 70612e36acbSWarner Losh #endif /* !_IF_BWIVAR_H */ 707