Lines Matching +full:fifo +full:- +full:watermark +full:- +full:aligned
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
3 * Copyright (C) 2005-2014, 2018-2021 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 ?
61 #define FH_RSCSR_FRAME_SIZE_MSK 0x00003FFF /* bits 0-13 */
77 * 28-27: Reserved
83 * 21-16: RX queue
84 * 15-14: Reserved
85 * 13-00: RX frame size
94 return le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; in iwl_rx_packet_len()
99 return iwl_rx_packet_len(pkt) - sizeof(pkt->hdr); in iwl_rx_packet_payload_len()
103 * enum CMD_MODE - how to send the host commands ?
112 * trans->system_pm_mode to IWL_PLAT_PM_MODE_D3.
139 u8 payload_wide[DEF_CMD_PAYLOAD_SIZE -
147 * struct iwl_device_tx_cmd - buffer for TX command
170 #define IWL_TRANS_MAX_FRAGS(trans) ((trans)->txqs.tfd.max_tbs - 3)
173 * enum iwl_hcmd_dataflag - flag for each one of the chunks of the command
200 * struct iwl_host_cmd - Host command to the uCode
226 free_pages(cmd->_rx_page_addr, cmd->_rx_page_order); in iwl_free_resp()
239 return (void *)((unsigned long)page_address(r->_page) + r->_offset); in rxb_addr()
244 return r->_offset; in rxb_offset()
249 r->_page_stolen = true; in rxb_steal_page()
250 get_page(r->_page); in rxb_steal_page()
251 return r->_page; in rxb_steal_page()
256 __free_pages(r->_page, r->_rx_page_order); in iwl_free_rxb()
261 #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
277 * enum iwl_wowlan_status - WoWLAN image/device status
292 * @STATUS_RFKILL_HW: the actual HW state of the RF-kill switch
293 * @STATUS_RFKILL_OPMODE: RF-kill state reported to opmode
297 * @STATUS_TRANS_IDLE: the trans is idle - general commands are not to be sent
298 * @STATUS_TRANS_DEAD: trans is dead - avoid any read/write operation
327 return -1; in iwl_trans_get_rb_size_order()
366 * struct iwl_trans_config - transport configuration
371 * @cmd_fifo: the fifo for host commands
378 * @rx_buf_size: RX buffer size needed for A-MSDUs
386 * @cb_data_offs: offset inside skb->cb to store transport data at, must have
417 u8 fifo; member
425 * struct iwl_trans_rxq_dma_data - RX queue DMA data
439 * struct iwl_trans_ops - transport specific operations
464 * @send_cmd:send a host command. Must return -ERFKILL if RFkill is asserted.
466 * return -ERFKILL straight away.
469 * the ieee80211_tx_info->driver_data. If the MPDU is an A-MSDU, all
483 * @txq_disable: de-configure a Tx queue to send AMPDUs
509 * @grab_nic_access: wake the NIC to be able to access non-HBUS regs.
514 * @set_bits_mask - set SRAM register according to value and mask.
599 * enum iwl_trans_state - state of the transport layer
614 * In system-wide power management the entire platform goes into a low
620 * mode is dictated by the wake-on-WLAN configuration.
624 * - D0: the device is fully powered and the host is awake;
625 * - D3: the device is in low power mode and only reacts to
626 * specific events (e.g. magic-packet received or scan
634 * enum iwl_plat_pm_mode - platform power management mode
637 * behavior when in system-wide suspend (i.e WoWLAN).
640 * device. In system-wide suspend mode, it means that the all
679 * struct iwl_fw_mon - fw monitor per allocation id
689 * struct iwl_self_init_dram - dram data used by self init process
703 * struct iwl_trans_debug - transport debug related data
801 * struct iwl_txq - Tx Queue for DMA
805 * the writeback -- this is DMA memory and an array holding one buffer
814 * @wd_timeout: queue watchdog timeout (jiffies) - per queue
818 * @write_ptr: 1-st empty entry (index) host_w
823 * @low_mark: low watermark, resume queue if free space more than this
824 * @high_mark: high watermark, stop queue if free space less than this
872 * struct iwl_trans_txqs - transport tx queues data
875 * @page_offs: offset from skb->cb to mac header page pointer
876 * @dev_cmd_offs: offset from skb->cb to iwl_device_tx_cmd pointer
877 * @queue_used - bit mask of used queues
878 * @queue_stopped - bit mask of stopped queues
893 u8 fifo; member
908 * struct iwl_trans - transport common data
910 * @ops - pointer to iwl_trans_ops
911 * @op_mode - pointer to the op_mode
912 * @trans_cfg: the trans-specific configuration part
913 * @cfg - pointer to the configuration
914 * @drv - pointer to iwl_drv
915 * @status: a bit-mask of transport status flags
916 * @dev - pointer to struct device * that represents the device
920 * @hw_id: a u32 with the ID of the device / sub-device.
931 * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only.
938 * @system_pm_mode: the system-wide power management mode in use.
996 /*Ensure that this pointer will always be aligned to sizeof pointer */
1006 trans->op_mode = trans_cfg->op_mode; in iwl_trans_configure()
1008 trans->ops->configure(trans, trans_cfg); in iwl_trans_configure()
1016 return trans->ops->start_hw(trans); in iwl_trans_start_hw()
1023 if (trans->ops->op_mode_leave) in iwl_trans_op_mode_leave()
1024 trans->ops->op_mode_leave(trans); in iwl_trans_op_mode_leave()
1026 trans->op_mode = NULL; in iwl_trans_op_mode_leave()
1028 trans->state = IWL_TRANS_NO_FW; in iwl_trans_op_mode_leave()
1035 trans->state = IWL_TRANS_FW_ALIVE; in iwl_trans_fw_alive()
1037 trans->ops->fw_alive(trans, scd_addr); in iwl_trans_fw_alive()
1048 WARN_ON_ONCE(!trans->rx_mpdu_cmd); in iwl_trans_start_fw()
1050 clear_bit(STATUS_FW_ERROR, &trans->status); in iwl_trans_start_fw()
1051 ret = trans->ops->start_fw(trans, fw, run_in_rfkill); in iwl_trans_start_fw()
1053 trans->state = IWL_TRANS_FW_STARTED; in iwl_trans_start_fw()
1062 trans->ops->stop_device(trans); in iwl_trans_stop_device()
1064 trans->state = IWL_TRANS_NO_FW; in iwl_trans_stop_device()
1071 if (!trans->ops->d3_suspend) in iwl_trans_d3_suspend()
1074 return trans->ops->d3_suspend(trans, test, reset); in iwl_trans_d3_suspend()
1082 if (!trans->ops->d3_resume) in iwl_trans_d3_resume()
1085 return trans->ops->d3_resume(trans, status, test, reset); in iwl_trans_d3_resume()
1091 if (!trans->ops->dump_data) in iwl_trans_dump_data()
1093 return trans->ops->dump_data(trans, dump_mask); in iwl_trans_dump_data()
1099 return kmem_cache_zalloc(trans->dev_cmd_pool, GFP_ATOMIC); in iwl_trans_alloc_tx_cmd()
1107 kmem_cache_free(trans->dev_cmd_pool, dev_cmd); in iwl_trans_free_tx_cmd()
1113 if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status))) in iwl_trans_tx()
1114 return -EIO; in iwl_trans_tx()
1116 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_tx()
1117 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_tx()
1118 return -EIO; in iwl_trans_tx()
1121 return trans->ops->tx(trans, skb, dev_cmd, queue); in iwl_trans_tx()
1127 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_reclaim()
1128 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_reclaim()
1132 trans->ops->reclaim(trans, queue, ssn, skbs); in iwl_trans_reclaim()
1138 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_set_q_ptrs()
1139 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_set_q_ptrs()
1143 trans->ops->set_q_ptrs(trans, queue, ptr); in iwl_trans_set_q_ptrs()
1149 trans->ops->txq_disable(trans, queue, configure_scd); in iwl_trans_txq_disable()
1159 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_txq_enable_cfg()
1160 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_txq_enable_cfg()
1164 return trans->ops->txq_enable(trans, queue, ssn, in iwl_trans_txq_enable_cfg()
1172 if (WARN_ON_ONCE(!trans->ops->rxq_dma_data)) in iwl_trans_get_rxq_dma_data()
1173 return -ENOTSUPP; in iwl_trans_get_rxq_dma_data()
1175 return trans->ops->rxq_dma_data(trans, queue, data); in iwl_trans_get_rxq_dma_data()
1181 if (WARN_ON_ONCE(!trans->ops->txq_free)) in iwl_trans_txq_free()
1184 trans->ops->txq_free(trans, queue); in iwl_trans_txq_free()
1195 if (WARN_ON_ONCE(!trans->ops->txq_alloc)) in iwl_trans_txq_alloc()
1196 return -ENOTSUPP; in iwl_trans_txq_alloc()
1198 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_txq_alloc()
1199 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_txq_alloc()
1200 return -EIO; in iwl_trans_txq_alloc()
1203 return trans->ops->txq_alloc(trans, flags, sta_id, tid, in iwl_trans_txq_alloc()
1210 if (trans->ops->txq_set_shared_mode) in iwl_trans_txq_set_shared_mode()
1211 trans->ops->txq_set_shared_mode(trans, queue, shared_mode); in iwl_trans_txq_set_shared_mode()
1215 int fifo, int sta_id, int tid, in iwl_trans_txq_enable() argument
1220 .fifo = fifo, in iwl_trans_txq_enable()
1231 void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue, int fifo, in iwl_trans_ac_txq_enable() argument
1235 .fifo = fifo, in iwl_trans_ac_txq_enable()
1236 .sta_id = -1, in iwl_trans_ac_txq_enable()
1249 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_freeze_txq_timer()
1250 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_freeze_txq_timer()
1254 if (trans->ops->freeze_txq_timer) in iwl_trans_freeze_txq_timer()
1255 trans->ops->freeze_txq_timer(trans, txqs, freeze); in iwl_trans_freeze_txq_timer()
1261 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_block_txq_ptrs()
1262 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_block_txq_ptrs()
1266 if (trans->ops->block_txq_ptrs) in iwl_trans_block_txq_ptrs()
1267 trans->ops->block_txq_ptrs(trans, block); in iwl_trans_block_txq_ptrs()
1273 if (WARN_ON_ONCE(!trans->ops->wait_tx_queues_empty)) in iwl_trans_wait_tx_queues_empty()
1274 return -ENOTSUPP; in iwl_trans_wait_tx_queues_empty()
1277 if (trans->state != IWL_TRANS_FW_ALIVE) { in iwl_trans_wait_tx_queues_empty()
1278 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_wait_tx_queues_empty()
1279 return -EIO; in iwl_trans_wait_tx_queues_empty()
1282 return trans->ops->wait_tx_queues_empty(trans, txqs); in iwl_trans_wait_tx_queues_empty()
1287 if (WARN_ON_ONCE(!trans->ops->wait_txq_empty)) in iwl_trans_wait_txq_empty()
1288 return -ENOTSUPP; in iwl_trans_wait_txq_empty()
1290 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_wait_txq_empty()
1291 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_wait_txq_empty()
1292 return -EIO; in iwl_trans_wait_txq_empty()
1295 return trans->ops->wait_txq_empty(trans, queue); in iwl_trans_wait_txq_empty()
1300 trans->ops->write8(trans, ofs, val); in iwl_trans_write8()
1305 trans->ops->write32(trans, ofs, val); in iwl_trans_write32()
1310 return trans->ops->read32(trans, ofs); in iwl_trans_read32()
1315 return trans->ops->read_prph(trans, ofs); in iwl_trans_read_prph()
1321 return trans->ops->write_prph(trans, ofs, val); in iwl_trans_write_prph()
1327 return trans->ops->read_mem(trans, addr, buf, dwords); in iwl_trans_read_mem()
1350 return trans->ops->write_mem(trans, addr, buf, dwords); in iwl_trans_write_mem()
1361 if (trans->ops->set_pmi) in iwl_trans_set_pmi()
1362 trans->ops->set_pmi(trans, state); in iwl_trans_set_pmi()
1367 if (trans->ops->sw_reset) in iwl_trans_sw_reset()
1368 trans->ops->sw_reset(trans); in iwl_trans_sw_reset()
1374 trans->ops->set_bits_mask(trans, reg, mask, value); in iwl_trans_set_bits_mask()
1379 likely((trans)->ops->grab_nic_access(trans)))
1384 trans->ops->release_nic_access(trans); in __releases()
1390 if (WARN_ON_ONCE(!trans->op_mode)) in iwl_trans_fw_error()
1394 if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status)) { in iwl_trans_fw_error()
1395 iwl_op_mode_nic_error(trans->op_mode, sync); in iwl_trans_fw_error()
1396 trans->state = IWL_TRANS_NO_FW; in iwl_trans_fw_error()
1402 return trans->state == IWL_TRANS_FW_ALIVE; in iwl_trans_fw_running()
1407 if (trans->ops->sync_nmi) in iwl_trans_sync_nmi()
1408 trans->ops->sync_nmi(trans); in iwl_trans_sync_nmi()
1417 if (trans->ops->set_pnvm) { in iwl_trans_set_pnvm()
1418 int ret = trans->ops->set_pnvm(trans, data, len); in iwl_trans_set_pnvm()
1424 trans->pnvm_loaded = true; in iwl_trans_set_pnvm()
1432 if (trans->ops->set_reduce_power) { in iwl_trans_set_reduce_power()
1433 int ret = trans->ops->set_reduce_power(trans, data, len); in iwl_trans_set_reduce_power()
1439 trans->reduce_power_loaded = true; in iwl_trans_set_reduce_power()
1445 return trans->dbg.internal_ini_cfg != IWL_INI_CFG_STATE_NOT_LOADED || in iwl_trans_dbg_ini_valid()
1446 trans->dbg.external_ini_cfg != IWL_INI_CFG_STATE_NOT_LOADED; in iwl_trans_dbg_ini_valid()
1451 if (trans->ops->interrupts) in iwl_trans_interrupts()
1452 trans->ops->interrupts(trans, enable); in iwl_trans_interrupts()