9d7cb0edb2d36cf13932a4ce70c15c624d23dbfb
[deliverable/linux.git] / drivers / staging / rtl8192e / rtl8192e / rtl_core.h
1 /******************************************************************************
2 * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
3 *
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.
9 *
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
13 * more details.
14 *
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
18 *
19 * The full GNU General Public License is included in this distribution in the
20 * file called LICENSE.
21 *
22 * Contact Information:
23 * wlanfae <wlanfae@realtek.com>
24 ******************************************************************************/
25
26 #ifndef _RTL_CORE_H
27 #define _RTL_CORE_H
28
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/io.h>
48
49 /* Need this defined before including local include files */
50 #define DRV_NAME "rtl819xE"
51
52 #include "../rtllib.h"
53
54 #include "../dot11d.h"
55
56 #include "r8192E_firmware.h"
57 #include "r8192E_hw.h"
58
59 #include "r8190P_def.h"
60 #include "r8192E_dev.h"
61
62 #include "rtl_eeprom.h"
63 #include "rtl_ps.h"
64 #include "rtl_pci.h"
65 #include "rtl_cam.h"
66
67 #define DRV_COPYRIGHT \
68 "Copyright(c) 2008 - 2010 Realsil Semiconductor Corporation"
69 #define DRV_AUTHOR "<wlanfae@realtek.com>"
70 #define DRV_VERSION "0014.0401.2010"
71
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)
85
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)
90
91 #define RTL_MAX_SCAN_SIZE 128
92
93 #define RTL_RATE_MAX 30
94
95 #define TOTAL_CAM_ENTRY 32
96 #define CAM_CONTENT_COUNT 8
97
98 #ifndef BIT
99 #define BIT(_i) (1<<(_i))
100 #endif
101
102 #define IS_NIC_DOWN(priv) (!(priv)->up)
103
104 #define IS_ADAPTER_SENDS_BEACON(dev) 0
105
106 #define IS_UNDER_11N_AES_MODE(_rtllib) \
107 ((_rtllib->pHTInfo->bCurrentHTSupport == true) && \
108 (_rtllib->pairwise_key_type == KEY_TYPE_CCMP))
109
110 #define HAL_MEMORY_MAPPED_IO_RANGE_8190PCI 0x1000
111 #define HAL_HW_PCI_REVISION_ID_8190PCI 0x00
112 #define HAL_MEMORY_MAPPED_IO_RANGE_8192PCIE 0x4000
113 #define HAL_HW_PCI_REVISION_ID_8192PCIE 0x01
114 #define HAL_MEMORY_MAPPED_IO_RANGE_8192SE 0x4000
115 #define HAL_HW_PCI_REVISION_ID_8192SE 0x10
116 #define HAL_HW_PCI_REVISION_ID_8192CE 0x1
117 #define HAL_MEMORY_MAPPED_IO_RANGE_8192CE 0x4000
118 #define HAL_HW_PCI_REVISION_ID_8192DE 0x0
119 #define HAL_MEMORY_MAPPED_IO_RANGE_8192DE 0x4000
120
121 #define HAL_HW_PCI_8180_DEVICE_ID 0x8180
122 #define HAL_HW_PCI_8185_DEVICE_ID 0x8185
123 #define HAL_HW_PCI_8188_DEVICE_ID 0x8188
124 #define HAL_HW_PCI_8198_DEVICE_ID 0x8198
125 #define HAL_HW_PCI_8190_DEVICE_ID 0x8190
126 #define HAL_HW_PCI_8192_DEVICE_ID 0x8192
127 #define HAL_HW_PCI_8192SE_DEVICE_ID 0x8192
128 #define HAL_HW_PCI_8174_DEVICE_ID 0x8174
129 #define HAL_HW_PCI_8173_DEVICE_ID 0x8173
130 #define HAL_HW_PCI_8172_DEVICE_ID 0x8172
131 #define HAL_HW_PCI_8171_DEVICE_ID 0x8171
132 #define HAL_HW_PCI_0045_DEVICE_ID 0x0045
133 #define HAL_HW_PCI_0046_DEVICE_ID 0x0046
134 #define HAL_HW_PCI_0044_DEVICE_ID 0x0044
135 #define HAL_HW_PCI_0047_DEVICE_ID 0x0047
136 #define HAL_HW_PCI_700F_DEVICE_ID 0x700F
137 #define HAL_HW_PCI_701F_DEVICE_ID 0x701F
138 #define HAL_HW_PCI_DLINK_DEVICE_ID 0x3304
139 #define HAL_HW_PCI_8192CET_DEVICE_ID 0x8191
140 #define HAL_HW_PCI_8192CE_DEVICE_ID 0x8178
141 #define HAL_HW_PCI_8191CE_DEVICE_ID 0x8177
142 #define HAL_HW_PCI_8188CE_DEVICE_ID 0x8176
143 #define HAL_HW_PCI_8192CU_DEVICE_ID 0x8191
144 #define HAL_HW_PCI_8192DE_DEVICE_ID 0x092D
145 #define HAL_HW_PCI_8192DU_DEVICE_ID 0x092D
146
147 #define RTL819X_DEFAULT_RF_TYPE RF_1T2R
148
149 #define RTLLIB_WATCH_DOG_TIME 2000
150
151 #define MAX_DEV_ADDR_SIZE 8 /*support till 64 bit bus width OS*/
152 #define MAX_FIRMWARE_INFORMATION_SIZE 32
153 #define MAX_802_11_HEADER_LENGTH (40 + MAX_FIRMWARE_INFORMATION_SIZE)
154 #define ENCRYPTION_MAX_OVERHEAD 128
155 #define MAX_FRAGMENT_COUNT 8
156 #define MAX_TRANSMIT_BUFFER_SIZE \
157 (1600 + (MAX_802_11_HEADER_LENGTH + ENCRYPTION_MAX_OVERHEAD) * \
158 MAX_FRAGMENT_COUNT)
159
160 #define scrclng 4
161
162 #define DEFAULT_FRAG_THRESHOLD 2342U
163 #define MIN_FRAG_THRESHOLD 256U
164 #define DEFAULT_BEACONINTERVAL 0x64U
165
166 #define DEFAULT_SSID ""
167 #define DEFAULT_RETRY_RTS 7
168 #define DEFAULT_RETRY_DATA 7
169 #define PRISM_HDR_SIZE 64
170
171 #define PHY_RSSI_SLID_WIN_MAX 100
172
173 #define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 30)
174
175 #define TxBBGainTableLength 37
176 #define CCKTxBBGainTableLength 23
177
178 #define CHANNEL_PLAN_LEN 10
179 #define sCrcLng 4
180
181 #define NIC_SEND_HANG_THRESHOLD_NORMAL 4
182 #define NIC_SEND_HANG_THRESHOLD_POWERSAVE 8
183
184 #define MAX_TX_QUEUE 9
185
186 #define MAX_RX_QUEUE 1
187
188 #define MAX_RX_COUNT 64
189 #define MAX_TX_QUEUE_COUNT 9
190
191 enum RTL819x_PHY_PARAM {
192 RTL819X_PHY_MACPHY_REG = 0,
193 RTL819X_PHY_MACPHY_REG_PG = 1,
194 RTL8188C_PHY_MACREG = 2,
195 RTL8192C_PHY_MACREG = 3,
196 RTL819X_PHY_REG = 4,
197 RTL819X_PHY_REG_1T2R = 5,
198 RTL819X_PHY_REG_to1T1R = 6,
199 RTL819X_PHY_REG_to1T2R = 7,
200 RTL819X_PHY_REG_to2T2R = 8,
201 RTL819X_PHY_REG_PG = 9,
202 RTL819X_AGC_TAB = 10,
203 RTL819X_PHY_RADIO_A = 11,
204 RTL819X_PHY_RADIO_A_1T = 12,
205 RTL819X_PHY_RADIO_A_2T = 13,
206 RTL819X_PHY_RADIO_B = 14,
207 RTL819X_PHY_RADIO_B_GM = 15,
208 RTL819X_PHY_RADIO_C = 16,
209 RTL819X_PHY_RADIO_D = 17,
210 RTL819X_EEPROM_MAP = 18,
211 RTL819X_EFUSE_MAP = 19,
212 };
213
214 enum nic_t {
215 NIC_UNKNOWN = 0,
216 NIC_8192E = 1,
217 NIC_8190P = 2,
218 NIC_8192SE = 4,
219 NIC_8192CE = 5,
220 NIC_8192CU = 6,
221 NIC_8192DE = 7,
222 NIC_8192DU = 8,
223 };
224
225 enum rt_eeprom_type {
226 EEPROM_93C46,
227 EEPROM_93C56,
228 EEPROM_BOOT_EFUSE,
229 };
230
231 enum dcmg_txcmd_op {
232 TXCMD_TXRA_HISTORY_CTRL = 0xFF900000,
233 TXCMD_RESET_TX_PKT_BUFF = 0xFF900001,
234 TXCMD_RESET_RX_PKT_BUFF = 0xFF900002,
235 TXCMD_SET_TX_DURATION = 0xFF900003,
236 TXCMD_SET_RX_RSSI = 0xFF900004,
237 TXCMD_SET_TX_PWR_TRACKING = 0xFF900005,
238 TXCMD_XXXX_CTRL,
239 };
240
241 enum rt_rf_type_819xu {
242 RF_TYPE_MIN = 0,
243 RF_8225,
244 RF_8256,
245 RF_8258,
246 RF_6052 = 4,
247 RF_PSEUDO_11N = 5,
248 };
249
250 enum rf_step {
251 RF_STEP_INIT = 0,
252 RF_STEP_NORMAL,
253 RF_STEP_MAX
254 };
255
256 enum rt_status {
257 RT_STATUS_SUCCESS,
258 RT_STATUS_FAILURE,
259 RT_STATUS_PENDING,
260 RT_STATUS_RESOURCE
261 };
262
263 enum rt_customer_id {
264 RT_CID_DEFAULT = 0,
265 RT_CID_8187_ALPHA0 = 1,
266 RT_CID_8187_SERCOMM_PS = 2,
267 RT_CID_8187_HW_LED = 3,
268 RT_CID_8187_NETGEAR = 4,
269 RT_CID_WHQL = 5,
270 RT_CID_819x_CAMEO = 6,
271 RT_CID_819x_RUNTOP = 7,
272 RT_CID_819x_Senao = 8,
273 RT_CID_TOSHIBA = 9,
274 RT_CID_819x_Netcore = 10,
275 RT_CID_Nettronix = 11,
276 RT_CID_DLINK = 12,
277 RT_CID_PRONET = 13,
278 RT_CID_COREGA = 14,
279 RT_CID_819x_ALPHA = 15,
280 RT_CID_819x_Sitecom = 16,
281 RT_CID_CCX = 17,
282 RT_CID_819x_Lenovo = 18,
283 RT_CID_819x_QMI = 19,
284 RT_CID_819x_Edimax_Belkin = 20,
285 RT_CID_819x_Sercomm_Belkin = 21,
286 RT_CID_819x_CAMEO1 = 22,
287 RT_CID_819x_MSI = 23,
288 RT_CID_819x_Acer = 24,
289 RT_CID_819x_HP = 27,
290 RT_CID_819x_CLEVO = 28,
291 RT_CID_819x_Arcadyan_Belkin = 29,
292 RT_CID_819x_SAMSUNG = 30,
293 RT_CID_819x_WNC_COREGA = 31,
294 };
295
296 enum reset_type {
297 RESET_TYPE_NORESET = 0x00,
298 RESET_TYPE_NORMAL = 0x01,
299 RESET_TYPE_SILENT = 0x02
300 };
301
302 enum ic_inferiority_8192s {
303 IC_INFERIORITY_A = 0,
304 IC_INFERIORITY_B = 1,
305 };
306
307 enum pci_bridge_vendor {
308 PCI_BRIDGE_VENDOR_INTEL = 0x0,
309 PCI_BRIDGE_VENDOR_ATI,
310 PCI_BRIDGE_VENDOR_AMD,
311 PCI_BRIDGE_VENDOR_SIS ,
312 PCI_BRIDGE_VENDOR_UNKNOWN,
313 PCI_BRIDGE_VENDOR_MAX ,
314 };
315
316 struct buffer {
317 struct buffer *next;
318 u32 *buf;
319 dma_addr_t dma;
320
321 };
322
323 struct rtl_reg_debug {
324 unsigned int cmd;
325 struct {
326 unsigned char type;
327 unsigned char addr;
328 unsigned char page;
329 unsigned char length;
330 } head;
331 unsigned char buf[0xff];
332 };
333
334 struct rt_tx_rahis {
335 u32 cck[4];
336 u32 ofdm[8];
337 u32 ht_mcs[4][16];
338 };
339
340 struct rt_smooth_data_4rf {
341 char elements[4][100];
342 u32 index;
343 u32 TotalNum;
344 u32 TotalVal[4];
345 };
346
347 struct rt_stats {
348 unsigned long txrdu;
349 unsigned long rxrdu;
350 unsigned long rxok;
351 unsigned long rxframgment;
352 unsigned long rxurberr;
353 unsigned long rxstaterr;
354 unsigned long rxdatacrcerr;
355 unsigned long rxmgmtcrcerr;
356 unsigned long rxcrcerrmin;
357 unsigned long rxcrcerrmid;
358 unsigned long rxcrcerrmax;
359 unsigned long received_rate_histogram[4][32];
360 unsigned long received_preamble_GI[2][32];
361 unsigned long rx_AMPDUsize_histogram[5];
362 unsigned long rx_AMPDUnum_histogram[5];
363 unsigned long numpacket_matchbssid;
364 unsigned long numpacket_toself;
365 unsigned long num_process_phyinfo;
366 unsigned long numqry_phystatus;
367 unsigned long numqry_phystatusCCK;
368 unsigned long numqry_phystatusHT;
369 unsigned long received_bwtype[5];
370 unsigned long txnperr;
371 unsigned long txnpdrop;
372 unsigned long txresumed;
373 unsigned long rxoverflow;
374 unsigned long rxint;
375 unsigned long txnpokint;
376 unsigned long ints;
377 unsigned long shints;
378 unsigned long txoverflow;
379 unsigned long txlpokint;
380 unsigned long txlpdrop;
381 unsigned long txlperr;
382 unsigned long txbeokint;
383 unsigned long txbedrop;
384 unsigned long txbeerr;
385 unsigned long txbkokint;
386 unsigned long txbkdrop;
387 unsigned long txbkerr;
388 unsigned long txviokint;
389 unsigned long txvidrop;
390 unsigned long txvierr;
391 unsigned long txvookint;
392 unsigned long txvodrop;
393 unsigned long txvoerr;
394 unsigned long txbeaconokint;
395 unsigned long txbeacondrop;
396 unsigned long txbeaconerr;
397 unsigned long txmanageokint;
398 unsigned long txmanagedrop;
399 unsigned long txmanageerr;
400 unsigned long txcmdpktokint;
401 unsigned long txdatapkt;
402 unsigned long txfeedback;
403 unsigned long txfeedbackok;
404 unsigned long txoktotal;
405 unsigned long txokbytestotal;
406 unsigned long txokinperiod;
407 unsigned long txmulticast;
408 unsigned long txbytesmulticast;
409 unsigned long txbroadcast;
410 unsigned long txbytesbroadcast;
411 unsigned long txunicast;
412 unsigned long txbytesunicast;
413 unsigned long rxbytesunicast;
414 unsigned long txfeedbackfail;
415 unsigned long txerrtotal;
416 unsigned long txerrbytestotal;
417 unsigned long txerrmulticast;
418 unsigned long txerrbroadcast;
419 unsigned long txerrunicast;
420 unsigned long txretrycount;
421 unsigned long txfeedbackretry;
422 u8 last_packet_rate;
423 unsigned long slide_signal_strength[100];
424 unsigned long slide_evm[100];
425 unsigned long slide_rssi_total;
426 unsigned long slide_evm_total;
427 long signal_strength;
428 long signal_quality;
429 long last_signal_strength_inpercent;
430 long recv_signal_power;
431 u8 rx_rssi_percentage[4];
432 u8 rx_evm_percentage[2];
433 long rxSNRdB[4];
434 struct rt_tx_rahis txrate;
435 u32 Slide_Beacon_pwdb[100];
436 u32 Slide_Beacon_Total;
437 struct rt_smooth_data_4rf cck_adc_pwdb;
438 u32 CurrentShowTxate;
439 };
440
441 struct channel_access_setting {
442 u16 SIFS_Timer;
443 u16 DIFS_Timer;
444 u16 SlotTimeTimer;
445 u16 EIFS_Timer;
446 u16 CWminIndex;
447 u16 CWmaxIndex;
448 };
449
450 enum two_port_status {
451 TWO_PORT_STATUS__DEFAULT_ONLY,
452 TWO_PORT_STATUS__EXTENSION_ONLY,
453 TWO_PORT_STATUS__EXTENSION_FOLLOW_DEFAULT,
454 TWO_PORT_STATUS__DEFAULT_G_EXTENSION_N20,
455 TWO_PORT_STATUS__ADHOC,
456 TWO_PORT_STATUS__WITHOUT_ANY_ASSOCIATE
457 };
458
459 struct txbbgain_struct {
460 long txbb_iq_amplifygain;
461 u32 txbbgain_value;
462 };
463
464 struct ccktxbbgain {
465 u8 ccktxbb_valuearray[8];
466 };
467
468 struct init_gain {
469 u8 xaagccore1;
470 u8 xbagccore1;
471 u8 xcagccore1;
472 u8 xdagccore1;
473 u8 cca;
474
475 };
476
477 struct tx_ring {
478 u32 *desc;
479 u8 nStuckCount;
480 struct tx_ring *next;
481 } __packed;
482
483 struct rtl8192_tx_ring {
484 struct tx_desc *desc;
485 dma_addr_t dma;
486 unsigned int idx;
487 unsigned int entries;
488 struct sk_buff_head queue;
489 };
490
491
492
493 struct rtl819x_ops {
494 enum nic_t nic_type;
495 void (*get_eeprom_size)(struct net_device *dev);
496 void (*init_adapter_variable)(struct net_device *dev);
497 void (*init_before_adapter_start)(struct net_device *dev);
498 bool (*initialize_adapter)(struct net_device *dev);
499 void (*link_change)(struct net_device *dev);
500 void (*tx_fill_descriptor)(struct net_device *dev,
501 struct tx_desc *tx_desc,
502 struct cb_desc *cb_desc,
503 struct sk_buff *skb);
504 void (*tx_fill_cmd_descriptor)(struct net_device *dev,
505 struct tx_desc_cmd *entry,
506 struct cb_desc *cb_desc,
507 struct sk_buff *skb);
508 bool (*rx_query_status_descriptor)(struct net_device *dev,
509 struct rtllib_rx_stats *stats,
510 struct rx_desc *pdesc,
511 struct sk_buff *skb);
512 bool (*rx_command_packet_handler)(struct net_device *dev,
513 struct sk_buff *skb,
514 struct rx_desc *pdesc);
515 void (*stop_adapter)(struct net_device *dev, bool reset);
516 void (*update_ratr_table)(struct net_device *dev);
517 void (*irq_enable)(struct net_device *dev);
518 void (*irq_disable)(struct net_device *dev);
519 void (*irq_clear)(struct net_device *dev);
520 void (*rx_enable)(struct net_device *dev);
521 void (*tx_enable)(struct net_device *dev);
522 void (*interrupt_recognized)(struct net_device *dev,
523 u32 *p_inta, u32 *p_intb);
524 bool (*TxCheckStuckHandler)(struct net_device *dev);
525 bool (*RxCheckStuckHandler)(struct net_device *dev);
526 };
527
528 struct r8192_priv {
529 struct pci_dev *pdev;
530 struct pci_dev *bridge_pdev;
531
532 bool bfirst_init;
533 bool bfirst_after_down;
534 bool initialized_at_probe;
535 bool being_init_adapter;
536 bool bDriverIsGoingToUnload;
537
538 int irq;
539 short irq_enabled;
540
541 short up;
542 short up_first_time;
543 struct delayed_work update_beacon_wq;
544 struct delayed_work watch_dog_wq;
545 struct delayed_work txpower_tracking_wq;
546 struct delayed_work rfpath_check_wq;
547 struct delayed_work gpio_change_rf_wq;
548 struct delayed_work initialgain_operate_wq;
549 struct delayed_work check_hw_scan_wq;
550 struct delayed_work hw_scan_simu_wq;
551 struct delayed_work start_hw_scan_wq;
552
553 struct workqueue_struct *priv_wq;
554
555 struct channel_access_setting ChannelAccessSetting;
556
557 struct mp_adapter NdisAdapter;
558
559 struct rtl819x_ops *ops;
560 struct rtllib_device *rtllib;
561
562 struct work_struct reset_wq;
563
564 struct log_int_8190 InterruptLog;
565
566 enum rt_customer_id CustomerID;
567
568
569 enum rt_rf_type_819xu rf_chip;
570 enum ic_inferiority_8192s IC_Class;
571 enum ht_channel_width CurrentChannelBW;
572 struct bb_reg_definition PHYRegDef[4];
573 struct rate_adaptive rate_adaptive;
574
575 struct ccktxbbgain cck_txbbgain_table[CCKTxBBGainTableLength];
576 struct ccktxbbgain cck_txbbgain_ch14_table[CCKTxBBGainTableLength];
577
578 struct txbbgain_struct txbbgain_table[TxBBGainTableLength];
579
580 enum acm_method AcmMethod;
581
582 struct rt_firmware *pFirmware;
583 enum rtl819x_loopback LoopbackMode;
584 enum firmware_source firmware_source;
585
586 struct timer_list watch_dog_timer;
587 struct timer_list fsync_timer;
588 struct timer_list gpio_polling_timer;
589
590 spinlock_t fw_scan_lock;
591 spinlock_t irq_lock;
592 spinlock_t irq_th_lock;
593 spinlock_t tx_lock;
594 spinlock_t rf_ps_lock;
595 spinlock_t rw_lock;
596 spinlock_t rt_h2c_lock;
597 spinlock_t rf_lock;
598 spinlock_t ps_lock;
599
600 struct sk_buff_head rx_queue;
601 struct sk_buff_head skb_queue;
602
603 struct tasklet_struct irq_rx_tasklet;
604 struct tasklet_struct irq_tx_tasklet;
605 struct tasklet_struct irq_prepare_beacon_tasklet;
606
607 struct semaphore wx_sem;
608 struct semaphore rf_sem;
609 struct mutex mutex;
610
611 struct rt_stats stats;
612 struct iw_statistics wstats;
613 struct proc_dir_entry *dir_dev;
614
615 short (*rf_set_sens)(struct net_device *dev, short sens);
616 u8 (*rf_set_chan)(struct net_device *dev, u8 ch);
617 void (*rf_close)(struct net_device *dev);
618 void (*rf_init)(struct net_device *dev);
619
620 struct rx_desc *rx_ring[MAX_RX_QUEUE];
621 struct sk_buff *rx_buf[MAX_RX_QUEUE][MAX_RX_COUNT];
622 dma_addr_t rx_ring_dma[MAX_RX_QUEUE];
623 unsigned int rx_idx[MAX_RX_QUEUE];
624 int rxringcount;
625 u16 rxbuffersize;
626
627 u64 LastRxDescTSF;
628
629 u16 EarlyRxThreshold;
630 u32 ReceiveConfig;
631 u8 AcmControl;
632 u8 RFProgType;
633 u8 retry_data;
634 u8 retry_rts;
635 u16 rts;
636
637 struct rtl8192_tx_ring tx_ring[MAX_TX_QUEUE_COUNT];
638 int txringcount;
639 int txbuffsize;
640 int txfwbuffersize;
641 atomic_t tx_pending[0x10];
642
643 u16 ShortRetryLimit;
644 u16 LongRetryLimit;
645 u32 TransmitConfig;
646 u8 RegCWinMin;
647 u8 keepAliveLevel;
648
649 bool sw_radio_on;
650 bool bHwRadioOff;
651 bool pwrdown;
652 bool blinked_ingpio;
653 u8 polling_timer_on;
654
655 /**********************************************************/
656
657 enum card_type {
658 PCI, MINIPCI,
659 CARDBUS, USB
660 } card_type;
661
662 struct work_struct qos_activate;
663
664 u8 bIbssCoordinator;
665
666 short promisc;
667 short crcmon;
668
669 int txbeaconcount;
670
671 short chan;
672 short sens;
673 short max_sens;
674 u32 rx_prevlen;
675
676 u8 ScanDelay;
677 bool ps_force;
678
679 u32 irq_mask[2];
680
681 u8 Rf_Mode;
682 enum nic_t card_8192;
683 u8 card_8192_version;
684
685 short enable_gpio0;
686
687 u8 rf_type;
688 u8 IC_Cut;
689 char nick[IW_ESSID_MAX_SIZE + 1];
690
691 u8 RegBcnCtrlVal;
692 bool bHwAntDiv;
693
694 bool bTKIPinNmodeFromReg;
695 bool bWEPinNmodeFromReg;
696
697 bool bLedOpenDrain;
698
699 u8 check_roaming_cnt;
700
701 bool bIgnoreSilentReset;
702 u32 SilentResetRxSoltNum;
703 u32 SilentResetRxSlotIndex;
704 u32 SilentResetRxStuckEvent[MAX_SILENT_RESET_RX_SLOT_NUM];
705
706 void *scan_cmd;
707 u8 hwscan_bw_40;
708
709 u16 nrxAMPDU_size;
710 u8 nrxAMPDU_aggr_num;
711
712 u32 last_rxdesc_tsf_high;
713 u32 last_rxdesc_tsf_low;
714
715 u16 basic_rate;
716 u8 short_preamble;
717 u8 dot11CurrentPreambleMode;
718 u8 slot_time;
719 u16 SifsTime;
720
721 u8 RegWirelessMode;
722
723 u8 firmware_version;
724 u16 FirmwareSubVersion;
725 u16 rf_pathmap;
726 bool AutoloadFailFlag;
727
728 u8 RegPciASPM;
729 u8 RegAMDPciASPM;
730 u8 RegHwSwRfOffD3;
731 u8 RegSupportPciASPM;
732 bool bSupportASPM;
733
734 u32 RfRegChnlVal[2];
735
736 u8 ShowRateMode;
737 u8 RATRTableBitmap;
738
739 u8 EfuseMap[2][HWSET_MAX_SIZE_92S];
740 u16 EfuseUsedBytes;
741 u8 EfuseUsedPercentage;
742
743 short epromtype;
744 u16 eeprom_vid;
745 u16 eeprom_did;
746 u16 eeprom_svid;
747 u16 eeprom_smid;
748 u8 eeprom_CustomerID;
749 u16 eeprom_ChannelPlan;
750 u8 eeprom_version;
751
752 u8 EEPROMRegulatory;
753 u8 EEPROMPwrGroup[2][3];
754 u8 EEPROMOptional;
755
756 u8 EEPROMTxPowerLevelCCK[14];
757 u8 EEPROMTxPowerLevelOFDM24G[14];
758 u8 EEPROMTxPowerLevelOFDM5G[24];
759 u8 EEPROMRfACCKChnl1TxPwLevel[3];
760 u8 EEPROMRfAOfdmChnlTxPwLevel[3];
761 u8 EEPROMRfCCCKChnl1TxPwLevel[3];
762 u8 EEPROMRfCOfdmChnlTxPwLevel[3];
763 u16 EEPROMTxPowerDiff;
764 u16 EEPROMAntPwDiff;
765 u8 EEPROMThermalMeter;
766 u8 EEPROMPwDiff;
767 u8 EEPROMCrystalCap;
768
769 u8 EEPROMBluetoothCoexist;
770 u8 EEPROMBluetoothType;
771 u8 EEPROMBluetoothAntNum;
772 u8 EEPROMBluetoothAntIsolation;
773 u8 EEPROMBluetoothRadioShared;
774
775
776 u8 EEPROMSupportWoWLAN;
777 u8 EEPROMBoardType;
778 u8 EEPROM_Def_Ver;
779 u8 EEPROMHT2T_TxPwr[6];
780 u8 EEPROMTSSI_A;
781 u8 EEPROMTSSI_B;
782 u8 EEPROMTxPowerLevelCCK_V1[3];
783 u8 EEPROMLegacyHTTxPowerDiff;
784
785 u8 BluetoothCoexist;
786
787 u8 CrystalCap;
788 u8 ThermalMeter[2];
789
790 u16 FwCmdIOMap;
791 u32 FwCmdIOParam;
792
793 u8 SwChnlInProgress;
794 u8 SwChnlStage;
795 u8 SwChnlStep;
796 u8 SetBWModeInProgress;
797
798 u8 nCur40MhzPrimeSC;
799
800 u32 RfReg0Value[4];
801 u8 NumTotalRFPath;
802 bool brfpath_rxenable[4];
803
804 bool bTXPowerDataReadFromEEPORM;
805
806 u16 RegChannelPlan;
807 u16 ChannelPlan;
808 bool bChnlPlanFromHW;
809
810 bool RegRfOff;
811 bool isRFOff;
812 bool bInPowerSaveMode;
813 u8 bHwRfOffAction;
814
815 bool aspm_clkreq_enable;
816 u32 pci_bridge_vendor;
817 u8 RegHostPciASPMSetting;
818 u8 RegDevicePciASPMSetting;
819
820 bool RFChangeInProgress;
821 bool SetRFPowerStateInProgress;
822 bool bdisable_nic;
823
824 u8 pwrGroupCnt;
825
826 u8 ThermalValue_LCK;
827 u8 ThermalValue_IQK;
828 bool bRfPiEnable;
829
830 u32 APKoutput[2][2];
831 bool bAPKdone;
832
833 long RegE94;
834 long RegE9C;
835 long RegEB4;
836 long RegEBC;
837
838 u32 RegC04;
839 u32 Reg874;
840 u32 RegC08;
841 u32 ADDA_backup[16];
842 u32 IQK_MAC_backup[3];
843
844 bool SetFwCmdInProgress;
845 u8 CurrentFwCmdIO;
846
847 u8 rssi_level;
848
849 bool bInformFWDriverControlDM;
850 u8 PwrGroupHT20[2][14];
851 u8 PwrGroupHT40[2][14];
852
853 u8 ThermalValue;
854 long EntryMinUndecoratedSmoothedPWDB;
855 long EntryMaxUndecoratedSmoothedPWDB;
856 u8 DynamicTxHighPowerLvl;
857 u8 LastDTPLvl;
858 u32 CurrentRATR0;
859 struct false_alarm_stats FalseAlmCnt;
860
861 u8 DMFlag;
862 u8 DM_Type;
863
864 u8 CckPwEnl;
865 u16 TSSI_13dBm;
866 u32 Pwr_Track;
867 u8 CCKPresentAttentuation_20Mdefault;
868 u8 CCKPresentAttentuation_40Mdefault;
869 char CCKPresentAttentuation_difference;
870 char CCKPresentAttentuation;
871 u8 bCckHighPower;
872 long undecorated_smoothed_pwdb;
873 long undecorated_smoothed_cck_adc_pwdb[4];
874
875 u32 MCSTxPowerLevelOriginalOffset[6];
876 u32 CCKTxPowerLevelOriginalOffset;
877 u8 TxPowerLevelCCK[14];
878 u8 TxPowerLevelCCK_A[14];
879 u8 TxPowerLevelCCK_C[14];
880 u8 TxPowerLevelOFDM24G[14];
881 u8 TxPowerLevelOFDM5G[14];
882 u8 TxPowerLevelOFDM24G_A[14];
883 u8 TxPowerLevelOFDM24G_C[14];
884 u8 LegacyHTTxPowerDiff;
885 u8 TxPowerDiff;
886 s8 RF_C_TxPwDiff;
887 s8 RF_B_TxPwDiff;
888 u8 RfTxPwrLevelCck[2][14];
889 u8 RfTxPwrLevelOfdm1T[2][14];
890 u8 RfTxPwrLevelOfdm2T[2][14];
891 u8 AntennaTxPwDiff[3];
892 u8 TxPwrHt20Diff[2][14];
893 u8 TxPwrLegacyHtDiff[2][14];
894 u8 TxPwrSafetyFlag;
895 u8 HT2T_TxPwr_A[14];
896 u8 HT2T_TxPwr_B[14];
897 u8 CurrentCckTxPwrIdx;
898 u8 CurrentOfdm24GTxPwrIdx;
899
900 bool bdynamic_txpower;
901 bool bDynamicTxHighPower;
902 bool bDynamicTxLowPower;
903 bool bLastDTPFlag_High;
904 bool bLastDTPFlag_Low;
905
906 bool bstore_last_dtpflag;
907 bool bstart_txctrl_bydtp;
908
909 u8 rfa_txpowertrackingindex;
910 u8 rfa_txpowertrackingindex_real;
911 u8 rfa_txpowertracking_default;
912 u8 rfc_txpowertrackingindex;
913 u8 rfc_txpowertrackingindex_real;
914 u8 rfc_txpowertracking_default;
915 bool btxpower_tracking;
916 bool bcck_in_ch14;
917
918 u8 TxPowerTrackControl;
919 u8 txpower_count;
920 bool btxpower_trackingInit;
921
922 u8 OFDM_index[2];
923 u8 CCK_index;
924
925 u8 Record_CCK_20Mindex;
926 u8 Record_CCK_40Mindex;
927
928 struct init_gain initgain_backup;
929 u8 DefaultInitialGain[4];
930 bool bis_any_nonbepkts;
931 bool bcurrent_turbo_EDCA;
932 bool bis_cur_rdlstate;
933
934 bool bCCKinCH14;
935
936 u8 MidHighPwrTHR_L1;
937 u8 MidHighPwrTHR_L2;
938
939 bool bfsync_processing;
940 u32 rate_record;
941 u32 rateCountDiffRecord;
942 u32 ContinueDiffCount;
943 bool bswitch_fsync;
944 u8 framesync;
945 u32 framesyncC34;
946 u8 framesyncMonitor;
947
948 bool bDMInitialGainEnable;
949 bool MutualAuthenticationFail;
950
951 bool bDisableFrameBursting;
952
953 u32 reset_count;
954 bool bpbc_pressed;
955
956 u32 txpower_checkcnt;
957 u32 txpower_tracking_callback_cnt;
958 u8 thermal_read_val[40];
959 u8 thermal_readback_index;
960 u32 ccktxpower_adjustcnt_not_ch14;
961 u32 ccktxpower_adjustcnt_ch14;
962
963 enum reset_type ResetProgress;
964 bool bForcedSilentReset;
965 bool bDisableNormalResetCheck;
966 u16 TxCounter;
967 u16 RxCounter;
968 int IrpPendingCount;
969 bool bResetInProgress;
970 bool force_reset;
971 bool force_lps;
972 u8 InitialGainOperateType;
973
974 bool chan_forced;
975 bool bSingleCarrier;
976 bool RegBoard;
977 bool bCckContTx;
978 bool bOfdmContTx;
979 bool bStartContTx;
980 u8 RegPaModel;
981 u8 btMpCckTxPower;
982 u8 btMpOfdmTxPower;
983
984 u32 MptActType;
985 u32 MptIoOffset;
986 u32 MptIoValue;
987 u32 MptRfPath;
988
989 u32 MptBandWidth;
990 u32 MptRateIndex;
991 u8 MptChannelToSw;
992 u32 MptRCR;
993
994 u8 PwrDomainProtect;
995 u8 H2CTxCmdSeq;
996
997
998 };
999
1000 extern const struct ethtool_ops rtl819x_ethtool_ops;
1001
1002 void rtl8192_tx_cmd(struct net_device *dev, struct sk_buff *skb);
1003 short rtl8192_tx(struct net_device *dev, struct sk_buff *skb);
1004
1005 u8 read_nic_io_byte(struct net_device *dev, int x);
1006 u32 read_nic_io_dword(struct net_device *dev, int x);
1007 u16 read_nic_io_word(struct net_device *dev, int x) ;
1008 void write_nic_io_byte(struct net_device *dev, int x, u8 y);
1009 void write_nic_io_word(struct net_device *dev, int x, u16 y);
1010 void write_nic_io_dword(struct net_device *dev, int x, u32 y);
1011
1012 u8 read_nic_byte(struct net_device *dev, int x);
1013 u32 read_nic_dword(struct net_device *dev, int x);
1014 u16 read_nic_word(struct net_device *dev, int x) ;
1015 void write_nic_byte(struct net_device *dev, int x, u8 y);
1016 void write_nic_word(struct net_device *dev, int x, u16 y);
1017 void write_nic_dword(struct net_device *dev, int x, u32 y);
1018
1019 void force_pci_posting(struct net_device *dev);
1020
1021 void rtl8192_rx_enable(struct net_device *);
1022 void rtl8192_tx_enable(struct net_device *);
1023
1024 int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev);
1025 void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
1026 int rate);
1027 void rtl8192_data_hard_stop(struct net_device *dev);
1028 void rtl8192_data_hard_resume(struct net_device *dev);
1029 void rtl8192_restart(void *data);
1030 void rtl819x_watchdog_wqcallback(void *data);
1031 void rtl8192_hw_sleep_wq(void *data);
1032 void watch_dog_timer_callback(unsigned long data);
1033 void rtl8192_irq_rx_tasklet(struct r8192_priv *priv);
1034 void rtl8192_irq_tx_tasklet(struct r8192_priv *priv);
1035 int rtl8192_down(struct net_device *dev, bool shutdownrf);
1036 int rtl8192_up(struct net_device *dev);
1037 void rtl8192_commit(struct net_device *dev);
1038 void rtl8192_set_chan(struct net_device *dev, short ch);
1039
1040 void check_rfctrl_gpio_timer(unsigned long data);
1041
1042 void rtl8192_hw_wakeup_wq(void *data);
1043 short rtl8192_pci_initdescring(struct net_device *dev);
1044
1045 void rtl8192_cancel_deferred_work(struct r8192_priv *priv);
1046
1047 int _rtl8192_up(struct net_device *dev, bool is_silent_reset);
1048
1049 short rtl8192_is_tx_queue_empty(struct net_device *dev);
1050 void rtl8192_irq_disable(struct net_device *dev);
1051
1052 void rtl8192_tx_timeout(struct net_device *dev);
1053 void rtl8192_pci_resetdescring(struct net_device *dev);
1054 void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode);
1055 void rtl8192_irq_enable(struct net_device *dev);
1056 void rtl8192_config_rate(struct net_device *dev, u16 *rate_config);
1057 void rtl8192_update_cap(struct net_device *dev, u16 cap);
1058 void rtl8192_irq_disable(struct net_device *dev);
1059
1060 void rtl819x_UpdateRxPktTimeStamp(struct net_device *dev,
1061 struct rtllib_rx_stats *stats);
1062 long rtl819x_translate_todbm(struct r8192_priv *priv, u8 signal_strength_index);
1063 void rtl819x_update_rxsignalstatistics8190pci(struct r8192_priv *priv,
1064 struct rtllib_rx_stats *pprevious_stats);
1065 u8 rtl819x_evm_dbtopercentage(char value);
1066 void rtl819x_process_cck_rxpathsel(struct r8192_priv *priv,
1067 struct rtllib_rx_stats *pprevious_stats);
1068 u8 rtl819x_query_rxpwrpercentage(char antpower);
1069 void rtl8192_record_rxdesc_forlateruse(struct rtllib_rx_stats *psrc_stats,
1070 struct rtllib_rx_stats *ptarget_stats);
1071 bool NicIFEnableNIC(struct net_device *dev);
1072 bool NicIFDisableNIC(struct net_device *dev);
1073
1074 bool MgntActSet_RF_State(struct net_device *dev,
1075 enum rt_rf_power_state StateToSet,
1076 RT_RF_CHANGE_SOURCE ChangeSource,
1077 bool ProtectOrNot);
1078 void ActUpdateChannelAccessSetting(struct net_device *dev,
1079 enum wireless_mode WirelessMode,
1080 struct channel_access_setting *ChnlAccessSetting);
1081
1082 #endif
This page took 0.052301 seconds and 4 git commands to generate.