1 /******************************************************************************
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.
8 * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
25 * The full GNU General Public License is included in this distribution
26 * in the file called COPYING.
28 * Contact Information:
29 * Intel Linux Wireless <ilw@linux.intel.com>
30 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
34 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
35 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
36 * All rights reserved.
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
42 * * Redistributions of source code must retain the above copyright
43 * notice, this list of conditions and the following disclaimer.
44 * * Redistributions in binary form must reproduce the above copyright
45 * notice, this list of conditions and the following disclaimer in
46 * the documentation and/or other materials provided with the
48 * * Neither the name Intel Corporation nor the names of its
49 * contributors may be used to endorse or promote products derived
50 * from this software without specific prior written permission.
52 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
53 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
54 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
55 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
56 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
57 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
58 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
59 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
60 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
62 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64 *****************************************************************************/
65 #include <linux/completion.h>
66 #include <linux/dma-mapping.h>
67 #include <linux/firmware.h>
68 #include <linux/module.h>
69 #include <linux/vmalloc.h>
73 #include "iwl-debug.h"
74 #include "iwl-trans.h"
75 #include "iwl-op-mode.h"
76 #include "iwl-agn-hw.h"
78 #include "iwl-config.h"
79 #include "iwl-modparams.h"
81 /******************************************************************************
85 ******************************************************************************/
88 * module name, copyright, version, etc.
90 #define DRV_DESCRIPTION "Intel(R) Wireless WiFi driver for Linux"
92 #ifdef CONFIG_IWLWIFI_DEBUG
98 #define DRV_VERSION IWLWIFI_VERSION VD
100 MODULE_DESCRIPTION(DRV_DESCRIPTION);
101 MODULE_VERSION(DRV_VERSION);
102 MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
103 MODULE_LICENSE("GPL");
105 #ifdef CONFIG_IWLWIFI_DEBUGFS
106 static struct dentry *iwl_dbgfs_root;
110 * struct iwl_drv - drv common data
111 * @list: list of drv structures using this opmode
112 * @fw: the iwl_fw structure
113 * @op_mode: the running op_mode
114 * @trans: transport layer
115 * @dev: for debug prints only
116 * @cfg: configuration struct
117 * @fw_index: firmware revision to try loading
118 * @firmware_name: composite filename of ucode file to load
119 * @request_firmware_complete: the firmware has been obtained from user space
122 struct list_head list;
125 struct iwl_op_mode *op_mode;
126 struct iwl_trans *trans;
128 const struct iwl_cfg *cfg;
130 int fw_index; /* firmware we're trying to load */
131 char firmware_name[32]; /* name of firmware file to load */
133 struct completion request_firmware_complete;
135 #ifdef CONFIG_IWLWIFI_DEBUGFS
136 struct dentry *dbgfs_drv;
137 struct dentry *dbgfs_trans;
138 struct dentry *dbgfs_op_mode;
147 /* Protects the table contents, i.e. the ops pointer & drv list */
148 static struct mutex iwlwifi_opmode_table_mtx;
149 static struct iwlwifi_opmode_table {
150 const char *name; /* name: iwldvm, iwlmvm, etc */
151 const struct iwl_op_mode_ops *ops; /* pointer to op_mode ops */
152 struct list_head drv; /* list of devices using this op_mode */
153 } iwlwifi_opmode_table[] = { /* ops set when driver is initialized */
154 [DVM_OP_MODE] = { .name = "iwldvm", .ops = NULL },
155 [MVM_OP_MODE] = { .name = "iwlmvm", .ops = NULL },
158 #define IWL_DEFAULT_SCAN_CHANNELS 40
161 * struct fw_sec: Just for the image parsing proccess.
162 * For the fw storage we are using struct fw_desc.
165 const void *data; /* the sec data */
166 size_t size; /* section size */
167 u32 offset; /* offset of writing in the device */
170 static void iwl_free_fw_desc(struct iwl_drv *drv, struct fw_desc *desc)
177 static void iwl_free_fw_img(struct iwl_drv *drv, struct fw_img *img)
180 for (i = 0; i < IWL_UCODE_SECTION_MAX; i++)
181 iwl_free_fw_desc(drv, &img->sec[i]);
184 static void iwl_dealloc_ucode(struct iwl_drv *drv)
187 for (i = 0; i < IWL_UCODE_TYPE_MAX; i++)
188 iwl_free_fw_img(drv, drv->fw.img + i);
191 static int iwl_alloc_fw_desc(struct iwl_drv *drv, struct fw_desc *desc,
198 if (!sec || !sec->size)
201 data = vmalloc(sec->size);
205 desc->len = sec->size;
206 desc->offset = sec->offset;
207 memcpy(data, sec->data, desc->len);
213 static void iwl_req_fw_callback(const struct firmware *ucode_raw,
216 #define UCODE_EXPERIMENTAL_INDEX 100
217 #define UCODE_EXPERIMENTAL_TAG "exp"
219 static int iwl_request_firmware(struct iwl_drv *drv, bool first)
221 const char *name_pre = drv->cfg->fw_name_pre;
225 #ifdef CONFIG_IWLWIFI_DEBUG_EXPERIMENTAL_UCODE
226 drv->fw_index = UCODE_EXPERIMENTAL_INDEX;
227 strcpy(tag, UCODE_EXPERIMENTAL_TAG);
228 } else if (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) {
230 drv->fw_index = drv->cfg->ucode_api_max;
231 sprintf(tag, "%d", drv->fw_index);
234 sprintf(tag, "%d", drv->fw_index);
237 if (drv->fw_index < drv->cfg->ucode_api_min) {
238 IWL_ERR(drv, "no suitable firmware found!\n");
242 snprintf(drv->firmware_name, sizeof(drv->firmware_name), "%s%s.ucode",
246 * Starting 8000B - FW name format has changed. This overwrites the
247 * previous name and uses the new format.
249 if (drv->trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) {
251 'A' + CSR_HW_REV_STEP(drv->trans->hw_rev), 0
254 /* A-step doesn't have an indication */
255 if (CSR_HW_REV_STEP(drv->trans->hw_rev) == SILICON_A_STEP)
258 snprintf(drv->firmware_name, sizeof(drv->firmware_name),
259 "%s%s-%s.ucode", name_pre, rev_step, tag);
262 IWL_DEBUG_INFO(drv, "attempting to load firmware %s'%s'\n",
263 (drv->fw_index == UCODE_EXPERIMENTAL_INDEX)
264 ? "EXPERIMENTAL " : "",
267 return request_firmware_nowait(THIS_MODULE, 1, drv->firmware_name,
269 GFP_KERNEL, drv, iwl_req_fw_callback);
272 struct fw_img_parsing {
273 struct fw_sec sec[IWL_UCODE_SECTION_MAX];
278 * struct fw_sec_parsing: to extract fw section and it's offset from tlv
280 struct fw_sec_parsing {
286 * struct iwl_tlv_calib_data - parse the default calib data from TLV
288 * @ucode_type: the uCode to which the following default calib relates.
289 * @calib: default calibrations.
291 struct iwl_tlv_calib_data {
293 struct iwl_tlv_calib_ctrl calib;
296 struct iwl_firmware_pieces {
297 struct fw_img_parsing img[IWL_UCODE_TYPE_MAX];
299 u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr;
300 u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr;
304 * These functions are just to extract uCode section data from the pieces
307 static struct fw_sec *get_sec(struct iwl_firmware_pieces *pieces,
308 enum iwl_ucode_type type,
311 return &pieces->img[type].sec[sec];
314 static void set_sec_data(struct iwl_firmware_pieces *pieces,
315 enum iwl_ucode_type type,
319 pieces->img[type].sec[sec].data = data;
322 static void set_sec_size(struct iwl_firmware_pieces *pieces,
323 enum iwl_ucode_type type,
327 pieces->img[type].sec[sec].size = size;
330 static size_t get_sec_size(struct iwl_firmware_pieces *pieces,
331 enum iwl_ucode_type type,
334 return pieces->img[type].sec[sec].size;
337 static void set_sec_offset(struct iwl_firmware_pieces *pieces,
338 enum iwl_ucode_type type,
342 pieces->img[type].sec[sec].offset = offset;
345 static int iwl_store_cscheme(struct iwl_fw *fw, const u8 *data, const u32 len)
348 struct iwl_fw_cscheme_list *l = (struct iwl_fw_cscheme_list *)data;
349 struct iwl_fw_cipher_scheme *fwcs;
350 struct ieee80211_cipher_scheme *cs;
353 if (len < sizeof(*l) ||
354 len < sizeof(l->size) + l->size * sizeof(l->cs[0]))
357 for (i = 0, j = 0; i < IWL_UCODE_MAX_CS && i < l->size; i++) {
359 cipher = le32_to_cpu(fwcs->cipher);
361 /* we skip schemes with zero cipher suite selector */
367 cs->iftype = BIT(NL80211_IFTYPE_STATION);
368 cs->hdr_len = fwcs->hdr_len;
369 cs->pn_len = fwcs->pn_len;
370 cs->pn_off = fwcs->pn_off;
371 cs->key_idx_off = fwcs->key_idx_off;
372 cs->key_idx_mask = fwcs->key_idx_mask;
373 cs->key_idx_shift = fwcs->key_idx_shift;
374 cs->mic_len = fwcs->mic_len;
381 * Gets uCode section from tlv.
383 static int iwl_store_ucode_sec(struct iwl_firmware_pieces *pieces,
384 const void *data, enum iwl_ucode_type type,
387 struct fw_img_parsing *img;
389 struct fw_sec_parsing *sec_parse;
391 if (WARN_ON(!pieces || !data || type >= IWL_UCODE_TYPE_MAX))
394 sec_parse = (struct fw_sec_parsing *)data;
396 img = &pieces->img[type];
397 sec = &img->sec[img->sec_counter];
399 sec->offset = le32_to_cpu(sec_parse->offset);
400 sec->data = sec_parse->data;
401 sec->size = size - sizeof(sec_parse->offset);
408 static int iwl_set_default_calib(struct iwl_drv *drv, const u8 *data)
410 struct iwl_tlv_calib_data *def_calib =
411 (struct iwl_tlv_calib_data *)data;
412 u32 ucode_type = le32_to_cpu(def_calib->ucode_type);
413 if (ucode_type >= IWL_UCODE_TYPE_MAX) {
414 IWL_ERR(drv, "Wrong ucode_type %u for default calibration.\n",
418 drv->fw.default_calib[ucode_type].flow_trigger =
419 def_calib->calib.flow_trigger;
420 drv->fw.default_calib[ucode_type].event_trigger =
421 def_calib->calib.event_trigger;
426 static int iwl_set_ucode_api_flags(struct iwl_drv *drv, const u8 *data,
427 struct iwl_ucode_capabilities *capa)
429 const struct iwl_ucode_api *ucode_api = (void *)data;
430 u32 api_index = le32_to_cpu(ucode_api->api_index);
432 if (api_index >= IWL_API_ARRAY_SIZE) {
433 IWL_ERR(drv, "api_index larger than supported by driver\n");
437 capa->api[api_index] = le32_to_cpu(ucode_api->api_flags);
442 static int iwl_set_ucode_capabilities(struct iwl_drv *drv, const u8 *data,
443 struct iwl_ucode_capabilities *capa)
445 const struct iwl_ucode_capa *ucode_capa = (void *)data;
446 u32 api_index = le32_to_cpu(ucode_capa->api_index);
448 if (api_index >= IWL_CAPABILITIES_ARRAY_SIZE) {
449 IWL_ERR(drv, "api_index larger than supported by driver\n");
453 capa->capa[api_index] = le32_to_cpu(ucode_capa->api_capa);
458 static int iwl_parse_v1_v2_firmware(struct iwl_drv *drv,
459 const struct firmware *ucode_raw,
460 struct iwl_firmware_pieces *pieces)
462 struct iwl_ucode_header *ucode = (void *)ucode_raw->data;
463 u32 api_ver, hdr_size, build;
467 drv->fw.ucode_ver = le32_to_cpu(ucode->ver);
468 api_ver = IWL_UCODE_API(drv->fw.ucode_ver);
473 if (ucode_raw->size < hdr_size) {
474 IWL_ERR(drv, "File size too small!\n");
477 build = le32_to_cpu(ucode->u.v2.build);
478 set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST,
479 le32_to_cpu(ucode->u.v2.inst_size));
480 set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA,
481 le32_to_cpu(ucode->u.v2.data_size));
482 set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST,
483 le32_to_cpu(ucode->u.v2.init_size));
484 set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA,
485 le32_to_cpu(ucode->u.v2.init_data_size));
486 src = ucode->u.v2.data;
492 if (ucode_raw->size < hdr_size) {
493 IWL_ERR(drv, "File size too small!\n");
497 set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST,
498 le32_to_cpu(ucode->u.v1.inst_size));
499 set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA,
500 le32_to_cpu(ucode->u.v1.data_size));
501 set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST,
502 le32_to_cpu(ucode->u.v1.init_size));
503 set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA,
504 le32_to_cpu(ucode->u.v1.init_data_size));
505 src = ucode->u.v1.data;
510 sprintf(buildstr, " build %u%s", build,
511 (drv->fw_index == UCODE_EXPERIMENTAL_INDEX)
516 snprintf(drv->fw.fw_version,
517 sizeof(drv->fw.fw_version),
519 IWL_UCODE_MAJOR(drv->fw.ucode_ver),
520 IWL_UCODE_MINOR(drv->fw.ucode_ver),
521 IWL_UCODE_API(drv->fw.ucode_ver),
522 IWL_UCODE_SERIAL(drv->fw.ucode_ver),
525 /* Verify size of file vs. image size info in file's header */
527 if (ucode_raw->size != hdr_size +
528 get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST) +
529 get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA) +
530 get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST) +
531 get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA)) {
534 "uCode file size %d does not match expected size\n",
535 (int)ucode_raw->size);
540 set_sec_data(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST, src);
541 src += get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST);
542 set_sec_offset(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST,
543 IWLAGN_RTC_INST_LOWER_BOUND);
544 set_sec_data(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA, src);
545 src += get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA);
546 set_sec_offset(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA,
547 IWLAGN_RTC_DATA_LOWER_BOUND);
548 set_sec_data(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST, src);
549 src += get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST);
550 set_sec_offset(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST,
551 IWLAGN_RTC_INST_LOWER_BOUND);
552 set_sec_data(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA, src);
553 src += get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA);
554 set_sec_offset(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA,
555 IWLAGN_RTC_DATA_LOWER_BOUND);
559 static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
560 const struct firmware *ucode_raw,
561 struct iwl_firmware_pieces *pieces,
562 struct iwl_ucode_capabilities *capa)
564 struct iwl_tlv_ucode_header *ucode = (void *)ucode_raw->data;
565 struct iwl_ucode_tlv *tlv;
566 size_t len = ucode_raw->size;
569 enum iwl_ucode_tlv_type tlv_type;
575 if (len < sizeof(*ucode)) {
576 IWL_ERR(drv, "uCode has invalid length: %zd\n", len);
580 if (ucode->magic != cpu_to_le32(IWL_TLV_UCODE_MAGIC)) {
581 IWL_ERR(drv, "invalid uCode magic: 0X%x\n",
582 le32_to_cpu(ucode->magic));
586 drv->fw.ucode_ver = le32_to_cpu(ucode->ver);
587 memcpy(drv->fw.human_readable, ucode->human_readable,
588 sizeof(drv->fw.human_readable));
589 build = le32_to_cpu(ucode->build);
592 sprintf(buildstr, " build %u%s", build,
593 (drv->fw_index == UCODE_EXPERIMENTAL_INDEX)
598 snprintf(drv->fw.fw_version,
599 sizeof(drv->fw.fw_version),
601 IWL_UCODE_MAJOR(drv->fw.ucode_ver),
602 IWL_UCODE_MINOR(drv->fw.ucode_ver),
603 IWL_UCODE_API(drv->fw.ucode_ver),
604 IWL_UCODE_SERIAL(drv->fw.ucode_ver),
609 len -= sizeof(*ucode);
611 while (len >= sizeof(*tlv)) {
615 tlv_len = le32_to_cpu(tlv->length);
616 tlv_type = le32_to_cpu(tlv->type);
617 tlv_data = tlv->data;
620 IWL_ERR(drv, "invalid TLV len: %zd/%u\n",
624 len -= ALIGN(tlv_len, 4);
625 data += sizeof(*tlv) + ALIGN(tlv_len, 4);
628 case IWL_UCODE_TLV_INST:
629 set_sec_data(pieces, IWL_UCODE_REGULAR,
630 IWL_UCODE_SECTION_INST, tlv_data);
631 set_sec_size(pieces, IWL_UCODE_REGULAR,
632 IWL_UCODE_SECTION_INST, tlv_len);
633 set_sec_offset(pieces, IWL_UCODE_REGULAR,
634 IWL_UCODE_SECTION_INST,
635 IWLAGN_RTC_INST_LOWER_BOUND);
637 case IWL_UCODE_TLV_DATA:
638 set_sec_data(pieces, IWL_UCODE_REGULAR,
639 IWL_UCODE_SECTION_DATA, tlv_data);
640 set_sec_size(pieces, IWL_UCODE_REGULAR,
641 IWL_UCODE_SECTION_DATA, tlv_len);
642 set_sec_offset(pieces, IWL_UCODE_REGULAR,
643 IWL_UCODE_SECTION_DATA,
644 IWLAGN_RTC_DATA_LOWER_BOUND);
646 case IWL_UCODE_TLV_INIT:
647 set_sec_data(pieces, IWL_UCODE_INIT,
648 IWL_UCODE_SECTION_INST, tlv_data);
649 set_sec_size(pieces, IWL_UCODE_INIT,
650 IWL_UCODE_SECTION_INST, tlv_len);
651 set_sec_offset(pieces, IWL_UCODE_INIT,
652 IWL_UCODE_SECTION_INST,
653 IWLAGN_RTC_INST_LOWER_BOUND);
655 case IWL_UCODE_TLV_INIT_DATA:
656 set_sec_data(pieces, IWL_UCODE_INIT,
657 IWL_UCODE_SECTION_DATA, tlv_data);
658 set_sec_size(pieces, IWL_UCODE_INIT,
659 IWL_UCODE_SECTION_DATA, tlv_len);
660 set_sec_offset(pieces, IWL_UCODE_INIT,
661 IWL_UCODE_SECTION_DATA,
662 IWLAGN_RTC_DATA_LOWER_BOUND);
664 case IWL_UCODE_TLV_BOOT:
665 IWL_ERR(drv, "Found unexpected BOOT ucode\n");
667 case IWL_UCODE_TLV_PROBE_MAX_LEN:
668 if (tlv_len != sizeof(u32))
669 goto invalid_tlv_len;
670 capa->max_probe_length =
671 le32_to_cpup((__le32 *)tlv_data);
673 case IWL_UCODE_TLV_PAN:
675 goto invalid_tlv_len;
676 capa->flags |= IWL_UCODE_TLV_FLAGS_PAN;
678 case IWL_UCODE_TLV_FLAGS:
679 /* must be at least one u32 */
680 if (tlv_len < sizeof(u32))
681 goto invalid_tlv_len;
682 /* and a proper number of u32s */
683 if (tlv_len % sizeof(u32))
684 goto invalid_tlv_len;
686 * This driver only reads the first u32 as
687 * right now no more features are defined,
688 * if that changes then either the driver
689 * will not work with the new firmware, or
690 * it'll not take advantage of new features.
692 capa->flags = le32_to_cpup((__le32 *)tlv_data);
694 case IWL_UCODE_TLV_API_CHANGES_SET:
695 if (tlv_len != sizeof(struct iwl_ucode_api))
696 goto invalid_tlv_len;
697 if (iwl_set_ucode_api_flags(drv, tlv_data, capa))
700 case IWL_UCODE_TLV_ENABLED_CAPABILITIES:
701 if (tlv_len != sizeof(struct iwl_ucode_capa))
702 goto invalid_tlv_len;
703 if (iwl_set_ucode_capabilities(drv, tlv_data, capa))
706 case IWL_UCODE_TLV_INIT_EVTLOG_PTR:
707 if (tlv_len != sizeof(u32))
708 goto invalid_tlv_len;
709 pieces->init_evtlog_ptr =
710 le32_to_cpup((__le32 *)tlv_data);
712 case IWL_UCODE_TLV_INIT_EVTLOG_SIZE:
713 if (tlv_len != sizeof(u32))
714 goto invalid_tlv_len;
715 pieces->init_evtlog_size =
716 le32_to_cpup((__le32 *)tlv_data);
718 case IWL_UCODE_TLV_INIT_ERRLOG_PTR:
719 if (tlv_len != sizeof(u32))
720 goto invalid_tlv_len;
721 pieces->init_errlog_ptr =
722 le32_to_cpup((__le32 *)tlv_data);
724 case IWL_UCODE_TLV_RUNT_EVTLOG_PTR:
725 if (tlv_len != sizeof(u32))
726 goto invalid_tlv_len;
727 pieces->inst_evtlog_ptr =
728 le32_to_cpup((__le32 *)tlv_data);
730 case IWL_UCODE_TLV_RUNT_EVTLOG_SIZE:
731 if (tlv_len != sizeof(u32))
732 goto invalid_tlv_len;
733 pieces->inst_evtlog_size =
734 le32_to_cpup((__le32 *)tlv_data);
736 case IWL_UCODE_TLV_RUNT_ERRLOG_PTR:
737 if (tlv_len != sizeof(u32))
738 goto invalid_tlv_len;
739 pieces->inst_errlog_ptr =
740 le32_to_cpup((__le32 *)tlv_data);
742 case IWL_UCODE_TLV_ENHANCE_SENS_TBL:
744 goto invalid_tlv_len;
745 drv->fw.enhance_sensitivity_table = true;
747 case IWL_UCODE_TLV_WOWLAN_INST:
748 set_sec_data(pieces, IWL_UCODE_WOWLAN,
749 IWL_UCODE_SECTION_INST, tlv_data);
750 set_sec_size(pieces, IWL_UCODE_WOWLAN,
751 IWL_UCODE_SECTION_INST, tlv_len);
752 set_sec_offset(pieces, IWL_UCODE_WOWLAN,
753 IWL_UCODE_SECTION_INST,
754 IWLAGN_RTC_INST_LOWER_BOUND);
756 case IWL_UCODE_TLV_WOWLAN_DATA:
757 set_sec_data(pieces, IWL_UCODE_WOWLAN,
758 IWL_UCODE_SECTION_DATA, tlv_data);
759 set_sec_size(pieces, IWL_UCODE_WOWLAN,
760 IWL_UCODE_SECTION_DATA, tlv_len);
761 set_sec_offset(pieces, IWL_UCODE_WOWLAN,
762 IWL_UCODE_SECTION_DATA,
763 IWLAGN_RTC_DATA_LOWER_BOUND);
765 case IWL_UCODE_TLV_PHY_CALIBRATION_SIZE:
766 if (tlv_len != sizeof(u32))
767 goto invalid_tlv_len;
768 capa->standard_phy_calibration_size =
769 le32_to_cpup((__le32 *)tlv_data);
771 case IWL_UCODE_TLV_SEC_RT:
772 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR,
774 drv->fw.mvm_fw = true;
776 case IWL_UCODE_TLV_SEC_INIT:
777 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT,
779 drv->fw.mvm_fw = true;
781 case IWL_UCODE_TLV_SEC_WOWLAN:
782 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN,
784 drv->fw.mvm_fw = true;
786 case IWL_UCODE_TLV_DEF_CALIB:
787 if (tlv_len != sizeof(struct iwl_tlv_calib_data))
788 goto invalid_tlv_len;
789 if (iwl_set_default_calib(drv, tlv_data))
792 case IWL_UCODE_TLV_PHY_SKU:
793 if (tlv_len != sizeof(u32))
794 goto invalid_tlv_len;
795 drv->fw.phy_config = le32_to_cpup((__le32 *)tlv_data);
796 drv->fw.valid_tx_ant = (drv->fw.phy_config &
797 FW_PHY_CFG_TX_CHAIN) >>
798 FW_PHY_CFG_TX_CHAIN_POS;
799 drv->fw.valid_rx_ant = (drv->fw.phy_config &
800 FW_PHY_CFG_RX_CHAIN) >>
801 FW_PHY_CFG_RX_CHAIN_POS;
803 case IWL_UCODE_TLV_SECURE_SEC_RT:
804 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR,
806 drv->fw.mvm_fw = true;
808 case IWL_UCODE_TLV_SECURE_SEC_INIT:
809 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT,
811 drv->fw.mvm_fw = true;
813 case IWL_UCODE_TLV_SECURE_SEC_WOWLAN:
814 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN,
816 drv->fw.mvm_fw = true;
818 case IWL_UCODE_TLV_NUM_OF_CPU:
819 if (tlv_len != sizeof(u32))
820 goto invalid_tlv_len;
822 le32_to_cpup((__le32 *)tlv_data);
824 if (num_of_cpus == 2) {
825 drv->fw.img[IWL_UCODE_REGULAR].is_dual_cpus =
827 drv->fw.img[IWL_UCODE_INIT].is_dual_cpus =
829 drv->fw.img[IWL_UCODE_WOWLAN].is_dual_cpus =
831 } else if ((num_of_cpus > 2) || (num_of_cpus < 1)) {
832 IWL_ERR(drv, "Driver support upto 2 CPUs\n");
836 case IWL_UCODE_TLV_CSCHEME:
837 if (iwl_store_cscheme(&drv->fw, tlv_data, tlv_len))
838 goto invalid_tlv_len;
840 case IWL_UCODE_TLV_N_SCAN_CHANNELS:
841 if (tlv_len != sizeof(u32))
842 goto invalid_tlv_len;
843 capa->n_scan_channels =
844 le32_to_cpup((__le32 *)tlv_data);
847 IWL_DEBUG_INFO(drv, "unknown TLV: %d\n", tlv_type);
853 IWL_ERR(drv, "invalid TLV after parsing: %zd\n", len);
854 iwl_print_hex_dump(drv, IWL_DL_FW, (u8 *)data, len);
861 IWL_ERR(drv, "TLV %d has invalid size: %u\n", tlv_type, tlv_len);
863 iwl_print_hex_dump(drv, IWL_DL_FW, tlv_data, tlv_len);
868 static int iwl_alloc_ucode(struct iwl_drv *drv,
869 struct iwl_firmware_pieces *pieces,
870 enum iwl_ucode_type type)
874 i < IWL_UCODE_SECTION_MAX && get_sec_size(pieces, type, i);
876 if (iwl_alloc_fw_desc(drv, &(drv->fw.img[type].sec[i]),
877 get_sec(pieces, type, i)))
882 static int validate_sec_sizes(struct iwl_drv *drv,
883 struct iwl_firmware_pieces *pieces,
884 const struct iwl_cfg *cfg)
886 IWL_DEBUG_INFO(drv, "f/w package hdr runtime inst size = %Zd\n",
887 get_sec_size(pieces, IWL_UCODE_REGULAR,
888 IWL_UCODE_SECTION_INST));
889 IWL_DEBUG_INFO(drv, "f/w package hdr runtime data size = %Zd\n",
890 get_sec_size(pieces, IWL_UCODE_REGULAR,
891 IWL_UCODE_SECTION_DATA));
892 IWL_DEBUG_INFO(drv, "f/w package hdr init inst size = %Zd\n",
893 get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST));
894 IWL_DEBUG_INFO(drv, "f/w package hdr init data size = %Zd\n",
895 get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA));
897 /* Verify that uCode images will fit in card's SRAM. */
898 if (get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST) >
899 cfg->max_inst_size) {
900 IWL_ERR(drv, "uCode instr len %Zd too large to fit in\n",
901 get_sec_size(pieces, IWL_UCODE_REGULAR,
902 IWL_UCODE_SECTION_INST));
906 if (get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA) >
907 cfg->max_data_size) {
908 IWL_ERR(drv, "uCode data len %Zd too large to fit in\n",
909 get_sec_size(pieces, IWL_UCODE_REGULAR,
910 IWL_UCODE_SECTION_DATA));
914 if (get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST) >
915 cfg->max_inst_size) {
916 IWL_ERR(drv, "uCode init instr len %Zd too large to fit in\n",
917 get_sec_size(pieces, IWL_UCODE_INIT,
918 IWL_UCODE_SECTION_INST));
922 if (get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA) >
923 cfg->max_data_size) {
924 IWL_ERR(drv, "uCode init data len %Zd too large to fit in\n",
925 get_sec_size(pieces, IWL_UCODE_REGULAR,
926 IWL_UCODE_SECTION_DATA));
932 static struct iwl_op_mode *
933 _iwl_op_mode_start(struct iwl_drv *drv, struct iwlwifi_opmode_table *op)
935 const struct iwl_op_mode_ops *ops = op->ops;
936 struct dentry *dbgfs_dir = NULL;
937 struct iwl_op_mode *op_mode = NULL;
939 #ifdef CONFIG_IWLWIFI_DEBUGFS
940 drv->dbgfs_op_mode = debugfs_create_dir(op->name,
942 if (!drv->dbgfs_op_mode) {
944 "failed to create opmode debugfs directory\n");
947 dbgfs_dir = drv->dbgfs_op_mode;
950 op_mode = ops->start(drv->trans, drv->cfg, &drv->fw, dbgfs_dir);
952 #ifdef CONFIG_IWLWIFI_DEBUGFS
954 debugfs_remove_recursive(drv->dbgfs_op_mode);
955 drv->dbgfs_op_mode = NULL;
962 static void _iwl_op_mode_stop(struct iwl_drv *drv)
964 /* op_mode can be NULL if its start failed */
966 iwl_op_mode_stop(drv->op_mode);
969 #ifdef CONFIG_IWLWIFI_DEBUGFS
970 debugfs_remove_recursive(drv->dbgfs_op_mode);
971 drv->dbgfs_op_mode = NULL;
977 * iwl_req_fw_callback - callback when firmware was loaded
979 * If loaded successfully, copies the firmware into buffers
980 * for the card to fetch (via DMA).
982 static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
984 struct iwl_drv *drv = context;
985 struct iwl_fw *fw = &drv->fw;
986 struct iwl_ucode_header *ucode;
987 struct iwlwifi_opmode_table *op;
989 struct iwl_firmware_pieces pieces;
990 const unsigned int api_max = drv->cfg->ucode_api_max;
991 unsigned int api_ok = drv->cfg->ucode_api_ok;
992 const unsigned int api_min = drv->cfg->ucode_api_min;
995 bool load_module = false;
997 fw->ucode_capa.max_probe_length = IWL_DEFAULT_MAX_PROBE_LENGTH;
998 fw->ucode_capa.standard_phy_calibration_size =
999 IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE;
1000 fw->ucode_capa.n_scan_channels = IWL_DEFAULT_SCAN_CHANNELS;
1005 memset(&pieces, 0, sizeof(pieces));
1008 if (drv->fw_index <= api_ok)
1010 "request for firmware file '%s' failed.\n",
1011 drv->firmware_name);
1015 IWL_DEBUG_INFO(drv, "Loaded firmware file '%s' (%zd bytes).\n",
1016 drv->firmware_name, ucode_raw->size);
1018 /* Make sure that we got at least the API version number */
1019 if (ucode_raw->size < 4) {
1020 IWL_ERR(drv, "File size way too small!\n");
1024 /* Data from ucode file: header followed by uCode images */
1025 ucode = (struct iwl_ucode_header *)ucode_raw->data;
1028 err = iwl_parse_v1_v2_firmware(drv, ucode_raw, &pieces);
1030 err = iwl_parse_tlv_firmware(drv, ucode_raw, &pieces,
1036 api_ver = IWL_UCODE_API(drv->fw.ucode_ver);
1039 * api_ver should match the api version forming part of the
1040 * firmware filename ... but we don't check for that and only rely
1041 * on the API version read from firmware header from here on forward
1043 /* no api version check required for experimental uCode */
1044 if (drv->fw_index != UCODE_EXPERIMENTAL_INDEX) {
1045 if (api_ver < api_min || api_ver > api_max) {
1047 "Driver unable to support your firmware API. "
1048 "Driver supports v%u, firmware is v%u.\n",
1053 if (api_ver < api_ok) {
1054 if (api_ok != api_max)
1055 IWL_ERR(drv, "Firmware has old API version, "
1056 "expected v%u through v%u, got v%u.\n",
1057 api_ok, api_max, api_ver);
1059 IWL_ERR(drv, "Firmware has old API version, "
1060 "expected v%u, got v%u.\n",
1062 IWL_ERR(drv, "New firmware can be obtained from "
1063 "http://www.intellinuxwireless.org/.\n");
1068 * In mvm uCode there is no difference between data and instructions
1071 if (!fw->mvm_fw && validate_sec_sizes(drv, &pieces, drv->cfg))
1074 /* Allocate ucode buffers for card's bus-master loading ... */
1076 /* Runtime instructions and 2 copies of data:
1077 * 1) unmodified from disk
1078 * 2) backup cache for save/restore during power-downs */
1079 for (i = 0; i < IWL_UCODE_TYPE_MAX; i++)
1080 if (iwl_alloc_ucode(drv, &pieces, i))
1083 /* Now that we can no longer fail, copy information */
1086 * The (size - 16) / 12 formula is based on the information recorded
1087 * for each event, which is of mode 1 (including timestamp) for all
1088 * new microcodes that include this information.
1090 fw->init_evtlog_ptr = pieces.init_evtlog_ptr;
1091 if (pieces.init_evtlog_size)
1092 fw->init_evtlog_size = (pieces.init_evtlog_size - 16)/12;
1094 fw->init_evtlog_size =
1095 drv->cfg->base_params->max_event_log_size;
1096 fw->init_errlog_ptr = pieces.init_errlog_ptr;
1097 fw->inst_evtlog_ptr = pieces.inst_evtlog_ptr;
1098 if (pieces.inst_evtlog_size)
1099 fw->inst_evtlog_size = (pieces.inst_evtlog_size - 16)/12;
1101 fw->inst_evtlog_size =
1102 drv->cfg->base_params->max_event_log_size;
1103 fw->inst_errlog_ptr = pieces.inst_errlog_ptr;
1106 * figure out the offset of chain noise reset and gain commands
1107 * base on the size of standard phy calibration commands table size
1109 if (fw->ucode_capa.standard_phy_calibration_size >
1110 IWL_MAX_PHY_CALIBRATE_TBL_SIZE)
1111 fw->ucode_capa.standard_phy_calibration_size =
1112 IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE;
1114 /* We have our copies now, allow OS release its copies */
1115 release_firmware(ucode_raw);
1117 mutex_lock(&iwlwifi_opmode_table_mtx);
1119 op = &iwlwifi_opmode_table[MVM_OP_MODE];
1121 op = &iwlwifi_opmode_table[DVM_OP_MODE];
1123 IWL_INFO(drv, "loaded firmware version %s op_mode %s\n",
1124 drv->fw.fw_version, op->name);
1126 /* add this device to the list of devices using this op_mode */
1127 list_add_tail(&drv->list, &op->drv);
1130 drv->op_mode = _iwl_op_mode_start(drv, op);
1132 if (!drv->op_mode) {
1133 mutex_unlock(&iwlwifi_opmode_table_mtx);
1139 mutex_unlock(&iwlwifi_opmode_table_mtx);
1142 * Complete the firmware request last so that
1143 * a driver unbind (stop) doesn't run while we
1144 * are doing the start() above.
1146 complete(&drv->request_firmware_complete);
1149 * Load the module last so we don't block anything
1150 * else from proceeding if the module fails to load
1154 err = request_module("%s", op->name);
1155 #ifdef CONFIG_IWLWIFI_OPMODE_MODULAR
1158 "failed to load module %s (error %d), is dynamic loading enabled?\n",
1165 /* try next, if any */
1166 release_firmware(ucode_raw);
1167 if (iwl_request_firmware(drv, false))
1172 IWL_ERR(drv, "failed to allocate pci memory\n");
1173 iwl_dealloc_ucode(drv);
1174 release_firmware(ucode_raw);
1176 complete(&drv->request_firmware_complete);
1177 device_release_driver(drv->trans->dev);
1180 struct iwl_drv *iwl_drv_start(struct iwl_trans *trans,
1181 const struct iwl_cfg *cfg)
1183 struct iwl_drv *drv;
1186 drv = kzalloc(sizeof(*drv), GFP_KERNEL);
1193 drv->dev = trans->dev;
1196 init_completion(&drv->request_firmware_complete);
1197 INIT_LIST_HEAD(&drv->list);
1199 #ifdef CONFIG_IWLWIFI_DEBUGFS
1200 /* Create the device debugfs entries. */
1201 drv->dbgfs_drv = debugfs_create_dir(dev_name(trans->dev),
1204 if (!drv->dbgfs_drv) {
1205 IWL_ERR(drv, "failed to create debugfs directory\n");
1210 /* Create transport layer debugfs dir */
1211 drv->trans->dbgfs_dir = debugfs_create_dir("trans", drv->dbgfs_drv);
1213 if (!drv->trans->dbgfs_dir) {
1214 IWL_ERR(drv, "failed to create transport debugfs directory\n");
1216 goto err_free_dbgfs;
1220 ret = iwl_request_firmware(drv, true);
1222 IWL_ERR(trans, "Couldn't request the fw\n");
1229 #ifdef CONFIG_IWLWIFI_DEBUGFS
1231 debugfs_remove_recursive(drv->dbgfs_drv);
1236 return ERR_PTR(ret);
1239 void iwl_drv_stop(struct iwl_drv *drv)
1241 wait_for_completion(&drv->request_firmware_complete);
1243 _iwl_op_mode_stop(drv);
1245 iwl_dealloc_ucode(drv);
1247 mutex_lock(&iwlwifi_opmode_table_mtx);
1249 * List is empty (this item wasn't added)
1250 * when firmware loading failed -- in that
1251 * case we can't remove it from any list.
1253 if (!list_empty(&drv->list))
1254 list_del(&drv->list);
1255 mutex_unlock(&iwlwifi_opmode_table_mtx);
1257 #ifdef CONFIG_IWLWIFI_DEBUGFS
1258 debugfs_remove_recursive(drv->dbgfs_drv);
1265 /* shared module parameters */
1266 struct iwl_mod_params iwlwifi_mod_params = {
1268 .bt_coex_active = true,
1269 .power_level = IWL_POWER_INDEX_1,
1271 #ifndef CONFIG_IWLWIFI_UAPSD
1272 .uapsd_disable = true,
1273 #endif /* CONFIG_IWLWIFI_UAPSD */
1274 /* the rest are 0 by default */
1276 IWL_EXPORT_SYMBOL(iwlwifi_mod_params);
1278 int iwl_opmode_register(const char *name, const struct iwl_op_mode_ops *ops)
1281 struct iwl_drv *drv;
1282 struct iwlwifi_opmode_table *op;
1284 mutex_lock(&iwlwifi_opmode_table_mtx);
1285 for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++) {
1286 op = &iwlwifi_opmode_table[i];
1287 if (strcmp(op->name, name))
1290 /* TODO: need to handle exceptional case */
1291 list_for_each_entry(drv, &op->drv, list)
1292 drv->op_mode = _iwl_op_mode_start(drv, op);
1294 mutex_unlock(&iwlwifi_opmode_table_mtx);
1297 mutex_unlock(&iwlwifi_opmode_table_mtx);
1300 IWL_EXPORT_SYMBOL(iwl_opmode_register);
1302 void iwl_opmode_deregister(const char *name)
1305 struct iwl_drv *drv;
1307 mutex_lock(&iwlwifi_opmode_table_mtx);
1308 for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++) {
1309 if (strcmp(iwlwifi_opmode_table[i].name, name))
1311 iwlwifi_opmode_table[i].ops = NULL;
1313 /* call the stop routine for all devices */
1314 list_for_each_entry(drv, &iwlwifi_opmode_table[i].drv, list)
1315 _iwl_op_mode_stop(drv);
1317 mutex_unlock(&iwlwifi_opmode_table_mtx);
1320 mutex_unlock(&iwlwifi_opmode_table_mtx);
1322 IWL_EXPORT_SYMBOL(iwl_opmode_deregister);
1324 static int __init iwl_drv_init(void)
1328 mutex_init(&iwlwifi_opmode_table_mtx);
1330 for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++)
1331 INIT_LIST_HEAD(&iwlwifi_opmode_table[i].drv);
1333 pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n");
1334 pr_info(DRV_COPYRIGHT "\n");
1336 #ifdef CONFIG_IWLWIFI_DEBUGFS
1337 /* Create the root of iwlwifi debugfs subsystem. */
1338 iwl_dbgfs_root = debugfs_create_dir(DRV_NAME, NULL);
1340 if (!iwl_dbgfs_root)
1344 return iwl_pci_register_driver();
1346 module_init(iwl_drv_init);
1348 static void __exit iwl_drv_exit(void)
1350 iwl_pci_unregister_driver();
1352 #ifdef CONFIG_IWLWIFI_DEBUGFS
1353 debugfs_remove_recursive(iwl_dbgfs_root);
1356 module_exit(iwl_drv_exit);
1358 #ifdef CONFIG_IWLWIFI_DEBUG
1359 module_param_named(debug, iwlwifi_mod_params.debug_level, uint,
1361 MODULE_PARM_DESC(debug, "debug output mask");
1364 module_param_named(swcrypto, iwlwifi_mod_params.sw_crypto, int, S_IRUGO);
1365 MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])");
1366 module_param_named(11n_disable, iwlwifi_mod_params.disable_11n, uint, S_IRUGO);
1367 MODULE_PARM_DESC(11n_disable,
1368 "disable 11n functionality, bitmap: 1: full, 2: disable agg TX, 4: disable agg RX, 8 enable agg TX");
1369 module_param_named(amsdu_size_8K, iwlwifi_mod_params.amsdu_size_8K,
1371 MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size (default 0)");
1372 module_param_named(fw_restart, iwlwifi_mod_params.restart_fw, bool, S_IRUGO);
1373 MODULE_PARM_DESC(fw_restart, "restart firmware in case of error (default true)");
1375 module_param_named(antenna_coupling, iwlwifi_mod_params.ant_coupling,
1377 MODULE_PARM_DESC(antenna_coupling,
1378 "specify antenna coupling in dB (default: 0 dB)");
1380 module_param_named(wd_disable, iwlwifi_mod_params.wd_disable, int, S_IRUGO);
1381 MODULE_PARM_DESC(wd_disable,
1382 "Disable stuck queue watchdog timer 0=system default, 1=disable (default: 1)");
1384 module_param_named(nvm_file, iwlwifi_mod_params.nvm_file, charp, S_IRUGO);
1385 MODULE_PARM_DESC(nvm_file, "NVM file name");
1387 module_param_named(uapsd_disable, iwlwifi_mod_params.uapsd_disable,
1389 #ifdef CONFIG_IWLWIFI_UAPSD
1390 MODULE_PARM_DESC(uapsd_disable, "disable U-APSD functionality (default: N)");
1392 MODULE_PARM_DESC(uapsd_disable, "disable U-APSD functionality (default: Y)");
1396 * set bt_coex_active to true, uCode will do kill/defer
1397 * every time the priority line is asserted (BT is sending signals on the
1398 * priority line in the PCIx).
1399 * set bt_coex_active to false, uCode will ignore the BT activity and
1400 * perform the normal operation
1402 * User might experience transmit issue on some platform due to WiFi/BT
1403 * co-exist problem. The possible behaviors are:
1404 * Able to scan and finding all the available AP
1405 * Not able to associate with any AP
1406 * On those platforms, WiFi communication can be restored by set
1407 * "bt_coex_active" module parameter to "false"
1409 * default: bt_coex_active = true (BT_COEX_ENABLE)
1411 module_param_named(bt_coex_active, iwlwifi_mod_params.bt_coex_active,
1413 MODULE_PARM_DESC(bt_coex_active, "enable wifi/bt co-exist (default: enable)");
1415 module_param_named(led_mode, iwlwifi_mod_params.led_mode, int, S_IRUGO);
1416 MODULE_PARM_DESC(led_mode, "0=system default, "
1417 "1=On(RF On)/Off(RF Off), 2=blinking, 3=Off (default: 0)");
1419 module_param_named(power_save, iwlwifi_mod_params.power_save,
1421 MODULE_PARM_DESC(power_save,
1422 "enable WiFi power management (default: disable)");
1424 module_param_named(power_level, iwlwifi_mod_params.power_level,
1426 MODULE_PARM_DESC(power_level,
1427 "default power save level (range from 1 - 5, default: 1)");
1429 module_param_named(fw_monitor, iwlwifi_mod_params.fw_monitor, bool, S_IRUGO);
1430 MODULE_PARM_DESC(fw_monitor,
1431 "firmware monitor - to debug FW (default: false - needs lots of memory)");