Lines Matching refs:trans
63 #define IWL_TRANS_FW_DBG_DOMAIN(trans) IWL_FW_INI_DOMAIN_ALWAYS_ON
116 * trans->system_pm_mode to IWL_PLAT_PM_MODE_D3.
174 #define IWL_TRANS_MAX_FRAGS(trans) ((trans)->txqs.tfd.max_tbs - 3)
302 * @STATUS_TRANS_GOING_IDLE: shutting down the trans, only special commands
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
565 * of the trans debugfs
577 int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw,
579 void (*fw_alive)(struct iwl_trans *trans, u32 scd_addr);
580 void (*stop_device)(struct iwl_trans *trans);
582 int (*d3_suspend)(struct iwl_trans *trans, bool test, bool reset);
583 int (*d3_resume)(struct iwl_trans *trans, enum iwl_d3_status *status,
586 int (*send_cmd)(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
588 int (*tx)(struct iwl_trans *trans, struct sk_buff *skb,
590 void (*reclaim)(struct iwl_trans *trans, int queue, int ssn,
593 void (*set_q_ptrs)(struct iwl_trans *trans, int queue, int ptr);
595 bool (*txq_enable)(struct iwl_trans *trans, int queue, u16 ssn,
598 void (*txq_disable)(struct iwl_trans *trans, int queue,
601 int (*txq_alloc)(struct iwl_trans *trans, u32 flags,
604 void (*txq_free)(struct iwl_trans *trans, int queue);
605 int (*rxq_dma_data)(struct iwl_trans *trans, int queue,
608 void (*txq_set_shared_mode)(struct iwl_trans *trans, u32 txq_id,
611 int (*wait_tx_queues_empty)(struct iwl_trans *trans, u32 txq_bm);
612 int (*wait_txq_empty)(struct iwl_trans *trans, int queue);
613 void (*freeze_txq_timer)(struct iwl_trans *trans, unsigned long txqs,
615 void (*block_txq_ptrs)(struct iwl_trans *trans, bool block);
617 void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val);
618 void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val);
619 u32 (*read32)(struct iwl_trans *trans, u32 ofs);
620 u32 (*read_prph)(struct iwl_trans *trans, u32 ofs);
621 void (*write_prph)(struct iwl_trans *trans, u32 ofs, u32 val);
622 int (*read_mem)(struct iwl_trans *trans, u32 addr,
624 int (*write_mem)(struct iwl_trans *trans, u32 addr,
626 int (*read_config32)(struct iwl_trans *trans, u32 ofs, u32 *val);
627 void (*configure)(struct iwl_trans *trans,
629 void (*set_pmi)(struct iwl_trans *trans, bool state);
630 int (*sw_reset)(struct iwl_trans *trans, bool retake_ownership);
631 bool (*grab_nic_access)(struct iwl_trans *trans);
632 void (*release_nic_access)(struct iwl_trans *trans);
633 void (*set_bits_mask)(struct iwl_trans *trans, u32 reg, u32 mask,
636 struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans,
640 void (*debugfs_cleanup)(struct iwl_trans *trans);
641 void (*sync_nmi)(struct iwl_trans *trans);
642 int (*load_pnvm)(struct iwl_trans *trans,
645 void (*set_pnvm)(struct iwl_trans *trans,
647 int (*load_reduce_power)(struct iwl_trans *trans,
650 void (*set_reduce_power)(struct iwl_trans *trans,
653 void (*interrupts)(struct iwl_trans *trans, bool enable);
654 int (*imr_dma_data)(struct iwl_trans *trans,
932 * @trans: pointer back to transport (for timer)
972 struct iwl_trans *trans;
1037 * @trans_cfg: the trans-specific configuration part
1143 /* pointer to trans specific struct */
1148 const char *iwl_get_cmd_string(struct iwl_trans *trans, u32 id);
1149 int iwl_cmd_groups_verify_sorted(const struct iwl_trans_config *trans);
1151 static inline void iwl_trans_configure(struct iwl_trans *trans,
1154 trans->op_mode = trans_cfg->op_mode;
1156 trans->ops->configure(trans, trans_cfg);
1160 static inline int iwl_trans_start_hw(struct iwl_trans *trans)
1164 return trans->ops->start_hw(trans);
1167 static inline void iwl_trans_op_mode_leave(struct iwl_trans *trans)
1171 if (trans->ops->op_mode_leave)
1172 trans->ops->op_mode_leave(trans);
1174 trans->op_mode = NULL;
1176 trans->state = IWL_TRANS_NO_FW;
1179 static inline void iwl_trans_fw_alive(struct iwl_trans *trans, u32 scd_addr)
1183 trans->state = IWL_TRANS_FW_ALIVE;
1185 trans->ops->fw_alive(trans, scd_addr);
1188 static inline int iwl_trans_start_fw(struct iwl_trans *trans,
1196 WARN_ON_ONCE(!trans->rx_mpdu_cmd);
1198 clear_bit(STATUS_FW_ERROR, &trans->status);
1199 ret = trans->ops->start_fw(trans, fw, run_in_rfkill);
1201 trans->state = IWL_TRANS_FW_STARTED;
1206 static inline void iwl_trans_stop_device(struct iwl_trans *trans)
1210 trans->ops->stop_device(trans);
1212 trans->state = IWL_TRANS_NO_FW;
1215 static inline int iwl_trans_d3_suspend(struct iwl_trans *trans, bool test,
1219 if (!trans->ops->d3_suspend)
1222 return trans->ops->d3_suspend(trans, test, reset);
1225 static inline int iwl_trans_d3_resume(struct iwl_trans *trans,
1230 if (!trans->ops->d3_resume)
1233 return trans->ops->d3_resume(trans, status, test, reset);
1237 iwl_trans_dump_data(struct iwl_trans *trans, u32 dump_mask,
1241 if (!trans->ops->dump_data)
1243 return trans->ops->dump_data(trans, dump_mask,
1248 iwl_trans_alloc_tx_cmd(struct iwl_trans *trans)
1250 return kmem_cache_zalloc(trans->dev_cmd_pool, GFP_ATOMIC);
1253 int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
1255 static inline void iwl_trans_free_tx_cmd(struct iwl_trans *trans,
1258 kmem_cache_free(trans->dev_cmd_pool, dev_cmd);
1261 static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
1264 if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status)))
1267 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1268 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1272 return trans->ops->tx(trans, skb, dev_cmd, queue);
1275 static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue,
1279 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1280 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1284 trans->ops->reclaim(trans, queue, ssn, skbs, is_flush);
1287 static inline void iwl_trans_set_q_ptrs(struct iwl_trans *trans, int queue,
1290 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1291 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1295 trans->ops->set_q_ptrs(trans, queue, ptr);
1298 static inline void iwl_trans_txq_disable(struct iwl_trans *trans, int queue,
1301 trans->ops->txq_disable(trans, queue, configure_scd);
1305 iwl_trans_txq_enable_cfg(struct iwl_trans *trans, int queue, u16 ssn,
1311 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1312 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1316 return trans->ops->txq_enable(trans, queue, ssn,
1321 iwl_trans_get_rxq_dma_data(struct iwl_trans *trans, int queue,
1324 if (WARN_ON_ONCE(!trans->ops->rxq_dma_data))
1327 return trans->ops->rxq_dma_data(trans, queue, data);
1331 iwl_trans_txq_free(struct iwl_trans *trans, int queue)
1333 if (WARN_ON_ONCE(!trans->ops->txq_free))
1336 trans->ops->txq_free(trans, queue);
1340 iwl_trans_txq_alloc(struct iwl_trans *trans,
1346 if (WARN_ON_ONCE(!trans->ops->txq_alloc))
1349 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1350 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1354 return trans->ops->txq_alloc(trans, flags, sta_mask, tid,
1358 static inline void iwl_trans_txq_set_shared_mode(struct iwl_trans *trans,
1361 if (trans->ops->txq_set_shared_mode)
1362 trans->ops->txq_set_shared_mode(trans, queue, shared_mode);
1365 static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue,
1378 iwl_trans_txq_enable_cfg(trans, queue, ssn, &cfg, queue_wdg_timeout);
1382 void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue, int fifo,
1393 iwl_trans_txq_enable_cfg(trans, queue, 0, &cfg, queue_wdg_timeout);
1396 static inline void iwl_trans_freeze_txq_timer(struct iwl_trans *trans,
1400 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1401 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1405 if (trans->ops->freeze_txq_timer)
1406 trans->ops->freeze_txq_timer(trans, txqs, freeze);
1409 static inline void iwl_trans_block_txq_ptrs(struct iwl_trans *trans,
1412 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1413 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1417 if (trans->ops->block_txq_ptrs)
1418 trans->ops->block_txq_ptrs(trans, block);
1421 static inline int iwl_trans_wait_tx_queues_empty(struct iwl_trans *trans,
1424 if (WARN_ON_ONCE(!trans->ops->wait_tx_queues_empty))
1428 if (trans->state != IWL_TRANS_FW_ALIVE) {
1429 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1433 return trans->ops->wait_tx_queues_empty(trans, txqs);
1436 static inline int iwl_trans_wait_txq_empty(struct iwl_trans *trans, int queue)
1438 if (WARN_ON_ONCE(!trans->ops->wait_txq_empty))
1441 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1442 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1446 return trans->ops->wait_txq_empty(trans, queue);
1449 static inline void iwl_trans_write8(struct iwl_trans *trans, u32 ofs, u8 val)
1451 trans->ops->write8(trans, ofs, val);
1454 static inline void iwl_trans_write32(struct iwl_trans *trans, u32 ofs, u32 val)
1456 trans->ops->write32(trans, ofs, val);
1459 static inline u32 iwl_trans_read32(struct iwl_trans *trans, u32 ofs)
1461 return trans->ops->read32(trans, ofs);
1464 static inline u32 iwl_trans_read_prph(struct iwl_trans *trans, u32 ofs)
1466 return trans->ops->read_prph(trans, ofs);
1469 static inline void iwl_trans_write_prph(struct iwl_trans *trans, u32 ofs,
1472 return trans->ops->write_prph(trans, ofs, val);
1475 static inline int iwl_trans_read_mem(struct iwl_trans *trans, u32 addr,
1478 return trans->ops->read_mem(trans, addr, buf, dwords);
1481 #define iwl_trans_read_mem_bytes(trans, addr, buf, bufsize) \
1485 iwl_trans_read_mem(trans, addr, buf, (bufsize) / sizeof(u32));\
1488 static inline int iwl_trans_write_imr_mem(struct iwl_trans *trans,
1492 if (trans->ops->imr_dma_data)
1493 return trans->ops->imr_dma_data(trans, dst_addr, src_addr, byte_cnt);
1497 static inline u32 iwl_trans_read_mem32(struct iwl_trans *trans, u32 addr)
1501 if (iwl_trans_read_mem(trans, addr, &value, 1))
1507 static inline int iwl_trans_write_mem(struct iwl_trans *trans, u32 addr,
1510 return trans->ops->write_mem(trans, addr, buf, dwords);
1513 static inline u32 iwl_trans_write_mem32(struct iwl_trans *trans, u32 addr,
1516 return iwl_trans_write_mem(trans, addr, &val, 1);
1519 static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state)
1521 if (trans->ops->set_pmi)
1522 trans->ops->set_pmi(trans, state);
1525 static inline int iwl_trans_sw_reset(struct iwl_trans *trans,
1528 if (trans->ops->sw_reset)
1529 return trans->ops->sw_reset(trans, retake_ownership);
1534 iwl_trans_set_bits_mask(struct iwl_trans *trans, u32 reg, u32 mask, u32 value)
1536 trans->ops->set_bits_mask(trans, reg, mask, value);
1539 #define iwl_trans_grab_nic_access(trans) \
1541 likely((trans)->ops->grab_nic_access(trans)))
1544 iwl_trans_release_nic_access(struct iwl_trans *trans)
1546 trans->ops->release_nic_access(trans);
1550 static inline void iwl_trans_fw_error(struct iwl_trans *trans, bool sync)
1552 if (WARN_ON_ONCE(!trans->op_mode))
1556 if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status)) {
1557 iwl_op_mode_nic_error(trans->op_mode, sync);
1558 trans->state = IWL_TRANS_NO_FW;
1562 static inline bool iwl_trans_fw_running(struct iwl_trans *trans)
1564 return trans->state == IWL_TRANS_FW_ALIVE;
1567 static inline void iwl_trans_sync_nmi(struct iwl_trans *trans)
1569 if (trans->ops->sync_nmi)
1570 trans->ops->sync_nmi(trans);
1573 void iwl_trans_sync_nmi_with_addr(struct iwl_trans *trans, u32 inta_addr,
1576 static inline int iwl_trans_load_pnvm(struct iwl_trans *trans,
1580 return trans->ops->load_pnvm(trans, pnvm_data, capa);
1583 static inline void iwl_trans_set_pnvm(struct iwl_trans *trans,
1586 if (trans->ops->set_pnvm)
1587 trans->ops->set_pnvm(trans, capa);
1591 (struct iwl_trans *trans,
1595 return trans->ops->load_reduce_power(trans, payloads, capa);
1599 iwl_trans_set_reduce_power(struct iwl_trans *trans,
1602 if (trans->ops->set_reduce_power)
1603 trans->ops->set_reduce_power(trans, capa);
1606 static inline bool iwl_trans_dbg_ini_valid(struct iwl_trans *trans)
1608 return trans->dbg.internal_ini_cfg != IWL_INI_CFG_STATE_NOT_LOADED ||
1609 trans->dbg.external_ini_cfg != IWL_INI_CFG_STATE_NOT_LOADED;
1612 static inline void iwl_trans_interrupts(struct iwl_trans *trans, bool enable)
1614 if (trans->ops->interrupts)
1615 trans->ops->interrupts(trans, enable);
1625 int iwl_trans_init(struct iwl_trans *trans);
1626 void iwl_trans_free(struct iwl_trans *trans);
1638 void iwl_trans_pcie_remove(struct iwl_trans *trans, bool rescan);