Skip to content

Commit 0f673c1

Browse files
jmberg-intelKalle Valo
authored andcommitted
iwlwifi: pnvm: accept multiple HW-type TLVs
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 <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/20210719140154.a6a86e903035.Ic0b1b75c45d386698859f251518e8a5144431938@changeid
1 parent 09cfae9 commit 0f673c1

File tree

1 file changed

+16
-9
lines changed
  • drivers/net/wireless/intel/iwlwifi/fw

1 file changed

+16
-9
lines changed

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)