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