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 /* 24 * This file was originally distributed by Qualcomm Atheros, Inc. 25 * under proprietary terms before Copyright ownership was assigned 26 * to the Linux Foundation. 27 */ 28 29 /* 30 * This file contains the definitions of the WMI protocol specified in the 31 * Wireless Module Interface (WMI). It includes definitions of all the 32 * commands and events. Commands are messages from the host to the WM. 33 * Events and Replies are messages from the WM to the host. 34 * 35 * Ownership of correctness in regards to commands 36 * belongs to the host driver and the WMI is not required to validate 37 * parameters for value, proper range, or any other checking. 38 * 39 */ 40 41 #ifndef _WMI_H_ 42 #define _WMI_H_ 43 44 #include "wlan_defs.h" 45 #include "wmix.h" 46 #include "wmi_unified.h" 47 #include "wmi_tlv_helper.h" 48 #include "wmi_tlv_defs.h" 49 50 #ifdef __cplusplus 51 extern "C" { 52 #endif 53 54 55 #define HTC_PROTOCOL_VERSION 0x0002 56 57 #define WMI_PROTOCOL_VERSION 0x0002 58 59 #define WMI_MODE_MAX 8 60 #define WMI_MAX_RATE_MASK 6 61 62 63 PREPACK struct host_app_area_s { 64 A_UINT32 wmi_protocol_ver; 65 } POSTPACK; 66 67 68 #undef MS 69 #define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB) 70 #undef SM 71 #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK) 72 #undef WO 73 #define WO(_f) ((_f##_OFFSET) >> 2) 74 75 #undef GET_FIELD 76 #define GET_FIELD(_addr, _f) MS(*((A_UINT32 *)(_addr) + WO(_f)), _f) 77 #undef SET_FIELD 78 #define SET_FIELD(_addr, _f, _val) \ 79 (*((A_UINT32 *)(_addr) + WO(_f)) = \ 80 (*((A_UINT32 *)(_addr) + WO(_f)) & ~_f##_MASK) | SM(_val, _f)) 81 82 #define WMI_GET_FIELD(_msg_buf, _msg_type, _f) \ 83 GET_FIELD(_msg_buf, _msg_type ## _ ## _f) 84 85 #define WMI_SET_FIELD(_msg_buf, _msg_type, _f, _val) \ 86 SET_FIELD(_msg_buf, _msg_type ## _ ## _f, _val) 87 88 #define WMI_EP_APASS WMI_EP_APSS /* TYPO: leave incorrect name as an alias for the correct name */ 89 #define WMI_EP_APSS 0x0 /* WLAN driver running on apps processor sub-system */ 90 #define WMI_EP_LPASS 0x1 91 #define WMI_EP_SENSOR 0x2 92 #define WMI_EP_NANOHUB 0x3 /* WLAN driver running on NANO Hub */ 93 #define WMI_EP_MODEM 0x4 94 #define WMI_EP_LOCATION 0x5 95 96 /* 97 * Control Path 98 */ 99 typedef PREPACK struct { 100 A_UINT32 commandId : 24, 101 reserved : 2, /* used for WMI endpoint ID */ 102 plt_priv : 6; /* platform private */ 103 } POSTPACK WMI_CMD_HDR; /* used for commands and events */ 104 105 #define WMI_CMD_HDR_COMMANDID_LSB 0 106 #define WMI_CMD_HDR_COMMANDID_MASK 0x00ffffff 107 #define WMI_CMD_HDR_COMMANDID_OFFSET 0x00000000 108 #define WMI_CMD_HDR_WMI_ENDPOINTID_MASK 0x03000000 109 #define WMI_CMD_HDR_WMI_ENDPOINTID_OFFSET 24 110 #define WMI_CMD_HDR_PLT_PRIV_LSB 24 111 #define WMI_CMD_HDR_PLT_PRIV_MASK 0xff000000 112 #define WMI_CMD_HDR_PLT_PRIV_OFFSET 0x00000000 113 114 /* 115 * List of Commands 116 */ 117 typedef enum { 118 WMI_EXTENSION_CMDID, //used in wmi_svc.c /* Non-wireless extensions */ 119 WMI_IGNORE_CMDID, //used in wlan_wmi.c 120 } WMI_COMMAND_ID; 121 122 123 typedef enum { 124 NONE_CRYPT = 0x01, 125 WEP_CRYPT = 0x02, 126 TKIP_CRYPT = 0x04, 127 AES_CRYPT = 0x08, 128 #ifdef WAPI_ENABLE 129 WAPI_CRYPT = 0x10, 130 #endif /*WAPI_ENABLE*/ 131 } CRYPTO_TYPE; 132 133 #define WMI_MAX_SSID_LEN 32 134 135 /* 136 * WMI_SET_PMK_CMDID 137 */ 138 #define WMI_PMK_LEN 32 139 140 141 /* 142 * WMI_ADD_CIPHER_KEY_CMDID 143 */ 144 typedef enum { 145 PAIRWISE_USAGE = 0x00, 146 GROUP_USAGE = 0x01, 147 TX_USAGE = 0x02, /* default Tx Key - Static WEP only */ 148 PMK_USAGE = 0x04, /* PMK cache */ 149 LTF_USAGE = 0x08, /* LTF key seed */ 150 } KEY_USAGE; 151 /* 152 * List of Events (target to host) 153 */ 154 typedef enum { 155 WMI_EXTENSION_EVENTID //wmi_profhook.c and umac_wmi_events.c 156 } WMI_EVENT_ID; 157 158 typedef enum { 159 WMI_11A_CAPABILITY = 1, 160 WMI_11G_CAPABILITY = 2, 161 WMI_11AG_CAPABILITY = 3, 162 WMI_11NA_CAPABILITY = 4, 163 WMI_11NG_CAPABILITY = 5, 164 WMI_11NAG_CAPABILITY = 6, 165 WMI_11AC_CAPABILITY = 7, 166 WMI_11AX_CAPABILITY = 8, 167 // END CAPABILITY 168 WMI_11N_CAPABILITY_OFFSET = (WMI_11NA_CAPABILITY - WMI_11A_CAPABILITY), 169 } WMI_PHY_CAPABILITY; 170 171 172 /* Deprecated, need clean up */ 173 #define WMI_MAX_RX_META_SZ (12) 174 175 typedef PREPACK struct { 176 A_INT8 rssi; 177 A_UINT8 info; /* usage of 'info' field(8-bit): 178 * b1:b0 - WMI_MSG_TYPE 179 * b4:b3:b2 - UP(tid) 180 * b5 - Used in AP mode. More-data in tx dir, PS in rx. 181 * b7:b6 - Dot3 header(0), 182 * Dot11 Header(1), 183 * ACL data(2) 184 */ 185 186 A_UINT16 info2; /* usage of 'info2' field(16-bit): 187 * b11:b0 - seq_no 188 * b12 - A-MSDU? 189 * b15:b13 - META_DATA_VERSION 0 - 7 190 */ 191 A_UINT16 info3; /* b3:b2:b1:b0 - device id 192 * b4 - Used in AP mode. uAPSD trigger in rx, EOSP in tx 193 * b7:b5 - unused? 194 * b15:b8 - pad before data start(irrespective of meta version) 195 */ 196 } POSTPACK WMI_DATA_HDR; 197 #ifdef __cplusplus 198 } 199 #endif 200 201 #endif /* _WMI_H_ */ 202