diff options
author | John W. Linville <linville@tuxdriver.com> | 2012-04-18 14:17:13 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-04-18 14:27:48 -0400 |
commit | 59ef43e681d103a51c3727dad0315e093f07ec61 (patch) | |
tree | 87f6320f1440ce3ce6c0c15ad3cef8bc98186f88 /drivers/net/wireless/iwlwifi/iwl-drv.c | |
parent | 91fbe33034c184c6a60e31c2207a2f7ec2f180dc (diff) | |
parent | b5abcf0219263f4e961dca71cbe26e06c5b0ee68 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts:
drivers/net/wireless/iwlwifi/iwl-testmode.c
include/net/nfc/nfc.h
net/nfc/netlink.c
net/wireless/nl80211.c
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-drv.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-drv.c | 70 |
1 files changed, 2 insertions, 68 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c index 6f312c77af5e..17485e715424 100644 --- a/drivers/net/wireless/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/iwlwifi/iwl-drv.c | |||
@@ -284,6 +284,7 @@ static int iwl_store_ucode_sec(struct iwl_firmware_pieces *pieces, | |||
284 | 284 | ||
285 | sec->offset = le32_to_cpu(sec_parse->offset); | 285 | sec->offset = le32_to_cpu(sec_parse->offset); |
286 | sec->data = sec_parse->data; | 286 | sec->data = sec_parse->data; |
287 | sec->size = size - sizeof(sec_parse->offset); | ||
287 | 288 | ||
288 | ++img->sec_counter; | 289 | ++img->sec_counter; |
289 | 290 | ||
@@ -414,9 +415,6 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, | |||
414 | struct iwl_ucode_tlv *tlv; | 415 | struct iwl_ucode_tlv *tlv; |
415 | size_t len = ucode_raw->size; | 416 | size_t len = ucode_raw->size; |
416 | const u8 *data; | 417 | const u8 *data; |
417 | int wanted_alternative = iwlagn_mod_params.wanted_ucode_alternative; | ||
418 | int tmp; | ||
419 | u64 alternatives; | ||
420 | u32 tlv_len; | 418 | u32 tlv_len; |
421 | enum iwl_ucode_tlv_type tlv_type; | 419 | enum iwl_ucode_tlv_type tlv_type; |
422 | const u8 *tlv_data; | 420 | const u8 *tlv_data; |
@@ -434,23 +432,6 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, | |||
434 | return -EINVAL; | 432 | return -EINVAL; |
435 | } | 433 | } |
436 | 434 | ||
437 | /* | ||
438 | * Check which alternatives are present, and "downgrade" | ||
439 | * when the chosen alternative is not present, warning | ||
440 | * the user when that happens. Some files may not have | ||
441 | * any alternatives, so don't warn in that case. | ||
442 | */ | ||
443 | alternatives = le64_to_cpu(ucode->alternatives); | ||
444 | tmp = wanted_alternative; | ||
445 | if (wanted_alternative > 63) | ||
446 | wanted_alternative = 63; | ||
447 | while (wanted_alternative && !(alternatives & BIT(wanted_alternative))) | ||
448 | wanted_alternative--; | ||
449 | if (wanted_alternative && wanted_alternative != tmp) | ||
450 | IWL_WARN(drv, | ||
451 | "uCode alternative %d not available, choosing %d\n", | ||
452 | tmp, wanted_alternative); | ||
453 | |||
454 | drv->fw.ucode_ver = le32_to_cpu(ucode->ver); | 435 | drv->fw.ucode_ver = le32_to_cpu(ucode->ver); |
455 | build = le32_to_cpu(ucode->build); | 436 | build = le32_to_cpu(ucode->build); |
456 | 437 | ||
@@ -475,14 +456,11 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, | |||
475 | len -= sizeof(*ucode); | 456 | len -= sizeof(*ucode); |
476 | 457 | ||
477 | while (len >= sizeof(*tlv)) { | 458 | while (len >= sizeof(*tlv)) { |
478 | u16 tlv_alt; | ||
479 | |||
480 | len -= sizeof(*tlv); | 459 | len -= sizeof(*tlv); |
481 | tlv = (void *)data; | 460 | tlv = (void *)data; |
482 | 461 | ||
483 | tlv_len = le32_to_cpu(tlv->length); | 462 | tlv_len = le32_to_cpu(tlv->length); |
484 | tlv_type = le16_to_cpu(tlv->type); | 463 | tlv_type = le32_to_cpu(tlv->type); |
485 | tlv_alt = le16_to_cpu(tlv->alternative); | ||
486 | tlv_data = tlv->data; | 464 | tlv_data = tlv->data; |
487 | 465 | ||
488 | if (len < tlv_len) { | 466 | if (len < tlv_len) { |
@@ -493,14 +471,6 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, | |||
493 | len -= ALIGN(tlv_len, 4); | 471 | len -= ALIGN(tlv_len, 4); |
494 | data += sizeof(*tlv) + ALIGN(tlv_len, 4); | 472 | data += sizeof(*tlv) + ALIGN(tlv_len, 4); |
495 | 473 | ||
496 | /* | ||
497 | * Alternative 0 is always valid. | ||
498 | * | ||
499 | * Skip alternative TLVs that are not selected. | ||
500 | */ | ||
501 | if (tlv_alt != 0 && tlv_alt != wanted_alternative) | ||
502 | continue; | ||
503 | |||
504 | switch (tlv_type) { | 474 | switch (tlv_type) { |
505 | case IWL_UCODE_TLV_INST: | 475 | case IWL_UCODE_TLV_INST: |
506 | set_sec_data(pieces, IWL_UCODE_REGULAR, | 476 | set_sec_data(pieces, IWL_UCODE_REGULAR, |
@@ -838,42 +808,6 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
838 | IWL_INFO(drv, "loaded firmware version %s", drv->fw.fw_version); | 808 | IWL_INFO(drv, "loaded firmware version %s", drv->fw.fw_version); |
839 | 809 | ||
840 | /* | 810 | /* |
841 | * For any of the failures below (before allocating pci memory) | ||
842 | * we will try to load a version with a smaller API -- maybe the | ||
843 | * user just got a corrupted version of the latest API. | ||
844 | */ | ||
845 | |||
846 | IWL_DEBUG_INFO(drv, "f/w package hdr ucode version raw = 0x%x\n", | ||
847 | drv->fw.ucode_ver); | ||
848 | IWL_DEBUG_INFO(drv, "f/w package hdr runtime inst size = %Zd\n", | ||
849 | get_sec_size(&pieces, IWL_UCODE_REGULAR, | ||
850 | IWL_UCODE_SECTION_INST)); | ||
851 | IWL_DEBUG_INFO(drv, "f/w package hdr runtime data size = %Zd\n", | ||
852 | get_sec_size(&pieces, IWL_UCODE_REGULAR, | ||
853 | IWL_UCODE_SECTION_DATA)); | ||
854 | IWL_DEBUG_INFO(drv, "f/w package hdr init inst size = %Zd\n", | ||
855 | get_sec_size(&pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST)); | ||
856 | IWL_DEBUG_INFO(drv, "f/w package hdr init data size = %Zd\n", | ||
857 | get_sec_size(&pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA)); | ||
858 | |||
859 | /* Verify that uCode images will fit in card's SRAM */ | ||
860 | if (get_sec_size(&pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST) > | ||
861 | cfg->max_inst_size) { | ||
862 | IWL_ERR(drv, "uCode instr len %Zd too large to fit in\n", | ||
863 | get_sec_size(&pieces, IWL_UCODE_REGULAR, | ||
864 | IWL_UCODE_SECTION_INST)); | ||
865 | goto try_again; | ||
866 | } | ||
867 | |||
868 | if (get_sec_size(&pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA) > | ||
869 | cfg->max_data_size) { | ||
870 | IWL_ERR(drv, "uCode data len %Zd too large to fit in\n", | ||
871 | get_sec_size(&pieces, IWL_UCODE_REGULAR, | ||
872 | IWL_UCODE_SECTION_DATA)); | ||
873 | goto try_again; | ||
874 | } | ||
875 | |||
876 | /* | ||
877 | * In mvm uCode there is no difference between data and instructions | 811 | * In mvm uCode there is no difference between data and instructions |
878 | * sections. | 812 | * sections. |
879 | */ | 813 | */ |