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