aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-06-06 12:41:15 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2011-06-11 10:09:09 -0400
commit872907bb17fe2d8d01d0e9723f72f91cb4ea103f (patch)
tree73bf39a66c32e2764bfd354cae90f05d9599052d
parent3f1e5f4a2b0993b6e81b5665b28568624f581b0f (diff)
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: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-ucode.c19
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c15
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sv-open.c5
7 files changed, 23 insertions, 41 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
index 97de5d9de67..a5cb1f63563 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
@@ -602,12 +602,12 @@ static void iwlagn_alive_fn(struct iwl_priv *priv,
602 602
603int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, 603int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
604 struct fw_img *image, 604 struct fw_img *image,
605 int subtype, int alternate_subtype) 605 enum iwlagn_ucode_type ucode_type)
606{ 606{
607 struct iwl_notification_wait alive_wait; 607 struct iwl_notification_wait alive_wait;
608 struct iwlagn_alive_data alive_data; 608 struct iwlagn_alive_data alive_data;
609 int ret; 609 int ret;
610 enum iwlagn_ucode_subtype old_type; 610 enum iwlagn_ucode_type old_type;
611 611
612 ret = iwlagn_start_device(priv); 612 ret = iwlagn_start_device(priv);
613 if (ret) 613 if (ret)
@@ -617,7 +617,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
617 iwlagn_alive_fn, &alive_data); 617 iwlagn_alive_fn, &alive_data);
618 618
619 old_type = priv->ucode_type; 619 old_type = priv->ucode_type;
620 priv->ucode_type = subtype; 620 priv->ucode_type = ucode_type;
621 621
622 ret = iwlagn_load_given_ucode(priv, image); 622 ret = iwlagn_load_given_ucode(priv, image);
623 if (ret) { 623 if (ret) {
@@ -645,15 +645,6 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
645 return -EIO; 645 return -EIO;
646 } 646 }
647 647
648 if (alive_data.subtype != subtype &&
649 alive_data.subtype != alternate_subtype) {
650 IWL_ERR(priv,
651 "Loaded ucode is not expected type (got %d, expected %d)!\n",
652 alive_data.subtype, subtype);
653 priv->ucode_type = old_type;
654 return -EIO;
655 }
656
657 ret = iwl_verify_ucode(priv, image); 648 ret = iwl_verify_ucode(priv, image);
658 if (ret) { 649 if (ret) {
659 priv->ucode_type = old_type; 650 priv->ucode_type = old_type;
@@ -685,7 +676,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv)
685 if (!priv->ucode_init.code.len) 676 if (!priv->ucode_init.code.len)
686 return 0; 677 return 0;
687 678
688 if (priv->ucode_type != UCODE_SUBTYPE_NONE_LOADED) 679 if (priv->ucode_type != IWL_UCODE_NONE)
689 return 0; 680 return 0;
690 681
691 iwlagn_init_notification_wait(priv, &calib_wait, 682 iwlagn_init_notification_wait(priv, &calib_wait,
@@ -694,7 +685,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv)
694 685
695 /* Will also start the device */ 686 /* Will also start the device */
696 ret = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init, 687 ret = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init,
697 UCODE_SUBTYPE_INIT, -1); 688 IWL_UCODE_INIT);
698 if (ret) 689 if (ret)
699 goto error; 690 goto error;
700 691
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 8bed31539c5..3cd42a52095 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1626,7 +1626,7 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv)
1626 struct iwl_error_event_table table; 1626 struct iwl_error_event_table table;
1627 1627
1628 base = priv->device_pointers.error_event_table; 1628 base = priv->device_pointers.error_event_table;
1629 if (priv->ucode_type == UCODE_SUBTYPE_INIT) { 1629 if (priv->ucode_type == IWL_UCODE_INIT) {
1630 if (!base) 1630 if (!base)
1631 base = priv->_agn.init_errlog_ptr; 1631 base = priv->_agn.init_errlog_ptr;
1632 } else { 1632 } else {
@@ -1638,7 +1638,7 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv)
1638 IWL_ERR(priv, 1638 IWL_ERR(priv,
1639 "Not valid error log pointer 0x%08X for %s uCode\n", 1639 "Not valid error log pointer 0x%08X for %s uCode\n",
1640 base, 1640 base,
1641 (priv->ucode_type == UCODE_SUBTYPE_INIT) 1641 (priv->ucode_type == IWL_UCODE_INIT)
1642 ? "Init" : "RT"); 1642 ? "Init" : "RT");
1643 return; 1643 return;
1644 } 1644 }
@@ -1702,7 +1702,7 @@ static int iwl_print_event_log(struct iwl_priv *priv, u32 start_idx,
1702 return pos; 1702 return pos;
1703 1703
1704 base = priv->device_pointers.log_event_table; 1704 base = priv->device_pointers.log_event_table;
1705 if (priv->ucode_type == UCODE_SUBTYPE_INIT) { 1705 if (priv->ucode_type == IWL_UCODE_INIT) {
1706 if (!base) 1706 if (!base)
1707 base = priv->_agn.init_evtlog_ptr; 1707 base = priv->_agn.init_evtlog_ptr;
1708 } else { 1708 } else {
@@ -1815,7 +1815,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
1815 size_t bufsz = 0; 1815 size_t bufsz = 0;
1816 1816
1817 base = priv->device_pointers.log_event_table; 1817 base = priv->device_pointers.log_event_table;
1818 if (priv->ucode_type == UCODE_SUBTYPE_INIT) { 1818 if (priv->ucode_type == IWL_UCODE_INIT) {
1819 logsize = priv->_agn.init_evtlog_size; 1819 logsize = priv->_agn.init_evtlog_size;
1820 if (!base) 1820 if (!base)
1821 base = priv->_agn.init_evtlog_ptr; 1821 base = priv->_agn.init_evtlog_ptr;
@@ -1829,7 +1829,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
1829 IWL_ERR(priv, 1829 IWL_ERR(priv,
1830 "Invalid event log pointer 0x%08X for %s uCode\n", 1830 "Invalid event log pointer 0x%08X for %s uCode\n",
1831 base, 1831 base,
1832 (priv->ucode_type == UCODE_SUBTYPE_INIT) 1832 (priv->ucode_type == IWL_UCODE_INIT)
1833 ? "Init" : "RT"); 1833 ? "Init" : "RT");
1834 return -EINVAL; 1834 return -EINVAL;
1835 } 1835 }
@@ -2210,8 +2210,7 @@ static int __iwl_up(struct iwl_priv *priv)
2210 2210
2211 ret = iwlagn_load_ucode_wait_alive(priv, 2211 ret = iwlagn_load_ucode_wait_alive(priv,
2212 &priv->ucode_rt, 2212 &priv->ucode_rt,
2213 UCODE_SUBTYPE_REGULAR, 2213 IWL_UCODE_REGULAR);
2214 UCODE_SUBTYPE_REGULAR_NEW);
2215 if (ret) { 2214 if (ret) {
2216 IWL_ERR(priv, "Failed to start RT ucode: %d\n", ret); 2215 IWL_ERR(priv, "Failed to start RT ucode: %d\n", ret);
2217 goto error; 2216 goto error;
@@ -3448,8 +3447,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3448 priv = hw->priv; 3447 priv = hw->priv;
3449 /* At this point both hw and priv are allocated. */ 3448 /* At this point both hw and priv are allocated. */
3450 3449
3451 priv->ucode_type = UCODE_SUBTYPE_NONE_LOADED;
3452
3453 /* 3450 /*
3454 * The default context is always valid, 3451 * The default context is always valid,
3455 * more may be discovered when firmware 3452 * more may be discovered when firmware
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index d074e6c7a57..94ee1416fb9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -161,7 +161,7 @@ void iwlagn_send_prio_tbl(struct iwl_priv *priv);
161int iwlagn_run_init_ucode(struct iwl_priv *priv); 161int iwlagn_run_init_ucode(struct iwl_priv *priv);
162int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, 162int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
163 struct fw_img *image, 163 struct fw_img *image,
164 int subtype, int alternate_subtype); 164 enum iwlagn_ucode_type ucode_type);
165 165
166/* lib */ 166/* lib */
167void iwl_check_abort_status(struct iwl_priv *priv, 167void iwl_check_abort_status(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index 6ee5f1aa555..8dcb2108bce 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -384,18 +384,6 @@ struct iwl_tx_ant_config_cmd {
384 384
385#define UCODE_VALID_OK cpu_to_le32(0x1) 385#define UCODE_VALID_OK cpu_to_le32(0x1)
386 386
387enum iwlagn_ucode_subtype {
388 UCODE_SUBTYPE_REGULAR = 0,
389 UCODE_SUBTYPE_REGULAR_NEW = 1,
390 UCODE_SUBTYPE_INIT = 9,
391
392 /*
393 * Not a valid subtype, the ucode has just a u8, so
394 * we can use something > 0xff for this value.
395 */
396 UCODE_SUBTYPE_NONE_LOADED = 0x100,
397};
398
399/** 387/**
400 * REPLY_ALIVE = 0x1 (response only, not a command) 388 * REPLY_ALIVE = 0x1 (response only, not a command)
401 * 389 *
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 0e6a04b739a..5f335c7815b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -227,7 +227,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file,
227 /* default is to dump the entire data segment */ 227 /* default is to dump the entire data segment */
228 if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { 228 if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) {
229 priv->dbgfs_sram_offset = 0x800000; 229 priv->dbgfs_sram_offset = 0x800000;
230 if (priv->ucode_type == UCODE_SUBTYPE_INIT) 230 if (priv->ucode_type == IWL_UCODE_INIT)
231 priv->dbgfs_sram_len = priv->ucode_init.data.len; 231 priv->dbgfs_sram_len = priv->ucode_init.data.len;
232 else 232 else
233 priv->dbgfs_sram_len = priv->ucode_rt.data.len; 233 priv->dbgfs_sram_len = priv->ucode_rt.data.len;
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index d23430e1000..ffed30207e9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1168,6 +1168,13 @@ enum iwl_scan_type {
1168 IWL_SCAN_OFFCH_TX, 1168 IWL_SCAN_OFFCH_TX,
1169}; 1169};
1170 1170
1171enum iwlagn_ucode_type {
1172 IWL_UCODE_NONE,
1173 IWL_UCODE_REGULAR,
1174 IWL_UCODE_INIT,
1175 IWL_UCODE_WOWLAN,
1176};
1177
1171#ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL 1178#ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL
1172struct iwl_testmode_trace { 1179struct iwl_testmode_trace {
1173 u32 buff_size; 1180 u32 buff_size;
@@ -1273,7 +1280,7 @@ struct iwl_priv {
1273 struct fw_img ucode_rt; 1280 struct fw_img ucode_rt;
1274 struct fw_img ucode_init; 1281 struct fw_img ucode_init;
1275 1282
1276 enum iwlagn_ucode_subtype ucode_type; 1283 enum iwlagn_ucode_type ucode_type;
1277 u8 ucode_write_complete; /* the image write is complete */ 1284 u8 ucode_write_complete; /* the image write is complete */
1278 char firmware_name[25]; 1285 char firmware_name[25];
1279 1286
diff --git a/drivers/net/wireless/iwlwifi/iwl-sv-open.c b/drivers/net/wireless/iwlwifi/iwl-sv-open.c
index 038c6961c46..6f626425144 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sv-open.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sv-open.c
@@ -397,7 +397,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
397 397
398 case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW: 398 case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW:
399 status = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init, 399 status = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init,
400 UCODE_SUBTYPE_INIT, -1); 400 IWL_UCODE_INIT);
401 if (status) 401 if (status)
402 IWL_DEBUG_INFO(priv, 402 IWL_DEBUG_INFO(priv,
403 "Error loading init ucode: %d\n", status); 403 "Error loading init ucode: %d\n", status);
@@ -411,8 +411,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
411 case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW: 411 case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW:
412 status = iwlagn_load_ucode_wait_alive(priv, 412 status = iwlagn_load_ucode_wait_alive(priv,
413 &priv->ucode_rt, 413 &priv->ucode_rt,
414 UCODE_SUBTYPE_REGULAR, 414 IWL_UCODE_REGULAR);
415 UCODE_SUBTYPE_REGULAR_NEW);
416 if (status) { 415 if (status) {
417 IWL_DEBUG_INFO(priv, 416 IWL_DEBUG_INFO(priv,
418 "Error loading runtime ucode: %d\n", status); 417 "Error loading runtime ucode: %d\n", status);