Skip to content

Commit 2c72c8d

Browse files
committed
Miri Korenblit says: ==================== a few fixes, mainly of the cfg rework. ==================== Signed-off-by: Johannes Berg <[email protected]>
2 parents b3bf3dc + 019f71a commit 2c72c8d

File tree

5 files changed

+57
-7
lines changed

5 files changed

+57
-7
lines changed

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ int iwl_acpi_get_dsm(struct iwl_fw_runtime *fwrt,
169169

170170
BUILD_BUG_ON(ARRAY_SIZE(acpi_dsm_size) != DSM_FUNC_NUM_FUNCS);
171171

172-
if (WARN_ON(func >= ARRAY_SIZE(acpi_dsm_size)))
172+
if (WARN_ON(func >= ARRAY_SIZE(acpi_dsm_size) || !func))
173173
return -EINVAL;
174174

175175
expected_size = acpi_dsm_size[func];
@@ -178,6 +178,29 @@ int iwl_acpi_get_dsm(struct iwl_fw_runtime *fwrt,
178178
if (expected_size != sizeof(u8) && expected_size != sizeof(u32))
179179
return -EOPNOTSUPP;
180180

181+
if (!fwrt->acpi_dsm_funcs_valid) {
182+
ret = iwl_acpi_get_dsm_integer(fwrt->dev, ACPI_DSM_REV,
183+
DSM_FUNC_QUERY,
184+
&iwl_guid, &tmp,
185+
acpi_dsm_size[DSM_FUNC_QUERY]);
186+
if (ret) {
187+
/* always indicate BIT(0) to avoid re-reading */
188+
fwrt->acpi_dsm_funcs_valid = BIT(0);
189+
return ret;
190+
}
191+
192+
IWL_DEBUG_RADIO(fwrt, "ACPI DSM validity bitmap 0x%x\n",
193+
(u32)tmp);
194+
/* always indicate BIT(0) to avoid re-reading */
195+
fwrt->acpi_dsm_funcs_valid = tmp | BIT(0);
196+
}
197+
198+
if (!(fwrt->acpi_dsm_funcs_valid & BIT(func))) {
199+
IWL_DEBUG_RADIO(fwrt, "ACPI DSM %d not indicated as valid\n",
200+
func);
201+
return -ENODATA;
202+
}
203+
181204
ret = iwl_acpi_get_dsm_integer(fwrt->dev, ACPI_DSM_REV, func,
182205
&iwl_guid, &tmp, expected_size);
183206
if (ret)

drivers/net/wireless/intel/iwlwifi/fw/runtime.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ struct iwl_txf_iter_data {
113113
* @phy_filters: specific phy filters as read from WPFC BIOS table
114114
* @ppag_bios_rev: PPAG BIOS revision
115115
* @ppag_bios_source: see &enum bios_source
116+
* @acpi_dsm_funcs_valid: bitmap indicating which DSM values are valid,
117+
* zero (default initialization) means it hasn't been read yet,
118+
* and BIT(0) is set when it has since function 0 also has this
119+
* bitmap and is always supported
116120
*/
117121
struct iwl_fw_runtime {
118122
struct iwl_trans *trans;
@@ -189,6 +193,10 @@ struct iwl_fw_runtime {
189193
bool uats_valid;
190194
u8 uefi_tables_lock_status;
191195
struct iwl_phy_specific_cfg phy_filters;
196+
197+
#ifdef CONFIG_ACPI
198+
u32 acpi_dsm_funcs_valid;
199+
#endif
192200
};
193201

194202
void iwl_fw_runtime_init(struct iwl_fw_runtime *fwrt, struct iwl_trans *trans,

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,12 @@ int iwl_uefi_get_dsm(struct iwl_fw_runtime *fwrt, enum iwl_dsm_funcs func,
747747
goto out;
748748
}
749749

750+
if (!(data->functions[DSM_FUNC_QUERY] & BIT(func))) {
751+
IWL_DEBUG_RADIO(fwrt, "DSM func %d not in 0x%x\n",
752+
func, data->functions[DSM_FUNC_QUERY]);
753+
goto out;
754+
}
755+
750756
*value = data->functions[func];
751757

752758
IWL_DEBUG_RADIO(fwrt,

drivers/net/wireless/intel/iwlwifi/pcie/drv.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,8 @@ VISIBLE_IF_IWLWIFI_KUNIT const struct iwl_dev_info iwl_dev_info_table[] = {
673673

674674
IWL_DEV_INFO(iwl6005_n_cfg, iwl6005_2agn_sff_name,
675675
DEVICE(0x0082), SUBDEV_MASKED(0xC000, 0xF000)),
676+
IWL_DEV_INFO(iwl6005_n_cfg, iwl6005_2agn_sff_name,
677+
DEVICE(0x0085), SUBDEV_MASKED(0xC000, 0xF000)),
676678
IWL_DEV_INFO(iwl6005_n_cfg, iwl6005_2agn_d_name,
677679
DEVICE(0x0082), SUBDEV(0x4820)),
678680
IWL_DEV_INFO(iwl6005_n_cfg, iwl6005_2agn_mow1_name,
@@ -729,10 +731,10 @@ VISIBLE_IF_IWLWIFI_KUNIT const struct iwl_dev_info iwl_dev_info_table[] = {
729731
DEVICE(0x0083), SUBDEV_MASKED(0x5, 0xF)),
730732
IWL_DEV_INFO(iwl1000_bg_cfg, iwl1000_bg_name,
731733
DEVICE(0x0083), SUBDEV_MASKED(0x6, 0xF)),
734+
IWL_DEV_INFO(iwl1000_bgn_cfg, iwl1000_bgn_name,
735+
DEVICE(0x0084), SUBDEV_MASKED(0x5, 0xF)),
732736
IWL_DEV_INFO(iwl1000_bg_cfg, iwl1000_bg_name,
733-
DEVICE(0x0084), SUBDEV(0x1216)),
734-
IWL_DEV_INFO(iwl1000_bg_cfg, iwl1000_bg_name,
735-
DEVICE(0x0084), SUBDEV(0x1316)),
737+
DEVICE(0x0084), SUBDEV_MASKED(0x6, 0xF)),
736738

737739
/* 100 Series WiFi */
738740
IWL_DEV_INFO(iwl100_bgn_cfg, iwl100_bgn_name,
@@ -964,6 +966,12 @@ VISIBLE_IF_IWLWIFI_KUNIT const struct iwl_dev_info iwl_dev_info_table[] = {
964966
DEVICE(0x24F3), SUBDEV(0x0004)),
965967
IWL_DEV_INFO(iwl8260_cfg, iwl8260_2n_name,
966968
DEVICE(0x24F3), SUBDEV(0x0044)),
969+
IWL_DEV_INFO(iwl8260_cfg, iwl8260_2ac_name,
970+
DEVICE(0x24F4)),
971+
IWL_DEV_INFO(iwl8260_cfg, iwl4165_2ac_name,
972+
DEVICE(0x24F5)),
973+
IWL_DEV_INFO(iwl8260_cfg, iwl4165_2ac_name,
974+
DEVICE(0x24F6)),
967975
IWL_DEV_INFO(iwl8265_cfg, iwl8265_2ac_name,
968976
DEVICE(0x24FD)),
969977
IWL_DEV_INFO(iwl8265_cfg, iwl8275_2ac_name,
@@ -1222,11 +1230,15 @@ static int _iwl_pci_resume(struct device *device, bool restore)
12221230
* Note: MAC (bits 0:7) will be cleared upon suspend even with wowlan,
12231231
* but not bits [15:8]. So if we have bits set in lower word, assume
12241232
* the device is alive.
1233+
* Alternatively, if the scratch value is 0xFFFFFFFF, then we no longer
1234+
* have access to the device and consider it powered off.
12251235
* For older devices, just try silently to grab the NIC.
12261236
*/
12271237
if (trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) {
1228-
if (!(iwl_read32(trans, CSR_FUNC_SCRATCH) &
1229-
CSR_FUNC_SCRATCH_POWER_OFF_MASK))
1238+
u32 scratch = iwl_read32(trans, CSR_FUNC_SCRATCH);
1239+
1240+
if (!(scratch & CSR_FUNC_SCRATCH_POWER_OFF_MASK) ||
1241+
scratch == ~0U)
12301242
device_was_powered_off = true;
12311243
} else {
12321244
/*

drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/tx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2092,7 +2092,8 @@ static void iwl_txq_gen1_update_byte_cnt_tbl(struct iwl_trans *trans,
20922092
break;
20932093
}
20942094

2095-
if (trans->mac_cfg->device_family < IWL_DEVICE_FAMILY_AX210)
2095+
if (trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_9000 &&
2096+
trans->mac_cfg->device_family < IWL_DEVICE_FAMILY_AX210)
20962097
len = DIV_ROUND_UP(len, 4);
20972098

20982099
if (WARN_ON(len > 0xFFF || write_ptr >= TFD_QUEUE_SIZE_MAX))

0 commit comments

Comments
 (0)