aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl4965-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/iwl4965-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/iwl4965-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c2321
1 files changed, 1160 insertions, 1161 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 07df6c1c102c..41cabd618496 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -60,11 +60,11 @@
60#include "iwl-helpers.h" 60#include "iwl-helpers.h"
61 61
62#ifdef CONFIG_IWL4965_DEBUG 62#ifdef CONFIG_IWL4965_DEBUG
63u32 iwl_debug_level; 63u32 iwl4965_debug_level;
64#endif 64#endif
65 65
66static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, 66static int iwl4965_tx_queue_update_write_ptr(struct iwl4965_priv *priv,
67 struct iwl_tx_queue *txq); 67 struct iwl4965_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 iwl4965_param_disable_hw_scan;
77static int iwl_param_debug; 77static int iwl4965_param_debug;
78static int iwl_param_disable; /* def: enable radio */ 78static int iwl4965_param_disable; /* def: enable radio */
79static int iwl_param_antenna; /* def: 0 = both antennas (use diversity) */ 79static int iwl4965_param_antenna; /* def: 0 = both antennas (use diversity) */
80int iwl_param_hwcrypto; /* def: using software encryption */ 80int iwl4965_param_hwcrypto; /* def: using software encryption */
81static int iwl_param_qos_enable = 1; 81static int iwl4965_param_qos_enable = 1;
82int iwl_param_queues_num = IWL_MAX_NUM_QUEUES; 82int iwl4965_param_queues_num = IWL_MAX_NUM_QUEUES;
83 83
84/* 84/*
85 * module name, copyright, version, etc. 85 * module name, copyright, version, etc.
@@ -125,8 +125,8 @@ __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr)
125 return NULL; 125 return NULL;
126} 126}
127 127
128static const struct ieee80211_hw_mode *iwl_get_hw_mode( 128static const struct ieee80211_hw_mode *iwl4965_get_hw_mode(
129 struct iwl_priv *priv, int mode) 129 struct iwl4965_priv *priv, int mode)
130{ 130{
131 int i; 131 int i;
132 132
@@ -137,7 +137,7 @@ static const struct ieee80211_hw_mode *iwl_get_hw_mode(
137 return NULL; 137 return NULL;
138} 138}
139 139
140static int iwl_is_empty_essid(const char *essid, int essid_len) 140static int iwl4965_is_empty_essid(const char *essid, int essid_len)
141{ 141{
142 /* Single white space is for Linksys APs */ 142 /* Single white space is for Linksys APs */
143 if (essid_len == 1 && essid[0] == ' ') 143 if (essid_len == 1 && essid[0] == ' ')
@@ -153,13 +153,13 @@ static int iwl_is_empty_essid(const char *essid, int essid_len)
153 return 1; 153 return 1;
154} 154}
155 155
156static const char *iwl_escape_essid(const char *essid, u8 essid_len) 156static const char *iwl4965_escape_essid(const char *essid, u8 essid_len)
157{ 157{
158 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; 158 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
159 const char *s = essid; 159 const char *s = essid;
160 char *d = escaped; 160 char *d = escaped;
161 161
162 if (iwl_is_empty_essid(essid, essid_len)) { 162 if (iwl4965_is_empty_essid(essid, essid_len)) {
163 memcpy(escaped, "<hidden>", sizeof("<hidden>")); 163 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
164 return escaped; 164 return escaped;
165 } 165 }
@@ -177,10 +177,10 @@ static const char *iwl_escape_essid(const char *essid, u8 essid_len)
177 return escaped; 177 return escaped;
178} 178}
179 179
180static void iwl_print_hex_dump(int level, void *p, u32 len) 180static void iwl4965_print_hex_dump(int level, void *p, u32 len)
181{ 181{
182#ifdef CONFIG_IWL4965_DEBUG 182#ifdef CONFIG_IWL4965_DEBUG
183 if (!(iwl_debug_level & level)) 183 if (!(iwl4965_debug_level & level))
184 return; 184 return;
185 185
186 print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1, 186 print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1,
@@ -206,7 +206,7 @@ static void iwl_print_hex_dump(int level, void *p, u32 len)
206 * and four transmit queues for data. 206 * and four transmit queues for data.
207 ***************************************************/ 207 ***************************************************/
208 208
209static int iwl_queue_space(const struct iwl_queue *q) 209static int iwl4965_queue_space(const struct iwl4965_queue *q)
210{ 210{
211 int s = q->read_ptr - q->write_ptr; 211 int s = q->read_ptr - q->write_ptr;
212 212
@@ -223,25 +223,25 @@ static int iwl_queue_space(const struct iwl_queue *q)
223} 223}
224 224
225/* XXX: n_bd must be power-of-two size */ 225/* XXX: n_bd must be power-of-two size */
226static inline int iwl_queue_inc_wrap(int index, int n_bd) 226static inline int iwl4965_queue_inc_wrap(int index, int n_bd)
227{ 227{
228 return ++index & (n_bd - 1); 228 return ++index & (n_bd - 1);
229} 229}
230 230
231/* XXX: n_bd must be power-of-two size */ 231/* XXX: n_bd must be power-of-two size */
232static inline int iwl_queue_dec_wrap(int index, int n_bd) 232static inline int iwl4965_queue_dec_wrap(int index, int n_bd)
233{ 233{
234 return --index & (n_bd - 1); 234 return --index & (n_bd - 1);
235} 235}
236 236
237static inline int x2_queue_used(const struct iwl_queue *q, int i) 237static inline int x2_queue_used(const struct iwl4965_queue *q, int i)
238{ 238{
239 return q->write_ptr > q->read_ptr ? 239 return q->write_ptr > q->read_ptr ?
240 (i >= q->read_ptr && i < q->write_ptr) : 240 (i >= q->read_ptr && i < q->write_ptr) :
241 !(i < q->read_ptr && i >= q->write_ptr); 241 !(i < q->read_ptr && i >= q->write_ptr);
242} 242}
243 243
244static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) 244static inline u8 get_cmd_index(struct iwl4965_queue *q, u32 index, int is_huge)
245{ 245{
246 if (is_huge) 246 if (is_huge)
247 return q->n_window; 247 return q->n_window;
@@ -249,15 +249,15 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge)
249 return index & (q->n_window - 1); 249 return index & (q->n_window - 1);
250} 250}
251 251
252static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, 252static int iwl4965_queue_init(struct iwl4965_priv *priv, struct iwl4965_queue *q,
253 int count, int slots_num, u32 id) 253 int count, int slots_num, u32 id)
254{ 254{
255 q->n_bd = count; 255 q->n_bd = count;
256 q->n_window = slots_num; 256 q->n_window = slots_num;
257 q->id = id; 257 q->id = id;
258 258
259 /* count must be power-of-two size, otherwise iwl_queue_inc_wrap 259 /* count must be power-of-two size, otherwise iwl4965_queue_inc_wrap
260 * and iwl_queue_dec_wrap are broken. */ 260 * and iwl4965_queue_dec_wrap are broken. */
261 BUG_ON(!is_power_of_2(count)); 261 BUG_ON(!is_power_of_2(count));
262 262
263 /* slots_num must be power-of-two size, otherwise 263 /* slots_num must be power-of-two size, otherwise
@@ -277,8 +277,8 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
277 return 0; 277 return 0;
278} 278}
279 279
280static int iwl_tx_queue_alloc(struct iwl_priv *priv, 280static int iwl4965_tx_queue_alloc(struct iwl4965_priv *priv,
281 struct iwl_tx_queue *txq, u32 id) 281 struct iwl4965_tx_queue *txq, u32 id)
282{ 282{
283 struct pci_dev *dev = priv->pci_dev; 283 struct pci_dev *dev = priv->pci_dev;
284 284
@@ -315,8 +315,8 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv,
315 return -ENOMEM; 315 return -ENOMEM;
316} 316}
317 317
318int iwl_tx_queue_init(struct iwl_priv *priv, 318int iwl4965_tx_queue_init(struct iwl4965_priv *priv,
319 struct iwl_tx_queue *txq, int slots_num, u32 txq_id) 319 struct iwl4965_tx_queue *txq, int slots_num, u32 txq_id)
320{ 320{
321 struct pci_dev *dev = priv->pci_dev; 321 struct pci_dev *dev = priv->pci_dev;
322 int len; 322 int len;
@@ -325,14 +325,14 @@ int iwl_tx_queue_init(struct iwl_priv *priv,
325 /* allocate command space + one big command for scan since scan 325 /* allocate command space + one big command for scan since scan
326 * command is very huge the system will not have two scan at the 326 * command is very huge the system will not have two scan at the
327 * same time */ 327 * same time */
328 len = sizeof(struct iwl_cmd) * slots_num; 328 len = sizeof(struct iwl4965_cmd) * slots_num;
329 if (txq_id == IWL_CMD_QUEUE_NUM) 329 if (txq_id == IWL_CMD_QUEUE_NUM)
330 len += IWL_MAX_SCAN_SIZE; 330 len += IWL_MAX_SCAN_SIZE;
331 txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd); 331 txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd);
332 if (!txq->cmd) 332 if (!txq->cmd)
333 return -ENOMEM; 333 return -ENOMEM;
334 334
335 rc = iwl_tx_queue_alloc(priv, txq, txq_id); 335 rc = iwl4965_tx_queue_alloc(priv, txq, txq_id);
336 if (rc) { 336 if (rc) {
337 pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd); 337 pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd);
338 338
@@ -341,26 +341,26 @@ int iwl_tx_queue_init(struct iwl_priv *priv,
341 txq->need_update = 0; 341 txq->need_update = 0;
342 342
343 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise 343 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
344 * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */ 344 * iwl4965_queue_inc_wrap and iwl4965_queue_dec_wrap are broken. */
345 BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); 345 BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1));
346 iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id); 346 iwl4965_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id);
347 347
348 iwl_hw_tx_queue_init(priv, txq); 348 iwl4965_hw_tx_queue_init(priv, txq);
349 349
350 return 0; 350 return 0;
351} 351}
352 352
353/** 353/**
354 * iwl_tx_queue_free - Deallocate DMA queue. 354 * iwl4965_tx_queue_free - Deallocate DMA queue.
355 * @txq: Transmit queue to deallocate. 355 * @txq: Transmit queue to deallocate.
356 * 356 *
357 * Empty queue by removing and destroying all BD's. 357 * Empty queue by removing and destroying all BD's.
358 * Free all buffers. txq itself is not freed. 358 * Free all buffers. txq itself is not freed.
359 * 359 *
360 */ 360 */
361void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) 361void iwl4965_tx_queue_free(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq)
362{ 362{
363 struct iwl_queue *q = &txq->q; 363 struct iwl4965_queue *q = &txq->q;
364 struct pci_dev *dev = priv->pci_dev; 364 struct pci_dev *dev = priv->pci_dev;
365 int len; 365 int len;
366 366
@@ -369,10 +369,10 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq)
369 369
370 /* first, empty all BD's */ 370 /* first, empty all BD's */
371 for (; q->write_ptr != q->read_ptr; 371 for (; q->write_ptr != q->read_ptr;
372 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) 372 q->read_ptr = iwl4965_queue_inc_wrap(q->read_ptr, q->n_bd))
373 iwl_hw_txq_free_tfd(priv, txq); 373 iwl4965_hw_txq_free_tfd(priv, txq);
374 374
375 len = sizeof(struct iwl_cmd) * q->n_window; 375 len = sizeof(struct iwl4965_cmd) * q->n_window;
376 if (q->id == IWL_CMD_QUEUE_NUM) 376 if (q->id == IWL_CMD_QUEUE_NUM)
377 len += IWL_MAX_SCAN_SIZE; 377 len += IWL_MAX_SCAN_SIZE;
378 378
@@ -380,7 +380,7 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq)
380 380
381 /* free buffers belonging to queue itself */ 381 /* free buffers belonging to queue itself */
382 if (txq->q.n_bd) 382 if (txq->q.n_bd)
383 pci_free_consistent(dev, sizeof(struct iwl_tfd_frame) * 383 pci_free_consistent(dev, sizeof(struct iwl4965_tfd_frame) *
384 txq->q.n_bd, txq->bd, txq->q.dma_addr); 384 txq->q.n_bd, txq->bd, txq->q.dma_addr);
385 385
386 if (txq->txb) { 386 if (txq->txb) {
@@ -392,12 +392,12 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq)
392 memset(txq, 0, sizeof(*txq)); 392 memset(txq, 0, sizeof(*txq));
393} 393}
394 394
395const u8 BROADCAST_ADDR[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; 395const u8 iwl4965_broadcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
396 396
397/*************** STATION TABLE MANAGEMENT **** 397/*************** STATION TABLE MANAGEMENT ****
398 * 398 *
399 * NOTE: This needs to be overhauled to better synchronize between 399 * NOTE: This needs to be overhauled to better synchronize between
400 * how the iwl-4965.c is using iwl_hw_find_station vs. iwl-3945.c 400 * how the iwl-4965.c is using iwl4965_hw_find_station vs. iwl-3945.c
401 * 401 *
402 * mac80211 should also be examined to determine if sta_info is duplicating 402 * mac80211 should also be examined to determine if sta_info is duplicating
403 * the functionality provided here 403 * 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 iwl4965_remove_station(struct iwl4965_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;
@@ -443,7 +443,7 @@ out:
443} 443}
444#endif 444#endif
445 445
446static void iwl_clear_stations_table(struct iwl_priv *priv) 446static void iwl4965_clear_stations_table(struct iwl4965_priv *priv)
447{ 447{
448 unsigned long flags; 448 unsigned long flags;
449 449
@@ -455,11 +455,11 @@ static void iwl_clear_stations_table(struct iwl_priv *priv)
455 spin_unlock_irqrestore(&priv->sta_lock, flags); 455 spin_unlock_irqrestore(&priv->sta_lock, flags);
456} 456}
457 457
458u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags) 458u8 iwl4965_add_station_flags(struct iwl4965_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 iwl4965_station_entry *station;
463 unsigned long flags_spin; 463 unsigned long flags_spin;
464 DECLARE_MAC_BUF(mac); 464 DECLARE_MAC_BUF(mac);
465 465
@@ -501,7 +501,7 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags)
501 station->used = 1; 501 station->used = 1;
502 priv->num_stations++; 502 priv->num_stations++;
503 503
504 memset(&station->sta, 0, sizeof(struct iwl_addsta_cmd)); 504 memset(&station->sta, 0, sizeof(struct iwl4965_addsta_cmd));
505 memcpy(station->sta.sta.addr, addr, ETH_ALEN); 505 memcpy(station->sta.sta.addr, addr, ETH_ALEN);
506 station->sta.mode = 0; 506 station->sta.mode = 0;
507 station->sta.sta.sta_id = index; 507 station->sta.sta.sta_id = index;
@@ -515,14 +515,14 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags)
515#endif /*CONFIG_IWL4965_HT*/ 515#endif /*CONFIG_IWL4965_HT*/
516 516
517 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 517 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
518 iwl_send_add_station(priv, &station->sta, flags); 518 iwl4965_send_add_station(priv, &station->sta, flags);
519 return index; 519 return index;
520 520
521} 521}
522 522
523/*************** DRIVER STATUS FUNCTIONS *****/ 523/*************** DRIVER STATUS FUNCTIONS *****/
524 524
525static inline int iwl_is_ready(struct iwl_priv *priv) 525static inline int iwl4965_is_ready(struct iwl4965_priv *priv)
526{ 526{
527 /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are 527 /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are
528 * set but EXIT_PENDING is not */ 528 * set but EXIT_PENDING is not */
@@ -531,29 +531,29 @@ static inline int iwl_is_ready(struct iwl_priv *priv)
531 !test_bit(STATUS_EXIT_PENDING, &priv->status); 531 !test_bit(STATUS_EXIT_PENDING, &priv->status);
532} 532}
533 533
534static inline int iwl_is_alive(struct iwl_priv *priv) 534static inline int iwl4965_is_alive(struct iwl4965_priv *priv)
535{ 535{
536 return test_bit(STATUS_ALIVE, &priv->status); 536 return test_bit(STATUS_ALIVE, &priv->status);
537} 537}
538 538
539static inline int iwl_is_init(struct iwl_priv *priv) 539static inline int iwl4965_is_init(struct iwl4965_priv *priv)
540{ 540{
541 return test_bit(STATUS_INIT, &priv->status); 541 return test_bit(STATUS_INIT, &priv->status);
542} 542}
543 543
544static inline int iwl_is_rfkill(struct iwl_priv *priv) 544static inline int iwl4965_is_rfkill(struct iwl4965_priv *priv)
545{ 545{
546 return test_bit(STATUS_RF_KILL_HW, &priv->status) || 546 return test_bit(STATUS_RF_KILL_HW, &priv->status) ||
547 test_bit(STATUS_RF_KILL_SW, &priv->status); 547 test_bit(STATUS_RF_KILL_SW, &priv->status);
548} 548}
549 549
550static inline int iwl_is_ready_rf(struct iwl_priv *priv) 550static inline int iwl4965_is_ready_rf(struct iwl4965_priv *priv)
551{ 551{
552 552
553 if (iwl_is_rfkill(priv)) 553 if (iwl4965_is_rfkill(priv))
554 return 0; 554 return 0;
555 555
556 return iwl_is_ready(priv); 556 return iwl4965_is_ready(priv);
557} 557}
558 558
559/*************** HOST COMMAND QUEUE FUNCTIONS *****/ 559/*************** HOST COMMAND QUEUE FUNCTIONS *****/
@@ -618,7 +618,7 @@ static const char *get_cmd_string(u8 cmd)
618#define HOST_COMPLETE_TIMEOUT (HZ / 2) 618#define HOST_COMPLETE_TIMEOUT (HZ / 2)
619 619
620/** 620/**
621 * iwl_enqueue_hcmd - enqueue a uCode command 621 * iwl4965_enqueue_hcmd - enqueue a uCode command
622 * @priv: device private data point 622 * @priv: device private data point
623 * @cmd: a point to the ucode command structure 623 * @cmd: a point to the ucode command structure
624 * 624 *
@@ -626,13 +626,13 @@ static const char *get_cmd_string(u8 cmd)
626 * failed. On success, it turns the index (> 0) of command in the 626 * failed. On success, it turns the index (> 0) of command in the
627 * command queue. 627 * command queue.
628 */ 628 */
629static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 629static int iwl4965_enqueue_hcmd(struct iwl4965_priv *priv, struct iwl4965_host_cmd *cmd)
630{ 630{
631 struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; 631 struct iwl4965_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
632 struct iwl_queue *q = &txq->q; 632 struct iwl4965_queue *q = &txq->q;
633 struct iwl_tfd_frame *tfd; 633 struct iwl4965_tfd_frame *tfd;
634 u32 *control_flags; 634 u32 *control_flags;
635 struct iwl_cmd *out_cmd; 635 struct iwl4965_cmd *out_cmd;
636 u32 idx; 636 u32 idx;
637 u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); 637 u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr));
638 dma_addr_t phys_addr; 638 dma_addr_t phys_addr;
@@ -645,7 +645,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
645 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) && 645 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) &&
646 !(cmd->meta.flags & CMD_SIZE_HUGE)); 646 !(cmd->meta.flags & CMD_SIZE_HUGE));
647 647
648 if (iwl_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) { 648 if (iwl4965_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) {
649 IWL_ERROR("No space for Tx\n"); 649 IWL_ERROR("No space for Tx\n");
650 return -ENOSPC; 650 return -ENOSPC;
651 } 651 }
@@ -674,8 +674,8 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
674 out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); 674 out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME);
675 675
676 phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx + 676 phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx +
677 offsetof(struct iwl_cmd, hdr); 677 offsetof(struct iwl4965_cmd, hdr);
678 iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); 678 iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size);
679 679
680 IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, " 680 IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, "
681 "%d bytes at %d[%d]:%d\n", 681 "%d bytes at %d[%d]:%d\n",
@@ -685,14 +685,14 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
685 685
686 txq->need_update = 1; 686 txq->need_update = 1;
687 ret = iwl4965_tx_queue_update_wr_ptr(priv, txq, 0); 687 ret = iwl4965_tx_queue_update_wr_ptr(priv, txq, 0);
688 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 688 q->write_ptr = iwl4965_queue_inc_wrap(q->write_ptr, q->n_bd);
689 iwl_tx_queue_update_write_ptr(priv, txq); 689 iwl4965_tx_queue_update_write_ptr(priv, txq);
690 690
691 spin_unlock_irqrestore(&priv->hcmd_lock, flags); 691 spin_unlock_irqrestore(&priv->hcmd_lock, flags);
692 return ret ? ret : idx; 692 return ret ? ret : idx;
693} 693}
694 694
695static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 695static int iwl4965_send_cmd_async(struct iwl4965_priv *priv, struct iwl4965_host_cmd *cmd)
696{ 696{
697 int ret; 697 int ret;
698 698
@@ -707,16 +707,16 @@ static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
707 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 707 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
708 return -EBUSY; 708 return -EBUSY;
709 709
710 ret = iwl_enqueue_hcmd(priv, cmd); 710 ret = iwl4965_enqueue_hcmd(priv, cmd);
711 if (ret < 0) { 711 if (ret < 0) {
712 IWL_ERROR("Error sending %s: iwl_enqueue_hcmd failed: %d\n", 712 IWL_ERROR("Error sending %s: iwl4965_enqueue_hcmd failed: %d\n",
713 get_cmd_string(cmd->id), ret); 713 get_cmd_string(cmd->id), ret);
714 return ret; 714 return ret;
715 } 715 }
716 return 0; 716 return 0;
717} 717}
718 718
719static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 719static int iwl4965_send_cmd_sync(struct iwl4965_priv *priv, struct iwl4965_host_cmd *cmd)
720{ 720{
721 int cmd_idx; 721 int cmd_idx;
722 int ret; 722 int ret;
@@ -738,10 +738,10 @@ static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
738 if (cmd->meta.flags & CMD_WANT_SKB) 738 if (cmd->meta.flags & CMD_WANT_SKB)
739 cmd->meta.source = &cmd->meta; 739 cmd->meta.source = &cmd->meta;
740 740
741 cmd_idx = iwl_enqueue_hcmd(priv, cmd); 741 cmd_idx = iwl4965_enqueue_hcmd(priv, cmd);
742 if (cmd_idx < 0) { 742 if (cmd_idx < 0) {
743 ret = cmd_idx; 743 ret = cmd_idx;
744 IWL_ERROR("Error sending %s: iwl_enqueue_hcmd failed: %d\n", 744 IWL_ERROR("Error sending %s: iwl4965_enqueue_hcmd failed: %d\n",
745 get_cmd_string(cmd->id), ret); 745 get_cmd_string(cmd->id), ret);
746 goto out; 746 goto out;
747 } 747 }
@@ -785,7 +785,7 @@ static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
785 785
786cancel: 786cancel:
787 if (cmd->meta.flags & CMD_WANT_SKB) { 787 if (cmd->meta.flags & CMD_WANT_SKB) {
788 struct iwl_cmd *qcmd; 788 struct iwl4965_cmd *qcmd;
789 789
790 /* Cancel the CMD_WANT_SKB flag for the cmd in the 790 /* Cancel the CMD_WANT_SKB flag for the cmd in the
791 * TX cmd queue. Otherwise in case the cmd comes 791 * TX cmd queue. Otherwise in case the cmd comes
@@ -804,60 +804,60 @@ out:
804 return ret; 804 return ret;
805} 805}
806 806
807int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 807int iwl4965_send_cmd(struct iwl4965_priv *priv, struct iwl4965_host_cmd *cmd)
808{ 808{
809 if (cmd->meta.flags & CMD_ASYNC) 809 if (cmd->meta.flags & CMD_ASYNC)
810 return iwl_send_cmd_async(priv, cmd); 810 return iwl4965_send_cmd_async(priv, cmd);
811 811
812 return iwl_send_cmd_sync(priv, cmd); 812 return iwl4965_send_cmd_sync(priv, cmd);
813} 813}
814 814
815int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data) 815int iwl4965_send_cmd_pdu(struct iwl4965_priv *priv, u8 id, u16 len, const void *data)
816{ 816{
817 struct iwl_host_cmd cmd = { 817 struct iwl4965_host_cmd cmd = {
818 .id = id, 818 .id = id,
819 .len = len, 819 .len = len,
820 .data = data, 820 .data = data,
821 }; 821 };
822 822
823 return iwl_send_cmd_sync(priv, &cmd); 823 return iwl4965_send_cmd_sync(priv, &cmd);
824} 824}
825 825
826static int __must_check iwl_send_cmd_u32(struct iwl_priv *priv, u8 id, u32 val) 826static int __must_check iwl4965_send_cmd_u32(struct iwl4965_priv *priv, u8 id, u32 val)
827{ 827{
828 struct iwl_host_cmd cmd = { 828 struct iwl4965_host_cmd cmd = {
829 .id = id, 829 .id = id,
830 .len = sizeof(val), 830 .len = sizeof(val),
831 .data = &val, 831 .data = &val,
832 }; 832 };
833 833
834 return iwl_send_cmd_sync(priv, &cmd); 834 return iwl4965_send_cmd_sync(priv, &cmd);
835} 835}
836 836
837int iwl_send_statistics_request(struct iwl_priv *priv) 837int iwl4965_send_statistics_request(struct iwl4965_priv *priv)
838{ 838{
839 return iwl_send_cmd_u32(priv, REPLY_STATISTICS_CMD, 0); 839 return iwl4965_send_cmd_u32(priv, REPLY_STATISTICS_CMD, 0);
840} 840}
841 841
842/** 842/**
843 * iwl_rxon_add_station - add station into station table. 843 * iwl4965_rxon_add_station - add station into station table.
844 * 844 *
845 * there is only one AP station with id= IWL_AP_ID 845 * there is only one AP station with id= IWL_AP_ID
846 * NOTE: mutex must be held before calling the this fnction 846 * NOTE: mutex must be held before calling the this fnction
847*/ 847*/
848static int iwl_rxon_add_station(struct iwl_priv *priv, 848static int iwl4965_rxon_add_station(struct iwl4965_priv *priv,
849 const u8 *addr, int is_ap) 849 const u8 *addr, int is_ap)
850{ 850{
851 u8 sta_id; 851 u8 sta_id;
852 852
853 sta_id = iwl_add_station(priv, addr, is_ap, 0); 853 sta_id = iwl4965_add_station_flags(priv, addr, is_ap, 0);
854 iwl4965_add_station(priv, addr, is_ap); 854 iwl4965_add_station(priv, addr, is_ap);
855 855
856 return sta_id; 856 return sta_id;
857} 857}
858 858
859/** 859/**
860 * iwl_set_rxon_channel - Set the phymode and channel values in staging RXON 860 * iwl4965_set_rxon_channel - Set the phymode and channel values in staging RXON
861 * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz 861 * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz
862 * @channel: Any channel valid for the requested phymode 862 * @channel: Any channel valid for the requested phymode
863 863
@@ -866,9 +866,9 @@ static int iwl_rxon_add_station(struct iwl_priv *priv,
866 * NOTE: Does not commit to the hardware; it sets appropriate bit fields 866 * NOTE: Does not commit to the hardware; it sets appropriate bit fields
867 * in the staging RXON flag structure based on the phymode 867 * in the staging RXON flag structure based on the phymode
868 */ 868 */
869static int iwl_set_rxon_channel(struct iwl_priv *priv, u8 phymode, u16 channel) 869static int iwl4965_set_rxon_channel(struct iwl4965_priv *priv, u8 phymode, u16 channel)
870{ 870{
871 if (!iwl_get_channel_info(priv, phymode, channel)) { 871 if (!iwl4965_get_channel_info(priv, phymode, channel)) {
872 IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", 872 IWL_DEBUG_INFO("Could not set channel to %d [%d]\n",
873 channel, phymode); 873 channel, phymode);
874 return -EINVAL; 874 return -EINVAL;
@@ -892,13 +892,13 @@ static int iwl_set_rxon_channel(struct iwl_priv *priv, u8 phymode, u16 channel)
892} 892}
893 893
894/** 894/**
895 * iwl_check_rxon_cmd - validate RXON structure is valid 895 * iwl4965_check_rxon_cmd - validate RXON structure is valid
896 * 896 *
897 * NOTE: This is really only useful during development and can eventually 897 * NOTE: This is really only useful during development and can eventually
898 * be #ifdef'd out once the driver is stable and folks aren't actively 898 * be #ifdef'd out once the driver is stable and folks aren't actively
899 * making changes 899 * making changes
900 */ 900 */
901static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon) 901static int iwl4965_check_rxon_cmd(struct iwl4965_rxon_cmd *rxon)
902{ 902{
903 int error = 0; 903 int error = 0;
904 int counter = 1; 904 int counter = 1;
@@ -958,21 +958,21 @@ static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon)
958 le16_to_cpu(rxon->channel)); 958 le16_to_cpu(rxon->channel));
959 959
960 if (error) { 960 if (error) {
961 IWL_ERROR("Not a valid iwl_rxon_assoc_cmd field values\n"); 961 IWL_ERROR("Not a valid iwl4965_rxon_assoc_cmd field values\n");
962 return -1; 962 return -1;
963 } 963 }
964 return 0; 964 return 0;
965} 965}
966 966
967/** 967/**
968 * iwl_full_rxon_required - determine if RXON_ASSOC can be used in RXON commit 968 * iwl4965_full_rxon_required - determine if RXON_ASSOC can be used in RXON commit
969 * @priv: staging_rxon is compared to active_rxon 969 * @priv: staging_rxon is compared to active_rxon
970 * 970 *
971 * If the RXON structure is changing sufficient to require a new 971 * If the RXON structure is changing sufficient to require a new
972 * tune or to clear and reset the RXON_FILTER_ASSOC_MSK then return 1 972 * tune or to clear and reset the RXON_FILTER_ASSOC_MSK then return 1
973 * to indicate a new tune is required. 973 * to indicate a new tune is required.
974 */ 974 */
975static int iwl_full_rxon_required(struct iwl_priv *priv) 975static int iwl4965_full_rxon_required(struct iwl4965_priv *priv)
976{ 976{
977 977
978 /* These items are only settable from the full RXON command */ 978 /* These items are only settable from the full RXON command */
@@ -1012,19 +1012,19 @@ static int iwl_full_rxon_required(struct iwl_priv *priv)
1012 return 0; 1012 return 0;
1013} 1013}
1014 1014
1015static int iwl_send_rxon_assoc(struct iwl_priv *priv) 1015static int iwl4965_send_rxon_assoc(struct iwl4965_priv *priv)
1016{ 1016{
1017 int rc = 0; 1017 int rc = 0;
1018 struct iwl_rx_packet *res = NULL; 1018 struct iwl4965_rx_packet *res = NULL;
1019 struct iwl_rxon_assoc_cmd rxon_assoc; 1019 struct iwl4965_rxon_assoc_cmd rxon_assoc;
1020 struct iwl_host_cmd cmd = { 1020 struct iwl4965_host_cmd cmd = {
1021 .id = REPLY_RXON_ASSOC, 1021 .id = REPLY_RXON_ASSOC,
1022 .len = sizeof(rxon_assoc), 1022 .len = sizeof(rxon_assoc),
1023 .meta.flags = CMD_WANT_SKB, 1023 .meta.flags = CMD_WANT_SKB,
1024 .data = &rxon_assoc, 1024 .data = &rxon_assoc,
1025 }; 1025 };
1026 const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; 1026 const struct iwl4965_rxon_cmd *rxon1 = &priv->staging_rxon;
1027 const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; 1027 const struct iwl4965_rxon_cmd *rxon2 = &priv->active_rxon;
1028 1028
1029 if ((rxon1->flags == rxon2->flags) && 1029 if ((rxon1->flags == rxon2->flags) &&
1030 (rxon1->filter_flags == rxon2->filter_flags) && 1030 (rxon1->filter_flags == rxon2->filter_flags) &&
@@ -1050,11 +1050,11 @@ static int iwl_send_rxon_assoc(struct iwl_priv *priv)
1050 priv->staging_rxon.ofdm_ht_dual_stream_basic_rates; 1050 priv->staging_rxon.ofdm_ht_dual_stream_basic_rates;
1051 rxon_assoc.rx_chain_select_flags = priv->staging_rxon.rx_chain; 1051 rxon_assoc.rx_chain_select_flags = priv->staging_rxon.rx_chain;
1052 1052
1053 rc = iwl_send_cmd_sync(priv, &cmd); 1053 rc = iwl4965_send_cmd_sync(priv, &cmd);
1054 if (rc) 1054 if (rc)
1055 return rc; 1055 return rc;
1056 1056
1057 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; 1057 res = (struct iwl4965_rx_packet *)cmd.meta.u.skb->data;
1058 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 1058 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
1059 IWL_ERROR("Bad return from REPLY_RXON_ASSOC command\n"); 1059 IWL_ERROR("Bad return from REPLY_RXON_ASSOC command\n");
1060 rc = -EIO; 1060 rc = -EIO;
@@ -1067,37 +1067,37 @@ static int iwl_send_rxon_assoc(struct iwl_priv *priv)
1067} 1067}
1068 1068
1069/** 1069/**
1070 * iwl_commit_rxon - commit staging_rxon to hardware 1070 * iwl4965_commit_rxon - commit staging_rxon to hardware
1071 * 1071 *
1072 * The RXON command in staging_rxon is committed to the hardware and 1072 * The RXON command in staging_rxon is committed to the hardware and
1073 * the active_rxon structure is updated with the new data. This 1073 * the active_rxon structure is updated with the new data. This
1074 * function correctly transitions out of the RXON_ASSOC_MSK state if 1074 * function correctly transitions out of the RXON_ASSOC_MSK state if
1075 * a HW tune is required based on the RXON structure changes. 1075 * a HW tune is required based on the RXON structure changes.
1076 */ 1076 */
1077static int iwl_commit_rxon(struct iwl_priv *priv) 1077static int iwl4965_commit_rxon(struct iwl4965_priv *priv)
1078{ 1078{
1079 /* cast away the const for active_rxon in this function */ 1079 /* cast away the const for active_rxon in this function */
1080 struct iwl_rxon_cmd *active_rxon = (void *)&priv->active_rxon; 1080 struct iwl4965_rxon_cmd *active_rxon = (void *)&priv->active_rxon;
1081 DECLARE_MAC_BUF(mac); 1081 DECLARE_MAC_BUF(mac);
1082 int rc = 0; 1082 int rc = 0;
1083 1083
1084 if (!iwl_is_alive(priv)) 1084 if (!iwl4965_is_alive(priv))
1085 return -1; 1085 return -1;
1086 1086
1087 /* always get timestamp with Rx frame */ 1087 /* always get timestamp with Rx frame */
1088 priv->staging_rxon.flags |= RXON_FLG_TSF2HOST_MSK; 1088 priv->staging_rxon.flags |= RXON_FLG_TSF2HOST_MSK;
1089 1089
1090 rc = iwl_check_rxon_cmd(&priv->staging_rxon); 1090 rc = iwl4965_check_rxon_cmd(&priv->staging_rxon);
1091 if (rc) { 1091 if (rc) {
1092 IWL_ERROR("Invalid RXON configuration. Not committing.\n"); 1092 IWL_ERROR("Invalid RXON configuration. Not committing.\n");
1093 return -EINVAL; 1093 return -EINVAL;
1094 } 1094 }
1095 1095
1096 /* If we don't need to send a full RXON, we can use 1096 /* If we don't need to send a full RXON, we can use
1097 * iwl_rxon_assoc_cmd which is used to reconfigure filter 1097 * iwl4965_rxon_assoc_cmd which is used to reconfigure filter
1098 * and other flags for the current radio configuration. */ 1098 * and other flags for the current radio configuration. */
1099 if (!iwl_full_rxon_required(priv)) { 1099 if (!iwl4965_full_rxon_required(priv)) {
1100 rc = iwl_send_rxon_assoc(priv); 1100 rc = iwl4965_send_rxon_assoc(priv);
1101 if (rc) { 1101 if (rc) {
1102 IWL_ERROR("Error setting RXON_ASSOC " 1102 IWL_ERROR("Error setting RXON_ASSOC "
1103 "configuration (%d).\n", rc); 1103 "configuration (%d).\n", rc);
@@ -1124,13 +1124,13 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1124 * an RXON_ASSOC and the new config wants the associated mask enabled, 1124 * an RXON_ASSOC and the new config wants the associated mask enabled,
1125 * we must clear the associated from the active configuration 1125 * we must clear the associated from the active configuration
1126 * before we apply the new config */ 1126 * before we apply the new config */
1127 if (iwl_is_associated(priv) && 1127 if (iwl4965_is_associated(priv) &&
1128 (priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK)) { 1128 (priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK)) {
1129 IWL_DEBUG_INFO("Toggling associated bit on current RXON\n"); 1129 IWL_DEBUG_INFO("Toggling associated bit on current RXON\n");
1130 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 1130 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1131 1131
1132 rc = iwl_send_cmd_pdu(priv, REPLY_RXON, 1132 rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON,
1133 sizeof(struct iwl_rxon_cmd), 1133 sizeof(struct iwl4965_rxon_cmd),
1134 &priv->active_rxon); 1134 &priv->active_rxon);
1135 1135
1136 /* If the mask clearing failed then we set 1136 /* If the mask clearing failed then we set
@@ -1153,14 +1153,14 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1153 print_mac(mac, priv->staging_rxon.bssid_addr)); 1153 print_mac(mac, priv->staging_rxon.bssid_addr));
1154 1154
1155 /* Apply the new configuration */ 1155 /* Apply the new configuration */
1156 rc = iwl_send_cmd_pdu(priv, REPLY_RXON, 1156 rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON,
1157 sizeof(struct iwl_rxon_cmd), &priv->staging_rxon); 1157 sizeof(struct iwl4965_rxon_cmd), &priv->staging_rxon);
1158 if (rc) { 1158 if (rc) {
1159 IWL_ERROR("Error setting new configuration (%d).\n", rc); 1159 IWL_ERROR("Error setting new configuration (%d).\n", rc);
1160 return rc; 1160 return rc;
1161 } 1161 }
1162 1162
1163 iwl_clear_stations_table(priv); 1163 iwl4965_clear_stations_table(priv);
1164 1164
1165#ifdef CONFIG_IWL4965_SENSITIVITY 1165#ifdef CONFIG_IWL4965_SENSITIVITY
1166 if (!priv->error_recovering) 1166 if (!priv->error_recovering)
@@ -1174,14 +1174,14 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1174 1174
1175 /* If we issue a new RXON command which required a tune then we must 1175 /* If we issue a new RXON command which required a tune then we must
1176 * send a new TXPOWER command or we won't be able to Tx any frames */ 1176 * send a new TXPOWER command or we won't be able to Tx any frames */
1177 rc = iwl_hw_reg_send_txpower(priv); 1177 rc = iwl4965_hw_reg_send_txpower(priv);
1178 if (rc) { 1178 if (rc) {
1179 IWL_ERROR("Error setting Tx power (%d).\n", rc); 1179 IWL_ERROR("Error setting Tx power (%d).\n", rc);
1180 return rc; 1180 return rc;
1181 } 1181 }
1182 1182
1183 /* Add the broadcast address so we can send broadcast frames */ 1183 /* Add the broadcast address so we can send broadcast frames */
1184 if (iwl_rxon_add_station(priv, BROADCAST_ADDR, 0) == 1184 if (iwl4965_rxon_add_station(priv, iwl4965_broadcast_addr, 0) ==
1185 IWL_INVALID_STATION) { 1185 IWL_INVALID_STATION) {
1186 IWL_ERROR("Error adding BROADCAST address for transmit.\n"); 1186 IWL_ERROR("Error adding BROADCAST address for transmit.\n");
1187 return -EIO; 1187 return -EIO;
@@ -1189,9 +1189,9 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1189 1189
1190 /* If we have set the ASSOC_MSK and we are in BSS mode then 1190 /* If we have set the ASSOC_MSK and we are in BSS mode then
1191 * add the IWL_AP_ID to the station rate table */ 1191 * add the IWL_AP_ID to the station rate table */
1192 if (iwl_is_associated(priv) && 1192 if (iwl4965_is_associated(priv) &&
1193 (priv->iw_mode == IEEE80211_IF_TYPE_STA)) { 1193 (priv->iw_mode == IEEE80211_IF_TYPE_STA)) {
1194 if (iwl_rxon_add_station(priv, priv->active_rxon.bssid_addr, 1) 1194 if (iwl4965_rxon_add_station(priv, priv->active_rxon.bssid_addr, 1)
1195 == IWL_INVALID_STATION) { 1195 == IWL_INVALID_STATION) {
1196 IWL_ERROR("Error adding AP address for transmit.\n"); 1196 IWL_ERROR("Error adding AP address for transmit.\n");
1197 return -EIO; 1197 return -EIO;
@@ -1202,9 +1202,9 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1202 return 0; 1202 return 0;
1203} 1203}
1204 1204
1205static int iwl_send_bt_config(struct iwl_priv *priv) 1205static int iwl4965_send_bt_config(struct iwl4965_priv *priv)
1206{ 1206{
1207 struct iwl_bt_cmd bt_cmd = { 1207 struct iwl4965_bt_cmd bt_cmd = {
1208 .flags = 3, 1208 .flags = 3,
1209 .lead_time = 0xAA, 1209 .lead_time = 0xAA,
1210 .max_kill = 1, 1210 .max_kill = 1,
@@ -1212,15 +1212,15 @@ static int iwl_send_bt_config(struct iwl_priv *priv)
1212 .kill_cts_mask = 0, 1212 .kill_cts_mask = 0,
1213 }; 1213 };
1214 1214
1215 return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG, 1215 return iwl4965_send_cmd_pdu(priv, REPLY_BT_CONFIG,
1216 sizeof(struct iwl_bt_cmd), &bt_cmd); 1216 sizeof(struct iwl4965_bt_cmd), &bt_cmd);
1217} 1217}
1218 1218
1219static int iwl_send_scan_abort(struct iwl_priv *priv) 1219static int iwl4965_send_scan_abort(struct iwl4965_priv *priv)
1220{ 1220{
1221 int rc = 0; 1221 int rc = 0;
1222 struct iwl_rx_packet *res; 1222 struct iwl4965_rx_packet *res;
1223 struct iwl_host_cmd cmd = { 1223 struct iwl4965_host_cmd cmd = {
1224 .id = REPLY_SCAN_ABORT_CMD, 1224 .id = REPLY_SCAN_ABORT_CMD,
1225 .meta.flags = CMD_WANT_SKB, 1225 .meta.flags = CMD_WANT_SKB,
1226 }; 1226 };
@@ -1233,13 +1233,13 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
1233 return 0; 1233 return 0;
1234 } 1234 }
1235 1235
1236 rc = iwl_send_cmd_sync(priv, &cmd); 1236 rc = iwl4965_send_cmd_sync(priv, &cmd);
1237 if (rc) { 1237 if (rc) {
1238 clear_bit(STATUS_SCAN_ABORTING, &priv->status); 1238 clear_bit(STATUS_SCAN_ABORTING, &priv->status);
1239 return rc; 1239 return rc;
1240 } 1240 }
1241 1241
1242 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; 1242 res = (struct iwl4965_rx_packet *)cmd.meta.u.skb->data;
1243 if (res->u.status != CAN_ABORT_STATUS) { 1243 if (res->u.status != CAN_ABORT_STATUS) {
1244 /* The scan abort will return 1 for success or 1244 /* The scan abort will return 1 for success or
1245 * 2 for "failure". A failure condition can be 1245 * 2 for "failure". A failure condition can be
@@ -1257,8 +1257,8 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
1257 return rc; 1257 return rc;
1258} 1258}
1259 1259
1260static int iwl_card_state_sync_callback(struct iwl_priv *priv, 1260static int iwl4965_card_state_sync_callback(struct iwl4965_priv *priv,
1261 struct iwl_cmd *cmd, 1261 struct iwl4965_cmd *cmd,
1262 struct sk_buff *skb) 1262 struct sk_buff *skb)
1263{ 1263{
1264 return 1; 1264 return 1;
@@ -1274,9 +1274,9 @@ static int iwl_card_state_sync_callback(struct iwl_priv *priv,
1274 * When in the 'halt' state, the card is shut down and must be fully 1274 * When in the 'halt' state, the card is shut down and must be fully
1275 * restarted to come back on. 1275 * restarted to come back on.
1276 */ 1276 */
1277static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag) 1277static int iwl4965_send_card_state(struct iwl4965_priv *priv, u32 flags, u8 meta_flag)
1278{ 1278{
1279 struct iwl_host_cmd cmd = { 1279 struct iwl4965_host_cmd cmd = {
1280 .id = REPLY_CARD_STATE_CMD, 1280 .id = REPLY_CARD_STATE_CMD,
1281 .len = sizeof(u32), 1281 .len = sizeof(u32),
1282 .data = &flags, 1282 .data = &flags,
@@ -1284,22 +1284,22 @@ static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)
1284 }; 1284 };
1285 1285
1286 if (meta_flag & CMD_ASYNC) 1286 if (meta_flag & CMD_ASYNC)
1287 cmd.meta.u.callback = iwl_card_state_sync_callback; 1287 cmd.meta.u.callback = iwl4965_card_state_sync_callback;
1288 1288
1289 return iwl_send_cmd(priv, &cmd); 1289 return iwl4965_send_cmd(priv, &cmd);
1290} 1290}
1291 1291
1292static int iwl_add_sta_sync_callback(struct iwl_priv *priv, 1292static int iwl4965_add_sta_sync_callback(struct iwl4965_priv *priv,
1293 struct iwl_cmd *cmd, struct sk_buff *skb) 1293 struct iwl4965_cmd *cmd, struct sk_buff *skb)
1294{ 1294{
1295 struct iwl_rx_packet *res = NULL; 1295 struct iwl4965_rx_packet *res = NULL;
1296 1296
1297 if (!skb) { 1297 if (!skb) {
1298 IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n"); 1298 IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n");
1299 return 1; 1299 return 1;
1300 } 1300 }
1301 1301
1302 res = (struct iwl_rx_packet *)skb->data; 1302 res = (struct iwl4965_rx_packet *)skb->data;
1303 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 1303 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
1304 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n", 1304 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
1305 res->hdr.flags); 1305 res->hdr.flags);
@@ -1317,29 +1317,29 @@ static int iwl_add_sta_sync_callback(struct iwl_priv *priv,
1317 return 1; 1317 return 1;
1318} 1318}
1319 1319
1320int iwl_send_add_station(struct iwl_priv *priv, 1320int iwl4965_send_add_station(struct iwl4965_priv *priv,
1321 struct iwl_addsta_cmd *sta, u8 flags) 1321 struct iwl4965_addsta_cmd *sta, u8 flags)
1322{ 1322{
1323 struct iwl_rx_packet *res = NULL; 1323 struct iwl4965_rx_packet *res = NULL;
1324 int rc = 0; 1324 int rc = 0;
1325 struct iwl_host_cmd cmd = { 1325 struct iwl4965_host_cmd cmd = {
1326 .id = REPLY_ADD_STA, 1326 .id = REPLY_ADD_STA,
1327 .len = sizeof(struct iwl_addsta_cmd), 1327 .len = sizeof(struct iwl4965_addsta_cmd),
1328 .meta.flags = flags, 1328 .meta.flags = flags,
1329 .data = sta, 1329 .data = sta,
1330 }; 1330 };
1331 1331
1332 if (flags & CMD_ASYNC) 1332 if (flags & CMD_ASYNC)
1333 cmd.meta.u.callback = iwl_add_sta_sync_callback; 1333 cmd.meta.u.callback = iwl4965_add_sta_sync_callback;
1334 else 1334 else
1335 cmd.meta.flags |= CMD_WANT_SKB; 1335 cmd.meta.flags |= CMD_WANT_SKB;
1336 1336
1337 rc = iwl_send_cmd(priv, &cmd); 1337 rc = iwl4965_send_cmd(priv, &cmd);
1338 1338
1339 if (rc || (flags & CMD_ASYNC)) 1339 if (rc || (flags & CMD_ASYNC))
1340 return rc; 1340 return rc;
1341 1341
1342 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; 1342 res = (struct iwl4965_rx_packet *)cmd.meta.u.skb->data;
1343 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 1343 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
1344 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n", 1344 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
1345 res->hdr.flags); 1345 res->hdr.flags);
@@ -1364,7 +1364,7 @@ int iwl_send_add_station(struct iwl_priv *priv,
1364 return rc; 1364 return rc;
1365} 1365}
1366 1366
1367static int iwl_update_sta_key_info(struct iwl_priv *priv, 1367static int iwl4965_update_sta_key_info(struct iwl4965_priv *priv,
1368 struct ieee80211_key_conf *keyconf, 1368 struct ieee80211_key_conf *keyconf,
1369 u8 sta_id) 1369 u8 sta_id)
1370{ 1370{
@@ -1398,28 +1398,28 @@ static int iwl_update_sta_key_info(struct iwl_priv *priv,
1398 spin_unlock_irqrestore(&priv->sta_lock, flags); 1398 spin_unlock_irqrestore(&priv->sta_lock, flags);
1399 1399
1400 IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n"); 1400 IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n");
1401 iwl_send_add_station(priv, &priv->stations[sta_id].sta, 0); 1401 iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, 0);
1402 return 0; 1402 return 0;
1403} 1403}
1404 1404
1405static int iwl_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id) 1405static int iwl4965_clear_sta_key_info(struct iwl4965_priv *priv, u8 sta_id)
1406{ 1406{
1407 unsigned long flags; 1407 unsigned long flags;
1408 1408
1409 spin_lock_irqsave(&priv->sta_lock, flags); 1409 spin_lock_irqsave(&priv->sta_lock, flags);
1410 memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl_hw_key)); 1410 memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl4965_hw_key));
1411 memset(&priv->stations[sta_id].sta.key, 0, sizeof(struct iwl_keyinfo)); 1411 memset(&priv->stations[sta_id].sta.key, 0, sizeof(struct iwl4965_keyinfo));
1412 priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; 1412 priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC;
1413 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; 1413 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
1414 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 1414 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
1415 spin_unlock_irqrestore(&priv->sta_lock, flags); 1415 spin_unlock_irqrestore(&priv->sta_lock, flags);
1416 1416
1417 IWL_DEBUG_INFO("hwcrypto: clear ucode station key info\n"); 1417 IWL_DEBUG_INFO("hwcrypto: clear ucode station key info\n");
1418 iwl_send_add_station(priv, &priv->stations[sta_id].sta, 0); 1418 iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, 0);
1419 return 0; 1419 return 0;
1420} 1420}
1421 1421
1422static void iwl_clear_free_frames(struct iwl_priv *priv) 1422static void iwl4965_clear_free_frames(struct iwl4965_priv *priv)
1423{ 1423{
1424 struct list_head *element; 1424 struct list_head *element;
1425 1425
@@ -1429,7 +1429,7 @@ static void iwl_clear_free_frames(struct iwl_priv *priv)
1429 while (!list_empty(&priv->free_frames)) { 1429 while (!list_empty(&priv->free_frames)) {
1430 element = priv->free_frames.next; 1430 element = priv->free_frames.next;
1431 list_del(element); 1431 list_del(element);
1432 kfree(list_entry(element, struct iwl_frame, list)); 1432 kfree(list_entry(element, struct iwl4965_frame, list));
1433 priv->frames_count--; 1433 priv->frames_count--;
1434 } 1434 }
1435 1435
@@ -1440,9 +1440,9 @@ static void iwl_clear_free_frames(struct iwl_priv *priv)
1440 } 1440 }
1441} 1441}
1442 1442
1443static struct iwl_frame *iwl_get_free_frame(struct iwl_priv *priv) 1443static struct iwl4965_frame *iwl4965_get_free_frame(struct iwl4965_priv *priv)
1444{ 1444{
1445 struct iwl_frame *frame; 1445 struct iwl4965_frame *frame;
1446 struct list_head *element; 1446 struct list_head *element;
1447 if (list_empty(&priv->free_frames)) { 1447 if (list_empty(&priv->free_frames)) {
1448 frame = kzalloc(sizeof(*frame), GFP_KERNEL); 1448 frame = kzalloc(sizeof(*frame), GFP_KERNEL);
@@ -1457,21 +1457,21 @@ static struct iwl_frame *iwl_get_free_frame(struct iwl_priv *priv)
1457 1457
1458 element = priv->free_frames.next; 1458 element = priv->free_frames.next;
1459 list_del(element); 1459 list_del(element);
1460 return list_entry(element, struct iwl_frame, list); 1460 return list_entry(element, struct iwl4965_frame, list);
1461} 1461}
1462 1462
1463static void iwl_free_frame(struct iwl_priv *priv, struct iwl_frame *frame) 1463static void iwl4965_free_frame(struct iwl4965_priv *priv, struct iwl4965_frame *frame)
1464{ 1464{
1465 memset(frame, 0, sizeof(*frame)); 1465 memset(frame, 0, sizeof(*frame));
1466 list_add(&frame->list, &priv->free_frames); 1466 list_add(&frame->list, &priv->free_frames);
1467} 1467}
1468 1468
1469unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, 1469unsigned int iwl4965_fill_beacon_frame(struct iwl4965_priv *priv,
1470 struct ieee80211_hdr *hdr, 1470 struct ieee80211_hdr *hdr,
1471 const u8 *dest, int left) 1471 const u8 *dest, int left)
1472{ 1472{
1473 1473
1474 if (!iwl_is_associated(priv) || !priv->ibss_beacon || 1474 if (!iwl4965_is_associated(priv) || !priv->ibss_beacon ||
1475 ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) && 1475 ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) &&
1476 (priv->iw_mode != IEEE80211_IF_TYPE_AP))) 1476 (priv->iw_mode != IEEE80211_IF_TYPE_AP)))
1477 return 0; 1477 return 0;
@@ -1484,7 +1484,7 @@ unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv,
1484 return priv->ibss_beacon->len; 1484 return priv->ibss_beacon->len;
1485} 1485}
1486 1486
1487int iwl_rate_index_from_plcp(int plcp) 1487int iwl4965_rate_index_from_plcp(int plcp)
1488{ 1488{
1489 int i = 0; 1489 int i = 0;
1490 1490
@@ -1502,34 +1502,34 @@ int iwl_rate_index_from_plcp(int plcp)
1502 (i <= IWL_LAST_OFDM_RATE)) 1502 (i <= IWL_LAST_OFDM_RATE))
1503 return i; 1503 return i;
1504 } else { 1504 } else {
1505 for (i = 0; i < ARRAY_SIZE(iwl_rates); i++) 1505 for (i = 0; i < ARRAY_SIZE(iwl4965_rates); i++)
1506 if (iwl_rates[i].plcp == (plcp &0xFF)) 1506 if (iwl4965_rates[i].plcp == (plcp &0xFF))
1507 return i; 1507 return i;
1508 } 1508 }
1509 return -1; 1509 return -1;
1510} 1510}
1511 1511
1512static u8 iwl_rate_get_lowest_plcp(int rate_mask) 1512static u8 iwl4965_rate_get_lowest_plcp(int rate_mask)
1513{ 1513{
1514 u8 i; 1514 u8 i;
1515 1515
1516 for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID; 1516 for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID;
1517 i = iwl_rates[i].next_ieee) { 1517 i = iwl4965_rates[i].next_ieee) {
1518 if (rate_mask & (1 << i)) 1518 if (rate_mask & (1 << i))
1519 return iwl_rates[i].plcp; 1519 return iwl4965_rates[i].plcp;
1520 } 1520 }
1521 1521
1522 return IWL_RATE_INVALID; 1522 return IWL_RATE_INVALID;
1523} 1523}
1524 1524
1525static int iwl_send_beacon_cmd(struct iwl_priv *priv) 1525static int iwl4965_send_beacon_cmd(struct iwl4965_priv *priv)
1526{ 1526{
1527 struct iwl_frame *frame; 1527 struct iwl4965_frame *frame;
1528 unsigned int frame_size; 1528 unsigned int frame_size;
1529 int rc; 1529 int rc;
1530 u8 rate; 1530 u8 rate;
1531 1531
1532 frame = iwl_get_free_frame(priv); 1532 frame = iwl4965_get_free_frame(priv);
1533 1533
1534 if (!frame) { 1534 if (!frame) {
1535 IWL_ERROR("Could not obtain free frame buffer for beacon " 1535 IWL_ERROR("Could not obtain free frame buffer for beacon "
@@ -1538,22 +1538,22 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv)
1538 } 1538 }
1539 1539
1540 if (!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)) { 1540 if (!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)) {
1541 rate = iwl_rate_get_lowest_plcp(priv->active_rate_basic & 1541 rate = iwl4965_rate_get_lowest_plcp(priv->active_rate_basic &
1542 0xFF0); 1542 0xFF0);
1543 if (rate == IWL_INVALID_RATE) 1543 if (rate == IWL_INVALID_RATE)
1544 rate = IWL_RATE_6M_PLCP; 1544 rate = IWL_RATE_6M_PLCP;
1545 } else { 1545 } else {
1546 rate = iwl_rate_get_lowest_plcp(priv->active_rate_basic & 0xF); 1546 rate = iwl4965_rate_get_lowest_plcp(priv->active_rate_basic & 0xF);
1547 if (rate == IWL_INVALID_RATE) 1547 if (rate == IWL_INVALID_RATE)
1548 rate = IWL_RATE_1M_PLCP; 1548 rate = IWL_RATE_1M_PLCP;
1549 } 1549 }
1550 1550
1551 frame_size = iwl_hw_get_beacon_cmd(priv, frame, rate); 1551 frame_size = iwl4965_hw_get_beacon_cmd(priv, frame, rate);
1552 1552
1553 rc = iwl_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, 1553 rc = iwl4965_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size,
1554 &frame->u.cmd[0]); 1554 &frame->u.cmd[0]);
1555 1555
1556 iwl_free_frame(priv, frame); 1556 iwl4965_free_frame(priv, frame);
1557 1557
1558 return rc; 1558 return rc;
1559} 1559}
@@ -1564,22 +1564,22 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv)
1564 * 1564 *
1565 ******************************************************************************/ 1565 ******************************************************************************/
1566 1566
1567static void get_eeprom_mac(struct iwl_priv *priv, u8 *mac) 1567static void get_eeprom_mac(struct iwl4965_priv *priv, u8 *mac)
1568{ 1568{
1569 memcpy(mac, priv->eeprom.mac_address, 6); 1569 memcpy(mac, priv->eeprom.mac_address, 6);
1570} 1570}
1571 1571
1572/** 1572/**
1573 * iwl_eeprom_init - read EEPROM contents 1573 * iwl4965_eeprom_init - read EEPROM contents
1574 * 1574 *
1575 * Load the EEPROM from adapter into priv->eeprom 1575 * Load the EEPROM from adapter into priv->eeprom
1576 * 1576 *
1577 * NOTE: This routine uses the non-debug IO access functions. 1577 * NOTE: This routine uses the non-debug IO access functions.
1578 */ 1578 */
1579int iwl_eeprom_init(struct iwl_priv *priv) 1579int iwl4965_eeprom_init(struct iwl4965_priv *priv)
1580{ 1580{
1581 u16 *e = (u16 *)&priv->eeprom; 1581 u16 *e = (u16 *)&priv->eeprom;
1582 u32 gp = iwl_read32(priv, CSR_EEPROM_GP); 1582 u32 gp = iwl4965_read32(priv, CSR_EEPROM_GP);
1583 u32 r; 1583 u32 r;
1584 int sz = sizeof(priv->eeprom); 1584 int sz = sizeof(priv->eeprom);
1585 int rc; 1585 int rc;
@@ -1597,7 +1597,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
1597 return -ENOENT; 1597 return -ENOENT;
1598 } 1598 }
1599 1599
1600 rc = iwl_eeprom_acquire_semaphore(priv); 1600 rc = iwl4965_eeprom_acquire_semaphore(priv);
1601 if (rc < 0) { 1601 if (rc < 0) {
1602 IWL_ERROR("Failed to acquire EEPROM semaphore.\n"); 1602 IWL_ERROR("Failed to acquire EEPROM semaphore.\n");
1603 return -ENOENT; 1603 return -ENOENT;
@@ -1605,12 +1605,12 @@ int iwl_eeprom_init(struct iwl_priv *priv)
1605 1605
1606 /* eeprom is an array of 16bit values */ 1606 /* eeprom is an array of 16bit values */
1607 for (addr = 0; addr < sz; addr += sizeof(u16)) { 1607 for (addr = 0; addr < sz; addr += sizeof(u16)) {
1608 _iwl_write32(priv, CSR_EEPROM_REG, addr << 1); 1608 _iwl4965_write32(priv, CSR_EEPROM_REG, addr << 1);
1609 _iwl_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD); 1609 _iwl4965_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD);
1610 1610
1611 for (i = 0; i < IWL_EEPROM_ACCESS_TIMEOUT; 1611 for (i = 0; i < IWL_EEPROM_ACCESS_TIMEOUT;
1612 i += IWL_EEPROM_ACCESS_DELAY) { 1612 i += IWL_EEPROM_ACCESS_DELAY) {
1613 r = _iwl_read_direct32(priv, CSR_EEPROM_REG); 1613 r = _iwl4965_read_direct32(priv, CSR_EEPROM_REG);
1614 if (r & CSR_EEPROM_REG_READ_VALID_MSK) 1614 if (r & CSR_EEPROM_REG_READ_VALID_MSK)
1615 break; 1615 break;
1616 udelay(IWL_EEPROM_ACCESS_DELAY); 1616 udelay(IWL_EEPROM_ACCESS_DELAY);
@@ -1626,7 +1626,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
1626 rc = 0; 1626 rc = 0;
1627 1627
1628done: 1628done:
1629 iwl_eeprom_release_semaphore(priv); 1629 iwl4965_eeprom_release_semaphore(priv);
1630 return rc; 1630 return rc;
1631} 1631}
1632 1632
@@ -1638,19 +1638,19 @@ done:
1638#ifdef CONFIG_IWL4965_DEBUG 1638#ifdef CONFIG_IWL4965_DEBUG
1639 1639
1640/** 1640/**
1641 * iwl_report_frame - dump frame to syslog during debug sessions 1641 * iwl4965_report_frame - dump frame to syslog during debug sessions
1642 * 1642 *
1643 * hack this function to show different aspects of received frames, 1643 * hack this function to show different aspects of received frames,
1644 * including selective frame dumps. 1644 * including selective frame dumps.
1645 * group100 parameter selects whether to show 1 out of 100 good frames. 1645 * group100 parameter selects whether to show 1 out of 100 good frames.
1646 * 1646 *
1647 * TODO: ieee80211_hdr stuff is common to 3945 and 4965, so frame type 1647 * TODO: ieee80211_hdr stuff is common to 3945 and 4965, so frame type
1648 * info output is okay, but some of this stuff (e.g. iwl_rx_frame_stats) 1648 * info output is okay, but some of this stuff (e.g. iwl4965_rx_frame_stats)
1649 * is 3945-specific and gives bad output for 4965. Need to split the 1649 * is 3945-specific and gives bad output for 4965. Need to split the
1650 * functionality, keep common stuff here. 1650 * functionality, keep common stuff here.
1651 */ 1651 */
1652void iwl_report_frame(struct iwl_priv *priv, 1652void iwl4965_report_frame(struct iwl4965_priv *priv,
1653 struct iwl_rx_packet *pkt, 1653 struct iwl4965_rx_packet *pkt,
1654 struct ieee80211_hdr *header, int group100) 1654 struct ieee80211_hdr *header, int group100)
1655{ 1655{
1656 u32 to_us; 1656 u32 to_us;
@@ -1672,9 +1672,9 @@ void iwl_report_frame(struct iwl_priv *priv,
1672 u8 agc; 1672 u8 agc;
1673 u16 sig_avg; 1673 u16 sig_avg;
1674 u16 noise_diff; 1674 u16 noise_diff;
1675 struct iwl_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt); 1675 struct iwl4965_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt);
1676 struct iwl_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); 1676 struct iwl4965_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
1677 struct iwl_rx_frame_end *rx_end = IWL_RX_END(pkt); 1677 struct iwl4965_rx_frame_end *rx_end = IWL_RX_END(pkt);
1678 u8 *data = IWL_RX_DATA(pkt); 1678 u8 *data = IWL_RX_DATA(pkt);
1679 1679
1680 /* MAC header */ 1680 /* MAC header */
@@ -1750,11 +1750,11 @@ void iwl_report_frame(struct iwl_priv *priv,
1750 else 1750 else
1751 title = "Frame"; 1751 title = "Frame";
1752 1752
1753 rate = iwl_rate_index_from_plcp(rate_sym); 1753 rate = iwl4965_rate_index_from_plcp(rate_sym);
1754 if (rate == -1) 1754 if (rate == -1)
1755 rate = 0; 1755 rate = 0;
1756 else 1756 else
1757 rate = iwl_rates[rate].ieee / 2; 1757 rate = iwl4965_rates[rate].ieee / 2;
1758 1758
1759 /* print frame summary. 1759 /* print frame summary.
1760 * MAC addresses show just the last byte (for brevity), 1760 * MAC addresses show just the last byte (for brevity),
@@ -1776,25 +1776,25 @@ void iwl_report_frame(struct iwl_priv *priv,
1776 } 1776 }
1777 } 1777 }
1778 if (print_dump) 1778 if (print_dump)
1779 iwl_print_hex_dump(IWL_DL_RX, data, length); 1779 iwl4965_print_hex_dump(IWL_DL_RX, data, length);
1780} 1780}
1781#endif 1781#endif
1782 1782
1783static void iwl_unset_hw_setting(struct iwl_priv *priv) 1783static void iwl4965_unset_hw_setting(struct iwl4965_priv *priv)
1784{ 1784{
1785 if (priv->hw_setting.shared_virt) 1785 if (priv->hw_setting.shared_virt)
1786 pci_free_consistent(priv->pci_dev, 1786 pci_free_consistent(priv->pci_dev,
1787 sizeof(struct iwl_shared), 1787 sizeof(struct iwl4965_shared),
1788 priv->hw_setting.shared_virt, 1788 priv->hw_setting.shared_virt,
1789 priv->hw_setting.shared_phys); 1789 priv->hw_setting.shared_phys);
1790} 1790}
1791 1791
1792/** 1792/**
1793 * iwl_supported_rate_to_ie - fill in the supported rate in IE field 1793 * iwl4965_supported_rate_to_ie - fill in the supported rate in IE field
1794 * 1794 *
1795 * return : set the bit for each supported rate insert in ie 1795 * return : set the bit for each supported rate insert in ie
1796 */ 1796 */
1797static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, 1797static u16 iwl4965_supported_rate_to_ie(u8 *ie, u16 supported_rate,
1798 u16 basic_rate, int *left) 1798 u16 basic_rate, int *left)
1799{ 1799{
1800 u16 ret_rates = 0, bit; 1800 u16 ret_rates = 0, bit;
@@ -1805,7 +1805,7 @@ static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate,
1805 for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { 1805 for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) {
1806 if (bit & supported_rate) { 1806 if (bit & supported_rate) {
1807 ret_rates |= bit; 1807 ret_rates |= bit;
1808 rates[*cnt] = iwl_rates[i].ieee | 1808 rates[*cnt] = iwl4965_rates[i].ieee |
1809 ((bit & basic_rate) ? 0x80 : 0x00); 1809 ((bit & basic_rate) ? 0x80 : 0x00);
1810 (*cnt)++; 1810 (*cnt)++;
1811 (*left)--; 1811 (*left)--;
@@ -1819,15 +1819,15 @@ static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate,
1819} 1819}
1820 1820
1821#ifdef CONFIG_IWL4965_HT 1821#ifdef CONFIG_IWL4965_HT
1822void static iwl_set_ht_capab(struct ieee80211_hw *hw, 1822void static iwl4965_set_ht_capab(struct ieee80211_hw *hw,
1823 struct ieee80211_ht_capability *ht_cap, 1823 struct ieee80211_ht_capability *ht_cap,
1824 u8 use_wide_chan); 1824 u8 use_wide_chan);
1825#endif 1825#endif
1826 1826
1827/** 1827/**
1828 * iwl_fill_probe_req - fill in all required fields and IE for probe request 1828 * iwl4965_fill_probe_req - fill in all required fields and IE for probe request
1829 */ 1829 */
1830static u16 iwl_fill_probe_req(struct iwl_priv *priv, 1830static u16 iwl4965_fill_probe_req(struct iwl4965_priv *priv,
1831 struct ieee80211_mgmt *frame, 1831 struct ieee80211_mgmt *frame,
1832 int left, int is_direct) 1832 int left, int is_direct)
1833{ 1833{
@@ -1843,9 +1843,9 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1843 len += 24; 1843 len += 24;
1844 1844
1845 frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); 1845 frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
1846 memcpy(frame->da, BROADCAST_ADDR, ETH_ALEN); 1846 memcpy(frame->da, iwl4965_broadcast_addr, ETH_ALEN);
1847 memcpy(frame->sa, priv->mac_addr, ETH_ALEN); 1847 memcpy(frame->sa, priv->mac_addr, ETH_ALEN);
1848 memcpy(frame->bssid, BROADCAST_ADDR, ETH_ALEN); 1848 memcpy(frame->bssid, iwl4965_broadcast_addr, ETH_ALEN);
1849 frame->seq_ctrl = 0; 1849 frame->seq_ctrl = 0;
1850 1850
1851 /* fill in our indirect SSID IE */ 1851 /* fill in our indirect SSID IE */
@@ -1890,11 +1890,11 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1890 active_rate_basic = active_rates & IWL_BASIC_RATES_MASK; 1890 active_rate_basic = active_rates & IWL_BASIC_RATES_MASK;
1891 1891
1892 cck_rates = IWL_CCK_RATES_MASK & active_rates; 1892 cck_rates = IWL_CCK_RATES_MASK & active_rates;
1893 ret_rates = iwl_supported_rate_to_ie(pos, cck_rates, 1893 ret_rates = iwl4965_supported_rate_to_ie(pos, cck_rates,
1894 active_rate_basic, &left); 1894 active_rate_basic, &left);
1895 active_rates &= ~ret_rates; 1895 active_rates &= ~ret_rates;
1896 1896
1897 ret_rates = iwl_supported_rate_to_ie(pos, active_rates, 1897 ret_rates = iwl4965_supported_rate_to_ie(pos, active_rates,
1898 active_rate_basic, &left); 1898 active_rate_basic, &left);
1899 active_rates &= ~ret_rates; 1899 active_rates &= ~ret_rates;
1900 1900
@@ -1911,7 +1911,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1911 /* ... fill it in... */ 1911 /* ... fill it in... */
1912 *pos++ = WLAN_EID_EXT_SUPP_RATES; 1912 *pos++ = WLAN_EID_EXT_SUPP_RATES;
1913 *pos = 0; 1913 *pos = 0;
1914 iwl_supported_rate_to_ie(pos, active_rates, 1914 iwl4965_supported_rate_to_ie(pos, active_rates,
1915 active_rate_basic, &left); 1915 active_rate_basic, &left);
1916 if (*pos > 0) 1916 if (*pos > 0)
1917 len += 2 + *pos; 1917 len += 2 + *pos;
@@ -1925,7 +1925,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1925 pos += (*pos) + 1; 1925 pos += (*pos) + 1;
1926 *pos++ = WLAN_EID_HT_CAPABILITY; 1926 *pos++ = WLAN_EID_HT_CAPABILITY;
1927 *pos++ = sizeof(struct ieee80211_ht_capability); 1927 *pos++ = sizeof(struct ieee80211_ht_capability);
1928 iwl_set_ht_capab(NULL, (struct ieee80211_ht_capability *)pos, 1928 iwl4965_set_ht_capab(NULL, (struct ieee80211_ht_capability *)pos,
1929 use_wide_chan); 1929 use_wide_chan);
1930 len += 2 + sizeof(struct ieee80211_ht_capability); 1930 len += 2 + sizeof(struct ieee80211_ht_capability);
1931 } 1931 }
@@ -1939,15 +1939,15 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1939 * QoS support 1939 * QoS support
1940*/ 1940*/
1941#ifdef CONFIG_IWL4965_QOS 1941#ifdef CONFIG_IWL4965_QOS
1942static int iwl_send_qos_params_command(struct iwl_priv *priv, 1942static int iwl4965_send_qos_params_command(struct iwl4965_priv *priv,
1943 struct iwl_qosparam_cmd *qos) 1943 struct iwl4965_qosparam_cmd *qos)
1944{ 1944{
1945 1945
1946 return iwl_send_cmd_pdu(priv, REPLY_QOS_PARAM, 1946 return iwl4965_send_cmd_pdu(priv, REPLY_QOS_PARAM,
1947 sizeof(struct iwl_qosparam_cmd), qos); 1947 sizeof(struct iwl4965_qosparam_cmd), qos);
1948} 1948}
1949 1949
1950static void iwl_reset_qos(struct iwl_priv *priv) 1950static void iwl4965_reset_qos(struct iwl4965_priv *priv)
1951{ 1951{
1952 u16 cw_min = 15; 1952 u16 cw_min = 15;
1953 u16 cw_max = 1023; 1953 u16 cw_max = 1023;
@@ -2034,7 +2034,7 @@ static void iwl_reset_qos(struct iwl_priv *priv)
2034 spin_unlock_irqrestore(&priv->lock, flags); 2034 spin_unlock_irqrestore(&priv->lock, flags);
2035} 2035}
2036 2036
2037static void iwl_activate_qos(struct iwl_priv *priv, u8 force) 2037static void iwl4965_activate_qos(struct iwl4965_priv *priv, u8 force)
2038{ 2038{
2039 unsigned long flags; 2039 unsigned long flags;
2040 2040
@@ -2062,12 +2062,12 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force)
2062 2062
2063 spin_unlock_irqrestore(&priv->lock, flags); 2063 spin_unlock_irqrestore(&priv->lock, flags);
2064 2064
2065 if (force || iwl_is_associated(priv)) { 2065 if (force || iwl4965_is_associated(priv)) {
2066 IWL_DEBUG_QOS("send QoS cmd with Qos active=%d FLAGS=0x%X\n", 2066 IWL_DEBUG_QOS("send QoS cmd with Qos active=%d FLAGS=0x%X\n",
2067 priv->qos_data.qos_active, 2067 priv->qos_data.qos_active,
2068 priv->qos_data.def_qos_parm.qos_flags); 2068 priv->qos_data.def_qos_parm.qos_flags);
2069 2069
2070 iwl_send_qos_params_command(priv, 2070 iwl4965_send_qos_params_command(priv,
2071 &(priv->qos_data.def_qos_parm)); 2071 &(priv->qos_data.def_qos_parm));
2072 } 2072 }
2073} 2073}
@@ -2090,7 +2090,7 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force)
2090 2090
2091/* default power management (not Tx power) table values */ 2091/* default power management (not Tx power) table values */
2092/* for tim 0-10 */ 2092/* for tim 0-10 */
2093static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = { 2093static struct iwl4965_power_vec_entry range_0[IWL_POWER_AC] = {
2094 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 2094 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
2095 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, 2095 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0},
2096 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 7)}, 0}, 2096 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 7)}, 0},
@@ -2100,7 +2100,7 @@ static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = {
2100}; 2100};
2101 2101
2102/* for tim > 10 */ 2102/* for tim > 10 */
2103static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = { 2103static struct iwl4965_power_vec_entry range_1[IWL_POWER_AC] = {
2104 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 2104 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
2105 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), 2105 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500),
2106 SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, 2106 SLP_VEC(1, 2, 3, 4, 0xFF)}, 0},
@@ -2113,11 +2113,11 @@ static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = {
2113 SLP_VEC(4, 7, 10, 10, 0xFF)}, 0} 2113 SLP_VEC(4, 7, 10, 10, 0xFF)}, 0}
2114}; 2114};
2115 2115
2116int iwl_power_init_handle(struct iwl_priv *priv) 2116int iwl4965_power_init_handle(struct iwl4965_priv *priv)
2117{ 2117{
2118 int rc = 0, i; 2118 int rc = 0, i;
2119 struct iwl_power_mgr *pow_data; 2119 struct iwl4965_power_mgr *pow_data;
2120 int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_AC; 2120 int size = sizeof(struct iwl4965_power_vec_entry) * IWL_POWER_AC;
2121 u16 pci_pm; 2121 u16 pci_pm;
2122 2122
2123 IWL_DEBUG_POWER("Initialize power \n"); 2123 IWL_DEBUG_POWER("Initialize power \n");
@@ -2136,7 +2136,7 @@ int iwl_power_init_handle(struct iwl_priv *priv)
2136 if (rc != 0) 2136 if (rc != 0)
2137 return 0; 2137 return 0;
2138 else { 2138 else {
2139 struct iwl_powertable_cmd *cmd; 2139 struct iwl4965_powertable_cmd *cmd;
2140 2140
2141 IWL_DEBUG_POWER("adjust power command flags\n"); 2141 IWL_DEBUG_POWER("adjust power command flags\n");
2142 2142
@@ -2152,15 +2152,15 @@ int iwl_power_init_handle(struct iwl_priv *priv)
2152 return rc; 2152 return rc;
2153} 2153}
2154 2154
2155static int iwl_update_power_cmd(struct iwl_priv *priv, 2155static int iwl4965_update_power_cmd(struct iwl4965_priv *priv,
2156 struct iwl_powertable_cmd *cmd, u32 mode) 2156 struct iwl4965_powertable_cmd *cmd, u32 mode)
2157{ 2157{
2158 int rc = 0, i; 2158 int rc = 0, i;
2159 u8 skip; 2159 u8 skip;
2160 u32 max_sleep = 0; 2160 u32 max_sleep = 0;
2161 struct iwl_power_vec_entry *range; 2161 struct iwl4965_power_vec_entry *range;
2162 u8 period = 0; 2162 u8 period = 0;
2163 struct iwl_power_mgr *pow_data; 2163 struct iwl4965_power_mgr *pow_data;
2164 2164
2165 if (mode > IWL_POWER_INDEX_5) { 2165 if (mode > IWL_POWER_INDEX_5) {
2166 IWL_DEBUG_POWER("Error invalid power mode \n"); 2166 IWL_DEBUG_POWER("Error invalid power mode \n");
@@ -2173,7 +2173,7 @@ static int iwl_update_power_cmd(struct iwl_priv *priv,
2173 else 2173 else
2174 range = &pow_data->pwr_range_1[1]; 2174 range = &pow_data->pwr_range_1[1];
2175 2175
2176 memcpy(cmd, &range[mode].cmd, sizeof(struct iwl_powertable_cmd)); 2176 memcpy(cmd, &range[mode].cmd, sizeof(struct iwl4965_powertable_cmd));
2177 2177
2178#ifdef IWL_MAC80211_DISABLE 2178#ifdef IWL_MAC80211_DISABLE
2179 if (priv->assoc_network != NULL) { 2179 if (priv->assoc_network != NULL) {
@@ -2216,11 +2216,11 @@ static int iwl_update_power_cmd(struct iwl_priv *priv,
2216 return rc; 2216 return rc;
2217} 2217}
2218 2218
2219static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode) 2219static int iwl4965_send_power_mode(struct iwl4965_priv *priv, u32 mode)
2220{ 2220{
2221 u32 final_mode = mode; 2221 u32 final_mode = mode;
2222 int rc; 2222 int rc;
2223 struct iwl_powertable_cmd cmd; 2223 struct iwl4965_powertable_cmd cmd;
2224 2224
2225 /* If on battery, set to 3, 2225 /* If on battery, set to 3,
2226 * if plugged into AC power, set to CAM ("continuously aware mode"), 2226 * if plugged into AC power, set to CAM ("continuously aware mode"),
@@ -2239,9 +2239,9 @@ static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode)
2239 2239
2240 cmd.keep_alive_beacons = 0; 2240 cmd.keep_alive_beacons = 0;
2241 2241
2242 iwl_update_power_cmd(priv, &cmd, final_mode); 2242 iwl4965_update_power_cmd(priv, &cmd, final_mode);
2243 2243
2244 rc = iwl_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd); 2244 rc = iwl4965_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd);
2245 2245
2246 if (final_mode == IWL_POWER_MODE_CAM) 2246 if (final_mode == IWL_POWER_MODE_CAM)
2247 clear_bit(STATUS_POWER_PMI, &priv->status); 2247 clear_bit(STATUS_POWER_PMI, &priv->status);
@@ -2251,7 +2251,7 @@ static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode)
2251 return rc; 2251 return rc;
2252} 2252}
2253 2253
2254int iwl_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) 2254int iwl4965_is_network_packet(struct iwl4965_priv *priv, struct ieee80211_hdr *header)
2255{ 2255{
2256 /* Filter incoming packets to determine if they are targeted toward 2256 /* Filter incoming packets to determine if they are targeted toward
2257 * this network, discarding packets coming from ourselves */ 2257 * this network, discarding packets coming from ourselves */
@@ -2281,7 +2281,7 @@ int iwl_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *header)
2281 2281
2282#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x 2282#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x
2283 2283
2284static const char *iwl_get_tx_fail_reason(u32 status) 2284static const char *iwl4965_get_tx_fail_reason(u32 status)
2285{ 2285{
2286 switch (status & TX_STATUS_MSK) { 2286 switch (status & TX_STATUS_MSK) {
2287 case TX_STATUS_SUCCESS: 2287 case TX_STATUS_SUCCESS:
@@ -2308,11 +2308,11 @@ static const char *iwl_get_tx_fail_reason(u32 status)
2308} 2308}
2309 2309
2310/** 2310/**
2311 * iwl_scan_cancel - Cancel any currently executing HW scan 2311 * iwl4965_scan_cancel - Cancel any currently executing HW scan
2312 * 2312 *
2313 * NOTE: priv->mutex is not required before calling this function 2313 * NOTE: priv->mutex is not required before calling this function
2314 */ 2314 */
2315static int iwl_scan_cancel(struct iwl_priv *priv) 2315static int iwl4965_scan_cancel(struct iwl4965_priv *priv)
2316{ 2316{
2317 if (!test_bit(STATUS_SCAN_HW, &priv->status)) { 2317 if (!test_bit(STATUS_SCAN_HW, &priv->status)) {
2318 clear_bit(STATUS_SCANNING, &priv->status); 2318 clear_bit(STATUS_SCANNING, &priv->status);
@@ -2335,17 +2335,17 @@ static int iwl_scan_cancel(struct iwl_priv *priv)
2335} 2335}
2336 2336
2337/** 2337/**
2338 * iwl_scan_cancel_timeout - Cancel any currently executing HW scan 2338 * iwl4965_scan_cancel_timeout - Cancel any currently executing HW scan
2339 * @ms: amount of time to wait (in milliseconds) for scan to abort 2339 * @ms: amount of time to wait (in milliseconds) for scan to abort
2340 * 2340 *
2341 * NOTE: priv->mutex must be held before calling this function 2341 * NOTE: priv->mutex must be held before calling this function
2342 */ 2342 */
2343static int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) 2343static int iwl4965_scan_cancel_timeout(struct iwl4965_priv *priv, unsigned long ms)
2344{ 2344{
2345 unsigned long now = jiffies; 2345 unsigned long now = jiffies;
2346 int ret; 2346 int ret;
2347 2347
2348 ret = iwl_scan_cancel(priv); 2348 ret = iwl4965_scan_cancel(priv);
2349 if (ret && ms) { 2349 if (ret && ms) {
2350 mutex_unlock(&priv->mutex); 2350 mutex_unlock(&priv->mutex);
2351 while (!time_after(jiffies, now + msecs_to_jiffies(ms)) && 2351 while (!time_after(jiffies, now + msecs_to_jiffies(ms)) &&
@@ -2359,7 +2359,7 @@ static int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)
2359 return ret; 2359 return ret;
2360} 2360}
2361 2361
2362static void iwl_sequence_reset(struct iwl_priv *priv) 2362static void iwl4965_sequence_reset(struct iwl4965_priv *priv)
2363{ 2363{
2364 /* Reset ieee stats */ 2364 /* Reset ieee stats */
2365 2365
@@ -2370,13 +2370,13 @@ static void iwl_sequence_reset(struct iwl_priv *priv)
2370 priv->last_frag_num = -1; 2370 priv->last_frag_num = -1;
2371 priv->last_packet_time = 0; 2371 priv->last_packet_time = 0;
2372 2372
2373 iwl_scan_cancel(priv); 2373 iwl4965_scan_cancel(priv);
2374} 2374}
2375 2375
2376#define MAX_UCODE_BEACON_INTERVAL 4096 2376#define MAX_UCODE_BEACON_INTERVAL 4096
2377#define INTEL_CONN_LISTEN_INTERVAL __constant_cpu_to_le16(0xA) 2377#define INTEL_CONN_LISTEN_INTERVAL __constant_cpu_to_le16(0xA)
2378 2378
2379static __le16 iwl_adjust_beacon_interval(u16 beacon_val) 2379static __le16 iwl4965_adjust_beacon_interval(u16 beacon_val)
2380{ 2380{
2381 u16 new_val = 0; 2381 u16 new_val = 0;
2382 u16 beacon_factor = 0; 2382 u16 beacon_factor = 0;
@@ -2389,7 +2389,7 @@ static __le16 iwl_adjust_beacon_interval(u16 beacon_val)
2389 return cpu_to_le16(new_val); 2389 return cpu_to_le16(new_val);
2390} 2390}
2391 2391
2392static void iwl_setup_rxon_timing(struct iwl_priv *priv) 2392static void iwl4965_setup_rxon_timing(struct iwl4965_priv *priv)
2393{ 2393{
2394 u64 interval_tm_unit; 2394 u64 interval_tm_unit;
2395 u64 tsf, result; 2395 u64 tsf, result;
@@ -2419,14 +2419,14 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv)
2419 priv->rxon_timing.beacon_interval = 2419 priv->rxon_timing.beacon_interval =
2420 cpu_to_le16(beacon_int); 2420 cpu_to_le16(beacon_int);
2421 priv->rxon_timing.beacon_interval = 2421 priv->rxon_timing.beacon_interval =
2422 iwl_adjust_beacon_interval( 2422 iwl4965_adjust_beacon_interval(
2423 le16_to_cpu(priv->rxon_timing.beacon_interval)); 2423 le16_to_cpu(priv->rxon_timing.beacon_interval));
2424 } 2424 }
2425 2425
2426 priv->rxon_timing.atim_window = 0; 2426 priv->rxon_timing.atim_window = 0;
2427 } else { 2427 } else {
2428 priv->rxon_timing.beacon_interval = 2428 priv->rxon_timing.beacon_interval =
2429 iwl_adjust_beacon_interval(conf->beacon_int); 2429 iwl4965_adjust_beacon_interval(conf->beacon_int);
2430 /* TODO: we need to get atim_window from upper stack 2430 /* TODO: we need to get atim_window from upper stack
2431 * for now we set to 0 */ 2431 * for now we set to 0 */
2432 priv->rxon_timing.atim_window = 0; 2432 priv->rxon_timing.atim_window = 0;
@@ -2445,14 +2445,14 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv)
2445 le16_to_cpu(priv->rxon_timing.atim_window)); 2445 le16_to_cpu(priv->rxon_timing.atim_window));
2446} 2446}
2447 2447
2448static int iwl_scan_initiate(struct iwl_priv *priv) 2448static int iwl4965_scan_initiate(struct iwl4965_priv *priv)
2449{ 2449{
2450 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { 2450 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) {
2451 IWL_ERROR("APs don't scan.\n"); 2451 IWL_ERROR("APs don't scan.\n");
2452 return 0; 2452 return 0;
2453 } 2453 }
2454 2454
2455 if (!iwl_is_ready_rf(priv)) { 2455 if (!iwl4965_is_ready_rf(priv)) {
2456 IWL_DEBUG_SCAN("Aborting scan due to not ready.\n"); 2456 IWL_DEBUG_SCAN("Aborting scan due to not ready.\n");
2457 return -EIO; 2457 return -EIO;
2458 } 2458 }
@@ -2479,9 +2479,9 @@ static int iwl_scan_initiate(struct iwl_priv *priv)
2479 return 0; 2479 return 0;
2480} 2480}
2481 2481
2482static int iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) 2482static int iwl4965_set_rxon_hwcrypto(struct iwl4965_priv *priv, int hw_decrypt)
2483{ 2483{
2484 struct iwl_rxon_cmd *rxon = &priv->staging_rxon; 2484 struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon;
2485 2485
2486 if (hw_decrypt) 2486 if (hw_decrypt)
2487 rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; 2487 rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK;
@@ -2491,7 +2491,7 @@ static int iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt)
2491 return 0; 2491 return 0;
2492} 2492}
2493 2493
2494static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode) 2494static void iwl4965_set_flags_for_phymode(struct iwl4965_priv *priv, u8 phymode)
2495{ 2495{
2496 if (phymode == MODE_IEEE80211A) { 2496 if (phymode == MODE_IEEE80211A) {
2497 priv->staging_rxon.flags &= 2497 priv->staging_rxon.flags &=
@@ -2499,7 +2499,7 @@ static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode)
2499 | RXON_FLG_CCK_MSK); 2499 | RXON_FLG_CCK_MSK);
2500 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; 2500 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
2501 } else { 2501 } else {
2502 /* Copied from iwl_bg_post_associate() */ 2502 /* Copied from iwl4965_bg_post_associate() */
2503 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) 2503 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
2504 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; 2504 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
2505 else 2505 else
@@ -2517,9 +2517,9 @@ static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode)
2517/* 2517/*
2518 * initialize rxon structure with default values from eeprom 2518 * initialize rxon structure with default values from eeprom
2519 */ 2519 */
2520static void iwl_connection_init_rx_config(struct iwl_priv *priv) 2520static void iwl4965_connection_init_rx_config(struct iwl4965_priv *priv)
2521{ 2521{
2522 const struct iwl_channel_info *ch_info; 2522 const struct iwl4965_channel_info *ch_info;
2523 2523
2524 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); 2524 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon));
2525 2525
@@ -2556,7 +2556,7 @@ static void iwl_connection_init_rx_config(struct iwl_priv *priv)
2556 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 2556 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
2557#endif 2557#endif
2558 2558
2559 ch_info = iwl_get_channel_info(priv, priv->phymode, 2559 ch_info = iwl4965_get_channel_info(priv, priv->phymode,
2560 le16_to_cpu(priv->staging_rxon.channel)); 2560 le16_to_cpu(priv->staging_rxon.channel));
2561 2561
2562 if (!ch_info) 2562 if (!ch_info)
@@ -2576,7 +2576,7 @@ static void iwl_connection_init_rx_config(struct iwl_priv *priv)
2576 else 2576 else
2577 priv->phymode = MODE_IEEE80211G; 2577 priv->phymode = MODE_IEEE80211G;
2578 2578
2579 iwl_set_flags_for_phymode(priv, priv->phymode); 2579 iwl4965_set_flags_for_phymode(priv, priv->phymode);
2580 2580
2581 priv->staging_rxon.ofdm_basic_rates = 2581 priv->staging_rxon.ofdm_basic_rates =
2582 (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; 2582 (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
@@ -2592,15 +2592,15 @@ static void iwl_connection_init_rx_config(struct iwl_priv *priv)
2592 iwl4965_set_rxon_chain(priv); 2592 iwl4965_set_rxon_chain(priv);
2593} 2593}
2594 2594
2595static int iwl_set_mode(struct iwl_priv *priv, int mode) 2595static int iwl4965_set_mode(struct iwl4965_priv *priv, int mode)
2596{ 2596{
2597 if (!iwl_is_ready_rf(priv)) 2597 if (!iwl4965_is_ready_rf(priv))
2598 return -EAGAIN; 2598 return -EAGAIN;
2599 2599
2600 if (mode == IEEE80211_IF_TYPE_IBSS) { 2600 if (mode == IEEE80211_IF_TYPE_IBSS) {
2601 const struct iwl_channel_info *ch_info; 2601 const struct iwl4965_channel_info *ch_info;
2602 2602
2603 ch_info = iwl_get_channel_info(priv, 2603 ch_info = iwl4965_get_channel_info(priv,
2604 priv->phymode, 2604 priv->phymode,
2605 le16_to_cpu(priv->staging_rxon.channel)); 2605 le16_to_cpu(priv->staging_rxon.channel));
2606 2606
@@ -2612,7 +2612,7 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode)
2612 } 2612 }
2613 2613
2614 cancel_delayed_work(&priv->scan_check); 2614 cancel_delayed_work(&priv->scan_check);
2615 if (iwl_scan_cancel_timeout(priv, 100)) { 2615 if (iwl4965_scan_cancel_timeout(priv, 100)) {
2616 IWL_WARNING("Aborted scan still in progress after 100ms\n"); 2616 IWL_WARNING("Aborted scan still in progress after 100ms\n");
2617 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); 2617 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n");
2618 return -EAGAIN; 2618 return -EAGAIN;
@@ -2620,23 +2620,23 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode)
2620 2620
2621 priv->iw_mode = mode; 2621 priv->iw_mode = mode;
2622 2622
2623 iwl_connection_init_rx_config(priv); 2623 iwl4965_connection_init_rx_config(priv);
2624 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); 2624 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
2625 2625
2626 iwl_clear_stations_table(priv); 2626 iwl4965_clear_stations_table(priv);
2627 2627
2628 iwl_commit_rxon(priv); 2628 iwl4965_commit_rxon(priv);
2629 2629
2630 return 0; 2630 return 0;
2631} 2631}
2632 2632
2633static void iwl_build_tx_cmd_hwcrypto(struct iwl_priv *priv, 2633static void iwl4965_build_tx_cmd_hwcrypto(struct iwl4965_priv *priv,
2634 struct ieee80211_tx_control *ctl, 2634 struct ieee80211_tx_control *ctl,
2635 struct iwl_cmd *cmd, 2635 struct iwl4965_cmd *cmd,
2636 struct sk_buff *skb_frag, 2636 struct sk_buff *skb_frag,
2637 int last_frag) 2637 int last_frag)
2638{ 2638{
2639 struct iwl_hw_key *keyinfo = &priv->stations[ctl->key_idx].keyinfo; 2639 struct iwl4965_hw_key *keyinfo = &priv->stations[ctl->key_idx].keyinfo;
2640 2640
2641 switch (keyinfo->alg) { 2641 switch (keyinfo->alg) {
2642 case ALG_CCMP: 2642 case ALG_CCMP:
@@ -2679,8 +2679,8 @@ static void iwl_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
2679/* 2679/*
2680 * handle build REPLY_TX command notification. 2680 * handle build REPLY_TX command notification.
2681 */ 2681 */
2682static void iwl_build_tx_cmd_basic(struct iwl_priv *priv, 2682static void iwl4965_build_tx_cmd_basic(struct iwl4965_priv *priv,
2683 struct iwl_cmd *cmd, 2683 struct iwl4965_cmd *cmd,
2684 struct ieee80211_tx_control *ctrl, 2684 struct ieee80211_tx_control *ctrl,
2685 struct ieee80211_hdr *hdr, 2685 struct ieee80211_hdr *hdr,
2686 int is_unicast, u8 std_id) 2686 int is_unicast, u8 std_id)
@@ -2739,7 +2739,7 @@ static void iwl_build_tx_cmd_basic(struct iwl_priv *priv,
2739 cmd->cmd.tx.next_frame_len = 0; 2739 cmd->cmd.tx.next_frame_len = 0;
2740} 2740}
2741 2741
2742static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) 2742static int iwl4965_get_sta_id(struct iwl4965_priv *priv, struct ieee80211_hdr *hdr)
2743{ 2743{
2744 int sta_id; 2744 int sta_id;
2745 u16 fc = le16_to_cpu(hdr->frame_control); 2745 u16 fc = le16_to_cpu(hdr->frame_control);
@@ -2760,7 +2760,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
2760 2760
2761 /* If we are an AP, then find the station, or use BCAST */ 2761 /* If we are an AP, then find the station, or use BCAST */
2762 case IEEE80211_IF_TYPE_AP: 2762 case IEEE80211_IF_TYPE_AP:
2763 sta_id = iwl_hw_find_station(priv, hdr->addr1); 2763 sta_id = iwl4965_hw_find_station(priv, hdr->addr1);
2764 if (sta_id != IWL_INVALID_STATION) 2764 if (sta_id != IWL_INVALID_STATION)
2765 return sta_id; 2765 return sta_id;
2766 return priv->hw_setting.bcast_sta_id; 2766 return priv->hw_setting.bcast_sta_id;
@@ -2768,11 +2768,11 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
2768 /* If this frame is part of a IBSS network, then we use the 2768 /* If this frame is part of a IBSS network, then we use the
2769 * target specific station id */ 2769 * target specific station id */
2770 case IEEE80211_IF_TYPE_IBSS: 2770 case IEEE80211_IF_TYPE_IBSS:
2771 sta_id = iwl_hw_find_station(priv, hdr->addr1); 2771 sta_id = iwl4965_hw_find_station(priv, hdr->addr1);
2772 if (sta_id != IWL_INVALID_STATION) 2772 if (sta_id != IWL_INVALID_STATION)
2773 return sta_id; 2773 return sta_id;
2774 2774
2775 sta_id = iwl_add_station(priv, hdr->addr1, 0, CMD_ASYNC); 2775 sta_id = iwl4965_add_station_flags(priv, hdr->addr1, 0, CMD_ASYNC);
2776 2776
2777 if (sta_id != IWL_INVALID_STATION) 2777 if (sta_id != IWL_INVALID_STATION)
2778 return sta_id; 2778 return sta_id;
@@ -2780,7 +2780,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
2780 IWL_DEBUG_DROP("Station %s not in station map. " 2780 IWL_DEBUG_DROP("Station %s not in station map. "
2781 "Defaulting to broadcast...\n", 2781 "Defaulting to broadcast...\n",
2782 print_mac(mac, hdr->addr1)); 2782 print_mac(mac, hdr->addr1));
2783 iwl_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); 2783 iwl4965_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr));
2784 return priv->hw_setting.bcast_sta_id; 2784 return priv->hw_setting.bcast_sta_id;
2785 2785
2786 default: 2786 default:
@@ -2792,18 +2792,18 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
2792/* 2792/*
2793 * start REPLY_TX command process 2793 * start REPLY_TX command process
2794 */ 2794 */
2795static int iwl_tx_skb(struct iwl_priv *priv, 2795static int iwl4965_tx_skb(struct iwl4965_priv *priv,
2796 struct sk_buff *skb, struct ieee80211_tx_control *ctl) 2796 struct sk_buff *skb, struct ieee80211_tx_control *ctl)
2797{ 2797{
2798 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 2798 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2799 struct iwl_tfd_frame *tfd; 2799 struct iwl4965_tfd_frame *tfd;
2800 u32 *control_flags; 2800 u32 *control_flags;
2801 int txq_id = ctl->queue; 2801 int txq_id = ctl->queue;
2802 struct iwl_tx_queue *txq = NULL; 2802 struct iwl4965_tx_queue *txq = NULL;
2803 struct iwl_queue *q = NULL; 2803 struct iwl4965_queue *q = NULL;
2804 dma_addr_t phys_addr; 2804 dma_addr_t phys_addr;
2805 dma_addr_t txcmd_phys; 2805 dma_addr_t txcmd_phys;
2806 struct iwl_cmd *out_cmd = NULL; 2806 struct iwl4965_cmd *out_cmd = NULL;
2807 u16 len, idx, len_org; 2807 u16 len, idx, len_org;
2808 u8 id, hdr_len, unicast; 2808 u8 id, hdr_len, unicast;
2809 u8 sta_id; 2809 u8 sta_id;
@@ -2815,7 +2815,7 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2815 int rc; 2815 int rc;
2816 2816
2817 spin_lock_irqsave(&priv->lock, flags); 2817 spin_lock_irqsave(&priv->lock, flags);
2818 if (iwl_is_rfkill(priv)) { 2818 if (iwl4965_is_rfkill(priv)) {
2819 IWL_DEBUG_DROP("Dropping - RF KILL\n"); 2819 IWL_DEBUG_DROP("Dropping - RF KILL\n");
2820 goto drop_unlock; 2820 goto drop_unlock;
2821 } 2821 }
@@ -2844,16 +2844,16 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2844 IWL_DEBUG_TX("Sending REASSOC frame\n"); 2844 IWL_DEBUG_TX("Sending REASSOC frame\n");
2845#endif 2845#endif
2846 2846
2847 if (!iwl_is_associated(priv) && 2847 if (!iwl4965_is_associated(priv) &&
2848 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { 2848 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) {
2849 IWL_DEBUG_DROP("Dropping - !iwl_is_associated\n"); 2849 IWL_DEBUG_DROP("Dropping - !iwl4965_is_associated\n");
2850 goto drop_unlock; 2850 goto drop_unlock;
2851 } 2851 }
2852 2852
2853 spin_unlock_irqrestore(&priv->lock, flags); 2853 spin_unlock_irqrestore(&priv->lock, flags);
2854 2854
2855 hdr_len = ieee80211_get_hdrlen(fc); 2855 hdr_len = ieee80211_get_hdrlen(fc);
2856 sta_id = iwl_get_sta_id(priv, hdr); 2856 sta_id = iwl4965_get_sta_id(priv, hdr);
2857 if (sta_id == IWL_INVALID_STATION) { 2857 if (sta_id == IWL_INVALID_STATION) {
2858 DECLARE_MAC_BUF(mac); 2858 DECLARE_MAC_BUF(mac);
2859 2859
@@ -2891,7 +2891,7 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2891 control_flags = (u32 *) tfd; 2891 control_flags = (u32 *) tfd;
2892 idx = get_cmd_index(q, q->write_ptr, 0); 2892 idx = get_cmd_index(q, q->write_ptr, 0);
2893 2893
2894 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); 2894 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl4965_tx_info));
2895 txq->txb[q->write_ptr].skb[0] = skb; 2895 txq->txb[q->write_ptr].skb[0] = skb;
2896 memcpy(&(txq->txb[q->write_ptr].status.control), 2896 memcpy(&(txq->txb[q->write_ptr].status.control),
2897 ctl, sizeof(struct ieee80211_tx_control)); 2897 ctl, sizeof(struct ieee80211_tx_control));
@@ -2906,7 +2906,7 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2906 2906
2907 /* hdr = (struct ieee80211_hdr *)out_cmd->cmd.tx.hdr; */ 2907 /* hdr = (struct ieee80211_hdr *)out_cmd->cmd.tx.hdr; */
2908 len = priv->hw_setting.tx_cmd_len + 2908 len = priv->hw_setting.tx_cmd_len +
2909 sizeof(struct iwl_cmd_header) + hdr_len; 2909 sizeof(struct iwl4965_cmd_header) + hdr_len;
2910 2910
2911 len_org = len; 2911 len_org = len;
2912 len = (len + 3) & ~3; 2912 len = (len + 3) & ~3;
@@ -2916,20 +2916,20 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2916 else 2916 else
2917 len_org = 0; 2917 len_org = 0;
2918 2918
2919 txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl_cmd) * idx + 2919 txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl4965_cmd) * idx +
2920 offsetof(struct iwl_cmd, hdr); 2920 offsetof(struct iwl4965_cmd, hdr);
2921 2921
2922 iwl_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); 2922 iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len);
2923 2923
2924 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) 2924 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT))
2925 iwl_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0); 2925 iwl4965_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0);
2926 2926
2927 /* 802.11 null functions have no payload... */ 2927 /* 802.11 null functions have no payload... */
2928 len = skb->len - hdr_len; 2928 len = skb->len - hdr_len;
2929 if (len) { 2929 if (len) {
2930 phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, 2930 phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len,
2931 len, PCI_DMA_TODEVICE); 2931 len, PCI_DMA_TODEVICE);
2932 iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len); 2932 iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len);
2933 } 2933 }
2934 2934
2935 if (len_org) 2935 if (len_org)
@@ -2939,10 +2939,10 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2939 out_cmd->cmd.tx.len = cpu_to_le16(len); 2939 out_cmd->cmd.tx.len = cpu_to_le16(len);
2940 2940
2941 /* TODO need this for burst mode later on */ 2941 /* TODO need this for burst mode later on */
2942 iwl_build_tx_cmd_basic(priv, out_cmd, ctl, hdr, unicast, sta_id); 2942 iwl4965_build_tx_cmd_basic(priv, out_cmd, ctl, hdr, unicast, sta_id);
2943 2943
2944 /* set is_hcca to 0; it probably will never be implemented */ 2944 /* set is_hcca to 0; it probably will never be implemented */
2945 iwl_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0); 2945 iwl4965_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0);
2946 2946
2947 iwl4965_tx_cmd(priv, out_cmd, sta_id, txcmd_phys, 2947 iwl4965_tx_cmd(priv, out_cmd, sta_id, txcmd_phys,
2948 hdr, hdr_len, ctl, NULL); 2948 hdr, hdr_len, ctl, NULL);
@@ -2958,27 +2958,27 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2958 txq->need_update = 0; 2958 txq->need_update = 0;
2959 } 2959 }
2960 2960
2961 iwl_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload, 2961 iwl4965_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload,
2962 sizeof(out_cmd->cmd.tx)); 2962 sizeof(out_cmd->cmd.tx));
2963 2963
2964 iwl_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, 2964 iwl4965_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr,
2965 ieee80211_get_hdrlen(fc)); 2965 ieee80211_get_hdrlen(fc));
2966 2966
2967 iwl4965_tx_queue_update_wr_ptr(priv, txq, len); 2967 iwl4965_tx_queue_update_wr_ptr(priv, txq, len);
2968 2968
2969 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 2969 q->write_ptr = iwl4965_queue_inc_wrap(q->write_ptr, q->n_bd);
2970 rc = iwl_tx_queue_update_write_ptr(priv, txq); 2970 rc = iwl4965_tx_queue_update_write_ptr(priv, txq);
2971 spin_unlock_irqrestore(&priv->lock, flags); 2971 spin_unlock_irqrestore(&priv->lock, flags);
2972 2972
2973 if (rc) 2973 if (rc)
2974 return rc; 2974 return rc;
2975 2975
2976 if ((iwl_queue_space(q) < q->high_mark) 2976 if ((iwl4965_queue_space(q) < q->high_mark)
2977 && priv->mac80211_registered) { 2977 && priv->mac80211_registered) {
2978 if (wait_write_ptr) { 2978 if (wait_write_ptr) {
2979 spin_lock_irqsave(&priv->lock, flags); 2979 spin_lock_irqsave(&priv->lock, flags);
2980 txq->need_update = 1; 2980 txq->need_update = 1;
2981 iwl_tx_queue_update_write_ptr(priv, txq); 2981 iwl4965_tx_queue_update_write_ptr(priv, txq);
2982 spin_unlock_irqrestore(&priv->lock, flags); 2982 spin_unlock_irqrestore(&priv->lock, flags);
2983 } 2983 }
2984 2984
@@ -2993,13 +2993,13 @@ drop:
2993 return -1; 2993 return -1;
2994} 2994}
2995 2995
2996static void iwl_set_rate(struct iwl_priv *priv) 2996static void iwl4965_set_rate(struct iwl4965_priv *priv)
2997{ 2997{
2998 const struct ieee80211_hw_mode *hw = NULL; 2998 const struct ieee80211_hw_mode *hw = NULL;
2999 struct ieee80211_rate *rate; 2999 struct ieee80211_rate *rate;
3000 int i; 3000 int i;
3001 3001
3002 hw = iwl_get_hw_mode(priv, priv->phymode); 3002 hw = iwl4965_get_hw_mode(priv, priv->phymode);
3003 if (!hw) { 3003 if (!hw) {
3004 IWL_ERROR("Failed to set rate: unable to get hw mode\n"); 3004 IWL_ERROR("Failed to set rate: unable to get hw mode\n");
3005 return; 3005 return;
@@ -3017,7 +3017,7 @@ static void iwl_set_rate(struct iwl_priv *priv)
3017 if ((rate->val < IWL_RATE_COUNT) && 3017 if ((rate->val < IWL_RATE_COUNT) &&
3018 (rate->flags & IEEE80211_RATE_SUPPORTED)) { 3018 (rate->flags & IEEE80211_RATE_SUPPORTED)) {
3019 IWL_DEBUG_RATE("Adding rate index %d (plcp %d)%s\n", 3019 IWL_DEBUG_RATE("Adding rate index %d (plcp %d)%s\n",
3020 rate->val, iwl_rates[rate->val].plcp, 3020 rate->val, iwl4965_rates[rate->val].plcp,
3021 (rate->flags & IEEE80211_RATE_BASIC) ? 3021 (rate->flags & IEEE80211_RATE_BASIC) ?
3022 "*" : ""); 3022 "*" : "");
3023 priv->active_rate |= (1 << rate->val); 3023 priv->active_rate |= (1 << rate->val);
@@ -3025,7 +3025,7 @@ static void iwl_set_rate(struct iwl_priv *priv)
3025 priv->active_rate_basic |= (1 << rate->val); 3025 priv->active_rate_basic |= (1 << rate->val);
3026 } else 3026 } else
3027 IWL_DEBUG_RATE("Not adding rate %d (plcp %d)\n", 3027 IWL_DEBUG_RATE("Not adding rate %d (plcp %d)\n",
3028 rate->val, iwl_rates[rate->val].plcp); 3028 rate->val, iwl4965_rates[rate->val].plcp);
3029 } 3029 }
3030 3030
3031 IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n", 3031 IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n",
@@ -3054,7 +3054,7 @@ static void iwl_set_rate(struct iwl_priv *priv)
3054 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; 3054 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
3055} 3055}
3056 3056
3057static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio) 3057static void iwl4965_radio_kill_sw(struct iwl4965_priv *priv, int disable_radio)
3058{ 3058{
3059 unsigned long flags; 3059 unsigned long flags;
3060 3060
@@ -3065,21 +3065,21 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
3065 disable_radio ? "OFF" : "ON"); 3065 disable_radio ? "OFF" : "ON");
3066 3066
3067 if (disable_radio) { 3067 if (disable_radio) {
3068 iwl_scan_cancel(priv); 3068 iwl4965_scan_cancel(priv);
3069 /* FIXME: This is a workaround for AP */ 3069 /* FIXME: This is a workaround for AP */
3070 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { 3070 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) {
3071 spin_lock_irqsave(&priv->lock, flags); 3071 spin_lock_irqsave(&priv->lock, flags);
3072 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, 3072 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_SET,
3073 CSR_UCODE_SW_BIT_RFKILL); 3073 CSR_UCODE_SW_BIT_RFKILL);
3074 spin_unlock_irqrestore(&priv->lock, flags); 3074 spin_unlock_irqrestore(&priv->lock, flags);
3075 iwl_send_card_state(priv, CARD_STATE_CMD_DISABLE, 0); 3075 iwl4965_send_card_state(priv, CARD_STATE_CMD_DISABLE, 0);
3076 set_bit(STATUS_RF_KILL_SW, &priv->status); 3076 set_bit(STATUS_RF_KILL_SW, &priv->status);
3077 } 3077 }
3078 return; 3078 return;
3079 } 3079 }
3080 3080
3081 spin_lock_irqsave(&priv->lock, flags); 3081 spin_lock_irqsave(&priv->lock, flags);
3082 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 3082 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
3083 3083
3084 clear_bit(STATUS_RF_KILL_SW, &priv->status); 3084 clear_bit(STATUS_RF_KILL_SW, &priv->status);
3085 spin_unlock_irqrestore(&priv->lock, flags); 3085 spin_unlock_irqrestore(&priv->lock, flags);
@@ -3088,9 +3088,9 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
3088 msleep(10); 3088 msleep(10);
3089 3089
3090 spin_lock_irqsave(&priv->lock, flags); 3090 spin_lock_irqsave(&priv->lock, flags);
3091 iwl_read32(priv, CSR_UCODE_DRV_GP1); 3091 iwl4965_read32(priv, CSR_UCODE_DRV_GP1);
3092 if (!iwl_grab_nic_access(priv)) 3092 if (!iwl4965_grab_nic_access(priv))
3093 iwl_release_nic_access(priv); 3093 iwl4965_release_nic_access(priv);
3094 spin_unlock_irqrestore(&priv->lock, flags); 3094 spin_unlock_irqrestore(&priv->lock, flags);
3095 3095
3096 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { 3096 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
@@ -3103,7 +3103,7 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
3103 return; 3103 return;
3104} 3104}
3105 3105
3106void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, 3106void iwl4965_set_decrypted_flag(struct iwl4965_priv *priv, struct sk_buff *skb,
3107 u32 decrypt_res, struct ieee80211_rx_status *stats) 3107 u32 decrypt_res, struct ieee80211_rx_status *stats)
3108{ 3108{
3109 u16 fc = 3109 u16 fc =
@@ -3135,13 +3135,13 @@ void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb,
3135 } 3135 }
3136} 3136}
3137 3137
3138void iwl_handle_data_packet_monitor(struct iwl_priv *priv, 3138void iwl4965_handle_data_packet_monitor(struct iwl4965_priv *priv,
3139 struct iwl_rx_mem_buffer *rxb, 3139 struct iwl4965_rx_mem_buffer *rxb,
3140 void *data, short len, 3140 void *data, short len,
3141 struct ieee80211_rx_status *stats, 3141 struct ieee80211_rx_status *stats,
3142 u16 phy_flags) 3142 u16 phy_flags)
3143{ 3143{
3144 struct iwl_rt_rx_hdr *iwl_rt; 3144 struct iwl4965_rt_rx_hdr *iwl4965_rt;
3145 3145
3146 /* First cache any information we need before we overwrite 3146 /* First cache any information we need before we overwrite
3147 * the information provided in the skb from the hardware */ 3147 * the information provided in the skb from the hardware */
@@ -3152,26 +3152,26 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv,
3152 __le16 phy_flags_hw = cpu_to_le16(phy_flags); 3152 __le16 phy_flags_hw = cpu_to_le16(phy_flags);
3153 3153
3154 /* We received data from the HW, so stop the watchdog */ 3154 /* We received data from the HW, so stop the watchdog */
3155 if (len > IWL_RX_BUF_SIZE - sizeof(*iwl_rt)) { 3155 if (len > IWL_RX_BUF_SIZE - sizeof(*iwl4965_rt)) {
3156 IWL_DEBUG_DROP("Dropping too large packet in monitor\n"); 3156 IWL_DEBUG_DROP("Dropping too large packet in monitor\n");
3157 return; 3157 return;
3158 } 3158 }
3159 3159
3160 /* copy the frame data to write after where the radiotap header goes */ 3160 /* copy the frame data to write after where the radiotap header goes */
3161 iwl_rt = (void *)rxb->skb->data; 3161 iwl4965_rt = (void *)rxb->skb->data;
3162 memmove(iwl_rt->payload, data, len); 3162 memmove(iwl4965_rt->payload, data, len);
3163 3163
3164 iwl_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; 3164 iwl4965_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION;
3165 iwl_rt->rt_hdr.it_pad = 0; /* always good to zero */ 3165 iwl4965_rt->rt_hdr.it_pad = 0; /* always good to zero */
3166 3166
3167 /* total header + data */ 3167 /* total header + data */
3168 iwl_rt->rt_hdr.it_len = cpu_to_le16(sizeof(*iwl_rt)); 3168 iwl4965_rt->rt_hdr.it_len = cpu_to_le16(sizeof(*iwl4965_rt));
3169 3169
3170 /* Set the size of the skb to the size of the frame */ 3170 /* Set the size of the skb to the size of the frame */
3171 skb_put(rxb->skb, sizeof(*iwl_rt) + len); 3171 skb_put(rxb->skb, sizeof(*iwl4965_rt) + len);
3172 3172
3173 /* Big bitfield of all the fields we provide in radiotap */ 3173 /* Big bitfield of all the fields we provide in radiotap */
3174 iwl_rt->rt_hdr.it_present = 3174 iwl4965_rt->rt_hdr.it_present =
3175 cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) | 3175 cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) |
3176 (1 << IEEE80211_RADIOTAP_FLAGS) | 3176 (1 << IEEE80211_RADIOTAP_FLAGS) |
3177 (1 << IEEE80211_RADIOTAP_RATE) | 3177 (1 << IEEE80211_RADIOTAP_RATE) |
@@ -3181,39 +3181,39 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv,
3181 (1 << IEEE80211_RADIOTAP_ANTENNA)); 3181 (1 << IEEE80211_RADIOTAP_ANTENNA));
3182 3182
3183 /* Zero the flags, we'll add to them as we go */ 3183 /* Zero the flags, we'll add to them as we go */
3184 iwl_rt->rt_flags = 0; 3184 iwl4965_rt->rt_flags = 0;
3185 3185
3186 iwl_rt->rt_tsf = cpu_to_le64(tsf); 3186 iwl4965_rt->rt_tsf = cpu_to_le64(tsf);
3187 3187
3188 /* Convert to dBm */ 3188 /* Convert to dBm */
3189 iwl_rt->rt_dbmsignal = signal; 3189 iwl4965_rt->rt_dbmsignal = signal;
3190 iwl_rt->rt_dbmnoise = noise; 3190 iwl4965_rt->rt_dbmnoise = noise;
3191 3191
3192 /* Convert the channel frequency and set the flags */ 3192 /* Convert the channel frequency and set the flags */
3193 iwl_rt->rt_channelMHz = cpu_to_le16(stats->freq); 3193 iwl4965_rt->rt_channelMHz = cpu_to_le16(stats->freq);
3194 if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK)) 3194 if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK))
3195 iwl_rt->rt_chbitmask = 3195 iwl4965_rt->rt_chbitmask =
3196 cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ)); 3196 cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ));
3197 else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK) 3197 else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK)
3198 iwl_rt->rt_chbitmask = 3198 iwl4965_rt->rt_chbitmask =
3199 cpu_to_le16((IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ)); 3199 cpu_to_le16((IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ));
3200 else /* 802.11g */ 3200 else /* 802.11g */
3201 iwl_rt->rt_chbitmask = 3201 iwl4965_rt->rt_chbitmask =
3202 cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ)); 3202 cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ));
3203 3203
3204 rate = iwl_rate_index_from_plcp(rate); 3204 rate = iwl4965_rate_index_from_plcp(rate);
3205 if (rate == -1) 3205 if (rate == -1)
3206 iwl_rt->rt_rate = 0; 3206 iwl4965_rt->rt_rate = 0;
3207 else 3207 else
3208 iwl_rt->rt_rate = iwl_rates[rate].ieee; 3208 iwl4965_rt->rt_rate = iwl4965_rates[rate].ieee;
3209 3209
3210 /* antenna number */ 3210 /* antenna number */
3211 iwl_rt->rt_antenna = 3211 iwl4965_rt->rt_antenna =
3212 le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; 3212 le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4;
3213 3213
3214 /* set the preamble flag if we have it */ 3214 /* set the preamble flag if we have it */
3215 if (phy_flags_hw & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) 3215 if (phy_flags_hw & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK)
3216 iwl_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; 3216 iwl4965_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
3217 3217
3218 IWL_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); 3218 IWL_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len);
3219 3219
@@ -3225,7 +3225,7 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv,
3225 3225
3226#define IWL_PACKET_RETRY_TIME HZ 3226#define IWL_PACKET_RETRY_TIME HZ
3227 3227
3228int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) 3228int iwl4965_is_duplicate_packet(struct iwl4965_priv *priv, struct ieee80211_hdr *header)
3229{ 3229{
3230 u16 sc = le16_to_cpu(header->seq_ctrl); 3230 u16 sc = le16_to_cpu(header->seq_ctrl);
3231 u16 seq = (sc & IEEE80211_SCTL_SEQ) >> 4; 3231 u16 seq = (sc & IEEE80211_SCTL_SEQ) >> 4;
@@ -3236,12 +3236,12 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header)
3236 switch (priv->iw_mode) { 3236 switch (priv->iw_mode) {
3237 case IEEE80211_IF_TYPE_IBSS:{ 3237 case IEEE80211_IF_TYPE_IBSS:{
3238 struct list_head *p; 3238 struct list_head *p;
3239 struct iwl_ibss_seq *entry = NULL; 3239 struct iwl4965_ibss_seq *entry = NULL;
3240 u8 *mac = header->addr2; 3240 u8 *mac = header->addr2;
3241 int index = mac[5] & (IWL_IBSS_MAC_HASH_SIZE - 1); 3241 int index = mac[5] & (IWL_IBSS_MAC_HASH_SIZE - 1);
3242 3242
3243 __list_for_each(p, &priv->ibss_mac_hash[index]) { 3243 __list_for_each(p, &priv->ibss_mac_hash[index]) {
3244 entry = list_entry(p, struct iwl_ibss_seq, list); 3244 entry = list_entry(p, struct iwl4965_ibss_seq, list);
3245 if (!compare_ether_addr(entry->mac, mac)) 3245 if (!compare_ether_addr(entry->mac, mac))
3246 break; 3246 break;
3247 } 3247 }
@@ -3304,7 +3304,7 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header)
3304 * the lower 3 bytes is the time in usec within one beacon interval 3304 * the lower 3 bytes is the time in usec within one beacon interval
3305 */ 3305 */
3306 3306
3307static u32 iwl_usecs_to_beacons(u32 usec, u32 beacon_interval) 3307static u32 iwl4965_usecs_to_beacons(u32 usec, u32 beacon_interval)
3308{ 3308{
3309 u32 quot; 3309 u32 quot;
3310 u32 rem; 3310 u32 rem;
@@ -3323,7 +3323,7 @@ static u32 iwl_usecs_to_beacons(u32 usec, u32 beacon_interval)
3323 * the same as HW timer counter counting down 3323 * the same as HW timer counter counting down
3324 */ 3324 */
3325 3325
3326static __le32 iwl_add_beacon_time(u32 base, u32 addon, u32 beacon_interval) 3326static __le32 iwl4965_add_beacon_time(u32 base, u32 addon, u32 beacon_interval)
3327{ 3327{
3328 u32 base_low = base & BEACON_TIME_MASK_LOW; 3328 u32 base_low = base & BEACON_TIME_MASK_LOW;
3329 u32 addon_low = addon & BEACON_TIME_MASK_LOW; 3329 u32 addon_low = addon & BEACON_TIME_MASK_LOW;
@@ -3342,13 +3342,13 @@ static __le32 iwl_add_beacon_time(u32 base, u32 addon, u32 beacon_interval)
3342 return cpu_to_le32(res); 3342 return cpu_to_le32(res);
3343} 3343}
3344 3344
3345static int iwl_get_measurement(struct iwl_priv *priv, 3345static int iwl4965_get_measurement(struct iwl4965_priv *priv,
3346 struct ieee80211_measurement_params *params, 3346 struct ieee80211_measurement_params *params,
3347 u8 type) 3347 u8 type)
3348{ 3348{
3349 struct iwl_spectrum_cmd spectrum; 3349 struct iwl4965_spectrum_cmd spectrum;
3350 struct iwl_rx_packet *res; 3350 struct iwl4965_rx_packet *res;
3351 struct iwl_host_cmd cmd = { 3351 struct iwl4965_host_cmd cmd = {
3352 .id = REPLY_SPECTRUM_MEASUREMENT_CMD, 3352 .id = REPLY_SPECTRUM_MEASUREMENT_CMD,
3353 .data = (void *)&spectrum, 3353 .data = (void *)&spectrum,
3354 .meta.flags = CMD_WANT_SKB, 3354 .meta.flags = CMD_WANT_SKB,
@@ -3358,9 +3358,9 @@ static int iwl_get_measurement(struct iwl_priv *priv,
3358 int spectrum_resp_status; 3358 int spectrum_resp_status;
3359 int duration = le16_to_cpu(params->duration); 3359 int duration = le16_to_cpu(params->duration);
3360 3360
3361 if (iwl_is_associated(priv)) 3361 if (iwl4965_is_associated(priv))
3362 add_time = 3362 add_time =
3363 iwl_usecs_to_beacons( 3363 iwl4965_usecs_to_beacons(
3364 le64_to_cpu(params->start_time) - priv->last_tsf, 3364 le64_to_cpu(params->start_time) - priv->last_tsf,
3365 le16_to_cpu(priv->rxon_timing.beacon_interval)); 3365 le16_to_cpu(priv->rxon_timing.beacon_interval));
3366 3366
@@ -3373,9 +3373,9 @@ static int iwl_get_measurement(struct iwl_priv *priv,
3373 cmd.len = sizeof(spectrum); 3373 cmd.len = sizeof(spectrum);
3374 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); 3374 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len));
3375 3375
3376 if (iwl_is_associated(priv)) 3376 if (iwl4965_is_associated(priv))
3377 spectrum.start_time = 3377 spectrum.start_time =
3378 iwl_add_beacon_time(priv->last_beacon_time, 3378 iwl4965_add_beacon_time(priv->last_beacon_time,
3379 add_time, 3379 add_time,
3380 le16_to_cpu(priv->rxon_timing.beacon_interval)); 3380 le16_to_cpu(priv->rxon_timing.beacon_interval));
3381 else 3381 else
@@ -3388,11 +3388,11 @@ static int iwl_get_measurement(struct iwl_priv *priv,
3388 spectrum.flags |= RXON_FLG_BAND_24G_MSK | 3388 spectrum.flags |= RXON_FLG_BAND_24G_MSK |
3389 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; 3389 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK;
3390 3390
3391 rc = iwl_send_cmd_sync(priv, &cmd); 3391 rc = iwl4965_send_cmd_sync(priv, &cmd);
3392 if (rc) 3392 if (rc)
3393 return rc; 3393 return rc;
3394 3394
3395 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; 3395 res = (struct iwl4965_rx_packet *)cmd.meta.u.skb->data;
3396 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 3396 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
3397 IWL_ERROR("Bad return from REPLY_RX_ON_ASSOC command\n"); 3397 IWL_ERROR("Bad return from REPLY_RX_ON_ASSOC command\n");
3398 rc = -EIO; 3398 rc = -EIO;
@@ -3422,8 +3422,8 @@ static int iwl_get_measurement(struct iwl_priv *priv,
3422} 3422}
3423#endif 3423#endif
3424 3424
3425static void iwl_txstatus_to_ieee(struct iwl_priv *priv, 3425static void iwl4965_txstatus_to_ieee(struct iwl4965_priv *priv,
3426 struct iwl_tx_info *tx_sta) 3426 struct iwl4965_tx_info *tx_sta)
3427{ 3427{
3428 3428
3429 tx_sta->status.ack_signal = 0; 3429 tx_sta->status.ack_signal = 0;
@@ -3442,16 +3442,16 @@ static void iwl_txstatus_to_ieee(struct iwl_priv *priv,
3442} 3442}
3443 3443
3444/** 3444/**
3445 * iwl_tx_queue_reclaim - Reclaim Tx queue entries no more used by NIC. 3445 * iwl4965_tx_queue_reclaim - Reclaim Tx queue entries no more used by NIC.
3446 * 3446 *
3447 * When FW advances 'R' index, all entries between old and 3447 * When FW advances 'R' index, all entries between old and
3448 * new 'R' index need to be reclaimed. As result, some free space 3448 * new 'R' index need to be reclaimed. As result, some free space
3449 * forms. If there is enough free space (> low mark), wake Tx queue. 3449 * forms. If there is enough free space (> low mark), wake Tx queue.
3450 */ 3450 */
3451int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) 3451int iwl4965_tx_queue_reclaim(struct iwl4965_priv *priv, int txq_id, int index)
3452{ 3452{
3453 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 3453 struct iwl4965_tx_queue *txq = &priv->txq[txq_id];
3454 struct iwl_queue *q = &txq->q; 3454 struct iwl4965_queue *q = &txq->q;
3455 int nfreed = 0; 3455 int nfreed = 0;
3456 3456
3457 if ((index >= q->n_bd) || (x2_queue_used(q, index) == 0)) { 3457 if ((index >= q->n_bd) || (x2_queue_used(q, index) == 0)) {
@@ -3461,13 +3461,13 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
3461 return 0; 3461 return 0;
3462 } 3462 }
3463 3463
3464 for (index = iwl_queue_inc_wrap(index, q->n_bd); 3464 for (index = iwl4965_queue_inc_wrap(index, q->n_bd);
3465 q->read_ptr != index; 3465 q->read_ptr != index;
3466 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { 3466 q->read_ptr = iwl4965_queue_inc_wrap(q->read_ptr, q->n_bd)) {
3467 if (txq_id != IWL_CMD_QUEUE_NUM) { 3467 if (txq_id != IWL_CMD_QUEUE_NUM) {
3468 iwl_txstatus_to_ieee(priv, 3468 iwl4965_txstatus_to_ieee(priv,
3469 &(txq->txb[txq->q.read_ptr])); 3469 &(txq->txb[txq->q.read_ptr]));
3470 iwl_hw_txq_free_tfd(priv, txq); 3470 iwl4965_hw_txq_free_tfd(priv, txq);
3471 } else if (nfreed > 1) { 3471 } else if (nfreed > 1) {
3472 IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index, 3472 IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index,
3473 q->write_ptr, q->read_ptr); 3473 q->write_ptr, q->read_ptr);
@@ -3476,7 +3476,7 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
3476 nfreed++; 3476 nfreed++;
3477 } 3477 }
3478 3478
3479 if (iwl_queue_space(q) > q->low_mark && (txq_id >= 0) && 3479 if (iwl4965_queue_space(q) > q->low_mark && (txq_id >= 0) &&
3480 (txq_id != IWL_CMD_QUEUE_NUM) && 3480 (txq_id != IWL_CMD_QUEUE_NUM) &&
3481 priv->mac80211_registered) 3481 priv->mac80211_registered)
3482 ieee80211_wake_queue(priv->hw, txq_id); 3482 ieee80211_wake_queue(priv->hw, txq_id);
@@ -3485,7 +3485,7 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
3485 return nfreed; 3485 return nfreed;
3486} 3486}
3487 3487
3488static int iwl_is_tx_success(u32 status) 3488static int iwl4965_is_tx_success(u32 status)
3489{ 3489{
3490 status &= TX_STATUS_MSK; 3490 status &= TX_STATUS_MSK;
3491 return (status == TX_STATUS_SUCCESS) 3491 return (status == TX_STATUS_SUCCESS)
@@ -3500,19 +3500,19 @@ static int iwl_is_tx_success(u32 status)
3500#ifdef CONFIG_IWL4965_HT 3500#ifdef CONFIG_IWL4965_HT
3501#ifdef CONFIG_IWL4965_HT_AGG 3501#ifdef CONFIG_IWL4965_HT_AGG
3502 3502
3503static inline int iwl_get_ra_sta_id(struct iwl_priv *priv, 3503static inline int iwl4965_get_ra_sta_id(struct iwl4965_priv *priv,
3504 struct ieee80211_hdr *hdr) 3504 struct ieee80211_hdr *hdr)
3505{ 3505{
3506 if (priv->iw_mode == IEEE80211_IF_TYPE_STA) 3506 if (priv->iw_mode == IEEE80211_IF_TYPE_STA)
3507 return IWL_AP_ID; 3507 return IWL_AP_ID;
3508 else { 3508 else {
3509 u8 *da = ieee80211_get_DA(hdr); 3509 u8 *da = ieee80211_get_DA(hdr);
3510 return iwl_hw_find_station(priv, da); 3510 return iwl4965_hw_find_station(priv, da);
3511 } 3511 }
3512} 3512}
3513 3513
3514static struct ieee80211_hdr *iwl_tx_queue_get_hdr( 3514static struct ieee80211_hdr *iwl4965_tx_queue_get_hdr(
3515 struct iwl_priv *priv, int txq_id, int idx) 3515 struct iwl4965_priv *priv, int txq_id, int idx)
3516{ 3516{
3517 if (priv->txq[txq_id].txb[idx].skb[0]) 3517 if (priv->txq[txq_id].txb[idx].skb[0])
3518 return (struct ieee80211_hdr *)priv->txq[txq_id]. 3518 return (struct ieee80211_hdr *)priv->txq[txq_id].
@@ -3520,16 +3520,16 @@ static struct ieee80211_hdr *iwl_tx_queue_get_hdr(
3520 return NULL; 3520 return NULL;
3521} 3521}
3522 3522
3523static inline u32 iwl_get_scd_ssn(struct iwl_tx_resp *tx_resp) 3523static inline u32 iwl4965_get_scd_ssn(struct iwl4965_tx_resp *tx_resp)
3524{ 3524{
3525 __le32 *scd_ssn = (__le32 *)((u32 *)&tx_resp->status + 3525 __le32 *scd_ssn = (__le32 *)((u32 *)&tx_resp->status +
3526 tx_resp->frame_count); 3526 tx_resp->frame_count);
3527 return le32_to_cpu(*scd_ssn) & MAX_SN; 3527 return le32_to_cpu(*scd_ssn) & MAX_SN;
3528 3528
3529} 3529}
3530static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, 3530static int iwl4965_tx_status_reply_tx(struct iwl4965_priv *priv,
3531 struct iwl_ht_agg *agg, 3531 struct iwl4965_ht_agg *agg,
3532 struct iwl_tx_resp *tx_resp, 3532 struct iwl4965_tx_resp *tx_resp,
3533 u16 start_idx) 3533 u16 start_idx)
3534{ 3534{
3535 u32 status; 3535 u32 status;
@@ -3549,7 +3549,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
3549 agg->bitmap0 = agg->bitmap1 = 0; 3549 agg->bitmap0 = agg->bitmap1 = 0;
3550 3550
3551 if (agg->frame_count == 1) { 3551 if (agg->frame_count == 1) {
3552 struct iwl_tx_queue *txq ; 3552 struct iwl4965_tx_queue *txq ;
3553 status = le32_to_cpu(frame_status[0]); 3553 status = le32_to_cpu(frame_status[0]);
3554 3554
3555 txq_id = agg->txq_id; 3555 txq_id = agg->txq_id;
@@ -3564,16 +3564,16 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
3564 tx_status->queue_length = tx_resp->bt_kill_count; 3564 tx_status->queue_length = tx_resp->bt_kill_count;
3565 tx_status->queue_length |= tx_resp->failure_rts; 3565 tx_status->queue_length |= tx_resp->failure_rts;
3566 3566
3567 tx_status->flags = iwl_is_tx_success(status)? 3567 tx_status->flags = iwl4965_is_tx_success(status)?
3568 IEEE80211_TX_STATUS_ACK : 0; 3568 IEEE80211_TX_STATUS_ACK : 0;
3569 tx_status->control.tx_rate = 3569 tx_status->control.tx_rate =
3570 iwl_hw_get_rate_n_flags(tx_resp->rate_n_flags); 3570 iwl4965_hw_get_rate_n_flags(tx_resp->rate_n_flags);
3571 /* FIXME: code repetition end */ 3571 /* FIXME: code repetition end */
3572 3572
3573 IWL_DEBUG_TX_REPLY("1 Frame 0x%x failure :%d\n", 3573 IWL_DEBUG_TX_REPLY("1 Frame 0x%x failure :%d\n",
3574 status & 0xff, tx_resp->failure_frame); 3574 status & 0xff, tx_resp->failure_frame);
3575 IWL_DEBUG_TX_REPLY("Rate Info rate_n_flags=%x\n", 3575 IWL_DEBUG_TX_REPLY("Rate Info rate_n_flags=%x\n",
3576 iwl_hw_get_rate_n_flags(tx_resp->rate_n_flags)); 3576 iwl4965_hw_get_rate_n_flags(tx_resp->rate_n_flags));
3577 3577
3578 agg->wait_for_ba = 0; 3578 agg->wait_for_ba = 0;
3579 } else { 3579 } else {
@@ -3594,7 +3594,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
3594 IWL_DEBUG_TX_REPLY("FrameCnt = %d, txq_id=%d idx=%d\n", 3594 IWL_DEBUG_TX_REPLY("FrameCnt = %d, txq_id=%d idx=%d\n",
3595 agg->frame_count, txq_id, idx); 3595 agg->frame_count, txq_id, idx);
3596 3596
3597 hdr = iwl_tx_queue_get_hdr(priv, txq_id, idx); 3597 hdr = iwl4965_tx_queue_get_hdr(priv, txq_id, idx);
3598 3598
3599 sc = le16_to_cpu(hdr->seq_ctrl); 3599 sc = le16_to_cpu(hdr->seq_ctrl);
3600 if (idx != (SEQ_TO_SN(sc) & 0xff)) { 3600 if (idx != (SEQ_TO_SN(sc) & 0xff)) {
@@ -3643,16 +3643,16 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
3643#endif 3643#endif
3644#endif 3644#endif
3645 3645
3646static void iwl_rx_reply_tx(struct iwl_priv *priv, 3646static void iwl4965_rx_reply_tx(struct iwl4965_priv *priv,
3647 struct iwl_rx_mem_buffer *rxb) 3647 struct iwl4965_rx_mem_buffer *rxb)
3648{ 3648{
3649 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3649 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3650 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 3650 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
3651 int txq_id = SEQ_TO_QUEUE(sequence); 3651 int txq_id = SEQ_TO_QUEUE(sequence);
3652 int index = SEQ_TO_INDEX(sequence); 3652 int index = SEQ_TO_INDEX(sequence);
3653 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 3653 struct iwl4965_tx_queue *txq = &priv->txq[txq_id];
3654 struct ieee80211_tx_status *tx_status; 3654 struct ieee80211_tx_status *tx_status;
3655 struct iwl_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; 3655 struct iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
3656 u32 status = le32_to_cpu(tx_resp->status); 3656 u32 status = le32_to_cpu(tx_resp->status);
3657#ifdef CONFIG_IWL4965_HT 3657#ifdef CONFIG_IWL4965_HT
3658#ifdef CONFIG_IWL4965_HT_AGG 3658#ifdef CONFIG_IWL4965_HT_AGG
@@ -3671,10 +3671,10 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv,
3671#ifdef CONFIG_IWL4965_HT 3671#ifdef CONFIG_IWL4965_HT
3672#ifdef CONFIG_IWL4965_HT_AGG 3672#ifdef CONFIG_IWL4965_HT_AGG
3673 if (txq->sched_retry) { 3673 if (txq->sched_retry) {
3674 const u32 scd_ssn = iwl_get_scd_ssn(tx_resp); 3674 const u32 scd_ssn = iwl4965_get_scd_ssn(tx_resp);
3675 struct ieee80211_hdr *hdr = 3675 struct ieee80211_hdr *hdr =
3676 iwl_tx_queue_get_hdr(priv, txq_id, index); 3676 iwl4965_tx_queue_get_hdr(priv, txq_id, index);
3677 struct iwl_ht_agg *agg = NULL; 3677 struct iwl4965_ht_agg *agg = NULL;
3678 __le16 *qc = ieee80211_get_qos_ctrl(hdr); 3678 __le16 *qc = ieee80211_get_qos_ctrl(hdr);
3679 3679
3680 if (qc == NULL) { 3680 if (qc == NULL) {
@@ -3684,7 +3684,7 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv,
3684 3684
3685 tid = le16_to_cpu(*qc) & 0xf; 3685 tid = le16_to_cpu(*qc) & 0xf;
3686 3686
3687 sta_id = iwl_get_ra_sta_id(priv, hdr); 3687 sta_id = iwl4965_get_ra_sta_id(priv, hdr);
3688 if (unlikely(sta_id == IWL_INVALID_STATION)) { 3688 if (unlikely(sta_id == IWL_INVALID_STATION)) {
3689 IWL_ERROR("Station not known for\n"); 3689 IWL_ERROR("Station not known for\n");
3690 return; 3690 return;
@@ -3695,15 +3695,15 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv,
3695 iwl4965_tx_status_reply_tx(priv, agg, tx_resp, index); 3695 iwl4965_tx_status_reply_tx(priv, agg, tx_resp, index);
3696 3696
3697 if ((tx_resp->frame_count == 1) && 3697 if ((tx_resp->frame_count == 1) &&
3698 !iwl_is_tx_success(status)) { 3698 !iwl4965_is_tx_success(status)) {
3699 /* TODO: send BAR */ 3699 /* TODO: send BAR */
3700 } 3700 }
3701 3701
3702 if ((txq->q.read_ptr != (scd_ssn & 0xff))) { 3702 if ((txq->q.read_ptr != (scd_ssn & 0xff))) {
3703 index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd); 3703 index = iwl4965_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd);
3704 IWL_DEBUG_TX_REPLY("Retry scheduler reclaim scd_ssn " 3704 IWL_DEBUG_TX_REPLY("Retry scheduler reclaim scd_ssn "
3705 "%d index %d\n", scd_ssn , index); 3705 "%d index %d\n", scd_ssn , index);
3706 iwl_tx_queue_reclaim(priv, txq_id, index); 3706 iwl4965_tx_queue_reclaim(priv, txq_id, index);
3707 } 3707 }
3708 } else { 3708 } else {
3709#endif /* CONFIG_IWL4965_HT_AGG */ 3709#endif /* CONFIG_IWL4965_HT_AGG */
@@ -3716,19 +3716,19 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv,
3716 tx_status->queue_length |= tx_resp->failure_rts; 3716 tx_status->queue_length |= tx_resp->failure_rts;
3717 3717
3718 tx_status->flags = 3718 tx_status->flags =
3719 iwl_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0; 3719 iwl4965_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0;
3720 3720
3721 tx_status->control.tx_rate = 3721 tx_status->control.tx_rate =
3722 iwl_hw_get_rate_n_flags(tx_resp->rate_n_flags); 3722 iwl4965_hw_get_rate_n_flags(tx_resp->rate_n_flags);
3723 3723
3724 IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) rate_n_flags 0x%x " 3724 IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) rate_n_flags 0x%x "
3725 "retries %d\n", txq_id, iwl_get_tx_fail_reason(status), 3725 "retries %d\n", txq_id, iwl4965_get_tx_fail_reason(status),
3726 status, le32_to_cpu(tx_resp->rate_n_flags), 3726 status, le32_to_cpu(tx_resp->rate_n_flags),
3727 tx_resp->failure_frame); 3727 tx_resp->failure_frame);
3728 3728
3729 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); 3729 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index);
3730 if (index != -1) 3730 if (index != -1)
3731 iwl_tx_queue_reclaim(priv, txq_id, index); 3731 iwl4965_tx_queue_reclaim(priv, txq_id, index);
3732#ifdef CONFIG_IWL4965_HT 3732#ifdef CONFIG_IWL4965_HT
3733#ifdef CONFIG_IWL4965_HT_AGG 3733#ifdef CONFIG_IWL4965_HT_AGG
3734 } 3734 }
@@ -3740,11 +3740,11 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv,
3740} 3740}
3741 3741
3742 3742
3743static void iwl_rx_reply_alive(struct iwl_priv *priv, 3743static void iwl4965_rx_reply_alive(struct iwl4965_priv *priv,
3744 struct iwl_rx_mem_buffer *rxb) 3744 struct iwl4965_rx_mem_buffer *rxb)
3745{ 3745{
3746 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3746 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3747 struct iwl_alive_resp *palive; 3747 struct iwl4965_alive_resp *palive;
3748 struct delayed_work *pwork; 3748 struct delayed_work *pwork;
3749 3749
3750 palive = &pkt->u.alive_frame; 3750 palive = &pkt->u.alive_frame;
@@ -3758,12 +3758,12 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv,
3758 IWL_DEBUG_INFO("Initialization Alive received.\n"); 3758 IWL_DEBUG_INFO("Initialization Alive received.\n");
3759 memcpy(&priv->card_alive_init, 3759 memcpy(&priv->card_alive_init,
3760 &pkt->u.alive_frame, 3760 &pkt->u.alive_frame,
3761 sizeof(struct iwl_init_alive_resp)); 3761 sizeof(struct iwl4965_init_alive_resp));
3762 pwork = &priv->init_alive_start; 3762 pwork = &priv->init_alive_start;
3763 } else { 3763 } else {
3764 IWL_DEBUG_INFO("Runtime Alive received.\n"); 3764 IWL_DEBUG_INFO("Runtime Alive received.\n");
3765 memcpy(&priv->card_alive, &pkt->u.alive_frame, 3765 memcpy(&priv->card_alive, &pkt->u.alive_frame,
3766 sizeof(struct iwl_alive_resp)); 3766 sizeof(struct iwl4965_alive_resp));
3767 pwork = &priv->alive_start; 3767 pwork = &priv->alive_start;
3768 } 3768 }
3769 3769
@@ -3776,19 +3776,19 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv,
3776 IWL_WARNING("uCode did not respond OK.\n"); 3776 IWL_WARNING("uCode did not respond OK.\n");
3777} 3777}
3778 3778
3779static void iwl_rx_reply_add_sta(struct iwl_priv *priv, 3779static void iwl4965_rx_reply_add_sta(struct iwl4965_priv *priv,
3780 struct iwl_rx_mem_buffer *rxb) 3780 struct iwl4965_rx_mem_buffer *rxb)
3781{ 3781{
3782 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3782 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3783 3783
3784 IWL_DEBUG_RX("Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status); 3784 IWL_DEBUG_RX("Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status);
3785 return; 3785 return;
3786} 3786}
3787 3787
3788static void iwl_rx_reply_error(struct iwl_priv *priv, 3788static void iwl4965_rx_reply_error(struct iwl4965_priv *priv,
3789 struct iwl_rx_mem_buffer *rxb) 3789 struct iwl4965_rx_mem_buffer *rxb)
3790{ 3790{
3791 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3791 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3792 3792
3793 IWL_ERROR("Error Reply type 0x%08X cmd %s (0x%02X) " 3793 IWL_ERROR("Error Reply type 0x%08X cmd %s (0x%02X) "
3794 "seq 0x%04X ser 0x%08X\n", 3794 "seq 0x%04X ser 0x%08X\n",
@@ -3801,23 +3801,23 @@ static void iwl_rx_reply_error(struct iwl_priv *priv,
3801 3801
3802#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x 3802#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x
3803 3803
3804static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) 3804static void iwl4965_rx_csa(struct iwl4965_priv *priv, struct iwl4965_rx_mem_buffer *rxb)
3805{ 3805{
3806 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3806 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3807 struct iwl_rxon_cmd *rxon = (void *)&priv->active_rxon; 3807 struct iwl4965_rxon_cmd *rxon = (void *)&priv->active_rxon;
3808 struct iwl_csa_notification *csa = &(pkt->u.csa_notif); 3808 struct iwl4965_csa_notification *csa = &(pkt->u.csa_notif);
3809 IWL_DEBUG_11H("CSA notif: channel %d, status %d\n", 3809 IWL_DEBUG_11H("CSA notif: channel %d, status %d\n",
3810 le16_to_cpu(csa->channel), le32_to_cpu(csa->status)); 3810 le16_to_cpu(csa->channel), le32_to_cpu(csa->status));
3811 rxon->channel = csa->channel; 3811 rxon->channel = csa->channel;
3812 priv->staging_rxon.channel = csa->channel; 3812 priv->staging_rxon.channel = csa->channel;
3813} 3813}
3814 3814
3815static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, 3815static void iwl4965_rx_spectrum_measure_notif(struct iwl4965_priv *priv,
3816 struct iwl_rx_mem_buffer *rxb) 3816 struct iwl4965_rx_mem_buffer *rxb)
3817{ 3817{
3818#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 3818#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT
3819 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3819 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3820 struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif); 3820 struct iwl4965_spectrum_notification *report = &(pkt->u.spectrum_notif);
3821 3821
3822 if (!report->state) { 3822 if (!report->state) {
3823 IWL_DEBUG(IWL_DL_11H | IWL_DL_INFO, 3823 IWL_DEBUG(IWL_DL_11H | IWL_DL_INFO,
@@ -3830,31 +3830,31 @@ static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv,
3830#endif 3830#endif
3831} 3831}
3832 3832
3833static void iwl_rx_pm_sleep_notif(struct iwl_priv *priv, 3833static void iwl4965_rx_pm_sleep_notif(struct iwl4965_priv *priv,
3834 struct iwl_rx_mem_buffer *rxb) 3834 struct iwl4965_rx_mem_buffer *rxb)
3835{ 3835{
3836#ifdef CONFIG_IWL4965_DEBUG 3836#ifdef CONFIG_IWL4965_DEBUG
3837 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3837 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3838 struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif); 3838 struct iwl4965_sleep_notification *sleep = &(pkt->u.sleep_notif);
3839 IWL_DEBUG_RX("sleep mode: %d, src: %d\n", 3839 IWL_DEBUG_RX("sleep mode: %d, src: %d\n",
3840 sleep->pm_sleep_mode, sleep->pm_wakeup_src); 3840 sleep->pm_sleep_mode, sleep->pm_wakeup_src);
3841#endif 3841#endif
3842} 3842}
3843 3843
3844static void iwl_rx_pm_debug_statistics_notif(struct iwl_priv *priv, 3844static void iwl4965_rx_pm_debug_statistics_notif(struct iwl4965_priv *priv,
3845 struct iwl_rx_mem_buffer *rxb) 3845 struct iwl4965_rx_mem_buffer *rxb)
3846{ 3846{
3847 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3847 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3848 IWL_DEBUG_RADIO("Dumping %d bytes of unhandled " 3848 IWL_DEBUG_RADIO("Dumping %d bytes of unhandled "
3849 "notification for %s:\n", 3849 "notification for %s:\n",
3850 le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd)); 3850 le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd));
3851 iwl_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); 3851 iwl4965_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len));
3852} 3852}
3853 3853
3854static void iwl_bg_beacon_update(struct work_struct *work) 3854static void iwl4965_bg_beacon_update(struct work_struct *work)
3855{ 3855{
3856 struct iwl_priv *priv = 3856 struct iwl4965_priv *priv =
3857 container_of(work, struct iwl_priv, beacon_update); 3857 container_of(work, struct iwl4965_priv, beacon_update);
3858 struct sk_buff *beacon; 3858 struct sk_buff *beacon;
3859 3859
3860 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ 3860 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */
@@ -3873,16 +3873,16 @@ static void iwl_bg_beacon_update(struct work_struct *work)
3873 priv->ibss_beacon = beacon; 3873 priv->ibss_beacon = beacon;
3874 mutex_unlock(&priv->mutex); 3874 mutex_unlock(&priv->mutex);
3875 3875
3876 iwl_send_beacon_cmd(priv); 3876 iwl4965_send_beacon_cmd(priv);
3877} 3877}
3878 3878
3879static void iwl_rx_beacon_notif(struct iwl_priv *priv, 3879static void iwl4965_rx_beacon_notif(struct iwl4965_priv *priv,
3880 struct iwl_rx_mem_buffer *rxb) 3880 struct iwl4965_rx_mem_buffer *rxb)
3881{ 3881{
3882#ifdef CONFIG_IWL4965_DEBUG 3882#ifdef CONFIG_IWL4965_DEBUG
3883 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3883 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3884 struct iwl_beacon_notif *beacon = &(pkt->u.beacon_status); 3884 struct iwl4965_beacon_notif *beacon = &(pkt->u.beacon_status);
3885 u8 rate = iwl_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); 3885 u8 rate = iwl4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags);
3886 3886
3887 IWL_DEBUG_RX("beacon status %x retries %d iss %d " 3887 IWL_DEBUG_RX("beacon status %x retries %d iss %d "
3888 "tsf %d %d rate %d\n", 3888 "tsf %d %d rate %d\n",
@@ -3899,25 +3899,25 @@ static void iwl_rx_beacon_notif(struct iwl_priv *priv,
3899} 3899}
3900 3900
3901/* Service response to REPLY_SCAN_CMD (0x80) */ 3901/* Service response to REPLY_SCAN_CMD (0x80) */
3902static void iwl_rx_reply_scan(struct iwl_priv *priv, 3902static void iwl4965_rx_reply_scan(struct iwl4965_priv *priv,
3903 struct iwl_rx_mem_buffer *rxb) 3903 struct iwl4965_rx_mem_buffer *rxb)
3904{ 3904{
3905#ifdef CONFIG_IWL4965_DEBUG 3905#ifdef CONFIG_IWL4965_DEBUG
3906 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3906 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3907 struct iwl_scanreq_notification *notif = 3907 struct iwl4965_scanreq_notification *notif =
3908 (struct iwl_scanreq_notification *)pkt->u.raw; 3908 (struct iwl4965_scanreq_notification *)pkt->u.raw;
3909 3909
3910 IWL_DEBUG_RX("Scan request status = 0x%x\n", notif->status); 3910 IWL_DEBUG_RX("Scan request status = 0x%x\n", notif->status);
3911#endif 3911#endif
3912} 3912}
3913 3913
3914/* Service SCAN_START_NOTIFICATION (0x82) */ 3914/* Service SCAN_START_NOTIFICATION (0x82) */
3915static void iwl_rx_scan_start_notif(struct iwl_priv *priv, 3915static void iwl4965_rx_scan_start_notif(struct iwl4965_priv *priv,
3916 struct iwl_rx_mem_buffer *rxb) 3916 struct iwl4965_rx_mem_buffer *rxb)
3917{ 3917{
3918 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3918 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3919 struct iwl_scanstart_notification *notif = 3919 struct iwl4965_scanstart_notification *notif =
3920 (struct iwl_scanstart_notification *)pkt->u.raw; 3920 (struct iwl4965_scanstart_notification *)pkt->u.raw;
3921 priv->scan_start_tsf = le32_to_cpu(notif->tsf_low); 3921 priv->scan_start_tsf = le32_to_cpu(notif->tsf_low);
3922 IWL_DEBUG_SCAN("Scan start: " 3922 IWL_DEBUG_SCAN("Scan start: "
3923 "%d [802.11%s] " 3923 "%d [802.11%s] "
@@ -3929,12 +3929,12 @@ static void iwl_rx_scan_start_notif(struct iwl_priv *priv,
3929} 3929}
3930 3930
3931/* Service SCAN_RESULTS_NOTIFICATION (0x83) */ 3931/* Service SCAN_RESULTS_NOTIFICATION (0x83) */
3932static void iwl_rx_scan_results_notif(struct iwl_priv *priv, 3932static void iwl4965_rx_scan_results_notif(struct iwl4965_priv *priv,
3933 struct iwl_rx_mem_buffer *rxb) 3933 struct iwl4965_rx_mem_buffer *rxb)
3934{ 3934{
3935 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3935 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3936 struct iwl_scanresults_notification *notif = 3936 struct iwl4965_scanresults_notification *notif =
3937 (struct iwl_scanresults_notification *)pkt->u.raw; 3937 (struct iwl4965_scanresults_notification *)pkt->u.raw;
3938 3938
3939 IWL_DEBUG_SCAN("Scan ch.res: " 3939 IWL_DEBUG_SCAN("Scan ch.res: "
3940 "%d [802.11%s] " 3940 "%d [802.11%s] "
@@ -3953,11 +3953,11 @@ static void iwl_rx_scan_results_notif(struct iwl_priv *priv,
3953} 3953}
3954 3954
3955/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ 3955/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */
3956static void iwl_rx_scan_complete_notif(struct iwl_priv *priv, 3956static void iwl4965_rx_scan_complete_notif(struct iwl4965_priv *priv,
3957 struct iwl_rx_mem_buffer *rxb) 3957 struct iwl4965_rx_mem_buffer *rxb)
3958{ 3958{
3959 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3959 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3960 struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw; 3960 struct iwl4965_scancomplete_notification *scan_notif = (void *)pkt->u.raw;
3961 3961
3962 IWL_DEBUG_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n", 3962 IWL_DEBUG_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n",
3963 scan_notif->scanned_channels, 3963 scan_notif->scanned_channels,
@@ -4010,10 +4010,10 @@ reschedule:
4010 4010
4011/* Handle notification from uCode that card's power state is changing 4011/* Handle notification from uCode that card's power state is changing
4012 * due to software, hardware, or critical temperature RFKILL */ 4012 * due to software, hardware, or critical temperature RFKILL */
4013static void iwl_rx_card_state_notif(struct iwl_priv *priv, 4013static void iwl4965_rx_card_state_notif(struct iwl4965_priv *priv,
4014 struct iwl_rx_mem_buffer *rxb) 4014 struct iwl4965_rx_mem_buffer *rxb)
4015{ 4015{
4016 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 4016 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
4017 u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); 4017 u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags);
4018 unsigned long status = priv->status; 4018 unsigned long status = priv->status;
4019 4019
@@ -4024,35 +4024,35 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
4024 if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED | 4024 if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED |
4025 RF_CARD_DISABLED)) { 4025 RF_CARD_DISABLED)) {
4026 4026
4027 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, 4027 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_SET,
4028 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 4028 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
4029 4029
4030 if (!iwl_grab_nic_access(priv)) { 4030 if (!iwl4965_grab_nic_access(priv)) {
4031 iwl_write_direct32( 4031 iwl4965_write_direct32(
4032 priv, HBUS_TARG_MBX_C, 4032 priv, HBUS_TARG_MBX_C,
4033 HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); 4033 HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED);
4034 4034
4035 iwl_release_nic_access(priv); 4035 iwl4965_release_nic_access(priv);
4036 } 4036 }
4037 4037
4038 if (!(flags & RXON_CARD_DISABLED)) { 4038 if (!(flags & RXON_CARD_DISABLED)) {
4039 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, 4039 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR,
4040 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 4040 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
4041 if (!iwl_grab_nic_access(priv)) { 4041 if (!iwl4965_grab_nic_access(priv)) {
4042 iwl_write_direct32( 4042 iwl4965_write_direct32(
4043 priv, HBUS_TARG_MBX_C, 4043 priv, HBUS_TARG_MBX_C,
4044 HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); 4044 HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED);
4045 4045
4046 iwl_release_nic_access(priv); 4046 iwl4965_release_nic_access(priv);
4047 } 4047 }
4048 } 4048 }
4049 4049
4050 if (flags & RF_CARD_DISABLED) { 4050 if (flags & RF_CARD_DISABLED) {
4051 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, 4051 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_SET,
4052 CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); 4052 CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT);
4053 iwl_read32(priv, CSR_UCODE_DRV_GP1); 4053 iwl4965_read32(priv, CSR_UCODE_DRV_GP1);
4054 if (!iwl_grab_nic_access(priv)) 4054 if (!iwl4965_grab_nic_access(priv))
4055 iwl_release_nic_access(priv); 4055 iwl4965_release_nic_access(priv);
4056 } 4056 }
4057 } 4057 }
4058 4058
@@ -4068,7 +4068,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
4068 clear_bit(STATUS_RF_KILL_SW, &priv->status); 4068 clear_bit(STATUS_RF_KILL_SW, &priv->status);
4069 4069
4070 if (!(flags & RXON_CARD_DISABLED)) 4070 if (!(flags & RXON_CARD_DISABLED))
4071 iwl_scan_cancel(priv); 4071 iwl4965_scan_cancel(priv);
4072 4072
4073 if ((test_bit(STATUS_RF_KILL_HW, &status) != 4073 if ((test_bit(STATUS_RF_KILL_HW, &status) !=
4074 test_bit(STATUS_RF_KILL_HW, &priv->status)) || 4074 test_bit(STATUS_RF_KILL_HW, &priv->status)) ||
@@ -4080,7 +4080,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
4080} 4080}
4081 4081
4082/** 4082/**
4083 * iwl_setup_rx_handlers - Initialize Rx handler callbacks 4083 * iwl4965_setup_rx_handlers - Initialize Rx handler callbacks
4084 * 4084 *
4085 * Setup the RX handlers for each of the reply types sent from the uCode 4085 * Setup the RX handlers for each of the reply types sent from the uCode
4086 * to the host. 4086 * to the host.
@@ -4088,20 +4088,20 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
4088 * This function chains into the hardware specific files for them to setup 4088 * This function chains into the hardware specific files for them to setup
4089 * any hardware specific handlers as well. 4089 * any hardware specific handlers as well.
4090 */ 4090 */
4091static void iwl_setup_rx_handlers(struct iwl_priv *priv) 4091static void iwl4965_setup_rx_handlers(struct iwl4965_priv *priv)
4092{ 4092{
4093 priv->rx_handlers[REPLY_ALIVE] = iwl_rx_reply_alive; 4093 priv->rx_handlers[REPLY_ALIVE] = iwl4965_rx_reply_alive;
4094 priv->rx_handlers[REPLY_ADD_STA] = iwl_rx_reply_add_sta; 4094 priv->rx_handlers[REPLY_ADD_STA] = iwl4965_rx_reply_add_sta;
4095 priv->rx_handlers[REPLY_ERROR] = iwl_rx_reply_error; 4095 priv->rx_handlers[REPLY_ERROR] = iwl4965_rx_reply_error;
4096 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_rx_csa; 4096 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl4965_rx_csa;
4097 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = 4097 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] =
4098 iwl_rx_spectrum_measure_notif; 4098 iwl4965_rx_spectrum_measure_notif;
4099 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl_rx_pm_sleep_notif; 4099 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl4965_rx_pm_sleep_notif;
4100 priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = 4100 priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] =
4101 iwl_rx_pm_debug_statistics_notif; 4101 iwl4965_rx_pm_debug_statistics_notif;
4102 priv->rx_handlers[BEACON_NOTIFICATION] = iwl_rx_beacon_notif; 4102 priv->rx_handlers[BEACON_NOTIFICATION] = iwl4965_rx_beacon_notif;
4103 4103
4104 /* NOTE: iwl_rx_statistics is different based on whether 4104 /* NOTE: iwl4965_rx_statistics is different based on whether
4105 * the build is for the 3945 or the 4965. See the 4105 * the build is for the 3945 or the 4965. See the
4106 * corresponding implementation in iwl-XXXX.c 4106 * corresponding implementation in iwl-XXXX.c
4107 * 4107 *
@@ -4109,40 +4109,40 @@ static void iwl_setup_rx_handlers(struct iwl_priv *priv)
4109 * discrete statistics request from the host as well as 4109 * discrete statistics request from the host as well as
4110 * for the periodic statistics notification from the uCode 4110 * for the periodic statistics notification from the uCode
4111 */ 4111 */
4112 priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl_hw_rx_statistics; 4112 priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl4965_hw_rx_statistics;
4113 priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl_hw_rx_statistics; 4113 priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl4965_hw_rx_statistics;
4114 4114
4115 priv->rx_handlers[REPLY_SCAN_CMD] = iwl_rx_reply_scan; 4115 priv->rx_handlers[REPLY_SCAN_CMD] = iwl4965_rx_reply_scan;
4116 priv->rx_handlers[SCAN_START_NOTIFICATION] = iwl_rx_scan_start_notif; 4116 priv->rx_handlers[SCAN_START_NOTIFICATION] = iwl4965_rx_scan_start_notif;
4117 priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] = 4117 priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] =
4118 iwl_rx_scan_results_notif; 4118 iwl4965_rx_scan_results_notif;
4119 priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] = 4119 priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] =
4120 iwl_rx_scan_complete_notif; 4120 iwl4965_rx_scan_complete_notif;
4121 priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl_rx_card_state_notif; 4121 priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl4965_rx_card_state_notif;
4122 priv->rx_handlers[REPLY_TX] = iwl_rx_reply_tx; 4122 priv->rx_handlers[REPLY_TX] = iwl4965_rx_reply_tx;
4123 4123
4124 /* Setup hardware specific Rx handlers */ 4124 /* Setup hardware specific Rx handlers */
4125 iwl_hw_rx_handler_setup(priv); 4125 iwl4965_hw_rx_handler_setup(priv);
4126} 4126}
4127 4127
4128/** 4128/**
4129 * iwl_tx_cmd_complete - Pull unused buffers off the queue and reclaim them 4129 * iwl4965_tx_cmd_complete - Pull unused buffers off the queue and reclaim them
4130 * @rxb: Rx buffer to reclaim 4130 * @rxb: Rx buffer to reclaim
4131 * 4131 *
4132 * If an Rx buffer has an async callback associated with it the callback 4132 * If an Rx buffer has an async callback associated with it the callback
4133 * will be executed. The attached skb (if present) will only be freed 4133 * will be executed. The attached skb (if present) will only be freed
4134 * if the callback returns 1 4134 * if the callback returns 1
4135 */ 4135 */
4136static void iwl_tx_cmd_complete(struct iwl_priv *priv, 4136static void iwl4965_tx_cmd_complete(struct iwl4965_priv *priv,
4137 struct iwl_rx_mem_buffer *rxb) 4137 struct iwl4965_rx_mem_buffer *rxb)
4138{ 4138{
4139 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 4139 struct iwl4965_rx_packet *pkt = (struct iwl4965_rx_packet *)rxb->skb->data;
4140 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 4140 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
4141 int txq_id = SEQ_TO_QUEUE(sequence); 4141 int txq_id = SEQ_TO_QUEUE(sequence);
4142 int index = SEQ_TO_INDEX(sequence); 4142 int index = SEQ_TO_INDEX(sequence);
4143 int huge = sequence & SEQ_HUGE_FRAME; 4143 int huge = sequence & SEQ_HUGE_FRAME;
4144 int cmd_index; 4144 int cmd_index;
4145 struct iwl_cmd *cmd; 4145 struct iwl4965_cmd *cmd;
4146 4146
4147 /* If a Tx command is being handled and it isn't in the actual 4147 /* If a Tx command is being handled and it isn't in the actual
4148 * command queue then there a command routing bug has been introduced 4148 * command queue then there a command routing bug has been introduced
@@ -4163,7 +4163,7 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv,
4163 !cmd->meta.u.callback(priv, cmd, rxb->skb)) 4163 !cmd->meta.u.callback(priv, cmd, rxb->skb))
4164 rxb->skb = NULL; 4164 rxb->skb = NULL;
4165 4165
4166 iwl_tx_queue_reclaim(priv, txq_id, index); 4166 iwl4965_tx_queue_reclaim(priv, txq_id, index);
4167 4167
4168 if (!(cmd->meta.flags & CMD_ASYNC)) { 4168 if (!(cmd->meta.flags & CMD_ASYNC)) {
4169 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 4169 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
@@ -4205,7 +4205,7 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv,
4205 * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When 4205 * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When
4206 * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled 4206 * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled
4207 * to replenish the iwl->rxq->rx_free. 4207 * to replenish the iwl->rxq->rx_free.
4208 * + In iwl_rx_replenish (scheduled) if 'processed' != 'read' then the 4208 * + In iwl4965_rx_replenish (scheduled) if 'processed' != 'read' then the
4209 * iwl->rxq is replenished and the READ INDEX is updated (updating the 4209 * iwl->rxq is replenished and the READ INDEX is updated (updating the
4210 * 'processed' and 'read' driver indexes as well) 4210 * 'processed' and 'read' driver indexes as well)
4211 * + A received packet is processed and handed to the kernel network stack, 4211 * + A received packet is processed and handed to the kernel network stack,
@@ -4218,28 +4218,28 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv,
4218 * 4218 *
4219 * Driver sequence: 4219 * Driver sequence:
4220 * 4220 *
4221 * iwl_rx_queue_alloc() Allocates rx_free 4221 * iwl4965_rx_queue_alloc() Allocates rx_free
4222 * iwl_rx_replenish() Replenishes rx_free list from rx_used, and calls 4222 * iwl4965_rx_replenish() Replenishes rx_free list from rx_used, and calls
4223 * iwl_rx_queue_restock 4223 * iwl4965_rx_queue_restock
4224 * iwl_rx_queue_restock() Moves available buffers from rx_free into Rx 4224 * iwl4965_rx_queue_restock() Moves available buffers from rx_free into Rx
4225 * queue, updates firmware pointers, and updates 4225 * queue, updates firmware pointers, and updates
4226 * the WRITE index. If insufficient rx_free buffers 4226 * the WRITE index. If insufficient rx_free buffers
4227 * are available, schedules iwl_rx_replenish 4227 * are available, schedules iwl4965_rx_replenish
4228 * 4228 *
4229 * -- enable interrupts -- 4229 * -- enable interrupts --
4230 * ISR - iwl_rx() Detach iwl_rx_mem_buffers from pool up to the 4230 * ISR - iwl4965_rx() Detach iwl4965_rx_mem_buffers from pool up to the
4231 * READ INDEX, detaching the SKB from the pool. 4231 * READ INDEX, detaching the SKB from the pool.
4232 * Moves the packet buffer from queue to rx_used. 4232 * Moves the packet buffer from queue to rx_used.
4233 * Calls iwl_rx_queue_restock to refill any empty 4233 * Calls iwl4965_rx_queue_restock to refill any empty
4234 * slots. 4234 * slots.
4235 * ... 4235 * ...
4236 * 4236 *
4237 */ 4237 */
4238 4238
4239/** 4239/**
4240 * iwl_rx_queue_space - Return number of free slots available in queue. 4240 * iwl4965_rx_queue_space - Return number of free slots available in queue.
4241 */ 4241 */
4242static int iwl_rx_queue_space(const struct iwl_rx_queue *q) 4242static int iwl4965_rx_queue_space(const struct iwl4965_rx_queue *q)
4243{ 4243{
4244 int s = q->read - q->write; 4244 int s = q->read - q->write;
4245 if (s <= 0) 4245 if (s <= 0)
@@ -4252,7 +4252,7 @@ static int iwl_rx_queue_space(const struct iwl_rx_queue *q)
4252} 4252}
4253 4253
4254/** 4254/**
4255 * iwl_rx_queue_update_write_ptr - Update the write pointer for the RX queue 4255 * iwl4965_rx_queue_update_write_ptr - Update the write pointer for the RX queue
4256 * 4256 *
4257 * NOTE: This function has 3945 and 4965 specific code sections 4257 * NOTE: This function has 3945 and 4965 specific code sections
4258 * but is declared in base due to the majority of the 4258 * but is declared in base due to the majority of the
@@ -4260,7 +4260,7 @@ static int iwl_rx_queue_space(const struct iwl_rx_queue *q)
4260 * different) 4260 * different)
4261 * 4261 *
4262 */ 4262 */
4263int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q) 4263int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv, struct iwl4965_rx_queue *q)
4264{ 4264{
4265 u32 reg = 0; 4265 u32 reg = 0;
4266 int rc = 0; 4266 int rc = 0;
@@ -4272,23 +4272,23 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q)
4272 goto exit_unlock; 4272 goto exit_unlock;
4273 4273
4274 if (test_bit(STATUS_POWER_PMI, &priv->status)) { 4274 if (test_bit(STATUS_POWER_PMI, &priv->status)) {
4275 reg = iwl_read32(priv, CSR_UCODE_DRV_GP1); 4275 reg = iwl4965_read32(priv, CSR_UCODE_DRV_GP1);
4276 4276
4277 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { 4277 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
4278 iwl_set_bit(priv, CSR_GP_CNTRL, 4278 iwl4965_set_bit(priv, CSR_GP_CNTRL,
4279 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 4279 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
4280 goto exit_unlock; 4280 goto exit_unlock;
4281 } 4281 }
4282 4282
4283 rc = iwl_grab_nic_access(priv); 4283 rc = iwl4965_grab_nic_access(priv);
4284 if (rc) 4284 if (rc)
4285 goto exit_unlock; 4285 goto exit_unlock;
4286 4286
4287 iwl_write_direct32(priv, FH_RSCSR_CHNL0_WPTR, 4287 iwl4965_write_direct32(priv, FH_RSCSR_CHNL0_WPTR,
4288 q->write & ~0x7); 4288 q->write & ~0x7);
4289 iwl_release_nic_access(priv); 4289 iwl4965_release_nic_access(priv);
4290 } else 4290 } else
4291 iwl_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); 4291 iwl4965_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7);
4292 4292
4293 4293
4294 q->need_update = 0; 4294 q->need_update = 0;
@@ -4299,11 +4299,11 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q)
4299} 4299}
4300 4300
4301/** 4301/**
4302 * iwl_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer pointer. 4302 * iwl4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer pointer.
4303 * 4303 *
4304 * NOTE: This function has 3945 and 4965 specific code paths in it. 4304 * NOTE: This function has 3945 and 4965 specific code paths in it.
4305 */ 4305 */
4306static inline __le32 iwl_dma_addr2rbd_ptr(struct iwl_priv *priv, 4306static inline __le32 iwl4965_dma_addr2rbd_ptr(struct iwl4965_priv *priv,
4307 dma_addr_t dma_addr) 4307 dma_addr_t dma_addr)
4308{ 4308{
4309 return cpu_to_le32((u32)(dma_addr >> 8)); 4309 return cpu_to_le32((u32)(dma_addr >> 8));
@@ -4311,7 +4311,7 @@ static inline __le32 iwl_dma_addr2rbd_ptr(struct iwl_priv *priv,
4311 4311
4312 4312
4313/** 4313/**
4314 * iwl_rx_queue_restock - refill RX queue from pre-allocated pool 4314 * iwl4965_rx_queue_restock - refill RX queue from pre-allocated pool
4315 * 4315 *
4316 * If there are slots in the RX queue that need to be restocked, 4316 * If there are slots in the RX queue that need to be restocked,
4317 * and we have free pre-allocated buffers, fill the ranks as much 4317 * and we have free pre-allocated buffers, fill the ranks as much
@@ -4321,21 +4321,21 @@ static inline __le32 iwl_dma_addr2rbd_ptr(struct iwl_priv *priv,
4321 * also updates the memory address in the firmware to reference the new 4321 * also updates the memory address in the firmware to reference the new
4322 * target buffer. 4322 * target buffer.
4323 */ 4323 */
4324static int iwl_rx_queue_restock(struct iwl_priv *priv) 4324static int iwl4965_rx_queue_restock(struct iwl4965_priv *priv)
4325{ 4325{
4326 struct iwl_rx_queue *rxq = &priv->rxq; 4326 struct iwl4965_rx_queue *rxq = &priv->rxq;
4327 struct list_head *element; 4327 struct list_head *element;
4328 struct iwl_rx_mem_buffer *rxb; 4328 struct iwl4965_rx_mem_buffer *rxb;
4329 unsigned long flags; 4329 unsigned long flags;
4330 int write, rc; 4330 int write, rc;
4331 4331
4332 spin_lock_irqsave(&rxq->lock, flags); 4332 spin_lock_irqsave(&rxq->lock, flags);
4333 write = rxq->write & ~0x7; 4333 write = rxq->write & ~0x7;
4334 while ((iwl_rx_queue_space(rxq) > 0) && (rxq->free_count)) { 4334 while ((iwl4965_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
4335 element = rxq->rx_free.next; 4335 element = rxq->rx_free.next;
4336 rxb = list_entry(element, struct iwl_rx_mem_buffer, list); 4336 rxb = list_entry(element, struct iwl4965_rx_mem_buffer, list);
4337 list_del(element); 4337 list_del(element);
4338 rxq->bd[rxq->write] = iwl_dma_addr2rbd_ptr(priv, rxb->dma_addr); 4338 rxq->bd[rxq->write] = iwl4965_dma_addr2rbd_ptr(priv, rxb->dma_addr);
4339 rxq->queue[rxq->write] = rxb; 4339 rxq->queue[rxq->write] = rxb;
4340 rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; 4340 rxq->write = (rxq->write + 1) & RX_QUEUE_MASK;
4341 rxq->free_count--; 4341 rxq->free_count--;
@@ -4353,7 +4353,7 @@ static int iwl_rx_queue_restock(struct iwl_priv *priv)
4353 spin_lock_irqsave(&rxq->lock, flags); 4353 spin_lock_irqsave(&rxq->lock, flags);
4354 rxq->need_update = 1; 4354 rxq->need_update = 1;
4355 spin_unlock_irqrestore(&rxq->lock, flags); 4355 spin_unlock_irqrestore(&rxq->lock, flags);
4356 rc = iwl_rx_queue_update_write_ptr(priv, rxq); 4356 rc = iwl4965_rx_queue_update_write_ptr(priv, rxq);
4357 if (rc) 4357 if (rc)
4358 return rc; 4358 return rc;
4359 } 4359 }
@@ -4362,24 +4362,24 @@ static int iwl_rx_queue_restock(struct iwl_priv *priv)
4362} 4362}
4363 4363
4364/** 4364/**
4365 * iwl_rx_replenish - Move all used packet from rx_used to rx_free 4365 * iwl4965_rx_replenish - Move all used packet from rx_used to rx_free
4366 * 4366 *
4367 * When moving to rx_free an SKB is allocated for the slot. 4367 * When moving to rx_free an SKB is allocated for the slot.
4368 * 4368 *
4369 * Also restock the Rx queue via iwl_rx_queue_restock. 4369 * Also restock the Rx queue via iwl4965_rx_queue_restock.
4370 * This is called as a scheduled work item (except for during initialization) 4370 * This is called as a scheduled work item (except for during initialization)
4371 */ 4371 */
4372void iwl_rx_replenish(void *data) 4372void iwl4965_rx_replenish(void *data)
4373{ 4373{
4374 struct iwl_priv *priv = data; 4374 struct iwl4965_priv *priv = data;
4375 struct iwl_rx_queue *rxq = &priv->rxq; 4375 struct iwl4965_rx_queue *rxq = &priv->rxq;
4376 struct list_head *element; 4376 struct list_head *element;
4377 struct iwl_rx_mem_buffer *rxb; 4377 struct iwl4965_rx_mem_buffer *rxb;
4378 unsigned long flags; 4378 unsigned long flags;
4379 spin_lock_irqsave(&rxq->lock, flags); 4379 spin_lock_irqsave(&rxq->lock, flags);
4380 while (!list_empty(&rxq->rx_used)) { 4380 while (!list_empty(&rxq->rx_used)) {
4381 element = rxq->rx_used.next; 4381 element = rxq->rx_used.next;
4382 rxb = list_entry(element, struct iwl_rx_mem_buffer, list); 4382 rxb = list_entry(element, struct iwl4965_rx_mem_buffer, list);
4383 rxb->skb = 4383 rxb->skb =
4384 alloc_skb(IWL_RX_BUF_SIZE, __GFP_NOWARN | GFP_ATOMIC); 4384 alloc_skb(IWL_RX_BUF_SIZE, __GFP_NOWARN | GFP_ATOMIC);
4385 if (!rxb->skb) { 4385 if (!rxb->skb) {
@@ -4402,7 +4402,7 @@ void iwl_rx_replenish(void *data)
4402 spin_unlock_irqrestore(&rxq->lock, flags); 4402 spin_unlock_irqrestore(&rxq->lock, flags);
4403 4403
4404 spin_lock_irqsave(&priv->lock, flags); 4404 spin_lock_irqsave(&priv->lock, flags);
4405 iwl_rx_queue_restock(priv); 4405 iwl4965_rx_queue_restock(priv);
4406 spin_unlock_irqrestore(&priv->lock, flags); 4406 spin_unlock_irqrestore(&priv->lock, flags);
4407} 4407}
4408 4408
@@ -4411,7 +4411,7 @@ void iwl_rx_replenish(void *data)
4411 * This free routine walks the list of POOL entries and if SKB is set to 4411 * This free routine walks the list of POOL entries and if SKB is set to
4412 * non NULL it is unmapped and freed 4412 * non NULL it is unmapped and freed
4413 */ 4413 */
4414static void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 4414static void iwl4965_rx_queue_free(struct iwl4965_priv *priv, struct iwl4965_rx_queue *rxq)
4415{ 4415{
4416 int i; 4416 int i;
4417 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { 4417 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
@@ -4428,9 +4428,9 @@ static void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
4428 rxq->bd = NULL; 4428 rxq->bd = NULL;
4429} 4429}
4430 4430
4431int iwl_rx_queue_alloc(struct iwl_priv *priv) 4431int iwl4965_rx_queue_alloc(struct iwl4965_priv *priv)
4432{ 4432{
4433 struct iwl_rx_queue *rxq = &priv->rxq; 4433 struct iwl4965_rx_queue *rxq = &priv->rxq;
4434 struct pci_dev *dev = priv->pci_dev; 4434 struct pci_dev *dev = priv->pci_dev;
4435 int i; 4435 int i;
4436 4436
@@ -4451,7 +4451,7 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv)
4451 return 0; 4451 return 0;
4452} 4452}
4453 4453
4454void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 4454void iwl4965_rx_queue_reset(struct iwl4965_priv *priv, struct iwl4965_rx_queue *rxq)
4455{ 4455{
4456 unsigned long flags; 4456 unsigned long flags;
4457 int i; 4457 int i;
@@ -4498,7 +4498,7 @@ static u8 ratio2dB[100] = {
4498/* Calculates a relative dB value from a ratio of linear 4498/* Calculates a relative dB value from a ratio of linear
4499 * (i.e. not dB) signal levels. 4499 * (i.e. not dB) signal levels.
4500 * Conversion assumes that levels are voltages (20*log), not powers (10*log). */ 4500 * Conversion assumes that levels are voltages (20*log), not powers (10*log). */
4501int iwl_calc_db_from_ratio(int sig_ratio) 4501int iwl4965_calc_db_from_ratio(int sig_ratio)
4502{ 4502{
4503 /* 1000:1 or higher just report as 60 dB */ 4503 /* 1000:1 or higher just report as 60 dB */
4504 if (sig_ratio >= 1000) 4504 if (sig_ratio >= 1000)
@@ -4524,7 +4524,7 @@ int iwl_calc_db_from_ratio(int sig_ratio)
4524/* Calculate an indication of rx signal quality (a percentage, not dBm!). 4524/* Calculate an indication of rx signal quality (a percentage, not dBm!).
4525 * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info 4525 * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info
4526 * about formulas used below. */ 4526 * about formulas used below. */
4527int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm) 4527int iwl4965_calc_sig_qual(int rssi_dbm, int noise_dbm)
4528{ 4528{
4529 int sig_qual; 4529 int sig_qual;
4530 int degradation = PERFECT_RSSI - rssi_dbm; 4530 int degradation = PERFECT_RSSI - rssi_dbm;
@@ -4559,22 +4559,22 @@ int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm)
4559} 4559}
4560 4560
4561/** 4561/**
4562 * iwl_rx_handle - Main entry function for receiving responses from the uCode 4562 * iwl4965_rx_handle - Main entry function for receiving responses from the uCode
4563 * 4563 *
4564 * Uses the priv->rx_handlers callback function array to invoke 4564 * Uses the priv->rx_handlers callback function array to invoke
4565 * the appropriate handlers, including command responses, 4565 * the appropriate handlers, including command responses,
4566 * frame-received notifications, and other notifications. 4566 * frame-received notifications, and other notifications.
4567 */ 4567 */
4568static void iwl_rx_handle(struct iwl_priv *priv) 4568static void iwl4965_rx_handle(struct iwl4965_priv *priv)
4569{ 4569{
4570 struct iwl_rx_mem_buffer *rxb; 4570 struct iwl4965_rx_mem_buffer *rxb;
4571 struct iwl_rx_packet *pkt; 4571 struct iwl4965_rx_packet *pkt;
4572 struct iwl_rx_queue *rxq = &priv->rxq; 4572 struct iwl4965_rx_queue *rxq = &priv->rxq;
4573 u32 r, i; 4573 u32 r, i;
4574 int reclaim; 4574 int reclaim;
4575 unsigned long flags; 4575 unsigned long flags;
4576 4576
4577 r = iwl_hw_get_rx_read(priv); 4577 r = iwl4965_hw_get_rx_read(priv);
4578 i = rxq->read; 4578 i = rxq->read;
4579 4579
4580 /* Rx interrupt, but nothing sent from uCode */ 4580 /* Rx interrupt, but nothing sent from uCode */
@@ -4594,7 +4594,7 @@ static void iwl_rx_handle(struct iwl_priv *priv)
4594 pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, 4594 pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr,
4595 IWL_RX_BUF_SIZE, 4595 IWL_RX_BUF_SIZE,
4596 PCI_DMA_FROMDEVICE); 4596 PCI_DMA_FROMDEVICE);
4597 pkt = (struct iwl_rx_packet *)rxb->skb->data; 4597 pkt = (struct iwl4965_rx_packet *)rxb->skb->data;
4598 4598
4599 /* Reclaim a command buffer only if this packet is a response 4599 /* Reclaim a command buffer only if this packet is a response
4600 * to a (driver-originated) command. 4600 * to a (driver-originated) command.
@@ -4611,7 +4611,7 @@ static void iwl_rx_handle(struct iwl_priv *priv)
4611 4611
4612 /* Based on type of command response or notification, 4612 /* Based on type of command response or notification,
4613 * handle those that need handling via function in 4613 * handle those that need handling via function in
4614 * rx_handlers table. See iwl_setup_rx_handlers() */ 4614 * rx_handlers table. See iwl4965_setup_rx_handlers() */
4615 if (priv->rx_handlers[pkt->hdr.cmd]) { 4615 if (priv->rx_handlers[pkt->hdr.cmd]) {
4616 IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR, 4616 IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR,
4617 "r = %d, i = %d, %s, 0x%02x\n", r, i, 4617 "r = %d, i = %d, %s, 0x%02x\n", r, i,
@@ -4627,10 +4627,10 @@ static void iwl_rx_handle(struct iwl_priv *priv)
4627 4627
4628 if (reclaim) { 4628 if (reclaim) {
4629 /* Invoke any callbacks, transfer the skb to caller, 4629 /* Invoke any callbacks, transfer the skb to caller,
4630 * and fire off the (possibly) blocking iwl_send_cmd() 4630 * and fire off the (possibly) blocking iwl4965_send_cmd()
4631 * as we reclaim the driver command queue */ 4631 * as we reclaim the driver command queue */
4632 if (rxb && rxb->skb) 4632 if (rxb && rxb->skb)
4633 iwl_tx_cmd_complete(priv, rxb); 4633 iwl4965_tx_cmd_complete(priv, rxb);
4634 else 4634 else
4635 IWL_WARNING("Claim null rxb?\n"); 4635 IWL_WARNING("Claim null rxb?\n");
4636 } 4636 }
@@ -4654,11 +4654,11 @@ static void iwl_rx_handle(struct iwl_priv *priv)
4654 4654
4655 /* Backtrack one entry */ 4655 /* Backtrack one entry */
4656 priv->rxq.read = i; 4656 priv->rxq.read = i;
4657 iwl_rx_queue_restock(priv); 4657 iwl4965_rx_queue_restock(priv);
4658} 4658}
4659 4659
4660static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, 4660static int iwl4965_tx_queue_update_write_ptr(struct iwl4965_priv *priv,
4661 struct iwl_tx_queue *txq) 4661 struct iwl4965_tx_queue *txq)
4662{ 4662{
4663 u32 reg = 0; 4663 u32 reg = 0;
4664 int rc = 0; 4664 int rc = 0;
@@ -4672,27 +4672,27 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv,
4672 /* wake up nic if it's powered down ... 4672 /* wake up nic if it's powered down ...
4673 * uCode will wake up, and interrupt us again, so next 4673 * uCode will wake up, and interrupt us again, so next
4674 * time we'll skip this part. */ 4674 * time we'll skip this part. */
4675 reg = iwl_read32(priv, CSR_UCODE_DRV_GP1); 4675 reg = iwl4965_read32(priv, CSR_UCODE_DRV_GP1);
4676 4676
4677 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { 4677 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
4678 IWL_DEBUG_INFO("Requesting wakeup, GP1 = 0x%x\n", reg); 4678 IWL_DEBUG_INFO("Requesting wakeup, GP1 = 0x%x\n", reg);
4679 iwl_set_bit(priv, CSR_GP_CNTRL, 4679 iwl4965_set_bit(priv, CSR_GP_CNTRL,
4680 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 4680 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
4681 return rc; 4681 return rc;
4682 } 4682 }
4683 4683
4684 /* restore this queue's parameters in nic hardware. */ 4684 /* restore this queue's parameters in nic hardware. */
4685 rc = iwl_grab_nic_access(priv); 4685 rc = iwl4965_grab_nic_access(priv);
4686 if (rc) 4686 if (rc)
4687 return rc; 4687 return rc;
4688 iwl_write_direct32(priv, HBUS_TARG_WRPTR, 4688 iwl4965_write_direct32(priv, HBUS_TARG_WRPTR,
4689 txq->q.write_ptr | (txq_id << 8)); 4689 txq->q.write_ptr | (txq_id << 8));
4690 iwl_release_nic_access(priv); 4690 iwl4965_release_nic_access(priv);
4691 4691
4692 /* else not in power-save mode, uCode will never sleep when we're 4692 /* else not in power-save mode, uCode will never sleep when we're
4693 * trying to tx (during RFKILL, we're not trying to tx). */ 4693 * trying to tx (during RFKILL, we're not trying to tx). */
4694 } else 4694 } else
4695 iwl_write32(priv, HBUS_TARG_WRPTR, 4695 iwl4965_write32(priv, HBUS_TARG_WRPTR,
4696 txq->q.write_ptr | (txq_id << 8)); 4696 txq->q.write_ptr | (txq_id << 8));
4697 4697
4698 txq->need_update = 0; 4698 txq->need_update = 0;
@@ -4701,12 +4701,12 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv,
4701} 4701}
4702 4702
4703#ifdef CONFIG_IWL4965_DEBUG 4703#ifdef CONFIG_IWL4965_DEBUG
4704static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon) 4704static void iwl4965_print_rx_config_cmd(struct iwl4965_rxon_cmd *rxon)
4705{ 4705{
4706 DECLARE_MAC_BUF(mac); 4706 DECLARE_MAC_BUF(mac);
4707 4707
4708 IWL_DEBUG_RADIO("RX CONFIG:\n"); 4708 IWL_DEBUG_RADIO("RX CONFIG:\n");
4709 iwl_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); 4709 iwl4965_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
4710 IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); 4710 IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel));
4711 IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); 4711 IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags));
4712 IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n", 4712 IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n",
@@ -4723,24 +4723,24 @@ static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon)
4723} 4723}
4724#endif 4724#endif
4725 4725
4726static void iwl_enable_interrupts(struct iwl_priv *priv) 4726static void iwl4965_enable_interrupts(struct iwl4965_priv *priv)
4727{ 4727{
4728 IWL_DEBUG_ISR("Enabling interrupts\n"); 4728 IWL_DEBUG_ISR("Enabling interrupts\n");
4729 set_bit(STATUS_INT_ENABLED, &priv->status); 4729 set_bit(STATUS_INT_ENABLED, &priv->status);
4730 iwl_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK); 4730 iwl4965_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK);
4731} 4731}
4732 4732
4733static inline void iwl_disable_interrupts(struct iwl_priv *priv) 4733static inline void iwl4965_disable_interrupts(struct iwl4965_priv *priv)
4734{ 4734{
4735 clear_bit(STATUS_INT_ENABLED, &priv->status); 4735 clear_bit(STATUS_INT_ENABLED, &priv->status);
4736 4736
4737 /* disable interrupts from uCode/NIC to host */ 4737 /* disable interrupts from uCode/NIC to host */
4738 iwl_write32(priv, CSR_INT_MASK, 0x00000000); 4738 iwl4965_write32(priv, CSR_INT_MASK, 0x00000000);
4739 4739
4740 /* acknowledge/clear/reset any interrupts still pending 4740 /* acknowledge/clear/reset any interrupts still pending
4741 * from uCode or flow handler (Rx/Tx DMA) */ 4741 * from uCode or flow handler (Rx/Tx DMA) */
4742 iwl_write32(priv, CSR_INT, 0xffffffff); 4742 iwl4965_write32(priv, CSR_INT, 0xffffffff);
4743 iwl_write32(priv, CSR_FH_INT_STATUS, 0xffffffff); 4743 iwl4965_write32(priv, CSR_FH_INT_STATUS, 0xffffffff);
4744 IWL_DEBUG_ISR("Disabled interrupts\n"); 4744 IWL_DEBUG_ISR("Disabled interrupts\n");
4745} 4745}
4746 4746
@@ -4767,7 +4767,7 @@ static const char *desc_lookup(int i)
4767#define ERROR_START_OFFSET (1 * sizeof(u32)) 4767#define ERROR_START_OFFSET (1 * sizeof(u32))
4768#define ERROR_ELEM_SIZE (7 * sizeof(u32)) 4768#define ERROR_ELEM_SIZE (7 * sizeof(u32))
4769 4769
4770static void iwl_dump_nic_error_log(struct iwl_priv *priv) 4770static void iwl4965_dump_nic_error_log(struct iwl4965_priv *priv)
4771{ 4771{
4772 u32 data2, line; 4772 u32 data2, line;
4773 u32 desc, time, count, base, data1; 4773 u32 desc, time, count, base, data1;
@@ -4776,18 +4776,18 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv)
4776 4776
4777 base = le32_to_cpu(priv->card_alive.error_event_table_ptr); 4777 base = le32_to_cpu(priv->card_alive.error_event_table_ptr);
4778 4778
4779 if (!iwl_hw_valid_rtc_data_addr(base)) { 4779 if (!iwl4965_hw_valid_rtc_data_addr(base)) {
4780 IWL_ERROR("Not valid error log pointer 0x%08X\n", base); 4780 IWL_ERROR("Not valid error log pointer 0x%08X\n", base);
4781 return; 4781 return;
4782 } 4782 }
4783 4783
4784 rc = iwl_grab_nic_access(priv); 4784 rc = iwl4965_grab_nic_access(priv);
4785 if (rc) { 4785 if (rc) {
4786 IWL_WARNING("Can not read from adapter at this time.\n"); 4786 IWL_WARNING("Can not read from adapter at this time.\n");
4787 return; 4787 return;
4788 } 4788 }
4789 4789
4790 count = iwl_read_targ_mem(priv, base); 4790 count = iwl4965_read_targ_mem(priv, base);
4791 4791
4792 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { 4792 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
4793 IWL_ERROR("Start IWL Error Log Dump:\n"); 4793 IWL_ERROR("Start IWL Error Log Dump:\n");
@@ -4795,15 +4795,15 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv)
4795 priv->status, priv->config, count); 4795 priv->status, priv->config, count);
4796 } 4796 }
4797 4797
4798 desc = iwl_read_targ_mem(priv, base + 1 * sizeof(u32)); 4798 desc = iwl4965_read_targ_mem(priv, base + 1 * sizeof(u32));
4799 blink1 = iwl_read_targ_mem(priv, base + 3 * sizeof(u32)); 4799 blink1 = iwl4965_read_targ_mem(priv, base + 3 * sizeof(u32));
4800 blink2 = iwl_read_targ_mem(priv, base + 4 * sizeof(u32)); 4800 blink2 = iwl4965_read_targ_mem(priv, base + 4 * sizeof(u32));
4801 ilink1 = iwl_read_targ_mem(priv, base + 5 * sizeof(u32)); 4801 ilink1 = iwl4965_read_targ_mem(priv, base + 5 * sizeof(u32));
4802 ilink2 = iwl_read_targ_mem(priv, base + 6 * sizeof(u32)); 4802 ilink2 = iwl4965_read_targ_mem(priv, base + 6 * sizeof(u32));
4803 data1 = iwl_read_targ_mem(priv, base + 7 * sizeof(u32)); 4803 data1 = iwl4965_read_targ_mem(priv, base + 7 * sizeof(u32));
4804 data2 = iwl_read_targ_mem(priv, base + 8 * sizeof(u32)); 4804 data2 = iwl4965_read_targ_mem(priv, base + 8 * sizeof(u32));
4805 line = iwl_read_targ_mem(priv, base + 9 * sizeof(u32)); 4805 line = iwl4965_read_targ_mem(priv, base + 9 * sizeof(u32));
4806 time = iwl_read_targ_mem(priv, base + 11 * sizeof(u32)); 4806 time = iwl4965_read_targ_mem(priv, base + 11 * sizeof(u32));
4807 4807
4808 IWL_ERROR("Desc Time " 4808 IWL_ERROR("Desc Time "
4809 "data1 data2 line\n"); 4809 "data1 data2 line\n");
@@ -4813,17 +4813,17 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv)
4813 IWL_ERROR("0x%05X 0x%05X 0x%05X 0x%05X\n", blink1, blink2, 4813 IWL_ERROR("0x%05X 0x%05X 0x%05X 0x%05X\n", blink1, blink2,
4814 ilink1, ilink2); 4814 ilink1, ilink2);
4815 4815
4816 iwl_release_nic_access(priv); 4816 iwl4965_release_nic_access(priv);
4817} 4817}
4818 4818
4819#define EVENT_START_OFFSET (4 * sizeof(u32)) 4819#define EVENT_START_OFFSET (4 * sizeof(u32))
4820 4820
4821/** 4821/**
4822 * iwl_print_event_log - Dump error event log to syslog 4822 * iwl4965_print_event_log - Dump error event log to syslog
4823 * 4823 *
4824 * NOTE: Must be called with iwl_grab_nic_access() already obtained! 4824 * NOTE: Must be called with iwl4965_grab_nic_access() already obtained!
4825 */ 4825 */
4826static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, 4826static void iwl4965_print_event_log(struct iwl4965_priv *priv, u32 start_idx,
4827 u32 num_events, u32 mode) 4827 u32 num_events, u32 mode)
4828{ 4828{
4829 u32 i; 4829 u32 i;
@@ -4847,21 +4847,21 @@ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx,
4847 /* "time" is actually "data" for mode 0 (no timestamp). 4847 /* "time" is actually "data" for mode 0 (no timestamp).
4848 * place event id # at far right for easier visual parsing. */ 4848 * place event id # at far right for easier visual parsing. */
4849 for (i = 0; i < num_events; i++) { 4849 for (i = 0; i < num_events; i++) {
4850 ev = iwl_read_targ_mem(priv, ptr); 4850 ev = iwl4965_read_targ_mem(priv, ptr);
4851 ptr += sizeof(u32); 4851 ptr += sizeof(u32);
4852 time = iwl_read_targ_mem(priv, ptr); 4852 time = iwl4965_read_targ_mem(priv, ptr);
4853 ptr += sizeof(u32); 4853 ptr += sizeof(u32);
4854 if (mode == 0) 4854 if (mode == 0)
4855 IWL_ERROR("0x%08x\t%04u\n", time, ev); /* data, ev */ 4855 IWL_ERROR("0x%08x\t%04u\n", time, ev); /* data, ev */
4856 else { 4856 else {
4857 data = iwl_read_targ_mem(priv, ptr); 4857 data = iwl4965_read_targ_mem(priv, ptr);
4858 ptr += sizeof(u32); 4858 ptr += sizeof(u32);
4859 IWL_ERROR("%010u\t0x%08x\t%04u\n", time, data, ev); 4859 IWL_ERROR("%010u\t0x%08x\t%04u\n", time, data, ev);
4860 } 4860 }
4861 } 4861 }
4862} 4862}
4863 4863
4864static void iwl_dump_nic_event_log(struct iwl_priv *priv) 4864static void iwl4965_dump_nic_event_log(struct iwl4965_priv *priv)
4865{ 4865{
4866 int rc; 4866 int rc;
4867 u32 base; /* SRAM byte address of event log header */ 4867 u32 base; /* SRAM byte address of event log header */
@@ -4872,29 +4872,29 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv)
4872 u32 size; /* # entries that we'll print */ 4872 u32 size; /* # entries that we'll print */
4873 4873
4874 base = le32_to_cpu(priv->card_alive.log_event_table_ptr); 4874 base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
4875 if (!iwl_hw_valid_rtc_data_addr(base)) { 4875 if (!iwl4965_hw_valid_rtc_data_addr(base)) {
4876 IWL_ERROR("Invalid event log pointer 0x%08X\n", base); 4876 IWL_ERROR("Invalid event log pointer 0x%08X\n", base);
4877 return; 4877 return;
4878 } 4878 }
4879 4879
4880 rc = iwl_grab_nic_access(priv); 4880 rc = iwl4965_grab_nic_access(priv);
4881 if (rc) { 4881 if (rc) {
4882 IWL_WARNING("Can not read from adapter at this time.\n"); 4882 IWL_WARNING("Can not read from adapter at this time.\n");
4883 return; 4883 return;
4884 } 4884 }
4885 4885
4886 /* event log header */ 4886 /* event log header */
4887 capacity = iwl_read_targ_mem(priv, base); 4887 capacity = iwl4965_read_targ_mem(priv, base);
4888 mode = iwl_read_targ_mem(priv, base + (1 * sizeof(u32))); 4888 mode = iwl4965_read_targ_mem(priv, base + (1 * sizeof(u32)));
4889 num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32))); 4889 num_wraps = iwl4965_read_targ_mem(priv, base + (2 * sizeof(u32)));
4890 next_entry = iwl_read_targ_mem(priv, base + (3 * sizeof(u32))); 4890 next_entry = iwl4965_read_targ_mem(priv, base + (3 * sizeof(u32)));
4891 4891
4892 size = num_wraps ? capacity : next_entry; 4892 size = num_wraps ? capacity : next_entry;
4893 4893
4894 /* bail out if nothing in log */ 4894 /* bail out if nothing in log */
4895 if (size == 0) { 4895 if (size == 0) {
4896 IWL_ERROR("Start IWL Event Log Dump: nothing in log\n"); 4896 IWL_ERROR("Start IWL Event Log Dump: nothing in log\n");
4897 iwl_release_nic_access(priv); 4897 iwl4965_release_nic_access(priv);
4898 return; 4898 return;
4899 } 4899 }
4900 4900
@@ -4904,31 +4904,31 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv)
4904 /* if uCode has wrapped back to top of log, start at the oldest entry, 4904 /* if uCode has wrapped back to top of log, start at the oldest entry,
4905 * i.e the next one that uCode would fill. */ 4905 * i.e the next one that uCode would fill. */
4906 if (num_wraps) 4906 if (num_wraps)
4907 iwl_print_event_log(priv, next_entry, 4907 iwl4965_print_event_log(priv, next_entry,
4908 capacity - next_entry, mode); 4908 capacity - next_entry, mode);
4909 4909
4910 /* (then/else) start at top of log */ 4910 /* (then/else) start at top of log */
4911 iwl_print_event_log(priv, 0, next_entry, mode); 4911 iwl4965_print_event_log(priv, 0, next_entry, mode);
4912 4912
4913 iwl_release_nic_access(priv); 4913 iwl4965_release_nic_access(priv);
4914} 4914}
4915 4915
4916/** 4916/**
4917 * iwl_irq_handle_error - called for HW or SW error interrupt from card 4917 * iwl4965_irq_handle_error - called for HW or SW error interrupt from card
4918 */ 4918 */
4919static void iwl_irq_handle_error(struct iwl_priv *priv) 4919static void iwl4965_irq_handle_error(struct iwl4965_priv *priv)
4920{ 4920{
4921 /* Set the FW error flag -- cleared on iwl_down */ 4921 /* Set the FW error flag -- cleared on iwl4965_down */
4922 set_bit(STATUS_FW_ERROR, &priv->status); 4922 set_bit(STATUS_FW_ERROR, &priv->status);
4923 4923
4924 /* Cancel currently queued command. */ 4924 /* Cancel currently queued command. */
4925 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 4925 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
4926 4926
4927#ifdef CONFIG_IWL4965_DEBUG 4927#ifdef CONFIG_IWL4965_DEBUG
4928 if (iwl_debug_level & IWL_DL_FW_ERRORS) { 4928 if (iwl4965_debug_level & IWL_DL_FW_ERRORS) {
4929 iwl_dump_nic_error_log(priv); 4929 iwl4965_dump_nic_error_log(priv);
4930 iwl_dump_nic_event_log(priv); 4930 iwl4965_dump_nic_event_log(priv);
4931 iwl_print_rx_config_cmd(&priv->staging_rxon); 4931 iwl4965_print_rx_config_cmd(&priv->staging_rxon);
4932 } 4932 }
4933#endif 4933#endif
4934 4934
@@ -4942,7 +4942,7 @@ static void iwl_irq_handle_error(struct iwl_priv *priv)
4942 IWL_DEBUG(IWL_DL_INFO | IWL_DL_FW_ERRORS, 4942 IWL_DEBUG(IWL_DL_INFO | IWL_DL_FW_ERRORS,
4943 "Restarting adapter due to uCode error.\n"); 4943 "Restarting adapter due to uCode error.\n");
4944 4944
4945 if (iwl_is_associated(priv)) { 4945 if (iwl4965_is_associated(priv)) {
4946 memcpy(&priv->recovery_rxon, &priv->active_rxon, 4946 memcpy(&priv->recovery_rxon, &priv->active_rxon,
4947 sizeof(priv->recovery_rxon)); 4947 sizeof(priv->recovery_rxon));
4948 priv->error_recovering = 1; 4948 priv->error_recovering = 1;
@@ -4951,16 +4951,16 @@ static void iwl_irq_handle_error(struct iwl_priv *priv)
4951 } 4951 }
4952} 4952}
4953 4953
4954static void iwl_error_recovery(struct iwl_priv *priv) 4954static void iwl4965_error_recovery(struct iwl4965_priv *priv)
4955{ 4955{
4956 unsigned long flags; 4956 unsigned long flags;
4957 4957
4958 memcpy(&priv->staging_rxon, &priv->recovery_rxon, 4958 memcpy(&priv->staging_rxon, &priv->recovery_rxon,
4959 sizeof(priv->staging_rxon)); 4959 sizeof(priv->staging_rxon));
4960 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 4960 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
4961 iwl_commit_rxon(priv); 4961 iwl4965_commit_rxon(priv);
4962 4962
4963 iwl_rxon_add_station(priv, priv->bssid, 1); 4963 iwl4965_rxon_add_station(priv, priv->bssid, 1);
4964 4964
4965 spin_lock_irqsave(&priv->lock, flags); 4965 spin_lock_irqsave(&priv->lock, flags);
4966 priv->assoc_id = le16_to_cpu(priv->staging_rxon.assoc_id); 4966 priv->assoc_id = le16_to_cpu(priv->staging_rxon.assoc_id);
@@ -4968,7 +4968,7 @@ static void iwl_error_recovery(struct iwl_priv *priv)
4968 spin_unlock_irqrestore(&priv->lock, flags); 4968 spin_unlock_irqrestore(&priv->lock, flags);
4969} 4969}
4970 4970
4971static void iwl_irq_tasklet(struct iwl_priv *priv) 4971static void iwl4965_irq_tasklet(struct iwl4965_priv *priv)
4972{ 4972{
4973 u32 inta, handled = 0; 4973 u32 inta, handled = 0;
4974 u32 inta_fh; 4974 u32 inta_fh;
@@ -4982,18 +4982,18 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4982 /* Ack/clear/reset pending uCode interrupts. 4982 /* Ack/clear/reset pending uCode interrupts.
4983 * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, 4983 * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS,
4984 * and will clear only when CSR_FH_INT_STATUS gets cleared. */ 4984 * and will clear only when CSR_FH_INT_STATUS gets cleared. */
4985 inta = iwl_read32(priv, CSR_INT); 4985 inta = iwl4965_read32(priv, CSR_INT);
4986 iwl_write32(priv, CSR_INT, inta); 4986 iwl4965_write32(priv, CSR_INT, inta);
4987 4987
4988 /* Ack/clear/reset pending flow-handler (DMA) interrupts. 4988 /* Ack/clear/reset pending flow-handler (DMA) interrupts.
4989 * Any new interrupts that happen after this, either while we're 4989 * Any new interrupts that happen after this, either while we're
4990 * in this tasklet, or later, will show up in next ISR/tasklet. */ 4990 * in this tasklet, or later, will show up in next ISR/tasklet. */
4991 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 4991 inta_fh = iwl4965_read32(priv, CSR_FH_INT_STATUS);
4992 iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh); 4992 iwl4965_write32(priv, CSR_FH_INT_STATUS, inta_fh);
4993 4993
4994#ifdef CONFIG_IWL4965_DEBUG 4994#ifdef CONFIG_IWL4965_DEBUG
4995 if (iwl_debug_level & IWL_DL_ISR) { 4995 if (iwl4965_debug_level & IWL_DL_ISR) {
4996 inta_mask = iwl_read32(priv, CSR_INT_MASK); /* just for debug */ 4996 inta_mask = iwl4965_read32(priv, CSR_INT_MASK); /* just for debug */
4997 IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 4997 IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
4998 inta, inta_mask, inta_fh); 4998 inta, inta_mask, inta_fh);
4999 } 4999 }
@@ -5013,9 +5013,9 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
5013 IWL_ERROR("Microcode HW error detected. Restarting.\n"); 5013 IWL_ERROR("Microcode HW error detected. Restarting.\n");
5014 5014
5015 /* Tell the device to stop sending interrupts */ 5015 /* Tell the device to stop sending interrupts */
5016 iwl_disable_interrupts(priv); 5016 iwl4965_disable_interrupts(priv);
5017 5017
5018 iwl_irq_handle_error(priv); 5018 iwl4965_irq_handle_error(priv);
5019 5019
5020 handled |= CSR_INT_BIT_HW_ERR; 5020 handled |= CSR_INT_BIT_HW_ERR;
5021 5021
@@ -5025,7 +5025,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
5025 } 5025 }
5026 5026
5027#ifdef CONFIG_IWL4965_DEBUG 5027#ifdef CONFIG_IWL4965_DEBUG
5028 if (iwl_debug_level & (IWL_DL_ISR)) { 5028 if (iwl4965_debug_level & (IWL_DL_ISR)) {
5029 /* NIC fires this, but we don't use it, redundant with WAKEUP */ 5029 /* NIC fires this, but we don't use it, redundant with WAKEUP */
5030 if (inta & CSR_INT_BIT_MAC_CLK_ACTV) 5030 if (inta & CSR_INT_BIT_MAC_CLK_ACTV)
5031 IWL_DEBUG_ISR("Microcode started or stopped.\n"); 5031 IWL_DEBUG_ISR("Microcode started or stopped.\n");
@@ -5041,7 +5041,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
5041 /* HW RF KILL switch toggled (4965 only) */ 5041 /* HW RF KILL switch toggled (4965 only) */
5042 if (inta & CSR_INT_BIT_RF_KILL) { 5042 if (inta & CSR_INT_BIT_RF_KILL) {
5043 int hw_rf_kill = 0; 5043 int hw_rf_kill = 0;
5044 if (!(iwl_read32(priv, CSR_GP_CNTRL) & 5044 if (!(iwl4965_read32(priv, CSR_GP_CNTRL) &
5045 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) 5045 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW))
5046 hw_rf_kill = 1; 5046 hw_rf_kill = 1;
5047 5047
@@ -5071,20 +5071,20 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
5071 if (inta & CSR_INT_BIT_SW_ERR) { 5071 if (inta & CSR_INT_BIT_SW_ERR) {
5072 IWL_ERROR("Microcode SW error detected. Restarting 0x%X.\n", 5072 IWL_ERROR("Microcode SW error detected. Restarting 0x%X.\n",
5073 inta); 5073 inta);
5074 iwl_irq_handle_error(priv); 5074 iwl4965_irq_handle_error(priv);
5075 handled |= CSR_INT_BIT_SW_ERR; 5075 handled |= CSR_INT_BIT_SW_ERR;
5076 } 5076 }
5077 5077
5078 /* uCode wakes up after power-down sleep */ 5078 /* uCode wakes up after power-down sleep */
5079 if (inta & CSR_INT_BIT_WAKEUP) { 5079 if (inta & CSR_INT_BIT_WAKEUP) {
5080 IWL_DEBUG_ISR("Wakeup interrupt\n"); 5080 IWL_DEBUG_ISR("Wakeup interrupt\n");
5081 iwl_rx_queue_update_write_ptr(priv, &priv->rxq); 5081 iwl4965_rx_queue_update_write_ptr(priv, &priv->rxq);
5082 iwl_tx_queue_update_write_ptr(priv, &priv->txq[0]); 5082 iwl4965_tx_queue_update_write_ptr(priv, &priv->txq[0]);
5083 iwl_tx_queue_update_write_ptr(priv, &priv->txq[1]); 5083 iwl4965_tx_queue_update_write_ptr(priv, &priv->txq[1]);
5084 iwl_tx_queue_update_write_ptr(priv, &priv->txq[2]); 5084 iwl4965_tx_queue_update_write_ptr(priv, &priv->txq[2]);
5085 iwl_tx_queue_update_write_ptr(priv, &priv->txq[3]); 5085 iwl4965_tx_queue_update_write_ptr(priv, &priv->txq[3]);
5086 iwl_tx_queue_update_write_ptr(priv, &priv->txq[4]); 5086 iwl4965_tx_queue_update_write_ptr(priv, &priv->txq[4]);
5087 iwl_tx_queue_update_write_ptr(priv, &priv->txq[5]); 5087 iwl4965_tx_queue_update_write_ptr(priv, &priv->txq[5]);
5088 5088
5089 handled |= CSR_INT_BIT_WAKEUP; 5089 handled |= CSR_INT_BIT_WAKEUP;
5090 } 5090 }
@@ -5093,7 +5093,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
5093 * Rx "responses" (frame-received notification), and other 5093 * Rx "responses" (frame-received notification), and other
5094 * notifications from uCode come through here*/ 5094 * notifications from uCode come through here*/
5095 if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { 5095 if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) {
5096 iwl_rx_handle(priv); 5096 iwl4965_rx_handle(priv);
5097 handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); 5097 handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX);
5098 } 5098 }
5099 5099
@@ -5112,13 +5112,13 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
5112 } 5112 }
5113 5113
5114 /* Re-enable all interrupts */ 5114 /* Re-enable all interrupts */
5115 iwl_enable_interrupts(priv); 5115 iwl4965_enable_interrupts(priv);
5116 5116
5117#ifdef CONFIG_IWL4965_DEBUG 5117#ifdef CONFIG_IWL4965_DEBUG
5118 if (iwl_debug_level & (IWL_DL_ISR)) { 5118 if (iwl4965_debug_level & (IWL_DL_ISR)) {
5119 inta = iwl_read32(priv, CSR_INT); 5119 inta = iwl4965_read32(priv, CSR_INT);
5120 inta_mask = iwl_read32(priv, CSR_INT_MASK); 5120 inta_mask = iwl4965_read32(priv, CSR_INT_MASK);
5121 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 5121 inta_fh = iwl4965_read32(priv, CSR_FH_INT_STATUS);
5122 IWL_DEBUG_ISR("End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " 5122 IWL_DEBUG_ISR("End inta 0x%08x, enabled 0x%08x, fh 0x%08x, "
5123 "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); 5123 "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags);
5124 } 5124 }
@@ -5126,9 +5126,9 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
5126 spin_unlock_irqrestore(&priv->lock, flags); 5126 spin_unlock_irqrestore(&priv->lock, flags);
5127} 5127}
5128 5128
5129static irqreturn_t iwl_isr(int irq, void *data) 5129static irqreturn_t iwl4965_isr(int irq, void *data)
5130{ 5130{
5131 struct iwl_priv *priv = data; 5131 struct iwl4965_priv *priv = data;
5132 u32 inta, inta_mask; 5132 u32 inta, inta_mask;
5133 u32 inta_fh; 5133 u32 inta_fh;
5134 if (!priv) 5134 if (!priv)
@@ -5140,12 +5140,12 @@ static irqreturn_t iwl_isr(int irq, void *data)
5140 * back-to-back ISRs and sporadic interrupts from our NIC. 5140 * back-to-back ISRs and sporadic interrupts from our NIC.
5141 * If we have something to service, the tasklet will re-enable ints. 5141 * If we have something to service, the tasklet will re-enable ints.
5142 * If we *don't* have something, we'll re-enable before leaving here. */ 5142 * If we *don't* have something, we'll re-enable before leaving here. */
5143 inta_mask = iwl_read32(priv, CSR_INT_MASK); /* just for debug */ 5143 inta_mask = iwl4965_read32(priv, CSR_INT_MASK); /* just for debug */
5144 iwl_write32(priv, CSR_INT_MASK, 0x00000000); 5144 iwl4965_write32(priv, CSR_INT_MASK, 0x00000000);
5145 5145
5146 /* Discover which interrupts are active/pending */ 5146 /* Discover which interrupts are active/pending */
5147 inta = iwl_read32(priv, CSR_INT); 5147 inta = iwl4965_read32(priv, CSR_INT);
5148 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 5148 inta_fh = iwl4965_read32(priv, CSR_FH_INT_STATUS);
5149 5149
5150 /* Ignore interrupt if there's nothing in NIC to service. 5150 /* Ignore interrupt if there's nothing in NIC to service.
5151 * This may be due to IRQ shared with another device, 5151 * This may be due to IRQ shared with another device,
@@ -5165,7 +5165,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
5165 IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 5165 IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
5166 inta, inta_mask, inta_fh); 5166 inta, inta_mask, inta_fh);
5167 5167
5168 /* iwl_irq_tasklet() will service interrupts and re-enable them */ 5168 /* iwl4965_irq_tasklet() will service interrupts and re-enable them */
5169 tasklet_schedule(&priv->irq_tasklet); 5169 tasklet_schedule(&priv->irq_tasklet);
5170 5170
5171 unplugged: 5171 unplugged:
@@ -5174,18 +5174,18 @@ static irqreturn_t iwl_isr(int irq, void *data)
5174 5174
5175 none: 5175 none:
5176 /* re-enable interrupts here since we don't have anything to service. */ 5176 /* re-enable interrupts here since we don't have anything to service. */
5177 iwl_enable_interrupts(priv); 5177 iwl4965_enable_interrupts(priv);
5178 spin_unlock(&priv->lock); 5178 spin_unlock(&priv->lock);
5179 return IRQ_NONE; 5179 return IRQ_NONE;
5180} 5180}
5181 5181
5182/************************** EEPROM BANDS **************************** 5182/************************** EEPROM BANDS ****************************
5183 * 5183 *
5184 * The iwl_eeprom_band definitions below provide the mapping from the 5184 * The iwl4965_eeprom_band definitions below provide the mapping from the
5185 * EEPROM contents to the specific channel number supported for each 5185 * EEPROM contents to the specific channel number supported for each
5186 * band. 5186 * band.
5187 * 5187 *
5188 * For example, iwl_priv->eeprom.band_3_channels[4] from the band_3 5188 * For example, iwl4965_priv->eeprom.band_3_channels[4] from the band_3
5189 * definition below maps to physical channel 42 in the 5.2GHz spectrum. 5189 * definition below maps to physical channel 42 in the 5.2GHz spectrum.
5190 * The specific geography and calibration information for that channel 5190 * The specific geography and calibration information for that channel
5191 * is contained in the eeprom map itself. 5191 * is contained in the eeprom map itself.
@@ -5211,76 +5211,76 @@ static irqreturn_t iwl_isr(int irq, void *data)
5211 *********************************************************************/ 5211 *********************************************************************/
5212 5212
5213/* 2.4 GHz */ 5213/* 2.4 GHz */
5214static const u8 iwl_eeprom_band_1[14] = { 5214static const u8 iwl4965_eeprom_band_1[14] = {
5215 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 5215 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
5216}; 5216};
5217 5217
5218/* 5.2 GHz bands */ 5218/* 5.2 GHz bands */
5219static const u8 iwl_eeprom_band_2[] = { 5219static const u8 iwl4965_eeprom_band_2[] = {
5220 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16 5220 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16
5221}; 5221};
5222 5222
5223static const u8 iwl_eeprom_band_3[] = { /* 5205-5320MHz */ 5223static const u8 iwl4965_eeprom_band_3[] = { /* 5205-5320MHz */
5224 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 5224 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
5225}; 5225};
5226 5226
5227static const u8 iwl_eeprom_band_4[] = { /* 5500-5700MHz */ 5227static const u8 iwl4965_eeprom_band_4[] = { /* 5500-5700MHz */
5228 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 5228 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
5229}; 5229};
5230 5230
5231static const u8 iwl_eeprom_band_5[] = { /* 5725-5825MHz */ 5231static const u8 iwl4965_eeprom_band_5[] = { /* 5725-5825MHz */
5232 145, 149, 153, 157, 161, 165 5232 145, 149, 153, 157, 161, 165
5233}; 5233};
5234 5234
5235static u8 iwl_eeprom_band_6[] = { /* 2.4 FAT channel */ 5235static u8 iwl4965_eeprom_band_6[] = { /* 2.4 FAT channel */
5236 1, 2, 3, 4, 5, 6, 7 5236 1, 2, 3, 4, 5, 6, 7
5237}; 5237};
5238 5238
5239static u8 iwl_eeprom_band_7[] = { /* 5.2 FAT channel */ 5239static u8 iwl4965_eeprom_band_7[] = { /* 5.2 FAT channel */
5240 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157 5240 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157
5241}; 5241};
5242 5242
5243static void iwl_init_band_reference(const struct iwl_priv *priv, int band, 5243static void iwl4965_init_band_reference(const struct iwl4965_priv *priv, int band,
5244 int *eeprom_ch_count, 5244 int *eeprom_ch_count,
5245 const struct iwl_eeprom_channel 5245 const struct iwl4965_eeprom_channel
5246 **eeprom_ch_info, 5246 **eeprom_ch_info,
5247 const u8 **eeprom_ch_index) 5247 const u8 **eeprom_ch_index)
5248{ 5248{
5249 switch (band) { 5249 switch (band) {
5250 case 1: /* 2.4GHz band */ 5250 case 1: /* 2.4GHz band */
5251 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_1); 5251 *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_1);
5252 *eeprom_ch_info = priv->eeprom.band_1_channels; 5252 *eeprom_ch_info = priv->eeprom.band_1_channels;
5253 *eeprom_ch_index = iwl_eeprom_band_1; 5253 *eeprom_ch_index = iwl4965_eeprom_band_1;
5254 break; 5254 break;
5255 case 2: /* 5.2GHz band */ 5255 case 2: /* 5.2GHz band */
5256 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_2); 5256 *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_2);
5257 *eeprom_ch_info = priv->eeprom.band_2_channels; 5257 *eeprom_ch_info = priv->eeprom.band_2_channels;
5258 *eeprom_ch_index = iwl_eeprom_band_2; 5258 *eeprom_ch_index = iwl4965_eeprom_band_2;
5259 break; 5259 break;
5260 case 3: /* 5.2GHz band */ 5260 case 3: /* 5.2GHz band */
5261 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_3); 5261 *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_3);
5262 *eeprom_ch_info = priv->eeprom.band_3_channels; 5262 *eeprom_ch_info = priv->eeprom.band_3_channels;
5263 *eeprom_ch_index = iwl_eeprom_band_3; 5263 *eeprom_ch_index = iwl4965_eeprom_band_3;
5264 break; 5264 break;
5265 case 4: /* 5.2GHz band */ 5265 case 4: /* 5.2GHz band */
5266 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_4); 5266 *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_4);
5267 *eeprom_ch_info = priv->eeprom.band_4_channels; 5267 *eeprom_ch_info = priv->eeprom.band_4_channels;
5268 *eeprom_ch_index = iwl_eeprom_band_4; 5268 *eeprom_ch_index = iwl4965_eeprom_band_4;
5269 break; 5269 break;
5270 case 5: /* 5.2GHz band */ 5270 case 5: /* 5.2GHz band */
5271 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_5); 5271 *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_5);
5272 *eeprom_ch_info = priv->eeprom.band_5_channels; 5272 *eeprom_ch_info = priv->eeprom.band_5_channels;
5273 *eeprom_ch_index = iwl_eeprom_band_5; 5273 *eeprom_ch_index = iwl4965_eeprom_band_5;
5274 break; 5274 break;
5275 case 6: 5275 case 6:
5276 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_6); 5276 *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_6);
5277 *eeprom_ch_info = priv->eeprom.band_24_channels; 5277 *eeprom_ch_info = priv->eeprom.band_24_channels;
5278 *eeprom_ch_index = iwl_eeprom_band_6; 5278 *eeprom_ch_index = iwl4965_eeprom_band_6;
5279 break; 5279 break;
5280 case 7: 5280 case 7:
5281 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_7); 5281 *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_7);
5282 *eeprom_ch_info = priv->eeprom.band_52_channels; 5282 *eeprom_ch_info = priv->eeprom.band_52_channels;
5283 *eeprom_ch_index = iwl_eeprom_band_7; 5283 *eeprom_ch_index = iwl4965_eeprom_band_7;
5284 break; 5284 break;
5285 default: 5285 default:
5286 BUG(); 5286 BUG();
@@ -5288,7 +5288,7 @@ static void iwl_init_band_reference(const struct iwl_priv *priv, int band,
5288 } 5288 }
5289} 5289}
5290 5290
5291const struct iwl_channel_info *iwl_get_channel_info(const struct iwl_priv *priv, 5291const struct iwl4965_channel_info *iwl4965_get_channel_info(const struct iwl4965_priv *priv,
5292 int phymode, u16 channel) 5292 int phymode, u16 channel)
5293{ 5293{
5294 int i; 5294 int i;
@@ -5315,13 +5315,13 @@ const struct iwl_channel_info *iwl_get_channel_info(const struct iwl_priv *priv,
5315#define CHECK_AND_PRINT(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \ 5315#define CHECK_AND_PRINT(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \
5316 ? # x " " : "") 5316 ? # x " " : "")
5317 5317
5318static int iwl_init_channel_map(struct iwl_priv *priv) 5318static int iwl4965_init_channel_map(struct iwl4965_priv *priv)
5319{ 5319{
5320 int eeprom_ch_count = 0; 5320 int eeprom_ch_count = 0;
5321 const u8 *eeprom_ch_index = NULL; 5321 const u8 *eeprom_ch_index = NULL;
5322 const struct iwl_eeprom_channel *eeprom_ch_info = NULL; 5322 const struct iwl4965_eeprom_channel *eeprom_ch_info = NULL;
5323 int band, ch; 5323 int band, ch;
5324 struct iwl_channel_info *ch_info; 5324 struct iwl4965_channel_info *ch_info;
5325 5325
5326 if (priv->channel_count) { 5326 if (priv->channel_count) {
5327 IWL_DEBUG_INFO("Channel map already initialized.\n"); 5327 IWL_DEBUG_INFO("Channel map already initialized.\n");
@@ -5337,15 +5337,15 @@ static int iwl_init_channel_map(struct iwl_priv *priv)
5337 IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n"); 5337 IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n");
5338 5338
5339 priv->channel_count = 5339 priv->channel_count =
5340 ARRAY_SIZE(iwl_eeprom_band_1) + 5340 ARRAY_SIZE(iwl4965_eeprom_band_1) +
5341 ARRAY_SIZE(iwl_eeprom_band_2) + 5341 ARRAY_SIZE(iwl4965_eeprom_band_2) +
5342 ARRAY_SIZE(iwl_eeprom_band_3) + 5342 ARRAY_SIZE(iwl4965_eeprom_band_3) +
5343 ARRAY_SIZE(iwl_eeprom_band_4) + 5343 ARRAY_SIZE(iwl4965_eeprom_band_4) +
5344 ARRAY_SIZE(iwl_eeprom_band_5); 5344 ARRAY_SIZE(iwl4965_eeprom_band_5);
5345 5345
5346 IWL_DEBUG_INFO("Parsing data for %d channels.\n", priv->channel_count); 5346 IWL_DEBUG_INFO("Parsing data for %d channels.\n", priv->channel_count);
5347 5347
5348 priv->channel_info = kzalloc(sizeof(struct iwl_channel_info) * 5348 priv->channel_info = kzalloc(sizeof(struct iwl4965_channel_info) *
5349 priv->channel_count, GFP_KERNEL); 5349 priv->channel_count, GFP_KERNEL);
5350 if (!priv->channel_info) { 5350 if (!priv->channel_info) {
5351 IWL_ERROR("Could not allocate channel_info\n"); 5351 IWL_ERROR("Could not allocate channel_info\n");
@@ -5360,7 +5360,7 @@ static int iwl_init_channel_map(struct iwl_priv *priv)
5360 * what just in the EEPROM) */ 5360 * what just in the EEPROM) */
5361 for (band = 1; band <= 5; band++) { 5361 for (band = 1; band <= 5; band++) {
5362 5362
5363 iwl_init_band_reference(priv, band, &eeprom_ch_count, 5363 iwl4965_init_band_reference(priv, band, &eeprom_ch_count,
5364 &eeprom_ch_info, &eeprom_ch_index); 5364 &eeprom_ch_info, &eeprom_ch_index);
5365 5365
5366 /* Loop through each band adding each of the channels */ 5366 /* Loop through each band adding each of the channels */
@@ -5428,7 +5428,7 @@ static int iwl_init_channel_map(struct iwl_priv *priv)
5428 int phymode; 5428 int phymode;
5429 u8 fat_extension_chan; 5429 u8 fat_extension_chan;
5430 5430
5431 iwl_init_band_reference(priv, band, &eeprom_ch_count, 5431 iwl4965_init_band_reference(priv, band, &eeprom_ch_count,
5432 &eeprom_ch_info, &eeprom_ch_index); 5432 &eeprom_ch_info, &eeprom_ch_index);
5433 5433
5434 phymode = (band == 6) ? MODE_IEEE80211B : MODE_IEEE80211A; 5434 phymode = (band == 6) ? MODE_IEEE80211B : MODE_IEEE80211A;
@@ -5481,7 +5481,7 @@ static int iwl_init_channel_map(struct iwl_priv *priv)
5481#define IWL_PASSIVE_DWELL_BASE (100) 5481#define IWL_PASSIVE_DWELL_BASE (100)
5482#define IWL_CHANNEL_TUNE_TIME 5 5482#define IWL_CHANNEL_TUNE_TIME 5
5483 5483
5484static inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv, int phymode) 5484static inline u16 iwl4965_get_active_dwell_time(struct iwl4965_priv *priv, int phymode)
5485{ 5485{
5486 if (phymode == MODE_IEEE80211A) 5486 if (phymode == MODE_IEEE80211A)
5487 return IWL_ACTIVE_DWELL_TIME_52; 5487 return IWL_ACTIVE_DWELL_TIME_52;
@@ -5489,14 +5489,14 @@ static inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv, int phymode)
5489 return IWL_ACTIVE_DWELL_TIME_24; 5489 return IWL_ACTIVE_DWELL_TIME_24;
5490} 5490}
5491 5491
5492static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, int phymode) 5492static u16 iwl4965_get_passive_dwell_time(struct iwl4965_priv *priv, int phymode)
5493{ 5493{
5494 u16 active = iwl_get_active_dwell_time(priv, phymode); 5494 u16 active = iwl4965_get_active_dwell_time(priv, phymode);
5495 u16 passive = (phymode != MODE_IEEE80211A) ? 5495 u16 passive = (phymode != MODE_IEEE80211A) ?
5496 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : 5496 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 :
5497 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; 5497 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52;
5498 5498
5499 if (iwl_is_associated(priv)) { 5499 if (iwl4965_is_associated(priv)) {
5500 /* If we're associated, we clamp the maximum passive 5500 /* If we're associated, we clamp the maximum passive
5501 * dwell time to be 98% of the beacon interval (minus 5501 * dwell time to be 98% of the beacon interval (minus
5502 * 2 * channel tune time) */ 5502 * 2 * channel tune time) */
@@ -5512,30 +5512,30 @@ static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, int phymode)
5512 return passive; 5512 return passive;
5513} 5513}
5514 5514
5515static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode, 5515static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, int phymode,
5516 u8 is_active, u8 direct_mask, 5516 u8 is_active, u8 direct_mask,
5517 struct iwl_scan_channel *scan_ch) 5517 struct iwl4965_scan_channel *scan_ch)
5518{ 5518{
5519 const struct ieee80211_channel *channels = NULL; 5519 const struct ieee80211_channel *channels = NULL;
5520 const struct ieee80211_hw_mode *hw_mode; 5520 const struct ieee80211_hw_mode *hw_mode;
5521 const struct iwl_channel_info *ch_info; 5521 const struct iwl4965_channel_info *ch_info;
5522 u16 passive_dwell = 0; 5522 u16 passive_dwell = 0;
5523 u16 active_dwell = 0; 5523 u16 active_dwell = 0;
5524 int added, i; 5524 int added, i;
5525 5525
5526 hw_mode = iwl_get_hw_mode(priv, phymode); 5526 hw_mode = iwl4965_get_hw_mode(priv, phymode);
5527 if (!hw_mode) 5527 if (!hw_mode)
5528 return 0; 5528 return 0;
5529 5529
5530 channels = hw_mode->channels; 5530 channels = hw_mode->channels;
5531 5531
5532 active_dwell = iwl_get_active_dwell_time(priv, phymode); 5532 active_dwell = iwl4965_get_active_dwell_time(priv, phymode);
5533 passive_dwell = iwl_get_passive_dwell_time(priv, phymode); 5533 passive_dwell = iwl4965_get_passive_dwell_time(priv, phymode);
5534 5534
5535 for (i = 0, added = 0; i < hw_mode->num_channels; i++) { 5535 for (i = 0, added = 0; i < hw_mode->num_channels; i++) {
5536 if (channels[i].chan == 5536 if (channels[i].chan ==
5537 le16_to_cpu(priv->active_rxon.channel)) { 5537 le16_to_cpu(priv->active_rxon.channel)) {
5538 if (iwl_is_associated(priv)) { 5538 if (iwl4965_is_associated(priv)) {
5539 IWL_DEBUG_SCAN 5539 IWL_DEBUG_SCAN
5540 ("Skipping current channel %d\n", 5540 ("Skipping current channel %d\n",
5541 le16_to_cpu(priv->active_rxon.channel)); 5541 le16_to_cpu(priv->active_rxon.channel));
@@ -5546,7 +5546,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode,
5546 5546
5547 scan_ch->channel = channels[i].chan; 5547 scan_ch->channel = channels[i].chan;
5548 5548
5549 ch_info = iwl_get_channel_info(priv, phymode, scan_ch->channel); 5549 ch_info = iwl4965_get_channel_info(priv, phymode, scan_ch->channel);
5550 if (!is_channel_valid(ch_info)) { 5550 if (!is_channel_valid(ch_info)) {
5551 IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", 5551 IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n",
5552 scan_ch->channel); 5552 scan_ch->channel);
@@ -5597,7 +5597,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode,
5597 return added; 5597 return added;
5598} 5598}
5599 5599
5600static void iwl_reset_channel_flag(struct iwl_priv *priv) 5600static void iwl4965_reset_channel_flag(struct iwl4965_priv *priv)
5601{ 5601{
5602 int i, j; 5602 int i, j;
5603 for (i = 0; i < 3; i++) { 5603 for (i = 0; i < 3; i++) {
@@ -5607,13 +5607,13 @@ static void iwl_reset_channel_flag(struct iwl_priv *priv)
5607 } 5607 }
5608} 5608}
5609 5609
5610static void iwl_init_hw_rates(struct iwl_priv *priv, 5610static void iwl4965_init_hw_rates(struct iwl4965_priv *priv,
5611 struct ieee80211_rate *rates) 5611 struct ieee80211_rate *rates)
5612{ 5612{
5613 int i; 5613 int i;
5614 5614
5615 for (i = 0; i < IWL_RATE_COUNT; i++) { 5615 for (i = 0; i < IWL_RATE_COUNT; i++) {
5616 rates[i].rate = iwl_rates[i].ieee * 5; 5616 rates[i].rate = iwl4965_rates[i].ieee * 5;
5617 rates[i].val = i; /* Rate scaling will work on indexes */ 5617 rates[i].val = i; /* Rate scaling will work on indexes */
5618 rates[i].val2 = i; 5618 rates[i].val2 = i;
5619 rates[i].flags = IEEE80211_RATE_SUPPORTED; 5619 rates[i].flags = IEEE80211_RATE_SUPPORTED;
@@ -5625,7 +5625,7 @@ static void iwl_init_hw_rates(struct iwl_priv *priv,
5625 * If CCK 1M then set rate flag to CCK else CCK_2 5625 * If CCK 1M then set rate flag to CCK else CCK_2
5626 * which is CCK | PREAMBLE2 5626 * which is CCK | PREAMBLE2
5627 */ 5627 */
5628 rates[i].flags |= (iwl_rates[i].plcp == 10) ? 5628 rates[i].flags |= (iwl4965_rates[i].plcp == 10) ?
5629 IEEE80211_RATE_CCK : IEEE80211_RATE_CCK_2; 5629 IEEE80211_RATE_CCK : IEEE80211_RATE_CCK_2;
5630 } 5630 }
5631 5631
@@ -5638,11 +5638,11 @@ static void iwl_init_hw_rates(struct iwl_priv *priv,
5638} 5638}
5639 5639
5640/** 5640/**
5641 * iwl_init_geos - Initialize mac80211's geo/channel info based from eeprom 5641 * iwl4965_init_geos - Initialize mac80211's geo/channel info based from eeprom
5642 */ 5642 */
5643static int iwl_init_geos(struct iwl_priv *priv) 5643static int iwl4965_init_geos(struct iwl4965_priv *priv)
5644{ 5644{
5645 struct iwl_channel_info *ch; 5645 struct iwl4965_channel_info *ch;
5646 struct ieee80211_hw_mode *modes; 5646 struct ieee80211_hw_mode *modes;
5647 struct ieee80211_channel *channels; 5647 struct ieee80211_channel *channels;
5648 struct ieee80211_channel *geo_ch; 5648 struct ieee80211_channel *geo_ch;
@@ -5690,7 +5690,7 @@ static int iwl_init_geos(struct iwl_priv *priv)
5690 5690
5691 /* 5.2GHz channels start after the 2.4GHz channels */ 5691 /* 5.2GHz channels start after the 2.4GHz channels */
5692 modes[A].mode = MODE_IEEE80211A; 5692 modes[A].mode = MODE_IEEE80211A;
5693 modes[A].channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)]; 5693 modes[A].channels = &channels[ARRAY_SIZE(iwl4965_eeprom_band_1)];
5694 modes[A].rates = rates; 5694 modes[A].rates = rates;
5695 modes[A].num_rates = 8; /* just OFDM */ 5695 modes[A].num_rates = 8; /* just OFDM */
5696 modes[A].rates = &rates[4]; 5696 modes[A].rates = &rates[4];
@@ -5715,7 +5715,7 @@ static int iwl_init_geos(struct iwl_priv *priv)
5715 modes[G_11N].num_channels = 0; 5715 modes[G_11N].num_channels = 0;
5716 5716
5717 modes[A_11N].mode = MODE_IEEE80211A; 5717 modes[A_11N].mode = MODE_IEEE80211A;
5718 modes[A_11N].channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)]; 5718 modes[A_11N].channels = &channels[ARRAY_SIZE(iwl4965_eeprom_band_1)];
5719 modes[A_11N].rates = &rates[4]; 5719 modes[A_11N].rates = &rates[4];
5720 modes[A_11N].num_rates = 9; /* just OFDM */ 5720 modes[A_11N].num_rates = 9; /* just OFDM */
5721 modes[A_11N].num_channels = 0; 5721 modes[A_11N].num_channels = 0;
@@ -5723,7 +5723,7 @@ static int iwl_init_geos(struct iwl_priv *priv)
5723 priv->ieee_channels = channels; 5723 priv->ieee_channels = channels;
5724 priv->ieee_rates = rates; 5724 priv->ieee_rates = rates;
5725 5725
5726 iwl_init_hw_rates(priv, rates); 5726 iwl4965_init_hw_rates(priv, rates);
5727 5727
5728 for (i = 0, geo_ch = channels; i < priv->channel_count; i++) { 5728 for (i = 0, geo_ch = channels; i < priv->channel_count; i++) {
5729 ch = &priv->channel_info[i]; 5729 ch = &priv->channel_info[i];
@@ -5808,7 +5808,7 @@ static int iwl_init_geos(struct iwl_priv *priv)
5808 * 5808 *
5809 ******************************************************************************/ 5809 ******************************************************************************/
5810 5810
5811static void iwl_dealloc_ucode_pci(struct iwl_priv *priv) 5811static void iwl4965_dealloc_ucode_pci(struct iwl4965_priv *priv)
5812{ 5812{
5813 if (priv->ucode_code.v_addr != NULL) { 5813 if (priv->ucode_code.v_addr != NULL) {
5814 pci_free_consistent(priv->pci_dev, 5814 pci_free_consistent(priv->pci_dev,
@@ -5855,10 +5855,10 @@ static void iwl_dealloc_ucode_pci(struct iwl_priv *priv)
5855} 5855}
5856 5856
5857/** 5857/**
5858 * iwl_verify_inst_full - verify runtime uCode image in card vs. host, 5858 * iwl4965_verify_inst_full - verify runtime uCode image in card vs. host,
5859 * looking at all data. 5859 * looking at all data.
5860 */ 5860 */
5861static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) 5861static int iwl4965_verify_inst_full(struct iwl4965_priv *priv, __le32 * image, u32 len)
5862{ 5862{
5863 u32 val; 5863 u32 val;
5864 u32 save_len = len; 5864 u32 save_len = len;
@@ -5867,18 +5867,18 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len)
5867 5867
5868 IWL_DEBUG_INFO("ucode inst image size is %u\n", len); 5868 IWL_DEBUG_INFO("ucode inst image size is %u\n", len);
5869 5869
5870 rc = iwl_grab_nic_access(priv); 5870 rc = iwl4965_grab_nic_access(priv);
5871 if (rc) 5871 if (rc)
5872 return rc; 5872 return rc;
5873 5873
5874 iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND); 5874 iwl4965_write_direct32(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND);
5875 5875
5876 errcnt = 0; 5876 errcnt = 0;
5877 for (; len > 0; len -= sizeof(u32), image++) { 5877 for (; len > 0; len -= sizeof(u32), image++) {
5878 /* read data comes through single port, auto-incr addr */ 5878 /* read data comes through single port, auto-incr addr */
5879 /* NOTE: Use the debugless read so we don't flood kernel log 5879 /* NOTE: Use the debugless read so we don't flood kernel log
5880 * if IWL_DL_IO is set */ 5880 * if IWL_DL_IO is set */
5881 val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); 5881 val = _iwl4965_read_direct32(priv, HBUS_TARG_MEM_RDAT);
5882 if (val != le32_to_cpu(*image)) { 5882 if (val != le32_to_cpu(*image)) {
5883 IWL_ERROR("uCode INST section is invalid at " 5883 IWL_ERROR("uCode INST section is invalid at "
5884 "offset 0x%x, is 0x%x, s/b 0x%x\n", 5884 "offset 0x%x, is 0x%x, s/b 0x%x\n",
@@ -5890,7 +5890,7 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len)
5890 } 5890 }
5891 } 5891 }
5892 5892
5893 iwl_release_nic_access(priv); 5893 iwl4965_release_nic_access(priv);
5894 5894
5895 if (!errcnt) 5895 if (!errcnt)
5896 IWL_DEBUG_INFO 5896 IWL_DEBUG_INFO
@@ -5901,11 +5901,11 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len)
5901 5901
5902 5902
5903/** 5903/**
5904 * iwl_verify_inst_sparse - verify runtime uCode image in card vs. host, 5904 * iwl4965_verify_inst_sparse - verify runtime uCode image in card vs. host,
5905 * using sample data 100 bytes apart. If these sample points are good, 5905 * using sample data 100 bytes apart. If these sample points are good,
5906 * it's a pretty good bet that everything between them is good, too. 5906 * it's a pretty good bet that everything between them is good, too.
5907 */ 5907 */
5908static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) 5908static int iwl4965_verify_inst_sparse(struct iwl4965_priv *priv, __le32 *image, u32 len)
5909{ 5909{
5910 u32 val; 5910 u32 val;
5911 int rc = 0; 5911 int rc = 0;
@@ -5914,7 +5914,7 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len)
5914 5914
5915 IWL_DEBUG_INFO("ucode inst image size is %u\n", len); 5915 IWL_DEBUG_INFO("ucode inst image size is %u\n", len);
5916 5916
5917 rc = iwl_grab_nic_access(priv); 5917 rc = iwl4965_grab_nic_access(priv);
5918 if (rc) 5918 if (rc)
5919 return rc; 5919 return rc;
5920 5920
@@ -5922,9 +5922,9 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len)
5922 /* read data comes through single port, auto-incr addr */ 5922 /* read data comes through single port, auto-incr addr */
5923 /* NOTE: Use the debugless read so we don't flood kernel log 5923 /* NOTE: Use the debugless read so we don't flood kernel log
5924 * if IWL_DL_IO is set */ 5924 * if IWL_DL_IO is set */
5925 iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, 5925 iwl4965_write_direct32(priv, HBUS_TARG_MEM_RADDR,
5926 i + RTC_INST_LOWER_BOUND); 5926 i + RTC_INST_LOWER_BOUND);
5927 val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); 5927 val = _iwl4965_read_direct32(priv, HBUS_TARG_MEM_RDAT);
5928 if (val != le32_to_cpu(*image)) { 5928 if (val != le32_to_cpu(*image)) {
5929#if 0 /* Enable this if you want to see details */ 5929#if 0 /* Enable this if you want to see details */
5930 IWL_ERROR("uCode INST section is invalid at " 5930 IWL_ERROR("uCode INST section is invalid at "
@@ -5938,17 +5938,17 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len)
5938 } 5938 }
5939 } 5939 }
5940 5940
5941 iwl_release_nic_access(priv); 5941 iwl4965_release_nic_access(priv);
5942 5942
5943 return rc; 5943 return rc;
5944} 5944}
5945 5945
5946 5946
5947/** 5947/**
5948 * iwl_verify_ucode - determine which instruction image is in SRAM, 5948 * iwl4965_verify_ucode - determine which instruction image is in SRAM,
5949 * and verify its contents 5949 * and verify its contents
5950 */ 5950 */
5951static int iwl_verify_ucode(struct iwl_priv *priv) 5951static int iwl4965_verify_ucode(struct iwl4965_priv *priv)
5952{ 5952{
5953 __le32 *image; 5953 __le32 *image;
5954 u32 len; 5954 u32 len;
@@ -5957,7 +5957,7 @@ static int iwl_verify_ucode(struct iwl_priv *priv)
5957 /* Try bootstrap */ 5957 /* Try bootstrap */
5958 image = (__le32 *)priv->ucode_boot.v_addr; 5958 image = (__le32 *)priv->ucode_boot.v_addr;
5959 len = priv->ucode_boot.len; 5959 len = priv->ucode_boot.len;
5960 rc = iwl_verify_inst_sparse(priv, image, len); 5960 rc = iwl4965_verify_inst_sparse(priv, image, len);
5961 if (rc == 0) { 5961 if (rc == 0) {
5962 IWL_DEBUG_INFO("Bootstrap uCode is good in inst SRAM\n"); 5962 IWL_DEBUG_INFO("Bootstrap uCode is good in inst SRAM\n");
5963 return 0; 5963 return 0;
@@ -5966,7 +5966,7 @@ static int iwl_verify_ucode(struct iwl_priv *priv)
5966 /* Try initialize */ 5966 /* Try initialize */
5967 image = (__le32 *)priv->ucode_init.v_addr; 5967 image = (__le32 *)priv->ucode_init.v_addr;
5968 len = priv->ucode_init.len; 5968 len = priv->ucode_init.len;
5969 rc = iwl_verify_inst_sparse(priv, image, len); 5969 rc = iwl4965_verify_inst_sparse(priv, image, len);
5970 if (rc == 0) { 5970 if (rc == 0) {
5971 IWL_DEBUG_INFO("Initialize uCode is good in inst SRAM\n"); 5971 IWL_DEBUG_INFO("Initialize uCode is good in inst SRAM\n");
5972 return 0; 5972 return 0;
@@ -5975,7 +5975,7 @@ static int iwl_verify_ucode(struct iwl_priv *priv)
5975 /* Try runtime/protocol */ 5975 /* Try runtime/protocol */
5976 image = (__le32 *)priv->ucode_code.v_addr; 5976 image = (__le32 *)priv->ucode_code.v_addr;
5977 len = priv->ucode_code.len; 5977 len = priv->ucode_code.len;
5978 rc = iwl_verify_inst_sparse(priv, image, len); 5978 rc = iwl4965_verify_inst_sparse(priv, image, len);
5979 if (rc == 0) { 5979 if (rc == 0) {
5980 IWL_DEBUG_INFO("Runtime uCode is good in inst SRAM\n"); 5980 IWL_DEBUG_INFO("Runtime uCode is good in inst SRAM\n");
5981 return 0; 5981 return 0;
@@ -5987,14 +5987,14 @@ static int iwl_verify_ucode(struct iwl_priv *priv)
5987 * Selection of bootstrap image is arbitrary. */ 5987 * Selection of bootstrap image is arbitrary. */
5988 image = (__le32 *)priv->ucode_boot.v_addr; 5988 image = (__le32 *)priv->ucode_boot.v_addr;
5989 len = priv->ucode_boot.len; 5989 len = priv->ucode_boot.len;
5990 rc = iwl_verify_inst_full(priv, image, len); 5990 rc = iwl4965_verify_inst_full(priv, image, len);
5991 5991
5992 return rc; 5992 return rc;
5993} 5993}
5994 5994
5995 5995
5996/* check contents of special bootstrap uCode SRAM */ 5996/* check contents of special bootstrap uCode SRAM */
5997static int iwl_verify_bsm(struct iwl_priv *priv) 5997static int iwl4965_verify_bsm(struct iwl4965_priv *priv)
5998{ 5998{
5999 __le32 *image = priv->ucode_boot.v_addr; 5999 __le32 *image = priv->ucode_boot.v_addr;
6000 u32 len = priv->ucode_boot.len; 6000 u32 len = priv->ucode_boot.len;
@@ -6004,11 +6004,11 @@ static int iwl_verify_bsm(struct iwl_priv *priv)
6004 IWL_DEBUG_INFO("Begin verify bsm\n"); 6004 IWL_DEBUG_INFO("Begin verify bsm\n");
6005 6005
6006 /* verify BSM SRAM contents */ 6006 /* verify BSM SRAM contents */
6007 val = iwl_read_prph(priv, BSM_WR_DWCOUNT_REG); 6007 val = iwl4965_read_prph(priv, BSM_WR_DWCOUNT_REG);
6008 for (reg = BSM_SRAM_LOWER_BOUND; 6008 for (reg = BSM_SRAM_LOWER_BOUND;
6009 reg < BSM_SRAM_LOWER_BOUND + len; 6009 reg < BSM_SRAM_LOWER_BOUND + len;
6010 reg += sizeof(u32), image ++) { 6010 reg += sizeof(u32), image ++) {
6011 val = iwl_read_prph(priv, reg); 6011 val = iwl4965_read_prph(priv, reg);
6012 if (val != le32_to_cpu(*image)) { 6012 if (val != le32_to_cpu(*image)) {
6013 IWL_ERROR("BSM uCode verification failed at " 6013 IWL_ERROR("BSM uCode verification failed at "
6014 "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", 6014 "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n",
@@ -6025,7 +6025,7 @@ static int iwl_verify_bsm(struct iwl_priv *priv)
6025} 6025}
6026 6026
6027/** 6027/**
6028 * iwl_load_bsm - Load bootstrap instructions 6028 * iwl4965_load_bsm - Load bootstrap instructions
6029 * 6029 *
6030 * BSM operation: 6030 * BSM operation:
6031 * 6031 *
@@ -6056,7 +6056,7 @@ static int iwl_verify_bsm(struct iwl_priv *priv)
6056 * the runtime uCode instructions and the backup data cache into SRAM, 6056 * the runtime uCode instructions and the backup data cache into SRAM,
6057 * and re-launches the runtime uCode from where it left off. 6057 * and re-launches the runtime uCode from where it left off.
6058 */ 6058 */
6059static int iwl_load_bsm(struct iwl_priv *priv) 6059static int iwl4965_load_bsm(struct iwl4965_priv *priv)
6060{ 6060{
6061 __le32 *image = priv->ucode_boot.v_addr; 6061 __le32 *image = priv->ucode_boot.v_addr;
6062 u32 len = priv->ucode_boot.len; 6062 u32 len = priv->ucode_boot.len;
@@ -6077,7 +6077,7 @@ static int iwl_load_bsm(struct iwl_priv *priv)
6077 6077
6078 /* Tell bootstrap uCode where to find the "Initialize" uCode 6078 /* Tell bootstrap uCode where to find the "Initialize" uCode
6079 * in host DRAM ... bits 31:0 for 3945, bits 35:4 for 4965. 6079 * in host DRAM ... bits 31:0 for 3945, bits 35:4 for 4965.
6080 * NOTE: iwl_initialize_alive_start() will replace these values, 6080 * NOTE: iwl4965_initialize_alive_start() will replace these values,
6081 * after the "initialize" uCode has run, to point to 6081 * after the "initialize" uCode has run, to point to
6082 * runtime/protocol instructions and backup data cache. */ 6082 * runtime/protocol instructions and backup data cache. */
6083 pinst = priv->ucode_init.p_addr >> 4; 6083 pinst = priv->ucode_init.p_addr >> 4;
@@ -6085,42 +6085,42 @@ static int iwl_load_bsm(struct iwl_priv *priv)
6085 inst_len = priv->ucode_init.len; 6085 inst_len = priv->ucode_init.len;
6086 data_len = priv->ucode_init_data.len; 6086 data_len = priv->ucode_init_data.len;
6087 6087
6088 rc = iwl_grab_nic_access(priv); 6088 rc = iwl4965_grab_nic_access(priv);
6089 if (rc) 6089 if (rc)
6090 return rc; 6090 return rc;
6091 6091
6092 iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); 6092 iwl4965_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
6093 iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); 6093 iwl4965_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
6094 iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); 6094 iwl4965_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len);
6095 iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); 6095 iwl4965_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len);
6096 6096
6097 /* Fill BSM memory with bootstrap instructions */ 6097 /* Fill BSM memory with bootstrap instructions */
6098 for (reg_offset = BSM_SRAM_LOWER_BOUND; 6098 for (reg_offset = BSM_SRAM_LOWER_BOUND;
6099 reg_offset < BSM_SRAM_LOWER_BOUND + len; 6099 reg_offset < BSM_SRAM_LOWER_BOUND + len;
6100 reg_offset += sizeof(u32), image++) 6100 reg_offset += sizeof(u32), image++)
6101 _iwl_write_prph(priv, reg_offset, 6101 _iwl4965_write_prph(priv, reg_offset,
6102 le32_to_cpu(*image)); 6102 le32_to_cpu(*image));
6103 6103
6104 rc = iwl_verify_bsm(priv); 6104 rc = iwl4965_verify_bsm(priv);
6105 if (rc) { 6105 if (rc) {
6106 iwl_release_nic_access(priv); 6106 iwl4965_release_nic_access(priv);
6107 return rc; 6107 return rc;
6108 } 6108 }
6109 6109
6110 /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ 6110 /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */
6111 iwl_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); 6111 iwl4965_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0);
6112 iwl_write_prph(priv, BSM_WR_MEM_DST_REG, 6112 iwl4965_write_prph(priv, BSM_WR_MEM_DST_REG,
6113 RTC_INST_LOWER_BOUND); 6113 RTC_INST_LOWER_BOUND);
6114 iwl_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); 6114 iwl4965_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32));
6115 6115
6116 /* Load bootstrap code into instruction SRAM now, 6116 /* Load bootstrap code into instruction SRAM now,
6117 * to prepare to load "initialize" uCode */ 6117 * to prepare to load "initialize" uCode */
6118 iwl_write_prph(priv, BSM_WR_CTRL_REG, 6118 iwl4965_write_prph(priv, BSM_WR_CTRL_REG,
6119 BSM_WR_CTRL_REG_BIT_START); 6119 BSM_WR_CTRL_REG_BIT_START);
6120 6120
6121 /* Wait for load of bootstrap uCode to finish */ 6121 /* Wait for load of bootstrap uCode to finish */
6122 for (i = 0; i < 100; i++) { 6122 for (i = 0; i < 100; i++) {
6123 done = iwl_read_prph(priv, BSM_WR_CTRL_REG); 6123 done = iwl4965_read_prph(priv, BSM_WR_CTRL_REG);
6124 if (!(done & BSM_WR_CTRL_REG_BIT_START)) 6124 if (!(done & BSM_WR_CTRL_REG_BIT_START))
6125 break; 6125 break;
6126 udelay(10); 6126 udelay(10);
@@ -6134,28 +6134,28 @@ static int iwl_load_bsm(struct iwl_priv *priv)
6134 6134
6135 /* Enable future boot loads whenever power management unit triggers it 6135 /* Enable future boot loads whenever power management unit triggers it
6136 * (e.g. when powering back up after power-save shutdown) */ 6136 * (e.g. when powering back up after power-save shutdown) */
6137 iwl_write_prph(priv, BSM_WR_CTRL_REG, 6137 iwl4965_write_prph(priv, BSM_WR_CTRL_REG,
6138 BSM_WR_CTRL_REG_BIT_START_EN); 6138 BSM_WR_CTRL_REG_BIT_START_EN);
6139 6139
6140 iwl_release_nic_access(priv); 6140 iwl4965_release_nic_access(priv);
6141 6141
6142 return 0; 6142 return 0;
6143} 6143}
6144 6144
6145static void iwl_nic_start(struct iwl_priv *priv) 6145static void iwl4965_nic_start(struct iwl4965_priv *priv)
6146{ 6146{
6147 /* Remove all resets to allow NIC to operate */ 6147 /* Remove all resets to allow NIC to operate */
6148 iwl_write32(priv, CSR_RESET, 0); 6148 iwl4965_write32(priv, CSR_RESET, 0);
6149} 6149}
6150 6150
6151/** 6151/**
6152 * iwl_read_ucode - Read uCode images from disk file. 6152 * iwl4965_read_ucode - Read uCode images from disk file.
6153 * 6153 *
6154 * Copy into buffers for card to fetch via bus-mastering 6154 * Copy into buffers for card to fetch via bus-mastering
6155 */ 6155 */
6156static int iwl_read_ucode(struct iwl_priv *priv) 6156static int iwl4965_read_ucode(struct iwl4965_priv *priv)
6157{ 6157{
6158 struct iwl_ucode *ucode; 6158 struct iwl4965_ucode *ucode;
6159 int rc = 0; 6159 int rc = 0;
6160 const struct firmware *ucode_raw; 6160 const struct firmware *ucode_raw;
6161 const char *name = "iwlwifi-4965" IWL4965_UCODE_API ".ucode"; 6161 const char *name = "iwlwifi-4965" IWL4965_UCODE_API ".ucode";
@@ -6311,7 +6311,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
6311 priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); 6311 priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr);
6312 6312
6313 /* Runtime data (2nd block) 6313 /* Runtime data (2nd block)
6314 * NOTE: Copy into backup buffer will be done in iwl_up() */ 6314 * NOTE: Copy into backup buffer will be done in iwl4965_up() */
6315 src = &ucode->data[inst_size]; 6315 src = &ucode->data[inst_size];
6316 len = priv->ucode_data.len; 6316 len = priv->ucode_data.len;
6317 IWL_DEBUG_INFO("Copying (but not loading) uCode data len %d\n", 6317 IWL_DEBUG_INFO("Copying (but not loading) uCode data len %d\n",
@@ -6351,7 +6351,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
6351 err_pci_alloc: 6351 err_pci_alloc:
6352 IWL_ERROR("failed to allocate pci memory\n"); 6352 IWL_ERROR("failed to allocate pci memory\n");
6353 rc = -ENOMEM; 6353 rc = -ENOMEM;
6354 iwl_dealloc_ucode_pci(priv); 6354 iwl4965_dealloc_ucode_pci(priv);
6355 6355
6356 err_release: 6356 err_release:
6357 release_firmware(ucode_raw); 6357 release_firmware(ucode_raw);
@@ -6362,7 +6362,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
6362 6362
6363 6363
6364/** 6364/**
6365 * iwl_set_ucode_ptrs - Set uCode address location 6365 * iwl4965_set_ucode_ptrs - Set uCode address location
6366 * 6366 *
6367 * Tell initialization uCode where to find runtime uCode. 6367 * Tell initialization uCode where to find runtime uCode.
6368 * 6368 *
@@ -6370,7 +6370,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
6370 * We need to replace them to load runtime uCode inst and data, 6370 * We need to replace them to load runtime uCode inst and data,
6371 * and to save runtime data when powering down. 6371 * and to save runtime data when powering down.
6372 */ 6372 */
6373static int iwl_set_ucode_ptrs(struct iwl_priv *priv) 6373static int iwl4965_set_ucode_ptrs(struct iwl4965_priv *priv)
6374{ 6374{
6375 dma_addr_t pinst; 6375 dma_addr_t pinst;
6376 dma_addr_t pdata; 6376 dma_addr_t pdata;
@@ -6382,24 +6382,24 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv)
6382 pdata = priv->ucode_data_backup.p_addr >> 4; 6382 pdata = priv->ucode_data_backup.p_addr >> 4;
6383 6383
6384 spin_lock_irqsave(&priv->lock, flags); 6384 spin_lock_irqsave(&priv->lock, flags);
6385 rc = iwl_grab_nic_access(priv); 6385 rc = iwl4965_grab_nic_access(priv);
6386 if (rc) { 6386 if (rc) {
6387 spin_unlock_irqrestore(&priv->lock, flags); 6387 spin_unlock_irqrestore(&priv->lock, flags);
6388 return rc; 6388 return rc;
6389 } 6389 }
6390 6390
6391 /* Tell bootstrap uCode where to find image to load */ 6391 /* Tell bootstrap uCode where to find image to load */
6392 iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); 6392 iwl4965_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
6393 iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); 6393 iwl4965_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
6394 iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, 6394 iwl4965_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG,
6395 priv->ucode_data.len); 6395 priv->ucode_data.len);
6396 6396
6397 /* Inst bytecount must be last to set up, bit 31 signals uCode 6397 /* Inst bytecount must be last to set up, bit 31 signals uCode
6398 * that all new ptr/size info is in place */ 6398 * that all new ptr/size info is in place */
6399 iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, 6399 iwl4965_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG,
6400 priv->ucode_code.len | BSM_DRAM_INST_LOAD); 6400 priv->ucode_code.len | BSM_DRAM_INST_LOAD);
6401 6401
6402 iwl_release_nic_access(priv); 6402 iwl4965_release_nic_access(priv);
6403 6403
6404 spin_unlock_irqrestore(&priv->lock, flags); 6404 spin_unlock_irqrestore(&priv->lock, flags);
6405 6405
@@ -6409,7 +6409,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv)
6409} 6409}
6410 6410
6411/** 6411/**
6412 * iwl_init_alive_start - Called after REPLY_ALIVE notification received 6412 * iwl4965_init_alive_start - Called after REPLY_ALIVE notification received
6413 * 6413 *
6414 * Called after REPLY_ALIVE notification received from "initialize" uCode. 6414 * Called after REPLY_ALIVE notification received from "initialize" uCode.
6415 * 6415 *
@@ -6419,7 +6419,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv)
6419 * 6419 *
6420 * Tell "initialize" uCode to go ahead and load the runtime uCode. 6420 * Tell "initialize" uCode to go ahead and load the runtime uCode.
6421*/ 6421*/
6422static void iwl_init_alive_start(struct iwl_priv *priv) 6422static void iwl4965_init_alive_start(struct iwl4965_priv *priv)
6423{ 6423{
6424 /* Check alive response for "valid" sign from uCode */ 6424 /* Check alive response for "valid" sign from uCode */
6425 if (priv->card_alive_init.is_valid != UCODE_VALID_OK) { 6425 if (priv->card_alive_init.is_valid != UCODE_VALID_OK) {
@@ -6432,7 +6432,7 @@ static void iwl_init_alive_start(struct iwl_priv *priv)
6432 /* Bootstrap uCode has loaded initialize uCode ... verify inst image. 6432 /* Bootstrap uCode has loaded initialize uCode ... verify inst image.
6433 * This is a paranoid check, because we would not have gotten the 6433 * This is a paranoid check, because we would not have gotten the
6434 * "initialize" alive if code weren't properly loaded. */ 6434 * "initialize" alive if code weren't properly loaded. */
6435 if (iwl_verify_ucode(priv)) { 6435 if (iwl4965_verify_ucode(priv)) {
6436 /* Runtime instruction load was bad; 6436 /* Runtime instruction load was bad;
6437 * take it all the way back down so we can try again */ 6437 * take it all the way back down so we can try again */
6438 IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n"); 6438 IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n");
@@ -6446,7 +6446,7 @@ static void iwl_init_alive_start(struct iwl_priv *priv)
6446 * load and launch runtime uCode, which will send us another "Alive" 6446 * load and launch runtime uCode, which will send us another "Alive"
6447 * notification. */ 6447 * notification. */
6448 IWL_DEBUG_INFO("Initialization Alive received.\n"); 6448 IWL_DEBUG_INFO("Initialization Alive received.\n");
6449 if (iwl_set_ucode_ptrs(priv)) { 6449 if (iwl4965_set_ucode_ptrs(priv)) {
6450 /* Runtime instruction load won't happen; 6450 /* Runtime instruction load won't happen;
6451 * take it all the way back down so we can try again */ 6451 * take it all the way back down so we can try again */
6452 IWL_DEBUG_INFO("Couldn't set up uCode pointers.\n"); 6452 IWL_DEBUG_INFO("Couldn't set up uCode pointers.\n");
@@ -6460,11 +6460,11 @@ static void iwl_init_alive_start(struct iwl_priv *priv)
6460 6460
6461 6461
6462/** 6462/**
6463 * iwl_alive_start - called after REPLY_ALIVE notification received 6463 * iwl4965_alive_start - called after REPLY_ALIVE notification received
6464 * from protocol/runtime uCode (initialization uCode's 6464 * from protocol/runtime uCode (initialization uCode's
6465 * Alive gets handled by iwl_init_alive_start()). 6465 * Alive gets handled by iwl4965_init_alive_start()).
6466 */ 6466 */
6467static void iwl_alive_start(struct iwl_priv *priv) 6467static void iwl4965_alive_start(struct iwl4965_priv *priv)
6468{ 6468{
6469 int rc = 0; 6469 int rc = 0;
6470 6470
@@ -6480,14 +6480,14 @@ static void iwl_alive_start(struct iwl_priv *priv)
6480 /* Initialize uCode has loaded Runtime uCode ... verify inst image. 6480 /* Initialize uCode has loaded Runtime uCode ... verify inst image.
6481 * This is a paranoid check, because we would not have gotten the 6481 * This is a paranoid check, because we would not have gotten the
6482 * "runtime" alive if code weren't properly loaded. */ 6482 * "runtime" alive if code weren't properly loaded. */
6483 if (iwl_verify_ucode(priv)) { 6483 if (iwl4965_verify_ucode(priv)) {
6484 /* Runtime instruction load was bad; 6484 /* Runtime instruction load was bad;
6485 * take it all the way back down so we can try again */ 6485 * take it all the way back down so we can try again */
6486 IWL_DEBUG_INFO("Bad runtime uCode load.\n"); 6486 IWL_DEBUG_INFO("Bad runtime uCode load.\n");
6487 goto restart; 6487 goto restart;
6488 } 6488 }
6489 6489
6490 iwl_clear_stations_table(priv); 6490 iwl4965_clear_stations_table(priv);
6491 6491
6492 rc = iwl4965_alive_notify(priv); 6492 rc = iwl4965_alive_notify(priv);
6493 if (rc) { 6493 if (rc) {
@@ -6502,28 +6502,28 @@ static void iwl_alive_start(struct iwl_priv *priv)
6502 /* Clear out the uCode error bit if it is set */ 6502 /* Clear out the uCode error bit if it is set */
6503 clear_bit(STATUS_FW_ERROR, &priv->status); 6503 clear_bit(STATUS_FW_ERROR, &priv->status);
6504 6504
6505 rc = iwl_init_channel_map(priv); 6505 rc = iwl4965_init_channel_map(priv);
6506 if (rc) { 6506 if (rc) {
6507 IWL_ERROR("initializing regulatory failed: %d\n", rc); 6507 IWL_ERROR("initializing regulatory failed: %d\n", rc);
6508 return; 6508 return;
6509 } 6509 }
6510 6510
6511 iwl_init_geos(priv); 6511 iwl4965_init_geos(priv);
6512 6512
6513 if (iwl_is_rfkill(priv)) 6513 if (iwl4965_is_rfkill(priv))
6514 return; 6514 return;
6515 6515
6516 if (!priv->mac80211_registered) { 6516 if (!priv->mac80211_registered) {
6517 /* Unlock so any user space entry points can call back into 6517 /* Unlock so any user space entry points can call back into
6518 * the driver without a deadlock... */ 6518 * the driver without a deadlock... */
6519 mutex_unlock(&priv->mutex); 6519 mutex_unlock(&priv->mutex);
6520 iwl_rate_control_register(priv->hw); 6520 iwl4965_rate_control_register(priv->hw);
6521 rc = ieee80211_register_hw(priv->hw); 6521 rc = ieee80211_register_hw(priv->hw);
6522 priv->hw->conf.beacon_int = 100; 6522 priv->hw->conf.beacon_int = 100;
6523 mutex_lock(&priv->mutex); 6523 mutex_lock(&priv->mutex);
6524 6524
6525 if (rc) { 6525 if (rc) {
6526 iwl_rate_control_unregister(priv->hw); 6526 iwl4965_rate_control_unregister(priv->hw);
6527 IWL_ERROR("Failed to register network " 6527 IWL_ERROR("Failed to register network "
6528 "device (error %d)\n", rc); 6528 "device (error %d)\n", rc);
6529 return; 6529 return;
@@ -6531,33 +6531,33 @@ static void iwl_alive_start(struct iwl_priv *priv)
6531 6531
6532 priv->mac80211_registered = 1; 6532 priv->mac80211_registered = 1;
6533 6533
6534 iwl_reset_channel_flag(priv); 6534 iwl4965_reset_channel_flag(priv);
6535 } else 6535 } else
6536 ieee80211_start_queues(priv->hw); 6536 ieee80211_start_queues(priv->hw);
6537 6537
6538 priv->active_rate = priv->rates_mask; 6538 priv->active_rate = priv->rates_mask;
6539 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; 6539 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
6540 6540
6541 iwl_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode)); 6541 iwl4965_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode));
6542 6542
6543 if (iwl_is_associated(priv)) { 6543 if (iwl4965_is_associated(priv)) {
6544 struct iwl_rxon_cmd *active_rxon = 6544 struct iwl4965_rxon_cmd *active_rxon =
6545 (struct iwl_rxon_cmd *)(&priv->active_rxon); 6545 (struct iwl4965_rxon_cmd *)(&priv->active_rxon);
6546 6546
6547 memcpy(&priv->staging_rxon, &priv->active_rxon, 6547 memcpy(&priv->staging_rxon, &priv->active_rxon,
6548 sizeof(priv->staging_rxon)); 6548 sizeof(priv->staging_rxon));
6549 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 6549 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
6550 } else { 6550 } else {
6551 /* Initialize our rx_config data */ 6551 /* Initialize our rx_config data */
6552 iwl_connection_init_rx_config(priv); 6552 iwl4965_connection_init_rx_config(priv);
6553 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); 6553 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
6554 } 6554 }
6555 6555
6556 /* Configure BT coexistence */ 6556 /* Configure BT coexistence */
6557 iwl_send_bt_config(priv); 6557 iwl4965_send_bt_config(priv);
6558 6558
6559 /* Configure the adapter for unassociated operation */ 6559 /* Configure the adapter for unassociated operation */
6560 iwl_commit_rxon(priv); 6560 iwl4965_commit_rxon(priv);
6561 6561
6562 /* At this point, the NIC is initialized and operational */ 6562 /* At this point, the NIC is initialized and operational */
6563 priv->notif_missed_beacons = 0; 6563 priv->notif_missed_beacons = 0;
@@ -6567,7 +6567,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
6567 IWL_DEBUG_INFO("ALIVE processing complete.\n"); 6567 IWL_DEBUG_INFO("ALIVE processing complete.\n");
6568 6568
6569 if (priv->error_recovering) 6569 if (priv->error_recovering)
6570 iwl_error_recovery(priv); 6570 iwl4965_error_recovery(priv);
6571 6571
6572 return; 6572 return;
6573 6573
@@ -6575,9 +6575,9 @@ static void iwl_alive_start(struct iwl_priv *priv)
6575 queue_work(priv->workqueue, &priv->restart); 6575 queue_work(priv->workqueue, &priv->restart);
6576} 6576}
6577 6577
6578static void iwl_cancel_deferred_work(struct iwl_priv *priv); 6578static void iwl4965_cancel_deferred_work(struct iwl4965_priv *priv);
6579 6579
6580static void __iwl_down(struct iwl_priv *priv) 6580static void __iwl4965_down(struct iwl4965_priv *priv)
6581{ 6581{
6582 unsigned long flags; 6582 unsigned long flags;
6583 int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status); 6583 int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status);
@@ -6590,7 +6590,7 @@ static void __iwl_down(struct iwl_priv *priv)
6590 if (!exit_pending) 6590 if (!exit_pending)
6591 set_bit(STATUS_EXIT_PENDING, &priv->status); 6591 set_bit(STATUS_EXIT_PENDING, &priv->status);
6592 6592
6593 iwl_clear_stations_table(priv); 6593 iwl4965_clear_stations_table(priv);
6594 6594
6595 /* Unblock any waiting calls */ 6595 /* Unblock any waiting calls */
6596 wake_up_interruptible_all(&priv->wait_command_queue); 6596 wake_up_interruptible_all(&priv->wait_command_queue);
@@ -6601,17 +6601,17 @@ static void __iwl_down(struct iwl_priv *priv)
6601 clear_bit(STATUS_EXIT_PENDING, &priv->status); 6601 clear_bit(STATUS_EXIT_PENDING, &priv->status);
6602 6602
6603 /* stop and reset the on-board processor */ 6603 /* stop and reset the on-board processor */
6604 iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); 6604 iwl4965_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
6605 6605
6606 /* tell the device to stop sending interrupts */ 6606 /* tell the device to stop sending interrupts */
6607 iwl_disable_interrupts(priv); 6607 iwl4965_disable_interrupts(priv);
6608 6608
6609 if (priv->mac80211_registered) 6609 if (priv->mac80211_registered)
6610 ieee80211_stop_queues(priv->hw); 6610 ieee80211_stop_queues(priv->hw);
6611 6611
6612 /* If we have not previously called iwl_init() then 6612 /* If we have not previously called iwl4965_init() then
6613 * clear all bits but the RF Kill and SUSPEND bits and return */ 6613 * clear all bits but the RF Kill and SUSPEND bits and return */
6614 if (!iwl_is_init(priv)) { 6614 if (!iwl4965_is_init(priv)) {
6615 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << 6615 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) <<
6616 STATUS_RF_KILL_HW | 6616 STATUS_RF_KILL_HW |
6617 test_bit(STATUS_RF_KILL_SW, &priv->status) << 6617 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
@@ -6633,49 +6633,49 @@ static void __iwl_down(struct iwl_priv *priv)
6633 STATUS_FW_ERROR; 6633 STATUS_FW_ERROR;
6634 6634
6635 spin_lock_irqsave(&priv->lock, flags); 6635 spin_lock_irqsave(&priv->lock, flags);
6636 iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 6636 iwl4965_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
6637 spin_unlock_irqrestore(&priv->lock, flags); 6637 spin_unlock_irqrestore(&priv->lock, flags);
6638 6638
6639 iwl_hw_txq_ctx_stop(priv); 6639 iwl4965_hw_txq_ctx_stop(priv);
6640 iwl_hw_rxq_stop(priv); 6640 iwl4965_hw_rxq_stop(priv);
6641 6641
6642 spin_lock_irqsave(&priv->lock, flags); 6642 spin_lock_irqsave(&priv->lock, flags);
6643 if (!iwl_grab_nic_access(priv)) { 6643 if (!iwl4965_grab_nic_access(priv)) {
6644 iwl_write_prph(priv, APMG_CLK_DIS_REG, 6644 iwl4965_write_prph(priv, APMG_CLK_DIS_REG,
6645 APMG_CLK_VAL_DMA_CLK_RQT); 6645 APMG_CLK_VAL_DMA_CLK_RQT);
6646 iwl_release_nic_access(priv); 6646 iwl4965_release_nic_access(priv);
6647 } 6647 }
6648 spin_unlock_irqrestore(&priv->lock, flags); 6648 spin_unlock_irqrestore(&priv->lock, flags);
6649 6649
6650 udelay(5); 6650 udelay(5);
6651 6651
6652 iwl_hw_nic_stop_master(priv); 6652 iwl4965_hw_nic_stop_master(priv);
6653 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); 6653 iwl4965_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
6654 iwl_hw_nic_reset(priv); 6654 iwl4965_hw_nic_reset(priv);
6655 6655
6656 exit: 6656 exit:
6657 memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp)); 6657 memset(&priv->card_alive, 0, sizeof(struct iwl4965_alive_resp));
6658 6658
6659 if (priv->ibss_beacon) 6659 if (priv->ibss_beacon)
6660 dev_kfree_skb(priv->ibss_beacon); 6660 dev_kfree_skb(priv->ibss_beacon);
6661 priv->ibss_beacon = NULL; 6661 priv->ibss_beacon = NULL;
6662 6662
6663 /* clear out any free frames */ 6663 /* clear out any free frames */
6664 iwl_clear_free_frames(priv); 6664 iwl4965_clear_free_frames(priv);
6665} 6665}
6666 6666
6667static void iwl_down(struct iwl_priv *priv) 6667static void iwl4965_down(struct iwl4965_priv *priv)
6668{ 6668{
6669 mutex_lock(&priv->mutex); 6669 mutex_lock(&priv->mutex);
6670 __iwl_down(priv); 6670 __iwl4965_down(priv);
6671 mutex_unlock(&priv->mutex); 6671 mutex_unlock(&priv->mutex);
6672 6672
6673 iwl_cancel_deferred_work(priv); 6673 iwl4965_cancel_deferred_work(priv);
6674} 6674}
6675 6675
6676#define MAX_HW_RESTARTS 5 6676#define MAX_HW_RESTARTS 5
6677 6677
6678static int __iwl_up(struct iwl_priv *priv) 6678static int __iwl4965_up(struct iwl4965_priv *priv)
6679{ 6679{
6680 DECLARE_MAC_BUF(mac); 6680 DECLARE_MAC_BUF(mac);
6681 int rc, i; 6681 int rc, i;
@@ -6697,26 +6697,26 @@ static int __iwl_up(struct iwl_priv *priv)
6697 return -EIO; 6697 return -EIO;
6698 } 6698 }
6699 6699
6700 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 6700 iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF);
6701 6701
6702 rc = iwl_hw_nic_init(priv); 6702 rc = iwl4965_hw_nic_init(priv);
6703 if (rc) { 6703 if (rc) {
6704 IWL_ERROR("Unable to int nic\n"); 6704 IWL_ERROR("Unable to int nic\n");
6705 return rc; 6705 return rc;
6706 } 6706 }
6707 6707
6708 /* make sure rfkill handshake bits are cleared */ 6708 /* make sure rfkill handshake bits are cleared */
6709 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 6709 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
6710 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, 6710 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR,
6711 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 6711 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
6712 6712
6713 /* clear (again), then enable host interrupts */ 6713 /* clear (again), then enable host interrupts */
6714 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 6714 iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF);
6715 iwl_enable_interrupts(priv); 6715 iwl4965_enable_interrupts(priv);
6716 6716
6717 /* really make sure rfkill handshake bits are cleared */ 6717 /* really make sure rfkill handshake bits are cleared */
6718 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 6718 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
6719 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 6719 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
6720 6720
6721 /* Copy original ucode data image from disk into backup cache. 6721 /* Copy original ucode data image from disk into backup cache.
6722 * This will be used to initialize the on-board processor's 6722 * This will be used to initialize the on-board processor's
@@ -6727,7 +6727,7 @@ static int __iwl_up(struct iwl_priv *priv)
6727 /* If platform's RF_KILL switch is set to KILL, 6727 /* If platform's RF_KILL switch is set to KILL,
6728 * wait for BIT_INT_RF_KILL interrupt before loading uCode 6728 * wait for BIT_INT_RF_KILL interrupt before loading uCode
6729 * and getting things started */ 6729 * and getting things started */
6730 if (!(iwl_read32(priv, CSR_GP_CNTRL) & 6730 if (!(iwl4965_read32(priv, CSR_GP_CNTRL) &
6731 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) 6731 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW))
6732 hw_rf_kill = 1; 6732 hw_rf_kill = 1;
6733 6733
@@ -6738,12 +6738,12 @@ static int __iwl_up(struct iwl_priv *priv)
6738 6738
6739 for (i = 0; i < MAX_HW_RESTARTS; i++) { 6739 for (i = 0; i < MAX_HW_RESTARTS; i++) {
6740 6740
6741 iwl_clear_stations_table(priv); 6741 iwl4965_clear_stations_table(priv);
6742 6742
6743 /* load bootstrap state machine, 6743 /* load bootstrap state machine,
6744 * load bootstrap program into processor's memory, 6744 * load bootstrap program into processor's memory,
6745 * prepare to load the "initialize" uCode */ 6745 * prepare to load the "initialize" uCode */
6746 rc = iwl_load_bsm(priv); 6746 rc = iwl4965_load_bsm(priv);
6747 6747
6748 if (rc) { 6748 if (rc) {
6749 IWL_ERROR("Unable to set up bootstrap uCode: %d\n", rc); 6749 IWL_ERROR("Unable to set up bootstrap uCode: %d\n", rc);
@@ -6751,7 +6751,7 @@ static int __iwl_up(struct iwl_priv *priv)
6751 } 6751 }
6752 6752
6753 /* start card; "initialize" will load runtime ucode */ 6753 /* start card; "initialize" will load runtime ucode */
6754 iwl_nic_start(priv); 6754 iwl4965_nic_start(priv);
6755 6755
6756 /* MAC Address location in EEPROM same for 3945/4965 */ 6756 /* MAC Address location in EEPROM same for 3945/4965 */
6757 get_eeprom_mac(priv, priv->mac_addr); 6757 get_eeprom_mac(priv, priv->mac_addr);
@@ -6766,7 +6766,7 @@ static int __iwl_up(struct iwl_priv *priv)
6766 } 6766 }
6767 6767
6768 set_bit(STATUS_EXIT_PENDING, &priv->status); 6768 set_bit(STATUS_EXIT_PENDING, &priv->status);
6769 __iwl_down(priv); 6769 __iwl4965_down(priv);
6770 6770
6771 /* tried to restart and config the device for as long as our 6771 /* tried to restart and config the device for as long as our
6772 * patience could withstand */ 6772 * patience could withstand */
@@ -6781,35 +6781,35 @@ static int __iwl_up(struct iwl_priv *priv)
6781 * 6781 *
6782 *****************************************************************************/ 6782 *****************************************************************************/
6783 6783
6784static void iwl_bg_init_alive_start(struct work_struct *data) 6784static void iwl4965_bg_init_alive_start(struct work_struct *data)
6785{ 6785{
6786 struct iwl_priv *priv = 6786 struct iwl4965_priv *priv =
6787 container_of(data, struct iwl_priv, init_alive_start.work); 6787 container_of(data, struct iwl4965_priv, init_alive_start.work);
6788 6788
6789 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6789 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6790 return; 6790 return;
6791 6791
6792 mutex_lock(&priv->mutex); 6792 mutex_lock(&priv->mutex);
6793 iwl_init_alive_start(priv); 6793 iwl4965_init_alive_start(priv);
6794 mutex_unlock(&priv->mutex); 6794 mutex_unlock(&priv->mutex);
6795} 6795}
6796 6796
6797static void iwl_bg_alive_start(struct work_struct *data) 6797static void iwl4965_bg_alive_start(struct work_struct *data)
6798{ 6798{
6799 struct iwl_priv *priv = 6799 struct iwl4965_priv *priv =
6800 container_of(data, struct iwl_priv, alive_start.work); 6800 container_of(data, struct iwl4965_priv, alive_start.work);
6801 6801
6802 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6802 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6803 return; 6803 return;
6804 6804
6805 mutex_lock(&priv->mutex); 6805 mutex_lock(&priv->mutex);
6806 iwl_alive_start(priv); 6806 iwl4965_alive_start(priv);
6807 mutex_unlock(&priv->mutex); 6807 mutex_unlock(&priv->mutex);
6808} 6808}
6809 6809
6810static void iwl_bg_rf_kill(struct work_struct *work) 6810static void iwl4965_bg_rf_kill(struct work_struct *work)
6811{ 6811{
6812 struct iwl_priv *priv = container_of(work, struct iwl_priv, rf_kill); 6812 struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv, rf_kill);
6813 6813
6814 wake_up_interruptible(&priv->wait_command_queue); 6814 wake_up_interruptible(&priv->wait_command_queue);
6815 6815
@@ -6818,7 +6818,7 @@ static void iwl_bg_rf_kill(struct work_struct *work)
6818 6818
6819 mutex_lock(&priv->mutex); 6819 mutex_lock(&priv->mutex);
6820 6820
6821 if (!iwl_is_rfkill(priv)) { 6821 if (!iwl4965_is_rfkill(priv)) {
6822 IWL_DEBUG(IWL_DL_INFO | IWL_DL_RF_KILL, 6822 IWL_DEBUG(IWL_DL_INFO | IWL_DL_RF_KILL,
6823 "HW and/or SW RF Kill no longer active, restarting " 6823 "HW and/or SW RF Kill no longer active, restarting "
6824 "device\n"); 6824 "device\n");
@@ -6839,10 +6839,10 @@ static void iwl_bg_rf_kill(struct work_struct *work)
6839 6839
6840#define IWL_SCAN_CHECK_WATCHDOG (7 * HZ) 6840#define IWL_SCAN_CHECK_WATCHDOG (7 * HZ)
6841 6841
6842static void iwl_bg_scan_check(struct work_struct *data) 6842static void iwl4965_bg_scan_check(struct work_struct *data)
6843{ 6843{
6844 struct iwl_priv *priv = 6844 struct iwl4965_priv *priv =
6845 container_of(data, struct iwl_priv, scan_check.work); 6845 container_of(data, struct iwl4965_priv, scan_check.work);
6846 6846
6847 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6847 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6848 return; 6848 return;
@@ -6855,22 +6855,22 @@ static void iwl_bg_scan_check(struct work_struct *data)
6855 jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); 6855 jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG));
6856 6856
6857 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) 6857 if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
6858 iwl_send_scan_abort(priv); 6858 iwl4965_send_scan_abort(priv);
6859 } 6859 }
6860 mutex_unlock(&priv->mutex); 6860 mutex_unlock(&priv->mutex);
6861} 6861}
6862 6862
6863static void iwl_bg_request_scan(struct work_struct *data) 6863static void iwl4965_bg_request_scan(struct work_struct *data)
6864{ 6864{
6865 struct iwl_priv *priv = 6865 struct iwl4965_priv *priv =
6866 container_of(data, struct iwl_priv, request_scan); 6866 container_of(data, struct iwl4965_priv, request_scan);
6867 struct iwl_host_cmd cmd = { 6867 struct iwl4965_host_cmd cmd = {
6868 .id = REPLY_SCAN_CMD, 6868 .id = REPLY_SCAN_CMD,
6869 .len = sizeof(struct iwl_scan_cmd), 6869 .len = sizeof(struct iwl4965_scan_cmd),
6870 .meta.flags = CMD_SIZE_HUGE, 6870 .meta.flags = CMD_SIZE_HUGE,
6871 }; 6871 };
6872 int rc = 0; 6872 int rc = 0;
6873 struct iwl_scan_cmd *scan; 6873 struct iwl4965_scan_cmd *scan;
6874 struct ieee80211_conf *conf = NULL; 6874 struct ieee80211_conf *conf = NULL;
6875 u8 direct_mask; 6875 u8 direct_mask;
6876 int phymode; 6876 int phymode;
@@ -6879,7 +6879,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6879 6879
6880 mutex_lock(&priv->mutex); 6880 mutex_lock(&priv->mutex);
6881 6881
6882 if (!iwl_is_ready(priv)) { 6882 if (!iwl4965_is_ready(priv)) {
6883 IWL_WARNING("request scan called when driver not ready.\n"); 6883 IWL_WARNING("request scan called when driver not ready.\n");
6884 goto done; 6884 goto done;
6885 } 6885 }
@@ -6908,7 +6908,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6908 goto done; 6908 goto done;
6909 } 6909 }
6910 6910
6911 if (iwl_is_rfkill(priv)) { 6911 if (iwl4965_is_rfkill(priv)) {
6912 IWL_DEBUG_HC("Aborting scan due to RF Kill activation\n"); 6912 IWL_DEBUG_HC("Aborting scan due to RF Kill activation\n");
6913 goto done; 6913 goto done;
6914 } 6914 }
@@ -6924,7 +6924,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6924 } 6924 }
6925 6925
6926 if (!priv->scan) { 6926 if (!priv->scan) {
6927 priv->scan = kmalloc(sizeof(struct iwl_scan_cmd) + 6927 priv->scan = kmalloc(sizeof(struct iwl4965_scan_cmd) +
6928 IWL_MAX_SCAN_SIZE, GFP_KERNEL); 6928 IWL_MAX_SCAN_SIZE, GFP_KERNEL);
6929 if (!priv->scan) { 6929 if (!priv->scan) {
6930 rc = -ENOMEM; 6930 rc = -ENOMEM;
@@ -6932,12 +6932,12 @@ static void iwl_bg_request_scan(struct work_struct *data)
6932 } 6932 }
6933 } 6933 }
6934 scan = priv->scan; 6934 scan = priv->scan;
6935 memset(scan, 0, sizeof(struct iwl_scan_cmd) + IWL_MAX_SCAN_SIZE); 6935 memset(scan, 0, sizeof(struct iwl4965_scan_cmd) + IWL_MAX_SCAN_SIZE);
6936 6936
6937 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; 6937 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH;
6938 scan->quiet_time = IWL_ACTIVE_QUIET_TIME; 6938 scan->quiet_time = IWL_ACTIVE_QUIET_TIME;
6939 6939
6940 if (iwl_is_associated(priv)) { 6940 if (iwl4965_is_associated(priv)) {
6941 u16 interval = 0; 6941 u16 interval = 0;
6942 u32 extra; 6942 u32 extra;
6943 u32 suspend_time = 100; 6943 u32 suspend_time = 100;
@@ -6967,14 +6967,14 @@ static void iwl_bg_request_scan(struct work_struct *data)
6967 if (priv->one_direct_scan) { 6967 if (priv->one_direct_scan) {
6968 IWL_DEBUG_SCAN 6968 IWL_DEBUG_SCAN
6969 ("Kicking off one direct scan for '%s'\n", 6969 ("Kicking off one direct scan for '%s'\n",
6970 iwl_escape_essid(priv->direct_ssid, 6970 iwl4965_escape_essid(priv->direct_ssid,
6971 priv->direct_ssid_len)); 6971 priv->direct_ssid_len));
6972 scan->direct_scan[0].id = WLAN_EID_SSID; 6972 scan->direct_scan[0].id = WLAN_EID_SSID;
6973 scan->direct_scan[0].len = priv->direct_ssid_len; 6973 scan->direct_scan[0].len = priv->direct_ssid_len;
6974 memcpy(scan->direct_scan[0].ssid, 6974 memcpy(scan->direct_scan[0].ssid,
6975 priv->direct_ssid, priv->direct_ssid_len); 6975 priv->direct_ssid, priv->direct_ssid_len);
6976 direct_mask = 1; 6976 direct_mask = 1;
6977 } else if (!iwl_is_associated(priv) && priv->essid_len) { 6977 } else if (!iwl4965_is_associated(priv) && priv->essid_len) {
6978 scan->direct_scan[0].id = WLAN_EID_SSID; 6978 scan->direct_scan[0].id = WLAN_EID_SSID;
6979 scan->direct_scan[0].len = priv->essid_len; 6979 scan->direct_scan[0].len = priv->essid_len;
6980 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); 6980 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
@@ -6985,7 +6985,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6985 /* We don't build a direct scan probe request; the uCode will do 6985 /* We don't build a direct scan probe request; the uCode will do
6986 * that based on the direct_mask added to each channel entry */ 6986 * that based on the direct_mask added to each channel entry */
6987 scan->tx_cmd.len = cpu_to_le16( 6987 scan->tx_cmd.len = cpu_to_le16(
6988 iwl_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, 6988 iwl4965_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data,
6989 IWL_MAX_SCAN_SIZE - sizeof(scan), 0)); 6989 IWL_MAX_SCAN_SIZE - sizeof(scan), 0));
6990 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; 6990 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
6991 scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; 6991 scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id;
@@ -6999,7 +6999,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6999 case 2: 6999 case 2:
7000 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; 7000 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
7001 scan->tx_cmd.rate_n_flags = 7001 scan->tx_cmd.rate_n_flags =
7002 iwl_hw_set_rate_n_flags(IWL_RATE_1M_PLCP, 7002 iwl4965_hw_set_rate_n_flags(IWL_RATE_1M_PLCP,
7003 RATE_MCS_ANT_B_MSK|RATE_MCS_CCK_MSK); 7003 RATE_MCS_ANT_B_MSK|RATE_MCS_CCK_MSK);
7004 7004
7005 scan->good_CRC_th = 0; 7005 scan->good_CRC_th = 0;
@@ -7008,7 +7008,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
7008 7008
7009 case 1: 7009 case 1:
7010 scan->tx_cmd.rate_n_flags = 7010 scan->tx_cmd.rate_n_flags =
7011 iwl_hw_set_rate_n_flags(IWL_RATE_6M_PLCP, 7011 iwl4965_hw_set_rate_n_flags(IWL_RATE_6M_PLCP,
7012 RATE_MCS_ANT_B_MSK); 7012 RATE_MCS_ANT_B_MSK);
7013 scan->good_CRC_th = IWL_GOOD_CRC_TH; 7013 scan->good_CRC_th = IWL_GOOD_CRC_TH;
7014 phymode = MODE_IEEE80211A; 7014 phymode = MODE_IEEE80211A;
@@ -7035,23 +7035,23 @@ static void iwl_bg_request_scan(struct work_struct *data)
7035 if (direct_mask) 7035 if (direct_mask)
7036 IWL_DEBUG_SCAN 7036 IWL_DEBUG_SCAN
7037 ("Initiating direct scan for %s.\n", 7037 ("Initiating direct scan for %s.\n",
7038 iwl_escape_essid(priv->essid, priv->essid_len)); 7038 iwl4965_escape_essid(priv->essid, priv->essid_len));
7039 else 7039 else
7040 IWL_DEBUG_SCAN("Initiating indirect scan.\n"); 7040 IWL_DEBUG_SCAN("Initiating indirect scan.\n");
7041 7041
7042 scan->channel_count = 7042 scan->channel_count =
7043 iwl_get_channels_for_scan( 7043 iwl4965_get_channels_for_scan(
7044 priv, phymode, 1, /* active */ 7044 priv, phymode, 1, /* active */
7045 direct_mask, 7045 direct_mask,
7046 (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); 7046 (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]);
7047 7047
7048 cmd.len += le16_to_cpu(scan->tx_cmd.len) + 7048 cmd.len += le16_to_cpu(scan->tx_cmd.len) +
7049 scan->channel_count * sizeof(struct iwl_scan_channel); 7049 scan->channel_count * sizeof(struct iwl4965_scan_channel);
7050 cmd.data = scan; 7050 cmd.data = scan;
7051 scan->len = cpu_to_le16(cmd.len); 7051 scan->len = cpu_to_le16(cmd.len);
7052 7052
7053 set_bit(STATUS_SCAN_HW, &priv->status); 7053 set_bit(STATUS_SCAN_HW, &priv->status);
7054 rc = iwl_send_cmd_sync(priv, &cmd); 7054 rc = iwl4965_send_cmd_sync(priv, &cmd);
7055 if (rc) 7055 if (rc)
7056 goto done; 7056 goto done;
7057 7057
@@ -7067,45 +7067,45 @@ static void iwl_bg_request_scan(struct work_struct *data)
7067 mutex_unlock(&priv->mutex); 7067 mutex_unlock(&priv->mutex);
7068} 7068}
7069 7069
7070static void iwl_bg_up(struct work_struct *data) 7070static void iwl4965_bg_up(struct work_struct *data)
7071{ 7071{
7072 struct iwl_priv *priv = container_of(data, struct iwl_priv, up); 7072 struct iwl4965_priv *priv = container_of(data, struct iwl4965_priv, up);
7073 7073
7074 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 7074 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
7075 return; 7075 return;
7076 7076
7077 mutex_lock(&priv->mutex); 7077 mutex_lock(&priv->mutex);
7078 __iwl_up(priv); 7078 __iwl4965_up(priv);
7079 mutex_unlock(&priv->mutex); 7079 mutex_unlock(&priv->mutex);
7080} 7080}
7081 7081
7082static void iwl_bg_restart(struct work_struct *data) 7082static void iwl4965_bg_restart(struct work_struct *data)
7083{ 7083{
7084 struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); 7084 struct iwl4965_priv *priv = container_of(data, struct iwl4965_priv, restart);
7085 7085
7086 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 7086 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
7087 return; 7087 return;
7088 7088
7089 iwl_down(priv); 7089 iwl4965_down(priv);
7090 queue_work(priv->workqueue, &priv->up); 7090 queue_work(priv->workqueue, &priv->up);
7091} 7091}
7092 7092
7093static void iwl_bg_rx_replenish(struct work_struct *data) 7093static void iwl4965_bg_rx_replenish(struct work_struct *data)
7094{ 7094{
7095 struct iwl_priv *priv = 7095 struct iwl4965_priv *priv =
7096 container_of(data, struct iwl_priv, rx_replenish); 7096 container_of(data, struct iwl4965_priv, rx_replenish);
7097 7097
7098 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 7098 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
7099 return; 7099 return;
7100 7100
7101 mutex_lock(&priv->mutex); 7101 mutex_lock(&priv->mutex);
7102 iwl_rx_replenish(priv); 7102 iwl4965_rx_replenish(priv);
7103 mutex_unlock(&priv->mutex); 7103 mutex_unlock(&priv->mutex);
7104} 7104}
7105 7105
7106static void iwl_bg_post_associate(struct work_struct *data) 7106static void iwl4965_bg_post_associate(struct work_struct *data)
7107{ 7107{
7108 struct iwl_priv *priv = container_of(data, struct iwl_priv, 7108 struct iwl4965_priv *priv = container_of(data, struct iwl4965_priv,
7109 post_associate.work); 7109 post_associate.work);
7110 7110
7111 int rc = 0; 7111 int rc = 0;
@@ -7131,16 +7131,16 @@ static void iwl_bg_post_associate(struct work_struct *data)
7131 mutex_unlock(&priv->mutex); 7131 mutex_unlock(&priv->mutex);
7132 return; 7132 return;
7133 } 7133 }
7134 iwl_scan_cancel_timeout(priv, 200); 7134 iwl4965_scan_cancel_timeout(priv, 200);
7135 7135
7136 conf = ieee80211_get_hw_conf(priv->hw); 7136 conf = ieee80211_get_hw_conf(priv->hw);
7137 7137
7138 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7138 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7139 iwl_commit_rxon(priv); 7139 iwl4965_commit_rxon(priv);
7140 7140
7141 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); 7141 memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd));
7142 iwl_setup_rxon_timing(priv); 7142 iwl4965_setup_rxon_timing(priv);
7143 rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, 7143 rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON_TIMING,
7144 sizeof(priv->rxon_timing), &priv->rxon_timing); 7144 sizeof(priv->rxon_timing), &priv->rxon_timing);
7145 if (rc) 7145 if (rc)
7146 IWL_WARNING("REPLY_RXON_TIMING failed - " 7146 IWL_WARNING("REPLY_RXON_TIMING failed - "
@@ -7179,22 +7179,22 @@ static void iwl_bg_post_associate(struct work_struct *data)
7179 7179
7180 } 7180 }
7181 7181
7182 iwl_commit_rxon(priv); 7182 iwl4965_commit_rxon(priv);
7183 7183
7184 switch (priv->iw_mode) { 7184 switch (priv->iw_mode) {
7185 case IEEE80211_IF_TYPE_STA: 7185 case IEEE80211_IF_TYPE_STA:
7186 iwl_rate_scale_init(priv->hw, IWL_AP_ID); 7186 iwl4965_rate_scale_init(priv->hw, IWL_AP_ID);
7187 break; 7187 break;
7188 7188
7189 case IEEE80211_IF_TYPE_IBSS: 7189 case IEEE80211_IF_TYPE_IBSS:
7190 7190
7191 /* clear out the station table */ 7191 /* clear out the station table */
7192 iwl_clear_stations_table(priv); 7192 iwl4965_clear_stations_table(priv);
7193 7193
7194 iwl_rxon_add_station(priv, BROADCAST_ADDR, 0); 7194 iwl4965_rxon_add_station(priv, iwl4965_broadcast_addr, 0);
7195 iwl_rxon_add_station(priv, priv->bssid, 0); 7195 iwl4965_rxon_add_station(priv, priv->bssid, 0);
7196 iwl_rate_scale_init(priv->hw, IWL_STA_ID); 7196 iwl4965_rate_scale_init(priv->hw, IWL_STA_ID);
7197 iwl_send_beacon_cmd(priv); 7197 iwl4965_send_beacon_cmd(priv);
7198 7198
7199 break; 7199 break;
7200 7200
@@ -7204,7 +7204,7 @@ static void iwl_bg_post_associate(struct work_struct *data)
7204 break; 7204 break;
7205 } 7205 }
7206 7206
7207 iwl_sequence_reset(priv); 7207 iwl4965_sequence_reset(priv);
7208 7208
7209#ifdef CONFIG_IWL4965_SENSITIVITY 7209#ifdef CONFIG_IWL4965_SENSITIVITY
7210 /* Enable Rx differential gain and sensitivity calibrations */ 7210 /* Enable Rx differential gain and sensitivity calibrations */
@@ -7216,30 +7216,30 @@ static void iwl_bg_post_associate(struct work_struct *data)
7216 priv->assoc_station_added = 1; 7216 priv->assoc_station_added = 1;
7217 7217
7218#ifdef CONFIG_IWL4965_QOS 7218#ifdef CONFIG_IWL4965_QOS
7219 iwl_activate_qos(priv, 0); 7219 iwl4965_activate_qos(priv, 0);
7220#endif /* CONFIG_IWL4965_QOS */ 7220#endif /* CONFIG_IWL4965_QOS */
7221 mutex_unlock(&priv->mutex); 7221 mutex_unlock(&priv->mutex);
7222} 7222}
7223 7223
7224static void iwl_bg_abort_scan(struct work_struct *work) 7224static void iwl4965_bg_abort_scan(struct work_struct *work)
7225{ 7225{
7226 struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); 7226 struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv, abort_scan);
7227 7227
7228 if (!iwl_is_ready(priv)) 7228 if (!iwl4965_is_ready(priv))
7229 return; 7229 return;
7230 7230
7231 mutex_lock(&priv->mutex); 7231 mutex_lock(&priv->mutex);
7232 7232
7233 set_bit(STATUS_SCAN_ABORTING, &priv->status); 7233 set_bit(STATUS_SCAN_ABORTING, &priv->status);
7234 iwl_send_scan_abort(priv); 7234 iwl4965_send_scan_abort(priv);
7235 7235
7236 mutex_unlock(&priv->mutex); 7236 mutex_unlock(&priv->mutex);
7237} 7237}
7238 7238
7239static void iwl_bg_scan_completed(struct work_struct *work) 7239static void iwl4965_bg_scan_completed(struct work_struct *work)
7240{ 7240{
7241 struct iwl_priv *priv = 7241 struct iwl4965_priv *priv =
7242 container_of(work, struct iwl_priv, scan_completed); 7242 container_of(work, struct iwl4965_priv, scan_completed);
7243 7243
7244 IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, "SCAN complete scan\n"); 7244 IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, "SCAN complete scan\n");
7245 7245
@@ -7251,7 +7251,7 @@ static void iwl_bg_scan_completed(struct work_struct *work)
7251 /* Since setting the TXPOWER may have been deferred while 7251 /* Since setting the TXPOWER may have been deferred while
7252 * performing the scan, fire one off */ 7252 * performing the scan, fire one off */
7253 mutex_lock(&priv->mutex); 7253 mutex_lock(&priv->mutex);
7254 iwl_hw_reg_send_txpower(priv); 7254 iwl4965_hw_reg_send_txpower(priv);
7255 mutex_unlock(&priv->mutex); 7255 mutex_unlock(&priv->mutex);
7256} 7256}
7257 7257
@@ -7261,9 +7261,9 @@ static void iwl_bg_scan_completed(struct work_struct *work)
7261 * 7261 *
7262 *****************************************************************************/ 7262 *****************************************************************************/
7263 7263
7264static int iwl_mac_start(struct ieee80211_hw *hw) 7264static int iwl4965_mac_start(struct ieee80211_hw *hw)
7265{ 7265{
7266 struct iwl_priv *priv = hw->priv; 7266 struct iwl4965_priv *priv = hw->priv;
7267 7267
7268 IWL_DEBUG_MAC80211("enter\n"); 7268 IWL_DEBUG_MAC80211("enter\n");
7269 7269
@@ -7272,7 +7272,7 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
7272 7272
7273 priv->is_open = 1; 7273 priv->is_open = 1;
7274 7274
7275 if (!iwl_is_rfkill(priv)) 7275 if (!iwl4965_is_rfkill(priv))
7276 ieee80211_start_queues(priv->hw); 7276 ieee80211_start_queues(priv->hw);
7277 7277
7278 mutex_unlock(&priv->mutex); 7278 mutex_unlock(&priv->mutex);
@@ -7280,9 +7280,9 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
7280 return 0; 7280 return 0;
7281} 7281}
7282 7282
7283static void iwl_mac_stop(struct ieee80211_hw *hw) 7283static void iwl4965_mac_stop(struct ieee80211_hw *hw)
7284{ 7284{
7285 struct iwl_priv *priv = hw->priv; 7285 struct iwl4965_priv *priv = hw->priv;
7286 7286
7287 IWL_DEBUG_MAC80211("enter\n"); 7287 IWL_DEBUG_MAC80211("enter\n");
7288 7288
@@ -7292,19 +7292,19 @@ static void iwl_mac_stop(struct ieee80211_hw *hw)
7292 * RXON_FILTER_ASSOC_MSK BIT 7292 * RXON_FILTER_ASSOC_MSK BIT
7293 */ 7293 */
7294 priv->is_open = 0; 7294 priv->is_open = 0;
7295 iwl_scan_cancel_timeout(priv, 100); 7295 iwl4965_scan_cancel_timeout(priv, 100);
7296 cancel_delayed_work(&priv->post_associate); 7296 cancel_delayed_work(&priv->post_associate);
7297 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7297 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7298 iwl_commit_rxon(priv); 7298 iwl4965_commit_rxon(priv);
7299 mutex_unlock(&priv->mutex); 7299 mutex_unlock(&priv->mutex);
7300 7300
7301 IWL_DEBUG_MAC80211("leave\n"); 7301 IWL_DEBUG_MAC80211("leave\n");
7302} 7302}
7303 7303
7304static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, 7304static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
7305 struct ieee80211_tx_control *ctl) 7305 struct ieee80211_tx_control *ctl)
7306{ 7306{
7307 struct iwl_priv *priv = hw->priv; 7307 struct iwl4965_priv *priv = hw->priv;
7308 7308
7309 IWL_DEBUG_MAC80211("enter\n"); 7309 IWL_DEBUG_MAC80211("enter\n");
7310 7310
@@ -7316,17 +7316,17 @@ static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
7316 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 7316 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
7317 ctl->tx_rate); 7317 ctl->tx_rate);
7318 7318
7319 if (iwl_tx_skb(priv, skb, ctl)) 7319 if (iwl4965_tx_skb(priv, skb, ctl))
7320 dev_kfree_skb_any(skb); 7320 dev_kfree_skb_any(skb);
7321 7321
7322 IWL_DEBUG_MAC80211("leave\n"); 7322 IWL_DEBUG_MAC80211("leave\n");
7323 return 0; 7323 return 0;
7324} 7324}
7325 7325
7326static int iwl_mac_add_interface(struct ieee80211_hw *hw, 7326static int iwl4965_mac_add_interface(struct ieee80211_hw *hw,
7327 struct ieee80211_if_init_conf *conf) 7327 struct ieee80211_if_init_conf *conf)
7328{ 7328{
7329 struct iwl_priv *priv = hw->priv; 7329 struct iwl4965_priv *priv = hw->priv;
7330 unsigned long flags; 7330 unsigned long flags;
7331 DECLARE_MAC_BUF(mac); 7331 DECLARE_MAC_BUF(mac);
7332 7332
@@ -7348,7 +7348,7 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
7348 IWL_DEBUG_MAC80211("Set %s\n", print_mac(mac, conf->mac_addr)); 7348 IWL_DEBUG_MAC80211("Set %s\n", print_mac(mac, conf->mac_addr));
7349 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); 7349 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
7350 } 7350 }
7351 iwl_set_mode(priv, conf->type); 7351 iwl4965_set_mode(priv, conf->type);
7352 7352
7353 IWL_DEBUG_MAC80211("leave\n"); 7353 IWL_DEBUG_MAC80211("leave\n");
7354 mutex_unlock(&priv->mutex); 7354 mutex_unlock(&priv->mutex);
@@ -7357,22 +7357,22 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
7357} 7357}
7358 7358
7359/** 7359/**
7360 * iwl_mac_config - mac80211 config callback 7360 * iwl4965_mac_config - mac80211 config callback
7361 * 7361 *
7362 * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to 7362 * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to
7363 * be set inappropriately and the driver currently sets the hardware up to 7363 * be set inappropriately and the driver currently sets the hardware up to
7364 * use it whenever needed. 7364 * use it whenever needed.
7365 */ 7365 */
7366static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) 7366static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
7367{ 7367{
7368 struct iwl_priv *priv = hw->priv; 7368 struct iwl4965_priv *priv = hw->priv;
7369 const struct iwl_channel_info *ch_info; 7369 const struct iwl4965_channel_info *ch_info;
7370 unsigned long flags; 7370 unsigned long flags;
7371 7371
7372 mutex_lock(&priv->mutex); 7372 mutex_lock(&priv->mutex);
7373 IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel); 7373 IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel);
7374 7374
7375 if (!iwl_is_ready(priv)) { 7375 if (!iwl4965_is_ready(priv)) {
7376 IWL_DEBUG_MAC80211("leave - not ready\n"); 7376 IWL_DEBUG_MAC80211("leave - not ready\n");
7377 mutex_unlock(&priv->mutex); 7377 mutex_unlock(&priv->mutex);
7378 return -EIO; 7378 return -EIO;
@@ -7380,7 +7380,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
7380 7380
7381 /* TODO: Figure out how to get ieee80211_local->sta_scanning w/ only 7381 /* TODO: Figure out how to get ieee80211_local->sta_scanning w/ only
7382 * what is exposed through include/ declarations */ 7382 * what is exposed through include/ declarations */
7383 if (unlikely(!iwl_param_disable_hw_scan && 7383 if (unlikely(!iwl4965_param_disable_hw_scan &&
7384 test_bit(STATUS_SCANNING, &priv->status))) { 7384 test_bit(STATUS_SCANNING, &priv->status))) {
7385 IWL_DEBUG_MAC80211("leave - scanning\n"); 7385 IWL_DEBUG_MAC80211("leave - scanning\n");
7386 mutex_unlock(&priv->mutex); 7386 mutex_unlock(&priv->mutex);
@@ -7389,7 +7389,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
7389 7389
7390 spin_lock_irqsave(&priv->lock, flags); 7390 spin_lock_irqsave(&priv->lock, flags);
7391 7391
7392 ch_info = iwl_get_channel_info(priv, conf->phymode, conf->channel); 7392 ch_info = iwl4965_get_channel_info(priv, conf->phymode, conf->channel);
7393 if (!is_channel_valid(ch_info)) { 7393 if (!is_channel_valid(ch_info)) {
7394 IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this SKU.\n", 7394 IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this SKU.\n",
7395 conf->channel, conf->phymode); 7395 conf->channel, conf->phymode);
@@ -7411,26 +7411,26 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
7411 priv->staging_rxon.flags = 0; 7411 priv->staging_rxon.flags = 0;
7412#endif /* CONFIG_IWL4965_HT */ 7412#endif /* CONFIG_IWL4965_HT */
7413 7413
7414 iwl_set_rxon_channel(priv, conf->phymode, conf->channel); 7414 iwl4965_set_rxon_channel(priv, conf->phymode, conf->channel);
7415 7415
7416 iwl_set_flags_for_phymode(priv, conf->phymode); 7416 iwl4965_set_flags_for_phymode(priv, conf->phymode);
7417 7417
7418 /* The list of supported rates and rate mask can be different 7418 /* The list of supported rates and rate mask can be different
7419 * for each phymode; since the phymode may have changed, reset 7419 * for each phymode; since the phymode may have changed, reset
7420 * the rate mask to what mac80211 lists */ 7420 * the rate mask to what mac80211 lists */
7421 iwl_set_rate(priv); 7421 iwl4965_set_rate(priv);
7422 7422
7423 spin_unlock_irqrestore(&priv->lock, flags); 7423 spin_unlock_irqrestore(&priv->lock, flags);
7424 7424
7425#ifdef IEEE80211_CONF_CHANNEL_SWITCH 7425#ifdef IEEE80211_CONF_CHANNEL_SWITCH
7426 if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) { 7426 if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) {
7427 iwl_hw_channel_switch(priv, conf->channel); 7427 iwl4965_hw_channel_switch(priv, conf->channel);
7428 mutex_unlock(&priv->mutex); 7428 mutex_unlock(&priv->mutex);
7429 return 0; 7429 return 0;
7430 } 7430 }
7431#endif 7431#endif
7432 7432
7433 iwl_radio_kill_sw(priv, !conf->radio_enabled); 7433 iwl4965_radio_kill_sw(priv, !conf->radio_enabled);
7434 7434
7435 if (!conf->radio_enabled) { 7435 if (!conf->radio_enabled) {
7436 IWL_DEBUG_MAC80211("leave - radio disabled\n"); 7436 IWL_DEBUG_MAC80211("leave - radio disabled\n");
@@ -7438,17 +7438,17 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
7438 return 0; 7438 return 0;
7439 } 7439 }
7440 7440
7441 if (iwl_is_rfkill(priv)) { 7441 if (iwl4965_is_rfkill(priv)) {
7442 IWL_DEBUG_MAC80211("leave - RF kill\n"); 7442 IWL_DEBUG_MAC80211("leave - RF kill\n");
7443 mutex_unlock(&priv->mutex); 7443 mutex_unlock(&priv->mutex);
7444 return -EIO; 7444 return -EIO;
7445 } 7445 }
7446 7446
7447 iwl_set_rate(priv); 7447 iwl4965_set_rate(priv);
7448 7448
7449 if (memcmp(&priv->active_rxon, 7449 if (memcmp(&priv->active_rxon,
7450 &priv->staging_rxon, sizeof(priv->staging_rxon))) 7450 &priv->staging_rxon, sizeof(priv->staging_rxon)))
7451 iwl_commit_rxon(priv); 7451 iwl4965_commit_rxon(priv);
7452 else 7452 else
7453 IWL_DEBUG_INFO("No re-sending same RXON configuration.\n"); 7453 IWL_DEBUG_INFO("No re-sending same RXON configuration.\n");
7454 7454
@@ -7459,7 +7459,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
7459 return 0; 7459 return 0;
7460} 7460}
7461 7461
7462static void iwl_config_ap(struct iwl_priv *priv) 7462static void iwl4965_config_ap(struct iwl4965_priv *priv)
7463{ 7463{
7464 int rc = 0; 7464 int rc = 0;
7465 7465
@@ -7471,12 +7471,12 @@ static void iwl_config_ap(struct iwl_priv *priv)
7471 7471
7472 /* RXON - unassoc (to set timing command) */ 7472 /* RXON - unassoc (to set timing command) */
7473 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7473 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7474 iwl_commit_rxon(priv); 7474 iwl4965_commit_rxon(priv);
7475 7475
7476 /* RXON Timing */ 7476 /* RXON Timing */
7477 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); 7477 memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd));
7478 iwl_setup_rxon_timing(priv); 7478 iwl4965_setup_rxon_timing(priv);
7479 rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, 7479 rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON_TIMING,
7480 sizeof(priv->rxon_timing), &priv->rxon_timing); 7480 sizeof(priv->rxon_timing), &priv->rxon_timing);
7481 if (rc) 7481 if (rc)
7482 IWL_WARNING("REPLY_RXON_TIMING failed - " 7482 IWL_WARNING("REPLY_RXON_TIMING failed - "
@@ -7508,23 +7508,23 @@ static void iwl_config_ap(struct iwl_priv *priv)
7508 } 7508 }
7509 /* restore RXON assoc */ 7509 /* restore RXON assoc */
7510 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; 7510 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
7511 iwl_commit_rxon(priv); 7511 iwl4965_commit_rxon(priv);
7512#ifdef CONFIG_IWL4965_QOS 7512#ifdef CONFIG_IWL4965_QOS
7513 iwl_activate_qos(priv, 1); 7513 iwl4965_activate_qos(priv, 1);
7514#endif 7514#endif
7515 iwl_rxon_add_station(priv, BROADCAST_ADDR, 0); 7515 iwl4965_rxon_add_station(priv, iwl4965_broadcast_addr, 0);
7516 } 7516 }
7517 iwl_send_beacon_cmd(priv); 7517 iwl4965_send_beacon_cmd(priv);
7518 7518
7519 /* FIXME - we need to add code here to detect a totally new 7519 /* FIXME - we need to add code here to detect a totally new
7520 * configuration, reset the AP, unassoc, rxon timing, assoc, 7520 * configuration, reset the AP, unassoc, rxon timing, assoc,
7521 * clear sta table, add BCAST sta... */ 7521 * clear sta table, add BCAST sta... */
7522} 7522}
7523 7523
7524static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, 7524static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7525 struct ieee80211_if_conf *conf) 7525 struct ieee80211_if_conf *conf)
7526{ 7526{
7527 struct iwl_priv *priv = hw->priv; 7527 struct iwl4965_priv *priv = hw->priv;
7528 DECLARE_MAC_BUF(mac); 7528 DECLARE_MAC_BUF(mac);
7529 unsigned long flags; 7529 unsigned long flags;
7530 int rc; 7530 int rc;
@@ -7581,7 +7581,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7581 !is_multicast_ether_addr(conf->bssid)) { 7581 !is_multicast_ether_addr(conf->bssid)) {
7582 /* If there is currently a HW scan going on in the background 7582 /* If there is currently a HW scan going on in the background
7583 * then we need to cancel it else the RXON below will fail. */ 7583 * then we need to cancel it else the RXON below will fail. */
7584 if (iwl_scan_cancel_timeout(priv, 100)) { 7584 if (iwl4965_scan_cancel_timeout(priv, 100)) {
7585 IWL_WARNING("Aborted scan still in progress " 7585 IWL_WARNING("Aborted scan still in progress "
7586 "after 100ms\n"); 7586 "after 100ms\n");
7587 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); 7587 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n");
@@ -7597,18 +7597,18 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7597 memcpy(priv->bssid, conf->bssid, ETH_ALEN); 7597 memcpy(priv->bssid, conf->bssid, ETH_ALEN);
7598 7598
7599 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) 7599 if (priv->iw_mode == IEEE80211_IF_TYPE_AP)
7600 iwl_config_ap(priv); 7600 iwl4965_config_ap(priv);
7601 else { 7601 else {
7602 rc = iwl_commit_rxon(priv); 7602 rc = iwl4965_commit_rxon(priv);
7603 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) 7603 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc)
7604 iwl_rxon_add_station( 7604 iwl4965_rxon_add_station(
7605 priv, priv->active_rxon.bssid_addr, 1); 7605 priv, priv->active_rxon.bssid_addr, 1);
7606 } 7606 }
7607 7607
7608 } else { 7608 } else {
7609 iwl_scan_cancel_timeout(priv, 100); 7609 iwl4965_scan_cancel_timeout(priv, 100);
7610 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7610 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7611 iwl_commit_rxon(priv); 7611 iwl4965_commit_rxon(priv);
7612 } 7612 }
7613 7613
7614 spin_lock_irqsave(&priv->lock, flags); 7614 spin_lock_irqsave(&priv->lock, flags);
@@ -7626,31 +7626,31 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7626 return 0; 7626 return 0;
7627} 7627}
7628 7628
7629static void iwl_configure_filter(struct ieee80211_hw *hw, 7629static void iwl4965_configure_filter(struct ieee80211_hw *hw,
7630 unsigned int changed_flags, 7630 unsigned int changed_flags,
7631 unsigned int *total_flags, 7631 unsigned int *total_flags,
7632 int mc_count, struct dev_addr_list *mc_list) 7632 int mc_count, struct dev_addr_list *mc_list)
7633{ 7633{
7634 /* 7634 /*
7635 * XXX: dummy 7635 * XXX: dummy
7636 * see also iwl_connection_init_rx_config 7636 * see also iwl4965_connection_init_rx_config
7637 */ 7637 */
7638 *total_flags = 0; 7638 *total_flags = 0;
7639} 7639}
7640 7640
7641static void iwl_mac_remove_interface(struct ieee80211_hw *hw, 7641static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw,
7642 struct ieee80211_if_init_conf *conf) 7642 struct ieee80211_if_init_conf *conf)
7643{ 7643{
7644 struct iwl_priv *priv = hw->priv; 7644 struct iwl4965_priv *priv = hw->priv;
7645 7645
7646 IWL_DEBUG_MAC80211("enter\n"); 7646 IWL_DEBUG_MAC80211("enter\n");
7647 7647
7648 mutex_lock(&priv->mutex); 7648 mutex_lock(&priv->mutex);
7649 7649
7650 iwl_scan_cancel_timeout(priv, 100); 7650 iwl4965_scan_cancel_timeout(priv, 100);
7651 cancel_delayed_work(&priv->post_associate); 7651 cancel_delayed_work(&priv->post_associate);
7652 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7652 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7653 iwl_commit_rxon(priv); 7653 iwl4965_commit_rxon(priv);
7654 7654
7655 if (priv->interface_id == conf->if_id) { 7655 if (priv->interface_id == conf->if_id) {
7656 priv->interface_id = 0; 7656 priv->interface_id = 0;
@@ -7663,11 +7663,10 @@ static void iwl_mac_remove_interface(struct ieee80211_hw *hw,
7663 IWL_DEBUG_MAC80211("leave\n"); 7663 IWL_DEBUG_MAC80211("leave\n");
7664 7664
7665} 7665}
7666static void iwl_mac_erp_ie_changed(struct ieee80211_hw *hw, 7666static void iwl4965_mac_erp_ie_changed(struct ieee80211_hw *hw,
7667 u8 changes, int cts_protection, int preamble) 7667 u8 changes, int cts_protection, int preamble)
7668{ 7668{
7669 7669 struct iwl4965_priv *priv = hw->priv;
7670 struct iwl_priv *priv = hw->priv;
7671 7670
7672 if (changes & IEEE80211_ERP_CHANGE_PREAMBLE) { 7671 if (changes & IEEE80211_ERP_CHANGE_PREAMBLE) {
7673 if (preamble == WLAN_ERP_PREAMBLE_SHORT) 7672 if (preamble == WLAN_ERP_PREAMBLE_SHORT)
@@ -7683,23 +7682,23 @@ static void iwl_mac_erp_ie_changed(struct ieee80211_hw *hw,
7683 priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; 7682 priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
7684 } 7683 }
7685 7684
7686 if (iwl_is_associated(priv)) 7685 if (iwl4965_is_associated(priv))
7687 iwl_send_rxon_assoc(priv); 7686 iwl4965_send_rxon_assoc(priv);
7688} 7687}
7689 7688
7690#define IWL_DELAY_NEXT_SCAN (HZ*2) 7689#define IWL_DELAY_NEXT_SCAN (HZ*2)
7691static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) 7690static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7692{ 7691{
7693 int rc = 0; 7692 int rc = 0;
7694 unsigned long flags; 7693 unsigned long flags;
7695 struct iwl_priv *priv = hw->priv; 7694 struct iwl4965_priv *priv = hw->priv;
7696 7695
7697 IWL_DEBUG_MAC80211("enter\n"); 7696 IWL_DEBUG_MAC80211("enter\n");
7698 7697
7699 mutex_lock(&priv->mutex); 7698 mutex_lock(&priv->mutex);
7700 spin_lock_irqsave(&priv->lock, flags); 7699 spin_lock_irqsave(&priv->lock, flags);
7701 7700
7702 if (!iwl_is_ready_rf(priv)) { 7701 if (!iwl4965_is_ready_rf(priv)) {
7703 rc = -EIO; 7702 rc = -EIO;
7704 IWL_DEBUG_MAC80211("leave - not ready or exit pending\n"); 7703 IWL_DEBUG_MAC80211("leave - not ready or exit pending\n");
7705 goto out_unlock; 7704 goto out_unlock;
@@ -7721,7 +7720,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7721 if (len) { 7720 if (len) {
7722 IWL_DEBUG_SCAN("direct scan for " 7721 IWL_DEBUG_SCAN("direct scan for "
7723 "%s [%d]\n ", 7722 "%s [%d]\n ",
7724 iwl_escape_essid(ssid, len), (int)len); 7723 iwl4965_escape_essid(ssid, len), (int)len);
7725 7724
7726 priv->one_direct_scan = 1; 7725 priv->one_direct_scan = 1;
7727 priv->direct_ssid_len = (u8) 7726 priv->direct_ssid_len = (u8)
@@ -7730,7 +7729,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7730 } else 7729 } else
7731 priv->one_direct_scan = 0; 7730 priv->one_direct_scan = 0;
7732 7731
7733 rc = iwl_scan_initiate(priv); 7732 rc = iwl4965_scan_initiate(priv);
7734 7733
7735 IWL_DEBUG_MAC80211("leave\n"); 7734 IWL_DEBUG_MAC80211("leave\n");
7736 7735
@@ -7741,18 +7740,18 @@ out_unlock:
7741 return rc; 7740 return rc;
7742} 7741}
7743 7742
7744static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 7743static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7745 const u8 *local_addr, const u8 *addr, 7744 const u8 *local_addr, const u8 *addr,
7746 struct ieee80211_key_conf *key) 7745 struct ieee80211_key_conf *key)
7747{ 7746{
7748 struct iwl_priv *priv = hw->priv; 7747 struct iwl4965_priv *priv = hw->priv;
7749 DECLARE_MAC_BUF(mac); 7748 DECLARE_MAC_BUF(mac);
7750 int rc = 0; 7749 int rc = 0;
7751 u8 sta_id; 7750 u8 sta_id;
7752 7751
7753 IWL_DEBUG_MAC80211("enter\n"); 7752 IWL_DEBUG_MAC80211("enter\n");
7754 7753
7755 if (!iwl_param_hwcrypto) { 7754 if (!iwl4965_param_hwcrypto) {
7756 IWL_DEBUG_MAC80211("leave - hwcrypto disabled\n"); 7755 IWL_DEBUG_MAC80211("leave - hwcrypto disabled\n");
7757 return -EOPNOTSUPP; 7756 return -EOPNOTSUPP;
7758 } 7757 }
@@ -7761,7 +7760,7 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7761 /* only support pairwise keys */ 7760 /* only support pairwise keys */
7762 return -EOPNOTSUPP; 7761 return -EOPNOTSUPP;
7763 7762
7764 sta_id = iwl_hw_find_station(priv, addr); 7763 sta_id = iwl4965_hw_find_station(priv, addr);
7765 if (sta_id == IWL_INVALID_STATION) { 7764 if (sta_id == IWL_INVALID_STATION) {
7766 IWL_DEBUG_MAC80211("leave - %s not in station map.\n", 7765 IWL_DEBUG_MAC80211("leave - %s not in station map.\n",
7767 print_mac(mac, addr)); 7766 print_mac(mac, addr));
@@ -7770,24 +7769,24 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7770 7769
7771 mutex_lock(&priv->mutex); 7770 mutex_lock(&priv->mutex);
7772 7771
7773 iwl_scan_cancel_timeout(priv, 100); 7772 iwl4965_scan_cancel_timeout(priv, 100);
7774 7773
7775 switch (cmd) { 7774 switch (cmd) {
7776 case SET_KEY: 7775 case SET_KEY:
7777 rc = iwl_update_sta_key_info(priv, key, sta_id); 7776 rc = iwl4965_update_sta_key_info(priv, key, sta_id);
7778 if (!rc) { 7777 if (!rc) {
7779 iwl_set_rxon_hwcrypto(priv, 1); 7778 iwl4965_set_rxon_hwcrypto(priv, 1);
7780 iwl_commit_rxon(priv); 7779 iwl4965_commit_rxon(priv);
7781 key->hw_key_idx = sta_id; 7780 key->hw_key_idx = sta_id;
7782 IWL_DEBUG_MAC80211("set_key success, using hwcrypto\n"); 7781 IWL_DEBUG_MAC80211("set_key success, using hwcrypto\n");
7783 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 7782 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
7784 } 7783 }
7785 break; 7784 break;
7786 case DISABLE_KEY: 7785 case DISABLE_KEY:
7787 rc = iwl_clear_sta_key_info(priv, sta_id); 7786 rc = iwl4965_clear_sta_key_info(priv, sta_id);
7788 if (!rc) { 7787 if (!rc) {
7789 iwl_set_rxon_hwcrypto(priv, 0); 7788 iwl4965_set_rxon_hwcrypto(priv, 0);
7790 iwl_commit_rxon(priv); 7789 iwl4965_commit_rxon(priv);
7791 IWL_DEBUG_MAC80211("disable hwcrypto key\n"); 7790 IWL_DEBUG_MAC80211("disable hwcrypto key\n");
7792 } 7791 }
7793 break; 7792 break;
@@ -7801,10 +7800,10 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7801 return rc; 7800 return rc;
7802} 7801}
7803 7802
7804static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, 7803static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, int queue,
7805 const struct ieee80211_tx_queue_params *params) 7804 const struct ieee80211_tx_queue_params *params)
7806{ 7805{
7807 struct iwl_priv *priv = hw->priv; 7806 struct iwl4965_priv *priv = hw->priv;
7808#ifdef CONFIG_IWL4965_QOS 7807#ifdef CONFIG_IWL4965_QOS
7809 unsigned long flags; 7808 unsigned long flags;
7810 int q; 7809 int q;
@@ -7812,7 +7811,7 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue,
7812 7811
7813 IWL_DEBUG_MAC80211("enter\n"); 7812 IWL_DEBUG_MAC80211("enter\n");
7814 7813
7815 if (!iwl_is_ready_rf(priv)) { 7814 if (!iwl4965_is_ready_rf(priv)) {
7816 IWL_DEBUG_MAC80211("leave - RF not ready\n"); 7815 IWL_DEBUG_MAC80211("leave - RF not ready\n");
7817 return -EIO; 7816 return -EIO;
7818 } 7817 }
@@ -7845,9 +7844,9 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue,
7845 7844
7846 mutex_lock(&priv->mutex); 7845 mutex_lock(&priv->mutex);
7847 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) 7846 if (priv->iw_mode == IEEE80211_IF_TYPE_AP)
7848 iwl_activate_qos(priv, 1); 7847 iwl4965_activate_qos(priv, 1);
7849 else if (priv->assoc_id && iwl_is_associated(priv)) 7848 else if (priv->assoc_id && iwl4965_is_associated(priv))
7850 iwl_activate_qos(priv, 0); 7849 iwl4965_activate_qos(priv, 0);
7851 7850
7852 mutex_unlock(&priv->mutex); 7851 mutex_unlock(&priv->mutex);
7853 7852
@@ -7857,18 +7856,18 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue,
7857 return 0; 7856 return 0;
7858} 7857}
7859 7858
7860static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw, 7859static int iwl4965_mac_get_tx_stats(struct ieee80211_hw *hw,
7861 struct ieee80211_tx_queue_stats *stats) 7860 struct ieee80211_tx_queue_stats *stats)
7862{ 7861{
7863 struct iwl_priv *priv = hw->priv; 7862 struct iwl4965_priv *priv = hw->priv;
7864 int i, avail; 7863 int i, avail;
7865 struct iwl_tx_queue *txq; 7864 struct iwl4965_tx_queue *txq;
7866 struct iwl_queue *q; 7865 struct iwl4965_queue *q;
7867 unsigned long flags; 7866 unsigned long flags;
7868 7867
7869 IWL_DEBUG_MAC80211("enter\n"); 7868 IWL_DEBUG_MAC80211("enter\n");
7870 7869
7871 if (!iwl_is_ready_rf(priv)) { 7870 if (!iwl4965_is_ready_rf(priv)) {
7872 IWL_DEBUG_MAC80211("leave - RF not ready\n"); 7871 IWL_DEBUG_MAC80211("leave - RF not ready\n");
7873 return -EIO; 7872 return -EIO;
7874 } 7873 }
@@ -7878,7 +7877,7 @@ static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw,
7878 for (i = 0; i < AC_NUM; i++) { 7877 for (i = 0; i < AC_NUM; i++) {
7879 txq = &priv->txq[i]; 7878 txq = &priv->txq[i];
7880 q = &txq->q; 7879 q = &txq->q;
7881 avail = iwl_queue_space(q); 7880 avail = iwl4965_queue_space(q);
7882 7881
7883 stats->data[i].len = q->n_window - avail; 7882 stats->data[i].len = q->n_window - avail;
7884 stats->data[i].limit = q->n_window - q->high_mark; 7883 stats->data[i].limit = q->n_window - q->high_mark;
@@ -7892,7 +7891,7 @@ static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw,
7892 return 0; 7891 return 0;
7893} 7892}
7894 7893
7895static int iwl_mac_get_stats(struct ieee80211_hw *hw, 7894static int iwl4965_mac_get_stats(struct ieee80211_hw *hw,
7896 struct ieee80211_low_level_stats *stats) 7895 struct ieee80211_low_level_stats *stats)
7897{ 7896{
7898 IWL_DEBUG_MAC80211("enter\n"); 7897 IWL_DEBUG_MAC80211("enter\n");
@@ -7901,7 +7900,7 @@ static int iwl_mac_get_stats(struct ieee80211_hw *hw,
7901 return 0; 7900 return 0;
7902} 7901}
7903 7902
7904static u64 iwl_mac_get_tsf(struct ieee80211_hw *hw) 7903static u64 iwl4965_mac_get_tsf(struct ieee80211_hw *hw)
7905{ 7904{
7906 IWL_DEBUG_MAC80211("enter\n"); 7905 IWL_DEBUG_MAC80211("enter\n");
7907 IWL_DEBUG_MAC80211("leave\n"); 7906 IWL_DEBUG_MAC80211("leave\n");
@@ -7909,9 +7908,9 @@ static u64 iwl_mac_get_tsf(struct ieee80211_hw *hw)
7909 return 0; 7908 return 0;
7910} 7909}
7911 7910
7912static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) 7911static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw)
7913{ 7912{
7914 struct iwl_priv *priv = hw->priv; 7913 struct iwl4965_priv *priv = hw->priv;
7915 unsigned long flags; 7914 unsigned long flags;
7916 7915
7917 mutex_lock(&priv->mutex); 7916 mutex_lock(&priv->mutex);
@@ -7926,7 +7925,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7926/* if (priv->lq_mngr.agg_ctrl.granted_ba) 7925/* if (priv->lq_mngr.agg_ctrl.granted_ba)
7927 iwl4965_turn_off_agg(priv, TID_ALL_SPECIFIED);*/ 7926 iwl4965_turn_off_agg(priv, TID_ALL_SPECIFIED);*/
7928 7927
7929 memset(&(priv->lq_mngr.agg_ctrl), 0, sizeof(struct iwl_agg_control)); 7928 memset(&(priv->lq_mngr.agg_ctrl), 0, sizeof(struct iwl4965_agg_control));
7930 priv->lq_mngr.agg_ctrl.tid_traffic_load_threshold = 10; 7929 priv->lq_mngr.agg_ctrl.tid_traffic_load_threshold = 10;
7931 priv->lq_mngr.agg_ctrl.ba_timeout = 5000; 7930 priv->lq_mngr.agg_ctrl.ba_timeout = 5000;
7932 priv->lq_mngr.agg_ctrl.auto_agg = 1; 7931 priv->lq_mngr.agg_ctrl.auto_agg = 1;
@@ -7937,7 +7936,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7937#endif /* CONFIG_IWL4965_HT */ 7936#endif /* CONFIG_IWL4965_HT */
7938 7937
7939#ifdef CONFIG_IWL4965_QOS 7938#ifdef CONFIG_IWL4965_QOS
7940 iwl_reset_qos(priv); 7939 iwl4965_reset_qos(priv);
7941#endif 7940#endif
7942 7941
7943 cancel_delayed_work(&priv->post_associate); 7942 cancel_delayed_work(&priv->post_associate);
@@ -7966,9 +7965,9 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7966 * clear RXON_FILTER_ASSOC_MSK bit 7965 * clear RXON_FILTER_ASSOC_MSK bit
7967 */ 7966 */
7968 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { 7967 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) {
7969 iwl_scan_cancel_timeout(priv, 100); 7968 iwl4965_scan_cancel_timeout(priv, 100);
7970 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7969 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7971 iwl_commit_rxon(priv); 7970 iwl4965_commit_rxon(priv);
7972 } 7971 }
7973 7972
7974 /* Per mac80211.h: This is only used in IBSS mode... */ 7973 /* Per mac80211.h: This is only used in IBSS mode... */
@@ -7979,7 +7978,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7979 return; 7978 return;
7980 } 7979 }
7981 7980
7982 if (!iwl_is_ready_rf(priv)) { 7981 if (!iwl4965_is_ready_rf(priv)) {
7983 IWL_DEBUG_MAC80211("leave - not ready\n"); 7982 IWL_DEBUG_MAC80211("leave - not ready\n");
7984 mutex_unlock(&priv->mutex); 7983 mutex_unlock(&priv->mutex);
7985 return; 7984 return;
@@ -7987,7 +7986,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7987 7986
7988 priv->only_active_channel = 0; 7987 priv->only_active_channel = 0;
7989 7988
7990 iwl_set_rate(priv); 7989 iwl4965_set_rate(priv);
7991 7990
7992 mutex_unlock(&priv->mutex); 7991 mutex_unlock(&priv->mutex);
7993 7992
@@ -7995,16 +7994,16 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7995 7994
7996} 7995}
7997 7996
7998static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, 7997static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
7999 struct ieee80211_tx_control *control) 7998 struct ieee80211_tx_control *control)
8000{ 7999{
8001 struct iwl_priv *priv = hw->priv; 8000 struct iwl4965_priv *priv = hw->priv;
8002 unsigned long flags; 8001 unsigned long flags;
8003 8002
8004 mutex_lock(&priv->mutex); 8003 mutex_lock(&priv->mutex);
8005 IWL_DEBUG_MAC80211("enter\n"); 8004 IWL_DEBUG_MAC80211("enter\n");
8006 8005
8007 if (!iwl_is_ready_rf(priv)) { 8006 if (!iwl4965_is_ready_rf(priv)) {
8008 IWL_DEBUG_MAC80211("leave - RF not ready\n"); 8007 IWL_DEBUG_MAC80211("leave - RF not ready\n");
8009 mutex_unlock(&priv->mutex); 8008 mutex_unlock(&priv->mutex);
8010 return -EIO; 8009 return -EIO;
@@ -8029,7 +8028,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
8029 spin_unlock_irqrestore(&priv->lock, flags); 8028 spin_unlock_irqrestore(&priv->lock, flags);
8030 8029
8031#ifdef CONFIG_IWL4965_QOS 8030#ifdef CONFIG_IWL4965_QOS
8032 iwl_reset_qos(priv); 8031 iwl4965_reset_qos(priv);
8033#endif 8032#endif
8034 8033
8035 queue_work(priv->workqueue, &priv->post_associate.work); 8034 queue_work(priv->workqueue, &priv->post_associate.work);
@@ -8156,11 +8155,11 @@ static int sta_ht_info_init(struct ieee80211_ht_capability *ht_cap,
8156 return 0; 8155 return 0;
8157} 8156}
8158 8157
8159static int iwl_mac_conf_ht(struct ieee80211_hw *hw, 8158static int iwl4965_mac_conf_ht(struct ieee80211_hw *hw,
8160 struct ieee80211_ht_capability *ht_cap, 8159 struct ieee80211_ht_capability *ht_cap,
8161 struct ieee80211_ht_additional_info *ht_extra) 8160 struct ieee80211_ht_additional_info *ht_extra)
8162{ 8161{
8163 struct iwl_priv *priv = hw->priv; 8162 struct iwl4965_priv *priv = hw->priv;
8164 int rs; 8163 int rs;
8165 8164
8166 IWL_DEBUG_MAC80211("enter: \n"); 8165 IWL_DEBUG_MAC80211("enter: \n");
@@ -8186,7 +8185,7 @@ static int iwl_mac_conf_ht(struct ieee80211_hw *hw,
8186 8185
8187} 8186}
8188 8187
8189static void iwl_set_ht_capab(struct ieee80211_hw *hw, 8188static void iwl4965_set_ht_capab(struct ieee80211_hw *hw,
8190 struct ieee80211_ht_capability *ht_cap, 8189 struct ieee80211_ht_capability *ht_cap,
8191 u8 use_wide_chan) 8190 u8 use_wide_chan)
8192{ 8191{
@@ -8214,11 +8213,11 @@ static void iwl_set_ht_capab(struct ieee80211_hw *hw,
8214 (cap.supported_chan_width_set) ? 0x1: 0x0; 8213 (cap.supported_chan_width_set) ? 0x1: 0x0;
8215} 8214}
8216 8215
8217static void iwl_mac_get_ht_capab(struct ieee80211_hw *hw, 8216static void iwl4965_mac_get_ht_capab(struct ieee80211_hw *hw,
8218 struct ieee80211_ht_capability *ht_cap) 8217 struct ieee80211_ht_capability *ht_cap)
8219{ 8218{
8220 u8 use_wide_channel = 1; 8219 u8 use_wide_channel = 1;
8221 struct iwl_priv *priv = hw->priv; 8220 struct iwl4965_priv *priv = hw->priv;
8222 8221
8223 IWL_DEBUG_MAC80211("enter: \n"); 8222 IWL_DEBUG_MAC80211("enter: \n");
8224 if (priv->channel_width != IWL_CHANNEL_WIDTH_40MHZ) 8223 if (priv->channel_width != IWL_CHANNEL_WIDTH_40MHZ)
@@ -8228,7 +8227,7 @@ static void iwl_mac_get_ht_capab(struct ieee80211_hw *hw,
8228 if (priv->phymode != MODE_IEEE80211A) 8227 if (priv->phymode != MODE_IEEE80211A)
8229 use_wide_channel = 0; 8228 use_wide_channel = 0;
8230 8229
8231 iwl_set_ht_capab(hw, ht_cap, use_wide_channel); 8230 iwl4965_set_ht_capab(hw, ht_cap, use_wide_channel);
8232 IWL_DEBUG_MAC80211("leave: \n"); 8231 IWL_DEBUG_MAC80211("leave: \n");
8233} 8232}
8234#endif /*CONFIG_IWL4965_HT*/ 8233#endif /*CONFIG_IWL4965_HT*/
@@ -8251,7 +8250,7 @@ static void iwl_mac_get_ht_capab(struct ieee80211_hw *hw,
8251 8250
8252static ssize_t show_debug_level(struct device_driver *d, char *buf) 8251static ssize_t show_debug_level(struct device_driver *d, char *buf)
8253{ 8252{
8254 return sprintf(buf, "0x%08X\n", iwl_debug_level); 8253 return sprintf(buf, "0x%08X\n", iwl4965_debug_level);
8255} 8254}
8256static ssize_t store_debug_level(struct device_driver *d, 8255static ssize_t store_debug_level(struct device_driver *d,
8257 const char *buf, size_t count) 8256 const char *buf, size_t count)
@@ -8264,7 +8263,7 @@ static ssize_t store_debug_level(struct device_driver *d,
8264 printk(KERN_INFO DRV_NAME 8263 printk(KERN_INFO DRV_NAME
8265 ": %s is not in hex or decimal form.\n", buf); 8264 ": %s is not in hex or decimal form.\n", buf);
8266 else 8265 else
8267 iwl_debug_level = val; 8266 iwl4965_debug_level = val;
8268 8267
8269 return strnlen(buf, count); 8268 return strnlen(buf, count);
8270} 8269}
@@ -8283,7 +8282,7 @@ static ssize_t show_rf_kill(struct device *d,
8283 * 2 - HW based RF kill active 8282 * 2 - HW based RF kill active
8284 * 3 - Both HW and SW based RF kill active 8283 * 3 - Both HW and SW based RF kill active
8285 */ 8284 */
8286 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 8285 struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data;
8287 int val = (test_bit(STATUS_RF_KILL_SW, &priv->status) ? 0x1 : 0x0) | 8286 int val = (test_bit(STATUS_RF_KILL_SW, &priv->status) ? 0x1 : 0x0) |
8288 (test_bit(STATUS_RF_KILL_HW, &priv->status) ? 0x2 : 0x0); 8287 (test_bit(STATUS_RF_KILL_HW, &priv->status) ? 0x2 : 0x0);
8289 8288
@@ -8294,10 +8293,10 @@ static ssize_t store_rf_kill(struct device *d,
8294 struct device_attribute *attr, 8293 struct device_attribute *attr,
8295 const char *buf, size_t count) 8294 const char *buf, size_t count)
8296{ 8295{
8297 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 8296 struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data;
8298 8297
8299 mutex_lock(&priv->mutex); 8298 mutex_lock(&priv->mutex);
8300 iwl_radio_kill_sw(priv, buf[0] == '1'); 8299 iwl4965_radio_kill_sw(priv, buf[0] == '1');
8301 mutex_unlock(&priv->mutex); 8300 mutex_unlock(&priv->mutex);
8302 8301
8303 return count; 8302 return count;
@@ -8308,12 +8307,12 @@ static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill);
8308static ssize_t show_temperature(struct device *d, 8307static ssize_t show_temperature(struct device *d,
8309 struct device_attribute *attr, char *buf) 8308 struct device_attribute *attr, char *buf)
8310{ 8309{
8311 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 8310 struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data;
8312 8311
8313 if (!iwl_is_alive(priv)) 8312 if (!iwl4965_is_alive(priv))
8314 return -EAGAIN; 8313 return -EAGAIN;
8315 8314
8316 return sprintf(buf, "%d\n", iwl_hw_get_temperature(priv)); 8315 return sprintf(buf, "%d\n", iwl4965_hw_get_temperature(priv));
8317} 8316}
8318 8317
8319static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL); 8318static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);
@@ -8322,15 +8321,15 @@ static ssize_t show_rs_window(struct device *d,
8322 struct device_attribute *attr, 8321 struct device_attribute *attr,
8323 char *buf) 8322 char *buf)
8324{ 8323{
8325 struct iwl_priv *priv = d->driver_data; 8324 struct iwl4965_priv *priv = d->driver_data;
8326 return iwl_fill_rs_info(priv->hw, buf, IWL_AP_ID); 8325 return iwl4965_fill_rs_info(priv->hw, buf, IWL_AP_ID);
8327} 8326}
8328static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL); 8327static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL);
8329 8328
8330static ssize_t show_tx_power(struct device *d, 8329static ssize_t show_tx_power(struct device *d,
8331 struct device_attribute *attr, char *buf) 8330 struct device_attribute *attr, char *buf)
8332{ 8331{
8333 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 8332 struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data;
8334 return sprintf(buf, "%d\n", priv->user_txpower_limit); 8333 return sprintf(buf, "%d\n", priv->user_txpower_limit);
8335} 8334}
8336 8335
@@ -8338,7 +8337,7 @@ static ssize_t store_tx_power(struct device *d,
8338 struct device_attribute *attr, 8337 struct device_attribute *attr,
8339 const char *buf, size_t count) 8338 const char *buf, size_t count)
8340{ 8339{
8341 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 8340 struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data;
8342 char *p = (char *)buf; 8341 char *p = (char *)buf;
8343 u32 val; 8342 u32 val;
8344 8343
@@ -8347,7 +8346,7 @@ static ssize_t store_tx_power(struct device *d,
8347 printk(KERN_INFO DRV_NAME 8346 printk(KERN_INFO DRV_NAME
8348 ": %s is not in decimal form.\n", buf); 8347 ": %s is not in decimal form.\n", buf);
8349 else 8348 else
8350 iwl_hw_reg_set_txpower(priv, val); 8349 iwl4965_hw_reg_set_txpower(priv, val);
8351 8350
8352 return count; 8351 return count;
8353} 8352}
@@ -8357,7 +8356,7 @@ static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power);
8357static ssize_t show_flags(struct device *d, 8356static ssize_t show_flags(struct device *d,
8358 struct device_attribute *attr, char *buf) 8357 struct device_attribute *attr, char *buf)
8359{ 8358{
8360 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 8359 struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data;
8361 8360
8362 return sprintf(buf, "0x%04X\n", priv->active_rxon.flags); 8361 return sprintf(buf, "0x%04X\n", priv->active_rxon.flags);
8363} 8362}
@@ -8366,19 +8365,19 @@ static ssize_t store_flags(struct device *d,
8366 struct device_attribute *attr, 8365 struct device_attribute *attr,
8367 const char *buf, size_t count) 8366 const char *buf, size_t count)
8368{ 8367{
8369 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 8368 struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data;
8370 u32 flags = simple_strtoul(buf, NULL, 0); 8369 u32 flags = simple_strtoul(buf, NULL, 0);
8371 8370
8372 mutex_lock(&priv->mutex); 8371 mutex_lock(&priv->mutex);
8373 if (le32_to_cpu(priv->staging_rxon.flags) != flags) { 8372 if (le32_to_cpu(priv->staging_rxon.flags) != flags) {
8374 /* Cancel any currently running scans... */ 8373 /* Cancel any currently running scans... */
8375 if (iwl_scan_cancel_timeout(priv, 100)) 8374 if (iwl4965_scan_cancel_timeout(priv, 100))
8376 IWL_WARNING("Could not cancel scan.\n"); 8375 IWL_WARNING("Could not cancel scan.\n");
8377 else { 8376 else {
8378 IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n", 8377 IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n",
8379 flags); 8378 flags);
8380 priv->staging_rxon.flags = cpu_to_le32(flags); 8379 priv->staging_rxon.flags = cpu_to_le32(flags);
8381 iwl_commit_rxon(priv); 8380 iwl4965_commit_rxon(priv);
8382 } 8381 }
8383 } 8382 }
8384 mutex_unlock(&priv->mutex); 8383 mutex_unlock(&priv->mutex);
@@ -8391,7 +8390,7 @@ static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, show_flags, store_flags);
8391static ssize_t show_filter_flags(struct device *d, 8390static ssize_t show_filter_flags(struct device *d,
8392 struct device_attribute *attr, char *buf) 8391 struct device_attribute *attr, char *buf)
8393{ 8392{
8394 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 8393 struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data;
8395 8394
8396 return sprintf(buf, "0x%04X\n", 8395 return sprintf(buf, "0x%04X\n",
8397 le32_to_cpu(priv->active_rxon.filter_flags)); 8396 le32_to_cpu(priv->active_rxon.filter_flags));
@@ -8401,20 +8400,20 @@ static ssize_t store_filter_flags(struct device *d,
8401 struct device_attribute *attr, 8400 struct device_attribute *attr,
8402 const char *buf, size_t count) 8401 const char *buf, size_t count)
8403{ 8402{
8404 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 8403 struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data;
8405 u32 filter_flags = simple_strtoul(buf, NULL, 0); 8404 u32 filter_flags = simple_strtoul(buf, NULL, 0);
8406 8405
8407 mutex_lock(&priv->mutex); 8406 mutex_lock(&priv->mutex);
8408 if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) { 8407 if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) {
8409 /* Cancel any currently running scans... */ 8408 /* Cancel any currently running scans... */
8410 if (iwl_scan_cancel_timeout(priv, 100)) 8409 if (iwl4965_scan_cancel_timeout(priv, 100))
8411 IWL_WARNING("Could not cancel scan.\n"); 8410 IWL_WARNING("Could not cancel scan.\n");
8412 else { 8411 else {
8413 IWL_DEBUG_INFO("Committing rxon.filter_flags = " 8412 IWL_DEBUG_INFO("Committing rxon.filter_flags = "
8414 "0x%04X\n", filter_flags); 8413 "0x%04X\n", filter_flags);
8415 priv->staging_rxon.filter_flags = 8414 priv->staging_rxon.filter_flags =
8416 cpu_to_le32(filter_flags); 8415 cpu_to_le32(filter_flags);
8417 iwl_commit_rxon(priv); 8416 iwl4965_commit_rxon(priv);
8418 } 8417 }
8419 } 8418 }
8420 mutex_unlock(&priv->mutex); 8419 mutex_unlock(&priv->mutex);
@@ -8428,20 +8427,20 @@ static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags,
8428static ssize_t show_tune(struct device *d, 8427static ssize_t show_tune(struct device *d,
8429 struct device_attribute *attr, char *buf) 8428 struct device_attribute *attr, char *buf)
8430{ 8429{
8431 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 8430 struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data;
8432 8431
8433 return sprintf(buf, "0x%04X\n", 8432 return sprintf(buf, "0x%04X\n",
8434 (priv->phymode << 8) | 8433 (priv->phymode << 8) |
8435 le16_to_cpu(priv->active_rxon.channel)); 8434 le16_to_cpu(priv->active_rxon.channel));
8436} 8435}
8437 8436
8438static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode); 8437static void iwl4965_set_flags_for_phymode(struct iwl4965_priv *priv, u8 phymode);
8439 8438
8440static ssize_t store_tune(struct device *d, 8439static ssize_t store_tune(struct device *d,
8441 struct device_attribute *attr, 8440 struct device_attribute *attr,
8442 const char *buf, size_t count) 8441 const char *buf, size_t count)
8443{ 8442{
8444 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 8443 struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data;
8445 char *p = (char *)buf; 8444 char *p = (char *)buf;
8446 u16 tune = simple_strtoul(p, &p, 0); 8445 u16 tune = simple_strtoul(p, &p, 0);
8447 u8 phymode = (tune >> 8) & 0xff; 8446 u8 phymode = (tune >> 8) & 0xff;
@@ -8452,9 +8451,9 @@ static ssize_t store_tune(struct device *d,
8452 mutex_lock(&priv->mutex); 8451 mutex_lock(&priv->mutex);
8453 if ((le16_to_cpu(priv->staging_rxon.channel) != channel) || 8452 if ((le16_to_cpu(priv->staging_rxon.channel) != channel) ||
8454 (priv->phymode != phymode)) { 8453 (priv->phymode != phymode)) {
8455 const struct iwl_channel_info *ch_info; 8454 const struct iwl4965_channel_info *ch_info;
8456 8455
8457 ch_info = iwl_get_channel_info(priv, phymode, channel); 8456 ch_info = iwl4965_get_channel_info(priv, phymode, channel);
8458 if (!ch_info) { 8457 if (!ch_info) {
8459 IWL_WARNING("Requested invalid phymode/channel " 8458 IWL_WARNING("Requested invalid phymode/channel "
8460 "combination: %d %d\n", phymode, channel); 8459 "combination: %d %d\n", phymode, channel);
@@ -8463,18 +8462,18 @@ static ssize_t store_tune(struct device *d,
8463 } 8462 }
8464 8463
8465 /* Cancel any currently running scans... */ 8464 /* Cancel any currently running scans... */
8466 if (iwl_scan_cancel_timeout(priv, 100)) 8465 if (iwl4965_scan_cancel_timeout(priv, 100))
8467 IWL_WARNING("Could not cancel scan.\n"); 8466 IWL_WARNING("Could not cancel scan.\n");
8468 else { 8467 else {
8469 IWL_DEBUG_INFO("Committing phymode and " 8468 IWL_DEBUG_INFO("Committing phymode and "
8470 "rxon.channel = %d %d\n", 8469 "rxon.channel = %d %d\n",
8471 phymode, channel); 8470 phymode, channel);
8472 8471
8473 iwl_set_rxon_channel(priv, phymode, channel); 8472 iwl4965_set_rxon_channel(priv, phymode, channel);
8474 iwl_set_flags_for_phymode(priv, phymode); 8473 iwl4965_set_flags_for_phymode(priv, phymode);
8475 8474
8476 iwl_set_rate(priv); 8475 iwl4965_set_rate(priv);
8477 iwl_commit_rxon(priv); 8476 iwl4965_commit_rxon(priv);
8478 } 8477 }
8479 } 8478 }
8480 mutex_unlock(&priv->mutex); 8479 mutex_unlock(&priv->mutex);
@@ -8489,8 +8488,8 @@ static DEVICE_ATTR(tune, S_IWUSR | S_IRUGO, show_tune, store_tune);
8489static ssize_t show_measurement(struct device *d, 8488static ssize_t show_measurement(struct device *d,
8490 struct device_attribute *attr, char *buf) 8489 struct device_attribute *attr, char *buf)
8491{ 8490{
8492 struct iwl_priv *priv = dev_get_drvdata(d); 8491 struct iwl4965_priv *priv = dev_get_drvdata(d);
8493 struct iwl_spectrum_notification measure_report; 8492 struct iwl4965_spectrum_notification measure_report;
8494 u32 size = sizeof(measure_report), len = 0, ofs = 0; 8493 u32 size = sizeof(measure_report), len = 0, ofs = 0;
8495 u8 *data = (u8 *) & measure_report; 8494 u8 *data = (u8 *) & measure_report;
8496 unsigned long flags; 8495 unsigned long flags;
@@ -8522,7 +8521,7 @@ static ssize_t store_measurement(struct device *d,
8522 struct device_attribute *attr, 8521 struct device_attribute *attr,
8523 const char *buf, size_t count) 8522 const char *buf, size_t count)
8524{ 8523{
8525 struct iwl_priv *priv = dev_get_drvdata(d); 8524 struct iwl4965_priv *priv = dev_get_drvdata(d);
8526 struct ieee80211_measurement_params params = { 8525 struct ieee80211_measurement_params params = {
8527 .channel = le16_to_cpu(priv->active_rxon.channel), 8526 .channel = le16_to_cpu(priv->active_rxon.channel),
8528 .start_time = cpu_to_le64(priv->last_tsf), 8527 .start_time = cpu_to_le64(priv->last_tsf),
@@ -8548,7 +8547,7 @@ static ssize_t store_measurement(struct device *d,
8548 8547
8549 IWL_DEBUG_INFO("Invoking measurement of type %d on " 8548 IWL_DEBUG_INFO("Invoking measurement of type %d on "
8550 "channel %d (for '%s')\n", type, params.channel, buf); 8549 "channel %d (for '%s')\n", type, params.channel, buf);
8551 iwl_get_measurement(priv, &params, type); 8550 iwl4965_get_measurement(priv, &params, type);
8552 8551
8553 return count; 8552 return count;
8554} 8553}
@@ -8561,7 +8560,7 @@ static ssize_t store_retry_rate(struct device *d,
8561 struct device_attribute *attr, 8560 struct device_attribute *attr,
8562 const char *buf, size_t count) 8561 const char *buf, size_t count)
8563{ 8562{
8564 struct iwl_priv *priv = dev_get_drvdata(d); 8563 struct iwl4965_priv *priv = dev_get_drvdata(d);
8565 8564
8566 priv->retry_rate = simple_strtoul(buf, NULL, 0); 8565 priv->retry_rate = simple_strtoul(buf, NULL, 0);
8567 if (priv->retry_rate <= 0) 8566 if (priv->retry_rate <= 0)
@@ -8573,7 +8572,7 @@ static ssize_t store_retry_rate(struct device *d,
8573static ssize_t show_retry_rate(struct device *d, 8572static ssize_t show_retry_rate(struct device *d,
8574 struct device_attribute *attr, char *buf) 8573 struct device_attribute *attr, char *buf)
8575{ 8574{
8576 struct iwl_priv *priv = dev_get_drvdata(d); 8575 struct iwl4965_priv *priv = dev_get_drvdata(d);
8577 return sprintf(buf, "%d", priv->retry_rate); 8576 return sprintf(buf, "%d", priv->retry_rate);
8578} 8577}
8579 8578
@@ -8584,14 +8583,14 @@ static ssize_t store_power_level(struct device *d,
8584 struct device_attribute *attr, 8583 struct device_attribute *attr,
8585 const char *buf, size_t count) 8584 const char *buf, size_t count)
8586{ 8585{
8587 struct iwl_priv *priv = dev_get_drvdata(d); 8586 struct iwl4965_priv *priv = dev_get_drvdata(d);
8588 int rc; 8587 int rc;
8589 int mode; 8588 int mode;
8590 8589
8591 mode = simple_strtoul(buf, NULL, 0); 8590 mode = simple_strtoul(buf, NULL, 0);
8592 mutex_lock(&priv->mutex); 8591 mutex_lock(&priv->mutex);
8593 8592
8594 if (!iwl_is_ready(priv)) { 8593 if (!iwl4965_is_ready(priv)) {
8595 rc = -EAGAIN; 8594 rc = -EAGAIN;
8596 goto out; 8595 goto out;
8597 } 8596 }
@@ -8602,7 +8601,7 @@ static ssize_t store_power_level(struct device *d,
8602 mode |= IWL_POWER_ENABLED; 8601 mode |= IWL_POWER_ENABLED;
8603 8602
8604 if (mode != priv->power_mode) { 8603 if (mode != priv->power_mode) {
8605 rc = iwl_send_power_mode(priv, IWL_POWER_LEVEL(mode)); 8604 rc = iwl4965_send_power_mode(priv, IWL_POWER_LEVEL(mode));
8606 if (rc) { 8605 if (rc) {
8607 IWL_DEBUG_MAC80211("failed setting power mode.\n"); 8606 IWL_DEBUG_MAC80211("failed setting power mode.\n");
8608 goto out; 8607 goto out;
@@ -8638,7 +8637,7 @@ static const s32 period_duration[] = {
8638static ssize_t show_power_level(struct device *d, 8637static ssize_t show_power_level(struct device *d,
8639 struct device_attribute *attr, char *buf) 8638 struct device_attribute *attr, char *buf)
8640{ 8639{
8641 struct iwl_priv *priv = dev_get_drvdata(d); 8640 struct iwl4965_priv *priv = dev_get_drvdata(d);
8642 int level = IWL_POWER_LEVEL(priv->power_mode); 8641 int level = IWL_POWER_LEVEL(priv->power_mode);
8643 char *p = buf; 8642 char *p = buf;
8644 8643
@@ -8673,18 +8672,18 @@ static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level,
8673static ssize_t show_channels(struct device *d, 8672static ssize_t show_channels(struct device *d,
8674 struct device_attribute *attr, char *buf) 8673 struct device_attribute *attr, char *buf)
8675{ 8674{
8676 struct iwl_priv *priv = dev_get_drvdata(d); 8675 struct iwl4965_priv *priv = dev_get_drvdata(d);
8677 int len = 0, i; 8676 int len = 0, i;
8678 struct ieee80211_channel *channels = NULL; 8677 struct ieee80211_channel *channels = NULL;
8679 const struct ieee80211_hw_mode *hw_mode = NULL; 8678 const struct ieee80211_hw_mode *hw_mode = NULL;
8680 int count = 0; 8679 int count = 0;
8681 8680
8682 if (!iwl_is_ready(priv)) 8681 if (!iwl4965_is_ready(priv))
8683 return -EAGAIN; 8682 return -EAGAIN;
8684 8683
8685 hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211G); 8684 hw_mode = iwl4965_get_hw_mode(priv, MODE_IEEE80211G);
8686 if (!hw_mode) 8685 if (!hw_mode)
8687 hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211B); 8686 hw_mode = iwl4965_get_hw_mode(priv, MODE_IEEE80211B);
8688 if (hw_mode) { 8687 if (hw_mode) {
8689 channels = hw_mode->channels; 8688 channels = hw_mode->channels;
8690 count = hw_mode->num_channels; 8689 count = hw_mode->num_channels;
@@ -8711,7 +8710,7 @@ static ssize_t show_channels(struct device *d,
8711 flag & IEEE80211_CHAN_W_ACTIVE_SCAN ? 8710 flag & IEEE80211_CHAN_W_ACTIVE_SCAN ?
8712 "active/passive" : "passive only"); 8711 "active/passive" : "passive only");
8713 8712
8714 hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211A); 8713 hw_mode = iwl4965_get_hw_mode(priv, MODE_IEEE80211A);
8715 if (hw_mode) { 8714 if (hw_mode) {
8716 channels = hw_mode->channels; 8715 channels = hw_mode->channels;
8717 count = hw_mode->num_channels; 8716 count = hw_mode->num_channels;
@@ -8747,17 +8746,17 @@ static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL);
8747static ssize_t show_statistics(struct device *d, 8746static ssize_t show_statistics(struct device *d,
8748 struct device_attribute *attr, char *buf) 8747 struct device_attribute *attr, char *buf)
8749{ 8748{
8750 struct iwl_priv *priv = dev_get_drvdata(d); 8749 struct iwl4965_priv *priv = dev_get_drvdata(d);
8751 u32 size = sizeof(struct iwl_notif_statistics); 8750 u32 size = sizeof(struct iwl4965_notif_statistics);
8752 u32 len = 0, ofs = 0; 8751 u32 len = 0, ofs = 0;
8753 u8 *data = (u8 *) & priv->statistics; 8752 u8 *data = (u8 *) & priv->statistics;
8754 int rc = 0; 8753 int rc = 0;
8755 8754
8756 if (!iwl_is_alive(priv)) 8755 if (!iwl4965_is_alive(priv))
8757 return -EAGAIN; 8756 return -EAGAIN;
8758 8757
8759 mutex_lock(&priv->mutex); 8758 mutex_lock(&priv->mutex);
8760 rc = iwl_send_statistics_request(priv); 8759 rc = iwl4965_send_statistics_request(priv);
8761 mutex_unlock(&priv->mutex); 8760 mutex_unlock(&priv->mutex);
8762 8761
8763 if (rc) { 8762 if (rc) {
@@ -8785,9 +8784,9 @@ static DEVICE_ATTR(statistics, S_IRUGO, show_statistics, NULL);
8785static ssize_t show_antenna(struct device *d, 8784static ssize_t show_antenna(struct device *d,
8786 struct device_attribute *attr, char *buf) 8785 struct device_attribute *attr, char *buf)
8787{ 8786{
8788 struct iwl_priv *priv = dev_get_drvdata(d); 8787 struct iwl4965_priv *priv = dev_get_drvdata(d);
8789 8788
8790 if (!iwl_is_alive(priv)) 8789 if (!iwl4965_is_alive(priv))
8791 return -EAGAIN; 8790 return -EAGAIN;
8792 8791
8793 return sprintf(buf, "%d\n", priv->antenna); 8792 return sprintf(buf, "%d\n", priv->antenna);
@@ -8798,7 +8797,7 @@ static ssize_t store_antenna(struct device *d,
8798 const char *buf, size_t count) 8797 const char *buf, size_t count)
8799{ 8798{
8800 int ant; 8799 int ant;
8801 struct iwl_priv *priv = dev_get_drvdata(d); 8800 struct iwl4965_priv *priv = dev_get_drvdata(d);
8802 8801
8803 if (count == 0) 8802 if (count == 0)
8804 return 0; 8803 return 0;
@@ -8810,7 +8809,7 @@ static ssize_t store_antenna(struct device *d,
8810 8809
8811 if ((ant >= 0) && (ant <= 2)) { 8810 if ((ant >= 0) && (ant <= 2)) {
8812 IWL_DEBUG_INFO("Setting antenna select to %d.\n", ant); 8811 IWL_DEBUG_INFO("Setting antenna select to %d.\n", ant);
8813 priv->antenna = (enum iwl_antenna)ant; 8812 priv->antenna = (enum iwl4965_antenna)ant;
8814 } else 8813 } else
8815 IWL_DEBUG_INFO("Bad antenna select value %d.\n", ant); 8814 IWL_DEBUG_INFO("Bad antenna select value %d.\n", ant);
8816 8815
@@ -8823,8 +8822,8 @@ static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, show_antenna, store_antenna);
8823static ssize_t show_status(struct device *d, 8822static ssize_t show_status(struct device *d,
8824 struct device_attribute *attr, char *buf) 8823 struct device_attribute *attr, char *buf)
8825{ 8824{
8826 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 8825 struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data;
8827 if (!iwl_is_alive(priv)) 8826 if (!iwl4965_is_alive(priv))
8828 return -EAGAIN; 8827 return -EAGAIN;
8829 return sprintf(buf, "0x%08x\n", (int)priv->status); 8828 return sprintf(buf, "0x%08x\n", (int)priv->status);
8830} 8829}
@@ -8838,7 +8837,7 @@ static ssize_t dump_error_log(struct device *d,
8838 char *p = (char *)buf; 8837 char *p = (char *)buf;
8839 8838
8840 if (p[0] == '1') 8839 if (p[0] == '1')
8841 iwl_dump_nic_error_log((struct iwl_priv *)d->driver_data); 8840 iwl4965_dump_nic_error_log((struct iwl4965_priv *)d->driver_data);
8842 8841
8843 return strnlen(buf, count); 8842 return strnlen(buf, count);
8844} 8843}
@@ -8852,7 +8851,7 @@ static ssize_t dump_event_log(struct device *d,
8852 char *p = (char *)buf; 8851 char *p = (char *)buf;
8853 8852
8854 if (p[0] == '1') 8853 if (p[0] == '1')
8855 iwl_dump_nic_event_log((struct iwl_priv *)d->driver_data); 8854 iwl4965_dump_nic_event_log((struct iwl4965_priv *)d->driver_data);
8856 8855
8857 return strnlen(buf, count); 8856 return strnlen(buf, count);
8858} 8857}
@@ -8865,34 +8864,34 @@ static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log);
8865 * 8864 *
8866 *****************************************************************************/ 8865 *****************************************************************************/
8867 8866
8868static void iwl_setup_deferred_work(struct iwl_priv *priv) 8867static void iwl4965_setup_deferred_work(struct iwl4965_priv *priv)
8869{ 8868{
8870 priv->workqueue = create_workqueue(DRV_NAME); 8869 priv->workqueue = create_workqueue(DRV_NAME);
8871 8870
8872 init_waitqueue_head(&priv->wait_command_queue); 8871 init_waitqueue_head(&priv->wait_command_queue);
8873 8872
8874 INIT_WORK(&priv->up, iwl_bg_up); 8873 INIT_WORK(&priv->up, iwl4965_bg_up);
8875 INIT_WORK(&priv->restart, iwl_bg_restart); 8874 INIT_WORK(&priv->restart, iwl4965_bg_restart);
8876 INIT_WORK(&priv->rx_replenish, iwl_bg_rx_replenish); 8875 INIT_WORK(&priv->rx_replenish, iwl4965_bg_rx_replenish);
8877 INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); 8876 INIT_WORK(&priv->scan_completed, iwl4965_bg_scan_completed);
8878 INIT_WORK(&priv->request_scan, iwl_bg_request_scan); 8877 INIT_WORK(&priv->request_scan, iwl4965_bg_request_scan);
8879 INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); 8878 INIT_WORK(&priv->abort_scan, iwl4965_bg_abort_scan);
8880 INIT_WORK(&priv->rf_kill, iwl_bg_rf_kill); 8879 INIT_WORK(&priv->rf_kill, iwl4965_bg_rf_kill);
8881 INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update); 8880 INIT_WORK(&priv->beacon_update, iwl4965_bg_beacon_update);
8882 INIT_DELAYED_WORK(&priv->post_associate, iwl_bg_post_associate); 8881 INIT_DELAYED_WORK(&priv->post_associate, iwl4965_bg_post_associate);
8883 INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); 8882 INIT_DELAYED_WORK(&priv->init_alive_start, iwl4965_bg_init_alive_start);
8884 INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); 8883 INIT_DELAYED_WORK(&priv->alive_start, iwl4965_bg_alive_start);
8885 INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); 8884 INIT_DELAYED_WORK(&priv->scan_check, iwl4965_bg_scan_check);
8886 8885
8887 iwl_hw_setup_deferred_work(priv); 8886 iwl4965_hw_setup_deferred_work(priv);
8888 8887
8889 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) 8888 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))
8890 iwl_irq_tasklet, (unsigned long)priv); 8889 iwl4965_irq_tasklet, (unsigned long)priv);
8891} 8890}
8892 8891
8893static void iwl_cancel_deferred_work(struct iwl_priv *priv) 8892static void iwl4965_cancel_deferred_work(struct iwl4965_priv *priv)
8894{ 8893{
8895 iwl_hw_cancel_deferred_work(priv); 8894 iwl4965_hw_cancel_deferred_work(priv);
8896 8895
8897 cancel_delayed_work_sync(&priv->init_alive_start); 8896 cancel_delayed_work_sync(&priv->init_alive_start);
8898 cancel_delayed_work(&priv->scan_check); 8897 cancel_delayed_work(&priv->scan_check);
@@ -8901,7 +8900,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
8901 cancel_work_sync(&priv->beacon_update); 8900 cancel_work_sync(&priv->beacon_update);
8902} 8901}
8903 8902
8904static struct attribute *iwl_sysfs_entries[] = { 8903static struct attribute *iwl4965_sysfs_entries[] = {
8905 &dev_attr_antenna.attr, 8904 &dev_attr_antenna.attr,
8906 &dev_attr_channels.attr, 8905 &dev_attr_channels.attr,
8907 &dev_attr_dump_errors.attr, 8906 &dev_attr_dump_errors.attr,
@@ -8924,55 +8923,55 @@ static struct attribute *iwl_sysfs_entries[] = {
8924 NULL 8923 NULL
8925}; 8924};
8926 8925
8927static struct attribute_group iwl_attribute_group = { 8926static struct attribute_group iwl4965_attribute_group = {
8928 .name = NULL, /* put in device directory */ 8927 .name = NULL, /* put in device directory */
8929 .attrs = iwl_sysfs_entries, 8928 .attrs = iwl4965_sysfs_entries,
8930}; 8929};
8931 8930
8932static struct ieee80211_ops iwl_hw_ops = { 8931static struct ieee80211_ops iwl4965_hw_ops = {
8933 .tx = iwl_mac_tx, 8932 .tx = iwl4965_mac_tx,
8934 .start = iwl_mac_start, 8933 .start = iwl4965_mac_start,
8935 .stop = iwl_mac_stop, 8934 .stop = iwl4965_mac_stop,
8936 .add_interface = iwl_mac_add_interface, 8935 .add_interface = iwl4965_mac_add_interface,
8937 .remove_interface = iwl_mac_remove_interface, 8936 .remove_interface = iwl4965_mac_remove_interface,
8938 .config = iwl_mac_config, 8937 .config = iwl4965_mac_config,
8939 .config_interface = iwl_mac_config_interface, 8938 .config_interface = iwl4965_mac_config_interface,
8940 .configure_filter = iwl_configure_filter, 8939 .configure_filter = iwl4965_configure_filter,
8941 .set_key = iwl_mac_set_key, 8940 .set_key = iwl4965_mac_set_key,
8942 .get_stats = iwl_mac_get_stats, 8941 .get_stats = iwl4965_mac_get_stats,
8943 .get_tx_stats = iwl_mac_get_tx_stats, 8942 .get_tx_stats = iwl4965_mac_get_tx_stats,
8944 .conf_tx = iwl_mac_conf_tx, 8943 .conf_tx = iwl4965_mac_conf_tx,
8945 .get_tsf = iwl_mac_get_tsf, 8944 .get_tsf = iwl4965_mac_get_tsf,
8946 .reset_tsf = iwl_mac_reset_tsf, 8945 .reset_tsf = iwl4965_mac_reset_tsf,
8947 .beacon_update = iwl_mac_beacon_update, 8946 .beacon_update = iwl4965_mac_beacon_update,
8948 .erp_ie_changed = iwl_mac_erp_ie_changed, 8947 .erp_ie_changed = iwl4965_mac_erp_ie_changed,
8949#ifdef CONFIG_IWL4965_HT 8948#ifdef CONFIG_IWL4965_HT
8950 .conf_ht = iwl_mac_conf_ht, 8949 .conf_ht = iwl4965_mac_conf_ht,
8951 .get_ht_capab = iwl_mac_get_ht_capab, 8950 .get_ht_capab = iwl4965_mac_get_ht_capab,
8952#ifdef CONFIG_IWL4965_HT_AGG 8951#ifdef CONFIG_IWL4965_HT_AGG
8953 .ht_tx_agg_start = iwl_mac_ht_tx_agg_start, 8952 .ht_tx_agg_start = iwl4965_mac_ht_tx_agg_start,
8954 .ht_tx_agg_stop = iwl_mac_ht_tx_agg_stop, 8953 .ht_tx_agg_stop = iwl4965_mac_ht_tx_agg_stop,
8955 .ht_rx_agg_start = iwl_mac_ht_rx_agg_start, 8954 .ht_rx_agg_start = iwl4965_mac_ht_rx_agg_start,
8956 .ht_rx_agg_stop = iwl_mac_ht_rx_agg_stop, 8955 .ht_rx_agg_stop = iwl4965_mac_ht_rx_agg_stop,
8957#endif /* CONFIG_IWL4965_HT_AGG */ 8956#endif /* CONFIG_IWL4965_HT_AGG */
8958#endif /* CONFIG_IWL4965_HT */ 8957#endif /* CONFIG_IWL4965_HT */
8959 .hw_scan = iwl_mac_hw_scan 8958 .hw_scan = iwl4965_mac_hw_scan
8960}; 8959};
8961 8960
8962static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 8961static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8963{ 8962{
8964 int err = 0; 8963 int err = 0;
8965 struct iwl_priv *priv; 8964 struct iwl4965_priv *priv;
8966 struct ieee80211_hw *hw; 8965 struct ieee80211_hw *hw;
8967 int i; 8966 int i;
8968 8967
8969 if (iwl_param_disable_hw_scan) { 8968 if (iwl4965_param_disable_hw_scan) {
8970 IWL_DEBUG_INFO("Disabling hw_scan\n"); 8969 IWL_DEBUG_INFO("Disabling hw_scan\n");
8971 iwl_hw_ops.hw_scan = NULL; 8970 iwl4965_hw_ops.hw_scan = NULL;
8972 } 8971 }
8973 8972
8974 if ((iwl_param_queues_num > IWL_MAX_NUM_QUEUES) || 8973 if ((iwl4965_param_queues_num > IWL_MAX_NUM_QUEUES) ||
8975 (iwl_param_queues_num < IWL_MIN_NUM_QUEUES)) { 8974 (iwl4965_param_queues_num < IWL_MIN_NUM_QUEUES)) {
8976 IWL_ERROR("invalid queues_num, should be between %d and %d\n", 8975 IWL_ERROR("invalid queues_num, should be between %d and %d\n",
8977 IWL_MIN_NUM_QUEUES, IWL_MAX_NUM_QUEUES); 8976 IWL_MIN_NUM_QUEUES, IWL_MAX_NUM_QUEUES);
8978 err = -EINVAL; 8977 err = -EINVAL;
@@ -8981,7 +8980,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8981 8980
8982 /* mac80211 allocates memory for this device instance, including 8981 /* mac80211 allocates memory for this device instance, including
8983 * space for this driver's private structure */ 8982 * space for this driver's private structure */
8984 hw = ieee80211_alloc_hw(sizeof(struct iwl_priv), &iwl_hw_ops); 8983 hw = ieee80211_alloc_hw(sizeof(struct iwl4965_priv), &iwl4965_hw_ops);
8985 if (hw == NULL) { 8984 if (hw == NULL) {
8986 IWL_ERROR("Can not allocate network device\n"); 8985 IWL_ERROR("Can not allocate network device\n");
8987 err = -ENOMEM; 8986 err = -ENOMEM;
@@ -8996,9 +8995,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8996 priv->hw = hw; 8995 priv->hw = hw;
8997 8996
8998 priv->pci_dev = pdev; 8997 priv->pci_dev = pdev;
8999 priv->antenna = (enum iwl_antenna)iwl_param_antenna; 8998 priv->antenna = (enum iwl4965_antenna)iwl4965_param_antenna;
9000#ifdef CONFIG_IWL4965_DEBUG 8999#ifdef CONFIG_IWL4965_DEBUG
9001 iwl_debug_level = iwl_param_debug; 9000 iwl4965_debug_level = iwl4965_param_debug;
9002 atomic_set(&priv->restrict_refcnt, 0); 9001 atomic_set(&priv->restrict_refcnt, 0);
9003#endif 9002#endif
9004 priv->retry_rate = 1; 9003 priv->retry_rate = 1;
@@ -9043,7 +9042,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
9043 9042
9044 pci_set_master(pdev); 9043 pci_set_master(pdev);
9045 9044
9046 iwl_clear_stations_table(priv); 9045 iwl4965_clear_stations_table(priv);
9047 9046
9048 priv->data_retry_limit = -1; 9047 priv->data_retry_limit = -1;
9049 priv->ieee_channels = NULL; 9048 priv->ieee_channels = NULL;
@@ -9077,7 +9076,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
9077 9076
9078 /* Initialize module parameter values here */ 9077 /* Initialize module parameter values here */
9079 9078
9080 if (iwl_param_disable) { 9079 if (iwl4965_param_disable) {
9081 set_bit(STATUS_RF_KILL_SW, &priv->status); 9080 set_bit(STATUS_RF_KILL_SW, &priv->status);
9082 IWL_DEBUG_INFO("Radio disabled.\n"); 9081 IWL_DEBUG_INFO("Radio disabled.\n");
9083 } 9082 }
@@ -9097,36 +9096,36 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
9097 ": Detected Intel Wireless WiFi Link 4965AGN\n"); 9096 ": Detected Intel Wireless WiFi Link 4965AGN\n");
9098 9097
9099 /* Device-specific setup */ 9098 /* Device-specific setup */
9100 if (iwl_hw_set_hw_setting(priv)) { 9099 if (iwl4965_hw_set_hw_setting(priv)) {
9101 IWL_ERROR("failed to set hw settings\n"); 9100 IWL_ERROR("failed to set hw settings\n");
9102 mutex_unlock(&priv->mutex); 9101 mutex_unlock(&priv->mutex);
9103 goto out_iounmap; 9102 goto out_iounmap;
9104 } 9103 }
9105 9104
9106#ifdef CONFIG_IWL4965_QOS 9105#ifdef CONFIG_IWL4965_QOS
9107 if (iwl_param_qos_enable) 9106 if (iwl4965_param_qos_enable)
9108 priv->qos_data.qos_enable = 1; 9107 priv->qos_data.qos_enable = 1;
9109 9108
9110 iwl_reset_qos(priv); 9109 iwl4965_reset_qos(priv);
9111 9110
9112 priv->qos_data.qos_active = 0; 9111 priv->qos_data.qos_active = 0;
9113 priv->qos_data.qos_cap.val = 0; 9112 priv->qos_data.qos_cap.val = 0;
9114#endif /* CONFIG_IWL4965_QOS */ 9113#endif /* CONFIG_IWL4965_QOS */
9115 9114
9116 iwl_set_rxon_channel(priv, MODE_IEEE80211G, 6); 9115 iwl4965_set_rxon_channel(priv, MODE_IEEE80211G, 6);
9117 iwl_setup_deferred_work(priv); 9116 iwl4965_setup_deferred_work(priv);
9118 iwl_setup_rx_handlers(priv); 9117 iwl4965_setup_rx_handlers(priv);
9119 9118
9120 priv->rates_mask = IWL_RATES_MASK; 9119 priv->rates_mask = IWL_RATES_MASK;
9121 /* If power management is turned on, default to AC mode */ 9120 /* If power management is turned on, default to AC mode */
9122 priv->power_mode = IWL_POWER_AC; 9121 priv->power_mode = IWL_POWER_AC;
9123 priv->user_txpower_limit = IWL_DEFAULT_TX_POWER; 9122 priv->user_txpower_limit = IWL_DEFAULT_TX_POWER;
9124 9123
9125 iwl_disable_interrupts(priv); 9124 iwl4965_disable_interrupts(priv);
9126 9125
9127 pci_enable_msi(pdev); 9126 pci_enable_msi(pdev);
9128 9127
9129 err = request_irq(pdev->irq, iwl_isr, IRQF_SHARED, DRV_NAME, priv); 9128 err = request_irq(pdev->irq, iwl4965_isr, IRQF_SHARED, DRV_NAME, priv);
9130 if (err) { 9129 if (err) {
9131 IWL_ERROR("Error allocating IRQ %d\n", pdev->irq); 9130 IWL_ERROR("Error allocating IRQ %d\n", pdev->irq);
9132 goto out_disable_msi; 9131 goto out_disable_msi;
@@ -9134,7 +9133,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
9134 9133
9135 mutex_lock(&priv->mutex); 9134 mutex_lock(&priv->mutex);
9136 9135
9137 err = sysfs_create_group(&pdev->dev.kobj, &iwl_attribute_group); 9136 err = sysfs_create_group(&pdev->dev.kobj, &iwl4965_attribute_group);
9138 if (err) { 9137 if (err) {
9139 IWL_ERROR("failed to create sysfs device attributes\n"); 9138 IWL_ERROR("failed to create sysfs device attributes\n");
9140 mutex_unlock(&priv->mutex); 9139 mutex_unlock(&priv->mutex);
@@ -9143,7 +9142,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
9143 9142
9144 /* fetch ucode file from disk, alloc and copy to bus-master buffers ... 9143 /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
9145 * ucode filename and max sizes are card-specific. */ 9144 * ucode filename and max sizes are card-specific. */
9146 err = iwl_read_ucode(priv); 9145 err = iwl4965_read_ucode(priv);
9147 if (err) { 9146 if (err) {
9148 IWL_ERROR("Could not read microcode: %d\n", err); 9147 IWL_ERROR("Could not read microcode: %d\n", err);
9149 mutex_unlock(&priv->mutex); 9148 mutex_unlock(&priv->mutex);
@@ -9159,9 +9158,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
9159 return 0; 9158 return 0;
9160 9159
9161 out_pci_alloc: 9160 out_pci_alloc:
9162 iwl_dealloc_ucode_pci(priv); 9161 iwl4965_dealloc_ucode_pci(priv);
9163 9162
9164 sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); 9163 sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group);
9165 9164
9166 out_release_irq: 9165 out_release_irq:
9167 free_irq(pdev->irq, priv); 9166 free_irq(pdev->irq, priv);
@@ -9170,7 +9169,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
9170 pci_disable_msi(pdev); 9169 pci_disable_msi(pdev);
9171 destroy_workqueue(priv->workqueue); 9170 destroy_workqueue(priv->workqueue);
9172 priv->workqueue = NULL; 9171 priv->workqueue = NULL;
9173 iwl_unset_hw_setting(priv); 9172 iwl4965_unset_hw_setting(priv);
9174 9173
9175 out_iounmap: 9174 out_iounmap:
9176 pci_iounmap(pdev, priv->hw_base); 9175 pci_iounmap(pdev, priv->hw_base);
@@ -9185,9 +9184,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
9185 return err; 9184 return err;
9186} 9185}
9187 9186
9188static void iwl_pci_remove(struct pci_dev *pdev) 9187static void iwl4965_pci_remove(struct pci_dev *pdev)
9189{ 9188{
9190 struct iwl_priv *priv = pci_get_drvdata(pdev); 9189 struct iwl4965_priv *priv = pci_get_drvdata(pdev);
9191 struct list_head *p, *q; 9190 struct list_head *p, *q;
9192 int i; 9191 int i;
9193 9192
@@ -9198,36 +9197,36 @@ static void iwl_pci_remove(struct pci_dev *pdev)
9198 9197
9199 set_bit(STATUS_EXIT_PENDING, &priv->status); 9198 set_bit(STATUS_EXIT_PENDING, &priv->status);
9200 9199
9201 iwl_down(priv); 9200 iwl4965_down(priv);
9202 9201
9203 /* Free MAC hash list for ADHOC */ 9202 /* Free MAC hash list for ADHOC */
9204 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { 9203 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
9205 list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) { 9204 list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) {
9206 list_del(p); 9205 list_del(p);
9207 kfree(list_entry(p, struct iwl_ibss_seq, list)); 9206 kfree(list_entry(p, struct iwl4965_ibss_seq, list));
9208 } 9207 }
9209 } 9208 }
9210 9209
9211 sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); 9210 sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group);
9212 9211
9213 iwl_dealloc_ucode_pci(priv); 9212 iwl4965_dealloc_ucode_pci(priv);
9214 9213
9215 if (priv->rxq.bd) 9214 if (priv->rxq.bd)
9216 iwl_rx_queue_free(priv, &priv->rxq); 9215 iwl4965_rx_queue_free(priv, &priv->rxq);
9217 iwl_hw_txq_ctx_free(priv); 9216 iwl4965_hw_txq_ctx_free(priv);
9218 9217
9219 iwl_unset_hw_setting(priv); 9218 iwl4965_unset_hw_setting(priv);
9220 iwl_clear_stations_table(priv); 9219 iwl4965_clear_stations_table(priv);
9221 9220
9222 if (priv->mac80211_registered) { 9221 if (priv->mac80211_registered) {
9223 ieee80211_unregister_hw(priv->hw); 9222 ieee80211_unregister_hw(priv->hw);
9224 iwl_rate_control_unregister(priv->hw); 9223 iwl4965_rate_control_unregister(priv->hw);
9225 } 9224 }
9226 9225
9227 /*netif_stop_queue(dev); */ 9226 /*netif_stop_queue(dev); */
9228 flush_workqueue(priv->workqueue); 9227 flush_workqueue(priv->workqueue);
9229 9228
9230 /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes 9229 /* ieee80211_unregister_hw calls iwl4965_mac_stop, which flushes
9231 * priv->workqueue... so we can't take down the workqueue 9230 * priv->workqueue... so we can't take down the workqueue
9232 * until now... */ 9231 * until now... */
9233 destroy_workqueue(priv->workqueue); 9232 destroy_workqueue(priv->workqueue);
@@ -9253,14 +9252,14 @@ static void iwl_pci_remove(struct pci_dev *pdev)
9253 9252
9254#ifdef CONFIG_PM 9253#ifdef CONFIG_PM
9255 9254
9256static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) 9255static int iwl4965_pci_suspend(struct pci_dev *pdev, pm_message_t state)
9257{ 9256{
9258 struct iwl_priv *priv = pci_get_drvdata(pdev); 9257 struct iwl4965_priv *priv = pci_get_drvdata(pdev);
9259 9258
9260 set_bit(STATUS_IN_SUSPEND, &priv->status); 9259 set_bit(STATUS_IN_SUSPEND, &priv->status);
9261 9260
9262 /* Take down the device; powers it off, etc. */ 9261 /* Take down the device; powers it off, etc. */
9263 iwl_down(priv); 9262 iwl4965_down(priv);
9264 9263
9265 if (priv->mac80211_registered) 9264 if (priv->mac80211_registered)
9266 ieee80211_stop_queues(priv->hw); 9265 ieee80211_stop_queues(priv->hw);
@@ -9272,7 +9271,7 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
9272 return 0; 9271 return 0;
9273} 9272}
9274 9273
9275static void iwl_resume(struct iwl_priv *priv) 9274static void iwl4965_resume(struct iwl4965_priv *priv)
9276{ 9275{
9277 unsigned long flags; 9276 unsigned long flags;
9278 9277
@@ -9281,47 +9280,47 @@ static void iwl_resume(struct iwl_priv *priv)
9281 * Without all of the following, resume will not attempt to take 9280 * Without all of the following, resume will not attempt to take
9282 * down the NIC (it shouldn't really need to) and will just try 9281 * down the NIC (it shouldn't really need to) and will just try
9283 * and bring the NIC back up. However that fails during the 9282 * and bring the NIC back up. However that fails during the
9284 * ucode verification process. This then causes iwl_down to be 9283 * ucode verification process. This then causes iwl4965_down to be
9285 * called *after* iwl_hw_nic_init() has succeeded -- which 9284 * called *after* iwl4965_hw_nic_init() has succeeded -- which
9286 * then lets the next init sequence succeed. So, we've 9285 * then lets the next init sequence succeed. So, we've
9287 * replicated all of that NIC init code here... */ 9286 * replicated all of that NIC init code here... */
9288 9287
9289 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 9288 iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF);
9290 9289
9291 iwl_hw_nic_init(priv); 9290 iwl4965_hw_nic_init(priv);
9292 9291
9293 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 9292 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
9294 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, 9293 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR,
9295 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 9294 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
9296 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 9295 iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF);
9297 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 9296 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
9298 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 9297 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
9299 9298
9300 /* tell the device to stop sending interrupts */ 9299 /* tell the device to stop sending interrupts */
9301 iwl_disable_interrupts(priv); 9300 iwl4965_disable_interrupts(priv);
9302 9301
9303 spin_lock_irqsave(&priv->lock, flags); 9302 spin_lock_irqsave(&priv->lock, flags);
9304 iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 9303 iwl4965_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
9305 9304
9306 if (!iwl_grab_nic_access(priv)) { 9305 if (!iwl4965_grab_nic_access(priv)) {
9307 iwl_write_prph(priv, APMG_CLK_DIS_REG, 9306 iwl4965_write_prph(priv, APMG_CLK_DIS_REG,
9308 APMG_CLK_VAL_DMA_CLK_RQT); 9307 APMG_CLK_VAL_DMA_CLK_RQT);
9309 iwl_release_nic_access(priv); 9308 iwl4965_release_nic_access(priv);
9310 } 9309 }
9311 spin_unlock_irqrestore(&priv->lock, flags); 9310 spin_unlock_irqrestore(&priv->lock, flags);
9312 9311
9313 udelay(5); 9312 udelay(5);
9314 9313
9315 iwl_hw_nic_reset(priv); 9314 iwl4965_hw_nic_reset(priv);
9316 9315
9317 /* Bring the device back up */ 9316 /* Bring the device back up */
9318 clear_bit(STATUS_IN_SUSPEND, &priv->status); 9317 clear_bit(STATUS_IN_SUSPEND, &priv->status);
9319 queue_work(priv->workqueue, &priv->up); 9318 queue_work(priv->workqueue, &priv->up);
9320} 9319}
9321 9320
9322static int iwl_pci_resume(struct pci_dev *pdev) 9321static int iwl4965_pci_resume(struct pci_dev *pdev)
9323{ 9322{
9324 struct iwl_priv *priv = pci_get_drvdata(pdev); 9323 struct iwl4965_priv *priv = pci_get_drvdata(pdev);
9325 int err; 9324 int err;
9326 9325
9327 printk(KERN_INFO "Coming out of suspend...\n"); 9326 printk(KERN_INFO "Coming out of suspend...\n");
@@ -9338,7 +9337,7 @@ static int iwl_pci_resume(struct pci_dev *pdev)
9338 */ 9337 */
9339 pci_write_config_byte(pdev, 0x41, 0x00); 9338 pci_write_config_byte(pdev, 0x41, 0x00);
9340 9339
9341 iwl_resume(priv); 9340 iwl4965_resume(priv);
9342 9341
9343 return 0; 9342 return 0;
9344} 9343}
@@ -9351,33 +9350,33 @@ static int iwl_pci_resume(struct pci_dev *pdev)
9351 * 9350 *
9352 *****************************************************************************/ 9351 *****************************************************************************/
9353 9352
9354static struct pci_driver iwl_driver = { 9353static struct pci_driver iwl4965_driver = {
9355 .name = DRV_NAME, 9354 .name = DRV_NAME,
9356 .id_table = iwl_hw_card_ids, 9355 .id_table = iwl4965_hw_card_ids,
9357 .probe = iwl_pci_probe, 9356 .probe = iwl4965_pci_probe,
9358 .remove = __devexit_p(iwl_pci_remove), 9357 .remove = __devexit_p(iwl4965_pci_remove),
9359#ifdef CONFIG_PM 9358#ifdef CONFIG_PM
9360 .suspend = iwl_pci_suspend, 9359 .suspend = iwl4965_pci_suspend,
9361 .resume = iwl_pci_resume, 9360 .resume = iwl4965_pci_resume,
9362#endif 9361#endif
9363}; 9362};
9364 9363
9365static int __init iwl_init(void) 9364static int __init iwl4965_init(void)
9366{ 9365{
9367 9366
9368 int ret; 9367 int ret;
9369 printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); 9368 printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n");
9370 printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); 9369 printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n");
9371 ret = pci_register_driver(&iwl_driver); 9370 ret = pci_register_driver(&iwl4965_driver);
9372 if (ret) { 9371 if (ret) {
9373 IWL_ERROR("Unable to initialize PCI module\n"); 9372 IWL_ERROR("Unable to initialize PCI module\n");
9374 return ret; 9373 return ret;
9375 } 9374 }
9376#ifdef CONFIG_IWL4965_DEBUG 9375#ifdef CONFIG_IWL4965_DEBUG
9377 ret = driver_create_file(&iwl_driver.driver, &driver_attr_debug_level); 9376 ret = driver_create_file(&iwl4965_driver.driver, &driver_attr_debug_level);
9378 if (ret) { 9377 if (ret) {
9379 IWL_ERROR("Unable to create driver sysfs file\n"); 9378 IWL_ERROR("Unable to create driver sysfs file\n");
9380 pci_unregister_driver(&iwl_driver); 9379 pci_unregister_driver(&iwl4965_driver);
9381 return ret; 9380 return ret;
9382 } 9381 }
9383#endif 9382#endif
@@ -9385,32 +9384,32 @@ static int __init iwl_init(void)
9385 return ret; 9384 return ret;
9386} 9385}
9387 9386
9388static void __exit iwl_exit(void) 9387static void __exit iwl4965_exit(void)
9389{ 9388{
9390#ifdef CONFIG_IWL4965_DEBUG 9389#ifdef CONFIG_IWL4965_DEBUG
9391 driver_remove_file(&iwl_driver.driver, &driver_attr_debug_level); 9390 driver_remove_file(&iwl4965_driver.driver, &driver_attr_debug_level);
9392#endif 9391#endif
9393 pci_unregister_driver(&iwl_driver); 9392 pci_unregister_driver(&iwl4965_driver);
9394} 9393}
9395 9394
9396module_param_named(antenna, iwl_param_antenna, int, 0444); 9395module_param_named(antenna, iwl4965_param_antenna, int, 0444);
9397MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); 9396MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])");
9398module_param_named(disable, iwl_param_disable, int, 0444); 9397module_param_named(disable, iwl4965_param_disable, int, 0444);
9399MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])"); 9398MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])");
9400module_param_named(hwcrypto, iwl_param_hwcrypto, int, 0444); 9399module_param_named(hwcrypto, iwl4965_param_hwcrypto, int, 0444);
9401MODULE_PARM_DESC(hwcrypto, 9400MODULE_PARM_DESC(hwcrypto,
9402 "using hardware crypto engine (default 0 [software])\n"); 9401 "using hardware crypto engine (default 0 [software])\n");
9403module_param_named(debug, iwl_param_debug, int, 0444); 9402module_param_named(debug, iwl4965_param_debug, int, 0444);
9404MODULE_PARM_DESC(debug, "debug output mask"); 9403MODULE_PARM_DESC(debug, "debug output mask");
9405module_param_named(disable_hw_scan, iwl_param_disable_hw_scan, int, 0444); 9404module_param_named(disable_hw_scan, iwl4965_param_disable_hw_scan, int, 0444);
9406MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); 9405MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)");
9407 9406
9408module_param_named(queues_num, iwl_param_queues_num, int, 0444); 9407module_param_named(queues_num, iwl4965_param_queues_num, int, 0444);
9409MODULE_PARM_DESC(queues_num, "number of hw queues."); 9408MODULE_PARM_DESC(queues_num, "number of hw queues.");
9410 9409
9411/* QoS */ 9410/* QoS */
9412module_param_named(qos_enable, iwl_param_qos_enable, int, 0444); 9411module_param_named(qos_enable, iwl4965_param_qos_enable, int, 0444);
9413MODULE_PARM_DESC(qos_enable, "enable all QoS functionality"); 9412MODULE_PARM_DESC(qos_enable, "enable all QoS functionality");
9414 9413
9415module_exit(iwl_exit); 9414module_exit(iwl4965_exit);
9416module_init(iwl_init); 9415module_init(iwl4965_init);