Lines Matching +full:fw +full:- +full:cfg

1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2005-2014, 2018-2023 Intel Corporation
4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5 * Copyright (C) 2016-2017 Intel Deutschland GmbH
14 #include "iwl-drv.h"
15 #include "iwl-modparams.h"
16 #include "iwl-nvm-parse.h"
17 #include "iwl-prph.h"
18 #include "iwl-io.h"
19 #include "iwl-csr.h"
20 #include "fw/acpi.h"
21 #include "fw/api/nvm-reg.h"
22 #include "fw/api/commands.h"
23 #include "fw/api/cmdhdr.h"
24 #include "fw/img.h"
25 #include "mei/iwl-mei.h"
29 /* NVM HW-Section offset (in words) definitions */
33 /* NVM SW-Section offset (in words) definitions */
39 NVM_CHANNELS = 0x1E0 - NVM_SW_SECTION,
41 /* NVM REGULATORY -Section offset (in words) definitions */
46 /* NVM HW-Section offset (in words) definitions */
50 /* NVM SW-Section offset (in words) definitions */
54 /* NVM PHY_SKU-Section offset (in words) definitions */
58 /* NVM REGULATORY -Section offset (in words) definitions */
102 /* 6-7 GHz */
139 #define N_RATES_52 (N_RATES_24 - RATES_52_OFFS)
142 * enum iwl_nvm_channel_flags - channel flags in NVM
177 * enum iwl_reg_capa_flags_v1 - global flags applied for the whole regulatory
179 * @REG_CAPA_V1_BF_CCD_LOW_BAND: Beam-forming or Cyclic Delay Diversity in the
181 * @REG_CAPA_V1_BF_CCD_HIGH_BAND: Beam-forming or Cyclic Delay Diversity in the
207 * enum iwl_reg_capa_flags_v2 - global flags applied for the whole regulatory
211 * @REG_CAPA_V2_BF_CCD_LOW_BAND: Beam-forming or Cyclic Delay Diversity in the
213 * @REG_CAPA_V2_BF_CCD_HIGH_BAND: Beam-forming or Cyclic Delay Diversity in the
241 * enum iwl_reg_capa_flags_v4 - global flags applied for the whole regulatory
276 * struct iwl_reg_capa - struct for global regulatory capabilities, Used for
333 u32 nvm_flags, const struct iwl_cfg *cfg)
343 if ((ch_idx - NUM_2GHZ_CHANNELS) % 2 == 0)
395 const struct iwl_fw *fw,
400 const struct iwl_cfg *cfg = trans->cfg;
401 struct device *dev = trans->dev;
409 if (cfg->uhb_supported) {
412 } else if (cfg->nvm_type == IWL_NVM_EXT) {
432 !data->sku_cap_band_52ghz_enable)
444 data->vht160_supported = true;
458 channel = &data->channels[n_channels];
461 channel->hw_value = nvm_chan[ch_idx];
462 channel->band = band;
463 channel->center_freq =
465 channel->hw_value, channel->band);
467 /* Initialize regulatory-based run-time data */
470 * Default value - highest tx power value. max_power
473 channel->max_power = IWL_DEFAULT_MAX_TX_POWER;
477 channel->flags = iwl_get_channel_flags(nvm_chan[ch_idx],
479 ch_flags, cfg);
481 channel->flags = 0;
483 if (fw_has_capa(&fw->ucode_capa,
485 channel->flags |= IEEE80211_CHAN_CAN_MONITOR;
488 channel->hw_value, ch_flags);
490 channel->hw_value, channel->max_power);
501 const struct iwl_cfg *cfg = trans->cfg;
505 vht_cap->vht_supported = true;
507 vht_cap->cap = IEEE80211_VHT_CAP_SHORT_GI_80 |
514 if (!trans->cfg->ht_params->stbc)
515 vht_cap->cap &= ~IEEE80211_VHT_CAP_RXSTBC_MASK;
517 if (data->vht160_supported)
518 vht_cap->cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ |
521 if (cfg->vht_mu_mimo_supported)
522 vht_cap->cap |= IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE;
524 if (cfg->ht_params->ldpc)
525 vht_cap->cap |= IEEE80211_VHT_CAP_RXLDPC;
527 if (data->sku_cap_mimo_disabled) {
532 if (trans->cfg->ht_params->stbc && num_tx_ants > 1)
533 vht_cap->cap |= IEEE80211_VHT_CAP_TXSTBC;
535 vht_cap->cap |= IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN;
539 if (trans->trans_cfg->mq_rx_supported)
540 vht_cap->cap |=
543 vht_cap->cap |= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895;
546 if (trans->trans_cfg->mq_rx_supported)
547 vht_cap->cap |=
553 vht_cap->cap |= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895;
556 vht_cap->cap |= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991;
559 vht_cap->cap |= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454;
565 vht_cap->vht_mcs.rx_mcs_map =
575 if (num_rx_ants == 1 || cfg->rx_with_siso_diversity) {
576 vht_cap->cap |= IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN;
578 vht_cap->vht_mcs.rx_mcs_map |=
582 vht_cap->vht_mcs.tx_mcs_map = vht_cap->vht_mcs.rx_mcs_map;
584 vht_cap->vht_mcs.tx_highest |=
726 * Rx - note we don't set the only_20mhz, but due to this
825 * Rx - note we don't set the only_20mhz, but due to this
870 if (sband->band != NL80211_BAND_6GHZ)
896 IWL_DEBUG_EEPROM(trans->dev, "he_6ghz_capa=0x%x\n", he_6ghz_capa);
898 /* we know it's writable - we set it before ourselves */
899 iftype_data = (void *)(uintptr_t)sband->iftype_data;
900 for (i = 0; i < sband->n_iftype_data; i++)
910 const struct iwl_fw *fw)
912 bool is_ap = iftype_data->types_mask & (BIT(NL80211_IFTYPE_AP) |
916 no_320 = (!trans->trans_cfg->integrated &&
917 trans->pcie_link_speed < PCI_EXP_LNKSTA_CLS_8_0GB) ||
918 trans->reduced_cap_sku;
920 if (!data->sku_cap_11be_enable || iwlwifi_mod_params.disable_11be)
921 iftype_data->eht_cap.has_eht = false;
923 /* Advertise an A-MPDU exponent extension based on
926 if (sband->band == NL80211_BAND_6GHZ && iftype_data->eht_cap.has_eht)
927 iftype_data->he_cap.he_cap_elem.mac_cap_info[3] |=
929 else if (sband->band != NL80211_BAND_2GHZ)
930 iftype_data->he_cap.he_cap_elem.mac_cap_info[3] |=
933 iftype_data->he_cap.he_cap_elem.mac_cap_info[3] |=
936 switch (sband->band) {
938 iftype_data->he_cap.he_cap_elem.phy_cap_info[0] |=
940 iftype_data->eht_cap.eht_cap_elem.mac_cap_info[0] |=
946 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[0] |=
948 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[1] |=
953 iftype_data->he_cap.he_cap_elem.phy_cap_info[0] |=
963 iftype_data->he_cap.he_cap_elem.phy_cap_info[2] |=
965 iftype_data->he_cap.he_cap_elem.phy_cap_info[5] |=
969 iftype_data->he_cap.he_cap_elem.phy_cap_info[7] |=
972 if (iftype_data->eht_cap.has_eht) {
978 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[2] |= 0x49;
984 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[4] |= 0x10;
989 &iftype_data->he_cap.he_mcs_nss_supp;
991 if (iftype_data->eht_cap.has_eht) {
993 &iftype_data->eht_cap.eht_mcs_nss_supp;
1000 * Midamble RX Max NSTS - but not for AP mode
1002 iftype_data->he_cap.he_cap_elem.phy_cap_info[1] &=
1004 iftype_data->he_cap.he_cap_elem.phy_cap_info[2] &=
1006 iftype_data->he_cap.he_cap_elem.phy_cap_info[7] |=
1010 he_mcs_nss_supp->rx_mcs_80 |=
1012 he_mcs_nss_supp->tx_mcs_80 |=
1014 he_mcs_nss_supp->rx_mcs_160 |=
1016 he_mcs_nss_supp->tx_mcs_160 |=
1018 he_mcs_nss_supp->rx_mcs_80p80 |=
1020 he_mcs_nss_supp->tx_mcs_80p80 |=
1024 if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210 && !is_ap)
1025 iftype_data->he_cap.he_cap_elem.phy_cap_info[2] |=
1028 switch (CSR_HW_RFID_TYPE(trans->hw_rf_id)) {
1032 iftype_data->he_cap.he_cap_elem.phy_cap_info[9] |=
1035 iftype_data->he_cap.he_cap_elem.phy_cap_info[9] |=
1040 if (CSR_HW_REV_TYPE(trans->hw_rev) == IWL_CFG_MAC_TYPE_GL &&
1041 iftype_data->eht_cap.has_eht) {
1042 iftype_data->eht_cap.eht_cap_elem.mac_cap_info[0] &=
1045 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[3] &=
1053 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[4] &=
1056 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[5] &=
1058 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[6] &=
1061 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[5] |=
1065 if (fw_has_capa(&fw->ucode_capa, IWL_UCODE_TLV_CAPA_BROADCAST_TWT))
1066 iftype_data->he_cap.he_cap_elem.mac_cap_info[2] |=
1069 if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000 &&
1071 iftype_data->vendor_elems.data = iwl_vendor_caps;
1072 iftype_data->vendor_elems.len = ARRAY_SIZE(iwl_vendor_caps);
1075 if (!trans->cfg->ht_params->stbc) {
1076 iftype_data->he_cap.he_cap_elem.phy_cap_info[2] &=
1078 iftype_data->he_cap.he_cap_elem.phy_cap_info[7] &=
1082 if (trans->step_urm) {
1083 iftype_data->eht_cap.eht_mcs_nss_supp.bw._320.rx_tx_mcs11_max_nss = 0;
1084 iftype_data->eht_cap.eht_mcs_nss_supp.bw._320.rx_tx_mcs13_max_nss = 0;
1087 if (trans->no_160)
1088 iftype_data->he_cap.he_cap_elem.phy_cap_info[0] &=
1091 if (trans->reduced_cap_sku) {
1092 memset(&iftype_data->eht_cap.eht_mcs_nss_supp.bw._320, 0,
1093 sizeof(iftype_data->eht_cap.eht_mcs_nss_supp.bw._320));
1094 iftype_data->eht_cap.eht_mcs_nss_supp.bw._80.rx_tx_mcs13_max_nss = 0;
1095 iftype_data->eht_cap.eht_mcs_nss_supp.bw._160.rx_tx_mcs13_max_nss = 0;
1096 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[8] &=
1098 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[2] &=
1107 const struct iwl_fw *fw)
1112 BUILD_BUG_ON(sizeof(data->iftd.low) != sizeof(iwl_he_eht_capa));
1113 BUILD_BUG_ON(sizeof(data->iftd.high) != sizeof(iwl_he_eht_capa));
1114 BUILD_BUG_ON(sizeof(data->iftd.uhb) != sizeof(iwl_he_eht_capa));
1116 switch (sband->band) {
1118 iftype_data = data->iftd.low;
1121 iftype_data = data->iftd.high;
1124 iftype_data = data->iftd.uhb;
1136 for (i = 0; i < sband->n_iftype_data; i++)
1138 tx_chains, rx_chains, fw);
1144 u8 tx_chains, u8 rx_chains, const struct iwl_fw *fw)
1148 sband = &data->bands[NL80211_BAND_2GHZ];
1149 iwl_init_ht_hw_capab(trans, data, &sband->ht_cap, NL80211_BAND_2GHZ,
1152 if (data->sku_cap_11ax_enable && !iwlwifi_mod_params.disable_11ax)
1154 fw);
1156 sband = &data->bands[NL80211_BAND_5GHZ];
1157 iwl_init_ht_hw_capab(trans, data, &sband->ht_cap, NL80211_BAND_5GHZ,
1159 if (data->sku_cap_11ac_enable && !iwlwifi_mod_params.disable_11ac)
1160 iwl_init_vht_hw_capab(trans, data, &sband->vht_cap,
1163 if (data->sku_cap_11ax_enable && !iwlwifi_mod_params.disable_11ax)
1165 fw);
1167 sband = &data->bands[NL80211_BAND_6GHZ];
1168 if (data->sku_cap_11ax_enable && !iwlwifi_mod_params.disable_11ax)
1170 fw);
1178 const struct iwl_fw *fw)
1180 struct device *dev = trans->dev;
1185 n_channels = iwl_init_channel_map(trans, fw, data, nvm_ch_flags,
1187 sband = &data->bands[NL80211_BAND_2GHZ];
1188 sband->band = NL80211_BAND_2GHZ;
1189 sband->bitrates = &iwl_cfg80211_rates[RATES_24_OFFS];
1190 sband->n_bitrates = N_RATES_24;
1193 iwl_init_ht_hw_capab(trans, data, &sband->ht_cap, NL80211_BAND_2GHZ,
1196 if (data->sku_cap_11ax_enable && !iwlwifi_mod_params.disable_11ax)
1198 fw);
1200 sband = &data->bands[NL80211_BAND_5GHZ];
1201 sband->band = NL80211_BAND_5GHZ;
1202 sband->bitrates = &iwl_cfg80211_rates[RATES_52_OFFS];
1203 sband->n_bitrates = N_RATES_52;
1206 iwl_init_ht_hw_capab(trans, data, &sband->ht_cap, NL80211_BAND_5GHZ,
1208 if (data->sku_cap_11ac_enable && !iwlwifi_mod_params.disable_11ac)
1209 iwl_init_vht_hw_capab(trans, data, &sband->vht_cap,
1212 if (data->sku_cap_11ax_enable && !iwlwifi_mod_params.disable_11ax)
1214 fw);
1217 sband = &data->bands[NL80211_BAND_6GHZ];
1218 sband->band = NL80211_BAND_6GHZ;
1220 sband->bitrates = &iwl_cfg80211_rates[RATES_52_OFFS];
1221 sband->n_bitrates = N_RATES_52;
1225 if (data->sku_cap_11ax_enable && !iwlwifi_mod_params.disable_11ax)
1227 fw);
1229 sband->n_channels = 0;
1235 static int iwl_get_sku(const struct iwl_cfg *cfg, const __le16 *nvm_sw,
1238 if (cfg->nvm_type != IWL_NVM_EXT)
1244 static int iwl_get_nvm_version(const struct iwl_cfg *cfg, const __le16 *nvm_sw)
1246 if (cfg->nvm_type != IWL_NVM_EXT)
1253 static int iwl_get_radio_cfg(const struct iwl_cfg *cfg, const __le16 *nvm_sw,
1256 if (cfg->nvm_type != IWL_NVM_EXT)
1263 static int iwl_get_n_hw_addrs(const struct iwl_cfg *cfg, const __le16 *nvm_sw)
1267 if (cfg->nvm_type != IWL_NVM_EXT)
1275 static void iwl_set_radio_cfg(const struct iwl_cfg *cfg,
1279 if (cfg->nvm_type != IWL_NVM_EXT) {
1280 data->radio_cfg_type = NVM_RF_CFG_TYPE_MSK(radio_cfg);
1281 data->radio_cfg_step = NVM_RF_CFG_STEP_MSK(radio_cfg);
1282 data->radio_cfg_dash = NVM_RF_CFG_DASH_MSK(radio_cfg);
1283 data->radio_cfg_pnum = NVM_RF_CFG_PNUM_MSK(radio_cfg);
1288 data->radio_cfg_type = EXT_NVM_RF_CFG_TYPE_MSK(radio_cfg);
1289 data->radio_cfg_step = EXT_NVM_RF_CFG_STEP_MSK(radio_cfg);
1290 data->radio_cfg_dash = EXT_NVM_RF_CFG_DASH_MSK(radio_cfg);
1291 data->radio_cfg_pnum = EXT_NVM_RF_CFG_FLAVOR_MSK(radio_cfg);
1292 data->valid_tx_ant = EXT_NVM_RF_CFG_TX_ANT_MSK(radio_cfg);
1293 data->valid_rx_ant = EXT_NVM_RF_CFG_RX_ANT_MSK(radio_cfg);
1319 iwl_flip_hw_address(mac_addr0, mac_addr1, data->hw_addr);
1324 if (is_valid_ether_addr(data->hw_addr))
1330 iwl_flip_hw_address(mac_addr0, mac_addr1, data->hw_addr);
1334 const struct iwl_cfg *cfg,
1353 memcpy(data->hw_addr, hw_addr, ETH_ALEN);
1359 if (is_valid_ether_addr(data->hw_addr) &&
1374 iwl_flip_hw_address(mac_addr0, mac_addr1, data->hw_addr);
1383 const struct iwl_cfg *cfg,
1387 if (cfg->mac_addr_from_csr) {
1389 } else if (cfg->nvm_type != IWL_NVM_EXT) {
1393 data->hw_addr[0] = hw_addr[1];
1394 data->hw_addr[1] = hw_addr[0];
1395 data->hw_addr[2] = hw_addr[3];
1396 data->hw_addr[3] = hw_addr[2];
1397 data->hw_addr[4] = hw_addr[5];
1398 data->hw_addr[5] = hw_addr[4];
1400 iwl_set_hw_address_family_8000(trans, cfg, data,
1404 if (!is_valid_ether_addr(data->hw_addr)) {
1406 return -EINVAL;
1409 if (!trans->csme_own)
1412 data->hw_addr, iwl_read_prph(trans, REG_OTP_MINOR));
1415 data->hw_addr, ":", iwl_read_prph(trans, REG_OTP_MINOR));
1422 iwl_nvm_no_wide_in_5ghz(struct iwl_trans *trans, const struct iwl_cfg *cfg,
1427 * some 7000-family OTPs erroneously allow wide channels in
1429 * bits 1-4 in the subsystem ID and check if it is either 5 or
1430 * 9. In those cases, we need to force-disable wide channels
1431 * in 5GHz otherwise the FW will throw a sysassert when we try
1434 if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_7000) {
1437 * section uses big-endian.
1443 IWL_DEBUG_EEPROM(trans->dev,
1454 iwl_parse_mei_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
1456 const struct iwl_fw *fw, u8 tx_ant, u8 rx_ant)
1460 u8 rx_chains = fw->valid_rx_ant;
1461 u8 tx_chains = fw->valid_rx_ant;
1463 if (cfg->uhb_supported)
1474 BUILD_BUG_ON(ARRAY_SIZE(mei_nvm->channels) !=
1476 data->nvm_version = mei_nvm->nvm_version;
1478 iwl_set_radio_cfg(cfg, data, mei_nvm->radio_cfg);
1479 if (data->valid_tx_ant)
1480 tx_chains &= data->valid_tx_ant;
1481 if (data->valid_rx_ant)
1482 rx_chains &= data->valid_rx_ant;
1488 data->sku_cap_mimo_disabled = false;
1489 data->sku_cap_band_24ghz_enable = true;
1490 data->sku_cap_band_52ghz_enable = true;
1491 data->sku_cap_11n_enable =
1493 data->sku_cap_11ac_enable = true;
1494 data->sku_cap_11ax_enable =
1495 mei_nvm->caps & MEI_NVM_CAPS_11AX_SUPPORT;
1497 data->lar_enabled = mei_nvm->caps & MEI_NVM_CAPS_LARI_SUPPORT;
1499 data->n_hw_addrs = mei_nvm->n_hw_addrs;
1500 /* If no valid mac address was found - bail out */
1501 if (iwl_set_hw_address(trans, cfg, data, NULL, NULL)) {
1506 if (data->lar_enabled &&
1507 fw_has_capa(&fw->ucode_capa, IWL_UCODE_TLV_CAPA_LAR_SUPPORT))
1510 iwl_init_sbands(trans, data, mei_nvm->channels, tx_chains, rx_chains,
1511 sbands_flags, true, fw);
1518 iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
1519 const struct iwl_fw *fw,
1532 if (cfg->uhb_supported)
1536 else if (cfg->nvm_type != IWL_NVM_EXT)
1547 data->nvm_version = iwl_get_nvm_version(cfg, nvm_sw);
1549 radio_cfg = iwl_get_radio_cfg(cfg, nvm_sw, phy_sku);
1550 iwl_set_radio_cfg(cfg, data, radio_cfg);
1551 if (data->valid_tx_ant)
1552 tx_chains &= data->valid_tx_ant;
1553 if (data->valid_rx_ant)
1554 rx_chains &= data->valid_rx_ant;
1556 sku = iwl_get_sku(cfg, nvm_sw, phy_sku);
1557 data->sku_cap_band_24ghz_enable = sku & NVM_SKU_CAP_BAND_24GHZ;
1558 data->sku_cap_band_52ghz_enable = sku & NVM_SKU_CAP_BAND_52GHZ;
1559 data->sku_cap_11n_enable = sku & NVM_SKU_CAP_11N_ENABLE;
1561 data->sku_cap_11n_enable = false;
1562 data->sku_cap_11ac_enable = data->sku_cap_11n_enable &&
1564 data->sku_cap_mimo_disabled = sku & NVM_SKU_CAP_MIMO_DISABLE;
1566 data->n_hw_addrs = iwl_get_n_hw_addrs(cfg, nvm_sw);
1568 if (cfg->nvm_type != IWL_NVM_EXT) {
1577 ch_section = cfg->nvm_type == IWL_NVM_SDP ?
1583 u16 lar_offset = data->nvm_version < 0xE39 ?
1588 data->lar_enabled = !!(lar_config &
1590 lar_enabled = data->lar_enabled;
1594 /* If no valid mac address was found - bail out */
1595 if (iwl_set_hw_address(trans, cfg, data, nvm_hw, mac_override)) {
1601 fw_has_capa(&fw->ucode_capa, IWL_UCODE_TLV_CAPA_LAR_SUPPORT))
1604 if (iwl_nvm_no_wide_in_5ghz(trans, cfg, nvm_hw))
1608 sbands_flags, false, fw);
1609 data->calib_version = 255;
1618 const struct iwl_cfg *cfg)
1630 if ((ch_idx - NUM_2GHZ_CHANNELS) % 2 == 0)
1662 * however, once marked as DFS no-ir is not needed.
1729 iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
1745 if (cfg->uhb_supported) {
1748 } else if (cfg->nvm_type == IWL_NVM_EXT) {
1764 return ERR_PTR(-EINVAL);
1772 return ERR_PTR(-ENOMEM);
1774 /* set alpha2 from FW. */
1775 regd->alpha2[0] = fw_mcc >> 8;
1776 regd->alpha2[1] = fw_mcc & 0xff;
1798 cfg);
1802 center_freq - prev_center_freq > 20) {
1807 rule = &regd->reg_rules[valid_rules - 1];
1810 rule->freq_range.start_freq_khz =
1811 MHZ_TO_KHZ(center_freq - 10);
1813 rule->freq_range.end_freq_khz = MHZ_TO_KHZ(center_freq + 10);
1815 /* this doesn't matter - not used by FW */
1816 rule->power_rule.max_antenna_gain = DBI_TO_MBI(6);
1817 rule->power_rule.max_eirp =
1820 rule->flags = reg_rule_flags;
1822 /* rely on auto-calculation to merge BW of contiguous chans */
1823 rule->flags |= NL80211_RRF_AUTO_BW;
1824 rule->freq_range.max_bandwidth_khz = 0;
1836 reg_query_regdb_wmm(regd->alpha2, center_freq, rule);
1841 * if booted in RF-kill, i.e. not all calibrations etc. are
1849 rule = &regd->reg_rules[valid_rules - 1];
1850 rule->freq_range.start_freq_khz = MHZ_TO_KHZ(2412);
1851 rule->freq_range.end_freq_khz = MHZ_TO_KHZ(2413);
1852 rule->freq_range.max_bandwidth_khz = MHZ_TO_KHZ(1);
1853 rule->power_rule.max_antenna_gain = DBI_TO_MBI(6);
1854 rule->power_rule.max_eirp =
1858 regd->n_reg_rules = valid_rules;
1867 copy_rd = ERR_PTR(-ENOMEM);
1893 * Reads external NVM from a file into mvm->nvm_sections
1896 * ------------------------------
1898 * 3800 -> header
1899 * 0000 -> header
1900 * 5a40 -> data
1902 * rev - 6 bit (word1)
1903 * len - 10 bit (word1)
1904 * id - 4 bit (word2)
1905 * rsv - 12 bit (word2)
1938 IWL_DEBUG_EEPROM(trans->dev, "Read from external NVM\n");
1941 if (trans->cfg->nvm_type != IWL_NVM_EXT)
1952 ret = request_firmware(&fw_entry, nvm_file_name, trans->dev);
1960 nvm_file_name, fw_entry->size);
1962 if (fw_entry->size > MAX_NVM_FILE_LEN) {
1964 ret = -EINVAL;
1968 eof = fw_entry->data + fw_entry->size;
1969 dword_buff = (const __le32 *)fw_entry->data;
1976 * This header must be skipped when providing the NVM data to the FW.
1978 if (fw_entry->size > NVM_HEADER_SIZE &&
1981 file_sec = (const void *)(fw_entry->data + NVM_HEADER_SIZE);
1987 if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_8000 &&
1988 trans->hw_rev_step == SILICON_C_STEP &&
1990 ret = -EFAULT;
1994 file_sec = (const void *)fw_entry->data;
1998 if (file_sec->data > eof) {
2000 "ERROR - NVM file too short for section header\n");
2001 ret = -EINVAL;
2006 if (!file_sec->word1 && !file_sec->word2) {
2011 if (trans->cfg->nvm_type != IWL_NVM_EXT) {
2013 2 * NVM_WORD1_LEN(le16_to_cpu(file_sec->word1));
2014 section_id = NVM_WORD2_ID(le16_to_cpu(file_sec->word2));
2017 le16_to_cpu(file_sec->word2));
2019 le16_to_cpu(file_sec->word1));
2023 IWL_ERR(trans, "ERROR - section too large (%d)\n",
2025 ret = -EINVAL;
2030 IWL_ERR(trans, "ERROR - section empty\n");
2031 ret = -EINVAL;
2035 if (file_sec->data + section_size > eof) {
2037 "ERROR - NVM file too short for section (%d bytes)\n",
2039 ret = -EINVAL;
2045 ret = -EINVAL;
2049 temp = kmemdup(file_sec->data, section_size, GFP_KERNEL);
2051 ret = -ENOMEM;
2055 iwl_nvm_fixups(trans->hw_id, section_id, temp, section_size);
2062 file_sec = (const void *)(file_sec->data + section_size);
2071 const struct iwl_fw *fw,
2097 bool v4 = fw_has_api(&fw->ucode_capa,
2107 "Invalid payload len in NVM response from FW %d",
2109 ret = -EINVAL;
2113 rsp = (void *)hcmd.resp_pkt->data;
2114 empty_otp = !!(le32_to_cpu(rsp->general.flags) &
2121 ret = -ENOMEM;
2126 /* TODO: if platform NVM has MAC address - override it here */
2128 if (!is_valid_ether_addr(nvm->hw_addr)) {
2130 ret = -EINVAL;
2135 IWL_INFO(trans, "base HW address: %pM\n", nvm->hw_addr);
2137 IWL_INFO(trans, "base HW address: %6D\n", nvm->hw_addr, ":");
2141 nvm->nvm_version = le16_to_cpu(rsp->general.nvm_version);
2142 nvm->n_hw_addrs = rsp->general.n_hw_addrs;
2143 if (nvm->n_hw_addrs == 0)
2149 mac_flags = le32_to_cpu(rsp->mac_sku.mac_sku_flags);
2150 nvm->sku_cap_11ac_enable =
2152 nvm->sku_cap_11n_enable =
2154 nvm->sku_cap_11ax_enable =
2156 nvm->sku_cap_band_24ghz_enable =
2158 nvm->sku_cap_band_52ghz_enable =
2160 nvm->sku_cap_mimo_disabled =
2162 if (CSR_HW_RFID_TYPE(trans->hw_rf_id) >= IWL_CFG_RF_TYPE_FM)
2163 nvm->sku_cap_11be_enable = true;
2166 nvm->valid_tx_ant = (u8)le32_to_cpu(rsp->phy_sku.tx_chains);
2167 nvm->valid_rx_ant = (u8)le32_to_cpu(rsp->phy_sku.rx_chains);
2169 if (le32_to_cpu(rsp->regulatory.lar_enabled) &&
2170 fw_has_capa(&fw->ucode_capa,
2172 nvm->lar_enabled = true;
2177 channel_profile = v4 ? (void *)rsp->regulatory.channel_profile :
2178 (void *)rsp_v3->regulatory.channel_profile;
2180 tx_ant = nvm->valid_tx_ant & fw->valid_tx_ant;
2181 rx_ant = nvm->valid_rx_ant & fw->valid_rx_ant;
2189 sbands_flags, v4, fw);