aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2008-01-27 19:41:47 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:04:35 -0500
commitbb8c093bdea62f2ae371b98ebff81b0407852faf (patch)
tree7937a70c333356a85b344f883608eeaf93dd3d2b /drivers/net/wireless/iwlwifi/iwl3945-base.c
parent403ab56b1c2786b0e1d58c27f5ce667b529c7faa (diff)
iwlwifi: cleanup namespace
Prefix all symbols with iwl3945_ or iwl4965_ and thus allow building the driver into the kernel. Also remove all the useless default statements in Kconfig while we're at it. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c2206
1 files changed, 1103 insertions, 1103 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index e0f6f03a920f..e14e1333535f 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -60,11 +60,11 @@
60#include "iwl-helpers.h" 60#include "iwl-helpers.h"
61 61
62#ifdef CONFIG_IWL3945_DEBUG 62#ifdef CONFIG_IWL3945_DEBUG
63u32 iwl_debug_level; 63u32 iwl3945_debug_level;
64#endif 64#endif
65 65
66static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, 66static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv,
67 struct iwl_tx_queue *txq); 67 struct iwl3945_tx_queue *txq);
68 68
69/****************************************************************************** 69/******************************************************************************
70 * 70 *
@@ -73,13 +73,13 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv,
73 ******************************************************************************/ 73 ******************************************************************************/
74 74
75/* module parameters */ 75/* module parameters */
76static int iwl_param_disable_hw_scan; 76static int iwl3945_param_disable_hw_scan;
77static int iwl_param_debug; 77static int iwl3945_param_debug;
78static int iwl_param_disable; /* def: enable radio */ 78static int iwl3945_param_disable; /* def: enable radio */
79static int iwl_param_antenna; /* def: 0 = both antennas (use diversity) */ 79static int iwl3945_param_antenna; /* def: 0 = both antennas (use diversity) */
80int iwl_param_hwcrypto; /* def: using software encryption */ 80int iwl3945_param_hwcrypto; /* def: using software encryption */
81static int iwl_param_qos_enable = 1; 81static int iwl3945_param_qos_enable = 1;
82int iwl_param_queues_num = IWL_MAX_NUM_QUEUES; 82int iwl3945_param_queues_num = IWL_MAX_NUM_QUEUES;
83 83
84/* 84/*
85 * module name, copyright, version, etc. 85 * module name, copyright, version, etc.
@@ -126,8 +126,8 @@ static __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr)
126 return NULL; 126 return NULL;
127} 127}
128 128
129static const struct ieee80211_hw_mode *iwl_get_hw_mode( 129static const struct ieee80211_hw_mode *iwl3945_get_hw_mode(
130 struct iwl_priv *priv, int mode) 130 struct iwl3945_priv *priv, int mode)
131{ 131{
132 int i; 132 int i;
133 133
@@ -138,7 +138,7 @@ static const struct ieee80211_hw_mode *iwl_get_hw_mode(
138 return NULL; 138 return NULL;
139} 139}
140 140
141static int iwl_is_empty_essid(const char *essid, int essid_len) 141static int iwl3945_is_empty_essid(const char *essid, int essid_len)
142{ 142{
143 /* Single white space is for Linksys APs */ 143 /* Single white space is for Linksys APs */
144 if (essid_len == 1 && essid[0] == ' ') 144 if (essid_len == 1 && essid[0] == ' ')
@@ -154,13 +154,13 @@ static int iwl_is_empty_essid(const char *essid, int essid_len)
154 return 1; 154 return 1;
155} 155}
156 156
157static const char *iwl_escape_essid(const char *essid, u8 essid_len) 157static const char *iwl3945_escape_essid(const char *essid, u8 essid_len)
158{ 158{
159 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; 159 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
160 const char *s = essid; 160 const char *s = essid;
161 char *d = escaped; 161 char *d = escaped;
162 162
163 if (iwl_is_empty_essid(essid, essid_len)) { 163 if (iwl3945_is_empty_essid(essid, essid_len)) {
164 memcpy(escaped, "<hidden>", sizeof("<hidden>")); 164 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
165 return escaped; 165 return escaped;
166 } 166 }
@@ -178,10 +178,10 @@ static const char *iwl_escape_essid(const char *essid, u8 essid_len)
178 return escaped; 178 return escaped;
179} 179}
180 180
181static void iwl_print_hex_dump(int level, void *p, u32 len) 181static void iwl3945_print_hex_dump(int level, void *p, u32 len)
182{ 182{
183#ifdef CONFIG_IWL3945_DEBUG 183#ifdef CONFIG_IWL3945_DEBUG
184 if (!(iwl_debug_level & level)) 184 if (!(iwl3945_debug_level & level))
185 return; 185 return;
186 186
187 print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1, 187 print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1,
@@ -207,7 +207,7 @@ static void iwl_print_hex_dump(int level, void *p, u32 len)
207 * and four transmit queues for data. 207 * and four transmit queues for data.
208 ***************************************************/ 208 ***************************************************/
209 209
210static int iwl_queue_space(const struct iwl_queue *q) 210static int iwl3945_queue_space(const struct iwl3945_queue *q)
211{ 211{
212 int s = q->read_ptr - q->write_ptr; 212 int s = q->read_ptr - q->write_ptr;
213 213
@@ -224,25 +224,25 @@ static int iwl_queue_space(const struct iwl_queue *q)
224} 224}
225 225
226/* XXX: n_bd must be power-of-two size */ 226/* XXX: n_bd must be power-of-two size */
227static inline int iwl_queue_inc_wrap(int index, int n_bd) 227static inline int iwl3945_queue_inc_wrap(int index, int n_bd)
228{ 228{
229 return ++index & (n_bd - 1); 229 return ++index & (n_bd - 1);
230} 230}
231 231
232/* XXX: n_bd must be power-of-two size */ 232/* XXX: n_bd must be power-of-two size */
233static inline int iwl_queue_dec_wrap(int index, int n_bd) 233static inline int iwl3945_queue_dec_wrap(int index, int n_bd)
234{ 234{
235 return --index & (n_bd - 1); 235 return --index & (n_bd - 1);
236} 236}
237 237
238static inline int x2_queue_used(const struct iwl_queue *q, int i) 238static inline int x2_queue_used(const struct iwl3945_queue *q, int i)
239{ 239{
240 return q->write_ptr > q->read_ptr ? 240 return q->write_ptr > q->read_ptr ?
241 (i >= q->read_ptr && i < q->write_ptr) : 241 (i >= q->read_ptr && i < q->write_ptr) :
242 !(i < q->read_ptr && i >= q->write_ptr); 242 !(i < q->read_ptr && i >= q->write_ptr);
243} 243}
244 244
245static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) 245static inline u8 get_cmd_index(struct iwl3945_queue *q, u32 index, int is_huge)
246{ 246{
247 if (is_huge) 247 if (is_huge)
248 return q->n_window; 248 return q->n_window;
@@ -250,15 +250,15 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge)
250 return index & (q->n_window - 1); 250 return index & (q->n_window - 1);
251} 251}
252 252
253static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, 253static int iwl3945_queue_init(struct iwl3945_priv *priv, struct iwl3945_queue *q,
254 int count, int slots_num, u32 id) 254 int count, int slots_num, u32 id)
255{ 255{
256 q->n_bd = count; 256 q->n_bd = count;
257 q->n_window = slots_num; 257 q->n_window = slots_num;
258 q->id = id; 258 q->id = id;
259 259
260 /* count must be power-of-two size, otherwise iwl_queue_inc_wrap 260 /* count must be power-of-two size, otherwise iwl3945_queue_inc_wrap
261 * and iwl_queue_dec_wrap are broken. */ 261 * and iwl3945_queue_dec_wrap are broken. */
262 BUG_ON(!is_power_of_2(count)); 262 BUG_ON(!is_power_of_2(count));
263 263
264 /* slots_num must be power-of-two size, otherwise 264 /* slots_num must be power-of-two size, otherwise
@@ -278,8 +278,8 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
278 return 0; 278 return 0;
279} 279}
280 280
281static int iwl_tx_queue_alloc(struct iwl_priv *priv, 281static int iwl3945_tx_queue_alloc(struct iwl3945_priv *priv,
282 struct iwl_tx_queue *txq, u32 id) 282 struct iwl3945_tx_queue *txq, u32 id)
283{ 283{
284 struct pci_dev *dev = priv->pci_dev; 284 struct pci_dev *dev = priv->pci_dev;
285 285
@@ -316,8 +316,8 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv,
316 return -ENOMEM; 316 return -ENOMEM;
317} 317}
318 318
319int iwl_tx_queue_init(struct iwl_priv *priv, 319int iwl3945_tx_queue_init(struct iwl3945_priv *priv,
320 struct iwl_tx_queue *txq, int slots_num, u32 txq_id) 320 struct iwl3945_tx_queue *txq, int slots_num, u32 txq_id)
321{ 321{
322 struct pci_dev *dev = priv->pci_dev; 322 struct pci_dev *dev = priv->pci_dev;
323 int len; 323 int len;
@@ -326,14 +326,14 @@ int iwl_tx_queue_init(struct iwl_priv *priv,
326 /* allocate command space + one big command for scan since scan 326 /* allocate command space + one big command for scan since scan
327 * command is very huge the system will not have two scan at the 327 * command is very huge the system will not have two scan at the
328 * same time */ 328 * same time */
329 len = sizeof(struct iwl_cmd) * slots_num; 329 len = sizeof(struct iwl3945_cmd) * slots_num;
330 if (txq_id == IWL_CMD_QUEUE_NUM) 330 if (txq_id == IWL_CMD_QUEUE_NUM)
331 len += IWL_MAX_SCAN_SIZE; 331 len += IWL_MAX_SCAN_SIZE;
332 txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd); 332 txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd);
333 if (!txq->cmd) 333 if (!txq->cmd)
334 return -ENOMEM; 334 return -ENOMEM;
335 335
336 rc = iwl_tx_queue_alloc(priv, txq, txq_id); 336 rc = iwl3945_tx_queue_alloc(priv, txq, txq_id);
337 if (rc) { 337 if (rc) {
338 pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd); 338 pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd);
339 339
@@ -342,26 +342,26 @@ int iwl_tx_queue_init(struct iwl_priv *priv,
342 txq->need_update = 0; 342 txq->need_update = 0;
343 343
344 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise 344 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
345 * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */ 345 * iwl3945_queue_inc_wrap and iwl3945_queue_dec_wrap are broken. */
346 BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); 346 BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1));
347 iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id); 347 iwl3945_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id);
348 348
349 iwl_hw_tx_queue_init(priv, txq); 349 iwl3945_hw_tx_queue_init(priv, txq);
350 350
351 return 0; 351 return 0;
352} 352}
353 353
354/** 354/**
355 * iwl_tx_queue_free - Deallocate DMA queue. 355 * iwl3945_tx_queue_free - Deallocate DMA queue.
356 * @txq: Transmit queue to deallocate. 356 * @txq: Transmit queue to deallocate.
357 * 357 *
358 * Empty queue by removing and destroying all BD's. 358 * Empty queue by removing and destroying all BD's.
359 * Free all buffers. txq itself is not freed. 359 * Free all buffers. txq itself is not freed.
360 * 360 *
361 */ 361 */
362void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) 362void iwl3945_tx_queue_free(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq)
363{ 363{
364 struct iwl_queue *q = &txq->q; 364 struct iwl3945_queue *q = &txq->q;
365 struct pci_dev *dev = priv->pci_dev; 365 struct pci_dev *dev = priv->pci_dev;
366 int len; 366 int len;
367 367
@@ -370,10 +370,10 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq)
370 370
371 /* first, empty all BD's */ 371 /* first, empty all BD's */
372 for (; q->write_ptr != q->read_ptr; 372 for (; q->write_ptr != q->read_ptr;
373 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) 373 q->read_ptr = iwl3945_queue_inc_wrap(q->read_ptr, q->n_bd))
374 iwl_hw_txq_free_tfd(priv, txq); 374 iwl3945_hw_txq_free_tfd(priv, txq);
375 375
376 len = sizeof(struct iwl_cmd) * q->n_window; 376 len = sizeof(struct iwl3945_cmd) * q->n_window;
377 if (q->id == IWL_CMD_QUEUE_NUM) 377 if (q->id == IWL_CMD_QUEUE_NUM)
378 len += IWL_MAX_SCAN_SIZE; 378 len += IWL_MAX_SCAN_SIZE;
379 379
@@ -381,7 +381,7 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq)
381 381
382 /* free buffers belonging to queue itself */ 382 /* free buffers belonging to queue itself */
383 if (txq->q.n_bd) 383 if (txq->q.n_bd)
384 pci_free_consistent(dev, sizeof(struct iwl_tfd_frame) * 384 pci_free_consistent(dev, sizeof(struct iwl3945_tfd_frame) *
385 txq->q.n_bd, txq->bd, txq->q.dma_addr); 385 txq->q.n_bd, txq->bd, txq->q.dma_addr);
386 386
387 if (txq->txb) { 387 if (txq->txb) {
@@ -393,12 +393,12 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq)
393 memset(txq, 0, sizeof(*txq)); 393 memset(txq, 0, sizeof(*txq));
394} 394}
395 395
396const u8 BROADCAST_ADDR[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; 396const u8 iwl3945_broadcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
397 397
398/*************** STATION TABLE MANAGEMENT **** 398/*************** STATION TABLE MANAGEMENT ****
399 * 399 *
400 * NOTE: This needs to be overhauled to better synchronize between 400 * NOTE: This needs to be overhauled to better synchronize between
401 * how the iwl-4965.c is using iwl_hw_find_station vs. iwl-3945.c 401 * how the iwl-4965.c is using iwl3945_hw_find_station vs. iwl-3945.c
402 * 402 *
403 * mac80211 should also be examined to determine if sta_info is duplicating 403 * mac80211 should also be examined to determine if sta_info is duplicating
404 * the functionality provided here 404 * the functionality provided here
@@ -406,7 +406,7 @@ const u8 BROADCAST_ADDR[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
406 406
407/**************************************************************/ 407/**************************************************************/
408#if 0 /* temporary disable till we add real remove station */ 408#if 0 /* temporary disable till we add real remove station */
409static u8 iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap) 409static u8 iwl3945_remove_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap)
410{ 410{
411 int index = IWL_INVALID_STATION; 411 int index = IWL_INVALID_STATION;
412 int i; 412 int i;
@@ -442,7 +442,7 @@ out:
442 return 0; 442 return 0;
443} 443}
444#endif 444#endif
445static void iwl_clear_stations_table(struct iwl_priv *priv) 445static void iwl3945_clear_stations_table(struct iwl3945_priv *priv)
446{ 446{
447 unsigned long flags; 447 unsigned long flags;
448 448
@@ -455,11 +455,11 @@ static void iwl_clear_stations_table(struct iwl_priv *priv)
455} 455}
456 456
457 457
458u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags) 458u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8 flags)
459{ 459{
460 int i; 460 int i;
461 int index = IWL_INVALID_STATION; 461 int index = IWL_INVALID_STATION;
462 struct iwl_station_entry *station; 462 struct iwl3945_station_entry *station;
463 unsigned long flags_spin; 463 unsigned long flags_spin;
464 DECLARE_MAC_BUF(mac); 464 DECLARE_MAC_BUF(mac);
465 u8 rate; 465 u8 rate;
@@ -500,7 +500,7 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags)
500 station->used = 1; 500 station->used = 1;
501 priv->num_stations++; 501 priv->num_stations++;
502 502
503 memset(&station->sta, 0, sizeof(struct iwl_addsta_cmd)); 503 memset(&station->sta, 0, sizeof(struct iwl3945_addsta_cmd));
504 memcpy(station->sta.sta.addr, addr, ETH_ALEN); 504 memcpy(station->sta.sta.addr, addr, ETH_ALEN);
505 station->sta.mode = 0; 505 station->sta.mode = 0;
506 station->sta.sta.sta_id = index; 506 station->sta.sta.sta_id = index;
@@ -513,19 +513,19 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags)
513 513
514 /* Turn on both antennas for the station... */ 514 /* Turn on both antennas for the station... */
515 station->sta.rate_n_flags = 515 station->sta.rate_n_flags =
516 iwl_hw_set_rate_n_flags(rate, RATE_MCS_ANT_AB_MSK); 516 iwl3945_hw_set_rate_n_flags(rate, RATE_MCS_ANT_AB_MSK);
517 station->current_rate.rate_n_flags = 517 station->current_rate.rate_n_flags =
518 le16_to_cpu(station->sta.rate_n_flags); 518 le16_to_cpu(station->sta.rate_n_flags);
519 519
520 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 520 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
521 iwl_send_add_station(priv, &station->sta, flags); 521 iwl3945_send_add_station(priv, &station->sta, flags);
522 return index; 522 return index;
523 523
524} 524}
525 525
526/*************** DRIVER STATUS FUNCTIONS *****/ 526/*************** DRIVER STATUS FUNCTIONS *****/
527 527
528static inline int iwl_is_ready(struct iwl_priv *priv) 528static inline int iwl3945_is_ready(struct iwl3945_priv *priv)
529{ 529{
530 /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are 530 /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are
531 * set but EXIT_PENDING is not */ 531 * set but EXIT_PENDING is not */
@@ -534,29 +534,29 @@ static inline int iwl_is_ready(struct iwl_priv *priv)
534 !test_bit(STATUS_EXIT_PENDING, &priv->status); 534 !test_bit(STATUS_EXIT_PENDING, &priv->status);
535} 535}
536 536
537static inline int iwl_is_alive(struct iwl_priv *priv) 537static inline int iwl3945_is_alive(struct iwl3945_priv *priv)
538{ 538{
539 return test_bit(STATUS_ALIVE, &priv->status); 539 return test_bit(STATUS_ALIVE, &priv->status);
540} 540}
541 541
542static inline int iwl_is_init(struct iwl_priv *priv) 542static inline int iwl3945_is_init(struct iwl3945_priv *priv)
543{ 543{
544 return test_bit(STATUS_INIT, &priv->status); 544 return test_bit(STATUS_INIT, &priv->status);
545} 545}
546 546
547static inline int iwl_is_rfkill(struct iwl_priv *priv) 547static inline int iwl3945_is_rfkill(struct iwl3945_priv *priv)
548{ 548{
549 return test_bit(STATUS_RF_KILL_HW, &priv->status) || 549 return test_bit(STATUS_RF_KILL_HW, &priv->status) ||
550 test_bit(STATUS_RF_KILL_SW, &priv->status); 550 test_bit(STATUS_RF_KILL_SW, &priv->status);
551} 551}
552 552
553static inline int iwl_is_ready_rf(struct iwl_priv *priv) 553static inline int iwl3945_is_ready_rf(struct iwl3945_priv *priv)
554{ 554{
555 555
556 if (iwl_is_rfkill(priv)) 556 if (iwl3945_is_rfkill(priv))
557 return 0; 557 return 0;
558 558
559 return iwl_is_ready(priv); 559 return iwl3945_is_ready(priv);
560} 560}
561 561
562/*************** HOST COMMAND QUEUE FUNCTIONS *****/ 562/*************** HOST COMMAND QUEUE FUNCTIONS *****/
@@ -615,7 +615,7 @@ static const char *get_cmd_string(u8 cmd)
615#define HOST_COMPLETE_TIMEOUT (HZ / 2) 615#define HOST_COMPLETE_TIMEOUT (HZ / 2)
616 616
617/** 617/**
618 * iwl_enqueue_hcmd - enqueue a uCode command 618 * iwl3945_enqueue_hcmd - enqueue a uCode command
619 * @priv: device private data point 619 * @priv: device private data point
620 * @cmd: a point to the ucode command structure 620 * @cmd: a point to the ucode command structure
621 * 621 *
@@ -623,13 +623,13 @@ static const char *get_cmd_string(u8 cmd)
623 * failed. On success, it turns the index (> 0) of command in the 623 * failed. On success, it turns the index (> 0) of command in the
624 * command queue. 624 * command queue.
625 */ 625 */
626static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 626static int iwl3945_enqueue_hcmd(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd)
627{ 627{
628 struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; 628 struct iwl3945_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
629 struct iwl_queue *q = &txq->q; 629 struct iwl3945_queue *q = &txq->q;
630 struct iwl_tfd_frame *tfd; 630 struct iwl3945_tfd_frame *tfd;
631 u32 *control_flags; 631 u32 *control_flags;
632 struct iwl_cmd *out_cmd; 632 struct iwl3945_cmd *out_cmd;
633 u32 idx; 633 u32 idx;
634 u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); 634 u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr));
635 dma_addr_t phys_addr; 635 dma_addr_t phys_addr;
@@ -644,7 +644,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
644 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) && 644 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) &&
645 !(cmd->meta.flags & CMD_SIZE_HUGE)); 645 !(cmd->meta.flags & CMD_SIZE_HUGE));
646 646
647 if (iwl_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) { 647 if (iwl3945_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) {
648 IWL_ERROR("No space for Tx\n"); 648 IWL_ERROR("No space for Tx\n");
649 return -ENOSPC; 649 return -ENOSPC;
650 } 650 }
@@ -673,8 +673,8 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
673 out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); 673 out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME);
674 674
675 phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx + 675 phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx +
676 offsetof(struct iwl_cmd, hdr); 676 offsetof(struct iwl3945_cmd, hdr);
677 iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); 677 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size);
678 678
679 pad = U32_PAD(cmd->len); 679 pad = U32_PAD(cmd->len);
680 count = TFD_CTL_COUNT_GET(*control_flags); 680 count = TFD_CTL_COUNT_GET(*control_flags);
@@ -687,14 +687,14 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
687 fix_size, q->write_ptr, idx, IWL_CMD_QUEUE_NUM); 687 fix_size, q->write_ptr, idx, IWL_CMD_QUEUE_NUM);
688 688
689 txq->need_update = 1; 689 txq->need_update = 1;
690 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 690 q->write_ptr = iwl3945_queue_inc_wrap(q->write_ptr, q->n_bd);
691 ret = iwl_tx_queue_update_write_ptr(priv, txq); 691 ret = iwl3945_tx_queue_update_write_ptr(priv, txq);
692 692
693 spin_unlock_irqrestore(&priv->hcmd_lock, flags); 693 spin_unlock_irqrestore(&priv->hcmd_lock, flags);
694 return ret ? ret : idx; 694 return ret ? ret : idx;
695} 695}
696 696
697static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 697static int iwl3945_send_cmd_async(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd)
698{ 698{
699 int ret; 699 int ret;
700 700
@@ -709,16 +709,16 @@ static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
709 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 709 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
710 return -EBUSY; 710 return -EBUSY;
711 711
712 ret = iwl_enqueue_hcmd(priv, cmd); 712 ret = iwl3945_enqueue_hcmd(priv, cmd);
713 if (ret < 0) { 713 if (ret < 0) {
714 IWL_ERROR("Error sending %s: iwl_enqueue_hcmd failed: %d\n", 714 IWL_ERROR("Error sending %s: iwl3945_enqueue_hcmd failed: %d\n",
715 get_cmd_string(cmd->id), ret); 715 get_cmd_string(cmd->id), ret);
716 return ret; 716 return ret;
717 } 717 }
718 return 0; 718 return 0;
719} 719}
720 720
721static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 721static int iwl3945_send_cmd_sync(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd)
722{ 722{
723 int cmd_idx; 723 int cmd_idx;
724 int ret; 724 int ret;
@@ -740,10 +740,10 @@ static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
740 if (cmd->meta.flags & CMD_WANT_SKB) 740 if (cmd->meta.flags & CMD_WANT_SKB)
741 cmd->meta.source = &cmd->meta; 741 cmd->meta.source = &cmd->meta;
742 742
743 cmd_idx = iwl_enqueue_hcmd(priv, cmd); 743 cmd_idx = iwl3945_enqueue_hcmd(priv, cmd);
744 if (cmd_idx < 0) { 744 if (cmd_idx < 0) {
745 ret = cmd_idx; 745 ret = cmd_idx;
746 IWL_ERROR("Error sending %s: iwl_enqueue_hcmd failed: %d\n", 746 IWL_ERROR("Error sending %s: iwl3945_enqueue_hcmd failed: %d\n",
747 get_cmd_string(cmd->id), ret); 747 get_cmd_string(cmd->id), ret);
748 goto out; 748 goto out;
749 } 749 }
@@ -787,7 +787,7 @@ static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
787 787
788cancel: 788cancel:
789 if (cmd->meta.flags & CMD_WANT_SKB) { 789 if (cmd->meta.flags & CMD_WANT_SKB) {
790 struct iwl_cmd *qcmd; 790 struct iwl3945_cmd *qcmd;
791 791
792 /* Cancel the CMD_WANT_SKB flag for the cmd in the 792 /* Cancel the CMD_WANT_SKB flag for the cmd in the
793 * TX cmd queue. Otherwise in case the cmd comes 793 * TX cmd queue. Otherwise in case the cmd comes
@@ -806,43 +806,43 @@ out:
806 return ret; 806 return ret;
807} 807}
808 808
809int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 809int iwl3945_send_cmd(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd)
810{ 810{
811 if (cmd->meta.flags & CMD_ASYNC) 811 if (cmd->meta.flags & CMD_ASYNC)
812 return iwl_send_cmd_async(priv, cmd); 812 return iwl3945_send_cmd_async(priv, cmd);
813 813
814 return iwl_send_cmd_sync(priv, cmd); 814 return iwl3945_send_cmd_sync(priv, cmd);
815} 815}
816 816
817int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data) 817int iwl3945_send_cmd_pdu(struct iwl3945_priv *priv, u8 id, u16 len, const void *data)
818{ 818{
819 struct iwl_host_cmd cmd = { 819 struct iwl3945_host_cmd cmd = {
820 .id = id, 820 .id = id,
821 .len = len, 821 .len = len,
822 .data = data, 822 .data = data,
823 }; 823 };
824 824
825 return iwl_send_cmd_sync(priv, &cmd); 825 return iwl3945_send_cmd_sync(priv, &cmd);
826} 826}
827 827
828static int __must_check iwl_send_cmd_u32(struct iwl_priv *priv, u8 id, u32 val) 828static int __must_check iwl3945_send_cmd_u32(struct iwl3945_priv *priv, u8 id, u32 val)
829{ 829{
830 struct iwl_host_cmd cmd = { 830 struct iwl3945_host_cmd cmd = {
831 .id = id, 831 .id = id,
832 .len = sizeof(val), 832 .len = sizeof(val),
833 .data = &val, 833 .data = &val,
834 }; 834 };
835 835
836 return iwl_send_cmd_sync(priv, &cmd); 836 return iwl3945_send_cmd_sync(priv, &cmd);
837} 837}
838 838
839int iwl_send_statistics_request(struct iwl_priv *priv) 839int iwl3945_send_statistics_request(struct iwl3945_priv *priv)
840{ 840{
841 return iwl_send_cmd_u32(priv, REPLY_STATISTICS_CMD, 0); 841 return iwl3945_send_cmd_u32(priv, REPLY_STATISTICS_CMD, 0);
842} 842}
843 843
844/** 844/**
845 * iwl_set_rxon_channel - Set the phymode and channel values in staging RXON 845 * iwl3945_set_rxon_channel - Set the phymode and channel values in staging RXON
846 * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz 846 * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz
847 * @channel: Any channel valid for the requested phymode 847 * @channel: Any channel valid for the requested phymode
848 848
@@ -851,9 +851,9 @@ int iwl_send_statistics_request(struct iwl_priv *priv)
851 * NOTE: Does not commit to the hardware; it sets appropriate bit fields 851 * NOTE: Does not commit to the hardware; it sets appropriate bit fields
852 * in the staging RXON flag structure based on the phymode 852 * in the staging RXON flag structure based on the phymode
853 */ 853 */
854static int iwl_set_rxon_channel(struct iwl_priv *priv, u8 phymode, u16 channel) 854static int iwl3945_set_rxon_channel(struct iwl3945_priv *priv, u8 phymode, u16 channel)
855{ 855{
856 if (!iwl_get_channel_info(priv, phymode, channel)) { 856 if (!iwl3945_get_channel_info(priv, phymode, channel)) {
857 IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", 857 IWL_DEBUG_INFO("Could not set channel to %d [%d]\n",
858 channel, phymode); 858 channel, phymode);
859 return -EINVAL; 859 return -EINVAL;
@@ -877,13 +877,13 @@ static int iwl_set_rxon_channel(struct iwl_priv *priv, u8 phymode, u16 channel)
877} 877}
878 878
879/** 879/**
880 * iwl_check_rxon_cmd - validate RXON structure is valid 880 * iwl3945_check_rxon_cmd - validate RXON structure is valid
881 * 881 *
882 * NOTE: This is really only useful during development and can eventually 882 * NOTE: This is really only useful during development and can eventually
883 * be #ifdef'd out once the driver is stable and folks aren't actively 883 * be #ifdef'd out once the driver is stable and folks aren't actively
884 * making changes 884 * making changes
885 */ 885 */
886static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon) 886static int iwl3945_check_rxon_cmd(struct iwl3945_rxon_cmd *rxon)
887{ 887{
888 int error = 0; 888 int error = 0;
889 int counter = 1; 889 int counter = 1;
@@ -949,21 +949,21 @@ static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon)
949 le16_to_cpu(rxon->channel)); 949 le16_to_cpu(rxon->channel));
950 950
951 if (error) { 951 if (error) {
952 IWL_ERROR("Not a valid iwl_rxon_assoc_cmd field values\n"); 952 IWL_ERROR("Not a valid iwl3945_rxon_assoc_cmd field values\n");
953 return -1; 953 return -1;
954 } 954 }
955 return 0; 955 return 0;
956} 956}
957 957
958/** 958/**
959 * iwl_full_rxon_required - determine if RXON_ASSOC can be used in RXON commit 959 * iwl3945_full_rxon_required - determine if RXON_ASSOC can be used in RXON commit
960 * @priv: staging_rxon is compared to active_rxon 960 * @priv: staging_rxon is compared to active_rxon
961 * 961 *
962 * If the RXON structure is changing sufficient to require a new 962 * If the RXON structure is changing sufficient to require a new
963 * tune or to clear and reset the RXON_FILTER_ASSOC_MSK then return 1 963 * tune or to clear and reset the RXON_FILTER_ASSOC_MSK then return 1
964 * to indicate a new tune is required. 964 * to indicate a new tune is required.
965 */ 965 */
966static int iwl_full_rxon_required(struct iwl_priv *priv) 966static int iwl3945_full_rxon_required(struct iwl3945_priv *priv)
967{ 967{
968 968
969 /* These items are only settable from the full RXON command */ 969 /* These items are only settable from the full RXON command */
@@ -998,19 +998,19 @@ static int iwl_full_rxon_required(struct iwl_priv *priv)
998 return 0; 998 return 0;
999} 999}
1000 1000
1001static int iwl_send_rxon_assoc(struct iwl_priv *priv) 1001static int iwl3945_send_rxon_assoc(struct iwl3945_priv *priv)
1002{ 1002{
1003 int rc = 0; 1003 int rc = 0;
1004 struct iwl_rx_packet *res = NULL; 1004 struct iwl3945_rx_packet *res = NULL;
1005 struct iwl_rxon_assoc_cmd rxon_assoc; 1005 struct iwl3945_rxon_assoc_cmd rxon_assoc;
1006 struct iwl_host_cmd cmd = { 1006 struct iwl3945_host_cmd cmd = {
1007 .id = REPLY_RXON_ASSOC, 1007 .id = REPLY_RXON_ASSOC,
1008 .len = sizeof(rxon_assoc), 1008 .len = sizeof(rxon_assoc),
1009 .meta.flags = CMD_WANT_SKB, 1009 .meta.flags = CMD_WANT_SKB,
1010 .data = &rxon_assoc, 1010 .data = &rxon_assoc,
1011 }; 1011 };
1012 const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; 1012 const struct iwl3945_rxon_cmd *rxon1 = &priv->staging_rxon;
1013 const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; 1013 const struct iwl3945_rxon_cmd *rxon2 = &priv->active_rxon;
1014 1014
1015 if ((rxon1->flags == rxon2->flags) && 1015 if ((rxon1->flags == rxon2->flags) &&
1016 (rxon1->filter_flags == rxon2->filter_flags) && 1016 (rxon1->filter_flags == rxon2->filter_flags) &&
@@ -1026,11 +1026,11 @@ static int iwl_send_rxon_assoc(struct iwl_priv *priv)
1026 rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates; 1026 rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates;
1027 rxon_assoc.reserved = 0; 1027 rxon_assoc.reserved = 0;
1028 1028
1029 rc = iwl_send_cmd_sync(priv, &cmd); 1029 rc = iwl3945_send_cmd_sync(priv, &cmd);
1030 if (rc) 1030 if (rc)
1031 return rc; 1031 return rc;
1032 1032
1033 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; 1033 res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
1034 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 1034 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
1035 IWL_ERROR("Bad return from REPLY_RXON_ASSOC command\n"); 1035 IWL_ERROR("Bad return from REPLY_RXON_ASSOC command\n");
1036 rc = -EIO; 1036 rc = -EIO;
@@ -1043,21 +1043,21 @@ static int iwl_send_rxon_assoc(struct iwl_priv *priv)
1043} 1043}
1044 1044
1045/** 1045/**
1046 * iwl_commit_rxon - commit staging_rxon to hardware 1046 * iwl3945_commit_rxon - commit staging_rxon to hardware
1047 * 1047 *
1048 * The RXON command in staging_rxon is committed to the hardware and 1048 * The RXON command in staging_rxon is committed to the hardware and
1049 * the active_rxon structure is updated with the new data. This 1049 * the active_rxon structure is updated with the new data. This
1050 * function correctly transitions out of the RXON_ASSOC_MSK state if 1050 * function correctly transitions out of the RXON_ASSOC_MSK state if
1051 * a HW tune is required based on the RXON structure changes. 1051 * a HW tune is required based on the RXON structure changes.
1052 */ 1052 */
1053static int iwl_commit_rxon(struct iwl_priv *priv) 1053static int iwl3945_commit_rxon(struct iwl3945_priv *priv)
1054{ 1054{
1055 /* cast away the const for active_rxon in this function */ 1055 /* cast away the const for active_rxon in this function */
1056 struct iwl_rxon_cmd *active_rxon = (void *)&priv->active_rxon; 1056 struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active_rxon;
1057 int rc = 0; 1057 int rc = 0;
1058 DECLARE_MAC_BUF(mac); 1058 DECLARE_MAC_BUF(mac);
1059 1059
1060 if (!iwl_is_alive(priv)) 1060 if (!iwl3945_is_alive(priv))
1061 return -1; 1061 return -1;
1062 1062
1063 /* always get timestamp with Rx frame */ 1063 /* always get timestamp with Rx frame */
@@ -1068,17 +1068,17 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1068 ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); 1068 ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK);
1069 priv->staging_rxon.flags |= iwl3945_get_antenna_flags(priv); 1069 priv->staging_rxon.flags |= iwl3945_get_antenna_flags(priv);
1070 1070
1071 rc = iwl_check_rxon_cmd(&priv->staging_rxon); 1071 rc = iwl3945_check_rxon_cmd(&priv->staging_rxon);
1072 if (rc) { 1072 if (rc) {
1073 IWL_ERROR("Invalid RXON configuration. Not committing.\n"); 1073 IWL_ERROR("Invalid RXON configuration. Not committing.\n");
1074 return -EINVAL; 1074 return -EINVAL;
1075 } 1075 }
1076 1076
1077 /* If we don't need to send a full RXON, we can use 1077 /* If we don't need to send a full RXON, we can use
1078 * iwl_rxon_assoc_cmd which is used to reconfigure filter 1078 * iwl3945_rxon_assoc_cmd which is used to reconfigure filter
1079 * and other flags for the current radio configuration. */ 1079 * and other flags for the current radio configuration. */
1080 if (!iwl_full_rxon_required(priv)) { 1080 if (!iwl3945_full_rxon_required(priv)) {
1081 rc = iwl_send_rxon_assoc(priv); 1081 rc = iwl3945_send_rxon_assoc(priv);
1082 if (rc) { 1082 if (rc) {
1083 IWL_ERROR("Error setting RXON_ASSOC " 1083 IWL_ERROR("Error setting RXON_ASSOC "
1084 "configuration (%d).\n", rc); 1084 "configuration (%d).\n", rc);
@@ -1094,13 +1094,13 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1094 * an RXON_ASSOC and the new config wants the associated mask enabled, 1094 * an RXON_ASSOC and the new config wants the associated mask enabled,
1095 * we must clear the associated from the active configuration 1095 * we must clear the associated from the active configuration
1096 * before we apply the new config */ 1096 * before we apply the new config */
1097 if (iwl_is_associated(priv) && 1097 if (iwl3945_is_associated(priv) &&
1098 (priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK)) { 1098 (priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK)) {
1099 IWL_DEBUG_INFO("Toggling associated bit on current RXON\n"); 1099 IWL_DEBUG_INFO("Toggling associated bit on current RXON\n");
1100 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 1100 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1101 1101
1102 rc = iwl_send_cmd_pdu(priv, REPLY_RXON, 1102 rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON,
1103 sizeof(struct iwl_rxon_cmd), 1103 sizeof(struct iwl3945_rxon_cmd),
1104 &priv->active_rxon); 1104 &priv->active_rxon);
1105 1105
1106 /* If the mask clearing failed then we set 1106 /* If the mask clearing failed then we set
@@ -1123,8 +1123,8 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1123 print_mac(mac, priv->staging_rxon.bssid_addr)); 1123 print_mac(mac, priv->staging_rxon.bssid_addr));
1124 1124
1125 /* Apply the new configuration */ 1125 /* Apply the new configuration */
1126 rc = iwl_send_cmd_pdu(priv, REPLY_RXON, 1126 rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON,
1127 sizeof(struct iwl_rxon_cmd), &priv->staging_rxon); 1127 sizeof(struct iwl3945_rxon_cmd), &priv->staging_rxon);
1128 if (rc) { 1128 if (rc) {
1129 IWL_ERROR("Error setting new configuration (%d).\n", rc); 1129 IWL_ERROR("Error setting new configuration (%d).\n", rc);
1130 return rc; 1130 return rc;
@@ -1132,18 +1132,18 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1132 1132
1133 memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); 1133 memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon));
1134 1134
1135 iwl_clear_stations_table(priv); 1135 iwl3945_clear_stations_table(priv);
1136 1136
1137 /* If we issue a new RXON command which required a tune then we must 1137 /* If we issue a new RXON command which required a tune then we must
1138 * send a new TXPOWER command or we won't be able to Tx any frames */ 1138 * send a new TXPOWER command or we won't be able to Tx any frames */
1139 rc = iwl_hw_reg_send_txpower(priv); 1139 rc = iwl3945_hw_reg_send_txpower(priv);
1140 if (rc) { 1140 if (rc) {
1141 IWL_ERROR("Error setting Tx power (%d).\n", rc); 1141 IWL_ERROR("Error setting Tx power (%d).\n", rc);
1142 return rc; 1142 return rc;
1143 } 1143 }
1144 1144
1145 /* Add the broadcast address so we can send broadcast frames */ 1145 /* Add the broadcast address so we can send broadcast frames */
1146 if (iwl_add_station(priv, BROADCAST_ADDR, 0, 0) == 1146 if (iwl3945_add_station(priv, iwl3945_broadcast_addr, 0, 0) ==
1147 IWL_INVALID_STATION) { 1147 IWL_INVALID_STATION) {
1148 IWL_ERROR("Error adding BROADCAST address for transmit.\n"); 1148 IWL_ERROR("Error adding BROADCAST address for transmit.\n");
1149 return -EIO; 1149 return -EIO;
@@ -1151,9 +1151,9 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1151 1151
1152 /* If we have set the ASSOC_MSK and we are in BSS mode then 1152 /* If we have set the ASSOC_MSK and we are in BSS mode then
1153 * add the IWL_AP_ID to the station rate table */ 1153 * add the IWL_AP_ID to the station rate table */
1154 if (iwl_is_associated(priv) && 1154 if (iwl3945_is_associated(priv) &&
1155 (priv->iw_mode == IEEE80211_IF_TYPE_STA)) 1155 (priv->iw_mode == IEEE80211_IF_TYPE_STA))
1156 if (iwl_add_station(priv, priv->active_rxon.bssid_addr, 1, 0) 1156 if (iwl3945_add_station(priv, priv->active_rxon.bssid_addr, 1, 0)
1157 == IWL_INVALID_STATION) { 1157 == IWL_INVALID_STATION) {
1158 IWL_ERROR("Error adding AP address for transmit.\n"); 1158 IWL_ERROR("Error adding AP address for transmit.\n");
1159 return -EIO; 1159 return -EIO;
@@ -1170,9 +1170,9 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1170 return 0; 1170 return 0;
1171} 1171}
1172 1172
1173static int iwl_send_bt_config(struct iwl_priv *priv) 1173static int iwl3945_send_bt_config(struct iwl3945_priv *priv)
1174{ 1174{
1175 struct iwl_bt_cmd bt_cmd = { 1175 struct iwl3945_bt_cmd bt_cmd = {
1176 .flags = 3, 1176 .flags = 3,
1177 .lead_time = 0xAA, 1177 .lead_time = 0xAA,
1178 .max_kill = 1, 1178 .max_kill = 1,
@@ -1180,15 +1180,15 @@ static int iwl_send_bt_config(struct iwl_priv *priv)
1180 .kill_cts_mask = 0, 1180 .kill_cts_mask = 0,
1181 }; 1181 };
1182 1182
1183 return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG, 1183 return iwl3945_send_cmd_pdu(priv, REPLY_BT_CONFIG,
1184 sizeof(struct iwl_bt_cmd), &bt_cmd); 1184 sizeof(struct iwl3945_bt_cmd), &bt_cmd);
1185} 1185}
1186 1186
1187static int iwl_send_scan_abort(struct iwl_priv *priv) 1187static int iwl3945_send_scan_abort(struct iwl3945_priv *priv)
1188{ 1188{
1189 int rc = 0; 1189 int rc = 0;
1190 struct iwl_rx_packet *res; 1190 struct iwl3945_rx_packet *res;
1191 struct iwl_host_cmd cmd = { 1191 struct iwl3945_host_cmd cmd = {
1192 .id = REPLY_SCAN_ABORT_CMD, 1192 .id = REPLY_SCAN_ABORT_CMD,
1193 .meta.flags = CMD_WANT_SKB, 1193 .meta.flags = CMD_WANT_SKB,
1194 }; 1194 };
@@ -1201,13 +1201,13 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
1201 return 0; 1201 return 0;
1202 } 1202 }
1203 1203
1204 rc = iwl_send_cmd_sync(priv, &cmd); 1204 rc = iwl3945_send_cmd_sync(priv, &cmd);
1205 if (rc) { 1205 if (rc) {
1206 clear_bit(STATUS_SCAN_ABORTING, &priv->status); 1206 clear_bit(STATUS_SCAN_ABORTING, &priv->status);
1207 return rc; 1207 return rc;
1208 } 1208 }
1209 1209
1210 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; 1210 res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
1211 if (res->u.status != CAN_ABORT_STATUS) { 1211 if (res->u.status != CAN_ABORT_STATUS) {
1212 /* The scan abort will return 1 for success or 1212 /* The scan abort will return 1 for success or
1213 * 2 for "failure". A failure condition can be 1213 * 2 for "failure". A failure condition can be
@@ -1225,8 +1225,8 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
1225 return rc; 1225 return rc;
1226} 1226}
1227 1227
1228static int iwl_card_state_sync_callback(struct iwl_priv *priv, 1228static int iwl3945_card_state_sync_callback(struct iwl3945_priv *priv,
1229 struct iwl_cmd *cmd, 1229 struct iwl3945_cmd *cmd,
1230 struct sk_buff *skb) 1230 struct sk_buff *skb)
1231{ 1231{
1232 return 1; 1232 return 1;
@@ -1242,9 +1242,9 @@ static int iwl_card_state_sync_callback(struct iwl_priv *priv,
1242 * When in the 'halt' state, the card is shut down and must be fully 1242 * When in the 'halt' state, the card is shut down and must be fully
1243 * restarted to come back on. 1243 * restarted to come back on.
1244 */ 1244 */
1245static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag) 1245static int iwl3945_send_card_state(struct iwl3945_priv *priv, u32 flags, u8 meta_flag)
1246{ 1246{
1247 struct iwl_host_cmd cmd = { 1247 struct iwl3945_host_cmd cmd = {
1248 .id = REPLY_CARD_STATE_CMD, 1248 .id = REPLY_CARD_STATE_CMD,
1249 .len = sizeof(u32), 1249 .len = sizeof(u32),
1250 .data = &flags, 1250 .data = &flags,
@@ -1252,22 +1252,22 @@ static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)
1252 }; 1252 };
1253 1253
1254 if (meta_flag & CMD_ASYNC) 1254 if (meta_flag & CMD_ASYNC)
1255 cmd.meta.u.callback = iwl_card_state_sync_callback; 1255 cmd.meta.u.callback = iwl3945_card_state_sync_callback;
1256 1256
1257 return iwl_send_cmd(priv, &cmd); 1257 return iwl3945_send_cmd(priv, &cmd);
1258} 1258}
1259 1259
1260static int iwl_add_sta_sync_callback(struct iwl_priv *priv, 1260static int iwl3945_add_sta_sync_callback(struct iwl3945_priv *priv,
1261 struct iwl_cmd *cmd, struct sk_buff *skb) 1261 struct iwl3945_cmd *cmd, struct sk_buff *skb)
1262{ 1262{
1263 struct iwl_rx_packet *res = NULL; 1263 struct iwl3945_rx_packet *res = NULL;
1264 1264
1265 if (!skb) { 1265 if (!skb) {
1266 IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n"); 1266 IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n");
1267 return 1; 1267 return 1;
1268 } 1268 }
1269 1269
1270 res = (struct iwl_rx_packet *)skb->data; 1270 res = (struct iwl3945_rx_packet *)skb->data;
1271 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 1271 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
1272 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n", 1272 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
1273 res->hdr.flags); 1273 res->hdr.flags);
@@ -1285,29 +1285,29 @@ static int iwl_add_sta_sync_callback(struct iwl_priv *priv,
1285 return 1; 1285 return 1;
1286} 1286}
1287 1287
1288int iwl_send_add_station(struct iwl_priv *priv, 1288int iwl3945_send_add_station(struct iwl3945_priv *priv,
1289 struct iwl_addsta_cmd *sta, u8 flags) 1289 struct iwl3945_addsta_cmd *sta, u8 flags)
1290{ 1290{
1291 struct iwl_rx_packet *res = NULL; 1291 struct iwl3945_rx_packet *res = NULL;
1292 int rc = 0; 1292 int rc = 0;
1293 struct iwl_host_cmd cmd = { 1293 struct iwl3945_host_cmd cmd = {
1294 .id = REPLY_ADD_STA, 1294 .id = REPLY_ADD_STA,
1295 .len = sizeof(struct iwl_addsta_cmd), 1295 .len = sizeof(struct iwl3945_addsta_cmd),
1296 .meta.flags = flags, 1296 .meta.flags = flags,
1297 .data = sta, 1297 .data = sta,
1298 }; 1298 };
1299 1299
1300 if (flags & CMD_ASYNC) 1300 if (flags & CMD_ASYNC)
1301 cmd.meta.u.callback = iwl_add_sta_sync_callback; 1301 cmd.meta.u.callback = iwl3945_add_sta_sync_callback;
1302 else 1302 else
1303 cmd.meta.flags |= CMD_WANT_SKB; 1303 cmd.meta.flags |= CMD_WANT_SKB;
1304 1304
1305 rc = iwl_send_cmd(priv, &cmd); 1305 rc = iwl3945_send_cmd(priv, &cmd);
1306 1306
1307 if (rc || (flags & CMD_ASYNC)) 1307 if (rc || (flags & CMD_ASYNC))
1308 return rc; 1308 return rc;
1309 1309
1310 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; 1310 res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
1311 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 1311 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
1312 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n", 1312 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
1313 res->hdr.flags); 1313 res->hdr.flags);
@@ -1332,7 +1332,7 @@ int iwl_send_add_station(struct iwl_priv *priv,
1332 return rc; 1332 return rc;
1333} 1333}
1334 1334
1335static int iwl_update_sta_key_info(struct iwl_priv *priv, 1335static int iwl3945_update_sta_key_info(struct iwl3945_priv *priv,
1336 struct ieee80211_key_conf *keyconf, 1336 struct ieee80211_key_conf *keyconf,
1337 u8 sta_id) 1337 u8 sta_id)
1338{ 1338{
@@ -1366,28 +1366,28 @@ static int iwl_update_sta_key_info(struct iwl_priv *priv,
1366 spin_unlock_irqrestore(&priv->sta_lock, flags); 1366 spin_unlock_irqrestore(&priv->sta_lock, flags);
1367 1367
1368 IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n"); 1368 IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n");
1369 iwl_send_add_station(priv, &priv->stations[sta_id].sta, 0); 1369 iwl3945_send_add_station(priv, &priv->stations[sta_id].sta, 0);
1370 return 0; 1370 return 0;
1371} 1371}
1372 1372
1373static int iwl_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id) 1373static int iwl3945_clear_sta_key_info(struct iwl3945_priv *priv, u8 sta_id)
1374{ 1374{
1375 unsigned long flags; 1375 unsigned long flags;
1376 1376
1377 spin_lock_irqsave(&priv->sta_lock, flags); 1377 spin_lock_irqsave(&priv->sta_lock, flags);
1378 memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl_hw_key)); 1378 memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl3945_hw_key));
1379 memset(&priv->stations[sta_id].sta.key, 0, sizeof(struct iwl_keyinfo)); 1379 memset(&priv->stations[sta_id].sta.key, 0, sizeof(struct iwl3945_keyinfo));
1380 priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; 1380 priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC;
1381 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; 1381 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
1382 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 1382 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
1383 spin_unlock_irqrestore(&priv->sta_lock, flags); 1383 spin_unlock_irqrestore(&priv->sta_lock, flags);
1384 1384
1385 IWL_DEBUG_INFO("hwcrypto: clear ucode station key info\n"); 1385 IWL_DEBUG_INFO("hwcrypto: clear ucode station key info\n");
1386 iwl_send_add_station(priv, &priv->stations[sta_id].sta, 0); 1386 iwl3945_send_add_station(priv, &priv->stations[sta_id].sta, 0);
1387 return 0; 1387 return 0;
1388} 1388}
1389 1389
1390static void iwl_clear_free_frames(struct iwl_priv *priv) 1390static void iwl3945_clear_free_frames(struct iwl3945_priv *priv)
1391{ 1391{
1392 struct list_head *element; 1392 struct list_head *element;
1393 1393
@@ -1397,7 +1397,7 @@ static void iwl_clear_free_frames(struct iwl_priv *priv)
1397 while (!list_empty(&priv->free_frames)) { 1397 while (!list_empty(&priv->free_frames)) {
1398 element = priv->free_frames.next; 1398 element = priv->free_frames.next;
1399 list_del(element); 1399 list_del(element);
1400 kfree(list_entry(element, struct iwl_frame, list)); 1400 kfree(list_entry(element, struct iwl3945_frame, list));
1401 priv->frames_count--; 1401 priv->frames_count--;
1402 } 1402 }
1403 1403
@@ -1408,9 +1408,9 @@ static void iwl_clear_free_frames(struct iwl_priv *priv)
1408 } 1408 }
1409} 1409}
1410 1410
1411static struct iwl_frame *iwl_get_free_frame(struct iwl_priv *priv) 1411static struct iwl3945_frame *iwl3945_get_free_frame(struct iwl3945_priv *priv)
1412{ 1412{
1413 struct iwl_frame *frame; 1413 struct iwl3945_frame *frame;
1414 struct list_head *element; 1414 struct list_head *element;
1415 if (list_empty(&priv->free_frames)) { 1415 if (list_empty(&priv->free_frames)) {
1416 frame = kzalloc(sizeof(*frame), GFP_KERNEL); 1416 frame = kzalloc(sizeof(*frame), GFP_KERNEL);
@@ -1425,21 +1425,21 @@ static struct iwl_frame *iwl_get_free_frame(struct iwl_priv *priv)
1425 1425
1426 element = priv->free_frames.next; 1426 element = priv->free_frames.next;
1427 list_del(element); 1427 list_del(element);
1428 return list_entry(element, struct iwl_frame, list); 1428 return list_entry(element, struct iwl3945_frame, list);
1429} 1429}
1430 1430
1431static void iwl_free_frame(struct iwl_priv *priv, struct iwl_frame *frame) 1431static void iwl3945_free_frame(struct iwl3945_priv *priv, struct iwl3945_frame *frame)
1432{ 1432{
1433 memset(frame, 0, sizeof(*frame)); 1433 memset(frame, 0, sizeof(*frame));
1434 list_add(&frame->list, &priv->free_frames); 1434 list_add(&frame->list, &priv->free_frames);
1435} 1435}
1436 1436
1437unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, 1437unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv,
1438 struct ieee80211_hdr *hdr, 1438 struct ieee80211_hdr *hdr,
1439 const u8 *dest, int left) 1439 const u8 *dest, int left)
1440{ 1440{
1441 1441
1442 if (!iwl_is_associated(priv) || !priv->ibss_beacon || 1442 if (!iwl3945_is_associated(priv) || !priv->ibss_beacon ||
1443 ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) && 1443 ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) &&
1444 (priv->iw_mode != IEEE80211_IF_TYPE_AP))) 1444 (priv->iw_mode != IEEE80211_IF_TYPE_AP)))
1445 return 0; 1445 return 0;
@@ -1452,37 +1452,37 @@ unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv,
1452 return priv->ibss_beacon->len; 1452 return priv->ibss_beacon->len;
1453} 1453}
1454 1454
1455static int iwl_rate_index_from_plcp(int plcp) 1455static int iwl3945_rate_index_from_plcp(int plcp)
1456{ 1456{
1457 int i = 0; 1457 int i = 0;
1458 1458
1459 for (i = 0; i < IWL_RATE_COUNT; i++) 1459 for (i = 0; i < IWL_RATE_COUNT; i++)
1460 if (iwl_rates[i].plcp == plcp) 1460 if (iwl3945_rates[i].plcp == plcp)
1461 return i; 1461 return i;
1462 return -1; 1462 return -1;
1463} 1463}
1464 1464
1465static u8 iwl_rate_get_lowest_plcp(int rate_mask) 1465static u8 iwl3945_rate_get_lowest_plcp(int rate_mask)
1466{ 1466{
1467 u8 i; 1467 u8 i;
1468 1468
1469 for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID; 1469 for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID;
1470 i = iwl_rates[i].next_ieee) { 1470 i = iwl3945_rates[i].next_ieee) {
1471 if (rate_mask & (1 << i)) 1471 if (rate_mask & (1 << i))
1472 return iwl_rates[i].plcp; 1472 return iwl3945_rates[i].plcp;
1473 } 1473 }
1474 1474
1475 return IWL_RATE_INVALID; 1475 return IWL_RATE_INVALID;
1476} 1476}
1477 1477
1478static int iwl_send_beacon_cmd(struct iwl_priv *priv) 1478static int iwl3945_send_beacon_cmd(struct iwl3945_priv *priv)
1479{ 1479{
1480 struct iwl_frame *frame; 1480 struct iwl3945_frame *frame;
1481 unsigned int frame_size; 1481 unsigned int frame_size;
1482 int rc; 1482 int rc;
1483 u8 rate; 1483 u8 rate;
1484 1484
1485 frame = iwl_get_free_frame(priv); 1485 frame = iwl3945_get_free_frame(priv);
1486 1486
1487 if (!frame) { 1487 if (!frame) {
1488 IWL_ERROR("Could not obtain free frame buffer for beacon " 1488 IWL_ERROR("Could not obtain free frame buffer for beacon "
@@ -1491,22 +1491,22 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv)
1491 } 1491 }
1492 1492
1493 if (!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)) { 1493 if (!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)) {
1494 rate = iwl_rate_get_lowest_plcp(priv->active_rate_basic & 1494 rate = iwl3945_rate_get_lowest_plcp(priv->active_rate_basic &
1495 0xFF0); 1495 0xFF0);
1496 if (rate == IWL_INVALID_RATE) 1496 if (rate == IWL_INVALID_RATE)
1497 rate = IWL_RATE_6M_PLCP; 1497 rate = IWL_RATE_6M_PLCP;
1498 } else { 1498 } else {
1499 rate = iwl_rate_get_lowest_plcp(priv->active_rate_basic & 0xF); 1499 rate = iwl3945_rate_get_lowest_plcp(priv->active_rate_basic & 0xF);
1500 if (rate == IWL_INVALID_RATE) 1500 if (rate == IWL_INVALID_RATE)
1501 rate = IWL_RATE_1M_PLCP; 1501 rate = IWL_RATE_1M_PLCP;
1502 } 1502 }
1503 1503
1504 frame_size = iwl_hw_get_beacon_cmd(priv, frame, rate); 1504 frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate);
1505 1505
1506 rc = iwl_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, 1506 rc = iwl3945_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size,
1507 &frame->u.cmd[0]); 1507 &frame->u.cmd[0]);
1508 1508
1509 iwl_free_frame(priv, frame); 1509 iwl3945_free_frame(priv, frame);
1510 1510
1511 return rc; 1511 return rc;
1512} 1512}
@@ -1517,22 +1517,22 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv)
1517 * 1517 *
1518 ******************************************************************************/ 1518 ******************************************************************************/
1519 1519
1520static void get_eeprom_mac(struct iwl_priv *priv, u8 *mac) 1520static void get_eeprom_mac(struct iwl3945_priv *priv, u8 *mac)
1521{ 1521{
1522 memcpy(mac, priv->eeprom.mac_address, 6); 1522 memcpy(mac, priv->eeprom.mac_address, 6);
1523} 1523}
1524 1524
1525/** 1525/**
1526 * iwl_eeprom_init - read EEPROM contents 1526 * iwl3945_eeprom_init - read EEPROM contents
1527 * 1527 *
1528 * Load the EEPROM from adapter into priv->eeprom 1528 * Load the EEPROM from adapter into priv->eeprom
1529 * 1529 *
1530 * NOTE: This routine uses the non-debug IO access functions. 1530 * NOTE: This routine uses the non-debug IO access functions.
1531 */ 1531 */
1532int iwl_eeprom_init(struct iwl_priv *priv) 1532int iwl3945_eeprom_init(struct iwl3945_priv *priv)
1533{ 1533{
1534 u16 *e = (u16 *)&priv->eeprom; 1534 u16 *e = (u16 *)&priv->eeprom;
1535 u32 gp = iwl_read32(priv, CSR_EEPROM_GP); 1535 u32 gp = iwl3945_read32(priv, CSR_EEPROM_GP);
1536 u32 r; 1536 u32 r;
1537 int sz = sizeof(priv->eeprom); 1537 int sz = sizeof(priv->eeprom);
1538 int rc; 1538 int rc;
@@ -1550,7 +1550,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
1550 return -ENOENT; 1550 return -ENOENT;
1551 } 1551 }
1552 1552
1553 rc = iwl_eeprom_acquire_semaphore(priv); 1553 rc = iwl3945_eeprom_acquire_semaphore(priv);
1554 if (rc < 0) { 1554 if (rc < 0) {
1555 IWL_ERROR("Failed to acquire EEPROM semaphore.\n"); 1555 IWL_ERROR("Failed to acquire EEPROM semaphore.\n");
1556 return -ENOENT; 1556 return -ENOENT;
@@ -1558,12 +1558,12 @@ int iwl_eeprom_init(struct iwl_priv *priv)
1558 1558
1559 /* eeprom is an array of 16bit values */ 1559 /* eeprom is an array of 16bit values */
1560 for (addr = 0; addr < sz; addr += sizeof(u16)) { 1560 for (addr = 0; addr < sz; addr += sizeof(u16)) {
1561 _iwl_write32(priv, CSR_EEPROM_REG, addr << 1); 1561 _iwl3945_write32(priv, CSR_EEPROM_REG, addr << 1);
1562 _iwl_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD); 1562 _iwl3945_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD);
1563 1563
1564 for (i = 0; i < IWL_EEPROM_ACCESS_TIMEOUT; 1564 for (i = 0; i < IWL_EEPROM_ACCESS_TIMEOUT;
1565 i += IWL_EEPROM_ACCESS_DELAY) { 1565 i += IWL_EEPROM_ACCESS_DELAY) {
1566 r = _iwl_read_direct32(priv, CSR_EEPROM_REG); 1566 r = _iwl3945_read_direct32(priv, CSR_EEPROM_REG);
1567 if (r & CSR_EEPROM_REG_READ_VALID_MSK) 1567 if (r & CSR_EEPROM_REG_READ_VALID_MSK)
1568 break; 1568 break;
1569 udelay(IWL_EEPROM_ACCESS_DELAY); 1569 udelay(IWL_EEPROM_ACCESS_DELAY);
@@ -1587,19 +1587,19 @@ int iwl_eeprom_init(struct iwl_priv *priv)
1587#ifdef CONFIG_IWL3945_DEBUG 1587#ifdef CONFIG_IWL3945_DEBUG
1588 1588
1589/** 1589/**
1590 * iwl_report_frame - dump frame to syslog during debug sessions 1590 * iwl3945_report_frame - dump frame to syslog during debug sessions
1591 * 1591 *
1592 * hack this function to show different aspects of received frames, 1592 * hack this function to show different aspects of received frames,
1593 * including selective frame dumps. 1593 * including selective frame dumps.
1594 * group100 parameter selects whether to show 1 out of 100 good frames. 1594 * group100 parameter selects whether to show 1 out of 100 good frames.
1595 * 1595 *
1596 * TODO: ieee80211_hdr stuff is common to 3945 and 4965, so frame type 1596 * TODO: ieee80211_hdr stuff is common to 3945 and 4965, so frame type
1597 * info output is okay, but some of this stuff (e.g. iwl_rx_frame_stats) 1597 * info output is okay, but some of this stuff (e.g. iwl3945_rx_frame_stats)
1598 * is 3945-specific and gives bad output for 4965. Need to split the 1598 * is 3945-specific and gives bad output for 4965. Need to split the
1599 * functionality, keep common stuff here. 1599 * functionality, keep common stuff here.
1600 */ 1600 */
1601void iwl_report_frame(struct iwl_priv *priv, 1601void iwl3945_report_frame(struct iwl3945_priv *priv,
1602 struct iwl_rx_packet *pkt, 1602 struct iwl3945_rx_packet *pkt,
1603 struct ieee80211_hdr *header, int group100) 1603 struct ieee80211_hdr *header, int group100)
1604{ 1604{
1605 u32 to_us; 1605 u32 to_us;
@@ -1621,9 +1621,9 @@ void iwl_report_frame(struct iwl_priv *priv,
1621 u8 agc; 1621 u8 agc;
1622 u16 sig_avg; 1622 u16 sig_avg;
1623 u16 noise_diff; 1623 u16 noise_diff;
1624 struct iwl_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt); 1624 struct iwl3945_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt);
1625 struct iwl_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); 1625 struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
1626 struct iwl_rx_frame_end *rx_end = IWL_RX_END(pkt); 1626 struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt);
1627 u8 *data = IWL_RX_DATA(pkt); 1627 u8 *data = IWL_RX_DATA(pkt);
1628 1628
1629 /* MAC header */ 1629 /* MAC header */
@@ -1699,11 +1699,11 @@ void iwl_report_frame(struct iwl_priv *priv,
1699 else 1699 else
1700 title = "Frame"; 1700 title = "Frame";
1701 1701
1702 rate = iwl_rate_index_from_plcp(rate_sym); 1702 rate = iwl3945_rate_index_from_plcp(rate_sym);
1703 if (rate == -1) 1703 if (rate == -1)
1704 rate = 0; 1704 rate = 0;
1705 else 1705 else
1706 rate = iwl_rates[rate].ieee / 2; 1706 rate = iwl3945_rates[rate].ieee / 2;
1707 1707
1708 /* print frame summary. 1708 /* print frame summary.
1709 * MAC addresses show just the last byte (for brevity), 1709 * MAC addresses show just the last byte (for brevity),
@@ -1725,25 +1725,25 @@ void iwl_report_frame(struct iwl_priv *priv,
1725 } 1725 }
1726 } 1726 }
1727 if (print_dump) 1727 if (print_dump)
1728 iwl_print_hex_dump(IWL_DL_RX, data, length); 1728 iwl3945_print_hex_dump(IWL_DL_RX, data, length);
1729} 1729}
1730#endif 1730#endif
1731 1731
1732static void iwl_unset_hw_setting(struct iwl_priv *priv) 1732static void iwl3945_unset_hw_setting(struct iwl3945_priv *priv)
1733{ 1733{
1734 if (priv->hw_setting.shared_virt) 1734 if (priv->hw_setting.shared_virt)
1735 pci_free_consistent(priv->pci_dev, 1735 pci_free_consistent(priv->pci_dev,
1736 sizeof(struct iwl_shared), 1736 sizeof(struct iwl3945_shared),
1737 priv->hw_setting.shared_virt, 1737 priv->hw_setting.shared_virt,
1738 priv->hw_setting.shared_phys); 1738 priv->hw_setting.shared_phys);
1739} 1739}
1740 1740
1741/** 1741/**
1742 * iwl_supported_rate_to_ie - fill in the supported rate in IE field 1742 * iwl3945_supported_rate_to_ie - fill in the supported rate in IE field
1743 * 1743 *
1744 * return : set the bit for each supported rate insert in ie 1744 * return : set the bit for each supported rate insert in ie
1745 */ 1745 */
1746static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, 1746static u16 iwl3945_supported_rate_to_ie(u8 *ie, u16 supported_rate,
1747 u16 basic_rate, int *left) 1747 u16 basic_rate, int *left)
1748{ 1748{
1749 u16 ret_rates = 0, bit; 1749 u16 ret_rates = 0, bit;
@@ -1754,7 +1754,7 @@ static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate,
1754 for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { 1754 for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) {
1755 if (bit & supported_rate) { 1755 if (bit & supported_rate) {
1756 ret_rates |= bit; 1756 ret_rates |= bit;
1757 rates[*cnt] = iwl_rates[i].ieee | 1757 rates[*cnt] = iwl3945_rates[i].ieee |
1758 ((bit & basic_rate) ? 0x80 : 0x00); 1758 ((bit & basic_rate) ? 0x80 : 0x00);
1759 (*cnt)++; 1759 (*cnt)++;
1760 (*left)--; 1760 (*left)--;
@@ -1768,9 +1768,9 @@ static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate,
1768} 1768}
1769 1769
1770/** 1770/**
1771 * iwl_fill_probe_req - fill in all required fields and IE for probe request 1771 * iwl3945_fill_probe_req - fill in all required fields and IE for probe request
1772 */ 1772 */
1773static u16 iwl_fill_probe_req(struct iwl_priv *priv, 1773static u16 iwl3945_fill_probe_req(struct iwl3945_priv *priv,
1774 struct ieee80211_mgmt *frame, 1774 struct ieee80211_mgmt *frame,
1775 int left, int is_direct) 1775 int left, int is_direct)
1776{ 1776{
@@ -1786,9 +1786,9 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1786 len += 24; 1786 len += 24;
1787 1787
1788 frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); 1788 frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
1789 memcpy(frame->da, BROADCAST_ADDR, ETH_ALEN); 1789 memcpy(frame->da, iwl3945_broadcast_addr, ETH_ALEN);
1790 memcpy(frame->sa, priv->mac_addr, ETH_ALEN); 1790 memcpy(frame->sa, priv->mac_addr, ETH_ALEN);
1791 memcpy(frame->bssid, BROADCAST_ADDR, ETH_ALEN); 1791 memcpy(frame->bssid, iwl3945_broadcast_addr, ETH_ALEN);
1792 frame->seq_ctrl = 0; 1792 frame->seq_ctrl = 0;
1793 1793
1794 /* fill in our indirect SSID IE */ 1794 /* fill in our indirect SSID IE */
@@ -1831,11 +1831,11 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1831 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; 1831 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
1832 1832
1833 cck_rates = IWL_CCK_RATES_MASK & active_rates; 1833 cck_rates = IWL_CCK_RATES_MASK & active_rates;
1834 ret_rates = iwl_supported_rate_to_ie(pos, cck_rates, 1834 ret_rates = iwl3945_supported_rate_to_ie(pos, cck_rates,
1835 priv->active_rate_basic, &left); 1835 priv->active_rate_basic, &left);
1836 active_rates &= ~ret_rates; 1836 active_rates &= ~ret_rates;
1837 1837
1838 ret_rates = iwl_supported_rate_to_ie(pos, active_rates, 1838 ret_rates = iwl3945_supported_rate_to_ie(pos, active_rates,
1839 priv->active_rate_basic, &left); 1839 priv->active_rate_basic, &left);
1840 active_rates &= ~ret_rates; 1840 active_rates &= ~ret_rates;
1841 1841
@@ -1852,7 +1852,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1852 /* ... fill it in... */ 1852 /* ... fill it in... */
1853 *pos++ = WLAN_EID_EXT_SUPP_RATES; 1853 *pos++ = WLAN_EID_EXT_SUPP_RATES;
1854 *pos = 0; 1854 *pos = 0;
1855 iwl_supported_rate_to_ie(pos, active_rates, 1855 iwl3945_supported_rate_to_ie(pos, active_rates,
1856 priv->active_rate_basic, &left); 1856 priv->active_rate_basic, &left);
1857 if (*pos > 0) 1857 if (*pos > 0)
1858 len += 2 + *pos; 1858 len += 2 + *pos;
@@ -1865,15 +1865,15 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1865 * QoS support 1865 * QoS support
1866*/ 1866*/
1867#ifdef CONFIG_IWL3945_QOS 1867#ifdef CONFIG_IWL3945_QOS
1868static int iwl_send_qos_params_command(struct iwl_priv *priv, 1868static int iwl3945_send_qos_params_command(struct iwl3945_priv *priv,
1869 struct iwl_qosparam_cmd *qos) 1869 struct iwl3945_qosparam_cmd *qos)
1870{ 1870{
1871 1871
1872 return iwl_send_cmd_pdu(priv, REPLY_QOS_PARAM, 1872 return iwl3945_send_cmd_pdu(priv, REPLY_QOS_PARAM,
1873 sizeof(struct iwl_qosparam_cmd), qos); 1873 sizeof(struct iwl3945_qosparam_cmd), qos);
1874} 1874}
1875 1875
1876static void iwl_reset_qos(struct iwl_priv *priv) 1876static void iwl3945_reset_qos(struct iwl3945_priv *priv)
1877{ 1877{
1878 u16 cw_min = 15; 1878 u16 cw_min = 15;
1879 u16 cw_max = 1023; 1879 u16 cw_max = 1023;
@@ -1960,7 +1960,7 @@ static void iwl_reset_qos(struct iwl_priv *priv)
1960 spin_unlock_irqrestore(&priv->lock, flags); 1960 spin_unlock_irqrestore(&priv->lock, flags);
1961} 1961}
1962 1962
1963static void iwl_activate_qos(struct iwl_priv *priv, u8 force) 1963static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force)
1964{ 1964{
1965 unsigned long flags; 1965 unsigned long flags;
1966 1966
@@ -1984,11 +1984,11 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force)
1984 1984
1985 spin_unlock_irqrestore(&priv->lock, flags); 1985 spin_unlock_irqrestore(&priv->lock, flags);
1986 1986
1987 if (force || iwl_is_associated(priv)) { 1987 if (force || iwl3945_is_associated(priv)) {
1988 IWL_DEBUG_QOS("send QoS cmd with Qos active %d \n", 1988 IWL_DEBUG_QOS("send QoS cmd with Qos active %d \n",
1989 priv->qos_data.qos_active); 1989 priv->qos_data.qos_active);
1990 1990
1991 iwl_send_qos_params_command(priv, 1991 iwl3945_send_qos_params_command(priv,
1992 &(priv->qos_data.def_qos_parm)); 1992 &(priv->qos_data.def_qos_parm));
1993 } 1993 }
1994} 1994}
@@ -2011,7 +2011,7 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force)
2011 2011
2012/* default power management (not Tx power) table values */ 2012/* default power management (not Tx power) table values */
2013/* for tim 0-10 */ 2013/* for tim 0-10 */
2014static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = { 2014static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = {
2015 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 2015 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
2016 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, 2016 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0},
2017 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 7)}, 0}, 2017 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 7)}, 0},
@@ -2021,7 +2021,7 @@ static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = {
2021}; 2021};
2022 2022
2023/* for tim > 10 */ 2023/* for tim > 10 */
2024static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = { 2024static struct iwl3945_power_vec_entry range_1[IWL_POWER_AC] = {
2025 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 2025 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
2026 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), 2026 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500),
2027 SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, 2027 SLP_VEC(1, 2, 3, 4, 0xFF)}, 0},
@@ -2034,11 +2034,11 @@ static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = {
2034 SLP_VEC(4, 7, 10, 10, 0xFF)}, 0} 2034 SLP_VEC(4, 7, 10, 10, 0xFF)}, 0}
2035}; 2035};
2036 2036
2037int iwl_power_init_handle(struct iwl_priv *priv) 2037int iwl3945_power_init_handle(struct iwl3945_priv *priv)
2038{ 2038{
2039 int rc = 0, i; 2039 int rc = 0, i;
2040 struct iwl_power_mgr *pow_data; 2040 struct iwl3945_power_mgr *pow_data;
2041 int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_AC; 2041 int size = sizeof(struct iwl3945_power_vec_entry) * IWL_POWER_AC;
2042 u16 pci_pm; 2042 u16 pci_pm;
2043 2043
2044 IWL_DEBUG_POWER("Initialize power \n"); 2044 IWL_DEBUG_POWER("Initialize power \n");
@@ -2057,7 +2057,7 @@ int iwl_power_init_handle(struct iwl_priv *priv)
2057 if (rc != 0) 2057 if (rc != 0)
2058 return 0; 2058 return 0;
2059 else { 2059 else {
2060 struct iwl_powertable_cmd *cmd; 2060 struct iwl3945_powertable_cmd *cmd;
2061 2061
2062 IWL_DEBUG_POWER("adjust power command flags\n"); 2062 IWL_DEBUG_POWER("adjust power command flags\n");
2063 2063
@@ -2073,15 +2073,15 @@ int iwl_power_init_handle(struct iwl_priv *priv)
2073 return rc; 2073 return rc;
2074} 2074}
2075 2075
2076static int iwl_update_power_cmd(struct iwl_priv *priv, 2076static int iwl3945_update_power_cmd(struct iwl3945_priv *priv,
2077 struct iwl_powertable_cmd *cmd, u32 mode) 2077 struct iwl3945_powertable_cmd *cmd, u32 mode)
2078{ 2078{
2079 int rc = 0, i; 2079 int rc = 0, i;
2080 u8 skip; 2080 u8 skip;
2081 u32 max_sleep = 0; 2081 u32 max_sleep = 0;
2082 struct iwl_power_vec_entry *range; 2082 struct iwl3945_power_vec_entry *range;
2083 u8 period = 0; 2083 u8 period = 0;
2084 struct iwl_power_mgr *pow_data; 2084 struct iwl3945_power_mgr *pow_data;
2085 2085
2086 if (mode > IWL_POWER_INDEX_5) { 2086 if (mode > IWL_POWER_INDEX_5) {
2087 IWL_DEBUG_POWER("Error invalid power mode \n"); 2087 IWL_DEBUG_POWER("Error invalid power mode \n");
@@ -2094,7 +2094,7 @@ static int iwl_update_power_cmd(struct iwl_priv *priv,
2094 else 2094 else
2095 range = &pow_data->pwr_range_1[1]; 2095 range = &pow_data->pwr_range_1[1];
2096 2096
2097 memcpy(cmd, &range[mode].cmd, sizeof(struct iwl_powertable_cmd)); 2097 memcpy(cmd, &range[mode].cmd, sizeof(struct iwl3945_powertable_cmd));
2098 2098
2099#ifdef IWL_MAC80211_DISABLE 2099#ifdef IWL_MAC80211_DISABLE
2100 if (priv->assoc_network != NULL) { 2100 if (priv->assoc_network != NULL) {
@@ -2137,11 +2137,11 @@ static int iwl_update_power_cmd(struct iwl_priv *priv,
2137 return rc; 2137 return rc;
2138} 2138}
2139 2139
2140static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode) 2140static int iwl3945_send_power_mode(struct iwl3945_priv *priv, u32 mode)
2141{ 2141{
2142 u32 final_mode = mode; 2142 u32 final_mode = mode;
2143 int rc; 2143 int rc;
2144 struct iwl_powertable_cmd cmd; 2144 struct iwl3945_powertable_cmd cmd;
2145 2145
2146 /* If on battery, set to 3, 2146 /* If on battery, set to 3,
2147 * if plugged into AC power, set to CAM ("continuously aware mode"), 2147 * if plugged into AC power, set to CAM ("continuously aware mode"),
@@ -2158,9 +2158,9 @@ static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode)
2158 break; 2158 break;
2159 } 2159 }
2160 2160
2161 iwl_update_power_cmd(priv, &cmd, final_mode); 2161 iwl3945_update_power_cmd(priv, &cmd, final_mode);
2162 2162
2163 rc = iwl_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd); 2163 rc = iwl3945_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd);
2164 2164
2165 if (final_mode == IWL_POWER_MODE_CAM) 2165 if (final_mode == IWL_POWER_MODE_CAM)
2166 clear_bit(STATUS_POWER_PMI, &priv->status); 2166 clear_bit(STATUS_POWER_PMI, &priv->status);
@@ -2170,7 +2170,7 @@ static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode)
2170 return rc; 2170 return rc;
2171} 2171}
2172 2172
2173int iwl_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) 2173int iwl3945_is_network_packet(struct iwl3945_priv *priv, struct ieee80211_hdr *header)
2174{ 2174{
2175 /* Filter incoming packets to determine if they are targeted toward 2175 /* Filter incoming packets to determine if they are targeted toward
2176 * this network, discarding packets coming from ourselves */ 2176 * this network, discarding packets coming from ourselves */
@@ -2200,7 +2200,7 @@ int iwl_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *header)
2200 2200
2201#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x 2201#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x
2202 2202
2203static const char *iwl_get_tx_fail_reason(u32 status) 2203static const char *iwl3945_get_tx_fail_reason(u32 status)
2204{ 2204{
2205 switch (status & TX_STATUS_MSK) { 2205 switch (status & TX_STATUS_MSK) {
2206 case TX_STATUS_SUCCESS: 2206 case TX_STATUS_SUCCESS:
@@ -2227,11 +2227,11 @@ static const char *iwl_get_tx_fail_reason(u32 status)
2227} 2227}
2228 2228
2229/** 2229/**
2230 * iwl_scan_cancel - Cancel any currently executing HW scan 2230 * iwl3945_scan_cancel - Cancel any currently executing HW scan
2231 * 2231 *
2232 * NOTE: priv->mutex is not required before calling this function 2232 * NOTE: priv->mutex is not required before calling this function
2233 */ 2233 */
2234static int iwl_scan_cancel(struct iwl_priv *priv) 2234static int iwl3945_scan_cancel(struct iwl3945_priv *priv)
2235{ 2235{
2236 if (!test_bit(STATUS_SCAN_HW, &priv->status)) { 2236 if (!test_bit(STATUS_SCAN_HW, &priv->status)) {
2237 clear_bit(STATUS_SCANNING, &priv->status); 2237 clear_bit(STATUS_SCANNING, &priv->status);
@@ -2254,17 +2254,17 @@ static int iwl_scan_cancel(struct iwl_priv *priv)
2254} 2254}
2255 2255
2256/** 2256/**
2257 * iwl_scan_cancel_timeout - Cancel any currently executing HW scan 2257 * iwl3945_scan_cancel_timeout - Cancel any currently executing HW scan
2258 * @ms: amount of time to wait (in milliseconds) for scan to abort 2258 * @ms: amount of time to wait (in milliseconds) for scan to abort
2259 * 2259 *
2260 * NOTE: priv->mutex must be held before calling this function 2260 * NOTE: priv->mutex must be held before calling this function
2261 */ 2261 */
2262static int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) 2262static int iwl3945_scan_cancel_timeout(struct iwl3945_priv *priv, unsigned long ms)
2263{ 2263{
2264 unsigned long now = jiffies; 2264 unsigned long now = jiffies;
2265 int ret; 2265 int ret;
2266 2266
2267 ret = iwl_scan_cancel(priv); 2267 ret = iwl3945_scan_cancel(priv);
2268 if (ret && ms) { 2268 if (ret && ms) {
2269 mutex_unlock(&priv->mutex); 2269 mutex_unlock(&priv->mutex);
2270 while (!time_after(jiffies, now + msecs_to_jiffies(ms)) && 2270 while (!time_after(jiffies, now + msecs_to_jiffies(ms)) &&
@@ -2278,7 +2278,7 @@ static int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)
2278 return ret; 2278 return ret;
2279} 2279}
2280 2280
2281static void iwl_sequence_reset(struct iwl_priv *priv) 2281static void iwl3945_sequence_reset(struct iwl3945_priv *priv)
2282{ 2282{
2283 /* Reset ieee stats */ 2283 /* Reset ieee stats */
2284 2284
@@ -2289,13 +2289,13 @@ static void iwl_sequence_reset(struct iwl_priv *priv)
2289 priv->last_frag_num = -1; 2289 priv->last_frag_num = -1;
2290 priv->last_packet_time = 0; 2290 priv->last_packet_time = 0;
2291 2291
2292 iwl_scan_cancel(priv); 2292 iwl3945_scan_cancel(priv);
2293} 2293}
2294 2294
2295#define MAX_UCODE_BEACON_INTERVAL 1024 2295#define MAX_UCODE_BEACON_INTERVAL 1024
2296#define INTEL_CONN_LISTEN_INTERVAL __constant_cpu_to_le16(0xA) 2296#define INTEL_CONN_LISTEN_INTERVAL __constant_cpu_to_le16(0xA)
2297 2297
2298static __le16 iwl_adjust_beacon_interval(u16 beacon_val) 2298static __le16 iwl3945_adjust_beacon_interval(u16 beacon_val)
2299{ 2299{
2300 u16 new_val = 0; 2300 u16 new_val = 0;
2301 u16 beacon_factor = 0; 2301 u16 beacon_factor = 0;
@@ -2308,7 +2308,7 @@ static __le16 iwl_adjust_beacon_interval(u16 beacon_val)
2308 return cpu_to_le16(new_val); 2308 return cpu_to_le16(new_val);
2309} 2309}
2310 2310
2311static void iwl_setup_rxon_timing(struct iwl_priv *priv) 2311static void iwl3945_setup_rxon_timing(struct iwl3945_priv *priv)
2312{ 2312{
2313 u64 interval_tm_unit; 2313 u64 interval_tm_unit;
2314 u64 tsf, result; 2314 u64 tsf, result;
@@ -2338,14 +2338,14 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv)
2338 priv->rxon_timing.beacon_interval = 2338 priv->rxon_timing.beacon_interval =
2339 cpu_to_le16(beacon_int); 2339 cpu_to_le16(beacon_int);
2340 priv->rxon_timing.beacon_interval = 2340 priv->rxon_timing.beacon_interval =
2341 iwl_adjust_beacon_interval( 2341 iwl3945_adjust_beacon_interval(
2342 le16_to_cpu(priv->rxon_timing.beacon_interval)); 2342 le16_to_cpu(priv->rxon_timing.beacon_interval));
2343 } 2343 }
2344 2344
2345 priv->rxon_timing.atim_window = 0; 2345 priv->rxon_timing.atim_window = 0;
2346 } else { 2346 } else {
2347 priv->rxon_timing.beacon_interval = 2347 priv->rxon_timing.beacon_interval =
2348 iwl_adjust_beacon_interval(conf->beacon_int); 2348 iwl3945_adjust_beacon_interval(conf->beacon_int);
2349 /* TODO: we need to get atim_window from upper stack 2349 /* TODO: we need to get atim_window from upper stack
2350 * for now we set to 0 */ 2350 * for now we set to 0 */
2351 priv->rxon_timing.atim_window = 0; 2351 priv->rxon_timing.atim_window = 0;
@@ -2364,14 +2364,14 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv)
2364 le16_to_cpu(priv->rxon_timing.atim_window)); 2364 le16_to_cpu(priv->rxon_timing.atim_window));
2365} 2365}
2366 2366
2367static int iwl_scan_initiate(struct iwl_priv *priv) 2367static int iwl3945_scan_initiate(struct iwl3945_priv *priv)
2368{ 2368{
2369 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { 2369 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) {
2370 IWL_ERROR("APs don't scan.\n"); 2370 IWL_ERROR("APs don't scan.\n");
2371 return 0; 2371 return 0;
2372 } 2372 }
2373 2373
2374 if (!iwl_is_ready_rf(priv)) { 2374 if (!iwl3945_is_ready_rf(priv)) {
2375 IWL_DEBUG_SCAN("Aborting scan due to not ready.\n"); 2375 IWL_DEBUG_SCAN("Aborting scan due to not ready.\n");
2376 return -EIO; 2376 return -EIO;
2377 } 2377 }
@@ -2398,9 +2398,9 @@ static int iwl_scan_initiate(struct iwl_priv *priv)
2398 return 0; 2398 return 0;
2399} 2399}
2400 2400
2401static int iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) 2401static int iwl3945_set_rxon_hwcrypto(struct iwl3945_priv *priv, int hw_decrypt)
2402{ 2402{
2403 struct iwl_rxon_cmd *rxon = &priv->staging_rxon; 2403 struct iwl3945_rxon_cmd *rxon = &priv->staging_rxon;
2404 2404
2405 if (hw_decrypt) 2405 if (hw_decrypt)
2406 rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; 2406 rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK;
@@ -2410,7 +2410,7 @@ static int iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt)
2410 return 0; 2410 return 0;
2411} 2411}
2412 2412
2413static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode) 2413static void iwl3945_set_flags_for_phymode(struct iwl3945_priv *priv, u8 phymode)
2414{ 2414{
2415 if (phymode == MODE_IEEE80211A) { 2415 if (phymode == MODE_IEEE80211A) {
2416 priv->staging_rxon.flags &= 2416 priv->staging_rxon.flags &=
@@ -2418,7 +2418,7 @@ static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode)
2418 | RXON_FLG_CCK_MSK); 2418 | RXON_FLG_CCK_MSK);
2419 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; 2419 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
2420 } else { 2420 } else {
2421 /* Copied from iwl_bg_post_associate() */ 2421 /* Copied from iwl3945_bg_post_associate() */
2422 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) 2422 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
2423 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; 2423 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
2424 else 2424 else
@@ -2436,9 +2436,9 @@ static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode)
2436/* 2436/*
2437 * initialize rxon structure with default values from eeprom 2437 * initialize rxon structure with default values from eeprom
2438 */ 2438 */
2439static void iwl_connection_init_rx_config(struct iwl_priv *priv) 2439static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv)
2440{ 2440{
2441 const struct iwl_channel_info *ch_info; 2441 const struct iwl3945_channel_info *ch_info;
2442 2442
2443 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); 2443 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon));
2444 2444
@@ -2475,7 +2475,7 @@ static void iwl_connection_init_rx_config(struct iwl_priv *priv)
2475 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 2475 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
2476#endif 2476#endif
2477 2477
2478 ch_info = iwl_get_channel_info(priv, priv->phymode, 2478 ch_info = iwl3945_get_channel_info(priv, priv->phymode,
2479 le16_to_cpu(priv->staging_rxon.channel)); 2479 le16_to_cpu(priv->staging_rxon.channel));
2480 2480
2481 if (!ch_info) 2481 if (!ch_info)
@@ -2495,7 +2495,7 @@ static void iwl_connection_init_rx_config(struct iwl_priv *priv)
2495 else 2495 else
2496 priv->phymode = MODE_IEEE80211G; 2496 priv->phymode = MODE_IEEE80211G;
2497 2497
2498 iwl_set_flags_for_phymode(priv, priv->phymode); 2498 iwl3945_set_flags_for_phymode(priv, priv->phymode);
2499 2499
2500 priv->staging_rxon.ofdm_basic_rates = 2500 priv->staging_rxon.ofdm_basic_rates =
2501 (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; 2501 (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
@@ -2503,15 +2503,15 @@ static void iwl_connection_init_rx_config(struct iwl_priv *priv)
2503 (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF; 2503 (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
2504} 2504}
2505 2505
2506static int iwl_set_mode(struct iwl_priv *priv, int mode) 2506static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode)
2507{ 2507{
2508 if (!iwl_is_ready_rf(priv)) 2508 if (!iwl3945_is_ready_rf(priv))
2509 return -EAGAIN; 2509 return -EAGAIN;
2510 2510
2511 if (mode == IEEE80211_IF_TYPE_IBSS) { 2511 if (mode == IEEE80211_IF_TYPE_IBSS) {
2512 const struct iwl_channel_info *ch_info; 2512 const struct iwl3945_channel_info *ch_info;
2513 2513
2514 ch_info = iwl_get_channel_info(priv, 2514 ch_info = iwl3945_get_channel_info(priv,
2515 priv->phymode, 2515 priv->phymode,
2516 le16_to_cpu(priv->staging_rxon.channel)); 2516 le16_to_cpu(priv->staging_rxon.channel));
2517 2517
@@ -2523,7 +2523,7 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode)
2523 } 2523 }
2524 2524
2525 cancel_delayed_work(&priv->scan_check); 2525 cancel_delayed_work(&priv->scan_check);
2526 if (iwl_scan_cancel_timeout(priv, 100)) { 2526 if (iwl3945_scan_cancel_timeout(priv, 100)) {
2527 IWL_WARNING("Aborted scan still in progress after 100ms\n"); 2527 IWL_WARNING("Aborted scan still in progress after 100ms\n");
2528 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); 2528 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n");
2529 return -EAGAIN; 2529 return -EAGAIN;
@@ -2531,23 +2531,23 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode)
2531 2531
2532 priv->iw_mode = mode; 2532 priv->iw_mode = mode;
2533 2533
2534 iwl_connection_init_rx_config(priv); 2534 iwl3945_connection_init_rx_config(priv);
2535 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); 2535 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
2536 2536
2537 iwl_clear_stations_table(priv); 2537 iwl3945_clear_stations_table(priv);
2538 2538
2539 iwl_commit_rxon(priv); 2539 iwl3945_commit_rxon(priv);
2540 2540
2541 return 0; 2541 return 0;
2542} 2542}
2543 2543
2544static void iwl_build_tx_cmd_hwcrypto(struct iwl_priv *priv, 2544static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
2545 struct ieee80211_tx_control *ctl, 2545 struct ieee80211_tx_control *ctl,
2546 struct iwl_cmd *cmd, 2546 struct iwl3945_cmd *cmd,
2547 struct sk_buff *skb_frag, 2547 struct sk_buff *skb_frag,
2548 int last_frag) 2548 int last_frag)
2549{ 2549{
2550 struct iwl_hw_key *keyinfo = &priv->stations[ctl->key_idx].keyinfo; 2550 struct iwl3945_hw_key *keyinfo = &priv->stations[ctl->key_idx].keyinfo;
2551 2551
2552 switch (keyinfo->alg) { 2552 switch (keyinfo->alg) {
2553 case ALG_CCMP: 2553 case ALG_CCMP:
@@ -2590,8 +2590,8 @@ static void iwl_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
2590/* 2590/*
2591 * handle build REPLY_TX command notification. 2591 * handle build REPLY_TX command notification.
2592 */ 2592 */
2593static void iwl_build_tx_cmd_basic(struct iwl_priv *priv, 2593static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
2594 struct iwl_cmd *cmd, 2594 struct iwl3945_cmd *cmd,
2595 struct ieee80211_tx_control *ctrl, 2595 struct ieee80211_tx_control *ctrl,
2596 struct ieee80211_hdr *hdr, 2596 struct ieee80211_hdr *hdr,
2597 int is_unicast, u8 std_id) 2597 int is_unicast, u8 std_id)
@@ -2650,7 +2650,7 @@ static void iwl_build_tx_cmd_basic(struct iwl_priv *priv,
2650 cmd->cmd.tx.next_frame_len = 0; 2650 cmd->cmd.tx.next_frame_len = 0;
2651} 2651}
2652 2652
2653static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) 2653static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *hdr)
2654{ 2654{
2655 int sta_id; 2655 int sta_id;
2656 u16 fc = le16_to_cpu(hdr->frame_control); 2656 u16 fc = le16_to_cpu(hdr->frame_control);
@@ -2670,7 +2670,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
2670 2670
2671 /* If we are an AP, then find the station, or use BCAST */ 2671 /* If we are an AP, then find the station, or use BCAST */
2672 case IEEE80211_IF_TYPE_AP: 2672 case IEEE80211_IF_TYPE_AP:
2673 sta_id = iwl_hw_find_station(priv, hdr->addr1); 2673 sta_id = iwl3945_hw_find_station(priv, hdr->addr1);
2674 if (sta_id != IWL_INVALID_STATION) 2674 if (sta_id != IWL_INVALID_STATION)
2675 return sta_id; 2675 return sta_id;
2676 return priv->hw_setting.bcast_sta_id; 2676 return priv->hw_setting.bcast_sta_id;
@@ -2680,11 +2680,11 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
2680 case IEEE80211_IF_TYPE_IBSS: { 2680 case IEEE80211_IF_TYPE_IBSS: {
2681 DECLARE_MAC_BUF(mac); 2681 DECLARE_MAC_BUF(mac);
2682 2682
2683 sta_id = iwl_hw_find_station(priv, hdr->addr1); 2683 sta_id = iwl3945_hw_find_station(priv, hdr->addr1);
2684 if (sta_id != IWL_INVALID_STATION) 2684 if (sta_id != IWL_INVALID_STATION)
2685 return sta_id; 2685 return sta_id;
2686 2686
2687 sta_id = iwl_add_station(priv, hdr->addr1, 0, CMD_ASYNC); 2687 sta_id = iwl3945_add_station(priv, hdr->addr1, 0, CMD_ASYNC);
2688 2688
2689 if (sta_id != IWL_INVALID_STATION) 2689 if (sta_id != IWL_INVALID_STATION)
2690 return sta_id; 2690 return sta_id;
@@ -2692,7 +2692,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
2692 IWL_DEBUG_DROP("Station %s not in station map. " 2692 IWL_DEBUG_DROP("Station %s not in station map. "
2693 "Defaulting to broadcast...\n", 2693 "Defaulting to broadcast...\n",
2694 print_mac(mac, hdr->addr1)); 2694 print_mac(mac, hdr->addr1));
2695 iwl_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); 2695 iwl3945_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr));
2696 return priv->hw_setting.bcast_sta_id; 2696 return priv->hw_setting.bcast_sta_id;
2697 } 2697 }
2698 default: 2698 default:
@@ -2704,18 +2704,18 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
2704/* 2704/*
2705 * start REPLY_TX command process 2705 * start REPLY_TX command process
2706 */ 2706 */
2707static int iwl_tx_skb(struct iwl_priv *priv, 2707static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2708 struct sk_buff *skb, struct ieee80211_tx_control *ctl) 2708 struct sk_buff *skb, struct ieee80211_tx_control *ctl)
2709{ 2709{
2710 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 2710 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2711 struct iwl_tfd_frame *tfd; 2711 struct iwl3945_tfd_frame *tfd;
2712 u32 *control_flags; 2712 u32 *control_flags;
2713 int txq_id = ctl->queue; 2713 int txq_id = ctl->queue;
2714 struct iwl_tx_queue *txq = NULL; 2714 struct iwl3945_tx_queue *txq = NULL;
2715 struct iwl_queue *q = NULL; 2715 struct iwl3945_queue *q = NULL;
2716 dma_addr_t phys_addr; 2716 dma_addr_t phys_addr;
2717 dma_addr_t txcmd_phys; 2717 dma_addr_t txcmd_phys;
2718 struct iwl_cmd *out_cmd = NULL; 2718 struct iwl3945_cmd *out_cmd = NULL;
2719 u16 len, idx, len_org; 2719 u16 len, idx, len_org;
2720 u8 id, hdr_len, unicast; 2720 u8 id, hdr_len, unicast;
2721 u8 sta_id; 2721 u8 sta_id;
@@ -2727,7 +2727,7 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2727 int rc; 2727 int rc;
2728 2728
2729 spin_lock_irqsave(&priv->lock, flags); 2729 spin_lock_irqsave(&priv->lock, flags);
2730 if (iwl_is_rfkill(priv)) { 2730 if (iwl3945_is_rfkill(priv)) {
2731 IWL_DEBUG_DROP("Dropping - RF KILL\n"); 2731 IWL_DEBUG_DROP("Dropping - RF KILL\n");
2732 goto drop_unlock; 2732 goto drop_unlock;
2733 } 2733 }
@@ -2756,16 +2756,16 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2756 IWL_DEBUG_TX("Sending REASSOC frame\n"); 2756 IWL_DEBUG_TX("Sending REASSOC frame\n");
2757#endif 2757#endif
2758 2758
2759 if (!iwl_is_associated(priv) && 2759 if (!iwl3945_is_associated(priv) &&
2760 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { 2760 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) {
2761 IWL_DEBUG_DROP("Dropping - !iwl_is_associated\n"); 2761 IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n");
2762 goto drop_unlock; 2762 goto drop_unlock;
2763 } 2763 }
2764 2764
2765 spin_unlock_irqrestore(&priv->lock, flags); 2765 spin_unlock_irqrestore(&priv->lock, flags);
2766 2766
2767 hdr_len = ieee80211_get_hdrlen(fc); 2767 hdr_len = ieee80211_get_hdrlen(fc);
2768 sta_id = iwl_get_sta_id(priv, hdr); 2768 sta_id = iwl3945_get_sta_id(priv, hdr);
2769 if (sta_id == IWL_INVALID_STATION) { 2769 if (sta_id == IWL_INVALID_STATION) {
2770 DECLARE_MAC_BUF(mac); 2770 DECLARE_MAC_BUF(mac);
2771 2771
@@ -2796,7 +2796,7 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2796 control_flags = (u32 *) tfd; 2796 control_flags = (u32 *) tfd;
2797 idx = get_cmd_index(q, q->write_ptr, 0); 2797 idx = get_cmd_index(q, q->write_ptr, 0);
2798 2798
2799 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); 2799 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl3945_tx_info));
2800 txq->txb[q->write_ptr].skb[0] = skb; 2800 txq->txb[q->write_ptr].skb[0] = skb;
2801 memcpy(&(txq->txb[q->write_ptr].status.control), 2801 memcpy(&(txq->txb[q->write_ptr].status.control),
2802 ctl, sizeof(struct ieee80211_tx_control)); 2802 ctl, sizeof(struct ieee80211_tx_control));
@@ -2811,7 +2811,7 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2811 2811
2812 /* hdr = (struct ieee80211_hdr *)out_cmd->cmd.tx.hdr; */ 2812 /* hdr = (struct ieee80211_hdr *)out_cmd->cmd.tx.hdr; */
2813 len = priv->hw_setting.tx_cmd_len + 2813 len = priv->hw_setting.tx_cmd_len +
2814 sizeof(struct iwl_cmd_header) + hdr_len; 2814 sizeof(struct iwl3945_cmd_header) + hdr_len;
2815 2815
2816 len_org = len; 2816 len_org = len;
2817 len = (len + 3) & ~3; 2817 len = (len + 3) & ~3;
@@ -2821,20 +2821,20 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2821 else 2821 else
2822 len_org = 0; 2822 len_org = 0;
2823 2823
2824 txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl_cmd) * idx + 2824 txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl3945_cmd) * idx +
2825 offsetof(struct iwl_cmd, hdr); 2825 offsetof(struct iwl3945_cmd, hdr);
2826 2826
2827 iwl_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); 2827 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len);
2828 2828
2829 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) 2829 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT))
2830 iwl_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0); 2830 iwl3945_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0);
2831 2831
2832 /* 802.11 null functions have no payload... */ 2832 /* 802.11 null functions have no payload... */
2833 len = skb->len - hdr_len; 2833 len = skb->len - hdr_len;
2834 if (len) { 2834 if (len) {
2835 phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, 2835 phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len,
2836 len, PCI_DMA_TODEVICE); 2836 len, PCI_DMA_TODEVICE);
2837 iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len); 2837 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len);
2838 } 2838 }
2839 2839
2840 /* If there is no payload, then only one TFD is used */ 2840 /* If there is no payload, then only one TFD is used */
@@ -2848,10 +2848,10 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2848 out_cmd->cmd.tx.len = cpu_to_le16(len); 2848 out_cmd->cmd.tx.len = cpu_to_le16(len);
2849 2849
2850 /* TODO need this for burst mode later on */ 2850 /* TODO need this for burst mode later on */
2851 iwl_build_tx_cmd_basic(priv, out_cmd, ctl, hdr, unicast, sta_id); 2851 iwl3945_build_tx_cmd_basic(priv, out_cmd, ctl, hdr, unicast, sta_id);
2852 2852
2853 /* set is_hcca to 0; it probably will never be implemented */ 2853 /* set is_hcca to 0; it probably will never be implemented */
2854 iwl_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0); 2854 iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0);
2855 2855
2856 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; 2856 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
2857 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; 2857 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
@@ -2867,25 +2867,25 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2867 txq->need_update = 0; 2867 txq->need_update = 0;
2868 } 2868 }
2869 2869
2870 iwl_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload, 2870 iwl3945_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload,
2871 sizeof(out_cmd->cmd.tx)); 2871 sizeof(out_cmd->cmd.tx));
2872 2872
2873 iwl_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, 2873 iwl3945_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr,
2874 ieee80211_get_hdrlen(fc)); 2874 ieee80211_get_hdrlen(fc));
2875 2875
2876 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 2876 q->write_ptr = iwl3945_queue_inc_wrap(q->write_ptr, q->n_bd);
2877 rc = iwl_tx_queue_update_write_ptr(priv, txq); 2877 rc = iwl3945_tx_queue_update_write_ptr(priv, txq);
2878 spin_unlock_irqrestore(&priv->lock, flags); 2878 spin_unlock_irqrestore(&priv->lock, flags);
2879 2879
2880 if (rc) 2880 if (rc)
2881 return rc; 2881 return rc;
2882 2882
2883 if ((iwl_queue_space(q) < q->high_mark) 2883 if ((iwl3945_queue_space(q) < q->high_mark)
2884 && priv->mac80211_registered) { 2884 && priv->mac80211_registered) {
2885 if (wait_write_ptr) { 2885 if (wait_write_ptr) {
2886 spin_lock_irqsave(&priv->lock, flags); 2886 spin_lock_irqsave(&priv->lock, flags);
2887 txq->need_update = 1; 2887 txq->need_update = 1;
2888 iwl_tx_queue_update_write_ptr(priv, txq); 2888 iwl3945_tx_queue_update_write_ptr(priv, txq);
2889 spin_unlock_irqrestore(&priv->lock, flags); 2889 spin_unlock_irqrestore(&priv->lock, flags);
2890 } 2890 }
2891 2891
@@ -2900,13 +2900,13 @@ drop:
2900 return -1; 2900 return -1;
2901} 2901}
2902 2902
2903static void iwl_set_rate(struct iwl_priv *priv) 2903static void iwl3945_set_rate(struct iwl3945_priv *priv)
2904{ 2904{
2905 const struct ieee80211_hw_mode *hw = NULL; 2905 const struct ieee80211_hw_mode *hw = NULL;
2906 struct ieee80211_rate *rate; 2906 struct ieee80211_rate *rate;
2907 int i; 2907 int i;
2908 2908
2909 hw = iwl_get_hw_mode(priv, priv->phymode); 2909 hw = iwl3945_get_hw_mode(priv, priv->phymode);
2910 if (!hw) { 2910 if (!hw) {
2911 IWL_ERROR("Failed to set rate: unable to get hw mode\n"); 2911 IWL_ERROR("Failed to set rate: unable to get hw mode\n");
2912 return; 2912 return;
@@ -2924,7 +2924,7 @@ static void iwl_set_rate(struct iwl_priv *priv)
2924 if ((rate->val < IWL_RATE_COUNT) && 2924 if ((rate->val < IWL_RATE_COUNT) &&
2925 (rate->flags & IEEE80211_RATE_SUPPORTED)) { 2925 (rate->flags & IEEE80211_RATE_SUPPORTED)) {
2926 IWL_DEBUG_RATE("Adding rate index %d (plcp %d)%s\n", 2926 IWL_DEBUG_RATE("Adding rate index %d (plcp %d)%s\n",
2927 rate->val, iwl_rates[rate->val].plcp, 2927 rate->val, iwl3945_rates[rate->val].plcp,
2928 (rate->flags & IEEE80211_RATE_BASIC) ? 2928 (rate->flags & IEEE80211_RATE_BASIC) ?
2929 "*" : ""); 2929 "*" : "");
2930 priv->active_rate |= (1 << rate->val); 2930 priv->active_rate |= (1 << rate->val);
@@ -2932,7 +2932,7 @@ static void iwl_set_rate(struct iwl_priv *priv)
2932 priv->active_rate_basic |= (1 << rate->val); 2932 priv->active_rate_basic |= (1 << rate->val);
2933 } else 2933 } else
2934 IWL_DEBUG_RATE("Not adding rate %d (plcp %d)\n", 2934 IWL_DEBUG_RATE("Not adding rate %d (plcp %d)\n",
2935 rate->val, iwl_rates[rate->val].plcp); 2935 rate->val, iwl3945_rates[rate->val].plcp);
2936 } 2936 }
2937 2937
2938 IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n", 2938 IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n",
@@ -2961,7 +2961,7 @@ static void iwl_set_rate(struct iwl_priv *priv)
2961 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; 2961 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
2962} 2962}
2963 2963
2964static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio) 2964static void iwl3945_radio_kill_sw(struct iwl3945_priv *priv, int disable_radio)
2965{ 2965{
2966 unsigned long flags; 2966 unsigned long flags;
2967 2967
@@ -2972,21 +2972,21 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
2972 disable_radio ? "OFF" : "ON"); 2972 disable_radio ? "OFF" : "ON");
2973 2973
2974 if (disable_radio) { 2974 if (disable_radio) {
2975 iwl_scan_cancel(priv); 2975 iwl3945_scan_cancel(priv);
2976 /* FIXME: This is a workaround for AP */ 2976 /* FIXME: This is a workaround for AP */
2977 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { 2977 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) {
2978 spin_lock_irqsave(&priv->lock, flags); 2978 spin_lock_irqsave(&priv->lock, flags);
2979 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, 2979 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_SET,
2980 CSR_UCODE_SW_BIT_RFKILL); 2980 CSR_UCODE_SW_BIT_RFKILL);
2981 spin_unlock_irqrestore(&priv->lock, flags); 2981 spin_unlock_irqrestore(&priv->lock, flags);
2982 iwl_send_card_state(priv, CARD_STATE_CMD_DISABLE, 0); 2982 iwl3945_send_card_state(priv, CARD_STATE_CMD_DISABLE, 0);
2983 set_bit(STATUS_RF_KILL_SW, &priv->status); 2983 set_bit(STATUS_RF_KILL_SW, &priv->status);
2984 } 2984 }
2985 return; 2985 return;
2986 } 2986 }
2987 2987
2988 spin_lock_irqsave(&priv->lock, flags); 2988 spin_lock_irqsave(&priv->lock, flags);
2989 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 2989 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
2990 2990
2991 clear_bit(STATUS_RF_KILL_SW, &priv->status); 2991 clear_bit(STATUS_RF_KILL_SW, &priv->status);
2992 spin_unlock_irqrestore(&priv->lock, flags); 2992 spin_unlock_irqrestore(&priv->lock, flags);
@@ -2995,9 +2995,9 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
2995 msleep(10); 2995 msleep(10);
2996 2996
2997 spin_lock_irqsave(&priv->lock, flags); 2997 spin_lock_irqsave(&priv->lock, flags);
2998 iwl_read32(priv, CSR_UCODE_DRV_GP1); 2998 iwl3945_read32(priv, CSR_UCODE_DRV_GP1);
2999 if (!iwl_grab_nic_access(priv)) 2999 if (!iwl3945_grab_nic_access(priv))
3000 iwl_release_nic_access(priv); 3000 iwl3945_release_nic_access(priv);
3001 spin_unlock_irqrestore(&priv->lock, flags); 3001 spin_unlock_irqrestore(&priv->lock, flags);
3002 3002
3003 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { 3003 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
@@ -3010,7 +3010,7 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
3010 return; 3010 return;
3011} 3011}
3012 3012
3013void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, 3013void iwl3945_set_decrypted_flag(struct iwl3945_priv *priv, struct sk_buff *skb,
3014 u32 decrypt_res, struct ieee80211_rx_status *stats) 3014 u32 decrypt_res, struct ieee80211_rx_status *stats)
3015{ 3015{
3016 u16 fc = 3016 u16 fc =
@@ -3042,13 +3042,13 @@ void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb,
3042 } 3042 }
3043} 3043}
3044 3044
3045void iwl_handle_data_packet_monitor(struct iwl_priv *priv, 3045void iwl3945_handle_data_packet_monitor(struct iwl3945_priv *priv,
3046 struct iwl_rx_mem_buffer *rxb, 3046 struct iwl3945_rx_mem_buffer *rxb,
3047 void *data, short len, 3047 void *data, short len,
3048 struct ieee80211_rx_status *stats, 3048 struct ieee80211_rx_status *stats,
3049 u16 phy_flags) 3049 u16 phy_flags)
3050{ 3050{
3051 struct iwl_rt_rx_hdr *iwl_rt; 3051 struct iwl3945_rt_rx_hdr *iwl3945_rt;
3052 3052
3053 /* First cache any information we need before we overwrite 3053 /* First cache any information we need before we overwrite
3054 * the information provided in the skb from the hardware */ 3054 * the information provided in the skb from the hardware */
@@ -3059,26 +3059,26 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv,
3059 __le16 phy_flags_hw = cpu_to_le16(phy_flags); 3059 __le16 phy_flags_hw = cpu_to_le16(phy_flags);
3060 3060
3061 /* We received data from the HW, so stop the watchdog */ 3061 /* We received data from the HW, so stop the watchdog */
3062 if (len > IWL_RX_BUF_SIZE - sizeof(*iwl_rt)) { 3062 if (len > IWL_RX_BUF_SIZE - sizeof(*iwl3945_rt)) {
3063 IWL_DEBUG_DROP("Dropping too large packet in monitor\n"); 3063 IWL_DEBUG_DROP("Dropping too large packet in monitor\n");
3064 return; 3064 return;
3065 } 3065 }
3066 3066
3067 /* copy the frame data to write after where the radiotap header goes */ 3067 /* copy the frame data to write after where the radiotap header goes */
3068 iwl_rt = (void *)rxb->skb->data; 3068 iwl3945_rt = (void *)rxb->skb->data;
3069 memmove(iwl_rt->payload, data, len); 3069 memmove(iwl3945_rt->payload, data, len);
3070 3070
3071 iwl_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; 3071 iwl3945_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION;
3072 iwl_rt->rt_hdr.it_pad = 0; /* always good to zero */ 3072 iwl3945_rt->rt_hdr.it_pad = 0; /* always good to zero */
3073 3073
3074 /* total header + data */ 3074 /* total header + data */
3075 iwl_rt->rt_hdr.it_len = cpu_to_le16(sizeof(*iwl_rt)); 3075 iwl3945_rt->rt_hdr.it_len = cpu_to_le16(sizeof(*iwl3945_rt));
3076 3076
3077 /* Set the size of the skb to the size of the frame */ 3077 /* Set the size of the skb to the size of the frame */
3078 skb_put(rxb->skb, sizeof(*iwl_rt) + len); 3078 skb_put(rxb->skb, sizeof(*iwl3945_rt) + len);
3079 3079
3080 /* Big bitfield of all the fields we provide in radiotap */ 3080 /* Big bitfield of all the fields we provide in radiotap */
3081 iwl_rt->rt_hdr.it_present = 3081 iwl3945_rt->rt_hdr.it_present =
3082 cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) | 3082 cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) |
3083 (1 << IEEE80211_RADIOTAP_FLAGS) | 3083 (1 << IEEE80211_RADIOTAP_FLAGS) |
3084 (1 << IEEE80211_RADIOTAP_RATE) | 3084 (1 << IEEE80211_RADIOTAP_RATE) |
@@ -3088,39 +3088,39 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv,
3088 (1 << IEEE80211_RADIOTAP_ANTENNA)); 3088 (1 << IEEE80211_RADIOTAP_ANTENNA));
3089 3089
3090 /* Zero the flags, we'll add to them as we go */ 3090 /* Zero the flags, we'll add to them as we go */
3091 iwl_rt->rt_flags = 0; 3091 iwl3945_rt->rt_flags = 0;
3092 3092
3093 iwl_rt->rt_tsf = cpu_to_le64(tsf); 3093 iwl3945_rt->rt_tsf = cpu_to_le64(tsf);
3094 3094
3095 /* Convert to dBm */ 3095 /* Convert to dBm */
3096 iwl_rt->rt_dbmsignal = signal; 3096 iwl3945_rt->rt_dbmsignal = signal;
3097 iwl_rt->rt_dbmnoise = noise; 3097 iwl3945_rt->rt_dbmnoise = noise;
3098 3098
3099 /* Convert the channel frequency and set the flags */ 3099 /* Convert the channel frequency and set the flags */
3100 iwl_rt->rt_channelMHz = cpu_to_le16(stats->freq); 3100 iwl3945_rt->rt_channelMHz = cpu_to_le16(stats->freq);
3101 if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK)) 3101 if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK))
3102 iwl_rt->rt_chbitmask = 3102 iwl3945_rt->rt_chbitmask =
3103 cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ)); 3103 cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ));
3104 else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK) 3104 else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK)
3105 iwl_rt->rt_chbitmask = 3105 iwl3945_rt->rt_chbitmask =
3106 cpu_to_le16((IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ)); 3106 cpu_to_le16((IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ));
3107 else /* 802.11g */ 3107 else /* 802.11g */
3108 iwl_rt->rt_chbitmask = 3108 iwl3945_rt->rt_chbitmask =
3109 cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ)); 3109 cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ));
3110 3110
3111 rate = iwl_rate_index_from_plcp(rate); 3111 rate = iwl3945_rate_index_from_plcp(rate);
3112 if (rate == -1) 3112 if (rate == -1)
3113 iwl_rt->rt_rate = 0; 3113 iwl3945_rt->rt_rate = 0;
3114 else 3114 else
3115 iwl_rt->rt_rate = iwl_rates[rate].ieee; 3115 iwl3945_rt->rt_rate = iwl3945_rates[rate].ieee;
3116 3116
3117 /* antenna number */ 3117 /* antenna number */
3118 iwl_rt->rt_antenna = 3118 iwl3945_rt->rt_antenna =
3119 le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; 3119 le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4;
3120 3120
3121 /* set the preamble flag if we have it */ 3121 /* set the preamble flag if we have it */
3122 if (phy_flags_hw & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) 3122 if (phy_flags_hw & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK)
3123 iwl_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; 3123 iwl3945_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
3124 3124
3125 IWL_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); 3125 IWL_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len);
3126 3126
@@ -3132,7 +3132,7 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv,
3132 3132
3133#define IWL_PACKET_RETRY_TIME HZ 3133#define IWL_PACKET_RETRY_TIME HZ
3134 3134
3135int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) 3135int iwl3945_is_duplicate_packet(struct iwl3945_priv *priv, struct ieee80211_hdr *header)
3136{ 3136{
3137 u16 sc = le16_to_cpu(header->seq_ctrl); 3137 u16 sc = le16_to_cpu(header->seq_ctrl);
3138 u16 seq = (sc & IEEE80211_SCTL_SEQ) >> 4; 3138 u16 seq = (sc & IEEE80211_SCTL_SEQ) >> 4;
@@ -3143,12 +3143,12 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header)
3143 switch (priv->iw_mode) { 3143 switch (priv->iw_mode) {
3144 case IEEE80211_IF_TYPE_IBSS:{ 3144 case IEEE80211_IF_TYPE_IBSS:{
3145 struct list_head *p; 3145 struct list_head *p;
3146 struct iwl_ibss_seq *entry = NULL; 3146 struct iwl3945_ibss_seq *entry = NULL;
3147 u8 *mac = header->addr2; 3147 u8 *mac = header->addr2;
3148 int index = mac[5] & (IWL_IBSS_MAC_HASH_SIZE - 1); 3148 int index = mac[5] & (IWL_IBSS_MAC_HASH_SIZE - 1);
3149 3149
3150 __list_for_each(p, &priv->ibss_mac_hash[index]) { 3150 __list_for_each(p, &priv->ibss_mac_hash[index]) {
3151 entry = list_entry(p, struct iwl_ibss_seq, list); 3151 entry = list_entry(p, struct iwl3945_ibss_seq, list);
3152 if (!compare_ether_addr(entry->mac, mac)) 3152 if (!compare_ether_addr(entry->mac, mac))
3153 break; 3153 break;
3154 } 3154 }
@@ -3211,7 +3211,7 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header)
3211 * the lower 3 bytes is the time in usec within one beacon interval 3211 * the lower 3 bytes is the time in usec within one beacon interval
3212 */ 3212 */
3213 3213
3214static u32 iwl_usecs_to_beacons(u32 usec, u32 beacon_interval) 3214static u32 iwl3945_usecs_to_beacons(u32 usec, u32 beacon_interval)
3215{ 3215{
3216 u32 quot; 3216 u32 quot;
3217 u32 rem; 3217 u32 rem;
@@ -3230,7 +3230,7 @@ static u32 iwl_usecs_to_beacons(u32 usec, u32 beacon_interval)
3230 * the same as HW timer counter counting down 3230 * the same as HW timer counter counting down
3231 */ 3231 */
3232 3232
3233static __le32 iwl_add_beacon_time(u32 base, u32 addon, u32 beacon_interval) 3233static __le32 iwl3945_add_beacon_time(u32 base, u32 addon, u32 beacon_interval)
3234{ 3234{
3235 u32 base_low = base & BEACON_TIME_MASK_LOW; 3235 u32 base_low = base & BEACON_TIME_MASK_LOW;
3236 u32 addon_low = addon & BEACON_TIME_MASK_LOW; 3236 u32 addon_low = addon & BEACON_TIME_MASK_LOW;
@@ -3249,13 +3249,13 @@ static __le32 iwl_add_beacon_time(u32 base, u32 addon, u32 beacon_interval)
3249 return cpu_to_le32(res); 3249 return cpu_to_le32(res);
3250} 3250}
3251 3251
3252static int iwl_get_measurement(struct iwl_priv *priv, 3252static int iwl3945_get_measurement(struct iwl3945_priv *priv,
3253 struct ieee80211_measurement_params *params, 3253 struct ieee80211_measurement_params *params,
3254 u8 type) 3254 u8 type)
3255{ 3255{
3256 struct iwl_spectrum_cmd spectrum; 3256 struct iwl3945_spectrum_cmd spectrum;
3257 struct iwl_rx_packet *res; 3257 struct iwl3945_rx_packet *res;
3258 struct iwl_host_cmd cmd = { 3258 struct iwl3945_host_cmd cmd = {
3259 .id = REPLY_SPECTRUM_MEASUREMENT_CMD, 3259 .id = REPLY_SPECTRUM_MEASUREMENT_CMD,
3260 .data = (void *)&spectrum, 3260 .data = (void *)&spectrum,
3261 .meta.flags = CMD_WANT_SKB, 3261 .meta.flags = CMD_WANT_SKB,
@@ -3265,9 +3265,9 @@ static int iwl_get_measurement(struct iwl_priv *priv,
3265 int spectrum_resp_status; 3265 int spectrum_resp_status;
3266 int duration = le16_to_cpu(params->duration); 3266 int duration = le16_to_cpu(params->duration);
3267 3267
3268 if (iwl_is_associated(priv)) 3268 if (iwl3945_is_associated(priv))
3269 add_time = 3269 add_time =
3270 iwl_usecs_to_beacons( 3270 iwl3945_usecs_to_beacons(
3271 le64_to_cpu(params->start_time) - priv->last_tsf, 3271 le64_to_cpu(params->start_time) - priv->last_tsf,
3272 le16_to_cpu(priv->rxon_timing.beacon_interval)); 3272 le16_to_cpu(priv->rxon_timing.beacon_interval));
3273 3273
@@ -3280,9 +3280,9 @@ static int iwl_get_measurement(struct iwl_priv *priv,
3280 cmd.len = sizeof(spectrum); 3280 cmd.len = sizeof(spectrum);
3281 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); 3281 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len));
3282 3282
3283 if (iwl_is_associated(priv)) 3283 if (iwl3945_is_associated(priv))
3284 spectrum.start_time = 3284 spectrum.start_time =
3285 iwl_add_beacon_time(priv->last_beacon_time, 3285 iwl3945_add_beacon_time(priv->last_beacon_time,
3286 add_time, 3286 add_time,
3287 le16_to_cpu(priv->rxon_timing.beacon_interval)); 3287 le16_to_cpu(priv->rxon_timing.beacon_interval));
3288 else 3288 else
@@ -3295,11 +3295,11 @@ static int iwl_get_measurement(struct iwl_priv *priv,
3295 spectrum.flags |= RXON_FLG_BAND_24G_MSK | 3295 spectrum.flags |= RXON_FLG_BAND_24G_MSK |
3296 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; 3296 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK;
3297 3297
3298 rc = iwl_send_cmd_sync(priv, &cmd); 3298 rc = iwl3945_send_cmd_sync(priv, &cmd);
3299 if (rc) 3299 if (rc)
3300 return rc; 3300 return rc;
3301 3301
3302 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; 3302 res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
3303 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 3303 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
3304 IWL_ERROR("Bad return from REPLY_RX_ON_ASSOC command\n"); 3304 IWL_ERROR("Bad return from REPLY_RX_ON_ASSOC command\n");
3305 rc = -EIO; 3305 rc = -EIO;
@@ -3328,8 +3328,8 @@ static int iwl_get_measurement(struct iwl_priv *priv,
3328} 3328}
3329#endif 3329#endif
3330 3330
3331static void iwl_txstatus_to_ieee(struct iwl_priv *priv, 3331static void iwl3945_txstatus_to_ieee(struct iwl3945_priv *priv,
3332 struct iwl_tx_info *tx_sta) 3332 struct iwl3945_tx_info *tx_sta)
3333{ 3333{
3334 3334
3335 tx_sta->status.ack_signal = 0; 3335 tx_sta->status.ack_signal = 0;
@@ -3348,16 +3348,16 @@ static void iwl_txstatus_to_ieee(struct iwl_priv *priv,
3348} 3348}
3349 3349
3350/** 3350/**
3351 * iwl_tx_queue_reclaim - Reclaim Tx queue entries no more used by NIC. 3351 * iwl3945_tx_queue_reclaim - Reclaim Tx queue entries no more used by NIC.
3352 * 3352 *
3353 * When FW advances 'R' index, all entries between old and 3353 * When FW advances 'R' index, all entries between old and
3354 * new 'R' index need to be reclaimed. As result, some free space 3354 * new 'R' index need to be reclaimed. As result, some free space
3355 * forms. If there is enough free space (> low mark), wake Tx queue. 3355 * forms. If there is enough free space (> low mark), wake Tx queue.
3356 */ 3356 */
3357static int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) 3357static int iwl3945_tx_queue_reclaim(struct iwl3945_priv *priv, int txq_id, int index)
3358{ 3358{
3359 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 3359 struct iwl3945_tx_queue *txq = &priv->txq[txq_id];
3360 struct iwl_queue *q = &txq->q; 3360 struct iwl3945_queue *q = &txq->q;
3361 int nfreed = 0; 3361 int nfreed = 0;
3362 3362
3363 if ((index >= q->n_bd) || (x2_queue_used(q, index) == 0)) { 3363 if ((index >= q->n_bd) || (x2_queue_used(q, index) == 0)) {
@@ -3367,13 +3367,13 @@ static int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
3367 return 0; 3367 return 0;
3368 } 3368 }
3369 3369
3370 for (index = iwl_queue_inc_wrap(index, q->n_bd); 3370 for (index = iwl3945_queue_inc_wrap(index, q->n_bd);
3371 q->read_ptr != index; 3371 q->read_ptr != index;
3372 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { 3372 q->read_ptr = iwl3945_queue_inc_wrap(q->read_ptr, q->n_bd)) {
3373 if (txq_id != IWL_CMD_QUEUE_NUM) { 3373 if (txq_id != IWL_CMD_QUEUE_NUM) {
3374 iwl_txstatus_to_ieee(priv, 3374 iwl3945_txstatus_to_ieee(priv,
3375 &(txq->txb[txq->q.read_ptr])); 3375 &(txq->txb[txq->q.read_ptr]));
3376 iwl_hw_txq_free_tfd(priv, txq); 3376 iwl3945_hw_txq_free_tfd(priv, txq);
3377 } else if (nfreed > 1) { 3377 } else if (nfreed > 1) {
3378 IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index, 3378 IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index,
3379 q->write_ptr, q->read_ptr); 3379 q->write_ptr, q->read_ptr);
@@ -3382,7 +3382,7 @@ static int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
3382 nfreed++; 3382 nfreed++;
3383 } 3383 }
3384 3384
3385 if (iwl_queue_space(q) > q->low_mark && (txq_id >= 0) && 3385 if (iwl3945_queue_space(q) > q->low_mark && (txq_id >= 0) &&
3386 (txq_id != IWL_CMD_QUEUE_NUM) && 3386 (txq_id != IWL_CMD_QUEUE_NUM) &&
3387 priv->mac80211_registered) 3387 priv->mac80211_registered)
3388 ieee80211_wake_queue(priv->hw, txq_id); 3388 ieee80211_wake_queue(priv->hw, txq_id);
@@ -3391,7 +3391,7 @@ static int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
3391 return nfreed; 3391 return nfreed;
3392} 3392}
3393 3393
3394static int iwl_is_tx_success(u32 status) 3394static int iwl3945_is_tx_success(u32 status)
3395{ 3395{
3396 return (status & 0xFF) == 0x1; 3396 return (status & 0xFF) == 0x1;
3397} 3397}
@@ -3401,16 +3401,16 @@ static int iwl_is_tx_success(u32 status)
3401 * Generic RX handler implementations 3401 * Generic RX handler implementations
3402 * 3402 *
3403 ******************************************************************************/ 3403 ******************************************************************************/
3404static void iwl_rx_reply_tx(struct iwl_priv *priv, 3404static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
3405 struct iwl_rx_mem_buffer *rxb) 3405 struct iwl3945_rx_mem_buffer *rxb)
3406{ 3406{
3407 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3407 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3408 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 3408 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
3409 int txq_id = SEQ_TO_QUEUE(sequence); 3409 int txq_id = SEQ_TO_QUEUE(sequence);
3410 int index = SEQ_TO_INDEX(sequence); 3410 int index = SEQ_TO_INDEX(sequence);
3411 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 3411 struct iwl3945_tx_queue *txq = &priv->txq[txq_id];
3412 struct ieee80211_tx_status *tx_status; 3412 struct ieee80211_tx_status *tx_status;
3413 struct iwl_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; 3413 struct iwl3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
3414 u32 status = le32_to_cpu(tx_resp->status); 3414 u32 status = le32_to_cpu(tx_resp->status);
3415 3415
3416 if ((index >= txq->q.n_bd) || (x2_queue_used(&txq->q, index) == 0)) { 3416 if ((index >= txq->q.n_bd) || (x2_queue_used(&txq->q, index) == 0)) {
@@ -3429,28 +3429,28 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv,
3429 tx_status->queue_length |= tx_resp->failure_rts; 3429 tx_status->queue_length |= tx_resp->failure_rts;
3430 3430
3431 tx_status->flags = 3431 tx_status->flags =
3432 iwl_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0; 3432 iwl3945_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0;
3433 3433
3434 tx_status->control.tx_rate = iwl_rate_index_from_plcp(tx_resp->rate); 3434 tx_status->control.tx_rate = iwl3945_rate_index_from_plcp(tx_resp->rate);
3435 3435
3436 IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n", 3436 IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n",
3437 txq_id, iwl_get_tx_fail_reason(status), status, 3437 txq_id, iwl3945_get_tx_fail_reason(status), status,
3438 tx_resp->rate, tx_resp->failure_frame); 3438 tx_resp->rate, tx_resp->failure_frame);
3439 3439
3440 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); 3440 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index);
3441 if (index != -1) 3441 if (index != -1)
3442 iwl_tx_queue_reclaim(priv, txq_id, index); 3442 iwl3945_tx_queue_reclaim(priv, txq_id, index);
3443 3443
3444 if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK)) 3444 if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK))
3445 IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n"); 3445 IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n");
3446} 3446}
3447 3447
3448 3448
3449static void iwl_rx_reply_alive(struct iwl_priv *priv, 3449static void iwl3945_rx_reply_alive(struct iwl3945_priv *priv,
3450 struct iwl_rx_mem_buffer *rxb) 3450 struct iwl3945_rx_mem_buffer *rxb)
3451{ 3451{
3452 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3452 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3453 struct iwl_alive_resp *palive; 3453 struct iwl3945_alive_resp *palive;
3454 struct delayed_work *pwork; 3454 struct delayed_work *pwork;
3455 3455
3456 palive = &pkt->u.alive_frame; 3456 palive = &pkt->u.alive_frame;
@@ -3464,14 +3464,14 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv,
3464 IWL_DEBUG_INFO("Initialization Alive received.\n"); 3464 IWL_DEBUG_INFO("Initialization Alive received.\n");
3465 memcpy(&priv->card_alive_init, 3465 memcpy(&priv->card_alive_init,
3466 &pkt->u.alive_frame, 3466 &pkt->u.alive_frame,
3467 sizeof(struct iwl_init_alive_resp)); 3467 sizeof(struct iwl3945_init_alive_resp));
3468 pwork = &priv->init_alive_start; 3468 pwork = &priv->init_alive_start;
3469 } else { 3469 } else {
3470 IWL_DEBUG_INFO("Runtime Alive received.\n"); 3470 IWL_DEBUG_INFO("Runtime Alive received.\n");
3471 memcpy(&priv->card_alive, &pkt->u.alive_frame, 3471 memcpy(&priv->card_alive, &pkt->u.alive_frame,
3472 sizeof(struct iwl_alive_resp)); 3472 sizeof(struct iwl3945_alive_resp));
3473 pwork = &priv->alive_start; 3473 pwork = &priv->alive_start;
3474 iwl_disable_events(priv); 3474 iwl3945_disable_events(priv);
3475 } 3475 }
3476 3476
3477 /* We delay the ALIVE response by 5ms to 3477 /* We delay the ALIVE response by 5ms to
@@ -3483,19 +3483,19 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv,
3483 IWL_WARNING("uCode did not respond OK.\n"); 3483 IWL_WARNING("uCode did not respond OK.\n");
3484} 3484}
3485 3485
3486static void iwl_rx_reply_add_sta(struct iwl_priv *priv, 3486static void iwl3945_rx_reply_add_sta(struct iwl3945_priv *priv,
3487 struct iwl_rx_mem_buffer *rxb) 3487 struct iwl3945_rx_mem_buffer *rxb)
3488{ 3488{
3489 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3489 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3490 3490
3491 IWL_DEBUG_RX("Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status); 3491 IWL_DEBUG_RX("Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status);
3492 return; 3492 return;
3493} 3493}
3494 3494
3495static void iwl_rx_reply_error(struct iwl_priv *priv, 3495static void iwl3945_rx_reply_error(struct iwl3945_priv *priv,
3496 struct iwl_rx_mem_buffer *rxb) 3496 struct iwl3945_rx_mem_buffer *rxb)
3497{ 3497{
3498 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3498 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3499 3499
3500 IWL_ERROR("Error Reply type 0x%08X cmd %s (0x%02X) " 3500 IWL_ERROR("Error Reply type 0x%08X cmd %s (0x%02X) "
3501 "seq 0x%04X ser 0x%08X\n", 3501 "seq 0x%04X ser 0x%08X\n",
@@ -3508,23 +3508,23 @@ static void iwl_rx_reply_error(struct iwl_priv *priv,
3508 3508
3509#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x 3509#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x
3510 3510
3511static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) 3511static void iwl3945_rx_csa(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb)
3512{ 3512{
3513 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3513 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3514 struct iwl_rxon_cmd *rxon = (void *)&priv->active_rxon; 3514 struct iwl3945_rxon_cmd *rxon = (void *)&priv->active_rxon;
3515 struct iwl_csa_notification *csa = &(pkt->u.csa_notif); 3515 struct iwl3945_csa_notification *csa = &(pkt->u.csa_notif);
3516 IWL_DEBUG_11H("CSA notif: channel %d, status %d\n", 3516 IWL_DEBUG_11H("CSA notif: channel %d, status %d\n",
3517 le16_to_cpu(csa->channel), le32_to_cpu(csa->status)); 3517 le16_to_cpu(csa->channel), le32_to_cpu(csa->status));
3518 rxon->channel = csa->channel; 3518 rxon->channel = csa->channel;
3519 priv->staging_rxon.channel = csa->channel; 3519 priv->staging_rxon.channel = csa->channel;
3520} 3520}
3521 3521
3522static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, 3522static void iwl3945_rx_spectrum_measure_notif(struct iwl3945_priv *priv,
3523 struct iwl_rx_mem_buffer *rxb) 3523 struct iwl3945_rx_mem_buffer *rxb)
3524{ 3524{
3525#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT 3525#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
3526 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3526 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3527 struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif); 3527 struct iwl3945_spectrum_notification *report = &(pkt->u.spectrum_notif);
3528 3528
3529 if (!report->state) { 3529 if (!report->state) {
3530 IWL_DEBUG(IWL_DL_11H | IWL_DL_INFO, 3530 IWL_DEBUG(IWL_DL_11H | IWL_DL_INFO,
@@ -3537,31 +3537,31 @@ static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv,
3537#endif 3537#endif
3538} 3538}
3539 3539
3540static void iwl_rx_pm_sleep_notif(struct iwl_priv *priv, 3540static void iwl3945_rx_pm_sleep_notif(struct iwl3945_priv *priv,
3541 struct iwl_rx_mem_buffer *rxb) 3541 struct iwl3945_rx_mem_buffer *rxb)
3542{ 3542{
3543#ifdef CONFIG_IWL3945_DEBUG 3543#ifdef CONFIG_IWL3945_DEBUG
3544 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3544 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3545 struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif); 3545 struct iwl3945_sleep_notification *sleep = &(pkt->u.sleep_notif);
3546 IWL_DEBUG_RX("sleep mode: %d, src: %d\n", 3546 IWL_DEBUG_RX("sleep mode: %d, src: %d\n",
3547 sleep->pm_sleep_mode, sleep->pm_wakeup_src); 3547 sleep->pm_sleep_mode, sleep->pm_wakeup_src);
3548#endif 3548#endif
3549} 3549}
3550 3550
3551static void iwl_rx_pm_debug_statistics_notif(struct iwl_priv *priv, 3551static void iwl3945_rx_pm_debug_statistics_notif(struct iwl3945_priv *priv,
3552 struct iwl_rx_mem_buffer *rxb) 3552 struct iwl3945_rx_mem_buffer *rxb)
3553{ 3553{
3554 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3554 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3555 IWL_DEBUG_RADIO("Dumping %d bytes of unhandled " 3555 IWL_DEBUG_RADIO("Dumping %d bytes of unhandled "
3556 "notification for %s:\n", 3556 "notification for %s:\n",
3557 le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd)); 3557 le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd));
3558 iwl_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); 3558 iwl3945_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len));
3559} 3559}
3560 3560
3561static void iwl_bg_beacon_update(struct work_struct *work) 3561static void iwl3945_bg_beacon_update(struct work_struct *work)
3562{ 3562{
3563 struct iwl_priv *priv = 3563 struct iwl3945_priv *priv =
3564 container_of(work, struct iwl_priv, beacon_update); 3564 container_of(work, struct iwl3945_priv, beacon_update);
3565 struct sk_buff *beacon; 3565 struct sk_buff *beacon;
3566 3566
3567 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ 3567 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */
@@ -3580,15 +3580,15 @@ static void iwl_bg_beacon_update(struct work_struct *work)
3580 priv->ibss_beacon = beacon; 3580 priv->ibss_beacon = beacon;
3581 mutex_unlock(&priv->mutex); 3581 mutex_unlock(&priv->mutex);
3582 3582
3583 iwl_send_beacon_cmd(priv); 3583 iwl3945_send_beacon_cmd(priv);
3584} 3584}
3585 3585
3586static void iwl_rx_beacon_notif(struct iwl_priv *priv, 3586static void iwl3945_rx_beacon_notif(struct iwl3945_priv *priv,
3587 struct iwl_rx_mem_buffer *rxb) 3587 struct iwl3945_rx_mem_buffer *rxb)
3588{ 3588{
3589#ifdef CONFIG_IWL3945_DEBUG 3589#ifdef CONFIG_IWL3945_DEBUG
3590 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3590 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3591 struct iwl_beacon_notif *beacon = &(pkt->u.beacon_status); 3591 struct iwl3945_beacon_notif *beacon = &(pkt->u.beacon_status);
3592 u8 rate = beacon->beacon_notify_hdr.rate; 3592 u8 rate = beacon->beacon_notify_hdr.rate;
3593 3593
3594 IWL_DEBUG_RX("beacon status %x retries %d iss %d " 3594 IWL_DEBUG_RX("beacon status %x retries %d iss %d "
@@ -3606,25 +3606,25 @@ static void iwl_rx_beacon_notif(struct iwl_priv *priv,
3606} 3606}
3607 3607
3608/* Service response to REPLY_SCAN_CMD (0x80) */ 3608/* Service response to REPLY_SCAN_CMD (0x80) */
3609static void iwl_rx_reply_scan(struct iwl_priv *priv, 3609static void iwl3945_rx_reply_scan(struct iwl3945_priv *priv,
3610 struct iwl_rx_mem_buffer *rxb) 3610 struct iwl3945_rx_mem_buffer *rxb)
3611{ 3611{
3612#ifdef CONFIG_IWL3945_DEBUG 3612#ifdef CONFIG_IWL3945_DEBUG
3613 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3613 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3614 struct iwl_scanreq_notification *notif = 3614 struct iwl3945_scanreq_notification *notif =
3615 (struct iwl_scanreq_notification *)pkt->u.raw; 3615 (struct iwl3945_scanreq_notification *)pkt->u.raw;
3616 3616
3617 IWL_DEBUG_RX("Scan request status = 0x%x\n", notif->status); 3617 IWL_DEBUG_RX("Scan request status = 0x%x\n", notif->status);
3618#endif 3618#endif
3619} 3619}
3620 3620
3621/* Service SCAN_START_NOTIFICATION (0x82) */ 3621/* Service SCAN_START_NOTIFICATION (0x82) */
3622static void iwl_rx_scan_start_notif(struct iwl_priv *priv, 3622static void iwl3945_rx_scan_start_notif(struct iwl3945_priv *priv,
3623 struct iwl_rx_mem_buffer *rxb) 3623 struct iwl3945_rx_mem_buffer *rxb)
3624{ 3624{
3625 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3625 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3626 struct iwl_scanstart_notification *notif = 3626 struct iwl3945_scanstart_notification *notif =
3627 (struct iwl_scanstart_notification *)pkt->u.raw; 3627 (struct iwl3945_scanstart_notification *)pkt->u.raw;
3628 priv->scan_start_tsf = le32_to_cpu(notif->tsf_low); 3628 priv->scan_start_tsf = le32_to_cpu(notif->tsf_low);
3629 IWL_DEBUG_SCAN("Scan start: " 3629 IWL_DEBUG_SCAN("Scan start: "
3630 "%d [802.11%s] " 3630 "%d [802.11%s] "
@@ -3636,12 +3636,12 @@ static void iwl_rx_scan_start_notif(struct iwl_priv *priv,
3636} 3636}
3637 3637
3638/* Service SCAN_RESULTS_NOTIFICATION (0x83) */ 3638/* Service SCAN_RESULTS_NOTIFICATION (0x83) */
3639static void iwl_rx_scan_results_notif(struct iwl_priv *priv, 3639static void iwl3945_rx_scan_results_notif(struct iwl3945_priv *priv,
3640 struct iwl_rx_mem_buffer *rxb) 3640 struct iwl3945_rx_mem_buffer *rxb)
3641{ 3641{
3642 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3642 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3643 struct iwl_scanresults_notification *notif = 3643 struct iwl3945_scanresults_notification *notif =
3644 (struct iwl_scanresults_notification *)pkt->u.raw; 3644 (struct iwl3945_scanresults_notification *)pkt->u.raw;
3645 3645
3646 IWL_DEBUG_SCAN("Scan ch.res: " 3646 IWL_DEBUG_SCAN("Scan ch.res: "
3647 "%d [802.11%s] " 3647 "%d [802.11%s] "
@@ -3660,11 +3660,11 @@ static void iwl_rx_scan_results_notif(struct iwl_priv *priv,
3660} 3660}
3661 3661
3662/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ 3662/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */
3663static void iwl_rx_scan_complete_notif(struct iwl_priv *priv, 3663static void iwl3945_rx_scan_complete_notif(struct iwl3945_priv *priv,
3664 struct iwl_rx_mem_buffer *rxb) 3664 struct iwl3945_rx_mem_buffer *rxb)
3665{ 3665{
3666 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3666 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3667 struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw; 3667 struct iwl3945_scancomplete_notification *scan_notif = (void *)pkt->u.raw;
3668 3668
3669 IWL_DEBUG_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n", 3669 IWL_DEBUG_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n",
3670 scan_notif->scanned_channels, 3670 scan_notif->scanned_channels,
@@ -3717,10 +3717,10 @@ reschedule:
3717 3717
3718/* Handle notification from uCode that card's power state is changing 3718/* Handle notification from uCode that card's power state is changing
3719 * due to software, hardware, or critical temperature RFKILL */ 3719 * due to software, hardware, or critical temperature RFKILL */
3720static void iwl_rx_card_state_notif(struct iwl_priv *priv, 3720static void iwl3945_rx_card_state_notif(struct iwl3945_priv *priv,
3721 struct iwl_rx_mem_buffer *rxb) 3721 struct iwl3945_rx_mem_buffer *rxb)
3722{ 3722{
3723 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3723 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3724 u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); 3724 u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags);
3725 unsigned long status = priv->status; 3725 unsigned long status = priv->status;
3726 3726
@@ -3728,7 +3728,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
3728 (flags & HW_CARD_DISABLED) ? "Kill" : "On", 3728 (flags & HW_CARD_DISABLED) ? "Kill" : "On",
3729 (flags & SW_CARD_DISABLED) ? "Kill" : "On"); 3729 (flags & SW_CARD_DISABLED) ? "Kill" : "On");
3730 3730
3731 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, 3731 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_SET,
3732 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 3732 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
3733 3733
3734 if (flags & HW_CARD_DISABLED) 3734 if (flags & HW_CARD_DISABLED)
@@ -3742,7 +3742,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
3742 else 3742 else
3743 clear_bit(STATUS_RF_KILL_SW, &priv->status); 3743 clear_bit(STATUS_RF_KILL_SW, &priv->status);
3744 3744
3745 iwl_scan_cancel(priv); 3745 iwl3945_scan_cancel(priv);
3746 3746
3747 if ((test_bit(STATUS_RF_KILL_HW, &status) != 3747 if ((test_bit(STATUS_RF_KILL_HW, &status) !=
3748 test_bit(STATUS_RF_KILL_HW, &priv->status)) || 3748 test_bit(STATUS_RF_KILL_HW, &priv->status)) ||
@@ -3754,7 +3754,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
3754} 3754}
3755 3755
3756/** 3756/**
3757 * iwl_setup_rx_handlers - Initialize Rx handler callbacks 3757 * iwl3945_setup_rx_handlers - Initialize Rx handler callbacks
3758 * 3758 *
3759 * Setup the RX handlers for each of the reply types sent from the uCode 3759 * Setup the RX handlers for each of the reply types sent from the uCode
3760 * to the host. 3760 * to the host.
@@ -3762,20 +3762,20 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
3762 * This function chains into the hardware specific files for them to setup 3762 * This function chains into the hardware specific files for them to setup
3763 * any hardware specific handlers as well. 3763 * any hardware specific handlers as well.
3764 */ 3764 */
3765static void iwl_setup_rx_handlers(struct iwl_priv *priv) 3765static void iwl3945_setup_rx_handlers(struct iwl3945_priv *priv)
3766{ 3766{
3767 priv->rx_handlers[REPLY_ALIVE] = iwl_rx_reply_alive; 3767 priv->rx_handlers[REPLY_ALIVE] = iwl3945_rx_reply_alive;
3768 priv->rx_handlers[REPLY_ADD_STA] = iwl_rx_reply_add_sta; 3768 priv->rx_handlers[REPLY_ADD_STA] = iwl3945_rx_reply_add_sta;
3769 priv->rx_handlers[REPLY_ERROR] = iwl_rx_reply_error; 3769 priv->rx_handlers[REPLY_ERROR] = iwl3945_rx_reply_error;
3770 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_rx_csa; 3770 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl3945_rx_csa;
3771 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = 3771 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] =
3772 iwl_rx_spectrum_measure_notif; 3772 iwl3945_rx_spectrum_measure_notif;
3773 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl_rx_pm_sleep_notif; 3773 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl3945_rx_pm_sleep_notif;
3774 priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = 3774 priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] =
3775 iwl_rx_pm_debug_statistics_notif; 3775 iwl3945_rx_pm_debug_statistics_notif;
3776 priv->rx_handlers[BEACON_NOTIFICATION] = iwl_rx_beacon_notif; 3776 priv->rx_handlers[BEACON_NOTIFICATION] = iwl3945_rx_beacon_notif;
3777 3777
3778 /* NOTE: iwl_rx_statistics is different based on whether 3778 /* NOTE: iwl3945_rx_statistics is different based on whether
3779 * the build is for the 3945 or the 4965. See the 3779 * the build is for the 3945 or the 4965. See the
3780 * corresponding implementation in iwl-XXXX.c 3780 * corresponding implementation in iwl-XXXX.c
3781 * 3781 *
@@ -3783,40 +3783,40 @@ static void iwl_setup_rx_handlers(struct iwl_priv *priv)
3783 * discrete statistics request from the host as well as 3783 * discrete statistics request from the host as well as
3784 * for the periodic statistics notification from the uCode 3784 * for the periodic statistics notification from the uCode
3785 */ 3785 */
3786 priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl_hw_rx_statistics; 3786 priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl3945_hw_rx_statistics;
3787 priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl_hw_rx_statistics; 3787 priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl3945_hw_rx_statistics;
3788 3788
3789 priv->rx_handlers[REPLY_SCAN_CMD] = iwl_rx_reply_scan; 3789 priv->rx_handlers[REPLY_SCAN_CMD] = iwl3945_rx_reply_scan;
3790 priv->rx_handlers[SCAN_START_NOTIFICATION] = iwl_rx_scan_start_notif; 3790 priv->rx_handlers[SCAN_START_NOTIFICATION] = iwl3945_rx_scan_start_notif;
3791 priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] = 3791 priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] =
3792 iwl_rx_scan_results_notif; 3792 iwl3945_rx_scan_results_notif;
3793 priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] = 3793 priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] =
3794 iwl_rx_scan_complete_notif; 3794 iwl3945_rx_scan_complete_notif;
3795 priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl_rx_card_state_notif; 3795 priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl3945_rx_card_state_notif;
3796 priv->rx_handlers[REPLY_TX] = iwl_rx_reply_tx; 3796 priv->rx_handlers[REPLY_TX] = iwl3945_rx_reply_tx;
3797 3797
3798 /* Setup hardware specific Rx handlers */ 3798 /* Setup hardware specific Rx handlers */
3799 iwl_hw_rx_handler_setup(priv); 3799 iwl3945_hw_rx_handler_setup(priv);
3800} 3800}
3801 3801
3802/** 3802/**
3803 * iwl_tx_cmd_complete - Pull unused buffers off the queue and reclaim them 3803 * iwl3945_tx_cmd_complete - Pull unused buffers off the queue and reclaim them
3804 * @rxb: Rx buffer to reclaim 3804 * @rxb: Rx buffer to reclaim
3805 * 3805 *
3806 * If an Rx buffer has an async callback associated with it the callback 3806 * If an Rx buffer has an async callback associated with it the callback
3807 * will be executed. The attached skb (if present) will only be freed 3807 * will be executed. The attached skb (if present) will only be freed
3808 * if the callback returns 1 3808 * if the callback returns 1
3809 */ 3809 */
3810static void iwl_tx_cmd_complete(struct iwl_priv *priv, 3810static void iwl3945_tx_cmd_complete(struct iwl3945_priv *priv,
3811 struct iwl_rx_mem_buffer *rxb) 3811 struct iwl3945_rx_mem_buffer *rxb)
3812{ 3812{
3813 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 3813 struct iwl3945_rx_packet *pkt = (struct iwl3945_rx_packet *)rxb->skb->data;
3814 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 3814 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
3815 int txq_id = SEQ_TO_QUEUE(sequence); 3815 int txq_id = SEQ_TO_QUEUE(sequence);
3816 int index = SEQ_TO_INDEX(sequence); 3816 int index = SEQ_TO_INDEX(sequence);
3817 int huge = sequence & SEQ_HUGE_FRAME; 3817 int huge = sequence & SEQ_HUGE_FRAME;
3818 int cmd_index; 3818 int cmd_index;
3819 struct iwl_cmd *cmd; 3819 struct iwl3945_cmd *cmd;
3820 3820
3821 /* If a Tx command is being handled and it isn't in the actual 3821 /* If a Tx command is being handled and it isn't in the actual
3822 * command queue then there a command routing bug has been introduced 3822 * command queue then there a command routing bug has been introduced
@@ -3837,7 +3837,7 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv,
3837 !cmd->meta.u.callback(priv, cmd, rxb->skb)) 3837 !cmd->meta.u.callback(priv, cmd, rxb->skb))
3838 rxb->skb = NULL; 3838 rxb->skb = NULL;
3839 3839
3840 iwl_tx_queue_reclaim(priv, txq_id, index); 3840 iwl3945_tx_queue_reclaim(priv, txq_id, index);
3841 3841
3842 if (!(cmd->meta.flags & CMD_ASYNC)) { 3842 if (!(cmd->meta.flags & CMD_ASYNC)) {
3843 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 3843 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
@@ -3879,7 +3879,7 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv,
3879 * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When 3879 * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When
3880 * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled 3880 * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled
3881 * to replenish the iwl->rxq->rx_free. 3881 * to replenish the iwl->rxq->rx_free.
3882 * + In iwl_rx_replenish (scheduled) if 'processed' != 'read' then the 3882 * + In iwl3945_rx_replenish (scheduled) if 'processed' != 'read' then the
3883 * iwl->rxq is replenished and the READ INDEX is updated (updating the 3883 * iwl->rxq is replenished and the READ INDEX is updated (updating the
3884 * 'processed' and 'read' driver indexes as well) 3884 * 'processed' and 'read' driver indexes as well)
3885 * + A received packet is processed and handed to the kernel network stack, 3885 * + A received packet is processed and handed to the kernel network stack,
@@ -3892,28 +3892,28 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv,
3892 * 3892 *
3893 * Driver sequence: 3893 * Driver sequence:
3894 * 3894 *
3895 * iwl_rx_queue_alloc() Allocates rx_free 3895 * iwl3945_rx_queue_alloc() Allocates rx_free
3896 * iwl_rx_replenish() Replenishes rx_free list from rx_used, and calls 3896 * iwl3945_rx_replenish() Replenishes rx_free list from rx_used, and calls
3897 * iwl_rx_queue_restock 3897 * iwl3945_rx_queue_restock
3898 * iwl_rx_queue_restock() Moves available buffers from rx_free into Rx 3898 * iwl3945_rx_queue_restock() Moves available buffers from rx_free into Rx
3899 * queue, updates firmware pointers, and updates 3899 * queue, updates firmware pointers, and updates
3900 * the WRITE index. If insufficient rx_free buffers 3900 * the WRITE index. If insufficient rx_free buffers
3901 * are available, schedules iwl_rx_replenish 3901 * are available, schedules iwl3945_rx_replenish
3902 * 3902 *
3903 * -- enable interrupts -- 3903 * -- enable interrupts --
3904 * ISR - iwl_rx() Detach iwl_rx_mem_buffers from pool up to the 3904 * ISR - iwl3945_rx() Detach iwl3945_rx_mem_buffers from pool up to the
3905 * READ INDEX, detaching the SKB from the pool. 3905 * READ INDEX, detaching the SKB from the pool.
3906 * Moves the packet buffer from queue to rx_used. 3906 * Moves the packet buffer from queue to rx_used.
3907 * Calls iwl_rx_queue_restock to refill any empty 3907 * Calls iwl3945_rx_queue_restock to refill any empty
3908 * slots. 3908 * slots.
3909 * ... 3909 * ...
3910 * 3910 *
3911 */ 3911 */
3912 3912
3913/** 3913/**
3914 * iwl_rx_queue_space - Return number of free slots available in queue. 3914 * iwl3945_rx_queue_space - Return number of free slots available in queue.
3915 */ 3915 */
3916static int iwl_rx_queue_space(const struct iwl_rx_queue *q) 3916static int iwl3945_rx_queue_space(const struct iwl3945_rx_queue *q)
3917{ 3917{
3918 int s = q->read - q->write; 3918 int s = q->read - q->write;
3919 if (s <= 0) 3919 if (s <= 0)
@@ -3926,7 +3926,7 @@ static int iwl_rx_queue_space(const struct iwl_rx_queue *q)
3926} 3926}
3927 3927
3928/** 3928/**
3929 * iwl_rx_queue_update_write_ptr - Update the write pointer for the RX queue 3929 * iwl3945_rx_queue_update_write_ptr - Update the write pointer for the RX queue
3930 * 3930 *
3931 * NOTE: This function has 3945 and 4965 specific code sections 3931 * NOTE: This function has 3945 and 4965 specific code sections
3932 * but is declared in base due to the majority of the 3932 * but is declared in base due to the majority of the
@@ -3934,7 +3934,7 @@ static int iwl_rx_queue_space(const struct iwl_rx_queue *q)
3934 * different) 3934 * different)
3935 * 3935 *
3936 */ 3936 */
3937int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q) 3937int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv, struct iwl3945_rx_queue *q)
3938{ 3938{
3939 u32 reg = 0; 3939 u32 reg = 0;
3940 int rc = 0; 3940 int rc = 0;
@@ -3946,23 +3946,23 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q)
3946 goto exit_unlock; 3946 goto exit_unlock;
3947 3947
3948 if (test_bit(STATUS_POWER_PMI, &priv->status)) { 3948 if (test_bit(STATUS_POWER_PMI, &priv->status)) {
3949 reg = iwl_read32(priv, CSR_UCODE_DRV_GP1); 3949 reg = iwl3945_read32(priv, CSR_UCODE_DRV_GP1);
3950 3950
3951 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { 3951 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
3952 iwl_set_bit(priv, CSR_GP_CNTRL, 3952 iwl3945_set_bit(priv, CSR_GP_CNTRL,
3953 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 3953 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
3954 goto exit_unlock; 3954 goto exit_unlock;
3955 } 3955 }
3956 3956
3957 rc = iwl_grab_nic_access(priv); 3957 rc = iwl3945_grab_nic_access(priv);
3958 if (rc) 3958 if (rc)
3959 goto exit_unlock; 3959 goto exit_unlock;
3960 3960
3961 iwl_write_direct32(priv, FH_RSCSR_CHNL0_WPTR, 3961 iwl3945_write_direct32(priv, FH_RSCSR_CHNL0_WPTR,
3962 q->write & ~0x7); 3962 q->write & ~0x7);
3963 iwl_release_nic_access(priv); 3963 iwl3945_release_nic_access(priv);
3964 } else 3964 } else
3965 iwl_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); 3965 iwl3945_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7);
3966 3966
3967 3967
3968 q->need_update = 0; 3968 q->need_update = 0;
@@ -3973,18 +3973,18 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q)
3973} 3973}
3974 3974
3975/** 3975/**
3976 * iwl_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer pointer. 3976 * iwl3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer pointer.
3977 * 3977 *
3978 * NOTE: This function has 3945 and 4965 specific code paths in it. 3978 * NOTE: This function has 3945 and 4965 specific code paths in it.
3979 */ 3979 */
3980static inline __le32 iwl_dma_addr2rbd_ptr(struct iwl_priv *priv, 3980static inline __le32 iwl3945_dma_addr2rbd_ptr(struct iwl3945_priv *priv,
3981 dma_addr_t dma_addr) 3981 dma_addr_t dma_addr)
3982{ 3982{
3983 return cpu_to_le32((u32)dma_addr); 3983 return cpu_to_le32((u32)dma_addr);
3984} 3984}
3985 3985
3986/** 3986/**
3987 * iwl_rx_queue_restock - refill RX queue from pre-allocated pool 3987 * iwl3945_rx_queue_restock - refill RX queue from pre-allocated pool
3988 * 3988 *
3989 * If there are slots in the RX queue that need to be restocked, 3989 * If there are slots in the RX queue that need to be restocked,
3990 * and we have free pre-allocated buffers, fill the ranks as much 3990 * and we have free pre-allocated buffers, fill the ranks as much
@@ -3994,21 +3994,21 @@ static inline __le32 iwl_dma_addr2rbd_ptr(struct iwl_priv *priv,
3994 * also updates the memory address in the firmware to reference the new 3994 * also updates the memory address in the firmware to reference the new
3995 * target buffer. 3995 * target buffer.
3996 */ 3996 */
3997static int iwl_rx_queue_restock(struct iwl_priv *priv) 3997static int iwl3945_rx_queue_restock(struct iwl3945_priv *priv)
3998{ 3998{
3999 struct iwl_rx_queue *rxq = &priv->rxq; 3999 struct iwl3945_rx_queue *rxq = &priv->rxq;
4000 struct list_head *element; 4000 struct list_head *element;
4001 struct iwl_rx_mem_buffer *rxb; 4001 struct iwl3945_rx_mem_buffer *rxb;
4002 unsigned long flags; 4002 unsigned long flags;
4003 int write, rc; 4003 int write, rc;
4004 4004
4005 spin_lock_irqsave(&rxq->lock, flags); 4005 spin_lock_irqsave(&rxq->lock, flags);
4006 write = rxq->write & ~0x7; 4006 write = rxq->write & ~0x7;
4007 while ((iwl_rx_queue_space(rxq) > 0) && (rxq->free_count)) { 4007 while ((iwl3945_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
4008 element = rxq->rx_free.next; 4008 element = rxq->rx_free.next;
4009 rxb = list_entry(element, struct iwl_rx_mem_buffer, list); 4009 rxb = list_entry(element, struct iwl3945_rx_mem_buffer, list);
4010 list_del(element); 4010 list_del(element);
4011 rxq->bd[rxq->write] = iwl_dma_addr2rbd_ptr(priv, rxb->dma_addr); 4011 rxq->bd[rxq->write] = iwl3945_dma_addr2rbd_ptr(priv, rxb->dma_addr);
4012 rxq->queue[rxq->write] = rxb; 4012 rxq->queue[rxq->write] = rxb;
4013 rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; 4013 rxq->write = (rxq->write + 1) & RX_QUEUE_MASK;
4014 rxq->free_count--; 4014 rxq->free_count--;
@@ -4026,7 +4026,7 @@ static int iwl_rx_queue_restock(struct iwl_priv *priv)
4026 spin_lock_irqsave(&rxq->lock, flags); 4026 spin_lock_irqsave(&rxq->lock, flags);
4027 rxq->need_update = 1; 4027 rxq->need_update = 1;
4028 spin_unlock_irqrestore(&rxq->lock, flags); 4028 spin_unlock_irqrestore(&rxq->lock, flags);
4029 rc = iwl_rx_queue_update_write_ptr(priv, rxq); 4029 rc = iwl3945_rx_queue_update_write_ptr(priv, rxq);
4030 if (rc) 4030 if (rc)
4031 return rc; 4031 return rc;
4032 } 4032 }
@@ -4035,24 +4035,24 @@ static int iwl_rx_queue_restock(struct iwl_priv *priv)
4035} 4035}
4036 4036
4037/** 4037/**
4038 * iwl_rx_replenish - Move all used packet from rx_used to rx_free 4038 * iwl3945_rx_replenish - Move all used packet from rx_used to rx_free
4039 * 4039 *
4040 * When moving to rx_free an SKB is allocated for the slot. 4040 * When moving to rx_free an SKB is allocated for the slot.
4041 * 4041 *
4042 * Also restock the Rx queue via iwl_rx_queue_restock. 4042 * Also restock the Rx queue via iwl3945_rx_queue_restock.
4043 * This is called as a scheduled work item (except for during initialization) 4043 * This is called as a scheduled work item (except for during initialization)
4044 */ 4044 */
4045void iwl_rx_replenish(void *data) 4045void iwl3945_rx_replenish(void *data)
4046{ 4046{
4047 struct iwl_priv *priv = data; 4047 struct iwl3945_priv *priv = data;
4048 struct iwl_rx_queue *rxq = &priv->rxq; 4048 struct iwl3945_rx_queue *rxq = &priv->rxq;
4049 struct list_head *element; 4049 struct list_head *element;
4050 struct iwl_rx_mem_buffer *rxb; 4050 struct iwl3945_rx_mem_buffer *rxb;
4051 unsigned long flags; 4051 unsigned long flags;
4052 spin_lock_irqsave(&rxq->lock, flags); 4052 spin_lock_irqsave(&rxq->lock, flags);
4053 while (!list_empty(&rxq->rx_used)) { 4053 while (!list_empty(&rxq->rx_used)) {
4054 element = rxq->rx_used.next; 4054 element = rxq->rx_used.next;
4055 rxb = list_entry(element, struct iwl_rx_mem_buffer, list); 4055 rxb = list_entry(element, struct iwl3945_rx_mem_buffer, list);
4056 rxb->skb = 4056 rxb->skb =
4057 alloc_skb(IWL_RX_BUF_SIZE, __GFP_NOWARN | GFP_ATOMIC); 4057 alloc_skb(IWL_RX_BUF_SIZE, __GFP_NOWARN | GFP_ATOMIC);
4058 if (!rxb->skb) { 4058 if (!rxb->skb) {
@@ -4075,7 +4075,7 @@ void iwl_rx_replenish(void *data)
4075 spin_unlock_irqrestore(&rxq->lock, flags); 4075 spin_unlock_irqrestore(&rxq->lock, flags);
4076 4076
4077 spin_lock_irqsave(&priv->lock, flags); 4077 spin_lock_irqsave(&priv->lock, flags);
4078 iwl_rx_queue_restock(priv); 4078 iwl3945_rx_queue_restock(priv);
4079 spin_unlock_irqrestore(&priv->lock, flags); 4079 spin_unlock_irqrestore(&priv->lock, flags);
4080} 4080}
4081 4081
@@ -4084,7 +4084,7 @@ void iwl_rx_replenish(void *data)
4084 * This free routine walks the list of POOL entries and if SKB is set to 4084 * This free routine walks the list of POOL entries and if SKB is set to
4085 * non NULL it is unmapped and freed 4085 * non NULL it is unmapped and freed
4086 */ 4086 */
4087static void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 4087static void iwl3945_rx_queue_free(struct iwl3945_priv *priv, struct iwl3945_rx_queue *rxq)
4088{ 4088{
4089 int i; 4089 int i;
4090 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { 4090 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
@@ -4101,9 +4101,9 @@ static void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
4101 rxq->bd = NULL; 4101 rxq->bd = NULL;
4102} 4102}
4103 4103
4104int iwl_rx_queue_alloc(struct iwl_priv *priv) 4104int iwl3945_rx_queue_alloc(struct iwl3945_priv *priv)
4105{ 4105{
4106 struct iwl_rx_queue *rxq = &priv->rxq; 4106 struct iwl3945_rx_queue *rxq = &priv->rxq;
4107 struct pci_dev *dev = priv->pci_dev; 4107 struct pci_dev *dev = priv->pci_dev;
4108 int i; 4108 int i;
4109 4109
@@ -4124,7 +4124,7 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv)
4124 return 0; 4124 return 0;
4125} 4125}
4126 4126
4127void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 4127void iwl3945_rx_queue_reset(struct iwl3945_priv *priv, struct iwl3945_rx_queue *rxq)
4128{ 4128{
4129 unsigned long flags; 4129 unsigned long flags;
4130 int i; 4130 int i;
@@ -4171,7 +4171,7 @@ static u8 ratio2dB[100] = {
4171/* Calculates a relative dB value from a ratio of linear 4171/* Calculates a relative dB value from a ratio of linear
4172 * (i.e. not dB) signal levels. 4172 * (i.e. not dB) signal levels.
4173 * Conversion assumes that levels are voltages (20*log), not powers (10*log). */ 4173 * Conversion assumes that levels are voltages (20*log), not powers (10*log). */
4174int iwl_calc_db_from_ratio(int sig_ratio) 4174int iwl3945_calc_db_from_ratio(int sig_ratio)
4175{ 4175{
4176 /* Anything above 1000:1 just report as 60 dB */ 4176 /* Anything above 1000:1 just report as 60 dB */
4177 if (sig_ratio > 1000) 4177 if (sig_ratio > 1000)
@@ -4197,7 +4197,7 @@ int iwl_calc_db_from_ratio(int sig_ratio)
4197/* Calculate an indication of rx signal quality (a percentage, not dBm!). 4197/* Calculate an indication of rx signal quality (a percentage, not dBm!).
4198 * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info 4198 * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info
4199 * about formulas used below. */ 4199 * about formulas used below. */
4200int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm) 4200int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm)
4201{ 4201{
4202 int sig_qual; 4202 int sig_qual;
4203 int degradation = PERFECT_RSSI - rssi_dbm; 4203 int degradation = PERFECT_RSSI - rssi_dbm;
@@ -4232,22 +4232,22 @@ int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm)
4232} 4232}
4233 4233
4234/** 4234/**
4235 * iwl_rx_handle - Main entry function for receiving responses from the uCode 4235 * iwl3945_rx_handle - Main entry function for receiving responses from the uCode
4236 * 4236 *
4237 * Uses the priv->rx_handlers callback function array to invoke 4237 * Uses the priv->rx_handlers callback function array to invoke
4238 * the appropriate handlers, including command responses, 4238 * the appropriate handlers, including command responses,
4239 * frame-received notifications, and other notifications. 4239 * frame-received notifications, and other notifications.
4240 */ 4240 */
4241static void iwl_rx_handle(struct iwl_priv *priv) 4241static void iwl3945_rx_handle(struct iwl3945_priv *priv)
4242{ 4242{
4243 struct iwl_rx_mem_buffer *rxb; 4243 struct iwl3945_rx_mem_buffer *rxb;
4244 struct iwl_rx_packet *pkt; 4244 struct iwl3945_rx_packet *pkt;
4245 struct iwl_rx_queue *rxq = &priv->rxq; 4245 struct iwl3945_rx_queue *rxq = &priv->rxq;
4246 u32 r, i; 4246 u32 r, i;
4247 int reclaim; 4247 int reclaim;
4248 unsigned long flags; 4248 unsigned long flags;
4249 4249
4250 r = iwl_hw_get_rx_read(priv); 4250 r = iwl3945_hw_get_rx_read(priv);
4251 i = rxq->read; 4251 i = rxq->read;
4252 4252
4253 /* Rx interrupt, but nothing sent from uCode */ 4253 /* Rx interrupt, but nothing sent from uCode */
@@ -4267,7 +4267,7 @@ static void iwl_rx_handle(struct iwl_priv *priv)
4267 pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, 4267 pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr,
4268 IWL_RX_BUF_SIZE, 4268 IWL_RX_BUF_SIZE,
4269 PCI_DMA_FROMDEVICE); 4269 PCI_DMA_FROMDEVICE);
4270 pkt = (struct iwl_rx_packet *)rxb->skb->data; 4270 pkt = (struct iwl3945_rx_packet *)rxb->skb->data;
4271 4271
4272 /* Reclaim a command buffer only if this packet is a response 4272 /* Reclaim a command buffer only if this packet is a response
4273 * to a (driver-originated) command. 4273 * to a (driver-originated) command.
@@ -4281,7 +4281,7 @@ static void iwl_rx_handle(struct iwl_priv *priv)
4281 4281
4282 /* Based on type of command response or notification, 4282 /* Based on type of command response or notification,
4283 * handle those that need handling via function in 4283 * handle those that need handling via function in
4284 * rx_handlers table. See iwl_setup_rx_handlers() */ 4284 * rx_handlers table. See iwl3945_setup_rx_handlers() */
4285 if (priv->rx_handlers[pkt->hdr.cmd]) { 4285 if (priv->rx_handlers[pkt->hdr.cmd]) {
4286 IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR, 4286 IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR,
4287 "r = %d, i = %d, %s, 0x%02x\n", r, i, 4287 "r = %d, i = %d, %s, 0x%02x\n", r, i,
@@ -4297,10 +4297,10 @@ static void iwl_rx_handle(struct iwl_priv *priv)
4297 4297
4298 if (reclaim) { 4298 if (reclaim) {
4299 /* Invoke any callbacks, transfer the skb to caller, 4299 /* Invoke any callbacks, transfer the skb to caller,
4300 * and fire off the (possibly) blocking iwl_send_cmd() 4300 * and fire off the (possibly) blocking iwl3945_send_cmd()
4301 * as we reclaim the driver command queue */ 4301 * as we reclaim the driver command queue */
4302 if (rxb && rxb->skb) 4302 if (rxb && rxb->skb)
4303 iwl_tx_cmd_complete(priv, rxb); 4303 iwl3945_tx_cmd_complete(priv, rxb);
4304 else 4304 else
4305 IWL_WARNING("Claim null rxb?\n"); 4305 IWL_WARNING("Claim null rxb?\n");
4306 } 4306 }
@@ -4324,11 +4324,11 @@ static void iwl_rx_handle(struct iwl_priv *priv)
4324 4324
4325 /* Backtrack one entry */ 4325 /* Backtrack one entry */
4326 priv->rxq.read = i; 4326 priv->rxq.read = i;
4327 iwl_rx_queue_restock(priv); 4327 iwl3945_rx_queue_restock(priv);
4328} 4328}
4329 4329
4330static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, 4330static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv,
4331 struct iwl_tx_queue *txq) 4331 struct iwl3945_tx_queue *txq)
4332{ 4332{
4333 u32 reg = 0; 4333 u32 reg = 0;
4334 int rc = 0; 4334 int rc = 0;
@@ -4342,27 +4342,27 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv,
4342 /* wake up nic if it's powered down ... 4342 /* wake up nic if it's powered down ...
4343 * uCode will wake up, and interrupt us again, so next 4343 * uCode will wake up, and interrupt us again, so next
4344 * time we'll skip this part. */ 4344 * time we'll skip this part. */
4345 reg = iwl_read32(priv, CSR_UCODE_DRV_GP1); 4345 reg = iwl3945_read32(priv, CSR_UCODE_DRV_GP1);
4346 4346
4347 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { 4347 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
4348 IWL_DEBUG_INFO("Requesting wakeup, GP1 = 0x%x\n", reg); 4348 IWL_DEBUG_INFO("Requesting wakeup, GP1 = 0x%x\n", reg);
4349 iwl_set_bit(priv, CSR_GP_CNTRL, 4349 iwl3945_set_bit(priv, CSR_GP_CNTRL,
4350 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 4350 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
4351 return rc; 4351 return rc;
4352 } 4352 }
4353 4353
4354 /* restore this queue's parameters in nic hardware. */ 4354 /* restore this queue's parameters in nic hardware. */
4355 rc = iwl_grab_nic_access(priv); 4355 rc = iwl3945_grab_nic_access(priv);
4356 if (rc) 4356 if (rc)
4357 return rc; 4357 return rc;
4358 iwl_write_direct32(priv, HBUS_TARG_WRPTR, 4358 iwl3945_write_direct32(priv, HBUS_TARG_WRPTR,
4359 txq->q.write_ptr | (txq_id << 8)); 4359 txq->q.write_ptr | (txq_id << 8));
4360 iwl_release_nic_access(priv); 4360 iwl3945_release_nic_access(priv);
4361 4361
4362 /* else not in power-save mode, uCode will never sleep when we're 4362 /* else not in power-save mode, uCode will never sleep when we're
4363 * trying to tx (during RFKILL, we're not trying to tx). */ 4363 * trying to tx (during RFKILL, we're not trying to tx). */
4364 } else 4364 } else
4365 iwl_write32(priv, HBUS_TARG_WRPTR, 4365 iwl3945_write32(priv, HBUS_TARG_WRPTR,
4366 txq->q.write_ptr | (txq_id << 8)); 4366 txq->q.write_ptr | (txq_id << 8));
4367 4367
4368 txq->need_update = 0; 4368 txq->need_update = 0;
@@ -4371,12 +4371,12 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv,
4371} 4371}
4372 4372
4373#ifdef CONFIG_IWL3945_DEBUG 4373#ifdef CONFIG_IWL3945_DEBUG
4374static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon) 4374static void iwl3945_print_rx_config_cmd(struct iwl3945_rxon_cmd *rxon)
4375{ 4375{
4376 DECLARE_MAC_BUF(mac); 4376 DECLARE_MAC_BUF(mac);
4377 4377
4378 IWL_DEBUG_RADIO("RX CONFIG:\n"); 4378 IWL_DEBUG_RADIO("RX CONFIG:\n");
4379 iwl_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); 4379 iwl3945_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
4380 IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); 4380 IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel));
4381 IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); 4381 IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags));
4382 IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n", 4382 IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n",
@@ -4393,24 +4393,24 @@ static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon)
4393} 4393}
4394#endif 4394#endif
4395 4395
4396static void iwl_enable_interrupts(struct iwl_priv *priv) 4396static void iwl3945_enable_interrupts(struct iwl3945_priv *priv)
4397{ 4397{
4398 IWL_DEBUG_ISR("Enabling interrupts\n"); 4398 IWL_DEBUG_ISR("Enabling interrupts\n");
4399 set_bit(STATUS_INT_ENABLED, &priv->status); 4399 set_bit(STATUS_INT_ENABLED, &priv->status);
4400 iwl_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK); 4400 iwl3945_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK);
4401} 4401}
4402 4402
4403static inline void iwl_disable_interrupts(struct iwl_priv *priv) 4403static inline void iwl3945_disable_interrupts(struct iwl3945_priv *priv)
4404{ 4404{
4405 clear_bit(STATUS_INT_ENABLED, &priv->status); 4405 clear_bit(STATUS_INT_ENABLED, &priv->status);
4406 4406
4407 /* disable interrupts from uCode/NIC to host */ 4407 /* disable interrupts from uCode/NIC to host */
4408 iwl_write32(priv, CSR_INT_MASK, 0x00000000); 4408 iwl3945_write32(priv, CSR_INT_MASK, 0x00000000);
4409 4409
4410 /* acknowledge/clear/reset any interrupts still pending 4410 /* acknowledge/clear/reset any interrupts still pending
4411 * from uCode or flow handler (Rx/Tx DMA) */ 4411 * from uCode or flow handler (Rx/Tx DMA) */
4412 iwl_write32(priv, CSR_INT, 0xffffffff); 4412 iwl3945_write32(priv, CSR_INT, 0xffffffff);
4413 iwl_write32(priv, CSR_FH_INT_STATUS, 0xffffffff); 4413 iwl3945_write32(priv, CSR_FH_INT_STATUS, 0xffffffff);
4414 IWL_DEBUG_ISR("Disabled interrupts\n"); 4414 IWL_DEBUG_ISR("Disabled interrupts\n");
4415} 4415}
4416 4416
@@ -4437,7 +4437,7 @@ static const char *desc_lookup(int i)
4437#define ERROR_START_OFFSET (1 * sizeof(u32)) 4437#define ERROR_START_OFFSET (1 * sizeof(u32))
4438#define ERROR_ELEM_SIZE (7 * sizeof(u32)) 4438#define ERROR_ELEM_SIZE (7 * sizeof(u32))
4439 4439
4440static void iwl_dump_nic_error_log(struct iwl_priv *priv) 4440static void iwl3945_dump_nic_error_log(struct iwl3945_priv *priv)
4441{ 4441{
4442 u32 i; 4442 u32 i;
4443 u32 desc, time, count, base, data1; 4443 u32 desc, time, count, base, data1;
@@ -4446,18 +4446,18 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv)
4446 4446
4447 base = le32_to_cpu(priv->card_alive.error_event_table_ptr); 4447 base = le32_to_cpu(priv->card_alive.error_event_table_ptr);
4448 4448
4449 if (!iwl_hw_valid_rtc_data_addr(base)) { 4449 if (!iwl3945_hw_valid_rtc_data_addr(base)) {
4450 IWL_ERROR("Not valid error log pointer 0x%08X\n", base); 4450 IWL_ERROR("Not valid error log pointer 0x%08X\n", base);
4451 return; 4451 return;
4452 } 4452 }
4453 4453
4454 rc = iwl_grab_nic_access(priv); 4454 rc = iwl3945_grab_nic_access(priv);
4455 if (rc) { 4455 if (rc) {
4456 IWL_WARNING("Can not read from adapter at this time.\n"); 4456 IWL_WARNING("Can not read from adapter at this time.\n");
4457 return; 4457 return;
4458 } 4458 }
4459 4459
4460 count = iwl_read_targ_mem(priv, base); 4460 count = iwl3945_read_targ_mem(priv, base);
4461 4461
4462 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { 4462 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
4463 IWL_ERROR("Start IWL Error Log Dump:\n"); 4463 IWL_ERROR("Start IWL Error Log Dump:\n");
@@ -4470,19 +4470,19 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv)
4470 for (i = ERROR_START_OFFSET; 4470 for (i = ERROR_START_OFFSET;
4471 i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET; 4471 i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET;
4472 i += ERROR_ELEM_SIZE) { 4472 i += ERROR_ELEM_SIZE) {
4473 desc = iwl_read_targ_mem(priv, base + i); 4473 desc = iwl3945_read_targ_mem(priv, base + i);
4474 time = 4474 time =
4475 iwl_read_targ_mem(priv, base + i + 1 * sizeof(u32)); 4475 iwl3945_read_targ_mem(priv, base + i + 1 * sizeof(u32));
4476 blink1 = 4476 blink1 =
4477 iwl_read_targ_mem(priv, base + i + 2 * sizeof(u32)); 4477 iwl3945_read_targ_mem(priv, base + i + 2 * sizeof(u32));
4478 blink2 = 4478 blink2 =
4479 iwl_read_targ_mem(priv, base + i + 3 * sizeof(u32)); 4479 iwl3945_read_targ_mem(priv, base + i + 3 * sizeof(u32));
4480 ilink1 = 4480 ilink1 =
4481 iwl_read_targ_mem(priv, base + i + 4 * sizeof(u32)); 4481 iwl3945_read_targ_mem(priv, base + i + 4 * sizeof(u32));
4482 ilink2 = 4482 ilink2 =
4483 iwl_read_targ_mem(priv, base + i + 5 * sizeof(u32)); 4483 iwl3945_read_targ_mem(priv, base + i + 5 * sizeof(u32));
4484 data1 = 4484 data1 =
4485 iwl_read_targ_mem(priv, base + i + 6 * sizeof(u32)); 4485 iwl3945_read_targ_mem(priv, base + i + 6 * sizeof(u32));
4486 4486
4487 IWL_ERROR 4487 IWL_ERROR
4488 ("%-13s (#%d) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n", 4488 ("%-13s (#%d) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n",
@@ -4490,18 +4490,18 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv)
4490 ilink1, ilink2, data1); 4490 ilink1, ilink2, data1);
4491 } 4491 }
4492 4492
4493 iwl_release_nic_access(priv); 4493 iwl3945_release_nic_access(priv);
4494 4494
4495} 4495}
4496 4496
4497#define EVENT_START_OFFSET (4 * sizeof(u32)) 4497#define EVENT_START_OFFSET (4 * sizeof(u32))
4498 4498
4499/** 4499/**
4500 * iwl_print_event_log - Dump error event log to syslog 4500 * iwl3945_print_event_log - Dump error event log to syslog
4501 * 4501 *
4502 * NOTE: Must be called with iwl_grab_nic_access() already obtained! 4502 * NOTE: Must be called with iwl3945_grab_nic_access() already obtained!
4503 */ 4503 */
4504static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, 4504static void iwl3945_print_event_log(struct iwl3945_priv *priv, u32 start_idx,
4505 u32 num_events, u32 mode) 4505 u32 num_events, u32 mode)
4506{ 4506{
4507 u32 i; 4507 u32 i;
@@ -4525,21 +4525,21 @@ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx,
4525 /* "time" is actually "data" for mode 0 (no timestamp). 4525 /* "time" is actually "data" for mode 0 (no timestamp).
4526 * place event id # at far right for easier visual parsing. */ 4526 * place event id # at far right for easier visual parsing. */
4527 for (i = 0; i < num_events; i++) { 4527 for (i = 0; i < num_events; i++) {
4528 ev = iwl_read_targ_mem(priv, ptr); 4528 ev = iwl3945_read_targ_mem(priv, ptr);
4529 ptr += sizeof(u32); 4529 ptr += sizeof(u32);
4530 time = iwl_read_targ_mem(priv, ptr); 4530 time = iwl3945_read_targ_mem(priv, ptr);
4531 ptr += sizeof(u32); 4531 ptr += sizeof(u32);
4532 if (mode == 0) 4532 if (mode == 0)
4533 IWL_ERROR("0x%08x\t%04u\n", time, ev); /* data, ev */ 4533 IWL_ERROR("0x%08x\t%04u\n", time, ev); /* data, ev */
4534 else { 4534 else {
4535 data = iwl_read_targ_mem(priv, ptr); 4535 data = iwl3945_read_targ_mem(priv, ptr);
4536 ptr += sizeof(u32); 4536 ptr += sizeof(u32);
4537 IWL_ERROR("%010u\t0x%08x\t%04u\n", time, data, ev); 4537 IWL_ERROR("%010u\t0x%08x\t%04u\n", time, data, ev);
4538 } 4538 }
4539 } 4539 }
4540} 4540}
4541 4541
4542static void iwl_dump_nic_event_log(struct iwl_priv *priv) 4542static void iwl3945_dump_nic_event_log(struct iwl3945_priv *priv)
4543{ 4543{
4544 int rc; 4544 int rc;
4545 u32 base; /* SRAM byte address of event log header */ 4545 u32 base; /* SRAM byte address of event log header */
@@ -4550,29 +4550,29 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv)
4550 u32 size; /* # entries that we'll print */ 4550 u32 size; /* # entries that we'll print */
4551 4551
4552 base = le32_to_cpu(priv->card_alive.log_event_table_ptr); 4552 base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
4553 if (!iwl_hw_valid_rtc_data_addr(base)) { 4553 if (!iwl3945_hw_valid_rtc_data_addr(base)) {
4554 IWL_ERROR("Invalid event log pointer 0x%08X\n", base); 4554 IWL_ERROR("Invalid event log pointer 0x%08X\n", base);
4555 return; 4555 return;
4556 } 4556 }
4557 4557
4558 rc = iwl_grab_nic_access(priv); 4558 rc = iwl3945_grab_nic_access(priv);
4559 if (rc) { 4559 if (rc) {
4560 IWL_WARNING("Can not read from adapter at this time.\n"); 4560 IWL_WARNING("Can not read from adapter at this time.\n");
4561 return; 4561 return;
4562 } 4562 }
4563 4563
4564 /* event log header */ 4564 /* event log header */
4565 capacity = iwl_read_targ_mem(priv, base); 4565 capacity = iwl3945_read_targ_mem(priv, base);
4566 mode = iwl_read_targ_mem(priv, base + (1 * sizeof(u32))); 4566 mode = iwl3945_read_targ_mem(priv, base + (1 * sizeof(u32)));
4567 num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32))); 4567 num_wraps = iwl3945_read_targ_mem(priv, base + (2 * sizeof(u32)));
4568 next_entry = iwl_read_targ_mem(priv, base + (3 * sizeof(u32))); 4568 next_entry = iwl3945_read_targ_mem(priv, base + (3 * sizeof(u32)));
4569 4569
4570 size = num_wraps ? capacity : next_entry; 4570 size = num_wraps ? capacity : next_entry;
4571 4571
4572 /* bail out if nothing in log */ 4572 /* bail out if nothing in log */
4573 if (size == 0) { 4573 if (size == 0) {
4574 IWL_ERROR("Start IWL Event Log Dump: nothing in log\n"); 4574 IWL_ERROR("Start IWL Event Log Dump: nothing in log\n");
4575 iwl_release_nic_access(priv); 4575 iwl3945_release_nic_access(priv);
4576 return; 4576 return;
4577 } 4577 }
4578 4578
@@ -4582,31 +4582,31 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv)
4582 /* if uCode has wrapped back to top of log, start at the oldest entry, 4582 /* if uCode has wrapped back to top of log, start at the oldest entry,
4583 * i.e the next one that uCode would fill. */ 4583 * i.e the next one that uCode would fill. */
4584 if (num_wraps) 4584 if (num_wraps)
4585 iwl_print_event_log(priv, next_entry, 4585 iwl3945_print_event_log(priv, next_entry,
4586 capacity - next_entry, mode); 4586 capacity - next_entry, mode);
4587 4587
4588 /* (then/else) start at top of log */ 4588 /* (then/else) start at top of log */
4589 iwl_print_event_log(priv, 0, next_entry, mode); 4589 iwl3945_print_event_log(priv, 0, next_entry, mode);
4590 4590
4591 iwl_release_nic_access(priv); 4591 iwl3945_release_nic_access(priv);
4592} 4592}
4593 4593
4594/** 4594/**
4595 * iwl_irq_handle_error - called for HW or SW error interrupt from card 4595 * iwl3945_irq_handle_error - called for HW or SW error interrupt from card
4596 */ 4596 */
4597static void iwl_irq_handle_error(struct iwl_priv *priv) 4597static void iwl3945_irq_handle_error(struct iwl3945_priv *priv)
4598{ 4598{
4599 /* Set the FW error flag -- cleared on iwl_down */ 4599 /* Set the FW error flag -- cleared on iwl3945_down */
4600 set_bit(STATUS_FW_ERROR, &priv->status); 4600 set_bit(STATUS_FW_ERROR, &priv->status);
4601 4601
4602 /* Cancel currently queued command. */ 4602 /* Cancel currently queued command. */
4603 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 4603 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
4604 4604
4605#ifdef CONFIG_IWL3945_DEBUG 4605#ifdef CONFIG_IWL3945_DEBUG
4606 if (iwl_debug_level & IWL_DL_FW_ERRORS) { 4606 if (iwl3945_debug_level & IWL_DL_FW_ERRORS) {
4607 iwl_dump_nic_error_log(priv); 4607 iwl3945_dump_nic_error_log(priv);
4608 iwl_dump_nic_event_log(priv); 4608 iwl3945_dump_nic_event_log(priv);
4609 iwl_print_rx_config_cmd(&priv->staging_rxon); 4609 iwl3945_print_rx_config_cmd(&priv->staging_rxon);
4610 } 4610 }
4611#endif 4611#endif
4612 4612
@@ -4620,7 +4620,7 @@ static void iwl_irq_handle_error(struct iwl_priv *priv)
4620 IWL_DEBUG(IWL_DL_INFO | IWL_DL_FW_ERRORS, 4620 IWL_DEBUG(IWL_DL_INFO | IWL_DL_FW_ERRORS,
4621 "Restarting adapter due to uCode error.\n"); 4621 "Restarting adapter due to uCode error.\n");
4622 4622
4623 if (iwl_is_associated(priv)) { 4623 if (iwl3945_is_associated(priv)) {
4624 memcpy(&priv->recovery_rxon, &priv->active_rxon, 4624 memcpy(&priv->recovery_rxon, &priv->active_rxon,
4625 sizeof(priv->recovery_rxon)); 4625 sizeof(priv->recovery_rxon));
4626 priv->error_recovering = 1; 4626 priv->error_recovering = 1;
@@ -4629,16 +4629,16 @@ static void iwl_irq_handle_error(struct iwl_priv *priv)
4629 } 4629 }
4630} 4630}
4631 4631
4632static void iwl_error_recovery(struct iwl_priv *priv) 4632static void iwl3945_error_recovery(struct iwl3945_priv *priv)
4633{ 4633{
4634 unsigned long flags; 4634 unsigned long flags;
4635 4635
4636 memcpy(&priv->staging_rxon, &priv->recovery_rxon, 4636 memcpy(&priv->staging_rxon, &priv->recovery_rxon,
4637 sizeof(priv->staging_rxon)); 4637 sizeof(priv->staging_rxon));
4638 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 4638 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
4639 iwl_commit_rxon(priv); 4639 iwl3945_commit_rxon(priv);
4640 4640
4641 iwl_add_station(priv, priv->bssid, 1, 0); 4641 iwl3945_add_station(priv, priv->bssid, 1, 0);
4642 4642
4643 spin_lock_irqsave(&priv->lock, flags); 4643 spin_lock_irqsave(&priv->lock, flags);
4644 priv->assoc_id = le16_to_cpu(priv->staging_rxon.assoc_id); 4644 priv->assoc_id = le16_to_cpu(priv->staging_rxon.assoc_id);
@@ -4646,7 +4646,7 @@ static void iwl_error_recovery(struct iwl_priv *priv)
4646 spin_unlock_irqrestore(&priv->lock, flags); 4646 spin_unlock_irqrestore(&priv->lock, flags);
4647} 4647}
4648 4648
4649static void iwl_irq_tasklet(struct iwl_priv *priv) 4649static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
4650{ 4650{
4651 u32 inta, handled = 0; 4651 u32 inta, handled = 0;
4652 u32 inta_fh; 4652 u32 inta_fh;
@@ -4660,18 +4660,18 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4660 /* Ack/clear/reset pending uCode interrupts. 4660 /* Ack/clear/reset pending uCode interrupts.
4661 * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, 4661 * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS,
4662 * and will clear only when CSR_FH_INT_STATUS gets cleared. */ 4662 * and will clear only when CSR_FH_INT_STATUS gets cleared. */
4663 inta = iwl_read32(priv, CSR_INT); 4663 inta = iwl3945_read32(priv, CSR_INT);
4664 iwl_write32(priv, CSR_INT, inta); 4664 iwl3945_write32(priv, CSR_INT, inta);
4665 4665
4666 /* Ack/clear/reset pending flow-handler (DMA) interrupts. 4666 /* Ack/clear/reset pending flow-handler (DMA) interrupts.
4667 * Any new interrupts that happen after this, either while we're 4667 * Any new interrupts that happen after this, either while we're
4668 * in this tasklet, or later, will show up in next ISR/tasklet. */ 4668 * in this tasklet, or later, will show up in next ISR/tasklet. */
4669 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 4669 inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS);
4670 iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh); 4670 iwl3945_write32(priv, CSR_FH_INT_STATUS, inta_fh);
4671 4671
4672#ifdef CONFIG_IWL3945_DEBUG 4672#ifdef CONFIG_IWL3945_DEBUG
4673 if (iwl_debug_level & IWL_DL_ISR) { 4673 if (iwl3945_debug_level & IWL_DL_ISR) {
4674 inta_mask = iwl_read32(priv, CSR_INT_MASK); /* just for debug */ 4674 inta_mask = iwl3945_read32(priv, CSR_INT_MASK); /* just for debug */
4675 IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 4675 IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
4676 inta, inta_mask, inta_fh); 4676 inta, inta_mask, inta_fh);
4677 } 4677 }
@@ -4691,9 +4691,9 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4691 IWL_ERROR("Microcode HW error detected. Restarting.\n"); 4691 IWL_ERROR("Microcode HW error detected. Restarting.\n");
4692 4692
4693 /* Tell the device to stop sending interrupts */ 4693 /* Tell the device to stop sending interrupts */
4694 iwl_disable_interrupts(priv); 4694 iwl3945_disable_interrupts(priv);
4695 4695
4696 iwl_irq_handle_error(priv); 4696 iwl3945_irq_handle_error(priv);
4697 4697
4698 handled |= CSR_INT_BIT_HW_ERR; 4698 handled |= CSR_INT_BIT_HW_ERR;
4699 4699
@@ -4703,7 +4703,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4703 } 4703 }
4704 4704
4705#ifdef CONFIG_IWL3945_DEBUG 4705#ifdef CONFIG_IWL3945_DEBUG
4706 if (iwl_debug_level & (IWL_DL_ISR)) { 4706 if (iwl3945_debug_level & (IWL_DL_ISR)) {
4707 /* NIC fires this, but we don't use it, redundant with WAKEUP */ 4707 /* NIC fires this, but we don't use it, redundant with WAKEUP */
4708 if (inta & CSR_INT_BIT_MAC_CLK_ACTV) 4708 if (inta & CSR_INT_BIT_MAC_CLK_ACTV)
4709 IWL_DEBUG_ISR("Microcode started or stopped.\n"); 4709 IWL_DEBUG_ISR("Microcode started or stopped.\n");
@@ -4719,7 +4719,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4719 /* HW RF KILL switch toggled (4965 only) */ 4719 /* HW RF KILL switch toggled (4965 only) */
4720 if (inta & CSR_INT_BIT_RF_KILL) { 4720 if (inta & CSR_INT_BIT_RF_KILL) {
4721 int hw_rf_kill = 0; 4721 int hw_rf_kill = 0;
4722 if (!(iwl_read32(priv, CSR_GP_CNTRL) & 4722 if (!(iwl3945_read32(priv, CSR_GP_CNTRL) &
4723 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) 4723 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW))
4724 hw_rf_kill = 1; 4724 hw_rf_kill = 1;
4725 4725
@@ -4749,20 +4749,20 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4749 if (inta & CSR_INT_BIT_SW_ERR) { 4749 if (inta & CSR_INT_BIT_SW_ERR) {
4750 IWL_ERROR("Microcode SW error detected. Restarting 0x%X.\n", 4750 IWL_ERROR("Microcode SW error detected. Restarting 0x%X.\n",
4751 inta); 4751 inta);
4752 iwl_irq_handle_error(priv); 4752 iwl3945_irq_handle_error(priv);
4753 handled |= CSR_INT_BIT_SW_ERR; 4753 handled |= CSR_INT_BIT_SW_ERR;
4754 } 4754 }
4755 4755
4756 /* uCode wakes up after power-down sleep */ 4756 /* uCode wakes up after power-down sleep */
4757 if (inta & CSR_INT_BIT_WAKEUP) { 4757 if (inta & CSR_INT_BIT_WAKEUP) {
4758 IWL_DEBUG_ISR("Wakeup interrupt\n"); 4758 IWL_DEBUG_ISR("Wakeup interrupt\n");
4759 iwl_rx_queue_update_write_ptr(priv, &priv->rxq); 4759 iwl3945_rx_queue_update_write_ptr(priv, &priv->rxq);
4760 iwl_tx_queue_update_write_ptr(priv, &priv->txq[0]); 4760 iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[0]);
4761 iwl_tx_queue_update_write_ptr(priv, &priv->txq[1]); 4761 iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[1]);
4762 iwl_tx_queue_update_write_ptr(priv, &priv->txq[2]); 4762 iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[2]);
4763 iwl_tx_queue_update_write_ptr(priv, &priv->txq[3]); 4763 iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[3]);
4764 iwl_tx_queue_update_write_ptr(priv, &priv->txq[4]); 4764 iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[4]);
4765 iwl_tx_queue_update_write_ptr(priv, &priv->txq[5]); 4765 iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[5]);
4766 4766
4767 handled |= CSR_INT_BIT_WAKEUP; 4767 handled |= CSR_INT_BIT_WAKEUP;
4768 } 4768 }
@@ -4771,19 +4771,19 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4771 * Rx "responses" (frame-received notification), and other 4771 * Rx "responses" (frame-received notification), and other
4772 * notifications from uCode come through here*/ 4772 * notifications from uCode come through here*/
4773 if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { 4773 if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) {
4774 iwl_rx_handle(priv); 4774 iwl3945_rx_handle(priv);
4775 handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); 4775 handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX);
4776 } 4776 }
4777 4777
4778 if (inta & CSR_INT_BIT_FH_TX) { 4778 if (inta & CSR_INT_BIT_FH_TX) {
4779 IWL_DEBUG_ISR("Tx interrupt\n"); 4779 IWL_DEBUG_ISR("Tx interrupt\n");
4780 4780
4781 iwl_write32(priv, CSR_FH_INT_STATUS, (1 << 6)); 4781 iwl3945_write32(priv, CSR_FH_INT_STATUS, (1 << 6));
4782 if (!iwl_grab_nic_access(priv)) { 4782 if (!iwl3945_grab_nic_access(priv)) {
4783 iwl_write_direct32(priv, 4783 iwl3945_write_direct32(priv,
4784 FH_TCSR_CREDIT 4784 FH_TCSR_CREDIT
4785 (ALM_FH_SRVC_CHNL), 0x0); 4785 (ALM_FH_SRVC_CHNL), 0x0);
4786 iwl_release_nic_access(priv); 4786 iwl3945_release_nic_access(priv);
4787 } 4787 }
4788 handled |= CSR_INT_BIT_FH_TX; 4788 handled |= CSR_INT_BIT_FH_TX;
4789 } 4789 }
@@ -4798,13 +4798,13 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4798 } 4798 }
4799 4799
4800 /* Re-enable all interrupts */ 4800 /* Re-enable all interrupts */
4801 iwl_enable_interrupts(priv); 4801 iwl3945_enable_interrupts(priv);
4802 4802
4803#ifdef CONFIG_IWL3945_DEBUG 4803#ifdef CONFIG_IWL3945_DEBUG
4804 if (iwl_debug_level & (IWL_DL_ISR)) { 4804 if (iwl3945_debug_level & (IWL_DL_ISR)) {
4805 inta = iwl_read32(priv, CSR_INT); 4805 inta = iwl3945_read32(priv, CSR_INT);
4806 inta_mask = iwl_read32(priv, CSR_INT_MASK); 4806 inta_mask = iwl3945_read32(priv, CSR_INT_MASK);
4807 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 4807 inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS);
4808 IWL_DEBUG_ISR("End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " 4808 IWL_DEBUG_ISR("End inta 0x%08x, enabled 0x%08x, fh 0x%08x, "
4809 "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); 4809 "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags);
4810 } 4810 }
@@ -4812,9 +4812,9 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4812 spin_unlock_irqrestore(&priv->lock, flags); 4812 spin_unlock_irqrestore(&priv->lock, flags);
4813} 4813}
4814 4814
4815static irqreturn_t iwl_isr(int irq, void *data) 4815static irqreturn_t iwl3945_isr(int irq, void *data)
4816{ 4816{
4817 struct iwl_priv *priv = data; 4817 struct iwl3945_priv *priv = data;
4818 u32 inta, inta_mask; 4818 u32 inta, inta_mask;
4819 u32 inta_fh; 4819 u32 inta_fh;
4820 if (!priv) 4820 if (!priv)
@@ -4826,12 +4826,12 @@ static irqreturn_t iwl_isr(int irq, void *data)
4826 * back-to-back ISRs and sporadic interrupts from our NIC. 4826 * back-to-back ISRs and sporadic interrupts from our NIC.
4827 * If we have something to service, the tasklet will re-enable ints. 4827 * If we have something to service, the tasklet will re-enable ints.
4828 * If we *don't* have something, we'll re-enable before leaving here. */ 4828 * If we *don't* have something, we'll re-enable before leaving here. */
4829 inta_mask = iwl_read32(priv, CSR_INT_MASK); /* just for debug */ 4829 inta_mask = iwl3945_read32(priv, CSR_INT_MASK); /* just for debug */
4830 iwl_write32(priv, CSR_INT_MASK, 0x00000000); 4830 iwl3945_write32(priv, CSR_INT_MASK, 0x00000000);
4831 4831
4832 /* Discover which interrupts are active/pending */ 4832 /* Discover which interrupts are active/pending */
4833 inta = iwl_read32(priv, CSR_INT); 4833 inta = iwl3945_read32(priv, CSR_INT);
4834 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 4834 inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS);
4835 4835
4836 /* Ignore interrupt if there's nothing in NIC to service. 4836 /* Ignore interrupt if there's nothing in NIC to service.
4837 * This may be due to IRQ shared with another device, 4837 * This may be due to IRQ shared with another device,
@@ -4850,7 +4850,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
4850 IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 4850 IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
4851 inta, inta_mask, inta_fh); 4851 inta, inta_mask, inta_fh);
4852 4852
4853 /* iwl_irq_tasklet() will service interrupts and re-enable them */ 4853 /* iwl3945_irq_tasklet() will service interrupts and re-enable them */
4854 tasklet_schedule(&priv->irq_tasklet); 4854 tasklet_schedule(&priv->irq_tasklet);
4855unplugged: 4855unplugged:
4856 spin_unlock(&priv->lock); 4856 spin_unlock(&priv->lock);
@@ -4859,18 +4859,18 @@ unplugged:
4859 4859
4860 none: 4860 none:
4861 /* re-enable interrupts here since we don't have anything to service. */ 4861 /* re-enable interrupts here since we don't have anything to service. */
4862 iwl_enable_interrupts(priv); 4862 iwl3945_enable_interrupts(priv);
4863 spin_unlock(&priv->lock); 4863 spin_unlock(&priv->lock);
4864 return IRQ_NONE; 4864 return IRQ_NONE;
4865} 4865}
4866 4866
4867/************************** EEPROM BANDS **************************** 4867/************************** EEPROM BANDS ****************************
4868 * 4868 *
4869 * The iwl_eeprom_band definitions below provide the mapping from the 4869 * The iwl3945_eeprom_band definitions below provide the mapping from the
4870 * EEPROM contents to the specific channel number supported for each 4870 * EEPROM contents to the specific channel number supported for each
4871 * band. 4871 * band.
4872 * 4872 *
4873 * For example, iwl_priv->eeprom.band_3_channels[4] from the band_3 4873 * For example, iwl3945_priv->eeprom.band_3_channels[4] from the band_3
4874 * definition below maps to physical channel 42 in the 5.2GHz spectrum. 4874 * definition below maps to physical channel 42 in the 5.2GHz spectrum.
4875 * The specific geography and calibration information for that channel 4875 * The specific geography and calibration information for that channel
4876 * is contained in the eeprom map itself. 4876 * is contained in the eeprom map itself.
@@ -4896,58 +4896,58 @@ unplugged:
4896 *********************************************************************/ 4896 *********************************************************************/
4897 4897
4898/* 2.4 GHz */ 4898/* 2.4 GHz */
4899static const u8 iwl_eeprom_band_1[14] = { 4899static const u8 iwl3945_eeprom_band_1[14] = {
4900 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 4900 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
4901}; 4901};
4902 4902
4903/* 5.2 GHz bands */ 4903/* 5.2 GHz bands */
4904static const u8 iwl_eeprom_band_2[] = { 4904static const u8 iwl3945_eeprom_band_2[] = {
4905 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16 4905 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16
4906}; 4906};
4907 4907
4908static const u8 iwl_eeprom_band_3[] = { /* 5205-5320MHz */ 4908static const u8 iwl3945_eeprom_band_3[] = { /* 5205-5320MHz */
4909 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 4909 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
4910}; 4910};
4911 4911
4912static const u8 iwl_eeprom_band_4[] = { /* 5500-5700MHz */ 4912static const u8 iwl3945_eeprom_band_4[] = { /* 5500-5700MHz */
4913 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 4913 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
4914}; 4914};
4915 4915
4916static const u8 iwl_eeprom_band_5[] = { /* 5725-5825MHz */ 4916static const u8 iwl3945_eeprom_band_5[] = { /* 5725-5825MHz */
4917 145, 149, 153, 157, 161, 165 4917 145, 149, 153, 157, 161, 165
4918}; 4918};
4919 4919
4920static void iwl_init_band_reference(const struct iwl_priv *priv, int band, 4920static void iwl3945_init_band_reference(const struct iwl3945_priv *priv, int band,
4921 int *eeprom_ch_count, 4921 int *eeprom_ch_count,
4922 const struct iwl_eeprom_channel 4922 const struct iwl3945_eeprom_channel
4923 **eeprom_ch_info, 4923 **eeprom_ch_info,
4924 const u8 **eeprom_ch_index) 4924 const u8 **eeprom_ch_index)
4925{ 4925{
4926 switch (band) { 4926 switch (band) {
4927 case 1: /* 2.4GHz band */ 4927 case 1: /* 2.4GHz band */
4928 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_1); 4928 *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_1);
4929 *eeprom_ch_info = priv->eeprom.band_1_channels; 4929 *eeprom_ch_info = priv->eeprom.band_1_channels;
4930 *eeprom_ch_index = iwl_eeprom_band_1; 4930 *eeprom_ch_index = iwl3945_eeprom_band_1;
4931 break; 4931 break;
4932 case 2: /* 5.2GHz band */ 4932 case 2: /* 5.2GHz band */
4933 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_2); 4933 *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_2);
4934 *eeprom_ch_info = priv->eeprom.band_2_channels; 4934 *eeprom_ch_info = priv->eeprom.band_2_channels;
4935 *eeprom_ch_index = iwl_eeprom_band_2; 4935 *eeprom_ch_index = iwl3945_eeprom_band_2;
4936 break; 4936 break;
4937 case 3: /* 5.2GHz band */ 4937 case 3: /* 5.2GHz band */
4938 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_3); 4938 *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_3);
4939 *eeprom_ch_info = priv->eeprom.band_3_channels; 4939 *eeprom_ch_info = priv->eeprom.band_3_channels;
4940 *eeprom_ch_index = iwl_eeprom_band_3; 4940 *eeprom_ch_index = iwl3945_eeprom_band_3;
4941 break; 4941 break;
4942 case 4: /* 5.2GHz band */ 4942 case 4: /* 5.2GHz band */
4943 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_4); 4943 *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_4);
4944 *eeprom_ch_info = priv->eeprom.band_4_channels; 4944 *eeprom_ch_info = priv->eeprom.band_4_channels;
4945 *eeprom_ch_index = iwl_eeprom_band_4; 4945 *eeprom_ch_index = iwl3945_eeprom_band_4;
4946 break; 4946 break;
4947 case 5: /* 5.2GHz band */ 4947 case 5: /* 5.2GHz band */
4948 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_5); 4948 *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_5);
4949 *eeprom_ch_info = priv->eeprom.band_5_channels; 4949 *eeprom_ch_info = priv->eeprom.band_5_channels;
4950 *eeprom_ch_index = iwl_eeprom_band_5; 4950 *eeprom_ch_index = iwl3945_eeprom_band_5;
4951 break; 4951 break;
4952 default: 4952 default:
4953 BUG(); 4953 BUG();
@@ -4955,7 +4955,7 @@ static void iwl_init_band_reference(const struct iwl_priv *priv, int band,
4955 } 4955 }
4956} 4956}
4957 4957
4958const struct iwl_channel_info *iwl_get_channel_info(const struct iwl_priv *priv, 4958const struct iwl3945_channel_info *iwl3945_get_channel_info(const struct iwl3945_priv *priv,
4959 int phymode, u16 channel) 4959 int phymode, u16 channel)
4960{ 4960{
4961 int i; 4961 int i;
@@ -4982,13 +4982,13 @@ const struct iwl_channel_info *iwl_get_channel_info(const struct iwl_priv *priv,
4982#define CHECK_AND_PRINT(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \ 4982#define CHECK_AND_PRINT(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \
4983 ? # x " " : "") 4983 ? # x " " : "")
4984 4984
4985static int iwl_init_channel_map(struct iwl_priv *priv) 4985static int iwl3945_init_channel_map(struct iwl3945_priv *priv)
4986{ 4986{
4987 int eeprom_ch_count = 0; 4987 int eeprom_ch_count = 0;
4988 const u8 *eeprom_ch_index = NULL; 4988 const u8 *eeprom_ch_index = NULL;
4989 const struct iwl_eeprom_channel *eeprom_ch_info = NULL; 4989 const struct iwl3945_eeprom_channel *eeprom_ch_info = NULL;
4990 int band, ch; 4990 int band, ch;
4991 struct iwl_channel_info *ch_info; 4991 struct iwl3945_channel_info *ch_info;
4992 4992
4993 if (priv->channel_count) { 4993 if (priv->channel_count) {
4994 IWL_DEBUG_INFO("Channel map already initialized.\n"); 4994 IWL_DEBUG_INFO("Channel map already initialized.\n");
@@ -5004,15 +5004,15 @@ static int iwl_init_channel_map(struct iwl_priv *priv)
5004 IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n"); 5004 IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n");
5005 5005
5006 priv->channel_count = 5006 priv->channel_count =
5007 ARRAY_SIZE(iwl_eeprom_band_1) + 5007 ARRAY_SIZE(iwl3945_eeprom_band_1) +
5008 ARRAY_SIZE(iwl_eeprom_band_2) + 5008 ARRAY_SIZE(iwl3945_eeprom_band_2) +
5009 ARRAY_SIZE(iwl_eeprom_band_3) + 5009 ARRAY_SIZE(iwl3945_eeprom_band_3) +
5010 ARRAY_SIZE(iwl_eeprom_band_4) + 5010 ARRAY_SIZE(iwl3945_eeprom_band_4) +
5011 ARRAY_SIZE(iwl_eeprom_band_5); 5011 ARRAY_SIZE(iwl3945_eeprom_band_5);
5012 5012
5013 IWL_DEBUG_INFO("Parsing data for %d channels.\n", priv->channel_count); 5013 IWL_DEBUG_INFO("Parsing data for %d channels.\n", priv->channel_count);
5014 5014
5015 priv->channel_info = kzalloc(sizeof(struct iwl_channel_info) * 5015 priv->channel_info = kzalloc(sizeof(struct iwl3945_channel_info) *
5016 priv->channel_count, GFP_KERNEL); 5016 priv->channel_count, GFP_KERNEL);
5017 if (!priv->channel_info) { 5017 if (!priv->channel_info) {
5018 IWL_ERROR("Could not allocate channel_info\n"); 5018 IWL_ERROR("Could not allocate channel_info\n");
@@ -5027,7 +5027,7 @@ static int iwl_init_channel_map(struct iwl_priv *priv)
5027 * what just in the EEPROM) */ 5027 * what just in the EEPROM) */
5028 for (band = 1; band <= 5; band++) { 5028 for (band = 1; band <= 5; band++) {
5029 5029
5030 iwl_init_band_reference(priv, band, &eeprom_ch_count, 5030 iwl3945_init_band_reference(priv, band, &eeprom_ch_count,
5031 &eeprom_ch_info, &eeprom_ch_index); 5031 &eeprom_ch_info, &eeprom_ch_index);
5032 5032
5033 /* Loop through each band adding each of the channels */ 5033 /* Loop through each band adding each of the channels */
@@ -5120,7 +5120,7 @@ static int iwl_init_channel_map(struct iwl_priv *priv)
5120#define IWL_PASSIVE_DWELL_BASE (100) 5120#define IWL_PASSIVE_DWELL_BASE (100)
5121#define IWL_CHANNEL_TUNE_TIME 5 5121#define IWL_CHANNEL_TUNE_TIME 5
5122 5122
5123static inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv, int phymode) 5123static inline u16 iwl3945_get_active_dwell_time(struct iwl3945_priv *priv, int phymode)
5124{ 5124{
5125 if (phymode == MODE_IEEE80211A) 5125 if (phymode == MODE_IEEE80211A)
5126 return IWL_ACTIVE_DWELL_TIME_52; 5126 return IWL_ACTIVE_DWELL_TIME_52;
@@ -5128,14 +5128,14 @@ static inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv, int phymode)
5128 return IWL_ACTIVE_DWELL_TIME_24; 5128 return IWL_ACTIVE_DWELL_TIME_24;
5129} 5129}
5130 5130
5131static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, int phymode) 5131static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv, int phymode)
5132{ 5132{
5133 u16 active = iwl_get_active_dwell_time(priv, phymode); 5133 u16 active = iwl3945_get_active_dwell_time(priv, phymode);
5134 u16 passive = (phymode != MODE_IEEE80211A) ? 5134 u16 passive = (phymode != MODE_IEEE80211A) ?
5135 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : 5135 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 :
5136 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; 5136 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52;
5137 5137
5138 if (iwl_is_associated(priv)) { 5138 if (iwl3945_is_associated(priv)) {
5139 /* If we're associated, we clamp the maximum passive 5139 /* If we're associated, we clamp the maximum passive
5140 * dwell time to be 98% of the beacon interval (minus 5140 * dwell time to be 98% of the beacon interval (minus
5141 * 2 * channel tune time) */ 5141 * 2 * channel tune time) */
@@ -5151,30 +5151,30 @@ static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, int phymode)
5151 return passive; 5151 return passive;
5152} 5152}
5153 5153
5154static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode, 5154static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, int phymode,
5155 u8 is_active, u8 direct_mask, 5155 u8 is_active, u8 direct_mask,
5156 struct iwl_scan_channel *scan_ch) 5156 struct iwl3945_scan_channel *scan_ch)
5157{ 5157{
5158 const struct ieee80211_channel *channels = NULL; 5158 const struct ieee80211_channel *channels = NULL;
5159 const struct ieee80211_hw_mode *hw_mode; 5159 const struct ieee80211_hw_mode *hw_mode;
5160 const struct iwl_channel_info *ch_info; 5160 const struct iwl3945_channel_info *ch_info;
5161 u16 passive_dwell = 0; 5161 u16 passive_dwell = 0;
5162 u16 active_dwell = 0; 5162 u16 active_dwell = 0;
5163 int added, i; 5163 int added, i;
5164 5164
5165 hw_mode = iwl_get_hw_mode(priv, phymode); 5165 hw_mode = iwl3945_get_hw_mode(priv, phymode);
5166 if (!hw_mode) 5166 if (!hw_mode)
5167 return 0; 5167 return 0;
5168 5168
5169 channels = hw_mode->channels; 5169 channels = hw_mode->channels;
5170 5170
5171 active_dwell = iwl_get_active_dwell_time(priv, phymode); 5171 active_dwell = iwl3945_get_active_dwell_time(priv, phymode);
5172 passive_dwell = iwl_get_passive_dwell_time(priv, phymode); 5172 passive_dwell = iwl3945_get_passive_dwell_time(priv, phymode);
5173 5173
5174 for (i = 0, added = 0; i < hw_mode->num_channels; i++) { 5174 for (i = 0, added = 0; i < hw_mode->num_channels; i++) {
5175 if (channels[i].chan == 5175 if (channels[i].chan ==
5176 le16_to_cpu(priv->active_rxon.channel)) { 5176 le16_to_cpu(priv->active_rxon.channel)) {
5177 if (iwl_is_associated(priv)) { 5177 if (iwl3945_is_associated(priv)) {
5178 IWL_DEBUG_SCAN 5178 IWL_DEBUG_SCAN
5179 ("Skipping current channel %d\n", 5179 ("Skipping current channel %d\n",
5180 le16_to_cpu(priv->active_rxon.channel)); 5180 le16_to_cpu(priv->active_rxon.channel));
@@ -5185,7 +5185,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode,
5185 5185
5186 scan_ch->channel = channels[i].chan; 5186 scan_ch->channel = channels[i].chan;
5187 5187
5188 ch_info = iwl_get_channel_info(priv, phymode, scan_ch->channel); 5188 ch_info = iwl3945_get_channel_info(priv, phymode, scan_ch->channel);
5189 if (!is_channel_valid(ch_info)) { 5189 if (!is_channel_valid(ch_info)) {
5190 IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", 5190 IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n",
5191 scan_ch->channel); 5191 scan_ch->channel);
@@ -5236,7 +5236,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode,
5236 return added; 5236 return added;
5237} 5237}
5238 5238
5239static void iwl_reset_channel_flag(struct iwl_priv *priv) 5239static void iwl3945_reset_channel_flag(struct iwl3945_priv *priv)
5240{ 5240{
5241 int i, j; 5241 int i, j;
5242 for (i = 0; i < 3; i++) { 5242 for (i = 0; i < 3; i++) {
@@ -5246,13 +5246,13 @@ static void iwl_reset_channel_flag(struct iwl_priv *priv)
5246 } 5246 }
5247} 5247}
5248 5248
5249static void iwl_init_hw_rates(struct iwl_priv *priv, 5249static void iwl3945_init_hw_rates(struct iwl3945_priv *priv,
5250 struct ieee80211_rate *rates) 5250 struct ieee80211_rate *rates)
5251{ 5251{
5252 int i; 5252 int i;
5253 5253
5254 for (i = 0; i < IWL_RATE_COUNT; i++) { 5254 for (i = 0; i < IWL_RATE_COUNT; i++) {
5255 rates[i].rate = iwl_rates[i].ieee * 5; 5255 rates[i].rate = iwl3945_rates[i].ieee * 5;
5256 rates[i].val = i; /* Rate scaling will work on indexes */ 5256 rates[i].val = i; /* Rate scaling will work on indexes */
5257 rates[i].val2 = i; 5257 rates[i].val2 = i;
5258 rates[i].flags = IEEE80211_RATE_SUPPORTED; 5258 rates[i].flags = IEEE80211_RATE_SUPPORTED;
@@ -5264,7 +5264,7 @@ static void iwl_init_hw_rates(struct iwl_priv *priv,
5264 * If CCK 1M then set rate flag to CCK else CCK_2 5264 * If CCK 1M then set rate flag to CCK else CCK_2
5265 * which is CCK | PREAMBLE2 5265 * which is CCK | PREAMBLE2
5266 */ 5266 */
5267 rates[i].flags |= (iwl_rates[i].plcp == 10) ? 5267 rates[i].flags |= (iwl3945_rates[i].plcp == 10) ?
5268 IEEE80211_RATE_CCK : IEEE80211_RATE_CCK_2; 5268 IEEE80211_RATE_CCK : IEEE80211_RATE_CCK_2;
5269 } 5269 }
5270 5270
@@ -5275,11 +5275,11 @@ static void iwl_init_hw_rates(struct iwl_priv *priv,
5275} 5275}
5276 5276
5277/** 5277/**
5278 * iwl_init_geos - Initialize mac80211's geo/channel info based from eeprom 5278 * iwl3945_init_geos - Initialize mac80211's geo/channel info based from eeprom
5279 */ 5279 */
5280static int iwl_init_geos(struct iwl_priv *priv) 5280static int iwl3945_init_geos(struct iwl3945_priv *priv)
5281{ 5281{
5282 struct iwl_channel_info *ch; 5282 struct iwl3945_channel_info *ch;
5283 struct ieee80211_hw_mode *modes; 5283 struct ieee80211_hw_mode *modes;
5284 struct ieee80211_channel *channels; 5284 struct ieee80211_channel *channels;
5285 struct ieee80211_channel *geo_ch; 5285 struct ieee80211_channel *geo_ch;
@@ -5325,7 +5325,7 @@ static int iwl_init_geos(struct iwl_priv *priv)
5325 5325
5326 /* 5.2GHz channels start after the 2.4GHz channels */ 5326 /* 5.2GHz channels start after the 2.4GHz channels */
5327 modes[A].mode = MODE_IEEE80211A; 5327 modes[A].mode = MODE_IEEE80211A;
5328 modes[A].channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)]; 5328 modes[A].channels = &channels[ARRAY_SIZE(iwl3945_eeprom_band_1)];
5329 modes[A].rates = &rates[4]; 5329 modes[A].rates = &rates[4];
5330 modes[A].num_rates = 8; /* just OFDM */ 5330 modes[A].num_rates = 8; /* just OFDM */
5331 modes[A].num_channels = 0; 5331 modes[A].num_channels = 0;
@@ -5345,7 +5345,7 @@ static int iwl_init_geos(struct iwl_priv *priv)
5345 priv->ieee_channels = channels; 5345 priv->ieee_channels = channels;
5346 priv->ieee_rates = rates; 5346 priv->ieee_rates = rates;
5347 5347
5348 iwl_init_hw_rates(priv, rates); 5348 iwl3945_init_hw_rates(priv, rates);
5349 5349
5350 for (i = 0, geo_ch = channels; i < priv->channel_count; i++) { 5350 for (i = 0, geo_ch = channels; i < priv->channel_count; i++) {
5351 ch = &priv->channel_info[i]; 5351 ch = &priv->channel_info[i];
@@ -5428,7 +5428,7 @@ static int iwl_init_geos(struct iwl_priv *priv)
5428 * 5428 *
5429 ******************************************************************************/ 5429 ******************************************************************************/
5430 5430
5431static void iwl_dealloc_ucode_pci(struct iwl_priv *priv) 5431static void iwl3945_dealloc_ucode_pci(struct iwl3945_priv *priv)
5432{ 5432{
5433 if (priv->ucode_code.v_addr != NULL) { 5433 if (priv->ucode_code.v_addr != NULL) {
5434 pci_free_consistent(priv->pci_dev, 5434 pci_free_consistent(priv->pci_dev,
@@ -5475,10 +5475,10 @@ static void iwl_dealloc_ucode_pci(struct iwl_priv *priv)
5475} 5475}
5476 5476
5477/** 5477/**
5478 * iwl_verify_inst_full - verify runtime uCode image in card vs. host, 5478 * iwl3945_verify_inst_full - verify runtime uCode image in card vs. host,
5479 * looking at all data. 5479 * looking at all data.
5480 */ 5480 */
5481static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) 5481static int iwl3945_verify_inst_full(struct iwl3945_priv *priv, __le32 * image, u32 len)
5482{ 5482{
5483 u32 val; 5483 u32 val;
5484 u32 save_len = len; 5484 u32 save_len = len;
@@ -5487,18 +5487,18 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len)
5487 5487
5488 IWL_DEBUG_INFO("ucode inst image size is %u\n", len); 5488 IWL_DEBUG_INFO("ucode inst image size is %u\n", len);
5489 5489
5490 rc = iwl_grab_nic_access(priv); 5490 rc = iwl3945_grab_nic_access(priv);
5491 if (rc) 5491 if (rc)
5492 return rc; 5492 return rc;
5493 5493
5494 iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND); 5494 iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND);
5495 5495
5496 errcnt = 0; 5496 errcnt = 0;
5497 for (; len > 0; len -= sizeof(u32), image++) { 5497 for (; len > 0; len -= sizeof(u32), image++) {
5498 /* read data comes through single port, auto-incr addr */ 5498 /* read data comes through single port, auto-incr addr */
5499 /* NOTE: Use the debugless read so we don't flood kernel log 5499 /* NOTE: Use the debugless read so we don't flood kernel log
5500 * if IWL_DL_IO is set */ 5500 * if IWL_DL_IO is set */
5501 val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); 5501 val = _iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT);
5502 if (val != le32_to_cpu(*image)) { 5502 if (val != le32_to_cpu(*image)) {
5503 IWL_ERROR("uCode INST section is invalid at " 5503 IWL_ERROR("uCode INST section is invalid at "
5504 "offset 0x%x, is 0x%x, s/b 0x%x\n", 5504 "offset 0x%x, is 0x%x, s/b 0x%x\n",
@@ -5510,7 +5510,7 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len)
5510 } 5510 }
5511 } 5511 }
5512 5512
5513 iwl_release_nic_access(priv); 5513 iwl3945_release_nic_access(priv);
5514 5514
5515 if (!errcnt) 5515 if (!errcnt)
5516 IWL_DEBUG_INFO("ucode image in INSTRUCTION memory is good\n"); 5516 IWL_DEBUG_INFO("ucode image in INSTRUCTION memory is good\n");
@@ -5520,11 +5520,11 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len)
5520 5520
5521 5521
5522/** 5522/**
5523 * iwl_verify_inst_sparse - verify runtime uCode image in card vs. host, 5523 * iwl3945_verify_inst_sparse - verify runtime uCode image in card vs. host,
5524 * using sample data 100 bytes apart. If these sample points are good, 5524 * using sample data 100 bytes apart. If these sample points are good,
5525 * it's a pretty good bet that everything between them is good, too. 5525 * it's a pretty good bet that everything between them is good, too.
5526 */ 5526 */
5527static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) 5527static int iwl3945_verify_inst_sparse(struct iwl3945_priv *priv, __le32 *image, u32 len)
5528{ 5528{
5529 u32 val; 5529 u32 val;
5530 int rc = 0; 5530 int rc = 0;
@@ -5533,7 +5533,7 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len)
5533 5533
5534 IWL_DEBUG_INFO("ucode inst image size is %u\n", len); 5534 IWL_DEBUG_INFO("ucode inst image size is %u\n", len);
5535 5535
5536 rc = iwl_grab_nic_access(priv); 5536 rc = iwl3945_grab_nic_access(priv);
5537 if (rc) 5537 if (rc)
5538 return rc; 5538 return rc;
5539 5539
@@ -5541,9 +5541,9 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len)
5541 /* read data comes through single port, auto-incr addr */ 5541 /* read data comes through single port, auto-incr addr */
5542 /* NOTE: Use the debugless read so we don't flood kernel log 5542 /* NOTE: Use the debugless read so we don't flood kernel log
5543 * if IWL_DL_IO is set */ 5543 * if IWL_DL_IO is set */
5544 iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, 5544 iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR,
5545 i + RTC_INST_LOWER_BOUND); 5545 i + RTC_INST_LOWER_BOUND);
5546 val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); 5546 val = _iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT);
5547 if (val != le32_to_cpu(*image)) { 5547 if (val != le32_to_cpu(*image)) {
5548#if 0 /* Enable this if you want to see details */ 5548#if 0 /* Enable this if you want to see details */
5549 IWL_ERROR("uCode INST section is invalid at " 5549 IWL_ERROR("uCode INST section is invalid at "
@@ -5557,17 +5557,17 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len)
5557 } 5557 }
5558 } 5558 }
5559 5559
5560 iwl_release_nic_access(priv); 5560 iwl3945_release_nic_access(priv);
5561 5561
5562 return rc; 5562 return rc;
5563} 5563}
5564 5564
5565 5565
5566/** 5566/**
5567 * iwl_verify_ucode - determine which instruction image is in SRAM, 5567 * iwl3945_verify_ucode - determine which instruction image is in SRAM,
5568 * and verify its contents 5568 * and verify its contents
5569 */ 5569 */
5570static int iwl_verify_ucode(struct iwl_priv *priv) 5570static int iwl3945_verify_ucode(struct iwl3945_priv *priv)
5571{ 5571{
5572 __le32 *image; 5572 __le32 *image;
5573 u32 len; 5573 u32 len;
@@ -5576,7 +5576,7 @@ static int iwl_verify_ucode(struct iwl_priv *priv)
5576 /* Try bootstrap */ 5576 /* Try bootstrap */
5577 image = (__le32 *)priv->ucode_boot.v_addr; 5577 image = (__le32 *)priv->ucode_boot.v_addr;
5578 len = priv->ucode_boot.len; 5578 len = priv->ucode_boot.len;
5579 rc = iwl_verify_inst_sparse(priv, image, len); 5579 rc = iwl3945_verify_inst_sparse(priv, image, len);
5580 if (rc == 0) { 5580 if (rc == 0) {
5581 IWL_DEBUG_INFO("Bootstrap uCode is good in inst SRAM\n"); 5581 IWL_DEBUG_INFO("Bootstrap uCode is good in inst SRAM\n");
5582 return 0; 5582 return 0;
@@ -5585,7 +5585,7 @@ static int iwl_verify_ucode(struct iwl_priv *priv)
5585 /* Try initialize */ 5585 /* Try initialize */
5586 image = (__le32 *)priv->ucode_init.v_addr; 5586 image = (__le32 *)priv->ucode_init.v_addr;
5587 len = priv->ucode_init.len; 5587 len = priv->ucode_init.len;
5588 rc = iwl_verify_inst_sparse(priv, image, len); 5588 rc = iwl3945_verify_inst_sparse(priv, image, len);
5589 if (rc == 0) { 5589 if (rc == 0) {
5590 IWL_DEBUG_INFO("Initialize uCode is good in inst SRAM\n"); 5590 IWL_DEBUG_INFO("Initialize uCode is good in inst SRAM\n");
5591 return 0; 5591 return 0;
@@ -5594,7 +5594,7 @@ static int iwl_verify_ucode(struct iwl_priv *priv)
5594 /* Try runtime/protocol */ 5594 /* Try runtime/protocol */
5595 image = (__le32 *)priv->ucode_code.v_addr; 5595 image = (__le32 *)priv->ucode_code.v_addr;
5596 len = priv->ucode_code.len; 5596 len = priv->ucode_code.len;
5597 rc = iwl_verify_inst_sparse(priv, image, len); 5597 rc = iwl3945_verify_inst_sparse(priv, image, len);
5598 if (rc == 0) { 5598 if (rc == 0) {
5599 IWL_DEBUG_INFO("Runtime uCode is good in inst SRAM\n"); 5599 IWL_DEBUG_INFO("Runtime uCode is good in inst SRAM\n");
5600 return 0; 5600 return 0;
@@ -5606,14 +5606,14 @@ static int iwl_verify_ucode(struct iwl_priv *priv)
5606 * Selection of bootstrap image is arbitrary. */ 5606 * Selection of bootstrap image is arbitrary. */
5607 image = (__le32 *)priv->ucode_boot.v_addr; 5607 image = (__le32 *)priv->ucode_boot.v_addr;
5608 len = priv->ucode_boot.len; 5608 len = priv->ucode_boot.len;
5609 rc = iwl_verify_inst_full(priv, image, len); 5609 rc = iwl3945_verify_inst_full(priv, image, len);
5610 5610
5611 return rc; 5611 return rc;
5612} 5612}
5613 5613
5614 5614
5615/* check contents of special bootstrap uCode SRAM */ 5615/* check contents of special bootstrap uCode SRAM */
5616static int iwl_verify_bsm(struct iwl_priv *priv) 5616static int iwl3945_verify_bsm(struct iwl3945_priv *priv)
5617{ 5617{
5618 __le32 *image = priv->ucode_boot.v_addr; 5618 __le32 *image = priv->ucode_boot.v_addr;
5619 u32 len = priv->ucode_boot.len; 5619 u32 len = priv->ucode_boot.len;
@@ -5623,11 +5623,11 @@ static int iwl_verify_bsm(struct iwl_priv *priv)
5623 IWL_DEBUG_INFO("Begin verify bsm\n"); 5623 IWL_DEBUG_INFO("Begin verify bsm\n");
5624 5624
5625 /* verify BSM SRAM contents */ 5625 /* verify BSM SRAM contents */
5626 val = iwl_read_prph(priv, BSM_WR_DWCOUNT_REG); 5626 val = iwl3945_read_prph(priv, BSM_WR_DWCOUNT_REG);
5627 for (reg = BSM_SRAM_LOWER_BOUND; 5627 for (reg = BSM_SRAM_LOWER_BOUND;
5628 reg < BSM_SRAM_LOWER_BOUND + len; 5628 reg < BSM_SRAM_LOWER_BOUND + len;
5629 reg += sizeof(u32), image ++) { 5629 reg += sizeof(u32), image ++) {
5630 val = iwl_read_prph(priv, reg); 5630 val = iwl3945_read_prph(priv, reg);
5631 if (val != le32_to_cpu(*image)) { 5631 if (val != le32_to_cpu(*image)) {
5632 IWL_ERROR("BSM uCode verification failed at " 5632 IWL_ERROR("BSM uCode verification failed at "
5633 "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", 5633 "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n",
@@ -5644,7 +5644,7 @@ static int iwl_verify_bsm(struct iwl_priv *priv)
5644} 5644}
5645 5645
5646/** 5646/**
5647 * iwl_load_bsm - Load bootstrap instructions 5647 * iwl3945_load_bsm - Load bootstrap instructions
5648 * 5648 *
5649 * BSM operation: 5649 * BSM operation:
5650 * 5650 *
@@ -5675,7 +5675,7 @@ static int iwl_verify_bsm(struct iwl_priv *priv)
5675 * the runtime uCode instructions and the backup data cache into SRAM, 5675 * the runtime uCode instructions and the backup data cache into SRAM,
5676 * and re-launches the runtime uCode from where it left off. 5676 * and re-launches the runtime uCode from where it left off.
5677 */ 5677 */
5678static int iwl_load_bsm(struct iwl_priv *priv) 5678static int iwl3945_load_bsm(struct iwl3945_priv *priv)
5679{ 5679{
5680 __le32 *image = priv->ucode_boot.v_addr; 5680 __le32 *image = priv->ucode_boot.v_addr;
5681 u32 len = priv->ucode_boot.len; 5681 u32 len = priv->ucode_boot.len;
@@ -5696,7 +5696,7 @@ static int iwl_load_bsm(struct iwl_priv *priv)
5696 5696
5697 /* Tell bootstrap uCode where to find the "Initialize" uCode 5697 /* Tell bootstrap uCode where to find the "Initialize" uCode
5698 * in host DRAM ... bits 31:0 for 3945, bits 35:4 for 4965. 5698 * in host DRAM ... bits 31:0 for 3945, bits 35:4 for 4965.
5699 * NOTE: iwl_initialize_alive_start() will replace these values, 5699 * NOTE: iwl3945_initialize_alive_start() will replace these values,
5700 * after the "initialize" uCode has run, to point to 5700 * after the "initialize" uCode has run, to point to
5701 * runtime/protocol instructions and backup data cache. */ 5701 * runtime/protocol instructions and backup data cache. */
5702 pinst = priv->ucode_init.p_addr; 5702 pinst = priv->ucode_init.p_addr;
@@ -5704,42 +5704,42 @@ static int iwl_load_bsm(struct iwl_priv *priv)
5704 inst_len = priv->ucode_init.len; 5704 inst_len = priv->ucode_init.len;
5705 data_len = priv->ucode_init_data.len; 5705 data_len = priv->ucode_init_data.len;
5706 5706
5707 rc = iwl_grab_nic_access(priv); 5707 rc = iwl3945_grab_nic_access(priv);
5708 if (rc) 5708 if (rc)
5709 return rc; 5709 return rc;
5710 5710
5711 iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); 5711 iwl3945_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
5712 iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); 5712 iwl3945_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
5713 iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); 5713 iwl3945_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len);
5714 iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); 5714 iwl3945_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len);
5715 5715
5716 /* Fill BSM memory with bootstrap instructions */ 5716 /* Fill BSM memory with bootstrap instructions */
5717 for (reg_offset = BSM_SRAM_LOWER_BOUND; 5717 for (reg_offset = BSM_SRAM_LOWER_BOUND;
5718 reg_offset < BSM_SRAM_LOWER_BOUND + len; 5718 reg_offset < BSM_SRAM_LOWER_BOUND + len;
5719 reg_offset += sizeof(u32), image++) 5719 reg_offset += sizeof(u32), image++)
5720 _iwl_write_prph(priv, reg_offset, 5720 _iwl3945_write_prph(priv, reg_offset,
5721 le32_to_cpu(*image)); 5721 le32_to_cpu(*image));
5722 5722
5723 rc = iwl_verify_bsm(priv); 5723 rc = iwl3945_verify_bsm(priv);
5724 if (rc) { 5724 if (rc) {
5725 iwl_release_nic_access(priv); 5725 iwl3945_release_nic_access(priv);
5726 return rc; 5726 return rc;
5727 } 5727 }
5728 5728
5729 /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ 5729 /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */
5730 iwl_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); 5730 iwl3945_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0);
5731 iwl_write_prph(priv, BSM_WR_MEM_DST_REG, 5731 iwl3945_write_prph(priv, BSM_WR_MEM_DST_REG,
5732 RTC_INST_LOWER_BOUND); 5732 RTC_INST_LOWER_BOUND);
5733 iwl_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); 5733 iwl3945_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32));
5734 5734
5735 /* Load bootstrap code into instruction SRAM now, 5735 /* Load bootstrap code into instruction SRAM now,
5736 * to prepare to load "initialize" uCode */ 5736 * to prepare to load "initialize" uCode */
5737 iwl_write_prph(priv, BSM_WR_CTRL_REG, 5737 iwl3945_write_prph(priv, BSM_WR_CTRL_REG,
5738 BSM_WR_CTRL_REG_BIT_START); 5738 BSM_WR_CTRL_REG_BIT_START);
5739 5739
5740 /* Wait for load of bootstrap uCode to finish */ 5740 /* Wait for load of bootstrap uCode to finish */
5741 for (i = 0; i < 100; i++) { 5741 for (i = 0; i < 100; i++) {
5742 done = iwl_read_prph(priv, BSM_WR_CTRL_REG); 5742 done = iwl3945_read_prph(priv, BSM_WR_CTRL_REG);
5743 if (!(done & BSM_WR_CTRL_REG_BIT_START)) 5743 if (!(done & BSM_WR_CTRL_REG_BIT_START))
5744 break; 5744 break;
5745 udelay(10); 5745 udelay(10);
@@ -5753,28 +5753,28 @@ static int iwl_load_bsm(struct iwl_priv *priv)
5753 5753
5754 /* Enable future boot loads whenever power management unit triggers it 5754 /* Enable future boot loads whenever power management unit triggers it
5755 * (e.g. when powering back up after power-save shutdown) */ 5755 * (e.g. when powering back up after power-save shutdown) */
5756 iwl_write_prph(priv, BSM_WR_CTRL_REG, 5756 iwl3945_write_prph(priv, BSM_WR_CTRL_REG,
5757 BSM_WR_CTRL_REG_BIT_START_EN); 5757 BSM_WR_CTRL_REG_BIT_START_EN);
5758 5758
5759 iwl_release_nic_access(priv); 5759 iwl3945_release_nic_access(priv);
5760 5760
5761 return 0; 5761 return 0;
5762} 5762}
5763 5763
5764static void iwl_nic_start(struct iwl_priv *priv) 5764static void iwl3945_nic_start(struct iwl3945_priv *priv)
5765{ 5765{
5766 /* Remove all resets to allow NIC to operate */ 5766 /* Remove all resets to allow NIC to operate */
5767 iwl_write32(priv, CSR_RESET, 0); 5767 iwl3945_write32(priv, CSR_RESET, 0);
5768} 5768}
5769 5769
5770/** 5770/**
5771 * iwl_read_ucode - Read uCode images from disk file. 5771 * iwl3945_read_ucode - Read uCode images from disk file.
5772 * 5772 *
5773 * Copy into buffers for card to fetch via bus-mastering 5773 * Copy into buffers for card to fetch via bus-mastering
5774 */ 5774 */
5775static int iwl_read_ucode(struct iwl_priv *priv) 5775static int iwl3945_read_ucode(struct iwl3945_priv *priv)
5776{ 5776{
5777 struct iwl_ucode *ucode; 5777 struct iwl3945_ucode *ucode;
5778 int rc = 0; 5778 int rc = 0;
5779 const struct firmware *ucode_raw; 5779 const struct firmware *ucode_raw;
5780 /* firmware file name contains uCode/driver compatibility version */ 5780 /* firmware file name contains uCode/driver compatibility version */
@@ -5926,7 +5926,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
5926 priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); 5926 priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr);
5927 5927
5928 /* Runtime data (2nd block) 5928 /* Runtime data (2nd block)
5929 * NOTE: Copy into backup buffer will be done in iwl_up() */ 5929 * NOTE: Copy into backup buffer will be done in iwl3945_up() */
5930 src = &ucode->data[inst_size]; 5930 src = &ucode->data[inst_size];
5931 len = priv->ucode_data.len; 5931 len = priv->ucode_data.len;
5932 IWL_DEBUG_INFO("Copying (but not loading) uCode data len %d\n", 5932 IWL_DEBUG_INFO("Copying (but not loading) uCode data len %d\n",
@@ -5966,7 +5966,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
5966 err_pci_alloc: 5966 err_pci_alloc:
5967 IWL_ERROR("failed to allocate pci memory\n"); 5967 IWL_ERROR("failed to allocate pci memory\n");
5968 rc = -ENOMEM; 5968 rc = -ENOMEM;
5969 iwl_dealloc_ucode_pci(priv); 5969 iwl3945_dealloc_ucode_pci(priv);
5970 5970
5971 err_release: 5971 err_release:
5972 release_firmware(ucode_raw); 5972 release_firmware(ucode_raw);
@@ -5977,7 +5977,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
5977 5977
5978 5978
5979/** 5979/**
5980 * iwl_set_ucode_ptrs - Set uCode address location 5980 * iwl3945_set_ucode_ptrs - Set uCode address location
5981 * 5981 *
5982 * Tell initialization uCode where to find runtime uCode. 5982 * Tell initialization uCode where to find runtime uCode.
5983 * 5983 *
@@ -5985,7 +5985,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
5985 * We need to replace them to load runtime uCode inst and data, 5985 * We need to replace them to load runtime uCode inst and data,
5986 * and to save runtime data when powering down. 5986 * and to save runtime data when powering down.
5987 */ 5987 */
5988static int iwl_set_ucode_ptrs(struct iwl_priv *priv) 5988static int iwl3945_set_ucode_ptrs(struct iwl3945_priv *priv)
5989{ 5989{
5990 dma_addr_t pinst; 5990 dma_addr_t pinst;
5991 dma_addr_t pdata; 5991 dma_addr_t pdata;
@@ -5997,24 +5997,24 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv)
5997 pdata = priv->ucode_data_backup.p_addr; 5997 pdata = priv->ucode_data_backup.p_addr;
5998 5998
5999 spin_lock_irqsave(&priv->lock, flags); 5999 spin_lock_irqsave(&priv->lock, flags);
6000 rc = iwl_grab_nic_access(priv); 6000 rc = iwl3945_grab_nic_access(priv);
6001 if (rc) { 6001 if (rc) {
6002 spin_unlock_irqrestore(&priv->lock, flags); 6002 spin_unlock_irqrestore(&priv->lock, flags);
6003 return rc; 6003 return rc;
6004 } 6004 }
6005 6005
6006 /* Tell bootstrap uCode where to find image to load */ 6006 /* Tell bootstrap uCode where to find image to load */
6007 iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); 6007 iwl3945_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
6008 iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); 6008 iwl3945_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
6009 iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, 6009 iwl3945_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG,
6010 priv->ucode_data.len); 6010 priv->ucode_data.len);
6011 6011
6012 /* Inst bytecount must be last to set up, bit 31 signals uCode 6012 /* Inst bytecount must be last to set up, bit 31 signals uCode
6013 * that all new ptr/size info is in place */ 6013 * that all new ptr/size info is in place */
6014 iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, 6014 iwl3945_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG,
6015 priv->ucode_code.len | BSM_DRAM_INST_LOAD); 6015 priv->ucode_code.len | BSM_DRAM_INST_LOAD);
6016 6016
6017 iwl_release_nic_access(priv); 6017 iwl3945_release_nic_access(priv);
6018 6018
6019 spin_unlock_irqrestore(&priv->lock, flags); 6019 spin_unlock_irqrestore(&priv->lock, flags);
6020 6020
@@ -6024,7 +6024,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv)
6024} 6024}
6025 6025
6026/** 6026/**
6027 * iwl_init_alive_start - Called after REPLY_ALIVE notification received 6027 * iwl3945_init_alive_start - Called after REPLY_ALIVE notification received
6028 * 6028 *
6029 * Called after REPLY_ALIVE notification received from "initialize" uCode. 6029 * Called after REPLY_ALIVE notification received from "initialize" uCode.
6030 * 6030 *
@@ -6034,7 +6034,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv)
6034 * 6034 *
6035 * Tell "initialize" uCode to go ahead and load the runtime uCode. 6035 * Tell "initialize" uCode to go ahead and load the runtime uCode.
6036*/ 6036*/
6037static void iwl_init_alive_start(struct iwl_priv *priv) 6037static void iwl3945_init_alive_start(struct iwl3945_priv *priv)
6038{ 6038{
6039 /* Check alive response for "valid" sign from uCode */ 6039 /* Check alive response for "valid" sign from uCode */
6040 if (priv->card_alive_init.is_valid != UCODE_VALID_OK) { 6040 if (priv->card_alive_init.is_valid != UCODE_VALID_OK) {
@@ -6047,7 +6047,7 @@ static void iwl_init_alive_start(struct iwl_priv *priv)
6047 /* Bootstrap uCode has loaded initialize uCode ... verify inst image. 6047 /* Bootstrap uCode has loaded initialize uCode ... verify inst image.
6048 * This is a paranoid check, because we would not have gotten the 6048 * This is a paranoid check, because we would not have gotten the
6049 * "initialize" alive if code weren't properly loaded. */ 6049 * "initialize" alive if code weren't properly loaded. */
6050 if (iwl_verify_ucode(priv)) { 6050 if (iwl3945_verify_ucode(priv)) {
6051 /* Runtime instruction load was bad; 6051 /* Runtime instruction load was bad;
6052 * take it all the way back down so we can try again */ 6052 * take it all the way back down so we can try again */
6053 IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n"); 6053 IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n");
@@ -6058,7 +6058,7 @@ static void iwl_init_alive_start(struct iwl_priv *priv)
6058 * load and launch runtime uCode, which will send us another "Alive" 6058 * load and launch runtime uCode, which will send us another "Alive"
6059 * notification. */ 6059 * notification. */
6060 IWL_DEBUG_INFO("Initialization Alive received.\n"); 6060 IWL_DEBUG_INFO("Initialization Alive received.\n");
6061 if (iwl_set_ucode_ptrs(priv)) { 6061 if (iwl3945_set_ucode_ptrs(priv)) {
6062 /* Runtime instruction load won't happen; 6062 /* Runtime instruction load won't happen;
6063 * take it all the way back down so we can try again */ 6063 * take it all the way back down so we can try again */
6064 IWL_DEBUG_INFO("Couldn't set up uCode pointers.\n"); 6064 IWL_DEBUG_INFO("Couldn't set up uCode pointers.\n");
@@ -6072,11 +6072,11 @@ static void iwl_init_alive_start(struct iwl_priv *priv)
6072 6072
6073 6073
6074/** 6074/**
6075 * iwl_alive_start - called after REPLY_ALIVE notification received 6075 * iwl3945_alive_start - called after REPLY_ALIVE notification received
6076 * from protocol/runtime uCode (initialization uCode's 6076 * from protocol/runtime uCode (initialization uCode's
6077 * Alive gets handled by iwl_init_alive_start()). 6077 * Alive gets handled by iwl3945_init_alive_start()).
6078 */ 6078 */
6079static void iwl_alive_start(struct iwl_priv *priv) 6079static void iwl3945_alive_start(struct iwl3945_priv *priv)
6080{ 6080{
6081 int rc = 0; 6081 int rc = 0;
6082 int thermal_spin = 0; 6082 int thermal_spin = 0;
@@ -6094,30 +6094,30 @@ static void iwl_alive_start(struct iwl_priv *priv)
6094 /* Initialize uCode has loaded Runtime uCode ... verify inst image. 6094 /* Initialize uCode has loaded Runtime uCode ... verify inst image.
6095 * This is a paranoid check, because we would not have gotten the 6095 * This is a paranoid check, because we would not have gotten the
6096 * "runtime" alive if code weren't properly loaded. */ 6096 * "runtime" alive if code weren't properly loaded. */
6097 if (iwl_verify_ucode(priv)) { 6097 if (iwl3945_verify_ucode(priv)) {
6098 /* Runtime instruction load was bad; 6098 /* Runtime instruction load was bad;
6099 * take it all the way back down so we can try again */ 6099 * take it all the way back down so we can try again */
6100 IWL_DEBUG_INFO("Bad runtime uCode load.\n"); 6100 IWL_DEBUG_INFO("Bad runtime uCode load.\n");
6101 goto restart; 6101 goto restart;
6102 } 6102 }
6103 6103
6104 iwl_clear_stations_table(priv); 6104 iwl3945_clear_stations_table(priv);
6105 6105
6106 rc = iwl_grab_nic_access(priv); 6106 rc = iwl3945_grab_nic_access(priv);
6107 if (rc) { 6107 if (rc) {
6108 IWL_WARNING("Can not read rfkill status from adapter\n"); 6108 IWL_WARNING("Can not read rfkill status from adapter\n");
6109 return; 6109 return;
6110 } 6110 }
6111 6111
6112 rfkill = iwl_read_prph(priv, APMG_RFKILL_REG); 6112 rfkill = iwl3945_read_prph(priv, APMG_RFKILL_REG);
6113 IWL_DEBUG_INFO("RFKILL status: 0x%x\n", rfkill); 6113 IWL_DEBUG_INFO("RFKILL status: 0x%x\n", rfkill);
6114 iwl_release_nic_access(priv); 6114 iwl3945_release_nic_access(priv);
6115 6115
6116 if (rfkill & 0x1) { 6116 if (rfkill & 0x1) {
6117 clear_bit(STATUS_RF_KILL_HW, &priv->status); 6117 clear_bit(STATUS_RF_KILL_HW, &priv->status);
6118 /* if rfkill is not on, then wait for thermal 6118 /* if rfkill is not on, then wait for thermal
6119 * sensor in adapter to kick in */ 6119 * sensor in adapter to kick in */
6120 while (iwl_hw_get_temperature(priv) == 0) { 6120 while (iwl3945_hw_get_temperature(priv) == 0) {
6121 thermal_spin++; 6121 thermal_spin++;
6122 udelay(10); 6122 udelay(10);
6123 } 6123 }
@@ -6134,28 +6134,28 @@ static void iwl_alive_start(struct iwl_priv *priv)
6134 /* Clear out the uCode error bit if it is set */ 6134 /* Clear out the uCode error bit if it is set */
6135 clear_bit(STATUS_FW_ERROR, &priv->status); 6135 clear_bit(STATUS_FW_ERROR, &priv->status);
6136 6136
6137 rc = iwl_init_channel_map(priv); 6137 rc = iwl3945_init_channel_map(priv);
6138 if (rc) { 6138 if (rc) {
6139 IWL_ERROR("initializing regulatory failed: %d\n", rc); 6139 IWL_ERROR("initializing regulatory failed: %d\n", rc);
6140 return; 6140 return;
6141 } 6141 }
6142 6142
6143 iwl_init_geos(priv); 6143 iwl3945_init_geos(priv);
6144 6144
6145 if (iwl_is_rfkill(priv)) 6145 if (iwl3945_is_rfkill(priv))
6146 return; 6146 return;
6147 6147
6148 if (!priv->mac80211_registered) { 6148 if (!priv->mac80211_registered) {
6149 /* Unlock so any user space entry points can call back into 6149 /* Unlock so any user space entry points can call back into
6150 * the driver without a deadlock... */ 6150 * the driver without a deadlock... */
6151 mutex_unlock(&priv->mutex); 6151 mutex_unlock(&priv->mutex);
6152 iwl_rate_control_register(priv->hw); 6152 iwl3945_rate_control_register(priv->hw);
6153 rc = ieee80211_register_hw(priv->hw); 6153 rc = ieee80211_register_hw(priv->hw);
6154 priv->hw->conf.beacon_int = 100; 6154 priv->hw->conf.beacon_int = 100;
6155 mutex_lock(&priv->mutex); 6155 mutex_lock(&priv->mutex);
6156 6156
6157 if (rc) { 6157 if (rc) {
6158 iwl_rate_control_unregister(priv->hw); 6158 iwl3945_rate_control_unregister(priv->hw);
6159 IWL_ERROR("Failed to register network " 6159 IWL_ERROR("Failed to register network "
6160 "device (error %d)\n", rc); 6160 "device (error %d)\n", rc);
6161 return; 6161 return;
@@ -6163,33 +6163,33 @@ static void iwl_alive_start(struct iwl_priv *priv)
6163 6163
6164 priv->mac80211_registered = 1; 6164 priv->mac80211_registered = 1;
6165 6165
6166 iwl_reset_channel_flag(priv); 6166 iwl3945_reset_channel_flag(priv);
6167 } else 6167 } else
6168 ieee80211_start_queues(priv->hw); 6168 ieee80211_start_queues(priv->hw);
6169 6169
6170 priv->active_rate = priv->rates_mask; 6170 priv->active_rate = priv->rates_mask;
6171 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; 6171 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
6172 6172
6173 iwl_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode)); 6173 iwl3945_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode));
6174 6174
6175 if (iwl_is_associated(priv)) { 6175 if (iwl3945_is_associated(priv)) {
6176 struct iwl_rxon_cmd *active_rxon = 6176 struct iwl3945_rxon_cmd *active_rxon =
6177 (struct iwl_rxon_cmd *)(&priv->active_rxon); 6177 (struct iwl3945_rxon_cmd *)(&priv->active_rxon);
6178 6178
6179 memcpy(&priv->staging_rxon, &priv->active_rxon, 6179 memcpy(&priv->staging_rxon, &priv->active_rxon,
6180 sizeof(priv->staging_rxon)); 6180 sizeof(priv->staging_rxon));
6181 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 6181 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
6182 } else { 6182 } else {
6183 /* Initialize our rx_config data */ 6183 /* Initialize our rx_config data */
6184 iwl_connection_init_rx_config(priv); 6184 iwl3945_connection_init_rx_config(priv);
6185 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); 6185 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
6186 } 6186 }
6187 6187
6188 /* Configure BT coexistence */ 6188 /* Configure BT coexistence */
6189 iwl_send_bt_config(priv); 6189 iwl3945_send_bt_config(priv);
6190 6190
6191 /* Configure the adapter for unassociated operation */ 6191 /* Configure the adapter for unassociated operation */
6192 iwl_commit_rxon(priv); 6192 iwl3945_commit_rxon(priv);
6193 6193
6194 /* At this point, the NIC is initialized and operational */ 6194 /* At this point, the NIC is initialized and operational */
6195 priv->notif_missed_beacons = 0; 6195 priv->notif_missed_beacons = 0;
@@ -6200,7 +6200,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
6200 IWL_DEBUG_INFO("ALIVE processing complete.\n"); 6200 IWL_DEBUG_INFO("ALIVE processing complete.\n");
6201 6201
6202 if (priv->error_recovering) 6202 if (priv->error_recovering)
6203 iwl_error_recovery(priv); 6203 iwl3945_error_recovery(priv);
6204 6204
6205 return; 6205 return;
6206 6206
@@ -6208,9 +6208,9 @@ static void iwl_alive_start(struct iwl_priv *priv)
6208 queue_work(priv->workqueue, &priv->restart); 6208 queue_work(priv->workqueue, &priv->restart);
6209} 6209}
6210 6210
6211static void iwl_cancel_deferred_work(struct iwl_priv *priv); 6211static void iwl3945_cancel_deferred_work(struct iwl3945_priv *priv);
6212 6212
6213static void __iwl_down(struct iwl_priv *priv) 6213static void __iwl3945_down(struct iwl3945_priv *priv)
6214{ 6214{
6215 unsigned long flags; 6215 unsigned long flags;
6216 int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status); 6216 int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status);
@@ -6223,7 +6223,7 @@ static void __iwl_down(struct iwl_priv *priv)
6223 if (!exit_pending) 6223 if (!exit_pending)
6224 set_bit(STATUS_EXIT_PENDING, &priv->status); 6224 set_bit(STATUS_EXIT_PENDING, &priv->status);
6225 6225
6226 iwl_clear_stations_table(priv); 6226 iwl3945_clear_stations_table(priv);
6227 6227
6228 /* Unblock any waiting calls */ 6228 /* Unblock any waiting calls */
6229 wake_up_interruptible_all(&priv->wait_command_queue); 6229 wake_up_interruptible_all(&priv->wait_command_queue);
@@ -6234,17 +6234,17 @@ static void __iwl_down(struct iwl_priv *priv)
6234 clear_bit(STATUS_EXIT_PENDING, &priv->status); 6234 clear_bit(STATUS_EXIT_PENDING, &priv->status);
6235 6235
6236 /* stop and reset the on-board processor */ 6236 /* stop and reset the on-board processor */
6237 iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); 6237 iwl3945_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
6238 6238
6239 /* tell the device to stop sending interrupts */ 6239 /* tell the device to stop sending interrupts */
6240 iwl_disable_interrupts(priv); 6240 iwl3945_disable_interrupts(priv);
6241 6241
6242 if (priv->mac80211_registered) 6242 if (priv->mac80211_registered)
6243 ieee80211_stop_queues(priv->hw); 6243 ieee80211_stop_queues(priv->hw);
6244 6244
6245 /* If we have not previously called iwl_init() then 6245 /* If we have not previously called iwl3945_init() then
6246 * clear all bits but the RF Kill and SUSPEND bits and return */ 6246 * clear all bits but the RF Kill and SUSPEND bits and return */
6247 if (!iwl_is_init(priv)) { 6247 if (!iwl3945_is_init(priv)) {
6248 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << 6248 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) <<
6249 STATUS_RF_KILL_HW | 6249 STATUS_RF_KILL_HW |
6250 test_bit(STATUS_RF_KILL_SW, &priv->status) << 6250 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
@@ -6266,49 +6266,49 @@ static void __iwl_down(struct iwl_priv *priv)
6266 STATUS_FW_ERROR; 6266 STATUS_FW_ERROR;
6267 6267
6268 spin_lock_irqsave(&priv->lock, flags); 6268 spin_lock_irqsave(&priv->lock, flags);
6269 iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 6269 iwl3945_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
6270 spin_unlock_irqrestore(&priv->lock, flags); 6270 spin_unlock_irqrestore(&priv->lock, flags);
6271 6271
6272 iwl_hw_txq_ctx_stop(priv); 6272 iwl3945_hw_txq_ctx_stop(priv);
6273 iwl_hw_rxq_stop(priv); 6273 iwl3945_hw_rxq_stop(priv);
6274 6274
6275 spin_lock_irqsave(&priv->lock, flags); 6275 spin_lock_irqsave(&priv->lock, flags);
6276 if (!iwl_grab_nic_access(priv)) { 6276 if (!iwl3945_grab_nic_access(priv)) {
6277 iwl_write_prph(priv, APMG_CLK_DIS_REG, 6277 iwl3945_write_prph(priv, APMG_CLK_DIS_REG,
6278 APMG_CLK_VAL_DMA_CLK_RQT); 6278 APMG_CLK_VAL_DMA_CLK_RQT);
6279 iwl_release_nic_access(priv); 6279 iwl3945_release_nic_access(priv);
6280 } 6280 }
6281 spin_unlock_irqrestore(&priv->lock, flags); 6281 spin_unlock_irqrestore(&priv->lock, flags);
6282 6282
6283 udelay(5); 6283 udelay(5);
6284 6284
6285 iwl_hw_nic_stop_master(priv); 6285 iwl3945_hw_nic_stop_master(priv);
6286 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); 6286 iwl3945_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
6287 iwl_hw_nic_reset(priv); 6287 iwl3945_hw_nic_reset(priv);
6288 6288
6289 exit: 6289 exit:
6290 memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp)); 6290 memset(&priv->card_alive, 0, sizeof(struct iwl3945_alive_resp));
6291 6291
6292 if (priv->ibss_beacon) 6292 if (priv->ibss_beacon)
6293 dev_kfree_skb(priv->ibss_beacon); 6293 dev_kfree_skb(priv->ibss_beacon);
6294 priv->ibss_beacon = NULL; 6294 priv->ibss_beacon = NULL;
6295 6295
6296 /* clear out any free frames */ 6296 /* clear out any free frames */
6297 iwl_clear_free_frames(priv); 6297 iwl3945_clear_free_frames(priv);
6298} 6298}
6299 6299
6300static void iwl_down(struct iwl_priv *priv) 6300static void iwl3945_down(struct iwl3945_priv *priv)
6301{ 6301{
6302 mutex_lock(&priv->mutex); 6302 mutex_lock(&priv->mutex);
6303 __iwl_down(priv); 6303 __iwl3945_down(priv);
6304 mutex_unlock(&priv->mutex); 6304 mutex_unlock(&priv->mutex);
6305 6305
6306 iwl_cancel_deferred_work(priv); 6306 iwl3945_cancel_deferred_work(priv);
6307} 6307}
6308 6308
6309#define MAX_HW_RESTARTS 5 6309#define MAX_HW_RESTARTS 5
6310 6310
6311static int __iwl_up(struct iwl_priv *priv) 6311static int __iwl3945_up(struct iwl3945_priv *priv)
6312{ 6312{
6313 DECLARE_MAC_BUF(mac); 6313 DECLARE_MAC_BUF(mac);
6314 int rc, i; 6314 int rc, i;
@@ -6329,26 +6329,26 @@ static int __iwl_up(struct iwl_priv *priv)
6329 return -EIO; 6329 return -EIO;
6330 } 6330 }
6331 6331
6332 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 6332 iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF);
6333 6333
6334 rc = iwl_hw_nic_init(priv); 6334 rc = iwl3945_hw_nic_init(priv);
6335 if (rc) { 6335 if (rc) {
6336 IWL_ERROR("Unable to int nic\n"); 6336 IWL_ERROR("Unable to int nic\n");
6337 return rc; 6337 return rc;
6338 } 6338 }
6339 6339
6340 /* make sure rfkill handshake bits are cleared */ 6340 /* make sure rfkill handshake bits are cleared */
6341 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 6341 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
6342 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, 6342 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR,
6343 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 6343 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
6344 6344
6345 /* clear (again), then enable host interrupts */ 6345 /* clear (again), then enable host interrupts */
6346 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 6346 iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF);
6347 iwl_enable_interrupts(priv); 6347 iwl3945_enable_interrupts(priv);
6348 6348
6349 /* really make sure rfkill handshake bits are cleared */ 6349 /* really make sure rfkill handshake bits are cleared */
6350 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 6350 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
6351 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 6351 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
6352 6352
6353 /* Copy original ucode data image from disk into backup cache. 6353 /* Copy original ucode data image from disk into backup cache.
6354 * This will be used to initialize the on-board processor's 6354 * This will be used to initialize the on-board processor's
@@ -6358,12 +6358,12 @@ static int __iwl_up(struct iwl_priv *priv)
6358 6358
6359 for (i = 0; i < MAX_HW_RESTARTS; i++) { 6359 for (i = 0; i < MAX_HW_RESTARTS; i++) {
6360 6360
6361 iwl_clear_stations_table(priv); 6361 iwl3945_clear_stations_table(priv);
6362 6362
6363 /* load bootstrap state machine, 6363 /* load bootstrap state machine,
6364 * load bootstrap program into processor's memory, 6364 * load bootstrap program into processor's memory,
6365 * prepare to load the "initialize" uCode */ 6365 * prepare to load the "initialize" uCode */
6366 rc = iwl_load_bsm(priv); 6366 rc = iwl3945_load_bsm(priv);
6367 6367
6368 if (rc) { 6368 if (rc) {
6369 IWL_ERROR("Unable to set up bootstrap uCode: %d\n", rc); 6369 IWL_ERROR("Unable to set up bootstrap uCode: %d\n", rc);
@@ -6371,7 +6371,7 @@ static int __iwl_up(struct iwl_priv *priv)
6371 } 6371 }
6372 6372
6373 /* start card; "initialize" will load runtime ucode */ 6373 /* start card; "initialize" will load runtime ucode */
6374 iwl_nic_start(priv); 6374 iwl3945_nic_start(priv);
6375 6375
6376 /* MAC Address location in EEPROM same for 3945/4965 */ 6376 /* MAC Address location in EEPROM same for 3945/4965 */
6377 get_eeprom_mac(priv, priv->mac_addr); 6377 get_eeprom_mac(priv, priv->mac_addr);
@@ -6386,7 +6386,7 @@ static int __iwl_up(struct iwl_priv *priv)
6386 } 6386 }
6387 6387
6388 set_bit(STATUS_EXIT_PENDING, &priv->status); 6388 set_bit(STATUS_EXIT_PENDING, &priv->status);
6389 __iwl_down(priv); 6389 __iwl3945_down(priv);
6390 6390
6391 /* tried to restart and config the device for as long as our 6391 /* tried to restart and config the device for as long as our
6392 * patience could withstand */ 6392 * patience could withstand */
@@ -6401,35 +6401,35 @@ static int __iwl_up(struct iwl_priv *priv)
6401 * 6401 *
6402 *****************************************************************************/ 6402 *****************************************************************************/
6403 6403
6404static void iwl_bg_init_alive_start(struct work_struct *data) 6404static void iwl3945_bg_init_alive_start(struct work_struct *data)
6405{ 6405{
6406 struct iwl_priv *priv = 6406 struct iwl3945_priv *priv =
6407 container_of(data, struct iwl_priv, init_alive_start.work); 6407 container_of(data, struct iwl3945_priv, init_alive_start.work);
6408 6408
6409 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6409 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6410 return; 6410 return;
6411 6411
6412 mutex_lock(&priv->mutex); 6412 mutex_lock(&priv->mutex);
6413 iwl_init_alive_start(priv); 6413 iwl3945_init_alive_start(priv);
6414 mutex_unlock(&priv->mutex); 6414 mutex_unlock(&priv->mutex);
6415} 6415}
6416 6416
6417static void iwl_bg_alive_start(struct work_struct *data) 6417static void iwl3945_bg_alive_start(struct work_struct *data)
6418{ 6418{
6419 struct iwl_priv *priv = 6419 struct iwl3945_priv *priv =
6420 container_of(data, struct iwl_priv, alive_start.work); 6420 container_of(data, struct iwl3945_priv, alive_start.work);
6421 6421
6422 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6422 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6423 return; 6423 return;
6424 6424
6425 mutex_lock(&priv->mutex); 6425 mutex_lock(&priv->mutex);
6426 iwl_alive_start(priv); 6426 iwl3945_alive_start(priv);
6427 mutex_unlock(&priv->mutex); 6427 mutex_unlock(&priv->mutex);
6428} 6428}
6429 6429
6430static void iwl_bg_rf_kill(struct work_struct *work) 6430static void iwl3945_bg_rf_kill(struct work_struct *work)
6431{ 6431{
6432 struct iwl_priv *priv = container_of(work, struct iwl_priv, rf_kill); 6432 struct iwl3945_priv *priv = container_of(work, struct iwl3945_priv, rf_kill);
6433 6433
6434 wake_up_interruptible(&priv->wait_command_queue); 6434 wake_up_interruptible(&priv->wait_command_queue);
6435 6435
@@ -6438,7 +6438,7 @@ static void iwl_bg_rf_kill(struct work_struct *work)
6438 6438
6439 mutex_lock(&priv->mutex); 6439 mutex_lock(&priv->mutex);
6440 6440
6441 if (!iwl_is_rfkill(priv)) { 6441 if (!iwl3945_is_rfkill(priv)) {
6442 IWL_DEBUG(IWL_DL_INFO | IWL_DL_RF_KILL, 6442 IWL_DEBUG(IWL_DL_INFO | IWL_DL_RF_KILL,
6443 "HW and/or SW RF Kill no longer active, restarting " 6443 "HW and/or SW RF Kill no longer active, restarting "
6444 "device\n"); 6444 "device\n");
@@ -6459,10 +6459,10 @@ static void iwl_bg_rf_kill(struct work_struct *work)
6459 6459
6460#define IWL_SCAN_CHECK_WATCHDOG (7 * HZ) 6460#define IWL_SCAN_CHECK_WATCHDOG (7 * HZ)
6461 6461
6462static void iwl_bg_scan_check(struct work_struct *data) 6462static void iwl3945_bg_scan_check(struct work_struct *data)
6463{ 6463{
6464 struct iwl_priv *priv = 6464 struct iwl3945_priv *priv =
6465 container_of(data, struct iwl_priv, scan_check.work); 6465 container_of(data, struct iwl3945_priv, scan_check.work);
6466 6466
6467 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6467 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6468 return; 6468 return;
@@ -6475,22 +6475,22 @@ static void iwl_bg_scan_check(struct work_struct *data)
6475 jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); 6475 jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG));
6476 6476
6477 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) 6477 if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
6478 iwl_send_scan_abort(priv); 6478 iwl3945_send_scan_abort(priv);
6479 } 6479 }
6480 mutex_unlock(&priv->mutex); 6480 mutex_unlock(&priv->mutex);
6481} 6481}
6482 6482
6483static void iwl_bg_request_scan(struct work_struct *data) 6483static void iwl3945_bg_request_scan(struct work_struct *data)
6484{ 6484{
6485 struct iwl_priv *priv = 6485 struct iwl3945_priv *priv =
6486 container_of(data, struct iwl_priv, request_scan); 6486 container_of(data, struct iwl3945_priv, request_scan);
6487 struct iwl_host_cmd cmd = { 6487 struct iwl3945_host_cmd cmd = {
6488 .id = REPLY_SCAN_CMD, 6488 .id = REPLY_SCAN_CMD,
6489 .len = sizeof(struct iwl_scan_cmd), 6489 .len = sizeof(struct iwl3945_scan_cmd),
6490 .meta.flags = CMD_SIZE_HUGE, 6490 .meta.flags = CMD_SIZE_HUGE,
6491 }; 6491 };
6492 int rc = 0; 6492 int rc = 0;
6493 struct iwl_scan_cmd *scan; 6493 struct iwl3945_scan_cmd *scan;
6494 struct ieee80211_conf *conf = NULL; 6494 struct ieee80211_conf *conf = NULL;
6495 u8 direct_mask; 6495 u8 direct_mask;
6496 int phymode; 6496 int phymode;
@@ -6499,7 +6499,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6499 6499
6500 mutex_lock(&priv->mutex); 6500 mutex_lock(&priv->mutex);
6501 6501
6502 if (!iwl_is_ready(priv)) { 6502 if (!iwl3945_is_ready(priv)) {
6503 IWL_WARNING("request scan called when driver not ready.\n"); 6503 IWL_WARNING("request scan called when driver not ready.\n");
6504 goto done; 6504 goto done;
6505 } 6505 }
@@ -6528,7 +6528,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6528 goto done; 6528 goto done;
6529 } 6529 }
6530 6530
6531 if (iwl_is_rfkill(priv)) { 6531 if (iwl3945_is_rfkill(priv)) {
6532 IWL_DEBUG_HC("Aborting scan due to RF Kill activation\n"); 6532 IWL_DEBUG_HC("Aborting scan due to RF Kill activation\n");
6533 goto done; 6533 goto done;
6534 } 6534 }
@@ -6544,7 +6544,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6544 } 6544 }
6545 6545
6546 if (!priv->scan) { 6546 if (!priv->scan) {
6547 priv->scan = kmalloc(sizeof(struct iwl_scan_cmd) + 6547 priv->scan = kmalloc(sizeof(struct iwl3945_scan_cmd) +
6548 IWL_MAX_SCAN_SIZE, GFP_KERNEL); 6548 IWL_MAX_SCAN_SIZE, GFP_KERNEL);
6549 if (!priv->scan) { 6549 if (!priv->scan) {
6550 rc = -ENOMEM; 6550 rc = -ENOMEM;
@@ -6552,12 +6552,12 @@ static void iwl_bg_request_scan(struct work_struct *data)
6552 } 6552 }
6553 } 6553 }
6554 scan = priv->scan; 6554 scan = priv->scan;
6555 memset(scan, 0, sizeof(struct iwl_scan_cmd) + IWL_MAX_SCAN_SIZE); 6555 memset(scan, 0, sizeof(struct iwl3945_scan_cmd) + IWL_MAX_SCAN_SIZE);
6556 6556
6557 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; 6557 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH;
6558 scan->quiet_time = IWL_ACTIVE_QUIET_TIME; 6558 scan->quiet_time = IWL_ACTIVE_QUIET_TIME;
6559 6559
6560 if (iwl_is_associated(priv)) { 6560 if (iwl3945_is_associated(priv)) {
6561 u16 interval = 0; 6561 u16 interval = 0;
6562 u32 extra; 6562 u32 extra;
6563 u32 suspend_time = 100; 6563 u32 suspend_time = 100;
@@ -6594,14 +6594,14 @@ static void iwl_bg_request_scan(struct work_struct *data)
6594 if (priv->one_direct_scan) { 6594 if (priv->one_direct_scan) {
6595 IWL_DEBUG_SCAN 6595 IWL_DEBUG_SCAN
6596 ("Kicking off one direct scan for '%s'\n", 6596 ("Kicking off one direct scan for '%s'\n",
6597 iwl_escape_essid(priv->direct_ssid, 6597 iwl3945_escape_essid(priv->direct_ssid,
6598 priv->direct_ssid_len)); 6598 priv->direct_ssid_len));
6599 scan->direct_scan[0].id = WLAN_EID_SSID; 6599 scan->direct_scan[0].id = WLAN_EID_SSID;
6600 scan->direct_scan[0].len = priv->direct_ssid_len; 6600 scan->direct_scan[0].len = priv->direct_ssid_len;
6601 memcpy(scan->direct_scan[0].ssid, 6601 memcpy(scan->direct_scan[0].ssid,
6602 priv->direct_ssid, priv->direct_ssid_len); 6602 priv->direct_ssid, priv->direct_ssid_len);
6603 direct_mask = 1; 6603 direct_mask = 1;
6604 } else if (!iwl_is_associated(priv) && priv->essid_len) { 6604 } else if (!iwl3945_is_associated(priv) && priv->essid_len) {
6605 scan->direct_scan[0].id = WLAN_EID_SSID; 6605 scan->direct_scan[0].id = WLAN_EID_SSID;
6606 scan->direct_scan[0].len = priv->essid_len; 6606 scan->direct_scan[0].len = priv->essid_len;
6607 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); 6607 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
@@ -6612,7 +6612,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6612 /* We don't build a direct scan probe request; the uCode will do 6612 /* We don't build a direct scan probe request; the uCode will do
6613 * that based on the direct_mask added to each channel entry */ 6613 * that based on the direct_mask added to each channel entry */
6614 scan->tx_cmd.len = cpu_to_le16( 6614 scan->tx_cmd.len = cpu_to_le16(
6615 iwl_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, 6615 iwl3945_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data,
6616 IWL_MAX_SCAN_SIZE - sizeof(scan), 0)); 6616 IWL_MAX_SCAN_SIZE - sizeof(scan), 0));
6617 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; 6617 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
6618 scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; 6618 scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id;
@@ -6648,23 +6648,23 @@ static void iwl_bg_request_scan(struct work_struct *data)
6648 if (direct_mask) 6648 if (direct_mask)
6649 IWL_DEBUG_SCAN 6649 IWL_DEBUG_SCAN
6650 ("Initiating direct scan for %s.\n", 6650 ("Initiating direct scan for %s.\n",
6651 iwl_escape_essid(priv->essid, priv->essid_len)); 6651 iwl3945_escape_essid(priv->essid, priv->essid_len));
6652 else 6652 else
6653 IWL_DEBUG_SCAN("Initiating indirect scan.\n"); 6653 IWL_DEBUG_SCAN("Initiating indirect scan.\n");
6654 6654
6655 scan->channel_count = 6655 scan->channel_count =
6656 iwl_get_channels_for_scan( 6656 iwl3945_get_channels_for_scan(
6657 priv, phymode, 1, /* active */ 6657 priv, phymode, 1, /* active */
6658 direct_mask, 6658 direct_mask,
6659 (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); 6659 (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]);
6660 6660
6661 cmd.len += le16_to_cpu(scan->tx_cmd.len) + 6661 cmd.len += le16_to_cpu(scan->tx_cmd.len) +
6662 scan->channel_count * sizeof(struct iwl_scan_channel); 6662 scan->channel_count * sizeof(struct iwl3945_scan_channel);
6663 cmd.data = scan; 6663 cmd.data = scan;
6664 scan->len = cpu_to_le16(cmd.len); 6664 scan->len = cpu_to_le16(cmd.len);
6665 6665
6666 set_bit(STATUS_SCAN_HW, &priv->status); 6666 set_bit(STATUS_SCAN_HW, &priv->status);
6667 rc = iwl_send_cmd_sync(priv, &cmd); 6667 rc = iwl3945_send_cmd_sync(priv, &cmd);
6668 if (rc) 6668 if (rc)
6669 goto done; 6669 goto done;
6670 6670
@@ -6680,45 +6680,45 @@ static void iwl_bg_request_scan(struct work_struct *data)
6680 mutex_unlock(&priv->mutex); 6680 mutex_unlock(&priv->mutex);
6681} 6681}
6682 6682
6683static void iwl_bg_up(struct work_struct *data) 6683static void iwl3945_bg_up(struct work_struct *data)
6684{ 6684{
6685 struct iwl_priv *priv = container_of(data, struct iwl_priv, up); 6685 struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv, up);
6686 6686
6687 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6687 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6688 return; 6688 return;
6689 6689
6690 mutex_lock(&priv->mutex); 6690 mutex_lock(&priv->mutex);
6691 __iwl_up(priv); 6691 __iwl3945_up(priv);
6692 mutex_unlock(&priv->mutex); 6692 mutex_unlock(&priv->mutex);
6693} 6693}
6694 6694
6695static void iwl_bg_restart(struct work_struct *data) 6695static void iwl3945_bg_restart(struct work_struct *data)
6696{ 6696{
6697 struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); 6697 struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv, restart);
6698 6698
6699 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6699 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6700 return; 6700 return;
6701 6701
6702 iwl_down(priv); 6702 iwl3945_down(priv);
6703 queue_work(priv->workqueue, &priv->up); 6703 queue_work(priv->workqueue, &priv->up);
6704} 6704}
6705 6705
6706static void iwl_bg_rx_replenish(struct work_struct *data) 6706static void iwl3945_bg_rx_replenish(struct work_struct *data)
6707{ 6707{
6708 struct iwl_priv *priv = 6708 struct iwl3945_priv *priv =
6709 container_of(data, struct iwl_priv, rx_replenish); 6709 container_of(data, struct iwl3945_priv, rx_replenish);
6710 6710
6711 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6711 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6712 return; 6712 return;
6713 6713
6714 mutex_lock(&priv->mutex); 6714 mutex_lock(&priv->mutex);
6715 iwl_rx_replenish(priv); 6715 iwl3945_rx_replenish(priv);
6716 mutex_unlock(&priv->mutex); 6716 mutex_unlock(&priv->mutex);
6717} 6717}
6718 6718
6719static void iwl_bg_post_associate(struct work_struct *data) 6719static void iwl3945_bg_post_associate(struct work_struct *data)
6720{ 6720{
6721 struct iwl_priv *priv = container_of(data, struct iwl_priv, 6721 struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv,
6722 post_associate.work); 6722 post_associate.work);
6723 6723
6724 int rc = 0; 6724 int rc = 0;
@@ -6744,16 +6744,16 @@ static void iwl_bg_post_associate(struct work_struct *data)
6744 mutex_unlock(&priv->mutex); 6744 mutex_unlock(&priv->mutex);
6745 return; 6745 return;
6746 } 6746 }
6747 iwl_scan_cancel_timeout(priv, 200); 6747 iwl3945_scan_cancel_timeout(priv, 200);
6748 6748
6749 conf = ieee80211_get_hw_conf(priv->hw); 6749 conf = ieee80211_get_hw_conf(priv->hw);
6750 6750
6751 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 6751 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
6752 iwl_commit_rxon(priv); 6752 iwl3945_commit_rxon(priv);
6753 6753
6754 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); 6754 memset(&priv->rxon_timing, 0, sizeof(struct iwl3945_rxon_time_cmd));
6755 iwl_setup_rxon_timing(priv); 6755 iwl3945_setup_rxon_timing(priv);
6756 rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, 6756 rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON_TIMING,
6757 sizeof(priv->rxon_timing), &priv->rxon_timing); 6757 sizeof(priv->rxon_timing), &priv->rxon_timing);
6758 if (rc) 6758 if (rc)
6759 IWL_WARNING("REPLY_RXON_TIMING failed - " 6759 IWL_WARNING("REPLY_RXON_TIMING failed - "
@@ -6782,26 +6782,26 @@ static void iwl_bg_post_associate(struct work_struct *data)
6782 6782
6783 } 6783 }
6784 6784
6785 iwl_commit_rxon(priv); 6785 iwl3945_commit_rxon(priv);
6786 6786
6787 switch (priv->iw_mode) { 6787 switch (priv->iw_mode) {
6788 case IEEE80211_IF_TYPE_STA: 6788 case IEEE80211_IF_TYPE_STA:
6789 iwl_rate_scale_init(priv->hw, IWL_AP_ID); 6789 iwl3945_rate_scale_init(priv->hw, IWL_AP_ID);
6790 break; 6790 break;
6791 6791
6792 case IEEE80211_IF_TYPE_IBSS: 6792 case IEEE80211_IF_TYPE_IBSS:
6793 6793
6794 /* clear out the station table */ 6794 /* clear out the station table */
6795 iwl_clear_stations_table(priv); 6795 iwl3945_clear_stations_table(priv);
6796 6796
6797 iwl_add_station(priv, BROADCAST_ADDR, 0, 0); 6797 iwl3945_add_station(priv, iwl3945_broadcast_addr, 0, 0);
6798 iwl_add_station(priv, priv->bssid, 0, 0); 6798 iwl3945_add_station(priv, priv->bssid, 0, 0);
6799 iwl3945_sync_sta(priv, IWL_STA_ID, 6799 iwl3945_sync_sta(priv, IWL_STA_ID,
6800 (priv->phymode == MODE_IEEE80211A)? 6800 (priv->phymode == MODE_IEEE80211A)?
6801 IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP, 6801 IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP,
6802 CMD_ASYNC); 6802 CMD_ASYNC);
6803 iwl_rate_scale_init(priv->hw, IWL_STA_ID); 6803 iwl3945_rate_scale_init(priv->hw, IWL_STA_ID);
6804 iwl_send_beacon_cmd(priv); 6804 iwl3945_send_beacon_cmd(priv);
6805 6805
6806 break; 6806 break;
6807 6807
@@ -6811,33 +6811,33 @@ static void iwl_bg_post_associate(struct work_struct *data)
6811 break; 6811 break;
6812 } 6812 }
6813 6813
6814 iwl_sequence_reset(priv); 6814 iwl3945_sequence_reset(priv);
6815 6815
6816#ifdef CONFIG_IWL3945_QOS 6816#ifdef CONFIG_IWL3945_QOS
6817 iwl_activate_qos(priv, 0); 6817 iwl3945_activate_qos(priv, 0);
6818#endif /* CONFIG_IWL3945_QOS */ 6818#endif /* CONFIG_IWL3945_QOS */
6819 mutex_unlock(&priv->mutex); 6819 mutex_unlock(&priv->mutex);
6820} 6820}
6821 6821
6822static void iwl_bg_abort_scan(struct work_struct *work) 6822static void iwl3945_bg_abort_scan(struct work_struct *work)
6823{ 6823{
6824 struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); 6824 struct iwl3945_priv *priv = container_of(work, struct iwl3945_priv, abort_scan);
6825 6825
6826 if (!iwl_is_ready(priv)) 6826 if (!iwl3945_is_ready(priv))
6827 return; 6827 return;
6828 6828
6829 mutex_lock(&priv->mutex); 6829 mutex_lock(&priv->mutex);
6830 6830
6831 set_bit(STATUS_SCAN_ABORTING, &priv->status); 6831 set_bit(STATUS_SCAN_ABORTING, &priv->status);
6832 iwl_send_scan_abort(priv); 6832 iwl3945_send_scan_abort(priv);
6833 6833
6834 mutex_unlock(&priv->mutex); 6834 mutex_unlock(&priv->mutex);
6835} 6835}
6836 6836
6837static void iwl_bg_scan_completed(struct work_struct *work) 6837static void iwl3945_bg_scan_completed(struct work_struct *work)
6838{ 6838{
6839 struct iwl_priv *priv = 6839 struct iwl3945_priv *priv =
6840 container_of(work, struct iwl_priv, scan_completed); 6840 container_of(work, struct iwl3945_priv, scan_completed);
6841 6841
6842 IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, "SCAN complete scan\n"); 6842 IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, "SCAN complete scan\n");
6843 6843
@@ -6849,7 +6849,7 @@ static void iwl_bg_scan_completed(struct work_struct *work)
6849 /* Since setting the TXPOWER may have been deferred while 6849 /* Since setting the TXPOWER may have been deferred while
6850 * performing the scan, fire one off */ 6850 * performing the scan, fire one off */
6851 mutex_lock(&priv->mutex); 6851 mutex_lock(&priv->mutex);
6852 iwl_hw_reg_send_txpower(priv); 6852 iwl3945_hw_reg_send_txpower(priv);
6853 mutex_unlock(&priv->mutex); 6853 mutex_unlock(&priv->mutex);
6854} 6854}
6855 6855
@@ -6859,9 +6859,9 @@ static void iwl_bg_scan_completed(struct work_struct *work)
6859 * 6859 *
6860 *****************************************************************************/ 6860 *****************************************************************************/
6861 6861
6862static int iwl_mac_start(struct ieee80211_hw *hw) 6862static int iwl3945_mac_start(struct ieee80211_hw *hw)
6863{ 6863{
6864 struct iwl_priv *priv = hw->priv; 6864 struct iwl3945_priv *priv = hw->priv;
6865 6865
6866 IWL_DEBUG_MAC80211("enter\n"); 6866 IWL_DEBUG_MAC80211("enter\n");
6867 6867
@@ -6870,7 +6870,7 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
6870 6870
6871 priv->is_open = 1; 6871 priv->is_open = 1;
6872 6872
6873 if (!iwl_is_rfkill(priv)) 6873 if (!iwl3945_is_rfkill(priv))
6874 ieee80211_start_queues(priv->hw); 6874 ieee80211_start_queues(priv->hw);
6875 6875
6876 mutex_unlock(&priv->mutex); 6876 mutex_unlock(&priv->mutex);
@@ -6878,9 +6878,9 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
6878 return 0; 6878 return 0;
6879} 6879}
6880 6880
6881static void iwl_mac_stop(struct ieee80211_hw *hw) 6881static void iwl3945_mac_stop(struct ieee80211_hw *hw)
6882{ 6882{
6883 struct iwl_priv *priv = hw->priv; 6883 struct iwl3945_priv *priv = hw->priv;
6884 6884
6885 IWL_DEBUG_MAC80211("enter\n"); 6885 IWL_DEBUG_MAC80211("enter\n");
6886 6886
@@ -6890,19 +6890,19 @@ static void iwl_mac_stop(struct ieee80211_hw *hw)
6890 * RXON_FILTER_ASSOC_MSK BIT 6890 * RXON_FILTER_ASSOC_MSK BIT
6891 */ 6891 */
6892 priv->is_open = 0; 6892 priv->is_open = 0;
6893 iwl_scan_cancel_timeout(priv, 100); 6893 iwl3945_scan_cancel_timeout(priv, 100);
6894 cancel_delayed_work(&priv->post_associate); 6894 cancel_delayed_work(&priv->post_associate);
6895 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 6895 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
6896 iwl_commit_rxon(priv); 6896 iwl3945_commit_rxon(priv);
6897 mutex_unlock(&priv->mutex); 6897 mutex_unlock(&priv->mutex);
6898 6898
6899 IWL_DEBUG_MAC80211("leave\n"); 6899 IWL_DEBUG_MAC80211("leave\n");
6900} 6900}
6901 6901
6902static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, 6902static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
6903 struct ieee80211_tx_control *ctl) 6903 struct ieee80211_tx_control *ctl)
6904{ 6904{
6905 struct iwl_priv *priv = hw->priv; 6905 struct iwl3945_priv *priv = hw->priv;
6906 6906
6907 IWL_DEBUG_MAC80211("enter\n"); 6907 IWL_DEBUG_MAC80211("enter\n");
6908 6908
@@ -6914,17 +6914,17 @@ static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
6914 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 6914 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
6915 ctl->tx_rate); 6915 ctl->tx_rate);
6916 6916
6917 if (iwl_tx_skb(priv, skb, ctl)) 6917 if (iwl3945_tx_skb(priv, skb, ctl))
6918 dev_kfree_skb_any(skb); 6918 dev_kfree_skb_any(skb);
6919 6919
6920 IWL_DEBUG_MAC80211("leave\n"); 6920 IWL_DEBUG_MAC80211("leave\n");
6921 return 0; 6921 return 0;
6922} 6922}
6923 6923
6924static int iwl_mac_add_interface(struct ieee80211_hw *hw, 6924static int iwl3945_mac_add_interface(struct ieee80211_hw *hw,
6925 struct ieee80211_if_init_conf *conf) 6925 struct ieee80211_if_init_conf *conf)
6926{ 6926{
6927 struct iwl_priv *priv = hw->priv; 6927 struct iwl3945_priv *priv = hw->priv;
6928 unsigned long flags; 6928 unsigned long flags;
6929 DECLARE_MAC_BUF(mac); 6929 DECLARE_MAC_BUF(mac);
6930 6930
@@ -6947,7 +6947,7 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
6947 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); 6947 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
6948 } 6948 }
6949 6949
6950 iwl_set_mode(priv, conf->type); 6950 iwl3945_set_mode(priv, conf->type);
6951 6951
6952 IWL_DEBUG_MAC80211("leave\n"); 6952 IWL_DEBUG_MAC80211("leave\n");
6953 mutex_unlock(&priv->mutex); 6953 mutex_unlock(&priv->mutex);
@@ -6956,22 +6956,22 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
6956} 6956}
6957 6957
6958/** 6958/**
6959 * iwl_mac_config - mac80211 config callback 6959 * iwl3945_mac_config - mac80211 config callback
6960 * 6960 *
6961 * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to 6961 * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to
6962 * be set inappropriately and the driver currently sets the hardware up to 6962 * be set inappropriately and the driver currently sets the hardware up to
6963 * use it whenever needed. 6963 * use it whenever needed.
6964 */ 6964 */
6965static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) 6965static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
6966{ 6966{
6967 struct iwl_priv *priv = hw->priv; 6967 struct iwl3945_priv *priv = hw->priv;
6968 const struct iwl_channel_info *ch_info; 6968 const struct iwl3945_channel_info *ch_info;
6969 unsigned long flags; 6969 unsigned long flags;
6970 6970
6971 mutex_lock(&priv->mutex); 6971 mutex_lock(&priv->mutex);
6972 IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel); 6972 IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel);
6973 6973
6974 if (!iwl_is_ready(priv)) { 6974 if (!iwl3945_is_ready(priv)) {
6975 IWL_DEBUG_MAC80211("leave - not ready\n"); 6975 IWL_DEBUG_MAC80211("leave - not ready\n");
6976 mutex_unlock(&priv->mutex); 6976 mutex_unlock(&priv->mutex);
6977 return -EIO; 6977 return -EIO;
@@ -6979,7 +6979,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
6979 6979
6980 /* TODO: Figure out how to get ieee80211_local->sta_scanning w/ only 6980 /* TODO: Figure out how to get ieee80211_local->sta_scanning w/ only
6981 * what is exposed through include/ declarations */ 6981 * what is exposed through include/ declarations */
6982 if (unlikely(!iwl_param_disable_hw_scan && 6982 if (unlikely(!iwl3945_param_disable_hw_scan &&
6983 test_bit(STATUS_SCANNING, &priv->status))) { 6983 test_bit(STATUS_SCANNING, &priv->status))) {
6984 IWL_DEBUG_MAC80211("leave - scanning\n"); 6984 IWL_DEBUG_MAC80211("leave - scanning\n");
6985 mutex_unlock(&priv->mutex); 6985 mutex_unlock(&priv->mutex);
@@ -6988,7 +6988,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
6988 6988
6989 spin_lock_irqsave(&priv->lock, flags); 6989 spin_lock_irqsave(&priv->lock, flags);
6990 6990
6991 ch_info = iwl_get_channel_info(priv, conf->phymode, conf->channel); 6991 ch_info = iwl3945_get_channel_info(priv, conf->phymode, conf->channel);
6992 if (!is_channel_valid(ch_info)) { 6992 if (!is_channel_valid(ch_info)) {
6993 IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this SKU.\n", 6993 IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this SKU.\n",
6994 conf->channel, conf->phymode); 6994 conf->channel, conf->phymode);
@@ -6998,26 +6998,26 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
6998 return -EINVAL; 6998 return -EINVAL;
6999 } 6999 }
7000 7000
7001 iwl_set_rxon_channel(priv, conf->phymode, conf->channel); 7001 iwl3945_set_rxon_channel(priv, conf->phymode, conf->channel);
7002 7002
7003 iwl_set_flags_for_phymode(priv, conf->phymode); 7003 iwl3945_set_flags_for_phymode(priv, conf->phymode);
7004 7004
7005 /* The list of supported rates and rate mask can be different 7005 /* The list of supported rates and rate mask can be different
7006 * for each phymode; since the phymode may have changed, reset 7006 * for each phymode; since the phymode may have changed, reset
7007 * the rate mask to what mac80211 lists */ 7007 * the rate mask to what mac80211 lists */
7008 iwl_set_rate(priv); 7008 iwl3945_set_rate(priv);
7009 7009
7010 spin_unlock_irqrestore(&priv->lock, flags); 7010 spin_unlock_irqrestore(&priv->lock, flags);
7011 7011
7012#ifdef IEEE80211_CONF_CHANNEL_SWITCH 7012#ifdef IEEE80211_CONF_CHANNEL_SWITCH
7013 if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) { 7013 if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) {
7014 iwl_hw_channel_switch(priv, conf->channel); 7014 iwl3945_hw_channel_switch(priv, conf->channel);
7015 mutex_unlock(&priv->mutex); 7015 mutex_unlock(&priv->mutex);
7016 return 0; 7016 return 0;
7017 } 7017 }
7018#endif 7018#endif
7019 7019
7020 iwl_radio_kill_sw(priv, !conf->radio_enabled); 7020 iwl3945_radio_kill_sw(priv, !conf->radio_enabled);
7021 7021
7022 if (!conf->radio_enabled) { 7022 if (!conf->radio_enabled) {
7023 IWL_DEBUG_MAC80211("leave - radio disabled\n"); 7023 IWL_DEBUG_MAC80211("leave - radio disabled\n");
@@ -7025,17 +7025,17 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
7025 return 0; 7025 return 0;
7026 } 7026 }
7027 7027
7028 if (iwl_is_rfkill(priv)) { 7028 if (iwl3945_is_rfkill(priv)) {
7029 IWL_DEBUG_MAC80211("leave - RF kill\n"); 7029 IWL_DEBUG_MAC80211("leave - RF kill\n");
7030 mutex_unlock(&priv->mutex); 7030 mutex_unlock(&priv->mutex);
7031 return -EIO; 7031 return -EIO;
7032 } 7032 }
7033 7033
7034 iwl_set_rate(priv); 7034 iwl3945_set_rate(priv);
7035 7035
7036 if (memcmp(&priv->active_rxon, 7036 if (memcmp(&priv->active_rxon,
7037 &priv->staging_rxon, sizeof(priv->staging_rxon))) 7037 &priv->staging_rxon, sizeof(priv->staging_rxon)))
7038 iwl_commit_rxon(priv); 7038 iwl3945_commit_rxon(priv);
7039 else 7039 else
7040 IWL_DEBUG_INFO("No re-sending same RXON configuration.\n"); 7040 IWL_DEBUG_INFO("No re-sending same RXON configuration.\n");
7041 7041
@@ -7046,7 +7046,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
7046 return 0; 7046 return 0;
7047} 7047}
7048 7048
7049static void iwl_config_ap(struct iwl_priv *priv) 7049static void iwl3945_config_ap(struct iwl3945_priv *priv)
7050{ 7050{
7051 int rc = 0; 7051 int rc = 0;
7052 7052
@@ -7058,12 +7058,12 @@ static void iwl_config_ap(struct iwl_priv *priv)
7058 7058
7059 /* RXON - unassoc (to set timing command) */ 7059 /* RXON - unassoc (to set timing command) */
7060 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7060 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7061 iwl_commit_rxon(priv); 7061 iwl3945_commit_rxon(priv);
7062 7062
7063 /* RXON Timing */ 7063 /* RXON Timing */
7064 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); 7064 memset(&priv->rxon_timing, 0, sizeof(struct iwl3945_rxon_time_cmd));
7065 iwl_setup_rxon_timing(priv); 7065 iwl3945_setup_rxon_timing(priv);
7066 rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, 7066 rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON_TIMING,
7067 sizeof(priv->rxon_timing), &priv->rxon_timing); 7067 sizeof(priv->rxon_timing), &priv->rxon_timing);
7068 if (rc) 7068 if (rc)
7069 IWL_WARNING("REPLY_RXON_TIMING failed - " 7069 IWL_WARNING("REPLY_RXON_TIMING failed - "
@@ -7093,20 +7093,20 @@ static void iwl_config_ap(struct iwl_priv *priv)
7093 } 7093 }
7094 /* restore RXON assoc */ 7094 /* restore RXON assoc */
7095 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; 7095 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
7096 iwl_commit_rxon(priv); 7096 iwl3945_commit_rxon(priv);
7097 iwl_add_station(priv, BROADCAST_ADDR, 0, 0); 7097 iwl3945_add_station(priv, iwl3945_broadcast_addr, 0, 0);
7098 } 7098 }
7099 iwl_send_beacon_cmd(priv); 7099 iwl3945_send_beacon_cmd(priv);
7100 7100
7101 /* FIXME - we need to add code here to detect a totally new 7101 /* FIXME - we need to add code here to detect a totally new
7102 * configuration, reset the AP, unassoc, rxon timing, assoc, 7102 * configuration, reset the AP, unassoc, rxon timing, assoc,
7103 * clear sta table, add BCAST sta... */ 7103 * clear sta table, add BCAST sta... */
7104} 7104}
7105 7105
7106static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, 7106static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7107 struct ieee80211_if_conf *conf) 7107 struct ieee80211_if_conf *conf)
7108{ 7108{
7109 struct iwl_priv *priv = hw->priv; 7109 struct iwl3945_priv *priv = hw->priv;
7110 DECLARE_MAC_BUF(mac); 7110 DECLARE_MAC_BUF(mac);
7111 unsigned long flags; 7111 unsigned long flags;
7112 int rc; 7112 int rc;
@@ -7165,7 +7165,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7165 !is_multicast_ether_addr(conf->bssid)) { 7165 !is_multicast_ether_addr(conf->bssid)) {
7166 /* If there is currently a HW scan going on in the background 7166 /* If there is currently a HW scan going on in the background
7167 * then we need to cancel it else the RXON below will fail. */ 7167 * then we need to cancel it else the RXON below will fail. */
7168 if (iwl_scan_cancel_timeout(priv, 100)) { 7168 if (iwl3945_scan_cancel_timeout(priv, 100)) {
7169 IWL_WARNING("Aborted scan still in progress " 7169 IWL_WARNING("Aborted scan still in progress "
7170 "after 100ms\n"); 7170 "after 100ms\n");
7171 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); 7171 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n");
@@ -7181,18 +7181,18 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7181 memcpy(priv->bssid, conf->bssid, ETH_ALEN); 7181 memcpy(priv->bssid, conf->bssid, ETH_ALEN);
7182 7182
7183 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) 7183 if (priv->iw_mode == IEEE80211_IF_TYPE_AP)
7184 iwl_config_ap(priv); 7184 iwl3945_config_ap(priv);
7185 else { 7185 else {
7186 rc = iwl_commit_rxon(priv); 7186 rc = iwl3945_commit_rxon(priv);
7187 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) 7187 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc)
7188 iwl_add_station(priv, 7188 iwl3945_add_station(priv,
7189 priv->active_rxon.bssid_addr, 1, 0); 7189 priv->active_rxon.bssid_addr, 1, 0);
7190 } 7190 }
7191 7191
7192 } else { 7192 } else {
7193 iwl_scan_cancel_timeout(priv, 100); 7193 iwl3945_scan_cancel_timeout(priv, 100);
7194 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7194 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7195 iwl_commit_rxon(priv); 7195 iwl3945_commit_rxon(priv);
7196 } 7196 }
7197 7197
7198 spin_lock_irqsave(&priv->lock, flags); 7198 spin_lock_irqsave(&priv->lock, flags);
@@ -7210,31 +7210,31 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7210 return 0; 7210 return 0;
7211} 7211}
7212 7212
7213static void iwl_configure_filter(struct ieee80211_hw *hw, 7213static void iwl3945_configure_filter(struct ieee80211_hw *hw,
7214 unsigned int changed_flags, 7214 unsigned int changed_flags,
7215 unsigned int *total_flags, 7215 unsigned int *total_flags,
7216 int mc_count, struct dev_addr_list *mc_list) 7216 int mc_count, struct dev_addr_list *mc_list)
7217{ 7217{
7218 /* 7218 /*
7219 * XXX: dummy 7219 * XXX: dummy
7220 * see also iwl_connection_init_rx_config 7220 * see also iwl3945_connection_init_rx_config
7221 */ 7221 */
7222 *total_flags = 0; 7222 *total_flags = 0;
7223} 7223}
7224 7224
7225static void iwl_mac_remove_interface(struct ieee80211_hw *hw, 7225static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw,
7226 struct ieee80211_if_init_conf *conf) 7226 struct ieee80211_if_init_conf *conf)
7227{ 7227{
7228 struct iwl_priv *priv = hw->priv; 7228 struct iwl3945_priv *priv = hw->priv;
7229 7229
7230 IWL_DEBUG_MAC80211("enter\n"); 7230 IWL_DEBUG_MAC80211("enter\n");
7231 7231
7232 mutex_lock(&priv->mutex); 7232 mutex_lock(&priv->mutex);
7233 7233
7234 iwl_scan_cancel_timeout(priv, 100); 7234 iwl3945_scan_cancel_timeout(priv, 100);
7235 cancel_delayed_work(&priv->post_associate); 7235 cancel_delayed_work(&priv->post_associate);
7236 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7236 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7237 iwl_commit_rxon(priv); 7237 iwl3945_commit_rxon(priv);
7238 7238
7239 if (priv->interface_id == conf->if_id) { 7239 if (priv->interface_id == conf->if_id) {
7240 priv->interface_id = 0; 7240 priv->interface_id = 0;
@@ -7249,18 +7249,18 @@ static void iwl_mac_remove_interface(struct ieee80211_hw *hw,
7249} 7249}
7250 7250
7251#define IWL_DELAY_NEXT_SCAN (HZ*2) 7251#define IWL_DELAY_NEXT_SCAN (HZ*2)
7252static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) 7252static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7253{ 7253{
7254 int rc = 0; 7254 int rc = 0;
7255 unsigned long flags; 7255 unsigned long flags;
7256 struct iwl_priv *priv = hw->priv; 7256 struct iwl3945_priv *priv = hw->priv;
7257 7257
7258 IWL_DEBUG_MAC80211("enter\n"); 7258 IWL_DEBUG_MAC80211("enter\n");
7259 7259
7260 mutex_lock(&priv->mutex); 7260 mutex_lock(&priv->mutex);
7261 spin_lock_irqsave(&priv->lock, flags); 7261 spin_lock_irqsave(&priv->lock, flags);
7262 7262
7263 if (!iwl_is_ready_rf(priv)) { 7263 if (!iwl3945_is_ready_rf(priv)) {
7264 rc = -EIO; 7264 rc = -EIO;
7265 IWL_DEBUG_MAC80211("leave - not ready or exit pending\n"); 7265 IWL_DEBUG_MAC80211("leave - not ready or exit pending\n");
7266 goto out_unlock; 7266 goto out_unlock;
@@ -7282,7 +7282,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7282 if (len) { 7282 if (len) {
7283 IWL_DEBUG_SCAN("direct scan for " 7283 IWL_DEBUG_SCAN("direct scan for "
7284 "%s [%d]\n ", 7284 "%s [%d]\n ",
7285 iwl_escape_essid(ssid, len), (int)len); 7285 iwl3945_escape_essid(ssid, len), (int)len);
7286 7286
7287 priv->one_direct_scan = 1; 7287 priv->one_direct_scan = 1;
7288 priv->direct_ssid_len = (u8) 7288 priv->direct_ssid_len = (u8)
@@ -7291,7 +7291,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7291 } else 7291 } else
7292 priv->one_direct_scan = 0; 7292 priv->one_direct_scan = 0;
7293 7293
7294 rc = iwl_scan_initiate(priv); 7294 rc = iwl3945_scan_initiate(priv);
7295 7295
7296 IWL_DEBUG_MAC80211("leave\n"); 7296 IWL_DEBUG_MAC80211("leave\n");
7297 7297
@@ -7302,17 +7302,17 @@ out_unlock:
7302 return rc; 7302 return rc;
7303} 7303}
7304 7304
7305static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 7305static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7306 const u8 *local_addr, const u8 *addr, 7306 const u8 *local_addr, const u8 *addr,
7307 struct ieee80211_key_conf *key) 7307 struct ieee80211_key_conf *key)
7308{ 7308{
7309 struct iwl_priv *priv = hw->priv; 7309 struct iwl3945_priv *priv = hw->priv;
7310 int rc = 0; 7310 int rc = 0;
7311 u8 sta_id; 7311 u8 sta_id;
7312 7312
7313 IWL_DEBUG_MAC80211("enter\n"); 7313 IWL_DEBUG_MAC80211("enter\n");
7314 7314
7315 if (!iwl_param_hwcrypto) { 7315 if (!iwl3945_param_hwcrypto) {
7316 IWL_DEBUG_MAC80211("leave - hwcrypto disabled\n"); 7316 IWL_DEBUG_MAC80211("leave - hwcrypto disabled\n");
7317 return -EOPNOTSUPP; 7317 return -EOPNOTSUPP;
7318 } 7318 }
@@ -7321,7 +7321,7 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7321 /* only support pairwise keys */ 7321 /* only support pairwise keys */
7322 return -EOPNOTSUPP; 7322 return -EOPNOTSUPP;
7323 7323
7324 sta_id = iwl_hw_find_station(priv, addr); 7324 sta_id = iwl3945_hw_find_station(priv, addr);
7325 if (sta_id == IWL_INVALID_STATION) { 7325 if (sta_id == IWL_INVALID_STATION) {
7326 DECLARE_MAC_BUF(mac); 7326 DECLARE_MAC_BUF(mac);
7327 7327
@@ -7332,24 +7332,24 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7332 7332
7333 mutex_lock(&priv->mutex); 7333 mutex_lock(&priv->mutex);
7334 7334
7335 iwl_scan_cancel_timeout(priv, 100); 7335 iwl3945_scan_cancel_timeout(priv, 100);
7336 7336
7337 switch (cmd) { 7337 switch (cmd) {
7338 case SET_KEY: 7338 case SET_KEY:
7339 rc = iwl_update_sta_key_info(priv, key, sta_id); 7339 rc = iwl3945_update_sta_key_info(priv, key, sta_id);
7340 if (!rc) { 7340 if (!rc) {
7341 iwl_set_rxon_hwcrypto(priv, 1); 7341 iwl3945_set_rxon_hwcrypto(priv, 1);
7342 iwl_commit_rxon(priv); 7342 iwl3945_commit_rxon(priv);
7343 key->hw_key_idx = sta_id; 7343 key->hw_key_idx = sta_id;
7344 IWL_DEBUG_MAC80211("set_key success, using hwcrypto\n"); 7344 IWL_DEBUG_MAC80211("set_key success, using hwcrypto\n");
7345 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 7345 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
7346 } 7346 }
7347 break; 7347 break;
7348 case DISABLE_KEY: 7348 case DISABLE_KEY:
7349 rc = iwl_clear_sta_key_info(priv, sta_id); 7349 rc = iwl3945_clear_sta_key_info(priv, sta_id);
7350 if (!rc) { 7350 if (!rc) {
7351 iwl_set_rxon_hwcrypto(priv, 0); 7351 iwl3945_set_rxon_hwcrypto(priv, 0);
7352 iwl_commit_rxon(priv); 7352 iwl3945_commit_rxon(priv);
7353 IWL_DEBUG_MAC80211("disable hwcrypto key\n"); 7353 IWL_DEBUG_MAC80211("disable hwcrypto key\n");
7354 } 7354 }
7355 break; 7355 break;
@@ -7363,10 +7363,10 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7363 return rc; 7363 return rc;
7364} 7364}
7365 7365
7366static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, 7366static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, int queue,
7367 const struct ieee80211_tx_queue_params *params) 7367 const struct ieee80211_tx_queue_params *params)
7368{ 7368{
7369 struct iwl_priv *priv = hw->priv; 7369 struct iwl3945_priv *priv = hw->priv;
7370#ifdef CONFIG_IWL3945_QOS 7370#ifdef CONFIG_IWL3945_QOS
7371 unsigned long flags; 7371 unsigned long flags;
7372 int q; 7372 int q;
@@ -7374,7 +7374,7 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue,
7374 7374
7375 IWL_DEBUG_MAC80211("enter\n"); 7375 IWL_DEBUG_MAC80211("enter\n");
7376 7376
7377 if (!iwl_is_ready_rf(priv)) { 7377 if (!iwl3945_is_ready_rf(priv)) {
7378 IWL_DEBUG_MAC80211("leave - RF not ready\n"); 7378 IWL_DEBUG_MAC80211("leave - RF not ready\n");
7379 return -EIO; 7379 return -EIO;
7380 } 7380 }
@@ -7407,9 +7407,9 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue,
7407 7407
7408 mutex_lock(&priv->mutex); 7408 mutex_lock(&priv->mutex);
7409 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) 7409 if (priv->iw_mode == IEEE80211_IF_TYPE_AP)
7410 iwl_activate_qos(priv, 1); 7410 iwl3945_activate_qos(priv, 1);
7411 else if (priv->assoc_id && iwl_is_associated(priv)) 7411 else if (priv->assoc_id && iwl3945_is_associated(priv))
7412 iwl_activate_qos(priv, 0); 7412 iwl3945_activate_qos(priv, 0);
7413 7413
7414 mutex_unlock(&priv->mutex); 7414 mutex_unlock(&priv->mutex);
7415 7415
@@ -7419,18 +7419,18 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue,
7419 return 0; 7419 return 0;
7420} 7420}
7421 7421
7422static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw, 7422static int iwl3945_mac_get_tx_stats(struct ieee80211_hw *hw,
7423 struct ieee80211_tx_queue_stats *stats) 7423 struct ieee80211_tx_queue_stats *stats)
7424{ 7424{
7425 struct iwl_priv *priv = hw->priv; 7425 struct iwl3945_priv *priv = hw->priv;
7426 int i, avail; 7426 int i, avail;
7427 struct iwl_tx_queue *txq; 7427 struct iwl3945_tx_queue *txq;
7428 struct iwl_queue *q; 7428 struct iwl3945_queue *q;
7429 unsigned long flags; 7429 unsigned long flags;
7430 7430
7431 IWL_DEBUG_MAC80211("enter\n"); 7431 IWL_DEBUG_MAC80211("enter\n");
7432 7432
7433 if (!iwl_is_ready_rf(priv)) { 7433 if (!iwl3945_is_ready_rf(priv)) {
7434 IWL_DEBUG_MAC80211("leave - RF not ready\n"); 7434 IWL_DEBUG_MAC80211("leave - RF not ready\n");
7435 return -EIO; 7435 return -EIO;
7436 } 7436 }
@@ -7440,7 +7440,7 @@ static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw,
7440 for (i = 0; i < AC_NUM; i++) { 7440 for (i = 0; i < AC_NUM; i++) {
7441 txq = &priv->txq[i]; 7441 txq = &priv->txq[i];
7442 q = &txq->q; 7442 q = &txq->q;
7443 avail = iwl_queue_space(q); 7443 avail = iwl3945_queue_space(q);
7444 7444
7445 stats->data[i].len = q->n_window - avail; 7445 stats->data[i].len = q->n_window - avail;
7446 stats->data[i].limit = q->n_window - q->high_mark; 7446 stats->data[i].limit = q->n_window - q->high_mark;
@@ -7454,7 +7454,7 @@ static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw,
7454 return 0; 7454 return 0;
7455} 7455}
7456 7456
7457static int iwl_mac_get_stats(struct ieee80211_hw *hw, 7457static int iwl3945_mac_get_stats(struct ieee80211_hw *hw,
7458 struct ieee80211_low_level_stats *stats) 7458 struct ieee80211_low_level_stats *stats)
7459{ 7459{
7460 IWL_DEBUG_MAC80211("enter\n"); 7460 IWL_DEBUG_MAC80211("enter\n");
@@ -7463,7 +7463,7 @@ static int iwl_mac_get_stats(struct ieee80211_hw *hw,
7463 return 0; 7463 return 0;
7464} 7464}
7465 7465
7466static u64 iwl_mac_get_tsf(struct ieee80211_hw *hw) 7466static u64 iwl3945_mac_get_tsf(struct ieee80211_hw *hw)
7467{ 7467{
7468 IWL_DEBUG_MAC80211("enter\n"); 7468 IWL_DEBUG_MAC80211("enter\n");
7469 IWL_DEBUG_MAC80211("leave\n"); 7469 IWL_DEBUG_MAC80211("leave\n");
@@ -7471,16 +7471,16 @@ static u64 iwl_mac_get_tsf(struct ieee80211_hw *hw)
7471 return 0; 7471 return 0;
7472} 7472}
7473 7473
7474static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) 7474static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
7475{ 7475{
7476 struct iwl_priv *priv = hw->priv; 7476 struct iwl3945_priv *priv = hw->priv;
7477 unsigned long flags; 7477 unsigned long flags;
7478 7478
7479 mutex_lock(&priv->mutex); 7479 mutex_lock(&priv->mutex);
7480 IWL_DEBUG_MAC80211("enter\n"); 7480 IWL_DEBUG_MAC80211("enter\n");
7481 7481
7482#ifdef CONFIG_IWL3945_QOS 7482#ifdef CONFIG_IWL3945_QOS
7483 iwl_reset_qos(priv); 7483 iwl3945_reset_qos(priv);
7484#endif 7484#endif
7485 cancel_delayed_work(&priv->post_associate); 7485 cancel_delayed_work(&priv->post_associate);
7486 7486
@@ -7507,9 +7507,9 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7507 * clear RXON_FILTER_ASSOC_MSK bit 7507 * clear RXON_FILTER_ASSOC_MSK bit
7508 */ 7508 */
7509 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { 7509 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) {
7510 iwl_scan_cancel_timeout(priv, 100); 7510 iwl3945_scan_cancel_timeout(priv, 100);
7511 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7511 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7512 iwl_commit_rxon(priv); 7512 iwl3945_commit_rxon(priv);
7513 } 7513 }
7514 7514
7515 /* Per mac80211.h: This is only used in IBSS mode... */ 7515 /* Per mac80211.h: This is only used in IBSS mode... */
@@ -7520,7 +7520,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7520 return; 7520 return;
7521 } 7521 }
7522 7522
7523 if (!iwl_is_ready_rf(priv)) { 7523 if (!iwl3945_is_ready_rf(priv)) {
7524 IWL_DEBUG_MAC80211("leave - not ready\n"); 7524 IWL_DEBUG_MAC80211("leave - not ready\n");
7525 mutex_unlock(&priv->mutex); 7525 mutex_unlock(&priv->mutex);
7526 return; 7526 return;
@@ -7528,7 +7528,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7528 7528
7529 priv->only_active_channel = 0; 7529 priv->only_active_channel = 0;
7530 7530
7531 iwl_set_rate(priv); 7531 iwl3945_set_rate(priv);
7532 7532
7533 mutex_unlock(&priv->mutex); 7533 mutex_unlock(&priv->mutex);
7534 7534
@@ -7536,16 +7536,16 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7536 7536
7537} 7537}
7538 7538
7539static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, 7539static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
7540 struct ieee80211_tx_control *control) 7540 struct ieee80211_tx_control *control)
7541{ 7541{
7542 struct iwl_priv *priv = hw->priv; 7542 struct iwl3945_priv *priv = hw->priv;
7543 unsigned long flags; 7543 unsigned long flags;
7544 7544
7545 mutex_lock(&priv->mutex); 7545 mutex_lock(&priv->mutex);
7546 IWL_DEBUG_MAC80211("enter\n"); 7546 IWL_DEBUG_MAC80211("enter\n");
7547 7547
7548 if (!iwl_is_ready_rf(priv)) { 7548 if (!iwl3945_is_ready_rf(priv)) {
7549 IWL_DEBUG_MAC80211("leave - RF not ready\n"); 7549 IWL_DEBUG_MAC80211("leave - RF not ready\n");
7550 mutex_unlock(&priv->mutex); 7550 mutex_unlock(&priv->mutex);
7551 return -EIO; 7551 return -EIO;
@@ -7570,7 +7570,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
7570 spin_unlock_irqrestore(&priv->lock, flags); 7570 spin_unlock_irqrestore(&priv->lock, flags);
7571 7571
7572#ifdef CONFIG_IWL3945_QOS 7572#ifdef CONFIG_IWL3945_QOS
7573 iwl_reset_qos(priv); 7573 iwl3945_reset_qos(priv);
7574#endif 7574#endif
7575 7575
7576 queue_work(priv->workqueue, &priv->post_associate.work); 7576 queue_work(priv->workqueue, &priv->post_associate.work);
@@ -7598,7 +7598,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
7598 7598
7599static ssize_t show_debug_level(struct device_driver *d, char *buf) 7599static ssize_t show_debug_level(struct device_driver *d, char *buf)
7600{ 7600{
7601 return sprintf(buf, "0x%08X\n", iwl_debug_level); 7601 return sprintf(buf, "0x%08X\n", iwl3945_debug_level);
7602} 7602}
7603static ssize_t store_debug_level(struct device_driver *d, 7603static ssize_t store_debug_level(struct device_driver *d,
7604 const char *buf, size_t count) 7604 const char *buf, size_t count)
@@ -7611,7 +7611,7 @@ static ssize_t store_debug_level(struct device_driver *d,
7611 printk(KERN_INFO DRV_NAME 7611 printk(KERN_INFO DRV_NAME
7612 ": %s is not in hex or decimal form.\n", buf); 7612 ": %s is not in hex or decimal form.\n", buf);
7613 else 7613 else
7614 iwl_debug_level = val; 7614 iwl3945_debug_level = val;
7615 7615
7616 return strnlen(buf, count); 7616 return strnlen(buf, count);
7617} 7617}
@@ -7630,7 +7630,7 @@ static ssize_t show_rf_kill(struct device *d,
7630 * 2 - HW based RF kill active 7630 * 2 - HW based RF kill active
7631 * 3 - Both HW and SW based RF kill active 7631 * 3 - Both HW and SW based RF kill active
7632 */ 7632 */
7633 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7633 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7634 int val = (test_bit(STATUS_RF_KILL_SW, &priv->status) ? 0x1 : 0x0) | 7634 int val = (test_bit(STATUS_RF_KILL_SW, &priv->status) ? 0x1 : 0x0) |
7635 (test_bit(STATUS_RF_KILL_HW, &priv->status) ? 0x2 : 0x0); 7635 (test_bit(STATUS_RF_KILL_HW, &priv->status) ? 0x2 : 0x0);
7636 7636
@@ -7641,10 +7641,10 @@ static ssize_t store_rf_kill(struct device *d,
7641 struct device_attribute *attr, 7641 struct device_attribute *attr,
7642 const char *buf, size_t count) 7642 const char *buf, size_t count)
7643{ 7643{
7644 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7644 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7645 7645
7646 mutex_lock(&priv->mutex); 7646 mutex_lock(&priv->mutex);
7647 iwl_radio_kill_sw(priv, buf[0] == '1'); 7647 iwl3945_radio_kill_sw(priv, buf[0] == '1');
7648 mutex_unlock(&priv->mutex); 7648 mutex_unlock(&priv->mutex);
7649 7649
7650 return count; 7650 return count;
@@ -7655,12 +7655,12 @@ static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill);
7655static ssize_t show_temperature(struct device *d, 7655static ssize_t show_temperature(struct device *d,
7656 struct device_attribute *attr, char *buf) 7656 struct device_attribute *attr, char *buf)
7657{ 7657{
7658 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7658 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7659 7659
7660 if (!iwl_is_alive(priv)) 7660 if (!iwl3945_is_alive(priv))
7661 return -EAGAIN; 7661 return -EAGAIN;
7662 7662
7663 return sprintf(buf, "%d\n", iwl_hw_get_temperature(priv)); 7663 return sprintf(buf, "%d\n", iwl3945_hw_get_temperature(priv));
7664} 7664}
7665 7665
7666static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL); 7666static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);
@@ -7669,15 +7669,15 @@ static ssize_t show_rs_window(struct device *d,
7669 struct device_attribute *attr, 7669 struct device_attribute *attr,
7670 char *buf) 7670 char *buf)
7671{ 7671{
7672 struct iwl_priv *priv = d->driver_data; 7672 struct iwl3945_priv *priv = d->driver_data;
7673 return iwl_fill_rs_info(priv->hw, buf, IWL_AP_ID); 7673 return iwl3945_fill_rs_info(priv->hw, buf, IWL_AP_ID);
7674} 7674}
7675static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL); 7675static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL);
7676 7676
7677static ssize_t show_tx_power(struct device *d, 7677static ssize_t show_tx_power(struct device *d,
7678 struct device_attribute *attr, char *buf) 7678 struct device_attribute *attr, char *buf)
7679{ 7679{
7680 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7680 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7681 return sprintf(buf, "%d\n", priv->user_txpower_limit); 7681 return sprintf(buf, "%d\n", priv->user_txpower_limit);
7682} 7682}
7683 7683
@@ -7685,7 +7685,7 @@ static ssize_t store_tx_power(struct device *d,
7685 struct device_attribute *attr, 7685 struct device_attribute *attr,
7686 const char *buf, size_t count) 7686 const char *buf, size_t count)
7687{ 7687{
7688 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7688 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7689 char *p = (char *)buf; 7689 char *p = (char *)buf;
7690 u32 val; 7690 u32 val;
7691 7691
@@ -7694,7 +7694,7 @@ static ssize_t store_tx_power(struct device *d,
7694 printk(KERN_INFO DRV_NAME 7694 printk(KERN_INFO DRV_NAME
7695 ": %s is not in decimal form.\n", buf); 7695 ": %s is not in decimal form.\n", buf);
7696 else 7696 else
7697 iwl_hw_reg_set_txpower(priv, val); 7697 iwl3945_hw_reg_set_txpower(priv, val);
7698 7698
7699 return count; 7699 return count;
7700} 7700}
@@ -7704,7 +7704,7 @@ static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power);
7704static ssize_t show_flags(struct device *d, 7704static ssize_t show_flags(struct device *d,
7705 struct device_attribute *attr, char *buf) 7705 struct device_attribute *attr, char *buf)
7706{ 7706{
7707 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7707 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7708 7708
7709 return sprintf(buf, "0x%04X\n", priv->active_rxon.flags); 7709 return sprintf(buf, "0x%04X\n", priv->active_rxon.flags);
7710} 7710}
@@ -7713,19 +7713,19 @@ static ssize_t store_flags(struct device *d,
7713 struct device_attribute *attr, 7713 struct device_attribute *attr,
7714 const char *buf, size_t count) 7714 const char *buf, size_t count)
7715{ 7715{
7716 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7716 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7717 u32 flags = simple_strtoul(buf, NULL, 0); 7717 u32 flags = simple_strtoul(buf, NULL, 0);
7718 7718
7719 mutex_lock(&priv->mutex); 7719 mutex_lock(&priv->mutex);
7720 if (le32_to_cpu(priv->staging_rxon.flags) != flags) { 7720 if (le32_to_cpu(priv->staging_rxon.flags) != flags) {
7721 /* Cancel any currently running scans... */ 7721 /* Cancel any currently running scans... */
7722 if (iwl_scan_cancel_timeout(priv, 100)) 7722 if (iwl3945_scan_cancel_timeout(priv, 100))
7723 IWL_WARNING("Could not cancel scan.\n"); 7723 IWL_WARNING("Could not cancel scan.\n");
7724 else { 7724 else {
7725 IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n", 7725 IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n",
7726 flags); 7726 flags);
7727 priv->staging_rxon.flags = cpu_to_le32(flags); 7727 priv->staging_rxon.flags = cpu_to_le32(flags);
7728 iwl_commit_rxon(priv); 7728 iwl3945_commit_rxon(priv);
7729 } 7729 }
7730 } 7730 }
7731 mutex_unlock(&priv->mutex); 7731 mutex_unlock(&priv->mutex);
@@ -7738,7 +7738,7 @@ static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, show_flags, store_flags);
7738static ssize_t show_filter_flags(struct device *d, 7738static ssize_t show_filter_flags(struct device *d,
7739 struct device_attribute *attr, char *buf) 7739 struct device_attribute *attr, char *buf)
7740{ 7740{
7741 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7741 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7742 7742
7743 return sprintf(buf, "0x%04X\n", 7743 return sprintf(buf, "0x%04X\n",
7744 le32_to_cpu(priv->active_rxon.filter_flags)); 7744 le32_to_cpu(priv->active_rxon.filter_flags));
@@ -7748,20 +7748,20 @@ static ssize_t store_filter_flags(struct device *d,
7748 struct device_attribute *attr, 7748 struct device_attribute *attr,
7749 const char *buf, size_t count) 7749 const char *buf, size_t count)
7750{ 7750{
7751 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7751 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7752 u32 filter_flags = simple_strtoul(buf, NULL, 0); 7752 u32 filter_flags = simple_strtoul(buf, NULL, 0);
7753 7753
7754 mutex_lock(&priv->mutex); 7754 mutex_lock(&priv->mutex);
7755 if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) { 7755 if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) {
7756 /* Cancel any currently running scans... */ 7756 /* Cancel any currently running scans... */
7757 if (iwl_scan_cancel_timeout(priv, 100)) 7757 if (iwl3945_scan_cancel_timeout(priv, 100))
7758 IWL_WARNING("Could not cancel scan.\n"); 7758 IWL_WARNING("Could not cancel scan.\n");
7759 else { 7759 else {
7760 IWL_DEBUG_INFO("Committing rxon.filter_flags = " 7760 IWL_DEBUG_INFO("Committing rxon.filter_flags = "
7761 "0x%04X\n", filter_flags); 7761 "0x%04X\n", filter_flags);
7762 priv->staging_rxon.filter_flags = 7762 priv->staging_rxon.filter_flags =
7763 cpu_to_le32(filter_flags); 7763 cpu_to_le32(filter_flags);
7764 iwl_commit_rxon(priv); 7764 iwl3945_commit_rxon(priv);
7765 } 7765 }
7766 } 7766 }
7767 mutex_unlock(&priv->mutex); 7767 mutex_unlock(&priv->mutex);
@@ -7775,20 +7775,20 @@ static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags,
7775static ssize_t show_tune(struct device *d, 7775static ssize_t show_tune(struct device *d,
7776 struct device_attribute *attr, char *buf) 7776 struct device_attribute *attr, char *buf)
7777{ 7777{
7778 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7778 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7779 7779
7780 return sprintf(buf, "0x%04X\n", 7780 return sprintf(buf, "0x%04X\n",
7781 (priv->phymode << 8) | 7781 (priv->phymode << 8) |
7782 le16_to_cpu(priv->active_rxon.channel)); 7782 le16_to_cpu(priv->active_rxon.channel));
7783} 7783}
7784 7784
7785static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode); 7785static void iwl3945_set_flags_for_phymode(struct iwl3945_priv *priv, u8 phymode);
7786 7786
7787static ssize_t store_tune(struct device *d, 7787static ssize_t store_tune(struct device *d,
7788 struct device_attribute *attr, 7788 struct device_attribute *attr,
7789 const char *buf, size_t count) 7789 const char *buf, size_t count)
7790{ 7790{
7791 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7791 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7792 char *p = (char *)buf; 7792 char *p = (char *)buf;
7793 u16 tune = simple_strtoul(p, &p, 0); 7793 u16 tune = simple_strtoul(p, &p, 0);
7794 u8 phymode = (tune >> 8) & 0xff; 7794 u8 phymode = (tune >> 8) & 0xff;
@@ -7799,9 +7799,9 @@ static ssize_t store_tune(struct device *d,
7799 mutex_lock(&priv->mutex); 7799 mutex_lock(&priv->mutex);
7800 if ((le16_to_cpu(priv->staging_rxon.channel) != channel) || 7800 if ((le16_to_cpu(priv->staging_rxon.channel) != channel) ||
7801 (priv->phymode != phymode)) { 7801 (priv->phymode != phymode)) {
7802 const struct iwl_channel_info *ch_info; 7802 const struct iwl3945_channel_info *ch_info;
7803 7803
7804 ch_info = iwl_get_channel_info(priv, phymode, channel); 7804 ch_info = iwl3945_get_channel_info(priv, phymode, channel);
7805 if (!ch_info) { 7805 if (!ch_info) {
7806 IWL_WARNING("Requested invalid phymode/channel " 7806 IWL_WARNING("Requested invalid phymode/channel "
7807 "combination: %d %d\n", phymode, channel); 7807 "combination: %d %d\n", phymode, channel);
@@ -7810,18 +7810,18 @@ static ssize_t store_tune(struct device *d,
7810 } 7810 }
7811 7811
7812 /* Cancel any currently running scans... */ 7812 /* Cancel any currently running scans... */
7813 if (iwl_scan_cancel_timeout(priv, 100)) 7813 if (iwl3945_scan_cancel_timeout(priv, 100))
7814 IWL_WARNING("Could not cancel scan.\n"); 7814 IWL_WARNING("Could not cancel scan.\n");
7815 else { 7815 else {
7816 IWL_DEBUG_INFO("Committing phymode and " 7816 IWL_DEBUG_INFO("Committing phymode and "
7817 "rxon.channel = %d %d\n", 7817 "rxon.channel = %d %d\n",
7818 phymode, channel); 7818 phymode, channel);
7819 7819
7820 iwl_set_rxon_channel(priv, phymode, channel); 7820 iwl3945_set_rxon_channel(priv, phymode, channel);
7821 iwl_set_flags_for_phymode(priv, phymode); 7821 iwl3945_set_flags_for_phymode(priv, phymode);
7822 7822
7823 iwl_set_rate(priv); 7823 iwl3945_set_rate(priv);
7824 iwl_commit_rxon(priv); 7824 iwl3945_commit_rxon(priv);
7825 } 7825 }
7826 } 7826 }
7827 mutex_unlock(&priv->mutex); 7827 mutex_unlock(&priv->mutex);
@@ -7836,8 +7836,8 @@ static DEVICE_ATTR(tune, S_IWUSR | S_IRUGO, show_tune, store_tune);
7836static ssize_t show_measurement(struct device *d, 7836static ssize_t show_measurement(struct device *d,
7837 struct device_attribute *attr, char *buf) 7837 struct device_attribute *attr, char *buf)
7838{ 7838{
7839 struct iwl_priv *priv = dev_get_drvdata(d); 7839 struct iwl3945_priv *priv = dev_get_drvdata(d);
7840 struct iwl_spectrum_notification measure_report; 7840 struct iwl3945_spectrum_notification measure_report;
7841 u32 size = sizeof(measure_report), len = 0, ofs = 0; 7841 u32 size = sizeof(measure_report), len = 0, ofs = 0;
7842 u8 *data = (u8 *) & measure_report; 7842 u8 *data = (u8 *) & measure_report;
7843 unsigned long flags; 7843 unsigned long flags;
@@ -7869,7 +7869,7 @@ static ssize_t store_measurement(struct device *d,
7869 struct device_attribute *attr, 7869 struct device_attribute *attr,
7870 const char *buf, size_t count) 7870 const char *buf, size_t count)
7871{ 7871{
7872 struct iwl_priv *priv = dev_get_drvdata(d); 7872 struct iwl3945_priv *priv = dev_get_drvdata(d);
7873 struct ieee80211_measurement_params params = { 7873 struct ieee80211_measurement_params params = {
7874 .channel = le16_to_cpu(priv->active_rxon.channel), 7874 .channel = le16_to_cpu(priv->active_rxon.channel),
7875 .start_time = cpu_to_le64(priv->last_tsf), 7875 .start_time = cpu_to_le64(priv->last_tsf),
@@ -7895,7 +7895,7 @@ static ssize_t store_measurement(struct device *d,
7895 7895
7896 IWL_DEBUG_INFO("Invoking measurement of type %d on " 7896 IWL_DEBUG_INFO("Invoking measurement of type %d on "
7897 "channel %d (for '%s')\n", type, params.channel, buf); 7897 "channel %d (for '%s')\n", type, params.channel, buf);
7898 iwl_get_measurement(priv, &params, type); 7898 iwl3945_get_measurement(priv, &params, type);
7899 7899
7900 return count; 7900 return count;
7901} 7901}
@@ -7907,7 +7907,7 @@ static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR,
7907static ssize_t show_rate(struct device *d, 7907static ssize_t show_rate(struct device *d,
7908 struct device_attribute *attr, char *buf) 7908 struct device_attribute *attr, char *buf)
7909{ 7909{
7910 struct iwl_priv *priv = dev_get_drvdata(d); 7910 struct iwl3945_priv *priv = dev_get_drvdata(d);
7911 unsigned long flags; 7911 unsigned long flags;
7912 int i; 7912 int i;
7913 7913
@@ -7918,13 +7918,13 @@ static ssize_t show_rate(struct device *d,
7918 i = priv->stations[IWL_STA_ID].current_rate.s.rate; 7918 i = priv->stations[IWL_STA_ID].current_rate.s.rate;
7919 spin_unlock_irqrestore(&priv->sta_lock, flags); 7919 spin_unlock_irqrestore(&priv->sta_lock, flags);
7920 7920
7921 i = iwl_rate_index_from_plcp(i); 7921 i = iwl3945_rate_index_from_plcp(i);
7922 if (i == -1) 7922 if (i == -1)
7923 return sprintf(buf, "0\n"); 7923 return sprintf(buf, "0\n");
7924 7924
7925 return sprintf(buf, "%d%s\n", 7925 return sprintf(buf, "%d%s\n",
7926 (iwl_rates[i].ieee >> 1), 7926 (iwl3945_rates[i].ieee >> 1),
7927 (iwl_rates[i].ieee & 0x1) ? ".5" : ""); 7927 (iwl3945_rates[i].ieee & 0x1) ? ".5" : "");
7928} 7928}
7929 7929
7930static DEVICE_ATTR(rate, S_IRUSR, show_rate, NULL); 7930static DEVICE_ATTR(rate, S_IRUSR, show_rate, NULL);
@@ -7933,7 +7933,7 @@ static ssize_t store_retry_rate(struct device *d,
7933 struct device_attribute *attr, 7933 struct device_attribute *attr,
7934 const char *buf, size_t count) 7934 const char *buf, size_t count)
7935{ 7935{
7936 struct iwl_priv *priv = dev_get_drvdata(d); 7936 struct iwl3945_priv *priv = dev_get_drvdata(d);
7937 7937
7938 priv->retry_rate = simple_strtoul(buf, NULL, 0); 7938 priv->retry_rate = simple_strtoul(buf, NULL, 0);
7939 if (priv->retry_rate <= 0) 7939 if (priv->retry_rate <= 0)
@@ -7945,7 +7945,7 @@ static ssize_t store_retry_rate(struct device *d,
7945static ssize_t show_retry_rate(struct device *d, 7945static ssize_t show_retry_rate(struct device *d,
7946 struct device_attribute *attr, char *buf) 7946 struct device_attribute *attr, char *buf)
7947{ 7947{
7948 struct iwl_priv *priv = dev_get_drvdata(d); 7948 struct iwl3945_priv *priv = dev_get_drvdata(d);
7949 return sprintf(buf, "%d", priv->retry_rate); 7949 return sprintf(buf, "%d", priv->retry_rate);
7950} 7950}
7951 7951
@@ -7956,14 +7956,14 @@ static ssize_t store_power_level(struct device *d,
7956 struct device_attribute *attr, 7956 struct device_attribute *attr,
7957 const char *buf, size_t count) 7957 const char *buf, size_t count)
7958{ 7958{
7959 struct iwl_priv *priv = dev_get_drvdata(d); 7959 struct iwl3945_priv *priv = dev_get_drvdata(d);
7960 int rc; 7960 int rc;
7961 int mode; 7961 int mode;
7962 7962
7963 mode = simple_strtoul(buf, NULL, 0); 7963 mode = simple_strtoul(buf, NULL, 0);
7964 mutex_lock(&priv->mutex); 7964 mutex_lock(&priv->mutex);
7965 7965
7966 if (!iwl_is_ready(priv)) { 7966 if (!iwl3945_is_ready(priv)) {
7967 rc = -EAGAIN; 7967 rc = -EAGAIN;
7968 goto out; 7968 goto out;
7969 } 7969 }
@@ -7974,7 +7974,7 @@ static ssize_t store_power_level(struct device *d,
7974 mode |= IWL_POWER_ENABLED; 7974 mode |= IWL_POWER_ENABLED;
7975 7975
7976 if (mode != priv->power_mode) { 7976 if (mode != priv->power_mode) {
7977 rc = iwl_send_power_mode(priv, IWL_POWER_LEVEL(mode)); 7977 rc = iwl3945_send_power_mode(priv, IWL_POWER_LEVEL(mode));
7978 if (rc) { 7978 if (rc) {
7979 IWL_DEBUG_MAC80211("failed setting power mode.\n"); 7979 IWL_DEBUG_MAC80211("failed setting power mode.\n");
7980 goto out; 7980 goto out;
@@ -8010,7 +8010,7 @@ static const s32 period_duration[] = {
8010static ssize_t show_power_level(struct device *d, 8010static ssize_t show_power_level(struct device *d,
8011 struct device_attribute *attr, char *buf) 8011 struct device_attribute *attr, char *buf)
8012{ 8012{
8013 struct iwl_priv *priv = dev_get_drvdata(d); 8013 struct iwl3945_priv *priv = dev_get_drvdata(d);
8014 int level = IWL_POWER_LEVEL(priv->power_mode); 8014 int level = IWL_POWER_LEVEL(priv->power_mode);
8015 char *p = buf; 8015 char *p = buf;
8016 8016
@@ -8045,18 +8045,18 @@ static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level,
8045static ssize_t show_channels(struct device *d, 8045static ssize_t show_channels(struct device *d,
8046 struct device_attribute *attr, char *buf) 8046 struct device_attribute *attr, char *buf)
8047{ 8047{
8048 struct iwl_priv *priv = dev_get_drvdata(d); 8048 struct iwl3945_priv *priv = dev_get_drvdata(d);
8049 int len = 0, i; 8049 int len = 0, i;
8050 struct ieee80211_channel *channels = NULL; 8050 struct ieee80211_channel *channels = NULL;
8051 const struct ieee80211_hw_mode *hw_mode = NULL; 8051 const struct ieee80211_hw_mode *hw_mode = NULL;
8052 int count = 0; 8052 int count = 0;
8053 8053
8054 if (!iwl_is_ready(priv)) 8054 if (!iwl3945_is_ready(priv))
8055 return -EAGAIN; 8055 return -EAGAIN;
8056 8056
8057 hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211G); 8057 hw_mode = iwl3945_get_hw_mode(priv, MODE_IEEE80211G);
8058 if (!hw_mode) 8058 if (!hw_mode)
8059 hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211B); 8059 hw_mode = iwl3945_get_hw_mode(priv, MODE_IEEE80211B);
8060 if (hw_mode) { 8060 if (hw_mode) {
8061 channels = hw_mode->channels; 8061 channels = hw_mode->channels;
8062 count = hw_mode->num_channels; 8062 count = hw_mode->num_channels;
@@ -8083,7 +8083,7 @@ static ssize_t show_channels(struct device *d,
8083 flag & IEEE80211_CHAN_W_ACTIVE_SCAN ? 8083 flag & IEEE80211_CHAN_W_ACTIVE_SCAN ?
8084 "active/passive" : "passive only"); 8084 "active/passive" : "passive only");
8085 8085
8086 hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211A); 8086 hw_mode = iwl3945_get_hw_mode(priv, MODE_IEEE80211A);
8087 if (hw_mode) { 8087 if (hw_mode) {
8088 channels = hw_mode->channels; 8088 channels = hw_mode->channels;
8089 count = hw_mode->num_channels; 8089 count = hw_mode->num_channels;
@@ -8119,17 +8119,17 @@ static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL);
8119static ssize_t show_statistics(struct device *d, 8119static ssize_t show_statistics(struct device *d,
8120 struct device_attribute *attr, char *buf) 8120 struct device_attribute *attr, char *buf)
8121{ 8121{
8122 struct iwl_priv *priv = dev_get_drvdata(d); 8122 struct iwl3945_priv *priv = dev_get_drvdata(d);
8123 u32 size = sizeof(struct iwl_notif_statistics); 8123 u32 size = sizeof(struct iwl3945_notif_statistics);
8124 u32 len = 0, ofs = 0; 8124 u32 len = 0, ofs = 0;
8125 u8 *data = (u8 *) & priv->statistics; 8125 u8 *data = (u8 *) & priv->statistics;
8126 int rc = 0; 8126 int rc = 0;
8127 8127
8128 if (!iwl_is_alive(priv)) 8128 if (!iwl3945_is_alive(priv))
8129 return -EAGAIN; 8129 return -EAGAIN;
8130 8130
8131 mutex_lock(&priv->mutex); 8131 mutex_lock(&priv->mutex);
8132 rc = iwl_send_statistics_request(priv); 8132 rc = iwl3945_send_statistics_request(priv);
8133 mutex_unlock(&priv->mutex); 8133 mutex_unlock(&priv->mutex);
8134 8134
8135 if (rc) { 8135 if (rc) {
@@ -8157,9 +8157,9 @@ static DEVICE_ATTR(statistics, S_IRUGO, show_statistics, NULL);
8157static ssize_t show_antenna(struct device *d, 8157static ssize_t show_antenna(struct device *d,
8158 struct device_attribute *attr, char *buf) 8158 struct device_attribute *attr, char *buf)
8159{ 8159{
8160 struct iwl_priv *priv = dev_get_drvdata(d); 8160 struct iwl3945_priv *priv = dev_get_drvdata(d);
8161 8161
8162 if (!iwl_is_alive(priv)) 8162 if (!iwl3945_is_alive(priv))
8163 return -EAGAIN; 8163 return -EAGAIN;
8164 8164
8165 return sprintf(buf, "%d\n", priv->antenna); 8165 return sprintf(buf, "%d\n", priv->antenna);
@@ -8170,7 +8170,7 @@ static ssize_t store_antenna(struct device *d,
8170 const char *buf, size_t count) 8170 const char *buf, size_t count)
8171{ 8171{
8172 int ant; 8172 int ant;
8173 struct iwl_priv *priv = dev_get_drvdata(d); 8173 struct iwl3945_priv *priv = dev_get_drvdata(d);
8174 8174
8175 if (count == 0) 8175 if (count == 0)
8176 return 0; 8176 return 0;
@@ -8182,7 +8182,7 @@ static ssize_t store_antenna(struct device *d,
8182 8182
8183 if ((ant >= 0) && (ant <= 2)) { 8183 if ((ant >= 0) && (ant <= 2)) {
8184 IWL_DEBUG_INFO("Setting antenna select to %d.\n", ant); 8184 IWL_DEBUG_INFO("Setting antenna select to %d.\n", ant);
8185 priv->antenna = (enum iwl_antenna)ant; 8185 priv->antenna = (enum iwl3945_antenna)ant;
8186 } else 8186 } else
8187 IWL_DEBUG_INFO("Bad antenna select value %d.\n", ant); 8187 IWL_DEBUG_INFO("Bad antenna select value %d.\n", ant);
8188 8188
@@ -8195,8 +8195,8 @@ static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, show_antenna, store_antenna);
8195static ssize_t show_status(struct device *d, 8195static ssize_t show_status(struct device *d,
8196 struct device_attribute *attr, char *buf) 8196 struct device_attribute *attr, char *buf)
8197{ 8197{
8198 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 8198 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
8199 if (!iwl_is_alive(priv)) 8199 if (!iwl3945_is_alive(priv))
8200 return -EAGAIN; 8200 return -EAGAIN;
8201 return sprintf(buf, "0x%08x\n", (int)priv->status); 8201 return sprintf(buf, "0x%08x\n", (int)priv->status);
8202} 8202}
@@ -8210,7 +8210,7 @@ static ssize_t dump_error_log(struct device *d,
8210 char *p = (char *)buf; 8210 char *p = (char *)buf;
8211 8211
8212 if (p[0] == '1') 8212 if (p[0] == '1')
8213 iwl_dump_nic_error_log((struct iwl_priv *)d->driver_data); 8213 iwl3945_dump_nic_error_log((struct iwl3945_priv *)d->driver_data);
8214 8214
8215 return strnlen(buf, count); 8215 return strnlen(buf, count);
8216} 8216}
@@ -8224,7 +8224,7 @@ static ssize_t dump_event_log(struct device *d,
8224 char *p = (char *)buf; 8224 char *p = (char *)buf;
8225 8225
8226 if (p[0] == '1') 8226 if (p[0] == '1')
8227 iwl_dump_nic_event_log((struct iwl_priv *)d->driver_data); 8227 iwl3945_dump_nic_event_log((struct iwl3945_priv *)d->driver_data);
8228 8228
8229 return strnlen(buf, count); 8229 return strnlen(buf, count);
8230} 8230}
@@ -8237,34 +8237,34 @@ static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log);
8237 * 8237 *
8238 *****************************************************************************/ 8238 *****************************************************************************/
8239 8239
8240static void iwl_setup_deferred_work(struct iwl_priv *priv) 8240static void iwl3945_setup_deferred_work(struct iwl3945_priv *priv)
8241{ 8241{
8242 priv->workqueue = create_workqueue(DRV_NAME); 8242 priv->workqueue = create_workqueue(DRV_NAME);
8243 8243
8244 init_waitqueue_head(&priv->wait_command_queue); 8244 init_waitqueue_head(&priv->wait_command_queue);
8245 8245
8246 INIT_WORK(&priv->up, iwl_bg_up); 8246 INIT_WORK(&priv->up, iwl3945_bg_up);
8247 INIT_WORK(&priv->restart, iwl_bg_restart); 8247 INIT_WORK(&priv->restart, iwl3945_bg_restart);
8248 INIT_WORK(&priv->rx_replenish, iwl_bg_rx_replenish); 8248 INIT_WORK(&priv->rx_replenish, iwl3945_bg_rx_replenish);
8249 INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); 8249 INIT_WORK(&priv->scan_completed, iwl3945_bg_scan_completed);
8250 INIT_WORK(&priv->request_scan, iwl_bg_request_scan); 8250 INIT_WORK(&priv->request_scan, iwl3945_bg_request_scan);
8251 INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); 8251 INIT_WORK(&priv->abort_scan, iwl3945_bg_abort_scan);
8252 INIT_WORK(&priv->rf_kill, iwl_bg_rf_kill); 8252 INIT_WORK(&priv->rf_kill, iwl3945_bg_rf_kill);
8253 INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update); 8253 INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update);
8254 INIT_DELAYED_WORK(&priv->post_associate, iwl_bg_post_associate); 8254 INIT_DELAYED_WORK(&priv->post_associate, iwl3945_bg_post_associate);
8255 INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); 8255 INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start);
8256 INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); 8256 INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start);
8257 INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); 8257 INIT_DELAYED_WORK(&priv->scan_check, iwl3945_bg_scan_check);
8258 8258
8259 iwl_hw_setup_deferred_work(priv); 8259 iwl3945_hw_setup_deferred_work(priv);
8260 8260
8261 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) 8261 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))
8262 iwl_irq_tasklet, (unsigned long)priv); 8262 iwl3945_irq_tasklet, (unsigned long)priv);
8263} 8263}
8264 8264
8265static void iwl_cancel_deferred_work(struct iwl_priv *priv) 8265static void iwl3945_cancel_deferred_work(struct iwl3945_priv *priv)
8266{ 8266{
8267 iwl_hw_cancel_deferred_work(priv); 8267 iwl3945_hw_cancel_deferred_work(priv);
8268 8268
8269 cancel_delayed_work_sync(&priv->init_alive_start); 8269 cancel_delayed_work_sync(&priv->init_alive_start);
8270 cancel_delayed_work(&priv->scan_check); 8270 cancel_delayed_work(&priv->scan_check);
@@ -8273,7 +8273,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
8273 cancel_work_sync(&priv->beacon_update); 8273 cancel_work_sync(&priv->beacon_update);
8274} 8274}
8275 8275
8276static struct attribute *iwl_sysfs_entries[] = { 8276static struct attribute *iwl3945_sysfs_entries[] = {
8277 &dev_attr_antenna.attr, 8277 &dev_attr_antenna.attr,
8278 &dev_attr_channels.attr, 8278 &dev_attr_channels.attr,
8279 &dev_attr_dump_errors.attr, 8279 &dev_attr_dump_errors.attr,
@@ -8297,45 +8297,45 @@ static struct attribute *iwl_sysfs_entries[] = {
8297 NULL 8297 NULL
8298}; 8298};
8299 8299
8300static struct attribute_group iwl_attribute_group = { 8300static struct attribute_group iwl3945_attribute_group = {
8301 .name = NULL, /* put in device directory */ 8301 .name = NULL, /* put in device directory */
8302 .attrs = iwl_sysfs_entries, 8302 .attrs = iwl3945_sysfs_entries,
8303}; 8303};
8304 8304
8305static struct ieee80211_ops iwl_hw_ops = { 8305static struct ieee80211_ops iwl3945_hw_ops = {
8306 .tx = iwl_mac_tx, 8306 .tx = iwl3945_mac_tx,
8307 .start = iwl_mac_start, 8307 .start = iwl3945_mac_start,
8308 .stop = iwl_mac_stop, 8308 .stop = iwl3945_mac_stop,
8309 .add_interface = iwl_mac_add_interface, 8309 .add_interface = iwl3945_mac_add_interface,
8310 .remove_interface = iwl_mac_remove_interface, 8310 .remove_interface = iwl3945_mac_remove_interface,
8311 .config = iwl_mac_config, 8311 .config = iwl3945_mac_config,
8312 .config_interface = iwl_mac_config_interface, 8312 .config_interface = iwl3945_mac_config_interface,
8313 .configure_filter = iwl_configure_filter, 8313 .configure_filter = iwl3945_configure_filter,
8314 .set_key = iwl_mac_set_key, 8314 .set_key = iwl3945_mac_set_key,
8315 .get_stats = iwl_mac_get_stats, 8315 .get_stats = iwl3945_mac_get_stats,
8316 .get_tx_stats = iwl_mac_get_tx_stats, 8316 .get_tx_stats = iwl3945_mac_get_tx_stats,
8317 .conf_tx = iwl_mac_conf_tx, 8317 .conf_tx = iwl3945_mac_conf_tx,
8318 .get_tsf = iwl_mac_get_tsf, 8318 .get_tsf = iwl3945_mac_get_tsf,
8319 .reset_tsf = iwl_mac_reset_tsf, 8319 .reset_tsf = iwl3945_mac_reset_tsf,
8320 .beacon_update = iwl_mac_beacon_update, 8320 .beacon_update = iwl3945_mac_beacon_update,
8321 .hw_scan = iwl_mac_hw_scan 8321 .hw_scan = iwl3945_mac_hw_scan
8322}; 8322};
8323 8323
8324static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 8324static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8325{ 8325{
8326 int err = 0; 8326 int err = 0;
8327 u32 pci_id; 8327 u32 pci_id;
8328 struct iwl_priv *priv; 8328 struct iwl3945_priv *priv;
8329 struct ieee80211_hw *hw; 8329 struct ieee80211_hw *hw;
8330 int i; 8330 int i;
8331 8331
8332 if (iwl_param_disable_hw_scan) { 8332 if (iwl3945_param_disable_hw_scan) {
8333 IWL_DEBUG_INFO("Disabling hw_scan\n"); 8333 IWL_DEBUG_INFO("Disabling hw_scan\n");
8334 iwl_hw_ops.hw_scan = NULL; 8334 iwl3945_hw_ops.hw_scan = NULL;
8335 } 8335 }
8336 8336
8337 if ((iwl_param_queues_num > IWL_MAX_NUM_QUEUES) || 8337 if ((iwl3945_param_queues_num > IWL_MAX_NUM_QUEUES) ||
8338 (iwl_param_queues_num < IWL_MIN_NUM_QUEUES)) { 8338 (iwl3945_param_queues_num < IWL_MIN_NUM_QUEUES)) {
8339 IWL_ERROR("invalid queues_num, should be between %d and %d\n", 8339 IWL_ERROR("invalid queues_num, should be between %d and %d\n",
8340 IWL_MIN_NUM_QUEUES, IWL_MAX_NUM_QUEUES); 8340 IWL_MIN_NUM_QUEUES, IWL_MAX_NUM_QUEUES);
8341 err = -EINVAL; 8341 err = -EINVAL;
@@ -8344,7 +8344,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8344 8344
8345 /* mac80211 allocates memory for this device instance, including 8345 /* mac80211 allocates memory for this device instance, including
8346 * space for this driver's private structure */ 8346 * space for this driver's private structure */
8347 hw = ieee80211_alloc_hw(sizeof(struct iwl_priv), &iwl_hw_ops); 8347 hw = ieee80211_alloc_hw(sizeof(struct iwl3945_priv), &iwl3945_hw_ops);
8348 if (hw == NULL) { 8348 if (hw == NULL) {
8349 IWL_ERROR("Can not allocate network device\n"); 8349 IWL_ERROR("Can not allocate network device\n");
8350 err = -ENOMEM; 8350 err = -ENOMEM;
@@ -8359,9 +8359,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8359 priv->hw = hw; 8359 priv->hw = hw;
8360 8360
8361 priv->pci_dev = pdev; 8361 priv->pci_dev = pdev;
8362 priv->antenna = (enum iwl_antenna)iwl_param_antenna; 8362 priv->antenna = (enum iwl3945_antenna)iwl3945_param_antenna;
8363#ifdef CONFIG_IWL3945_DEBUG 8363#ifdef CONFIG_IWL3945_DEBUG
8364 iwl_debug_level = iwl_param_debug; 8364 iwl3945_debug_level = iwl3945_param_debug;
8365 atomic_set(&priv->restrict_refcnt, 0); 8365 atomic_set(&priv->restrict_refcnt, 0);
8366#endif 8366#endif
8367 priv->retry_rate = 1; 8367 priv->retry_rate = 1;
@@ -8400,7 +8400,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8400 8400
8401 pci_set_master(pdev); 8401 pci_set_master(pdev);
8402 8402
8403 iwl_clear_stations_table(priv); 8403 iwl3945_clear_stations_table(priv);
8404 8404
8405 priv->data_retry_limit = -1; 8405 priv->data_retry_limit = -1;
8406 priv->ieee_channels = NULL; 8406 priv->ieee_channels = NULL;
@@ -8434,7 +8434,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8434 8434
8435 /* Initialize module parameter values here */ 8435 /* Initialize module parameter values here */
8436 8436
8437 if (iwl_param_disable) { 8437 if (iwl3945_param_disable) {
8438 set_bit(STATUS_RF_KILL_SW, &priv->status); 8438 set_bit(STATUS_RF_KILL_SW, &priv->status);
8439 IWL_DEBUG_INFO("Radio disabled.\n"); 8439 IWL_DEBUG_INFO("Radio disabled.\n");
8440 } 8440 }
@@ -8469,36 +8469,36 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8469 priv->is_abg ? "A" : ""); 8469 priv->is_abg ? "A" : "");
8470 8470
8471 /* Device-specific setup */ 8471 /* Device-specific setup */
8472 if (iwl_hw_set_hw_setting(priv)) { 8472 if (iwl3945_hw_set_hw_setting(priv)) {
8473 IWL_ERROR("failed to set hw settings\n"); 8473 IWL_ERROR("failed to set hw settings\n");
8474 mutex_unlock(&priv->mutex); 8474 mutex_unlock(&priv->mutex);
8475 goto out_iounmap; 8475 goto out_iounmap;
8476 } 8476 }
8477 8477
8478#ifdef CONFIG_IWL3945_QOS 8478#ifdef CONFIG_IWL3945_QOS
8479 if (iwl_param_qos_enable) 8479 if (iwl3945_param_qos_enable)
8480 priv->qos_data.qos_enable = 1; 8480 priv->qos_data.qos_enable = 1;
8481 8481
8482 iwl_reset_qos(priv); 8482 iwl3945_reset_qos(priv);
8483 8483
8484 priv->qos_data.qos_active = 0; 8484 priv->qos_data.qos_active = 0;
8485 priv->qos_data.qos_cap.val = 0; 8485 priv->qos_data.qos_cap.val = 0;
8486#endif /* CONFIG_IWL3945_QOS */ 8486#endif /* CONFIG_IWL3945_QOS */
8487 8487
8488 iwl_set_rxon_channel(priv, MODE_IEEE80211G, 6); 8488 iwl3945_set_rxon_channel(priv, MODE_IEEE80211G, 6);
8489 iwl_setup_deferred_work(priv); 8489 iwl3945_setup_deferred_work(priv);
8490 iwl_setup_rx_handlers(priv); 8490 iwl3945_setup_rx_handlers(priv);
8491 8491
8492 priv->rates_mask = IWL_RATES_MASK; 8492 priv->rates_mask = IWL_RATES_MASK;
8493 /* If power management is turned on, default to AC mode */ 8493 /* If power management is turned on, default to AC mode */
8494 priv->power_mode = IWL_POWER_AC; 8494 priv->power_mode = IWL_POWER_AC;
8495 priv->user_txpower_limit = IWL_DEFAULT_TX_POWER; 8495 priv->user_txpower_limit = IWL_DEFAULT_TX_POWER;
8496 8496
8497 iwl_disable_interrupts(priv); 8497 iwl3945_disable_interrupts(priv);
8498 8498
8499 pci_enable_msi(pdev); 8499 pci_enable_msi(pdev);
8500 8500
8501 err = request_irq(pdev->irq, iwl_isr, IRQF_SHARED, DRV_NAME, priv); 8501 err = request_irq(pdev->irq, iwl3945_isr, IRQF_SHARED, DRV_NAME, priv);
8502 if (err) { 8502 if (err) {
8503 IWL_ERROR("Error allocating IRQ %d\n", pdev->irq); 8503 IWL_ERROR("Error allocating IRQ %d\n", pdev->irq);
8504 goto out_disable_msi; 8504 goto out_disable_msi;
@@ -8506,7 +8506,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8506 8506
8507 mutex_lock(&priv->mutex); 8507 mutex_lock(&priv->mutex);
8508 8508
8509 err = sysfs_create_group(&pdev->dev.kobj, &iwl_attribute_group); 8509 err = sysfs_create_group(&pdev->dev.kobj, &iwl3945_attribute_group);
8510 if (err) { 8510 if (err) {
8511 IWL_ERROR("failed to create sysfs device attributes\n"); 8511 IWL_ERROR("failed to create sysfs device attributes\n");
8512 mutex_unlock(&priv->mutex); 8512 mutex_unlock(&priv->mutex);
@@ -8515,7 +8515,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8515 8515
8516 /* fetch ucode file from disk, alloc and copy to bus-master buffers ... 8516 /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
8517 * ucode filename and max sizes are card-specific. */ 8517 * ucode filename and max sizes are card-specific. */
8518 err = iwl_read_ucode(priv); 8518 err = iwl3945_read_ucode(priv);
8519 if (err) { 8519 if (err) {
8520 IWL_ERROR("Could not read microcode: %d\n", err); 8520 IWL_ERROR("Could not read microcode: %d\n", err);
8521 mutex_unlock(&priv->mutex); 8521 mutex_unlock(&priv->mutex);
@@ -8531,9 +8531,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8531 return 0; 8531 return 0;
8532 8532
8533 out_pci_alloc: 8533 out_pci_alloc:
8534 iwl_dealloc_ucode_pci(priv); 8534 iwl3945_dealloc_ucode_pci(priv);
8535 8535
8536 sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); 8536 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
8537 8537
8538 out_release_irq: 8538 out_release_irq:
8539 free_irq(pdev->irq, priv); 8539 free_irq(pdev->irq, priv);
@@ -8542,7 +8542,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8542 pci_disable_msi(pdev); 8542 pci_disable_msi(pdev);
8543 destroy_workqueue(priv->workqueue); 8543 destroy_workqueue(priv->workqueue);
8544 priv->workqueue = NULL; 8544 priv->workqueue = NULL;
8545 iwl_unset_hw_setting(priv); 8545 iwl3945_unset_hw_setting(priv);
8546 8546
8547 out_iounmap: 8547 out_iounmap:
8548 pci_iounmap(pdev, priv->hw_base); 8548 pci_iounmap(pdev, priv->hw_base);
@@ -8557,9 +8557,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8557 return err; 8557 return err;
8558} 8558}
8559 8559
8560static void iwl_pci_remove(struct pci_dev *pdev) 8560static void iwl3945_pci_remove(struct pci_dev *pdev)
8561{ 8561{
8562 struct iwl_priv *priv = pci_get_drvdata(pdev); 8562 struct iwl3945_priv *priv = pci_get_drvdata(pdev);
8563 struct list_head *p, *q; 8563 struct list_head *p, *q;
8564 int i; 8564 int i;
8565 8565
@@ -8570,36 +8570,36 @@ static void iwl_pci_remove(struct pci_dev *pdev)
8570 8570
8571 set_bit(STATUS_EXIT_PENDING, &priv->status); 8571 set_bit(STATUS_EXIT_PENDING, &priv->status);
8572 8572
8573 iwl_down(priv); 8573 iwl3945_down(priv);
8574 8574
8575 /* Free MAC hash list for ADHOC */ 8575 /* Free MAC hash list for ADHOC */
8576 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { 8576 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
8577 list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) { 8577 list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) {
8578 list_del(p); 8578 list_del(p);
8579 kfree(list_entry(p, struct iwl_ibss_seq, list)); 8579 kfree(list_entry(p, struct iwl3945_ibss_seq, list));
8580 } 8580 }
8581 } 8581 }
8582 8582
8583 sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); 8583 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
8584 8584
8585 iwl_dealloc_ucode_pci(priv); 8585 iwl3945_dealloc_ucode_pci(priv);
8586 8586
8587 if (priv->rxq.bd) 8587 if (priv->rxq.bd)
8588 iwl_rx_queue_free(priv, &priv->rxq); 8588 iwl3945_rx_queue_free(priv, &priv->rxq);
8589 iwl_hw_txq_ctx_free(priv); 8589 iwl3945_hw_txq_ctx_free(priv);
8590 8590
8591 iwl_unset_hw_setting(priv); 8591 iwl3945_unset_hw_setting(priv);
8592 iwl_clear_stations_table(priv); 8592 iwl3945_clear_stations_table(priv);
8593 8593
8594 if (priv->mac80211_registered) { 8594 if (priv->mac80211_registered) {
8595 ieee80211_unregister_hw(priv->hw); 8595 ieee80211_unregister_hw(priv->hw);
8596 iwl_rate_control_unregister(priv->hw); 8596 iwl3945_rate_control_unregister(priv->hw);
8597 } 8597 }
8598 8598
8599 /*netif_stop_queue(dev); */ 8599 /*netif_stop_queue(dev); */
8600 flush_workqueue(priv->workqueue); 8600 flush_workqueue(priv->workqueue);
8601 8601
8602 /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes 8602 /* ieee80211_unregister_hw calls iwl3945_mac_stop, which flushes
8603 * priv->workqueue... so we can't take down the workqueue 8603 * priv->workqueue... so we can't take down the workqueue
8604 * until now... */ 8604 * until now... */
8605 destroy_workqueue(priv->workqueue); 8605 destroy_workqueue(priv->workqueue);
@@ -8625,14 +8625,14 @@ static void iwl_pci_remove(struct pci_dev *pdev)
8625 8625
8626#ifdef CONFIG_PM 8626#ifdef CONFIG_PM
8627 8627
8628static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) 8628static int iwl3945_pci_suspend(struct pci_dev *pdev, pm_message_t state)
8629{ 8629{
8630 struct iwl_priv *priv = pci_get_drvdata(pdev); 8630 struct iwl3945_priv *priv = pci_get_drvdata(pdev);
8631 8631
8632 set_bit(STATUS_IN_SUSPEND, &priv->status); 8632 set_bit(STATUS_IN_SUSPEND, &priv->status);
8633 8633
8634 /* Take down the device; powers it off, etc. */ 8634 /* Take down the device; powers it off, etc. */
8635 iwl_down(priv); 8635 iwl3945_down(priv);
8636 8636
8637 if (priv->mac80211_registered) 8637 if (priv->mac80211_registered)
8638 ieee80211_stop_queues(priv->hw); 8638 ieee80211_stop_queues(priv->hw);
@@ -8644,7 +8644,7 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
8644 return 0; 8644 return 0;
8645} 8645}
8646 8646
8647static void iwl_resume(struct iwl_priv *priv) 8647static void iwl3945_resume(struct iwl3945_priv *priv)
8648{ 8648{
8649 unsigned long flags; 8649 unsigned long flags;
8650 8650
@@ -8653,47 +8653,47 @@ static void iwl_resume(struct iwl_priv *priv)
8653 * Without all of the following, resume will not attempt to take 8653 * Without all of the following, resume will not attempt to take
8654 * down the NIC (it shouldn't really need to) and will just try 8654 * down the NIC (it shouldn't really need to) and will just try
8655 * and bring the NIC back up. However that fails during the 8655 * and bring the NIC back up. However that fails during the
8656 * ucode verification process. This then causes iwl_down to be 8656 * ucode verification process. This then causes iwl3945_down to be
8657 * called *after* iwl_hw_nic_init() has succeeded -- which 8657 * called *after* iwl3945_hw_nic_init() has succeeded -- which
8658 * then lets the next init sequence succeed. So, we've 8658 * then lets the next init sequence succeed. So, we've
8659 * replicated all of that NIC init code here... */ 8659 * replicated all of that NIC init code here... */
8660 8660
8661 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 8661 iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF);
8662 8662
8663 iwl_hw_nic_init(priv); 8663 iwl3945_hw_nic_init(priv);
8664 8664
8665 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 8665 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
8666 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, 8666 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR,
8667 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 8667 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
8668 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 8668 iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF);
8669 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 8669 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
8670 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 8670 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
8671 8671
8672 /* tell the device to stop sending interrupts */ 8672 /* tell the device to stop sending interrupts */
8673 iwl_disable_interrupts(priv); 8673 iwl3945_disable_interrupts(priv);
8674 8674
8675 spin_lock_irqsave(&priv->lock, flags); 8675 spin_lock_irqsave(&priv->lock, flags);
8676 iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 8676 iwl3945_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
8677 8677
8678 if (!iwl_grab_nic_access(priv)) { 8678 if (!iwl3945_grab_nic_access(priv)) {
8679 iwl_write_prph(priv, APMG_CLK_DIS_REG, 8679 iwl3945_write_prph(priv, APMG_CLK_DIS_REG,
8680 APMG_CLK_VAL_DMA_CLK_RQT); 8680 APMG_CLK_VAL_DMA_CLK_RQT);
8681 iwl_release_nic_access(priv); 8681 iwl3945_release_nic_access(priv);
8682 } 8682 }
8683 spin_unlock_irqrestore(&priv->lock, flags); 8683 spin_unlock_irqrestore(&priv->lock, flags);
8684 8684
8685 udelay(5); 8685 udelay(5);
8686 8686
8687 iwl_hw_nic_reset(priv); 8687 iwl3945_hw_nic_reset(priv);
8688 8688
8689 /* Bring the device back up */ 8689 /* Bring the device back up */
8690 clear_bit(STATUS_IN_SUSPEND, &priv->status); 8690 clear_bit(STATUS_IN_SUSPEND, &priv->status);
8691 queue_work(priv->workqueue, &priv->up); 8691 queue_work(priv->workqueue, &priv->up);
8692} 8692}
8693 8693
8694static int iwl_pci_resume(struct pci_dev *pdev) 8694static int iwl3945_pci_resume(struct pci_dev *pdev)
8695{ 8695{
8696 struct iwl_priv *priv = pci_get_drvdata(pdev); 8696 struct iwl3945_priv *priv = pci_get_drvdata(pdev);
8697 int err; 8697 int err;
8698 8698
8699 printk(KERN_INFO "Coming out of suspend...\n"); 8699 printk(KERN_INFO "Coming out of suspend...\n");
@@ -8710,7 +8710,7 @@ static int iwl_pci_resume(struct pci_dev *pdev)
8710 */ 8710 */
8711 pci_write_config_byte(pdev, 0x41, 0x00); 8711 pci_write_config_byte(pdev, 0x41, 0x00);
8712 8712
8713 iwl_resume(priv); 8713 iwl3945_resume(priv);
8714 8714
8715 return 0; 8715 return 0;
8716} 8716}
@@ -8723,33 +8723,33 @@ static int iwl_pci_resume(struct pci_dev *pdev)
8723 * 8723 *
8724 *****************************************************************************/ 8724 *****************************************************************************/
8725 8725
8726static struct pci_driver iwl_driver = { 8726static struct pci_driver iwl3945_driver = {
8727 .name = DRV_NAME, 8727 .name = DRV_NAME,
8728 .id_table = iwl_hw_card_ids, 8728 .id_table = iwl3945_hw_card_ids,
8729 .probe = iwl_pci_probe, 8729 .probe = iwl3945_pci_probe,
8730 .remove = __devexit_p(iwl_pci_remove), 8730 .remove = __devexit_p(iwl3945_pci_remove),
8731#ifdef CONFIG_PM 8731#ifdef CONFIG_PM
8732 .suspend = iwl_pci_suspend, 8732 .suspend = iwl3945_pci_suspend,
8733 .resume = iwl_pci_resume, 8733 .resume = iwl3945_pci_resume,
8734#endif 8734#endif
8735}; 8735};
8736 8736
8737static int __init iwl_init(void) 8737static int __init iwl3945_init(void)
8738{ 8738{
8739 8739
8740 int ret; 8740 int ret;
8741 printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); 8741 printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n");
8742 printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); 8742 printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n");
8743 ret = pci_register_driver(&iwl_driver); 8743 ret = pci_register_driver(&iwl3945_driver);
8744 if (ret) { 8744 if (ret) {
8745 IWL_ERROR("Unable to initialize PCI module\n"); 8745 IWL_ERROR("Unable to initialize PCI module\n");
8746 return ret; 8746 return ret;
8747 } 8747 }
8748#ifdef CONFIG_IWL3945_DEBUG 8748#ifdef CONFIG_IWL3945_DEBUG
8749 ret = driver_create_file(&iwl_driver.driver, &driver_attr_debug_level); 8749 ret = driver_create_file(&iwl3945_driver.driver, &driver_attr_debug_level);
8750 if (ret) { 8750 if (ret) {
8751 IWL_ERROR("Unable to create driver sysfs file\n"); 8751 IWL_ERROR("Unable to create driver sysfs file\n");
8752 pci_unregister_driver(&iwl_driver); 8752 pci_unregister_driver(&iwl3945_driver);
8753 return ret; 8753 return ret;
8754 } 8754 }
8755#endif 8755#endif
@@ -8757,32 +8757,32 @@ static int __init iwl_init(void)
8757 return ret; 8757 return ret;
8758} 8758}
8759 8759
8760static void __exit iwl_exit(void) 8760static void __exit iwl3945_exit(void)
8761{ 8761{
8762#ifdef CONFIG_IWL3945_DEBUG 8762#ifdef CONFIG_IWL3945_DEBUG
8763 driver_remove_file(&iwl_driver.driver, &driver_attr_debug_level); 8763 driver_remove_file(&iwl3945_driver.driver, &driver_attr_debug_level);
8764#endif 8764#endif
8765 pci_unregister_driver(&iwl_driver); 8765 pci_unregister_driver(&iwl3945_driver);
8766} 8766}
8767 8767
8768module_param_named(antenna, iwl_param_antenna, int, 0444); 8768module_param_named(antenna, iwl3945_param_antenna, int, 0444);
8769MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); 8769MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])");
8770module_param_named(disable, iwl_param_disable, int, 0444); 8770module_param_named(disable, iwl3945_param_disable, int, 0444);
8771MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])"); 8771MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])");
8772module_param_named(hwcrypto, iwl_param_hwcrypto, int, 0444); 8772module_param_named(hwcrypto, iwl3945_param_hwcrypto, int, 0444);
8773MODULE_PARM_DESC(hwcrypto, 8773MODULE_PARM_DESC(hwcrypto,
8774 "using hardware crypto engine (default 0 [software])\n"); 8774 "using hardware crypto engine (default 0 [software])\n");
8775module_param_named(debug, iwl_param_debug, int, 0444); 8775module_param_named(debug, iwl3945_param_debug, int, 0444);
8776MODULE_PARM_DESC(debug, "debug output mask"); 8776MODULE_PARM_DESC(debug, "debug output mask");
8777module_param_named(disable_hw_scan, iwl_param_disable_hw_scan, int, 0444); 8777module_param_named(disable_hw_scan, iwl3945_param_disable_hw_scan, int, 0444);
8778MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); 8778MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)");
8779 8779
8780module_param_named(queues_num, iwl_param_queues_num, int, 0444); 8780module_param_named(queues_num, iwl3945_param_queues_num, int, 0444);
8781MODULE_PARM_DESC(queues_num, "number of hw queues."); 8781MODULE_PARM_DESC(queues_num, "number of hw queues.");
8782 8782
8783/* QoS */ 8783/* QoS */
8784module_param_named(qos_enable, iwl_param_qos_enable, int, 0444); 8784module_param_named(qos_enable, iwl3945_param_qos_enable, int, 0444);
8785MODULE_PARM_DESC(qos_enable, "enable all QoS functionality"); 8785MODULE_PARM_DESC(qos_enable, "enable all QoS functionality");
8786 8786
8787module_exit(iwl_exit); 8787module_exit(iwl3945_exit);
8788module_init(iwl_init); 8788module_init(iwl3945_init);