fw.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  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 - 2014 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) 2012 - 2014 Intel Corporation. All rights reserved.
  35. * Copyright(c) 2013 - 2014 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. #include <net/mac80211.h>
  66. #include "iwl-trans.h"
  67. #include "iwl-op-mode.h"
  68. #include "iwl-fw.h"
  69. #include "iwl-debug.h"
  70. #include "iwl-csr.h" /* for iwl_mvm_rx_card_state_notif */
  71. #include "iwl-io.h" /* for iwl_mvm_rx_card_state_notif */
  72. #include "iwl-eeprom-parse.h"
  73. #include "mvm.h"
  74. #include "iwl-phy-db.h"
  75. #define MVM_UCODE_ALIVE_TIMEOUT HZ
  76. #define MVM_UCODE_CALIB_TIMEOUT (2*HZ)
  77. #define UCODE_VALID_OK cpu_to_le32(0x1)
  78. struct iwl_mvm_alive_data {
  79. bool valid;
  80. u32 scd_base_addr;
  81. };
  82. static inline const struct fw_img *
  83. iwl_get_ucode_image(struct iwl_mvm *mvm, enum iwl_ucode_type ucode_type)
  84. {
  85. if (ucode_type >= IWL_UCODE_TYPE_MAX)
  86. return NULL;
  87. return &mvm->fw->img[ucode_type];
  88. }
  89. static int iwl_send_tx_ant_cfg(struct iwl_mvm *mvm, u8 valid_tx_ant)
  90. {
  91. struct iwl_tx_ant_cfg_cmd tx_ant_cmd = {
  92. .valid = cpu_to_le32(valid_tx_ant),
  93. };
  94. IWL_DEBUG_FW(mvm, "select valid tx ant: %u\n", valid_tx_ant);
  95. return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, 0,
  96. sizeof(tx_ant_cmd), &tx_ant_cmd);
  97. }
  98. static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait,
  99. struct iwl_rx_packet *pkt, void *data)
  100. {
  101. struct iwl_mvm *mvm =
  102. container_of(notif_wait, struct iwl_mvm, notif_wait);
  103. struct iwl_mvm_alive_data *alive_data = data;
  104. struct mvm_alive_resp *palive;
  105. struct mvm_alive_resp_ver2 *palive2;
  106. if (iwl_rx_packet_payload_len(pkt) == sizeof(*palive)) {
  107. palive = (void *)pkt->data;
  108. mvm->support_umac_log = false;
  109. mvm->error_event_table =
  110. le32_to_cpu(palive->error_event_table_ptr);
  111. mvm->log_event_table = le32_to_cpu(palive->log_event_table_ptr);
  112. alive_data->scd_base_addr = le32_to_cpu(palive->scd_base_ptr);
  113. alive_data->valid = le16_to_cpu(palive->status) ==
  114. IWL_ALIVE_STATUS_OK;
  115. IWL_DEBUG_FW(mvm,
  116. "Alive VER1 ucode status 0x%04x revision 0x%01X 0x%01X flags 0x%01X\n",
  117. le16_to_cpu(palive->status), palive->ver_type,
  118. palive->ver_subtype, palive->flags);
  119. } else {
  120. palive2 = (void *)pkt->data;
  121. mvm->error_event_table =
  122. le32_to_cpu(palive2->error_event_table_ptr);
  123. mvm->log_event_table =
  124. le32_to_cpu(palive2->log_event_table_ptr);
  125. alive_data->scd_base_addr = le32_to_cpu(palive2->scd_base_ptr);
  126. mvm->umac_error_event_table =
  127. le32_to_cpu(palive2->error_info_addr);
  128. mvm->sf_space.addr = le32_to_cpu(palive2->st_fwrd_addr);
  129. mvm->sf_space.size = le32_to_cpu(palive2->st_fwrd_size);
  130. alive_data->valid = le16_to_cpu(palive2->status) ==
  131. IWL_ALIVE_STATUS_OK;
  132. if (mvm->umac_error_event_table)
  133. mvm->support_umac_log = true;
  134. IWL_DEBUG_FW(mvm,
  135. "Alive VER2 ucode status 0x%04x revision 0x%01X 0x%01X flags 0x%01X\n",
  136. le16_to_cpu(palive2->status), palive2->ver_type,
  137. palive2->ver_subtype, palive2->flags);
  138. IWL_DEBUG_FW(mvm,
  139. "UMAC version: Major - 0x%x, Minor - 0x%x\n",
  140. palive2->umac_major, palive2->umac_minor);
  141. }
  142. return true;
  143. }
  144. static bool iwl_wait_phy_db_entry(struct iwl_notif_wait_data *notif_wait,
  145. struct iwl_rx_packet *pkt, void *data)
  146. {
  147. struct iwl_phy_db *phy_db = data;
  148. if (pkt->hdr.cmd != CALIB_RES_NOTIF_PHY_DB) {
  149. WARN_ON(pkt->hdr.cmd != INIT_COMPLETE_NOTIF);
  150. return true;
  151. }
  152. WARN_ON(iwl_phy_db_set_section(phy_db, pkt, GFP_ATOMIC));
  153. return false;
  154. }
  155. static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
  156. enum iwl_ucode_type ucode_type)
  157. {
  158. struct iwl_notification_wait alive_wait;
  159. struct iwl_mvm_alive_data alive_data;
  160. const struct fw_img *fw;
  161. int ret, i;
  162. enum iwl_ucode_type old_type = mvm->cur_ucode;
  163. static const u8 alive_cmd[] = { MVM_ALIVE };
  164. struct iwl_sf_region st_fwrd_space;
  165. fw = iwl_get_ucode_image(mvm, ucode_type);
  166. if (WARN_ON(!fw))
  167. return -EINVAL;
  168. mvm->cur_ucode = ucode_type;
  169. mvm->ucode_loaded = false;
  170. iwl_init_notification_wait(&mvm->notif_wait, &alive_wait,
  171. alive_cmd, ARRAY_SIZE(alive_cmd),
  172. iwl_alive_fn, &alive_data);
  173. ret = iwl_trans_start_fw(mvm->trans, fw, ucode_type == IWL_UCODE_INIT);
  174. if (ret) {
  175. mvm->cur_ucode = old_type;
  176. iwl_remove_notification(&mvm->notif_wait, &alive_wait);
  177. return ret;
  178. }
  179. /*
  180. * Some things may run in the background now, but we
  181. * just wait for the ALIVE notification here.
  182. */
  183. ret = iwl_wait_notification(&mvm->notif_wait, &alive_wait,
  184. MVM_UCODE_ALIVE_TIMEOUT);
  185. if (ret) {
  186. mvm->cur_ucode = old_type;
  187. return ret;
  188. }
  189. if (!alive_data.valid) {
  190. IWL_ERR(mvm, "Loaded ucode is not valid!\n");
  191. mvm->cur_ucode = old_type;
  192. return -EIO;
  193. }
  194. /*
  195. * update the sdio allocation according to the pointer we get in the
  196. * alive notification.
  197. */
  198. st_fwrd_space.addr = mvm->sf_space.addr;
  199. st_fwrd_space.size = mvm->sf_space.size;
  200. ret = iwl_trans_update_sf(mvm->trans, &st_fwrd_space);
  201. iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr);
  202. /*
  203. * Note: all the queues are enabled as part of the interface
  204. * initialization, but in firmware restart scenarios they
  205. * could be stopped, so wake them up. In firmware restart,
  206. * mac80211 will have the queues stopped as well until the
  207. * reconfiguration completes. During normal startup, they
  208. * will be empty.
  209. */
  210. for (i = 0; i < IWL_MAX_HW_QUEUES; i++) {
  211. if (i < mvm->first_agg_queue && i != IWL_MVM_CMD_QUEUE)
  212. mvm->queue_to_mac80211[i] = i;
  213. else
  214. mvm->queue_to_mac80211[i] = IWL_INVALID_MAC80211_QUEUE;
  215. }
  216. for (i = 0; i < IEEE80211_MAX_QUEUES; i++)
  217. atomic_set(&mvm->mac80211_queue_stop_count[i], 0);
  218. mvm->ucode_loaded = true;
  219. return 0;
  220. }
  221. static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm)
  222. {
  223. struct iwl_phy_cfg_cmd phy_cfg_cmd;
  224. enum iwl_ucode_type ucode_type = mvm->cur_ucode;
  225. /* Set parameters */
  226. phy_cfg_cmd.phy_cfg = cpu_to_le32(mvm->fw->phy_config);
  227. phy_cfg_cmd.calib_control.event_trigger =
  228. mvm->fw->default_calib[ucode_type].event_trigger;
  229. phy_cfg_cmd.calib_control.flow_trigger =
  230. mvm->fw->default_calib[ucode_type].flow_trigger;
  231. IWL_DEBUG_INFO(mvm, "Sending Phy CFG command: 0x%x\n",
  232. phy_cfg_cmd.phy_cfg);
  233. return iwl_mvm_send_cmd_pdu(mvm, PHY_CONFIGURATION_CMD, 0,
  234. sizeof(phy_cfg_cmd), &phy_cfg_cmd);
  235. }
  236. int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
  237. {
  238. struct iwl_notification_wait calib_wait;
  239. static const u8 init_complete[] = {
  240. INIT_COMPLETE_NOTIF,
  241. CALIB_RES_NOTIF_PHY_DB
  242. };
  243. int ret;
  244. lockdep_assert_held(&mvm->mutex);
  245. if (WARN_ON_ONCE(mvm->init_ucode_complete))
  246. return 0;
  247. iwl_init_notification_wait(&mvm->notif_wait,
  248. &calib_wait,
  249. init_complete,
  250. ARRAY_SIZE(init_complete),
  251. iwl_wait_phy_db_entry,
  252. mvm->phy_db);
  253. /* Will also start the device */
  254. ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_INIT);
  255. if (ret) {
  256. IWL_ERR(mvm, "Failed to start INIT ucode: %d\n", ret);
  257. goto error;
  258. }
  259. ret = iwl_send_bt_init_conf(mvm);
  260. if (ret)
  261. goto error;
  262. /* Read the NVM only at driver load time, no need to do this twice */
  263. if (read_nvm) {
  264. /* Read nvm */
  265. ret = iwl_nvm_init(mvm, true);
  266. if (ret) {
  267. IWL_ERR(mvm, "Failed to read NVM: %d\n", ret);
  268. goto error;
  269. }
  270. }
  271. /* In case we read the NVM from external file, load it to the NIC */
  272. if (mvm->nvm_file_name)
  273. iwl_mvm_load_nvm_to_nic(mvm);
  274. ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans);
  275. WARN_ON(ret);
  276. /*
  277. * abort after reading the nvm in case RF Kill is on, we will complete
  278. * the init seq later when RF kill will switch to off
  279. */
  280. if (iwl_mvm_is_radio_killed(mvm)) {
  281. IWL_DEBUG_RF_KILL(mvm,
  282. "jump over all phy activities due to RF kill\n");
  283. iwl_remove_notification(&mvm->notif_wait, &calib_wait);
  284. ret = 1;
  285. goto out;
  286. }
  287. /* Send TX valid antennas before triggering calibrations */
  288. ret = iwl_send_tx_ant_cfg(mvm, mvm->fw->valid_tx_ant);
  289. if (ret)
  290. goto error;
  291. /*
  292. * Send phy configurations command to init uCode
  293. * to start the 16.0 uCode init image internal calibrations.
  294. */
  295. ret = iwl_send_phy_cfg_cmd(mvm);
  296. if (ret) {
  297. IWL_ERR(mvm, "Failed to run INIT calibrations: %d\n",
  298. ret);
  299. goto error;
  300. }
  301. /*
  302. * Some things may run in the background now, but we
  303. * just wait for the calibration complete notification.
  304. */
  305. ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait,
  306. MVM_UCODE_CALIB_TIMEOUT);
  307. if (!ret)
  308. mvm->init_ucode_complete = true;
  309. goto out;
  310. error:
  311. iwl_remove_notification(&mvm->notif_wait, &calib_wait);
  312. out:
  313. if (iwlmvm_mod_params.init_dbg && !mvm->nvm_data) {
  314. /* we want to debug INIT and we have no NVM - fake */
  315. mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) +
  316. sizeof(struct ieee80211_channel) +
  317. sizeof(struct ieee80211_rate),
  318. GFP_KERNEL);
  319. if (!mvm->nvm_data)
  320. return -ENOMEM;
  321. mvm->nvm_data->bands[0].channels = mvm->nvm_data->channels;
  322. mvm->nvm_data->bands[0].n_channels = 1;
  323. mvm->nvm_data->bands[0].n_bitrates = 1;
  324. mvm->nvm_data->bands[0].bitrates =
  325. (void *)mvm->nvm_data->channels + 1;
  326. mvm->nvm_data->bands[0].bitrates->hw_value = 10;
  327. }
  328. return ret;
  329. }
  330. int iwl_mvm_up(struct iwl_mvm *mvm)
  331. {
  332. int ret, i;
  333. struct ieee80211_channel *chan;
  334. struct cfg80211_chan_def chandef;
  335. lockdep_assert_held(&mvm->mutex);
  336. ret = iwl_trans_start_hw(mvm->trans);
  337. if (ret)
  338. return ret;
  339. /*
  340. * If we haven't completed the run of the init ucode during
  341. * module loading, load init ucode now
  342. * (for example, if we were in RFKILL)
  343. */
  344. if (!mvm->init_ucode_complete) {
  345. ret = iwl_run_init_mvm_ucode(mvm, false);
  346. if (ret && !iwlmvm_mod_params.init_dbg) {
  347. IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret);
  348. /* this can't happen */
  349. if (WARN_ON(ret > 0))
  350. ret = -ERFKILL;
  351. goto error;
  352. }
  353. if (!iwlmvm_mod_params.init_dbg) {
  354. /*
  355. * should stop and start HW since that INIT
  356. * image just loaded
  357. */
  358. iwl_trans_stop_device(mvm->trans);
  359. ret = iwl_trans_start_hw(mvm->trans);
  360. if (ret)
  361. return ret;
  362. }
  363. }
  364. if (iwlmvm_mod_params.init_dbg)
  365. return 0;
  366. ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR);
  367. if (ret) {
  368. IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret);
  369. goto error;
  370. }
  371. ret = iwl_mvm_sf_update(mvm, NULL, false);
  372. if (ret)
  373. IWL_ERR(mvm, "Failed to initialize Smart Fifo\n");
  374. ret = iwl_send_tx_ant_cfg(mvm, mvm->fw->valid_tx_ant);
  375. if (ret)
  376. goto error;
  377. ret = iwl_send_bt_init_conf(mvm);
  378. if (ret)
  379. goto error;
  380. /* Send phy db control command and then phy db calibration*/
  381. ret = iwl_send_phy_db_data(mvm->phy_db);
  382. if (ret)
  383. goto error;
  384. ret = iwl_send_phy_cfg_cmd(mvm);
  385. if (ret)
  386. goto error;
  387. /* init the fw <-> mac80211 STA mapping */
  388. for (i = 0; i < IWL_MVM_STATION_COUNT; i++)
  389. RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL);
  390. /* reset quota debouncing buffer - 0xff will yield invalid data */
  391. memset(&mvm->last_quota_cmd, 0xff, sizeof(mvm->last_quota_cmd));
  392. /* Add auxiliary station for scanning */
  393. ret = iwl_mvm_add_aux_sta(mvm);
  394. if (ret)
  395. goto error;
  396. /* Add all the PHY contexts */
  397. chan = &mvm->hw->wiphy->bands[IEEE80211_BAND_2GHZ]->channels[0];
  398. cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT);
  399. for (i = 0; i < NUM_PHY_CTX; i++) {
  400. /*
  401. * The channel used here isn't relevant as it's
  402. * going to be overwritten in the other flows.
  403. * For now use the first channel we have.
  404. */
  405. ret = iwl_mvm_phy_ctxt_add(mvm, &mvm->phy_ctxts[i],
  406. &chandef, 1, 1);
  407. if (ret)
  408. goto error;
  409. }
  410. /* Initialize tx backoffs to the minimal possible */
  411. iwl_mvm_tt_tx_backoff(mvm, 0);
  412. if (mvm->trans->ltr_enabled) {
  413. struct iwl_ltr_config_cmd cmd = {
  414. .flags = cpu_to_le32(LTR_CFG_FLAG_FEATURE_ENABLE),
  415. };
  416. WARN_ON(iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0,
  417. sizeof(cmd), &cmd));
  418. }
  419. ret = iwl_mvm_power_update_device(mvm);
  420. if (ret)
  421. goto error;
  422. /* allow FW/transport low power modes if not during restart */
  423. if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
  424. iwl_mvm_unref(mvm, IWL_MVM_REF_UCODE_DOWN);
  425. IWL_DEBUG_INFO(mvm, "RT uCode started.\n");
  426. return 0;
  427. error:
  428. iwl_trans_stop_device(mvm->trans);
  429. return ret;
  430. }
  431. int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm)
  432. {
  433. int ret, i;
  434. lockdep_assert_held(&mvm->mutex);
  435. ret = iwl_trans_start_hw(mvm->trans);
  436. if (ret)
  437. return ret;
  438. ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_WOWLAN);
  439. if (ret) {
  440. IWL_ERR(mvm, "Failed to start WoWLAN firmware: %d\n", ret);
  441. goto error;
  442. }
  443. ret = iwl_send_tx_ant_cfg(mvm, mvm->fw->valid_tx_ant);
  444. if (ret)
  445. goto error;
  446. /* Send phy db control command and then phy db calibration*/
  447. ret = iwl_send_phy_db_data(mvm->phy_db);
  448. if (ret)
  449. goto error;
  450. ret = iwl_send_phy_cfg_cmd(mvm);
  451. if (ret)
  452. goto error;
  453. /* init the fw <-> mac80211 STA mapping */
  454. for (i = 0; i < IWL_MVM_STATION_COUNT; i++)
  455. RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL);
  456. /* Add auxiliary station for scanning */
  457. ret = iwl_mvm_add_aux_sta(mvm);
  458. if (ret)
  459. goto error;
  460. return 0;
  461. error:
  462. iwl_trans_stop_device(mvm->trans);
  463. return ret;
  464. }
  465. int iwl_mvm_rx_card_state_notif(struct iwl_mvm *mvm,
  466. struct iwl_rx_cmd_buffer *rxb,
  467. struct iwl_device_cmd *cmd)
  468. {
  469. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  470. struct iwl_card_state_notif *card_state_notif = (void *)pkt->data;
  471. u32 flags = le32_to_cpu(card_state_notif->flags);
  472. IWL_DEBUG_RF_KILL(mvm, "Card state received: HW:%s SW:%s CT:%s\n",
  473. (flags & HW_CARD_DISABLED) ? "Kill" : "On",
  474. (flags & SW_CARD_DISABLED) ? "Kill" : "On",
  475. (flags & CT_KILL_CARD_DISABLED) ?
  476. "Reached" : "Not reached");
  477. return 0;
  478. }
  479. int iwl_mvm_rx_radio_ver(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
  480. struct iwl_device_cmd *cmd)
  481. {
  482. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  483. struct iwl_radio_version_notif *radio_version = (void *)pkt->data;
  484. /* TODO: what to do with that? */
  485. IWL_DEBUG_INFO(mvm,
  486. "Radio version: flavor: 0x%08x, step 0x%08x, dash 0x%08x\n",
  487. le32_to_cpu(radio_version->radio_flavor),
  488. le32_to_cpu(radio_version->radio_step),
  489. le32_to_cpu(radio_version->radio_dash));
  490. return 0;
  491. }