Lines Matching refs:mvm

36 static int iwl_send_tx_ant_cfg(struct iwl_mvm *mvm, u8 valid_tx_ant)  in iwl_send_tx_ant_cfg()  argument
42 IWL_DEBUG_FW(mvm, "select valid tx ant: %u\n", valid_tx_ant); in iwl_send_tx_ant_cfg()
43 return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, 0, in iwl_send_tx_ant_cfg()
47 static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm) in iwl_send_rss_cfg_cmd() argument
60 if (mvm->trans->num_rx_queues == 1) in iwl_send_rss_cfg_cmd()
66 1 + (i % (mvm->trans->num_rx_queues - 1)); in iwl_send_rss_cfg_cmd()
69 return iwl_mvm_send_cmd_pdu(mvm, RSS_CONFIG_CMD, 0, sizeof(cmd), &cmd); in iwl_send_rss_cfg_cmd()
72 static int iwl_mvm_send_dqa_cmd(struct iwl_mvm *mvm) in iwl_mvm_send_dqa_cmd() argument
80 ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, sizeof(dqa_cmd), &dqa_cmd); in iwl_mvm_send_dqa_cmd()
82 IWL_ERR(mvm, "Failed to send DQA enabling command: %d\n", ret); in iwl_mvm_send_dqa_cmd()
84 IWL_DEBUG_FW(mvm, "Working in DQA mode\n"); in iwl_mvm_send_dqa_cmd()
89 void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm, in iwl_mvm_mfu_assert_dump_notif() argument
99 IWL_INFO(mvm, "MFUART assert id 0x%x occurred\n", in iwl_mvm_mfu_assert_dump_notif()
103 IWL_DEBUG_INFO(mvm, in iwl_mvm_mfu_assert_dump_notif()
114 struct iwl_mvm *mvm = in iwl_alive_fn() local
122 u32 version = iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP, in iwl_alive_fn()
133 mvm->trans->dbg.imr_data.imr_enable = in iwl_alive_fn()
135 mvm->trans->dbg.imr_data.imr_size = in iwl_alive_fn()
137 mvm->trans->dbg.imr_data.imr2sram_remainbyte = in iwl_alive_fn()
138 mvm->trans->dbg.imr_data.imr_size; in iwl_alive_fn()
139 mvm->trans->dbg.imr_data.imr_base_addr = in iwl_alive_fn()
141 mvm->trans->dbg.imr_data.imr_curr_addr = in iwl_alive_fn()
142 le64_to_cpu(mvm->trans->dbg.imr_data.imr_base_addr); in iwl_alive_fn()
143 IWL_DEBUG_FW(mvm, "IMR Enabled: 0x0%x size 0x0%x Address 0x%016llx\n", in iwl_alive_fn()
144 mvm->trans->dbg.imr_data.imr_enable, in iwl_alive_fn()
145 mvm->trans->dbg.imr_data.imr_size, in iwl_alive_fn()
146 le64_to_cpu(mvm->trans->dbg.imr_data.imr_base_addr)); in iwl_alive_fn()
148 if (!mvm->trans->dbg.imr_data.imr_enable) { in iwl_alive_fn()
149 for (i = 0; i < ARRAY_SIZE(mvm->trans->dbg.active_regions); i++) { in iwl_alive_fn()
153 reg_tlv = mvm->trans->dbg.active_regions[i]; in iwl_alive_fn()
164 mvm->trans->dbg.unsupported_region_msk |= BIT(i); in iwl_alive_fn()
183 mvm->trans->sku_id[0] = le32_to_cpu(palive->sku_id.data[0]); in iwl_alive_fn()
184 mvm->trans->sku_id[1] = le32_to_cpu(palive->sku_id.data[1]); in iwl_alive_fn()
185 mvm->trans->sku_id[2] = le32_to_cpu(palive->sku_id.data[2]); in iwl_alive_fn()
187 IWL_DEBUG_FW(mvm, "Got sku_id: 0x0%x 0x0%x 0x0%x\n", in iwl_alive_fn()
188 mvm->trans->sku_id[0], in iwl_alive_fn()
189 mvm->trans->sku_id[1], in iwl_alive_fn()
190 mvm->trans->sku_id[2]); in iwl_alive_fn()
222 iwl_fw_lmac1_set_alive_err_table(mvm->trans, lmac_error_event_table); in iwl_alive_fn()
225 mvm->trans->dbg.lmac_error_event_table[1] = in iwl_alive_fn()
233 mvm->trans->cfg->min_umac_error_event_table) { in iwl_alive_fn()
234 iwl_fw_umac_set_alive_err_table(mvm->trans, in iwl_alive_fn()
237 IWL_ERR(mvm, in iwl_alive_fn()
240 (mvm->fwrt.cur_fw_img == IWL_UCODE_INIT) ? in iwl_alive_fn()
248 IWL_DEBUG_FW(mvm, in iwl_alive_fn()
253 IWL_DEBUG_FW(mvm, "Alive ucode CDB\n"); in iwl_alive_fn()
255 IWL_DEBUG_FW(mvm, in iwl_alive_fn()
260 iwl_fwrt_update_fw_versions(&mvm->fwrt, lmac1, umac); in iwl_alive_fn()
288 static void iwl_mvm_print_pd_notification(struct iwl_mvm *mvm) in iwl_mvm_print_pd_notification() argument
291 IWL_ERR(mvm, #reg_name ": 0x%x\n", iwl_read_umac_prph(trans, reg_name)) in iwl_mvm_print_pd_notification()
293 struct iwl_trans *trans = mvm->trans; in iwl_mvm_print_pd_notification()
311 static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm, in iwl_mvm_load_ucode_wait_alive() argument
318 enum iwl_ucode_type old_type = mvm->fwrt.cur_fw_img; in iwl_mvm_load_ucode_wait_alive()
321 ucode_type == IWL_UCODE_INIT || iwl_mvm_has_unified_ucode(mvm); in iwl_mvm_load_ucode_wait_alive()
324 iwl_fw_dbg_conf_usniffer(mvm->fw, FW_DBG_START_FROM_ALIVE) && in iwl_mvm_load_ucode_wait_alive()
325 !(fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_load_ucode_wait_alive()
327 fw = iwl_get_ucode_image(mvm->fw, IWL_UCODE_REGULAR_USNIFFER); in iwl_mvm_load_ucode_wait_alive()
329 fw = iwl_get_ucode_image(mvm->fw, ucode_type); in iwl_mvm_load_ucode_wait_alive()
332 iwl_fw_set_current_image(&mvm->fwrt, ucode_type); in iwl_mvm_load_ucode_wait_alive()
333 clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); in iwl_mvm_load_ucode_wait_alive()
335 iwl_init_notification_wait(&mvm->notif_wait, &alive_wait, in iwl_mvm_load_ucode_wait_alive()
344 ret = iwl_trans_start_fw(mvm->trans, fw, run_in_rfkill); in iwl_mvm_load_ucode_wait_alive()
346 iwl_fw_set_current_image(&mvm->fwrt, old_type); in iwl_mvm_load_ucode_wait_alive()
347 iwl_remove_notification(&mvm->notif_wait, &alive_wait); in iwl_mvm_load_ucode_wait_alive()
355 ret = iwl_wait_notification(&mvm->notif_wait, &alive_wait, in iwl_mvm_load_ucode_wait_alive()
358 struct iwl_trans *trans = mvm->trans; in iwl_mvm_load_ucode_wait_alive()
363 IWL_ERR(mvm, in iwl_mvm_load_ucode_wait_alive()
370 IWL_ERR(mvm, in iwl_mvm_load_ucode_wait_alive()
376 iwl_mvm_print_pd_notification(mvm); in iwl_mvm_load_ucode_wait_alive()
381 IWL_ERR(mvm, "UMAC PC: 0x%x\n", in iwl_mvm_load_ucode_wait_alive()
384 IWL_ERR(mvm, "LMAC PC: 0x%x\n", in iwl_mvm_load_ucode_wait_alive()
387 if (iwl_mvm_is_cdb_supported(mvm)) in iwl_mvm_load_ucode_wait_alive()
388 IWL_ERR(mvm, "LMAC2 PC: 0x%x\n", in iwl_mvm_load_ucode_wait_alive()
394 iwl_fw_dbg_error_collect(&mvm->fwrt, in iwl_mvm_load_ucode_wait_alive()
397 iwl_fw_set_current_image(&mvm->fwrt, old_type); in iwl_mvm_load_ucode_wait_alive()
402 IWL_ERR(mvm, "Loaded ucode is not valid!\n"); in iwl_mvm_load_ucode_wait_alive()
403 iwl_fw_set_current_image(&mvm->fwrt, old_type); in iwl_mvm_load_ucode_wait_alive()
407 ret = iwl_pnvm_load(mvm->trans, &mvm->notif_wait); in iwl_mvm_load_ucode_wait_alive()
409 IWL_ERR(mvm, "Timeout waiting for PNVM load!\n"); in iwl_mvm_load_ucode_wait_alive()
410 iwl_fw_set_current_image(&mvm->fwrt, old_type); in iwl_mvm_load_ucode_wait_alive()
414 iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr); in iwl_mvm_load_ucode_wait_alive()
425 memset(&mvm->queue_info, 0, sizeof(mvm->queue_info)); in iwl_mvm_load_ucode_wait_alive()
432 mvm->queue_info[IWL_MVM_DQA_CMD_QUEUE].tid_bitmap = in iwl_mvm_load_ucode_wait_alive()
435 set_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); in iwl_mvm_load_ucode_wait_alive()
437 iwl_fw_set_dbg_rec_on(&mvm->fwrt); in iwl_mvm_load_ucode_wait_alive()
446 cfg80211_bss_flush(mvm->hw->wiphy); in iwl_mvm_load_ucode_wait_alive()
451 static int iwl_run_unified_mvm_ucode(struct iwl_mvm *mvm) in iwl_run_unified_mvm_ucode() argument
463 if (mvm->trans->cfg->tx_with_siso_diversity) in iwl_run_unified_mvm_ucode()
466 lockdep_assert_held(&mvm->mutex); in iwl_run_unified_mvm_ucode()
468 mvm->rfkill_safe_init_done = false; in iwl_run_unified_mvm_ucode()
470 iwl_init_notification_wait(&mvm->notif_wait, in iwl_run_unified_mvm_ucode()
477 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_EARLY, NULL); in iwl_run_unified_mvm_ucode()
480 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR); in iwl_run_unified_mvm_ucode()
482 IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret); in iwl_run_unified_mvm_ucode()
485 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_AFTER_ALIVE, in iwl_run_unified_mvm_ucode()
491 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(SYSTEM_GROUP, in iwl_run_unified_mvm_ucode()
496 IWL_ERR(mvm, "Failed to run init config command: %d\n", in iwl_run_unified_mvm_ucode()
502 if (mvm->nvm_file_name) { in iwl_run_unified_mvm_ucode()
503 ret = iwl_read_external_nvm(mvm->trans, mvm->nvm_file_name, in iwl_run_unified_mvm_ucode()
504 mvm->nvm_sections); in iwl_run_unified_mvm_ucode()
507 ret = iwl_mvm_load_nvm_to_nic(mvm); in iwl_run_unified_mvm_ucode()
512 if (IWL_MVM_PARSE_NVM && !mvm->nvm_data) { in iwl_run_unified_mvm_ucode()
513 ret = iwl_nvm_init(mvm); in iwl_run_unified_mvm_ucode()
515 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); in iwl_run_unified_mvm_ucode()
520 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(REGULATORY_AND_NVM_GROUP, in iwl_run_unified_mvm_ucode()
525 IWL_ERR(mvm, "Failed to run complete NVM access: %d\n", in iwl_run_unified_mvm_ucode()
531 ret = iwl_wait_notification(&mvm->notif_wait, &init_wait, in iwl_run_unified_mvm_ucode()
537 if (!IWL_MVM_PARSE_NVM && !mvm->nvm_data) { in iwl_run_unified_mvm_ucode()
538 mvm->nvm_data = iwl_get_nvm(mvm->trans, mvm->fw); in iwl_run_unified_mvm_ucode()
539 if (IS_ERR(mvm->nvm_data)) { in iwl_run_unified_mvm_ucode()
540 ret = PTR_ERR(mvm->nvm_data); in iwl_run_unified_mvm_ucode()
541 mvm->nvm_data = NULL; in iwl_run_unified_mvm_ucode()
542 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); in iwl_run_unified_mvm_ucode()
547 mvm->rfkill_safe_init_done = true; in iwl_run_unified_mvm_ucode()
552 iwl_remove_notification(&mvm->notif_wait, &init_wait); in iwl_run_unified_mvm_ucode()
557 static void iwl_mvm_phy_filter_init(struct iwl_mvm *mvm, in iwl_mvm_phy_filter_init() argument
585 static void iwl_mvm_phy_filter_init(struct iwl_mvm *mvm, in iwl_mvm_phy_filter_init() argument
592 static int iwl_mvm_sgom_init(struct iwl_mvm *mvm) in iwl_mvm_sgom_init() argument
600 .data[0] = &mvm->fwrt.sgom_table, in iwl_mvm_sgom_init()
601 .len[0] = sizeof(mvm->fwrt.sgom_table), in iwl_mvm_sgom_init()
605 if (!mvm->fwrt.sgom_enabled) { in iwl_mvm_sgom_init()
606 IWL_DEBUG_RADIO(mvm, "SGOM table is disabled\n"); in iwl_mvm_sgom_init()
610 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd.id, in iwl_mvm_sgom_init()
614 IWL_DEBUG_RADIO(mvm, "command version is unsupported. version = %d\n", in iwl_mvm_sgom_init()
619 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_sgom_init()
621 IWL_ERR(mvm, "failed to send SAR_OFFSET_MAPPING_CMD (%d)\n", ret); in iwl_mvm_sgom_init()
627 static int iwl_mvm_sgom_init(struct iwl_mvm *mvm) in iwl_mvm_sgom_init() argument
633 static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm) in iwl_send_phy_cfg_cmd() argument
637 enum iwl_ucode_type ucode_type = mvm->fwrt.cur_fw_img; in iwl_send_phy_cfg_cmd()
642 if (iwl_mvm_has_unified_ucode(mvm) && in iwl_send_phy_cfg_cmd()
643 !mvm->trans->cfg->tx_with_siso_diversity) in iwl_send_phy_cfg_cmd()
646 if (mvm->trans->cfg->tx_with_siso_diversity) { in iwl_send_phy_cfg_cmd()
656 phy_cfg_cmd.phy_cfg = cpu_to_le32(iwl_mvm_get_phy_config(mvm)); in iwl_send_phy_cfg_cmd()
660 cpu_to_le32(mvm->trans->trans_cfg->extra_phy_cfg_flags); in iwl_send_phy_cfg_cmd()
663 mvm->fw->default_calib[ucode_type].event_trigger; in iwl_send_phy_cfg_cmd()
665 mvm->fw->default_calib[ucode_type].flow_trigger; in iwl_send_phy_cfg_cmd()
667 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, in iwl_send_phy_cfg_cmd()
670 iwl_mvm_phy_filter_init(mvm, &phy_filters); in iwl_send_phy_cfg_cmd()
675 IWL_DEBUG_INFO(mvm, "Sending Phy CFG command: 0x%x\n", in iwl_send_phy_cfg_cmd()
679 return iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, cmd_size, &phy_cfg_cmd); in iwl_send_phy_cfg_cmd()
682 int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm) in iwl_run_init_mvm_ucode() argument
691 if (iwl_mvm_has_unified_ucode(mvm)) in iwl_run_init_mvm_ucode()
692 return iwl_run_unified_mvm_ucode(mvm); in iwl_run_init_mvm_ucode()
694 lockdep_assert_held(&mvm->mutex); in iwl_run_init_mvm_ucode()
696 mvm->rfkill_safe_init_done = false; in iwl_run_init_mvm_ucode()
698 iwl_init_notification_wait(&mvm->notif_wait, in iwl_run_init_mvm_ucode()
703 mvm->phy_db); in iwl_run_init_mvm_ucode()
705 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_EARLY, NULL); in iwl_run_init_mvm_ucode()
708 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_INIT); in iwl_run_init_mvm_ucode()
710 IWL_ERR(mvm, "Failed to start INIT ucode: %d\n", ret); in iwl_run_init_mvm_ucode()
714 if (mvm->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_8000) { in iwl_run_init_mvm_ucode()
715 ret = iwl_mvm_send_bt_init_conf(mvm); in iwl_run_init_mvm_ucode()
721 if (!mvm->nvm_data) { in iwl_run_init_mvm_ucode()
722 ret = iwl_nvm_init(mvm); in iwl_run_init_mvm_ucode()
724 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); in iwl_run_init_mvm_ucode()
730 if (mvm->nvm_file_name) { in iwl_run_init_mvm_ucode()
731 ret = iwl_mvm_load_nvm_to_nic(mvm); in iwl_run_init_mvm_ucode()
736 WARN_ONCE(mvm->nvm_data->nvm_version < mvm->trans->cfg->nvm_ver, in iwl_run_init_mvm_ucode()
738 mvm->nvm_data->nvm_version, mvm->trans->cfg->nvm_ver); in iwl_run_init_mvm_ucode()
744 if (iwl_mvm_is_radio_hw_killed(mvm)) { in iwl_run_init_mvm_ucode()
745 IWL_DEBUG_RF_KILL(mvm, in iwl_run_init_mvm_ucode()
750 mvm->rfkill_safe_init_done = true; in iwl_run_init_mvm_ucode()
753 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm)); in iwl_run_init_mvm_ucode()
757 ret = iwl_send_phy_cfg_cmd(mvm); in iwl_run_init_mvm_ucode()
759 IWL_ERR(mvm, "Failed to run INIT calibrations: %d\n", in iwl_run_init_mvm_ucode()
768 ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait, in iwl_run_init_mvm_ucode()
773 if (iwl_mvm_is_radio_hw_killed(mvm)) { in iwl_run_init_mvm_ucode()
774 IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n"); in iwl_run_init_mvm_ucode()
777 IWL_ERR(mvm, "Failed to run INIT calibrations: %d\n", in iwl_run_init_mvm_ucode()
784 iwl_remove_notification(&mvm->notif_wait, &calib_wait); in iwl_run_init_mvm_ucode()
786 mvm->rfkill_safe_init_done = false; in iwl_run_init_mvm_ucode()
787 if (iwlmvm_mod_params.init_dbg && !mvm->nvm_data) { in iwl_run_init_mvm_ucode()
789 mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) + in iwl_run_init_mvm_ucode()
793 if (!mvm->nvm_data) in iwl_run_init_mvm_ucode()
795 mvm->nvm_data->bands[0].channels = mvm->nvm_data->channels; in iwl_run_init_mvm_ucode()
796 mvm->nvm_data->bands[0].n_channels = 1; in iwl_run_init_mvm_ucode()
797 mvm->nvm_data->bands[0].n_bitrates = 1; in iwl_run_init_mvm_ucode()
798 mvm->nvm_data->bands[0].bitrates = in iwl_run_init_mvm_ucode()
799 (void *)((u8 *)mvm->nvm_data->channels + 1); in iwl_run_init_mvm_ucode()
800 mvm->nvm_data->bands[0].bitrates->hw_value = 10; in iwl_run_init_mvm_ucode()
806 static int iwl_mvm_config_ltr(struct iwl_mvm *mvm) in iwl_mvm_config_ltr() argument
812 if (!mvm->trans->ltr_enabled) in iwl_mvm_config_ltr()
815 return iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0, in iwl_mvm_config_ltr()
820 int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b) in iwl_mvm_sar_select_profile() argument
830 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, in iwl_mvm_sar_select_profile()
836 cmd.v7.flags = cpu_to_le32(mvm->fwrt.reduced_power_flags); in iwl_mvm_sar_select_profile()
841 } else if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_sar_select_profile()
846 } else if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_sar_select_profile()
860 ret = iwl_sar_select_profile(&mvm->fwrt, per_chain, in iwl_mvm_sar_select_profile()
870 IWL_DEBUG_RADIO(mvm, "Sending REDUCE_TX_POWER_CMD per chain\n"); in iwl_mvm_sar_select_profile()
871 return iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, len, &cmd); in iwl_mvm_sar_select_profile()
874 int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm) in iwl_mvm_get_sar_geo_profile() argument
885 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd.id, in iwl_mvm_get_sar_geo_profile()
898 else if (fw_has_api(&mvm->fwrt.fw->ucode_capa, in iwl_mvm_get_sar_geo_profile()
904 if (!iwl_sar_geo_support(&mvm->fwrt)) in iwl_mvm_get_sar_geo_profile()
909 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_get_sar_geo_profile()
911 IWL_ERR(mvm, "Failed to get geographic profile info %d\n", ret); in iwl_mvm_get_sar_geo_profile()
925 static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) in iwl_mvm_sar_geo_init() argument
934 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, in iwl_mvm_sar_geo_init()
961 } else if (fw_has_api(&mvm->fwrt.fw->ucode_capa, in iwl_mvm_sar_geo_init()
981 ret = iwl_sar_geo_init(&mvm->fwrt, &cmd.v1.table[0][0], in iwl_mvm_sar_geo_init()
992 if (mvm->fwrt.geo_rev == 1) in iwl_mvm_sar_geo_init()
1008 else if (fw_has_api(&mvm->fwrt.fw->ucode_capa, in iwl_mvm_sar_geo_init()
1012 return iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, len, &cmd); in iwl_mvm_sar_geo_init()
1015 int iwl_mvm_ppag_send_cmd(struct iwl_mvm *mvm) in iwl_mvm_ppag_send_cmd() argument
1020 ret = iwl_read_ppag_table(&mvm->fwrt, &cmd, &cmd_size); in iwl_mvm_ppag_send_cmd()
1025 IWL_DEBUG_RADIO(mvm, "Sending PER_PLATFORM_ANT_GAIN_CMD\n"); in iwl_mvm_ppag_send_cmd()
1026 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(PHY_OPS_GROUP, in iwl_mvm_ppag_send_cmd()
1030 IWL_ERR(mvm, "failed to send PER_PLATFORM_ANT_GAIN_CMD (%d)\n", in iwl_mvm_ppag_send_cmd()
1036 static int iwl_mvm_ppag_init(struct iwl_mvm *mvm) in iwl_mvm_ppag_init() argument
1039 if (!(iwl_acpi_is_ppag_approved(&mvm->fwrt))) in iwl_mvm_ppag_init()
1042 return iwl_mvm_ppag_send_cmd(mvm); in iwl_mvm_ppag_init()
1090 static void iwl_mvm_tas_init(struct iwl_mvm *mvm) in iwl_mvm_tas_init() argument
1100 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TAS_CFG)) { in iwl_mvm_tas_init()
1101 IWL_DEBUG_RADIO(mvm, "TAS not enabled in FW\n"); in iwl_mvm_tas_init()
1105 fw_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, in iwl_mvm_tas_init()
1108 ret = iwl_acpi_get_tas(&mvm->fwrt, &cmd, fw_ver); in iwl_mvm_tas_init()
1110 IWL_DEBUG_RADIO(mvm, in iwl_mvm_tas_init()
1120 IWL_DEBUG_RADIO(mvm, in iwl_mvm_tas_init()
1129 IWL_DEBUG_RADIO(mvm, in iwl_mvm_tas_init()
1140 ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, cmd_size, &cmd); in iwl_mvm_tas_init()
1142 IWL_DEBUG_RADIO(mvm, "failed to send TAS_CONFIG (%d)\n", ret); in iwl_mvm_tas_init()
1145 static u8 iwl_mvm_eval_dsm_rfi(struct iwl_mvm *mvm) in iwl_mvm_eval_dsm_rfi() argument
1148 int ret = iwl_acpi_get_dsm_u8(mvm->fwrt.dev, 0, DSM_RFI_FUNC_ENABLE, in iwl_mvm_eval_dsm_rfi()
1152 IWL_DEBUG_RADIO(mvm, "Failed to get DSM RFI, ret=%d\n", ret); in iwl_mvm_eval_dsm_rfi()
1155 IWL_DEBUG_RADIO(mvm, "DSM RFI got invalid value, ret=%d\n", in iwl_mvm_eval_dsm_rfi()
1159 IWL_DEBUG_RADIO(mvm, "DSM RFI is evaluated to enable\n"); in iwl_mvm_eval_dsm_rfi()
1163 IWL_DEBUG_RADIO(mvm, "DSM RFI is disabled\n"); in iwl_mvm_eval_dsm_rfi()
1169 static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm) in iwl_mvm_lari_cfg() argument
1175 cmd.config_bitmap = iwl_acpi_get_lari_config_bitmap(&mvm->fwrt); in iwl_mvm_lari_cfg()
1177 ret = iwl_acpi_get_dsm_u32(mvm->fwrt.dev, 0, DSM_FUNC_11AX_ENABLEMENT, in iwl_mvm_lari_cfg()
1182 ret = iwl_acpi_get_dsm_u32(mvm->fwrt.dev, 0, in iwl_mvm_lari_cfg()
1188 ret = iwl_acpi_get_dsm_u32(mvm->fwrt.dev, 0, in iwl_mvm_lari_cfg()
1194 ret = iwl_acpi_get_dsm_u32(mvm->fwrt.dev, 0, in iwl_mvm_lari_cfg()
1200 ret = iwl_acpi_get_dsm_u32(mvm->fwrt.dev, 0, in iwl_mvm_lari_cfg()
1213 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, in iwl_mvm_lari_cfg()
1238 IWL_DEBUG_RADIO(mvm, in iwl_mvm_lari_cfg()
1242 IWL_DEBUG_RADIO(mvm, in iwl_mvm_lari_cfg()
1247 IWL_DEBUG_RADIO(mvm, in iwl_mvm_lari_cfg()
1251 ret = iwl_mvm_send_cmd_pdu(mvm, in iwl_mvm_lari_cfg()
1256 IWL_DEBUG_RADIO(mvm, in iwl_mvm_lari_cfg()
1262 void iwl_mvm_get_acpi_tables(struct iwl_mvm *mvm) in iwl_mvm_get_acpi_tables() argument
1267 ret = iwl_acpi_get_ppag_table(&mvm->fwrt); in iwl_mvm_get_acpi_tables()
1269 IWL_DEBUG_RADIO(mvm, in iwl_mvm_get_acpi_tables()
1275 ret = iwl_sar_get_wrds_table(&mvm->fwrt); in iwl_mvm_get_acpi_tables()
1277 IWL_DEBUG_RADIO(mvm, in iwl_mvm_get_acpi_tables()
1284 if (!iwl_sar_get_wgds_table(&mvm->fwrt)) { in iwl_mvm_get_acpi_tables()
1291 IWL_ERR(mvm, "BIOS contains WGDS but no WRDS\n"); in iwl_mvm_get_acpi_tables()
1295 ret = iwl_sar_get_ewrd_table(&mvm->fwrt); in iwl_mvm_get_acpi_tables()
1299 IWL_DEBUG_RADIO(mvm, in iwl_mvm_get_acpi_tables()
1304 if (iwl_sar_geo_support(&mvm->fwrt)) { in iwl_mvm_get_acpi_tables()
1305 ret = iwl_sar_get_wgds_table(&mvm->fwrt); in iwl_mvm_get_acpi_tables()
1307 IWL_DEBUG_RADIO(mvm, in iwl_mvm_get_acpi_tables()
1316 inline int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, in iwl_mvm_sar_select_profile() argument
1322 inline int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm) in iwl_mvm_get_sar_geo_profile() argument
1327 static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) in iwl_mvm_sar_geo_init() argument
1332 int iwl_mvm_ppag_send_cmd(struct iwl_mvm *mvm) in iwl_mvm_ppag_send_cmd() argument
1337 static int iwl_mvm_ppag_init(struct iwl_mvm *mvm) in iwl_mvm_ppag_init() argument
1342 static void iwl_mvm_tas_init(struct iwl_mvm *mvm) in iwl_mvm_tas_init() argument
1346 static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm) in iwl_mvm_lari_cfg() argument
1350 static u8 iwl_mvm_eval_dsm_rfi(struct iwl_mvm *mvm) in iwl_mvm_eval_dsm_rfi() argument
1355 void iwl_mvm_get_acpi_tables(struct iwl_mvm *mvm) in iwl_mvm_get_acpi_tables() argument
1361 void iwl_mvm_send_recovery_cmd(struct iwl_mvm *mvm, u32 flags) in iwl_mvm_send_recovery_cmd() argument
1363 u32 error_log_size = mvm->fw->ucode_capa.error_log_size; in iwl_mvm_send_recovery_cmd()
1384 if (!mvm->error_recovery_buf) in iwl_mvm_send_recovery_cmd()
1387 host_cmd.data[1] = mvm->error_recovery_buf; in iwl_mvm_send_recovery_cmd()
1393 ret = iwl_mvm_send_cmd(mvm, &host_cmd); in iwl_mvm_send_recovery_cmd()
1394 kfree(mvm->error_recovery_buf); in iwl_mvm_send_recovery_cmd()
1395 mvm->error_recovery_buf = NULL; in iwl_mvm_send_recovery_cmd()
1398 IWL_ERR(mvm, "Failed to send recovery cmd %d\n", ret); in iwl_mvm_send_recovery_cmd()
1406 IWL_ERR(mvm, in iwl_mvm_send_recovery_cmd()
1412 static int iwl_mvm_sar_init(struct iwl_mvm *mvm) in iwl_mvm_sar_init() argument
1414 return iwl_mvm_sar_select_profile(mvm, 1, 1); in iwl_mvm_sar_init()
1417 static int iwl_mvm_load_rt_fw(struct iwl_mvm *mvm) in iwl_mvm_load_rt_fw() argument
1421 if (iwl_mvm_has_unified_ucode(mvm)) in iwl_mvm_load_rt_fw()
1422 return iwl_run_unified_mvm_ucode(mvm); in iwl_mvm_load_rt_fw()
1424 ret = iwl_run_init_mvm_ucode(mvm); in iwl_mvm_load_rt_fw()
1427 IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret); in iwl_mvm_load_rt_fw()
1434 iwl_fw_dbg_stop_sync(&mvm->fwrt); in iwl_mvm_load_rt_fw()
1435 iwl_trans_stop_device(mvm->trans); in iwl_mvm_load_rt_fw()
1436 ret = iwl_trans_start_hw(mvm->trans); in iwl_mvm_load_rt_fw()
1440 mvm->rfkill_safe_init_done = false; in iwl_mvm_load_rt_fw()
1441 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR); in iwl_mvm_load_rt_fw()
1445 mvm->rfkill_safe_init_done = true; in iwl_mvm_load_rt_fw()
1447 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_AFTER_ALIVE, in iwl_mvm_load_rt_fw()
1450 return iwl_init_paging(&mvm->fwrt, mvm->fwrt.cur_fw_img); in iwl_mvm_load_rt_fw()
1453 int iwl_mvm_up(struct iwl_mvm *mvm) in iwl_mvm_up() argument
1460 lockdep_assert_held(&mvm->mutex); in iwl_mvm_up()
1462 ret = iwl_trans_start_hw(mvm->trans); in iwl_mvm_up()
1466 ret = iwl_mvm_load_rt_fw(mvm); in iwl_mvm_up()
1468 IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret); in iwl_mvm_up()
1470 iwl_fw_dbg_error_collect(&mvm->fwrt, in iwl_mvm_up()
1475 iwl_get_shared_mem_conf(&mvm->fwrt); in iwl_mvm_up()
1477 ret = iwl_mvm_sf_update(mvm, NULL, false); in iwl_mvm_up()
1479 IWL_ERR(mvm, "Failed to initialize Smart Fifo\n"); in iwl_mvm_up()
1481 if (!iwl_trans_dbg_ini_valid(mvm->trans)) { in iwl_mvm_up()
1482 mvm->fwrt.dump.conf = FW_DBG_INVALID; in iwl_mvm_up()
1484 if (mvm->fw->dbg.dest_tlv) in iwl_mvm_up()
1485 mvm->fwrt.dump.conf = FW_DBG_START_FROM_ALIVE; in iwl_mvm_up()
1486 iwl_fw_start_dbg_conf(&mvm->fwrt, FW_DBG_START_FROM_ALIVE); in iwl_mvm_up()
1489 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm)); in iwl_mvm_up()
1493 if (!iwl_mvm_has_unified_ucode(mvm)) { in iwl_mvm_up()
1495 ret = iwl_send_phy_db_data(mvm->phy_db); in iwl_mvm_up()
1500 ret = iwl_send_phy_cfg_cmd(mvm); in iwl_mvm_up()
1504 ret = iwl_mvm_send_bt_init_conf(mvm); in iwl_mvm_up()
1508 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_up()
1510 ret = iwl_set_soc_latency(&mvm->fwrt); in iwl_mvm_up()
1516 ret = iwl_configure_rxq(&mvm->fwrt); in iwl_mvm_up()
1520 if (iwl_mvm_has_new_rx_api(mvm)) { in iwl_mvm_up()
1521 ret = iwl_send_rss_cfg_cmd(mvm); in iwl_mvm_up()
1523 IWL_ERR(mvm, "Failed to configure RSS queues: %d\n", in iwl_mvm_up()
1530 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) in iwl_mvm_up()
1531 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL); in iwl_mvm_up()
1533 mvm->tdls_cs.peer.sta_id = IWL_MVM_INVALID_STA; in iwl_mvm_up()
1536 memset(&mvm->last_quota_cmd, 0xff, sizeof(mvm->last_quota_cmd)); in iwl_mvm_up()
1538 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_DQA_SUPPORT)) { in iwl_mvm_up()
1539 ret = iwl_mvm_send_dqa_cmd(mvm); in iwl_mvm_up()
1550 if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) < 12) { in iwl_mvm_up()
1555 ret = iwl_mvm_add_aux_sta(mvm, MAC_INDEX_AUX); in iwl_mvm_up()
1563 sband = mvm->hw->wiphy->bands[i++]; in iwl_mvm_up()
1579 ret = iwl_mvm_phy_ctxt_add(mvm, &mvm->phy_ctxts[i], in iwl_mvm_up()
1585 if (iwl_mvm_is_tt_in_fw(mvm)) { in iwl_mvm_up()
1590 iwl_mvm_send_temp_report_ths_cmd(mvm); in iwl_mvm_up()
1593 iwl_mvm_tt_tx_backoff(mvm, 0); in iwl_mvm_up()
1603 if (iwl_mvm_is_ctdp_supported(mvm)) { in iwl_mvm_up()
1604 ret = iwl_mvm_ctdp_command(mvm, CTDP_CMD_OPERATION_START, in iwl_mvm_up()
1605 mvm->cooling_dev.cur_state); in iwl_mvm_up()
1611 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_SET_LTR_GEN2)) in iwl_mvm_up()
1612 WARN_ON(iwl_mvm_config_ltr(mvm)); in iwl_mvm_up()
1614 ret = iwl_mvm_power_update_device(mvm); in iwl_mvm_up()
1618 iwl_mvm_lari_cfg(mvm); in iwl_mvm_up()
1623 if (!test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status)) { in iwl_mvm_up()
1624 ret = iwl_mvm_init_mcc(mvm); in iwl_mvm_up()
1629 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { in iwl_mvm_up()
1630 mvm->scan_type = IWL_SCAN_TYPE_NOT_SET; in iwl_mvm_up()
1631 mvm->hb_scan_type = IWL_SCAN_TYPE_NOT_SET; in iwl_mvm_up()
1632 ret = iwl_mvm_config_scan(mvm); in iwl_mvm_up()
1637 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_up()
1638 iwl_mvm_send_recovery_cmd(mvm, ERROR_RECOVERY_UPDATE_DB); in iwl_mvm_up()
1640 if (iwl_acpi_get_eckv(mvm->dev, &mvm->ext_clock_valid)) in iwl_mvm_up()
1641 IWL_DEBUG_INFO(mvm, "ECKV table doesn't exist in BIOS\n"); in iwl_mvm_up()
1643 ret = iwl_mvm_ppag_init(mvm); in iwl_mvm_up()
1647 ret = iwl_mvm_sar_init(mvm); in iwl_mvm_up()
1649 ret = iwl_mvm_sar_geo_init(mvm); in iwl_mvm_up()
1653 ret = iwl_mvm_sgom_init(mvm); in iwl_mvm_up()
1657 iwl_mvm_tas_init(mvm); in iwl_mvm_up()
1658 iwl_mvm_leds_sync(mvm); in iwl_mvm_up()
1660 iwl_mvm_ftm_initiator_smooth_config(mvm); in iwl_mvm_up()
1662 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_up()
1664 if (iwl_mvm_eval_dsm_rfi(mvm) == DSM_VALUE_RFI_ENABLE) in iwl_mvm_up()
1665 iwl_rfi_send_config_cmd(mvm, NULL); in iwl_mvm_up()
1668 IWL_DEBUG_INFO(mvm, "RT uCode started.\n"); in iwl_mvm_up()
1672 iwl_mvm_stop_device(mvm); in iwl_mvm_up()
1676 int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm) in iwl_mvm_load_d3_fw() argument
1680 lockdep_assert_held(&mvm->mutex); in iwl_mvm_load_d3_fw()
1682 ret = iwl_trans_start_hw(mvm->trans); in iwl_mvm_load_d3_fw()
1686 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_WOWLAN); in iwl_mvm_load_d3_fw()
1688 IWL_ERR(mvm, "Failed to start WoWLAN firmware: %d\n", ret); in iwl_mvm_load_d3_fw()
1692 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm)); in iwl_mvm_load_d3_fw()
1697 ret = iwl_send_phy_db_data(mvm->phy_db); in iwl_mvm_load_d3_fw()
1701 ret = iwl_send_phy_cfg_cmd(mvm); in iwl_mvm_load_d3_fw()
1706 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) in iwl_mvm_load_d3_fw()
1707 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL); in iwl_mvm_load_d3_fw()
1709 if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) < 12) { in iwl_mvm_load_d3_fw()
1718 ret = iwl_mvm_add_aux_sta(mvm, MAC_INDEX_AUX); in iwl_mvm_load_d3_fw()
1725 iwl_mvm_stop_device(mvm); in iwl_mvm_load_d3_fw()
1729 void iwl_mvm_rx_mfuart_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_mfuart_notif() argument
1735 IWL_DEBUG_INFO(mvm, in iwl_mvm_rx_mfuart_notif()
1743 IWL_DEBUG_INFO(mvm, in iwl_mvm_rx_mfuart_notif()