Commit e9daccd7 authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by Wey-Yi Guy

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: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent e8b461c3
...@@ -731,8 +731,6 @@ struct iwlagn_firmware_pieces { ...@@ -731,8 +731,6 @@ struct iwlagn_firmware_pieces {
size_t inst_size, data_size, init_size, init_data_size, size_t inst_size, data_size, init_size, init_data_size,
wowlan_inst_size, wowlan_data_size; wowlan_inst_size, wowlan_data_size;
u32 build;
u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr; u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr;
u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr; u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr;
}; };
...@@ -742,7 +740,8 @@ static int iwl_parse_v1_v2_firmware(struct iwl_nic *nic, ...@@ -742,7 +740,8 @@ static int iwl_parse_v1_v2_firmware(struct iwl_nic *nic,
struct iwlagn_firmware_pieces *pieces) struct iwlagn_firmware_pieces *pieces)
{ {
struct iwl_ucode_header *ucode = (void *)ucode_raw->data; struct iwl_ucode_header *ucode = (void *)ucode_raw->data;
u32 api_ver, hdr_size; u32 api_ver, hdr_size, build;
char buildstr[25];
const u8 *src; const u8 *src;
nic->fw.ucode_ver = le32_to_cpu(ucode->ver); 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,7 +754,7 @@ static int iwl_parse_v1_v2_firmware(struct iwl_nic *nic,
IWL_ERR(nic, "File size too small!\n"); IWL_ERR(nic, "File size too small!\n");
return -EINVAL; return -EINVAL;
} }
pieces->build = le32_to_cpu(ucode->u.v2.build); build = le32_to_cpu(ucode->u.v2.build);
pieces->inst_size = le32_to_cpu(ucode->u.v2.inst_size); pieces->inst_size = le32_to_cpu(ucode->u.v2.inst_size);
pieces->data_size = le32_to_cpu(ucode->u.v2.data_size); pieces->data_size = le32_to_cpu(ucode->u.v2.data_size);
pieces->init_size = le32_to_cpu(ucode->u.v2.init_size); 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,7 +769,7 @@ static int iwl_parse_v1_v2_firmware(struct iwl_nic *nic,
IWL_ERR(nic, "File size too small!\n"); IWL_ERR(nic, "File size too small!\n");
return -EINVAL; return -EINVAL;
} }
pieces->build = 0; build = 0;
pieces->inst_size = le32_to_cpu(ucode->u.v1.inst_size); pieces->inst_size = le32_to_cpu(ucode->u.v1.inst_size);
pieces->data_size = le32_to_cpu(ucode->u.v1.data_size); pieces->data_size = le32_to_cpu(ucode->u.v1.data_size);
pieces->init_size = le32_to_cpu(ucode->u.v1.init_size); 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,6 +778,22 @@ static int iwl_parse_v1_v2_firmware(struct iwl_nic *nic,
break; break;
} }
if (build)
sprintf(buildstr, " build %u%s", build,
(nic->fw_index == UCODE_EXPERIMENTAL_INDEX)
? " (EXP)" : "");
else
buildstr[0] = '\0';
snprintf(nic->fw.fw_version,
sizeof(nic->fw.fw_version),
"%u.%u.%u.%u%s",
IWL_UCODE_MAJOR(nic->fw.ucode_ver),
IWL_UCODE_MINOR(nic->fw.ucode_ver),
IWL_UCODE_API(nic->fw.ucode_ver),
IWL_UCODE_SERIAL(nic->fw.ucode_ver),
buildstr);
/* Verify size of file vs. image size info in file's header */ /* Verify size of file vs. image size info in file's header */
if (ucode_raw->size != hdr_size + pieces->inst_size + if (ucode_raw->size != hdr_size + pieces->inst_size +
pieces->data_size + pieces->init_size + pieces->data_size + pieces->init_size +
...@@ -817,6 +832,8 @@ static int iwl_parse_tlv_firmware(struct iwl_nic *nic, ...@@ -817,6 +832,8 @@ static int iwl_parse_tlv_firmware(struct iwl_nic *nic,
u32 tlv_len; u32 tlv_len;
enum iwl_ucode_tlv_type tlv_type; enum iwl_ucode_tlv_type tlv_type;
const u8 *tlv_data; const u8 *tlv_data;
char buildstr[25];
u32 build;
if (len < sizeof(*ucode)) { if (len < sizeof(*ucode)) {
IWL_ERR(nic, "uCode has invalid length: %zd\n", len); 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,7 +864,24 @@ static int iwl_parse_tlv_firmware(struct iwl_nic *nic,
tmp, wanted_alternative); tmp, wanted_alternative);
nic->fw.ucode_ver = le32_to_cpu(ucode->ver); nic->fw.ucode_ver = le32_to_cpu(ucode->ver);
pieces->build = le32_to_cpu(ucode->build); build = le32_to_cpu(ucode->build);
if (build)
sprintf(buildstr, " build %u%s", build,
(nic->fw_index == UCODE_EXPERIMENTAL_INDEX)
? " (EXP)" : "");
else
buildstr[0] = '\0';
snprintf(nic->fw.fw_version,
sizeof(nic->fw.fw_version),
"%u.%u.%u.%u%s",
IWL_UCODE_MAJOR(nic->fw.ucode_ver),
IWL_UCODE_MINOR(nic->fw.ucode_ver),
IWL_UCODE_API(nic->fw.ucode_ver),
IWL_UCODE_SERIAL(nic->fw.ucode_ver),
buildstr);
data = ucode->data; data = ucode->data;
len -= sizeof(*ucode); len -= sizeof(*ucode);
...@@ -1021,8 +1055,6 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) ...@@ -1021,8 +1055,6 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
unsigned int api_ok = cfg->ucode_api_ok; unsigned int api_ok = cfg->ucode_api_ok;
const unsigned int api_min = cfg->ucode_api_min; const unsigned int api_min = cfg->ucode_api_min;
u32 api_ver; u32 api_ver;
char buildstr[25];
u32 build;
fw->ucode_capa.max_probe_length = 200; fw->ucode_capa.max_probe_length = 200;
fw->ucode_capa.standard_phy_calibration_size = fw->ucode_capa.standard_phy_calibration_size =
...@@ -1063,7 +1095,6 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) ...@@ -1063,7 +1095,6 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
goto try_again; goto try_again;
api_ver = IWL_UCODE_API(nic->fw.ucode_ver); api_ver = IWL_UCODE_API(nic->fw.ucode_ver);
build = pieces.build;
/* /*
* api_ver should match the api version forming part of the * 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,28 +1125,11 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
} }
} }
if (build) IWL_INFO(nic, "loaded firmware version %s", nic->fw.fw_version);
sprintf(buildstr, " build %u%s", build,
(nic->fw_index == UCODE_EXPERIMENTAL_INDEX)
? " (EXP)" : "");
else
buildstr[0] = '\0';
IWL_INFO(nic, "loaded firmware version %u.%u.%u.%u%s\n",
IWL_UCODE_MAJOR(nic->fw.ucode_ver),
IWL_UCODE_MINOR(nic->fw.ucode_ver),
IWL_UCODE_API(nic->fw.ucode_ver),
IWL_UCODE_SERIAL(nic->fw.ucode_ver),
buildstr);
snprintf(priv->hw->wiphy->fw_version, snprintf(priv->hw->wiphy->fw_version,
sizeof(priv->hw->wiphy->fw_version), sizeof(priv->hw->wiphy->fw_version),
"%u.%u.%u.%u%s", "%s", nic->fw.fw_version);
IWL_UCODE_MAJOR(nic->fw.ucode_ver),
IWL_UCODE_MINOR(nic->fw.ucode_ver),
IWL_UCODE_API(nic->fw.ucode_ver),
IWL_UCODE_SERIAL(nic->fw.ucode_ver),
buildstr);
/* /*
* For any of the failures below (before allocating pci memory) * For any of the failures below (before allocating pci memory)
......
...@@ -204,9 +204,8 @@ struct fw_img { ...@@ -204,9 +204,8 @@ struct fw_img {
*/ */
struct iwl_fw { struct iwl_fw {
/* ucode image and variables */ u32 ucode_ver;
u32 ucode_ver; /* version of ucode, copy of
iwl_ucode.ver */
char fw_version[ETHTOOL_BUSINFO_LEN]; char fw_version[ETHTOOL_BUSINFO_LEN];
/* ucode images */ /* ucode images */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment