Merge tag 'lsk-v4.4-16.06-android'
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rkwifi / bcmdhd / dhd_proto.h
1 /*
2  * Header file describing the internal (inter-module) DHD interfaces.
3  *
4  * Provides type definitions and function prototypes used to link the
5  * DHD OS, bus, and protocol modules.
6  *
7  * Copyright (C) 1999-2016, Broadcom Corporation
8  * 
9  *      Unless you and Broadcom execute a separate written software license
10  * agreement governing use of this software, this software is licensed to you
11  * under the terms of the GNU General Public License version 2 (the "GPL"),
12  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
13  * following added to such license:
14  * 
15  *      As a special exception, the copyright holders of this software give you
16  * permission to link this software with independent modules, and to copy and
17  * distribute the resulting executable under terms of your choice, provided that
18  * you also meet, for each linked independent module, the terms and conditions of
19  * the license of that module.  An independent module is a module which is not
20  * derived from this software.  The special exception does not apply to any
21  * modifications of the software.
22  * 
23  *      Notwithstanding the above, under no circumstances may you combine this
24  * software in any way with any other Broadcom software provided under a license
25  * other than the GPL, without Broadcom's express prior written consent.
26  *
27  *
28  * <<Broadcom-WL-IPTag/Open:>>
29  *
30  * $Id: dhd_proto.h 604483 2015-12-07 14:47:36Z $
31  */
32
33 #ifndef _dhd_proto_h_
34 #define _dhd_proto_h_
35
36 #include <dhdioctl.h>
37 #include <wlioctl.h>
38 #ifdef BCMPCIE
39 #include <dhd_flowring.h>
40 #endif
41
42 #define DEFAULT_IOCTL_RESP_TIMEOUT      2000
43 #ifndef IOCTL_RESP_TIMEOUT
44 /* In milli second default value for Production FW */
45 #define IOCTL_RESP_TIMEOUT  DEFAULT_IOCTL_RESP_TIMEOUT
46 #endif /* IOCTL_RESP_TIMEOUT */
47
48 #ifndef MFG_IOCTL_RESP_TIMEOUT
49 #define MFG_IOCTL_RESP_TIMEOUT  20000  /* In milli second default value for MFG FW */
50 #endif /* MFG_IOCTL_RESP_TIMEOUT */
51
52 #define DEFAULT_D3_ACK_RESP_TIMEOUT     4000
53 #ifndef D3_ACK_RESP_TIMEOUT
54 #define D3_ACK_RESP_TIMEOUT             DEFAULT_D3_ACK_RESP_TIMEOUT
55 #endif /* D3_ACK_RESP_TIMEOUT */
56
57 #define DEFAULT_DHD_BUS_BUSY_TIMEOUT    (IOCTL_RESP_TIMEOUT + 1000)
58 #ifndef DHD_BUS_BUSY_TIMEOUT
59 #define DHD_BUS_BUSY_TIMEOUT    DEFAULT_DHD_BUS_BUSY_TIMEOUT
60 #endif /* DEFAULT_DHD_BUS_BUSY_TIMEOUT */
61
62 #define IOCTL_DISABLE_TIMEOUT 0
63 /*
64  * Exported from the dhd protocol module (dhd_cdc, dhd_rndis)
65  */
66
67 /* Linkage, sets prot link and updates hdrlen in pub */
68 extern int dhd_prot_attach(dhd_pub_t *dhdp);
69
70 /* Initilizes the index block for dma'ing indices */
71 extern int dhd_prot_dma_indx_init(dhd_pub_t *dhdp, uint32 rw_index_sz,
72         uint8 type, uint32 length);
73
74 /* Unlink, frees allocated protocol memory (including dhd_prot) */
75 extern void dhd_prot_detach(dhd_pub_t *dhdp);
76
77 /* Initialize protocol: sync w/dongle state.
78  * Sets dongle media info (iswl, drv_version, mac address).
79  */
80 extern int dhd_sync_with_dongle(dhd_pub_t *dhdp);
81
82 /* Protocol initialization needed for IOCTL/IOVAR path */
83 extern int dhd_prot_init(dhd_pub_t *dhd);
84
85 /* Stop protocol: sync w/dongle state. */
86 extern void dhd_prot_stop(dhd_pub_t *dhdp);
87
88 /* Add any protocol-specific data header.
89  * Caller must reserve prot_hdrlen prepend space.
90  */
91 extern void dhd_prot_hdrpush(dhd_pub_t *, int ifidx, void *txp);
92 extern uint dhd_prot_hdrlen(dhd_pub_t *, void *txp);
93
94 /* Remove any protocol-specific data header. */
95 extern int dhd_prot_hdrpull(dhd_pub_t *, int *ifidx, void *rxp, uchar *buf, uint *len);
96
97 /* Use protocol to issue ioctl to dongle */
98 extern int dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t * ioc, void * buf, int len);
99
100 /* Handles a protocol control response asynchronously */
101 extern int dhd_prot_ctl_complete(dhd_pub_t *dhd);
102
103 /* Check for and handle local prot-specific iovar commands */
104 extern int dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name,
105                              void *params, int plen, void *arg, int len, bool set);
106
107 /* Add prot dump output to a buffer */
108 extern void dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf);
109
110 /* Update local copy of dongle statistics */
111 extern void dhd_prot_dstats(dhd_pub_t *dhdp);
112
113 extern int dhd_ioctl(dhd_pub_t * dhd_pub, dhd_ioctl_t *ioc, void * buf, uint buflen);
114
115 extern int dhd_preinit_ioctls(dhd_pub_t *dhd);
116
117 extern int dhd_process_pkt_reorder_info(dhd_pub_t *dhd, uchar *reorder_info_buf,
118         uint reorder_info_len, void **pkt, uint32 *free_buf_count);
119
120 #ifdef BCMPCIE
121 extern bool dhd_prot_process_msgbuf_txcpl(dhd_pub_t *dhd, uint bound);
122 extern bool dhd_prot_process_msgbuf_rxcpl(dhd_pub_t *dhd, uint bound);
123 extern int dhd_prot_process_ctrlbuf(dhd_pub_t * dhd);
124 extern bool dhd_prot_dtohsplit(dhd_pub_t * dhd);
125 extern int dhd_post_dummy_msg(dhd_pub_t *dhd);
126 extern int dhdmsgbuf_lpbk_req(dhd_pub_t *dhd, uint len);
127 extern void dhd_prot_rx_dataoffset(dhd_pub_t *dhd, uint32 offset);
128 extern int dhd_prot_txdata(dhd_pub_t *dhd, void *p, uint8 ifidx);
129 extern int dhdmsgbuf_dmaxfer_req(dhd_pub_t *dhd, uint len, uint srcdelay, uint destdelay);
130
131 extern void dhd_dma_buf_init(dhd_pub_t *dhd, void *dma_buf,
132         void *va, uint32 len, dmaaddr_t pa, void *dmah, void *secdma);
133 extern void dhd_prot_flowrings_pool_release(dhd_pub_t *dhd,
134         uint16 flowid, void *msgbuf_ring);
135 extern int dhd_prot_flow_ring_create(dhd_pub_t *dhd, flow_ring_node_t *flow_ring_node);
136 extern int dhd_post_tx_ring_item(dhd_pub_t *dhd, void *PKTBUF, uint8 ifindex);
137 extern int dhd_prot_flow_ring_delete(dhd_pub_t *dhd, flow_ring_node_t *flow_ring_node);
138 extern int dhd_prot_flow_ring_flush(dhd_pub_t *dhd, flow_ring_node_t *flow_ring_node);
139 extern int dhd_prot_ringupd_dump(dhd_pub_t *dhd, struct bcmstrbuf *b);
140 extern uint32 dhd_prot_metadata_dbg_set(dhd_pub_t *dhd, bool val);
141 extern uint32 dhd_prot_metadata_dbg_get(dhd_pub_t *dhd);
142 extern uint32 dhd_prot_metadatalen_set(dhd_pub_t *dhd, uint32 val, bool rx);
143 extern uint32 dhd_prot_metadatalen_get(dhd_pub_t *dhd, bool rx);
144 extern void dhd_prot_print_flow_ring(dhd_pub_t *dhd, void *msgbuf_flow_info,
145         struct bcmstrbuf *strbuf, const char * fmt);
146 extern void dhd_prot_print_info(dhd_pub_t *dhd, struct bcmstrbuf *strbuf);
147 extern void dhd_prot_update_txflowring(dhd_pub_t *dhdp, uint16 flow_id, void *msgring_info);
148 extern void dhd_prot_txdata_write_flush(dhd_pub_t *dhd, uint16 flow_id, bool in_lock);
149 extern uint32 dhd_prot_txp_threshold(dhd_pub_t *dhd, bool set, uint32 val);
150 extern void dhd_prot_reset(dhd_pub_t *dhd);
151 #ifdef DHD_LB
152 extern void dhd_lb_tx_compl_handler(unsigned long data);
153 extern void dhd_lb_rx_compl_handler(unsigned long data);
154 extern void dhd_lb_rx_process_handler(unsigned long data);
155 #endif /* DHD_LB */
156 void dhd_prot_collect_memdump(dhd_pub_t *dhd);
157 #endif /* BCMPCIE */
158 /********************************
159  * For version-string expansion *
160  */
161 #if defined(BDC)
162 #define DHD_PROTOCOL "bdc"
163 #elif defined(CDC)
164 #define DHD_PROTOCOL "cdc"
165 #else
166 #define DHD_PROTOCOL "unknown"
167 #endif /* proto */
168
169 #endif /* _dhd_proto_h_ */