1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Definitions for ioctls to access DHD iovars. 4 * Based on wlioctl.h (for Broadcom 802.11abg driver). 5 * (Moves towards generic ioctls for BCM drivers/iovars.) 6 * 7 * Definitions subject to change without notice. 8 * 9 * Copyright (C) 1999-2019, Broadcom. 10 * 11 * Unless you and Broadcom execute a separate written software license 12 * agreement governing use of this software, this software is licensed to you 13 * under the terms of the GNU General Public License version 2 (the "GPL"), 14 * available at http://www.broadcom.com/licenses/GPLv2.php, with the 15 * following added to such license: 16 * 17 * As a special exception, the copyright holders of this software give you 18 * permission to link this software with independent modules, and to copy and 19 * distribute the resulting executable under terms of your choice, provided that 20 * you also meet, for each linked independent module, the terms and conditions of 21 * the license of that module. An independent module is a module which is not 22 * derived from this software. The special exception does not apply to any 23 * modifications of the software. 24 * 25 * Notwithstanding the above, under no circumstances may you combine this 26 * software in any way with any other Broadcom software provided under a license 27 * other than the GPL, without Broadcom's express prior written consent. 28 * 29 * 30 * <<Broadcom-WL-IPTag/Open:>> 31 * 32 * $Id: dhdioctl.h 800512 2019-01-22 09:31:01Z $ 33 */ 34 35 #ifndef _dhdioctl_h_ 36 #define _dhdioctl_h_ 37 38 #include <typedefs.h> 39 40 /* Linux network driver ioctl encoding */ 41 typedef struct dhd_ioctl { 42 uint32 cmd; /* common ioctl definition */ 43 void *buf; /* pointer to user buffer */ 44 uint32 len; /* length of user buffer */ 45 uint32 set; /* get or set request boolean (optional) */ 46 uint32 used; /* bytes read or written (optional) */ 47 uint32 needed; /* bytes needed (optional) */ 48 uint32 driver; /* to identify target driver */ 49 } dhd_ioctl_t; 50 51 /* Underlying BUS definition */ 52 enum { 53 BUS_TYPE_USB = 0, /* for USB dongles */ 54 BUS_TYPE_SDIO, /* for SDIO dongles */ 55 BUS_TYPE_PCIE /* for PCIE dongles */ 56 }; 57 58 typedef enum { 59 DMA_XFER_SUCCESS = 0, 60 DMA_XFER_IN_PROGRESS, 61 DMA_XFER_FAILED 62 } dma_xfer_status_t; 63 64 typedef enum d11_lpbk_type { 65 M2M_DMA_LPBK = 0, 66 D11_LPBK = 1, 67 BMC_LPBK = 2, 68 M2M_NON_DMA_LPBK = 3, 69 D11_HOST_MEM_LPBK = 4, 70 BMC_HOST_MEM_LPBK = 5, 71 MAX_LPBK = 6 72 } dma_xfer_type_t; 73 74 typedef struct dmaxfer_info { 75 uint16 version; 76 uint16 length; 77 dma_xfer_status_t status; 78 dma_xfer_type_t type; 79 uint src_delay; 80 uint dest_delay; 81 uint should_wait; 82 uint core_num; 83 int error_code; 84 uint32 num_bytes; 85 uint64 time_taken; 86 uint64 tput; 87 } dma_xfer_info_t; 88 89 #define DHD_DMAXFER_VERSION 0x1 90 91 typedef struct tput_test { 92 uint16 version; 93 uint16 length; 94 uint8 direction; 95 uint8 tput_test_running; 96 uint8 mac_sta[6]; 97 uint8 mac_ap[6]; 98 uint8 PAD[2]; 99 uint32 payload_size; 100 uint32 num_pkts; 101 uint32 timeout_ms; 102 uint32 flags; 103 104 uint32 pkts_good; 105 uint32 pkts_bad; 106 uint32 pkts_cmpl; 107 uint64 time_ms; 108 uint64 tput_bps; 109 } tput_test_t; 110 111 typedef enum { 112 TPUT_DIR_TX = 0, 113 TPUT_DIR_RX 114 } tput_dir_t; 115 116 #define TPUT_TEST_T_VER 1 117 #define TPUT_TEST_T_LEN 68 118 #define TPUT_TEST_MIN_PAYLOAD_SIZE 16 119 #define TPUT_TEST_USE_ETHERNET_HDR 0x1 120 #define TPUT_TEST_USE_802_11_HDR 0x2 121 122 /* per-driver magic numbers */ 123 #define DHD_IOCTL_MAGIC 0x00444944 124 125 /* bump this number if you change the ioctl interface */ 126 #define DHD_IOCTL_VERSION 1 127 128 /* 129 * Increase the DHD_IOCTL_MAXLEN to 16K for supporting download of NVRAM files of size 130 * > 8K. In the existing implementation when NVRAM is to be downloaded via the "vars" 131 * DHD IOVAR, the NVRAM is copied to the DHD Driver memory. Later on when "dwnldstate" is 132 * invoked with FALSE option, the NVRAM gets copied from the DHD driver to the Dongle 133 * memory. The simple way to support this feature without modifying the DHD application, 134 * driver logic is to increase the DHD_IOCTL_MAXLEN size. This macro defines the "size" 135 * of the buffer in which data is exchanged between the DHD App and DHD driver. 136 */ 137 #define DHD_IOCTL_MAXLEN (16384) /* max length ioctl buffer required */ 138 #define DHD_IOCTL_SMLEN 256 /* "small" length ioctl buffer required */ 139 140 /* common ioctl definitions */ 141 #define DHD_GET_MAGIC 0 142 #define DHD_GET_VERSION 1 143 #define DHD_GET_VAR 2 144 #define DHD_SET_VAR 3 145 146 /* message levels */ 147 #define DHD_ERROR_VAL 0x0001 148 #define DHD_TRACE_VAL 0x0002 149 #define DHD_INFO_VAL 0x0004 150 #define DHD_DATA_VAL 0x0008 151 #define DHD_CTL_VAL 0x0010 152 #define DHD_TIMER_VAL 0x0020 153 #define DHD_HDRS_VAL 0x0040 154 #define DHD_BYTES_VAL 0x0080 155 #define DHD_INTR_VAL 0x0100 156 #define DHD_LOG_VAL 0x0200 157 #define DHD_GLOM_VAL 0x0400 158 #define DHD_EVENT_VAL 0x0800 159 #define DHD_BTA_VAL 0x1000 160 #define DHD_ISCAN_VAL 0x2000 161 #define DHD_ARPOE_VAL 0x4000 162 #define DHD_REORDER_VAL 0x8000 163 #define DHD_NOCHECKDIED_VAL 0x20000 /* UTF WAR */ 164 #define DHD_PNO_VAL 0x80000 165 #define DHD_RTT_VAL 0x100000 166 #define DHD_MSGTRACE_VAL 0x200000 167 #define DHD_FWLOG_VAL 0x400000 168 #define DHD_DBGIF_VAL 0x800000 169 #ifdef DHD_PCIE_NATIVE_RUNTIMEPM 170 #define DHD_RPM_VAL 0x1000000 171 #endif /* DHD_PCIE_NATIVE_RUNTIMEPM */ 172 #define DHD_PKT_MON_VAL 0x2000000 173 #define DHD_PKT_MON_DUMP_VAL 0x4000000 174 #define DHD_ERROR_MEM_VAL 0x8000000 175 #define DHD_DNGL_IOVAR_SET_VAL 0x10000000 /**< logs the setting of dongle iovars */ 176 #define DHD_LPBKDTDUMP_VAL 0x20000000 177 #define DHD_PRSRV_MEM_VAL 0x40000000 178 #define DHD_IOVAR_MEM_VAL 0x80000000 179 #define DHD_ANDROID_VAL 0x10000 180 #define DHD_IW_VAL 0x20000 181 #define DHD_CFG_VAL 0x40000 182 #define DHD_CONFIG_VAL 0x80000 183 #define DHD_DUMP_VAL 0x100000 184 #define DUMP_EAPOL_VAL 0x0001 185 #define DUMP_ARP_VAL 0x0002 186 #define DUMP_DHCP_VAL 0x0004 187 #define DUMP_ICMP_VAL 0x0008 188 #define DUMP_DNS_VAL 0x0010 189 #define DUMP_TRX_VAL 0x0080 190 191 #ifdef SDTEST 192 /* For pktgen iovar */ 193 typedef struct dhd_pktgen { 194 uint32 version; /* To allow structure change tracking */ 195 uint32 freq; /* Max ticks between tx/rx attempts */ 196 uint32 count; /* Test packets to send/rcv each attempt */ 197 uint32 print; /* Print counts every <print> attempts */ 198 uint32 total; /* Total packets (or bursts) */ 199 uint32 minlen; /* Minimum length of packets to send */ 200 uint32 maxlen; /* Maximum length of packets to send */ 201 uint32 numsent; /* Count of test packets sent */ 202 uint32 numrcvd; /* Count of test packets received */ 203 uint32 numfail; /* Count of test send failures */ 204 uint32 mode; /* Test mode (type of test packets) */ 205 uint32 stop; /* Stop after this many tx failures */ 206 } dhd_pktgen_t; 207 208 /* Version in case structure changes */ 209 #define DHD_PKTGEN_VERSION 2 210 211 /* Type of test packets to use */ 212 #define DHD_PKTGEN_ECHO 1 /* Send echo requests */ 213 #define DHD_PKTGEN_SEND 2 /* Send discard packets */ 214 #define DHD_PKTGEN_RXBURST 3 /* Request dongle send N packets */ 215 #define DHD_PKTGEN_RECV 4 /* Continuous rx from continuous tx dongle */ 216 #endif /* SDTEST */ 217 218 /* Enter idle immediately (no timeout) */ 219 #define DHD_IDLE_IMMEDIATE (-1) 220 221 /* Values for idleclock iovar: other values are the sd_divisor to use when idle */ 222 #define DHD_IDLE_ACTIVE 0 /* Do not request any SD clock change when idle */ 223 #define DHD_IDLE_STOP (-1) /* Request SD clock be stopped (and use SD1 mode) */ 224 225 enum dhd_maclist_xtlv_type { 226 DHD_MACLIST_XTLV_R = 0x1, 227 DHD_MACLIST_XTLV_X = 0x2, 228 DHD_SVMPLIST_XTLV = 0x3 229 }; 230 231 typedef struct _dhd_maclist_t { 232 uint16 version; /* Version */ 233 uint16 bytes_len; /* Total bytes length of lists, XTLV headers and paddings */ 234 uint8 plist[1]; /* Pointer to the first list */ 235 } dhd_maclist_t; 236 237 typedef struct _dhd_pd11regs_param { 238 uint16 start_idx; 239 uint8 verbose; 240 uint8 pad; 241 uint8 plist[1]; 242 } dhd_pd11regs_param; 243 244 typedef struct _dhd_pd11regs_buf { 245 uint16 idx; 246 uint8 pad[2]; 247 uint8 pbuf[1]; 248 } dhd_pd11regs_buf; 249 250 /* BT logging and memory dump */ 251 252 #define BT_LOG_BUF_MAX_SIZE (DHD_IOCTL_MAXLEN - (2 * sizeof(int))) 253 #define BT_LOG_BUF_NOT_AVAILABLE 0 254 #define BT_LOG_NEXT_BUF_NOT_AVAIL 1 255 #define BT_LOG_NEXT_BUF_AVAIL 2 256 #define BT_LOG_NOT_READY 3 257 258 typedef struct bt_log_buf_info { 259 int availability; 260 int size; 261 char buf[BT_LOG_BUF_MAX_SIZE]; 262 } bt_log_buf_info_t; 263 264 /* request BT memory in chunks */ 265 typedef struct bt_mem_req { 266 int offset; /* offset from BT memory start */ 267 int buf_size; /* buffer size per chunk */ 268 } bt_mem_req_t; 269 270 /* max dest supported */ 271 #define DEBUG_BUF_DEST_MAX 4 272 273 /* debug buf dest stat */ 274 typedef struct debug_buf_dest_stat { 275 uint32 stat[DEBUG_BUF_DEST_MAX]; 276 } debug_buf_dest_stat_t; 277 278 #endif /* _dhdioctl_h_ */ 279