fw-api.h 57 KB

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