iwlwifi: mvm: Add debugfs entry to generate NMI to NIC
authorAlexander Bondar <alexander.bondar@intel.com>
Thu, 17 Oct 2013 12:26:50 +0000 (14:26 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Mon, 9 Dec 2013 20:27:57 +0000 (22:27 +0200)
Writting to fw_nmi entry will set DEVICE_SET_NMI_REG (0x00a01c30)
generating NMI that halts NIC CPU.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/iwl-prph.h
drivers/net/wireless/iwlwifi/mvm/debugfs.c

index a70c7b9d9bad897345fb1e1e89d5c421e0d8a3da..f6412dae26590cbf2f66ae774b11aaf402721179 100644 (file)
 /* Device system time */
 #define DEVICE_SYSTEM_TIME_REG 0xA0206C
 
+/* Device NMI register */
+#define DEVICE_SET_NMI_REG 0x00a01c30
+
 /*****************************************************************************
  *                        7000/3000 series SHR DTS addresses                 *
  *****************************************************************************/
index a8fe6b41f9a34b417a12e5295c7b86c75361bb1b..342bd1a07ab7f758176719c7487df918e615a50a 100644 (file)
@@ -63,6 +63,7 @@
 #include "mvm.h"
 #include "sta.h"
 #include "iwl-io.h"
+#include "iwl-prph.h"
 
 struct iwl_dbgfs_mvm_ctx {
        struct iwl_mvm *mvm;
@@ -804,6 +805,17 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct file *file,
        return count;
 }
 
+static ssize_t iwl_dbgfs_fw_nmi_write(struct file *file,
+                                     const char __user *user_buf,
+                                     size_t count, loff_t *ppos)
+{
+       struct iwl_mvm *mvm = file->private_data;
+
+       iwl_write_prph(mvm->trans, DEVICE_SET_NMI_REG, 1);
+
+       return count;
+}
+
 static ssize_t
 iwl_dbgfs_scan_ant_rxchain_read(struct file *file,
                                char __user *user_buf,
@@ -1168,6 +1180,7 @@ MVM_DEBUGFS_READ_FILE_OPS(bt_cmd);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(disable_power_off);
 MVM_DEBUGFS_READ_FILE_OPS(fw_rx_stats);
 MVM_DEBUGFS_WRITE_FILE_OPS(fw_restart);
+MVM_DEBUGFS_WRITE_FILE_OPS(fw_nmi);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(scan_ant_rxchain);
 
 #ifdef CONFIG_PM_SLEEP
@@ -1196,6 +1209,7 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
                                     S_IRUSR | S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(fw_rx_stats, mvm->debugfs_dir, S_IRUSR);
        MVM_DEBUGFS_ADD_FILE(fw_restart, mvm->debugfs_dir, S_IWUSR);
+       MVM_DEBUGFS_ADD_FILE(fw_nmi, mvm->debugfs_dir, S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(scan_ant_rxchain, mvm->debugfs_dir,
                             S_IWUSR | S_IRUSR);
 #ifdef CONFIG_PM_SLEEP