linux/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
   2/*
   3 * Copyright (C) 2005-2015, 2018-2020 Intel Corporation
   4 * Copyright (C) 2016-2017 Intel Deutschland GmbH
   5 */
   6#ifndef __iwl_nvm_parse_h__
   7#define __iwl_nvm_parse_h__
   8
   9#include <net/cfg80211.h>
  10#include "iwl-eeprom-parse.h"
  11
  12/**
  13 * enum iwl_nvm_sbands_flags - modification flags for the channel profiles
  14 *
  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
  17 */
  18enum iwl_nvm_sbands_flags {
  19        IWL_NVM_SBANDS_FLAGS_LAR                = BIT(0),
  20        IWL_NVM_SBANDS_FLAGS_NO_WIDE_IN_5GHZ    = BIT(1),
  21};
  22
  23/**
  24 * iwl_parse_nvm_data - parse NVM data and return values
  25 *
  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().
  30 */
  31struct iwl_nvm_data *
  32iwl_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);
  38
  39/**
  40 * iwl_parse_mcc_info - parse MCC (mobile country code) info coming from FW
  41 *
  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.
  48 */
  49struct ieee80211_regdomain *
  50iwl_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);
  53
  54/**
  55 * struct iwl_nvm_section - describes an NVM section in memory.
  56 *
  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.
  60 */
  61struct iwl_nvm_section {
  62        u16 length;
  63        const u8 *data;
  64};
  65
  66/**
  67 * iwl_read_external_nvm - Reads external NVM from a file into nvm_sections
  68 */
  69int iwl_read_external_nvm(struct iwl_trans *trans,
  70                          const char *nvm_file_name,
  71                          struct iwl_nvm_section *nvm_sections);
  72void iwl_nvm_fixups(u32 hw_id, unsigned int section, u8 *data,
  73                    unsigned int len);
  74
  75/**
  76 * iwl_get_nvm - retrieve NVM data from firmware
  77 *
  78 * Allocates a new iwl_nvm_data structure, fills it with
  79 * NVM data, and returns it to caller.
  80 */
  81struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans,
  82                                 const struct iwl_fw *fw);
  83
  84#endif /* __iwl_nvm_parse_h__ */
  85