iwl-config.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  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) 2007 - 2014 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) 2005 - 2014 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 __IWL_CONFIG_H__
  64. #define __IWL_CONFIG_H__
  65. #include <linux/types.h>
  66. #include <net/mac80211.h>
  67. enum iwl_device_family {
  68. IWL_DEVICE_FAMILY_UNDEFINED,
  69. IWL_DEVICE_FAMILY_1000,
  70. IWL_DEVICE_FAMILY_100,
  71. IWL_DEVICE_FAMILY_2000,
  72. IWL_DEVICE_FAMILY_2030,
  73. IWL_DEVICE_FAMILY_105,
  74. IWL_DEVICE_FAMILY_135,
  75. IWL_DEVICE_FAMILY_5000,
  76. IWL_DEVICE_FAMILY_5150,
  77. IWL_DEVICE_FAMILY_6000,
  78. IWL_DEVICE_FAMILY_6000i,
  79. IWL_DEVICE_FAMILY_6005,
  80. IWL_DEVICE_FAMILY_6030,
  81. IWL_DEVICE_FAMILY_6050,
  82. IWL_DEVICE_FAMILY_6150,
  83. IWL_DEVICE_FAMILY_7000,
  84. IWL_DEVICE_FAMILY_8000,
  85. };
  86. static inline bool iwl_has_secure_boot(u32 hw_rev,
  87. enum iwl_device_family family)
  88. {
  89. /* return 1 only for family 8000 B0 */
  90. if ((family == IWL_DEVICE_FAMILY_8000) && (hw_rev & 0xC))
  91. return true;
  92. return false;
  93. }
  94. /*
  95. * LED mode
  96. * IWL_LED_DEFAULT: use device default
  97. * IWL_LED_RF_STATE: turn LED on/off based on RF state
  98. * LED ON = RF ON
  99. * LED OFF = RF OFF
  100. * IWL_LED_BLINK: adjust led blink rate based on blink table
  101. * IWL_LED_DISABLE: led disabled
  102. */
  103. enum iwl_led_mode {
  104. IWL_LED_DEFAULT,
  105. IWL_LED_RF_STATE,
  106. IWL_LED_BLINK,
  107. IWL_LED_DISABLE,
  108. };
  109. /*
  110. * This is the threshold value of plcp error rate per 100mSecs. It is
  111. * used to set and check for the validity of plcp_delta.
  112. */
  113. #define IWL_MAX_PLCP_ERR_THRESHOLD_MIN 1
  114. #define IWL_MAX_PLCP_ERR_THRESHOLD_DEF 50
  115. #define IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF 100
  116. #define IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF 200
  117. #define IWL_MAX_PLCP_ERR_THRESHOLD_MAX 255
  118. #define IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE 0
  119. /* TX queue watchdog timeouts in mSecs */
  120. #define IWL_WATCHDOG_DISABLED 0
  121. #define IWL_DEF_WD_TIMEOUT 2500
  122. #define IWL_LONG_WD_TIMEOUT 10000
  123. #define IWL_MAX_WD_TIMEOUT 120000
  124. #define IWL_DEFAULT_MAX_TX_POWER 22
  125. /* Antenna presence definitions */
  126. #define ANT_NONE 0x0
  127. #define ANT_A BIT(0)
  128. #define ANT_B BIT(1)
  129. #define ANT_C BIT(2)
  130. #define ANT_AB (ANT_A | ANT_B)
  131. #define ANT_AC (ANT_A | ANT_C)
  132. #define ANT_BC (ANT_B | ANT_C)
  133. #define ANT_ABC (ANT_A | ANT_B | ANT_C)
  134. static inline u8 num_of_ant(u8 mask)
  135. {
  136. return !!((mask) & ANT_A) +
  137. !!((mask) & ANT_B) +
  138. !!((mask) & ANT_C);
  139. }
  140. /*
  141. * @max_ll_items: max number of OTP blocks
  142. * @shadow_ram_support: shadow support for OTP memory
  143. * @led_compensation: compensate on the led on/off time per HW according
  144. * to the deviation to achieve the desired led frequency.
  145. * The detail algorithm is described in iwl-led.c
  146. * @wd_timeout: TX queues watchdog timeout
  147. * @max_event_log_size: size of event log buffer size for ucode event logging
  148. * @shadow_reg_enable: HW shadow register support
  149. * @apmg_wake_up_wa: should the MAC access REQ be asserted when a command
  150. * is in flight. This is due to a HW bug in 7260, 3160 and 7265.
  151. * @scd_chain_ext_wa: should the chain extension feature in SCD be disabled.
  152. */
  153. struct iwl_base_params {
  154. int eeprom_size;
  155. int num_of_queues; /* def: HW dependent */
  156. /* for iwl_pcie_apm_init() */
  157. u32 pll_cfg_val;
  158. const u16 max_ll_items;
  159. const bool shadow_ram_support;
  160. u16 led_compensation;
  161. unsigned int wd_timeout;
  162. u32 max_event_log_size;
  163. const bool shadow_reg_enable;
  164. const bool pcie_l1_allowed;
  165. const bool apmg_wake_up_wa;
  166. const bool scd_chain_ext_wa;
  167. };
  168. /*
  169. * @stbc: support Tx STBC and 1*SS Rx STBC
  170. * @ldpc: support Tx/Rx with LDPC
  171. * @use_rts_for_aggregation: use rts/cts protection for HT traffic
  172. * @ht40_bands: bitmap of bands (using %IEEE80211_BAND_*) that support HT40
  173. */
  174. struct iwl_ht_params {
  175. enum ieee80211_smps_mode smps_mode;
  176. const bool ht_greenfield_support; /* if used set to true */
  177. const bool stbc;
  178. const bool ldpc;
  179. bool use_rts_for_aggregation;
  180. u8 ht40_bands;
  181. };
  182. /*
  183. * Tx-backoff threshold
  184. * @temperature: The threshold in Celsius
  185. * @backoff: The tx-backoff in uSec
  186. */
  187. struct iwl_tt_tx_backoff {
  188. s32 temperature;
  189. u32 backoff;
  190. };
  191. #define TT_TX_BACKOFF_SIZE 6
  192. /**
  193. * struct iwl_tt_params - thermal throttling parameters
  194. * @ct_kill_entry: CT Kill entry threshold
  195. * @ct_kill_exit: CT Kill exit threshold
  196. * @ct_kill_duration: The time intervals (in uSec) in which the driver needs
  197. * to checks whether to exit CT Kill.
  198. * @dynamic_smps_entry: Dynamic SMPS entry threshold
  199. * @dynamic_smps_exit: Dynamic SMPS exit threshold
  200. * @tx_protection_entry: TX protection entry threshold
  201. * @tx_protection_exit: TX protection exit threshold
  202. * @tx_backoff: Array of thresholds for tx-backoff , in ascending order.
  203. * @support_ct_kill: Support CT Kill?
  204. * @support_dynamic_smps: Support dynamic SMPS?
  205. * @support_tx_protection: Support tx protection?
  206. * @support_tx_backoff: Support tx-backoff?
  207. */
  208. struct iwl_tt_params {
  209. u32 ct_kill_entry;
  210. u32 ct_kill_exit;
  211. u32 ct_kill_duration;
  212. u32 dynamic_smps_entry;
  213. u32 dynamic_smps_exit;
  214. u32 tx_protection_entry;
  215. u32 tx_protection_exit;
  216. struct iwl_tt_tx_backoff tx_backoff[TT_TX_BACKOFF_SIZE];
  217. bool support_ct_kill;
  218. bool support_dynamic_smps;
  219. bool support_tx_protection;
  220. bool support_tx_backoff;
  221. };
  222. /*
  223. * information on how to parse the EEPROM
  224. */
  225. #define EEPROM_REG_BAND_1_CHANNELS 0x08
  226. #define EEPROM_REG_BAND_2_CHANNELS 0x26
  227. #define EEPROM_REG_BAND_3_CHANNELS 0x42
  228. #define EEPROM_REG_BAND_4_CHANNELS 0x5C
  229. #define EEPROM_REG_BAND_5_CHANNELS 0x74
  230. #define EEPROM_REG_BAND_24_HT40_CHANNELS 0x82
  231. #define EEPROM_REG_BAND_52_HT40_CHANNELS 0x92
  232. #define EEPROM_6000_REG_BAND_24_HT40_CHANNELS 0x80
  233. #define EEPROM_REGULATORY_BAND_NO_HT40 0
  234. /* lower blocks contain EEPROM image and calibration data */
  235. #define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */
  236. #define OTP_LOW_IMAGE_SIZE_FAMILY_7000 (16 * 512 * sizeof(u16)) /* 16 KB */
  237. #define OTP_LOW_IMAGE_SIZE_FAMILY_8000 (32 * 512 * sizeof(u16)) /* 32 KB */
  238. struct iwl_eeprom_params {
  239. const u8 regulatory_bands[7];
  240. bool enhanced_txpower;
  241. };
  242. /* Tx-backoff power threshold
  243. * @pwr: The power limit in mw
  244. * @backoff: The tx-backoff in uSec
  245. */
  246. struct iwl_pwr_tx_backoff {
  247. u32 pwr;
  248. u32 backoff;
  249. };
  250. /**
  251. * struct iwl_cfg
  252. * @name: Official name of the device
  253. * @fw_name_pre: Firmware filename prefix. The api version and extension
  254. * (.ucode) will be added to filename before loading from disk. The
  255. * filename is constructed as fw_name_pre<api>.ucode.
  256. * @ucode_api_max: Highest version of uCode API supported by driver.
  257. * @ucode_api_ok: oldest version of the uCode API that is OK to load
  258. * without a warning, for use in transitions
  259. * @ucode_api_min: Lowest version of uCode API supported by driver.
  260. * @max_inst_size: The maximal length of the fw inst section
  261. * @max_data_size: The maximal length of the fw data section
  262. * @valid_tx_ant: valid transmit antenna
  263. * @valid_rx_ant: valid receive antenna
  264. * @non_shared_ant: the antenna that is for WiFi only
  265. * @nvm_ver: NVM version
  266. * @nvm_calib_ver: NVM calibration version
  267. * @lib: pointer to the lib ops
  268. * @base_params: pointer to basic parameters
  269. * @ht_params: point to ht parameters
  270. * @led_mode: 0=blinking, 1=On(RF On)/Off(RF Off)
  271. * @rx_with_siso_diversity: 1x1 device with rx antenna diversity
  272. * @internal_wimax_coex: internal wifi/wimax combo device
  273. * @high_temp: Is this NIC is designated to be in high temperature.
  274. * @host_interrupt_operation_mode: device needs host interrupt operation
  275. * mode set
  276. * @d0i3: device uses d0i3 instead of d3
  277. * @nvm_hw_section_num: the ID of the HW NVM section
  278. * @features: hw features, any combination of feature_whitelist
  279. * @pwr_tx_backoffs: translation table between power limits and backoffs
  280. * @max_rx_agg_size: max RX aggregation size of the ADDBA request/response
  281. * @max_tx_agg_size: max TX aggregation size of the ADDBA request/response
  282. * @max_ht_ampdu_factor: the exponent of the max length of A-MPDU that the
  283. * station can receive in HT
  284. * @max_vht_ampdu_exponent: the exponent of the max length of A-MPDU that the
  285. * station can receive in VHT
  286. * @dccm_offset: offset from which DCCM begins
  287. * @dccm_len: length of DCCM (including runtime stack CCM)
  288. * @dccm2_offset: offset from which the second DCCM begins
  289. * @dccm2_len: length of the second DCCM
  290. * @smem_offset: offset from which the SMEM begins
  291. * @smem_len: the length of SMEM
  292. *
  293. * We enable the driver to be backward compatible wrt. hardware features.
  294. * API differences in uCode shouldn't be handled here but through TLVs
  295. * and/or the uCode API version instead.
  296. */
  297. struct iwl_cfg {
  298. /* params specific to an individual device within a device family */
  299. const char *name;
  300. const char *fw_name_pre;
  301. const unsigned int ucode_api_max;
  302. const unsigned int ucode_api_ok;
  303. const unsigned int ucode_api_min;
  304. const enum iwl_device_family device_family;
  305. const u32 max_data_size;
  306. const u32 max_inst_size;
  307. u8 valid_tx_ant;
  308. u8 valid_rx_ant;
  309. u8 non_shared_ant;
  310. bool bt_shared_single_ant;
  311. u16 nvm_ver;
  312. u16 nvm_calib_ver;
  313. /* params not likely to change within a device family */
  314. const struct iwl_base_params *base_params;
  315. /* params likely to change within a device family */
  316. const struct iwl_ht_params *ht_params;
  317. const struct iwl_eeprom_params *eeprom_params;
  318. enum iwl_led_mode led_mode;
  319. const bool rx_with_siso_diversity;
  320. const bool internal_wimax_coex;
  321. const bool host_interrupt_operation_mode;
  322. bool high_temp;
  323. bool d0i3;
  324. u8 nvm_hw_section_num;
  325. bool lp_xtal_workaround;
  326. const struct iwl_pwr_tx_backoff *pwr_tx_backoffs;
  327. bool no_power_up_nic_in_init;
  328. const char *default_nvm_file_B_step;
  329. const char *default_nvm_file_C_step;
  330. netdev_features_t features;
  331. unsigned int max_rx_agg_size;
  332. bool disable_dummy_notification;
  333. unsigned int max_tx_agg_size;
  334. unsigned int max_ht_ampdu_exponent;
  335. unsigned int max_vht_ampdu_exponent;
  336. const u32 dccm_offset;
  337. const u32 dccm_len;
  338. const u32 dccm2_offset;
  339. const u32 dccm2_len;
  340. const u32 smem_offset;
  341. const u32 smem_len;
  342. const struct iwl_tt_params *thermal_params;
  343. bool apmg_not_supported;
  344. };
  345. /*
  346. * This list declares the config structures for all devices.
  347. */
  348. #if IS_ENABLED(CONFIG_IWLDVM)
  349. extern const struct iwl_cfg iwl5300_agn_cfg;
  350. extern const struct iwl_cfg iwl5100_agn_cfg;
  351. extern const struct iwl_cfg iwl5350_agn_cfg;
  352. extern const struct iwl_cfg iwl5100_bgn_cfg;
  353. extern const struct iwl_cfg iwl5100_abg_cfg;
  354. extern const struct iwl_cfg iwl5150_agn_cfg;
  355. extern const struct iwl_cfg iwl5150_abg_cfg;
  356. extern const struct iwl_cfg iwl6005_2agn_cfg;
  357. extern const struct iwl_cfg iwl6005_2abg_cfg;
  358. extern const struct iwl_cfg iwl6005_2bg_cfg;
  359. extern const struct iwl_cfg iwl6005_2agn_sff_cfg;
  360. extern const struct iwl_cfg iwl6005_2agn_d_cfg;
  361. extern const struct iwl_cfg iwl6005_2agn_mow1_cfg;
  362. extern const struct iwl_cfg iwl6005_2agn_mow2_cfg;
  363. extern const struct iwl_cfg iwl1030_bgn_cfg;
  364. extern const struct iwl_cfg iwl1030_bg_cfg;
  365. extern const struct iwl_cfg iwl6030_2agn_cfg;
  366. extern const struct iwl_cfg iwl6030_2abg_cfg;
  367. extern const struct iwl_cfg iwl6030_2bgn_cfg;
  368. extern const struct iwl_cfg iwl6030_2bg_cfg;
  369. extern const struct iwl_cfg iwl6000i_2agn_cfg;
  370. extern const struct iwl_cfg iwl6000i_2abg_cfg;
  371. extern const struct iwl_cfg iwl6000i_2bg_cfg;
  372. extern const struct iwl_cfg iwl6000_3agn_cfg;
  373. extern const struct iwl_cfg iwl6050_2agn_cfg;
  374. extern const struct iwl_cfg iwl6050_2abg_cfg;
  375. extern const struct iwl_cfg iwl6150_bgn_cfg;
  376. extern const struct iwl_cfg iwl6150_bg_cfg;
  377. extern const struct iwl_cfg iwl1000_bgn_cfg;
  378. extern const struct iwl_cfg iwl1000_bg_cfg;
  379. extern const struct iwl_cfg iwl100_bgn_cfg;
  380. extern const struct iwl_cfg iwl100_bg_cfg;
  381. extern const struct iwl_cfg iwl130_bgn_cfg;
  382. extern const struct iwl_cfg iwl130_bg_cfg;
  383. extern const struct iwl_cfg iwl2000_2bgn_cfg;
  384. extern const struct iwl_cfg iwl2000_2bgn_d_cfg;
  385. extern const struct iwl_cfg iwl2030_2bgn_cfg;
  386. extern const struct iwl_cfg iwl6035_2agn_cfg;
  387. extern const struct iwl_cfg iwl6035_2agn_sff_cfg;
  388. extern const struct iwl_cfg iwl105_bgn_cfg;
  389. extern const struct iwl_cfg iwl105_bgn_d_cfg;
  390. extern const struct iwl_cfg iwl135_bgn_cfg;
  391. #endif /* CONFIG_IWLDVM */
  392. #if IS_ENABLED(CONFIG_IWLMVM)
  393. extern const struct iwl_cfg iwl7260_2ac_cfg;
  394. extern const struct iwl_cfg iwl7260_2ac_cfg_high_temp;
  395. extern const struct iwl_cfg iwl7260_2n_cfg;
  396. extern const struct iwl_cfg iwl7260_n_cfg;
  397. extern const struct iwl_cfg iwl3160_2ac_cfg;
  398. extern const struct iwl_cfg iwl3160_2n_cfg;
  399. extern const struct iwl_cfg iwl3160_n_cfg;
  400. extern const struct iwl_cfg iwl3165_2ac_cfg;
  401. extern const struct iwl_cfg iwl7265_2ac_cfg;
  402. extern const struct iwl_cfg iwl7265_2n_cfg;
  403. extern const struct iwl_cfg iwl7265_n_cfg;
  404. extern const struct iwl_cfg iwl7265d_2ac_cfg;
  405. extern const struct iwl_cfg iwl7265d_2n_cfg;
  406. extern const struct iwl_cfg iwl7265d_n_cfg;
  407. extern const struct iwl_cfg iwl8260_2n_cfg;
  408. extern const struct iwl_cfg iwl8260_2ac_cfg;
  409. extern const struct iwl_cfg iwl4165_2ac_cfg;
  410. extern const struct iwl_cfg iwl8260_2ac_sdio_cfg;
  411. extern const struct iwl_cfg iwl4165_2ac_sdio_cfg;
  412. #endif /* CONFIG_IWLMVM */
  413. #endif /* __IWL_CONFIG_H__ */