Lines Matching refs:trans
116 #define IWL_TRANS_FW_DBG_DOMAIN(trans) IWL_FW_INI_DOMAIN_ALWAYS_ON argument
223 #define IWL_TRANS_MAX_FRAGS(trans) ((trans)->txqs.tfd.max_tbs - 3) argument
579 int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw,
581 void (*fw_alive)(struct iwl_trans *trans, u32 scd_addr);
582 void (*stop_device)(struct iwl_trans *trans);
584 int (*d3_suspend)(struct iwl_trans *trans, bool test, bool reset);
585 int (*d3_resume)(struct iwl_trans *trans, enum iwl_d3_status *status,
588 int (*send_cmd)(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
590 int (*tx)(struct iwl_trans *trans, struct sk_buff *skb,
592 void (*reclaim)(struct iwl_trans *trans, int queue, int ssn,
595 void (*set_q_ptrs)(struct iwl_trans *trans, int queue, int ptr);
597 bool (*txq_enable)(struct iwl_trans *trans, int queue, u16 ssn,
600 void (*txq_disable)(struct iwl_trans *trans, int queue,
603 int (*txq_alloc)(struct iwl_trans *trans,
607 void (*txq_free)(struct iwl_trans *trans, int queue);
608 int (*rxq_dma_data)(struct iwl_trans *trans, int queue,
611 void (*txq_set_shared_mode)(struct iwl_trans *trans, u32 txq_id,
614 int (*wait_tx_queues_empty)(struct iwl_trans *trans, u32 txq_bm);
615 int (*wait_txq_empty)(struct iwl_trans *trans, int queue);
616 void (*freeze_txq_timer)(struct iwl_trans *trans, unsigned long txqs,
618 void (*block_txq_ptrs)(struct iwl_trans *trans, bool block);
620 void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val);
621 void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val);
622 u32 (*read32)(struct iwl_trans *trans, u32 ofs);
623 u32 (*read_prph)(struct iwl_trans *trans, u32 ofs);
624 void (*write_prph)(struct iwl_trans *trans, u32 ofs, u32 val);
625 int (*read_mem)(struct iwl_trans *trans, u32 addr,
627 int (*write_mem)(struct iwl_trans *trans, u32 addr,
629 int (*read_config32)(struct iwl_trans *trans, u32 ofs, u32 *val);
630 void (*configure)(struct iwl_trans *trans,
632 void (*set_pmi)(struct iwl_trans *trans, bool state);
633 void (*sw_reset)(struct iwl_trans *trans);
634 bool (*grab_nic_access)(struct iwl_trans *trans, unsigned long *flags);
635 void (*release_nic_access)(struct iwl_trans *trans,
637 void (*set_bits_mask)(struct iwl_trans *trans, u32 reg, u32 mask,
639 int (*suspend)(struct iwl_trans *trans);
640 void (*resume)(struct iwl_trans *trans);
642 struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans,
644 void (*debugfs_cleanup)(struct iwl_trans *trans);
645 void (*sync_nmi)(struct iwl_trans *trans);
646 int (*set_pnvm)(struct iwl_trans *trans, const void *data, u32 len);
897 struct iwl_trans *trans; member
1043 const char *iwl_get_cmd_string(struct iwl_trans *trans, u32 id);
1044 int iwl_cmd_groups_verify_sorted(const struct iwl_trans_config *trans);
1046 static inline void iwl_trans_configure(struct iwl_trans *trans, in iwl_trans_configure() argument
1049 trans->op_mode = trans_cfg->op_mode; in iwl_trans_configure()
1051 trans->ops->configure(trans, trans_cfg); in iwl_trans_configure()
1055 static inline int iwl_trans_start_hw(struct iwl_trans *trans) in iwl_trans_start_hw() argument
1059 return trans->ops->start_hw(trans); in iwl_trans_start_hw()
1062 static inline void iwl_trans_op_mode_leave(struct iwl_trans *trans) in iwl_trans_op_mode_leave() argument
1066 if (trans->ops->op_mode_leave) in iwl_trans_op_mode_leave()
1067 trans->ops->op_mode_leave(trans); in iwl_trans_op_mode_leave()
1069 trans->op_mode = NULL; in iwl_trans_op_mode_leave()
1071 trans->state = IWL_TRANS_NO_FW; in iwl_trans_op_mode_leave()
1074 static inline void iwl_trans_fw_alive(struct iwl_trans *trans, u32 scd_addr) in iwl_trans_fw_alive() argument
1078 trans->state = IWL_TRANS_FW_ALIVE; in iwl_trans_fw_alive()
1080 trans->ops->fw_alive(trans, scd_addr); in iwl_trans_fw_alive()
1083 static inline int iwl_trans_start_fw(struct iwl_trans *trans, in iwl_trans_start_fw() argument
1089 WARN_ON_ONCE(!trans->rx_mpdu_cmd); in iwl_trans_start_fw()
1091 clear_bit(STATUS_FW_ERROR, &trans->status); in iwl_trans_start_fw()
1092 return trans->ops->start_fw(trans, fw, run_in_rfkill); in iwl_trans_start_fw()
1095 static inline void iwl_trans_stop_device(struct iwl_trans *trans) in iwl_trans_stop_device() argument
1099 trans->ops->stop_device(trans); in iwl_trans_stop_device()
1101 trans->state = IWL_TRANS_NO_FW; in iwl_trans_stop_device()
1104 static inline int iwl_trans_d3_suspend(struct iwl_trans *trans, bool test, in iwl_trans_d3_suspend() argument
1108 if (!trans->ops->d3_suspend) in iwl_trans_d3_suspend()
1111 return trans->ops->d3_suspend(trans, test, reset); in iwl_trans_d3_suspend()
1114 static inline int iwl_trans_d3_resume(struct iwl_trans *trans, in iwl_trans_d3_resume() argument
1119 if (!trans->ops->d3_resume) in iwl_trans_d3_resume()
1122 return trans->ops->d3_resume(trans, status, test, reset); in iwl_trans_d3_resume()
1125 static inline int iwl_trans_suspend(struct iwl_trans *trans) in iwl_trans_suspend() argument
1127 if (!trans->ops->suspend) in iwl_trans_suspend()
1130 return trans->ops->suspend(trans); in iwl_trans_suspend()
1133 static inline void iwl_trans_resume(struct iwl_trans *trans) in iwl_trans_resume() argument
1135 if (trans->ops->resume) in iwl_trans_resume()
1136 trans->ops->resume(trans); in iwl_trans_resume()
1140 iwl_trans_dump_data(struct iwl_trans *trans, u32 dump_mask) in iwl_trans_dump_data() argument
1142 if (!trans->ops->dump_data) in iwl_trans_dump_data()
1144 return trans->ops->dump_data(trans, dump_mask); in iwl_trans_dump_data()
1148 iwl_trans_alloc_tx_cmd(struct iwl_trans *trans) in iwl_trans_alloc_tx_cmd() argument
1150 return kmem_cache_zalloc(trans->dev_cmd_pool, GFP_ATOMIC); in iwl_trans_alloc_tx_cmd()
1153 int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
1155 static inline void iwl_trans_free_tx_cmd(struct iwl_trans *trans, in iwl_trans_free_tx_cmd() argument
1158 kmem_cache_free(trans->dev_cmd_pool, dev_cmd); in iwl_trans_free_tx_cmd()
1161 static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb, in iwl_trans_tx() argument
1164 if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status))) in iwl_trans_tx()
1167 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_tx()
1168 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_tx()
1172 return trans->ops->tx(trans, skb, dev_cmd, queue); in iwl_trans_tx()
1175 static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue, in iwl_trans_reclaim() argument
1178 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_reclaim()
1179 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_reclaim()
1183 trans->ops->reclaim(trans, queue, ssn, skbs); in iwl_trans_reclaim()
1186 static inline void iwl_trans_set_q_ptrs(struct iwl_trans *trans, int queue, in iwl_trans_set_q_ptrs() argument
1189 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_set_q_ptrs()
1190 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_set_q_ptrs()
1194 trans->ops->set_q_ptrs(trans, queue, ptr); in iwl_trans_set_q_ptrs()
1197 static inline void iwl_trans_txq_disable(struct iwl_trans *trans, int queue, in iwl_trans_txq_disable() argument
1200 trans->ops->txq_disable(trans, queue, configure_scd); in iwl_trans_txq_disable()
1204 iwl_trans_txq_enable_cfg(struct iwl_trans *trans, int queue, u16 ssn, in iwl_trans_txq_enable_cfg() argument
1210 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_txq_enable_cfg()
1211 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_txq_enable_cfg()
1215 return trans->ops->txq_enable(trans, queue, ssn, in iwl_trans_txq_enable_cfg()
1220 iwl_trans_get_rxq_dma_data(struct iwl_trans *trans, int queue, in iwl_trans_get_rxq_dma_data() argument
1223 if (WARN_ON_ONCE(!trans->ops->rxq_dma_data)) in iwl_trans_get_rxq_dma_data()
1226 return trans->ops->rxq_dma_data(trans, queue, data); in iwl_trans_get_rxq_dma_data()
1230 iwl_trans_txq_free(struct iwl_trans *trans, int queue) in iwl_trans_txq_free() argument
1232 if (WARN_ON_ONCE(!trans->ops->txq_free)) in iwl_trans_txq_free()
1235 trans->ops->txq_free(trans, queue); in iwl_trans_txq_free()
1239 iwl_trans_txq_alloc(struct iwl_trans *trans, in iwl_trans_txq_alloc() argument
1246 if (WARN_ON_ONCE(!trans->ops->txq_alloc)) in iwl_trans_txq_alloc()
1249 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_txq_alloc()
1250 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_txq_alloc()
1254 return trans->ops->txq_alloc(trans, flags, sta_id, tid, in iwl_trans_txq_alloc()
1258 static inline void iwl_trans_txq_set_shared_mode(struct iwl_trans *trans, in iwl_trans_txq_set_shared_mode() argument
1261 if (trans->ops->txq_set_shared_mode) in iwl_trans_txq_set_shared_mode()
1262 trans->ops->txq_set_shared_mode(trans, queue, shared_mode); in iwl_trans_txq_set_shared_mode()
1265 static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue, in iwl_trans_txq_enable() argument
1278 iwl_trans_txq_enable_cfg(trans, queue, ssn, &cfg, queue_wdg_timeout); in iwl_trans_txq_enable()
1282 void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue, int fifo, in iwl_trans_ac_txq_enable() argument
1293 iwl_trans_txq_enable_cfg(trans, queue, 0, &cfg, queue_wdg_timeout); in iwl_trans_ac_txq_enable()
1296 static inline void iwl_trans_freeze_txq_timer(struct iwl_trans *trans, in iwl_trans_freeze_txq_timer() argument
1300 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_freeze_txq_timer()
1301 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_freeze_txq_timer()
1305 if (trans->ops->freeze_txq_timer) in iwl_trans_freeze_txq_timer()
1306 trans->ops->freeze_txq_timer(trans, txqs, freeze); in iwl_trans_freeze_txq_timer()
1309 static inline void iwl_trans_block_txq_ptrs(struct iwl_trans *trans, in iwl_trans_block_txq_ptrs() argument
1312 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_block_txq_ptrs()
1313 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_block_txq_ptrs()
1317 if (trans->ops->block_txq_ptrs) in iwl_trans_block_txq_ptrs()
1318 trans->ops->block_txq_ptrs(trans, block); in iwl_trans_block_txq_ptrs()
1321 static inline int iwl_trans_wait_tx_queues_empty(struct iwl_trans *trans, in iwl_trans_wait_tx_queues_empty() argument
1324 if (WARN_ON_ONCE(!trans->ops->wait_tx_queues_empty)) in iwl_trans_wait_tx_queues_empty()
1327 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_wait_tx_queues_empty()
1328 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_wait_tx_queues_empty()
1332 return trans->ops->wait_tx_queues_empty(trans, txqs); in iwl_trans_wait_tx_queues_empty()
1335 static inline int iwl_trans_wait_txq_empty(struct iwl_trans *trans, int queue) in iwl_trans_wait_txq_empty() argument
1337 if (WARN_ON_ONCE(!trans->ops->wait_txq_empty)) in iwl_trans_wait_txq_empty()
1340 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_wait_txq_empty()
1341 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_wait_txq_empty()
1345 return trans->ops->wait_txq_empty(trans, queue); in iwl_trans_wait_txq_empty()
1348 static inline void iwl_trans_write8(struct iwl_trans *trans, u32 ofs, u8 val) in iwl_trans_write8() argument
1350 trans->ops->write8(trans, ofs, val); in iwl_trans_write8()
1353 static inline void iwl_trans_write32(struct iwl_trans *trans, u32 ofs, u32 val) in iwl_trans_write32() argument
1355 trans->ops->write32(trans, ofs, val); in iwl_trans_write32()
1358 static inline u32 iwl_trans_read32(struct iwl_trans *trans, u32 ofs) in iwl_trans_read32() argument
1360 return trans->ops->read32(trans, ofs); in iwl_trans_read32()
1363 static inline u32 iwl_trans_read_prph(struct iwl_trans *trans, u32 ofs) in iwl_trans_read_prph() argument
1365 return trans->ops->read_prph(trans, ofs); in iwl_trans_read_prph()
1368 static inline void iwl_trans_write_prph(struct iwl_trans *trans, u32 ofs, in iwl_trans_write_prph() argument
1371 return trans->ops->write_prph(trans, ofs, val); in iwl_trans_write_prph()
1374 static inline int iwl_trans_read_mem(struct iwl_trans *trans, u32 addr, in iwl_trans_read_mem() argument
1377 return trans->ops->read_mem(trans, addr, buf, dwords); in iwl_trans_read_mem()
1380 #define iwl_trans_read_mem_bytes(trans, addr, buf, bufsize) \ argument
1384 iwl_trans_read_mem(trans, addr, buf, (bufsize) / sizeof(u32));\
1387 static inline u32 iwl_trans_read_mem32(struct iwl_trans *trans, u32 addr) in iwl_trans_read_mem32() argument
1391 if (WARN_ON(iwl_trans_read_mem(trans, addr, &value, 1))) in iwl_trans_read_mem32()
1397 static inline int iwl_trans_write_mem(struct iwl_trans *trans, u32 addr, in iwl_trans_write_mem() argument
1400 return trans->ops->write_mem(trans, addr, buf, dwords); in iwl_trans_write_mem()
1403 static inline u32 iwl_trans_write_mem32(struct iwl_trans *trans, u32 addr, in iwl_trans_write_mem32() argument
1406 return iwl_trans_write_mem(trans, addr, &val, 1); in iwl_trans_write_mem32()
1409 static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state) in iwl_trans_set_pmi() argument
1411 if (trans->ops->set_pmi) in iwl_trans_set_pmi()
1412 trans->ops->set_pmi(trans, state); in iwl_trans_set_pmi()
1415 static inline void iwl_trans_sw_reset(struct iwl_trans *trans) in iwl_trans_sw_reset() argument
1417 if (trans->ops->sw_reset) in iwl_trans_sw_reset()
1418 trans->ops->sw_reset(trans); in iwl_trans_sw_reset()
1422 iwl_trans_set_bits_mask(struct iwl_trans *trans, u32 reg, u32 mask, u32 value) in iwl_trans_set_bits_mask() argument
1424 trans->ops->set_bits_mask(trans, reg, mask, value); in iwl_trans_set_bits_mask()
1427 #define iwl_trans_grab_nic_access(trans, flags) \ argument
1429 likely((trans)->ops->grab_nic_access(trans, flags)))
1432 iwl_trans_release_nic_access(struct iwl_trans *trans, unsigned long *flags) in __releases()
1434 trans->ops->release_nic_access(trans, flags); in __releases()
1438 static inline void iwl_trans_fw_error(struct iwl_trans *trans) in iwl_trans_fw_error() argument
1440 if (WARN_ON_ONCE(!trans->op_mode)) in iwl_trans_fw_error()
1444 if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status)) in iwl_trans_fw_error()
1445 iwl_op_mode_nic_error(trans->op_mode); in iwl_trans_fw_error()
1448 static inline bool iwl_trans_fw_running(struct iwl_trans *trans) in iwl_trans_fw_running() argument
1450 return trans->state == IWL_TRANS_FW_ALIVE; in iwl_trans_fw_running()
1453 static inline void iwl_trans_sync_nmi(struct iwl_trans *trans) in iwl_trans_sync_nmi() argument
1455 if (trans->ops->sync_nmi) in iwl_trans_sync_nmi()
1456 trans->ops->sync_nmi(trans); in iwl_trans_sync_nmi()
1459 static inline int iwl_trans_set_pnvm(struct iwl_trans *trans, in iwl_trans_set_pnvm() argument
1462 if (trans->ops->set_pnvm) { in iwl_trans_set_pnvm()
1463 int ret = trans->ops->set_pnvm(trans, data, len); in iwl_trans_set_pnvm()
1469 trans->pnvm_loaded = true; in iwl_trans_set_pnvm()
1474 static inline bool iwl_trans_dbg_ini_valid(struct iwl_trans *trans) in iwl_trans_dbg_ini_valid() argument
1476 return trans->dbg.internal_ini_cfg != IWL_INI_CFG_STATE_NOT_LOADED || in iwl_trans_dbg_ini_valid()
1477 trans->dbg.external_ini_cfg != IWL_INI_CFG_STATE_NOT_LOADED; in iwl_trans_dbg_ini_valid()
1487 void iwl_trans_free(struct iwl_trans *trans);