fw-api.h 42 KB

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