fw-api.h 57 KB

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