fw-api.h 37 KB

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