fw-api.h 50 KB

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