diff options
author | Johannes Berg <johannes.berg@intel.com> | 2016-04-28 08:40:59 -0400 |
---|---|---|
committer | Luca Coelho <luciano.coelho@intel.com> | 2016-07-05 17:08:21 -0400 |
commit | ca221c9b946cd4a9ea67375c8d90379a0e65179d (patch) | |
tree | c391691d12dca67b90065010638bbd4895aa7877 /drivers/net | |
parent | 6d48fcd900803c7ddb9b3813176e2cdb4fcd6aaa (diff) |
iwlwifi: change fw.mvm_fw to fw.type
Instead of explicitly indicating the difference between just
DVM and MVM with an mvm_fw boolean change this to fw.type to
be more extensible and easier to understand.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 26 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/iwl-fw.h | 14 |
2 files changed, 28 insertions, 12 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c index 26afa72daa94..e2df544cc64e 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c | |||
@@ -795,17 +795,17 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, | |||
795 | case IWL_UCODE_TLV_SEC_RT: | 795 | case IWL_UCODE_TLV_SEC_RT: |
796 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR, | 796 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR, |
797 | tlv_len); | 797 | tlv_len); |
798 | drv->fw.mvm_fw = true; | 798 | drv->fw.type = IWL_FW_MVM; |
799 | break; | 799 | break; |
800 | case IWL_UCODE_TLV_SEC_INIT: | 800 | case IWL_UCODE_TLV_SEC_INIT: |
801 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT, | 801 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT, |
802 | tlv_len); | 802 | tlv_len); |
803 | drv->fw.mvm_fw = true; | 803 | drv->fw.type = IWL_FW_MVM; |
804 | break; | 804 | break; |
805 | case IWL_UCODE_TLV_SEC_WOWLAN: | 805 | case IWL_UCODE_TLV_SEC_WOWLAN: |
806 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN, | 806 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN, |
807 | tlv_len); | 807 | tlv_len); |
808 | drv->fw.mvm_fw = true; | 808 | drv->fw.type = IWL_FW_MVM; |
809 | break; | 809 | break; |
810 | case IWL_UCODE_TLV_DEF_CALIB: | 810 | case IWL_UCODE_TLV_DEF_CALIB: |
811 | if (tlv_len != sizeof(struct iwl_tlv_calib_data)) | 811 | if (tlv_len != sizeof(struct iwl_tlv_calib_data)) |
@@ -827,17 +827,17 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, | |||
827 | case IWL_UCODE_TLV_SECURE_SEC_RT: | 827 | case IWL_UCODE_TLV_SECURE_SEC_RT: |
828 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR, | 828 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR, |
829 | tlv_len); | 829 | tlv_len); |
830 | drv->fw.mvm_fw = true; | 830 | drv->fw.type = IWL_FW_MVM; |
831 | break; | 831 | break; |
832 | case IWL_UCODE_TLV_SECURE_SEC_INIT: | 832 | case IWL_UCODE_TLV_SECURE_SEC_INIT: |
833 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT, | 833 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT, |
834 | tlv_len); | 834 | tlv_len); |
835 | drv->fw.mvm_fw = true; | 835 | drv->fw.type = IWL_FW_MVM; |
836 | break; | 836 | break; |
837 | case IWL_UCODE_TLV_SECURE_SEC_WOWLAN: | 837 | case IWL_UCODE_TLV_SECURE_SEC_WOWLAN: |
838 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN, | 838 | iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN, |
839 | tlv_len); | 839 | tlv_len); |
840 | drv->fw.mvm_fw = true; | 840 | drv->fw.type = IWL_FW_MVM; |
841 | break; | 841 | break; |
842 | case IWL_UCODE_TLV_NUM_OF_CPU: | 842 | case IWL_UCODE_TLV_NUM_OF_CPU: |
843 | if (tlv_len != sizeof(u32)) | 843 | if (tlv_len != sizeof(u32)) |
@@ -1272,7 +1272,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) | |||
1272 | * In mvm uCode there is no difference between data and instructions | 1272 | * In mvm uCode there is no difference between data and instructions |
1273 | * sections. | 1273 | * sections. |
1274 | */ | 1274 | */ |
1275 | if (!fw->mvm_fw && validate_sec_sizes(drv, pieces, drv->cfg)) | 1275 | if (fw->type == IWL_FW_DVM && validate_sec_sizes(drv, pieces, drv->cfg)) |
1276 | goto try_again; | 1276 | goto try_again; |
1277 | 1277 | ||
1278 | /* Allocate ucode buffers for card's bus-master loading ... */ | 1278 | /* Allocate ucode buffers for card's bus-master loading ... */ |
@@ -1400,10 +1400,16 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) | |||
1400 | release_firmware(ucode_raw); | 1400 | release_firmware(ucode_raw); |
1401 | 1401 | ||
1402 | mutex_lock(&iwlwifi_opmode_table_mtx); | 1402 | mutex_lock(&iwlwifi_opmode_table_mtx); |
1403 | if (fw->mvm_fw) | 1403 | switch (fw->type) { |
1404 | op = &iwlwifi_opmode_table[MVM_OP_MODE]; | 1404 | case IWL_FW_DVM: |
1405 | else | ||
1406 | op = &iwlwifi_opmode_table[DVM_OP_MODE]; | 1405 | op = &iwlwifi_opmode_table[DVM_OP_MODE]; |
1406 | break; | ||
1407 | default: | ||
1408 | WARN(1, "Invalid fw type %d\n", fw->type); | ||
1409 | case IWL_FW_MVM: | ||
1410 | op = &iwlwifi_opmode_table[MVM_OP_MODE]; | ||
1411 | break; | ||
1412 | } | ||
1407 | 1413 | ||
1408 | IWL_INFO(drv, "loaded firmware version %s op_mode %s\n", | 1414 | IWL_INFO(drv, "loaded firmware version %s op_mode %s\n", |
1409 | drv->fw.fw_version, op->name); | 1415 | drv->fw.fw_version, op->name); |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw.h b/drivers/net/wireless/intel/iwlwifi/iwl-fw.h index e461d631893a..655ec52a0c03 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-fw.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw.h | |||
@@ -231,6 +231,16 @@ struct iwl_gscan_capabilities { | |||
231 | }; | 231 | }; |
232 | 232 | ||
233 | /** | 233 | /** |
234 | * enum iwl_fw_type - iwlwifi firmware type | ||
235 | * @IWL_FW_DVM: DVM firmware | ||
236 | * @IWL_FW_MVM: MVM firmware | ||
237 | */ | ||
238 | enum iwl_fw_type { | ||
239 | IWL_FW_DVM, | ||
240 | IWL_FW_MVM, | ||
241 | }; | ||
242 | |||
243 | /** | ||
234 | * struct iwl_fw - variables associated with the firmware | 244 | * struct iwl_fw - variables associated with the firmware |
235 | * | 245 | * |
236 | * @ucode_ver: ucode version from the ucode file | 246 | * @ucode_ver: ucode version from the ucode file |
@@ -244,7 +254,7 @@ struct iwl_gscan_capabilities { | |||
244 | * @inst_evtlog_ptr: event log offset for runtime ucode. | 254 | * @inst_evtlog_ptr: event log offset for runtime ucode. |
245 | * @inst_evtlog_size: event log size for runtime ucode. | 255 | * @inst_evtlog_size: event log size for runtime ucode. |
246 | * @inst_errlog_ptr: error log offfset for runtime ucode. | 256 | * @inst_errlog_ptr: error log offfset for runtime ucode. |
247 | * @mvm_fw: indicates this is MVM firmware | 257 | * @type: firmware type (&enum iwl_fw_type) |
248 | * @cipher_scheme: optional external cipher scheme. | 258 | * @cipher_scheme: optional external cipher scheme. |
249 | * @human_readable: human readable version | 259 | * @human_readable: human readable version |
250 | * @sdio_adma_addr: the default address to set for the ADMA in SDIO mode until | 260 | * @sdio_adma_addr: the default address to set for the ADMA in SDIO mode until |
@@ -275,7 +285,7 @@ struct iwl_fw { | |||
275 | u8 valid_tx_ant; | 285 | u8 valid_tx_ant; |
276 | u8 valid_rx_ant; | 286 | u8 valid_rx_ant; |
277 | 287 | ||
278 | bool mvm_fw; | 288 | enum iwl_fw_type type; |
279 | 289 | ||
280 | struct ieee80211_cipher_scheme cs[IWL_UCODE_MAX_CS]; | 290 | struct ieee80211_cipher_scheme cs[IWL_UCODE_MAX_CS]; |
281 | u8 human_readable[FW_VER_HUMAN_READABLE_SZ]; | 291 | u8 human_readable[FW_VER_HUMAN_READABLE_SZ]; |