fw-api.h 52 KB

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