Lines Matching refs:mvm

21 #include "mvm.h"
39 static int iwl_send_tx_ant_cfg(struct iwl_mvm *mvm, u8 valid_tx_ant)
45 IWL_DEBUG_FW(mvm, "select valid tx ant: %u\n", valid_tx_ant);
46 return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, 0,
50 static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm)
63 if (mvm->trans->num_rx_queues == 1)
69 1 + (i % (mvm->trans->num_rx_queues - 1));
72 return iwl_mvm_send_cmd_pdu(mvm, RSS_CONFIG_CMD, 0, sizeof(cmd), &cmd);
75 static int iwl_mvm_send_dqa_cmd(struct iwl_mvm *mvm)
83 ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, sizeof(dqa_cmd), &dqa_cmd);
85 IWL_ERR(mvm, "Failed to send DQA enabling command: %d\n", ret);
87 IWL_DEBUG_FW(mvm, "Working in DQA mode\n");
92 void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm,
102 IWL_INFO(mvm, "MFUART assert id 0x%x occurred\n",
106 IWL_DEBUG_INFO(mvm,
117 struct iwl_mvm *mvm =
125 u32 version = iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP,
137 mvm->trans->dbg.imr_data.imr_enable =
139 mvm->trans->dbg.imr_data.imr_size =
141 mvm->trans->dbg.imr_data.imr2sram_remainbyte =
142 mvm->trans->dbg.imr_data.imr_size;
143 mvm->trans->dbg.imr_data.imr_base_addr =
145 mvm->trans->dbg.imr_data.imr_curr_addr =
146 le64_to_cpu(mvm->trans->dbg.imr_data.imr_base_addr);
147 IWL_DEBUG_FW(mvm, "IMR Enabled: 0x0%x size 0x0%x Address 0x%016llx\n",
148 mvm->trans->dbg.imr_data.imr_enable,
149 mvm->trans->dbg.imr_data.imr_size,
150 le64_to_cpu(mvm->trans->dbg.imr_data.imr_base_addr));
152 if (!mvm->trans->dbg.imr_data.imr_enable) {
153 for (i = 0; i < ARRAY_SIZE(mvm->trans->dbg.active_regions); i++) {
157 reg_tlv = mvm->trans->dbg.active_regions[i];
168 mvm->trans->dbg.unsupported_region_msk |= BIT(i);
187 mvm->trans->sku_id[0] = le32_to_cpu(palive->sku_id.data[0]);
188 mvm->trans->sku_id[1] = le32_to_cpu(palive->sku_id.data[1]);
189 mvm->trans->sku_id[2] = le32_to_cpu(palive->sku_id.data[2]);
191 IWL_DEBUG_FW(mvm, "Got sku_id: 0x0%x 0x0%x 0x0%x\n",
192 mvm->trans->sku_id[0],
193 mvm->trans->sku_id[1],
194 mvm->trans->sku_id[2]);
226 iwl_fw_lmac1_set_alive_err_table(mvm->trans, lmac_error_event_table);
229 mvm->trans->dbg.lmac_error_event_table[1] =
237 mvm->trans->cfg->min_umac_error_event_table) {
238 iwl_fw_umac_set_alive_err_table(mvm->trans,
241 IWL_ERR(mvm,
244 (mvm->fwrt.cur_fw_img == IWL_UCODE_INIT) ?
252 IWL_DEBUG_FW(mvm,
257 IWL_DEBUG_FW(mvm, "Alive ucode CDB\n");
259 IWL_DEBUG_FW(mvm,
264 iwl_fwrt_update_fw_versions(&mvm->fwrt, lmac1, umac);
292 static void iwl_mvm_print_pd_notification(struct iwl_mvm *mvm)
295 IWL_ERR(mvm, #reg_name ": 0x%x\n", iwl_read_umac_prph(trans, reg_name))
297 struct iwl_trans *trans = mvm->trans;
315 static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
322 enum iwl_ucode_type old_type = mvm->fwrt.cur_fw_img;
325 ucode_type == IWL_UCODE_INIT || iwl_mvm_has_unified_ucode(mvm);
330 iwl_fw_dbg_conf_usniffer(mvm->fw, FW_DBG_START_FROM_ALIVE) &&
331 !(fw_has_capa(&mvm->fw->ucode_capa,
333 fw = iwl_get_ucode_image(mvm->fw, IWL_UCODE_REGULAR_USNIFFER);
335 fw = iwl_get_ucode_image(mvm->fw, ucode_type);
338 iwl_fw_set_current_image(&mvm->fwrt, ucode_type);
339 clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status);
341 iwl_init_notification_wait(&mvm->notif_wait, &alive_wait,
350 ret = iwl_trans_start_fw(mvm->trans, fw, run_in_rfkill);
352 iwl_fw_set_current_image(&mvm->fwrt, old_type);
353 iwl_remove_notification(&mvm->notif_wait, &alive_wait);
361 ret = iwl_wait_notification(&mvm->notif_wait, &alive_wait,
364 if (mvm->trans->trans_cfg->device_family ==
367 IWL_INFO(mvm, "WFPM_UMAC_PD_NOTIFICATION: 0x%x\n",
368 iwl_read_umac_prph(mvm->trans, WFPM_ARC1_PD_NOTIFICATION));
369 IWL_INFO(mvm, "WFPM_LMAC2_PD_NOTIFICATION: 0x%x\n",
370 iwl_read_umac_prph(mvm->trans, WFPM_LMAC2_PD_NOTIFICATION));
371 IWL_INFO(mvm, "WFPM_AUTH_KEY_0: 0x%x\n",
372 iwl_read_umac_prph(mvm->trans, SB_MODIFY_CFG_FLAG));
373 IWL_INFO(mvm, "CNVI_SCU_SEQ_DATA_DW9: 0x%x\n",
374 iwl_read_prph(mvm->trans, CNVI_SCU_SEQ_DATA_DW9));
378 struct iwl_trans *trans = mvm->trans;
383 IWL_ERR(mvm,
390 IWL_ERR(mvm,
396 iwl_mvm_print_pd_notification(mvm);
404 IWL_ERR(mvm, "%s: 0x%x\n",
409 IWL_ERR(mvm, "UMAC PC: 0x%x\n",
412 IWL_ERR(mvm, "LMAC PC: 0x%x\n",
415 if (iwl_mvm_is_cdb_supported(mvm))
416 IWL_ERR(mvm, "LMAC2 PC: 0x%x\n",
421 if (ret == -ETIMEDOUT && !mvm->pldr_sync)
422 iwl_fw_dbg_error_collect(&mvm->fwrt,
425 iwl_fw_set_current_image(&mvm->fwrt, old_type);
430 IWL_ERR(mvm, "Loaded ucode is not valid!\n");
431 iwl_fw_set_current_image(&mvm->fwrt, old_type);
438 ret = iwl_pnvm_load(mvm->trans, &mvm->notif_wait,
439 &mvm->fw->ucode_capa);
441 IWL_ERR(mvm, "Timeout waiting for PNVM load!\n");
442 iwl_fw_set_current_image(&mvm->fwrt, old_type);
446 iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr);
457 memset(&mvm->queue_info, 0, sizeof(mvm->queue_info));
464 mvm->queue_info[IWL_MVM_DQA_CMD_QUEUE].tid_bitmap =
467 set_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status);
469 iwl_fw_set_dbg_rec_on(&mvm->fwrt);
478 cfg80211_bss_flush(mvm->hw->wiphy);
483 static void iwl_mvm_phy_filter_init(struct iwl_mvm *mvm,
487 *phy_filters = mvm->phy_filters;
491 static void iwl_mvm_uats_init(struct iwl_mvm *mvm)
499 .data[0] = &mvm->fwrt.uats_table,
500 .len[0] = sizeof(mvm->fwrt.uats_table),
504 if (!(mvm->trans->trans_cfg->device_family >=
506 IWL_DEBUG_RADIO(mvm, "UATS feature is not supported\n");
510 if (!mvm->fwrt.uats_enabled) {
511 IWL_DEBUG_RADIO(mvm, "UATS feature is disabled\n");
515 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd.id,
518 IWL_DEBUG_RADIO(mvm,
524 ret = iwl_uefi_get_uats_table(mvm->trans, &mvm->fwrt);
526 IWL_ERR(mvm, "failed to read UATS table (%d)\n", ret);
530 ret = iwl_mvm_send_cmd(mvm, &cmd);
532 IWL_ERR(mvm, "failed to send UATS_TABLE_CMD (%d)\n", ret);
534 IWL_DEBUG_RADIO(mvm, "UATS_TABLE_CMD sent to FW\n");
537 static int iwl_mvm_sgom_init(struct iwl_mvm *mvm)
545 .data[0] = &mvm->fwrt.sgom_table,
546 .len[0] = sizeof(mvm->fwrt.sgom_table),
550 if (!mvm->fwrt.sgom_enabled) {
551 IWL_DEBUG_RADIO(mvm, "SGOM table is disabled\n");
555 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd.id,
559 IWL_DEBUG_RADIO(mvm, "command version is unsupported. version = %d\n",
564 ret = iwl_mvm_send_cmd(mvm, &cmd);
566 IWL_ERR(mvm, "failed to send SAR_OFFSET_MAPPING_CMD (%d)\n", ret);
571 static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm)
575 enum iwl_ucode_type ucode_type = mvm->fwrt.cur_fw_img;
579 if (iwl_mvm_has_unified_ucode(mvm) &&
580 !mvm->trans->cfg->tx_with_siso_diversity)
583 if (mvm->trans->cfg->tx_with_siso_diversity) {
593 phy_cfg_cmd.phy_cfg = cpu_to_le32(iwl_mvm_get_phy_config(mvm));
597 cpu_to_le32(mvm->trans->trans_cfg->extra_phy_cfg_flags);
600 mvm->fw->default_calib[ucode_type].event_trigger;
602 mvm->fw->default_calib[ucode_type].flow_trigger;
604 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id,
607 iwl_mvm_phy_filter_init(mvm, &phy_cfg_cmd.phy_specific_cfg);
609 IWL_DEBUG_INFO(mvm, "Sending Phy CFG command: 0x%x\n",
613 return iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, cmd_size, &phy_cfg_cmd);
616 static int iwl_run_unified_mvm_ucode(struct iwl_mvm *mvm)
629 if (mvm->trans->cfg->tx_with_siso_diversity)
632 lockdep_assert_held(&mvm->mutex);
634 mvm->rfkill_safe_init_done = false;
636 if (mvm->trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210) {
637 sb_cfg = iwl_read_umac_prph(mvm->trans, SB_MODIFY_CFG_FLAG);
639 mvm->pldr_sync = sb_cfg == SB_CFG_RESIDES_IN_ROM;
640 if (mvm->pldr_sync && iwl_mei_pldr_req())
644 iwl_init_notification_wait(&mvm->notif_wait,
651 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_EARLY, NULL);
654 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR);
656 IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret);
659 if (mvm->pldr_sync) {
661 iwl_trans_pcie_remove(mvm->trans, true);
666 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_AFTER_ALIVE,
669 if (mvm->trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_BZ)
670 mvm->trans->step_urm = !!(iwl_read_umac_prph(mvm->trans,
677 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(SYSTEM_GROUP,
682 IWL_ERR(mvm, "Failed to run init config command: %d\n",
688 if (mvm->nvm_file_name) {
689 ret = iwl_read_external_nvm(mvm->trans, mvm->nvm_file_name,
690 mvm->nvm_sections);
693 ret = iwl_mvm_load_nvm_to_nic(mvm);
698 if (IWL_MVM_PARSE_NVM && !mvm->nvm_data) {
699 ret = iwl_nvm_init(mvm);
701 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret);
706 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(REGULATORY_AND_NVM_GROUP,
711 IWL_ERR(mvm, "Failed to run complete NVM access: %d\n",
716 ret = iwl_send_phy_cfg_cmd(mvm);
718 IWL_ERR(mvm, "Failed to run PHY configuration: %d\n",
724 ret = iwl_wait_notification(&mvm->notif_wait, &init_wait,
730 if (!IWL_MVM_PARSE_NVM && !mvm->nvm_data) {
731 mvm->nvm_data = iwl_get_nvm(mvm->trans, mvm->fw,
732 mvm->set_tx_ant, mvm->set_rx_ant);
733 if (IS_ERR(mvm->nvm_data)) {
734 ret = PTR_ERR(mvm->nvm_data);
735 mvm->nvm_data = NULL;
736 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret);
741 mvm->rfkill_safe_init_done = true;
746 iwl_remove_notification(&mvm->notif_wait, &init_wait);
750 int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm)
759 if (iwl_mvm_has_unified_ucode(mvm))
760 return iwl_run_unified_mvm_ucode(mvm);
762 lockdep_assert_held(&mvm->mutex);
764 mvm->rfkill_safe_init_done = false;
766 iwl_init_notification_wait(&mvm->notif_wait,
771 mvm->phy_db);
773 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_EARLY, NULL);
776 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_INIT);
778 IWL_ERR(mvm, "Failed to start INIT ucode: %d\n", ret);
782 if (mvm->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_8000) {
783 ret = iwl_mvm_send_bt_init_conf(mvm);
789 if (!mvm->nvm_data) {
790 ret = iwl_nvm_init(mvm);
792 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret);
798 if (mvm->nvm_file_name) {
799 ret = iwl_mvm_load_nvm_to_nic(mvm);
804 WARN_ONCE(mvm->nvm_data->nvm_version < mvm->trans->cfg->nvm_ver,
806 mvm->nvm_data->nvm_version, mvm->trans->cfg->nvm_ver);
812 if (iwl_mvm_is_radio_hw_killed(mvm)) {
813 IWL_DEBUG_RF_KILL(mvm,
818 mvm->rfkill_safe_init_done = true;
821 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm));
825 ret = iwl_send_phy_cfg_cmd(mvm);
827 IWL_ERR(mvm, "Failed to run INIT calibrations: %d\n",
836 ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait,
841 if (iwl_mvm_is_radio_hw_killed(mvm)) {
842 IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n");
845 IWL_ERR(mvm, "Failed to run INIT calibrations: %d\n",
852 iwl_remove_notification(&mvm->notif_wait, &calib_wait);
854 mvm->rfkill_safe_init_done = false;
855 if (iwlmvm_mod_params.init_dbg && !mvm->nvm_data) {
857 mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) +
861 if (!mvm->nvm_data)
863 mvm->nvm_data->bands[0].channels = mvm->nvm_data->channels;
864 mvm->nvm_data->bands[0].n_channels = 1;
865 mvm->nvm_data->bands[0].n_bitrates = 1;
866 mvm->nvm_data->bands[0].bitrates =
867 (void *)(mvm->nvm_data->channels + 1);
868 mvm->nvm_data->bands[0].bitrates->hw_value = 10;
874 static int iwl_mvm_config_ltr(struct iwl_mvm *mvm)
880 if (!mvm->trans->ltr_enabled)
883 return iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0,
887 int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b)
897 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id,
903 cmd.v7.flags = cpu_to_le32(mvm->fwrt.reduced_power_flags);
908 } else if (fw_has_api(&mvm->fw->ucode_capa,
913 } else if (fw_has_capa(&mvm->fw->ucode_capa,
927 ret = iwl_sar_fill_profile(&mvm->fwrt, per_chain,
937 IWL_DEBUG_RADIO(mvm, "Sending REDUCE_TX_POWER_CMD per chain\n");
938 return iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, len, &cmd);
941 int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm)
952 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd.id,
965 else if (fw_has_api(&mvm->fwrt.fw->ucode_capa,
971 if (!iwl_sar_geo_support(&mvm->fwrt))
976 ret = iwl_mvm_send_cmd(mvm, &cmd);
978 IWL_ERR(mvm, "Failed to get geographic profile info %d\n", ret);
992 static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm)
1001 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id,
1017 if (mvm->fwrt.geo_rev == 1)
1035 } else if (fw_has_api(&mvm->fwrt.fw->ucode_capa,
1056 ret = iwl_sar_geo_fill_table(&mvm->fwrt, &cmd.v1.table[0][0],
1066 return iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, len, &cmd);
1069 int iwl_mvm_ppag_send_cmd(struct iwl_mvm *mvm)
1074 ret = iwl_fill_ppag_table(&mvm->fwrt, &cmd, &cmd_size);
1079 IWL_DEBUG_RADIO(mvm, "Sending PER_PLATFORM_ANT_GAIN_CMD\n");
1080 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(PHY_OPS_GROUP,
1084 IWL_ERR(mvm, "failed to send PER_PLATFORM_ANT_GAIN_CMD (%d)\n",
1090 static int iwl_mvm_ppag_init(struct iwl_mvm *mvm)
1093 if (!(iwl_is_ppag_approved(&mvm->fwrt)))
1096 return iwl_mvm_ppag_send_cmd(mvm);
1118 static void iwl_mvm_tas_init(struct iwl_mvm *mvm)
1131 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TAS_CFG)) {
1132 IWL_DEBUG_RADIO(mvm, "TAS not enabled in FW\n");
1136 ret = iwl_bios_get_tas_table(&mvm->fwrt, &data);
1138 IWL_DEBUG_RADIO(mvm,
1148 IWL_DEBUG_RADIO(mvm,
1157 IWL_DEBUG_RADIO(mvm,
1162 IWL_DEBUG_RADIO(mvm,
1167 fw_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id,
1187 ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, cmd_size, &cmd);
1189 IWL_DEBUG_RADIO(mvm, "failed to send TAS_CONFIG (%d)\n", ret);
1192 static bool iwl_mvm_eval_dsm_rfi(struct iwl_mvm *mvm)
1197 int ret = iwl_bios_get_dsm(&mvm->fwrt, DSM_FUNC_RFI_CONFIG, &value);
1201 IWL_DEBUG_RADIO(mvm, "Failed to get DSM RFI, ret=%d\n", ret);
1212 IWL_DEBUG_RADIO(mvm, "DSM RFI is evaluated to enable\n");
1215 IWL_DEBUG_RADIO(mvm, "DSM RFI is evaluated to disable\n");
1217 IWL_DEBUG_RADIO(mvm,
1224 static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
1229 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw,
1233 cmd.config_bitmap = iwl_get_lari_config_bitmap(&mvm->fwrt);
1235 ret = iwl_bios_get_dsm(&mvm->fwrt, DSM_FUNC_11AX_ENABLEMENT, &value);
1239 ret = iwl_bios_get_dsm(&mvm->fwrt, DSM_FUNC_ENABLE_UNII4_CHAN, &value);
1243 ret = iwl_bios_get_dsm(&mvm->fwrt, DSM_FUNC_ACTIVATE_CHANNEL, &value);
1250 ret = iwl_bios_get_dsm(&mvm->fwrt, DSM_FUNC_ENABLE_6E, &value);
1254 ret = iwl_bios_get_dsm(&mvm->fwrt, DSM_FUNC_FORCE_DISABLE_CHANNELS,
1259 ret = iwl_bios_get_dsm(&mvm->fwrt, DSM_FUNC_ENERGY_DETECTION_THRESHOLD,
1298 IWL_DEBUG_RADIO(mvm,
1302 IWL_DEBUG_RADIO(mvm,
1307 IWL_DEBUG_RADIO(mvm,
1311 IWL_DEBUG_RADIO(mvm,
1314 ret = iwl_mvm_send_cmd_pdu(mvm,
1319 IWL_DEBUG_RADIO(mvm,
1326 mvm->fwrt.uats_enabled = true;
1329 void iwl_mvm_get_bios_tables(struct iwl_mvm *mvm)
1333 iwl_acpi_get_guid_lock_status(&mvm->fwrt);
1336 ret = iwl_bios_get_ppag_table(&mvm->fwrt);
1338 IWL_DEBUG_RADIO(mvm,
1344 ret = iwl_bios_get_wrds_table(&mvm->fwrt);
1346 IWL_DEBUG_RADIO(mvm,
1353 if (!iwl_bios_get_wgds_table(&mvm->fwrt)) {
1360 IWL_ERR(mvm, "BIOS contains WGDS but no WRDS\n");
1364 ret = iwl_bios_get_ewrd_table(&mvm->fwrt);
1368 IWL_DEBUG_RADIO(mvm,
1373 if (iwl_sar_geo_support(&mvm->fwrt)) {
1374 ret = iwl_bios_get_wgds_table(&mvm->fwrt);
1376 IWL_DEBUG_RADIO(mvm,
1383 iwl_acpi_get_phy_filters(&mvm->fwrt, &mvm->phy_filters);
1385 if (iwl_bios_get_eckv(&mvm->fwrt, &mvm->ext_clock_valid))
1386 IWL_DEBUG_RADIO(mvm, "ECKV table doesn't exist in BIOS\n");
1396 void iwl_mvm_send_recovery_cmd(struct iwl_mvm *mvm, u32 flags)
1398 u32 error_log_size = mvm->fw->ucode_capa.error_log_size;
1419 if (!mvm->error_recovery_buf)
1422 host_cmd.data[1] = mvm->error_recovery_buf;
1428 ret = iwl_mvm_send_cmd(mvm, &host_cmd);
1429 kfree(mvm->error_recovery_buf);
1430 mvm->error_recovery_buf = NULL;
1433 IWL_ERR(mvm, "Failed to send recovery cmd %d\n", ret);
1441 IWL_ERR(mvm,
1445 ieee80211_iterate_interfaces(mvm->hw, 0,
1447 mvm);
1452 static int iwl_mvm_sar_init(struct iwl_mvm *mvm)
1454 return iwl_mvm_sar_select_profile(mvm, 1, 1);
1457 static int iwl_mvm_load_rt_fw(struct iwl_mvm *mvm)
1461 if (iwl_mvm_has_unified_ucode(mvm))
1462 return iwl_run_unified_mvm_ucode(mvm);
1464 ret = iwl_run_init_mvm_ucode(mvm);
1467 IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret);
1474 iwl_fw_dbg_stop_sync(&mvm->fwrt);
1475 iwl_trans_stop_device(mvm->trans);
1476 ret = iwl_trans_start_hw(mvm->trans);
1480 mvm->rfkill_safe_init_done = false;
1481 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR);
1485 mvm->rfkill_safe_init_done = true;
1487 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_AFTER_ALIVE,
1490 return iwl_init_paging(&mvm->fwrt, mvm->fwrt.cur_fw_img);
1493 int iwl_mvm_up(struct iwl_mvm *mvm)
1498 lockdep_assert_held(&mvm->mutex);
1500 ret = iwl_trans_start_hw(mvm->trans);
1504 ret = iwl_mvm_load_rt_fw(mvm);
1506 IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret);
1507 if (ret != -ERFKILL && !mvm->pldr_sync)
1508 iwl_fw_dbg_error_collect(&mvm->fwrt,
1514 mvm->pldr_sync = false;
1516 iwl_fw_disable_dbg_asserts(&mvm->fwrt);
1517 iwl_get_shared_mem_conf(&mvm->fwrt);
1519 ret = iwl_mvm_sf_update(mvm, NULL, false);
1521 IWL_ERR(mvm, "Failed to initialize Smart Fifo\n");
1523 if (!iwl_trans_dbg_ini_valid(mvm->trans)) {
1524 mvm->fwrt.dump.conf = FW_DBG_INVALID;
1526 if (mvm->fw->dbg.dest_tlv)
1527 mvm->fwrt.dump.conf = FW_DBG_START_FROM_ALIVE;
1528 iwl_fw_start_dbg_conf(&mvm->fwrt, FW_DBG_START_FROM_ALIVE);
1531 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm));
1535 if (!iwl_mvm_has_unified_ucode(mvm)) {
1537 ret = iwl_send_phy_db_data(mvm->phy_db);
1540 ret = iwl_send_phy_cfg_cmd(mvm);
1545 ret = iwl_mvm_send_bt_init_conf(mvm);
1549 if (fw_has_capa(&mvm->fw->ucode_capa,
1551 ret = iwl_set_soc_latency(&mvm->fwrt);
1556 iwl_mvm_lari_cfg(mvm);
1559 ret = iwl_configure_rxq(&mvm->fwrt);
1563 if (iwl_mvm_has_new_rx_api(mvm)) {
1564 ret = iwl_send_rss_cfg_cmd(mvm);
1566 IWL_ERR(mvm, "Failed to configure RSS queues: %d\n",
1573 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) {
1574 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL);
1575 RCU_INIT_POINTER(mvm->fw_id_to_link_sta[i], NULL);
1579 RCU_INIT_POINTER(mvm->link_id_to_link_conf[i], NULL);
1581 memset(&mvm->fw_link_ids_map, 0, sizeof(mvm->fw_link_ids_map));
1583 mvm->tdls_cs.peer.sta_id = IWL_MVM_INVALID_STA;
1586 memset(&mvm->last_quota_cmd, 0xff, sizeof(mvm->last_quota_cmd));
1588 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_DQA_SUPPORT)) {
1589 ret = iwl_mvm_send_dqa_cmd(mvm);
1600 if (!iwl_mvm_has_new_station_api(mvm->fw)) {
1605 ret = iwl_mvm_add_aux_sta(mvm, MAC_INDEX_AUX);
1613 sband = mvm->hw->wiphy->bands[i++];
1620 if (iwl_mvm_is_tt_in_fw(mvm)) {
1625 iwl_mvm_send_temp_report_ths_cmd(mvm);
1628 iwl_mvm_tt_tx_backoff(mvm, 0);
1638 if (iwl_mvm_is_ctdp_supported(mvm)) {
1639 ret = iwl_mvm_ctdp_command(mvm, CTDP_CMD_OPERATION_START,
1640 mvm->cooling_dev.cur_state);
1646 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_SET_LTR_GEN2))
1647 WARN_ON(iwl_mvm_config_ltr(mvm));
1649 ret = iwl_mvm_power_update_device(mvm);
1657 if (!test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status)) {
1658 ret = iwl_mvm_init_mcc(mvm);
1663 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
1664 mvm->scan_type = IWL_SCAN_TYPE_NOT_SET;
1665 mvm->hb_scan_type = IWL_SCAN_TYPE_NOT_SET;
1666 ret = iwl_mvm_config_scan(mvm);
1671 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
1672 iwl_mvm_send_recovery_cmd(mvm, ERROR_RECOVERY_UPDATE_DB);
1674 if (mvm->time_sync.active)
1675 iwl_mvm_time_sync_config(mvm, mvm->time_sync.peer_addr,
1680 if (!mvm->ptp_data.ptp_clock)
1681 iwl_mvm_ptp_init(mvm);
1683 ret = iwl_mvm_ppag_init(mvm);
1687 ret = iwl_mvm_sar_init(mvm);
1689 ret = iwl_mvm_sar_geo_init(mvm);
1693 ret = iwl_mvm_sgom_init(mvm);
1697 iwl_mvm_tas_init(mvm);
1698 iwl_mvm_leds_sync(mvm);
1699 iwl_mvm_uats_init(mvm);
1701 if (iwl_rfi_supported(mvm)) {
1702 if (iwl_mvm_eval_dsm_rfi(mvm))
1703 iwl_rfi_send_config_cmd(mvm, NULL);
1706 iwl_mvm_mei_device_state(mvm, true);
1708 IWL_DEBUG_INFO(mvm, "RT uCode started.\n");
1712 iwl_mvm_stop_device(mvm);
1716 int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm)
1720 lockdep_assert_held(&mvm->mutex);
1722 ret = iwl_trans_start_hw(mvm->trans);
1726 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_WOWLAN);
1728 IWL_ERR(mvm, "Failed to start WoWLAN firmware: %d\n", ret);
1732 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm));
1737 ret = iwl_send_phy_db_data(mvm->phy_db);
1741 ret = iwl_send_phy_cfg_cmd(mvm);
1746 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) {
1747 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL);
1748 RCU_INIT_POINTER(mvm->fw_id_to_link_sta[i], NULL);
1751 if (!iwl_mvm_has_new_station_api(mvm->fw)) {
1760 ret = iwl_mvm_add_aux_sta(mvm, MAC_INDEX_AUX);
1767 iwl_mvm_stop_device(mvm);
1771 void iwl_mvm_rx_mfuart_notif(struct iwl_mvm *mvm,
1777 IWL_DEBUG_INFO(mvm,
1785 IWL_DEBUG_INFO(mvm,