diff options
author | Johannes Berg <johannes.berg@intel.com> | 2011-04-05 12:42:04 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-04-07 15:51:38 -0400 |
commit | d7d5783c6668b54111cc77005755799e94261497 (patch) | |
tree | f65b3ee1b9d1c49088ccabc18638fc99b5e053d1 /drivers/net/wireless | |
parent | 3d09cdff233b5a37ce9993c533e8da1403e2da30 (diff) |
iwlagn: clean up alive handling
Devices newer than 4965 don't actually send
two different versions of the ALIVE command,
so we always had a bug here since before this
patch we copy more data than we got. Remove
the iwl_init_alive_resp struct and don't use
it.
Since we also really don't need to track all
the data received in ALIVE as we only use the
error and log event tables later, we can also
save space by just keeping those and not more
data around in memory.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 16 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-commands.h | 48 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 8 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-rx.c | 10 |
4 files changed, 13 insertions, 69 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 30b8b9e1bc2e..b3b1e84c9311 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -590,10 +590,7 @@ static void iwl_continuous_event_trace(struct iwl_priv *priv) | |||
590 | u32 num_wraps; /* # times uCode wrapped to top of log */ | 590 | u32 num_wraps; /* # times uCode wrapped to top of log */ |
591 | u32 next_entry; /* index of next entry to be written by uCode */ | 591 | u32 next_entry; /* index of next entry to be written by uCode */ |
592 | 592 | ||
593 | if (priv->ucode_type == UCODE_INIT) | 593 | base = priv->device_pointers.error_event_table; |
594 | base = le32_to_cpu(priv->card_alive_init.error_event_table_ptr); | ||
595 | else | ||
596 | base = le32_to_cpu(priv->card_alive.log_event_table_ptr); | ||
597 | if (priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) { | 594 | if (priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) { |
598 | capacity = iwl_read_targ_mem(priv, base); | 595 | capacity = iwl_read_targ_mem(priv, base); |
599 | num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32))); | 596 | num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32))); |
@@ -1871,12 +1868,11 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv) | |||
1871 | u32 blink1, blink2, ilink1, ilink2; | 1868 | u32 blink1, blink2, ilink1, ilink2; |
1872 | u32 pc, hcmd; | 1869 | u32 pc, hcmd; |
1873 | 1870 | ||
1871 | base = priv->device_pointers.error_event_table; | ||
1874 | if (priv->ucode_type == UCODE_INIT) { | 1872 | if (priv->ucode_type == UCODE_INIT) { |
1875 | base = le32_to_cpu(priv->card_alive_init.error_event_table_ptr); | ||
1876 | if (!base) | 1873 | if (!base) |
1877 | base = priv->_agn.init_errlog_ptr; | 1874 | base = priv->_agn.init_errlog_ptr; |
1878 | } else { | 1875 | } else { |
1879 | base = le32_to_cpu(priv->card_alive.error_event_table_ptr); | ||
1880 | if (!base) | 1876 | if (!base) |
1881 | base = priv->_agn.inst_errlog_ptr; | 1877 | base = priv->_agn.inst_errlog_ptr; |
1882 | } | 1878 | } |
@@ -1941,12 +1937,11 @@ static int iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, | |||
1941 | if (num_events == 0) | 1937 | if (num_events == 0) |
1942 | return pos; | 1938 | return pos; |
1943 | 1939 | ||
1940 | base = priv->device_pointers.log_event_table; | ||
1944 | if (priv->ucode_type == UCODE_INIT) { | 1941 | if (priv->ucode_type == UCODE_INIT) { |
1945 | base = le32_to_cpu(priv->card_alive_init.log_event_table_ptr); | ||
1946 | if (!base) | 1942 | if (!base) |
1947 | base = priv->_agn.init_evtlog_ptr; | 1943 | base = priv->_agn.init_evtlog_ptr; |
1948 | } else { | 1944 | } else { |
1949 | base = le32_to_cpu(priv->card_alive.log_event_table_ptr); | ||
1950 | if (!base) | 1945 | if (!base) |
1951 | base = priv->_agn.inst_evtlog_ptr; | 1946 | base = priv->_agn.inst_evtlog_ptr; |
1952 | } | 1947 | } |
@@ -2055,13 +2050,12 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, | |||
2055 | int pos = 0; | 2050 | int pos = 0; |
2056 | size_t bufsz = 0; | 2051 | size_t bufsz = 0; |
2057 | 2052 | ||
2053 | base = priv->device_pointers.log_event_table; | ||
2058 | if (priv->ucode_type == UCODE_INIT) { | 2054 | if (priv->ucode_type == UCODE_INIT) { |
2059 | base = le32_to_cpu(priv->card_alive_init.log_event_table_ptr); | ||
2060 | logsize = priv->_agn.init_evtlog_size; | 2055 | logsize = priv->_agn.init_evtlog_size; |
2061 | if (!base) | 2056 | if (!base) |
2062 | base = priv->_agn.init_evtlog_ptr; | 2057 | base = priv->_agn.init_evtlog_ptr; |
2063 | } else { | 2058 | } else { |
2064 | base = le32_to_cpu(priv->card_alive.log_event_table_ptr); | ||
2065 | logsize = priv->_agn.inst_evtlog_size; | 2059 | logsize = priv->_agn.inst_evtlog_size; |
2066 | if (!base) | 2060 | if (!base) |
2067 | base = priv->_agn.inst_evtlog_ptr; | 2061 | base = priv->_agn.inst_evtlog_ptr; |
@@ -2415,8 +2409,6 @@ static void __iwl_down(struct iwl_priv *priv) | |||
2415 | iwl_apm_stop(priv); | 2409 | iwl_apm_stop(priv); |
2416 | 2410 | ||
2417 | exit: | 2411 | exit: |
2418 | memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp)); | ||
2419 | |||
2420 | dev_kfree_skb(priv->beacon_skb); | 2412 | dev_kfree_skb(priv->beacon_skb); |
2421 | priv->beacon_skb = NULL; | 2413 | priv->beacon_skb = NULL; |
2422 | 2414 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index a2348ee61fd9..a1a5c1b23096 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -388,54 +388,6 @@ struct iwl_tx_ant_config_cmd { | |||
388 | #define UCODE_VALID_OK cpu_to_le32(0x1) | 388 | #define UCODE_VALID_OK cpu_to_le32(0x1) |
389 | #define INITIALIZE_SUBTYPE (9) | 389 | #define INITIALIZE_SUBTYPE (9) |
390 | 390 | ||
391 | /* | ||
392 | * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command) | ||
393 | * | ||
394 | * uCode issues this "initialize alive" notification once the initialization | ||
395 | * uCode image has completed its work, and is ready to load the runtime image. | ||
396 | * This is the *first* "alive" notification that the driver will receive after | ||
397 | * rebooting uCode; the "initialize" alive is indicated by subtype field == 9. | ||
398 | * | ||
399 | * See comments documenting "BSM" (bootstrap state machine). | ||
400 | * | ||
401 | * For 4965, this notification contains important calibration data for | ||
402 | * calculating txpower settings: | ||
403 | * | ||
404 | * 1) Power supply voltage indication. The voltage sensor outputs higher | ||
405 | * values for lower voltage, and vice verse. | ||
406 | * | ||
407 | * 2) Temperature measurement parameters, for each of two channel widths | ||
408 | * (20 MHz and 40 MHz) supported by the radios. Temperature sensing | ||
409 | * is done via one of the receiver chains, and channel width influences | ||
410 | * the results. | ||
411 | * | ||
412 | * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation, | ||
413 | * for each of 5 frequency ranges. | ||
414 | */ | ||
415 | struct iwl_init_alive_resp { | ||
416 | u8 ucode_minor; | ||
417 | u8 ucode_major; | ||
418 | __le16 reserved1; | ||
419 | u8 sw_rev[8]; | ||
420 | u8 ver_type; | ||
421 | u8 ver_subtype; /* "9" for initialize alive */ | ||
422 | __le16 reserved2; | ||
423 | __le32 log_event_table_ptr; | ||
424 | __le32 error_event_table_ptr; | ||
425 | __le32 timestamp; | ||
426 | __le32 is_valid; | ||
427 | |||
428 | /* calibration values from "initialize" uCode */ | ||
429 | __le32 voltage; /* signed, higher value is lower voltage */ | ||
430 | __le32 therm_r1[2]; /* signed, 1st for normal, 2nd for HT40 */ | ||
431 | __le32 therm_r2[2]; /* signed */ | ||
432 | __le32 therm_r3[2]; /* signed */ | ||
433 | __le32 therm_r4[2]; /* signed */ | ||
434 | __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups, | ||
435 | * 2 Tx chains */ | ||
436 | } __packed; | ||
437 | |||
438 | |||
439 | /** | 391 | /** |
440 | * REPLY_ALIVE = 0x1 (response only, not a command) | 392 | * REPLY_ALIVE = 0x1 (response only, not a command) |
441 | * | 393 | * |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 2f7458d3be9c..b4bfcab233ab 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -1285,10 +1285,10 @@ struct iwl_priv { | |||
1285 | 1285 | ||
1286 | struct iwl_switch_rxon switch_rxon; | 1286 | struct iwl_switch_rxon switch_rxon; |
1287 | 1287 | ||
1288 | /* 1st responses from initialize and runtime uCode images. | 1288 | struct { |
1289 | * _agn's initialize alive response contains some calibration data. */ | 1289 | u32 error_event_table; |
1290 | struct iwl_init_alive_resp card_alive_init; | 1290 | u32 log_event_table; |
1291 | struct iwl_alive_resp card_alive; | 1291 | } device_pointers; |
1292 | 1292 | ||
1293 | u16 active_rate; | 1293 | u16 active_rate; |
1294 | 1294 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index 984a42cfffe9..b5124de99624 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -239,16 +239,16 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv, | |||
239 | palive->is_valid, palive->ver_type, | 239 | palive->is_valid, palive->ver_type, |
240 | palive->ver_subtype); | 240 | palive->ver_subtype); |
241 | 241 | ||
242 | priv->device_pointers.log_event_table = | ||
243 | le32_to_cpu(palive->log_event_table_ptr); | ||
244 | priv->device_pointers.error_event_table = | ||
245 | le32_to_cpu(palive->error_event_table_ptr); | ||
246 | |||
242 | if (palive->ver_subtype == INITIALIZE_SUBTYPE) { | 247 | if (palive->ver_subtype == INITIALIZE_SUBTYPE) { |
243 | IWL_DEBUG_INFO(priv, "Initialization Alive received.\n"); | 248 | IWL_DEBUG_INFO(priv, "Initialization Alive received.\n"); |
244 | memcpy(&priv->card_alive_init, | ||
245 | &pkt->u.alive_frame, | ||
246 | sizeof(struct iwl_init_alive_resp)); | ||
247 | pwork = &priv->init_alive_start; | 249 | pwork = &priv->init_alive_start; |
248 | } else { | 250 | } else { |
249 | IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); | 251 | IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); |
250 | memcpy(&priv->card_alive, &pkt->u.alive_frame, | ||
251 | sizeof(struct iwl_alive_resp)); | ||
252 | pwork = &priv->alive_start; | 252 | pwork = &priv->alive_start; |
253 | } | 253 | } |
254 | 254 | ||