Lines Matching refs:trans
491 int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw,
493 int (*update_sf)(struct iwl_trans *trans,
495 void (*fw_alive)(struct iwl_trans *trans, u32 scd_addr);
496 void (*stop_device)(struct iwl_trans *trans);
498 void (*d3_suspend)(struct iwl_trans *trans, bool test);
499 int (*d3_resume)(struct iwl_trans *trans, enum iwl_d3_status *status,
502 int (*send_cmd)(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
504 int (*tx)(struct iwl_trans *trans, struct sk_buff *skb,
506 void (*reclaim)(struct iwl_trans *trans, int queue, int ssn,
509 void (*txq_enable)(struct iwl_trans *trans, int queue, u16 ssn,
511 void (*txq_disable)(struct iwl_trans *trans, int queue,
514 int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir);
515 int (*wait_tx_queue_empty)(struct iwl_trans *trans, u32 txq_bm);
517 void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val);
518 void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val);
519 u32 (*read32)(struct iwl_trans *trans, u32 ofs);
520 u32 (*read_prph)(struct iwl_trans *trans, u32 ofs);
521 void (*write_prph)(struct iwl_trans *trans, u32 ofs, u32 val);
522 int (*read_mem)(struct iwl_trans *trans, u32 addr,
524 int (*write_mem)(struct iwl_trans *trans, u32 addr,
526 void (*configure)(struct iwl_trans *trans,
528 void (*set_pmi)(struct iwl_trans *trans, bool state);
529 bool (*grab_nic_access)(struct iwl_trans *trans, bool silent,
531 void (*release_nic_access)(struct iwl_trans *trans,
533 void (*set_bits_mask)(struct iwl_trans *trans, u32 reg, u32 mask,
535 void (*ref)(struct iwl_trans *trans);
536 void (*unref)(struct iwl_trans *trans);
539 struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans);
613 static inline void iwl_trans_configure(struct iwl_trans *trans, in iwl_trans_configure() argument
616 trans->op_mode = trans_cfg->op_mode; in iwl_trans_configure()
618 trans->ops->configure(trans, trans_cfg); in iwl_trans_configure()
621 static inline int iwl_trans_start_hw(struct iwl_trans *trans) in iwl_trans_start_hw() argument
625 return trans->ops->start_hw(trans); in iwl_trans_start_hw()
628 static inline void iwl_trans_op_mode_leave(struct iwl_trans *trans) in iwl_trans_op_mode_leave() argument
632 if (trans->ops->op_mode_leave) in iwl_trans_op_mode_leave()
633 trans->ops->op_mode_leave(trans); in iwl_trans_op_mode_leave()
635 trans->op_mode = NULL; in iwl_trans_op_mode_leave()
637 trans->state = IWL_TRANS_NO_FW; in iwl_trans_op_mode_leave()
640 static inline void iwl_trans_fw_alive(struct iwl_trans *trans, u32 scd_addr) in iwl_trans_fw_alive() argument
644 trans->state = IWL_TRANS_FW_ALIVE; in iwl_trans_fw_alive()
646 trans->ops->fw_alive(trans, scd_addr); in iwl_trans_fw_alive()
649 static inline int iwl_trans_start_fw(struct iwl_trans *trans, in iwl_trans_start_fw() argument
655 WARN_ON_ONCE(!trans->rx_mpdu_cmd); in iwl_trans_start_fw()
657 clear_bit(STATUS_FW_ERROR, &trans->status); in iwl_trans_start_fw()
658 return trans->ops->start_fw(trans, fw, run_in_rfkill); in iwl_trans_start_fw()
661 static inline int iwl_trans_update_sf(struct iwl_trans *trans, in iwl_trans_update_sf() argument
666 if (trans->ops->update_sf) in iwl_trans_update_sf()
667 return trans->ops->update_sf(trans, st_fwrd_space); in iwl_trans_update_sf()
672 static inline void iwl_trans_stop_device(struct iwl_trans *trans) in iwl_trans_stop_device() argument
676 trans->ops->stop_device(trans); in iwl_trans_stop_device()
678 trans->state = IWL_TRANS_NO_FW; in iwl_trans_stop_device()
681 static inline void iwl_trans_d3_suspend(struct iwl_trans *trans, bool test) in iwl_trans_d3_suspend() argument
684 trans->ops->d3_suspend(trans, test); in iwl_trans_d3_suspend()
687 static inline int iwl_trans_d3_resume(struct iwl_trans *trans, in iwl_trans_d3_resume() argument
692 return trans->ops->d3_resume(trans, status, test); in iwl_trans_d3_resume()
695 static inline void iwl_trans_ref(struct iwl_trans *trans) in iwl_trans_ref() argument
697 if (trans->ops->ref) in iwl_trans_ref()
698 trans->ops->ref(trans); in iwl_trans_ref()
701 static inline void iwl_trans_unref(struct iwl_trans *trans) in iwl_trans_unref() argument
703 if (trans->ops->unref) in iwl_trans_unref()
704 trans->ops->unref(trans); in iwl_trans_unref()
709 iwl_trans_dump_data(struct iwl_trans *trans) in iwl_trans_dump_data() argument
711 if (!trans->ops->dump_data) in iwl_trans_dump_data()
713 return trans->ops->dump_data(trans); in iwl_trans_dump_data()
717 static inline int iwl_trans_send_cmd(struct iwl_trans *trans, in iwl_trans_send_cmd() argument
723 test_bit(STATUS_RFKILL, &trans->status))) in iwl_trans_send_cmd()
726 if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status))) in iwl_trans_send_cmd()
729 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) { in iwl_trans_send_cmd()
730 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_send_cmd()
735 lock_map_acquire_read(&trans->sync_cmd_lockdep_map); in iwl_trans_send_cmd()
737 ret = trans->ops->send_cmd(trans, cmd); in iwl_trans_send_cmd()
740 lock_map_release(&trans->sync_cmd_lockdep_map); in iwl_trans_send_cmd()
746 iwl_trans_alloc_tx_cmd(struct iwl_trans *trans) in iwl_trans_alloc_tx_cmd() argument
748 u8 *dev_cmd_ptr = kmem_cache_alloc(trans->dev_cmd_pool, GFP_ATOMIC); in iwl_trans_alloc_tx_cmd()
754 (dev_cmd_ptr + trans->dev_cmd_headroom); in iwl_trans_alloc_tx_cmd()
757 static inline void iwl_trans_free_tx_cmd(struct iwl_trans *trans, in iwl_trans_free_tx_cmd() argument
760 u8 *dev_cmd_ptr = (u8 *)dev_cmd - trans->dev_cmd_headroom; in iwl_trans_free_tx_cmd()
762 kmem_cache_free(trans->dev_cmd_pool, dev_cmd_ptr); in iwl_trans_free_tx_cmd()
765 static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb, in iwl_trans_tx() argument
768 if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status))) in iwl_trans_tx()
771 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) in iwl_trans_tx()
772 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_tx()
774 return trans->ops->tx(trans, skb, dev_cmd, queue); in iwl_trans_tx()
777 static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue, in iwl_trans_reclaim() argument
780 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) in iwl_trans_reclaim()
781 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_reclaim()
783 trans->ops->reclaim(trans, queue, ssn, skbs); in iwl_trans_reclaim()
786 static inline void iwl_trans_txq_disable(struct iwl_trans *trans, int queue, in iwl_trans_txq_disable() argument
789 trans->ops->txq_disable(trans, queue, configure_scd); in iwl_trans_txq_disable()
793 iwl_trans_txq_enable_cfg(struct iwl_trans *trans, int queue, u16 ssn, in iwl_trans_txq_enable_cfg() argument
798 if (unlikely((trans->state != IWL_TRANS_FW_ALIVE))) in iwl_trans_txq_enable_cfg()
799 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_txq_enable_cfg()
801 trans->ops->txq_enable(trans, queue, ssn, cfg); in iwl_trans_txq_enable_cfg()
804 static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue, in iwl_trans_txq_enable() argument
816 iwl_trans_txq_enable_cfg(trans, queue, ssn, &cfg); in iwl_trans_txq_enable()
819 static inline void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue, in iwl_trans_ac_txq_enable() argument
830 iwl_trans_txq_enable_cfg(trans, queue, 0, &cfg); in iwl_trans_ac_txq_enable()
833 static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans, in iwl_trans_wait_tx_queue_empty() argument
836 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) in iwl_trans_wait_tx_queue_empty()
837 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); in iwl_trans_wait_tx_queue_empty()
839 return trans->ops->wait_tx_queue_empty(trans, txq_bm); in iwl_trans_wait_tx_queue_empty()
842 static inline int iwl_trans_dbgfs_register(struct iwl_trans *trans, in iwl_trans_dbgfs_register() argument
845 return trans->ops->dbgfs_register(trans, dir); in iwl_trans_dbgfs_register()
848 static inline void iwl_trans_write8(struct iwl_trans *trans, u32 ofs, u8 val) in iwl_trans_write8() argument
850 trans->ops->write8(trans, ofs, val); in iwl_trans_write8()
853 static inline void iwl_trans_write32(struct iwl_trans *trans, u32 ofs, u32 val) in iwl_trans_write32() argument
855 trans->ops->write32(trans, ofs, val); in iwl_trans_write32()
858 static inline u32 iwl_trans_read32(struct iwl_trans *trans, u32 ofs) in iwl_trans_read32() argument
860 return trans->ops->read32(trans, ofs); in iwl_trans_read32()
863 static inline u32 iwl_trans_read_prph(struct iwl_trans *trans, u32 ofs) in iwl_trans_read_prph() argument
865 return trans->ops->read_prph(trans, ofs); in iwl_trans_read_prph()
868 static inline void iwl_trans_write_prph(struct iwl_trans *trans, u32 ofs, in iwl_trans_write_prph() argument
871 return trans->ops->write_prph(trans, ofs, val); in iwl_trans_write_prph()
874 static inline int iwl_trans_read_mem(struct iwl_trans *trans, u32 addr, in iwl_trans_read_mem() argument
877 return trans->ops->read_mem(trans, addr, buf, dwords); in iwl_trans_read_mem()
880 #define iwl_trans_read_mem_bytes(trans, addr, buf, bufsize) \ argument
884 iwl_trans_read_mem(trans, addr, buf, (bufsize) / sizeof(u32));\
887 static inline u32 iwl_trans_read_mem32(struct iwl_trans *trans, u32 addr) in iwl_trans_read_mem32() argument
891 if (WARN_ON(iwl_trans_read_mem(trans, addr, &value, 1))) in iwl_trans_read_mem32()
897 static inline int iwl_trans_write_mem(struct iwl_trans *trans, u32 addr, in iwl_trans_write_mem() argument
900 return trans->ops->write_mem(trans, addr, buf, dwords); in iwl_trans_write_mem()
903 static inline u32 iwl_trans_write_mem32(struct iwl_trans *trans, u32 addr, in iwl_trans_write_mem32() argument
906 return iwl_trans_write_mem(trans, addr, &val, 1); in iwl_trans_write_mem32()
909 static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state) in iwl_trans_set_pmi() argument
911 if (trans->ops->set_pmi) in iwl_trans_set_pmi()
912 trans->ops->set_pmi(trans, state); in iwl_trans_set_pmi()
916 iwl_trans_set_bits_mask(struct iwl_trans *trans, u32 reg, u32 mask, u32 value) in iwl_trans_set_bits_mask() argument
918 trans->ops->set_bits_mask(trans, reg, mask, value); in iwl_trans_set_bits_mask()
921 #define iwl_trans_grab_nic_access(trans, silent, flags) \ argument
923 likely((trans)->ops->grab_nic_access(trans, silent, flags)))
926 iwl_trans_release_nic_access(struct iwl_trans *trans, unsigned long *flags) in __releases()
928 trans->ops->release_nic_access(trans, flags); in __releases()
932 static inline void iwl_trans_fw_error(struct iwl_trans *trans) in iwl_trans_fw_error() argument
934 if (WARN_ON_ONCE(!trans->op_mode)) in iwl_trans_fw_error()
938 if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status)) in iwl_trans_fw_error()
939 iwl_op_mode_nic_error(trans->op_mode); in iwl_trans_fw_error()
948 static inline void trans_lockdep_init(struct iwl_trans *trans) in trans_lockdep_init() argument
953 lockdep_init_map(&trans->sync_cmd_lockdep_map, "sync_cmd_lockdep_map", in trans_lockdep_init()