add rk3288 pinctrl dts code
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / mt5931_kk / drv_wlan / include / nic / adapter.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT662X_593X_WIFI_DRIVER_V2_3/include/nic/adapter.h#1 $
3 */
4
5 /*! \file   adapter.h
6     \brief  Definition of internal data structure for driver manipulation.
7
8     In this file we define the internal data structure - ADAPTER_T which stands
9     for MiniPort ADAPTER(From Windows point of view) or stands for Network ADAPTER.
10 */
11
12 /*******************************************************************************
13 * Copyright (c) 2007 MediaTek Inc.
14 *
15 * All rights reserved. Copying, compilation, modification, distribution
16 * or any other use whatsoever of this material is strictly prohibited
17 * except in accordance with a Software License Agreement with
18 * MediaTek Inc.
19 ********************************************************************************
20 */
21
22 /*******************************************************************************
23 * LEGAL DISCLAIMER
24 *
25 * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND
26 * AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK
27 * SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE
28 * PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY
29 * DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
30 * LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
31 * PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE
32 * ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY
33 * WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK
34 * SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY
35 * WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE
36 * FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO
37 * CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
38 *
39 * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
40 * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL
41 * BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT
42 * ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY
43 * BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
44 *
45 * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
46 * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT
47 * OF LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING
48 * THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN
49 * FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE
50 * (ICC).
51 ********************************************************************************
52 */
53
54 /*
55 ** $Log: adapter.h $
56 **
57 ** 10 31 2012 cp.wu
58 ** [WCXRP00001269] [MT6620 Wi-Fi][Driver] cfg80211 porting merge back to DaVinci
59 ** to sync with CFG80211 behavior for CFG80211 will block disconnect request while not staying in connected state
60 ** 
61 ** 08 24 2012 cp.wu
62 ** [WCXRP00001269] [MT6620 Wi-Fi][Driver] cfg80211 porting merge back to DaVinci
63 ** .
64 ** 
65 ** 08 24 2012 cp.wu
66 ** [WCXRP00001269] [MT6620 Wi-Fi][Driver] cfg80211 porting merge back to DaVinci
67 ** cfg80211 support merge back from ALPS.JB to DaVinci - MT6620 Driver v2.3 branch.
68 ** 
69 ** 07 24 2012 yuche.tsai
70 ** NULL
71 ** Bug fix for JB.
72  *
73  * 07 17 2012 yuche.tsai
74  * NULL
75  * Let netdev bring up.
76  *
77  * 07 17 2012 yuche.tsai
78  * NULL
79  * Compile no error before trial run.
80  *
81  * 06 13 2012 yuche.tsai
82  * NULL
83  * Update maintrunk driver.
84  * Add support for driver compose assoc request frame.
85  *
86  * 03 02 2012 terry.wu
87  * NULL
88  * Snc CFG80211 modification for ICS migration from branch 2.2.
89  *
90  * 03 02 2012 terry.wu
91  * NULL
92  * Sync CFG80211 modification from branch 2,2.
93  *
94  * 01 16 2012 cp.wu
95  * [MT6620 Wi-Fi][Driver] API and behavior modification for preferred band configuration with corresponding network configuration 
96  * add wlanSetPreferBandByNetwork() for glue layer to invoke for setting preferred band configuration corresponding to network type.
97  *
98  * 12 13 2011 cm.chang
99  * [WCXRP00001136] [All Wi-Fi][Driver] Add wake lock for pending timer
100  * Add wake lock if timer timeout value is smaller than 5 seconds
101  *
102  * 12 02 2011 yuche.tsai
103  * NULL
104  * Resolve inorder issue under AP mode.
105  * 
106  * data frame may TX before assoc response frame.
107  *
108  * 11 19 2011 yuche.tsai
109  * NULL
110  * Update RSSI for P2P.
111  *
112  * 11 18 2011 yuche.tsai
113  * NULL
114  * CONFIG P2P support RSSI query, default turned off.
115  *
116  * 11 11 2011 yuche.tsai
117  * NULL
118  * Fix work thread cancel issue.
119  *
120  * 10 21 2011 eddie.chen
121  * [WCXRP00001051] [MT6620 Wi-Fi][Driver/Fw] Adjust the STA aging timeout
122  * Add switch to ignore the STA aging timeout.
123  *
124  * 10 12 2011 wh.su
125  * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP
126  * adding the 802.11w related function and define .
127  *
128  * 09 20 2011 cm.chang
129  * [WCXRP00000997] [MT6620 Wi-Fi][Driver][FW] Handle change of BSS preamble type and slot time
130  * Remove ERP member in adapter structure
131  *
132  * 09 14 2011 yuche.tsai
133  * NULL
134  * Add P2P IE in assoc response.
135  *
136  * 08 31 2011 cm.chang
137  * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code
138  * .
139  *
140  * 07 18 2011 chinghwa.yu
141  * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm
142  * Add CMD/Event for RDD and BWCS.
143  *
144  * 06 23 2011 cp.wu
145  * [WCXRP00000812] [MT6620 Wi-Fi][Driver] not show NVRAM when there is no valid MAC address in NVRAM content
146  * check with firmware for valid MAC address.
147  *
148  * 04 18 2011 terry.wu
149  * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED
150  * Remove flag CFG_WIFI_DIRECT_MOVED.
151  *
152  * 04 12 2011 cm.chang
153  * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency
154  * .
155  *
156  * 04 08 2011 yuche.tsai
157  * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
158  * Add device discoverability support.
159  * Action frame callback for GO Device Discoverability Req.
160  *
161  * 04 08 2011 george.huang
162  * [WCXRP00000621] [MT6620 Wi-Fi][Driver] Support P2P supplicant to set power mode
163  * separate settings of P2P and AIS
164  *
165  * 04 08 2011 eddie.chen
166  * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma
167  * Fix for sigma
168  *
169  * 03 19 2011 yuche.tsai
170  * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct.
171  * Add beacon timeout support for WiFi Direct Network.
172  *
173  * 03 19 2011 yuche.tsai
174  * [WCXRP00000581] [Volunteer Patch][MT6620][Driver] P2P IE in Assoc Req Issue
175  * Make assoc req to append P2P IE if wifi direct is enabled.
176  *
177  * 03 17 2011 cp.wu
178  * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage after system running for a long period
179  * use pre-allocated buffer for storing enhanced interrupt response as well
180  *
181  * 03 15 2011 cp.wu
182  * [WCXRP00000559] [MT6620 Wi-Fi][Driver] Combine TX/RX DMA buffers into a single one to reduce physically continuous memory consumption
183  * 1. deprecate CFG_HANDLE_IST_IN_SDIO_CALLBACK
184  * 2. Use common coalescing buffer for both TX/RX directions
185  *
186  *
187  * 03 10 2011 yuche.tsai
188  * [WCXRP00000533] [Volunteer Patch][MT6620][Driver] Provide a P2P function API for Legacy WiFi to query AP mode.
189  * Provide an API for Legacy WiFi to query the operation mode..
190  *
191  * 03 05 2011 wh.su
192  * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
193  * add the code to get the check rsponse and indicate to app.
194  *
195  * 03 02 2011 wh.su
196  * [WCXRP00000448] [MT6620 Wi-Fi][Driver] Fixed WSC IE not send out at probe request
197  * Add code to send beacon and probe response WSC IE at Auto GO.
198  *
199  * 03 02 2011 cp.wu
200  * [WCXRP00000503] [MT6620 Wi-Fi][Driver] Take RCPI brought by association response as initial RSSI right after connection is built.
201  * use RCPI brought by ASSOC-RESP after connection is built as initial RCPI to avoid using a uninitialized MAC-RX RCPI.
202  *
203  * 02 21 2011 terry.wu
204  * [WCXRP00000476] [MT6620 Wi-Fi][Driver] Clean P2P scan list while removing P2P
205  * Clean P2P scan list while removing P2P.
206  *
207  * 02 17 2011 eddie.chen
208  * [WCXRP00000458] [MT6620 Wi-Fi][Driver] BOW Concurrent - ProbeResp was exist in other channel
209  * 1) Chnage GetFrameAction decision when BSS is absent.
210  * 2) Check channel and resource in processing ProbeRequest
211  *
212  * 02 16 2011 cm.chang
213  * [WCXRP00000447] [MT6620 Wi-Fi][FW] Support new NVRAM update mechanism
214  * .
215  *
216  * 02 10 2011 yuche.tsai
217  * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
218  * Add RX deauthentication & disassociation process under Hot-Spot mode.
219  *
220  * 02 09 2011 wh.su
221  * [WCXRP00000433] [MT6620 Wi-Fi][Driver] Remove WAPI structure define for avoid P2P module with structure miss-align pointer issue
222  * always pre-allio WAPI related structure for align p2p module.
223  *
224  * 02 08 2011 yuche.tsai
225  * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module.
226  * Provide disconnect function for AAA module.
227  *
228  * 02 01 2011 cm.chang
229  * [WCXRP00000415] [MT6620 Wi-Fi][Driver] Check if any memory leakage happens when uninitializing in DGB mode
230  * .
231  *
232  * 01 27 2011 tsaiyuan.hsu
233  * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support
234  * add roaming fsm
235  * 1. not support 11r, only use strength of signal to determine roaming.
236  * 2. not enable CFG_SUPPORT_ROAMING until completion of full test.
237  * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw
238  * 4. assume that change of link quality in smooth way.
239  *
240  * 01 27 2011 george.huang
241  * [WCXRP00000400] [MT6620 Wi-Fi] support CTIA power mode setting
242  * Support CTIA power mode setting.
243  *
244  * 01 27 2011 george.huang
245  * [WCXRP00000355] [MT6620 Wi-Fi] Set WMM-PS related setting with qualifying AP capability
246  * Support current measure mode, assigned by registry (XP only).
247  *
248  * 01 24 2011 cp.wu
249  * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving
250  * 1. add an extra counter for tracking pending forward frames.
251  * 2. notify TX service thread as well when there is pending forward frame
252  * 3. correct build errors leaded by introduction of Wi-Fi direct separation module
253  *
254  * 01 12 2011 cm.chang
255  * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting
256  * User-defined bandwidth is for 2.4G and 5G individually
257  *
258  * 12 29 2010 eddie.chen
259  * [WCXRP00000322] Add WMM IE in beacon,
260
261 Add per station flow control when STA is in PS
262
263
264  * Add WMM parameter for broadcast.
265  *
266  * 12 29 2010 eddie.chen
267  * [WCXRP00000322] Add WMM IE in beacon,
268
269 Add per station flow control when STA is in PS
270
271
272  * Add CWMin CWMax for AP to generate IE.
273  *
274  * 12 29 2010 eddie.chen
275  * [WCXRP00000322] Add WMM IE in beacon,
276 Add per station flow control when STA is in PS
277
278  * 1) PS flow control event
279  *
280  * 2) WMM IE in beacon, assoc resp, probe resp
281  *
282  * 12 28 2010 cp.wu
283  * [WCXRP00000269] [MT6620 Wi-Fi][Driver][Firmware] Prepare for v1.1 branch release
284  * report EEPROM used flag via NIC_CAPABILITY
285  *
286  * 12 28 2010 cp.wu
287  * [WCXRP00000269] [MT6620 Wi-Fi][Driver][Firmware] Prepare for v1.1 branch release
288  * integrate with 'EEPROM used' flag for reporting correct capability to Engineer Mode/META and other tools
289  *
290  * 12 07 2010 cm.chang
291  * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant
292  * 1. Country code is from NVRAM or supplicant
293  * 2. Change band definition in CMD/EVENT.
294  *
295  * 11 01 2010 cp.wu
296  * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module
297  * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead
298  * 2) Remove CNM CH-RECOVER event handling
299  * 3) cfg read/write API renamed with kal prefix for unified naming rules.
300  *
301  * 10 27 2010 george.huang
302  * [WCXRP00000127] [MT6620 Wi-Fi][Driver] Add a registry to disable Beacon Timeout function for SQA test by using E1 EVB
303  * Support registry option for disable beacon lost detection.
304  *
305  * 10 26 2010 cp.wu
306  * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000137] [MT6620 Wi-Fi] [FW] Support NIC capability query command
307  * 1) update NVRAM content template to ver 1.02
308  * 2) add compile option for querying NIC capability (default: off)
309  * 3) modify AIS 5GHz support to run-time option, which could be turned on by registry or NVRAM setting
310  * 4) correct auto-rate compiler error under linux (treat warning as error)
311  * 5) simplify usage of NVRAM and REG_INFO_T
312  * 6) add version checking between driver and firmware
313  *
314  * 10 08 2010 cp.wu
315  * [WCXRP00000084] [MT6620 Wi-Fi][Driver][FW] Add fixed rate support for distance test
316  * adding fixed rate support for distance test. (from registry setting)
317  *
318  * 10 06 2010 cp.wu
319  * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning
320  * code reorganization to improve isolation between GLUE and CORE layers.
321  *
322  * 10 05 2010 cp.wu
323  * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check
324  * 1) add NVRAM access API
325  * 2) fake scanning result when NVRAM doesn't exist and/or version mismatch. (off by compiler option)
326  * 3) add OID implementation for NVRAM read/write service
327  *
328  * 09 27 2010 chinghwa.yu
329  * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000065] Update BoW design and settings
330  * Update BCM/BoW design and settings.
331  *
332  * 09 24 2010 cp.wu
333  * [WCXRP00000057] [MT6620 Wi-Fi][Driver] Modify online scan to a run-time switchable feature
334  * Modify online scan as a run-time adjustable option (for Windows, in registry)
335  *
336  * 09 23 2010 cp.wu
337  * [WCXRP00000051] [MT6620 Wi-Fi][Driver] WHQL test fail in MAC address changed item
338  * use firmware reported mac address right after wlanAdapterStart() as permanent address
339  *
340  * 09 08 2010 cp.wu
341  * NULL
342  * use static memory pool for storing IEs of scanning result.
343  *
344  * 09 07 2010 yuche.tsai
345  * NULL
346  * Add a common IE buffer in P2P INFO structure.
347  *
348  * 09 03 2010 kevin.huang
349  * NULL
350  * Refine #include sequence and solve recursive/nested #include issue
351  *
352  * 09 01 2010 cp.wu
353  * NULL
354  * restore configuration as before.
355  *
356  * 09 01 2010 wh.su
357  * NULL
358  * adding the wapi support for integration test.
359  *
360  * 08 31 2010 kevin.huang
361  * NULL
362  * Use LINK LIST operation to process SCAN result
363  *
364  * 08 29 2010 yuche.tsai
365  * NULL
366  * Finish SLT TX/RX & Rate Changing Support.
367  *
368  * 08 25 2010 george.huang
369  * NULL
370  * update OID/ registry control path for PM related settings
371  *
372  * 08 24 2010 cm.chang
373  * NULL
374  * Support RLM initail channel of Ad-hoc, P2P and BOW
375  *
376  * 08 23 2010 chinghwa.yu
377  * NULL
378  * Update for BOW.
379  *
380  * 08 20 2010 cm.chang
381  * NULL
382  * Migrate RLM code to host from FW
383  *
384  * 08 16 2010 yuche.tsai
385  * NULL
386  * Add an intend mode for BSS info.
387  * It is used to let P2P BSS Info to know which OP Mode it is going to become.
388  *
389  * 08 04 2010 george.huang
390  * NULL
391  * handle change PS mode OID/ CMD
392  *
393  * 08 02 2010 cp.wu
394  * NULL
395  * comment out deprecated members in BSS_INFO, which are only used by firmware rather than driver.
396  *
397  * 07 29 2010 cp.wu
398  * NULL
399  * eliminate u4FreqInKHz usage, combined into rConnections.ucAdHoc*
400  *
401  * 07 28 2010 cp.wu
402  * NULL
403  * 1) eliminate redundant variable eOPMode in prAdapter->rWlanInfo
404  * 2) change nicMediaStateChange() API prototype
405  *
406  * 07 24 2010 wh.su
407  *
408  * .support the Wi-Fi RSN
409  *
410  * 07 21 2010 yuche.tsai
411  *
412  * Add for P2P Scan Result Parsing & Saving.
413  *
414  * 07 19 2010 wh.su
415  *
416  * update for security supporting.
417  *
418  * 07 19 2010 cm.chang
419  *
420  * Set RLM parameters and enable CNM channel manager
421  *
422  * 07 19 2010 yuche.tsai
423  *
424  * Remove BSS info which is redonedent in Wifi Var..
425  *
426  * 07 16 2010 yarco.yang
427  *
428  * 1. Support BSS Absence/Presence Event
429  * 2. Support STA change PS mode Event
430  * 3. Support BMC forwarding for AP mode.
431  *
432  * 07 14 2010 yarco.yang
433  *
434  * 1. Remove CFG_MQM_MIGRATION
435  * 2. Add CMD_UPDATE_WMM_PARMS command
436  *
437  * 07 09 2010 george.huang
438  *
439  * [WPD00001556] Migrate PM variables from FW to driver: for composing QoS Info
440  *
441  * 07 08 2010 cp.wu
442  *
443  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
444  *
445  * 07 08 2010 cm.chang
446  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
447  * Check draft RLM code for HT cap
448  *
449  * 06 29 2010 yarco.yang
450  * [WPD00003837][MT6620]Data Path Refine
451  * replace g_rQM with Adpater->rQM
452  *
453  * 06 28 2010 cm.chang
454  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
455  * 1st draft code for RLM module
456  *
457  * 06 21 2010 wh.su
458  * [WPD00003840][MT6620 5931] Security migration
459  * remove duplicate variable for migration.
460  *
461  * 06 21 2010 wh.su
462  * [WPD00003840][MT6620 5931] Security migration
463  * modify some code for concurrent network.
464  *
465  * 06 21 2010 yuche.tsai
466  * [WPD00003839][MT6620 5931][P2P] Feature migration
467  * Add P2P FSM Info in adapter.
468  *
469  * 06 21 2010 yarco.yang
470  * [WPD00003837][MT6620]Data Path Refine
471  * Support CFG_MQM_MIGRATION flag
472  *
473  * 06 18 2010 cm.chang
474  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
475  * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf
476  *
477  * 06 18 2010 wh.su
478  * [WPD00003840][MT6620 5931] Security migration
479  * migration the security related function from firmware.
480  *
481  * 06 17 2010 yuche.tsai
482  * [WPD00003839][MT6620 5931][P2P] Feature migration
483  * Add P2P related field, additional include p2p_fsm.h if p2p is enabled.
484  *
485  * 06 15 2010 cp.wu
486  * [WPD00003833][MT6620 and MT5931] Driver migration
487  * add scan.c.
488  *
489  * 06 14 2010 cp.wu
490  * [WPD00003833][MT6620 and MT5931] Driver migration
491  * add management dispatching function table.
492  *
493  * 06 11 2010 cp.wu
494  * [WPD00003833][MT6620 and MT5931] Driver migration
495  * auth.c is migrated.
496  *
497  * 06 11 2010 cp.wu
498  * [WPD00003833][MT6620 and MT5931] Driver migration
499  * 1) migrate assoc.c.
500  * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness
501  * 3) add configuration options for CNM_MEM and RSN modules
502  * 4) add data path for management frames
503  * 5) eliminate rPacketInfo of MSDU_INFO_T
504  *
505  * 06 10 2010 cp.wu
506  * [WPD00003833][MT6620 and MT5931] Driver migration
507  * add buildable & linkable ais_fsm.c
508  *
509  * related reference are still waiting to be resolved
510  *
511  * 06 09 2010 cp.wu
512  * [WPD00003833][MT6620 and MT5931] Driver migration
513  * add definitions for module migration.
514  *
515  * 06 08 2010 cp.wu
516  * [WPD00003833][MT6620 and MT5931] Driver migration
517  * cnm_timer has been migrated.
518  *
519  * 06 08 2010 cp.wu
520  * [WPD00003833][MT6620 and MT5931] Driver migration
521  * hem_mbox is migrated.
522  *
523  * 06 07 2010 cp.wu
524  * [WPD00003833][MT6620 and MT5931] Driver migration
525  * merge wifi_var.h, precomp.h, cnm_timer.h (data type only)
526  *
527  * 06 06 2010 kevin.huang
528  * [WPD00003832][MT6620 5931] Create driver base
529  * [MT6620 5931] Create driver base
530  *
531  * 05 22 2010 cp.wu
532  * [WPD00001943]Create WiFi test driver framework on WinXP
533  * change OID behavior to meet WHQL requirement.
534  *
535  * 05 20 2010 cp.wu
536  * [WPD00001943]Create WiFi test driver framework on WinXP
537  * 1) integrate OID_GEN_NETWORK_LAYER_ADDRESSES with CMD_ID_SET_IP_ADDRESS
538  * 2) buffer statistics data for 2 seconds
539  * 3) use default value for adhoc parameters instead of 0
540  *
541  * 05 19 2010 cp.wu
542  * [WPD00001943]Create WiFi test driver framework on WinXP
543  * 1) do not take timeout mechanism for power mode oids
544  * 2) retrieve network type from connection status
545  * 3) after disassciation, set radio state to off
546  * 4) TCP option over IPv6 is supported
547  *
548  * 05 18 2010 cp.wu
549  * [WPD00001943]Create WiFi test driver framework on WinXP
550  * implement Wakeup-on-LAN except firmware integration part
551  *
552  * 04 27 2010 cp.wu
553  * [WPD00001943]Create WiFi test driver framework on WinXP
554  * reserve field of privacy filter and RTS threshold setting.
555  *
556  * 04 13 2010 cp.wu
557  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
558  * add framework for BT-over-Wi-Fi support.
559  *  *  *  *  *  * 1) prPendingCmdInfo is replaced by queue for multiple handler capability
560  *  *  *  *  *  * 2) command sequence number is now increased atomically
561  *  *  *  *  *  * 3) private data could be hold and taken use for other purpose
562  *
563  * 04 07 2010 cp.wu
564  * [WPD00001943]Create WiFi test driver framework on WinXP
565  * rWlanInfo should be placed at adapter rather than glue due to most operations
566  *  *  * are done in adapter layer.
567  *
568  * 04 06 2010 cp.wu
569  * [WPD00001943]Create WiFi test driver framework on WinXP
570  * code refine: fgTestMode should be at adapter rather than glue due to the device/fw is also involved
571  *
572  * 03 31 2010 wh.su
573  * [WPD00003816][MT6620 Wi-Fi] Adding the security support
574  * modify the wapi related code for new driver's design.
575  *
576  * 03 19 2010 cp.wu
577  * [WPD00001943]Create WiFi test driver framework on WinXP
578  * 1) add ACPI D0/D3 state switching support
579  *  *  * 2) use more formal way to handle interrupt when the status is retrieved from enhanced RX response
580  *
581  * 03 03 2010 cp.wu
582  * [WPD00001943]Create WiFi test driver framework on WinXP
583  * implement OID_802_3_MULTICAST_LIST oid handling
584  *
585  * 03 02 2010 cp.wu
586  * [WPD00001943]Create WiFi test driver framework on WinXP
587  * 1) the use of prPendingOid revised, all accessing are now protected by spin lock
588  *  *  * 2) ensure wlanReleasePendingOid will clear all command queues
589  *
590  * 02 09 2010 cp.wu
591  * [WPD00001943]Create WiFi test driver framework on WinXP
592  * move ucCmdSeqNum as instance variable
593  *
594  * 01 27 2010 wh.su
595  * [WPD00003816][MT6620 Wi-Fi] Adding the security support
596  * .
597  *
598  * 01 27 2010 cp.wu
599  * [WPD00001943]Create WiFi test driver framework on WinXP
600  * 1. eliminate improper variable in rHifInfo
601  *  *  * 2. block TX/ordinary OID when RF test mode is engaged
602  *  *  * 3. wait until firmware finish operation when entering into and leaving from RF test mode
603  *  *  * 4. correct some HAL implementation
604  *
605  * 12 30 2009 cp.wu
606  * [WPD00001943]Create WiFi test driver framework on WinXP
607  * 1) According to CMD/EVENT documentation v0.8,
608  *  *  * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used,
609  *  *  * and result is retrieved by get ATInfo instead
610  *  *  * 2) add 4 counter for recording aggregation statistics
611  *
612  * 12 28 2009 cp.wu
613  * [WPD00001943]Create WiFi test driver framework on WinXP
614  * eliminate redundant variables for connection_state
615 **  \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-12-16 18:02:03 GMT mtk02752
616 **  add external reference to avoid compilation error
617 **  \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-12-10 16:40:26 GMT mtk02752
618 **  eliminate unused member
619 **  \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-12-08 17:36:08 GMT mtk02752
620 **  add RF test data members into P_ADAPTER_T
621 **  \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-10-13 21:58:45 GMT mtk01084
622 **  update for new HW architecture design
623 **  \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-04-28 10:29:57 GMT mtk01461
624 **  Add read WTSR for SDIO_STATUS_ENHANCE mode
625 **  \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-04-21 09:37:35 GMT mtk01461
626 **  Add prPendingCmdInfoOfOID for temporarily saving the CMD_INFO_T before en-queue to rCmdQueue
627 **  \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-04-17 19:57:51 GMT mtk01461
628 **  Add MGMT Buffer Info
629 **  \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-01 10:34:12 GMT mtk01461
630 **  Add SW pre test CFG_HIF_LOOPBACK_PRETEST
631 **  \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-03-23 21:41:48 GMT mtk01461
632 **  Add fgIsWmmAssoc flag for TC assignment
633 **  \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-19 18:32:51 GMT mtk01084
634 **  update for basic power management functions
635 **  \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-18 20:51:52 GMT mtk01426
636 **  Add #if CFG_SDIO_RX_ENHANCE related data structure
637 **  \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:16:17 GMT mtk01426
638 **  Init for develop
639 **
640 */
641
642 #ifndef _ADAPTER_H
643 #define _ADAPTER_H
644
645 /*******************************************************************************
646 *                         C O M P I L E R   F L A G S
647 ********************************************************************************
648 */
649
650 /*******************************************************************************
651 *                    E X T E R N A L   R E F E R E N C E S
652 ********************************************************************************
653 */
654
655 /*******************************************************************************
656 *                              C O N S T A N T S
657 ********************************************************************************
658 */
659
660 /*******************************************************************************
661 *                             D A T A   T Y P E S
662 ********************************************************************************
663 */
664 typedef struct _ENHANCE_MODE_DATA_STRUCT_T SDIO_CTRL_T, *P_SDIO_CTRL_T;
665
666 typedef struct _WLAN_INFO_T {
667     PARAM_BSSID_EX_T                rCurrBssId;
668
669     // Scan Result
670     PARAM_BSSID_EX_T                arScanResult[CFG_MAX_NUM_BSS_LIST];
671     PUINT_8                         apucScanResultIEs[CFG_MAX_NUM_BSS_LIST];
672     UINT_32                         u4ScanResultNum;
673
674     // IE pool for Scanning Result
675     UINT_8                          aucScanIEBuf[CFG_MAX_COMMON_IE_BUF_LEN];
676     UINT_32                         u4ScanIEBufferUsage;
677
678     OS_SYSTIME                      u4SysTime;
679
680     // connection parameter (for Ad-Hoc)
681     UINT_16                     u2BeaconPeriod;
682     UINT_16                     u2AtimWindow;
683
684     PARAM_RATES                 eDesiredRates;
685     CMD_LINK_ATTRIB             eLinkAttr;
686 //    CMD_PS_PROFILE_T         ePowerSaveMode;
687     CMD_PS_PROFILE_T         arPowerSaveMode[NETWORK_TYPE_INDEX_NUM];
688
689     // trigger parameter
690     ENUM_RSSI_TRIGGER_TYPE      eRssiTriggerType;
691     PARAM_RSSI                  rRssiTriggerValue;
692
693     // Privacy Filter
694     ENUM_PARAM_PRIVACY_FILTER_T ePrivacyFilter;
695
696     // RTS Threshold
697     PARAM_RTS_THRESHOLD         eRtsThreshold;
698
699     // Network Type
700     UINT_8                      ucNetworkType;
701
702     // Network Type In Use
703     UINT_8                      ucNetworkTypeInUse;
704
705 } WLAN_INFO_T, *P_WLAN_INFO_T;
706
707 /* Session for CONNECTION SETTINGS */
708 typedef struct _CONNECTION_SETTINGS_T {
709
710     UINT_8                          aucMacAddress[MAC_ADDR_LEN];
711
712     UINT_8                          ucDelayTimeOfDisconnectEvent;
713
714     BOOLEAN                         fgIsConnByBssidIssued;
715     UINT_8                          aucBSSID[MAC_ADDR_LEN];
716
717     BOOLEAN                         fgIsConnReqIssued;
718     BOOLEAN                         fgIsDisconnectedByNonRequest;
719
720     UINT_8                          ucSSIDLen;
721     UINT_8                          aucSSID[ELEM_MAX_LEN_SSID];
722
723     ENUM_PARAM_OP_MODE_T            eOPMode;
724
725     ENUM_PARAM_CONNECTION_POLICY_T  eConnectionPolicy;
726
727     ENUM_PARAM_AD_HOC_MODE_T        eAdHocMode;
728
729     ENUM_PARAM_AUTH_MODE_T          eAuthMode;
730
731     ENUM_PARAM_ENCRYPTION_STATUS_T  eEncStatus;
732
733     BOOLEAN                         fgIsScanReqIssued;
734
735
736     /* MIB attributes */
737     UINT_16                         u2BeaconPeriod;
738
739     UINT_16                         u2RTSThreshold; /* User desired setting */
740
741     UINT_16                         u2DesiredNonHTRateSet; /* User desired setting */
742
743     UINT_8                          ucAdHocChannelNum; /* For AdHoc */
744
745     ENUM_BAND_T                     eAdHocBand; /* For AdHoc */
746
747     UINT_32                         u4FreqInKHz; /* Center frequency */
748
749     /* ATIM windows using for IBSS power saving function */
750     UINT_16                         u2AtimWindow;
751
752     /* Features */
753     BOOLEAN                         fgIsEnableRoaming;
754
755     BOOLEAN                         fgIsAdHocQoSEnable;
756
757     ENUM_PARAM_PHY_CONFIG_T         eDesiredPhyConfig;
758
759     /* Used for AP mode for desired channel and bandwidth */
760     UINT_16                         u2CountryCode;
761     UINT_8                          uc2G4BandwidthMode; /* 20/40M or 20M only */
762     UINT_8                          uc5GBandwidthMode;  /* 20/40M or 20M only */
763
764     BOOLEAN                         fgTxShortGIDisabled;
765     BOOLEAN                         fgRxShortGIDisabled;
766
767 #if CFG_SUPPORT_802_11D
768     BOOLEAN                         fgMultiDomainCapabilityEnabled;
769 #endif /* CFG_SUPPORT_802_11D*/
770
771
772 #if 1 //CFG_SUPPORT_WAPI
773     BOOL                            fgWapiMode;
774     UINT_32                         u4WapiSelectedGroupCipher;
775     UINT_32                         u4WapiSelectedPairwiseCipher;
776     UINT_32                         u4WapiSelectedAKMSuite;
777 #endif
778
779     /* CR1486, CR1640 */
780     /* for WPS, disable the privacy check for AP selection policy */
781     BOOLEAN                         fgPrivacyCheckDisable;
782
783     /* b0~3: trigger-en AC0~3. b4~7: delivery-en AC0~3 */
784     UINT_8                          bmfgApsdEnAc;
785
786 } CONNECTION_SETTINGS_T, *P_CONNECTION_SETTINGS_T;
787
788 struct _BSS_INFO_T {
789
790     ENUM_PARAM_MEDIA_STATE_T  eConnectionState;           /* Connected Flag used in AIS_NORMAL_TR */
791     ENUM_PARAM_MEDIA_STATE_T  eConnectionStateIndicated;  /* The Media State that report to HOST */
792
793     ENUM_OP_MODE_T          eCurrentOPMode;             /* Current Operation Mode - Infra/IBSS */
794 #if CFG_ENABLE_WIFI_DIRECT
795     ENUM_OP_MODE_T          eIntendOPMode;
796 #endif
797
798     BOOLEAN                 fgIsNetActive;              /* TRUE if this network has been activated */
799
800     UINT_8                  ucNetTypeIndex;             /* ENUM_NETWORK_TYPE_INDEX_T */
801
802     UINT_8                  ucReasonOfDisconnect;       /* Used by media state indication */
803
804     UINT_8                  ucSSIDLen;                  /* Length of SSID */
805
806 #if CFG_ENABLE_WIFI_DIRECT
807     ENUM_HIDDEN_SSID_TYPE_T eHiddenSsidType;            /* For Hidden SSID usage. */
808 #endif
809
810     UINT_8                  aucSSID[ELEM_MAX_LEN_SSID]; /* SSID used in this BSS */
811
812     UINT_8                  aucBSSID[MAC_ADDR_LEN];     /* The BSSID of the associated BSS */
813
814     UINT_8                  aucOwnMacAddr[MAC_ADDR_LEN];/* Owned MAC Address used in this BSS */
815
816     P_STA_RECORD_T          prStaRecOfAP;               /* For Infra Mode, and valid only if
817                                                          * eConnectionState == MEDIA_STATE_CONNECTED
818                                                          */
819     LINK_T                  rStaRecOfClientList;        /* For IBSS/AP Mode, all known STAs in current BSS */
820
821     UINT_16                 u2CapInfo;                  /* Change Detection */
822
823     UINT_16                 u2BeaconInterval;           /* The Beacon Interval of this BSS */
824
825
826     UINT_16                 u2ATIMWindow;               /* For IBSS Mode */
827
828     UINT_16                 u2AssocId;                  /* For Infra Mode, it is the Assoc ID assigned by AP.
829                                                          */
830
831
832     UINT_8                  ucDTIMPeriod;               /* For Infra/AP Mode */
833
834     UINT_8                  ucDTIMCount;                /* For AP Mode, it is the DTIM value we should carried in
835                                                          * the Beacon of next TBTT.
836                                                          */
837
838     UINT_8                  ucPhyTypeSet;               /* Available PHY Type Set of this peer
839                                                          * (This is deduced from received BSS_DESC_T)
840                                                          */
841
842     UINT_8                  ucNonHTBasicPhyType;        /* The Basic PHY Type Index, used to setup Phy Capability */
843
844     UINT_8                  ucConfigAdHocAPMode;        /* The configuration of AdHoc/AP Mode. e.g. 11g or 11b */
845
846     UINT_8                  ucBeaconTimeoutCount;       /* For Infra/AP Mode, it is a threshold of Beacon Lost Count to
847                                                            confirm connection was lost */
848
849     BOOLEAN                 fgHoldSameBssidForIBSS;     /* For IBSS Mode, to keep use same BSSID to extend the life cycle of an IBSS */
850
851     BOOLEAN                 fgIsBeaconActivated;        /* For AP/IBSS Mode, it is used to indicate that Beacon is sending */
852
853     P_MSDU_INFO_T           prBeacon;                   /* For AP/IBSS Mode - Beacon Frame */
854
855     BOOLEAN                 fgIsIBSSMaster;             /* For IBSS Mode - To indicate that we can reply ProbeResp Frame.
856                                                            In current TBTT interval */
857
858     BOOLEAN                 fgIsShortPreambleAllowed;   /* From Capability Info. of AssocResp Frame AND of Beacon/ProbeResp Frame */
859     BOOLEAN                 fgUseShortPreamble;         /* Short Preamble is enabled in current BSS. */
860     BOOLEAN                 fgUseShortSlotTime;         /* Short Slot Time is enabled in current BSS. */
861
862     UINT_16                 u2OperationalRateSet;       /* Operational Rate Set of current BSS */
863     UINT_16                 u2BSSBasicRateSet;          /* Basic Rate Set of current BSS */
864
865
866     UINT_8                  ucAllSupportedRatesLen;     /* Used for composing Beacon Frame in AdHoc or AP Mode */
867     UINT_8                  aucAllSupportedRates[RATE_NUM];
868
869     UINT_8                  ucAssocClientCnt;           /* TODO(Kevin): Number of associated clients */
870
871     BOOLEAN                 fgIsProtection;
872     BOOLEAN                 fgIsQBSS; /* fgIsWmmBSS; */ /* For Infra/AP/IBSS Mode, it is used to indicate if we support WMM in
873                                                          * current BSS. */
874     BOOLEAN                 fgIsNetAbsent;              /* TRUE: BSS is absent, FALSE: BSS is present */
875
876     UINT_32                 u4RsnSelectedGroupCipher;
877     UINT_32                 u4RsnSelectedPairwiseCipher;
878     UINT_32                 u4RsnSelectedAKMSuite;
879         UINT_16                 u2RsnSelectedCapInfo;
880
881     /*------------------------------------------------------------------------*/
882     /* Power Management related information                                   */
883     /*------------------------------------------------------------------------*/
884     PM_PROFILE_SETUP_INFO_T rPmProfSetupInfo;
885
886
887     /*------------------------------------------------------------------------*/
888     /* WMM/QoS related information                                            */
889     /*------------------------------------------------------------------------*/
890     UINT_8                  ucWmmParamSetCount;         /* Used to detect the change of EDCA parameters. For AP mode, the value is used in WMM IE */
891
892     AC_QUE_PARMS_T          arACQueParms[WMM_AC_INDEX_NUM];
893
894     UINT_8                  aucCWminLog2ForBcast[WMM_AC_INDEX_NUM];        /* For AP mode, broadcast the CWminLog2 */
895     UINT_8                  aucCWmaxLog2ForBcast[WMM_AC_INDEX_NUM];        /* For AP mode, broadcast the CWmaxLog2 */
896     AC_QUE_PARMS_T          arACQueParmsForBcast[WMM_AC_INDEX_NUM];        /* For AP mode, broadcast the value */
897
898     /*------------------------------------------------------------------------*/
899     /* 802.11n HT operation IE when (prStaRec->ucPhyTypeSet & PHY_TYPE_BIT_HT)*/
900     /* is true. They have the same definition with fields of                  */
901     /* information element (CM)                                               */
902     /*------------------------------------------------------------------------*/
903     ENUM_BAND_T             eBand;
904     UINT_8                  ucPrimaryChannel;
905     UINT_8                  ucHtOpInfo1;
906     UINT_16                 u2HtOpInfo2;
907     UINT_16                 u2HtOpInfo3;
908
909     /*------------------------------------------------------------------------*/
910     /* Required protection modes (CM)                                         */
911     /*------------------------------------------------------------------------*/
912     BOOLEAN                 fgErpProtectMode;
913     ENUM_HT_PROTECT_MODE_T  eHtProtectMode;
914     ENUM_GF_MODE_T          eGfOperationMode;
915     ENUM_RIFS_MODE_T        eRifsOperationMode;
916
917     BOOLEAN                 fgObssErpProtectMode;       /* GO only */
918     ENUM_HT_PROTECT_MODE_T  eObssHtProtectMode;         /* GO only */
919     ENUM_GF_MODE_T          eObssGfOperationMode;       /* GO only */
920     BOOLEAN                 fgObssRifsOperationMode;    /* GO only */
921
922     /*------------------------------------------------------------------------*/
923     /* OBSS to decide if 20/40M bandwidth is permitted.                       */
924     /* The first member indicates the following channel list length.          */
925     /*------------------------------------------------------------------------*/
926     BOOLEAN                 fgAssoc40mBwAllowed;
927     BOOLEAN                 fg40mBwAllowed;
928     ENUM_CHNL_EXT_T         eBssSCO;    /* Real setting for HW
929                                          * 20/40M AP mode will always set 40M,
930                                          * but its OP IE can be changed.
931                                          */
932     UINT_8                  auc2G_20mReqChnlList[CHNL_LIST_SZ_2G + 1];
933     UINT_8                  auc2G_NonHtChnlList[CHNL_LIST_SZ_2G + 1];
934     UINT_8                  auc2G_PriChnlList[CHNL_LIST_SZ_2G + 1];
935     UINT_8                  auc2G_SecChnlList[CHNL_LIST_SZ_2G + 1];
936
937     UINT_8                  auc5G_20mReqChnlList[CHNL_LIST_SZ_5G + 1];
938     UINT_8                  auc5G_NonHtChnlList[CHNL_LIST_SZ_5G + 1];
939     UINT_8                  auc5G_PriChnlList[CHNL_LIST_SZ_5G + 1];
940     UINT_8                  auc5G_SecChnlList[CHNL_LIST_SZ_5G + 1];
941
942     TIMER_T                 rObssScanTimer;
943     UINT_16                 u2ObssScanInterval;     /* in unit of sec */
944
945     BOOLEAN                 fgObssActionForcedTo20M;    /* GO only */
946     BOOLEAN                 fgObssBeaconForcedTo20M;    /* GO only */
947
948     /*------------------------------------------------------------------------*/
949     /* HW Related Fields (Kevin)                                              */
950     /*------------------------------------------------------------------------*/
951     UINT_8                  ucHwDefaultFixedRateCode;   /* The default rate code copied to MAC TX Desc */
952     UINT_16                 u2HwLPWakeupGuardTimeUsec;
953
954
955     UINT_8                  ucBssFreeQuota;              /* The value is updated from FW  */
956 };
957
958
959 struct _AIS_SPECIFIC_BSS_INFO_T {
960     UINT_8                  ucRoamingAuthTypes;         /* This value indicate the roaming type used in AIS_JOIN */
961
962     BOOLEAN                 fgIsIBSSActive;
963
964     /*! \brief Global flag to let arbiter stay at standby and not connect to any network */
965     BOOLEAN                 fgCounterMeasure;
966     UINT_8                  ucWEPDefaultKeyID;
967     BOOLEAN                 fgTransmitKeyExist; /* Legacy wep Transmit key exist or not */
968
969     /* While Do CounterMeasure procedure, check the EAPoL Error report have send out */
970     BOOLEAN                 fgCheckEAPoLTxDone;
971
972     UINT_32                 u4RsnaLastMICFailTime;
973
974     /* Stored the current bss wpa rsn cap filed, used for roaming policy */
975     //UINT_16                 u2RsnCap;
976     TIMER_T                 rPreauthenticationTimer;
977
978     /* By the flow chart of 802.11i,
979                wait 60 sec before associating to same AP
980                or roaming to a new AP
981                or sending data in IBSS,
982                keep a timer for handle the 60 sec counterMeasure */
983     TIMER_T                 rRsnaBlockTrafficTimer;
984     TIMER_T                 rRsnaEAPoLReportTimeoutTimer;
985
986     /* For Keep the Tx/Rx Mic key for TKIP SW Calculate Mic */
987     /* This is only one for AIS/AP */
988     UINT_8                  aucTxMicKey[8];
989     UINT_8                  aucRxMicKey[8];
990
991     /* Buffer for WPA2 PMKID */
992     /* The PMKID cache lifetime is expire by media_disconnect_indication */
993     UINT_32                 u4PmkidCandicateCount;
994     PMKID_CANDICATE_T       arPmkidCandicate[CFG_MAX_PMKID_CACHE];
995     UINT_32                 u4PmkidCacheCount;
996     PMKID_ENTRY_T           arPmkidCache[CFG_MAX_PMKID_CACHE];
997     BOOLEAN                 fgIndicatePMKID;
998 #if CFG_SUPPORT_802_11W
999     BOOLEAN                 fgMgmtProtection;
1000     UINT_32                 u4SaQueryStart;
1001     UINT_32                 u4SaQueryCount;
1002     UINT_8                  ucSaQueryTimedOut;
1003     PUINT_8                 pucSaQueryTransId;
1004     TIMER_T                 rSaQueryTimer;
1005     BOOLEAN                 fgBipKeyInstalled;
1006 #endif
1007 };
1008
1009 struct _BOW_SPECIFIC_BSS_INFO_T {
1010     UINT_16                 u2Reserved; /* Reserved for Data Type Check */
1011 };
1012
1013 #if CFG_SLT_SUPPORT
1014 typedef struct _SLT_INFO_T {
1015
1016     P_BSS_DESC_T prPseudoBssDesc;
1017     UINT_16 u2SiteID;
1018     UINT_8 ucChannel2G4;
1019     UINT_8 ucChannel5G;
1020     BOOLEAN fgIsDUT;
1021     UINT_32 u4BeaconReceiveCnt;
1022     /////////Deprecated/////////
1023     P_STA_RECORD_T prPseudoStaRec;
1024 } SLT_INFO_T, *P_SLT_INFO_T;
1025 #endif
1026
1027
1028 /* Major member variables for WiFi FW operation.
1029    Variables within this region will be ready for access after WIFI function is enabled.
1030 */
1031 typedef struct _WIFI_VAR_T {
1032     BOOLEAN                 fgIsRadioOff;
1033
1034     BOOLEAN                 fgIsEnterD3ReqIssued;
1035
1036     BOOLEAN                 fgDebugCmdResp;
1037
1038     CONNECTION_SETTINGS_T   rConnSettings;
1039
1040     SCAN_INFO_T             rScanInfo;
1041
1042 #if CFG_SUPPORT_ROAMING
1043     ROAMING_INFO_T          rRoamingInfo;
1044 #endif /* CFG_SUPPORT_ROAMING */
1045
1046     AIS_FSM_INFO_T          rAisFsmInfo;
1047
1048     ENUM_PWR_STATE_T        aePwrState[NETWORK_TYPE_INDEX_NUM];
1049
1050     BSS_INFO_T              arBssInfo[NETWORK_TYPE_INDEX_NUM];
1051
1052     AIS_SPECIFIC_BSS_INFO_T rAisSpecificBssInfo;
1053
1054 #if CFG_ENABLE_WIFI_DIRECT
1055     P_P2P_CONNECTION_SETTINGS_T prP2PConnSettings;
1056
1057     P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo;
1058
1059     P_P2P_FSM_INFO_T prP2pFsmInfo;
1060 #endif /* CFG_ENABLE_WIFI_DIRECT */
1061
1062 #if CFG_ENABLE_BT_OVER_WIFI
1063     BOW_SPECIFIC_BSS_INFO_T rBowSpecificBssInfo;
1064     BOW_FSM_INFO_T rBowFsmInfo;
1065 #endif /* CFG_ENABLE_BT_OVER_WIFI */
1066
1067     DEAUTH_INFO_T           arDeauthInfo[MAX_DEAUTH_INFO_COUNT];
1068
1069     /* Current Wi-Fi Settings and Flags */
1070     UINT_8                  aucPermanentAddress[MAC_ADDR_LEN];
1071     UINT_8                  aucMacAddress[MAC_ADDR_LEN];
1072     UINT_8                  aucDeviceAddress[MAC_ADDR_LEN];
1073     UINT_8                  aucInterfaceAddress[MAC_ADDR_LEN];
1074
1075     UINT_8                  ucAvailablePhyTypeSet;
1076
1077     ENUM_PHY_TYPE_INDEX_T   eNonHTBasicPhyType2G4; /* Basic Phy Type used by SCN according
1078                                                     * to the set of Available PHY Types
1079                                                     */
1080
1081     ENUM_PARAM_PREAMBLE_TYPE_T  ePreambleType;
1082     ENUM_REGISTRY_FIXED_RATE_T  eRateSetting;
1083
1084     BOOLEAN                 fgIsShortSlotTimeOptionEnable;
1085                             /* User desired setting, but will honor the capability of AP */
1086
1087     BOOLEAN                 fgEnableJoinToHiddenSSID;
1088     BOOLEAN                 fgSupportWZCDisassociation;
1089
1090     BOOLEAN                 fgSupportQoS;
1091     BOOLEAN                 fgSupportAmpduTx;
1092     BOOLEAN                 fgSupportAmpduRx;
1093     BOOLEAN                 fgSupportTspec;
1094     BOOLEAN                 fgSupportUAPSD;
1095     BOOLEAN                 fgSupportULPSMP;
1096
1097 #if CFG_SLT_SUPPORT
1098     SLT_INFO_T      rSltInfo;
1099 #endif
1100
1101 } WIFI_VAR_T, *P_WIFI_VAR_T;/* end of _WIFI_VAR_T */
1102
1103 /* cnm_timer module */
1104 typedef struct {
1105     LINK_T              rLinkHead;
1106     OS_SYSTIME          rNextExpiredSysTime;
1107     KAL_WAKE_LOCK_T     rWakeLock;
1108     BOOLEAN             fgWakeLocked;
1109 } ROOT_TIMER, *P_ROOT_TIMER;
1110
1111
1112 /* FW/DRV/NVRAM version information */
1113 typedef struct {
1114
1115     /* NVRAM or Registry */
1116     UINT_16     u2Part1CfgOwnVersion;
1117     UINT_16     u2Part1CfgPeerVersion;
1118     UINT_16     u2Part2CfgOwnVersion;
1119     UINT_16     u2Part2CfgPeerVersion;
1120
1121     /* Firmware */
1122     UINT_16     u2FwProductID;
1123     UINT_16     u2FwOwnVersion;
1124     UINT_16     u2FwPeerVersion;
1125
1126 } WIFI_VER_INFO_T, *P_WIFI_VER_INFO_T;
1127
1128
1129 #if CFG_ENABLE_WIFI_DIRECT
1130 /*
1131 * p2p function pointer structure
1132 */
1133
1134 typedef struct _P2P_FUNCTION_LINKER {
1135     P2P_REMOVE                                  prP2pRemove;
1136 //    NIC_P2P_MEDIA_STATE_CHANGE                  prNicP2pMediaStateChange;
1137 //    SCAN_UPDATE_P2P_DEVICE_DESC                 prScanUpdateP2pDeviceDesc;
1138 //    P2P_FSM_RUN_EVENT_RX_PROBE_RESPONSE_FRAME   prP2pFsmRunEventRxProbeResponseFrame;
1139     P2P_GENERATE_P2P_IE              prP2pGenerateWSC_IEForBeacon;
1140 //    P2P_CALCULATE_WSC_IE_LEN_FOR_PROBE_RSP      prP2pCalculateWSC_IELenForProbeRsp;
1141 //    P2P_GENERATE_WSC_IE_FOR_PROBE_RSP           prP2pGenerateWSC_IEForProbeRsp;
1142 //    SCAN_REMOVE_P2P_BSS_DESC                    prScanRemoveP2pBssDesc;
1143 //    P2P_HANDLE_SEC_CHECK_RSP                    prP2pHandleSecCheckRsp;
1144     P2P_NET_REGISTER                 prP2pNetRegister;
1145     P2P_NET_UNREGISTER               prP2pNetUnregister;
1146     P2P_CALCULATE_P2P_IE_LEN         prP2pCalculateP2p_IELenForAssocReq;   /* All IEs generated from supplicant. */
1147     P2P_GENERATE_P2P_IE              prP2pGenerateP2p_IEForAssocReq;           /* All IEs generated from supplicant. */
1148 } P2P_FUNCTION_LINKER, *P_P2P_FUNCTION_LINKER;
1149
1150
1151 #endif
1152
1153 /*
1154  * Major ADAPTER structure
1155  * Major data structure for driver operation
1156  */
1157 struct _ADAPTER_T {
1158     UINT_8                  ucRevID;
1159
1160     UINT_16                 u2NicOpChnlNum;
1161
1162     BOOLEAN                 fgIsEnableWMM;
1163     BOOLEAN                 fgIsWmmAssoc; /* This flag is used to indicate that WMM is enable in current BSS */
1164
1165     UINT_32                 u4OsPacketFilter;     // packet filter used by OS
1166
1167
1168 #if CFG_TCP_IP_CHKSUM_OFFLOAD
1169     UINT_32                 u4CSUMFlags;
1170 #endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */
1171
1172
1173     ENUM_BAND_T             aePreferBand[NETWORK_TYPE_INDEX_NUM];
1174
1175     /* ADAPTER flags */
1176     UINT_32                 u4Flags;
1177     UINT_32                 u4HwFlags;
1178
1179     BOOLEAN                 fgIsRadioOff;
1180
1181     BOOLEAN                 fgIsEnterD3ReqIssued;
1182
1183     UINT_8                  aucMacAddress[MAC_ADDR_LEN];
1184
1185     ENUM_PHY_TYPE_INDEX_T   eCurrentPhyType; /* Current selection basing on the set of Available PHY Types */
1186
1187 #if CFG_COALESCING_BUFFER_SIZE || CFG_SDIO_RX_AGG
1188     UINT_32                 u4CoalescingBufCachedSize;
1189     PUINT_8                 pucCoalescingBufCached;
1190 #endif /* CFG_COALESCING_BUFFER_SIZE */
1191
1192     /* Buffer for CMD_INFO_T, Mgt packet and mailbox message */
1193     BUF_INFO_T              rMgtBufInfo;
1194     BUF_INFO_T              rMsgBufInfo;
1195     PUINT_8                 pucMgtBufCached;
1196     UINT_32                 u4MgtBufCachedSize;
1197     UINT_8                  aucMsgBuf[MSG_BUFFER_SIZE];
1198 #if CFG_DBG_MGT_BUF
1199     UINT_32                 u4MemAllocDynamicCount;     /* Debug only */
1200     UINT_32                 u4MemFreeDynamicCount;      /* Debug only */
1201 #endif
1202
1203     STA_RECORD_T            arStaRec[CFG_STA_REC_NUM];
1204
1205     /* Element for TX PATH */
1206     TX_CTRL_T               rTxCtrl;
1207     QUE_T                   rFreeCmdList;
1208     CMD_INFO_T              arHifCmdDesc[CFG_TX_MAX_CMD_PKT_NUM];
1209
1210     /* Element for RX PATH */
1211     RX_CTRL_T               rRxCtrl;
1212
1213     P_SDIO_CTRL_T           prSDIOCtrl;
1214
1215 #if (MT6620_E1_ASIC_HIFSYS_WORKAROUND == 1)
1216     /* Element for MT6620 E1 HIFSYS workaround */
1217     BOOLEAN                 fgIsClockGatingEnabled;
1218 #endif
1219
1220     /* Buffer for Authentication Event */
1221     /* <Todo> Move to glue layer and refine the kal function */
1222     /* Reference to rsnGeneratePmkidIndication function at rsn.c */
1223     UINT_8                  aucIndicationEventBuffer[(CFG_MAX_PMKID_CACHE * 20)  + 8 ];
1224
1225     UINT_32                 u4IntStatus;
1226
1227     ENUM_ACPI_STATE_T       rAcpiState;
1228
1229     BOOLEAN                 fgIsIntEnable;
1230     BOOLEAN                 fgIsIntEnableWithLPOwnSet;
1231
1232     BOOLEAN                 fgIsFwOwn;
1233     BOOLEAN                 fgWiFiInSleepyState;
1234
1235     UINT_32                 u4PwrCtrlBlockCnt;
1236
1237     QUE_T                   rPendingCmdQueue;
1238
1239     P_GLUE_INFO_T           prGlueInfo;
1240
1241     UINT_8                  ucCmdSeqNum;
1242     UINT_8                  ucTxSeqNum;
1243
1244 #if 1//CFG_SUPPORT_WAPI
1245     BOOLEAN                 fgUseWapi;
1246 #endif
1247
1248     /* RF Test flags */
1249     BOOLEAN         fgTestMode;
1250
1251     /* WLAN Info for DRIVER_CORE OID query */
1252     WLAN_INFO_T     rWlanInfo;
1253
1254 #if CFG_ENABLE_WIFI_DIRECT
1255     BOOLEAN             fgIsP2PRegistered;
1256     ENUM_NET_REG_STATE_T rP2PNetRegState;
1257     BOOLEAN             fgIsWlanLaunched;
1258     P_P2P_INFO_T        prP2pInfo;
1259 #if CFG_SUPPORT_P2P_RSSI_QUERY
1260     OS_SYSTIME          rP2pLinkQualityUpdateTime;
1261     BOOLEAN             fgIsP2pLinkQualityValid;
1262     EVENT_LINK_QUALITY  rP2pLinkQuality;
1263 #endif
1264 #endif
1265
1266     /* Online Scan Option */
1267     BOOLEAN         fgEnOnlineScan;
1268
1269     /* Online Scan Option */
1270     BOOLEAN         fgDisBcnLostDetection;
1271
1272     /* MAC address */
1273     PARAM_MAC_ADDRESS rMyMacAddr;
1274
1275     /* Wake-up Event for WOL */
1276     UINT_32         u4WakeupEventEnable;
1277
1278     /* Event Buffering */
1279     EVENT_STATISTICS    rStatStruct;
1280     OS_SYSTIME          rStatUpdateTime;
1281     BOOLEAN             fgIsStatValid;
1282
1283     EVENT_LINK_QUALITY  rLinkQuality;
1284     OS_SYSTIME          rLinkQualityUpdateTime;
1285     BOOLEAN             fgIsLinkQualityValid;
1286     OS_SYSTIME          rLinkRateUpdateTime;
1287     BOOLEAN             fgIsLinkRateValid;
1288
1289     /* WIFI_VAR_T */
1290     WIFI_VAR_T          rWifiVar;
1291
1292     /* MTK WLAN NIC driver IEEE 802.11 MIB */
1293     IEEE_802_11_MIB_T   rMib;
1294
1295     /* Mailboxs for inter-module communication */
1296     MBOX_T arMbox[MBOX_ID_TOTAL_NUM];
1297
1298     /* Timers for OID Pending Handling */
1299     TIMER_T             rOidTimeoutTimer;
1300
1301     /* Root Timer for cnm_timer module */
1302     ROOT_TIMER          rRootTimer;
1303
1304     /* RLM maintenance */
1305     ENUM_CHNL_EXT_T             eRfSco;
1306     ENUM_SYS_PROTECT_MODE_T     eSysProtectMode;
1307     ENUM_GF_MODE_T              eSysHtGfMode;
1308     ENUM_RIFS_MODE_T            eSysTxRifsMode;
1309     ENUM_SYS_PCO_PHASE_T        eSysPcoPhase;
1310
1311     P_DOMAIN_INFO_ENTRY         prDomainInfo;
1312
1313     /* QM */
1314     QUE_MGT_T                   rQM;
1315
1316     CNM_INFO_T                  rCnmInfo;
1317
1318     UINT_32 u4PowerMode;
1319
1320     UINT_32 u4CtiaPowerMode;
1321     BOOLEAN fgEnCtiaPowerMode;
1322
1323     UINT_32 fgEnArpFilter;
1324
1325     UINT_32 u4UapsdAcBmp;
1326
1327     UINT_32 u4MaxSpLen;
1328
1329     UINT_32 u4PsCurrentMeasureEn;
1330
1331     /* Version Information */
1332     WIFI_VER_INFO_T             rVerInfo;
1333
1334     /* 5GHz support (from F/W) */
1335     BOOLEAN fgIsHw5GBandDisabled;
1336     BOOLEAN fgEnable5GBand;
1337     BOOLEAN fgIsEepromUsed;
1338     BOOLEAN fgIsEfuseValid;
1339     BOOLEAN fgIsEmbbededMacAddrValid;
1340
1341     /* Packet Forwarding Tracking */
1342     INT_32  i4PendingFwdFrameCount;
1343
1344 #if CFG_SUPPORT_RDD_TEST_MODE
1345     UINT_8  ucRddStatus;
1346 #endif
1347
1348     BOOL fgDisStaAgingTimeoutDetection;
1349
1350 };/* end of _ADAPTER_T */
1351
1352 /*******************************************************************************
1353 *                            P U B L I C   D A T A
1354 ********************************************************************************
1355 */
1356
1357 /*******************************************************************************
1358 *                           P R I V A T E   D A T A
1359 ********************************************************************************
1360 */
1361
1362 /*******************************************************************************
1363 *                                 M A C R O S
1364 ********************************************************************************
1365 */
1366 /*----------------------------------------------------------------------------*/
1367 /* Macros for BSS_INFO_T - Flag of Net Active                                 */
1368 /*----------------------------------------------------------------------------*/
1369 #define IS_NET_ACTIVE(_prAdapter, _NetTypeIndex) \
1370                 (_prAdapter->rWifiVar.arBssInfo[(_NetTypeIndex)].fgIsNetActive)
1371 #define IS_BSS_ACTIVE(_prBssInfo)     ((_prBssInfo)->fgIsNetActive)
1372
1373 #define IS_AIS_ACTIVE(_prAdapter)     IS_NET_ACTIVE(_prAdapter, NETWORK_TYPE_AIS_INDEX)
1374 #define IS_P2P_ACTIVE(_prAdapter)     IS_NET_ACTIVE(_prAdapter, NETWORK_TYPE_P2P_INDEX)
1375 #define IS_BOW_ACTIVE(_prAdapter)     IS_NET_ACTIVE(_prAdapter, NETWORK_TYPE_BOW_INDEX)
1376
1377 #define SET_NET_ACTIVE(_prAdapter, _NetTypeIndex) \
1378                 {_prAdapter->rWifiVar.arBssInfo[(_NetTypeIndex)].fgIsNetActive = TRUE;}
1379
1380 #define UNSET_NET_ACTIVE(_prAdapter, _NetTypeIndex) \
1381                 {_prAdapter->rWifiVar.arBssInfo[(_NetTypeIndex)].fgIsNetActive = FALSE;}
1382
1383 #define BSS_INFO_INIT(_prAdapter, _NetTypeIndex) \
1384                 {   UINT_8 _aucZeroMacAddr[] = NULL_MAC_ADDR; \
1385                     P_BSS_INFO_T _prBssInfo = &(_prAdapter->rWifiVar.arBssInfo[(_NetTypeIndex)]); \
1386                     \
1387                     _prBssInfo->eConnectionState = PARAM_MEDIA_STATE_DISCONNECTED; \
1388                     _prBssInfo->eConnectionStateIndicated = PARAM_MEDIA_STATE_DISCONNECTED; \
1389                     _prBssInfo->eCurrentOPMode = OP_MODE_INFRASTRUCTURE; \
1390                     _prBssInfo->fgIsNetActive = FALSE; \
1391                     _prBssInfo->ucNetTypeIndex = (_NetTypeIndex); \
1392                     _prBssInfo->ucReasonOfDisconnect = DISCONNECT_REASON_CODE_RESERVED; \
1393                     COPY_MAC_ADDR(_prBssInfo->aucBSSID, _aucZeroMacAddr); \
1394                     LINK_INITIALIZE(&_prBssInfo->rStaRecOfClientList); \
1395                     _prBssInfo->fgIsBeaconActivated = FALSE; \
1396                     _prBssInfo->ucHwDefaultFixedRateCode = RATE_CCK_1M_LONG; \
1397                     _prBssInfo->fgIsNetAbsent = FALSE; \
1398                 }
1399
1400 #if CFG_ENABLE_BT_OVER_WIFI
1401 #define BOW_BSS_INFO_INIT(_prAdapter, _NetTypeIndex) \
1402                 {  \
1403                     P_BSS_INFO_T _prBssInfo = &(_prAdapter->rWifiVar.arBssInfo[(_NetTypeIndex)]); \
1404                     \
1405                     _prBssInfo->eConnectionState = PARAM_MEDIA_STATE_DISCONNECTED; \
1406                     _prBssInfo->eConnectionStateIndicated = PARAM_MEDIA_STATE_DISCONNECTED; \
1407                     _prBssInfo->eCurrentOPMode = OP_MODE_BOW; \
1408                     _prBssInfo->ucNetTypeIndex = (_NetTypeIndex); \
1409                     _prBssInfo->ucReasonOfDisconnect = DISCONNECT_REASON_CODE_RESERVED; \
1410                     LINK_INITIALIZE(&_prBssInfo->rStaRecOfClientList); \
1411                     _prBssInfo->fgIsBeaconActivated = TRUE; \
1412                     _prBssInfo->ucHwDefaultFixedRateCode = RATE_CCK_1M_LONG; \
1413                     _prBssInfo->fgIsNetAbsent = FALSE; \
1414                 }
1415 #endif
1416
1417 /*----------------------------------------------------------------------------*/
1418 /* Macros for Power State                                                     */
1419 /*----------------------------------------------------------------------------*/
1420 #define SET_NET_PWR_STATE_IDLE(_prAdapter, _NetTypeIndex) \
1421                 {_prAdapter->rWifiVar.aePwrState[(_NetTypeIndex)] = PWR_STATE_IDLE;}
1422
1423 #define SET_NET_PWR_STATE_ACTIVE(_prAdapter, _NetTypeIndex) \
1424                 {_prAdapter->rWifiVar.aePwrState[(_NetTypeIndex)] = PWR_STATE_ACTIVE;}
1425
1426 #define SET_NET_PWR_STATE_PS(_prAdapter, _NetTypeIndex) \
1427                 {_prAdapter->rWifiVar.aePwrState[(_NetTypeIndex)] = PWR_STATE_PS;}
1428
1429 #define IS_NET_PWR_STATE_ACTIVE(_prAdapter, _NetTypeIndex) \
1430                 (_prAdapter->rWifiVar.aePwrState[(_NetTypeIndex)] == PWR_STATE_ACTIVE)
1431
1432 #define IS_NET_PWR_STATE_IDLE(_prAdapter, _NetTypeIndex) \
1433                 (_prAdapter->rWifiVar.aePwrState[(_NetTypeIndex)] == PWR_STATE_IDLE)
1434
1435 #define IS_SCN_PWR_STATE_ACTIVE(_prAdapter) \
1436                 (_prAdapter->rWifiVar.rScanInfo.eScanPwrState == SCAN_PWR_STATE_ACTIVE)
1437
1438 #define IS_SCN_PWR_STATE_IDLE(_prAdapter) \
1439                 (_prAdapter->rWifiVar.rScanInfo.eScanPwrState == SCAN_PWR_STATE_IDLE)
1440
1441 /*******************************************************************************
1442 *                  F U N C T I O N   D E C L A R A T I O N S
1443 ********************************************************************************
1444 */
1445
1446
1447 /*******************************************************************************
1448 *                              F U N C T I O N S
1449 ********************************************************************************
1450 */
1451
1452 #endif /* _ADAPTER_H */
1453
1454