wmi.h 6.4 KB

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