dhdioctl.h 8.3 KB

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