add MTK-combo-module,continue with commit 17f39ed917874e77e80411f33faba1b7ee8138c8
[firefly-linux-kernel-4.4.55.git] / drivers / mtk_wcn_combo / drv_wlan / wlan / include / mgmt / hem_mbox.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_2/include/mgmt/hem_mbox.h#3 $
3 */
4
5 /*! \file   hem_mbox.h
6     \brief
7
8 */
9
10 /*******************************************************************************
11 * Copyright (c) 2009 MediaTek Inc.
12 *
13 * All rights reserved. Copying, compilation, modification, distribution
14 * or any other use whatsoever of this material is strictly prohibited
15 * except in accordance with a Software License Agreement with
16 * MediaTek Inc.
17 ********************************************************************************
18 */
19
20 /*******************************************************************************
21 * LEGAL DISCLAIMER
22 *
23 * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND
24 * AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK
25 * SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE
26 * PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY
27 * DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
28 * LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
29 * PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE
30 * ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY
31 * WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK
32 * SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY
33 * WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE
34 * FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO
35 * CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
36 *
37 * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
38 * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL
39 * BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT
40 * ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY
41 * BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
42 *
43 * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
44 * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT
45 * OF LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING
46 * THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN
47 * FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE
48 * (ICC).
49 ********************************************************************************
50 */
51
52 /*
53 ** $Log: hem_mbox.h $
54  *
55  * 01 17 2012 yuche.tsai
56  * NULL
57  * Update mgmt frame filter setting.
58  * Please also update FW 2.1
59  *
60  * 01 13 2012 yuche.tsai
61  * NULL
62  * WiFi Hot Spot Tethering for ICS ALPHA testing version.
63  *
64  * 10 19 2011 yuche.tsai
65  * [WCXRP00001045] [WiFi Direct][Driver] Check 2.1 branch.
66  * Branch 2.1
67  * Davinci Maintrunk Label: MT6620_WIFI_DRIVER_FW_TRUNK_MT6620E5_111019_0926.
68  *
69  * 08 10 2011 yuche.tsai
70  * [WCXRP00000919] [Volunteer Patch][WiFi Direct][Driver] Invitation New Feature.
71  * Add infitation support.
72  *
73  * 06 23 2011 cp.wu
74  * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module
75  * follow-ups for frequency-shifted WAPI AP support
76  *
77  * 03 18 2011 cp.wu
78  * [WCXRP00000577] [MT6620 Wi-Fi][Driver][FW] Create V2.0 branch for firmware and driver
79  * create V2.0 driver release based on label "MT6620_WIFI_DRIVER_V2_0_110318_1600" from main trunk
80  *
81  * 01 26 2011 cm.chang
82  * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument
83  * Allocate system RAM if fixed message or mgmt buffer is not available
84  *
85  * 11 08 2010 cm.chang
86  * [WCXRP00000169] [MT6620 Wi-Fi][Driver][FW] Remove unused CNM recover message ID
87  * Remove CNM channel reover message ID
88  *
89  * 09 16 2010 cm.chang
90  * NULL
91  * Remove unused message ID
92  *
93  * 09 03 2010 kevin.huang
94  * NULL
95  * Refine #include sequence and solve recursive/nested #include issue
96  *
97  * 08 30 2010 cp.wu
98  * NULL
99  * eliminate klockwork errors
100  *
101  * 08 25 2010 george.huang
102  * NULL
103  * update OID/ registry control path for PM related settings
104  *
105  * 08 23 2010 chinghwa.yu
106  * NULL
107  * Update for BOW.
108  *
109  * 08 16 2010 cp.wu
110  * NULL
111  * add interface for RLM to trigger OBSS-SCAN.
112  *
113  * 08 11 2010 yuche.tsai
114  * NULL
115  * Add some message ID for P2P FSM under provisioning phase.
116  *
117  * 08 11 2010 yuche.tsai
118  * NULL
119  * Add Message Event ID for P2P Module.
120  *
121  * 08 05 2010 yuche.tsai
122  * NULL
123  * Check-in P2P Device Discovery Feature.
124  *
125  * 08 04 2010 cp.wu
126  * NULL
127  * remove unused mailbox message definitions.
128  *
129  * 08 02 2010 yuche.tsai
130  * NULL
131  * P2P Group Negotiation Code Check in.
132  *
133  * 07 19 2010 cp.wu
134  *
135  * [WPD00003833] [MT6620 and MT5931] Driver migration.
136  * message table should not be commented out by compilation option without modifying header file
137  *
138  * 07 08 2010 cp.wu
139  *
140  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
141  *
142  * 07 08 2010 cm.chang
143  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
144  * Rename MID_MNY_CNM_CH_RELEASE to MID_MNY_CNM_CH_ABORT
145  *
146  * 07 01 2010 cp.wu
147  * [WPD00003833][MT6620 and MT5931] Driver migration
148  * AIS-FSM integration with CNM channel request messages
149  *
150  * 07 01 2010 cp.wu
151  * [WPD00003833][MT6620 and MT5931] Driver migration
152  * implementation of DRV-SCN and related mailbox message handling.
153  *
154  * 07 01 2010 cm.chang
155  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
156  * Modify CNM message handler for new flow
157  *
158  * 06 18 2010 cm.chang
159  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
160  * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf
161  *
162  * 06 14 2010 cp.wu
163  * [WPD00003833][MT6620 and MT5931] Driver migration
164  * restore utility function invoking via hem_mbox to direct calls
165  *
166  * 06 11 2010 cp.wu
167  * [WPD00003833][MT6620 and MT5931] Driver migration
168  * auth.c is migrated.
169  *
170  * 06 10 2010 cp.wu
171  * [WPD00003833][MT6620 and MT5931] Driver migration
172  * add buildable & linkable ais_fsm.c
173  *
174  * related reference are still waiting to be resolved
175  *
176  * 06 09 2010 cp.wu
177  * [WPD00003833][MT6620 and MT5931] Driver migration
178  * add definitions for module migration.
179  *
180  * 06 08 2010 cp.wu
181  * [WPD00003833][MT6620 and MT5931] Driver migration
182  * hem_mbox is migrated.
183  *
184  * 06 07 2010 cp.wu
185  * [WPD00003833][MT6620 and MT5931] Driver migration
186  * merge cnm_scan.h and hem_mbox.h
187  *
188  * 05 12 2010 kevin.huang
189  * [BORA00000794][WIFISYS][New Feature]Power Management Support
190  * Add Power Management - Legacy PS-POLL support.
191  *
192  * 04 29 2010 tehuang.liu
193  * [BORA00000605][WIFISYS] Phase3 Integration
194  * Removed MID_RXM_MQM_QOS_ACTION_FRAME
195  *
196  * 04 29 2010 tehuang.liu
197  * [BORA00000605][WIFISYS] Phase3 Integration
198  * Removed MID_RXM_MQM_BA_ACTION_FRAME
199  *
200  * 03 30 2010 cm.chang
201  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
202  * Support 2.4G OBSS scan
203  *
204  * 03 16 2010 kevin.huang
205  * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
206  * Add AdHoc Mode
207  *
208  * 03 10 2010 kevin.huang
209  * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support
210  *
211  *  *  *  *  * Add Channel Manager for arbitration of JOIN and SCAN Req
212  *
213  * 03 05 2010 cm.chang
214  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
215  * Develop partial DPD code
216  *
217  * 02 11 2010 tehuang.liu
218  * [BORA00000569][WIFISYS] Phase 2 Integration Test
219  * Added MID_RXM_MQM_QOS_ACTION_FRAME for RXM to indicate QoS Action frames to MQM
220  *
221  * 01 11 2010 kevin.huang
222  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
223  * Add Deauth and Disassoc Handler
224  *
225  * Dec 7 2009 mtk01461
226  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
227  * Rename the parameter of mboxDummy()
228  *
229  * Dec 2 2009 MTK02468
230  * [BORA00000337] To check in codes for FPGA emulation
231  * Added MID_RXM_MQM_BA_ACTION_FRAME
232  *
233  * Nov 24 2009 mtk01461
234  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
235  * Remove Dummy MSG ID
236  *
237  * Nov 23 2009 mtk01461
238  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
239  * Add JOIN REQ related MSG ID
240  *
241  * Nov 16 2009 mtk01461
242  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
243  * Add AIS ABORT MSG ID
244  *
245  * Nov 5 2009 mtk01461
246  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
247  * Add SCN MSG IDs
248  *
249  * Oct 28 2009 mtk01104
250  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
251  *
252 */
253
254 #ifndef _HEM_MBOX_H
255 #define _HEM_MBOX_H
256
257 /*******************************************************************************
258 *                         C O M P I L E R   F L A G S
259 ********************************************************************************
260 */
261
262 /*******************************************************************************
263 *                    E X T E R N A L   R E F E R E N C E S
264 ********************************************************************************
265 */
266
267 /*******************************************************************************
268 *                              C O N S T A N T S
269 ********************************************************************************
270 */
271
272 /*******************************************************************************
273 *                             D A T A   T Y P E S
274 ********************************************************************************
275 */
276 /* Message IDs */
277 typedef enum _ENUM_MSG_ID_T {
278     MID_MNY_CNM_CH_REQ,                 /* MANY notify CNM to obtain channel privilege */
279     MID_MNY_CNM_CH_ABORT,               /* MANY notify CNM to abort/release channel privilege */
280
281     MID_CNM_AIS_CH_GRANT,               /* CNM notify AIS for indicating channel granted */
282     MID_CNM_P2P_CH_GRANT,               /* CNM notify P2P for indicating channel granted */
283     MID_CNM_BOW_CH_GRANT,               /* CNM notify BOW for indicating channel granted */
284
285     /*--------------------------------------------------*/
286     /* SCN Module Mailbox Messages                      */
287     /*--------------------------------------------------*/
288     MID_AIS_SCN_SCAN_REQ,               /* AIS notify SCN for starting scan */
289     MID_AIS_SCN_SCAN_REQ_V2,            /* AIS notify SCN for starting scan with multiple SSID support */
290     MID_AIS_SCN_SCAN_CANCEL,            /* AIS notify SCN for cancelling scan */
291     MID_P2P_SCN_SCAN_REQ,               /* P2P notify SCN for starting scan */
292     MID_P2P_SCN_SCAN_REQ_V2,            /* P2P notify SCN for starting scan with multiple SSID support */
293     MID_P2P_SCN_SCAN_CANCEL,            /* P2P notify SCN for cancelling scan */
294     MID_BOW_SCN_SCAN_REQ,               /* BOW notify SCN for starting scan */
295     MID_BOW_SCN_SCAN_REQ_V2,            /* BOW notify SCN for starting scan with multiple SSID support */
296     MID_BOW_SCN_SCAN_CANCEL,            /* BOW notify SCN for cancelling scan */
297     MID_RLM_SCN_SCAN_REQ,               /* RLM notify SCN for starting scan (OBSS-SCAN) */
298     MID_RLM_SCN_SCAN_REQ_V2,            /* RLM notify SCN for starting scan (OBSS-SCAN) with multiple SSID support */
299     MID_RLM_SCN_SCAN_CANCEL,            /* RLM notify SCN for cancelling scan (OBSS-SCAN)*/
300     MID_SCN_AIS_SCAN_DONE,              /* SCN notify AIS for scan completion */
301     MID_SCN_P2P_SCAN_DONE,              /* SCN notify P2P for scan completion */
302     MID_SCN_BOW_SCAN_DONE,              /* SCN notify BOW for scan completion */
303     MID_SCN_RLM_SCAN_DONE,              /* SCN notify RLM for scan completion (OBSS-SCAN) */
304
305     /*--------------------------------------------------*/
306     /* AIS Module Mailbox Messages                      */
307     /*--------------------------------------------------*/
308     MID_OID_AIS_FSM_JOIN_REQ,           /* OID/IOCTL notify AIS for join */
309     MID_OID_AIS_FSM_ABORT,              /* OID/IOCTL notify AIS for abort */
310     MID_AIS_SAA_FSM_START,              /* AIS notify SAA for Starting authentication/association fsm */
311     MID_AIS_SAA_FSM_ABORT,              /* AIS notify SAA for Aborting authentication/association fsm */
312     MID_SAA_AIS_JOIN_COMPLETE,          /* SAA notify AIS for indicating join complete */
313
314 #if CFG_ENABLE_BT_OVER_WIFI
315     /*--------------------------------------------------*/
316     /* BOW Module Mailbox Messages                      */
317     /*--------------------------------------------------*/
318     MID_BOW_SAA_FSM_START,              /* BOW notify SAA for Starting authentication/association fsm */
319     MID_BOW_SAA_FSM_ABORT,              /* BOW notify SAA for Aborting authentication/association fsm */
320     MID_SAA_BOW_JOIN_COMPLETE,          /* SAA notify BOW for indicating join complete */
321 #endif
322
323 #if CFG_ENABLE_WIFI_DIRECT
324     /*--------------------------------------------------*/
325     /* P2P Module Mailbox Messages                      */
326     /*--------------------------------------------------*/
327     MID_P2P_SAA_FSM_START,              /* P2P notify SAA for Starting authentication/association fsm */
328     MID_P2P_SAA_FSM_ABORT,              /* P2P notify SAA for Aborting authentication/association fsm */
329     MID_SAA_P2P_JOIN_COMPLETE,          /* SAA notify P2P for indicating join complete */
330
331     MID_MNY_P2P_FUN_SWITCH,             /* Enable P2P FSM. */
332     MID_MNY_P2P_DEVICE_DISCOVERY,       /* Start device discovery. */
333     MID_MNY_P2P_DISCOVERY_ABORT,        /* Start device discovery abort. */
334     MID_MNY_P2P_CONNECTION_REQ,         /* Connection request. */
335     MID_MNY_P2P_CONNECTION_ABORT,       /* Abort connection request, P2P FSM return to IDLE. */
336     MID_MNY_P2P_CONNECTION_TRIGGER,     /* Only if connection request is valid. Trigger P2P FSM to connection target AP. */
337     MID_MNY_P2P_CONNECTION_PAUSE,       /* Disconnect from target AP, connection is not complete yet. */
338     MID_MNY_P2P_PROVISION_COMPLETE,     /* Provisioning complete. */
339     MID_MNY_P2P_INVITATION_REQ,
340     MID_MNY_P2P_INVITATION_ABORT,
341     MID_MNY_P2P_BEACON_UPDATE,
342     MID_MNY_P2P_BEACON_DEL,
343     MID_MNY_P2P_CHNL_REQ,
344     MID_MNY_P2P_CHNL_ABORT,
345     MID_MNY_P2P_MGMT_TX,
346     MID_MNY_P2P_GROUP_DISSOLVE,
347     MID_MNY_P2P_MGMT_FRAME_REGISTER,
348 #endif
349
350 #if CFG_SUPPORT_ADHOC
351     MID_SCN_AIS_FOUND_IBSS,             /* SCN notify AIS that an IBSS Peer has been found and can merge into */
352 #endif /* CFG_SUPPORT_ADHOC */
353
354     MID_SAA_AIS_FSM_ABORT,              /* SAA notify AIS for indicating deauthentication/disassociation */
355
356     MID_TOTAL_NUM
357 } ENUM_MSG_ID_T, *P_ENUM_MSG_ID_T;
358
359 /* Message header of inter-components */
360 struct _MSG_HDR_T {
361     LINK_ENTRY_T    rLinkEntry;
362     ENUM_MSG_ID_T   eMsgId;
363 };
364
365 typedef VOID (*PFN_MSG_HNDL_FUNC)(P_ADAPTER_T, P_MSG_HDR_T);
366
367 typedef struct _MSG_HNDL_ENTRY {
368     ENUM_MSG_ID_T       eMsgId;
369     PFN_MSG_HNDL_FUNC   pfMsgHndl;
370 } MSG_HNDL_ENTRY_T, *P_MSG_HNDL_ENTRY_T;
371
372 typedef enum _EUNM_MSG_SEND_METHOD_T {
373     MSG_SEND_METHOD_BUF = 0,    /* Message is put in the queue and will be
374                                    executed when mailbox is checked. */
375     MSG_SEND_METHOD_UNBUF       /* The handler function is called immediately
376                                    in the same context of the sender */
377 } EUNM_MSG_SEND_METHOD_T, *P_EUNM_MSG_SEND_METHOD_T;
378
379
380 typedef enum _ENUM_MBOX_ID_T {
381     MBOX_ID_0 = 0,
382     MBOX_ID_TOTAL_NUM
383 } ENUM_MBOX_ID_T, *P_ENUM_MBOX_ID_T;
384
385 /* Define Mailbox structure */
386 typedef struct _MBOX_T {
387     LINK_T          rLinkHead;
388 } MBOX_T, *P_MBOX_T;
389
390 typedef struct _MSG_SAA_FSM_START_T {
391     MSG_HDR_T       rMsgHdr;    /* Must be the first member */
392     UINT_8          ucSeqNum;
393     P_STA_RECORD_T  prStaRec;
394 } MSG_SAA_FSM_START_T, *P_MSG_SAA_FSM_START_T;
395
396 typedef struct _MSG_SAA_FSM_COMP_T {
397     MSG_HDR_T       rMsgHdr;        /* Must be the first member */
398     UINT_8          ucSeqNum;
399     WLAN_STATUS     rJoinStatus;
400     P_STA_RECORD_T  prStaRec;
401     P_SW_RFB_T      prSwRfb;
402 } MSG_SAA_FSM_COMP_T, *P_MSG_SAA_FSM_COMP_T;
403
404 typedef struct _MSG_SAA_FSM_ABORT_T {
405     MSG_HDR_T       rMsgHdr;    /* Must be the first member */
406     UINT_8          ucSeqNum;
407     P_STA_RECORD_T  prStaRec;
408 } MSG_SAA_FSM_ABORT_T, *P_MSG_SAA_FSM_ABORT_T;
409
410 typedef struct _MSG_CONNECTION_ABORT_T {
411     MSG_HDR_T       rMsgHdr;    /* Must be the first member */
412     UINT_8          ucNetTypeIndex;
413 } MSG_CONNECTION_ABORT_T, *P_MSG_CONNECTION_ABORT_T;
414
415
416
417 /* specific message data types */
418 typedef MSG_SAA_FSM_START_T MSG_JOIN_REQ_T, *P_MSG_JOIN_REQ_T;
419 typedef MSG_SAA_FSM_COMP_T MSG_JOIN_COMP_T, *P_MSG_JOIN_COMP_T;
420 typedef MSG_SAA_FSM_ABORT_T MSG_JOIN_ABORT_T, *P_MSG_JOIN_ABORT_T;
421
422
423 /*******************************************************************************
424 *                            P U B L I C   D A T A
425 ********************************************************************************
426 */
427
428 /*******************************************************************************
429 *                           P R I V A T E   D A T A
430 ********************************************************************************
431 */
432
433 /*******************************************************************************
434 *                                 M A C R O S
435 ********************************************************************************
436 */
437
438 /*******************************************************************************
439 *                  F U N C T I O N   D E C L A R A T I O N S
440 ********************************************************************************
441 */
442 VOID
443 mboxSetup (
444     IN P_ADAPTER_T  prAdapter,
445     IN ENUM_MBOX_ID_T  eMboxId
446     );
447
448
449 VOID
450 mboxSendMsg (
451     IN P_ADAPTER_T prAdapter,
452     IN ENUM_MBOX_ID_T eMboxId,
453     IN P_MSG_HDR_T prMsg,
454     IN EUNM_MSG_SEND_METHOD_T eMethod
455     );
456
457 VOID
458 mboxRcvAllMsg (
459     IN P_ADAPTER_T prAdapter,
460     IN ENUM_MBOX_ID_T eMboxId
461     );
462
463 VOID
464 mboxInitialize (
465     IN P_ADAPTER_T prAdapter
466     );
467
468 VOID
469 mboxDestroy (
470     IN P_ADAPTER_T prAdapter
471     );
472
473 VOID
474 mboxDummy (
475     IN P_ADAPTER_T prAdapter,
476     P_MSG_HDR_T prMsgHdr
477     );
478
479 /*******************************************************************************
480 *                              F U N C T I O N S
481 ********************************************************************************
482 */
483
484 #endif /* _HEM_MBOX_H */
485
486