Commit 872907bb authored by Johannes Berg's avatar Johannes Berg Committed by Wey-Yi Guy

iwlagn: don't check ucode subtype

The ucode subtypes keep changing, and there's no
particular reason to be checking them (other than
a paranoid sanity check). Since the numbers are
also in conflict between different ucode images
now, simply don't check them any more and rely on
the images being built correctly.

Also, to indicate that, rename the constants and
the enum, moving it to a different file.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent 3f1e5f4a
...@@ -602,12 +602,12 @@ static void iwlagn_alive_fn(struct iwl_priv *priv, ...@@ -602,12 +602,12 @@ static void iwlagn_alive_fn(struct iwl_priv *priv,
int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
struct fw_img *image, struct fw_img *image,
int subtype, int alternate_subtype) enum iwlagn_ucode_type ucode_type)
{ {
struct iwl_notification_wait alive_wait; struct iwl_notification_wait alive_wait;
struct iwlagn_alive_data alive_data; struct iwlagn_alive_data alive_data;
int ret; int ret;
enum iwlagn_ucode_subtype old_type; enum iwlagn_ucode_type old_type;
ret = iwlagn_start_device(priv); ret = iwlagn_start_device(priv);
if (ret) if (ret)
...@@ -617,7 +617,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, ...@@ -617,7 +617,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
iwlagn_alive_fn, &alive_data); iwlagn_alive_fn, &alive_data);
old_type = priv->ucode_type; old_type = priv->ucode_type;
priv->ucode_type = subtype; priv->ucode_type = ucode_type;
ret = iwlagn_load_given_ucode(priv, image); ret = iwlagn_load_given_ucode(priv, image);
if (ret) { if (ret) {
...@@ -645,15 +645,6 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, ...@@ -645,15 +645,6 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
return -EIO; return -EIO;
} }
if (alive_data.subtype != subtype &&
alive_data.subtype != alternate_subtype) {
IWL_ERR(priv,
"Loaded ucode is not expected type (got %d, expected %d)!\n",
alive_data.subtype, subtype);
priv->ucode_type = old_type;
return -EIO;
}
ret = iwl_verify_ucode(priv, image); ret = iwl_verify_ucode(priv, image);
if (ret) { if (ret) {
priv->ucode_type = old_type; priv->ucode_type = old_type;
...@@ -685,7 +676,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv) ...@@ -685,7 +676,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv)
if (!priv->ucode_init.code.len) if (!priv->ucode_init.code.len)
return 0; return 0;
if (priv->ucode_type != UCODE_SUBTYPE_NONE_LOADED) if (priv->ucode_type != IWL_UCODE_NONE)
return 0; return 0;
iwlagn_init_notification_wait(priv, &calib_wait, iwlagn_init_notification_wait(priv, &calib_wait,
...@@ -694,7 +685,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv) ...@@ -694,7 +685,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv)
/* Will also start the device */ /* Will also start the device */
ret = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init, ret = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init,
UCODE_SUBTYPE_INIT, -1); IWL_UCODE_INIT);
if (ret) if (ret)
goto error; goto error;
......
...@@ -1626,7 +1626,7 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv) ...@@ -1626,7 +1626,7 @@ 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->ucode_type == UCODE_SUBTYPE_INIT) { if (priv->ucode_type == IWL_UCODE_INIT) {
if (!base) if (!base)
base = priv->_agn.init_errlog_ptr; base = priv->_agn.init_errlog_ptr;
} else { } else {
...@@ -1638,7 +1638,7 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv) ...@@ -1638,7 +1638,7 @@ 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->ucode_type == UCODE_SUBTYPE_INIT) (priv->ucode_type == IWL_UCODE_INIT)
? "Init" : "RT"); ? "Init" : "RT");
return; return;
} }
...@@ -1702,7 +1702,7 @@ static int iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, ...@@ -1702,7 +1702,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->ucode_type == UCODE_SUBTYPE_INIT) { if (priv->ucode_type == IWL_UCODE_INIT) {
if (!base) if (!base)
base = priv->_agn.init_evtlog_ptr; base = priv->_agn.init_evtlog_ptr;
} else { } else {
...@@ -1815,7 +1815,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, ...@@ -1815,7 +1815,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
size_t bufsz = 0; size_t bufsz = 0;
base = priv->device_pointers.log_event_table; base = priv->device_pointers.log_event_table;
if (priv->ucode_type == UCODE_SUBTYPE_INIT) { if (priv->ucode_type == IWL_UCODE_INIT) {
logsize = priv->_agn.init_evtlog_size; logsize = priv->_agn.init_evtlog_size;
if (!base) if (!base)
base = priv->_agn.init_evtlog_ptr; base = priv->_agn.init_evtlog_ptr;
...@@ -1829,7 +1829,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, ...@@ -1829,7 +1829,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->ucode_type == UCODE_SUBTYPE_INIT) (priv->ucode_type == IWL_UCODE_INIT)
? "Init" : "RT"); ? "Init" : "RT");
return -EINVAL; return -EINVAL;
} }
...@@ -2210,8 +2210,7 @@ static int __iwl_up(struct iwl_priv *priv) ...@@ -2210,8 +2210,7 @@ static int __iwl_up(struct iwl_priv *priv)
ret = iwlagn_load_ucode_wait_alive(priv, ret = iwlagn_load_ucode_wait_alive(priv,
&priv->ucode_rt, &priv->ucode_rt,
UCODE_SUBTYPE_REGULAR, IWL_UCODE_REGULAR);
UCODE_SUBTYPE_REGULAR_NEW);
if (ret) { if (ret) {
IWL_ERR(priv, "Failed to start RT ucode: %d\n", ret); IWL_ERR(priv, "Failed to start RT ucode: %d\n", ret);
goto error; goto error;
...@@ -3448,8 +3447,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -3448,8 +3447,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
priv = hw->priv; priv = hw->priv;
/* At this point both hw and priv are allocated. */ /* At this point both hw and priv are allocated. */
priv->ucode_type = UCODE_SUBTYPE_NONE_LOADED;
/* /*
* The default context is always valid, * The default context is always valid,
* more may be discovered when firmware * more may be discovered when firmware
......
...@@ -161,7 +161,7 @@ void iwlagn_send_prio_tbl(struct iwl_priv *priv); ...@@ -161,7 +161,7 @@ void iwlagn_send_prio_tbl(struct iwl_priv *priv);
int iwlagn_run_init_ucode(struct iwl_priv *priv); int iwlagn_run_init_ucode(struct iwl_priv *priv);
int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
struct fw_img *image, struct fw_img *image,
int subtype, int alternate_subtype); enum iwlagn_ucode_type ucode_type);
/* lib */ /* lib */
void iwl_check_abort_status(struct iwl_priv *priv, void iwl_check_abort_status(struct iwl_priv *priv,
......
...@@ -384,18 +384,6 @@ struct iwl_tx_ant_config_cmd { ...@@ -384,18 +384,6 @@ struct iwl_tx_ant_config_cmd {
#define UCODE_VALID_OK cpu_to_le32(0x1) #define UCODE_VALID_OK cpu_to_le32(0x1)
enum iwlagn_ucode_subtype {
UCODE_SUBTYPE_REGULAR = 0,
UCODE_SUBTYPE_REGULAR_NEW = 1,
UCODE_SUBTYPE_INIT = 9,
/*
* Not a valid subtype, the ucode has just a u8, so
* we can use something > 0xff for this value.
*/
UCODE_SUBTYPE_NONE_LOADED = 0x100,
};
/** /**
* REPLY_ALIVE = 0x1 (response only, not a command) * REPLY_ALIVE = 0x1 (response only, not a command)
* *
......
...@@ -227,7 +227,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file, ...@@ -227,7 +227,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file,
/* default is to dump the entire data segment */ /* default is to dump the entire data segment */
if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) {
priv->dbgfs_sram_offset = 0x800000; priv->dbgfs_sram_offset = 0x800000;
if (priv->ucode_type == UCODE_SUBTYPE_INIT) if (priv->ucode_type == IWL_UCODE_INIT)
priv->dbgfs_sram_len = priv->ucode_init.data.len; priv->dbgfs_sram_len = priv->ucode_init.data.len;
else else
priv->dbgfs_sram_len = priv->ucode_rt.data.len; priv->dbgfs_sram_len = priv->ucode_rt.data.len;
......
...@@ -1168,6 +1168,13 @@ enum iwl_scan_type { ...@@ -1168,6 +1168,13 @@ enum iwl_scan_type {
IWL_SCAN_OFFCH_TX, IWL_SCAN_OFFCH_TX,
}; };
enum iwlagn_ucode_type {
IWL_UCODE_NONE,
IWL_UCODE_REGULAR,
IWL_UCODE_INIT,
IWL_UCODE_WOWLAN,
};
#ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL
struct iwl_testmode_trace { struct iwl_testmode_trace {
u32 buff_size; u32 buff_size;
...@@ -1273,7 +1280,7 @@ struct iwl_priv { ...@@ -1273,7 +1280,7 @@ struct iwl_priv {
struct fw_img ucode_rt; struct fw_img ucode_rt;
struct fw_img ucode_init; struct fw_img ucode_init;
enum iwlagn_ucode_subtype ucode_type; enum iwlagn_ucode_type ucode_type;
u8 ucode_write_complete; /* the image write is complete */ u8 ucode_write_complete; /* the image write is complete */
char firmware_name[25]; char firmware_name[25];
......
...@@ -397,7 +397,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) ...@@ -397,7 +397,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW: case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW:
status = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init, status = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init,
UCODE_SUBTYPE_INIT, -1); IWL_UCODE_INIT);
if (status) if (status)
IWL_DEBUG_INFO(priv, IWL_DEBUG_INFO(priv,
"Error loading init ucode: %d\n", status); "Error loading init ucode: %d\n", status);
...@@ -411,8 +411,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) ...@@ -411,8 +411,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW: case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW:
status = iwlagn_load_ucode_wait_alive(priv, status = iwlagn_load_ucode_wait_alive(priv,
&priv->ucode_rt, &priv->ucode_rt,
UCODE_SUBTYPE_REGULAR, IWL_UCODE_REGULAR);
UCODE_SUBTYPE_REGULAR_NEW);
if (status) { if (status) {
IWL_DEBUG_INFO(priv, IWL_DEBUG_INFO(priv,
"Error loading runtime ucode: %d\n", status); "Error loading runtime ucode: %d\n", status);
......
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