Commit a42506eb authored by Meenakshi Venkataraman's avatar Meenakshi Venkataraman Committed by John W. Linville

iwlwifi: move ucode_type from shared to op_mode

This variable holds the ucode currently
running on the device; which is determined by
op_mode, so move this parameter there.

Also, the name of the variable is a bit
misleading, so rename it to cur_ucode.
Signed-off-by: default avatarMeenakshi Venkataraman <meenakshi.venkataraman@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 2fdfc476
...@@ -1632,7 +1632,7 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) ...@@ -1632,7 +1632,7 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv)
struct iwl_error_event_table table; struct iwl_error_event_table table;
base = priv->device_pointers.error_event_table; base = priv->device_pointers.error_event_table;
if (priv->shrd->ucode_type == IWL_UCODE_INIT) { if (priv->cur_ucode == IWL_UCODE_INIT) {
if (!base) if (!base)
base = priv->shrd->fw->init_errlog_ptr; base = priv->shrd->fw->init_errlog_ptr;
} else { } else {
...@@ -1644,7 +1644,7 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) ...@@ -1644,7 +1644,7 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv)
IWL_ERR(priv, IWL_ERR(priv,
"Not valid error log pointer 0x%08X for %s uCode\n", "Not valid error log pointer 0x%08X for %s uCode\n",
base, base,
(priv->shrd->ucode_type == IWL_UCODE_INIT) (priv->cur_ucode == IWL_UCODE_INIT)
? "Init" : "RT"); ? "Init" : "RT");
return; return;
} }
...@@ -1723,7 +1723,7 @@ static int iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, ...@@ -1723,7 +1723,7 @@ static int iwl_print_event_log(struct iwl_priv *priv, u32 start_idx,
return pos; return pos;
base = priv->device_pointers.log_event_table; base = priv->device_pointers.log_event_table;
if (priv->shrd->ucode_type == IWL_UCODE_INIT) { if (priv->cur_ucode == IWL_UCODE_INIT) {
if (!base) if (!base)
base = priv->shrd->fw->init_evtlog_ptr; base = priv->shrd->fw->init_evtlog_ptr;
} else { } else {
...@@ -1838,7 +1838,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, ...@@ -1838,7 +1838,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
struct iwl_trans *trans = trans(priv); struct iwl_trans *trans = trans(priv);
base = priv->device_pointers.log_event_table; base = priv->device_pointers.log_event_table;
if (priv->shrd->ucode_type == IWL_UCODE_INIT) { if (priv->cur_ucode == IWL_UCODE_INIT) {
logsize = priv->shrd->fw->init_evtlog_size; logsize = priv->shrd->fw->init_evtlog_size;
if (!base) if (!base)
base = priv->shrd->fw->init_evtlog_ptr; base = priv->shrd->fw->init_evtlog_ptr;
...@@ -1852,7 +1852,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, ...@@ -1852,7 +1852,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
IWL_ERR(priv, IWL_ERR(priv,
"Invalid event log pointer 0x%08X for %s uCode\n", "Invalid event log pointer 0x%08X for %s uCode\n",
base, base,
(priv->shrd->ucode_type == IWL_UCODE_INIT) (priv->cur_ucode == IWL_UCODE_INIT)
? "Init" : "RT"); ? "Init" : "RT");
return -EINVAL; return -EINVAL;
} }
......
...@@ -240,7 +240,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file, ...@@ -240,7 +240,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file,
IWL_ERR(priv, "No uCode has been loadded.\n"); IWL_ERR(priv, "No uCode has been loadded.\n");
return -EINVAL; return -EINVAL;
} }
img = &priv->fw->img[priv->shrd->ucode_type]; img = &priv->fw->img[priv->cur_ucode];
priv->dbgfs_sram_len = img->sec[IWL_UCODE_SECTION_DATA].len; priv->dbgfs_sram_len = img->sec[IWL_UCODE_SECTION_DATA].len;
} }
len = priv->dbgfs_sram_len; len = priv->dbgfs_sram_len;
......
...@@ -997,6 +997,9 @@ struct iwl_priv { ...@@ -997,6 +997,9 @@ struct iwl_priv {
u32 error_event_table; u32 error_event_table;
u32 log_event_table; u32 log_event_table;
} device_pointers; } device_pointers;
/* indicator of loaded ucode image */
enum iwl_ucode_type cur_ucode;
}; /*iwl_priv */ }; /*iwl_priv */
extern struct kmem_cache *iwl_tx_cmd_pool; extern struct kmem_cache *iwl_tx_cmd_pool;
......
...@@ -346,7 +346,6 @@ struct iwl_cfg { ...@@ -346,7 +346,6 @@ struct iwl_cfg {
* @hw_params: see struct iwl_hw_params * @hw_params: see struct iwl_hw_params
* @lock: protect general shared data * @lock: protect general shared data
* @eeprom: pointer to the eeprom/OTP image * @eeprom: pointer to the eeprom/OTP image
* @ucode_type: indicator of loaded ucode image
*/ */
struct iwl_shared { struct iwl_shared {
unsigned long status; unsigned long status;
...@@ -360,9 +359,6 @@ struct iwl_shared { ...@@ -360,9 +359,6 @@ struct iwl_shared {
/* eeprom -- this is in the card's little endian byte order */ /* eeprom -- this is in the card's little endian byte order */
u8 *eeprom; u8 *eeprom;
/* ucode related variables */
enum iwl_ucode_type ucode_type;
}; };
/*Whatever _m is (iwl_trans, iwl_priv, these macros will work */ /*Whatever _m is (iwl_trans, iwl_priv, these macros will work */
......
...@@ -601,11 +601,11 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) ...@@ -601,11 +601,11 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
IWL_ERR(priv, "No uCode has not been loaded\n"); IWL_ERR(priv, "No uCode has not been loaded\n");
return -EINVAL; return -EINVAL;
} else { } else {
img = &priv->fw->img[priv->shrd->ucode_type]; img = &priv->fw->img[priv->cur_ucode];
inst_size = img->sec[IWL_UCODE_SECTION_INST].len; inst_size = img->sec[IWL_UCODE_SECTION_INST].len;
data_size = img->sec[IWL_UCODE_SECTION_DATA].len; data_size = img->sec[IWL_UCODE_SECTION_DATA].len;
} }
NLA_PUT_U32(skb, IWL_TM_ATTR_FW_TYPE, priv->shrd->ucode_type); NLA_PUT_U32(skb, IWL_TM_ATTR_FW_TYPE, priv->cur_ucode);
NLA_PUT_U32(skb, IWL_TM_ATTR_FW_INST_SIZE, inst_size); NLA_PUT_U32(skb, IWL_TM_ATTR_FW_INST_SIZE, inst_size);
NLA_PUT_U32(skb, IWL_TM_ATTR_FW_DATA_SIZE, data_size); NLA_PUT_U32(skb, IWL_TM_ATTR_FW_DATA_SIZE, data_size);
status = cfg80211_testmode_reply(skb); status = cfg80211_testmode_reply(skb);
......
...@@ -391,8 +391,8 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv, ...@@ -391,8 +391,8 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
enum iwl_ucode_type old_type; enum iwl_ucode_type old_type;
static const u8 alive_cmd[] = { REPLY_ALIVE }; static const u8 alive_cmd[] = { REPLY_ALIVE };
old_type = priv->shrd->ucode_type; old_type = priv->cur_ucode;
priv->shrd->ucode_type = ucode_type; priv->cur_ucode = ucode_type;
fw = iwl_get_ucode_image(priv, ucode_type); fw = iwl_get_ucode_image(priv, ucode_type);
priv->ucode_loaded = false; priv->ucode_loaded = false;
...@@ -406,7 +406,7 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv, ...@@ -406,7 +406,7 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
ret = iwl_trans_start_fw(trans(priv), fw); ret = iwl_trans_start_fw(trans(priv), fw);
if (ret) { if (ret) {
priv->shrd->ucode_type = old_type; priv->cur_ucode = old_type;
iwl_remove_notification(&priv->notif_wait, &alive_wait); iwl_remove_notification(&priv->notif_wait, &alive_wait);
return ret; return ret;
} }
...@@ -418,13 +418,13 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv, ...@@ -418,13 +418,13 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
ret = iwl_wait_notification(&priv->notif_wait, &alive_wait, ret = iwl_wait_notification(&priv->notif_wait, &alive_wait,
UCODE_ALIVE_TIMEOUT); UCODE_ALIVE_TIMEOUT);
if (ret) { if (ret) {
priv->shrd->ucode_type = old_type; priv->cur_ucode = old_type;
return ret; return ret;
} }
if (!alive_data.valid) { if (!alive_data.valid) {
IWL_ERR(priv, "Loaded ucode is not valid!\n"); IWL_ERR(priv, "Loaded ucode is not valid!\n");
priv->shrd->ucode_type = old_type; priv->cur_ucode = old_type;
return -EIO; return -EIO;
} }
...@@ -436,7 +436,7 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv, ...@@ -436,7 +436,7 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
if (ucode_type != IWL_UCODE_WOWLAN) { if (ucode_type != IWL_UCODE_WOWLAN) {
ret = iwl_verify_ucode(priv, ucode_type); ret = iwl_verify_ucode(priv, ucode_type);
if (ret) { if (ret) {
priv->shrd->ucode_type = old_type; priv->cur_ucode = old_type;
return ret; return ret;
} }
...@@ -448,7 +448,7 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv, ...@@ -448,7 +448,7 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
if (ret) { if (ret) {
IWL_WARN(priv, IWL_WARN(priv,
"Could not complete ALIVE transition: %d\n", ret); "Could not complete ALIVE transition: %d\n", ret);
priv->shrd->ucode_type = old_type; priv->cur_ucode = old_type;
return ret; return ret;
} }
......
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