diff options
Diffstat (limited to 'sys/contrib/dev/iwlwifi/mvm/nvm.c')
| -rw-r--r-- | sys/contrib/dev/iwlwifi/mvm/nvm.c | 52 | 
1 files changed, 23 insertions, 29 deletions
| diff --git a/sys/contrib/dev/iwlwifi/mvm/nvm.c b/sys/contrib/dev/iwlwifi/mvm/nvm.c index 9083089f2e68..f01d5836fce6 100644 --- a/sys/contrib/dev/iwlwifi/mvm/nvm.c +++ b/sys/contrib/dev/iwlwifi/mvm/nvm.c @@ -1,6 +1,6 @@  // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause  /* - * Copyright (C) 2012-2014, 2018-2019, 2021-2024 Intel Corporation + * Copyright (C) 2012-2014, 2018-2019, 2021-2025 Intel Corporation   * Copyright (C) 2013-2015 Intel Mobile Communications GmbH   * Copyright (C) 2016-2017 Intel Deutschland GmbH   */ @@ -122,7 +122,7 @@ static int iwl_nvm_read_chunk(struct iwl_mvm *mvm, u16 section,  		} else {  			IWL_DEBUG_EEPROM(mvm->trans->dev,  					 "NVM access command failed with status %d (device: %s)\n", -					 ret, mvm->trans->name); +					 ret, mvm->trans->info.name);  			ret = -ENODATA;  		}  		goto exit; @@ -193,7 +193,7 @@ static int iwl_nvm_read_section(struct iwl_mvm *mvm, u16 section,  	while (ret == length) {  		/* Check no memory assumptions fail and cause an overflow */  		if ((size_read + offset + length) > -		    mvm->trans->trans_cfg->base_params->eeprom_size) { +		    mvm->trans->mac_cfg->base->eeprom_size) {  			IWL_ERR(mvm, "EEPROM size is too small for NVM\n");  			return -ENOBUFS;  		} @@ -208,7 +208,7 @@ static int iwl_nvm_read_section(struct iwl_mvm *mvm, u16 section,  		offset += ret;  	} -	iwl_nvm_fixups(mvm->trans->hw_id, section, data, offset); +	iwl_nvm_fixups(mvm->trans->info.hw_id, section, data, offset);  	IWL_DEBUG_EEPROM(mvm->trans->dev,  			 "NVM section %d read completed\n", section); @@ -228,7 +228,7 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm)  	/* Checking for required sections */  	if (mvm->trans->cfg->nvm_type == IWL_NVM) {  		if (!mvm->nvm_sections[NVM_SECTION_TYPE_SW].data || -		    !mvm->nvm_sections[mvm->cfg->nvm_hw_section_num].data) { +		    !mvm->nvm_sections[mvm->trans->mac_cfg->base->nvm_hw_section_num].data) {  			IWL_ERR(mvm, "Can't parse empty OTP/NVM sections\n");  			return NULL;  		} @@ -246,7 +246,7 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm)  			return NULL;  		}  		/* MAC_OVERRIDE or at least HW section must exist */ -		if (!mvm->nvm_sections[mvm->cfg->nvm_hw_section_num].data && +		if (!mvm->nvm_sections[mvm->trans->mac_cfg->base->nvm_hw_section_num].data &&  		    !mvm->nvm_sections[NVM_SECTION_TYPE_MAC_OVERRIDE].data) {  			IWL_ERR(mvm,  				"Can't parse mac_address, empty sections\n"); @@ -262,7 +262,7 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm)  		}  	} -	hw = (const __be16 *)sections[mvm->cfg->nvm_hw_section_num].data; +	hw = (const __be16 *)sections[mvm->trans->mac_cfg->base->nvm_hw_section_num].data;  	sw = (const __le16 *)sections[NVM_SECTION_TYPE_SW].data;  	calib = (const __le16 *)sections[NVM_SECTION_TYPE_CALIBRATION].data;  	mac_override = @@ -310,16 +310,15 @@ int iwl_nvm_init(struct iwl_mvm *mvm)  	int ret, section;  	u32 size_read = 0;  	u8 *nvm_buffer, *temp; -	const char *nvm_file_C = mvm->cfg->default_nvm_file_C_step; -	if (WARN_ON_ONCE(mvm->cfg->nvm_hw_section_num >= NVM_MAX_NUM_SECTIONS)) +	if (WARN_ON_ONCE(mvm->trans->mac_cfg->base->nvm_hw_section_num >= NVM_MAX_NUM_SECTIONS))  		return -EINVAL;  	/* load NVM values from nic */  	/* Read From FW NVM */  	IWL_DEBUG_EEPROM(mvm->trans->dev, "Read from NVM\n"); -	nvm_buffer = kmalloc(mvm->trans->trans_cfg->base_params->eeprom_size, +	nvm_buffer = kmalloc(mvm->trans->mac_cfg->base->eeprom_size,  			     GFP_KERNEL);  	if (!nvm_buffer)  		return -ENOMEM; @@ -340,7 +339,7 @@ int iwl_nvm_init(struct iwl_mvm *mvm)  			break;  		} -		iwl_nvm_fixups(mvm->trans->hw_id, section, temp, ret); +		iwl_nvm_fixups(mvm->trans->info.hw_id, section, temp, ret);  		mvm->nvm_sections[section].data = temp;  		mvm->nvm_sections[section].length = ret; @@ -369,7 +368,7 @@ int iwl_nvm_init(struct iwl_mvm *mvm)  			mvm->nvm_reg_blob.size  = ret;  			break;  		default: -			if (section == mvm->cfg->nvm_hw_section_num) { +			if (section == mvm->trans->mac_cfg->base->nvm_hw_section_num) {  				mvm->nvm_hw_blob.data = temp;  				mvm->nvm_hw_blob.size = ret;  				break; @@ -386,21 +385,8 @@ int iwl_nvm_init(struct iwl_mvm *mvm)  		/* read External NVM file from the mod param */  		ret = iwl_read_external_nvm(mvm->trans, mvm->nvm_file_name,  					    mvm->nvm_sections); -		if (ret) { -			mvm->nvm_file_name = nvm_file_C; - -			if ((ret == -EFAULT || ret == -ENOENT) && -			    mvm->nvm_file_name) { -				/* in case nvm file was failed try again */ -				ret = iwl_read_external_nvm(mvm->trans, -							    mvm->nvm_file_name, -							    mvm->nvm_sections); -				if (ret) -					return ret; -			} else { -				return ret; -			} -		} +		if (ret) +			return ret;  	}  	/* parse the relevant nvm sections */ @@ -556,7 +542,7 @@ int iwl_mvm_init_mcc(struct iwl_mvm *mvm)  	struct ieee80211_regdomain *regd;  	char mcc[3]; -	if (mvm->cfg->nvm_type == IWL_NVM_EXT) { +	if (mvm->trans->cfg->nvm_type == IWL_NVM_EXT) {  		tlv_lar = fw_has_capa(&mvm->fw->ucode_capa,  				      IWL_UCODE_TLV_CAPA_LAR_SUPPORT);  		nvm_lar = mvm->nvm_data->lar_enabled; @@ -613,6 +599,7 @@ void iwl_mvm_rx_chub_update_mcc(struct iwl_mvm *mvm,  	char mcc[3];  	struct ieee80211_regdomain *regd;  	int wgds_tbl_idx; +	bool changed = false;  	lockdep_assert_held(&mvm->mutex); @@ -632,10 +619,15 @@ void iwl_mvm_rx_chub_update_mcc(struct iwl_mvm *mvm,  	IWL_DEBUG_LAR(mvm,  		      "RX: received chub update mcc cmd (mcc '%s' src %d)\n",  		      mcc, src); -	regd = iwl_mvm_get_regdomain(mvm->hw->wiphy, mcc, src, NULL); +	regd = iwl_mvm_get_regdomain(mvm->hw->wiphy, mcc, src, &changed);  	if (IS_ERR_OR_NULL(regd))  		return; +	if (!changed) { +		IWL_DEBUG_LAR(mvm, "RX: No change in the regulatory data\n"); +		goto out; +	} +  	wgds_tbl_idx = iwl_mvm_get_sar_geo_profile(mvm);  	if (wgds_tbl_idx < 1)  		IWL_DEBUG_INFO(mvm, @@ -646,5 +638,7 @@ void iwl_mvm_rx_chub_update_mcc(struct iwl_mvm *mvm,  			       wgds_tbl_idx);  	regulatory_set_wiphy_regd(mvm->hw->wiphy, regd); + +out:  	kfree(regd);  } | 
