if_iwivar.h revision 1.1 1 /* $Id: if_iwivar.h,v 1.1 2005/01/11 18:24:24 skrll Exp $ */
2
3 /*-
4 * Copyright (c) 2004, 2005
5 * Damien Bergamini <damien.bergamini (at) 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
30 struct 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
39 struct iwi_rx_radiotap_header {
40 struct ieee80211_radiotap_header wr_ihdr;
41 u_int8_t wr_flags;
42 u_int8_t wr_rate;
43 u_int16_t wr_chan_freq;
44 u_int16_t wr_chan_flags;
45 u_int8_t wr_antsignal;
46 u_int8_t wr_antnoise;
47 u_int8_t wr_antenna;
48 };
49
50 #define IWI_RX_RADIOTAP_PRESENT \
51 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
52 (1 << IEEE80211_RADIOTAP_RATE) | \
53 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
54 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \
55 (1 << IEEE80211_RADIOTAP_DB_ANTNOISE) | \
56 (1 << IEEE80211_RADIOTAP_ANTENNA))
57
58 struct iwi_tx_radiotap_header {
59 struct ieee80211_radiotap_header wt_ihdr;
60 u_int8_t wt_flags;
61 u_int16_t wt_chan_freq;
62 u_int16_t wt_chan_flags;
63 };
64
65 #define IWI_TX_RADIOTAP_PRESENT \
66 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
67 (1 << IEEE80211_RADIOTAP_CHANNEL))
68
69 struct iwi_softc {
70 struct device sc_dev;
71
72 struct ieee80211com sc_ic;
73 int (*sc_newstate)(struct ieee80211com *,
74 enum ieee80211_state, int);
75
76 struct iwi_firmware fw;
77 u_int32_t flags;
78 #define IWI_FLAG_FW_CACHED (1 << 0)
79 #define IWI_FLAG_FW_INITED (1 << 1)
80
81 bus_dma_tag_t sc_dmat;
82
83 struct iwi_tx_desc *tx_desc;
84 bus_dmamap_t tx_ring_map;
85 bus_dma_segment_t tx_ring_seg;
86
87 struct iwi_tx_buf {
88 bus_dmamap_t map;
89 struct mbuf *m;
90 struct ieee80211_node *ni;
91 } tx_buf[IWI_TX_RING_SIZE];
92
93 int tx_cur;
94 int tx_old;
95 int tx_queued;
96
97 struct iwi_cmd_desc *cmd_desc;
98 bus_dmamap_t cmd_ring_map;
99 bus_dma_segment_t cmd_ring_seg;
100 int cmd_cur;
101
102 struct iwi_rx_buf {
103 bus_dmamap_t map;
104 struct mbuf *m;
105 } rx_buf[IWI_RX_RING_SIZE];
106
107 int rx_cur;
108
109 struct resource *irq;
110 struct resource *mem;
111 bus_space_tag_t sc_st;
112 bus_space_handle_t sc_sh;
113 void *sc_ih;
114 pci_chipset_tag_t sc_pct;
115 pcitag_t sc_pcitag;
116 bus_size_t sc_sz;
117
118 int authmode;
119
120 int sc_tx_timer;
121
122 #if NBPFILTER > 0
123 struct bpf_if *sc_drvbpf;
124
125 union {
126 struct iwi_rx_radiotap_header th;
127 u_int8_t pad[64];
128 } sc_rxtapu;
129 #define sc_rxtap sc_rxtapu.th
130 int sc_rxtap_len;
131
132 union {
133 struct iwi_tx_radiotap_header th;
134 u_int8_t pad[64];
135 } sc_txtapu;
136 #define sc_txtap sc_txtapu.th
137 int sc_txtap_len;
138 #endif
139 };
140
141 #define SIOCSLOADFW _IOW('i', 137, struct ifreq)
142 #define SIOCSKILLFW _IOW('i', 138, struct ifreq)
143 #define SIOCGRADIO _IOWR('i', 139, struct ifreq)
144 #define SIOCGTABLE0 _IOWR('i', 140, struct ifreq)
145