diff options
author | Eliad Peller <eliad@wizery.com> | 2015-12-10 08:47:11 -0500 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2015-12-13 06:05:03 -0500 |
commit | 08f0d23d97dcb49ca7ba65a3fc714a5d28a91d0c (patch) | |
tree | c40ac7a5c4b1386e65c2cc40b65b7ba62d94ae60 | |
parent | 36be0eb62e8292b1dbe6fdc2163196f9f69ca422 (diff) |
iwlwifi: avoid d0i3 commands when no/init ucode is loaded
d0i3 commands are not supported in the init image, so take
a reference to ensure we don't enter d0i3 during init image,
and additional checks to prevent d0i3 commands when no
fw image is loaded.
Add a few WARN_ON_ONCE to the d0i3 enter/exit commands
to ensure we send d0i3 commands only when the normal
ucode is loaded.
Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 8 |
3 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c index 7e2a8149411c..9ce7587e329d 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | |||
@@ -1316,6 +1316,7 @@ static ssize_t iwl_dbgfs_d0i3_refs_read(struct file *file, | |||
1316 | PRINT_MVM_REF(IWL_MVM_REF_EXIT_WORK); | 1316 | PRINT_MVM_REF(IWL_MVM_REF_EXIT_WORK); |
1317 | PRINT_MVM_REF(IWL_MVM_REF_PROTECT_CSA); | 1317 | PRINT_MVM_REF(IWL_MVM_REF_PROTECT_CSA); |
1318 | PRINT_MVM_REF(IWL_MVM_REF_FW_DBG_COLLECT); | 1318 | PRINT_MVM_REF(IWL_MVM_REF_FW_DBG_COLLECT); |
1319 | PRINT_MVM_REF(IWL_MVM_REF_INIT_UCODE); | ||
1319 | 1320 | ||
1320 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 1321 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
1321 | } | 1322 | } |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index 612799a889db..3f0db29d5d56 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | |||
@@ -294,6 +294,7 @@ enum iwl_mvm_ref_type { | |||
294 | IWL_MVM_REF_EXIT_WORK, | 294 | IWL_MVM_REF_EXIT_WORK, |
295 | IWL_MVM_REF_PROTECT_CSA, | 295 | IWL_MVM_REF_PROTECT_CSA, |
296 | IWL_MVM_REF_FW_DBG_COLLECT, | 296 | IWL_MVM_REF_FW_DBG_COLLECT, |
297 | IWL_MVM_REF_INIT_UCODE, | ||
297 | 298 | ||
298 | /* update debugfs.c when changing this */ | 299 | /* update debugfs.c when changing this */ |
299 | 300 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index 958984cc4d2e..31c16a185001 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c | |||
@@ -603,9 +603,11 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
603 | goto out_free; | 603 | goto out_free; |
604 | 604 | ||
605 | mutex_lock(&mvm->mutex); | 605 | mutex_lock(&mvm->mutex); |
606 | iwl_mvm_ref(mvm, IWL_MVM_REF_INIT_UCODE); | ||
606 | err = iwl_run_init_mvm_ucode(mvm, true); | 607 | err = iwl_run_init_mvm_ucode(mvm, true); |
607 | if (!err || !iwlmvm_mod_params.init_dbg) | 608 | if (!err || !iwlmvm_mod_params.init_dbg) |
608 | iwl_trans_stop_device(trans); | 609 | iwl_trans_stop_device(trans); |
610 | iwl_mvm_unref(mvm, IWL_MVM_REF_INIT_UCODE); | ||
609 | mutex_unlock(&mvm->mutex); | 611 | mutex_unlock(&mvm->mutex); |
610 | /* returns 0 if successful, 1 if success but in rfkill */ | 612 | /* returns 0 if successful, 1 if success but in rfkill */ |
611 | if (err < 0 && !iwlmvm_mod_params.init_dbg) { | 613 | if (err < 0 && !iwlmvm_mod_params.init_dbg) { |
@@ -1213,6 +1215,9 @@ int iwl_mvm_enter_d0i3(struct iwl_op_mode *op_mode) | |||
1213 | 1215 | ||
1214 | IWL_DEBUG_RPM(mvm, "MVM entering D0i3\n"); | 1216 | IWL_DEBUG_RPM(mvm, "MVM entering D0i3\n"); |
1215 | 1217 | ||
1218 | if (WARN_ON_ONCE(mvm->cur_ucode != IWL_UCODE_REGULAR)) | ||
1219 | return -EINVAL; | ||
1220 | |||
1216 | set_bit(IWL_MVM_STATUS_IN_D0I3, &mvm->status); | 1221 | set_bit(IWL_MVM_STATUS_IN_D0I3, &mvm->status); |
1217 | 1222 | ||
1218 | /* | 1223 | /* |
@@ -1420,6 +1425,9 @@ int _iwl_mvm_exit_d0i3(struct iwl_mvm *mvm) | |||
1420 | 1425 | ||
1421 | IWL_DEBUG_RPM(mvm, "MVM exiting D0i3\n"); | 1426 | IWL_DEBUG_RPM(mvm, "MVM exiting D0i3\n"); |
1422 | 1427 | ||
1428 | if (WARN_ON_ONCE(mvm->cur_ucode != IWL_UCODE_REGULAR)) | ||
1429 | return -EINVAL; | ||
1430 | |||
1423 | mutex_lock(&mvm->d0i3_suspend_mutex); | 1431 | mutex_lock(&mvm->d0i3_suspend_mutex); |
1424 | if (test_bit(D0I3_DEFER_WAKEUP, &mvm->d0i3_suspend_flags)) { | 1432 | if (test_bit(D0I3_DEFER_WAKEUP, &mvm->d0i3_suspend_flags)) { |
1425 | IWL_DEBUG_RPM(mvm, "Deferring d0i3 exit until resume\n"); | 1433 | IWL_DEBUG_RPM(mvm, "Deferring d0i3 exit until resume\n"); |