Lines Matching +full:rfkill +full:- +full:pcie +full:- +full:wlan
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
3 * Copyright (C) 2005-2014, 2018-2023 Intel Corporation
4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5 * Copyright (C) 2016-2017 Intel Deutschland GmbH
15 #include "iwl-debug.h"
16 #include "iwl-config.h"
18 #include "iwl-op-mode.h"
22 #include "fw/api/dbg-tlv.h"
23 #include "iwl-dbg-tlv.h"
26 * DOC: Transport layer - what is it ?
65 #define FH_RSCSR_FRAME_SIZE_MSK 0x00003FFF /* bits 0-13 */
81 * 28-27: Reserved
87 * 21-16: RX queue
88 * 15-14: Reserved
89 * 13-00: RX frame size
98 return le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; in iwl_rx_packet_len()
103 return iwl_rx_packet_len(pkt) - sizeof(pkt->hdr); in iwl_rx_packet_payload_len()
107 * enum CMD_MODE - how to send the host commands ?
112 * @CMD_SEND_IN_RFKILL: Send the command even if the NIC is in RF-kill.
116 * trans->system_pm_mode to IWL_PLAT_PM_MODE_D3.
143 u8 payload_wide[DEF_CMD_PAYLOAD_SIZE -
151 * struct iwl_device_tx_cmd - buffer for TX command
174 #define IWL_TRANS_MAX_FRAGS(trans) ((trans)->txqs.tfd.max_tbs - 3)
177 * enum iwl_hcmd_dataflag - flag for each one of the chunks of the command
207 * struct iwl_host_cmd - Host command to the uCode
233 free_pages(cmd->_rx_page_addr, cmd->_rx_page_order); in iwl_free_resp()
246 return (void *)((unsigned long)page_address(r->_page) + r->_offset); in rxb_addr()
251 return r->_offset; in rxb_offset()
256 r->_page_stolen = true; in rxb_steal_page()
257 get_page(r->_page); in rxb_steal_page()
258 return r->_page; in rxb_steal_page()
263 __free_pages(r->_page, r->_rx_page_order); in iwl_free_rxb()
268 #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
284 * enum iwl_wowlan_status - WoWLAN image/device status
299 * @STATUS_RFKILL_HW: the actual HW state of the RF-kill switch
300 * @STATUS_RFKILL_OPMODE: RF-kill state reported to opmode
304 * @STATUS_TRANS_IDLE: the trans is idle - general commands are not to be sent
305 * @STATUS_TRANS_DEAD: trans is dead - avoid any read/write operation
337 return -1; in iwl_trans_get_rb_size_order()
376 * struct iwl_dump_sanitize_ops - dump sanitization operations
390 * struct iwl_trans_config - transport configuration
402 * @rx_buf_size: RX buffer size needed for A-MSDUs
410 * @cb_data_offs: offset inside skb->cb to store transport data at, must have
453 * struct iwl_trans_rxq_dma_data - RX queue DMA data
470 * struct iwl_pnvm_image - contains info about the parsed pnvm image
485 * struct iwl_trans_ops - transport specific operations
510 * @send_cmd:send a host command. Must return -ERFKILL if RFkill is asserted.
511 * If RFkill is asserted in the middle of a SYNC host command, it must
512 * return -ERFKILL straight away.
515 * the ieee80211_tx_info->driver_data. If the MPDU is an A-MSDU, all
529 * @txq_disable: de-configure a Tx queue to send AMPDUs
550 * @grab_nic_access: wake the NIC to be able to access non-HBUS regs.
555 * @set_bits_mask - set SRAM register according to value and mask.
655 * enum iwl_trans_state - state of the transport layer
670 * In system-wide power management the entire platform goes into a low
676 * mode is dictated by the wake-on-WLAN configuration.
680 * - D0: the device is fully powered and the host is awake;
681 * - D3: the device is in low power mode and only reacts to
682 * specific events (e.g. magic-packet received or scan
690 * enum iwl_plat_pm_mode - platform power management mode
693 * behavior when in system-wide suspend (i.e WoWLAN).
696 * device. In system-wide suspend mode, it means that the all
735 * struct iwl_dram_regions - DRAM regions container structure
749 * struct iwl_fw_mon - fw monitor per allocation id
759 * struct iwl_self_init_dram - dram data used by self init process
773 * struct iwl_imr_data - imr dram data used during debug process
795 * struct iwl_pc_data - program counter details
805 * struct iwl_trans_debug - transport debug related data
918 * struct iwl_txq - Tx Queue for DMA
921 * the writeback -- this is DMA memory and an array holding one buffer
930 * @wd_timeout: queue watchdog timeout (jiffies) - per queue
934 * @write_ptr: 1-st empty entry (index) host_w
988 * struct iwl_trans_txqs - transport tx queues data
991 * @page_offs: offset from skb->cb to mac header page pointer
992 * @dev_cmd_offs: offset from skb->cb to iwl_device_tx_cmd pointer
993 * @queue_used - bit mask of used queues
994 * @queue_stopped - bit mask of stopped queues
1027 * struct iwl_trans - transport common data
1029 * @csme_own - true if we couldn't get ownership on the device
1030 * @ops - pointer to iwl_trans_ops
1031 * @op_mode - pointer to the op_mode
1032 * @trans_cfg: the trans-specific configuration part
1033 * @cfg - pointer to the configuration
1034 * @drv - pointer to iwl_drv
1035 * @status: a bit-mask of transport status flags
1036 * @dev - pointer to struct device * that represents the device
1042 * @hw_id: a u32 with the ID of the device / sub-device.
1056 * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only.
1062 * @system_pm_mode: the system-wide power management mode in use.
1068 * @pcie_link_speed: current PCIe link speed (%PCI_EXP_LNKSTA_CLS_*),
1148 trans->op_mode = trans_cfg->op_mode; in iwl_trans_configure()
1150 trans->ops->configure(trans, trans_cfg); in iwl_trans_configure()
1158 return trans->ops->start_hw(trans); in iwl_trans_start_hw()
1165 if (trans->ops->op_mode_leave) in iwl_trans_op_mode_leave()
1166 trans->ops->op_mode_leave(trans); in iwl_trans_op_mode_leave()
1168 trans->op_mode = NULL; in iwl_trans_op_mode_leave()
1170 trans->state = IWL_TRANS_NO_FW; in iwl_trans_op_mode_leave()
1177 trans->state = IWL_TRANS_FW_ALIVE; in iwl_trans_fw_alive()
1179 trans->ops->fw_alive(trans, scd_addr); in iwl_trans_fw_alive()
1190 WARN_ON_ONCE(!trans->rx_mpdu_cmd); in iwl_trans_start_fw()
1192 clear_bit(STATUS_FW_ERROR, &trans->status); in iwl_trans_start_fw()
1193 ret = trans->ops->start_fw(trans, fw, run_in_rfkill); in iwl_trans_start_fw()
1195 trans->state = IWL_TRANS_FW_STARTED; in iwl_trans_start_fw()
1204 trans->ops->stop_device(trans); in iwl_trans_stop_device()
1206 trans->state = IWL_TRANS_NO_FW; in iwl_trans_stop_device()
1213 if (!trans->ops->d3_suspend) in iwl_trans_d3_suspend()
1214 return -EOPNOTSUPP; in iwl_trans_d3_suspend()
1216 return trans->ops->d3_suspend(trans, test, reset); in iwl_trans_d3_suspend()
1224 if (!trans->ops->d3_resume) in iwl_trans_d3_resume()
1225 return -EOPNOTSUPP; in iwl_trans_d3_resume()
1227 return trans->ops->d3_resume(trans, status, test, reset); in iwl_trans_d3_resume()
1235 if (!trans->ops->dump_data) in iwl_trans_dump_data()
1237 return trans->ops->dump_data(trans, dump_mask, in iwl_trans_dump_data()
1244 return kmem_cache_zalloc(trans->dev_cmd_pool, GFP_ATOMIC); in iwl_trans_alloc_tx_cmd()
1252 kmem_cache_free(trans->dev_cmd_pool, dev_cmd); in iwl_trans_free_tx_cmd()
1258 if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status))) in iwl_trans_tx()
1259 return -EIO; in iwl_trans_tx()
1261 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_tx()
1262 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_tx()
1263 return -EIO; in iwl_trans_tx()
1266 return trans->ops->tx(trans, skb, dev_cmd, queue); in iwl_trans_tx()
1273 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_reclaim()
1274 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_reclaim()
1278 trans->ops->reclaim(trans, queue, ssn, skbs, is_flush); in iwl_trans_reclaim()
1284 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_set_q_ptrs()
1285 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_set_q_ptrs()
1289 trans->ops->set_q_ptrs(trans, queue, ptr); in iwl_trans_set_q_ptrs()
1295 trans->ops->txq_disable(trans, queue, configure_scd); in iwl_trans_txq_disable()
1305 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_txq_enable_cfg()
1306 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_txq_enable_cfg()
1310 return trans->ops->txq_enable(trans, queue, ssn, in iwl_trans_txq_enable_cfg()
1318 if (WARN_ON_ONCE(!trans->ops->rxq_dma_data)) in iwl_trans_get_rxq_dma_data()
1319 return -EOPNOTSUPP; in iwl_trans_get_rxq_dma_data()
1321 return trans->ops->rxq_dma_data(trans, queue, data); in iwl_trans_get_rxq_dma_data()
1327 if (WARN_ON_ONCE(!trans->ops->txq_free)) in iwl_trans_txq_free()
1330 trans->ops->txq_free(trans, queue); in iwl_trans_txq_free()
1340 if (WARN_ON_ONCE(!trans->ops->txq_alloc)) in iwl_trans_txq_alloc()
1341 return -EOPNOTSUPP; in iwl_trans_txq_alloc()
1343 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_txq_alloc()
1344 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_txq_alloc()
1345 return -EIO; in iwl_trans_txq_alloc()
1348 return trans->ops->txq_alloc(trans, flags, sta_mask, tid, in iwl_trans_txq_alloc()
1355 if (trans->ops->txq_set_shared_mode) in iwl_trans_txq_set_shared_mode()
1356 trans->ops->txq_set_shared_mode(trans, queue, shared_mode); in iwl_trans_txq_set_shared_mode()
1381 .sta_id = -1, in iwl_trans_ac_txq_enable()
1394 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_freeze_txq_timer()
1395 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_freeze_txq_timer()
1399 if (trans->ops->freeze_txq_timer) in iwl_trans_freeze_txq_timer()
1400 trans->ops->freeze_txq_timer(trans, txqs, freeze); in iwl_trans_freeze_txq_timer()
1406 if (WARN_ON_ONCE(!trans->ops->wait_tx_queues_empty)) in iwl_trans_wait_tx_queues_empty()
1407 return -EOPNOTSUPP; in iwl_trans_wait_tx_queues_empty()
1410 if (trans->state != IWL_TRANS_FW_ALIVE) { in iwl_trans_wait_tx_queues_empty()
1411 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_wait_tx_queues_empty()
1412 return -EIO; in iwl_trans_wait_tx_queues_empty()
1415 return trans->ops->wait_tx_queues_empty(trans, txqs); in iwl_trans_wait_tx_queues_empty()
1420 if (WARN_ON_ONCE(!trans->ops->wait_txq_empty)) in iwl_trans_wait_txq_empty()
1421 return -EOPNOTSUPP; in iwl_trans_wait_txq_empty()
1423 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_wait_txq_empty()
1424 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_wait_txq_empty()
1425 return -EIO; in iwl_trans_wait_txq_empty()
1428 return trans->ops->wait_txq_empty(trans, queue); in iwl_trans_wait_txq_empty()
1433 trans->ops->write8(trans, ofs, val); in iwl_trans_write8()
1438 trans->ops->write32(trans, ofs, val); in iwl_trans_write32()
1443 return trans->ops->read32(trans, ofs); in iwl_trans_read32()
1448 return trans->ops->read_prph(trans, ofs); in iwl_trans_read_prph()
1454 return trans->ops->write_prph(trans, ofs, val); in iwl_trans_write_prph()
1460 return trans->ops->read_mem(trans, addr, buf, dwords); in iwl_trans_read_mem()
1474 if (trans->ops->imr_dma_data) in iwl_trans_write_imr_mem()
1475 return trans->ops->imr_dma_data(trans, dst_addr, src_addr, byte_cnt); in iwl_trans_write_imr_mem()
1492 return trans->ops->write_mem(trans, addr, buf, dwords); in iwl_trans_write_mem()
1503 if (trans->ops->set_pmi) in iwl_trans_set_pmi()
1504 trans->ops->set_pmi(trans, state); in iwl_trans_set_pmi()
1510 if (trans->ops->sw_reset) in iwl_trans_sw_reset()
1511 return trans->ops->sw_reset(trans, retake_ownership); in iwl_trans_sw_reset()
1518 trans->ops->set_bits_mask(trans, reg, mask, value); in iwl_trans_set_bits_mask()
1523 likely((trans)->ops->grab_nic_access(trans)))
1528 trans->ops->release_nic_access(trans); in __releases()
1534 if (WARN_ON_ONCE(!trans->op_mode)) in iwl_trans_fw_error()
1538 if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status)) { in iwl_trans_fw_error()
1539 iwl_op_mode_nic_error(trans->op_mode, sync); in iwl_trans_fw_error()
1540 trans->state = IWL_TRANS_NO_FW; in iwl_trans_fw_error()
1546 return trans->state == IWL_TRANS_FW_ALIVE; in iwl_trans_fw_running()
1551 if (trans->ops->sync_nmi) in iwl_trans_sync_nmi()
1552 trans->ops->sync_nmi(trans); in iwl_trans_sync_nmi()
1562 return trans->ops->load_pnvm(trans, pnvm_data, capa); in iwl_trans_load_pnvm()
1568 if (trans->ops->set_pnvm) in iwl_trans_set_pnvm()
1569 trans->ops->set_pnvm(trans, capa); in iwl_trans_set_pnvm()
1577 return trans->ops->load_reduce_power(trans, payloads, capa); in iwl_trans_load_reduce_power()
1584 if (trans->ops->set_reduce_power) in iwl_trans_set_reduce_power()
1585 trans->ops->set_reduce_power(trans, capa); in iwl_trans_set_reduce_power()
1590 return trans->dbg.internal_ini_cfg != IWL_INI_CFG_STATE_NOT_LOADED || in iwl_trans_dbg_ini_valid()
1591 trans->dbg.external_ini_cfg != IWL_INI_CFG_STATE_NOT_LOADED; in iwl_trans_dbg_ini_valid()
1596 if (trans->ops->interrupts) in iwl_trans_interrupts()
1597 trans->ops->interrupts(trans, enable); in iwl_trans_interrupts()