if_iwivar.h revision 150341
1/* $FreeBSD: head/sys/dev/iwi/if_iwivar.h 150341 2005-09-19 18:59:04Z damien $ */ 2 3/*- 4 * Copyright (c) 2004, 2005 5 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice unmodified, this list of conditions, and the following 12 * disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30struct iwi_firmware { 31 void *boot; 32 int boot_size; 33 void *ucode; 34 int ucode_size; 35 void *main; 36 int main_size; 37}; 38 39struct iwi_rx_radiotap_header { 40 struct ieee80211_radiotap_header wr_ihdr; 41 uint8_t wr_flags; 42 uint8_t wr_rate; 43 uint16_t wr_chan_freq; 44 uint16_t wr_chan_flags; 45 uint8_t wr_antsignal; 46 uint8_t wr_antenna; 47}; 48 49#define IWI_RX_RADIOTAP_PRESENT \ 50 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 51 (1 << IEEE80211_RADIOTAP_RATE) | \ 52 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 53 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \ 54 (1 << IEEE80211_RADIOTAP_ANTENNA)) 55 56struct iwi_tx_radiotap_header { 57 struct ieee80211_radiotap_header wt_ihdr; 58 uint8_t wt_flags; 59 uint16_t wt_chan_freq; 60 uint16_t wt_chan_flags; 61}; 62 63#define IWI_TX_RADIOTAP_PRESENT \ 64 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 65 (1 << IEEE80211_RADIOTAP_CHANNEL)) 66 67struct iwi_cmd_ring { 68 bus_dma_tag_t desc_dmat; 69 bus_dmamap_t desc_map; 70 bus_addr_t physaddr; 71 struct iwi_cmd_desc *desc; 72 int count; 73 int queued; 74 int cur; 75 int next; 76}; 77 78struct iwi_tx_data { 79 bus_dmamap_t map; 80 struct mbuf *m; 81 struct ieee80211_node *ni; 82}; 83 84struct iwi_tx_ring { 85 bus_dma_tag_t desc_dmat; 86 bus_dma_tag_t data_dmat; 87 bus_dmamap_t desc_map; 88 bus_addr_t physaddr; 89 bus_addr_t csr_ridx; 90 bus_addr_t csr_widx; 91 struct iwi_tx_desc *desc; 92 struct iwi_tx_data *data; 93 int count; 94 int queued; 95 int cur; 96 int next; 97}; 98 99struct iwi_rx_data { 100 bus_dmamap_t map; 101 bus_addr_t physaddr; 102 uint32_t reg; 103 struct mbuf *m; 104}; 105 106struct iwi_rx_ring { 107 bus_dma_tag_t data_dmat; 108 struct iwi_rx_data *data; 109 int count; 110 int cur; 111}; 112 113struct iwi_node { 114 struct ieee80211_node in_node; 115 int in_station; 116#define IWI_MAX_IBSSNODE 32 117}; 118 119struct iwi_softc { 120 struct ifnet *sc_ifp; 121 struct ieee80211com sc_ic; 122 int (*sc_newstate)(struct ieee80211com *, 123 enum ieee80211_state, int); 124 void (*sc_node_free)(struct ieee80211_node *); 125 device_t sc_dev; 126 127 struct mtx sc_mtx; 128 struct unrhdr *sc_unr; 129 130 struct iwi_firmware fw; 131 uint32_t flags; 132#define IWI_FLAG_FW_CACHED (1 << 0) 133#define IWI_FLAG_FW_INITED (1 << 1) 134#define IWI_FLAG_FW_WARNED (1 << 2) 135#define IWI_FLAG_SCANNING (1 << 3) 136 137 struct iwi_cmd_ring cmdq; 138 struct iwi_tx_ring txq[WME_NUM_AC]; 139 struct iwi_rx_ring rxq; 140 141 struct resource *irq; 142 struct resource *mem; 143 bus_space_tag_t sc_st; 144 bus_space_handle_t sc_sh; 145 void *sc_ih; 146 int mem_rid; 147 int irq_rid; 148 149 int antenna; 150 int dwelltime; 151 int bluetooth; 152 153 int sc_tx_timer; 154 155 struct bpf_if *sc_drvbpf; 156 157 union { 158 struct iwi_rx_radiotap_header th; 159 uint8_t pad[64]; 160 } sc_rxtapu; 161#define sc_rxtap sc_rxtapu.th 162 int sc_rxtap_len; 163 164 union { 165 struct iwi_tx_radiotap_header th; 166 uint8_t pad[64]; 167 } sc_txtapu; 168#define sc_txtap sc_txtapu.th 169 int sc_txtap_len; 170}; 171 172#define SIOCSLOADFW _IOW('i', 137, struct ifreq) 173#define SIOCSKILLFW _IOW('i', 138, struct ifreq) 174 175#define IWI_LOCK(sc) mtx_lock(&(sc)->sc_mtx) 176#define IWI_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) 177