iwlwifi: dbg: move monitor recording functionality from header file
authorShahar S Matityahu <shahar.s.matityahu@intel.com>
Tue, 21 May 2019 06:42:15 +0000 (09:42 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 6 Sep 2019 12:31:11 +0000 (15:31 +0300)
The recording functions are quite big to be inline and the driver should
expose only the stop and restart functions that are allowed to be used
rather then the internal helper functions. Move the functions from the
header file.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/dbg.c
drivers/net/wireless/intel/iwlwifi/fw/dbg.h

index 4d81776f576dc370091126d1c706b1532f956909..dfb0c50df94c9dadd5b071a49eb7d49558d97fb4 100644 (file)
@@ -2937,3 +2937,88 @@ void iwl_fw_error_print_fseq_regs(struct iwl_fw_runtime *fwrt)
        iwl_trans_release_nic_access(trans, &flags);
 }
 IWL_EXPORT_SYMBOL(iwl_fw_error_print_fseq_regs);
+
+static void _iwl_fw_dbg_stop_recording(struct iwl_trans *trans,
+                                      struct iwl_fw_dbg_params *params)
+{
+       if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) {
+               iwl_set_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x100);
+               return;
+       }
+
+       if (params) {
+               params->in_sample = iwl_read_umac_prph(trans, DBGC_IN_SAMPLE);
+               params->out_ctrl = iwl_read_umac_prph(trans, DBGC_OUT_CTRL);
+       }
+
+       iwl_write_umac_prph(trans, DBGC_IN_SAMPLE, 0);
+       /* wait for the DBGC to finish writing the internal buffer to DRAM to
+        * avoid halting the HW while writing
+        */
+       usleep_range(700, 1000);
+       iwl_write_umac_prph(trans, DBGC_OUT_CTRL, 0);
+#ifdef CONFIG_IWLWIFI_DEBUGFS
+       trans->dbg.rec_on = false;
+#endif
+}
+
+void iwl_fw_dbg_stop_recording(struct iwl_trans *trans,
+                              struct iwl_fw_dbg_params *params)
+{
+       /* if the FW crashed or not debug monitor cfg was given, there is
+        * no point in stopping
+        */
+       if (test_bit(STATUS_FW_ERROR, &trans->status) ||
+           (!trans->dbg.dest_tlv &&
+            trans->dbg.ini_dest == IWL_FW_INI_LOCATION_INVALID))
+               return;
+
+       if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560) {
+               IWL_ERR(trans,
+                       "WRT: unsupported device family %d for debug stop recording\n",
+                       trans->cfg->device_family);
+               return;
+       }
+       _iwl_fw_dbg_stop_recording(trans, params);
+}
+IWL_EXPORT_SYMBOL(iwl_fw_dbg_stop_recording);
+
+static void _iwl_fw_dbg_restart_recording(struct iwl_trans *trans,
+                                         struct iwl_fw_dbg_params *params)
+{
+       if (WARN_ON(!params))
+               return;
+
+       if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) {
+               iwl_clear_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x100);
+               iwl_clear_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x1);
+               iwl_set_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x1);
+       } else {
+               iwl_write_umac_prph(trans, DBGC_IN_SAMPLE, params->in_sample);
+               iwl_write_umac_prph(trans, DBGC_OUT_CTRL, params->out_ctrl);
+       }
+}
+
+void iwl_fw_dbg_restart_recording(struct iwl_fw_runtime *fwrt,
+                                 struct iwl_fw_dbg_params *params)
+{
+       /* if the FW crashed or not debug monitor cfg was given, there is
+        * no point in restarting
+        */
+       if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status) ||
+           (!fwrt->trans->dbg.dest_tlv &&
+            fwrt->trans->dbg.ini_dest == IWL_FW_INI_LOCATION_INVALID))
+               return;
+
+       if (fwrt->trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560) {
+               IWL_ERR(fwrt,
+                       "WRT: unsupported device family %d for debug restart recording\n",
+                       fwrt->trans->cfg->device_family);
+               return;
+       }
+       _iwl_fw_dbg_restart_recording(fwrt->trans, params);
+#ifdef CONFIG_IWLWIFI_DEBUGFS
+       iwl_fw_set_dbg_rec_on(fwrt);
+#endif
+}
+IWL_EXPORT_SYMBOL(iwl_fw_dbg_restart_recording);
index a8459ac71b2cc00b6fe163ff1f25e12092882731..d6b012459b043cbc9404dd7327e7e9e01de58bae 100644 (file)
@@ -263,68 +263,11 @@ _iwl_fw_dbg_trigger_simple_stop(struct iwl_fw_runtime *fwrt,
                                        iwl_fw_dbg_get_trigger((fwrt)->fw,\
                                                               (trig)))
 
