1 /******************************************************************************
2 * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
4 * Based on the r8180 driver, which is:
5 * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 * The full GNU General Public License is included in this distribution in the
20 * file called LICENSE.
22 * Contact Information:
23 * wlanfae <wlanfae@realtek.com>
24 ******************************************************************************/
29 #include <linux/module.h>
30 #include <linux/kernel.h>
31 #include <linux/init.h>
32 #include <linux/ioport.h>
33 #include <linux/sched.h>
34 #include <linux/types.h>
35 #include <linux/interrupt.h>
36 #include <linux/slab.h>
37 #include <linux/netdevice.h>
38 #include <linux/pci.h>
39 #include <linux/etherdevice.h>
40 #include <linux/delay.h>
41 #include <linux/rtnetlink.h>
42 #include <linux/wireless.h>
43 #include <linux/timer.h>
44 #include <linux/proc_fs.h>
45 #include <linux/if_arp.h>
46 #include <linux/random.h>
47 #include <linux/version.h>
53 #include "r8192E_firmware.h"
54 #include "r8192E_hw.h"
56 #include "r8190P_def.h"
57 #include "r8192E_dev.h"
59 #include "rtl_debug.h"
60 #include "rtl_eeprom.h"
65 #define DRV_COPYRIGHT \
66 "Copyright(c) 2008 - 2010 Realsil Semiconductor Corporation"
67 #define DRV_AUTHOR "<wlanfae@realtek.com>"
68 #define DRV_VERSION "0014.0401.2010"
70 #define DRV_NAME "rtl819xE"
72 #define IS_HARDWARE_TYPE_819xP(_priv) \
73 ((((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8190P) || \
74 (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192E))
75 #define IS_HARDWARE_TYPE_8192SE(_priv) \
76 (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192SE)
77 #define IS_HARDWARE_TYPE_8192CE(_priv) \
78 (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192CE)
79 #define IS_HARDWARE_TYPE_8192CU(_priv) \
80 (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192CU)
81 #define IS_HARDWARE_TYPE_8192DE(_priv) \
82 (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192DE)
83 #define IS_HARDWARE_TYPE_8192DU(_priv) \
84 (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192DU)
86 #define RTL_PCI_DEVICE(vend, dev, cfg) \
87 .vendor = (vend), .device = (dev), \
88 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID , \
89 .driver_data = (kernel_ulong_t)&(cfg)
91 #define irqreturn_type irqreturn_t
93 #define rtl8192_interrupt(x, y, z) rtl8192_interrupt_rsl(x, y)
95 #define RTL_MAX_SCAN_SIZE 128
97 #define RTL_RATE_MAX 30
99 #define TOTAL_CAM_ENTRY 32
100 #define CAM_CONTENT_COUNT 8
103 #define BIT(_i) (1<<(_i))
106 #define IS_NIC_DOWN(priv) (!(priv)->up)
108 #define IS_ADAPTER_SENDS_BEACON(dev) 0
110 #define IS_UNDER_11N_AES_MODE(_rtllib) \
111 ((_rtllib->pHTInfo->bCurrentHTSupport == true) && \
112 (_rtllib->pairwise_key_type == KEY_TYPE_CCMP))
114 #define HAL_MEMORY_MAPPED_IO_RANGE_8190PCI 0x1000
115 #define HAL_HW_PCI_REVISION_ID_8190PCI 0x00
116 #define HAL_MEMORY_MAPPED_IO_RANGE_8192PCIE 0x4000
117 #define HAL_HW_PCI_REVISION_ID_8192PCIE 0x01
118 #define HAL_MEMORY_MAPPED_IO_RANGE_8192SE 0x4000
119 #define HAL_HW_PCI_REVISION_ID_8192SE 0x10
120 #define HAL_HW_PCI_REVISION_ID_8192CE 0x1
121 #define HAL_MEMORY_MAPPED_IO_RANGE_8192CE 0x4000
122 #define HAL_HW_PCI_REVISION_ID_8192DE 0x0
123 #define HAL_MEMORY_MAPPED_IO_RANGE_8192DE 0x4000
125 #define HAL_HW_PCI_8180_DEVICE_ID 0x8180
126 #define HAL_HW_PCI_8185_DEVICE_ID 0x8185
127 #define HAL_HW_PCI_8188_DEVICE_ID 0x8188
128 #define HAL_HW_PCI_8198_DEVICE_ID 0x8198
129 #define HAL_HW_PCI_8190_DEVICE_ID 0x8190
130 #define HAL_HW_PCI_8192_DEVICE_ID 0x8192
131 #define HAL_HW_PCI_8192SE_DEVICE_ID 0x8192
132 #define HAL_HW_PCI_8174_DEVICE_ID 0x8174
133 #define HAL_HW_PCI_8173_DEVICE_ID 0x8173
134 #define HAL_HW_PCI_8172_DEVICE_ID 0x8172
135 #define HAL_HW_PCI_8171_DEVICE_ID 0x8171
136 #define HAL_HW_PCI_0045_DEVICE_ID 0x0045
137 #define HAL_HW_PCI_0046_DEVICE_ID 0x0046
138 #define HAL_HW_PCI_0044_DEVICE_ID 0x0044
139 #define HAL_HW_PCI_0047_DEVICE_ID 0x0047
140 #define HAL_HW_PCI_700F_DEVICE_ID 0x700F
141 #define HAL_HW_PCI_701F_DEVICE_ID 0x701F
142 #define HAL_HW_PCI_DLINK_DEVICE_ID 0x3304
143 #define HAL_HW_PCI_8192CET_DEVICE_ID 0x8191
144 #define HAL_HW_PCI_8192CE_DEVICE_ID 0x8178
145 #define HAL_HW_PCI_8191CE_DEVICE_ID 0x8177
146 #define HAL_HW_PCI_8188CE_DEVICE_ID 0x8176
147 #define HAL_HW_PCI_8192CU_DEVICE_ID 0x8191
148 #define HAL_HW_PCI_8192DE_DEVICE_ID 0x092D
149 #define HAL_HW_PCI_8192DU_DEVICE_ID 0x092D
151 #define RTL819X_DEFAULT_RF_TYPE RF_1T2R
153 #define RTLLIB_WATCH_DOG_TIME 2000
155 #define MAX_DEV_ADDR_SIZE 8 /*support till 64 bit bus width OS*/
156 #define MAX_FIRMWARE_INFORMATION_SIZE 32
157 #define MAX_802_11_HEADER_LENGTH (40 + MAX_FIRMWARE_INFORMATION_SIZE)
158 #define ENCRYPTION_MAX_OVERHEAD 128
159 #define MAX_FRAGMENT_COUNT 8
160 #define MAX_TRANSMIT_BUFFER_SIZE \
161 (1600 + (MAX_802_11_HEADER_LENGTH + ENCRYPTION_MAX_OVERHEAD) * \
166 #define DEFAULT_FRAG_THRESHOLD 2342U
167 #define MIN_FRAG_THRESHOLD 256U
168 #define DEFAULT_BEACONINTERVAL 0x64U
170 #define DEFAULT_SSID ""
171 #define DEFAULT_RETRY_RTS 7
172 #define DEFAULT_RETRY_DATA 7
173 #define PRISM_HDR_SIZE 64
175 #define PHY_RSSI_SLID_WIN_MAX 100
177 #define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 30)
179 #define TxBBGainTableLength 37
180 #define CCKTxBBGainTableLength 23
182 #define CHANNEL_PLAN_LEN 10
185 #define NIC_SEND_HANG_THRESHOLD_NORMAL 4
186 #define NIC_SEND_HANG_THRESHOLD_POWERSAVE 8
188 #define MAX_TX_QUEUE 9
190 #define MAX_RX_QUEUE 1
192 #define MAX_RX_COUNT 64
193 #define MAX_TX_QUEUE_COUNT 9
195 enum RTL819x_PHY_PARAM {
196 RTL819X_PHY_MACPHY_REG = 0,
197 RTL819X_PHY_MACPHY_REG_PG = 1,
198 RTL8188C_PHY_MACREG = 2,
199 RTL8192C_PHY_MACREG = 3,
201 RTL819X_PHY_REG_1T2R = 5,
202 RTL819X_PHY_REG_to1T1R = 6,
203 RTL819X_PHY_REG_to1T2R = 7,
204 RTL819X_PHY_REG_to2T2R = 8,
205 RTL819X_PHY_REG_PG = 9,
206 RTL819X_AGC_TAB = 10,
207 RTL819X_PHY_RADIO_A = 11,
208 RTL819X_PHY_RADIO_A_1T = 12,
209 RTL819X_PHY_RADIO_A_2T = 13,
210 RTL819X_PHY_RADIO_B = 14,
211 RTL819X_PHY_RADIO_B_GM = 15,
212 RTL819X_PHY_RADIO_C = 16,
213 RTL819X_PHY_RADIO_D = 17,
214 RTL819X_EEPROM_MAP = 18,
215 RTL819X_EFUSE_MAP = 19,
237 COMP_POWER_TRACKING = BIT18,
240 COMP_FIRMWARE = BIT21,
264 enum rt_eeprom_type {
271 TXCMD_TXRA_HISTORY_CTRL = 0xFF900000,
272 TXCMD_RESET_TX_PKT_BUFF = 0xFF900001,
273 TXCMD_RESET_RX_PKT_BUFF = 0xFF900002,
274 TXCMD_SET_TX_DURATION = 0xFF900003,
275 TXCMD_SET_RX_RSSI = 0xFF900004,
276 TXCMD_SET_TX_PWR_TRACKING = 0xFF900005,
280 enum rt_rf_type_819xu {
302 enum rt_customer_id {
304 RT_CID_8187_ALPHA0 = 1,
305 RT_CID_8187_SERCOMM_PS = 2,
306 RT_CID_8187_HW_LED = 3,
307 RT_CID_8187_NETGEAR = 4,
309 RT_CID_819x_CAMEO = 6,
310 RT_CID_819x_RUNTOP = 7,
311 RT_CID_819x_Senao = 8,
313 RT_CID_819x_Netcore = 10,
314 RT_CID_Nettronix = 11,
318 RT_CID_819x_ALPHA = 15,
319 RT_CID_819x_Sitecom = 16,
321 RT_CID_819x_Lenovo = 18,
322 RT_CID_819x_QMI = 19,
323 RT_CID_819x_Edimax_Belkin = 20,
324 RT_CID_819x_Sercomm_Belkin = 21,
325 RT_CID_819x_CAMEO1 = 22,
326 RT_CID_819x_MSI = 23,
327 RT_CID_819x_Acer = 24,
329 RT_CID_819x_CLEVO = 28,
330 RT_CID_819x_Arcadyan_Belkin = 29,
331 RT_CID_819x_SAMSUNG = 30,
332 RT_CID_819x_WNC_COREGA = 31,
336 RESET_TYPE_NORESET = 0x00,
337 RESET_TYPE_NORMAL = 0x01,
338 RESET_TYPE_SILENT = 0x02
341 enum ic_inferiority_8192s {
342 IC_INFERIORITY_A = 0,
343 IC_INFERIORITY_B = 1,
346 enum pci_bridge_vendor {
347 PCI_BRIDGE_VENDOR_INTEL = 0x0,
348 PCI_BRIDGE_VENDOR_ATI,
349 PCI_BRIDGE_VENDOR_AMD,
350 PCI_BRIDGE_VENDOR_SIS ,
351 PCI_BRIDGE_VENDOR_UNKNOWN,
352 PCI_BRIDGE_VENDOR_MAX ,
362 struct rtl_reg_debug {
368 unsigned char length;
370 unsigned char buf[0xff];
379 struct rt_smooth_data_4rf {
380 char elements[4][100];
390 unsigned long rxframgment;
391 unsigned long rxcmdpkt[8];
392 unsigned long rxurberr;
393 unsigned long rxstaterr;
394 unsigned long rxdatacrcerr;
395 unsigned long rxmgmtcrcerr;
396 unsigned long rxcrcerrmin;
397 unsigned long rxcrcerrmid;
398 unsigned long rxcrcerrmax;
399 unsigned long received_rate_histogram[4][32];
400 unsigned long received_preamble_GI[2][32];
401 unsigned long rx_AMPDUsize_histogram[5];
402 unsigned long rx_AMPDUnum_histogram[5];
403 unsigned long numpacket_matchbssid;
404 unsigned long numpacket_toself;
405 unsigned long num_process_phyinfo;
406 unsigned long numqry_phystatus;
407 unsigned long numqry_phystatusCCK;
408 unsigned long numqry_phystatusHT;
409 unsigned long received_bwtype[5];
410 unsigned long txnperr;
411 unsigned long txnpdrop;
412 unsigned long txresumed;
413 unsigned long rxoverflow;
415 unsigned long txnpokint;
417 unsigned long shints;
418 unsigned long txoverflow;
419 unsigned long txlpokint;
420 unsigned long txlpdrop;
421 unsigned long txlperr;
422 unsigned long txbeokint;
423 unsigned long txbedrop;
424 unsigned long txbeerr;
425 unsigned long txbkokint;
426 unsigned long txbkdrop;
427 unsigned long txbkerr;
428 unsigned long txviokint;
429 unsigned long txvidrop;
430 unsigned long txvierr;
431 unsigned long txvookint;
432 unsigned long txvodrop;
433 unsigned long txvoerr;
434 unsigned long txbeaconokint;
435 unsigned long txbeacondrop;
436 unsigned long txbeaconerr;
437 unsigned long txmanageokint;
438 unsigned long txmanagedrop;
439 unsigned long txmanageerr;
440 unsigned long txcmdpktokint;
441 unsigned long txdatapkt;
442 unsigned long txfeedback;
443 unsigned long txfeedbackok;
444 unsigned long txoktotal;
445 unsigned long txokbytestotal;
446 unsigned long txokinperiod;
447 unsigned long txmulticast;
448 unsigned long txbytesmulticast;
449 unsigned long txbroadcast;
450 unsigned long txbytesbroadcast;
451 unsigned long txunicast;
452 unsigned long txbytesunicast;
453 unsigned long rxbytesunicast;
454 unsigned long txfeedbackfail;
455 unsigned long txerrtotal;
456 unsigned long txerrbytestotal;
457 unsigned long txerrmulticast;
458 unsigned long txerrbroadcast;
459 unsigned long txerrunicast;
460 unsigned long txretrycount;
461 unsigned long txfeedbackretry;
463 unsigned long slide_signal_strength[100];
464 unsigned long slide_evm[100];
465 unsigned long slide_rssi_total;
466 unsigned long slide_evm_total;
467 long signal_strength;
469 long last_signal_strength_inpercent;
470 long recv_signal_power;
471 u8 rx_rssi_percentage[4];
472 u8 rx_evm_percentage[2];
474 struct rt_tx_rahis txrate;
475 u32 Slide_Beacon_pwdb[100];
476 u32 Slide_Beacon_Total;
477 struct rt_smooth_data_4rf cck_adc_pwdb;
478 u32 CurrentShowTxate;
481 struct channel_access_setting {
490 enum two_port_status {
491 TWO_PORT_STATUS__DEFAULT_ONLY,
492 TWO_PORT_STATUS__EXTENSION_ONLY,
493 TWO_PORT_STATUS__EXTENSION_FOLLOW_DEFAULT,
494 TWO_PORT_STATUS__DEFAULT_G_EXTENSION_N20,
495 TWO_PORT_STATUS__ADHOC,
496 TWO_PORT_STATUS__WITHOUT_ANY_ASSOCIATE
499 struct txbbgain_struct {
500 long txbb_iq_amplifygain;
505 u8 ccktxbb_valuearray[8];
520 struct tx_ring *next;
523 struct rtl8192_tx_ring {
524 struct tx_desc *desc;
527 unsigned int entries;
528 struct sk_buff_head queue;
535 void (*get_eeprom_size)(struct net_device *dev);
536 void (*init_adapter_variable)(struct net_device *dev);
537 void (*init_before_adapter_start)(struct net_device *dev);
538 bool (*initialize_adapter)(struct net_device *dev);
539 void (*link_change)(struct net_device *dev);
540 void (*tx_fill_descriptor)(struct net_device *dev,
541 struct tx_desc *tx_desc,
542 struct cb_desc *cb_desc,
543 struct sk_buff *skb);
544 void (*tx_fill_cmd_descriptor)(struct net_device *dev,
545 struct tx_desc_cmd *entry,
546 struct cb_desc *cb_desc,
547 struct sk_buff *skb);
548 bool (*rx_query_status_descriptor)(struct net_device *dev,
549 struct rtllib_rx_stats *stats,
550 struct rx_desc *pdesc,
551 struct sk_buff *skb);
552 bool (*rx_command_packet_handler)(struct net_device *dev,
554 struct rx_desc *pdesc);
555 void (*stop_adapter)(struct net_device *dev, bool reset);
556 void (*update_ratr_table)(struct net_device *dev);
557 void (*irq_enable)(struct net_device *dev);
558 void (*irq_disable)(struct net_device *dev);
559 void (*irq_clear)(struct net_device *dev);
560 void (*rx_enable)(struct net_device *dev);
561 void (*tx_enable)(struct net_device *dev);
562 void (*interrupt_recognized)(struct net_device *dev,
563 u32 *p_inta, u32 *p_intb);
564 bool (*TxCheckStuckHandler)(struct net_device *dev);
565 bool (*RxCheckStuckHandler)(struct net_device *dev);
569 struct pci_dev *pdev;
570 struct pci_dev *bridge_pdev;
573 bool bfirst_after_down;
574 bool initialized_at_probe;
575 bool being_init_adapter;
576 bool bDriverIsGoingToUnload;
583 struct delayed_work update_beacon_wq;
584 struct delayed_work watch_dog_wq;
585 struct delayed_work txpower_tracking_wq;
586 struct delayed_work rfpath_check_wq;
587 struct delayed_work gpio_change_rf_wq;
588 struct delayed_work initialgain_operate_wq;
589 struct delayed_work check_hw_scan_wq;
590 struct delayed_work hw_scan_simu_wq;
591 struct delayed_work start_hw_scan_wq;
593 struct workqueue_struct *priv_wq;
595 struct channel_access_setting ChannelAccessSetting;
597 struct mp_adapter NdisAdapter;
599 struct rtl819x_ops *ops;
600 struct rtllib_device *rtllib;
602 struct work_struct reset_wq;
604 struct log_int_8190 InterruptLog;
606 enum rt_customer_id CustomerID;
609 enum rt_rf_type_819xu rf_chip;
610 enum ic_inferiority_8192s IC_Class;
611 enum ht_channel_width CurrentChannelBW;
612 struct bb_reg_definition PHYRegDef[4];
613 struct rate_adaptive rate_adaptive;
615 struct ccktxbbgain cck_txbbgain_table[CCKTxBBGainTableLength];
616 struct ccktxbbgain cck_txbbgain_ch14_table[CCKTxBBGainTableLength];
618 struct txbbgain_struct txbbgain_table[TxBBGainTableLength];
620 enum acm_method AcmMethod;
622 struct rt_firmware *pFirmware;
623 enum rtl819x_loopback LoopbackMode;
624 enum firmware_source firmware_source;
626 struct timer_list watch_dog_timer;
627 struct timer_list fsync_timer;
628 struct timer_list gpio_polling_timer;
630 spinlock_t fw_scan_lock;
632 spinlock_t irq_th_lock;
634 spinlock_t rf_ps_lock;
636 spinlock_t rt_h2c_lock;
640 struct sk_buff_head rx_queue;
641 struct sk_buff_head skb_queue;
643 struct tasklet_struct irq_rx_tasklet;
644 struct tasklet_struct irq_tx_tasklet;
645 struct tasklet_struct irq_prepare_beacon_tasklet;
647 struct semaphore wx_sem;
648 struct semaphore rf_sem;
651 struct rt_stats stats;
652 struct iw_statistics wstats;
653 struct proc_dir_entry *dir_dev;
655 short (*rf_set_sens)(struct net_device *dev, short sens);
656 u8 (*rf_set_chan)(struct net_device *dev, u8 ch);
657 void (*rf_close)(struct net_device *dev);
658 void (*rf_init)(struct net_device *dev);
660 struct rx_desc *rx_ring[MAX_RX_QUEUE];
661 struct sk_buff *rx_buf[MAX_RX_QUEUE][MAX_RX_COUNT];
662 dma_addr_t rx_ring_dma[MAX_RX_QUEUE];
663 unsigned int rx_idx[MAX_RX_QUEUE];
669 u16 EarlyRxThreshold;
677 struct rtl8192_tx_ring tx_ring[MAX_TX_QUEUE_COUNT];
681 atomic_t tx_pending[0x10];
695 /**********************************************************/
702 struct work_struct qos_activate;
722 enum nic_t card_8192;
723 u8 card_8192_version;
729 char nick[IW_ESSID_MAX_SIZE + 1];
734 bool bTKIPinNmodeFromReg;
735 bool bWEPinNmodeFromReg;
739 u8 check_roaming_cnt;
741 bool bIgnoreSilentReset;
742 u32 SilentResetRxSoltNum;
743 u32 SilentResetRxSlotIndex;
744 u32 SilentResetRxStuckEvent[MAX_SILENT_RESET_RX_SLOT_NUM];
750 u8 nrxAMPDU_aggr_num;
752 u32 last_rxdesc_tsf_high;
753 u32 last_rxdesc_tsf_low;
757 u8 dot11CurrentPreambleMode;
764 u16 FirmwareSubVersion;
766 bool AutoloadFailFlag;
771 u8 RegSupportPciASPM;
779 u8 EfuseMap[2][HWSET_MAX_SIZE_92S];
781 u8 EfuseUsedPercentage;
788 u8 eeprom_CustomerID;
789 u16 eeprom_ChannelPlan;
793 u8 EEPROMPwrGroup[2][3];
796 u8 EEPROMTxPowerLevelCCK[14];
797 u8 EEPROMTxPowerLevelOFDM24G[14];
798 u8 EEPROMTxPowerLevelOFDM5G[24];
799 u8 EEPROMRfACCKChnl1TxPwLevel[3];
800 u8 EEPROMRfAOfdmChnlTxPwLevel[3];
801 u8 EEPROMRfCCCKChnl1TxPwLevel[3];
802 u8 EEPROMRfCOfdmChnlTxPwLevel[3];
803 u16 EEPROMTxPowerDiff;
805 u8 EEPROMThermalMeter;
809 u8 EEPROMBluetoothCoexist;
810 u8 EEPROMBluetoothType;
811 u8 EEPROMBluetoothAntNum;
812 u8 EEPROMBluetoothAntIsolation;
813 u8 EEPROMBluetoothRadioShared;
816 u8 EEPROMSupportWoWLAN;
819 u8 EEPROMHT2T_TxPwr[6];
822 u8 EEPROMTxPowerLevelCCK_V1[3];
823 u8 EEPROMLegacyHTTxPowerDiff;
836 u8 SetBWModeInProgress;
842 bool brfpath_rxenable[4];
844 bool bTXPowerDataReadFromEEPORM;
848 bool bChnlPlanFromHW;
852 bool bInPowerSaveMode;
855 bool aspm_clkreq_enable;
856 u32 pci_bridge_vendor;
857 u8 RegHostPciASPMSetting;
858 u8 RegDevicePciASPMSetting;
860 bool RFChangeInProgress;
861 bool SetRFPowerStateInProgress;
882 u32 IQK_MAC_backup[3];
884 bool SetFwCmdInProgress;
889 bool bInformFWDriverControlDM;
890 u8 PwrGroupHT20[2][14];
891 u8 PwrGroupHT40[2][14];
894 long EntryMinUndecoratedSmoothedPWDB;
895 long EntryMaxUndecoratedSmoothedPWDB;
896 u8 DynamicTxHighPowerLvl;
899 struct false_alarm_stats FalseAlmCnt;
907 u8 CCKPresentAttentuation_20Mdefault;
908 u8 CCKPresentAttentuation_40Mdefault;
909 char CCKPresentAttentuation_difference;
910 char CCKPresentAttentuation;
912 long undecorated_smoothed_pwdb;
913 long undecorated_smoothed_cck_adc_pwdb[4];
915 u32 MCSTxPowerLevelOriginalOffset[6];
916 u32 CCKTxPowerLevelOriginalOffset;
917 u8 TxPowerLevelCCK[14];
918 u8 TxPowerLevelCCK_A[14];
919 u8 TxPowerLevelCCK_C[14];
920 u8 TxPowerLevelOFDM24G[14];
921 u8 TxPowerLevelOFDM5G[14];
922 u8 TxPowerLevelOFDM24G_A[14];
923 u8 TxPowerLevelOFDM24G_C[14];
924 u8 LegacyHTTxPowerDiff;
928 u8 RfTxPwrLevelCck[2][14];
929 u8 RfTxPwrLevelOfdm1T[2][14];
930 u8 RfTxPwrLevelOfdm2T[2][14];
931 u8 AntennaTxPwDiff[3];
932 u8 TxPwrHt20Diff[2][14];
933 u8 TxPwrLegacyHtDiff[2][14];
937 u8 CurrentCckTxPwrIdx;
938 u8 CurrentOfdm24GTxPwrIdx;
940 bool bdynamic_txpower;
941 bool bDynamicTxHighPower;
942 bool bDynamicTxLowPower;
943 bool bLastDTPFlag_High;
944 bool bLastDTPFlag_Low;
946 bool bstore_last_dtpflag;
947 bool bstart_txctrl_bydtp;
949 u8 rfa_txpowertrackingindex;
950 u8 rfa_txpowertrackingindex_real;
951 u8 rfa_txpowertracking_default;
952 u8 rfc_txpowertrackingindex;
953 u8 rfc_txpowertrackingindex_real;
954 u8 rfc_txpowertracking_default;
955 bool btxpower_tracking;
958 u8 TxPowerTrackControl;
960 bool btxpower_trackingInit;
965 u8 Record_CCK_20Mindex;
966 u8 Record_CCK_40Mindex;
968 struct init_gain initgain_backup;
969 u8 DefaultInitialGain[4];
970 bool bis_any_nonbepkts;
971 bool bcurrent_turbo_EDCA;
972 bool bis_cur_rdlstate;
979 bool bfsync_processing;
981 u32 rateCountDiffRecord;
982 u32 ContiuneDiffCount;
988 bool bDMInitialGainEnable;
989 bool MutualAuthenticationFail;
991 bool bDisableFrameBursting;
996 u32 txpower_checkcnt;
997 u32 txpower_tracking_callback_cnt;
998 u8 thermal_read_val[40];
999 u8 thermal_readback_index;
1000 u32 ccktxpower_adjustcnt_not_ch14;
1001 u32 ccktxpower_adjustcnt_ch14;
1003 enum reset_type ResetProgress;
1004 bool bForcedSilentReset;
1005 bool bDisableNormalResetCheck;
1008 int IrpPendingCount;
1009 bool bResetInProgress;
1012 u8 InitialGainOperateType;
1015 bool bSingleCarrier;
1034 u8 PwrDomainProtect;
1040 extern const struct ethtool_ops rtl819x_ethtool_ops;
1042 void rtl8192_tx_cmd(struct net_device *dev, struct sk_buff *skb);
1043 short rtl8192_tx(struct net_device *dev, struct sk_buff *skb);
1045 u8 read_nic_io_byte(struct net_device *dev, int x);
1046 u32 read_nic_io_dword(struct net_device *dev, int x);
1047 u16 read_nic_io_word(struct net_device *dev, int x) ;
1048 void write_nic_io_byte(struct net_device *dev, int x, u8 y);
1049 void write_nic_io_word(struct net_device *dev, int x, u16 y);
1050 void write_nic_io_dword(struct net_device *dev, int x, u32 y);
1052 u8 read_nic_byte(struct net_device *dev, int x);
1053 u32 read_nic_dword(struct net_device *dev, int x);
1054 u16 read_nic_word(struct net_device *dev, int x) ;
1055 void write_nic_byte(struct net_device *dev, int x, u8 y);
1056 void write_nic_word(struct net_device *dev, int x, u16 y);
1057 void write_nic_dword(struct net_device *dev, int x, u32 y);
1059 void force_pci_posting(struct net_device *dev);
1061 void rtl8192_rx_enable(struct net_device *);
1062 void rtl8192_tx_enable(struct net_device *);
1064 int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev);
1065 void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
1067 void rtl8192_data_hard_stop(struct net_device *dev);
1068 void rtl8192_data_hard_resume(struct net_device *dev);
1069 void rtl8192_restart(void *data);
1070 void rtl819x_watchdog_wqcallback(void *data);
1071 void rtl8192_hw_sleep_wq(void *data);
1072 void watch_dog_timer_callback(unsigned long data);
1073 void rtl8192_irq_rx_tasklet(struct r8192_priv *priv);
1074 void rtl8192_irq_tx_tasklet(struct r8192_priv *priv);
1075 int rtl8192_down(struct net_device *dev, bool shutdownrf);
1076 int rtl8192_up(struct net_device *dev);
1077 void rtl8192_commit(struct net_device *dev);
1078 void rtl8192_set_chan(struct net_device *dev, short ch);
1080 void check_rfctrl_gpio_timer(unsigned long data);
1082 void rtl8192_hw_wakeup_wq(void *data);
1083 irqreturn_type rtl8192_interrupt(int irq, void *netdev, struct pt_regs *regs);
1085 short rtl8192_pci_initdescring(struct net_device *dev);
1087 void rtl8192_cancel_deferred_work(struct r8192_priv *priv);
1089 int _rtl8192_up(struct net_device *dev, bool is_silent_reset);
1091 short rtl8192_is_tx_queue_empty(struct net_device *dev);
1092 void rtl8192_irq_disable(struct net_device *dev);
1094 void rtl8192_tx_timeout(struct net_device *dev);
1095 void rtl8192_pci_resetdescring(struct net_device *dev);
1096 void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode);
1097 void rtl8192_irq_enable(struct net_device *dev);
1098 void rtl8192_config_rate(struct net_device *dev, u16 *rate_config);
1099 void rtl8192_update_cap(struct net_device *dev, u16 cap);
1100 void rtl8192_irq_disable(struct net_device *dev);
1102 void rtl819x_UpdateRxPktTimeStamp(struct net_device *dev,
1103 struct rtllib_rx_stats *stats);
1104 long rtl819x_translate_todbm(struct r8192_priv *priv, u8 signal_strength_index);
1105 void rtl819x_update_rxsignalstatistics8190pci(struct r8192_priv *priv,
1106 struct rtllib_rx_stats *pprevious_stats);
1107 u8 rtl819x_evm_dbtopercentage(char value);
1108 void rtl819x_process_cck_rxpathsel(struct r8192_priv *priv,
1109 struct rtllib_rx_stats *pprevious_stats);
1110 u8 rtl819x_query_rxpwrpercentage(char antpower);
1111 void rtl8192_record_rxdesc_forlateruse(struct rtllib_rx_stats *psrc_stats,
1112 struct rtllib_rx_stats *ptarget_stats);
1113 bool NicIFEnableNIC(struct net_device *dev);
1114 bool NicIFDisableNIC(struct net_device *dev);
1116 bool MgntActSet_RF_State(struct net_device *dev,
1117 enum rt_rf_power_state StateToSet,
1118 RT_RF_CHANGE_SOURCE ChangeSource,
1120 void ActUpdateChannelAccessSetting(struct net_device *dev,
1121 enum wireless_mode WirelessMode,
1122 struct channel_access_setting *ChnlAccessSetting);