2 * Header file describing the internal (inter-module) DHD interfaces.
4 * Provides type definitions and function prototypes used to link the
5 * DHD OS, bus, and protocol modules.
7 * Copyright (C) 1999-2018, Broadcom Corporation
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:
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.
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.
28 * <<Broadcom-WL-IPTag/Open:>>
30 * $Id: dhd_proto.h 727682 2017-10-23 04:45:57Z $
39 #include <dhd_flowring.h>
42 #define DEFAULT_IOCTL_RESP_TIMEOUT 4000
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 */
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 */
52 #define DEFAULT_D3_ACK_RESP_TIMEOUT 1000
53 #ifndef D3_ACK_RESP_TIMEOUT
54 #define D3_ACK_RESP_TIMEOUT DEFAULT_D3_ACK_RESP_TIMEOUT
55 #endif /* D3_ACK_RESP_TIMEOUT */
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 */
62 #define DS_EXIT_TIMEOUT 1000 /* In ms */
63 #define DS_ENTER_TIMEOUT 1000 /* In ms */
65 #define IOCTL_DISABLE_TIMEOUT 0
68 * Exported from the dhd protocol module (dhd_cdc, dhd_rndis)
71 /* Linkage, sets prot link and updates hdrlen in pub */
72 extern int dhd_prot_attach(dhd_pub_t
*dhdp
);
74 /* Initilizes the index block for dma'ing indices */
75 extern int dhd_prot_dma_indx_init(dhd_pub_t
*dhdp
, uint32 rw_index_sz
,
76 uint8 type
, uint32 length
);
78 /* Unlink, frees allocated protocol memory (including dhd_prot) */
79 extern void dhd_prot_detach(dhd_pub_t
*dhdp
);
81 /* Initialize protocol: sync w/dongle state.
82 * Sets dongle media info (iswl, drv_version, mac address).
84 extern int dhd_sync_with_dongle(dhd_pub_t
*dhdp
);
86 /* Protocol initialization needed for IOCTL/IOVAR path */
87 extern int dhd_prot_init(dhd_pub_t
*dhd
);
89 /* Stop protocol: sync w/dongle state. */
90 extern void dhd_prot_stop(dhd_pub_t
*dhdp
);
92 /* Add any protocol-specific data header.
93 * Caller must reserve prot_hdrlen prepend space.
95 extern void dhd_prot_hdrpush(dhd_pub_t
*, int ifidx
, void *txp
);
96 extern uint
dhd_prot_hdrlen(dhd_pub_t
*, void *txp
);
98 /* Remove any protocol-specific data header. */
99 extern int dhd_prot_hdrpull(dhd_pub_t
*, int *ifidx
, void *rxp
, uchar
*buf
, uint
*len
);
101 /* Use protocol to issue ioctl to dongle */
102 extern int dhd_prot_ioctl(dhd_pub_t
*dhd
, int ifidx
, wl_ioctl_t
* ioc
, void * buf
, int len
);
104 /* Handles a protocol control response asynchronously */
105 extern int dhd_prot_ctl_complete(dhd_pub_t
*dhd
);
107 /* Check for and handle local prot-specific iovar commands */
108 extern int dhd_prot_iovar_op(dhd_pub_t
*dhdp
, const char *name
,
109 void *params
, int plen
, void *arg
, int len
, bool set
);
111 /* Add prot dump output to a buffer */
112 extern void dhd_prot_dump(dhd_pub_t
*dhdp
, struct bcmstrbuf
*strbuf
);
114 /* Dump extended trap data */
115 extern int dhd_prot_dump_extended_trap(dhd_pub_t
*dhdp
, struct bcmstrbuf
*b
, bool raw
);
117 /* Update local copy of dongle statistics */
118 extern void dhd_prot_dstats(dhd_pub_t
*dhdp
);
120 extern int dhd_ioctl(dhd_pub_t
* dhd_pub
, dhd_ioctl_t
*ioc
, void * buf
, uint buflen
);
122 extern int dhd_preinit_ioctls(dhd_pub_t
*dhd
);
124 extern int dhd_process_pkt_reorder_info(dhd_pub_t
*dhd
, uchar
*reorder_info_buf
,
125 uint reorder_info_len
, void **pkt
, uint32
*free_buf_count
);
128 extern bool dhd_prot_process_msgbuf_txcpl(dhd_pub_t
*dhd
, uint bound
);
129 extern bool dhd_prot_process_msgbuf_rxcpl(dhd_pub_t
*dhd
, uint bound
);
130 extern bool dhd_prot_process_msgbuf_infocpl(dhd_pub_t
*dhd
, uint bound
);
131 extern int dhd_prot_process_ctrlbuf(dhd_pub_t
* dhd
);
132 extern int dhd_prot_process_trapbuf(dhd_pub_t
* dhd
);
133 extern bool dhd_prot_dtohsplit(dhd_pub_t
* dhd
);
134 extern int dhd_post_dummy_msg(dhd_pub_t
*dhd
);
135 extern int dhdmsgbuf_lpbk_req(dhd_pub_t
*dhd
, uint len
);
136 extern void dhd_prot_rx_dataoffset(dhd_pub_t
*dhd
, uint32 offset
);
137 extern int dhd_prot_txdata(dhd_pub_t
*dhd
, void *p
, uint8 ifidx
);
138 extern int dhdmsgbuf_dmaxfer_req(dhd_pub_t
*dhd
,
139 uint len
, uint srcdelay
, uint destdelay
, uint d11_lpbk
, uint core_num
);
140 extern dma_xfer_status_t
dhdmsgbuf_dmaxfer_status(dhd_pub_t
*dhd
);
142 extern void dhd_dma_buf_init(dhd_pub_t
*dhd
, void *dma_buf
,
143 void *va
, uint32 len
, dmaaddr_t pa
, void *dmah
, void *secdma
);
144 extern void dhd_prot_flowrings_pool_release(dhd_pub_t
*dhd
,
145 uint16 flowid
, void *msgbuf_ring
);
146 extern int dhd_prot_flow_ring_create(dhd_pub_t
*dhd
, flow_ring_node_t
*flow_ring_node
);
147 extern int dhd_post_tx_ring_item(dhd_pub_t
*dhd
, void *PKTBUF
, uint8 ifindex
);
148 extern int dhd_prot_flow_ring_delete(dhd_pub_t
*dhd
, flow_ring_node_t
*flow_ring_node
);
149 extern int dhd_prot_flow_ring_flush(dhd_pub_t
*dhd
, flow_ring_node_t
*flow_ring_node
);
150 extern int dhd_prot_ringupd_dump(dhd_pub_t
*dhd
, struct bcmstrbuf
*b
);
151 extern uint32
dhd_prot_metadata_dbg_set(dhd_pub_t
*dhd
, bool val
);
152 extern uint32
dhd_prot_metadata_dbg_get(dhd_pub_t
*dhd
);
153 extern uint32
dhd_prot_metadatalen_set(dhd_pub_t
*dhd
, uint32 val
, bool rx
);
154 extern uint32
dhd_prot_metadatalen_get(dhd_pub_t
*dhd
, bool rx
);
155 extern void dhd_prot_print_flow_ring(dhd_pub_t
*dhd
, void *msgbuf_flow_info
,
156 struct bcmstrbuf
*strbuf
, const char * fmt
);
157 extern void dhd_prot_print_info(dhd_pub_t
*dhd
, struct bcmstrbuf
*strbuf
);
158 extern void dhd_prot_update_txflowring(dhd_pub_t
*dhdp
, uint16 flow_id
, void *msgring_info
);
159 extern void dhd_prot_txdata_write_flush(dhd_pub_t
*dhd
, uint16 flow_id
, bool in_lock
);
160 extern uint32
dhd_prot_txp_threshold(dhd_pub_t
*dhd
, bool set
, uint32 val
);
161 extern void dhd_prot_reset(dhd_pub_t
*dhd
);
163 #ifdef IDLE_TX_FLOW_MGMT
164 extern int dhd_prot_flow_ring_batch_suspend_request(dhd_pub_t
*dhd
, uint16
*ringid
, uint16 count
);
165 extern int dhd_prot_flow_ring_resume(dhd_pub_t
*dhd
, flow_ring_node_t
*flow_ring_node
);
166 #endif /* IDLE_TX_FLOW_MGMT */
167 extern int dhd_prot_init_info_rings(dhd_pub_t
*dhd
);
172 extern void dhd_lb_tx_compl_handler(unsigned long data
);
173 extern void dhd_lb_rx_compl_handler(unsigned long data
);
174 extern void dhd_lb_rx_process_handler(unsigned long data
);
176 extern int dhd_prot_h2d_mbdata_send_ctrlmsg(dhd_pub_t
*dhd
, uint32 mb_data
);
179 extern int dhd_prot_send_host_timestamp(dhd_pub_t
*dhdp
, uchar
*tlv
, uint16 tlv_len
,
180 uint16 seq
, uint16 xt_id
);
181 extern bool dhd_prot_data_path_tx_timestamp_logging(dhd_pub_t
*dhd
, bool enable
, bool set
);
182 extern bool dhd_prot_data_path_rx_timestamp_logging(dhd_pub_t
*dhd
, bool enable
, bool set
);
184 #define dhd_prot_send_host_timestamp(a, b, c, d, e) 0
185 #define dhd_prot_data_path_tx_timestamp_logging(a, b, c) 0
186 #define dhd_prot_data_path_rx_timestamp_logging(a, b, c) 0
189 extern void dhd_prot_dma_indx_free(dhd_pub_t
*dhd
);
191 /********************************
192 * For version-string expansion *
195 #define DHD_PROTOCOL "bdc"
197 #define DHD_PROTOCOL "cdc"
199 #define DHD_PROTOCOL "unknown"
202 #endif /* _dhd_proto_h_ */