1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
3 * Copyright (C) 2005-2015, 2018-2020 Intel Corporation
4 * Copyright (C) 2016-2017 Intel Deutschland GmbH
6 #ifndef __iwl_nvm_parse_h__
7 #define __iwl_nvm_parse_h__
9 #include <net/cfg80211.h>
10 #include "iwl-eeprom-parse.h"
13 * enum iwl_nvm_sbands_flags - modification flags for the channel profiles
15 * @IWL_NVM_SBANDS_FLAGS_LAR: LAR is enabled
16 * @IWL_NVM_SBANDS_FLAGS_NO_WIDE_IN_5GHZ: disallow 40, 80 and 160MHz on 5GHz
18 enum iwl_nvm_sbands_flags {
19 IWL_NVM_SBANDS_FLAGS_LAR = BIT(0),
20 IWL_NVM_SBANDS_FLAGS_NO_WIDE_IN_5GHZ = BIT(1),
24 * iwl_parse_nvm_data - parse NVM data and return values
26 * This function parses all NVM values we need and then
27 * returns a (newly allocated) struct containing all the
28 * relevant values for driver use. The struct must be freed
29 * later with iwl_free_nvm_data().
32 iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
33 const struct iwl_fw *fw,
34 const __be16 *nvm_hw, const __le16 *nvm_sw,
35 const __le16 *nvm_calib, const __le16 *regulatory,
36 const __le16 *mac_override, const __le16 *phy_sku,
37 u8 tx_chains, u8 rx_chains);
40 * iwl_parse_mcc_info - parse MCC (mobile country code) info coming from FW
42 * This function parses the regulatory channel data received as a
43 * 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 handle
45 * accordingly. An ERR_PTR is returned on error.
46 * If not given to the regulatory core, the user is responsible for freeing
47 * the regdomain returned here with kfree.
49 struct ieee80211_regdomain *
50 iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
51 int num_of_ch, __le32 *channels, u16 fw_mcc,
52 u16 geo_info, u16 cap, u8 resp_ver);
55 * struct iwl_nvm_section - describes an NVM section in memory.
57 * This struct holds an NVM section read from the NIC using NVM_ACCESS_CMD,
58 * and saved for later use by the driver. Not all NVM sections are saved
59 * this way, only the needed ones.
61 struct iwl_nvm_section {
67 * iwl_read_external_nvm - Reads external NVM from a file into nvm_sections
69 int iwl_read_external_nvm(struct iwl_trans *trans,
70 const char *nvm_file_name,
71 struct iwl_nvm_section *nvm_sections);
72 void iwl_nvm_fixups(u32 hw_id, unsigned int section, u8 *data,
76 * iwl_get_nvm - retrieve NVM data from firmware
78 * Allocates a new iwl_nvm_data structure, fills it with
79 * NVM data, and returns it to caller.
81 struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans,
82 const struct iwl_fw *fw);
83 #endif /* __iwl_nvm_parse_h__ */