Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
0002 /*
0003  * Copyright (C) 2005-2015, 2018-2021 Intel Corporation
0004  * Copyright (C) 2016-2017 Intel Deutschland GmbH
0005  */
0006 #ifndef __iwl_nvm_parse_h__
0007 #define __iwl_nvm_parse_h__
0008 
0009 #include <net/cfg80211.h>
0010 #include "iwl-eeprom-parse.h"
0011 #include "mei/iwl-mei.h"
0012 
0013 /**
0014  * enum iwl_nvm_sbands_flags - modification flags for the channel profiles
0015  *
0016  * @IWL_NVM_SBANDS_FLAGS_LAR: LAR is enabled
0017  * @IWL_NVM_SBANDS_FLAGS_NO_WIDE_IN_5GHZ: disallow 40, 80 and 160MHz on 5GHz
0018  */
0019 enum iwl_nvm_sbands_flags {
0020     IWL_NVM_SBANDS_FLAGS_LAR        = BIT(0),
0021     IWL_NVM_SBANDS_FLAGS_NO_WIDE_IN_5GHZ    = BIT(1),
0022 };
0023 
0024 /**
0025  * iwl_parse_nvm_data - parse NVM data and return values
0026  *
0027  * This function parses all NVM values we need and then
0028  * returns a (newly allocated) struct containing all the
0029  * relevant values for driver use. The struct must be freed
0030  * later with iwl_free_nvm_data().
0031  */
0032 struct iwl_nvm_data *
0033 iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
0034            const struct iwl_fw *fw,
0035            const __be16 *nvm_hw, const __le16 *nvm_sw,
0036            const __le16 *nvm_calib, const __le16 *regulatory,
0037            const __le16 *mac_override, const __le16 *phy_sku,
0038            u8 tx_chains, u8 rx_chains);
0039 
0040 /**
0041  * iwl_parse_mcc_info - parse MCC (mobile country code) info coming from FW
0042  *
0043  * This function parses the regulatory channel data received as a
0044  * MCC_UPDATE_CMD command. It returns a newly allocation regulatory domain,
0045  * to be fed into the regulatory core. In case the geo_info is set handle
0046  * accordingly. An ERR_PTR is returned on error.
0047  * If not given to the regulatory core, the user is responsible for freeing
0048  * the regdomain returned here with kfree.
0049  */
0050 struct ieee80211_regdomain *
0051 iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
0052                int num_of_ch, __le32 *channels, u16 fw_mcc,
0053                u16 geo_info, u16 cap, u8 resp_ver);
0054 
0055 /**
0056  * struct iwl_nvm_section - describes an NVM section in memory.
0057  *
0058  * This struct holds an NVM section read from the NIC using NVM_ACCESS_CMD,
0059  * and saved for later use by the driver. Not all NVM sections are saved
0060  * this way, only the needed ones.
0061  */
0062 struct iwl_nvm_section {
0063     u16 length;
0064     const u8 *data;
0065 };
0066 
0067 /**
0068  * iwl_read_external_nvm - Reads external NVM from a file into nvm_sections
0069  */
0070 int iwl_read_external_nvm(struct iwl_trans *trans,
0071               const char *nvm_file_name,
0072               struct iwl_nvm_section *nvm_sections);
0073 void iwl_nvm_fixups(u32 hw_id, unsigned int section, u8 *data,
0074             unsigned int len);
0075 
0076 /**
0077  * iwl_get_nvm - retrieve NVM data from firmware
0078  *
0079  * Allocates a new iwl_nvm_data structure, fills it with
0080  * NVM data, and returns it to caller.
0081  */
0082 struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans,
0083                  const struct iwl_fw *fw);
0084 
0085 /**
0086  * iwl_parse_mei_nvm_data - parse the mei_nvm_data and get an iwl_nvm_data
0087  */
0088 struct iwl_nvm_data *
0089 iwl_parse_mei_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
0090                const struct iwl_mei_nvm *mei_nvm,
0091                const struct iwl_fw *fw);
0092 
0093 #endif /* __iwl_nvm_parse_h__ */