-static inline void
-_iwl_fw_dbg_stop_recording(struct iwl_trans *trans,
-                          struct iwl_fw_dbg_params *params)
-{
-       if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) {
-               iwl_set_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x100);
-               return;
-       }
+void iwl_fw_dbg_stop_recording(struct iwl_trans *trans,
+                              struct iwl_fw_dbg_params *params);
 
-       if (params) {
-               params->in_sample = iwl_read_umac_prph(trans, DBGC_IN_SAMPLE);
-               params->out_ctrl = iwl_read_umac_prph(trans, DBGC_OUT_CTRL);
-       }
-
-       iwl_write_umac_prph(trans, DBGC_IN_SAMPLE, 0);
-       /* wait for the DBGC to finish writing the internal buffer to DRAM to
-        * avoid halting the HW while writing
-        */
-       usleep_range(700, 1000);
-       iwl_write_umac_prph(trans, DBGC_OUT_CTRL, 0);
-#ifdef CONFIG_IWLWIFI_DEBUGFS
-       trans->dbg.rec_on = false;
-#endif
-}
-
-static inline void
-iwl_fw_dbg_stop_recording(struct iwl_trans *trans,
-                         struct iwl_fw_dbg_params *params)
-{
-       /* if the FW crashed or not debug monitor cfg was given, there is
-        * no point in stopping
-        */
-       if (test_bit(STATUS_FW_ERROR, &trans->status) ||
-           (!trans->dbg.dest_tlv &&
-            trans->dbg.ini_dest == IWL_FW_INI_LOCATION_INVALID))
-               return;
-
-       if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560) {
-               IWL_ERR(trans,
-                       "WRT: unsupported device family %d for debug stop recording\n",
-                       trans->cfg->device_family);
-               return;
-       }
-       _iwl_fw_dbg_stop_recording(trans, params);
-}
-
-static inline void
-_iwl_fw_dbg_restart_recording(struct iwl_trans *trans,
-                             struct iwl_fw_dbg_params *params)
-{
-       if (WARN_ON(!params))
-               return;
-
-       if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) {
-               iwl_clear_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x100);
-               iwl_clear_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x1);
-               iwl_set_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x1);
-       } else {
-               iwl_write_umac_prph(trans, DBGC_IN_SAMPLE, params->in_sample);
-               iwl_write_umac_prph(trans, DBGC_OUT_CTRL, params->out_ctrl);
-       }
-}
+void iwl_fw_dbg_restart_recording(struct iwl_fw_runtime *fwrt,
+                                 struct iwl_fw_dbg_params *params);
 
 #ifdef CONFIG_IWLWIFI_DEBUGFS
 static inline void iwl_fw_set_dbg_rec_on(struct iwl_fw_runtime *fwrt)
@@ -336,30 +279,6 @@ static inline void iwl_fw_set_dbg_rec_on(struct iwl_fw_runtime *fwrt)
 }
 #endif
 
-static inline void
-iwl_fw_dbg_restart_recording(struct iwl_fw_runtime *fwrt,
-                            struct iwl_fw_dbg_params *params)
-{
-       /* if the FW crashed or not debug monitor cfg was given, there is
-        * no point in restarting
-        */
-       if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status) ||
-           (!fwrt->trans->dbg.dest_tlv &&
-            fwrt->trans->dbg.ini_dest == IWL_FW_INI_LOCATION_INVALID))
-               return;
-
-       if (fwrt->trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560) {
-               IWL_ERR(fwrt,
-                       "WRT: unsupported device family %d for debug restart recording\n",
-                       fwrt->trans->cfg->device_family);
-               return;
-       }
-       _iwl_fw_dbg_restart_recording(fwrt->trans, params);
-#ifdef CONFIG_IWLWIFI_DEBUGFS
-       iwl_fw_set_dbg_rec_on(fwrt);
-#endif
-}
-
 static inline void iwl_fw_dump_conf_clear(struct iwl_fw_runtime *fwrt)
 {
        fwrt->dump.conf = FW_DBG_INVALID;