1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3 *
4 * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
5 *
6 ******************************************************************************/
7 /*-------------------------------------------------------------------------------
8
9 For type defines and data structure defines
10
11 --------------------------------------------------------------------------------*/
12
13
14 #ifndef __DRV_TYPES_H__
15 #define __DRV_TYPES_H__
16
17 #include <linux/version.h>
18 #include <linux/sched/signal.h>
19 #include <autoconf.h>
20 #include <basic_types.h>
21 #include <osdep_service.h>
22 #include <rtw_byteorder.h>
23 #include <wlan_bssdef.h>
24 #include <wifi.h>
25 #include <ieee80211.h>
26
27 enum _NIC_VERSION {
28
29 RTL8711_NIC,
30 RTL8712_NIC,
31 RTL8713_NIC,
32 RTL8716_NIC
33
34 };
35
36 #include <rtw_rf.h>
37
38 #include <rtw_ht.h>
39
40 #include <rtw_cmd.h>
41 #include <cmd_osdep.h>
42 #include <rtw_security.h>
43 #include <rtw_xmit.h>
44 #include <xmit_osdep.h>
45 #include <rtw_recv.h>
46
47 #include <recv_osdep.h>
48 #include <rtw_efuse.h>
49 #include <hal_intf.h>
50 #include <hal_com.h>
51 #include <rtw_qos.h>
52 #include <rtw_pwrctrl.h>
53 #include <rtw_mlme.h>
54 #include <mlme_osdep.h>
55 #include <rtw_io.h>
56 #include <rtw_ioctl.h>
57 #include <rtw_ioctl_set.h>
58 #include <osdep_intf.h>
59 #include <rtw_eeprom.h>
60 #include <sta_info.h>
61 #include <rtw_event.h>
62 #include <rtw_mlme_ext.h>
63 #include <rtw_ap.h>
64 #include <rtw_version.h>
65 #include <rtw_odm.h>
66
67 #include "ioctl_cfg80211.h"
68
69 #include <linux/ip.h>
70 #include <linux/if_ether.h>
71 #include <ethernet.h>
72
73 #define SPEC_DEV_ID_NONE BIT(0)
74 #define SPEC_DEV_ID_DISABLE_HT BIT(1)
75 #define SPEC_DEV_ID_ENABLE_PS BIT(2)
76 #define SPEC_DEV_ID_RF_CONFIG_1T1R BIT(3)
77 #define SPEC_DEV_ID_RF_CONFIG_2T2R BIT(4)
78 #define SPEC_DEV_ID_ASSIGN_IFNAME BIT(5)
79
80 struct specific_device_id {
81
82 u32 flags;
83
84 u16 idVendor;
85 u16 idProduct;
86
87 };
88
89 struct registry_priv {
90 u8 chip_version;
91 u8 rfintfs;
92 u8 lbkmode;
93 u8 hci;
94 struct ndis_802_11_ssid ssid;
95 u8 network_mode; /* infra, ad-hoc, auto */
96 u8 channel;/* ad-hoc support requirement */
97 u8 wireless_mode;/* A, B, G, auto */
98 u8 scan_mode;/* active, passive */
99 u8 radio_enable;
100 u8 preamble;/* long, short, auto */
101 u8 vrtl_carrier_sense;/* Enable, Disable, Auto */
102 u8 vcs_type;/* RTS/CTS, CTS-to-self */
103 u16 rts_thresh;
104 u16 frag_thresh;
105 u8 adhoc_tx_pwr;
106 u8 soft_ap;
107 u8 power_mgnt;
108 u8 ips_mode;
109 u8 smart_ps;
110 u8 usb_rxagg_mode;
111 u8 long_retry_lmt;
112 u8 short_retry_lmt;
113 u16 busy_thresh;
114 u8 ack_policy;
115 u8 mp_dm;
116 u8 software_encrypt;
117 u8 software_decrypt;
118 u8 acm_method;
119 /* UAPSD */
120 u8 wmm_enable;
121 u8 uapsd_enable;
122 u8 uapsd_max_sp;
123 u8 uapsd_acbk_en;
124 u8 uapsd_acbe_en;
125 u8 uapsd_acvi_en;
126 u8 uapsd_acvo_en;
127
128 struct wlan_bssid_ex dev_network;
129
130 u8 ht_enable;
131 /* 0: 20 MHz, 1: 40 MHz, 2: 80 MHz, 3: 160MHz */
132 /* 2.4G use bit 0 ~ 3, 5G use bit 4 ~ 7 */
133 /* 0x21 means enable 2.4G 40MHz & 5G 80MHz */
134 u8 bw_mode;
135 u8 ampdu_enable;/* for tx */
136 u8 rx_stbc;
137 u8 ampdu_amsdu;/* A-MPDU Supports A-MSDU is permitted */
138 /* Short GI support Bit Map */
139 /* BIT0 - 20MHz, 1: support, 0: non-support */
140 /* BIT1 - 40MHz, 1: support, 0: non-support */
141 /* BIT2 - 80MHz, 1: support, 0: non-support */
142 /* BIT3 - 160MHz, 1: support, 0: non-support */
143 u8 short_gi;
144 /* BIT0: Enable VHT LDPC Rx, BIT1: Enable VHT LDPC Tx, BIT4: Enable HT LDPC Rx, BIT5: Enable HT LDPC Tx */
145 u8 ldpc_cap;
146 /* BIT0: Enable VHT STBC Rx, BIT1: Enable VHT STBC Tx, BIT4: Enable HT STBC Rx, BIT5: Enable HT STBC Tx */
147 u8 stbc_cap;
148 /* BIT0: Enable VHT Beamformer, BIT1: Enable VHT Beamformee, BIT4: Enable HT Beamformer, BIT5: Enable HT Beamformee */
149 u8 beamform_cap;
150
151 u8 lowrate_two_xmit;
152
153 u8 rf_config;
154 u8 low_power;
155
156 u8 wifi_spec;/* !turbo_mode */
157
158 u8 channel_plan;
159
160 u8 btcoex;
161 u8 bt_iso;
162 u8 bt_sco;
163 u8 bt_ampdu;
164 s8 ant_num;
165
166 /* false:Reject AP's Add BA req, true:accept AP's Add BA req */
167 bool accept_addba_req;
168
169 u8 antdiv_cfg;
170 u8 antdiv_type;
171
172 u8 usbss_enable;/* 0:disable, 1:enable */
173 u8 hwpdn_mode;/* 0:disable, 1:enable, 2:decide by EFUSE config */
174 u8 hwpwrp_detect;/* 0:disable, 1:enable */
175
176 u8 hw_wps_pbc;/* 0:disable, 1:enable */
177
178 u8 max_roaming_times; /* the max number driver will try to roaming */
179
180 u8 enable80211d;
181
182 u8 ifname[16];
183
184 u8 notch_filter;
185
186 /* define for tx power adjust */
187 u8 RegEnableTxPowerLimit;
188 u8 RegEnableTxPowerByRate;
189 u8 RegPowerBase;
190 u8 RegPwrTblSel;
191 s8 TxBBSwing_2G;
192 s8 TxBBSwing_5G;
193 u8 AmplifierType_2G;
194 u8 AmplifierType_5G;
195 u8 bEn_RFE;
196 u8 RFE_Type;
197 u8 check_fw_ps;
198
199 #ifdef CONFIG_MULTI_VIR_IFACES
200 u8 ext_iface_num;/* primary/secondary iface is excluded */
201 #endif
202 u8 qos_opt_enable;
203
204 u8 hiq_filter;
205 };
206
207
208 /* For registry parameters */
209 #define RGTRY_OFT(field) ((u32)FIELD_OFFSET(struct registry_priv, field))
210 #define RGTRY_SZ(field) sizeof(((struct registry_priv*) 0)->field)
211 #define BSSID_OFT(field) ((u32)FIELD_OFFSET(struct wlan_bssid_ex, field))
212 #define BSSID_SZ(field) sizeof(((struct wlan_bssid_ex *) 0)->field)
213
214 #include <drv_types_sdio.h>
215
216 #define is_primary_adapter(adapter) (1)
217 #define get_iface_type(adapter) (IFACE_PORT0)
218 #define GET_PRIMARY_ADAPTER(padapter) (((struct adapter *)padapter)->dvobj->if1)
219 #define GET_IFACE_NUMS(padapter) (((struct adapter *)padapter)->dvobj->iface_nums)
220 #define GET_ADAPTER(padapter, iface_id) (((struct adapter *)padapter)->dvobj->padapters[iface_id])
221
222 #ifdef CONFIG_DBG_COUNTER
223
224 struct rx_logs {
225 u32 intf_rx;
226 u32 intf_rx_err_recvframe;
227 u32 intf_rx_err_skb;
228 u32 intf_rx_report;
229 u32 core_rx;
230 u32 core_rx_pre;
231 u32 core_rx_pre_ver_err;
232 u32 core_rx_pre_mgmt;
233 u32 core_rx_pre_mgmt_err_80211w;
234 u32 core_rx_pre_mgmt_err;
235 u32 core_rx_pre_ctrl;
236 u32 core_rx_pre_ctrl_err;
237 u32 core_rx_pre_data;
238 u32 core_rx_pre_data_wapi_seq_err;
239 u32 core_rx_pre_data_wapi_key_err;
240 u32 core_rx_pre_data_handled;
241 u32 core_rx_pre_data_err;
242 u32 core_rx_pre_data_unknown;
243 u32 core_rx_pre_unknown;
244 u32 core_rx_enqueue;
245 u32 core_rx_dequeue;
246 u32 core_rx_post;
247 u32 core_rx_post_decrypt;
248 u32 core_rx_post_decrypt_wep;
249 u32 core_rx_post_decrypt_tkip;
250 u32 core_rx_post_decrypt_aes;
251 u32 core_rx_post_decrypt_wapi;
252 u32 core_rx_post_decrypt_hw;
253 u32 core_rx_post_decrypt_unknown;
254 u32 core_rx_post_decrypt_err;
255 u32 core_rx_post_defrag_err;
256 u32 core_rx_post_portctrl_err;
257 u32 core_rx_post_indicate;
258 u32 core_rx_post_indicate_in_oder;
259 u32 core_rx_post_indicate_reoder;
260 u32 core_rx_post_indicate_err;
261 u32 os_indicate;
262 u32 os_indicate_ap_mcast;
263 u32 os_indicate_ap_forward;
264 u32 os_indicate_ap_self;
265 u32 os_indicate_err;
266 u32 os_netif_ok;
267 u32 os_netif_err;
268 };
269
270 struct tx_logs {
271 u32 os_tx;
272 u32 os_tx_err_up;
273 u32 os_tx_err_xmit;
274 u32 os_tx_m2u;
275 u32 os_tx_m2u_ignore_fw_linked;
276 u32 os_tx_m2u_ignore_self;
277 u32 os_tx_m2u_entry;
278 u32 os_tx_m2u_entry_err_xmit;
279 u32 os_tx_m2u_entry_err_skb;
280 u32 os_tx_m2u_stop;
281 u32 core_tx;
282 u32 core_tx_err_pxmitframe;
283 u32 core_tx_err_brtx;
284 u32 core_tx_upd_attrib;
285 u32 core_tx_upd_attrib_adhoc;
286 u32 core_tx_upd_attrib_sta;
287 u32 core_tx_upd_attrib_ap;
288 u32 core_tx_upd_attrib_unknown;
289 u32 core_tx_upd_attrib_dhcp;
290 u32 core_tx_upd_attrib_icmp;
291 u32 core_tx_upd_attrib_active;
292 u32 core_tx_upd_attrib_err_ucast_sta;
293 u32 core_tx_upd_attrib_err_ucast_ap_link;
294 u32 core_tx_upd_attrib_err_sta;
295 u32 core_tx_upd_attrib_err_link;
296 u32 core_tx_upd_attrib_err_sec;
297 u32 core_tx_ap_enqueue_warn_fwstate;
298 u32 core_tx_ap_enqueue_warn_sta;
299 u32 core_tx_ap_enqueue_warn_nosta;
300 u32 core_tx_ap_enqueue_warn_link;
301 u32 core_tx_ap_enqueue_warn_trigger;
302 u32 core_tx_ap_enqueue_mcast;
303 u32 core_tx_ap_enqueue_ucast;
304 u32 core_tx_ap_enqueue;
305 u32 intf_tx;
306 u32 intf_tx_pending_ac;
307 u32 intf_tx_pending_fw_under_survey;
308 u32 intf_tx_pending_fw_under_linking;
309 u32 intf_tx_pending_xmitbuf;
310 u32 intf_tx_enqueue;
311 u32 core_tx_enqueue;
312 u32 core_tx_enqueue_class;
313 u32 core_tx_enqueue_class_err_sta;
314 u32 core_tx_enqueue_class_err_nosta;
315 u32 core_tx_enqueue_class_err_fwlink;
316 u32 intf_tx_direct;
317 u32 intf_tx_direct_err_coalesce;
318 u32 intf_tx_dequeue;
319 u32 intf_tx_dequeue_err_coalesce;
320 u32 intf_tx_dump_xframe;
321 u32 intf_tx_dump_xframe_err_txdesc;
322 u32 intf_tx_dump_xframe_err_port;
323 };
324
325 struct int_logs {
326 u32 all;
327 u32 err;
328 u32 tbdok;
329 u32 tbder;
330 u32 bcnderr;
331 u32 bcndma;
332 u32 bcndma_e;
333 u32 rx;
334 u32 rx_rdu;
335 u32 rx_fovw;
336 u32 txfovw;
337 u32 mgntok;
338 u32 highdok;
339 u32 bkdok;
340 u32 bedok;
341 u32 vidok;
342 u32 vodok;
343 };
344
345 #endif /* CONFIG_DBG_COUNTER */
346
347 struct debug_priv {
348 u32 dbg_sdio_free_irq_error_cnt;
349 u32 dbg_sdio_alloc_irq_error_cnt;
350 u32 dbg_sdio_free_irq_cnt;
351 u32 dbg_sdio_alloc_irq_cnt;
352 u32 dbg_sdio_deinit_error_cnt;
353 u32 dbg_sdio_init_error_cnt;
354 u32 dbg_suspend_error_cnt;
355 u32 dbg_suspend_cnt;
356 u32 dbg_resume_cnt;
357 u32 dbg_resume_error_cnt;
358 u32 dbg_deinit_fail_cnt;
359 u32 dbg_carddisable_cnt;
360 u32 dbg_carddisable_error_cnt;
361 u32 dbg_ps_insuspend_cnt;
362 u32 dbg_dev_unload_inIPS_cnt;
363 u32 dbg_wow_leave_ps_fail_cnt;
364 u32 dbg_scan_pwr_state_cnt;
365 u32 dbg_downloadfw_pwr_state_cnt;
366 u32 dbg_fw_read_ps_state_fail_cnt;
367 u32 dbg_leave_ips_fail_cnt;
368 u32 dbg_leave_lps_fail_cnt;
369 u32 dbg_h2c_leave32k_fail_cnt;
370 u32 dbg_diswow_dload_fw_fail_cnt;
371 u32 dbg_enwow_dload_fw_fail_cnt;
372 u32 dbg_ips_drvopen_fail_cnt;
373 u32 dbg_poll_fail_cnt;
374 u32 dbg_rpwm_toggle_cnt;
375 u32 dbg_rpwm_timeout_fail_cnt;
376 u64 dbg_rx_fifo_last_overflow;
377 u64 dbg_rx_fifo_curr_overflow;
378 u64 dbg_rx_fifo_diff_overflow;
379 u64 dbg_rx_ampdu_drop_count;
380 u64 dbg_rx_ampdu_forced_indicate_count;
381 u64 dbg_rx_ampdu_loss_count;
382 u64 dbg_rx_dup_mgt_frame_drop_count;
383 u64 dbg_rx_ampdu_window_shift_cnt;
384 };
385
386 struct rtw_traffic_statistics {
387 /* tx statistics */
388 u64 tx_bytes;
389 u64 tx_pkts;
390 u64 tx_drop;
391 u64 cur_tx_bytes;
392 u64 last_tx_bytes;
393 u32 cur_tx_tp; /* Tx throughput in MBps. */
394
395 /* rx statistics */
396 u64 rx_bytes;
397 u64 rx_pkts;
398 u64 rx_drop;
399 u64 cur_rx_bytes;
400 u64 last_rx_bytes;
401 u32 cur_rx_tp; /* Rx throughput in MBps. */
402 };
403
404 struct cam_ctl_t {
405 _lock lock;
406 u64 bitmap;
407 };
408
409 struct cam_entry_cache {
410 u16 ctrl;
411 u8 mac[ETH_ALEN];
412 u8 key[16];
413 };
414
415 #define KEY_FMT "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
416 #define KEY_ARG(x) ((u8 *)(x))[0], ((u8 *)(x))[1], ((u8 *)(x))[2], ((u8 *)(x))[3], ((u8 *)(x))[4], ((u8 *)(x))[5], \
417 ((u8 *)(x))[6], ((u8 *)(x))[7], ((u8 *)(x))[8], ((u8 *)(x))[9], ((u8 *)(x))[10], ((u8 *)(x))[11], \
418 ((u8 *)(x))[12], ((u8 *)(x))[13], ((u8 *)(x))[14], ((u8 *)(x))[15]
419
420 struct dvobj_priv {
421 /*-------- below is common data --------*/
422 struct adapter *if1; /* PRIMARY_ADAPTER */
423 struct adapter *if2; /* SECONDARY_ADAPTER */
424
425 s32 processing_dev_remove;
426
427 struct debug_priv drv_dbg;
428
429 /* for local/global synchronization */
430 /* */
431 _lock lock;
432 int macid[NUM_STA];
433
434 _mutex hw_init_mutex;
435 _mutex h2c_fwcmd_mutex;
436 _mutex setch_mutex;
437 _mutex setbw_mutex;
438
439 unsigned char oper_channel; /* saved channel info when call set_channel_bw */
440 unsigned char oper_bwmode;
441 unsigned char oper_ch_offset;/* PRIME_CHNL_OFFSET */
442 unsigned long on_oper_ch_time;
443
444 struct adapter *padapters;
445
446 struct cam_ctl_t cam_ctl;
447 struct cam_entry_cache cam_cache[TOTAL_CAM_ENTRY];
448
449 /* For 92D, DMDP have 2 interface. */
450 u8 InterfaceNumber;
451 u8 NumInterfaces;
452
453 /* In /Out Pipe information */
454 int RtInPipe[2];
455 int RtOutPipe[4];
456 u8 Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */
457
458 u8 irq_alloc;
459 atomic_t continual_io_error;
460
461 atomic_t disable_func;
462
463 struct pwrctrl_priv pwrctl_priv;
464
465 struct rtw_traffic_statistics traffic_stat;
466
467 /*-------- below is for SDIO INTERFACE --------*/
468
469 struct sdio_data intf_data;
470
471 };
472
473 #define dvobj_to_pwrctl(dvobj) (&(dvobj->pwrctl_priv))
474 #define pwrctl_to_dvobj(pwrctl) container_of(pwrctl, struct dvobj_priv, pwrctl_priv)
475
dvobj_to_dev(struct dvobj_priv * dvobj)476 static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
477 {
478 /* todo: get interface type from dvobj and the return the dev accordingly */
479 #ifdef RTW_DVOBJ_CHIP_HW_TYPE
480 #endif
481
482 return &dvobj->intf_data.func->dev;
483 }
484
485 struct adapter *dvobj_get_port0_adapter(struct dvobj_priv *dvobj);
486
487 enum _IFACE_TYPE {
488 IFACE_PORT0, /* mapping to port0 for C/D series chips */
489 IFACE_PORT1, /* mapping to port1 for C/D series chip */
490 MAX_IFACE_PORT,
491 };
492
493 enum ADAPTER_TYPE {
494 PRIMARY_ADAPTER,
495 SECONDARY_ADAPTER,
496 MAX_ADAPTER = 0xFF,
497 };
498
499 typedef enum _DRIVER_STATE {
500 DRIVER_NORMAL = 0,
501 DRIVER_DISAPPEAR = 1,
502 DRIVER_REPLACE_DONGLE = 2,
503 } DRIVER_STATE;
504
505 struct adapter {
506 int DriverState;/* for disable driver using module, use dongle to replace module. */
507 int pid[3];/* process id from UI, 0:wps, 1:hostapd, 2:dhcpcd */
508 int bDongle;/* build-in module or external dongle */
509
510 struct dvobj_priv *dvobj;
511 struct mlme_priv mlmepriv;
512 struct mlme_ext_priv mlmeextpriv;
513 struct cmd_priv cmdpriv;
514 struct evt_priv evtpriv;
515 /* struct io_queue *pio_queue; */
516 struct io_priv iopriv;
517 struct xmit_priv xmitpriv;
518 struct recv_priv recvpriv;
519 struct sta_priv stapriv;
520 struct security_priv securitypriv;
521 _lock security_key_mutex; /* add for CONFIG_IEEE80211W, none 11w also can use */
522 struct registry_priv registrypriv;
523 struct eeprom_priv eeprompriv;
524
525 struct hostapd_priv *phostapdpriv;
526
527 u32 setband;
528
529 void * HalData;
530 u32 hal_data_sz;
531 struct hal_ops HalFunc;
532
533 s32 bDriverStopped;
534 s32 bSurpriseRemoved;
535 s32 bCardDisableWOHSM;
536
537 u32 IsrContent;
538 u32 ImrContent;
539
540 u8 EepromAddressSize;
541 u8 hw_init_completed;
542 u8 bDriverIsGoingToUnload;
543 u8 init_adpt_in_progress;
544 u8 bHaltInProgress;
545
546 void *cmdThread;
547 void *evtThread;
548 void *xmitThread;
549 void *recvThread;
550
551 u32 (*intf_init)(struct dvobj_priv *dvobj);
552 void (*intf_deinit)(struct dvobj_priv *dvobj);
553 int (*intf_alloc_irq)(struct dvobj_priv *dvobj);
554 void (*intf_free_irq)(struct dvobj_priv *dvobj);
555
556
557 void (*intf_start)(struct adapter * adapter);
558 void (*intf_stop)(struct adapter * adapter);
559
560 _nic_hdl pnetdev;
561 char old_ifname[IFNAMSIZ];
562
563 /* used by rtw_rereg_nd_name related function */
564 struct rereg_nd_name_data {
565 _nic_hdl old_pnetdev;
566 char old_ifname[IFNAMSIZ];
567 u8 old_ips_mode;
568 u8 old_bRegUseLed;
569 } rereg_nd_name_priv;
570
571 int bup;
572 struct net_device_stats stats;
573 struct iw_statistics iwstats;
574
575 struct wireless_dev *rtw_wdev;
576 struct rtw_wdev_priv wdev_data;
577
578 int net_closed;
579
580 u8 netif_up;
581
582 u8 bFWReady;
583 u8 bBTFWReady;
584 u8 bLinkInfoDump;
585 u8 bRxRSSIDisplay;
586 /* Added by Albert 2012/10/26 */
587 /* The driver will show up the desired channel number when this flag is 1. */
588 u8 bNotifyChannelChange;
589
590 /* pbuddystruct adapter is used only in two inteface case, (iface_nums =2 in struct dvobj_priv) */
591 /* PRIMARY ADAPTER's buddy is SECONDARY_ADAPTER */
592 /* SECONDARY_ADAPTER's buddy is PRIMARY_ADAPTER */
593 /* for iface_id > SECONDARY_ADAPTER(IFACE_ID1), refer to padapters[iface_id] in struct dvobj_priv */
594 /* and their pbuddystruct adapter is PRIMARY_ADAPTER. */
595 /* for PRIMARY_ADAPTER(IFACE_ID0) can directly refer to if1 in struct dvobj_priv */
596 struct adapter *pbuddy_adapter;
597
598 /* extend to support multi interface */
599 /* IFACE_ID0 is equals to PRIMARY_ADAPTER */
600 /* IFACE_ID1 is equals to SECONDARY_ADAPTER */
601 u8 iface_id;
602
603 /* for debug purpose */
604 u8 fix_rate;
605 u8 driver_vcs_en; /* Enable = 1, Disable = 0 driver control vrtl_carrier_sense for tx */
606 u8 driver_vcs_type;/* force 0:disable VCS, 1:RTS-CTS, 2:CTS-to-self when vcs_en = 1. */
607 u8 driver_ampdu_spacing;/* driver control AMPDU Density for peer sta's rx */
608 u8 driver_rx_ampdu_factor;/* 0xff: disable drv ctrl, 0:8k, 1:16k, 2:32k, 3:64k; */
609
610 unsigned char in_cta_test;
611
612 #ifdef CONFIG_DBG_COUNTER
613 struct rx_logs rx_logs;
614 struct tx_logs tx_logs;
615 struct int_logs int_logs;
616 #endif
617 };
618
619 #define adapter_to_dvobj(adapter) (adapter->dvobj)
620 #define adapter_to_pwrctl(adapter) (dvobj_to_pwrctl(adapter->dvobj))
621 #define adapter_wdev_data(adapter) (&((adapter)->wdev_data))
622
623 /* */
624 /* Function disabled. */
625 /* */
626 #define DF_TX_BIT BIT0
627 #define DF_RX_BIT BIT1
628 #define DF_IO_BIT BIT2
629
630 /* define RTW_DISABLE_FUNC(padapter, func) (atomic_add(&adapter_to_dvobj(padapter)->disable_func, (func))) */
631 /* define RTW_ENABLE_FUNC(padapter, func) (atomic_sub(&adapter_to_dvobj(padapter)->disable_func, (func))) */
RTW_DISABLE_FUNC(struct adapter * padapter,int func_bit)632 static inline void RTW_DISABLE_FUNC(struct adapter *padapter, int func_bit)
633 {
634 int df = atomic_read(&adapter_to_dvobj(padapter)->disable_func);
635 df |= func_bit;
636 atomic_set(&adapter_to_dvobj(padapter)->disable_func, df);
637 }
638
RTW_ENABLE_FUNC(struct adapter * padapter,int func_bit)639 static inline void RTW_ENABLE_FUNC(struct adapter *padapter, int func_bit)
640 {
641 int df = atomic_read(&adapter_to_dvobj(padapter)->disable_func);
642 df &= ~(func_bit);
643 atomic_set(&adapter_to_dvobj(padapter)->disable_func, df);
644 }
645
646 #define RTW_IS_FUNC_DISABLED(padapter, func_bit) (atomic_read(&adapter_to_dvobj(padapter)->disable_func) & (func_bit))
647
648 #define RTW_CANNOT_IO(padapter) \
649 ((padapter)->bSurpriseRemoved || \
650 RTW_IS_FUNC_DISABLED((padapter), DF_IO_BIT))
651
652 #define RTW_CANNOT_RX(padapter) \
653 ((padapter)->bDriverStopped || \
654 (padapter)->bSurpriseRemoved || \
655 RTW_IS_FUNC_DISABLED((padapter), DF_RX_BIT))
656
657 #define RTW_CANNOT_TX(padapter) \
658 ((padapter)->bDriverStopped || \
659 (padapter)->bSurpriseRemoved || \
660 RTW_IS_FUNC_DISABLED((padapter), DF_TX_BIT))
661
662 #ifdef CONFIG_GPIO_API
663 int rtw_get_gpio(struct net_device *netdev, int gpio_num);
664 int rtw_set_gpio_output_value(struct net_device *netdev, int gpio_num, bool isHigh);
665 int rtw_config_gpio(struct net_device *netdev, int gpio_num, bool isOutput);
666 #endif
667
668 #ifdef CONFIG_WOWLAN
669 void rtw_suspend_wow(struct adapter *padapter);
670 int rtw_resume_process_wow(struct adapter *padapter);
671 #endif
672
myid(struct eeprom_priv * peepriv)673 static inline u8 *myid(struct eeprom_priv *peepriv)
674 {
675 return peepriv->mac_addr;
676 }
677
678 /* HCI Related header file */
679 #include <sdio_osintf.h>
680 #include <sdio_ops.h>
681 #include <sdio_hal.h>
682
683 #include <rtw_btcoex.h>
684
685 void rtw_indicate_wx_disassoc_event(struct adapter *padapter);
686 void rtw_indicate_wx_assoc_event(struct adapter *padapter);
687 void rtw_indicate_wx_disassoc_event(struct adapter *padapter);
688 void indicate_wx_scan_complete_event(struct adapter *padapter);
689 int rtw_change_ifname(struct adapter *padapter, const char *ifname);
690
691 extern char *rtw_initmac;
692 extern int rtw_mc2u_disable;
693 extern int rtw_ht_enable;
694 extern u32 g_wait_hiq_empty;
695 extern u8 g_fwdl_wintint_rdy_fail;
696 extern u8 g_fwdl_chksum_fail;
697
698 #endif /* __DRV_TYPES_H__ */
699