iwlwifi: mvm: new Alive / error table API
[cascardo/linux.git] / drivers / net / wireless / iwlwifi / iwl-drv.c
index 996e7f1..b608114 100644 (file)
@@ -842,6 +842,23 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
                        capa->n_scan_channels =
                                le32_to_cpup((__le32 *)tlv_data);
                        break;
+               case IWL_UCODE_TLV_FW_VERSION: {
+                       __le32 *ptr = (void *)tlv_data;
+                       u32 major, minor;
+                       u8 local_comp;
+
+                       if (tlv_len != sizeof(u32) * 3)
+                               goto invalid_tlv_len;
+
+                       major = le32_to_cpup(ptr++);
+                       minor = le32_to_cpup(ptr++);
+                       local_comp = le32_to_cpup(ptr);
+
+                       snprintf(drv->fw.fw_version,
+                                sizeof(drv->fw.fw_version), "%u.%u.%u",
+                                major, minor, local_comp);
+                       break;
+                       }
                case IWL_UCODE_TLV_FW_DBG_DEST: {
                        struct iwl_fw_dbg_dest_tlv *dest = (void *)tlv_data;
 
@@ -1107,7 +1124,10 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
        if (err)
                goto try_again;
 
-       api_ver = IWL_UCODE_API(drv->fw.ucode_ver);
+       if (drv->fw.ucode_capa.api[0] & IWL_UCODE_TLV_API_NEW_VERSION)
+               api_ver = drv->fw.ucode_ver;
+       else
+               api_ver = IWL_UCODE_API(drv->fw.ucode_ver);
 
        /*
         * api_ver should match the api version forming part of the