Lines Matching refs:mvm
90 iwl_get_ucode_image(struct iwl_mvm *mvm, enum iwl_ucode_type ucode_type) in iwl_get_ucode_image() argument
95 return &mvm->fw->img[ucode_type]; in iwl_get_ucode_image()
98 static int iwl_send_tx_ant_cfg(struct iwl_mvm *mvm, u8 valid_tx_ant) in iwl_send_tx_ant_cfg() argument
104 IWL_DEBUG_FW(mvm, "select valid tx ant: %u\n", valid_tx_ant); in iwl_send_tx_ant_cfg()
105 return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, 0, in iwl_send_tx_ant_cfg()
112 struct iwl_mvm *mvm = in iwl_alive_fn() local
122 mvm->support_umac_log = false; in iwl_alive_fn()
123 mvm->error_event_table = in iwl_alive_fn()
125 mvm->log_event_table = in iwl_alive_fn()
131 IWL_DEBUG_FW(mvm, in iwl_alive_fn()
138 mvm->error_event_table = in iwl_alive_fn()
140 mvm->log_event_table = in iwl_alive_fn()
143 mvm->umac_error_event_table = in iwl_alive_fn()
145 mvm->sf_space.addr = le32_to_cpu(palive2->st_fwrd_addr); in iwl_alive_fn()
146 mvm->sf_space.size = le32_to_cpu(palive2->st_fwrd_size); in iwl_alive_fn()
150 if (mvm->umac_error_event_table) in iwl_alive_fn()
151 mvm->support_umac_log = true; in iwl_alive_fn()
153 IWL_DEBUG_FW(mvm, in iwl_alive_fn()
158 IWL_DEBUG_FW(mvm, in iwl_alive_fn()
164 mvm->error_event_table = in iwl_alive_fn()
166 mvm->log_event_table = in iwl_alive_fn()
169 mvm->umac_error_event_table = in iwl_alive_fn()
171 mvm->sf_space.addr = le32_to_cpu(palive->st_fwrd_addr); in iwl_alive_fn()
172 mvm->sf_space.size = le32_to_cpu(palive->st_fwrd_size); in iwl_alive_fn()
176 if (mvm->umac_error_event_table) in iwl_alive_fn()
177 mvm->support_umac_log = true; in iwl_alive_fn()
179 IWL_DEBUG_FW(mvm, in iwl_alive_fn()
184 IWL_DEBUG_FW(mvm, in iwl_alive_fn()
208 static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm, in iwl_mvm_load_ucode_wait_alive() argument
215 enum iwl_ucode_type old_type = mvm->cur_ucode; in iwl_mvm_load_ucode_wait_alive()
220 iwl_fw_dbg_conf_usniffer(mvm->fw, FW_DBG_START_FROM_ALIVE)) in iwl_mvm_load_ucode_wait_alive()
221 fw = iwl_get_ucode_image(mvm, IWL_UCODE_REGULAR_USNIFFER); in iwl_mvm_load_ucode_wait_alive()
223 fw = iwl_get_ucode_image(mvm, ucode_type); in iwl_mvm_load_ucode_wait_alive()
226 mvm->cur_ucode = ucode_type; in iwl_mvm_load_ucode_wait_alive()
227 mvm->ucode_loaded = false; in iwl_mvm_load_ucode_wait_alive()
229 iwl_init_notification_wait(&mvm->notif_wait, &alive_wait, in iwl_mvm_load_ucode_wait_alive()
233 ret = iwl_trans_start_fw(mvm->trans, fw, ucode_type == IWL_UCODE_INIT); in iwl_mvm_load_ucode_wait_alive()
235 mvm->cur_ucode = old_type; in iwl_mvm_load_ucode_wait_alive()
236 iwl_remove_notification(&mvm->notif_wait, &alive_wait); in iwl_mvm_load_ucode_wait_alive()
244 ret = iwl_wait_notification(&mvm->notif_wait, &alive_wait, in iwl_mvm_load_ucode_wait_alive()
247 mvm->cur_ucode = old_type; in iwl_mvm_load_ucode_wait_alive()
252 IWL_ERR(mvm, "Loaded ucode is not valid!\n"); in iwl_mvm_load_ucode_wait_alive()
253 mvm->cur_ucode = old_type; in iwl_mvm_load_ucode_wait_alive()
261 st_fwrd_space.addr = mvm->sf_space.addr; in iwl_mvm_load_ucode_wait_alive()
262 st_fwrd_space.size = mvm->sf_space.size; in iwl_mvm_load_ucode_wait_alive()
263 ret = iwl_trans_update_sf(mvm->trans, &st_fwrd_space); in iwl_mvm_load_ucode_wait_alive()
265 IWL_ERR(mvm, "Failed to update SF size. ret %d\n", ret); in iwl_mvm_load_ucode_wait_alive()
269 iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr); in iwl_mvm_load_ucode_wait_alive()
281 if (i < mvm->first_agg_queue && i != IWL_MVM_CMD_QUEUE) in iwl_mvm_load_ucode_wait_alive()
282 mvm->queue_to_mac80211[i] = i; in iwl_mvm_load_ucode_wait_alive()
284 mvm->queue_to_mac80211[i] = IWL_INVALID_MAC80211_QUEUE; in iwl_mvm_load_ucode_wait_alive()
288 atomic_set(&mvm->mac80211_queue_stop_count[i], 0); in iwl_mvm_load_ucode_wait_alive()
290 mvm->ucode_loaded = true; in iwl_mvm_load_ucode_wait_alive()
295 static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm) in iwl_send_phy_cfg_cmd() argument
298 enum iwl_ucode_type ucode_type = mvm->cur_ucode; in iwl_send_phy_cfg_cmd()
301 phy_cfg_cmd.phy_cfg = cpu_to_le32(iwl_mvm_get_phy_config(mvm)); in iwl_send_phy_cfg_cmd()
303 mvm->fw->default_calib[ucode_type].event_trigger; in iwl_send_phy_cfg_cmd()
305 mvm->fw->default_calib[ucode_type].flow_trigger; in iwl_send_phy_cfg_cmd()
307 IWL_DEBUG_INFO(mvm, "Sending Phy CFG command: 0x%x\n", in iwl_send_phy_cfg_cmd()
310 return iwl_mvm_send_cmd_pdu(mvm, PHY_CONFIGURATION_CMD, 0, in iwl_send_phy_cfg_cmd()
314 int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) in iwl_run_init_mvm_ucode() argument
323 lockdep_assert_held(&mvm->mutex); in iwl_run_init_mvm_ucode()
325 if (WARN_ON_ONCE(mvm->calibrating)) in iwl_run_init_mvm_ucode()
328 iwl_init_notification_wait(&mvm->notif_wait, in iwl_run_init_mvm_ucode()
333 mvm->phy_db); in iwl_run_init_mvm_ucode()
336 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_INIT); in iwl_run_init_mvm_ucode()
338 IWL_ERR(mvm, "Failed to start INIT ucode: %d\n", ret); in iwl_run_init_mvm_ucode()
342 ret = iwl_send_bt_init_conf(mvm); in iwl_run_init_mvm_ucode()
349 ret = iwl_nvm_init(mvm, true); in iwl_run_init_mvm_ucode()
351 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); in iwl_run_init_mvm_ucode()
357 if (mvm->nvm_file_name) in iwl_run_init_mvm_ucode()
358 iwl_mvm_load_nvm_to_nic(mvm); in iwl_run_init_mvm_ucode()
360 ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans); in iwl_run_init_mvm_ucode()
367 if (iwl_mvm_is_radio_hw_killed(mvm)) { in iwl_run_init_mvm_ucode()
368 IWL_DEBUG_RF_KILL(mvm, in iwl_run_init_mvm_ucode()
370 iwl_remove_notification(&mvm->notif_wait, &calib_wait); in iwl_run_init_mvm_ucode()
375 mvm->calibrating = true; in iwl_run_init_mvm_ucode()
378 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm)); in iwl_run_init_mvm_ucode()
386 ret = iwl_send_phy_cfg_cmd(mvm); in iwl_run_init_mvm_ucode()
388 IWL_ERR(mvm, "Failed to run INIT calibrations: %d\n", in iwl_run_init_mvm_ucode()
397 ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait, in iwl_run_init_mvm_ucode()
400 if (ret && iwl_mvm_is_radio_hw_killed(mvm)) { in iwl_run_init_mvm_ucode()
401 IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n"); in iwl_run_init_mvm_ucode()
407 iwl_remove_notification(&mvm->notif_wait, &calib_wait); in iwl_run_init_mvm_ucode()
409 mvm->calibrating = false; in iwl_run_init_mvm_ucode()
410 if (iwlmvm_mod_params.init_dbg && !mvm->nvm_data) { in iwl_run_init_mvm_ucode()
412 mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) + in iwl_run_init_mvm_ucode()
416 if (!mvm->nvm_data) in iwl_run_init_mvm_ucode()
418 mvm->nvm_data->bands[0].channels = mvm->nvm_data->channels; in iwl_run_init_mvm_ucode()
419 mvm->nvm_data->bands[0].n_channels = 1; in iwl_run_init_mvm_ucode()
420 mvm->nvm_data->bands[0].n_bitrates = 1; in iwl_run_init_mvm_ucode()
421 mvm->nvm_data->bands[0].bitrates = in iwl_run_init_mvm_ucode()
422 (void *)mvm->nvm_data->channels + 1; in iwl_run_init_mvm_ucode()
423 mvm->nvm_data->bands[0].bitrates->hw_value = 10; in iwl_run_init_mvm_ucode()
429 static void iwl_mvm_get_shared_mem_conf(struct iwl_mvm *mvm) in iwl_mvm_get_shared_mem_conf() argument
441 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_shared_mem_conf()
443 if (WARN_ON(iwl_mvm_send_cmd(mvm, &cmd))) in iwl_mvm_get_shared_mem_conf()
448 IWL_ERR(mvm, "Bad return from SHARED_MEM_CFG (0x%08X)\n", in iwl_mvm_get_shared_mem_conf()
455 mvm->shared_mem_cfg.shared_mem_addr = in iwl_mvm_get_shared_mem_conf()
457 mvm->shared_mem_cfg.shared_mem_size = in iwl_mvm_get_shared_mem_conf()
459 mvm->shared_mem_cfg.sample_buff_addr = in iwl_mvm_get_shared_mem_conf()
461 mvm->shared_mem_cfg.sample_buff_size = in iwl_mvm_get_shared_mem_conf()
463 mvm->shared_mem_cfg.txfifo_addr = le32_to_cpu(mem_cfg->txfifo_addr); in iwl_mvm_get_shared_mem_conf()
464 for (i = 0; i < ARRAY_SIZE(mvm->shared_mem_cfg.txfifo_size); i++) in iwl_mvm_get_shared_mem_conf()
465 mvm->shared_mem_cfg.txfifo_size[i] = in iwl_mvm_get_shared_mem_conf()
467 for (i = 0; i < ARRAY_SIZE(mvm->shared_mem_cfg.rxfifo_size); i++) in iwl_mvm_get_shared_mem_conf()
468 mvm->shared_mem_cfg.rxfifo_size[i] = in iwl_mvm_get_shared_mem_conf()
470 mvm->shared_mem_cfg.page_buff_addr = in iwl_mvm_get_shared_mem_conf()
472 mvm->shared_mem_cfg.page_buff_size = in iwl_mvm_get_shared_mem_conf()
474 IWL_DEBUG_INFO(mvm, "SHARED MEM CFG: got memory offsets/sizes\n"); in iwl_mvm_get_shared_mem_conf()
480 int iwl_mvm_fw_dbg_collect_desc(struct iwl_mvm *mvm, in iwl_mvm_fw_dbg_collect_desc() argument
484 if (test_and_set_bit(IWL_MVM_STATUS_DUMPING_FW_LOG, &mvm->status)) in iwl_mvm_fw_dbg_collect_desc()
487 if (WARN_ON(mvm->fw_dump_desc)) in iwl_mvm_fw_dbg_collect_desc()
488 iwl_mvm_free_fw_dump_desc(mvm); in iwl_mvm_fw_dbg_collect_desc()
490 IWL_WARN(mvm, "Collecting data: trigger %d fired.\n", in iwl_mvm_fw_dbg_collect_desc()
493 mvm->fw_dump_desc = desc; in iwl_mvm_fw_dbg_collect_desc()
495 queue_delayed_work(system_wq, &mvm->fw_dump_wk, delay); in iwl_mvm_fw_dbg_collect_desc()
500 int iwl_mvm_fw_dbg_collect(struct iwl_mvm *mvm, enum iwl_fw_dbg_trigger trig, in iwl_mvm_fw_dbg_collect() argument
513 return iwl_mvm_fw_dbg_collect_desc(mvm, desc, delay); in iwl_mvm_fw_dbg_collect()
516 int iwl_mvm_fw_dbg_collect_trig(struct iwl_mvm *mvm, in iwl_mvm_fw_dbg_collect_trig() argument
544 ret = iwl_mvm_fw_dbg_collect(mvm, le32_to_cpu(trigger->id), buf, in iwl_mvm_fw_dbg_collect_trig()
553 static inline void iwl_mvm_restart_early_start(struct iwl_mvm *mvm) in iwl_mvm_restart_early_start() argument
555 if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000) in iwl_mvm_restart_early_start()
556 iwl_clear_bits_prph(mvm->trans, MON_BUFF_SAMPLE_CTL, 0x100); in iwl_mvm_restart_early_start()
558 iwl_write_prph(mvm->trans, DBGC_IN_SAMPLE, 1); in iwl_mvm_restart_early_start()
561 int iwl_mvm_start_fw_dbg_conf(struct iwl_mvm *mvm, u8 conf_id) in iwl_mvm_start_fw_dbg_conf() argument
567 if (WARN_ONCE(conf_id >= ARRAY_SIZE(mvm->fw->dbg_conf_tlv), in iwl_mvm_start_fw_dbg_conf()
572 if ((!mvm->fw->dbg_conf_tlv[conf_id] || in iwl_mvm_start_fw_dbg_conf()
573 !mvm->fw->dbg_conf_tlv[conf_id]->num_of_hcmds) && in iwl_mvm_start_fw_dbg_conf()
575 iwl_mvm_restart_early_start(mvm); in iwl_mvm_start_fw_dbg_conf()
579 if (!mvm->fw->dbg_conf_tlv[conf_id]) in iwl_mvm_start_fw_dbg_conf()
582 if (mvm->fw_dbg_conf != FW_DBG_INVALID) in iwl_mvm_start_fw_dbg_conf()
583 IWL_WARN(mvm, "FW already configured (%d) - re-configuring\n", in iwl_mvm_start_fw_dbg_conf()
584 mvm->fw_dbg_conf); in iwl_mvm_start_fw_dbg_conf()
587 ptr = (void *)&mvm->fw->dbg_conf_tlv[conf_id]->hcmd; in iwl_mvm_start_fw_dbg_conf()
588 for (i = 0; i < mvm->fw->dbg_conf_tlv[conf_id]->num_of_hcmds; i++) { in iwl_mvm_start_fw_dbg_conf()
591 ret = iwl_mvm_send_cmd_pdu(mvm, cmd->id, 0, in iwl_mvm_start_fw_dbg_conf()
600 mvm->fw_dbg_conf = conf_id; in iwl_mvm_start_fw_dbg_conf()
604 static int iwl_mvm_config_ltr_v1(struct iwl_mvm *mvm) in iwl_mvm_config_ltr_v1() argument
610 if (!mvm->trans->ltr_enabled) in iwl_mvm_config_ltr_v1()
613 return iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0, in iwl_mvm_config_ltr_v1()
617 static int iwl_mvm_config_ltr(struct iwl_mvm *mvm) in iwl_mvm_config_ltr() argument
623 if (!mvm->trans->ltr_enabled) in iwl_mvm_config_ltr()
626 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_HDC_PHASE_0)) in iwl_mvm_config_ltr()
627 return iwl_mvm_config_ltr_v1(mvm); in iwl_mvm_config_ltr()
629 return iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0, in iwl_mvm_config_ltr()
633 int iwl_mvm_up(struct iwl_mvm *mvm) in iwl_mvm_up() argument
639 lockdep_assert_held(&mvm->mutex); in iwl_mvm_up()
641 ret = iwl_trans_start_hw(mvm->trans); in iwl_mvm_up()
650 ret = iwl_run_init_mvm_ucode(mvm, false); in iwl_mvm_up()
652 IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret); in iwl_mvm_up()
664 _iwl_trans_stop_device(mvm->trans, false); in iwl_mvm_up()
665 _iwl_trans_start_hw(mvm->trans, false); in iwl_mvm_up()
673 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR); in iwl_mvm_up()
675 IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret); in iwl_mvm_up()
679 if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 10) in iwl_mvm_up()
680 iwl_mvm_get_shared_mem_conf(mvm); in iwl_mvm_up()
682 ret = iwl_mvm_sf_update(mvm, NULL, false); in iwl_mvm_up()
684 IWL_ERR(mvm, "Failed to initialize Smart Fifo\n"); in iwl_mvm_up()
686 mvm->fw_dbg_conf = FW_DBG_INVALID; in iwl_mvm_up()
688 if (mvm->fw->dbg_dest_tlv) in iwl_mvm_up()
689 mvm->fw_dbg_conf = FW_DBG_START_FROM_ALIVE; in iwl_mvm_up()
690 iwl_mvm_start_fw_dbg_conf(mvm, FW_DBG_START_FROM_ALIVE); in iwl_mvm_up()
692 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm)); in iwl_mvm_up()
696 ret = iwl_send_bt_init_conf(mvm); in iwl_mvm_up()
701 ret = iwl_send_phy_db_data(mvm->phy_db); in iwl_mvm_up()
705 ret = iwl_send_phy_cfg_cmd(mvm); in iwl_mvm_up()
711 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL); in iwl_mvm_up()
713 mvm->tdls_cs.peer.sta_id = IWL_MVM_STATION_COUNT; in iwl_mvm_up()
716 memset(&mvm->last_quota_cmd, 0xff, sizeof(mvm->last_quota_cmd)); in iwl_mvm_up()
719 ret = iwl_mvm_add_aux_sta(mvm); in iwl_mvm_up()
724 chan = &mvm->hw->wiphy->bands[IEEE80211_BAND_2GHZ]->channels[0]; in iwl_mvm_up()
732 ret = iwl_mvm_phy_ctxt_add(mvm, &mvm->phy_ctxts[i], in iwl_mvm_up()
739 iwl_mvm_tt_tx_backoff(mvm, 0); in iwl_mvm_up()
741 WARN_ON(iwl_mvm_config_ltr(mvm)); in iwl_mvm_up()
743 ret = iwl_mvm_power_update_device(mvm); in iwl_mvm_up()
751 if (!test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status)) { in iwl_mvm_up()
752 ret = iwl_mvm_init_mcc(mvm); in iwl_mvm_up()
757 if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) { in iwl_mvm_up()
758 ret = iwl_mvm_config_scan(mvm); in iwl_mvm_up()
764 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_up()
765 iwl_mvm_unref(mvm, IWL_MVM_REF_UCODE_DOWN); in iwl_mvm_up()
767 IWL_DEBUG_INFO(mvm, "RT uCode started.\n"); in iwl_mvm_up()
770 iwl_trans_stop_device(mvm->trans); in iwl_mvm_up()
774 int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm) in iwl_mvm_load_d3_fw() argument
778 lockdep_assert_held(&mvm->mutex); in iwl_mvm_load_d3_fw()
780 ret = iwl_trans_start_hw(mvm->trans); in iwl_mvm_load_d3_fw()
784 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_WOWLAN); in iwl_mvm_load_d3_fw()
786 IWL_ERR(mvm, "Failed to start WoWLAN firmware: %d\n", ret); in iwl_mvm_load_d3_fw()
790 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm)); in iwl_mvm_load_d3_fw()
795 ret = iwl_send_phy_db_data(mvm->phy_db); in iwl_mvm_load_d3_fw()
799 ret = iwl_send_phy_cfg_cmd(mvm); in iwl_mvm_load_d3_fw()
805 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL); in iwl_mvm_load_d3_fw()
808 ret = iwl_mvm_add_aux_sta(mvm); in iwl_mvm_load_d3_fw()
814 iwl_trans_stop_device(mvm->trans); in iwl_mvm_load_d3_fw()
818 int iwl_mvm_rx_card_state_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_card_state_notif() argument
826 IWL_DEBUG_RF_KILL(mvm, "Card state received: HW:%s SW:%s CT:%s\n", in iwl_mvm_rx_card_state_notif()
835 int iwl_mvm_rx_radio_ver(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, in iwl_mvm_rx_radio_ver() argument
842 IWL_DEBUG_INFO(mvm, in iwl_mvm_rx_radio_ver()
850 int iwl_mvm_rx_mfuart_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_mfuart_notif() argument
857 IWL_DEBUG_INFO(mvm, in iwl_mvm_rx_mfuart_notif()