Path: blob/main/sys/contrib/dev/iwlwifi/iwl-nvm-parse.h
107077 views
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */1/*2* Copyright (C) 2005-2015, 2018-2025 Intel Corporation3* Copyright (C) 2016-2017 Intel Deutschland GmbH4*/5#ifndef __iwl_nvm_parse_h__6#define __iwl_nvm_parse_h__78#include <net/cfg80211.h>9#include "iwl-nvm-utils.h"10#include "mei/iwl-mei.h"1112/**13* enum iwl_nvm_sbands_flags - modification flags for the channel profiles14*15* @IWL_NVM_SBANDS_FLAGS_LAR: LAR is enabled16* @IWL_NVM_SBANDS_FLAGS_NO_WIDE_IN_5GHZ: disallow 40, 80 and 160MHz on 5GHz17*/18enum iwl_nvm_sbands_flags {19IWL_NVM_SBANDS_FLAGS_LAR = BIT(0),20IWL_NVM_SBANDS_FLAGS_NO_WIDE_IN_5GHZ = BIT(1),21};2223/*24* iwl_parse_nvm_data - parse NVM data and return values25*26* This function parses all NVM values we need and then27* returns a (newly allocated) struct containing all the28* relevant values for driver use. The struct must be freed29* later with iwl_free_nvm_data().30*/31struct iwl_nvm_data *32iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg,33const struct iwl_fw *fw,34const __be16 *nvm_hw, const __le16 *nvm_sw,35const __le16 *nvm_calib, const __le16 *regulatory,36const __le16 *mac_override, const __le16 *phy_sku,37u8 tx_chains, u8 rx_chains);3839/**40* iwl_parse_nvm_mcc_info - parse MCC (mobile country code) info coming from FW41*42* This function parses the regulatory channel data received as a43* MCC_UPDATE_CMD command. It returns a newly allocation regulatory domain,44* to be fed into the regulatory core. In case the geo_info is set handle45* accordingly. An ERR_PTR is returned on error.46* If not given to the regulatory core, the user is responsible for freeing47* the regdomain returned here with kfree.48*49* @trans: the transport50* @num_of_ch: the number of channels51* @channels: channel map52* @fw_mcc: firmware country code53* @geo_info: geo info value54* @cap: capability55* @resp_ver: FW response version56*/57struct ieee80211_regdomain *58iwl_parse_nvm_mcc_info(struct iwl_trans *trans,59int num_of_ch, __le32 *channels, u16 fw_mcc,60u16 geo_info, u32 cap, u8 resp_ver);6162/**63* struct iwl_nvm_section - describes an NVM section in memory.64*65* This struct holds an NVM section read from the NIC using NVM_ACCESS_CMD,66* and saved for later use by the driver. Not all NVM sections are saved67* this way, only the needed ones.68*/69struct iwl_nvm_section {70u16 length;71const u8 *data;72};7374/**75* iwl_read_external_nvm - Reads external NVM from a file into nvm_sections76*/77int iwl_read_external_nvm(struct iwl_trans *trans,78const char *nvm_file_name,79struct iwl_nvm_section *nvm_sections);80void iwl_nvm_fixups(u32 hw_id, unsigned int section, u8 *data,81unsigned int len);8283/*84* iwl_get_nvm - retrieve NVM data from firmware85*86* Allocates a new iwl_nvm_data structure, fills it with87* NVM data, and returns it to caller.88*/89struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans,90const struct iwl_fw *fw,91u8 set_tx_ant, u8 set_rx_ant);9293/*94* iwl_parse_mei_nvm_data - parse the mei_nvm_data and get an iwl_nvm_data95*/96struct iwl_nvm_data *97iwl_parse_mei_nvm_data(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg,98const struct iwl_mei_nvm *mei_nvm,99const struct iwl_fw *fw, u8 set_tx_ant, u8 set_rx_ant);100101/*102* iwl_reinit_cab - to be called when the tx_chains or rx_chains are modified103*/104void iwl_reinit_cab(struct iwl_trans *trans, struct iwl_nvm_data *data,105u8 tx_chains, u8 rx_chains, const struct iwl_fw *fw);106107#endif /* __iwl_nvm_parse_h__ */108109110