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 - 2017 Intel Deutschland GmbH 11 * Copyright(c) 2018 Intel Corporation 12 * 13 * This program is free software; you can redistribute it and/or modify 14 * it under the terms of version 2 of the GNU General Public License as 15 * published by the Free Software Foundation. 16 * 17 * This program is distributed in the hope that it will be useful, but 18 * WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 * General Public License for more details. 21 * 22 * You should have received a copy of the GNU General Public License 23 * along with this program; if not, write to the Free Software 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, 25 * USA 26 * 27 * The full GNU General Public License is included in this distribution 28 * in the file called COPYING. 29 * 30 * Contact Information: 31 * Intel Linux Wireless <linuxwifi@intel.com> 32 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 33 * 34 * BSD LICENSE 35 * 36 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 37 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 38 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 39 * Copyright(c) 2018 Intel Corporation 40 * All rights reserved. 41 * 42 * Redistribution and use in source and binary forms, with or without 43 * modification, are permitted provided that the following conditions 44 * are met: 45 * 46 * * Redistributions of source code must retain the above copyright 47 * notice, this list of conditions and the following disclaimer. 48 * * Redistributions in binary form must reproduce the above copyright 49 * notice, this list of conditions and the following disclaimer in 50 * the documentation and/or other materials provided with the 51 * distribution. 52 * * Neither the name Intel Corporation nor the names of its 53 * contributors may be used to endorse or promote products derived 54 * from this software without specific prior written permission. 55 * 56 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 57 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 58 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 59 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 60 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 61 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 62 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 63 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 64 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 65 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 66 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 67 * 68 *****************************************************************************/ 69 #include <net/mac80211.h> 70 #include <linux/netdevice.h> 71 72 #include "iwl-trans.h" 73 #include "iwl-op-mode.h" 74 #include "fw/img.h" 75 #include "iwl-debug.h" 76 #include "iwl-csr.h" /* for iwl_mvm_rx_card_state_notif */ 77 #include "iwl-io.h" /* for iwl_mvm_rx_card_state_notif */ 78 #include "iwl-prph.h" 79 #include "fw/acpi.h" 80 81 #include "mvm.h" 82 #include "fw/dbg.h" 83 #include "iwl-phy-db.h" 84 #include "iwl-modparams.h" 85 #include "iwl-nvm-parse.h" 86 87 #define MVM_UCODE_ALIVE_TIMEOUT HZ 88 #define MVM_UCODE_CALIB_TIMEOUT (2*HZ) 89 90 #define UCODE_VALID_OK cpu_to_le32(0x1) 91 92 struct iwl_mvm_alive_data { 93 bool valid; 94 u32 scd_base_addr; 95 }; 96 97 static int iwl_send_tx_ant_cfg(struct iwl_mvm *mvm, u8 valid_tx_ant) 98 { 99 struct iwl_tx_ant_cfg_cmd tx_ant_cmd = { 100 .valid = cpu_to_le32(valid_tx_ant), 101 }; 102 103 IWL_DEBUG_FW(mvm, "select valid tx ant: %u\n", valid_tx_ant); 104 return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, 0, 105 sizeof(tx_ant_cmd), &tx_ant_cmd); 106 } 107 108 static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm) 109 { 110 int i; 111 struct iwl_rss_config_cmd cmd = { 112 .flags = cpu_to_le32(IWL_RSS_ENABLE), 113 .hash_mask = IWL_RSS_HASH_TYPE_IPV4_TCP | 114 IWL_RSS_HASH_TYPE_IPV4_UDP | 115 IWL_RSS_HASH_TYPE_IPV4_PAYLOAD | 116 IWL_RSS_HASH_TYPE_IPV6_TCP | 117 IWL_RSS_HASH_TYPE_IPV6_UDP | 118 IWL_RSS_HASH_TYPE_IPV6_PAYLOAD, 119 }; 120 121 if (mvm->trans->num_rx_queues == 1) 122 return 0; 123 124 /* Do not direct RSS traffic to Q 0 which is our fallback queue */ 125 for (i = 0; i < ARRAY_SIZE(cmd.indirection_table); i++) 126 cmd.indirection_table[i] = 127 1 + (i % (mvm->trans->num_rx_queues - 1)); 128 netdev_rss_key_fill(cmd.secret_key, sizeof(cmd.secret_key)); 129 130 return iwl_mvm_send_cmd_pdu(mvm, RSS_CONFIG_CMD, 0, sizeof(cmd), &cmd); 131 } 132 133 static int iwl_mvm_send_dqa_cmd(struct iwl_mvm *mvm) 134 { 135 struct iwl_dqa_enable_cmd dqa_cmd = { 136 .cmd_queue = cpu_to_le32(IWL_MVM_DQA_CMD_QUEUE), 137 }; 138 u32 cmd_id = iwl_cmd_id(DQA_ENABLE_CMD, DATA_PATH_GROUP, 0); 139 int ret; 140 141 ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, sizeof(dqa_cmd), &dqa_cmd); 142 if (ret) 143 IWL_ERR(mvm, "Failed to send DQA enabling command: %d\n", ret); 144 else 145 IWL_DEBUG_FW(mvm, "Working in DQA mode\n"); 146 147 return ret; 148 } 149 150 void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm, 151 struct iwl_rx_cmd_buffer *rxb) 152 { 153 struct iwl_rx_packet *pkt = rxb_addr(rxb); 154 struct iwl_mfu_assert_dump_notif *mfu_dump_notif = (void *)pkt->data; 155 __le32 *dump_data = mfu_dump_notif->data; 156 int n_words = le32_to_cpu(mfu_dump_notif->data_size) / sizeof(__le32); 157 int i; 158 159 if (mfu_dump_notif->index_num == 0) 160 IWL_INFO(mvm, "MFUART assert id 0x%x occurred\n", 161 le32_to_cpu(mfu_dump_notif->assert_id)); 162 163 for (i = 0; i < n_words; i++) 164 IWL_DEBUG_INFO(mvm, 165 "MFUART assert dump, dword %u: 0x%08x\n", 166 le16_to_cpu(mfu_dump_notif->index_num) * 167 n_words + i, 168 le32_to_cpu(dump_data[i])); 169 } 170 171 static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait, 172 struct iwl_rx_packet *pkt, void *data) 173 { 174 struct iwl_mvm *mvm = 175 container_of(notif_wait, struct iwl_mvm, notif_wait); 176 struct iwl_mvm_alive_data *alive_data = data; 177 struct mvm_alive_resp_v3 *palive3; 178 struct mvm_alive_resp *palive; 179 struct iwl_umac_alive *umac; 180 struct iwl_lmac_alive *lmac1; 181 struct iwl_lmac_alive *lmac2 = NULL; 182 u16 status; 183 u32 umac_error_event_table; 184 185 if (iwl_rx_packet_payload_len(pkt) == sizeof(*palive)) { 186 palive = (void *)pkt->data; 187 umac = &palive->umac_data; 188 lmac1 = &palive->lmac_data[0]; 189 lmac2 = &palive->lmac_data[1]; 190 status = le16_to_cpu(palive->status); 191 } else { 192 palive3 = (void *)pkt->data; 193 umac = &palive3->umac_data; 194 lmac1 = &palive3->lmac_data; 195 status = le16_to_cpu(palive3->status); 196 } 197 198 mvm->error_event_table[0] = le32_to_cpu(lmac1->error_event_table_ptr); 199 if (lmac2) 200 mvm->error_event_table[1] = 201 le32_to_cpu(lmac2->error_event_table_ptr); 202 mvm->log_event_table = le32_to_cpu(lmac1->log_event_table_ptr); 203 204 umac_error_event_table = le32_to_cpu(umac->error_info_addr); 205 206 if (!umac_error_event_table) { 207 mvm->support_umac_log = false; 208 } else if (umac_error_event_table >= 209 mvm->trans->cfg->min_umac_error_event_table) { 210 mvm->support_umac_log = true; 211 mvm->umac_error_event_table = umac_error_event_table; 212 } else { 213 IWL_ERR(mvm, 214 "Not valid error log pointer 0x%08X for %s uCode\n", 215 mvm->umac_error_event_table, 216 (mvm->fwrt.cur_fw_img == IWL_UCODE_INIT) ? 217 "Init" : "RT"); 218 mvm->support_umac_log = false; 219 } 220 221 alive_data->scd_base_addr = le32_to_cpu(lmac1->scd_base_ptr); 222 alive_data->valid = status == IWL_ALIVE_STATUS_OK; 223 224 IWL_DEBUG_FW(mvm, 225 "Alive ucode status 0x%04x revision 0x%01X 0x%01X\n", 226 status, lmac1->ver_type, lmac1->ver_subtype); 227 228 if (lmac2) 229 IWL_DEBUG_FW(mvm, "Alive ucode CDB\n"); 230 231 IWL_DEBUG_FW(mvm, 232 "UMAC version: Major - 0x%x, Minor - 0x%x\n", 233 le32_to_cpu(umac->umac_major), 234 le32_to_cpu(umac->umac_minor)); 235 236 return true; 237 } 238 239 static bool iwl_wait_init_complete(struct iwl_notif_wait_data *notif_wait, 240 struct iwl_rx_packet *pkt, void *data) 241 { 242 WARN_ON(pkt->hdr.cmd != INIT_COMPLETE_NOTIF); 243 244 return true; 245 } 246 247 static bool iwl_wait_phy_db_entry(struct iwl_notif_wait_data *notif_wait, 248 struct iwl_rx_packet *pkt, void *data) 249 { 250 struct iwl_phy_db *phy_db = data; 251 252 if (pkt->hdr.cmd != CALIB_RES_NOTIF_PHY_DB) { 253 WARN_ON(pkt->hdr.cmd != INIT_COMPLETE_NOTIF); 254 return true; 255 } 256 257 WARN_ON(iwl_phy_db_set_section(phy_db, pkt)); 258 259 return false; 260 } 261 262 static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm, 263 enum iwl_ucode_type ucode_type) 264 { 265 struct iwl_notification_wait alive_wait; 266 struct iwl_mvm_alive_data alive_data; 267 const struct fw_img *fw; 268 int ret, i; 269 enum iwl_ucode_type old_type = mvm->fwrt.cur_fw_img; 270 static const u16 alive_cmd[] = { MVM_ALIVE }; 271 272 if (ucode_type == IWL_UCODE_REGULAR && 273 iwl_fw_dbg_conf_usniffer(mvm->fw, FW_DBG_START_FROM_ALIVE) && 274 !(fw_has_capa(&mvm->fw->ucode_capa, 275 IWL_UCODE_TLV_CAPA_USNIFFER_UNIFIED))) 276 fw = iwl_get_ucode_image(mvm->fw, IWL_UCODE_REGULAR_USNIFFER); 277 else 278 fw = iwl_get_ucode_image(mvm->fw, ucode_type); 279 if (WARN_ON(!fw)) 280 return -EINVAL; 281 iwl_fw_set_current_image(&mvm->fwrt, ucode_type); 282 clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); 283 284 iwl_init_notification_wait(&mvm->notif_wait, &alive_wait, 285 alive_cmd, ARRAY_SIZE(alive_cmd), 286 iwl_alive_fn, &alive_data); 287 288 ret = iwl_trans_start_fw(mvm->trans, fw, ucode_type == IWL_UCODE_INIT); 289 if (ret) { 290 iwl_fw_set_current_image(&mvm->fwrt, old_type); 291 iwl_remove_notification(&mvm->notif_wait, &alive_wait); 292 return ret; 293 } 294 295 /* 296 * Some things may run in the background now, but we 297 * just wait for the ALIVE notification here. 298 */ 299 ret = iwl_wait_notification(&mvm->notif_wait, &alive_wait, 300 MVM_UCODE_ALIVE_TIMEOUT); 301 if (ret) { 302 struct iwl_trans *trans = mvm->trans; 303 304 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_22000) 305 IWL_ERR(mvm, 306 "SecBoot CPU1 Status: 0x%x, CPU2 Status: 0x%x\n", 307 iwl_read_prph(trans, UMAG_SB_CPU_1_STATUS), 308 iwl_read_prph(trans, UMAG_SB_CPU_2_STATUS)); 309 else if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_8000) 310 IWL_ERR(mvm, 311 "SecBoot CPU1 Status: 0x%x, CPU2 Status: 0x%x\n", 312 iwl_read_prph(trans, SB_CPU_1_STATUS), 313 iwl_read_prph(trans, SB_CPU_2_STATUS)); 314 iwl_fw_set_current_image(&mvm->fwrt, old_type); 315 return ret; 316 } 317 318 if (!alive_data.valid) { 319 IWL_ERR(mvm, "Loaded ucode is not valid!\n"); 320 iwl_fw_set_current_image(&mvm->fwrt, old_type); 321 return -EIO; 322 } 323 324 iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr); 325 326 /* 327 * Note: all the queues are enabled as part of the interface 328 * initialization, but in firmware restart scenarios they 329 * could be stopped, so wake them up. In firmware restart, 330 * mac80211 will have the queues stopped as well until the 331 * reconfiguration completes. During normal startup, they 332 * will be empty. 333 */ 334 335 memset(&mvm->queue_info, 0, sizeof(mvm->queue_info)); 336 mvm->queue_info[IWL_MVM_DQA_CMD_QUEUE].hw_queue_refcount = 1; 337 338 for (i = 0; i < IEEE80211_MAX_QUEUES; i++) 339 atomic_set(&mvm->mac80211_queue_stop_count[i], 0); 340 341 set_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); 342 343 return 0; 344 } 345 346 static int iwl_run_unified_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) 347 { 348 struct iwl_notification_wait init_wait; 349 struct iwl_nvm_access_complete_cmd nvm_complete = {}; 350 struct iwl_init_extended_cfg_cmd init_cfg = { 351 .init_flags = cpu_to_le32(BIT(IWL_INIT_NVM)), 352 }; 353 static const u16 init_complete[] = { 354 INIT_COMPLETE_NOTIF, 355 }; 356 int ret; 357 358 lockdep_assert_held(&mvm->mutex); 359 360 iwl_init_notification_wait(&mvm->notif_wait, 361 &init_wait, 362 init_complete, 363 ARRAY_SIZE(init_complete), 364 iwl_wait_init_complete, 365 NULL); 366 367 /* Will also start the device */ 368 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR); 369 if (ret) { 370 IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret); 371 goto error; 372 } 373 374 /* Send init config command to mark that we are sending NVM access 375 * commands 376 */ 377 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(SYSTEM_GROUP, 378 INIT_EXTENDED_CFG_CMD), 0, 379 sizeof(init_cfg), &init_cfg); 380 if (ret) { 381 IWL_ERR(mvm, "Failed to run init config command: %d\n", 382 ret); 383 goto error; 384 } 385 386 /* Load NVM to NIC if needed */ 387 if (mvm->nvm_file_name) { 388 iwl_read_external_nvm(mvm->trans, mvm->nvm_file_name, 389 mvm->nvm_sections); 390 iwl_mvm_load_nvm_to_nic(mvm); 391 } 392 393 if (IWL_MVM_PARSE_NVM && read_nvm) { 394 ret = iwl_nvm_init(mvm); 395 if (ret) { 396 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); 397 goto error; 398 } 399 } 400 401 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(REGULATORY_AND_NVM_GROUP, 402 NVM_ACCESS_COMPLETE), 0, 403 sizeof(nvm_complete), &nvm_complete); 404 if (ret) { 405 IWL_ERR(mvm, "Failed to run complete NVM access: %d\n", 406 ret); 407 goto error; 408 } 409 410 /* We wait for the INIT complete notification */ 411 ret = iwl_wait_notification(&mvm->notif_wait, &init_wait, 412 MVM_UCODE_ALIVE_TIMEOUT); 413 if (ret) 414 return ret; 415 416 /* Read the NVM only at driver load time, no need to do this twice */ 417 if (!IWL_MVM_PARSE_NVM && read_nvm) { 418 mvm->nvm_data = iwl_get_nvm(mvm->trans, mvm->fw); 419 if (IS_ERR(mvm->nvm_data)) { 420 ret = PTR_ERR(mvm->nvm_data); 421 mvm->nvm_data = NULL; 422 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); 423 return ret; 424 } 425 } 426 427 return 0; 428 429 error: 430 iwl_remove_notification(&mvm->notif_wait, &init_wait); 431 return ret; 432 } 433 434 static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm) 435 { 436 struct iwl_phy_cfg_cmd phy_cfg_cmd; 437 enum iwl_ucode_type ucode_type = mvm->fwrt.cur_fw_img; 438 439 /* Set parameters */ 440 phy_cfg_cmd.phy_cfg = cpu_to_le32(iwl_mvm_get_phy_config(mvm)); 441 442 /* set flags extra PHY configuration flags from the device's cfg */ 443 phy_cfg_cmd.phy_cfg |= cpu_to_le32(mvm->cfg->extra_phy_cfg_flags); 444 445 phy_cfg_cmd.calib_control.event_trigger = 446 mvm->fw->default_calib[ucode_type].event_trigger; 447 phy_cfg_cmd.calib_control.flow_trigger = 448 mvm->fw->default_calib[ucode_type].flow_trigger; 449 450 IWL_DEBUG_INFO(mvm, "Sending Phy CFG command: 0x%x\n", 451 phy_cfg_cmd.phy_cfg); 452 453 return iwl_mvm_send_cmd_pdu(mvm, PHY_CONFIGURATION_CMD, 0, 454 sizeof(phy_cfg_cmd), &phy_cfg_cmd); 455 } 456 457 int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) 458 { 459 struct iwl_notification_wait calib_wait; 460 static const u16 init_complete[] = { 461 INIT_COMPLETE_NOTIF, 462 CALIB_RES_NOTIF_PHY_DB 463 }; 464 int ret; 465 466 if (iwl_mvm_has_unified_ucode(mvm)) 467 return iwl_run_unified_mvm_ucode(mvm, true); 468 469 lockdep_assert_held(&mvm->mutex); 470 471 if (WARN_ON_ONCE(mvm->calibrating)) 472 return 0; 473 474 iwl_init_notification_wait(&mvm->notif_wait, 475 &calib_wait, 476 init_complete, 477 ARRAY_SIZE(init_complete), 478 iwl_wait_phy_db_entry, 479 mvm->phy_db); 480 481 /* Will also start the device */ 482 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_INIT); 483 if (ret) { 484 IWL_ERR(mvm, "Failed to start INIT ucode: %d\n", ret); 485 goto remove_notif; 486 } 487 488 if (mvm->cfg->device_family < IWL_DEVICE_FAMILY_8000) { 489 ret = iwl_mvm_send_bt_init_conf(mvm); 490 if (ret) 491 goto remove_notif; 492 } 493 494 /* Read the NVM only at driver load time, no need to do this twice */ 495 if (read_nvm) { 496 ret = iwl_nvm_init(mvm); 497 if (ret) { 498 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); 499 goto remove_notif; 500 } 501 } 502 503 /* In case we read the NVM from external file, load it to the NIC */ 504 if (mvm->nvm_file_name) 505 iwl_mvm_load_nvm_to_nic(mvm); 506 507 WARN_ON(iwl_nvm_check_version(mvm->nvm_data, mvm->trans)); 508 509 /* 510 * abort after reading the nvm in case RF Kill is on, we will complete 511 * the init seq later when RF kill will switch to off 512 */ 513 if (iwl_mvm_is_radio_hw_killed(mvm)) { 514 IWL_DEBUG_RF_KILL(mvm, 515 "jump over all phy activities due to RF kill\n"); 516 goto remove_notif; 517 } 518 519 mvm->calibrating = true; 520 521 /* Send TX valid antennas before triggering calibrations */ 522 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm)); 523 if (ret) 524 goto remove_notif; 525 526 ret = iwl_send_phy_cfg_cmd(mvm); 527 if (ret) { 528 IWL_ERR(mvm, "Failed to run INIT calibrations: %d\n", 529 ret); 530 goto remove_notif; 531 } 532 533 /* 534 * Some things may run in the background now, but we 535 * just wait for the calibration complete notification. 536 */ 537 ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait, 538 MVM_UCODE_CALIB_TIMEOUT); 539 if (!ret) 540 goto out; 541 542 if (iwl_mvm_is_radio_hw_killed(mvm)) { 543 IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n"); 544 ret = 0; 545 } else { 546 IWL_ERR(mvm, "Failed to run INIT calibrations: %d\n", 547 ret); 548 } 549 550 goto out; 551 552 remove_notif: 553 iwl_remove_notification(&mvm->notif_wait, &calib_wait); 554 out: 555 mvm->calibrating = false; 556 if (iwlmvm_mod_params.init_dbg && !mvm->nvm_data) { 557 /* we want to debug INIT and we have no NVM - fake */ 558 mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) + 559 sizeof(struct ieee80211_channel) + 560 sizeof(struct ieee80211_rate), 561 GFP_KERNEL); 562 if (!mvm->nvm_data) 563 return -ENOMEM; 564 mvm->nvm_data->bands[0].channels = mvm->nvm_data->channels; 565 mvm->nvm_data->bands[0].n_channels = 1; 566 mvm->nvm_data->bands[0].n_bitrates = 1; 567 mvm->nvm_data->bands[0].bitrates = 568 (void *)mvm->nvm_data->channels + 1; 569 mvm->nvm_data->bands[0].bitrates->hw_value = 10; 570 } 571 572 return ret; 573 } 574 575 static int iwl_mvm_config_ltr(struct iwl_mvm *mvm) 576 { 577 struct iwl_ltr_config_cmd cmd = { 578 .flags = cpu_to_le32(LTR_CFG_FLAG_FEATURE_ENABLE), 579 }; 580 581 if (!mvm->trans->ltr_enabled) 582 return 0; 583 584 return iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0, 585 sizeof(cmd), &cmd); 586 } 587 588 #ifdef CONFIG_ACPI 589 static int iwl_mvm_sar_set_profile(struct iwl_mvm *mvm, 590 union acpi_object *table, 591 struct iwl_mvm_sar_profile *profile, 592 bool enabled) 593 { 594 int i; 595 596 profile->enabled = enabled; 597 598 for (i = 0; i < ACPI_SAR_TABLE_SIZE; i++) { 599 if ((table[i].type != ACPI_TYPE_INTEGER) || 600 (table[i].integer.value > U8_MAX)) 601 return -EINVAL; 602 603 profile->table[i] = table[i].integer.value; 604 } 605 606 return 0; 607 } 608 609 static int iwl_mvm_sar_get_wrds_table(struct iwl_mvm *mvm) 610 { 611 union acpi_object *wifi_pkg, *table, *data; 612 bool enabled; 613 int ret; 614 615 data = iwl_acpi_get_object(mvm->dev, ACPI_WRDS_METHOD); 616 if (IS_ERR(data)) 617 return PTR_ERR(data); 618 619 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, 620 ACPI_WRDS_WIFI_DATA_SIZE); 621 if (IS_ERR(wifi_pkg)) { 622 ret = PTR_ERR(wifi_pkg); 623 goto out_free; 624 } 625 626 if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) { 627 ret = -EINVAL; 628 goto out_free; 629 } 630 631 enabled = !!(wifi_pkg->package.elements[1].integer.value); 632 633 /* position of the actual table */ 634 table = &wifi_pkg->package.elements[2]; 635 636 /* The profile from WRDS is officially profile 1, but goes 637 * into sar_profiles[0] (because we don't have a profile 0). 638 */ 639 ret = iwl_mvm_sar_set_profile(mvm, table, &mvm->sar_profiles[0], 640 enabled); 641 out_free: 642 kfree(data); 643 return ret; 644 } 645 646 static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm *mvm) 647 { 648 union acpi_object *wifi_pkg, *data; 649 bool enabled; 650 int i, n_profiles, ret; 651 652 data = iwl_acpi_get_object(mvm->dev, ACPI_EWRD_METHOD); 653 if (IS_ERR(data)) 654 return PTR_ERR(data); 655 656 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, 657 ACPI_EWRD_WIFI_DATA_SIZE); 658 if (IS_ERR(wifi_pkg)) { 659 ret = PTR_ERR(wifi_pkg); 660 goto out_free; 661 } 662 663 if ((wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) || 664 (wifi_pkg->package.elements[2].type != ACPI_TYPE_INTEGER)) { 665 ret = -EINVAL; 666 goto out_free; 667 } 668 669 enabled = !!(wifi_pkg->package.elements[1].integer.value); 670 n_profiles = wifi_pkg->package.elements[2].integer.value; 671 672 /* in case of BIOS bug */ 673 if (n_profiles <= 0) { 674 ret = -EINVAL; 675 goto out_free; 676 } 677 678 for (i = 0; i < n_profiles; i++) { 679 /* the tables start at element 3 */ 680 static int pos = 3; 681 682 /* The EWRD profiles officially go from 2 to 4, but we 683 * save them in sar_profiles[1-3] (because we don't 684 * have profile 0). So in the array we start from 1. 685 */ 686 ret = iwl_mvm_sar_set_profile(mvm, 687 &wifi_pkg->package.elements[pos], 688 &mvm->sar_profiles[i + 1], 689 enabled); 690 if (ret < 0) 691 break; 692 693 /* go to the next table */ 694 pos += ACPI_SAR_TABLE_SIZE; 695 } 696 697 out_free: 698 kfree(data); 699 return ret; 700 } 701 702 static int iwl_mvm_sar_get_wgds_table(struct iwl_mvm *mvm) 703 { 704 union acpi_object *wifi_pkg, *data; 705 int i, j, ret; 706 int idx = 1; 707 708 data = iwl_acpi_get_object(mvm->dev, ACPI_WGDS_METHOD); 709 if (IS_ERR(data)) 710 return PTR_ERR(data); 711 712 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, 713 ACPI_WGDS_WIFI_DATA_SIZE); 714 if (IS_ERR(wifi_pkg)) { 715 ret = PTR_ERR(wifi_pkg); 716 goto out_free; 717 } 718 719 for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) { 720 for (j = 0; j < ACPI_GEO_TABLE_SIZE; j++) { 721 union acpi_object *entry; 722 723 entry = &wifi_pkg->package.elements[idx++]; 724 if ((entry->type != ACPI_TYPE_INTEGER) || 725 (entry->integer.value > U8_MAX)) { 726 ret = -EINVAL; 727 goto out_free; 728 } 729 730 mvm->geo_profiles[i].values[j] = entry->integer.value; 731 } 732 } 733 ret = 0; 734 out_free: 735 kfree(data); 736 return ret; 737 } 738 739 int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b) 740 { 741 struct iwl_dev_tx_power_cmd cmd = { 742 .v3.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_CHAINS), 743 }; 744 int i, j, idx; 745 int profs[ACPI_SAR_NUM_CHAIN_LIMITS] = { prof_a, prof_b }; 746 int len = sizeof(cmd); 747 748 BUILD_BUG_ON(ACPI_SAR_NUM_CHAIN_LIMITS < 2); 749 BUILD_BUG_ON(ACPI_SAR_NUM_CHAIN_LIMITS * ACPI_SAR_NUM_SUB_BANDS != 750 ACPI_SAR_TABLE_SIZE); 751 752 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TX_POWER_ACK)) 753 len = sizeof(cmd.v3); 754 755 for (i = 0; i < ACPI_SAR_NUM_CHAIN_LIMITS; i++) { 756 struct iwl_mvm_sar_profile *prof; 757 758 /* don't allow SAR to be disabled (profile 0 means disable) */ 759 if (profs[i] == 0) 760 return -EPERM; 761 762 /* we are off by one, so allow up to ACPI_SAR_PROFILE_NUM */ 763 if (profs[i] > ACPI_SAR_PROFILE_NUM) 764 return -EINVAL; 765 766 /* profiles go from 1 to 4, so decrement to access the array */ 767 prof = &mvm->sar_profiles[profs[i] - 1]; 768 769 /* if the profile is disabled, do nothing */ 770 if (!prof->enabled) { 771 IWL_DEBUG_RADIO(mvm, "SAR profile %d is disabled.\n", 772 profs[i]); 773 /* if one of the profiles is disabled, we fail all */ 774 return -ENOENT; 775 } 776 777 IWL_DEBUG_RADIO(mvm, " Chain[%d]:\n", i); 778 for (j = 0; j < ACPI_SAR_NUM_SUB_BANDS; j++) { 779 idx = (i * ACPI_SAR_NUM_SUB_BANDS) + j; 780 cmd.v3.per_chain_restriction[i][j] = 781 cpu_to_le16(prof->table[idx]); 782 IWL_DEBUG_RADIO(mvm, " Band[%d] = %d * .125dBm\n", 783 j, prof->table[idx]); 784 } 785 } 786 787 IWL_DEBUG_RADIO(mvm, "Sending REDUCE_TX_POWER_CMD per chain\n"); 788 789 return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, &cmd); 790 } 791 792 int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm) 793 { 794 struct iwl_geo_tx_power_profiles_resp *resp; 795 int ret; 796 797 struct iwl_geo_tx_power_profiles_cmd geo_cmd = { 798 .ops = cpu_to_le32(IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE), 799 }; 800 struct iwl_host_cmd cmd = { 801 .id = WIDE_ID(PHY_OPS_GROUP, GEO_TX_POWER_LIMIT), 802 .len = { sizeof(geo_cmd), }, 803 .flags = CMD_WANT_SKB, 804 .data = { &geo_cmd }, 805 }; 806 807 ret = iwl_mvm_send_cmd(mvm, &cmd); 808 if (ret) { 809 IWL_ERR(mvm, "Failed to get geographic profile info %d\n", ret); 810 return ret; 811 } 812 813 resp = (void *)cmd.resp_pkt->data; 814 ret = le32_to_cpu(resp->profile_idx); 815 if (WARN_ON(ret > ACPI_NUM_GEO_PROFILES)) { 816 ret = -EIO; 817 IWL_WARN(mvm, "Invalid geographic profile idx (%d)\n", ret); 818 } 819 820 iwl_free_resp(&cmd); 821 return ret; 822 } 823 824 static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) 825 { 826 struct iwl_geo_tx_power_profiles_cmd cmd = { 827 .ops = cpu_to_le32(IWL_PER_CHAIN_OFFSET_SET_TABLES), 828 }; 829 int ret, i, j; 830 u16 cmd_wide_id = WIDE_ID(PHY_OPS_GROUP, GEO_TX_POWER_LIMIT); 831 832 ret = iwl_mvm_sar_get_wgds_table(mvm); 833 if (ret < 0) { 834 IWL_DEBUG_RADIO(mvm, 835 "Geo SAR BIOS table invalid or unavailable. (%d)\n", 836 ret); 837 /* we don't fail if the table is not available */ 838 return 0; 839 } 840 841 IWL_DEBUG_RADIO(mvm, "Sending GEO_TX_POWER_LIMIT\n"); 842 843 BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES * ACPI_WGDS_NUM_BANDS * 844 ACPI_WGDS_TABLE_SIZE != ACPI_WGDS_WIFI_DATA_SIZE); 845 846 BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES > IWL_NUM_GEO_PROFILES); 847 848 for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) { 849 struct iwl_per_chain_offset *chain = 850 (struct iwl_per_chain_offset *)&cmd.table[i]; 851 852 for (j = 0; j < ACPI_WGDS_NUM_BANDS; j++) { 853 u8 *value; 854 855 value = &mvm->geo_profiles[i].values[j * 856 ACPI_GEO_PER_CHAIN_SIZE]; 857 chain[j].max_tx_power = cpu_to_le16(value[0]); 858 chain[j].chain_a = value[1]; 859 chain[j].chain_b = value[2]; 860 IWL_DEBUG_RADIO(mvm, 861 "SAR geographic profile[%d] Band[%d]: chain A = %d chain B = %d max_tx_power = %d\n", 862 i, j, value[1], value[2], value[0]); 863 } 864 } 865 return iwl_mvm_send_cmd_pdu(mvm, cmd_wide_id, 0, sizeof(cmd), &cmd); 866 } 867 868 #else /* CONFIG_ACPI */ 869 static int iwl_mvm_sar_get_wrds_table(struct iwl_mvm *mvm) 870 { 871 return -ENOENT; 872 } 873 874 static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm *mvm) 875 { 876 return -ENOENT; 877 } 878 879 static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) 880 { 881 return 0; 882 } 883 884 int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, 885 int prof_b) 886 { 887 return -ENOENT; 888 } 889 890 int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm) 891 { 892 return -ENOENT; 893 } 894 #endif /* CONFIG_ACPI */ 895 896 static int iwl_mvm_sar_init(struct iwl_mvm *mvm) 897 { 898 int ret; 899 900 ret = iwl_mvm_sar_get_wrds_table(mvm); 901 if (ret < 0) { 902 IWL_DEBUG_RADIO(mvm, 903 "WRDS SAR BIOS table invalid or unavailable. (%d)\n", 904 ret); 905 /* if not available, don't fail and don't bother with EWRD */ 906 return 0; 907 } 908 909 ret = iwl_mvm_sar_get_ewrd_table(mvm); 910 /* if EWRD is not available, we can still use WRDS, so don't fail */ 911 if (ret < 0) 912 IWL_DEBUG_RADIO(mvm, 913 "EWRD SAR BIOS table invalid or unavailable. (%d)\n", 914 ret); 915 916 /* choose profile 1 (WRDS) as default for both chains */ 917 ret = iwl_mvm_sar_select_profile(mvm, 1, 1); 918 919 /* if we don't have profile 0 from BIOS, just skip it */ 920 if (ret == -ENOENT) 921 return 0; 922 923 return ret; 924 } 925 926 static int iwl_mvm_load_rt_fw(struct iwl_mvm *mvm) 927 { 928 int ret; 929 930 if (iwl_mvm_has_unified_ucode(mvm)) 931 return iwl_run_unified_mvm_ucode(mvm, false); 932 933 ret = iwl_run_init_mvm_ucode(mvm, false); 934 935 if (ret) { 936 IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret); 937 938 if (iwlmvm_mod_params.init_dbg) 939 return 0; 940 return ret; 941 } 942 943 /* 944 * Stop and start the transport without entering low power 945 * mode. This will save the state of other components on the 946 * device that are triggered by the INIT firwmare (MFUART). 947 */ 948 _iwl_trans_stop_device(mvm->trans, false); 949 ret = _iwl_trans_start_hw(mvm->trans, false); 950 if (ret) 951 return ret; 952 953 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR); 954 if (ret) 955 return ret; 956 957 return iwl_init_paging(&mvm->fwrt, mvm->fwrt.cur_fw_img); 958 } 959 960 int iwl_mvm_up(struct iwl_mvm *mvm) 961 { 962 int ret, i; 963 struct ieee80211_channel *chan; 964 struct cfg80211_chan_def chandef; 965 966 lockdep_assert_held(&mvm->mutex); 967 968 ret = iwl_trans_start_hw(mvm->trans); 969 if (ret) 970 return ret; 971 972 ret = iwl_mvm_load_rt_fw(mvm); 973 if (ret) { 974 IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret); 975 goto error; 976 } 977 978 iwl_get_shared_mem_conf(&mvm->fwrt); 979 980 ret = iwl_mvm_sf_update(mvm, NULL, false); 981 if (ret) 982 IWL_ERR(mvm, "Failed to initialize Smart Fifo\n"); 983 984 mvm->fwrt.dump.conf = FW_DBG_INVALID; 985 /* if we have a destination, assume EARLY START */ 986 if (mvm->fw->dbg_dest_tlv) 987 mvm->fwrt.dump.conf = FW_DBG_START_FROM_ALIVE; 988 iwl_fw_start_dbg_conf(&mvm->fwrt, FW_DBG_START_FROM_ALIVE); 989 990 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm)); 991 if (ret) 992 goto error; 993 994 if (!iwl_mvm_has_unified_ucode(mvm)) { 995 /* Send phy db control command and then phy db calibration */ 996 ret = iwl_send_phy_db_data(mvm->phy_db); 997 if (ret) 998 goto error; 999 1000 ret = iwl_send_phy_cfg_cmd(mvm); 1001 if (ret) 1002 goto error; 1003 } 1004 1005 ret = iwl_mvm_send_bt_init_conf(mvm); 1006 if (ret) 1007 goto error; 1008 1009 /* Init RSS configuration */ 1010 /* TODO - remove 22000 disablement when we have RXQ config API */ 1011 if (iwl_mvm_has_new_rx_api(mvm) && 1012 mvm->trans->cfg->device_family != IWL_DEVICE_FAMILY_22000) { 1013 ret = iwl_send_rss_cfg_cmd(mvm); 1014 if (ret) { 1015 IWL_ERR(mvm, "Failed to configure RSS queues: %d\n", 1016 ret); 1017 goto error; 1018 } 1019 } 1020 1021 /* init the fw <-> mac80211 STA mapping */ 1022 for (i = 0; i < ARRAY_SIZE(mvm->fw_id_to_mac_id); i++) 1023 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL); 1024 1025 mvm->tdls_cs.peer.sta_id = IWL_MVM_INVALID_STA; 1026 1027 /* reset quota debouncing buffer - 0xff will yield invalid data */ 1028 memset(&mvm->last_quota_cmd, 0xff, sizeof(mvm->last_quota_cmd)); 1029 1030 ret = iwl_mvm_send_dqa_cmd(mvm); 1031 if (ret) 1032 goto error; 1033 1034 /* Add auxiliary station for scanning */ 1035 ret = iwl_mvm_add_aux_sta(mvm); 1036 if (ret) 1037 goto error; 1038 1039 /* Add all the PHY contexts */ 1040 chan = &mvm->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[0]; 1041 cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT); 1042 for (i = 0; i < NUM_PHY_CTX; i++) { 1043 /* 1044 * The channel used here isn't relevant as it's 1045 * going to be overwritten in the other flows. 1046 * For now use the first channel we have. 1047 */ 1048 ret = iwl_mvm_phy_ctxt_add(mvm, &mvm->phy_ctxts[i], 1049 &chandef, 1, 1); 1050 if (ret) 1051 goto error; 1052 } 1053 1054 #ifdef CONFIG_THERMAL 1055 if (iwl_mvm_is_tt_in_fw(mvm)) { 1056 /* in order to give the responsibility of ct-kill and 1057 * TX backoff to FW we need to send empty temperature reporting 1058 * cmd during init time 1059 */ 1060 iwl_mvm_send_temp_report_ths_cmd(mvm); 1061 } else { 1062 /* Initialize tx backoffs to the minimal possible */ 1063 iwl_mvm_tt_tx_backoff(mvm, 0); 1064 } 1065 1066 /* TODO: read the budget from BIOS / Platform NVM */ 1067 1068 /* 1069 * In case there is no budget from BIOS / Platform NVM the default 1070 * budget should be 2000mW (cooling state 0). 1071 */ 1072 if (iwl_mvm_is_ctdp_supported(mvm)) { 1073 ret = iwl_mvm_ctdp_command(mvm, CTDP_CMD_OPERATION_START, 1074 mvm->cooling_dev.cur_state); 1075 if (ret) 1076 goto error; 1077 } 1078 #else 1079 /* Initialize tx backoffs to the minimal possible */ 1080 iwl_mvm_tt_tx_backoff(mvm, 0); 1081 #endif 1082 1083 WARN_ON(iwl_mvm_config_ltr(mvm)); 1084 1085 ret = iwl_mvm_power_update_device(mvm); 1086 if (ret) 1087 goto error; 1088 1089 /* 1090 * RTNL is not taken during Ct-kill, but we don't need to scan/Tx 1091 * anyway, so don't init MCC. 1092 */ 1093 if (!test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status)) { 1094 ret = iwl_mvm_init_mcc(mvm); 1095 if (ret) 1096 goto error; 1097 } 1098 1099 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { 1100 mvm->scan_type = IWL_SCAN_TYPE_NOT_SET; 1101 mvm->hb_scan_type = IWL_SCAN_TYPE_NOT_SET; 1102 ret = iwl_mvm_config_scan(mvm); 1103 if (ret) 1104 goto error; 1105 } 1106 1107 /* allow FW/transport low power modes if not during restart */ 1108 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) 1109 iwl_mvm_unref(mvm, IWL_MVM_REF_UCODE_DOWN); 1110 1111 ret = iwl_mvm_sar_init(mvm); 1112 if (ret) 1113 goto error; 1114 1115 ret = iwl_mvm_sar_geo_init(mvm); 1116 if (ret) 1117 goto error; 1118 1119 iwl_mvm_leds_sync(mvm); 1120 1121 IWL_DEBUG_INFO(mvm, "RT uCode started.\n"); 1122 return 0; 1123 error: 1124 if (!iwlmvm_mod_params.init_dbg || !ret) 1125 iwl_mvm_stop_device(mvm); 1126 return ret; 1127 } 1128 1129 int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm) 1130 { 1131 int ret, i; 1132 1133 lockdep_assert_held(&mvm->mutex); 1134 1135 ret = iwl_trans_start_hw(mvm->trans); 1136 if (ret) 1137 return ret; 1138 1139 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_WOWLAN); 1140 if (ret) { 1141 IWL_ERR(mvm, "Failed to start WoWLAN firmware: %d\n", ret); 1142 goto error; 1143 } 1144 1145 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm)); 1146 if (ret) 1147 goto error; 1148 1149 /* Send phy db control command and then phy db calibration*/ 1150 ret = iwl_send_phy_db_data(mvm->phy_db); 1151 if (ret) 1152 goto error; 1153 1154 ret = iwl_send_phy_cfg_cmd(mvm); 1155 if (ret) 1156 goto error; 1157 1158 /* init the fw <-> mac80211 STA mapping */ 1159 for (i = 0; i < ARRAY_SIZE(mvm->fw_id_to_mac_id); i++) 1160 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL); 1161 1162 /* Add auxiliary station for scanning */ 1163 ret = iwl_mvm_add_aux_sta(mvm); 1164 if (ret) 1165 goto error; 1166 1167 return 0; 1168 error: 1169 iwl_mvm_stop_device(mvm); 1170 return ret; 1171 } 1172 1173 void iwl_mvm_rx_card_state_notif(struct iwl_mvm *mvm, 1174 struct iwl_rx_cmd_buffer *rxb) 1175 { 1176 struct iwl_rx_packet *pkt = rxb_addr(rxb); 1177 struct iwl_card_state_notif *card_state_notif = (void *)pkt->data; 1178 u32 flags = le32_to_cpu(card_state_notif->flags); 1179 1180 IWL_DEBUG_RF_KILL(mvm, "Card state received: HW:%s SW:%s CT:%s\n", 1181 (flags & HW_CARD_DISABLED) ? "Kill" : "On", 1182 (flags & SW_CARD_DISABLED) ? "Kill" : "On", 1183 (flags & CT_KILL_CARD_DISABLED) ? 1184 "Reached" : "Not reached"); 1185 } 1186 1187 void iwl_mvm_rx_mfuart_notif(struct iwl_mvm *mvm, 1188 struct iwl_rx_cmd_buffer *rxb) 1189 { 1190 struct iwl_rx_packet *pkt = rxb_addr(rxb); 1191 struct iwl_mfuart_load_notif *mfuart_notif = (void *)pkt->data; 1192 1193 IWL_DEBUG_INFO(mvm, 1194 "MFUART: installed ver: 0x%08x, external ver: 0x%08x, status: 0x%08x, duration: 0x%08x\n", 1195 le32_to_cpu(mfuart_notif->installed_ver), 1196 le32_to_cpu(mfuart_notif->external_ver), 1197 le32_to_cpu(mfuart_notif->status), 1198 le32_to_cpu(mfuart_notif->duration)); 1199 1200 if (iwl_rx_packet_payload_len(pkt) == sizeof(*mfuart_notif)) 1201 IWL_DEBUG_INFO(mvm, 1202 "MFUART: image size: 0x%08x\n", 1203 le32_to_cpu(mfuart_notif->image_size)); 1204 } 1205