fw-api.h 54 KB

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