diff options
author | Sara Sharon <sara.sharon@intel.com> | 2016-03-07 09:55:20 -0500 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2016-03-30 09:21:27 -0400 |
commit | 97f95c93c8ed5177371e75275f236513152fa308 (patch) | |
tree | 1bccd1fe9435b8b24354e2fa0cd114dff4ca6b41 | |
parent | a0b09f13036cedfd67c9cb4b9d05138e7022723d (diff) |
iwlwifi: remove support for fw older than -16.ucode
API version lower than 16 is not supported anymore - don't
load older ucode.
Remove code handling older versions.
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/iwl-7000.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/iwl-8000.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/iwl-9000.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/Makefile | 2 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/coex.c | 42 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/coex_legacy.c | 1315 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 164 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 16 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/sf.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/utils.c | 86 |
12 files changed, 41 insertions, 1621 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-7000.c b/drivers/net/wireless/intel/iwlwifi/iwl-7000.c index fc475ce59b47..f4012a3f4d06 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-7000.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-7000.c | |||
@@ -77,15 +77,15 @@ | |||
77 | #define IWL3168_UCODE_API_MAX 21 | 77 | #define IWL3168_UCODE_API_MAX 21 |
78 | 78 | ||
79 | /* Oldest version we won't warn about */ | 79 | /* Oldest version we won't warn about */ |
80 | #define IWL7260_UCODE_API_OK 13 | 80 | #define IWL7260_UCODE_API_OK 16 |
81 | #define IWL7265_UCODE_API_OK 13 | 81 | #define IWL7265_UCODE_API_OK 16 |
82 | #define IWL7265D_UCODE_API_OK 13 | 82 | #define IWL7265D_UCODE_API_OK 16 |
83 | #define IWL3168_UCODE_API_OK 20 | 83 | #define IWL3168_UCODE_API_OK 20 |
84 | 84 | ||
85 | /* Lowest firmware API version supported */ | 85 | /* Lowest firmware API version supported */ |
86 | #define IWL7260_UCODE_API_MIN 13 | 86 | #define IWL7260_UCODE_API_MIN 16 |
87 | #define IWL7265_UCODE_API_MIN 13 | 87 | #define IWL7265_UCODE_API_MIN 16 |
88 | #define IWL7265D_UCODE_API_MIN 13 | 88 | #define IWL7265D_UCODE_API_MIN 16 |
89 | #define IWL3168_UCODE_API_MIN 20 | 89 | #define IWL3168_UCODE_API_MIN 20 |
90 | 90 | ||
91 | /* NVM versions */ | 91 | /* NVM versions */ |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c index 97be104d1203..49bb2a5f9dcf 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c | |||
@@ -74,11 +74,11 @@ | |||
74 | #define IWL8265_UCODE_API_MAX 21 | 74 | #define IWL8265_UCODE_API_MAX 21 |
75 | 75 | ||
76 | /* Oldest version we won't warn about */ | 76 | /* Oldest version we won't warn about */ |
77 | #define IWL8000_UCODE_API_OK 13 | 77 | #define IWL8000_UCODE_API_OK 16 |
78 | #define IWL8265_UCODE_API_OK 20 | 78 | #define IWL8265_UCODE_API_OK 20 |
79 | 79 | ||
80 | /* Lowest firmware API version supported */ | 80 | /* Lowest firmware API version supported */ |
81 | #define IWL8000_UCODE_API_MIN 13 | 81 | #define IWL8000_UCODE_API_MIN 16 |
82 | #define IWL8265_UCODE_API_MIN 20 | 82 | #define IWL8265_UCODE_API_MIN 20 |
83 | 83 | ||
84 | /* NVM versions */ | 84 | /* NVM versions */ |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-9000.c b/drivers/net/wireless/intel/iwlwifi/iwl-9000.c index 642fc92d7788..277396a30713 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-9000.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-9000.c | |||
@@ -58,10 +58,10 @@ | |||
58 | #define IWL9000_UCODE_API_MAX 21 | 58 | #define IWL9000_UCODE_API_MAX 21 |
59 | 59 | ||
60 | /* Oldest version we won't warn about */ | 60 | /* Oldest version we won't warn about */ |
61 | #define IWL9000_UCODE_API_OK 13 | 61 | #define IWL9000_UCODE_API_OK 16 |
62 | 62 | ||
63 | /* Lowest firmware API version supported */ | 63 | /* Lowest firmware API version supported */ |
64 | #define IWL9000_UCODE_API_MIN 13 | 64 | #define IWL9000_UCODE_API_MIN 16 |
65 | 65 | ||
66 | /* NVM versions */ | 66 | /* NVM versions */ |
67 | #define IWL9000_NVM_VERSION 0x0a1d | 67 | #define IWL9000_NVM_VERSION 0x0a1d |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c index 7cd17f0e45e8..9a680ac48820 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c | |||
@@ -1255,10 +1255,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) | |||
1255 | if (err) | 1255 | if (err) |
1256 | goto try_again; | 1256 | goto try_again; |
1257 | 1257 | ||
1258 | if (fw_has_api(&drv->fw.ucode_capa, IWL_UCODE_TLV_API_NEW_VERSION)) | 1258 | api_ver = drv->fw.ucode_ver; |
1259 | api_ver = drv->fw.ucode_ver; | ||
1260 | else | ||
1261 | api_ver = IWL_UCODE_API(drv->fw.ucode_ver); | ||
1262 | 1259 | ||
1263 | /* | 1260 | /* |
1264 | * api_ver should match the api version forming part of the | 1261 | * api_ver should match the api version forming part of the |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h index c82b94167ac6..a6e8826c61db 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h | |||
@@ -245,13 +245,11 @@ typedef unsigned int __bitwise__ iwl_ucode_tlv_api_t; | |||
245 | 245 | ||
246 | /** | 246 | /** |
247 | * enum iwl_ucode_tlv_api - ucode api | 247 | * enum iwl_ucode_tlv_api - ucode api |
248 | * @IWL_UCODE_TLV_API_BT_COEX_SPLIT: new API for BT Coex | ||
249 | * @IWL_UCODE_TLV_API_FRAGMENTED_SCAN: This ucode supports active dwell time | 248 | * @IWL_UCODE_TLV_API_FRAGMENTED_SCAN: This ucode supports active dwell time |
250 | * longer than the passive one, which is essential for fragmented scan. | 249 | * longer than the passive one, which is essential for fragmented scan. |
251 | * @IWL_UCODE_TLV_API_WIFI_MCC_UPDATE: ucode supports MCC updates with source. | 250 | * @IWL_UCODE_TLV_API_WIFI_MCC_UPDATE: ucode supports MCC updates with source. |
252 | * @IWL_UCODE_TLV_API_WIDE_CMD_HDR: ucode supports wide command header | 251 | * @IWL_UCODE_TLV_API_WIDE_CMD_HDR: ucode supports wide command header |
253 | * @IWL_UCODE_TLV_API_LQ_SS_PARAMS: Configure STBC/BFER via LQ CMD ss_params | 252 | * @IWL_UCODE_TLV_API_LQ_SS_PARAMS: Configure STBC/BFER via LQ CMD ss_params |
254 | * @IWL_UCODE_TLV_API_NEW_VERSION: new versioning format | ||
255 | * @IWL_UCODE_TLV_API_EXT_SCAN_PRIORITY: scan APIs use 8-level priority | 253 | * @IWL_UCODE_TLV_API_EXT_SCAN_PRIORITY: scan APIs use 8-level priority |
256 | * instead of 3. | 254 | * instead of 3. |
257 | * @IWL_UCODE_TLV_API_TX_POWER_CHAIN: TX power API has larger command size | 255 | * @IWL_UCODE_TLV_API_TX_POWER_CHAIN: TX power API has larger command size |
@@ -260,12 +258,10 @@ typedef unsigned int __bitwise__ iwl_ucode_tlv_api_t; | |||
260 | * @NUM_IWL_UCODE_TLV_API: number of bits used | 258 | * @NUM_IWL_UCODE_TLV_API: number of bits used |
261 | */ | 259 | */ |
262 | enum iwl_ucode_tlv_api { | 260 | enum iwl_ucode_tlv_api { |
263 | IWL_UCODE_TLV_API_BT_COEX_SPLIT = (__force iwl_ucode_tlv_api_t)3, | ||
264 | IWL_UCODE_TLV_API_FRAGMENTED_SCAN = (__force iwl_ucode_tlv_api_t)8, | 261 | IWL_UCODE_TLV_API_FRAGMENTED_SCAN = (__force iwl_ucode_tlv_api_t)8, |
265 | IWL_UCODE_TLV_API_WIFI_MCC_UPDATE = (__force iwl_ucode_tlv_api_t)9, | 262 | IWL_UCODE_TLV_API_WIFI_MCC_UPDATE = (__force iwl_ucode_tlv_api_t)9, |
266 | IWL_UCODE_TLV_API_WIDE_CMD_HDR = (__force iwl_ucode_tlv_api_t)14, | 263 | IWL_UCODE_TLV_API_WIDE_CMD_HDR = (__force iwl_ucode_tlv_api_t)14, |
267 | IWL_UCODE_TLV_API_LQ_SS_PARAMS = (__force iwl_ucode_tlv_api_t)18, | 264 | IWL_UCODE_TLV_API_LQ_SS_PARAMS = (__force iwl_ucode_tlv_api_t)18, |
268 | IWL_UCODE_TLV_API_NEW_VERSION = (__force iwl_ucode_tlv_api_t)20, | ||
269 | IWL_UCODE_TLV_API_EXT_SCAN_PRIORITY = (__force iwl_ucode_tlv_api_t)24, | 265 | IWL_UCODE_TLV_API_EXT_SCAN_PRIORITY = (__force iwl_ucode_tlv_api_t)24, |
270 | IWL_UCODE_TLV_API_TX_POWER_CHAIN = (__force iwl_ucode_tlv_api_t)27, | 266 | IWL_UCODE_TLV_API_TX_POWER_CHAIN = (__force iwl_ucode_tlv_api_t)27, |
271 | 267 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/Makefile b/drivers/net/wireless/intel/iwlwifi/mvm/Makefile index 23e7e2937566..2e06dfc1c477 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/Makefile +++ b/drivers/net/wireless/intel/iwlwifi/mvm/Makefile | |||
@@ -2,7 +2,7 @@ obj-$(CONFIG_IWLMVM) += iwlmvm.o | |||
2 | iwlmvm-y += fw.o mac80211.o nvm.o ops.o phy-ctxt.o mac-ctxt.o | 2 | iwlmvm-y += fw.o mac80211.o nvm.o ops.o phy-ctxt.o mac-ctxt.o |
3 | iwlmvm-y += utils.o rx.o rxmq.o tx.o binding.o quota.o sta.o sf.o | 3 | iwlmvm-y += utils.o rx.o rxmq.o tx.o binding.o quota.o sta.o sf.o |
4 | iwlmvm-y += scan.o time-event.o rs.o | 4 | iwlmvm-y += scan.o time-event.o rs.o |
5 | iwlmvm-y += power.o coex.o coex_legacy.o | 5 | iwlmvm-y += power.o coex.o |
6 | iwlmvm-y += tt.o offloading.o tdls.o | 6 | iwlmvm-y += tt.o offloading.o tdls.o |
7 | iwlmvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o debugfs-vif.o | 7 | iwlmvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o debugfs-vif.o |
8 | iwlmvm-$(CONFIG_IWLWIFI_LEDS) += led.o | 8 | iwlmvm-$(CONFIG_IWLWIFI_LEDS) += led.o |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/coex.c b/drivers/net/wireless/intel/iwlwifi/mvm/coex.c index 2e098f8e0f83..35cdeca3d61e 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/coex.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/coex.c | |||
@@ -411,9 +411,6 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm) | |||
411 | struct iwl_bt_coex_cmd bt_cmd = {}; | 411 | struct iwl_bt_coex_cmd bt_cmd = {}; |
412 | u32 mode; | 412 | u32 mode; |
413 | 413 | ||
414 | if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BT_COEX_SPLIT)) | ||
415 | return iwl_send_bt_init_conf_old(mvm); | ||
416 | |||
417 | lockdep_assert_held(&mvm->mutex); | 414 | lockdep_assert_held(&mvm->mutex); |
418 | 415 | ||
419 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) { | 416 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) { |
@@ -728,12 +725,6 @@ void iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, | |||
728 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | 725 | struct iwl_rx_packet *pkt = rxb_addr(rxb); |
729 | struct iwl_bt_coex_profile_notif *notif = (void *)pkt->data; | 726 | struct iwl_bt_coex_profile_notif *notif = (void *)pkt->data; |
730 | 727 | ||
731 | if (!fw_has_api(&mvm->fw->ucode_capa, | ||
732 | IWL_UCODE_TLV_API_BT_COEX_SPLIT)) { | ||
733 | iwl_mvm_rx_bt_coex_notif_old(mvm, rxb); | ||
734 | return; | ||
735 | } | ||
736 | |||
737 | IWL_DEBUG_COEX(mvm, "BT Coex Notification received\n"); | 728 | IWL_DEBUG_COEX(mvm, "BT Coex Notification received\n"); |
738 | IWL_DEBUG_COEX(mvm, "\tBT ci compliance %d\n", notif->bt_ci_compliance); | 729 | IWL_DEBUG_COEX(mvm, "\tBT ci compliance %d\n", notif->bt_ci_compliance); |
739 | IWL_DEBUG_COEX(mvm, "\tBT primary_ch_lut %d\n", | 730 | IWL_DEBUG_COEX(mvm, "\tBT primary_ch_lut %d\n", |
@@ -755,12 +746,6 @@ void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
755 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 746 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
756 | int ret; | 747 | int ret; |
757 | 748 | ||
758 | if (!fw_has_api(&mvm->fw->ucode_capa, | ||
759 | IWL_UCODE_TLV_API_BT_COEX_SPLIT)) { | ||
760 | iwl_mvm_bt_rssi_event_old(mvm, vif, rssi_event); | ||
761 | return; | ||
762 | } | ||
763 | |||
764 | lockdep_assert_held(&mvm->mutex); | 749 | lockdep_assert_held(&mvm->mutex); |
765 | 750 | ||
766 | /* Ignore updates if we are in force mode */ | 751 | /* Ignore updates if we are in force mode */ |
@@ -807,9 +792,6 @@ u16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm, | |||
807 | struct iwl_mvm_phy_ctxt *phy_ctxt = mvmvif->phy_ctxt; | 792 | struct iwl_mvm_phy_ctxt *phy_ctxt = mvmvif->phy_ctxt; |
808 | enum iwl_bt_coex_lut_type lut_type; | 793 | enum iwl_bt_coex_lut_type lut_type; |
809 | 794 | ||
810 | if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BT_COEX_SPLIT)) | ||
811 | return iwl_mvm_coex_agg_time_limit_old(mvm, sta); | ||
812 | |||
813 | if (IWL_COEX_IS_TTC_ON(mvm->last_bt_notif.ttc_rrc_status, phy_ctxt->id)) | 795 | if (IWL_COEX_IS_TTC_ON(mvm->last_bt_notif.ttc_rrc_status, phy_ctxt->id)) |
814 | return LINK_QUAL_AGG_TIME_LIMIT_DEF; | 796 | return LINK_QUAL_AGG_TIME_LIMIT_DEF; |
815 | 797 | ||
@@ -834,9 +816,6 @@ bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm, | |||
834 | struct iwl_mvm_phy_ctxt *phy_ctxt = mvmvif->phy_ctxt; | 816 | struct iwl_mvm_phy_ctxt *phy_ctxt = mvmvif->phy_ctxt; |
835 | enum iwl_bt_coex_lut_type lut_type; | 817 | enum iwl_bt_coex_lut_type lut_type; |
836 | 818 | ||
837 | if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BT_COEX_SPLIT)) | ||
838 | return iwl_mvm_bt_coex_is_mimo_allowed_old(mvm, sta); | ||
839 | |||
840 | if (IWL_COEX_IS_TTC_ON(mvm->last_bt_notif.ttc_rrc_status, phy_ctxt->id)) | 819 | if (IWL_COEX_IS_TTC_ON(mvm->last_bt_notif.ttc_rrc_status, phy_ctxt->id)) |
841 | return true; | 820 | return true; |
842 | 821 | ||
@@ -864,9 +843,6 @@ bool iwl_mvm_bt_coex_is_ant_avail(struct iwl_mvm *mvm, u8 ant) | |||
864 | if (ant & mvm->cfg->non_shared_ant) | 843 | if (ant & mvm->cfg->non_shared_ant) |
865 | return true; | 844 | return true; |
866 | 845 | ||
867 | if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BT_COEX_SPLIT)) | ||
868 | return iwl_mvm_bt_coex_is_shared_ant_avail_old(mvm); | ||
869 | |||
870 | return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < | 846 | return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < |
871 | BT_HIGH_TRAFFIC; | 847 | BT_HIGH_TRAFFIC; |
872 | } | 848 | } |
@@ -877,9 +853,6 @@ bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm) | |||
877 | if (mvm->cfg->bt_shared_single_ant) | 853 | if (mvm->cfg->bt_shared_single_ant) |
878 | return true; | 854 | return true; |
879 | 855 | ||
880 | if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BT_COEX_SPLIT)) | ||
881 | return iwl_mvm_bt_coex_is_shared_ant_avail_old(mvm); | ||
882 | |||
883 | return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < BT_HIGH_TRAFFIC; | 856 | return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < BT_HIGH_TRAFFIC; |
884 | } | 857 | } |
885 | 858 | ||
@@ -888,9 +861,6 @@ bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm, | |||
888 | { | 861 | { |
889 | u32 bt_activity = le32_to_cpu(mvm->last_bt_notif.bt_activity_grading); | 862 | u32 bt_activity = le32_to_cpu(mvm->last_bt_notif.bt_activity_grading); |
890 | 863 | ||
891 | if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BT_COEX_SPLIT)) | ||
892 | return iwl_mvm_bt_coex_is_tpc_allowed_old(mvm, band); | ||
893 | |||
894 | if (band != IEEE80211_BAND_2GHZ) | 864 | if (band != IEEE80211_BAND_2GHZ) |
895 | return false; | 865 | return false; |
896 | 866 | ||
@@ -937,12 +907,6 @@ u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, | |||
937 | 907 | ||
938 | void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm) | 908 | void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm) |
939 | { | 909 | { |
940 | if (!fw_has_api(&mvm->fw->ucode_capa, | ||
941 | IWL_UCODE_TLV_API_BT_COEX_SPLIT)) { | ||
942 | iwl_mvm_bt_coex_vif_change_old(mvm); | ||
943 | return; | ||
944 | } | ||
945 | |||
946 | iwl_mvm_bt_coex_notif_handle(mvm); | 910 | iwl_mvm_bt_coex_notif_handle(mvm); |
947 | } | 911 | } |
948 | 912 | ||
@@ -955,12 +919,6 @@ void iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm, | |||
955 | u8 __maybe_unused lower_bound, upper_bound; | 919 | u8 __maybe_unused lower_bound, upper_bound; |
956 | u8 lut; | 920 | u8 lut; |
957 | 921 | ||
958 | if (!fw_has_api(&mvm->fw->ucode_capa, | ||
959 | IWL_UCODE_TLV_API_BT_COEX_SPLIT)) { | ||
960 | iwl_mvm_rx_ant_coupling_notif_old(mvm, rxb); | ||
961 | return; | ||
962 | } | ||
963 | |||
964 | if (!iwl_mvm_bt_is_plcr_supported(mvm)) | 922 | if (!iwl_mvm_bt_is_plcr_supported(mvm)) |
965 | return; | 923 | return; |
966 | 924 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/coex_legacy.c b/drivers/net/wireless/intel/iwlwifi/mvm/coex_legacy.c deleted file mode 100644 index 015045733444..000000000000 --- a/drivers/net/wireless/intel/iwlwifi/mvm/coex_legacy.c +++ /dev/null | |||
@@ -1,1315 +0,0 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
4 | * redistributing this file, you may do so under either license. | ||
5 | * | ||
6 | * GPL LICENSE SUMMARY | ||
7 | * | ||
8 | * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved. | ||
9 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of version 2 of the GNU General Public License as | ||
13 | * published by the Free Software Foundation. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, but | ||
16 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
18 | * General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, | ||
23 | * USA | ||
24 | * | ||
25 | * The full GNU General Public License is included in this distribution | ||
26 | * in the file called COPYING. | ||
27 | * | ||
28 | * Contact Information: | ||
29 | * Intel Linux Wireless <linuxwifi@intel.com> | ||
30 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
31 | * | ||
32 | * BSD LICENSE | ||
33 | * | ||
34 | * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved. | ||
35 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH | ||
36 | * All rights reserved. | ||
37 | * | ||
38 | * Redistribution and use in source and binary forms, with or without | ||
39 | * modification, are permitted provided that the following conditions | ||
40 | * are met: | ||
41 | * | ||
42 | * * Redistributions of source code must retain the above copyright | ||
43 | * notice, this list of conditions and the following disclaimer. | ||
44 | * * Redistributions in binary form must reproduce the above copyright | ||
45 | * notice, this list of conditions and the following disclaimer in | ||
46 | * the documentation and/or other materials provided with the | ||
47 | * distribution. | ||
48 | * * Neither the name Intel Corporation nor the names of its | ||
49 | * contributors may be used to endorse or promote products derived | ||
50 | * from this software without specific prior written permission. | ||
51 | * | ||
52 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
53 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
54 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
55 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
56 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
57 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
58 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
59 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
60 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
61 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
62 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
63 | * | ||
64 | *****************************************************************************/ | ||
65 | |||
66 | #include <linux/ieee80211.h> | ||
67 | #include <linux/etherdevice.h> | ||
68 | #include <net/mac80211.h> | ||
69 | |||
70 | #include "fw-api-coex.h" | ||
71 | #include "iwl-modparams.h" | ||
72 | #include "mvm.h" | ||
73 | #include "iwl-debug.h" | ||
74 | |||
75 | #define EVENT_PRIO_ANT(_evt, _prio, _shrd_ant) \ | ||
76 | [(_evt)] = (((_prio) << BT_COEX_PRIO_TBL_PRIO_POS) | \ | ||
77 | ((_shrd_ant) << BT_COEX_PRIO_TBL_SHRD_ANT_POS)) | ||
78 | |||
79 | static const u8 iwl_bt_prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX] = { | ||
80 | EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_INIT_CALIB1, | ||
81 | BT_COEX_PRIO_TBL_PRIO_BYPASS, 0), | ||
82 | EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_INIT_CALIB2, | ||
83 | BT_COEX_PRIO_TBL_PRIO_BYPASS, 1), | ||
84 | EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW1, | ||
85 | BT_COEX_PRIO_TBL_PRIO_LOW, 0), | ||
86 | EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW2, | ||
87 | BT_COEX_PRIO_TBL_PRIO_LOW, 1), | ||
88 | EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH1, | ||
89 | BT_COEX_PRIO_TBL_PRIO_HIGH, 0), | ||
90 | EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH2, | ||
91 | BT_COEX_PRIO_TBL_PRIO_HIGH, 1), | ||
92 | EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_DTIM, | ||
93 | BT_COEX_PRIO_TBL_DISABLED, 0), | ||
94 | EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_SCAN52, | ||
95 | BT_COEX_PRIO_TBL_PRIO_COEX_OFF, 0), | ||
96 | EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_SCAN24, | ||
97 | BT_COEX_PRIO_TBL_PRIO_COEX_ON, 0), | ||
98 | EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_IDLE, | ||
99 | BT_COEX_PRIO_TBL_PRIO_COEX_IDLE, 0), | ||
100 | 0, 0, 0, 0, 0, 0, | ||
101 | }; | ||
102 | |||
103 | #undef EVENT_PRIO_ANT | ||
104 | |||
105 | static int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm) | ||
106 | { | ||
107 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) | ||
108 | return 0; | ||
109 | |||
110 | return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_PRIO_TABLE, 0, | ||
111 | sizeof(struct iwl_bt_coex_prio_tbl_cmd), | ||
112 | &iwl_bt_prio_tbl); | ||
113 | } | ||
114 | |||
115 | static const __le32 iwl_bt_prio_boost[BT_COEX_BOOST_SIZE] = { | ||
116 | cpu_to_le32(0xf0f0f0f0), /* 50% */ | ||
117 | cpu_to_le32(0xc0c0c0c0), /* 25% */ | ||
118 | cpu_to_le32(0xfcfcfcfc), /* 75% */ | ||
119 | cpu_to_le32(0xfefefefe), /* 87.5% */ | ||
120 | }; | ||
121 | |||
122 | static const __le32 iwl_single_shared_ant[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE] = { | ||
123 | { | ||
124 | cpu_to_le32(0x40000000), | ||
125 | cpu_to_le32(0x00000000), | ||
126 | cpu_to_le32(0x44000000), | ||
127 | cpu_to_le32(0x00000000), | ||
128 | cpu_to_le32(0x40000000), | ||
129 | cpu_to_le32(0x00000000), | ||
130 | cpu_to_le32(0x44000000), | ||
131 | cpu_to_le32(0x00000000), | ||
132 | cpu_to_le32(0xc0004000), | ||
133 | cpu_to_le32(0xf0005000), | ||
134 | cpu_to_le32(0xc0004000), | ||
135 | cpu_to_le32(0xf0005000), | ||
136 | }, | ||
137 | { | ||
138 | cpu_to_le32(0x40000000), | ||
139 | cpu_to_le32(0x00000000), | ||
140 | cpu_to_le32(0x44000000), | ||
141 | cpu_to_le32(0x00000000), | ||
142 | cpu_to_le32(0x40000000), | ||
143 | cpu_to_le32(0x00000000), | ||
144 | cpu_to_le32(0x44000000), | ||
145 | cpu_to_le32(0x00000000), | ||
146 | cpu_to_le32(0xc0004000), | ||
147 | cpu_to_le32(0xf0005000), | ||
148 | cpu_to_le32(0xc0004000), | ||
149 | cpu_to_le32(0xf0005000), | ||
150 | }, | ||
151 | { | ||
152 | cpu_to_le32(0x40000000), | ||
153 | cpu_to_le32(0x00000000), | ||
154 | cpu_to_le32(0x44000000), | ||
155 | cpu_to_le32(0x00000000), | ||
156 | cpu_to_le32(0x40000000), | ||
157 | cpu_to_le32(0x00000000), | ||
158 | cpu_to_le32(0x44000000), | ||
159 | cpu_to_le32(0x00000000), | ||
160 | cpu_to_le32(0xc0004000), | ||
161 | cpu_to_le32(0xf0005000), | ||
162 | cpu_to_le32(0xc0004000), | ||
163 | cpu_to_le32(0xf0005000), | ||
164 | }, | ||
165 | }; | ||
166 | |||
167 | static const __le32 iwl_combined_lookup[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE] = { | ||
168 | { | ||
169 | /* Tight */ | ||
170 | cpu_to_le32(0xaaaaaaaa), | ||
171 | cpu_to_le32(0xaaaaaaaa), | ||
172 | cpu_to_le32(0xaeaaaaaa), | ||
173 | cpu_to_le32(0xaaaaaaaa), | ||
174 | cpu_to_le32(0xcc00ff28), | ||
175 | cpu_to_le32(0x0000aaaa), | ||
176 | cpu_to_le32(0xcc00aaaa), | ||
177 | cpu_to_le32(0x0000aaaa), | ||
178 | cpu_to_le32(0xc0004000), | ||
179 | cpu_to_le32(0x00004000), | ||
180 | cpu_to_le32(0xf0005000), | ||
181 | cpu_to_le32(0xf0005000), | ||
182 | }, | ||
183 | { | ||
184 | /* Loose */ | ||
185 | cpu_to_le32(0xaaaaaaaa), | ||
186 | cpu_to_le32(0xaaaaaaaa), | ||
187 | cpu_to_le32(0xaaaaaaaa), | ||
188 | cpu_to_le32(0xaaaaaaaa), | ||
189 | cpu_to_le32(0xcc00ff28), | ||
190 | cpu_to_le32(0x0000aaaa), | ||
191 | cpu_to_le32(0xcc00aaaa), | ||
192 | cpu_to_le32(0x0000aaaa), | ||
193 | cpu_to_le32(0x00000000), | ||
194 | cpu_to_le32(0x00000000), | ||
195 | cpu_to_le32(0xf0005000), | ||
196 | cpu_to_le32(0xf0005000), | ||
197 | }, | ||
198 | { | ||
199 | /* Tx Tx disabled */ | ||
200 | cpu_to_le32(0xaaaaaaaa), | ||
201 | cpu_to_le32(0xaaaaaaaa), | ||
202 | cpu_to_le32(0xeeaaaaaa), | ||
203 | cpu_to_le32(0xaaaaaaaa), | ||
204 | cpu_to_le32(0xcc00ff28), | ||
205 | cpu_to_le32(0x0000aaaa), | ||
206 | cpu_to_le32(0xcc00aaaa), | ||
207 | cpu_to_le32(0x0000aaaa), | ||
208 | cpu_to_le32(0xc0004000), | ||
209 | cpu_to_le32(0xc0004000), | ||
210 | cpu_to_le32(0xf0005000), | ||
211 | cpu_to_le32(0xf0005000), | ||
212 | }, | ||
213 | }; | ||
214 | |||
215 | /* 20MHz / 40MHz below / 40Mhz above*/ | ||
216 | static const __le64 iwl_ci_mask[][3] = { | ||
217 | /* dummy entry for channel 0 */ | ||
218 | {cpu_to_le64(0), cpu_to_le64(0), cpu_to_le64(0)}, | ||
219 | { | ||
220 | cpu_to_le64(0x0000001FFFULL), | ||
221 | cpu_to_le64(0x0ULL), | ||
222 | cpu_to_le64(0x00007FFFFFULL), | ||
223 | }, | ||
224 | { | ||
225 | cpu_to_le64(0x000000FFFFULL), | ||
226 | cpu_to_le64(0x0ULL), | ||
227 | cpu_to_le64(0x0003FFFFFFULL), | ||
228 | }, | ||
229 | { | ||
230 | cpu_to_le64(0x000003FFFCULL), | ||
231 | cpu_to_le64(0x0ULL), | ||
232 | cpu_to_le64(0x000FFFFFFCULL), | ||
233 | }, | ||
234 | { | ||
235 | cpu_to_le64(0x00001FFFE0ULL), | ||
236 | cpu_to_le64(0x0ULL), | ||
237 | cpu_to_le64(0x007FFFFFE0ULL), | ||
238 | }, | ||
239 | { | ||
240 | cpu_to_le64(0x00007FFF80ULL), | ||
241 | cpu_to_le64(0x00007FFFFFULL), | ||
242 | cpu_to_le64(0x01FFFFFF80ULL), | ||
243 | }, | ||
244 | { | ||
245 | cpu_to_le64(0x0003FFFC00ULL), | ||
246 | cpu_to_le64(0x0003FFFFFFULL), | ||
247 | cpu_to_le64(0x0FFFFFFC00ULL), | ||
248 | }, | ||
249 | { | ||
250 | cpu_to_le64(0x000FFFF000ULL), | ||
251 | cpu_to_le64(0x000FFFFFFCULL), | ||
252 | cpu_to_le64(0x3FFFFFF000ULL), | ||
253 | }, | ||
254 | { | ||
255 | cpu_to_le64(0x007FFF8000ULL), | ||
256 | cpu_to_le64(0x007FFFFFE0ULL), | ||
257 | cpu_to_le64(0xFFFFFF8000ULL), | ||
258 | }, | ||
259 | { | ||
260 | cpu_to_le64(0x01FFFE0000ULL), | ||
261 | cpu_to_le64(0x01FFFFFF80ULL), | ||
262 | cpu_to_le64(0xFFFFFE0000ULL), | ||
263 | }, | ||
264 | { | ||
265 | cpu_to_le64(0x0FFFF00000ULL), | ||
266 | cpu_to_le64(0x0FFFFFFC00ULL), | ||
267 | cpu_to_le64(0x0ULL), | ||
268 | }, | ||
269 | { | ||
270 | cpu_to_le64(0x3FFFC00000ULL), | ||
271 | cpu_to_le64(0x3FFFFFF000ULL), | ||
272 | cpu_to_le64(0x0) | ||
273 | }, | ||
274 | { | ||
275 | cpu_to_le64(0xFFFE000000ULL), | ||
276 | cpu_to_le64(0xFFFFFF8000ULL), | ||
277 | cpu_to_le64(0x0) | ||
278 | }, | ||
279 | { | ||
280 | cpu_to_le64(0xFFF8000000ULL), | ||
281 | cpu_to_le64(0xFFFFFE0000ULL), | ||
282 | cpu_to_le64(0x0) | ||
283 | }, | ||
284 | { | ||
285 | cpu_to_le64(0xFFC0000000ULL), | ||
286 | cpu_to_le64(0x0ULL), | ||
287 | cpu_to_le64(0x0ULL) | ||
288 | }, | ||
289 | }; | ||
290 | |||
291 | enum iwl_bt_kill_msk { | ||
292 | BT_KILL_MSK_DEFAULT, | ||
293 | BT_KILL_MSK_NEVER, | ||
294 | BT_KILL_MSK_ALWAYS, | ||
295 | BT_KILL_MSK_MAX, | ||
296 | }; | ||
297 | |||
298 | static const u32 iwl_bt_ctl_kill_msk[BT_KILL_MSK_MAX] = { | ||
299 | [BT_KILL_MSK_DEFAULT] = 0xfffffc00, | ||
300 | [BT_KILL_MSK_NEVER] = 0xffffffff, | ||
301 | [BT_KILL_MSK_ALWAYS] = 0, | ||
302 | }; | ||
303 | |||
304 | static const u8 iwl_bt_cts_kill_msk[BT_MAX_AG][BT_COEX_MAX_LUT] = { | ||
305 | { | ||
306 | BT_KILL_MSK_ALWAYS, | ||
307 | BT_KILL_MSK_ALWAYS, | ||
308 | BT_KILL_MSK_ALWAYS, | ||
309 | }, | ||
310 | { | ||
311 | BT_KILL_MSK_NEVER, | ||
312 | BT_KILL_MSK_NEVER, | ||
313 | BT_KILL_MSK_NEVER, | ||
314 | }, | ||
315 | { | ||
316 | BT_KILL_MSK_NEVER, | ||
317 | BT_KILL_MSK_NEVER, | ||
318 | BT_KILL_MSK_NEVER, | ||
319 | }, | ||
320 | { | ||
321 | BT_KILL_MSK_DEFAULT, | ||
322 | BT_KILL_MSK_NEVER, | ||
323 | BT_KILL_MSK_DEFAULT, | ||
324 | }, | ||
325 | }; | ||
326 | |||
327 | static const u8 iwl_bt_ack_kill_msk[BT_MAX_AG][BT_COEX_MAX_LUT] = { | ||
328 | { | ||
329 | BT_KILL_MSK_ALWAYS, | ||
330 | BT_KILL_MSK_ALWAYS, | ||
331 | BT_KILL_MSK_ALWAYS, | ||
332 | }, | ||
333 | { | ||
334 | BT_KILL_MSK_ALWAYS, | ||
335 | BT_KILL_MSK_ALWAYS, | ||
336 | BT_KILL_MSK_ALWAYS, | ||
337 | }, | ||
338 | { | ||
339 | BT_KILL_MSK_ALWAYS, | ||
340 | BT_KILL_MSK_ALWAYS, | ||
341 | BT_KILL_MSK_ALWAYS, | ||
342 | }, | ||
343 | { | ||
344 | BT_KILL_MSK_DEFAULT, | ||
345 | BT_KILL_MSK_ALWAYS, | ||
346 | BT_KILL_MSK_DEFAULT, | ||
347 | }, | ||
348 | }; | ||
349 | |||
350 | struct corunning_block_luts { | ||
351 | u8 range; | ||
352 | __le32 lut20[BT_COEX_CORUN_LUT_SIZE]; | ||
353 | }; | ||
354 | |||
355 | /* | ||
356 | * Ranges for the antenna coupling calibration / co-running block LUT: | ||
357 | * LUT0: [ 0, 12[ | ||
358 | * LUT1: [12, 20[ | ||
359 | * LUT2: [20, 21[ | ||
360 | * LUT3: [21, 23[ | ||
361 | * LUT4: [23, 27[ | ||
362 | * LUT5: [27, 30[ | ||
363 | * LUT6: [30, 32[ | ||
364 | * LUT7: [32, 33[ | ||
365 | * LUT8: [33, - [ | ||
366 | */ | ||
367 | static const struct corunning_block_luts antenna_coupling_ranges[] = { | ||
368 | { | ||
369 | .range = 0, | ||
370 | .lut20 = { | ||
371 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
372 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
373 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
374 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
375 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
376 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
377 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
378 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
379 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
380 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
381 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
382 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
383 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
384 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
385 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
386 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
387 | }, | ||
388 | }, | ||
389 | { | ||
390 | .range = 12, | ||
391 | .lut20 = { | ||
392 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
393 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
394 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
395 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
396 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
397 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
398 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
399 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
400 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
401 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
402 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
403 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
404 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
405 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
406 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
407 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
408 | }, | ||
409 | }, | ||
410 | { | ||
411 | .range = 20, | ||
412 | .lut20 = { | ||
413 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
414 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
415 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
416 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
417 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
418 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
419 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
420 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
421 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
422 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
423 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
424 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
425 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
426 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
427 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
428 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
429 | }, | ||
430 | }, | ||
431 | { | ||
432 | .range = 21, | ||
433 | .lut20 = { | ||
434 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
435 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
436 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
437 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
438 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
439 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
440 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
441 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
442 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
443 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
444 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
445 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
446 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
447 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
448 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
449 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
450 | }, | ||
451 | }, | ||
452 | { | ||
453 | .range = 23, | ||
454 | .lut20 = { | ||
455 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
456 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
457 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
458 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
459 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
460 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
461 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
462 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
463 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
464 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
465 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
466 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
467 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
468 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
469 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
470 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
471 | }, | ||
472 | }, | ||
473 | { | ||
474 | .range = 27, | ||
475 | .lut20 = { | ||
476 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
477 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
478 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
479 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
480 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
481 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
482 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
483 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
484 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
485 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
486 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
487 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
488 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
489 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
490 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
491 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
492 | }, | ||
493 | }, | ||
494 | { | ||
495 | .range = 30, | ||
496 | .lut20 = { | ||
497 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
498 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
499 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
500 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
501 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
502 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
503 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
504 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
505 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
506 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
507 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
508 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
509 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
510 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
511 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
512 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
513 | }, | ||
514 | }, | ||
515 | { | ||
516 | .range = 32, | ||
517 | .lut20 = { | ||
518 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
519 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
520 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
521 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
522 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
523 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
524 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
525 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
526 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
527 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
528 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
529 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
530 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
531 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
532 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
533 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
534 | }, | ||
535 | }, | ||
536 | { | ||
537 | .range = 33, | ||
538 | .lut20 = { | ||
539 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
540 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
541 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
542 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
543 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
544 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
545 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
546 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
547 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
548 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
549 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
550 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
551 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
552 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
553 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
554 | cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), | ||
555 | }, | ||
556 | }, | ||
557 | }; | ||
558 | |||
559 | static enum iwl_bt_coex_lut_type | ||
560 | iwl_get_coex_type(struct iwl_mvm *mvm, const struct ieee80211_vif *vif) | ||
561 | { | ||
562 | struct ieee80211_chanctx_conf *chanctx_conf; | ||
563 | enum iwl_bt_coex_lut_type ret; | ||
564 | u16 phy_ctx_id; | ||
565 | |||
566 | /* | ||
567 | * Checking that we hold mvm->mutex is a good idea, but the rate | ||
568 | * control can't acquire the mutex since it runs in Tx path. | ||
569 | * So this is racy in that case, but in the worst case, the AMPDU | ||
570 | * size limit will be wrong for a short time which is not a big | ||
571 | * issue. | ||
572 | */ | ||
573 | |||
574 | rcu_read_lock(); | ||
575 | |||
576 | chanctx_conf = rcu_dereference(vif->chanctx_conf); | ||
577 | |||
578 | if (!chanctx_conf || | ||
579 | chanctx_conf->def.chan->band != IEEE80211_BAND_2GHZ) { | ||
580 | rcu_read_unlock(); | ||
581 | return BT_COEX_INVALID_LUT; | ||
582 | } | ||
583 | |||
584 | ret = BT_COEX_TX_DIS_LUT; | ||
585 | |||
586 | if (mvm->cfg->bt_shared_single_ant) { | ||
587 | rcu_read_unlock(); | ||
588 | return ret; | ||
589 | } | ||
590 | |||
591 | phy_ctx_id = *((u16 *)chanctx_conf->drv_priv); | ||
592 | |||
593 | if (mvm->last_bt_ci_cmd_old.primary_ch_phy_id == phy_ctx_id) | ||
594 | ret = le32_to_cpu(mvm->last_bt_notif_old.primary_ch_lut); | ||
595 | else if (mvm->last_bt_ci_cmd_old.secondary_ch_phy_id == phy_ctx_id) | ||
596 | ret = le32_to_cpu(mvm->last_bt_notif_old.secondary_ch_lut); | ||
597 | /* else - default = TX TX disallowed */ | ||
598 | |||
599 | rcu_read_unlock(); | ||
600 | |||
601 | return ret; | ||
602 | } | ||
603 | |||
604 | int iwl_send_bt_init_conf_old(struct iwl_mvm *mvm) | ||
605 | { | ||
606 | struct iwl_bt_coex_cmd_old *bt_cmd; | ||
607 | struct iwl_host_cmd cmd = { | ||
608 | .id = BT_CONFIG, | ||
609 | .len = { sizeof(*bt_cmd), }, | ||
610 | .dataflags = { IWL_HCMD_DFL_NOCOPY, }, | ||
611 | }; | ||
612 | int ret; | ||
613 | u32 flags; | ||
614 | |||
615 | ret = iwl_send_bt_prio_tbl(mvm); | ||
616 | if (ret) | ||
617 | return ret; | ||
618 | |||
619 | bt_cmd = kzalloc(sizeof(*bt_cmd), GFP_KERNEL); | ||
620 | if (!bt_cmd) | ||
621 | return -ENOMEM; | ||
622 | cmd.data[0] = bt_cmd; | ||
623 | |||
624 | lockdep_assert_held(&mvm->mutex); | ||
625 | |||
626 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) { | ||
627 | switch (mvm->bt_force_ant_mode) { | ||
628 | case BT_FORCE_ANT_AUTO: | ||
629 | flags = BT_COEX_AUTO_OLD; | ||
630 | break; | ||
631 | case BT_FORCE_ANT_BT: | ||
632 | flags = BT_COEX_BT_OLD; | ||
633 | break; | ||
634 | case BT_FORCE_ANT_WIFI: | ||
635 | flags = BT_COEX_WIFI_OLD; | ||
636 | break; | ||
637 | default: | ||
638 | WARN_ON(1); | ||
639 | flags = 0; | ||
640 | } | ||
641 | |||
642 | bt_cmd->flags = cpu_to_le32(flags); | ||
643 | bt_cmd->valid_bit_msk = cpu_to_le32(BT_VALID_ENABLE); | ||
644 | goto send_cmd; | ||
645 | } | ||
646 | |||
647 | bt_cmd->max_kill = 5; | ||
648 | bt_cmd->bt4_antenna_isolation_thr = | ||
649 | IWL_MVM_BT_COEX_ANTENNA_COUPLING_THRS; | ||
650 | bt_cmd->bt4_antenna_isolation = iwlwifi_mod_params.ant_coupling; | ||
651 | bt_cmd->bt4_tx_tx_delta_freq_thr = 15; | ||
652 | bt_cmd->bt4_tx_rx_max_freq0 = 15; | ||
653 | bt_cmd->override_primary_lut = BT_COEX_INVALID_LUT; | ||
654 | bt_cmd->override_secondary_lut = BT_COEX_INVALID_LUT; | ||
655 | |||
656 | flags = iwlwifi_mod_params.bt_coex_active ? | ||
657 | BT_COEX_NW_OLD : BT_COEX_DISABLE_OLD; | ||
658 | bt_cmd->flags = cpu_to_le32(flags); | ||
659 | |||
660 | bt_cmd->valid_bit_msk = cpu_to_le32(BT_VALID_ENABLE | | ||
661 | BT_VALID_BT_PRIO_BOOST | | ||
662 | BT_VALID_MAX_KILL | | ||
663 | BT_VALID_3W_TMRS | | ||
664 | BT_VALID_KILL_ACK | | ||
665 | BT_VALID_KILL_CTS | | ||
666 | BT_VALID_REDUCED_TX_POWER | | ||
667 | BT_VALID_LUT | | ||
668 | BT_VALID_WIFI_RX_SW_PRIO_BOOST | | ||
669 | BT_VALID_WIFI_TX_SW_PRIO_BOOST | | ||
670 | BT_VALID_ANT_ISOLATION | | ||
671 | BT_VALID_ANT_ISOLATION_THRS | | ||
672 | BT_VALID_TXTX_DELTA_FREQ_THRS | | ||
673 | BT_VALID_TXRX_MAX_FREQ_0 | | ||
674 | BT_VALID_SYNC_TO_SCO | | ||
675 | BT_VALID_TTC | | ||
676 | BT_VALID_RRC); | ||
677 | |||
678 | if (IWL_MVM_BT_COEX_SYNC2SCO) | ||
679 | bt_cmd->flags |= cpu_to_le32(BT_COEX_SYNC2SCO); | ||
680 | |||
681 | if (iwl_mvm_bt_is_plcr_supported(mvm)) { | ||
682 | bt_cmd->valid_bit_msk |= cpu_to_le32(BT_VALID_CORUN_LUT_20 | | ||
683 | BT_VALID_CORUN_LUT_40); | ||
684 | bt_cmd->flags |= cpu_to_le32(BT_COEX_CORUNNING); | ||
685 | } | ||
686 | |||
687 | if (IWL_MVM_BT_COEX_MPLUT) { | ||
688 | bt_cmd->flags |= cpu_to_le32(BT_COEX_MPLUT); | ||
689 | bt_cmd->valid_bit_msk |= cpu_to_le32(BT_VALID_MULTI_PRIO_LUT); | ||
690 | } | ||
691 | |||
692 | if (IWL_MVM_BT_COEX_TTC) | ||
693 | bt_cmd->flags |= cpu_to_le32(BT_COEX_TTC); | ||
694 | |||
695 | if (iwl_mvm_bt_is_rrc_supported(mvm)) | ||
696 | bt_cmd->flags |= cpu_to_le32(BT_COEX_RRC); | ||
697 | |||
698 | if (mvm->cfg->bt_shared_single_ant) | ||
699 | memcpy(&bt_cmd->decision_lut, iwl_single_shared_ant, | ||
700 | sizeof(iwl_single_shared_ant)); | ||
701 | else | ||
702 | memcpy(&bt_cmd->decision_lut, iwl_combined_lookup, | ||
703 | sizeof(iwl_combined_lookup)); | ||
704 | |||
705 | /* Take first Co-running block LUT to get started */ | ||
706 | memcpy(bt_cmd->bt4_corun_lut20, antenna_coupling_ranges[0].lut20, | ||
707 | sizeof(bt_cmd->bt4_corun_lut20)); | ||
708 | memcpy(bt_cmd->bt4_corun_lut40, antenna_coupling_ranges[0].lut20, | ||
709 | sizeof(bt_cmd->bt4_corun_lut40)); | ||
710 | |||
711 | memcpy(&bt_cmd->bt_prio_boost, iwl_bt_prio_boost, | ||
712 | sizeof(iwl_bt_prio_boost)); | ||
713 | bt_cmd->bt4_multiprio_lut[0] = cpu_to_le32(IWL_MVM_BT_COEX_MPLUT_REG0); | ||
714 | bt_cmd->bt4_multiprio_lut[1] = cpu_to_le32(IWL_MVM_BT_COEX_MPLUT_REG1); | ||
715 | |||
716 | send_cmd: | ||
717 | memset(&mvm->last_bt_notif_old, 0, sizeof(mvm->last_bt_notif_old)); | ||
718 | memset(&mvm->last_bt_ci_cmd_old, 0, sizeof(mvm->last_bt_ci_cmd_old)); | ||
719 | |||
720 | ret = iwl_mvm_send_cmd(mvm, &cmd); | ||
721 | |||
722 | kfree(bt_cmd); | ||
723 | return ret; | ||
724 | } | ||
725 | |||
726 | static int iwl_mvm_bt_udpate_ctrl_kill_msk(struct iwl_mvm *mvm) | ||
727 | { | ||
728 | struct iwl_bt_coex_profile_notif_old *notif = &mvm->last_bt_notif_old; | ||
729 | u32 primary_lut = le32_to_cpu(notif->primary_ch_lut); | ||
730 | u32 ag = le32_to_cpu(notif->bt_activity_grading); | ||
731 | struct iwl_bt_coex_cmd_old *bt_cmd; | ||
732 | u8 ack_kill_msk, cts_kill_msk; | ||
733 | struct iwl_host_cmd cmd = { | ||
734 | .id = BT_CONFIG, | ||
735 | .data[0] = &bt_cmd, | ||
736 | .len = { sizeof(*bt_cmd), }, | ||
737 | .dataflags = { IWL_HCMD_DFL_NOCOPY, }, | ||
738 | }; | ||
739 | int ret = 0; | ||
740 | |||
741 | lockdep_assert_held(&mvm->mutex); | ||
742 | |||
743 | ack_kill_msk = iwl_bt_ack_kill_msk[ag][primary_lut]; | ||
744 | cts_kill_msk = iwl_bt_cts_kill_msk[ag][primary_lut]; | ||
745 | |||
746 | if (mvm->bt_ack_kill_msk[0] == ack_kill_msk && | ||
747 | mvm->bt_cts_kill_msk[0] == cts_kill_msk) | ||
748 | return 0; | ||
749 | |||
750 | mvm->bt_ack_kill_msk[0] = ack_kill_msk; | ||
751 | mvm->bt_cts_kill_msk[0] = cts_kill_msk; | ||
752 | |||
753 | bt_cmd = kzalloc(sizeof(*bt_cmd), GFP_KERNEL); | ||
754 | if (!bt_cmd) | ||
755 | return -ENOMEM; | ||
756 | cmd.data[0] = bt_cmd; | ||
757 | bt_cmd->flags = cpu_to_le32(BT_COEX_NW_OLD); | ||
758 | |||
759 | bt_cmd->kill_ack_msk = cpu_to_le32(iwl_bt_ctl_kill_msk[ack_kill_msk]); | ||
760 | bt_cmd->kill_cts_msk = cpu_to_le32(iwl_bt_ctl_kill_msk[cts_kill_msk]); | ||
761 | bt_cmd->valid_bit_msk |= cpu_to_le32(BT_VALID_ENABLE | | ||
762 | BT_VALID_KILL_ACK | | ||
763 | BT_VALID_KILL_CTS); | ||
764 | |||
765 | ret = iwl_mvm_send_cmd(mvm, &cmd); | ||
766 | |||
767 | kfree(bt_cmd); | ||
768 | return ret; | ||
769 | } | ||
770 | |||
771 | static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, | ||
772 | bool enable) | ||
773 | { | ||
774 | struct iwl_bt_coex_cmd_old *bt_cmd; | ||
775 | /* Send ASYNC since this can be sent from an atomic context */ | ||
776 | struct iwl_host_cmd cmd = { | ||
777 | .id = BT_CONFIG, | ||
778 | .len = { sizeof(*bt_cmd), }, | ||
779 | .dataflags = { IWL_HCMD_DFL_DUP, }, | ||
780 | .flags = CMD_ASYNC, | ||
781 | }; | ||
782 | struct iwl_mvm_sta *mvmsta; | ||
783 | int ret; | ||
784 | |||
785 | mvmsta = iwl_mvm_sta_from_staid_protected(mvm, sta_id); | ||
786 | if (!mvmsta) | ||
787 | return 0; | ||
788 | |||
789 | /* nothing to do */ | ||
790 | if (mvmsta->bt_reduced_txpower == enable) | ||
791 | return 0; | ||
792 | |||
793 | bt_cmd = kzalloc(sizeof(*bt_cmd), GFP_ATOMIC); | ||
794 | if (!bt_cmd) | ||
795 | return -ENOMEM; | ||
796 | cmd.data[0] = bt_cmd; | ||
797 | bt_cmd->flags = cpu_to_le32(BT_COEX_NW_OLD); | ||
798 | |||
799 | bt_cmd->valid_bit_msk = | ||
800 | cpu_to_le32(BT_VALID_ENABLE | BT_VALID_REDUCED_TX_POWER); | ||
801 | bt_cmd->bt_reduced_tx_power = sta_id; | ||
802 | |||
803 | if (enable) | ||
804 | bt_cmd->bt_reduced_tx_power |= BT_REDUCED_TX_POWER_BIT; | ||
805 | |||
806 | IWL_DEBUG_COEX(mvm, "%sable reduced Tx Power for sta %d\n", | ||
807 | enable ? "en" : "dis", sta_id); | ||
808 | |||
809 | mvmsta->bt_reduced_txpower = enable; | ||
810 | |||
811 | ret = iwl_mvm_send_cmd(mvm, &cmd); | ||
812 | |||
813 | kfree(bt_cmd); | ||
814 | return ret; | ||
815 | } | ||
816 | |||
817 | struct iwl_bt_iterator_data { | ||
818 | struct iwl_bt_coex_profile_notif_old *notif; | ||
819 | struct iwl_mvm *mvm; | ||
820 | struct ieee80211_chanctx_conf *primary; | ||
821 | struct ieee80211_chanctx_conf *secondary; | ||
822 | bool primary_ll; | ||
823 | }; | ||
824 | |||
825 | static inline | ||
826 | void iwl_mvm_bt_coex_enable_rssi_event(struct iwl_mvm *mvm, | ||
827 | struct ieee80211_vif *vif, | ||
828 | bool enable, int rssi) | ||
829 | { | ||
830 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
831 | |||
832 | mvmvif->bf_data.last_bt_coex_event = rssi; | ||
833 | mvmvif->bf_data.bt_coex_max_thold = | ||
834 | enable ? -IWL_MVM_BT_COEX_EN_RED_TXP_THRESH : 0; | ||
835 | mvmvif->bf_data.bt_coex_min_thold = | ||
836 | enable ? -IWL_MVM_BT_COEX_DIS_RED_TXP_THRESH : 0; | ||
837 | } | ||
838 | |||
839 | /* must be called under rcu_read_lock */ | ||
840 | static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | ||
841 | struct ieee80211_vif *vif) | ||
842 | { | ||
843 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
844 | struct iwl_bt_iterator_data *data = _data; | ||
845 | struct iwl_mvm *mvm = data->mvm; | ||
846 | struct ieee80211_chanctx_conf *chanctx_conf; | ||
847 | enum ieee80211_smps_mode smps_mode; | ||
848 | u32 bt_activity_grading; | ||
849 | int ave_rssi; | ||
850 | |||
851 | lockdep_assert_held(&mvm->mutex); | ||
852 | |||
853 | switch (vif->type) { | ||
854 | case NL80211_IFTYPE_STATION: | ||
855 | /* default smps_mode for BSS / P2P client is AUTOMATIC */ | ||
856 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | ||
857 | break; | ||
858 | case NL80211_IFTYPE_AP: | ||
859 | if (!mvmvif->ap_ibss_active) | ||
860 | return; | ||
861 | break; | ||
862 | default: | ||
863 | return; | ||
864 | } | ||
865 | |||
866 | chanctx_conf = rcu_dereference(vif->chanctx_conf); | ||
867 | |||
868 | /* If channel context is invalid or not on 2.4GHz .. */ | ||
869 | if ((!chanctx_conf || | ||
870 | chanctx_conf->def.chan->band != IEEE80211_BAND_2GHZ)) { | ||
871 | if (vif->type == NL80211_IFTYPE_STATION) { | ||
872 | /* ... relax constraints and disable rssi events */ | ||
873 | iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, | ||
874 | smps_mode); | ||
875 | iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, | ||
876 | false); | ||
877 | iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); | ||
878 | } | ||
879 | return; | ||
880 | } | ||
881 | |||
882 | bt_activity_grading = le32_to_cpu(data->notif->bt_activity_grading); | ||
883 | if (bt_activity_grading >= BT_HIGH_TRAFFIC) | ||
884 | smps_mode = IEEE80211_SMPS_STATIC; | ||
885 | else if (bt_activity_grading >= BT_LOW_TRAFFIC) | ||
886 | smps_mode = vif->type == NL80211_IFTYPE_AP ? | ||
887 | IEEE80211_SMPS_OFF : | ||
888 | IEEE80211_SMPS_DYNAMIC; | ||
889 | |||
890 | /* relax SMPS contraints for next association */ | ||
891 | if (!vif->bss_conf.assoc) | ||
892 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | ||
893 | |||
894 | if (mvmvif->phy_ctxt && | ||
895 | data->notif->rrc_enabled & BIT(mvmvif->phy_ctxt->id)) | ||
896 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | ||
897 | |||
898 | IWL_DEBUG_COEX(data->mvm, | ||
899 | "mac %d: bt_status %d bt_activity_grading %d smps_req %d\n", | ||
900 | mvmvif->id, data->notif->bt_status, bt_activity_grading, | ||
901 | smps_mode); | ||
902 | |||
903 | if (vif->type == NL80211_IFTYPE_STATION) | ||
904 | iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, | ||
905 | smps_mode); | ||
906 | |||
907 | /* low latency is always primary */ | ||
908 | if (iwl_mvm_vif_low_latency(mvmvif)) { | ||
909 | data->primary_ll = true; | ||
910 | |||
911 | data->secondary = data->primary; | ||
912 | data->primary = chanctx_conf; | ||
913 | } | ||
914 | |||
915 | if (vif->type == NL80211_IFTYPE_AP) { | ||
916 | if (!mvmvif->ap_ibss_active) | ||
917 | return; | ||
918 | |||
919 | if (chanctx_conf == data->primary) | ||
920 | return; | ||
921 | |||
922 | if (!data->primary_ll) { | ||
923 | /* | ||
924 | * downgrade the current primary no matter what its | ||
925 | * type is. | ||
926 | */ | ||
927 | data->secondary = data->primary; | ||
928 | data->primary = chanctx_conf; | ||
929 | } else { | ||
930 | /* there is low latency vif - we will be secondary */ | ||
931 | data->secondary = chanctx_conf; | ||
932 | } | ||
933 | return; | ||
934 | } | ||
935 | |||
936 | /* | ||
937 | * STA / P2P Client, try to be primary if first vif. If we are in low | ||
938 | * latency mode, we are already in primary and just don't do much | ||
939 | */ | ||
940 | if (!data->primary || data->primary == chanctx_conf) | ||
941 | data->primary = chanctx_conf; | ||
942 | else if (!data->secondary) | ||
943 | /* if secondary is not NULL, it might be a GO */ | ||
944 | data->secondary = chanctx_conf; | ||
945 | |||
946 | /* | ||
947 | * don't reduce the Tx power if one of these is true: | ||
948 | * we are in LOOSE | ||
949 | * single share antenna product | ||
950 | * BT is active | ||
951 | * we are associated | ||
952 | */ | ||
953 | if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT || | ||
954 | mvm->cfg->bt_shared_single_ant || !vif->bss_conf.assoc || | ||
955 | !data->notif->bt_status) { | ||
956 | iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false); | ||
957 | iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); | ||
958 | return; | ||
959 | } | ||
960 | |||
961 | /* try to get the avg rssi from fw */ | ||
962 | ave_rssi = mvmvif->bf_data.ave_beacon_signal; | ||
963 | |||
964 | /* if the RSSI isn't valid, fake it is very low */ | ||
965 | if (!ave_rssi) | ||
966 | ave_rssi = -100; | ||
967 | if (ave_rssi > -IWL_MVM_BT_COEX_EN_RED_TXP_THRESH) { | ||
968 | if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, true)) | ||
969 | IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); | ||
970 | } else if (ave_rssi < -IWL_MVM_BT_COEX_DIS_RED_TXP_THRESH) { | ||
971 | if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false)) | ||
972 | IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); | ||
973 | } | ||
974 | |||
975 | /* Begin to monitor the RSSI: it may influence the reduced Tx power */ | ||
976 | iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, true, ave_rssi); | ||
977 | } | ||
978 | |||
979 | static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm) | ||
980 | { | ||
981 | struct iwl_bt_iterator_data data = { | ||
982 | .mvm = mvm, | ||
983 | .notif = &mvm->last_bt_notif_old, | ||
984 | }; | ||
985 | struct iwl_bt_coex_ci_cmd_old cmd = {}; | ||
986 | u8 ci_bw_idx; | ||
987 | |||
988 | /* Ignore updates if we are in force mode */ | ||
989 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) | ||
990 | return; | ||
991 | |||
992 | rcu_read_lock(); | ||
993 | ieee80211_iterate_active_interfaces_atomic( | ||
994 | mvm->hw, IEEE80211_IFACE_ITER_NORMAL, | ||
995 | iwl_mvm_bt_notif_iterator, &data); | ||
996 | |||
997 | if (data.primary) { | ||
998 | struct ieee80211_chanctx_conf *chan = data.primary; | ||
999 | |||
1000 | if (WARN_ON(!chan->def.chan)) { | ||
1001 | rcu_read_unlock(); | ||
1002 | return; | ||
1003 | } | ||
1004 | |||
1005 | if (chan->def.width < NL80211_CHAN_WIDTH_40) { | ||
1006 | ci_bw_idx = 0; | ||
1007 | cmd.co_run_bw_primary = 0; | ||
1008 | } else { | ||
1009 | cmd.co_run_bw_primary = 1; | ||
1010 | if (chan->def.center_freq1 > | ||
1011 | chan->def.chan->center_freq) | ||
1012 | ci_bw_idx = 2; | ||
1013 | else | ||
1014 | ci_bw_idx = 1; | ||
1015 | } | ||
1016 | |||
1017 | cmd.bt_primary_ci = | ||
1018 | iwl_ci_mask[chan->def.chan->hw_value][ci_bw_idx]; | ||
1019 | cmd.primary_ch_phy_id = *((u16 *)data.primary->drv_priv); | ||
1020 | } | ||
1021 | |||
1022 | if (data.secondary) { | ||
1023 | struct ieee80211_chanctx_conf *chan = data.secondary; | ||
1024 | |||
1025 | if (WARN_ON(!data.secondary->def.chan)) { | ||
1026 | rcu_read_unlock(); | ||
1027 | return; | ||
1028 | } | ||
1029 | |||
1030 | if (chan->def.width < NL80211_CHAN_WIDTH_40) { | ||
1031 | ci_bw_idx = 0; | ||
1032 | cmd.co_run_bw_secondary = 0; | ||
1033 | } else { | ||
1034 | cmd.co_run_bw_secondary = 1; | ||
1035 | if (chan->def.center_freq1 > | ||
1036 | chan->def.chan->center_freq) | ||
1037 | ci_bw_idx = 2; | ||
1038 | else | ||
1039 | ci_bw_idx = 1; | ||
1040 | } | ||
1041 | |||
1042 | cmd.bt_secondary_ci = | ||
1043 | iwl_ci_mask[chan->def.chan->hw_value][ci_bw_idx]; | ||
1044 | cmd.secondary_ch_phy_id = *((u16 *)data.secondary->drv_priv); | ||
1045 | } | ||
1046 | |||
1047 | rcu_read_unlock(); | ||
1048 | |||
1049 | /* Don't spam the fw with the same command over and over */ | ||
1050 | if (memcmp(&cmd, &mvm->last_bt_ci_cmd_old, sizeof(cmd))) { | ||
1051 | if (iwl_mvm_send_cmd_pdu(mvm, BT_COEX_CI, 0, | ||
1052 | sizeof(cmd), &cmd)) | ||
1053 | IWL_ERR(mvm, "Failed to send BT_CI cmd\n"); | ||
1054 | memcpy(&mvm->last_bt_ci_cmd_old, &cmd, sizeof(cmd)); | ||
1055 | } | ||
1056 | |||
1057 | if (iwl_mvm_bt_udpate_ctrl_kill_msk(mvm)) | ||
1058 | IWL_ERR(mvm, "Failed to update the ctrl_kill_msk\n"); | ||
1059 | } | ||
1060 | |||
1061 | void iwl_mvm_rx_bt_coex_notif_old(struct iwl_mvm *mvm, | ||
1062 | struct iwl_rx_cmd_buffer *rxb) | ||
1063 | { | ||
1064 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | ||
1065 | struct iwl_bt_coex_profile_notif_old *notif = (void *)pkt->data; | ||
1066 | |||
1067 | IWL_DEBUG_COEX(mvm, "BT Coex Notification received\n"); | ||
1068 | IWL_DEBUG_COEX(mvm, "\tBT status: %s\n", | ||
1069 | notif->bt_status ? "ON" : "OFF"); | ||
1070 | IWL_DEBUG_COEX(mvm, "\tBT open conn %d\n", notif->bt_open_conn); | ||
1071 | IWL_DEBUG_COEX(mvm, "\tBT ci compliance %d\n", notif->bt_ci_compliance); | ||
1072 | IWL_DEBUG_COEX(mvm, "\tBT primary_ch_lut %d\n", | ||
1073 | le32_to_cpu(notif->primary_ch_lut)); | ||
1074 | IWL_DEBUG_COEX(mvm, "\tBT secondary_ch_lut %d\n", | ||
1075 | le32_to_cpu(notif->secondary_ch_lut)); | ||
1076 | IWL_DEBUG_COEX(mvm, "\tBT activity grading %d\n", | ||
1077 | le32_to_cpu(notif->bt_activity_grading)); | ||
1078 | IWL_DEBUG_COEX(mvm, "\tBT agg traffic load %d\n", | ||
1079 | notif->bt_agg_traffic_load); | ||
1080 | |||
1081 | /* remember this notification for future use: rssi fluctuations */ | ||
1082 | memcpy(&mvm->last_bt_notif_old, notif, sizeof(mvm->last_bt_notif_old)); | ||
1083 | |||
1084 | iwl_mvm_bt_coex_notif_handle(mvm); | ||
1085 | } | ||
1086 | |||
1087 | static void iwl_mvm_bt_rssi_iterator(void *_data, u8 *mac, | ||
1088 | struct ieee80211_vif *vif) | ||
1089 | { | ||
1090 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
1091 | struct iwl_bt_iterator_data *data = _data; | ||
1092 | struct iwl_mvm *mvm = data->mvm; | ||
1093 | |||
1094 | struct ieee80211_sta *sta; | ||
1095 | struct iwl_mvm_sta *mvmsta; | ||
1096 | |||
1097 | struct ieee80211_chanctx_conf *chanctx_conf; | ||
1098 | |||
1099 | rcu_read_lock(); | ||
1100 | chanctx_conf = rcu_dereference(vif->chanctx_conf); | ||
1101 | /* If channel context is invalid or not on 2.4GHz - don't count it */ | ||
1102 | if (!chanctx_conf || | ||
1103 | chanctx_conf->def.chan->band != IEEE80211_BAND_2GHZ) { | ||
1104 | rcu_read_unlock(); | ||
1105 | return; | ||
1106 | } | ||
1107 | rcu_read_unlock(); | ||
1108 | |||
1109 | if (vif->type != NL80211_IFTYPE_STATION || | ||
1110 | mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT) | ||
1111 | return; | ||
1112 | |||
1113 | sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], | ||
1114 | lockdep_is_held(&mvm->mutex)); | ||
1115 | |||
1116 | /* This can happen if the station has been removed right now */ | ||
1117 | if (IS_ERR_OR_NULL(sta)) | ||
1118 | return; | ||
1119 | |||
1120 | mvmsta = iwl_mvm_sta_from_mac80211(sta); | ||
1121 | } | ||
1122 | |||
1123 | void iwl_mvm_bt_rssi_event_old(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | ||
1124 | enum ieee80211_rssi_event_data rssi_event) | ||
1125 | { | ||
1126 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
1127 | struct iwl_bt_iterator_data data = { | ||
1128 | .mvm = mvm, | ||
1129 | }; | ||
1130 | int ret; | ||
1131 | |||
1132 | lockdep_assert_held(&mvm->mutex); | ||
1133 | |||
1134 | /* Ignore updates if we are in force mode */ | ||
1135 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) | ||
1136 | return; | ||
1137 | |||
1138 | /* | ||
1139 | * Rssi update while not associated - can happen since the statistics | ||
1140 | * are handled asynchronously | ||
1141 | */ | ||
1142 | if (mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT) | ||
1143 | return; | ||
1144 | |||
1145 | /* No BT - reports should be disabled */ | ||
1146 | if (!mvm->last_bt_notif_old.bt_status) | ||
1147 | return; | ||
1148 | |||
1149 | IWL_DEBUG_COEX(mvm, "RSSI for %pM is now %s\n", vif->bss_conf.bssid, | ||
1150 | rssi_event == RSSI_EVENT_HIGH ? "HIGH" : "LOW"); | ||
1151 | |||
1152 | /* | ||
1153 | * Check if rssi is good enough for reduced Tx power, but not in loose | ||
1154 | * scheme. | ||
1155 | */ | ||
1156 | if (rssi_event == RSSI_EVENT_LOW || mvm->cfg->bt_shared_single_ant || | ||
1157 | iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT) | ||
1158 | ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, | ||
1159 | false); | ||
1160 | else | ||
1161 | ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, true); | ||
1162 | |||
1163 | if (ret) | ||
1164 | IWL_ERR(mvm, "couldn't send BT_CONFIG HCMD upon RSSI event\n"); | ||
1165 | |||
1166 | ieee80211_iterate_active_interfaces_atomic( | ||
1167 | mvm->hw, IEEE80211_IFACE_ITER_NORMAL, | ||
1168 | iwl_mvm_bt_rssi_iterator, &data); | ||
1169 | |||
1170 | if (iwl_mvm_bt_udpate_ctrl_kill_msk(mvm)) | ||
1171 | IWL_ERR(mvm, "Failed to update the ctrl_kill_msk\n"); | ||
1172 | } | ||
1173 | |||
1174 | #define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) | ||
1175 | #define LINK_QUAL_AGG_TIME_LIMIT_BT_ACT (1200) | ||
1176 | |||
1177 | u16 iwl_mvm_coex_agg_time_limit_old(struct iwl_mvm *mvm, | ||
1178 | struct ieee80211_sta *sta) | ||
1179 | { | ||
1180 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | ||
1181 | enum iwl_bt_coex_lut_type lut_type; | ||
1182 | |||
1183 | if (le32_to_cpu(mvm->last_bt_notif_old.bt_activity_grading) < | ||
1184 | BT_HIGH_TRAFFIC) | ||
1185 | return LINK_QUAL_AGG_TIME_LIMIT_DEF; | ||
1186 | |||
1187 | if (mvm->last_bt_notif_old.ttc_enabled) | ||
1188 | return LINK_QUAL_AGG_TIME_LIMIT_DEF; | ||
1189 | |||
1190 | lut_type = iwl_get_coex_type(mvm, mvmsta->vif); | ||
1191 | |||
1192 | if (lut_type == BT_COEX_LOOSE_LUT || lut_type == BT_COEX_INVALID_LUT) | ||
1193 | return LINK_QUAL_AGG_TIME_LIMIT_DEF; | ||
1194 | |||
1195 | /* tight coex, high bt traffic, reduce AGG time limit */ | ||
1196 | return LINK_QUAL_AGG_TIME_LIMIT_BT_ACT; | ||
1197 | } | ||
1198 | |||
1199 | bool iwl_mvm_bt_coex_is_mimo_allowed_old(struct iwl_mvm *mvm, | ||
1200 | struct ieee80211_sta *sta) | ||
1201 | { | ||
1202 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | ||
1203 | enum iwl_bt_coex_lut_type lut_type; | ||
1204 | |||
1205 | if (mvm->last_bt_notif_old.ttc_enabled) | ||
1206 | return true; | ||
1207 | |||
1208 | if (le32_to_cpu(mvm->last_bt_notif_old.bt_activity_grading) < | ||
1209 | BT_HIGH_TRAFFIC) | ||
1210 | return true; | ||
1211 | |||
1212 | /* | ||
1213 | * In Tight / TxTxDis, BT can't Rx while we Tx, so use both antennas | ||
1214 | * since BT is already killed. | ||
1215 | * In Loose, BT can Rx while we Tx, so forbid MIMO to let BT Rx while | ||
1216 | * we Tx. | ||
1217 | * When we are in 5GHz, we'll get BT_COEX_INVALID_LUT allowing MIMO. | ||
1218 | */ | ||
1219 | lut_type = iwl_get_coex_type(mvm, mvmsta->vif); | ||
1220 | return lut_type != BT_COEX_LOOSE_LUT; | ||
1221 | } | ||
1222 | |||
1223 | bool iwl_mvm_bt_coex_is_shared_ant_avail_old(struct iwl_mvm *mvm) | ||
1224 | { | ||
1225 | u32 ag = le32_to_cpu(mvm->last_bt_notif_old.bt_activity_grading); | ||
1226 | return ag < BT_HIGH_TRAFFIC; | ||
1227 | } | ||
1228 | |||
1229 | bool iwl_mvm_bt_coex_is_tpc_allowed_old(struct iwl_mvm *mvm, | ||
1230 | enum ieee80211_band band) | ||
1231 | { | ||
1232 | u32 bt_activity = | ||
1233 | le32_to_cpu(mvm->last_bt_notif_old.bt_activity_grading); | ||
1234 | |||
1235 | if (band != IEEE80211_BAND_2GHZ) | ||
1236 | return false; | ||
1237 | |||
1238 | return bt_activity >= BT_LOW_TRAFFIC; | ||
1239 | } | ||
1240 | |||
1241 | void iwl_mvm_bt_coex_vif_change_old(struct iwl_mvm *mvm) | ||
1242 | { | ||
1243 | iwl_mvm_bt_coex_notif_handle(mvm); | ||
1244 | } | ||
1245 | |||
1246 | void iwl_mvm_rx_ant_coupling_notif_old(struct iwl_mvm *mvm, | ||
1247 | struct iwl_rx_cmd_buffer *rxb) | ||
1248 | { | ||
1249 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | ||
1250 | u32 ant_isolation = le32_to_cpup((void *)pkt->data); | ||
1251 | u8 __maybe_unused lower_bound, upper_bound; | ||
1252 | u8 lut; | ||
1253 | |||
1254 | struct iwl_bt_coex_cmd_old *bt_cmd; | ||
1255 | struct iwl_host_cmd cmd = { | ||
1256 | .id = BT_CONFIG, | ||
1257 | .len = { sizeof(*bt_cmd), }, | ||
1258 | .dataflags = { IWL_HCMD_DFL_NOCOPY, }, | ||
1259 | }; | ||
1260 | |||
1261 | if (!iwl_mvm_bt_is_plcr_supported(mvm)) | ||
1262 | return; | ||
1263 | |||
1264 | lockdep_assert_held(&mvm->mutex); | ||
1265 | |||
1266 | /* Ignore updates if we are in force mode */ | ||
1267 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) | ||
1268 | return; | ||
1269 | |||
1270 | if (ant_isolation == mvm->last_ant_isol) | ||
1271 | return; | ||
1272 | |||
1273 | for (lut = 0; lut < ARRAY_SIZE(antenna_coupling_ranges) - 1; lut++) | ||
1274 | if (ant_isolation < antenna_coupling_ranges[lut + 1].range) | ||
1275 | break; | ||
1276 | |||
1277 | lower_bound = antenna_coupling_ranges[lut].range; | ||
1278 | |||
1279 | if (lut < ARRAY_SIZE(antenna_coupling_ranges) - 1) | ||
1280 | upper_bound = antenna_coupling_ranges[lut + 1].range; | ||
1281 | else | ||
1282 | upper_bound = antenna_coupling_ranges[lut].range; | ||
1283 | |||
1284 | IWL_DEBUG_COEX(mvm, "Antenna isolation=%d in range [%d,%d[, lut=%d\n", | ||
1285 | ant_isolation, lower_bound, upper_bound, lut); | ||
1286 | |||
1287 | mvm->last_ant_isol = ant_isolation; | ||
1288 | |||
1289 | if (mvm->last_corun_lut == lut) | ||
1290 | return; | ||
1291 | |||
1292 | mvm->last_corun_lut = lut; | ||
1293 | |||
1294 | bt_cmd = kzalloc(sizeof(*bt_cmd), GFP_KERNEL); | ||
1295 | if (!bt_cmd) | ||
1296 | return; | ||
1297 | cmd.data[0] = bt_cmd; | ||
1298 | |||
1299 | bt_cmd->flags = cpu_to_le32(BT_COEX_NW_OLD); | ||
1300 | bt_cmd->valid_bit_msk |= cpu_to_le32(BT_VALID_ENABLE | | ||
1301 | BT_VALID_CORUN_LUT_20 | | ||
1302 | BT_VALID_CORUN_LUT_40); | ||
1303 | |||
1304 | /* For the moment, use the same LUT for 20GHz and 40GHz */ | ||
1305 | memcpy(bt_cmd->bt4_corun_lut20, antenna_coupling_ranges[lut].lut20, | ||
1306 | sizeof(bt_cmd->bt4_corun_lut20)); | ||
1307 | |||
1308 | memcpy(bt_cmd->bt4_corun_lut40, antenna_coupling_ranges[lut].lut20, | ||
1309 | sizeof(bt_cmd->bt4_corun_lut40)); | ||
1310 | |||
1311 | if (iwl_mvm_send_cmd(mvm, &cmd)) | ||
1312 | IWL_ERR(mvm, "failed to send BT_CONFIG command\n"); | ||
1313 | |||
1314 | kfree(bt_cmd); | ||
1315 | } | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c index a43b3921c4c1..abc16f73f07b 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | |||
@@ -463,69 +463,11 @@ int iwl_mvm_coex_dump_mbox(struct iwl_bt_coex_profile_notif *notif, char *buf, | |||
463 | return pos; | 463 | return pos; |
464 | } | 464 | } |
465 | 465 | ||
466 | static | ||
467 | int iwl_mvm_coex_dump_mbox_old(struct iwl_bt_coex_profile_notif_old *notif, | ||
468 | char *buf, int pos, int bufsz) | ||
469 | { | ||
470 | pos += scnprintf(buf+pos, bufsz-pos, "MBOX dw0:\n"); | ||
471 | |||
472 | BT_MBOX_PRINT(0, LE_SLAVE_LAT, false); | ||
473 | BT_MBOX_PRINT(0, LE_PROF1, false); | ||
474 | BT_MBOX_PRINT(0, LE_PROF2, false); | ||
475 | BT_MBOX_PRINT(0, LE_PROF_OTHER, false); | ||
476 | BT_MBOX_PRINT(0, CHL_SEQ_N, false); | ||
477 | BT_MBOX_PRINT(0, INBAND_S, false); | ||
478 | BT_MBOX_PRINT(0, LE_MIN_RSSI, false); | ||
479 | BT_MBOX_PRINT(0, LE_SCAN, false); | ||
480 | BT_MBOX_PRINT(0, LE_ADV, false); | ||
481 | BT_MBOX_PRINT(0, LE_MAX_TX_POWER, false); | ||
482 | BT_MBOX_PRINT(0, OPEN_CON_1, true); | ||
483 | |||
484 | pos += scnprintf(buf+pos, bufsz-pos, "MBOX dw1:\n"); | ||
485 | |||
486 | BT_MBOX_PRINT(1, BR_MAX_TX_POWER, false); | ||
487 | BT_MBOX_PRINT(1, IP_SR, false); | ||
488 | BT_MBOX_PRINT(1, LE_MSTR, false); | ||
489 | BT_MBOX_PRINT(1, AGGR_TRFC_LD, false); | ||
490 | BT_MBOX_PRINT(1, MSG_TYPE, false); | ||
491 | BT_MBOX_PRINT(1, SSN, true); | ||
492 | |||
493 | pos += scnprintf(buf+pos, bufsz-pos, "MBOX dw2:\n"); | ||
494 | |||
495 | BT_MBOX_PRINT(2, SNIFF_ACT, false); | ||
496 | BT_MBOX_PRINT(2, PAG, false); | ||
497 | BT_MBOX_PRINT(2, INQUIRY, false); | ||
498 | BT_MBOX_PRINT(2, CONN, false); | ||
499 | BT_MBOX_PRINT(2, SNIFF_INTERVAL, false); | ||
500 | BT_MBOX_PRINT(2, DISC, false); | ||
501 | BT_MBOX_PRINT(2, SCO_TX_ACT, false); | ||
502 | BT_MBOX_PRINT(2, SCO_RX_ACT, false); | ||
503 | BT_MBOX_PRINT(2, ESCO_RE_TX, false); | ||
504 | BT_MBOX_PRINT(2, SCO_DURATION, true); | ||
505 | |||
506 | pos += scnprintf(buf+pos, bufsz-pos, "MBOX dw3:\n"); | ||
507 | |||
508 | BT_MBOX_PRINT(3, SCO_STATE, false); | ||
509 | BT_MBOX_PRINT(3, SNIFF_STATE, false); | ||
510 | BT_MBOX_PRINT(3, A2DP_STATE, false); | ||
511 | BT_MBOX_PRINT(3, ACL_STATE, false); | ||
512 | BT_MBOX_PRINT(3, MSTR_STATE, false); | ||
513 | BT_MBOX_PRINT(3, OBX_STATE, false); | ||
514 | BT_MBOX_PRINT(3, OPEN_CON_2, false); | ||
515 | BT_MBOX_PRINT(3, TRAFFIC_LOAD, false); | ||
516 | BT_MBOX_PRINT(3, CHL_SEQN_LSB, false); | ||
517 | BT_MBOX_PRINT(3, INBAND_P, false); | ||
518 | BT_MBOX_PRINT(3, MSG_TYPE_2, false); | ||
519 | BT_MBOX_PRINT(3, SSN_2, false); | ||
520 | BT_MBOX_PRINT(3, UPDATE_REQUEST, true); | ||
521 | |||
522 | return pos; | ||
523 | } | ||
524 | |||
525 | static ssize_t iwl_dbgfs_bt_notif_read(struct file *file, char __user *user_buf, | 466 | static ssize_t iwl_dbgfs_bt_notif_read(struct file *file, char __user *user_buf, |
526 | size_t count, loff_t *ppos) | 467 | size_t count, loff_t *ppos) |
527 | { | 468 | { |
528 | struct iwl_mvm *mvm = file->private_data; | 469 | struct iwl_mvm *mvm = file->private_data; |
470 | struct iwl_bt_coex_profile_notif *notif = &mvm->last_bt_notif; | ||
529 | char *buf; | 471 | char *buf; |
530 | int ret, pos = 0, bufsz = sizeof(char) * 1024; | 472 | int ret, pos = 0, bufsz = sizeof(char) * 1024; |
531 | 473 | ||
@@ -535,52 +477,24 @@ static ssize_t iwl_dbgfs_bt_notif_read(struct file *file, char __user *user_buf, | |||
535 | 477 | ||
536 | mutex_lock(&mvm->mutex); | 478 | mutex_lock(&mvm->mutex); |
537 | 479 | ||
538 | if (!fw_has_api(&mvm->fw->ucode_capa, | 480 | pos += iwl_mvm_coex_dump_mbox(notif, buf, pos, bufsz); |
539 | IWL_UCODE_TLV_API_BT_COEX_SPLIT)) { | 481 | |
540 | struct iwl_bt_coex_profile_notif_old *notif = | 482 | pos += scnprintf(buf + pos, bufsz - pos, "bt_ci_compliance = %d\n", |
541 | &mvm->last_bt_notif_old; | 483 | notif->bt_ci_compliance); |
542 | 484 | pos += scnprintf(buf + pos, bufsz - pos, "primary_ch_lut = %d\n", | |
543 | pos += iwl_mvm_coex_dump_mbox_old(notif, buf, pos, bufsz); | 485 | le32_to_cpu(notif->primary_ch_lut)); |
544 | 486 | pos += scnprintf(buf + pos, bufsz - pos, "secondary_ch_lut = %d\n", | |
545 | pos += scnprintf(buf+pos, bufsz-pos, "bt_ci_compliance = %d\n", | 487 | le32_to_cpu(notif->secondary_ch_lut)); |
546 | notif->bt_ci_compliance); | 488 | pos += scnprintf(buf + pos, |
547 | pos += scnprintf(buf+pos, bufsz-pos, "primary_ch_lut = %d\n", | 489 | bufsz - pos, "bt_activity_grading = %d\n", |
548 | le32_to_cpu(notif->primary_ch_lut)); | 490 | le32_to_cpu(notif->bt_activity_grading)); |
549 | pos += scnprintf(buf+pos, bufsz-pos, "secondary_ch_lut = %d\n", | 491 | pos += scnprintf(buf + pos, bufsz - pos, |
550 | le32_to_cpu(notif->secondary_ch_lut)); | 492 | "antenna isolation = %d CORUN LUT index = %d\n", |
551 | pos += scnprintf(buf+pos, | 493 | mvm->last_ant_isol, mvm->last_corun_lut); |
552 | bufsz-pos, "bt_activity_grading = %d\n", | 494 | pos += scnprintf(buf + pos, bufsz - pos, "bt_rrc = %d\n", |
553 | le32_to_cpu(notif->bt_activity_grading)); | 495 | (notif->ttc_rrc_status >> 4) & 0xF); |
554 | pos += scnprintf(buf+pos, bufsz-pos, | 496 | pos += scnprintf(buf + pos, bufsz - pos, "bt_ttc = %d\n", |
555 | "antenna isolation = %d CORUN LUT index = %d\n", | 497 | notif->ttc_rrc_status & 0xF); |
556 | mvm->last_ant_isol, mvm->last_corun_lut); | ||
557 | pos += scnprintf(buf + pos, bufsz - pos, "bt_rrc = %d\n", | ||
558 | notif->rrc_enabled); | ||
559 | pos += scnprintf(buf + pos, bufsz - pos, "bt_ttc = %d\n", | ||
560 | notif->ttc_enabled); | ||
561 | } else { | ||
562 | struct iwl_bt_coex_profile_notif *notif = | ||
563 | &mvm->last_bt_notif; | ||
564 | |||
565 | pos += iwl_mvm_coex_dump_mbox(notif, buf, pos, bufsz); | ||
566 | |||
567 | pos += scnprintf(buf+pos, bufsz-pos, "bt_ci_compliance = %d\n", | ||
568 | notif->bt_ci_compliance); | ||
569 | pos += scnprintf(buf+pos, bufsz-pos, "primary_ch_lut = %d\n", | ||
570 | le32_to_cpu(notif->primary_ch_lut)); | ||
571 | pos += scnprintf(buf+pos, bufsz-pos, "secondary_ch_lut = %d\n", | ||
572 | le32_to_cpu(notif->secondary_ch_lut)); | ||
573 | pos += scnprintf(buf+pos, | ||
574 | bufsz-pos, "bt_activity_grading = %d\n", | ||
575 | le32_to_cpu(notif->bt_activity_grading)); | ||
576 | pos += scnprintf(buf+pos, bufsz-pos, | ||
577 | "antenna isolation = %d CORUN LUT index = %d\n", | ||
578 | mvm->last_ant_isol, mvm->last_corun_lut); | ||
579 | pos += scnprintf(buf + pos, bufsz - pos, "bt_rrc = %d\n", | ||
580 | (notif->ttc_rrc_status >> 4) & 0xF); | ||
581 | pos += scnprintf(buf + pos, bufsz - pos, "bt_ttc = %d\n", | ||
582 | notif->ttc_rrc_status & 0xF); | ||
583 | } | ||
584 | 498 | ||
585 | pos += scnprintf(buf + pos, bufsz - pos, "sync_sco = %d\n", | 499 | pos += scnprintf(buf + pos, bufsz - pos, "sync_sco = %d\n", |
586 | IWL_MVM_BT_COEX_SYNC2SCO); | 500 | IWL_MVM_BT_COEX_SYNC2SCO); |
@@ -602,44 +516,20 @@ static ssize_t iwl_dbgfs_bt_cmd_read(struct file *file, char __user *user_buf, | |||
602 | size_t count, loff_t *ppos) | 516 | size_t count, loff_t *ppos) |
603 | { | 517 | { |
604 | struct iwl_mvm *mvm = file->private_data; | 518 | struct iwl_mvm *mvm = file->private_data; |
519 | struct iwl_bt_coex_ci_cmd *cmd = &mvm->last_bt_ci_cmd; | ||
605 | char buf[256]; | 520 | char buf[256]; |
606 | int bufsz = sizeof(buf); | 521 | int bufsz = sizeof(buf); |
607 | int pos = 0; | 522 | int pos = 0; |
608 | 523 | ||
609 | mutex_lock(&mvm->mutex); | 524 | mutex_lock(&mvm->mutex); |
610 | 525 | ||
611 | if (!fw_has_api(&mvm->fw->ucode_capa, | 526 | pos += scnprintf(buf + pos, bufsz - pos, "Channel inhibition CMD\n"); |
612 | IWL_UCODE_TLV_API_BT_COEX_SPLIT)) { | 527 | pos += scnprintf(buf + pos, bufsz - pos, |
613 | struct iwl_bt_coex_ci_cmd_old *cmd = &mvm->last_bt_ci_cmd_old; | 528 | "\tPrimary Channel Bitmap 0x%016llx\n", |
614 | 529 | le64_to_cpu(cmd->bt_primary_ci)); | |
615 | pos += scnprintf(buf+pos, bufsz-pos, | 530 | pos += scnprintf(buf + pos, bufsz - pos, |
616 | "Channel inhibition CMD\n"); | 531 | "\tSecondary Channel Bitmap 0x%016llx\n", |
617 | pos += scnprintf(buf+pos, bufsz-pos, | 532 | le64_to_cpu(cmd->bt_secondary_ci)); |
618 | "\tPrimary Channel Bitmap 0x%016llx\n", | ||
619 | le64_to_cpu(cmd->bt_primary_ci)); | ||
620 | pos += scnprintf(buf+pos, bufsz-pos, | ||
621 | "\tSecondary Channel Bitmap 0x%016llx\n", | ||
622 | le64_to_cpu(cmd->bt_secondary_ci)); | ||
623 | |||
624 | pos += scnprintf(buf+pos, bufsz-pos, | ||
625 | "BT Configuration CMD - 0=default, 1=never, 2=always\n"); | ||
626 | pos += scnprintf(buf+pos, bufsz-pos, "\tACK Kill msk idx %d\n", | ||
627 | mvm->bt_ack_kill_msk[0]); | ||
628 | pos += scnprintf(buf+pos, bufsz-pos, "\tCTS Kill msk idx %d\n", | ||
629 | mvm->bt_cts_kill_msk[0]); | ||
630 | |||
631 | } else { | ||
632 | struct iwl_bt_coex_ci_cmd *cmd = &mvm->last_bt_ci_cmd; | ||
633 | |||
634 | pos += scnprintf(buf+pos, bufsz-pos, | ||
635 | "Channel inhibition CMD\n"); | ||
636 | pos += scnprintf(buf+pos, bufsz-pos, | ||
637 | "\tPrimary Channel Bitmap 0x%016llx\n", | ||
638 | le64_to_cpu(cmd->bt_primary_ci)); | ||
639 | pos += scnprintf(buf+pos, bufsz-pos, | ||
640 | "\tSecondary Channel Bitmap 0x%016llx\n", | ||
641 | le64_to_cpu(cmd->bt_secondary_ci)); | ||
642 | } | ||
643 | 533 | ||
644 | mutex_unlock(&mvm->mutex); | 534 | mutex_unlock(&mvm->mutex); |
645 | 535 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index f9430ee8f96b..f0e25971424e 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | |||
@@ -1470,22 +1470,6 @@ bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm, | |||
1470 | u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, | 1470 | u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, |
1471 | struct ieee80211_tx_info *info, u8 ac); | 1471 | struct ieee80211_tx_info *info, u8 ac); |
1472 | 1472 | ||
1473 | bool iwl_mvm_bt_coex_is_shared_ant_avail_old(struct iwl_mvm *mvm); | ||
1474 | void iwl_mvm_bt_coex_vif_change_old(struct iwl_mvm *mvm); | ||
1475 | int iwl_send_bt_init_conf_old(struct iwl_mvm *mvm); | ||
1476 | void iwl_mvm_rx_bt_coex_notif_old(struct iwl_mvm *mvm, | ||
1477 | struct iwl_rx_cmd_buffer *rxb); | ||
1478 | void iwl_mvm_bt_rssi_event_old(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | ||
1479 | enum ieee80211_rssi_event_data); | ||
1480 | u16 iwl_mvm_coex_agg_time_limit_old(struct iwl_mvm *mvm, | ||
1481 | struct ieee80211_sta *sta); | ||
1482 | bool iwl_mvm_bt_coex_is_mimo_allowed_old(struct iwl_mvm *mvm, | ||
1483 | struct ieee80211_sta *sta); | ||
1484 | bool iwl_mvm_bt_coex_is_tpc_allowed_old(struct iwl_mvm *mvm, | ||
1485 | enum ieee80211_band band); | ||
1486 | void iwl_mvm_rx_ant_coupling_notif_old(struct iwl_mvm *mvm, | ||
1487 | struct iwl_rx_cmd_buffer *rxb); | ||
1488 | |||
1489 | /* beacon filtering */ | 1473 | /* beacon filtering */ |
1490 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 1474 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
1491 | void | 1475 | void |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sf.c b/drivers/net/wireless/intel/iwlwifi/mvm/sf.c index c2def1232a8c..443a42855c9e 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sf.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sf.c | |||
@@ -193,7 +193,7 @@ static void iwl_mvm_fill_sf_command(struct iwl_mvm *mvm, | |||
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | if (sta || IWL_UCODE_API(mvm->fw->ucode_ver) < 13) { | 196 | if (sta) { |
197 | BUILD_BUG_ON(sizeof(sf_full_timeout) != | 197 | BUILD_BUG_ON(sizeof(sf_full_timeout) != |
198 | sizeof(__le32) * SF_NUM_SCENARIO * | 198 | sizeof(__le32) * SF_NUM_SCENARIO * |
199 | SF_NUM_TIMEOUT_TYPES); | 199 | SF_NUM_TIMEOUT_TYPES); |
@@ -220,9 +220,6 @@ static int iwl_mvm_sf_config(struct iwl_mvm *mvm, u8 sta_id, | |||
220 | struct ieee80211_sta *sta; | 220 | struct ieee80211_sta *sta; |
221 | int ret = 0; | 221 | int ret = 0; |
222 | 222 | ||
223 | if (IWL_UCODE_API(mvm->fw->ucode_ver) < 13) | ||
224 | sf_cmd.state = cpu_to_le32(new_state); | ||
225 | |||
226 | if (mvm->cfg->disable_dummy_notification) | 223 | if (mvm->cfg->disable_dummy_notification) |
227 | sf_cmd.state |= cpu_to_le32(SF_CFG_DUMMY_NOTIF_OFF); | 224 | sf_cmd.state |= cpu_to_le32(SF_CFG_DUMMY_NOTIF_OFF); |
228 | 225 | ||
@@ -235,8 +232,7 @@ static int iwl_mvm_sf_config(struct iwl_mvm *mvm, u8 sta_id, | |||
235 | 232 | ||
236 | switch (new_state) { | 233 | switch (new_state) { |
237 | case SF_UNINIT: | 234 | case SF_UNINIT: |
238 | if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 13) | 235 | iwl_mvm_fill_sf_command(mvm, &sf_cmd, NULL); |
239 | iwl_mvm_fill_sf_command(mvm, &sf_cmd, NULL); | ||
240 | break; | 236 | break; |
241 | case SF_FULL_ON: | 237 | case SF_FULL_ON: |
242 | if (sta_id == IWL_MVM_STATION_COUNT) { | 238 | if (sta_id == IWL_MVM_STATION_COUNT) { |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c index 2440248c8e69..76866b9e5686 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c | |||
@@ -491,98 +491,12 @@ static void iwl_mvm_dump_umac_error_log(struct iwl_mvm *mvm) | |||
491 | IWL_ERR(mvm, "0x%08X | isr status reg\n", table.nic_isr_pref); | 491 | IWL_ERR(mvm, "0x%08X | isr status reg\n", table.nic_isr_pref); |
492 | } | 492 | } |
493 | 493 | ||
494 | static void iwl_mvm_dump_nic_error_log_old(struct iwl_mvm *mvm) | ||
495 | { | ||
496 | struct iwl_trans *trans = mvm->trans; | ||
497 | struct iwl_error_event_table_v1 table; | ||
498 | u32 base; | ||
499 | |||
500 | base = mvm->error_event_table; | ||
501 | if (mvm->cur_ucode == IWL_UCODE_INIT) { | ||
502 | if (!base) | ||
503 | base = mvm->fw->init_errlog_ptr; | ||
504 | } else { | ||
505 | if (!base) | ||
506 | base = mvm->fw->inst_errlog_ptr; | ||
507 | } | ||
508 | |||
509 | if (base < 0x800000) { | ||
510 | IWL_ERR(mvm, | ||
511 | "Not valid error log pointer 0x%08X for %s uCode\n", | ||
512 | base, | ||
513 | (mvm->cur_ucode == IWL_UCODE_INIT) | ||
514 | ? "Init" : "RT"); | ||
515 | return; | ||
516 | } | ||
517 | |||
518 | iwl_trans_read_mem_bytes(trans, base, &table, sizeof(table)); | ||
519 | |||
520 | if (ERROR_START_OFFSET <= table.valid * ERROR_ELEM_SIZE) { | ||
521 | IWL_ERR(trans, "Start IWL Error Log Dump:\n"); | ||
522 | IWL_ERR(trans, "Status: 0x%08lX, count: %d\n", | ||
523 | mvm->status, table.valid); | ||
524 | } | ||
525 | |||
526 | /* Do not change this output - scripts rely on it */ | ||
527 | |||
528 | IWL_ERR(mvm, "Loaded firmware version: %s\n", mvm->fw->fw_version); | ||
529 | |||
530 | trace_iwlwifi_dev_ucode_error(trans->dev, table.error_id, table.tsf_low, | ||
531 | table.data1, table.data2, table.data3, | ||
532 | table.blink2, table.ilink1, table.ilink2, | ||
533 | table.bcon_time, table.gp1, table.gp2, | ||
534 | table.gp3, table.ucode_ver, 0, | ||
535 | table.hw_ver, table.brd_ver); | ||
536 | IWL_ERR(mvm, "0x%08X | %-28s\n", table.error_id, | ||
537 | desc_lookup(table.error_id)); | ||
538 | IWL_ERR(mvm, "0x%08X | uPc\n", table.pc); | ||
539 | IWL_ERR(mvm, "0x%08X | branchlink1\n", table.blink1); | ||
540 | IWL_ERR(mvm, "0x%08X | branchlink2\n", table.blink2); | ||
541 | IWL_ERR(mvm, "0x%08X | interruptlink1\n", table.ilink1); | ||
542 | IWL_ERR(mvm, "0x%08X | interruptlink2\n", table.ilink2); | ||
543 | IWL_ERR(mvm, "0x%08X | data1\n", table.data1); | ||
544 | IWL_ERR(mvm, "0x%08X | data2\n", table.data2); | ||
545 | IWL_ERR(mvm, "0x%08X | data3\n", table.data3); | ||
546 | IWL_ERR(mvm, "0x%08X | beacon time\n", table.bcon_time); | ||
547 | IWL_ERR(mvm, "0x%08X | tsf low\n", table.tsf_low); | ||
548 | IWL_ERR(mvm, "0x%08X | tsf hi\n", table.tsf_hi); | ||
549 | IWL_ERR(mvm, "0x%08X | time gp1\n", table.gp1); | ||
550 | IWL_ERR(mvm, "0x%08X | time gp2\n", table.gp2); | ||
551 | IWL_ERR(mvm, "0x%08X | time gp3\n", table.gp3); | ||
552 | IWL_ERR(mvm, "0x%08X | uCode version\n", table.ucode_ver); | ||
553 | IWL_ERR(mvm, "0x%08X | hw version\n", table.hw_ver); | ||
554 | IWL_ERR(mvm, "0x%08X | board version\n", table.brd_ver); | ||
555 | IWL_ERR(mvm, "0x%08X | hcmd\n", table.hcmd); | ||
556 | IWL_ERR(mvm, "0x%08X | isr0\n", table.isr0); | ||
557 | IWL_ERR(mvm, "0x%08X | isr1\n", table.isr1); | ||
558 | IWL_ERR(mvm, "0x%08X | isr2\n", table.isr2); | ||
559 | IWL_ERR(mvm, "0x%08X | isr3\n", table.isr3); | ||
560 | IWL_ERR(mvm, "0x%08X | isr4\n", table.isr4); | ||
561 | IWL_ERR(mvm, "0x%08X | isr_pref\n", table.isr_pref); | ||
562 | IWL_ERR(mvm, "0x%08X | wait_event\n", table.wait_event); | ||
563 | IWL_ERR(mvm, "0x%08X | l2p_control\n", table.l2p_control); | ||
564 | IWL_ERR(mvm, "0x%08X | l2p_duration\n", table.l2p_duration); | ||
565 | IWL_ERR(mvm, "0x%08X | l2p_mhvalid\n", table.l2p_mhvalid); | ||
566 | IWL_ERR(mvm, "0x%08X | l2p_addr_match\n", table.l2p_addr_match); | ||
567 | IWL_ERR(mvm, "0x%08X | lmpm_pmg_sel\n", table.lmpm_pmg_sel); | ||
568 | IWL_ERR(mvm, "0x%08X | timestamp\n", table.u_timestamp); | ||
569 | IWL_ERR(mvm, "0x%08X | flow_handler\n", table.flow_handler); | ||
570 | |||
571 | if (mvm->support_umac_log) | ||
572 | iwl_mvm_dump_umac_error_log(mvm); | ||
573 | } | ||
574 | |||
575 | void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm) | 494 | void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm) |
576 | { | 495 | { |
577 | struct iwl_trans *trans = mvm->trans; | 496 | struct iwl_trans *trans = mvm->trans; |
578 | struct iwl_error_event_table table; | 497 | struct iwl_error_event_table table; |
579 | u32 base; | 498 | u32 base; |
580 | 499 | ||
581 | if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_NEW_VERSION)) { | ||
582 | iwl_mvm_dump_nic_error_log_old(mvm); | ||
583 | return; | ||
584 | } | ||
585 | |||
586 | base = mvm->error_event_table; | 500 | base = mvm->error_event_table; |
587 | if (mvm->cur_ucode == IWL_UCODE_INIT) { | 501 | if (mvm->cur_ucode == IWL_UCODE_INIT) { |
588 | if (!base) | 502 | if (!base) |