blob: 70d0505a176ee2d9bebc04d969d652b667cf15b2 [file] [log] [blame]
Johannes Berg8ca151b2013-01-24 14:25:36 +01001/******************************************************************************
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 *
Emmanuel Grumbach51368bf2013-12-30 13:15:54 +02008 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
Eran Harary8d193ca2015-04-27 10:29:31 +03009 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
Golan Ben-Amibdccdb82016-11-15 14:45:29 +020010 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
Johannes Berg8ca151b2013-01-24 14:25:36 +010011 *
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
Emmanuel Grumbach410dc5a2013-02-18 09:22:28 +020027 * in the file called COPYING.
Johannes Berg8ca151b2013-01-24 14:25:36 +010028 *
29 * Contact Information:
Emmanuel Grumbachcb2f8272015-11-17 15:39:56 +020030 * Intel Linux Wireless <linuxwifi@intel.com>
Johannes Berg8ca151b2013-01-24 14:25:36 +010031 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
32 *
33 * BSD LICENSE
34 *
Emmanuel Grumbach51368bf2013-12-30 13:15:54 +020035 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
Eran Harary8d193ca2015-04-27 10:29:31 +030036 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
Golan Ben-Amibdccdb82016-11-15 14:45:29 +020037 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
Johannes Berg8ca151b2013-01-24 14:25:36 +010038 * All rights reserved.
39 *
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions
42 * are met:
43 *
44 * * Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 * * Redistributions in binary form must reproduce the above copyright
47 * notice, this list of conditions and the following disclaimer in
48 * the documentation and/or other materials provided with the
49 * distribution.
50 * * Neither the name Intel Corporation nor the names of its
51 * contributors may be used to endorse or promote products derived
52 * from this software without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
55 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
56 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
57 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
58 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
59 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
60 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
61 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
62 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
63 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
64 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65 *
66 *****************************************************************************/
67#include <net/mac80211.h>
Sara Sharon854d7732016-03-22 15:55:58 +020068#include <linux/netdevice.h>
Johannes Berg8ca151b2013-01-24 14:25:36 +010069
70#include "iwl-trans.h"
71#include "iwl-op-mode.h"
Johannes Bergd962f9b2017-06-01 10:22:09 +020072#include "fw/img.h"
Johannes Berg8ca151b2013-01-24 14:25:36 +010073#include "iwl-debug.h"
74#include "iwl-csr.h" /* for iwl_mvm_rx_card_state_notif */
75#include "iwl-io.h" /* for iwl_mvm_rx_card_state_notif */
Emmanuel Grumbach8c23f952014-12-04 10:07:47 +020076#include "iwl-prph.h"
Luca Coelho813df5c2017-09-19 12:35:18 +030077#include "fw/acpi.h"
Johannes Berg8ca151b2013-01-24 14:25:36 +010078
79#include "mvm.h"
Johannes Berg7174beb2017-06-01 16:03:19 +020080#include "fw/dbg.h"
Johannes Berg8ca151b2013-01-24 14:25:36 +010081#include "iwl-phy-db.h"
82
83#define MVM_UCODE_ALIVE_TIMEOUT HZ
84#define MVM_UCODE_CALIB_TIMEOUT (2*HZ)
85
86#define UCODE_VALID_OK cpu_to_le32(0x1)
87
Johannes Berg8ca151b2013-01-24 14:25:36 +010088struct iwl_mvm_alive_data {
89 bool valid;
90 u32 scd_base_addr;
91};
92
Johannes Berg8ca151b2013-01-24 14:25:36 +010093static int iwl_send_tx_ant_cfg(struct iwl_mvm *mvm, u8 valid_tx_ant)
94{
95 struct iwl_tx_ant_cfg_cmd tx_ant_cmd = {
96 .valid = cpu_to_le32(valid_tx_ant),
97 };
98
Emmanuel Grumbach33223542013-03-09 20:38:19 +020099 IWL_DEBUG_FW(mvm, "select valid tx ant: %u\n", valid_tx_ant);
Emmanuel Grumbacha1022922014-05-12 11:36:41 +0300100 return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, 0,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100101 sizeof(tx_ant_cmd), &tx_ant_cmd);
102}
103
Sara Sharon43413a92015-12-31 11:49:18 +0200104static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm)
105{
106 int i;
107 struct iwl_rss_config_cmd cmd = {
108 .flags = cpu_to_le32(IWL_RSS_ENABLE),
109 .hash_mask = IWL_RSS_HASH_TYPE_IPV4_TCP |
Sara Sharon854d7732016-03-22 15:55:58 +0200110 IWL_RSS_HASH_TYPE_IPV4_UDP |
Sara Sharon43413a92015-12-31 11:49:18 +0200111 IWL_RSS_HASH_TYPE_IPV4_PAYLOAD |
112 IWL_RSS_HASH_TYPE_IPV6_TCP |
Sara Sharon854d7732016-03-22 15:55:58 +0200113 IWL_RSS_HASH_TYPE_IPV6_UDP |
Sara Sharon43413a92015-12-31 11:49:18 +0200114 IWL_RSS_HASH_TYPE_IPV6_PAYLOAD,
115 };
116
Sara Sharonf43495f2016-05-04 14:22:10 +0300117 if (mvm->trans->num_rx_queues == 1)
118 return 0;
119
Sara Sharon854d7732016-03-22 15:55:58 +0200120 /* Do not direct RSS traffic to Q 0 which is our fallback queue */
Sara Sharon43413a92015-12-31 11:49:18 +0200121 for (i = 0; i < ARRAY_SIZE(cmd.indirection_table); i++)
Sara Sharon854d7732016-03-22 15:55:58 +0200122 cmd.indirection_table[i] =
123 1 + (i % (mvm->trans->num_rx_queues - 1));
124 netdev_rss_key_fill(cmd.secret_key, sizeof(cmd.secret_key));
Sara Sharon43413a92015-12-31 11:49:18 +0200125
126 return iwl_mvm_send_cmd_pdu(mvm, RSS_CONFIG_CMD, 0, sizeof(cmd), &cmd);
127}
128
Liad Kaufman97d5be72015-08-31 14:33:23 +0300129static int iwl_mvm_send_dqa_cmd(struct iwl_mvm *mvm)
130{
131 struct iwl_dqa_enable_cmd dqa_cmd = {
132 .cmd_queue = cpu_to_le32(IWL_MVM_DQA_CMD_QUEUE),
133 };
134 u32 cmd_id = iwl_cmd_id(DQA_ENABLE_CMD, DATA_PATH_GROUP, 0);
135 int ret;
136
137 ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, sizeof(dqa_cmd), &dqa_cmd);
138 if (ret)
139 IWL_ERR(mvm, "Failed to send DQA enabling command: %d\n", ret);
140 else
141 IWL_DEBUG_FW(mvm, "Working in DQA mode\n");
142
143 return ret;
144}
145
Golan Ben-Amibdccdb82016-11-15 14:45:29 +0200146void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm,
147 struct iwl_rx_cmd_buffer *rxb)
148{
149 struct iwl_rx_packet *pkt = rxb_addr(rxb);
150 struct iwl_mfu_assert_dump_notif *mfu_dump_notif = (void *)pkt->data;
151 __le32 *dump_data = mfu_dump_notif->data;
152 int n_words = le32_to_cpu(mfu_dump_notif->data_size) / sizeof(__le32);
153 int i;
154
155 if (mfu_dump_notif->index_num == 0)
156 IWL_INFO(mvm, "MFUART assert id 0x%x occurred\n",
157 le32_to_cpu(mfu_dump_notif->assert_id));
158
159 for (i = 0; i < n_words; i++)
160 IWL_DEBUG_INFO(mvm,
161 "MFUART assert dump, dword %u: 0x%08x\n",
162 le16_to_cpu(mfu_dump_notif->index_num) *
163 n_words + i,
164 le32_to_cpu(dump_data[i]));
165}
166
Johannes Berg8ca151b2013-01-24 14:25:36 +0100167static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait,
168 struct iwl_rx_packet *pkt, void *data)
169{
170 struct iwl_mvm *mvm =
171 container_of(notif_wait, struct iwl_mvm, notif_wait);
172 struct iwl_mvm_alive_data *alive_data = data;
Sara Sharon5c228d62016-11-24 13:48:27 +0200173 struct mvm_alive_resp_v3 *palive3;
Emmanuel Grumbach7e1223b2015-02-03 20:11:48 +0200174 struct mvm_alive_resp *palive;
Sara Sharon5c228d62016-11-24 13:48:27 +0200175 struct iwl_umac_alive *umac;
176 struct iwl_lmac_alive *lmac1;
177 struct iwl_lmac_alive *lmac2 = NULL;
178 u16 status;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100179
Sara Sharon5c228d62016-11-24 13:48:27 +0200180 if (iwl_rx_packet_payload_len(pkt) == sizeof(*palive)) {
Emmanuel Grumbach7e1223b2015-02-03 20:11:48 +0200181 palive = (void *)pkt->data;
Sara Sharon5c228d62016-11-24 13:48:27 +0200182 umac = &palive->umac_data;
183 lmac1 = &palive->lmac_data[0];
184 lmac2 = &palive->lmac_data[1];
185 status = le16_to_cpu(palive->status);
186 } else {
187 palive3 = (void *)pkt->data;
188 umac = &palive3->umac_data;
189 lmac1 = &palive3->lmac_data;
190 status = le16_to_cpu(palive3->status);
Eran Harary01a9ca52014-02-03 09:29:57 +0200191 }
Johannes Berg8ca151b2013-01-24 14:25:36 +0100192
Sara Sharon5c228d62016-11-24 13:48:27 +0200193 mvm->error_event_table[0] = le32_to_cpu(lmac1->error_event_table_ptr);
194 if (lmac2)
195 mvm->error_event_table[1] =
196 le32_to_cpu(lmac2->error_event_table_ptr);
197 mvm->log_event_table = le32_to_cpu(lmac1->log_event_table_ptr);
198 mvm->sf_space.addr = le32_to_cpu(lmac1->st_fwrd_addr);
199 mvm->sf_space.size = le32_to_cpu(lmac1->st_fwrd_size);
200
201 mvm->umac_error_event_table = le32_to_cpu(umac->error_info_addr);
202
Luca Coelhofb5b2842017-10-02 15:44:20 +0300203 if (mvm->umac_error_event_table <
204 (mvm->trans->cfg->device_family == IWL_DEVICE_FAMILY_A000 ?
205 0x400000 : 0x800000))
206 IWL_ERR(mvm,
207 "Not valid error log pointer 0x%08X for %s uCode\n",
208 mvm->umac_error_event_table,
209 (mvm->fwrt.cur_fw_img == IWL_UCODE_INIT) ?
210 "Init" : "RT");
211 else
212 mvm->support_umac_log = true;
213
Sara Sharon5c228d62016-11-24 13:48:27 +0200214 alive_data->scd_base_addr = le32_to_cpu(lmac1->scd_base_ptr);
215 alive_data->valid = status == IWL_ALIVE_STATUS_OK;
Sara Sharon5c228d62016-11-24 13:48:27 +0200216
217 IWL_DEBUG_FW(mvm,
218 "Alive ucode status 0x%04x revision 0x%01X 0x%01X\n",
219 status, lmac1->ver_type, lmac1->ver_subtype);
220
221 if (lmac2)
222 IWL_DEBUG_FW(mvm, "Alive ucode CDB\n");
223
224 IWL_DEBUG_FW(mvm,
225 "UMAC version: Major - 0x%x, Minor - 0x%x\n",
226 le32_to_cpu(umac->umac_major),
227 le32_to_cpu(umac->umac_minor));
228
Johannes Berg8ca151b2013-01-24 14:25:36 +0100229 return true;
230}
231
Sara Sharon1f370652016-08-31 18:13:57 +0300232static bool iwl_wait_init_complete(struct iwl_notif_wait_data *notif_wait,
233 struct iwl_rx_packet *pkt, void *data)
234{
235 WARN_ON(pkt->hdr.cmd != INIT_COMPLETE_NOTIF);
236
237 return true;
238}
239
Johannes Berg8ca151b2013-01-24 14:25:36 +0100240static bool iwl_wait_phy_db_entry(struct iwl_notif_wait_data *notif_wait,
241 struct iwl_rx_packet *pkt, void *data)
242{
243 struct iwl_phy_db *phy_db = data;
244
245 if (pkt->hdr.cmd != CALIB_RES_NOTIF_PHY_DB) {
246 WARN_ON(pkt->hdr.cmd != INIT_COMPLETE_NOTIF);
247 return true;
248 }
249
Sara Sharonce1f2772016-04-10 16:02:12 +0300250 WARN_ON(iwl_phy_db_set_section(phy_db, pkt));
Johannes Berg8ca151b2013-01-24 14:25:36 +0100251
252 return false;
253}
254
255static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
256 enum iwl_ucode_type ucode_type)
257{
258 struct iwl_notification_wait alive_wait;
259 struct iwl_mvm_alive_data alive_data;
260 const struct fw_img *fw;
261 int ret, i;
Johannes Berg702e9752017-06-02 11:56:58 +0200262 enum iwl_ucode_type old_type = mvm->fwrt.cur_fw_img;
Sara Sharon6eb031d2015-07-13 14:50:47 +0300263 static const u16 alive_cmd[] = { MVM_ALIVE };
Eran Harary91479b62014-05-11 08:11:34 +0300264 struct iwl_sf_region st_fwrd_space;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100265
Eran Harary61df7502014-12-01 17:40:37 +0200266 if (ucode_type == IWL_UCODE_REGULAR &&
Golan Ben-Ami3d2d4422016-02-23 10:34:48 +0200267 iwl_fw_dbg_conf_usniffer(mvm->fw, FW_DBG_START_FROM_ALIVE) &&
268 !(fw_has_capa(&mvm->fw->ucode_capa,
269 IWL_UCODE_TLV_CAPA_USNIFFER_UNIFIED)))
Sharon Dvir612da1e2016-08-03 10:55:45 +0300270 fw = iwl_get_ucode_image(mvm->fw, IWL_UCODE_REGULAR_USNIFFER);
Eran Harary61df7502014-12-01 17:40:37 +0200271 else
Sharon Dvir612da1e2016-08-03 10:55:45 +0300272 fw = iwl_get_ucode_image(mvm->fw, ucode_type);
Johannes Bergbefe9b62013-10-25 12:32:51 +0200273 if (WARN_ON(!fw))
Johannes Berg8ca151b2013-01-24 14:25:36 +0100274 return -EINVAL;
Johannes Berg702e9752017-06-02 11:56:58 +0200275 iwl_fw_set_current_image(&mvm->fwrt, ucode_type);
Johannes Berg65b280f2017-03-22 22:10:36 +0100276 clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100277
278 iwl_init_notification_wait(&mvm->notif_wait, &alive_wait,
279 alive_cmd, ARRAY_SIZE(alive_cmd),
280 iwl_alive_fn, &alive_data);
281
282 ret = iwl_trans_start_fw(mvm->trans, fw, ucode_type == IWL_UCODE_INIT);
283 if (ret) {
Johannes Berg702e9752017-06-02 11:56:58 +0200284 iwl_fw_set_current_image(&mvm->fwrt, old_type);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100285 iwl_remove_notification(&mvm->notif_wait, &alive_wait);
286 return ret;
287 }
288
289 /*
290 * Some things may run in the background now, but we
291 * just wait for the ALIVE notification here.
292 */
293 ret = iwl_wait_notification(&mvm->notif_wait, &alive_wait,
294 MVM_UCODE_ALIVE_TIMEOUT);
295 if (ret) {
Sara Sharond6be9c12017-01-12 11:31:25 +0200296 struct iwl_trans *trans = mvm->trans;
297
Sara Sharon6e584872017-03-22 14:07:50 +0200298 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_A000)
Dor Shaish192de2b2015-07-15 11:41:21 +0300299 IWL_ERR(mvm,
300 "SecBoot CPU1 Status: 0x%x, CPU2 Status: 0x%x\n",
Sara Sharond6be9c12017-01-12 11:31:25 +0200301 iwl_read_prph(trans, UMAG_SB_CPU_1_STATUS),
302 iwl_read_prph(trans, UMAG_SB_CPU_2_STATUS));
Sara Sharon6e584872017-03-22 14:07:50 +0200303 else if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_8000)
Sara Sharond6be9c12017-01-12 11:31:25 +0200304 IWL_ERR(mvm,
305 "SecBoot CPU1 Status: 0x%x, CPU2 Status: 0x%x\n",
306 iwl_read_prph(trans, SB_CPU_1_STATUS),
307 iwl_read_prph(trans, SB_CPU_2_STATUS));
Johannes Berg702e9752017-06-02 11:56:58 +0200308 iwl_fw_set_current_image(&mvm->fwrt, old_type);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100309 return ret;
310 }
311
312 if (!alive_data.valid) {
313 IWL_ERR(mvm, "Loaded ucode is not valid!\n");
Johannes Berg702e9752017-06-02 11:56:58 +0200314 iwl_fw_set_current_image(&mvm->fwrt, old_type);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100315 return -EIO;
316 }
317
Eran Harary91479b62014-05-11 08:11:34 +0300318 /*
319 * update the sdio allocation according to the pointer we get in the
320 * alive notification.
321 */
322 st_fwrd_space.addr = mvm->sf_space.addr;
323 st_fwrd_space.size = mvm->sf_space.size;
324 ret = iwl_trans_update_sf(mvm->trans, &st_fwrd_space);
Eyal Shapira82e8aea2014-10-19 14:56:40 +0300325 if (ret) {
326 IWL_ERR(mvm, "Failed to update SF size. ret %d\n", ret);
327 return ret;
328 }
Eran Harary91479b62014-05-11 08:11:34 +0300329
Johannes Berg8ca151b2013-01-24 14:25:36 +0100330 iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr);
331
332 /*
333 * Note: all the queues are enabled as part of the interface
334 * initialization, but in firmware restart scenarios they
335 * could be stopped, so wake them up. In firmware restart,
336 * mac80211 will have the queues stopped as well until the
337 * reconfiguration completes. During normal startup, they
338 * will be empty.
339 */
340
Liad Kaufman4ecafae2015-07-14 13:36:18 +0300341 memset(&mvm->queue_info, 0, sizeof(mvm->queue_info));
Johannes Bergc8f54702017-06-19 23:50:31 +0200342 mvm->queue_info[IWL_MVM_DQA_CMD_QUEUE].hw_queue_refcount = 1;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100343
Johannes Bergdf197c02014-08-01 18:14:45 +0200344 for (i = 0; i < IEEE80211_MAX_QUEUES; i++)
345 atomic_set(&mvm->mac80211_queue_stop_count[i], 0);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100346
Johannes Berg65b280f2017-03-22 22:10:36 +0100347 set_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100348
349 return 0;
350}
Johannes Berg8ca151b2013-01-24 14:25:36 +0100351
Johannes Berg8c5f47b2017-02-20 17:47:04 +0100352static int iwl_run_unified_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
353{
354 struct iwl_notification_wait init_wait;
355 struct iwl_nvm_access_complete_cmd nvm_complete = {};
356 struct iwl_init_extended_cfg_cmd init_cfg = {
357 .init_flags = cpu_to_le32(BIT(IWL_INIT_NVM)),
358 };
359 static const u16 init_complete[] = {
360 INIT_COMPLETE_NOTIF,
361 };
362 int ret;
363
364 lockdep_assert_held(&mvm->mutex);
365
366 iwl_init_notification_wait(&mvm->notif_wait,
367 &init_wait,
368 init_complete,
369 ARRAY_SIZE(init_complete),
370 iwl_wait_init_complete,
371 NULL);
372
373 /* Will also start the device */
374 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR);
375 if (ret) {
376 IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret);
377 goto error;
378 }
379
380 /* Send init config command to mark that we are sending NVM access
381 * commands
382 */
383 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(SYSTEM_GROUP,
384 INIT_EXTENDED_CFG_CMD), 0,
385 sizeof(init_cfg), &init_cfg);
386 if (ret) {
387 IWL_ERR(mvm, "Failed to run init config command: %d\n",
388 ret);
389 goto error;
390 }
391
Sara Sharone9e1ba32017-01-08 16:46:14 +0200392 /* Load NVM to NIC if needed */
393 if (mvm->nvm_file_name) {
394 iwl_mvm_read_external_nvm(mvm);
Johannes Berg8c5f47b2017-02-20 17:47:04 +0100395 iwl_mvm_load_nvm_to_nic(mvm);
Sara Sharone9e1ba32017-01-08 16:46:14 +0200396 }
Johannes Berg8c5f47b2017-02-20 17:47:04 +0100397
Sara Sharond4f36952017-03-06 11:13:02 +0200398 if (IWL_MVM_PARSE_NVM && read_nvm) {
Luca Coelho5bd1d2c2017-08-15 18:46:44 +0300399 ret = iwl_nvm_init(mvm);
Sara Sharond4f36952017-03-06 11:13:02 +0200400 if (ret) {
401 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret);
402 goto error;
403 }
404 }
405
Johannes Berg8c5f47b2017-02-20 17:47:04 +0100406 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(REGULATORY_AND_NVM_GROUP,
407 NVM_ACCESS_COMPLETE), 0,
408 sizeof(nvm_complete), &nvm_complete);
409 if (ret) {
410 IWL_ERR(mvm, "Failed to run complete NVM access: %d\n",
411 ret);
412 goto error;
413 }
414
415 /* We wait for the INIT complete notification */
Sara Sharone9e1ba32017-01-08 16:46:14 +0200416 ret = iwl_wait_notification(&mvm->notif_wait, &init_wait,
417 MVM_UCODE_ALIVE_TIMEOUT);
418 if (ret)
419 return ret;
420
421 /* Read the NVM only at driver load time, no need to do this twice */
Sara Sharond4f36952017-03-06 11:13:02 +0200422 if (!IWL_MVM_PARSE_NVM && read_nvm) {
Shaul Triebitzc135cb52017-06-22 17:09:08 +0300423 mvm->nvm_data = iwl_fw_get_nvm(&mvm->fwrt);
424 if (IS_ERR(mvm->nvm_data)) {
425 ret = PTR_ERR(mvm->nvm_data);
426 mvm->nvm_data = NULL;
Sara Sharone9e1ba32017-01-08 16:46:14 +0200427 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret);
428 return ret;
429 }
430 }
431
432 return 0;
Johannes Berg8c5f47b2017-02-20 17:47:04 +0100433
434error:
435 iwl_remove_notification(&mvm->notif_wait, &init_wait);
436 return ret;
437}
438
Johannes Berg8ca151b2013-01-24 14:25:36 +0100439static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm)
440{
441 struct iwl_phy_cfg_cmd phy_cfg_cmd;
Johannes Berg702e9752017-06-02 11:56:58 +0200442 enum iwl_ucode_type ucode_type = mvm->fwrt.cur_fw_img;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100443
444 /* Set parameters */
Moshe Harela0544272014-12-08 21:13:14 +0200445 phy_cfg_cmd.phy_cfg = cpu_to_le32(iwl_mvm_get_phy_config(mvm));
Johannes Berg8ca151b2013-01-24 14:25:36 +0100446 phy_cfg_cmd.calib_control.event_trigger =
447 mvm->fw->default_calib[ucode_type].event_trigger;
448 phy_cfg_cmd.calib_control.flow_trigger =
449 mvm->fw->default_calib[ucode_type].flow_trigger;
450
451 IWL_DEBUG_INFO(mvm, "Sending Phy CFG command: 0x%x\n",
452 phy_cfg_cmd.phy_cfg);
453
Emmanuel Grumbacha1022922014-05-12 11:36:41 +0300454 return iwl_mvm_send_cmd_pdu(mvm, PHY_CONFIGURATION_CMD, 0,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100455 sizeof(phy_cfg_cmd), &phy_cfg_cmd);
456}
457
Johannes Berg8ca151b2013-01-24 14:25:36 +0100458int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
459{
460 struct iwl_notification_wait calib_wait;
Sara Sharon6eb031d2015-07-13 14:50:47 +0300461 static const u16 init_complete[] = {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100462 INIT_COMPLETE_NOTIF,
463 CALIB_RES_NOTIF_PHY_DB
464 };
465 int ret;
466
Johannes Berg7d6222e22017-06-08 09:18:22 +0200467 if (iwl_mvm_has_unified_ucode(mvm))
Johannes Berg8c5f47b2017-02-20 17:47:04 +0100468 return iwl_run_unified_mvm_ucode(mvm, true);
469
Johannes Berg8ca151b2013-01-24 14:25:36 +0100470 lockdep_assert_held(&mvm->mutex);
471
Eran Harary8d193ca2015-04-27 10:29:31 +0300472 if (WARN_ON_ONCE(mvm->calibrating))
Johannes Berg8ca151b2013-01-24 14:25:36 +0100473 return 0;
474
475 iwl_init_notification_wait(&mvm->notif_wait,
476 &calib_wait,
477 init_complete,
478 ARRAY_SIZE(init_complete),
479 iwl_wait_phy_db_entry,
480 mvm->phy_db);
481
482 /* Will also start the device */
483 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_INIT);
484 if (ret) {
485 IWL_ERR(mvm, "Failed to start INIT ucode: %d\n", ret);
Luca Coelho00e0c6c2017-07-24 14:47:52 +0300486 goto remove_notif;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100487 }
488
Emmanuel Grumbachb3de3ef2017-05-29 14:01:06 +0300489 if (mvm->cfg->device_family < IWL_DEVICE_FAMILY_8000) {
490 ret = iwl_mvm_send_bt_init_conf(mvm);
491 if (ret)
Luca Coelho00e0c6c2017-07-24 14:47:52 +0300492 goto remove_notif;
Emmanuel Grumbachb3de3ef2017-05-29 14:01:06 +0300493 }
Emmanuel Grumbach931d4162013-01-17 09:42:25 +0200494
Eytan Lifshitz81a67e32013-09-11 12:39:18 +0200495 /* Read the NVM only at driver load time, no need to do this twice */
Johannes Berg8ca151b2013-01-24 14:25:36 +0100496 if (read_nvm) {
Luca Coelho5bd1d2c2017-08-15 18:46:44 +0300497 ret = iwl_nvm_init(mvm);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100498 if (ret) {
499 IWL_ERR(mvm, "Failed to read NVM: %d\n", ret);
Luca Coelho00e0c6c2017-07-24 14:47:52 +0300500 goto remove_notif;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100501 }
502 }
503
Eytan Lifshitz81a67e32013-09-11 12:39:18 +0200504 /* In case we read the NVM from external file, load it to the NIC */
Eran Hararye02a9d62014-05-07 12:27:10 +0300505 if (mvm->nvm_file_name)
Eytan Lifshitz81a67e32013-09-11 12:39:18 +0200506 iwl_mvm_load_nvm_to_nic(mvm);
507
Luca Coelho00e0c6c2017-07-24 14:47:52 +0300508 WARN_ON(iwl_nvm_check_version(mvm->nvm_data, mvm->trans));
Johannes Berg8ca151b2013-01-24 14:25:36 +0100509
Eran Harary4f593342013-05-13 07:53:26 +0300510 /*
511 * abort after reading the nvm in case RF Kill is on, we will complete
512 * the init seq later when RF kill will switch to off
513 */
Arik Nemtsov1a3fe0b2015-09-30 11:19:55 +0300514 if (iwl_mvm_is_radio_hw_killed(mvm)) {
Eran Harary4f593342013-05-13 07:53:26 +0300515 IWL_DEBUG_RF_KILL(mvm,
516 "jump over all phy activities due to RF kill\n");
Luca Coelho00e0c6c2017-07-24 14:47:52 +0300517 goto remove_notif;
Eran Harary4f593342013-05-13 07:53:26 +0300518 }
519
Emmanuel Grumbach31b8b342014-11-02 15:48:09 +0200520 mvm->calibrating = true;
521
Dor Shaishe07cbb52013-02-27 23:00:27 +0200522 /* Send TX valid antennas before triggering calibrations */
Moshe Harela0544272014-12-08 21:13:14 +0200523 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm));
Dor Shaishe07cbb52013-02-27 23:00:27 +0200524 if (ret)
Luca Coelho00e0c6c2017-07-24 14:47:52 +0300525 goto remove_notif;
Dor Shaishe07cbb52013-02-27 23:00:27 +0200526
Johannes Berg8ca151b2013-01-24 14:25:36 +0100527 ret = iwl_send_phy_cfg_cmd(mvm);
528 if (ret) {
529 IWL_ERR(mvm, "Failed to run INIT calibrations: %d\n",
530 ret);
Luca Coelho00e0c6c2017-07-24 14:47:52 +0300531 goto remove_notif;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100532 }
533
534 /*
535 * Some things may run in the background now, but we
536 * just wait for the calibration complete notification.
537 */
538 ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait,
Luca Coelho00e0c6c2017-07-24 14:47:52 +0300539 MVM_UCODE_CALIB_TIMEOUT);
540 if (!ret)
541 goto out;
Emmanuel Grumbach31b8b342014-11-02 15:48:09 +0200542
Luca Coelho00e0c6c2017-07-24 14:47:52 +0300543 if (iwl_mvm_is_radio_hw_killed(mvm)) {
Emmanuel Grumbach31b8b342014-11-02 15:48:09 +0200544 IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n");
Luca Coelho00e0c6c2017-07-24 14:47:52 +0300545 ret = 0;
546 } else {
547 IWL_ERR(mvm, "Failed to run INIT calibrations: %d\n",
548 ret);
Emmanuel Grumbach31b8b342014-11-02 15:48:09 +0200549 }
Luca Coelho00e0c6c2017-07-24 14:47:52 +0300550
Johannes Berg8ca151b2013-01-24 14:25:36 +0100551 goto out;
552
Luca Coelho00e0c6c2017-07-24 14:47:52 +0300553remove_notif:
Johannes Berg8ca151b2013-01-24 14:25:36 +0100554 iwl_remove_notification(&mvm->notif_wait, &calib_wait);
555out:
Emmanuel Grumbach31b8b342014-11-02 15:48:09 +0200556 mvm->calibrating = false;
Arik Nemtsova4082842013-11-24 19:10:46 +0200557 if (iwlmvm_mod_params.init_dbg && !mvm->nvm_data) {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100558 /* we want to debug INIT and we have no NVM - fake */
559 mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) +
560 sizeof(struct ieee80211_channel) +
561 sizeof(struct ieee80211_rate),
562 GFP_KERNEL);
563 if (!mvm->nvm_data)
564 return -ENOMEM;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100565 mvm->nvm_data->bands[0].channels = mvm->nvm_data->channels;
566 mvm->nvm_data->bands[0].n_channels = 1;
567 mvm->nvm_data->bands[0].n_bitrates = 1;
568 mvm->nvm_data->bands[0].bitrates =
569 (void *)mvm->nvm_data->channels + 1;
570 mvm->nvm_data->bands[0].bitrates->hw_value = 10;
571 }
572
573 return ret;
574}
575
Emmanuel Grumbach84bfffa2015-01-13 10:16:30 +0200576static int iwl_mvm_config_ltr(struct iwl_mvm *mvm)
577{
578 struct iwl_ltr_config_cmd cmd = {
579 .flags = cpu_to_le32(LTR_CFG_FLAG_FEATURE_ENABLE),
580 };
581
582 if (!mvm->trans->ltr_enabled)
583 return 0;
584
Emmanuel Grumbach84bfffa2015-01-13 10:16:30 +0200585 return iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0,
586 sizeof(cmd), &cmd);
587}
588
Luca Coelhoda2830a2016-05-30 13:00:44 +0300589#ifdef CONFIG_ACPI
Haim Dreyfussc386dac2016-12-28 15:58:22 +0200590static int iwl_mvm_sar_set_profile(struct iwl_mvm *mvm,
591 union acpi_object *table,
592 struct iwl_mvm_sar_profile *profile,
593 bool enabled)
Luca Coelhoda2830a2016-05-30 13:00:44 +0300594{
Haim Dreyfussc386dac2016-12-28 15:58:22 +0200595 int i;
Luca Coelhoda2830a2016-05-30 13:00:44 +0300596
Haim Dreyfussc386dac2016-12-28 15:58:22 +0200597 profile->enabled = enabled;
Luca Coelhoda2830a2016-05-30 13:00:44 +0300598
Luca Coelhoe7a3b8d2017-09-21 13:22:59 +0300599 for (i = 0; i < ACPI_SAR_TABLE_SIZE; i++) {
Haim Dreyfussc386dac2016-12-28 15:58:22 +0200600 if ((table[i].type != ACPI_TYPE_INTEGER) ||
601 (table[i].integer.value > U8_MAX))
Luca Coelhoda2830a2016-05-30 13:00:44 +0300602 return -EINVAL;
603
Haim Dreyfussc386dac2016-12-28 15:58:22 +0200604 profile->table[i] = table[i].integer.value;
Luca Coelhoda2830a2016-05-30 13:00:44 +0300605 }
606
607 return 0;
608}
609
Haim Dreyfussc386dac2016-12-28 15:58:22 +0200610static int iwl_mvm_sar_get_wrds_table(struct iwl_mvm *mvm)
611{
Luca Coelho813df5c2017-09-19 12:35:18 +0300612 union acpi_object *wifi_pkg, *table, *data;
Haim Dreyfussc386dac2016-12-28 15:58:22 +0200613 bool enabled;
Luca Coelhoda2830a2016-05-30 13:00:44 +0300614 int ret;
615
Luca Coelho813df5c2017-09-19 12:35:18 +0300616 data = iwl_acpi_get_object(mvm->dev, ACPI_WRDS_METHOD);
617 if (IS_ERR(data))
618 return PTR_ERR(data);
Luca Coelhoda2830a2016-05-30 13:00:44 +0300619
Luca Coelho2fa388c2017-09-21 14:30:53 +0300620 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data,
621 ACPI_WRDS_WIFI_DATA_SIZE);
Haim Dreyfussc386dac2016-12-28 15:58:22 +0200622 if (IS_ERR(wifi_pkg)) {
623 ret = PTR_ERR(wifi_pkg);
624 goto out_free;
625 }
Luca Coelhoda2830a2016-05-30 13:00:44 +0300626
Haim Dreyfussc386dac2016-12-28 15:58:22 +0200627 if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) {
628 ret = -EINVAL;
629 goto out_free;
630 }
631
632 enabled = !!(wifi_pkg->package.elements[1].integer.value);
633
634 /* position of the actual table */
635 table = &wifi_pkg->package.elements[2];
636
637 /* The profile from WRDS is officially profile 1, but goes
638 * into sar_profiles[0] (because we don't have a profile 0).
639 */
640 ret = iwl_mvm_sar_set_profile(mvm, table, &mvm->sar_profiles[0],
641 enabled);
Haim Dreyfussc386dac2016-12-28 15:58:22 +0200642out_free:
Luca Coelho813df5c2017-09-19 12:35:18 +0300643 kfree(data);
Luca Coelhoda2830a2016-05-30 13:00:44 +0300644 return ret;
645}
Luca Coelhoda2830a2016-05-30 13:00:44 +0300646
Luca Coelho69964902017-01-12 12:43:12 +0200647static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm *mvm)
648{
Luca Coelho813df5c2017-09-19 12:35:18 +0300649 union acpi_object *wifi_pkg, *data;
Luca Coelho69964902017-01-12 12:43:12 +0200650 bool enabled;
651 int i, n_profiles, ret;
652
Luca Coelho813df5c2017-09-19 12:35:18 +0300653 data = iwl_acpi_get_object(mvm->dev, ACPI_EWRD_METHOD);
654 if (IS_ERR(data))
655 return PTR_ERR(data);
Luca Coelho69964902017-01-12 12:43:12 +0200656
Luca Coelho2fa388c2017-09-21 14:30:53 +0300657 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data,
658 ACPI_EWRD_WIFI_DATA_SIZE);
Luca Coelho69964902017-01-12 12:43:12 +0200659 if (IS_ERR(wifi_pkg)) {
660 ret = PTR_ERR(wifi_pkg);
661 goto out_free;
662 }
663
664 if ((wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) ||
665 (wifi_pkg->package.elements[2].type != ACPI_TYPE_INTEGER)) {
666 ret = -EINVAL;
667 goto out_free;
668 }
669
670 enabled = !!(wifi_pkg->package.elements[1].integer.value);
671 n_profiles = wifi_pkg->package.elements[2].integer.value;
672
Sharon Dvire2ef1472017-02-21 11:12:12 +0200673 /* in case of BIOS bug */
674 if (n_profiles <= 0) {
675 ret = -EINVAL;
676 goto out_free;
677 }
678
Luca Coelho69964902017-01-12 12:43:12 +0200679 for (i = 0; i < n_profiles; i++) {
680 /* the tables start at element 3 */
681 static int pos = 3;
682
683 /* The EWRD profiles officially go from 2 to 4, but we
684 * save them in sar_profiles[1-3] (because we don't
685 * have profile 0). So in the array we start from 1.
686 */
687 ret = iwl_mvm_sar_set_profile(mvm,
688 &wifi_pkg->package.elements[pos],
689 &mvm->sar_profiles[i + 1],
690 enabled);
691 if (ret < 0)
692 break;
693
694 /* go to the next table */
Luca Coelhoe7a3b8d2017-09-21 13:22:59 +0300695 pos += ACPI_SAR_TABLE_SIZE;
Luca Coelho69964902017-01-12 12:43:12 +0200696 }
697
698out_free:
Luca Coelho813df5c2017-09-19 12:35:18 +0300699 kfree(data);
Luca Coelho69964902017-01-12 12:43:12 +0200700 return ret;
701}
702
Haim Dreyfuss7fe90e02017-03-30 11:16:17 +0300703static int iwl_mvm_sar_get_wgds_table(struct iwl_mvm *mvm)
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200704{
Luca Coelho813df5c2017-09-19 12:35:18 +0300705 union acpi_object *wifi_pkg, *data;
Haim Dreyfuss7fe90e02017-03-30 11:16:17 +0300706 int i, j, ret;
707 int idx = 1;
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200708
Luca Coelho813df5c2017-09-19 12:35:18 +0300709 data = iwl_acpi_get_object(mvm->dev, ACPI_WGDS_METHOD);
710 if (IS_ERR(data))
711 return PTR_ERR(data);
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200712
Luca Coelho2fa388c2017-09-21 14:30:53 +0300713 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data,
714 ACPI_WGDS_WIFI_DATA_SIZE);
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200715 if (IS_ERR(wifi_pkg)) {
716 ret = PTR_ERR(wifi_pkg);
717 goto out_free;
718 }
719
Luca Coelhoe7a3b8d2017-09-21 13:22:59 +0300720 for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) {
721 for (j = 0; j < ACPI_GEO_TABLE_SIZE; j++) {
Haim Dreyfuss7fe90e02017-03-30 11:16:17 +0300722 union acpi_object *entry;
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200723
Haim Dreyfuss7fe90e02017-03-30 11:16:17 +0300724 entry = &wifi_pkg->package.elements[idx++];
725 if ((entry->type != ACPI_TYPE_INTEGER) ||
Christophe Jailletaae9d562017-07-14 12:06:59 +0200726 (entry->integer.value > U8_MAX)) {
727 ret = -EINVAL;
728 goto out_free;
729 }
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200730
Haim Dreyfuss7fe90e02017-03-30 11:16:17 +0300731 mvm->geo_profiles[i].values[j] = entry->integer.value;
732 }
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200733 }
734 ret = 0;
735out_free:
Luca Coelho813df5c2017-09-19 12:35:18 +0300736 kfree(data);
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200737 return ret;
738}
739
Luca Coelho42ce76d2017-01-11 23:36:30 +0200740int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b)
Luca Coelhoda2830a2016-05-30 13:00:44 +0300741{
Luca Coelhoda2830a2016-05-30 13:00:44 +0300742 struct iwl_dev_tx_power_cmd cmd = {
Luca Coelho4b87e5a2016-09-12 16:03:30 +0300743 .v3.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_CHAINS),
Luca Coelhoda2830a2016-05-30 13:00:44 +0300744 };
Luca Coelho42ce76d2017-01-11 23:36:30 +0200745 int i, j, idx;
Luca Coelhoe7a3b8d2017-09-21 13:22:59 +0300746 int profs[ACPI_SAR_NUM_CHAIN_LIMITS] = { prof_a, prof_b };
Luca Coelho55bfa4b2016-06-29 00:38:40 +0300747 int len = sizeof(cmd);
Luca Coelhoda2830a2016-05-30 13:00:44 +0300748
Luca Coelhoe7a3b8d2017-09-21 13:22:59 +0300749 BUILD_BUG_ON(ACPI_SAR_NUM_CHAIN_LIMITS < 2);
750 BUILD_BUG_ON(ACPI_SAR_NUM_CHAIN_LIMITS * ACPI_SAR_NUM_SUB_BANDS !=
751 ACPI_SAR_TABLE_SIZE);
Luca Coelho42ce76d2017-01-11 23:36:30 +0200752
Luca Coelho55bfa4b2016-06-29 00:38:40 +0300753 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TX_POWER_ACK))
754 len = sizeof(cmd.v3);
755
Luca Coelhoe7a3b8d2017-09-21 13:22:59 +0300756 for (i = 0; i < ACPI_SAR_NUM_CHAIN_LIMITS; i++) {
Luca Coelho42ce76d2017-01-11 23:36:30 +0200757 struct iwl_mvm_sar_profile *prof;
758
759 /* don't allow SAR to be disabled (profile 0 means disable) */
760 if (profs[i] == 0)
761 return -EPERM;
762
Luca Coelhoe7a3b8d2017-09-21 13:22:59 +0300763 /* we are off by one, so allow up to ACPI_SAR_PROFILE_NUM */
764 if (profs[i] > ACPI_SAR_PROFILE_NUM)
Luca Coelho42ce76d2017-01-11 23:36:30 +0200765 return -EINVAL;
766
767 /* profiles go from 1 to 4, so decrement to access the array */
768 prof = &mvm->sar_profiles[profs[i] - 1];
769
770 /* if the profile is disabled, do nothing */
771 if (!prof->enabled) {
772 IWL_DEBUG_RADIO(mvm, "SAR profile %d is disabled.\n",
773 profs[i]);
774 /* if one of the profiles is disabled, we fail all */
775 return -ENOENT;
776 }
777
778 IWL_DEBUG_RADIO(mvm, " Chain[%d]:\n", i);
Luca Coelhoe7a3b8d2017-09-21 13:22:59 +0300779 for (j = 0; j < ACPI_SAR_NUM_SUB_BANDS; j++) {
780 idx = (i * ACPI_SAR_NUM_SUB_BANDS) + j;
Luca Coelho42ce76d2017-01-11 23:36:30 +0200781 cmd.v3.per_chain_restriction[i][j] =
782 cpu_to_le16(prof->table[idx]);
783 IWL_DEBUG_RADIO(mvm, " Band[%d] = %d * .125dBm\n",
784 j, prof->table[idx]);
785 }
786 }
787
788 IWL_DEBUG_RADIO(mvm, "Sending REDUCE_TX_POWER_CMD per chain\n");
789
790 return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, &cmd);
791}
792
Haim Dreyfuss7fe90e02017-03-30 11:16:17 +0300793int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm)
794{
795 struct iwl_geo_tx_power_profiles_resp *resp;
796 int ret;
797
798 struct iwl_geo_tx_power_profiles_cmd geo_cmd = {
799 .ops = cpu_to_le32(IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE),
800 };
801 struct iwl_host_cmd cmd = {
802 .id = WIDE_ID(PHY_OPS_GROUP, GEO_TX_POWER_LIMIT),
803 .len = { sizeof(geo_cmd), },
804 .flags = CMD_WANT_SKB,
805 .data = { &geo_cmd },
806 };
807
808 ret = iwl_mvm_send_cmd(mvm, &cmd);
809 if (ret) {
810 IWL_ERR(mvm, "Failed to get geographic profile info %d\n", ret);
811 return ret;
812 }
813
814 resp = (void *)cmd.resp_pkt->data;
815 ret = le32_to_cpu(resp->profile_idx);
Luca Coelhoe7a3b8d2017-09-21 13:22:59 +0300816 if (WARN_ON(ret > ACPI_NUM_GEO_PROFILES)) {
Haim Dreyfuss7fe90e02017-03-30 11:16:17 +0300817 ret = -EIO;
818 IWL_WARN(mvm, "Invalid geographic profile idx (%d)\n", ret);
819 }
820
821 iwl_free_resp(&cmd);
822 return ret;
823}
824
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200825static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm)
826{
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200827 struct iwl_geo_tx_power_profiles_cmd cmd = {
828 .ops = cpu_to_le32(IWL_PER_CHAIN_OFFSET_SET_TABLES),
829 };
Haim Dreyfuss7fe90e02017-03-30 11:16:17 +0300830 int ret, i, j;
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200831 u16 cmd_wide_id = WIDE_ID(PHY_OPS_GROUP, GEO_TX_POWER_LIMIT);
832
Haim Dreyfuss7fe90e02017-03-30 11:16:17 +0300833 ret = iwl_mvm_sar_get_wgds_table(mvm);
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200834 if (ret < 0) {
835 IWL_DEBUG_RADIO(mvm,
836 "Geo SAR BIOS table invalid or unavailable. (%d)\n",
837 ret);
838 /* we don't fail if the table is not available */
839 return 0;
840 }
841
842 IWL_DEBUG_RADIO(mvm, "Sending GEO_TX_POWER_LIMIT\n");
843
Luca Coelhoe7a3b8d2017-09-21 13:22:59 +0300844 BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES * ACPI_WGDS_NUM_BANDS *
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200845 ACPI_WGDS_TABLE_SIZE != ACPI_WGDS_WIFI_DATA_SIZE);
846
Luca Coelhoe7a3b8d2017-09-21 13:22:59 +0300847 BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES > IWL_NUM_GEO_PROFILES);
848
849 for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) {
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200850 struct iwl_per_chain_offset *chain =
851 (struct iwl_per_chain_offset *)&cmd.table[i];
852
853 for (j = 0; j < ACPI_WGDS_NUM_BANDS; j++) {
854 u8 *value;
855
Haim Dreyfuss7fe90e02017-03-30 11:16:17 +0300856 value = &mvm->geo_profiles[i].values[j *
Luca Coelhoe7a3b8d2017-09-21 13:22:59 +0300857 ACPI_GEO_PER_CHAIN_SIZE];
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200858 chain[j].max_tx_power = cpu_to_le16(value[0]);
859 chain[j].chain_a = value[1];
860 chain[j].chain_b = value[2];
861 IWL_DEBUG_RADIO(mvm,
862 "SAR geographic profile[%d] Band[%d]: chain A = %d chain B = %d max_tx_power = %d\n",
863 i, j, value[1], value[2], value[0]);
864 }
865 }
866 return iwl_mvm_send_cmd_pdu(mvm, cmd_wide_id, 0, sizeof(cmd), &cmd);
867}
868
Luca Coelho69964902017-01-12 12:43:12 +0200869#else /* CONFIG_ACPI */
870static int iwl_mvm_sar_get_wrds_table(struct iwl_mvm *mvm)
871{
872 return -ENOENT;
873}
874
875static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm *mvm)
876{
877 return -ENOENT;
878}
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200879
880static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm)
881{
882 return 0;
883}
Luca Coelho18f17552017-07-26 15:20:18 +0300884
885int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a,
886 int prof_b)
887{
888 return -ENOENT;
889}
890
891int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm)
892{
893 return -ENOENT;
894}
Luca Coelho69964902017-01-12 12:43:12 +0200895#endif /* CONFIG_ACPI */
896
Luca Coelho42ce76d2017-01-11 23:36:30 +0200897static int iwl_mvm_sar_init(struct iwl_mvm *mvm)
898{
899 int ret;
900
Haim Dreyfussc386dac2016-12-28 15:58:22 +0200901 ret = iwl_mvm_sar_get_wrds_table(mvm);
Luca Coelhoda2830a2016-05-30 13:00:44 +0300902 if (ret < 0) {
903 IWL_DEBUG_RADIO(mvm,
Luca Coelho69964902017-01-12 12:43:12 +0200904 "WRDS SAR BIOS table invalid or unavailable. (%d)\n",
Luca Coelhoda2830a2016-05-30 13:00:44 +0300905 ret);
Luca Coelho69964902017-01-12 12:43:12 +0200906 /* if not available, don't fail and don't bother with EWRD */
Luca Coelhoda2830a2016-05-30 13:00:44 +0300907 return 0;
908 }
909
Luca Coelho69964902017-01-12 12:43:12 +0200910 ret = iwl_mvm_sar_get_ewrd_table(mvm);
911 /* if EWRD is not available, we can still use WRDS, so don't fail */
912 if (ret < 0)
913 IWL_DEBUG_RADIO(mvm,
914 "EWRD SAR BIOS table invalid or unavailable. (%d)\n",
915 ret);
916
Luca Coelho42ce76d2017-01-11 23:36:30 +0200917 /* choose profile 1 (WRDS) as default for both chains */
918 ret = iwl_mvm_sar_select_profile(mvm, 1, 1);
919
920 /* if we don't have profile 0 from BIOS, just skip it */
921 if (ret == -ENOENT)
Luca Coelhoda2830a2016-05-30 13:00:44 +0300922 return 0;
923
Luca Coelhoda2830a2016-05-30 13:00:44 +0300924 return ret;
925}
926
Sara Sharon1f370652016-08-31 18:13:57 +0300927static int iwl_mvm_load_rt_fw(struct iwl_mvm *mvm)
928{
929 int ret;
930
Johannes Berg7d6222e22017-06-08 09:18:22 +0200931 if (iwl_mvm_has_unified_ucode(mvm))
Sara Sharon1f370652016-08-31 18:13:57 +0300932 return iwl_run_unified_mvm_ucode(mvm, false);
933
934 ret = iwl_run_init_mvm_ucode(mvm, false);
935
936 if (iwlmvm_mod_params.init_dbg)
937 return 0;
938
939 if (ret) {
940 IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret);
Sara Sharon1f370652016-08-31 18:13:57 +0300941 return ret;
942 }
943
944 /*
945 * Stop and start the transport without entering low power
946 * mode. This will save the state of other components on the
947 * device that are triggered by the INIT firwmare (MFUART).
948 */
949 _iwl_trans_stop_device(mvm->trans, false);
950 ret = _iwl_trans_start_hw(mvm->trans, false);
951 if (ret)
952 return ret;
953
954 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR);
955 if (ret)
956 return ret;
957
Johannes Berg702e9752017-06-02 11:56:58 +0200958 return iwl_init_paging(&mvm->fwrt, mvm->fwrt.cur_fw_img);
Sara Sharon1f370652016-08-31 18:13:57 +0300959}
960
Johannes Berg8ca151b2013-01-24 14:25:36 +0100961int iwl_mvm_up(struct iwl_mvm *mvm)
962{
963 int ret, i;
Ilan Peer53a9d612013-04-28 11:55:08 +0300964 struct ieee80211_channel *chan;
965 struct cfg80211_chan_def chandef;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100966
967 lockdep_assert_held(&mvm->mutex);
968
969 ret = iwl_trans_start_hw(mvm->trans);
970 if (ret)
971 return ret;
972
Sara Sharon1f370652016-08-31 18:13:57 +0300973 ret = iwl_mvm_load_rt_fw(mvm);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100974 if (ret) {
975 IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret);
976 goto error;
977 }
978
Johannes Bergd0b813f2017-06-01 14:44:40 +0200979 iwl_get_shared_mem_conf(&mvm->fwrt);
Liad Kaufman04fd2c22014-12-15 17:54:16 +0200980
Lilach Edelstein1f3b0ff2013-10-06 13:03:32 +0200981 ret = iwl_mvm_sf_update(mvm, NULL, false);
982 if (ret)
983 IWL_ERR(mvm, "Failed to initialize Smart Fifo\n");
984
Johannes Berg7174beb2017-06-01 16:03:19 +0200985 mvm->fwrt.dump.conf = FW_DBG_INVALID;
Emmanuel Grumbach945d4202015-02-15 17:16:16 +0200986 /* if we have a destination, assume EARLY START */
987 if (mvm->fw->dbg_dest_tlv)
Johannes Berg7174beb2017-06-01 16:03:19 +0200988 mvm->fwrt.dump.conf = FW_DBG_START_FROM_ALIVE;
989 iwl_fw_start_dbg_conf(&mvm->fwrt, FW_DBG_START_FROM_ALIVE);
Liad Kaufman6a951262014-11-17 11:36:21 +0200990
Moshe Harela0544272014-12-08 21:13:14 +0200991 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm));
Johannes Berg8ca151b2013-01-24 14:25:36 +0100992 if (ret)
993 goto error;
994
Johannes Berg7d6222e22017-06-08 09:18:22 +0200995 if (!iwl_mvm_has_unified_ucode(mvm)) {
996 /* Send phy db control command and then phy db calibration */
Sara Sharon1f370652016-08-31 18:13:57 +0300997 ret = iwl_send_phy_db_data(mvm->phy_db);
998 if (ret)
999 goto error;
Johannes Berg8ca151b2013-01-24 14:25:36 +01001000
Sara Sharon1f370652016-08-31 18:13:57 +03001001 ret = iwl_send_phy_cfg_cmd(mvm);
1002 if (ret)
1003 goto error;
1004 }
Johannes Berg8ca151b2013-01-24 14:25:36 +01001005
Emmanuel Grumbachb3de3ef2017-05-29 14:01:06 +03001006 ret = iwl_mvm_send_bt_init_conf(mvm);
1007 if (ret)
1008 goto error;
1009
Sara Sharon43413a92015-12-31 11:49:18 +02001010 /* Init RSS configuration */
Sara Sharon09a2e252016-12-19 14:10:35 +02001011 /* TODO - remove a000 disablement when we have RXQ config API */
Johannes Bergc8c017a2017-06-08 09:42:28 +02001012 if (iwl_mvm_has_new_rx_api(mvm) &&
1013 mvm->trans->cfg->device_family != IWL_DEVICE_FAMILY_A000) {
Sara Sharon43413a92015-12-31 11:49:18 +02001014 ret = iwl_send_rss_cfg_cmd(mvm);
1015 if (ret) {
1016 IWL_ERR(mvm, "Failed to configure RSS queues: %d\n",
1017 ret);
1018 goto error;
1019 }
1020 }
1021
Johannes Berg8ca151b2013-01-24 14:25:36 +01001022 /* init the fw <-> mac80211 STA mapping */
Sara Sharon0ae98812017-01-04 14:53:58 +02001023 for (i = 0; i < ARRAY_SIZE(mvm->fw_id_to_mac_id); i++)
Johannes Berg8ca151b2013-01-24 14:25:36 +01001024 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL);
1025
Sara Sharon0ae98812017-01-04 14:53:58 +02001026 mvm->tdls_cs.peer.sta_id = IWL_MVM_INVALID_STA;
Arik Nemtsov1d3c3f62014-10-23 18:03:10 +03001027
Johannes Bergb2b78752014-09-08 16:42:54 +02001028 /* reset quota debouncing buffer - 0xff will yield invalid data */
1029 memset(&mvm->last_quota_cmd, 0xff, sizeof(mvm->last_quota_cmd));
1030
Johannes Bergc8f54702017-06-19 23:50:31 +02001031 ret = iwl_mvm_send_dqa_cmd(mvm);
1032 if (ret)
1033 goto error;
Liad Kaufman97d5be72015-08-31 14:33:23 +03001034
Johannes Berg8ca151b2013-01-24 14:25:36 +01001035 /* Add auxiliary station for scanning */
1036 ret = iwl_mvm_add_aux_sta(mvm);
1037 if (ret)
1038 goto error;
1039
Ilan Peer53a9d612013-04-28 11:55:08 +03001040 /* Add all the PHY contexts */
Johannes Berg57fbcce2016-04-12 15:56:15 +02001041 chan = &mvm->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[0];
Ilan Peer53a9d612013-04-28 11:55:08 +03001042 cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT);
1043 for (i = 0; i < NUM_PHY_CTX; i++) {
1044 /*
1045 * The channel used here isn't relevant as it's
1046 * going to be overwritten in the other flows.
1047 * For now use the first channel we have.
1048 */
1049 ret = iwl_mvm_phy_ctxt_add(mvm, &mvm->phy_ctxts[i],
1050 &chandef, 1, 1);
1051 if (ret)
1052 goto error;
1053 }
Johannes Berg8ca151b2013-01-24 14:25:36 +01001054
Chaya Rachel Ivgic221daf2015-12-29 09:54:49 +02001055#ifdef CONFIG_THERMAL
1056 if (iwl_mvm_is_tt_in_fw(mvm)) {
1057 /* in order to give the responsibility of ct-kill and
1058 * TX backoff to FW we need to send empty temperature reporting
1059 * cmd during init time
1060 */
1061 iwl_mvm_send_temp_report_ths_cmd(mvm);
1062 } else {
1063 /* Initialize tx backoffs to the minimal possible */
1064 iwl_mvm_tt_tx_backoff(mvm, 0);
1065 }
Chaya Rachel Ivgi5c89e7b2016-01-05 10:34:47 +02001066
1067 /* TODO: read the budget from BIOS / Platform NVM */
Chaya Rachel Ivgi944eafc2017-07-09 16:35:14 +03001068
1069 /*
1070 * In case there is no budget from BIOS / Platform NVM the default
1071 * budget should be 2000mW (cooling state 0).
1072 */
1073 if (iwl_mvm_is_ctdp_supported(mvm)) {
Chaya Rachel Ivgi5c89e7b2016-01-05 10:34:47 +02001074 ret = iwl_mvm_ctdp_command(mvm, CTDP_CMD_OPERATION_START,
1075 mvm->cooling_dev.cur_state);
Luca Coelho75cfe332016-09-14 11:54:36 +03001076 if (ret)
1077 goto error;
1078 }
Chaya Rachel Ivgic221daf2015-12-29 09:54:49 +02001079#else
Ido Yariv0c0e2c72014-01-16 21:12:02 -05001080 /* Initialize tx backoffs to the minimal possible */
1081 iwl_mvm_tt_tx_backoff(mvm, 0);
Chaya Rachel Ivgic221daf2015-12-29 09:54:49 +02001082#endif
Ido Yariv0c0e2c72014-01-16 21:12:02 -05001083
Emmanuel Grumbach84bfffa2015-01-13 10:16:30 +02001084 WARN_ON(iwl_mvm_config_ltr(mvm));
Emmanuel Grumbach9180ac52014-09-23 23:02:41 +03001085
Emmanuel Grumbachc1cb92f2014-01-28 10:17:18 +02001086 ret = iwl_mvm_power_update_device(mvm);
Alexander Bondar64b928c2013-09-03 14:18:03 +03001087 if (ret)
1088 goto error;
1089
Arik Nemtsov35af15d2015-03-04 15:08:00 +02001090 /*
1091 * RTNL is not taken during Ct-kill, but we don't need to scan/Tx
1092 * anyway, so don't init MCC.
1093 */
1094 if (!test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status)) {
1095 ret = iwl_mvm_init_mcc(mvm);
1096 if (ret)
1097 goto error;
1098 }
Arik Nemtsov90d4f7d2014-03-04 19:58:46 +02001099
Johannes Berg859d9142015-06-01 17:11:11 +02001100 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
Emmanuel Grumbach4ca87a52016-01-03 22:23:40 +02001101 mvm->scan_type = IWL_SCAN_TYPE_NOT_SET;
David Spinadeld2496222014-05-20 12:46:37 +03001102 ret = iwl_mvm_config_scan(mvm);
1103 if (ret)
1104 goto error;
1105 }
1106
Eliad Peller7498cf42014-01-16 17:10:44 +02001107 /* 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
Luca Coelhoda2830a2016-05-30 13:00:44 +03001111 ret = iwl_mvm_sar_init(mvm);
1112 if (ret)
1113 goto error;
1114
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +02001115 ret = iwl_mvm_sar_geo_init(mvm);
1116 if (ret)
1117 goto error;
1118
Johannes Berg7089ae62017-06-28 16:19:49 +02001119 iwl_mvm_leds_sync(mvm);
1120
Ilan Peer53a9d612013-04-28 11:55:08 +03001121 IWL_DEBUG_INFO(mvm, "RT uCode started.\n");
Johannes Berg8ca151b2013-01-24 14:25:36 +01001122 return 0;
1123 error:
Liad Kaufmande8ba412017-03-16 13:00:59 +02001124 if (!iwlmvm_mod_params.init_dbg)
1125 iwl_mvm_stop_device(mvm);
Johannes Berg8ca151b2013-01-24 14:25:36 +01001126 return ret;
1127}
1128
1129int 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
Moshe Harela0544272014-12-08 21:13:14 +02001145 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm));
Johannes Berg8ca151b2013-01-24 14:25:36 +01001146 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 */
Sara Sharon0ae98812017-01-04 14:53:58 +02001159 for (i = 0; i < ARRAY_SIZE(mvm->fw_id_to_mac_id); i++)
Johannes Berg8ca151b2013-01-24 14:25:36 +01001160 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:
Chaya Rachel Ivgifcb6b922016-02-22 10:21:41 +02001169 iwl_mvm_stop_device(mvm);
Johannes Berg8ca151b2013-01-24 14:25:36 +01001170 return ret;
1171}
1172
Johannes Berg04168412015-06-23 21:22:09 +02001173void iwl_mvm_rx_card_state_notif(struct iwl_mvm *mvm,
1174 struct iwl_rx_cmd_buffer *rxb)
Johannes Berg8ca151b2013-01-24 14:25:36 +01001175{
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");
Johannes Berg8ca151b2013-01-24 14:25:36 +01001185}
1186
Johannes Berg04168412015-06-23 21:22:09 +02001187void iwl_mvm_rx_mfuart_notif(struct iwl_mvm *mvm,
1188 struct iwl_rx_cmd_buffer *rxb)
Chaya Rachel Ivgy30269c12014-11-15 21:08:29 +02001189{
1190 struct iwl_rx_packet *pkt = rxb_addr(rxb);
1191 struct iwl_mfuart_load_notif *mfuart_notif = (void *)pkt->data;
1192
Golan Ben-Ami0c8d0a42017-01-25 15:11:30 +02001193 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
Golan Ben-Ami19f63c52016-11-07 17:40:43 +02001200 if (iwl_rx_packet_payload_len(pkt) == sizeof(*mfuart_notif))
1201 IWL_DEBUG_INFO(mvm,
Golan Ben-Ami0c8d0a42017-01-25 15:11:30 +02001202 "MFUART: image size: 0x%08x\n",
Golan Ben-Ami19f63c52016-11-07 17:40:43 +02001203 le32_to_cpu(mfuart_notif->image_size));
Chaya Rachel Ivgy30269c12014-11-15 21:08:29 +02001204}