1 | /* $NetBSD: if_iwivar.h,v 1.18 2015/09/06 06:01:00 dholland Exp $ */ |
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 | |
30 | #include <sys/ioccom.h> |
31 | |
32 | struct iwi_firmware { |
33 | void *boot; |
34 | int boot_size; |
35 | void *ucode; |
36 | int ucode_size; |
37 | void *main; |
38 | int main_size; |
39 | }; |
40 | |
41 | struct { |
42 | struct ieee80211_radiotap_header ; |
43 | uint8_t ; |
44 | uint8_t ; |
45 | uint16_t ; |
46 | uint16_t ; |
47 | uint8_t ; |
48 | uint8_t ; |
49 | }; |
50 | |
51 | #define IWI_RX_RADIOTAP_PRESENT \ |
52 | ((1 << IEEE80211_RADIOTAP_FLAGS) | \ |
53 | (1 << IEEE80211_RADIOTAP_RATE) | \ |
54 | (1 << IEEE80211_RADIOTAP_CHANNEL) | \ |
55 | (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \ |
56 | (1 << IEEE80211_RADIOTAP_ANTENNA)) |
57 | |
58 | struct { |
59 | struct ieee80211_radiotap_header ; |
60 | uint8_t ; |
61 | uint16_t ; |
62 | uint16_t ; |
63 | }; |
64 | |
65 | #define IWI_TX_RADIOTAP_PRESENT \ |
66 | ((1 << IEEE80211_RADIOTAP_FLAGS) | \ |
67 | (1 << IEEE80211_RADIOTAP_CHANNEL)) |
68 | |
69 | struct iwi_cmd_ring { |
70 | bus_dmamap_t desc_map; |
71 | bus_dma_segment_t desc_seg; |
72 | struct iwi_cmd_desc *desc; |
73 | int count; |
74 | int queued; |
75 | int cur; |
76 | int next; |
77 | }; |
78 | |
79 | struct iwi_tx_data { |
80 | bus_dmamap_t map; |
81 | struct mbuf *m; |
82 | struct ieee80211_node *ni; |
83 | }; |
84 | |
85 | struct iwi_tx_ring { |
86 | bus_dmamap_t desc_map; |
87 | bus_dma_segment_t desc_seg; |
88 | bus_size_t csr_ridx; |
89 | bus_size_t csr_widx; |
90 | struct iwi_tx_desc *desc; |
91 | struct iwi_tx_data *data; |
92 | int count; |
93 | int queued; |
94 | int cur; |
95 | int next; |
96 | }; |
97 | |
98 | struct iwi_rx_data { |
99 | bus_dmamap_t map; |
100 | struct mbuf *m; |
101 | }; |
102 | |
103 | struct iwi_rx_ring { |
104 | struct iwi_rx_data *data; |
105 | int count; |
106 | int cur; |
107 | }; |
108 | |
109 | struct iwi_node { |
110 | struct ieee80211_node in_node; |
111 | int in_station; |
112 | #define IWI_MAX_IBSSNODE 32 |
113 | }; |
114 | |
115 | struct iwi_softc { |
116 | device_t sc_dev; |
117 | struct ethercom sc_ec; |
118 | struct ieee80211com sc_ic; |
119 | int (*sc_newstate)(struct ieee80211com *, |
120 | enum ieee80211_state, int); |
121 | void (*sc_node_free)(struct ieee80211_node *); |
122 | |
123 | uint32_t sc_unr; |
124 | |
125 | struct iwi_firmware fw; |
126 | const char *sc_fwname; |
127 | char *sc_blob; |
128 | size_t sc_blobsize; |
129 | |
130 | uint32_t flags; |
131 | #define IWI_FLAG_FW_CACHED (1 << 0) |
132 | #define IWI_FLAG_FW_INITED (1 << 1) |
133 | #define IWI_FLAG_SCANNING (1 << 3) |
134 | |
135 | bus_dma_tag_t sc_dmat; |
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 | pci_chipset_tag_t sc_pct; |
147 | pcitag_t sc_pcitag; |
148 | bus_size_t sc_sz; |
149 | |
150 | struct sysctllog *sc_sysctllog; |
151 | |
152 | int antenna; |
153 | int dwelltime; |
154 | int bluetooth; |
155 | int nictype; |
156 | |
157 | int sc_tx_timer; |
158 | |
159 | struct bpf_if *sc_drvbpf; |
160 | |
161 | union { |
162 | struct iwi_rx_radiotap_header th; |
163 | uint8_t pad[64]; |
164 | } sc_rxtapu; |
165 | #define sc_rxtap sc_rxtapu.th |
166 | int sc_rxtap_len; |
167 | |
168 | union { |
169 | struct iwi_tx_radiotap_header th; |
170 | uint8_t pad[64]; |
171 | } sc_txtapu; |
172 | #define sc_txtap sc_txtapu.th |
173 | int sc_txtap_len; |
174 | }; |
175 | |
176 | #define sc_if sc_ec.ec_if |
177 | |
178 | #define SIOCGRADIO _IOWR('i', 139, struct ifreq) |
179 | #define SIOCGTABLE0 _IOWR('i', 140, struct ifreq) |
180 | |