internal.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2003 - 2015 Intel Corporation. All rights reserved.
  4. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  5. *
  6. * Portions of this file are derived from the ipw3945 project, as well
  7. * as portions of the ieee80211 subsystem header files.
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of version 2 of the GNU General Public License as
  11. * published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but WITHOUT
  14. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  16. * more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along with
  19. * this program; if not, write to the Free Software Foundation, Inc.,
  20. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  21. *
  22. * The full GNU General Public License is included in this distribution in the
  23. * file called LICENSE.
  24. *
  25. * Contact Information:
  26. * Intel Linux Wireless <ilw@linux.intel.com>
  27. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  28. *
  29. *****************************************************************************/
  30. #ifndef __iwl_trans_int_pcie_h__
  31. #define __iwl_trans_int_pcie_h__
  32. #include <linux/spinlock.h>
  33. #include <linux/interrupt.h>
  34. #include <linux/skbuff.h>
  35. #include <linux/wait.h>
  36. #include <linux/pci.h>
  37. #include <linux/timer.h>
  38. #include "iwl-fh.h"
  39. #include "iwl-csr.h"
  40. #include "iwl-trans.h"
  41. #include "iwl-debug.h"
  42. #include "iwl-io.h"
  43. #include "iwl-op-mode.h"
  44. /* We need 2 entries for the TX command and header, and another one might
  45. * be needed for potential data in the SKB's head. The remaining ones can
  46. * be used for frags.
  47. */
  48. #define IWL_PCIE_MAX_FRAGS (IWL_NUM_OF_TBS - 3)
  49. /*
  50. * RX related structures and functions
  51. */
  52. #define RX_NUM_QUEUES 1
  53. #define RX_POST_REQ_ALLOC 2
  54. #define RX_CLAIM_REQ_ALLOC 8
  55. #define RX_POOL_SIZE ((RX_CLAIM_REQ_ALLOC - RX_POST_REQ_ALLOC) * RX_NUM_QUEUES)
  56. #define RX_LOW_WATERMARK 8
  57. struct iwl_host_cmd;
  58. /*This file includes the declaration that are internal to the
  59. * trans_pcie layer */
  60. struct iwl_rx_mem_buffer {
  61. dma_addr_t page_dma;
  62. struct page *page;
  63. struct list_head list;
  64. };
  65. /**
  66. * struct isr_statistics - interrupt statistics
  67. *
  68. */
  69. struct isr_statistics {
  70. u32 hw;
  71. u32 sw;
  72. u32 err_code;
  73. u32 sch;
  74. u32 alive;
  75. u32 rfkill;
  76. u32 ctkill;
  77. u32 wakeup;
  78. u32 rx;
  79. u32 tx;
  80. u32 unhandled;
  81. };
  82. /**
  83. * struct iwl_rxq - Rx queue
  84. * @bd: driver's pointer to buffer of receive buffer descriptors (rbd)
  85. * @bd_dma: bus address of buffer of receive buffer descriptors (rbd)
  86. * @read: Shared index to newest available Rx buffer
  87. * @write: Shared index to oldest written Rx packet
  88. * @free_count: Number of pre-allocated buffers in rx_free
  89. * @used_count: Number of RBDs handled to allocator to use for allocation
  90. * @write_actual:
  91. * @rx_free: list of RBDs with allocated RB ready for use
  92. * @rx_used: list of RBDs with no RB attached
  93. * @need_update: flag to indicate we need to update read/write index
  94. * @rb_stts: driver's pointer to receive buffer status
  95. * @rb_stts_dma: bus address of receive buffer status
  96. * @lock:
  97. * @pool: initial pool of iwl_rx_mem_buffer for the queue
  98. * @queue: actual rx queue
  99. *
  100. * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers
  101. */
  102. struct iwl_rxq {
  103. __le32 *bd;
  104. dma_addr_t bd_dma;
  105. u32 read;
  106. u32 write;
  107. u32 free_count;
  108. u32 used_count;
  109. u32 write_actual;
  110. struct list_head rx_free;
  111. struct list_head rx_used;
  112. bool need_update;
  113. struct iwl_rb_status *rb_stts;
  114. dma_addr_t rb_stts_dma;
  115. spinlock_t lock;
  116. struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE];
  117. struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE];
  118. };
  119. /**
  120. * struct iwl_rb_allocator - Rx allocator
  121. * @pool: initial pool of allocator
  122. * @req_pending: number of requests the allcator had not processed yet
  123. * @req_ready: number of requests honored and ready for claiming
  124. * @rbd_allocated: RBDs with pages allocated and ready to be handled to
  125. * the queue. This is a list of &struct iwl_rx_mem_buffer
  126. * @rbd_empty: RBDs with no page attached for allocator use. This is a list
  127. * of &struct iwl_rx_mem_buffer
  128. * @lock: protects the rbd_allocated and rbd_empty lists
  129. * @alloc_wq: work queue for background calls
  130. * @rx_alloc: work struct for background calls
  131. */
  132. struct iwl_rb_allocator {
  133. struct iwl_rx_mem_buffer pool[RX_POOL_SIZE];
  134. atomic_t req_pending;
  135. atomic_t req_ready;
  136. struct list_head rbd_allocated;
  137. struct list_head rbd_empty;
  138. spinlock_t lock;
  139. struct workqueue_struct *alloc_wq;
  140. struct work_struct rx_alloc;
  141. };
  142. struct iwl_dma_ptr {
  143. dma_addr_t dma;
  144. void *addr;
  145. size_t size;
  146. };
  147. /**
  148. * iwl_queue_inc_wrap - increment queue index, wrap back to beginning
  149. * @index -- current index
  150. */
  151. static inline int iwl_queue_inc_wrap(int index)
  152. {
  153. return ++index & (TFD_QUEUE_SIZE_MAX - 1);
  154. }
  155. /**
  156. * iwl_queue_dec_wrap - decrement queue index, wrap back to end
  157. * @index -- current index
  158. */
  159. static inline int iwl_queue_dec_wrap(int index)
  160. {
  161. return --index & (TFD_QUEUE_SIZE_MAX - 1);
  162. }
  163. struct iwl_cmd_meta {
  164. /* only for SYNC commands, iff the reply skb is wanted */
  165. struct iwl_host_cmd *source;
  166. u32 flags;
  167. };
  168. /*
  169. * Generic queue structure
  170. *
  171. * Contains common data for Rx and Tx queues.
  172. *
  173. * Note the difference between TFD_QUEUE_SIZE_MAX and n_window: the hardware
  174. * always assumes 256 descriptors, so TFD_QUEUE_SIZE_MAX is always 256 (unless
  175. * there might be HW changes in the future). For the normal TX
  176. * queues, n_window, which is the size of the software queue data
  177. * is also 256; however, for the command queue, n_window is only
  178. * 32 since we don't need so many commands pending. Since the HW
  179. * still uses 256 BDs for DMA though, TFD_QUEUE_SIZE_MAX stays 256. As a result,
  180. * the software buffers (in the variables @meta, @txb in struct
  181. * iwl_txq) only have 32 entries, while the HW buffers (@tfds in
  182. * the same struct) have 256.
  183. * This means that we end up with the following:
  184. * HW entries: | 0 | ... | N * 32 | ... | N * 32 + 31 | ... | 255 |
  185. * SW entries: | 0 | ... | 31 |
  186. * where N is a number between 0 and 7. This means that the SW
  187. * data is a window overlayed over the HW queue.
  188. */
  189. struct iwl_queue {
  190. int write_ptr; /* 1-st empty entry (index) host_w*/
  191. int read_ptr; /* last used entry (index) host_r*/
  192. /* use for monitoring and recovering the stuck queue */
  193. dma_addr_t dma_addr; /* physical addr for BD's */
  194. int n_window; /* safe queue window */
  195. u32 id;
  196. int low_mark; /* low watermark, resume queue if free
  197. * space more than this */
  198. int high_mark; /* high watermark, stop queue if free
  199. * space less than this */
  200. };
  201. #define TFD_TX_CMD_SLOTS 256
  202. #define TFD_CMD_SLOTS 32
  203. /*
  204. * The FH will write back to the first TB only, so we need
  205. * to copy some data into the buffer regardless of whether
  206. * it should be mapped or not. This indicates how big the
  207. * first TB must be to include the scratch buffer. Since
  208. * the scratch is 4 bytes at offset 12, it's 16 now. If we
  209. * make it bigger then allocations will be bigger and copy
  210. * slower, so that's probably not useful.
  211. */
  212. #define IWL_HCMD_SCRATCHBUF_SIZE 16
  213. struct iwl_pcie_txq_entry {
  214. struct iwl_device_cmd *cmd;
  215. struct sk_buff *skb;
  216. /* buffer to free after command completes */
  217. const void *free_buf;
  218. struct iwl_cmd_meta meta;
  219. };
  220. struct iwl_pcie_txq_scratch_buf {
  221. struct iwl_cmd_header hdr;
  222. u8 buf[8];
  223. __le32 scratch;
  224. };
  225. /**
  226. * struct iwl_txq - Tx Queue for DMA
  227. * @q: generic Rx/Tx queue descriptor
  228. * @tfds: transmit frame descriptors (DMA memory)
  229. * @scratchbufs: start of command headers, including scratch buffers, for
  230. * the writeback -- this is DMA memory and an array holding one buffer
  231. * for each command on the queue
  232. * @scratchbufs_dma: DMA address for the scratchbufs start
  233. * @entries: transmit entries (driver state)
  234. * @lock: queue lock
  235. * @stuck_timer: timer that fires if queue gets stuck
  236. * @trans_pcie: pointer back to transport (for timer)
  237. * @need_update: indicates need to update read/write index
  238. * @active: stores if queue is active
  239. * @ampdu: true if this queue is an ampdu queue for an specific RA/TID
  240. * @wd_timeout: queue watchdog timeout (jiffies) - per queue
  241. * @frozen: tx stuck queue timer is frozen
  242. * @frozen_expiry_remainder: remember how long until the timer fires
  243. *
  244. * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
  245. * descriptors) and required locking structures.
  246. */
  247. struct iwl_txq {
  248. struct iwl_queue q;
  249. struct iwl_tfd *tfds;
  250. struct iwl_pcie_txq_scratch_buf *scratchbufs;
  251. dma_addr_t scratchbufs_dma;
  252. struct iwl_pcie_txq_entry *entries;
  253. spinlock_t lock;
  254. unsigned long frozen_expiry_remainder;
  255. struct timer_list stuck_timer;
  256. struct iwl_trans_pcie *trans_pcie;
  257. bool need_update;
  258. bool frozen;
  259. u8 active;
  260. bool ampdu;
  261. unsigned long wd_timeout;
  262. };
  263. static inline dma_addr_t
  264. iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx)
  265. {
  266. return txq->scratchbufs_dma +
  267. sizeof(struct iwl_pcie_txq_scratch_buf) * idx;
  268. }
  269. /**
  270. * struct iwl_trans_pcie - PCIe transport specific data
  271. * @rxq: all the RX queue data
  272. * @rba: allocator for RX replenishing
  273. * @drv - pointer to iwl_drv
  274. * @trans: pointer to the generic transport area
  275. * @scd_base_addr: scheduler sram base address in SRAM
  276. * @scd_bc_tbls: pointer to the byte count table of the scheduler
  277. * @kw: keep warm address
  278. * @pci_dev: basic pci-network driver stuff
  279. * @hw_base: pci hardware address support
  280. * @ucode_write_complete: indicates that the ucode has been copied.
  281. * @ucode_write_waitq: wait queue for uCode load
  282. * @cmd_queue - command queue number
  283. * @rx_buf_size_8k: 8 kB RX buffer size
  284. * @bc_table_dword: true if the BC table expects DWORD (as opposed to bytes)
  285. * @scd_set_active: should the transport configure the SCD for HCMD queue
  286. * @wide_cmd_header: true when ucode supports wide command header format
  287. * @rx_page_order: page order for receive buffer size
  288. * @reg_lock: protect hw register access
  289. * @mutex: to protect stop_device / start_fw / start_hw
  290. * @cmd_in_flight: true when we have a host command in flight
  291. * @fw_mon_phys: physical address of the buffer for the firmware monitor
  292. * @fw_mon_page: points to the first page of the buffer for the firmware monitor
  293. * @fw_mon_size: size of the buffer for the firmware monitor
  294. */
  295. struct iwl_trans_pcie {
  296. struct iwl_rxq rxq;
  297. struct iwl_rb_allocator rba;
  298. struct iwl_trans *trans;
  299. struct iwl_drv *drv;
  300. struct net_device napi_dev;
  301. struct napi_struct napi;
  302. /* INT ICT Table */
  303. __le32 *ict_tbl;
  304. dma_addr_t ict_tbl_dma;
  305. int ict_index;
  306. bool use_ict;
  307. bool is_down;
  308. struct isr_statistics isr_stats;
  309. spinlock_t irq_lock;
  310. struct mutex mutex;
  311. u32 inta_mask;
  312. u32 scd_base_addr;
  313. struct iwl_dma_ptr scd_bc_tbls;
  314. struct iwl_dma_ptr kw;
  315. struct iwl_txq *txq;
  316. unsigned long queue_used[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)];
  317. unsigned long queue_stopped[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)];
  318. /* PCI bus related data */
  319. struct pci_dev *pci_dev;
  320. void __iomem *hw_base;
  321. bool ucode_write_complete;
  322. wait_queue_head_t ucode_write_waitq;
  323. wait_queue_head_t wait_command_queue;
  324. u8 cmd_queue;
  325. u8 cmd_fifo;
  326. unsigned int cmd_q_wdg_timeout;
  327. u8 n_no_reclaim_cmds;
  328. u8 no_reclaim_cmds[MAX_NO_RECLAIM_CMDS];
  329. bool rx_buf_size_8k;
  330. bool bc_table_dword;
  331. bool scd_set_active;
  332. bool wide_cmd_header;
  333. u32 rx_page_order;
  334. const char *const *command_names;
  335. /*protect hw register */
  336. spinlock_t reg_lock;
  337. bool cmd_hold_nic_awake;
  338. bool ref_cmd_in_flight;
  339. /* protect ref counter */
  340. spinlock_t ref_lock;
  341. u32 ref_count;
  342. dma_addr_t fw_mon_phys;
  343. struct page *fw_mon_page;
  344. u32 fw_mon_size;
  345. };
  346. #define IWL_TRANS_GET_PCIE_TRANS(_iwl_trans) \
  347. ((struct iwl_trans_pcie *) ((_iwl_trans)->trans_specific))
  348. static inline struct iwl_trans *
  349. iwl_trans_pcie_get_trans(struct iwl_trans_pcie *trans_pcie)
  350. {
  351. return container_of((void *)trans_pcie, struct iwl_trans,
  352. trans_specific);
  353. }
  354. /*
  355. * Convention: trans API functions: iwl_trans_pcie_XXX
  356. * Other functions: iwl_pcie_XXX
  357. */
  358. struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
  359. const struct pci_device_id *ent,
  360. const struct iwl_cfg *cfg);
  361. void iwl_trans_pcie_free(struct iwl_trans *trans);
  362. /*****************************************************
  363. * RX
  364. ******************************************************/
  365. int iwl_pcie_rx_init(struct iwl_trans *trans);
  366. irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id);
  367. int iwl_pcie_rx_stop(struct iwl_trans *trans);
  368. void iwl_pcie_rx_free(struct iwl_trans *trans);
  369. /*****************************************************
  370. * ICT - interrupt handling
  371. ******************************************************/
  372. irqreturn_t iwl_pcie_isr(int irq, void *data);
  373. int iwl_pcie_alloc_ict(struct iwl_trans *trans);
  374. void iwl_pcie_free_ict(struct iwl_trans *trans);
  375. void iwl_pcie_reset_ict(struct iwl_trans *trans);
  376. void iwl_pcie_disable_ict(struct iwl_trans *trans);
  377. /*****************************************************
  378. * TX / HCMD
  379. ******************************************************/
  380. int iwl_pcie_tx_init(struct iwl_trans *trans);
  381. void iwl_pcie_tx_start(struct iwl_trans *trans, u32 scd_base_addr);
  382. int iwl_pcie_tx_stop(struct iwl_trans *trans);
  383. void iwl_pcie_tx_free(struct iwl_trans *trans);
  384. void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int queue, u16 ssn,
  385. const struct iwl_trans_txq_scd_cfg *cfg,
  386. unsigned int wdg_timeout);
  387. void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int queue,
  388. bool configure_scd);
  389. int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
  390. struct iwl_device_cmd *dev_cmd, int txq_id);
  391. void iwl_pcie_txq_check_wrptrs(struct iwl_trans *trans);
  392. int iwl_trans_pcie_send_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
  393. void iwl_pcie_hcmd_complete(struct iwl_trans *trans,
  394. struct iwl_rx_cmd_buffer *rxb);
  395. void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn,
  396. struct sk_buff_head *skbs);
  397. void iwl_trans_pcie_tx_reset(struct iwl_trans *trans);
  398. void iwl_trans_pcie_ref(struct iwl_trans *trans);
  399. void iwl_trans_pcie_unref(struct iwl_trans *trans);
  400. static inline u16 iwl_pcie_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx)
  401. {
  402. struct iwl_tfd_tb *tb = &tfd->tbs[idx];
  403. return le16_to_cpu(tb->hi_n_len) >> 4;
  404. }
  405. /*****************************************************
  406. * Error handling
  407. ******************************************************/
  408. void iwl_pcie_dump_csr(struct iwl_trans *trans);
  409. /*****************************************************
  410. * Helpers
  411. ******************************************************/
  412. static inline void iwl_disable_interrupts(struct iwl_trans *trans)
  413. {
  414. clear_bit(STATUS_INT_ENABLED, &trans->status);
  415. /* disable interrupts from uCode/NIC to host */
  416. iwl_write32(trans, CSR_INT_MASK, 0x00000000);
  417. /* acknowledge/clear/reset any interrupts still pending
  418. * from uCode or flow handler (Rx/Tx DMA) */
  419. iwl_write32(trans, CSR_INT, 0xffffffff);
  420. iwl_write32(trans, CSR_FH_INT_STATUS, 0xffffffff);
  421. IWL_DEBUG_ISR(trans, "Disabled interrupts\n");
  422. }
  423. static inline void iwl_enable_interrupts(struct iwl_trans *trans)
  424. {
  425. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  426. IWL_DEBUG_ISR(trans, "Enabling interrupts\n");
  427. set_bit(STATUS_INT_ENABLED, &trans->status);
  428. trans_pcie->inta_mask = CSR_INI_SET_MASK;
  429. iwl_write32(trans, CSR_INT_MASK, trans_pcie->inta_mask);
  430. }
  431. static inline void iwl_enable_rfkill_int(struct iwl_trans *trans)
  432. {
  433. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  434. IWL_DEBUG_ISR(trans, "Enabling rfkill interrupt\n");
  435. trans_pcie->inta_mask = CSR_INT_BIT_RF_KILL;
  436. iwl_write32(trans, CSR_INT_MASK, trans_pcie->inta_mask);
  437. }
  438. static inline void iwl_wake_queue(struct iwl_trans *trans,
  439. struct iwl_txq *txq)
  440. {
  441. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  442. if (test_and_clear_bit(txq->q.id, trans_pcie->queue_stopped)) {
  443. IWL_DEBUG_TX_QUEUES(trans, "Wake hwq %d\n", txq->q.id);
  444. iwl_op_mode_queue_not_full(trans->op_mode, txq->q.id);
  445. }
  446. }
  447. static inline void iwl_stop_queue(struct iwl_trans *trans,
  448. struct iwl_txq *txq)
  449. {
  450. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  451. if (!test_and_set_bit(txq->q.id, trans_pcie->queue_stopped)) {
  452. iwl_op_mode_queue_full(trans->op_mode, txq->q.id);
  453. IWL_DEBUG_TX_QUEUES(trans, "Stop hwq %d\n", txq->q.id);
  454. } else
  455. IWL_DEBUG_TX_QUEUES(trans, "hwq %d already stopped\n",
  456. txq->q.id);
  457. }
  458. static inline bool iwl_queue_used(const struct iwl_queue *q, int i)
  459. {
  460. return q->write_ptr >= q->read_ptr ?
  461. (i >= q->read_ptr && i < q->write_ptr) :
  462. !(i < q->read_ptr && i >= q->write_ptr);
  463. }
  464. static inline u8 get_cmd_index(struct iwl_queue *q, u32 index)
  465. {
  466. return index & (q->n_window - 1);
  467. }
  468. static inline const char *get_cmd_string(struct iwl_trans_pcie *trans_pcie,
  469. u8 cmd)
  470. {
  471. if (!trans_pcie->command_names || !trans_pcie->command_names[cmd])
  472. return "UNKNOWN";
  473. return trans_pcie->command_names[cmd];
  474. }
  475. static inline bool iwl_is_rfkill_set(struct iwl_trans *trans)
  476. {
  477. return !(iwl_read32(trans, CSR_GP_CNTRL) &
  478. CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);
  479. }
  480. static inline void __iwl_trans_pcie_set_bits_mask(struct iwl_trans *trans,
  481. u32 reg, u32 mask, u32 value)
  482. {
  483. u32 v;
  484. #ifdef CONFIG_IWLWIFI_DEBUG
  485. WARN_ON_ONCE(value & ~mask);
  486. #endif
  487. v = iwl_read32(trans, reg);
  488. v &= ~mask;
  489. v |= value;
  490. iwl_write32(trans, reg, v);
  491. }
  492. static inline void __iwl_trans_pcie_clear_bit(struct iwl_trans *trans,
  493. u32 reg, u32 mask)
  494. {
  495. __iwl_trans_pcie_set_bits_mask(trans, reg, mask, 0);
  496. }
  497. static inline void __iwl_trans_pcie_set_bit(struct iwl_trans *trans,
  498. u32 reg, u32 mask)
  499. {
  500. __iwl_trans_pcie_set_bits_mask(trans, reg, mask, mask);
  501. }
  502. void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state);
  503. #endif /* __iwl_trans_int_pcie_h__ */