mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 05:11:48 +00:00
iwlwifi: nvm: get num of hw addresses from firmware
With NICs that don't read the NVM directly and instead rely on getting
the relevant data from the firmware, the number of reserved MAC
addresses was not added to the API. This caused the driver to assume
there is only one address which results in all interfaces getting the
same address. Update the API to fix this.
While at it, fix-up the comments with firmware api names to actually
match what we have in the firmware.
Fixes: e9e1ba3dbf
("iwlwifi: mvm: support getting nvm data from firmware")
Signed-off-by: Naftali Goldstein <naftali.goldstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
This commit is contained in:
parent
f38efdb293
commit
e7eeee0843
@ -165,7 +165,7 @@ struct iwl_nvm_access_resp {
|
||||
*/
|
||||
struct iwl_nvm_get_info {
|
||||
__le32 reserved;
|
||||
} __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_S_VER_1 */
|
||||
} __packed; /* REGULATORY_NVM_GET_INFO_CMD_API_S_VER_1 */
|
||||
|
||||
/**
|
||||
* enum iwl_nvm_info_general_flags - flags in NVM_GET_INFO resp
|
||||
@ -180,14 +180,14 @@ enum iwl_nvm_info_general_flags {
|
||||
* @flags: bit 0: 1 - empty, 0 - non-empty
|
||||
* @nvm_version: nvm version
|
||||
* @board_type: board type
|
||||
* @reserved: reserved
|
||||
* @n_hw_addrs: number of reserved MAC addresses
|
||||
*/
|
||||
struct iwl_nvm_get_info_general {
|
||||
__le32 flags;
|
||||
__le16 nvm_version;
|
||||
u8 board_type;
|
||||
u8 reserved;
|
||||
} __packed; /* GRP_REGULATORY_NVM_GET_INFO_GENERAL_S_VER_1 */
|
||||
u8 n_hw_addrs;
|
||||
} __packed; /* REGULATORY_NVM_GET_INFO_GENERAL_S_VER_2 */
|
||||
|
||||
/**
|
||||
* enum iwl_nvm_mac_sku_flags - flags in &iwl_nvm_get_info_sku
|
||||
@ -231,7 +231,7 @@ struct iwl_nvm_get_info_sku {
|
||||
struct iwl_nvm_get_info_phy {
|
||||
__le32 tx_chains;
|
||||
__le32 rx_chains;
|
||||
} __packed; /* GRP_REGULATORY_NVM_GET_INFO_PHY_SKU_SECTION_S_VER_1 */
|
||||
} __packed; /* REGULATORY_NVM_GET_INFO_PHY_SKU_SECTION_S_VER_1 */
|
||||
|
||||
#define IWL_NUM_CHANNELS (51)
|
||||
|
||||
@ -245,7 +245,7 @@ struct iwl_nvm_get_info_regulatory {
|
||||
__le32 lar_enabled;
|
||||
__le16 channel_profile[IWL_NUM_CHANNELS];
|
||||
__le16 reserved;
|
||||
} __packed; /* GRP_REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */
|
||||
} __packed; /* REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */
|
||||
|
||||
/**
|
||||
* struct iwl_nvm_get_info_rsp - response to get NVM data
|
||||
@ -259,7 +259,7 @@ struct iwl_nvm_get_info_rsp {
|
||||
struct iwl_nvm_get_info_sku mac_sku;
|
||||
struct iwl_nvm_get_info_phy phy_sku;
|
||||
struct iwl_nvm_get_info_regulatory regulatory;
|
||||
} __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_RSP_S_VER_2 */
|
||||
} __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_3 */
|
||||
|
||||
/**
|
||||
* struct iwl_nvm_access_complete_cmd - NVM_ACCESS commands are completed
|
||||
|
@ -1335,6 +1335,7 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans,
|
||||
bool lar_fw_supported = !iwlwifi_mod_params.lar_disable &&
|
||||
fw_has_capa(&fw->ucode_capa,
|
||||
IWL_UCODE_TLV_CAPA_LAR_SUPPORT);
|
||||
bool empty_otp;
|
||||
u32 mac_flags;
|
||||
u32 sbands_flags = 0;
|
||||
|
||||
@ -1350,7 +1351,9 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans,
|
||||
}
|
||||
|
||||
rsp = (void *)hcmd.resp_pkt->data;
|
||||
if (le32_to_cpu(rsp->general.flags) & NVM_GENERAL_FLAGS_EMPTY_OTP)
|
||||
empty_otp = !!(le32_to_cpu(rsp->general.flags) &
|
||||
NVM_GENERAL_FLAGS_EMPTY_OTP);
|
||||
if (empty_otp)
|
||||
IWL_INFO(trans, "OTP is empty\n");
|
||||
|
||||
nvm = kzalloc(sizeof(*nvm) +
|
||||
@ -1374,6 +1377,11 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans,
|
||||
|
||||
/* Initialize general data */
|
||||
nvm->nvm_version = le16_to_cpu(rsp->general.nvm_version);
|
||||
nvm->n_hw_addrs = rsp->general.n_hw_addrs;
|
||||
if (nvm->n_hw_addrs == 0)
|
||||
IWL_WARN(trans,
|
||||
"Firmware declares no reserved mac addresses. OTP is empty: %d\n",
|
||||
empty_otp);
|
||||
|
||||
/* Initialize MAC sku data */
|
||||
mac_flags = le32_to_cpu(rsp->mac_sku.mac_sku_flags);
|
||||
|
Loading…
Reference in New Issue
Block a user