fw-api.h 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236
  1. /******************************************************************************
  2. *
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * GPL LICENSE SUMMARY
  7. *
  8. * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of version 2 of the GNU General Public License as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  22. * USA
  23. *
  24. * The full GNU General Public License is included in this distribution
  25. * in the file called COPYING.
  26. *
  27. * Contact Information:
  28. * Intel Linux Wireless <ilw@linux.intel.com>
  29. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  30. *
  31. * BSD LICENSE
  32. *
  33. * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
  34. * All rights reserved.
  35. *
  36. * Redistribution and use in source and binary forms, with or without
  37. * modification, are permitted provided that the following conditions
  38. * are met:
  39. *
  40. * * Redistributions of source code must retain the above copyright
  41. * notice, this list of conditions and the following disclaimer.
  42. * * Redistributions in binary form must reproduce the above copyright
  43. * notice, this list of conditions and the following disclaimer in
  44. * the documentation and/or other materials provided with the
  45. * distribution.
  46. * * Neither the name Intel Corporation nor the names of its
  47. * contributors may be used to endorse or promote products derived
  48. * from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  51. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  52. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  53. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  54. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  55. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  56. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  57. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  58. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  59. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  60. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  61. *
  62. *****************************************************************************/
  63. #ifndef __fw_api_h__
  64. #define __fw_api_h__
  65. #include "fw-api-rs.h"
  66. #include "fw-api-tx.h"
  67. #include "fw-api-sta.h"
  68. #include "fw-api-mac.h"
  69. #include "fw-api-power.h"
  70. #include "fw-api-d3.h"
  71. #include "fw-api-bt-coex.h"
  72. /* queue and FIFO numbers by usage */
  73. enum {
  74. IWL_MVM_OFFCHANNEL_QUEUE = 8,
  75. IWL_MVM_CMD_QUEUE = 9,
  76. IWL_MVM_AUX_QUEUE = 15,
  77. IWL_MVM_FIRST_AGG_QUEUE = 16,
  78. IWL_MVM_NUM_QUEUES = 20,
  79. IWL_MVM_LAST_AGG_QUEUE = IWL_MVM_NUM_QUEUES - 1,
  80. IWL_MVM_CMD_FIFO = 7
  81. };
  82. #define IWL_MVM_STATION_COUNT 16
  83. /* commands */
  84. enum {
  85. MVM_ALIVE = 0x1,
  86. REPLY_ERROR = 0x2,
  87. INIT_COMPLETE_NOTIF = 0x4,
  88. /* PHY context commands */
  89. PHY_CONTEXT_CMD = 0x8,
  90. DBG_CFG = 0x9,
  91. /* station table */
  92. ADD_STA = 0x18,
  93. REMOVE_STA = 0x19,
  94. /* TX */
  95. TX_CMD = 0x1c,
  96. TXPATH_FLUSH = 0x1e,
  97. MGMT_MCAST_KEY = 0x1f,
  98. /* global key */
  99. WEP_KEY = 0x20,
  100. /* MAC and Binding commands */
  101. MAC_CONTEXT_CMD = 0x28,
  102. TIME_EVENT_CMD = 0x29, /* both CMD and response */
  103. TIME_EVENT_NOTIFICATION = 0x2a,
  104. BINDING_CONTEXT_CMD = 0x2b,
  105. TIME_QUOTA_CMD = 0x2c,
  106. LQ_CMD = 0x4e,
  107. /* Calibration */
  108. TEMPERATURE_NOTIFICATION = 0x62,
  109. CALIBRATION_CFG_CMD = 0x65,
  110. CALIBRATION_RES_NOTIFICATION = 0x66,
  111. CALIBRATION_COMPLETE_NOTIFICATION = 0x67,
  112. RADIO_VERSION_NOTIFICATION = 0x68,
  113. /* Scan offload */
  114. SCAN_OFFLOAD_REQUEST_CMD = 0x51,
  115. SCAN_OFFLOAD_ABORT_CMD = 0x52,
  116. SCAN_OFFLOAD_COMPLETE = 0x6D,
  117. SCAN_OFFLOAD_UPDATE_PROFILES_CMD = 0x6E,
  118. SCAN_OFFLOAD_CONFIG_CMD = 0x6f,
  119. /* Phy */
  120. PHY_CONFIGURATION_CMD = 0x6a,
  121. CALIB_RES_NOTIF_PHY_DB = 0x6b,
  122. /* PHY_DB_CMD = 0x6c, */
  123. /* Power - legacy power table command */
  124. POWER_TABLE_CMD = 0x77,
  125. /* Thermal Throttling*/
  126. REPLY_THERMAL_MNG_BACKOFF = 0x7e,
  127. /* Scanning */
  128. SCAN_REQUEST_CMD = 0x80,
  129. SCAN_ABORT_CMD = 0x81,
  130. SCAN_START_NOTIFICATION = 0x82,
  131. SCAN_RESULTS_NOTIFICATION = 0x83,
  132. SCAN_COMPLETE_NOTIFICATION = 0x84,
  133. /* NVM */
  134. NVM_ACCESS_CMD = 0x88,
  135. SET_CALIB_DEFAULT_CMD = 0x8e,
  136. BEACON_NOTIFICATION = 0x90,
  137. BEACON_TEMPLATE_CMD = 0x91,
  138. TX_ANT_CONFIGURATION_CMD = 0x98,
  139. BT_CONFIG = 0x9b,
  140. STATISTICS_NOTIFICATION = 0x9d,
  141. REDUCE_TX_POWER_CMD = 0x9f,
  142. /* RF-KILL commands and notifications */
  143. CARD_STATE_CMD = 0xa0,
  144. CARD_STATE_NOTIFICATION = 0xa1,
  145. MISSED_BEACONS_NOTIFICATION = 0xa2,
  146. /* Power - new power table command */
  147. MAC_PM_POWER_TABLE = 0xa9,
  148. REPLY_RX_PHY_CMD = 0xc0,
  149. REPLY_RX_MPDU_CMD = 0xc1,
  150. BA_NOTIF = 0xc5,
  151. /* BT Coex */
  152. BT_COEX_PRIO_TABLE = 0xcc,
  153. BT_COEX_PROT_ENV = 0xcd,
  154. BT_PROFILE_NOTIFICATION = 0xce,
  155. REPLY_BEACON_FILTERING_CMD = 0xd2,
  156. REPLY_DEBUG_CMD = 0xf0,
  157. DEBUG_LOG_MSG = 0xf7,
  158. MCAST_FILTER_CMD = 0xd0,
  159. /* D3 commands/notifications */
  160. D3_CONFIG_CMD = 0xd3,
  161. PROT_OFFLOAD_CONFIG_CMD = 0xd4,
  162. OFFLOADS_QUERY_CMD = 0xd5,
  163. REMOTE_WAKE_CONFIG_CMD = 0xd6,
  164. /* for WoWLAN in particular */
  165. WOWLAN_PATTERNS = 0xe0,
  166. WOWLAN_CONFIGURATION = 0xe1,
  167. WOWLAN_TSC_RSC_PARAM = 0xe2,
  168. WOWLAN_TKIP_PARAM = 0xe3,
  169. WOWLAN_KEK_KCK_MATERIAL = 0xe4,
  170. WOWLAN_GET_STATUSES = 0xe5,
  171. WOWLAN_TX_POWER_PER_DB = 0xe6,
  172. /* and for NetDetect */
  173. NET_DETECT_CONFIG_CMD = 0x54,
  174. NET_DETECT_PROFILES_QUERY_CMD = 0x56,
  175. NET_DETECT_PROFILES_CMD = 0x57,
  176. NET_DETECT_HOTSPOTS_CMD = 0x58,
  177. NET_DETECT_HOTSPOTS_QUERY_CMD = 0x59,
  178. REPLY_MAX = 0xff,
  179. };
  180. /**
  181. * struct iwl_cmd_response - generic response struct for most commands
  182. * @status: status of the command asked, changes for each one
  183. */
  184. struct iwl_cmd_response {
  185. __le32 status;
  186. };
  187. /*
  188. * struct iwl_tx_ant_cfg_cmd
  189. * @valid: valid antenna configuration
  190. */
  191. struct iwl_tx_ant_cfg_cmd {
  192. __le32 valid;
  193. } __packed;
  194. /**
  195. * struct iwl_reduce_tx_power_cmd - TX power reduction command
  196. * REDUCE_TX_POWER_CMD = 0x9f
  197. * @flags: (reserved for future implementation)
  198. * @mac_context_id: id of the mac ctx for which we are reducing TX power.
  199. * @pwr_restriction: TX power restriction in dBms.
  200. */
  201. struct iwl_reduce_tx_power_cmd {
  202. u8 flags;
  203. u8 mac_context_id;
  204. __le16 pwr_restriction;
  205. } __packed; /* TX_REDUCED_POWER_API_S_VER_1 */
  206. /*
  207. * Calibration control struct.
  208. * Sent as part of the phy configuration command.
  209. * @flow_trigger: bitmap for which calibrations to perform according to
  210. * flow triggers.
  211. * @event_trigger: bitmap for which calibrations to perform according to
  212. * event triggers.
  213. */
  214. struct iwl_calib_ctrl {
  215. __le32 flow_trigger;
  216. __le32 event_trigger;
  217. } __packed;
  218. /* This enum defines the bitmap of various calibrations to enable in both
  219. * init ucode and runtime ucode through CALIBRATION_CFG_CMD.
  220. */
  221. enum iwl_calib_cfg {
  222. IWL_CALIB_CFG_XTAL_IDX = BIT(0),
  223. IWL_CALIB_CFG_TEMPERATURE_IDX = BIT(1),
  224. IWL_CALIB_CFG_VOLTAGE_READ_IDX = BIT(2),
  225. IWL_CALIB_CFG_PAPD_IDX = BIT(3),
  226. IWL_CALIB_CFG_TX_PWR_IDX = BIT(4),
  227. IWL_CALIB_CFG_DC_IDX = BIT(5),
  228. IWL_CALIB_CFG_BB_FILTER_IDX = BIT(6),
  229. IWL_CALIB_CFG_LO_LEAKAGE_IDX = BIT(7),
  230. IWL_CALIB_CFG_TX_IQ_IDX = BIT(8),
  231. IWL_CALIB_CFG_TX_IQ_SKEW_IDX = BIT(9),
  232. IWL_CALIB_CFG_RX_IQ_IDX = BIT(10),
  233. IWL_CALIB_CFG_RX_IQ_SKEW_IDX = BIT(11),
  234. IWL_CALIB_CFG_SENSITIVITY_IDX = BIT(12),
  235. IWL_CALIB_CFG_CHAIN_NOISE_IDX = BIT(13),
  236. IWL_CALIB_CFG_DISCONNECTED_ANT_IDX = BIT(14),
  237. IWL_CALIB_CFG_ANT_COUPLING_IDX = BIT(15),
  238. IWL_CALIB_CFG_DAC_IDX = BIT(16),
  239. IWL_CALIB_CFG_ABS_IDX = BIT(17),
  240. IWL_CALIB_CFG_AGC_IDX = BIT(18),
  241. };
  242. /*
  243. * Phy configuration command.
  244. */
  245. struct iwl_phy_cfg_cmd {
  246. __le32 phy_cfg;
  247. struct iwl_calib_ctrl calib_control;
  248. } __packed;
  249. #define PHY_CFG_RADIO_TYPE (BIT(0) | BIT(1))
  250. #define PHY_CFG_RADIO_STEP (BIT(2) | BIT(3))
  251. #define PHY_CFG_RADIO_DASH (BIT(4) | BIT(5))
  252. #define PHY_CFG_PRODUCT_NUMBER (BIT(6) | BIT(7))
  253. #define PHY_CFG_TX_CHAIN_A BIT(8)
  254. #define PHY_CFG_TX_CHAIN_B BIT(9)
  255. #define PHY_CFG_TX_CHAIN_C BIT(10)
  256. #define PHY_CFG_RX_CHAIN_A BIT(12)
  257. #define PHY_CFG_RX_CHAIN_B BIT(13)
  258. #define PHY_CFG_RX_CHAIN_C BIT(14)
  259. /* Target of the NVM_ACCESS_CMD */
  260. enum {
  261. NVM_ACCESS_TARGET_CACHE = 0,
  262. NVM_ACCESS_TARGET_OTP = 1,
  263. NVM_ACCESS_TARGET_EEPROM = 2,
  264. };
  265. /* Section types for NVM_ACCESS_CMD */
  266. enum {
  267. NVM_SECTION_TYPE_HW = 0,
  268. NVM_SECTION_TYPE_SW,
  269. NVM_SECTION_TYPE_PAPD,
  270. NVM_SECTION_TYPE_BT,
  271. NVM_SECTION_TYPE_CALIBRATION,
  272. NVM_SECTION_TYPE_PRODUCTION,
  273. NVM_SECTION_TYPE_POST_FCS_CALIB,
  274. NVM_NUM_OF_SECTIONS,
  275. };
  276. /**
  277. * struct iwl_nvm_access_cmd_ver2 - Request the device to send an NVM section
  278. * @op_code: 0 - read, 1 - write
  279. * @target: NVM_ACCESS_TARGET_*
  280. * @type: NVM_SECTION_TYPE_*
  281. * @offset: offset in bytes into the section
  282. * @length: in bytes, to read/write
  283. * @data: if write operation, the data to write. On read its empty
  284. */
  285. struct iwl_nvm_access_cmd {
  286. u8 op_code;
  287. u8 target;
  288. __le16 type;
  289. __le16 offset;
  290. __le16 length;
  291. u8 data[];
  292. } __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */
  293. /**
  294. * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD
  295. * @offset: offset in bytes into the section
  296. * @length: in bytes, either how much was written or read
  297. * @type: NVM_SECTION_TYPE_*
  298. * @status: 0 for success, fail otherwise
  299. * @data: if read operation, the data returned. Empty on write.
  300. */
  301. struct iwl_nvm_access_resp {
  302. __le16 offset;
  303. __le16 length;
  304. __le16 type;
  305. __le16 status;
  306. u8 data[];
  307. } __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */
  308. /* MVM_ALIVE 0x1 */
  309. /* alive response is_valid values */
  310. #define ALIVE_RESP_UCODE_OK BIT(0)
  311. #define ALIVE_RESP_RFKILL BIT(1)
  312. /* alive response ver_type values */
  313. enum {
  314. FW_TYPE_HW = 0,
  315. FW_TYPE_PROT = 1,
  316. FW_TYPE_AP = 2,
  317. FW_TYPE_WOWLAN = 3,
  318. FW_TYPE_TIMING = 4,
  319. FW_TYPE_WIPAN = 5
  320. };
  321. /* alive response ver_subtype values */
  322. enum {
  323. FW_SUBTYPE_FULL_FEATURE = 0,
  324. FW_SUBTYPE_BOOTSRAP = 1, /* Not valid */
  325. FW_SUBTYPE_REDUCED = 2,
  326. FW_SUBTYPE_ALIVE_ONLY = 3,
  327. FW_SUBTYPE_WOWLAN = 4,
  328. FW_SUBTYPE_AP_SUBTYPE = 5,
  329. FW_SUBTYPE_WIPAN = 6,
  330. FW_SUBTYPE_INITIALIZE = 9
  331. };
  332. #define IWL_ALIVE_STATUS_ERR 0xDEAD
  333. #define IWL_ALIVE_STATUS_OK 0xCAFE
  334. #define IWL_ALIVE_FLG_RFKILL BIT(0)
  335. struct mvm_alive_resp {
  336. __le16 status;
  337. __le16 flags;
  338. u8 ucode_minor;
  339. u8 ucode_major;
  340. __le16 id;
  341. u8 api_minor;
  342. u8 api_major;
  343. u8 ver_subtype;
  344. u8 ver_type;
  345. u8 mac;
  346. u8 opt;
  347. __le16 reserved2;
  348. __le32 timestamp;
  349. __le32 error_event_table_ptr; /* SRAM address for error log */
  350. __le32 log_event_table_ptr; /* SRAM address for event log */
  351. __le32 cpu_register_ptr;
  352. __le32 dbgm_config_ptr;
  353. __le32 alive_counter_ptr;
  354. __le32 scd_base_ptr; /* SRAM address for SCD */
  355. } __packed; /* ALIVE_RES_API_S_VER_1 */
  356. /* Error response/notification */
  357. enum {
  358. FW_ERR_UNKNOWN_CMD = 0x0,
  359. FW_ERR_INVALID_CMD_PARAM = 0x1,
  360. FW_ERR_SERVICE = 0x2,
  361. FW_ERR_ARC_MEMORY = 0x3,
  362. FW_ERR_ARC_CODE = 0x4,
  363. FW_ERR_WATCH_DOG = 0x5,
  364. FW_ERR_WEP_GRP_KEY_INDX = 0x10,
  365. FW_ERR_WEP_KEY_SIZE = 0x11,
  366. FW_ERR_OBSOLETE_FUNC = 0x12,
  367. FW_ERR_UNEXPECTED = 0xFE,
  368. FW_ERR_FATAL = 0xFF
  369. };
  370. /**
  371. * struct iwl_error_resp - FW error indication
  372. * ( REPLY_ERROR = 0x2 )
  373. * @error_type: one of FW_ERR_*
  374. * @cmd_id: the command ID for which the error occured
  375. * @bad_cmd_seq_num: sequence number of the erroneous command
  376. * @error_service: which service created the error, applicable only if
  377. * error_type = 2, otherwise 0
  378. * @timestamp: TSF in usecs.
  379. */
  380. struct iwl_error_resp {
  381. __le32 error_type;
  382. u8 cmd_id;
  383. u8 reserved1;
  384. __le16 bad_cmd_seq_num;
  385. __le32 error_service;
  386. __le64 timestamp;
  387. } __packed;
  388. /* Common PHY, MAC and Bindings definitions */
  389. #define MAX_MACS_IN_BINDING (3)
  390. #define MAX_BINDINGS (4)
  391. #define AUX_BINDING_INDEX (3)
  392. #define MAX_PHYS (4)
  393. /* Used to extract ID and color from the context dword */
  394. #define FW_CTXT_ID_POS (0)
  395. #define FW_CTXT_ID_MSK (0xff << FW_CTXT_ID_POS)
  396. #define FW_CTXT_COLOR_POS (8)
  397. #define FW_CTXT_COLOR_MSK (0xff << FW_CTXT_COLOR_POS)
  398. #define FW_CTXT_INVALID (0xffffffff)
  399. #define FW_CMD_ID_AND_COLOR(_id, _color) ((_id << FW_CTXT_ID_POS) |\
  400. (_color << FW_CTXT_COLOR_POS))
  401. /* Possible actions on PHYs, MACs and Bindings */
  402. enum {
  403. FW_CTXT_ACTION_STUB = 0,
  404. FW_CTXT_ACTION_ADD,
  405. FW_CTXT_ACTION_MODIFY,
  406. FW_CTXT_ACTION_REMOVE,
  407. FW_CTXT_ACTION_NUM
  408. }; /* COMMON_CONTEXT_ACTION_API_E_VER_1 */
  409. /* Time Events */
  410. /* Time Event types, according to MAC type */
  411. enum iwl_time_event_type {
  412. /* BSS Station Events */
  413. TE_BSS_STA_AGGRESSIVE_ASSOC,
  414. TE_BSS_STA_ASSOC,
  415. TE_BSS_EAP_DHCP_PROT,
  416. TE_BSS_QUIET_PERIOD,
  417. /* P2P Device Events */
  418. TE_P2P_DEVICE_DISCOVERABLE,
  419. TE_P2P_DEVICE_LISTEN,
  420. TE_P2P_DEVICE_ACTION_SCAN,
  421. TE_P2P_DEVICE_FULL_SCAN,
  422. /* P2P Client Events */
  423. TE_P2P_CLIENT_AGGRESSIVE_ASSOC,
  424. TE_P2P_CLIENT_ASSOC,
  425. TE_P2P_CLIENT_QUIET_PERIOD,
  426. /* P2P GO Events */
  427. TE_P2P_GO_ASSOC_PROT,
  428. TE_P2P_GO_REPETITIVE_NOA,
  429. TE_P2P_GO_CT_WINDOW,
  430. /* WiDi Sync Events */
  431. TE_WIDI_TX_SYNC,
  432. TE_MAX
  433. }; /* MAC_EVENT_TYPE_API_E_VER_1 */
  434. /* Time Event dependencies: none, on another TE, or in a specific time */
  435. enum {
  436. TE_INDEPENDENT = 0,
  437. TE_DEP_OTHER = 1,
  438. TE_DEP_TSF = 2,
  439. TE_EVENT_SOCIOPATHIC = 4,
  440. }; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */
  441. /*
  442. * Supported Time event notifications configuration.
  443. * A notification (both event and fragment) includes a status indicating weather
  444. * the FW was able to schedule the event or not. For fragment start/end
  445. * notification the status is always success. There is no start/end fragment
  446. * notification for monolithic events.
  447. *
  448. * @TE_NOTIF_NONE: no notifications
  449. * @TE_NOTIF_HOST_EVENT_START: request/receive notification on event start
  450. * @TE_NOTIF_HOST_EVENT_END:request/receive notification on event end
  451. * @TE_NOTIF_INTERNAL_EVENT_START: internal FW use
  452. * @TE_NOTIF_INTERNAL_EVENT_END: internal FW use.
  453. * @TE_NOTIF_HOST_FRAG_START: request/receive notification on frag start
  454. * @TE_NOTIF_HOST_FRAG_END:request/receive notification on frag end
  455. * @TE_NOTIF_INTERNAL_FRAG_START: internal FW use.
  456. * @TE_NOTIF_INTERNAL_FRAG_END: internal FW use.
  457. */
  458. enum {
  459. TE_NOTIF_NONE = 0,
  460. TE_NOTIF_HOST_EVENT_START = 0x1,
  461. TE_NOTIF_HOST_EVENT_END = 0x2,
  462. TE_NOTIF_INTERNAL_EVENT_START = 0x4,
  463. TE_NOTIF_INTERNAL_EVENT_END = 0x8,
  464. TE_NOTIF_HOST_FRAG_START = 0x10,
  465. TE_NOTIF_HOST_FRAG_END = 0x20,
  466. TE_NOTIF_INTERNAL_FRAG_START = 0x40,
  467. TE_NOTIF_INTERNAL_FRAG_END = 0x80
  468. }; /* MAC_EVENT_ACTION_API_E_VER_2 */
  469. /*
  470. * @TE_FRAG_NONE: fragmentation of the time event is NOT allowed.
  471. * @TE_FRAG_SINGLE: fragmentation of the time event is allowed, but only
  472. * the first fragment is scheduled.
  473. * @TE_FRAG_DUAL: fragmentation of the time event is allowed, but only
  474. * the first 2 fragments are scheduled.
  475. * @TE_FRAG_ENDLESS: fragmentation of the time event is allowed, and any number
  476. * of fragments are valid.
  477. *
  478. * Other than the constant defined above, specifying a fragmentation value 'x'
  479. * means that the event can be fragmented but only the first 'x' will be
  480. * scheduled.
  481. */
  482. enum {
  483. TE_FRAG_NONE = 0,
  484. TE_FRAG_SINGLE = 1,
  485. TE_FRAG_DUAL = 2,
  486. TE_FRAG_ENDLESS = 0xffffffff
  487. };
  488. /* Repeat the time event endlessly (until removed) */
  489. #define TE_REPEAT_ENDLESS (0xffffffff)
  490. /* If a Time Event has bounded repetitions, this is the maximal value */
  491. #define TE_REPEAT_MAX_MSK (0x0fffffff)
  492. /* If a Time Event can be fragmented, this is the max number of fragments */
  493. #define TE_FRAG_MAX_MSK (0x0fffffff)
  494. /**
  495. * struct iwl_time_event_cmd - configuring Time Events
  496. * ( TIME_EVENT_CMD = 0x29 )
  497. * @id_and_color: ID and color of the relevant MAC
  498. * @action: action to perform, one of FW_CTXT_ACTION_*
  499. * @id: this field has two meanings, depending on the action:
  500. * If the action is ADD, then it means the type of event to add.
  501. * For all other actions it is the unique event ID assigned when the
  502. * event was added by the FW.
  503. * @apply_time: When to start the Time Event (in GP2)
  504. * @max_delay: maximum delay to event's start (apply time), in TU
  505. * @depends_on: the unique ID of the event we depend on (if any)
  506. * @interval: interval between repetitions, in TU
  507. * @interval_reciprocal: 2^32 / interval
  508. * @duration: duration of event in TU
  509. * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS
  510. * @dep_policy: one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF
  511. * @is_present: 0 or 1, are we present or absent during the Time Event
  512. * @max_frags: maximal number of fragments the Time Event can be divided to
  513. * @notify: notifications using TE_NOTIF_* (whom to notify when)
  514. */
  515. struct iwl_time_event_cmd {
  516. /* COMMON_INDEX_HDR_API_S_VER_1 */
  517. __le32 id_and_color;
  518. __le32 action;
  519. __le32 id;
  520. /* MAC_TIME_EVENT_DATA_API_S_VER_1 */
  521. __le32 apply_time;
  522. __le32 max_delay;
  523. __le32 dep_policy;
  524. __le32 depends_on;
  525. __le32 is_present;
  526. __le32 max_frags;
  527. __le32 interval;
  528. __le32 interval_reciprocal;
  529. __le32 duration;
  530. __le32 repeat;
  531. __le32 notify;
  532. } __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_1 */
  533. /**
  534. * struct iwl_time_event_resp - response structure to iwl_time_event_cmd
  535. * @status: bit 0 indicates success, all others specify errors
  536. * @id: the Time Event type
  537. * @unique_id: the unique ID assigned (in ADD) or given (others) to the TE
  538. * @id_and_color: ID and color of the relevant MAC
  539. */
  540. struct iwl_time_event_resp {
  541. __le32 status;
  542. __le32 id;
  543. __le32 unique_id;
  544. __le32 id_and_color;
  545. } __packed; /* MAC_TIME_EVENT_RSP_API_S_VER_1 */
  546. /**
  547. * struct iwl_time_event_notif - notifications of time event start/stop
  548. * ( TIME_EVENT_NOTIFICATION = 0x2a )
  549. * @timestamp: action timestamp in GP2
  550. * @session_id: session's unique id
  551. * @unique_id: unique id of the Time Event itself
  552. * @id_and_color: ID and color of the relevant MAC
  553. * @action: one of TE_NOTIF_START or TE_NOTIF_END
  554. * @status: true if scheduled, false otherwise (not executed)
  555. */
  556. struct iwl_time_event_notif {
  557. __le32 timestamp;
  558. __le32 session_id;
  559. __le32 unique_id;
  560. __le32 id_and_color;
  561. __le32 action;
  562. __le32 status;
  563. } __packed; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */
  564. /* Bindings and Time Quota */
  565. /**
  566. * struct iwl_binding_cmd - configuring bindings
  567. * ( BINDING_CONTEXT_CMD = 0x2b )
  568. * @id_and_color: ID and color of the relevant Binding
  569. * @action: action to perform, one of FW_CTXT_ACTION_*
  570. * @macs: array of MAC id and colors which belong to the binding
  571. * @phy: PHY id and color which belongs to the binding
  572. */
  573. struct iwl_binding_cmd {
  574. /* COMMON_INDEX_HDR_API_S_VER_1 */
  575. __le32 id_and_color;
  576. __le32 action;
  577. /* BINDING_DATA_API_S_VER_1 */
  578. __le32 macs[MAX_MACS_IN_BINDING];
  579. __le32 phy;
  580. } __packed; /* BINDING_CMD_API_S_VER_1 */
  581. /* The maximal number of fragments in the FW's schedule session */
  582. #define IWL_MVM_MAX_QUOTA 128
  583. /**
  584. * struct iwl_time_quota_data - configuration of time quota per binding
  585. * @id_and_color: ID and color of the relevant Binding
  586. * @quota: absolute time quota in TU. The scheduler will try to divide the
  587. * remainig quota (after Time Events) according to this quota.
  588. * @max_duration: max uninterrupted context duration in TU
  589. */
  590. struct iwl_time_quota_data {
  591. __le32 id_and_color;
  592. __le32 quota;
  593. __le32 max_duration;
  594. } __packed; /* TIME_QUOTA_DATA_API_S_VER_1 */
  595. /**
  596. * struct iwl_time_quota_cmd - configuration of time quota between bindings
  597. * ( TIME_QUOTA_CMD = 0x2c )
  598. * @quotas: allocations per binding
  599. */
  600. struct iwl_time_quota_cmd {
  601. struct iwl_time_quota_data quotas[MAX_BINDINGS];
  602. } __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_1 */
  603. /* PHY context */
  604. /* Supported bands */
  605. #define PHY_BAND_5 (0)
  606. #define PHY_BAND_24 (1)
  607. /* Supported channel width, vary if there is VHT support */
  608. #define PHY_VHT_CHANNEL_MODE20 (0x0)
  609. #define PHY_VHT_CHANNEL_MODE40 (0x1)
  610. #define PHY_VHT_CHANNEL_MODE80 (0x2)
  611. #define PHY_VHT_CHANNEL_MODE160 (0x3)
  612. /*
  613. * Control channel position:
  614. * For legacy set bit means upper channel, otherwise lower.
  615. * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
  616. * bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
  617. * center_freq
  618. * |
  619. * 40Mhz |_______|_______|
  620. * 80Mhz |_______|_______|_______|_______|
  621. * 160Mhz |_______|_______|_______|_______|_______|_______|_______|_______|
  622. * code 011 010 001 000 | 100 101 110 111
  623. */
  624. #define PHY_VHT_CTRL_POS_1_BELOW (0x0)
  625. #define PHY_VHT_CTRL_POS_2_BELOW (0x1)
  626. #define PHY_VHT_CTRL_POS_3_BELOW (0x2)
  627. #define PHY_VHT_CTRL_POS_4_BELOW (0x3)
  628. #define PHY_VHT_CTRL_POS_1_ABOVE (0x4)
  629. #define PHY_VHT_CTRL_POS_2_ABOVE (0x5)
  630. #define PHY_VHT_CTRL_POS_3_ABOVE (0x6)
  631. #define PHY_VHT_CTRL_POS_4_ABOVE (0x7)
  632. /*
  633. * @band: PHY_BAND_*
  634. * @channel: channel number
  635. * @width: PHY_[VHT|LEGACY]_CHANNEL_*
  636. * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
  637. */
  638. struct iwl_fw_channel_info {
  639. u8 band;
  640. u8 channel;
  641. u8 width;
  642. u8 ctrl_pos;
  643. } __packed;
  644. #define PHY_RX_CHAIN_DRIVER_FORCE_POS (0)
  645. #define PHY_RX_CHAIN_DRIVER_FORCE_MSK \
  646. (0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS)
  647. #define PHY_RX_CHAIN_VALID_POS (1)
  648. #define PHY_RX_CHAIN_VALID_MSK \
  649. (0x7 << PHY_RX_CHAIN_VALID_POS)
  650. #define PHY_RX_CHAIN_FORCE_SEL_POS (4)
  651. #define PHY_RX_CHAIN_FORCE_SEL_MSK \
  652. (0x7 << PHY_RX_CHAIN_FORCE_SEL_POS)
  653. #define PHY_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
  654. #define PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \
  655. (0x7 << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS)
  656. #define PHY_RX_CHAIN_CNT_POS (10)
  657. #define PHY_RX_CHAIN_CNT_MSK \
  658. (0x3 << PHY_RX_CHAIN_CNT_POS)
  659. #define PHY_RX_CHAIN_MIMO_CNT_POS (12)
  660. #define PHY_RX_CHAIN_MIMO_CNT_MSK \
  661. (0x3 << PHY_RX_CHAIN_MIMO_CNT_POS)
  662. #define PHY_RX_CHAIN_MIMO_FORCE_POS (14)
  663. #define PHY_RX_CHAIN_MIMO_FORCE_MSK \
  664. (0x1 << PHY_RX_CHAIN_MIMO_FORCE_POS)
  665. /* TODO: fix the value, make it depend on firmware at runtime? */
  666. #define NUM_PHY_CTX 3
  667. /* TODO: complete missing documentation */
  668. /**
  669. * struct iwl_phy_context_cmd - config of the PHY context
  670. * ( PHY_CONTEXT_CMD = 0x8 )
  671. * @id_and_color: ID and color of the relevant Binding
  672. * @action: action to perform, one of FW_CTXT_ACTION_*
  673. * @apply_time: 0 means immediate apply and context switch.
  674. * other value means apply new params after X usecs
  675. * @tx_param_color: ???
  676. * @channel_info:
  677. * @txchain_info: ???
  678. * @rxchain_info: ???
  679. * @acquisition_data: ???
  680. * @dsp_cfg_flags: set to 0
  681. */
  682. struct iwl_phy_context_cmd {
  683. /* COMMON_INDEX_HDR_API_S_VER_1 */
  684. __le32 id_and_color;
  685. __le32 action;
  686. /* PHY_CONTEXT_DATA_API_S_VER_1 */
  687. __le32 apply_time;
  688. __le32 tx_param_color;
  689. struct iwl_fw_channel_info ci;
  690. __le32 txchain_info;
  691. __le32 rxchain_info;
  692. __le32 acquisition_data;
  693. __le32 dsp_cfg_flags;
  694. } __packed; /* PHY_CONTEXT_CMD_API_VER_1 */
  695. #define IWL_RX_INFO_PHY_CNT 8
  696. #define IWL_RX_INFO_ENERGY_ANT_ABC_IDX 1
  697. #define IWL_RX_INFO_ENERGY_ANT_A_MSK 0x000000ff
  698. #define IWL_RX_INFO_ENERGY_ANT_B_MSK 0x0000ff00
  699. #define IWL_RX_INFO_ENERGY_ANT_C_MSK 0x00ff0000
  700. #define IWL_RX_INFO_ENERGY_ANT_A_POS 0
  701. #define IWL_RX_INFO_ENERGY_ANT_B_POS 8
  702. #define IWL_RX_INFO_ENERGY_ANT_C_POS 16
  703. #define IWL_RX_INFO_AGC_IDX 1
  704. #define IWL_RX_INFO_RSSI_AB_IDX 2
  705. #define IWL_OFDM_AGC_A_MSK 0x0000007f
  706. #define IWL_OFDM_AGC_A_POS 0
  707. #define IWL_OFDM_AGC_B_MSK 0x00003f80
  708. #define IWL_OFDM_AGC_B_POS 7
  709. #define IWL_OFDM_AGC_CODE_MSK 0x3fe00000
  710. #define IWL_OFDM_AGC_CODE_POS 20
  711. #define IWL_OFDM_RSSI_INBAND_A_MSK 0x00ff
  712. #define IWL_OFDM_RSSI_A_POS 0
  713. #define IWL_OFDM_RSSI_ALLBAND_A_MSK 0xff00
  714. #define IWL_OFDM_RSSI_ALLBAND_A_POS 8
  715. #define IWL_OFDM_RSSI_INBAND_B_MSK 0xff0000
  716. #define IWL_OFDM_RSSI_B_POS 16
  717. #define IWL_OFDM_RSSI_ALLBAND_B_MSK 0xff000000
  718. #define IWL_OFDM_RSSI_ALLBAND_B_POS 24
  719. /**
  720. * struct iwl_rx_phy_info - phy info
  721. * (REPLY_RX_PHY_CMD = 0xc0)
  722. * @non_cfg_phy_cnt: non configurable DSP phy data byte count
  723. * @cfg_phy_cnt: configurable DSP phy data byte count
  724. * @stat_id: configurable DSP phy data set ID
  725. * @reserved1:
  726. * @system_timestamp: GP2 at on air rise
  727. * @timestamp: TSF at on air rise
  728. * @beacon_time_stamp: beacon at on-air rise
  729. * @phy_flags: general phy flags: band, modulation, ...
  730. * @channel: channel number
  731. * @non_cfg_phy_buf: for various implementations of non_cfg_phy
  732. * @rate_n_flags: RATE_MCS_*
  733. * @byte_count: frame's byte-count
  734. * @frame_time: frame's time on the air, based on byte count and frame rate
  735. * calculation
  736. * @mac_active_msk: what MACs were active when the frame was received
  737. *
  738. * Before each Rx, the device sends this data. It contains PHY information
  739. * about the reception of the packet.
  740. */
  741. struct iwl_rx_phy_info {
  742. u8 non_cfg_phy_cnt;
  743. u8 cfg_phy_cnt;
  744. u8 stat_id;
  745. u8 reserved1;
  746. __le32 system_timestamp;
  747. __le64 timestamp;
  748. __le32 beacon_time_stamp;
  749. __le16 phy_flags;
  750. __le16 channel;
  751. __le32 non_cfg_phy[IWL_RX_INFO_PHY_CNT];
  752. __le32 rate_n_flags;
  753. __le32 byte_count;
  754. __le16 mac_active_msk;
  755. __le16 frame_time;
  756. } __packed;
  757. struct iwl_rx_mpdu_res_start {
  758. __le16 byte_count;
  759. __le16 reserved;
  760. } __packed;
  761. /**
  762. * enum iwl_rx_phy_flags - to parse %iwl_rx_phy_info phy_flags
  763. * @RX_RES_PHY_FLAGS_BAND_24: true if the packet was received on 2.4 band
  764. * @RX_RES_PHY_FLAGS_MOD_CCK:
  765. * @RX_RES_PHY_FLAGS_SHORT_PREAMBLE: true if packet's preamble was short
  766. * @RX_RES_PHY_FLAGS_NARROW_BAND:
  767. * @RX_RES_PHY_FLAGS_ANTENNA: antenna on which the packet was received
  768. * @RX_RES_PHY_FLAGS_AGG: set if the packet was part of an A-MPDU
  769. * @RX_RES_PHY_FLAGS_OFDM_HT: The frame was an HT frame
  770. * @RX_RES_PHY_FLAGS_OFDM_GF: The frame used GF preamble
  771. * @RX_RES_PHY_FLAGS_OFDM_VHT: The frame was a VHT frame
  772. */
  773. enum iwl_rx_phy_flags {
  774. RX_RES_PHY_FLAGS_BAND_24 = BIT(0),
  775. RX_RES_PHY_FLAGS_MOD_CCK = BIT(1),
  776. RX_RES_PHY_FLAGS_SHORT_PREAMBLE = BIT(2),
  777. RX_RES_PHY_FLAGS_NARROW_BAND = BIT(3),
  778. RX_RES_PHY_FLAGS_ANTENNA = (0x7 << 4),
  779. RX_RES_PHY_FLAGS_ANTENNA_POS = 4,
  780. RX_RES_PHY_FLAGS_AGG = BIT(7),
  781. RX_RES_PHY_FLAGS_OFDM_HT = BIT(8),
  782. RX_RES_PHY_FLAGS_OFDM_GF = BIT(9),
  783. RX_RES_PHY_FLAGS_OFDM_VHT = BIT(10),
  784. };
  785. /**
  786. * enum iwl_mvm_rx_status - written by fw for each Rx packet
  787. * @RX_MPDU_RES_STATUS_CRC_OK: CRC is fine
  788. * @RX_MPDU_RES_STATUS_OVERRUN_OK: there was no RXE overflow
  789. * @RX_MPDU_RES_STATUS_SRC_STA_FOUND:
  790. * @RX_MPDU_RES_STATUS_KEY_VALID:
  791. * @RX_MPDU_RES_STATUS_KEY_PARAM_OK:
  792. * @RX_MPDU_RES_STATUS_ICV_OK: ICV is fine, if not, the packet is destroyed
  793. * @RX_MPDU_RES_STATUS_MIC_OK: used for CCM alg only. TKIP MIC is checked
  794. * in the driver.
  795. * @RX_MPDU_RES_STATUS_TTAK_OK: TTAK is fine
  796. * @RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR: valid for alg = CCM_CMAC or
  797. * alg = CCM only. Checks replay attack for 11w frames. Relevant only if
  798. * %RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME is set.
  799. * @RX_MPDU_RES_STATUS_SEC_NO_ENC: this frame is not encrypted
  800. * @RX_MPDU_RES_STATUS_SEC_WEP_ENC: this frame is encrypted using WEP
  801. * @RX_MPDU_RES_STATUS_SEC_CCM_ENC: this frame is encrypted using CCM
  802. * @RX_MPDU_RES_STATUS_SEC_TKIP_ENC: this frame is encrypted using TKIP
  803. * @RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC: this frame is encrypted using CCM_CMAC
  804. * @RX_MPDU_RES_STATUS_SEC_ENC_ERR: this frame couldn't be decrypted
  805. * @RX_MPDU_RES_STATUS_SEC_ENC_MSK: bitmask of the encryption algorithm
  806. * @RX_MPDU_RES_STATUS_DEC_DONE: this frame has been successfully decrypted
  807. * @RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP:
  808. * @RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP:
  809. * @RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT:
  810. * @RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME: this frame is an 11w management frame
  811. * @RX_MPDU_RES_STATUS_HASH_INDEX_MSK:
  812. * @RX_MPDU_RES_STATUS_STA_ID_MSK:
  813. * @RX_MPDU_RES_STATUS_RRF_KILL:
  814. * @RX_MPDU_RES_STATUS_FILTERING_MSK:
  815. * @RX_MPDU_RES_STATUS2_FILTERING_MSK:
  816. */
  817. enum iwl_mvm_rx_status {
  818. RX_MPDU_RES_STATUS_CRC_OK = BIT(0),
  819. RX_MPDU_RES_STATUS_OVERRUN_OK = BIT(1),
  820. RX_MPDU_RES_STATUS_SRC_STA_FOUND = BIT(2),
  821. RX_MPDU_RES_STATUS_KEY_VALID = BIT(3),
  822. RX_MPDU_RES_STATUS_KEY_PARAM_OK = BIT(4),
  823. RX_MPDU_RES_STATUS_ICV_OK = BIT(5),
  824. RX_MPDU_RES_STATUS_MIC_OK = BIT(6),
  825. RX_MPDU_RES_STATUS_TTAK_OK = BIT(7),
  826. RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR = BIT(7),
  827. RX_MPDU_RES_STATUS_SEC_NO_ENC = (0 << 8),
  828. RX_MPDU_RES_STATUS_SEC_WEP_ENC = (1 << 8),
  829. RX_MPDU_RES_STATUS_SEC_CCM_ENC = (2 << 8),
  830. RX_MPDU_RES_STATUS_SEC_TKIP_ENC = (3 << 8),
  831. RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC = (6 << 8),
  832. RX_MPDU_RES_STATUS_SEC_ENC_ERR = (7 << 8),
  833. RX_MPDU_RES_STATUS_SEC_ENC_MSK = (7 << 8),
  834. RX_MPDU_RES_STATUS_DEC_DONE = BIT(11),
  835. RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP = BIT(12),
  836. RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP = BIT(13),
  837. RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT = BIT(14),
  838. RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME = BIT(15),
  839. RX_MPDU_RES_STATUS_HASH_INDEX_MSK = (0x3F0000),
  840. RX_MPDU_RES_STATUS_STA_ID_MSK = (0x1f000000),
  841. RX_MPDU_RES_STATUS_RRF_KILL = BIT(29),
  842. RX_MPDU_RES_STATUS_FILTERING_MSK = (0xc00000),
  843. RX_MPDU_RES_STATUS2_FILTERING_MSK = (0xc0000000),
  844. };
  845. /**
  846. * struct iwl_radio_version_notif - information on the radio version
  847. * ( RADIO_VERSION_NOTIFICATION = 0x68 )
  848. * @radio_flavor:
  849. * @radio_step:
  850. * @radio_dash:
  851. */
  852. struct iwl_radio_version_notif {
  853. __le32 radio_flavor;
  854. __le32 radio_step;
  855. __le32 radio_dash;
  856. } __packed; /* RADIO_VERSION_NOTOFICATION_S_VER_1 */
  857. enum iwl_card_state_flags {
  858. CARD_ENABLED = 0x00,
  859. HW_CARD_DISABLED = 0x01,
  860. SW_CARD_DISABLED = 0x02,
  861. CT_KILL_CARD_DISABLED = 0x04,
  862. HALT_CARD_DISABLED = 0x08,
  863. CARD_DISABLED_MSK = 0x0f,
  864. CARD_IS_RX_ON = 0x10,
  865. };
  866. /**
  867. * struct iwl_radio_version_notif - information on the radio version
  868. * ( CARD_STATE_NOTIFICATION = 0xa1 )
  869. * @flags: %iwl_card_state_flags
  870. */
  871. struct iwl_card_state_notif {
  872. __le32 flags;
  873. } __packed; /* CARD_STATE_NTFY_API_S_VER_1 */
  874. /**
  875. * struct iwl_missed_beacons_notif - information on missed beacons
  876. * ( MISSED_BEACONS_NOTIFICATION = 0xa2 )
  877. * @mac_id: interface ID
  878. * @consec_missed_beacons_since_last_rx: number of consecutive missed
  879. * beacons since last RX.
  880. * @consec_missed_beacons: number of consecutive missed beacons
  881. * @num_expected_beacons:
  882. * @num_recvd_beacons:
  883. */
  884. struct iwl_missed_beacons_notif {
  885. __le32 mac_id;
  886. __le32 consec_missed_beacons_since_last_rx;
  887. __le32 consec_missed_beacons;
  888. __le32 num_expected_beacons;
  889. __le32 num_recvd_beacons;
  890. } __packed; /* MISSED_BEACON_NTFY_API_S_VER_3 */
  891. /**
  892. * struct iwl_set_calib_default_cmd - set default value for calibration.
  893. * ( SET_CALIB_DEFAULT_CMD = 0x8e )
  894. * @calib_index: the calibration to set value for
  895. * @length: of data
  896. * @data: the value to set for the calibration result
  897. */
  898. struct iwl_set_calib_default_cmd {
  899. __le16 calib_index;
  900. __le16 length;
  901. u8 data[0];
  902. } __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */
  903. #define MAX_PORT_ID_NUM 2
  904. /**
  905. * struct iwl_mcast_filter_cmd - configure multicast filter.
  906. * @filter_own: Set 1 to filter out multicast packets sent by station itself
  907. * @port_id: Multicast MAC addresses array specifier. This is a strange way
  908. * to identify network interface adopted in host-device IF.
  909. * It is used by FW as index in array of addresses. This array has
  910. * MAX_PORT_ID_NUM members.
  911. * @count: Number of MAC addresses in the array
  912. * @pass_all: Set 1 to pass all multicast packets.
  913. * @bssid: current association BSSID.
  914. * @addr_list: Place holder for array of MAC addresses.
  915. * IMPORTANT: add padding if necessary to ensure DWORD alignment.
  916. */
  917. struct iwl_mcast_filter_cmd {
  918. u8 filter_own;
  919. u8 port_id;
  920. u8 count;
  921. u8 pass_all;
  922. u8 bssid[6];
  923. u8 reserved[2];
  924. u8 addr_list[0];
  925. } __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */
  926. struct mvm_statistics_dbg {
  927. __le32 burst_check;
  928. __le32 burst_count;
  929. __le32 wait_for_silence_timeout_cnt;
  930. __le32 reserved[3];
  931. } __packed; /* STATISTICS_DEBUG_API_S_VER_2 */
  932. struct mvm_statistics_div {
  933. __le32 tx_on_a;
  934. __le32 tx_on_b;
  935. __le32 exec_time;
  936. __le32 probe_time;
  937. __le32 rssi_ant;
  938. __le32 reserved2;
  939. } __packed; /* STATISTICS_SLOW_DIV_API_S_VER_2 */
  940. struct mvm_statistics_general_common {
  941. __le32 temperature; /* radio temperature */
  942. __le32 temperature_m; /* radio voltage */
  943. struct mvm_statistics_dbg dbg;
  944. __le32 sleep_time;
  945. __le32 slots_out;
  946. __le32 slots_idle;
  947. __le32 ttl_timestamp;
  948. struct mvm_statistics_div div;
  949. __le32 rx_enable_counter;
  950. /*
  951. * num_of_sos_states:
  952. * count the number of times we have to re-tune
  953. * in order to get out of bad PHY status
  954. */
  955. __le32 num_of_sos_states;
  956. } __packed; /* STATISTICS_GENERAL_API_S_VER_5 */
  957. struct mvm_statistics_rx_non_phy {
  958. __le32 bogus_cts; /* CTS received when not expecting CTS */
  959. __le32 bogus_ack; /* ACK received when not expecting ACK */
  960. __le32 non_bssid_frames; /* number of frames with BSSID that
  961. * doesn't belong to the STA BSSID */
  962. __le32 filtered_frames; /* count frames that were dumped in the
  963. * filtering process */
  964. __le32 non_channel_beacons; /* beacons with our bss id but not on
  965. * our serving channel */
  966. __le32 channel_beacons; /* beacons with our bss id and in our
  967. * serving channel */
  968. __le32 num_missed_bcon; /* number of missed beacons */
  969. __le32 adc_rx_saturation_time; /* count in 0.8us units the time the
  970. * ADC was in saturation */
  971. __le32 ina_detection_search_time;/* total time (in 0.8us) searched
  972. * for INA */
  973. __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */
  974. __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */
  975. __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */
  976. __le32 interference_data_flag; /* flag for interference data
  977. * availability. 1 when data is
  978. * available. */
  979. __le32 channel_load; /* counts RX Enable time in uSec */
  980. __le32 dsp_false_alarms; /* DSP false alarm (both OFDM
  981. * and CCK) counter */
  982. __le32 beacon_rssi_a;
  983. __le32 beacon_rssi_b;
  984. __le32 beacon_rssi_c;
  985. __le32 beacon_energy_a;
  986. __le32 beacon_energy_b;
  987. __le32 beacon_energy_c;
  988. __le32 num_bt_kills;
  989. __le32 mac_id;
  990. __le32 directed_data_mpdu;
  991. } __packed; /* STATISTICS_RX_NON_PHY_API_S_VER_3 */
  992. struct mvm_statistics_rx_phy {
  993. __le32 ina_cnt;
  994. __le32 fina_cnt;
  995. __le32 plcp_err;
  996. __le32 crc32_err;
  997. __le32 overrun_err;
  998. __le32 early_overrun_err;
  999. __le32 crc32_good;
  1000. __le32 false_alarm_cnt;
  1001. __le32 fina_sync_err_cnt;
  1002. __le32 sfd_timeout;
  1003. __le32 fina_timeout;
  1004. __le32 unresponded_rts;
  1005. __le32 rxe_frame_limit_overrun;
  1006. __le32 sent_ack_cnt;
  1007. __le32 sent_cts_cnt;
  1008. __le32 sent_ba_rsp_cnt;
  1009. __le32 dsp_self_kill;
  1010. __le32 mh_format_err;
  1011. __le32 re_acq_main_rssi_sum;
  1012. __le32 reserved;
  1013. } __packed; /* STATISTICS_RX_PHY_API_S_VER_2 */
  1014. struct mvm_statistics_rx_ht_phy {
  1015. __le32 plcp_err;
  1016. __le32 overrun_err;
  1017. __le32 early_overrun_err;
  1018. __le32 crc32_good;
  1019. __le32 crc32_err;
  1020. __le32 mh_format_err;
  1021. __le32 agg_crc32_good;
  1022. __le32 agg_mpdu_cnt;
  1023. __le32 agg_cnt;
  1024. __le32 unsupport_mcs;
  1025. } __packed; /* STATISTICS_HT_RX_PHY_API_S_VER_1 */
  1026. #define MAX_CHAINS 3
  1027. struct mvm_statistics_tx_non_phy_agg {
  1028. __le32 ba_timeout;
  1029. __le32 ba_reschedule_frames;
  1030. __le32 scd_query_agg_frame_cnt;
  1031. __le32 scd_query_no_agg;
  1032. __le32 scd_query_agg;
  1033. __le32 scd_query_mismatch;
  1034. __le32 frame_not_ready;
  1035. __le32 underrun;
  1036. __le32 bt_prio_kill;
  1037. __le32 rx_ba_rsp_cnt;
  1038. __s8 txpower[MAX_CHAINS];
  1039. __s8 reserved;
  1040. __le32 reserved2;
  1041. } __packed; /* STATISTICS_TX_NON_PHY_AGG_API_S_VER_1 */
  1042. struct mvm_statistics_tx_channel_width {
  1043. __le32 ext_cca_narrow_ch20[1];
  1044. __le32 ext_cca_narrow_ch40[2];
  1045. __le32 ext_cca_narrow_ch80[3];
  1046. __le32 ext_cca_narrow_ch160[4];
  1047. __le32 last_tx_ch_width_indx;
  1048. __le32 rx_detected_per_ch_width[4];
  1049. __le32 success_per_ch_width[4];
  1050. __le32 fail_per_ch_width[4];
  1051. }; /* STATISTICS_TX_CHANNEL_WIDTH_API_S_VER_1 */
  1052. struct mvm_statistics_tx {
  1053. __le32 preamble_cnt;
  1054. __le32 rx_detected_cnt;
  1055. __le32 bt_prio_defer_cnt;
  1056. __le32 bt_prio_kill_cnt;
  1057. __le32 few_bytes_cnt;
  1058. __le32 cts_timeout;
  1059. __le32 ack_timeout;
  1060. __le32 expected_ack_cnt;
  1061. __le32 actual_ack_cnt;
  1062. __le32 dump_msdu_cnt;
  1063. __le32 burst_abort_next_frame_mismatch_cnt;
  1064. __le32 burst_abort_missing_next_frame_cnt;
  1065. __le32 cts_timeout_collision;
  1066. __le32 ack_or_ba_timeout_collision;
  1067. struct mvm_statistics_tx_non_phy_agg agg;
  1068. struct mvm_statistics_tx_channel_width channel_width;
  1069. } __packed; /* STATISTICS_TX_API_S_VER_4 */
  1070. struct mvm_statistics_bt_activity {
  1071. __le32 hi_priority_tx_req_cnt;
  1072. __le32 hi_priority_tx_denied_cnt;
  1073. __le32 lo_priority_tx_req_cnt;
  1074. __le32 lo_priority_tx_denied_cnt;
  1075. __le32 hi_priority_rx_req_cnt;
  1076. __le32 hi_priority_rx_denied_cnt;
  1077. __le32 lo_priority_rx_req_cnt;
  1078. __le32 lo_priority_rx_denied_cnt;
  1079. } __packed; /* STATISTICS_BT_ACTIVITY_API_S_VER_1 */
  1080. struct mvm_statistics_general {
  1081. struct mvm_statistics_general_common common;
  1082. __le32 beacon_filtered;
  1083. __le32 missed_beacons;
  1084. __s8 beacon_filter_everage_energy;
  1085. __s8 beacon_filter_reason;
  1086. __s8 beacon_filter_current_energy;
  1087. __s8 beacon_filter_reserved;
  1088. __le32 beacon_filter_delta_time;
  1089. struct mvm_statistics_bt_activity bt_activity;
  1090. } __packed; /* STATISTICS_GENERAL_API_S_VER_5 */
  1091. struct mvm_statistics_rx {
  1092. struct mvm_statistics_rx_phy ofdm;
  1093. struct mvm_statistics_rx_phy cck;
  1094. struct mvm_statistics_rx_non_phy general;
  1095. struct mvm_statistics_rx_ht_phy ofdm_ht;
  1096. } __packed; /* STATISTICS_RX_API_S_VER_3 */
  1097. /*
  1098. * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
  1099. *
  1100. * By default, uCode issues this notification after receiving a beacon
  1101. * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
  1102. * REPLY_STATISTICS_CMD 0x9c, above.
  1103. *
  1104. * Statistics counters continue to increment beacon after beacon, but are
  1105. * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
  1106. * 0x9c with CLEAR_STATS bit set (see above).
  1107. *
  1108. * uCode also issues this notification during scans. uCode clears statistics
  1109. * appropriately so that each notification contains statistics for only the
  1110. * one channel that has just been scanned.
  1111. */
  1112. struct iwl_notif_statistics { /* STATISTICS_NTFY_API_S_VER_8 */
  1113. __le32 flag;
  1114. struct mvm_statistics_rx rx;
  1115. struct mvm_statistics_tx tx;
  1116. struct mvm_statistics_general general;
  1117. } __packed;
  1118. #endif /* __fw_api_h__ */