aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2012-02-09 01:42:43 -0500
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2012-02-27 16:24:49 -0500
commite9daccd732971b5d0268a0b858b5d14f6b6a9d86 (patch)
tree893ff81ea085eaa922662aa2ba5ea0874704422c /drivers
parente8b461c37717d6b5c071c4924845884a86c20752 (diff)
iwlwifi: parse_tlv functions set the fw_version string
struct iwl_fw contains a string that describe the fw. This string is now set by the iwl_parse_*_firmware. This string is later used to update the cfg80211 data. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-ucode.c70
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-ucode.h5
2 files changed, 44 insertions, 31 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-ucode.c b/drivers/net/wireless/iwlwifi/iwl-ucode.c
index 61c6c0568c11..ea757098654d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-ucode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-ucode.c
@@ -731,8 +731,6 @@ struct iwlagn_firmware_pieces {
731 size_t inst_size, data_size, init_size, init_data_size, 731 size_t inst_size, data_size, init_size, init_data_size,
732 wowlan_inst_size, wowlan_data_size; 732 wowlan_inst_size, wowlan_data_size;
733 733
734 u32 build;
735
736 u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr; 734 u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr;
737 u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr; 735 u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr;
738}; 736};
@@ -742,7 +740,8 @@ static int iwl_parse_v1_v2_firmware(struct iwl_nic *nic,
742 struct iwlagn_firmware_pieces *pieces) 740 struct iwlagn_firmware_pieces *pieces)
743{ 741{
744 struct iwl_ucode_header *ucode = (void *)ucode_raw->data; 742 struct iwl_ucode_header *ucode = (void *)ucode_raw->data;
745 u32 api_ver, hdr_size; 743 u32 api_ver, hdr_size, build;
744 char buildstr[25];
746 const u8 *src; 745 const u8 *src;
747 746
748 nic->fw.ucode_ver = le32_to_cpu(ucode->ver); 747 nic->fw.ucode_ver = le32_to_cpu(ucode->ver);
@@ -755,7 +754,7 @@ static int iwl_parse_v1_v2_firmware(struct iwl_nic *nic,
755 IWL_ERR(nic, "File size too small!\n"); 754 IWL_ERR(nic, "File size too small!\n");
756 return -EINVAL; 755 return -EINVAL;
757 } 756 }
758 pieces->build = le32_to_cpu(ucode->u.v2.build); 757 build = le32_to_cpu(ucode->u.v2.build);
759 pieces->inst_size = le32_to_cpu(ucode->u.v2.inst_size); 758 pieces->inst_size = le32_to_cpu(ucode->u.v2.inst_size);
760 pieces->data_size = le32_to_cpu(ucode->u.v2.data_size); 759 pieces->data_size = le32_to_cpu(ucode->u.v2.data_size);
761 pieces->init_size = le32_to_cpu(ucode->u.v2.init_size); 760 pieces->init_size = le32_to_cpu(ucode->u.v2.init_size);
@@ -770,7 +769,7 @@ static int iwl_parse_v1_v2_firmware(struct iwl_nic *nic,
770 IWL_ERR(nic, "File size too small!\n"); 769 IWL_ERR(nic, "File size too small!\n");
771 return -EINVAL; 770 return -EINVAL;
772 } 771 }
773 pieces->build = 0; 772 build = 0;
774 pieces->inst_size = le32_to_cpu(ucode->u.v1.inst_size); 773 pieces->inst_size = le32_to_cpu(ucode->u.v1.inst_size);
775 pieces->data_size = le32_to_cpu(ucode->u.v1.data_size); 774 pieces->data_size = le32_to_cpu(ucode->u.v1.data_size);
776 pieces->init_size = le32_to_cpu(ucode->u.v1.init_size); 775 pieces->init_size = le32_to_cpu(ucode->u.v1.init_size);
@@ -779,6 +778,22 @@ static int iwl_parse_v1_v2_firmware(struct iwl_nic *nic,
779 break; 778 break;
780 } 779 }
781 780
781 if (build)
782 sprintf(buildstr, " build %u%s", build,
783 (nic->fw_index == UCODE_EXPERIMENTAL_INDEX)
784 ? " (EXP)" : "");
785 else
786 buildstr[0] = '\0';
787
788 snprintf(nic->fw.fw_version,
789 sizeof(nic->fw.fw_version),
790 "%u.%u.%u.%u%s",
791 IWL_UCODE_MAJOR(nic->fw.ucode_ver),
792 IWL_UCODE_MINOR(nic->fw.ucode_ver),
793 IWL_UCODE_API(nic->fw.ucode_ver),
794 IWL_UCODE_SERIAL(nic->fw.ucode_ver),
795 buildstr);
796
782 /* Verify size of file vs. image size info in file's header */ 797 /* Verify size of file vs. image size info in file's header */
783 if (ucode_raw->size != hdr_size + pieces->inst_size + 798 if (ucode_raw->size != hdr_size + pieces->inst_size +
784 pieces->data_size + pieces->init_size + 799 pieces->data_size + pieces->init_size +
@@ -817,6 +832,8 @@ static int iwl_parse_tlv_firmware(struct iwl_nic *nic,
817 u32 tlv_len; 832 u32 tlv_len;
818 enum iwl_ucode_tlv_type tlv_type; 833 enum iwl_ucode_tlv_type tlv_type;
819 const u8 *tlv_data; 834 const u8 *tlv_data;
835 char buildstr[25];
836 u32 build;
820 837
821 if (len < sizeof(*ucode)) { 838 if (len < sizeof(*ucode)) {
822 IWL_ERR(nic, "uCode has invalid length: %zd\n", len); 839 IWL_ERR(nic, "uCode has invalid length: %zd\n", len);
@@ -847,7 +864,24 @@ static int iwl_parse_tlv_firmware(struct iwl_nic *nic,
847 tmp, wanted_alternative); 864 tmp, wanted_alternative);
848 865
849 nic->fw.ucode_ver = le32_to_cpu(ucode->ver); 866 nic->fw.ucode_ver = le32_to_cpu(ucode->ver);
850 pieces->build = le32_to_cpu(ucode->build); 867 build = le32_to_cpu(ucode->build);
868
869 if (build)
870 sprintf(buildstr, " build %u%s", build,
871 (nic->fw_index == UCODE_EXPERIMENTAL_INDEX)
872 ? " (EXP)" : "");
873 else
874 buildstr[0] = '\0';
875
876 snprintf(nic->fw.fw_version,
877 sizeof(nic->fw.fw_version),
878 "%u.%u.%u.%u%s",
879 IWL_UCODE_MAJOR(nic->fw.ucode_ver),
880 IWL_UCODE_MINOR(nic->fw.ucode_ver),
881 IWL_UCODE_API(nic->fw.ucode_ver),
882 IWL_UCODE_SERIAL(nic->fw.ucode_ver),
883 buildstr);
884
851 data = ucode->data; 885 data = ucode->data;
852 886
853 len -= sizeof(*ucode); 887 len -= sizeof(*ucode);
@@ -1021,8 +1055,6 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
1021 unsigned int api_ok = cfg->ucode_api_ok; 1055 unsigned int api_ok = cfg->ucode_api_ok;
1022 const unsigned int api_min = cfg->ucode_api_min; 1056 const unsigned int api_min = cfg->ucode_api_min;
1023 u32 api_ver; 1057 u32 api_ver;
1024 char buildstr[25];
1025 u32 build;
1026 1058
1027 fw->ucode_capa.max_probe_length = 200; 1059 fw->ucode_capa.max_probe_length = 200;
1028 fw->ucode_capa.standard_phy_calibration_size = 1060 fw->ucode_capa.standard_phy_calibration_size =
@@ -1063,7 +1095,6 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
1063 goto try_again; 1095 goto try_again;
1064 1096
1065 api_ver = IWL_UCODE_API(nic->fw.ucode_ver); 1097 api_ver = IWL_UCODE_API(nic->fw.ucode_ver);
1066 build = pieces.build;
1067 1098
1068 /* 1099 /*
1069 * api_ver should match the api version forming part of the 1100 * api_ver should match the api version forming part of the
@@ -1094,28 +1125,11 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
1094 } 1125 }
1095 } 1126 }
1096 1127
1097 if (build) 1128 IWL_INFO(nic, "loaded firmware version %s", nic->fw.fw_version);
1098 sprintf(buildstr, " build %u%s", build,
1099 (nic->fw_index == UCODE_EXPERIMENTAL_INDEX)
1100 ? " (EXP)" : "");
1101 else
1102 buildstr[0] = '\0';
1103
1104 IWL_INFO(nic, "loaded firmware version %u.%u.%u.%u%s\n",
1105 IWL_UCODE_MAJOR(nic->fw.ucode_ver),
1106 IWL_UCODE_MINOR(nic->fw.ucode_ver),
1107 IWL_UCODE_API(nic->fw.ucode_ver),
1108 IWL_UCODE_SERIAL(nic->fw.ucode_ver),
1109 buildstr);
1110 1129
1111 snprintf(priv->hw->wiphy->fw_version, 1130 snprintf(priv->hw->wiphy->fw_version,
1112 sizeof(priv->hw->wiphy->fw_version), 1131 sizeof(priv->hw->wiphy->fw_version),
1113 "%u.%u.%u.%u%s", 1132 "%s", nic->fw.fw_version);
1114 IWL_UCODE_MAJOR(nic->fw.ucode_ver),
1115 IWL_UCODE_MINOR(nic->fw.ucode_ver),
1116 IWL_UCODE_API(nic->fw.ucode_ver),
1117 IWL_UCODE_SERIAL(nic->fw.ucode_ver),
1118 buildstr);
1119 1133
1120 /* 1134 /*
1121 * For any of the failures below (before allocating pci memory) 1135 * For any of the failures below (before allocating pci memory)
diff --git a/drivers/net/wireless/iwlwifi/iwl-ucode.h b/drivers/net/wireless/iwlwifi/iwl-ucode.h
index d13e6241f126..8bebeb003bef 100644
--- a/drivers/net/wireless/iwlwifi/iwl-ucode.h
+++ b/drivers/net/wireless/iwlwifi/iwl-ucode.h
@@ -204,9 +204,8 @@ struct fw_img {
204 */ 204 */
205struct iwl_fw { 205struct iwl_fw {
206 206
207 /* ucode image and variables */ 207 u32 ucode_ver;
208 u32 ucode_ver; /* version of ucode, copy of 208
209 iwl_ucode.ver */
210 char fw_version[ETHTOOL_BUSINFO_LEN]; 209 char fw_version[ETHTOOL_BUSINFO_LEN];
211 210
212 /* ucode images */ 211 /* ucode images */