|
|
deb259 |
From f374231a3a0dcfb8c2c6d33b853b17700d899cc0 Mon Sep 17 00:00:00 2001
|
|
|
deb259 |
From: Eugene Syromiatnikov <esyr@redhat.com>
|
|
|
deb259 |
Date: Fri, 6 Sep 2019 01:52:09 +0200
|
|
|
deb259 |
Subject: [PATCH 4/7] Revert "iwlwifi: support new NVM response API"
|
|
|
deb259 |
|
|
|
deb259 |
This reverts commit 2785ce008e3b52b5a8f9a5bef68b8306d3e37b86.
|
|
|
deb259 |
---
|
|
|
deb259 |
.../net/wireless/intel/iwlwifi/fw/api/nvm-reg.h | 39 +++---------------
|
|
|
deb259 |
drivers/net/wireless/intel/iwlwifi/fw/file.h | 3 --
|
|
|
deb259 |
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | 46 ++++++----------------
|
|
|
deb259 |
3 files changed, 19 insertions(+), 69 deletions(-)
|
|
|
deb259 |
|
|
|
deb259 |
Index: src/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
|
|
|
deb259 |
===================================================================
|
|
|
deb259 |
--- src.orig/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h 2019-06-27 14:54:04.121678482 +0200
|
|
|
deb259 |
+++ src/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h 2019-09-06 01:58:30.665000571 +0200
|
|
|
deb259 |
@@ -8,7 +8,7 @@
|
|
|
deb259 |
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
|
|
|
deb259 |
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
|
|
|
deb259 |
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH
|
|
|
deb259 |
- * Copyright(C) 2018 - 2019 Intel Corporation
|
|
|
deb259 |
+ * Copyright (C) 2018 Intel Corporation
|
|
|
deb259 |
*
|
|
|
deb259 |
* This program is free software; you can redistribute it and/or modify
|
|
|
deb259 |
* it under the terms of version 2 of the GNU General Public License as
|
|
|
deb259 |
@@ -31,7 +31,7 @@
|
|
|
deb259 |
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
|
|
|
deb259 |
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
|
|
|
deb259 |
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH
|
|
|
deb259 |
- * Copyright(C) 2018 - 2019 Intel Corporation
|
|
|
deb259 |
+ * Copyright (C) 2018 Intel Corporation
|
|
|
deb259 |
* All rights reserved.
|
|
|
deb259 |
*
|
|
|
deb259 |
* Redistribution and use in source and binary forms, with or without
|
|
|
deb259 |
@@ -233,8 +233,7 @@
|
|
|
deb259 |
__le32 rx_chains;
|
|
|
deb259 |
} __packed; /* REGULATORY_NVM_GET_INFO_PHY_SKU_SECTION_S_VER_1 */
|
|
|
deb259 |
|
|
|
deb259 |
-#define IWL_NUM_CHANNELS_V1 51
|
|
|
deb259 |
-#define IWL_NUM_CHANNELS 110
|
|
|
deb259 |
+#define IWL_NUM_CHANNELS (51)
|
|
|
deb259 |
|
|
|
deb259 |
/**
|
|
|
deb259 |
* struct iwl_nvm_get_info_regulatory - regulatory information
|
|
|
deb259 |
@@ -242,39 +241,13 @@
|
|
|
deb259 |
* @channel_profile: regulatory data of this channel
|
|
|
deb259 |
* @reserved: reserved
|
|
|
deb259 |
*/
|
|
|
deb259 |
-struct iwl_nvm_get_info_regulatory_v1 {
|
|
|
deb259 |
+struct iwl_nvm_get_info_regulatory {
|
|
|
deb259 |
__le32 lar_enabled;
|
|
|
deb259 |
- __le16 channel_profile[IWL_NUM_CHANNELS_V1];
|
|
|
deb259 |
+ __le16 channel_profile[IWL_NUM_CHANNELS];
|
|
|
deb259 |
__le16 reserved;
|
|
|
deb259 |
} __packed; /* REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */
|
|
|
deb259 |
|
|
|
deb259 |
/**
|
|
|
deb259 |
- * struct iwl_nvm_get_info_regulatory - regulatory information
|
|
|
deb259 |
- * @lar_enabled: is LAR enabled
|
|
|
deb259 |
- * @n_channels: number of valid channels in the array
|
|
|
deb259 |
- * @channel_profile: regulatory data of this channel
|
|
|
deb259 |
- */
|
|
|
deb259 |
-struct iwl_nvm_get_info_regulatory {
|
|
|
deb259 |
- __le32 lar_enabled;
|
|
|
deb259 |
- __le32 n_channels;
|
|
|
deb259 |
- __le32 channel_profile[IWL_NUM_CHANNELS];
|
|
|
deb259 |
-} __packed; /* REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_2 */
|
|
|
deb259 |
-
|
|
|
deb259 |
-/**
|
|
|
deb259 |
- * struct iwl_nvm_get_info_rsp_v3 - response to get NVM data
|
|
|
deb259 |
- * @general: general NVM data
|
|
|
deb259 |
- * @mac_sku: data relating to MAC sku
|
|
|
deb259 |
- * @phy_sku: data relating to PHY sku
|
|
|
deb259 |
- * @regulatory: regulatory data
|
|
|
deb259 |
- */
|
|
|
deb259 |
-struct iwl_nvm_get_info_rsp_v3 {
|
|
|
deb259 |
- struct iwl_nvm_get_info_general general;
|
|
|
deb259 |
- struct iwl_nvm_get_info_sku mac_sku;
|
|
|
deb259 |
- struct iwl_nvm_get_info_phy phy_sku;
|
|
|
deb259 |
- struct iwl_nvm_get_info_regulatory_v1 regulatory;
|
|
|
deb259 |
-} __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_3 */
|
|
|
deb259 |
-
|
|
|
deb259 |
-/**
|
|
|
deb259 |
* struct iwl_nvm_get_info_rsp - response to get NVM data
|
|
|
deb259 |
* @general: general NVM data
|
|
|
deb259 |
* @mac_sku: data relating to MAC sku
|
|
|
deb259 |
@@ -286,7 +259,7 @@
|
|
|
deb259 |
struct iwl_nvm_get_info_sku mac_sku;
|
|
|
deb259 |
struct iwl_nvm_get_info_phy phy_sku;
|
|
|
deb259 |
struct iwl_nvm_get_info_regulatory regulatory;
|
|
|
deb259 |
-} __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_4 */
|
|
|
deb259 |
+} __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_3 */
|
|
|
deb259 |
|
|
|
deb259 |
/**
|
|
|
deb259 |
* struct iwl_nvm_access_complete_cmd - NVM_ACCESS commands are completed
|
|
|
deb259 |
Index: src/drivers/net/wireless/intel/iwlwifi/fw/file.h
|
|
|
deb259 |
===================================================================
|
|
|
deb259 |
--- src.orig/drivers/net/wireless/intel/iwlwifi/fw/file.h 2019-09-06 01:47:46.211297764 +0200
|
|
|
deb259 |
+++ src/drivers/net/wireless/intel/iwlwifi/fw/file.h 2019-09-06 01:58:30.666000559 +0200
|
|
|
deb259 |
@@ -275,8 +275,6 @@
|
|
|
deb259 |
* version of the beacon notification.
|
|
|
deb259 |
* @IWL_UCODE_TLV_API_BEACON_FILTER_V4: This ucode supports v4 of
|
|
|
deb259 |
* BEACON_FILTER_CONFIG_API_S_VER_4.
|
|
|
deb259 |
- * @IWL_UCODE_TLV_API_REGULATORY_NVM_INFO: This ucode supports v4 of
|
|
|
deb259 |
- * REGULATORY_NVM_GET_INFO_RSP_API_S.
|
|
|
deb259 |
* @IWL_UCODE_TLV_API_FTM_NEW_RANGE_REQ: This ucode supports v7 of
|
|
|
deb259 |
* LOCATION_RANGE_REQ_CMD_API_S and v6 of LOCATION_RANGE_RESP_NTFY_API_S.
|
|
|
deb259 |
* @IWL_UCODE_TLV_API_SCAN_OFFLOAD_CHANS: This ucode supports v2 of
|
|
|
deb259 |
@@ -308,7 +306,6 @@
|
|
|
deb259 |
IWL_UCODE_TLV_API_REDUCE_TX_POWER = (__force iwl_ucode_tlv_api_t)45,
|
|
|
deb259 |
IWL_UCODE_TLV_API_SHORT_BEACON_NOTIF = (__force iwl_ucode_tlv_api_t)46,
|
|
|
deb259 |
IWL_UCODE_TLV_API_BEACON_FILTER_V4 = (__force iwl_ucode_tlv_api_t)47,
|
|
|
deb259 |
- IWL_UCODE_TLV_API_REGULATORY_NVM_INFO = (__force iwl_ucode_tlv_api_t)48,
|
|
|
deb259 |
IWL_UCODE_TLV_API_FTM_NEW_RANGE_REQ = (__force iwl_ucode_tlv_api_t)49,
|
|
|
deb259 |
IWL_UCODE_TLV_API_SCAN_OFFLOAD_CHANS = (__force iwl_ucode_tlv_api_t)50,
|
|
|
deb259 |
IWL_UCODE_TLV_API_MBSSID_HE = (__force iwl_ucode_tlv_api_t)52,
|
|
|
deb259 |
Index: src/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
|
|
|
deb259 |
===================================================================
|
|
|
deb259 |
--- src.orig/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c 2019-09-06 01:57:27.386815264 +0200
|
|
|
deb259 |
+++ src/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c 2019-09-06 01:58:30.666000559 +0200
|
|
|
deb259 |
@@ -226,7 +226,7 @@
|
|
|
deb259 |
};
|
|
|
deb259 |
|
|
|
deb259 |
static inline void iwl_nvm_print_channel_flags(struct device *dev, u32 level,
|
|
|
deb259 |
- int chan, u32 flags)
|
|
|
deb259 |
+ int chan, u16 flags)
|
|
|
deb259 |
{
|
|
|
deb259 |
#define CHECK_AND_PRINT_I(x) \
|
|
|
deb259 |
((flags & NVM_CHANNEL_##x) ? " " #x : "")
|
|
|
deb259 |
@@ -257,7 +257,7 @@
|
|
|
deb259 |
}
|
|
|
deb259 |
|
|
|
deb259 |
static u32 iwl_get_channel_flags(u8 ch_num, int ch_idx, bool is_5ghz,
|
|
|
deb259 |
- u32 nvm_flags, const struct iwl_cfg *cfg)
|
|
|
deb259 |
+ u16 nvm_flags, const struct iwl_cfg *cfg)
|
|
|
deb259 |
{
|
|
|
deb259 |
u32 flags = IEEE80211_CHAN_NO_HT40;
|
|
|
deb259 |
|
|
|
deb259 |
@@ -301,13 +301,13 @@
|
|
|
deb259 |
|
|
|
deb259 |
static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
|
|
|
deb259 |
struct iwl_nvm_data *data,
|
|
|
deb259 |
- const void * const nvm_ch_flags,
|
|
|
deb259 |
- u32 sbands_flags, bool v4)
|
|
|
deb259 |
+ const __le16 * const nvm_ch_flags,
|
|
|
deb259 |
+ u32 sbands_flags)
|
|
|
deb259 |
{
|
|
|
deb259 |
int ch_idx;
|
|
|
deb259 |
int n_channels = 0;
|
|
|
deb259 |
struct ieee80211_channel *channel;
|
|
|
deb259 |
- u32 ch_flags;
|
|
|
deb259 |
+ u16 ch_flags;
|
|
|
deb259 |
int num_of_ch, num_2ghz_channels = NUM_2GHZ_CHANNELS;
|
|
|
deb259 |
const u16 *nvm_chan;
|
|
|
deb259 |
|
|
|
deb259 |
@@ -325,12 +325,7 @@
|
|
|
deb259 |
for (ch_idx = 0; ch_idx < num_of_ch; ch_idx++) {
|
|
|
deb259 |
bool is_5ghz = (ch_idx >= num_2ghz_channels);
|
|
|
deb259 |
|
|
|
deb259 |
- if (v4)
|
|
|
deb259 |
- ch_flags =
|
|
|
deb259 |
- __le32_to_cpup((__le32 *)nvm_ch_flags + ch_idx);
|
|
|
deb259 |
- else
|
|
|
deb259 |
- ch_flags =
|
|
|
deb259 |
- __le16_to_cpup((__le16 *)nvm_ch_flags + ch_idx);
|
|
|
deb259 |
+ ch_flags = __le16_to_cpup(nvm_ch_flags + ch_idx);
|
|
|
deb259 |
|
|
|
deb259 |
if (is_5ghz && !data->sku_cap_band_52ghz_enable)
|
|
|
deb259 |
continue;
|
|
|
deb259 |
@@ -482,15 +477,15 @@
|
|
|
deb259 |
|
|
|
deb259 |
static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg,
|
|
|
deb259 |
struct iwl_nvm_data *data,
|
|
|
deb259 |
- const void *nvm_ch_flags, u8 tx_chains,
|
|
|
deb259 |
- u8 rx_chains, u32 sbands_flags, bool v4)
|
|
|
deb259 |
+ const __le16 *nvm_ch_flags, u8 tx_chains,
|
|
|
deb259 |
+ u8 rx_chains, u32 sbands_flags)
|
|
|
deb259 |
{
|
|
|
deb259 |
int n_channels;
|
|
|
deb259 |
int n_used = 0;
|
|
|
deb259 |
struct ieee80211_supported_band *sband;
|
|
|
deb259 |
|
|
|
deb259 |
n_channels = iwl_init_channel_map(dev, cfg, data, nvm_ch_flags,
|
|
|
deb259 |
- sbands_flags, v4);
|
|
|
deb259 |
+ sbands_flags);
|
|
|
deb259 |
sband = &data->bands[NL80211_BAND_2GHZ];
|
|
|
deb259 |
sband->band = NL80211_BAND_2GHZ;
|
|
|
deb259 |
sband->bitrates = &iwl_cfg80211_rates[RATES_24_OFFS];
|
|
|
deb259 |
@@ -823,7 +818,7 @@
|
|
|
deb259 |
sbands_flags |= IWL_NVM_SBANDS_FLAGS_NO_WIDE_IN_5GHZ;
|
|
|
deb259 |
|
|
|
deb259 |
iwl_init_sbands(dev, cfg, data, ch_section, tx_chains, rx_chains,
|
|
|
deb259 |
- sbands_flags, false);
|
|
|
deb259 |
+ sbands_flags);
|
|
|
deb259 |
data->calib_version = 255;
|
|
|
deb259 |
|
|
|
deb259 |
return data;
|
|
|
deb259 |
@@ -1214,6 +1209,7 @@
|
|
|
deb259 |
const struct iwl_fw *fw)
|
|
|
deb259 |
{
|
|
|
deb259 |
struct iwl_nvm_get_info cmd = {};
|
|
|
deb259 |
+ struct iwl_nvm_get_info_rsp *rsp;
|
|
|
deb259 |
struct iwl_nvm_data *nvm;
|
|
|
deb259 |
struct iwl_host_cmd hcmd = {
|
|
|
deb259 |
.flags = CMD_WANT_SKB | CMD_SEND_IN_RFKILL,
|
|
|
deb259 |
@@ -1228,24 +1224,12 @@
|
|
|
deb259 |
bool empty_otp;
|
|
|
deb259 |
u32 mac_flags;
|
|
|
deb259 |
u32 sbands_flags = 0;
|
|
|
deb259 |
- /*
|
|
|
deb259 |
- * All the values in iwl_nvm_get_info_rsp v4 are the same as
|
|
|
deb259 |
- * in v3, except for the channel profile part of the
|
|
|
deb259 |
- * regulatory. So we can just access the new struct, with the
|
|
|
deb259 |
- * exception of the latter.
|
|
|
deb259 |
- */
|
|
|
deb259 |
- struct iwl_nvm_get_info_rsp *rsp;
|
|
|
deb259 |
- struct iwl_nvm_get_info_rsp_v3 *rsp_v3;
|
|
|
deb259 |
- bool v4 = fw_has_api(&fw->ucode_capa,
|
|
|
deb259 |
- IWL_UCODE_TLV_API_REGULATORY_NVM_INFO);
|
|
|
deb259 |
- size_t rsp_size = v4 ? sizeof(*rsp) : sizeof(*rsp_v3);
|
|
|
deb259 |
- void *channel_profile;
|
|
|
deb259 |
|
|
|
deb259 |
ret = iwl_trans_send_cmd(trans, &hcmd);
|
|
|
deb259 |
if (ret)
|
|
|
deb259 |
return ERR_PTR(ret);
|
|
|
deb259 |
|
|
|
deb259 |
- if (WARN(iwl_rx_packet_payload_len(hcmd.resp_pkt) != rsp_size,
|
|
|
deb259 |
+ if (WARN(iwl_rx_packet_payload_len(hcmd.resp_pkt) != sizeof(*rsp),
|
|
|
deb259 |
"Invalid payload len in NVM response from FW %d",
|
|
|
deb259 |
iwl_rx_packet_payload_len(hcmd.resp_pkt))) {
|
|
|
deb259 |
ret = -EINVAL;
|
|
|
deb259 |
@@ -1307,15 +1291,11 @@
|
|
|
deb259 |
sbands_flags |= IWL_NVM_SBANDS_FLAGS_LAR;
|
|
|
deb259 |
}
|
|
|
deb259 |
|
|
|
deb259 |
- rsp_v3 = (void *)rsp;
|
|
|
deb259 |
- channel_profile = v4 ? (void *)rsp->regulatory.channel_profile :
|
|
|
deb259 |
- (void *)rsp_v3->regulatory.channel_profile;
|
|
|
deb259 |
-
|
|
|
deb259 |
iwl_init_sbands(trans->dev, trans->cfg, nvm,
|
|
|
deb259 |
channel_profile,
|
|
|
deb259 |
nvm->valid_tx_ant & fw->valid_tx_ant,
|
|
|
deb259 |
nvm->valid_rx_ant & fw->valid_rx_ant,
|
|
|
deb259 |
- sbands_flags, v4);
|
|
|
deb259 |
+ sbands_flags);
|
|
|
deb259 |
|
|
|
deb259 |
iwl_free_resp(&hcmd);
|
|
|
deb259 |
return nvm;
|