@@ -1501,11 +1501,27 @@ static int _iwl_pci_resume(struct device *device, bool restore)
1501
1501
* Scratch value was altered, this means the device was powered off, we
1502
1502
* need to reset it completely.
1503
1503
* Note: MAC (bits 0:7) will be cleared upon suspend even with wowlan,
1504
- * so assume that any bits there mean that the device is usable.
1504
+ * but not bits [15:8]. So if we have bits set in lower word, assume
1505
+ * the device is alive.
1506
+ * For older devices, just try silently to grab the NIC.
1505
1507
*/
1506
- if (trans -> mac_cfg -> device_family >= IWL_DEVICE_FAMILY_BZ &&
1507
- !iwl_read32 (trans , CSR_FUNC_SCRATCH ))
1508
- device_was_powered_off = true;
1508
+ if (trans -> mac_cfg -> device_family >= IWL_DEVICE_FAMILY_BZ ) {
1509
+ if (!(iwl_read32 (trans , CSR_FUNC_SCRATCH ) &
1510
+ CSR_FUNC_SCRATCH_POWER_OFF_MASK ))
1511
+ device_was_powered_off = true;
1512
+ } else {
1513
+ /*
1514
+ * bh are re-enabled by iwl_trans_pcie_release_nic_access,
1515
+ * so re-enable them if _iwl_trans_pcie_grab_nic_access fails.
1516
+ */
1517
+ local_bh_disable ();
1518
+ if (_iwl_trans_pcie_grab_nic_access (trans , true)) {
1519
+ iwl_trans_pcie_release_nic_access (trans );
1520
+ } else {
1521
+ device_was_powered_off = true;
1522
+ local_bh_enable ();
1523
+ }
1524
+ }
1509
1525
1510
1526
if (restore || device_was_powered_off ) {
1511
1527
trans -> state = IWL_TRANS_NO_FW ;
0 commit comments