wmi.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. /*
  2. * Copyright (c) 2010-2017 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. /*
  27. * This file contains the definitions of the WMI protocol specified in the
  28. * Wireless Module Interface (WMI). It includes definitions of all the
  29. * commands and events. Commands are messages from the host to the WM.
  30. * Events and Replies are messages from the WM to the host.
  31. *
  32. * Ownership of correctness in regards to commands
  33. * belongs to the host driver and the WMI is not required to validate
  34. * parameters for value, proper range, or any other checking.
  35. *
  36. */
  37. #ifndef _WMI_H_
  38. #define _WMI_H_
  39. #include "wlan_defs.h"
  40. #include "wmix.h"
  41. #include "wmi_unified.h"
  42. #include "wmi_tlv_helper.h"
  43. #include "wmi_tlv_defs.h"
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. #define HTC_PROTOCOL_VERSION 0x0002
  48. #define WMI_PROTOCOL_VERSION 0x0002
  49. #define WMI_MODE_MAX 8
  50. #define WMI_MAX_RATE_MASK 6
  51. PREPACK struct host_app_area_s {
  52. A_UINT32 wmi_protocol_ver;
  53. } POSTPACK;
  54. #undef MS
  55. #define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB)
  56. #undef SM
  57. #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
  58. #undef WO
  59. #define WO(_f) ((_f##_OFFSET) >> 2)
  60. #undef GET_FIELD
  61. #define GET_FIELD(_addr, _f) MS(*((A_UINT32 *)(_addr) + WO(_f)), _f)
  62. #undef SET_FIELD
  63. #define SET_FIELD(_addr, _f, _val) \
  64. (*((A_UINT32 *)(_addr) + WO(_f)) = \
  65. (*((A_UINT32 *)(_addr) + WO(_f)) & ~_f##_MASK) | SM(_val, _f))
  66. #define WMI_GET_FIELD(_msg_buf, _msg_type, _f) \
  67. GET_FIELD(_msg_buf, _msg_type ## _ ## _f)
  68. #define WMI_SET_FIELD(_msg_buf, _msg_type, _f, _val) \
  69. SET_FIELD(_msg_buf, _msg_type ## _ ## _f, _val)
  70. #define WMI_EP_APASS WMI_EP_APSS /* TYPO: leave incorrect name as an alias for the correct name */
  71. #define WMI_EP_APSS 0x0 /* WLAN driver running on apps processor sub-system */
  72. #define WMI_EP_LPASS 0x1
  73. #define WMI_EP_SENSOR 0x2
  74. #define WMI_EP_NANOHUB 0x3 /* WLAN driver running on NANO Hub */
  75. #define WMI_EP_MODEM 0x4
  76. #define WMI_EP_LOCATION 0x5
  77. /*
  78. * Control Path
  79. */
  80. typedef PREPACK struct {
  81. A_UINT32 commandId : 24,
  82. reserved : 2, /* used for WMI endpoint ID */
  83. plt_priv : 6; /* platform private */
  84. } POSTPACK WMI_CMD_HDR; /* used for commands and events */
  85. #define WMI_CMD_HDR_COMMANDID_LSB 0
  86. #define WMI_CMD_HDR_COMMANDID_MASK 0x00ffffff
  87. #define WMI_CMD_HDR_COMMANDID_OFFSET 0x00000000
  88. #define WMI_CMD_HDR_WMI_ENDPOINTID_MASK 0x03000000
  89. #define WMI_CMD_HDR_WMI_ENDPOINTID_OFFSET 24
  90. #define WMI_CMD_HDR_PLT_PRIV_LSB 24
  91. #define WMI_CMD_HDR_PLT_PRIV_MASK 0xff000000
  92. #define WMI_CMD_HDR_PLT_PRIV_OFFSET 0x00000000
  93. /*
  94. * List of Commnands
  95. */
  96. typedef enum {
  97. WMI_EXTENSION_CMDID, //used in wmi_svc.c /* Non-wireless extensions */
  98. WMI_IGNORE_CMDID, //used in wlan_wmi.c
  99. } WMI_COMMAND_ID;
  100. typedef enum {
  101. NONE_CRYPT = 0x01,
  102. WEP_CRYPT = 0x02,
  103. TKIP_CRYPT = 0x04,
  104. AES_CRYPT = 0x08,
  105. #ifdef WAPI_ENABLE
  106. WAPI_CRYPT = 0x10,
  107. #endif /*WAPI_ENABLE*/
  108. } CRYPTO_TYPE;
  109. #define WMI_MAX_SSID_LEN 32
  110. /*
  111. * WMI_SET_PMK_CMDID
  112. */
  113. #define WMI_PMK_LEN 32
  114. /*
  115. * WMI_ADD_CIPHER_KEY_CMDID
  116. */
  117. typedef enum {
  118. PAIRWISE_USAGE = 0x00,
  119. GROUP_USAGE = 0x01,
  120. TX_USAGE = 0x02, /* default Tx Key - Static WEP only */
  121. PMK_USAGE = 0x04, /* PMK cache */
  122. } KEY_USAGE;
  123. /*
  124. * List of Events (target to host)
  125. */
  126. typedef enum {
  127. WMI_EXTENSION_EVENTID //wmi_profhook.c and umac_wmi_events.c
  128. } WMI_EVENT_ID;
  129. typedef enum {
  130. WMI_11A_CAPABILITY = 1,
  131. WMI_11G_CAPABILITY = 2,
  132. WMI_11AG_CAPABILITY = 3,
  133. WMI_11NA_CAPABILITY = 4,
  134. WMI_11NG_CAPABILITY = 5,
  135. WMI_11NAG_CAPABILITY = 6,
  136. WMI_11AC_CAPABILITY = 7,
  137. WMI_11AX_CAPABILITY = 8,
  138. // END CAPABILITY
  139. WMI_11N_CAPABILITY_OFFSET = (WMI_11NA_CAPABILITY - WMI_11A_CAPABILITY),
  140. } WMI_PHY_CAPABILITY;
  141. /* Deprectated, need clean up */
  142. #define WMI_MAX_RX_META_SZ (12)
  143. typedef PREPACK struct {
  144. A_INT8 rssi;
  145. A_UINT8 info; /* usage of 'info' field(8-bit):
  146. * b1:b0 - WMI_MSG_TYPE
  147. * b4:b3:b2 - UP(tid)
  148. * b5 - Used in AP mode. More-data in tx dir, PS in rx.
  149. * b7:b6 - Dot3 header(0),
  150. * Dot11 Header(1),
  151. * ACL data(2)
  152. */
  153. A_UINT16 info2; /* usage of 'info2' field(16-bit):
  154. * b11:b0 - seq_no
  155. * b12 - A-MSDU?
  156. * b15:b13 - META_DATA_VERSION 0 - 7
  157. */
  158. A_UINT16 info3; /* b3:b2:b1:b0 - device id
  159. * b4 - Used in AP mode. uAPSD trigger in rx, EOSP in tx
  160. * b7:b5 - unused?
  161. * b15:b8 - pad before data start(irrespective of meta version)
  162. */
  163. } POSTPACK WMI_DATA_HDR;
  164. #ifdef __cplusplus
  165. }
  166. #endif
  167. #endif /* _WMI_H_ */