diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-ucode.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-ucode.c | 740 |
1 files changed, 636 insertions, 104 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-ucode.c b/drivers/net/wireless/iwlwifi/iwl-ucode.c index 2edf0ef65a5b..11b659ab261d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-ucode.c +++ b/drivers/net/wireless/iwlwifi/iwl-ucode.c | |||
@@ -32,7 +32,9 @@ | |||
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
34 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
35 | #include <linux/firmware.h> | ||
35 | 36 | ||
37 | #include "iwl-ucode.h" | ||
36 | #include "iwl-wifi.h" | 38 | #include "iwl-wifi.h" |
37 | #include "iwl-dev.h" | 39 | #include "iwl-dev.h" |
38 | #include "iwl-core.h" | 40 | #include "iwl-core.h" |
@@ -80,29 +82,29 @@ static struct iwl_wimax_coex_event_entry cu_priorities[COEX_NUM_OF_EVENTS] = { | |||
80 | * | 82 | * |
81 | ******************************************************************************/ | 83 | ******************************************************************************/ |
82 | 84 | ||
83 | static void iwl_free_fw_desc(struct iwl_bus *bus, struct fw_desc *desc) | 85 | static void iwl_free_fw_desc(struct iwl_trans *trans, struct fw_desc *desc) |
84 | { | 86 | { |
85 | if (desc->v_addr) | 87 | if (desc->v_addr) |
86 | dma_free_coherent(bus->dev, desc->len, | 88 | dma_free_coherent(trans->dev, desc->len, |
87 | desc->v_addr, desc->p_addr); | 89 | desc->v_addr, desc->p_addr); |
88 | desc->v_addr = NULL; | 90 | desc->v_addr = NULL; |
89 | desc->len = 0; | 91 | desc->len = 0; |
90 | } | 92 | } |
91 | 93 | ||
92 | static void iwl_free_fw_img(struct iwl_bus *bus, struct fw_img *img) | 94 | static void iwl_free_fw_img(struct iwl_trans *trans, struct fw_img *img) |
93 | { | 95 | { |
94 | iwl_free_fw_desc(bus, &img->code); | 96 | iwl_free_fw_desc(trans, &img->code); |
95 | iwl_free_fw_desc(bus, &img->data); | 97 | iwl_free_fw_desc(trans, &img->data); |
96 | } | 98 | } |
97 | 99 | ||
98 | void iwl_dealloc_ucode(struct iwl_trans *trans) | 100 | void iwl_dealloc_ucode(struct iwl_trans *trans) |
99 | { | 101 | { |
100 | iwl_free_fw_img(bus(trans), &trans->ucode_rt); | 102 | iwl_free_fw_img(trans, &trans->ucode_rt); |
101 | iwl_free_fw_img(bus(trans), &trans->ucode_init); | 103 | iwl_free_fw_img(trans, &trans->ucode_init); |
102 | iwl_free_fw_img(bus(trans), &trans->ucode_wowlan); | 104 | iwl_free_fw_img(trans, &trans->ucode_wowlan); |
103 | } | 105 | } |
104 | 106 | ||
105 | int iwl_alloc_fw_desc(struct iwl_bus *bus, struct fw_desc *desc, | 107 | static int iwl_alloc_fw_desc(struct iwl_trans *trans, struct fw_desc *desc, |
106 | const void *data, size_t len) | 108 | const void *data, size_t len) |
107 | { | 109 | { |
108 | if (!len) { | 110 | if (!len) { |
@@ -110,7 +112,7 @@ int iwl_alloc_fw_desc(struct iwl_bus *bus, struct fw_desc *desc, | |||
110 | return -EINVAL; | 112 | return -EINVAL; |
111 | } | 113 | } |
112 | 114 | ||
113 | desc->v_addr = dma_alloc_coherent(bus->dev, len, | 115 | desc->v_addr = dma_alloc_coherent(trans->dev, len, |
114 | &desc->p_addr, GFP_KERNEL); | 116 | &desc->p_addr, GFP_KERNEL); |
115 | if (!desc->v_addr) | 117 | if (!desc->v_addr) |
116 | return -ENOMEM; | 118 | return -ENOMEM; |
@@ -120,59 +122,6 @@ int iwl_alloc_fw_desc(struct iwl_bus *bus, struct fw_desc *desc, | |||
120 | return 0; | 122 | return 0; |
121 | } | 123 | } |
122 | 124 | ||
123 | /* | ||
124 | * ucode | ||
125 | */ | ||
126 | static int iwl_load_section(struct iwl_trans *trans, const char *name, | ||
127 | struct fw_desc *image, u32 dst_addr) | ||
128 | { | ||
129 | struct iwl_bus *bus = bus(trans); | ||
130 | dma_addr_t phy_addr = image->p_addr; | ||
131 | u32 byte_cnt = image->len; | ||
132 | int ret; | ||
133 | |||
134 | trans->ucode_write_complete = 0; | ||
135 | |||
136 | iwl_write_direct32(bus, | ||
137 | FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL), | ||
138 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE); | ||
139 | |||
140 | iwl_write_direct32(bus, | ||
141 | FH_SRVC_CHNL_SRAM_ADDR_REG(FH_SRVC_CHNL), dst_addr); | ||
142 | |||
143 | iwl_write_direct32(bus, | ||
144 | FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL), | ||
145 | phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK); | ||
146 | |||
147 | iwl_write_direct32(bus, | ||
148 | FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), | ||
149 | (iwl_get_dma_hi_addr(phy_addr) | ||
150 | << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt); | ||
151 | |||
152 | iwl_write_direct32(bus, | ||
153 | FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL), | ||
154 | 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM | | ||
155 | 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX | | ||
156 | FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID); | ||
157 | |||
158 | iwl_write_direct32(bus, | ||
159 | FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL), | ||
160 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | | ||
161 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE | | ||
162 | FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD); | ||
163 | |||
164 | IWL_DEBUG_FW(bus, "%s uCode section being loaded...\n", name); | ||
165 | ret = wait_event_timeout(trans->shrd->wait_command_queue, | ||
166 | trans->ucode_write_complete, 5 * HZ); | ||
167 | if (!ret) { | ||
168 | IWL_ERR(trans, "Could not load the %s uCode section\n", | ||
169 | name); | ||
170 | return -ETIMEDOUT; | ||
171 | } | ||
172 | |||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | static inline struct fw_img *iwl_get_ucode_image(struct iwl_trans *trans, | 125 | static inline struct fw_img *iwl_get_ucode_image(struct iwl_trans *trans, |
177 | enum iwl_ucode_type ucode_type) | 126 | enum iwl_ucode_type ucode_type) |
178 | { | 127 | { |
@@ -189,28 +138,6 @@ static inline struct fw_img *iwl_get_ucode_image(struct iwl_trans *trans, | |||
189 | return NULL; | 138 | return NULL; |
190 | } | 139 | } |
191 | 140 | ||
192 | static int iwl_load_given_ucode(struct iwl_trans *trans, | ||
193 | enum iwl_ucode_type ucode_type) | ||
194 | { | ||
195 | int ret = 0; | ||
196 | struct fw_img *image = iwl_get_ucode_image(trans, ucode_type); | ||
197 | |||
198 | |||
199 | if (!image) { | ||
200 | IWL_ERR(trans, "Invalid ucode requested (%d)\n", | ||
201 | ucode_type); | ||
202 | return -EINVAL; | ||
203 | } | ||
204 | |||
205 | ret = iwl_load_section(trans, "INST", &image->code, | ||
206 | IWLAGN_RTC_INST_LOWER_BOUND); | ||
207 | if (ret) | ||
208 | return ret; | ||
209 | |||
210 | return iwl_load_section(trans, "DATA", &image->data, | ||
211 | IWLAGN_RTC_DATA_LOWER_BOUND); | ||
212 | } | ||
213 | |||
214 | /* | 141 | /* |
215 | * Calibration | 142 | * Calibration |
216 | */ | 143 | */ |
@@ -447,7 +374,7 @@ static int iwl_alive_notify(struct iwl_trans *trans) | |||
447 | if (!priv->tx_cmd_pool) | 374 | if (!priv->tx_cmd_pool) |
448 | return -ENOMEM; | 375 | return -ENOMEM; |
449 | 376 | ||
450 | iwl_trans_tx_start(trans); | 377 | iwl_trans_fw_alive(trans); |
451 | for_each_context(priv, ctx) | 378 | for_each_context(priv, ctx) |
452 | ctx->last_tx_rejected = false; | 379 | ctx->last_tx_rejected = false; |
453 | 380 | ||
@@ -470,7 +397,7 @@ static int iwl_alive_notify(struct iwl_trans *trans) | |||
470 | * using sample data 100 bytes apart. If these sample points are good, | 397 | * using sample data 100 bytes apart. If these sample points are good, |
471 | * it's a pretty good bet that everything between them is good, too. | 398 | * it's a pretty good bet that everything between them is good, too. |
472 | */ | 399 | */ |
473 | static int iwl_verify_inst_sparse(struct iwl_bus *bus, | 400 | static int iwl_verify_inst_sparse(struct iwl_trans *trans, |
474 | struct fw_desc *fw_desc) | 401 | struct fw_desc *fw_desc) |
475 | { | 402 | { |
476 | __le32 *image = (__le32 *)fw_desc->v_addr; | 403 | __le32 *image = (__le32 *)fw_desc->v_addr; |
@@ -478,15 +405,15 @@ static int iwl_verify_inst_sparse(struct iwl_bus *bus, | |||
478 | u32 val; | 405 | u32 val; |
479 | u32 i; | 406 | u32 i; |
480 | 407 | ||
481 | IWL_DEBUG_FW(bus, "ucode inst image size is %u\n", len); | 408 | IWL_DEBUG_FW(trans, "ucode inst image size is %u\n", len); |
482 | 409 | ||
483 | for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) { | 410 | for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) { |
484 | /* read data comes through single port, auto-incr addr */ | 411 | /* read data comes through single port, auto-incr addr */ |
485 | /* NOTE: Use the debugless read so we don't flood kernel log | 412 | /* NOTE: Use the debugless read so we don't flood kernel log |
486 | * if IWL_DL_IO is set */ | 413 | * if IWL_DL_IO is set */ |
487 | iwl_write_direct32(bus, HBUS_TARG_MEM_RADDR, | 414 | iwl_write_direct32(trans, HBUS_TARG_MEM_RADDR, |
488 | i + IWLAGN_RTC_INST_LOWER_BOUND); | 415 | i + IWLAGN_RTC_INST_LOWER_BOUND); |
489 | val = iwl_read32(bus, HBUS_TARG_MEM_RDAT); | 416 | val = iwl_read32(trans, HBUS_TARG_MEM_RDAT); |
490 | if (val != le32_to_cpu(*image)) | 417 | if (val != le32_to_cpu(*image)) |
491 | return -EIO; | 418 | return -EIO; |
492 | } | 419 | } |
@@ -494,7 +421,7 @@ static int iwl_verify_inst_sparse(struct iwl_bus *bus, | |||
494 | return 0; | 421 | return 0; |
495 | } | 422 | } |
496 | 423 | ||
497 | static void iwl_print_mismatch_inst(struct iwl_bus *bus, | 424 | static void iwl_print_mismatch_inst(struct iwl_trans *trans, |
498 | struct fw_desc *fw_desc) | 425 | struct fw_desc *fw_desc) |
499 | { | 426 | { |
500 | __le32 *image = (__le32 *)fw_desc->v_addr; | 427 | __le32 *image = (__le32 *)fw_desc->v_addr; |
@@ -503,18 +430,18 @@ static void iwl_print_mismatch_inst(struct iwl_bus *bus, | |||
503 | u32 offs; | 430 | u32 offs; |
504 | int errors = 0; | 431 | int errors = 0; |
505 | 432 | ||
506 | IWL_DEBUG_FW(bus, "ucode inst image size is %u\n", len); | 433 | IWL_DEBUG_FW(trans, "ucode inst image size is %u\n", len); |
507 | 434 | ||
508 | iwl_write_direct32(bus, HBUS_TARG_MEM_RADDR, | 435 | iwl_write_direct32(trans, HBUS_TARG_MEM_RADDR, |
509 | IWLAGN_RTC_INST_LOWER_BOUND); | 436 | IWLAGN_RTC_INST_LOWER_BOUND); |
510 | 437 | ||
511 | for (offs = 0; | 438 | for (offs = 0; |
512 | offs < len && errors < 20; | 439 | offs < len && errors < 20; |
513 | offs += sizeof(u32), image++) { | 440 | offs += sizeof(u32), image++) { |
514 | /* read data comes through single port, auto-incr addr */ | 441 | /* read data comes through single port, auto-incr addr */ |
515 | val = iwl_read32(bus, HBUS_TARG_MEM_RDAT); | 442 | val = iwl_read32(trans, HBUS_TARG_MEM_RDAT); |
516 | if (val != le32_to_cpu(*image)) { | 443 | if (val != le32_to_cpu(*image)) { |
517 | IWL_ERR(bus, "uCode INST section at " | 444 | IWL_ERR(trans, "uCode INST section at " |
518 | "offset 0x%x, is 0x%x, s/b 0x%x\n", | 445 | "offset 0x%x, is 0x%x, s/b 0x%x\n", |
519 | offs, val, le32_to_cpu(*image)); | 446 | offs, val, le32_to_cpu(*image)); |
520 | errors++; | 447 | errors++; |
@@ -536,14 +463,14 @@ static int iwl_verify_ucode(struct iwl_trans *trans, | |||
536 | return -EINVAL; | 463 | return -EINVAL; |
537 | } | 464 | } |
538 | 465 | ||
539 | if (!iwl_verify_inst_sparse(bus(trans), &img->code)) { | 466 | if (!iwl_verify_inst_sparse(trans, &img->code)) { |
540 | IWL_DEBUG_FW(trans, "uCode is good in inst SRAM\n"); | 467 | IWL_DEBUG_FW(trans, "uCode is good in inst SRAM\n"); |
541 | return 0; | 468 | return 0; |
542 | } | 469 | } |
543 | 470 | ||
544 | IWL_ERR(trans, "UCODE IMAGE IN INSTRUCTION SRAM NOT VALID!!\n"); | 471 | IWL_ERR(trans, "UCODE IMAGE IN INSTRUCTION SRAM NOT VALID!!\n"); |
545 | 472 | ||
546 | iwl_print_mismatch_inst(bus(trans), &img->code); | 473 | iwl_print_mismatch_inst(trans, &img->code); |
547 | return -EIO; | 474 | return -EIO; |
548 | } | 475 | } |
549 | 476 | ||
@@ -647,28 +574,27 @@ int iwl_load_ucode_wait_alive(struct iwl_trans *trans, | |||
647 | { | 574 | { |
648 | struct iwl_notification_wait alive_wait; | 575 | struct iwl_notification_wait alive_wait; |
649 | struct iwl_alive_data alive_data; | 576 | struct iwl_alive_data alive_data; |
577 | struct fw_img *fw; | ||
650 | int ret; | 578 | int ret; |
651 | enum iwl_ucode_type old_type; | 579 | enum iwl_ucode_type old_type; |
652 | 580 | ||
653 | ret = iwl_trans_start_device(trans); | ||
654 | if (ret) | ||
655 | return ret; | ||
656 | |||
657 | iwl_init_notification_wait(trans->shrd, &alive_wait, REPLY_ALIVE, | 581 | iwl_init_notification_wait(trans->shrd, &alive_wait, REPLY_ALIVE, |
658 | iwl_alive_fn, &alive_data); | 582 | iwl_alive_fn, &alive_data); |
659 | 583 | ||
660 | old_type = trans->shrd->ucode_type; | 584 | old_type = trans->shrd->ucode_type; |
661 | trans->shrd->ucode_type = ucode_type; | 585 | trans->shrd->ucode_type = ucode_type; |
586 | fw = iwl_get_ucode_image(trans, ucode_type); | ||
587 | |||
588 | if (!fw) | ||
589 | return -EINVAL; | ||
662 | 590 | ||
663 | ret = iwl_load_given_ucode(trans, ucode_type); | 591 | ret = iwl_trans_start_fw(trans, fw); |
664 | if (ret) { | 592 | if (ret) { |
665 | trans->shrd->ucode_type = old_type; | 593 | trans->shrd->ucode_type = old_type; |
666 | iwl_remove_notification(trans->shrd, &alive_wait); | 594 | iwl_remove_notification(trans->shrd, &alive_wait); |
667 | return ret; | 595 | return ret; |
668 | } | 596 | } |
669 | 597 | ||
670 | iwl_trans_kick_nic(trans); | ||
671 | |||
672 | /* | 598 | /* |
673 | * Some things may run in the background now, but we | 599 | * Some things may run in the background now, but we |
674 | * just wait for the ALIVE notification here. | 600 | * just wait for the ALIVE notification here. |
@@ -756,3 +682,609 @@ int iwl_run_init_ucode(struct iwl_trans *trans) | |||
756 | iwl_trans_stop_device(trans); | 682 | iwl_trans_stop_device(trans); |
757 | return ret; | 683 | return ret; |
758 | } | 684 | } |
685 | |||
686 | static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); | ||
687 | |||
688 | #define UCODE_EXPERIMENTAL_INDEX 100 | ||
689 | #define UCODE_EXPERIMENTAL_TAG "exp" | ||
690 | |||
691 | int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first) | ||
692 | { | ||
693 | const char *name_pre = cfg(priv)->fw_name_pre; | ||
694 | char tag[8]; | ||
695 | |||
696 | if (first) { | ||
697 | #ifdef CONFIG_IWLWIFI_DEBUG_EXPERIMENTAL_UCODE | ||
698 | priv->fw_index = UCODE_EXPERIMENTAL_INDEX; | ||
699 | strcpy(tag, UCODE_EXPERIMENTAL_TAG); | ||
700 | } else if (priv->fw_index == UCODE_EXPERIMENTAL_INDEX) { | ||
701 | #endif | ||
702 | priv->fw_index = cfg(priv)->ucode_api_max; | ||
703 | sprintf(tag, "%d", priv->fw_index); | ||
704 | } else { | ||
705 | priv->fw_index--; | ||
706 | sprintf(tag, "%d", priv->fw_index); | ||
707 | } | ||
708 | |||
709 | if (priv->fw_index < cfg(priv)->ucode_api_min) { | ||
710 | IWL_ERR(priv, "no suitable firmware found!\n"); | ||
711 | return -ENOENT; | ||
712 | } | ||
713 | |||
714 | sprintf(priv->firmware_name, "%s%s%s", name_pre, tag, ".ucode"); | ||
715 | |||
716 | IWL_DEBUG_INFO(priv, "attempting to load firmware %s'%s'\n", | ||
717 | (priv->fw_index == UCODE_EXPERIMENTAL_INDEX) | ||
718 | ? "EXPERIMENTAL " : "", | ||
719 | priv->firmware_name); | ||
720 | |||
721 | return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name, | ||
722 | trans(priv)->dev, | ||
723 | GFP_KERNEL, priv, iwl_ucode_callback); | ||
724 | } | ||
725 | |||
726 | struct iwlagn_firmware_pieces { | ||
727 | const void *inst, *data, *init, *init_data, *wowlan_inst, *wowlan_data; | ||
728 | size_t inst_size, data_size, init_size, init_data_size, | ||
729 | wowlan_inst_size, wowlan_data_size; | ||
730 | |||
731 | u32 build; | ||
732 | |||
733 | u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr; | ||
734 | u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr; | ||
735 | }; | ||
736 | |||
737 | static int iwlagn_load_legacy_firmware(struct iwl_priv *priv, | ||
738 | const struct firmware *ucode_raw, | ||
739 | struct iwlagn_firmware_pieces *pieces) | ||
740 | { | ||
741 | struct iwl_ucode_header *ucode = (void *)ucode_raw->data; | ||
742 | u32 api_ver, hdr_size; | ||
743 | const u8 *src; | ||
744 | |||
745 | priv->ucode_ver = le32_to_cpu(ucode->ver); | ||
746 | api_ver = IWL_UCODE_API(priv->ucode_ver); | ||
747 | |||
748 | switch (api_ver) { | ||
749 | default: | ||
750 | hdr_size = 28; | ||
751 | if (ucode_raw->size < hdr_size) { | ||
752 | IWL_ERR(priv, "File size too small!\n"); | ||
753 | return -EINVAL; | ||
754 | } | ||
755 | pieces->build = le32_to_cpu(ucode->u.v2.build); | ||
756 | pieces->inst_size = le32_to_cpu(ucode->u.v2.inst_size); | ||
757 | pieces->data_size = le32_to_cpu(ucode->u.v2.data_size); | ||
758 | pieces->init_size = le32_to_cpu(ucode->u.v2.init_size); | ||
759 | pieces->init_data_size = le32_to_cpu(ucode->u.v2.init_data_size); | ||
760 | src = ucode->u.v2.data; | ||
761 | break; | ||
762 | case 0: | ||
763 | case 1: | ||
764 | case 2: | ||
765 | hdr_size = 24; | ||
766 | if (ucode_raw->size < hdr_size) { | ||
767 | IWL_ERR(priv, "File size too small!\n"); | ||
768 | return -EINVAL; | ||
769 | } | ||
770 | pieces->build = 0; | ||
771 | pieces->inst_size = le32_to_cpu(ucode->u.v1.inst_size); | ||
772 | pieces->data_size = le32_to_cpu(ucode->u.v1.data_size); | ||
773 | pieces->init_size = le32_to_cpu(ucode->u.v1.init_size); | ||
774 | pieces->init_data_size = le32_to_cpu(ucode->u.v1.init_data_size); | ||
775 | src = ucode->u.v1.data; | ||
776 | break; | ||
777 | } | ||
778 | |||
779 | /* Verify size of file vs. image size info in file's header */ | ||
780 | if (ucode_raw->size != hdr_size + pieces->inst_size + | ||
781 | pieces->data_size + pieces->init_size + | ||
782 | pieces->init_data_size) { | ||
783 | |||
784 | IWL_ERR(priv, | ||
785 | "uCode file size %d does not match expected size\n", | ||
786 | (int)ucode_raw->size); | ||
787 | return -EINVAL; | ||
788 | } | ||
789 | |||
790 | pieces->inst = src; | ||
791 | src += pieces->inst_size; | ||
792 | pieces->data = src; | ||
793 | src += pieces->data_size; | ||
794 | pieces->init = src; | ||
795 | src += pieces->init_size; | ||
796 | pieces->init_data = src; | ||
797 | src += pieces->init_data_size; | ||
798 | |||
799 | return 0; | ||
800 | } | ||
801 | |||
802 | static int iwlagn_load_firmware(struct iwl_priv *priv, | ||
803 | const struct firmware *ucode_raw, | ||
804 | struct iwlagn_firmware_pieces *pieces, | ||
805 | struct iwlagn_ucode_capabilities *capa) | ||
806 | { | ||
807 | struct iwl_tlv_ucode_header *ucode = (void *)ucode_raw->data; | ||
808 | struct iwl_ucode_tlv *tlv; | ||
809 | size_t len = ucode_raw->size; | ||
810 | const u8 *data; | ||
811 | int wanted_alternative = iwlagn_mod_params.wanted_ucode_alternative; | ||
812 | int tmp; | ||
813 | u64 alternatives; | ||
814 | u32 tlv_len; | ||
815 | enum iwl_ucode_tlv_type tlv_type; | ||
816 | const u8 *tlv_data; | ||
817 | |||
818 | if (len < sizeof(*ucode)) { | ||
819 | IWL_ERR(priv, "uCode has invalid length: %zd\n", len); | ||
820 | return -EINVAL; | ||
821 | } | ||
822 | |||
823 | if (ucode->magic != cpu_to_le32(IWL_TLV_UCODE_MAGIC)) { | ||
824 | IWL_ERR(priv, "invalid uCode magic: 0X%x\n", | ||
825 | le32_to_cpu(ucode->magic)); | ||
826 | return -EINVAL; | ||
827 | } | ||
828 | |||
829 | /* | ||
830 | * Check which alternatives are present, and "downgrade" | ||
831 | * when the chosen alternative is not present, warning | ||
832 | * the user when that happens. Some files may not have | ||
833 | * any alternatives, so don't warn in that case. | ||
834 | */ | ||
835 | alternatives = le64_to_cpu(ucode->alternatives); | ||
836 | tmp = wanted_alternative; | ||
837 | if (wanted_alternative > 63) | ||
838 | wanted_alternative = 63; | ||
839 | while (wanted_alternative && !(alternatives & BIT(wanted_alternative))) | ||
840 | wanted_alternative--; | ||
841 | if (wanted_alternative && wanted_alternative != tmp) | ||
842 | IWL_WARN(priv, | ||
843 | "uCode alternative %d not available, choosing %d\n", | ||
844 | tmp, wanted_alternative); | ||
845 | |||
846 | priv->ucode_ver = le32_to_cpu(ucode->ver); | ||
847 | pieces->build = le32_to_cpu(ucode->build); | ||
848 | data = ucode->data; | ||
849 | |||
850 | len -= sizeof(*ucode); | ||
851 | |||
852 | while (len >= sizeof(*tlv)) { | ||
853 | u16 tlv_alt; | ||
854 | |||
855 | len -= sizeof(*tlv); | ||
856 | tlv = (void *)data; | ||
857 | |||
858 | tlv_len = le32_to_cpu(tlv->length); | ||
859 | tlv_type = le16_to_cpu(tlv->type); | ||
860 | tlv_alt = le16_to_cpu(tlv->alternative); | ||
861 | tlv_data = tlv->data; | ||
862 | |||
863 | if (len < tlv_len) { | ||
864 | IWL_ERR(priv, "invalid TLV len: %zd/%u\n", | ||
865 | len, tlv_len); | ||
866 | return -EINVAL; | ||
867 | } | ||
868 | len -= ALIGN(tlv_len, 4); | ||
869 | data += sizeof(*tlv) + ALIGN(tlv_len, 4); | ||
870 | |||
871 | /* | ||
872 | * Alternative 0 is always valid. | ||
873 | * | ||
874 | * Skip alternative TLVs that are not selected. | ||
875 | */ | ||
876 | if (tlv_alt != 0 && tlv_alt != wanted_alternative) | ||
877 | continue; | ||
878 | |||
879 | switch (tlv_type) { | ||
880 | case IWL_UCODE_TLV_INST: | ||
881 | pieces->inst = tlv_data; | ||
882 | pieces->inst_size = tlv_len; | ||
883 | break; | ||
884 | case IWL_UCODE_TLV_DATA: | ||
885 | pieces->data = tlv_data; | ||
886 | pieces->data_size = tlv_len; | ||
887 | break; | ||
888 | case IWL_UCODE_TLV_INIT: | ||
889 | pieces->init = tlv_data; | ||
890 | pieces->init_size = tlv_len; | ||
891 | break; | ||
892 | case IWL_UCODE_TLV_INIT_DATA: | ||
893 | pieces->init_data = tlv_data; | ||
894 | pieces->init_data_size = tlv_len; | ||
895 | break; | ||
896 | case IWL_UCODE_TLV_BOOT: | ||
897 | IWL_ERR(priv, "Found unexpected BOOT ucode\n"); | ||
898 | break; | ||
899 | case IWL_UCODE_TLV_PROBE_MAX_LEN: | ||
900 | if (tlv_len != sizeof(u32)) | ||
901 | goto invalid_tlv_len; | ||
902 | capa->max_probe_length = | ||
903 | le32_to_cpup((__le32 *)tlv_data); | ||
904 | break; | ||
905 | case IWL_UCODE_TLV_PAN: | ||
906 | if (tlv_len) | ||
907 | goto invalid_tlv_len; | ||
908 | capa->flags |= IWL_UCODE_TLV_FLAGS_PAN; | ||
909 | break; | ||
910 | case IWL_UCODE_TLV_FLAGS: | ||
911 | /* must be at least one u32 */ | ||
912 | if (tlv_len < sizeof(u32)) | ||
913 | goto invalid_tlv_len; | ||
914 | /* and a proper number of u32s */ | ||
915 | if (tlv_len % sizeof(u32)) | ||
916 | goto invalid_tlv_len; | ||
917 | /* | ||
918 | * This driver only reads the first u32 as | ||
919 | * right now no more features are defined, | ||
920 | * if that changes then either the driver | ||
921 | * will not work with the new firmware, or | ||
922 | * it'll not take advantage of new features. | ||
923 | */ | ||
924 | capa->flags = le32_to_cpup((__le32 *)tlv_data); | ||
925 | break; | ||
926 | case IWL_UCODE_TLV_INIT_EVTLOG_PTR: | ||
927 | if (tlv_len != sizeof(u32)) | ||
928 | goto invalid_tlv_len; | ||
929 | pieces->init_evtlog_ptr = | ||
930 | le32_to_cpup((__le32 *)tlv_data); | ||
931 | break; | ||
932 | case IWL_UCODE_TLV_INIT_EVTLOG_SIZE: | ||
933 | if (tlv_len != sizeof(u32)) | ||
934 | goto invalid_tlv_len; | ||
935 | pieces->init_evtlog_size = | ||
936 | le32_to_cpup((__le32 *)tlv_data); | ||
937 | break; | ||
938 | case IWL_UCODE_TLV_INIT_ERRLOG_PTR: | ||
939 | if (tlv_len != sizeof(u32)) | ||
940 | goto invalid_tlv_len; | ||
941 | pieces->init_errlog_ptr = | ||
942 | le32_to_cpup((__le32 *)tlv_data); | ||
943 | break; | ||
944 | case IWL_UCODE_TLV_RUNT_EVTLOG_PTR: | ||
945 | if (tlv_len != sizeof(u32)) | ||
946 | goto invalid_tlv_len; | ||
947 | pieces->inst_evtlog_ptr = | ||
948 | le32_to_cpup((__le32 *)tlv_data); | ||
949 | break; | ||
950 | case IWL_UCODE_TLV_RUNT_EVTLOG_SIZE: | ||
951 | if (tlv_len != sizeof(u32)) | ||
952 | goto invalid_tlv_len; | ||
953 | pieces->inst_evtlog_size = | ||
954 | le32_to_cpup((__le32 *)tlv_data); | ||
955 | break; | ||
956 | case IWL_UCODE_TLV_RUNT_ERRLOG_PTR: | ||
957 | if (tlv_len != sizeof(u32)) | ||
958 | goto invalid_tlv_len; | ||
959 | pieces->inst_errlog_ptr = | ||
960 | le32_to_cpup((__le32 *)tlv_data); | ||
961 | break; | ||
962 | case IWL_UCODE_TLV_ENHANCE_SENS_TBL: | ||
963 | if (tlv_len) | ||
964 | goto invalid_tlv_len; | ||
965 | priv->enhance_sensitivity_table = true; | ||
966 | break; | ||
967 | case IWL_UCODE_TLV_WOWLAN_INST: | ||
968 | pieces->wowlan_inst = tlv_data; | ||
969 | pieces->wowlan_inst_size = tlv_len; | ||
970 | break; | ||
971 | case IWL_UCODE_TLV_WOWLAN_DATA: | ||
972 | pieces->wowlan_data = tlv_data; | ||
973 | pieces->wowlan_data_size = tlv_len; | ||
974 | break; | ||
975 | case IWL_UCODE_TLV_PHY_CALIBRATION_SIZE: | ||
976 | if (tlv_len != sizeof(u32)) | ||
977 | goto invalid_tlv_len; | ||
978 | capa->standard_phy_calibration_size = | ||
979 | le32_to_cpup((__le32 *)tlv_data); | ||
980 | break; | ||
981 | default: | ||
982 | IWL_DEBUG_INFO(priv, "unknown TLV: %d\n", tlv_type); | ||
983 | break; | ||
984 | } | ||
985 | } | ||
986 | |||
987 | if (len) { | ||
988 | IWL_ERR(priv, "invalid TLV after parsing: %zd\n", len); | ||
989 | iwl_print_hex_dump(priv, IWL_DL_FW, (u8 *)data, len); | ||
990 | return -EINVAL; | ||
991 | } | ||
992 | |||
993 | return 0; | ||
994 | |||
995 | invalid_tlv_len: | ||
996 | IWL_ERR(priv, "TLV %d has invalid size: %u\n", tlv_type, tlv_len); | ||
997 | iwl_print_hex_dump(priv, IWL_DL_FW, tlv_data, tlv_len); | ||
998 | |||
999 | return -EINVAL; | ||
1000 | } | ||
1001 | |||
1002 | /** | ||
1003 | * iwl_ucode_callback - callback when firmware was loaded | ||
1004 | * | ||
1005 | * If loaded successfully, copies the firmware into buffers | ||
1006 | * for the card to fetch (via DMA). | ||
1007 | */ | ||
1008 | static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | ||
1009 | { | ||
1010 | struct iwl_priv *priv = context; | ||
1011 | struct iwl_ucode_header *ucode; | ||
1012 | int err; | ||
1013 | struct iwlagn_firmware_pieces pieces; | ||
1014 | const unsigned int api_max = cfg(priv)->ucode_api_max; | ||
1015 | unsigned int api_ok = cfg(priv)->ucode_api_ok; | ||
1016 | const unsigned int api_min = cfg(priv)->ucode_api_min; | ||
1017 | u32 api_ver; | ||
1018 | char buildstr[25]; | ||
1019 | u32 build; | ||
1020 | struct iwlagn_ucode_capabilities ucode_capa = { | ||
1021 | .max_probe_length = 200, | ||
1022 | .standard_phy_calibration_size = | ||
1023 | IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE, | ||
1024 | }; | ||
1025 | |||
1026 | if (!api_ok) | ||
1027 | api_ok = api_max; | ||
1028 | |||
1029 | memset(&pieces, 0, sizeof(pieces)); | ||
1030 | |||
1031 | if (!ucode_raw) { | ||
1032 | if (priv->fw_index <= api_ok) | ||
1033 | IWL_ERR(priv, | ||
1034 | "request for firmware file '%s' failed.\n", | ||
1035 | priv->firmware_name); | ||
1036 | goto try_again; | ||
1037 | } | ||
1038 | |||
1039 | IWL_DEBUG_INFO(priv, "Loaded firmware file '%s' (%zd bytes).\n", | ||
1040 | priv->firmware_name, ucode_raw->size); | ||
1041 | |||
1042 | /* Make sure that we got at least the API version number */ | ||
1043 | if (ucode_raw->size < 4) { | ||
1044 | IWL_ERR(priv, "File size way too small!\n"); | ||
1045 | goto try_again; | ||
1046 | } | ||
1047 | |||
1048 | /* Data from ucode file: header followed by uCode images */ | ||
1049 | ucode = (struct iwl_ucode_header *)ucode_raw->data; | ||
1050 | |||
1051 | if (ucode->ver) | ||
1052 | err = iwlagn_load_legacy_firmware(priv, ucode_raw, &pieces); | ||
1053 | else | ||
1054 | err = iwlagn_load_firmware(priv, ucode_raw, &pieces, | ||
1055 | &ucode_capa); | ||
1056 | |||
1057 | if (err) | ||
1058 | goto try_again; | ||
1059 | |||
1060 | api_ver = IWL_UCODE_API(priv->ucode_ver); | ||
1061 | build = pieces.build; | ||
1062 | |||
1063 | /* | ||
1064 | * api_ver should match the api version forming part of the | ||
1065 | * firmware filename ... but we don't check for that and only rely | ||
1066 | * on the API version read from firmware header from here on forward | ||
1067 | */ | ||
1068 | /* no api version check required for experimental uCode */ | ||
1069 | if (priv->fw_index != UCODE_EXPERIMENTAL_INDEX) { | ||
1070 | if (api_ver < api_min || api_ver > api_max) { | ||
1071 | IWL_ERR(priv, | ||
1072 | "Driver unable to support your firmware API. " | ||
1073 | "Driver supports v%u, firmware is v%u.\n", | ||
1074 | api_max, api_ver); | ||
1075 | goto try_again; | ||
1076 | } | ||
1077 | |||
1078 | if (api_ver < api_ok) { | ||
1079 | if (api_ok != api_max) | ||
1080 | IWL_ERR(priv, "Firmware has old API version, " | ||
1081 | "expected v%u through v%u, got v%u.\n", | ||
1082 | api_ok, api_max, api_ver); | ||
1083 | else | ||
1084 | IWL_ERR(priv, "Firmware has old API version, " | ||
1085 | "expected v%u, got v%u.\n", | ||
1086 | api_max, api_ver); | ||
1087 | IWL_ERR(priv, "New firmware can be obtained from " | ||
1088 | "http://www.intellinuxwireless.org/.\n"); | ||
1089 | } | ||
1090 | } | ||
1091 | |||
1092 | if (build) | ||
1093 | sprintf(buildstr, " build %u%s", build, | ||
1094 | (priv->fw_index == UCODE_EXPERIMENTAL_INDEX) | ||
1095 | ? " (EXP)" : ""); | ||
1096 | else | ||
1097 | buildstr[0] = '\0'; | ||
1098 | |||
1099 | IWL_INFO(priv, "loaded firmware version %u.%u.%u.%u%s\n", | ||
1100 | IWL_UCODE_MAJOR(priv->ucode_ver), | ||
1101 | IWL_UCODE_MINOR(priv->ucode_ver), | ||
1102 | IWL_UCODE_API(priv->ucode_ver), | ||
1103 | IWL_UCODE_SERIAL(priv->ucode_ver), | ||
1104 | buildstr); | ||
1105 | |||
1106 | snprintf(priv->hw->wiphy->fw_version, | ||
1107 | sizeof(priv->hw->wiphy->fw_version), | ||
1108 | "%u.%u.%u.%u%s", | ||
1109 | IWL_UCODE_MAJOR(priv->ucode_ver), | ||
1110 | IWL_UCODE_MINOR(priv->ucode_ver), | ||
1111 | IWL_UCODE_API(priv->ucode_ver), | ||
1112 | IWL_UCODE_SERIAL(priv->ucode_ver), | ||
1113 | buildstr); | ||
1114 | |||
1115 | /* | ||
1116 | * For any of the failures below (before allocating pci memory) | ||
1117 | * we will try to load a version with a smaller API -- maybe the | ||
1118 | * user just got a corrupted version of the latest API. | ||
1119 | */ | ||
1120 | |||
1121 | IWL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", | ||
1122 | priv->ucode_ver); | ||
1123 | IWL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %Zd\n", | ||
1124 | pieces.inst_size); | ||
1125 | IWL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %Zd\n", | ||
1126 | pieces.data_size); | ||
1127 | IWL_DEBUG_INFO(priv, "f/w package hdr init inst size = %Zd\n", | ||
1128 | pieces.init_size); | ||
1129 | IWL_DEBUG_INFO(priv, "f/w package hdr init data size = %Zd\n", | ||
1130 | pieces.init_data_size); | ||
1131 | |||
1132 | /* Verify that uCode images will fit in card's SRAM */ | ||
1133 | if (pieces.inst_size > hw_params(priv).max_inst_size) { | ||
1134 | IWL_ERR(priv, "uCode instr len %Zd too large to fit in\n", | ||
1135 | pieces.inst_size); | ||
1136 | goto try_again; | ||
1137 | } | ||
1138 | |||
1139 | if (pieces.data_size > hw_params(priv).max_data_size) { | ||
1140 | IWL_ERR(priv, "uCode data len %Zd too large to fit in\n", | ||
1141 | pieces.data_size); | ||
1142 | goto try_again; | ||
1143 | } | ||
1144 | |||
1145 | if (pieces.init_size > hw_params(priv).max_inst_size) { | ||
1146 | IWL_ERR(priv, "uCode init instr len %Zd too large to fit in\n", | ||
1147 | pieces.init_size); | ||
1148 | goto try_again; | ||
1149 | } | ||
1150 | |||
1151 | if (pieces.init_data_size > hw_params(priv).max_data_size) { | ||
1152 | IWL_ERR(priv, "uCode init data len %Zd too large to fit in\n", | ||
1153 | pieces.init_data_size); | ||
1154 | goto try_again; | ||
1155 | } | ||
1156 | |||
1157 | /* Allocate ucode buffers for card's bus-master loading ... */ | ||
1158 | |||
1159 | /* Runtime instructions and 2 copies of data: | ||
1160 | * 1) unmodified from disk | ||
1161 | * 2) backup cache for save/restore during power-downs */ | ||
1162 | if (iwl_alloc_fw_desc(trans(priv), &trans(priv)->ucode_rt.code, | ||
1163 | pieces.inst, pieces.inst_size)) | ||
1164 | goto err_pci_alloc; | ||
1165 | if (iwl_alloc_fw_desc(trans(priv), &trans(priv)->ucode_rt.data, | ||
1166 | pieces.data, pieces.data_size)) | ||
1167 | goto err_pci_alloc; | ||
1168 | |||
1169 | /* Initialization instructions and data */ | ||
1170 | if (pieces.init_size && pieces.init_data_size) { | ||
1171 | if (iwl_alloc_fw_desc(trans(priv), | ||
1172 | &trans(priv)->ucode_init.code, | ||
1173 | pieces.init, pieces.init_size)) | ||
1174 | goto err_pci_alloc; | ||
1175 | if (iwl_alloc_fw_desc(trans(priv), | ||
1176 | &trans(priv)->ucode_init.data, | ||
1177 | pieces.init_data, pieces.init_data_size)) | ||
1178 | goto err_pci_alloc; | ||
1179 | } | ||
1180 | |||
1181 | /* WoWLAN instructions and data */ | ||
1182 | if (pieces.wowlan_inst_size && pieces.wowlan_data_size) { | ||
1183 | if (iwl_alloc_fw_desc(trans(priv), | ||
1184 | &trans(priv)->ucode_wowlan.code, | ||
1185 | pieces.wowlan_inst, | ||
1186 | pieces.wowlan_inst_size)) | ||
1187 | goto err_pci_alloc; | ||
1188 | if (iwl_alloc_fw_desc(trans(priv), | ||
1189 | &trans(priv)->ucode_wowlan.data, | ||
1190 | pieces.wowlan_data, | ||
1191 | pieces.wowlan_data_size)) | ||
1192 | goto err_pci_alloc; | ||
1193 | } | ||
1194 | |||
1195 | /* Now that we can no longer fail, copy information */ | ||
1196 | |||
1197 | /* | ||
1198 | * The (size - 16) / 12 formula is based on the information recorded | ||
1199 | * for each event, which is of mode 1 (including timestamp) for all | ||
1200 | * new microcodes that include this information. | ||
1201 | */ | ||
1202 | priv->init_evtlog_ptr = pieces.init_evtlog_ptr; | ||
1203 | if (pieces.init_evtlog_size) | ||
1204 | priv->init_evtlog_size = (pieces.init_evtlog_size - 16)/12; | ||
1205 | else | ||
1206 | priv->init_evtlog_size = | ||
1207 | cfg(priv)->base_params->max_event_log_size; | ||
1208 | priv->init_errlog_ptr = pieces.init_errlog_ptr; | ||
1209 | priv->inst_evtlog_ptr = pieces.inst_evtlog_ptr; | ||
1210 | if (pieces.inst_evtlog_size) | ||
1211 | priv->inst_evtlog_size = (pieces.inst_evtlog_size - 16)/12; | ||
1212 | else | ||
1213 | priv->inst_evtlog_size = | ||
1214 | cfg(priv)->base_params->max_event_log_size; | ||
1215 | priv->inst_errlog_ptr = pieces.inst_errlog_ptr; | ||
1216 | #ifndef CONFIG_IWLWIFI_P2P | ||
1217 | ucode_capa.flags &= ~IWL_UCODE_TLV_FLAGS_PAN; | ||
1218 | #endif | ||
1219 | |||
1220 | priv->new_scan_threshold_behaviour = | ||
1221 | !!(ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWSCAN); | ||
1222 | |||
1223 | if (!(cfg(priv)->sku & EEPROM_SKU_CAP_IPAN_ENABLE)) | ||
1224 | ucode_capa.flags &= ~IWL_UCODE_TLV_FLAGS_PAN; | ||
1225 | |||
1226 | /* | ||
1227 | * if not PAN, then don't support P2P -- might be a uCode | ||
1228 | * packaging bug or due to the eeprom check above | ||
1229 | */ | ||
1230 | if (!(ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PAN)) | ||
1231 | ucode_capa.flags &= ~IWL_UCODE_TLV_FLAGS_P2P; | ||
1232 | |||
1233 | if (ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PAN) { | ||
1234 | priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN; | ||
1235 | priv->shrd->cmd_queue = IWL_IPAN_CMD_QUEUE_NUM; | ||
1236 | } else { | ||
1237 | priv->sta_key_max_num = STA_KEY_MAX_NUM; | ||
1238 | priv->shrd->cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM; | ||
1239 | } | ||
1240 | /* | ||
1241 | * figure out the offset of chain noise reset and gain commands | ||
1242 | * base on the size of standard phy calibration commands table size | ||
1243 | */ | ||
1244 | if (ucode_capa.standard_phy_calibration_size > | ||
1245 | IWL_MAX_PHY_CALIBRATE_TBL_SIZE) | ||
1246 | ucode_capa.standard_phy_calibration_size = | ||
1247 | IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE; | ||
1248 | |||
1249 | priv->phy_calib_chain_noise_reset_cmd = | ||
1250 | ucode_capa.standard_phy_calibration_size; | ||
1251 | priv->phy_calib_chain_noise_gain_cmd = | ||
1252 | ucode_capa.standard_phy_calibration_size + 1; | ||
1253 | |||
1254 | /* initialize all valid contexts */ | ||
1255 | iwl_init_context(priv, ucode_capa.flags); | ||
1256 | |||
1257 | /************************************************** | ||
1258 | * This is still part of probe() in a sense... | ||
1259 | * | ||
1260 | * 9. Setup and register with mac80211 and debugfs | ||
1261 | **************************************************/ | ||
1262 | err = iwlagn_mac_setup_register(priv, &ucode_capa); | ||
1263 | if (err) | ||
1264 | goto out_unbind; | ||
1265 | |||
1266 | err = iwl_dbgfs_register(priv, DRV_NAME); | ||
1267 | if (err) | ||
1268 | IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); | ||
1269 | |||
1270 | /* We have our copies now, allow OS release its copies */ | ||
1271 | release_firmware(ucode_raw); | ||
1272 | complete(&priv->firmware_loading_complete); | ||
1273 | return; | ||
1274 | |||
1275 | try_again: | ||
1276 | /* try next, if any */ | ||
1277 | if (iwl_request_firmware(priv, false)) | ||
1278 | goto out_unbind; | ||
1279 | release_firmware(ucode_raw); | ||
1280 | return; | ||
1281 | |||
1282 | err_pci_alloc: | ||
1283 | IWL_ERR(priv, "failed to allocate pci memory\n"); | ||
1284 | iwl_dealloc_ucode(trans(priv)); | ||
1285 | out_unbind: | ||
1286 | complete(&priv->firmware_loading_complete); | ||
1287 | device_release_driver(trans(priv)->dev); | ||
1288 | release_firmware(ucode_raw); | ||
1289 | } | ||
1290 | |||