fw-api.h 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677
  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 - 2014 Intel Corporation. All rights reserved.
  9. * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of version 2 of the GNU General Public License as
  13. * published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  23. * USA
  24. *
  25. * The full GNU General Public License is included in this distribution
  26. * in the file called COPYING.
  27. *
  28. * Contact Information:
  29. * Intel Linux Wireless <ilw@linux.intel.com>
  30. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  31. *
  32. * BSD LICENSE
  33. *
  34. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  35. * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
  36. * All rights reserved.
  37. *
  38. * Redistribution and use in source and binary forms, with or without
  39. * modification, are permitted provided that the following conditions
  40. * are met:
  41. *
  42. * * Redistributions of source code must retain the above copyright
  43. * notice, this list of conditions and the following disclaimer.
  44. * * Redistributions in binary form must reproduce the above copyright
  45. * notice, this list of conditions and the following disclaimer in
  46. * the documentation and/or other materials provided with the
  47. * distribution.
  48. * * Neither the name Intel Corporation nor the names of its
  49. * contributors may be used to endorse or promote products derived
  50. * from this software without specific prior written permission.
  51. *
  52. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  53. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  54. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  55. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  56. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  57. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  58. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  59. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  60. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  61. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  62. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  63. *
  64. *****************************************************************************/
  65. #ifndef __fw_api_h__
  66. #define __fw_api_h__
  67. #include "fw-api-rs.h"
  68. #include "fw-api-tx.h"
  69. #include "fw-api-sta.h"
  70. #include "fw-api-mac.h"
  71. #include "fw-api-power.h"
  72. #include "fw-api-d3.h"
  73. #include "fw-api-coex.h"
  74. #include "fw-api-scan.h"
  75. #include "fw-api-stats.h"
  76. /* Tx queue numbers */
  77. enum {
  78. IWL_MVM_OFFCHANNEL_QUEUE = 8,
  79. IWL_MVM_CMD_QUEUE = 9,
  80. };
  81. enum iwl_mvm_tx_fifo {
  82. IWL_MVM_TX_FIFO_BK = 0,
  83. IWL_MVM_TX_FIFO_BE,
  84. IWL_MVM_TX_FIFO_VI,
  85. IWL_MVM_TX_FIFO_VO,
  86. IWL_MVM_TX_FIFO_MCAST = 5,
  87. IWL_MVM_TX_FIFO_CMD = 7,
  88. };
  89. #define IWL_MVM_STATION_COUNT 16
  90. #define IWL_MVM_TDLS_STA_COUNT 4
  91. /* commands */
  92. enum {
  93. MVM_ALIVE = 0x1,
  94. REPLY_ERROR = 0x2,
  95. INIT_COMPLETE_NOTIF = 0x4,
  96. /* PHY context commands */
  97. PHY_CONTEXT_CMD = 0x8,
  98. DBG_CFG = 0x9,
  99. ANTENNA_COUPLING_NOTIFICATION = 0xa,
  100. /* UMAC scan commands */
  101. SCAN_CFG_CMD = 0xc,
  102. SCAN_REQ_UMAC = 0xd,
  103. SCAN_ABORT_UMAC = 0xe,
  104. SCAN_COMPLETE_UMAC = 0xf,
  105. /* station table */
  106. ADD_STA_KEY = 0x17,
  107. ADD_STA = 0x18,
  108. REMOVE_STA = 0x19,
  109. /* TX */
  110. TX_CMD = 0x1c,
  111. TXPATH_FLUSH = 0x1e,
  112. MGMT_MCAST_KEY = 0x1f,
  113. /* scheduler config */
  114. SCD_QUEUE_CFG = 0x1d,
  115. /* global key */
  116. WEP_KEY = 0x20,
  117. /* Memory */
  118. SHARED_MEM_CFG = 0x25,
  119. /* TDLS */
  120. TDLS_CHANNEL_SWITCH_CMD = 0x27,
  121. TDLS_CHANNEL_SWITCH_NOTIFICATION = 0xaa,
  122. TDLS_CONFIG_CMD = 0xa7,
  123. /* MAC and Binding commands */
  124. MAC_CONTEXT_CMD = 0x28,
  125. TIME_EVENT_CMD = 0x29, /* both CMD and response */
  126. TIME_EVENT_NOTIFICATION = 0x2a,
  127. BINDING_CONTEXT_CMD = 0x2b,
  128. TIME_QUOTA_CMD = 0x2c,
  129. NON_QOS_TX_COUNTER_CMD = 0x2d,
  130. LQ_CMD = 0x4e,
  131. /* Calibration */
  132. TEMPERATURE_NOTIFICATION = 0x62,
  133. CALIBRATION_CFG_CMD = 0x65,
  134. CALIBRATION_RES_NOTIFICATION = 0x66,
  135. CALIBRATION_COMPLETE_NOTIFICATION = 0x67,
  136. RADIO_VERSION_NOTIFICATION = 0x68,
  137. /* Scan offload */
  138. SCAN_OFFLOAD_REQUEST_CMD = 0x51,
  139. SCAN_OFFLOAD_ABORT_CMD = 0x52,
  140. HOT_SPOT_CMD = 0x53,
  141. SCAN_OFFLOAD_COMPLETE = 0x6D,
  142. SCAN_OFFLOAD_UPDATE_PROFILES_CMD = 0x6E,
  143. SCAN_OFFLOAD_CONFIG_CMD = 0x6f,
  144. MATCH_FOUND_NOTIFICATION = 0xd9,
  145. SCAN_ITERATION_COMPLETE = 0xe7,
  146. /* Phy */
  147. PHY_CONFIGURATION_CMD = 0x6a,
  148. CALIB_RES_NOTIF_PHY_DB = 0x6b,
  149. /* PHY_DB_CMD = 0x6c, */
  150. /* Power - legacy power table command */
  151. POWER_TABLE_CMD = 0x77,
  152. PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78,
  153. LTR_CONFIG = 0xee,
  154. /* Thermal Throttling*/
  155. REPLY_THERMAL_MNG_BACKOFF = 0x7e,
  156. /* Scanning */
  157. SCAN_REQUEST_CMD = 0x80,
  158. SCAN_ABORT_CMD = 0x81,
  159. SCAN_START_NOTIFICATION = 0x82,
  160. SCAN_RESULTS_NOTIFICATION = 0x83,
  161. SCAN_COMPLETE_NOTIFICATION = 0x84,
  162. /* NVM */
  163. NVM_ACCESS_CMD = 0x88,
  164. SET_CALIB_DEFAULT_CMD = 0x8e,
  165. BEACON_NOTIFICATION = 0x90,
  166. BEACON_TEMPLATE_CMD = 0x91,
  167. TX_ANT_CONFIGURATION_CMD = 0x98,
  168. STATISTICS_CMD = 0x9c,
  169. STATISTICS_NOTIFICATION = 0x9d,
  170. EOSP_NOTIFICATION = 0x9e,
  171. REDUCE_TX_POWER_CMD = 0x9f,
  172. /* RF-KILL commands and notifications */
  173. CARD_STATE_CMD = 0xa0,
  174. CARD_STATE_NOTIFICATION = 0xa1,
  175. MISSED_BEACONS_NOTIFICATION = 0xa2,
  176. /* Power - new power table command */
  177. MAC_PM_POWER_TABLE = 0xa9,
  178. MFUART_LOAD_NOTIFICATION = 0xb1,
  179. REPLY_RX_PHY_CMD = 0xc0,
  180. REPLY_RX_MPDU_CMD = 0xc1,
  181. BA_NOTIF = 0xc5,
  182. MARKER_CMD = 0xcb,
  183. /* BT Coex */
  184. BT_COEX_PRIO_TABLE = 0xcc,
  185. BT_COEX_PROT_ENV = 0xcd,
  186. BT_PROFILE_NOTIFICATION = 0xce,
  187. BT_CONFIG = 0x9b,
  188. BT_COEX_UPDATE_SW_BOOST = 0x5a,
  189. BT_COEX_UPDATE_CORUN_LUT = 0x5b,
  190. BT_COEX_UPDATE_REDUCED_TXP = 0x5c,
  191. BT_COEX_CI = 0x5d,
  192. REPLY_SF_CFG_CMD = 0xd1,
  193. REPLY_BEACON_FILTERING_CMD = 0xd2,
  194. /* DTS measurements */
  195. CMD_DTS_MEASUREMENT_TRIGGER = 0xdc,
  196. DTS_MEASUREMENT_NOTIFICATION = 0xdd,
  197. REPLY_DEBUG_CMD = 0xf0,
  198. DEBUG_LOG_MSG = 0xf7,
  199. BCAST_FILTER_CMD = 0xcf,
  200. MCAST_FILTER_CMD = 0xd0,
  201. /* D3 commands/notifications */
  202. D3_CONFIG_CMD = 0xd3,
  203. PROT_OFFLOAD_CONFIG_CMD = 0xd4,
  204. OFFLOADS_QUERY_CMD = 0xd5,
  205. REMOTE_WAKE_CONFIG_CMD = 0xd6,
  206. D0I3_END_CMD = 0xed,
  207. /* for WoWLAN in particular */
  208. WOWLAN_PATTERNS = 0xe0,
  209. WOWLAN_CONFIGURATION = 0xe1,
  210. WOWLAN_TSC_RSC_PARAM = 0xe2,
  211. WOWLAN_TKIP_PARAM = 0xe3,
  212. WOWLAN_KEK_KCK_MATERIAL = 0xe4,
  213. WOWLAN_GET_STATUSES = 0xe5,
  214. WOWLAN_TX_POWER_PER_DB = 0xe6,
  215. /* and for NetDetect */
  216. SCAN_OFFLOAD_PROFILES_QUERY_CMD = 0x56,
  217. SCAN_OFFLOAD_HOTSPOTS_CONFIG_CMD = 0x58,
  218. SCAN_OFFLOAD_HOTSPOTS_QUERY_CMD = 0x59,
  219. REPLY_MAX = 0xff,
  220. };
  221. /**
  222. * struct iwl_cmd_response - generic response struct for most commands
  223. * @status: status of the command asked, changes for each one
  224. */
  225. struct iwl_cmd_response {
  226. __le32 status;
  227. };
  228. /*
  229. * struct iwl_tx_ant_cfg_cmd
  230. * @valid: valid antenna configuration
  231. */
  232. struct iwl_tx_ant_cfg_cmd {
  233. __le32 valid;
  234. } __packed;
  235. /**
  236. * struct iwl_reduce_tx_power_cmd - TX power reduction command
  237. * REDUCE_TX_POWER_CMD = 0x9f
  238. * @flags: (reserved for future implementation)
  239. * @mac_context_id: id of the mac ctx for which we are reducing TX power.
  240. * @pwr_restriction: TX power restriction in dBms.
  241. */
  242. struct iwl_reduce_tx_power_cmd {
  243. u8 flags;
  244. u8 mac_context_id;
  245. __le16 pwr_restriction;
  246. } __packed; /* TX_REDUCED_POWER_API_S_VER_1 */
  247. /*
  248. * Calibration control struct.
  249. * Sent as part of the phy configuration command.
  250. * @flow_trigger: bitmap for which calibrations to perform according to
  251. * flow triggers.
  252. * @event_trigger: bitmap for which calibrations to perform according to
  253. * event triggers.
  254. */
  255. struct iwl_calib_ctrl {
  256. __le32 flow_trigger;
  257. __le32 event_trigger;
  258. } __packed;
  259. /* This enum defines the bitmap of various calibrations to enable in both
  260. * init ucode and runtime ucode through CALIBRATION_CFG_CMD.
  261. */
  262. enum iwl_calib_cfg {
  263. IWL_CALIB_CFG_XTAL_IDX = BIT(0),
  264. IWL_CALIB_CFG_TEMPERATURE_IDX = BIT(1),
  265. IWL_CALIB_CFG_VOLTAGE_READ_IDX = BIT(2),
  266. IWL_CALIB_CFG_PAPD_IDX = BIT(3),
  267. IWL_CALIB_CFG_TX_PWR_IDX = BIT(4),
  268. IWL_CALIB_CFG_DC_IDX = BIT(5),
  269. IWL_CALIB_CFG_BB_FILTER_IDX = BIT(6),
  270. IWL_CALIB_CFG_LO_LEAKAGE_IDX = BIT(7),
  271. IWL_CALIB_CFG_TX_IQ_IDX = BIT(8),
  272. IWL_CALIB_CFG_TX_IQ_SKEW_IDX = BIT(9),
  273. IWL_CALIB_CFG_RX_IQ_IDX = BIT(10),
  274. IWL_CALIB_CFG_RX_IQ_SKEW_IDX = BIT(11),
  275. IWL_CALIB_CFG_SENSITIVITY_IDX = BIT(12),
  276. IWL_CALIB_CFG_CHAIN_NOISE_IDX = BIT(13),
  277. IWL_CALIB_CFG_DISCONNECTED_ANT_IDX = BIT(14),
  278. IWL_CALIB_CFG_ANT_COUPLING_IDX = BIT(15),
  279. IWL_CALIB_CFG_DAC_IDX = BIT(16),
  280. IWL_CALIB_CFG_ABS_IDX = BIT(17),
  281. IWL_CALIB_CFG_AGC_IDX = BIT(18),
  282. };
  283. /*
  284. * Phy configuration command.
  285. */
  286. struct iwl_phy_cfg_cmd {
  287. __le32 phy_cfg;
  288. struct iwl_calib_ctrl calib_control;
  289. } __packed;
  290. #define PHY_CFG_RADIO_TYPE (BIT(0) | BIT(1))
  291. #define PHY_CFG_RADIO_STEP (BIT(2) | BIT(3))
  292. #define PHY_CFG_RADIO_DASH (BIT(4) | BIT(5))
  293. #define PHY_CFG_PRODUCT_NUMBER (BIT(6) | BIT(7))
  294. #define PHY_CFG_TX_CHAIN_A BIT(8)
  295. #define PHY_CFG_TX_CHAIN_B BIT(9)
  296. #define PHY_CFG_TX_CHAIN_C BIT(10)
  297. #define PHY_CFG_RX_CHAIN_A BIT(12)
  298. #define PHY_CFG_RX_CHAIN_B BIT(13)
  299. #define PHY_CFG_RX_CHAIN_C BIT(14)
  300. /* Target of the NVM_ACCESS_CMD */
  301. enum {
  302. NVM_ACCESS_TARGET_CACHE = 0,
  303. NVM_ACCESS_TARGET_OTP = 1,
  304. NVM_ACCESS_TARGET_EEPROM = 2,
  305. };
  306. /* Section types for NVM_ACCESS_CMD */
  307. enum {
  308. NVM_SECTION_TYPE_SW = 1,
  309. NVM_SECTION_TYPE_REGULATORY = 3,
  310. NVM_SECTION_TYPE_CALIBRATION = 4,
  311. NVM_SECTION_TYPE_PRODUCTION = 5,
  312. NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
  313. NVM_MAX_NUM_SECTIONS = 12,
  314. };
  315. /**
  316. * struct iwl_nvm_access_cmd_ver2 - Request the device to send an NVM section
  317. * @op_code: 0 - read, 1 - write
  318. * @target: NVM_ACCESS_TARGET_*
  319. * @type: NVM_SECTION_TYPE_*
  320. * @offset: offset in bytes into the section
  321. * @length: in bytes, to read/write
  322. * @data: if write operation, the data to write. On read its empty
  323. */
  324. struct iwl_nvm_access_cmd {
  325. u8 op_code;
  326. u8 target;
  327. __le16 type;
  328. __le16 offset;
  329. __le16 length;
  330. u8 data[];
  331. } __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */
  332. /**
  333. * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD
  334. * @offset: offset in bytes into the section
  335. * @length: in bytes, either how much was written or read
  336. * @type: NVM_SECTION_TYPE_*
  337. * @status: 0 for success, fail otherwise
  338. * @data: if read operation, the data returned. Empty on write.
  339. */
  340. struct iwl_nvm_access_resp {
  341. __le16 offset;
  342. __le16 length;
  343. __le16 type;
  344. __le16 status;
  345. u8 data[];
  346. } __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */
  347. /* MVM_ALIVE 0x1 */
  348. /* alive response is_valid values */
  349. #define ALIVE_RESP_UCODE_OK BIT(0)
  350. #define ALIVE_RESP_RFKILL BIT(1)
  351. /* alive response ver_type values */
  352. enum {
  353. FW_TYPE_HW = 0,
  354. FW_TYPE_PROT = 1,
  355. FW_TYPE_AP = 2,
  356. FW_TYPE_WOWLAN = 3,
  357. FW_TYPE_TIMING = 4,
  358. FW_TYPE_WIPAN = 5
  359. };
  360. /* alive response ver_subtype values */
  361. enum {
  362. FW_SUBTYPE_FULL_FEATURE = 0,
  363. FW_SUBTYPE_BOOTSRAP = 1, /* Not valid */
  364. FW_SUBTYPE_REDUCED = 2,
  365. FW_SUBTYPE_ALIVE_ONLY = 3,
  366. FW_SUBTYPE_WOWLAN = 4,
  367. FW_SUBTYPE_AP_SUBTYPE = 5,
  368. FW_SUBTYPE_WIPAN = 6,
  369. FW_SUBTYPE_INITIALIZE = 9
  370. };
  371. #define IWL_ALIVE_STATUS_ERR 0xDEAD
  372. #define IWL_ALIVE_STATUS_OK 0xCAFE
  373. #define IWL_ALIVE_FLG_RFKILL BIT(0)
  374. struct mvm_alive_resp_ver1 {
  375. __le16 status;
  376. __le16 flags;
  377. u8 ucode_minor;
  378. u8 ucode_major;
  379. __le16 id;
  380. u8 api_minor;
  381. u8 api_major;
  382. u8 ver_subtype;
  383. u8 ver_type;
  384. u8 mac;
  385. u8 opt;
  386. __le16 reserved2;
  387. __le32 timestamp;
  388. __le32 error_event_table_ptr; /* SRAM address for error log */
  389. __le32 log_event_table_ptr; /* SRAM address for event log */
  390. __le32 cpu_register_ptr;
  391. __le32 dbgm_config_ptr;
  392. __le32 alive_counter_ptr;
  393. __le32 scd_base_ptr; /* SRAM address for SCD */
  394. } __packed; /* ALIVE_RES_API_S_VER_1 */
  395. struct mvm_alive_resp_ver2 {
  396. __le16 status;
  397. __le16 flags;
  398. u8 ucode_minor;
  399. u8 ucode_major;
  400. __le16 id;
  401. u8 api_minor;
  402. u8 api_major;
  403. u8 ver_subtype;
  404. u8 ver_type;
  405. u8 mac;
  406. u8 opt;
  407. __le16 reserved2;
  408. __le32 timestamp;
  409. __le32 error_event_table_ptr; /* SRAM address for error log */
  410. __le32 log_event_table_ptr; /* SRAM address for LMAC event log */
  411. __le32 cpu_register_ptr;
  412. __le32 dbgm_config_ptr;
  413. __le32 alive_counter_ptr;
  414. __le32 scd_base_ptr; /* SRAM address for SCD */
  415. __le32 st_fwrd_addr; /* pointer to Store and forward */
  416. __le32 st_fwrd_size;
  417. u8 umac_minor; /* UMAC version: minor */
  418. u8 umac_major; /* UMAC version: major */
  419. __le16 umac_id; /* UMAC version: id */
  420. __le32 error_info_addr; /* SRAM address for UMAC error log */
  421. __le32 dbg_print_buff_addr;
  422. } __packed; /* ALIVE_RES_API_S_VER_2 */
  423. struct mvm_alive_resp {
  424. __le16 status;
  425. __le16 flags;
  426. __le32 ucode_minor;
  427. __le32 ucode_major;
  428. u8 ver_subtype;
  429. u8 ver_type;
  430. u8 mac;
  431. u8 opt;
  432. __le32 timestamp;
  433. __le32 error_event_table_ptr; /* SRAM address for error log */
  434. __le32 log_event_table_ptr; /* SRAM address for LMAC event log */
  435. __le32 cpu_register_ptr;
  436. __le32 dbgm_config_ptr;
  437. __le32 alive_counter_ptr;
  438. __le32 scd_base_ptr; /* SRAM address for SCD */
  439. __le32 st_fwrd_addr; /* pointer to Store and forward */
  440. __le32 st_fwrd_size;
  441. __le32 umac_minor; /* UMAC version: minor */
  442. __le32 umac_major; /* UMAC version: major */
  443. __le32 error_info_addr; /* SRAM address for UMAC error log */
  444. __le32 dbg_print_buff_addr;
  445. } __packed; /* ALIVE_RES_API_S_VER_3 */
  446. /* Error response/notification */
  447. enum {
  448. FW_ERR_UNKNOWN_CMD = 0x0,
  449. FW_ERR_INVALID_CMD_PARAM = 0x1,
  450. FW_ERR_SERVICE = 0x2,
  451. FW_ERR_ARC_MEMORY = 0x3,
  452. FW_ERR_ARC_CODE = 0x4,
  453. FW_ERR_WATCH_DOG = 0x5,
  454. FW_ERR_WEP_GRP_KEY_INDX = 0x10,
  455. FW_ERR_WEP_KEY_SIZE = 0x11,
  456. FW_ERR_OBSOLETE_FUNC = 0x12,
  457. FW_ERR_UNEXPECTED = 0xFE,
  458. FW_ERR_FATAL = 0xFF
  459. };
  460. /**
  461. * struct iwl_error_resp - FW error indication
  462. * ( REPLY_ERROR = 0x2 )
  463. * @error_type: one of FW_ERR_*
  464. * @cmd_id: the command ID for which the error occured
  465. * @bad_cmd_seq_num: sequence number of the erroneous command
  466. * @error_service: which service created the error, applicable only if
  467. * error_type = 2, otherwise 0
  468. * @timestamp: TSF in usecs.
  469. */
  470. struct iwl_error_resp {
  471. __le32 error_type;
  472. u8 cmd_id;
  473. u8 reserved1;
  474. __le16 bad_cmd_seq_num;
  475. __le32 error_service;
  476. __le64 timestamp;
  477. } __packed;
  478. /* Common PHY, MAC and Bindings definitions */
  479. #define MAX_MACS_IN_BINDING (3)
  480. #define MAX_BINDINGS (4)
  481. #define AUX_BINDING_INDEX (3)
  482. #define MAX_PHYS (4)
  483. /* Used to extract ID and color from the context dword */
  484. #define FW_CTXT_ID_POS (0)
  485. #define FW_CTXT_ID_MSK (0xff << FW_CTXT_ID_POS)
  486. #define FW_CTXT_COLOR_POS (8)
  487. #define FW_CTXT_COLOR_MSK (0xff << FW_CTXT_COLOR_POS)
  488. #define FW_CTXT_INVALID (0xffffffff)
  489. #define FW_CMD_ID_AND_COLOR(_id, _color) ((_id << FW_CTXT_ID_POS) |\
  490. (_color << FW_CTXT_COLOR_POS))
  491. /* Possible actions on PHYs, MACs and Bindings */
  492. enum {
  493. FW_CTXT_ACTION_STUB = 0,
  494. FW_CTXT_ACTION_ADD,
  495. FW_CTXT_ACTION_MODIFY,
  496. FW_CTXT_ACTION_REMOVE,
  497. FW_CTXT_ACTION_NUM
  498. }; /* COMMON_CONTEXT_ACTION_API_E_VER_1 */
  499. /* Time Events */
  500. /* Time Event types, according to MAC type */
  501. enum iwl_time_event_type {
  502. /* BSS Station Events */
  503. TE_BSS_STA_AGGRESSIVE_ASSOC,
  504. TE_BSS_STA_ASSOC,
  505. TE_BSS_EAP_DHCP_PROT,
  506. TE_BSS_QUIET_PERIOD,
  507. /* P2P Device Events */
  508. TE_P2P_DEVICE_DISCOVERABLE,
  509. TE_P2P_DEVICE_LISTEN,
  510. TE_P2P_DEVICE_ACTION_SCAN,
  511. TE_P2P_DEVICE_FULL_SCAN,
  512. /* P2P Client Events */
  513. TE_P2P_CLIENT_AGGRESSIVE_ASSOC,
  514. TE_P2P_CLIENT_ASSOC,
  515. TE_P2P_CLIENT_QUIET_PERIOD,
  516. /* P2P GO Events */
  517. TE_P2P_GO_ASSOC_PROT,
  518. TE_P2P_GO_REPETITIVE_NOA,
  519. TE_P2P_GO_CT_WINDOW,
  520. /* WiDi Sync Events */
  521. TE_WIDI_TX_SYNC,
  522. /* Channel Switch NoA */
  523. TE_CHANNEL_SWITCH_PERIOD,
  524. TE_MAX
  525. }; /* MAC_EVENT_TYPE_API_E_VER_1 */
  526. /* Time event - defines for command API v1 */
  527. /*
  528. * @TE_V1_FRAG_NONE: fragmentation of the time event is NOT allowed.
  529. * @TE_V1_FRAG_SINGLE: fragmentation of the time event is allowed, but only
  530. * the first fragment is scheduled.
  531. * @TE_V1_FRAG_DUAL: fragmentation of the time event is allowed, but only
  532. * the first 2 fragments are scheduled.
  533. * @TE_V1_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
  534. * number of fragments are valid.
  535. *
  536. * Other than the constant defined above, specifying a fragmentation value 'x'
  537. * means that the event can be fragmented but only the first 'x' will be
  538. * scheduled.
  539. */
  540. enum {
  541. TE_V1_FRAG_NONE = 0,
  542. TE_V1_FRAG_SINGLE = 1,
  543. TE_V1_FRAG_DUAL = 2,
  544. TE_V1_FRAG_ENDLESS = 0xffffffff
  545. };
  546. /* If a Time Event can be fragmented, this is the max number of fragments */
  547. #define TE_V1_FRAG_MAX_MSK 0x0fffffff
  548. /* Repeat the time event endlessly (until removed) */
  549. #define TE_V1_REPEAT_ENDLESS 0xffffffff
  550. /* If a Time Event has bounded repetitions, this is the maximal value */
  551. #define TE_V1_REPEAT_MAX_MSK_V1 0x0fffffff
  552. /* Time Event dependencies: none, on another TE, or in a specific time */
  553. enum {
  554. TE_V1_INDEPENDENT = 0,
  555. TE_V1_DEP_OTHER = BIT(0),
  556. TE_V1_DEP_TSF = BIT(1),
  557. TE_V1_EVENT_SOCIOPATHIC = BIT(2),
  558. }; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */
  559. /*
  560. * @TE_V1_NOTIF_NONE: no notifications
  561. * @TE_V1_NOTIF_HOST_EVENT_START: request/receive notification on event start
  562. * @TE_V1_NOTIF_HOST_EVENT_END:request/receive notification on event end
  563. * @TE_V1_NOTIF_INTERNAL_EVENT_START: internal FW use
  564. * @TE_V1_NOTIF_INTERNAL_EVENT_END: internal FW use.
  565. * @TE_V1_NOTIF_HOST_FRAG_START: request/receive notification on frag start
  566. * @TE_V1_NOTIF_HOST_FRAG_END:request/receive notification on frag end
  567. * @TE_V1_NOTIF_INTERNAL_FRAG_START: internal FW use.
  568. * @TE_V1_NOTIF_INTERNAL_FRAG_END: internal FW use.
  569. *
  570. * Supported Time event notifications configuration.
  571. * A notification (both event and fragment) includes a status indicating weather
  572. * the FW was able to schedule the event or not. For fragment start/end
  573. * notification the status is always success. There is no start/end fragment
  574. * notification for monolithic events.
  575. */
  576. enum {
  577. TE_V1_NOTIF_NONE = 0,
  578. TE_V1_NOTIF_HOST_EVENT_START = BIT(0),
  579. TE_V1_NOTIF_HOST_EVENT_END = BIT(1),
  580. TE_V1_NOTIF_INTERNAL_EVENT_START = BIT(2),
  581. TE_V1_NOTIF_INTERNAL_EVENT_END = BIT(3),
  582. TE_V1_NOTIF_HOST_FRAG_START = BIT(4),
  583. TE_V1_NOTIF_HOST_FRAG_END = BIT(5),
  584. TE_V1_NOTIF_INTERNAL_FRAG_START = BIT(6),
  585. TE_V1_NOTIF_INTERNAL_FRAG_END = BIT(7),
  586. }; /* MAC_EVENT_ACTION_API_E_VER_2 */
  587. /* Time event - defines for command API */
  588. /*
  589. * @TE_V2_FRAG_NONE: fragmentation of the time event is NOT allowed.
  590. * @TE_V2_FRAG_SINGLE: fragmentation of the time event is allowed, but only
  591. * the first fragment is scheduled.
  592. * @TE_V2_FRAG_DUAL: fragmentation of the time event is allowed, but only
  593. * the first 2 fragments are scheduled.
  594. * @TE_V2_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
  595. * number of fragments are valid.
  596. *
  597. * Other than the constant defined above, specifying a fragmentation value 'x'
  598. * means that the event can be fragmented but only the first 'x' will be
  599. * scheduled.
  600. */
  601. enum {
  602. TE_V2_FRAG_NONE = 0,
  603. TE_V2_FRAG_SINGLE = 1,
  604. TE_V2_FRAG_DUAL = 2,
  605. TE_V2_FRAG_MAX = 0xfe,
  606. TE_V2_FRAG_ENDLESS = 0xff
  607. };
  608. /* Repeat the time event endlessly (until removed) */
  609. #define TE_V2_REPEAT_ENDLESS 0xff
  610. /* If a Time Event has bounded repetitions, this is the maximal value */
  611. #define TE_V2_REPEAT_MAX 0xfe
  612. #define TE_V2_PLACEMENT_POS 12
  613. #define TE_V2_ABSENCE_POS 15
  614. /* Time event policy values
  615. * A notification (both event and fragment) includes a status indicating weather
  616. * the FW was able to schedule the event or not. For fragment start/end
  617. * notification the status is always success. There is no start/end fragment
  618. * notification for monolithic events.
  619. *
  620. * @TE_V2_DEFAULT_POLICY: independent, social, present, unoticable
  621. * @TE_V2_NOTIF_HOST_EVENT_START: request/receive notification on event start
  622. * @TE_V2_NOTIF_HOST_EVENT_END:request/receive notification on event end
  623. * @TE_V2_NOTIF_INTERNAL_EVENT_START: internal FW use
  624. * @TE_V2_NOTIF_INTERNAL_EVENT_END: internal FW use.
  625. * @TE_V2_NOTIF_HOST_FRAG_START: request/receive notification on frag start
  626. * @TE_V2_NOTIF_HOST_FRAG_END:request/receive notification on frag end
  627. * @TE_V2_NOTIF_INTERNAL_FRAG_START: internal FW use.
  628. * @TE_V2_NOTIF_INTERNAL_FRAG_END: internal FW use.
  629. * @TE_V2_DEP_OTHER: depends on another time event
  630. * @TE_V2_DEP_TSF: depends on a specific time
  631. * @TE_V2_EVENT_SOCIOPATHIC: can't co-exist with other events of tha same MAC
  632. * @TE_V2_ABSENCE: are we present or absent during the Time Event.
  633. */
  634. enum {
  635. TE_V2_DEFAULT_POLICY = 0x0,
  636. /* notifications (event start/stop, fragment start/stop) */
  637. TE_V2_NOTIF_HOST_EVENT_START = BIT(0),
  638. TE_V2_NOTIF_HOST_EVENT_END = BIT(1),
  639. TE_V2_NOTIF_INTERNAL_EVENT_START = BIT(2),
  640. TE_V2_NOTIF_INTERNAL_EVENT_END = BIT(3),
  641. TE_V2_NOTIF_HOST_FRAG_START = BIT(4),
  642. TE_V2_NOTIF_HOST_FRAG_END = BIT(5),
  643. TE_V2_NOTIF_INTERNAL_FRAG_START = BIT(6),
  644. TE_V2_NOTIF_INTERNAL_FRAG_END = BIT(7),
  645. T2_V2_START_IMMEDIATELY = BIT(11),
  646. TE_V2_NOTIF_MSK = 0xff,
  647. /* placement characteristics */
  648. TE_V2_DEP_OTHER = BIT(TE_V2_PLACEMENT_POS),
  649. TE_V2_DEP_TSF = BIT(TE_V2_PLACEMENT_POS + 1),
  650. TE_V2_EVENT_SOCIOPATHIC = BIT(TE_V2_PLACEMENT_POS + 2),
  651. /* are we present or absent during the Time Event. */
  652. TE_V2_ABSENCE = BIT(TE_V2_ABSENCE_POS),
  653. };
  654. /**
  655. * struct iwl_time_event_cmd_api - configuring Time Events
  656. * with struct MAC_TIME_EVENT_DATA_API_S_VER_2 (see also
  657. * with version 1. determined by IWL_UCODE_TLV_FLAGS)
  658. * ( TIME_EVENT_CMD = 0x29 )
  659. * @id_and_color: ID and color of the relevant MAC
  660. * @action: action to perform, one of FW_CTXT_ACTION_*
  661. * @id: this field has two meanings, depending on the action:
  662. * If the action is ADD, then it means the type of event to add.
  663. * For all other actions it is the unique event ID assigned when the
  664. * event was added by the FW.
  665. * @apply_time: When to start the Time Event (in GP2)
  666. * @max_delay: maximum delay to event's start (apply time), in TU
  667. * @depends_on: the unique ID of the event we depend on (if any)
  668. * @interval: interval between repetitions, in TU
  669. * @duration: duration of event in TU
  670. * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS
  671. * @max_frags: maximal number of fragments the Time Event can be divided to
  672. * @policy: defines whether uCode shall notify the host or other uCode modules
  673. * on event and/or fragment start and/or end
  674. * using one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF
  675. * TE_EVENT_SOCIOPATHIC
  676. * using TE_ABSENCE and using TE_NOTIF_*
  677. */
  678. struct iwl_time_event_cmd {
  679. /* COMMON_INDEX_HDR_API_S_VER_1 */
  680. __le32 id_and_color;
  681. __le32 action;
  682. __le32 id;
  683. /* MAC_TIME_EVENT_DATA_API_S_VER_2 */
  684. __le32 apply_time;
  685. __le32 max_delay;
  686. __le32 depends_on;
  687. __le32 interval;
  688. __le32 duration;
  689. u8 repeat;
  690. u8 max_frags;
  691. __le16 policy;
  692. } __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_2 */
  693. /**
  694. * struct iwl_time_event_resp - response structure to iwl_time_event_cmd
  695. * @status: bit 0 indicates success, all others specify errors
  696. * @id: the Time Event type
  697. * @unique_id: the unique ID assigned (in ADD) or given (others) to the TE
  698. * @id_and_color: ID and color of the relevant MAC
  699. */
  700. struct iwl_time_event_resp {
  701. __le32 status;
  702. __le32 id;
  703. __le32 unique_id;
  704. __le32 id_and_color;
  705. } __packed; /* MAC_TIME_EVENT_RSP_API_S_VER_1 */
  706. /**
  707. * struct iwl_time_event_notif - notifications of time event start/stop
  708. * ( TIME_EVENT_NOTIFICATION = 0x2a )
  709. * @timestamp: action timestamp in GP2
  710. * @session_id: session's unique id
  711. * @unique_id: unique id of the Time Event itself
  712. * @id_and_color: ID and color of the relevant MAC
  713. * @action: one of TE_NOTIF_START or TE_NOTIF_END
  714. * @status: true if scheduled, false otherwise (not executed)
  715. */
  716. struct iwl_time_event_notif {
  717. __le32 timestamp;
  718. __le32 session_id;
  719. __le32 unique_id;
  720. __le32 id_and_color;
  721. __le32 action;
  722. __le32 status;
  723. } __packed; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */
  724. /* Bindings and Time Quota */
  725. /**
  726. * struct iwl_binding_cmd - configuring bindings
  727. * ( BINDING_CONTEXT_CMD = 0x2b )
  728. * @id_and_color: ID and color of the relevant Binding
  729. * @action: action to perform, one of FW_CTXT_ACTION_*
  730. * @macs: array of MAC id and colors which belong to the binding
  731. * @phy: PHY id and color which belongs to the binding
  732. */
  733. struct iwl_binding_cmd {
  734. /* COMMON_INDEX_HDR_API_S_VER_1 */
  735. __le32 id_and_color;
  736. __le32 action;
  737. /* BINDING_DATA_API_S_VER_1 */
  738. __le32 macs[MAX_MACS_IN_BINDING];
  739. __le32 phy;
  740. } __packed; /* BINDING_CMD_API_S_VER_1 */
  741. /* The maximal number of fragments in the FW's schedule session */
  742. #define IWL_MVM_MAX_QUOTA 128
  743. /**
  744. * struct iwl_time_quota_data - configuration of time quota per binding
  745. * @id_and_color: ID and color of the relevant Binding
  746. * @quota: absolute time quota in TU. The scheduler will try to divide the
  747. * remainig quota (after Time Events) according to this quota.
  748. * @max_duration: max uninterrupted context duration in TU
  749. */
  750. struct iwl_time_quota_data {
  751. __le32 id_and_color;
  752. __le32 quota;
  753. __le32 max_duration;
  754. } __packed; /* TIME_QUOTA_DATA_API_S_VER_1 */
  755. /**
  756. * struct iwl_time_quota_cmd - configuration of time quota between bindings
  757. * ( TIME_QUOTA_CMD = 0x2c )
  758. * @quotas: allocations per binding
  759. */
  760. struct iwl_time_quota_cmd {
  761. struct iwl_time_quota_data quotas[MAX_BINDINGS];
  762. } __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_1 */
  763. /* PHY context */
  764. /* Supported bands */
  765. #define PHY_BAND_5 (0)
  766. #define PHY_BAND_24 (1)
  767. /* Supported channel width, vary if there is VHT support */
  768. #define PHY_VHT_CHANNEL_MODE20 (0x0)
  769. #define PHY_VHT_CHANNEL_MODE40 (0x1)
  770. #define PHY_VHT_CHANNEL_MODE80 (0x2)
  771. #define PHY_VHT_CHANNEL_MODE160 (0x3)
  772. /*
  773. * Control channel position:
  774. * For legacy set bit means upper channel, otherwise lower.
  775. * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
  776. * bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
  777. * center_freq
  778. * |
  779. * 40Mhz |_______|_______|
  780. * 80Mhz |_______|_______|_______|_______|
  781. * 160Mhz |_______|_______|_______|_______|_______|_______|_______|_______|
  782. * code 011 010 001 000 | 100 101 110 111
  783. */
  784. #define PHY_VHT_CTRL_POS_1_BELOW (0x0)
  785. #define PHY_VHT_CTRL_POS_2_BELOW (0x1)
  786. #define PHY_VHT_CTRL_POS_3_BELOW (0x2)
  787. #define PHY_VHT_CTRL_POS_4_BELOW (0x3)
  788. #define PHY_VHT_CTRL_POS_1_ABOVE (0x4)
  789. #define PHY_VHT_CTRL_POS_2_ABOVE (0x5)
  790. #define PHY_VHT_CTRL_POS_3_ABOVE (0x6)
  791. #define PHY_VHT_CTRL_POS_4_ABOVE (0x7)
  792. /*
  793. * @band: PHY_BAND_*
  794. * @channel: channel number
  795. * @width: PHY_[VHT|LEGACY]_CHANNEL_*
  796. * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
  797. */
  798. struct iwl_fw_channel_info {
  799. u8 band;
  800. u8 channel;
  801. u8 width;
  802. u8 ctrl_pos;
  803. } __packed;
  804. #define PHY_RX_CHAIN_DRIVER_FORCE_POS (0)
  805. #define PHY_RX_CHAIN_DRIVER_FORCE_MSK \
  806. (0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS)
  807. #define PHY_RX_CHAIN_VALID_POS (1)
  808. #define PHY_RX_CHAIN_VALID_MSK \
  809. (0x7 << PHY_RX_CHAIN_VALID_POS)
  810. #define PHY_RX_CHAIN_FORCE_SEL_POS (4)
  811. #define PHY_RX_CHAIN_FORCE_SEL_MSK \
  812. (0x7 << PHY_RX_CHAIN_FORCE_SEL_POS)
  813. #define PHY_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
  814. #define PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \
  815. (0x7 << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS)
  816. #define PHY_RX_CHAIN_CNT_POS (10)
  817. #define PHY_RX_CHAIN_CNT_MSK \
  818. (0x3 << PHY_RX_CHAIN_CNT_POS)
  819. #define PHY_RX_CHAIN_MIMO_CNT_POS (12)
  820. #define PHY_RX_CHAIN_MIMO_CNT_MSK \
  821. (0x3 << PHY_RX_CHAIN_MIMO_CNT_POS)
  822. #define PHY_RX_CHAIN_MIMO_FORCE_POS (14)
  823. #define PHY_RX_CHAIN_MIMO_FORCE_MSK \
  824. (0x1 << PHY_RX_CHAIN_MIMO_FORCE_POS)
  825. /* TODO: fix the value, make it depend on firmware at runtime? */
  826. #define NUM_PHY_CTX 3
  827. /* TODO: complete missing documentation */
  828. /**
  829. * struct iwl_phy_context_cmd - config of the PHY context
  830. * ( PHY_CONTEXT_CMD = 0x8 )
  831. * @id_and_color: ID and color of the relevant Binding
  832. * @action: action to perform, one of FW_CTXT_ACTION_*
  833. * @apply_time: 0 means immediate apply and context switch.
  834. * other value means apply new params after X usecs
  835. * @tx_param_color: ???
  836. * @channel_info:
  837. * @txchain_info: ???
  838. * @rxchain_info: ???
  839. * @acquisition_data: ???
  840. * @dsp_cfg_flags: set to 0
  841. */
  842. struct iwl_phy_context_cmd {
  843. /* COMMON_INDEX_HDR_API_S_VER_1 */
  844. __le32 id_and_color;
  845. __le32 action;
  846. /* PHY_CONTEXT_DATA_API_S_VER_1 */
  847. __le32 apply_time;
  848. __le32 tx_param_color;
  849. struct iwl_fw_channel_info ci;
  850. __le32 txchain_info;
  851. __le32 rxchain_info;
  852. __le32 acquisition_data;
  853. __le32 dsp_cfg_flags;
  854. } __packed; /* PHY_CONTEXT_CMD_API_VER_1 */
  855. /*
  856. * Aux ROC command
  857. *
  858. * Command requests the firmware to create a time event for a certain duration
  859. * and remain on the given channel. This is done by using the Aux framework in
  860. * the FW.
  861. * The command was first used for Hot Spot issues - but can be used regardless
  862. * to Hot Spot.
  863. *
  864. * ( HOT_SPOT_CMD 0x53 )
  865. *
  866. * @id_and_color: ID and color of the MAC
  867. * @action: action to perform, one of FW_CTXT_ACTION_*
  868. * @event_unique_id: If the action FW_CTXT_ACTION_REMOVE then the
  869. * event_unique_id should be the id of the time event assigned by ucode.
  870. * Otherwise ignore the event_unique_id.
  871. * @sta_id_and_color: station id and color, resumed during "Remain On Channel"
  872. * activity.
  873. * @channel_info: channel info
  874. * @node_addr: Our MAC Address
  875. * @reserved: reserved for alignment
  876. * @apply_time: GP2 value to start (should always be the current GP2 value)
  877. * @apply_time_max_delay: Maximum apply time delay value in TU. Defines max
  878. * time by which start of the event is allowed to be postponed.
  879. * @duration: event duration in TU To calculate event duration:
  880. * timeEventDuration = min(duration, remainingQuota)
  881. */
  882. struct iwl_hs20_roc_req {
  883. /* COMMON_INDEX_HDR_API_S_VER_1 hdr */
  884. __le32 id_and_color;
  885. __le32 action;
  886. __le32 event_unique_id;
  887. __le32 sta_id_and_color;
  888. struct iwl_fw_channel_info channel_info;
  889. u8 node_addr[ETH_ALEN];
  890. __le16 reserved;
  891. __le32 apply_time;
  892. __le32 apply_time_max_delay;
  893. __le32 duration;
  894. } __packed; /* HOT_SPOT_CMD_API_S_VER_1 */
  895. /*
  896. * values for AUX ROC result values
  897. */
  898. enum iwl_mvm_hot_spot {
  899. HOT_SPOT_RSP_STATUS_OK,
  900. HOT_SPOT_RSP_STATUS_TOO_MANY_EVENTS,
  901. HOT_SPOT_MAX_NUM_OF_SESSIONS,
  902. };
  903. /*
  904. * Aux ROC command response
  905. *
  906. * In response to iwl_hs20_roc_req the FW sends this command to notify the
  907. * driver the uid of the timevent.
  908. *
  909. * ( HOT_SPOT_CMD 0x53 )
  910. *
  911. * @event_unique_id: Unique ID of time event assigned by ucode
  912. * @status: Return status 0 is success, all the rest used for specific errors
  913. */
  914. struct iwl_hs20_roc_res {
  915. __le32 event_unique_id;
  916. __le32 status;
  917. } __packed; /* HOT_SPOT_RSP_API_S_VER_1 */
  918. #define IWL_RX_INFO_PHY_CNT 8
  919. #define IWL_RX_INFO_ENERGY_ANT_ABC_IDX 1
  920. #define IWL_RX_INFO_ENERGY_ANT_A_MSK 0x000000ff
  921. #define IWL_RX_INFO_ENERGY_ANT_B_MSK 0x0000ff00
  922. #define IWL_RX_INFO_ENERGY_ANT_C_MSK 0x00ff0000
  923. #define IWL_RX_INFO_ENERGY_ANT_A_POS 0
  924. #define IWL_RX_INFO_ENERGY_ANT_B_POS 8
  925. #define IWL_RX_INFO_ENERGY_ANT_C_POS 16
  926. #define IWL_RX_INFO_AGC_IDX 1
  927. #define IWL_RX_INFO_RSSI_AB_IDX 2
  928. #define IWL_OFDM_AGC_A_MSK 0x0000007f
  929. #define IWL_OFDM_AGC_A_POS 0
  930. #define IWL_OFDM_AGC_B_MSK 0x00003f80
  931. #define IWL_OFDM_AGC_B_POS 7
  932. #define IWL_OFDM_AGC_CODE_MSK 0x3fe00000
  933. #define IWL_OFDM_AGC_CODE_POS 20
  934. #define IWL_OFDM_RSSI_INBAND_A_MSK 0x00ff
  935. #define IWL_OFDM_RSSI_A_POS 0
  936. #define IWL_OFDM_RSSI_ALLBAND_A_MSK 0xff00
  937. #define IWL_OFDM_RSSI_ALLBAND_A_POS 8
  938. #define IWL_OFDM_RSSI_INBAND_B_MSK 0xff0000
  939. #define IWL_OFDM_RSSI_B_POS 16
  940. #define IWL_OFDM_RSSI_ALLBAND_B_MSK 0xff000000
  941. #define IWL_OFDM_RSSI_ALLBAND_B_POS 24
  942. /**
  943. * struct iwl_rx_phy_info - phy info
  944. * (REPLY_RX_PHY_CMD = 0xc0)
  945. * @non_cfg_phy_cnt: non configurable DSP phy data byte count
  946. * @cfg_phy_cnt: configurable DSP phy data byte count
  947. * @stat_id: configurable DSP phy data set ID
  948. * @reserved1:
  949. * @system_timestamp: GP2 at on air rise
  950. * @timestamp: TSF at on air rise
  951. * @beacon_time_stamp: beacon at on-air rise
  952. * @phy_flags: general phy flags: band, modulation, ...
  953. * @channel: channel number
  954. * @non_cfg_phy_buf: for various implementations of non_cfg_phy
  955. * @rate_n_flags: RATE_MCS_*
  956. * @byte_count: frame's byte-count
  957. * @frame_time: frame's time on the air, based on byte count and frame rate
  958. * calculation
  959. * @mac_active_msk: what MACs were active when the frame was received
  960. *
  961. * Before each Rx, the device sends this data. It contains PHY information
  962. * about the reception of the packet.
  963. */
  964. struct iwl_rx_phy_info {
  965. u8 non_cfg_phy_cnt;
  966. u8 cfg_phy_cnt;
  967. u8 stat_id;
  968. u8 reserved1;
  969. __le32 system_timestamp;
  970. __le64 timestamp;
  971. __le32 beacon_time_stamp;
  972. __le16 phy_flags;
  973. __le16 channel;
  974. __le32 non_cfg_phy[IWL_RX_INFO_PHY_CNT];
  975. __le32 rate_n_flags;
  976. __le32 byte_count;
  977. __le16 mac_active_msk;
  978. __le16 frame_time;
  979. } __packed;
  980. struct iwl_rx_mpdu_res_start {
  981. __le16 byte_count;
  982. __le16 reserved;
  983. } __packed;
  984. /**
  985. * enum iwl_rx_phy_flags - to parse %iwl_rx_phy_info phy_flags
  986. * @RX_RES_PHY_FLAGS_BAND_24: true if the packet was received on 2.4 band
  987. * @RX_RES_PHY_FLAGS_MOD_CCK:
  988. * @RX_RES_PHY_FLAGS_SHORT_PREAMBLE: true if packet's preamble was short
  989. * @RX_RES_PHY_FLAGS_NARROW_BAND:
  990. * @RX_RES_PHY_FLAGS_ANTENNA: antenna on which the packet was received
  991. * @RX_RES_PHY_FLAGS_AGG: set if the packet was part of an A-MPDU
  992. * @RX_RES_PHY_FLAGS_OFDM_HT: The frame was an HT frame
  993. * @RX_RES_PHY_FLAGS_OFDM_GF: The frame used GF preamble
  994. * @RX_RES_PHY_FLAGS_OFDM_VHT: The frame was a VHT frame
  995. */
  996. enum iwl_rx_phy_flags {
  997. RX_RES_PHY_FLAGS_BAND_24 = BIT(0),
  998. RX_RES_PHY_FLAGS_MOD_CCK = BIT(1),
  999. RX_RES_PHY_FLAGS_SHORT_PREAMBLE = BIT(2),
  1000. RX_RES_PHY_FLAGS_NARROW_BAND = BIT(3),
  1001. RX_RES_PHY_FLAGS_ANTENNA = (0x7 << 4),
  1002. RX_RES_PHY_FLAGS_ANTENNA_POS = 4,
  1003. RX_RES_PHY_FLAGS_AGG = BIT(7),
  1004. RX_RES_PHY_FLAGS_OFDM_HT = BIT(8),
  1005. RX_RES_PHY_FLAGS_OFDM_GF = BIT(9),
  1006. RX_RES_PHY_FLAGS_OFDM_VHT = BIT(10),
  1007. };
  1008. /**
  1009. * enum iwl_mvm_rx_status - written by fw for each Rx packet
  1010. * @RX_MPDU_RES_STATUS_CRC_OK: CRC is fine
  1011. * @RX_MPDU_RES_STATUS_OVERRUN_OK: there was no RXE overflow
  1012. * @RX_MPDU_RES_STATUS_SRC_STA_FOUND:
  1013. * @RX_MPDU_RES_STATUS_KEY_VALID:
  1014. * @RX_MPDU_RES_STATUS_KEY_PARAM_OK:
  1015. * @RX_MPDU_RES_STATUS_ICV_OK: ICV is fine, if not, the packet is destroyed
  1016. * @RX_MPDU_RES_STATUS_MIC_OK: used for CCM alg only. TKIP MIC is checked
  1017. * in the driver.
  1018. * @RX_MPDU_RES_STATUS_TTAK_OK: TTAK is fine
  1019. * @RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR: valid for alg = CCM_CMAC or
  1020. * alg = CCM only. Checks replay attack for 11w frames. Relevant only if
  1021. * %RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME is set.
  1022. * @RX_MPDU_RES_STATUS_SEC_NO_ENC: this frame is not encrypted
  1023. * @RX_MPDU_RES_STATUS_SEC_WEP_ENC: this frame is encrypted using WEP
  1024. * @RX_MPDU_RES_STATUS_SEC_CCM_ENC: this frame is encrypted using CCM
  1025. * @RX_MPDU_RES_STATUS_SEC_TKIP_ENC: this frame is encrypted using TKIP
  1026. * @RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC: this frame is encrypted using CCM_CMAC
  1027. * @RX_MPDU_RES_STATUS_SEC_ENC_ERR: this frame couldn't be decrypted
  1028. * @RX_MPDU_RES_STATUS_SEC_ENC_MSK: bitmask of the encryption algorithm
  1029. * @RX_MPDU_RES_STATUS_DEC_DONE: this frame has been successfully decrypted
  1030. * @RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP:
  1031. * @RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP:
  1032. * @RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT:
  1033. * @RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME: this frame is an 11w management frame
  1034. * @RX_MPDU_RES_STATUS_HASH_INDEX_MSK:
  1035. * @RX_MPDU_RES_STATUS_STA_ID_MSK:
  1036. * @RX_MPDU_RES_STATUS_RRF_KILL:
  1037. * @RX_MPDU_RES_STATUS_FILTERING_MSK:
  1038. * @RX_MPDU_RES_STATUS2_FILTERING_MSK:
  1039. */
  1040. enum iwl_mvm_rx_status {
  1041. RX_MPDU_RES_STATUS_CRC_OK = BIT(0),
  1042. RX_MPDU_RES_STATUS_OVERRUN_OK = BIT(1),
  1043. RX_MPDU_RES_STATUS_SRC_STA_FOUND = BIT(2),
  1044. RX_MPDU_RES_STATUS_KEY_VALID = BIT(3),
  1045. RX_MPDU_RES_STATUS_KEY_PARAM_OK = BIT(4),
  1046. RX_MPDU_RES_STATUS_ICV_OK = BIT(5),
  1047. RX_MPDU_RES_STATUS_MIC_OK = BIT(6),
  1048. RX_MPDU_RES_STATUS_TTAK_OK = BIT(7),
  1049. RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR = BIT(7),
  1050. RX_MPDU_RES_STATUS_SEC_NO_ENC = (0 << 8),
  1051. RX_MPDU_RES_STATUS_SEC_WEP_ENC = (1 << 8),
  1052. RX_MPDU_RES_STATUS_SEC_CCM_ENC = (2 << 8),
  1053. RX_MPDU_RES_STATUS_SEC_TKIP_ENC = (3 << 8),
  1054. RX_MPDU_RES_STATUS_SEC_EXT_ENC = (4 << 8),
  1055. RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC = (6 << 8),
  1056. RX_MPDU_RES_STATUS_SEC_ENC_ERR = (7 << 8),
  1057. RX_MPDU_RES_STATUS_SEC_ENC_MSK = (7 << 8),
  1058. RX_MPDU_RES_STATUS_DEC_DONE = BIT(11),
  1059. RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP = BIT(12),
  1060. RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP = BIT(13),
  1061. RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT = BIT(14),
  1062. RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME = BIT(15),
  1063. RX_MPDU_RES_STATUS_HASH_INDEX_MSK = (0x3F0000),
  1064. RX_MPDU_RES_STATUS_STA_ID_MSK = (0x1f000000),
  1065. RX_MPDU_RES_STATUS_RRF_KILL = BIT(29),
  1066. RX_MPDU_RES_STATUS_FILTERING_MSK = (0xc00000),
  1067. RX_MPDU_RES_STATUS2_FILTERING_MSK = (0xc0000000),
  1068. };
  1069. /**
  1070. * struct iwl_radio_version_notif - information on the radio version
  1071. * ( RADIO_VERSION_NOTIFICATION = 0x68 )
  1072. * @radio_flavor:
  1073. * @radio_step:
  1074. * @radio_dash:
  1075. */
  1076. struct iwl_radio_version_notif {
  1077. __le32 radio_flavor;
  1078. __le32 radio_step;
  1079. __le32 radio_dash;
  1080. } __packed; /* RADIO_VERSION_NOTOFICATION_S_VER_1 */
  1081. enum iwl_card_state_flags {
  1082. CARD_ENABLED = 0x00,
  1083. HW_CARD_DISABLED = 0x01,
  1084. SW_CARD_DISABLED = 0x02,
  1085. CT_KILL_CARD_DISABLED = 0x04,
  1086. HALT_CARD_DISABLED = 0x08,
  1087. CARD_DISABLED_MSK = 0x0f,
  1088. CARD_IS_RX_ON = 0x10,
  1089. };
  1090. /**
  1091. * struct iwl_radio_version_notif - information on the radio version
  1092. * ( CARD_STATE_NOTIFICATION = 0xa1 )
  1093. * @flags: %iwl_card_state_flags
  1094. */
  1095. struct iwl_card_state_notif {
  1096. __le32 flags;
  1097. } __packed; /* CARD_STATE_NTFY_API_S_VER_1 */
  1098. /**
  1099. * struct iwl_missed_beacons_notif - information on missed beacons
  1100. * ( MISSED_BEACONS_NOTIFICATION = 0xa2 )
  1101. * @mac_id: interface ID
  1102. * @consec_missed_beacons_since_last_rx: number of consecutive missed
  1103. * beacons since last RX.
  1104. * @consec_missed_beacons: number of consecutive missed beacons
  1105. * @num_expected_beacons:
  1106. * @num_recvd_beacons:
  1107. */
  1108. struct iwl_missed_beacons_notif {
  1109. __le32 mac_id;
  1110. __le32 consec_missed_beacons_since_last_rx;
  1111. __le32 consec_missed_beacons;
  1112. __le32 num_expected_beacons;
  1113. __le32 num_recvd_beacons;
  1114. } __packed; /* MISSED_BEACON_NTFY_API_S_VER_3 */
  1115. /**
  1116. * struct iwl_mfuart_load_notif - mfuart image version & status
  1117. * ( MFUART_LOAD_NOTIFICATION = 0xb1 )
  1118. * @installed_ver: installed image version
  1119. * @external_ver: external image version
  1120. * @status: MFUART loading status
  1121. * @duration: MFUART loading time
  1122. */
  1123. struct iwl_mfuart_load_notif {
  1124. __le32 installed_ver;
  1125. __le32 external_ver;
  1126. __le32 status;
  1127. __le32 duration;
  1128. } __packed; /*MFU_LOADER_NTFY_API_S_VER_1*/
  1129. /**
  1130. * struct iwl_set_calib_default_cmd - set default value for calibration.
  1131. * ( SET_CALIB_DEFAULT_CMD = 0x8e )
  1132. * @calib_index: the calibration to set value for
  1133. * @length: of data
  1134. * @data: the value to set for the calibration result
  1135. */
  1136. struct iwl_set_calib_default_cmd {
  1137. __le16 calib_index;
  1138. __le16 length;
  1139. u8 data[0];
  1140. } __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */
  1141. #define MAX_PORT_ID_NUM 2
  1142. #define MAX_MCAST_FILTERING_ADDRESSES 256
  1143. /**
  1144. * struct iwl_mcast_filter_cmd - configure multicast filter.
  1145. * @filter_own: Set 1 to filter out multicast packets sent by station itself
  1146. * @port_id: Multicast MAC addresses array specifier. This is a strange way
  1147. * to identify network interface adopted in host-device IF.
  1148. * It is used by FW as index in array of addresses. This array has
  1149. * MAX_PORT_ID_NUM members.
  1150. * @count: Number of MAC addresses in the array
  1151. * @pass_all: Set 1 to pass all multicast packets.
  1152. * @bssid: current association BSSID.
  1153. * @addr_list: Place holder for array of MAC addresses.
  1154. * IMPORTANT: add padding if necessary to ensure DWORD alignment.
  1155. */
  1156. struct iwl_mcast_filter_cmd {
  1157. u8 filter_own;
  1158. u8 port_id;
  1159. u8 count;
  1160. u8 pass_all;
  1161. u8 bssid[6];
  1162. u8 reserved[2];
  1163. u8 addr_list[0];
  1164. } __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */
  1165. #define MAX_BCAST_FILTERS 8
  1166. #define MAX_BCAST_FILTER_ATTRS 2
  1167. /**
  1168. * enum iwl_mvm_bcast_filter_attr_offset - written by fw for each Rx packet
  1169. * @BCAST_FILTER_OFFSET_PAYLOAD_START: offset is from payload start.
  1170. * @BCAST_FILTER_OFFSET_IP_END: offset is from ip header end (i.e.
  1171. * start of ip payload).
  1172. */
  1173. enum iwl_mvm_bcast_filter_attr_offset {
  1174. BCAST_FILTER_OFFSET_PAYLOAD_START = 0,
  1175. BCAST_FILTER_OFFSET_IP_END = 1,
  1176. };
  1177. /**
  1178. * struct iwl_fw_bcast_filter_attr - broadcast filter attribute
  1179. * @offset_type: &enum iwl_mvm_bcast_filter_attr_offset.
  1180. * @offset: starting offset of this pattern.
  1181. * @val: value to match - big endian (MSB is the first
  1182. * byte to match from offset pos).
  1183. * @mask: mask to match (big endian).
  1184. */
  1185. struct iwl_fw_bcast_filter_attr {
  1186. u8 offset_type;
  1187. u8 offset;
  1188. __le16 reserved1;
  1189. __be32 val;
  1190. __be32 mask;
  1191. } __packed; /* BCAST_FILTER_ATT_S_VER_1 */
  1192. /**
  1193. * enum iwl_mvm_bcast_filter_frame_type - filter frame type
  1194. * @BCAST_FILTER_FRAME_TYPE_ALL: consider all frames.
  1195. * @BCAST_FILTER_FRAME_TYPE_IPV4: consider only ipv4 frames
  1196. */
  1197. enum iwl_mvm_bcast_filter_frame_type {
  1198. BCAST_FILTER_FRAME_TYPE_ALL = 0,
  1199. BCAST_FILTER_FRAME_TYPE_IPV4 = 1,
  1200. };
  1201. /**
  1202. * struct iwl_fw_bcast_filter - broadcast filter
  1203. * @discard: discard frame (1) or let it pass (0).
  1204. * @frame_type: &enum iwl_mvm_bcast_filter_frame_type.
  1205. * @num_attrs: number of valid attributes in this filter.
  1206. * @attrs: attributes of this filter. a filter is considered matched
  1207. * only when all its attributes are matched (i.e. AND relationship)
  1208. */
  1209. struct iwl_fw_bcast_filter {
  1210. u8 discard;
  1211. u8 frame_type;
  1212. u8 num_attrs;
  1213. u8 reserved1;
  1214. struct iwl_fw_bcast_filter_attr attrs[MAX_BCAST_FILTER_ATTRS];
  1215. } __packed; /* BCAST_FILTER_S_VER_1 */
  1216. /**
  1217. * struct iwl_fw_bcast_mac - per-mac broadcast filtering configuration.
  1218. * @default_discard: default action for this mac (discard (1) / pass (0)).
  1219. * @attached_filters: bitmap of relevant filters for this mac.
  1220. */
  1221. struct iwl_fw_bcast_mac {
  1222. u8 default_discard;
  1223. u8 reserved1;
  1224. __le16 attached_filters;
  1225. } __packed; /* BCAST_MAC_CONTEXT_S_VER_1 */
  1226. /**
  1227. * struct iwl_bcast_filter_cmd - broadcast filtering configuration
  1228. * @disable: enable (0) / disable (1)
  1229. * @max_bcast_filters: max number of filters (MAX_BCAST_FILTERS)
  1230. * @max_macs: max number of macs (NUM_MAC_INDEX_DRIVER)
  1231. * @filters: broadcast filters
  1232. * @macs: broadcast filtering configuration per-mac
  1233. */
  1234. struct iwl_bcast_filter_cmd {
  1235. u8 disable;
  1236. u8 max_bcast_filters;
  1237. u8 max_macs;
  1238. u8 reserved1;
  1239. struct iwl_fw_bcast_filter filters[MAX_BCAST_FILTERS];
  1240. struct iwl_fw_bcast_mac macs[NUM_MAC_INDEX_DRIVER];
  1241. } __packed; /* BCAST_FILTERING_HCMD_API_S_VER_1 */
  1242. /*
  1243. * enum iwl_mvm_marker_id - maker ids
  1244. *
  1245. * The ids for different type of markers to insert into the usniffer logs
  1246. */
  1247. enum iwl_mvm_marker_id {
  1248. MARKER_ID_TX_FRAME_LATENCY = 1,
  1249. }; /* MARKER_ID_API_E_VER_1 */
  1250. /**
  1251. * struct iwl_mvm_marker - mark info into the usniffer logs
  1252. *
  1253. * (MARKER_CMD = 0xcb)
  1254. *
  1255. * Mark the UTC time stamp into the usniffer logs together with additional
  1256. * metadata, so the usniffer output can be parsed.
  1257. * In the command response the ucode will return the GP2 time.
  1258. *
  1259. * @dw_len: The amount of dwords following this byte including this byte.
  1260. * @marker_id: A unique marker id (iwl_mvm_marker_id).
  1261. * @reserved: reserved.
  1262. * @timestamp: in milliseconds since 1970-01-01 00:00:00 UTC
  1263. * @metadata: additional meta data that will be written to the unsiffer log
  1264. */
  1265. struct iwl_mvm_marker {
  1266. u8 dwLen;
  1267. u8 markerId;
  1268. __le16 reserved;
  1269. __le64 timestamp;
  1270. __le32 metadata[0];
  1271. } __packed; /* MARKER_API_S_VER_1 */
  1272. /***********************************
  1273. * Smart Fifo API
  1274. ***********************************/
  1275. /* Smart Fifo state */
  1276. enum iwl_sf_state {
  1277. SF_LONG_DELAY_ON = 0, /* should never be called by driver */
  1278. SF_FULL_ON,
  1279. SF_UNINIT,
  1280. SF_INIT_OFF,
  1281. SF_HW_NUM_STATES
  1282. };
  1283. /* Smart Fifo possible scenario */
  1284. enum iwl_sf_scenario {
  1285. SF_SCENARIO_SINGLE_UNICAST,
  1286. SF_SCENARIO_AGG_UNICAST,
  1287. SF_SCENARIO_MULTICAST,
  1288. SF_SCENARIO_BA_RESP,
  1289. SF_SCENARIO_TX_RESP,
  1290. SF_NUM_SCENARIO
  1291. };
  1292. #define SF_TRANSIENT_STATES_NUMBER 2 /* SF_LONG_DELAY_ON and SF_FULL_ON */
  1293. #define SF_NUM_TIMEOUT_TYPES 2 /* Aging timer and Idle timer */
  1294. /* smart FIFO default values */
  1295. #define SF_W_MARK_SISO 6144
  1296. #define SF_W_MARK_MIMO2 8192
  1297. #define SF_W_MARK_MIMO3 6144
  1298. #define SF_W_MARK_LEGACY 4096
  1299. #define SF_W_MARK_SCAN 4096
  1300. /* SF Scenarios timers for FULL_ON state (aligned to 32 uSec) */
  1301. #define SF_SINGLE_UNICAST_IDLE_TIMER 320 /* 300 uSec */
  1302. #define SF_SINGLE_UNICAST_AGING_TIMER 2016 /* 2 mSec */
  1303. #define SF_AGG_UNICAST_IDLE_TIMER 320 /* 300 uSec */
  1304. #define SF_AGG_UNICAST_AGING_TIMER 2016 /* 2 mSec */
  1305. #define SF_MCAST_IDLE_TIMER 2016 /* 2 mSec */
  1306. #define SF_MCAST_AGING_TIMER 10016 /* 10 mSec */
  1307. #define SF_BA_IDLE_TIMER 320 /* 300 uSec */
  1308. #define SF_BA_AGING_TIMER 2016 /* 2 mSec */
  1309. #define SF_TX_RE_IDLE_TIMER 320 /* 300 uSec */
  1310. #define SF_TX_RE_AGING_TIMER 2016 /* 2 mSec */
  1311. #define SF_LONG_DELAY_AGING_TIMER 1000000 /* 1 Sec */
  1312. #define SF_CFG_DUMMY_NOTIF_OFF BIT(16)
  1313. /**
  1314. * Smart Fifo configuration command.
  1315. * @state: smart fifo state, types listed in enum %iwl_sf_sate.
  1316. * @watermark: Minimum allowed availabe free space in RXF for transient state.
  1317. * @long_delay_timeouts: aging and idle timer values for each scenario
  1318. * in long delay state.
  1319. * @full_on_timeouts: timer values for each scenario in full on state.
  1320. */
  1321. struct iwl_sf_cfg_cmd {
  1322. __le32 state;
  1323. __le32 watermark[SF_TRANSIENT_STATES_NUMBER];
  1324. __le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
  1325. __le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
  1326. } __packed; /* SF_CFG_API_S_VER_2 */
  1327. /* DTS measurements */
  1328. enum iwl_dts_measurement_flags {
  1329. DTS_TRIGGER_CMD_FLAGS_TEMP = BIT(0),
  1330. DTS_TRIGGER_CMD_FLAGS_VOLT = BIT(1),
  1331. };
  1332. /**
  1333. * iwl_dts_measurement_cmd - request DTS temperature and/or voltage measurements
  1334. *
  1335. * @flags: indicates which measurements we want as specified in &enum
  1336. * iwl_dts_measurement_flags
  1337. */
  1338. struct iwl_dts_measurement_cmd {
  1339. __le32 flags;
  1340. } __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_CMD_S */
  1341. /**
  1342. * iwl_dts_measurement_notif - notification received with the measurements
  1343. *
  1344. * @temp: the measured temperature
  1345. * @voltage: the measured voltage
  1346. */
  1347. struct iwl_dts_measurement_notif {
  1348. __le32 temp;
  1349. __le32 voltage;
  1350. } __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S */
  1351. /***********************************
  1352. * TDLS API
  1353. ***********************************/
  1354. /* Type of TDLS request */
  1355. enum iwl_tdls_channel_switch_type {
  1356. TDLS_SEND_CHAN_SW_REQ = 0,
  1357. TDLS_SEND_CHAN_SW_RESP_AND_MOVE_CH,
  1358. TDLS_MOVE_CH,
  1359. }; /* TDLS_STA_CHANNEL_SWITCH_CMD_TYPE_API_E_VER_1 */
  1360. /**
  1361. * Switch timing sub-element in a TDLS channel-switch command
  1362. * @frame_timestamp: GP2 timestamp of channel-switch request/response packet
  1363. * received from peer
  1364. * @max_offchan_duration: What amount of microseconds out of a DTIM is given
  1365. * to the TDLS off-channel communication. For instance if the DTIM is
  1366. * 200TU and the TDLS peer is to be given 25% of the time, the value
  1367. * given will be 50TU, or 50 * 1024 if translated into microseconds.
  1368. * @switch_time: switch time the peer sent in its channel switch timing IE
  1369. * @switch_timout: switch timeout the peer sent in its channel switch timing IE
  1370. */
  1371. struct iwl_tdls_channel_switch_timing {
  1372. __le32 frame_timestamp; /* GP2 time of peer packet Rx */
  1373. __le32 max_offchan_duration; /* given in micro-seconds */
  1374. __le32 switch_time; /* given in micro-seconds */
  1375. __le32 switch_timeout; /* given in micro-seconds */
  1376. } __packed; /* TDLS_STA_CHANNEL_SWITCH_TIMING_DATA_API_S_VER_1 */
  1377. #define IWL_TDLS_CH_SW_FRAME_MAX_SIZE 200
  1378. /**
  1379. * TDLS channel switch frame template
  1380. *
  1381. * A template representing a TDLS channel-switch request or response frame
  1382. *
  1383. * @switch_time_offset: offset to the channel switch timing IE in the template
  1384. * @tx_cmd: Tx parameters for the frame
  1385. * @data: frame data
  1386. */
  1387. struct iwl_tdls_channel_switch_frame {
  1388. __le32 switch_time_offset;
  1389. struct iwl_tx_cmd tx_cmd;
  1390. u8 data[IWL_TDLS_CH_SW_FRAME_MAX_SIZE];
  1391. } __packed; /* TDLS_STA_CHANNEL_SWITCH_FRAME_API_S_VER_1 */
  1392. /**
  1393. * TDLS channel switch command
  1394. *
  1395. * The command is sent to initiate a channel switch and also in response to
  1396. * incoming TDLS channel-switch request/response packets from remote peers.
  1397. *
  1398. * @switch_type: see &enum iwl_tdls_channel_switch_type
  1399. * @peer_sta_id: station id of TDLS peer
  1400. * @ci: channel we switch to
  1401. * @timing: timing related data for command
  1402. * @frame: channel-switch request/response template, depending to switch_type
  1403. */
  1404. struct iwl_tdls_channel_switch_cmd {
  1405. u8 switch_type;
  1406. __le32 peer_sta_id;
  1407. struct iwl_fw_channel_info ci;
  1408. struct iwl_tdls_channel_switch_timing timing;
  1409. struct iwl_tdls_channel_switch_frame frame;
  1410. } __packed; /* TDLS_STA_CHANNEL_SWITCH_CMD_API_S_VER_1 */
  1411. /**
  1412. * TDLS channel switch start notification
  1413. *
  1414. * @status: non-zero on success
  1415. * @offchannel_duration: duration given in microseconds
  1416. * @sta_id: peer currently performing the channel-switch with
  1417. */
  1418. struct iwl_tdls_channel_switch_notif {
  1419. __le32 status;
  1420. __le32 offchannel_duration;
  1421. __le32 sta_id;
  1422. } __packed; /* TDLS_STA_CHANNEL_SWITCH_NTFY_API_S_VER_1 */
  1423. /**
  1424. * TDLS station info
  1425. *
  1426. * @sta_id: station id of the TDLS peer
  1427. * @tx_to_peer_tid: TID reserved vs. the peer for FW based Tx
  1428. * @tx_to_peer_ssn: initial SSN the FW should use for Tx on its TID vs the peer
  1429. * @is_initiator: 1 if the peer is the TDLS link initiator, 0 otherwise
  1430. */
  1431. struct iwl_tdls_sta_info {
  1432. u8 sta_id;
  1433. u8 tx_to_peer_tid;
  1434. __le16 tx_to_peer_ssn;
  1435. __le32 is_initiator;
  1436. } __packed; /* TDLS_STA_INFO_VER_1 */
  1437. /**
  1438. * TDLS basic config command
  1439. *
  1440. * @id_and_color: MAC id and color being configured
  1441. * @tdls_peer_count: amount of currently connected TDLS peers
  1442. * @tx_to_ap_tid: TID reverved vs. the AP for FW based Tx
  1443. * @tx_to_ap_ssn: initial SSN the FW should use for Tx on its TID vs. the AP
  1444. * @sta_info: per-station info. Only the first tdls_peer_count entries are set
  1445. * @pti_req_data_offset: offset of network-level data for the PTI template
  1446. * @pti_req_tx_cmd: Tx parameters for PTI request template
  1447. * @pti_req_template: PTI request template data
  1448. */
  1449. struct iwl_tdls_config_cmd {
  1450. __le32 id_and_color; /* mac id and color */
  1451. u8 tdls_peer_count;
  1452. u8 tx_to_ap_tid;
  1453. __le16 tx_to_ap_ssn;
  1454. struct iwl_tdls_sta_info sta_info[IWL_MVM_TDLS_STA_COUNT];
  1455. __le32 pti_req_data_offset;
  1456. struct iwl_tx_cmd pti_req_tx_cmd;
  1457. u8 pti_req_template[0];
  1458. } __packed; /* TDLS_CONFIG_CMD_API_S_VER_1 */
  1459. /**
  1460. * TDLS per-station config information from FW
  1461. *
  1462. * @sta_id: station id of the TDLS peer
  1463. * @tx_to_peer_last_seq: last sequence number used by FW during FW-based Tx to
  1464. * the peer
  1465. */
  1466. struct iwl_tdls_config_sta_info_res {
  1467. __le16 sta_id;
  1468. __le16 tx_to_peer_last_seq;
  1469. } __packed; /* TDLS_STA_INFO_RSP_VER_1 */
  1470. /**
  1471. * TDLS config information from FW
  1472. *
  1473. * @tx_to_ap_last_seq: last sequence number used by FW during FW-based Tx to AP
  1474. * @sta_info: per-station TDLS config information
  1475. */
  1476. struct iwl_tdls_config_res {
  1477. __le32 tx_to_ap_last_seq;
  1478. struct iwl_tdls_config_sta_info_res sta_info[IWL_MVM_TDLS_STA_COUNT];
  1479. } __packed; /* TDLS_CONFIG_RSP_API_S_VER_1 */
  1480. #define TX_FIFO_MAX_NUM 8
  1481. #define RX_FIFO_MAX_NUM 2
  1482. /**
  1483. * Shared memory configuration information from the FW
  1484. *
  1485. * @shared_mem_addr: shared memory addr (pre 8000 HW set to 0x0 as MARBH is not
  1486. * accessible)
  1487. * @shared_mem_size: shared memory size
  1488. * @sample_buff_addr: internal sample (mon/adc) buff addr (pre 8000 HW set to
  1489. * 0x0 as accessible only via DBGM RDAT)
  1490. * @sample_buff_size: internal sample buff size
  1491. * @txfifo_addr: start addr of TXF0 (excluding the context table 0.5KB), (pre
  1492. * 8000 HW set to 0x0 as not accessible)
  1493. * @txfifo_size: size of TXF0 ... TXF7
  1494. * @rxfifo_size: RXF1, RXF2 sizes. If there is no RXF2, it'll have a value of 0
  1495. * @page_buff_addr: used by UMAC and performance debug (page miss analysis),
  1496. * when paging is not supported this should be 0
  1497. * @page_buff_size: size of %page_buff_addr
  1498. */
  1499. struct iwl_shared_mem_cfg {
  1500. __le32 shared_mem_addr;
  1501. __le32 shared_mem_size;
  1502. __le32 sample_buff_addr;
  1503. __le32 sample_buff_size;
  1504. __le32 txfifo_addr;
  1505. __le32 txfifo_size[TX_FIFO_MAX_NUM];
  1506. __le32 rxfifo_size[RX_FIFO_MAX_NUM];
  1507. __le32 page_buff_addr;
  1508. __le32 page_buff_size;
  1509. } __packed; /* SHARED_MEM_ALLOC_API_S_VER_1 */
  1510. #endif /* __fw_api_h__ */