Lines Matching +full:fw +full:- +full:cfg
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2024-2025 Intel Corporation
8 #include "fw/api/rx.h"
9 #include "fw/api/datapath.h"
10 #include "fw/api/commands.h"
11 #include "fw/api/offload.h"
12 #include "fw/api/coex.h"
13 #include "fw/dbg.h"
14 #include "fw/uefi.h"
27 #include "fw/api/location.h"
29 #include "iwl-nvm-parse.h"
57 struct wiphy *wiphy = mld->wiphy; in iwl_mld_hw_set_regulatory()
59 wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED; in iwl_mld_hw_set_regulatory()
60 wiphy->regulatory_flags |= REGULATORY_ENABLE_RELAX_NO_IR; in iwl_mld_hw_set_regulatory()
65 const struct iwl_rf_cfg *cfg, const struct iwl_fw *fw, in iwl_construct_mld() argument
68 mld->dev = trans->dev; in iwl_construct_mld()
69 mld->trans = trans; in iwl_construct_mld()
70 mld->cfg = cfg; in iwl_construct_mld()
71 mld->fw = fw; in iwl_construct_mld()
72 mld->hw = hw; in iwl_construct_mld()
73 mld->wiphy = hw->wiphy; in iwl_construct_mld()
74 mld->debugfs_dir = dbgfs_dir; in iwl_construct_mld()
76 iwl_notification_wait_init(&mld->notif_wait); in iwl_construct_mld()
79 spin_lock_init(&mld->async_handlers_lock); in iwl_construct_mld()
80 INIT_LIST_HEAD(&mld->async_handlers_list); in iwl_construct_mld()
81 wiphy_work_init(&mld->async_handlers_wk, in iwl_construct_mld()
85 spin_lock_init(&mld->add_txqs_lock); in iwl_construct_mld()
86 INIT_LIST_HEAD(&mld->txqs_to_add); in iwl_construct_mld()
87 wiphy_work_init(&mld->add_txqs_wk, iwl_mld_add_txqs_wk); in iwl_construct_mld()
90 init_waitqueue_head(&mld->rxq_sync.waitq); in iwl_construct_mld()
94 static void __acquires(&mld->wiphy->mtx)
99 wiphy_lock(mld->wiphy); in iwl_mld_fwrt_dump_start()
102 static void __releases(&mld->wiphy->mtx)
107 wiphy_unlock(mld->wiphy); in iwl_mld_fwrt_dump_end()
120 wiphy_lock(mld->wiphy); in iwl_mld_fwrt_send_hcmd()
122 wiphy_unlock(mld->wiphy); in iwl_mld_fwrt_send_hcmd()
136 const struct iwl_fw *fw, in iwl_mld_construct_fw_runtime() argument
139 iwl_fw_runtime_init(&mld->fwrt, trans, fw, &iwl_mld_fwrt_ops, mld, in iwl_mld_construct_fw_runtime()
142 iwl_fw_set_current_image(&mld->fwrt, IWL_UCODE_REGULAR); in iwl_mld_construct_fw_runtime()
340 struct iwl_trans *trans = mld->trans; in iwl_mld_configure_trans()
343 iwl_bios_setup_step(trans, &mld->fwrt); in iwl_mld_configure_trans()
346 if (iwl_bios_get_eckv(&mld->fwrt, &eckv_value)) in iwl_mld_configure_trans()
349 trans->conf.ext_32khz_clock_valid = !!eckv_value; in iwl_mld_configure_trans()
351 trans->conf.rx_buf_size = iwl_amsdu_size_to_rxb_size(); in iwl_mld_configure_trans()
352 trans->conf.command_groups = iwl_mld_groups; in iwl_mld_configure_trans()
353 trans->conf.command_groups_size = ARRAY_SIZE(iwl_mld_groups); in iwl_mld_configure_trans()
354 trans->conf.fw_reset_handshake = true; in iwl_mld_configure_trans()
355 trans->conf.queue_alloc_cmd_ver = in iwl_mld_configure_trans()
356 iwl_fw_lookup_cmd_ver(mld->fw, WIDE_ID(DATA_PATH_GROUP, in iwl_mld_configure_trans()
359 trans->conf.cb_data_offs = offsetof(struct ieee80211_tx_info, in iwl_mld_configure_trans()
362 sizeof(trans->conf.no_reclaim_cmds)); in iwl_mld_configure_trans()
363 memcpy(trans->conf.no_reclaim_cmds, no_reclaim_cmds, in iwl_mld_configure_trans()
365 trans->conf.n_no_reclaim_cmds = ARRAY_SIZE(no_reclaim_cmds); in iwl_mld_configure_trans()
367 trans->conf.rx_mpdu_cmd = REPLY_RX_MPDU_CMD; in iwl_mld_configure_trans()
368 trans->conf.rx_mpdu_cmd_hdr_size = sizeof(struct iwl_rx_mpdu_desc); in iwl_mld_configure_trans()
369 trans->conf.wide_cmd_header = true; in iwl_mld_configure_trans()
382 iwl_op_mode_mld_start(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg, in iwl_op_mode_mld_start() argument
383 const struct iwl_fw *fw, struct dentry *dbgfs_dir) in iwl_op_mode_mld_start() argument
395 return ERR_PTR(-ENOMEM); in iwl_op_mode_mld_start()
397 op_mode = hw->priv; in iwl_op_mode_mld_start()
399 op_mode->ops = &iwl_mld_ops; in iwl_op_mode_mld_start()
403 iwl_construct_mld(mld, trans, cfg, fw, hw, dbgfs_dir); in iwl_op_mode_mld_start()
406 mld->fw_rates_ver_3 = iwl_fw_lookup_cmd_ver(mld->fw, TX_CMD, 0) >= 11; in iwl_op_mode_mld_start()
408 iwl_mld_construct_fw_runtime(mld, trans, fw, dbgfs_dir); in iwl_op_mode_mld_start()
411 iwl_uefi_get_sgom_table(trans, &mld->fwrt); in iwl_op_mode_mld_start()
412 mld->bios_enable_puncturing = iwl_uefi_get_puncturing(&mld->fwrt); in iwl_op_mode_mld_start()
422 wiphy_lock(mld->wiphy); in iwl_op_mode_mld_start()
431 mld->nvm_data = iwl_get_nvm(mld->trans, mld->fw, 0, 0); in iwl_op_mode_mld_start()
432 if (IS_ERR(mld->nvm_data)) { in iwl_op_mode_mld_start()
434 ret = PTR_ERR(mld->nvm_data); in iwl_op_mode_mld_start()
439 wiphy_unlock(mld->wiphy); in iwl_op_mode_mld_start()
444 /* We are about to stop the FW. Notifications may require an in iwl_op_mode_mld_start()
445 * operational FW, so handle them all here before we stop. in iwl_op_mode_mld_start()
447 wiphy_work_flush(mld->wiphy, &mld->async_handlers_wk); in iwl_op_mode_mld_start()
451 wiphy_unlock(mld->wiphy); in iwl_op_mode_mld_start()
470 iwl_mld_toggle_tx_ant(mld, &mld->mgmt_tx_ant); in iwl_op_mode_mld_start()
482 kfree(mld->scan.cmd); in iwl_op_mode_mld_start()
486 kfree(mld->nvm_data); in iwl_op_mode_mld_start()
488 iwl_trans_op_mode_leave(mld->trans); in iwl_op_mode_mld_start()
489 ieee80211_free_hw(mld->hw); in iwl_op_mode_mld_start()
503 wiphy_lock(mld->wiphy); in iwl_op_mode_mld_stop()
506 wiphy_unlock(mld->wiphy); in iwl_op_mode_mld_stop()
508 ieee80211_unregister_hw(mld->hw); in iwl_op_mode_mld_stop()
510 iwl_fw_runtime_free(&mld->fwrt); in iwl_op_mode_mld_stop()
513 iwl_trans_op_mode_leave(mld->trans); in iwl_op_mode_mld_stop()
515 kfree(mld->nvm_data); in iwl_op_mode_mld_stop()
516 kfree(mld->scan.cmd); in iwl_op_mode_mld_stop()
517 kfree(mld->channel_survey); in iwl_op_mode_mld_stop()
518 kfree(mld->error_recovery_buf); in iwl_op_mode_mld_stop()
519 kfree(mld->mcast_filter_cmd); in iwl_op_mode_mld_stop()
521 ieee80211_free_hw(mld->hw); in iwl_op_mode_mld_stop()
534 txq = rcu_dereference(mld->fw_id_to_txq[hw_queue]); in iwl_mld_queue_state_change()
546 ieee80211_stop_queues(mld->hw); in iwl_mld_queue_state_change()
548 ieee80211_wake_queues(mld->hw); in iwl_mld_queue_state_change()
555 mld_sta = txq->sta ? iwl_mld_sta_from_mac80211(txq->sta) : NULL; in iwl_mld_queue_state_change()
557 mld_txq->status.stop_full = queue_full; in iwl_mld_queue_state_change()
560 mld_sta->sta_state != IEEE80211_STA_NOTEXIST) { in iwl_mld_queue_state_change()
597 iwl_trans_free_tx_cmd(mld->trans, info->driver_data[1]); in iwl_mld_free_skb()
598 ieee80211_free_txskb(mld->hw, skb); in iwl_mld_free_skb()
603 u32 src_size = mld->fw->ucode_capa.error_log_size; in iwl_mld_read_error_recovery_buffer()
604 u32 src_addr = mld->fw->ucode_capa.error_log_addr; in iwl_mld_read_error_recovery_buffer()
616 ret = iwl_trans_read_mem_bytes(mld->trans, src_addr, in iwl_mld_read_error_recovery_buffer()
625 mld->error_recovery_buf = recovery_buf; in iwl_mld_read_error_recovery_buffer()
632 mld->fwrt.trans->dbg.restart_required = false; in iwl_mld_restart_nic()
634 ieee80211_restart_hw(mld->hw); in iwl_mld_restart_nic()
642 bool trans_dead = iwl_trans_is_dead(mld->trans); in iwl_mld_nic_error()
646 else if (!trans_dead && !mld->fw_status.do_not_dump_once) in iwl_mld_nic_error()
647 iwl_fwrt_dump_error_logs(&mld->fwrt); in iwl_mld_nic_error()
649 mld->fw_status.do_not_dump_once = false; in iwl_mld_nic_error()
667 mld->fw_status.running) in iwl_mld_nic_error()
668 mld->fw_status.in_hw_restart = true; in iwl_mld_nic_error()
677 if (mode->context == IWL_ERR_CONTEXT_FROM_OPMODE) { in iwl_mld_dump_error()
678 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_dump_error()
679 iwl_fw_error_collect(&mld->fwrt); in iwl_mld_dump_error()
681 wiphy_lock(mld->wiphy); in iwl_mld_dump_error()
682 if (mode->context != IWL_ERR_CONTEXT_ABORT) in iwl_mld_dump_error()
683 iwl_fw_error_collect(&mld->fwrt); in iwl_mld_dump_error()
684 wiphy_unlock(mld->wiphy); in iwl_mld_dump_error()
698 mld->fw_status.in_hw_restart = true; in iwl_mld_sw_reset()
701 * - we consider the FW as running in iwl_mld_sw_reset()
702 * - The trigger that brought us here is defined as one that requires in iwl_mld_sw_reset()
705 if (!mld->fw_status.running || !mld->fwrt.trans->dbg.restart_required) in iwl_mld_sw_reset()
719 iwl_dbg_tlv_time_point(&mld->fwrt, tp_id, tp_data); in iwl_mld_time_point()
727 wiphy_lock(mld->wiphy); in iwl_mld_device_powered_off()
729 mld->fw_status.in_d3 = false; in iwl_mld_device_powered_off()
730 wiphy_unlock(mld->wiphy); in iwl_mld_device_powered_off()
740 struct iwl_fw_runtime *fwrt = &mld->fwrt; in iwl_mld_dump()
742 if (!iwl_trans_fw_running(fwrt->trans)) in iwl_mld_dump()
771 "power management scheme: 1-active, 2-balanced, default: 2");