diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2014-06-25 07:08:58 -0400 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2014-07-06 04:16:15 -0400 |
commit | 655e6d6db21b0c0d411aef9d816816fb68b0496c (patch) | |
tree | e6bced23090bf8024e930cf4789a63f52a53c0a5 /drivers/net/wireless/iwlwifi/mvm/mac80211.c | |
parent | 78dae98fab85f4cd2d38cfc3474dea6e87e7b53a (diff) |
iwlwifi: mvm: kill iwl_mvm_fw_error_rxf_dump
Its content can move to the caller.
While at it, move iwl_mvm_fw_error_rxf_dump to caller.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/mac80211.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/mac80211.c | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 9feca4a6bacf..9661a526ed51 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -80,6 +80,8 @@ | |||
80 | #include "fw-api-scan.h" | 80 | #include "fw-api-scan.h" |
81 | #include "iwl-phy-db.h" | 81 | #include "iwl-phy-db.h" |
82 | #include "testmode.h" | 82 | #include "testmode.h" |
83 | #include "iwl-fw-error-dump.h" | ||
84 | #include "iwl-prph.h" | ||
83 | 85 | ||
84 | static const struct ieee80211_iface_limit iwl_mvm_limits[] = { | 86 | static const struct ieee80211_iface_limit iwl_mvm_limits[] = { |
85 | { | 87 | { |
@@ -645,6 +647,104 @@ static void iwl_mvm_cleanup_iterator(void *data, u8 *mac, | |||
645 | mvmvif->phy_ctxt = NULL; | 647 | mvmvif->phy_ctxt = NULL; |
646 | } | 648 | } |
647 | 649 | ||
650 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
651 | static void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm) | ||
652 | { | ||
653 | struct iwl_fw_error_dump_file *dump_file; | ||
654 | struct iwl_fw_error_dump_data *dump_data; | ||
655 | struct iwl_fw_error_dump_info *dump_info; | ||
656 | const struct fw_img *img; | ||
657 | u32 sram_len, sram_ofs; | ||
658 | u32 file_len, rxf_len; | ||
659 | unsigned long flags; | ||
660 | u32 trans_len; | ||
661 | int reg_val; | ||
662 | |||
663 | lockdep_assert_held(&mvm->mutex); | ||
664 | |||
665 | if (mvm->fw_error_dump) | ||
666 | return; | ||
667 | |||
668 | img = &mvm->fw->img[mvm->cur_ucode]; | ||
669 | sram_ofs = img->sec[IWL_UCODE_SECTION_DATA].offset; | ||
670 | sram_len = img->sec[IWL_UCODE_SECTION_DATA].len; | ||
671 | |||
672 | /* reading buffer size */ | ||
673 | reg_val = iwl_trans_read_prph(mvm->trans, RXF_SIZE_ADDR); | ||
674 | rxf_len = (reg_val & RXF_SIZE_BYTE_CNT_MSK) >> RXF_SIZE_BYTE_CND_POS; | ||
675 | |||
676 | /* the register holds the value divided by 128 */ | ||
677 | rxf_len = rxf_len << 7; | ||
678 | |||
679 | file_len = sizeof(*dump_file) + | ||
680 | sizeof(*dump_data) * 3 + | ||
681 | sram_len + | ||
682 | rxf_len + | ||
683 | sizeof(*dump_info); | ||
684 | |||
685 | trans_len = iwl_trans_dump_data(mvm->trans, NULL, 0); | ||
686 | if (trans_len) | ||
687 | file_len += trans_len; | ||
688 | |||
689 | dump_file = vmalloc(file_len); | ||
690 | if (!dump_file) | ||
691 | return; | ||
692 | |||
693 | mvm->fw_error_dump = dump_file; | ||
694 | |||
695 | dump_file->barker = cpu_to_le32(IWL_FW_ERROR_DUMP_BARKER); | ||
696 | dump_file->file_len = cpu_to_le32(file_len); | ||
697 | dump_data = (void *)dump_file->data; | ||
698 | |||
699 | dump_data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_DEV_FW_INFO); | ||
700 | dump_data->len = cpu_to_le32(sizeof(*dump_info)); | ||
701 | dump_info = (void *) dump_data->data; | ||
702 | dump_info->device_family = | ||
703 | mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000 ? | ||
704 | cpu_to_le32(IWL_FW_ERROR_DUMP_FAMILY_7) : | ||
705 | cpu_to_le32(IWL_FW_ERROR_DUMP_FAMILY_8); | ||
706 | memcpy(dump_info->fw_human_readable, mvm->fw->human_readable, | ||
707 | sizeof(dump_info->fw_human_readable)); | ||
708 | strncpy(dump_info->dev_human_readable, mvm->cfg->name, | ||
709 | sizeof(dump_info->dev_human_readable)); | ||
710 | strncpy(dump_info->bus_human_readable, mvm->dev->bus->name, | ||
711 | sizeof(dump_info->bus_human_readable)); | ||
712 | |||
713 | dump_data = iwl_fw_error_next_data(dump_data); | ||
714 | dump_data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_RXF); | ||
715 | dump_data->len = cpu_to_le32(rxf_len); | ||
716 | |||
717 | if (iwl_trans_grab_nic_access(mvm->trans, false, &flags)) { | ||
718 | u32 *rxf = (void *)dump_data->data; | ||
719 | int i; | ||
720 | |||
721 | for (i = 0; i < (rxf_len / sizeof(u32)); i++) { | ||
722 | iwl_trans_write_prph(mvm->trans, | ||
723 | RXF_LD_FENCE_OFFSET_ADDR, | ||
724 | i * sizeof(u32)); | ||
725 | rxf[i] = iwl_trans_read_prph(mvm->trans, | ||
726 | RXF_FIFO_RD_FENCE_ADDR); | ||
727 | } | ||
728 | iwl_trans_release_nic_access(mvm->trans, &flags); | ||
729 | } | ||
730 | |||
731 | dump_data = iwl_fw_error_next_data(dump_data); | ||
732 | dump_data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_SRAM); | ||
733 | dump_data->len = cpu_to_le32(sram_len); | ||
734 | iwl_trans_read_mem_bytes(mvm->trans, sram_ofs, dump_data->data, | ||
735 | sram_len); | ||
736 | |||
737 | if (trans_len) { | ||
738 | void *buf = iwl_fw_error_next_data(dump_data); | ||
739 | u32 real_trans_len = iwl_trans_dump_data(mvm->trans, buf, | ||
740 | trans_len); | ||
741 | dump_data = (void *)((u8 *)buf + real_trans_len); | ||
742 | dump_file->file_len = | ||
743 | cpu_to_le32(file_len - trans_len + real_trans_len); | ||
744 | } | ||
745 | } | ||
746 | #endif | ||
747 | |||
648 | static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) | 748 | static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) |
649 | { | 749 | { |
650 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 750 | #ifdef CONFIG_IWLWIFI_DEBUGFS |