Commit 55b514b4 authored by Johannes Berg's avatar Johannes Berg Committed by Luca Coelho

iwlwifi: incorporate firmware filename into version

We have many different firmware images with the same version,
and it's sometimes cumbersome to figure out which image was
really used, especially as the marketing strings that we do
print out can be the same for (slightly) different hardware
using different firmware images.

Incorporate the firmware filename into the fw_version so it's
printed out all the time. Unfortunately, this will make the
string be longer than the 32 characters for ethtool, but we
almost never really use ethtool, so strip the "iwlwifi-"
prefix (if not overridden), and the remaining data that may
then be stripped at the end is not usually useful anyway.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent e701da0c
...@@ -251,7 +251,7 @@ struct iwl_fw_dbg { ...@@ -251,7 +251,7 @@ struct iwl_fw_dbg {
struct iwl_fw { struct iwl_fw {
u32 ucode_ver; u32 ucode_ver;
char fw_version[ETHTOOL_FWVERS_LEN]; char fw_version[64];
/* ucode images */ /* ucode images */
struct fw_img img[IWL_UCODE_TYPE_MAX]; struct fw_img img[IWL_UCODE_TYPE_MAX];
......
...@@ -493,6 +493,16 @@ static void iwl_set_ucode_capabilities(struct iwl_drv *drv, const u8 *data, ...@@ -493,6 +493,16 @@ static void iwl_set_ucode_capabilities(struct iwl_drv *drv, const u8 *data,
} }
} }
static const char *iwl_reduced_fw_name(struct iwl_drv *drv)
{
const char *name = drv->firmware_name;
if (strncmp(name, "iwlwifi-", 8) == 0)
name += 8;
return name;
}
static int iwl_parse_v1_v2_firmware(struct iwl_drv *drv, static int iwl_parse_v1_v2_firmware(struct iwl_drv *drv,
const struct firmware *ucode_raw, const struct firmware *ucode_raw,
struct iwl_firmware_pieces *pieces) struct iwl_firmware_pieces *pieces)
...@@ -551,12 +561,12 @@ static int iwl_parse_v1_v2_firmware(struct iwl_drv *drv, ...@@ -551,12 +561,12 @@ static int iwl_parse_v1_v2_firmware(struct iwl_drv *drv,
snprintf(drv->fw.fw_version, snprintf(drv->fw.fw_version,
sizeof(drv->fw.fw_version), sizeof(drv->fw.fw_version),
"%u.%u.%u.%u%s", "%u.%u.%u.%u%s %s",
IWL_UCODE_MAJOR(drv->fw.ucode_ver), IWL_UCODE_MAJOR(drv->fw.ucode_ver),
IWL_UCODE_MINOR(drv->fw.ucode_ver), IWL_UCODE_MINOR(drv->fw.ucode_ver),
IWL_UCODE_API(drv->fw.ucode_ver), IWL_UCODE_API(drv->fw.ucode_ver),
IWL_UCODE_SERIAL(drv->fw.ucode_ver), IWL_UCODE_SERIAL(drv->fw.ucode_ver),
buildstr); buildstr, iwl_reduced_fw_name(drv));
/* Verify size of file vs. image size info in file's header */ /* Verify size of file vs. image size info in file's header */
...@@ -636,12 +646,12 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -636,12 +646,12 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
snprintf(drv->fw.fw_version, snprintf(drv->fw.fw_version,
sizeof(drv->fw.fw_version), sizeof(drv->fw.fw_version),
"%u.%u.%u.%u%s", "%u.%u.%u.%u%s %s",
IWL_UCODE_MAJOR(drv->fw.ucode_ver), IWL_UCODE_MAJOR(drv->fw.ucode_ver),
IWL_UCODE_MINOR(drv->fw.ucode_ver), IWL_UCODE_MINOR(drv->fw.ucode_ver),
IWL_UCODE_API(drv->fw.ucode_ver), IWL_UCODE_API(drv->fw.ucode_ver),
IWL_UCODE_SERIAL(drv->fw.ucode_ver), IWL_UCODE_SERIAL(drv->fw.ucode_ver),
buildstr); buildstr, iwl_reduced_fw_name(drv));
data = ucode->data; data = ucode->data;
...@@ -895,11 +905,13 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -895,11 +905,13 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
if (major >= 35) if (major >= 35)
snprintf(drv->fw.fw_version, snprintf(drv->fw.fw_version,
sizeof(drv->fw.fw_version), sizeof(drv->fw.fw_version),
"%u.%08x.%u", major, minor, local_comp); "%u.%08x.%u %s", major, minor,
local_comp, iwl_reduced_fw_name(drv));
else else
snprintf(drv->fw.fw_version, snprintf(drv->fw.fw_version,
sizeof(drv->fw.fw_version), sizeof(drv->fw.fw_version),
"%u.%u.%u", major, minor, local_comp); "%u.%u.%u %s", major, minor,
local_comp, iwl_reduced_fw_name(drv));
break; break;
} }
case IWL_UCODE_TLV_FW_DBG_DEST: { case IWL_UCODE_TLV_FW_DBG_DEST: {
......
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