Lines Matching +full:fw +full:- +full:cfg
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2012-2014, 2018-2024 Intel Corporation
4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5 * Copyright (C) 2016-2017 Intel Deutschland GmbH
11 #include "iwl-trans.h"
12 #include "iwl-op-mode.h"
13 #include "fw/img.h"
14 #include "iwl-debug.h"
15 #include "iwl-prph.h"
16 #include "fw/acpi.h"
17 #include "fw/pnvm.h"
18 #include "fw/uefi.h"
19 #include "fw/regulatory.h"
22 #include "fw/dbg.h"
23 #include "iwl-phy-db.h"
24 #include "iwl-modparams.h"
25 #include "iwl-nvm-parse.h"
26 #include "time-sync.h"
60 if (mvm->trans->num_rx_queues == 1)
66 1 + (i % (mvm->trans->num_rx_queues - 1));
93 struct iwl_mfu_assert_dump_notif *mfu_dump_notif = (void *)pkt->data;
95 if (mfu_dump_notif->index_num == 0)
97 le32_to_cpu(mfu_dump_notif->assert_id));
112 u32 version = iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP,
123 palive = (void *)pkt->data;
124 mvm->trans->dbg.imr_data.imr_enable =
125 le32_to_cpu(palive->imr.enabled);
126 mvm->trans->dbg.imr_data.imr_size =
127 le32_to_cpu(palive->imr.size);
128 mvm->trans->dbg.imr_data.imr2sram_remainbyte =
129 mvm->trans->dbg.imr_data.imr_size;
130 mvm->trans->dbg.imr_data.imr_base_addr =
131 palive->imr.base_addr;
132 mvm->trans->dbg.imr_data.imr_curr_addr =
133 le64_to_cpu(mvm->trans->dbg.imr_data.imr_base_addr);
135 mvm->trans->dbg.imr_data.imr_enable,
136 mvm->trans->dbg.imr_data.imr_size,
137 le64_to_cpu(mvm->trans->dbg.imr_data.imr_base_addr));
139 if (!mvm->trans->dbg.imr_data.imr_enable) {
140 for (i = 0; i < ARRAY_SIZE(mvm->trans->dbg.active_regions); i++) {
144 reg_tlv = mvm->trans->dbg.active_regions[i];
148 reg = (void *)reg_tlv->data;
154 if (reg->type == IWL_FW_INI_REGION_DRAM_IMR) {
155 mvm->trans->dbg.unsupported_region_msk |= BIT(i);
168 palive = (void *)pkt->data;
169 umac = &palive->umac_data;
170 lmac1 = &palive->lmac_data[0];
171 lmac2 = &palive->lmac_data[1];
172 status = le16_to_cpu(palive->status);
174 mvm->trans->sku_id[0] = le32_to_cpu(palive->sku_id.data[0]);
175 mvm->trans->sku_id[1] = le32_to_cpu(palive->sku_id.data[1]);
176 mvm->trans->sku_id[2] = le32_to_cpu(palive->sku_id.data[2]);
179 mvm->trans->sku_id[0],
180 mvm->trans->sku_id[1],
181 mvm->trans->sku_id[2]);
188 palive = (void *)pkt->data;
189 umac = &palive->umac_data;
190 lmac1 = &palive->lmac_data[0];
191 lmac2 = &palive->lmac_data[1];
192 status = le16_to_cpu(palive->status);
200 palive3 = (void *)pkt->data;
201 umac = &palive3->umac_data;
202 lmac1 = &palive3->lmac_data;
203 status = le16_to_cpu(palive3->status);
212 le32_to_cpu(lmac1->dbg_ptrs.error_event_table_ptr);
213 iwl_fw_lmac1_set_alive_err_table(mvm->trans, lmac_error_event_table);
216 mvm->trans->dbg.lmac_error_event_table[1] =
217 le32_to_cpu(lmac2->dbg_ptrs.error_event_table_ptr);
219 umac_error_table = le32_to_cpu(umac->dbg_ptrs.error_info_addr) &
224 mvm->trans->cfg->min_umac_error_event_table) {
225 iwl_fw_umac_set_alive_err_table(mvm->trans,
231 (mvm->fwrt.cur_fw_img == IWL_UCODE_INIT) ?
236 alive_data->scd_base_addr = le32_to_cpu(lmac1->dbg_ptrs.scd_base_ptr);
237 alive_data->valid = status == IWL_ALIVE_STATUS_OK;
241 status, lmac1->ver_type, lmac1->ver_subtype);
247 "UMAC version: Major - 0x%x, Minor - 0x%x\n",
248 le32_to_cpu(umac->umac_major),
249 le32_to_cpu(umac->umac_minor));
251 iwl_fwrt_update_fw_versions(&mvm->fwrt, lmac1, umac);
259 WARN_ON(pkt->hdr.cmd != INIT_COMPLETE_NOTIF);
269 if (pkt->hdr.cmd != CALIB_RES_NOTIF_PHY_DB) {
270 WARN_ON(pkt->hdr.cmd != INIT_COMPLETE_NOTIF);
284 struct iwl_trans *trans = mvm->trans;
285 enum iwl_device_family device_family = trans->trans_cfg->device_family;
307 const struct fw_img *fw;
309 enum iwl_ucode_type old_type = mvm->fwrt.cur_fw_img;
317 iwl_fw_dbg_conf_usniffer(mvm->fw, FW_DBG_START_FROM_ALIVE) &&
318 !(fw_has_capa(&mvm->fw->ucode_capa,
320 fw = iwl_get_ucode_image(mvm->fw, IWL_UCODE_REGULAR_USNIFFER);
322 fw = iwl_get_ucode_image(mvm->fw, ucode_type);
323 if (WARN_ON(!fw))
324 return -EINVAL;
325 iwl_fw_set_current_image(&mvm->fwrt, ucode_type);
326 clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status);
328 iwl_init_notification_wait(&mvm->notif_wait, &alive_wait,
337 ret = iwl_trans_start_fw(mvm->trans, fw, run_in_rfkill);
339 iwl_fw_set_current_image(&mvm->fwrt, old_type);
340 iwl_remove_notification(&mvm->notif_wait, &alive_wait);
348 ret = iwl_wait_notification(&mvm->notif_wait, &alive_wait,
351 if (mvm->trans->trans_cfg->device_family ==
355 iwl_read_umac_prph(mvm->trans, WFPM_ARC1_PD_NOTIFICATION));
357 iwl_read_umac_prph(mvm->trans, WFPM_LMAC2_PD_NOTIFICATION));
359 iwl_read_umac_prph(mvm->trans, SB_MODIFY_CFG_FLAG));
361 iwl_read_prph(mvm->trans, CNVI_SCU_SEQ_DATA_DW9));
365 struct iwl_trans *trans = mvm->trans;
368 if (trans->trans_cfg->device_family >=
375 } else if (trans->trans_cfg->device_family >=
386 if (trans->trans_cfg->device_family >=
388 pc_data = trans->dbg.pc_data;
389 for (count = 0; count < trans->dbg.num_pc;
392 pc_data->pc_name,
393 pc_data->pc_address);
394 } else if (trans->trans_cfg->device_family >=
408 if (ret == -ETIMEDOUT && !mvm->fw_product_reset)
409 iwl_fw_dbg_error_collect(&mvm->fwrt,
412 iwl_fw_set_current_image(&mvm->fwrt, old_type);
418 iwl_fw_set_current_image(&mvm->fwrt, old_type);
419 return -EIO;
425 ret = iwl_pnvm_load(mvm->trans, &mvm->notif_wait,
426 &mvm->fw->ucode_capa);
429 iwl_fw_set_current_image(&mvm->fwrt, old_type);
433 iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr);
444 memset(&mvm->queue_info, 0, sizeof(mvm->queue_info));
451 mvm->queue_info[IWL_MVM_DQA_CMD_QUEUE].tid_bitmap =
454 set_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status);
456 iwl_fw_set_dbg_rec_on(&mvm->fwrt);
460 * For pre-MLD API (MLD API doesn't use the timestamps):
466 if (!mvm->mld_api_is_used)
467 cfg80211_bss_flush(mvm->hw->wiphy);
476 *phy_filters = mvm->phy_filters;
488 .data[0] = &mvm->fwrt.uats_table,
489 .len[0] = sizeof(mvm->fwrt.uats_table),
493 if (mvm->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_AX210) {
498 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd.id,
507 ret = iwl_uefi_get_uats_table(mvm->trans, &mvm->fwrt);
518 IWL_DEBUG_RADIO(mvm, "MCC_ALLOWED_AP_TYPE_CMD sent to FW\n");
529 .data[0] = &mvm->fwrt.sgom_table,
530 .len[0] = sizeof(mvm->fwrt.sgom_table),
534 if (!mvm->fwrt.sgom_enabled) {
539 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd.id,
559 enum iwl_ucode_type ucode_type = mvm->fwrt.cur_fw_img;
564 !mvm->trans->cfg->tx_with_siso_diversity)
567 if (mvm->trans->cfg->tx_with_siso_diversity) {
579 /* set flags extra PHY configuration flags from the device's cfg */
581 cpu_to_le32(mvm->trans->trans_cfg->extra_phy_cfg_flags);
584 mvm->fw->default_calib[ucode_type].event_trigger;
586 mvm->fw->default_calib[ucode_type].flow_trigger;
588 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id,
593 IWL_DEBUG_INFO(mvm, "Sending Phy CFG command: 0x%x\n",
613 if (mvm->trans->cfg->tx_with_siso_diversity)
616 lockdep_assert_held(&mvm->mutex);
618 mvm->rfkill_safe_init_done = false;
620 if (mvm->trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210) {
621 sb_cfg = iwl_read_umac_prph(mvm->trans, SB_MODIFY_CFG_FLAG);
623 mvm->fw_product_reset = sb_cfg == SB_CFG_RESIDES_IN_ROM;
624 if (mvm->fw_product_reset && iwl_mei_pldr_req())
625 return -EBUSY;
628 iwl_init_notification_wait(&mvm->notif_wait,
635 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_EARLY, NULL);
643 if (mvm->fw_product_reset) {
645 iwl_trans_pcie_remove(mvm->trans, true);
650 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_AFTER_ALIVE,
653 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ)
654 mvm->trans->step_urm = !!(iwl_read_umac_prph(mvm->trans,
672 if (mvm->nvm_file_name) {
673 ret = iwl_read_external_nvm(mvm->trans, mvm->nvm_file_name,
674 mvm->nvm_sections);
700 ret = iwl_wait_notification(&mvm->notif_wait, &init_wait,
706 if (!mvm->nvm_data) {
707 mvm->nvm_data = iwl_get_nvm(mvm->trans, mvm->fw,
708 mvm->set_tx_ant, mvm->set_rx_ant);
709 if (IS_ERR(mvm->nvm_data)) {
710 ret = PTR_ERR(mvm->nvm_data);
711 mvm->nvm_data = NULL;
717 mvm->rfkill_safe_init_done = true;
722 iwl_remove_notification(&mvm->notif_wait, &init_wait);
738 lockdep_assert_held(&mvm->mutex);
740 mvm->rfkill_safe_init_done = false;
742 iwl_init_notification_wait(&mvm->notif_wait,
747 mvm->phy_db);
749 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_EARLY, NULL);
758 if (mvm->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_8000) {
765 if (!mvm->nvm_data) {
774 if (mvm->nvm_file_name) {
780 WARN_ONCE(mvm->nvm_data->nvm_version < mvm->trans->cfg->nvm_ver,
782 mvm->nvm_data->nvm_version, mvm->trans->cfg->nvm_ver);
794 mvm->rfkill_safe_init_done = true;
812 ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait,
828 iwl_remove_notification(&mvm->notif_wait, &calib_wait);
830 mvm->rfkill_safe_init_done = false;
831 if (!mvm->nvm_data) {
832 /* we want to debug INIT and we have no NVM - fake */
833 mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) +
837 if (!mvm->nvm_data)
838 return -ENOMEM;
839 mvm->nvm_data->bands[0].channels = mvm->nvm_data->channels;
840 mvm->nvm_data->bands[0].n_channels = 1;
841 mvm->nvm_data->bands[0].n_bitrates = 1;
842 mvm->nvm_data->bands[0].bitrates =
843 (void *)(mvm->nvm_data->channels + 1);
844 mvm->nvm_data->bands[0].bitrates->hw_value = 10;
856 if (!mvm->trans->ltr_enabled)
873 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 3);
879 cmd.v7.flags = cpu_to_le32(mvm->fwrt.reduced_power_flags);
886 } else if (fw_has_api(&mvm->fw->ucode_capa,
891 } else if (fw_has_capa(&mvm->fw->ucode_capa,
905 ret = iwl_sar_fill_profile(&mvm->fwrt, per_chain,
930 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd.id,
943 else if (fw_has_api(&mvm->fwrt.fw->ucode_capa,
949 if (!iwl_sar_geo_support(&mvm->fwrt))
950 return -EOPNOTSUPP;
960 resp = (void *)cmd.resp_pkt->data;
961 ret = le32_to_cpu(resp->profile_idx);
964 ret = -EIO;
979 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id,
995 if (mvm->fwrt.geo_rev == 1)
1013 } else if (fw_has_api(&mvm->fwrt.fw->ucode_capa,
1034 ret = iwl_sar_geo_fill_table(&mvm->fwrt, &cmd.v1.table[0][0],
1052 ret = iwl_fill_ppag_table(&mvm->fwrt, &cmd, &cmd_size);
1071 if (!(iwl_is_ppag_approved(&mvm->fwrt)))
1109 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TAS_CFG)) {
1110 IWL_DEBUG_RADIO(mvm, "TAS not enabled in FW\n");
1114 ret = iwl_bios_get_tas_table(&mvm->fwrt, &data);
1145 fw_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id,
1175 int ret = iwl_bios_get_dsm(&mvm->fwrt, DSM_FUNC_RFI_CONFIG, &value);
1208 ret = iwl_fill_lari_config(&mvm->fwrt, &cmd, &cmd_size);
1225 iwl_acpi_get_guid_lock_status(&mvm->fwrt);
1228 ret = iwl_bios_get_ppag_table(&mvm->fwrt);
1236 ret = iwl_bios_get_wrds_table(&mvm->fwrt);
1245 if (!iwl_bios_get_wgds_table(&mvm->fwrt)) {
1256 ret = iwl_bios_get_ewrd_table(&mvm->fwrt);
1265 if (iwl_sar_geo_support(&mvm->fwrt)) {
1266 ret = iwl_bios_get_wgds_table(&mvm->fwrt);
1275 iwl_acpi_get_phy_filters(&mvm->fwrt, &mvm->phy_filters);
1277 if (iwl_bios_get_eckv(&mvm->fwrt, &mvm->ext_clock_valid))
1284 if (vif->type == NL80211_IFTYPE_STATION)
1290 u32 error_log_size = mvm->fw->ucode_capa.error_log_size;
1311 if (!mvm->error_recovery_buf)
1314 host_cmd.data[1] = mvm->error_recovery_buf;
1321 kfree(mvm->error_recovery_buf);
1322 mvm->error_recovery_buf = NULL;
1331 resp = le32_to_cpu(*(__le32 *)host_cmd.resp_pkt->data);
1337 ieee80211_iterate_interfaces(mvm->hw, 0,
1363 iwl_fw_dbg_stop_sync(&mvm->fwrt);
1364 iwl_trans_stop_device(mvm->trans);
1365 ret = iwl_trans_start_hw(mvm->trans);
1369 mvm->rfkill_safe_init_done = false;
1374 mvm->rfkill_safe_init_done = true;
1376 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_AFTER_ALIVE,
1379 return iwl_init_paging(&mvm->fwrt, mvm->fwrt.cur_fw_img);
1387 lockdep_assert_held(&mvm->mutex);
1389 ret = iwl_trans_start_hw(mvm->trans);
1396 if (ret != -ERFKILL && !mvm->fw_product_reset)
1397 iwl_fw_dbg_error_collect(&mvm->fwrt,
1402 /* FW loaded successfully */
1403 mvm->fw_product_reset = false;
1405 iwl_fw_disable_dbg_asserts(&mvm->fwrt);
1406 iwl_get_shared_mem_conf(&mvm->fwrt);
1412 if (!iwl_trans_dbg_ini_valid(mvm->trans)) {
1413 mvm->fwrt.dump.conf = FW_DBG_INVALID;
1415 if (mvm->fw->dbg.dest_tlv)
1416 mvm->fwrt.dump.conf = FW_DBG_START_FROM_ALIVE;
1417 iwl_fw_start_dbg_conf(&mvm->fwrt, FW_DBG_START_FROM_ALIVE);
1426 ret = iwl_send_phy_db_data(mvm->phy_db);
1438 if (fw_has_capa(&mvm->fw->ucode_capa,
1440 ret = iwl_set_soc_latency(&mvm->fwrt);
1448 ret = iwl_configure_rxq(&mvm->fwrt);
1461 /* init the fw <-> mac80211 STA mapping */
1462 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) {
1463 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL);
1464 RCU_INIT_POINTER(mvm->fw_id_to_link_sta[i], NULL);
1468 RCU_INIT_POINTER(mvm->link_id_to_link_conf[i], NULL);
1470 mvm->tdls_cs.peer.sta_id = IWL_MVM_INVALID_STA;
1472 /* reset quota debouncing buffer - 0xff will yield invalid data */
1473 memset(&mvm->last_quota_cmd, 0xff, sizeof(mvm->last_quota_cmd));
1475 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_DQA_SUPPORT)) {
1483 * Newer versions of this command implies that the fw uses
1487 if (!iwl_mvm_has_new_station_api(mvm->fw)) {
1500 sband = mvm->hw->wiphy->bands[i++];
1503 ret = -ENODEV;
1508 /* in order to give the responsibility of ct-kill and
1509 * TX backoff to FW we need to send empty temperature reporting
1527 mvm->cooling_dev.cur_state);
1533 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_SET_LTR_GEN2))
1541 * RTNL is not taken during Ct-kill, but we don't need to scan/Tx
1544 if (!test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status)) {
1550 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
1551 mvm->scan_type = IWL_SCAN_TYPE_NOT_SET;
1552 mvm->hb_scan_type = IWL_SCAN_TYPE_NOT_SET;
1558 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
1561 if (mvm->time_sync.active)
1562 iwl_mvm_time_sync_config(mvm, mvm->time_sync.peer_addr,
1567 if (!mvm->ptp_data.ptp_clock)
1606 lockdep_assert_held(&mvm->mutex);
1608 ret = iwl_trans_start_hw(mvm->trans);
1623 ret = iwl_send_phy_db_data(mvm->phy_db);
1631 /* init the fw <-> mac80211 STA mapping */
1632 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) {
1633 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL);
1634 RCU_INIT_POINTER(mvm->fw_id_to_link_sta[i], NULL);
1637 if (!iwl_mvm_has_new_station_api(mvm->fw)) {
1640 * Newer versions of this command implies that the fw uses
1661 struct iwl_mfuart_load_notif *mfuart_notif = (void *)pkt->data;
1665 le32_to_cpu(mfuart_notif->installed_ver),
1666 le32_to_cpu(mfuart_notif->external_ver),
1667 le32_to_cpu(mfuart_notif->status),
1668 le32_to_cpu(mfuart_notif->duration));
1673 le32_to_cpu(mfuart_notif->image_size));