if_iwivar.h revision 1.4 1 1.4 christos /* $NetBSD: if_iwivar.h,v 1.4 2005/07/30 21:15:51 christos Exp $ */
2 1.1 skrll
3 1.1 skrll /*-
4 1.1 skrll * Copyright (c) 2004, 2005
5 1.1 skrll * Damien Bergamini <damien.bergamini (at) free.fr>. All rights reserved.
6 1.1 skrll *
7 1.1 skrll * Redistribution and use in source and binary forms, with or without
8 1.1 skrll * modification, are permitted provided that the following conditions
9 1.1 skrll * are met:
10 1.1 skrll * 1. Redistributions of source code must retain the above copyright
11 1.1 skrll * notice unmodified, this list of conditions, and the following
12 1.1 skrll * disclaimer.
13 1.1 skrll * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 skrll * notice, this list of conditions and the following disclaimer in the
15 1.1 skrll * documentation and/or other materials provided with the distribution.
16 1.1 skrll *
17 1.1 skrll * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 1.1 skrll * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 1.1 skrll * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 1.1 skrll * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 1.1 skrll * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 1.1 skrll * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 1.1 skrll * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 1.1 skrll * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 1.1 skrll * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 1.1 skrll * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 1.1 skrll * SUCH DAMAGE.
28 1.1 skrll */
29 1.1 skrll
30 1.1 skrll struct iwi_firmware {
31 1.1 skrll void *boot;
32 1.1 skrll int boot_size;
33 1.1 skrll void *ucode;
34 1.1 skrll int ucode_size;
35 1.1 skrll void *main;
36 1.1 skrll int main_size;
37 1.1 skrll };
38 1.1 skrll
39 1.1 skrll struct iwi_rx_radiotap_header {
40 1.1 skrll struct ieee80211_radiotap_header wr_ihdr;
41 1.1 skrll u_int8_t wr_flags;
42 1.1 skrll u_int8_t wr_rate;
43 1.1 skrll u_int16_t wr_chan_freq;
44 1.1 skrll u_int16_t wr_chan_flags;
45 1.1 skrll u_int8_t wr_antsignal;
46 1.1 skrll u_int8_t wr_antnoise;
47 1.1 skrll u_int8_t wr_antenna;
48 1.1 skrll };
49 1.1 skrll
50 1.1 skrll #define IWI_RX_RADIOTAP_PRESENT \
51 1.1 skrll ((1 << IEEE80211_RADIOTAP_FLAGS) | \
52 1.1 skrll (1 << IEEE80211_RADIOTAP_RATE) | \
53 1.1 skrll (1 << IEEE80211_RADIOTAP_CHANNEL) | \
54 1.1 skrll (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \
55 1.1 skrll (1 << IEEE80211_RADIOTAP_DB_ANTNOISE) | \
56 1.1 skrll (1 << IEEE80211_RADIOTAP_ANTENNA))
57 1.1 skrll
58 1.1 skrll struct iwi_tx_radiotap_header {
59 1.1 skrll struct ieee80211_radiotap_header wt_ihdr;
60 1.1 skrll u_int8_t wt_flags;
61 1.1 skrll u_int16_t wt_chan_freq;
62 1.1 skrll u_int16_t wt_chan_flags;
63 1.1 skrll };
64 1.1 skrll
65 1.1 skrll #define IWI_TX_RADIOTAP_PRESENT \
66 1.1 skrll ((1 << IEEE80211_RADIOTAP_FLAGS) | \
67 1.1 skrll (1 << IEEE80211_RADIOTAP_CHANNEL))
68 1.1 skrll
69 1.1 skrll struct iwi_softc {
70 1.1 skrll struct device sc_dev;
71 1.3 dyoung struct ethercom sc_ec;
72 1.1 skrll struct ieee80211com sc_ic;
73 1.1 skrll int (*sc_newstate)(struct ieee80211com *,
74 1.1 skrll enum ieee80211_state, int);
75 1.1 skrll
76 1.1 skrll struct iwi_firmware fw;
77 1.1 skrll u_int32_t flags;
78 1.1 skrll #define IWI_FLAG_FW_CACHED (1 << 0)
79 1.1 skrll #define IWI_FLAG_FW_INITED (1 << 1)
80 1.4 christos #define IWI_FLAG_FW_WARNED (1 << 2)
81 1.4 christos #define IWI_FLAG_SCANNING (1 << 3)
82 1.1 skrll
83 1.1 skrll bus_dma_tag_t sc_dmat;
84 1.1 skrll
85 1.1 skrll struct iwi_tx_desc *tx_desc;
86 1.1 skrll bus_dmamap_t tx_ring_map;
87 1.1 skrll bus_dma_segment_t tx_ring_seg;
88 1.1 skrll
89 1.1 skrll struct iwi_tx_buf {
90 1.1 skrll bus_dmamap_t map;
91 1.1 skrll struct mbuf *m;
92 1.1 skrll struct ieee80211_node *ni;
93 1.1 skrll } tx_buf[IWI_TX_RING_SIZE];
94 1.1 skrll
95 1.1 skrll int tx_cur;
96 1.1 skrll int tx_old;
97 1.1 skrll int tx_queued;
98 1.1 skrll
99 1.1 skrll struct iwi_cmd_desc *cmd_desc;
100 1.1 skrll bus_dmamap_t cmd_ring_map;
101 1.1 skrll bus_dma_segment_t cmd_ring_seg;
102 1.1 skrll int cmd_cur;
103 1.1 skrll
104 1.1 skrll struct iwi_rx_buf {
105 1.1 skrll bus_dmamap_t map;
106 1.1 skrll struct mbuf *m;
107 1.1 skrll } rx_buf[IWI_RX_RING_SIZE];
108 1.1 skrll
109 1.1 skrll int rx_cur;
110 1.1 skrll
111 1.1 skrll struct resource *irq;
112 1.1 skrll struct resource *mem;
113 1.1 skrll bus_space_tag_t sc_st;
114 1.1 skrll bus_space_handle_t sc_sh;
115 1.1 skrll void *sc_ih;
116 1.1 skrll pci_chipset_tag_t sc_pct;
117 1.1 skrll pcitag_t sc_pcitag;
118 1.1 skrll bus_size_t sc_sz;
119 1.1 skrll
120 1.1 skrll int authmode;
121 1.1 skrll
122 1.1 skrll int sc_tx_timer;
123 1.1 skrll
124 1.1 skrll #if NBPFILTER > 0
125 1.1 skrll struct bpf_if *sc_drvbpf;
126 1.1 skrll
127 1.1 skrll union {
128 1.1 skrll struct iwi_rx_radiotap_header th;
129 1.1 skrll u_int8_t pad[64];
130 1.1 skrll } sc_rxtapu;
131 1.1 skrll #define sc_rxtap sc_rxtapu.th
132 1.1 skrll int sc_rxtap_len;
133 1.1 skrll
134 1.1 skrll union {
135 1.1 skrll struct iwi_tx_radiotap_header th;
136 1.1 skrll u_int8_t pad[64];
137 1.1 skrll } sc_txtapu;
138 1.1 skrll #define sc_txtap sc_txtapu.th
139 1.1 skrll int sc_txtap_len;
140 1.1 skrll #endif
141 1.4 christos
142 1.4 christos int antenna;
143 1.4 christos int dwelltime;
144 1.4 christos int bluetooth;
145 1.1 skrll };
146 1.1 skrll
147 1.3 dyoung #define sc_if sc_ec.ec_if
148 1.3 dyoung
149 1.1 skrll #define SIOCSLOADFW _IOW('i', 137, struct ifreq)
150 1.1 skrll #define SIOCSKILLFW _IOW('i', 138, struct ifreq)
151 1.1 skrll #define SIOCGRADIO _IOWR('i', 139, struct ifreq)
152 1.1 skrll #define SIOCGTABLE0 _IOWR('i', 140, struct ifreq)
153