fw.c 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088
  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) 2012 - 2014 Intel Corporation. All rights reserved.
  9. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  10. * Copyright(c) 2016 Intel Deutschland GmbH
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of version 2 of the GNU General Public License as
  14. * published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful, but
  17. * WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  24. * USA
  25. *
  26. * The full GNU General Public License is included in this distribution
  27. * in the file called COPYING.
  28. *
  29. * Contact Information:
  30. * Intel Linux Wireless <linuxwifi@intel.com>
  31. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  32. *
  33. * BSD LICENSE
  34. *
  35. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  36. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  37. * All rights reserved.
  38. *
  39. * Redistribution and use in source and binary forms, with or without
  40. * modification, are permitted provided that the following conditions
  41. * are met:
  42. *
  43. * * Redistributions of source code must retain the above copyright
  44. * notice, this list of conditions and the following disclaimer.
  45. * * Redistributions in binary form must reproduce the above copyright
  46. * notice, this list of conditions and the following disclaimer in
  47. * the documentation and/or other materials provided with the
  48. * distribution.
  49. * * Neither the name Intel Corporation nor the names of its
  50. * contributors may be used to endorse or promote products derived
  51. * from this software without specific prior written permission.
  52. *
  53. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  54. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  55. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  56. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  57. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  58. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  59. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  60. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  61. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  62. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  63. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  64. *
  65. *****************************************************************************/
  66. #include <net/mac80211.h>
  67. #include "iwl-trans.h"
  68. #include "iwl-op-mode.h"
  69. #include "iwl-fw.h"
  70. #include "iwl-debug.h"
  71. #include "iwl-csr.h" /* for iwl_mvm_rx_card_state_notif */
  72. #include "iwl-io.h" /* for iwl_mvm_rx_card_state_notif */
  73. #include "iwl-prph.h"
  74. #include "iwl-eeprom-parse.h"
  75. #include "mvm.h"
  76. #include "fw-dbg.h"
  77. #include "iwl-phy-db.h"
  78. #define MVM_UCODE_ALIVE_TIMEOUT HZ
  79. #define MVM_UCODE_CALIB_TIMEOUT (2*HZ)
  80. #define UCODE_VALID_OK cpu_to_le32(0x1)
  81. struct iwl_mvm_alive_data {
  82. bool valid;
  83. u32 scd_base_addr;
  84. };
  85. static inline const struct fw_img *
  86. iwl_get_ucode_image(struct iwl_mvm *mvm, enum iwl_ucode_type ucode_type)
  87. {
  88. if (ucode_type >= IWL_UCODE_TYPE_MAX)
  89. return NULL;
  90. return &mvm->fw->img[ucode_type];
  91. }
  92. static int iwl_send_tx_ant_cfg(struct iwl_mvm *mvm, u8 valid_tx_ant)
  93. {
  94. struct iwl_tx_ant_cfg_cmd tx_ant_cmd = {
  95. .valid = cpu_to_le32(valid_tx_ant),
  96. };
  97. IWL_DEBUG_FW(mvm, "select valid tx ant: %u\n", valid_tx_ant);
  98. return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, 0,
  99. sizeof(tx_ant_cmd), &tx_ant_cmd);
  100. }
  101. static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm)
  102. {
  103. int i;
  104. struct iwl_rss_config_cmd cmd = {
  105. .flags = cpu_to_le32(IWL_RSS_ENABLE),
  106. .hash_mask = IWL_RSS_HASH_TYPE_IPV4_TCP |
  107. IWL_RSS_HASH_TYPE_IPV4_PAYLOAD |
  108. IWL_RSS_HASH_TYPE_IPV6_TCP |
  109. IWL_RSS_HASH_TYPE_IPV6_PAYLOAD,
  110. };
  111. for (i = 0; i < ARRAY_SIZE(cmd.indirection_table); i++)
  112. cmd.indirection_table[i] = i % mvm->trans->num_rx_queues;
  113. memcpy(cmd.secret_key, mvm->secret_key, sizeof(cmd.secret_key));
  114. return iwl_mvm_send_cmd_pdu(mvm, RSS_CONFIG_CMD, 0, sizeof(cmd), &cmd);
  115. }
  116. void iwl_free_fw_paging(struct iwl_mvm *mvm)
  117. {
  118. int i;
  119. if (!mvm->fw_paging_db[0].fw_paging_block)
  120. return;
  121. for (i = 0; i < NUM_OF_FW_PAGING_BLOCKS; i++) {
  122. if (!mvm->fw_paging_db[i].fw_paging_block) {
  123. IWL_DEBUG_FW(mvm,
  124. "Paging: block %d already freed, continue to next page\n",
  125. i);
  126. continue;
  127. }
  128. __free_pages(mvm->fw_paging_db[i].fw_paging_block,
  129. get_order(mvm->fw_paging_db[i].fw_paging_size));
  130. }
  131. kfree(mvm->trans->paging_download_buf);
  132. mvm->trans->paging_download_buf = NULL;
  133. memset(mvm->fw_paging_db, 0, sizeof(mvm->fw_paging_db));
  134. }
  135. static int iwl_fill_paging_mem(struct iwl_mvm *mvm, const struct fw_img *image)
  136. {
  137. int sec_idx, idx;
  138. u32 offset = 0;
  139. /*
  140. * find where is the paging image start point:
  141. * if CPU2 exist and it's in paging format, then the image looks like:
  142. * CPU1 sections (2 or more)
  143. * CPU1_CPU2_SEPARATOR_SECTION delimiter - separate between CPU1 to CPU2
  144. * CPU2 sections (not paged)
  145. * PAGING_SEPARATOR_SECTION delimiter - separate between CPU2
  146. * non paged to CPU2 paging sec
  147. * CPU2 paging CSS
  148. * CPU2 paging image (including instruction and data)
  149. */
  150. for (sec_idx = 0; sec_idx < IWL_UCODE_SECTION_MAX; sec_idx++) {
  151. if (image->sec[sec_idx].offset == PAGING_SEPARATOR_SECTION) {
  152. sec_idx++;
  153. break;
  154. }
  155. }
  156. if (sec_idx >= IWL_UCODE_SECTION_MAX) {
  157. IWL_ERR(mvm, "driver didn't find paging image\n");
  158. iwl_free_fw_paging(mvm);
  159. return -EINVAL;
  160. }
  161. /* copy the CSS block to the dram */
  162. IWL_DEBUG_FW(mvm, "Paging: load paging CSS to FW, sec = %d\n",
  163. sec_idx);
  164. memcpy(page_address(mvm->fw_paging_db[0].fw_paging_block),
  165. image->sec[sec_idx].data,
  166. mvm->fw_paging_db[0].fw_paging_size);
  167. IWL_DEBUG_FW(mvm,
  168. "Paging: copied %d CSS bytes to first block\n",
  169. mvm->fw_paging_db[0].fw_paging_size);
  170. sec_idx++;
  171. /*
  172. * copy the paging blocks to the dram
  173. * loop index start from 1 since that CSS block already copied to dram
  174. * and CSS index is 0.
  175. * loop stop at num_of_paging_blk since that last block is not full.
  176. */
  177. for (idx = 1; idx < mvm->num_of_paging_blk; idx++) {
  178. memcpy(page_address(mvm->fw_paging_db[idx].fw_paging_block),
  179. image->sec[sec_idx].data + offset,
  180. mvm->fw_paging_db[idx].fw_paging_size);
  181. IWL_DEBUG_FW(mvm,
  182. "Paging: copied %d paging bytes to block %d\n",
  183. mvm->fw_paging_db[idx].fw_paging_size,
  184. idx);
  185. offset += mvm->fw_paging_db[idx].fw_paging_size;
  186. }
  187. /* copy the last paging block */
  188. if (mvm->num_of_pages_in_last_blk > 0) {
  189. memcpy(page_address(mvm->fw_paging_db[idx].fw_paging_block),
  190. image->sec[sec_idx].data + offset,
  191. FW_PAGING_SIZE * mvm->num_of_pages_in_last_blk);
  192. IWL_DEBUG_FW(mvm,
  193. "Paging: copied %d pages in the last block %d\n",
  194. mvm->num_of_pages_in_last_blk, idx);
  195. }
  196. return 0;
  197. }
  198. static int iwl_alloc_fw_paging_mem(struct iwl_mvm *mvm,
  199. const struct fw_img *image)
  200. {
  201. struct page *block;
  202. dma_addr_t phys = 0;
  203. int blk_idx = 0;
  204. int order, num_of_pages;
  205. int dma_enabled;
  206. if (mvm->fw_paging_db[0].fw_paging_block)
  207. return 0;
  208. dma_enabled = is_device_dma_capable(mvm->trans->dev);
  209. /* ensure BLOCK_2_EXP_SIZE is power of 2 of PAGING_BLOCK_SIZE */
  210. BUILD_BUG_ON(BIT(BLOCK_2_EXP_SIZE) != PAGING_BLOCK_SIZE);
  211. num_of_pages = image->paging_mem_size / FW_PAGING_SIZE;
  212. mvm->num_of_paging_blk = ((num_of_pages - 1) /
  213. NUM_OF_PAGE_PER_GROUP) + 1;
  214. mvm->num_of_pages_in_last_blk =
  215. num_of_pages -
  216. NUM_OF_PAGE_PER_GROUP * (mvm->num_of_paging_blk - 1);
  217. IWL_DEBUG_FW(mvm,
  218. "Paging: allocating mem for %d paging blocks, each block holds 8 pages, last block holds %d pages\n",
  219. mvm->num_of_paging_blk,
  220. mvm->num_of_pages_in_last_blk);
  221. /* allocate block of 4Kbytes for paging CSS */
  222. order = get_order(FW_PAGING_SIZE);
  223. block = alloc_pages(GFP_KERNEL, order);
  224. if (!block) {
  225. /* free all the previous pages since we failed */
  226. iwl_free_fw_paging(mvm);
  227. return -ENOMEM;
  228. }
  229. mvm->fw_paging_db[blk_idx].fw_paging_block = block;
  230. mvm->fw_paging_db[blk_idx].fw_paging_size = FW_PAGING_SIZE;
  231. if (dma_enabled) {
  232. phys = dma_map_page(mvm->trans->dev, block, 0,
  233. PAGE_SIZE << order, DMA_BIDIRECTIONAL);
  234. if (dma_mapping_error(mvm->trans->dev, phys)) {
  235. /*
  236. * free the previous pages and the current one since
  237. * we failed to map_page.
  238. */
  239. iwl_free_fw_paging(mvm);
  240. return -ENOMEM;
  241. }
  242. mvm->fw_paging_db[blk_idx].fw_paging_phys = phys;
  243. } else {
  244. mvm->fw_paging_db[blk_idx].fw_paging_phys = PAGING_ADDR_SIG |
  245. blk_idx << BLOCK_2_EXP_SIZE;
  246. }
  247. IWL_DEBUG_FW(mvm,
  248. "Paging: allocated 4K(CSS) bytes (order %d) for firmware paging.\n",
  249. order);
  250. /*
  251. * allocate blocks in dram.
  252. * since that CSS allocated in fw_paging_db[0] loop start from index 1
  253. */
  254. for (blk_idx = 1; blk_idx < mvm->num_of_paging_blk + 1; blk_idx++) {
  255. /* allocate block of PAGING_BLOCK_SIZE (32K) */
  256. order = get_order(PAGING_BLOCK_SIZE);
  257. block = alloc_pages(GFP_KERNEL, order);
  258. if (!block) {
  259. /* free all the previous pages since we failed */
  260. iwl_free_fw_paging(mvm);
  261. return -ENOMEM;
  262. }
  263. mvm->fw_paging_db[blk_idx].fw_paging_block = block;
  264. mvm->fw_paging_db[blk_idx].fw_paging_size = PAGING_BLOCK_SIZE;
  265. if (dma_enabled) {
  266. phys = dma_map_page(mvm->trans->dev, block, 0,
  267. PAGE_SIZE << order,
  268. DMA_BIDIRECTIONAL);
  269. if (dma_mapping_error(mvm->trans->dev, phys)) {
  270. /*
  271. * free the previous pages and the current one
  272. * since we failed to map_page.
  273. */
  274. iwl_free_fw_paging(mvm);
  275. return -ENOMEM;
  276. }
  277. mvm->fw_paging_db[blk_idx].fw_paging_phys = phys;
  278. } else {
  279. mvm->fw_paging_db[blk_idx].fw_paging_phys =
  280. PAGING_ADDR_SIG |
  281. blk_idx << BLOCK_2_EXP_SIZE;
  282. }
  283. IWL_DEBUG_FW(mvm,
  284. "Paging: allocated 32K bytes (order %d) for firmware paging.\n",
  285. order);
  286. }
  287. return 0;
  288. }
  289. static int iwl_save_fw_paging(struct iwl_mvm *mvm,
  290. const struct fw_img *fw)
  291. {
  292. int ret;
  293. ret = iwl_alloc_fw_paging_mem(mvm, fw);
  294. if (ret)
  295. return ret;
  296. return iwl_fill_paging_mem(mvm, fw);
  297. }
  298. /* send paging cmd to FW in case CPU2 has paging image */
  299. static int iwl_send_paging_cmd(struct iwl_mvm *mvm, const struct fw_img *fw)
  300. {
  301. int blk_idx;
  302. __le32 dev_phy_addr;
  303. struct iwl_fw_paging_cmd fw_paging_cmd = {
  304. .flags =
  305. cpu_to_le32(PAGING_CMD_IS_SECURED |
  306. PAGING_CMD_IS_ENABLED |
  307. (mvm->num_of_pages_in_last_blk <<
  308. PAGING_CMD_NUM_OF_PAGES_IN_LAST_GRP_POS)),
  309. .block_size = cpu_to_le32(BLOCK_2_EXP_SIZE),
  310. .block_num = cpu_to_le32(mvm->num_of_paging_blk),
  311. };
  312. /* loop for for all paging blocks + CSS block */
  313. for (blk_idx = 0; blk_idx < mvm->num_of_paging_blk + 1; blk_idx++) {
  314. dev_phy_addr =
  315. cpu_to_le32(mvm->fw_paging_db[blk_idx].fw_paging_phys >>
  316. PAGE_2_EXP_SIZE);
  317. fw_paging_cmd.device_phy_addr[blk_idx] = dev_phy_addr;
  318. }
  319. return iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(FW_PAGING_BLOCK_CMD,
  320. IWL_ALWAYS_LONG_GROUP, 0),
  321. 0, sizeof(fw_paging_cmd), &fw_paging_cmd);
  322. }
  323. /*
  324. * Send paging item cmd to FW in case CPU2 has paging image
  325. */
  326. static int iwl_trans_get_paging_item(struct iwl_mvm *mvm)
  327. {
  328. int ret;
  329. struct iwl_fw_get_item_cmd fw_get_item_cmd = {
  330. .item_id = cpu_to_le32(IWL_FW_ITEM_ID_PAGING),
  331. };
  332. struct iwl_fw_get_item_resp *item_resp;
  333. struct iwl_host_cmd cmd = {
  334. .id = iwl_cmd_id(FW_GET_ITEM_CMD, IWL_ALWAYS_LONG_GROUP, 0),
  335. .flags = CMD_WANT_SKB | CMD_SEND_IN_RFKILL,
  336. .data = { &fw_get_item_cmd, },
  337. };
  338. cmd.len[0] = sizeof(struct iwl_fw_get_item_cmd);
  339. ret = iwl_mvm_send_cmd(mvm, &cmd);
  340. if (ret) {
  341. IWL_ERR(mvm,
  342. "Paging: Failed to send FW_GET_ITEM_CMD cmd (err = %d)\n",
  343. ret);
  344. return ret;
  345. }
  346. item_resp = (void *)((struct iwl_rx_packet *)cmd.resp_pkt)->data;
  347. if (item_resp->item_id != cpu_to_le32(IWL_FW_ITEM_ID_PAGING)) {
  348. IWL_ERR(mvm,
  349. "Paging: got wrong item in FW_GET_ITEM_CMD resp (item_id = %u)\n",
  350. le32_to_cpu(item_resp->item_id));
  351. ret = -EIO;
  352. goto exit;
  353. }
  354. mvm->trans->paging_download_buf = kzalloc(MAX_PAGING_IMAGE_SIZE,
  355. GFP_KERNEL);
  356. if (!mvm->trans->paging_download_buf) {
  357. ret = -ENOMEM;
  358. goto exit;
  359. }
  360. mvm->trans->paging_req_addr = le32_to_cpu(item_resp->item_val);
  361. mvm->trans->paging_db = mvm->fw_paging_db;
  362. IWL_DEBUG_FW(mvm,
  363. "Paging: got paging request address (paging_req_addr 0x%08x)\n",
  364. mvm->trans->paging_req_addr);
  365. exit:
  366. iwl_free_resp(&cmd);
  367. return ret;
  368. }
  369. static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait,
  370. struct iwl_rx_packet *pkt, void *data)
  371. {
  372. struct iwl_mvm *mvm =
  373. container_of(notif_wait, struct iwl_mvm, notif_wait);
  374. struct iwl_mvm_alive_data *alive_data = data;
  375. struct mvm_alive_resp_ver1 *palive1;
  376. struct mvm_alive_resp_ver2 *palive2;
  377. struct mvm_alive_resp *palive;
  378. if (iwl_rx_packet_payload_len(pkt) == sizeof(*palive1)) {
  379. palive1 = (void *)pkt->data;
  380. mvm->support_umac_log = false;
  381. mvm->error_event_table =
  382. le32_to_cpu(palive1->error_event_table_ptr);
  383. mvm->log_event_table =
  384. le32_to_cpu(palive1->log_event_table_ptr);
  385. alive_data->scd_base_addr = le32_to_cpu(palive1->scd_base_ptr);
  386. alive_data->valid = le16_to_cpu(palive1->status) ==
  387. IWL_ALIVE_STATUS_OK;
  388. IWL_DEBUG_FW(mvm,
  389. "Alive VER1 ucode status 0x%04x revision 0x%01X 0x%01X flags 0x%01X\n",
  390. le16_to_cpu(palive1->status), palive1->ver_type,
  391. palive1->ver_subtype, palive1->flags);
  392. } else if (iwl_rx_packet_payload_len(pkt) == sizeof(*palive2)) {
  393. palive2 = (void *)pkt->data;
  394. mvm->error_event_table =
  395. le32_to_cpu(palive2->error_event_table_ptr);
  396. mvm->log_event_table =
  397. le32_to_cpu(palive2->log_event_table_ptr);
  398. alive_data->scd_base_addr = le32_to_cpu(palive2->scd_base_ptr);
  399. mvm->umac_error_event_table =
  400. le32_to_cpu(palive2->error_info_addr);
  401. mvm->sf_space.addr = le32_to_cpu(palive2->st_fwrd_addr);
  402. mvm->sf_space.size = le32_to_cpu(palive2->st_fwrd_size);
  403. alive_data->valid = le16_to_cpu(palive2->status) ==
  404. IWL_ALIVE_STATUS_OK;
  405. if (mvm->umac_error_event_table)
  406. mvm->support_umac_log = true;
  407. IWL_DEBUG_FW(mvm,
  408. "Alive VER2 ucode status 0x%04x revision 0x%01X 0x%01X flags 0x%01X\n",
  409. le16_to_cpu(palive2->status), palive2->ver_type,
  410. palive2->ver_subtype, palive2->flags);
  411. IWL_DEBUG_FW(mvm,
  412. "UMAC version: Major - 0x%x, Minor - 0x%x\n",
  413. palive2->umac_major, palive2->umac_minor);
  414. } else if (iwl_rx_packet_payload_len(pkt) == sizeof(*palive)) {
  415. palive = (void *)pkt->data;
  416. mvm->error_event_table =
  417. le32_to_cpu(palive->error_event_table_ptr);
  418. mvm->log_event_table =
  419. le32_to_cpu(palive->log_event_table_ptr);
  420. alive_data->scd_base_addr = le32_to_cpu(palive->scd_base_ptr);
  421. mvm->umac_error_event_table =
  422. le32_to_cpu(palive->error_info_addr);
  423. mvm->sf_space.addr = le32_to_cpu(palive->st_fwrd_addr);
  424. mvm->sf_space.size = le32_to_cpu(palive->st_fwrd_size);
  425. alive_data->valid = le16_to_cpu(palive->status) ==
  426. IWL_ALIVE_STATUS_OK;
  427. if (mvm->umac_error_event_table)
  428. mvm->support_umac_log = true;
  429. IWL_DEBUG_FW(mvm,
  430. "Alive VER3 ucode status 0x%04x revision 0x%01X 0x%01X flags 0x%01X\n",
  431. le16_to_cpu(palive->status), palive->ver_type,
  432. palive->ver_subtype, palive->flags);
  433. IWL_DEBUG_FW(mvm,
  434. "UMAC version: Major - 0x%x, Minor - 0x%x\n",
  435. le32_to_cpu(palive->umac_major),
  436. le32_to_cpu(palive->umac_minor));
  437. }
  438. return true;
  439. }
  440. static bool iwl_wait_phy_db_entry(struct iwl_notif_wait_data *notif_wait,
  441. struct iwl_rx_packet *pkt, void *data)
  442. {
  443. struct iwl_phy_db *phy_db = data;
  444. if (pkt->hdr.cmd != CALIB_RES_NOTIF_PHY_DB) {
  445. WARN_ON(pkt->hdr.cmd != INIT_COMPLETE_NOTIF);
  446. return true;
  447. }
  448. WARN_ON(iwl_phy_db_set_section(phy_db, pkt, GFP_ATOMIC));
  449. return false;
  450. }
  451. static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
  452. enum iwl_ucode_type ucode_type)
  453. {
  454. struct iwl_notification_wait alive_wait;
  455. struct iwl_mvm_alive_data alive_data;
  456. const struct fw_img *fw;
  457. int ret, i;
  458. enum iwl_ucode_type old_type = mvm->cur_ucode;
  459. static const u16 alive_cmd[] = { MVM_ALIVE };
  460. struct iwl_sf_region st_fwrd_space;
  461. if (ucode_type == IWL_UCODE_REGULAR &&
  462. iwl_fw_dbg_conf_usniffer(mvm->fw, FW_DBG_START_FROM_ALIVE) &&
  463. !(fw_has_capa(&mvm->fw->ucode_capa,
  464. IWL_UCODE_TLV_CAPA_USNIFFER_UNIFIED)))
  465. fw = iwl_get_ucode_image(mvm, IWL_UCODE_REGULAR_USNIFFER);
  466. else
  467. fw = iwl_get_ucode_image(mvm, ucode_type);
  468. if (WARN_ON(!fw))
  469. return -EINVAL;
  470. mvm->cur_ucode = ucode_type;
  471. mvm->ucode_loaded = false;
  472. iwl_init_notification_wait(&mvm->notif_wait, &alive_wait,
  473. alive_cmd, ARRAY_SIZE(alive_cmd),
  474. iwl_alive_fn, &alive_data);
  475. ret = iwl_trans_start_fw(mvm->trans, fw, ucode_type == IWL_UCODE_INIT);
  476. if (ret) {
  477. mvm->cur_ucode = old_type;
  478. iwl_remove_notification(&mvm->notif_wait, &alive_wait);
  479. return ret;
  480. }
  481. /*
  482. * Some things may run in the background now, but we
  483. * just wait for the ALIVE notification here.
  484. */
  485. ret = iwl_wait_notification(&mvm->notif_wait, &alive_wait,
  486. MVM_UCODE_ALIVE_TIMEOUT);
  487. if (ret) {
  488. if (mvm->trans->cfg->device_family == IWL_DEVICE_FAMILY_8000)
  489. IWL_ERR(mvm,
  490. "SecBoot CPU1 Status: 0x%x, CPU2 Status: 0x%x\n",
  491. iwl_read_prph(mvm->trans, SB_CPU_1_STATUS),
  492. iwl_read_prph(mvm->trans, SB_CPU_2_STATUS));
  493. mvm->cur_ucode = old_type;
  494. return ret;
  495. }
  496. if (!alive_data.valid) {
  497. IWL_ERR(mvm, "Loaded ucode is not valid!\n");
  498. mvm->cur_ucode = old_type;
  499. return -EIO;
  500. }
  501. /*
  502. * update the sdio allocation according to the pointer we get in the
  503. * alive notification.
  504. */
  505. st_fwrd_space.addr = mvm->sf_space.addr;
  506. st_fwrd_space.size = mvm->sf_space.size;
  507. ret = iwl_trans_update_sf(mvm->trans, &st_fwrd_space);
  508. if (ret) {
  509. IWL_ERR(mvm, "Failed to update SF size. ret %d\n", ret);
  510. return ret;
  511. }
  512. iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr);
  513. /*
  514. * configure and operate fw paging mechanism.
  515. * driver configures the paging flow only once, CPU2 paging image
  516. * included in the IWL_UCODE_INIT image.
  517. */
  518. if (fw->paging_mem_size) {
  519. /*
  520. * When dma is not enabled, the driver needs to copy / write
  521. * the downloaded / uploaded page to / from the smem.
  522. * This gets the location of the place were the pages are
  523. * stored.
  524. */
  525. if (!is_device_dma_capable(mvm->trans->dev)) {
  526. ret = iwl_trans_get_paging_item(mvm);
  527. if (ret) {
  528. IWL_ERR(mvm, "failed to get FW paging item\n");
  529. return ret;
  530. }
  531. }
  532. ret = iwl_save_fw_paging(mvm, fw);
  533. if (ret) {
  534. IWL_ERR(mvm, "failed to save the FW paging image\n");
  535. return ret;
  536. }
  537. ret = iwl_send_paging_cmd(mvm, fw);
  538. if (ret) {
  539. IWL_ERR(mvm, "failed to send the paging cmd\n");
  540. iwl_free_fw_paging(mvm);
  541. return ret;
  542. }
  543. }
  544. /*
  545. * Note: all the queues are enabled as part of the interface
  546. * initialization, but in firmware restart scenarios they
  547. * could be stopped, so wake them up. In firmware restart,
  548. * mac80211 will have the queues stopped as well until the
  549. * reconfiguration completes. During normal startup, they
  550. * will be empty.
  551. */
  552. memset(&mvm->queue_info, 0, sizeof(mvm->queue_info));
  553. mvm->queue_info[IWL_MVM_CMD_QUEUE].hw_queue_refcount = 1;
  554. for (i = 0; i < IEEE80211_MAX_QUEUES; i++)
  555. atomic_set(&mvm->mac80211_queue_stop_count[i], 0);
  556. mvm->ucode_loaded = true;
  557. return 0;
  558. }
  559. static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm)
  560. {
  561. struct iwl_phy_cfg_cmd phy_cfg_cmd;
  562. enum iwl_ucode_type ucode_type = mvm->cur_ucode;
  563. /* Set parameters */
  564. phy_cfg_cmd.phy_cfg = cpu_to_le32(iwl_mvm_get_phy_config(mvm));
  565. phy_cfg_cmd.calib_control.event_trigger =
  566. mvm->fw->default_calib[ucode_type].event_trigger;
  567. phy_cfg_cmd.calib_control.flow_trigger =
  568. mvm->fw->default_calib[ucode_type].flow_trigger;
  569. IWL_DEBUG_INFO(mvm, "Sending Phy CFG command: 0x%x\n",
  570. phy_cfg_cmd.phy_cfg);
  571. return iwl_mvm_send_cmd_pdu(mvm, PHY_CONFIGURATION_CMD, 0,
  572. sizeof(phy_cfg_cmd), &phy_cfg_cmd);
  573. }
  574. int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
  575. {
  576. struct iwl_notification_wait calib_wait;
  577. static const u16 init_complete[] = {
  578. INIT_COMPLETE_NOTIF,
  579. CALIB_RES_NOTIF_PHY_DB
  580. };
  581. int ret;
  582. lockdep_assert_held(&mvm->mutex);
  583. if (WARN_ON_ONCE(mvm->calibrating))
  584. return 0;
  585. iwl_init_notification_wait(&mvm->notif_wait,
  586. &calib_wait,
  587. init_complete,
  588. ARRAY_SIZE(init_complete),
  589. iwl_wait_phy_db_entry,
  590. mvm->phy_db);
  591. /* Will also start the device */
  592. ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_INIT);
  593. if (ret) {
  594. IWL_ERR(mvm, "Failed to start INIT ucode: %d\n", ret);
  595. goto error;
  596. }
  597. ret = iwl_send_bt_init_conf(mvm);
  598. if (ret)
  599. goto error;
  600. /* Read the NVM only at driver load time, no need to do this twice */
  601. if (read_nvm) {
  602. /* Read nvm */
  603. ret = iwl_nvm_init(mvm, true);
  604. if (ret) {
  605. IWL_ERR(mvm, "Failed to read NVM: %d\n", ret);
  606. goto error;
  607. }
  608. }
  609. /* In case we read the NVM from external file, load it to the NIC */
  610. if (mvm->nvm_file_name)
  611. iwl_mvm_load_nvm_to_nic(mvm);
  612. ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans);
  613. WARN_ON(ret);
  614. /*
  615. * abort after reading the nvm in case RF Kill is on, we will complete
  616. * the init seq later when RF kill will switch to off
  617. */
  618. if (iwl_mvm_is_radio_hw_killed(mvm)) {
  619. IWL_DEBUG_RF_KILL(mvm,
  620. "jump over all phy activities due to RF kill\n");
  621. iwl_remove_notification(&mvm->notif_wait, &calib_wait);
  622. ret = 1;
  623. goto out;
  624. }
  625. mvm->calibrating = true;
  626. /* Send TX valid antennas before triggering calibrations */
  627. ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm));
  628. if (ret)
  629. goto error;
  630. /*
  631. * Send phy configurations command to init uCode
  632. * to start the 16.0 uCode init image internal calibrations.
  633. */
  634. ret = iwl_send_phy_cfg_cmd(mvm);
  635. if (ret) {
  636. IWL_ERR(mvm, "Failed to run INIT calibrations: %d\n",
  637. ret);
  638. goto error;
  639. }
  640. /*
  641. * Some things may run in the background now, but we
  642. * just wait for the calibration complete notification.
  643. */
  644. ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait,
  645. MVM_UCODE_CALIB_TIMEOUT);
  646. if (ret && iwl_mvm_is_radio_hw_killed(mvm)) {
  647. IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n");
  648. ret = 1;
  649. }
  650. goto out;
  651. error:
  652. iwl_remove_notification(&mvm->notif_wait, &calib_wait);
  653. out:
  654. mvm->calibrating = false;
  655. if (iwlmvm_mod_params.init_dbg && !mvm->nvm_data) {
  656. /* we want to debug INIT and we have no NVM - fake */
  657. mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) +
  658. sizeof(struct ieee80211_channel) +
  659. sizeof(struct ieee80211_rate),
  660. GFP_KERNEL);
  661. if (!mvm->nvm_data)
  662. return -ENOMEM;
  663. mvm->nvm_data->bands[0].channels = mvm->nvm_data->channels;
  664. mvm->nvm_data->bands[0].n_channels = 1;
  665. mvm->nvm_data->bands[0].n_bitrates = 1;
  666. mvm->nvm_data->bands[0].bitrates =
  667. (void *)mvm->nvm_data->channels + 1;
  668. mvm->nvm_data->bands[0].bitrates->hw_value = 10;
  669. }
  670. return ret;
  671. }
  672. static void iwl_mvm_get_shared_mem_conf(struct iwl_mvm *mvm)
  673. {
  674. struct iwl_host_cmd cmd = {
  675. .id = SHARED_MEM_CFG,
  676. .flags = CMD_WANT_SKB,
  677. .data = { NULL, },
  678. .len = { 0, },
  679. };
  680. struct iwl_rx_packet *pkt;
  681. struct iwl_shared_mem_cfg *mem_cfg;
  682. u32 i;
  683. lockdep_assert_held(&mvm->mutex);
  684. if (WARN_ON(iwl_mvm_send_cmd(mvm, &cmd)))
  685. return;
  686. pkt = cmd.resp_pkt;
  687. mem_cfg = (void *)pkt->data;
  688. mvm->shared_mem_cfg.shared_mem_addr =
  689. le32_to_cpu(mem_cfg->shared_mem_addr);
  690. mvm->shared_mem_cfg.shared_mem_size =
  691. le32_to_cpu(mem_cfg->shared_mem_size);
  692. mvm->shared_mem_cfg.sample_buff_addr =
  693. le32_to_cpu(mem_cfg->sample_buff_addr);
  694. mvm->shared_mem_cfg.sample_buff_size =
  695. le32_to_cpu(mem_cfg->sample_buff_size);
  696. mvm->shared_mem_cfg.txfifo_addr = le32_to_cpu(mem_cfg->txfifo_addr);
  697. for (i = 0; i < ARRAY_SIZE(mvm->shared_mem_cfg.txfifo_size); i++)
  698. mvm->shared_mem_cfg.txfifo_size[i] =
  699. le32_to_cpu(mem_cfg->txfifo_size[i]);
  700. for (i = 0; i < ARRAY_SIZE(mvm->shared_mem_cfg.rxfifo_size); i++)
  701. mvm->shared_mem_cfg.rxfifo_size[i] =
  702. le32_to_cpu(mem_cfg->rxfifo_size[i]);
  703. mvm->shared_mem_cfg.page_buff_addr =
  704. le32_to_cpu(mem_cfg->page_buff_addr);
  705. mvm->shared_mem_cfg.page_buff_size =
  706. le32_to_cpu(mem_cfg->page_buff_size);
  707. IWL_DEBUG_INFO(mvm, "SHARED MEM CFG: got memory offsets/sizes\n");
  708. iwl_free_resp(&cmd);
  709. }
  710. static int iwl_mvm_config_ltr(struct iwl_mvm *mvm)
  711. {
  712. struct iwl_ltr_config_cmd cmd = {
  713. .flags = cpu_to_le32(LTR_CFG_FLAG_FEATURE_ENABLE),
  714. };
  715. if (!mvm->trans->ltr_enabled)
  716. return 0;
  717. return iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0,
  718. sizeof(cmd), &cmd);
  719. }
  720. int iwl_mvm_up(struct iwl_mvm *mvm)
  721. {
  722. int ret, i;
  723. struct ieee80211_channel *chan;
  724. struct cfg80211_chan_def chandef;
  725. lockdep_assert_held(&mvm->mutex);
  726. ret = iwl_trans_start_hw(mvm->trans);
  727. if (ret)
  728. return ret;
  729. /*
  730. * If we haven't completed the run of the init ucode during
  731. * module loading, load init ucode now
  732. * (for example, if we were in RFKILL)
  733. */
  734. ret = iwl_run_init_mvm_ucode(mvm, false);
  735. if (ret && !iwlmvm_mod_params.init_dbg) {
  736. IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret);
  737. /* this can't happen */
  738. if (WARN_ON(ret > 0))
  739. ret = -ERFKILL;
  740. goto error;
  741. }
  742. if (!iwlmvm_mod_params.init_dbg) {
  743. /*
  744. * Stop and start the transport without entering low power
  745. * mode. This will save the state of other components on the
  746. * device that are triggered by the INIT firwmare (MFUART).
  747. */
  748. _iwl_trans_stop_device(mvm->trans, false);
  749. ret = _iwl_trans_start_hw(mvm->trans, false);
  750. if (ret)
  751. goto error;
  752. }
  753. if (iwlmvm_mod_params.init_dbg)
  754. return 0;
  755. ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR);
  756. if (ret) {
  757. IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret);
  758. goto error;
  759. }
  760. iwl_mvm_get_shared_mem_conf(mvm);
  761. ret = iwl_mvm_sf_update(mvm, NULL, false);
  762. if (ret)
  763. IWL_ERR(mvm, "Failed to initialize Smart Fifo\n");
  764. mvm->fw_dbg_conf = FW_DBG_INVALID;
  765. /* if we have a destination, assume EARLY START */
  766. if (mvm->fw->dbg_dest_tlv)
  767. mvm->fw_dbg_conf = FW_DBG_START_FROM_ALIVE;
  768. iwl_mvm_start_fw_dbg_conf(mvm, FW_DBG_START_FROM_ALIVE);
  769. ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm));
  770. if (ret)
  771. goto error;
  772. ret = iwl_send_bt_init_conf(mvm);
  773. if (ret)
  774. goto error;
  775. /* Send phy db control command and then phy db calibration*/
  776. ret = iwl_send_phy_db_data(mvm->phy_db);
  777. if (ret)
  778. goto error;
  779. ret = iwl_send_phy_cfg_cmd(mvm);
  780. if (ret)
  781. goto error;
  782. /* Init RSS configuration */
  783. if (iwl_mvm_has_new_rx_api(mvm)) {
  784. ret = iwl_send_rss_cfg_cmd(mvm);
  785. if (ret) {
  786. IWL_ERR(mvm, "Failed to configure RSS queues: %d\n",
  787. ret);
  788. goto error;
  789. }
  790. }
  791. /* init the fw <-> mac80211 STA mapping */
  792. for (i = 0; i < IWL_MVM_STATION_COUNT; i++)
  793. RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL);
  794. mvm->tdls_cs.peer.sta_id = IWL_MVM_STATION_COUNT;
  795. /* reset quota debouncing buffer - 0xff will yield invalid data */
  796. memset(&mvm->last_quota_cmd, 0xff, sizeof(mvm->last_quota_cmd));
  797. /* Add auxiliary station for scanning */
  798. ret = iwl_mvm_add_aux_sta(mvm);
  799. if (ret)
  800. goto error;
  801. /* Add all the PHY contexts */
  802. chan = &mvm->hw->wiphy->bands[IEEE80211_BAND_2GHZ]->channels[0];
  803. cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT);
  804. for (i = 0; i < NUM_PHY_CTX; i++) {
  805. /*
  806. * The channel used here isn't relevant as it's
  807. * going to be overwritten in the other flows.
  808. * For now use the first channel we have.
  809. */
  810. ret = iwl_mvm_phy_ctxt_add(mvm, &mvm->phy_ctxts[i],
  811. &chandef, 1, 1);
  812. if (ret)
  813. goto error;
  814. }
  815. #ifdef CONFIG_THERMAL
  816. if (iwl_mvm_is_tt_in_fw(mvm)) {
  817. /* in order to give the responsibility of ct-kill and
  818. * TX backoff to FW we need to send empty temperature reporting
  819. * cmd during init time
  820. */
  821. iwl_mvm_send_temp_report_ths_cmd(mvm);
  822. } else {
  823. /* Initialize tx backoffs to the minimal possible */
  824. iwl_mvm_tt_tx_backoff(mvm, 0);
  825. }
  826. /* TODO: read the budget from BIOS / Platform NVM */
  827. if (iwl_mvm_is_ctdp_supported(mvm) && mvm->cooling_dev.cur_state > 0)
  828. ret = iwl_mvm_ctdp_command(mvm, CTDP_CMD_OPERATION_START,
  829. mvm->cooling_dev.cur_state);
  830. #else
  831. /* Initialize tx backoffs to the minimal possible */
  832. iwl_mvm_tt_tx_backoff(mvm, 0);
  833. #endif
  834. WARN_ON(iwl_mvm_config_ltr(mvm));
  835. ret = iwl_mvm_power_update_device(mvm);
  836. if (ret)
  837. goto error;
  838. /*
  839. * RTNL is not taken during Ct-kill, but we don't need to scan/Tx
  840. * anyway, so don't init MCC.
  841. */
  842. if (!test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status)) {
  843. ret = iwl_mvm_init_mcc(mvm);
  844. if (ret)
  845. goto error;
  846. }
  847. if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
  848. mvm->scan_type = IWL_SCAN_TYPE_NOT_SET;
  849. ret = iwl_mvm_config_scan(mvm);
  850. if (ret)
  851. goto error;
  852. }
  853. if (iwl_mvm_is_csum_supported(mvm) &&
  854. mvm->cfg->features & NETIF_F_RXCSUM)
  855. iwl_trans_write_prph(mvm->trans, RX_EN_CSUM, 0x3);
  856. /* allow FW/transport low power modes if not during restart */
  857. if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
  858. iwl_mvm_unref(mvm, IWL_MVM_REF_UCODE_DOWN);
  859. IWL_DEBUG_INFO(mvm, "RT uCode started.\n");
  860. return 0;
  861. error:
  862. iwl_mvm_stop_device(mvm);
  863. return ret;
  864. }
  865. int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm)
  866. {
  867. int ret, i;
  868. lockdep_assert_held(&mvm->mutex);
  869. ret = iwl_trans_start_hw(mvm->trans);
  870. if (ret)
  871. return ret;
  872. ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_WOWLAN);
  873. if (ret) {
  874. IWL_ERR(mvm, "Failed to start WoWLAN firmware: %d\n", ret);
  875. goto error;
  876. }
  877. ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm));
  878. if (ret)
  879. goto error;
  880. /* Send phy db control command and then phy db calibration*/
  881. ret = iwl_send_phy_db_data(mvm->phy_db);
  882. if (ret)
  883. goto error;
  884. ret = iwl_send_phy_cfg_cmd(mvm);
  885. if (ret)
  886. goto error;
  887. /* init the fw <-> mac80211 STA mapping */
  888. for (i = 0; i < IWL_MVM_STATION_COUNT; i++)
  889. RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL);
  890. /* Add auxiliary station for scanning */
  891. ret = iwl_mvm_add_aux_sta(mvm);
  892. if (ret)
  893. goto error;
  894. return 0;
  895. error:
  896. iwl_mvm_stop_device(mvm);
  897. return ret;
  898. }
  899. void iwl_mvm_rx_card_state_notif(struct iwl_mvm *mvm,
  900. struct iwl_rx_cmd_buffer *rxb)
  901. {
  902. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  903. struct iwl_card_state_notif *card_state_notif = (void *)pkt->data;
  904. u32 flags = le32_to_cpu(card_state_notif->flags);
  905. IWL_DEBUG_RF_KILL(mvm, "Card state received: HW:%s SW:%s CT:%s\n",
  906. (flags & HW_CARD_DISABLED) ? "Kill" : "On",
  907. (flags & SW_CARD_DISABLED) ? "Kill" : "On",
  908. (flags & CT_KILL_CARD_DISABLED) ?
  909. "Reached" : "Not reached");
  910. }
  911. void iwl_mvm_rx_mfuart_notif(struct iwl_mvm *mvm,
  912. struct iwl_rx_cmd_buffer *rxb)
  913. {
  914. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  915. struct iwl_mfuart_load_notif *mfuart_notif = (void *)pkt->data;
  916. IWL_DEBUG_INFO(mvm,
  917. "MFUART: installed ver: 0x%08x, external ver: 0x%08x, status: 0x%08x, duration: 0x%08x\n",
  918. le32_to_cpu(mfuart_notif->installed_ver),
  919. le32_to_cpu(mfuart_notif->external_ver),
  920. le32_to_cpu(mfuart_notif->status),
  921. le32_to_cpu(mfuart_notif->duration));
  922. }