1/* $FreeBSD: head/sys/dev/wpi/if_wpivar.h 260064 2013-12-29 23:46:59Z marius $ */
| 1/* $FreeBSD: head/sys/dev/wpi/if_wpivar.h 278366 2015-02-07 23:11:38Z adrian $ */
|
2 3/*- 4 * Copyright (c) 2006,2007 5 * Damien Bergamini <damien.bergamini@free.fr> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */
| 2 3/*- 4 * Copyright (c) 2006,2007 5 * Damien Bergamini <damien.bergamini@free.fr> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */
|
19#include <net80211/ieee80211_amrr.h> 20
| |
21struct wpi_rx_radiotap_header { 22 struct ieee80211_radiotap_header wr_ihdr; 23 uint64_t wr_tsft; 24 uint8_t wr_flags; 25 uint8_t wr_rate; 26 uint16_t wr_chan_freq; 27 uint16_t wr_chan_flags; 28 int8_t wr_dbm_antsignal; 29 int8_t wr_dbm_antnoise; 30 uint8_t wr_antenna;
| 19struct wpi_rx_radiotap_header { 20 struct ieee80211_radiotap_header wr_ihdr; 21 uint64_t wr_tsft; 22 uint8_t wr_flags; 23 uint8_t wr_rate; 24 uint16_t wr_chan_freq; 25 uint16_t wr_chan_flags; 26 int8_t wr_dbm_antsignal; 27 int8_t wr_dbm_antnoise; 28 uint8_t wr_antenna;
|
31};
| 29} __packed;
|
32 33#define WPI_RX_RADIOTAP_PRESENT \ 34 ((1 << IEEE80211_RADIOTAP_TSFT) | \ 35 (1 << IEEE80211_RADIOTAP_FLAGS) | \ 36 (1 << IEEE80211_RADIOTAP_RATE) | \ 37 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 38 (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \ 39 (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | \ 40 (1 << IEEE80211_RADIOTAP_ANTENNA)) 41 42struct wpi_tx_radiotap_header { 43 struct ieee80211_radiotap_header wt_ihdr; 44 uint8_t wt_flags; 45 uint8_t wt_rate; 46 uint16_t wt_chan_freq; 47 uint16_t wt_chan_flags;
| 30 31#define WPI_RX_RADIOTAP_PRESENT \ 32 ((1 << IEEE80211_RADIOTAP_TSFT) | \ 33 (1 << IEEE80211_RADIOTAP_FLAGS) | \ 34 (1 << IEEE80211_RADIOTAP_RATE) | \ 35 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 36 (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \ 37 (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | \ 38 (1 << IEEE80211_RADIOTAP_ANTENNA)) 39 40struct wpi_tx_radiotap_header { 41 struct ieee80211_radiotap_header wt_ihdr; 42 uint8_t wt_flags; 43 uint8_t wt_rate; 44 uint16_t wt_chan_freq; 45 uint16_t wt_chan_flags;
|
48 uint8_t wt_hwqueue; 49};
| 46} __packed;
|
50 51#define WPI_TX_RADIOTAP_PRESENT \ 52 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 53 (1 << IEEE80211_RADIOTAP_RATE) | \ 54 (1 << IEEE80211_RADIOTAP_CHANNEL)) 55 56struct wpi_dma_info { 57 bus_dma_tag_t tag; 58 bus_dmamap_t map;
| 47 48#define WPI_TX_RADIOTAP_PRESENT \ 49 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 50 (1 << IEEE80211_RADIOTAP_RATE) | \ 51 (1 << IEEE80211_RADIOTAP_CHANNEL)) 52 53struct wpi_dma_info { 54 bus_dma_tag_t tag; 55 bus_dmamap_t map;
|
59 bus_addr_t paddr; /* aligned p address */ 60 bus_addr_t paddr_start; /* possibly unaligned p start*/ 61 caddr_t vaddr; /* aligned v address */ 62 caddr_t vaddr_start; /* possibly unaligned v start */
| 56 bus_addr_t paddr; 57 caddr_t vaddr;
|
63 bus_size_t size; 64}; 65 66struct wpi_tx_data { 67 bus_dmamap_t map;
| 58 bus_size_t size; 59}; 60 61struct wpi_tx_data { 62 bus_dmamap_t map;
|
| 63 bus_addr_t cmd_paddr;
|
68 struct mbuf *m; 69 struct ieee80211_node *ni; 70}; 71 72struct wpi_tx_ring { 73 struct wpi_dma_info desc_dma; 74 struct wpi_dma_info cmd_dma; 75 struct wpi_tx_desc *desc; 76 struct wpi_tx_cmd *cmd;
| 64 struct mbuf *m; 65 struct ieee80211_node *ni; 66}; 67 68struct wpi_tx_ring { 69 struct wpi_dma_info desc_dma; 70 struct wpi_dma_info cmd_dma; 71 struct wpi_tx_desc *desc; 72 struct wpi_tx_cmd *cmd;
|
77 struct wpi_tx_data *data;
| 73 struct wpi_tx_data data[WPI_TX_RING_COUNT];
|
78 bus_dma_tag_t data_dmat; 79 int qid;
| 74 bus_dma_tag_t data_dmat; 75 int qid;
|
80 int count;
| |
81 int queued; 82 int cur;
| 76 int queued; 77 int cur;
|
| 78 int update;
|
83}; 84
| 79}; 80
|
85#define WPI_RBUF_COUNT ( WPI_RX_RING_COUNT + 16 ) 86
| |
87struct wpi_rx_data {
| 81struct wpi_rx_data {
|
88 bus_dmamap_t map; 89 struct mbuf *m;
| 82 struct mbuf *m; 83 bus_dmamap_t map;
|
90}; 91 92struct wpi_rx_ring { 93 struct wpi_dma_info desc_dma; 94 uint32_t *desc; 95 struct wpi_rx_data data[WPI_RX_RING_COUNT]; 96 bus_dma_tag_t data_dmat; 97 int cur;
| 84}; 85 86struct wpi_rx_ring { 87 struct wpi_dma_info desc_dma; 88 uint32_t *desc; 89 struct wpi_rx_data data[WPI_RX_RING_COUNT]; 90 bus_dma_tag_t data_dmat; 91 int cur;
|
| 92 int update;
|
98}; 99
| 93}; 94
|
100struct wpi_amrr { 101 struct ieee80211_node ni; /* must be the first */ 102 int txcnt; 103 int retrycnt; 104 int success; 105 int success_threshold; 106 int recovery;
| 95struct wpi_node { 96 struct ieee80211_node ni; /* must be the first */ 97 uint8_t id;
|
107}; 108 109struct wpi_power_sample { 110 uint8_t index; 111 int8_t power; 112}; 113 114struct wpi_power_group { 115#define WPI_SAMPLES_COUNT 5 116 struct wpi_power_sample samples[WPI_SAMPLES_COUNT]; 117 uint8_t chan; 118 int8_t maxpwr; 119 int16_t temp; 120}; 121
| 98}; 99 100struct wpi_power_sample { 101 uint8_t index; 102 int8_t power; 103}; 104 105struct wpi_power_group { 106#define WPI_SAMPLES_COUNT 5 107 struct wpi_power_sample samples[WPI_SAMPLES_COUNT]; 108 uint8_t chan; 109 int8_t maxpwr; 110 int16_t temp; 111}; 112
|
| 113struct wpi_buf { 114 void *data; 115 struct ieee80211_node *ni; 116 struct mbuf *m; 117 size_t size; 118 int code; 119 int ac; 120}; 121
|
122struct wpi_vap { 123 struct ieee80211vap vap;
| 122struct wpi_vap { 123 struct ieee80211vap vap;
|
| 124 struct wpi_buf wv_bcbuf;
|
124 125 int (*newstate)(struct ieee80211vap *, 126 enum ieee80211_state, int); 127}; 128#define WPI_VAP(vap) ((struct wpi_vap *)(vap)) 129
| 125 126 int (*newstate)(struct ieee80211vap *, 127 enum ieee80211_state, int); 128}; 129#define WPI_VAP(vap) ((struct wpi_vap *)(vap)) 130
|
| 131struct wpi_fw_part { 132 const uint8_t *text; 133 uint32_t textsz; 134 const uint8_t *data; 135 uint32_t datasz; 136}; 137 138struct wpi_fw_info { 139 const uint8_t *data; 140 size_t size; 141 struct wpi_fw_part init; 142 struct wpi_fw_part main; 143 struct wpi_fw_part boot; 144}; 145
|
130struct wpi_softc { 131 device_t sc_dev;
| 146struct wpi_softc { 147 device_t sc_dev;
|
| 148
|
132 struct ifnet *sc_ifp;
| 149 struct ifnet *sc_ifp;
|
| 150 int sc_debug; 151
|
133 struct mtx sc_mtx;
| 152 struct mtx sc_mtx;
|
| 153 struct unrhdr *sc_unr;
|
134 135 /* Flags indicating the current state the driver 136 * expects the hardware to be in 137 */ 138 uint32_t flags;
| 154 155 /* Flags indicating the current state the driver 156 * expects the hardware to be in 157 */ 158 uint32_t flags;
|
139#define WPI_FLAG_HW_RADIO_OFF (1 << 0) 140#define WPI_FLAG_BUSY (1 << 1) 141#define WPI_FLAG_AUTH (1 << 2)
| 159#define WPI_FLAG_BUSY (1 << 0)
|
142
| 160
|
143 /* shared area */
| 161 /* Shared area. */
|
144 struct wpi_dma_info shared_dma; 145 struct wpi_shared *shared; 146
| 162 struct wpi_dma_info shared_dma; 163 struct wpi_shared *shared; 164
|
147 struct wpi_tx_ring txq[WME_NUM_AC]; 148 struct wpi_tx_ring cmdq;
| 165 struct wpi_tx_ring txq[WPI_NTXQUEUES];
|
149 struct wpi_rx_ring rxq; 150
| 166 struct wpi_rx_ring rxq; 167
|
151 /* TX Thermal Callibration */
| 168 /* TX Thermal Callibration. */
|
152 struct callout calib_to; 153 int calib_cnt; 154
| 169 struct callout calib_to; 170 int calib_cnt; 171
|
155 /* Watch dog timer */
| 172 /* Watch dog timers. */
|
156 struct callout watchdog_to;
| 173 struct callout watchdog_to;
|
157 /* Hardware switch polling timer */ 158 struct callout hwswitch_to;
| 174 struct callout watchdog_rfkill;
|
159
| 175
|
| 176 /* Firmware image. */ 177 struct wpi_fw_info fw; 178 uint32_t errptr; 179
|
160 struct resource *irq; 161 struct resource *mem; 162 bus_space_tag_t sc_st; 163 bus_space_handle_t sc_sh; 164 void *sc_ih;
| 180 struct resource *irq; 181 struct resource *mem; 182 bus_space_tag_t sc_st; 183 bus_space_handle_t sc_sh; 184 void *sc_ih;
|
| 185 bus_size_t sc_sz; 186 int sc_cap_off; /* PCIe Capabilities. */
|
165
| 187
|
166 struct wpi_config config;
| 188 struct wpi_rxon rxon;
|
167 int temp;
| 189 int temp;
|
| 190 uint32_t qfullmsk;
|
168
| 191
|
169
| |
170 int sc_tx_timer; 171 int sc_scan_timer; 172
| 192 int sc_tx_timer; 193 int sc_scan_timer; 194
|
173 struct bpf_if *sc_drvbpf;
| 195 void (*sc_node_free)(struct ieee80211_node *); 196 void (*sc_scan_curchan)(struct ieee80211_scan_state *, 197 unsigned long);
|
174 175 struct wpi_rx_radiotap_header sc_rxtap; 176 struct wpi_tx_radiotap_header sc_txtap; 177
| 198 199 struct wpi_rx_radiotap_header sc_rxtap; 200 struct wpi_tx_radiotap_header sc_txtap; 201
|
178 /* firmware image */
| 202 /* Firmware image. */
|
179 const struct firmware *fw_fp; 180
| 203 const struct firmware *fw_fp; 204
|
181 /* firmware DMA transfer */
| 205 /* Firmware DMA transfer. */
|
182 struct wpi_dma_info fw_dma; 183
| 206 struct wpi_dma_info fw_dma; 207
|
184 /* Tasks used by the driver */ 185 struct task sc_restarttask; /* reset firmware task */ 186 struct task sc_radiotask; /* reset rf task */
| 208 /* Tasks used by the driver. */ 209 struct task sc_reinittask; 210 struct task sc_radiooff_task; 211 struct task sc_radioon_task;
|
187
| 212
|
188 /* Eeprom info */
| 213 /* Eeprom info. */
|
189 uint8_t cap; 190 uint16_t rev; 191 uint8_t type;
| 214 uint8_t cap; 215 uint16_t rev; 216 uint8_t type;
|
| 217 struct wpi_eeprom_chan 218 eeprom_channels[WPI_CHAN_BANDS_COUNT][WPI_MAX_CHAN_PER_BAND];
|
192 struct wpi_power_group groups[WPI_POWER_GROUPS_COUNT]; 193 int8_t maxpwr[IEEE80211_CHAN_MAX];
| 219 struct wpi_power_group groups[WPI_POWER_GROUPS_COUNT]; 220 int8_t maxpwr[IEEE80211_CHAN_MAX];
|
194 char domain[4]; /*reglatory domain XXX */
| 221 char domain[4]; /* Regulatory domain. */
|
195};
| 222};
|
| 223
|
196#define WPI_LOCK_INIT(_sc) \ 197 mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \ 198 MTX_NETWORK_LOCK, MTX_DEF) 199#define WPI_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) 200#define WPI_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) 201#define WPI_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) 202#define WPI_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx)
| 224#define WPI_LOCK_INIT(_sc) \ 225 mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \ 226 MTX_NETWORK_LOCK, MTX_DEF) 227#define WPI_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) 228#define WPI_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) 229#define WPI_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) 230#define WPI_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx)
|