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-2017, 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 678890 2017-01-11 11:48: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 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 */ 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 1000 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 DS_EXIT_TIMEOUT 1000 /* In ms */ 63 #define DS_ENTER_TIMEOUT 1000 /* In ms */ 64 65 #define IOCTL_DISABLE_TIMEOUT 0 66 67 /* 68 * Exported from the dhd protocol module (dhd_cdc, dhd_rndis) 69 */ 70 71 /* Linkage, sets prot link and updates hdrlen in pub */ 72 extern int dhd_prot_attach(dhd_pub_t *dhdp); 73 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); 77 78 /* Unlink, frees allocated protocol memory (including dhd_prot) */ 79 extern void dhd_prot_detach(dhd_pub_t *dhdp); 80 81 /* Initialize protocol: sync w/dongle state. 82 * Sets dongle media info (iswl, drv_version, mac address). 83 */ 84 extern int dhd_sync_with_dongle(dhd_pub_t *dhdp); 85 86 /* Protocol initialization needed for IOCTL/IOVAR path */ 87 extern int dhd_prot_init(dhd_pub_t *dhd); 88 89 /* Stop protocol: sync w/dongle state. */ 90 extern void dhd_prot_stop(dhd_pub_t *dhdp); 91 92 /* Add any protocol-specific data header. 93 * Caller must reserve prot_hdrlen prepend space. 94 */ 95 extern void dhd_prot_hdrpush(dhd_pub_t *, int ifidx, void *txp); 96 extern uint dhd_prot_hdrlen(dhd_pub_t *, void *txp); 97 98 /* Remove any protocol-specific data header. */ 99 extern int dhd_prot_hdrpull(dhd_pub_t *, int *ifidx, void *rxp, uchar *buf, uint *len); 100 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); 103 104 /* Handles a protocol control response asynchronously */ 105 extern int dhd_prot_ctl_complete(dhd_pub_t *dhd); 106 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); 110 111 /* Add prot dump output to a buffer */ 112 extern void dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf); 113 114 /* Dump extended trap data */ 115 extern int dhd_prot_dump_extended_trap(dhd_pub_t *dhdp, struct bcmstrbuf *b, bool raw); 116 117 /* Update local copy of dongle statistics */ 118 extern void dhd_prot_dstats(dhd_pub_t *dhdp); 119 120 extern int dhd_ioctl(dhd_pub_t * dhd_pub, dhd_ioctl_t *ioc, void * buf, uint buflen); 121 122 extern int dhd_preinit_ioctls(dhd_pub_t *dhd); 123 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); 126 127 #ifdef BCMPCIE 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); 140 141 extern void dhd_dma_buf_init(dhd_pub_t *dhd, void *dma_buf, 142 void *va, uint32 len, dmaaddr_t pa, void *dmah, void *secdma); 143 extern void dhd_prot_flowrings_pool_release(dhd_pub_t *dhd, 144 uint16 flowid, void *msgbuf_ring); 145 extern int dhd_prot_flow_ring_create(dhd_pub_t *dhd, flow_ring_node_t *flow_ring_node); 146 extern int dhd_post_tx_ring_item(dhd_pub_t *dhd, void *PKTBUF, uint8 ifindex); 147 extern int dhd_prot_flow_ring_delete(dhd_pub_t *dhd, flow_ring_node_t *flow_ring_node); 148 extern int dhd_prot_flow_ring_flush(dhd_pub_t *dhd, flow_ring_node_t *flow_ring_node); 149 extern int dhd_prot_ringupd_dump(dhd_pub_t *dhd, struct bcmstrbuf *b); 150 extern uint32 dhd_prot_metadata_dbg_set(dhd_pub_t *dhd, bool val); 151 extern uint32 dhd_prot_metadata_dbg_get(dhd_pub_t *dhd); 152 extern uint32 dhd_prot_metadatalen_set(dhd_pub_t *dhd, uint32 val, bool rx); 153 extern uint32 dhd_prot_metadatalen_get(dhd_pub_t *dhd, bool rx); 154 extern void dhd_prot_print_flow_ring(dhd_pub_t *dhd, void *msgbuf_flow_info, 155 struct bcmstrbuf *strbuf, const char * fmt); 156 extern void dhd_prot_print_info(dhd_pub_t *dhd, struct bcmstrbuf *strbuf); 157 extern void dhd_prot_update_txflowring(dhd_pub_t *dhdp, uint16 flow_id, void *msgring_info); 158 extern void dhd_prot_txdata_write_flush(dhd_pub_t *dhd, uint16 flow_id, bool in_lock); 159 extern uint32 dhd_prot_txp_threshold(dhd_pub_t *dhd, bool set, uint32 val); 160 extern void dhd_prot_reset(dhd_pub_t *dhd); 161 162 #ifdef IDLE_TX_FLOW_MGMT 163 extern int dhd_prot_flow_ring_batch_suspend_request(dhd_pub_t *dhd, uint16 *ringid, uint16 count); 164 extern int dhd_prot_flow_ring_resume(dhd_pub_t *dhd, flow_ring_node_t *flow_ring_node); 165 #endif /* IDLE_TX_FLOW_MGMT */ 166 extern int dhd_prot_init_info_rings(dhd_pub_t *dhd); 167 168 #endif /* BCMPCIE */ 169 170 #ifdef DHD_LB 171 extern void dhd_lb_tx_compl_handler(unsigned long data); 172 extern void dhd_lb_rx_compl_handler(unsigned long data); 173 extern void dhd_lb_rx_process_handler(unsigned long data); 174 #endif /* DHD_LB */ 175 extern int dhd_prot_h2d_mbdata_send_ctrlmsg(dhd_pub_t *dhd, uint32 mb_data); 176 177 #ifdef BCMPCIE 178 extern int dhd_prot_send_host_timestamp(dhd_pub_t *dhdp, uchar *tlv, uint16 tlv_len, 179 uint16 seq, uint16 xt_id); 180 extern bool dhd_prot_data_path_tx_timestamp_logging(dhd_pub_t *dhd, bool enable, bool set); 181 extern bool dhd_prot_data_path_rx_timestamp_logging(dhd_pub_t *dhd, bool enable, bool set); 182 #else /* BCMPCIE */ 183 #define dhd_prot_send_host_timestamp(a, b, c, d, e) 0 184 #define dhd_prot_data_path_tx_timestamp_logging(a, b, c) 0 185 #define dhd_prot_data_path_rx_timestamp_logging(a, b, c) 0 186 #endif /* BCMPCIE */ 187 188 extern void dhd_prot_dma_indx_free(dhd_pub_t *dhd); 189 190 /******************************** 191 * For version-string expansion * 192 */ 193 #if defined(BDC) 194 #define DHD_PROTOCOL "bdc" 195 #elif defined(CDC) 196 #define DHD_PROTOCOL "cdc" 197 #else 198 #define DHD_PROTOCOL "unknown" 199 #endif /* proto */ 200 201 #endif /* _dhd_proto_h_ */ 202