fw-api.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954
  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 LICENSE.GPL.
  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. /* queue and FIFO numbers by usage */
  72. enum {
  73. IWL_MVM_OFFCHANNEL_QUEUE = 8,
  74. IWL_MVM_CMD_QUEUE = 9,
  75. IWL_MVM_AUX_QUEUE = 15,
  76. IWL_MVM_FIRST_AGG_QUEUE = 16,
  77. IWL_MVM_NUM_QUEUES = 20,
  78. IWL_MVM_LAST_AGG_QUEUE = IWL_MVM_NUM_QUEUES - 1,
  79. IWL_MVM_CMD_FIFO = 7
  80. };
  81. #define IWL_MVM_STATION_COUNT 16
  82. /* commands */
  83. enum {
  84. MVM_ALIVE = 0x1,
  85. REPLY_ERROR = 0x2,
  86. INIT_COMPLETE_NOTIF = 0x4,
  87. /* PHY context commands */
  88. PHY_CONTEXT_CMD = 0x8,
  89. DBG_CFG = 0x9,
  90. /* station table */
  91. ADD_STA = 0x18,
  92. REMOVE_STA = 0x19,
  93. /* TX */
  94. TX_CMD = 0x1c,
  95. TXPATH_FLUSH = 0x1e,
  96. MGMT_MCAST_KEY = 0x1f,
  97. /* global key */
  98. WEP_KEY = 0x20,
  99. /* MAC and Binding commands */
  100. MAC_CONTEXT_CMD = 0x28,
  101. TIME_EVENT_CMD = 0x29, /* both CMD and response */
  102. TIME_EVENT_NOTIFICATION = 0x2a,
  103. BINDING_CONTEXT_CMD = 0x2b,
  104. TIME_QUOTA_CMD = 0x2c,
  105. LQ_CMD = 0x4e,
  106. /* Calibration */
  107. TEMPERATURE_NOTIFICATION = 0x62,
  108. CALIBRATION_CFG_CMD = 0x65,
  109. CALIBRATION_RES_NOTIFICATION = 0x66,
  110. CALIBRATION_COMPLETE_NOTIFICATION = 0x67,
  111. RADIO_VERSION_NOTIFICATION = 0x68,
  112. /* Scan offload */
  113. SCAN_OFFLOAD_REQUEST_CMD = 0x51,
  114. SCAN_OFFLOAD_ABORT_CMD = 0x52,
  115. SCAN_OFFLOAD_COMPLETE = 0x6D,
  116. SCAN_OFFLOAD_UPDATE_PROFILES_CMD = 0x6E,
  117. SCAN_OFFLOAD_CONFIG_CMD = 0x6f,
  118. /* Phy */
  119. PHY_CONFIGURATION_CMD = 0x6a,
  120. CALIB_RES_NOTIF_PHY_DB = 0x6b,
  121. /* PHY_DB_CMD = 0x6c, */
  122. /* Power */
  123. POWER_TABLE_CMD = 0x77,
  124. /* Scanning */
  125. SCAN_REQUEST_CMD = 0x80,
  126. SCAN_ABORT_CMD = 0x81,
  127. SCAN_START_NOTIFICATION = 0x82,
  128. SCAN_RESULTS_NOTIFICATION = 0x83,
  129. SCAN_COMPLETE_NOTIFICATION = 0x84,
  130. /* NVM */
  131. NVM_ACCESS_CMD = 0x88,
  132. SET_CALIB_DEFAULT_CMD = 0x8e,
  133. BEACON_TEMPLATE_CMD = 0x91,
  134. TX_ANT_CONFIGURATION_CMD = 0x98,
  135. STATISTICS_NOTIFICATION = 0x9d,
  136. /* RF-KILL commands and notifications */
  137. CARD_STATE_CMD = 0xa0,
  138. CARD_STATE_NOTIFICATION = 0xa1,
  139. REPLY_RX_PHY_CMD = 0xc0,
  140. REPLY_RX_MPDU_CMD = 0xc1,
  141. BA_NOTIF = 0xc5,
  142. REPLY_DEBUG_CMD = 0xf0,
  143. DEBUG_LOG_MSG = 0xf7,
  144. /* D3 commands/notifications */
  145. D3_CONFIG_CMD = 0xd3,
  146. PROT_OFFLOAD_CONFIG_CMD = 0xd4,
  147. OFFLOADS_QUERY_CMD = 0xd5,
  148. REMOTE_WAKE_CONFIG_CMD = 0xd6,
  149. /* for WoWLAN in particular */
  150. WOWLAN_PATTERNS = 0xe0,
  151. WOWLAN_CONFIGURATION = 0xe1,
  152. WOWLAN_TSC_RSC_PARAM = 0xe2,
  153. WOWLAN_TKIP_PARAM = 0xe3,
  154. WOWLAN_KEK_KCK_MATERIAL = 0xe4,
  155. WOWLAN_GET_STATUSES = 0xe5,
  156. WOWLAN_TX_POWER_PER_DB = 0xe6,
  157. /* and for NetDetect */
  158. NET_DETECT_CONFIG_CMD = 0x54,
  159. NET_DETECT_PROFILES_QUERY_CMD = 0x56,
  160. NET_DETECT_PROFILES_CMD = 0x57,
  161. NET_DETECT_HOTSPOTS_CMD = 0x58,
  162. NET_DETECT_HOTSPOTS_QUERY_CMD = 0x59,
  163. REPLY_MAX = 0xff,
  164. };
  165. /**
  166. * struct iwl_cmd_response - generic response struct for most commands
  167. * @status: status of the command asked, changes for each one
  168. */
  169. struct iwl_cmd_response {
  170. __le32 status;
  171. };
  172. /*
  173. * struct iwl_tx_ant_cfg_cmd
  174. * @valid: valid antenna configuration
  175. */
  176. struct iwl_tx_ant_cfg_cmd {
  177. __le32 valid;
  178. } __packed;
  179. /*
  180. * Calibration control struct.
  181. * Sent as part of the phy configuration command.
  182. * @flow_trigger: bitmap for which calibrations to perform according to
  183. * flow triggers.
  184. * @event_trigger: bitmap for which calibrations to perform according to
  185. * event triggers.
  186. */
  187. struct iwl_calib_ctrl {
  188. __le32 flow_trigger;
  189. __le32 event_trigger;
  190. } __packed;
  191. /* This enum defines the bitmap of various calibrations to enable in both
  192. * init ucode and runtime ucode through CALIBRATION_CFG_CMD.
  193. */
  194. enum iwl_calib_cfg {
  195. IWL_CALIB_CFG_XTAL_IDX = BIT(0),
  196. IWL_CALIB_CFG_TEMPERATURE_IDX = BIT(1),
  197. IWL_CALIB_CFG_VOLTAGE_READ_IDX = BIT(2),
  198. IWL_CALIB_CFG_PAPD_IDX = BIT(3),
  199. IWL_CALIB_CFG_TX_PWR_IDX = BIT(4),
  200. IWL_CALIB_CFG_DC_IDX = BIT(5),
  201. IWL_CALIB_CFG_BB_FILTER_IDX = BIT(6),
  202. IWL_CALIB_CFG_LO_LEAKAGE_IDX = BIT(7),
  203. IWL_CALIB_CFG_TX_IQ_IDX = BIT(8),
  204. IWL_CALIB_CFG_TX_IQ_SKEW_IDX = BIT(9),
  205. IWL_CALIB_CFG_RX_IQ_IDX = BIT(10),
  206. IWL_CALIB_CFG_RX_IQ_SKEW_IDX = BIT(11),
  207. IWL_CALIB_CFG_SENSITIVITY_IDX = BIT(12),
  208. IWL_CALIB_CFG_CHAIN_NOISE_IDX = BIT(13),
  209. IWL_CALIB_CFG_DISCONNECTED_ANT_IDX = BIT(14),
  210. IWL_CALIB_CFG_ANT_COUPLING_IDX = BIT(15),
  211. IWL_CALIB_CFG_DAC_IDX = BIT(16),
  212. IWL_CALIB_CFG_ABS_IDX = BIT(17),
  213. IWL_CALIB_CFG_AGC_IDX = BIT(18),
  214. };
  215. /*
  216. * Phy configuration command.
  217. */
  218. struct iwl_phy_cfg_cmd {
  219. __le32 phy_cfg;
  220. struct iwl_calib_ctrl calib_control;
  221. } __packed;
  222. #define PHY_CFG_RADIO_TYPE (BIT(0) | BIT(1))
  223. #define PHY_CFG_RADIO_STEP (BIT(2) | BIT(3))
  224. #define PHY_CFG_RADIO_DASH (BIT(4) | BIT(5))
  225. #define PHY_CFG_PRODUCT_NUMBER (BIT(6) | BIT(7))
  226. #define PHY_CFG_TX_CHAIN_A BIT(8)
  227. #define PHY_CFG_TX_CHAIN_B BIT(9)
  228. #define PHY_CFG_TX_CHAIN_C BIT(10)
  229. #define PHY_CFG_RX_CHAIN_A BIT(12)
  230. #define PHY_CFG_RX_CHAIN_B BIT(13)
  231. #define PHY_CFG_RX_CHAIN_C BIT(14)
  232. /* Target of the NVM_ACCESS_CMD */
  233. enum {
  234. NVM_ACCESS_TARGET_CACHE = 0,
  235. NVM_ACCESS_TARGET_OTP = 1,
  236. NVM_ACCESS_TARGET_EEPROM = 2,
  237. };
  238. /**
  239. * struct iwl_nvm_access_cmd_ver1 - Request the device to send the NVM.
  240. * @op_code: 0 - read, 1 - write.
  241. * @target: NVM_ACCESS_TARGET_*. should be 0 for read.
  242. * @cache_refresh: 0 - None, 1- NVM.
  243. * @offset: offset in the nvm data.
  244. * @length: of the chunk.
  245. * @data: empty on read, the NVM chunk on write
  246. */
  247. struct iwl_nvm_access_cmd_ver1 {
  248. u8 op_code;
  249. u8 target;
  250. u8 cache_refresh;
  251. u8 reserved;
  252. __le16 offset;
  253. __le16 length;
  254. u8 data[];
  255. } __packed; /* NVM_ACCESS_CMD_API_S_VER_1 */
  256. /**
  257. * struct iwl_nvm_access_resp_ver1 - response to NVM_ACCESS_CMD
  258. * @offset: the offset in the nvm data
  259. * @length: of the chunk
  260. * @data: the nvm chunk on when NVM_ACCESS_CMD was read, nothing on write
  261. */
  262. struct iwl_nvm_access_resp_ver1 {
  263. __le16 offset;
  264. __le16 length;
  265. u8 data[];
  266. } __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_1 */
  267. /* Section types for NVM_ACCESS_CMD version 2 */
  268. enum {
  269. NVM_SECTION_TYPE_HW = 0,
  270. NVM_SECTION_TYPE_SW,
  271. NVM_SECTION_TYPE_PAPD,
  272. NVM_SECTION_TYPE_BT,
  273. NVM_SECTION_TYPE_CALIBRATION,
  274. NVM_SECTION_TYPE_PRODUCTION,
  275. NVM_SECTION_TYPE_POST_FCS_CALIB,
  276. NVM_NUM_OF_SECTIONS,
  277. };
  278. /**
  279. * struct iwl_nvm_access_cmd_ver2 - Request the device to send an NVM section
  280. * @op_code: 0 - read, 1 - write
  281. * @target: NVM_ACCESS_TARGET_*
  282. * @type: NVM_SECTION_TYPE_*
  283. * @offset: offset in bytes into the section
  284. * @length: in bytes, to read/write
  285. * @data: if write operation, the data to write. On read its empty
  286. */
  287. struct iwl_nvm_access_cmd_ver2 {
  288. u8 op_code;
  289. u8 target;
  290. __le16 type;
  291. __le16 offset;
  292. __le16 length;
  293. u8 data[];
  294. } __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */
  295. /**
  296. * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD
  297. * @offset: offset in bytes into the section
  298. * @length: in bytes, either how much was written or read
  299. * @type: NVM_SECTION_TYPE_*
  300. * @status: 0 for success, fail otherwise
  301. * @data: if read operation, the data returned. Empty on write.
  302. */
  303. struct iwl_nvm_access_resp_ver2 {
  304. __le16 offset;
  305. __le16 length;
  306. __le16 type;
  307. __le16 status;
  308. u8 data[];
  309. } __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */
  310. /* MVM_ALIVE 0x1 */
  311. /* alive response is_valid values */
  312. #define ALIVE_RESP_UCODE_OK BIT(0)
  313. #define ALIVE_RESP_RFKILL BIT(1)
  314. /* alive response ver_type values */
  315. enum {
  316. FW_TYPE_HW = 0,
  317. FW_TYPE_PROT = 1,
  318. FW_TYPE_AP = 2,
  319. FW_TYPE_WOWLAN = 3,
  320. FW_TYPE_TIMING = 4,
  321. FW_TYPE_WIPAN = 5
  322. };
  323. /* alive response ver_subtype values */
  324. enum {
  325. FW_SUBTYPE_FULL_FEATURE = 0,
  326. FW_SUBTYPE_BOOTSRAP = 1, /* Not valid */
  327. FW_SUBTYPE_REDUCED = 2,
  328. FW_SUBTYPE_ALIVE_ONLY = 3,
  329. FW_SUBTYPE_WOWLAN = 4,
  330. FW_SUBTYPE_AP_SUBTYPE = 5,
  331. FW_SUBTYPE_WIPAN = 6,
  332. FW_SUBTYPE_INITIALIZE = 9
  333. };
  334. #define IWL_ALIVE_STATUS_ERR 0xDEAD
  335. #define IWL_ALIVE_STATUS_OK 0xCAFE
  336. #define IWL_ALIVE_FLG_RFKILL BIT(0)
  337. struct mvm_alive_resp {
  338. __le16 status;
  339. __le16 flags;
  340. u8 ucode_minor;
  341. u8 ucode_major;
  342. __le16 id;
  343. u8 api_minor;
  344. u8 api_major;
  345. u8 ver_subtype;
  346. u8 ver_type;
  347. u8 mac;
  348. u8 opt;
  349. __le16 reserved2;
  350. __le32 timestamp;
  351. __le32 error_event_table_ptr; /* SRAM address for error log */
  352. __le32 log_event_table_ptr; /* SRAM address for event log */
  353. __le32 cpu_register_ptr;
  354. __le32 dbgm_config_ptr;
  355. __le32 alive_counter_ptr;
  356. __le32 scd_base_ptr; /* SRAM address for SCD */
  357. } __packed; /* ALIVE_RES_API_S_VER_1 */
  358. /* Error response/notification */
  359. enum {
  360. FW_ERR_UNKNOWN_CMD = 0x0,
  361. FW_ERR_INVALID_CMD_PARAM = 0x1,
  362. FW_ERR_SERVICE = 0x2,
  363. FW_ERR_ARC_MEMORY = 0x3,
  364. FW_ERR_ARC_CODE = 0x4,
  365. FW_ERR_WATCH_DOG = 0x5,
  366. FW_ERR_WEP_GRP_KEY_INDX = 0x10,
  367. FW_ERR_WEP_KEY_SIZE = 0x11,
  368. FW_ERR_OBSOLETE_FUNC = 0x12,
  369. FW_ERR_UNEXPECTED = 0xFE,
  370. FW_ERR_FATAL = 0xFF
  371. };
  372. /**
  373. * struct iwl_error_resp - FW error indication
  374. * ( REPLY_ERROR = 0x2 )
  375. * @error_type: one of FW_ERR_*
  376. * @cmd_id: the command ID for which the error occured
  377. * @bad_cmd_seq_num: sequence number of the erroneous command
  378. * @error_service: which service created the error, applicable only if
  379. * error_type = 2, otherwise 0
  380. * @timestamp: TSF in usecs.
  381. */
  382. struct iwl_error_resp {
  383. __le32 error_type;
  384. u8 cmd_id;
  385. u8 reserved1;
  386. __le16 bad_cmd_seq_num;
  387. __le32 error_service;
  388. __le64 timestamp;
  389. } __packed;
  390. /* Common PHY, MAC and Bindings definitions */
  391. #define MAX_MACS_IN_BINDING (3)
  392. #define MAX_BINDINGS (4)
  393. #define AUX_BINDING_INDEX (3)
  394. #define MAX_PHYS (4)
  395. /* Used to extract ID and color from the context dword */
  396. #define FW_CTXT_ID_POS (0)
  397. #define FW_CTXT_ID_MSK (0xff << FW_CTXT_ID_POS)
  398. #define FW_CTXT_COLOR_POS (8)
  399. #define FW_CTXT_COLOR_MSK (0xff << FW_CTXT_COLOR_POS)
  400. #define FW_CTXT_INVALID (0xffffffff)
  401. #define FW_CMD_ID_AND_COLOR(_id, _color) ((_id << FW_CTXT_ID_POS) |\
  402. (_color << FW_CTXT_COLOR_POS))
  403. /* Possible actions on PHYs, MACs and Bindings */
  404. enum {
  405. FW_CTXT_ACTION_STUB = 0,
  406. FW_CTXT_ACTION_ADD,
  407. FW_CTXT_ACTION_MODIFY,
  408. FW_CTXT_ACTION_REMOVE,
  409. FW_CTXT_ACTION_NUM
  410. }; /* COMMON_CONTEXT_ACTION_API_E_VER_1 */
  411. /* Time Events */
  412. /* Time Event types, according to MAC type */
  413. enum iwl_time_event_type {
  414. /* BSS Station Events */
  415. TE_BSS_STA_AGGRESSIVE_ASSOC,
  416. TE_BSS_STA_ASSOC,
  417. TE_BSS_EAP_DHCP_PROT,
  418. TE_BSS_QUIET_PERIOD,
  419. /* P2P Device Events */
  420. TE_P2P_DEVICE_DISCOVERABLE,
  421. TE_P2P_DEVICE_LISTEN,
  422. TE_P2P_DEVICE_ACTION_SCAN,
  423. TE_P2P_DEVICE_FULL_SCAN,
  424. /* P2P Client Events */
  425. TE_P2P_CLIENT_AGGRESSIVE_ASSOC,
  426. TE_P2P_CLIENT_ASSOC,
  427. TE_P2P_CLIENT_QUIET_PERIOD,
  428. /* P2P GO Events */
  429. TE_P2P_GO_ASSOC_PROT,
  430. TE_P2P_GO_REPETITIVE_NOA,
  431. TE_P2P_GO_CT_WINDOW,
  432. /* WiDi Sync Events */
  433. TE_WIDI_TX_SYNC,
  434. TE_MAX
  435. }; /* MAC_EVENT_TYPE_API_E_VER_1 */
  436. /* Time Event dependencies: none, on another TE, or in a specific time */
  437. enum {
  438. TE_INDEPENDENT = 0,
  439. TE_DEP_OTHER = 1,
  440. TE_DEP_TSF = 2,
  441. TE_EVENT_SOCIOPATHIC = 4,
  442. }; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */
  443. /* When to send Time Event notifications and to whom (internal = FW) */
  444. enum {
  445. TE_NOTIF_NONE = 0,
  446. TE_NOTIF_HOST_START = 0x1,
  447. TE_NOTIF_HOST_END = 0x2,
  448. TE_NOTIF_INTERNAL_START = 0x4,
  449. TE_NOTIF_INTERNAL_END = 0x8
  450. }; /* MAC_EVENT_ACTION_API_E_VER_1 */
  451. /*
  452. * @TE_FRAG_NONE: fragmentation of the time event is NOT allowed.
  453. * @TE_FRAG_SINGLE: fragmentation of the time event is allowed, but only
  454. * the first fragment is scheduled.
  455. * @TE_FRAG_DUAL: fragmentation of the time event is allowed, but only
  456. * the first 2 fragments are scheduled.
  457. * @TE_FRAG_ENDLESS: fragmentation of the time event is allowed, and any number
  458. * of fragments are valid.
  459. *
  460. * Other than the constant defined above, specifying a fragmentation value 'x'
  461. * means that the event can be fragmented but only the first 'x' will be
  462. * scheduled.
  463. */
  464. enum {
  465. TE_FRAG_NONE = 0,
  466. TE_FRAG_SINGLE = 1,
  467. TE_FRAG_DUAL = 2,
  468. TE_FRAG_ENDLESS = 0xffffffff
  469. };
  470. /* Repeat the time event endlessly (until removed) */
  471. #define TE_REPEAT_ENDLESS (0xffffffff)
  472. /* If a Time Event has bounded repetitions, this is the maximal value */
  473. #define TE_REPEAT_MAX_MSK (0x0fffffff)
  474. /* If a Time Event can be fragmented, this is the max number of fragments */
  475. #define TE_FRAG_MAX_MSK (0x0fffffff)
  476. /**
  477. * struct iwl_time_event_cmd - configuring Time Events
  478. * ( TIME_EVENT_CMD = 0x29 )
  479. * @id_and_color: ID and color of the relevant MAC
  480. * @action: action to perform, one of FW_CTXT_ACTION_*
  481. * @id: this field has two meanings, depending on the action:
  482. * If the action is ADD, then it means the type of event to add.
  483. * For all other actions it is the unique event ID assigned when the
  484. * event was added by the FW.
  485. * @apply_time: When to start the Time Event (in GP2)
  486. * @max_delay: maximum delay to event's start (apply time), in TU
  487. * @depends_on: the unique ID of the event we depend on (if any)
  488. * @interval: interval between repetitions, in TU
  489. * @interval_reciprocal: 2^32 / interval
  490. * @duration: duration of event in TU
  491. * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS
  492. * @dep_policy: one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF
  493. * @is_present: 0 or 1, are we present or absent during the Time Event
  494. * @max_frags: maximal number of fragments the Time Event can be divided to
  495. * @notify: notifications using TE_NOTIF_* (whom to notify when)
  496. */
  497. struct iwl_time_event_cmd {
  498. /* COMMON_INDEX_HDR_API_S_VER_1 */
  499. __le32 id_and_color;
  500. __le32 action;
  501. __le32 id;
  502. /* MAC_TIME_EVENT_DATA_API_S_VER_1 */
  503. __le32 apply_time;
  504. __le32 max_delay;
  505. __le32 dep_policy;
  506. __le32 depends_on;
  507. __le32 is_present;
  508. __le32 max_frags;
  509. __le32 interval;
  510. __le32 interval_reciprocal;
  511. __le32 duration;
  512. __le32 repeat;
  513. __le32 notify;
  514. } __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_1 */
  515. /**
  516. * struct iwl_time_event_resp - response structure to iwl_time_event_cmd
  517. * @status: bit 0 indicates success, all others specify errors
  518. * @id: the Time Event type
  519. * @unique_id: the unique ID assigned (in ADD) or given (others) to the TE
  520. * @id_and_color: ID and color of the relevant MAC
  521. */
  522. struct iwl_time_event_resp {
  523. __le32 status;
  524. __le32 id;
  525. __le32 unique_id;
  526. __le32 id_and_color;
  527. } __packed; /* MAC_TIME_EVENT_RSP_API_S_VER_1 */
  528. /**
  529. * struct iwl_time_event_notif - notifications of time event start/stop
  530. * ( TIME_EVENT_NOTIFICATION = 0x2a )
  531. * @timestamp: action timestamp in GP2
  532. * @session_id: session's unique id
  533. * @unique_id: unique id of the Time Event itself
  534. * @id_and_color: ID and color of the relevant MAC
  535. * @action: one of TE_NOTIF_START or TE_NOTIF_END
  536. * @status: true if scheduled, false otherwise (not executed)
  537. */
  538. struct iwl_time_event_notif {
  539. __le32 timestamp;
  540. __le32 session_id;
  541. __le32 unique_id;
  542. __le32 id_and_color;
  543. __le32 action;
  544. __le32 status;
  545. } __packed; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */
  546. /* Bindings and Time Quota */
  547. /**
  548. * struct iwl_binding_cmd - configuring bindings
  549. * ( BINDING_CONTEXT_CMD = 0x2b )
  550. * @id_and_color: ID and color of the relevant Binding
  551. * @action: action to perform, one of FW_CTXT_ACTION_*
  552. * @macs: array of MAC id and colors which belong to the binding
  553. * @phy: PHY id and color which belongs to the binding
  554. */
  555. struct iwl_binding_cmd {
  556. /* COMMON_INDEX_HDR_API_S_VER_1 */
  557. __le32 id_and_color;
  558. __le32 action;
  559. /* BINDING_DATA_API_S_VER_1 */
  560. __le32 macs[MAX_MACS_IN_BINDING];
  561. __le32 phy;
  562. } __packed; /* BINDING_CMD_API_S_VER_1 */
  563. /* The maximal number of fragments in the FW's schedule session */
  564. #define IWL_MVM_MAX_QUOTA 128
  565. /**
  566. * struct iwl_time_quota_data - configuration of time quota per binding
  567. * @id_and_color: ID and color of the relevant Binding
  568. * @quota: absolute time quota in TU. The scheduler will try to divide the
  569. * remainig quota (after Time Events) according to this quota.
  570. * @max_duration: max uninterrupted context duration in TU
  571. */
  572. struct iwl_time_quota_data {
  573. __le32 id_and_color;
  574. __le32 quota;
  575. __le32 max_duration;
  576. } __packed; /* TIME_QUOTA_DATA_API_S_VER_1 */
  577. /**
  578. * struct iwl_time_quota_cmd - configuration of time quota between bindings
  579. * ( TIME_QUOTA_CMD = 0x2c )
  580. * @quotas: allocations per binding
  581. */
  582. struct iwl_time_quota_cmd {
  583. struct iwl_time_quota_data quotas[MAX_BINDINGS];
  584. } __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_1 */
  585. /* PHY context */
  586. /* Supported bands */
  587. #define PHY_BAND_5 (0)
  588. #define PHY_BAND_24 (1)
  589. /* Supported channel width, vary if there is VHT support */
  590. #define PHY_VHT_CHANNEL_MODE20 (0x0)
  591. #define PHY_VHT_CHANNEL_MODE40 (0x1)
  592. #define PHY_VHT_CHANNEL_MODE80 (0x2)
  593. #define PHY_VHT_CHANNEL_MODE160 (0x3)
  594. /*
  595. * Control channel position:
  596. * For legacy set bit means upper channel, otherwise lower.
  597. * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
  598. * bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
  599. * center_freq
  600. * |
  601. * 40Mhz |_______|_______|
  602. * 80Mhz |_______|_______|_______|_______|
  603. * 160Mhz |_______|_______|_______|_______|_______|_______|_______|_______|
  604. * code 011 010 001 000 | 100 101 110 111
  605. */
  606. #define PHY_VHT_CTRL_POS_1_BELOW (0x0)
  607. #define PHY_VHT_CTRL_POS_2_BELOW (0x1)
  608. #define PHY_VHT_CTRL_POS_3_BELOW (0x2)
  609. #define PHY_VHT_CTRL_POS_4_BELOW (0x3)
  610. #define PHY_VHT_CTRL_POS_1_ABOVE (0x4)
  611. #define PHY_VHT_CTRL_POS_2_ABOVE (0x5)
  612. #define PHY_VHT_CTRL_POS_3_ABOVE (0x6)
  613. #define PHY_VHT_CTRL_POS_4_ABOVE (0x7)
  614. /*
  615. * @band: PHY_BAND_*
  616. * @channel: channel number
  617. * @width: PHY_[VHT|LEGACY]_CHANNEL_*
  618. * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
  619. */
  620. struct iwl_fw_channel_info {
  621. u8 band;
  622. u8 channel;
  623. u8 width;
  624. u8 ctrl_pos;
  625. } __packed;
  626. #define PHY_RX_CHAIN_DRIVER_FORCE_POS (0)
  627. #define PHY_RX_CHAIN_DRIVER_FORCE_MSK \
  628. (0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS)
  629. #define PHY_RX_CHAIN_VALID_POS (1)
  630. #define PHY_RX_CHAIN_VALID_MSK \
  631. (0x7 << PHY_RX_CHAIN_VALID_POS)
  632. #define PHY_RX_CHAIN_FORCE_SEL_POS (4)
  633. #define PHY_RX_CHAIN_FORCE_SEL_MSK \
  634. (0x7 << PHY_RX_CHAIN_FORCE_SEL_POS)
  635. #define PHY_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
  636. #define PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \
  637. (0x7 << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS)
  638. #define PHY_RX_CHAIN_CNT_POS (10)
  639. #define PHY_RX_CHAIN_CNT_MSK \
  640. (0x3 << PHY_RX_CHAIN_CNT_POS)
  641. #define PHY_RX_CHAIN_MIMO_CNT_POS (12)
  642. #define PHY_RX_CHAIN_MIMO_CNT_MSK \
  643. (0x3 << PHY_RX_CHAIN_MIMO_CNT_POS)
  644. #define PHY_RX_CHAIN_MIMO_FORCE_POS (14)
  645. #define PHY_RX_CHAIN_MIMO_FORCE_MSK \
  646. (0x1 << PHY_RX_CHAIN_MIMO_FORCE_POS)
  647. /* TODO: fix the value, make it depend on firmware at runtime? */
  648. #define NUM_PHY_CTX 3
  649. /* TODO: complete missing documentation */
  650. /**
  651. * struct iwl_phy_context_cmd - config of the PHY context
  652. * ( PHY_CONTEXT_CMD = 0x8 )
  653. * @id_and_color: ID and color of the relevant Binding
  654. * @action: action to perform, one of FW_CTXT_ACTION_*
  655. * @apply_time: 0 means immediate apply and context switch.
  656. * other value means apply new params after X usecs
  657. * @tx_param_color: ???
  658. * @channel_info:
  659. * @txchain_info: ???
  660. * @rxchain_info: ???
  661. * @acquisition_data: ???
  662. * @dsp_cfg_flags: set to 0
  663. */
  664. struct iwl_phy_context_cmd {
  665. /* COMMON_INDEX_HDR_API_S_VER_1 */
  666. __le32 id_and_color;
  667. __le32 action;
  668. /* PHY_CONTEXT_DATA_API_S_VER_1 */
  669. __le32 apply_time;
  670. __le32 tx_param_color;
  671. struct iwl_fw_channel_info ci;
  672. __le32 txchain_info;
  673. __le32 rxchain_info;
  674. __le32 acquisition_data;
  675. __le32 dsp_cfg_flags;
  676. } __packed; /* PHY_CONTEXT_CMD_API_VER_1 */
  677. #define IWL_RX_INFO_PHY_CNT 8
  678. #define IWL_RX_INFO_AGC_IDX 1
  679. #define IWL_RX_INFO_RSSI_AB_IDX 2
  680. #define IWL_OFDM_AGC_A_MSK 0x0000007f
  681. #define IWL_OFDM_AGC_A_POS 0
  682. #define IWL_OFDM_AGC_B_MSK 0x00003f80
  683. #define IWL_OFDM_AGC_B_POS 7
  684. #define IWL_OFDM_AGC_CODE_MSK 0x3fe00000
  685. #define IWL_OFDM_AGC_CODE_POS 20
  686. #define IWL_OFDM_RSSI_INBAND_A_MSK 0x00ff
  687. #define IWL_OFDM_RSSI_A_POS 0
  688. #define IWL_OFDM_RSSI_ALLBAND_A_MSK 0xff00
  689. #define IWL_OFDM_RSSI_ALLBAND_A_POS 8
  690. #define IWL_OFDM_RSSI_INBAND_B_MSK 0xff0000
  691. #define IWL_OFDM_RSSI_B_POS 16
  692. #define IWL_OFDM_RSSI_ALLBAND_B_MSK 0xff000000
  693. #define IWL_OFDM_RSSI_ALLBAND_B_POS 24
  694. /**
  695. * struct iwl_rx_phy_info - phy info
  696. * (REPLY_RX_PHY_CMD = 0xc0)
  697. * @non_cfg_phy_cnt: non configurable DSP phy data byte count
  698. * @cfg_phy_cnt: configurable DSP phy data byte count
  699. * @stat_id: configurable DSP phy data set ID
  700. * @reserved1:
  701. * @system_timestamp: GP2 at on air rise
  702. * @timestamp: TSF at on air rise
  703. * @beacon_time_stamp: beacon at on-air rise
  704. * @phy_flags: general phy flags: band, modulation, ...
  705. * @channel: channel number
  706. * @non_cfg_phy_buf: for various implementations of non_cfg_phy
  707. * @rate_n_flags: RATE_MCS_*
  708. * @byte_count: frame's byte-count
  709. * @frame_time: frame's time on the air, based on byte count and frame rate
  710. * calculation
  711. *
  712. * Before each Rx, the device sends this data. It contains PHY information
  713. * about the reception of the packet.
  714. */
  715. struct iwl_rx_phy_info {
  716. u8 non_cfg_phy_cnt;
  717. u8 cfg_phy_cnt;
  718. u8 stat_id;
  719. u8 reserved1;
  720. __le32 system_timestamp;
  721. __le64 timestamp;
  722. __le32 beacon_time_stamp;
  723. __le16 phy_flags;
  724. __le16 channel;
  725. __le32 non_cfg_phy[IWL_RX_INFO_PHY_CNT];
  726. __le32 rate_n_flags;
  727. __le32 byte_count;
  728. __le16 reserved2;
  729. __le16 frame_time;
  730. } __packed;
  731. struct iwl_rx_mpdu_res_start {
  732. __le16 byte_count;
  733. __le16 reserved;
  734. } __packed;
  735. /**
  736. * enum iwl_rx_phy_flags - to parse %iwl_rx_phy_info phy_flags
  737. * @RX_RES_PHY_FLAGS_BAND_24: true if the packet was received on 2.4 band
  738. * @RX_RES_PHY_FLAGS_MOD_CCK:
  739. * @RX_RES_PHY_FLAGS_SHORT_PREAMBLE: true if packet's preamble was short
  740. * @RX_RES_PHY_FLAGS_NARROW_BAND:
  741. * @RX_RES_PHY_FLAGS_ANTENNA: antenna on which the packet was received
  742. * @RX_RES_PHY_FLAGS_AGG: set if the packet was part of an A-MPDU
  743. * @RX_RES_PHY_FLAGS_OFDM_HT: The frame was an HT frame
  744. * @RX_RES_PHY_FLAGS_OFDM_GF: The frame used GF preamble
  745. * @RX_RES_PHY_FLAGS_OFDM_VHT: The frame was a VHT frame
  746. */
  747. enum iwl_rx_phy_flags {
  748. RX_RES_PHY_FLAGS_BAND_24 = BIT(0),
  749. RX_RES_PHY_FLAGS_MOD_CCK = BIT(1),
  750. RX_RES_PHY_FLAGS_SHORT_PREAMBLE = BIT(2),
  751. RX_RES_PHY_FLAGS_NARROW_BAND = BIT(3),
  752. RX_RES_PHY_FLAGS_ANTENNA = (0x7 << 4),
  753. RX_RES_PHY_FLAGS_ANTENNA_POS = 4,
  754. RX_RES_PHY_FLAGS_AGG = BIT(7),
  755. RX_RES_PHY_FLAGS_OFDM_HT = BIT(8),
  756. RX_RES_PHY_FLAGS_OFDM_GF = BIT(9),
  757. RX_RES_PHY_FLAGS_OFDM_VHT = BIT(10),
  758. };
  759. /**
  760. * enum iwl_mvm_rx_status - written by fw for each Rx packet
  761. * @RX_MPDU_RES_STATUS_CRC_OK: CRC is fine
  762. * @RX_MPDU_RES_STATUS_OVERRUN_OK: there was no RXE overflow
  763. * @RX_MPDU_RES_STATUS_SRC_STA_FOUND:
  764. * @RX_MPDU_RES_STATUS_KEY_VALID:
  765. * @RX_MPDU_RES_STATUS_KEY_PARAM_OK:
  766. * @RX_MPDU_RES_STATUS_ICV_OK: ICV is fine, if not, the packet is destroyed
  767. * @RX_MPDU_RES_STATUS_MIC_OK: used for CCM alg only. TKIP MIC is checked
  768. * in the driver.
  769. * @RX_MPDU_RES_STATUS_TTAK_OK: TTAK is fine
  770. * @RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR: valid for alg = CCM_CMAC or
  771. * alg = CCM only. Checks replay attack for 11w frames. Relevant only if
  772. * %RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME is set.
  773. * @RX_MPDU_RES_STATUS_SEC_NO_ENC: this frame is not encrypted
  774. * @RX_MPDU_RES_STATUS_SEC_WEP_ENC: this frame is encrypted using WEP
  775. * @RX_MPDU_RES_STATUS_SEC_CCM_ENC: this frame is encrypted using CCM
  776. * @RX_MPDU_RES_STATUS_SEC_TKIP_ENC: this frame is encrypted using TKIP
  777. * @RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC: this frame is encrypted using CCM_CMAC
  778. * @RX_MPDU_RES_STATUS_SEC_ENC_ERR: this frame couldn't be decrypted
  779. * @RX_MPDU_RES_STATUS_SEC_ENC_MSK: bitmask of the encryption algorithm
  780. * @RX_MPDU_RES_STATUS_DEC_DONE: this frame has been successfully decrypted
  781. * @RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP:
  782. * @RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP:
  783. * @RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT:
  784. * @RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME: this frame is an 11w management frame
  785. * @RX_MPDU_RES_STATUS_HASH_INDEX_MSK:
  786. * @RX_MPDU_RES_STATUS_STA_ID_MSK:
  787. * @RX_MPDU_RES_STATUS_RRF_KILL:
  788. * @RX_MPDU_RES_STATUS_FILTERING_MSK:
  789. * @RX_MPDU_RES_STATUS2_FILTERING_MSK:
  790. */
  791. enum iwl_mvm_rx_status {
  792. RX_MPDU_RES_STATUS_CRC_OK = BIT(0),
  793. RX_MPDU_RES_STATUS_OVERRUN_OK = BIT(1),
  794. RX_MPDU_RES_STATUS_SRC_STA_FOUND = BIT(2),
  795. RX_MPDU_RES_STATUS_KEY_VALID = BIT(3),
  796. RX_MPDU_RES_STATUS_KEY_PARAM_OK = BIT(4),
  797. RX_MPDU_RES_STATUS_ICV_OK = BIT(5),
  798. RX_MPDU_RES_STATUS_MIC_OK = BIT(6),
  799. RX_MPDU_RES_STATUS_TTAK_OK = BIT(7),
  800. RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR = BIT(7),
  801. RX_MPDU_RES_STATUS_SEC_NO_ENC = (0 << 8),
  802. RX_MPDU_RES_STATUS_SEC_WEP_ENC = (1 << 8),
  803. RX_MPDU_RES_STATUS_SEC_CCM_ENC = (2 << 8),
  804. RX_MPDU_RES_STATUS_SEC_TKIP_ENC = (3 << 8),
  805. RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC = (6 << 8),
  806. RX_MPDU_RES_STATUS_SEC_ENC_ERR = (7 << 8),
  807. RX_MPDU_RES_STATUS_SEC_ENC_MSK = (7 << 8),
  808. RX_MPDU_RES_STATUS_DEC_DONE = BIT(11),
  809. RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP = BIT(12),
  810. RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP = BIT(13),
  811. RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT = BIT(14),
  812. RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME = BIT(15),
  813. RX_MPDU_RES_STATUS_HASH_INDEX_MSK = (0x3F0000),
  814. RX_MPDU_RES_STATUS_STA_ID_MSK = (0x1f000000),
  815. RX_MPDU_RES_STATUS_RRF_KILL = BIT(29),
  816. RX_MPDU_RES_STATUS_FILTERING_MSK = (0xc00000),
  817. RX_MPDU_RES_STATUS2_FILTERING_MSK = (0xc0000000),
  818. };
  819. /**
  820. * struct iwl_radio_version_notif - information on the radio version
  821. * ( RADIO_VERSION_NOTIFICATION = 0x68 )
  822. * @radio_flavor:
  823. * @radio_step:
  824. * @radio_dash:
  825. */
  826. struct iwl_radio_version_notif {
  827. __le32 radio_flavor;
  828. __le32 radio_step;
  829. __le32 radio_dash;
  830. } __packed; /* RADIO_VERSION_NOTOFICATION_S_VER_1 */
  831. enum iwl_card_state_flags {
  832. CARD_ENABLED = 0x00,
  833. HW_CARD_DISABLED = 0x01,
  834. SW_CARD_DISABLED = 0x02,
  835. CT_KILL_CARD_DISABLED = 0x04,
  836. HALT_CARD_DISABLED = 0x08,
  837. CARD_DISABLED_MSK = 0x0f,
  838. CARD_IS_RX_ON = 0x10,
  839. };
  840. /**
  841. * struct iwl_radio_version_notif - information on the radio version
  842. * ( CARD_STATE_NOTIFICATION = 0xa1 )
  843. * @flags: %iwl_card_state_flags
  844. */
  845. struct iwl_card_state_notif {
  846. __le32 flags;
  847. } __packed; /* CARD_STATE_NTFY_API_S_VER_1 */
  848. /**
  849. * struct iwl_set_calib_default_cmd - set default value for calibration.
  850. * ( SET_CALIB_DEFAULT_CMD = 0x8e )
  851. * @calib_index: the calibration to set value for
  852. * @length: of data
  853. * @data: the value to set for the calibration result
  854. */
  855. struct iwl_set_calib_default_cmd {
  856. __le16 calib_index;
  857. __le16 length;
  858. u8 data[0];
  859. } __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */
  860. #endif /* __fw_api_h__ */