fw-api.h 28 KB

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