Skip to content

Commit be37f7d

Browse files
jmberg-intelgregkh
authored andcommitted
iwlwifi: pnvm: accept multiple HW-type TLVs
[ Upstream commit 0f673c1 ] Some products (So) may have two different types of products with different mac-type that are otherwise equivalent, and have the same PNVM data, so the PNVM file will contain two (or perhaps later more) HW-type TLVs. Accept the file and use the data section that contains any matching entry. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20210719140154.a6a86e903035.Ic0b1b75c45d386698859f251518e8a5144431938@changeid Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9a6a560 commit be37f7d

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

  • drivers/net/wireless/intel/iwlwifi/fw

drivers/net/wireless/intel/iwlwifi/fw/pnvm.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data,
3838
u32 sha1 = 0;
3939
u16 mac_type = 0, rf_id = 0;
4040
u8 *pnvm_data = NULL, *tmp;
41+
bool hw_match = false;
4142
u32 size = 0;
4243
int ret;
4344

@@ -84,22 +85,19 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data,
8485
break;
8586
}
8687

88+
if (hw_match)
89+
break;
90+
8791
mac_type = le16_to_cpup((__le16 *)data);
8892
rf_id = le16_to_cpup((__le16 *)(data + sizeof(__le16)));
8993

9094
IWL_DEBUG_FW(trans,
9195
"Got IWL_UCODE_TLV_HW_TYPE mac_type 0x%0x rf_id 0x%0x\n",
9296
mac_type, rf_id);
9397

94-
if (mac_type != CSR_HW_REV_TYPE(trans->hw_rev) ||
95-
rf_id != CSR_HW_RFID_TYPE(trans->hw_rf_id)) {
96-
IWL_DEBUG_FW(trans,
97-
"HW mismatch, skipping PNVM section, mac_type 0x%0x, rf_id 0x%0x.\n",
98-
CSR_HW_REV_TYPE(trans->hw_rev), trans->hw_rf_id);
99-
ret = -ENOENT;
100-
goto out;
101-
}
102-
98+
if (mac_type == CSR_HW_REV_TYPE(trans->hw_rev) &&
99+
rf_id == CSR_HW_RFID_TYPE(trans->hw_rf_id))
100+
hw_match = true;
103101
break;
104102
case IWL_UCODE_TLV_SEC_RT: {
105103
struct iwl_pnvm_section *section = (void *)data;
@@ -150,6 +148,15 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data,
150148
}
151149

152150
done:
151+
if (!hw_match) {
152+
IWL_DEBUG_FW(trans,
153+
"HW mismatch, skipping PNVM section (need mac_type 0x%x rf_id 0x%x)\n",
154+
CSR_HW_REV_TYPE(trans->hw_rev),
155+
CSR_HW_RFID_TYPE(trans->hw_rf_id));
156+
ret = -ENOENT;
157+
goto out;
158+
}
159+
153160
if (!size) {
154161
IWL_DEBUG_FW(trans, "Empty PNVM, skipping.\n");
155162
ret = -ENOENT;

0 commit comments

Comments
 (0)