fw-api.h 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211
  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 - 2013 Intel Corporation. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of version 2 of the GNU General Public License as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  22. * USA
  23. *
  24. * The full GNU General Public License is included in this distribution
  25. * in the file called COPYING.
  26. *
  27. * Contact Information:
  28. * Intel Linux Wireless <ilw@linux.intel.com>
  29. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  30. *
  31. * BSD LICENSE
  32. *
  33. * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
  34. * All rights reserved.
  35. *
  36. * Redistribution and use in source and binary forms, with or without
  37. * modification, are permitted provided that the following conditions
  38. * are met:
  39. *
  40. * * Redistributions of source code must retain the above copyright
  41. * notice, this list of conditions and the following disclaimer.
  42. * * Redistributions in binary form must reproduce the above copyright
  43. * notice, this list of conditions and the following disclaimer in
  44. * the documentation and/or other materials provided with the
  45. * distribution.
  46. * * Neither the name Intel Corporation nor the names of its
  47. * contributors may be used to endorse or promote products derived
  48. * from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  51. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  52. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  53. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  54. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  55. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  56. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  57. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  58. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  59. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  60. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  61. *
  62. *****************************************************************************/
  63. #ifndef __fw_api_h__
  64. #define __fw_api_h__
  65. #include "fw-api-rs.h"
  66. #include "fw-api-tx.h"
  67. #include "fw-api-sta.h"
  68. #include "fw-api-mac.h"
  69. #include "fw-api-power.h"
  70. #include "fw-api-d3.h"
  71. #include "fw-api-bt-coex.h"
  72. /* queue and FIFO numbers by usage */
  73. enum {
  74. IWL_MVM_OFFCHANNEL_QUEUE = 8,
  75. IWL_MVM_CMD_QUEUE = 9,
  76. IWL_MVM_AUX_QUEUE = 15,
  77. IWL_MVM_FIRST_AGG_QUEUE = 16,
  78. IWL_MVM_NUM_QUEUES = 20,
  79. IWL_MVM_LAST_AGG_QUEUE = IWL_MVM_NUM_QUEUES - 1,
  80. IWL_MVM_CMD_FIFO = 7
  81. };
  82. #define IWL_MVM_STATION_COUNT 16
  83. /* commands */
  84. enum {
  85. MVM_ALIVE = 0x1,
  86. REPLY_ERROR = 0x2,
  87. INIT_COMPLETE_NOTIF = 0x4,
  88. /* PHY context commands */
  89. PHY_CONTEXT_CMD = 0x8,
  90. DBG_CFG = 0x9,
  91. /* station table */
  92. ADD_STA = 0x18,
  93. REMOVE_STA = 0x19,
  94. /* TX */
  95. TX_CMD = 0x1c,
  96. TXPATH_FLUSH = 0x1e,
  97. MGMT_MCAST_KEY = 0x1f,
  98. /* global key */
  99. WEP_KEY = 0x20,
  100. /* MAC and Binding commands */
  101. MAC_CONTEXT_CMD = 0x28,
  102. TIME_EVENT_CMD = 0x29, /* both CMD and response */
  103. TIME_EVENT_NOTIFICATION = 0x2a,
  104. BINDING_CONTEXT_CMD = 0x2b,
  105. TIME_QUOTA_CMD = 0x2c,
  106. LQ_CMD = 0x4e,
  107. /* Calibration */
  108. TEMPERATURE_NOTIFICATION = 0x62,
  109. CALIBRATION_CFG_CMD = 0x65,
  110. CALIBRATION_RES_NOTIFICATION = 0x66,
  111. CALIBRATION_COMPLETE_NOTIFICATION = 0x67,
  112. RADIO_VERSION_NOTIFICATION = 0x68,
  113. /* Scan offload */
  114. SCAN_OFFLOAD_REQUEST_CMD = 0x51,
  115. SCAN_OFFLOAD_ABORT_CMD = 0x52,
  116. SCAN_OFFLOAD_COMPLETE = 0x6D,
  117. SCAN_OFFLOAD_UPDATE_PROFILES_CMD = 0x6E,
  118. SCAN_OFFLOAD_CONFIG_CMD = 0x6f,
  119. /* Phy */
  120. PHY_CONFIGURATION_CMD = 0x6a,
  121. CALIB_RES_NOTIF_PHY_DB = 0x6b,
  122. /* PHY_DB_CMD = 0x6c, */
  123. /* Power */
  124. POWER_TABLE_CMD = 0x77,
  125. /* Thermal Throttling*/
  126. REPLY_THERMAL_MNG_BACKOFF = 0x7e,
  127. /* Scanning */
  128. SCAN_REQUEST_CMD = 0x80,
  129. SCAN_ABORT_CMD = 0x81,
  130. SCAN_START_NOTIFICATION = 0x82,
  131. SCAN_RESULTS_NOTIFICATION = 0x83,
  132. SCAN_COMPLETE_NOTIFICATION = 0x84,
  133. /* NVM */
  134. NVM_ACCESS_CMD = 0x88,
  135. SET_CALIB_DEFAULT_CMD = 0x8e,
  136. BEACON_NOTIFICATION = 0x90,
  137. BEACON_TEMPLATE_CMD = 0x91,
  138. TX_ANT_CONFIGURATION_CMD = 0x98,
  139. BT_CONFIG = 0x9b,
  140. STATISTICS_NOTIFICATION = 0x9d,
  141. /* RF-KILL commands and notifications */
  142. CARD_STATE_CMD = 0xa0,
  143. CARD_STATE_NOTIFICATION = 0xa1,
  144. MISSED_BEACONS_NOTIFICATION = 0xa2,
  145. REPLY_RX_PHY_CMD = 0xc0,
  146. REPLY_RX_MPDU_CMD = 0xc1,
  147. BA_NOTIF = 0xc5,
  148. /* BT Coex */
  149. BT_COEX_PRIO_TABLE = 0xcc,
  150. BT_COEX_PROT_ENV = 0xcd,
  151. BT_PROFILE_NOTIFICATION = 0xce,
  152. REPLY_BEACON_FILTERING_CMD = 0xd2,
  153. REPLY_DEBUG_CMD = 0xf0,
  154. DEBUG_LOG_MSG = 0xf7,
  155. MCAST_FILTER_CMD = 0xd0,
  156. /* D3 commands/notifications */
  157. D3_CONFIG_CMD = 0xd3,
  158. PROT_OFFLOAD_CONFIG_CMD = 0xd4,
  159. OFFLOADS_QUERY_CMD = 0xd5,
  160. REMOTE_WAKE_CONFIG_CMD = 0xd6,
  161. /* for WoWLAN in particular */
  162. WOWLAN_PATTERNS = 0xe0,
  163. WOWLAN_CONFIGURATION = 0xe1,
  164. WOWLAN_TSC_RSC_PARAM = 0xe2,
  165. WOWLAN_TKIP_PARAM = 0xe3,
  166. WOWLAN_KEK_KCK_MATERIAL = 0xe4,
  167. WOWLAN_GET_STATUSES = 0xe5,
  168. WOWLAN_TX_POWER_PER_DB = 0xe6,
  169. /* and for NetDetect */
  170. NET_DETECT_CONFIG_CMD = 0x54,
  171. NET_DETECT_PROFILES_QUERY_CMD = 0x56,
  172. NET_DETECT_PROFILES_CMD = 0x57,
  173. NET_DETECT_HOTSPOTS_CMD = 0x58,
  174. NET_DETECT_HOTSPOTS_QUERY_CMD = 0x59,
  175. REPLY_MAX = 0xff,
  176. };
  177. /**
  178. * struct iwl_cmd_response - generic response struct for most commands
  179. * @status: status of the command asked, changes for each one
  180. */
  181. struct iwl_cmd_response {
  182. __le32 status;
  183. };
  184. /*
  185. * struct iwl_tx_ant_cfg_cmd
  186. * @valid: valid antenna configuration
  187. */
  188. struct iwl_tx_ant_cfg_cmd {
  189. __le32 valid;
  190. } __packed;
  191. /*
  192. * Calibration control struct.
  193. * Sent as part of the phy configuration command.
  194. * @flow_trigger: bitmap for which calibrations to perform according to
  195. * flow triggers.
  196. * @event_trigger: bitmap for which calibrations to perform according to
  197. * event triggers.
  198. */
  199. struct iwl_calib_ctrl {
  200. __le32 flow_trigger;
  201. __le32 event_trigger;
  202. } __packed;
  203. /* This enum defines the bitmap of various calibrations to enable in both
  204. * init ucode and runtime ucode through CALIBRATION_CFG_CMD.
  205. */
  206. enum iwl_calib_cfg {
  207. IWL_CALIB_CFG_XTAL_IDX = BIT(0),
  208. IWL_CALIB_CFG_TEMPERATURE_IDX = BIT(1),
  209. IWL_CALIB_CFG_VOLTAGE_READ_IDX = BIT(2),
  210. IWL_CALIB_CFG_PAPD_IDX = BIT(3),
  211. IWL_CALIB_CFG_TX_PWR_IDX = BIT(4),
  212. IWL_CALIB_CFG_DC_IDX = BIT(5),
  213. IWL_CALIB_CFG_BB_FILTER_IDX = BIT(6),
  214. IWL_CALIB_CFG_LO_LEAKAGE_IDX = BIT(7),
  215. IWL_CALIB_CFG_TX_IQ_IDX = BIT(8),
  216. IWL_CALIB_CFG_TX_IQ_SKEW_IDX = BIT(9),
  217. IWL_CALIB_CFG_RX_IQ_IDX = BIT(10),
  218. IWL_CALIB_CFG_RX_IQ_SKEW_IDX = BIT(11),
  219. IWL_CALIB_CFG_SENSITIVITY_IDX = BIT(12),
  220. IWL_CALIB_CFG_CHAIN_NOISE_IDX = BIT(13),
  221. IWL_CALIB_CFG_DISCONNECTED_ANT_IDX = BIT(14),
  222. IWL_CALIB_CFG_ANT_COUPLING_IDX = BIT(15),
  223. IWL_CALIB_CFG_DAC_IDX = BIT(16),
  224. IWL_CALIB_CFG_ABS_IDX = BIT(17),
  225. IWL_CALIB_CFG_AGC_IDX = BIT(18),
  226. };
  227. /*
  228. * Phy configuration command.
  229. */
  230. struct iwl_phy_cfg_cmd {
  231. __le32 phy_cfg;
  232. struct iwl_calib_ctrl calib_control;
  233. } __packed;
  234. #define PHY_CFG_RADIO_TYPE (BIT(0) | BIT(1))
  235. #define PHY_CFG_RADIO_STEP (BIT(2) | BIT(3))
  236. #define PHY_CFG_RADIO_DASH (BIT(4) | BIT(5))
  237. #define PHY_CFG_PRODUCT_NUMBER (BIT(6) | BIT(7))
  238. #define PHY_CFG_TX_CHAIN_A BIT(8)
  239. #define PHY_CFG_TX_CHAIN_B BIT(9)
  240. #define PHY_CFG_TX_CHAIN_C BIT(10)
  241. #define PHY_CFG_RX_CHAIN_A BIT(12)
  242. #define PHY_CFG_RX_CHAIN_B BIT(13)
  243. #define PHY_CFG_RX_CHAIN_C BIT(14)
  244. /* Target of the NVM_ACCESS_CMD */
  245. enum {
  246. NVM_ACCESS_TARGET_CACHE = 0,
  247. NVM_ACCESS_TARGET_OTP = 1,
  248. NVM_ACCESS_TARGET_EEPROM = 2,
  249. };
  250. /* Section types for NVM_ACCESS_CMD */
  251. enum {
  252. NVM_SECTION_TYPE_HW = 0,
  253. NVM_SECTION_TYPE_SW,
  254. NVM_SECTION_TYPE_PAPD,
  255. NVM_SECTION_TYPE_BT,
  256. NVM_SECTION_TYPE_CALIBRATION,
  257. NVM_SECTION_TYPE_PRODUCTION,
  258. NVM_SECTION_TYPE_POST_FCS_CALIB,
  259. NVM_NUM_OF_SECTIONS,
  260. };
  261. /**
  262. * struct iwl_nvm_access_cmd_ver2 - Request the device to send an NVM section
  263. * @op_code: 0 - read, 1 - write
  264. * @target: NVM_ACCESS_TARGET_*
  265. * @type: NVM_SECTION_TYPE_*
  266. * @offset: offset in bytes into the section
  267. * @length: in bytes, to read/write
  268. * @data: if write operation, the data to write. On read its empty
  269. */
  270. struct iwl_nvm_access_cmd {
  271. u8 op_code;
  272. u8 target;
  273. __le16 type;
  274. __le16 offset;
  275. __le16 length;
  276. u8 data[];
  277. } __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */
  278. /**
  279. * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD
  280. * @offset: offset in bytes into the section
  281. * @length: in bytes, either how much was written or read
  282. * @type: NVM_SECTION_TYPE_*
  283. * @status: 0 for success, fail otherwise
  284. * @data: if read operation, the data returned. Empty on write.
  285. */
  286. struct iwl_nvm_access_resp {
  287. __le16 offset;
  288. __le16 length;
  289. __le16 type;
  290. __le16 status;
  291. u8 data[];
  292. } __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */
  293. /* MVM_ALIVE 0x1 */
  294. /* alive response is_valid values */
  295. #define ALIVE_RESP_UCODE_OK BIT(0)
  296. #define ALIVE_RESP_RFKILL BIT(1)
  297. /* alive response ver_type values */
  298. enum {
  299. FW_TYPE_HW = 0,
  300. FW_TYPE_PROT = 1,
  301. FW_TYPE_AP = 2,
  302. FW_TYPE_WOWLAN = 3,
  303. FW_TYPE_TIMING = 4,
  304. FW_TYPE_WIPAN = 5
  305. };
  306. /* alive response ver_subtype values */
  307. enum {
  308. FW_SUBTYPE_FULL_FEATURE = 0,
  309. FW_SUBTYPE_BOOTSRAP = 1, /* Not valid */
  310. FW_SUBTYPE_REDUCED = 2,
  311. FW_SUBTYPE_ALIVE_ONLY = 3,
  312. FW_SUBTYPE_WOWLAN = 4,
  313. FW_SUBTYPE_AP_SUBTYPE = 5,
  314. FW_SUBTYPE_WIPAN = 6,
  315. FW_SUBTYPE_INITIALIZE = 9
  316. };
  317. #define IWL_ALIVE_STATUS_ERR 0xDEAD
  318. #define IWL_ALIVE_STATUS_OK 0xCAFE
  319. #define IWL_ALIVE_FLG_RFKILL BIT(0)
  320. struct mvm_alive_resp {
  321. __le16 status;
  322. __le16 flags;
  323. u8 ucode_minor;
  324. u8 ucode_major;
  325. __le16 id;
  326. u8 api_minor;
  327. u8 api_major;
  328. u8 ver_subtype;
  329. u8 ver_type;
  330. u8 mac;
  331. u8 opt;
  332. __le16 reserved2;
  333. __le32 timestamp;
  334. __le32 error_event_table_ptr; /* SRAM address for error log */
  335. __le32 log_event_table_ptr; /* SRAM address for event log */
  336. __le32 cpu_register_ptr;
  337. __le32 dbgm_config_ptr;
  338. __le32 alive_counter_ptr;
  339. __le32 scd_base_ptr; /* SRAM address for SCD */
  340. } __packed; /* ALIVE_RES_API_S_VER_1 */
  341. /* Error response/notification */
  342. enum {
  343. FW_ERR_UNKNOWN_CMD = 0x0,
  344. FW_ERR_INVALID_CMD_PARAM = 0x1,
  345. FW_ERR_SERVICE = 0x2,
  346. FW_ERR_ARC_MEMORY = 0x3,
  347. FW_ERR_ARC_CODE = 0x4,
  348. FW_ERR_WATCH_DOG = 0x5,
  349. FW_ERR_WEP_GRP_KEY_INDX = 0x10,
  350. FW_ERR_WEP_KEY_SIZE = 0x11,
  351. FW_ERR_OBSOLETE_FUNC = 0x12,
  352. FW_ERR_UNEXPECTED = 0xFE,
  353. FW_ERR_FATAL = 0xFF
  354. };
  355. /**
  356. * struct iwl_error_resp - FW error indication
  357. * ( REPLY_ERROR = 0x2 )
  358. * @error_type: one of FW_ERR_*
  359. * @cmd_id: the command ID for which the error occured
  360. * @bad_cmd_seq_num: sequence number of the erroneous command
  361. * @error_service: which service created the error, applicable only if
  362. * error_type = 2, otherwise 0
  363. * @timestamp: TSF in usecs.
  364. */
  365. struct iwl_error_resp {
  366. __le32 error_type;
  367. u8 cmd_id;
  368. u8 reserved1;
  369. __le16 bad_cmd_seq_num;
  370. __le32 error_service;
  371. __le64 timestamp;
  372. } __packed;
  373. /* Common PHY, MAC and Bindings definitions */
  374. #define MAX_MACS_IN_BINDING (3)
  375. #define MAX_BINDINGS (4)
  376. #define AUX_BINDING_INDEX (3)
  377. #define MAX_PHYS (4)
  378. /* Used to extract ID and color from the context dword */
  379. #define FW_CTXT_ID_POS (0)
  380. #define FW_CTXT_ID_MSK (0xff << FW_CTXT_ID_POS)
  381. #define FW_CTXT_COLOR_POS (8)
  382. #define FW_CTXT_COLOR_MSK (0xff << FW_CTXT_COLOR_POS)
  383. #define FW_CTXT_INVALID (0xffffffff)
  384. #define FW_CMD_ID_AND_COLOR(_id, _color) ((_id << FW_CTXT_ID_POS) |\
  385. (_color << FW_CTXT_COLOR_POS))
  386. /* Possible actions on PHYs, MACs and Bindings */
  387. enum {
  388. FW_CTXT_ACTION_STUB = 0,
  389. FW_CTXT_ACTION_ADD,
  390. FW_CTXT_ACTION_MODIFY,
  391. FW_CTXT_ACTION_REMOVE,
  392. FW_CTXT_ACTION_NUM
  393. }; /* COMMON_CONTEXT_ACTION_API_E_VER_1 */
  394. /* Time Events */
  395. /* Time Event types, according to MAC type */
  396. enum iwl_time_event_type {
  397. /* BSS Station Events */
  398. TE_BSS_STA_AGGRESSIVE_ASSOC,
  399. TE_BSS_STA_ASSOC,
  400. TE_BSS_EAP_DHCP_PROT,
  401. TE_BSS_QUIET_PERIOD,
  402. /* P2P Device Events */
  403. TE_P2P_DEVICE_DISCOVERABLE,
  404. TE_P2P_DEVICE_LISTEN,
  405. TE_P2P_DEVICE_ACTION_SCAN,
  406. TE_P2P_DEVICE_FULL_SCAN,
  407. /* P2P Client Events */
  408. TE_P2P_CLIENT_AGGRESSIVE_ASSOC,
  409. TE_P2P_CLIENT_ASSOC,
  410. TE_P2P_CLIENT_QUIET_PERIOD,
  411. /* P2P GO Events */
  412. TE_P2P_GO_ASSOC_PROT,
  413. TE_P2P_GO_REPETITIVE_NOA,
  414. TE_P2P_GO_CT_WINDOW,
  415. /* WiDi Sync Events */
  416. TE_WIDI_TX_SYNC,
  417. TE_MAX
  418. }; /* MAC_EVENT_TYPE_API_E_VER_1 */
  419. /* Time Event dependencies: none, on another TE, or in a specific time */
  420. enum {
  421. TE_INDEPENDENT = 0,
  422. TE_DEP_OTHER = 1,
  423. TE_DEP_TSF = 2,
  424. TE_EVENT_SOCIOPATHIC = 4,
  425. }; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */
  426. /*
  427. * Supported Time event notifications configuration.
  428. * A notification (both event and fragment) includes a status indicating weather
  429. * the FW was able to schedule the event or not. For fragment start/end
  430. * notification the status is always success. There is no start/end fragment
  431. * notification for monolithic events.
  432. *
  433. * @TE_NOTIF_NONE: no notifications
  434. * @TE_NOTIF_HOST_EVENT_START: request/receive notification on event start
  435. * @TE_NOTIF_HOST_EVENT_END:request/receive notification on event end
  436. * @TE_NOTIF_INTERNAL_EVENT_START: internal FW use
  437. * @TE_NOTIF_INTERNAL_EVENT_END: internal FW use.
  438. * @TE_NOTIF_HOST_FRAG_START: request/receive notification on frag start
  439. * @TE_NOTIF_HOST_FRAG_END:request/receive notification on frag end
  440. * @TE_NOTIF_INTERNAL_FRAG_START: internal FW use.
  441. * @TE_NOTIF_INTERNAL_FRAG_END: internal FW use.
  442. */
  443. enum {
  444. TE_NOTIF_NONE = 0,
  445. TE_NOTIF_HOST_EVENT_START = 0x1,
  446. TE_NOTIF_HOST_EVENT_END = 0x2,
  447. TE_NOTIF_INTERNAL_EVENT_START = 0x4,
  448. TE_NOTIF_INTERNAL_EVENT_END = 0x8,
  449. TE_NOTIF_HOST_FRAG_START = 0x10,
  450. TE_NOTIF_HOST_FRAG_END = 0x20,
  451. TE_NOTIF_INTERNAL_FRAG_START = 0x40,
  452. TE_NOTIF_INTERNAL_FRAG_END = 0x80
  453. }; /* MAC_EVENT_ACTION_API_E_VER_2 */
  454. /*
  455. * @TE_FRAG_NONE: fragmentation of the time event is NOT allowed.
  456. * @TE_FRAG_SINGLE: fragmentation of the time event is allowed, but only
  457. * the first fragment is scheduled.
  458. * @TE_FRAG_DUAL: fragmentation of the time event is allowed, but only
  459. * the first 2 fragments are scheduled.
  460. * @TE_FRAG_ENDLESS: fragmentation of the time event is allowed, and any number
  461. * of fragments are valid.
  462. *
  463. * Other than the constant defined above, specifying a fragmentation value 'x'
  464. * means that the event can be fragmented but only the first 'x' will be
  465. * scheduled.
  466. */
  467. enum {
  468. TE_FRAG_NONE = 0,
  469. TE_FRAG_SINGLE = 1,
  470. TE_FRAG_DUAL = 2,
  471. TE_FRAG_ENDLESS = 0xffffffff
  472. };
  473. /* Repeat the time event endlessly (until removed) */
  474. #define TE_REPEAT_ENDLESS (0xffffffff)
  475. /* If a Time Event has bounded repetitions, this is the maximal value */
  476. #define TE_REPEAT_MAX_MSK (0x0fffffff)
  477. /* If a Time Event can be fragmented, this is the max number of fragments */
  478. #define TE_FRAG_MAX_MSK (0x0fffffff)
  479. /**
  480. * struct iwl_time_event_cmd - configuring Time Events
  481. * ( TIME_EVENT_CMD = 0x29 )
  482. * @id_and_color: ID and color of the relevant MAC
  483. * @action: action to perform, one of FW_CTXT_ACTION_*
  484. * @id: this field has two meanings, depending on the action:
  485. * If the action is ADD, then it means the type of event to add.
  486. * For all other actions it is the unique event ID assigned when the
  487. * event was added by the FW.
  488. * @apply_time: When to start the Time Event (in GP2)
  489. * @max_delay: maximum delay to event's start (apply time), in TU
  490. * @depends_on: the unique ID of the event we depend on (if any)
  491. * @interval: interval between repetitions, in TU
  492. * @interval_reciprocal: 2^32 / interval
  493. * @duration: duration of event in TU
  494. * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS
  495. * @dep_policy: one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF
  496. * @is_present: 0 or 1, are we present or absent during the Time Event
  497. * @max_frags: maximal number of fragments the Time Event can be divided to
  498. * @notify: notifications using TE_NOTIF_* (whom to notify when)
  499. */
  500. struct iwl_time_event_cmd {
  501. /* COMMON_INDEX_HDR_API_S_VER_1 */
  502. __le32 id_and_color;
  503. __le32 action;
  504. __le32 id;
  505. /* MAC_TIME_EVENT_DATA_API_S_VER_1 */
  506. __le32 apply_time;
  507. __le32 max_delay;
  508. __le32 dep_policy;
  509. __le32 depends_on;
  510. __le32 is_present;
  511. __le32 max_frags;
  512. __le32 interval;
  513. __le32 interval_reciprocal;
  514. __le32 duration;
  515. __le32 repeat;
  516. __le32 notify;
  517. } __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_1 */
  518. /**
  519. * struct iwl_time_event_resp - response structure to iwl_time_event_cmd
  520. * @status: bit 0 indicates success, all others specify errors
  521. * @id: the Time Event type
  522. * @unique_id: the unique ID assigned (in ADD) or given (others) to the TE
  523. * @id_and_color: ID and color of the relevant MAC
  524. */
  525. struct iwl_time_event_resp {
  526. __le32 status;
  527. __le32 id;
  528. __le32 unique_id;
  529. __le32 id_and_color;
  530. } __packed; /* MAC_TIME_EVENT_RSP_API_S_VER_1 */
  531. /**
  532. * struct iwl_time_event_notif - notifications of time event start/stop
  533. * ( TIME_EVENT_NOTIFICATION = 0x2a )
  534. * @timestamp: action timestamp in GP2
  535. * @session_id: session's unique id
  536. * @unique_id: unique id of the Time Event itself
  537. * @id_and_color: ID and color of the relevant MAC
  538. * @action: one of TE_NOTIF_START or TE_NOTIF_END
  539. * @status: true if scheduled, false otherwise (not executed)
  540. */
  541. struct iwl_time_event_notif {
  542. __le32 timestamp;
  543. __le32 session_id;
  544. __le32 unique_id;
  545. __le32 id_and_color;
  546. __le32 action;
  547. __le32 status;
  548. } __packed; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */
  549. /* Bindings and Time Quota */
  550. /**
  551. * struct iwl_binding_cmd - configuring bindings
  552. * ( BINDING_CONTEXT_CMD = 0x2b )
  553. * @id_and_color: ID and color of the relevant Binding
  554. * @action: action to perform, one of FW_CTXT_ACTION_*
  555. * @macs: array of MAC id and colors which belong to the binding
  556. * @phy: PHY id and color which belongs to the binding
  557. */
  558. struct iwl_binding_cmd {
  559. /* COMMON_INDEX_HDR_API_S_VER_1 */
  560. __le32 id_and_color;
  561. __le32 action;
  562. /* BINDING_DATA_API_S_VER_1 */
  563. __le32 macs[MAX_MACS_IN_BINDING];
  564. __le32 phy;
  565. } __packed; /* BINDING_CMD_API_S_VER_1 */
  566. /* The maximal number of fragments in the FW's schedule session */
  567. #define IWL_MVM_MAX_QUOTA 128
  568. /**
  569. * struct iwl_time_quota_data - configuration of time quota per binding
  570. * @id_and_color: ID and color of the relevant Binding
  571. * @quota: absolute time quota in TU. The scheduler will try to divide the
  572. * remainig quota (after Time Events) according to this quota.
  573. * @max_duration: max uninterrupted context duration in TU
  574. */
  575. struct iwl_time_quota_data {
  576. __le32 id_and_color;
  577. __le32 quota;
  578. __le32 max_duration;
  579. } __packed; /* TIME_QUOTA_DATA_API_S_VER_1 */
  580. /**
  581. * struct iwl_time_quota_cmd - configuration of time quota between bindings
  582. * ( TIME_QUOTA_CMD = 0x2c )
  583. * @quotas: allocations per binding
  584. */
  585. struct iwl_time_quota_cmd {
  586. struct iwl_time_quota_data quotas[MAX_BINDINGS];
  587. } __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_1 */
  588. /* PHY context */
  589. /* Supported bands */
  590. #define PHY_BAND_5 (0)
  591. #define PHY_BAND_24 (1)
  592. /* Supported channel width, vary if there is VHT support */
  593. #define PHY_VHT_CHANNEL_MODE20 (0x0)
  594. #define PHY_VHT_CHANNEL_MODE40 (0x1)
  595. #define PHY_VHT_CHANNEL_MODE80 (0x2)
  596. #define PHY_VHT_CHANNEL_MODE160 (0x3)
  597. /*
  598. * Control channel position:
  599. * For legacy set bit means upper channel, otherwise lower.
  600. * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
  601. * bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
  602. * center_freq
  603. * |
  604. * 40Mhz |_______|_______|
  605. * 80Mhz |_______|_______|_______|_______|
  606. * 160Mhz |_______|_______|_______|_______|_______|_______|_______|_______|
  607. * code 011 010 001 000 | 100 101 110 111
  608. */
  609. #define PHY_VHT_CTRL_POS_1_BELOW (0x0)
  610. #define PHY_VHT_CTRL_POS_2_BELOW (0x1)
  611. #define PHY_VHT_CTRL_POS_3_BELOW (0x2)
  612. #define PHY_VHT_CTRL_POS_4_BELOW (0x3)
  613. #define PHY_VHT_CTRL_POS_1_ABOVE (0x4)
  614. #define PHY_VHT_CTRL_POS_2_ABOVE (0x5)
  615. #define PHY_VHT_CTRL_POS_3_ABOVE (0x6)
  616. #define PHY_VHT_CTRL_POS_4_ABOVE (0x7)
  617. /*
  618. * @band: PHY_BAND_*
  619. * @channel: channel number
  620. * @width: PHY_[VHT|LEGACY]_CHANNEL_*
  621. * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
  622. */
  623. struct iwl_fw_channel_info {
  624. u8 band;
  625. u8 channel;
  626. u8 width;
  627. u8 ctrl_pos;
  628. } __packed;
  629. #define PHY_RX_CHAIN_DRIVER_FORCE_POS (0)
  630. #define PHY_RX_CHAIN_DRIVER_FORCE_MSK \
  631. (0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS)
  632. #define PHY_RX_CHAIN_VALID_POS (1)
  633. #define PHY_RX_CHAIN_VALID_MSK \
  634. (0x7 << PHY_RX_CHAIN_VALID_POS)
  635. #define PHY_RX_CHAIN_FORCE_SEL_POS (4)
  636. #define PHY_RX_CHAIN_FORCE_SEL_MSK \
  637. (0x7 << PHY_RX_CHAIN_FORCE_SEL_POS)
  638. #define PHY_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
  639. #define PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \
  640. (0x7 << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS)
  641. #define PHY_RX_CHAIN_CNT_POS (10)
  642. #define PHY_RX_CHAIN_CNT_MSK \
  643. (0x3 << PHY_RX_CHAIN_CNT_POS)
  644. #define PHY_RX_CHAIN_MIMO_CNT_POS (12)
  645. #define PHY_RX_CHAIN_MIMO_CNT_MSK \
  646. (0x3 << PHY_RX_CHAIN_MIMO_CNT_POS)
  647. #define PHY_RX_CHAIN_MIMO_FORCE_POS (14)
  648. #define PHY_RX_CHAIN_MIMO_FORCE_MSK \
  649. (0x1 << PHY_RX_CHAIN_MIMO_FORCE_POS)
  650. /* TODO: fix the value, make it depend on firmware at runtime? */
  651. #define NUM_PHY_CTX 3
  652. /* TODO: complete missing documentation */
  653. /**
  654. * struct iwl_phy_context_cmd - config of the PHY context
  655. * ( PHY_CONTEXT_CMD = 0x8 )
  656. * @id_and_color: ID and color of the relevant Binding
  657. * @action: action to perform, one of FW_CTXT_ACTION_*
  658. * @apply_time: 0 means immediate apply and context switch.
  659. * other value means apply new params after X usecs
  660. * @tx_param_color: ???
  661. * @channel_info:
  662. * @txchain_info: ???
  663. * @rxchain_info: ???
  664. * @acquisition_data: ???
  665. * @dsp_cfg_flags: set to 0
  666. */
  667. struct iwl_phy_context_cmd {
  668. /* COMMON_INDEX_HDR_API_S_VER_1 */
  669. __le32 id_and_color;
  670. __le32 action;
  671. /* PHY_CONTEXT_DATA_API_S_VER_1 */
  672. __le32 apply_time;
  673. __le32 tx_param_color;
  674. struct iwl_fw_channel_info ci;
  675. __le32 txchain_info;
  676. __le32 rxchain_info;
  677. __le32 acquisition_data;
  678. __le32 dsp_cfg_flags;
  679. } __packed; /* PHY_CONTEXT_CMD_API_VER_1 */
  680. #define IWL_RX_INFO_PHY_CNT 8
  681. #define IWL_RX_INFO_AGC_IDX 1
  682. #define IWL_RX_INFO_RSSI_AB_IDX 2
  683. #define IWL_OFDM_AGC_A_MSK 0x0000007f
  684. #define IWL_OFDM_AGC_A_POS 0
  685. #define IWL_OFDM_AGC_B_MSK 0x00003f80
  686. #define IWL_OFDM_AGC_B_POS 7
  687. #define IWL_OFDM_AGC_CODE_MSK 0x3fe00000
  688. #define IWL_OFDM_AGC_CODE_POS 20
  689. #define IWL_OFDM_RSSI_INBAND_A_MSK 0x00ff
  690. #define IWL_OFDM_RSSI_A_POS 0
  691. #define IWL_OFDM_RSSI_ALLBAND_A_MSK 0xff00
  692. #define IWL_OFDM_RSSI_ALLBAND_A_POS 8
  693. #define IWL_OFDM_RSSI_INBAND_B_MSK 0xff0000
  694. #define IWL_OFDM_RSSI_B_POS 16
  695. #define IWL_OFDM_RSSI_ALLBAND_B_MSK 0xff000000
  696. #define IWL_OFDM_RSSI_ALLBAND_B_POS 24
  697. /**
  698. * struct iwl_rx_phy_info - phy info
  699. * (REPLY_RX_PHY_CMD = 0xc0)
  700. * @non_cfg_phy_cnt: non configurable DSP phy data byte count
  701. * @cfg_phy_cnt: configurable DSP phy data byte count
  702. * @stat_id: configurable DSP phy data set ID
  703. * @reserved1:
  704. * @system_timestamp: GP2 at on air rise
  705. * @timestamp: TSF at on air rise
  706. * @beacon_time_stamp: beacon at on-air rise
  707. * @phy_flags: general phy flags: band, modulation, ...
  708. * @channel: channel number
  709. * @non_cfg_phy_buf: for various implementations of non_cfg_phy
  710. * @rate_n_flags: RATE_MCS_*
  711. * @byte_count: frame's byte-count
  712. * @frame_time: frame's time on the air, based on byte count and frame rate
  713. * calculation
  714. * @mac_active_msk: what MACs were active when the frame was received
  715. *
  716. * Before each Rx, the device sends this data. It contains PHY information
  717. * about the reception of the packet.
  718. */
  719. struct iwl_rx_phy_info {
  720. u8 non_cfg_phy_cnt;
  721. u8 cfg_phy_cnt;
  722. u8 stat_id;
  723. u8 reserved1;
  724. __le32 system_timestamp;
  725. __le64 timestamp;
  726. __le32 beacon_time_stamp;
  727. __le16 phy_flags;
  728. __le16 channel;
  729. __le32 non_cfg_phy[IWL_RX_INFO_PHY_CNT];
  730. __le32 rate_n_flags;
  731. __le32 byte_count;
  732. __le16 mac_active_msk;
  733. __le16 frame_time;
  734. } __packed;
  735. struct iwl_rx_mpdu_res_start {
  736. __le16 byte_count;
  737. __le16 reserved;
  738. } __packed;
  739. /**
  740. * enum iwl_rx_phy_flags - to parse %iwl_rx_phy_info phy_flags
  741. * @RX_RES_PHY_FLAGS_BAND_24: true if the packet was received on 2.4 band
  742. * @RX_RES_PHY_FLAGS_MOD_CCK:
  743. * @RX_RES_PHY_FLAGS_SHORT_PREAMBLE: true if packet's preamble was short
  744. * @RX_RES_PHY_FLAGS_NARROW_BAND:
  745. * @RX_RES_PHY_FLAGS_ANTENNA: antenna on which the packet was received
  746. * @RX_RES_PHY_FLAGS_AGG: set if the packet was part of an A-MPDU
  747. * @RX_RES_PHY_FLAGS_OFDM_HT: The frame was an HT frame
  748. * @RX_RES_PHY_FLAGS_OFDM_GF: The frame used GF preamble
  749. * @RX_RES_PHY_FLAGS_OFDM_VHT: The frame was a VHT frame
  750. */
  751. enum iwl_rx_phy_flags {
  752. RX_RES_PHY_FLAGS_BAND_24 = BIT(0),
  753. RX_RES_PHY_FLAGS_MOD_CCK = BIT(1),
  754. RX_RES_PHY_FLAGS_SHORT_PREAMBLE = BIT(2),
  755. RX_RES_PHY_FLAGS_NARROW_BAND = BIT(3),
  756. RX_RES_PHY_FLAGS_ANTENNA = (0x7 << 4),
  757. RX_RES_PHY_FLAGS_ANTENNA_POS = 4,
  758. RX_RES_PHY_FLAGS_AGG = BIT(7),
  759. RX_RES_PHY_FLAGS_OFDM_HT = BIT(8),
  760. RX_RES_PHY_FLAGS_OFDM_GF = BIT(9),
  761. RX_RES_PHY_FLAGS_OFDM_VHT = BIT(10),
  762. };
  763. /**
  764. * enum iwl_mvm_rx_status - written by fw for each Rx packet
  765. * @RX_MPDU_RES_STATUS_CRC_OK: CRC is fine
  766. * @RX_MPDU_RES_STATUS_OVERRUN_OK: there was no RXE overflow
  767. * @RX_MPDU_RES_STATUS_SRC_STA_FOUND:
  768. * @RX_MPDU_RES_STATUS_KEY_VALID:
  769. * @RX_MPDU_RES_STATUS_KEY_PARAM_OK:
  770. * @RX_MPDU_RES_STATUS_ICV_OK: ICV is fine, if not, the packet is destroyed
  771. * @RX_MPDU_RES_STATUS_MIC_OK: used for CCM alg only. TKIP MIC is checked
  772. * in the driver.
  773. * @RX_MPDU_RES_STATUS_TTAK_OK: TTAK is fine
  774. * @RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR: valid for alg = CCM_CMAC or
  775. * alg = CCM only. Checks replay attack for 11w frames. Relevant only if
  776. * %RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME is set.
  777. * @RX_MPDU_RES_STATUS_SEC_NO_ENC: this frame is not encrypted
  778. * @RX_MPDU_RES_STATUS_SEC_WEP_ENC: this frame is encrypted using WEP
  779. * @RX_MPDU_RES_STATUS_SEC_CCM_ENC: this frame is encrypted using CCM
  780. * @RX_MPDU_RES_STATUS_SEC_TKIP_ENC: this frame is encrypted using TKIP
  781. * @RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC: this frame is encrypted using CCM_CMAC
  782. * @RX_MPDU_RES_STATUS_SEC_ENC_ERR: this frame couldn't be decrypted
  783. * @RX_MPDU_RES_STATUS_SEC_ENC_MSK: bitmask of the encryption algorithm
  784. * @RX_MPDU_RES_STATUS_DEC_DONE: this frame has been successfully decrypted
  785. * @RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP:
  786. * @RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP:
  787. * @RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT:
  788. * @RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME: this frame is an 11w management frame
  789. * @RX_MPDU_RES_STATUS_HASH_INDEX_MSK:
  790. * @RX_MPDU_RES_STATUS_STA_ID_MSK:
  791. * @RX_MPDU_RES_STATUS_RRF_KILL:
  792. * @RX_MPDU_RES_STATUS_FILTERING_MSK:
  793. * @RX_MPDU_RES_STATUS2_FILTERING_MSK:
  794. */
  795. enum iwl_mvm_rx_status {
  796. RX_MPDU_RES_STATUS_CRC_OK = BIT(0),
  797. RX_MPDU_RES_STATUS_OVERRUN_OK = BIT(1),
  798. RX_MPDU_RES_STATUS_SRC_STA_FOUND = BIT(2),
  799. RX_MPDU_RES_STATUS_KEY_VALID = BIT(3),
  800. RX_MPDU_RES_STATUS_KEY_PARAM_OK = BIT(4),
  801. RX_MPDU_RES_STATUS_ICV_OK = BIT(5),
  802. RX_MPDU_RES_STATUS_MIC_OK = BIT(6),
  803. RX_MPDU_RES_STATUS_TTAK_OK = BIT(7),
  804. RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR = BIT(7),
  805. RX_MPDU_RES_STATUS_SEC_NO_ENC = (0 << 8),
  806. RX_MPDU_RES_STATUS_SEC_WEP_ENC = (1 << 8),
  807. RX_MPDU_RES_STATUS_SEC_CCM_ENC = (2 << 8),
  808. RX_MPDU_RES_STATUS_SEC_TKIP_ENC = (3 << 8),
  809. RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC = (6 << 8),
  810. RX_MPDU_RES_STATUS_SEC_ENC_ERR = (7 << 8),
  811. RX_MPDU_RES_STATUS_SEC_ENC_MSK = (7 << 8),
  812. RX_MPDU_RES_STATUS_DEC_DONE = BIT(11),
  813. RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP = BIT(12),
  814. RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP = BIT(13),
  815. RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT = BIT(14),
  816. RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME = BIT(15),
  817. RX_MPDU_RES_STATUS_HASH_INDEX_MSK = (0x3F0000),
  818. RX_MPDU_RES_STATUS_STA_ID_MSK = (0x1f000000),
  819. RX_MPDU_RES_STATUS_RRF_KILL = BIT(29),
  820. RX_MPDU_RES_STATUS_FILTERING_MSK = (0xc00000),
  821. RX_MPDU_RES_STATUS2_FILTERING_MSK = (0xc0000000),
  822. };
  823. /**
  824. * struct iwl_radio_version_notif - information on the radio version
  825. * ( RADIO_VERSION_NOTIFICATION = 0x68 )
  826. * @radio_flavor:
  827. * @radio_step:
  828. * @radio_dash:
  829. */
  830. struct iwl_radio_version_notif {
  831. __le32 radio_flavor;
  832. __le32 radio_step;
  833. __le32 radio_dash;
  834. } __packed; /* RADIO_VERSION_NOTOFICATION_S_VER_1 */
  835. enum iwl_card_state_flags {
  836. CARD_ENABLED = 0x00,
  837. HW_CARD_DISABLED = 0x01,
  838. SW_CARD_DISABLED = 0x02,
  839. CT_KILL_CARD_DISABLED = 0x04,
  840. HALT_CARD_DISABLED = 0x08,
  841. CARD_DISABLED_MSK = 0x0f,
  842. CARD_IS_RX_ON = 0x10,
  843. };
  844. /**
  845. * struct iwl_radio_version_notif - information on the radio version
  846. * ( CARD_STATE_NOTIFICATION = 0xa1 )
  847. * @flags: %iwl_card_state_flags
  848. */
  849. struct iwl_card_state_notif {
  850. __le32 flags;
  851. } __packed; /* CARD_STATE_NTFY_API_S_VER_1 */
  852. /**
  853. * struct iwl_missed_beacons_notif - information on missed beacons
  854. * ( MISSED_BEACONS_NOTIFICATION = 0xa2 )
  855. * @mac_id: interface ID
  856. * @consec_missed_beacons_since_last_rx: number of consecutive missed
  857. * beacons since last RX.
  858. * @consec_missed_beacons: number of consecutive missed beacons
  859. * @num_expected_beacons:
  860. * @num_recvd_beacons:
  861. */
  862. struct iwl_missed_beacons_notif {
  863. __le32 mac_id;
  864. __le32 consec_missed_beacons_since_last_rx;
  865. __le32 consec_missed_beacons;
  866. __le32 num_expected_beacons;
  867. __le32 num_recvd_beacons;
  868. } __packed; /* MISSED_BEACON_NTFY_API_S_VER_3 */
  869. /**
  870. * struct iwl_set_calib_default_cmd - set default value for calibration.
  871. * ( SET_CALIB_DEFAULT_CMD = 0x8e )
  872. * @calib_index: the calibration to set value for
  873. * @length: of data
  874. * @data: the value to set for the calibration result
  875. */
  876. struct iwl_set_calib_default_cmd {
  877. __le16 calib_index;
  878. __le16 length;
  879. u8 data[0];
  880. } __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */
  881. #define MAX_PORT_ID_NUM 2
  882. /**
  883. * struct iwl_mcast_filter_cmd - configure multicast filter.
  884. * @filter_own: Set 1 to filter out multicast packets sent by station itself
  885. * @port_id: Multicast MAC addresses array specifier. This is a strange way
  886. * to identify network interface adopted in host-device IF.
  887. * It is used by FW as index in array of addresses. This array has
  888. * MAX_PORT_ID_NUM members.
  889. * @count: Number of MAC addresses in the array
  890. * @pass_all: Set 1 to pass all multicast packets.
  891. * @bssid: current association BSSID.
  892. * @addr_list: Place holder for array of MAC addresses.
  893. * IMPORTANT: add padding if necessary to ensure DWORD alignment.
  894. */
  895. struct iwl_mcast_filter_cmd {
  896. u8 filter_own;
  897. u8 port_id;
  898. u8 count;
  899. u8 pass_all;
  900. u8 bssid[6];
  901. u8 reserved[2];
  902. u8 addr_list[0];
  903. } __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */
  904. struct mvm_statistics_dbg {
  905. __le32 burst_check;
  906. __le32 burst_count;
  907. __le32 wait_for_silence_timeout_cnt;
  908. __le32 reserved[3];
  909. } __packed; /* STATISTICS_DEBUG_API_S_VER_2 */
  910. struct mvm_statistics_div {
  911. __le32 tx_on_a;
  912. __le32 tx_on_b;
  913. __le32 exec_time;
  914. __le32 probe_time;
  915. __le32 rssi_ant;
  916. __le32 reserved2;
  917. } __packed; /* STATISTICS_SLOW_DIV_API_S_VER_2 */
  918. struct mvm_statistics_general_common {
  919. __le32 temperature; /* radio temperature */
  920. __le32 temperature_m; /* radio voltage */
  921. struct mvm_statistics_dbg dbg;
  922. __le32 sleep_time;
  923. __le32 slots_out;
  924. __le32 slots_idle;
  925. __le32 ttl_timestamp;
  926. struct mvm_statistics_div div;
  927. __le32 rx_enable_counter;
  928. /*
  929. * num_of_sos_states:
  930. * count the number of times we have to re-tune
  931. * in order to get out of bad PHY status
  932. */
  933. __le32 num_of_sos_states;
  934. } __packed; /* STATISTICS_GENERAL_API_S_VER_5 */
  935. struct mvm_statistics_rx_non_phy {
  936. __le32 bogus_cts; /* CTS received when not expecting CTS */
  937. __le32 bogus_ack; /* ACK received when not expecting ACK */
  938. __le32 non_bssid_frames; /* number of frames with BSSID that
  939. * doesn't belong to the STA BSSID */
  940. __le32 filtered_frames; /* count frames that were dumped in the
  941. * filtering process */
  942. __le32 non_channel_beacons; /* beacons with our bss id but not on
  943. * our serving channel */
  944. __le32 channel_beacons; /* beacons with our bss id and in our
  945. * serving channel */
  946. __le32 num_missed_bcon; /* number of missed beacons */
  947. __le32 adc_rx_saturation_time; /* count in 0.8us units the time the
  948. * ADC was in saturation */
  949. __le32 ina_detection_search_time;/* total time (in 0.8us) searched
  950. * for INA */
  951. __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */
  952. __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */
  953. __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */
  954. __le32 interference_data_flag; /* flag for interference data
  955. * availability. 1 when data is
  956. * available. */
  957. __le32 channel_load; /* counts RX Enable time in uSec */
  958. __le32 dsp_false_alarms; /* DSP false alarm (both OFDM
  959. * and CCK) counter */
  960. __le32 beacon_rssi_a;
  961. __le32 beacon_rssi_b;
  962. __le32 beacon_rssi_c;
  963. __le32 beacon_energy_a;
  964. __le32 beacon_energy_b;
  965. __le32 beacon_energy_c;
  966. __le32 num_bt_kills;
  967. __le32 mac_id;
  968. __le32 directed_data_mpdu;
  969. } __packed; /* STATISTICS_RX_NON_PHY_API_S_VER_3 */
  970. struct mvm_statistics_rx_phy {
  971. __le32 ina_cnt;
  972. __le32 fina_cnt;
  973. __le32 plcp_err;
  974. __le32 crc32_err;
  975. __le32 overrun_err;
  976. __le32 early_overrun_err;
  977. __le32 crc32_good;
  978. __le32 false_alarm_cnt;
  979. __le32 fina_sync_err_cnt;
  980. __le32 sfd_timeout;
  981. __le32 fina_timeout;
  982. __le32 unresponded_rts;
  983. __le32 rxe_frame_limit_overrun;
  984. __le32 sent_ack_cnt;
  985. __le32 sent_cts_cnt;
  986. __le32 sent_ba_rsp_cnt;
  987. __le32 dsp_self_kill;
  988. __le32 mh_format_err;
  989. __le32 re_acq_main_rssi_sum;
  990. __le32 reserved;
  991. } __packed; /* STATISTICS_RX_PHY_API_S_VER_2 */
  992. struct mvm_statistics_rx_ht_phy {
  993. __le32 plcp_err;
  994. __le32 overrun_err;
  995. __le32 early_overrun_err;
  996. __le32 crc32_good;
  997. __le32 crc32_err;
  998. __le32 mh_format_err;
  999. __le32 agg_crc32_good;
  1000. __le32 agg_mpdu_cnt;
  1001. __le32 agg_cnt;
  1002. __le32 unsupport_mcs;
  1003. } __packed; /* STATISTICS_HT_RX_PHY_API_S_VER_1 */
  1004. #define MAX_CHAINS 3
  1005. struct mvm_statistics_tx_non_phy_agg {
  1006. __le32 ba_timeout;
  1007. __le32 ba_reschedule_frames;
  1008. __le32 scd_query_agg_frame_cnt;
  1009. __le32 scd_query_no_agg;
  1010. __le32 scd_query_agg;
  1011. __le32 scd_query_mismatch;
  1012. __le32 frame_not_ready;
  1013. __le32 underrun;
  1014. __le32 bt_prio_kill;
  1015. __le32 rx_ba_rsp_cnt;
  1016. __s8 txpower[MAX_CHAINS];
  1017. __s8 reserved;
  1018. __le32 reserved2;
  1019. } __packed; /* STATISTICS_TX_NON_PHY_AGG_API_S_VER_1 */
  1020. struct mvm_statistics_tx_channel_width {
  1021. __le32 ext_cca_narrow_ch20[1];
  1022. __le32 ext_cca_narrow_ch40[2];
  1023. __le32 ext_cca_narrow_ch80[3];
  1024. __le32 ext_cca_narrow_ch160[4];
  1025. __le32 last_tx_ch_width_indx;
  1026. __le32 rx_detected_per_ch_width[4];
  1027. __le32 success_per_ch_width[4];
  1028. __le32 fail_per_ch_width[4];
  1029. }; /* STATISTICS_TX_CHANNEL_WIDTH_API_S_VER_1 */
  1030. struct mvm_statistics_tx {
  1031. __le32 preamble_cnt;
  1032. __le32 rx_detected_cnt;
  1033. __le32 bt_prio_defer_cnt;
  1034. __le32 bt_prio_kill_cnt;
  1035. __le32 few_bytes_cnt;
  1036. __le32 cts_timeout;
  1037. __le32 ack_timeout;
  1038. __le32 expected_ack_cnt;
  1039. __le32 actual_ack_cnt;
  1040. __le32 dump_msdu_cnt;
  1041. __le32 burst_abort_next_frame_mismatch_cnt;
  1042. __le32 burst_abort_missing_next_frame_cnt;
  1043. __le32 cts_timeout_collision;
  1044. __le32 ack_or_ba_timeout_collision;
  1045. struct mvm_statistics_tx_non_phy_agg agg;
  1046. struct mvm_statistics_tx_channel_width channel_width;
  1047. } __packed; /* STATISTICS_TX_API_S_VER_4 */
  1048. struct mvm_statistics_bt_activity {
  1049. __le32 hi_priority_tx_req_cnt;
  1050. __le32 hi_priority_tx_denied_cnt;
  1051. __le32 lo_priority_tx_req_cnt;
  1052. __le32 lo_priority_tx_denied_cnt;
  1053. __le32 hi_priority_rx_req_cnt;
  1054. __le32 hi_priority_rx_denied_cnt;
  1055. __le32 lo_priority_rx_req_cnt;
  1056. __le32 lo_priority_rx_denied_cnt;
  1057. } __packed; /* STATISTICS_BT_ACTIVITY_API_S_VER_1 */
  1058. struct mvm_statistics_general {
  1059. struct mvm_statistics_general_common common;
  1060. __le32 beacon_filtered;
  1061. __le32 missed_beacons;
  1062. __s8 beacon_filter_everage_energy;
  1063. __s8 beacon_filter_reason;
  1064. __s8 beacon_filter_current_energy;
  1065. __s8 beacon_filter_reserved;
  1066. __le32 beacon_filter_delta_time;
  1067. struct mvm_statistics_bt_activity bt_activity;
  1068. } __packed; /* STATISTICS_GENERAL_API_S_VER_5 */
  1069. struct mvm_statistics_rx {
  1070. struct mvm_statistics_rx_phy ofdm;
  1071. struct mvm_statistics_rx_phy cck;
  1072. struct mvm_statistics_rx_non_phy general;
  1073. struct mvm_statistics_rx_ht_phy ofdm_ht;
  1074. } __packed; /* STATISTICS_RX_API_S_VER_3 */
  1075. /*
  1076. * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
  1077. *
  1078. * By default, uCode issues this notification after receiving a beacon
  1079. * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
  1080. * REPLY_STATISTICS_CMD 0x9c, above.
  1081. *
  1082. * Statistics counters continue to increment beacon after beacon, but are
  1083. * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
  1084. * 0x9c with CLEAR_STATS bit set (see above).
  1085. *
  1086. * uCode also issues this notification during scans. uCode clears statistics
  1087. * appropriately so that each notification contains statistics for only the
  1088. * one channel that has just been scanned.
  1089. */
  1090. struct iwl_notif_statistics { /* STATISTICS_NTFY_API_S_VER_8 */
  1091. __le32 flag;
  1092. struct mvm_statistics_rx rx;
  1093. struct mvm_statistics_tx tx;
  1094. struct mvm_statistics_general general;
  1095. } __packed;
  1096. #endif /* __fw_api_h__ */