Lines Matching refs:trans

116 #define IWL_TRANS_FW_DBG_DOMAIN(trans)	IWL_FW_INI_DOMAIN_ALWAYS_ON
223 #define IWL_TRANS_MAX_FRAGS(trans) ((trans)->txqs.tfd.max_tbs - 3)
347 * @STATUS_TRANS_GOING_IDLE: shutting down the trans, only special commands
349 * @STATUS_TRANS_IDLE: the trans is idle - general commands are not to be sent
350 * @STATUS_TRANS_DEAD: trans is dead - avoid any read/write operation
571 * of the trans debugfs
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);
857 * @trans: pointer back to transport (for timer)
897 struct iwl_trans *trans;
958 * @trans_cfg: the trans-specific configuration part
1038 /* pointer to trans specific struct */
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,
1049 trans->op_mode = trans_cfg->op_mode;
1051 trans->ops->configure(trans, trans_cfg);
1055 static inline int iwl_trans_start_hw(struct iwl_trans *trans)
1059 return trans->ops->start_hw(trans);
1062 static inline void iwl_trans_op_mode_leave(struct iwl_trans *trans)
1066 if (trans->ops->op_mode_leave)
1067 trans->ops->op_mode_leave(trans);
1069 trans->op_mode = NULL;
1071 trans->state = IWL_TRANS_NO_FW;
1074 static inline void iwl_trans_fw_alive(struct iwl_trans *trans, u32 scd_addr)
1078 trans->state = IWL_TRANS_FW_ALIVE;
1080 trans->ops->fw_alive(trans, scd_addr);
1083 static inline int iwl_trans_start_fw(struct iwl_trans *trans,
1089 WARN_ON_ONCE(!trans->rx_mpdu_cmd);
1091 clear_bit(STATUS_FW_ERROR, &trans->status);
1092 return trans->ops->start_fw(trans, fw, run_in_rfkill);
1095 static inline void iwl_trans_stop_device(struct iwl_trans *trans)
1099 trans->ops->stop_device(trans);
1101 trans->state = IWL_TRANS_NO_FW;
1104 static inline int iwl_trans_d3_suspend(struct iwl_trans *trans, bool test,
1108 if (!trans->ops->d3_suspend)
1111 return trans->ops->d3_suspend(trans, test, reset);
1114 static inline int iwl_trans_d3_resume(struct iwl_trans *trans,
1119 if (!trans->ops->d3_resume)
1122 return trans->ops->d3_resume(trans, status, test, reset);
1125 static inline int iwl_trans_suspend(struct iwl_trans *trans)
1127 if (!trans->ops->suspend)
1130 return trans->ops->suspend(trans);
1133 static inline void iwl_trans_resume(struct iwl_trans *trans)
1135 if (trans->ops->resume)
1136 trans->ops->resume(trans);
1140 iwl_trans_dump_data(struct iwl_trans *trans, u32 dump_mask)
1142 if (!trans->ops->dump_data)
1144 return trans->ops->dump_data(trans, dump_mask);
1148 iwl_trans_alloc_tx_cmd(struct iwl_trans *trans)
1150 return kmem_cache_zalloc(trans->dev_cmd_pool, GFP_ATOMIC);
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,
1158 kmem_cache_free(trans->dev_cmd_pool, dev_cmd);
1161 static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
1164 if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status)))
1167 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1168 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1172 return trans->ops->tx(trans, skb, dev_cmd, queue);
1175 static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue,
1178 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1179 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1183 trans->ops->reclaim(trans, queue, ssn, skbs);
1186 static inline void iwl_trans_set_q_ptrs(struct iwl_trans *trans, int queue,
1189 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1190 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1194 trans->ops->set_q_ptrs(trans, queue, ptr);
1197 static inline void iwl_trans_txq_disable(struct iwl_trans *trans, int queue,
1200 trans->ops->txq_disable(trans, queue, configure_scd);
1204 iwl_trans_txq_enable_cfg(struct iwl_trans *trans, int queue, u16 ssn,
1210 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1211 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1215 return trans->ops->txq_enable(trans, queue, ssn,
1220 iwl_trans_get_rxq_dma_data(struct iwl_trans *trans, int queue,
1223 if (WARN_ON_ONCE(!trans->ops->rxq_dma_data))
1226 return trans->ops->rxq_dma_data(trans, queue, data);
1230 iwl_trans_txq_free(struct iwl_trans *trans, int queue)
1232 if (WARN_ON_ONCE(!trans->ops->txq_free))
1235 trans->ops->txq_free(trans, queue);
1239 iwl_trans_txq_alloc(struct iwl_trans *trans,
1246 if (WARN_ON_ONCE(!trans->ops->txq_alloc))
1249 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1250 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1254 return trans->ops->txq_alloc(trans, flags, sta_id, tid,
1258 static inline void iwl_trans_txq_set_shared_mode(struct iwl_trans *trans,
1261 if (trans->ops->txq_set_shared_mode)
1262 trans->ops->txq_set_shared_mode(trans, queue, shared_mode);
1265 static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue,
1278 iwl_trans_txq_enable_cfg(trans, queue, ssn, &cfg, queue_wdg_timeout);
1282 void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue, int fifo,
1293 iwl_trans_txq_enable_cfg(trans, queue, 0, &cfg, queue_wdg_timeout);
1296 static inline void iwl_trans_freeze_txq_timer(struct iwl_trans *trans,
1300 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1301 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1305 if (trans->ops->freeze_txq_timer)
1306 trans->ops->freeze_txq_timer(trans, txqs, freeze);
1309 static inline void iwl_trans_block_txq_ptrs(struct iwl_trans *trans,
1312 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1313 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1317 if (trans->ops->block_txq_ptrs)
1318 trans->ops->block_txq_ptrs(trans, block);
1321 static inline int iwl_trans_wait_tx_queues_empty(struct iwl_trans *trans,
1324 if (WARN_ON_ONCE(!trans->ops->wait_tx_queues_empty))
1327 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1328 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1332 return trans->ops->wait_tx_queues_empty(trans, txqs);
1335 static inline int iwl_trans_wait_txq_empty(struct iwl_trans *trans, int queue)
1337 if (WARN_ON_ONCE(!trans->ops->wait_txq_empty))
1340 if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
1341 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
1345 return trans->ops->wait_txq_empty(trans, queue);
1348 static inline void iwl_trans_write8(struct iwl_trans *trans, u32 ofs, u8 val)
1350 trans->ops->write8(trans, ofs, val);
1353 static inline void iwl_trans_write32(struct iwl_trans *trans, u32 ofs, u32 val)
1355 trans->ops->write32(trans, ofs, val);
1358 static inline u32 iwl_trans_read32(struct iwl_trans *trans, u32 ofs)
1360 return trans->ops->read32(trans, ofs);
1363 static inline u32 iwl_trans_read_prph(struct iwl_trans *trans, u32 ofs)
1365 return trans->ops->read_prph(trans, ofs);
1368 static inline void iwl_trans_write_prph(struct iwl_trans *trans, u32 ofs,
1371 return trans->ops->write_prph(trans, ofs, val);
1374 static inline int iwl_trans_read_mem(struct iwl_trans *trans, u32 addr,
1377 return trans->ops->read_mem(trans, addr, buf, dwords);
1380 #define iwl_trans_read_mem_bytes(trans, addr, buf, bufsize) \
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)
1391 if (WARN_ON(iwl_trans_read_mem(trans, addr, &value, 1)))
1397 static inline int iwl_trans_write_mem(struct iwl_trans *trans, u32 addr,
1400 return trans->ops->write_mem(trans, addr, buf, dwords);
1403 static inline u32 iwl_trans_write_mem32(struct iwl_trans *trans, u32 addr,
1406 return iwl_trans_write_mem(trans, addr, &val, 1);
1409 static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state)
1411 if (trans->ops->set_pmi)
1412 trans->ops->set_pmi(trans, state);
1415 static inline void iwl_trans_sw_reset(struct iwl_trans *trans)
1417 if (trans->ops->sw_reset)
1418 trans->ops->sw_reset(trans);
1422 iwl_trans_set_bits_mask(struct iwl_trans *trans, u32 reg, u32 mask, u32 value)
1424 trans->ops->set_bits_mask(trans, reg, mask, value);
1427 #define iwl_trans_grab_nic_access(trans, flags) \
1429 likely((trans)->ops->grab_nic_access(trans, flags)))
1432 iwl_trans_release_nic_access(struct iwl_trans *trans, unsigned long *flags)
1434 trans->ops->release_nic_access(trans, flags);
1438 static inline void iwl_trans_fw_error(struct iwl_trans *trans)
1440 if (WARN_ON_ONCE(!trans->op_mode))
1444 if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status))
1445 iwl_op_mode_nic_error(trans->op_mode);
1448 static inline bool iwl_trans_fw_running(struct iwl_trans *trans)
1450 return trans->state == IWL_TRANS_FW_ALIVE;
1453 static inline void iwl_trans_sync_nmi(struct iwl_trans *trans)
1455 if (trans->ops->sync_nmi)
1456 trans->ops->sync_nmi(trans);
1459 static inline int iwl_trans_set_pnvm(struct iwl_trans *trans,
1462 if (trans->ops->set_pnvm) {
1463 int ret = trans->ops->set_pnvm(trans, data, len);
1469 trans->pnvm_loaded = true;
1474 static inline bool iwl_trans_dbg_ini_valid(struct iwl_trans *trans)
1476 return trans->dbg.internal_ini_cfg != IWL_INI_CFG_STATE_NOT_LOADED ||
1477 trans->dbg.external_ini_cfg != IWL_INI_CFG_STATE_NOT_LOADED;
1487 void iwl_trans_free(struct iwl_trans *trans);