internal.h 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2003 - 2015 Intel Corporation. All rights reserved.
  4. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  5. * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
  6. * Copyright(c) 2018 Intel Corporation
  7. *
  8. * Portions of this file are derived from the ipw3945 project, as well
  9. * as portions of the ieee80211 subsystem header files.
  10. *
  11. * This program is free software; you can redistribute it and/or modify it
  12. * under the terms of version 2 of the GNU General Public License as
  13. * published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful, but WITHOUT
  16. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  17. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  18. * more details.
  19. *
  20. * You should have received a copy of the GNU General Public License along with
  21. * this program.
  22. *
  23. * The full GNU General Public License is included in this distribution in the
  24. * file called LICENSE.
  25. *
  26. * Contact Information:
  27. * Intel Linux Wireless <linuxwifi@intel.com>
  28. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  29. *
  30. *****************************************************************************/
  31. #ifndef __iwl_trans_int_pcie_h__
  32. #define __iwl_trans_int_pcie_h__
  33. #include <linux/spinlock.h>
  34. #include <linux/interrupt.h>
  35. #include <linux/skbuff.h>
  36. #include <linux/wait.h>
  37. #include <linux/pci.h>
  38. #include <linux/timer.h>
  39. #include <linux/cpu.h>
  40. #include "iwl-fh.h"
  41. #include "iwl-csr.h"
  42. #include "iwl-trans.h"
  43. #include "iwl-debug.h"
  44. #include "iwl-io.h"
  45. #include "iwl-op-mode.h"
  46. #include "iwl-drv.h"
  47. /* We need 2 entries for the TX command and header, and another one might
  48. * be needed for potential data in the SKB's head. The remaining ones can
  49. * be used for frags.
  50. */
  51. #define IWL_PCIE_MAX_FRAGS(x) (x->max_tbs - 3)
  52. /*
  53. * RX related structures and functions
  54. */
  55. #define RX_NUM_QUEUES 1
  56. #define RX_POST_REQ_ALLOC 2
  57. #define RX_CLAIM_REQ_ALLOC 8
  58. #define RX_PENDING_WATERMARK 16
  59. #define FIRST_RX_QUEUE 512
  60. struct iwl_host_cmd;
  61. /*This file includes the declaration that are internal to the
  62. * trans_pcie layer */
  63. /**
  64. * struct iwl_rx_mem_buffer
  65. * @page_dma: bus address of rxb page
  66. * @page: driver's pointer to the rxb page
  67. * @invalid: rxb is in driver ownership - not owned by HW
  68. * @vid: index of this rxb in the global table
  69. * @size: size used from the buffer
  70. */
  71. struct iwl_rx_mem_buffer {
  72. dma_addr_t page_dma;
  73. struct page *page;
  74. u16 vid;
  75. bool invalid;
  76. struct list_head list;
  77. u32 size;
  78. };
  79. /**
  80. * struct isr_statistics - interrupt statistics
  81. *
  82. */
  83. struct isr_statistics {
  84. u32 hw;
  85. u32 sw;
  86. u32 err_code;
  87. u32 sch;
  88. u32 alive;
  89. u32 rfkill;
  90. u32 ctkill;
  91. u32 wakeup;
  92. u32 rx;
  93. u32 tx;
  94. u32 unhandled;
  95. };
  96. #define IWL_RX_TD_TYPE_MSK 0xff000000
  97. #define IWL_RX_TD_SIZE_MSK 0x00ffffff
  98. #define IWL_RX_TD_SIZE_2K BIT(11)
  99. #define IWL_RX_TD_TYPE 0
  100. /**
  101. * struct iwl_rx_transfer_desc - transfer descriptor
  102. * @type_n_size: buffer type (bit 0: external buff valid,
  103. * bit 1: optional footer valid, bit 2-7: reserved)
  104. * and buffer size
  105. * @addr: ptr to free buffer start address
  106. * @rbid: unique tag of the buffer
  107. * @reserved: reserved
  108. */
  109. struct iwl_rx_transfer_desc {
  110. __le32 type_n_size;
  111. __le64 addr;
  112. __le16 rbid;
  113. __le16 reserved;
  114. } __packed;
  115. #define IWL_RX_CD_SIZE 0xffffff00
  116. /**
  117. * struct iwl_rx_completion_desc - completion descriptor
  118. * @type: buffer type (bit 0: external buff valid,
  119. * bit 1: optional footer valid, bit 2-7: reserved)
  120. * @status: status of the completion
  121. * @reserved1: reserved
  122. * @rbid: unique tag of the received buffer
  123. * @size: buffer size, masked by IWL_RX_CD_SIZE
  124. * @reserved2: reserved
  125. */
  126. struct iwl_rx_completion_desc {
  127. u8 type;
  128. u8 status;
  129. __le16 reserved1;
  130. __le16 rbid;
  131. __le32 size;
  132. u8 reserved2[22];
  133. } __packed;
  134. /**
  135. * struct iwl_rxq - Rx queue
  136. * @id: queue index
  137. * @bd: driver's pointer to buffer of receive buffer descriptors (rbd).
  138. * Address size is 32 bit in pre-9000 devices and 64 bit in 9000 devices.
  139. * In 22560 devices it is a pointer to a list of iwl_rx_transfer_desc's
  140. * @bd_dma: bus address of buffer of receive buffer descriptors (rbd)
  141. * @ubd: driver's pointer to buffer of used receive buffer descriptors (rbd)
  142. * @ubd_dma: physical address of buffer of used receive buffer descriptors (rbd)
  143. * @tr_tail: driver's pointer to the transmission ring tail buffer
  144. * @tr_tail_dma: physical address of the buffer for the transmission ring tail
  145. * @cr_tail: driver's pointer to the completion ring tail buffer
  146. * @cr_tail_dma: physical address of the buffer for the completion ring tail
  147. * @read: Shared index to newest available Rx buffer
  148. * @write: Shared index to oldest written Rx packet
  149. * @free_count: Number of pre-allocated buffers in rx_free
  150. * @used_count: Number of RBDs handled to allocator to use for allocation
  151. * @write_actual:
  152. * @rx_free: list of RBDs with allocated RB ready for use
  153. * @rx_used: list of RBDs with no RB attached
  154. * @need_update: flag to indicate we need to update read/write index
  155. * @rb_stts: driver's pointer to receive buffer status
  156. * @rb_stts_dma: bus address of receive buffer status
  157. * @lock:
  158. * @queue: actual rx queue. Not used for multi-rx queue.
  159. *
  160. * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers
  161. */
  162. struct iwl_rxq {
  163. int id;
  164. void *bd;
  165. dma_addr_t bd_dma;
  166. union {
  167. void *used_bd;
  168. __le32 *bd_32;
  169. struct iwl_rx_completion_desc *cd;
  170. };
  171. dma_addr_t used_bd_dma;
  172. __le16 *tr_tail;
  173. dma_addr_t tr_tail_dma;
  174. __le16 *cr_tail;
  175. dma_addr_t cr_tail_dma;
  176. u32 read;
  177. u32 write;
  178. u32 free_count;
  179. u32 used_count;
  180. u32 write_actual;
  181. u32 queue_size;
  182. struct list_head rx_free;
  183. struct list_head rx_used;
  184. bool need_update;
  185. void *rb_stts;
  186. dma_addr_t rb_stts_dma;
  187. spinlock_t lock;
  188. struct napi_struct napi;
  189. struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE];
  190. };
  191. /**
  192. * struct iwl_rb_allocator - Rx allocator
  193. * @req_pending: number of requests the allcator had not processed yet
  194. * @req_ready: number of requests honored and ready for claiming
  195. * @rbd_allocated: RBDs with pages allocated and ready to be handled to
  196. * the queue. This is a list of &struct iwl_rx_mem_buffer
  197. * @rbd_empty: RBDs with no page attached for allocator use. This is a list
  198. * of &struct iwl_rx_mem_buffer
  199. * @lock: protects the rbd_allocated and rbd_empty lists
  200. * @alloc_wq: work queue for background calls
  201. * @rx_alloc: work struct for background calls
  202. */
  203. struct iwl_rb_allocator {
  204. atomic_t req_pending;
  205. atomic_t req_ready;
  206. struct list_head rbd_allocated;
  207. struct list_head rbd_empty;
  208. spinlock_t lock;
  209. struct workqueue_struct *alloc_wq;
  210. struct work_struct rx_alloc;
  211. };
  212. struct iwl_dma_ptr {
  213. dma_addr_t dma;
  214. void *addr;
  215. size_t size;
  216. };
  217. /**
  218. * iwl_queue_inc_wrap - increment queue index, wrap back to beginning
  219. * @index -- current index
  220. */
  221. static inline int iwl_queue_inc_wrap(struct iwl_trans *trans, int index)
  222. {
  223. return ++index & (trans->cfg->base_params->max_tfd_queue_size - 1);
  224. }
  225. /**
  226. * iwl_get_closed_rb_stts - get closed rb stts from different structs
  227. * @rxq - the rxq to get the rb stts from
  228. */
  229. static inline __le16 iwl_get_closed_rb_stts(struct iwl_trans *trans,
  230. struct iwl_rxq *rxq)
  231. {
  232. if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560) {
  233. __le16 *rb_stts = rxq->rb_stts;
  234. return READ_ONCE(*rb_stts);
  235. } else {
  236. struct iwl_rb_status *rb_stts = rxq->rb_stts;
  237. return READ_ONCE(rb_stts->closed_rb_num);
  238. }
  239. }
  240. /**
  241. * iwl_queue_dec_wrap - decrement queue index, wrap back to end
  242. * @index -- current index
  243. */
  244. static inline int iwl_queue_dec_wrap(struct iwl_trans *trans, int index)
  245. {
  246. return --index & (trans->cfg->base_params->max_tfd_queue_size - 1);
  247. }
  248. struct iwl_cmd_meta {
  249. /* only for SYNC commands, iff the reply skb is wanted */
  250. struct iwl_host_cmd *source;
  251. u32 flags;
  252. u32 tbs;
  253. };
  254. #define TFD_TX_CMD_SLOTS 256
  255. #define TFD_CMD_SLOTS 32
  256. /*
  257. * The FH will write back to the first TB only, so we need to copy some data
  258. * into the buffer regardless of whether it should be mapped or not.
  259. * This indicates how big the first TB must be to include the scratch buffer
  260. * and the assigned PN.
  261. * Since PN location is 8 bytes at offset 12, it's 20 now.
  262. * If we make it bigger then allocations will be bigger and copy slower, so
  263. * that's probably not useful.
  264. */
  265. #define IWL_FIRST_TB_SIZE 20
  266. #define IWL_FIRST_TB_SIZE_ALIGN ALIGN(IWL_FIRST_TB_SIZE, 64)
  267. struct iwl_pcie_txq_entry {
  268. struct iwl_device_cmd *cmd;
  269. struct sk_buff *skb;
  270. /* buffer to free after command completes */
  271. const void *free_buf;
  272. struct iwl_cmd_meta meta;
  273. };
  274. struct iwl_pcie_first_tb_buf {
  275. u8 buf[IWL_FIRST_TB_SIZE_ALIGN];
  276. };
  277. /**
  278. * struct iwl_txq - Tx Queue for DMA
  279. * @q: generic Rx/Tx queue descriptor
  280. * @tfds: transmit frame descriptors (DMA memory)
  281. * @first_tb_bufs: start of command headers, including scratch buffers, for
  282. * the writeback -- this is DMA memory and an array holding one buffer
  283. * for each command on the queue
  284. * @first_tb_dma: DMA address for the first_tb_bufs start
  285. * @entries: transmit entries (driver state)
  286. * @lock: queue lock
  287. * @stuck_timer: timer that fires if queue gets stuck
  288. * @trans_pcie: pointer back to transport (for timer)
  289. * @need_update: indicates need to update read/write index
  290. * @ampdu: true if this queue is an ampdu queue for an specific RA/TID
  291. * @wd_timeout: queue watchdog timeout (jiffies) - per queue
  292. * @frozen: tx stuck queue timer is frozen
  293. * @frozen_expiry_remainder: remember how long until the timer fires
  294. * @bc_tbl: byte count table of the queue (relevant only for gen2 transport)
  295. * @write_ptr: 1-st empty entry (index) host_w
  296. * @read_ptr: last used entry (index) host_r
  297. * @dma_addr: physical addr for BD's
  298. * @n_window: safe queue window
  299. * @id: queue id
  300. * @low_mark: low watermark, resume queue if free space more than this
  301. * @high_mark: high watermark, stop queue if free space less than this
  302. *
  303. * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
  304. * descriptors) and required locking structures.
  305. *
  306. * Note the difference between TFD_QUEUE_SIZE_MAX and n_window: the hardware
  307. * always assumes 256 descriptors, so TFD_QUEUE_SIZE_MAX is always 256 (unless
  308. * there might be HW changes in the future). For the normal TX
  309. * queues, n_window, which is the size of the software queue data
  310. * is also 256; however, for the command queue, n_window is only
  311. * 32 since we don't need so many commands pending. Since the HW
  312. * still uses 256 BDs for DMA though, TFD_QUEUE_SIZE_MAX stays 256.
  313. * This means that we end up with the following:
  314. * HW entries: | 0 | ... | N * 32 | ... | N * 32 + 31 | ... | 255 |
  315. * SW entries: | 0 | ... | 31 |
  316. * where N is a number between 0 and 7. This means that the SW
  317. * data is a window overlayed over the HW queue.
  318. */
  319. struct iwl_txq {
  320. void *tfds;
  321. struct iwl_pcie_first_tb_buf *first_tb_bufs;
  322. dma_addr_t first_tb_dma;
  323. struct iwl_pcie_txq_entry *entries;
  324. spinlock_t lock;
  325. unsigned long frozen_expiry_remainder;
  326. struct timer_list stuck_timer;
  327. struct iwl_trans_pcie *trans_pcie;
  328. bool need_update;
  329. bool frozen;
  330. bool ampdu;
  331. int block;
  332. unsigned long wd_timeout;
  333. struct sk_buff_head overflow_q;
  334. struct iwl_dma_ptr bc_tbl;
  335. int write_ptr;
  336. int read_ptr;
  337. dma_addr_t dma_addr;
  338. int n_window;
  339. u32 id;
  340. int low_mark;
  341. int high_mark;
  342. };
  343. static inline dma_addr_t
  344. iwl_pcie_get_first_tb_dma(struct iwl_txq *txq, int idx)
  345. {
  346. return txq->first_tb_dma +
  347. sizeof(struct iwl_pcie_first_tb_buf) * idx;
  348. }
  349. struct iwl_tso_hdr_page {
  350. struct page *page;
  351. u8 *pos;
  352. };
  353. /**
  354. * enum iwl_shared_irq_flags - level of sharing for irq
  355. * @IWL_SHARED_IRQ_NON_RX: interrupt vector serves non rx causes.
  356. * @IWL_SHARED_IRQ_FIRST_RSS: interrupt vector serves first RSS queue.
  357. */
  358. enum iwl_shared_irq_flags {
  359. IWL_SHARED_IRQ_NON_RX = BIT(0),
  360. IWL_SHARED_IRQ_FIRST_RSS = BIT(1),
  361. };
  362. /**
  363. * enum iwl_image_response_code - image response values
  364. * @IWL_IMAGE_RESP_DEF: the default value of the register
  365. * @IWL_IMAGE_RESP_SUCCESS: iml was read successfully
  366. * @IWL_IMAGE_RESP_FAIL: iml reading failed
  367. */
  368. enum iwl_image_response_code {
  369. IWL_IMAGE_RESP_DEF = 0,
  370. IWL_IMAGE_RESP_SUCCESS = 1,
  371. IWL_IMAGE_RESP_FAIL = 2,
  372. };
  373. /**
  374. * struct iwl_dram_data
  375. * @physical: page phy pointer
  376. * @block: pointer to the allocated block/page
  377. * @size: size of the block/page
  378. */
  379. struct iwl_dram_data {
  380. dma_addr_t physical;
  381. void *block;
  382. int size;
  383. };
  384. /**
  385. * struct iwl_self_init_dram - dram data used by self init process
  386. * @fw: lmac and umac dram data
  387. * @fw_cnt: total number of items in array
  388. * @paging: paging dram data
  389. * @paging_cnt: total number of items in array
  390. */
  391. struct iwl_self_init_dram {
  392. struct iwl_dram_data *fw;
  393. int fw_cnt;
  394. struct iwl_dram_data *paging;
  395. int paging_cnt;
  396. };
  397. /**
  398. * struct iwl_trans_pcie - PCIe transport specific data
  399. * @rxq: all the RX queue data
  400. * @rx_pool: initial pool of iwl_rx_mem_buffer for all the queues
  401. * @global_table: table mapping received VID from hw to rxb
  402. * @rba: allocator for RX replenishing
  403. * @ctxt_info: context information for FW self init
  404. * @ctxt_info_gen3: context information for gen3 devices
  405. * @prph_info: prph info for self init
  406. * @prph_scratch: prph scratch for self init
  407. * @ctxt_info_dma_addr: dma addr of context information
  408. * @prph_info_dma_addr: dma addr of prph info
  409. * @prph_scratch_dma_addr: dma addr of prph scratch
  410. * @ctxt_info_dma_addr: dma addr of context information
  411. * @init_dram: DRAM data of firmware image (including paging).
  412. * Context information addresses will be taken from here.
  413. * This is driver's local copy for keeping track of size and
  414. * count for allocating and freeing the memory.
  415. * @trans: pointer to the generic transport area
  416. * @scd_base_addr: scheduler sram base address in SRAM
  417. * @scd_bc_tbls: pointer to the byte count table of the scheduler
  418. * @kw: keep warm address
  419. * @pci_dev: basic pci-network driver stuff
  420. * @hw_base: pci hardware address support
  421. * @ucode_write_complete: indicates that the ucode has been copied.
  422. * @ucode_write_waitq: wait queue for uCode load
  423. * @cmd_queue - command queue number
  424. * @rx_buf_size: Rx buffer size
  425. * @bc_table_dword: true if the BC table expects DWORD (as opposed to bytes)
  426. * @scd_set_active: should the transport configure the SCD for HCMD queue
  427. * @sw_csum_tx: if true, then the transport will compute the csum of the TXed
  428. * frame.
  429. * @rx_page_order: page order for receive buffer size
  430. * @reg_lock: protect hw register access
  431. * @mutex: to protect stop_device / start_fw / start_hw
  432. * @cmd_in_flight: true when we have a host command in flight
  433. * @fw_mon_phys: physical address of the buffer for the firmware monitor
  434. * @fw_mon_page: points to the first page of the buffer for the firmware monitor
  435. * @fw_mon_size: size of the buffer for the firmware monitor
  436. * @msix_entries: array of MSI-X entries
  437. * @msix_enabled: true if managed to enable MSI-X
  438. * @shared_vec_mask: the type of causes the shared vector handles
  439. * (see iwl_shared_irq_flags).
  440. * @alloc_vecs: the number of interrupt vectors allocated by the OS
  441. * @def_irq: default irq for non rx causes
  442. * @fh_init_mask: initial unmasked fh causes
  443. * @hw_init_mask: initial unmasked hw causes
  444. * @fh_mask: current unmasked fh causes
  445. * @hw_mask: current unmasked hw causes
  446. * @in_rescan: true if we have triggered a device rescan
  447. * @scheduled_for_removal: true if we have scheduled a device removal
  448. */
  449. struct iwl_trans_pcie {
  450. struct iwl_rxq *rxq;
  451. struct iwl_rx_mem_buffer rx_pool[RX_POOL_SIZE];
  452. struct iwl_rx_mem_buffer *global_table[RX_POOL_SIZE];
  453. struct iwl_rb_allocator rba;
  454. union {
  455. struct iwl_context_info *ctxt_info;
  456. struct iwl_context_info_gen3 *ctxt_info_gen3;
  457. };
  458. struct iwl_prph_info *prph_info;
  459. struct iwl_prph_scratch *prph_scratch;
  460. dma_addr_t ctxt_info_dma_addr;
  461. dma_addr_t prph_info_dma_addr;
  462. dma_addr_t prph_scratch_dma_addr;
  463. dma_addr_t iml_dma_addr;
  464. struct iwl_self_init_dram init_dram;
  465. struct iwl_trans *trans;
  466. struct net_device napi_dev;
  467. struct __percpu iwl_tso_hdr_page *tso_hdr_page;
  468. /* INT ICT Table */
  469. __le32 *ict_tbl;
  470. dma_addr_t ict_tbl_dma;
  471. int ict_index;
  472. bool use_ict;
  473. bool is_down, opmode_down;
  474. bool debug_rfkill;
  475. struct isr_statistics isr_stats;
  476. spinlock_t irq_lock;
  477. struct mutex mutex;
  478. u32 inta_mask;
  479. u32 scd_base_addr;
  480. struct iwl_dma_ptr scd_bc_tbls;
  481. struct iwl_dma_ptr kw;
  482. struct iwl_txq *txq_memory;
  483. struct iwl_txq *txq[IWL_MAX_TVQM_QUEUES];
  484. unsigned long queue_used[BITS_TO_LONGS(IWL_MAX_TVQM_QUEUES)];
  485. unsigned long queue_stopped[BITS_TO_LONGS(IWL_MAX_TVQM_QUEUES)];
  486. /* PCI bus related data */
  487. struct pci_dev *pci_dev;
  488. void __iomem *hw_base;
  489. bool ucode_write_complete;
  490. wait_queue_head_t ucode_write_waitq;
  491. wait_queue_head_t wait_command_queue;
  492. wait_queue_head_t d0i3_waitq;
  493. u8 page_offs, dev_cmd_offs;
  494. u8 cmd_queue;
  495. u8 cmd_fifo;
  496. unsigned int cmd_q_wdg_timeout;
  497. u8 n_no_reclaim_cmds;
  498. u8 no_reclaim_cmds[MAX_NO_RECLAIM_CMDS];
  499. u8 max_tbs;
  500. u16 tfd_size;
  501. enum iwl_amsdu_size rx_buf_size;
  502. bool bc_table_dword;
  503. bool scd_set_active;
  504. bool sw_csum_tx;
  505. bool pcie_dbg_dumped_once;
  506. u32 rx_page_order;
  507. /*protect hw register */
  508. spinlock_t reg_lock;
  509. bool cmd_hold_nic_awake;
  510. bool ref_cmd_in_flight;
  511. dma_addr_t fw_mon_phys;
  512. struct page *fw_mon_page;
  513. u32 fw_mon_size;
  514. struct msix_entry msix_entries[IWL_MAX_RX_HW_QUEUES];
  515. bool msix_enabled;
  516. u8 shared_vec_mask;
  517. u32 alloc_vecs;
  518. u32 def_irq;
  519. u32 fh_init_mask;
  520. u32 hw_init_mask;
  521. u32 fh_mask;
  522. u32 hw_mask;
  523. cpumask_t affinity_mask[IWL_MAX_RX_HW_QUEUES];
  524. u16 tx_cmd_queue_size;
  525. bool in_rescan;
  526. bool scheduled_for_removal;
  527. };
  528. static inline struct iwl_trans_pcie *
  529. IWL_TRANS_GET_PCIE_TRANS(struct iwl_trans *trans)
  530. {
  531. return (void *)trans->trans_specific;
  532. }
  533. static inline void iwl_pcie_clear_irq(struct iwl_trans *trans,
  534. struct msix_entry *entry)
  535. {
  536. /*
  537. * Before sending the interrupt the HW disables it to prevent
  538. * a nested interrupt. This is done by writing 1 to the corresponding
  539. * bit in the mask register. After handling the interrupt, it should be
  540. * re-enabled by clearing this bit. This register is defined as
  541. * write 1 clear (W1C) register, meaning that it's being clear
  542. * by writing 1 to the bit.
  543. */
  544. iwl_write32(trans, CSR_MSIX_AUTOMASK_ST_AD, BIT(entry->entry));
  545. }
  546. static inline struct iwl_trans *
  547. iwl_trans_pcie_get_trans(struct iwl_trans_pcie *trans_pcie)
  548. {
  549. return container_of((void *)trans_pcie, struct iwl_trans,
  550. trans_specific);
  551. }
  552. /*
  553. * Convention: trans API functions: iwl_trans_pcie_XXX
  554. * Other functions: iwl_pcie_XXX
  555. */
  556. struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
  557. const struct pci_device_id *ent,
  558. const struct iwl_cfg *cfg);
  559. void iwl_trans_pcie_free(struct iwl_trans *trans);
  560. /*****************************************************
  561. * RX
  562. ******************************************************/
  563. int iwl_pcie_rx_init(struct iwl_trans *trans);
  564. int iwl_pcie_gen2_rx_init(struct iwl_trans *trans);
  565. irqreturn_t iwl_pcie_msix_isr(int irq, void *data);
  566. irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id);
  567. irqreturn_t iwl_pcie_irq_msix_handler(int irq, void *dev_id);
  568. irqreturn_t iwl_pcie_irq_rx_msix_handler(int irq, void *dev_id);
  569. int iwl_pcie_rx_stop(struct iwl_trans *trans);
  570. void iwl_pcie_rx_free(struct iwl_trans *trans);
  571. void iwl_pcie_free_rbs_pool(struct iwl_trans *trans);
  572. void iwl_pcie_rx_init_rxb_lists(struct iwl_rxq *rxq);
  573. int iwl_pcie_dummy_napi_poll(struct napi_struct *napi, int budget);
  574. void iwl_pcie_rxq_alloc_rbs(struct iwl_trans *trans, gfp_t priority,
  575. struct iwl_rxq *rxq);
  576. /*****************************************************
  577. * ICT - interrupt handling
  578. ******************************************************/
  579. irqreturn_t iwl_pcie_isr(int irq, void *data);
  580. int iwl_pcie_alloc_ict(struct iwl_trans *trans);
  581. void iwl_pcie_free_ict(struct iwl_trans *trans);
  582. void iwl_pcie_reset_ict(struct iwl_trans *trans);
  583. void iwl_pcie_disable_ict(struct iwl_trans *trans);
  584. /*****************************************************
  585. * TX / HCMD
  586. ******************************************************/
  587. int iwl_pcie_tx_init(struct iwl_trans *trans);
  588. int iwl_pcie_gen2_tx_init(struct iwl_trans *trans);
  589. void iwl_pcie_tx_start(struct iwl_trans *trans, u32 scd_base_addr);
  590. int iwl_pcie_tx_stop(struct iwl_trans *trans);
  591. void iwl_pcie_tx_free(struct iwl_trans *trans);
  592. bool iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int queue, u16 ssn,
  593. const struct iwl_trans_txq_scd_cfg *cfg,
  594. unsigned int wdg_timeout);
  595. void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int queue,
  596. bool configure_scd);
  597. void iwl_trans_pcie_txq_set_shared_mode(struct iwl_trans *trans, u32 txq_id,
  598. bool shared_mode);
  599. void iwl_trans_pcie_log_scd_error(struct iwl_trans *trans,
  600. struct iwl_txq *txq);
  601. int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
  602. struct iwl_device_cmd *dev_cmd, int txq_id);
  603. void iwl_pcie_txq_check_wrptrs(struct iwl_trans *trans);
  604. int iwl_trans_pcie_send_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
  605. void iwl_pcie_hcmd_complete(struct iwl_trans *trans,
  606. struct iwl_rx_cmd_buffer *rxb);
  607. void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn,
  608. struct sk_buff_head *skbs);
  609. void iwl_trans_pcie_tx_reset(struct iwl_trans *trans);
  610. static inline u16 iwl_pcie_tfd_tb_get_len(struct iwl_trans *trans, void *_tfd,
  611. u8 idx)
  612. {
  613. if (trans->cfg->use_tfh) {
  614. struct iwl_tfh_tfd *tfd = _tfd;
  615. struct iwl_tfh_tb *tb = &tfd->tbs[idx];
  616. return le16_to_cpu(tb->tb_len);
  617. } else {
  618. struct iwl_tfd *tfd = _tfd;
  619. struct iwl_tfd_tb *tb = &tfd->tbs[idx];
  620. return le16_to_cpu(tb->hi_n_len) >> 4;
  621. }
  622. }
  623. /*****************************************************
  624. * Error handling
  625. ******************************************************/
  626. void iwl_pcie_dump_csr(struct iwl_trans *trans);
  627. /*****************************************************
  628. * Helpers
  629. ******************************************************/
  630. static inline void _iwl_disable_interrupts(struct iwl_trans *trans)
  631. {
  632. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  633. clear_bit(STATUS_INT_ENABLED, &trans->status);
  634. if (!trans_pcie->msix_enabled) {
  635. /* disable interrupts from uCode/NIC to host */
  636. iwl_write32(trans, CSR_INT_MASK, 0x00000000);
  637. /* acknowledge/clear/reset any interrupts still pending
  638. * from uCode or flow handler (Rx/Tx DMA) */
  639. iwl_write32(trans, CSR_INT, 0xffffffff);
  640. iwl_write32(trans, CSR_FH_INT_STATUS, 0xffffffff);
  641. } else {
  642. /* disable all the interrupt we might use */
  643. iwl_write32(trans, CSR_MSIX_FH_INT_MASK_AD,
  644. trans_pcie->fh_init_mask);
  645. iwl_write32(trans, CSR_MSIX_HW_INT_MASK_AD,
  646. trans_pcie->hw_init_mask);
  647. }
  648. IWL_DEBUG_ISR(trans, "Disabled interrupts\n");
  649. }
  650. #define IWL_NUM_OF_COMPLETION_RINGS 31
  651. #define IWL_NUM_OF_TRANSFER_RINGS 527
  652. static inline int iwl_pcie_get_num_sections(const struct fw_img *fw,
  653. int start)
  654. {
  655. int i = 0;
  656. while (start < fw->num_sec &&
  657. fw->sec[start].offset != CPU1_CPU2_SEPARATOR_SECTION &&
  658. fw->sec[start].offset != PAGING_SEPARATOR_SECTION) {
  659. start++;
  660. i++;
  661. }
  662. return i;
  663. }
  664. static inline int iwl_pcie_ctxt_info_alloc_dma(struct iwl_trans *trans,
  665. const struct fw_desc *sec,
  666. struct iwl_dram_data *dram)
  667. {
  668. dram->block = dma_alloc_coherent(trans->dev, sec->len,
  669. &dram->physical,
  670. GFP_KERNEL);
  671. if (!dram->block)
  672. return -ENOMEM;
  673. dram->size = sec->len;
  674. memcpy(dram->block, sec->data, sec->len);
  675. return 0;
  676. }
  677. static inline void iwl_pcie_ctxt_info_free_fw_img(struct iwl_trans *trans)
  678. {
  679. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  680. struct iwl_self_init_dram *dram = &trans_pcie->init_dram;
  681. int i;
  682. if (!dram->fw) {
  683. WARN_ON(dram->fw_cnt);
  684. return;
  685. }
  686. for (i = 0; i < dram->fw_cnt; i++)
  687. dma_free_coherent(trans->dev, dram->fw[i].size,
  688. dram->fw[i].block, dram->fw[i].physical);
  689. kfree(dram->fw);
  690. dram->fw_cnt = 0;
  691. dram->fw = NULL;
  692. }
  693. static inline void iwl_disable_interrupts(struct iwl_trans *trans)
  694. {
  695. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  696. spin_lock(&trans_pcie->irq_lock);
  697. _iwl_disable_interrupts(trans);
  698. spin_unlock(&trans_pcie->irq_lock);
  699. }
  700. static inline void _iwl_enable_interrupts(struct iwl_trans *trans)
  701. {
  702. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  703. IWL_DEBUG_ISR(trans, "Enabling interrupts\n");
  704. set_bit(STATUS_INT_ENABLED, &trans->status);
  705. if (!trans_pcie->msix_enabled) {
  706. trans_pcie->inta_mask = CSR_INI_SET_MASK;
  707. iwl_write32(trans, CSR_INT_MASK, trans_pcie->inta_mask);
  708. } else {
  709. /*
  710. * fh/hw_mask keeps all the unmasked causes.
  711. * Unlike msi, in msix cause is enabled when it is unset.
  712. */
  713. trans_pcie->hw_mask = trans_pcie->hw_init_mask;
  714. trans_pcie->fh_mask = trans_pcie->fh_init_mask;
  715. iwl_write32(trans, CSR_MSIX_FH_INT_MASK_AD,
  716. ~trans_pcie->fh_mask);
  717. iwl_write32(trans, CSR_MSIX_HW_INT_MASK_AD,
  718. ~trans_pcie->hw_mask);
  719. }
  720. }
  721. static inline void iwl_enable_interrupts(struct iwl_trans *trans)
  722. {
  723. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  724. spin_lock(&trans_pcie->irq_lock);
  725. _iwl_enable_interrupts(trans);
  726. spin_unlock(&trans_pcie->irq_lock);
  727. }
  728. static inline void iwl_enable_hw_int_msk_msix(struct iwl_trans *trans, u32 msk)
  729. {
  730. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  731. iwl_write32(trans, CSR_MSIX_HW_INT_MASK_AD, ~msk);
  732. trans_pcie->hw_mask = msk;
  733. }
  734. static inline void iwl_enable_fh_int_msk_msix(struct iwl_trans *trans, u32 msk)
  735. {
  736. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  737. iwl_write32(trans, CSR_MSIX_FH_INT_MASK_AD, ~msk);
  738. trans_pcie->fh_mask = msk;
  739. }
  740. static inline void iwl_enable_fw_load_int(struct iwl_trans *trans)
  741. {
  742. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  743. IWL_DEBUG_ISR(trans, "Enabling FW load interrupt\n");
  744. if (!trans_pcie->msix_enabled) {
  745. trans_pcie->inta_mask = CSR_INT_BIT_FH_TX;
  746. iwl_write32(trans, CSR_INT_MASK, trans_pcie->inta_mask);
  747. } else {
  748. iwl_write32(trans, CSR_MSIX_HW_INT_MASK_AD,
  749. trans_pcie->hw_init_mask);
  750. iwl_enable_fh_int_msk_msix(trans,
  751. MSIX_FH_INT_CAUSES_D2S_CH0_NUM);
  752. }
  753. }
  754. static inline void iwl_enable_fw_load_int_ctx_info(struct iwl_trans *trans)
  755. {
  756. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  757. IWL_DEBUG_ISR(trans, "Enabling ALIVE interrupt only\n");
  758. if (!trans_pcie->msix_enabled) {
  759. /*
  760. * When we'll receive the ALIVE interrupt, the ISR will call
  761. * iwl_enable_fw_load_int_ctx_info again to set the ALIVE
  762. * interrupt (which is not really needed anymore) but also the
  763. * RX interrupt which will allow us to receive the ALIVE
  764. * notification (which is Rx) and continue the flow.
  765. */
  766. trans_pcie->inta_mask = CSR_INT_BIT_ALIVE | CSR_INT_BIT_FH_RX;
  767. iwl_write32(trans, CSR_INT_MASK, trans_pcie->inta_mask);
  768. } else {
  769. iwl_enable_hw_int_msk_msix(trans,
  770. MSIX_HW_INT_CAUSES_REG_ALIVE);
  771. /*
  772. * Leave all the FH causes enabled to get the ALIVE
  773. * notification.
  774. */
  775. iwl_enable_fh_int_msk_msix(trans, trans_pcie->fh_init_mask);
  776. }
  777. }
  778. static inline u16 iwl_pcie_get_cmd_index(const struct iwl_txq *q, u32 index)
  779. {
  780. return index & (q->n_window - 1);
  781. }
  782. static inline void *iwl_pcie_get_tfd(struct iwl_trans *trans,
  783. struct iwl_txq *txq, int idx)
  784. {
  785. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  786. if (trans->cfg->use_tfh)
  787. idx = iwl_pcie_get_cmd_index(txq, idx);
  788. return txq->tfds + trans_pcie->tfd_size * idx;
  789. }
  790. static inline const char *queue_name(struct device *dev,
  791. struct iwl_trans_pcie *trans_p, int i)
  792. {
  793. if (trans_p->shared_vec_mask) {
  794. int vec = trans_p->shared_vec_mask &
  795. IWL_SHARED_IRQ_FIRST_RSS ? 1 : 0;
  796. if (i == 0)
  797. return DRV_NAME ": shared IRQ";
  798. return devm_kasprintf(dev, GFP_KERNEL,
  799. DRV_NAME ": queue %d", i + vec);
  800. }
  801. if (i == 0)
  802. return DRV_NAME ": default queue";
  803. if (i == trans_p->alloc_vecs - 1)
  804. return DRV_NAME ": exception";
  805. return devm_kasprintf(dev, GFP_KERNEL,
  806. DRV_NAME ": queue %d", i);
  807. }
  808. static inline void iwl_enable_rfkill_int(struct iwl_trans *trans)
  809. {
  810. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  811. IWL_DEBUG_ISR(trans, "Enabling rfkill interrupt\n");
  812. if (!trans_pcie->msix_enabled) {
  813. trans_pcie->inta_mask = CSR_INT_BIT_RF_KILL;
  814. iwl_write32(trans, CSR_INT_MASK, trans_pcie->inta_mask);
  815. } else {
  816. iwl_write32(trans, CSR_MSIX_FH_INT_MASK_AD,
  817. trans_pcie->fh_init_mask);
  818. iwl_enable_hw_int_msk_msix(trans,
  819. MSIX_HW_INT_CAUSES_REG_RF_KILL);
  820. }
  821. if (trans->cfg->device_family == IWL_DEVICE_FAMILY_9000) {
  822. /*
  823. * On 9000-series devices this bit isn't enabled by default, so
  824. * when we power down the device we need set the bit to allow it
  825. * to wake up the PCI-E bus for RF-kill interrupts.
  826. */
  827. iwl_set_bit(trans, CSR_GP_CNTRL,
  828. CSR_GP_CNTRL_REG_FLAG_RFKILL_WAKE_L1A_EN);
  829. }
  830. }
  831. void iwl_pcie_handle_rfkill_irq(struct iwl_trans *trans);
  832. static inline void iwl_wake_queue(struct iwl_trans *trans,
  833. struct iwl_txq *txq)
  834. {
  835. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  836. if (test_and_clear_bit(txq->id, trans_pcie->queue_stopped)) {
  837. IWL_DEBUG_TX_QUEUES(trans, "Wake hwq %d\n", txq->id);
  838. iwl_op_mode_queue_not_full(trans->op_mode, txq->id);
  839. }
  840. }
  841. static inline void iwl_stop_queue(struct iwl_trans *trans,
  842. struct iwl_txq *txq)
  843. {
  844. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  845. if (!test_and_set_bit(txq->id, trans_pcie->queue_stopped)) {
  846. iwl_op_mode_queue_full(trans->op_mode, txq->id);
  847. IWL_DEBUG_TX_QUEUES(trans, "Stop hwq %d\n", txq->id);
  848. } else
  849. IWL_DEBUG_TX_QUEUES(trans, "hwq %d already stopped\n",
  850. txq->id);
  851. }
  852. static inline bool iwl_queue_used(const struct iwl_txq *q, int i)
  853. {
  854. int index = iwl_pcie_get_cmd_index(q, i);
  855. int r = iwl_pcie_get_cmd_index(q, q->read_ptr);
  856. int w = iwl_pcie_get_cmd_index(q, q->write_ptr);
  857. return w >= r ?
  858. (index >= r && index < w) :
  859. !(index < r && index >= w);
  860. }
  861. static inline bool iwl_is_rfkill_set(struct iwl_trans *trans)
  862. {
  863. struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
  864. lockdep_assert_held(&trans_pcie->mutex);
  865. if (trans_pcie->debug_rfkill)
  866. return true;
  867. return !(iwl_read32(trans, CSR_GP_CNTRL) &
  868. CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);
  869. }
  870. static inline void __iwl_trans_pcie_set_bits_mask(struct iwl_trans *trans,
  871. u32 reg, u32 mask, u32 value)
  872. {
  873. u32 v;
  874. #ifdef CONFIG_IWLWIFI_DEBUG
  875. WARN_ON_ONCE(value & ~mask);
  876. #endif
  877. v = iwl_read32(trans, reg);
  878. v &= ~mask;
  879. v |= value;
  880. iwl_write32(trans, reg, v);
  881. }
  882. static inline void __iwl_trans_pcie_clear_bit(struct iwl_trans *trans,
  883. u32 reg, u32 mask)
  884. {
  885. __iwl_trans_pcie_set_bits_mask(trans, reg, mask, 0);
  886. }
  887. static inline void __iwl_trans_pcie_set_bit(struct iwl_trans *trans,
  888. u32 reg, u32 mask)
  889. {
  890. __iwl_trans_pcie_set_bits_mask(trans, reg, mask, mask);
  891. }
  892. void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state);
  893. #ifdef CONFIG_IWLWIFI_DEBUGFS
  894. int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans);
  895. #else
  896. static inline int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans)
  897. {
  898. return 0;
  899. }
  900. #endif
  901. int iwl_pci_fw_exit_d0i3(struct iwl_trans *trans);
  902. int iwl_pci_fw_enter_d0i3(struct iwl_trans *trans);
  903. void iwl_pcie_enable_rx_wake(struct iwl_trans *trans, bool enable);
  904. void iwl_pcie_rx_allocator_work(struct work_struct *data);
  905. /* common functions that are used by gen2 transport */
  906. void iwl_pcie_apm_config(struct iwl_trans *trans);
  907. int iwl_pcie_prepare_card_hw(struct iwl_trans *trans);
  908. void iwl_pcie_synchronize_irqs(struct iwl_trans *trans);
  909. bool iwl_pcie_check_hw_rf_kill(struct iwl_trans *trans);
  910. void iwl_trans_pcie_handle_stop_rfkill(struct iwl_trans *trans,
  911. bool was_in_rfkill);
  912. void iwl_pcie_txq_free_tfd(struct iwl_trans *trans, struct iwl_txq *txq);
  913. int iwl_queue_space(struct iwl_trans *trans, const struct iwl_txq *q);
  914. void iwl_pcie_apm_stop_master(struct iwl_trans *trans);
  915. void iwl_pcie_conf_msix_hw(struct iwl_trans_pcie *trans_pcie);
  916. int iwl_pcie_txq_init(struct iwl_trans *trans, struct iwl_txq *txq,
  917. int slots_num, bool cmd_queue);
  918. int iwl_pcie_txq_alloc(struct iwl_trans *trans,
  919. struct iwl_txq *txq, int slots_num, bool cmd_queue);
  920. int iwl_pcie_alloc_dma_ptr(struct iwl_trans *trans,
  921. struct iwl_dma_ptr *ptr, size_t size);
  922. void iwl_pcie_free_dma_ptr(struct iwl_trans *trans, struct iwl_dma_ptr *ptr);
  923. void iwl_pcie_apply_destination(struct iwl_trans *trans);
  924. void iwl_pcie_free_tso_page(struct iwl_trans_pcie *trans_pcie,
  925. struct sk_buff *skb);
  926. #ifdef CONFIG_INET
  927. struct iwl_tso_hdr_page *get_page_hdr(struct iwl_trans *trans, size_t len);
  928. #endif
  929. /* common functions that are used by gen3 transport */
  930. void iwl_pcie_alloc_fw_monitor(struct iwl_trans *trans, u8 max_power);
  931. /* transport gen 2 exported functions */
  932. int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans,
  933. const struct fw_img *fw, bool run_in_rfkill);
  934. void iwl_trans_pcie_gen2_fw_alive(struct iwl_trans *trans, u32 scd_addr);
  935. int iwl_trans_pcie_dyn_txq_alloc(struct iwl_trans *trans,
  936. struct iwl_tx_queue_cfg_cmd *cmd,
  937. int cmd_id, int size,
  938. unsigned int timeout);
  939. void iwl_trans_pcie_dyn_txq_free(struct iwl_trans *trans, int queue);
  940. int iwl_trans_pcie_gen2_tx(struct iwl_trans *trans, struct sk_buff *skb,
  941. struct iwl_device_cmd *dev_cmd, int txq_id);
  942. int iwl_trans_pcie_gen2_send_hcmd(struct iwl_trans *trans,
  943. struct iwl_host_cmd *cmd);
  944. void iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans,
  945. bool low_power);
  946. void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans, bool low_power);
  947. void iwl_pcie_gen2_txq_unmap(struct iwl_trans *trans, int txq_id);
  948. void iwl_pcie_gen2_tx_free(struct iwl_trans *trans);
  949. void iwl_pcie_gen2_tx_stop(struct iwl_trans *trans);
  950. #endif /* __iwl_trans_int_pcie_h__ */