fw-api.h 55 KB

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