fw-api.h 36 KB

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