dhd: import wifi and bluetooth firmware
[GitHub/LineageOS/G12/android_hardware_amlogic_kernel-modules_dhd-driver.git] / bcmdhd.101.10.240.x / dhd_config.h
CommitLineData
1b4a7c03
LJ
1
2#ifndef _dhd_config_
3#define _dhd_config_
4
5#include <bcmdevs.h>
6#include <siutils.h>
7#include <dngl_stats.h>
8#include <dhd.h>
9#include <wlioctl.h>
10#include <802.11.h>
11
12#define FW_TYPE_STA 0
13#define FW_TYPE_APSTA 1
14#define FW_TYPE_P2P 2
15#define FW_TYPE_MESH 3
16#define FW_TYPE_ES 4
17#define FW_TYPE_MFG 5
18#define FW_TYPE_MINIME 6
19#define FW_TYPE_G 0
20#define FW_TYPE_AG 1
21
22#define FW_PATH_AUTO_SELECT 1
23//#define CONFIG_PATH_AUTO_SELECT
24extern char firmware_path[MOD_PARAM_PATHLEN];
25#if defined(BCMSDIO) || defined(BCMPCIE)
26extern uint dhd_rxbound;
27extern uint dhd_txbound;
28#endif
29#ifdef BCMSDIO
30#define TXGLOM_RECV_OFFSET 8
31extern uint dhd_doflow;
32extern uint dhd_slpauto;
33#endif
34
35typedef struct wl_mac_range {
36 uint32 oui;
37 uint32 nic_start;
38 uint32 nic_end;
39} wl_mac_range_t;
40
41typedef struct wl_mac_list {
42 int count;
43 wl_mac_range_t *mac;
44 char name[MOD_PARAM_PATHLEN];
45} wl_mac_list_t;
46
47typedef struct wl_mac_list_ctrl {
48 int count;
49 struct wl_mac_list *m_mac_list_head;
50} wl_mac_list_ctrl_t;
51
52typedef struct wl_chip_nv_path {
53 uint chip;
54 uint chiprev;
55 char name[MOD_PARAM_PATHLEN];
56} wl_chip_nv_path_t;
57
58typedef struct wl_chip_nv_path_list_ctrl {
59 int count;
60 struct wl_chip_nv_path *m_chip_nv_path_head;
61} wl_chip_nv_path_list_ctrl_t;
62
63typedef struct wl_channel_list {
64 uint32 count;
65 uint32 channel[WL_NUMCHANNELS];
66} wl_channel_list_t;
67
68typedef struct wmes_param {
69 int aifsn[AC_COUNT];
70 int ecwmin[AC_COUNT];
71 int ecwmax[AC_COUNT];
72 int txop[AC_COUNT];
73} wme_param_t;
74
75#ifdef PKT_FILTER_SUPPORT
76#define DHD_CONF_FILTER_MAX 8
77#define PKT_FILTER_LEN 300
78#define MAGIC_PKT_FILTER_LEN 450
79typedef struct conf_pkt_filter_add {
80 uint32 count;
81 char filter[DHD_CONF_FILTER_MAX][PKT_FILTER_LEN];
82} conf_pkt_filter_add_t;
83
84typedef struct conf_pkt_filter_del {
85 uint32 count;
86 uint32 id[DHD_CONF_FILTER_MAX];
87} conf_pkt_filter_del_t;
88#endif
89
90#define CONFIG_COUNTRY_LIST_SIZE 500
91typedef struct country_list {
92 struct country_list *next;
93 wl_country_t cspec;
94} country_list_t;
95
96/* mchan_params */
97#define MCHAN_MAX_NUM 4
98#define MIRACAST_SOURCE 1
99#define MIRACAST_SINK 2
100typedef struct mchan_params {
101 struct mchan_params *next;
102 int bw;
103 int p2p_mode;
104 int miracast_mode;
105} mchan_params_t;
106
107enum in4way_flags {
108 NO_SCAN_IN4WAY = (1 << (0)),
109 NO_BTC_IN4WAY = (1 << (1)),
110 DONT_DELETE_GC_AFTER_WPS = (1 << (2)),
111 WAIT_DISCONNECTED = (1 << (3)),
112};
113
114enum in_suspend_flags {
115 NO_EVENT_IN_SUSPEND = (1 << (0)),
116 NO_TXDATA_IN_SUSPEND = (1 << (1)),
117 NO_TXCTL_IN_SUSPEND = (1 << (2)),
118 AP_DOWN_IN_SUSPEND = (1 << (3)),
119 ROAM_OFFLOAD_IN_SUSPEND = (1 << (4)),
120 AP_FILTER_IN_SUSPEND = (1 << (5)),
121 WOWL_IN_SUSPEND = (1 << (6)),
122 ALL_IN_SUSPEND = 0xFFFFFFFF,
123};
124
125enum in_suspend_mode {
126 EARLY_SUSPEND = 0,
127 PM_NOTIFIER = 1
128};
129
130#ifdef HOST_TPUT_TEST
131enum data_drop_mode {
132 NO_DATA_DROP = 0,
133 TXPKT_DROP = 1,
134 XMIT_DROP = 2
135};
136#endif
137
138enum eapol_status {
139 EAPOL_STATUS_NONE = 0,
140 EAPOL_STATUS_REQID = 1,
141 EAPOL_STATUS_RSPID = 2,
142 EAPOL_STATUS_WSC_START = 3,
143 EAPOL_STATUS_WPS_M1 = 4,
144 EAPOL_STATUS_WPS_M2 = 5,
145 EAPOL_STATUS_WPS_M3 = 6,
146 EAPOL_STATUS_WPS_M4 = 7,
147 EAPOL_STATUS_WPS_M5 = 8,
148 EAPOL_STATUS_WPS_M6 = 9,
149 EAPOL_STATUS_WPS_M7 = 10,
150 EAPOL_STATUS_WPS_M8 = 11,
151 EAPOL_STATUS_WSC_DONE = 12,
152 EAPOL_STATUS_4WAY_START = 13,
153 EAPOL_STATUS_4WAY_M1 = 14,
154 EAPOL_STATUS_4WAY_M2 = 15,
155 EAPOL_STATUS_4WAY_M3 = 16,
156 EAPOL_STATUS_4WAY_M4 = 17,
157 EAPOL_STATUS_GROUPKEY_M1 = 18,
158 EAPOL_STATUS_GROUPKEY_M2 = 19,
159 EAPOL_STATUS_4WAY_DONE = 20
160};
161
162typedef struct dhd_conf {
163 uint chip;
164 uint chiprev;
165#ifdef GET_OTP_MODULE_NAME
166 char module_name[16];
167#endif
168 struct ether_addr otp_mac;
169 int fw_type;
170#ifdef BCMSDIO
171 wl_mac_list_ctrl_t fw_by_mac;
172 wl_mac_list_ctrl_t nv_by_mac;
173#endif
174 wl_chip_nv_path_list_ctrl_t nv_by_chip;
175 country_list_t *country_head;
176 int band;
177 int bw_cap[2];
178 wl_country_t cspec;
179 wl_channel_list_t channels;
180 uint roam_off;
181 uint roam_off_suspend;
182 int roam_trigger[2];
183 int roam_scan_period[2];
184 int roam_delta[2];
185 int fullroamperiod;
186 uint keep_alive_period;
187#ifdef ARP_OFFLOAD_SUPPORT
188 bool garp;
189#endif
190 int force_wme_ac;
191 wme_param_t wme_sta;
192 wme_param_t wme_ap;
193#ifdef PKT_FILTER_SUPPORT
194 conf_pkt_filter_add_t pkt_filter_add;
195 conf_pkt_filter_del_t pkt_filter_del;
196 char *magic_pkt_filter_add;
197#endif
198 int srl;
199 int lrl;
200 uint bcn_timeout;
201 int disable_proptx;
202 int dhd_poll;
203#ifdef BCMSDIO
204 int use_rxchain;
205 bool bus_rxglom;
206 bool txglom_ext; /* Only for 43362/4330/43340/43341/43241 */
207 /* terence 20161011:
208 1) conf->tx_max_offset = 1 to fix credict issue in adaptivity testing
209 2) conf->tx_max_offset = 1 will cause to UDP Tx not work in rxglom supported,
210 but not happened in sw txglom
211 */
212 int tx_max_offset;
213 uint txglomsize;
214 int txctl_tmo_fix;
215 bool txglom_mode;
216 uint deferred_tx_len;
217 /*txglom_bucket_size:
218 * 43362/4330: 1680
219 * 43340/43341/43241: 1684
220 */
221 int txglom_bucket_size;
222 int txinrx_thres;
223 int dhd_txminmax; // -1=DATABUFCNT(bus)
224 bool oob_enabled_later;
225#ifdef MINIME
226 uint32 ramsize;
227#endif
228#if defined(SDIO_ISR_THREAD)
229 bool intr_extn;
230#endif
231#ifdef BCMSDIO_RXLIM_POST
232 bool rxlim_en;
233#endif
234#endif
235#ifdef BCMPCIE
236 int bus_deepsleep_disable;
237#endif
238 int dpc_cpucore;
239 int rxf_cpucore;
240 int frameburst;
241 bool deepsleep;
242 int pm;
243 int pm_in_suspend;
244 int suspend_mode;
245 int suspend_bcn_li_dtim;
246#ifdef DHDTCPACK_SUPPRESS
247 uint8 tcpack_sup_mode;
248#endif
249 int pktprio8021x;
250 uint insuspend;
251 bool suspended;
252#ifdef SUSPEND_EVENT
253 char resume_eventmask[WL_EVENTING_MASK_LEN];
254 struct ether_addr bssid_insuspend;
255 bool wlfc;
256#endif
257#ifdef IDHCP
258 int dhcpc_enable;
259 int dhcpd_enable;
260 struct ipv4_addr dhcpd_ip_addr;
261 struct ipv4_addr dhcpd_ip_mask;
262 struct ipv4_addr dhcpd_ip_start;
263 struct ipv4_addr dhcpd_ip_end;
264#endif
265#ifdef ISAM_PREINIT
266 char isam_init[50];
267 char isam_config[300];
268 char isam_enable[50];
269#endif
270 int ctrl_resched;
271 mchan_params_t *mchan;
272 char *wl_preinit;
273 char *wl_suspend;
274 char *wl_resume;
275 int tsq;
276 int orphan_move;
277 uint eapol_status;
278 uint in4way;
279#ifdef WL_EXT_WOWL
280 uint wowl;
281#endif
282#ifdef GET_CUSTOM_MAC_FROM_CONFIG
283 char hw_ether[62];
284#endif
285 wait_queue_head_t event_complete;
286#ifdef PROPTX_MAXCOUNT
287 int proptx_maxcnt_2g;
288 int proptx_maxcnt_5g;
289#endif /* DYNAMIC_PROPTX_MAXCOUNT */
290#ifdef HOST_TPUT_TEST
291 int data_drop_mode;
292#endif
293} dhd_conf_t;
294
295#ifdef BCMSDIO
296void dhd_conf_get_otp(dhd_pub_t *dhd, bcmsdh_info_t *sdh, si_t *sih);
297#if defined(HW_OOB) || defined(FORCE_WOWLAN)
298void dhd_conf_set_hw_oob_intr(bcmsdh_info_t *sdh, struct si_pub *sih);
299#endif
300void dhd_conf_set_txglom_params(dhd_pub_t *dhd, bool enable);
301#endif
302void dhd_conf_set_path_params(dhd_pub_t *dhd, char *fw_path, char *nv_path);
303int dhd_conf_set_intiovar(dhd_pub_t *dhd, uint cmd, char *name, int val,
304 int def, bool down);
305int dhd_conf_get_band(dhd_pub_t *dhd);
306int dhd_conf_set_country(dhd_pub_t *dhd, wl_country_t *cspec);
307int dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec);
308int dhd_conf_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec);
309#ifdef CCODE_LIST
310int dhd_ccode_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec);
311#endif
312int dhd_conf_fix_country(dhd_pub_t *dhd);
313bool dhd_conf_match_channel(dhd_pub_t *dhd, uint32 channel);
314void dhd_conf_set_wme(dhd_pub_t *dhd, int ifidx, int mode);
315void dhd_conf_set_mchan_bw(dhd_pub_t *dhd, int go, int source);
316void dhd_conf_add_pkt_filter(dhd_pub_t *dhd);
317bool dhd_conf_del_pkt_filter(dhd_pub_t *dhd, uint32 id);
318void dhd_conf_discard_pkt_filter(dhd_pub_t *dhd);
319int dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path);
320int dhd_conf_set_chiprev(dhd_pub_t *dhd, uint chip, uint chiprev);
321uint dhd_conf_get_chip(void *context);
322uint dhd_conf_get_chiprev(void *context);
323int dhd_conf_get_pm(dhd_pub_t *dhd);
324int dhd_conf_check_hostsleep(dhd_pub_t *dhd, int cmd, void *buf, int len,
325 int *hostsleep_set, int *hostsleep_val, int *ret);
326void dhd_conf_get_hostsleep(dhd_pub_t *dhd,
327 int hostsleep_set, int hostsleep_val, int ret);
328int dhd_conf_mkeep_alive(dhd_pub_t *dhd, int ifidx, int id, int period,
329 char *packet, bool bcast);
330#ifdef ARP_OFFLOAD_SUPPORT
331void dhd_conf_set_garp(dhd_pub_t *dhd, int ifidx, uint32 ipa, bool enable);
332#endif
333#ifdef PROP_TXSTATUS
334int dhd_conf_get_disable_proptx(dhd_pub_t *dhd);
335#endif
336uint dhd_conf_get_insuspend(dhd_pub_t *dhd, uint mask);
337int dhd_conf_set_suspend_resume(dhd_pub_t *dhd, int suspend);
338void dhd_conf_postinit_ioctls(dhd_pub_t *dhd);
339int dhd_conf_preinit(dhd_pub_t *dhd);
340int dhd_conf_reset(dhd_pub_t *dhd);
341int dhd_conf_attach(dhd_pub_t *dhd);
342void dhd_conf_detach(dhd_pub_t *dhd);
343void *dhd_get_pub(struct net_device *dev);
344int wl_pattern_atoh(char *src, char *dst);
345#ifdef BCMSDIO
346extern int dhd_bus_sleep(dhd_pub_t *dhdp, bool sleep, uint32 *intstatus);
347#endif
348#endif /* _dhd_config_ */