bwfmreg.h revision 1.3 1 /* $NetBSD: bwfmreg.h,v 1.3 2018/05/11 07:41:11 maya Exp $ */
2 /* $OpenBSD: bwfmreg.h,v 1.16 2018/02/07 21:44:09 patrick Exp $ */
3 /*
4 * Copyright (c) 2010-2016 Broadcom Corporation
5 * Copyright (c) 2016,2017 Patrick Wildt <patrick (at) blueri.se>
6 *
7 * Permission to use, copy, modify, and/or 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
20 /* SDIO registers */
21 #define BWFM_SDIO_FUNC1_SBADDRLOW 0x1000A
22 #define BWFM_SDIO_FUNC1_SBADDRMID 0x1000B
23 #define BWFM_SDIO_FUNC1_SBADDRHIGH 0x1000C
24 #define BWFM_SDIO_FUNC1_CHIPCLKCSR 0x1000E
25 #define BWFM_SDIO_FUNC1_CHIPCLKCSR_FORCE_ALP 0x01
26 #define BWFM_SDIO_FUNC1_CHIPCLKCSR_FORCE_HT 0x02
27 #define BWFM_SDIO_FUNC1_CHIPCLKCSR_FORCE_ILP 0x04
28 #define BWFM_SDIO_FUNC1_CHIPCLKCSR_ALP_AVAIL_REQ 0x08
29 #define BWFM_SDIO_FUNC1_CHIPCLKCSR_HT_AVAIL_REQ 0x10
30 #define BWFM_SDIO_FUNC1_CHIPCLKCSR_FORCE_HW_CLKREQ_OFF 0x20
31 #define BWFM_SDIO_FUNC1_CHIPCLKCSR_ALP_AVAIL 0x40
32 #define BWFM_SDIO_FUNC1_CHIPCLKCSR_HT_AVAIL 0x80
33 #define BWFM_SDIO_FUNC1_CHIPCLKCSR_CSR_MASK 0x1F
34 #define BWFM_SDIO_FUNC1_SDIOPULLUP 0x1000F
35
36 #define BWFM_SDIO_SB_OFT_ADDR_MASK 0x07FFF
37 #define BWFM_SDIO_SB_ACCESS_2_4B_FLAG 0x08000
38
39 /* Chip registers */
40 #define BWFM_CHIP_BASE 0x18000000
41 #define BWFM_CHIP_REG_CHIPID 0x00000000
42 #define BWFM_CHIP_CHIPID_ID(x) (((x) >> 0) & 0xffff)
43 #define BWFM_CHIP_CHIPID_REV(x) (((x) >> 16) & 0xf)
44 #define BWFM_CHIP_CHIPID_PKG(x) (((x) >> 20) & 0xf)
45 #define BWFM_CHIP_CHIPID_CC(x) (((x) >> 24) & 0xf)
46 #define BWFM_CHIP_CHIPID_TYPE(x) (((x) >> 28) & 0xf)
47 #define BWFM_CHIP_CHIPID_TYPE_SOCI_SB 0
48 #define BWFM_CHIP_CHIPID_TYPE_SOCI_AI 1
49 #define BWFM_CHIP_REG_CAPABILITIES 0x00000004
50 #define BWFM_CHIP_REG_CAPABILITIES_PMU 0x10000000
51 #define BWFM_CHIP_REG_CAPABILITIES_EXT 0x000000AC
52 #define BWFM_CHIP_REG_CAPABILITIES_EXT_AOB_PRESENT 0x00000040
53 #define BWFM_CHIP_REG_WATCHDOG 0x00000080
54 #define BWFM_CHIP_REG_EROMPTR 0x000000FC
55 #define BWFM_CHIP_REG_SR_CAPABILITY 0x00000500
56 #define BWFM_CHIP_REG_SR_CONTROL0 0x00000504
57 #define BWFM_CHIP_REG_SR_CONTROL1 0x00000508
58 #define BWFM_CHIP_REG_PMUCONTROL 0x00000600
59 #define BWFM_CHIP_REG_PMUCONTROL_RES_MASK 0x00006000
60 #define BWFM_CHIP_REG_PMUCONTROL_RES_SHIFT 13
61 #define BWFM_CHIP_REG_PMUCONTROL_RES_RELOAD 0x2
62 #define BWFM_CHIP_REG_PMUCAPABILITIES 0x00000604
63 #define BWFM_CHIP_REG_PMUCAPABILITIES_REV_MASK 0x000000ff
64 #define BWFM_CHIP_REG_PMUCAPABILITIES_EXT 0x0000064C
65 #define BWFM_CHIP_REG_PMUCAPABILITIES_SR_SUPP (1 << 1)
66 #define BWFM_CHIP_REG_CHIPCONTROL_ADDR 0x00000650
67 #define BWFM_CHIP_REG_CHIPCONTROL_DATA 0x00000654
68 #define BWFM_CHIP_REG_RETENTION_CTL 0x00000670
69 #define BWFM_CHIP_REG_RETENTION_CTL_MACPHY_DIS (1 << 26)
70 #define BWFM_CHIP_REG_RETENTION_CTL_LOGIC_DIS (1 << 27)
71
72 /* Agent registers */
73 #define BWFM_AGENT_IOCTL 0x0408
74 #define BWFM_AGENT_IOCTL_CLK 0x0001
75 #define BWFM_AGENT_IOCTL_FGC 0x0002
76 #define BWFM_AGENT_IOCTL_CORE_BITS 0x3FFC
77 #define BWFM_AGENT_IOCTL_PME_EN 0x4000
78 #define BWFM_AGENT_IOCTL_BIST_EN 0x8000
79 #define BWFM_AGENT_IOCTL_ARMCR4_CPUHALT 0x0020
80 #define BWFM_AGENT_RESET_CTL 0x0800
81 #define BWFM_AGENT_RESET_CTL_RESET 0x0001
82
83 /* Agent Core-IDs */
84 #define BWFM_AGENT_CORE_CHIPCOMMON 0x800
85 #define BWFM_AGENT_INTERNAL_MEM 0x80E
86 #define BWFM_AGENT_CORE_80211 0x812
87 #define BWFM_AGENT_CORE_PMU 0x827
88 #define BWFM_AGENT_CORE_SDIO_DEV 0x829
89 #define BWFM_AGENT_CORE_ARM_CM3 0x82A
90 #define BWFM_AGENT_CORE_PCIE2 0x83C
91 #define BWFM_AGENT_CORE_ARM_CR4 0x83E
92 #define BWFM_AGENT_CORE_ARM_CA7 0x847
93 #define BWFM_AGENT_SYS_MEM 0x849
94
95 /* Specific Core Bits */
96 #define BWFM_AGENT_ARMCR4_IOCTL_CPUHALT 0x0020
97 #define BWFM_AGENT_D11_IOCTL_PHYCLOCKEN 0x0004
98 #define BWFM_AGENT_D11_IOCTL_PHYRESET 0x0008
99
100 /* CR4 registers */
101 #define BWFM_ARMCR4_CAP 0x0004
102 #define BWFM_ARMCR4_CAP_TCBANB_MASK 0xf
103 #define BWFM_ARMCR4_CAP_TCBANB_SHIFT 0
104 #define BWFM_ARMCR4_CAP_TCBBNB_MASK 0xf0
105 #define BWFM_ARMCR4_CAP_TCBBNB_SHIFT 4
106 #define BWFM_ARMCR4_BANKIDX 0x0040
107 #define BWFM_ARMCR4_BANKINFO 0x0044
108 #define BWFM_ARMCR4_BANKINFO_BSZ_MASK 0x3f
109 #define BWFM_ARMCR4_BANKINFO_BSZ_MULT 8192
110 #define BWFM_ARMCR4_BANKPDA 0x004C
111
112 /* SOCRAM registers */
113 #define BWFM_SOCRAM_COREINFO 0x0000
114 #define BWFM_SOCRAM_COREINFO_SRBSZ_BASE 14
115 #define BWFM_SOCRAM_COREINFO_SRBSZ_MASK 0xf
116 #define BWFM_SOCRAM_COREINFO_SRBSZ_SHIFT 0
117 #define BWFM_SOCRAM_COREINFO_SRNB_MASK 0xf0
118 #define BWFM_SOCRAM_COREINFO_SRNB_SHIFT 4
119 #define BWFM_SOCRAM_COREINFO_LSS_MASK 0xf00000
120 #define BWFM_SOCRAM_COREINFO_LSS_SHIFT 20
121 #define BWFM_SOCRAM_BANKIDX 0x0010
122 #define BWFM_SOCRAM_BANKIDX_MEMTYPE_RAM 0
123 #define BWFM_SOCRAM_BANKIDX_MEMTYPE_ROM 1
124 #define BWFM_SOCRAM_BANKIDX_MEMTYPE_DEVRAM 2
125 #define BWFM_SOCRAM_BANKIDX_MEMTYPE_SHIFT 8
126 #define BWFM_SOCRAM_BANKINFO 0x0040
127 #define BWFM_SOCRAM_BANKINFO_SZBASE 8192
128 #define BWFM_SOCRAM_BANKINFO_SZMASK 0x7f
129 #define BWFM_SOCRAM_BANKINFO_RETNTRAM_MASK 0x10000
130 #define BWFM_SOCRAM_BANKPDA 0x0044
131
132 /* SDPCMD registers */
133 #define BWFM_SDPCMD_INTSTATUS 0x0020
134
135 /* DMP descriptor */
136 #define BWFM_DMP_DESC_MASK 0x0000000F
137 #define BWFM_DMP_DESC_EMPTY 0x00000000
138 #define BWFM_DMP_DESC_VALID 0x00000001
139 #define BWFM_DMP_DESC_COMPONENT 0x00000001
140 #define BWFM_DMP_DESC_MASTER_PORT 0x00000003
141 #define BWFM_DMP_DESC_ADDRESS 0x00000005
142 #define BWFM_DMP_DESC_ADDRSIZE_GT32 0x00000008
143 #define BWFM_DMP_DESC_EOT 0x0000000F
144 #define BWFM_DMP_COMP_DESIGNER 0xFFF00000
145 #define BWFM_DMP_COMP_DESIGNER_S 20
146 #define BWFM_DMP_COMP_PARTNUM 0x000FFF00
147 #define BWFM_DMP_COMP_PARTNUM_S 8
148 #define BWFM_DMP_COMP_CLASS 0x000000F0
149 #define BWFM_DMP_COMP_CLASS_S 4
150 #define BWFM_DMP_COMP_REVISION 0xFF000000
151 #define BWFM_DMP_COMP_REVISION_S 24
152 #define BWFM_DMP_COMP_NUM_SWRAP 0x00F80000
153 #define BWFM_DMP_COMP_NUM_SWRAP_S 19
154 #define BWFM_DMP_COMP_NUM_MWRAP 0x0007C000
155 #define BWFM_DMP_COMP_NUM_MWRAP_S 14
156 #define BWFM_DMP_COMP_NUM_SPORT 0x00003E00
157 #define BWFM_DMP_COMP_NUM_SPORT_S 9
158 #define BWFM_DMP_COMP_NUM_MPORT 0x000001F0
159 #define BWFM_DMP_COMP_NUM_MPORT_S 4
160 #define BWFM_DMP_MASTER_PORT_UID 0x0000FF00
161 #define BWFM_DMP_MASTER_PORT_UID_S 8
162 #define BWFM_DMP_MASTER_PORT_NUM 0x000000F0
163 #define BWFM_DMP_MASTER_PORT_NUM_S 4
164 #define BWFM_DMP_SLAVE_ADDR_BASE 0xFFFFF000
165 #define BWFM_DMP_SLAVE_ADDR_BASE_S 12
166 #define BWFM_DMP_SLAVE_PORT_NUM 0x00000F00
167 #define BWFM_DMP_SLAVE_PORT_NUM_S 8
168 #define BWFM_DMP_SLAVE_TYPE 0x000000C0
169 #define BWFM_DMP_SLAVE_TYPE_S 6
170 #define BWFM_DMP_SLAVE_TYPE_SLAVE 0
171 #define BWFM_DMP_SLAVE_TYPE_BRIDGE 1
172 #define BWFM_DMP_SLAVE_TYPE_SWRAP 2
173 #define BWFM_DMP_SLAVE_TYPE_MWRAP 3
174 #define BWFM_DMP_SLAVE_SIZE_TYPE 0x00000030
175 #define BWFM_DMP_SLAVE_SIZE_TYPE_S 4
176 #define BWFM_DMP_SLAVE_SIZE_4K 0
177 #define BWFM_DMP_SLAVE_SIZE_8K 1
178 #define BWFM_DMP_SLAVE_SIZE_16K 2
179 #define BWFM_DMP_SLAVE_SIZE_DESC 3
180
181 /* Security Parameters */
182 #define BWFM_AUTH_OPEN 0
183 #define BWFM_AUTH_SHARED_KEY 1
184 #define BWFM_AUTH_AUTO 2
185 #define BWFM_CRYPTO_ALGO_OFF 0
186 #define BWFM_CRYPTO_ALGO_WEP1 1
187 #define BWFM_CRYPTO_ALGO_TKIP 2
188 #define BWFM_CRYPTO_ALGO_WEP128 3
189 #define BWFM_CRYPTO_ALGO_AES_CCM 4
190 #define BWFM_CRYPTO_ALGO_AES_RESERVED1 5
191 #define BWFM_CRYPTO_ALGO_AES_RESERVED2 6
192 #define BWFM_MFP_NONE 0
193 #define BWFM_MFP_CAPABLE 1
194 #define BWFM_MFP_REQUIRED 2
195 #define BWFM_WPA_AUTH_DISABLED (0 << 0)
196 #define BWFM_WPA_AUTH_NONE (1 << 0)
197 #define BWFM_WPA_AUTH_WPA_UNSPECIFIED (1 << 1)
198 #define BWFM_WPA_AUTH_WPA_PSK (1 << 2)
199 #define BWFM_WPA_AUTH_WPA2_UNSPECIFIED (1 << 6)
200 #define BWFM_WPA_AUTH_WPA2_PSK (1 << 7)
201 #define BWFM_WPA_AUTH_WPA2_1X_SHA256 (1 << 12)
202 #define BWFM_WPA_AUTH_WPA2_PSK_SHA256 (1 << 15)
203 #define BWFM_WSEC_NONE (0 << 0)
204 #define BWFM_WSEC_WEP (1 << 0)
205 #define BWFM_WSEC_TKIP (1 << 1)
206 #define BWFM_WSEC_AES (1 << 2)
207
208 /* Channel Parameters */
209 #define BWFM_CHANSPEC_CHAN_MASK 0xff
210 #define BWFM_CHANSPEC_CHAN_SHIFT 0
211 #define BWFM_CHANSPEC_D11N_SB_L (0x1 << 8) /* control lower */
212 #define BWFM_CHANSPEC_D11N_SB_U (0x2 << 8) /* control lower */
213 #define BWFM_CHANSPEC_D11N_SB_N (0x3 << 8) /* none */
214 #define BWFM_CHANSPEC_D11N_SB_MASK (0x3 << 8)
215 #define BWFM_CHANSPEC_D11N_SB_SHIFT 8
216 #define BWFM_CHANSPEC_D11N_BW_10 (0x1 << 10)
217 #define BWFM_CHANSPEC_D11N_BW_20 (0x2 << 10)
218 #define BWFM_CHANSPEC_D11N_BW_40 (0x3 << 10)
219 #define BWFM_CHANSPEC_D11N_BW_MASK (0x3 << 10)
220 #define BWFM_CHANSPEC_D11N_BW_SHIFT 10
221 #define BWFM_CHANSPEC_D11N_BND_5G (0x1 << 12)
222 #define BWFM_CHANSPEC_D11N_BND_2G (0x2 << 12)
223 #define BWFM_CHANSPEC_D11N_BND_MASK (0x3 << 12)
224 #define BWFM_CHANSPEC_D11N_BND_SHIFT 12
225 #define BWFM_CHANSPEC_D11AC_SB_LLL (0x0 << 8)
226 #define BWFM_CHANSPEC_D11AC_SB_LLU (0x1 << 8)
227 #define BWFM_CHANSPEC_D11AC_SB_LUL (0x2 << 8)
228 #define BWFM_CHANSPEC_D11AC_SB_LUU (0x3 << 8)
229 #define BWFM_CHANSPEC_D11AC_SB_ULL (0x4 << 8)
230 #define BWFM_CHANSPEC_D11AC_SB_ULU (0x5 << 8)
231 #define BWFM_CHANSPEC_D11AC_SB_UUL (0x6 << 8)
232 #define BWFM_CHANSPEC_D11AC_SB_UUU (0x7 << 8)
233 #define BWFM_CHANSPEC_D11AC_SB_MASK (0x7 << 8)
234 #define BWFM_CHANSPEC_D11AC_SB_SHIFT 8
235 #define BWFM_CHANSPEC_D11AC_BW_5 (0x0 << 11)
236 #define BWFM_CHANSPEC_D11AC_BW_10 (0x1 << 11)
237 #define BWFM_CHANSPEC_D11AC_BW_20 (0x2 << 11)
238 #define BWFM_CHANSPEC_D11AC_BW_40 (0x3 << 11)
239 #define BWFM_CHANSPEC_D11AC_BW_80 (0x4 << 11)
240 #define BWFM_CHANSPEC_D11AC_BW_160 (0x5 << 11)
241 #define BWFM_CHANSPEC_D11AC_BW_8080 (0x6 << 11)
242 #define BWFM_CHANSPEC_D11AC_BW_MASK (0x7 << 11)
243 #define BWFM_CHANSPEC_D11AC_BW_SHIFT 11
244 #define BWFM_CHANSPEC_D11AC_BND_2G (0x0 << 14)
245 #define BWFM_CHANSPEC_D11AC_BND_3G (0x1 << 14)
246 #define BWFM_CHANSPEC_D11AC_BND_4G (0x2 << 14)
247 #define BWFM_CHANSPEC_D11AC_BND_5G (0x3 << 14)
248 #define BWFM_CHANSPEC_D11AC_BND_MASK (0x3 << 14)
249 #define BWFM_CHANSPEC_D11AC_BND_SHIFT 14
250
251 #define BWFM_BAND_AUTO 0
252 #define BWFM_BAND_5G 1
253 #define BWFM_BAND_2G 2
254 #define BWFM_BAND_ALL 3
255
256 /* Power Modes */
257 #define BWFM_PM_CAM 0
258 #define BWFM_PM_PS 1
259 #define BWFM_PM_FAST_PS 2
260
261 /* DCMD commands */
262 #define BWFM_C_GET_VERSION 1
263 #define BWFM_C_UP 2
264 #define BWFM_C_DOWN 3
265 #define BWFM_C_SET_PROMISC 10
266 #define BWFM_C_GET_RATE 12
267 #define BWFM_C_GET_INFRA 19
268 #define BWFM_C_SET_INFRA 20
269 #define BWFM_C_GET_AUTH 21
270 #define BWFM_C_SET_AUTH 22
271 #define BWFM_C_GET_BSSID 23
272 #define BWFM_C_GET_SSID 25
273 #define BWFM_C_SET_SSID 26
274 #define BWFM_C_TERMINATED 28
275 #define BWFM_C_GET_CHANNEL 29
276 #define BWFM_C_SET_CHANNEL 30
277 #define BWFM_C_GET_SRL 31
278 #define BWFM_C_SET_SRL 32
279 #define BWFM_C_GET_LRL 33
280 #define BWFM_C_SET_LRL 34
281 #define BWFM_C_GET_RADIO 37
282 #define BWFM_C_SET_RADIO 38
283 #define BWFM_C_GET_PHYTYPE 39
284 #define BWFM_C_SET_KEY 45
285 #define BWFM_C_GET_REGULATORY 46
286 #define BWFM_C_SET_REGULATORY 47
287 #define BWFM_C_SET_PASSIVE_SCAN 49
288 #define BWFM_C_SCAN 50
289 #define BWFM_C_SCAN_RESULTS 51
290 #define BWFM_C_DISASSOC 52
291 #define BWFM_C_REASSOC 53
292 #define BWFM_C_SET_ROAM_TRIGGER 55
293 #define BWFM_C_SET_ROAM_DELTA 57
294 #define BWFM_C_GET_BCNPRD 75
295 #define BWFM_C_SET_BCNPRD 76
296 #define BWFM_C_GET_DTIMPRD 77
297 #define BWFM_C_SET_DTIMPRD 78
298 #define BWFM_C_SET_COUNTRY 84
299 #define BWFM_C_GET_PM 85
300 #define BWFM_C_SET_PM 86
301 #define BWFM_C_GET_REVINFO 98
302 #define BWFM_C_GET_CURR_RATESET 114
303 #define BWFM_C_GET_AP 117
304 #define BWFM_C_SET_AP 118
305 #define BWFM_C_SET_SCB_AUTHORIZE 121
306 #define BWFM_C_SET_SCB_DEAUTHORIZE 122
307 #define BWFM_C_GET_RSSI 127
308 #define BWFM_C_GET_WSEC 133
309 #define BWFM_C_SET_WSEC 134
310 #define BWFM_C_GET_PHY_NOISE 135
311 #define BWFM_C_GET_BSS_INFO 136
312 #define BWFM_C_GET_GET_PKTCNTS 137
313 #define BWFM_C_GET_BANDLIST 140
314 #define BWFM_C_SET_SCB_TIMEOUT 158
315 #define BWFM_C_GET_ASSOCLIST 159
316 #define BWFM_C_GET_PHYLIST 180
317 #define BWFM_C_SET_SCAN_CHANNEL_TIME 185
318 #define BWFM_C_SET_SCAN_UNASSOC_TIME 187
319 #define BWFM_C_SCB_DEAUTHENTICATE_FOR_REASON 201
320 #define BWFM_C_SET_ASSOC_PREFER 205
321 #define BWFM_C_GET_VALID_CHANNELS 217
322 #define BWFM_C_GET_KEY_PRIMARY 235
323 #define BWFM_C_SET_KEY_PRIMARY 236
324 #define BWFM_C_SET_SCAN_PASSIVE_TIME 258
325 #define BWFM_C_GET_VAR 262
326 #define BWFM_C_SET_VAR 263
327 #define BWFM_C_SET_WSEC_PMK 268
328
329 /* Small, medium, and maximum buffer size for dcmd */
330 #define BWFM_DCMD_SMLEN 256
331 #define BWFM_DCMD_MEDLEN 1536
332 #define BWFM_DCMD_MAXLEN 8192
333
334 struct bwfm_proto_bcdc_dcmd {
335 struct {
336 uint32_t cmd;
337 uint32_t len;
338 uint32_t flags;
339 #define BWFM_BCDC_DCMD_ERROR (1 << 0)
340 #define BWFM_BCDC_DCMD_GET (0 << 1)
341 #define BWFM_BCDC_DCMD_SET (1 << 1)
342 #define BWFM_BCDC_DCMD_IF_GET(x) (((x) >> 12) & 0xf)
343 #define BWFM_BCDC_DCMD_IF_SET(x) (((x) & 0xf) << 12)
344 #define BWFM_BCDC_DCMD_ID_GET(x) (((x) >> 16) & 0xffff)
345 #define BWFM_BCDC_DCMD_ID_SET(x) (((x) & 0xffff) << 16)
346 uint32_t status;
347 } hdr;
348 char buf[8192];
349 };
350
351 struct bwfm_proto_bcdc_hdr {
352 uint8_t flags;
353 #define BWFM_BCDC_FLAG_PROTO_VER 2
354 #define BWFM_BCDC_FLAG_VER(x) (((x) & 0xf) << 4)
355 #define BWFM_BCDC_FLAG_SUM_GOOD (1 << 2) /* rx */
356 #define BWFM_BCDC_FLAG_SUM_NEEDED (1 << 3) /* tx */
357 uint8_t priority;
358 #define BWFM_BCDC_PRIORITY_MASK 0x7
359 uint8_t flags2;
360 #define BWFM_BCDC_FLAG2_IF_MASK 0xf
361 uint8_t data_offset;
362 };
363
364 #define BWFM_MCSSET_LEN 16
365 #define BWFM_MAX_SSID_LEN 32
366 #define BWFM_BSS_INFO_BUFLEN 2048
367 struct bwfm_bss_info {
368 uint32_t version;
369 uint32_t length;
370 uint8_t bssid[ETHER_ADDR_LEN];
371 uint16_t beacon_period;
372 uint16_t capability;
373 uint8_t ssid_len;
374 uint8_t ssid[BWFM_MAX_SSID_LEN];
375 uint32_t nrates;
376 uint8_t rates[16];
377 uint16_t chanspec;
378 uint16_t atim_window;
379 uint8_t dtim_period;
380 uint16_t rssi;
381 uint8_t phy_noise;
382 uint8_t n_cap;
383 uint32_t nbss_cap;
384 uint8_t ctl_ch;
385 uint32_t reserved32[1];
386 uint8_t flags;
387 uint8_t reserved[3];
388 uint8_t basic_mcs[BWFM_MCSSET_LEN];
389 uint16_t ie_offset;
390 uint32_t ie_length;
391 uint16_t snr;
392 };
393
394 struct bwfm_ssid {
395 uint32_t len;
396 uint8_t ssid[BWFM_MAX_SSID_LEN];
397 };
398
399 struct bwfm_scan_params {
400 struct bwfm_ssid ssid;
401 uint8_t bssid[ETHER_ADDR_LEN];
402 uint8_t bss_type;
403 #define DOT11_BSSTYPE_ANY 2
404 uint8_t scan_type;
405 #define BWFM_SCANTYPE_ACTIVE 0
406 #define BWFM_SCANTYPE_PASSIVE 1
407 #define BWFM_SCANTYPE_DEFAULT 0xff
408 uint32_t nprobes;
409 uint32_t active_time;
410 uint32_t passive_time;
411 uint32_t home_time;
412 uint32_t channel_num;
413 uint16_t channel_list[];
414 };
415
416 struct bwfm_scan_results {
417 uint32_t buflen;
418 uint32_t version;
419 uint32_t count;
420 struct bwfm_bss_info bss_info[];
421 };
422
423 struct bwfm_escan_params {
424 uint32_t version;
425 #define BWFM_ESCAN_REQ_VERSION 1
426 uint16_t action;
427 #define WL_ESCAN_ACTION_START 1
428 #define WL_ESCAN_ACTION_CONTINUE 2
429 #define WL_ESCAN_ACTION_ABORT 3
430 uint16_t sync_id;
431 struct bwfm_scan_params scan_params;
432 };
433
434 struct bwfm_escan_results {
435 uint32_t buflen;
436 uint32_t version;
437 uint16_t sync_id;
438 uint16_t bss_count;
439 struct bwfm_bss_info bss_info[];
440 };
441
442 struct bwfm_assoc_params {
443 uint8_t bssid[ETHER_ADDR_LEN];
444 uint32_t chanspec_num;
445 uint16_t chanspec_list[];
446 };
447
448 struct bwfm_join_pref_params {
449 uint8_t type;
450 #define BWFM_JOIN_PREF_RSSI 1
451 #define BWFM_JOIN_PREF_WPA 2
452 #define BWFM_JOIN_PREF_BAND 3
453 #define BWFM_JOIN_PREF_RSSI_DELTA 4
454 uint8_t len;
455 uint8_t rssi_gain;
456 #define BWFM_JOIN_PREF_RSSI_BOOST 8
457 uint8_t band;
458 #define BWFM_JOIN_PREF_BAND_AUTO 0
459 #define BWFM_JOIN_PREF_BAND_5G 1
460 #define BWFM_JOIN_PREF_BAND_2G 2
461 #define BWFM_JOIN_PREF_BAND_ALL 3
462 };
463
464 struct bwfm_join_params {
465 struct bwfm_ssid ssid;
466 struct bwfm_assoc_params assoc;
467 };
468
469 struct bwfm_join_scan_params {
470 uint8_t scan_type;
471 uint32_t nprobes;
472 uint32_t active_time;
473 uint32_t passive_time;
474 uint32_t home_time;
475 };
476
477 struct bwfm_ext_join_params {
478 struct bwfm_ssid ssid;
479 struct bwfm_join_scan_params scan;
480 struct bwfm_assoc_params assoc;
481 };
482
483 struct bwfm_wsec_pmk {
484 uint16_t key_len;
485 #define BWFM_WSEC_MAX_PSK_LEN 32
486 uint16_t flags;
487 #define BWFM_WSEC_PASSPHRASE (1 << 0)
488 uint8_t key[2 * BWFM_WSEC_MAX_PSK_LEN + 1];
489 };
490
491 struct bwfm_wsec_key {
492 uint32_t index;
493 uint32_t len;
494 uint8_t data[32];
495 uint32_t pad_1[18];
496 uint32_t algo;
497 #define BWFM_CRYPTO_ALGO_OFF 0
498 #define BWFM_CRYPTO_ALGO_WEP1 1
499 #define BWFM_CRYPTO_ALGO_TKIP 2
500 #define BWFM_CRYPTO_ALGO_WEP128 3
501 #define BWFM_CRYPTO_ALGO_AES_CCM 4
502 #define BWFM_CRYPTO_ALGO_AES_RESERVED1 5
503 #define BWFM_CRYPTO_ALGO_AES_RESERVED2 6
504 uint32_t flags;
505 #define BWFM_PRIMARY_KEY (1 << 1)
506 uint32_t pad_2[3];
507 uint32_t iv_initialized;
508 uint32_t pad_3;
509 struct {
510 uint32_t hi;
511 uint16_t lo;
512 } rxiv;
513 uint32_t pad_4[2];
514 uint8_t ea[IEEE80211_ADDR_LEN];
515 };
516
517 #define BWFM_BAND_5G 1
518 #define BWFM_BAND_2G 2
519
520 /* Event handling */
521 enum bwfm_fweh_event_code {
522 BWFM_E_SET_SSID = 0,
523 BWFM_E_JOIN = 1,
524 BWFM_E_START = 2,
525 BWFM_E_AUTH = 3,
526 BWFM_E_AUTH_IND = 4,
527 BWFM_E_DEAUTH = 5,
528 BWFM_E_DEAUTH_IND = 6,
529 BWFM_E_ASSOC = 7,
530 BWFM_E_ASSOC_IND = 8,
531 BWFM_E_REASSOC = 9,
532 BWFM_E_REASSOC_IND = 10,
533 BWFM_E_DISASSOC = 11,
534 BWFM_E_DISASSOC_IND = 12,
535 BWFM_E_QUIET_START = 13,
536 BWFM_E_QUIET_END = 14,
537 BWFM_E_BEACON_RX = 15,
538 BWFM_E_LINK = 16,
539 BWFM_E_MIC_ERROR = 17,
540 BWFM_E_NDIS_LINK = 18,
541 BWFM_E_ROAM = 19,
542 BWFM_E_TXFAIL = 20,
543 BWFM_E_PMKID_CACHE = 21,
544 BWFM_E_RETROGRADE_TSF = 22,
545 BWFM_E_PRUNE = 23,
546 BWFM_E_AUTOAUTH = 24,
547 BWFM_E_EAPOL_MSG = 25,
548 BWFM_E_SCAN_COMPLETE = 26,
549 BWFM_E_ADDTS_IND = 27,
550 BWFM_E_DELTS_IND = 28,
551 BWFM_E_BCNSENT_IND = 29,
552 BWFM_E_BCNRX_MSG = 30,
553 BWFM_E_BCNLOST_MSG = 31,
554 BWFM_E_ROAM_PREP = 32,
555 BWFM_E_PFN_NET_FOUND = 33,
556 BWFM_E_PFN_NET_LOST = 34,
557 BWFM_E_RESET_COMPLETE = 35,
558 BWFM_E_JOIN_START = 36,
559 BWFM_E_ROAM_START = 37,
560 BWFM_E_ASSOC_START = 38,
561 BWFM_E_IBSS_ASSOC = 39,
562 BWFM_E_RADIO = 40,
563 BWFM_E_PSM_WATCHDOG = 41,
564 BWFM_E_PROBREQ_MSG = 44,
565 BWFM_E_SCAN_CONFIRM_IND = 45,
566 BWFM_E_PSK_SUP = 46,
567 BWFM_E_COUNTRY_CODE_CHANGED = 47,
568 BWFM_E_EXCEEDED_MEDIUM_TIME = 48,
569 BWFM_E_ICV_ERROR = 49,
570 BWFM_E_UNICAST_DECODE_ERROR = 50,
571 BWFM_E_MULTICAST_DECODE_ERROR = 51,
572 BWFM_E_TRACE = 52,
573 BWFM_E_IF = 54,
574 BWFM_E_P2P_DISC_LISTEN_COMPLETE = 55,
575 BWFM_E_RSSI = 56,
576 BWFM_E_EXTLOG_MSG = 58,
577 BWFM_E_ACTION_FRAME = 59,
578 BWFM_E_ACTION_FRAME_COMPLETE = 60,
579 BWFM_E_PRE_ASSOC_IND = 61,
580 BWFM_E_PRE_REASSOC_IND = 62,
581 BWFM_E_CHANNEL_ADOPTED = 63,
582 BWFM_E_AP_STARTED = 64,
583 BWFM_E_DFS_AP_STOP = 65,
584 BWFM_E_DFS_AP_RESUME = 66,
585 BWFM_E_ESCAN_RESULT = 69,
586 BWFM_E_ACTION_FRAME_OFF_CHAN_COMPLETE = 70,
587 BWFM_E_PROBERESP_MSG = 71,
588 BWFM_E_P2P_PROBEREQ_MSG = 72,
589 BWFM_E_DCS_REQUEST = 73,
590 BWFM_E_FIFO_CREDIT_MAP = 74,
591 BWFM_E_ACTION_FRAME_RX = 75,
592 BWFM_E_TDLS_PEER_EVENT = 92,
593 BWFM_E_BCMC_CREDIT_SUPPORT = 127,
594 BWFM_E_LAST = 139
595 };
596 #define BWFM_EVENT_MASK_LEN (roundup(BWFM_E_LAST, 8) / 8)
597
598 enum bwfm_fweh_event_status {
599 BWFM_E_STATUS_SUCCESS = 0,
600 BWFM_E_STATUS_FAIL = 1,
601 BWFM_E_STATUS_TIMEOUT = 2,
602 BWFM_E_STATUS_NO_NETWORKS = 3,
603 BWFM_E_STATUS_ABORT = 4,
604 BWFM_E_STATUS_NO_ACK = 5,
605 BWFM_E_STATUS_UNSOLICITED = 6,
606 BWFM_E_STATUS_ATTEMPT = 7,
607 BWFM_E_STATUS_PARTIAL = 8,
608 BWFM_E_STATUS_NEWSCAN = 9,
609 BWFM_E_STATUS_NEWASSOC = 10,
610 BWFM_E_STATUS_11HQUIET = 11,
611 BWFM_E_STATUS_SUPPRESS = 12,
612 BWFM_E_STATUS_NOCHANS = 13,
613 BWFM_E_STATUS_CS_ABORT = 15,
614 BWFM_E_STATUS_ERROR = 16,
615 };
616
617 struct bwfm_ethhdr {
618 uint16_t subtype;
619 uint16_t length;
620 uint8_t version;
621 uint8_t oui[3];
622 #define BWFM_BRCM_OUI "\x00\x10\x18"
623 uint16_t usr_subtype;
624 #define BWFM_BRCM_SUBTYPE_EVENT 1
625 };
626
627 struct bwfm_event_msg {
628 uint16_t version;
629 uint16_t flags;
630 uint32_t event_type;
631 uint32_t status;
632 uint32_t reason;
633 uint32_t auth_type;
634 uint32_t datalen;
635 struct ether_addr addr;
636 char ifname[IFNAMSIZ];
637 uint8_t ifidx;
638 uint8_t bsscfgidx;
639 };
640
641 struct bwfm_event {
642 struct ether_header ehdr;
643 #define BWFM_ETHERTYPE_LINK_CTL 0x886c
644 struct bwfm_ethhdr hdr;
645 struct bwfm_event_msg msg;
646 } __packed;
647