fw-api.h 42 KB

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