add rk3288 pinctrl dts code
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / combo_mt66xx / mt6628 / wlan / os / linux / include / gl_os.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/include/gl_os.h#2 $
3 */
4
5 /*! \file   gl_os.h
6     \brief  List the external reference to OS for GLUE Layer.
7
8     In this file we define the data structure - GLUE_INFO_T to store those objects
9     we acquired from OS - e.g. TIMER, SPINLOCK, NET DEVICE ... . And all the
10     external reference (header file, extern func() ..) to OS for GLUE Layer should
11     also list down here.
12 */
13
14
15
16 /*
17 ** $Log: gl_os.h $
18 ** 
19 ** 08 20 2012 yuche.tsai
20 ** NULL
21 ** Fix possible KE issue.
22 ** 
23 ** 08 20 2012 yuche.tsai
24 ** [ALPS00339327] [Rose][6575JB][BSP Package][Free Test][KE][WIFI]There is no response when you tap the turn off/on button,wait a minutes, the device will reboot automatically and "KE" will pop up.
25 ** Fix possible KE when netlink operate mgmt frame register.
26  *
27  * 04 12 2012 terry.wu
28  * NULL
29  * Add AEE message support
30  * 1) Show AEE warning(red screen) if SDIO access error occurs
31
32  *
33  * 03 02 2012 terry.wu
34  * NULL
35  * Enable CFG80211 Support.
36  *
37  * 01 05 2012 wh.su
38  * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function
39  * Adding the related ioctl / wlan oid function to set the Tx power cfg.
40  *
41  * 12 13 2011 cm.chang
42  * [WCXRP00001136] [All Wi-Fi][Driver] Add wake lock for pending timer
43  * Add wake lock if timer timeout value is smaller than 5 seconds
44  *
45  * 11 18 2011 yuche.tsai
46  * NULL
47  * CONFIG P2P support RSSI query, default turned off.
48  *
49  * 11 16 2011 yuche.tsai
50  * NULL
51  * Avoid using work thread.
52  *
53  * 11 11 2011 yuche.tsai
54  * NULL
55  * Fix work thread cancel issue.
56  *
57  * 10 12 2011 wh.su
58  * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP
59  * adding the 802.11w related function and define .
60  *
61  * 09 29 2011 terry.wu
62  * NULL
63  * Show DRV_NAME by chip id.
64  *
65  * 04 18 2011 terry.wu
66  * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED
67  * Remove flag CFG_WIFI_DIRECT_MOVED.
68  *
69  * 03 29 2011 cp.wu
70  * [WCXRP00000598] [MT6620 Wi-Fi][Driver] Implementation of interface for communicating with user space process for RESET_START and RESET_END events
71  * implement kernel-to-userspace communication via generic netlink socket for whole-chip resetting mechanism
72  *
73  * 03 21 2011 cp.wu
74  * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer
75  * portability improvement
76  *
77  * 03 17 2011 chinglan.wang
78  * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature
79  * .
80  *
81  * 03 03 2011 jeffrey.chang
82  * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue
83  * support concurrent network
84  *
85  * 03 03 2011 jeffrey.chang
86  * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue
87  * modify net device relative functions to support multiple H/W queues
88  *
89  * 03 02 2011 wh.su
90  * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
91  * Add security check code.
92  *
93  * 02 21 2011 cp.wu
94  * [WCXRP00000482] [MT6620 Wi-Fi][Driver] Simplify logic for checking NVRAM existence in driver domain
95  * simplify logic for checking NVRAM existence only once.
96  *
97  * 02 16 2011 jeffrey.chang
98  * NULL
99  * Add query ipv4 and ipv6 address during early suspend and late resume
100  *
101  * 02 10 2011 chinghwa.yu
102  * [WCXRP00000065] Update BoW design and settings
103  * Fix kernel API change issue.
104  * Before ALPS 2.2 (2.2 included), kfifo_alloc() is
105  * struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, spinlock_t *lock);
106  * After ALPS 2.3, kfifo_alloc() is changed to
107  * int kfifo_alloc(struct kfifo *fifo, unsigned int size, gfp_t gfp_mask);
108  *
109  * 02 09 2011 wh.su
110  * [WCXRP00000433] [MT6620 Wi-Fi][Driver] Remove WAPI structure define for avoid P2P module with structure miss-align pointer issue
111  * always pre-allio WAPI related structure for align p2p module.
112  *
113  * 02 09 2011 terry.wu
114  * [WCXRP00000383] [MT6620 Wi-Fi][Driver] Separate WiFi and P2P driver into two modules
115  * Halt p2p module init and exit until TxThread finished p2p register and unregister.
116  *
117  * 02 01 2011 cm.chang
118  * [WCXRP00000415] [MT6620 Wi-Fi][Driver] Check if any memory leakage happens when uninitializing in DGB mode
119  * .
120  *
121  * 01 27 2011 cm.chang
122  * [WCXRP00000402] [MT6620 Wi-Fi][Driver] Enable MCR read/write by iwpriv by default
123  * .
124  *
125  * 01 12 2011 cp.wu
126  * [WCXRP00000357] [MT6620 Wi-Fi][Driver][Bluetooth over Wi-Fi] add another net device interface for BT AMP
127  * implementation of separate BT_OVER_WIFI data path.
128  *
129  * 01 12 2011 cp.wu
130  * [WCXRP00000356] [MT6620 Wi-Fi][Driver] fill mac header length for security frames 'cause hardware header translation needs such information
131  * fill mac header length information for 802.1x frames.
132  *
133  * 01 11 2011 chinglan.wang
134  * NULL
135  * Modify to reslove the CR :[ALPS00028994] Use WEP security to connect Marvell 11N AP.  Connection establish successfully.
136  * Use the WPS function to connect AP, the privacy bit always is set to 1.
137  *
138  * 01 10 2011 cp.wu
139  * [WCXRP00000349] [MT6620 Wi-Fi][Driver] make kalIoctl() of linux port as a thread safe API to avoid potential issues due to multiple access
140  * use mutex to protect kalIoctl() for thread safe.
141  *
142  * 01 05 2011 cp.wu
143  * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery
144  * ioctl implementations for P2P Service Discovery
145  *
146  * 11 04 2010 wh.su
147  * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID
148  * adding the p2p random ssid support.
149  *
150  * 10 18 2010 cp.wu
151  * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver] The mac address is all zero at android
152  * complete implementation of Android NVRAM access
153  *
154  * 09 28 2010 wh.su
155  * NULL
156  * [WCXRP00000069][MT6620 Wi-Fi][Driver] Fix some code for phase 1 P2P Demo.
157  *
158  * 09 23 2010 cp.wu
159  * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check
160  * add skeleton for NVRAM integration
161  *
162  * 09 13 2010 cp.wu
163  * NULL
164  * add waitq for poll() and read().
165  *
166  * 09 07 2010 wh.su
167  * NULL
168  * adding the code for beacon/probe req/ probe rsp wsc ie at p2p.
169  *
170  * 09 06 2010 wh.su
171  * NULL
172  * let the p2p can set the privacy bit at beacon and rsn ie at assoc req at key handshake state.
173  *
174  * 09 03 2010 kevin.huang
175  * NULL
176  * Refine #include sequence and solve recursive/nested #include issue
177  *
178  * 09 01 2010 wh.su
179  * NULL
180  * adding the wapi support for integration test.
181  *
182  * 08 31 2010 kevin.huang
183  * NULL
184  * Use LINK LIST operation to process SCAN result
185  *
186  * 08 23 2010 cp.wu
187  * NULL
188  * revise constant definitions to be matched with implementation (original cmd-event definition is deprecated)
189  *
190  * 08 16 2010 cp.wu
191  * NULL
192  * P2P packets are now marked when being queued into driver, and identified later without checking MAC address
193  *
194  * 08 16 2010 cp.wu
195  * NULL
196  * revised implementation of Wi-Fi Direct io controls.
197  *
198  * 08 11 2010 cp.wu
199  * NULL
200  * 1) do not use in-stack variable for beacon updating. (for MAUI porting)
201  * 2) extending scanning result to 64 instead of 48
202  *
203  * 08 06 2010 cp.wu
204  * NULL
205  * driver hook modifications corresponding to ioctl interface change.
206  *
207  * 08 03 2010 cp.wu
208  * NULL
209  * [Wi-Fi Direct] add framework for driver hooks
210  *
211  * 08 02 2010 jeffrey.chang
212  * NULL
213  * 1) modify tx service thread to avoid busy looping
214  * 2) add spin lock declartion for linux build
215  *
216  * 07 23 2010 jeffrey.chang
217  *
218  * add new KAL api
219  *
220  * 07 22 2010 jeffrey.chang
221  *
222  * modify tx thread and remove some spinlock
223  *
224  * 07 19 2010 jeffrey.chang
225  *
226  * add security frame pending count
227  *
228  * 07 08 2010 cp.wu
229  *
230  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
231  *
232  * 06 06 2010 kevin.huang
233  * [WPD00003832][MT6620 5931] Create driver base
234  * [MT6620 5931] Create driver base
235  *
236  * 06 01 2010 cp.wu
237  * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support
238  * add ioctl to configure scan mode for p2p connection
239  *
240  * 05 31 2010 cp.wu
241  * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support
242  * add cfg80211 interface, which is to replace WE, for further extension
243  *
244  * 05 14 2010 cp.wu
245  * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support
246  * add ioctl framework for Wi-Fi Direct by reusing wireless extension ioctls as well
247  *
248  * 05 11 2010 cp.wu
249  * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support
250  * p2p ioctls revised.
251  *
252  * 05 11 2010 cp.wu
253  * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support
254  * add ioctl for controlling p2p scan phase parameters
255  *
256  * 05 10 2010 cp.wu
257  * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support
258  * implement basic wi-fi direct framework
259  *
260  * 05 07 2010 jeffrey.chang
261  * [WPD00003826]Initial import for Linux port
262  * prevent supplicant accessing driver during resume
263  *
264  * 05 07 2010 cp.wu
265  * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support
266  * add basic framework for implementating P2P driver hook.
267  *
268  * 05 05 2010 cp.wu
269  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
270  * change variable names for multiple physical link to match with coding convention
271  *
272  * 04 27 2010 cp.wu
273  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
274  * identify BT Over Wi-Fi Security frame and mark it as 802.1X frame
275  *
276  * 04 27 2010 cp.wu
277  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
278  * add multiple physical link support
279  *
280  * 04 27 2010 jeffrey.chang
281  * [WPD00003826]Initial import for Linux port
282  * 1) fix firmware download bug
283  * 2) remove query statistics for acelerating firmware download
284  *
285  * 04 27 2010 jeffrey.chang
286  * [WPD00003826]Initial import for Linux port
287  * follow Linux's firmware framework, and remove unused kal API
288  *
289  * 04 23 2010 cp.wu
290  * [WPD00001943]Create WiFi test driver framework on WinXP
291  * surpress compiler warning
292  *
293  * 04 19 2010 jeffrey.chang
294  * [WPD00003826]Initial import for Linux port
295  * supporting power management
296  *
297  * 04 14 2010 jeffrey.chang
298  * [WPD00003826]Initial import for Linux port
299  * pvInformationBuffer and u4InformationBufferLength are no longer in glue
300  *
301  * 04 13 2010 cp.wu
302  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
303  * add framework for BT-over-Wi-Fi support.
304  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * 1) prPendingCmdInfo is replaced by queue for multiple handler capability
305  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * 2) command sequence number is now increased atomically
306  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * 3) private data could be hold and taken use for other purpose
307  *
308  * 04 07 2010 cp.wu
309  * [WPD00001943]Create WiFi test driver framework on WinXP
310  * rWlanInfo should be placed at adapter rather than glue due to most operations
311  *  *  *  *  *  *  *  *  *  * are done in adapter layer.
312  *
313  * 04 06 2010 jeffrey.chang
314  * [WPD00003826]Initial import for Linux port
315  * Tag the packet for QoS on Tx path
316  *
317  * 04 06 2010 jeffrey.chang
318  * [WPD00003826]Initial import for Linux port
319  * (1)deliver the kalOidComplete status to upper layer
320  *  * (2) fix spin lock
321  *
322  * 04 06 2010 jeffrey.chang
323  * [WPD00003826]Initial import for Linux port
324  * add timeout check in the kalOidComplete
325  *
326  * 04 06 2010 jeffrey.chang
327  * [WPD00003826]Initial import for Linux port
328  * improve none-glue code portability
329  *
330  * 04 06 2010 cp.wu
331  * [WPD00001943]Create WiFi test driver framework on WinXP
332  * code refine: fgTestMode should be at adapter rather than glue due to the device/fw is also involved
333  *
334  * 04 06 2010 cp.wu
335  * [WPD00001943]Create WiFi test driver framework on WinXP
336  * eliminate direct access for prGlueInfo->fgIsCardRemoved in non-glue layer
337  *
338  * 03 30 2010 jeffrey.chang
339  * [WPD00003826]Initial import for Linux port
340  * emulate NDIS Pending OID facility
341  *
342  * 03 26 2010 jeffrey.chang
343  * [WPD00003826]Initial import for Linux port
344  * [WPD00003826] Initial import for Linux port
345  * adding firmware download related data type
346  *
347  * 03 25 2010 cp.wu
348  * [WPD00001943]Create WiFi test driver framework on WinXP
349  * 1) correct OID_802_11_CONFIGURATION with frequency setting behavior.
350  *  *  *  * the frequency is used for adhoc connection only
351  *  *  *  * 2) update with SD1 v0.9 CMD/EVENT documentation
352  *
353  * 03 25 2010 cp.wu
354  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
355  * add Bluetooth-over-Wifi frame header check
356  *
357  * 03 24 2010 jeffrey.chang
358  * [WPD00003826]Initial import for Linux port
359  * initial import for Linux port
360 **  \main\maintrunk.MT5921\30 2009-10-20 17:38:31 GMT mtk01090
361 **  Refine driver unloading and clean up procedure. Block requests, stop main thread and clean up queued requests, and then stop hw.
362 **  \main\maintrunk.MT5921\29 2009-10-08 10:33:33 GMT mtk01090
363 **  Avoid accessing private data of net_device directly. Replace with netdev_priv(). Add more checking for input parameters and pointers.
364 **  \main\maintrunk.MT5921\28 2009-09-28 20:19:26 GMT mtk01090
365 **  Add private ioctl to carry OID structures. Restructure public/private ioctl interfaces to Linux kernel.
366 **  \main\maintrunk.MT5921\27 2009-08-18 22:57:12 GMT mtk01090
367 **  Add Linux SDIO (with mmc core) support.
368 **  Add Linux 2.6.21, 2.6.25, 2.6.26.
369 **  Fix compile warning in Linux.
370 **  \main\maintrunk.MT5921\26 2009-07-06 21:42:25 GMT mtk01088
371 **  fixed the compiling error at linux
372 **  \main\maintrunk.MT5921\25 2009-07-06 20:51:46 GMT mtk01088
373 **  adding the wapi 1x ether type define
374 **  \main\maintrunk.MT5921\24 2009-06-23 23:19:18 GMT mtk01090
375 **  Add build option BUILD_USE_EEPROM and compile option CFG_SUPPORT_EXT_CONFIG for NVRAM support
376 **  \main\maintrunk.MT5921\23 2009-02-07 15:05:06 GMT mtk01088
377 **  add the privacy flag to ingo driver the supplicant selected ap's security
378 **  \main\maintrunk.MT5921\22 2009-02-05 15:34:09 GMT mtk01088
379 **  fixed the compiling error for using bits marco for only one parameter
380 **  \main\maintrunk.MT5921\21 2009-01-22 13:02:13 GMT mtk01088
381 **  data frame is or not 802.1x value share with tid, using the same reserved byte, provide the function to set and get
382 **  \main\maintrunk.MT5921\20 2008-10-24 12:04:16 GMT mtk01088
383 **  move the config.h from precomp.h to here for lint check
384 **  \main\maintrunk.MT5921\19 2008-09-22 23:19:02 GMT mtk01461
385 **  Update driver for code review
386 **  \main\maintrunk.MT5921\18 2008-09-05 17:25:13 GMT mtk01461
387 **  Update Driver for Code Review
388 **  \main\maintrunk.MT5921\17 2008-08-01 13:32:47 GMT mtk01084
389 **  Prevent redundent driver assertion in driver logic when BUS is detached
390 **  \main\maintrunk.MT5921\16 2008-05-30 14:41:43 GMT mtk01461
391 **  Remove WMM Assoc Flag in KAL
392 **  \main\maintrunk.MT5921\15 2008-05-29 14:16:25 GMT mtk01084
393 **  remoev un-used variable
394 **  \main\maintrunk.MT5921\14 2008-05-03 15:17:14 GMT mtk01461
395 **  Add Media Status variable in Glue Layer
396 **  \main\maintrunk.MT5921\13 2008-04-24 11:58:41 GMT mtk01461
397 **  change threshold to 256
398 **  \main\maintrunk.MT5921\12 2008-03-11 14:51:05 GMT mtk01461
399 **  Remove redundant GL_CONN_INFO_T
400 **  \main\maintrunk.MT5921\11 2008-01-07 15:07:41 GMT mtk01461
401 **  Adjust the netif stop threshold to 150
402 **  \main\maintrunk.MT5921\10 2007-11-26 19:43:46 GMT mtk01461
403 **  Add OS_TIMESTAMP macro
404 **
405 **  \main\maintrunk.MT5921\9 2007-11-07 18:38:38 GMT mtk01461
406 **  Move definition
407 **  \main\maintrunk.MT5921\8 2007-11-02 01:04:00 GMT mtk01461
408 **  Unify TX Path for Normal and IBSS Power Save + IBSS neighbor learning
409 ** Revision 1.5  2007/07/12 11:04:28  MTK01084
410 ** update macro to delay for ms order
411 **
412 ** Revision 1.4  2007/07/05 07:25:34  MTK01461
413 ** Add Linux initial code, modify doc, add 11BB, RF init code
414 **
415 ** Revision 1.3  2007/06/27 02:18:51  MTK01461
416 ** Update SCAN_FSM, Initial(Can Load Module), Proc(Can do Reg R/W), TX API
417 **
418 ** Revision 1.2  2007/06/25 06:16:24  MTK01461
419 ** Update illustrations, gl_init.c, gl_kal.c, gl_kal.h, gl_os.h and RX API
420 **
421 */
422
423 #ifndef _GL_OS_H
424 #define _GL_OS_H
425
426 /*******************************************************************************
427 *                         C O M P I L E R   F L A G S
428 ********************************************************************************
429 */
430 /*------------------------------------------------------------------------------
431  * Flags for LINUX(OS) dependent
432  *------------------------------------------------------------------------------
433  */
434 #define CFG_MAX_WLAN_DEVICES                1 /* number of wlan card will coexist*/
435
436 #define CFG_MAX_TXQ_NUM                     4 /* number of tx queue for support multi-queue h/w  */
437
438
439 #define CFG_USE_SPIN_LOCK_BOTTOM_HALF       0 /* 1: Enable use of SPIN LOCK Bottom Half for LINUX
440                                                  0: Disable - use SPIN LOCK IRQ SAVE instead */
441
442 #define CFG_TX_PADDING_SMALL_ETH_PACKET     0 /* 1: Enable - Drop ethernet packet if it < 14 bytes.
443                                                              And pad ethernet packet with dummy 0 if it < 60 bytes.
444                                                  0: Disable */
445
446 #define CFG_TX_STOP_NETIF_QUEUE_THRESHOLD   256 /* packets */
447
448 #define CFG_TX_STOP_NETIF_PER_QUEUE_THRESHOLD   512  /* packets */
449 #define CFG_TX_START_NETIF_PER_QUEUE_THRESHOLD  128  /* packets */
450
451
452 #define ETH_P_1X                            0x888E
453 #define IPTOS_PREC_OFFSET                   5
454 #define USER_PRIORITY_DEFAULT               0
455
456 #define ETH_WPI_1X                         0x88B4
457
458 #define ETH_HLEN                                14
459 #define ETH_TYPE_LEN_OFFSET                     12
460 #define ETH_P_IP                                0x0800
461 #define ETH_P_1X                                0x888E
462 #define ETH_P_PRE_1X                            0x88C7
463
464 #define IPVERSION                               4
465 #define IP_HEADER_LEN                           20
466
467 #define IPVH_VERSION_OFFSET                     4 // For Little-Endian
468 #define IPVH_VERSION_MASK                       0xF0
469 #define IPTOS_PREC_OFFSET                       5
470 #define IPTOS_PREC_MASK                         0xE0
471
472 #define SOURCE_PORT_LEN                         2
473 /* NOTE(Kevin): Without IP Option Length */
474 #define LOOK_AHEAD_LEN                          (ETH_HLEN + IP_HEADER_LEN + SOURCE_PORT_LEN)
475
476 /* 802.2 LLC/SNAP */
477 #define ETH_LLC_OFFSET                          (ETH_HLEN)
478 #define ETH_LLC_LEN                             3
479 #define ETH_LLC_DSAP_SNAP                       0xAA
480 #define ETH_LLC_SSAP_SNAP                       0xAA
481 #define ETH_LLC_CONTROL_UNNUMBERED_INFORMATION  0x03
482
483 /* Bluetooth SNAP */
484 #define ETH_SNAP_OFFSET                         (ETH_HLEN + ETH_LLC_LEN)
485 #define ETH_SNAP_LEN                            5
486 #define ETH_SNAP_BT_SIG_OUI_0                   0x00
487 #define ETH_SNAP_BT_SIG_OUI_1                   0x19
488 #define ETH_SNAP_BT_SIG_OUI_2                   0x58
489
490 #define BOW_PROTOCOL_ID_SECURITY_FRAME          0x0003
491
492
493 #if defined(MT6620)
494     #define CHIP_NAME    "MT6620"
495 #elif defined(MT5931)
496     #define CHIP_NAME    "MT5931"
497 #elif defined(MT6628)
498     #define CHIP_NAME    "MT6628"
499 #endif
500
501 #define DRV_NAME "["CHIP_NAME"]: "
502
503 /* Define if target platform is Android.
504  * It should already be defined in Android kernel source
505  */
506 #ifndef CONFIG_ANDROID
507 #define CONFIG_ANDROID      0
508 #endif
509
510 /* for CFG80211 IE buffering mechanism */
511 #define CFG_CFG80211_IE_BUF_LEN     (512)
512
513 /*******************************************************************************
514 *                    E X T E R N A L   R E F E R E N C E S
515 ********************************************************************************
516 */
517 #include <linux/version.h>      /* constant of kernel version */
518
519 #include <linux/kernel.h>       /* bitops.h */
520
521 #include <linux/timer.h>        /* struct timer_list */
522 #include <linux/jiffies.h>      /* jiffies */
523 #include <linux/delay.h>        /* udelay and mdelay macro */
524
525 #if CONFIG_ANDROID
526 #include <linux/wakelock.h>
527 #endif
528
529 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 12)
530 #include <linux/irq.h>          /* IRQT_FALLING */
531 #include <linux/hardirq.h>      /*for in_interrupt*/
532 #endif
533
534 #include <linux/netdevice.h>    /* struct net_device, struct net_device_stats */
535 #include <linux/etherdevice.h>  /* for eth_type_trans() function */
536 #include <linux/wireless.h>     /* struct iw_statistics */
537 #include <linux/if_arp.h>
538 #include <linux/inetdevice.h>   /* struct in_device */
539
540 #include <linux/ip.h>           /* struct iphdr */
541
542 #include <linux/string.h>       /* for memcpy()/memset() function */
543 #include <linux/stddef.h>       /* for offsetof() macro */
544
545 #include <linux/proc_fs.h>      /* The proc filesystem constants/structures */
546
547 #include <linux/rtnetlink.h>    /* for rtnl_lock() and rtnl_unlock() */
548 #include <linux/kthread.h>      /* kthread_should_stop(), kthread_run() */
549 #include <asm/uaccess.h>        /* for copy_from_user() */
550 #include <linux/fs.h>           /* for firmware download */
551 #include <linux/vmalloc.h>
552
553 #include <linux/kfifo.h>        /* for kfifo interface */
554 #include <linux/cdev.h>         /* for cdev interface */
555
556 #include <linux/firmware.h>     /* for firmware download */
557
558 #if defined(_HIF_SDIO)
559 #include <linux/mmc/sdio.h>
560 #include <linux/mmc/sdio_func.h>
561 #endif
562
563 #include <linux/random.h>
564
565 #include <linux/lockdep.h>
566
567 #include <asm/io.h>             /* readw and writew */
568
569 #if WIRELESS_EXT > 12
570 #include <net/iw_handler.h>
571 #endif
572
573 #include "version.h"
574 #include "config.h"
575
576 #if CFG_ENABLE_WIFI_DIRECT_CFG_80211
577 #include <linux/wireless.h>
578 #include <net/cfg80211.h>
579 #endif
580
581 #include <linux/module.h>
582
583 #include "gl_typedef.h"
584 #include "typedef.h"
585 #include "queue.h"
586 #include "gl_kal.h"
587 #if CFG_CHIP_RESET_SUPPORT
588     #include "gl_rst.h"
589 #endif
590 #include "hif.h"
591
592
593 #include "debug.h"
594
595 #include "wlan_lib.h"
596 #include "wlan_oid.h"
597
598 #if CFG_ENABLE_AEE_MSG
599 #include <linux/aee.h>
600 #endif
601
602 extern BOOLEAN fgIsBusAccessFailed;
603
604 /*******************************************************************************
605 *                              C O N S T A N T S
606 ********************************************************************************
607 */
608 #define GLUE_FLAG_HALT          BIT(0)
609 #define GLUE_FLAG_INT           BIT(1)
610 #define GLUE_FLAG_OID           BIT(2)
611 #define GLUE_FLAG_TIMEOUT       BIT(3)
612 #define GLUE_FLAG_TXREQ         BIT(4)
613 #define GLUE_FLAG_SUB_MOD_INIT  BIT(5)
614 #define GLUE_FLAG_SUB_MOD_EXIT  BIT(6)
615 #define GLUE_FLAG_SUB_MOD_MULTICAST  BIT(7)
616 #define GLUE_FLAG_FRAME_FILTER      BIT(8)
617 #define GLUE_FLAG_HALT_BIT          (0)
618 #define GLUE_FLAG_INT_BIT           (1)
619 #define GLUE_FLAG_OID_BIT           (2)
620 #define GLUE_FLAG_TIMEOUT_BIT       (3)
621 #define GLUE_FLAG_TXREQ_BIT         (4)
622 #define GLUE_FLAG_SUB_MOD_INIT_BIT  (5)
623 #define GLUE_FLAG_SUB_MOD_EXIT_BIT  (6)
624 #define GLUE_FLAG_SUB_MOD_MULTICAST_BIT  (7)
625 #define GLUE_FLAG_FRAME_FILTER_BIT  (8)
626
627
628
629 #define GLUE_BOW_KFIFO_DEPTH        (1024)
630 //#define GLUE_BOW_DEVICE_NAME        "MT6620 802.11 AMP"
631 #define GLUE_BOW_DEVICE_NAME        "ampc0"
632
633
634 /*******************************************************************************
635 *                             D A T A   T Y P E S
636 ********************************************************************************
637 */
638 typedef struct _GL_WPA_INFO_T {
639     UINT_32 u4WpaVersion;
640     UINT_32 u4KeyMgmt;
641     UINT_32 u4CipherGroup;
642     UINT_32 u4CipherPairwise;
643     UINT_32 u4AuthAlg;
644     BOOLEAN fgPrivacyInvoke;
645 #if CFG_SUPPORT_802_11W
646     UINT_32 u4Mfp;
647 #endif
648 } GL_WPA_INFO_T, *P_GL_WPA_INFO_T;
649
650 typedef enum _ENUM_RSSI_TRIGGER_TYPE {
651     ENUM_RSSI_TRIGGER_NONE,
652     ENUM_RSSI_TRIGGER_GREATER,
653     ENUM_RSSI_TRIGGER_LESS,
654     ENUM_RSSI_TRIGGER_TRIGGERED,
655     ENUM_RSSI_TRIGGER_NUM
656 } ENUM_RSSI_TRIGGER_TYPE;
657
658 #if CFG_ENABLE_WIFI_DIRECT
659 typedef enum _ENUM_SUB_MODULE_IDX_T {
660     P2P_MODULE = 0,
661     SUB_MODULE_NUM
662 } ENUM_SUB_MODULE_IDX_T;
663
664 typedef enum _ENUM_NET_REG_STATE_T {
665     ENUM_NET_REG_STATE_UNREGISTERED,
666     ENUM_NET_REG_STATE_REGISTERING,
667     ENUM_NET_REG_STATE_REGISTERED,
668     ENUM_NET_REG_STATE_UNREGISTERING,
669     ENUM_NET_REG_STATE_NUM
670 } ENUM_NET_REG_STATE_T;
671
672 #endif
673
674 typedef struct _GL_IO_REQ_T {
675     QUE_ENTRY_T             rQueEntry;
676     //wait_queue_head_t       cmdwait_q;
677     BOOL                    fgRead;
678     BOOL                    fgWaitResp;
679 #if CFG_ENABLE_WIFI_DIRECT
680     BOOL                    fgIsP2pOid;
681 #endif
682     P_ADAPTER_T             prAdapter;
683     PFN_OID_HANDLER_FUNC    pfnOidHandler;
684     PVOID                   pvInfoBuf;
685     UINT_32                 u4InfoBufLen;
686     PUINT_32                pu4QryInfoLen;
687     WLAN_STATUS             rStatus;
688     UINT_32                 u4Flag;
689 } GL_IO_REQ_T, *P_GL_IO_REQ_T;
690
691 #if CFG_ENABLE_BT_OVER_WIFI
692 typedef struct _GL_BOW_INFO {
693     BOOLEAN                 fgIsRegistered;
694     dev_t                   u4DeviceNumber; /* dynamic device number */
695 //    struct kfifo            *prKfifo;       /* for buffering indicated events */
696     struct kfifo                      rKfifo;   /* for buffering indicated events */
697     spinlock_t              rSpinLock;      /* spin lock for kfifo */
698     struct cdev             cdev;
699     UINT_32                 u4FreqInKHz;    /* frequency */
700
701     UINT_8                  aucRole[CFG_BOW_PHYSICAL_LINK_NUM];  /* 0: Responder, 1: Initiator */
702     ENUM_BOW_DEVICE_STATE   aeState[CFG_BOW_PHYSICAL_LINK_NUM];
703     PARAM_MAC_ADDRESS       arPeerAddr[CFG_BOW_PHYSICAL_LINK_NUM];
704
705     wait_queue_head_t       outq;
706
707     #if CFG_BOW_SEPARATE_DATA_PATH
708     /* Device handle */
709     struct net_device           *prDevHandler;
710     BOOLEAN                     fgIsNetRegistered;
711     #endif
712
713 } GL_BOW_INFO, *P_GL_BOW_INFO;
714 #endif
715
716 /*
717 * type definition of pointer to p2p structure
718 */
719 typedef struct _GL_P2P_INFO_T   GL_P2P_INFO_T, *P_GL_P2P_INFO_T;
720
721 struct _GLUE_INFO_T {
722     /* Device handle */
723     struct net_device *prDevHandler;
724
725     /* Device Index(index of arWlanDevInfo[]) */
726     INT_32 i4DevIdx;
727
728     /* Device statistics */
729     struct net_device_stats rNetDevStats;
730
731     /* Wireless statistics struct net_device */
732     struct iw_statistics rIwStats;
733
734     /* spinlock to sync power save mechanism */
735     spinlock_t rSpinLock[SPIN_LOCK_NUM];
736
737     /* semaphore for ioctl */
738     struct semaphore ioctl_sem;
739
740     UINT_32 u4Flag; /* GLUE_FLAG_XXX */
741     UINT_32 u4PendFlag;
742     //UINT_32 u4TimeoutFlag;
743     UINT_32 u4OidCompleteFlag;
744     UINT_32 u4ReadyFlag;  /* check if card is ready */
745
746     /* Number of pending frames, also used for debuging if any frame is
747      * missing during the process of unloading Driver.
748      *
749      * NOTE(Kevin): In Linux, we also use this variable as the threshold
750      * for manipulating the netif_stop(wake)_queue() func.
751      */
752     INT_32             ai4TxPendingFrameNumPerQueue[4][CFG_MAX_TXQ_NUM];
753     INT_32             i4TxPendingFrameNum;
754     INT_32             i4TxPendingSecurityFrameNum;
755
756     /* current IO request for kalIoctl */
757     GL_IO_REQ_T         OidEntry;
758
759     /* registry info*/
760     REG_INFO_T rRegInfo;
761
762     /* firmware */
763     struct firmware     *prFw;
764
765     /* Host interface related information */
766     /* defined in related hif header file */
767     GL_HIF_INFO_T       rHifInfo;
768
769     /*! \brief wext wpa related information */
770     GL_WPA_INFO_T       rWpaInfo;
771
772
773     /* Pointer to ADAPTER_T - main data structure of internal protocol stack */
774     P_ADAPTER_T         prAdapter;
775
776 #ifdef WLAN_INCLUDE_PROC
777     struct proc_dir_entry *pProcRoot;
778 #endif /* WLAN_INCLUDE_PROC */
779
780     /* Indicated media state */
781     ENUM_PARAM_MEDIA_STATE_T eParamMediaStateIndicated;
782
783     /* Device power state D0~D3 */
784     PARAM_DEVICE_POWER_STATE ePowerState;
785
786     struct completion rScanComp; /* indicate scan complete */
787     struct completion rHaltComp; /* indicate main thread halt complete */
788     struct completion rPendComp; /* indicate main thread halt complete */
789 #if CFG_ENABLE_WIFI_DIRECT
790     struct completion rSubModComp; /*indicate sub module init or exit complete*/
791 #endif
792     WLAN_STATUS             rPendStatus;
793
794     QUE_T                   rTxQueue;
795
796
797     /* OID related */
798     QUE_T                   rCmdQueue;
799     //PVOID                   pvInformationBuffer;
800     //UINT_32                 u4InformationBufferLength;
801     //PVOID                   pvOidEntry;
802     //PUINT_8                 pucIOReqBuff;
803     //QUE_T                   rIOReqQueue;
804     //QUE_T                   rFreeIOReqQueue;
805
806     wait_queue_head_t       waitq;
807     struct task_struct      *main_thread;
808
809     struct timer_list tickfn;
810
811
812 #if CFG_SUPPORT_EXT_CONFIG
813     UINT_16     au2ExtCfg[256];  /* NVRAM data buffer */
814     UINT_32     u4ExtCfgLength;  /* 0 means data is NOT valid */
815 #endif
816
817 #if 1//CFG_SUPPORT_WAPI
818     /* Should be large than the PARAM_WAPI_ASSOC_INFO_T */
819     UINT_8                  aucWapiAssocInfoIEs[42];
820     UINT_16                 u2WapiAssocInfoIESz;
821 #endif
822
823 #if CFG_ENABLE_BT_OVER_WIFI
824     GL_BOW_INFO             rBowInfo;
825 #endif
826
827 #if CFG_ENABLE_WIFI_DIRECT
828     P_GL_P2P_INFO_T         prP2PInfo;
829 #if CFG_SUPPORT_P2P_RSSI_QUERY
830     /* Wireless statistics struct net_device */
831     struct iw_statistics    rP2pIwStats;
832 #endif
833 #endif
834     BOOLEAN                 fgWpsActive;
835         UINT_8                  aucWSCIE[500]; /*for probe req*/
836     UINT_16                 u2WSCIELen;
837         UINT_8                  aucWSCAssocInfoIE[200]; /*for Assoc req*/
838     UINT_16                 u2WSCAssocInfoIELen;
839
840     /* NVRAM availability */
841     BOOLEAN                 fgNvramAvailable;
842
843     BOOLEAN                 fgMcrAccessAllowed;
844
845     /* MAC Address Overriden by IOCTL */
846     BOOLEAN                 fgIsMacAddrOverride;
847     PARAM_MAC_ADDRESS       rMacAddrOverride;
848
849     SET_TXPWR_CTRL_T        rTxPwr;
850
851     /* for cfg80211 scan done indication */
852     struct cfg80211_scan_request    *prScanRequest;
853
854     /* to indicate registered or not */
855     BOOLEAN                 fgIsRegistered;
856
857     /* for cfg80211 connected indication */
858     UINT_32                 u4RspIeLength;
859     UINT_8                  aucRspIe[CFG_CFG80211_IE_BUF_LEN];
860
861     UINT_32                 u4ReqIeLength;
862     UINT_8                  aucReqIe[CFG_CFG80211_IE_BUF_LEN];
863 };
864
865 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
866     /* linux 2.4 */
867     typedef void (*PFN_WLANISR)(int irq, void *dev_id, struct pt_regs *regs);
868 #else
869     typedef irqreturn_t (*PFN_WLANISR)(int irq, void *dev_id, struct pt_regs *regs);
870 #endif
871
872 typedef void (*PFN_LINUX_TIMER_FUNC)(unsigned long);
873
874
875 /* generic sub module init/exit handler
876 *   now, we only have one sub module, p2p
877 */
878 #if CFG_ENABLE_WIFI_DIRECT
879 typedef BOOLEAN (*SUB_MODULE_INIT)(P_GLUE_INFO_T prGlueInfo);
880 typedef BOOLEAN (*SUB_MODULE_EXIT)(P_GLUE_INFO_T prGlueInfo);
881
882 typedef struct _SUB_MODULE_HANDLER {
883     SUB_MODULE_INIT subModInit;
884     SUB_MODULE_EXIT subModExit;
885     BOOLEAN fgIsInited;
886 } SUB_MODULE_HANDLER, *P_SUB_MODULE_HANDLER;
887
888 #endif
889
890 #if CONFIG_NL80211_TESTMODE
891
892 typedef struct _NL80211_DRIVER_TEST_MODE_PARAMS {
893         UINT_32  index;
894         UINT_32  buflen;
895 } NL80211_DRIVER_TEST_MODE_PARAMS, *P_NL80211_DRIVER_TEST_MODE_PARAMS;
896
897 /*SW CMD */
898 typedef struct _NL80211_DRIVER_SW_CMD_PARAMS {
899     NL80211_DRIVER_TEST_MODE_PARAMS hdr;
900     UINT_8           set;
901     unsigned long    adr;
902     unsigned long    data;
903 }NL80211_DRIVER_SW_CMD_PARAMS, *P_NL80211_DRIVER_SW_CMD_PARAMS;
904
905 struct iw_encode_exts {
906     __u32   ext_flags;                      /*!< IW_ENCODE_EXT_* */
907     __u8    tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /*!< LSB first */
908     __u8    rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /*!< LSB first */
909     __u8    addr[MAC_ADDR_LEN];   /*!< ff:ff:ff:ff:ff:ff for broadcast/multicast
910                                                           *   (group) keys or unicast address for
911                                                           *   individual keys */
912     __u16   alg;            /*!< IW_ENCODE_ALG_* */
913     __u16   key_len;
914     __u8    key[32];
915 };
916
917 /*SET KEY EXT */
918 typedef struct _NL80211_DRIVER_SET_KEY_EXTS {
919     NL80211_DRIVER_TEST_MODE_PARAMS hdr;
920     UINT_8     key_index;
921     UINT_8     key_len;
922     struct iw_encode_exts ext;
923 }NL80211_DRIVER_SET_KEY_EXTS, *P_NL80211_DRIVER_SET_KEY_EXTS;
924
925
926 #endif
927
928 /*******************************************************************************
929 *                            P U B L I C   D A T A
930 ********************************************************************************
931 */
932
933 /*******************************************************************************
934 *                           P R I V A T E   D A T A
935 ********************************************************************************
936 */
937
938 /*******************************************************************************
939 *                                 M A C R O S
940 ********************************************************************************
941 */
942 /*----------------------------------------------------------------------------*/
943 /* Macros of SPIN LOCK operations for using in Glue Layer                     */
944 /*----------------------------------------------------------------------------*/
945 #if CFG_USE_SPIN_LOCK_BOTTOM_HALF
946     #define GLUE_SPIN_LOCK_DECLARATION()
947     #define GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, rLockCategory)   \
948             { \
949                 if (rLockCategory < SPIN_LOCK_NUM) \
950                 spin_lock_bh(&(prGlueInfo->rSpinLock[rLockCategory])); \
951             }
952     #define GLUE_RELEASE_SPIN_LOCK(prGlueInfo, rLockCategory)   \
953             { \
954                 if (rLockCategory < SPIN_LOCK_NUM) \
955                 spin_unlock_bh(&(prGlueInfo->rSpinLock[rLockCategory])); \
956             }
957 #else /* !CFG_USE_SPIN_LOCK_BOTTOM_HALF */
958     #define GLUE_SPIN_LOCK_DECLARATION()                        UINT_32 __u4Flags = 0
959     #define GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, rLockCategory)   \
960             { \
961                 if (rLockCategory < SPIN_LOCK_NUM) \
962                 spin_lock_irqsave(&(prGlueInfo)->rSpinLock[rLockCategory], __u4Flags); \
963             }
964     #define GLUE_RELEASE_SPIN_LOCK(prGlueInfo, rLockCategory)   \
965             { \
966                 if (rLockCategory < SPIN_LOCK_NUM) \
967                 spin_unlock_irqrestore(&(prGlueInfo->rSpinLock[rLockCategory]), __u4Flags); \
968             }
969 #endif /* !CFG_USE_SPIN_LOCK_BOTTOM_HALF */
970
971
972 /*----------------------------------------------------------------------------*/
973 /* Macros for accessing Reserved Fields of native packet                      */
974 /*----------------------------------------------------------------------------*/
975 #define GLUE_GET_PKT_QUEUE_ENTRY(_p)    \
976             (&( ((struct sk_buff *)(_p))->cb[0] ))
977
978 #define GLUE_GET_PKT_DESCRIPTOR(_prQueueEntry)  \
979             ((P_NATIVE_PACKET) ((UINT_32)_prQueueEntry - offsetof(struct sk_buff, cb[0])) )
980
981 #define  GLUE_SET_PKT_FLAG_802_11(_p)  \
982             (*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) |= BIT(7))
983
984 #define GLUE_SET_PKT_FLAG_1X(_p)  \
985             (*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) |= BIT(6))
986
987 #define GLUE_SET_PKT_FLAG_PAL(_p)  \
988             (*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) |= BIT(5))
989
990 #define GLUE_SET_PKT_FLAG_P2P(_p)  \
991             (*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) |= BIT(4))
992
993
994
995 #define GLUE_SET_PKT_TID(_p, _tid)  \
996             (*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) |= (((UINT_8)((_tid) & (BITS(0,3))))))
997
998
999 #define GLUE_SET_PKT_FRAME_LEN(_p, _u2PayloadLen) \
1000             (*((PUINT_16) &( ((struct sk_buff *)(_p))->cb[6] )) = (UINT_16)(_u2PayloadLen))
1001
1002 #define GLUE_GET_PKT_FRAME_LEN(_p)    \
1003             (*((PUINT_16) &( ((struct sk_buff *)(_p))->cb[6] )) )
1004
1005
1006 #define  GLUE_GET_PKT_IS_802_11(_p)        \
1007             ((*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) ) & (BIT(7)))
1008
1009 #define  GLUE_GET_PKT_IS_1X(_p)        \
1010             ((*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) ) & (BIT(6)))
1011
1012 #define GLUE_GET_PKT_TID(_p)        \
1013             ((*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) ) & (BITS(0,3)))
1014
1015
1016 #define GLUE_GET_PKT_IS_PAL(_p)        \
1017             ((*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) ) & (BIT(5)))
1018
1019 #define GLUE_GET_PKT_IS_P2P(_p)        \
1020             ((*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) ) & (BIT(4)))
1021
1022
1023 #define GLUE_SET_PKT_HEADER_LEN(_p, _ucMacHeaderLen)    \
1024             (*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[5] )) = (UINT_8)(_ucMacHeaderLen))
1025
1026 #define GLUE_GET_PKT_HEADER_LEN(_p) \
1027             (*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[5] )) )
1028
1029 #define GLUE_SET_PKT_ARRIVAL_TIME(_p, _rSysTime) \
1030             (*((POS_SYSTIME) &( ((struct sk_buff *)(_p))->cb[8] )) = (OS_SYSTIME)(_rSysTime))
1031
1032 #define GLUE_GET_PKT_ARRIVAL_TIME(_p)    \
1033             (*((POS_SYSTIME) &( ((struct sk_buff *)(_p))->cb[8] )) )
1034
1035 /* Check validity of prDev, private data, and pointers */
1036 #define GLUE_CHK_DEV(prDev) \
1037     ((prDev && *((P_GLUE_INFO_T *) netdev_priv(prDev))) ? TRUE : FALSE)
1038
1039 #define GLUE_CHK_PR2(prDev, pr2) \
1040     ((GLUE_CHK_DEV(prDev) && pr2) ? TRUE : FALSE)
1041
1042 #define GLUE_CHK_PR3(prDev, pr2, pr3) \
1043     ((GLUE_CHK_PR2(prDev, pr2) && pr3) ? TRUE : FALSE)
1044
1045 #define GLUE_CHK_PR4(prDev, pr2, pr3, pr4) \
1046     ((GLUE_CHK_PR3(prDev, pr2, pr3) && pr4) ? TRUE : FALSE)
1047
1048 #define GLUE_SET_EVENT(pr) \
1049         kalSetEvent(pr)
1050
1051 #define GLUE_INC_REF_CNT(_refCount)     atomic_inc((atomic_t *)&(_refCount))
1052 #define GLUE_DEC_REF_CNT(_refCount)     atomic_dec((atomic_t *)&(_refCount))
1053
1054
1055 #define DbgPrint(...)
1056 /*******************************************************************************
1057 *                  F U N C T I O N   D E C L A R A T I O N S
1058 ********************************************************************************
1059 */
1060 #ifdef WLAN_INCLUDE_PROC
1061 INT_32
1062 procRemoveProcfs (
1063     struct net_device *prDev,
1064     char *pucDevName
1065     );
1066
1067 INT_32
1068 procInitProcfs (
1069     struct net_device *prDev,
1070     char *pucDevName
1071     );
1072 #endif /* WLAN_INCLUDE_PROC */
1073
1074 #if CFG_ENABLE_BT_OVER_WIFI
1075 BOOLEAN
1076 glRegisterAmpc (
1077     P_GLUE_INFO_T prGlueInfo
1078     );
1079
1080 BOOLEAN
1081 glUnregisterAmpc (
1082     P_GLUE_INFO_T prGlueInfo
1083     );
1084 #endif
1085
1086 #if CFG_ENABLE_WIFI_DIRECT
1087
1088 VOID
1089 wlanSubModRunInit(
1090     P_GLUE_INFO_T prGlueInfo
1091     );
1092
1093 VOID
1094 wlanSubModRunExit(
1095     P_GLUE_INFO_T prGlueInfo
1096     );
1097
1098 BOOLEAN
1099 wlanSubModInit(
1100     P_GLUE_INFO_T prGlueInfo
1101     );
1102
1103 BOOLEAN
1104 wlanSubModExit(
1105     P_GLUE_INFO_T prGlueInfo
1106     );
1107
1108 VOID
1109 wlanSubModRegisterInitExit(
1110     SUB_MODULE_INIT rSubModInit,
1111     SUB_MODULE_EXIT rSubModExit,
1112     ENUM_SUB_MODULE_IDX_T eSubModIdx
1113     );
1114
1115 BOOLEAN
1116 wlanExportGlueInfo(
1117     P_GLUE_INFO_T *prGlueInfoExpAddr
1118     );
1119
1120 BOOLEAN
1121 wlanIsLaunched(
1122     VOID
1123     );
1124
1125 void
1126 p2pSetMulticastListWorkQueueWrapper(
1127     P_GLUE_INFO_T prGlueInfo
1128     );
1129
1130
1131
1132 #endif
1133
1134 /*******************************************************************************
1135 *                              F U N C T I O N S
1136 ********************************************************************************
1137 */
1138
1139 #endif /* _GL_OS_H */
1140