Lines Matching +full:firmware +full:- +full:initialised

1 // SPDX-License-Identifier: ISC
3 * Copyright (c) 2014-2017 Qualcomm Atheros, Inc.
9 #include <linux/firmware.h>
38 "testmode event wmi cmd_id %d skb %pK skb->len %d\n", in ath10k_tm_event_wmi()
39 cmd_id, skb, skb->len); in ath10k_tm_event_wmi()
41 ath10k_dbg_dump(ar, ATH10K_DBG_TESTMODE, NULL, "", skb->data, skb->len); in ath10k_tm_event_wmi()
43 spin_lock_bh(&ar->data_lock); in ath10k_tm_event_wmi()
45 if (!ar->testmode.utf_monitor) { in ath10k_tm_event_wmi()
50 /* Only testmode.c should be handling events from utf firmware, in ath10k_tm_event_wmi()
52 * are not initialised. in ath10k_tm_event_wmi()
56 nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy, in ath10k_tm_event_wmi()
57 2 * sizeof(u32) + skb->len, in ath10k_tm_event_wmi()
83 ret = nla_put(nl_skb, ATH10K_TM_ATTR_DATA, skb->len, skb->data); in ath10k_tm_event_wmi()
95 spin_unlock_bh(&ar->data_lock); in ath10k_tm_event_wmi()
110 skb = cfg80211_testmode_alloc_reply_skb(ar->hw->wiphy, in ath10k_tm_cmd_get_version()
113 return -ENOMEM; in ath10k_tm_cmd_get_version()
130 ar->normal_mode_fw.fw_file.wmi_op_version); in ath10k_tm_cmd_get_version()
146 ar->hw_params.fw.dir, ATH10K_FW_UTF_FILE); in ath10k_tm_fetch_utf_firmware_api_1()
148 /* load utf firmware image */ in ath10k_tm_fetch_utf_firmware_api_1()
149 ret = firmware_request_nowarn(&fw_file->firmware, filename, ar->dev); in ath10k_tm_fetch_utf_firmware_api_1()
154 ath10k_warn(ar, "failed to retrieve utf firmware '%s': %d\n", in ath10k_tm_fetch_utf_firmware_api_1()
160 * firmware features. Do an ugly hack where we force the firmware in ath10k_tm_fetch_utf_firmware_api_1()
165 fw_file->wmi_op_version = ATH10K_FW_WMI_OP_VERSION_10_1; in ath10k_tm_fetch_utf_firmware_api_1()
166 fw_file->htt_op_version = ATH10K_FW_HTT_OP_VERSION_10_1; in ath10k_tm_fetch_utf_firmware_api_1()
167 fw_file->firmware_data = fw_file->firmware->data; in ath10k_tm_fetch_utf_firmware_api_1()
168 fw_file->firmware_len = fw_file->firmware->size; in ath10k_tm_fetch_utf_firmware_api_1()
180 switch (ar->hif.bus) { in ath10k_tm_fetch_firmware()
183 scnprintf(fw_name, sizeof(fw_name), "%s-%s-%d.bin", in ath10k_tm_fetch_firmware()
184 ATH10K_FW_UTF_FILE_BASE, ath10k_bus_str(ar->hif.bus), in ath10k_tm_fetch_firmware()
188 scnprintf(fw_name, sizeof(fw_name), "%s-%d.bin", in ath10k_tm_fetch_firmware()
194 &ar->testmode.utf_mode_fw.fw_file); in ath10k_tm_fetch_firmware()
200 ret = ath10k_tm_fetch_utf_firmware_api_1(ar, &ar->testmode.utf_mode_fw.fw_file); in ath10k_tm_fetch_firmware()
202 ath10k_err(ar, "failed to fetch utf firmware binary: %d", ret); in ath10k_tm_fetch_firmware()
209 utf_mode_fw = &ar->testmode.utf_mode_fw; in ath10k_tm_fetch_firmware()
211 /* Use the same board data file as the normal firmware uses (but in ath10k_tm_fetch_firmware()
214 utf_mode_fw->board_data = ar->normal_mode_fw.board_data; in ath10k_tm_fetch_firmware()
215 utf_mode_fw->board_len = ar->normal_mode_fw.board_len; in ath10k_tm_fetch_firmware()
217 if (!utf_mode_fw->fw_file.otp_data) { in ath10k_tm_fetch_firmware()
218 ath10k_info(ar, "utf.bin didn't contain otp binary, taking it from the normal mode firmware"); in ath10k_tm_fetch_firmware()
219 utf_mode_fw->fw_file.otp_data = ar->normal_mode_fw.fw_file.otp_data; in ath10k_tm_fetch_firmware()
220 utf_mode_fw->fw_file.otp_len = ar->normal_mode_fw.fw_file.otp_len; in ath10k_tm_fetch_firmware()
233 mutex_lock(&ar->conf_mutex); in ath10k_tm_cmd_utf_start()
235 if (ar->state == ATH10K_STATE_UTF) { in ath10k_tm_cmd_utf_start()
236 ret = -EALREADY; in ath10k_tm_cmd_utf_start()
241 if (ar->state != ATH10K_STATE_OFF) { in ath10k_tm_cmd_utf_start()
242 ret = -EBUSY; in ath10k_tm_cmd_utf_start()
246 if (WARN_ON(ar->testmode.utf_mode_fw.fw_file.firmware != NULL)) { in ath10k_tm_cmd_utf_start()
248 ret = -EEXIST; in ath10k_tm_cmd_utf_start()
254 ath10k_err(ar, "failed to fetch UTF firmware: %d", ret); in ath10k_tm_cmd_utf_start()
258 if (ar->testmode.utf_mode_fw.fw_file.codeswap_data && in ath10k_tm_cmd_utf_start()
259 ar->testmode.utf_mode_fw.fw_file.codeswap_len) { in ath10k_tm_cmd_utf_start()
261 &ar->testmode.utf_mode_fw.fw_file); in ath10k_tm_cmd_utf_start()
270 spin_lock_bh(&ar->data_lock); in ath10k_tm_cmd_utf_start()
271 ar->testmode.utf_monitor = true; in ath10k_tm_cmd_utf_start()
272 spin_unlock_bh(&ar->data_lock); in ath10k_tm_cmd_utf_start()
275 ar->testmode.utf_mode_fw.fw_file.wmi_op_version); in ath10k_tm_cmd_utf_start()
280 ar->state = ATH10K_STATE_OFF; in ath10k_tm_cmd_utf_start()
285 &ar->testmode.utf_mode_fw); in ath10k_tm_cmd_utf_start()
288 ar->state = ATH10K_STATE_OFF; in ath10k_tm_cmd_utf_start()
292 ar->state = ATH10K_STATE_UTF; in ath10k_tm_cmd_utf_start()
294 if (strlen(ar->testmode.utf_mode_fw.fw_file.fw_version) > 0) in ath10k_tm_cmd_utf_start()
295 ver = ar->testmode.utf_mode_fw.fw_file.fw_version; in ath10k_tm_cmd_utf_start()
299 ath10k_info(ar, "UTF firmware %s started\n", ver); in ath10k_tm_cmd_utf_start()
301 mutex_unlock(&ar->conf_mutex); in ath10k_tm_cmd_utf_start()
309 if (ar->testmode.utf_mode_fw.fw_file.codeswap_data && in ath10k_tm_cmd_utf_start()
310 ar->testmode.utf_mode_fw.fw_file.codeswap_len) in ath10k_tm_cmd_utf_start()
312 &ar->testmode.utf_mode_fw.fw_file); in ath10k_tm_cmd_utf_start()
314 release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware); in ath10k_tm_cmd_utf_start()
315 ar->testmode.utf_mode_fw.fw_file.firmware = NULL; in ath10k_tm_cmd_utf_start()
318 mutex_unlock(&ar->conf_mutex); in ath10k_tm_cmd_utf_start()
325 lockdep_assert_held(&ar->conf_mutex); in __ath10k_tm_cmd_utf_stop()
330 spin_lock_bh(&ar->data_lock); in __ath10k_tm_cmd_utf_stop()
332 ar->testmode.utf_monitor = false; in __ath10k_tm_cmd_utf_stop()
334 spin_unlock_bh(&ar->data_lock); in __ath10k_tm_cmd_utf_stop()
336 if (ar->testmode.utf_mode_fw.fw_file.codeswap_data && in __ath10k_tm_cmd_utf_stop()
337 ar->testmode.utf_mode_fw.fw_file.codeswap_len) in __ath10k_tm_cmd_utf_stop()
339 &ar->testmode.utf_mode_fw.fw_file); in __ath10k_tm_cmd_utf_stop()
341 release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware); in __ath10k_tm_cmd_utf_stop()
342 ar->testmode.utf_mode_fw.fw_file.firmware = NULL; in __ath10k_tm_cmd_utf_stop()
344 ar->state = ATH10K_STATE_OFF; in __ath10k_tm_cmd_utf_stop()
353 mutex_lock(&ar->conf_mutex); in ath10k_tm_cmd_utf_stop()
355 if (ar->state != ATH10K_STATE_UTF) { in ath10k_tm_cmd_utf_stop()
356 ret = -ENETDOWN; in ath10k_tm_cmd_utf_stop()
364 ath10k_info(ar, "UTF firmware stopped\n"); in ath10k_tm_cmd_utf_stop()
367 mutex_unlock(&ar->conf_mutex); in ath10k_tm_cmd_utf_stop()
378 mutex_lock(&ar->conf_mutex); in ath10k_tm_cmd_wmi()
380 if (ar->state != ATH10K_STATE_UTF) { in ath10k_tm_cmd_wmi()
381 ret = -ENETDOWN; in ath10k_tm_cmd_wmi()
386 ret = -EINVAL; in ath10k_tm_cmd_wmi()
391 ret = -EINVAL; in ath10k_tm_cmd_wmi()
407 ret = -ENOMEM; in ath10k_tm_cmd_wmi()
411 memcpy(skb->data, buf, buf_len); in ath10k_tm_cmd_wmi()
423 mutex_unlock(&ar->conf_mutex); in ath10k_tm_cmd_wmi()
430 struct ath10k *ar = hw->priv; in ath10k_tm_cmd()
440 return -EINVAL; in ath10k_tm_cmd()
452 return -EOPNOTSUPP; in ath10k_tm_cmd()
458 mutex_lock(&ar->conf_mutex); in ath10k_testmode_destroy()
460 if (ar->state != ATH10K_STATE_UTF) { in ath10k_testmode_destroy()
461 /* utf firmware is not running, nothing to do */ in ath10k_testmode_destroy()
468 mutex_unlock(&ar->conf_mutex); in ath10k_testmode_destroy()