iwl-trans.h 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125
  1. /******************************************************************************
  2. *
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * GPL LICENSE SUMMARY
  7. *
  8. * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
  9. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it 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
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  23. * USA
  24. *
  25. * The full GNU General Public License is included in this distribution
  26. * in the file called COPYING.
  27. *
  28. * Contact Information:
  29. * Intel Linux Wireless <ilw@linux.intel.com>
  30. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  31. *
  32. * BSD LICENSE
  33. *
  34. * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
  35. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  36. * All rights reserved.
  37. *
  38. * Redistribution and use in source and binary forms, with or without
  39. * modification, are permitted provided that the following conditions
  40. * are met:
  41. *
  42. * * Redistributions of source code must retain the above copyright
  43. * notice, this list of conditions and the following disclaimer.
  44. * * Redistributions in binary form must reproduce the above copyright
  45. * notice, this list of conditions and the following disclaimer in
  46. * the documentation and/or other materials provided with the
  47. * distribution.
  48. * * Neither the name Intel Corporation nor the names of its
  49. * contributors may be used to endorse or promote products derived
  50. * from this software without specific prior written permission.
  51. *
  52. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  53. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  54. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  55. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  56. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  57. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  58. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  59. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  60. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  61. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  62. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  63. *
  64. *****************************************************************************/
  65. #ifndef __iwl_trans_h__
  66. #define __iwl_trans_h__
  67. #include <linux/ieee80211.h>
  68. #include <linux/mm.h> /* for page_address */
  69. #include <linux/lockdep.h>
  70. #include "iwl-debug.h"
  71. #include "iwl-config.h"
  72. #include "iwl-fw.h"
  73. #include "iwl-op-mode.h"
  74. /**
  75. * DOC: Transport layer - what is it ?
  76. *
  77. * The transport layer is the layer that deals with the HW directly. It provides
  78. * an abstraction of the underlying HW to the upper layer. The transport layer
  79. * doesn't provide any policy, algorithm or anything of this kind, but only
  80. * mechanisms to make the HW do something. It is not completely stateless but
  81. * close to it.
  82. * We will have an implementation for each different supported bus.
  83. */
  84. /**
  85. * DOC: Life cycle of the transport layer
  86. *
  87. * The transport layer has a very precise life cycle.
  88. *
  89. * 1) A helper function is called during the module initialization and
  90. * registers the bus driver's ops with the transport's alloc function.
  91. * 2) Bus's probe calls to the transport layer's allocation functions.
  92. * Of course this function is bus specific.
  93. * 3) This allocation functions will spawn the upper layer which will
  94. * register mac80211.
  95. *
  96. * 4) At some point (i.e. mac80211's start call), the op_mode will call
  97. * the following sequence:
  98. * start_hw
  99. * start_fw
  100. *
  101. * 5) Then when finished (or reset):
  102. * stop_device
  103. *
  104. * 6) Eventually, the free function will be called.
  105. */
  106. /**
  107. * DOC: Host command section
  108. *
  109. * A host command is a command issued by the upper layer to the fw. There are
  110. * several versions of fw that have several APIs. The transport layer is
  111. * completely agnostic to these differences.
  112. * The transport does provide helper functionality (i.e. SYNC / ASYNC mode),
  113. */
  114. #define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f)
  115. #define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8)
  116. #define SEQ_TO_INDEX(s) ((s) & 0xff)
  117. #define INDEX_TO_SEQ(i) ((i) & 0xff)
  118. #define SEQ_RX_FRAME cpu_to_le16(0x8000)
  119. /*
  120. * those functions retrieve specific information from
  121. * the id field in the iwl_host_cmd struct which contains
  122. * the command id, the group id and the version of the command
  123. * and vice versa
  124. */
  125. static inline u8 iwl_cmd_opcode(u32 cmdid)
  126. {
  127. return cmdid & 0xFF;
  128. }
  129. static inline u8 iwl_cmd_groupid(u32 cmdid)
  130. {
  131. return ((cmdid & 0xFF00) >> 8);
  132. }
  133. static inline u8 iwl_cmd_version(u32 cmdid)
  134. {
  135. return ((cmdid & 0xFF0000) >> 16);
  136. }
  137. static inline u32 iwl_cmd_id(u8 opcode, u8 groupid, u8 version)
  138. {
  139. return opcode + (groupid << 8) + (version << 16);
  140. }
  141. /* make u16 wide id out of u8 group and opcode */
  142. #define WIDE_ID(grp, opcode) ((grp << 8) | opcode)
  143. /* due to the conversion, this group is special; new groups
  144. * should be defined in the appropriate fw-api header files
  145. */
  146. #define IWL_ALWAYS_LONG_GROUP 1
  147. /**
  148. * struct iwl_cmd_header
  149. *
  150. * This header format appears in the beginning of each command sent from the
  151. * driver, and each response/notification received from uCode.
  152. */
  153. struct iwl_cmd_header {
  154. u8 cmd; /* Command ID: REPLY_RXON, etc. */
  155. u8 group_id;
  156. /*
  157. * The driver sets up the sequence number to values of its choosing.
  158. * uCode does not use this value, but passes it back to the driver
  159. * when sending the response to each driver-originated command, so
  160. * the driver can match the response to the command. Since the values
  161. * don't get used by uCode, the driver may set up an arbitrary format.
  162. *
  163. * There is one exception: uCode sets bit 15 when it originates
  164. * the response/notification, i.e. when the response/notification
  165. * is not a direct response to a command sent by the driver. For
  166. * example, uCode issues REPLY_RX when it sends a received frame
  167. * to the driver; it is not a direct response to any driver command.
  168. *
  169. * The Linux driver uses the following format:
  170. *
  171. * 0:7 tfd index - position within TX queue
  172. * 8:12 TX queue id
  173. * 13:14 reserved
  174. * 15 unsolicited RX or uCode-originated notification
  175. */
  176. __le16 sequence;
  177. } __packed;
  178. /**
  179. * struct iwl_cmd_header_wide
  180. *
  181. * This header format appears in the beginning of each command sent from the
  182. * driver, and each response/notification received from uCode.
  183. * this is the wide version that contains more information about the command
  184. * like length, version and command type
  185. */
  186. struct iwl_cmd_header_wide {
  187. u8 cmd;
  188. u8 group_id;
  189. __le16 sequence;
  190. __le16 length;
  191. u8 reserved;
  192. u8 version;
  193. } __packed;
  194. #define FH_RSCSR_FRAME_SIZE_MSK 0x00003FFF /* bits 0-13 */
  195. #define FH_RSCSR_FRAME_INVALID 0x55550000
  196. #define FH_RSCSR_FRAME_ALIGN 0x40
  197. struct iwl_rx_packet {
  198. /*
  199. * The first 4 bytes of the RX frame header contain both the RX frame
  200. * size and some flags.
  201. * Bit fields:
  202. * 31: flag flush RB request
  203. * 30: flag ignore TC (terminal counter) request
  204. * 29: flag fast IRQ request
  205. * 28-14: Reserved
  206. * 13-00: RX frame size
  207. */
  208. __le32 len_n_flags;
  209. struct iwl_cmd_header hdr;
  210. u8 data[];
  211. } __packed;
  212. static inline u32 iwl_rx_packet_len(const struct iwl_rx_packet *pkt)
  213. {
  214. return le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
  215. }
  216. static inline u32 iwl_rx_packet_payload_len(const struct iwl_rx_packet *pkt)
  217. {
  218. return iwl_rx_packet_len(pkt) - sizeof(pkt->hdr);
  219. }
  220. /**
  221. * enum CMD_MODE - how to send the host commands ?
  222. *
  223. * @CMD_ASYNC: Return right away and don't wait for the response
  224. * @CMD_WANT_SKB: Not valid with CMD_ASYNC. The caller needs the buffer of
  225. * the response. The caller needs to call iwl_free_resp when done.
  226. * @CMD_HIGH_PRIO: The command is high priority - it goes to the front of the
  227. * command queue, but after other high priority commands. Valid only
  228. * with CMD_ASYNC.
  229. * @CMD_SEND_IN_IDLE: The command should be sent even when the trans is idle.
  230. * @CMD_MAKE_TRANS_IDLE: The command response should mark the trans as idle.
  231. * @CMD_WAKE_UP_TRANS: The command response should wake up the trans
  232. * (i.e. mark it as non-idle).
  233. * @CMD_TB_BITMAP_POS: Position of the first bit for the TB bitmap. We need to
  234. * check that we leave enough room for the TBs bitmap which needs 20 bits.
  235. */
  236. enum CMD_MODE {
  237. CMD_ASYNC = BIT(0),
  238. CMD_WANT_SKB = BIT(1),
  239. CMD_SEND_IN_RFKILL = BIT(2),
  240. CMD_HIGH_PRIO = BIT(3),
  241. CMD_SEND_IN_IDLE = BIT(4),
  242. CMD_MAKE_TRANS_IDLE = BIT(5),
  243. CMD_WAKE_UP_TRANS = BIT(6),
  244. CMD_TB_BITMAP_POS = 11,
  245. };
  246. #define DEF_CMD_PAYLOAD_SIZE 320
  247. /**
  248. * struct iwl_device_cmd
  249. *
  250. * For allocation of the command and tx queues, this establishes the overall
  251. * size of the largest command we send to uCode, except for commands that
  252. * aren't fully copied and use other TFD space.
  253. */
  254. struct iwl_device_cmd {
  255. union {
  256. struct {
  257. struct iwl_cmd_header hdr; /* uCode API */
  258. u8 payload[DEF_CMD_PAYLOAD_SIZE];
  259. };
  260. struct {
  261. struct iwl_cmd_header_wide hdr_wide;
  262. u8 payload_wide[DEF_CMD_PAYLOAD_SIZE -
  263. sizeof(struct iwl_cmd_header_wide) +
  264. sizeof(struct iwl_cmd_header)];
  265. };
  266. };
  267. } __packed;
  268. #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd))
  269. /*
  270. * number of transfer buffers (fragments) per transmit frame descriptor;
  271. * this is just the driver's idea, the hardware supports 20
  272. */
  273. #define IWL_MAX_CMD_TBS_PER_TFD 2
  274. /**
  275. * struct iwl_hcmd_dataflag - flag for each one of the chunks of the command
  276. *
  277. * @IWL_HCMD_DFL_NOCOPY: By default, the command is copied to the host command's
  278. * ring. The transport layer doesn't map the command's buffer to DMA, but
  279. * rather copies it to a previously allocated DMA buffer. This flag tells
  280. * the transport layer not to copy the command, but to map the existing
  281. * buffer (that is passed in) instead. This saves the memcpy and allows
  282. * commands that are bigger than the fixed buffer to be submitted.
  283. * Note that a TFD entry after a NOCOPY one cannot be a normal copied one.
  284. * @IWL_HCMD_DFL_DUP: Only valid without NOCOPY, duplicate the memory for this
  285. * chunk internally and free it again after the command completes. This
  286. * can (currently) be used only once per command.
  287. * Note that a TFD entry after a DUP one cannot be a normal copied one.
  288. */
  289. enum iwl_hcmd_dataflag {
  290. IWL_HCMD_DFL_NOCOPY = BIT(0),
  291. IWL_HCMD_DFL_DUP = BIT(1),
  292. };
  293. /**
  294. * struct iwl_host_cmd - Host command to the uCode
  295. *
  296. * @data: array of chunks that composes the data of the host command
  297. * @resp_pkt: response packet, if %CMD_WANT_SKB was set
  298. * @_rx_page_order: (internally used to free response packet)
  299. * @_rx_page_addr: (internally used to free response packet)
  300. * @flags: can be CMD_*
  301. * @len: array of the lengths of the chunks in data
  302. * @dataflags: IWL_HCMD_DFL_*
  303. * @id: command id of the host command, for wide commands encoding the
  304. * version and group as well
  305. */
  306. struct iwl_host_cmd {
  307. const void *data[IWL_MAX_CMD_TBS_PER_TFD];
  308. struct iwl_rx_packet *resp_pkt;
  309. unsigned long _rx_page_addr;
  310. u32 _rx_page_order;
  311. u32 flags;
  312. u32 id;
  313. u16 len[IWL_MAX_CMD_TBS_PER_TFD];
  314. u8 dataflags[IWL_MAX_CMD_TBS_PER_TFD];
  315. };
  316. static inline void iwl_free_resp(struct iwl_host_cmd *cmd)
  317. {
  318. free_pages(cmd->_rx_page_addr, cmd->_rx_page_order);
  319. }
  320. struct iwl_rx_cmd_buffer {
  321. struct page *_page;
  322. int _offset;
  323. bool _page_stolen;
  324. u32 _rx_page_order;
  325. unsigned int truesize;
  326. };
  327. static inline void *rxb_addr(struct iwl_rx_cmd_buffer *r)
  328. {
  329. return (void *)((unsigned long)page_address(r->_page) + r->_offset);
  330. }
  331. static inline int rxb_offset(struct iwl_rx_cmd_buffer *r)
  332. {
  333. return r->_offset;
  334. }
  335. static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r)
  336. {
  337. r->_page_stolen = true;
  338. get_page(r->_page);
  339. return r->_page;
  340. }
  341. static inline void iwl_free_rxb(struct iwl_rx_cmd_buffer *r)
  342. {
  343. __free_pages(r->_page, r->_rx_page_order);
  344. }
  345. #define MAX_NO_RECLAIM_CMDS 6
  346. #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
  347. /*
  348. * Maximum number of HW queues the transport layer
  349. * currently supports
  350. */
  351. #define IWL_MAX_HW_QUEUES 32
  352. #define IWL_MAX_TID_COUNT 8
  353. #define IWL_FRAME_LIMIT 64
  354. #define IWL_MAX_RX_HW_QUEUES 16
  355. /**
  356. * enum iwl_wowlan_status - WoWLAN image/device status
  357. * @IWL_D3_STATUS_ALIVE: firmware is still running after resume
  358. * @IWL_D3_STATUS_RESET: device was reset while suspended
  359. */
  360. enum iwl_d3_status {
  361. IWL_D3_STATUS_ALIVE,
  362. IWL_D3_STATUS_RESET,
  363. };
  364. /**
  365. * enum iwl_trans_status: transport status flags
  366. * @STATUS_SYNC_HCMD_ACTIVE: a SYNC command is being processed
  367. * @STATUS_DEVICE_ENABLED: APM is enabled
  368. * @STATUS_TPOWER_PMI: the device might be asleep (need to wake it up)
  369. * @STATUS_INT_ENABLED: interrupts are enabled
  370. * @STATUS_RFKILL: the HW RFkill switch is in KILL position
  371. * @STATUS_FW_ERROR: the fw is in error state
  372. * @STATUS_TRANS_GOING_IDLE: shutting down the trans, only special commands
  373. * are sent
  374. * @STATUS_TRANS_IDLE: the trans is idle - general commands are not to be sent
  375. * @STATUS_TRANS_DEAD: trans is dead - avoid any read/write operation
  376. */
  377. enum iwl_trans_status {
  378. STATUS_SYNC_HCMD_ACTIVE,
  379. STATUS_DEVICE_ENABLED,
  380. STATUS_TPOWER_PMI,
  381. STATUS_INT_ENABLED,
  382. STATUS_RFKILL,
  383. STATUS_FW_ERROR,
  384. STATUS_TRANS_GOING_IDLE,
  385. STATUS_TRANS_IDLE,
  386. STATUS_TRANS_DEAD,
  387. };
  388. /**
  389. * struct iwl_trans_config - transport configuration
  390. *
  391. * @op_mode: pointer to the upper layer.
  392. * @cmd_queue: the index of the command queue.
  393. * Must be set before start_fw.
  394. * @cmd_fifo: the fifo for host commands
  395. * @cmd_q_wdg_timeout: the timeout of the watchdog timer for the command queue.
  396. * @no_reclaim_cmds: Some devices erroneously don't set the
  397. * SEQ_RX_FRAME bit on some notifications, this is the
  398. * list of such notifications to filter. Max length is
  399. * %MAX_NO_RECLAIM_CMDS.
  400. * @n_no_reclaim_cmds: # of commands in list
  401. * @rx_buf_size_8k: 8 kB RX buffer size needed for A-MSDUs,
  402. * if unset 4k will be the RX buffer size
  403. * @bc_table_dword: set to true if the BC table expects the byte count to be
  404. * in DWORD (as opposed to bytes)
  405. * @scd_set_active: should the transport configure the SCD for HCMD queue
  406. * @wide_cmd_header: firmware supports wide host command header
  407. * @command_names: array of command names, must be 256 entries
  408. * (one for each command); for debugging only
  409. * @sdio_adma_addr: the default address to set for the ADMA in SDIO mode until
  410. * we get the ALIVE from the uCode
  411. */
  412. struct iwl_trans_config {
  413. struct iwl_op_mode *op_mode;
  414. u8 cmd_queue;
  415. u8 cmd_fifo;
  416. unsigned int cmd_q_wdg_timeout;
  417. const u8 *no_reclaim_cmds;
  418. unsigned int n_no_reclaim_cmds;
  419. bool rx_buf_size_8k;
  420. bool bc_table_dword;
  421. bool scd_set_active;
  422. bool wide_cmd_header;
  423. const char *const *command_names;
  424. u32 sdio_adma_addr;
  425. };
  426. struct iwl_trans_dump_data {
  427. u32 len;
  428. u8 data[];
  429. };
  430. struct iwl_trans;
  431. struct iwl_trans_txq_scd_cfg {
  432. u8 fifo;
  433. s8 sta_id;
  434. u8 tid;
  435. bool aggregate;
  436. int frame_limit;
  437. };
  438. /**
  439. * struct iwl_trans_ops - transport specific operations
  440. *
  441. * All the handlers MUST be implemented
  442. *
  443. * @start_hw: starts the HW. If low_power is true, the NIC needs to be taken
  444. * out of a low power state. From that point on, the HW can send
  445. * interrupts. May sleep.
  446. * @op_mode_leave: Turn off the HW RF kill indication if on
  447. * May sleep
  448. * @start_fw: allocates and inits all the resources for the transport
  449. * layer. Also kick a fw image.
  450. * May sleep
  451. * @fw_alive: called when the fw sends alive notification. If the fw provides
  452. * the SCD base address in SRAM, then provide it here, or 0 otherwise.
  453. * May sleep
  454. * @stop_device: stops the whole device (embedded CPU put to reset) and stops
  455. * the HW. If low_power is true, the NIC will be put in low power state.
  456. * From that point on, the HW will be stopped but will still issue an
  457. * interrupt if the HW RF kill switch is triggered.
  458. * This callback must do the right thing and not crash even if %start_hw()
  459. * was called but not &start_fw(). May sleep.
  460. * @d3_suspend: put the device into the correct mode for WoWLAN during
  461. * suspend. This is optional, if not implemented WoWLAN will not be
  462. * supported. This callback may sleep.
  463. * @d3_resume: resume the device after WoWLAN, enabling the opmode to
  464. * talk to the WoWLAN image to get its status. This is optional, if not
  465. * implemented WoWLAN will not be supported. This callback may sleep.
  466. * @send_cmd:send a host command. Must return -ERFKILL if RFkill is asserted.
  467. * If RFkill is asserted in the middle of a SYNC host command, it must
  468. * return -ERFKILL straight away.
  469. * May sleep only if CMD_ASYNC is not set
  470. * @tx: send an skb
  471. * Must be atomic
  472. * @reclaim: free packet until ssn. Returns a list of freed packets.
  473. * Must be atomic
  474. * @txq_enable: setup a queue. To setup an AC queue, use the
  475. * iwl_trans_ac_txq_enable wrapper. fw_alive must have been called before
  476. * this one. The op_mode must not configure the HCMD queue. The scheduler
  477. * configuration may be %NULL, in which case the hardware will not be
  478. * configured. May sleep.
  479. * @txq_disable: de-configure a Tx queue to send AMPDUs
  480. * Must be atomic
  481. * @wait_tx_queue_empty: wait until tx queues are empty. May sleep.
  482. * @freeze_txq_timer: prevents the timer of the queue from firing until the
  483. * queue is set to awake. Must be atomic.
  484. * @dbgfs_register: add the dbgfs files under this directory. Files will be
  485. * automatically deleted.
  486. * @write8: write a u8 to a register at offset ofs from the BAR
  487. * @write32: write a u32 to a register at offset ofs from the BAR
  488. * @read32: read a u32 register at offset ofs from the BAR
  489. * @read_prph: read a DWORD from a periphery register
  490. * @write_prph: write a DWORD to a periphery register
  491. * @read_mem: read device's SRAM in DWORD
  492. * @write_mem: write device's SRAM in DWORD. If %buf is %NULL, then the memory
  493. * will be zeroed.
  494. * @configure: configure parameters required by the transport layer from
  495. * the op_mode. May be called several times before start_fw, can't be
  496. * called after that.
  497. * @set_pmi: set the power pmi state
  498. * @grab_nic_access: wake the NIC to be able to access non-HBUS regs.
  499. * Sleeping is not allowed between grab_nic_access and
  500. * release_nic_access.
  501. * @release_nic_access: let the NIC go to sleep. The "flags" parameter
  502. * must be the same one that was sent before to the grab_nic_access.
  503. * @set_bits_mask - set SRAM register according to value and mask.
  504. * @ref: grab a reference to the transport/FW layers, disallowing
  505. * certain low power states
  506. * @unref: release a reference previously taken with @ref. Note that
  507. * initially the reference count is 1, making an initial @unref
  508. * necessary to allow low power states.
  509. * @dump_data: return a vmalloc'ed buffer with debug data, maybe containing last
  510. * TX'ed commands and similar. The buffer will be vfree'd by the caller.
  511. * Note that the transport must fill in the proper file headers.
  512. */
  513. struct iwl_trans_ops {
  514. int (*start_hw)(struct iwl_trans *iwl_trans, bool low_power);
  515. void (*op_mode_leave)(struct iwl_trans *iwl_trans);
  516. int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw,
  517. bool run_in_rfkill);
  518. int (*update_sf)(struct iwl_trans *trans,
  519. struct iwl_sf_region *st_fwrd_space);
  520. void (*fw_alive)(struct iwl_trans *trans, u32 scd_addr);
  521. void (*stop_device)(struct iwl_trans *trans, bool low_power);
  522. void (*d3_suspend)(struct iwl_trans *trans, bool test);
  523. int (*d3_resume)(struct iwl_trans *trans, enum iwl_d3_status *status,
  524. bool test);
  525. int (*send_cmd)(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
  526. int (*tx)(struct iwl_trans *trans, struct sk_buff *skb,
  527. struct iwl_device_cmd *dev_cmd, int queue);
  528. void (*reclaim)(struct iwl_trans *trans, int queue, int ssn,
  529. struct sk_buff_head *skbs);
  530. void (*txq_enable)(struct iwl_trans *trans, int queue, u16 ssn,
  531. const struct iwl_trans_txq_scd_cfg *cfg,
  532. unsigned int queue_wdg_timeout);
  533. void (*txq_disable)(struct iwl_trans *trans, int queue,
  534. bool configure_scd);
  535. int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir);
  536. int (*wait_tx_queue_empty)(struct iwl_trans *trans, u32 txq_bm);
  537. void (*freeze_txq_timer)(struct iwl_trans *trans, unsigned long txqs,
  538. bool freeze);
  539. void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val);
  540. void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val);
  541. u32 (*read32)(struct iwl_trans *trans, u32 ofs);
  542. u32 (*read_prph)(struct iwl_trans *trans, u32 ofs);
  543. void (*write_prph)(struct iwl_trans *trans, u32 ofs, u32 val);
  544. int (*read_mem)(struct iwl_trans *trans, u32 addr,
  545. void *buf, int dwords);
  546. int (*write_mem)(struct iwl_trans *trans, u32 addr,
  547. const void *buf, int dwords);
  548. void (*configure)(struct iwl_trans *trans,
  549. const struct iwl_trans_config *trans_cfg);
  550. void (*set_pmi)(struct iwl_trans *trans, bool state);
  551. bool (*grab_nic_access)(struct iwl_trans *trans, bool silent,
  552. unsigned long *flags);
  553. void (*release_nic_access)(struct iwl_trans *trans,
  554. unsigned long *flags);
  555. void (*set_bits_mask)(struct iwl_trans *trans, u32 reg, u32 mask,
  556. u32 value);
  557. void (*ref)(struct iwl_trans *trans);
  558. void (*unref)(struct iwl_trans *trans);
  559. int (*suspend)(struct iwl_trans *trans);
  560. void (*resume)(struct iwl_trans *trans);
  561. struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans,
  562. struct iwl_fw_dbg_trigger_tlv
  563. *trigger);
  564. };
  565. /**
  566. * enum iwl_trans_state - state of the transport layer
  567. *
  568. * @IWL_TRANS_NO_FW: no fw has sent an alive response
  569. * @IWL_TRANS_FW_ALIVE: a fw has sent an alive response
  570. */
  571. enum iwl_trans_state {
  572. IWL_TRANS_NO_FW = 0,
  573. IWL_TRANS_FW_ALIVE = 1,
  574. };
  575. /**
  576. * enum iwl_d0i3_mode - d0i3 mode
  577. *
  578. * @IWL_D0I3_MODE_OFF - d0i3 is disabled
  579. * @IWL_D0I3_MODE_ON_IDLE - enter d0i3 when device is idle
  580. * (e.g. no active references)
  581. * @IWL_D0I3_MODE_ON_SUSPEND - enter d0i3 only on suspend
  582. * (in case of 'any' trigger)
  583. */
  584. enum iwl_d0i3_mode {
  585. IWL_D0I3_MODE_OFF = 0,
  586. IWL_D0I3_MODE_ON_IDLE,
  587. IWL_D0I3_MODE_ON_SUSPEND,
  588. };
  589. /**
  590. * struct iwl_trans - transport common data
  591. *
  592. * @ops - pointer to iwl_trans_ops
  593. * @op_mode - pointer to the op_mode
  594. * @cfg - pointer to the configuration
  595. * @status: a bit-mask of transport status flags
  596. * @dev - pointer to struct device * that represents the device
  597. * @max_skb_frags: maximum number of fragments an SKB can have when transmitted.
  598. * 0 indicates that frag SKBs (NETIF_F_SG) aren't supported.
  599. * @hw_id: a u32 with the ID of the device / sub-device.
  600. * Set during transport allocation.
  601. * @hw_id_str: a string with info about HW ID. Set during transport allocation.
  602. * @pm_support: set to true in start_hw if link pm is supported
  603. * @ltr_enabled: set to true if the LTR is enabled
  604. * @num_rx_queues: number of RX queues allocated by the transport;
  605. * the transport must set this before calling iwl_drv_start()
  606. * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only.
  607. * The user should use iwl_trans_{alloc,free}_tx_cmd.
  608. * @dev_cmd_headroom: room needed for the transport's private use before the
  609. * device_cmd for Tx - for internal use only
  610. * The user should use iwl_trans_{alloc,free}_tx_cmd.
  611. * @rx_mpdu_cmd: MPDU RX command ID, must be assigned by opmode before
  612. * starting the firmware, used for tracing
  613. * @rx_mpdu_cmd_hdr_size: used for tracing, amount of data before the
  614. * start of the 802.11 header in the @rx_mpdu_cmd
  615. * @dflt_pwr_limit: default power limit fetched from the platform (ACPI)
  616. * @dbg_dest_tlv: points to the destination TLV for debug
  617. * @dbg_conf_tlv: array of pointers to configuration TLVs for debug
  618. * @dbg_trigger_tlv: array of pointers to triggers TLVs for debug
  619. * @dbg_dest_reg_num: num of reg_ops in %dbg_dest_tlv
  620. * @paging_req_addr: The location were the FW will upload / download the pages
  621. * from. The address is set by the opmode
  622. * @paging_db: Pointer to the opmode paging data base, the pointer is set by
  623. * the opmode.
  624. * @paging_download_buf: Buffer used for copying all of the pages before
  625. * downloading them to the FW. The buffer is allocated in the opmode
  626. */
  627. struct iwl_trans {
  628. const struct iwl_trans_ops *ops;
  629. struct iwl_op_mode *op_mode;
  630. const struct iwl_cfg *cfg;
  631. enum iwl_trans_state state;
  632. unsigned long status;
  633. struct device *dev;
  634. u32 max_skb_frags;
  635. u32 hw_rev;
  636. u32 hw_id;
  637. char hw_id_str[52];
  638. u8 rx_mpdu_cmd, rx_mpdu_cmd_hdr_size;
  639. bool pm_support;
  640. bool ltr_enabled;
  641. u8 num_rx_queues;
  642. /* The following fields are internal only */
  643. struct kmem_cache *dev_cmd_pool;
  644. size_t dev_cmd_headroom;
  645. char dev_cmd_pool_name[50];
  646. struct dentry *dbgfs_dir;
  647. #ifdef CONFIG_LOCKDEP
  648. struct lockdep_map sync_cmd_lockdep_map;
  649. #endif
  650. u64 dflt_pwr_limit;
  651. const struct iwl_fw_dbg_dest_tlv *dbg_dest_tlv;
  652. const struct iwl_fw_dbg_conf_tlv *dbg_conf_tlv[FW_DBG_CONF_MAX];
  653. struct iwl_fw_dbg_trigger_tlv * const *dbg_trigger_tlv;
  654. u8 dbg_dest_reg_num;
  655. /*
  656. * Paging parameters - All of the parameters should be set by the
  657. * opmode when paging is enabled
  658. */
  659. u32 paging_req_addr;
  660. struct iwl_fw_paging *paging_db;
  661. void *paging_download_buf;
  662. enum iwl_d0i3_mode d0i3_mode;
  663. bool wowlan_d0i3;
  664. /* pointer to trans specific struct */
  665. /*Ensure that this pointer will always be aligned to sizeof pointer */
  666. char trans_specific[0] __aligned(sizeof(void *));
  667. };
  668. static inline void iwl_trans_configure(struct iwl_trans *trans,
  669. const struct iwl_trans_config *trans_cfg)
  670. {
  671. trans->op_mode = trans_cfg->op_mode;
  672. trans->ops->configure(trans, trans_cfg);
  673. }
  674. static inline int _iwl_trans_start_hw(struct iwl_trans *trans, bool low_power)
  675. {
  676. might_sleep();
  677. return trans->ops->start_hw(trans, low_power);
  678. }
  679. static inline int iwl_trans_start_hw(struct iwl_trans *trans)
  680. {
  681. return trans->ops->start_hw(trans, true);
  682. }
  683. static inline void iwl_trans_op_mode_leave(struct iwl_trans *trans)
  684. {
  685. might_sleep();
  686. if (trans->ops->op_mode_leave)
  687. trans->ops->op_mode_leave(trans);
  688. trans->op_mode = NULL;
  689. trans->state = IWL_TRANS_NO_FW;
  690. }
  691. static inline void iwl_trans_fw_alive(struct iwl_trans *trans, u32 scd_addr)
  692. {
  693. might_sleep();
  694. trans->state = IWL_TRANS_FW_ALIVE;
  695. trans->ops->fw_alive(trans, scd_addr);
  696. }
  697. static inline int iwl_trans_start_fw(struct iwl_trans *trans,
  698. const struct fw_img *fw,
  699. bool run_in_rfkill)
  700. {
  701. might_sleep();
  702. WARN_ON_ONCE(!trans->rx_mpdu_cmd);
  703. clear_bit(STATUS_FW_ERROR, &trans->status);
  704. return trans->ops->start_fw(trans, fw, run_in_rfkill);
  705. }
  706. static inline int iwl_trans_update_sf(struct iwl_trans *trans,
  707. struct iwl_sf_region *st_fwrd_space)
  708. {
  709. might_sleep();
  710. if (trans->ops->update_sf)
  711. return trans->ops->update_sf(trans, st_fwrd_space);
  712. return 0;
  713. }
  714. static inline void _iwl_trans_stop_device(struct iwl_trans *trans,
  715. bool low_power)
  716. {
  717. might_sleep();
  718. trans->ops->stop_device(trans, low_power);
  719. trans->state = IWL_TRANS_NO_FW;
  720. }
  721. static inline void iwl_trans_stop_device(struct iwl_trans *trans)
  722. {
  723. _iwl_trans_stop_device(trans, true);
  724. }
  725. static inline void iwl_trans_d3_suspend(struct iwl_trans *trans, bool test)
  726. {
  727. might_sleep();
  728. if (trans->ops->d3_suspend)
  729. trans->ops->d3_suspend(trans, test);
  730. }
  731. static inline int iwl_trans_d3_resume(struct iwl_trans *trans,
  732. enum iwl_d3_status *status,
  733. bool test)
  734. {
  735. might_sleep();
  736. if (!trans->ops->d3_resume)
  737. return 0;
  738. return trans->ops->d3_resume(trans, status, test);
  739. }
  740. static inline void iwl_trans_ref(struct iwl_trans *trans)
  741. {
  742. if (trans->ops->ref)
  743. trans->ops->ref(trans);
  744. }
  745. static inline void iwl_trans_unref(struct iwl_trans *trans)
  746. {
  747. if (trans->ops->unref)
  748. trans->ops->unref(trans);
  749. }
  750. static inline int iwl_trans_suspend(struct iwl_trans *trans)
  751. {
  752. if (!trans->ops->suspend)
  753. return 0;
  754. return trans->ops->suspend(trans);
  755. }
  756. static inline void iwl_trans_resume(struct iwl_trans *trans)
  757. {
  758. if (trans->ops->resume)
  759. trans->ops->resume(trans);
  760. }
  761. static inline struct iwl_trans_dump_data *
  762. iwl_trans_dump_data(struct iwl_trans *trans,
  763. struct iwl_fw_dbg_trigger_tlv *trigger)
  764. {
  765. if (!trans->ops->dump_data)
  766. return NULL;
  767. return trans->ops->dump_data(trans, trigger);
  768. }
  769. static inline int iwl_trans_send_cmd(struct iwl_trans *trans,
  770. struct iwl_host_cmd *cmd)
  771. {
  772. int ret;
  773. if (unlikely(!(cmd->flags & CMD_SEND_IN_RFKILL) &&
  774. test_bit(STATUS_RFKILL, &trans->status)))
  775. return -ERFKILL;
  776. if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status)))
  777. return -EIO;
  778. if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) {
  779. IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
  780. return -EIO;
  781. }
  782. if (!(cmd->flags & CMD_ASYNC))
  783. lock_map_acquire_read(&trans->sync_cmd_lockdep_map);
  784. ret = trans->ops->send_cmd(trans, cmd);
  785. if (!(cmd->flags & CMD_ASYNC))
  786. lock_map_release(&trans->sync_cmd_lockdep_map);
  787. return ret;
  788. }
  789. static inline struct iwl_device_cmd *
  790. iwl_trans_alloc_tx_cmd(struct iwl_trans *trans)
  791. {
  792. u8 *dev_cmd_ptr = kmem_cache_alloc(trans->dev_cmd_pool, GFP_ATOMIC);
  793. if (unlikely(dev_cmd_ptr == NULL))
  794. return NULL;
  795. return (struct iwl_device_cmd *)
  796. (dev_cmd_ptr + trans->dev_cmd_headroom);
  797. }
  798. static inline void iwl_trans_free_tx_cmd(struct iwl_trans *trans,
  799. struct iwl_device_cmd *dev_cmd)
  800. {
  801. u8 *dev_cmd_ptr = (u8 *)dev_cmd - trans->dev_cmd_headroom;
  802. kmem_cache_free(trans->dev_cmd_pool, dev_cmd_ptr);
  803. }
  804. static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
  805. struct iwl_device_cmd *dev_cmd, int queue)
  806. {
  807. if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status)))
  808. return -EIO;
  809. if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
  810. IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
  811. return trans->ops->tx(trans, skb, dev_cmd, queue);
  812. }
  813. static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue,
  814. int ssn, struct sk_buff_head *skbs)
  815. {
  816. if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
  817. IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
  818. trans->ops->reclaim(trans, queue, ssn, skbs);
  819. }
  820. static inline void iwl_trans_txq_disable(struct iwl_trans *trans, int queue,
  821. bool configure_scd)
  822. {
  823. trans->ops->txq_disable(trans, queue, configure_scd);
  824. }
  825. static inline void
  826. iwl_trans_txq_enable_cfg(struct iwl_trans *trans, int queue, u16 ssn,
  827. const struct iwl_trans_txq_scd_cfg *cfg,
  828. unsigned int queue_wdg_timeout)
  829. {
  830. might_sleep();
  831. if (unlikely((trans->state != IWL_TRANS_FW_ALIVE)))
  832. IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
  833. trans->ops->txq_enable(trans, queue, ssn, cfg, queue_wdg_timeout);
  834. }
  835. static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue,
  836. int fifo, int sta_id, int tid,
  837. int frame_limit, u16 ssn,
  838. unsigned int queue_wdg_timeout)
  839. {
  840. struct iwl_trans_txq_scd_cfg cfg = {
  841. .fifo = fifo,
  842. .sta_id = sta_id,
  843. .tid = tid,
  844. .frame_limit = frame_limit,
  845. .aggregate = sta_id >= 0,
  846. };
  847. iwl_trans_txq_enable_cfg(trans, queue, ssn, &cfg, queue_wdg_timeout);
  848. }
  849. static inline
  850. void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue, int fifo,
  851. unsigned int queue_wdg_timeout)
  852. {
  853. struct iwl_trans_txq_scd_cfg cfg = {
  854. .fifo = fifo,
  855. .sta_id = -1,
  856. .tid = IWL_MAX_TID_COUNT,
  857. .frame_limit = IWL_FRAME_LIMIT,
  858. .aggregate = false,
  859. };
  860. iwl_trans_txq_enable_cfg(trans, queue, 0, &cfg, queue_wdg_timeout);
  861. }
  862. static inline void iwl_trans_freeze_txq_timer(struct iwl_trans *trans,
  863. unsigned long txqs,
  864. bool freeze)
  865. {
  866. if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
  867. IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
  868. if (trans->ops->freeze_txq_timer)
  869. trans->ops->freeze_txq_timer(trans, txqs, freeze);
  870. }
  871. static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans,
  872. u32 txqs)
  873. {
  874. if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
  875. IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
  876. return trans->ops->wait_tx_queue_empty(trans, txqs);
  877. }
  878. static inline int iwl_trans_dbgfs_register(struct iwl_trans *trans,
  879. struct dentry *dir)
  880. {
  881. return trans->ops->dbgfs_register(trans, dir);
  882. }
  883. static inline void iwl_trans_write8(struct iwl_trans *trans, u32 ofs, u8 val)
  884. {
  885. trans->ops->write8(trans, ofs, val);
  886. }
  887. static inline void iwl_trans_write32(struct iwl_trans *trans, u32 ofs, u32 val)
  888. {
  889. trans->ops->write32(trans, ofs, val);
  890. }
  891. static inline u32 iwl_trans_read32(struct iwl_trans *trans, u32 ofs)
  892. {
  893. return trans->ops->read32(trans, ofs);
  894. }
  895. static inline u32 iwl_trans_read_prph(struct iwl_trans *trans, u32 ofs)
  896. {
  897. return trans->ops->read_prph(trans, ofs);
  898. }
  899. static inline void iwl_trans_write_prph(struct iwl_trans *trans, u32 ofs,
  900. u32 val)
  901. {
  902. return trans->ops->write_prph(trans, ofs, val);
  903. }
  904. static inline int iwl_trans_read_mem(struct iwl_trans *trans, u32 addr,
  905. void *buf, int dwords)
  906. {
  907. return trans->ops->read_mem(trans, addr, buf, dwords);
  908. }
  909. #define iwl_trans_read_mem_bytes(trans, addr, buf, bufsize) \
  910. do { \
  911. if (__builtin_constant_p(bufsize)) \
  912. BUILD_BUG_ON((bufsize) % sizeof(u32)); \
  913. iwl_trans_read_mem(trans, addr, buf, (bufsize) / sizeof(u32));\
  914. } while (0)
  915. static inline u32 iwl_trans_read_mem32(struct iwl_trans *trans, u32 addr)
  916. {
  917. u32 value;
  918. if (WARN_ON(iwl_trans_read_mem(trans, addr, &value, 1)))
  919. return 0xa5a5a5a5;
  920. return value;
  921. }
  922. static inline int iwl_trans_write_mem(struct iwl_trans *trans, u32 addr,
  923. const void *buf, int dwords)
  924. {
  925. return trans->ops->write_mem(trans, addr, buf, dwords);
  926. }
  927. static inline u32 iwl_trans_write_mem32(struct iwl_trans *trans, u32 addr,
  928. u32 val)
  929. {
  930. return iwl_trans_write_mem(trans, addr, &val, 1);
  931. }
  932. static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state)
  933. {
  934. if (trans->ops->set_pmi)
  935. trans->ops->set_pmi(trans, state);
  936. }
  937. static inline void
  938. iwl_trans_set_bits_mask(struct iwl_trans *trans, u32 reg, u32 mask, u32 value)
  939. {
  940. trans->ops->set_bits_mask(trans, reg, mask, value);
  941. }
  942. #define iwl_trans_grab_nic_access(trans, silent, flags) \
  943. __cond_lock(nic_access, \
  944. likely((trans)->ops->grab_nic_access(trans, silent, flags)))
  945. static inline void __releases(nic_access)
  946. iwl_trans_release_nic_access(struct iwl_trans *trans, unsigned long *flags)
  947. {
  948. trans->ops->release_nic_access(trans, flags);
  949. __release(nic_access);
  950. }
  951. static inline void iwl_trans_fw_error(struct iwl_trans *trans)
  952. {
  953. if (WARN_ON_ONCE(!trans->op_mode))
  954. return;
  955. /* prevent double restarts due to the same erroneous FW */
  956. if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status))
  957. iwl_op_mode_nic_error(trans->op_mode);
  958. }
  959. /*****************************************************
  960. * transport helper functions
  961. *****************************************************/
  962. struct iwl_trans *iwl_trans_alloc(unsigned int priv_size,
  963. struct device *dev,
  964. const struct iwl_cfg *cfg,
  965. const struct iwl_trans_ops *ops,
  966. size_t dev_cmd_headroom);
  967. void iwl_trans_free(struct iwl_trans *trans);
  968. /*****************************************************
  969. * driver (transport) register/unregister functions
  970. ******************************************************/
  971. int __must_check iwl_pci_register_driver(void);
  972. void iwl_pci_unregister_driver(void);
  973. #endif /* __iwl_trans_h__ */