aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
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
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')
-rw-r--r--drivers/net/wireless/iwlwifi/Kconfig14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-commands.h190
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-debug.h12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-hw.h50
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-io.h256
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c144
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.h26
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c528
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h376
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-commands.h200
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-debug.h12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-hw.h72
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-io.h256
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.c300
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.h32
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c752
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.h452
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c2206
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c2321
19 files changed, 4093 insertions, 4106 deletions
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index 74243fe9dca4..abd0ce0954da 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -1,8 +1,7 @@
1config IWL4965 1config IWL4965
2 tristate "Intel Wireless WiFi 4965AGN" 2 tristate "Intel Wireless WiFi 4965AGN"
3 depends on m && PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL 3 depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
4 select FW_LOADER 4 select FW_LOADER
5 default m
6 ---help--- 5 ---help---
7 Select to build the driver supporting the: 6 Select to build the driver supporting the:
8 7
@@ -30,7 +29,6 @@ config IWL4965
30config IWL4965_QOS 29config IWL4965_QOS
31 bool "Enable Wireless QoS in iwl4965 driver" 30 bool "Enable Wireless QoS in iwl4965 driver"
32 depends on IWL4965 31 depends on IWL4965
33 default y
34 ---help--- 32 ---help---
35 This option will enable wireless quality of service (QoS) for the 33 This option will enable wireless quality of service (QoS) for the
36 iw4965 driver. 34 iw4965 driver.
@@ -38,14 +36,12 @@ config IWL4965_QOS
38config IWL4965_SPECTRUM_MEASUREMENT 36config IWL4965_SPECTRUM_MEASUREMENT
39 bool "Enable Spectrum Measurement in iw4965 driver" 37 bool "Enable Spectrum Measurement in iw4965 driver"
40 depends on IWL4965 38 depends on IWL4965
41 default y
42 ---help--- 39 ---help---
43 This option will enable spectrum measurement for the iwl4965 driver. 40 This option will enable spectrum measurement for the iwl4965 driver.
44 41
45config IWL4965_SENSITIVITY 42config IWL4965_SENSITIVITY
46 bool "Enable Sensitivity Calibration in iwl4965 driver" 43 bool "Enable Sensitivity Calibration in iwl4965 driver"
47 depends on IWL4965 44 depends on IWL4965
48 default y
49 ---help--- 45 ---help---
50 This option will enable sensitivity calibration for the iwl4965 46 This option will enable sensitivity calibration for the iwl4965
51 driver. 47 driver.
@@ -54,7 +50,6 @@ config IWL4965_HT
54 bool "Enable 802.11n HT features in iwl4965 driver" 50 bool "Enable 802.11n HT features in iwl4965 driver"
55 depends on EXPERIMENTAL 51 depends on EXPERIMENTAL
56 depends on IWL4965 && MAC80211_HT 52 depends on IWL4965 && MAC80211_HT
57 default n
58 ---help--- 53 ---help---
59 This option enables IEEE 802.11n High Throughput features 54 This option enables IEEE 802.11n High Throughput features
60 for the iwl4965 driver. 55 for the iwl4965 driver.
@@ -62,7 +57,6 @@ config IWL4965_HT
62config IWL4965_DEBUG 57config IWL4965_DEBUG
63 bool "Enable full debugging output in iwl4965 driver" 58 bool "Enable full debugging output in iwl4965 driver"
64 depends on IWL4965 59 depends on IWL4965
65 default y
66 ---help--- 60 ---help---
67 This option will enable debug tracing output for the iwl4965 61 This option will enable debug tracing output for the iwl4965
68 driver. 62 driver.
@@ -88,9 +82,8 @@ config IWL4965_DEBUG
88 82
89config IWL3945 83config IWL3945
90 tristate "Intel PRO/Wireless 3945ABG/BG Network Connection" 84 tristate "Intel PRO/Wireless 3945ABG/BG Network Connection"
91 depends on m && PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL 85 depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
92 select FW_LOADER 86 select FW_LOADER
93 default m
94 ---help--- 87 ---help---
95 Select to build the driver supporting the: 88 Select to build the driver supporting the:
96 89
@@ -118,7 +111,6 @@ config IWL3945
118config IWL3945_QOS 111config IWL3945_QOS
119 bool "Enable Wireless QoS in iwl3945 driver" 112 bool "Enable Wireless QoS in iwl3945 driver"
120 depends on IWL3945 113 depends on IWL3945
121 default y
122 ---help--- 114 ---help---
123 This option will enable wireless quality of service (QoS) for the 115 This option will enable wireless quality of service (QoS) for the
124 iwl3945 driver. 116 iwl3945 driver.
@@ -126,14 +118,12 @@ config IWL3945_QOS
126config IWL3945_SPECTRUM_MEASUREMENT 118config IWL3945_SPECTRUM_MEASUREMENT
127 bool "Enable Spectrum Measurement in iwl3945 drivers" 119 bool "Enable Spectrum Measurement in iwl3945 drivers"
128 depends on IWL3945 120 depends on IWL3945
129 default y
130 ---help--- 121 ---help---
131 This option will enable spectrum measurement for the iwl3945 driver. 122 This option will enable spectrum measurement for the iwl3945 driver.
132 123
133config IWL3945_DEBUG 124config IWL3945_DEBUG
134 bool "Enable full debugging output in iwl3945 driver" 125 bool "Enable full debugging output in iwl3945 driver"
135 depends on IWL3945 126 depends on IWL3945
136 default y
137 ---help--- 127 ---help---
138 This option will enable debug tracing output for the iwl3945 128 This option will enable debug tracing output for the iwl3945
139 driver. 129 driver.
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
index 2c71195a08e3..dc7498d5621c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
@@ -141,7 +141,7 @@ enum {
141 141
142#define IWL_CMD_FAILED_MSK 0x40 142#define IWL_CMD_FAILED_MSK 0x40
143 143
144struct iwl_cmd_header { 144struct iwl3945_cmd_header {
145 u8 cmd; 145 u8 cmd;
146 u8 flags; 146 u8 flags;
147 /* We have 15 LSB to use as we please (MSB indicates 147 /* We have 15 LSB to use as we please (MSB indicates
@@ -173,7 +173,7 @@ struct iwl_cmd_header {
173/* 173/*
174 * REPLY_ALIVE = 0x1 (response only, not a command) 174 * REPLY_ALIVE = 0x1 (response only, not a command)
175 */ 175 */
176struct iwl_alive_resp { 176struct iwl3945_alive_resp {
177 u8 ucode_minor; 177 u8 ucode_minor;
178 u8 ucode_major; 178 u8 ucode_major;
179 __le16 reserved1; 179 __le16 reserved1;
@@ -187,7 +187,7 @@ struct iwl_alive_resp {
187 __le32 is_valid; 187 __le32 is_valid;
188} __attribute__ ((packed)); 188} __attribute__ ((packed));
189 189
190struct iwl_init_alive_resp { 190struct iwl3945_init_alive_resp {
191 u8 ucode_minor; 191 u8 ucode_minor;
192 u8 ucode_major; 192 u8 ucode_major;
193 __le16 reserved1; 193 __le16 reserved1;
@@ -210,7 +210,7 @@ union tsf {
210/* 210/*
211 * REPLY_ERROR = 0x2 (response only, not a command) 211 * REPLY_ERROR = 0x2 (response only, not a command)
212 */ 212 */
213struct iwl_error_resp { 213struct iwl3945_error_resp {
214 __le32 error_type; 214 __le32 error_type;
215 u8 cmd_id; 215 u8 cmd_id;
216 u8 reserved1; 216 u8 reserved1;
@@ -279,7 +279,7 @@ enum {
279/* 279/*
280 * REPLY_RXON = 0x10 (command, has simple generic response) 280 * REPLY_RXON = 0x10 (command, has simple generic response)
281 */ 281 */
282struct iwl_rxon_cmd { 282struct iwl3945_rxon_cmd {
283 u8 node_addr[6]; 283 u8 node_addr[6];
284 __le16 reserved1; 284 __le16 reserved1;
285 u8 bssid_addr[6]; 285 u8 bssid_addr[6];
@@ -301,7 +301,7 @@ struct iwl_rxon_cmd {
301/* 301/*
302 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) 302 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
303 */ 303 */
304struct iwl_rxon_assoc_cmd { 304struct iwl3945_rxon_assoc_cmd {
305 __le32 flags; 305 __le32 flags;
306 __le32 filter_flags; 306 __le32 filter_flags;
307 u8 ofdm_basic_rates; 307 u8 ofdm_basic_rates;
@@ -312,7 +312,7 @@ struct iwl_rxon_assoc_cmd {
312/* 312/*
313 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) 313 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
314 */ 314 */
315struct iwl_rxon_time_cmd { 315struct iwl3945_rxon_time_cmd {
316 union tsf timestamp; 316 union tsf timestamp;
317 __le16 beacon_interval; 317 __le16 beacon_interval;
318 __le16 atim_window; 318 __le16 atim_window;
@@ -321,34 +321,34 @@ struct iwl_rxon_time_cmd {
321 __le16 reserved; 321 __le16 reserved;
322} __attribute__ ((packed)); 322} __attribute__ ((packed));
323 323
324struct iwl_tx_power { 324struct iwl3945_tx_power {
325 u8 tx_gain; /* gain for analog radio */ 325 u8 tx_gain; /* gain for analog radio */
326 u8 dsp_atten; /* gain for DSP */ 326 u8 dsp_atten; /* gain for DSP */
327} __attribute__ ((packed)); 327} __attribute__ ((packed));
328 328
329struct iwl_power_per_rate { 329struct iwl3945_power_per_rate {
330 u8 rate; /* plcp */ 330 u8 rate; /* plcp */
331 struct iwl_tx_power tpc; 331 struct iwl3945_tx_power tpc;
332 u8 reserved; 332 u8 reserved;
333} __attribute__ ((packed)); 333} __attribute__ ((packed));
334 334
335/* 335/*
336 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) 336 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
337 */ 337 */
338struct iwl_channel_switch_cmd { 338struct iwl3945_channel_switch_cmd {
339 u8 band; 339 u8 band;
340 u8 expect_beacon; 340 u8 expect_beacon;
341 __le16 channel; 341 __le16 channel;
342 __le32 rxon_flags; 342 __le32 rxon_flags;
343 __le32 rxon_filter_flags; 343 __le32 rxon_filter_flags;
344 __le32 switch_time; 344 __le32 switch_time;
345 struct iwl_power_per_rate power[IWL_MAX_RATES]; 345 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
346} __attribute__ ((packed)); 346} __attribute__ ((packed));
347 347
348/* 348/*
349 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) 349 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
350 */ 350 */
351struct iwl_csa_notification { 351struct iwl3945_csa_notification {
352 __le16 band; 352 __le16 band;
353 __le16 channel; 353 __le16 channel;
354 __le32 status; /* 0 - OK, 1 - fail */ 354 __le32 status; /* 0 - OK, 1 - fail */
@@ -359,7 +359,7 @@ struct iwl_csa_notification {
359 * Quality-of-Service (QOS) Commands & Responses: 359 * Quality-of-Service (QOS) Commands & Responses:
360 * 360 *
361 *****************************************************************************/ 361 *****************************************************************************/
362struct iwl_ac_qos { 362struct iwl3945_ac_qos {
363 __le16 cw_min; 363 __le16 cw_min;
364 __le16 cw_max; 364 __le16 cw_max;
365 u8 aifsn; 365 u8 aifsn;
@@ -381,9 +381,9 @@ struct iwl_ac_qos {
381/* 381/*
382 * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) 382 * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
383 */ 383 */
384struct iwl_qosparam_cmd { 384struct iwl3945_qosparam_cmd {
385 __le32 qos_flags; 385 __le32 qos_flags;
386 struct iwl_ac_qos ac[AC_NUM]; 386 struct iwl3945_ac_qos ac[AC_NUM];
387} __attribute__ ((packed)); 387} __attribute__ ((packed));
388 388
389/****************************************************************************** 389/******************************************************************************
@@ -442,7 +442,7 @@ struct iwl_qosparam_cmd {
442#define RATE_MCS_ANT_B_MSK 0x8000 442#define RATE_MCS_ANT_B_MSK 0x8000
443#define RATE_MCS_ANT_AB_MSK 0xc000 443#define RATE_MCS_ANT_AB_MSK 0xc000
444 444
445struct iwl_keyinfo { 445struct iwl3945_keyinfo {
446 __le16 key_flags; 446 __le16 key_flags;
447 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ 447 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
448 u8 reserved1; 448 u8 reserved1;
@@ -462,11 +462,11 @@ struct sta_id_modify {
462/* 462/*
463 * REPLY_ADD_STA = 0x18 (command) 463 * REPLY_ADD_STA = 0x18 (command)
464 */ 464 */
465struct iwl_addsta_cmd { 465struct iwl3945_addsta_cmd {
466 u8 mode; 466 u8 mode;
467 u8 reserved[3]; 467 u8 reserved[3];
468 struct sta_id_modify sta; 468 struct sta_id_modify sta;
469 struct iwl_keyinfo key; 469 struct iwl3945_keyinfo key;
470 __le32 station_flags; 470 __le32 station_flags;
471 __le32 station_flags_msk; 471 __le32 station_flags_msk;
472 __le16 tid_disable_tx; 472 __le16 tid_disable_tx;
@@ -479,7 +479,7 @@ struct iwl_addsta_cmd {
479/* 479/*
480 * REPLY_ADD_STA = 0x18 (response) 480 * REPLY_ADD_STA = 0x18 (response)
481 */ 481 */
482struct iwl_add_sta_resp { 482struct iwl3945_add_sta_resp {
483 u8 status; 483 u8 status;
484} __attribute__ ((packed)); 484} __attribute__ ((packed));
485 485
@@ -491,7 +491,7 @@ struct iwl_add_sta_resp {
491 * 491 *
492 *****************************************************************************/ 492 *****************************************************************************/
493 493
494struct iwl_rx_frame_stats { 494struct iwl3945_rx_frame_stats {
495 u8 phy_count; 495 u8 phy_count;
496 u8 id; 496 u8 id;
497 u8 rssi; 497 u8 rssi;
@@ -501,7 +501,7 @@ struct iwl_rx_frame_stats {
501 u8 payload[0]; 501 u8 payload[0];
502} __attribute__ ((packed)); 502} __attribute__ ((packed));
503 503
504struct iwl_rx_frame_hdr { 504struct iwl3945_rx_frame_hdr {
505 __le16 channel; 505 __le16 channel;
506 __le16 phy_flags; 506 __le16 phy_flags;
507 u8 reserved1; 507 u8 reserved1;
@@ -531,7 +531,7 @@ struct iwl_rx_frame_hdr {
531#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) 531#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
532#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) 532#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
533 533
534struct iwl_rx_frame_end { 534struct iwl3945_rx_frame_end {
535 __le32 status; 535 __le32 status;
536 __le64 timestamp; 536 __le64 timestamp;
537 __le32 beacon_timestamp; 537 __le32 beacon_timestamp;
@@ -545,10 +545,10 @@ struct iwl_rx_frame_end {
545 * The actual offsets of the hdr and end are dynamic based on 545 * The actual offsets of the hdr and end are dynamic based on
546 * stats.phy_count 546 * stats.phy_count
547 */ 547 */
548struct iwl_rx_frame { 548struct iwl3945_rx_frame {
549 struct iwl_rx_frame_stats stats; 549 struct iwl3945_rx_frame_stats stats;
550 struct iwl_rx_frame_hdr hdr; 550 struct iwl3945_rx_frame_hdr hdr;
551 struct iwl_rx_frame_end end; 551 struct iwl3945_rx_frame_end end;
552} __attribute__ ((packed)); 552} __attribute__ ((packed));
553 553
554/* Fixed (non-configurable) rx data from phy */ 554/* Fixed (non-configurable) rx data from phy */
@@ -643,7 +643,7 @@ struct iwl4965_rx_mpdu_res_start {
643 * TX command Frame life time 643 * TX command Frame life time
644 */ 644 */
645 645
646struct iwl_dram_scratch { 646struct iwl3945_dram_scratch {
647 u8 try_cnt; 647 u8 try_cnt;
648 u8 bt_kill_cnt; 648 u8 bt_kill_cnt;
649 __le16 reserved; 649 __le16 reserved;
@@ -652,7 +652,7 @@ struct iwl_dram_scratch {
652/* 652/*
653 * REPLY_TX = 0x1c (command) 653 * REPLY_TX = 0x1c (command)
654 */ 654 */
655struct iwl_tx_cmd { 655struct iwl3945_tx_cmd {
656 __le16 len; 656 __le16 len;
657 __le16 next_frame_len; 657 __le16 next_frame_len;
658 __le32 tx_flags; 658 __le32 tx_flags;
@@ -784,7 +784,7 @@ enum {
784/* 784/*
785 * REPLY_TX = 0x1c (response) 785 * REPLY_TX = 0x1c (response)
786 */ 786 */
787struct iwl_tx_resp { 787struct iwl3945_tx_resp {
788 u8 failure_rts; 788 u8 failure_rts;
789 u8 failure_frame; 789 u8 failure_frame;
790 u8 bt_kill_count; 790 u8 bt_kill_count;
@@ -796,7 +796,7 @@ struct iwl_tx_resp {
796/* 796/*
797 * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) 797 * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
798 */ 798 */
799struct iwl_compressed_ba_resp { 799struct iwl3945_compressed_ba_resp {
800 __le32 sta_addr_lo32; 800 __le32 sta_addr_lo32;
801 __le16 sta_addr_hi16; 801 __le16 sta_addr_hi16;
802 __le16 reserved; 802 __le16 reserved;
@@ -812,21 +812,21 @@ struct iwl_compressed_ba_resp {
812/* 812/*
813 * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) 813 * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
814 */ 814 */
815struct iwl_txpowertable_cmd { 815struct iwl3945_txpowertable_cmd {
816 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ 816 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
817 u8 reserved; 817 u8 reserved;
818 __le16 channel; 818 __le16 channel;
819 struct iwl_power_per_rate power[IWL_MAX_RATES]; 819 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
820} __attribute__ ((packed)); 820} __attribute__ ((packed));
821 821
822struct iwl_rate_scaling_info { 822struct iwl3945_rate_scaling_info {
823 __le16 rate_n_flags; 823 __le16 rate_n_flags;
824 u8 try_cnt; 824 u8 try_cnt;
825 u8 next_rate_index; 825 u8 next_rate_index;
826} __attribute__ ((packed)); 826} __attribute__ ((packed));
827 827
828/** 828/**
829 * struct iwl_rate_scaling_cmd - Rate Scaling Command & Response 829 * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
830 * 830 *
831 * REPLY_RATE_SCALE = 0x47 (command, has simple generic response) 831 * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
832 * 832 *
@@ -840,16 +840,16 @@ struct iwl_rate_scaling_info {
840 * when passed through ofdm_basic_rates on the REPLY_RXON 840 * when passed through ofdm_basic_rates on the REPLY_RXON
841 * command would be bit 0 (1<<0) 841 * command would be bit 0 (1<<0)
842 */ 842 */
843struct iwl_rate_scaling_cmd { 843struct iwl3945_rate_scaling_cmd {
844 u8 table_id; 844 u8 table_id;
845 u8 reserved[3]; 845 u8 reserved[3];
846 struct iwl_rate_scaling_info table[IWL_MAX_RATES]; 846 struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
847} __attribute__ ((packed)); 847} __attribute__ ((packed));
848 848
849/* 849/*
850 * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) 850 * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
851 */ 851 */
852struct iwl_bt_cmd { 852struct iwl3945_bt_cmd {
853 u8 flags; 853 u8 flags;
854 u8 lead_time; 854 u8 lead_time;
855 u8 max_kill; 855 u8 max_kill;
@@ -875,18 +875,18 @@ struct iwl_bt_cmd {
875 RXON_FILTER_ASSOC_MSK | \ 875 RXON_FILTER_ASSOC_MSK | \
876 RXON_FILTER_BCON_AWARE_MSK) 876 RXON_FILTER_BCON_AWARE_MSK)
877 877
878struct iwl_measure_channel { 878struct iwl3945_measure_channel {
879 __le32 duration; /* measurement duration in extended beacon 879 __le32 duration; /* measurement duration in extended beacon
880 * format */ 880 * format */
881 u8 channel; /* channel to measure */ 881 u8 channel; /* channel to measure */
882 u8 type; /* see enum iwl_measure_type */ 882 u8 type; /* see enum iwl3945_measure_type */
883 __le16 reserved; 883 __le16 reserved;
884} __attribute__ ((packed)); 884} __attribute__ ((packed));
885 885
886/* 886/*
887 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) 887 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
888 */ 888 */
889struct iwl_spectrum_cmd { 889struct iwl3945_spectrum_cmd {
890 __le16 len; /* number of bytes starting from token */ 890 __le16 len; /* number of bytes starting from token */
891 u8 token; /* token id */ 891 u8 token; /* token id */
892 u8 id; /* measurement id -- 0 or 1 */ 892 u8 id; /* measurement id -- 0 or 1 */
@@ -899,13 +899,13 @@ struct iwl_spectrum_cmd {
899 __le32 filter_flags; /* rxon filter flags */ 899 __le32 filter_flags; /* rxon filter flags */
900 __le16 channel_count; /* minimum 1, maximum 10 */ 900 __le16 channel_count; /* minimum 1, maximum 10 */
901 __le16 reserved3; 901 __le16 reserved3;
902 struct iwl_measure_channel channels[10]; 902 struct iwl3945_measure_channel channels[10];
903} __attribute__ ((packed)); 903} __attribute__ ((packed));
904 904
905/* 905/*
906 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) 906 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
907 */ 907 */
908struct iwl_spectrum_resp { 908struct iwl3945_spectrum_resp {
909 u8 token; 909 u8 token;
910 u8 id; /* id of the prior command replaced, or 0xff */ 910 u8 id; /* id of the prior command replaced, or 0xff */
911 __le16 status; /* 0 - command will be handled 911 __le16 status; /* 0 - command will be handled
@@ -913,12 +913,12 @@ struct iwl_spectrum_resp {
913 * measurement) */ 913 * measurement) */
914} __attribute__ ((packed)); 914} __attribute__ ((packed));
915 915
916enum iwl_measurement_state { 916enum iwl3945_measurement_state {
917 IWL_MEASUREMENT_START = 0, 917 IWL_MEASUREMENT_START = 0,
918 IWL_MEASUREMENT_STOP = 1, 918 IWL_MEASUREMENT_STOP = 1,
919}; 919};
920 920
921enum iwl_measurement_status { 921enum iwl3945_measurement_status {
922 IWL_MEASUREMENT_OK = 0, 922 IWL_MEASUREMENT_OK = 0,
923 IWL_MEASUREMENT_CONCURRENT = 1, 923 IWL_MEASUREMENT_CONCURRENT = 1,
924 IWL_MEASUREMENT_CSA_CONFLICT = 2, 924 IWL_MEASUREMENT_CSA_CONFLICT = 2,
@@ -931,18 +931,18 @@ enum iwl_measurement_status {
931 931
932#define NUM_ELEMENTS_IN_HISTOGRAM 8 932#define NUM_ELEMENTS_IN_HISTOGRAM 8
933 933
934struct iwl_measurement_histogram { 934struct iwl3945_measurement_histogram {
935 __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ 935 __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
936 __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ 936 __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
937} __attribute__ ((packed)); 937} __attribute__ ((packed));
938 938
939/* clear channel availability counters */ 939/* clear channel availability counters */
940struct iwl_measurement_cca_counters { 940struct iwl3945_measurement_cca_counters {
941 __le32 ofdm; 941 __le32 ofdm;
942 __le32 cck; 942 __le32 cck;
943} __attribute__ ((packed)); 943} __attribute__ ((packed));
944 944
945enum iwl_measure_type { 945enum iwl3945_measure_type {
946 IWL_MEASURE_BASIC = (1 << 0), 946 IWL_MEASURE_BASIC = (1 << 0),
947 IWL_MEASURE_CHANNEL_LOAD = (1 << 1), 947 IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
948 IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), 948 IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
@@ -955,7 +955,7 @@ enum iwl_measure_type {
955/* 955/*
956 * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) 956 * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
957 */ 957 */
958struct iwl_spectrum_notification { 958struct iwl3945_spectrum_notification {
959 u8 id; /* measurement id -- 0 or 1 */ 959 u8 id; /* measurement id -- 0 or 1 */
960 u8 token; 960 u8 token;
961 u8 channel_index; /* index in measurement channel list */ 961 u8 channel_index; /* index in measurement channel list */
@@ -963,7 +963,7 @@ struct iwl_spectrum_notification {
963 __le32 start_time; /* lower 32-bits of TSF */ 963 __le32 start_time; /* lower 32-bits of TSF */
964 u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ 964 u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
965 u8 channel; 965 u8 channel;
966 u8 type; /* see enum iwl_measurement_type */ 966 u8 type; /* see enum iwl3945_measurement_type */
967 u8 reserved1; 967 u8 reserved1;
968 /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only 968 /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
969 * valid if applicable for measurement type requested. */ 969 * valid if applicable for measurement type requested. */
@@ -973,9 +973,9 @@ struct iwl_spectrum_notification {
973 u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - 973 u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
974 * unidentified */ 974 * unidentified */
975 u8 reserved2[3]; 975 u8 reserved2[3];
976 struct iwl_measurement_histogram histogram; 976 struct iwl3945_measurement_histogram histogram;
977 __le32 stop_time; /* lower 32-bits of TSF */ 977 __le32 stop_time; /* lower 32-bits of TSF */
978 __le32 status; /* see iwl_measurement_status */ 978 __le32 status; /* see iwl3945_measurement_status */
979} __attribute__ ((packed)); 979} __attribute__ ((packed));
980 980
981/****************************************************************************** 981/******************************************************************************
@@ -985,7 +985,7 @@ struct iwl_spectrum_notification {
985 *****************************************************************************/ 985 *****************************************************************************/
986 986
987/** 987/**
988 * struct iwl_powertable_cmd - Power Table Command 988 * struct iwl3945_powertable_cmd - Power Table Command
989 * @flags: See below: 989 * @flags: See below:
990 * 990 *
991 * POWER_TABLE_CMD = 0x77 (command, has simple generic response) 991 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
@@ -1017,7 +1017,7 @@ struct iwl_spectrum_notification {
1017#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1<<0) 1017#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1<<0)
1018#define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1<<2) 1018#define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1<<2)
1019#define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1<<3) 1019#define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1<<3)
1020struct iwl_powertable_cmd { 1020struct iwl3945_powertable_cmd {
1021 __le32 flags; 1021 __le32 flags;
1022 __le32 rx_data_timeout; 1022 __le32 rx_data_timeout;
1023 __le32 tx_data_timeout; 1023 __le32 tx_data_timeout;
@@ -1028,7 +1028,7 @@ struct iwl_powertable_cmd {
1028 * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) 1028 * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
1029 * 3945 and 4965 identical. 1029 * 3945 and 4965 identical.
1030 */ 1030 */
1031struct iwl_sleep_notification { 1031struct iwl3945_sleep_notification {
1032 u8 pm_sleep_mode; 1032 u8 pm_sleep_mode;
1033 u8 pm_wakeup_src; 1033 u8 pm_wakeup_src;
1034 __le16 reserved; 1034 __le16 reserved;
@@ -1058,14 +1058,14 @@ enum {
1058#define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ 1058#define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
1059#define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ 1059#define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
1060#define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ 1060#define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
1061struct iwl_card_state_cmd { 1061struct iwl3945_card_state_cmd {
1062 __le32 status; /* CARD_STATE_CMD_* request new power state */ 1062 __le32 status; /* CARD_STATE_CMD_* request new power state */
1063} __attribute__ ((packed)); 1063} __attribute__ ((packed));
1064 1064
1065/* 1065/*
1066 * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) 1066 * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
1067 */ 1067 */
1068struct iwl_card_state_notif { 1068struct iwl3945_card_state_notif {
1069 __le32 flags; 1069 __le32 flags;
1070} __attribute__ ((packed)); 1070} __attribute__ ((packed));
1071 1071
@@ -1074,7 +1074,7 @@ struct iwl_card_state_notif {
1074#define RF_CARD_DISABLED 0x04 1074#define RF_CARD_DISABLED 0x04
1075#define RXON_CARD_DISABLED 0x10 1075#define RXON_CARD_DISABLED 0x10
1076 1076
1077struct iwl_ct_kill_config { 1077struct iwl3945_ct_kill_config {
1078 __le32 reserved; 1078 __le32 reserved;
1079 __le32 critical_temperature_M; 1079 __le32 critical_temperature_M;
1080 __le32 critical_temperature_R; 1080 __le32 critical_temperature_R;
@@ -1086,7 +1086,7 @@ struct iwl_ct_kill_config {
1086 * 1086 *
1087 *****************************************************************************/ 1087 *****************************************************************************/
1088 1088
1089struct iwl_scan_channel { 1089struct iwl3945_scan_channel {
1090 /* type is defined as: 1090 /* type is defined as:
1091 * 0:0 active (0 - passive) 1091 * 0:0 active (0 - passive)
1092 * 1:4 SSID direct 1092 * 1:4 SSID direct
@@ -1095,12 +1095,12 @@ struct iwl_scan_channel {
1095 */ 1095 */
1096 u8 type; 1096 u8 type;
1097 u8 channel; 1097 u8 channel;
1098 struct iwl_tx_power tpc; 1098 struct iwl3945_tx_power tpc;
1099 __le16 active_dwell; 1099 __le16 active_dwell;
1100 __le16 passive_dwell; 1100 __le16 passive_dwell;
1101} __attribute__ ((packed)); 1101} __attribute__ ((packed));
1102 1102
1103struct iwl_ssid_ie { 1103struct iwl3945_ssid_ie {
1104 u8 id; 1104 u8 id;
1105 u8 len; 1105 u8 len;
1106 u8 ssid[32]; 1106 u8 ssid[32];
@@ -1114,7 +1114,7 @@ struct iwl_ssid_ie {
1114/* 1114/*
1115 * REPLY_SCAN_CMD = 0x80 (command) 1115 * REPLY_SCAN_CMD = 0x80 (command)
1116 */ 1116 */
1117struct iwl_scan_cmd { 1117struct iwl3945_scan_cmd {
1118 __le16 len; 1118 __le16 len;
1119 u8 reserved0; 1119 u8 reserved0;
1120 u8 channel_count; 1120 u8 channel_count;
@@ -1133,14 +1133,14 @@ struct iwl_scan_cmd {
1133 __le32 flags; 1133 __le32 flags;
1134 __le32 filter_flags; 1134 __le32 filter_flags;
1135 1135
1136 struct iwl_tx_cmd tx_cmd; 1136 struct iwl3945_tx_cmd tx_cmd;
1137 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; 1137 struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX];
1138 1138
1139 u8 data[0]; 1139 u8 data[0];
1140 /* 1140 /*
1141 * The channels start after the probe request payload and are of type: 1141 * The channels start after the probe request payload and are of type:
1142 * 1142 *
1143 * struct iwl_scan_channel channels[0]; 1143 * struct iwl3945_scan_channel channels[0];
1144 * 1144 *
1145 * NOTE: Only one band of channels can be scanned per pass. You 1145 * NOTE: Only one band of channels can be scanned per pass. You
1146 * can not mix 2.4GHz channels and 5.2GHz channels and must 1146 * can not mix 2.4GHz channels and 5.2GHz channels and must
@@ -1157,14 +1157,14 @@ struct iwl_scan_cmd {
1157/* 1157/*
1158 * REPLY_SCAN_CMD = 0x80 (response) 1158 * REPLY_SCAN_CMD = 0x80 (response)
1159 */ 1159 */
1160struct iwl_scanreq_notification { 1160struct iwl3945_scanreq_notification {
1161 __le32 status; /* 1: okay, 2: cannot fulfill request */ 1161 __le32 status; /* 1: okay, 2: cannot fulfill request */
1162} __attribute__ ((packed)); 1162} __attribute__ ((packed));
1163 1163
1164/* 1164/*
1165 * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) 1165 * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
1166 */ 1166 */
1167struct iwl_scanstart_notification { 1167struct iwl3945_scanstart_notification {
1168 __le32 tsf_low; 1168 __le32 tsf_low;
1169 __le32 tsf_high; 1169 __le32 tsf_high;
1170 __le32 beacon_timer; 1170 __le32 beacon_timer;
@@ -1181,7 +1181,7 @@ struct iwl_scanstart_notification {
1181/* 1181/*
1182 * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) 1182 * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
1183 */ 1183 */
1184struct iwl_scanresults_notification { 1184struct iwl3945_scanresults_notification {
1185 u8 channel; 1185 u8 channel;
1186 u8 band; 1186 u8 band;
1187 u8 reserved[2]; 1187 u8 reserved[2];
@@ -1193,7 +1193,7 @@ struct iwl_scanresults_notification {
1193/* 1193/*
1194 * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) 1194 * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
1195 */ 1195 */
1196struct iwl_scancomplete_notification { 1196struct iwl3945_scancomplete_notification {
1197 u8 scanned_channels; 1197 u8 scanned_channels;
1198 u8 status; 1198 u8 status;
1199 u8 reserved; 1199 u8 reserved;
@@ -1212,8 +1212,8 @@ struct iwl_scancomplete_notification {
1212/* 1212/*
1213 * BEACON_NOTIFICATION = 0x90 (notification only, not a command) 1213 * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
1214 */ 1214 */
1215struct iwl_beacon_notif { 1215struct iwl3945_beacon_notif {
1216 struct iwl_tx_resp beacon_notify_hdr; 1216 struct iwl3945_tx_resp beacon_notify_hdr;
1217 __le32 low_tsf; 1217 __le32 low_tsf;
1218 __le32 high_tsf; 1218 __le32 high_tsf;
1219 __le32 ibss_mgr_status; 1219 __le32 ibss_mgr_status;
@@ -1222,8 +1222,8 @@ struct iwl_beacon_notif {
1222/* 1222/*
1223 * REPLY_TX_BEACON = 0x91 (command, has simple generic response) 1223 * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
1224 */ 1224 */
1225struct iwl_tx_beacon_cmd { 1225struct iwl3945_tx_beacon_cmd {
1226 struct iwl_tx_cmd tx; 1226 struct iwl3945_tx_cmd tx;
1227 __le16 tim_idx; 1227 __le16 tim_idx;
1228 u8 tim_size; 1228 u8 tim_size;
1229 u8 reserved1; 1229 u8 reserved1;
@@ -1345,7 +1345,7 @@ struct statistics_general {
1345 */ 1345 */
1346#define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */ 1346#define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */
1347#define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */ 1347#define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */
1348struct iwl_statistics_cmd { 1348struct iwl3945_statistics_cmd {
1349 __le32 configuration_flags; /* IWL_STATS_CONF_* */ 1349 __le32 configuration_flags; /* IWL_STATS_CONF_* */
1350} __attribute__ ((packed)); 1350} __attribute__ ((packed));
1351 1351
@@ -1366,7 +1366,7 @@ struct iwl_statistics_cmd {
1366 */ 1366 */
1367#define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2) 1367#define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2)
1368#define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8) 1368#define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8)
1369struct iwl_notif_statistics { 1369struct iwl3945_notif_statistics {
1370 __le32 flag; 1370 __le32 flag;
1371 struct statistics_rx rx; 1371 struct statistics_rx rx;
1372 struct statistics_tx tx; 1372 struct statistics_tx tx;
@@ -1381,7 +1381,7 @@ struct iwl_notif_statistics {
1381 * then this notification will be sent. */ 1381 * then this notification will be sent. */
1382#define CONSECUTIVE_MISSED_BCONS_TH 20 1382#define CONSECUTIVE_MISSED_BCONS_TH 20
1383 1383
1384struct iwl_missed_beacon_notif { 1384struct iwl3945_missed_beacon_notif {
1385 __le32 consequtive_missed_beacons; 1385 __le32 consequtive_missed_beacons;
1386 __le32 total_missed_becons; 1386 __le32 total_missed_becons;
1387 __le32 num_expected_beacons; 1387 __le32 num_expected_beacons;
@@ -1397,12 +1397,12 @@ struct iwl_missed_beacon_notif {
1397#define PHY_CALIBRATE_DIFF_GAIN_CMD (7) 1397#define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
1398#define HD_TABLE_SIZE (11) 1398#define HD_TABLE_SIZE (11)
1399 1399
1400struct iwl_sensitivity_cmd { 1400struct iwl3945_sensitivity_cmd {
1401 __le16 control; 1401 __le16 control;
1402 __le16 table[HD_TABLE_SIZE]; 1402 __le16 table[HD_TABLE_SIZE];
1403} __attribute__ ((packed)); 1403} __attribute__ ((packed));
1404 1404
1405struct iwl_calibration_cmd { 1405struct iwl3945_calibration_cmd {
1406 u8 opCode; 1406 u8 opCode;
1407 u8 flags; 1407 u8 flags;
1408 __le16 reserved; 1408 __le16 reserved;
@@ -1425,7 +1425,7 @@ struct iwl_calibration_cmd {
1425 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), 1425 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
1426 * this command turns it on or off, or sets up a periodic blinking cycle. 1426 * this command turns it on or off, or sets up a periodic blinking cycle.
1427 */ 1427 */
1428struct iwl_led_cmd { 1428struct iwl3945_led_cmd {
1429 __le32 interval; /* "interval" in uSec */ 1429 __le32 interval; /* "interval" in uSec */
1430 u8 id; /* 1: Activity, 2: Link, 3: Tech */ 1430 u8 id; /* 1: Activity, 2: Link, 3: Tech */
1431 u8 off; /* # intervals off while blinking; 1431 u8 off; /* # intervals off while blinking;
@@ -1441,27 +1441,27 @@ struct iwl_led_cmd {
1441 * 1441 *
1442 *****************************************************************************/ 1442 *****************************************************************************/
1443 1443
1444struct iwl_rx_packet { 1444struct iwl3945_rx_packet {
1445 __le32 len; 1445 __le32 len;
1446 struct iwl_cmd_header hdr; 1446 struct iwl3945_cmd_header hdr;
1447 union { 1447 union {
1448 struct iwl_alive_resp alive_frame; 1448 struct iwl3945_alive_resp alive_frame;
1449 struct iwl_rx_frame rx_frame; 1449 struct iwl3945_rx_frame rx_frame;
1450 struct iwl_tx_resp tx_resp; 1450 struct iwl3945_tx_resp tx_resp;
1451 struct iwl_spectrum_notification spectrum_notif; 1451 struct iwl3945_spectrum_notification spectrum_notif;
1452 struct iwl_csa_notification csa_notif; 1452 struct iwl3945_csa_notification csa_notif;
1453 struct iwl_error_resp err_resp; 1453 struct iwl3945_error_resp err_resp;
1454 struct iwl_card_state_notif card_state_notif; 1454 struct iwl3945_card_state_notif card_state_notif;
1455 struct iwl_beacon_notif beacon_status; 1455 struct iwl3945_beacon_notif beacon_status;
1456 struct iwl_add_sta_resp add_sta; 1456 struct iwl3945_add_sta_resp add_sta;
1457 struct iwl_sleep_notification sleep_notif; 1457 struct iwl3945_sleep_notification sleep_notif;
1458 struct iwl_spectrum_resp spectrum; 1458 struct iwl3945_spectrum_resp spectrum;
1459 struct iwl_notif_statistics stats; 1459 struct iwl3945_notif_statistics stats;
1460 __le32 status; 1460 __le32 status;
1461 u8 raw[0]; 1461 u8 raw[0];
1462 } u; 1462 } u;
1463} __attribute__ ((packed)); 1463} __attribute__ ((packed));
1464 1464
1465#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl_rx_frame)) 1465#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
1466 1466
1467#endif /* __iwl_3945_commands_h__ */ 1467#endif /* __iwl3945_3945_commands_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h
index d0ea83404e0e..ebf016877fee 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h
@@ -26,18 +26,18 @@
26 * 26 *
27 *****************************************************************************/ 27 *****************************************************************************/
28 28
29#ifndef __iwl_debug_h__ 29#ifndef __iwl3945_debug_h__
30#define __iwl_debug_h__ 30#define __iwl3945_debug_h__
31 31
32#ifdef CONFIG_IWL3945_DEBUG 32#ifdef CONFIG_IWL3945_DEBUG
33extern u32 iwl_debug_level; 33extern u32 iwl3945_debug_level;
34#define IWL_DEBUG(level, fmt, args...) \ 34#define IWL_DEBUG(level, fmt, args...) \
35do { if (iwl_debug_level & (level)) \ 35do { if (iwl3945_debug_level & (level)) \
36 printk(KERN_ERR DRV_NAME": %c %s " fmt, \ 36 printk(KERN_ERR DRV_NAME": %c %s " fmt, \
37 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) 37 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
38 38
39#define IWL_DEBUG_LIMIT(level, fmt, args...) \ 39#define IWL_DEBUG_LIMIT(level, fmt, args...) \
40do { if ((iwl_debug_level & (level)) && net_ratelimit()) \ 40do { if ((iwl3945_debug_level & (level)) && net_ratelimit()) \
41 printk(KERN_ERR DRV_NAME": %c %s " fmt, \ 41 printk(KERN_ERR DRV_NAME": %c %s " fmt, \
42 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) 42 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
43#else 43#else
@@ -68,7 +68,7 @@ static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...)
68 * 68 *
69 * % cat /proc/net/iwl/debug_level 69 * % cat /proc/net/iwl/debug_level
70 * 70 *
71 * you simply need to add your entry to the iwl_debug_levels array. 71 * you simply need to add your entry to the iwl3945_debug_levels array.
72 * 72 *
73 * If you do not see debug_level in /proc/net/iwl then you do not have 73 * If you do not see debug_level in /proc/net/iwl then you do not have
74 * CONFIG_IWL3945_DEBUG defined in your kernel configuration 74 * CONFIG_IWL3945_DEBUG defined in your kernel configuration
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
index 71c9a7e32d1b..8bbaa16442a5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
@@ -133,7 +133,7 @@ enum {
133#define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7) 133#define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7)
134 134
135/* *regulatory* channel data from eeprom, one for each channel */ 135/* *regulatory* channel data from eeprom, one for each channel */
136struct iwl_eeprom_channel { 136struct iwl3945_eeprom_channel {
137 u8 flags; /* flags copied from EEPROM */ 137 u8 flags; /* flags copied from EEPROM */
138 s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */ 138 s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */
139} __attribute__ ((packed)); 139} __attribute__ ((packed));
@@ -148,7 +148,7 @@ struct iwl_eeprom_channel {
148 * level. 148 * level.
149 * Data copied from EEPROM. 149 * Data copied from EEPROM.
150 */ 150 */
151struct iwl_eeprom_txpower_sample { 151struct iwl3945_eeprom_txpower_sample {
152 u8 gain_index; /* index into power (gain) setup table ... */ 152 u8 gain_index; /* index into power (gain) setup table ... */
153 s8 power; /* ... for this pwr level for this chnl group */ 153 s8 power; /* ... for this pwr level for this chnl group */
154 u16 v_det; /* PA output voltage */ 154 u16 v_det; /* PA output voltage */
@@ -162,8 +162,8 @@ struct iwl_eeprom_txpower_sample {
162 * Data copied from EEPROM. 162 * Data copied from EEPROM.
163 * DO NOT ALTER THIS STRUCTURE!!! 163 * DO NOT ALTER THIS STRUCTURE!!!
164 */ 164 */
165struct iwl_eeprom_txpower_group { 165struct iwl3945_eeprom_txpower_group {
166 struct iwl_eeprom_txpower_sample samples[5]; /* 5 power levels */ 166 struct iwl3945_eeprom_txpower_sample samples[5]; /* 5 power levels */
167 s32 a, b, c, d, e; /* coefficients for voltage->power 167 s32 a, b, c, d, e; /* coefficients for voltage->power
168 * formula (signed) */ 168 * formula (signed) */
169 s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on 169 s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on
@@ -181,7 +181,7 @@ struct iwl_eeprom_txpower_group {
181 * difference between current temperature and factory calib temperature. 181 * difference between current temperature and factory calib temperature.
182 * Data copied from EEPROM. 182 * Data copied from EEPROM.
183 */ 183 */
184struct iwl_eeprom_temperature_corr { 184struct iwl3945_eeprom_temperature_corr {
185 u32 Ta; 185 u32 Ta;
186 u32 Tb; 186 u32 Tb;
187 u32 Tc; 187 u32 Tc;
@@ -189,7 +189,7 @@ struct iwl_eeprom_temperature_corr {
189 u32 Te; 189 u32 Te;
190} __attribute__ ((packed)); 190} __attribute__ ((packed));
191 191
192struct iwl_eeprom { 192struct iwl3945_eeprom {
193 u8 reserved0[16]; 193 u8 reserved0[16];
194#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */ 194#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */
195 u16 device_id; /* abs.ofs: 16 */ 195 u16 device_id; /* abs.ofs: 16 */
@@ -232,23 +232,23 @@ struct iwl_eeprom {
232#define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */ 232#define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */
233 u16 band_1_count; /* abs.ofs: 196 */ 233 u16 band_1_count; /* abs.ofs: 196 */
234#define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */ 234#define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */
235 struct iwl_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */ 235 struct iwl3945_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */
236#define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */ 236#define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */
237 u16 band_2_count; /* abs.ofs: 226 */ 237 u16 band_2_count; /* abs.ofs: 226 */
238#define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */ 238#define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */
239 struct iwl_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ 239 struct iwl3945_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
240#define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */ 240#define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */
241 u16 band_3_count; /* abs.ofs: 254 */ 241 u16 band_3_count; /* abs.ofs: 254 */
242#define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */ 242#define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */
243 struct iwl_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ 243 struct iwl3945_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
244#define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */ 244#define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */
245 u16 band_4_count; /* abs.ofs: 280 */ 245 u16 band_4_count; /* abs.ofs: 280 */
246#define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */ 246#define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */
247 struct iwl_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ 247 struct iwl3945_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
248#define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */ 248#define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */
249 u16 band_5_count; /* abs.ofs: 304 */ 249 u16 band_5_count; /* abs.ofs: 304 */
250#define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */ 250#define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */
251 struct iwl_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ 251 struct iwl3945_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
252 252
253 u8 reserved9[194]; 253 u8 reserved9[194];
254 254
@@ -258,10 +258,10 @@ struct iwl_eeprom {
258#define EEPROM_TXPOWER_CALIB_GROUP3 0x2c0 258#define EEPROM_TXPOWER_CALIB_GROUP3 0x2c0
259#define EEPROM_TXPOWER_CALIB_GROUP4 0x300 259#define EEPROM_TXPOWER_CALIB_GROUP4 0x300
260#define IWL_NUM_TX_CALIB_GROUPS 5 260#define IWL_NUM_TX_CALIB_GROUPS 5
261 struct iwl_eeprom_txpower_group groups[IWL_NUM_TX_CALIB_GROUPS]; 261 struct iwl3945_eeprom_txpower_group groups[IWL_NUM_TX_CALIB_GROUPS];
262/* abs.ofs: 512 */ 262/* abs.ofs: 512 */
263#define EEPROM_CALIB_TEMPERATURE_CORRECT 0x340 263#define EEPROM_CALIB_TEMPERATURE_CORRECT 0x340
264 struct iwl_eeprom_temperature_corr corrections; /* abs.ofs: 832 */ 264 struct iwl3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */
265 u8 reserved16[172]; /* fill out to full 1024 byte block */ 265 u8 reserved16[172]; /* fill out to full 1024 byte block */
266} __attribute__ ((packed)); 266} __attribute__ ((packed));
267 267
@@ -681,8 +681,8 @@ struct iwl_eeprom {
681#define TFD_TX_CMD_SLOTS 256 681#define TFD_TX_CMD_SLOTS 256
682#define TFD_CMD_SLOTS 32 682#define TFD_CMD_SLOTS 32
683 683
684#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \ 684#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl3945_cmd) - \
685 sizeof(struct iwl_cmd_meta)) 685 sizeof(struct iwl3945_cmd_meta))
686 686
687/* 687/*
688 * RX related structures and functions 688 * RX related structures and functions
@@ -704,41 +704,41 @@ struct iwl_eeprom {
704#define IWL_MAX_DATA_SIZE ALM_RTC_DATA_SIZE 704#define IWL_MAX_DATA_SIZE ALM_RTC_DATA_SIZE
705#define IWL_MAX_NUM_QUEUES 8 705#define IWL_MAX_NUM_QUEUES 8
706 706
707static inline int iwl_hw_valid_rtc_data_addr(u32 addr) 707static inline int iwl3945_hw_valid_rtc_data_addr(u32 addr)
708{ 708{
709 return (addr >= RTC_DATA_LOWER_BOUND) && 709 return (addr >= RTC_DATA_LOWER_BOUND) &&
710 (addr < ALM_RTC_DATA_UPPER_BOUND); 710 (addr < ALM_RTC_DATA_UPPER_BOUND);
711} 711}
712 712
713/* Base physical address of iwl_shared is provided to FH_TSSR_CBB_BASE 713/* Base physical address of iwl3945_shared is provided to FH_TSSR_CBB_BASE
714 * and &iwl_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */ 714 * and &iwl3945_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */
715struct iwl_shared { 715struct iwl3945_shared {
716 __le32 tx_base_ptr[8]; 716 __le32 tx_base_ptr[8];
717 __le32 rx_read_ptr[3]; 717 __le32 rx_read_ptr[3];
718} __attribute__ ((packed)); 718} __attribute__ ((packed));
719 719
720struct iwl_tfd_frame_data { 720struct iwl3945_tfd_frame_data {
721 __le32 addr; 721 __le32 addr;
722 __le32 len; 722 __le32 len;
723} __attribute__ ((packed)); 723} __attribute__ ((packed));
724 724
725struct iwl_tfd_frame { 725struct iwl3945_tfd_frame {
726 __le32 control_flags; 726 __le32 control_flags;
727 struct iwl_tfd_frame_data pa[4]; 727 struct iwl3945_tfd_frame_data pa[4];
728 u8 reserved[28]; 728 u8 reserved[28];
729} __attribute__ ((packed)); 729} __attribute__ ((packed));
730 730
731static inline u8 iwl_hw_get_rate(__le16 rate_n_flags) 731static inline u8 iwl3945_hw_get_rate(__le16 rate_n_flags)
732{ 732{
733 return le16_to_cpu(rate_n_flags) & 0xFF; 733 return le16_to_cpu(rate_n_flags) & 0xFF;
734} 734}
735 735
736static inline u16 iwl_hw_get_rate_n_flags(__le16 rate_n_flags) 736static inline u16 iwl3945_hw_get_rate_n_flags(__le16 rate_n_flags)
737{ 737{
738 return le16_to_cpu(rate_n_flags); 738 return le16_to_cpu(rate_n_flags);
739} 739}
740 740
741static inline __le16 iwl_hw_set_rate_n_flags(u8 rate, u16 flags) 741static inline __le16 iwl3945_hw_set_rate_n_flags(u8 rate, u16 flags)
742{ 742{
743 return cpu_to_le16((u16)rate|flags); 743 return cpu_to_le16((u16)rate|flags);
744} 744}
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-io.h b/drivers/net/wireless/iwlwifi/iwl-3945-io.h
index 74a51798c232..75e20d0a20d1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-io.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-io.h
@@ -26,8 +26,8 @@
26 * 26 *
27 *****************************************************************************/ 27 *****************************************************************************/
28 28
29#ifndef __iwl_io_h__ 29#ifndef __iwl3945_io_h__
30#define __iwl_io_h__ 30#define __iwl3945_io_h__
31 31
32#include <linux/io.h> 32#include <linux/io.h>
33 33
@@ -49,8 +49,8 @@
49 * 49 *
50 * If you wish to call the function without any debug or state checking, 50 * If you wish to call the function without any debug or state checking,
51 * you should use the single _ prefix version (as is used by dependent IO 51 * you should use the single _ prefix version (as is used by dependent IO
52 * routines, for example _iwl_read_direct32 calls the non-check version of 52 * routines, for example _iwl3945_read_direct32 calls the non-check version of
53 * _iwl_read32.) 53 * _iwl3945_read32.)
54 * 54 *
55 * These declarations are *extremely* useful in quickly isolating code deltas 55 * These declarations are *extremely* useful in quickly isolating code deltas
56 * which result in misconfiguring of the hardware I/O. In combination with 56 * which result in misconfiguring of the hardware I/O. In combination with
@@ -59,39 +59,39 @@
59 * 59 *
60 */ 60 */
61 61
62#define _iwl_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs)) 62#define _iwl3945_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs))
63#ifdef CONFIG_IWL3945_DEBUG 63#ifdef CONFIG_IWL3945_DEBUG
64static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *iwl, 64static inline void __iwl3945_write32(const char *f, u32 l, struct iwl3945_priv *iwl,
65 u32 ofs, u32 val) 65 u32 ofs, u32 val)
66{ 66{
67 IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l); 67 IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l);
68 _iwl_write32(iwl, ofs, val); 68 _iwl3945_write32(iwl, ofs, val);
69} 69}
70#define iwl_write32(iwl, ofs, val) \ 70#define iwl3945_write32(iwl, ofs, val) \
71 __iwl_write32(__FILE__, __LINE__, iwl, ofs, val) 71 __iwl3945_write32(__FILE__, __LINE__, iwl, ofs, val)
72#else 72#else
73#define iwl_write32(iwl, ofs, val) _iwl_write32(iwl, ofs, val) 73#define iwl3945_write32(iwl, ofs, val) _iwl3945_write32(iwl, ofs, val)
74#endif 74#endif
75 75
76#define _iwl_read32(iwl, ofs) readl((iwl)->hw_base + (ofs)) 76#define _iwl3945_read32(iwl, ofs) readl((iwl)->hw_base + (ofs))
77#ifdef CONFIG_IWL3945_DEBUG 77#ifdef CONFIG_IWL3945_DEBUG
78static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *iwl, u32 ofs) 78static inline u32 __iwl3945_read32(char *f, u32 l, struct iwl3945_priv *iwl, u32 ofs)
79{ 79{
80 IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l); 80 IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l);
81 return _iwl_read32(iwl, ofs); 81 return _iwl3945_read32(iwl, ofs);
82} 82}
83#define iwl_read32(iwl, ofs) __iwl_read32(__FILE__, __LINE__, iwl, ofs) 83#define iwl3945_read32(iwl, ofs) __iwl3945_read32(__FILE__, __LINE__, iwl, ofs)
84#else 84#else
85#define iwl_read32(p, o) _iwl_read32(p, o) 85#define iwl3945_read32(p, o) _iwl3945_read32(p, o)
86#endif 86#endif
87 87
88static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr, 88static inline int _iwl3945_poll_bit(struct iwl3945_priv *priv, u32 addr,
89 u32 bits, u32 mask, int timeout) 89 u32 bits, u32 mask, int timeout)
90{ 90{
91 int i = 0; 91 int i = 0;
92 92
93 do { 93 do {
94 if ((_iwl_read32(priv, addr) & mask) == (bits & mask)) 94 if ((_iwl3945_read32(priv, addr) & mask) == (bits & mask))
95 return i; 95 return i;
96 mdelay(10); 96 mdelay(10);
97 i += 10; 97 i += 10;
@@ -100,11 +100,11 @@ static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr,
100 return -ETIMEDOUT; 100 return -ETIMEDOUT;
101} 101}
102#ifdef CONFIG_IWL3945_DEBUG 102#ifdef CONFIG_IWL3945_DEBUG
103static inline int __iwl_poll_bit(const char *f, u32 l, 103static inline int __iwl3945_poll_bit(const char *f, u32 l,
104 struct iwl_priv *priv, u32 addr, 104 struct iwl3945_priv *priv, u32 addr,
105 u32 bits, u32 mask, int timeout) 105 u32 bits, u32 mask, int timeout)
106{ 106{
107 int ret = _iwl_poll_bit(priv, addr, bits, mask, timeout); 107 int ret = _iwl3945_poll_bit(priv, addr, bits, mask, timeout);
108 if (unlikely(ret == -ETIMEDOUT)) 108 if (unlikely(ret == -ETIMEDOUT))
109 IWL_DEBUG_IO 109 IWL_DEBUG_IO
110 ("poll_bit(0x%08X, 0x%08X, 0x%08X) - timedout - %s %d\n", 110 ("poll_bit(0x%08X, 0x%08X, 0x%08X) - timedout - %s %d\n",
@@ -115,47 +115,47 @@ static inline int __iwl_poll_bit(const char *f, u32 l,
115 addr, bits, mask, ret, f, l); 115 addr, bits, mask, ret, f, l);
116 return ret; 116 return ret;
117} 117}
118#define iwl_poll_bit(iwl, addr, bits, mask, timeout) \ 118#define iwl3945_poll_bit(iwl, addr, bits, mask, timeout) \
119 __iwl_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout) 119 __iwl3945_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout)
120#else 120#else
121#define iwl_poll_bit(p, a, b, m, t) _iwl_poll_bit(p, a, b, m, t) 121#define iwl3945_poll_bit(p, a, b, m, t) _iwl3945_poll_bit(p, a, b, m, t)
122#endif 122#endif
123 123
124static inline void _iwl_set_bit(struct iwl_priv *priv, u32 reg, u32 mask) 124static inline void _iwl3945_set_bit(struct iwl3945_priv *priv, u32 reg, u32 mask)
125{ 125{
126 _iwl_write32(priv, reg, _iwl_read32(priv, reg) | mask); 126 _iwl3945_write32(priv, reg, _iwl3945_read32(priv, reg) | mask);
127} 127}
128#ifdef CONFIG_IWL3945_DEBUG 128#ifdef CONFIG_IWL3945_DEBUG
129static inline void __iwl_set_bit(const char *f, u32 l, 129static inline void __iwl3945_set_bit(const char *f, u32 l,
130 struct iwl_priv *priv, u32 reg, u32 mask) 130 struct iwl3945_priv *priv, u32 reg, u32 mask)
131{ 131{
132 u32 val = _iwl_read32(priv, reg) | mask; 132 u32 val = _iwl3945_read32(priv, reg) | mask;
133 IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); 133 IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
134 _iwl_write32(priv, reg, val); 134 _iwl3945_write32(priv, reg, val);
135} 135}
136#define iwl_set_bit(p, r, m) __iwl_set_bit(__FILE__, __LINE__, p, r, m) 136#define iwl3945_set_bit(p, r, m) __iwl3945_set_bit(__FILE__, __LINE__, p, r, m)
137#else 137#else
138#define iwl_set_bit(p, r, m) _iwl_set_bit(p, r, m) 138#define iwl3945_set_bit(p, r, m) _iwl3945_set_bit(p, r, m)
139#endif 139#endif
140 140
141static inline void _iwl_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask) 141static inline void _iwl3945_clear_bit(struct iwl3945_priv *priv, u32 reg, u32 mask)
142{ 142{
143 _iwl_write32(priv, reg, _iwl_read32(priv, reg) & ~mask); 143 _iwl3945_write32(priv, reg, _iwl3945_read32(priv, reg) & ~mask);
144} 144}
145#ifdef CONFIG_IWL3945_DEBUG 145#ifdef CONFIG_IWL3945_DEBUG
146static inline void __iwl_clear_bit(const char *f, u32 l, 146static inline void __iwl3945_clear_bit(const char *f, u32 l,
147 struct iwl_priv *priv, u32 reg, u32 mask) 147 struct iwl3945_priv *priv, u32 reg, u32 mask)
148{ 148{
149 u32 val = _iwl_read32(priv, reg) & ~mask; 149 u32 val = _iwl3945_read32(priv, reg) & ~mask;
150 IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); 150 IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
151 _iwl_write32(priv, reg, val); 151 _iwl3945_write32(priv, reg, val);
152} 152}
153#define iwl_clear_bit(p, r, m) __iwl_clear_bit(__FILE__, __LINE__, p, r, m) 153#define iwl3945_clear_bit(p, r, m) __iwl3945_clear_bit(__FILE__, __LINE__, p, r, m)
154#else 154#else
155#define iwl_clear_bit(p, r, m) _iwl_clear_bit(p, r, m) 155#define iwl3945_clear_bit(p, r, m) _iwl3945_clear_bit(p, r, m)
156#endif 156#endif
157 157
158static inline int _iwl_grab_nic_access(struct iwl_priv *priv) 158static inline int _iwl3945_grab_nic_access(struct iwl3945_priv *priv)
159{ 159{
160 int ret; 160 int ret;
161 u32 gp_ctl; 161 u32 gp_ctl;
@@ -170,7 +170,7 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv)
170 "wakes up NIC\n"); 170 "wakes up NIC\n");
171 171
172 /* 10 msec allows time for NIC to complete its data save */ 172 /* 10 msec allows time for NIC to complete its data save */
173 gp_ctl = _iwl_read32(priv, CSR_GP_CNTRL); 173 gp_ctl = _iwl3945_read32(priv, CSR_GP_CNTRL);
174 if (gp_ctl & CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY) { 174 if (gp_ctl & CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY) {
175 IWL_DEBUG_RF_KILL("Wait for complete power-down, " 175 IWL_DEBUG_RF_KILL("Wait for complete power-down, "
176 "gpctl = 0x%08x\n", gp_ctl); 176 "gpctl = 0x%08x\n", gp_ctl);
@@ -181,8 +181,8 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv)
181 } 181 }
182 182
183 /* this bit wakes up the NIC */ 183 /* this bit wakes up the NIC */
184 _iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 184 _iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
185 ret = _iwl_poll_bit(priv, CSR_GP_CNTRL, 185 ret = _iwl3945_poll_bit(priv, CSR_GP_CNTRL,
186 CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, 186 CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN,
187 (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | 187 (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY |
188 CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50); 188 CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50);
@@ -198,106 +198,106 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv)
198} 198}
199 199
200#ifdef CONFIG_IWL3945_DEBUG 200#ifdef CONFIG_IWL3945_DEBUG
201static inline int __iwl_grab_nic_access(const char *f, u32 l, 201static inline int __iwl3945_grab_nic_access(const char *f, u32 l,
202 struct iwl_priv *priv) 202 struct iwl3945_priv *priv)
203{ 203{
204 if (atomic_read(&priv->restrict_refcnt)) 204 if (atomic_read(&priv->restrict_refcnt))
205 IWL_DEBUG_INFO("Grabbing access while already held at " 205 IWL_DEBUG_INFO("Grabbing access while already held at "
206 "line %d.\n", l); 206 "line %d.\n", l);
207 207
208 IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l); 208 IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l);
209 return _iwl_grab_nic_access(priv); 209 return _iwl3945_grab_nic_access(priv);
210} 210}
211#define iwl_grab_nic_access(priv) \ 211#define iwl3945_grab_nic_access(priv) \
212 __iwl_grab_nic_access(__FILE__, __LINE__, priv) 212 __iwl3945_grab_nic_access(__FILE__, __LINE__, priv)
213#else 213#else
214#define iwl_grab_nic_access(priv) \ 214#define iwl3945_grab_nic_access(priv) \
215 _iwl_grab_nic_access(priv) 215 _iwl3945_grab_nic_access(priv)
216#endif 216#endif
217 217
218static inline void _iwl_release_nic_access(struct iwl_priv *priv) 218static inline void _iwl3945_release_nic_access(struct iwl3945_priv *priv)
219{ 219{
220#ifdef CONFIG_IWL3945_DEBUG 220#ifdef CONFIG_IWL3945_DEBUG
221 if (atomic_dec_and_test(&priv->restrict_refcnt)) 221 if (atomic_dec_and_test(&priv->restrict_refcnt))
222#endif 222#endif
223 _iwl_clear_bit(priv, CSR_GP_CNTRL, 223 _iwl3945_clear_bit(priv, CSR_GP_CNTRL,
224 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 224 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
225} 225}
226#ifdef CONFIG_IWL3945_DEBUG 226#ifdef CONFIG_IWL3945_DEBUG
227static inline void __iwl_release_nic_access(const char *f, u32 l, 227static inline void __iwl3945_release_nic_access(const char *f, u32 l,
228 struct iwl_priv *priv) 228 struct iwl3945_priv *priv)
229{ 229{
230 if (atomic_read(&priv->restrict_refcnt) <= 0) 230 if (atomic_read(&priv->restrict_refcnt) <= 0)
231 IWL_ERROR("Release unheld nic access at line %d.\n", l); 231 IWL_ERROR("Release unheld nic access at line %d.\n", l);
232 232
233 IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l); 233 IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l);
234 _iwl_release_nic_access(priv); 234 _iwl3945_release_nic_access(priv);
235} 235}
236#define iwl_release_nic_access(priv) \ 236#define iwl3945_release_nic_access(priv) \
237 __iwl_release_nic_access(__FILE__, __LINE__, priv) 237 __iwl3945_release_nic_access(__FILE__, __LINE__, priv)
238#else 238#else
239#define iwl_release_nic_access(priv) \ 239#define iwl3945_release_nic_access(priv) \
240 _iwl_release_nic_access(priv) 240 _iwl3945_release_nic_access(priv)
241#endif 241#endif
242 242
243static inline u32 _iwl_read_direct32(struct iwl_priv *priv, u32 reg) 243static inline u32 _iwl3945_read_direct32(struct iwl3945_priv *priv, u32 reg)
244{ 244{
245 return _iwl_read32(priv, reg); 245 return _iwl3945_read32(priv, reg);
246} 246}
247#ifdef CONFIG_IWL3945_DEBUG 247#ifdef CONFIG_IWL3945_DEBUG
248static inline u32 __iwl_read_direct32(const char *f, u32 l, 248static inline u32 __iwl3945_read_direct32(const char *f, u32 l,
249 struct iwl_priv *priv, u32 reg) 249 struct iwl3945_priv *priv, u32 reg)
250{ 250{
251 u32 value = _iwl_read_direct32(priv, reg); 251 u32 value = _iwl3945_read_direct32(priv, reg);
252 if (!atomic_read(&priv->restrict_refcnt)) 252 if (!atomic_read(&priv->restrict_refcnt))
253 IWL_ERROR("Nic access not held from %s %d\n", f, l); 253 IWL_ERROR("Nic access not held from %s %d\n", f, l);
254 IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value, 254 IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value,
255 f, l); 255 f, l);
256 return value; 256 return value;
257} 257}
258#define iwl_read_direct32(priv, reg) \ 258#define iwl3945_read_direct32(priv, reg) \
259 __iwl_read_direct32(__FILE__, __LINE__, priv, reg) 259 __iwl3945_read_direct32(__FILE__, __LINE__, priv, reg)
260#else 260#else
261#define iwl_read_direct32 _iwl_read_direct32 261#define iwl3945_read_direct32 _iwl3945_read_direct32
262#endif 262#endif
263 263
264static inline void _iwl_write_direct32(struct iwl_priv *priv, 264static inline void _iwl3945_write_direct32(struct iwl3945_priv *priv,
265 u32 reg, u32 value) 265 u32 reg, u32 value)
266{ 266{
267 _iwl_write32(priv, reg, value); 267 _iwl3945_write32(priv, reg, value);
268} 268}
269#ifdef CONFIG_IWL3945_DEBUG 269#ifdef CONFIG_IWL3945_DEBUG
270static void __iwl_write_direct32(u32 line, 270static void __iwl3945_write_direct32(u32 line,
271 struct iwl_priv *priv, u32 reg, u32 value) 271 struct iwl3945_priv *priv, u32 reg, u32 value)
272{ 272{
273 if (!atomic_read(&priv->restrict_refcnt)) 273 if (!atomic_read(&priv->restrict_refcnt))
274 IWL_ERROR("Nic access not held from line %d\n", line); 274 IWL_ERROR("Nic access not held from line %d\n", line);
275 _iwl_write_direct32(priv, reg, value); 275 _iwl3945_write_direct32(priv, reg, value);
276} 276}
277#define iwl_write_direct32(priv, reg, value) \ 277#define iwl3945_write_direct32(priv, reg, value) \
278 __iwl_write_direct32(__LINE__, priv, reg, value) 278 __iwl3945_write_direct32(__LINE__, priv, reg, value)
279#else 279#else
280#define iwl_write_direct32 _iwl_write_direct32 280#define iwl3945_write_direct32 _iwl3945_write_direct32
281#endif 281#endif
282 282
283static inline void iwl_write_reg_buf(struct iwl_priv *priv, 283static inline void iwl3945_write_reg_buf(struct iwl3945_priv *priv,
284 u32 reg, u32 len, u32 *values) 284 u32 reg, u32 len, u32 *values)
285{ 285{
286 u32 count = sizeof(u32); 286 u32 count = sizeof(u32);
287 287
288 if ((priv != NULL) && (values != NULL)) { 288 if ((priv != NULL) && (values != NULL)) {
289 for (; 0 < len; len -= count, reg += count, values++) 289 for (; 0 < len; len -= count, reg += count, values++)
290 _iwl_write_direct32(priv, reg, *values); 290 _iwl3945_write_direct32(priv, reg, *values);
291 } 291 }
292} 292}
293 293
294static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, 294static inline int _iwl3945_poll_direct_bit(struct iwl3945_priv *priv,
295 u32 addr, u32 mask, int timeout) 295 u32 addr, u32 mask, int timeout)
296{ 296{
297 int i = 0; 297 int i = 0;
298 298
299 do { 299 do {
300 if ((_iwl_read_direct32(priv, addr) & mask) == mask) 300 if ((_iwl3945_read_direct32(priv, addr) & mask) == mask)
301 return i; 301 return i;
302 mdelay(10); 302 mdelay(10);
303 i += 10; 303 i += 10;
@@ -307,11 +307,11 @@ static inline int _iwl_poll_direct_bit(struct iwl_priv *priv,
307} 307}
308 308
309#ifdef CONFIG_IWL3945_DEBUG 309#ifdef CONFIG_IWL3945_DEBUG
310static inline int __iwl_poll_direct_bit(const char *f, u32 l, 310static inline int __iwl3945_poll_direct_bit(const char *f, u32 l,
311 struct iwl_priv *priv, 311 struct iwl3945_priv *priv,
312 u32 addr, u32 mask, int timeout) 312 u32 addr, u32 mask, int timeout)
313{ 313{
314 int ret = _iwl_poll_direct_bit(priv, addr, mask, timeout); 314 int ret = _iwl3945_poll_direct_bit(priv, addr, mask, timeout);
315 315
316 if (unlikely(ret == -ETIMEDOUT)) 316 if (unlikely(ret == -ETIMEDOUT))
317 IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) - " 317 IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) - "
@@ -321,111 +321,111 @@ static inline int __iwl_poll_direct_bit(const char *f, u32 l,
321 "- %s %d\n", addr, mask, ret, f, l); 321 "- %s %d\n", addr, mask, ret, f, l);
322 return ret; 322 return ret;
323} 323}
324#define iwl_poll_direct_bit(iwl, addr, mask, timeout) \ 324#define iwl3945_poll_direct_bit(iwl, addr, mask, timeout) \
325 __iwl_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout) 325 __iwl3945_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout)
326#else 326#else
327#define iwl_poll_direct_bit _iwl_poll_direct_bit 327#define iwl3945_poll_direct_bit _iwl3945_poll_direct_bit
328#endif 328#endif
329 329
330static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) 330static inline u32 _iwl3945_read_prph(struct iwl3945_priv *priv, u32 reg)
331{ 331{
332 _iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); 332 _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
333 return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT); 333 return _iwl3945_read_direct32(priv, HBUS_TARG_PRPH_RDAT);
334} 334}
335#ifdef CONFIG_IWL3945_DEBUG 335#ifdef CONFIG_IWL3945_DEBUG
336static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg) 336static inline u32 __iwl3945_read_prph(u32 line, struct iwl3945_priv *priv, u32 reg)
337{ 337{
338 if (!atomic_read(&priv->restrict_refcnt)) 338 if (!atomic_read(&priv->restrict_refcnt))
339 IWL_ERROR("Nic access not held from line %d\n", line); 339 IWL_ERROR("Nic access not held from line %d\n", line);
340 return _iwl_read_prph(priv, reg); 340 return _iwl3945_read_prph(priv, reg);
341} 341}
342 342
343#define iwl_read_prph(priv, reg) \ 343#define iwl3945_read_prph(priv, reg) \
344 __iwl_read_prph(__LINE__, priv, reg) 344 __iwl3945_read_prph(__LINE__, priv, reg)
345#else 345#else
346#define iwl_read_prph _iwl_read_prph 346#define iwl3945_read_prph _iwl3945_read_prph
347#endif 347#endif
348 348
349static inline void _iwl_write_prph(struct iwl_priv *priv, 349static inline void _iwl3945_write_prph(struct iwl3945_priv *priv,
350 u32 addr, u32 val) 350 u32 addr, u32 val)
351{ 351{
352 _iwl_write_direct32(priv, HBUS_TARG_PRPH_WADDR, 352 _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WADDR,
353 ((addr & 0x0000FFFF) | (3 << 24))); 353 ((addr & 0x0000FFFF) | (3 << 24)));
354 _iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); 354 _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val);
355} 355}
356#ifdef CONFIG_IWL3945_DEBUG 356#ifdef CONFIG_IWL3945_DEBUG
357static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv, 357static inline void __iwl3945_write_prph(u32 line, struct iwl3945_priv *priv,
358 u32 addr, u32 val) 358 u32 addr, u32 val)
359{ 359{
360 if (!atomic_read(&priv->restrict_refcnt)) 360 if (!atomic_read(&priv->restrict_refcnt))
361 IWL_ERROR("Nic access from line %d\n", line); 361 IWL_ERROR("Nic access from line %d\n", line);
362 _iwl_write_prph(priv, addr, val); 362 _iwl3945_write_prph(priv, addr, val);
363} 363}
364 364
365#define iwl_write_prph(priv, addr, val) \ 365#define iwl3945_write_prph(priv, addr, val) \
366 __iwl_write_prph(__LINE__, priv, addr, val); 366 __iwl3945_write_prph(__LINE__, priv, addr, val);
367#else 367#else
368#define iwl_write_prph _iwl_write_prph 368#define iwl3945_write_prph _iwl3945_write_prph
369#endif 369#endif
370 370
371#define _iwl_set_bits_prph(priv, reg, mask) \ 371#define _iwl3945_set_bits_prph(priv, reg, mask) \
372 _iwl_write_prph(priv, reg, (_iwl_read_prph(priv, reg) | mask)) 372 _iwl3945_write_prph(priv, reg, (_iwl3945_read_prph(priv, reg) | mask))
373#ifdef CONFIG_IWL3945_DEBUG 373#ifdef CONFIG_IWL3945_DEBUG
374static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv, 374static inline void __iwl3945_set_bits_prph(u32 line, struct iwl3945_priv *priv,
375 u32 reg, u32 mask) 375 u32 reg, u32 mask)
376{ 376{
377 if (!atomic_read(&priv->restrict_refcnt)) 377 if (!atomic_read(&priv->restrict_refcnt))
378 IWL_ERROR("Nic access not held from line %d\n", line); 378 IWL_ERROR("Nic access not held from line %d\n", line);
379 379
380 _iwl_set_bits_prph(priv, reg, mask); 380 _iwl3945_set_bits_prph(priv, reg, mask);
381} 381}
382#define iwl_set_bits_prph(priv, reg, mask) \ 382#define iwl3945_set_bits_prph(priv, reg, mask) \
383 __iwl_set_bits_prph(__LINE__, priv, reg, mask) 383 __iwl3945_set_bits_prph(__LINE__, priv, reg, mask)
384#else 384#else
385#define iwl_set_bits_prph _iwl_set_bits_prph 385#define iwl3945_set_bits_prph _iwl3945_set_bits_prph
386#endif 386#endif
387 387
388#define _iwl_set_bits_mask_prph(priv, reg, bits, mask) \ 388#define _iwl3945_set_bits_mask_prph(priv, reg, bits, mask) \
389 _iwl_write_prph(priv, reg, ((_iwl_read_prph(priv, reg) & mask) | bits)) 389 _iwl3945_write_prph(priv, reg, ((_iwl3945_read_prph(priv, reg) & mask) | bits))
390 390
391#ifdef CONFIG_IWL3945_DEBUG 391#ifdef CONFIG_IWL3945_DEBUG
392static inline void __iwl_set_bits_mask_prph(u32 line, 392static inline void __iwl3945_set_bits_mask_prph(u32 line,
393 struct iwl_priv *priv, u32 reg, u32 bits, u32 mask) 393 struct iwl3945_priv *priv, u32 reg, u32 bits, u32 mask)
394{ 394{
395 if (!atomic_read(&priv->restrict_refcnt)) 395 if (!atomic_read(&priv->restrict_refcnt))
396 IWL_ERROR("Nic access not held from line %d\n", line); 396 IWL_ERROR("Nic access not held from line %d\n", line);
397 _iwl_set_bits_mask_prph(priv, reg, bits, mask); 397 _iwl3945_set_bits_mask_prph(priv, reg, bits, mask);
398} 398}
399#define iwl_set_bits_mask_prph(priv, reg, bits, mask) \ 399#define iwl3945_set_bits_mask_prph(priv, reg, bits, mask) \
400 __iwl_set_bits_mask_prph(__LINE__, priv, reg, bits, mask) 400 __iwl3945_set_bits_mask_prph(__LINE__, priv, reg, bits, mask)
401#else 401#else
402#define iwl_set_bits_mask_prph _iwl_set_bits_mask_prph 402#define iwl3945_set_bits_mask_prph _iwl3945_set_bits_mask_prph
403#endif 403#endif
404 404
405static inline void iwl_clear_bits_prph(struct iwl_priv 405static inline void iwl3945_clear_bits_prph(struct iwl3945_priv
406 *priv, u32 reg, u32 mask) 406 *priv, u32 reg, u32 mask)
407{ 407{
408 u32 val = _iwl_read_prph(priv, reg); 408 u32 val = _iwl3945_read_prph(priv, reg);
409 _iwl_write_prph(priv, reg, (val & ~mask)); 409 _iwl3945_write_prph(priv, reg, (val & ~mask));
410} 410}
411 411
412static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr) 412static inline u32 iwl3945_read_targ_mem(struct iwl3945_priv *priv, u32 addr)
413{ 413{
414 iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); 414 iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr);
415 return iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); 415 return iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT);
416} 416}
417 417
418static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val) 418static inline void iwl3945_write_targ_mem(struct iwl3945_priv *priv, u32 addr, u32 val)
419{ 419{
420 iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); 420 iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
421 iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); 421 iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, val);
422} 422}
423 423
424static inline void iwl_write_targ_mem_buf(struct iwl_priv *priv, u32 addr, 424static inline void iwl3945_write_targ_mem_buf(struct iwl3945_priv *priv, u32 addr,
425 u32 len, u32 *values) 425 u32 len, u32 *values)
426{ 426{
427 iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); 427 iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
428 for (; 0 < len; len -= sizeof(u32), values++) 428 for (; 0 < len; len -= sizeof(u32), values++)
429 iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); 429 iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values);
430} 430}
431#endif 431#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index e3a507513e8b..3e812743f6ad 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -43,7 +43,7 @@
43 43
44#define RS_NAME "iwl-3945-rs" 44#define RS_NAME "iwl-3945-rs"
45 45
46struct iwl_rate_scale_data { 46struct iwl3945_rate_scale_data {
47 u64 data; 47 u64 data;
48 s32 success_counter; 48 s32 success_counter;
49 s32 success_ratio; 49 s32 success_ratio;
@@ -52,7 +52,7 @@ struct iwl_rate_scale_data {
52 unsigned long stamp; 52 unsigned long stamp;
53}; 53};
54 54
55struct iwl_rate_scale_priv { 55struct iwl3945_rate_scale_priv {
56 spinlock_t lock; 56 spinlock_t lock;
57 s32 *expected_tpt; 57 s32 *expected_tpt;
58 unsigned long last_partial_flush; 58 unsigned long last_partial_flush;
@@ -65,31 +65,31 @@ struct iwl_rate_scale_priv {
65 u8 start_rate; 65 u8 start_rate;
66 u8 ibss_sta_added; 66 u8 ibss_sta_added;
67 struct timer_list rate_scale_flush; 67 struct timer_list rate_scale_flush;
68 struct iwl_rate_scale_data win[IWL_RATE_COUNT]; 68 struct iwl3945_rate_scale_data win[IWL_RATE_COUNT];
69}; 69};
70 70
71static s32 iwl_expected_tpt_g[IWL_RATE_COUNT] = { 71static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT] = {
72 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202 72 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202
73}; 73};
74 74
75static s32 iwl_expected_tpt_g_prot[IWL_RATE_COUNT] = { 75static s32 iwl3945_expected_tpt_g_prot[IWL_RATE_COUNT] = {
76 7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125 76 7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125
77}; 77};
78 78
79static s32 iwl_expected_tpt_a[IWL_RATE_COUNT] = { 79static s32 iwl3945_expected_tpt_a[IWL_RATE_COUNT] = {
80 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186 80 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186
81}; 81};
82 82
83static s32 iwl_expected_tpt_b[IWL_RATE_COUNT] = { 83static s32 iwl3945_expected_tpt_b[IWL_RATE_COUNT] = {
84 7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0 84 7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0
85}; 85};
86 86
87struct iwl_tpt_entry { 87struct iwl3945_tpt_entry {
88 s8 min_rssi; 88 s8 min_rssi;
89 u8 index; 89 u8 index;
90}; 90};
91 91
92static struct iwl_tpt_entry iwl_tpt_table_a[] = { 92static struct iwl3945_tpt_entry iwl3945_tpt_table_a[] = {
93 {-60, IWL_RATE_54M_INDEX}, 93 {-60, IWL_RATE_54M_INDEX},
94 {-64, IWL_RATE_48M_INDEX}, 94 {-64, IWL_RATE_48M_INDEX},
95 {-72, IWL_RATE_36M_INDEX}, 95 {-72, IWL_RATE_36M_INDEX},
@@ -100,7 +100,7 @@ static struct iwl_tpt_entry iwl_tpt_table_a[] = {
100 {-89, IWL_RATE_6M_INDEX} 100 {-89, IWL_RATE_6M_INDEX}
101}; 101};
102 102
103static struct iwl_tpt_entry iwl_tpt_table_b[] = { 103static struct iwl3945_tpt_entry iwl3945_tpt_table_b[] = {
104 {-86, IWL_RATE_11M_INDEX}, 104 {-86, IWL_RATE_11M_INDEX},
105 {-88, IWL_RATE_5M_INDEX}, 105 {-88, IWL_RATE_5M_INDEX},
106 {-90, IWL_RATE_2M_INDEX}, 106 {-90, IWL_RATE_2M_INDEX},
@@ -108,7 +108,7 @@ static struct iwl_tpt_entry iwl_tpt_table_b[] = {
108 108
109}; 109};
110 110
111static struct iwl_tpt_entry iwl_tpt_table_g[] = { 111static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = {
112 {-60, IWL_RATE_54M_INDEX}, 112 {-60, IWL_RATE_54M_INDEX},
113 {-64, IWL_RATE_48M_INDEX}, 113 {-64, IWL_RATE_48M_INDEX},
114 {-68, IWL_RATE_36M_INDEX}, 114 {-68, IWL_RATE_36M_INDEX},
@@ -129,30 +129,30 @@ static struct iwl_tpt_entry iwl_tpt_table_g[] = {
129#define IWL_RATE_MIN_SUCCESS_TH 8 129#define IWL_RATE_MIN_SUCCESS_TH 8
130#define IWL_RATE_DECREASE_TH 1920 130#define IWL_RATE_DECREASE_TH 1920
131 131
132static u8 iwl_get_rate_index_by_rssi(s32 rssi, u8 mode) 132static u8 iwl3945_get_rate_index_by_rssi(s32 rssi, u8 mode)
133{ 133{
134 u32 index = 0; 134 u32 index = 0;
135 u32 table_size = 0; 135 u32 table_size = 0;
136 struct iwl_tpt_entry *tpt_table = NULL; 136 struct iwl3945_tpt_entry *tpt_table = NULL;
137 137
138 if ((rssi < IWL_MIN_RSSI_VAL) || (rssi > IWL_MAX_RSSI_VAL)) 138 if ((rssi < IWL_MIN_RSSI_VAL) || (rssi > IWL_MAX_RSSI_VAL))
139 rssi = IWL_MIN_RSSI_VAL; 139 rssi = IWL_MIN_RSSI_VAL;
140 140
141 switch (mode) { 141 switch (mode) {
142 case MODE_IEEE80211G: 142 case MODE_IEEE80211G:
143 tpt_table = iwl_tpt_table_g; 143 tpt_table = iwl3945_tpt_table_g;
144 table_size = ARRAY_SIZE(iwl_tpt_table_g); 144 table_size = ARRAY_SIZE(iwl3945_tpt_table_g);
145 break; 145 break;
146 146
147 case MODE_IEEE80211A: 147 case MODE_IEEE80211A:
148 tpt_table = iwl_tpt_table_a; 148 tpt_table = iwl3945_tpt_table_a;
149 table_size = ARRAY_SIZE(iwl_tpt_table_a); 149 table_size = ARRAY_SIZE(iwl3945_tpt_table_a);
150 break; 150 break;
151 151
152 default: 152 default:
153 case MODE_IEEE80211B: 153 case MODE_IEEE80211B:
154 tpt_table = iwl_tpt_table_b; 154 tpt_table = iwl3945_tpt_table_b;
155 table_size = ARRAY_SIZE(iwl_tpt_table_b); 155 table_size = ARRAY_SIZE(iwl3945_tpt_table_b);
156 break; 156 break;
157 } 157 }
158 158
@@ -164,7 +164,7 @@ static u8 iwl_get_rate_index_by_rssi(s32 rssi, u8 mode)
164 return tpt_table[index].index; 164 return tpt_table[index].index;
165} 165}
166 166
167static void iwl_clear_window(struct iwl_rate_scale_data *window) 167static void iwl3945_clear_window(struct iwl3945_rate_scale_data *window)
168{ 168{
169 window->data = 0; 169 window->data = 0;
170 window->success_counter = 0; 170 window->success_counter = 0;
@@ -175,13 +175,13 @@ static void iwl_clear_window(struct iwl_rate_scale_data *window)
175} 175}
176 176
177/** 177/**
178 * iwl_rate_scale_flush_windows - flush out the rate scale windows 178 * iwl3945_rate_scale_flush_windows - flush out the rate scale windows
179 * 179 *
180 * Returns the number of windows that have gathered data but were 180 * Returns the number of windows that have gathered data but were
181 * not flushed. If there were any that were not flushed, then 181 * not flushed. If there were any that were not flushed, then
182 * reschedule the rate flushing routine. 182 * reschedule the rate flushing routine.
183 */ 183 */
184static int iwl_rate_scale_flush_windows(struct iwl_rate_scale_priv *rs_priv) 184static int iwl3945_rate_scale_flush_windows(struct iwl3945_rate_scale_priv *rs_priv)
185{ 185{
186 int unflushed = 0; 186 int unflushed = 0;
187 int i; 187 int i;
@@ -202,7 +202,7 @@ static int iwl_rate_scale_flush_windows(struct iwl_rate_scale_priv *rs_priv)
202 IWL_DEBUG_RATE("flushing %d samples of rate " 202 IWL_DEBUG_RATE("flushing %d samples of rate "
203 "index %d\n", 203 "index %d\n",
204 rs_priv->win[i].counter, i); 204 rs_priv->win[i].counter, i);
205 iwl_clear_window(&rs_priv->win[i]); 205 iwl3945_clear_window(&rs_priv->win[i]);
206 } else 206 } else
207 unflushed++; 207 unflushed++;
208 spin_unlock_irqrestore(&rs_priv->lock, flags); 208 spin_unlock_irqrestore(&rs_priv->lock, flags);
@@ -214,16 +214,16 @@ static int iwl_rate_scale_flush_windows(struct iwl_rate_scale_priv *rs_priv)
214#define IWL_RATE_FLUSH_MAX 5000 /* msec */ 214#define IWL_RATE_FLUSH_MAX 5000 /* msec */
215#define IWL_RATE_FLUSH_MIN 50 /* msec */ 215#define IWL_RATE_FLUSH_MIN 50 /* msec */
216 216
217static void iwl_bg_rate_scale_flush(unsigned long data) 217static void iwl3945_bg_rate_scale_flush(unsigned long data)
218{ 218{
219 struct iwl_rate_scale_priv *rs_priv = (void *)data; 219 struct iwl3945_rate_scale_priv *rs_priv = (void *)data;
220 int unflushed = 0; 220 int unflushed = 0;
221 unsigned long flags; 221 unsigned long flags;
222 u32 packet_count, duration, pps; 222 u32 packet_count, duration, pps;
223 223
224 IWL_DEBUG_RATE("enter\n"); 224 IWL_DEBUG_RATE("enter\n");
225 225
226 unflushed = iwl_rate_scale_flush_windows(rs_priv); 226 unflushed = iwl3945_rate_scale_flush_windows(rs_priv);
227 227
228 spin_lock_irqsave(&rs_priv->lock, flags); 228 spin_lock_irqsave(&rs_priv->lock, flags);
229 229
@@ -277,14 +277,14 @@ static void iwl_bg_rate_scale_flush(unsigned long data)
277} 277}
278 278
279/** 279/**
280 * iwl_collect_tx_data - Update the success/failure sliding window 280 * iwl3945_collect_tx_data - Update the success/failure sliding window
281 * 281 *
282 * We keep a sliding window of the last 64 packets transmitted 282 * We keep a sliding window of the last 64 packets transmitted
283 * at this rate. window->data contains the bitmask of successful 283 * at this rate. window->data contains the bitmask of successful
284 * packets. 284 * packets.
285 */ 285 */
286static void iwl_collect_tx_data(struct iwl_rate_scale_priv *rs_priv, 286static void iwl3945_collect_tx_data(struct iwl3945_rate_scale_priv *rs_priv,
287 struct iwl_rate_scale_data *window, 287 struct iwl3945_rate_scale_data *window,
288 int success, int retries) 288 int success, int retries)
289{ 289{
290 unsigned long flags; 290 unsigned long flags;
@@ -373,12 +373,12 @@ static void rs_clear(void *priv)
373 373
374static void *rs_alloc_sta(void *priv, gfp_t gfp) 374static void *rs_alloc_sta(void *priv, gfp_t gfp)
375{ 375{
376 struct iwl_rate_scale_priv *rs_priv; 376 struct iwl3945_rate_scale_priv *rs_priv;
377 int i; 377 int i;
378 378
379 IWL_DEBUG_RATE("enter\n"); 379 IWL_DEBUG_RATE("enter\n");
380 380
381 rs_priv = kzalloc(sizeof(struct iwl_rate_scale_priv), gfp); 381 rs_priv = kzalloc(sizeof(struct iwl3945_rate_scale_priv), gfp);
382 if (!rs_priv) { 382 if (!rs_priv) {
383 IWL_DEBUG_RATE("leave: ENOMEM\n"); 383 IWL_DEBUG_RATE("leave: ENOMEM\n");
384 return NULL; 384 return NULL;
@@ -389,7 +389,7 @@ static void *rs_alloc_sta(void *priv, gfp_t gfp)
389 rs_priv->start_rate = IWL_RATE_INVALID; 389 rs_priv->start_rate = IWL_RATE_INVALID;
390 390
391 /* default to just 802.11b */ 391 /* default to just 802.11b */
392 rs_priv->expected_tpt = iwl_expected_tpt_b; 392 rs_priv->expected_tpt = iwl3945_expected_tpt_b;
393 393
394 rs_priv->last_partial_flush = jiffies; 394 rs_priv->last_partial_flush = jiffies;
395 rs_priv->last_flush = jiffies; 395 rs_priv->last_flush = jiffies;
@@ -399,10 +399,10 @@ static void *rs_alloc_sta(void *priv, gfp_t gfp)
399 399
400 init_timer(&rs_priv->rate_scale_flush); 400 init_timer(&rs_priv->rate_scale_flush);
401 rs_priv->rate_scale_flush.data = (unsigned long)rs_priv; 401 rs_priv->rate_scale_flush.data = (unsigned long)rs_priv;
402 rs_priv->rate_scale_flush.function = &iwl_bg_rate_scale_flush; 402 rs_priv->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush;
403 403
404 for (i = 0; i < IWL_RATE_COUNT; i++) 404 for (i = 0; i < IWL_RATE_COUNT; i++)
405 iwl_clear_window(&rs_priv->win[i]); 405 iwl3945_clear_window(&rs_priv->win[i]);
406 406
407 IWL_DEBUG_RATE("leave\n"); 407 IWL_DEBUG_RATE("leave\n");
408 408
@@ -411,7 +411,7 @@ static void *rs_alloc_sta(void *priv, gfp_t gfp)
411 411
412static void rs_free_sta(void *priv, void *priv_sta) 412static void rs_free_sta(void *priv, void *priv_sta)
413{ 413{
414 struct iwl_rate_scale_priv *rs_priv = priv_sta; 414 struct iwl3945_rate_scale_priv *rs_priv = priv_sta;
415 415
416 IWL_DEBUG_RATE("enter\n"); 416 IWL_DEBUG_RATE("enter\n");
417 del_timer_sync(&rs_priv->rate_scale_flush); 417 del_timer_sync(&rs_priv->rate_scale_flush);
@@ -425,9 +425,9 @@ static void rs_free_sta(void *priv, void *priv_sta)
425 * for A and B mode we need to overright prev 425 * for A and B mode we need to overright prev
426 * value 426 * value
427 */ 427 */
428static int rs_adjust_next_rate(struct iwl_priv *priv, int rate) 428static int rs_adjust_next_rate(struct iwl3945_priv *priv, int rate)
429{ 429{
430 int next_rate = iwl_get_prev_ieee_rate(rate); 430 int next_rate = iwl3945_get_prev_ieee_rate(rate);
431 431
432 switch (priv->phymode) { 432 switch (priv->phymode) {
433 case MODE_IEEE80211A: 433 case MODE_IEEE80211A:
@@ -449,7 +449,7 @@ static int rs_adjust_next_rate(struct iwl_priv *priv, int rate)
449/** 449/**
450 * rs_tx_status - Update rate control values based on Tx results 450 * rs_tx_status - Update rate control values based on Tx results
451 * 451 *
452 * NOTE: Uses iwl_priv->retry_rate for the # of retries attempted by 452 * NOTE: Uses iwl3945_priv->retry_rate for the # of retries attempted by
453 * the hardware for each rate. 453 * the hardware for each rate.
454 */ 454 */
455static void rs_tx_status(void *priv_rate, 455static void rs_tx_status(void *priv_rate,
@@ -462,9 +462,9 @@ static void rs_tx_status(void *priv_rate,
462 unsigned long flags; 462 unsigned long flags;
463 struct sta_info *sta; 463 struct sta_info *sta;
464 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 464 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
465 struct iwl_priv *priv = (struct iwl_priv *)priv_rate; 465 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate;
466 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 466 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
467 struct iwl_rate_scale_priv *rs_priv; 467 struct iwl3945_rate_scale_priv *rs_priv;
468 468
469 IWL_DEBUG_RATE("enter\n"); 469 IWL_DEBUG_RATE("enter\n");
470 470
@@ -514,7 +514,7 @@ static void rs_tx_status(void *priv_rate,
514 514
515 /* Update this rate accounting for as many retries 515 /* Update this rate accounting for as many retries
516 * as was used for it (per current_count) */ 516 * as was used for it (per current_count) */
517 iwl_collect_tx_data(rs_priv, 517 iwl3945_collect_tx_data(rs_priv,
518 &rs_priv->win[scale_rate_index], 518 &rs_priv->win[scale_rate_index],
519 0, current_count); 519 0, current_count);
520 IWL_DEBUG_RATE("Update rate %d for %d retries.\n", 520 IWL_DEBUG_RATE("Update rate %d for %d retries.\n",
@@ -533,7 +533,7 @@ static void rs_tx_status(void *priv_rate,
533 last_index, 533 last_index,
534 (tx_resp->flags & IEEE80211_TX_STATUS_ACK) ? 534 (tx_resp->flags & IEEE80211_TX_STATUS_ACK) ?
535 "success" : "failure"); 535 "success" : "failure");
536 iwl_collect_tx_data(rs_priv, 536 iwl3945_collect_tx_data(rs_priv,
537 &rs_priv->win[last_index], 537 &rs_priv->win[last_index],
538 tx_resp->flags & IEEE80211_TX_STATUS_ACK, 1); 538 tx_resp->flags & IEEE80211_TX_STATUS_ACK, 1);
539 539
@@ -560,8 +560,8 @@ static void rs_tx_status(void *priv_rate,
560 return; 560 return;
561} 561}
562 562
563static u16 iwl_get_adjacent_rate(struct iwl_rate_scale_priv *rs_priv, 563static u16 iwl3945_get_adjacent_rate(struct iwl3945_rate_scale_priv *rs_priv,
564 u8 index, u16 rate_mask, int phymode) 564 u8 index, u16 rate_mask, int phymode)
565{ 565{
566 u8 high = IWL_RATE_INVALID; 566 u8 high = IWL_RATE_INVALID;
567 u8 low = IWL_RATE_INVALID; 567 u8 low = IWL_RATE_INVALID;
@@ -596,9 +596,9 @@ static u16 iwl_get_adjacent_rate(struct iwl_rate_scale_priv *rs_priv,
596 low = index; 596 low = index;
597 while (low != IWL_RATE_INVALID) { 597 while (low != IWL_RATE_INVALID) {
598 if (rs_priv->tgg) 598 if (rs_priv->tgg)
599 low = iwl_rates[low].prev_rs_tgg; 599 low = iwl3945_rates[low].prev_rs_tgg;
600 else 600 else
601 low = iwl_rates[low].prev_rs; 601 low = iwl3945_rates[low].prev_rs;
602 if (low == IWL_RATE_INVALID) 602 if (low == IWL_RATE_INVALID)
603 break; 603 break;
604 if (rate_mask & (1 << low)) 604 if (rate_mask & (1 << low))
@@ -609,9 +609,9 @@ static u16 iwl_get_adjacent_rate(struct iwl_rate_scale_priv *rs_priv,
609 high = index; 609 high = index;
610 while (high != IWL_RATE_INVALID) { 610 while (high != IWL_RATE_INVALID) {
611 if (rs_priv->tgg) 611 if (rs_priv->tgg)
612 high = iwl_rates[high].next_rs_tgg; 612 high = iwl3945_rates[high].next_rs_tgg;
613 else 613 else
614 high = iwl_rates[high].next_rs; 614 high = iwl3945_rates[high].next_rs;
615 if (high == IWL_RATE_INVALID) 615 if (high == IWL_RATE_INVALID)
616 break; 616 break;
617 if (rate_mask & (1 << high)) 617 if (rate_mask & (1 << high))
@@ -646,8 +646,8 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
646 u8 high = IWL_RATE_INVALID; 646 u8 high = IWL_RATE_INVALID;
647 u16 high_low; 647 u16 high_low;
648 int index; 648 int index;
649 struct iwl_rate_scale_priv *rs_priv; 649 struct iwl3945_rate_scale_priv *rs_priv;
650 struct iwl_rate_scale_data *window = NULL; 650 struct iwl3945_rate_scale_data *window = NULL;
651 int current_tpt = IWL_INVALID_VALUE; 651 int current_tpt = IWL_INVALID_VALUE;
652 int low_tpt = IWL_INVALID_VALUE; 652 int low_tpt = IWL_INVALID_VALUE;
653 int high_tpt = IWL_INVALID_VALUE; 653 int high_tpt = IWL_INVALID_VALUE;
@@ -658,7 +658,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
658 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 658 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
659 struct sta_info *sta; 659 struct sta_info *sta;
660 u16 rate_mask; 660 u16 rate_mask;
661 struct iwl_priv *priv = (struct iwl_priv *)priv_rate; 661 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate;
662 DECLARE_MAC_BUF(mac); 662 DECLARE_MAC_BUF(mac);
663 663
664 IWL_DEBUG_RATE("enter\n"); 664 IWL_DEBUG_RATE("enter\n");
@@ -682,12 +682,12 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
682 682
683 if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && 683 if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) &&
684 !rs_priv->ibss_sta_added) { 684 !rs_priv->ibss_sta_added) {
685 u8 sta_id = iwl_hw_find_station(priv, hdr->addr1); 685 u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1);
686 686
687 if (sta_id == IWL_INVALID_STATION) { 687 if (sta_id == IWL_INVALID_STATION) {
688 IWL_DEBUG_RATE("LQ: ADD station %s\n", 688 IWL_DEBUG_RATE("LQ: ADD station %s\n",
689 print_mac(mac, hdr->addr1)); 689 print_mac(mac, hdr->addr1));
690 sta_id = iwl_add_station(priv, 690 sta_id = iwl3945_add_station(priv,
691 hdr->addr1, 0, CMD_ASYNC); 691 hdr->addr1, 0, CMD_ASYNC);
692 } 692 }
693 if (sta_id != IWL_INVALID_STATION) 693 if (sta_id != IWL_INVALID_STATION)
@@ -725,7 +725,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
725 rs_priv->expected_tpt[index] + 64) / 128); 725 rs_priv->expected_tpt[index] + 64) / 128);
726 current_tpt = window->average_tpt; 726 current_tpt = window->average_tpt;
727 727
728 high_low = iwl_get_adjacent_rate(rs_priv, index, rate_mask, 728 high_low = iwl3945_get_adjacent_rate(rs_priv, index, rate_mask,
729 local->hw.conf.phymode); 729 local->hw.conf.phymode);
730 low = high_low & 0xff; 730 low = high_low & 0xff;
731 high = (high_low >> 8) & 0xff; 731 high = (high_low >> 8) & 0xff;
@@ -830,11 +830,11 @@ static struct rate_control_ops rs_ops = {
830 .free_sta = rs_free_sta, 830 .free_sta = rs_free_sta,
831}; 831};
832 832
833int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) 833int iwl3945_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
834{ 834{
835 struct ieee80211_local *local = hw_to_local(hw); 835 struct ieee80211_local *local = hw_to_local(hw);
836 struct iwl_priv *priv = hw->priv; 836 struct iwl3945_priv *priv = hw->priv;
837 struct iwl_rate_scale_priv *rs_priv; 837 struct iwl3945_rate_scale_priv *rs_priv;
838 struct sta_info *sta; 838 struct sta_info *sta;
839 unsigned long flags; 839 unsigned long flags;
840 int count = 0, i; 840 int count = 0, i;
@@ -860,7 +860,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
860 int j; 860 int j;
861 861
862 count += 862 count +=
863 sprintf(&buf[count], " %2dMbs: ", iwl_rates[i].ieee / 2); 863 sprintf(&buf[count], " %2dMbs: ", iwl3945_rates[i].ieee / 2);
864 864
865 mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1)); 865 mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1));
866 for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1) 866 for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1)
@@ -869,7 +869,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
869 869
870 samples += rs_priv->win[i].counter; 870 samples += rs_priv->win[i].counter;
871 good += rs_priv->win[i].success_counter; 871 good += rs_priv->win[i].success_counter;
872 success += rs_priv->win[i].success_counter * iwl_rates[i].ieee; 872 success += rs_priv->win[i].success_counter * iwl3945_rates[i].ieee;
873 873
874 if (rs_priv->win[i].stamp) { 874 if (rs_priv->win[i].stamp) {
875 int delta = 875 int delta =
@@ -882,7 +882,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
882 } else 882 } else
883 buf[count++] = '\n'; 883 buf[count++] = '\n';
884 884
885 j = iwl_get_prev_ieee_rate(i); 885 j = iwl3945_get_prev_ieee_rate(i);
886 if (j == i) 886 if (j == i)
887 break; 887 break;
888 i = j; 888 i = j;
@@ -893,7 +893,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
893 /* Display the average rate of all samples taken. 893 /* Display the average rate of all samples taken.
894 * 894 *
895 * NOTE: We multiple # of samples by 2 since the IEEE measurement 895 * NOTE: We multiple # of samples by 2 since the IEEE measurement
896 * added from iwl_rates is actually 2X the rate */ 896 * added from iwl3945_rates is actually 2X the rate */
897 if (samples) 897 if (samples)
898 count += sprintf( 898 count += sprintf(
899 &buf[count], 899 &buf[count],
@@ -907,13 +907,13 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
907 return count; 907 return count;
908} 908}
909 909
910void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) 910void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
911{ 911{
912 struct iwl_priv *priv = hw->priv; 912 struct iwl3945_priv *priv = hw->priv;
913 s32 rssi = 0; 913 s32 rssi = 0;
914 unsigned long flags; 914 unsigned long flags;
915 struct ieee80211_local *local = hw_to_local(hw); 915 struct ieee80211_local *local = hw_to_local(hw);
916 struct iwl_rate_scale_priv *rs_priv; 916 struct iwl3945_rate_scale_priv *rs_priv;
917 struct sta_info *sta; 917 struct sta_info *sta;
918 918
919 IWL_DEBUG_RATE("enter\n"); 919 IWL_DEBUG_RATE("enter\n");
@@ -942,19 +942,19 @@ void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
942 case MODE_IEEE80211G: 942 case MODE_IEEE80211G:
943 if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) { 943 if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) {
944 rs_priv->tgg = 1; 944 rs_priv->tgg = 1;
945 rs_priv->expected_tpt = iwl_expected_tpt_g_prot; 945 rs_priv->expected_tpt = iwl3945_expected_tpt_g_prot;
946 } else 946 } else
947 rs_priv->expected_tpt = iwl_expected_tpt_g; 947 rs_priv->expected_tpt = iwl3945_expected_tpt_g;
948 break; 948 break;
949 949
950 case MODE_IEEE80211A: 950 case MODE_IEEE80211A:
951 rs_priv->expected_tpt = iwl_expected_tpt_a; 951 rs_priv->expected_tpt = iwl3945_expected_tpt_a;
952 break; 952 break;
953 953
954 default: 954 default:
955 IWL_WARNING("Invalid phymode. Defaulting to 802.11b\n"); 955 IWL_WARNING("Invalid phymode. Defaulting to 802.11b\n");
956 case MODE_IEEE80211B: 956 case MODE_IEEE80211B:
957 rs_priv->expected_tpt = iwl_expected_tpt_b; 957 rs_priv->expected_tpt = iwl3945_expected_tpt_b;
958 break; 958 break;
959 } 959 }
960 960
@@ -967,19 +967,19 @@ void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
967 967
968 IWL_DEBUG(IWL_DL_INFO | IWL_DL_RATE, "Network RSSI: %d\n", rssi); 968 IWL_DEBUG(IWL_DL_INFO | IWL_DL_RATE, "Network RSSI: %d\n", rssi);
969 969
970 rs_priv->start_rate = iwl_get_rate_index_by_rssi(rssi, priv->phymode); 970 rs_priv->start_rate = iwl3945_get_rate_index_by_rssi(rssi, priv->phymode);
971 971
972 IWL_DEBUG_RATE("leave: rssi %d assign rate index: " 972 IWL_DEBUG_RATE("leave: rssi %d assign rate index: "
973 "%d (plcp 0x%x)\n", rssi, rs_priv->start_rate, 973 "%d (plcp 0x%x)\n", rssi, rs_priv->start_rate,
974 iwl_rates[rs_priv->start_rate].plcp); 974 iwl3945_rates[rs_priv->start_rate].plcp);
975} 975}
976 976
977void iwl_rate_control_register(struct ieee80211_hw *hw) 977void iwl3945_rate_control_register(struct ieee80211_hw *hw)
978{ 978{
979 ieee80211_rate_control_register(&rs_ops); 979 ieee80211_rate_control_register(&rs_ops);
980} 980}
981 981
982void iwl_rate_control_unregister(struct ieee80211_hw *hw) 982void iwl3945_rate_control_unregister(struct ieee80211_hw *hw)
983{ 983{
984 ieee80211_rate_control_unregister(&rs_ops); 984 ieee80211_rate_control_unregister(&rs_ops);
985} 985}
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
index 4f21bc73fc39..075f7de0976e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
@@ -27,7 +27,7 @@
27#ifndef __iwl_3945_rs_h__ 27#ifndef __iwl_3945_rs_h__
28#define __iwl_3945_rs_h__ 28#define __iwl_3945_rs_h__
29 29
30struct iwl_rate_info { 30struct iwl3945_rate_info {
31 u8 plcp; 31 u8 plcp;
32 u8 ieee; 32 u8 ieee;
33 u8 prev_ieee; /* previous rate in IEEE speeds */ 33 u8 prev_ieee; /* previous rate in IEEE speeds */
@@ -159,11 +159,11 @@ enum {
159#define IWL_MIN_RSSI_VAL -100 159#define IWL_MIN_RSSI_VAL -100
160#define IWL_MAX_RSSI_VAL 0 160#define IWL_MAX_RSSI_VAL 0
161 161
162extern const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT]; 162extern const struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT];
163 163
164static inline u8 iwl_get_prev_ieee_rate(u8 rate_index) 164static inline u8 iwl3945_get_prev_ieee_rate(u8 rate_index)
165{ 165{
166 u8 rate = iwl_rates[rate_index].prev_ieee; 166 u8 rate = iwl3945_rates[rate_index].prev_ieee;
167 167
168 if (rate == IWL_RATE_INVALID) 168 if (rate == IWL_RATE_INVALID)
169 rate = rate_index; 169 rate = rate_index;
@@ -171,40 +171,40 @@ static inline u8 iwl_get_prev_ieee_rate(u8 rate_index)
171} 171}
172 172
173/** 173/**
174 * iwl_fill_rs_info - Fill an output text buffer with the rate representation 174 * iwl3945_fill_rs_info - Fill an output text buffer with the rate representation
175 * 175 *
176 * NOTE: This is provided as a quick mechanism for a user to visualize 176 * NOTE: This is provided as a quick mechanism for a user to visualize
177 * the performance of the rate control algorithm and is not meant to be 177 * the performance of the rate control algorithm and is not meant to be
178 * parsed software. 178 * parsed software.
179 */ 179 */
180extern int iwl_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id); 180extern int iwl3945_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id);
181 181
182/** 182/**
183 * iwl_rate_scale_init - Initialize the rate scale table based on assoc info 183 * iwl3945_rate_scale_init - Initialize the rate scale table based on assoc info
184 * 184 *
185 * The specific throughput table used is based on the type of network 185 * The specific throughput table used is based on the type of network
186 * the associated with, including A, B, G, and G w/ TGG protection 186 * the associated with, including A, B, G, and G w/ TGG protection
187 */ 187 */
188extern void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); 188extern void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id);
189 189
190/** 190/**
191 * iwl_rate_control_register - Register the rate control algorithm callbacks 191 * iwl3945_rate_control_register - Register the rate control algorithm callbacks
192 * 192 *
193 * Since the rate control algorithm is hardware specific, there is no need 193 * Since the rate control algorithm is hardware specific, there is no need
194 * or reason to place it as a stand alone module. The driver can call 194 * or reason to place it as a stand alone module. The driver can call
195 * iwl_rate_control_register in order to register the rate control callbacks 195 * iwl3945_rate_control_register in order to register the rate control callbacks
196 * with the mac80211 subsystem. This should be performed prior to calling 196 * with the mac80211 subsystem. This should be performed prior to calling
197 * ieee80211_register_hw 197 * ieee80211_register_hw
198 * 198 *
199 */ 199 */
200extern void iwl_rate_control_register(struct ieee80211_hw *hw); 200extern void iwl3945_rate_control_register(struct ieee80211_hw *hw);
201 201
202/** 202/**
203 * iwl_rate_control_unregister - Unregister the rate control callbacks 203 * iwl3945_rate_control_unregister - Unregister the rate control callbacks
204 * 204 *
205 * This should be called after calling ieee80211_unregister_hw, but before 205 * This should be called after calling ieee80211_unregister_hw, but before
206 * the driver is unloaded. 206 * the driver is unloaded.
207 */ 207 */
208extern void iwl_rate_control_unregister(struct ieee80211_hw *hw); 208extern void iwl3945_rate_control_unregister(struct ieee80211_hw *hw);
209 209
210#endif 210#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 36867a18d5b4..953a9bec0639 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -63,7 +63,7 @@
63 * maps to IWL_RATE_INVALID 63 * maps to IWL_RATE_INVALID
64 * 64 *
65 */ 65 */
66const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = { 66const struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT] = {
67 IWL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */ 67 IWL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */
68 IWL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */ 68 IWL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */
69 IWL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */ 69 IWL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */
@@ -78,12 +78,12 @@ const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = {
78 IWL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */ 78 IWL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */
79}; 79};
80 80
81/* 1 = enable the iwl_disable_events() function */ 81/* 1 = enable the iwl3945_disable_events() function */
82#define IWL_EVT_DISABLE (0) 82#define IWL_EVT_DISABLE (0)
83#define IWL_EVT_DISABLE_SIZE (1532/32) 83#define IWL_EVT_DISABLE_SIZE (1532/32)
84 84
85/** 85/**
86 * iwl_disable_events - Disable selected events in uCode event log 86 * iwl3945_disable_events - Disable selected events in uCode event log
87 * 87 *
88 * Disable an event by writing "1"s into "disable" 88 * Disable an event by writing "1"s into "disable"
89 * bitmap in SRAM. Bit position corresponds to Event # (id/type). 89 * bitmap in SRAM. Bit position corresponds to Event # (id/type).
@@ -91,7 +91,7 @@ const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = {
91 * Use for only special debugging. This function is just a placeholder as-is, 91 * Use for only special debugging. This function is just a placeholder as-is,
92 * you'll need to provide the special bits! ... 92 * you'll need to provide the special bits! ...
93 * ... and set IWL_EVT_DISABLE to 1. */ 93 * ... and set IWL_EVT_DISABLE to 1. */
94void iwl_disable_events(struct iwl_priv *priv) 94void iwl3945_disable_events(struct iwl3945_priv *priv)
95{ 95{
96 int ret; 96 int ret;
97 int i; 97 int i;
@@ -149,31 +149,31 @@ void iwl_disable_events(struct iwl_priv *priv)
149 }; 149 };
150 150
151 base = le32_to_cpu(priv->card_alive.log_event_table_ptr); 151 base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
152 if (!iwl_hw_valid_rtc_data_addr(base)) { 152 if (!iwl3945_hw_valid_rtc_data_addr(base)) {
153 IWL_ERROR("Invalid event log pointer 0x%08X\n", base); 153 IWL_ERROR("Invalid event log pointer 0x%08X\n", base);
154 return; 154 return;
155 } 155 }
156 156
157 ret = iwl_grab_nic_access(priv); 157 ret = iwl3945_grab_nic_access(priv);
158 if (ret) { 158 if (ret) {
159 IWL_WARNING("Can not read from adapter at this time.\n"); 159 IWL_WARNING("Can not read from adapter at this time.\n");
160 return; 160 return;
161 } 161 }
162 162
163 disable_ptr = iwl_read_targ_mem(priv, base + (4 * sizeof(u32))); 163 disable_ptr = iwl3945_read_targ_mem(priv, base + (4 * sizeof(u32)));
164 array_size = iwl_read_targ_mem(priv, base + (5 * sizeof(u32))); 164 array_size = iwl3945_read_targ_mem(priv, base + (5 * sizeof(u32)));
165 iwl_release_nic_access(priv); 165 iwl3945_release_nic_access(priv);
166 166
167 if (IWL_EVT_DISABLE && (array_size == IWL_EVT_DISABLE_SIZE)) { 167 if (IWL_EVT_DISABLE && (array_size == IWL_EVT_DISABLE_SIZE)) {
168 IWL_DEBUG_INFO("Disabling selected uCode log events at 0x%x\n", 168 IWL_DEBUG_INFO("Disabling selected uCode log events at 0x%x\n",
169 disable_ptr); 169 disable_ptr);
170 ret = iwl_grab_nic_access(priv); 170 ret = iwl3945_grab_nic_access(priv);
171 for (i = 0; i < IWL_EVT_DISABLE_SIZE; i++) 171 for (i = 0; i < IWL_EVT_DISABLE_SIZE; i++)
172 iwl_write_targ_mem(priv, 172 iwl3945_write_targ_mem(priv,
173 disable_ptr + (i * sizeof(u32)), 173 disable_ptr + (i * sizeof(u32)),
174 evt_disable[i]); 174 evt_disable[i]);
175 175
176 iwl_release_nic_access(priv); 176 iwl3945_release_nic_access(priv);
177 } else { 177 } else {
178 IWL_DEBUG_INFO("Selected uCode log events may be disabled\n"); 178 IWL_DEBUG_INFO("Selected uCode log events may be disabled\n");
179 IWL_DEBUG_INFO(" by writing \"1\"s into disable bitmap\n"); 179 IWL_DEBUG_INFO(" by writing \"1\"s into disable bitmap\n");
@@ -194,7 +194,7 @@ void iwl_disable_events(struct iwl_priv *priv)
194 * IWL_ANTENNA_MAIN - Force MAIN antenna 194 * IWL_ANTENNA_MAIN - Force MAIN antenna
195 * IWL_ANTENNA_AUX - Force AUX antenna 195 * IWL_ANTENNA_AUX - Force AUX antenna
196 */ 196 */
197__le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv) 197__le32 iwl3945_get_antenna_flags(const struct iwl3945_priv *priv)
198{ 198{
199 switch (priv->antenna) { 199 switch (priv->antenna) {
200 case IWL_ANTENNA_DIVERSITY: 200 case IWL_ANTENNA_DIVERSITY:
@@ -226,11 +226,11 @@ __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv)
226 * 226 *
227 *****************************************************************************/ 227 *****************************************************************************/
228 228
229void iwl_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) 229void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb)
230{ 230{
231 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 231 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
232 IWL_DEBUG_RX("Statistics notification received (%d vs %d).\n", 232 IWL_DEBUG_RX("Statistics notification received (%d vs %d).\n",
233 (int)sizeof(struct iwl_notif_statistics), 233 (int)sizeof(struct iwl3945_notif_statistics),
234 le32_to_cpu(pkt->len)); 234 le32_to_cpu(pkt->len));
235 235
236 memcpy(&priv->statistics, pkt->u.raw, sizeof(priv->statistics)); 236 memcpy(&priv->statistics, pkt->u.raw, sizeof(priv->statistics));
@@ -238,15 +238,15 @@ void iwl_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
238 priv->last_statistics_time = jiffies; 238 priv->last_statistics_time = jiffies;
239} 239}
240 240
241static void iwl3945_handle_data_packet(struct iwl_priv *priv, int is_data, 241static void iwl3945_handle_data_packet(struct iwl3945_priv *priv, int is_data,
242 struct iwl_rx_mem_buffer *rxb, 242 struct iwl3945_rx_mem_buffer *rxb,
243 struct ieee80211_rx_status *stats, 243 struct ieee80211_rx_status *stats,
244 u16 phy_flags) 244 u16 phy_flags)
245{ 245{
246 struct ieee80211_hdr *hdr; 246 struct ieee80211_hdr *hdr;
247 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 247 struct iwl3945_rx_packet *pkt = (struct iwl3945_rx_packet *)rxb->skb->data;
248 struct iwl_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); 248 struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
249 struct iwl_rx_frame_end *rx_end = IWL_RX_END(pkt); 249 struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt);
250 short len = le16_to_cpu(rx_hdr->len); 250 short len = le16_to_cpu(rx_hdr->len);
251 251
252 /* We received data from the HW, so stop the watchdog */ 252 /* We received data from the HW, so stop the watchdog */
@@ -262,11 +262,11 @@ static void iwl3945_handle_data_packet(struct iwl_priv *priv, int is_data,
262 return; 262 return;
263 } 263 }
264 if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { 264 if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) {
265 if (iwl_param_hwcrypto) 265 if (iwl3945_param_hwcrypto)
266 iwl_set_decrypted_flag(priv, rxb->skb, 266 iwl3945_set_decrypted_flag(priv, rxb->skb,
267 le32_to_cpu(rx_end->status), 267 le32_to_cpu(rx_end->status),
268 stats); 268 stats);
269 iwl_handle_data_packet_monitor(priv, rxb, IWL_RX_DATA(pkt), 269 iwl3945_handle_data_packet_monitor(priv, rxb, IWL_RX_DATA(pkt),
270 len, stats, phy_flags); 270 len, stats, phy_flags);
271 return; 271 return;
272 } 272 }
@@ -277,21 +277,21 @@ static void iwl3945_handle_data_packet(struct iwl_priv *priv, int is_data,
277 277
278 hdr = (void *)rxb->skb->data; 278 hdr = (void *)rxb->skb->data;
279 279
280 if (iwl_param_hwcrypto) 280 if (iwl3945_param_hwcrypto)
281 iwl_set_decrypted_flag(priv, rxb->skb, 281 iwl3945_set_decrypted_flag(priv, rxb->skb,
282 le32_to_cpu(rx_end->status), stats); 282 le32_to_cpu(rx_end->status), stats);
283 283
284 ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats); 284 ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats);
285 rxb->skb = NULL; 285 rxb->skb = NULL;
286} 286}
287 287
288static void iwl3945_rx_reply_rx(struct iwl_priv *priv, 288static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
289 struct iwl_rx_mem_buffer *rxb) 289 struct iwl3945_rx_mem_buffer *rxb)
290{ 290{
291 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 291 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
292 struct iwl_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt); 292 struct iwl3945_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt);
293 struct iwl_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); 293 struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
294 struct iwl_rx_frame_end *rx_end = IWL_RX_END(pkt); 294 struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt);
295 struct ieee80211_hdr *header; 295 struct ieee80211_hdr *header;
296 u16 phy_flags = le16_to_cpu(rx_hdr->phy_flags); 296 u16 phy_flags = le16_to_cpu(rx_hdr->phy_flags);
297 u16 rx_stats_sig_avg = le16_to_cpu(rx_stats->sig_avg); 297 u16 rx_stats_sig_avg = le16_to_cpu(rx_stats->sig_avg);
@@ -347,14 +347,14 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
347 * Calculate stats.signal (quality indicator in %) based on SNR. */ 347 * Calculate stats.signal (quality indicator in %) based on SNR. */
348 if (rx_stats_noise_diff) { 348 if (rx_stats_noise_diff) {
349 snr = rx_stats_sig_avg / rx_stats_noise_diff; 349 snr = rx_stats_sig_avg / rx_stats_noise_diff;
350 stats.noise = stats.ssi - iwl_calc_db_from_ratio(snr); 350 stats.noise = stats.ssi - iwl3945_calc_db_from_ratio(snr);
351 stats.signal = iwl_calc_sig_qual(stats.ssi, stats.noise); 351 stats.signal = iwl3945_calc_sig_qual(stats.ssi, stats.noise);
352 352
353 /* If noise info not available, calculate signal quality indicator (%) 353 /* If noise info not available, calculate signal quality indicator (%)
354 * using just the dBm signal level. */ 354 * using just the dBm signal level. */
355 } else { 355 } else {
356 stats.noise = priv->last_rx_noise; 356 stats.noise = priv->last_rx_noise;
357 stats.signal = iwl_calc_sig_qual(stats.ssi, 0); 357 stats.signal = iwl3945_calc_sig_qual(stats.ssi, 0);
358 } 358 }
359 359
360 360
@@ -364,24 +364,24 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
364 364
365 stats.freq = ieee80211chan2mhz(stats.channel); 365 stats.freq = ieee80211chan2mhz(stats.channel);
366 366
367 /* can be covered by iwl_report_frame() in most cases */ 367 /* can be covered by iwl3945_report_frame() in most cases */
368/* IWL_DEBUG_RX("RX status: 0x%08X\n", rx_end->status); */ 368/* IWL_DEBUG_RX("RX status: 0x%08X\n", rx_end->status); */
369 369
370 header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); 370 header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt);
371 371
372 network_packet = iwl_is_network_packet(priv, header); 372 network_packet = iwl3945_is_network_packet(priv, header);
373 373
374#ifdef CONFIG_IWL3945_DEBUG 374#ifdef CONFIG_IWL3945_DEBUG
375 if (iwl_debug_level & IWL_DL_STATS && net_ratelimit()) 375 if (iwl3945_debug_level & IWL_DL_STATS && net_ratelimit())
376 IWL_DEBUG_STATS 376 IWL_DEBUG_STATS
377 ("[%c] %d RSSI: %d Signal: %u, Noise: %u, Rate: %u\n", 377 ("[%c] %d RSSI: %d Signal: %u, Noise: %u, Rate: %u\n",
378 network_packet ? '*' : ' ', 378 network_packet ? '*' : ' ',
379 stats.channel, stats.ssi, stats.ssi, 379 stats.channel, stats.ssi, stats.ssi,
380 stats.ssi, stats.rate); 380 stats.ssi, stats.rate);
381 381
382 if (iwl_debug_level & (IWL_DL_RX)) 382 if (iwl3945_debug_level & (IWL_DL_RX))
383 /* Set "1" to report good data frames in groups of 100 */ 383 /* Set "1" to report good data frames in groups of 100 */
384 iwl_report_frame(priv, pkt, header, 1); 384 iwl3945_report_frame(priv, pkt, header, 1);
385#endif 385#endif
386 386
387 if (network_packet) { 387 if (network_packet) {
@@ -481,7 +481,7 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
481 DECLARE_MAC_BUF(mac2); 481 DECLARE_MAC_BUF(mac2);
482 DECLARE_MAC_BUF(mac3); 482 DECLARE_MAC_BUF(mac3);
483 483
484 if (unlikely(is_duplicate_packet(priv, header))) 484 if (unlikely(iwl3945_is_duplicate_packet(priv, header)))
485 IWL_DEBUG_DROP("Dropping (dup): %s, %s, %s\n", 485 IWL_DEBUG_DROP("Dropping (dup): %s, %s, %s\n",
486 print_mac(mac1, header->addr1), 486 print_mac(mac1, header->addr1),
487 print_mac(mac2, header->addr2), 487 print_mac(mac2, header->addr2),
@@ -494,12 +494,12 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
494 } 494 }
495} 495}
496 496
497int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, 497int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl3945_priv *priv, void *ptr,
498 dma_addr_t addr, u16 len) 498 dma_addr_t addr, u16 len)
499{ 499{
500 int count; 500 int count;
501 u32 pad; 501 u32 pad;
502 struct iwl_tfd_frame *tfd = (struct iwl_tfd_frame *)ptr; 502 struct iwl3945_tfd_frame *tfd = (struct iwl3945_tfd_frame *)ptr;
503 503
504 count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags)); 504 count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));
505 pad = TFD_CTL_PAD_GET(le32_to_cpu(tfd->control_flags)); 505 pad = TFD_CTL_PAD_GET(le32_to_cpu(tfd->control_flags));
@@ -522,14 +522,14 @@ int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr,
522} 522}
523 523
524/** 524/**
525 * iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr] 525 * iwl3945_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr]
526 * 526 *
527 * Does NOT advance any indexes 527 * Does NOT advance any indexes
528 */ 528 */
529int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) 529int iwl3945_hw_txq_free_tfd(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq)
530{ 530{
531 struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0]; 531 struct iwl3945_tfd_frame *bd_tmp = (struct iwl3945_tfd_frame *)&txq->bd[0];
532 struct iwl_tfd_frame *bd = &bd_tmp[txq->q.read_ptr]; 532 struct iwl3945_tfd_frame *bd = &bd_tmp[txq->q.read_ptr];
533 struct pci_dev *dev = priv->pci_dev; 533 struct pci_dev *dev = priv->pci_dev;
534 int i; 534 int i;
535 int counter; 535 int counter;
@@ -564,7 +564,7 @@ int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
564 return 0; 564 return 0;
565} 565}
566 566
567u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *addr) 567u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *addr)
568{ 568{
569 int i; 569 int i;
570 int ret = IWL_INVALID_STATION; 570 int ret = IWL_INVALID_STATION;
@@ -588,11 +588,11 @@ u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *addr)
588} 588}
589 589
590/** 590/**
591 * iwl_hw_build_tx_cmd_rate - Add rate portion to TX_CMD: 591 * iwl3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD:
592 * 592 *
593*/ 593*/
594void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, 594void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
595 struct iwl_cmd *cmd, 595 struct iwl3945_cmd *cmd,
596 struct ieee80211_tx_control *ctrl, 596 struct ieee80211_tx_control *ctrl,
597 struct ieee80211_hdr *hdr, int sta_id, int tx_id) 597 struct ieee80211_hdr *hdr, int sta_id, int tx_id)
598{ 598{
@@ -605,7 +605,7 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
605 __le32 tx_flags; 605 __le32 tx_flags;
606 u16 fc = le16_to_cpu(hdr->frame_control); 606 u16 fc = le16_to_cpu(hdr->frame_control);
607 607
608 rate = iwl_rates[rate_index].plcp; 608 rate = iwl3945_rates[rate_index].plcp;
609 tx_flags = cmd->cmd.tx.tx_flags; 609 tx_flags = cmd->cmd.tx.tx_flags;
610 610
611 /* We need to figure out how to get the sta->supp_rates while 611 /* We need to figure out how to get the sta->supp_rates while
@@ -672,10 +672,10 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
672 cmd->cmd.tx.supp_rates[1], cmd->cmd.tx.supp_rates[0]); 672 cmd->cmd.tx.supp_rates[1], cmd->cmd.tx.supp_rates[0]);
673} 673}
674 674
675u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags) 675u8 iwl3945_sync_sta(struct iwl3945_priv *priv, int sta_id, u16 tx_rate, u8 flags)
676{ 676{
677 unsigned long flags_spin; 677 unsigned long flags_spin;
678 struct iwl_station_entry *station; 678 struct iwl3945_station_entry *station;
679 679
680 if (sta_id == IWL_INVALID_STATION) 680 if (sta_id == IWL_INVALID_STATION)
681 return IWL_INVALID_STATION; 681 return IWL_INVALID_STATION;
@@ -690,19 +690,19 @@ u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags)
690 690
691 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 691 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
692 692
693 iwl_send_add_station(priv, &station->sta, flags); 693 iwl3945_send_add_station(priv, &station->sta, flags);
694 IWL_DEBUG_RATE("SCALE sync station %d to rate %d\n", 694 IWL_DEBUG_RATE("SCALE sync station %d to rate %d\n",
695 sta_id, tx_rate); 695 sta_id, tx_rate);
696 return sta_id; 696 return sta_id;
697} 697}
698 698
699static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) 699static int iwl3945_nic_set_pwr_src(struct iwl3945_priv *priv, int pwr_max)
700{ 700{
701 int rc; 701 int rc;
702 unsigned long flags; 702 unsigned long flags;
703 703
704 spin_lock_irqsave(&priv->lock, flags); 704 spin_lock_irqsave(&priv->lock, flags);
705 rc = iwl_grab_nic_access(priv); 705 rc = iwl3945_grab_nic_access(priv);
706 if (rc) { 706 if (rc) {
707 spin_unlock_irqrestore(&priv->lock, flags); 707 spin_unlock_irqrestore(&priv->lock, flags);
708 return rc; 708 return rc;
@@ -714,23 +714,23 @@ static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max)
714 rc = pci_read_config_dword(priv->pci_dev, 714 rc = pci_read_config_dword(priv->pci_dev,
715 PCI_POWER_SOURCE, &val); 715 PCI_POWER_SOURCE, &val);
716 if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) { 716 if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) {
717 iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 717 iwl3945_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
718 APMG_PS_CTRL_VAL_PWR_SRC_VAUX, 718 APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
719 ~APMG_PS_CTRL_MSK_PWR_SRC); 719 ~APMG_PS_CTRL_MSK_PWR_SRC);
720 iwl_release_nic_access(priv); 720 iwl3945_release_nic_access(priv);
721 721
722 iwl_poll_bit(priv, CSR_GPIO_IN, 722 iwl3945_poll_bit(priv, CSR_GPIO_IN,
723 CSR_GPIO_IN_VAL_VAUX_PWR_SRC, 723 CSR_GPIO_IN_VAL_VAUX_PWR_SRC,
724 CSR_GPIO_IN_BIT_AUX_POWER, 5000); 724 CSR_GPIO_IN_BIT_AUX_POWER, 5000);
725 } else 725 } else
726 iwl_release_nic_access(priv); 726 iwl3945_release_nic_access(priv);
727 } else { 727 } else {
728 iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 728 iwl3945_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
729 APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, 729 APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
730 ~APMG_PS_CTRL_MSK_PWR_SRC); 730 ~APMG_PS_CTRL_MSK_PWR_SRC);
731 731
732 iwl_release_nic_access(priv); 732 iwl3945_release_nic_access(priv);
733 iwl_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC, 733 iwl3945_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC,
734 CSR_GPIO_IN_BIT_AUX_POWER, 5000); /* uS */ 734 CSR_GPIO_IN_BIT_AUX_POWER, 5000); /* uS */
735 } 735 }
736 spin_unlock_irqrestore(&priv->lock, flags); 736 spin_unlock_irqrestore(&priv->lock, flags);
@@ -738,24 +738,24 @@ static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max)
738 return rc; 738 return rc;
739} 739}
740 740
741static int iwl3945_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 741static int iwl3945_rx_init(struct iwl3945_priv *priv, struct iwl3945_rx_queue *rxq)
742{ 742{
743 int rc; 743 int rc;
744 unsigned long flags; 744 unsigned long flags;
745 745
746 spin_lock_irqsave(&priv->lock, flags); 746 spin_lock_irqsave(&priv->lock, flags);
747 rc = iwl_grab_nic_access(priv); 747 rc = iwl3945_grab_nic_access(priv);
748 if (rc) { 748 if (rc) {
749 spin_unlock_irqrestore(&priv->lock, flags); 749 spin_unlock_irqrestore(&priv->lock, flags);
750 return rc; 750 return rc;
751 } 751 }
752 752
753 iwl_write_direct32(priv, FH_RCSR_RBD_BASE(0), rxq->dma_addr); 753 iwl3945_write_direct32(priv, FH_RCSR_RBD_BASE(0), rxq->dma_addr);
754 iwl_write_direct32(priv, FH_RCSR_RPTR_ADDR(0), 754 iwl3945_write_direct32(priv, FH_RCSR_RPTR_ADDR(0),
755 priv->hw_setting.shared_phys + 755 priv->hw_setting.shared_phys +
756 offsetof(struct iwl_shared, rx_read_ptr[0])); 756 offsetof(struct iwl3945_shared, rx_read_ptr[0]));
757 iwl_write_direct32(priv, FH_RCSR_WPTR(0), 0); 757 iwl3945_write_direct32(priv, FH_RCSR_WPTR(0), 0);
758 iwl_write_direct32(priv, FH_RCSR_CONFIG(0), 758 iwl3945_write_direct32(priv, FH_RCSR_CONFIG(0),
759 ALM_FH_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE | 759 ALM_FH_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE |
760 ALM_FH_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE | 760 ALM_FH_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE |
761 ALM_FH_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN | 761 ALM_FH_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN |
@@ -766,44 +766,44 @@ static int iwl3945_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
766 ALM_FH_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH); 766 ALM_FH_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH);
767 767
768 /* fake read to flush all prev I/O */ 768 /* fake read to flush all prev I/O */
769 iwl_read_direct32(priv, FH_RSSR_CTRL); 769 iwl3945_read_direct32(priv, FH_RSSR_CTRL);
770 770
771 iwl_release_nic_access(priv); 771 iwl3945_release_nic_access(priv);
772 spin_unlock_irqrestore(&priv->lock, flags); 772 spin_unlock_irqrestore(&priv->lock, flags);
773 773
774 return 0; 774 return 0;
775} 775}
776 776
777static int iwl3945_tx_reset(struct iwl_priv *priv) 777static int iwl3945_tx_reset(struct iwl3945_priv *priv)
778{ 778{
779 int rc; 779 int rc;
780 unsigned long flags; 780 unsigned long flags;
781 781
782 spin_lock_irqsave(&priv->lock, flags); 782 spin_lock_irqsave(&priv->lock, flags);
783 rc = iwl_grab_nic_access(priv); 783 rc = iwl3945_grab_nic_access(priv);
784 if (rc) { 784 if (rc) {
785 spin_unlock_irqrestore(&priv->lock, flags); 785 spin_unlock_irqrestore(&priv->lock, flags);
786 return rc; 786 return rc;
787 } 787 }
788 788
789 /* bypass mode */ 789 /* bypass mode */
790 iwl_write_prph(priv, ALM_SCD_MODE_REG, 0x2); 790 iwl3945_write_prph(priv, ALM_SCD_MODE_REG, 0x2);
791 791
792 /* RA 0 is active */ 792 /* RA 0 is active */
793 iwl_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01); 793 iwl3945_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01);
794 794
795 /* all 6 fifo are active */ 795 /* all 6 fifo are active */
796 iwl_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f); 796 iwl3945_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f);
797 797
798 iwl_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000); 798 iwl3945_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000);
799 iwl_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002); 799 iwl3945_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002);
800 iwl_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004); 800 iwl3945_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004);
801 iwl_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005); 801 iwl3945_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005);
802 802
803 iwl_write_direct32(priv, FH_TSSR_CBB_BASE, 803 iwl3945_write_direct32(priv, FH_TSSR_CBB_BASE,
804 priv->hw_setting.shared_phys); 804 priv->hw_setting.shared_phys);
805 805
806 iwl_write_direct32(priv, FH_TSSR_MSG_CONFIG, 806 iwl3945_write_direct32(priv, FH_TSSR_MSG_CONFIG,
807 ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON | 807 ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON |
808 ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON | 808 ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON |
809 ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B | 809 ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B |
@@ -812,7 +812,7 @@ static int iwl3945_tx_reset(struct iwl_priv *priv)
812 ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH | 812 ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH |
813 ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH); 813 ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH);
814 814
815 iwl_release_nic_access(priv); 815 iwl3945_release_nic_access(priv);
816 spin_unlock_irqrestore(&priv->lock, flags); 816 spin_unlock_irqrestore(&priv->lock, flags);
817 817
818 return 0; 818 return 0;
@@ -823,12 +823,12 @@ static int iwl3945_tx_reset(struct iwl_priv *priv)
823 * 823 *
824 * Destroys all DMA structures and initialize them again 824 * Destroys all DMA structures and initialize them again
825 */ 825 */
826static int iwl3945_txq_ctx_reset(struct iwl_priv *priv) 826static int iwl3945_txq_ctx_reset(struct iwl3945_priv *priv)
827{ 827{
828 int rc; 828 int rc;
829 int txq_id, slots_num; 829 int txq_id, slots_num;
830 830
831 iwl_hw_txq_ctx_free(priv); 831 iwl3945_hw_txq_ctx_free(priv);
832 832
833 /* Tx CMD queue */ 833 /* Tx CMD queue */
834 rc = iwl3945_tx_reset(priv); 834 rc = iwl3945_tx_reset(priv);
@@ -839,7 +839,7 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)
839 for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++) { 839 for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++) {
840 slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ? 840 slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ?
841 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; 841 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
842 rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num, 842 rc = iwl3945_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
843 txq_id); 843 txq_id);
844 if (rc) { 844 if (rc) {
845 IWL_ERROR("Tx %d queue init failed\n", txq_id); 845 IWL_ERROR("Tx %d queue init failed\n", txq_id);
@@ -850,26 +850,26 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)
850 return rc; 850 return rc;
851 851
852 error: 852 error:
853 iwl_hw_txq_ctx_free(priv); 853 iwl3945_hw_txq_ctx_free(priv);
854 return rc; 854 return rc;
855} 855}
856 856
857int iwl_hw_nic_init(struct iwl_priv *priv) 857int iwl3945_hw_nic_init(struct iwl3945_priv *priv)
858{ 858{
859 u8 rev_id; 859 u8 rev_id;
860 int rc; 860 int rc;
861 unsigned long flags; 861 unsigned long flags;
862 struct iwl_rx_queue *rxq = &priv->rxq; 862 struct iwl3945_rx_queue *rxq = &priv->rxq;
863 863
864 iwl_power_init_handle(priv); 864 iwl3945_power_init_handle(priv);
865 865
866 spin_lock_irqsave(&priv->lock, flags); 866 spin_lock_irqsave(&priv->lock, flags);
867 iwl_set_bit(priv, CSR_ANA_PLL_CFG, (1 << 24)); 867 iwl3945_set_bit(priv, CSR_ANA_PLL_CFG, (1 << 24));
868 iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS, 868 iwl3945_set_bit(priv, CSR_GIO_CHICKEN_BITS,
869 CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX); 869 CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX);
870 870
871 iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 871 iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
872 rc = iwl_poll_bit(priv, CSR_GP_CNTRL, 872 rc = iwl3945_poll_bit(priv, CSR_GP_CNTRL,
873 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 873 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
874 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); 874 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
875 if (rc < 0) { 875 if (rc < 0) {
@@ -878,18 +878,18 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
878 return rc; 878 return rc;
879 } 879 }
880 880
881 rc = iwl_grab_nic_access(priv); 881 rc = iwl3945_grab_nic_access(priv);
882 if (rc) { 882 if (rc) {
883 spin_unlock_irqrestore(&priv->lock, flags); 883 spin_unlock_irqrestore(&priv->lock, flags);
884 return rc; 884 return rc;
885 } 885 }
886 iwl_write_prph(priv, APMG_CLK_EN_REG, 886 iwl3945_write_prph(priv, APMG_CLK_EN_REG,
887 APMG_CLK_VAL_DMA_CLK_RQT | 887 APMG_CLK_VAL_DMA_CLK_RQT |
888 APMG_CLK_VAL_BSM_CLK_RQT); 888 APMG_CLK_VAL_BSM_CLK_RQT);
889 udelay(20); 889 udelay(20);
890 iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG, 890 iwl3945_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
891 APMG_PCIDEV_STT_VAL_L1_ACT_DIS); 891 APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
892 iwl_release_nic_access(priv); 892 iwl3945_release_nic_access(priv);
893 spin_unlock_irqrestore(&priv->lock, flags); 893 spin_unlock_irqrestore(&priv->lock, flags);
894 894
895 /* Determine HW type */ 895 /* Determine HW type */
@@ -905,25 +905,25 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
905 IWL_DEBUG_INFO("RTP type \n"); 905 IWL_DEBUG_INFO("RTP type \n");
906 else if (rev_id & PCI_CFG_REV_ID_BIT_BASIC_SKU) { 906 else if (rev_id & PCI_CFG_REV_ID_BIT_BASIC_SKU) {
907 IWL_DEBUG_INFO("ALM-MB type\n"); 907 IWL_DEBUG_INFO("ALM-MB type\n");
908 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, 908 iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
909 CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MB); 909 CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MB);
910 } else { 910 } else {
911 IWL_DEBUG_INFO("ALM-MM type\n"); 911 IWL_DEBUG_INFO("ALM-MM type\n");
912 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, 912 iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
913 CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MM); 913 CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MM);
914 } 914 }
915 915
916 spin_unlock_irqrestore(&priv->lock, flags); 916 spin_unlock_irqrestore(&priv->lock, flags);
917 917
918 /* Initialize the EEPROM */ 918 /* Initialize the EEPROM */
919 rc = iwl_eeprom_init(priv); 919 rc = iwl3945_eeprom_init(priv);
920 if (rc) 920 if (rc)
921 return rc; 921 return rc;
922 922
923 spin_lock_irqsave(&priv->lock, flags); 923 spin_lock_irqsave(&priv->lock, flags);
924 if (EEPROM_SKU_CAP_OP_MODE_MRC == priv->eeprom.sku_cap) { 924 if (EEPROM_SKU_CAP_OP_MODE_MRC == priv->eeprom.sku_cap) {
925 IWL_DEBUG_INFO("SKU OP mode is mrc\n"); 925 IWL_DEBUG_INFO("SKU OP mode is mrc\n");
926 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, 926 iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
927 CSR_HW_IF_CONFIG_REG_BIT_SKU_MRC); 927 CSR_HW_IF_CONFIG_REG_BIT_SKU_MRC);
928 } else 928 } else
929 IWL_DEBUG_INFO("SKU OP mode is basic\n"); 929 IWL_DEBUG_INFO("SKU OP mode is basic\n");
@@ -931,24 +931,24 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
931 if ((priv->eeprom.board_revision & 0xF0) == 0xD0) { 931 if ((priv->eeprom.board_revision & 0xF0) == 0xD0) {
932 IWL_DEBUG_INFO("3945ABG revision is 0x%X\n", 932 IWL_DEBUG_INFO("3945ABG revision is 0x%X\n",
933 priv->eeprom.board_revision); 933 priv->eeprom.board_revision);
934 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, 934 iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
935 CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); 935 CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE);
936 } else { 936 } else {
937 IWL_DEBUG_INFO("3945ABG revision is 0x%X\n", 937 IWL_DEBUG_INFO("3945ABG revision is 0x%X\n",
938 priv->eeprom.board_revision); 938 priv->eeprom.board_revision);
939 iwl_clear_bit(priv, CSR_HW_IF_CONFIG_REG, 939 iwl3945_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
940 CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); 940 CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE);
941 } 941 }
942 942
943 if (priv->eeprom.almgor_m_version <= 1) { 943 if (priv->eeprom.almgor_m_version <= 1) {
944 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, 944 iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
945 CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A); 945 CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A);
946 IWL_DEBUG_INFO("Card M type A version is 0x%X\n", 946 IWL_DEBUG_INFO("Card M type A version is 0x%X\n",
947 priv->eeprom.almgor_m_version); 947 priv->eeprom.almgor_m_version);
948 } else { 948 } else {
949 IWL_DEBUG_INFO("Card M type B version is 0x%X\n", 949 IWL_DEBUG_INFO("Card M type B version is 0x%X\n",
950 priv->eeprom.almgor_m_version); 950 priv->eeprom.almgor_m_version);
951 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, 951 iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
952 CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B); 952 CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B);
953 } 953 }
954 spin_unlock_irqrestore(&priv->lock, flags); 954 spin_unlock_irqrestore(&priv->lock, flags);
@@ -961,15 +961,15 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
961 961
962 /* Allocate the RX queue, or reset if it is already allocated */ 962 /* Allocate the RX queue, or reset if it is already allocated */
963 if (!rxq->bd) { 963 if (!rxq->bd) {
964 rc = iwl_rx_queue_alloc(priv); 964 rc = iwl3945_rx_queue_alloc(priv);
965 if (rc) { 965 if (rc) {
966 IWL_ERROR("Unable to initialize Rx queue\n"); 966 IWL_ERROR("Unable to initialize Rx queue\n");
967 return -ENOMEM; 967 return -ENOMEM;
968 } 968 }
969 } else 969 } else
970 iwl_rx_queue_reset(priv, rxq); 970 iwl3945_rx_queue_reset(priv, rxq);
971 971
972 iwl_rx_replenish(priv); 972 iwl3945_rx_replenish(priv);
973 973
974 iwl3945_rx_init(priv, rxq); 974 iwl3945_rx_init(priv, rxq);
975 975
@@ -977,16 +977,16 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
977 977
978 /* Look at using this instead: 978 /* Look at using this instead:
979 rxq->need_update = 1; 979 rxq->need_update = 1;
980 iwl_rx_queue_update_write_ptr(priv, rxq); 980 iwl3945_rx_queue_update_write_ptr(priv, rxq);
981 */ 981 */
982 982
983 rc = iwl_grab_nic_access(priv); 983 rc = iwl3945_grab_nic_access(priv);
984 if (rc) { 984 if (rc) {
985 spin_unlock_irqrestore(&priv->lock, flags); 985 spin_unlock_irqrestore(&priv->lock, flags);
986 return rc; 986 return rc;
987 } 987 }
988 iwl_write_direct32(priv, FH_RCSR_WPTR(0), rxq->write & ~7); 988 iwl3945_write_direct32(priv, FH_RCSR_WPTR(0), rxq->write & ~7);
989 iwl_release_nic_access(priv); 989 iwl3945_release_nic_access(priv);
990 990
991 spin_unlock_irqrestore(&priv->lock, flags); 991 spin_unlock_irqrestore(&priv->lock, flags);
992 992
@@ -1000,49 +1000,49 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
1000} 1000}
1001 1001
1002/** 1002/**
1003 * iwl_hw_txq_ctx_free - Free TXQ Context 1003 * iwl3945_hw_txq_ctx_free - Free TXQ Context
1004 * 1004 *
1005 * Destroy all TX DMA queues and structures 1005 * Destroy all TX DMA queues and structures
1006 */ 1006 */
1007void iwl_hw_txq_ctx_free(struct iwl_priv *priv) 1007void iwl3945_hw_txq_ctx_free(struct iwl3945_priv *priv)
1008{ 1008{
1009 int txq_id; 1009 int txq_id;
1010 1010
1011 /* Tx queues */ 1011 /* Tx queues */
1012 for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++) 1012 for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++)
1013 iwl_tx_queue_free(priv, &priv->txq[txq_id]); 1013 iwl3945_tx_queue_free(priv, &priv->txq[txq_id]);
1014} 1014}
1015 1015
1016void iwl_hw_txq_ctx_stop(struct iwl_priv *priv) 1016void iwl3945_hw_txq_ctx_stop(struct iwl3945_priv *priv)
1017{ 1017{
1018 int queue; 1018 int queue;
1019 unsigned long flags; 1019 unsigned long flags;
1020 1020
1021 spin_lock_irqsave(&priv->lock, flags); 1021 spin_lock_irqsave(&priv->lock, flags);
1022 if (iwl_grab_nic_access(priv)) { 1022 if (iwl3945_grab_nic_access(priv)) {
1023 spin_unlock_irqrestore(&priv->lock, flags); 1023 spin_unlock_irqrestore(&priv->lock, flags);
1024 iwl_hw_txq_ctx_free(priv); 1024 iwl3945_hw_txq_ctx_free(priv);
1025 return; 1025 return;
1026 } 1026 }
1027 1027
1028 /* stop SCD */ 1028 /* stop SCD */
1029 iwl_write_prph(priv, ALM_SCD_MODE_REG, 0); 1029 iwl3945_write_prph(priv, ALM_SCD_MODE_REG, 0);
1030 1030
1031 /* reset TFD queues */ 1031 /* reset TFD queues */
1032 for (queue = TFD_QUEUE_MIN; queue < TFD_QUEUE_MAX; queue++) { 1032 for (queue = TFD_QUEUE_MIN; queue < TFD_QUEUE_MAX; queue++) {
1033 iwl_write_direct32(priv, FH_TCSR_CONFIG(queue), 0x0); 1033 iwl3945_write_direct32(priv, FH_TCSR_CONFIG(queue), 0x0);
1034 iwl_poll_direct_bit(priv, FH_TSSR_TX_STATUS, 1034 iwl3945_poll_direct_bit(priv, FH_TSSR_TX_STATUS,
1035 ALM_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(queue), 1035 ALM_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(queue),
1036 1000); 1036 1000);
1037 } 1037 }
1038 1038
1039 iwl_release_nic_access(priv); 1039 iwl3945_release_nic_access(priv);
1040 spin_unlock_irqrestore(&priv->lock, flags); 1040 spin_unlock_irqrestore(&priv->lock, flags);
1041 1041
1042 iwl_hw_txq_ctx_free(priv); 1042 iwl3945_hw_txq_ctx_free(priv);
1043} 1043}
1044 1044
1045int iwl_hw_nic_stop_master(struct iwl_priv *priv) 1045int iwl3945_hw_nic_stop_master(struct iwl3945_priv *priv)
1046{ 1046{
1047 int rc = 0; 1047 int rc = 0;
1048 u32 reg_val; 1048 u32 reg_val;
@@ -1051,16 +1051,16 @@ int iwl_hw_nic_stop_master(struct iwl_priv *priv)
1051 spin_lock_irqsave(&priv->lock, flags); 1051 spin_lock_irqsave(&priv->lock, flags);
1052 1052
1053 /* set stop master bit */ 1053 /* set stop master bit */
1054 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); 1054 iwl3945_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
1055 1055
1056 reg_val = iwl_read32(priv, CSR_GP_CNTRL); 1056 reg_val = iwl3945_read32(priv, CSR_GP_CNTRL);
1057 1057
1058 if (CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE == 1058 if (CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE ==
1059 (reg_val & CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE)) 1059 (reg_val & CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE))
1060 IWL_DEBUG_INFO("Card in power save, master is already " 1060 IWL_DEBUG_INFO("Card in power save, master is already "
1061 "stopped\n"); 1061 "stopped\n");
1062 else { 1062 else {
1063 rc = iwl_poll_bit(priv, CSR_RESET, 1063 rc = iwl3945_poll_bit(priv, CSR_RESET,
1064 CSR_RESET_REG_FLAG_MASTER_DISABLED, 1064 CSR_RESET_REG_FLAG_MASTER_DISABLED,
1065 CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); 1065 CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
1066 if (rc < 0) { 1066 if (rc < 0) {
@@ -1075,47 +1075,47 @@ int iwl_hw_nic_stop_master(struct iwl_priv *priv)
1075 return rc; 1075 return rc;
1076} 1076}
1077 1077
1078int iwl_hw_nic_reset(struct iwl_priv *priv) 1078int iwl3945_hw_nic_reset(struct iwl3945_priv *priv)
1079{ 1079{
1080 int rc; 1080 int rc;
1081 unsigned long flags; 1081 unsigned long flags;
1082 1082
1083 iwl_hw_nic_stop_master(priv); 1083 iwl3945_hw_nic_stop_master(priv);
1084 1084
1085 spin_lock_irqsave(&priv->lock, flags); 1085 spin_lock_irqsave(&priv->lock, flags);
1086 1086
1087 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); 1087 iwl3945_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
1088 1088
1089 rc = iwl_poll_bit(priv, CSR_GP_CNTRL, 1089 rc = iwl3945_poll_bit(priv, CSR_GP_CNTRL,
1090 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 1090 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
1091 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); 1091 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
1092 1092
1093 rc = iwl_grab_nic_access(priv); 1093 rc = iwl3945_grab_nic_access(priv);
1094 if (!rc) { 1094 if (!rc) {
1095 iwl_write_prph(priv, APMG_CLK_CTRL_REG, 1095 iwl3945_write_prph(priv, APMG_CLK_CTRL_REG,
1096 APMG_CLK_VAL_BSM_CLK_RQT); 1096 APMG_CLK_VAL_BSM_CLK_RQT);
1097 1097
1098 udelay(10); 1098 udelay(10);
1099 1099
1100 iwl_set_bit(priv, CSR_GP_CNTRL, 1100 iwl3945_set_bit(priv, CSR_GP_CNTRL,
1101 CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 1101 CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
1102 1102
1103 iwl_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0); 1103 iwl3945_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0);
1104 iwl_write_prph(priv, APMG_RTC_INT_STT_REG, 1104 iwl3945_write_prph(priv, APMG_RTC_INT_STT_REG,
1105 0xFFFFFFFF); 1105 0xFFFFFFFF);
1106 1106
1107 /* enable DMA */ 1107 /* enable DMA */
1108 iwl_write_prph(priv, APMG_CLK_EN_REG, 1108 iwl3945_write_prph(priv, APMG_CLK_EN_REG,
1109 APMG_CLK_VAL_DMA_CLK_RQT | 1109 APMG_CLK_VAL_DMA_CLK_RQT |
1110 APMG_CLK_VAL_BSM_CLK_RQT); 1110 APMG_CLK_VAL_BSM_CLK_RQT);
1111 udelay(10); 1111 udelay(10);
1112 1112
1113 iwl_set_bits_prph(priv, APMG_PS_CTRL_REG, 1113 iwl3945_set_bits_prph(priv, APMG_PS_CTRL_REG,
1114 APMG_PS_CTRL_VAL_RESET_REQ); 1114 APMG_PS_CTRL_VAL_RESET_REQ);
1115 udelay(5); 1115 udelay(5);
1116 iwl_clear_bits_prph(priv, APMG_PS_CTRL_REG, 1116 iwl3945_clear_bits_prph(priv, APMG_PS_CTRL_REG,
1117 APMG_PS_CTRL_VAL_RESET_REQ); 1117 APMG_PS_CTRL_VAL_RESET_REQ);
1118 iwl_release_nic_access(priv); 1118 iwl3945_release_nic_access(priv);
1119 } 1119 }
1120 1120
1121 /* Clear the 'host command active' bit... */ 1121 /* Clear the 'host command active' bit... */
@@ -1128,43 +1128,43 @@ int iwl_hw_nic_reset(struct iwl_priv *priv)
1128} 1128}
1129 1129
1130/** 1130/**
1131 * iwl_hw_reg_adjust_power_by_temp 1131 * iwl3945_hw_reg_adjust_power_by_temp
1132 * return index delta into power gain settings table 1132 * return index delta into power gain settings table
1133*/ 1133*/
1134static int iwl_hw_reg_adjust_power_by_temp(int new_reading, int old_reading) 1134static int iwl3945_hw_reg_adjust_power_by_temp(int new_reading, int old_reading)
1135{ 1135{
1136 return (new_reading - old_reading) * (-11) / 100; 1136 return (new_reading - old_reading) * (-11) / 100;
1137} 1137}
1138 1138
1139/** 1139/**
1140 * iwl_hw_reg_temp_out_of_range - Keep temperature in sane range 1140 * iwl3945_hw_reg_temp_out_of_range - Keep temperature in sane range
1141 */ 1141 */
1142static inline int iwl_hw_reg_temp_out_of_range(int temperature) 1142static inline int iwl3945_hw_reg_temp_out_of_range(int temperature)
1143{ 1143{
1144 return (((temperature < -260) || (temperature > 25)) ? 1 : 0); 1144 return (((temperature < -260) || (temperature > 25)) ? 1 : 0);
1145} 1145}
1146 1146
1147int iwl_hw_get_temperature(struct iwl_priv *priv) 1147int iwl3945_hw_get_temperature(struct iwl3945_priv *priv)
1148{ 1148{
1149 return iwl_read32(priv, CSR_UCODE_DRV_GP2); 1149 return iwl3945_read32(priv, CSR_UCODE_DRV_GP2);
1150} 1150}
1151 1151
1152/** 1152/**
1153 * iwl_hw_reg_txpower_get_temperature 1153 * iwl3945_hw_reg_txpower_get_temperature
1154 * get the current temperature by reading from NIC 1154 * get the current temperature by reading from NIC
1155*/ 1155*/
1156static int iwl_hw_reg_txpower_get_temperature(struct iwl_priv *priv) 1156static int iwl3945_hw_reg_txpower_get_temperature(struct iwl3945_priv *priv)
1157{ 1157{
1158 int temperature; 1158 int temperature;
1159 1159
1160 temperature = iwl_hw_get_temperature(priv); 1160 temperature = iwl3945_hw_get_temperature(priv);
1161 1161
1162 /* driver's okay range is -260 to +25. 1162 /* driver's okay range is -260 to +25.
1163 * human readable okay range is 0 to +285 */ 1163 * human readable okay range is 0 to +285 */
1164 IWL_DEBUG_INFO("Temperature: %d\n", temperature + IWL_TEMP_CONVERT); 1164 IWL_DEBUG_INFO("Temperature: %d\n", temperature + IWL_TEMP_CONVERT);
1165 1165
1166 /* handle insane temp reading */ 1166 /* handle insane temp reading */
1167 if (iwl_hw_reg_temp_out_of_range(temperature)) { 1167 if (iwl3945_hw_reg_temp_out_of_range(temperature)) {
1168 IWL_ERROR("Error bad temperature value %d\n", temperature); 1168 IWL_ERROR("Error bad temperature value %d\n", temperature);
1169 1169
1170 /* if really really hot(?), 1170 /* if really really hot(?),
@@ -1189,11 +1189,11 @@ static int iwl_hw_reg_txpower_get_temperature(struct iwl_priv *priv)
1189 * records new temperature in tx_mgr->temperature. 1189 * records new temperature in tx_mgr->temperature.
1190 * replaces tx_mgr->last_temperature *only* if calib needed 1190 * replaces tx_mgr->last_temperature *only* if calib needed
1191 * (assumes caller will actually do the calibration!). */ 1191 * (assumes caller will actually do the calibration!). */
1192static int is_temp_calib_needed(struct iwl_priv *priv) 1192static int is_temp_calib_needed(struct iwl3945_priv *priv)
1193{ 1193{
1194 int temp_diff; 1194 int temp_diff;
1195 1195
1196 priv->temperature = iwl_hw_reg_txpower_get_temperature(priv); 1196 priv->temperature = iwl3945_hw_reg_txpower_get_temperature(priv);
1197 temp_diff = priv->temperature - priv->last_temperature; 1197 temp_diff = priv->temperature - priv->last_temperature;
1198 1198
1199 /* get absolute value */ 1199 /* get absolute value */
@@ -1225,7 +1225,7 @@ static int is_temp_calib_needed(struct iwl_priv *priv)
1225 1225
1226/* radio and DSP power table, each step is 1/2 dB. 1226/* radio and DSP power table, each step is 1/2 dB.
1227 * 1st number is for RF analog gain, 2nd number is for DSP pre-DAC gain. */ 1227 * 1st number is for RF analog gain, 2nd number is for DSP pre-DAC gain. */
1228static struct iwl_tx_power power_gain_table[2][IWL_MAX_GAIN_ENTRIES] = { 1228static struct iwl3945_tx_power power_gain_table[2][IWL_MAX_GAIN_ENTRIES] = {
1229 { 1229 {
1230 {251, 127}, /* 2.4 GHz, highest power */ 1230 {251, 127}, /* 2.4 GHz, highest power */
1231 {251, 127}, 1231 {251, 127},
@@ -1386,7 +1386,7 @@ static struct iwl_tx_power power_gain_table[2][IWL_MAX_GAIN_ENTRIES] = {
1386 {3, 120} } /* 5.x GHz, lowest power */ 1386 {3, 120} } /* 5.x GHz, lowest power */
1387}; 1387};
1388 1388
1389static inline u8 iwl_hw_reg_fix_power_index(int index) 1389static inline u8 iwl3945_hw_reg_fix_power_index(int index)
1390{ 1390{
1391 if (index < 0) 1391 if (index < 0)
1392 return 0; 1392 return 0;
@@ -1399,17 +1399,17 @@ static inline u8 iwl_hw_reg_fix_power_index(int index)
1399#define REG_RECALIB_PERIOD (60) 1399#define REG_RECALIB_PERIOD (60)
1400 1400
1401/** 1401/**
1402 * iwl_hw_reg_set_scan_power - Set Tx power for scan probe requests 1402 * iwl3945_hw_reg_set_scan_power - Set Tx power for scan probe requests
1403 * 1403 *
1404 * Set (in our channel info database) the direct scan Tx power for 1 Mbit (CCK) 1404 * Set (in our channel info database) the direct scan Tx power for 1 Mbit (CCK)
1405 * or 6 Mbit (OFDM) rates. 1405 * or 6 Mbit (OFDM) rates.
1406 */ 1406 */
1407static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index, 1407static void iwl3945_hw_reg_set_scan_power(struct iwl3945_priv *priv, u32 scan_tbl_index,
1408 s32 rate_index, const s8 *clip_pwrs, 1408 s32 rate_index, const s8 *clip_pwrs,
1409 struct iwl_channel_info *ch_info, 1409 struct iwl3945_channel_info *ch_info,
1410 int band_index) 1410 int band_index)
1411{ 1411{
1412 struct iwl_scan_power_info *scan_power_info; 1412 struct iwl3945_scan_power_info *scan_power_info;
1413 s8 power; 1413 s8 power;
1414 u8 power_index; 1414 u8 power_index;
1415 1415
@@ -1445,7 +1445,7 @@ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index,
1445 * of the table. */ 1445 * of the table. */
1446 1446
1447 /* don't exceed table bounds for "real" setting */ 1447 /* don't exceed table bounds for "real" setting */
1448 power_index = iwl_hw_reg_fix_power_index(power_index); 1448 power_index = iwl3945_hw_reg_fix_power_index(power_index);
1449 1449
1450 scan_power_info->power_table_index = power_index; 1450 scan_power_info->power_table_index = power_index;
1451 scan_power_info->tpc.tx_gain = 1451 scan_power_info->tpc.tx_gain =
@@ -1455,21 +1455,21 @@ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index,
1455} 1455}
1456 1456
1457/** 1457/**
1458 * iwl_hw_reg_send_txpower - fill in Tx Power command with gain settings 1458 * iwl3945_hw_reg_send_txpower - fill in Tx Power command with gain settings
1459 * 1459 *
1460 * Configures power settings for all rates for the current channel, 1460 * Configures power settings for all rates for the current channel,
1461 * using values from channel info struct, and send to NIC 1461 * using values from channel info struct, and send to NIC
1462 */ 1462 */
1463int iwl_hw_reg_send_txpower(struct iwl_priv *priv) 1463int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv)
1464{ 1464{
1465 int rate_idx, i; 1465 int rate_idx, i;
1466 const struct iwl_channel_info *ch_info = NULL; 1466 const struct iwl3945_channel_info *ch_info = NULL;
1467 struct iwl_txpowertable_cmd txpower = { 1467 struct iwl3945_txpowertable_cmd txpower = {
1468 .channel = priv->active_rxon.channel, 1468 .channel = priv->active_rxon.channel,
1469 }; 1469 };
1470 1470
1471 txpower.band = (priv->phymode == MODE_IEEE80211A) ? 0 : 1; 1471 txpower.band = (priv->phymode == MODE_IEEE80211A) ? 0 : 1;
1472 ch_info = iwl_get_channel_info(priv, 1472 ch_info = iwl3945_get_channel_info(priv,
1473 priv->phymode, 1473 priv->phymode,
1474 le16_to_cpu(priv->active_rxon.channel)); 1474 le16_to_cpu(priv->active_rxon.channel));
1475 if (!ch_info) { 1475 if (!ch_info) {
@@ -1491,7 +1491,7 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv)
1491 rate_idx <= IWL_LAST_OFDM_RATE; rate_idx++, i++) { 1491 rate_idx <= IWL_LAST_OFDM_RATE; rate_idx++, i++) {
1492 1492
1493 txpower.power[i].tpc = ch_info->power_info[i].tpc; 1493 txpower.power[i].tpc = ch_info->power_info[i].tpc;
1494 txpower.power[i].rate = iwl_rates[rate_idx].plcp; 1494 txpower.power[i].rate = iwl3945_rates[rate_idx].plcp;
1495 1495
1496 IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n", 1496 IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n",
1497 le16_to_cpu(txpower.channel), 1497 le16_to_cpu(txpower.channel),
@@ -1504,7 +1504,7 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv)
1504 for (rate_idx = IWL_FIRST_CCK_RATE; 1504 for (rate_idx = IWL_FIRST_CCK_RATE;
1505 rate_idx <= IWL_LAST_CCK_RATE; rate_idx++, i++) { 1505 rate_idx <= IWL_LAST_CCK_RATE; rate_idx++, i++) {
1506 txpower.power[i].tpc = ch_info->power_info[i].tpc; 1506 txpower.power[i].tpc = ch_info->power_info[i].tpc;
1507 txpower.power[i].rate = iwl_rates[rate_idx].plcp; 1507 txpower.power[i].rate = iwl3945_rates[rate_idx].plcp;
1508 1508
1509 IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n", 1509 IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n",
1510 le16_to_cpu(txpower.channel), 1510 le16_to_cpu(txpower.channel),
@@ -1514,13 +1514,13 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv)
1514 txpower.power[i].rate); 1514 txpower.power[i].rate);
1515 } 1515 }
1516 1516
1517 return iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, 1517 return iwl3945_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD,
1518 sizeof(struct iwl_txpowertable_cmd), &txpower); 1518 sizeof(struct iwl3945_txpowertable_cmd), &txpower);
1519 1519
1520} 1520}
1521 1521
1522/** 1522/**
1523 * iwl_hw_reg_set_new_power - Configures power tables at new levels 1523 * iwl3945_hw_reg_set_new_power - Configures power tables at new levels
1524 * @ch_info: Channel to update. Uses power_info.requested_power. 1524 * @ch_info: Channel to update. Uses power_info.requested_power.
1525 * 1525 *
1526 * Replace requested_power and base_power_index ch_info fields for 1526 * Replace requested_power and base_power_index ch_info fields for
@@ -1535,10 +1535,10 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv)
1535 * properly fill out the scan powers, and actual h/w gain settings, 1535 * properly fill out the scan powers, and actual h/w gain settings,
1536 * and send changes to NIC 1536 * and send changes to NIC
1537 */ 1537 */
1538static int iwl_hw_reg_set_new_power(struct iwl_priv *priv, 1538static int iwl3945_hw_reg_set_new_power(struct iwl3945_priv *priv,
1539 struct iwl_channel_info *ch_info) 1539 struct iwl3945_channel_info *ch_info)
1540{ 1540{
1541 struct iwl_channel_power_info *power_info; 1541 struct iwl3945_channel_power_info *power_info;
1542 int power_changed = 0; 1542 int power_changed = 0;
1543 int i; 1543 int i;
1544 const s8 *clip_pwrs; 1544 const s8 *clip_pwrs;
@@ -1578,7 +1578,7 @@ static int iwl_hw_reg_set_new_power(struct iwl_priv *priv,
1578 ch_info->power_info[IWL_RATE_12M_INDEX_TABLE]. 1578 ch_info->power_info[IWL_RATE_12M_INDEX_TABLE].
1579 requested_power + IWL_CCK_FROM_OFDM_POWER_DIFF; 1579 requested_power + IWL_CCK_FROM_OFDM_POWER_DIFF;
1580 1580
1581 /* do all CCK rates' iwl_channel_power_info structures */ 1581 /* do all CCK rates' iwl3945_channel_power_info structures */
1582 for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++) { 1582 for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++) {
1583 power_info->requested_power = power; 1583 power_info->requested_power = power;
1584 power_info->base_power_index = 1584 power_info->base_power_index =
@@ -1592,13 +1592,13 @@ static int iwl_hw_reg_set_new_power(struct iwl_priv *priv,
1592} 1592}
1593 1593
1594/** 1594/**
1595 * iwl_hw_reg_get_ch_txpower_limit - returns new power limit for channel 1595 * iwl3945_hw_reg_get_ch_txpower_limit - returns new power limit for channel
1596 * 1596 *
1597 * NOTE: Returned power limit may be less (but not more) than requested, 1597 * NOTE: Returned power limit may be less (but not more) than requested,
1598 * based strictly on regulatory (eeprom and spectrum mgt) limitations 1598 * based strictly on regulatory (eeprom and spectrum mgt) limitations
1599 * (no consideration for h/w clipping limitations). 1599 * (no consideration for h/w clipping limitations).
1600 */ 1600 */
1601static int iwl_hw_reg_get_ch_txpower_limit(struct iwl_channel_info *ch_info) 1601static int iwl3945_hw_reg_get_ch_txpower_limit(struct iwl3945_channel_info *ch_info)
1602{ 1602{
1603 s8 max_power; 1603 s8 max_power;
1604 1604
@@ -1617,7 +1617,7 @@ static int iwl_hw_reg_get_ch_txpower_limit(struct iwl_channel_info *ch_info)
1617} 1617}
1618 1618
1619/** 1619/**
1620 * iwl_hw_reg_comp_txpower_temp - Compensate for temperature 1620 * iwl3945_hw_reg_comp_txpower_temp - Compensate for temperature
1621 * 1621 *
1622 * Compensate txpower settings of *all* channels for temperature. 1622 * Compensate txpower settings of *all* channels for temperature.
1623 * This only accounts for the difference between current temperature 1623 * This only accounts for the difference between current temperature
@@ -1626,9 +1626,9 @@ static int iwl_hw_reg_get_ch_txpower_limit(struct iwl_channel_info *ch_info)
1626 * 1626 *
1627 * If RxOn is "associated", this sends the new Txpower to NIC! 1627 * If RxOn is "associated", this sends the new Txpower to NIC!
1628 */ 1628 */
1629static int iwl_hw_reg_comp_txpower_temp(struct iwl_priv *priv) 1629static int iwl3945_hw_reg_comp_txpower_temp(struct iwl3945_priv *priv)
1630{ 1630{
1631 struct iwl_channel_info *ch_info = NULL; 1631 struct iwl3945_channel_info *ch_info = NULL;
1632 int delta_index; 1632 int delta_index;
1633 const s8 *clip_pwrs; /* array of h/w max power levels for each rate */ 1633 const s8 *clip_pwrs; /* array of h/w max power levels for each rate */
1634 u8 a_band; 1634 u8 a_band;
@@ -1649,7 +1649,7 @@ static int iwl_hw_reg_comp_txpower_temp(struct iwl_priv *priv)
1649 1649
1650 /* get power index adjustment based on curr and factory 1650 /* get power index adjustment based on curr and factory
1651 * temps */ 1651 * temps */
1652 delta_index = iwl_hw_reg_adjust_power_by_temp(temperature, 1652 delta_index = iwl3945_hw_reg_adjust_power_by_temp(temperature,
1653 ref_temp); 1653 ref_temp);
1654 1654
1655 /* set tx power value for all rates, OFDM and CCK */ 1655 /* set tx power value for all rates, OFDM and CCK */
@@ -1662,7 +1662,7 @@ static int iwl_hw_reg_comp_txpower_temp(struct iwl_priv *priv)
1662 power_idx += delta_index; 1662 power_idx += delta_index;
1663 1663
1664 /* stay within table range */ 1664 /* stay within table range */
1665 power_idx = iwl_hw_reg_fix_power_index(power_idx); 1665 power_idx = iwl3945_hw_reg_fix_power_index(power_idx);
1666 ch_info->power_info[rate_index]. 1666 ch_info->power_info[rate_index].
1667 power_table_index = (u8) power_idx; 1667 power_table_index = (u8) power_idx;
1668 ch_info->power_info[rate_index].tpc = 1668 ch_info->power_info[rate_index].tpc =
@@ -1677,19 +1677,19 @@ static int iwl_hw_reg_comp_txpower_temp(struct iwl_priv *priv)
1677 scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { 1677 scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) {
1678 s32 actual_index = (scan_tbl_index == 0) ? 1678 s32 actual_index = (scan_tbl_index == 0) ?
1679 IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE; 1679 IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE;
1680 iwl_hw_reg_set_scan_power(priv, scan_tbl_index, 1680 iwl3945_hw_reg_set_scan_power(priv, scan_tbl_index,
1681 actual_index, clip_pwrs, 1681 actual_index, clip_pwrs,
1682 ch_info, a_band); 1682 ch_info, a_band);
1683 } 1683 }
1684 } 1684 }
1685 1685
1686 /* send Txpower command for current channel to ucode */ 1686 /* send Txpower command for current channel to ucode */
1687 return iwl_hw_reg_send_txpower(priv); 1687 return iwl3945_hw_reg_send_txpower(priv);
1688} 1688}
1689 1689
1690int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) 1690int iwl3945_hw_reg_set_txpower(struct iwl3945_priv *priv, s8 power)
1691{ 1691{
1692 struct iwl_channel_info *ch_info; 1692 struct iwl3945_channel_info *ch_info;
1693 s8 max_power; 1693 s8 max_power;
1694 u8 a_band; 1694 u8 a_band;
1695 u8 i; 1695 u8 i;
@@ -1711,26 +1711,26 @@ int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power)
1711 1711
1712 /* find minimum power of all user and regulatory constraints 1712 /* find minimum power of all user and regulatory constraints
1713 * (does not consider h/w clipping limitations) */ 1713 * (does not consider h/w clipping limitations) */
1714 max_power = iwl_hw_reg_get_ch_txpower_limit(ch_info); 1714 max_power = iwl3945_hw_reg_get_ch_txpower_limit(ch_info);
1715 max_power = min(power, max_power); 1715 max_power = min(power, max_power);
1716 if (max_power != ch_info->curr_txpow) { 1716 if (max_power != ch_info->curr_txpow) {
1717 ch_info->curr_txpow = max_power; 1717 ch_info->curr_txpow = max_power;
1718 1718
1719 /* this considers the h/w clipping limitations */ 1719 /* this considers the h/w clipping limitations */
1720 iwl_hw_reg_set_new_power(priv, ch_info); 1720 iwl3945_hw_reg_set_new_power(priv, ch_info);
1721 } 1721 }
1722 } 1722 }
1723 1723
1724 /* update txpower settings for all channels, 1724 /* update txpower settings for all channels,
1725 * send to NIC if associated. */ 1725 * send to NIC if associated. */
1726 is_temp_calib_needed(priv); 1726 is_temp_calib_needed(priv);
1727 iwl_hw_reg_comp_txpower_temp(priv); 1727 iwl3945_hw_reg_comp_txpower_temp(priv);
1728 1728
1729 return 0; 1729 return 0;
1730} 1730}
1731 1731
1732/* will add 3945 channel switch cmd handling later */ 1732/* will add 3945 channel switch cmd handling later */
1733int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel) 1733int iwl3945_hw_channel_switch(struct iwl3945_priv *priv, u16 channel)
1734{ 1734{
1735 return 0; 1735 return 0;
1736} 1736}
@@ -1745,17 +1745,17 @@ int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel)
1745 * -- send new set of gain settings to NIC 1745 * -- send new set of gain settings to NIC
1746 * NOTE: This should continue working, even when we're not associated, 1746 * NOTE: This should continue working, even when we're not associated,
1747 * so we can keep our internal table of scan powers current. */ 1747 * so we can keep our internal table of scan powers current. */
1748void iwl3945_reg_txpower_periodic(struct iwl_priv *priv) 1748void iwl3945_reg_txpower_periodic(struct iwl3945_priv *priv)
1749{ 1749{
1750 /* This will kick in the "brute force" 1750 /* This will kick in the "brute force"
1751 * iwl_hw_reg_comp_txpower_temp() below */ 1751 * iwl3945_hw_reg_comp_txpower_temp() below */
1752 if (!is_temp_calib_needed(priv)) 1752 if (!is_temp_calib_needed(priv))
1753 goto reschedule; 1753 goto reschedule;
1754 1754
1755 /* Set up a new set of temp-adjusted TxPowers, send to NIC. 1755 /* Set up a new set of temp-adjusted TxPowers, send to NIC.
1756 * This is based *only* on current temperature, 1756 * This is based *only* on current temperature,
1757 * ignoring any previous power measurements */ 1757 * ignoring any previous power measurements */
1758 iwl_hw_reg_comp_txpower_temp(priv); 1758 iwl3945_hw_reg_comp_txpower_temp(priv);
1759 1759
1760 reschedule: 1760 reschedule:
1761 queue_delayed_work(priv->workqueue, 1761 queue_delayed_work(priv->workqueue,
@@ -1764,7 +1764,7 @@ void iwl3945_reg_txpower_periodic(struct iwl_priv *priv)
1764 1764
1765static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work) 1765static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work)
1766{ 1766{
1767 struct iwl_priv *priv = container_of(work, struct iwl_priv, 1767 struct iwl3945_priv *priv = container_of(work, struct iwl3945_priv,
1768 thermal_periodic.work); 1768 thermal_periodic.work);
1769 1769
1770 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 1770 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
@@ -1776,7 +1776,7 @@ static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work)
1776} 1776}
1777 1777
1778/** 1778/**
1779 * iwl_hw_reg_get_ch_grp_index - find the channel-group index (0-4) 1779 * iwl3945_hw_reg_get_ch_grp_index - find the channel-group index (0-4)
1780 * for the channel. 1780 * for the channel.
1781 * 1781 *
1782 * This function is used when initializing channel-info structs. 1782 * This function is used when initializing channel-info structs.
@@ -1786,10 +1786,10 @@ static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work)
1786 * on A-band, EEPROM's "group frequency" entries represent the top 1786 * on A-band, EEPROM's "group frequency" entries represent the top
1787 * channel in each group 1-4. Group 5 All B/G channels are in group 0. 1787 * channel in each group 1-4. Group 5 All B/G channels are in group 0.
1788 */ 1788 */
1789static u16 iwl_hw_reg_get_ch_grp_index(struct iwl_priv *priv, 1789static u16 iwl3945_hw_reg_get_ch_grp_index(struct iwl3945_priv *priv,
1790 const struct iwl_channel_info *ch_info) 1790 const struct iwl3945_channel_info *ch_info)
1791{ 1791{
1792 struct iwl_eeprom_txpower_group *ch_grp = &priv->eeprom.groups[0]; 1792 struct iwl3945_eeprom_txpower_group *ch_grp = &priv->eeprom.groups[0];
1793 u8 group; 1793 u8 group;
1794 u16 group_index = 0; /* based on factory calib frequencies */ 1794 u16 group_index = 0; /* based on factory calib frequencies */
1795 u8 grp_channel; 1795 u8 grp_channel;
@@ -1815,20 +1815,20 @@ static u16 iwl_hw_reg_get_ch_grp_index(struct iwl_priv *priv,
1815} 1815}
1816 1816
1817/** 1817/**
1818 * iwl_hw_reg_get_matched_power_index - Interpolate to get nominal index 1818 * iwl3945_hw_reg_get_matched_power_index - Interpolate to get nominal index
1819 * 1819 *
1820 * Interpolate to get nominal (i.e. at factory calibration temperature) index 1820 * Interpolate to get nominal (i.e. at factory calibration temperature) index
1821 * into radio/DSP gain settings table for requested power. 1821 * into radio/DSP gain settings table for requested power.
1822 */ 1822 */
1823static int iwl_hw_reg_get_matched_power_index(struct iwl_priv *priv, 1823static int iwl3945_hw_reg_get_matched_power_index(struct iwl3945_priv *priv,
1824 s8 requested_power, 1824 s8 requested_power,
1825 s32 setting_index, s32 *new_index) 1825 s32 setting_index, s32 *new_index)
1826{ 1826{
1827 const struct iwl_eeprom_txpower_group *chnl_grp = NULL; 1827 const struct iwl3945_eeprom_txpower_group *chnl_grp = NULL;
1828 s32 index0, index1; 1828 s32 index0, index1;
1829 s32 power = 2 * requested_power; 1829 s32 power = 2 * requested_power;
1830 s32 i; 1830 s32 i;
1831 const struct iwl_eeprom_txpower_sample *samples; 1831 const struct iwl3945_eeprom_txpower_sample *samples;
1832 s32 gains0, gains1; 1832 s32 gains0, gains1;
1833 s32 res; 1833 s32 res;
1834 s32 denominator; 1834 s32 denominator;
@@ -1868,11 +1868,11 @@ static int iwl_hw_reg_get_matched_power_index(struct iwl_priv *priv,
1868 return 0; 1868 return 0;
1869} 1869}
1870 1870
1871static void iwl_hw_reg_init_channel_groups(struct iwl_priv *priv) 1871static void iwl3945_hw_reg_init_channel_groups(struct iwl3945_priv *priv)
1872{ 1872{
1873 u32 i; 1873 u32 i;
1874 s32 rate_index; 1874 s32 rate_index;
1875 const struct iwl_eeprom_txpower_group *group; 1875 const struct iwl3945_eeprom_txpower_group *group;
1876 1876
1877 IWL_DEBUG_POWER("Initializing factory calib info from EEPROM\n"); 1877 IWL_DEBUG_POWER("Initializing factory calib info from EEPROM\n");
1878 1878
@@ -1948,10 +1948,10 @@ static void iwl_hw_reg_init_channel_groups(struct iwl_priv *priv)
1948 * 1948 *
1949 * This does *not* write values to NIC, just sets up our internal table. 1949 * This does *not* write values to NIC, just sets up our internal table.
1950 */ 1950 */
1951int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) 1951int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv)
1952{ 1952{
1953 struct iwl_channel_info *ch_info = NULL; 1953 struct iwl3945_channel_info *ch_info = NULL;
1954 struct iwl_channel_power_info *pwr_info; 1954 struct iwl3945_channel_power_info *pwr_info;
1955 int delta_index; 1955 int delta_index;
1956 u8 rate_index; 1956 u8 rate_index;
1957 u8 scan_tbl_index; 1957 u8 scan_tbl_index;
@@ -1964,10 +1964,10 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
1964 1964
1965 /* save temperature reference, 1965 /* save temperature reference,
1966 * so we can determine next time to calibrate */ 1966 * so we can determine next time to calibrate */
1967 temperature = iwl_hw_reg_txpower_get_temperature(priv); 1967 temperature = iwl3945_hw_reg_txpower_get_temperature(priv);
1968 priv->last_temperature = temperature; 1968 priv->last_temperature = temperature;
1969 1969
1970 iwl_hw_reg_init_channel_groups(priv); 1970 iwl3945_hw_reg_init_channel_groups(priv);
1971 1971
1972 /* initialize Tx power info for each and every channel, 2.4 and 5.x */ 1972 /* initialize Tx power info for each and every channel, 2.4 and 5.x */
1973 for (i = 0, ch_info = priv->channel_info; i < priv->channel_count; 1973 for (i = 0, ch_info = priv->channel_info; i < priv->channel_count;
@@ -1978,14 +1978,14 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
1978 1978
1979 /* find this channel's channel group (*not* "band") index */ 1979 /* find this channel's channel group (*not* "band") index */
1980 ch_info->group_index = 1980 ch_info->group_index =
1981 iwl_hw_reg_get_ch_grp_index(priv, ch_info); 1981 iwl3945_hw_reg_get_ch_grp_index(priv, ch_info);
1982 1982
1983 /* Get this chnlgrp's rate->max/clip-powers table */ 1983 /* Get this chnlgrp's rate->max/clip-powers table */
1984 clip_pwrs = priv->clip_groups[ch_info->group_index].clip_powers; 1984 clip_pwrs = priv->clip_groups[ch_info->group_index].clip_powers;
1985 1985
1986 /* calculate power index *adjustment* value according to 1986 /* calculate power index *adjustment* value according to
1987 * diff between current temperature and factory temperature */ 1987 * diff between current temperature and factory temperature */
1988 delta_index = iwl_hw_reg_adjust_power_by_temp(temperature, 1988 delta_index = iwl3945_hw_reg_adjust_power_by_temp(temperature,
1989 priv->eeprom.groups[ch_info->group_index]. 1989 priv->eeprom.groups[ch_info->group_index].
1990 temperature); 1990 temperature);
1991 1991
@@ -2008,7 +2008,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2008 2008
2009 /* get base (i.e. at factory-measured temperature) 2009 /* get base (i.e. at factory-measured temperature)
2010 * power table index for this rate's power */ 2010 * power table index for this rate's power */
2011 rc = iwl_hw_reg_get_matched_power_index(priv, pwr, 2011 rc = iwl3945_hw_reg_get_matched_power_index(priv, pwr,
2012 ch_info->group_index, 2012 ch_info->group_index,
2013 &power_idx); 2013 &power_idx);
2014 if (rc) { 2014 if (rc) {
@@ -2021,9 +2021,9 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2021 power_idx += delta_index; 2021 power_idx += delta_index;
2022 2022
2023 /* stay within range of gain table */ 2023 /* stay within range of gain table */
2024 power_idx = iwl_hw_reg_fix_power_index(power_idx); 2024 power_idx = iwl3945_hw_reg_fix_power_index(power_idx);
2025 2025
2026 /* fill 1 OFDM rate's iwl_channel_power_info struct */ 2026 /* fill 1 OFDM rate's iwl3945_channel_power_info struct */
2027 pwr_info->requested_power = pwr; 2027 pwr_info->requested_power = pwr;
2028 pwr_info->power_table_index = (u8) power_idx; 2028 pwr_info->power_table_index = (u8) power_idx;
2029 pwr_info->tpc.tx_gain = 2029 pwr_info->tpc.tx_gain =
@@ -2042,11 +2042,11 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2042 IWL_CCK_FROM_OFDM_INDEX_DIFF; 2042 IWL_CCK_FROM_OFDM_INDEX_DIFF;
2043 2043
2044 /* stay within table range */ 2044 /* stay within table range */
2045 pwr_index = iwl_hw_reg_fix_power_index(pwr_index); 2045 pwr_index = iwl3945_hw_reg_fix_power_index(pwr_index);
2046 gain = power_gain_table[a_band][pwr_index].tx_gain; 2046 gain = power_gain_table[a_band][pwr_index].tx_gain;
2047 dsp_atten = power_gain_table[a_band][pwr_index].dsp_atten; 2047 dsp_atten = power_gain_table[a_band][pwr_index].dsp_atten;
2048 2048
2049 /* fill each CCK rate's iwl_channel_power_info structure 2049 /* fill each CCK rate's iwl3945_channel_power_info structure
2050 * NOTE: All CCK-rate Txpwrs are the same for a given chnl! 2050 * NOTE: All CCK-rate Txpwrs are the same for a given chnl!
2051 * NOTE: CCK rates start at end of OFDM rates! */ 2051 * NOTE: CCK rates start at end of OFDM rates! */
2052 for (rate_index = 0; 2052 for (rate_index = 0;
@@ -2064,7 +2064,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2064 scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { 2064 scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) {
2065 s32 actual_index = (scan_tbl_index == 0) ? 2065 s32 actual_index = (scan_tbl_index == 0) ?
2066 IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE; 2066 IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE;
2067 iwl_hw_reg_set_scan_power(priv, scan_tbl_index, 2067 iwl3945_hw_reg_set_scan_power(priv, scan_tbl_index,
2068 actual_index, clip_pwrs, ch_info, a_band); 2068 actual_index, clip_pwrs, ch_info, a_band);
2069 } 2069 }
2070 } 2070 }
@@ -2072,66 +2072,66 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2072 return 0; 2072 return 0;
2073} 2073}
2074 2074
2075int iwl_hw_rxq_stop(struct iwl_priv *priv) 2075int iwl3945_hw_rxq_stop(struct iwl3945_priv *priv)
2076{ 2076{
2077 int rc; 2077 int rc;
2078 unsigned long flags; 2078 unsigned long flags;
2079 2079
2080 spin_lock_irqsave(&priv->lock, flags); 2080 spin_lock_irqsave(&priv->lock, flags);
2081 rc = iwl_grab_nic_access(priv); 2081 rc = iwl3945_grab_nic_access(priv);
2082 if (rc) { 2082 if (rc) {
2083 spin_unlock_irqrestore(&priv->lock, flags); 2083 spin_unlock_irqrestore(&priv->lock, flags);
2084 return rc; 2084 return rc;
2085 } 2085 }
2086 2086
2087 iwl_write_direct32(priv, FH_RCSR_CONFIG(0), 0); 2087 iwl3945_write_direct32(priv, FH_RCSR_CONFIG(0), 0);
2088 rc = iwl_poll_direct_bit(priv, FH_RSSR_STATUS, (1 << 24), 1000); 2088 rc = iwl3945_poll_direct_bit(priv, FH_RSSR_STATUS, (1 << 24), 1000);
2089 if (rc < 0) 2089 if (rc < 0)
2090 IWL_ERROR("Can't stop Rx DMA.\n"); 2090 IWL_ERROR("Can't stop Rx DMA.\n");
2091 2091
2092 iwl_release_nic_access(priv); 2092 iwl3945_release_nic_access(priv);
2093 spin_unlock_irqrestore(&priv->lock, flags); 2093 spin_unlock_irqrestore(&priv->lock, flags);
2094 2094
2095 return 0; 2095 return 0;
2096} 2096}
2097 2097
2098int iwl_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq) 2098int iwl3945_hw_tx_queue_init(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq)
2099{ 2099{
2100 int rc; 2100 int rc;
2101 unsigned long flags; 2101 unsigned long flags;
2102 int txq_id = txq->q.id; 2102 int txq_id = txq->q.id;
2103 2103
2104 struct iwl_shared *shared_data = priv->hw_setting.shared_virt; 2104 struct iwl3945_shared *shared_data = priv->hw_setting.shared_virt;
2105 2105
2106 shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr); 2106 shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr);
2107 2107
2108 spin_lock_irqsave(&priv->lock, flags); 2108 spin_lock_irqsave(&priv->lock, flags);
2109 rc = iwl_grab_nic_access(priv); 2109 rc = iwl3945_grab_nic_access(priv);
2110 if (rc) { 2110 if (rc) {
2111 spin_unlock_irqrestore(&priv->lock, flags); 2111 spin_unlock_irqrestore(&priv->lock, flags);
2112 return rc; 2112 return rc;
2113 } 2113 }
2114 iwl_write_direct32(priv, FH_CBCC_CTRL(txq_id), 0); 2114 iwl3945_write_direct32(priv, FH_CBCC_CTRL(txq_id), 0);
2115 iwl_write_direct32(priv, FH_CBCC_BASE(txq_id), 0); 2115 iwl3945_write_direct32(priv, FH_CBCC_BASE(txq_id), 0);
2116 2116
2117 iwl_write_direct32(priv, FH_TCSR_CONFIG(txq_id), 2117 iwl3945_write_direct32(priv, FH_TCSR_CONFIG(txq_id),
2118 ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT | 2118 ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT |
2119 ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF | 2119 ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF |
2120 ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD | 2120 ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD |
2121 ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL | 2121 ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL |
2122 ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE); 2122 ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE);
2123 iwl_release_nic_access(priv); 2123 iwl3945_release_nic_access(priv);
2124 2124
2125 /* fake read to flush all prev. writes */ 2125 /* fake read to flush all prev. writes */
2126 iwl_read32(priv, FH_TSSR_CBB_BASE); 2126 iwl3945_read32(priv, FH_TSSR_CBB_BASE);
2127 spin_unlock_irqrestore(&priv->lock, flags); 2127 spin_unlock_irqrestore(&priv->lock, flags);
2128 2128
2129 return 0; 2129 return 0;
2130} 2130}
2131 2131
2132int iwl_hw_get_rx_read(struct iwl_priv *priv) 2132int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv)
2133{ 2133{
2134 struct iwl_shared *shared_data = priv->hw_setting.shared_virt; 2134 struct iwl3945_shared *shared_data = priv->hw_setting.shared_virt;
2135 2135
2136 return le32_to_cpu(shared_data->rx_read_ptr[0]); 2136 return le32_to_cpu(shared_data->rx_read_ptr[0]);
2137} 2137}
@@ -2139,22 +2139,22 @@ int iwl_hw_get_rx_read(struct iwl_priv *priv)
2139/** 2139/**
2140 * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table 2140 * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table
2141 */ 2141 */
2142int iwl3945_init_hw_rate_table(struct iwl_priv *priv) 2142int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv)
2143{ 2143{
2144 int rc, i, index, prev_index; 2144 int rc, i, index, prev_index;
2145 struct iwl_rate_scaling_cmd rate_cmd = { 2145 struct iwl3945_rate_scaling_cmd rate_cmd = {
2146 .reserved = {0, 0, 0}, 2146 .reserved = {0, 0, 0},
2147 }; 2147 };
2148 struct iwl_rate_scaling_info *table = rate_cmd.table; 2148 struct iwl3945_rate_scaling_info *table = rate_cmd.table;
2149 2149
2150 for (i = 0; i < ARRAY_SIZE(iwl_rates); i++) { 2150 for (i = 0; i < ARRAY_SIZE(iwl3945_rates); i++) {
2151 index = iwl_rates[i].table_rs_index; 2151 index = iwl3945_rates[i].table_rs_index;
2152 2152
2153 table[index].rate_n_flags = 2153 table[index].rate_n_flags =
2154 iwl_hw_set_rate_n_flags(iwl_rates[i].plcp, 0); 2154 iwl3945_hw_set_rate_n_flags(iwl3945_rates[i].plcp, 0);
2155 table[index].try_cnt = priv->retry_rate; 2155 table[index].try_cnt = priv->retry_rate;
2156 prev_index = iwl_get_prev_ieee_rate(i); 2156 prev_index = iwl3945_get_prev_ieee_rate(i);
2157 table[index].next_rate_index = iwl_rates[prev_index].table_rs_index; 2157 table[index].next_rate_index = iwl3945_rates[prev_index].table_rs_index;
2158 } 2158 }
2159 2159
2160 switch (priv->phymode) { 2160 switch (priv->phymode) {
@@ -2163,14 +2163,14 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv)
2163 /* If one of the following CCK rates is used, 2163 /* If one of the following CCK rates is used,
2164 * have it fall back to the 6M OFDM rate */ 2164 * have it fall back to the 6M OFDM rate */
2165 for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++) 2165 for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++)
2166 table[i].next_rate_index = iwl_rates[IWL_FIRST_OFDM_RATE].table_rs_index; 2166 table[i].next_rate_index = iwl3945_rates[IWL_FIRST_OFDM_RATE].table_rs_index;
2167 2167
2168 /* Don't fall back to CCK rates */ 2168 /* Don't fall back to CCK rates */
2169 table[IWL_RATE_12M_INDEX_TABLE].next_rate_index = IWL_RATE_9M_INDEX_TABLE; 2169 table[IWL_RATE_12M_INDEX_TABLE].next_rate_index = IWL_RATE_9M_INDEX_TABLE;
2170 2170
2171 /* Don't drop out of OFDM rates */ 2171 /* Don't drop out of OFDM rates */
2172 table[IWL_RATE_6M_INDEX_TABLE].next_rate_index = 2172 table[IWL_RATE_6M_INDEX_TABLE].next_rate_index =
2173 iwl_rates[IWL_FIRST_OFDM_RATE].table_rs_index; 2173 iwl3945_rates[IWL_FIRST_OFDM_RATE].table_rs_index;
2174 break; 2174 break;
2175 2175
2176 case MODE_IEEE80211B: 2176 case MODE_IEEE80211B:
@@ -2178,7 +2178,7 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv)
2178 /* If an OFDM rate is used, have it fall back to the 2178 /* If an OFDM rate is used, have it fall back to the
2179 * 1M CCK rates */ 2179 * 1M CCK rates */
2180 for (i = IWL_RATE_6M_INDEX_TABLE; i <= IWL_RATE_54M_INDEX_TABLE; i++) 2180 for (i = IWL_RATE_6M_INDEX_TABLE; i <= IWL_RATE_54M_INDEX_TABLE; i++)
2181 table[i].next_rate_index = iwl_rates[IWL_FIRST_CCK_RATE].table_rs_index; 2181 table[i].next_rate_index = iwl3945_rates[IWL_FIRST_CCK_RATE].table_rs_index;
2182 2182
2183 /* CCK shouldn't fall back to OFDM... */ 2183 /* CCK shouldn't fall back to OFDM... */
2184 table[IWL_RATE_11M_INDEX_TABLE].next_rate_index = IWL_RATE_5M_INDEX_TABLE; 2184 table[IWL_RATE_11M_INDEX_TABLE].next_rate_index = IWL_RATE_5M_INDEX_TABLE;
@@ -2191,25 +2191,25 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv)
2191 2191
2192 /* Update the rate scaling for control frame Tx */ 2192 /* Update the rate scaling for control frame Tx */
2193 rate_cmd.table_id = 0; 2193 rate_cmd.table_id = 0;
2194 rc = iwl_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), 2194 rc = iwl3945_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
2195 &rate_cmd); 2195 &rate_cmd);
2196 if (rc) 2196 if (rc)
2197 return rc; 2197 return rc;
2198 2198
2199 /* Update the rate scaling for data frame Tx */ 2199 /* Update the rate scaling for data frame Tx */
2200 rate_cmd.table_id = 1; 2200 rate_cmd.table_id = 1;
2201 return iwl_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), 2201 return iwl3945_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
2202 &rate_cmd); 2202 &rate_cmd);
2203} 2203}
2204 2204
2205int iwl_hw_set_hw_setting(struct iwl_priv *priv) 2205int iwl3945_hw_set_hw_setting(struct iwl3945_priv *priv)
2206{ 2206{
2207 memset((void *)&priv->hw_setting, 0, 2207 memset((void *)&priv->hw_setting, 0,
2208 sizeof(struct iwl_driver_hw_info)); 2208 sizeof(struct iwl3945_driver_hw_info));
2209 2209
2210 priv->hw_setting.shared_virt = 2210 priv->hw_setting.shared_virt =
2211 pci_alloc_consistent(priv->pci_dev, 2211 pci_alloc_consistent(priv->pci_dev,
2212 sizeof(struct iwl_shared), 2212 sizeof(struct iwl3945_shared),
2213 &priv->hw_setting.shared_phys); 2213 &priv->hw_setting.shared_phys);
2214 2214
2215 if (!priv->hw_setting.shared_virt) { 2215 if (!priv->hw_setting.shared_virt) {
@@ -2220,7 +2220,7 @@ int iwl_hw_set_hw_setting(struct iwl_priv *priv)
2220 2220
2221 priv->hw_setting.ac_queue_count = AC_NUM; 2221 priv->hw_setting.ac_queue_count = AC_NUM;
2222 priv->hw_setting.rx_buffer_size = IWL_RX_BUF_SIZE; 2222 priv->hw_setting.rx_buffer_size = IWL_RX_BUF_SIZE;
2223 priv->hw_setting.tx_cmd_len = sizeof(struct iwl_tx_cmd); 2223 priv->hw_setting.tx_cmd_len = sizeof(struct iwl3945_tx_cmd);
2224 priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE; 2224 priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE;
2225 priv->hw_setting.max_rxq_log = RX_QUEUE_SIZE_LOG; 2225 priv->hw_setting.max_rxq_log = RX_QUEUE_SIZE_LOG;
2226 priv->hw_setting.max_stations = IWL3945_STATION_COUNT; 2226 priv->hw_setting.max_stations = IWL3945_STATION_COUNT;
@@ -2228,21 +2228,21 @@ int iwl_hw_set_hw_setting(struct iwl_priv *priv)
2228 return 0; 2228 return 0;
2229} 2229}
2230 2230
2231unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, 2231unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv,
2232 struct iwl_frame *frame, u8 rate) 2232 struct iwl3945_frame *frame, u8 rate)
2233{ 2233{
2234 struct iwl_tx_beacon_cmd *tx_beacon_cmd; 2234 struct iwl3945_tx_beacon_cmd *tx_beacon_cmd;
2235 unsigned int frame_size; 2235 unsigned int frame_size;
2236 2236
2237 tx_beacon_cmd = (struct iwl_tx_beacon_cmd *)&frame->u; 2237 tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u;
2238 memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); 2238 memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd));
2239 2239
2240 tx_beacon_cmd->tx.sta_id = IWL3945_BROADCAST_ID; 2240 tx_beacon_cmd->tx.sta_id = IWL3945_BROADCAST_ID;
2241 tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 2241 tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
2242 2242
2243 frame_size = iwl_fill_beacon_frame(priv, 2243 frame_size = iwl3945_fill_beacon_frame(priv,
2244 tx_beacon_cmd->frame, 2244 tx_beacon_cmd->frame,
2245 BROADCAST_ADDR, 2245 iwl3945_broadcast_addr,
2246 sizeof(frame->u) - sizeof(*tx_beacon_cmd)); 2246 sizeof(frame->u) - sizeof(*tx_beacon_cmd));
2247 2247
2248 BUG_ON(frame_size > MAX_MPDU_SIZE); 2248 BUG_ON(frame_size > MAX_MPDU_SIZE);
@@ -2259,35 +2259,35 @@ unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
2259 tx_beacon_cmd->tx.supp_rates[1] = 2259 tx_beacon_cmd->tx.supp_rates[1] =
2260 (IWL_CCK_BASIC_RATES_MASK & 0xF); 2260 (IWL_CCK_BASIC_RATES_MASK & 0xF);
2261 2261
2262 return (sizeof(struct iwl_tx_beacon_cmd) + frame_size); 2262 return (sizeof(struct iwl3945_tx_beacon_cmd) + frame_size);
2263} 2263}
2264 2264
2265void iwl_hw_rx_handler_setup(struct iwl_priv *priv) 2265void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv)
2266{ 2266{
2267 priv->rx_handlers[REPLY_3945_RX] = iwl3945_rx_reply_rx; 2267 priv->rx_handlers[REPLY_3945_RX] = iwl3945_rx_reply_rx;
2268} 2268}
2269 2269
2270void iwl_hw_setup_deferred_work(struct iwl_priv *priv) 2270void iwl3945_hw_setup_deferred_work(struct iwl3945_priv *priv)
2271{ 2271{
2272 INIT_DELAYED_WORK(&priv->thermal_periodic, 2272 INIT_DELAYED_WORK(&priv->thermal_periodic,
2273 iwl3945_bg_reg_txpower_periodic); 2273 iwl3945_bg_reg_txpower_periodic);
2274} 2274}
2275 2275
2276void iwl_hw_cancel_deferred_work(struct iwl_priv *priv) 2276void iwl3945_hw_cancel_deferred_work(struct iwl3945_priv *priv)
2277{ 2277{
2278 cancel_delayed_work(&priv->thermal_periodic); 2278 cancel_delayed_work(&priv->thermal_periodic);
2279} 2279}
2280 2280
2281struct pci_device_id iwl_hw_card_ids[] = { 2281struct pci_device_id iwl3945_hw_card_ids[] = {
2282 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4222)}, 2282 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4222)},
2283 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4227)}, 2283 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4227)},
2284 {0} 2284 {0}
2285}; 2285};
2286 2286
2287inline int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv) 2287inline int iwl3945_eeprom_acquire_semaphore(struct iwl3945_priv *priv)
2288{ 2288{
2289 _iwl_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK); 2289 _iwl3945_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK);
2290 return 0; 2290 return 0;
2291} 2291}
2292 2292
2293MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); 2293MODULE_DEVICE_TABLE(pci, iwl3945_hw_card_ids);
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index d1616bf9bc8e..e5b345de3c61 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -31,10 +31,10 @@
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <net/ieee80211_radiotap.h> 32#include <net/ieee80211_radiotap.h>
33 33
34struct iwl_priv; 34struct iwl3945_priv;
35 35
36/* Hardware specific file defines the PCI IDs table for that hardware module */ 36/* Hardware specific file defines the PCI IDs table for that hardware module */
37extern struct pci_device_id iwl_hw_card_ids[]; 37extern struct pci_device_id iwl3945_hw_card_ids[];
38 38
39#define DRV_NAME "iwl3945" 39#define DRV_NAME "iwl3945"
40#include "iwl-3945-hw.h" 40#include "iwl-3945-hw.h"
@@ -55,10 +55,10 @@ extern struct pci_device_id iwl_hw_card_ids[];
55#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127) 55#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127)
56 56
57/* Module parameters accessible from iwl-*.c */ 57/* Module parameters accessible from iwl-*.c */
58extern int iwl_param_hwcrypto; 58extern int iwl3945_param_hwcrypto;
59extern int iwl_param_queues_num; 59extern int iwl3945_param_queues_num;
60 60
61enum iwl_antenna { 61enum iwl3945_antenna {
62 IWL_ANTENNA_DIVERSITY, 62 IWL_ANTENNA_DIVERSITY,
63 IWL_ANTENNA_MAIN, 63 IWL_ANTENNA_MAIN,
64 IWL_ANTENNA_AUX 64 IWL_ANTENNA_AUX
@@ -81,13 +81,13 @@ enum iwl_antenna {
81#define DEFAULT_SHORT_RETRY_LIMIT 7U 81#define DEFAULT_SHORT_RETRY_LIMIT 7U
82#define DEFAULT_LONG_RETRY_LIMIT 4U 82#define DEFAULT_LONG_RETRY_LIMIT 4U
83 83
84struct iwl_rx_mem_buffer { 84struct iwl3945_rx_mem_buffer {
85 dma_addr_t dma_addr; 85 dma_addr_t dma_addr;
86 struct sk_buff *skb; 86 struct sk_buff *skb;
87 struct list_head list; 87 struct list_head list;
88}; 88};
89 89
90struct iwl_rt_rx_hdr { 90struct iwl3945_rt_rx_hdr {
91 struct ieee80211_radiotap_header rt_hdr; 91 struct ieee80211_radiotap_header rt_hdr;
92 __le64 rt_tsf; /* TSF */ 92 __le64 rt_tsf; /* TSF */
93 u8 rt_flags; /* radiotap packet flags */ 93 u8 rt_flags; /* radiotap packet flags */
@@ -100,7 +100,7 @@ struct iwl_rt_rx_hdr {
100 u8 payload[0]; /* payload... */ 100 u8 payload[0]; /* payload... */
101} __attribute__ ((packed)); 101} __attribute__ ((packed));
102 102
103struct iwl_rt_tx_hdr { 103struct iwl3945_rt_tx_hdr {
104 struct ieee80211_radiotap_header rt_hdr; 104 struct ieee80211_radiotap_header rt_hdr;
105 u8 rt_rate; /* rate in 500kb/s */ 105 u8 rt_rate; /* rate in 500kb/s */
106 __le16 rt_channel; /* channel in mHz */ 106 __le16 rt_channel; /* channel in mHz */
@@ -115,7 +115,7 @@ struct iwl_rt_tx_hdr {
115 * 115 *
116 * Contains common data for Rx and Tx queues 116 * Contains common data for Rx and Tx queues
117 */ 117 */
118struct iwl_queue { 118struct iwl3945_queue {
119 int n_bd; /* number of BDs in this queue */ 119 int n_bd; /* number of BDs in this queue */
120 int write_ptr; /* 1-st empty entry (index) host_w*/ 120 int write_ptr; /* 1-st empty entry (index) host_w*/
121 int read_ptr; /* last used entry (index) host_r*/ 121 int read_ptr; /* last used entry (index) host_r*/
@@ -130,24 +130,24 @@ struct iwl_queue {
130 130
131#define MAX_NUM_OF_TBS (20) 131#define MAX_NUM_OF_TBS (20)
132 132
133struct iwl_tx_info { 133struct iwl3945_tx_info {
134 struct ieee80211_tx_status status; 134 struct ieee80211_tx_status status;
135 struct sk_buff *skb[MAX_NUM_OF_TBS]; 135 struct sk_buff *skb[MAX_NUM_OF_TBS];
136}; 136};
137 137
138/** 138/**
139 * struct iwl_tx_queue - Tx Queue for DMA 139 * struct iwl3945_tx_queue - Tx Queue for DMA
140 * @need_update: need to update read/write index 140 * @need_update: need to update read/write index
141 * @shed_retry: queue is HT AGG enabled 141 * @shed_retry: queue is HT AGG enabled
142 * 142 *
143 * Queue consists of circular buffer of BD's and required locking structures. 143 * Queue consists of circular buffer of BD's and required locking structures.
144 */ 144 */
145struct iwl_tx_queue { 145struct iwl3945_tx_queue {
146 struct iwl_queue q; 146 struct iwl3945_queue q;
147 struct iwl_tfd_frame *bd; 147 struct iwl3945_tfd_frame *bd;
148 struct iwl_cmd *cmd; 148 struct iwl3945_cmd *cmd;
149 dma_addr_t dma_addr_cmd; 149 dma_addr_t dma_addr_cmd;
150 struct iwl_tx_info *txb; 150 struct iwl3945_tx_info *txb;
151 int need_update; 151 int need_update;
152 int sched_retry; 152 int sched_retry;
153 int active; 153 int active;
@@ -155,12 +155,12 @@ struct iwl_tx_queue {
155 155
156#define IWL_NUM_SCAN_RATES (2) 156#define IWL_NUM_SCAN_RATES (2)
157 157
158struct iwl_channel_tgd_info { 158struct iwl3945_channel_tgd_info {
159 u8 type; 159 u8 type;
160 s8 max_power; 160 s8 max_power;
161}; 161};
162 162
163struct iwl_channel_tgh_info { 163struct iwl3945_channel_tgh_info {
164 s64 last_radar_time; 164 s64 last_radar_time;
165}; 165};
166 166
@@ -171,8 +171,8 @@ struct iwl_channel_tgh_info {
171 * -- spectrum management 171 * -- spectrum management
172 * -- user preference (e.g. iwconfig) 172 * -- user preference (e.g. iwconfig)
173 * when requested power is set, base power index must also be set. */ 173 * when requested power is set, base power index must also be set. */
174struct iwl_channel_power_info { 174struct iwl3945_channel_power_info {
175 struct iwl_tx_power tpc; /* actual radio and DSP gain settings */ 175 struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */
176 s8 power_table_index; /* actual (compenst'd) index into gain table */ 176 s8 power_table_index; /* actual (compenst'd) index into gain table */
177 s8 base_power_index; /* gain index for power at factory temp. */ 177 s8 base_power_index; /* gain index for power at factory temp. */
178 s8 requested_power; /* power (dBm) requested for this chnl/rate */ 178 s8 requested_power; /* power (dBm) requested for this chnl/rate */
@@ -180,8 +180,8 @@ struct iwl_channel_power_info {
180 180
181/* current scan Tx power values to use, one for each scan rate for each 181/* current scan Tx power values to use, one for each scan rate for each
182 * channel. */ 182 * channel. */
183struct iwl_scan_power_info { 183struct iwl3945_scan_power_info {
184 struct iwl_tx_power tpc; /* actual radio and DSP gain settings */ 184 struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */
185 s8 power_table_index; /* actual (compenst'd) index into gain table */ 185 s8 power_table_index; /* actual (compenst'd) index into gain table */
186 s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */ 186 s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */
187}; 187};
@@ -201,11 +201,11 @@ struct iwl_scan_power_info {
201 */ 201 */
202#define IWL4965_MAX_RATE (33) 202#define IWL4965_MAX_RATE (33)
203 203
204struct iwl_channel_info { 204struct iwl3945_channel_info {
205 struct iwl_channel_tgd_info tgd; 205 struct iwl3945_channel_tgd_info tgd;
206 struct iwl_channel_tgh_info tgh; 206 struct iwl3945_channel_tgh_info tgh;
207 struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */ 207 struct iwl3945_eeprom_channel eeprom; /* EEPROM regulatory limit */
208 struct iwl_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for 208 struct iwl3945_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for
209 * FAT channel */ 209 * FAT channel */
210 210
211 u8 channel; /* channel number */ 211 u8 channel; /* channel number */
@@ -222,13 +222,13 @@ struct iwl_channel_info {
222 /* Radio/DSP gain settings for each "normal" data Tx rate. 222 /* Radio/DSP gain settings for each "normal" data Tx rate.
223 * These include, in addition to RF and DSP gain, a few fields for 223 * These include, in addition to RF and DSP gain, a few fields for
224 * remembering/modifying gain settings (indexes). */ 224 * remembering/modifying gain settings (indexes). */
225 struct iwl_channel_power_info power_info[IWL4965_MAX_RATE]; 225 struct iwl3945_channel_power_info power_info[IWL4965_MAX_RATE];
226 226
227 /* Radio/DSP gain settings for each scan rate, for directed scans. */ 227 /* Radio/DSP gain settings for each scan rate, for directed scans. */
228 struct iwl_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES]; 228 struct iwl3945_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES];
229}; 229};
230 230
231struct iwl_clip_group { 231struct iwl3945_clip_group {
232 /* maximum power level to prevent clipping for each rate, derived by 232 /* maximum power level to prevent clipping for each rate, derived by
233 * us from this band's saturation power in EEPROM */ 233 * us from this band's saturation power in EEPROM */
234 const s8 clip_powers[IWL_MAX_RATES]; 234 const s8 clip_powers[IWL_MAX_RATES];
@@ -249,8 +249,8 @@ struct iwl_clip_group {
249 249
250/* Power management (not Tx power) structures */ 250/* Power management (not Tx power) structures */
251 251
252struct iwl_power_vec_entry { 252struct iwl3945_power_vec_entry {
253 struct iwl_powertable_cmd cmd; 253 struct iwl3945_powertable_cmd cmd;
254 u8 no_dtim; 254 u8 no_dtim;
255}; 255};
256#define IWL_POWER_RANGE_0 (0) 256#define IWL_POWER_RANGE_0 (0)
@@ -266,10 +266,10 @@ struct iwl_power_vec_entry {
266#define IWL_POWER_ENABLED 0x10 266#define IWL_POWER_ENABLED 0x10
267#define IWL_POWER_LEVEL(x) ((x) & IWL_POWER_MASK) 267#define IWL_POWER_LEVEL(x) ((x) & IWL_POWER_MASK)
268 268
269struct iwl_power_mgr { 269struct iwl3945_power_mgr {
270 spinlock_t lock; 270 spinlock_t lock;
271 struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC]; 271 struct iwl3945_power_vec_entry pwr_range_0[IWL_POWER_AC];
272 struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC]; 272 struct iwl3945_power_vec_entry pwr_range_1[IWL_POWER_AC];
273 u8 active_index; 273 u8 active_index;
274 u32 dtim_val; 274 u32 dtim_val;
275}; 275};
@@ -279,10 +279,10 @@ struct iwl_power_mgr {
279#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) 279#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
280#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) 280#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
281 281
282struct iwl_frame { 282struct iwl3945_frame {
283 union { 283 union {
284 struct ieee80211_hdr frame; 284 struct ieee80211_hdr frame;
285 struct iwl_tx_beacon_cmd beacon; 285 struct iwl3945_tx_beacon_cmd beacon;
286 u8 raw[IEEE80211_FRAME_LEN]; 286 u8 raw[IEEE80211_FRAME_LEN];
287 u8 cmd[360]; 287 u8 cmd[360];
288 } u; 288 } u;
@@ -308,15 +308,15 @@ enum {
308 CMD_WANT_SKB = (1 << 2), 308 CMD_WANT_SKB = (1 << 2),
309}; 309};
310 310
311struct iwl_cmd; 311struct iwl3945_cmd;
312struct iwl_priv; 312struct iwl3945_priv;
313 313
314struct iwl_cmd_meta { 314struct iwl3945_cmd_meta {
315 struct iwl_cmd_meta *source; 315 struct iwl3945_cmd_meta *source;
316 union { 316 union {
317 struct sk_buff *skb; 317 struct sk_buff *skb;
318 int (*callback)(struct iwl_priv *priv, 318 int (*callback)(struct iwl3945_priv *priv,
319 struct iwl_cmd *cmd, struct sk_buff *skb); 319 struct iwl3945_cmd *cmd, struct sk_buff *skb);
320 } __attribute__ ((packed)) u; 320 } __attribute__ ((packed)) u;
321 321
322 /* The CMD_SIZE_HUGE flag bit indicates that the command 322 /* The CMD_SIZE_HUGE flag bit indicates that the command
@@ -325,37 +325,37 @@ struct iwl_cmd_meta {
325 325
326} __attribute__ ((packed)); 326} __attribute__ ((packed));
327 327
328struct iwl_cmd { 328struct iwl3945_cmd {
329 struct iwl_cmd_meta meta; 329 struct iwl3945_cmd_meta meta;
330 struct iwl_cmd_header hdr; 330 struct iwl3945_cmd_header hdr;
331 union { 331 union {
332 struct iwl_addsta_cmd addsta; 332 struct iwl3945_addsta_cmd addsta;
333 struct iwl_led_cmd led; 333 struct iwl3945_led_cmd led;
334 u32 flags; 334 u32 flags;
335 u8 val8; 335 u8 val8;
336 u16 val16; 336 u16 val16;
337 u32 val32; 337 u32 val32;
338 struct iwl_bt_cmd bt; 338 struct iwl3945_bt_cmd bt;
339 struct iwl_rxon_time_cmd rxon_time; 339 struct iwl3945_rxon_time_cmd rxon_time;
340 struct iwl_powertable_cmd powertable; 340 struct iwl3945_powertable_cmd powertable;
341 struct iwl_qosparam_cmd qosparam; 341 struct iwl3945_qosparam_cmd qosparam;
342 struct iwl_tx_cmd tx; 342 struct iwl3945_tx_cmd tx;
343 struct iwl_tx_beacon_cmd tx_beacon; 343 struct iwl3945_tx_beacon_cmd tx_beacon;
344 struct iwl_rxon_assoc_cmd rxon_assoc; 344 struct iwl3945_rxon_assoc_cmd rxon_assoc;
345 u8 *indirect; 345 u8 *indirect;
346 u8 payload[360]; 346 u8 payload[360];
347 } __attribute__ ((packed)) cmd; 347 } __attribute__ ((packed)) cmd;
348} __attribute__ ((packed)); 348} __attribute__ ((packed));
349 349
350struct iwl_host_cmd { 350struct iwl3945_host_cmd {
351 u8 id; 351 u8 id;
352 u16 len; 352 u16 len;
353 struct iwl_cmd_meta meta; 353 struct iwl3945_cmd_meta meta;
354 const void *data; 354 const void *data;
355}; 355};
356 356
357#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \ 357#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl3945_cmd) - \
358 sizeof(struct iwl_cmd_meta)) 358 sizeof(struct iwl3945_cmd_meta))
359 359
360/* 360/*
361 * RX related structures and functions 361 * RX related structures and functions
@@ -368,7 +368,7 @@ struct iwl_host_cmd {
368#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 368#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
369 369
370/** 370/**
371 * struct iwl_rx_queue - Rx queue 371 * struct iwl3945_rx_queue - Rx queue
372 * @processed: Internal index to last handled Rx packet 372 * @processed: Internal index to last handled Rx packet
373 * @read: Shared index to newest available Rx buffer 373 * @read: Shared index to newest available Rx buffer
374 * @write: Shared index to oldest written Rx packet 374 * @write: Shared index to oldest written Rx packet
@@ -377,13 +377,13 @@ struct iwl_host_cmd {
377 * @rx_used: List of Rx buffers with no SKB 377 * @rx_used: List of Rx buffers with no SKB
378 * @need_update: flag to indicate we need to update read/write index 378 * @need_update: flag to indicate we need to update read/write index
379 * 379 *
380 * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers 380 * NOTE: rx_free and rx_used are used as a FIFO for iwl3945_rx_mem_buffers
381 */ 381 */
382struct iwl_rx_queue { 382struct iwl3945_rx_queue {
383 __le32 *bd; 383 __le32 *bd;
384 dma_addr_t dma_addr; 384 dma_addr_t dma_addr;
385 struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; 385 struct iwl3945_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
386 struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE]; 386 struct iwl3945_rx_mem_buffer *queue[RX_QUEUE_SIZE];
387 u32 processed; 387 u32 processed;
388 u32 read; 388 u32 read;
389 u32 write; 389 u32 write;
@@ -427,17 +427,17 @@ struct iwl_rx_queue {
427#define IWL_INVALID_RATE 0xFF 427#define IWL_INVALID_RATE 0xFF
428#define IWL_INVALID_VALUE -1 428#define IWL_INVALID_VALUE -1
429 429
430struct iwl_tid_data { 430struct iwl3945_tid_data {
431 u16 seq_number; 431 u16 seq_number;
432}; 432};
433 433
434struct iwl_hw_key { 434struct iwl3945_hw_key {
435 enum ieee80211_key_alg alg; 435 enum ieee80211_key_alg alg;
436 int keylen; 436 int keylen;
437 u8 key[32]; 437 u8 key[32];
438}; 438};
439 439
440union iwl_ht_rate_supp { 440union iwl3945_ht_rate_supp {
441 u16 rates; 441 u16 rates;
442 struct { 442 struct {
443 u8 siso_rate; 443 u8 siso_rate;
@@ -472,7 +472,7 @@ struct sta_ht_info {
472 472
473#ifdef CONFIG_IWL3945_QOS 473#ifdef CONFIG_IWL3945_QOS
474 474
475union iwl_qos_capabity { 475union iwl3945_qos_capabity {
476 struct { 476 struct {
477 u8 edca_count:4; /* bit 0-3 */ 477 u8 edca_count:4; /* bit 0-3 */
478 u8 q_ack:1; /* bit 4 */ 478 u8 q_ack:1; /* bit 4 */
@@ -493,20 +493,20 @@ union iwl_qos_capabity {
493}; 493};
494 494
495/* QoS structures */ 495/* QoS structures */
496struct iwl_qos_info { 496struct iwl3945_qos_info {
497 int qos_enable; 497 int qos_enable;
498 int qos_active; 498 int qos_active;
499 union iwl_qos_capabity qos_cap; 499 union iwl3945_qos_capabity qos_cap;
500 struct iwl_qosparam_cmd def_qos_parm; 500 struct iwl3945_qosparam_cmd def_qos_parm;
501}; 501};
502#endif /*CONFIG_IWL3945_QOS */ 502#endif /*CONFIG_IWL3945_QOS */
503 503
504#define STA_PS_STATUS_WAKE 0 504#define STA_PS_STATUS_WAKE 0
505#define STA_PS_STATUS_SLEEP 1 505#define STA_PS_STATUS_SLEEP 1
506 506
507struct iwl_station_entry { 507struct iwl3945_station_entry {
508 struct iwl_addsta_cmd sta; 508 struct iwl3945_addsta_cmd sta;
509 struct iwl_tid_data tid[MAX_TID_COUNT]; 509 struct iwl3945_tid_data tid[MAX_TID_COUNT];
510 union { 510 union {
511 struct { 511 struct {
512 u8 rate; 512 u8 rate;
@@ -516,7 +516,7 @@ struct iwl_station_entry {
516 } current_rate; 516 } current_rate;
517 u8 used; 517 u8 used;
518 u8 ps_status; 518 u8 ps_status;
519 struct iwl_hw_key keyinfo; 519 struct iwl3945_hw_key keyinfo;
520}; 520};
521 521
522/* one for each uCode image (inst/data, boot/init/runtime) */ 522/* one for each uCode image (inst/data, boot/init/runtime) */
@@ -527,7 +527,7 @@ struct fw_desc {
527}; 527};
528 528
529/* uCode file layout */ 529/* uCode file layout */
530struct iwl_ucode { 530struct iwl3945_ucode {
531 __le32 ver; /* major/minor/subminor */ 531 __le32 ver; /* major/minor/subminor */
532 __le32 inst_size; /* bytes of runtime instructions */ 532 __le32 inst_size; /* bytes of runtime instructions */
533 __le32 data_size; /* bytes of runtime data */ 533 __le32 data_size; /* bytes of runtime data */
@@ -539,7 +539,7 @@ struct iwl_ucode {
539 539
540#define IWL_IBSS_MAC_HASH_SIZE 32 540#define IWL_IBSS_MAC_HASH_SIZE 32
541 541
542struct iwl_ibss_seq { 542struct iwl3945_ibss_seq {
543 u8 mac[ETH_ALEN]; 543 u8 mac[ETH_ALEN];
544 u16 seq_num; 544 u16 seq_num;
545 u16 frag_num; 545 u16 frag_num;
@@ -547,7 +547,7 @@ struct iwl_ibss_seq {
547 struct list_head list; 547 struct list_head list;
548}; 548};
549 549
550struct iwl_driver_hw_info { 550struct iwl3945_driver_hw_info {
551 u16 max_txq_num; 551 u16 max_txq_num;
552 u16 ac_queue_count; 552 u16 ac_queue_count;
553 u16 tx_cmd_len; 553 u16 tx_cmd_len;
@@ -573,10 +573,10 @@ struct iwl_driver_hw_info {
573#define HT_SHORT_GI_40MHZ_ONLY (1 << 1) 573#define HT_SHORT_GI_40MHZ_ONLY (1 << 1)
574 574
575 575
576#define IWL_RX_HDR(x) ((struct iwl_rx_frame_hdr *)(\ 576#define IWL_RX_HDR(x) ((struct iwl3945_rx_frame_hdr *)(\
577 x->u.rx_frame.stats.payload + \ 577 x->u.rx_frame.stats.payload + \
578 x->u.rx_frame.stats.phy_count)) 578 x->u.rx_frame.stats.phy_count))
579#define IWL_RX_END(x) ((struct iwl_rx_frame_end *)(\ 579#define IWL_RX_END(x) ((struct iwl3945_rx_frame_end *)(\
580 IWL_RX_HDR(x)->payload + \ 580 IWL_RX_HDR(x)->payload + \
581 le16_to_cpu(IWL_RX_HDR(x)->len))) 581 le16_to_cpu(IWL_RX_HDR(x)->len)))
582#define IWL_RX_STATS(x) (&x->u.rx_frame.stats) 582#define IWL_RX_STATS(x) (&x->u.rx_frame.stats)
@@ -589,61 +589,61 @@ struct iwl_driver_hw_info {
589 * for use by iwl-*.c 589 * for use by iwl-*.c
590 * 590 *
591 *****************************************************************************/ 591 *****************************************************************************/
592struct iwl_addsta_cmd; 592struct iwl3945_addsta_cmd;
593extern int iwl_send_add_station(struct iwl_priv *priv, 593extern int iwl3945_send_add_station(struct iwl3945_priv *priv,
594 struct iwl_addsta_cmd *sta, u8 flags); 594 struct iwl3945_addsta_cmd *sta, u8 flags);
595extern u8 iwl_add_station(struct iwl_priv *priv, const u8 *bssid, 595extern u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *bssid,
596 int is_ap, u8 flags); 596 int is_ap, u8 flags);
597extern int iwl_is_network_packet(struct iwl_priv *priv, 597extern int iwl3945_is_network_packet(struct iwl3945_priv *priv,
598 struct ieee80211_hdr *header); 598 struct ieee80211_hdr *header);
599extern int iwl_power_init_handle(struct iwl_priv *priv); 599extern int iwl3945_power_init_handle(struct iwl3945_priv *priv);
600extern int iwl_eeprom_init(struct iwl_priv *priv); 600extern int iwl3945_eeprom_init(struct iwl3945_priv *priv);
601#ifdef CONFIG_IWL3945_DEBUG 601#ifdef CONFIG_IWL3945_DEBUG
602extern void iwl_report_frame(struct iwl_priv *priv, 602extern void iwl3945_report_frame(struct iwl3945_priv *priv,
603 struct iwl_rx_packet *pkt, 603 struct iwl3945_rx_packet *pkt,
604 struct ieee80211_hdr *header, int group100); 604 struct ieee80211_hdr *header, int group100);
605#else 605#else
606static inline void iwl_report_frame(struct iwl_priv *priv, 606static inline void iwl3945_report_frame(struct iwl3945_priv *priv,
607 struct iwl_rx_packet *pkt, 607 struct iwl3945_rx_packet *pkt,
608 struct ieee80211_hdr *header, 608 struct ieee80211_hdr *header,
609 int group100) {} 609 int group100) {}
610#endif 610#endif
611extern void iwl_handle_data_packet_monitor(struct iwl_priv *priv, 611extern void iwl3945_handle_data_packet_monitor(struct iwl3945_priv *priv,
612 struct iwl_rx_mem_buffer *rxb, 612 struct iwl3945_rx_mem_buffer *rxb,
613 void *data, short len, 613 void *data, short len,
614 struct ieee80211_rx_status *stats, 614 struct ieee80211_rx_status *stats,
615 u16 phy_flags); 615 u16 phy_flags);
616extern int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr 616extern int iwl3945_is_duplicate_packet(struct iwl3945_priv *priv,
617 *header); 617 struct ieee80211_hdr *header);
618extern int iwl_rx_queue_alloc(struct iwl_priv *priv); 618extern int iwl3945_rx_queue_alloc(struct iwl3945_priv *priv);
619extern void iwl_rx_queue_reset(struct iwl_priv *priv, 619extern void iwl3945_rx_queue_reset(struct iwl3945_priv *priv,
620 struct iwl_rx_queue *rxq); 620 struct iwl3945_rx_queue *rxq);
621extern int iwl_calc_db_from_ratio(int sig_ratio); 621extern int iwl3945_calc_db_from_ratio(int sig_ratio);
622extern int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm); 622extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm);
623extern int iwl_tx_queue_init(struct iwl_priv *priv, 623extern int iwl3945_tx_queue_init(struct iwl3945_priv *priv,
624 struct iwl_tx_queue *txq, int count, u32 id); 624 struct iwl3945_tx_queue *txq, int count, u32 id);
625extern void iwl_rx_replenish(void *data); 625extern void iwl3945_rx_replenish(void *data);
626extern void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq); 626extern void iwl3945_tx_queue_free(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq);
627extern int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, 627extern int iwl3945_send_cmd_pdu(struct iwl3945_priv *priv, u8 id, u16 len,
628 const void *data); 628 const void *data);
629extern int __must_check iwl_send_cmd(struct iwl_priv *priv, 629extern int __must_check iwl3945_send_cmd(struct iwl3945_priv *priv,
630 struct iwl_host_cmd *cmd); 630 struct iwl3945_host_cmd *cmd);
631extern unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, 631extern unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv,
632 struct ieee80211_hdr *hdr, 632 struct ieee80211_hdr *hdr,
633 const u8 *dest, int left); 633 const u8 *dest, int left);
634extern int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, 634extern int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv,
635 struct iwl_rx_queue *q); 635 struct iwl3945_rx_queue *q);
636extern int iwl_send_statistics_request(struct iwl_priv *priv); 636extern int iwl3945_send_statistics_request(struct iwl3945_priv *priv);
637extern void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, 637extern void iwl3945_set_decrypted_flag(struct iwl3945_priv *priv, struct sk_buff *skb,
638 u32 decrypt_res, 638 u32 decrypt_res,
639 struct ieee80211_rx_status *stats); 639 struct ieee80211_rx_status *stats);
640extern const u8 BROADCAST_ADDR[ETH_ALEN]; 640extern const u8 iwl3945_broadcast_addr[ETH_ALEN];
641 641
642/* 642/*
643 * Currently used by iwl-3945-rs... look at restructuring so that it doesn't 643 * Currently used by iwl-3945-rs... look at restructuring so that it doesn't
644 * call this... todo... fix that. 644 * call this... todo... fix that.
645*/ 645*/
646extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id, 646extern u8 iwl3945_sync_station(struct iwl3945_priv *priv, int sta_id,
647 u16 tx_rate, u8 flags); 647 u16 tx_rate, u8 flags);
648 648
649/****************************************************************************** 649/******************************************************************************
@@ -655,65 +655,65 @@ extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id,
655 * which is why they are in the hardware specific files (vs. iwl-base.c) 655 * which is why they are in the hardware specific files (vs. iwl-base.c)
656 * 656 *
657 * Naming convention -- 657 * Naming convention --
658 * iwl_ <-- Its part of iwlwifi (should be changed to iwl_) 658 * iwl3945_ <-- Its part of iwlwifi (should be changed to iwl3945_)
659 * iwl_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) 659 * iwl3945_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW)
660 * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) 660 * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
661 * iwl_bg_ <-- Called from work queue context 661 * iwl3945_bg_ <-- Called from work queue context
662 * iwl_mac_ <-- mac80211 callback 662 * iwl3945_mac_ <-- mac80211 callback
663 * 663 *
664 ****************************************************************************/ 664 ****************************************************************************/
665extern void iwl_hw_rx_handler_setup(struct iwl_priv *priv); 665extern void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv);
666extern void iwl_hw_setup_deferred_work(struct iwl_priv *priv); 666extern void iwl3945_hw_setup_deferred_work(struct iwl3945_priv *priv);
667extern void iwl_hw_cancel_deferred_work(struct iwl_priv *priv); 667extern void iwl3945_hw_cancel_deferred_work(struct iwl3945_priv *priv);
668extern int iwl_hw_rxq_stop(struct iwl_priv *priv); 668extern int iwl3945_hw_rxq_stop(struct iwl3945_priv *priv);
669extern int iwl_hw_set_hw_setting(struct iwl_priv *priv); 669extern int iwl3945_hw_set_hw_setting(struct iwl3945_priv *priv);
670extern int iwl_hw_nic_init(struct iwl_priv *priv); 670extern int iwl3945_hw_nic_init(struct iwl3945_priv *priv);
671extern int iwl_hw_nic_stop_master(struct iwl_priv *priv); 671extern int iwl3945_hw_nic_stop_master(struct iwl3945_priv *priv);
672extern void iwl_hw_txq_ctx_free(struct iwl_priv *priv); 672extern void iwl3945_hw_txq_ctx_free(struct iwl3945_priv *priv);
673extern void iwl_hw_txq_ctx_stop(struct iwl_priv *priv); 673extern void iwl3945_hw_txq_ctx_stop(struct iwl3945_priv *priv);
674extern int iwl_hw_nic_reset(struct iwl_priv *priv); 674extern int iwl3945_hw_nic_reset(struct iwl3945_priv *priv);
675extern int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd, 675extern int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl3945_priv *priv, void *tfd,
676 dma_addr_t addr, u16 len); 676 dma_addr_t addr, u16 len);
677extern int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq); 677extern int iwl3945_hw_txq_free_tfd(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq);
678extern int iwl_hw_get_temperature(struct iwl_priv *priv); 678extern int iwl3945_hw_get_temperature(struct iwl3945_priv *priv);
679extern int iwl_hw_tx_queue_init(struct iwl_priv *priv, 679extern int iwl3945_hw_tx_queue_init(struct iwl3945_priv *priv,
680 struct iwl_tx_queue *txq); 680 struct iwl3945_tx_queue *txq);
681extern unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, 681extern unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv,
682 struct iwl_frame *frame, u8 rate); 682 struct iwl3945_frame *frame, u8 rate);
683extern int iwl_hw_get_rx_read(struct iwl_priv *priv); 683extern int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv);
684extern void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, 684extern void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
685 struct iwl_cmd *cmd, 685 struct iwl3945_cmd *cmd,
686 struct ieee80211_tx_control *ctrl, 686 struct ieee80211_tx_control *ctrl,
687 struct ieee80211_hdr *hdr, 687 struct ieee80211_hdr *hdr,
688 int sta_id, int tx_id); 688 int sta_id, int tx_id);
689extern int iwl_hw_reg_send_txpower(struct iwl_priv *priv); 689extern int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv);
690extern int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power); 690extern int iwl3945_hw_reg_set_txpower(struct iwl3945_priv *priv, s8 power);
691extern void iwl_hw_rx_statistics(struct iwl_priv *priv, 691extern void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv,
692 struct iwl_rx_mem_buffer *rxb); 692 struct iwl3945_rx_mem_buffer *rxb);
693extern void iwl_disable_events(struct iwl_priv *priv); 693extern void iwl3945_disable_events(struct iwl3945_priv *priv);
694extern int iwl4965_get_temperature(const struct iwl_priv *priv); 694extern int iwl4965_get_temperature(const struct iwl3945_priv *priv);
695 695
696/** 696/**
697 * iwl_hw_find_station - Find station id for a given BSSID 697 * iwl3945_hw_find_station - Find station id for a given BSSID
698 * @bssid: MAC address of station ID to find 698 * @bssid: MAC address of station ID to find
699 * 699 *
700 * NOTE: This should not be hardware specific but the code has 700 * NOTE: This should not be hardware specific but the code has
701 * not yet been merged into a single common layer for managing the 701 * not yet been merged into a single common layer for managing the
702 * station tables. 702 * station tables.
703 */ 703 */
704extern u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *bssid); 704extern u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *bssid);
705 705
706extern int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel); 706extern int iwl3945_hw_channel_switch(struct iwl3945_priv *priv, u16 channel);
707 707
708/* 708/*
709 * Forward declare iwl-3945.c functions for iwl-base.c 709 * Forward declare iwl-3945.c functions for iwl-base.c
710 */ 710 */
711extern int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv); 711extern int iwl3945_eeprom_acquire_semaphore(struct iwl3945_priv *priv);
712extern __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv); 712extern __le32 iwl3945_get_antenna_flags(const struct iwl3945_priv *priv);
713extern int iwl3945_init_hw_rate_table(struct iwl_priv *priv); 713extern int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv);
714extern void iwl3945_reg_txpower_periodic(struct iwl_priv *priv); 714extern void iwl3945_reg_txpower_periodic(struct iwl3945_priv *priv);
715extern int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv); 715extern int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv);
716extern u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, 716extern u8 iwl3945_sync_sta(struct iwl3945_priv *priv, int sta_id,
717 u16 tx_rate, u8 flags); 717 u16 tx_rate, u8 flags);
718 718
719 719
@@ -726,7 +726,7 @@ enum {
726 726
727#endif 727#endif
728 728
729struct iwl_priv { 729struct iwl3945_priv {
730 730
731 /* ieee device used by generic ieee processing code */ 731 /* ieee device used by generic ieee processing code */
732 struct ieee80211_hw *hw; 732 struct ieee80211_hw *hw;
@@ -740,27 +740,27 @@ struct iwl_priv {
740 u8 phymode; 740 u8 phymode;
741 int alloc_rxb_skb; 741 int alloc_rxb_skb;
742 742
743 void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, 743 void (*rx_handlers[REPLY_MAX])(struct iwl3945_priv *priv,
744 struct iwl_rx_mem_buffer *rxb); 744 struct iwl3945_rx_mem_buffer *rxb);
745 745
746 const struct ieee80211_hw_mode *modes; 746 const struct ieee80211_hw_mode *modes;
747 747
748#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT 748#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
749 /* spectrum measurement report caching */ 749 /* spectrum measurement report caching */
750 struct iwl_spectrum_notification measure_report; 750 struct iwl3945_spectrum_notification measure_report;
751 u8 measurement_status; 751 u8 measurement_status;
752#endif 752#endif
753 /* ucode beacon time */ 753 /* ucode beacon time */
754 u32 ucode_beacon_time; 754 u32 ucode_beacon_time;
755 755
756 /* we allocate array of iwl_channel_info for NIC's valid channels. 756 /* we allocate array of iwl3945_channel_info for NIC's valid channels.
757 * Access via channel # using indirect index array */ 757 * Access via channel # using indirect index array */
758 struct iwl_channel_info *channel_info; /* channel info array */ 758 struct iwl3945_channel_info *channel_info; /* channel info array */
759 u8 channel_count; /* # of channels */ 759 u8 channel_count; /* # of channels */
760 760
761 /* each calibration channel group in the EEPROM has a derived 761 /* each calibration channel group in the EEPROM has a derived
762 * clip setting for each rate. */ 762 * clip setting for each rate. */
763 const struct iwl_clip_group clip_groups[5]; 763 const struct iwl3945_clip_group clip_groups[5];
764 764
765 /* thermal calibration */ 765 /* thermal calibration */
766 s32 temperature; /* degrees Kelvin */ 766 s32 temperature; /* degrees Kelvin */
@@ -775,7 +775,7 @@ struct iwl_priv {
775 int one_direct_scan; 775 int one_direct_scan;
776 u8 direct_ssid_len; 776 u8 direct_ssid_len;
777 u8 direct_ssid[IW_ESSID_MAX_SIZE]; 777 u8 direct_ssid[IW_ESSID_MAX_SIZE];
778 struct iwl_scan_cmd *scan; 778 struct iwl3945_scan_cmd *scan;
779 u8 only_active_channel; 779 u8 only_active_channel;
780 780
781 /* spinlock */ 781 /* spinlock */
@@ -798,26 +798,26 @@ struct iwl_priv {
798 struct fw_desc ucode_boot; /* bootstrap inst */ 798 struct fw_desc ucode_boot; /* bootstrap inst */
799 799
800 800
801 struct iwl_rxon_time_cmd rxon_timing; 801 struct iwl3945_rxon_time_cmd rxon_timing;
802 802
803 /* We declare this const so it can only be 803 /* We declare this const so it can only be
804 * changed via explicit cast within the 804 * changed via explicit cast within the
805 * routines that actually update the physical 805 * routines that actually update the physical
806 * hardware */ 806 * hardware */
807 const struct iwl_rxon_cmd active_rxon; 807 const struct iwl3945_rxon_cmd active_rxon;
808 struct iwl_rxon_cmd staging_rxon; 808 struct iwl3945_rxon_cmd staging_rxon;
809 809
810 int error_recovering; 810 int error_recovering;
811 struct iwl_rxon_cmd recovery_rxon; 811 struct iwl3945_rxon_cmd recovery_rxon;
812 812
813 /* 1st responses from initialize and runtime uCode images. 813 /* 1st responses from initialize and runtime uCode images.
814 * 4965's initialize alive response contains some calibration data. */ 814 * 4965's initialize alive response contains some calibration data. */
815 struct iwl_init_alive_resp card_alive_init; 815 struct iwl3945_init_alive_resp card_alive_init;
816 struct iwl_alive_resp card_alive; 816 struct iwl3945_alive_resp card_alive;
817 817
818#ifdef LED 818#ifdef LED
819 /* LED related variables */ 819 /* LED related variables */
820 struct iwl_activity_blink activity; 820 struct iwl3945_activity_blink activity;
821 unsigned long led_packets; 821 unsigned long led_packets;
822 int led_state; 822 int led_state;
823#endif 823#endif
@@ -836,8 +836,8 @@ struct iwl_priv {
836 int activity_timer_active; 836 int activity_timer_active;
837 837
838 /* Rx and Tx DMA processing queues */ 838 /* Rx and Tx DMA processing queues */
839 struct iwl_rx_queue rxq; 839 struct iwl3945_rx_queue rxq;
840 struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES]; 840 struct iwl3945_tx_queue txq[IWL_MAX_NUM_QUEUES];
841 841
842 unsigned long status; 842 unsigned long status;
843 u32 config; 843 u32 config;
@@ -845,9 +845,9 @@ struct iwl_priv {
845 int last_rx_rssi; /* From Rx packet statisitics */ 845 int last_rx_rssi; /* From Rx packet statisitics */
846 int last_rx_noise; /* From beacon statistics */ 846 int last_rx_noise; /* From beacon statistics */
847 847
848 struct iwl_power_mgr power_data; 848 struct iwl3945_power_mgr power_data;
849 849
850 struct iwl_notif_statistics statistics; 850 struct iwl3945_notif_statistics statistics;
851 unsigned long last_statistics_time; 851 unsigned long last_statistics_time;
852 852
853 /* context information */ 853 /* context information */
@@ -864,7 +864,7 @@ struct iwl_priv {
864 /*station table variables */ 864 /*station table variables */
865 spinlock_t sta_lock; 865 spinlock_t sta_lock;
866 int num_stations; 866 int num_stations;
867 struct iwl_station_entry stations[IWL_STATION_COUNT]; 867 struct iwl3945_station_entry stations[IWL_STATION_COUNT];
868 868
869 /* Indication if ieee80211_ops->open has been called */ 869 /* Indication if ieee80211_ops->open has been called */
870 int is_open; 870 int is_open;
@@ -885,7 +885,7 @@ struct iwl_priv {
885 struct list_head ibss_mac_hash[IWL_IBSS_MAC_HASH_SIZE]; 885 struct list_head ibss_mac_hash[IWL_IBSS_MAC_HASH_SIZE];
886 886
887 /* eeprom */ 887 /* eeprom */
888 struct iwl_eeprom eeprom; 888 struct iwl3945_eeprom eeprom;
889 889
890 int iw_mode; 890 int iw_mode;
891 891
@@ -895,7 +895,7 @@ struct iwl_priv {
895 u32 timestamp0; 895 u32 timestamp0;
896 u32 timestamp1; 896 u32 timestamp1;
897 u16 beacon_int; 897 u16 beacon_int;
898 struct iwl_driver_hw_info hw_setting; 898 struct iwl3945_driver_hw_info hw_setting;
899 int interface_id; 899 int interface_id;
900 900
901 /* Current association information needed to configure the 901 /* Current association information needed to configure the
@@ -905,7 +905,7 @@ struct iwl_priv {
905 u8 ps_mode; 905 u8 ps_mode;
906 906
907#ifdef CONFIG_IWL3945_QOS 907#ifdef CONFIG_IWL3945_QOS
908 struct iwl_qos_info qos_data; 908 struct iwl3945_qos_info qos_data;
909#endif /*CONFIG_IWL3945_QOS */ 909#endif /*CONFIG_IWL3945_QOS */
910 910
911 struct workqueue_struct *workqueue; 911 struct workqueue_struct *workqueue;
@@ -946,55 +946,55 @@ struct iwl_priv {
946 u32 framecnt_to_us; 946 u32 framecnt_to_us;
947 atomic_t restrict_refcnt; 947 atomic_t restrict_refcnt;
948#endif 948#endif
949}; /*iwl_priv */ 949}; /*iwl3945_priv */
950 950
951static inline int iwl_is_associated(struct iwl_priv *priv) 951static inline int iwl3945_is_associated(struct iwl3945_priv *priv)
952{ 952{
953 return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; 953 return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
954} 954}
955 955
956static inline int is_channel_valid(const struct iwl_channel_info *ch_info) 956static inline int is_channel_valid(const struct iwl3945_channel_info *ch_info)
957{ 957{
958 if (ch_info == NULL) 958 if (ch_info == NULL)
959 return 0; 959 return 0;
960 return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0; 960 return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0;
961} 961}
962 962
963static inline int is_channel_narrow(const struct iwl_channel_info *ch_info) 963static inline int is_channel_narrow(const struct iwl3945_channel_info *ch_info)
964{ 964{
965 return (ch_info->flags & EEPROM_CHANNEL_NARROW) ? 1 : 0; 965 return (ch_info->flags & EEPROM_CHANNEL_NARROW) ? 1 : 0;
966} 966}
967 967
968static inline int is_channel_radar(const struct iwl_channel_info *ch_info) 968static inline int is_channel_radar(const struct iwl3945_channel_info *ch_info)
969{ 969{
970 return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0; 970 return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0;
971} 971}
972 972
973static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info) 973static inline u8 is_channel_a_band(const struct iwl3945_channel_info *ch_info)
974{ 974{
975 return ch_info->phymode == MODE_IEEE80211A; 975 return ch_info->phymode == MODE_IEEE80211A;
976} 976}
977 977
978static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info) 978static inline u8 is_channel_bg_band(const struct iwl3945_channel_info *ch_info)
979{ 979{
980 return ((ch_info->phymode == MODE_IEEE80211B) || 980 return ((ch_info->phymode == MODE_IEEE80211B) ||
981 (ch_info->phymode == MODE_IEEE80211G)); 981 (ch_info->phymode == MODE_IEEE80211G));
982} 982}
983 983
984static inline int is_channel_passive(const struct iwl_channel_info *ch) 984static inline int is_channel_passive(const struct iwl3945_channel_info *ch)
985{ 985{
986 return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0; 986 return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0;
987} 987}
988 988
989static inline int is_channel_ibss(const struct iwl_channel_info *ch) 989static inline int is_channel_ibss(const struct iwl3945_channel_info *ch)
990{ 990{
991 return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; 991 return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
992} 992}
993 993
994extern const struct iwl_channel_info *iwl_get_channel_info( 994extern const struct iwl3945_channel_info *iwl3945_get_channel_info(
995 const struct iwl_priv *priv, int phymode, u16 channel); 995 const struct iwl3945_priv *priv, int phymode, u16 channel);
996 996
997/* Requires full declaration of iwl_priv before including */ 997/* Requires full declaration of iwl3945_priv before including */
998#include "iwl-3945-io.h" 998#include "iwl-3945-io.h"
999 999
1000#endif 1000#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
index 5524bf77e882..2703c52750ba 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
@@ -61,8 +61,8 @@
61 * 61 *
62 *****************************************************************************/ 62 *****************************************************************************/
63 63
64#ifndef __iwl_commands_h__ 64#ifndef __iwl4965_commands_h__
65#define __iwl_commands_h__ 65#define __iwl4965_commands_h__
66 66
67enum { 67enum {
68 REPLY_ALIVE = 0x1, 68 REPLY_ALIVE = 0x1,
@@ -147,7 +147,7 @@ enum {
147 147
148#define IWL_CMD_FAILED_MSK 0x40 148#define IWL_CMD_FAILED_MSK 0x40
149 149
150struct iwl_cmd_header { 150struct iwl4965_cmd_header {
151 u8 cmd; 151 u8 cmd;
152 u8 flags; 152 u8 flags;
153 /* We have 15 LSB to use as we please (MSB indicates 153 /* We have 15 LSB to use as we please (MSB indicates
@@ -179,7 +179,7 @@ struct iwl_cmd_header {
179/* 179/*
180 * REPLY_ALIVE = 0x1 (response only, not a command) 180 * REPLY_ALIVE = 0x1 (response only, not a command)
181 */ 181 */
182struct iwl_alive_resp { 182struct iwl4965_alive_resp {
183 u8 ucode_minor; 183 u8 ucode_minor;
184 u8 ucode_major; 184 u8 ucode_major;
185 __le16 reserved1; 185 __le16 reserved1;
@@ -193,7 +193,7 @@ struct iwl_alive_resp {
193 __le32 is_valid; 193 __le32 is_valid;
194} __attribute__ ((packed)); 194} __attribute__ ((packed));
195 195
196struct iwl_init_alive_resp { 196struct iwl4965_init_alive_resp {
197 u8 ucode_minor; 197 u8 ucode_minor;
198 u8 ucode_major; 198 u8 ucode_major;
199 __le16 reserved1; 199 __le16 reserved1;
@@ -225,7 +225,7 @@ union tsf {
225/* 225/*
226 * REPLY_ERROR = 0x2 (response only, not a command) 226 * REPLY_ERROR = 0x2 (response only, not a command)
227 */ 227 */
228struct iwl_error_resp { 228struct iwl4965_error_resp {
229 __le32 error_type; 229 __le32 error_type;
230 u8 cmd_id; 230 u8 cmd_id;
231 u8 reserved1; 231 u8 reserved1;
@@ -293,7 +293,7 @@ enum {
293/* 293/*
294 * REPLY_RXON = 0x10 (command, has simple generic response) 294 * REPLY_RXON = 0x10 (command, has simple generic response)
295 */ 295 */
296struct iwl_rxon_cmd { 296struct iwl4965_rxon_cmd {
297 u8 node_addr[6]; 297 u8 node_addr[6];
298 __le16 reserved1; 298 __le16 reserved1;
299 u8 bssid_addr[6]; 299 u8 bssid_addr[6];
@@ -316,7 +316,7 @@ struct iwl_rxon_cmd {
316/* 316/*
317 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) 317 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
318 */ 318 */
319struct iwl_rxon_assoc_cmd { 319struct iwl4965_rxon_assoc_cmd {
320 __le32 flags; 320 __le32 flags;
321 __le32 filter_flags; 321 __le32 filter_flags;
322 u8 ofdm_basic_rates; 322 u8 ofdm_basic_rates;
@@ -330,7 +330,7 @@ struct iwl_rxon_assoc_cmd {
330/* 330/*
331 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) 331 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
332 */ 332 */
333struct iwl_rxon_time_cmd { 333struct iwl4965_rxon_time_cmd {
334 union tsf timestamp; 334 union tsf timestamp;
335 __le16 beacon_interval; 335 __le16 beacon_interval;
336 __le16 atim_window; 336 __le16 atim_window;
@@ -339,7 +339,7 @@ struct iwl_rxon_time_cmd {
339 __le16 reserved; 339 __le16 reserved;
340} __attribute__ ((packed)); 340} __attribute__ ((packed));
341 341
342struct iwl_tx_power { 342struct iwl4965_tx_power {
343 u8 tx_gain; /* gain for analog radio */ 343 u8 tx_gain; /* gain for analog radio */
344 u8 dsp_atten; /* gain for DSP */ 344 u8 dsp_atten; /* gain for DSP */
345} __attribute__ ((packed)); 345} __attribute__ ((packed));
@@ -351,27 +351,27 @@ struct tx_power_dual_stream {
351 __le32 dw; 351 __le32 dw;
352} __attribute__ ((packed)); 352} __attribute__ ((packed));
353 353
354struct iwl_tx_power_db { 354struct iwl4965_tx_power_db {
355 struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES]; 355 struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
356} __attribute__ ((packed)); 356} __attribute__ ((packed));
357 357
358/* 358/*
359 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) 359 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
360 */ 360 */
361struct iwl_channel_switch_cmd { 361struct iwl4965_channel_switch_cmd {
362 u8 band; 362 u8 band;
363 u8 expect_beacon; 363 u8 expect_beacon;
364 __le16 channel; 364 __le16 channel;
365 __le32 rxon_flags; 365 __le32 rxon_flags;
366 __le32 rxon_filter_flags; 366 __le32 rxon_filter_flags;
367 __le32 switch_time; 367 __le32 switch_time;
368 struct iwl_tx_power_db tx_power; 368 struct iwl4965_tx_power_db tx_power;
369} __attribute__ ((packed)); 369} __attribute__ ((packed));
370 370
371/* 371/*
372 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) 372 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
373 */ 373 */
374struct iwl_csa_notification { 374struct iwl4965_csa_notification {
375 __le16 band; 375 __le16 band;
376 __le16 channel; 376 __le16 channel;
377 __le32 status; /* 0 - OK, 1 - fail */ 377 __le32 status; /* 0 - OK, 1 - fail */
@@ -382,7 +382,7 @@ struct iwl_csa_notification {
382 * Quality-of-Service (QOS) Commands & Responses: 382 * Quality-of-Service (QOS) Commands & Responses:
383 * 383 *
384 *****************************************************************************/ 384 *****************************************************************************/
385struct iwl_ac_qos { 385struct iwl4965_ac_qos {
386 __le16 cw_min; 386 __le16 cw_min;
387 __le16 cw_max; 387 __le16 cw_max;
388 u8 aifsn; 388 u8 aifsn;
@@ -404,9 +404,9 @@ struct iwl_ac_qos {
404/* 404/*
405 * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) 405 * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
406 */ 406 */
407struct iwl_qosparam_cmd { 407struct iwl4965_qosparam_cmd {
408 __le32 qos_flags; 408 __le32 qos_flags;
409 struct iwl_ac_qos ac[AC_NUM]; 409 struct iwl4965_ac_qos ac[AC_NUM];
410} __attribute__ ((packed)); 410} __attribute__ ((packed));
411 411
412/****************************************************************************** 412/******************************************************************************
@@ -464,7 +464,7 @@ struct iwl_qosparam_cmd {
464#define RATE_MCS_ANT_B_MSK 0x8000 464#define RATE_MCS_ANT_B_MSK 0x8000
465#define RATE_MCS_ANT_AB_MSK 0xc000 465#define RATE_MCS_ANT_AB_MSK 0xc000
466 466
467struct iwl_keyinfo { 467struct iwl4965_keyinfo {
468 __le16 key_flags; 468 __le16 key_flags;
469 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ 469 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
470 u8 reserved1; 470 u8 reserved1;
@@ -484,11 +484,11 @@ struct sta_id_modify {
484/* 484/*
485 * REPLY_ADD_STA = 0x18 (command) 485 * REPLY_ADD_STA = 0x18 (command)
486 */ 486 */
487struct iwl_addsta_cmd { 487struct iwl4965_addsta_cmd {
488 u8 mode; 488 u8 mode;
489 u8 reserved[3]; 489 u8 reserved[3];
490 struct sta_id_modify sta; 490 struct sta_id_modify sta;
491 struct iwl_keyinfo key; 491 struct iwl4965_keyinfo key;
492 __le32 station_flags; 492 __le32 station_flags;
493 __le32 station_flags_msk; 493 __le32 station_flags_msk;
494 __le16 tid_disable_tx; 494 __le16 tid_disable_tx;
@@ -502,7 +502,7 @@ struct iwl_addsta_cmd {
502/* 502/*
503 * REPLY_ADD_STA = 0x18 (response) 503 * REPLY_ADD_STA = 0x18 (response)
504 */ 504 */
505struct iwl_add_sta_resp { 505struct iwl4965_add_sta_resp {
506 u8 status; 506 u8 status;
507} __attribute__ ((packed)); 507} __attribute__ ((packed));
508 508
@@ -514,7 +514,7 @@ struct iwl_add_sta_resp {
514 * 514 *
515 *****************************************************************************/ 515 *****************************************************************************/
516 516
517struct iwl_rx_frame_stats { 517struct iwl4965_rx_frame_stats {
518 u8 phy_count; 518 u8 phy_count;
519 u8 id; 519 u8 id;
520 u8 rssi; 520 u8 rssi;
@@ -524,7 +524,7 @@ struct iwl_rx_frame_stats {
524 u8 payload[0]; 524 u8 payload[0];
525} __attribute__ ((packed)); 525} __attribute__ ((packed));
526 526
527struct iwl_rx_frame_hdr { 527struct iwl4965_rx_frame_hdr {
528 __le16 channel; 528 __le16 channel;
529 __le16 phy_flags; 529 __le16 phy_flags;
530 u8 reserved1; 530 u8 reserved1;
@@ -554,7 +554,7 @@ struct iwl_rx_frame_hdr {
554#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) 554#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
555#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) 555#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
556 556
557struct iwl_rx_frame_end { 557struct iwl4965_rx_frame_end {
558 __le32 status; 558 __le32 status;
559 __le64 timestamp; 559 __le64 timestamp;
560 __le32 beacon_timestamp; 560 __le32 beacon_timestamp;
@@ -568,10 +568,10 @@ struct iwl_rx_frame_end {
568 * The actual offsets of the hdr and end are dynamic based on 568 * The actual offsets of the hdr and end are dynamic based on
569 * stats.phy_count 569 * stats.phy_count
570 */ 570 */
571struct iwl_rx_frame { 571struct iwl4965_rx_frame {
572 struct iwl_rx_frame_stats stats; 572 struct iwl4965_rx_frame_stats stats;
573 struct iwl_rx_frame_hdr hdr; 573 struct iwl4965_rx_frame_hdr hdr;
574 struct iwl_rx_frame_end end; 574 struct iwl4965_rx_frame_end end;
575} __attribute__ ((packed)); 575} __attribute__ ((packed));
576 576
577/* Fixed (non-configurable) rx data from phy */ 577/* Fixed (non-configurable) rx data from phy */
@@ -666,7 +666,7 @@ struct iwl4965_rx_mpdu_res_start {
666 * TX command Frame life time 666 * TX command Frame life time
667 */ 667 */
668 668
669struct iwl_dram_scratch { 669struct iwl4965_dram_scratch {
670 u8 try_cnt; 670 u8 try_cnt;
671 u8 bt_kill_cnt; 671 u8 bt_kill_cnt;
672 __le16 reserved; 672 __le16 reserved;
@@ -675,11 +675,11 @@ struct iwl_dram_scratch {
675/* 675/*
676 * REPLY_TX = 0x1c (command) 676 * REPLY_TX = 0x1c (command)
677 */ 677 */
678struct iwl_tx_cmd { 678struct iwl4965_tx_cmd {
679 __le16 len; 679 __le16 len;
680 __le16 next_frame_len; 680 __le16 next_frame_len;
681 __le32 tx_flags; 681 __le32 tx_flags;
682 struct iwl_dram_scratch scratch; 682 struct iwl4965_dram_scratch scratch;
683 __le32 rate_n_flags; 683 __le32 rate_n_flags;
684 u8 sta_id; 684 u8 sta_id;
685 u8 sec_ctl; 685 u8 sec_ctl;
@@ -807,7 +807,7 @@ enum {
807/* 807/*
808 * REPLY_TX = 0x1c (response) 808 * REPLY_TX = 0x1c (response)
809 */ 809 */
810struct iwl_tx_resp { 810struct iwl4965_tx_resp {
811 u8 frame_count; /* 1 no aggregation, >1 aggregation */ 811 u8 frame_count; /* 1 no aggregation, >1 aggregation */
812 u8 bt_kill_count; 812 u8 bt_kill_count;
813 u8 failure_rts; 813 u8 failure_rts;
@@ -823,7 +823,7 @@ struct iwl_tx_resp {
823/* 823/*
824 * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) 824 * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
825 */ 825 */
826struct iwl_compressed_ba_resp { 826struct iwl4965_compressed_ba_resp {
827 __le32 sta_addr_lo32; 827 __le32 sta_addr_lo32;
828 __le16 sta_addr_hi16; 828 __le16 sta_addr_hi16;
829 __le16 reserved; 829 __le16 reserved;
@@ -839,11 +839,11 @@ struct iwl_compressed_ba_resp {
839/* 839/*
840 * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) 840 * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
841 */ 841 */
842struct iwl_txpowertable_cmd { 842struct iwl4965_txpowertable_cmd {
843 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ 843 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
844 u8 reserved; 844 u8 reserved;
845 __le16 channel; 845 __le16 channel;
846 struct iwl_tx_power_db tx_power; 846 struct iwl4965_tx_power_db tx_power;
847} __attribute__ ((packed)); 847} __attribute__ ((packed));
848 848
849/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ 849/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
@@ -856,7 +856,7 @@ struct iwl_txpowertable_cmd {
856#define LINK_QUAL_ANT_B_MSK (1<<1) 856#define LINK_QUAL_ANT_B_MSK (1<<1)
857#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) 857#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
858 858
859struct iwl_link_qual_general_params { 859struct iwl4965_link_qual_general_params {
860 u8 flags; 860 u8 flags;
861 u8 mimo_delimiter; 861 u8 mimo_delimiter;
862 u8 single_stream_ant_msk; 862 u8 single_stream_ant_msk;
@@ -864,7 +864,7 @@ struct iwl_link_qual_general_params {
864 u8 start_rate_index[LINK_QUAL_AC_NUM]; 864 u8 start_rate_index[LINK_QUAL_AC_NUM];
865} __attribute__ ((packed)); 865} __attribute__ ((packed));
866 866
867struct iwl_link_qual_agg_params { 867struct iwl4965_link_qual_agg_params {
868 __le16 agg_time_limit; 868 __le16 agg_time_limit;
869 u8 agg_dis_start_th; 869 u8 agg_dis_start_th;
870 u8 agg_frame_cnt_limit; 870 u8 agg_frame_cnt_limit;
@@ -874,12 +874,12 @@ struct iwl_link_qual_agg_params {
874/* 874/*
875 * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) 875 * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
876 */ 876 */
877struct iwl_link_quality_cmd { 877struct iwl4965_link_quality_cmd {
878 u8 sta_id; 878 u8 sta_id;
879 u8 reserved1; 879 u8 reserved1;
880 __le16 control; 880 __le16 control;
881 struct iwl_link_qual_general_params general_params; 881 struct iwl4965_link_qual_general_params general_params;
882 struct iwl_link_qual_agg_params agg_params; 882 struct iwl4965_link_qual_agg_params agg_params;
883 struct { 883 struct {
884 __le32 rate_n_flags; 884 __le32 rate_n_flags;
885 } rs_table[LINK_QUAL_MAX_RETRY_NUM]; 885 } rs_table[LINK_QUAL_MAX_RETRY_NUM];
@@ -889,7 +889,7 @@ struct iwl_link_quality_cmd {
889/* 889/*
890 * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) 890 * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
891 */ 891 */
892struct iwl_bt_cmd { 892struct iwl4965_bt_cmd {
893 u8 flags; 893 u8 flags;
894 u8 lead_time; 894 u8 lead_time;
895 u8 max_kill; 895 u8 max_kill;
@@ -915,18 +915,18 @@ struct iwl_bt_cmd {
915 RXON_FILTER_ASSOC_MSK | \ 915 RXON_FILTER_ASSOC_MSK | \
916 RXON_FILTER_BCON_AWARE_MSK) 916 RXON_FILTER_BCON_AWARE_MSK)
917 917
918struct iwl_measure_channel { 918struct iwl4965_measure_channel {
919 __le32 duration; /* measurement duration in extended beacon 919 __le32 duration; /* measurement duration in extended beacon
920 * format */ 920 * format */
921 u8 channel; /* channel to measure */ 921 u8 channel; /* channel to measure */
922 u8 type; /* see enum iwl_measure_type */ 922 u8 type; /* see enum iwl4965_measure_type */
923 __le16 reserved; 923 __le16 reserved;
924} __attribute__ ((packed)); 924} __attribute__ ((packed));
925 925
926/* 926/*
927 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) 927 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
928 */ 928 */
929struct iwl_spectrum_cmd { 929struct iwl4965_spectrum_cmd {
930 __le16 len; /* number of bytes starting from token */ 930 __le16 len; /* number of bytes starting from token */
931 u8 token; /* token id */ 931 u8 token; /* token id */
932 u8 id; /* measurement id -- 0 or 1 */ 932 u8 id; /* measurement id -- 0 or 1 */
@@ -939,13 +939,13 @@ struct iwl_spectrum_cmd {
939 __le32 filter_flags; /* rxon filter flags */ 939 __le32 filter_flags; /* rxon filter flags */
940 __le16 channel_count; /* minimum 1, maximum 10 */ 940 __le16 channel_count; /* minimum 1, maximum 10 */
941 __le16 reserved3; 941 __le16 reserved3;
942 struct iwl_measure_channel channels[10]; 942 struct iwl4965_measure_channel channels[10];
943} __attribute__ ((packed)); 943} __attribute__ ((packed));
944 944
945/* 945/*
946 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) 946 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
947 */ 947 */
948struct iwl_spectrum_resp { 948struct iwl4965_spectrum_resp {
949 u8 token; 949 u8 token;
950 u8 id; /* id of the prior command replaced, or 0xff */ 950 u8 id; /* id of the prior command replaced, or 0xff */
951 __le16 status; /* 0 - command will be handled 951 __le16 status; /* 0 - command will be handled
@@ -953,12 +953,12 @@ struct iwl_spectrum_resp {
953 * measurement) */ 953 * measurement) */
954} __attribute__ ((packed)); 954} __attribute__ ((packed));
955 955
956enum iwl_measurement_state { 956enum iwl4965_measurement_state {
957 IWL_MEASUREMENT_START = 0, 957 IWL_MEASUREMENT_START = 0,
958 IWL_MEASUREMENT_STOP = 1, 958 IWL_MEASUREMENT_STOP = 1,
959}; 959};
960 960
961enum iwl_measurement_status { 961enum iwl4965_measurement_status {
962 IWL_MEASUREMENT_OK = 0, 962 IWL_MEASUREMENT_OK = 0,
963 IWL_MEASUREMENT_CONCURRENT = 1, 963 IWL_MEASUREMENT_CONCURRENT = 1,
964 IWL_MEASUREMENT_CSA_CONFLICT = 2, 964 IWL_MEASUREMENT_CSA_CONFLICT = 2,
@@ -971,18 +971,18 @@ enum iwl_measurement_status {
971 971
972#define NUM_ELEMENTS_IN_HISTOGRAM 8 972#define NUM_ELEMENTS_IN_HISTOGRAM 8
973 973
974struct iwl_measurement_histogram { 974struct iwl4965_measurement_histogram {
975 __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ 975 __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
976 __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ 976 __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
977} __attribute__ ((packed)); 977} __attribute__ ((packed));
978 978
979/* clear channel availability counters */ 979/* clear channel availability counters */
980struct iwl_measurement_cca_counters { 980struct iwl4965_measurement_cca_counters {
981 __le32 ofdm; 981 __le32 ofdm;
982 __le32 cck; 982 __le32 cck;
983} __attribute__ ((packed)); 983} __attribute__ ((packed));
984 984
985enum iwl_measure_type { 985enum iwl4965_measure_type {
986 IWL_MEASURE_BASIC = (1 << 0), 986 IWL_MEASURE_BASIC = (1 << 0),
987 IWL_MEASURE_CHANNEL_LOAD = (1 << 1), 987 IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
988 IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), 988 IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
@@ -995,7 +995,7 @@ enum iwl_measure_type {
995/* 995/*
996 * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) 996 * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
997 */ 997 */
998struct iwl_spectrum_notification { 998struct iwl4965_spectrum_notification {
999 u8 id; /* measurement id -- 0 or 1 */ 999 u8 id; /* measurement id -- 0 or 1 */
1000 u8 token; 1000 u8 token;
1001 u8 channel_index; /* index in measurement channel list */ 1001 u8 channel_index; /* index in measurement channel list */
@@ -1003,7 +1003,7 @@ struct iwl_spectrum_notification {
1003 __le32 start_time; /* lower 32-bits of TSF */ 1003 __le32 start_time; /* lower 32-bits of TSF */
1004 u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ 1004 u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
1005 u8 channel; 1005 u8 channel;
1006 u8 type; /* see enum iwl_measurement_type */ 1006 u8 type; /* see enum iwl4965_measurement_type */
1007 u8 reserved1; 1007 u8 reserved1;
1008 /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only 1008 /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
1009 * valid if applicable for measurement type requested. */ 1009 * valid if applicable for measurement type requested. */
@@ -1013,9 +1013,9 @@ struct iwl_spectrum_notification {
1013 u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - 1013 u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
1014 * unidentified */ 1014 * unidentified */
1015 u8 reserved2[3]; 1015 u8 reserved2[3];
1016 struct iwl_measurement_histogram histogram; 1016 struct iwl4965_measurement_histogram histogram;
1017 __le32 stop_time; /* lower 32-bits of TSF */ 1017 __le32 stop_time; /* lower 32-bits of TSF */
1018 __le32 status; /* see iwl_measurement_status */ 1018 __le32 status; /* see iwl4965_measurement_status */
1019} __attribute__ ((packed)); 1019} __attribute__ ((packed));
1020 1020
1021/****************************************************************************** 1021/******************************************************************************
@@ -1025,7 +1025,7 @@ struct iwl_spectrum_notification {
1025 *****************************************************************************/ 1025 *****************************************************************************/
1026 1026
1027/** 1027/**
1028 * struct iwl_powertable_cmd - Power Table Command 1028 * struct iwl4965_powertable_cmd - Power Table Command
1029 * @flags: See below: 1029 * @flags: See below:
1030 * 1030 *
1031 * POWER_TABLE_CMD = 0x77 (command, has simple generic response) 1031 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
@@ -1058,7 +1058,7 @@ struct iwl_spectrum_notification {
1058#define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le16(1<<2) 1058#define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le16(1<<2)
1059#define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1<<3) 1059#define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1<<3)
1060 1060
1061struct iwl_powertable_cmd { 1061struct iwl4965_powertable_cmd {
1062 __le16 flags; 1062 __le16 flags;
1063 u8 keep_alive_seconds; 1063 u8 keep_alive_seconds;
1064 u8 debug_flags; 1064 u8 debug_flags;
@@ -1072,7 +1072,7 @@ struct iwl_powertable_cmd {
1072 * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) 1072 * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
1073 * 3945 and 4965 identical. 1073 * 3945 and 4965 identical.
1074 */ 1074 */
1075struct iwl_sleep_notification { 1075struct iwl4965_sleep_notification {
1076 u8 pm_sleep_mode; 1076 u8 pm_sleep_mode;
1077 u8 pm_wakeup_src; 1077 u8 pm_wakeup_src;
1078 __le16 reserved; 1078 __le16 reserved;
@@ -1102,14 +1102,14 @@ enum {
1102#define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ 1102#define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
1103#define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ 1103#define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
1104#define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ 1104#define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
1105struct iwl_card_state_cmd { 1105struct iwl4965_card_state_cmd {
1106 __le32 status; /* CARD_STATE_CMD_* request new power state */ 1106 __le32 status; /* CARD_STATE_CMD_* request new power state */
1107} __attribute__ ((packed)); 1107} __attribute__ ((packed));
1108 1108
1109/* 1109/*
1110 * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) 1110 * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
1111 */ 1111 */
1112struct iwl_card_state_notif { 1112struct iwl4965_card_state_notif {
1113 __le32 flags; 1113 __le32 flags;
1114} __attribute__ ((packed)); 1114} __attribute__ ((packed));
1115 1115
@@ -1118,7 +1118,7 @@ struct iwl_card_state_notif {
1118#define RF_CARD_DISABLED 0x04 1118#define RF_CARD_DISABLED 0x04
1119#define RXON_CARD_DISABLED 0x10 1119#define RXON_CARD_DISABLED 0x10
1120 1120
1121struct iwl_ct_kill_config { 1121struct iwl4965_ct_kill_config {
1122 __le32 reserved; 1122 __le32 reserved;
1123 __le32 critical_temperature_M; 1123 __le32 critical_temperature_M;
1124 __le32 critical_temperature_R; 1124 __le32 critical_temperature_R;
@@ -1130,7 +1130,7 @@ struct iwl_ct_kill_config {
1130 * 1130 *
1131 *****************************************************************************/ 1131 *****************************************************************************/
1132 1132
1133struct iwl_scan_channel { 1133struct iwl4965_scan_channel {
1134 /* type is defined as: 1134 /* type is defined as:
1135 * 0:0 active (0 - passive) 1135 * 0:0 active (0 - passive)
1136 * 1:4 SSID direct 1136 * 1:4 SSID direct
@@ -1139,12 +1139,12 @@ struct iwl_scan_channel {
1139 */ 1139 */
1140 u8 type; 1140 u8 type;
1141 u8 channel; 1141 u8 channel;
1142 struct iwl_tx_power tpc; 1142 struct iwl4965_tx_power tpc;
1143 __le16 active_dwell; 1143 __le16 active_dwell;
1144 __le16 passive_dwell; 1144 __le16 passive_dwell;
1145} __attribute__ ((packed)); 1145} __attribute__ ((packed));
1146 1146
1147struct iwl_ssid_ie { 1147struct iwl4965_ssid_ie {
1148 u8 id; 1148 u8 id;
1149 u8 len; 1149 u8 len;
1150 u8 ssid[32]; 1150 u8 ssid[32];
@@ -1158,7 +1158,7 @@ struct iwl_ssid_ie {
1158/* 1158/*
1159 * REPLY_SCAN_CMD = 0x80 (command) 1159 * REPLY_SCAN_CMD = 0x80 (command)
1160 */ 1160 */
1161struct iwl_scan_cmd { 1161struct iwl4965_scan_cmd {
1162 __le16 len; 1162 __le16 len;
1163 u8 reserved0; 1163 u8 reserved0;
1164 u8 channel_count; 1164 u8 channel_count;
@@ -1177,14 +1177,14 @@ struct iwl_scan_cmd {
1177 __le32 flags; 1177 __le32 flags;
1178 __le32 filter_flags; 1178 __le32 filter_flags;
1179 1179
1180 struct iwl_tx_cmd tx_cmd; 1180 struct iwl4965_tx_cmd tx_cmd;
1181 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; 1181 struct iwl4965_ssid_ie direct_scan[PROBE_OPTION_MAX];
1182 1182
1183 u8 data[0]; 1183 u8 data[0];
1184 /* 1184 /*
1185 * The channels start after the probe request payload and are of type: 1185 * The channels start after the probe request payload and are of type:
1186 * 1186 *
1187 * struct iwl_scan_channel channels[0]; 1187 * struct iwl4965_scan_channel channels[0];
1188 * 1188 *
1189 * NOTE: Only one band of channels can be scanned per pass. You 1189 * NOTE: Only one band of channels can be scanned per pass. You
1190 * can not mix 2.4GHz channels and 5.2GHz channels and must 1190 * can not mix 2.4GHz channels and 5.2GHz channels and must
@@ -1201,14 +1201,14 @@ struct iwl_scan_cmd {
1201/* 1201/*
1202 * REPLY_SCAN_CMD = 0x80 (response) 1202 * REPLY_SCAN_CMD = 0x80 (response)
1203 */ 1203 */
1204struct iwl_scanreq_notification { 1204struct iwl4965_scanreq_notification {
1205 __le32 status; /* 1: okay, 2: cannot fulfill request */ 1205 __le32 status; /* 1: okay, 2: cannot fulfill request */
1206} __attribute__ ((packed)); 1206} __attribute__ ((packed));
1207 1207
1208/* 1208/*
1209 * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) 1209 * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
1210 */ 1210 */
1211struct iwl_scanstart_notification { 1211struct iwl4965_scanstart_notification {
1212 __le32 tsf_low; 1212 __le32 tsf_low;
1213 __le32 tsf_high; 1213 __le32 tsf_high;
1214 __le32 beacon_timer; 1214 __le32 beacon_timer;
@@ -1225,7 +1225,7 @@ struct iwl_scanstart_notification {
1225/* 1225/*
1226 * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) 1226 * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
1227 */ 1227 */
1228struct iwl_scanresults_notification { 1228struct iwl4965_scanresults_notification {
1229 u8 channel; 1229 u8 channel;
1230 u8 band; 1230 u8 band;
1231 u8 reserved[2]; 1231 u8 reserved[2];
@@ -1237,7 +1237,7 @@ struct iwl_scanresults_notification {
1237/* 1237/*
1238 * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) 1238 * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
1239 */ 1239 */
1240struct iwl_scancomplete_notification { 1240struct iwl4965_scancomplete_notification {
1241 u8 scanned_channels; 1241 u8 scanned_channels;
1242 u8 status; 1242 u8 status;
1243 u8 reserved; 1243 u8 reserved;
@@ -1256,8 +1256,8 @@ struct iwl_scancomplete_notification {
1256/* 1256/*
1257 * BEACON_NOTIFICATION = 0x90 (notification only, not a command) 1257 * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
1258 */ 1258 */
1259struct iwl_beacon_notif { 1259struct iwl4965_beacon_notif {
1260 struct iwl_tx_resp beacon_notify_hdr; 1260 struct iwl4965_tx_resp beacon_notify_hdr;
1261 __le32 low_tsf; 1261 __le32 low_tsf;
1262 __le32 high_tsf; 1262 __le32 high_tsf;
1263 __le32 ibss_mgr_status; 1263 __le32 ibss_mgr_status;
@@ -1266,8 +1266,8 @@ struct iwl_beacon_notif {
1266/* 1266/*
1267 * REPLY_TX_BEACON = 0x91 (command, has simple generic response) 1267 * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
1268 */ 1268 */
1269struct iwl_tx_beacon_cmd { 1269struct iwl4965_tx_beacon_cmd {
1270 struct iwl_tx_cmd tx; 1270 struct iwl4965_tx_cmd tx;
1271 __le16 tim_idx; 1271 __le16 tim_idx;
1272 u8 tim_size; 1272 u8 tim_size;
1273 u8 reserved1; 1273 u8 reserved1;
@@ -1458,7 +1458,7 @@ struct statistics_general {
1458 */ 1458 */
1459#define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */ 1459#define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */
1460#define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */ 1460#define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */
1461struct iwl_statistics_cmd { 1461struct iwl4965_statistics_cmd {
1462 __le32 configuration_flags; /* IWL_STATS_CONF_* */ 1462 __le32 configuration_flags; /* IWL_STATS_CONF_* */
1463} __attribute__ ((packed)); 1463} __attribute__ ((packed));
1464 1464
@@ -1479,7 +1479,7 @@ struct iwl_statistics_cmd {
1479 */ 1479 */
1480#define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2) 1480#define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2)
1481#define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8) 1481#define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8)
1482struct iwl_notif_statistics { 1482struct iwl4965_notif_statistics {
1483 __le32 flag; 1483 __le32 flag;
1484 struct statistics_rx rx; 1484 struct statistics_rx rx;
1485 struct statistics_tx tx; 1485 struct statistics_tx tx;
@@ -1494,7 +1494,7 @@ struct iwl_notif_statistics {
1494 * then this notification will be sent. */ 1494 * then this notification will be sent. */
1495#define CONSECUTIVE_MISSED_BCONS_TH 20 1495#define CONSECUTIVE_MISSED_BCONS_TH 20
1496 1496
1497struct iwl_missed_beacon_notif { 1497struct iwl4965_missed_beacon_notif {
1498 __le32 consequtive_missed_beacons; 1498 __le32 consequtive_missed_beacons;
1499 __le32 total_missed_becons; 1499 __le32 total_missed_becons;
1500 __le32 num_expected_beacons; 1500 __le32 num_expected_beacons;
@@ -1510,12 +1510,12 @@ struct iwl_missed_beacon_notif {
1510#define PHY_CALIBRATE_DIFF_GAIN_CMD (7) 1510#define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
1511#define HD_TABLE_SIZE (11) 1511#define HD_TABLE_SIZE (11)
1512 1512
1513struct iwl_sensitivity_cmd { 1513struct iwl4965_sensitivity_cmd {
1514 __le16 control; 1514 __le16 control;
1515 __le16 table[HD_TABLE_SIZE]; 1515 __le16 table[HD_TABLE_SIZE];
1516} __attribute__ ((packed)); 1516} __attribute__ ((packed));
1517 1517
1518struct iwl_calibration_cmd { 1518struct iwl4965_calibration_cmd {
1519 u8 opCode; 1519 u8 opCode;
1520 u8 flags; 1520 u8 flags;
1521 __le16 reserved; 1521 __le16 reserved;
@@ -1538,7 +1538,7 @@ struct iwl_calibration_cmd {
1538 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), 1538 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
1539 * this command turns it on or off, or sets up a periodic blinking cycle. 1539 * this command turns it on or off, or sets up a periodic blinking cycle.
1540 */ 1540 */
1541struct iwl_led_cmd { 1541struct iwl4965_led_cmd {
1542 __le32 interval; /* "interval" in uSec */ 1542 __le32 interval; /* "interval" in uSec */
1543 u8 id; /* 1: Activity, 2: Link, 3: Tech */ 1543 u8 id; /* 1: Activity, 2: Link, 3: Tech */
1544 u8 off; /* # intervals off while blinking; 1544 u8 off; /* # intervals off while blinking;
@@ -1554,29 +1554,29 @@ struct iwl_led_cmd {
1554 * 1554 *
1555 *****************************************************************************/ 1555 *****************************************************************************/
1556 1556
1557struct iwl_rx_packet { 1557struct iwl4965_rx_packet {
1558 __le32 len; 1558 __le32 len;
1559 struct iwl_cmd_header hdr; 1559 struct iwl4965_cmd_header hdr;
1560 union { 1560 union {
1561 struct iwl_alive_resp alive_frame; 1561 struct iwl4965_alive_resp alive_frame;
1562 struct iwl_rx_frame rx_frame; 1562 struct iwl4965_rx_frame rx_frame;
1563 struct iwl_tx_resp tx_resp; 1563 struct iwl4965_tx_resp tx_resp;
1564 struct iwl_spectrum_notification spectrum_notif; 1564 struct iwl4965_spectrum_notification spectrum_notif;
1565 struct iwl_csa_notification csa_notif; 1565 struct iwl4965_csa_notification csa_notif;
1566 struct iwl_error_resp err_resp; 1566 struct iwl4965_error_resp err_resp;
1567 struct iwl_card_state_notif card_state_notif; 1567 struct iwl4965_card_state_notif card_state_notif;
1568 struct iwl_beacon_notif beacon_status; 1568 struct iwl4965_beacon_notif beacon_status;
1569 struct iwl_add_sta_resp add_sta; 1569 struct iwl4965_add_sta_resp add_sta;
1570 struct iwl_sleep_notification sleep_notif; 1570 struct iwl4965_sleep_notification sleep_notif;
1571 struct iwl_spectrum_resp spectrum; 1571 struct iwl4965_spectrum_resp spectrum;
1572 struct iwl_notif_statistics stats; 1572 struct iwl4965_notif_statistics stats;
1573 struct iwl_compressed_ba_resp compressed_ba; 1573 struct iwl4965_compressed_ba_resp compressed_ba;
1574 struct iwl_missed_beacon_notif missed_beacon; 1574 struct iwl4965_missed_beacon_notif missed_beacon;
1575 __le32 status; 1575 __le32 status;
1576 u8 raw[0]; 1576 u8 raw[0];
1577 } u; 1577 } u;
1578} __attribute__ ((packed)); 1578} __attribute__ ((packed));
1579 1579
1580#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl_rx_frame)) 1580#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl4965_rx_frame))
1581 1581
1582#endif /* __iwl_commands_h__ */ 1582#endif /* __iwl4965_commands_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-debug.h b/drivers/net/wireless/iwlwifi/iwl-4965-debug.h
index 0c74883d2f8b..00bc1faece92 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-debug.h
@@ -26,18 +26,18 @@
26 * 26 *
27 *****************************************************************************/ 27 *****************************************************************************/
28 28
29#ifndef __iwl_debug_h__ 29#ifndef __iwl4965_debug_h__
30#define __iwl_debug_h__ 30#define __iwl4965_debug_h__
31 31
32#ifdef CONFIG_IWL4965_DEBUG 32#ifdef CONFIG_IWL4965_DEBUG
33extern u32 iwl_debug_level; 33extern u32 iwl4965_debug_level;
34#define IWL_DEBUG(level, fmt, args...) \ 34#define IWL_DEBUG(level, fmt, args...) \
35do { if (iwl_debug_level & (level)) \ 35do { if (iwl4965_debug_level & (level)) \
36 printk(KERN_ERR DRV_NAME": %c %s " fmt, \ 36 printk(KERN_ERR DRV_NAME": %c %s " fmt, \
37 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) 37 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
38 38
39#define IWL_DEBUG_LIMIT(level, fmt, args...) \ 39#define IWL_DEBUG_LIMIT(level, fmt, args...) \
40do { if ((iwl_debug_level & (level)) && net_ratelimit()) \ 40do { if ((iwl4965_debug_level & (level)) && net_ratelimit()) \
41 printk(KERN_ERR DRV_NAME": %c %s " fmt, \ 41 printk(KERN_ERR DRV_NAME": %c %s " fmt, \
42 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) 42 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
43#else 43#else
@@ -68,7 +68,7 @@ static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...)
68 * 68 *
69 * % cat /proc/net/iwl/debug_level 69 * % cat /proc/net/iwl/debug_level
70 * 70 *
71 * you simply need to add your entry to the iwl_debug_levels array. 71 * you simply need to add your entry to the iwl4965_debug_levels array.
72 * 72 *
73 * If you do not see debug_level in /proc/net/iwl then you do not have 73 * If you do not see debug_level in /proc/net/iwl then you do not have
74 * CONFIG_IWL4965_DEBUG defined in your kernel configuration 74 * CONFIG_IWL4965_DEBUG defined in your kernel configuration
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
index 4afd69da375f..dfaa60779460 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
@@ -137,7 +137,7 @@ enum {
137#define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7) 137#define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7)
138 138
139/* *regulatory* channel data from eeprom, one for each channel */ 139/* *regulatory* channel data from eeprom, one for each channel */
140struct iwl_eeprom_channel { 140struct iwl4965_eeprom_channel {
141 u8 flags; /* flags copied from EEPROM */ 141 u8 flags; /* flags copied from EEPROM */
142 s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */ 142 s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */
143} __attribute__ ((packed)); 143} __attribute__ ((packed));
@@ -152,7 +152,7 @@ struct iwl_eeprom_channel {
152 * level. 152 * level.
153 * Data copied from EEPROM. 153 * Data copied from EEPROM.
154 */ 154 */
155struct iwl_eeprom_txpower_sample { 155struct iwl4965_eeprom_txpower_sample {
156 u8 gain_index; /* index into power (gain) setup table ... */ 156 u8 gain_index; /* index into power (gain) setup table ... */
157 s8 power; /* ... for this pwr level for this chnl group */ 157 s8 power; /* ... for this pwr level for this chnl group */
158 u16 v_det; /* PA output voltage */ 158 u16 v_det; /* PA output voltage */
@@ -166,8 +166,8 @@ struct iwl_eeprom_txpower_sample {
166 * Data copied from EEPROM. 166 * Data copied from EEPROM.
167 * DO NOT ALTER THIS STRUCTURE!!! 167 * DO NOT ALTER THIS STRUCTURE!!!
168 */ 168 */
169struct iwl_eeprom_txpower_group { 169struct iwl4965_eeprom_txpower_group {
170 struct iwl_eeprom_txpower_sample samples[5]; /* 5 power levels */ 170 struct iwl4965_eeprom_txpower_sample samples[5]; /* 5 power levels */
171 s32 a, b, c, d, e; /* coefficients for voltage->power 171 s32 a, b, c, d, e; /* coefficients for voltage->power
172 * formula (signed) */ 172 * formula (signed) */
173 s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on 173 s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on
@@ -185,7 +185,7 @@ struct iwl_eeprom_txpower_group {
185 * difference between current temperature and factory calib temperature. 185 * difference between current temperature and factory calib temperature.
186 * Data copied from EEPROM. 186 * Data copied from EEPROM.
187 */ 187 */
188struct iwl_eeprom_temperature_corr { 188struct iwl4965_eeprom_temperature_corr {
189 u32 Ta; 189 u32 Ta;
190 u32 Tb; 190 u32 Tb;
191 u32 Tc; 191 u32 Tc;
@@ -199,35 +199,35 @@ struct iwl_eeprom_temperature_corr {
199#define EEPROM_TX_POWER_VERSION (2) 199#define EEPROM_TX_POWER_VERSION (2)
200#define EEPROM_TX_POWER_VERSION_NEW (5) 200#define EEPROM_TX_POWER_VERSION_NEW (5)
201 201
202struct iwl_eeprom_calib_measure { 202struct iwl4965_eeprom_calib_measure {
203 u8 temperature; 203 u8 temperature;
204 u8 gain_idx; 204 u8 gain_idx;
205 u8 actual_pow; 205 u8 actual_pow;
206 s8 pa_det; 206 s8 pa_det;
207} __attribute__ ((packed)); 207} __attribute__ ((packed));
208 208
209struct iwl_eeprom_calib_ch_info { 209struct iwl4965_eeprom_calib_ch_info {
210 u8 ch_num; 210 u8 ch_num;
211 struct iwl_eeprom_calib_measure measurements[EEPROM_TX_POWER_TX_CHAINS] 211 struct iwl4965_eeprom_calib_measure measurements[EEPROM_TX_POWER_TX_CHAINS]
212 [EEPROM_TX_POWER_MEASUREMENTS]; 212 [EEPROM_TX_POWER_MEASUREMENTS];
213} __attribute__ ((packed)); 213} __attribute__ ((packed));
214 214
215struct iwl_eeprom_calib_subband_info { 215struct iwl4965_eeprom_calib_subband_info {
216 u8 ch_from; 216 u8 ch_from;
217 u8 ch_to; 217 u8 ch_to;
218 struct iwl_eeprom_calib_ch_info ch1; 218 struct iwl4965_eeprom_calib_ch_info ch1;
219 struct iwl_eeprom_calib_ch_info ch2; 219 struct iwl4965_eeprom_calib_ch_info ch2;
220} __attribute__ ((packed)); 220} __attribute__ ((packed));
221 221
222struct iwl_eeprom_calib_info { 222struct iwl4965_eeprom_calib_info {
223 u8 saturation_power24; 223 u8 saturation_power24;
224 u8 saturation_power52; 224 u8 saturation_power52;
225 s16 voltage; /* signed */ 225 s16 voltage; /* signed */
226 struct iwl_eeprom_calib_subband_info band_info[EEPROM_TX_POWER_BANDS]; 226 struct iwl4965_eeprom_calib_subband_info band_info[EEPROM_TX_POWER_BANDS];
227} __attribute__ ((packed)); 227} __attribute__ ((packed));
228 228
229 229
230struct iwl_eeprom { 230struct iwl4965_eeprom {
231 u8 reserved0[16]; 231 u8 reserved0[16];
232#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */ 232#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */
233 u16 device_id; /* abs.ofs: 16 */ 233 u16 device_id; /* abs.ofs: 16 */
@@ -276,30 +276,30 @@ struct iwl_eeprom {
276#define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */ 276#define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */
277 u16 band_1_count; /* abs.ofs: 196 */ 277 u16 band_1_count; /* abs.ofs: 196 */
278#define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */ 278#define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */
279 struct iwl_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */ 279 struct iwl4965_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */
280#define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */ 280#define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */
281 u16 band_2_count; /* abs.ofs: 226 */ 281 u16 band_2_count; /* abs.ofs: 226 */
282#define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */ 282#define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */
283 struct iwl_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ 283 struct iwl4965_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
284#define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */ 284#define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */
285 u16 band_3_count; /* abs.ofs: 254 */ 285 u16 band_3_count; /* abs.ofs: 254 */
286#define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */ 286#define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */
287 struct iwl_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ 287 struct iwl4965_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
288#define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */ 288#define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */
289 u16 band_4_count; /* abs.ofs: 280 */ 289 u16 band_4_count; /* abs.ofs: 280 */
290#define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */ 290#define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */
291 struct iwl_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ 291 struct iwl4965_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
292#define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */ 292#define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */
293 u16 band_5_count; /* abs.ofs: 304 */ 293 u16 band_5_count; /* abs.ofs: 304 */
294#define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */ 294#define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */
295 struct iwl_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ 295 struct iwl4965_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
296 296
297 u8 reserved10[2]; 297 u8 reserved10[2];
298#define EEPROM_REGULATORY_BAND_24_FAT_CHANNELS (2*0xA0) /* 14 bytes */ 298#define EEPROM_REGULATORY_BAND_24_FAT_CHANNELS (2*0xA0) /* 14 bytes */
299 struct iwl_eeprom_channel band_24_channels[7]; /* abs.ofs: 320 */ 299 struct iwl4965_eeprom_channel band_24_channels[7]; /* abs.ofs: 320 */
300 u8 reserved11[2]; 300 u8 reserved11[2];
301#define EEPROM_REGULATORY_BAND_52_FAT_CHANNELS (2*0xA8) /* 22 bytes */ 301#define EEPROM_REGULATORY_BAND_52_FAT_CHANNELS (2*0xA8) /* 22 bytes */
302 struct iwl_eeprom_channel band_52_channels[11]; /* abs.ofs: 336 */ 302 struct iwl4965_eeprom_channel band_52_channels[11]; /* abs.ofs: 336 */
303 u8 reserved12[6]; 303 u8 reserved12[6];
304#define EEPROM_CALIB_VERSION_OFFSET (2*0xB6) /* 2 bytes */ 304#define EEPROM_CALIB_VERSION_OFFSET (2*0xB6) /* 2 bytes */
305 u16 calib_version; /* abs.ofs: 364 */ 305 u16 calib_version; /* abs.ofs: 364 */
@@ -308,7 +308,7 @@ struct iwl_eeprom {
308 u16 satruation_power; /* abs.ofs: 368 */ 308 u16 satruation_power; /* abs.ofs: 368 */
309 u8 reserved14[94]; 309 u8 reserved14[94];
310#define EEPROM_IWL_CALIB_TXPOWER_OFFSET (2*0xE8) /* 48 bytes */ 310#define EEPROM_IWL_CALIB_TXPOWER_OFFSET (2*0xE8) /* 48 bytes */
311 struct iwl_eeprom_calib_info calib_info; /* abs.ofs: 464 */ 311 struct iwl4965_eeprom_calib_info calib_info; /* abs.ofs: 464 */
312 312
313 u8 reserved16[140]; /* fill out to full 1024 byte block */ 313 u8 reserved16[140]; /* fill out to full 1024 byte block */
314 314
@@ -731,8 +731,8 @@ struct iwl_eeprom {
731#define TFD_TX_CMD_SLOTS 256 731#define TFD_TX_CMD_SLOTS 256
732#define TFD_CMD_SLOTS 32 732#define TFD_CMD_SLOTS 32
733 733
734#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \ 734#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl4965_cmd) - \
735 sizeof(struct iwl_cmd_meta)) 735 sizeof(struct iwl4965_cmd_meta))
736 736
737/* 737/*
738 * RX related structures and functions 738 * RX related structures and functions
@@ -751,7 +751,7 @@ struct iwl_eeprom {
751#define IWL_MAX_INST_SIZE KDR_RTC_INST_SIZE 751#define IWL_MAX_INST_SIZE KDR_RTC_INST_SIZE
752#define IWL_MAX_DATA_SIZE KDR_RTC_DATA_SIZE 752#define IWL_MAX_DATA_SIZE KDR_RTC_DATA_SIZE
753 753
754static inline int iwl_hw_valid_rtc_data_addr(u32 addr) 754static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
755{ 755{
756 return (addr >= RTC_DATA_LOWER_BOUND) && 756 return (addr >= RTC_DATA_LOWER_BOUND) &&
757 (addr < KDR_RTC_DATA_UPPER_BOUND); 757 (addr < KDR_RTC_DATA_UPPER_BOUND);
@@ -873,7 +873,7 @@ enum {
873#define CALIB_IWL_TX_ATTEN_GR5_LCH 20 873#define CALIB_IWL_TX_ATTEN_GR5_LCH 20
874 874
875 875
876union iwl_tx_power_dual_stream { 876union iwl4965_tx_power_dual_stream {
877 struct { 877 struct {
878 u8 radio_tx_gain[2]; 878 u8 radio_tx_gain[2];
879 u8 dsp_predis_atten[2]; 879 u8 dsp_predis_atten[2];
@@ -1115,20 +1115,20 @@ union iwl_tx_power_dual_stream {
1115#define CSR_HW_IF_CONFIG_REG_BIT_MAC_SI (0x00000100) 1115#define CSR_HW_IF_CONFIG_REG_BIT_MAC_SI (0x00000100)
1116#define CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI (0x00000200) 1116#define CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI (0x00000200)
1117 1117
1118static inline u8 iwl_hw_get_rate(__le32 rate_n_flags) 1118static inline u8 iwl4965_hw_get_rate(__le32 rate_n_flags)
1119{ 1119{
1120 return le32_to_cpu(rate_n_flags) & 0xFF; 1120 return le32_to_cpu(rate_n_flags) & 0xFF;
1121} 1121}
1122static inline u16 iwl_hw_get_rate_n_flags(__le32 rate_n_flags) 1122static inline u16 iwl4965_hw_get_rate_n_flags(__le32 rate_n_flags)
1123{ 1123{
1124 return le32_to_cpu(rate_n_flags) & 0xFFFF; 1124 return le32_to_cpu(rate_n_flags) & 0xFFFF;
1125} 1125}
1126static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u16 flags) 1126static inline __le32 iwl4965_hw_set_rate_n_flags(u8 rate, u16 flags)
1127{ 1127{
1128 return cpu_to_le32(flags|(u16)rate); 1128 return cpu_to_le32(flags|(u16)rate);
1129} 1129}
1130 1130
1131struct iwl_tfd_frame_data { 1131struct iwl4965_tfd_frame_data {
1132 __le32 tb1_addr; 1132 __le32 tb1_addr;
1133 1133
1134 __le32 val1; 1134 __le32 val1;
@@ -1156,7 +1156,7 @@ struct iwl_tfd_frame_data {
1156#define IWL_tb2_len_SYM val2 1156#define IWL_tb2_len_SYM val2
1157} __attribute__ ((packed)); 1157} __attribute__ ((packed));
1158 1158
1159struct iwl_tfd_frame { 1159struct iwl4965_tfd_frame {
1160 __le32 val0; 1160 __le32 val0;
1161 /* __le32 rsvd1:24; */ 1161 /* __le32 rsvd1:24; */
1162 /* __le32 num_tbs:5; */ 1162 /* __le32 num_tbs:5; */
@@ -1165,7 +1165,7 @@ struct iwl_tfd_frame {
1165#define IWL_num_tbs_SYM val0 1165#define IWL_num_tbs_SYM val0
1166 /* __le32 rsvd2:1; */ 1166 /* __le32 rsvd2:1; */
1167 /* __le32 padding:2; */ 1167 /* __le32 padding:2; */
1168 struct iwl_tfd_frame_data pa[10]; 1168 struct iwl4965_tfd_frame_data pa[10];
1169 __le32 reserved; 1169 __le32 reserved;
1170} __attribute__ ((packed)); 1170} __attribute__ ((packed));
1171 1171
@@ -1191,9 +1191,9 @@ struct iwl4965_sched_queue_byte_cnt_tbl {
1191 sizeof(__le16)]; 1191 sizeof(__le16)];
1192} __attribute__ ((packed)); 1192} __attribute__ ((packed));
1193 1193
1194/* Base physical address of iwl_shared is provided to KDR_SCD_DRAM_BASE_ADDR 1194/* Base physical address of iwl4965_shared is provided to KDR_SCD_DRAM_BASE_ADDR
1195 * and &iwl_shared.val0 is provided to FH_RSCSR_CHNL0_STTS_WPTR_REG */ 1195 * and &iwl4965_shared.val0 is provided to FH_RSCSR_CHNL0_STTS_WPTR_REG */
1196struct iwl_shared { 1196struct iwl4965_shared {
1197 struct iwl4965_sched_queue_byte_cnt_tbl 1197 struct iwl4965_sched_queue_byte_cnt_tbl
1198 queues_byte_cnt_tbls[IWL_MAX_NUM_QUEUES]; 1198 queues_byte_cnt_tbls[IWL_MAX_NUM_QUEUES];
1199 __le32 val0; 1199 __le32 val0;
@@ -1225,4 +1225,4 @@ struct iwl_shared {
1225 __le32 padding2; 1225 __le32 padding2;
1226} __attribute__ ((packed)); 1226} __attribute__ ((packed));
1227 1227
1228#endif /* __iwl_4965_hw_h__ */ 1228#endif /* __iwl4965_4965_hw_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-io.h b/drivers/net/wireless/iwlwifi/iwl-4965-io.h
index 5c497e4beea2..34a0b57eea0c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-io.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-io.h
@@ -26,8 +26,8 @@
26 * 26 *
27 *****************************************************************************/ 27 *****************************************************************************/
28 28
29#ifndef __iwl_io_h__ 29#ifndef __iwl4965_io_h__
30#define __iwl_io_h__ 30#define __iwl4965_io_h__
31 31
32#include <linux/io.h> 32#include <linux/io.h>
33 33
@@ -49,8 +49,8 @@
49 * 49 *
50 * If you wish to call the function without any debug or state checking, 50 * If you wish to call the function without any debug or state checking,
51 * you should use the single _ prefix version (as is used by dependent IO 51 * you should use the single _ prefix version (as is used by dependent IO
52 * routines, for example _iwl_read_direct32 calls the non-check version of 52 * routines, for example _iwl4965_read_direct32 calls the non-check version of
53 * _iwl_read32.) 53 * _iwl4965_read32.)
54 * 54 *
55 * These declarations are *extremely* useful in quickly isolating code deltas 55 * These declarations are *extremely* useful in quickly isolating code deltas
56 * which result in misconfiguring of the hardware I/O. In combination with 56 * which result in misconfiguring of the hardware I/O. In combination with
@@ -59,39 +59,39 @@
59 * 59 *
60 */ 60 */
61 61
62#define _iwl_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs)) 62#define _iwl4965_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs))
63#ifdef CONFIG_IWL4965_DEBUG 63#ifdef CONFIG_IWL4965_DEBUG
64static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *iwl, 64static inline void __iwl4965_write32(const char *f, u32 l, struct iwl4965_priv *iwl,
65 u32 ofs, u32 val) 65 u32 ofs, u32 val)
66{ 66{
67 IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l); 67 IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l);
68 _iwl_write32(iwl, ofs, val); 68 _iwl4965_write32(iwl, ofs, val);
69} 69}
70#define iwl_write32(iwl, ofs, val) \ 70#define iwl4965_write32(iwl, ofs, val) \
71 __iwl_write32(__FILE__, __LINE__, iwl, ofs, val) 71 __iwl4965_write32(__FILE__, __LINE__, iwl, ofs, val)
72#else 72#else
73#define iwl_write32(iwl, ofs, val) _iwl_write32(iwl, ofs, val) 73#define iwl4965_write32(iwl, ofs, val) _iwl4965_write32(iwl, ofs, val)
74#endif 74#endif
75 75
76#define _iwl_read32(iwl, ofs) readl((iwl)->hw_base + (ofs)) 76#define _iwl4965_read32(iwl, ofs) readl((iwl)->hw_base + (ofs))
77#ifdef CONFIG_IWL4965_DEBUG 77#ifdef CONFIG_IWL4965_DEBUG
78static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *iwl, u32 ofs) 78static inline u32 __iwl4965_read32(char *f, u32 l, struct iwl4965_priv *iwl, u32 ofs)
79{ 79{
80 IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l); 80 IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l);
81 return _iwl_read32(iwl, ofs); 81 return _iwl4965_read32(iwl, ofs);
82} 82}
83#define iwl_read32(iwl, ofs) __iwl_read32(__FILE__, __LINE__, iwl, ofs) 83#define iwl4965_read32(iwl, ofs) __iwl4965_read32(__FILE__, __LINE__, iwl, ofs)
84#else 84#else
85#define iwl_read32(p, o) _iwl_read32(p, o) 85#define iwl4965_read32(p, o) _iwl4965_read32(p, o)
86#endif 86#endif
87 87
88static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr, 88static inline int _iwl4965_poll_bit(struct iwl4965_priv *priv, u32 addr,
89 u32 bits, u32 mask, int timeout) 89 u32 bits, u32 mask, int timeout)
90{ 90{
91 int i = 0; 91 int i = 0;
92 92
93 do { 93 do {
94 if ((_iwl_read32(priv, addr) & mask) == (bits & mask)) 94 if ((_iwl4965_read32(priv, addr) & mask) == (bits & mask))
95 return i; 95 return i;
96 mdelay(10); 96 mdelay(10);
97 i += 10; 97 i += 10;
@@ -100,11 +100,11 @@ static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr,
100 return -ETIMEDOUT; 100 return -ETIMEDOUT;
101} 101}
102#ifdef CONFIG_IWL4965_DEBUG 102#ifdef CONFIG_IWL4965_DEBUG
103static inline int __iwl_poll_bit(const char *f, u32 l, 103static inline int __iwl4965_poll_bit(const char *f, u32 l,
104 struct iwl_priv *priv, u32 addr, 104 struct iwl4965_priv *priv, u32 addr,
105 u32 bits, u32 mask, int timeout) 105 u32 bits, u32 mask, int timeout)
106{ 106{
107 int ret = _iwl_poll_bit(priv, addr, bits, mask, timeout); 107 int ret = _iwl4965_poll_bit(priv, addr, bits, mask, timeout);
108 if (unlikely(ret == -ETIMEDOUT)) 108 if (unlikely(ret == -ETIMEDOUT))
109 IWL_DEBUG_IO 109 IWL_DEBUG_IO
110 ("poll_bit(0x%08X, 0x%08X, 0x%08X) - timedout - %s %d\n", 110 ("poll_bit(0x%08X, 0x%08X, 0x%08X) - timedout - %s %d\n",
@@ -115,47 +115,47 @@ static inline int __iwl_poll_bit(const char *f, u32 l,
115 addr, bits, mask, ret, f, l); 115 addr, bits, mask, ret, f, l);
116 return ret; 116 return ret;
117} 117}
118#define iwl_poll_bit(iwl, addr, bits, mask, timeout) \ 118#define iwl4965_poll_bit(iwl, addr, bits, mask, timeout) \
119 __iwl_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout) 119 __iwl4965_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout)
120#else 120#else
121#define iwl_poll_bit(p, a, b, m, t) _iwl_poll_bit(p, a, b, m, t) 121#define iwl4965_poll_bit(p, a, b, m, t) _iwl4965_poll_bit(p, a, b, m, t)
122#endif 122#endif
123 123
124static inline void _iwl_set_bit(struct iwl_priv *priv, u32 reg, u32 mask) 124static inline void _iwl4965_set_bit(struct iwl4965_priv *priv, u32 reg, u32 mask)
125{ 125{
126 _iwl_write32(priv, reg, _iwl_read32(priv, reg) | mask); 126 _iwl4965_write32(priv, reg, _iwl4965_read32(priv, reg) | mask);
127} 127}
128#ifdef CONFIG_IWL4965_DEBUG 128#ifdef CONFIG_IWL4965_DEBUG
129static inline void __iwl_set_bit(const char *f, u32 l, 129static inline void __iwl4965_set_bit(const char *f, u32 l,
130 struct iwl_priv *priv, u32 reg, u32 mask) 130 struct iwl4965_priv *priv, u32 reg, u32 mask)
131{ 131{
132 u32 val = _iwl_read32(priv, reg) | mask; 132 u32 val = _iwl4965_read32(priv, reg) | mask;
133 IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); 133 IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
134 _iwl_write32(priv, reg, val); 134 _iwl4965_write32(priv, reg, val);
135} 135}
136#define iwl_set_bit(p, r, m) __iwl_set_bit(__FILE__, __LINE__, p, r, m) 136#define iwl4965_set_bit(p, r, m) __iwl4965_set_bit(__FILE__, __LINE__, p, r, m)
137#else 137#else
138#define iwl_set_bit(p, r, m) _iwl_set_bit(p, r, m) 138#define iwl4965_set_bit(p, r, m) _iwl4965_set_bit(p, r, m)
139#endif 139#endif
140 140
141static inline void _iwl_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask) 141static inline void _iwl4965_clear_bit(struct iwl4965_priv *priv, u32 reg, u32 mask)
142{ 142{
143 _iwl_write32(priv, reg, _iwl_read32(priv, reg) & ~mask); 143 _iwl4965_write32(priv, reg, _iwl4965_read32(priv, reg) & ~mask);
144} 144}
145#ifdef CONFIG_IWL4965_DEBUG 145#ifdef CONFIG_IWL4965_DEBUG
146static inline void __iwl_clear_bit(const char *f, u32 l, 146static inline void __iwl4965_clear_bit(const char *f, u32 l,
147 struct iwl_priv *priv, u32 reg, u32 mask) 147 struct iwl4965_priv *priv, u32 reg, u32 mask)
148{ 148{
149 u32 val = _iwl_read32(priv, reg) & ~mask; 149 u32 val = _iwl4965_read32(priv, reg) & ~mask;
150 IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); 150 IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
151 _iwl_write32(priv, reg, val); 151 _iwl4965_write32(priv, reg, val);
152} 152}
153#define iwl_clear_bit(p, r, m) __iwl_clear_bit(__FILE__, __LINE__, p, r, m) 153#define iwl4965_clear_bit(p, r, m) __iwl4965_clear_bit(__FILE__, __LINE__, p, r, m)
154#else 154#else
155#define iwl_clear_bit(p, r, m) _iwl_clear_bit(p, r, m) 155#define iwl4965_clear_bit(p, r, m) _iwl4965_clear_bit(p, r, m)
156#endif 156#endif
157 157
158static inline int _iwl_grab_nic_access(struct iwl_priv *priv) 158static inline int _iwl4965_grab_nic_access(struct iwl4965_priv *priv)
159{ 159{
160 int ret; 160 int ret;
161 u32 gp_ctl; 161 u32 gp_ctl;
@@ -170,7 +170,7 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv)
170 "wakes up NIC\n"); 170 "wakes up NIC\n");
171 171
172 /* 10 msec allows time for NIC to complete its data save */ 172 /* 10 msec allows time for NIC to complete its data save */
173 gp_ctl = _iwl_read32(priv, CSR_GP_CNTRL); 173 gp_ctl = _iwl4965_read32(priv, CSR_GP_CNTRL);
174 if (gp_ctl & CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY) { 174 if (gp_ctl & CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY) {
175 IWL_DEBUG_RF_KILL("Wait for complete power-down, " 175 IWL_DEBUG_RF_KILL("Wait for complete power-down, "
176 "gpctl = 0x%08x\n", gp_ctl); 176 "gpctl = 0x%08x\n", gp_ctl);
@@ -181,8 +181,8 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv)
181 } 181 }
182 182
183 /* this bit wakes up the NIC */ 183 /* this bit wakes up the NIC */
184 _iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 184 _iwl4965_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
185 ret = _iwl_poll_bit(priv, CSR_GP_CNTRL, 185 ret = _iwl4965_poll_bit(priv, CSR_GP_CNTRL,
186 CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, 186 CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN,
187 (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | 187 (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY |
188 CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50); 188 CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50);
@@ -198,106 +198,106 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv)
198} 198}
199 199
200#ifdef CONFIG_IWL4965_DEBUG 200#ifdef CONFIG_IWL4965_DEBUG
201static inline int __iwl_grab_nic_access(const char *f, u32 l, 201static inline int __iwl4965_grab_nic_access(const char *f, u32 l,
202 struct iwl_priv *priv) 202 struct iwl4965_priv *priv)
203{ 203{
204 if (atomic_read(&priv->restrict_refcnt)) 204 if (atomic_read(&priv->restrict_refcnt))
205 IWL_DEBUG_INFO("Grabbing access while already held at " 205 IWL_DEBUG_INFO("Grabbing access while already held at "
206 "line %d.\n", l); 206 "line %d.\n", l);
207 207
208 IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l); 208 IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l);
209 return _iwl_grab_nic_access(priv); 209 return _iwl4965_grab_nic_access(priv);
210} 210}
211#define iwl_grab_nic_access(priv) \ 211#define iwl4965_grab_nic_access(priv) \
212 __iwl_grab_nic_access(__FILE__, __LINE__, priv) 212 __iwl4965_grab_nic_access(__FILE__, __LINE__, priv)
213#else 213#else
214#define iwl_grab_nic_access(priv) \ 214#define iwl4965_grab_nic_access(priv) \
215 _iwl_grab_nic_access(priv) 215 _iwl4965_grab_nic_access(priv)
216#endif 216#endif
217 217
218static inline void _iwl_release_nic_access(struct iwl_priv *priv) 218static inline void _iwl4965_release_nic_access(struct iwl4965_priv *priv)
219{ 219{
220#ifdef CONFIG_IWL4965_DEBUG 220#ifdef CONFIG_IWL4965_DEBUG
221 if (atomic_dec_and_test(&priv->restrict_refcnt)) 221 if (atomic_dec_and_test(&priv->restrict_refcnt))
222#endif 222#endif
223 _iwl_clear_bit(priv, CSR_GP_CNTRL, 223 _iwl4965_clear_bit(priv, CSR_GP_CNTRL,
224 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 224 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
225} 225}
226#ifdef CONFIG_IWL4965_DEBUG 226#ifdef CONFIG_IWL4965_DEBUG
227static inline void __iwl_release_nic_access(const char *f, u32 l, 227static inline void __iwl4965_release_nic_access(const char *f, u32 l,
228 struct iwl_priv *priv) 228 struct iwl4965_priv *priv)
229{ 229{
230 if (atomic_read(&priv->restrict_refcnt) <= 0) 230 if (atomic_read(&priv->restrict_refcnt) <= 0)
231 IWL_ERROR("Release unheld nic access at line %d.\n", l); 231 IWL_ERROR("Release unheld nic access at line %d.\n", l);
232 232
233 IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l); 233 IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l);
234 _iwl_release_nic_access(priv); 234 _iwl4965_release_nic_access(priv);
235} 235}
236#define iwl_release_nic_access(priv) \ 236#define iwl4965_release_nic_access(priv) \
237 __iwl_release_nic_access(__FILE__, __LINE__, priv) 237 __iwl4965_release_nic_access(__FILE__, __LINE__, priv)
238#else 238#else
239#define iwl_release_nic_access(priv) \ 239#define iwl4965_release_nic_access(priv) \
240 _iwl_release_nic_access(priv) 240 _iwl4965_release_nic_access(priv)
241#endif 241#endif
242 242
243static inline u32 _iwl_read_direct32(struct iwl_priv *priv, u32 reg) 243static inline u32 _iwl4965_read_direct32(struct iwl4965_priv *priv, u32 reg)
244{ 244{
245 return _iwl_read32(priv, reg); 245 return _iwl4965_read32(priv, reg);
246} 246}
247#ifdef CONFIG_IWL4965_DEBUG 247#ifdef CONFIG_IWL4965_DEBUG
248static inline u32 __iwl_read_direct32(const char *f, u32 l, 248static inline u32 __iwl4965_read_direct32(const char *f, u32 l,
249 struct iwl_priv *priv, u32 reg) 249 struct iwl4965_priv *priv, u32 reg)
250{ 250{
251 u32 value = _iwl_read_direct32(priv, reg); 251 u32 value = _iwl4965_read_direct32(priv, reg);
252 if (!atomic_read(&priv->restrict_refcnt)) 252 if (!atomic_read(&priv->restrict_refcnt))
253 IWL_ERROR("Nic access not held from %s %d\n", f, l); 253 IWL_ERROR("Nic access not held from %s %d\n", f, l);
254 IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value, 254 IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value,
255 f, l); 255 f, l);
256 return value; 256 return value;
257} 257}
258#define iwl_read_direct32(priv, reg) \ 258#define iwl4965_read_direct32(priv, reg) \
259 __iwl_read_direct32(__FILE__, __LINE__, priv, reg) 259 __iwl4965_read_direct32(__FILE__, __LINE__, priv, reg)
260#else 260#else
261#define iwl_read_direct32 _iwl_read_direct32 261#define iwl4965_read_direct32 _iwl4965_read_direct32
262#endif 262#endif
263 263
264static inline void _iwl_write_direct32(struct iwl_priv *priv, 264static inline void _iwl4965_write_direct32(struct iwl4965_priv *priv,
265 u32 reg, u32 value) 265 u32 reg, u32 value)
266{ 266{
267 _iwl_write32(priv, reg, value); 267 _iwl4965_write32(priv, reg, value);
268} 268}
269#ifdef CONFIG_IWL4965_DEBUG 269#ifdef CONFIG_IWL4965_DEBUG
270static void __iwl_write_direct32(u32 line, 270static void __iwl4965_write_direct32(u32 line,
271 struct iwl_priv *priv, u32 reg, u32 value) 271 struct iwl4965_priv *priv, u32 reg, u32 value)
272{ 272{
273 if (!atomic_read(&priv->restrict_refcnt)) 273 if (!atomic_read(&priv->restrict_refcnt))
274 IWL_ERROR("Nic access not held from line %d\n", line); 274 IWL_ERROR("Nic access not held from line %d\n", line);
275 _iwl_write_direct32(priv, reg, value); 275 _iwl4965_write_direct32(priv, reg, value);
276} 276}
277#define iwl_write_direct32(priv, reg, value) \ 277#define iwl4965_write_direct32(priv, reg, value) \
278 __iwl_write_direct32(__LINE__, priv, reg, value) 278 __iwl4965_write_direct32(__LINE__, priv, reg, value)
279#else 279#else
280#define iwl_write_direct32 _iwl_write_direct32 280#define iwl4965_write_direct32 _iwl4965_write_direct32
281#endif 281#endif
282 282
283static inline void iwl_write_reg_buf(struct iwl_priv *priv, 283static inline void iwl4965_write_reg_buf(struct iwl4965_priv *priv,
284 u32 reg, u32 len, u32 *values) 284 u32 reg, u32 len, u32 *values)
285{ 285{
286 u32 count = sizeof(u32); 286 u32 count = sizeof(u32);
287 287
288 if ((priv != NULL) && (values != NULL)) { 288 if ((priv != NULL) && (values != NULL)) {
289 for (; 0 < len; len -= count, reg += count, values++) 289 for (; 0 < len; len -= count, reg += count, values++)
290 _iwl_write_direct32(priv, reg, *values); 290 _iwl4965_write_direct32(priv, reg, *values);
291 } 291 }
292} 292}
293 293
294static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, 294static inline int _iwl4965_poll_direct_bit(struct iwl4965_priv *priv,
295 u32 addr, u32 mask, int timeout) 295 u32 addr, u32 mask, int timeout)
296{ 296{
297 int i = 0; 297 int i = 0;
298 298
299 do { 299 do {
300 if ((_iwl_read_direct32(priv, addr) & mask) == mask) 300 if ((_iwl4965_read_direct32(priv, addr) & mask) == mask)
301 return i; 301 return i;
302 mdelay(10); 302 mdelay(10);
303 i += 10; 303 i += 10;
@@ -307,11 +307,11 @@ static inline int _iwl_poll_direct_bit(struct iwl_priv *priv,
307} 307}
308 308
309#ifdef CONFIG_IWL4965_DEBUG 309#ifdef CONFIG_IWL4965_DEBUG
310static inline int __iwl_poll_direct_bit(const char *f, u32 l, 310static inline int __iwl4965_poll_direct_bit(const char *f, u32 l,
311 struct iwl_priv *priv, 311 struct iwl4965_priv *priv,
312 u32 addr, u32 mask, int timeout) 312 u32 addr, u32 mask, int timeout)
313{ 313{
314 int ret = _iwl_poll_direct_bit(priv, addr, mask, timeout); 314 int ret = _iwl4965_poll_direct_bit(priv, addr, mask, timeout);
315 315
316 if (unlikely(ret == -ETIMEDOUT)) 316 if (unlikely(ret == -ETIMEDOUT))
317 IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) - " 317 IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) - "
@@ -321,111 +321,111 @@ static inline int __iwl_poll_direct_bit(const char *f, u32 l,
321 "- %s %d\n", addr, mask, ret, f, l); 321 "- %s %d\n", addr, mask, ret, f, l);
322 return ret; 322 return ret;
323} 323}
324#define iwl_poll_direct_bit(iwl, addr, mask, timeout) \ 324#define iwl4965_poll_direct_bit(iwl, addr, mask, timeout) \
325 __iwl_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout) 325 __iwl4965_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout)
326#else 326#else
327#define iwl_poll_direct_bit _iwl_poll_direct_bit 327#define iwl4965_poll_direct_bit _iwl4965_poll_direct_bit
328#endif 328#endif
329 329
330static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) 330static inline u32 _iwl4965_read_prph(struct iwl4965_priv *priv, u32 reg)
331{ 331{
332 _iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); 332 _iwl4965_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
333 return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT); 333 return _iwl4965_read_direct32(priv, HBUS_TARG_PRPH_RDAT);
334} 334}
335#ifdef CONFIG_IWL4965_DEBUG 335#ifdef CONFIG_IWL4965_DEBUG
336static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg) 336static inline u32 __iwl4965_read_prph(u32 line, struct iwl4965_priv *priv, u32 reg)
337{ 337{
338 if (!atomic_read(&priv->restrict_refcnt)) 338 if (!atomic_read(&priv->restrict_refcnt))
339 IWL_ERROR("Nic access not held from line %d\n", line); 339 IWL_ERROR("Nic access not held from line %d\n", line);
340 return _iwl_read_prph(priv, reg); 340 return _iwl4965_read_prph(priv, reg);
341} 341}
342 342
343#define iwl_read_prph(priv, reg) \ 343#define iwl4965_read_prph(priv, reg) \
344 __iwl_read_prph(__LINE__, priv, reg) 344 __iwl4965_read_prph(__LINE__, priv, reg)
345#else 345#else
346#define iwl_read_prph _iwl_read_prph 346#define iwl4965_read_prph _iwl4965_read_prph
347#endif 347#endif
348 348
349static inline void _iwl_write_prph(struct iwl_priv *priv, 349static inline void _iwl4965_write_prph(struct iwl4965_priv *priv,
350 u32 addr, u32 val) 350 u32 addr, u32 val)
351{ 351{
352 _iwl_write_direct32(priv, HBUS_TARG_PRPH_WADDR, 352 _iwl4965_write_direct32(priv, HBUS_TARG_PRPH_WADDR,
353 ((addr & 0x0000FFFF) | (3 << 24))); 353 ((addr & 0x0000FFFF) | (3 << 24)));
354 _iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); 354 _iwl4965_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val);
355} 355}
356#ifdef CONFIG_IWL4965_DEBUG 356#ifdef CONFIG_IWL4965_DEBUG
357static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv, 357static inline void __iwl4965_write_prph(u32 line, struct iwl4965_priv *priv,
358 u32 addr, u32 val) 358 u32 addr, u32 val)
359{ 359{
360 if (!atomic_read(&priv->restrict_refcnt)) 360 if (!atomic_read(&priv->restrict_refcnt))
361 IWL_ERROR("Nic access from line %d\n", line); 361 IWL_ERROR("Nic access from line %d\n", line);
362 _iwl_write_prph(priv, addr, val); 362 _iwl4965_write_prph(priv, addr, val);
363} 363}
364 364
365#define iwl_write_prph(priv, addr, val) \ 365#define iwl4965_write_prph(priv, addr, val) \
366 __iwl_write_prph(__LINE__, priv, addr, val); 366 __iwl4965_write_prph(__LINE__, priv, addr, val);
367#else 367#else
368#define iwl_write_prph _iwl_write_prph 368#define iwl4965_write_prph _iwl4965_write_prph
369#endif 369#endif
370 370
371#define _iwl_set_bits_prph(priv, reg, mask) \ 371#define _iwl4965_set_bits_prph(priv, reg, mask) \
372 _iwl_write_prph(priv, reg, (_iwl_read_prph(priv, reg) | mask)) 372 _iwl4965_write_prph(priv, reg, (_iwl4965_read_prph(priv, reg) | mask))
373#ifdef CONFIG_IWL4965_DEBUG 373#ifdef CONFIG_IWL4965_DEBUG
374static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv, 374static inline void __iwl4965_set_bits_prph(u32 line, struct iwl4965_priv *priv,
375 u32 reg, u32 mask) 375 u32 reg, u32 mask)
376{ 376{
377 if (!atomic_read(&priv->restrict_refcnt)) 377 if (!atomic_read(&priv->restrict_refcnt))
378 IWL_ERROR("Nic access not held from line %d\n", line); 378 IWL_ERROR("Nic access not held from line %d\n", line);
379 379
380 _iwl_set_bits_prph(priv, reg, mask); 380 _iwl4965_set_bits_prph(priv, reg, mask);
381} 381}
382#define iwl_set_bits_prph(priv, reg, mask) \ 382#define iwl4965_set_bits_prph(priv, reg, mask) \
383 __iwl_set_bits_prph(__LINE__, priv, reg, mask) 383 __iwl4965_set_bits_prph(__LINE__, priv, reg, mask)
384#else 384#else
385#define iwl_set_bits_prph _iwl_set_bits_prph 385#define iwl4965_set_bits_prph _iwl4965_set_bits_prph
386#endif 386#endif
387 387
388#define _iwl_set_bits_mask_prph(priv, reg, bits, mask) \ 388#define _iwl4965_set_bits_mask_prph(priv, reg, bits, mask) \
389 _iwl_write_prph(priv, reg, ((_iwl_read_prph(priv, reg) & mask) | bits)) 389 _iwl4965_write_prph(priv, reg, ((_iwl4965_read_prph(priv, reg) & mask) | bits))
390 390
391#ifdef CONFIG_IWL4965_DEBUG 391#ifdef CONFIG_IWL4965_DEBUG
392static inline void __iwl_set_bits_mask_prph(u32 line, 392static inline void __iwl4965_set_bits_mask_prph(u32 line,
393 struct iwl_priv *priv, u32 reg, u32 bits, u32 mask) 393 struct iwl4965_priv *priv, u32 reg, u32 bits, u32 mask)
394{ 394{
395 if (!atomic_read(&priv->restrict_refcnt)) 395 if (!atomic_read(&priv->restrict_refcnt))
396 IWL_ERROR("Nic access not held from line %d\n", line); 396 IWL_ERROR("Nic access not held from line %d\n", line);
397 _iwl_set_bits_mask_prph(priv, reg, bits, mask); 397 _iwl4965_set_bits_mask_prph(priv, reg, bits, mask);
398} 398}
399#define iwl_set_bits_mask_prph(priv, reg, bits, mask) \ 399#define iwl4965_set_bits_mask_prph(priv, reg, bits, mask) \
400 __iwl_set_bits_mask_prph(__LINE__, priv, reg, bits, mask) 400 __iwl4965_set_bits_mask_prph(__LINE__, priv, reg, bits, mask)
401#else 401#else
402#define iwl_set_bits_mask_prph _iwl_set_bits_mask_prph 402#define iwl4965_set_bits_mask_prph _iwl4965_set_bits_mask_prph
403#endif 403#endif
404 404
405static inline void iwl_clear_bits_prph(struct iwl_priv 405static inline void iwl4965_clear_bits_prph(struct iwl4965_priv
406 *priv, u32 reg, u32 mask) 406 *priv, u32 reg, u32 mask)
407{ 407{
408 u32 val = _iwl_read_prph(priv, reg); 408 u32 val = _iwl4965_read_prph(priv, reg);
409 _iwl_write_prph(priv, reg, (val & ~mask)); 409 _iwl4965_write_prph(priv, reg, (val & ~mask));
410} 410}
411 411
412static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr) 412static inline u32 iwl4965_read_targ_mem(struct iwl4965_priv *priv, u32 addr)
413{ 413{
414 iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); 414 iwl4965_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr);
415 return iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); 415 return iwl4965_read_direct32(priv, HBUS_TARG_MEM_RDAT);
416} 416}
417 417
418static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val) 418static inline void iwl4965_write_targ_mem(struct iwl4965_priv *priv, u32 addr, u32 val)
419{ 419{
420 iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); 420 iwl4965_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
421 iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); 421 iwl4965_write_direct32(priv, HBUS_TARG_MEM_WDAT, val);
422} 422}
423 423
424static inline void iwl_write_targ_mem_buf(struct iwl_priv *priv, u32 addr, 424static inline void iwl4965_write_targ_mem_buf(struct iwl4965_priv *priv, u32 addr,
425 u32 len, u32 *values) 425 u32 len, u32 *values)
426{ 426{
427 iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); 427 iwl4965_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
428 for (; 0 < len; len -= sizeof(u32), values++) 428 for (; 0 < len; len -= sizeof(u32), values++)
429 iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); 429 iwl4965_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values);
430} 430}
431#endif 431#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index 2163805158b9..8d3d9f72a8ce 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -65,11 +65,11 @@ static u8 rs_ht_to_legacy[] = {
65 IWL_RATE_48M_INDEX, IWL_RATE_54M_INDEX 65 IWL_RATE_48M_INDEX, IWL_RATE_54M_INDEX
66}; 66};
67 67
68struct iwl_rate { 68struct iwl4965_rate {
69 u32 rate_n_flags; 69 u32 rate_n_flags;
70} __attribute__ ((packed)); 70} __attribute__ ((packed));
71 71
72struct iwl_rate_scale_data { 72struct iwl4965_rate_scale_data {
73 u64 data; 73 u64 data;
74 s32 success_counter; 74 s32 success_counter;
75 s32 success_ratio; 75 s32 success_ratio;
@@ -78,19 +78,19 @@ struct iwl_rate_scale_data {
78 unsigned long stamp; 78 unsigned long stamp;
79}; 79};
80 80
81struct iwl_scale_tbl_info { 81struct iwl4965_scale_tbl_info {
82 enum iwl_table_type lq_type; 82 enum iwl4965_table_type lq_type;
83 enum iwl_antenna_type antenna_type; 83 enum iwl4965_antenna_type antenna_type;
84 u8 is_SGI; 84 u8 is_SGI;
85 u8 is_fat; 85 u8 is_fat;
86 u8 is_dup; 86 u8 is_dup;
87 u8 action; 87 u8 action;
88 s32 *expected_tpt; 88 s32 *expected_tpt;
89 struct iwl_rate current_rate; 89 struct iwl4965_rate current_rate;
90 struct iwl_rate_scale_data win[IWL_RATE_COUNT]; 90 struct iwl4965_rate_scale_data win[IWL_RATE_COUNT];
91}; 91};
92 92
93struct iwl_rate_scale_priv { 93struct iwl4965_rate_scale_priv {
94 u8 active_tbl; 94 u8 active_tbl;
95 u8 enable_counter; 95 u8 enable_counter;
96 u8 stay_in_tbl; 96 u8 stay_in_tbl;
@@ -115,31 +115,31 @@ struct iwl_rate_scale_priv {
115 u16 active_siso_rate; 115 u16 active_siso_rate;
116 u16 active_mimo_rate; 116 u16 active_mimo_rate;
117 u16 active_rate_basic; 117 u16 active_rate_basic;
118 struct iwl_link_quality_cmd lq; 118 struct iwl4965_link_quality_cmd lq;
119 struct iwl_scale_tbl_info lq_info[LQ_SIZE]; 119 struct iwl4965_scale_tbl_info lq_info[LQ_SIZE];
120#ifdef CONFIG_MAC80211_DEBUGFS 120#ifdef CONFIG_MAC80211_DEBUGFS
121 struct dentry *rs_sta_dbgfs_scale_table_file; 121 struct dentry *rs_sta_dbgfs_scale_table_file;
122 struct dentry *rs_sta_dbgfs_stats_table_file; 122 struct dentry *rs_sta_dbgfs_stats_table_file;
123 struct iwl_rate dbg_fixed; 123 struct iwl4965_rate dbg_fixed;
124 struct iwl_priv *drv; 124 struct iwl4965_priv *drv;
125#endif 125#endif
126}; 126};
127 127
128static void rs_rate_scale_perform(struct iwl_priv *priv, 128static void rs_rate_scale_perform(struct iwl4965_priv *priv,
129 struct net_device *dev, 129 struct net_device *dev,
130 struct ieee80211_hdr *hdr, 130 struct ieee80211_hdr *hdr,
131 struct sta_info *sta); 131 struct sta_info *sta);
132static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data, 132static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data,
133 struct iwl_rate *tx_mcs, 133 struct iwl4965_rate *tx_mcs,
134 struct iwl_link_quality_cmd *tbl); 134 struct iwl4965_link_quality_cmd *tbl);
135 135
136 136
137#ifdef CONFIG_MAC80211_DEBUGFS 137#ifdef CONFIG_MAC80211_DEBUGFS
138static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv, 138static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv,
139 struct iwl_rate *mcs, int index); 139 struct iwl4965_rate *mcs, int index);
140#else 140#else
141static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv, 141static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv,
142 struct iwl_rate *mcs, int index) 142 struct iwl4965_rate *mcs, int index)
143{} 143{}
144#endif 144#endif
145static s32 expected_tpt_A[IWL_RATE_COUNT] = { 145static s32 expected_tpt_A[IWL_RATE_COUNT] = {
@@ -182,27 +182,27 @@ static s32 expected_tpt_mimo40MHzSGI[IWL_RATE_COUNT] = {
182 0, 0, 0, 0, 131, 131, 191, 222, 242, 270, 284, 289, 293 182 0, 0, 0, 0, 131, 131, 191, 222, 242, 270, 284, 289, 293
183}; 183};
184 184
185static int iwl_lq_sync_callback(struct iwl_priv *priv, 185static int iwl4965_lq_sync_callback(struct iwl4965_priv *priv,
186 struct iwl_cmd *cmd, struct sk_buff *skb) 186 struct iwl4965_cmd *cmd, struct sk_buff *skb)
187{ 187{
188 /*We didn't cache the SKB; let the caller free it */ 188 /*We didn't cache the SKB; let the caller free it */
189 return 1; 189 return 1;
190} 190}
191 191
192static inline u8 iwl_rate_get_rate(u32 rate_n_flags) 192static inline u8 iwl4965_rate_get_rate(u32 rate_n_flags)
193{ 193{
194 return (u8)(rate_n_flags & 0xFF); 194 return (u8)(rate_n_flags & 0xFF);
195} 195}
196 196
197static int rs_send_lq_cmd(struct iwl_priv *priv, 197static int rs_send_lq_cmd(struct iwl4965_priv *priv,
198 struct iwl_link_quality_cmd *lq, u8 flags) 198 struct iwl4965_link_quality_cmd *lq, u8 flags)
199{ 199{
200#ifdef CONFIG_IWL4965_DEBUG 200#ifdef CONFIG_IWL4965_DEBUG
201 int i; 201 int i;
202#endif 202#endif
203 struct iwl_host_cmd cmd = { 203 struct iwl4965_host_cmd cmd = {
204 .id = REPLY_TX_LINK_QUALITY_CMD, 204 .id = REPLY_TX_LINK_QUALITY_CMD,
205 .len = sizeof(struct iwl_link_quality_cmd), 205 .len = sizeof(struct iwl4965_link_quality_cmd),
206 .meta.flags = flags, 206 .meta.flags = flags,
207 .data = lq, 207 .data = lq,
208 }; 208 };
@@ -225,16 +225,16 @@ static int rs_send_lq_cmd(struct iwl_priv *priv,
225#endif 225#endif
226 226
227 if (flags & CMD_ASYNC) 227 if (flags & CMD_ASYNC)
228 cmd.meta.u.callback = iwl_lq_sync_callback; 228 cmd.meta.u.callback = iwl4965_lq_sync_callback;
229 229
230 if (iwl_is_associated(priv) && priv->assoc_station_added && 230 if (iwl4965_is_associated(priv) && priv->assoc_station_added &&
231 priv->lq_mngr.lq_ready) 231 priv->lq_mngr.lq_ready)
232 return iwl_send_cmd(priv, &cmd); 232 return iwl4965_send_cmd(priv, &cmd);
233 233
234 return 0; 234 return 0;
235} 235}
236 236
237static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window) 237static void rs_rate_scale_clear_window(struct iwl4965_rate_scale_data *window)
238{ 238{
239 window->data = 0; 239 window->data = 0;
240 window->success_counter = 0; 240 window->success_counter = 0;
@@ -244,10 +244,10 @@ static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window)
244 window->stamp = 0; 244 window->stamp = 0;
245} 245}
246 246
247static int rs_collect_tx_data(struct iwl_rate_scale_data *windows, 247static int rs_collect_tx_data(struct iwl4965_rate_scale_data *windows,
248 int scale_index, s32 tpt, u32 status) 248 int scale_index, s32 tpt, u32 status)
249{ 249{
250 struct iwl_rate_scale_data *window = NULL; 250 struct iwl4965_rate_scale_data *window = NULL;
251 u64 mask; 251 u64 mask;
252 u8 win_size = IWL_RATE_MAX_WINDOW; 252 u8 win_size = IWL_RATE_MAX_WINDOW;
253 s32 fail_count; 253 s32 fail_count;
@@ -295,24 +295,24 @@ static int rs_collect_tx_data(struct iwl_rate_scale_data *windows,
295 return 0; 295 return 0;
296} 296}
297 297
298static void rs_mcs_from_tbl(struct iwl_rate *mcs_rate, 298static void rs_mcs_from_tbl(struct iwl4965_rate *mcs_rate,
299 struct iwl_scale_tbl_info *tbl, 299 struct iwl4965_scale_tbl_info *tbl,
300 int index, u8 use_green) 300 int index, u8 use_green)
301{ 301{
302 if (is_legacy(tbl->lq_type)) { 302 if (is_legacy(tbl->lq_type)) {
303 mcs_rate->rate_n_flags = iwl_rates[index].plcp; 303 mcs_rate->rate_n_flags = iwl4965_rates[index].plcp;
304 if (index >= IWL_FIRST_CCK_RATE && index <= IWL_LAST_CCK_RATE) 304 if (index >= IWL_FIRST_CCK_RATE && index <= IWL_LAST_CCK_RATE)
305 mcs_rate->rate_n_flags |= RATE_MCS_CCK_MSK; 305 mcs_rate->rate_n_flags |= RATE_MCS_CCK_MSK;
306 306
307 } else if (is_siso(tbl->lq_type)) { 307 } else if (is_siso(tbl->lq_type)) {
308 if (index > IWL_LAST_OFDM_RATE) 308 if (index > IWL_LAST_OFDM_RATE)
309 index = IWL_LAST_OFDM_RATE; 309 index = IWL_LAST_OFDM_RATE;
310 mcs_rate->rate_n_flags = iwl_rates[index].plcp_siso | 310 mcs_rate->rate_n_flags = iwl4965_rates[index].plcp_siso |
311 RATE_MCS_HT_MSK; 311 RATE_MCS_HT_MSK;
312 } else { 312 } else {
313 if (index > IWL_LAST_OFDM_RATE) 313 if (index > IWL_LAST_OFDM_RATE)
314 index = IWL_LAST_OFDM_RATE; 314 index = IWL_LAST_OFDM_RATE;
315 mcs_rate->rate_n_flags = iwl_rates[index].plcp_mimo | 315 mcs_rate->rate_n_flags = iwl4965_rates[index].plcp_mimo |
316 RATE_MCS_HT_MSK; 316 RATE_MCS_HT_MSK;
317 } 317 }
318 318
@@ -349,14 +349,14 @@ static void rs_mcs_from_tbl(struct iwl_rate *mcs_rate,
349 } 349 }
350} 350}
351 351
352static int rs_get_tbl_info_from_mcs(const struct iwl_rate *mcs_rate, 352static int rs_get_tbl_info_from_mcs(const struct iwl4965_rate *mcs_rate,
353 int phymode, struct iwl_scale_tbl_info *tbl, 353 int phymode, struct iwl4965_scale_tbl_info *tbl,
354 int *rate_idx) 354 int *rate_idx)
355{ 355{
356 int index; 356 int index;
357 u32 ant_msk; 357 u32 ant_msk;
358 358
359 index = iwl_rate_index_from_plcp(mcs_rate->rate_n_flags); 359 index = iwl4965_rate_index_from_plcp(mcs_rate->rate_n_flags);
360 360
361 if (index == IWL_RATE_INVALID) { 361 if (index == IWL_RATE_INVALID) {
362 *rate_idx = -1; 362 *rate_idx = -1;
@@ -386,7 +386,7 @@ static int rs_get_tbl_info_from_mcs(const struct iwl_rate *mcs_rate,
386 } 386 }
387 *rate_idx = index; 387 *rate_idx = index;
388 388
389 } else if (iwl_rate_get_rate(mcs_rate->rate_n_flags) 389 } else if (iwl4965_rate_get_rate(mcs_rate->rate_n_flags)
390 <= IWL_RATE_SISO_60M_PLCP) { 390 <= IWL_RATE_SISO_60M_PLCP) {
391 tbl->lq_type = LQ_SISO; 391 tbl->lq_type = LQ_SISO;
392 392
@@ -426,8 +426,8 @@ static int rs_get_tbl_info_from_mcs(const struct iwl_rate *mcs_rate,
426 return 0; 426 return 0;
427} 427}
428 428
429static inline void rs_toggle_antenna(struct iwl_rate *new_rate, 429static inline void rs_toggle_antenna(struct iwl4965_rate *new_rate,
430 struct iwl_scale_tbl_info *tbl) 430 struct iwl4965_scale_tbl_info *tbl)
431{ 431{
432 if (tbl->antenna_type == ANT_AUX) { 432 if (tbl->antenna_type == ANT_AUX) {
433 tbl->antenna_type = ANT_MAIN; 433 tbl->antenna_type = ANT_MAIN;
@@ -440,7 +440,7 @@ static inline void rs_toggle_antenna(struct iwl_rate *new_rate,
440 } 440 }
441} 441}
442 442
443static inline u8 rs_use_green(struct iwl_priv *priv) 443static inline u8 rs_use_green(struct iwl4965_priv *priv)
444{ 444{
445#ifdef CONFIG_IWL4965_HT 445#ifdef CONFIG_IWL4965_HT
446 if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht) 446 if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht)
@@ -459,9 +459,9 @@ static inline u8 rs_use_green(struct iwl_priv *priv)
459 * basic available rates. 459 * basic available rates.
460 * 460 *
461 */ 461 */
462static void rs_get_supported_rates(struct iwl_rate_scale_priv *lq_data, 462static void rs_get_supported_rates(struct iwl4965_rate_scale_priv *lq_data,
463 struct ieee80211_hdr *hdr, 463 struct ieee80211_hdr *hdr,
464 enum iwl_table_type rate_type, 464 enum iwl4965_table_type rate_type,
465 u16 *data_rate) 465 u16 *data_rate)
466{ 466{
467 if (is_legacy(rate_type)) 467 if (is_legacy(rate_type))
@@ -512,7 +512,7 @@ static u16 rs_get_adjacent_rate(u8 index, u16 rate_mask, int rate_type)
512 512
513 low = index; 513 low = index;
514 while (low != IWL_RATE_INVALID) { 514 while (low != IWL_RATE_INVALID) {
515 low = iwl_rates[low].prev_rs; 515 low = iwl4965_rates[low].prev_rs;
516 if (low == IWL_RATE_INVALID) 516 if (low == IWL_RATE_INVALID)
517 break; 517 break;
518 if (rate_mask & (1 << low)) 518 if (rate_mask & (1 << low))
@@ -522,7 +522,7 @@ static u16 rs_get_adjacent_rate(u8 index, u16 rate_mask, int rate_type)
522 522
523 high = index; 523 high = index;
524 while (high != IWL_RATE_INVALID) { 524 while (high != IWL_RATE_INVALID) {
525 high = iwl_rates[high].next_rs; 525 high = iwl4965_rates[high].next_rs;
526 if (high == IWL_RATE_INVALID) 526 if (high == IWL_RATE_INVALID)
527 break; 527 break;
528 if (rate_mask & (1 << high)) 528 if (rate_mask & (1 << high))
@@ -533,9 +533,9 @@ static u16 rs_get_adjacent_rate(u8 index, u16 rate_mask, int rate_type)
533 return (high << 8) | low; 533 return (high << 8) | low;
534} 534}
535 535
536static void rs_get_lower_rate(struct iwl_rate_scale_priv *lq_data, 536static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data,
537 struct iwl_scale_tbl_info *tbl, u8 scale_index, 537 struct iwl4965_scale_tbl_info *tbl, u8 scale_index,
538 u8 ht_possible, struct iwl_rate *mcs_rate) 538 u8 ht_possible, struct iwl4965_rate *mcs_rate)
539{ 539{
540 s32 low; 540 s32 low;
541 u16 rate_mask; 541 u16 rate_mask;
@@ -596,17 +596,17 @@ static void rs_tx_status(void *priv_rate,
596 int status; 596 int status;
597 u8 retries; 597 u8 retries;
598 int rs_index, index = 0; 598 int rs_index, index = 0;
599 struct iwl_rate_scale_priv *lq; 599 struct iwl4965_rate_scale_priv *lq;
600 struct iwl_link_quality_cmd *table; 600 struct iwl4965_link_quality_cmd *table;
601 struct sta_info *sta; 601 struct sta_info *sta;
602 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 602 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
603 struct iwl_priv *priv = (struct iwl_priv *)priv_rate; 603 struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate;
604 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 604 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
605 struct iwl_rate_scale_data *window = NULL; 605 struct iwl4965_rate_scale_data *window = NULL;
606 struct iwl_rate_scale_data *search_win = NULL; 606 struct iwl4965_rate_scale_data *search_win = NULL;
607 struct iwl_rate tx_mcs; 607 struct iwl4965_rate tx_mcs;
608 struct iwl_scale_tbl_info tbl_type; 608 struct iwl4965_scale_tbl_info tbl_type;
609 struct iwl_scale_tbl_info *curr_tbl, *search_tbl; 609 struct iwl4965_scale_tbl_info *curr_tbl, *search_tbl;
610 u8 active_index = 0; 610 u8 active_index = 0;
611 u16 fc = le16_to_cpu(hdr->frame_control); 611 u16 fc = le16_to_cpu(hdr->frame_control);
612 s32 tpt = 0; 612 s32 tpt = 0;
@@ -630,7 +630,7 @@ static void rs_tx_status(void *priv_rate,
630 return; 630 return;
631 } 631 }
632 632
633 lq = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv; 633 lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv;
634 634
635 if (!priv->lq_mngr.lq_ready) 635 if (!priv->lq_mngr.lq_ready)
636 return; 636 return;
@@ -648,9 +648,9 @@ static void rs_tx_status(void *priv_rate,
648 lq->antenna = lq->valid_antenna; 648 lq->antenna = lq->valid_antenna;
649 curr_tbl = &(lq->lq_info[active_index]); 649 curr_tbl = &(lq->lq_info[active_index]);
650 search_tbl = &(lq->lq_info[(1 - active_index)]); 650 search_tbl = &(lq->lq_info[(1 - active_index)]);
651 window = (struct iwl_rate_scale_data *) 651 window = (struct iwl4965_rate_scale_data *)
652 &(curr_tbl->win[0]); 652 &(curr_tbl->win[0]);
653 search_win = (struct iwl_rate_scale_data *) 653 search_win = (struct iwl4965_rate_scale_data *)
654 &(search_tbl->win[0]); 654 &(search_tbl->win[0]);
655 655
656 tx_mcs.rate_n_flags = tx_resp->control.tx_rate; 656 tx_mcs.rate_n_flags = tx_resp->control.tx_rate;
@@ -751,7 +751,7 @@ static void rs_tx_status(void *priv_rate,
751} 751}
752 752
753static u8 rs_is_ant_connected(u8 valid_antenna, 753static u8 rs_is_ant_connected(u8 valid_antenna,
754 enum iwl_antenna_type antenna_type) 754 enum iwl4965_antenna_type antenna_type)
755{ 755{
756 if (antenna_type == ANT_AUX) 756 if (antenna_type == ANT_AUX)
757 return ((valid_antenna & 0x2) ? 1:0); 757 return ((valid_antenna & 0x2) ? 1:0);
@@ -764,7 +764,7 @@ static u8 rs_is_ant_connected(u8 valid_antenna,
764} 764}
765 765
766static u8 rs_is_other_ant_connected(u8 valid_antenna, 766static u8 rs_is_other_ant_connected(u8 valid_antenna,
767 enum iwl_antenna_type antenna_type) 767 enum iwl4965_antenna_type antenna_type)
768{ 768{
769 if (antenna_type == ANT_AUX) 769 if (antenna_type == ANT_AUX)
770 return rs_is_ant_connected(valid_antenna, ANT_MAIN); 770 return rs_is_ant_connected(valid_antenna, ANT_MAIN);
@@ -775,7 +775,7 @@ static u8 rs_is_other_ant_connected(u8 valid_antenna,
775} 775}
776 776
777static void rs_set_stay_in_table(u8 is_legacy, 777static void rs_set_stay_in_table(u8 is_legacy,
778 struct iwl_rate_scale_priv *lq_data) 778 struct iwl4965_rate_scale_priv *lq_data)
779{ 779{
780 IWL_DEBUG_HT("we are staying in the same table\n"); 780 IWL_DEBUG_HT("we are staying in the same table\n");
781 lq_data->stay_in_tbl = 1; 781 lq_data->stay_in_tbl = 1;
@@ -793,8 +793,8 @@ static void rs_set_stay_in_table(u8 is_legacy,
793 lq_data->total_success = 0; 793 lq_data->total_success = 0;
794} 794}
795 795
796static void rs_get_expected_tpt_table(struct iwl_rate_scale_priv *lq_data, 796static void rs_get_expected_tpt_table(struct iwl4965_rate_scale_priv *lq_data,
797 struct iwl_scale_tbl_info *tbl) 797 struct iwl4965_scale_tbl_info *tbl)
798{ 798{
799 if (is_legacy(tbl->lq_type)) { 799 if (is_legacy(tbl->lq_type)) {
800 if (!is_a_band(tbl->lq_type)) 800 if (!is_a_band(tbl->lq_type))
@@ -827,12 +827,12 @@ static void rs_get_expected_tpt_table(struct iwl_rate_scale_priv *lq_data,
827} 827}
828 828
829#ifdef CONFIG_IWL4965_HT 829#ifdef CONFIG_IWL4965_HT
830static s32 rs_get_best_rate(struct iwl_priv *priv, 830static s32 rs_get_best_rate(struct iwl4965_priv *priv,
831 struct iwl_rate_scale_priv *lq_data, 831 struct iwl4965_rate_scale_priv *lq_data,
832 struct iwl_scale_tbl_info *tbl, 832 struct iwl4965_scale_tbl_info *tbl,
833 u16 rate_mask, s8 index, s8 rate) 833 u16 rate_mask, s8 index, s8 rate)
834{ 834{
835 struct iwl_scale_tbl_info *active_tbl = 835 struct iwl4965_scale_tbl_info *active_tbl =
836 &(lq_data->lq_info[lq_data->active_tbl]); 836 &(lq_data->lq_info[lq_data->active_tbl]);
837 s32 new_rate, high, low, start_hi; 837 s32 new_rate, high, low, start_hi;
838 s32 active_sr = active_tbl->win[index].success_ratio; 838 s32 active_sr = active_tbl->win[index].success_ratio;
@@ -886,9 +886,9 @@ static inline u8 rs_is_both_ant_supp(u8 valid_antenna)
886 return (rs_is_ant_connected(valid_antenna, ANT_BOTH)); 886 return (rs_is_ant_connected(valid_antenna, ANT_BOTH));
887} 887}
888 888
889static int rs_switch_to_mimo(struct iwl_priv *priv, 889static int rs_switch_to_mimo(struct iwl4965_priv *priv,
890 struct iwl_rate_scale_priv *lq_data, 890 struct iwl4965_rate_scale_priv *lq_data,
891 struct iwl_scale_tbl_info *tbl, int index) 891 struct iwl4965_scale_tbl_info *tbl, int index)
892{ 892{
893#ifdef CONFIG_IWL4965_HT 893#ifdef CONFIG_IWL4965_HT
894 u16 rate_mask; 894 u16 rate_mask;
@@ -943,9 +943,9 @@ static int rs_switch_to_mimo(struct iwl_priv *priv,
943#endif /*CONFIG_IWL4965_HT */ 943#endif /*CONFIG_IWL4965_HT */
944} 944}
945 945
946static int rs_switch_to_siso(struct iwl_priv *priv, 946static int rs_switch_to_siso(struct iwl4965_priv *priv,
947 struct iwl_rate_scale_priv *lq_data, 947 struct iwl4965_rate_scale_priv *lq_data,
948 struct iwl_scale_tbl_info *tbl, int index) 948 struct iwl4965_scale_tbl_info *tbl, int index)
949{ 949{
950#ifdef CONFIG_IWL4965_HT 950#ifdef CONFIG_IWL4965_HT
951 u16 rate_mask; 951 u16 rate_mask;
@@ -999,18 +999,18 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
999#endif /*CONFIG_IWL4965_HT */ 999#endif /*CONFIG_IWL4965_HT */
1000} 1000}
1001 1001
1002static int rs_move_legacy_other(struct iwl_priv *priv, 1002static int rs_move_legacy_other(struct iwl4965_priv *priv,
1003 struct iwl_rate_scale_priv *lq_data, 1003 struct iwl4965_rate_scale_priv *lq_data,
1004 int index) 1004 int index)
1005{ 1005{
1006 int ret = 0; 1006 int ret = 0;
1007 struct iwl_scale_tbl_info *tbl = 1007 struct iwl4965_scale_tbl_info *tbl =
1008 &(lq_data->lq_info[lq_data->active_tbl]); 1008 &(lq_data->lq_info[lq_data->active_tbl]);
1009 struct iwl_scale_tbl_info *search_tbl = 1009 struct iwl4965_scale_tbl_info *search_tbl =
1010 &(lq_data->lq_info[(1 - lq_data->active_tbl)]); 1010 &(lq_data->lq_info[(1 - lq_data->active_tbl)]);
1011 struct iwl_rate_scale_data *window = &(tbl->win[index]); 1011 struct iwl4965_rate_scale_data *window = &(tbl->win[index]);
1012 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1012 u32 sz = (sizeof(struct iwl4965_scale_tbl_info) -
1013 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1013 (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT));
1014 u8 start_action = tbl->action; 1014 u8 start_action = tbl->action;
1015 1015
1016 for (; ;) { 1016 for (; ;) {
@@ -1083,19 +1083,19 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
1083 1083
1084} 1084}
1085 1085
1086static int rs_move_siso_to_other(struct iwl_priv *priv, 1086static int rs_move_siso_to_other(struct iwl4965_priv *priv,
1087 struct iwl_rate_scale_priv *lq_data, 1087 struct iwl4965_rate_scale_priv *lq_data,
1088 int index) 1088 int index)
1089{ 1089{
1090 int ret; 1090 int ret;
1091 u8 is_green = lq_data->is_green; 1091 u8 is_green = lq_data->is_green;
1092 struct iwl_scale_tbl_info *tbl = 1092 struct iwl4965_scale_tbl_info *tbl =
1093 &(lq_data->lq_info[lq_data->active_tbl]); 1093 &(lq_data->lq_info[lq_data->active_tbl]);
1094 struct iwl_scale_tbl_info *search_tbl = 1094 struct iwl4965_scale_tbl_info *search_tbl =
1095 &(lq_data->lq_info[(1 - lq_data->active_tbl)]); 1095 &(lq_data->lq_info[(1 - lq_data->active_tbl)]);
1096 struct iwl_rate_scale_data *window = &(tbl->win[index]); 1096 struct iwl4965_rate_scale_data *window = &(tbl->win[index]);
1097 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1097 u32 sz = (sizeof(struct iwl4965_scale_tbl_info) -
1098 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1098 (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT));
1099 u8 start_action = tbl->action; 1099 u8 start_action = tbl->action;
1100 1100
1101 for (;;) { 1101 for (;;) {
@@ -1173,18 +1173,18 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
1173 return 0; 1173 return 0;
1174} 1174}
1175 1175
1176static int rs_move_mimo_to_other(struct iwl_priv *priv, 1176static int rs_move_mimo_to_other(struct iwl4965_priv *priv,
1177 struct iwl_rate_scale_priv *lq_data, 1177 struct iwl4965_rate_scale_priv *lq_data,
1178 int index) 1178 int index)
1179{ 1179{
1180 int ret; 1180 int ret;
1181 s8 is_green = lq_data->is_green; 1181 s8 is_green = lq_data->is_green;
1182 struct iwl_scale_tbl_info *tbl = 1182 struct iwl4965_scale_tbl_info *tbl =
1183 &(lq_data->lq_info[lq_data->active_tbl]); 1183 &(lq_data->lq_info[lq_data->active_tbl]);
1184 struct iwl_scale_tbl_info *search_tbl = 1184 struct iwl4965_scale_tbl_info *search_tbl =
1185 &(lq_data->lq_info[(1 - lq_data->active_tbl)]); 1185 &(lq_data->lq_info[(1 - lq_data->active_tbl)]);
1186 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1186 u32 sz = (sizeof(struct iwl4965_scale_tbl_info) -
1187 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1187 (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT));
1188 u8 start_action = tbl->action; 1188 u8 start_action = tbl->action;
1189 1189
1190 for (;;) { 1190 for (;;) {
@@ -1253,9 +1253,9 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv,
1253 1253
1254} 1254}
1255 1255
1256static void rs_stay_in_table(struct iwl_rate_scale_priv *lq_data) 1256static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data)
1257{ 1257{
1258 struct iwl_scale_tbl_info *tbl; 1258 struct iwl4965_scale_tbl_info *tbl;
1259 int i; 1259 int i;
1260 int active_tbl; 1260 int active_tbl;
1261 int flush_interval_passed = 0; 1261 int flush_interval_passed = 0;
@@ -1305,7 +1305,7 @@ static void rs_stay_in_table(struct iwl_rate_scale_priv *lq_data)
1305 } 1305 }
1306} 1306}
1307 1307
1308static void rs_rate_scale_perform(struct iwl_priv *priv, 1308static void rs_rate_scale_perform(struct iwl4965_priv *priv,
1309 struct net_device *dev, 1309 struct net_device *dev,
1310 struct ieee80211_hdr *hdr, 1310 struct ieee80211_hdr *hdr,
1311 struct sta_info *sta) 1311 struct sta_info *sta)
@@ -1314,7 +1314,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
1314 int high = IWL_RATE_INVALID; 1314 int high = IWL_RATE_INVALID;
1315 int index; 1315 int index;
1316 int i; 1316 int i;
1317 struct iwl_rate_scale_data *window = NULL; 1317 struct iwl4965_rate_scale_data *window = NULL;
1318 int current_tpt = IWL_INVALID_VALUE; 1318 int current_tpt = IWL_INVALID_VALUE;
1319 int low_tpt = IWL_INVALID_VALUE; 1319 int low_tpt = IWL_INVALID_VALUE;
1320 int high_tpt = IWL_INVALID_VALUE; 1320 int high_tpt = IWL_INVALID_VALUE;
@@ -1322,10 +1322,10 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
1322 s8 scale_action = 0; 1322 s8 scale_action = 0;
1323 u16 fc, rate_mask; 1323 u16 fc, rate_mask;
1324 u8 update_lq = 0; 1324 u8 update_lq = 0;
1325 struct iwl_rate_scale_priv *lq_data; 1325 struct iwl4965_rate_scale_priv *lq_data;
1326 struct iwl_scale_tbl_info *tbl, *tbl1; 1326 struct iwl4965_scale_tbl_info *tbl, *tbl1;
1327 u16 rate_scale_index_msk = 0; 1327 u16 rate_scale_index_msk = 0;
1328 struct iwl_rate mcs_rate; 1328 struct iwl4965_rate mcs_rate;
1329 u8 is_green = 0; 1329 u8 is_green = 0;
1330 u8 active_tbl = 0; 1330 u8 active_tbl = 0;
1331 u8 done_search = 0; 1331 u8 done_search = 0;
@@ -1348,7 +1348,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
1348 IWL_DEBUG_RATE("still rate scaling not ready\n"); 1348 IWL_DEBUG_RATE("still rate scaling not ready\n");
1349 return; 1349 return;
1350 } 1350 }
1351 lq_data = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv; 1351 lq_data = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv;
1352 1352
1353 if (!lq_data->search_better_tbl) 1353 if (!lq_data->search_better_tbl)
1354 active_tbl = lq_data->active_tbl; 1354 active_tbl = lq_data->active_tbl;
@@ -1445,7 +1445,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
1445 active_tbl = lq_data->active_tbl; 1445 active_tbl = lq_data->active_tbl;
1446 tbl = &(lq_data->lq_info[active_tbl]); 1446 tbl = &(lq_data->lq_info[active_tbl]);
1447 1447
1448 index = iwl_rate_index_from_plcp( 1448 index = iwl4965_rate_index_from_plcp(
1449 tbl->current_rate.rate_n_flags); 1449 tbl->current_rate.rate_n_flags);
1450 1450
1451 update_lq = 1; 1451 update_lq = 1;
@@ -1559,7 +1559,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
1559 for (i = 0; i < IWL_RATE_COUNT; i++) 1559 for (i = 0; i < IWL_RATE_COUNT; i++)
1560 rs_rate_scale_clear_window(&(tbl->win[i])); 1560 rs_rate_scale_clear_window(&(tbl->win[i]));
1561 1561
1562 index = iwl_rate_index_from_plcp( 1562 index = iwl4965_rate_index_from_plcp(
1563 tbl->current_rate.rate_n_flags); 1563 tbl->current_rate.rate_n_flags);
1564 1564
1565 IWL_DEBUG_HT("Switch current mcs: %X index: %d\n", 1565 IWL_DEBUG_HT("Switch current mcs: %X index: %d\n",
@@ -1615,21 +1615,21 @@ out:
1615} 1615}
1616 1616
1617 1617
1618static void rs_initialize_lq(struct iwl_priv *priv, 1618static void rs_initialize_lq(struct iwl4965_priv *priv,
1619 struct sta_info *sta) 1619 struct sta_info *sta)
1620{ 1620{
1621 int i; 1621 int i;
1622 struct iwl_rate_scale_priv *lq; 1622 struct iwl4965_rate_scale_priv *lq;
1623 struct iwl_scale_tbl_info *tbl; 1623 struct iwl4965_scale_tbl_info *tbl;
1624 u8 active_tbl = 0; 1624 u8 active_tbl = 0;
1625 int rate_idx; 1625 int rate_idx;
1626 u8 use_green = rs_use_green(priv); 1626 u8 use_green = rs_use_green(priv);
1627 struct iwl_rate mcs_rate; 1627 struct iwl4965_rate mcs_rate;
1628 1628
1629 if (!sta || !sta->rate_ctrl_priv) 1629 if (!sta || !sta->rate_ctrl_priv)
1630 goto out; 1630 goto out;
1631 1631
1632 lq = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv; 1632 lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv;
1633 i = sta->last_txrate; 1633 i = sta->last_txrate;
1634 1634
1635 if ((lq->lq.sta_id == 0xff) && 1635 if ((lq->lq.sta_id == 0xff) &&
@@ -1646,7 +1646,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
1646 if ((i < 0) || (i >= IWL_RATE_COUNT)) 1646 if ((i < 0) || (i >= IWL_RATE_COUNT))
1647 i = 0; 1647 i = 0;
1648 1648
1649 mcs_rate.rate_n_flags = iwl_rates[i].plcp ; 1649 mcs_rate.rate_n_flags = iwl4965_rates[i].plcp ;
1650 mcs_rate.rate_n_flags |= RATE_MCS_ANT_B_MSK; 1650 mcs_rate.rate_n_flags |= RATE_MCS_ANT_B_MSK;
1651 mcs_rate.rate_n_flags &= ~RATE_MCS_ANT_A_MSK; 1651 mcs_rate.rate_n_flags &= ~RATE_MCS_ANT_A_MSK;
1652 1652
@@ -1676,8 +1676,8 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
1676 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1676 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1677 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 1677 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1678 struct sta_info *sta; 1678 struct sta_info *sta;
1679 struct iwl_priv *priv = (struct iwl_priv *)priv_rate; 1679 struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate;
1680 struct iwl_rate_scale_priv *lq; 1680 struct iwl4965_rate_scale_priv *lq;
1681 1681
1682 IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); 1682 IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n");
1683 1683
@@ -1690,17 +1690,17 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
1690 return; 1690 return;
1691 } 1691 }
1692 1692
1693 lq = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv; 1693 lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv;
1694 i = sta->last_txrate; 1694 i = sta->last_txrate;
1695 1695
1696 if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && !lq->ibss_sta_added) { 1696 if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && !lq->ibss_sta_added) {
1697 u8 sta_id = iwl_hw_find_station(priv, hdr->addr1); 1697 u8 sta_id = iwl4965_hw_find_station(priv, hdr->addr1);
1698 DECLARE_MAC_BUF(mac); 1698 DECLARE_MAC_BUF(mac);
1699 1699
1700 if (sta_id == IWL_INVALID_STATION) { 1700 if (sta_id == IWL_INVALID_STATION) {
1701 IWL_DEBUG_RATE("LQ: ADD station %s\n", 1701 IWL_DEBUG_RATE("LQ: ADD station %s\n",
1702 print_mac(mac, hdr->addr1)); 1702 print_mac(mac, hdr->addr1));
1703 sta_id = iwl_add_station(priv, 1703 sta_id = iwl4965_add_station_flags(priv,
1704 hdr->addr1, 0, CMD_ASYNC); 1704 hdr->addr1, 0, CMD_ASYNC);
1705 } 1705 }
1706 if ((sta_id != IWL_INVALID_STATION)) { 1706 if ((sta_id != IWL_INVALID_STATION)) {
@@ -1725,12 +1725,12 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
1725 1725
1726static void *rs_alloc_sta(void *priv, gfp_t gfp) 1726static void *rs_alloc_sta(void *priv, gfp_t gfp)
1727{ 1727{
1728 struct iwl_rate_scale_priv *crl; 1728 struct iwl4965_rate_scale_priv *crl;
1729 int i, j; 1729 int i, j;
1730 1730
1731 IWL_DEBUG_RATE("create station rate scale window\n"); 1731 IWL_DEBUG_RATE("create station rate scale window\n");
1732 1732
1733 crl = kzalloc(sizeof(struct iwl_rate_scale_priv), gfp); 1733 crl = kzalloc(sizeof(struct iwl4965_rate_scale_priv), gfp);
1734 1734
1735 if (crl == NULL) 1735 if (crl == NULL)
1736 return NULL; 1736 return NULL;
@@ -1750,8 +1750,8 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
1750{ 1750{
1751 int i, j; 1751 int i, j;
1752 struct ieee80211_hw_mode *mode = local->oper_hw_mode; 1752 struct ieee80211_hw_mode *mode = local->oper_hw_mode;
1753 struct iwl_priv *priv = (struct iwl_priv *)priv_rate; 1753 struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate;
1754 struct iwl_rate_scale_priv *crl = priv_sta; 1754 struct iwl4965_rate_scale_priv *crl = priv_sta;
1755 1755
1756 crl->flush_timer = 0; 1756 crl->flush_timer = 0;
1757 crl->supp_rates = sta->supp_rates; 1757 crl->supp_rates = sta->supp_rates;
@@ -1768,7 +1768,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
1768 1768
1769 crl->ibss_sta_added = 0; 1769 crl->ibss_sta_added = 0;
1770 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { 1770 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) {
1771 u8 sta_id = iwl_hw_find_station(priv, sta->addr); 1771 u8 sta_id = iwl4965_hw_find_station(priv, sta->addr);
1772 DECLARE_MAC_BUF(mac); 1772 DECLARE_MAC_BUF(mac);
1773 1773
1774 /* for IBSS the call are from tasklet */ 1774 /* for IBSS the call are from tasklet */
@@ -1778,7 +1778,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
1778 if (sta_id == IWL_INVALID_STATION) { 1778 if (sta_id == IWL_INVALID_STATION) {
1779 IWL_DEBUG_RATE("LQ: ADD station %s\n", 1779 IWL_DEBUG_RATE("LQ: ADD station %s\n",
1780 print_mac(mac, sta->addr)); 1780 print_mac(mac, sta->addr));
1781 sta_id = iwl_add_station(priv, 1781 sta_id = iwl4965_add_station_flags(priv,
1782 sta->addr, 0, CMD_ASYNC); 1782 sta->addr, 0, CMD_ASYNC);
1783 } 1783 }
1784 if ((sta_id != IWL_INVALID_STATION)) { 1784 if ((sta_id != IWL_INVALID_STATION)) {
@@ -1832,17 +1832,17 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
1832 rs_initialize_lq(priv, sta); 1832 rs_initialize_lq(priv, sta);
1833} 1833}
1834 1834
1835static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data, 1835static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data,
1836 struct iwl_rate *tx_mcs, 1836 struct iwl4965_rate *tx_mcs,
1837 struct iwl_link_quality_cmd *lq_cmd) 1837 struct iwl4965_link_quality_cmd *lq_cmd)
1838{ 1838{
1839 int index = 0; 1839 int index = 0;
1840 int rate_idx; 1840 int rate_idx;
1841 int repeat_rate = 0; 1841 int repeat_rate = 0;
1842 u8 ant_toggle_count = 0; 1842 u8 ant_toggle_count = 0;
1843 u8 use_ht_possible = 1; 1843 u8 use_ht_possible = 1;
1844 struct iwl_rate new_rate; 1844 struct iwl4965_rate new_rate;
1845 struct iwl_scale_tbl_info tbl_type = { 0 }; 1845 struct iwl4965_scale_tbl_info tbl_type = { 0 };
1846 1846
1847 rs_dbgfs_set_mcs(lq_data, tx_mcs, index); 1847 rs_dbgfs_set_mcs(lq_data, tx_mcs, index);
1848 1848
@@ -1935,7 +1935,7 @@ static void rs_free(void *priv_rate)
1935 1935
1936static void rs_clear(void *priv_rate) 1936static void rs_clear(void *priv_rate)
1937{ 1937{
1938 struct iwl_priv *priv = (struct iwl_priv *) priv_rate; 1938 struct iwl4965_priv *priv = (struct iwl4965_priv *) priv_rate;
1939 1939
1940 IWL_DEBUG_RATE("enter\n"); 1940 IWL_DEBUG_RATE("enter\n");
1941 1941
@@ -1952,7 +1952,7 @@ static void rs_clear(void *priv_rate)
1952 1952
1953static void rs_free_sta(void *priv, void *priv_sta) 1953static void rs_free_sta(void *priv, void *priv_sta)
1954{ 1954{
1955 struct iwl_rate_scale_priv *rs_priv = priv_sta; 1955 struct iwl4965_rate_scale_priv *rs_priv = priv_sta;
1956 1956
1957 IWL_DEBUG_RATE("enter\n"); 1957 IWL_DEBUG_RATE("enter\n");
1958 kfree(rs_priv); 1958 kfree(rs_priv);
@@ -1966,8 +1966,8 @@ static int open_file_generic(struct inode *inode, struct file *file)
1966 file->private_data = inode->i_private; 1966 file->private_data = inode->i_private;
1967 return 0; 1967 return 0;
1968} 1968}
1969static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv, 1969static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv,
1970 struct iwl_rate *mcs, int index) 1970 struct iwl4965_rate *mcs, int index)
1971{ 1971{
1972 u32 base_rate; 1972 u32 base_rate;
1973 1973
@@ -1991,7 +1991,7 @@ static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv,
1991static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file, 1991static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
1992 const char __user *user_buf, size_t count, loff_t *ppos) 1992 const char __user *user_buf, size_t count, loff_t *ppos)
1993{ 1993{
1994 struct iwl_rate_scale_priv *rs_priv = file->private_data; 1994 struct iwl4965_rate_scale_priv *rs_priv = file->private_data;
1995 char buf[64]; 1995 char buf[64];
1996 int buf_size; 1996 int buf_size;
1997 u32 parsed_rate; 1997 u32 parsed_rate;
@@ -2028,7 +2028,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
2028 int desc = 0; 2028 int desc = 0;
2029 int i = 0; 2029 int i = 0;
2030 2030
2031 struct iwl_rate_scale_priv *rs_priv = file->private_data; 2031 struct iwl4965_rate_scale_priv *rs_priv = file->private_data;
2032 2032
2033 desc += sprintf(buff+desc, "sta_id %d\n", rs_priv->lq.sta_id); 2033 desc += sprintf(buff+desc, "sta_id %d\n", rs_priv->lq.sta_id);
2034 desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n", 2034 desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n",
@@ -2076,7 +2076,7 @@ static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
2076 int desc = 0; 2076 int desc = 0;
2077 int i, j; 2077 int i, j;
2078 2078
2079 struct iwl_rate_scale_priv *rs_priv = file->private_data; 2079 struct iwl4965_rate_scale_priv *rs_priv = file->private_data;
2080 for (i = 0; i < LQ_SIZE; i++) { 2080 for (i = 0; i < LQ_SIZE; i++) {
2081 desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n" 2081 desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n"
2082 "rate=0x%X\n", 2082 "rate=0x%X\n",
@@ -2105,7 +2105,7 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
2105static void rs_add_debugfs(void *priv, void *priv_sta, 2105static void rs_add_debugfs(void *priv, void *priv_sta,
2106 struct dentry *dir) 2106 struct dentry *dir)
2107{ 2107{
2108 struct iwl_rate_scale_priv *rs_priv = priv_sta; 2108 struct iwl4965_rate_scale_priv *rs_priv = priv_sta;
2109 rs_priv->rs_sta_dbgfs_scale_table_file = 2109 rs_priv->rs_sta_dbgfs_scale_table_file =
2110 debugfs_create_file("rate_scale_table", 0600, dir, 2110 debugfs_create_file("rate_scale_table", 0600, dir,
2111 rs_priv, &rs_sta_dbgfs_scale_table_ops); 2111 rs_priv, &rs_sta_dbgfs_scale_table_ops);
@@ -2116,7 +2116,7 @@ static void rs_add_debugfs(void *priv, void *priv_sta,
2116 2116
2117static void rs_remove_debugfs(void *priv, void *priv_sta) 2117static void rs_remove_debugfs(void *priv, void *priv_sta)
2118{ 2118{
2119 struct iwl_rate_scale_priv *rs_priv = priv_sta; 2119 struct iwl4965_rate_scale_priv *rs_priv = priv_sta;
2120 debugfs_remove(rs_priv->rs_sta_dbgfs_scale_table_file); 2120 debugfs_remove(rs_priv->rs_sta_dbgfs_scale_table_file);
2121 debugfs_remove(rs_priv->rs_sta_dbgfs_stats_table_file); 2121 debugfs_remove(rs_priv->rs_sta_dbgfs_stats_table_file);
2122} 2122}
@@ -2139,11 +2139,11 @@ static struct rate_control_ops rs_ops = {
2139#endif 2139#endif
2140}; 2140};
2141 2141
2142int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) 2142int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
2143{ 2143{
2144 struct ieee80211_local *local = hw_to_local(hw); 2144 struct ieee80211_local *local = hw_to_local(hw);
2145 struct iwl_priv *priv = hw->priv; 2145 struct iwl4965_priv *priv = hw->priv;
2146 struct iwl_rate_scale_priv *rs_priv; 2146 struct iwl4965_rate_scale_priv *rs_priv;
2147 struct sta_info *sta; 2147 struct sta_info *sta;
2148 int count = 0, i; 2148 int count = 0, i;
2149 u32 samples = 0, success = 0, good = 0; 2149 u32 samples = 0, success = 0, good = 0;
@@ -2176,7 +2176,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
2176 int active = rs_priv->active_tbl; 2176 int active = rs_priv->active_tbl;
2177 2177
2178 count += 2178 count +=
2179 sprintf(&buf[count], " %2dMbs: ", iwl_rates[i].ieee / 2); 2179 sprintf(&buf[count], " %2dMbs: ", iwl4965_rates[i].ieee / 2);
2180 2180
2181 mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1)); 2181 mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1));
2182 for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1) 2182 for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1)
@@ -2187,7 +2187,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
2187 samples += rs_priv->lq_info[active].win[i].counter; 2187 samples += rs_priv->lq_info[active].win[i].counter;
2188 good += rs_priv->lq_info[active].win[i].success_counter; 2188 good += rs_priv->lq_info[active].win[i].success_counter;
2189 success += rs_priv->lq_info[active].win[i].success_counter * 2189 success += rs_priv->lq_info[active].win[i].success_counter *
2190 iwl_rates[i].ieee; 2190 iwl4965_rates[i].ieee;
2191 2191
2192 if (rs_priv->lq_info[active].win[i].stamp) { 2192 if (rs_priv->lq_info[active].win[i].stamp) {
2193 int delta = 2193 int delta =
@@ -2201,7 +2201,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
2201 } else 2201 } else
2202 buf[count++] = '\n'; 2202 buf[count++] = '\n';
2203 2203
2204 j = iwl_get_prev_ieee_rate(i); 2204 j = iwl4965_get_prev_ieee_rate(i);
2205 if (j == i) 2205 if (j == i)
2206 break; 2206 break;
2207 i = j; 2207 i = j;
@@ -2210,7 +2210,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
2210 /* Display the average rate of all samples taken. 2210 /* Display the average rate of all samples taken.
2211 * 2211 *
2212 * NOTE: We multiple # of samples by 2 since the IEEE measurement 2212 * NOTE: We multiple # of samples by 2 since the IEEE measurement
2213 * added from iwl_rates is actually 2X the rate */ 2213 * added from iwl4965_rates is actually 2X the rate */
2214 if (samples) 2214 if (samples)
2215 count += sprintf(&buf[count], 2215 count += sprintf(&buf[count],
2216 "\nAverage rate is %3d.%02dMbs over last %4dms\n" 2216 "\nAverage rate is %3d.%02dMbs over last %4dms\n"
@@ -2227,19 +2227,19 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
2227 return count; 2227 return count;
2228} 2228}
2229 2229
2230void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) 2230void iwl4965_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
2231{ 2231{
2232 struct iwl_priv *priv = hw->priv; 2232 struct iwl4965_priv *priv = hw->priv;
2233 2233
2234 priv->lq_mngr.lq_ready = 1; 2234 priv->lq_mngr.lq_ready = 1;
2235} 2235}
2236 2236
2237void iwl_rate_control_register(struct ieee80211_hw *hw) 2237void iwl4965_rate_control_register(struct ieee80211_hw *hw)
2238{ 2238{
2239 ieee80211_rate_control_register(&rs_ops); 2239 ieee80211_rate_control_register(&rs_ops);
2240} 2240}
2241 2241
2242void iwl_rate_control_unregister(struct ieee80211_hw *hw) 2242void iwl4965_rate_control_unregister(struct ieee80211_hw *hw)
2243{ 2243{
2244 ieee80211_rate_control_unregister(&rs_ops); 2244 ieee80211_rate_control_unregister(&rs_ops);
2245} 2245}
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.h b/drivers/net/wireless/iwlwifi/iwl-4965-rs.h
index f735752abf30..4259099eae71 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.h
@@ -29,7 +29,7 @@
29 29
30#include "iwl-4965.h" 30#include "iwl-4965.h"
31 31
32struct iwl_rate_info { 32struct iwl4965_rate_info {
33 u8 plcp; 33 u8 plcp;
34 u8 plcp_siso; 34 u8 plcp_siso;
35 u8 plcp_mimo; 35 u8 plcp_mimo;
@@ -197,9 +197,9 @@ enum {
197 197
198#define LQ_SIZE 2 198#define LQ_SIZE 2
199 199
200extern const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT]; 200extern const struct iwl4965_rate_info iwl4965_rates[IWL_RATE_COUNT];
201 201
202enum iwl_table_type { 202enum iwl4965_table_type {
203 LQ_NONE, 203 LQ_NONE,
204 LQ_G, 204 LQ_G,
205 LQ_A, 205 LQ_A,
@@ -208,59 +208,59 @@ enum iwl_table_type {
208 LQ_MAX, 208 LQ_MAX,
209}; 209};
210 210
211enum iwl_antenna_type { 211enum iwl4965_antenna_type {
212 ANT_NONE, 212 ANT_NONE,
213 ANT_MAIN, 213 ANT_MAIN,
214 ANT_AUX, 214 ANT_AUX,
215 ANT_BOTH, 215 ANT_BOTH,
216}; 216};
217 217
218static inline u8 iwl_get_prev_ieee_rate(u8 rate_index) 218static inline u8 iwl4965_get_prev_ieee_rate(u8 rate_index)
219{ 219{
220 u8 rate = iwl_rates[rate_index].prev_ieee; 220 u8 rate = iwl4965_rates[rate_index].prev_ieee;
221 221
222 if (rate == IWL_RATE_INVALID) 222 if (rate == IWL_RATE_INVALID)
223 rate = rate_index; 223 rate = rate_index;
224 return rate; 224 return rate;
225} 225}
226 226
227extern int iwl_rate_index_from_plcp(int plcp); 227extern int iwl4965_rate_index_from_plcp(int plcp);
228 228
229/** 229/**
230 * iwl_fill_rs_info - Fill an output text buffer with the rate representation 230 * iwl4965_fill_rs_info - Fill an output text buffer with the rate representation
231 * 231 *
232 * NOTE: This is provided as a quick mechanism for a user to visualize 232 * NOTE: This is provided as a quick mechanism for a user to visualize
233 * the performance of the rate control algorithm and is not meant to be 233 * the performance of the rate control algorithm and is not meant to be
234 * parsed software. 234 * parsed software.
235 */ 235 */
236extern int iwl_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id); 236extern int iwl4965_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id);
237 237
238/** 238/**
239 * iwl_rate_scale_init - Initialize the rate scale table based on assoc info 239 * iwl4965_rate_scale_init - Initialize the rate scale table based on assoc info
240 * 240 *
241 * The specific throughput table used is based on the type of network 241 * The specific throughput table used is based on the type of network
242 * the associated with, including A, B, G, and G w/ TGG protection 242 * the associated with, including A, B, G, and G w/ TGG protection
243 */ 243 */
244extern void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); 244extern void iwl4965_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id);
245 245
246/** 246/**
247 * iwl_rate_control_register - Register the rate control algorithm callbacks 247 * iwl4965_rate_control_register - Register the rate control algorithm callbacks
248 * 248 *
249 * Since the rate control algorithm is hardware specific, there is no need 249 * Since the rate control algorithm is hardware specific, there is no need
250 * or reason to place it as a stand alone module. The driver can call 250 * or reason to place it as a stand alone module. The driver can call
251 * iwl_rate_control_register in order to register the rate control callbacks 251 * iwl4965_rate_control_register in order to register the rate control callbacks
252 * with the mac80211 subsystem. This should be performed prior to calling 252 * with the mac80211 subsystem. This should be performed prior to calling
253 * ieee80211_register_hw 253 * ieee80211_register_hw
254 * 254 *
255 */ 255 */
256extern void iwl_rate_control_register(struct ieee80211_hw *hw); 256extern void iwl4965_rate_control_register(struct ieee80211_hw *hw);
257 257
258/** 258/**
259 * iwl_rate_control_unregister - Unregister the rate control callbacks 259 * iwl4965_rate_control_unregister - Unregister the rate control callbacks
260 * 260 *
261 * This should be called after calling ieee80211_unregister_hw, but before 261 * This should be called after calling ieee80211_unregister_hw, but before
262 * the driver is unloaded. 262 * the driver is unloaded.
263 */ 263 */
264extern void iwl_rate_control_unregister(struct ieee80211_hw *hw); 264extern void iwl4965_rate_control_unregister(struct ieee80211_hw *hw);
265 265
266#endif 266#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 620f125ae304..f7c5ac3072c7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -40,7 +40,7 @@
40#include "iwl-4965.h" 40#include "iwl-4965.h"
41#include "iwl-helpers.h" 41#include "iwl-helpers.h"
42 42
43static void iwl_hw_card_show_info(struct iwl_priv *priv); 43static void iwl4965_hw_card_show_info(struct iwl4965_priv *priv);
44 44
45#define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ 45#define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \
46 [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ 46 [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \
@@ -62,7 +62,7 @@ static void iwl_hw_card_show_info(struct iwl_priv *priv);
62 * maps to IWL_RATE_INVALID 62 * maps to IWL_RATE_INVALID
63 * 63 *
64 */ 64 */
65const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = { 65const struct iwl4965_rate_info iwl4965_rates[IWL_RATE_COUNT] = {
66 IWL_DECLARE_RATE_INFO(1, INV, INV, 2, INV, 2, INV, 2), /* 1mbps */ 66 IWL_DECLARE_RATE_INFO(1, INV, INV, 2, INV, 2, INV, 2), /* 1mbps */
67 IWL_DECLARE_RATE_INFO(2, INV, 1, 5, 1, 5, 1, 5), /* 2mbps */ 67 IWL_DECLARE_RATE_INFO(2, INV, 1, 5, 1, 5, 1, 5), /* 2mbps */
68 IWL_DECLARE_RATE_INFO(5, INV, 2, 6, 2, 11, 2, 11), /*5.5mbps */ 68 IWL_DECLARE_RATE_INFO(5, INV, 2, 6, 2, 11, 2, 11), /*5.5mbps */
@@ -84,7 +84,7 @@ static int is_fat_channel(__le32 rxon_flags)
84 (rxon_flags & RXON_FLG_CHANNEL_MODE_MIXED_MSK); 84 (rxon_flags & RXON_FLG_CHANNEL_MODE_MIXED_MSK);
85} 85}
86 86
87static u8 is_single_stream(struct iwl_priv *priv) 87static u8 is_single_stream(struct iwl4965_priv *priv)
88{ 88{
89#ifdef CONFIG_IWL4965_HT 89#ifdef CONFIG_IWL4965_HT
90 if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht || 90 if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht ||
@@ -103,7 +103,7 @@ static u8 is_single_stream(struct iwl_priv *priv)
103 * MIMO (dual stream) requires at least 2, but works better with 3. 103 * MIMO (dual stream) requires at least 2, but works better with 3.
104 * This does not determine *which* chains to use, just how many. 104 * This does not determine *which* chains to use, just how many.
105 */ 105 */
106static int iwl4965_get_rx_chain_counter(struct iwl_priv *priv, 106static int iwl4965_get_rx_chain_counter(struct iwl4965_priv *priv,
107 u8 *idle_state, u8 *rx_state) 107 u8 *idle_state, u8 *rx_state)
108{ 108{
109 u8 is_single = is_single_stream(priv); 109 u8 is_single = is_single_stream(priv);
@@ -132,32 +132,32 @@ static int iwl4965_get_rx_chain_counter(struct iwl_priv *priv,
132 return 0; 132 return 0;
133} 133}
134 134
135int iwl_hw_rxq_stop(struct iwl_priv *priv) 135int iwl4965_hw_rxq_stop(struct iwl4965_priv *priv)
136{ 136{
137 int rc; 137 int rc;
138 unsigned long flags; 138 unsigned long flags;
139 139
140 spin_lock_irqsave(&priv->lock, flags); 140 spin_lock_irqsave(&priv->lock, flags);
141 rc = iwl_grab_nic_access(priv); 141 rc = iwl4965_grab_nic_access(priv);
142 if (rc) { 142 if (rc) {
143 spin_unlock_irqrestore(&priv->lock, flags); 143 spin_unlock_irqrestore(&priv->lock, flags);
144 return rc; 144 return rc;
145 } 145 }
146 146
147 /* stop HW */ 147 /* stop HW */
148 iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); 148 iwl4965_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
149 rc = iwl_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG, 149 rc = iwl4965_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG,
150 (1 << 24), 1000); 150 (1 << 24), 1000);
151 if (rc < 0) 151 if (rc < 0)
152 IWL_ERROR("Can't stop Rx DMA.\n"); 152 IWL_ERROR("Can't stop Rx DMA.\n");
153 153
154 iwl_release_nic_access(priv); 154 iwl4965_release_nic_access(priv);
155 spin_unlock_irqrestore(&priv->lock, flags); 155 spin_unlock_irqrestore(&priv->lock, flags);
156 156
157 return 0; 157 return 0;
158} 158}
159 159
160u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *addr) 160u8 iwl4965_hw_find_station(struct iwl4965_priv *priv, const u8 *addr)
161{ 161{
162 int i; 162 int i;
163 int start = 0; 163 int start = 0;
@@ -189,13 +189,13 @@ u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *addr)
189 return ret; 189 return ret;
190} 190}
191 191
192static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) 192static int iwl4965_nic_set_pwr_src(struct iwl4965_priv *priv, int pwr_max)
193{ 193{
194 int ret; 194 int ret;
195 unsigned long flags; 195 unsigned long flags;
196 196
197 spin_lock_irqsave(&priv->lock, flags); 197 spin_lock_irqsave(&priv->lock, flags);
198 ret = iwl_grab_nic_access(priv); 198 ret = iwl4965_grab_nic_access(priv);
199 if (ret) { 199 if (ret) {
200 spin_unlock_irqrestore(&priv->lock, flags); 200 spin_unlock_irqrestore(&priv->lock, flags);
201 return ret; 201 return ret;
@@ -208,44 +208,44 @@ static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max)
208 &val); 208 &val);
209 209
210 if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) 210 if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT)
211 iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 211 iwl4965_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
212 APMG_PS_CTRL_VAL_PWR_SRC_VAUX, 212 APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
213 ~APMG_PS_CTRL_MSK_PWR_SRC); 213 ~APMG_PS_CTRL_MSK_PWR_SRC);
214 } else 214 } else
215 iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 215 iwl4965_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
216 APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, 216 APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
217 ~APMG_PS_CTRL_MSK_PWR_SRC); 217 ~APMG_PS_CTRL_MSK_PWR_SRC);
218 218
219 iwl_release_nic_access(priv); 219 iwl4965_release_nic_access(priv);
220 spin_unlock_irqrestore(&priv->lock, flags); 220 spin_unlock_irqrestore(&priv->lock, flags);
221 221
222 return ret; 222 return ret;
223} 223}
224 224
225static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 225static int iwl4965_rx_init(struct iwl4965_priv *priv, struct iwl4965_rx_queue *rxq)
226{ 226{
227 int rc; 227 int rc;
228 unsigned long flags; 228 unsigned long flags;
229 229
230 spin_lock_irqsave(&priv->lock, flags); 230 spin_lock_irqsave(&priv->lock, flags);
231 rc = iwl_grab_nic_access(priv); 231 rc = iwl4965_grab_nic_access(priv);
232 if (rc) { 232 if (rc) {
233 spin_unlock_irqrestore(&priv->lock, flags); 233 spin_unlock_irqrestore(&priv->lock, flags);
234 return rc; 234 return rc;
235 } 235 }
236 236
237 /* stop HW */ 237 /* stop HW */
238 iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); 238 iwl4965_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
239 239
240 iwl_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); 240 iwl4965_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0);
241 iwl_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG, 241 iwl4965_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG,
242 rxq->dma_addr >> 8); 242 rxq->dma_addr >> 8);
243 243
244 iwl_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, 244 iwl4965_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG,
245 (priv->hw_setting.shared_phys + 245 (priv->hw_setting.shared_phys +
246 offsetof(struct iwl_shared, val0)) >> 4); 246 offsetof(struct iwl4965_shared, val0)) >> 4);
247 247
248 iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 248 iwl4965_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG,
249 FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | 249 FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL |
250 FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | 250 FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL |
251 IWL_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K | 251 IWL_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K |
@@ -254,37 +254,37 @@ static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
254 FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT)); 254 FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT));
255 255
256 /* 256 /*
257 * iwl_write32(priv,CSR_INT_COAL_REG,0); 257 * iwl4965_write32(priv,CSR_INT_COAL_REG,0);
258 */ 258 */
259 259
260 iwl_release_nic_access(priv); 260 iwl4965_release_nic_access(priv);
261 spin_unlock_irqrestore(&priv->lock, flags); 261 spin_unlock_irqrestore(&priv->lock, flags);
262 262
263 return 0; 263 return 0;
264} 264}
265 265
266static int iwl4965_kw_init(struct iwl_priv *priv) 266static int iwl4965_kw_init(struct iwl4965_priv *priv)
267{ 267{
268 unsigned long flags; 268 unsigned long flags;
269 int rc; 269 int rc;
270 270
271 spin_lock_irqsave(&priv->lock, flags); 271 spin_lock_irqsave(&priv->lock, flags);
272 rc = iwl_grab_nic_access(priv); 272 rc = iwl4965_grab_nic_access(priv);
273 if (rc) 273 if (rc)
274 goto out; 274 goto out;
275 275
276 iwl_write_direct32(priv, IWL_FH_KW_MEM_ADDR_REG, 276 iwl4965_write_direct32(priv, IWL_FH_KW_MEM_ADDR_REG,
277 priv->kw.dma_addr >> 4); 277 priv->kw.dma_addr >> 4);
278 iwl_release_nic_access(priv); 278 iwl4965_release_nic_access(priv);
279out: 279out:
280 spin_unlock_irqrestore(&priv->lock, flags); 280 spin_unlock_irqrestore(&priv->lock, flags);
281 return rc; 281 return rc;
282} 282}
283 283
284static int iwl4965_kw_alloc(struct iwl_priv *priv) 284static int iwl4965_kw_alloc(struct iwl4965_priv *priv)
285{ 285{
286 struct pci_dev *dev = priv->pci_dev; 286 struct pci_dev *dev = priv->pci_dev;
287 struct iwl_kw *kw = &priv->kw; 287 struct iwl4965_kw *kw = &priv->kw;
288 288
289 kw->size = IWL4965_KW_SIZE; /* TBW need set somewhere else */ 289 kw->size = IWL4965_KW_SIZE; /* TBW need set somewhere else */
290 kw->v_addr = pci_alloc_consistent(dev, kw->size, &kw->dma_addr); 290 kw->v_addr = pci_alloc_consistent(dev, kw->size, &kw->dma_addr);
@@ -297,14 +297,14 @@ static int iwl4965_kw_alloc(struct iwl_priv *priv)
297#define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \ 297#define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \
298 ? # x " " : "") 298 ? # x " " : "")
299 299
300int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, u16 channel, 300int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv, int phymode, u16 channel,
301 const struct iwl_eeprom_channel *eeprom_ch, 301 const struct iwl4965_eeprom_channel *eeprom_ch,
302 u8 fat_extension_channel) 302 u8 fat_extension_channel)
303{ 303{
304 struct iwl_channel_info *ch_info; 304 struct iwl4965_channel_info *ch_info;
305 305
306 ch_info = (struct iwl_channel_info *) 306 ch_info = (struct iwl4965_channel_info *)
307 iwl_get_channel_info(priv, phymode, channel); 307 iwl4965_get_channel_info(priv, phymode, channel);
308 308
309 if (!is_channel_valid(ch_info)) 309 if (!is_channel_valid(ch_info))
310 return -1; 310 return -1;
@@ -337,10 +337,10 @@ int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, u16 channel,
337 return 0; 337 return 0;
338} 338}
339 339
340static void iwl4965_kw_free(struct iwl_priv *priv) 340static void iwl4965_kw_free(struct iwl4965_priv *priv)
341{ 341{
342 struct pci_dev *dev = priv->pci_dev; 342 struct pci_dev *dev = priv->pci_dev;
343 struct iwl_kw *kw = &priv->kw; 343 struct iwl4965_kw *kw = &priv->kw;
344 344
345 if (kw->v_addr) { 345 if (kw->v_addr) {
346 pci_free_consistent(dev, kw->size, kw->v_addr, kw->dma_addr); 346 pci_free_consistent(dev, kw->size, kw->v_addr, kw->dma_addr);
@@ -355,7 +355,7 @@ static void iwl4965_kw_free(struct iwl_priv *priv)
355 * @param priv 355 * @param priv
356 * @return error code 356 * @return error code
357 */ 357 */
358static int iwl4965_txq_ctx_reset(struct iwl_priv *priv) 358static int iwl4965_txq_ctx_reset(struct iwl4965_priv *priv)
359{ 359{
360 int rc = 0; 360 int rc = 0;
361 int txq_id, slots_num; 361 int txq_id, slots_num;
@@ -363,7 +363,7 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
363 363
364 iwl4965_kw_free(priv); 364 iwl4965_kw_free(priv);
365 365
366 iwl_hw_txq_ctx_free(priv); 366 iwl4965_hw_txq_ctx_free(priv);
367 367
368 /* Tx CMD queue */ 368 /* Tx CMD queue */
369 rc = iwl4965_kw_alloc(priv); 369 rc = iwl4965_kw_alloc(priv);
@@ -374,15 +374,15 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
374 374
375 spin_lock_irqsave(&priv->lock, flags); 375 spin_lock_irqsave(&priv->lock, flags);
376 376
377 rc = iwl_grab_nic_access(priv); 377 rc = iwl4965_grab_nic_access(priv);
378 if (unlikely(rc)) { 378 if (unlikely(rc)) {
379 IWL_ERROR("TX reset failed"); 379 IWL_ERROR("TX reset failed");
380 spin_unlock_irqrestore(&priv->lock, flags); 380 spin_unlock_irqrestore(&priv->lock, flags);
381 goto error_reset; 381 goto error_reset;
382 } 382 }
383 383
384 iwl_write_prph(priv, KDR_SCD_TXFACT, 0); 384 iwl4965_write_prph(priv, KDR_SCD_TXFACT, 0);
385 iwl_release_nic_access(priv); 385 iwl4965_release_nic_access(priv);
386 spin_unlock_irqrestore(&priv->lock, flags); 386 spin_unlock_irqrestore(&priv->lock, flags);
387 387
388 rc = iwl4965_kw_init(priv); 388 rc = iwl4965_kw_init(priv);
@@ -395,7 +395,7 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
395 for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++) { 395 for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++) {
396 slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ? 396 slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ?
397 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; 397 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
398 rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num, 398 rc = iwl4965_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
399 txq_id); 399 txq_id);
400 if (rc) { 400 if (rc) {
401 IWL_ERROR("Tx %d queue init failed\n", txq_id); 401 IWL_ERROR("Tx %d queue init failed\n", txq_id);
@@ -406,32 +406,32 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
406 return rc; 406 return rc;
407 407
408 error: 408 error:
409 iwl_hw_txq_ctx_free(priv); 409 iwl4965_hw_txq_ctx_free(priv);
410 error_reset: 410 error_reset:
411 iwl4965_kw_free(priv); 411 iwl4965_kw_free(priv);
412 error_kw: 412 error_kw:
413 return rc; 413 return rc;
414} 414}
415 415
416int iwl_hw_nic_init(struct iwl_priv *priv) 416int iwl4965_hw_nic_init(struct iwl4965_priv *priv)
417{ 417{
418 int rc; 418 int rc;
419 unsigned long flags; 419 unsigned long flags;
420 struct iwl_rx_queue *rxq = &priv->rxq; 420 struct iwl4965_rx_queue *rxq = &priv->rxq;
421 u8 rev_id; 421 u8 rev_id;
422 u32 val; 422 u32 val;
423 u8 val_link; 423 u8 val_link;
424 424
425 iwl_power_init_handle(priv); 425 iwl4965_power_init_handle(priv);
426 426
427 /* nic_init */ 427 /* nic_init */
428 spin_lock_irqsave(&priv->lock, flags); 428 spin_lock_irqsave(&priv->lock, flags);
429 429
430 iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS, 430 iwl4965_set_bit(priv, CSR_GIO_CHICKEN_BITS,
431 CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); 431 CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
432 432
433 iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 433 iwl4965_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
434 rc = iwl_poll_bit(priv, CSR_GP_CNTRL, 434 rc = iwl4965_poll_bit(priv, CSR_GP_CNTRL,
435 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 435 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
436 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); 436 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
437 if (rc < 0) { 437 if (rc < 0) {
@@ -440,26 +440,26 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
440 return rc; 440 return rc;
441 } 441 }
442 442
443 rc = iwl_grab_nic_access(priv); 443 rc = iwl4965_grab_nic_access(priv);
444 if (rc) { 444 if (rc) {
445 spin_unlock_irqrestore(&priv->lock, flags); 445 spin_unlock_irqrestore(&priv->lock, flags);
446 return rc; 446 return rc;
447 } 447 }
448 448
449 iwl_read_prph(priv, APMG_CLK_CTRL_REG); 449 iwl4965_read_prph(priv, APMG_CLK_CTRL_REG);
450 450
451 iwl_write_prph(priv, APMG_CLK_CTRL_REG, 451 iwl4965_write_prph(priv, APMG_CLK_CTRL_REG,
452 APMG_CLK_VAL_DMA_CLK_RQT | 452 APMG_CLK_VAL_DMA_CLK_RQT |
453 APMG_CLK_VAL_BSM_CLK_RQT); 453 APMG_CLK_VAL_BSM_CLK_RQT);
454 iwl_read_prph(priv, APMG_CLK_CTRL_REG); 454 iwl4965_read_prph(priv, APMG_CLK_CTRL_REG);
455 455
456 udelay(20); 456 udelay(20);
457 457
458 iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG, 458 iwl4965_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
459 APMG_PCIDEV_STT_VAL_L1_ACT_DIS); 459 APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
460 460
461 iwl_release_nic_access(priv); 461 iwl4965_release_nic_access(priv);
462 iwl_write32(priv, CSR_INT_COALESCING, 512 / 32); 462 iwl4965_write32(priv, CSR_INT_COALESCING, 512 / 32);
463 spin_unlock_irqrestore(&priv->lock, flags); 463 spin_unlock_irqrestore(&priv->lock, flags);
464 464
465 /* Determine HW type */ 465 /* Determine HW type */
@@ -482,7 +482,7 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
482 spin_unlock_irqrestore(&priv->lock, flags); 482 spin_unlock_irqrestore(&priv->lock, flags);
483 483
484 /* Read the EEPROM */ 484 /* Read the EEPROM */
485 rc = iwl_eeprom_init(priv); 485 rc = iwl4965_eeprom_init(priv);
486 if (rc) 486 if (rc)
487 return rc; 487 return rc;
488 488
@@ -500,49 +500,49 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
500 500
501 /* set CSR_HW_CONFIG_REG for uCode use */ 501 /* set CSR_HW_CONFIG_REG for uCode use */
502 502
503 iwl_set_bit(priv, CSR_SW_VER, CSR_HW_IF_CONFIG_REG_BIT_KEDRON_R | 503 iwl4965_set_bit(priv, CSR_SW_VER, CSR_HW_IF_CONFIG_REG_BIT_KEDRON_R |
504 CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | 504 CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
505 CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); 505 CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
506 506
507 rc = iwl_grab_nic_access(priv); 507 rc = iwl4965_grab_nic_access(priv);
508 if (rc < 0) { 508 if (rc < 0) {
509 spin_unlock_irqrestore(&priv->lock, flags); 509 spin_unlock_irqrestore(&priv->lock, flags);
510 IWL_DEBUG_INFO("Failed to init the card\n"); 510 IWL_DEBUG_INFO("Failed to init the card\n");
511 return rc; 511 return rc;
512 } 512 }
513 513
514 iwl_read_prph(priv, APMG_PS_CTRL_REG); 514 iwl4965_read_prph(priv, APMG_PS_CTRL_REG);
515 iwl_set_bits_prph(priv, APMG_PS_CTRL_REG, 515 iwl4965_set_bits_prph(priv, APMG_PS_CTRL_REG,
516 APMG_PS_CTRL_VAL_RESET_REQ); 516 APMG_PS_CTRL_VAL_RESET_REQ);
517 udelay(5); 517 udelay(5);
518 iwl_clear_bits_prph(priv, APMG_PS_CTRL_REG, 518 iwl4965_clear_bits_prph(priv, APMG_PS_CTRL_REG,
519 APMG_PS_CTRL_VAL_RESET_REQ); 519 APMG_PS_CTRL_VAL_RESET_REQ);
520 520
521 iwl_release_nic_access(priv); 521 iwl4965_release_nic_access(priv);
522 spin_unlock_irqrestore(&priv->lock, flags); 522 spin_unlock_irqrestore(&priv->lock, flags);
523 523
524 iwl_hw_card_show_info(priv); 524 iwl4965_hw_card_show_info(priv);
525 525
526 /* end nic_init */ 526 /* end nic_init */
527 527
528 /* Allocate the RX queue, or reset if it is already allocated */ 528 /* Allocate the RX queue, or reset if it is already allocated */
529 if (!rxq->bd) { 529 if (!rxq->bd) {
530 rc = iwl_rx_queue_alloc(priv); 530 rc = iwl4965_rx_queue_alloc(priv);
531 if (rc) { 531 if (rc) {
532 IWL_ERROR("Unable to initialize Rx queue\n"); 532 IWL_ERROR("Unable to initialize Rx queue\n");
533 return -ENOMEM; 533 return -ENOMEM;
534 } 534 }
535 } else 535 } else
536 iwl_rx_queue_reset(priv, rxq); 536 iwl4965_rx_queue_reset(priv, rxq);
537 537
538 iwl_rx_replenish(priv); 538 iwl4965_rx_replenish(priv);
539 539
540 iwl4965_rx_init(priv, rxq); 540 iwl4965_rx_init(priv, rxq);
541 541
542 spin_lock_irqsave(&priv->lock, flags); 542 spin_lock_irqsave(&priv->lock, flags);
543 543
544 rxq->need_update = 1; 544 rxq->need_update = 1;
545 iwl_rx_queue_update_write_ptr(priv, rxq); 545 iwl4965_rx_queue_update_write_ptr(priv, rxq);
546 546
547 spin_unlock_irqrestore(&priv->lock, flags); 547 spin_unlock_irqrestore(&priv->lock, flags);
548 rc = iwl4965_txq_ctx_reset(priv); 548 rc = iwl4965_txq_ctx_reset(priv);
@@ -560,7 +560,7 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
560 return 0; 560 return 0;
561} 561}
562 562
563int iwl_hw_nic_stop_master(struct iwl_priv *priv) 563int iwl4965_hw_nic_stop_master(struct iwl4965_priv *priv)
564{ 564{
565 int rc = 0; 565 int rc = 0;
566 u32 reg_val; 566 u32 reg_val;
@@ -569,16 +569,16 @@ int iwl_hw_nic_stop_master(struct iwl_priv *priv)
569 spin_lock_irqsave(&priv->lock, flags); 569 spin_lock_irqsave(&priv->lock, flags);
570 570
571 /* set stop master bit */ 571 /* set stop master bit */
572 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); 572 iwl4965_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
573 573
574 reg_val = iwl_read32(priv, CSR_GP_CNTRL); 574 reg_val = iwl4965_read32(priv, CSR_GP_CNTRL);
575 575
576 if (CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE == 576 if (CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE ==
577 (reg_val & CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE)) 577 (reg_val & CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE))
578 IWL_DEBUG_INFO("Card in power save, master is already " 578 IWL_DEBUG_INFO("Card in power save, master is already "
579 "stopped\n"); 579 "stopped\n");
580 else { 580 else {
581 rc = iwl_poll_bit(priv, CSR_RESET, 581 rc = iwl4965_poll_bit(priv, CSR_RESET,
582 CSR_RESET_REG_FLAG_MASTER_DISABLED, 582 CSR_RESET_REG_FLAG_MASTER_DISABLED,
583 CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); 583 CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
584 if (rc < 0) { 584 if (rc < 0) {
@@ -593,7 +593,7 @@ int iwl_hw_nic_stop_master(struct iwl_priv *priv)
593 return rc; 593 return rc;
594} 594}
595 595
596void iwl_hw_txq_ctx_stop(struct iwl_priv *priv) 596void iwl4965_hw_txq_ctx_stop(struct iwl4965_priv *priv)
597{ 597{
598 598
599 int txq_id; 599 int txq_id;
@@ -602,56 +602,56 @@ void iwl_hw_txq_ctx_stop(struct iwl_priv *priv)
602 /* reset TFD queues */ 602 /* reset TFD queues */
603 for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++) { 603 for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++) {
604 spin_lock_irqsave(&priv->lock, flags); 604 spin_lock_irqsave(&priv->lock, flags);
605 if (iwl_grab_nic_access(priv)) { 605 if (iwl4965_grab_nic_access(priv)) {
606 spin_unlock_irqrestore(&priv->lock, flags); 606 spin_unlock_irqrestore(&priv->lock, flags);
607 continue; 607 continue;
608 } 608 }
609 609
610 iwl_write_direct32(priv, 610 iwl4965_write_direct32(priv,
611 IWL_FH_TCSR_CHNL_TX_CONFIG_REG(txq_id), 611 IWL_FH_TCSR_CHNL_TX_CONFIG_REG(txq_id),
612 0x0); 612 0x0);
613 iwl_poll_direct_bit(priv, IWL_FH_TSSR_TX_STATUS_REG, 613 iwl4965_poll_direct_bit(priv, IWL_FH_TSSR_TX_STATUS_REG,
614 IWL_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE 614 IWL_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE
615 (txq_id), 200); 615 (txq_id), 200);
616 iwl_release_nic_access(priv); 616 iwl4965_release_nic_access(priv);
617 spin_unlock_irqrestore(&priv->lock, flags); 617 spin_unlock_irqrestore(&priv->lock, flags);
618 } 618 }
619 619
620 iwl_hw_txq_ctx_free(priv); 620 iwl4965_hw_txq_ctx_free(priv);
621} 621}
622 622
623int iwl_hw_nic_reset(struct iwl_priv *priv) 623int iwl4965_hw_nic_reset(struct iwl4965_priv *priv)
624{ 624{
625 int rc = 0; 625 int rc = 0;
626 unsigned long flags; 626 unsigned long flags;
627 627
628 iwl_hw_nic_stop_master(priv); 628 iwl4965_hw_nic_stop_master(priv);
629 629
630 spin_lock_irqsave(&priv->lock, flags); 630 spin_lock_irqsave(&priv->lock, flags);
631 631
632 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); 632 iwl4965_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
633 633
634 udelay(10); 634 udelay(10);
635 635
636 iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 636 iwl4965_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
637 rc = iwl_poll_bit(priv, CSR_RESET, 637 rc = iwl4965_poll_bit(priv, CSR_RESET,
638 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 638 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
639 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25); 639 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25);
640 640
641 udelay(10); 641 udelay(10);
642 642
643 rc = iwl_grab_nic_access(priv); 643 rc = iwl4965_grab_nic_access(priv);
644 if (!rc) { 644 if (!rc) {
645 iwl_write_prph(priv, APMG_CLK_EN_REG, 645 iwl4965_write_prph(priv, APMG_CLK_EN_REG,
646 APMG_CLK_VAL_DMA_CLK_RQT | 646 APMG_CLK_VAL_DMA_CLK_RQT |
647 APMG_CLK_VAL_BSM_CLK_RQT); 647 APMG_CLK_VAL_BSM_CLK_RQT);
648 648
649 udelay(10); 649 udelay(10);
650 650
651 iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG, 651 iwl4965_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
652 APMG_PCIDEV_STT_VAL_L1_ACT_DIS); 652 APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
653 653
654 iwl_release_nic_access(priv); 654 iwl4965_release_nic_access(priv);
655 } 655 }
656 656
657 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 657 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
@@ -681,7 +681,7 @@ int iwl_hw_nic_reset(struct iwl_priv *priv)
681 */ 681 */
682static void iwl4965_bg_statistics_periodic(unsigned long data) 682static void iwl4965_bg_statistics_periodic(unsigned long data)
683{ 683{
684 struct iwl_priv *priv = (struct iwl_priv *)data; 684 struct iwl4965_priv *priv = (struct iwl4965_priv *)data;
685 685
686 queue_work(priv->workqueue, &priv->statistics_work); 686 queue_work(priv->workqueue, &priv->statistics_work);
687} 687}
@@ -689,27 +689,27 @@ static void iwl4965_bg_statistics_periodic(unsigned long data)
689/** 689/**
690 * iwl4965_bg_statistics_work - Send the statistics request to the hardware. 690 * iwl4965_bg_statistics_work - Send the statistics request to the hardware.
691 * 691 *
692 * This is queued by iwl_bg_statistics_periodic. 692 * This is queued by iwl4965_bg_statistics_periodic.
693 */ 693 */
694static void iwl4965_bg_statistics_work(struct work_struct *work) 694static void iwl4965_bg_statistics_work(struct work_struct *work)
695{ 695{
696 struct iwl_priv *priv = container_of(work, struct iwl_priv, 696 struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv,
697 statistics_work); 697 statistics_work);
698 698
699 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 699 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
700 return; 700 return;
701 701
702 mutex_lock(&priv->mutex); 702 mutex_lock(&priv->mutex);
703 iwl_send_statistics_request(priv); 703 iwl4965_send_statistics_request(priv);
704 mutex_unlock(&priv->mutex); 704 mutex_unlock(&priv->mutex);
705} 705}
706 706
707#define CT_LIMIT_CONST 259 707#define CT_LIMIT_CONST 259
708#define TM_CT_KILL_THRESHOLD 110 708#define TM_CT_KILL_THRESHOLD 110
709 709
710void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) 710void iwl4965_rf_kill_ct_config(struct iwl4965_priv *priv)
711{ 711{
712 struct iwl_ct_kill_config cmd; 712 struct iwl4965_ct_kill_config cmd;
713 u32 R1, R2, R3; 713 u32 R1, R2, R3;
714 u32 temp_th; 714 u32 temp_th;
715 u32 crit_temperature; 715 u32 crit_temperature;
@@ -717,7 +717,7 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv)
717 int rc = 0; 717 int rc = 0;
718 718
719 spin_lock_irqsave(&priv->lock, flags); 719 spin_lock_irqsave(&priv->lock, flags);
720 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, 720 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR,
721 CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); 721 CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT);
722 spin_unlock_irqrestore(&priv->lock, flags); 722 spin_unlock_irqrestore(&priv->lock, flags);
723 723
@@ -735,7 +735,7 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv)
735 735
736 crit_temperature = ((temp_th * (R3-R1))/CT_LIMIT_CONST) + R2; 736 crit_temperature = ((temp_th * (R3-R1))/CT_LIMIT_CONST) + R2;
737 cmd.critical_temperature_R = cpu_to_le32(crit_temperature); 737 cmd.critical_temperature_R = cpu_to_le32(crit_temperature);
738 rc = iwl_send_cmd_pdu(priv, 738 rc = iwl4965_send_cmd_pdu(priv,
739 REPLY_CT_KILL_CONFIG_CMD, sizeof(cmd), &cmd); 739 REPLY_CT_KILL_CONFIG_CMD, sizeof(cmd), &cmd);
740 if (rc) 740 if (rc)
741 IWL_ERROR("REPLY_CT_KILL_CONFIG_CMD failed\n"); 741 IWL_ERROR("REPLY_CT_KILL_CONFIG_CMD failed\n");
@@ -753,7 +753,7 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv)
753 * enough to receive all of our own network traffic, but not so 753 * enough to receive all of our own network traffic, but not so
754 * high that our DSP gets too busy trying to lock onto non-network 754 * high that our DSP gets too busy trying to lock onto non-network
755 * activity/noise. */ 755 * activity/noise. */
756static int iwl4965_sens_energy_cck(struct iwl_priv *priv, 756static int iwl4965_sens_energy_cck(struct iwl4965_priv *priv,
757 u32 norm_fa, 757 u32 norm_fa,
758 u32 rx_enable_time, 758 u32 rx_enable_time,
759 struct statistics_general_data *rx_info) 759 struct statistics_general_data *rx_info)
@@ -779,7 +779,7 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv,
779 u32 false_alarms = norm_fa * 200 * 1024; 779 u32 false_alarms = norm_fa * 200 * 1024;
780 u32 max_false_alarms = MAX_FA_CCK * rx_enable_time; 780 u32 max_false_alarms = MAX_FA_CCK * rx_enable_time;
781 u32 min_false_alarms = MIN_FA_CCK * rx_enable_time; 781 u32 min_false_alarms = MIN_FA_CCK * rx_enable_time;
782 struct iwl_sensitivity_data *data = NULL; 782 struct iwl4965_sensitivity_data *data = NULL;
783 783
784 data = &(priv->sensitivity_data); 784 data = &(priv->sensitivity_data);
785 785
@@ -944,7 +944,7 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv,
944} 944}
945 945
946 946
947static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv, 947static int iwl4965_sens_auto_corr_ofdm(struct iwl4965_priv *priv,
948 u32 norm_fa, 948 u32 norm_fa,
949 u32 rx_enable_time) 949 u32 rx_enable_time)
950{ 950{
@@ -952,7 +952,7 @@ static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv,
952 u32 false_alarms = norm_fa * 200 * 1024; 952 u32 false_alarms = norm_fa * 200 * 1024;
953 u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time; 953 u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time;
954 u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time; 954 u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time;
955 struct iwl_sensitivity_data *data = NULL; 955 struct iwl4965_sensitivity_data *data = NULL;
956 956
957 data = &(priv->sensitivity_data); 957 data = &(priv->sensitivity_data);
958 958
@@ -1009,22 +1009,22 @@ static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv,
1009 return 0; 1009 return 0;
1010} 1010}
1011 1011
1012static int iwl_sensitivity_callback(struct iwl_priv *priv, 1012static int iwl4965_sensitivity_callback(struct iwl4965_priv *priv,
1013 struct iwl_cmd *cmd, struct sk_buff *skb) 1013 struct iwl4965_cmd *cmd, struct sk_buff *skb)
1014{ 1014{
1015 /* We didn't cache the SKB; let the caller free it */ 1015 /* We didn't cache the SKB; let the caller free it */
1016 return 1; 1016 return 1;
1017} 1017}
1018 1018
1019/* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */ 1019/* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */
1020static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags) 1020static int iwl4965_sensitivity_write(struct iwl4965_priv *priv, u8 flags)
1021{ 1021{
1022 int rc = 0; 1022 int rc = 0;
1023 struct iwl_sensitivity_cmd cmd ; 1023 struct iwl4965_sensitivity_cmd cmd ;
1024 struct iwl_sensitivity_data *data = NULL; 1024 struct iwl4965_sensitivity_data *data = NULL;
1025 struct iwl_host_cmd cmd_out = { 1025 struct iwl4965_host_cmd cmd_out = {
1026 .id = SENSITIVITY_CMD, 1026 .id = SENSITIVITY_CMD,
1027 .len = sizeof(struct iwl_sensitivity_cmd), 1027 .len = sizeof(struct iwl4965_sensitivity_cmd),
1028 .meta.flags = flags, 1028 .meta.flags = flags,
1029 .data = &cmd, 1029 .data = &cmd,
1030 }; 1030 };
@@ -1071,7 +1071,7 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags)
1071 cmd.control = SENSITIVITY_CMD_CONTROL_WORK_TABLE; 1071 cmd.control = SENSITIVITY_CMD_CONTROL_WORK_TABLE;
1072 1072
1073 if (flags & CMD_ASYNC) 1073 if (flags & CMD_ASYNC)
1074 cmd_out.meta.u.callback = iwl_sensitivity_callback; 1074 cmd_out.meta.u.callback = iwl4965_sensitivity_callback;
1075 1075
1076 /* Don't send command to uCode if nothing has changed */ 1076 /* Don't send command to uCode if nothing has changed */
1077 if (!memcmp(&cmd.table[0], &(priv->sensitivity_tbl[0]), 1077 if (!memcmp(&cmd.table[0], &(priv->sensitivity_tbl[0]),
@@ -1084,7 +1084,7 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags)
1084 memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]), 1084 memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]),
1085 sizeof(u16)*HD_TABLE_SIZE); 1085 sizeof(u16)*HD_TABLE_SIZE);
1086 1086
1087 rc = iwl_send_cmd(priv, &cmd_out); 1087 rc = iwl4965_send_cmd(priv, &cmd_out);
1088 if (!rc) { 1088 if (!rc) {
1089 IWL_DEBUG_CALIB("SENSITIVITY_CMD succeeded\n"); 1089 IWL_DEBUG_CALIB("SENSITIVITY_CMD succeeded\n");
1090 return rc; 1090 return rc;
@@ -1093,11 +1093,11 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags)
1093 return 0; 1093 return 0;
1094} 1094}
1095 1095
1096void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force) 1096void iwl4965_init_sensitivity(struct iwl4965_priv *priv, u8 flags, u8 force)
1097{ 1097{
1098 int rc = 0; 1098 int rc = 0;
1099 int i; 1099 int i;
1100 struct iwl_sensitivity_data *data = NULL; 1100 struct iwl4965_sensitivity_data *data = NULL;
1101 1101
1102 IWL_DEBUG_CALIB("Start iwl4965_init_sensitivity\n"); 1102 IWL_DEBUG_CALIB("Start iwl4965_init_sensitivity\n");
1103 1103
@@ -1107,7 +1107,7 @@ void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force)
1107 1107
1108 /* Clear driver's sensitivity algo data */ 1108 /* Clear driver's sensitivity algo data */
1109 data = &(priv->sensitivity_data); 1109 data = &(priv->sensitivity_data);
1110 memset(data, 0, sizeof(struct iwl_sensitivity_data)); 1110 memset(data, 0, sizeof(struct iwl4965_sensitivity_data));
1111 1111
1112 data->num_in_cck_no_fa = 0; 1112 data->num_in_cck_no_fa = 0;
1113 data->nrg_curr_state = IWL_FA_TOO_MANY; 1113 data->nrg_curr_state = IWL_FA_TOO_MANY;
@@ -1151,21 +1151,21 @@ void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force)
1151/* Reset differential Rx gains in NIC to prepare for chain noise calibration. 1151/* Reset differential Rx gains in NIC to prepare for chain noise calibration.
1152 * Called after every association, but this runs only once! 1152 * Called after every association, but this runs only once!
1153 * ... once chain noise is calibrated the first time, it's good forever. */ 1153 * ... once chain noise is calibrated the first time, it's good forever. */
1154void iwl4965_chain_noise_reset(struct iwl_priv *priv) 1154void iwl4965_chain_noise_reset(struct iwl4965_priv *priv)
1155{ 1155{
1156 struct iwl_chain_noise_data *data = NULL; 1156 struct iwl4965_chain_noise_data *data = NULL;
1157 int rc = 0; 1157 int rc = 0;
1158 1158
1159 data = &(priv->chain_noise_data); 1159 data = &(priv->chain_noise_data);
1160 if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) { 1160 if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl4965_is_associated(priv)) {
1161 struct iwl_calibration_cmd cmd; 1161 struct iwl4965_calibration_cmd cmd;
1162 1162
1163 memset(&cmd, 0, sizeof(cmd)); 1163 memset(&cmd, 0, sizeof(cmd));
1164 cmd.opCode = PHY_CALIBRATE_DIFF_GAIN_CMD; 1164 cmd.opCode = PHY_CALIBRATE_DIFF_GAIN_CMD;
1165 cmd.diff_gain_a = 0; 1165 cmd.diff_gain_a = 0;
1166 cmd.diff_gain_b = 0; 1166 cmd.diff_gain_b = 0;
1167 cmd.diff_gain_c = 0; 1167 cmd.diff_gain_c = 0;
1168 rc = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, 1168 rc = iwl4965_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
1169 sizeof(cmd), &cmd); 1169 sizeof(cmd), &cmd);
1170 msleep(4); 1170 msleep(4);
1171 data->state = IWL_CHAIN_NOISE_ACCUMULATE; 1171 data->state = IWL_CHAIN_NOISE_ACCUMULATE;
@@ -1180,10 +1180,10 @@ void iwl4965_chain_noise_reset(struct iwl_priv *priv)
1180 * 1) Which antennas are connected. 1180 * 1) Which antennas are connected.
1181 * 2) Differential rx gain settings to balance the 3 receivers. 1181 * 2) Differential rx gain settings to balance the 3 receivers.
1182 */ 1182 */
1183static void iwl4965_noise_calibration(struct iwl_priv *priv, 1183static void iwl4965_noise_calibration(struct iwl4965_priv *priv,
1184 struct iwl_notif_statistics *stat_resp) 1184 struct iwl4965_notif_statistics *stat_resp)
1185{ 1185{
1186 struct iwl_chain_noise_data *data = NULL; 1186 struct iwl4965_chain_noise_data *data = NULL;
1187 int rc = 0; 1187 int rc = 0;
1188 1188
1189 u32 chain_noise_a; 1189 u32 chain_noise_a;
@@ -1382,7 +1382,7 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv,
1382 1382
1383 /* Differential gain gets sent to uCode only once */ 1383 /* Differential gain gets sent to uCode only once */
1384 if (!data->radio_write) { 1384 if (!data->radio_write) {
1385 struct iwl_calibration_cmd cmd; 1385 struct iwl4965_calibration_cmd cmd;
1386 data->radio_write = 1; 1386 data->radio_write = 1;
1387 1387
1388 memset(&cmd, 0, sizeof(cmd)); 1388 memset(&cmd, 0, sizeof(cmd));
@@ -1390,7 +1390,7 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv,
1390 cmd.diff_gain_a = data->delta_gain_code[0]; 1390 cmd.diff_gain_a = data->delta_gain_code[0];
1391 cmd.diff_gain_b = data->delta_gain_code[1]; 1391 cmd.diff_gain_b = data->delta_gain_code[1];
1392 cmd.diff_gain_c = data->delta_gain_code[2]; 1392 cmd.diff_gain_c = data->delta_gain_code[2];
1393 rc = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, 1393 rc = iwl4965_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
1394 sizeof(cmd), &cmd); 1394 sizeof(cmd), &cmd);
1395 if (rc) 1395 if (rc)
1396 IWL_DEBUG_CALIB("fail sending cmd " 1396 IWL_DEBUG_CALIB("fail sending cmd "
@@ -1413,8 +1413,8 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv,
1413 return; 1413 return;
1414} 1414}
1415 1415
1416static void iwl4965_sensitivity_calibration(struct iwl_priv *priv, 1416static void iwl4965_sensitivity_calibration(struct iwl4965_priv *priv,
1417 struct iwl_notif_statistics *resp) 1417 struct iwl4965_notif_statistics *resp)
1418{ 1418{
1419 int rc = 0; 1419 int rc = 0;
1420 u32 rx_enable_time; 1420 u32 rx_enable_time;
@@ -1424,7 +1424,7 @@ static void iwl4965_sensitivity_calibration(struct iwl_priv *priv,
1424 u32 bad_plcp_ofdm; 1424 u32 bad_plcp_ofdm;
1425 u32 norm_fa_ofdm; 1425 u32 norm_fa_ofdm;
1426 u32 norm_fa_cck; 1426 u32 norm_fa_cck;
1427 struct iwl_sensitivity_data *data = NULL; 1427 struct iwl4965_sensitivity_data *data = NULL;
1428 struct statistics_rx_non_phy *rx_info = &(resp->rx.general); 1428 struct statistics_rx_non_phy *rx_info = &(resp->rx.general);
1429 struct statistics_rx *statistics = &(resp->rx); 1429 struct statistics_rx *statistics = &(resp->rx);
1430 unsigned long flags; 1430 unsigned long flags;
@@ -1432,7 +1432,7 @@ static void iwl4965_sensitivity_calibration(struct iwl_priv *priv,
1432 1432
1433 data = &(priv->sensitivity_data); 1433 data = &(priv->sensitivity_data);
1434 1434
1435 if (!iwl_is_associated(priv)) { 1435 if (!iwl4965_is_associated(priv)) {
1436 IWL_DEBUG_CALIB("<< - not associated\n"); 1436 IWL_DEBUG_CALIB("<< - not associated\n");
1437 return; 1437 return;
1438 } 1438 }
@@ -1520,7 +1520,7 @@ static void iwl4965_sensitivity_calibration(struct iwl_priv *priv,
1520 1520
1521static void iwl4965_bg_sensitivity_work(struct work_struct *work) 1521static void iwl4965_bg_sensitivity_work(struct work_struct *work)
1522{ 1522{
1523 struct iwl_priv *priv = container_of(work, struct iwl_priv, 1523 struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv,
1524 sensitivity_work); 1524 sensitivity_work);
1525 1525
1526 mutex_lock(&priv->mutex); 1526 mutex_lock(&priv->mutex);
@@ -1550,7 +1550,7 @@ static void iwl4965_bg_sensitivity_work(struct work_struct *work)
1550 1550
1551static void iwl4965_bg_txpower_work(struct work_struct *work) 1551static void iwl4965_bg_txpower_work(struct work_struct *work)
1552{ 1552{
1553 struct iwl_priv *priv = container_of(work, struct iwl_priv, 1553 struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv,
1554 txpower_work); 1554 txpower_work);
1555 1555
1556 /* If a scan happened to start before we got here 1556 /* If a scan happened to start before we got here
@@ -1566,7 +1566,7 @@ static void iwl4965_bg_txpower_work(struct work_struct *work)
1566 /* Regardless of if we are assocaited, we must reconfigure the 1566 /* Regardless of if we are assocaited, we must reconfigure the
1567 * TX power since frames can be sent on non-radar channels while 1567 * TX power since frames can be sent on non-radar channels while
1568 * not associated */ 1568 * not associated */
1569 iwl_hw_reg_send_txpower(priv); 1569 iwl4965_hw_reg_send_txpower(priv);
1570 1570
1571 /* Update last_temperature to keep is_calib_needed from running 1571 /* Update last_temperature to keep is_calib_needed from running
1572 * when it isn't needed... */ 1572 * when it isn't needed... */
@@ -1578,24 +1578,24 @@ static void iwl4965_bg_txpower_work(struct work_struct *work)
1578/* 1578/*
1579 * Acquire priv->lock before calling this function ! 1579 * Acquire priv->lock before calling this function !
1580 */ 1580 */
1581static void iwl4965_set_wr_ptrs(struct iwl_priv *priv, int txq_id, u32 index) 1581static void iwl4965_set_wr_ptrs(struct iwl4965_priv *priv, int txq_id, u32 index)
1582{ 1582{
1583 iwl_write_direct32(priv, HBUS_TARG_WRPTR, 1583 iwl4965_write_direct32(priv, HBUS_TARG_WRPTR,
1584 (index & 0xff) | (txq_id << 8)); 1584 (index & 0xff) | (txq_id << 8));
1585 iwl_write_prph(priv, KDR_SCD_QUEUE_RDPTR(txq_id), index); 1585 iwl4965_write_prph(priv, KDR_SCD_QUEUE_RDPTR(txq_id), index);
1586} 1586}
1587 1587
1588/* 1588/*
1589 * Acquire priv->lock before calling this function ! 1589 * Acquire priv->lock before calling this function !
1590 */ 1590 */
1591static void iwl4965_tx_queue_set_status(struct iwl_priv *priv, 1591static void iwl4965_tx_queue_set_status(struct iwl4965_priv *priv,
1592 struct iwl_tx_queue *txq, 1592 struct iwl4965_tx_queue *txq,
1593 int tx_fifo_id, int scd_retry) 1593 int tx_fifo_id, int scd_retry)
1594{ 1594{
1595 int txq_id = txq->q.id; 1595 int txq_id = txq->q.id;
1596 int active = test_bit(txq_id, &priv->txq_ctx_active_msk)?1:0; 1596 int active = test_bit(txq_id, &priv->txq_ctx_active_msk)?1:0;
1597 1597
1598 iwl_write_prph(priv, KDR_SCD_QUEUE_STATUS_BITS(txq_id), 1598 iwl4965_write_prph(priv, KDR_SCD_QUEUE_STATUS_BITS(txq_id),
1599 (active << SCD_QUEUE_STTS_REG_POS_ACTIVE) | 1599 (active << SCD_QUEUE_STTS_REG_POS_ACTIVE) |
1600 (tx_fifo_id << SCD_QUEUE_STTS_REG_POS_TXF) | 1600 (tx_fifo_id << SCD_QUEUE_STTS_REG_POS_TXF) |
1601 (scd_retry << SCD_QUEUE_STTS_REG_POS_WSL) | 1601 (scd_retry << SCD_QUEUE_STTS_REG_POS_WSL) |
@@ -1619,17 +1619,17 @@ static const u16 default_queue_to_tx_fifo[] = {
1619 IWL_TX_FIFO_HCCA_2 1619 IWL_TX_FIFO_HCCA_2
1620}; 1620};
1621 1621
1622static inline void iwl4965_txq_ctx_activate(struct iwl_priv *priv, int txq_id) 1622static inline void iwl4965_txq_ctx_activate(struct iwl4965_priv *priv, int txq_id)
1623{ 1623{
1624 set_bit(txq_id, &priv->txq_ctx_active_msk); 1624 set_bit(txq_id, &priv->txq_ctx_active_msk);
1625} 1625}
1626 1626
1627static inline void iwl4965_txq_ctx_deactivate(struct iwl_priv *priv, int txq_id) 1627static inline void iwl4965_txq_ctx_deactivate(struct iwl4965_priv *priv, int txq_id)
1628{ 1628{
1629 clear_bit(txq_id, &priv->txq_ctx_active_msk); 1629 clear_bit(txq_id, &priv->txq_ctx_active_msk);
1630} 1630}
1631 1631
1632int iwl4965_alive_notify(struct iwl_priv *priv) 1632int iwl4965_alive_notify(struct iwl4965_priv *priv)
1633{ 1633{
1634 u32 a; 1634 u32 a;
1635 int i = 0; 1635 int i = 0;
@@ -1640,43 +1640,43 @@ int iwl4965_alive_notify(struct iwl_priv *priv)
1640 1640
1641#ifdef CONFIG_IWL4965_SENSITIVITY 1641#ifdef CONFIG_IWL4965_SENSITIVITY
1642 memset(&(priv->sensitivity_data), 0, 1642 memset(&(priv->sensitivity_data), 0,
1643 sizeof(struct iwl_sensitivity_data)); 1643 sizeof(struct iwl4965_sensitivity_data));
1644 memset(&(priv->chain_noise_data), 0, 1644 memset(&(priv->chain_noise_data), 0,
1645 sizeof(struct iwl_chain_noise_data)); 1645 sizeof(struct iwl4965_chain_noise_data));
1646 for (i = 0; i < NUM_RX_CHAINS; i++) 1646 for (i = 0; i < NUM_RX_CHAINS; i++)
1647 priv->chain_noise_data.delta_gain_code[i] = 1647 priv->chain_noise_data.delta_gain_code[i] =
1648 CHAIN_NOISE_DELTA_GAIN_INIT_VAL; 1648 CHAIN_NOISE_DELTA_GAIN_INIT_VAL;
1649#endif /* CONFIG_IWL4965_SENSITIVITY*/ 1649#endif /* CONFIG_IWL4965_SENSITIVITY*/
1650 rc = iwl_grab_nic_access(priv); 1650 rc = iwl4965_grab_nic_access(priv);
1651 if (rc) { 1651 if (rc) {
1652 spin_unlock_irqrestore(&priv->lock, flags); 1652 spin_unlock_irqrestore(&priv->lock, flags);
1653 return rc; 1653 return rc;
1654 } 1654 }
1655 1655
1656 priv->scd_base_addr = iwl_read_prph(priv, KDR_SCD_SRAM_BASE_ADDR); 1656 priv->scd_base_addr = iwl4965_read_prph(priv, KDR_SCD_SRAM_BASE_ADDR);
1657 a = priv->scd_base_addr + SCD_CONTEXT_DATA_OFFSET; 1657 a = priv->scd_base_addr + SCD_CONTEXT_DATA_OFFSET;
1658 for (; a < priv->scd_base_addr + SCD_TX_STTS_BITMAP_OFFSET; a += 4) 1658 for (; a < priv->scd_base_addr + SCD_TX_STTS_BITMAP_OFFSET; a += 4)
1659 iwl_write_targ_mem(priv, a, 0); 1659 iwl4965_write_targ_mem(priv, a, 0);
1660 for (; a < priv->scd_base_addr + SCD_TRANSLATE_TBL_OFFSET; a += 4) 1660 for (; a < priv->scd_base_addr + SCD_TRANSLATE_TBL_OFFSET; a += 4)
1661 iwl_write_targ_mem(priv, a, 0); 1661 iwl4965_write_targ_mem(priv, a, 0);
1662 for (; a < sizeof(u16) * priv->hw_setting.max_txq_num; a += 4) 1662 for (; a < sizeof(u16) * priv->hw_setting.max_txq_num; a += 4)
1663 iwl_write_targ_mem(priv, a, 0); 1663 iwl4965_write_targ_mem(priv, a, 0);
1664 1664
1665 iwl_write_prph(priv, KDR_SCD_DRAM_BASE_ADDR, 1665 iwl4965_write_prph(priv, KDR_SCD_DRAM_BASE_ADDR,
1666 (priv->hw_setting.shared_phys + 1666 (priv->hw_setting.shared_phys +
1667 offsetof(struct iwl_shared, queues_byte_cnt_tbls)) >> 10); 1667 offsetof(struct iwl4965_shared, queues_byte_cnt_tbls)) >> 10);
1668 iwl_write_prph(priv, KDR_SCD_QUEUECHAIN_SEL, 0); 1668 iwl4965_write_prph(priv, KDR_SCD_QUEUECHAIN_SEL, 0);
1669 1669
1670 /* initiate the queues */ 1670 /* initiate the queues */
1671 for (i = 0; i < priv->hw_setting.max_txq_num; i++) { 1671 for (i = 0; i < priv->hw_setting.max_txq_num; i++) {
1672 iwl_write_prph(priv, KDR_SCD_QUEUE_RDPTR(i), 0); 1672 iwl4965_write_prph(priv, KDR_SCD_QUEUE_RDPTR(i), 0);
1673 iwl_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); 1673 iwl4965_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8));
1674 iwl_write_targ_mem(priv, priv->scd_base_addr + 1674 iwl4965_write_targ_mem(priv, priv->scd_base_addr +
1675 SCD_CONTEXT_QUEUE_OFFSET(i), 1675 SCD_CONTEXT_QUEUE_OFFSET(i),
1676 (SCD_WIN_SIZE << 1676 (SCD_WIN_SIZE <<
1677 SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & 1677 SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) &
1678 SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); 1678 SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK);
1679 iwl_write_targ_mem(priv, priv->scd_base_addr + 1679 iwl4965_write_targ_mem(priv, priv->scd_base_addr +
1680 SCD_CONTEXT_QUEUE_OFFSET(i) + 1680 SCD_CONTEXT_QUEUE_OFFSET(i) +
1681 sizeof(u32), 1681 sizeof(u32),
1682 (SCD_FRAME_LIMIT << 1682 (SCD_FRAME_LIMIT <<
@@ -1684,10 +1684,10 @@ int iwl4965_alive_notify(struct iwl_priv *priv)
1684 SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); 1684 SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK);
1685 1685
1686 } 1686 }
1687 iwl_write_prph(priv, KDR_SCD_INTERRUPT_MASK, 1687 iwl4965_write_prph(priv, KDR_SCD_INTERRUPT_MASK,
1688 (1 << priv->hw_setting.max_txq_num) - 1); 1688 (1 << priv->hw_setting.max_txq_num) - 1);
1689 1689
1690 iwl_write_prph(priv, KDR_SCD_TXFACT, 1690 iwl4965_write_prph(priv, KDR_SCD_TXFACT,
1691 SCD_TXFACT_REG_TXFIFO_MASK(0, 7)); 1691 SCD_TXFACT_REG_TXFIFO_MASK(0, 7));
1692 1692
1693 iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0); 1693 iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0);
@@ -1698,27 +1698,27 @@ int iwl4965_alive_notify(struct iwl_priv *priv)
1698 iwl4965_tx_queue_set_status(priv, &priv->txq[i], ac, 0); 1698 iwl4965_tx_queue_set_status(priv, &priv->txq[i], ac, 0);
1699 } 1699 }
1700 1700
1701 iwl_release_nic_access(priv); 1701 iwl4965_release_nic_access(priv);
1702 spin_unlock_irqrestore(&priv->lock, flags); 1702 spin_unlock_irqrestore(&priv->lock, flags);
1703 1703
1704 return 0; 1704 return 0;
1705} 1705}
1706 1706
1707int iwl_hw_set_hw_setting(struct iwl_priv *priv) 1707int iwl4965_hw_set_hw_setting(struct iwl4965_priv *priv)
1708{ 1708{
1709 priv->hw_setting.shared_virt = 1709 priv->hw_setting.shared_virt =
1710 pci_alloc_consistent(priv->pci_dev, 1710 pci_alloc_consistent(priv->pci_dev,
1711 sizeof(struct iwl_shared), 1711 sizeof(struct iwl4965_shared),
1712 &priv->hw_setting.shared_phys); 1712 &priv->hw_setting.shared_phys);
1713 1713
1714 if (!priv->hw_setting.shared_virt) 1714 if (!priv->hw_setting.shared_virt)
1715 return -1; 1715 return -1;
1716 1716
1717 memset(priv->hw_setting.shared_virt, 0, sizeof(struct iwl_shared)); 1717 memset(priv->hw_setting.shared_virt, 0, sizeof(struct iwl4965_shared));
1718 1718
1719 priv->hw_setting.max_txq_num = iwl_param_queues_num; 1719 priv->hw_setting.max_txq_num = iwl4965_param_queues_num;
1720 priv->hw_setting.ac_queue_count = AC_NUM; 1720 priv->hw_setting.ac_queue_count = AC_NUM;
1721 priv->hw_setting.tx_cmd_len = sizeof(struct iwl_tx_cmd); 1721 priv->hw_setting.tx_cmd_len = sizeof(struct iwl4965_tx_cmd);
1722 priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE; 1722 priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE;
1723 priv->hw_setting.max_rxq_log = RX_QUEUE_SIZE_LOG; 1723 priv->hw_setting.max_rxq_log = RX_QUEUE_SIZE_LOG;
1724 1724
@@ -1728,30 +1728,30 @@ int iwl_hw_set_hw_setting(struct iwl_priv *priv)
1728} 1728}
1729 1729
1730/** 1730/**
1731 * iwl_hw_txq_ctx_free - Free TXQ Context 1731 * iwl4965_hw_txq_ctx_free - Free TXQ Context
1732 * 1732 *
1733 * Destroy all TX DMA queues and structures 1733 * Destroy all TX DMA queues and structures
1734 */ 1734 */
1735void iwl_hw_txq_ctx_free(struct iwl_priv *priv) 1735void iwl4965_hw_txq_ctx_free(struct iwl4965_priv *priv)
1736{ 1736{
1737 int txq_id; 1737 int txq_id;
1738 1738
1739 /* Tx queues */ 1739 /* Tx queues */
1740 for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++) 1740 for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++)
1741 iwl_tx_queue_free(priv, &priv->txq[txq_id]); 1741 iwl4965_tx_queue_free(priv, &priv->txq[txq_id]);
1742 1742
1743 iwl4965_kw_free(priv); 1743 iwl4965_kw_free(priv);
1744} 1744}
1745 1745
1746/** 1746/**
1747 * iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr] 1747 * iwl4965_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr]
1748 * 1748 *
1749 * Does NOT advance any indexes 1749 * Does NOT advance any indexes
1750 */ 1750 */
1751int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) 1751int iwl4965_hw_txq_free_tfd(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq)
1752{ 1752{
1753 struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0]; 1753 struct iwl4965_tfd_frame *bd_tmp = (struct iwl4965_tfd_frame *)&txq->bd[0];
1754 struct iwl_tfd_frame *bd = &bd_tmp[txq->q.read_ptr]; 1754 struct iwl4965_tfd_frame *bd = &bd_tmp[txq->q.read_ptr];
1755 struct pci_dev *dev = priv->pci_dev; 1755 struct pci_dev *dev = priv->pci_dev;
1756 int i; 1756 int i;
1757 int counter = 0; 1757 int counter = 0;
@@ -1801,9 +1801,9 @@ int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
1801 return 0; 1801 return 0;
1802} 1802}
1803 1803
1804int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) 1804int iwl4965_hw_reg_set_txpower(struct iwl4965_priv *priv, s8 power)
1805{ 1805{
1806 IWL_ERROR("TODO: Implement iwl_hw_reg_set_txpower!\n"); 1806 IWL_ERROR("TODO: Implement iwl4965_hw_reg_set_txpower!\n");
1807 return -EINVAL; 1807 return -EINVAL;
1808} 1808}
1809 1809
@@ -1845,12 +1845,12 @@ static s32 iwl4965_get_voltage_compensation(s32 eeprom_voltage,
1845 return comp; 1845 return comp;
1846} 1846}
1847 1847
1848static const struct iwl_channel_info * 1848static const struct iwl4965_channel_info *
1849iwl4965_get_channel_txpower_info(struct iwl_priv *priv, u8 phymode, u16 channel) 1849iwl4965_get_channel_txpower_info(struct iwl4965_priv *priv, u8 phymode, u16 channel)
1850{ 1850{
1851 const struct iwl_channel_info *ch_info; 1851 const struct iwl4965_channel_info *ch_info;
1852 1852
1853 ch_info = iwl_get_channel_info(priv, phymode, channel); 1853 ch_info = iwl4965_get_channel_info(priv, phymode, channel);
1854 1854
1855 if (!is_channel_valid(ch_info)) 1855 if (!is_channel_valid(ch_info))
1856 return NULL; 1856 return NULL;
@@ -1884,7 +1884,7 @@ static s32 iwl4965_get_tx_atten_grp(u16 channel)
1884 return -1; 1884 return -1;
1885} 1885}
1886 1886
1887static u32 iwl4965_get_sub_band(const struct iwl_priv *priv, u32 channel) 1887static u32 iwl4965_get_sub_band(const struct iwl4965_priv *priv, u32 channel)
1888{ 1888{
1889 s32 b = -1; 1889 s32 b = -1;
1890 1890
@@ -1912,15 +1912,15 @@ static s32 iwl4965_interpolate_value(s32 x, s32 x1, s32 y1, s32 x2, s32 y2)
1912 } 1912 }
1913} 1913}
1914 1914
1915static int iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel, 1915static int iwl4965_interpolate_chan(struct iwl4965_priv *priv, u32 channel,
1916 struct iwl_eeprom_calib_ch_info *chan_info) 1916 struct iwl4965_eeprom_calib_ch_info *chan_info)
1917{ 1917{
1918 s32 s = -1; 1918 s32 s = -1;
1919 u32 c; 1919 u32 c;
1920 u32 m; 1920 u32 m;
1921 const struct iwl_eeprom_calib_measure *m1; 1921 const struct iwl4965_eeprom_calib_measure *m1;
1922 const struct iwl_eeprom_calib_measure *m2; 1922 const struct iwl4965_eeprom_calib_measure *m2;
1923 struct iwl_eeprom_calib_measure *omeas; 1923 struct iwl4965_eeprom_calib_measure *omeas;
1924 u32 ch_i1; 1924 u32 ch_i1;
1925 u32 ch_i2; 1925 u32 ch_i2;
1926 1926
@@ -1995,7 +1995,7 @@ static s32 back_off_table[] = {
1995 1995
1996/* Thermal compensation values for txpower for various frequency ranges ... 1996/* Thermal compensation values for txpower for various frequency ranges ...
1997 * ratios from 3:1 to 4.5:1 of degrees (Celsius) per half-dB gain adjust */ 1997 * ratios from 3:1 to 4.5:1 of degrees (Celsius) per half-dB gain adjust */
1998static struct iwl_txpower_comp_entry { 1998static struct iwl4965_txpower_comp_entry {
1999 s32 degrees_per_05db_a; 1999 s32 degrees_per_05db_a;
2000 s32 degrees_per_05db_a_denom; 2000 s32 degrees_per_05db_a_denom;
2001} tx_power_cmp_tble[CALIB_CH_GROUP_MAX] = { 2001} tx_power_cmp_tble[CALIB_CH_GROUP_MAX] = {
@@ -2245,9 +2245,9 @@ static const struct gain_entry gain_table[2][108] = {
2245 } 2245 }
2246}; 2246};
2247 2247
2248static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, 2248static int iwl4965_fill_txpower_tbl(struct iwl4965_priv *priv, u8 band, u16 channel,
2249 u8 is_fat, u8 ctrl_chan_high, 2249 u8 is_fat, u8 ctrl_chan_high,
2250 struct iwl_tx_power_db *tx_power_tbl) 2250 struct iwl4965_tx_power_db *tx_power_tbl)
2251{ 2251{
2252 u8 saturation_power; 2252 u8 saturation_power;
2253 s32 target_power; 2253 s32 target_power;
@@ -2259,9 +2259,9 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
2259 s32 txatten_grp = CALIB_CH_GROUP_MAX; 2259 s32 txatten_grp = CALIB_CH_GROUP_MAX;
2260 int i; 2260 int i;
2261 int c; 2261 int c;
2262 const struct iwl_channel_info *ch_info = NULL; 2262 const struct iwl4965_channel_info *ch_info = NULL;
2263 struct iwl_eeprom_calib_ch_info ch_eeprom_info; 2263 struct iwl4965_eeprom_calib_ch_info ch_eeprom_info;
2264 const struct iwl_eeprom_calib_measure *measurement; 2264 const struct iwl4965_eeprom_calib_measure *measurement;
2265 s16 voltage; 2265 s16 voltage;
2266 s32 init_voltage; 2266 s32 init_voltage;
2267 s32 voltage_compensation; 2267 s32 voltage_compensation;
@@ -2400,7 +2400,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
2400 /* for each of 33 bit-rates (including 1 for CCK) */ 2400 /* for each of 33 bit-rates (including 1 for CCK) */
2401 for (i = 0; i < POWER_TABLE_NUM_ENTRIES; i++) { 2401 for (i = 0; i < POWER_TABLE_NUM_ENTRIES; i++) {
2402 u8 is_mimo_rate; 2402 u8 is_mimo_rate;
2403 union iwl_tx_power_dual_stream tx_power; 2403 union iwl4965_tx_power_dual_stream tx_power;
2404 2404
2405 /* for mimo, reduce each chain's txpower by half 2405 /* for mimo, reduce each chain's txpower by half
2406 * (3dB, 6 steps), so total output power is regulatory 2406 * (3dB, 6 steps), so total output power is regulatory
@@ -2497,14 +2497,14 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
2497} 2497}
2498 2498
2499/** 2499/**
2500 * iwl_hw_reg_send_txpower - Configure the TXPOWER level user limit 2500 * iwl4965_hw_reg_send_txpower - Configure the TXPOWER level user limit
2501 * 2501 *
2502 * Uses the active RXON for channel, band, and characteristics (fat, high) 2502 * Uses the active RXON for channel, band, and characteristics (fat, high)
2503 * The power limit is taken from priv->user_txpower_limit. 2503 * The power limit is taken from priv->user_txpower_limit.
2504 */ 2504 */
2505int iwl_hw_reg_send_txpower(struct iwl_priv *priv) 2505int iwl4965_hw_reg_send_txpower(struct iwl4965_priv *priv)
2506{ 2506{
2507 struct iwl_txpowertable_cmd cmd = { 0 }; 2507 struct iwl4965_txpowertable_cmd cmd = { 0 };
2508 int rc = 0; 2508 int rc = 0;
2509 u8 band = 0; 2509 u8 band = 0;
2510 u8 is_fat = 0; 2510 u8 is_fat = 0;
@@ -2536,23 +2536,23 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv)
2536 if (rc) 2536 if (rc)
2537 return rc; 2537 return rc;
2538 2538
2539 rc = iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd); 2539 rc = iwl4965_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd);
2540 return rc; 2540 return rc;
2541} 2541}
2542 2542
2543int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel) 2543int iwl4965_hw_channel_switch(struct iwl4965_priv *priv, u16 channel)
2544{ 2544{
2545 int rc; 2545 int rc;
2546 u8 band = 0; 2546 u8 band = 0;
2547 u8 is_fat = 0; 2547 u8 is_fat = 0;
2548 u8 ctrl_chan_high = 0; 2548 u8 ctrl_chan_high = 0;
2549 struct iwl_channel_switch_cmd cmd = { 0 }; 2549 struct iwl4965_channel_switch_cmd cmd = { 0 };
2550 const struct iwl_channel_info *ch_info; 2550 const struct iwl4965_channel_info *ch_info;
2551 2551
2552 band = ((priv->phymode == MODE_IEEE80211B) || 2552 band = ((priv->phymode == MODE_IEEE80211B) ||
2553 (priv->phymode == MODE_IEEE80211G)); 2553 (priv->phymode == MODE_IEEE80211G));
2554 2554
2555 ch_info = iwl_get_channel_info(priv, priv->phymode, channel); 2555 ch_info = iwl4965_get_channel_info(priv, priv->phymode, channel);
2556 2556
2557 is_fat = is_fat_channel(priv->staging_rxon.flags); 2557 is_fat = is_fat_channel(priv->staging_rxon.flags);
2558 2558
@@ -2578,15 +2578,15 @@ int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel)
2578 return rc; 2578 return rc;
2579 } 2579 }
2580 2580
2581 rc = iwl_send_cmd_pdu(priv, REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); 2581 rc = iwl4965_send_cmd_pdu(priv, REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd);
2582 return rc; 2582 return rc;
2583} 2583}
2584 2584
2585#define RTS_HCCA_RETRY_LIMIT 3 2585#define RTS_HCCA_RETRY_LIMIT 3
2586#define RTS_DFAULT_RETRY_LIMIT 60 2586#define RTS_DFAULT_RETRY_LIMIT 60
2587 2587
2588void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, 2588void iwl4965_hw_build_tx_cmd_rate(struct iwl4965_priv *priv,
2589 struct iwl_cmd *cmd, 2589 struct iwl4965_cmd *cmd,
2590 struct ieee80211_tx_control *ctrl, 2590 struct ieee80211_tx_control *ctrl,
2591 struct ieee80211_hdr *hdr, int sta_id, 2591 struct ieee80211_hdr *hdr, int sta_id,
2592 int is_hcca) 2592 int is_hcca)
@@ -2599,7 +2599,7 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
2599 2599
2600 tx_flags = cmd->cmd.tx.tx_flags; 2600 tx_flags = cmd->cmd.tx.tx_flags;
2601 2601
2602 rate = iwl_rates[ctrl->tx_rate].plcp; 2602 rate = iwl4965_rates[ctrl->tx_rate].plcp;
2603 2603
2604 rts_retry_limit = (is_hcca) ? 2604 rts_retry_limit = (is_hcca) ?
2605 RTS_HCCA_RETRY_LIMIT : RTS_DFAULT_RETRY_LIMIT; 2605 RTS_HCCA_RETRY_LIMIT : RTS_DFAULT_RETRY_LIMIT;
@@ -2632,26 +2632,26 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
2632 2632
2633 cmd->cmd.tx.rts_retry_limit = rts_retry_limit; 2633 cmd->cmd.tx.rts_retry_limit = rts_retry_limit;
2634 cmd->cmd.tx.data_retry_limit = data_retry_limit; 2634 cmd->cmd.tx.data_retry_limit = data_retry_limit;
2635 cmd->cmd.tx.rate_n_flags = iwl_hw_set_rate_n_flags(rate, 0); 2635 cmd->cmd.tx.rate_n_flags = iwl4965_hw_set_rate_n_flags(rate, 0);
2636 cmd->cmd.tx.tx_flags = tx_flags; 2636 cmd->cmd.tx.tx_flags = tx_flags;
2637} 2637}
2638 2638
2639int iwl_hw_get_rx_read(struct iwl_priv *priv) 2639int iwl4965_hw_get_rx_read(struct iwl4965_priv *priv)
2640{ 2640{
2641 struct iwl_shared *shared_data = priv->hw_setting.shared_virt; 2641 struct iwl4965_shared *shared_data = priv->hw_setting.shared_virt;
2642 2642
2643 return IWL_GET_BITS(*shared_data, rb_closed_stts_rb_num); 2643 return IWL_GET_BITS(*shared_data, rb_closed_stts_rb_num);
2644} 2644}
2645 2645
2646int iwl_hw_get_temperature(struct iwl_priv *priv) 2646int iwl4965_hw_get_temperature(struct iwl4965_priv *priv)
2647{ 2647{
2648 return priv->temperature; 2648 return priv->temperature;
2649} 2649}
2650 2650
2651unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, 2651unsigned int iwl4965_hw_get_beacon_cmd(struct iwl4965_priv *priv,
2652 struct iwl_frame *frame, u8 rate) 2652 struct iwl4965_frame *frame, u8 rate)
2653{ 2653{
2654 struct iwl_tx_beacon_cmd *tx_beacon_cmd; 2654 struct iwl4965_tx_beacon_cmd *tx_beacon_cmd;
2655 unsigned int frame_size; 2655 unsigned int frame_size;
2656 2656
2657 tx_beacon_cmd = &frame->u.beacon; 2657 tx_beacon_cmd = &frame->u.beacon;
@@ -2660,9 +2660,9 @@ unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
2660 tx_beacon_cmd->tx.sta_id = IWL4965_BROADCAST_ID; 2660 tx_beacon_cmd->tx.sta_id = IWL4965_BROADCAST_ID;
2661 tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 2661 tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
2662 2662
2663 frame_size = iwl_fill_beacon_frame(priv, 2663 frame_size = iwl4965_fill_beacon_frame(priv,
2664 tx_beacon_cmd->frame, 2664 tx_beacon_cmd->frame,
2665 BROADCAST_ADDR, 2665 iwl4965_broadcast_addr,
2666 sizeof(frame->u) - sizeof(*tx_beacon_cmd)); 2666 sizeof(frame->u) - sizeof(*tx_beacon_cmd));
2667 2667
2668 BUG_ON(frame_size > MAX_MPDU_SIZE); 2668 BUG_ON(frame_size > MAX_MPDU_SIZE);
@@ -2670,36 +2670,36 @@ unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
2670 2670
2671 if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP)) 2671 if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP))
2672 tx_beacon_cmd->tx.rate_n_flags = 2672 tx_beacon_cmd->tx.rate_n_flags =
2673 iwl_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK); 2673 iwl4965_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK);
2674 else 2674 else
2675 tx_beacon_cmd->tx.rate_n_flags = 2675 tx_beacon_cmd->tx.rate_n_flags =
2676 iwl_hw_set_rate_n_flags(rate, 0); 2676 iwl4965_hw_set_rate_n_flags(rate, 0);
2677 2677
2678 tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK | 2678 tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK |
2679 TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK); 2679 TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK);
2680 return (sizeof(*tx_beacon_cmd) + frame_size); 2680 return (sizeof(*tx_beacon_cmd) + frame_size);
2681} 2681}
2682 2682
2683int iwl_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq) 2683int iwl4965_hw_tx_queue_init(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq)
2684{ 2684{
2685 int rc; 2685 int rc;
2686 unsigned long flags; 2686 unsigned long flags;
2687 int txq_id = txq->q.id; 2687 int txq_id = txq->q.id;
2688 2688
2689 spin_lock_irqsave(&priv->lock, flags); 2689 spin_lock_irqsave(&priv->lock, flags);
2690 rc = iwl_grab_nic_access(priv); 2690 rc = iwl4965_grab_nic_access(priv);
2691 if (rc) { 2691 if (rc) {
2692 spin_unlock_irqrestore(&priv->lock, flags); 2692 spin_unlock_irqrestore(&priv->lock, flags);
2693 return rc; 2693 return rc;
2694 } 2694 }
2695 2695
2696 iwl_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id), 2696 iwl4965_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id),
2697 txq->q.dma_addr >> 8); 2697 txq->q.dma_addr >> 8);
2698 iwl_write_direct32( 2698 iwl4965_write_direct32(
2699 priv, IWL_FH_TCSR_CHNL_TX_CONFIG_REG(txq_id), 2699 priv, IWL_FH_TCSR_CHNL_TX_CONFIG_REG(txq_id),
2700 IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | 2700 IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
2701 IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL); 2701 IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL);
2702 iwl_release_nic_access(priv); 2702 iwl4965_release_nic_access(priv);
2703 spin_unlock_irqrestore(&priv->lock, flags); 2703 spin_unlock_irqrestore(&priv->lock, flags);
2704 2704
2705 return 0; 2705 return 0;
@@ -2710,11 +2710,11 @@ static inline u8 iwl4965_get_dma_hi_address(dma_addr_t addr)
2710 return sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0; 2710 return sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0;
2711} 2711}
2712 2712
2713int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, 2713int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl4965_priv *priv, void *ptr,
2714 dma_addr_t addr, u16 len) 2714 dma_addr_t addr, u16 len)
2715{ 2715{
2716 int index, is_odd; 2716 int index, is_odd;
2717 struct iwl_tfd_frame *tfd = ptr; 2717 struct iwl4965_tfd_frame *tfd = ptr;
2718 u32 num_tbs = IWL_GET_BITS(*tfd, num_tbs); 2718 u32 num_tbs = IWL_GET_BITS(*tfd, num_tbs);
2719 2719
2720 if ((num_tbs >= MAX_NUM_OF_TBS) || (num_tbs < 0)) { 2720 if ((num_tbs >= MAX_NUM_OF_TBS) || (num_tbs < 0)) {
@@ -2743,7 +2743,7 @@ int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr,
2743 return 0; 2743 return 0;
2744} 2744}
2745 2745
2746static void iwl_hw_card_show_info(struct iwl_priv *priv) 2746static void iwl4965_hw_card_show_info(struct iwl4965_priv *priv)
2747{ 2747{
2748 u16 hw_version = priv->eeprom.board_revision_4965; 2748 u16 hw_version = priv->eeprom.board_revision_4965;
2749 2749
@@ -2758,12 +2758,12 @@ static void iwl_hw_card_show_info(struct iwl_priv *priv)
2758#define IWL_TX_CRC_SIZE 4 2758#define IWL_TX_CRC_SIZE 4
2759#define IWL_TX_DELIMITER_SIZE 4 2759#define IWL_TX_DELIMITER_SIZE 4
2760 2760
2761int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv, 2761int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv,
2762 struct iwl_tx_queue *txq, u16 byte_cnt) 2762 struct iwl4965_tx_queue *txq, u16 byte_cnt)
2763{ 2763{
2764 int len; 2764 int len;
2765 int txq_id = txq->q.id; 2765 int txq_id = txq->q.id;
2766 struct iwl_shared *shared_data = priv->hw_setting.shared_virt; 2766 struct iwl4965_shared *shared_data = priv->hw_setting.shared_virt;
2767 2767
2768 if (txq->need_update == 0) 2768 if (txq->need_update == 0)
2769 return 0; 2769 return 0;
@@ -2783,7 +2783,7 @@ int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv,
2783 2783
2784/* Set up Rx receiver/antenna/chain usage in "staging" RXON image. 2784/* Set up Rx receiver/antenna/chain usage in "staging" RXON image.
2785 * This should not be used for scan command ... it puts data in wrong place. */ 2785 * This should not be used for scan command ... it puts data in wrong place. */
2786void iwl4965_set_rxon_chain(struct iwl_priv *priv) 2786void iwl4965_set_rxon_chain(struct iwl4965_priv *priv)
2787{ 2787{
2788 u8 is_single = is_single_stream(priv); 2788 u8 is_single = is_single_stream(priv);
2789 u8 idle_state, rx_state; 2789 u8 idle_state, rx_state;
@@ -2819,14 +2819,14 @@ void iwl4965_set_rxon_chain(struct iwl_priv *priv)
2819/* 2819/*
2820 get the traffic load value for tid 2820 get the traffic load value for tid
2821*/ 2821*/
2822static u32 iwl4965_tl_get_load(struct iwl_priv *priv, u8 tid) 2822static u32 iwl4965_tl_get_load(struct iwl4965_priv *priv, u8 tid)
2823{ 2823{
2824 u32 load = 0; 2824 u32 load = 0;
2825 u32 current_time = jiffies_to_msecs(jiffies); 2825 u32 current_time = jiffies_to_msecs(jiffies);
2826 u32 time_diff; 2826 u32 time_diff;
2827 s32 index; 2827 s32 index;
2828 unsigned long flags; 2828 unsigned long flags;
2829 struct iwl_traffic_load *tid_ptr = NULL; 2829 struct iwl4965_traffic_load *tid_ptr = NULL;
2830 2830
2831 if (tid >= TID_MAX_LOAD_COUNT) 2831 if (tid >= TID_MAX_LOAD_COUNT)
2832 return 0; 2832 return 0;
@@ -2867,13 +2867,13 @@ static u32 iwl4965_tl_get_load(struct iwl_priv *priv, u8 tid)
2867 increment traffic load value for tid and also remove 2867 increment traffic load value for tid and also remove
2868 any old values if passed the certian time period 2868 any old values if passed the certian time period
2869*/ 2869*/
2870static void iwl4965_tl_add_packet(struct iwl_priv *priv, u8 tid) 2870static void iwl4965_tl_add_packet(struct iwl4965_priv *priv, u8 tid)
2871{ 2871{
2872 u32 current_time = jiffies_to_msecs(jiffies); 2872 u32 current_time = jiffies_to_msecs(jiffies);
2873 u32 time_diff; 2873 u32 time_diff;
2874 s32 index; 2874 s32 index;
2875 unsigned long flags; 2875 unsigned long flags;
2876 struct iwl_traffic_load *tid_ptr = NULL; 2876 struct iwl4965_traffic_load *tid_ptr = NULL;
2877 2877
2878 if (tid >= TID_MAX_LOAD_COUNT) 2878 if (tid >= TID_MAX_LOAD_COUNT)
2879 return; 2879 return;
@@ -2930,14 +2930,14 @@ enum HT_STATUS {
2930 BA_STATUS_ACTIVE, 2930 BA_STATUS_ACTIVE,
2931}; 2931};
2932 2932
2933static u8 iwl4964_tl_ba_avail(struct iwl_priv *priv) 2933static u8 iwl4964_tl_ba_avail(struct iwl4965_priv *priv)
2934{ 2934{
2935 int i; 2935 int i;
2936 struct iwl_lq_mngr *lq; 2936 struct iwl4965_lq_mngr *lq;
2937 u8 count = 0; 2937 u8 count = 0;
2938 u16 msk; 2938 u16 msk;
2939 2939
2940 lq = (struct iwl_lq_mngr *)&(priv->lq_mngr); 2940 lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr);
2941 for (i = 0; i < TID_MAX_LOAD_COUNT ; i++) { 2941 for (i = 0; i < TID_MAX_LOAD_COUNT ; i++) {
2942 msk = 1 << i; 2942 msk = 1 << i;
2943 if ((lq->agg_ctrl.granted_ba & msk) || 2943 if ((lq->agg_ctrl.granted_ba & msk) ||
@@ -2951,10 +2951,10 @@ static u8 iwl4964_tl_ba_avail(struct iwl_priv *priv)
2951 return 0; 2951 return 0;
2952} 2952}
2953 2953
2954static void iwl4965_ba_status(struct iwl_priv *priv, 2954static void iwl4965_ba_status(struct iwl4965_priv *priv,
2955 u8 tid, enum HT_STATUS status); 2955 u8 tid, enum HT_STATUS status);
2956 2956
2957static int iwl4965_perform_addba(struct iwl_priv *priv, u8 tid, u32 length, 2957static int iwl4965_perform_addba(struct iwl4965_priv *priv, u8 tid, u32 length,
2958 u32 ba_timeout) 2958 u32 ba_timeout)
2959{ 2959{
2960 int rc; 2960 int rc;
@@ -2966,7 +2966,7 @@ static int iwl4965_perform_addba(struct iwl_priv *priv, u8 tid, u32 length,
2966 return rc; 2966 return rc;
2967} 2967}
2968 2968
2969static int iwl4965_perform_delba(struct iwl_priv *priv, u8 tid) 2969static int iwl4965_perform_delba(struct iwl4965_priv *priv, u8 tid)
2970{ 2970{
2971 int rc; 2971 int rc;
2972 2972
@@ -2977,8 +2977,8 @@ static int iwl4965_perform_delba(struct iwl_priv *priv, u8 tid)
2977 return rc; 2977 return rc;
2978} 2978}
2979 2979
2980static void iwl4965_turn_on_agg_for_tid(struct iwl_priv *priv, 2980static void iwl4965_turn_on_agg_for_tid(struct iwl4965_priv *priv,
2981 struct iwl_lq_mngr *lq, 2981 struct iwl4965_lq_mngr *lq,
2982 u8 auto_agg, u8 tid) 2982 u8 auto_agg, u8 tid)
2983{ 2983{
2984 u32 tid_msk = (1 << tid); 2984 u32 tid_msk = (1 << tid);
@@ -3025,12 +3025,12 @@ static void iwl4965_turn_on_agg_for_tid(struct iwl_priv *priv,
3025 spin_unlock_irqrestore(&priv->lq_mngr.lock, flags); 3025 spin_unlock_irqrestore(&priv->lq_mngr.lock, flags);
3026} 3026}
3027 3027
3028static void iwl4965_turn_on_agg(struct iwl_priv *priv, u8 tid) 3028static void iwl4965_turn_on_agg(struct iwl4965_priv *priv, u8 tid)
3029{ 3029{
3030 struct iwl_lq_mngr *lq; 3030 struct iwl4965_lq_mngr *lq;
3031 unsigned long flags; 3031 unsigned long flags;
3032 3032
3033 lq = (struct iwl_lq_mngr *)&(priv->lq_mngr); 3033 lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr);
3034 3034
3035 if ((tid < TID_MAX_LOAD_COUNT)) 3035 if ((tid < TID_MAX_LOAD_COUNT))
3036 iwl4965_turn_on_agg_for_tid(priv, lq, lq->agg_ctrl.auto_agg, 3036 iwl4965_turn_on_agg_for_tid(priv, lq, lq->agg_ctrl.auto_agg,
@@ -3050,13 +3050,13 @@ static void iwl4965_turn_on_agg(struct iwl_priv *priv, u8 tid)
3050 3050
3051} 3051}
3052 3052
3053void iwl4965_turn_off_agg(struct iwl_priv *priv, u8 tid) 3053void iwl4965_turn_off_agg(struct iwl4965_priv *priv, u8 tid)
3054{ 3054{
3055 u32 tid_msk; 3055 u32 tid_msk;
3056 struct iwl_lq_mngr *lq; 3056 struct iwl4965_lq_mngr *lq;
3057 unsigned long flags; 3057 unsigned long flags;
3058 3058
3059 lq = (struct iwl_lq_mngr *)&(priv->lq_mngr); 3059 lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr);
3060 3060
3061 if ((tid < TID_MAX_LOAD_COUNT)) { 3061 if ((tid < TID_MAX_LOAD_COUNT)) {
3062 tid_msk = 1 << tid; 3062 tid_msk = 1 << tid;
@@ -3079,14 +3079,14 @@ void iwl4965_turn_off_agg(struct iwl_priv *priv, u8 tid)
3079 } 3079 }
3080} 3080}
3081 3081
3082static void iwl4965_ba_status(struct iwl_priv *priv, 3082static void iwl4965_ba_status(struct iwl4965_priv *priv,
3083 u8 tid, enum HT_STATUS status) 3083 u8 tid, enum HT_STATUS status)
3084{ 3084{
3085 struct iwl_lq_mngr *lq; 3085 struct iwl4965_lq_mngr *lq;
3086 u32 tid_msk = (1 << tid); 3086 u32 tid_msk = (1 << tid);
3087 unsigned long flags; 3087 unsigned long flags;
3088 3088
3089 lq = (struct iwl_lq_mngr *)&(priv->lq_mngr); 3089 lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr);
3090 3090
3091 if ((tid >= TID_MAX_LOAD_COUNT)) 3091 if ((tid >= TID_MAX_LOAD_COUNT))
3092 goto out; 3092 goto out;
@@ -3119,14 +3119,14 @@ static void iwl4965_ba_status(struct iwl_priv *priv,
3119 3119
3120static void iwl4965_bg_agg_work(struct work_struct *work) 3120static void iwl4965_bg_agg_work(struct work_struct *work)
3121{ 3121{
3122 struct iwl_priv *priv = container_of(work, struct iwl_priv, 3122 struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv,
3123 agg_work); 3123 agg_work);
3124 3124
3125 u32 tid; 3125 u32 tid;
3126 u32 retry_tid; 3126 u32 retry_tid;
3127 u32 tid_msk; 3127 u32 tid_msk;
3128 unsigned long flags; 3128 unsigned long flags;
3129 struct iwl_lq_mngr *lq = (struct iwl_lq_mngr *)&(priv->lq_mngr); 3129 struct iwl4965_lq_mngr *lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr);
3130 3130
3131 spin_lock_irqsave(&priv->lq_mngr.lock, flags); 3131 spin_lock_irqsave(&priv->lq_mngr.lock, flags);
3132 retry_tid = lq->agg_ctrl.tid_retry; 3132 retry_tid = lq->agg_ctrl.tid_retry;
@@ -3152,13 +3152,13 @@ static void iwl4965_bg_agg_work(struct work_struct *work)
3152#endif /*CONFIG_IWL4965_HT_AGG */ 3152#endif /*CONFIG_IWL4965_HT_AGG */
3153#endif /* CONFIG_IWL4965_HT */ 3153#endif /* CONFIG_IWL4965_HT */
3154 3154
3155int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd, 3155int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd,
3156 u8 sta_id, dma_addr_t txcmd_phys, 3156 u8 sta_id, dma_addr_t txcmd_phys,
3157 struct ieee80211_hdr *hdr, u8 hdr_len, 3157 struct ieee80211_hdr *hdr, u8 hdr_len,
3158 struct ieee80211_tx_control *ctrl, void *sta_in) 3158 struct ieee80211_tx_control *ctrl, void *sta_in)
3159{ 3159{
3160 struct iwl_tx_cmd cmd; 3160 struct iwl4965_tx_cmd cmd;
3161 struct iwl_tx_cmd *tx = (struct iwl_tx_cmd *)&out_cmd->cmd.payload[0]; 3161 struct iwl4965_tx_cmd *tx = (struct iwl4965_tx_cmd *)&out_cmd->cmd.payload[0];
3162 dma_addr_t scratch_phys; 3162 dma_addr_t scratch_phys;
3163 u8 unicast = 0; 3163 u8 unicast = 0;
3164 u8 is_data = 1; 3164 u8 is_data = 1;
@@ -3177,8 +3177,8 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd,
3177 if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) 3177 if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA)
3178 is_data = 0; 3178 is_data = 0;
3179 3179
3180 memcpy(&cmd, &(out_cmd->cmd.tx), sizeof(struct iwl_tx_cmd)); 3180 memcpy(&cmd, &(out_cmd->cmd.tx), sizeof(struct iwl4965_tx_cmd));
3181 memset(tx, 0, sizeof(struct iwl_tx_cmd)); 3181 memset(tx, 0, sizeof(struct iwl4965_tx_cmd));
3182 memcpy(tx->hdr, hdr, hdr_len); 3182 memcpy(tx->hdr, hdr, hdr_len);
3183 3183
3184 tx->len = cmd.len; 3184 tx->len = cmd.len;
@@ -3197,8 +3197,8 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd,
3197 tx->rts_retry_limit = cmd.rts_retry_limit; 3197 tx->rts_retry_limit = cmd.rts_retry_limit;
3198 tx->data_retry_limit = cmd.data_retry_limit; 3198 tx->data_retry_limit = cmd.data_retry_limit;
3199 3199
3200 scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) + 3200 scratch_phys = txcmd_phys + sizeof(struct iwl4965_cmd_header) +
3201 offsetof(struct iwl_tx_cmd, scratch); 3201 offsetof(struct iwl4965_tx_cmd, scratch);
3202 tx->dram_lsb_ptr = cpu_to_le32(scratch_phys); 3202 tx->dram_lsb_ptr = cpu_to_le32(scratch_phys);
3203 tx->dram_msb_ptr = iwl4965_get_dma_hi_address(scratch_phys); 3203 tx->dram_msb_ptr = iwl4965_get_dma_hi_address(scratch_phys);
3204 3204
@@ -3224,7 +3224,7 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd,
3224 tx->tx_flags |= TX_CMD_FLG_STA_RATE_MSK; 3224 tx->tx_flags |= TX_CMD_FLG_STA_RATE_MSK;
3225 } 3225 }
3226 3226
3227 tx->rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[rate_index].plcp, 3227 tx->rate_n_flags = iwl4965_hw_set_rate_n_flags(iwl4965_rates[rate_index].plcp,
3228 rate_flags); 3228 rate_flags);
3229 3229
3230 if (ieee80211_is_back_request(fc)) 3230 if (ieee80211_is_back_request(fc))
@@ -3277,7 +3277,7 @@ static s32 sign_extend(u32 oper, int index)
3277 * 3277 *
3278 * A return of <0 indicates bogus data in the statistics 3278 * A return of <0 indicates bogus data in the statistics
3279 */ 3279 */
3280int iwl4965_get_temperature(const struct iwl_priv *priv) 3280int iwl4965_get_temperature(const struct iwl4965_priv *priv)
3281{ 3281{
3282 s32 temperature; 3282 s32 temperature;
3283 s32 vt; 3283 s32 vt;
@@ -3344,7 +3344,7 @@ int iwl4965_get_temperature(const struct iwl_priv *priv)
3344 * Assumes caller will replace priv->last_temperature once calibration 3344 * Assumes caller will replace priv->last_temperature once calibration
3345 * executed. 3345 * executed.
3346 */ 3346 */
3347static int iwl4965_is_temp_calib_needed(struct iwl_priv *priv) 3347static int iwl4965_is_temp_calib_needed(struct iwl4965_priv *priv)
3348{ 3348{
3349 int temp_diff; 3349 int temp_diff;
3350 3350
@@ -3377,7 +3377,7 @@ static int iwl4965_is_temp_calib_needed(struct iwl_priv *priv)
3377/* Calculate noise level, based on measurements during network silence just 3377/* Calculate noise level, based on measurements during network silence just
3378 * before arriving beacon. This measurement can be done only if we know 3378 * before arriving beacon. This measurement can be done only if we know
3379 * exactly when to expect beacons, therefore only when we're associated. */ 3379 * exactly when to expect beacons, therefore only when we're associated. */
3380static void iwl4965_rx_calc_noise(struct iwl_priv *priv) 3380static void iwl4965_rx_calc_noise(struct iwl4965_priv *priv)
3381{ 3381{
3382 struct statistics_rx_non_phy *rx_info 3382 struct statistics_rx_non_phy *rx_info
3383 = &(priv->statistics.rx.general); 3383 = &(priv->statistics.rx.general);
@@ -3414,9 +3414,9 @@ static void iwl4965_rx_calc_noise(struct iwl_priv *priv)
3414 priv->last_rx_noise); 3414 priv->last_rx_noise);
3415} 3415}
3416 3416
3417void iwl_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) 3417void iwl4965_hw_rx_statistics(struct iwl4965_priv *priv, struct iwl4965_rx_mem_buffer *rxb)
3418{ 3418{
3419 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3419 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3420 int change; 3420 int change;
3421 s32 temp; 3421 s32 temp;
3422 3422
@@ -3478,12 +3478,12 @@ void iwl_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
3478 queue_work(priv->workqueue, &priv->txpower_work); 3478 queue_work(priv->workqueue, &priv->txpower_work);
3479} 3479}
3480 3480
3481static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data, 3481static void iwl4965_handle_data_packet(struct iwl4965_priv *priv, int is_data,
3482 int include_phy, 3482 int include_phy,
3483 struct iwl_rx_mem_buffer *rxb, 3483 struct iwl4965_rx_mem_buffer *rxb,
3484 struct ieee80211_rx_status *stats) 3484 struct ieee80211_rx_status *stats)
3485{ 3485{
3486 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 3486 struct iwl4965_rx_packet *pkt = (struct iwl4965_rx_packet *)rxb->skb->data;
3487 struct iwl4965_rx_phy_res *rx_start = (include_phy) ? 3487 struct iwl4965_rx_phy_res *rx_start = (include_phy) ?
3488 (struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) : NULL; 3488 (struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) : NULL;
3489 struct ieee80211_hdr *hdr; 3489 struct ieee80211_hdr *hdr;
@@ -3540,25 +3540,25 @@ static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data,
3540 } 3540 }
3541 3541
3542 if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { 3542 if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) {
3543 if (iwl_param_hwcrypto) 3543 if (iwl4965_param_hwcrypto)
3544 iwl_set_decrypted_flag(priv, rxb->skb, 3544 iwl4965_set_decrypted_flag(priv, rxb->skb,
3545 ampdu_status, stats); 3545 ampdu_status, stats);
3546 iwl_handle_data_packet_monitor(priv, rxb, hdr, len, stats, 0); 3546 iwl4965_handle_data_packet_monitor(priv, rxb, hdr, len, stats, 0);
3547 return; 3547 return;
3548 } 3548 }
3549 3549
3550 stats->flag = 0; 3550 stats->flag = 0;
3551 hdr = (struct ieee80211_hdr *)rxb->skb->data; 3551 hdr = (struct ieee80211_hdr *)rxb->skb->data;
3552 3552
3553 if (iwl_param_hwcrypto) 3553 if (iwl4965_param_hwcrypto)
3554 iwl_set_decrypted_flag(priv, rxb->skb, ampdu_status, stats); 3554 iwl4965_set_decrypted_flag(priv, rxb->skb, ampdu_status, stats);
3555 3555
3556 ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats); 3556 ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats);
3557 priv->alloc_rxb_skb--; 3557 priv->alloc_rxb_skb--;
3558 rxb->skb = NULL; 3558 rxb->skb = NULL;
3559#ifdef LED 3559#ifdef LED
3560 priv->led_packets += len; 3560 priv->led_packets += len;
3561 iwl_setup_activity_timer(priv); 3561 iwl4965_setup_activity_timer(priv);
3562#endif 3562#endif
3563} 3563}
3564 3564
@@ -3670,7 +3670,7 @@ static int parse_elems(u8 *start, size_t len, struct ieee802_11_elems *elems)
3670} 3670}
3671#endif /* CONFIG_IWL4965_HT */ 3671#endif /* CONFIG_IWL4965_HT */
3672 3672
3673static void iwl4965_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id) 3673static void iwl4965_sta_modify_ps_wake(struct iwl4965_priv *priv, int sta_id)
3674{ 3674{
3675 unsigned long flags; 3675 unsigned long flags;
3676 3676
@@ -3681,13 +3681,13 @@ static void iwl4965_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id)
3681 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 3681 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
3682 spin_unlock_irqrestore(&priv->sta_lock, flags); 3682 spin_unlock_irqrestore(&priv->sta_lock, flags);
3683 3683
3684 iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC); 3684 iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
3685} 3685}
3686 3686
3687static void iwl4965_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr) 3687static void iwl4965_update_ps_mode(struct iwl4965_priv *priv, u16 ps_bit, u8 *addr)
3688{ 3688{
3689 /* FIXME: need locking over ps_status ??? */ 3689 /* FIXME: need locking over ps_status ??? */
3690 u8 sta_id = iwl_hw_find_station(priv, addr); 3690 u8 sta_id = iwl4965_hw_find_station(priv, addr);
3691 3691
3692 if (sta_id != IWL_INVALID_STATION) { 3692 if (sta_id != IWL_INVALID_STATION) {
3693 u8 sta_awake = priv->stations[sta_id]. 3693 u8 sta_awake = priv->stations[sta_id].
@@ -3704,10 +3704,10 @@ static void iwl4965_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr)
3704 3704
3705/* Called for REPLY_4965_RX (legacy ABG frames), or 3705/* Called for REPLY_4965_RX (legacy ABG frames), or
3706 * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */ 3706 * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */
3707static void iwl4965_rx_reply_rx(struct iwl_priv *priv, 3707static void iwl4965_rx_reply_rx(struct iwl4965_priv *priv,
3708 struct iwl_rx_mem_buffer *rxb) 3708 struct iwl4965_rx_mem_buffer *rxb)
3709{ 3709{
3710 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3710 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3711 /* Use phy data (Rx signal strength, etc.) contained within 3711 /* Use phy data (Rx signal strength, etc.) contained within
3712 * this rx packet for legacy frames, 3712 * this rx packet for legacy frames,
3713 * or phy data cached from REPLY_RX_PHY_CMD for HT frames. */ 3713 * or phy data cached from REPLY_RX_PHY_CMD for HT frames. */
@@ -3726,7 +3726,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
3726 (rx_start->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? 3726 (rx_start->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ?
3727 MODE_IEEE80211G : MODE_IEEE80211A, 3727 MODE_IEEE80211G : MODE_IEEE80211A,
3728 .antenna = 0, 3728 .antenna = 0,
3729 .rate = iwl_hw_get_rate(rx_start->rate_n_flags), 3729 .rate = iwl4965_hw_get_rate(rx_start->rate_n_flags),
3730 .flag = 0, 3730 .flag = 0,
3731#ifdef CONFIG_IWL4965_HT_AGG 3731#ifdef CONFIG_IWL4965_HT_AGG
3732 .ordered = 0 3732 .ordered = 0
@@ -3789,32 +3789,32 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
3789 * which are gathered only when associated, and indicate noise 3789 * which are gathered only when associated, and indicate noise
3790 * only for the associated network channel ... 3790 * only for the associated network channel ...
3791 * Ignore these noise values while scanning (other channels) */ 3791 * Ignore these noise values while scanning (other channels) */
3792 if (iwl_is_associated(priv) && 3792 if (iwl4965_is_associated(priv) &&
3793 !test_bit(STATUS_SCANNING, &priv->status)) { 3793 !test_bit(STATUS_SCANNING, &priv->status)) {
3794 stats.noise = priv->last_rx_noise; 3794 stats.noise = priv->last_rx_noise;
3795 stats.signal = iwl_calc_sig_qual(stats.ssi, stats.noise); 3795 stats.signal = iwl4965_calc_sig_qual(stats.ssi, stats.noise);
3796 } else { 3796 } else {
3797 stats.noise = IWL_NOISE_MEAS_NOT_AVAILABLE; 3797 stats.noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
3798 stats.signal = iwl_calc_sig_qual(stats.ssi, 0); 3798 stats.signal = iwl4965_calc_sig_qual(stats.ssi, 0);
3799 } 3799 }
3800 3800
3801 /* Reset beacon noise level if not associated. */ 3801 /* Reset beacon noise level if not associated. */
3802 if (!iwl_is_associated(priv)) 3802 if (!iwl4965_is_associated(priv))
3803 priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE; 3803 priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
3804 3804
3805#ifdef CONFIG_IWL4965_DEBUG 3805#ifdef CONFIG_IWL4965_DEBUG
3806 /* TODO: Parts of iwl_report_frame are broken for 4965 */ 3806 /* TODO: Parts of iwl4965_report_frame are broken for 4965 */
3807 if (iwl_debug_level & (IWL_DL_RX)) 3807 if (iwl4965_debug_level & (IWL_DL_RX))
3808 /* Set "1" to report good data frames in groups of 100 */ 3808 /* Set "1" to report good data frames in groups of 100 */
3809 iwl_report_frame(priv, pkt, header, 1); 3809 iwl4965_report_frame(priv, pkt, header, 1);
3810 3810
3811 if (iwl_debug_level & (IWL_DL_RX | IWL_DL_STATS)) 3811 if (iwl4965_debug_level & (IWL_DL_RX | IWL_DL_STATS))
3812 IWL_DEBUG_RX("Rssi %d, noise %d, qual %d, TSF %lu\n", 3812 IWL_DEBUG_RX("Rssi %d, noise %d, qual %d, TSF %lu\n",
3813 stats.ssi, stats.noise, stats.signal, 3813 stats.ssi, stats.noise, stats.signal,
3814 (long unsigned int)le64_to_cpu(rx_start->timestamp)); 3814 (long unsigned int)le64_to_cpu(rx_start->timestamp));
3815#endif 3815#endif
3816 3816
3817 network_packet = iwl_is_network_packet(priv, header); 3817 network_packet = iwl4965_is_network_packet(priv, header);
3818 if (network_packet) { 3818 if (network_packet) {
3819 priv->last_rx_rssi = stats.ssi; 3819 priv->last_rx_rssi = stats.ssi;
3820 priv->last_beacon_time = priv->ucode_beacon_time; 3820 priv->last_beacon_time = priv->ucode_beacon_time;
@@ -3902,7 +3902,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
3902 3902
3903 case IEEE80211_STYPE_PROBE_REQ: 3903 case IEEE80211_STYPE_PROBE_REQ:
3904 if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && 3904 if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) &&
3905 !iwl_is_associated(priv)) { 3905 !iwl4965_is_associated(priv)) {
3906 DECLARE_MAC_BUF(mac1); 3906 DECLARE_MAC_BUF(mac1);
3907 DECLARE_MAC_BUF(mac2); 3907 DECLARE_MAC_BUF(mac2);
3908 DECLARE_MAC_BUF(mac3); 3908 DECLARE_MAC_BUF(mac3);
@@ -3948,7 +3948,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
3948 print_mac(mac1, header->addr1), 3948 print_mac(mac1, header->addr1),
3949 print_mac(mac2, header->addr2), 3949 print_mac(mac2, header->addr2),
3950 print_mac(mac3, header->addr3)); 3950 print_mac(mac3, header->addr3));
3951 else if (unlikely(is_duplicate_packet(priv, header))) 3951 else if (unlikely(iwl4965_is_duplicate_packet(priv, header)))
3952 IWL_DEBUG_DROP("Dropping (dup): %s, %s, %s\n", 3952 IWL_DEBUG_DROP("Dropping (dup): %s, %s, %s\n",
3953 print_mac(mac1, header->addr1), 3953 print_mac(mac1, header->addr1),
3954 print_mac(mac2, header->addr2), 3954 print_mac(mac2, header->addr2),
@@ -3966,22 +3966,22 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
3966 3966
3967/* Cache phy data (Rx signal strength, etc) for HT frame (REPLY_RX_PHY_CMD). 3967/* Cache phy data (Rx signal strength, etc) for HT frame (REPLY_RX_PHY_CMD).
3968 * This will be used later in iwl4965_rx_reply_rx() for REPLY_RX_MPDU_CMD. */ 3968 * This will be used later in iwl4965_rx_reply_rx() for REPLY_RX_MPDU_CMD. */
3969static void iwl4965_rx_reply_rx_phy(struct iwl_priv *priv, 3969static void iwl4965_rx_reply_rx_phy(struct iwl4965_priv *priv,
3970 struct iwl_rx_mem_buffer *rxb) 3970 struct iwl4965_rx_mem_buffer *rxb)
3971{ 3971{
3972 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3972 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3973 priv->last_phy_res[0] = 1; 3973 priv->last_phy_res[0] = 1;
3974 memcpy(&priv->last_phy_res[1], &(pkt->u.raw[0]), 3974 memcpy(&priv->last_phy_res[1], &(pkt->u.raw[0]),
3975 sizeof(struct iwl4965_rx_phy_res)); 3975 sizeof(struct iwl4965_rx_phy_res));
3976} 3976}
3977 3977
3978static void iwl4965_rx_missed_beacon_notif(struct iwl_priv *priv, 3978static void iwl4965_rx_missed_beacon_notif(struct iwl4965_priv *priv,
3979 struct iwl_rx_mem_buffer *rxb) 3979 struct iwl4965_rx_mem_buffer *rxb)
3980 3980
3981{ 3981{
3982#ifdef CONFIG_IWL4965_SENSITIVITY 3982#ifdef CONFIG_IWL4965_SENSITIVITY
3983 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3983 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
3984 struct iwl_missed_beacon_notif *missed_beacon; 3984 struct iwl4965_missed_beacon_notif *missed_beacon;
3985 3985
3986 missed_beacon = &pkt->u.missed_beacon; 3986 missed_beacon = &pkt->u.missed_beacon;
3987 if (le32_to_cpu(missed_beacon->consequtive_missed_beacons) > 5) { 3987 if (le32_to_cpu(missed_beacon->consequtive_missed_beacons) > 5) {
@@ -4000,7 +4000,7 @@ static void iwl4965_rx_missed_beacon_notif(struct iwl_priv *priv,
4000#ifdef CONFIG_IWL4965_HT 4000#ifdef CONFIG_IWL4965_HT
4001#ifdef CONFIG_IWL4965_HT_AGG 4001#ifdef CONFIG_IWL4965_HT_AGG
4002 4002
4003static void iwl4965_set_tx_status(struct iwl_priv *priv, int txq_id, int idx, 4003static void iwl4965_set_tx_status(struct iwl4965_priv *priv, int txq_id, int idx,
4004 u32 status, u32 retry_count, u32 rate) 4004 u32 status, u32 retry_count, u32 rate)
4005{ 4005{
4006 struct ieee80211_tx_status *tx_status = 4006 struct ieee80211_tx_status *tx_status =
@@ -4012,7 +4012,7 @@ static void iwl4965_set_tx_status(struct iwl_priv *priv, int txq_id, int idx,
4012} 4012}
4013 4013
4014 4014
4015static void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv, 4015static void iwl4965_sta_modify_enable_tid_tx(struct iwl4965_priv *priv,
4016 int sta_id, int tid) 4016 int sta_id, int tid)
4017{ 4017{
4018 unsigned long flags; 4018 unsigned long flags;
@@ -4023,13 +4023,13 @@ static void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv,
4023 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 4023 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
4024 spin_unlock_irqrestore(&priv->sta_lock, flags); 4024 spin_unlock_irqrestore(&priv->sta_lock, flags);
4025 4025
4026 iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC); 4026 iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
4027} 4027}
4028 4028
4029 4029
4030static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv, 4030static int iwl4965_tx_status_reply_compressed_ba(struct iwl4965_priv *priv,
4031 struct iwl_ht_agg *agg, 4031 struct iwl4965_ht_agg *agg,
4032 struct iwl_compressed_ba_resp* 4032 struct iwl4965_compressed_ba_resp*
4033 ba_resp) 4033 ba_resp)
4034 4034
4035{ 4035{
@@ -4079,19 +4079,19 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
4079 return 0; 4079 return 0;
4080} 4080}
4081 4081
4082static inline int iwl_queue_dec_wrap(int index, int n_bd) 4082static inline int iwl4965_queue_dec_wrap(int index, int n_bd)
4083{ 4083{
4084 return (index == 0) ? n_bd - 1 : index - 1; 4084 return (index == 0) ? n_bd - 1 : index - 1;
4085} 4085}
4086 4086
4087static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv, 4087static void iwl4965_rx_reply_compressed_ba(struct iwl4965_priv *priv,
4088 struct iwl_rx_mem_buffer *rxb) 4088 struct iwl4965_rx_mem_buffer *rxb)
4089{ 4089{
4090 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 4090 struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
4091 struct iwl_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba; 4091 struct iwl4965_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba;
4092 int index; 4092 int index;
4093 struct iwl_tx_queue *txq = NULL; 4093 struct iwl4965_tx_queue *txq = NULL;
4094 struct iwl_ht_agg *agg; 4094 struct iwl4965_ht_agg *agg;
4095 u16 ba_resp_scd_flow = le16_to_cpu(ba_resp->scd_flow); 4095 u16 ba_resp_scd_flow = le16_to_cpu(ba_resp->scd_flow);
4096 u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); 4096 u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn);
4097 4097
@@ -4102,7 +4102,7 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv,
4102 4102
4103 txq = &priv->txq[ba_resp_scd_flow]; 4103 txq = &priv->txq[ba_resp_scd_flow];
4104 agg = &priv->stations[ba_resp->sta_id].tid[ba_resp->tid].agg; 4104 agg = &priv->stations[ba_resp->sta_id].tid[ba_resp->tid].agg;
4105 index = iwl_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); 4105 index = iwl4965_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd);
4106 4106
4107 /* TODO: Need to get this copy more safely - now good for debug */ 4107 /* TODO: Need to get this copy more safely - now good for debug */
4108/* 4108/*
@@ -4130,20 +4130,20 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv,
4130 iwl4965_tx_status_reply_compressed_ba(priv, agg, ba_resp); 4130 iwl4965_tx_status_reply_compressed_ba(priv, agg, ba_resp);
4131 /* releases all the TFDs until the SSN */ 4131 /* releases all the TFDs until the SSN */
4132 if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) 4132 if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff))
4133 iwl_tx_queue_reclaim(priv, ba_resp_scd_flow, index); 4133 iwl4965_tx_queue_reclaim(priv, ba_resp_scd_flow, index);
4134 4134
4135} 4135}
4136 4136
4137 4137
4138static void iwl4965_tx_queue_stop_scheduler(struct iwl_priv *priv, u16 txq_id) 4138static void iwl4965_tx_queue_stop_scheduler(struct iwl4965_priv *priv, u16 txq_id)
4139{ 4139{
4140 iwl_write_prph(priv, 4140 iwl4965_write_prph(priv,
4141 KDR_SCD_QUEUE_STATUS_BITS(txq_id), 4141 KDR_SCD_QUEUE_STATUS_BITS(txq_id),
4142 (0 << SCD_QUEUE_STTS_REG_POS_ACTIVE)| 4142 (0 << SCD_QUEUE_STTS_REG_POS_ACTIVE)|
4143 (1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); 4143 (1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
4144} 4144}
4145 4145
4146static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid, 4146static int iwl4965_tx_queue_set_q2ratid(struct iwl4965_priv *priv, u16 ra_tid,
4147 u16 txq_id) 4147 u16 txq_id)
4148{ 4148{
4149 u32 tbl_dw_addr; 4149 u32 tbl_dw_addr;
@@ -4155,14 +4155,14 @@ static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid,
4155 tbl_dw_addr = priv->scd_base_addr + 4155 tbl_dw_addr = priv->scd_base_addr +
4156 SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id); 4156 SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id);
4157 4157
4158 tbl_dw = iwl_read_targ_mem(priv, tbl_dw_addr); 4158 tbl_dw = iwl4965_read_targ_mem(priv, tbl_dw_addr);
4159 4159
4160 if (txq_id & 0x1) 4160 if (txq_id & 0x1)
4161 tbl_dw = (scd_q2ratid << 16) | (tbl_dw & 0x0000FFFF); 4161 tbl_dw = (scd_q2ratid << 16) | (tbl_dw & 0x0000FFFF);
4162 else 4162 else
4163 tbl_dw = scd_q2ratid | (tbl_dw & 0xFFFF0000); 4163 tbl_dw = scd_q2ratid | (tbl_dw & 0xFFFF0000);
4164 4164
4165 iwl_write_targ_mem(priv, tbl_dw_addr, tbl_dw); 4165 iwl4965_write_targ_mem(priv, tbl_dw_addr, tbl_dw);
4166 4166
4167 return 0; 4167 return 0;
4168} 4168}
@@ -4170,7 +4170,7 @@ static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid,
4170/** 4170/**
4171 * txq_id must be greater than IWL_BACK_QUEUE_FIRST_ID 4171 * txq_id must be greater than IWL_BACK_QUEUE_FIRST_ID
4172 */ 4172 */
4173static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, 4173static int iwl4965_tx_queue_agg_enable(struct iwl4965_priv *priv, int txq_id,
4174 int tx_fifo, int sta_id, int tid, 4174 int tx_fifo, int sta_id, int tid,
4175 u16 ssn_idx) 4175 u16 ssn_idx)
4176{ 4176{
@@ -4184,10 +4184,10 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id,
4184 4184
4185 ra_tid = BUILD_RAxTID(sta_id, tid); 4185 ra_tid = BUILD_RAxTID(sta_id, tid);
4186 4186
4187 iwl_sta_modify_enable_tid_tx(priv, sta_id, tid); 4187 iwl4965_sta_modify_enable_tid_tx(priv, sta_id, tid);
4188 4188
4189 spin_lock_irqsave(&priv->lock, flags); 4189 spin_lock_irqsave(&priv->lock, flags);
4190 rc = iwl_grab_nic_access(priv); 4190 rc = iwl4965_grab_nic_access(priv);
4191 if (rc) { 4191 if (rc) {
4192 spin_unlock_irqrestore(&priv->lock, flags); 4192 spin_unlock_irqrestore(&priv->lock, flags);
4193 return rc; 4193 return rc;
@@ -4198,7 +4198,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id,
4198 iwl4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id); 4198 iwl4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id);
4199 4199
4200 4200
4201 iwl_set_bits_prph(priv, KDR_SCD_QUEUECHAIN_SEL, (1<<txq_id)); 4201 iwl4965_set_bits_prph(priv, KDR_SCD_QUEUECHAIN_SEL, (1<<txq_id));
4202 4202
4203 priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); 4203 priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff);
4204 priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); 4204 priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff);
@@ -4206,21 +4206,21 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id,
4206 /* supposes that ssn_idx is valid (!= 0xFFF) */ 4206 /* supposes that ssn_idx is valid (!= 0xFFF) */
4207 iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); 4207 iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx);
4208 4208
4209 iwl_write_targ_mem(priv, 4209 iwl4965_write_targ_mem(priv,
4210 priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(txq_id), 4210 priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(txq_id),
4211 (SCD_WIN_SIZE << SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & 4211 (SCD_WIN_SIZE << SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) &
4212 SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); 4212 SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK);
4213 4213
4214 iwl_write_targ_mem(priv, priv->scd_base_addr + 4214 iwl4965_write_targ_mem(priv, priv->scd_base_addr +
4215 SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32), 4215 SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32),
4216 (SCD_FRAME_LIMIT << SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) 4216 (SCD_FRAME_LIMIT << SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS)
4217 & SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); 4217 & SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK);
4218 4218
4219 iwl_set_bits_prph(priv, KDR_SCD_INTERRUPT_MASK, (1 << txq_id)); 4219 iwl4965_set_bits_prph(priv, KDR_SCD_INTERRUPT_MASK, (1 << txq_id));
4220 4220
4221 iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1); 4221 iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1);
4222 4222
4223 iwl_release_nic_access(priv); 4223 iwl4965_release_nic_access(priv);
4224 spin_unlock_irqrestore(&priv->lock, flags); 4224 spin_unlock_irqrestore(&priv->lock, flags);
4225 4225
4226 return 0; 4226 return 0;
@@ -4229,7 +4229,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id,
4229/** 4229/**
4230 * txq_id must be greater than IWL_BACK_QUEUE_FIRST_ID 4230 * txq_id must be greater than IWL_BACK_QUEUE_FIRST_ID
4231 */ 4231 */
4232static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id, 4232static int iwl4965_tx_queue_agg_disable(struct iwl4965_priv *priv, u16 txq_id,
4233 u16 ssn_idx, u8 tx_fifo) 4233 u16 ssn_idx, u8 tx_fifo)
4234{ 4234{
4235 unsigned long flags; 4235 unsigned long flags;
@@ -4242,7 +4242,7 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id,
4242 } 4242 }
4243 4243
4244 spin_lock_irqsave(&priv->lock, flags); 4244 spin_lock_irqsave(&priv->lock, flags);
4245 rc = iwl_grab_nic_access(priv); 4245 rc = iwl4965_grab_nic_access(priv);
4246 if (rc) { 4246 if (rc) {
4247 spin_unlock_irqrestore(&priv->lock, flags); 4247 spin_unlock_irqrestore(&priv->lock, flags);
4248 return rc; 4248 return rc;
@@ -4250,18 +4250,18 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id,
4250 4250
4251 iwl4965_tx_queue_stop_scheduler(priv, txq_id); 4251 iwl4965_tx_queue_stop_scheduler(priv, txq_id);
4252 4252
4253 iwl_clear_bits_prph(priv, KDR_SCD_QUEUECHAIN_SEL, (1 << txq_id)); 4253 iwl4965_clear_bits_prph(priv, KDR_SCD_QUEUECHAIN_SEL, (1 << txq_id));
4254 4254
4255 priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); 4255 priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff);
4256 priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); 4256 priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff);
4257 /* supposes that ssn_idx is valid (!= 0xFFF) */ 4257 /* supposes that ssn_idx is valid (!= 0xFFF) */
4258 iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); 4258 iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx);
4259 4259
4260 iwl_clear_bits_prph(priv, KDR_SCD_INTERRUPT_MASK, (1 << txq_id)); 4260 iwl4965_clear_bits_prph(priv, KDR_SCD_INTERRUPT_MASK, (1 << txq_id));
4261 iwl4965_txq_ctx_deactivate(priv, txq_id); 4261 iwl4965_txq_ctx_deactivate(priv, txq_id);
4262 iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0); 4262 iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0);
4263 4263
4264 iwl_release_nic_access(priv); 4264 iwl4965_release_nic_access(priv);
4265 spin_unlock_irqrestore(&priv->lock, flags); 4265 spin_unlock_irqrestore(&priv->lock, flags);
4266 4266
4267 return 0; 4267 return 0;
@@ -4272,7 +4272,7 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id,
4272/* 4272/*
4273 * RATE SCALE CODE 4273 * RATE SCALE CODE
4274 */ 4274 */
4275int iwl4965_init_hw_rates(struct iwl_priv *priv, struct ieee80211_rate *rates) 4275int iwl4965_init_hw_rates(struct iwl4965_priv *priv, struct ieee80211_rate *rates)
4276{ 4276{
4277 return 0; 4277 return 0;
4278} 4278}
@@ -4290,10 +4290,10 @@ int iwl4965_init_hw_rates(struct iwl_priv *priv, struct ieee80211_rate *rates)
4290 * rc80211_simple which is what this driver is currently using. 4290 * rc80211_simple which is what this driver is currently using.
4291 * 4291 *
4292 */ 4292 */
4293void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) 4293void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap)
4294{ 4294{
4295 int i, r; 4295 int i, r;
4296 struct iwl_link_quality_cmd link_cmd = { 4296 struct iwl4965_link_quality_cmd link_cmd = {
4297 .reserved1 = 0, 4297 .reserved1 = 0,
4298 }; 4298 };
4299 u16 rate_flags; 4299 u16 rate_flags;
@@ -4315,8 +4315,8 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
4315 rate_flags |= RATE_MCS_ANT_B_MSK; 4315 rate_flags |= RATE_MCS_ANT_B_MSK;
4316 rate_flags &= ~RATE_MCS_ANT_A_MSK; 4316 rate_flags &= ~RATE_MCS_ANT_A_MSK;
4317 link_cmd.rs_table[i].rate_n_flags = 4317 link_cmd.rs_table[i].rate_n_flags =
4318 iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); 4318 iwl4965_hw_set_rate_n_flags(iwl4965_rates[r].plcp, rate_flags);
4319 r = iwl_get_prev_ieee_rate(r); 4319 r = iwl4965_get_prev_ieee_rate(r);
4320 } 4320 }
4321 4321
4322 link_cmd.general_params.single_stream_ant_msk = 2; 4322 link_cmd.general_params.single_stream_ant_msk = 2;
@@ -4327,18 +4327,18 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
4327 /* Update the rate scaling for control frame Tx to AP */ 4327 /* Update the rate scaling for control frame Tx to AP */
4328 link_cmd.sta_id = is_ap ? IWL_AP_ID : IWL4965_BROADCAST_ID; 4328 link_cmd.sta_id = is_ap ? IWL_AP_ID : IWL4965_BROADCAST_ID;
4329 4329
4330 iwl_send_cmd_pdu(priv, REPLY_TX_LINK_QUALITY_CMD, sizeof(link_cmd), 4330 iwl4965_send_cmd_pdu(priv, REPLY_TX_LINK_QUALITY_CMD, sizeof(link_cmd),
4331 &link_cmd); 4331 &link_cmd);
4332} 4332}
4333 4333
4334#ifdef CONFIG_IWL4965_HT 4334#ifdef CONFIG_IWL4965_HT
4335 4335
4336static u8 iwl_is_channel_extension(struct iwl_priv *priv, int phymode, 4336static u8 iwl4965_is_channel_extension(struct iwl4965_priv *priv, int phymode,
4337 u16 channel, u8 extension_chan_offset) 4337 u16 channel, u8 extension_chan_offset)
4338{ 4338{
4339 const struct iwl_channel_info *ch_info; 4339 const struct iwl4965_channel_info *ch_info;
4340 4340
4341 ch_info = iwl_get_channel_info(priv, phymode, channel); 4341 ch_info = iwl4965_get_channel_info(priv, phymode, channel);
4342 if (!is_channel_valid(ch_info)) 4342 if (!is_channel_valid(ch_info))
4343 return 0; 4343 return 0;
4344 4344
@@ -4352,7 +4352,7 @@ static u8 iwl_is_channel_extension(struct iwl_priv *priv, int phymode,
4352 return 0; 4352 return 0;
4353} 4353}
4354 4354
4355static u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv, 4355static u8 iwl4965_is_fat_tx_allowed(struct iwl4965_priv *priv,
4356 const struct sta_ht_info *ht_info) 4356 const struct sta_ht_info *ht_info)
4357{ 4357{
4358 4358
@@ -4368,20 +4368,20 @@ static u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
4368 /* no fat tx allowed on 2.4GHZ */ 4368 /* no fat tx allowed on 2.4GHZ */
4369 if (priv->phymode != MODE_IEEE80211A) 4369 if (priv->phymode != MODE_IEEE80211A)
4370 return 0; 4370 return 0;
4371 return (iwl_is_channel_extension(priv, priv->phymode, 4371 return (iwl4965_is_channel_extension(priv, priv->phymode,
4372 ht_info->control_channel, 4372 ht_info->control_channel,
4373 ht_info->extension_chan_offset)); 4373 ht_info->extension_chan_offset));
4374} 4374}
4375 4375
4376void iwl4965_set_rxon_ht(struct iwl_priv *priv, struct sta_ht_info *ht_info) 4376void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, struct sta_ht_info *ht_info)
4377{ 4377{
4378 struct iwl_rxon_cmd *rxon = &priv->staging_rxon; 4378 struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon;
4379 u32 val; 4379 u32 val;
4380 4380
4381 if (!ht_info->is_ht) 4381 if (!ht_info->is_ht)
4382 return; 4382 return;
4383 4383
4384 if (iwl_is_fat_tx_allowed(priv, ht_info)) 4384 if (iwl4965_is_fat_tx_allowed(priv, ht_info))
4385 rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED_MSK; 4385 rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED_MSK;
4386 else 4386 else
4387 rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED_MSK | 4387 rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED_MSK |
@@ -4430,7 +4430,7 @@ void iwl4965_set_rxon_ht(struct iwl_priv *priv, struct sta_ht_info *ht_info)
4430 return; 4430 return;
4431} 4431}
4432 4432
4433void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index) 4433void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index)
4434{ 4434{
4435 __le32 sta_flags; 4435 __le32 sta_flags;
4436 struct sta_ht_info *ht_info = &priv->current_assoc_ht; 4436 struct sta_ht_info *ht_info = &priv->current_assoc_ht;
@@ -4456,7 +4456,7 @@ void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index)
4456 ht_info->tx_chan_width = IWL_CHANNEL_WIDTH_20MHZ; 4456 ht_info->tx_chan_width = IWL_CHANNEL_WIDTH_20MHZ;
4457 ht_info->chan_width_cap = IWL_CHANNEL_WIDTH_20MHZ; 4457 ht_info->chan_width_cap = IWL_CHANNEL_WIDTH_20MHZ;
4458 4458
4459 if (iwl_is_fat_tx_allowed(priv, ht_info)) { 4459 if (iwl4965_is_fat_tx_allowed(priv, ht_info)) {
4460 sta_flags |= STA_FLG_FAT_EN_MSK; 4460 sta_flags |= STA_FLG_FAT_EN_MSK;
4461 ht_info->chan_width_cap = IWL_CHANNEL_WIDTH_40MHZ; 4461 ht_info->chan_width_cap = IWL_CHANNEL_WIDTH_40MHZ;
4462 if (ht_info->supported_chan_width == IWL_CHANNEL_WIDTH_40MHZ) 4462 if (ht_info->supported_chan_width == IWL_CHANNEL_WIDTH_40MHZ)
@@ -4470,7 +4470,7 @@ void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index)
4470 4470
4471#ifdef CONFIG_IWL4965_HT_AGG 4471#ifdef CONFIG_IWL4965_HT_AGG
4472 4472
4473static void iwl4965_sta_modify_add_ba_tid(struct iwl_priv *priv, 4473static void iwl4965_sta_modify_add_ba_tid(struct iwl4965_priv *priv,
4474 int sta_id, int tid, u16 ssn) 4474 int sta_id, int tid, u16 ssn)
4475{ 4475{
4476 unsigned long flags; 4476 unsigned long flags;
@@ -4483,10 +4483,10 @@ static void iwl4965_sta_modify_add_ba_tid(struct iwl_priv *priv,
4483 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 4483 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
4484 spin_unlock_irqrestore(&priv->sta_lock, flags); 4484 spin_unlock_irqrestore(&priv->sta_lock, flags);
4485 4485
4486 iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC); 4486 iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
4487} 4487}
4488 4488
4489static void iwl4965_sta_modify_del_ba_tid(struct iwl_priv *priv, 4489static void iwl4965_sta_modify_del_ba_tid(struct iwl4965_priv *priv,
4490 int sta_id, int tid) 4490 int sta_id, int tid)
4491{ 4491{
4492 unsigned long flags; 4492 unsigned long flags;
@@ -4498,7 +4498,7 @@ static void iwl4965_sta_modify_del_ba_tid(struct iwl_priv *priv,
4498 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 4498 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
4499 spin_unlock_irqrestore(&priv->sta_lock, flags); 4499 spin_unlock_irqrestore(&priv->sta_lock, flags);
4500 4500
4501 iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC); 4501 iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
4502} 4502}
4503 4503
4504static const u16 default_tid_to_tx_fifo[] = { 4504static const u16 default_tid_to_tx_fifo[] = {
@@ -4521,7 +4521,7 @@ static const u16 default_tid_to_tx_fifo[] = {
4521 IWL_TX_FIFO_AC3 4521 IWL_TX_FIFO_AC3
4522}; 4522};
4523 4523
4524static int iwl_txq_ctx_activate_free(struct iwl_priv *priv) 4524static int iwl4965_txq_ctx_activate_free(struct iwl4965_priv *priv)
4525{ 4525{
4526 int txq_id; 4526 int txq_id;
4527 4527
@@ -4531,17 +4531,17 @@ static int iwl_txq_ctx_activate_free(struct iwl_priv *priv)
4531 return -1; 4531 return -1;
4532} 4532}
4533 4533
4534int iwl_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid, 4534int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid,
4535 u16 *start_seq_num) 4535 u16 *start_seq_num)
4536{ 4536{
4537 4537
4538 struct iwl_priv *priv = hw->priv; 4538 struct iwl4965_priv *priv = hw->priv;
4539 int sta_id; 4539 int sta_id;
4540 int tx_fifo; 4540 int tx_fifo;
4541 int txq_id; 4541 int txq_id;
4542 int ssn = -1; 4542 int ssn = -1;
4543 unsigned long flags; 4543 unsigned long flags;
4544 struct iwl_tid_data *tid_data; 4544 struct iwl4965_tid_data *tid_data;
4545 DECLARE_MAC_BUF(mac); 4545 DECLARE_MAC_BUF(mac);
4546 4546
4547 if (likely(tid < ARRAY_SIZE(default_tid_to_tx_fifo))) 4547 if (likely(tid < ARRAY_SIZE(default_tid_to_tx_fifo)))
@@ -4549,14 +4549,14 @@ int iwl_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid,
4549 else 4549 else
4550 return -EINVAL; 4550 return -EINVAL;
4551 4551
4552 IWL_WARNING("iwl-AGG iwl_mac_ht_tx_agg_start on da=%s" 4552 IWL_WARNING("iwl-AGG iwl4965_mac_ht_tx_agg_start on da=%s"
4553 " tid=%d\n", print_mac(mac, da), tid); 4553 " tid=%d\n", print_mac(mac, da), tid);
4554 4554
4555 sta_id = iwl_hw_find_station(priv, da); 4555 sta_id = iwl4965_hw_find_station(priv, da);
4556 if (sta_id == IWL_INVALID_STATION) 4556 if (sta_id == IWL_INVALID_STATION)
4557 return -ENXIO; 4557 return -ENXIO;
4558 4558
4559 txq_id = iwl_txq_ctx_activate_free(priv); 4559 txq_id = iwl4965_txq_ctx_activate_free(priv);
4560 if (txq_id == -1) 4560 if (txq_id == -1)
4561 return -ENXIO; 4561 return -ENXIO;
4562 4562
@@ -4573,13 +4573,13 @@ int iwl_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid,
4573} 4573}
4574 4574
4575 4575
4576int iwl_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid, 4576int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid,
4577 int generator) 4577 int generator)
4578{ 4578{
4579 4579
4580 struct iwl_priv *priv = hw->priv; 4580 struct iwl4965_priv *priv = hw->priv;
4581 int tx_fifo_id, txq_id, sta_id, ssn = -1; 4581 int tx_fifo_id, txq_id, sta_id, ssn = -1;
4582 struct iwl_tid_data *tid_data; 4582 struct iwl4965_tid_data *tid_data;
4583 int rc; 4583 int rc;
4584 DECLARE_MAC_BUF(mac); 4584 DECLARE_MAC_BUF(mac);
4585 4585
@@ -4593,7 +4593,7 @@ int iwl_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid,
4593 else 4593 else
4594 return -EINVAL; 4594 return -EINVAL;
4595 4595
4596 sta_id = iwl_hw_find_station(priv, da); 4596 sta_id = iwl4965_hw_find_station(priv, da);
4597 4597
4598 if (sta_id == IWL_INVALID_STATION) 4598 if (sta_id == IWL_INVALID_STATION)
4599 return -ENXIO; 4599 return -ENXIO;
@@ -4608,36 +4608,36 @@ int iwl_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid,
4608 return rc; 4608 return rc;
4609 4609
4610 iwl4965_ba_status(priv, tid, BA_STATUS_INITIATOR_DELBA); 4610 iwl4965_ba_status(priv, tid, BA_STATUS_INITIATOR_DELBA);
4611 IWL_DEBUG_INFO("iwl_mac_ht_tx_agg_stop on da=%s tid=%d\n", 4611 IWL_DEBUG_INFO("iwl4965_mac_ht_tx_agg_stop on da=%s tid=%d\n",
4612 print_mac(mac, da), tid); 4612 print_mac(mac, da), tid);
4613 4613
4614 return 0; 4614 return 0;
4615} 4615}
4616 4616
4617int iwl_mac_ht_rx_agg_start(struct ieee80211_hw *hw, u8 *da, 4617int iwl4965_mac_ht_rx_agg_start(struct ieee80211_hw *hw, u8 *da,
4618 u16 tid, u16 start_seq_num) 4618 u16 tid, u16 start_seq_num)
4619{ 4619{
4620 struct iwl_priv *priv = hw->priv; 4620 struct iwl4965_priv *priv = hw->priv;
4621 int sta_id; 4621 int sta_id;
4622 DECLARE_MAC_BUF(mac); 4622 DECLARE_MAC_BUF(mac);
4623 4623
4624 IWL_WARNING("iwl-AGG iwl_mac_ht_rx_agg_start on da=%s" 4624 IWL_WARNING("iwl-AGG iwl4965_mac_ht_rx_agg_start on da=%s"
4625 " tid=%d\n", print_mac(mac, da), tid); 4625 " tid=%d\n", print_mac(mac, da), tid);
4626 sta_id = iwl_hw_find_station(priv, da); 4626 sta_id = iwl4965_hw_find_station(priv, da);
4627 iwl4965_sta_modify_add_ba_tid(priv, sta_id, tid, start_seq_num); 4627 iwl4965_sta_modify_add_ba_tid(priv, sta_id, tid, start_seq_num);
4628 return 0; 4628 return 0;
4629} 4629}
4630 4630
4631int iwl_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da, 4631int iwl4965_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da,
4632 u16 tid, int generator) 4632 u16 tid, int generator)
4633{ 4633{
4634 struct iwl_priv *priv = hw->priv; 4634 struct iwl4965_priv *priv = hw->priv;
4635 int sta_id; 4635 int sta_id;
4636 DECLARE_MAC_BUF(mac); 4636 DECLARE_MAC_BUF(mac);
4637 4637
4638 IWL_WARNING("iwl-AGG iwl_mac_ht_rx_agg_stop on da=%s tid=%d\n", 4638 IWL_WARNING("iwl-AGG iwl4965_mac_ht_rx_agg_stop on da=%s tid=%d\n",
4639 print_mac(mac, da), tid); 4639 print_mac(mac, da), tid);
4640 sta_id = iwl_hw_find_station(priv, da); 4640 sta_id = iwl4965_hw_find_station(priv, da);
4641 iwl4965_sta_modify_del_ba_tid(priv, sta_id, tid); 4641 iwl4965_sta_modify_del_ba_tid(priv, sta_id, tid);
4642 return 0; 4642 return 0;
4643} 4643}
@@ -4646,7 +4646,7 @@ int iwl_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da,
4646#endif /* CONFIG_IWL4965_HT */ 4646#endif /* CONFIG_IWL4965_HT */
4647 4647
4648/* Set up 4965-specific Rx frame reply handlers */ 4648/* Set up 4965-specific Rx frame reply handlers */
4649void iwl_hw_rx_handler_setup(struct iwl_priv *priv) 4649void iwl4965_hw_rx_handler_setup(struct iwl4965_priv *priv)
4650{ 4650{
4651 /* Legacy Rx frames */ 4651 /* Legacy Rx frames */
4652 priv->rx_handlers[REPLY_4965_RX] = iwl4965_rx_reply_rx; 4652 priv->rx_handlers[REPLY_4965_RX] = iwl4965_rx_reply_rx;
@@ -4665,7 +4665,7 @@ void iwl_hw_rx_handler_setup(struct iwl_priv *priv)
4665#endif /* CONFIG_IWL4965_HT */ 4665#endif /* CONFIG_IWL4965_HT */
4666} 4666}
4667 4667
4668void iwl_hw_setup_deferred_work(struct iwl_priv *priv) 4668void iwl4965_hw_setup_deferred_work(struct iwl4965_priv *priv)
4669{ 4669{
4670 INIT_WORK(&priv->txpower_work, iwl4965_bg_txpower_work); 4670 INIT_WORK(&priv->txpower_work, iwl4965_bg_txpower_work);
4671 INIT_WORK(&priv->statistics_work, iwl4965_bg_statistics_work); 4671 INIT_WORK(&priv->statistics_work, iwl4965_bg_statistics_work);
@@ -4682,28 +4682,28 @@ void iwl_hw_setup_deferred_work(struct iwl_priv *priv)
4682 priv->statistics_periodic.function = iwl4965_bg_statistics_periodic; 4682 priv->statistics_periodic.function = iwl4965_bg_statistics_periodic;
4683} 4683}
4684 4684
4685void iwl_hw_cancel_deferred_work(struct iwl_priv *priv) 4685void iwl4965_hw_cancel_deferred_work(struct iwl4965_priv *priv)
4686{ 4686{
4687 del_timer_sync(&priv->statistics_periodic); 4687 del_timer_sync(&priv->statistics_periodic);
4688 4688
4689 cancel_delayed_work(&priv->init_alive_start); 4689 cancel_delayed_work(&priv->init_alive_start);
4690} 4690}
4691 4691
4692struct pci_device_id iwl_hw_card_ids[] = { 4692struct pci_device_id iwl4965_hw_card_ids[] = {
4693 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4229)}, 4693 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4229)},
4694 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4230)}, 4694 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4230)},
4695 {0} 4695 {0}
4696}; 4696};
4697 4697
4698int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv) 4698int iwl4965_eeprom_acquire_semaphore(struct iwl4965_priv *priv)
4699{ 4699{
4700 u16 count; 4700 u16 count;
4701 int rc; 4701 int rc;
4702 4702
4703 for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) { 4703 for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) {
4704 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, 4704 iwl4965_set_bit(priv, CSR_HW_IF_CONFIG_REG,
4705 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); 4705 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
4706 rc = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG, 4706 rc = iwl4965_poll_bit(priv, CSR_HW_IF_CONFIG_REG,
4707 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, 4707 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
4708 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, 4708 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
4709 EEPROM_SEM_TIMEOUT); 4709 EEPROM_SEM_TIMEOUT);
@@ -4717,11 +4717,11 @@ int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv)
4717 return rc; 4717 return rc;
4718} 4718}
4719 4719
4720inline void iwl_eeprom_release_semaphore(struct iwl_priv *priv) 4720inline void iwl4965_eeprom_release_semaphore(struct iwl4965_priv *priv)
4721{ 4721{
4722 iwl_clear_bit(priv, CSR_HW_IF_CONFIG_REG, 4722 iwl4965_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
4723 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); 4723 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
4724} 4724}
4725 4725
4726 4726
4727MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); 4727MODULE_DEVICE_TABLE(pci, iwl4965_hw_card_ids);
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h
index d61cf0e26e81..5944b4b9828b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.h
@@ -30,10 +30,10 @@
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31#include <net/ieee80211_radiotap.h> 31#include <net/ieee80211_radiotap.h>
32 32
33struct iwl_priv; 33struct iwl4965_priv;
34 34
35/* Hardware specific file defines the PCI IDs table for that hardware module */ 35/* Hardware specific file defines the PCI IDs table for that hardware module */
36extern struct pci_device_id iwl_hw_card_ids[]; 36extern struct pci_device_id iwl4965_hw_card_ids[];
37 37
38#define DRV_NAME "iwl4965" 38#define DRV_NAME "iwl4965"
39#include "iwl-4965-hw.h" 39#include "iwl-4965-hw.h"
@@ -54,10 +54,10 @@ extern struct pci_device_id iwl_hw_card_ids[];
54#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127) 54#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127)
55 55
56/* Module parameters accessible from iwl-*.c */ 56/* Module parameters accessible from iwl-*.c */
57extern int iwl_param_hwcrypto; 57extern int iwl4965_param_hwcrypto;
58extern int iwl_param_queues_num; 58extern int iwl4965_param_queues_num;
59 59
60enum iwl_antenna { 60enum iwl4965_antenna {
61 IWL_ANTENNA_DIVERSITY, 61 IWL_ANTENNA_DIVERSITY,
62 IWL_ANTENNA_MAIN, 62 IWL_ANTENNA_MAIN,
63 IWL_ANTENNA_AUX 63 IWL_ANTENNA_AUX
@@ -80,13 +80,13 @@ enum iwl_antenna {
80#define DEFAULT_SHORT_RETRY_LIMIT 7U 80#define DEFAULT_SHORT_RETRY_LIMIT 7U
81#define DEFAULT_LONG_RETRY_LIMIT 4U 81#define DEFAULT_LONG_RETRY_LIMIT 4U
82 82
83struct iwl_rx_mem_buffer { 83struct iwl4965_rx_mem_buffer {
84 dma_addr_t dma_addr; 84 dma_addr_t dma_addr;
85 struct sk_buff *skb; 85 struct sk_buff *skb;
86 struct list_head list; 86 struct list_head list;
87}; 87};
88 88
89struct iwl_rt_rx_hdr { 89struct iwl4965_rt_rx_hdr {
90 struct ieee80211_radiotap_header rt_hdr; 90 struct ieee80211_radiotap_header rt_hdr;
91 __le64 rt_tsf; /* TSF */ 91 __le64 rt_tsf; /* TSF */
92 u8 rt_flags; /* radiotap packet flags */ 92 u8 rt_flags; /* radiotap packet flags */
@@ -99,7 +99,7 @@ struct iwl_rt_rx_hdr {
99 u8 payload[0]; /* payload... */ 99 u8 payload[0]; /* payload... */
100} __attribute__ ((packed)); 100} __attribute__ ((packed));
101 101
102struct iwl_rt_tx_hdr { 102struct iwl4965_rt_tx_hdr {
103 struct ieee80211_radiotap_header rt_hdr; 103 struct ieee80211_radiotap_header rt_hdr;
104 u8 rt_rate; /* rate in 500kb/s */ 104 u8 rt_rate; /* rate in 500kb/s */
105 __le16 rt_channel; /* channel in mHz */ 105 __le16 rt_channel; /* channel in mHz */
@@ -114,7 +114,7 @@ struct iwl_rt_tx_hdr {
114 * 114 *
115 * Contains common data for Rx and Tx queues 115 * Contains common data for Rx and Tx queues
116 */ 116 */
117struct iwl_queue { 117struct iwl4965_queue {
118 int n_bd; /* number of BDs in this queue */ 118 int n_bd; /* number of BDs in this queue */
119 int write_ptr; /* 1-st empty entry (index) host_w*/ 119 int write_ptr; /* 1-st empty entry (index) host_w*/
120 int read_ptr; /* last used entry (index) host_r*/ 120 int read_ptr; /* last used entry (index) host_r*/
@@ -129,24 +129,24 @@ struct iwl_queue {
129 129
130#define MAX_NUM_OF_TBS (20) 130#define MAX_NUM_OF_TBS (20)
131 131
132struct iwl_tx_info { 132struct iwl4965_tx_info {
133 struct ieee80211_tx_status status; 133 struct ieee80211_tx_status status;
134 struct sk_buff *skb[MAX_NUM_OF_TBS]; 134 struct sk_buff *skb[MAX_NUM_OF_TBS];
135}; 135};
136 136
137/** 137/**
138 * struct iwl_tx_queue - Tx Queue for DMA 138 * struct iwl4965_tx_queue - Tx Queue for DMA
139 * @need_update: need to update read/write index 139 * @need_update: need to update read/write index
140 * @shed_retry: queue is HT AGG enabled 140 * @shed_retry: queue is HT AGG enabled
141 * 141 *
142 * Queue consists of circular buffer of BD's and required locking structures. 142 * Queue consists of circular buffer of BD's and required locking structures.
143 */ 143 */
144struct iwl_tx_queue { 144struct iwl4965_tx_queue {
145 struct iwl_queue q; 145 struct iwl4965_queue q;
146 struct iwl_tfd_frame *bd; 146 struct iwl4965_tfd_frame *bd;
147 struct iwl_cmd *cmd; 147 struct iwl4965_cmd *cmd;
148 dma_addr_t dma_addr_cmd; 148 dma_addr_t dma_addr_cmd;
149 struct iwl_tx_info *txb; 149 struct iwl4965_tx_info *txb;
150 int need_update; 150 int need_update;
151 int sched_retry; 151 int sched_retry;
152 int active; 152 int active;
@@ -154,12 +154,12 @@ struct iwl_tx_queue {
154 154
155#define IWL_NUM_SCAN_RATES (2) 155#define IWL_NUM_SCAN_RATES (2)
156 156
157struct iwl_channel_tgd_info { 157struct iwl4965_channel_tgd_info {
158 u8 type; 158 u8 type;
159 s8 max_power; 159 s8 max_power;
160}; 160};
161 161
162struct iwl_channel_tgh_info { 162struct iwl4965_channel_tgh_info {
163 s64 last_radar_time; 163 s64 last_radar_time;
164}; 164};
165 165
@@ -170,8 +170,8 @@ struct iwl_channel_tgh_info {
170 * -- spectrum management 170 * -- spectrum management
171 * -- user preference (e.g. iwconfig) 171 * -- user preference (e.g. iwconfig)
172 * when requested power is set, base power index must also be set. */ 172 * when requested power is set, base power index must also be set. */
173struct iwl_channel_power_info { 173struct iwl4965_channel_power_info {
174 struct iwl_tx_power tpc; /* actual radio and DSP gain settings */ 174 struct iwl4965_tx_power tpc; /* actual radio and DSP gain settings */
175 s8 power_table_index; /* actual (compenst'd) index into gain table */ 175 s8 power_table_index; /* actual (compenst'd) index into gain table */
176 s8 base_power_index; /* gain index for power at factory temp. */ 176 s8 base_power_index; /* gain index for power at factory temp. */
177 s8 requested_power; /* power (dBm) requested for this chnl/rate */ 177 s8 requested_power; /* power (dBm) requested for this chnl/rate */
@@ -179,8 +179,8 @@ struct iwl_channel_power_info {
179 179
180/* current scan Tx power values to use, one for each scan rate for each 180/* current scan Tx power values to use, one for each scan rate for each
181 * channel. */ 181 * channel. */
182struct iwl_scan_power_info { 182struct iwl4965_scan_power_info {
183 struct iwl_tx_power tpc; /* actual radio and DSP gain settings */ 183 struct iwl4965_tx_power tpc; /* actual radio and DSP gain settings */
184 s8 power_table_index; /* actual (compenst'd) index into gain table */ 184 s8 power_table_index; /* actual (compenst'd) index into gain table */
185 s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */ 185 s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */
186}; 186};
@@ -200,11 +200,11 @@ struct iwl_scan_power_info {
200 */ 200 */
201#define IWL4965_MAX_RATE (33) 201#define IWL4965_MAX_RATE (33)
202 202
203struct iwl_channel_info { 203struct iwl4965_channel_info {
204 struct iwl_channel_tgd_info tgd; 204 struct iwl4965_channel_tgd_info tgd;
205 struct iwl_channel_tgh_info tgh; 205 struct iwl4965_channel_tgh_info tgh;
206 struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */ 206 struct iwl4965_eeprom_channel eeprom; /* EEPROM regulatory limit */
207 struct iwl_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for 207 struct iwl4965_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for
208 * FAT channel */ 208 * FAT channel */
209 209
210 u8 channel; /* channel number */ 210 u8 channel; /* channel number */
@@ -221,7 +221,7 @@ struct iwl_channel_info {
221 /* Radio/DSP gain settings for each "normal" data Tx rate. 221 /* Radio/DSP gain settings for each "normal" data Tx rate.
222 * These include, in addition to RF and DSP gain, a few fields for 222 * These include, in addition to RF and DSP gain, a few fields for
223 * remembering/modifying gain settings (indexes). */ 223 * remembering/modifying gain settings (indexes). */
224 struct iwl_channel_power_info power_info[IWL4965_MAX_RATE]; 224 struct iwl4965_channel_power_info power_info[IWL4965_MAX_RATE];
225 225
226 /* FAT channel info */ 226 /* FAT channel info */
227 s8 fat_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */ 227 s8 fat_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */
@@ -232,10 +232,10 @@ struct iwl_channel_info {
232 u8 fat_extension_channel; 232 u8 fat_extension_channel;
233 233
234 /* Radio/DSP gain settings for each scan rate, for directed scans. */ 234 /* Radio/DSP gain settings for each scan rate, for directed scans. */
235 struct iwl_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES]; 235 struct iwl4965_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES];
236}; 236};
237 237
238struct iwl_clip_group { 238struct iwl4965_clip_group {
239 /* maximum power level to prevent clipping for each rate, derived by 239 /* maximum power level to prevent clipping for each rate, derived by
240 * us from this band's saturation power in EEPROM */ 240 * us from this band's saturation power in EEPROM */
241 const s8 clip_powers[IWL_MAX_RATES]; 241 const s8 clip_powers[IWL_MAX_RATES];
@@ -256,8 +256,8 @@ struct iwl_clip_group {
256 256
257/* Power management (not Tx power) structures */ 257/* Power management (not Tx power) structures */
258 258
259struct iwl_power_vec_entry { 259struct iwl4965_power_vec_entry {
260 struct iwl_powertable_cmd cmd; 260 struct iwl4965_powertable_cmd cmd;
261 u8 no_dtim; 261 u8 no_dtim;
262}; 262};
263#define IWL_POWER_RANGE_0 (0) 263#define IWL_POWER_RANGE_0 (0)
@@ -273,10 +273,10 @@ struct iwl_power_vec_entry {
273#define IWL_POWER_ENABLED 0x10 273#define IWL_POWER_ENABLED 0x10
274#define IWL_POWER_LEVEL(x) ((x) & IWL_POWER_MASK) 274#define IWL_POWER_LEVEL(x) ((x) & IWL_POWER_MASK)
275 275
276struct iwl_power_mgr { 276struct iwl4965_power_mgr {
277 spinlock_t lock; 277 spinlock_t lock;
278 struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC]; 278 struct iwl4965_power_vec_entry pwr_range_0[IWL_POWER_AC];
279 struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC]; 279 struct iwl4965_power_vec_entry pwr_range_1[IWL_POWER_AC];
280 u8 active_index; 280 u8 active_index;
281 u32 dtim_val; 281 u32 dtim_val;
282}; 282};
@@ -286,10 +286,10 @@ struct iwl_power_mgr {
286#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) 286#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
287#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) 287#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
288 288
289struct iwl_frame { 289struct iwl4965_frame {
290 union { 290 union {
291 struct ieee80211_hdr frame; 291 struct ieee80211_hdr frame;
292 struct iwl_tx_beacon_cmd beacon; 292 struct iwl4965_tx_beacon_cmd beacon;
293 u8 raw[IEEE80211_FRAME_LEN]; 293 u8 raw[IEEE80211_FRAME_LEN];
294 u8 cmd[360]; 294 u8 cmd[360];
295 } u; 295 } u;
@@ -315,15 +315,15 @@ enum {
315 CMD_WANT_SKB = (1 << 2), 315 CMD_WANT_SKB = (1 << 2),
316}; 316};
317 317
318struct iwl_cmd; 318struct iwl4965_cmd;
319struct iwl_priv; 319struct iwl4965_priv;
320 320
321struct iwl_cmd_meta { 321struct iwl4965_cmd_meta {
322 struct iwl_cmd_meta *source; 322 struct iwl4965_cmd_meta *source;
323 union { 323 union {
324 struct sk_buff *skb; 324 struct sk_buff *skb;
325 int (*callback)(struct iwl_priv *priv, 325 int (*callback)(struct iwl4965_priv *priv,
326 struct iwl_cmd *cmd, struct sk_buff *skb); 326 struct iwl4965_cmd *cmd, struct sk_buff *skb);
327 } __attribute__ ((packed)) u; 327 } __attribute__ ((packed)) u;
328 328
329 /* The CMD_SIZE_HUGE flag bit indicates that the command 329 /* The CMD_SIZE_HUGE flag bit indicates that the command
@@ -332,37 +332,37 @@ struct iwl_cmd_meta {
332 332
333} __attribute__ ((packed)); 333} __attribute__ ((packed));
334 334
335struct iwl_cmd { 335struct iwl4965_cmd {
336 struct iwl_cmd_meta meta; 336 struct iwl4965_cmd_meta meta;
337 struct iwl_cmd_header hdr; 337 struct iwl4965_cmd_header hdr;
338 union { 338 union {
339 struct iwl_addsta_cmd addsta; 339 struct iwl4965_addsta_cmd addsta;
340 struct iwl_led_cmd led; 340 struct iwl4965_led_cmd led;
341 u32 flags; 341 u32 flags;
342 u8 val8; 342 u8 val8;
343 u16 val16; 343 u16 val16;
344 u32 val32; 344 u32 val32;
345 struct iwl_bt_cmd bt; 345 struct iwl4965_bt_cmd bt;
346 struct iwl_rxon_time_cmd rxon_time; 346 struct iwl4965_rxon_time_cmd rxon_time;
347 struct iwl_powertable_cmd powertable; 347 struct iwl4965_powertable_cmd powertable;
348 struct iwl_qosparam_cmd qosparam; 348 struct iwl4965_qosparam_cmd qosparam;
349 struct iwl_tx_cmd tx; 349 struct iwl4965_tx_cmd tx;
350 struct iwl_tx_beacon_cmd tx_beacon; 350 struct iwl4965_tx_beacon_cmd tx_beacon;
351 struct iwl_rxon_assoc_cmd rxon_assoc; 351 struct iwl4965_rxon_assoc_cmd rxon_assoc;
352 u8 *indirect; 352 u8 *indirect;
353 u8 payload[360]; 353 u8 payload[360];
354 } __attribute__ ((packed)) cmd; 354 } __attribute__ ((packed)) cmd;
355} __attribute__ ((packed)); 355} __attribute__ ((packed));
356 356
357struct iwl_host_cmd { 357struct iwl4965_host_cmd {
358 u8 id; 358 u8 id;
359 u16 len; 359 u16 len;
360 struct iwl_cmd_meta meta; 360 struct iwl4965_cmd_meta meta;
361 const void *data; 361 const void *data;
362}; 362};
363 363
364#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \ 364#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl4965_cmd) - \
365 sizeof(struct iwl_cmd_meta)) 365 sizeof(struct iwl4965_cmd_meta))
366 366
367/* 367/*
368 * RX related structures and functions 368 * RX related structures and functions
@@ -375,7 +375,7 @@ struct iwl_host_cmd {
375#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 375#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
376 376
377/** 377/**
378 * struct iwl_rx_queue - Rx queue 378 * struct iwl4965_rx_queue - Rx queue
379 * @processed: Internal index to last handled Rx packet 379 * @processed: Internal index to last handled Rx packet
380 * @read: Shared index to newest available Rx buffer 380 * @read: Shared index to newest available Rx buffer
381 * @write: Shared index to oldest written Rx packet 381 * @write: Shared index to oldest written Rx packet
@@ -384,13 +384,13 @@ struct iwl_host_cmd {
384 * @rx_used: List of Rx buffers with no SKB 384 * @rx_used: List of Rx buffers with no SKB
385 * @need_update: flag to indicate we need to update read/write index 385 * @need_update: flag to indicate we need to update read/write index
386 * 386 *
387 * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers 387 * NOTE: rx_free and rx_used are used as a FIFO for iwl4965_rx_mem_buffers
388 */ 388 */
389struct iwl_rx_queue { 389struct iwl4965_rx_queue {
390 __le32 *bd; 390 __le32 *bd;
391 dma_addr_t dma_addr; 391 dma_addr_t dma_addr;
392 struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; 392 struct iwl4965_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
393 struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE]; 393 struct iwl4965_rx_mem_buffer *queue[RX_QUEUE_SIZE];
394 u32 processed; 394 u32 processed;
395 u32 read; 395 u32 read;
396 u32 write; 396 u32 write;
@@ -436,7 +436,7 @@ struct iwl_rx_queue {
436 436
437#ifdef CONFIG_IWL4965_HT 437#ifdef CONFIG_IWL4965_HT
438#ifdef CONFIG_IWL4965_HT_AGG 438#ifdef CONFIG_IWL4965_HT_AGG
439struct iwl_ht_agg { 439struct iwl4965_ht_agg {
440 u16 txq_id; 440 u16 txq_id;
441 u16 frame_count; 441 u16 frame_count;
442 u16 wait_for_ba; 442 u16 wait_for_ba;
@@ -448,22 +448,22 @@ struct iwl_ht_agg {
448#endif /* CONFIG_IWL4965_HT_AGG */ 448#endif /* CONFIG_IWL4965_HT_AGG */
449#endif /* CONFIG_IWL4965_HT */ 449#endif /* CONFIG_IWL4965_HT */
450 450
451struct iwl_tid_data { 451struct iwl4965_tid_data {
452 u16 seq_number; 452 u16 seq_number;
453#ifdef CONFIG_IWL4965_HT 453#ifdef CONFIG_IWL4965_HT
454#ifdef CONFIG_IWL4965_HT_AGG 454#ifdef CONFIG_IWL4965_HT_AGG
455 struct iwl_ht_agg agg; 455 struct iwl4965_ht_agg agg;
456#endif /* CONFIG_IWL4965_HT_AGG */ 456#endif /* CONFIG_IWL4965_HT_AGG */
457#endif /* CONFIG_IWL4965_HT */ 457#endif /* CONFIG_IWL4965_HT */
458}; 458};
459 459
460struct iwl_hw_key { 460struct iwl4965_hw_key {
461 enum ieee80211_key_alg alg; 461 enum ieee80211_key_alg alg;
462 int keylen; 462 int keylen;
463 u8 key[32]; 463 u8 key[32];
464}; 464};
465 465
466union iwl_ht_rate_supp { 466union iwl4965_ht_rate_supp {
467 u16 rates; 467 u16 rates;
468 struct { 468 struct {
469 u8 siso_rate; 469 u8 siso_rate;
@@ -498,7 +498,7 @@ struct sta_ht_info {
498 498
499#ifdef CONFIG_IWL4965_QOS 499#ifdef CONFIG_IWL4965_QOS
500 500
501union iwl_qos_capabity { 501union iwl4965_qos_capabity {
502 struct { 502 struct {
503 u8 edca_count:4; /* bit 0-3 */ 503 u8 edca_count:4; /* bit 0-3 */
504 u8 q_ack:1; /* bit 4 */ 504 u8 q_ack:1; /* bit 4 */
@@ -519,23 +519,23 @@ union iwl_qos_capabity {
519}; 519};
520 520
521/* QoS structures */ 521/* QoS structures */
522struct iwl_qos_info { 522struct iwl4965_qos_info {
523 int qos_enable; 523 int qos_enable;
524 int qos_active; 524 int qos_active;
525 union iwl_qos_capabity qos_cap; 525 union iwl4965_qos_capabity qos_cap;
526 struct iwl_qosparam_cmd def_qos_parm; 526 struct iwl4965_qosparam_cmd def_qos_parm;
527}; 527};
528#endif /*CONFIG_IWL4965_QOS */ 528#endif /*CONFIG_IWL4965_QOS */
529 529
530#define STA_PS_STATUS_WAKE 0 530#define STA_PS_STATUS_WAKE 0
531#define STA_PS_STATUS_SLEEP 1 531#define STA_PS_STATUS_SLEEP 1
532 532
533struct iwl_station_entry { 533struct iwl4965_station_entry {
534 struct iwl_addsta_cmd sta; 534 struct iwl4965_addsta_cmd sta;
535 struct iwl_tid_data tid[MAX_TID_COUNT]; 535 struct iwl4965_tid_data tid[MAX_TID_COUNT];
536 u8 used; 536 u8 used;
537 u8 ps_status; 537 u8 ps_status;
538 struct iwl_hw_key keyinfo; 538 struct iwl4965_hw_key keyinfo;
539}; 539};
540 540
541/* one for each uCode image (inst/data, boot/init/runtime) */ 541/* one for each uCode image (inst/data, boot/init/runtime) */
@@ -546,7 +546,7 @@ struct fw_desc {
546}; 546};
547 547
548/* uCode file layout */ 548/* uCode file layout */
549struct iwl_ucode { 549struct iwl4965_ucode {
550 __le32 ver; /* major/minor/subminor */ 550 __le32 ver; /* major/minor/subminor */
551 __le32 inst_size; /* bytes of runtime instructions */ 551 __le32 inst_size; /* bytes of runtime instructions */
552 __le32 data_size; /* bytes of runtime data */ 552 __le32 data_size; /* bytes of runtime data */
@@ -558,7 +558,7 @@ struct iwl_ucode {
558 558
559#define IWL_IBSS_MAC_HASH_SIZE 32 559#define IWL_IBSS_MAC_HASH_SIZE 32
560 560
561struct iwl_ibss_seq { 561struct iwl4965_ibss_seq {
562 u8 mac[ETH_ALEN]; 562 u8 mac[ETH_ALEN];
563 u16 seq_num; 563 u16 seq_num;
564 u16 frag_num; 564 u16 frag_num;
@@ -566,7 +566,7 @@ struct iwl_ibss_seq {
566 struct list_head list; 566 struct list_head list;
567}; 567};
568 568
569struct iwl_driver_hw_info { 569struct iwl4965_driver_hw_info {
570 u16 max_txq_num; 570 u16 max_txq_num;
571 u16 ac_queue_count; 571 u16 ac_queue_count;
572 u16 tx_cmd_len; 572 u16 tx_cmd_len;
@@ -592,10 +592,10 @@ struct iwl_driver_hw_info {
592#define HT_SHORT_GI_40MHZ_ONLY (1 << 1) 592#define HT_SHORT_GI_40MHZ_ONLY (1 << 1)
593 593
594 594
595#define IWL_RX_HDR(x) ((struct iwl_rx_frame_hdr *)(\ 595#define IWL_RX_HDR(x) ((struct iwl4965_rx_frame_hdr *)(\
596 x->u.rx_frame.stats.payload + \ 596 x->u.rx_frame.stats.payload + \
597 x->u.rx_frame.stats.phy_count)) 597 x->u.rx_frame.stats.phy_count))
598#define IWL_RX_END(x) ((struct iwl_rx_frame_end *)(\ 598#define IWL_RX_END(x) ((struct iwl4965_rx_frame_end *)(\
599 IWL_RX_HDR(x)->payload + \ 599 IWL_RX_HDR(x)->payload + \
600 le16_to_cpu(IWL_RX_HDR(x)->len))) 600 le16_to_cpu(IWL_RX_HDR(x)->len)))
601#define IWL_RX_STATS(x) (&x->u.rx_frame.stats) 601#define IWL_RX_STATS(x) (&x->u.rx_frame.stats)
@@ -608,63 +608,63 @@ struct iwl_driver_hw_info {
608 * for use by iwl-*.c 608 * for use by iwl-*.c
609 * 609 *
610 *****************************************************************************/ 610 *****************************************************************************/
611struct iwl_addsta_cmd; 611struct iwl4965_addsta_cmd;
612extern int iwl_send_add_station(struct iwl_priv *priv, 612extern int iwl4965_send_add_station(struct iwl4965_priv *priv,
613 struct iwl_addsta_cmd *sta, u8 flags); 613 struct iwl4965_addsta_cmd *sta, u8 flags);
614extern u8 iwl_add_station(struct iwl_priv *priv, const u8 *bssid, 614extern u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *bssid,
615 int is_ap, u8 flags); 615 int is_ap, u8 flags);
616extern int iwl_is_network_packet(struct iwl_priv *priv, 616extern int iwl4965_is_network_packet(struct iwl4965_priv *priv,
617 struct ieee80211_hdr *header); 617 struct ieee80211_hdr *header);
618extern int iwl_power_init_handle(struct iwl_priv *priv); 618extern int iwl4965_power_init_handle(struct iwl4965_priv *priv);
619extern int iwl_eeprom_init(struct iwl_priv *priv); 619extern int iwl4965_eeprom_init(struct iwl4965_priv *priv);
620#ifdef CONFIG_IWL4965_DEBUG 620#ifdef CONFIG_IWL4965_DEBUG
621extern void iwl_report_frame(struct iwl_priv *priv, 621extern void iwl4965_report_frame(struct iwl4965_priv *priv,
622 struct iwl_rx_packet *pkt, 622 struct iwl4965_rx_packet *pkt,
623 struct ieee80211_hdr *header, int group100); 623 struct ieee80211_hdr *header, int group100);
624#else 624#else
625static inline void iwl_report_frame(struct iwl_priv *priv, 625static inline void iwl4965_report_frame(struct iwl4965_priv *priv,
626 struct iwl_rx_packet *pkt, 626 struct iwl4965_rx_packet *pkt,
627 struct ieee80211_hdr *header, 627 struct ieee80211_hdr *header,
628 int group100) {} 628 int group100) {}
629#endif 629#endif
630extern void iwl_handle_data_packet_monitor(struct iwl_priv *priv, 630extern void iwl4965_handle_data_packet_monitor(struct iwl4965_priv *priv,
631 struct iwl_rx_mem_buffer *rxb, 631 struct iwl4965_rx_mem_buffer *rxb,
632 void *data, short len, 632 void *data, short len,
633 struct ieee80211_rx_status *stats, 633 struct ieee80211_rx_status *stats,
634 u16 phy_flags); 634 u16 phy_flags);
635extern int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr 635extern int iwl4965_is_duplicate_packet(struct iwl4965_priv *priv,
636 *header); 636 struct ieee80211_hdr *header);
637extern int iwl_rx_queue_alloc(struct iwl_priv *priv); 637extern int iwl4965_rx_queue_alloc(struct iwl4965_priv *priv);
638extern void iwl_rx_queue_reset(struct iwl_priv *priv, 638extern void iwl4965_rx_queue_reset(struct iwl4965_priv *priv,
639 struct iwl_rx_queue *rxq); 639 struct iwl4965_rx_queue *rxq);
640extern int iwl_calc_db_from_ratio(int sig_ratio); 640extern int iwl4965_calc_db_from_ratio(int sig_ratio);
641extern int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm); 641extern int iwl4965_calc_sig_qual(int rssi_dbm, int noise_dbm);
642extern int iwl_tx_queue_init(struct iwl_priv *priv, 642extern int iwl4965_tx_queue_init(struct iwl4965_priv *priv,
643 struct iwl_tx_queue *txq, int count, u32 id); 643 struct iwl4965_tx_queue *txq, int count, u32 id);
644extern void iwl_rx_replenish(void *data); 644extern void iwl4965_rx_replenish(void *data);
645extern void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq); 645extern void iwl4965_tx_queue_free(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq);
646extern int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, 646extern int iwl4965_send_cmd_pdu(struct iwl4965_priv *priv, u8 id, u16 len,
647 const void *data); 647 const void *data);
648extern int __must_check iwl_send_cmd(struct iwl_priv *priv, 648extern int __must_check iwl4965_send_cmd(struct iwl4965_priv *priv,
649 struct iwl_host_cmd *cmd); 649 struct iwl4965_host_cmd *cmd);
650extern unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, 650extern unsigned int iwl4965_fill_beacon_frame(struct iwl4965_priv *priv,
651 struct ieee80211_hdr *hdr, 651 struct ieee80211_hdr *hdr,
652 const u8 *dest, int left); 652 const u8 *dest, int left);
653extern int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, 653extern int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv,
654 struct iwl_rx_queue *q); 654 struct iwl4965_rx_queue *q);
655extern int iwl_send_statistics_request(struct iwl_priv *priv); 655extern int iwl4965_send_statistics_request(struct iwl4965_priv *priv);
656extern void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, 656extern void iwl4965_set_decrypted_flag(struct iwl4965_priv *priv, struct sk_buff *skb,
657 u32 decrypt_res, 657 u32 decrypt_res,
658 struct ieee80211_rx_status *stats); 658 struct ieee80211_rx_status *stats);
659extern __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr); 659extern __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr);
660 660
661extern const u8 BROADCAST_ADDR[ETH_ALEN]; 661extern const u8 iwl4965_broadcast_addr[ETH_ALEN];
662 662
663/* 663/*
664 * Currently used by iwl-3945-rs... look at restructuring so that it doesn't 664 * Currently used by iwl-3945-rs... look at restructuring so that it doesn't
665 * call this... todo... fix that. 665 * call this... todo... fix that.
666*/ 666*/
667extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id, 667extern u8 iwl4965_sync_station(struct iwl4965_priv *priv, int sta_id,
668 u16 tx_rate, u8 flags); 668 u16 tx_rate, u8 flags);
669 669
670/****************************************************************************** 670/******************************************************************************
@@ -676,112 +676,110 @@ extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id,
676 * which is why they are in the hardware specific files (vs. iwl-base.c) 676 * which is why they are in the hardware specific files (vs. iwl-base.c)
677 * 677 *
678 * Naming convention -- 678 * Naming convention --
679 * iwl_ <-- Its part of iwlwifi (should be changed to iwl_) 679 * iwl4965_ <-- Its part of iwlwifi (should be changed to iwl4965_)
680 * iwl_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) 680 * iwl4965_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW)
681 * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) 681 * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
682 * iwl_bg_ <-- Called from work queue context 682 * iwl4965_bg_ <-- Called from work queue context
683 * iwl_mac_ <-- mac80211 callback 683 * iwl4965_mac_ <-- mac80211 callback
684 * 684 *
685 ****************************************************************************/ 685 ****************************************************************************/
686extern void iwl_hw_rx_handler_setup(struct iwl_priv *priv); 686extern void iwl4965_hw_rx_handler_setup(struct iwl4965_priv *priv);
687extern void iwl_hw_setup_deferred_work(struct iwl_priv *priv); 687extern void iwl4965_hw_setup_deferred_work(struct iwl4965_priv *priv);
688extern void iwl_hw_cancel_deferred_work(struct iwl_priv *priv); 688extern void iwl4965_hw_cancel_deferred_work(struct iwl4965_priv *priv);
689extern int iwl_hw_rxq_stop(struct iwl_priv *priv); 689extern int iwl4965_hw_rxq_stop(struct iwl4965_priv *priv);
690extern int iwl_hw_set_hw_setting(struct iwl_priv *priv); 690extern int iwl4965_hw_set_hw_setting(struct iwl4965_priv *priv);
691extern int iwl_hw_nic_init(struct iwl_priv *priv); 691extern int iwl4965_hw_nic_init(struct iwl4965_priv *priv);
692extern int iwl_hw_nic_stop_master(struct iwl_priv *priv); 692extern int iwl4965_hw_nic_stop_master(struct iwl4965_priv *priv);
693extern void iwl_hw_txq_ctx_free(struct iwl_priv *priv); 693extern void iwl4965_hw_txq_ctx_free(struct iwl4965_priv *priv);
694extern void iwl_hw_txq_ctx_stop(struct iwl_priv *priv); 694extern void iwl4965_hw_txq_ctx_stop(struct iwl4965_priv *priv);
695extern int iwl_hw_nic_reset(struct iwl_priv *priv); 695extern int iwl4965_hw_nic_reset(struct iwl4965_priv *priv);
696extern int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd, 696extern int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl4965_priv *priv, void *tfd,
697 dma_addr_t addr, u16 len); 697 dma_addr_t addr, u16 len);
698extern int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq); 698extern int iwl4965_hw_txq_free_tfd(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq);
699extern int iwl_hw_get_temperature(struct iwl_priv *priv); 699extern int iwl4965_hw_get_temperature(struct iwl4965_priv *priv);
700extern int iwl_hw_tx_queue_init(struct iwl_priv *priv, 700extern int iwl4965_hw_tx_queue_init(struct iwl4965_priv *priv,
701 struct iwl_tx_queue *txq); 701 struct iwl4965_tx_queue *txq);
702extern unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, 702extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl4965_priv *priv,
703 struct iwl_frame *frame, u8 rate); 703 struct iwl4965_frame *frame, u8 rate);
704extern int iwl_hw_get_rx_read(struct iwl_priv *priv); 704extern int iwl4965_hw_get_rx_read(struct iwl4965_priv *priv);
705extern void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, 705extern void iwl4965_hw_build_tx_cmd_rate(struct iwl4965_priv *priv,
706 struct iwl_cmd *cmd, 706 struct iwl4965_cmd *cmd,
707 struct ieee80211_tx_control *ctrl, 707 struct ieee80211_tx_control *ctrl,
708 struct ieee80211_hdr *hdr, 708 struct ieee80211_hdr *hdr,
709 int sta_id, int tx_id); 709 int sta_id, int tx_id);
710extern int iwl_hw_reg_send_txpower(struct iwl_priv *priv); 710extern int iwl4965_hw_reg_send_txpower(struct iwl4965_priv *priv);
711extern int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power); 711extern int iwl4965_hw_reg_set_txpower(struct iwl4965_priv *priv, s8 power);
712extern void iwl_hw_rx_statistics(struct iwl_priv *priv, 712extern void iwl4965_hw_rx_statistics(struct iwl4965_priv *priv,
713 struct iwl_rx_mem_buffer *rxb); 713 struct iwl4965_rx_mem_buffer *rxb);
714extern void iwl_disable_events(struct iwl_priv *priv); 714extern void iwl4965_disable_events(struct iwl4965_priv *priv);
715extern int iwl4965_get_temperature(const struct iwl_priv *priv); 715extern int iwl4965_get_temperature(const struct iwl4965_priv *priv);
716 716
717/** 717/**
718 * iwl_hw_find_station - Find station id for a given BSSID 718 * iwl4965_hw_find_station - Find station id for a given BSSID
719 * @bssid: MAC address of station ID to find 719 * @bssid: MAC address of station ID to find
720 * 720 *
721 * NOTE: This should not be hardware specific but the code has 721 * NOTE: This should not be hardware specific but the code has
722 * not yet been merged into a single common layer for managing the 722 * not yet been merged into a single common layer for managing the
723 * station tables. 723 * station tables.
724 */ 724 */
725extern u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *bssid); 725extern u8 iwl4965_hw_find_station(struct iwl4965_priv *priv, const u8 *bssid);
726 726
727extern int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel); 727extern int iwl4965_hw_channel_switch(struct iwl4965_priv *priv, u16 channel);
728extern int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index); 728extern int iwl4965_tx_queue_reclaim(struct iwl4965_priv *priv, int txq_id, int index);
729 729
730struct iwl_priv; 730struct iwl4965_priv;
731struct sta_ht_info; 731struct sta_ht_info;
732 732
733/* 733/*
734 * Forward declare iwl-4965.c functions for iwl-base.c 734 * Forward declare iwl-4965.c functions for iwl-base.c
735 */ 735 */
736extern int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv); 736extern int iwl4965_eeprom_acquire_semaphore(struct iwl4965_priv *priv);
737extern void iwl_eeprom_release_semaphore(struct iwl_priv *priv); 737extern void iwl4965_eeprom_release_semaphore(struct iwl4965_priv *priv);
738 738
739extern int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv, 739extern int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv,
740 struct iwl_tx_queue *txq, 740 struct iwl4965_tx_queue *txq,
741 u16 byte_cnt); 741 u16 byte_cnt);
742extern void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, 742extern void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr,
743 int is_ap); 743 int is_ap);
744extern void iwl4965_set_rxon_ht(struct iwl_priv *priv, 744extern void iwl4965_set_rxon_ht(struct iwl4965_priv *priv,
745 struct sta_ht_info *ht_info); 745 struct sta_ht_info *ht_info);
746 746
747extern void iwl4965_set_rxon_chain(struct iwl_priv *priv); 747extern void iwl4965_set_rxon_chain(struct iwl4965_priv *priv);
748extern int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd, 748extern int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd,
749 u8 sta_id, dma_addr_t txcmd_phys, 749 u8 sta_id, dma_addr_t txcmd_phys,
750 struct ieee80211_hdr *hdr, u8 hdr_len, 750 struct ieee80211_hdr *hdr, u8 hdr_len,
751 struct ieee80211_tx_control *ctrl, void *sta_in); 751 struct ieee80211_tx_control *ctrl, void *sta_in);
752extern int iwl4965_init_hw_rates(struct iwl_priv *priv, 752extern int iwl4965_alive_notify(struct iwl4965_priv *priv);
753 struct ieee80211_rate *rates); 753extern void iwl4965_update_rate_scaling(struct iwl4965_priv *priv, u8 mode);
754extern int iwl4965_alive_notify(struct iwl_priv *priv); 754extern void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index);
755extern void iwl4965_update_rate_scaling(struct iwl_priv *priv, u8 mode); 755
756extern void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index); 756extern void iwl4965_chain_noise_reset(struct iwl4965_priv *priv);
757 757extern void iwl4965_init_sensitivity(struct iwl4965_priv *priv, u8 flags,
758extern void iwl4965_chain_noise_reset(struct iwl_priv *priv);
759extern void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags,
760 u8 force); 758 u8 force);
761extern int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, 759extern int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv, int phymode,
762 u16 channel, 760 u16 channel,
763 const struct iwl_eeprom_channel *eeprom_ch, 761 const struct iwl4965_eeprom_channel *eeprom_ch,
764 u8 fat_extension_channel); 762 u8 fat_extension_channel);
765extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv); 763extern void iwl4965_rf_kill_ct_config(struct iwl4965_priv *priv);
766 764
767#ifdef CONFIG_IWL4965_HT 765#ifdef CONFIG_IWL4965_HT
768#ifdef CONFIG_IWL4965_HT_AGG 766#ifdef CONFIG_IWL4965_HT_AGG
769extern int iwl_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, 767extern int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da,
770 u16 tid, u16 *start_seq_num); 768 u16 tid, u16 *start_seq_num);
771extern int iwl_mac_ht_rx_agg_start(struct ieee80211_hw *hw, u8 *da, 769extern int iwl4965_mac_ht_rx_agg_start(struct ieee80211_hw *hw, u8 *da,
772 u16 tid, u16 start_seq_num); 770 u16 tid, u16 start_seq_num);
773extern int iwl_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da, 771extern int iwl4965_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da,
774 u16 tid, int generator); 772 u16 tid, int generator);
775extern int iwl_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, 773extern int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da,
776 u16 tid, int generator); 774 u16 tid, int generator);
777extern void iwl4965_turn_off_agg(struct iwl_priv *priv, u8 tid); 775extern void iwl4965_turn_off_agg(struct iwl4965_priv *priv, u8 tid);
778#endif /* CONFIG_IWL4965_HT_AGG */ 776#endif /* CONFIG_IWL4965_HT_AGG */
779#endif /*CONFIG_IWL4965_HT */ 777#endif /*CONFIG_IWL4965_HT */
780/* Structures, enum, and defines specific to the 4965 */ 778/* Structures, enum, and defines specific to the 4965 */
781 779
782#define IWL4965_KW_SIZE 0x1000 /*4k */ 780#define IWL4965_KW_SIZE 0x1000 /*4k */
783 781
784struct iwl_kw { 782struct iwl4965_kw {
785 dma_addr_t dma_addr; 783 dma_addr_t dma_addr;
786 void *v_addr; 784 void *v_addr;
787 size_t size; 785 size_t size;
@@ -835,7 +833,7 @@ struct iwl_kw {
835#define IWL_TX_POWER_CCK_COMPENSATION_B_STEP (9) 833#define IWL_TX_POWER_CCK_COMPENSATION_B_STEP (9)
836#define IWL_TX_POWER_CCK_COMPENSATION_C_STEP (5) 834#define IWL_TX_POWER_CCK_COMPENSATION_C_STEP (5)
837 835
838struct iwl_traffic_load { 836struct iwl4965_traffic_load {
839 unsigned long time_stamp; 837 unsigned long time_stamp;
840 u32 packet_count[TID_QUEUE_MAX_SIZE]; 838 u32 packet_count[TID_QUEUE_MAX_SIZE];
841 u8 queue_count; 839 u8 queue_count;
@@ -844,7 +842,7 @@ struct iwl_traffic_load {
844}; 842};
845 843
846#ifdef CONFIG_IWL4965_HT_AGG 844#ifdef CONFIG_IWL4965_HT_AGG
847struct iwl_agg_control { 845struct iwl4965_agg_control {
848 unsigned long next_retry; 846 unsigned long next_retry;
849 u32 wait_for_agg_status; 847 u32 wait_for_agg_status;
850 u32 tid_retry; 848 u32 tid_retry;
@@ -853,13 +851,13 @@ struct iwl_agg_control {
853 u8 auto_agg; 851 u8 auto_agg;
854 u32 tid_traffic_load_threshold; 852 u32 tid_traffic_load_threshold;
855 u32 ba_timeout; 853 u32 ba_timeout;
856 struct iwl_traffic_load traffic_load[TID_MAX_LOAD_COUNT]; 854 struct iwl4965_traffic_load traffic_load[TID_MAX_LOAD_COUNT];
857}; 855};
858#endif /*CONFIG_IWL4965_HT_AGG */ 856#endif /*CONFIG_IWL4965_HT_AGG */
859 857
860struct iwl_lq_mngr { 858struct iwl4965_lq_mngr {
861#ifdef CONFIG_IWL4965_HT_AGG 859#ifdef CONFIG_IWL4965_HT_AGG
862 struct iwl_agg_control agg_ctrl; 860 struct iwl4965_agg_control agg_ctrl;
863#endif 861#endif
864 spinlock_t lock; 862 spinlock_t lock;
865 s32 max_window_size; 863 s32 max_window_size;
@@ -940,24 +938,24 @@ struct iwl_lq_mngr {
940#define IN_BAND_FILTER 0xFF 938#define IN_BAND_FILTER 0xFF
941#define MIN_AVERAGE_NOISE_MAX_VALUE 0xFFFFFFFF 939#define MIN_AVERAGE_NOISE_MAX_VALUE 0xFFFFFFFF
942 940
943enum iwl_false_alarm_state { 941enum iwl4965_false_alarm_state {
944 IWL_FA_TOO_MANY = 0, 942 IWL_FA_TOO_MANY = 0,
945 IWL_FA_TOO_FEW = 1, 943 IWL_FA_TOO_FEW = 1,
946 IWL_FA_GOOD_RANGE = 2, 944 IWL_FA_GOOD_RANGE = 2,
947}; 945};
948 946
949enum iwl_chain_noise_state { 947enum iwl4965_chain_noise_state {
950 IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */ 948 IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */
951 IWL_CHAIN_NOISE_ACCUMULATE = 1, 949 IWL_CHAIN_NOISE_ACCUMULATE = 1,
952 IWL_CHAIN_NOISE_CALIBRATED = 2, 950 IWL_CHAIN_NOISE_CALIBRATED = 2,
953}; 951};
954 952
955enum iwl_sensitivity_state { 953enum iwl4965_sensitivity_state {
956 IWL_SENS_CALIB_ALLOWED = 0, 954 IWL_SENS_CALIB_ALLOWED = 0,
957 IWL_SENS_CALIB_NEED_REINIT = 1, 955 IWL_SENS_CALIB_NEED_REINIT = 1,
958}; 956};
959 957
960enum iwl_calib_enabled_state { 958enum iwl4965_calib_enabled_state {
961 IWL_CALIB_DISABLED = 0, /* must be 0 */ 959 IWL_CALIB_DISABLED = 0, /* must be 0 */
962 IWL_CALIB_ENABLED = 1, 960 IWL_CALIB_ENABLED = 1,
963}; 961};
@@ -972,7 +970,7 @@ struct statistics_general_data {
972}; 970};
973 971
974/* Sensitivity calib data */ 972/* Sensitivity calib data */
975struct iwl_sensitivity_data { 973struct iwl4965_sensitivity_data {
976 u32 auto_corr_ofdm; 974 u32 auto_corr_ofdm;
977 u32 auto_corr_ofdm_mrc; 975 u32 auto_corr_ofdm_mrc;
978 u32 auto_corr_ofdm_x1; 976 u32 auto_corr_ofdm_x1;
@@ -1001,7 +999,7 @@ struct iwl_sensitivity_data {
1001}; 999};
1002 1000
1003/* Chain noise (differential Rx gain) calib data */ 1001/* Chain noise (differential Rx gain) calib data */
1004struct iwl_chain_noise_data { 1002struct iwl4965_chain_noise_data {
1005 u8 state; 1003 u8 state;
1006 u16 beacon_count; 1004 u16 beacon_count;
1007 u32 chain_noise_a; 1005 u32 chain_noise_a;
@@ -1049,7 +1047,7 @@ enum {
1049 1047
1050#endif 1048#endif
1051 1049
1052struct iwl_priv { 1050struct iwl4965_priv {
1053 1051
1054 /* ieee device used by generic ieee processing code */ 1052 /* ieee device used by generic ieee processing code */
1055 struct ieee80211_hw *hw; 1053 struct ieee80211_hw *hw;
@@ -1063,27 +1061,27 @@ struct iwl_priv {
1063 u8 phymode; 1061 u8 phymode;
1064 int alloc_rxb_skb; 1062 int alloc_rxb_skb;
1065 1063
1066 void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, 1064 void (*rx_handlers[REPLY_MAX])(struct iwl4965_priv *priv,
1067 struct iwl_rx_mem_buffer *rxb); 1065 struct iwl4965_rx_mem_buffer *rxb);
1068 1066
1069 const struct ieee80211_hw_mode *modes; 1067 const struct ieee80211_hw_mode *modes;
1070 1068
1071#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 1069#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT
1072 /* spectrum measurement report caching */ 1070 /* spectrum measurement report caching */
1073 struct iwl_spectrum_notification measure_report; 1071 struct iwl4965_spectrum_notification measure_report;
1074 u8 measurement_status; 1072 u8 measurement_status;
1075#endif 1073#endif
1076 /* ucode beacon time */ 1074 /* ucode beacon time */
1077 u32 ucode_beacon_time; 1075 u32 ucode_beacon_time;
1078 1076
1079 /* we allocate array of iwl_channel_info for NIC's valid channels. 1077 /* we allocate array of iwl4965_channel_info for NIC's valid channels.
1080 * Access via channel # using indirect index array */ 1078 * Access via channel # using indirect index array */
1081 struct iwl_channel_info *channel_info; /* channel info array */ 1079 struct iwl4965_channel_info *channel_info; /* channel info array */
1082 u8 channel_count; /* # of channels */ 1080 u8 channel_count; /* # of channels */
1083 1081
1084 /* each calibration channel group in the EEPROM has a derived 1082 /* each calibration channel group in the EEPROM has a derived
1085 * clip setting for each rate. */ 1083 * clip setting for each rate. */
1086 const struct iwl_clip_group clip_groups[5]; 1084 const struct iwl4965_clip_group clip_groups[5];
1087 1085
1088 /* thermal calibration */ 1086 /* thermal calibration */
1089 s32 temperature; /* degrees Kelvin */ 1087 s32 temperature; /* degrees Kelvin */
@@ -1098,7 +1096,7 @@ struct iwl_priv {
1098 int one_direct_scan; 1096 int one_direct_scan;
1099 u8 direct_ssid_len; 1097 u8 direct_ssid_len;
1100 u8 direct_ssid[IW_ESSID_MAX_SIZE]; 1098 u8 direct_ssid[IW_ESSID_MAX_SIZE];
1101 struct iwl_scan_cmd *scan; 1099 struct iwl4965_scan_cmd *scan;
1102 u8 only_active_channel; 1100 u8 only_active_channel;
1103 1101
1104 /* spinlock */ 1102 /* spinlock */
@@ -1121,26 +1119,26 @@ struct iwl_priv {
1121 struct fw_desc ucode_boot; /* bootstrap inst */ 1119 struct fw_desc ucode_boot; /* bootstrap inst */
1122 1120
1123 1121
1124 struct iwl_rxon_time_cmd rxon_timing; 1122 struct iwl4965_rxon_time_cmd rxon_timing;
1125 1123
1126 /* We declare this const so it can only be 1124 /* We declare this const so it can only be
1127 * changed via explicit cast within the 1125 * changed via explicit cast within the
1128 * routines that actually update the physical 1126 * routines that actually update the physical
1129 * hardware */ 1127 * hardware */
1130 const struct iwl_rxon_cmd active_rxon; 1128 const struct iwl4965_rxon_cmd active_rxon;
1131 struct iwl_rxon_cmd staging_rxon; 1129 struct iwl4965_rxon_cmd staging_rxon;
1132 1130
1133 int error_recovering; 1131 int error_recovering;
1134 struct iwl_rxon_cmd recovery_rxon; 1132 struct iwl4965_rxon_cmd recovery_rxon;
1135 1133
1136 /* 1st responses from initialize and runtime uCode images. 1134 /* 1st responses from initialize and runtime uCode images.
1137 * 4965's initialize alive response contains some calibration data. */ 1135 * 4965's initialize alive response contains some calibration data. */
1138 struct iwl_init_alive_resp card_alive_init; 1136 struct iwl4965_init_alive_resp card_alive_init;
1139 struct iwl_alive_resp card_alive; 1137 struct iwl4965_alive_resp card_alive;
1140 1138
1141#ifdef LED 1139#ifdef LED
1142 /* LED related variables */ 1140 /* LED related variables */
1143 struct iwl_activity_blink activity; 1141 struct iwl4965_activity_blink activity;
1144 unsigned long led_packets; 1142 unsigned long led_packets;
1145 int led_state; 1143 int led_state;
1146#endif 1144#endif
@@ -1158,8 +1156,8 @@ struct iwl_priv {
1158 u8 current_channel_width; 1156 u8 current_channel_width;
1159 u8 valid_antenna; /* Bit mask of antennas actually connected */ 1157 u8 valid_antenna; /* Bit mask of antennas actually connected */
1160#ifdef CONFIG_IWL4965_SENSITIVITY 1158#ifdef CONFIG_IWL4965_SENSITIVITY
1161 struct iwl_sensitivity_data sensitivity_data; 1159 struct iwl4965_sensitivity_data sensitivity_data;
1162 struct iwl_chain_noise_data chain_noise_data; 1160 struct iwl4965_chain_noise_data chain_noise_data;
1163 u8 start_calib; 1161 u8 start_calib;
1164 __le16 sensitivity_tbl[HD_TABLE_SIZE]; 1162 __le16 sensitivity_tbl[HD_TABLE_SIZE];
1165#endif /*CONFIG_IWL4965_SENSITIVITY*/ 1163#endif /*CONFIG_IWL4965_SENSITIVITY*/
@@ -1171,7 +1169,7 @@ struct iwl_priv {
1171 u8 last_phy_res[100]; 1169 u8 last_phy_res[100];
1172 1170
1173 /* Rate scaling data */ 1171 /* Rate scaling data */
1174 struct iwl_lq_mngr lq_mngr; 1172 struct iwl4965_lq_mngr lq_mngr;
1175 1173
1176 /* Rate scaling data */ 1174 /* Rate scaling data */
1177 s8 data_retry_limit; 1175 s8 data_retry_limit;
@@ -1182,10 +1180,10 @@ struct iwl_priv {
1182 int activity_timer_active; 1180 int activity_timer_active;
1183 1181
1184 /* Rx and Tx DMA processing queues */ 1182 /* Rx and Tx DMA processing queues */
1185 struct iwl_rx_queue rxq; 1183 struct iwl4965_rx_queue rxq;
1186 struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES]; 1184 struct iwl4965_tx_queue txq[IWL_MAX_NUM_QUEUES];
1187 unsigned long txq_ctx_active_msk; 1185 unsigned long txq_ctx_active_msk;
1188 struct iwl_kw kw; /* keep warm address */ 1186 struct iwl4965_kw kw; /* keep warm address */
1189 u32 scd_base_addr; /* scheduler sram base address */ 1187 u32 scd_base_addr; /* scheduler sram base address */
1190 1188
1191 unsigned long status; 1189 unsigned long status;
@@ -1194,9 +1192,9 @@ struct iwl_priv {
1194 int last_rx_rssi; /* From Rx packet statisitics */ 1192 int last_rx_rssi; /* From Rx packet statisitics */
1195 int last_rx_noise; /* From beacon statistics */ 1193 int last_rx_noise; /* From beacon statistics */
1196 1194
1197 struct iwl_power_mgr power_data; 1195 struct iwl4965_power_mgr power_data;
1198 1196
1199 struct iwl_notif_statistics statistics; 1197 struct iwl4965_notif_statistics statistics;
1200 unsigned long last_statistics_time; 1198 unsigned long last_statistics_time;
1201 1199
1202 /* context information */ 1200 /* context information */
@@ -1213,7 +1211,7 @@ struct iwl_priv {
1213 /*station table variables */ 1211 /*station table variables */
1214 spinlock_t sta_lock; 1212 spinlock_t sta_lock;
1215 int num_stations; 1213 int num_stations;
1216 struct iwl_station_entry stations[IWL_STATION_COUNT]; 1214 struct iwl4965_station_entry stations[IWL_STATION_COUNT];
1217 1215
1218 /* Indication if ieee80211_ops->open has been called */ 1216 /* Indication if ieee80211_ops->open has been called */
1219 int is_open; 1217 int is_open;
@@ -1234,7 +1232,7 @@ struct iwl_priv {
1234 struct list_head ibss_mac_hash[IWL_IBSS_MAC_HASH_SIZE]; 1232 struct list_head ibss_mac_hash[IWL_IBSS_MAC_HASH_SIZE];
1235 1233
1236 /* eeprom */ 1234 /* eeprom */
1237 struct iwl_eeprom eeprom; 1235 struct iwl4965_eeprom eeprom;
1238 1236
1239 int iw_mode; 1237 int iw_mode;
1240 1238
@@ -1244,7 +1242,7 @@ struct iwl_priv {
1244 u32 timestamp0; 1242 u32 timestamp0;
1245 u32 timestamp1; 1243 u32 timestamp1;
1246 u16 beacon_int; 1244 u16 beacon_int;
1247 struct iwl_driver_hw_info hw_setting; 1245 struct iwl4965_driver_hw_info hw_setting;
1248 int interface_id; 1246 int interface_id;
1249 1247
1250 /* Current association information needed to configure the 1248 /* Current association information needed to configure the
@@ -1254,7 +1252,7 @@ struct iwl_priv {
1254 u8 ps_mode; 1252 u8 ps_mode;
1255 1253
1256#ifdef CONFIG_IWL4965_QOS 1254#ifdef CONFIG_IWL4965_QOS
1257 struct iwl_qos_info qos_data; 1255 struct iwl4965_qos_info qos_data;
1258#endif /*CONFIG_IWL4965_QOS */ 1256#endif /*CONFIG_IWL4965_QOS */
1259 1257
1260 struct workqueue_struct *workqueue; 1258 struct workqueue_struct *workqueue;
@@ -1306,55 +1304,55 @@ struct iwl_priv {
1306#ifdef CONFIG_IWL4965_HT_AGG 1304#ifdef CONFIG_IWL4965_HT_AGG
1307 struct work_struct agg_work; 1305 struct work_struct agg_work;
1308#endif 1306#endif
1309}; /*iwl_priv */ 1307}; /*iwl4965_priv */
1310 1308
1311static inline int iwl_is_associated(struct iwl_priv *priv) 1309static inline int iwl4965_is_associated(struct iwl4965_priv *priv)
1312{ 1310{
1313 return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; 1311 return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
1314} 1312}
1315 1313
1316static inline int is_channel_valid(const struct iwl_channel_info *ch_info) 1314static inline int is_channel_valid(const struct iwl4965_channel_info *ch_info)
1317{ 1315{
1318 if (ch_info == NULL) 1316 if (ch_info == NULL)
1319 return 0; 1317 return 0;
1320 return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0; 1318 return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0;
1321} 1319}
1322 1320
1323static inline int is_channel_narrow(const struct iwl_channel_info *ch_info) 1321static inline int is_channel_narrow(const struct iwl4965_channel_info *ch_info)
1324{ 1322{
1325 return (ch_info->flags & EEPROM_CHANNEL_NARROW) ? 1 : 0; 1323 return (ch_info->flags & EEPROM_CHANNEL_NARROW) ? 1 : 0;
1326} 1324}
1327 1325
1328static inline int is_channel_radar(const struct iwl_channel_info *ch_info) 1326static inline int is_channel_radar(const struct iwl4965_channel_info *ch_info)
1329{ 1327{
1330 return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0; 1328 return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0;
1331} 1329}
1332 1330
1333static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info) 1331static inline u8 is_channel_a_band(const struct iwl4965_channel_info *ch_info)
1334{ 1332{
1335 return ch_info->phymode == MODE_IEEE80211A; 1333 return ch_info->phymode == MODE_IEEE80211A;
1336} 1334}
1337 1335
1338static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info) 1336static inline u8 is_channel_bg_band(const struct iwl4965_channel_info *ch_info)
1339{ 1337{
1340 return ((ch_info->phymode == MODE_IEEE80211B) || 1338 return ((ch_info->phymode == MODE_IEEE80211B) ||
1341 (ch_info->phymode == MODE_IEEE80211G)); 1339 (ch_info->phymode == MODE_IEEE80211G));
1342} 1340}
1343 1341
1344static inline int is_channel_passive(const struct iwl_channel_info *ch) 1342static inline int is_channel_passive(const struct iwl4965_channel_info *ch)
1345{ 1343{
1346 return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0; 1344 return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0;
1347} 1345}
1348 1346
1349static inline int is_channel_ibss(const struct iwl_channel_info *ch) 1347static inline int is_channel_ibss(const struct iwl4965_channel_info *ch)
1350{ 1348{
1351 return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; 1349 return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
1352} 1350}
1353 1351
1354extern const struct iwl_channel_info *iwl_get_channel_info( 1352extern const struct iwl4965_channel_info *iwl4965_get_channel_info(
1355 const struct iwl_priv *priv, int phymode, u16 channel); 1353 const struct iwl4965_priv *priv, int phymode, u16 channel);
1356 1354
1357/* Requires full declaration of iwl_priv before including */ 1355/* Requires full declaration of iwl4965_priv before including */
1358#include "iwl-4965-io.h" 1356#include "iwl-4965-io.h"
1359 1357
1360#endif /* __iwl_4965_h__ */ 1358#endif /* __iwl4965_4965_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index e0f6f03a920f..e14e1333535f 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -60,11 +60,11 @@
60#include "iwl-helpers.h" 60#include "iwl-helpers.h"
61 61
62#ifdef CONFIG_IWL3945_DEBUG 62#ifdef CONFIG_IWL3945_DEBUG
63u32 iwl_debug_level; 63u32 iwl3945_debug_level;
64#endif 64#endif
65 65
66static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, 66static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv,
67 struct iwl_tx_queue *txq); 67 struct iwl3945_tx_queue *txq);
68 68
69/****************************************************************************** 69/******************************************************************************
70 * 70 *
@@ -73,13 +73,13 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv,
73 ******************************************************************************/ 73 ******************************************************************************/
74 74
75/* module parameters */ 75/* module parameters */
76static int iwl_param_disable_hw_scan; 76static int iwl3945_param_disable_hw_scan;
77static int iwl_param_debug; 77static int iwl3945_param_debug;
78static int iwl_param_disable; /* def: enable radio */ 78static int iwl3945_param_disable; /* def: enable radio */
79static int iwl_param_antenna; /* def: 0 = both antennas (use diversity) */ 79static int iwl3945_param_antenna; /* def: 0 = both antennas (use diversity) */
80int iwl_param_hwcrypto; /* def: using software encryption */ 80int iwl3945_param_hwcrypto; /* def: using software encryption */
81static int iwl_param_qos_enable = 1; 81static int iwl3945_param_qos_enable = 1;
82int iwl_param_queues_num = IWL_MAX_NUM_QUEUES; 82int iwl3945_param_queues_num = IWL_MAX_NUM_QUEUES;
83 83
84/* 84/*
85 * module name, copyright, version, etc. 85 * module name, copyright, version, etc.
@@ -126,8 +126,8 @@ static __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr)
126 return NULL; 126 return NULL;
127} 127}
128 128
129static const struct ieee80211_hw_mode *iwl_get_hw_mode( 129static const struct ieee80211_hw_mode *iwl3945_get_hw_mode(
130 struct iwl_priv *priv, int mode) 130 struct iwl3945_priv *priv, int mode)
131{ 131{
132 int i; 132 int i;
133 133
@@ -138,7 +138,7 @@ static const struct ieee80211_hw_mode *iwl_get_hw_mode(
138 return NULL; 138 return NULL;
139} 139}
140 140
141static int iwl_is_empty_essid(const char *essid, int essid_len) 141static int iwl3945_is_empty_essid(const char *essid, int essid_len)
142{ 142{
143 /* Single white space is for Linksys APs */ 143 /* Single white space is for Linksys APs */
144 if (essid_len == 1 && essid[0] == ' ') 144 if (essid_len == 1 && essid[0] == ' ')
@@ -154,13 +154,13 @@ static int iwl_is_empty_essid(const char *essid, int essid_len)
154 return 1; 154 return 1;
155} 155}
156 156
157static const char *iwl_escape_essid(const char *essid, u8 essid_len) 157static const char *iwl3945_escape_essid(const char *essid, u8 essid_len)
158{ 158{
159 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; 159 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
160 const char *s = essid; 160 const char *s = essid;
161 char *d = escaped; 161 char *d = escaped;
162 162
163 if (iwl_is_empty_essid(essid, essid_len)) { 163 if (iwl3945_is_empty_essid(essid, essid_len)) {
164 memcpy(escaped, "<hidden>", sizeof("<hidden>")); 164 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
165 return escaped; 165 return escaped;
166 } 166 }
@@ -178,10 +178,10 @@ static const char *iwl_escape_essid(const char *essid, u8 essid_len)
178 return escaped; 178 return escaped;
179} 179}
180 180
181static void iwl_print_hex_dump(int level, void *p, u32 len) 181static void iwl3945_print_hex_dump(int level, void *p, u32 len)
182{ 182{
183#ifdef CONFIG_IWL3945_DEBUG 183#ifdef CONFIG_IWL3945_DEBUG
184 if (!(iwl_debug_level & level)) 184 if (!(iwl3945_debug_level & level))
185 return; 185 return;
186 186
187 print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1, 187 print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1,
@@ -207,7 +207,7 @@ static void iwl_print_hex_dump(int level, void *p, u32 len)
207 * and four transmit queues for data. 207 * and four transmit queues for data.
208 ***************************************************/ 208 ***************************************************/
209 209
210static int iwl_queue_space(const struct iwl_queue *q) 210static int iwl3945_queue_space(const struct iwl3945_queue *q)
211{ 211{
212 int s = q->read_ptr - q->write_ptr; 212 int s = q->read_ptr - q->write_ptr;
213 213
@@ -224,25 +224,25 @@ static int iwl_queue_space(const struct iwl_queue *q)
224} 224}
225 225
226/* XXX: n_bd must be power-of-two size */ 226/* XXX: n_bd must be power-of-two size */
227static inline int iwl_queue_inc_wrap(int index, int n_bd) 227static inline int iwl3945_queue_inc_wrap(int index, int n_bd)
228{ 228{
229 return ++index & (n_bd - 1); 229 return ++index & (n_bd - 1);
230} 230}
231 231
232/* XXX: n_bd must be power-of-two size */ 232/* XXX: n_bd must be power-of-two size */
233static inline int iwl_queue_dec_wrap(int index, int n_bd) 233static inline int iwl3945_queue_dec_wrap(int index, int n_bd)
234{ 234{
235 return --index & (n_bd - 1); 235 return --index & (n_bd - 1);
236} 236}
237 237
238static inline int x2_queue_used(const struct iwl_queue *q, int i) 238static inline int x2_queue_used(const struct iwl3945_queue *q, int i)
239{ 239{
240 return q->write_ptr > q->read_ptr ? 240 return q->write_ptr > q->read_ptr ?
241 (i >= q->read_ptr && i < q->write_ptr) : 241 (i >= q->read_ptr && i < q->write_ptr) :
242 !(i < q->read_ptr && i >= q->write_ptr); 242 !(i < q->read_ptr && i >= q->write_ptr);
243} 243}
244 244
245static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) 245static inline u8 get_cmd_index(struct iwl3945_queue *q, u32 index, int is_huge)
246{ 246{
247 if (is_huge) 247 if (is_huge)
248 return q->n_window; 248 return q->n_window;
@@ -250,15 +250,15 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge)
250 return index & (q->n_window - 1); 250 return index & (q->n_window - 1);
251} 251}
252 252
253static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, 253static int iwl3945_queue_init(struct iwl3945_priv *priv, struct iwl3945_queue *q,
254 int count, int slots_num, u32 id) 254 int count, int slots_num, u32 id)
255{ 255{
256 q->n_bd = count; 256 q->n_bd = count;
257 q->n_window = slots_num; 257 q->n_window = slots_num;
258 q->id = id; 258 q->id = id;
259 259
260 /* count must be power-of-two size, otherwise iwl_queue_inc_wrap 260 /* count must be power-of-two size, otherwise iwl3945_queue_inc_wrap
261 * and iwl_queue_dec_wrap are broken. */ 261 * and iwl3945_queue_dec_wrap are broken. */
262 BUG_ON(!is_power_of_2(count)); 262 BUG_ON(!is_power_of_2(count));
263 263
264 /* slots_num must be power-of-two size, otherwise 264 /* slots_num must be power-of-two size, otherwise
@@ -278,8 +278,8 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
278 return 0; 278 return 0;
279} 279}
280 280
281static int iwl_tx_queue_alloc(struct iwl_priv *priv, 281static int iwl3945_tx_queue_alloc(struct iwl3945_priv *priv,
282 struct iwl_tx_queue *txq, u32 id) 282 struct iwl3945_tx_queue *txq, u32 id)
283{ 283{
284 struct pci_dev *dev = priv->pci_dev; 284 struct pci_dev *dev = priv->pci_dev;
285 285
@@ -316,8 +316,8 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv,
316 return -ENOMEM; 316 return -ENOMEM;
317} 317}
318 318
319int iwl_tx_queue_init(struct iwl_priv *priv, 319int iwl3945_tx_queue_init(struct iwl3945_priv *priv,
320 struct iwl_tx_queue *txq, int slots_num, u32 txq_id) 320 struct iwl3945_tx_queue *txq, int slots_num, u32 txq_id)
321{ 321{
322 struct pci_dev *dev = priv->pci_dev; 322 struct pci_dev *dev = priv->pci_dev;
323 int len; 323 int len;
@@ -326,14 +326,14 @@ int iwl_tx_queue_init(struct iwl_priv *priv,
326 /* allocate command space + one big command for scan since scan 326 /* allocate command space + one big command for scan since scan
327 * command is very huge the system will not have two scan at the 327 * command is very huge the system will not have two scan at the
328 * same time */ 328 * same time */
329 len = sizeof(struct iwl_cmd) * slots_num; 329 len = sizeof(struct iwl3945_cmd) * slots_num;
330 if (txq_id == IWL_CMD_QUEUE_NUM) 330 if (txq_id == IWL_CMD_QUEUE_NUM)
331 len += IWL_MAX_SCAN_SIZE; 331 len += IWL_MAX_SCAN_SIZE;
332 txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd); 332 txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd);
333 if (!txq->cmd) 333 if (!txq->cmd)
334 return -ENOMEM; 334 return -ENOMEM;
335 335
336 rc = iwl_tx_queue_alloc(priv, txq, txq_id); 336 rc = iwl3945_tx_queue_alloc(priv, txq, txq_id);
337 if (rc) { 337 if (rc) {
338 pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd); 338 pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd);
339 339
@@ -342,26 +342,26 @@ int iwl_tx_queue_init(struct iwl_priv *priv,
342 txq->need_update = 0; 342 txq->need_update = 0;
343 343
344 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise 344 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
345 * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */ 345 * iwl3945_queue_inc_wrap and iwl3945_queue_dec_wrap are broken. */
346 BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); 346 BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1));
347 iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id); 347 iwl3945_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id);
348 348
349 iwl_hw_tx_queue_init(priv, txq); 349 iwl3945_hw_tx_queue_init(priv, txq);
350 350
351 return 0; 351 return 0;
352} 352}
353 353
354/** 354/**
355 * iwl_tx_queue_free - Deallocate DMA queue. 355 * iwl3945_tx_queue_free - Deallocate DMA queue.
356 * @txq: Transmit queue to deallocate. 356 * @txq: Transmit queue to deallocate.
357 * 357 *
358 * Empty queue by removing and destroying all BD's. 358 * Empty queue by removing and destroying all BD's.
359 * Free all buffers. txq itself is not freed. 359 * Free all buffers. txq itself is not freed.
360 * 360 *
361 */ 361 */
362void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) 362void iwl3945_tx_queue_free(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq)
363{ 363{
364 struct iwl_queue *q = &txq->q; 364 struct iwl3945_queue *q = &txq->q;
365 struct pci_dev *dev = priv->pci_dev; 365 struct pci_dev *dev = priv->pci_dev;
366 int len; 366 int len;
367 367
@@ -370,10 +370,10 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq)
370 370
371 /* first, empty all BD's */ 371 /* first, empty all BD's */
372 for (; q->write_ptr != q->read_ptr; 372 for (; q->write_ptr != q->read_ptr;
373 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) 373 q->read_ptr = iwl3945_queue_inc_wrap(q->read_ptr, q->n_bd))
374 iwl_hw_txq_free_tfd(priv, txq); 374 iwl3945_hw_txq_free_tfd(priv, txq);
375 375
376 len = sizeof(struct iwl_cmd) * q->n_window; 376 len = sizeof(struct iwl3945_cmd) * q->n_window;
377 if (q->id == IWL_CMD_QUEUE_NUM) 377 if (q->id == IWL_CMD_QUEUE_NUM)
378 len += IWL_MAX_SCAN_SIZE; 378 len += IWL_MAX_SCAN_SIZE;
379 379
@@ -381,7 +381,7 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq)
381 381
382 /* free buffers belonging to queue itself */ 382 /* free buffers belonging to queue itself */
383 if (txq->q.n_bd) 383 if (txq->q.n_bd)
384 pci_free_consistent(dev, sizeof(struct iwl_tfd_frame) * 384 pci_free_consistent(dev, sizeof(struct iwl3945_tfd_frame) *
385 txq->q.n_bd, txq->bd, txq->q.dma_addr); 385 txq->q.n_bd, txq->bd, txq->q.dma_addr);
386 386
387 if (txq->txb) { 387 if (txq->txb) {
@@ -393,12 +393,12 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq)
393 memset(txq, 0, sizeof(*txq)); 393 memset(txq, 0, sizeof(*txq));
394} 394}
395 395
396const u8 BROADCAST_ADDR[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; 396const u8 iwl3945_broadcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
397 397
398/*************** STATION TABLE MANAGEMENT **** 398/*************** STATION TABLE MANAGEMENT ****
399 * 399 *
400 * NOTE: This needs to be overhauled to better synchronize between 400 * NOTE: This needs to be overhauled to better synchronize between
401 * how the iwl-4965.c is using iwl_hw_find_station vs. iwl-3945.c 401 * how the iwl-4965.c is using iwl3945_hw_find_station vs. iwl-3945.c
402 * 402 *
403 * mac80211 should also be examined to determine if sta_info is duplicating 403 * mac80211 should also be examined to determine if sta_info is duplicating
404 * the functionality provided here 404 * the functionality provided here
@@ -406,7 +406,7 @@ const u8 BROADCAST_ADDR[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
406 406
407/**************************************************************/ 407/**************************************************************/
408#if 0 /* temporary disable till we add real remove station */ 408#if 0 /* temporary disable till we add real remove station */
409static u8 iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap) 409static u8 iwl3945_remove_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap)
410{ 410{
411 int index = IWL_INVALID_STATION; 411 int index = IWL_INVALID_STATION;
412 int i; 412 int i;
@@ -442,7 +442,7 @@ out:
442 return 0; 442 return 0;
443} 443}
444#endif 444#endif
445static void iwl_clear_stations_table(struct iwl_priv *priv) 445static void iwl3945_clear_stations_table(struct iwl3945_priv *priv)
446{ 446{
447 unsigned long flags; 447 unsigned long flags;
448 448
@@ -455,11 +455,11 @@ static void iwl_clear_stations_table(struct iwl_priv *priv)
455} 455}
456 456
457 457
458u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags) 458u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8 flags)
459{ 459{
460 int i; 460 int i;
461 int index = IWL_INVALID_STATION; 461 int index = IWL_INVALID_STATION;
462 struct iwl_station_entry *station; 462 struct iwl3945_station_entry *station;
463 unsigned long flags_spin; 463 unsigned long flags_spin;
464 DECLARE_MAC_BUF(mac); 464 DECLARE_MAC_BUF(mac);
465 u8 rate; 465 u8 rate;
@@ -500,7 +500,7 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags)
500 station->used = 1; 500 station->used = 1;
501 priv->num_stations++; 501 priv->num_stations++;
502 502
503 memset(&station->sta, 0, sizeof(struct iwl_addsta_cmd)); 503 memset(&station->sta, 0, sizeof(struct iwl3945_addsta_cmd));
504 memcpy(station->sta.sta.addr, addr, ETH_ALEN); 504 memcpy(station->sta.sta.addr, addr, ETH_ALEN);
505 station->sta.mode = 0; 505 station->sta.mode = 0;
506 station->sta.sta.sta_id = index; 506 station->sta.sta.sta_id = index;
@@ -513,19 +513,19 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags)
513 513
514 /* Turn on both antennas for the station... */ 514 /* Turn on both antennas for the station... */
515 station->sta.rate_n_flags = 515 station->sta.rate_n_flags =
516 iwl_hw_set_rate_n_flags(rate, RATE_MCS_ANT_AB_MSK); 516 iwl3945_hw_set_rate_n_flags(rate, RATE_MCS_ANT_AB_MSK);
517 station->current_rate.rate_n_flags = 517 station->current_rate.rate_n_flags =
518 le16_to_cpu(station->sta.rate_n_flags); 518 le16_to_cpu(station->sta.rate_n_flags);
519 519
520 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 520 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
521 iwl_send_add_station(priv, &station->sta, flags); 521 iwl3945_send_add_station(priv, &station->sta, flags);
522 return index; 522 return index;
523 523
524} 524}
525 525
526/*************** DRIVER STATUS FUNCTIONS *****/ 526/*************** DRIVER STATUS FUNCTIONS *****/
527 527
528static inline int iwl_is_ready(struct iwl_priv *priv) 528static inline int iwl3945_is_ready(struct iwl3945_priv *priv)
529{ 529{
530 /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are 530 /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are
531 * set but EXIT_PENDING is not */ 531 * set but EXIT_PENDING is not */
@@ -534,29 +534,29 @@ static inline int iwl_is_ready(struct iwl_priv *priv)
534 !test_bit(STATUS_EXIT_PENDING, &priv->status); 534 !test_bit(STATUS_EXIT_PENDING, &priv->status);
535} 535}
536 536
537static inline int iwl_is_alive(struct iwl_priv *priv) 537static inline int iwl3945_is_alive(struct iwl3945_priv *priv)
538{ 538{
539 return test_bit(STATUS_ALIVE, &priv->status); 539 return test_bit(STATUS_ALIVE, &priv->status);
540} 540}
541 541
542static inline int iwl_is_init(struct iwl_priv *priv) 542static inline int iwl3945_is_init(struct iwl3945_priv *priv)
543{ 543{
544 return test_bit(STATUS_INIT, &priv->status); 544 return test_bit(STATUS_INIT, &priv->status);
545} 545}
546 546
547static inline int iwl_is_rfkill(struct iwl_priv *priv) 547static inline int iwl3945_is_rfkill(struct iwl3945_priv *priv)
548{ 548{
549 return test_bit(STATUS_RF_KILL_HW, &priv->status) || 549 return test_bit(STATUS_RF_KILL_HW, &priv->status) ||
550 test_bit(STATUS_RF_KILL_SW, &priv->status); 550 test_bit(STATUS_RF_KILL_SW, &priv->status);
551} 551}
552 552
553static inline int iwl_is_ready_rf(struct iwl_priv *priv) 553static inline int iwl3945_is_ready_rf(struct iwl3945_priv *priv)
554{ 554{
555 555
556 if (iwl_is_rfkill(priv)) 556 if (iwl3945_is_rfkill(priv))
557 return 0; 557 return 0;
558 558
559 return iwl_is_ready(priv); 559 return iwl3945_is_ready(priv);
560} 560}
561 561
562/*************** HOST COMMAND QUEUE FUNCTIONS *****/ 562/*************** HOST COMMAND QUEUE FUNCTIONS *****/
@@ -615,7 +615,7 @@ static const char *get_cmd_string(u8 cmd)
615#define HOST_COMPLETE_TIMEOUT (HZ / 2) 615#define HOST_COMPLETE_TIMEOUT (HZ / 2)
616 616
617/** 617/**
618 * iwl_enqueue_hcmd - enqueue a uCode command 618 * iwl3945_enqueue_hcmd - enqueue a uCode command
619 * @priv: device private data point 619 * @priv: device private data point
620 * @cmd: a point to the ucode command structure 620 * @cmd: a point to the ucode command structure
621 * 621 *
@@ -623,13 +623,13 @@ static const char *get_cmd_string(u8 cmd)
623 * failed. On success, it turns the index (> 0) of command in the 623 * failed. On success, it turns the index (> 0) of command in the
624 * command queue. 624 * command queue.
625 */ 625 */
626static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 626static int iwl3945_enqueue_hcmd(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd)
627{ 627{
628 struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; 628 struct iwl3945_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
629 struct iwl_queue *q = &txq->q; 629 struct iwl3945_queue *q = &txq->q;
630 struct iwl_tfd_frame *tfd; 630 struct iwl3945_tfd_frame *tfd;
631 u32 *control_flags; 631 u32 *control_flags;
632 struct iwl_cmd *out_cmd; 632 struct iwl3945_cmd *out_cmd;
633 u32 idx; 633 u32 idx;
634 u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); 634 u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr));
635 dma_addr_t phys_addr; 635 dma_addr_t phys_addr;
@@ -644,7 +644,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
644 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) && 644 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) &&
645 !(cmd->meta.flags & CMD_SIZE_HUGE)); 645 !(cmd->meta.flags & CMD_SIZE_HUGE));
646 646
647 if (iwl_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) { 647 if (iwl3945_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) {
648 IWL_ERROR("No space for Tx\n"); 648 IWL_ERROR("No space for Tx\n");
649 return -ENOSPC; 649 return -ENOSPC;
650 } 650 }
@@ -673,8 +673,8 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
673 out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); 673 out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME);
674 674
675 phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx + 675 phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx +
676 offsetof(struct iwl_cmd, hdr); 676 offsetof(struct iwl3945_cmd, hdr);
677 iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); 677 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size);
678 678
679 pad = U32_PAD(cmd->len); 679 pad = U32_PAD(cmd->len);
680 count = TFD_CTL_COUNT_GET(*control_flags); 680 count = TFD_CTL_COUNT_GET(*control_flags);
@@ -687,14 +687,14 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
687 fix_size, q->write_ptr, idx, IWL_CMD_QUEUE_NUM); 687 fix_size, q->write_ptr, idx, IWL_CMD_QUEUE_NUM);
688 688
689 txq->need_update = 1; 689 txq->need_update = 1;
690 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 690 q->write_ptr = iwl3945_queue_inc_wrap(q->write_ptr, q->n_bd);
691 ret = iwl_tx_queue_update_write_ptr(priv, txq); 691 ret = iwl3945_tx_queue_update_write_ptr(priv, txq);
692 692
693 spin_unlock_irqrestore(&priv->hcmd_lock, flags); 693 spin_unlock_irqrestore(&priv->hcmd_lock, flags);
694 return ret ? ret : idx; 694 return ret ? ret : idx;
695} 695}
696 696
697static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 697static int iwl3945_send_cmd_async(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd)
698{ 698{
699 int ret; 699 int ret;
700 700
@@ -709,16 +709,16 @@ static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
709 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 709 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
710 return -EBUSY; 710 return -EBUSY;
711 711
712 ret = iwl_enqueue_hcmd(priv, cmd); 712 ret = iwl3945_enqueue_hcmd(priv, cmd);
713 if (ret < 0) { 713 if (ret < 0) {
714 IWL_ERROR("Error sending %s: iwl_enqueue_hcmd failed: %d\n", 714 IWL_ERROR("Error sending %s: iwl3945_enqueue_hcmd failed: %d\n",
715 get_cmd_string(cmd->id), ret); 715 get_cmd_string(cmd->id), ret);
716 return ret; 716 return ret;
717 } 717 }
718 return 0; 718 return 0;
719} 719}
720 720
721static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 721static int iwl3945_send_cmd_sync(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd)
722{ 722{
723 int cmd_idx; 723 int cmd_idx;
724 int ret; 724 int ret;
@@ -740,10 +740,10 @@ static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
740 if (cmd->meta.flags & CMD_WANT_SKB) 740 if (cmd->meta.flags & CMD_WANT_SKB)
741 cmd->meta.source = &cmd->meta; 741 cmd->meta.source = &cmd->meta;
742 742
743 cmd_idx = iwl_enqueue_hcmd(priv, cmd); 743 cmd_idx = iwl3945_enqueue_hcmd(priv, cmd);
744 if (cmd_idx < 0) { 744 if (cmd_idx < 0) {
745 ret = cmd_idx; 745 ret = cmd_idx;
746 IWL_ERROR("Error sending %s: iwl_enqueue_hcmd failed: %d\n", 746 IWL_ERROR("Error sending %s: iwl3945_enqueue_hcmd failed: %d\n",
747 get_cmd_string(cmd->id), ret); 747 get_cmd_string(cmd->id), ret);
748 goto out; 748 goto out;
749 } 749 }
@@ -787,7 +787,7 @@ static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
787 787
788cancel: 788cancel:
789 if (cmd->meta.flags & CMD_WANT_SKB) { 789 if (cmd->meta.flags & CMD_WANT_SKB) {
790 struct iwl_cmd *qcmd; 790 struct iwl3945_cmd *qcmd;
791 791
792 /* Cancel the CMD_WANT_SKB flag for the cmd in the 792 /* Cancel the CMD_WANT_SKB flag for the cmd in the
793 * TX cmd queue. Otherwise in case the cmd comes 793 * TX cmd queue. Otherwise in case the cmd comes
@@ -806,43 +806,43 @@ out:
806 return ret; 806 return ret;
807} 807}
808 808
809int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 809int iwl3945_send_cmd(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd)
810{ 810{
811 if (cmd->meta.flags & CMD_ASYNC) 811 if (cmd->meta.flags & CMD_ASYNC)
812 return iwl_send_cmd_async(priv, cmd); 812 return iwl3945_send_cmd_async(priv, cmd);
813 813
814 return iwl_send_cmd_sync(priv, cmd); 814 return iwl3945_send_cmd_sync(priv, cmd);
815} 815}
816 816
817int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data) 817int iwl3945_send_cmd_pdu(struct iwl3945_priv *priv, u8 id, u16 len, const void *data)
818{ 818{
819 struct iwl_host_cmd cmd = { 819 struct iwl3945_host_cmd cmd = {
820 .id = id, 820 .id = id,
821 .len = len, 821 .len = len,
822 .data = data, 822 .data = data,
823 }; 823 };
824 824
825 return iwl_send_cmd_sync(priv, &cmd); 825 return iwl3945_send_cmd_sync(priv, &cmd);
826} 826}
827 827
828static int __must_check iwl_send_cmd_u32(struct iwl_priv *priv, u8 id, u32 val) 828static int __must_check iwl3945_send_cmd_u32(struct iwl3945_priv *priv, u8 id, u32 val)
829{ 829{
830 struct iwl_host_cmd cmd = { 830 struct iwl3945_host_cmd cmd = {
831 .id = id, 831 .id = id,
832 .len = sizeof(val), 832 .len = sizeof(val),
833 .data = &val, 833 .data = &val,
834 }; 834 };
835 835
836 return iwl_send_cmd_sync(priv, &cmd); 836 return iwl3945_send_cmd_sync(priv, &cmd);
837} 837}
838 838
839int iwl_send_statistics_request(struct iwl_priv *priv) 839int iwl3945_send_statistics_request(struct iwl3945_priv *priv)
840{ 840{
841 return iwl_send_cmd_u32(priv, REPLY_STATISTICS_CMD, 0); 841 return iwl3945_send_cmd_u32(priv, REPLY_STATISTICS_CMD, 0);
842} 842}
843 843
844/** 844/**
845 * iwl_set_rxon_channel - Set the phymode and channel values in staging RXON 845 * iwl3945_set_rxon_channel - Set the phymode and channel values in staging RXON
846 * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz 846 * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz
847 * @channel: Any channel valid for the requested phymode 847 * @channel: Any channel valid for the requested phymode
848 848
@@ -851,9 +851,9 @@ int iwl_send_statistics_request(struct iwl_priv *priv)
851 * NOTE: Does not commit to the hardware; it sets appropriate bit fields 851 * NOTE: Does not commit to the hardware; it sets appropriate bit fields
852 * in the staging RXON flag structure based on the phymode 852 * in the staging RXON flag structure based on the phymode
853 */ 853 */
854static int iwl_set_rxon_channel(struct iwl_priv *priv, u8 phymode, u16 channel) 854static int iwl3945_set_rxon_channel(struct iwl3945_priv *priv, u8 phymode, u16 channel)
855{ 855{
856 if (!iwl_get_channel_info(priv, phymode, channel)) { 856 if (!iwl3945_get_channel_info(priv, phymode, channel)) {
857 IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", 857 IWL_DEBUG_INFO("Could not set channel to %d [%d]\n",
858 channel, phymode); 858 channel, phymode);
859 return -EINVAL; 859 return -EINVAL;
@@ -877,13 +877,13 @@ static int iwl_set_rxon_channel(struct iwl_priv *priv, u8 phymode, u16 channel)
877} 877}
878 878
879/** 879/**
880 * iwl_check_rxon_cmd - validate RXON structure is valid 880 * iwl3945_check_rxon_cmd - validate RXON structure is valid
881 * 881 *
882 * NOTE: This is really only useful during development and can eventually 882 * NOTE: This is really only useful during development and can eventually
883 * be #ifdef'd out once the driver is stable and folks aren't actively 883 * be #ifdef'd out once the driver is stable and folks aren't actively
884 * making changes 884 * making changes
885 */ 885 */
886static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon) 886static int iwl3945_check_rxon_cmd(struct iwl3945_rxon_cmd *rxon)
887{ 887{
888 int error = 0; 888 int error = 0;
889 int counter = 1; 889 int counter = 1;
@@ -949,21 +949,21 @@ static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon)
949 le16_to_cpu(rxon->channel)); 949 le16_to_cpu(rxon->channel));
950 950
951 if (error) { 951 if (error) {
952 IWL_ERROR("Not a valid iwl_rxon_assoc_cmd field values\n"); 952 IWL_ERROR("Not a valid iwl3945_rxon_assoc_cmd field values\n");
953 return -1; 953 return -1;
954 } 954 }
955 return 0; 955 return 0;
956} 956}
957 957
958/** 958/**
959 * iwl_full_rxon_required - determine if RXON_ASSOC can be used in RXON commit 959 * iwl3945_full_rxon_required - determine if RXON_ASSOC can be used in RXON commit
960 * @priv: staging_rxon is compared to active_rxon 960 * @priv: staging_rxon is compared to active_rxon
961 * 961 *
962 * If the RXON structure is changing sufficient to require a new 962 * If the RXON structure is changing sufficient to require a new
963 * tune or to clear and reset the RXON_FILTER_ASSOC_MSK then return 1 963 * tune or to clear and reset the RXON_FILTER_ASSOC_MSK then return 1
964 * to indicate a new tune is required. 964 * to indicate a new tune is required.
965 */ 965 */
966static int iwl_full_rxon_required(struct iwl_priv *priv) 966static int iwl3945_full_rxon_required(struct iwl3945_priv *priv)
967{ 967{
968 968
969 /* These items are only settable from the full RXON command */ 969 /* These items are only settable from the full RXON command */
@@ -998,19 +998,19 @@ static int iwl_full_rxon_required(struct iwl_priv *priv)
998 return 0; 998 return 0;
999} 999}
1000 1000
1001static int iwl_send_rxon_assoc(struct iwl_priv *priv) 1001static int iwl3945_send_rxon_assoc(struct iwl3945_priv *priv)
1002{ 1002{
1003 int rc = 0; 1003 int rc = 0;
1004 struct iwl_rx_packet *res = NULL; 1004 struct iwl3945_rx_packet *res = NULL;
1005 struct iwl_rxon_assoc_cmd rxon_assoc; 1005 struct iwl3945_rxon_assoc_cmd rxon_assoc;
1006 struct iwl_host_cmd cmd = { 1006 struct iwl3945_host_cmd cmd = {
1007 .id = REPLY_RXON_ASSOC, 1007 .id = REPLY_RXON_ASSOC,
1008 .len = sizeof(rxon_assoc), 1008 .len = sizeof(rxon_assoc),
1009 .meta.flags = CMD_WANT_SKB, 1009 .meta.flags = CMD_WANT_SKB,
1010 .data = &rxon_assoc, 1010 .data = &rxon_assoc,
1011 }; 1011 };
1012 const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; 1012 const struct iwl3945_rxon_cmd *rxon1 = &priv->staging_rxon;
1013 const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; 1013 const struct iwl3945_rxon_cmd *rxon2 = &priv->active_rxon;
1014 1014
1015 if ((rxon1->flags == rxon2->flags) && 1015 if ((rxon1->flags == rxon2->flags) &&
1016 (rxon1->filter_flags == rxon2->filter_flags) && 1016 (rxon1->filter_flags == rxon2->filter_flags) &&
@@ -1026,11 +1026,11 @@ static int iwl_send_rxon_assoc(struct iwl_priv *priv)
1026 rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates; 1026 rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates;
1027 rxon_assoc.reserved = 0; 1027 rxon_assoc.reserved = 0;
1028 1028
1029 rc = iwl_send_cmd_sync(priv, &cmd); 1029 rc = iwl3945_send_cmd_sync(priv, &cmd);
1030 if (rc) 1030 if (rc)
1031 return rc; 1031 return rc;
1032 1032
1033 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; 1033 res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
1034 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 1034 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
1035 IWL_ERROR("Bad return from REPLY_RXON_ASSOC command\n"); 1035 IWL_ERROR("Bad return from REPLY_RXON_ASSOC command\n");
1036 rc = -EIO; 1036 rc = -EIO;
@@ -1043,21 +1043,21 @@ static int iwl_send_rxon_assoc(struct iwl_priv *priv)
1043} 1043}
1044 1044
1045/** 1045/**
1046 * iwl_commit_rxon - commit staging_rxon to hardware 1046 * iwl3945_commit_rxon - commit staging_rxon to hardware
1047 * 1047 *
1048 * The RXON command in staging_rxon is committed to the hardware and 1048 * The RXON command in staging_rxon is committed to the hardware and
1049 * the active_rxon structure is updated with the new data. This 1049 * the active_rxon structure is updated with the new data. This
1050 * function correctly transitions out of the RXON_ASSOC_MSK state if 1050 * function correctly transitions out of the RXON_ASSOC_MSK state if
1051 * a HW tune is required based on the RXON structure changes. 1051 * a HW tune is required based on the RXON structure changes.
1052 */ 1052 */
1053static int iwl_commit_rxon(struct iwl_priv *priv) 1053static int iwl3945_commit_rxon(struct iwl3945_priv *priv)
1054{ 1054{
1055 /* cast away the const for active_rxon in this function */ 1055 /* cast away the const for active_rxon in this function */
1056 struct iwl_rxon_cmd *active_rxon = (void *)&priv->active_rxon; 1056 struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active_rxon;
1057 int rc = 0; 1057 int rc = 0;
1058 DECLARE_MAC_BUF(mac); 1058 DECLARE_MAC_BUF(mac);
1059 1059
1060 if (!iwl_is_alive(priv)) 1060 if (!iwl3945_is_alive(priv))
1061 return -1; 1061 return -1;
1062 1062
1063 /* always get timestamp with Rx frame */ 1063 /* always get timestamp with Rx frame */
@@ -1068,17 +1068,17 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1068 ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); 1068 ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK);
1069 priv->staging_rxon.flags |= iwl3945_get_antenna_flags(priv); 1069 priv->staging_rxon.flags |= iwl3945_get_antenna_flags(priv);
1070 1070
1071 rc = iwl_check_rxon_cmd(&priv->staging_rxon); 1071 rc = iwl3945_check_rxon_cmd(&priv->staging_rxon);
1072 if (rc) { 1072 if (rc) {
1073 IWL_ERROR("Invalid RXON configuration. Not committing.\n"); 1073 IWL_ERROR("Invalid RXON configuration. Not committing.\n");
1074 return -EINVAL; 1074 return -EINVAL;
1075 } 1075 }
1076 1076
1077 /* If we don't need to send a full RXON, we can use 1077 /* If we don't need to send a full RXON, we can use
1078 * iwl_rxon_assoc_cmd which is used to reconfigure filter 1078 * iwl3945_rxon_assoc_cmd which is used to reconfigure filter
1079 * and other flags for the current radio configuration. */ 1079 * and other flags for the current radio configuration. */
1080 if (!iwl_full_rxon_required(priv)) { 1080 if (!iwl3945_full_rxon_required(priv)) {
1081 rc = iwl_send_rxon_assoc(priv); 1081 rc = iwl3945_send_rxon_assoc(priv);
1082 if (rc) { 1082 if (rc) {
1083 IWL_ERROR("Error setting RXON_ASSOC " 1083 IWL_ERROR("Error setting RXON_ASSOC "
1084 "configuration (%d).\n", rc); 1084 "configuration (%d).\n", rc);
@@ -1094,13 +1094,13 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1094 * an RXON_ASSOC and the new config wants the associated mask enabled, 1094 * an RXON_ASSOC and the new config wants the associated mask enabled,
1095 * we must clear the associated from the active configuration 1095 * we must clear the associated from the active configuration
1096 * before we apply the new config */ 1096 * before we apply the new config */
1097 if (iwl_is_associated(priv) && 1097 if (iwl3945_is_associated(priv) &&
1098 (priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK)) { 1098 (priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK)) {
1099 IWL_DEBUG_INFO("Toggling associated bit on current RXON\n"); 1099 IWL_DEBUG_INFO("Toggling associated bit on current RXON\n");
1100 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 1100 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1101 1101
1102 rc = iwl_send_cmd_pdu(priv, REPLY_RXON, 1102 rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON,
1103 sizeof(struct iwl_rxon_cmd), 1103 sizeof(struct iwl3945_rxon_cmd),
1104 &priv->active_rxon); 1104 &priv->active_rxon);
1105 1105
1106 /* If the mask clearing failed then we set 1106 /* If the mask clearing failed then we set
@@ -1123,8 +1123,8 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1123 print_mac(mac, priv->staging_rxon.bssid_addr)); 1123 print_mac(mac, priv->staging_rxon.bssid_addr));
1124 1124
1125 /* Apply the new configuration */ 1125 /* Apply the new configuration */
1126 rc = iwl_send_cmd_pdu(priv, REPLY_RXON, 1126 rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON,
1127 sizeof(struct iwl_rxon_cmd), &priv->staging_rxon); 1127 sizeof(struct iwl3945_rxon_cmd), &priv->staging_rxon);
1128 if (rc) { 1128 if (rc) {
1129 IWL_ERROR("Error setting new configuration (%d).\n", rc); 1129 IWL_ERROR("Error setting new configuration (%d).\n", rc);
1130 return rc; 1130 return rc;
@@ -1132,18 +1132,18 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1132 1132
1133 memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); 1133 memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon));
1134 1134
1135 iwl_clear_stations_table(priv); 1135 iwl3945_clear_stations_table(priv);
1136 1136
1137 /* If we issue a new RXON command which required a tune then we must 1137 /* If we issue a new RXON command which required a tune then we must
1138 * send a new TXPOWER command or we won't be able to Tx any frames */ 1138 * send a new TXPOWER command or we won't be able to Tx any frames */
1139 rc = iwl_hw_reg_send_txpower(priv); 1139 rc = iwl3945_hw_reg_send_txpower(priv);
1140 if (rc) { 1140 if (rc) {
1141 IWL_ERROR("Error setting Tx power (%d).\n", rc); 1141 IWL_ERROR("Error setting Tx power (%d).\n", rc);
1142 return rc; 1142 return rc;
1143 } 1143 }
1144 1144
1145 /* Add the broadcast address so we can send broadcast frames */ 1145 /* Add the broadcast address so we can send broadcast frames */
1146 if (iwl_add_station(priv, BROADCAST_ADDR, 0, 0) == 1146 if (iwl3945_add_station(priv, iwl3945_broadcast_addr, 0, 0) ==
1147 IWL_INVALID_STATION) { 1147 IWL_INVALID_STATION) {
1148 IWL_ERROR("Error adding BROADCAST address for transmit.\n"); 1148 IWL_ERROR("Error adding BROADCAST address for transmit.\n");
1149 return -EIO; 1149 return -EIO;
@@ -1151,9 +1151,9 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1151 1151
1152 /* If we have set the ASSOC_MSK and we are in BSS mode then 1152 /* If we have set the ASSOC_MSK and we are in BSS mode then
1153 * add the IWL_AP_ID to the station rate table */ 1153 * add the IWL_AP_ID to the station rate table */
1154 if (iwl_is_associated(priv) && 1154 if (iwl3945_is_associated(priv) &&
1155 (priv->iw_mode == IEEE80211_IF_TYPE_STA)) 1155 (priv->iw_mode == IEEE80211_IF_TYPE_STA))
1156 if (iwl_add_station(priv, priv->active_rxon.bssid_addr, 1, 0) 1156 if (iwl3945_add_station(priv, priv->active_rxon.bssid_addr, 1, 0)
1157 == IWL_INVALID_STATION) { 1157 == IWL_INVALID_STATION) {
1158 IWL_ERROR("Error adding AP address for transmit.\n"); 1158 IWL_ERROR("Error adding AP address for transmit.\n");
1159 return -EIO; 1159 return -EIO;
@@ -1170,9 +1170,9 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
1170 return 0; 1170 return 0;
1171} 1171}
1172 1172
1173static int iwl_send_bt_config(struct iwl_priv *priv) 1173static int iwl3945_send_bt_config(struct iwl3945_priv *priv)
1174{ 1174{
1175 struct iwl_bt_cmd bt_cmd = { 1175 struct iwl3945_bt_cmd bt_cmd = {
1176 .flags = 3, 1176 .flags = 3,
1177 .lead_time = 0xAA, 1177 .lead_time = 0xAA,
1178 .max_kill = 1, 1178 .max_kill = 1,
@@ -1180,15 +1180,15 @@ static int iwl_send_bt_config(struct iwl_priv *priv)
1180 .kill_cts_mask = 0, 1180 .kill_cts_mask = 0,
1181 }; 1181 };
1182 1182
1183 return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG, 1183 return iwl3945_send_cmd_pdu(priv, REPLY_BT_CONFIG,
1184 sizeof(struct iwl_bt_cmd), &bt_cmd); 1184 sizeof(struct iwl3945_bt_cmd), &bt_cmd);
1185} 1185}
1186 1186
1187static int iwl_send_scan_abort(struct iwl_priv *priv) 1187static int iwl3945_send_scan_abort(struct iwl3945_priv *priv)
1188{ 1188{
1189 int rc = 0; 1189 int rc = 0;
1190 struct iwl_rx_packet *res; 1190 struct iwl3945_rx_packet *res;
1191 struct iwl_host_cmd cmd = { 1191 struct iwl3945_host_cmd cmd = {
1192 .id = REPLY_SCAN_ABORT_CMD, 1192 .id = REPLY_SCAN_ABORT_CMD,
1193 .meta.flags = CMD_WANT_SKB, 1193 .meta.flags = CMD_WANT_SKB,
1194 }; 1194 };
@@ -1201,13 +1201,13 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
1201 return 0; 1201 return 0;
1202 } 1202 }
1203 1203
1204 rc = iwl_send_cmd_sync(priv, &cmd); 1204 rc = iwl3945_send_cmd_sync(priv, &cmd);
1205 if (rc) { 1205 if (rc) {
1206 clear_bit(STATUS_SCAN_ABORTING, &priv->status); 1206 clear_bit(STATUS_SCAN_ABORTING, &priv->status);
1207 return rc; 1207 return rc;
1208 } 1208 }
1209 1209
1210 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; 1210 res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
1211 if (res->u.status != CAN_ABORT_STATUS) { 1211 if (res->u.status != CAN_ABORT_STATUS) {
1212 /* The scan abort will return 1 for success or 1212 /* The scan abort will return 1 for success or
1213 * 2 for "failure". A failure condition can be 1213 * 2 for "failure". A failure condition can be
@@ -1225,8 +1225,8 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
1225 return rc; 1225 return rc;
1226} 1226}
1227 1227
1228static int iwl_card_state_sync_callback(struct iwl_priv *priv, 1228static int iwl3945_card_state_sync_callback(struct iwl3945_priv *priv,
1229 struct iwl_cmd *cmd, 1229 struct iwl3945_cmd *cmd,
1230 struct sk_buff *skb) 1230 struct sk_buff *skb)
1231{ 1231{
1232 return 1; 1232 return 1;
@@ -1242,9 +1242,9 @@ static int iwl_card_state_sync_callback(struct iwl_priv *priv,
1242 * When in the 'halt' state, the card is shut down and must be fully 1242 * When in the 'halt' state, the card is shut down and must be fully
1243 * restarted to come back on. 1243 * restarted to come back on.
1244 */ 1244 */
1245static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag) 1245static int iwl3945_send_card_state(struct iwl3945_priv *priv, u32 flags, u8 meta_flag)
1246{ 1246{
1247 struct iwl_host_cmd cmd = { 1247 struct iwl3945_host_cmd cmd = {
1248 .id = REPLY_CARD_STATE_CMD, 1248 .id = REPLY_CARD_STATE_CMD,
1249 .len = sizeof(u32), 1249 .len = sizeof(u32),
1250 .data = &flags, 1250 .data = &flags,
@@ -1252,22 +1252,22 @@ static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)
1252 }; 1252 };
1253 1253
1254 if (meta_flag & CMD_ASYNC) 1254 if (meta_flag & CMD_ASYNC)
1255 cmd.meta.u.callback = iwl_card_state_sync_callback; 1255 cmd.meta.u.callback = iwl3945_card_state_sync_callback;
1256 1256
1257 return iwl_send_cmd(priv, &cmd); 1257 return iwl3945_send_cmd(priv, &cmd);
1258} 1258}
1259 1259
1260static int iwl_add_sta_sync_callback(struct iwl_priv *priv, 1260static int iwl3945_add_sta_sync_callback(struct iwl3945_priv *priv,
1261 struct iwl_cmd *cmd, struct sk_buff *skb) 1261 struct iwl3945_cmd *cmd, struct sk_buff *skb)
1262{ 1262{
1263 struct iwl_rx_packet *res = NULL; 1263 struct iwl3945_rx_packet *res = NULL;
1264 1264
1265 if (!skb) { 1265 if (!skb) {
1266 IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n"); 1266 IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n");
1267 return 1; 1267 return 1;
1268 } 1268 }
1269 1269
1270 res = (struct iwl_rx_packet *)skb->data; 1270 res = (struct iwl3945_rx_packet *)skb->data;
1271 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 1271 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
1272 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n", 1272 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
1273 res->hdr.flags); 1273 res->hdr.flags);
@@ -1285,29 +1285,29 @@ static int iwl_add_sta_sync_callback(struct iwl_priv *priv,
1285 return 1; 1285 return 1;
1286} 1286}
1287 1287
1288int iwl_send_add_station(struct iwl_priv *priv, 1288int iwl3945_send_add_station(struct iwl3945_priv *priv,
1289 struct iwl_addsta_cmd *sta, u8 flags) 1289 struct iwl3945_addsta_cmd *sta, u8 flags)
1290{ 1290{
1291 struct iwl_rx_packet *res = NULL; 1291 struct iwl3945_rx_packet *res = NULL;
1292 int rc = 0; 1292 int rc = 0;
1293 struct iwl_host_cmd cmd = { 1293 struct iwl3945_host_cmd cmd = {
1294 .id = REPLY_ADD_STA, 1294 .id = REPLY_ADD_STA,
1295 .len = sizeof(struct iwl_addsta_cmd), 1295 .len = sizeof(struct iwl3945_addsta_cmd),
1296 .meta.flags = flags, 1296 .meta.flags = flags,
1297 .data = sta, 1297 .data = sta,
1298 }; 1298 };
1299 1299
1300 if (flags & CMD_ASYNC) 1300 if (flags & CMD_ASYNC)
1301 cmd.meta.u.callback = iwl_add_sta_sync_callback; 1301 cmd.meta.u.callback = iwl3945_add_sta_sync_callback;
1302 else 1302 else
1303 cmd.meta.flags |= CMD_WANT_SKB; 1303 cmd.meta.flags |= CMD_WANT_SKB;
1304 1304
1305 rc = iwl_send_cmd(priv, &cmd); 1305 rc = iwl3945_send_cmd(priv, &cmd);
1306 1306
1307 if (rc || (flags & CMD_ASYNC)) 1307 if (rc || (flags & CMD_ASYNC))
1308 return rc; 1308 return rc;
1309 1309
1310 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; 1310 res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
1311 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 1311 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
1312 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n", 1312 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
1313 res->hdr.flags); 1313 res->hdr.flags);
@@ -1332,7 +1332,7 @@ int iwl_send_add_station(struct iwl_priv *priv,
1332 return rc; 1332 return rc;
1333} 1333}
1334 1334
1335static int iwl_update_sta_key_info(struct iwl_priv *priv, 1335static int iwl3945_update_sta_key_info(struct iwl3945_priv *priv,
1336 struct ieee80211_key_conf *keyconf, 1336 struct ieee80211_key_conf *keyconf,
1337 u8 sta_id) 1337 u8 sta_id)
1338{ 1338{
@@ -1366,28 +1366,28 @@ static int iwl_update_sta_key_info(struct iwl_priv *priv,
1366 spin_unlock_irqrestore(&priv->sta_lock, flags); 1366 spin_unlock_irqrestore(&priv->sta_lock, flags);
1367 1367
1368 IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n"); 1368 IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n");
1369 iwl_send_add_station(priv, &priv->stations[sta_id].sta, 0); 1369 iwl3945_send_add_station(priv, &priv->stations[sta_id].sta, 0);
1370 return 0; 1370 return 0;
1371} 1371}
1372 1372
1373static int iwl_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id) 1373static int iwl3945_clear_sta_key_info(struct iwl3945_priv *priv, u8 sta_id)
1374{ 1374{
1375 unsigned long flags; 1375 unsigned long flags;
1376 1376
1377 spin_lock_irqsave(&priv->sta_lock, flags); 1377 spin_lock_irqsave(&priv->sta_lock, flags);
1378 memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl_hw_key)); 1378 memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl3945_hw_key));
1379 memset(&priv->stations[sta_id].sta.key, 0, sizeof(struct iwl_keyinfo)); 1379 memset(&priv->stations[sta_id].sta.key, 0, sizeof(struct iwl3945_keyinfo));
1380 priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; 1380 priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC;
1381 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; 1381 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
1382 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 1382 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
1383 spin_unlock_irqrestore(&priv->sta_lock, flags); 1383 spin_unlock_irqrestore(&priv->sta_lock, flags);
1384 1384
1385 IWL_DEBUG_INFO("hwcrypto: clear ucode station key info\n"); 1385 IWL_DEBUG_INFO("hwcrypto: clear ucode station key info\n");
1386 iwl_send_add_station(priv, &priv->stations[sta_id].sta, 0); 1386 iwl3945_send_add_station(priv, &priv->stations[sta_id].sta, 0);
1387 return 0; 1387 return 0;
1388} 1388}
1389 1389
1390static void iwl_clear_free_frames(struct iwl_priv *priv) 1390static void iwl3945_clear_free_frames(struct iwl3945_priv *priv)
1391{ 1391{
1392 struct list_head *element; 1392 struct list_head *element;
1393 1393
@@ -1397,7 +1397,7 @@ static void iwl_clear_free_frames(struct iwl_priv *priv)
1397 while (!list_empty(&priv->free_frames)) { 1397 while (!list_empty(&priv->free_frames)) {
1398 element = priv->free_frames.next; 1398 element = priv->free_frames.next;
1399 list_del(element); 1399 list_del(element);
1400 kfree(list_entry(element, struct iwl_frame, list)); 1400 kfree(list_entry(element, struct iwl3945_frame, list));
1401 priv->frames_count--; 1401 priv->frames_count--;
1402 } 1402 }
1403 1403
@@ -1408,9 +1408,9 @@ static void iwl_clear_free_frames(struct iwl_priv *priv)
1408 } 1408 }
1409} 1409}
1410 1410
1411static struct iwl_frame *iwl_get_free_frame(struct iwl_priv *priv) 1411static struct iwl3945_frame *iwl3945_get_free_frame(struct iwl3945_priv *priv)
1412{ 1412{
1413 struct iwl_frame *frame; 1413 struct iwl3945_frame *frame;
1414 struct list_head *element; 1414 struct list_head *element;
1415 if (list_empty(&priv->free_frames)) { 1415 if (list_empty(&priv->free_frames)) {
1416 frame = kzalloc(sizeof(*frame), GFP_KERNEL); 1416 frame = kzalloc(sizeof(*frame), GFP_KERNEL);
@@ -1425,21 +1425,21 @@ static struct iwl_frame *iwl_get_free_frame(struct iwl_priv *priv)
1425 1425
1426 element = priv->free_frames.next; 1426 element = priv->free_frames.next;
1427 list_del(element); 1427 list_del(element);
1428 return list_entry(element, struct iwl_frame, list); 1428 return list_entry(element, struct iwl3945_frame, list);
1429} 1429}
1430 1430
1431static void iwl_free_frame(struct iwl_priv *priv, struct iwl_frame *frame) 1431static void iwl3945_free_frame(struct iwl3945_priv *priv, struct iwl3945_frame *frame)
1432{ 1432{
1433 memset(frame, 0, sizeof(*frame)); 1433 memset(frame, 0, sizeof(*frame));
1434 list_add(&frame->list, &priv->free_frames); 1434 list_add(&frame->list, &priv->free_frames);
1435} 1435}
1436 1436
1437unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, 1437unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv,
1438 struct ieee80211_hdr *hdr, 1438 struct ieee80211_hdr *hdr,
1439 const u8 *dest, int left) 1439 const u8 *dest, int left)
1440{ 1440{
1441 1441
1442 if (!iwl_is_associated(priv) || !priv->ibss_beacon || 1442 if (!iwl3945_is_associated(priv) || !priv->ibss_beacon ||
1443 ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) && 1443 ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) &&
1444 (priv->iw_mode != IEEE80211_IF_TYPE_AP))) 1444 (priv->iw_mode != IEEE80211_IF_TYPE_AP)))
1445 return 0; 1445 return 0;
@@ -1452,37 +1452,37 @@ unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv,
1452 return priv->ibss_beacon->len; 1452 return priv->ibss_beacon->len;
1453} 1453}
1454 1454
1455static int iwl_rate_index_from_plcp(int plcp) 1455static int iwl3945_rate_index_from_plcp(int plcp)
1456{ 1456{
1457 int i = 0; 1457 int i = 0;
1458 1458
1459 for (i = 0; i < IWL_RATE_COUNT; i++) 1459 for (i = 0; i < IWL_RATE_COUNT; i++)
1460 if (iwl_rates[i].plcp == plcp) 1460 if (iwl3945_rates[i].plcp == plcp)
1461 return i; 1461 return i;
1462 return -1; 1462 return -1;
1463} 1463}
1464 1464
1465static u8 iwl_rate_get_lowest_plcp(int rate_mask) 1465static u8 iwl3945_rate_get_lowest_plcp(int rate_mask)
1466{ 1466{
1467 u8 i; 1467 u8 i;
1468 1468
1469 for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID; 1469 for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID;
1470 i = iwl_rates[i].next_ieee) { 1470 i = iwl3945_rates[i].next_ieee) {
1471 if (rate_mask & (1 << i)) 1471 if (rate_mask & (1 << i))
1472 return iwl_rates[i].plcp; 1472 return iwl3945_rates[i].plcp;
1473 } 1473 }
1474 1474
1475 return IWL_RATE_INVALID; 1475 return IWL_RATE_INVALID;
1476} 1476}
1477 1477
1478static int iwl_send_beacon_cmd(struct iwl_priv *priv) 1478static int iwl3945_send_beacon_cmd(struct iwl3945_priv *priv)
1479{ 1479{
1480 struct iwl_frame *frame; 1480 struct iwl3945_frame *frame;
1481 unsigned int frame_size; 1481 unsigned int frame_size;
1482 int rc; 1482 int rc;
1483 u8 rate; 1483 u8 rate;
1484 1484
1485 frame = iwl_get_free_frame(priv); 1485 frame = iwl3945_get_free_frame(priv);
1486 1486
1487 if (!frame) { 1487 if (!frame) {
1488 IWL_ERROR("Could not obtain free frame buffer for beacon " 1488 IWL_ERROR("Could not obtain free frame buffer for beacon "
@@ -1491,22 +1491,22 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv)
1491 } 1491 }
1492 1492
1493 if (!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)) { 1493 if (!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)) {
1494 rate = iwl_rate_get_lowest_plcp(priv->active_rate_basic & 1494 rate = iwl3945_rate_get_lowest_plcp(priv->active_rate_basic &
1495 0xFF0); 1495 0xFF0);
1496 if (rate == IWL_INVALID_RATE) 1496 if (rate == IWL_INVALID_RATE)
1497 rate = IWL_RATE_6M_PLCP; 1497 rate = IWL_RATE_6M_PLCP;
1498 } else { 1498 } else {
1499 rate = iwl_rate_get_lowest_plcp(priv->active_rate_basic & 0xF); 1499 rate = iwl3945_rate_get_lowest_plcp(priv->active_rate_basic & 0xF);
1500 if (rate == IWL_INVALID_RATE) 1500 if (rate == IWL_INVALID_RATE)
1501 rate = IWL_RATE_1M_PLCP; 1501 rate = IWL_RATE_1M_PLCP;
1502 } 1502 }
1503 1503
1504 frame_size = iwl_hw_get_beacon_cmd(priv, frame, rate); 1504 frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate);
1505 1505
1506 rc = iwl_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, 1506 rc = iwl3945_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size,
1507 &frame->u.cmd[0]); 1507 &frame->u.cmd[0]);
1508 1508
1509 iwl_free_frame(priv, frame); 1509 iwl3945_free_frame(priv, frame);
1510 1510
1511 return rc; 1511 return rc;
1512} 1512}
@@ -1517,22 +1517,22 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv)
1517 * 1517 *
1518 ******************************************************************************/ 1518 ******************************************************************************/
1519 1519
1520static void get_eeprom_mac(struct iwl_priv *priv, u8 *mac) 1520static void get_eeprom_mac(struct iwl3945_priv *priv, u8 *mac)
1521{ 1521{
1522 memcpy(mac, priv->eeprom.mac_address, 6); 1522 memcpy(mac, priv->eeprom.mac_address, 6);
1523} 1523}
1524 1524
1525/** 1525/**
1526 * iwl_eeprom_init - read EEPROM contents 1526 * iwl3945_eeprom_init - read EEPROM contents
1527 * 1527 *
1528 * Load the EEPROM from adapter into priv->eeprom 1528 * Load the EEPROM from adapter into priv->eeprom
1529 * 1529 *
1530 * NOTE: This routine uses the non-debug IO access functions. 1530 * NOTE: This routine uses the non-debug IO access functions.
1531 */ 1531 */
1532int iwl_eeprom_init(struct iwl_priv *priv) 1532int iwl3945_eeprom_init(struct iwl3945_priv *priv)
1533{ 1533{
1534 u16 *e = (u16 *)&priv->eeprom; 1534 u16 *e = (u16 *)&priv->eeprom;
1535 u32 gp = iwl_read32(priv, CSR_EEPROM_GP); 1535 u32 gp = iwl3945_read32(priv, CSR_EEPROM_GP);
1536 u32 r; 1536 u32 r;
1537 int sz = sizeof(priv->eeprom); 1537 int sz = sizeof(priv->eeprom);
1538 int rc; 1538 int rc;
@@ -1550,7 +1550,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
1550 return -ENOENT; 1550 return -ENOENT;
1551 } 1551 }
1552 1552
1553 rc = iwl_eeprom_acquire_semaphore(priv); 1553 rc = iwl3945_eeprom_acquire_semaphore(priv);
1554 if (rc < 0) { 1554 if (rc < 0) {
1555 IWL_ERROR("Failed to acquire EEPROM semaphore.\n"); 1555 IWL_ERROR("Failed to acquire EEPROM semaphore.\n");
1556 return -ENOENT; 1556 return -ENOENT;
@@ -1558,12 +1558,12 @@ int iwl_eeprom_init(struct iwl_priv *priv)
1558 1558
1559 /* eeprom is an array of 16bit values */ 1559 /* eeprom is an array of 16bit values */
1560 for (addr = 0; addr < sz; addr += sizeof(u16)) { 1560 for (addr = 0; addr < sz; addr += sizeof(u16)) {
1561 _iwl_write32(priv, CSR_EEPROM_REG, addr << 1); 1561 _iwl3945_write32(priv, CSR_EEPROM_REG, addr << 1);
1562 _iwl_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD); 1562 _iwl3945_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD);
1563 1563
1564 for (i = 0; i < IWL_EEPROM_ACCESS_TIMEOUT; 1564 for (i = 0; i < IWL_EEPROM_ACCESS_TIMEOUT;
1565 i += IWL_EEPROM_ACCESS_DELAY) { 1565 i += IWL_EEPROM_ACCESS_DELAY) {
1566 r = _iwl_read_direct32(priv, CSR_EEPROM_REG); 1566 r = _iwl3945_read_direct32(priv, CSR_EEPROM_REG);
1567 if (r & CSR_EEPROM_REG_READ_VALID_MSK) 1567 if (r & CSR_EEPROM_REG_READ_VALID_MSK)
1568 break; 1568 break;
1569 udelay(IWL_EEPROM_ACCESS_DELAY); 1569 udelay(IWL_EEPROM_ACCESS_DELAY);
@@ -1587,19 +1587,19 @@ int iwl_eeprom_init(struct iwl_priv *priv)
1587#ifdef CONFIG_IWL3945_DEBUG 1587#ifdef CONFIG_IWL3945_DEBUG
1588 1588
1589/** 1589/**
1590 * iwl_report_frame - dump frame to syslog during debug sessions 1590 * iwl3945_report_frame - dump frame to syslog during debug sessions
1591 * 1591 *
1592 * hack this function to show different aspects of received frames, 1592 * hack this function to show different aspects of received frames,
1593 * including selective frame dumps. 1593 * including selective frame dumps.
1594 * group100 parameter selects whether to show 1 out of 100 good frames. 1594 * group100 parameter selects whether to show 1 out of 100 good frames.
1595 * 1595 *
1596 * TODO: ieee80211_hdr stuff is common to 3945 and 4965, so frame type 1596 * TODO: ieee80211_hdr stuff is common to 3945 and 4965, so frame type
1597 * info output is okay, but some of this stuff (e.g. iwl_rx_frame_stats) 1597 * info output is okay, but some of this stuff (e.g. iwl3945_rx_frame_stats)
1598 * is 3945-specific and gives bad output for 4965. Need to split the 1598 * is 3945-specific and gives bad output for 4965. Need to split the
1599 * functionality, keep common stuff here. 1599 * functionality, keep common stuff here.
1600 */ 1600 */
1601void iwl_report_frame(struct iwl_priv *priv, 1601void iwl3945_report_frame(struct iwl3945_priv *priv,
1602 struct iwl_rx_packet *pkt, 1602 struct iwl3945_rx_packet *pkt,
1603 struct ieee80211_hdr *header, int group100) 1603 struct ieee80211_hdr *header, int group100)
1604{ 1604{
1605 u32 to_us; 1605 u32 to_us;
@@ -1621,9 +1621,9 @@ void iwl_report_frame(struct iwl_priv *priv,
1621 u8 agc; 1621 u8 agc;
1622 u16 sig_avg; 1622 u16 sig_avg;
1623 u16 noise_diff; 1623 u16 noise_diff;
1624 struct iwl_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt); 1624 struct iwl3945_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt);
1625 struct iwl_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); 1625 struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
1626 struct iwl_rx_frame_end *rx_end = IWL_RX_END(pkt); 1626 struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt);
1627 u8 *data = IWL_RX_DATA(pkt); 1627 u8 *data = IWL_RX_DATA(pkt);
1628 1628
1629 /* MAC header */ 1629 /* MAC header */
@@ -1699,11 +1699,11 @@ void iwl_report_frame(struct iwl_priv *priv,
1699 else 1699 else
1700 title = "Frame"; 1700 title = "Frame";
1701 1701
1702 rate = iwl_rate_index_from_plcp(rate_sym); 1702 rate = iwl3945_rate_index_from_plcp(rate_sym);
1703 if (rate == -1) 1703 if (rate == -1)
1704 rate = 0; 1704 rate = 0;
1705 else 1705 else
1706 rate = iwl_rates[rate].ieee / 2; 1706 rate = iwl3945_rates[rate].ieee / 2;
1707 1707
1708 /* print frame summary. 1708 /* print frame summary.
1709 * MAC addresses show just the last byte (for brevity), 1709 * MAC addresses show just the last byte (for brevity),
@@ -1725,25 +1725,25 @@ void iwl_report_frame(struct iwl_priv *priv,
1725 } 1725 }
1726 } 1726 }
1727 if (print_dump) 1727 if (print_dump)
1728 iwl_print_hex_dump(IWL_DL_RX, data, length); 1728 iwl3945_print_hex_dump(IWL_DL_RX, data, length);
1729} 1729}
1730#endif 1730#endif
1731 1731
1732static void iwl_unset_hw_setting(struct iwl_priv *priv) 1732static void iwl3945_unset_hw_setting(struct iwl3945_priv *priv)
1733{ 1733{
1734 if (priv->hw_setting.shared_virt) 1734 if (priv->hw_setting.shared_virt)
1735 pci_free_consistent(priv->pci_dev, 1735 pci_free_consistent(priv->pci_dev,
1736 sizeof(struct iwl_shared), 1736 sizeof(struct iwl3945_shared),
1737 priv->hw_setting.shared_virt, 1737 priv->hw_setting.shared_virt,
1738 priv->hw_setting.shared_phys); 1738 priv->hw_setting.shared_phys);
1739} 1739}
1740 1740
1741/** 1741/**
1742 * iwl_supported_rate_to_ie - fill in the supported rate in IE field 1742 * iwl3945_supported_rate_to_ie - fill in the supported rate in IE field
1743 * 1743 *
1744 * return : set the bit for each supported rate insert in ie 1744 * return : set the bit for each supported rate insert in ie
1745 */ 1745 */
1746static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, 1746static u16 iwl3945_supported_rate_to_ie(u8 *ie, u16 supported_rate,
1747 u16 basic_rate, int *left) 1747 u16 basic_rate, int *left)
1748{ 1748{
1749 u16 ret_rates = 0, bit; 1749 u16 ret_rates = 0, bit;
@@ -1754,7 +1754,7 @@ static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate,
1754 for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { 1754 for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) {
1755 if (bit & supported_rate) { 1755 if (bit & supported_rate) {
1756 ret_rates |= bit; 1756 ret_rates |= bit;
1757 rates[*cnt] = iwl_rates[i].ieee | 1757 rates[*cnt] = iwl3945_rates[i].ieee |
1758 ((bit & basic_rate) ? 0x80 : 0x00); 1758 ((bit & basic_rate) ? 0x80 : 0x00);
1759 (*cnt)++; 1759 (*cnt)++;
1760 (*left)--; 1760 (*left)--;
@@ -1768,9 +1768,9 @@ static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate,
1768} 1768}
1769 1769
1770/** 1770/**
1771 * iwl_fill_probe_req - fill in all required fields and IE for probe request 1771 * iwl3945_fill_probe_req - fill in all required fields and IE for probe request
1772 */ 1772 */
1773static u16 iwl_fill_probe_req(struct iwl_priv *priv, 1773static u16 iwl3945_fill_probe_req(struct iwl3945_priv *priv,
1774 struct ieee80211_mgmt *frame, 1774 struct ieee80211_mgmt *frame,
1775 int left, int is_direct) 1775 int left, int is_direct)
1776{ 1776{
@@ -1786,9 +1786,9 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1786 len += 24; 1786 len += 24;
1787 1787
1788 frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); 1788 frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
1789 memcpy(frame->da, BROADCAST_ADDR, ETH_ALEN); 1789 memcpy(frame->da, iwl3945_broadcast_addr, ETH_ALEN);
1790 memcpy(frame->sa, priv->mac_addr, ETH_ALEN); 1790 memcpy(frame->sa, priv->mac_addr, ETH_ALEN);
1791 memcpy(frame->bssid, BROADCAST_ADDR, ETH_ALEN); 1791 memcpy(frame->bssid, iwl3945_broadcast_addr, ETH_ALEN);
1792 frame->seq_ctrl = 0; 1792 frame->seq_ctrl = 0;
1793 1793
1794 /* fill in our indirect SSID IE */ 1794 /* fill in our indirect SSID IE */
@@ -1831,11 +1831,11 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1831 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; 1831 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
1832 1832
1833 cck_rates = IWL_CCK_RATES_MASK & active_rates; 1833 cck_rates = IWL_CCK_RATES_MASK & active_rates;
1834 ret_rates = iwl_supported_rate_to_ie(pos, cck_rates, 1834 ret_rates = iwl3945_supported_rate_to_ie(pos, cck_rates,
1835 priv->active_rate_basic, &left); 1835 priv->active_rate_basic, &left);
1836 active_rates &= ~ret_rates; 1836 active_rates &= ~ret_rates;
1837 1837
1838 ret_rates = iwl_supported_rate_to_ie(pos, active_rates, 1838 ret_rates = iwl3945_supported_rate_to_ie(pos, active_rates,
1839 priv->active_rate_basic, &left); 1839 priv->active_rate_basic, &left);
1840 active_rates &= ~ret_rates; 1840 active_rates &= ~ret_rates;
1841 1841
@@ -1852,7 +1852,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1852 /* ... fill it in... */ 1852 /* ... fill it in... */
1853 *pos++ = WLAN_EID_EXT_SUPP_RATES; 1853 *pos++ = WLAN_EID_EXT_SUPP_RATES;
1854 *pos = 0; 1854 *pos = 0;
1855 iwl_supported_rate_to_ie(pos, active_rates, 1855 iwl3945_supported_rate_to_ie(pos, active_rates,
1856 priv->active_rate_basic, &left); 1856 priv->active_rate_basic, &left);
1857 if (*pos > 0) 1857 if (*pos > 0)
1858 len += 2 + *pos; 1858 len += 2 + *pos;
@@ -1865,15 +1865,15 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1865 * QoS support 1865 * QoS support
1866*/ 1866*/
1867#ifdef CONFIG_IWL3945_QOS 1867#ifdef CONFIG_IWL3945_QOS
1868static int iwl_send_qos_params_command(struct iwl_priv *priv, 1868static int iwl3945_send_qos_params_command(struct iwl3945_priv *priv,
1869 struct iwl_qosparam_cmd *qos) 1869 struct iwl3945_qosparam_cmd *qos)
1870{ 1870{
1871 1871
1872 return iwl_send_cmd_pdu(priv, REPLY_QOS_PARAM, 1872 return iwl3945_send_cmd_pdu(priv, REPLY_QOS_PARAM,
1873 sizeof(struct iwl_qosparam_cmd), qos); 1873 sizeof(struct iwl3945_qosparam_cmd), qos);
1874} 1874}
1875 1875
1876static void iwl_reset_qos(struct iwl_priv *priv) 1876static void iwl3945_reset_qos(struct iwl3945_priv *priv)
1877{ 1877{
1878 u16 cw_min = 15; 1878 u16 cw_min = 15;
1879 u16 cw_max = 1023; 1879 u16 cw_max = 1023;
@@ -1960,7 +1960,7 @@ static void iwl_reset_qos(struct iwl_priv *priv)
1960 spin_unlock_irqrestore(&priv->lock, flags); 1960 spin_unlock_irqrestore(&priv->lock, flags);
1961} 1961}
1962 1962
1963static void iwl_activate_qos(struct iwl_priv *priv, u8 force) 1963static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force)
1964{ 1964{
1965 unsigned long flags; 1965 unsigned long flags;
1966 1966
@@ -1984,11 +1984,11 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force)
1984 1984
1985 spin_unlock_irqrestore(&priv->lock, flags); 1985 spin_unlock_irqrestore(&priv->lock, flags);
1986 1986
1987 if (force || iwl_is_associated(priv)) { 1987 if (force || iwl3945_is_associated(priv)) {
1988 IWL_DEBUG_QOS("send QoS cmd with Qos active %d \n", 1988 IWL_DEBUG_QOS("send QoS cmd with Qos active %d \n",
1989 priv->qos_data.qos_active); 1989 priv->qos_data.qos_active);
1990 1990
1991 iwl_send_qos_params_command(priv, 1991 iwl3945_send_qos_params_command(priv,
1992 &(priv->qos_data.def_qos_parm)); 1992 &(priv->qos_data.def_qos_parm));
1993 } 1993 }
1994} 1994}
@@ -2011,7 +2011,7 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force)
2011 2011
2012/* default power management (not Tx power) table values */ 2012/* default power management (not Tx power) table values */
2013/* for tim 0-10 */ 2013/* for tim 0-10 */
2014static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = { 2014static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = {
2015 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 2015 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
2016 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, 2016 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0},
2017 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 7)}, 0}, 2017 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 7)}, 0},
@@ -2021,7 +2021,7 @@ static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = {
2021}; 2021};
2022 2022
2023/* for tim > 10 */ 2023/* for tim > 10 */
2024static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = { 2024static struct iwl3945_power_vec_entry range_1[IWL_POWER_AC] = {
2025 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 2025 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
2026 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), 2026 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500),
2027 SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, 2027 SLP_VEC(1, 2, 3, 4, 0xFF)}, 0},
@@ -2034,11 +2034,11 @@ static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = {
2034 SLP_VEC(4, 7, 10, 10, 0xFF)}, 0} 2034 SLP_VEC(4, 7, 10, 10, 0xFF)}, 0}
2035}; 2035};
2036 2036
2037int iwl_power_init_handle(struct iwl_priv *priv) 2037int iwl3945_power_init_handle(struct iwl3945_priv *priv)
2038{ 2038{
2039 int rc = 0, i; 2039 int rc = 0, i;
2040 struct iwl_power_mgr *pow_data; 2040 struct iwl3945_power_mgr *pow_data;
2041 int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_AC; 2041 int size = sizeof(struct iwl3945_power_vec_entry) * IWL_POWER_AC;
2042 u16 pci_pm; 2042 u16 pci_pm;
2043 2043
2044 IWL_DEBUG_POWER("Initialize power \n"); 2044 IWL_DEBUG_POWER("Initialize power \n");
@@ -2057,7 +2057,7 @@ int iwl_power_init_handle(struct iwl_priv *priv)
2057 if (rc != 0) 2057 if (rc != 0)
2058 return 0; 2058 return 0;
2059 else { 2059 else {
2060 struct iwl_powertable_cmd *cmd; 2060 struct iwl3945_powertable_cmd *cmd;
2061 2061
2062 IWL_DEBUG_POWER("adjust power command flags\n"); 2062 IWL_DEBUG_POWER("adjust power command flags\n");
2063 2063
@@ -2073,15 +2073,15 @@ int iwl_power_init_handle(struct iwl_priv *priv)
2073 return rc; 2073 return rc;
2074} 2074}
2075 2075
2076static int iwl_update_power_cmd(struct iwl_priv *priv, 2076static int iwl3945_update_power_cmd(struct iwl3945_priv *priv,
2077 struct iwl_powertable_cmd *cmd, u32 mode) 2077 struct iwl3945_powertable_cmd *cmd, u32 mode)
2078{ 2078{
2079 int rc = 0, i; 2079 int rc = 0, i;
2080 u8 skip; 2080 u8 skip;
2081 u32 max_sleep = 0; 2081 u32 max_sleep = 0;
2082 struct iwl_power_vec_entry *range; 2082 struct iwl3945_power_vec_entry *range;
2083 u8 period = 0; 2083 u8 period = 0;
2084 struct iwl_power_mgr *pow_data; 2084 struct iwl3945_power_mgr *pow_data;
2085 2085
2086 if (mode > IWL_POWER_INDEX_5) { 2086 if (mode > IWL_POWER_INDEX_5) {
2087 IWL_DEBUG_POWER("Error invalid power mode \n"); 2087 IWL_DEBUG_POWER("Error invalid power mode \n");
@@ -2094,7 +2094,7 @@ static int iwl_update_power_cmd(struct iwl_priv *priv,
2094 else 2094 else
2095 range = &pow_data->pwr_range_1[1]; 2095 range = &pow_data->pwr_range_1[1];
2096 2096
2097 memcpy(cmd, &range[mode].cmd, sizeof(struct iwl_powertable_cmd)); 2097 memcpy(cmd, &range[mode].cmd, sizeof(struct iwl3945_powertable_cmd));
2098 2098
2099#ifdef IWL_MAC80211_DISABLE 2099#ifdef IWL_MAC80211_DISABLE
2100 if (priv->assoc_network != NULL) { 2100 if (priv->assoc_network != NULL) {
@@ -2137,11 +2137,11 @@ static int iwl_update_power_cmd(struct iwl_priv *priv,
2137 return rc; 2137 return rc;
2138} 2138}
2139 2139
2140static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode) 2140static int iwl3945_send_power_mode(struct iwl3945_priv *priv, u32 mode)
2141{ 2141{
2142 u32 final_mode = mode; 2142 u32 final_mode = mode;
2143 int rc; 2143 int rc;
2144 struct iwl_powertable_cmd cmd; 2144 struct iwl3945_powertable_cmd cmd;
2145 2145
2146 /* If on battery, set to 3, 2146 /* If on battery, set to 3,
2147 * if plugged into AC power, set to CAM ("continuously aware mode"), 2147 * if plugged into AC power, set to CAM ("continuously aware mode"),
@@ -2158,9 +2158,9 @@ static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode)
2158 break; 2158 break;
2159 } 2159 }
2160 2160
2161 iwl_update_power_cmd(priv, &cmd, final_mode); 2161 iwl3945_update_power_cmd(priv, &cmd, final_mode);
2162 2162
2163 rc = iwl_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd); 2163 rc = iwl3945_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd);
2164 2164
2165 if (final_mode == IWL_POWER_MODE_CAM) 2165 if (final_mode == IWL_POWER_MODE_CAM)
2166 clear_bit(STATUS_POWER_PMI, &priv->status); 2166 clear_bit(STATUS_POWER_PMI, &priv->status);
@@ -2170,7 +2170,7 @@ static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode)
2170 return rc; 2170 return rc;
2171} 2171}
2172 2172
2173int iwl_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) 2173int iwl3945_is_network_packet(struct iwl3945_priv *priv, struct ieee80211_hdr *header)
2174{ 2174{
2175 /* Filter incoming packets to determine if they are targeted toward 2175 /* Filter incoming packets to determine if they are targeted toward
2176 * this network, discarding packets coming from ourselves */ 2176 * this network, discarding packets coming from ourselves */
@@ -2200,7 +2200,7 @@ int iwl_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *header)
2200 2200
2201#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x 2201#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x
2202 2202
2203static const char *iwl_get_tx_fail_reason(u32 status) 2203static const char *iwl3945_get_tx_fail_reason(u32 status)
2204{ 2204{
2205 switch (status & TX_STATUS_MSK) { 2205 switch (status & TX_STATUS_MSK) {
2206 case TX_STATUS_SUCCESS: 2206 case TX_STATUS_SUCCESS:
@@ -2227,11 +2227,11 @@ static const char *iwl_get_tx_fail_reason(u32 status)
2227} 2227}
2228 2228
2229/** 2229/**
2230 * iwl_scan_cancel - Cancel any currently executing HW scan 2230 * iwl3945_scan_cancel - Cancel any currently executing HW scan
2231 * 2231 *
2232 * NOTE: priv->mutex is not required before calling this function 2232 * NOTE: priv->mutex is not required before calling this function
2233 */ 2233 */
2234static int iwl_scan_cancel(struct iwl_priv *priv) 2234static int iwl3945_scan_cancel(struct iwl3945_priv *priv)
2235{ 2235{
2236 if (!test_bit(STATUS_SCAN_HW, &priv->status)) { 2236 if (!test_bit(STATUS_SCAN_HW, &priv->status)) {
2237 clear_bit(STATUS_SCANNING, &priv->status); 2237 clear_bit(STATUS_SCANNING, &priv->status);
@@ -2254,17 +2254,17 @@ static int iwl_scan_cancel(struct iwl_priv *priv)
2254} 2254}
2255 2255
2256/** 2256/**
2257 * iwl_scan_cancel_timeout - Cancel any currently executing HW scan 2257 * iwl3945_scan_cancel_timeout - Cancel any currently executing HW scan
2258 * @ms: amount of time to wait (in milliseconds) for scan to abort 2258 * @ms: amount of time to wait (in milliseconds) for scan to abort
2259 * 2259 *
2260 * NOTE: priv->mutex must be held before calling this function 2260 * NOTE: priv->mutex must be held before calling this function
2261 */ 2261 */
2262static int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) 2262static int iwl3945_scan_cancel_timeout(struct iwl3945_priv *priv, unsigned long ms)
2263{ 2263{
2264 unsigned long now = jiffies; 2264 unsigned long now = jiffies;
2265 int ret; 2265 int ret;
2266 2266
2267 ret = iwl_scan_cancel(priv); 2267 ret = iwl3945_scan_cancel(priv);
2268 if (ret && ms) { 2268 if (ret && ms) {
2269 mutex_unlock(&priv->mutex); 2269 mutex_unlock(&priv->mutex);
2270 while (!time_after(jiffies, now + msecs_to_jiffies(ms)) && 2270 while (!time_after(jiffies, now + msecs_to_jiffies(ms)) &&
@@ -2278,7 +2278,7 @@ static int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)
2278 return ret; 2278 return ret;
2279} 2279}
2280 2280
2281static void iwl_sequence_reset(struct iwl_priv *priv) 2281static void iwl3945_sequence_reset(struct iwl3945_priv *priv)
2282{ 2282{
2283 /* Reset ieee stats */ 2283 /* Reset ieee stats */
2284 2284
@@ -2289,13 +2289,13 @@ static void iwl_sequence_reset(struct iwl_priv *priv)
2289 priv->last_frag_num = -1; 2289 priv->last_frag_num = -1;
2290 priv->last_packet_time = 0; 2290 priv->last_packet_time = 0;
2291 2291
2292 iwl_scan_cancel(priv); 2292 iwl3945_scan_cancel(priv);
2293} 2293}
2294 2294
2295#define MAX_UCODE_BEACON_INTERVAL 1024 2295#define MAX_UCODE_BEACON_INTERVAL 1024
2296#define INTEL_CONN_LISTEN_INTERVAL __constant_cpu_to_le16(0xA) 2296#define INTEL_CONN_LISTEN_INTERVAL __constant_cpu_to_le16(0xA)
2297 2297
2298static __le16 iwl_adjust_beacon_interval(u16 beacon_val) 2298static __le16 iwl3945_adjust_beacon_interval(u16 beacon_val)
2299{ 2299{
2300 u16 new_val = 0; 2300 u16 new_val = 0;
2301 u16 beacon_factor = 0; 2301 u16 beacon_factor = 0;
@@ -2308,7 +2308,7 @@ static __le16 iwl_adjust_beacon_interval(u16 beacon_val)
2308 return cpu_to_le16(new_val); 2308 return cpu_to_le16(new_val);
2309} 2309}
2310 2310
2311static void iwl_setup_rxon_timing(struct iwl_priv *priv) 2311static void iwl3945_setup_rxon_timing(struct iwl3945_priv *priv)
2312{ 2312{
2313 u64 interval_tm_unit; 2313 u64 interval_tm_unit;
2314 u64 tsf, result; 2314 u64 tsf, result;
@@ -2338,14 +2338,14 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv)
2338 priv->rxon_timing.beacon_interval = 2338 priv->rxon_timing.beacon_interval =
2339 cpu_to_le16(beacon_int); 2339 cpu_to_le16(beacon_int);
2340 priv->rxon_timing.beacon_interval = 2340 priv->rxon_timing.beacon_interval =
2341 iwl_adjust_beacon_interval( 2341 iwl3945_adjust_beacon_interval(
2342 le16_to_cpu(priv->rxon_timing.beacon_interval)); 2342 le16_to_cpu(priv->rxon_timing.beacon_interval));
2343 } 2343 }
2344 2344
2345 priv->rxon_timing.atim_window = 0; 2345 priv->rxon_timing.atim_window = 0;
2346 } else { 2346 } else {
2347 priv->rxon_timing.beacon_interval = 2347 priv->rxon_timing.beacon_interval =
2348 iwl_adjust_beacon_interval(conf->beacon_int); 2348 iwl3945_adjust_beacon_interval(conf->beacon_int);
2349 /* TODO: we need to get atim_window from upper stack 2349 /* TODO: we need to get atim_window from upper stack
2350 * for now we set to 0 */ 2350 * for now we set to 0 */
2351 priv->rxon_timing.atim_window = 0; 2351 priv->rxon_timing.atim_window = 0;
@@ -2364,14 +2364,14 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv)
2364 le16_to_cpu(priv->rxon_timing.atim_window)); 2364 le16_to_cpu(priv->rxon_timing.atim_window));
2365} 2365}
2366 2366
2367static int iwl_scan_initiate(struct iwl_priv *priv) 2367static int iwl3945_scan_initiate(struct iwl3945_priv *priv)
2368{ 2368{
2369 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { 2369 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) {
2370 IWL_ERROR("APs don't scan.\n"); 2370 IWL_ERROR("APs don't scan.\n");
2371 return 0; 2371 return 0;
2372 } 2372 }
2373 2373
2374 if (!iwl_is_ready_rf(priv)) { 2374 if (!iwl3945_is_ready_rf(priv)) {
2375 IWL_DEBUG_SCAN("Aborting scan due to not ready.\n"); 2375 IWL_DEBUG_SCAN("Aborting scan due to not ready.\n");
2376 return -EIO; 2376 return -EIO;
2377 } 2377 }
@@ -2398,9 +2398,9 @@ static int iwl_scan_initiate(struct iwl_priv *priv)
2398 return 0; 2398 return 0;
2399} 2399}
2400 2400
2401static int iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) 2401static int iwl3945_set_rxon_hwcrypto(struct iwl3945_priv *priv, int hw_decrypt)
2402{ 2402{
2403 struct iwl_rxon_cmd *rxon = &priv->staging_rxon; 2403 struct iwl3945_rxon_cmd *rxon = &priv->staging_rxon;
2404 2404
2405 if (hw_decrypt) 2405 if (hw_decrypt)
2406 rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; 2406 rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK;
@@ -2410,7 +2410,7 @@ static int iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt)
2410 return 0; 2410 return 0;
2411} 2411}
2412 2412
2413static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode) 2413static void iwl3945_set_flags_for_phymode(struct iwl3945_priv *priv, u8 phymode)
2414{ 2414{
2415 if (phymode == MODE_IEEE80211A) { 2415 if (phymode == MODE_IEEE80211A) {
2416 priv->staging_rxon.flags &= 2416 priv->staging_rxon.flags &=
@@ -2418,7 +2418,7 @@ static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode)
2418 | RXON_FLG_CCK_MSK); 2418 | RXON_FLG_CCK_MSK);
2419 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; 2419 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
2420 } else { 2420 } else {
2421 /* Copied from iwl_bg_post_associate() */ 2421 /* Copied from iwl3945_bg_post_associate() */
2422 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) 2422 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
2423 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; 2423 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
2424 else 2424 else
@@ -2436,9 +2436,9 @@ static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode)
2436/* 2436/*
2437 * initialize rxon structure with default values from eeprom 2437 * initialize rxon structure with default values from eeprom
2438 */ 2438 */
2439static void iwl_connection_init_rx_config(struct iwl_priv *priv) 2439static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv)
2440{ 2440{
2441 const struct iwl_channel_info *ch_info; 2441 const struct iwl3945_channel_info *ch_info;
2442 2442
2443 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); 2443 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon));
2444 2444
@@ -2475,7 +2475,7 @@ static void iwl_connection_init_rx_config(struct iwl_priv *priv)
2475 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 2475 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
2476#endif 2476#endif
2477 2477
2478 ch_info = iwl_get_channel_info(priv, priv->phymode, 2478 ch_info = iwl3945_get_channel_info(priv, priv->phymode,
2479 le16_to_cpu(priv->staging_rxon.channel)); 2479 le16_to_cpu(priv->staging_rxon.channel));
2480 2480
2481 if (!ch_info) 2481 if (!ch_info)
@@ -2495,7 +2495,7 @@ static void iwl_connection_init_rx_config(struct iwl_priv *priv)
2495 else 2495 else
2496 priv->phymode = MODE_IEEE80211G; 2496 priv->phymode = MODE_IEEE80211G;
2497 2497
2498 iwl_set_flags_for_phymode(priv, priv->phymode); 2498 iwl3945_set_flags_for_phymode(priv, priv->phymode);
2499 2499
2500 priv->staging_rxon.ofdm_basic_rates = 2500 priv->staging_rxon.ofdm_basic_rates =
2501 (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; 2501 (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
@@ -2503,15 +2503,15 @@ static void iwl_connection_init_rx_config(struct iwl_priv *priv)
2503 (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF; 2503 (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
2504} 2504}
2505 2505
2506static int iwl_set_mode(struct iwl_priv *priv, int mode) 2506static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode)
2507{ 2507{
2508 if (!iwl_is_ready_rf(priv)) 2508 if (!iwl3945_is_ready_rf(priv))
2509 return -EAGAIN; 2509 return -EAGAIN;
2510 2510
2511 if (mode == IEEE80211_IF_TYPE_IBSS) { 2511 if (mode == IEEE80211_IF_TYPE_IBSS) {
2512 const struct iwl_channel_info *ch_info; 2512 const struct iwl3945_channel_info *ch_info;
2513 2513
2514 ch_info = iwl_get_channel_info(priv, 2514 ch_info = iwl3945_get_channel_info(priv,
2515 priv->phymode, 2515 priv->phymode,
2516 le16_to_cpu(priv->staging_rxon.channel)); 2516 le16_to_cpu(priv->staging_rxon.channel));
2517 2517
@@ -2523,7 +2523,7 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode)
2523 } 2523 }
2524 2524
2525 cancel_delayed_work(&priv->scan_check); 2525 cancel_delayed_work(&priv->scan_check);
2526 if (iwl_scan_cancel_timeout(priv, 100)) { 2526 if (iwl3945_scan_cancel_timeout(priv, 100)) {
2527 IWL_WARNING("Aborted scan still in progress after 100ms\n"); 2527 IWL_WARNING("Aborted scan still in progress after 100ms\n");
2528 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); 2528 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n");
2529 return -EAGAIN; 2529 return -EAGAIN;
@@ -2531,23 +2531,23 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode)
2531 2531
2532 priv->iw_mode = mode; 2532 priv->iw_mode = mode;
2533 2533
2534 iwl_connection_init_rx_config(priv); 2534 iwl3945_connection_init_rx_config(priv);
2535 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); 2535 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
2536 2536
2537 iwl_clear_stations_table(priv); 2537 iwl3945_clear_stations_table(priv);
2538 2538
2539 iwl_commit_rxon(priv); 2539 iwl3945_commit_rxon(priv);
2540 2540
2541 return 0; 2541 return 0;
2542} 2542}
2543 2543
2544static void iwl_build_tx_cmd_hwcrypto(struct iwl_priv *priv, 2544static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
2545 struct ieee80211_tx_control *ctl, 2545 struct ieee80211_tx_control *ctl,
2546 struct iwl_cmd *cmd, 2546 struct iwl3945_cmd *cmd,
2547 struct sk_buff *skb_frag, 2547 struct sk_buff *skb_frag,
2548 int last_frag) 2548 int last_frag)
2549{ 2549{
2550 struct iwl_hw_key *keyinfo = &priv->stations[ctl->key_idx].keyinfo; 2550 struct iwl3945_hw_key *keyinfo = &priv->stations[ctl->key_idx].keyinfo;
2551 2551
2552 switch (keyinfo->alg) { 2552 switch (keyinfo->alg) {
2553 case ALG_CCMP: 2553 case ALG_CCMP:
@@ -2590,8 +2590,8 @@ static void iwl_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
2590/* 2590/*
2591 * handle build REPLY_TX command notification. 2591 * handle build REPLY_TX command notification.
2592 */ 2592 */
2593static void iwl_build_tx_cmd_basic(struct iwl_priv *priv, 2593static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
2594 struct iwl_cmd *cmd, 2594 struct iwl3945_cmd *cmd,
2595 struct ieee80211_tx_control *ctrl, 2595 struct ieee80211_tx_control *ctrl,
2596 struct ieee80211_hdr *hdr, 2596 struct ieee80211_hdr *hdr,
2597 int is_unicast, u8 std_id) 2597 int is_unicast, u8 std_id)
@@ -2650,7 +2650,7 @@ static void iwl_build_tx_cmd_basic(struct iwl_priv *priv,
2650 cmd->cmd.tx.next_frame_len = 0; 2650 cmd->cmd.tx.next_frame_len = 0;
2651} 2651}
2652 2652
2653static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) 2653static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *hdr)
2654{ 2654{
2655 int sta_id; 2655 int sta_id;
2656 u16 fc = le16_to_cpu(hdr->frame_control); 2656 u16 fc = le16_to_cpu(hdr->frame_control);
@@ -2670,7 +2670,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
2670 2670
2671 /* If we are an AP, then find the station, or use BCAST */ 2671 /* If we are an AP, then find the station, or use BCAST */
2672 case IEEE80211_IF_TYPE_AP: 2672 case IEEE80211_IF_TYPE_AP:
2673 sta_id = iwl_hw_find_station(priv, hdr->addr1); 2673 sta_id = iwl3945_hw_find_station(priv, hdr->addr1);
2674 if (sta_id != IWL_INVALID_STATION) 2674 if (sta_id != IWL_INVALID_STATION)
2675 return sta_id; 2675 return sta_id;
2676 return priv->hw_setting.bcast_sta_id; 2676 return priv->hw_setting.bcast_sta_id;
@@ -2680,11 +2680,11 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
2680 case IEEE80211_IF_TYPE_IBSS: { 2680 case IEEE80211_IF_TYPE_IBSS: {
2681 DECLARE_MAC_BUF(mac); 2681 DECLARE_MAC_BUF(mac);
2682 2682
2683 sta_id = iwl_hw_find_station(priv, hdr->addr1); 2683 sta_id = iwl3945_hw_find_station(priv, hdr->addr1);
2684 if (sta_id != IWL_INVALID_STATION) 2684 if (sta_id != IWL_INVALID_STATION)
2685 return sta_id; 2685 return sta_id;
2686 2686
2687 sta_id = iwl_add_station(priv, hdr->addr1, 0, CMD_ASYNC); 2687 sta_id = iwl3945_add_station(priv, hdr->addr1, 0, CMD_ASYNC);
2688 2688
2689 if (sta_id != IWL_INVALID_STATION) 2689 if (sta_id != IWL_INVALID_STATION)
2690 return sta_id; 2690 return sta_id;
@@ -2692,7 +2692,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
2692 IWL_DEBUG_DROP("Station %s not in station map. " 2692 IWL_DEBUG_DROP("Station %s not in station map. "
2693 "Defaulting to broadcast...\n", 2693 "Defaulting to broadcast...\n",
2694 print_mac(mac, hdr->addr1)); 2694 print_mac(mac, hdr->addr1));
2695 iwl_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); 2695 iwl3945_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr));
2696 return priv->hw_setting.bcast_sta_id; 2696 return priv->hw_setting.bcast_sta_id;
2697 } 2697 }
2698 default: 2698 default:
@@ -2704,18 +2704,18 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
2704/* 2704/*
2705 * start REPLY_TX command process 2705 * start REPLY_TX command process
2706 */ 2706 */
2707static int iwl_tx_skb(struct iwl_priv *priv, 2707static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2708 struct sk_buff *skb, struct ieee80211_tx_control *ctl) 2708 struct sk_buff *skb, struct ieee80211_tx_control *ctl)
2709{ 2709{
2710 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 2710 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2711 struct iwl_tfd_frame *tfd; 2711 struct iwl3945_tfd_frame *tfd;
2712 u32 *control_flags; 2712 u32 *control_flags;
2713 int txq_id = ctl->queue; 2713 int txq_id = ctl->queue;
2714 struct iwl_tx_queue *txq = NULL; 2714 struct iwl3945_tx_queue *txq = NULL;
2715 struct iwl_queue *q = NULL; 2715 struct iwl3945_queue *q = NULL;
2716 dma_addr_t phys_addr; 2716 dma_addr_t phys_addr;
2717 dma_addr_t txcmd_phys; 2717 dma_addr_t txcmd_phys;
2718 struct iwl_cmd *out_cmd = NULL; 2718 struct iwl3945_cmd *out_cmd = NULL;
2719 u16 len, idx, len_org; 2719 u16 len, idx, len_org;
2720 u8 id, hdr_len, unicast; 2720 u8 id, hdr_len, unicast;
2721 u8 sta_id; 2721 u8 sta_id;
@@ -2727,7 +2727,7 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2727 int rc; 2727 int rc;
2728 2728
2729 spin_lock_irqsave(&priv->lock, flags); 2729 spin_lock_irqsave(&priv->lock, flags);
2730 if (iwl_is_rfkill(priv)) { 2730 if (iwl3945_is_rfkill(priv)) {
2731 IWL_DEBUG_DROP("Dropping - RF KILL\n"); 2731 IWL_DEBUG_DROP("Dropping - RF KILL\n");
2732 goto drop_unlock; 2732 goto drop_unlock;
2733 } 2733 }
@@ -2756,16 +2756,16 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2756 IWL_DEBUG_TX("Sending REASSOC frame\n"); 2756 IWL_DEBUG_TX("Sending REASSOC frame\n");
2757#endif 2757#endif
2758 2758
2759 if (!iwl_is_associated(priv) && 2759 if (!iwl3945_is_associated(priv) &&
2760 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { 2760 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) {
2761 IWL_DEBUG_DROP("Dropping - !iwl_is_associated\n"); 2761 IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n");
2762 goto drop_unlock; 2762 goto drop_unlock;
2763 } 2763 }
2764 2764
2765 spin_unlock_irqrestore(&priv->lock, flags); 2765 spin_unlock_irqrestore(&priv->lock, flags);
2766 2766
2767 hdr_len = ieee80211_get_hdrlen(fc); 2767 hdr_len = ieee80211_get_hdrlen(fc);
2768 sta_id = iwl_get_sta_id(priv, hdr); 2768 sta_id = iwl3945_get_sta_id(priv, hdr);
2769 if (sta_id == IWL_INVALID_STATION) { 2769 if (sta_id == IWL_INVALID_STATION) {
2770 DECLARE_MAC_BUF(mac); 2770 DECLARE_MAC_BUF(mac);
2771 2771
@@ -2796,7 +2796,7 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2796 control_flags = (u32 *) tfd; 2796 control_flags = (u32 *) tfd;
2797 idx = get_cmd_index(q, q->write_ptr, 0); 2797 idx = get_cmd_index(q, q->write_ptr, 0);
2798 2798
2799 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); 2799 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl3945_tx_info));
2800 txq->txb[q->write_ptr].skb[0] = skb; 2800 txq->txb[q->write_ptr].skb[0] = skb;
2801 memcpy(&(txq->txb[q->write_ptr].status.control), 2801 memcpy(&(txq->txb[q->write_ptr].status.control),
2802 ctl, sizeof(struct ieee80211_tx_control)); 2802 ctl, sizeof(struct ieee80211_tx_control));
@@ -2811,7 +2811,7 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2811 2811
2812 /* hdr = (struct ieee80211_hdr *)out_cmd->cmd.tx.hdr; */ 2812 /* hdr = (struct ieee80211_hdr *)out_cmd->cmd.tx.hdr; */
2813 len = priv->hw_setting.tx_cmd_len + 2813 len = priv->hw_setting.tx_cmd_len +
2814 sizeof(struct iwl_cmd_header) + hdr_len; 2814 sizeof(struct iwl3945_cmd_header) + hdr_len;
2815 2815
2816 len_org = len; 2816 len_org = len;
2817 len = (len + 3) & ~3; 2817 len = (len + 3) & ~3;
@@ -2821,20 +2821,20 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2821 else 2821 else
2822 len_org = 0; 2822 len_org = 0;
2823 2823
2824 txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl_cmd) * idx + 2824 txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl3945_cmd) * idx +
2825 offsetof(struct iwl_cmd, hdr); 2825 offsetof(struct iwl3945_cmd, hdr);
2826 2826
2827 iwl_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); 2827 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len);
2828 2828
2829 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) 2829 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT))
2830 iwl_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0); 2830 iwl3945_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0);
2831 2831
2832 /* 802.11 null functions have no payload... */ 2832 /* 802.11 null functions have no payload... */
2833 len = skb->len - hdr_len; 2833 len = skb->len - hdr_len;
2834 if (len) { 2834 if (len) {
2835 phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, 2835 phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len,
2836 len, PCI_DMA_TODEVICE); 2836 len, PCI_DMA_TODEVICE);
2837 iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len); 2837 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len);
2838 } 2838 }
2839 2839
2840 /* If there is no payload, then only one TFD is used */ 2840 /* If there is no payload, then only one TFD is used */
@@ -2848,10 +2848,10 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2848 out_cmd->cmd.tx.len = cpu_to_le16(len); 2848 out_cmd->cmd.tx.len = cpu_to_le16(len);
2849 2849
2850 /* TODO need this for burst mode later on */ 2850 /* TODO need this for burst mode later on */
2851 iwl_build_tx_cmd_basic(priv, out_cmd, ctl, hdr, unicast, sta_id); 2851 iwl3945_build_tx_cmd_basic(priv, out_cmd, ctl, hdr, unicast, sta_id);
2852 2852
2853 /* set is_hcca to 0; it probably will never be implemented */ 2853 /* set is_hcca to 0; it probably will never be implemented */
2854 iwl_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0); 2854 iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0);
2855 2855
2856 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; 2856 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
2857 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; 2857 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
@@ -2867,25 +2867,25 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2867 txq->need_update = 0; 2867 txq->need_update = 0;
2868 } 2868 }
2869 2869
2870 iwl_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload, 2870 iwl3945_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload,
2871 sizeof(out_cmd->cmd.tx)); 2871 sizeof(out_cmd->cmd.tx));
2872 2872
2873 iwl_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, 2873 iwl3945_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr,
2874 ieee80211_get_hdrlen(fc)); 2874 ieee80211_get_hdrlen(fc));
2875 2875
2876 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 2876 q->write_ptr = iwl3945_queue_inc_wrap(q->write_ptr, q->n_bd);
2877 rc = iwl_tx_queue_update_write_ptr(priv, txq); 2877 rc = iwl3945_tx_queue_update_write_ptr(priv, txq);
2878 spin_unlock_irqrestore(&priv->lock, flags); 2878 spin_unlock_irqrestore(&priv->lock, flags);
2879 2879
2880 if (rc) 2880 if (rc)
2881 return rc; 2881 return rc;
2882 2882
2883 if ((iwl_queue_space(q) < q->high_mark) 2883 if ((iwl3945_queue_space(q) < q->high_mark)
2884 && priv->mac80211_registered) { 2884 && priv->mac80211_registered) {
2885 if (wait_write_ptr) { 2885 if (wait_write_ptr) {
2886 spin_lock_irqsave(&priv->lock, flags); 2886 spin_lock_irqsave(&priv->lock, flags);
2887 txq->need_update = 1; 2887 txq->need_update = 1;
2888 iwl_tx_queue_update_write_ptr(priv, txq); 2888 iwl3945_tx_queue_update_write_ptr(priv, txq);
2889 spin_unlock_irqrestore(&priv->lock, flags); 2889 spin_unlock_irqrestore(&priv->lock, flags);
2890 } 2890 }
2891 2891
@@ -2900,13 +2900,13 @@ drop:
2900 return -1; 2900 return -1;
2901} 2901}
2902 2902
2903static void iwl_set_rate(struct iwl_priv *priv) 2903static void iwl3945_set_rate(struct iwl3945_priv *priv)
2904{ 2904{
2905 const struct ieee80211_hw_mode *hw = NULL; 2905 const struct ieee80211_hw_mode *hw = NULL;
2906 struct ieee80211_rate *rate; 2906 struct ieee80211_rate *rate;
2907 int i; 2907 int i;
2908 2908
2909 hw = iwl_get_hw_mode(priv, priv->phymode); 2909 hw = iwl3945_get_hw_mode(priv, priv->phymode);
2910 if (!hw) { 2910 if (!hw) {
2911 IWL_ERROR("Failed to set rate: unable to get hw mode\n"); 2911 IWL_ERROR("Failed to set rate: unable to get hw mode\n");
2912 return; 2912 return;
@@ -2924,7 +2924,7 @@ static void iwl_set_rate(struct iwl_priv *priv)
2924 if ((rate->val < IWL_RATE_COUNT) && 2924 if ((rate->val < IWL_RATE_COUNT) &&
2925 (rate->flags & IEEE80211_RATE_SUPPORTED)) { 2925 (rate->flags & IEEE80211_RATE_SUPPORTED)) {
2926 IWL_DEBUG_RATE("Adding rate index %d (plcp %d)%s\n", 2926 IWL_DEBUG_RATE("Adding rate index %d (plcp %d)%s\n",
2927 rate->val, iwl_rates[rate->val].plcp, 2927 rate->val, iwl3945_rates[rate->val].plcp,
2928 (rate->flags & IEEE80211_RATE_BASIC) ? 2928 (rate->flags & IEEE80211_RATE_BASIC) ?
2929 "*" : ""); 2929 "*" : "");
2930 priv->active_rate |= (1 << rate->val); 2930 priv->active_rate |= (1 << rate->val);
@@ -2932,7 +2932,7 @@ static void iwl_set_rate(struct iwl_priv *priv)
2932 priv->active_rate_basic |= (1 << rate->val); 2932 priv->active_rate_basic |= (1 << rate->val);
2933 } else 2933 } else
2934 IWL_DEBUG_RATE("Not adding rate %d (plcp %d)\n", 2934 IWL_DEBUG_RATE("Not adding rate %d (plcp %d)\n",
2935 rate->val, iwl_rates[rate->val].plcp); 2935 rate->val, iwl3945_rates[rate->val].plcp);
2936 } 2936 }
2937 2937
2938 IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n", 2938 IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n",
@@ -2961,7 +2961,7 @@ static void iwl_set_rate(struct iwl_priv *priv)
2961 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; 2961 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
2962} 2962}
2963 2963
2964static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio) 2964static void iwl3945_radio_kill_sw(struct iwl3945_priv *priv, int disable_radio)
2965{ 2965{
2966 unsigned long flags; 2966 unsigned long flags;
2967 2967
@@ -2972,21 +2972,21 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
2972 disable_radio ? "OFF" : "ON"); 2972 disable_radio ? "OFF" : "ON");
2973 2973
2974 if (disable_radio) { 2974 if (disable_radio) {
2975 iwl_scan_cancel(priv); 2975 iwl3945_scan_cancel(priv);
2976 /* FIXME: This is a workaround for AP */ 2976 /* FIXME: This is a workaround for AP */
2977 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { 2977 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) {
2978 spin_lock_irqsave(&priv->lock, flags); 2978 spin_lock_irqsave(&priv->lock, flags);
2979 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, 2979 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_SET,
2980 CSR_UCODE_SW_BIT_RFKILL); 2980 CSR_UCODE_SW_BIT_RFKILL);
2981 spin_unlock_irqrestore(&priv->lock, flags); 2981 spin_unlock_irqrestore(&priv->lock, flags);
2982 iwl_send_card_state(priv, CARD_STATE_CMD_DISABLE, 0); 2982 iwl3945_send_card_state(priv, CARD_STATE_CMD_DISABLE, 0);
2983 set_bit(STATUS_RF_KILL_SW, &priv->status); 2983 set_bit(STATUS_RF_KILL_SW, &priv->status);
2984 } 2984 }
2985 return; 2985 return;
2986 } 2986 }
2987 2987
2988 spin_lock_irqsave(&priv->lock, flags); 2988 spin_lock_irqsave(&priv->lock, flags);
2989 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 2989 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
2990 2990
2991 clear_bit(STATUS_RF_KILL_SW, &priv->status); 2991 clear_bit(STATUS_RF_KILL_SW, &priv->status);
2992 spin_unlock_irqrestore(&priv->lock, flags); 2992 spin_unlock_irqrestore(&priv->lock, flags);
@@ -2995,9 +2995,9 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
2995 msleep(10); 2995 msleep(10);
2996 2996
2997 spin_lock_irqsave(&priv->lock, flags); 2997 spin_lock_irqsave(&priv->lock, flags);
2998 iwl_read32(priv, CSR_UCODE_DRV_GP1); 2998 iwl3945_read32(priv, CSR_UCODE_DRV_GP1);
2999 if (!iwl_grab_nic_access(priv)) 2999 if (!iwl3945_grab_nic_access(priv))
3000 iwl_release_nic_access(priv); 3000 iwl3945_release_nic_access(priv);
3001 spin_unlock_irqrestore(&priv->lock, flags); 3001 spin_unlock_irqrestore(&priv->lock, flags);
3002 3002
3003 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { 3003 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
@@ -3010,7 +3010,7 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
3010 return; 3010 return;
3011} 3011}
3012 3012
3013void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, 3013void iwl3945_set_decrypted_flag(struct iwl3945_priv *priv, struct sk_buff *skb,
3014 u32 decrypt_res, struct ieee80211_rx_status *stats) 3014 u32 decrypt_res, struct ieee80211_rx_status *stats)
3015{ 3015{
3016 u16 fc = 3016 u16 fc =
@@ -3042,13 +3042,13 @@ void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb,
3042 } 3042 }
3043} 3043}
3044 3044
3045void iwl_handle_data_packet_monitor(struct iwl_priv *priv, 3045void iwl3945_handle_data_packet_monitor(struct iwl3945_priv *priv,
3046 struct iwl_rx_mem_buffer *rxb, 3046 struct iwl3945_rx_mem_buffer *rxb,
3047 void *data, short len, 3047 void *data, short len,
3048 struct ieee80211_rx_status *stats, 3048 struct ieee80211_rx_status *stats,
3049 u16 phy_flags) 3049 u16 phy_flags)
3050{ 3050{
3051 struct iwl_rt_rx_hdr *iwl_rt; 3051 struct iwl3945_rt_rx_hdr *iwl3945_rt;
3052 3052
3053 /* First cache any information we need before we overwrite 3053 /* First cache any information we need before we overwrite
3054 * the information provided in the skb from the hardware */ 3054 * the information provided in the skb from the hardware */
@@ -3059,26 +3059,26 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv,
3059 __le16 phy_flags_hw = cpu_to_le16(phy_flags); 3059 __le16 phy_flags_hw = cpu_to_le16(phy_flags);
3060 3060
3061 /* We received data from the HW, so stop the watchdog */ 3061 /* We received data from the HW, so stop the watchdog */
3062 if (len > IWL_RX_BUF_SIZE - sizeof(*iwl_rt)) { 3062 if (len > IWL_RX_BUF_SIZE - sizeof(*iwl3945_rt)) {
3063 IWL_DEBUG_DROP("Dropping too large packet in monitor\n"); 3063 IWL_DEBUG_DROP("Dropping too large packet in monitor\n");
3064 return; 3064 return;
3065 } 3065 }
3066 3066
3067 /* copy the frame data to write after where the radiotap header goes */ 3067 /* copy the frame data to write after where the radiotap header goes */
3068 iwl_rt = (void *)rxb->skb->data; 3068 iwl3945_rt = (void *)rxb->skb->data;
3069 memmove(iwl_rt->payload, data, len); 3069 memmove(iwl3945_rt->payload, data, len);
3070 3070
3071 iwl_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; 3071 iwl3945_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION;
3072 iwl_rt->rt_hdr.it_pad = 0; /* always good to zero */ 3072 iwl3945_rt->rt_hdr.it_pad = 0; /* always good to zero */
3073 3073
3074 /* total header + data */ 3074 /* total header + data */
3075 iwl_rt->rt_hdr.it_len = cpu_to_le16(sizeof(*iwl_rt)); 3075 iwl3945_rt->rt_hdr.it_len = cpu_to_le16(sizeof(*iwl3945_rt));
3076 3076
3077 /* Set the size of the skb to the size of the frame */ 3077 /* Set the size of the skb to the size of the frame */
3078 skb_put(rxb->skb, sizeof(*iwl_rt) + len); 3078 skb_put(rxb->skb, sizeof(*iwl3945_rt) + len);
3079 3079
3080 /* Big bitfield of all the fields we provide in radiotap */ 3080 /* Big bitfield of all the fields we provide in radiotap */
3081 iwl_rt->rt_hdr.it_present = 3081 iwl3945_rt->rt_hdr.it_present =
3082 cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) | 3082 cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) |
3083 (1 << IEEE80211_RADIOTAP_FLAGS) | 3083 (1 << IEEE80211_RADIOTAP_FLAGS) |
3084 (1 << IEEE80211_RADIOTAP_RATE) | 3084 (1 << IEEE80211_RADIOTAP_RATE) |
@@ -3088,39 +3088,39 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv,
3088 (1 << IEEE80211_RADIOTAP_ANTENNA)); 3088 (1 << IEEE80211_RADIOTAP_ANTENNA));
3089 3089
3090 /* Zero the flags, we'll add to them as we go */ 3090 /* Zero the flags, we'll add to them as we go */
3091 iwl_rt->rt_flags = 0; 3091 iwl3945_rt->rt_flags = 0;
3092 3092
3093 iwl_rt->rt_tsf = cpu_to_le64(tsf); 3093 iwl3945_rt->rt_tsf = cpu_to_le64(tsf);
3094 3094
3095 /* Convert to dBm */ 3095 /* Convert to dBm */
3096 iwl_rt->rt_dbmsignal = signal; 3096 iwl3945_rt->rt_dbmsignal = signal;
3097 iwl_rt->rt_dbmnoise = noise; 3097 iwl3945_rt->rt_dbmnoise = noise;
3098 3098
3099 /* Convert the channel frequency and set the flags */ 3099 /* Convert the channel frequency and set the flags */
3100 iwl_rt->rt_channelMHz = cpu_to_le16(stats->freq); 3100 iwl3945_rt->rt_channelMHz = cpu_to_le16(stats->freq);
3101 if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK)) 3101 if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK))
3102 iwl_rt->rt_chbitmask = 3102 iwl3945_rt->rt_chbitmask =
3103 cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ)); 3103 cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ));
3104 else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK) 3104 else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK)
3105 iwl_rt->rt_chbitmask = 3105 iwl3945_rt->rt_chbitmask =
3106 cpu_to_le16((IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ)); 3106 cpu_to_le16((IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ));
3107 else /* 802.11g */ 3107 else /* 802.11g */
3108 iwl_rt->rt_chbitmask = 3108 iwl3945_rt->rt_chbitmask =
3109 cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ)); 3109 cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ));
3110 3110
3111 rate = iwl_rate_index_from_plcp(rate); 3111 rate = iwl3945_rate_index_from_plcp(rate);
3112 if (rate == -1) 3112 if (rate == -1)
3113 iwl_rt->rt_rate = 0; 3113 iwl3945_rt->rt_rate = 0;
3114 else 3114 else
3115 iwl_rt->rt_rate = iwl_rates[rate].ieee; 3115 iwl3945_rt->rt_rate = iwl3945_rates[rate].ieee;
3116 3116
3117 /* antenna number */ 3117 /* antenna number */
3118 iwl_rt->rt_antenna = 3118 iwl3945_rt->rt_antenna =
3119 le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; 3119 le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4;
3120 3120
3121 /* set the preamble flag if we have it */ 3121 /* set the preamble flag if we have it */
3122 if (phy_flags_hw & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) 3122 if (phy_flags_hw & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK)
3123 iwl_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; 3123 iwl3945_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
3124 3124
3125 IWL_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); 3125 IWL_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len);
3126 3126
@@ -3132,7 +3132,7 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv,
3132 3132
3133#define IWL_PACKET_RETRY_TIME HZ 3133#define IWL_PACKET_RETRY_TIME HZ
3134 3134
3135int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) 3135int iwl3945_is_duplicate_packet(struct iwl3945_priv *priv, struct ieee80211_hdr *header)
3136{ 3136{
3137 u16 sc = le16_to_cpu(header->seq_ctrl); 3137 u16 sc = le16_to_cpu(header->seq_ctrl);
3138 u16 seq = (sc & IEEE80211_SCTL_SEQ) >> 4; 3138 u16 seq = (sc & IEEE80211_SCTL_SEQ) >> 4;
@@ -3143,12 +3143,12 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header)
3143 switch (priv->iw_mode) { 3143 switch (priv->iw_mode) {
3144 case IEEE80211_IF_TYPE_IBSS:{ 3144 case IEEE80211_IF_TYPE_IBSS:{
3145 struct list_head *p; 3145 struct list_head *p;
3146 struct iwl_ibss_seq *entry = NULL; 3146 struct iwl3945_ibss_seq *entry = NULL;
3147 u8 *mac = header->addr2; 3147 u8 *mac = header->addr2;
3148 int index = mac[5] & (IWL_IBSS_MAC_HASH_SIZE - 1); 3148 int index = mac[5] & (IWL_IBSS_MAC_HASH_SIZE - 1);
3149 3149
3150 __list_for_each(p, &priv->ibss_mac_hash[index]) { 3150 __list_for_each(p, &priv->ibss_mac_hash[index]) {
3151 entry = list_entry(p, struct iwl_ibss_seq, list); 3151 entry = list_entry(p, struct iwl3945_ibss_seq, list);
3152 if (!compare_ether_addr(entry->mac, mac)) 3152 if (!compare_ether_addr(entry->mac, mac))
3153 break; 3153 break;
3154 } 3154 }
@@ -3211,7 +3211,7 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header)
3211 * the lower 3 bytes is the time in usec within one beacon interval 3211 * the lower 3 bytes is the time in usec within one beacon interval
3212 */ 3212 */
3213 3213
3214static u32 iwl_usecs_to_beacons(u32 usec, u32 beacon_interval) 3214static u32 iwl3945_usecs_to_beacons(u32 usec, u32 beacon_interval)
3215{ 3215{
3216 u32 quot; 3216 u32 quot;
3217 u32 rem; 3217 u32 rem;
@@ -3230,7 +3230,7 @@ static u32 iwl_usecs_to_beacons(u32 usec, u32 beacon_interval)
3230 * the same as HW timer counter counting down 3230 * the same as HW timer counter counting down
3231 */ 3231 */
3232 3232
3233static __le32 iwl_add_beacon_time(u32 base, u32 addon, u32 beacon_interval) 3233static __le32 iwl3945_add_beacon_time(u32 base, u32 addon, u32 beacon_interval)
3234{ 3234{
3235 u32 base_low = base & BEACON_TIME_MASK_LOW; 3235 u32 base_low = base & BEACON_TIME_MASK_LOW;
3236 u32 addon_low = addon & BEACON_TIME_MASK_LOW; 3236 u32 addon_low = addon & BEACON_TIME_MASK_LOW;
@@ -3249,13 +3249,13 @@ static __le32 iwl_add_beacon_time(u32 base, u32 addon, u32 beacon_interval)
3249 return cpu_to_le32(res); 3249 return cpu_to_le32(res);
3250} 3250}
3251 3251
3252static int iwl_get_measurement(struct iwl_priv *priv, 3252static int iwl3945_get_measurement(struct iwl3945_priv *priv,
3253 struct ieee80211_measurement_params *params, 3253 struct ieee80211_measurement_params *params,
3254 u8 type) 3254 u8 type)
3255{ 3255{
3256 struct iwl_spectrum_cmd spectrum; 3256 struct iwl3945_spectrum_cmd spectrum;
3257 struct iwl_rx_packet *res; 3257 struct iwl3945_rx_packet *res;
3258 struct iwl_host_cmd cmd = { 3258 struct iwl3945_host_cmd cmd = {
3259 .id = REPLY_SPECTRUM_MEASUREMENT_CMD, 3259 .id = REPLY_SPECTRUM_MEASUREMENT_CMD,
3260 .data = (void *)&spectrum, 3260 .data = (void *)&spectrum,
3261 .meta.flags = CMD_WANT_SKB, 3261 .meta.flags = CMD_WANT_SKB,
@@ -3265,9 +3265,9 @@ static int iwl_get_measurement(struct iwl_priv *priv,
3265 int spectrum_resp_status; 3265 int spectrum_resp_status;
3266 int duration = le16_to_cpu(params->duration); 3266 int duration = le16_to_cpu(params->duration);
3267 3267
3268 if (iwl_is_associated(priv)) 3268 if (iwl3945_is_associated(priv))
3269 add_time = 3269 add_time =
3270 iwl_usecs_to_beacons( 3270 iwl3945_usecs_to_beacons(
3271 le64_to_cpu(params->start_time) - priv->last_tsf, 3271 le64_to_cpu(params->start_time) - priv->last_tsf,
3272 le16_to_cpu(priv->rxon_timing.beacon_interval)); 3272 le16_to_cpu(priv->rxon_timing.beacon_interval));
3273 3273
@@ -3280,9 +3280,9 @@ static int iwl_get_measurement(struct iwl_priv *priv,
3280 cmd.len = sizeof(spectrum); 3280 cmd.len = sizeof(spectrum);
3281 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); 3281 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len));
3282 3282
3283 if (iwl_is_associated(priv)) 3283 if (iwl3945_is_associated(priv))
3284 spectrum.start_time = 3284 spectrum.start_time =
3285 iwl_add_beacon_time(priv->last_beacon_time, 3285 iwl3945_add_beacon_time(priv->last_beacon_time,
3286 add_time, 3286 add_time,
3287 le16_to_cpu(priv->rxon_timing.beacon_interval)); 3287 le16_to_cpu(priv->rxon_timing.beacon_interval));
3288 else 3288 else
@@ -3295,11 +3295,11 @@ static int iwl_get_measurement(struct iwl_priv *priv,
3295 spectrum.flags |= RXON_FLG_BAND_24G_MSK | 3295 spectrum.flags |= RXON_FLG_BAND_24G_MSK |
3296 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; 3296 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK;
3297 3297
3298 rc = iwl_send_cmd_sync(priv, &cmd); 3298 rc = iwl3945_send_cmd_sync(priv, &cmd);
3299 if (rc) 3299 if (rc)
3300 return rc; 3300 return rc;
3301 3301
3302 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; 3302 res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
3303 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 3303 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
3304 IWL_ERROR("Bad return from REPLY_RX_ON_ASSOC command\n"); 3304 IWL_ERROR("Bad return from REPLY_RX_ON_ASSOC command\n");
3305 rc = -EIO; 3305 rc = -EIO;
@@ -3328,8 +3328,8 @@ static int iwl_get_measurement(struct iwl_priv *priv,
3328} 3328}
3329#endif 3329#endif
3330 3330
3331static void iwl_txstatus_to_ieee(struct iwl_priv *priv, 3331static void iwl3945_txstatus_to_ieee(struct iwl3945_priv *priv,
3332 struct iwl_tx_info *tx_sta) 3332 struct iwl3945_tx_info *tx_sta)
3333{ 3333{
3334 3334
3335 tx_sta->status.ack_signal = 0; 3335 tx_sta->status.ack_signal = 0;
@@ -3348,16 +3348,16 @@ static void iwl_txstatus_to_ieee(struct iwl_priv *priv,
3348} 3348}
3349 3349
3350/** 3350/**
3351 * iwl_tx_queue_reclaim - Reclaim Tx queue entries no more used by NIC. 3351 * iwl3945_tx_queue_reclaim - Reclaim Tx queue entries no more used by NIC.
3352 * 3352 *
3353 * When FW advances 'R' index, all entries between old and 3353 * When FW advances 'R' index, all entries between old and
3354 * new 'R' index need to be reclaimed. As result, some free space 3354 * new 'R' index need to be reclaimed. As result, some free space
3355 * forms. If there is enough free space (> low mark), wake Tx queue. 3355 * forms. If there is enough free space (> low mark), wake Tx queue.
3356 */ 3356 */
3357static int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) 3357static int iwl3945_tx_queue_reclaim(struct iwl3945_priv *priv, int txq_id, int index)
3358{ 3358{
3359 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 3359 struct iwl3945_tx_queue *txq = &priv->txq[txq_id];
3360 struct iwl_queue *q = &txq->q; 3360 struct iwl3945_queue *q = &txq->q;
3361 int nfreed = 0; 3361 int nfreed = 0;
3362 3362
3363 if ((index >= q->n_bd) || (x2_queue_used(q, index) == 0)) { 3363 if ((index >= q->n_bd) || (x2_queue_used(q, index) == 0)) {
@@ -3367,13 +3367,13 @@ static int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
3367 return 0; 3367 return 0;
3368 } 3368 }
3369 3369
3370 for (index = iwl_queue_inc_wrap(index, q->n_bd); 3370 for (index = iwl3945_queue_inc_wrap(index, q->n_bd);
3371 q->read_ptr != index; 3371 q->read_ptr != index;
3372 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { 3372 q->read_ptr = iwl3945_queue_inc_wrap(q->read_ptr, q->n_bd)) {
3373 if (txq_id != IWL_CMD_QUEUE_NUM) { 3373 if (txq_id != IWL_CMD_QUEUE_NUM) {
3374 iwl_txstatus_to_ieee(priv, 3374 iwl3945_txstatus_to_ieee(priv,
3375 &(txq->txb[txq->q.read_ptr])); 3375 &(txq->txb[txq->q.read_ptr]));
3376 iwl_hw_txq_free_tfd(priv, txq); 3376 iwl3945_hw_txq_free_tfd(priv, txq);
3377 } else if (nfreed > 1) { 3377 } else if (nfreed > 1) {
3378 IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index, 3378 IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index,
3379 q->write_ptr, q->read_ptr); 3379 q->write_ptr, q->read_ptr);
@@ -3382,7 +3382,7 @@ static int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
3382 nfreed++; 3382 nfreed++;
3383 } 3383 }
3384 3384
3385 if (iwl_queue_space(q) > q->low_mark && (txq_id >= 0) && 3385 if (iwl3945_queue_space(q) > q->low_mark && (txq_id >= 0) &&
3386 (txq_id != IWL_CMD_QUEUE_NUM) && 3386 (txq_id != IWL_CMD_QUEUE_NUM) &&
3387 priv->mac80211_registered) 3387 priv->mac80211_registered)
3388 ieee80211_wake_queue(priv->hw, txq_id); 3388 ieee80211_wake_queue(priv->hw, txq_id);
@@ -3391,7 +3391,7 @@ static int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
3391 return nfreed; 3391 return nfreed;
3392} 3392}
3393 3393
3394static int iwl_is_tx_success(u32 status) 3394static int iwl3945_is_tx_success(u32 status)
3395{ 3395{
3396 return (status & 0xFF) == 0x1; 3396 return (status & 0xFF) == 0x1;
3397} 3397}
@@ -3401,16 +3401,16 @@ static int iwl_is_tx_success(u32 status)
3401 * Generic RX handler implementations 3401 * Generic RX handler implementations
3402 * 3402 *
3403 ******************************************************************************/ 3403 ******************************************************************************/
3404static void iwl_rx_reply_tx(struct iwl_priv *priv, 3404static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
3405 struct iwl_rx_mem_buffer *rxb) 3405 struct iwl3945_rx_mem_buffer *rxb)
3406{ 3406{
3407 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3407 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3408 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 3408 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
3409 int txq_id = SEQ_TO_QUEUE(sequence); 3409 int txq_id = SEQ_TO_QUEUE(sequence);
3410 int index = SEQ_TO_INDEX(sequence); 3410 int index = SEQ_TO_INDEX(sequence);
3411 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 3411 struct iwl3945_tx_queue *txq = &priv->txq[txq_id];
3412 struct ieee80211_tx_status *tx_status; 3412 struct ieee80211_tx_status *tx_status;
3413 struct iwl_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; 3413 struct iwl3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
3414 u32 status = le32_to_cpu(tx_resp->status); 3414 u32 status = le32_to_cpu(tx_resp->status);
3415 3415
3416 if ((index >= txq->q.n_bd) || (x2_queue_used(&txq->q, index) == 0)) { 3416 if ((index >= txq->q.n_bd) || (x2_queue_used(&txq->q, index) == 0)) {
@@ -3429,28 +3429,28 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv,
3429 tx_status->queue_length |= tx_resp->failure_rts; 3429 tx_status->queue_length |= tx_resp->failure_rts;
3430 3430
3431 tx_status->flags = 3431 tx_status->flags =
3432 iwl_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0; 3432 iwl3945_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0;
3433 3433
3434 tx_status->control.tx_rate = iwl_rate_index_from_plcp(tx_resp->rate); 3434 tx_status->control.tx_rate = iwl3945_rate_index_from_plcp(tx_resp->rate);
3435 3435
3436 IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n", 3436 IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n",
3437 txq_id, iwl_get_tx_fail_reason(status), status, 3437 txq_id, iwl3945_get_tx_fail_reason(status), status,
3438 tx_resp->rate, tx_resp->failure_frame); 3438 tx_resp->rate, tx_resp->failure_frame);
3439 3439
3440 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); 3440 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index);
3441 if (index != -1) 3441 if (index != -1)
3442 iwl_tx_queue_reclaim(priv, txq_id, index); 3442 iwl3945_tx_queue_reclaim(priv, txq_id, index);
3443 3443
3444 if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK)) 3444 if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK))
3445 IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n"); 3445 IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n");
3446} 3446}
3447 3447
3448 3448
3449static void iwl_rx_reply_alive(struct iwl_priv *priv, 3449static void iwl3945_rx_reply_alive(struct iwl3945_priv *priv,
3450 struct iwl_rx_mem_buffer *rxb) 3450 struct iwl3945_rx_mem_buffer *rxb)
3451{ 3451{
3452 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3452 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3453 struct iwl_alive_resp *palive; 3453 struct iwl3945_alive_resp *palive;
3454 struct delayed_work *pwork; 3454 struct delayed_work *pwork;
3455 3455
3456 palive = &pkt->u.alive_frame; 3456 palive = &pkt->u.alive_frame;
@@ -3464,14 +3464,14 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv,
3464 IWL_DEBUG_INFO("Initialization Alive received.\n"); 3464 IWL_DEBUG_INFO("Initialization Alive received.\n");
3465 memcpy(&priv->card_alive_init, 3465 memcpy(&priv->card_alive_init,
3466 &pkt->u.alive_frame, 3466 &pkt->u.alive_frame,
3467 sizeof(struct iwl_init_alive_resp)); 3467 sizeof(struct iwl3945_init_alive_resp));
3468 pwork = &priv->init_alive_start; 3468 pwork = &priv->init_alive_start;
3469 } else { 3469 } else {
3470 IWL_DEBUG_INFO("Runtime Alive received.\n"); 3470 IWL_DEBUG_INFO("Runtime Alive received.\n");
3471 memcpy(&priv->card_alive, &pkt->u.alive_frame, 3471 memcpy(&priv->card_alive, &pkt->u.alive_frame,
3472 sizeof(struct iwl_alive_resp)); 3472 sizeof(struct iwl3945_alive_resp));
3473 pwork = &priv->alive_start; 3473 pwork = &priv->alive_start;
3474 iwl_disable_events(priv); 3474 iwl3945_disable_events(priv);
3475 } 3475 }
3476 3476
3477 /* We delay the ALIVE response by 5ms to 3477 /* We delay the ALIVE response by 5ms to
@@ -3483,19 +3483,19 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv,
3483 IWL_WARNING("uCode did not respond OK.\n"); 3483 IWL_WARNING("uCode did not respond OK.\n");
3484} 3484}
3485 3485
3486static void iwl_rx_reply_add_sta(struct iwl_priv *priv, 3486static void iwl3945_rx_reply_add_sta(struct iwl3945_priv *priv,
3487 struct iwl_rx_mem_buffer *rxb) 3487 struct iwl3945_rx_mem_buffer *rxb)
3488{ 3488{
3489 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3489 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3490 3490
3491 IWL_DEBUG_RX("Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status); 3491 IWL_DEBUG_RX("Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status);
3492 return; 3492 return;
3493} 3493}
3494 3494
3495static void iwl_rx_reply_error(struct iwl_priv *priv, 3495static void iwl3945_rx_reply_error(struct iwl3945_priv *priv,
3496 struct iwl_rx_mem_buffer *rxb) 3496 struct iwl3945_rx_mem_buffer *rxb)
3497{ 3497{
3498 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3498 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3499 3499
3500 IWL_ERROR("Error Reply type 0x%08X cmd %s (0x%02X) " 3500 IWL_ERROR("Error Reply type 0x%08X cmd %s (0x%02X) "
3501 "seq 0x%04X ser 0x%08X\n", 3501 "seq 0x%04X ser 0x%08X\n",
@@ -3508,23 +3508,23 @@ static void iwl_rx_reply_error(struct iwl_priv *priv,
3508 3508
3509#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x 3509#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x
3510 3510
3511static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) 3511static void iwl3945_rx_csa(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb)
3512{ 3512{
3513 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3513 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3514 struct iwl_rxon_cmd *rxon = (void *)&priv->active_rxon; 3514 struct iwl3945_rxon_cmd *rxon = (void *)&priv->active_rxon;
3515 struct iwl_csa_notification *csa = &(pkt->u.csa_notif); 3515 struct iwl3945_csa_notification *csa = &(pkt->u.csa_notif);
3516 IWL_DEBUG_11H("CSA notif: channel %d, status %d\n", 3516 IWL_DEBUG_11H("CSA notif: channel %d, status %d\n",
3517 le16_to_cpu(csa->channel), le32_to_cpu(csa->status)); 3517 le16_to_cpu(csa->channel), le32_to_cpu(csa->status));
3518 rxon->channel = csa->channel; 3518 rxon->channel = csa->channel;
3519 priv->staging_rxon.channel = csa->channel; 3519 priv->staging_rxon.channel = csa->channel;
3520} 3520}
3521 3521
3522static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, 3522static void iwl3945_rx_spectrum_measure_notif(struct iwl3945_priv *priv,
3523 struct iwl_rx_mem_buffer *rxb) 3523 struct iwl3945_rx_mem_buffer *rxb)
3524{ 3524{
3525#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT 3525#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
3526 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3526 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3527 struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif); 3527 struct iwl3945_spectrum_notification *report = &(pkt->u.spectrum_notif);
3528 3528
3529 if (!report->state) { 3529 if (!report->state) {
3530 IWL_DEBUG(IWL_DL_11H | IWL_DL_INFO, 3530 IWL_DEBUG(IWL_DL_11H | IWL_DL_INFO,
@@ -3537,31 +3537,31 @@ static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv,
3537#endif 3537#endif
3538} 3538}
3539 3539
3540static void iwl_rx_pm_sleep_notif(struct iwl_priv *priv, 3540static void iwl3945_rx_pm_sleep_notif(struct iwl3945_priv *priv,
3541 struct iwl_rx_mem_buffer *rxb) 3541 struct iwl3945_rx_mem_buffer *rxb)
3542{ 3542{
3543#ifdef CONFIG_IWL3945_DEBUG 3543#ifdef CONFIG_IWL3945_DEBUG
3544 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3544 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3545 struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif); 3545 struct iwl3945_sleep_notification *sleep = &(pkt->u.sleep_notif);
3546 IWL_DEBUG_RX("sleep mode: %d, src: %d\n", 3546 IWL_DEBUG_RX("sleep mode: %d, src: %d\n",
3547 sleep->pm_sleep_mode, sleep->pm_wakeup_src); 3547 sleep->pm_sleep_mode, sleep->pm_wakeup_src);
3548#endif 3548#endif
3549} 3549}
3550 3550
3551static void iwl_rx_pm_debug_statistics_notif(struct iwl_priv *priv, 3551static void iwl3945_rx_pm_debug_statistics_notif(struct iwl3945_priv *priv,
3552 struct iwl_rx_mem_buffer *rxb) 3552 struct iwl3945_rx_mem_buffer *rxb)
3553{ 3553{
3554 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3554 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3555 IWL_DEBUG_RADIO("Dumping %d bytes of unhandled " 3555 IWL_DEBUG_RADIO("Dumping %d bytes of unhandled "
3556 "notification for %s:\n", 3556 "notification for %s:\n",
3557 le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd)); 3557 le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd));
3558 iwl_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); 3558 iwl3945_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len));
3559} 3559}
3560 3560
3561static void iwl_bg_beacon_update(struct work_struct *work) 3561static void iwl3945_bg_beacon_update(struct work_struct *work)
3562{ 3562{
3563 struct iwl_priv *priv = 3563 struct iwl3945_priv *priv =
3564 container_of(work, struct iwl_priv, beacon_update); 3564 container_of(work, struct iwl3945_priv, beacon_update);
3565 struct sk_buff *beacon; 3565 struct sk_buff *beacon;
3566 3566
3567 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ 3567 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */
@@ -3580,15 +3580,15 @@ static void iwl_bg_beacon_update(struct work_struct *work)
3580 priv->ibss_beacon = beacon; 3580 priv->ibss_beacon = beacon;
3581 mutex_unlock(&priv->mutex); 3581 mutex_unlock(&priv->mutex);
3582 3582
3583 iwl_send_beacon_cmd(priv); 3583 iwl3945_send_beacon_cmd(priv);
3584} 3584}
3585 3585
3586static void iwl_rx_beacon_notif(struct iwl_priv *priv, 3586static void iwl3945_rx_beacon_notif(struct iwl3945_priv *priv,
3587 struct iwl_rx_mem_buffer *rxb) 3587 struct iwl3945_rx_mem_buffer *rxb)
3588{ 3588{
3589#ifdef CONFIG_IWL3945_DEBUG 3589#ifdef CONFIG_IWL3945_DEBUG
3590 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3590 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3591 struct iwl_beacon_notif *beacon = &(pkt->u.beacon_status); 3591 struct iwl3945_beacon_notif *beacon = &(pkt->u.beacon_status);
3592 u8 rate = beacon->beacon_notify_hdr.rate; 3592 u8 rate = beacon->beacon_notify_hdr.rate;
3593 3593
3594 IWL_DEBUG_RX("beacon status %x retries %d iss %d " 3594 IWL_DEBUG_RX("beacon status %x retries %d iss %d "
@@ -3606,25 +3606,25 @@ static void iwl_rx_beacon_notif(struct iwl_priv *priv,
3606} 3606}
3607 3607
3608/* Service response to REPLY_SCAN_CMD (0x80) */ 3608/* Service response to REPLY_SCAN_CMD (0x80) */
3609static void iwl_rx_reply_scan(struct iwl_priv *priv, 3609static void iwl3945_rx_reply_scan(struct iwl3945_priv *priv,
3610 struct iwl_rx_mem_buffer *rxb) 3610 struct iwl3945_rx_mem_buffer *rxb)
3611{ 3611{
3612#ifdef CONFIG_IWL3945_DEBUG 3612#ifdef CONFIG_IWL3945_DEBUG
3613 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3613 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3614 struct iwl_scanreq_notification *notif = 3614 struct iwl3945_scanreq_notification *notif =
3615 (struct iwl_scanreq_notification *)pkt->u.raw; 3615 (struct iwl3945_scanreq_notification *)pkt->u.raw;
3616 3616
3617 IWL_DEBUG_RX("Scan request status = 0x%x\n", notif->status); 3617 IWL_DEBUG_RX("Scan request status = 0x%x\n", notif->status);
3618#endif 3618#endif
3619} 3619}
3620 3620
3621/* Service SCAN_START_NOTIFICATION (0x82) */ 3621/* Service SCAN_START_NOTIFICATION (0x82) */
3622static void iwl_rx_scan_start_notif(struct iwl_priv *priv, 3622static void iwl3945_rx_scan_start_notif(struct iwl3945_priv *priv,
3623 struct iwl_rx_mem_buffer *rxb) 3623 struct iwl3945_rx_mem_buffer *rxb)
3624{ 3624{
3625 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3625 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3626 struct iwl_scanstart_notification *notif = 3626 struct iwl3945_scanstart_notification *notif =
3627 (struct iwl_scanstart_notification *)pkt->u.raw; 3627 (struct iwl3945_scanstart_notification *)pkt->u.raw;
3628 priv->scan_start_tsf = le32_to_cpu(notif->tsf_low); 3628 priv->scan_start_tsf = le32_to_cpu(notif->tsf_low);
3629 IWL_DEBUG_SCAN("Scan start: " 3629 IWL_DEBUG_SCAN("Scan start: "
3630 "%d [802.11%s] " 3630 "%d [802.11%s] "
@@ -3636,12 +3636,12 @@ static void iwl_rx_scan_start_notif(struct iwl_priv *priv,
3636} 3636}
3637 3637
3638/* Service SCAN_RESULTS_NOTIFICATION (0x83) */ 3638/* Service SCAN_RESULTS_NOTIFICATION (0x83) */
3639static void iwl_rx_scan_results_notif(struct iwl_priv *priv, 3639static void iwl3945_rx_scan_results_notif(struct iwl3945_priv *priv,
3640 struct iwl_rx_mem_buffer *rxb) 3640 struct iwl3945_rx_mem_buffer *rxb)
3641{ 3641{
3642 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3642 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3643 struct iwl_scanresults_notification *notif = 3643 struct iwl3945_scanresults_notification *notif =
3644 (struct iwl_scanresults_notification *)pkt->u.raw; 3644 (struct iwl3945_scanresults_notification *)pkt->u.raw;
3645 3645
3646 IWL_DEBUG_SCAN("Scan ch.res: " 3646 IWL_DEBUG_SCAN("Scan ch.res: "
3647 "%d [802.11%s] " 3647 "%d [802.11%s] "
@@ -3660,11 +3660,11 @@ static void iwl_rx_scan_results_notif(struct iwl_priv *priv,
3660} 3660}
3661 3661
3662/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ 3662/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */
3663static void iwl_rx_scan_complete_notif(struct iwl_priv *priv, 3663static void iwl3945_rx_scan_complete_notif(struct iwl3945_priv *priv,
3664 struct iwl_rx_mem_buffer *rxb) 3664 struct iwl3945_rx_mem_buffer *rxb)
3665{ 3665{
3666 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3666 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3667 struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw; 3667 struct iwl3945_scancomplete_notification *scan_notif = (void *)pkt->u.raw;
3668 3668
3669 IWL_DEBUG_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n", 3669 IWL_DEBUG_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n",
3670 scan_notif->scanned_channels, 3670 scan_notif->scanned_channels,
@@ -3717,10 +3717,10 @@ reschedule:
3717 3717
3718/* Handle notification from uCode that card's power state is changing 3718/* Handle notification from uCode that card's power state is changing
3719 * due to software, hardware, or critical temperature RFKILL */ 3719 * due to software, hardware, or critical temperature RFKILL */
3720static void iwl_rx_card_state_notif(struct iwl_priv *priv, 3720static void iwl3945_rx_card_state_notif(struct iwl3945_priv *priv,
3721 struct iwl_rx_mem_buffer *rxb) 3721 struct iwl3945_rx_mem_buffer *rxb)
3722{ 3722{
3723 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 3723 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3724 u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); 3724 u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags);
3725 unsigned long status = priv->status; 3725 unsigned long status = priv->status;
3726 3726
@@ -3728,7 +3728,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
3728 (flags & HW_CARD_DISABLED) ? "Kill" : "On", 3728 (flags & HW_CARD_DISABLED) ? "Kill" : "On",
3729 (flags & SW_CARD_DISABLED) ? "Kill" : "On"); 3729 (flags & SW_CARD_DISABLED) ? "Kill" : "On");
3730 3730
3731 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, 3731 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_SET,
3732 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 3732 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
3733 3733
3734 if (flags & HW_CARD_DISABLED) 3734 if (flags & HW_CARD_DISABLED)
@@ -3742,7 +3742,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
3742 else 3742 else
3743 clear_bit(STATUS_RF_KILL_SW, &priv->status); 3743 clear_bit(STATUS_RF_KILL_SW, &priv->status);
3744 3744
3745 iwl_scan_cancel(priv); 3745 iwl3945_scan_cancel(priv);
3746 3746
3747 if ((test_bit(STATUS_RF_KILL_HW, &status) != 3747 if ((test_bit(STATUS_RF_KILL_HW, &status) !=
3748 test_bit(STATUS_RF_KILL_HW, &priv->status)) || 3748 test_bit(STATUS_RF_KILL_HW, &priv->status)) ||
@@ -3754,7 +3754,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
3754} 3754}
3755 3755
3756/** 3756/**
3757 * iwl_setup_rx_handlers - Initialize Rx handler callbacks 3757 * iwl3945_setup_rx_handlers - Initialize Rx handler callbacks
3758 * 3758 *
3759 * Setup the RX handlers for each of the reply types sent from the uCode 3759 * Setup the RX handlers for each of the reply types sent from the uCode
3760 * to the host. 3760 * to the host.
@@ -3762,20 +3762,20 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
3762 * This function chains into the hardware specific files for them to setup 3762 * This function chains into the hardware specific files for them to setup
3763 * any hardware specific handlers as well. 3763 * any hardware specific handlers as well.
3764 */ 3764 */
3765static void iwl_setup_rx_handlers(struct iwl_priv *priv) 3765static void iwl3945_setup_rx_handlers(struct iwl3945_priv *priv)
3766{ 3766{
3767 priv->rx_handlers[REPLY_ALIVE] = iwl_rx_reply_alive; 3767 priv->rx_handlers[REPLY_ALIVE] = iwl3945_rx_reply_alive;
3768 priv->rx_handlers[REPLY_ADD_STA] = iwl_rx_reply_add_sta; 3768 priv->rx_handlers[REPLY_ADD_STA] = iwl3945_rx_reply_add_sta;
3769 priv->rx_handlers[REPLY_ERROR] = iwl_rx_reply_error; 3769 priv->rx_handlers[REPLY_ERROR] = iwl3945_rx_reply_error;
3770 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_rx_csa; 3770 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl3945_rx_csa;
3771 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = 3771 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] =
3772 iwl_rx_spectrum_measure_notif; 3772 iwl3945_rx_spectrum_measure_notif;
3773 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl_rx_pm_sleep_notif; 3773 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl3945_rx_pm_sleep_notif;
3774 priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = 3774 priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] =
3775 iwl_rx_pm_debug_statistics_notif; 3775 iwl3945_rx_pm_debug_statistics_notif;
3776 priv->rx_handlers[BEACON_NOTIFICATION] = iwl_rx_beacon_notif; 3776 priv->rx_handlers[BEACON_NOTIFICATION] = iwl3945_rx_beacon_notif;
3777 3777
3778 /* NOTE: iwl_rx_statistics is different based on whether 3778 /* NOTE: iwl3945_rx_statistics is different based on whether
3779 * the build is for the 3945 or the 4965. See the 3779 * the build is for the 3945 or the 4965. See the
3780 * corresponding implementation in iwl-XXXX.c 3780 * corresponding implementation in iwl-XXXX.c
3781 * 3781 *
@@ -3783,40 +3783,40 @@ static void iwl_setup_rx_handlers(struct iwl_priv *priv)
3783 * discrete statistics request from the host as well as 3783 * discrete statistics request from the host as well as
3784 * for the periodic statistics notification from the uCode 3784 * for the periodic statistics notification from the uCode
3785 */ 3785 */
3786 priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl_hw_rx_statistics; 3786 priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl3945_hw_rx_statistics;
3787 priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl_hw_rx_statistics; 3787 priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl3945_hw_rx_statistics;
3788 3788
3789 priv->rx_handlers[REPLY_SCAN_CMD] = iwl_rx_reply_scan; 3789 priv->rx_handlers[REPLY_SCAN_CMD] = iwl3945_rx_reply_scan;
3790 priv->rx_handlers[SCAN_START_NOTIFICATION] = iwl_rx_scan_start_notif; 3790 priv->rx_handlers[SCAN_START_NOTIFICATION] = iwl3945_rx_scan_start_notif;
3791 priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] = 3791 priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] =
3792 iwl_rx_scan_results_notif; 3792 iwl3945_rx_scan_results_notif;
3793 priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] = 3793 priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] =
3794 iwl_rx_scan_complete_notif; 3794 iwl3945_rx_scan_complete_notif;
3795 priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl_rx_card_state_notif; 3795 priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl3945_rx_card_state_notif;
3796 priv->rx_handlers[REPLY_TX] = iwl_rx_reply_tx; 3796 priv->rx_handlers[REPLY_TX] = iwl3945_rx_reply_tx;
3797 3797
3798 /* Setup hardware specific Rx handlers */ 3798 /* Setup hardware specific Rx handlers */
3799 iwl_hw_rx_handler_setup(priv); 3799 iwl3945_hw_rx_handler_setup(priv);
3800} 3800}
3801 3801
3802/** 3802/**
3803 * iwl_tx_cmd_complete - Pull unused buffers off the queue and reclaim them 3803 * iwl3945_tx_cmd_complete - Pull unused buffers off the queue and reclaim them
3804 * @rxb: Rx buffer to reclaim 3804 * @rxb: Rx buffer to reclaim
3805 * 3805 *
3806 * If an Rx buffer has an async callback associated with it the callback 3806 * If an Rx buffer has an async callback associated with it the callback
3807 * will be executed. The attached skb (if present) will only be freed 3807 * will be executed. The attached skb (if present) will only be freed
3808 * if the callback returns 1 3808 * if the callback returns 1
3809 */ 3809 */
3810static void iwl_tx_cmd_complete(struct iwl_priv *priv, 3810static void iwl3945_tx_cmd_complete(struct iwl3945_priv *priv,
3811 struct iwl_rx_mem_buffer *rxb) 3811 struct iwl3945_rx_mem_buffer *rxb)
3812{ 3812{
3813 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 3813 struct iwl3945_rx_packet *pkt = (struct iwl3945_rx_packet *)rxb->skb->data;
3814 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 3814 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
3815 int txq_id = SEQ_TO_QUEUE(sequence); 3815 int txq_id = SEQ_TO_QUEUE(sequence);
3816 int index = SEQ_TO_INDEX(sequence); 3816 int index = SEQ_TO_INDEX(sequence);
3817 int huge = sequence & SEQ_HUGE_FRAME; 3817 int huge = sequence & SEQ_HUGE_FRAME;
3818 int cmd_index; 3818 int cmd_index;
3819 struct iwl_cmd *cmd; 3819 struct iwl3945_cmd *cmd;
3820 3820
3821 /* If a Tx command is being handled and it isn't in the actual 3821 /* If a Tx command is being handled and it isn't in the actual
3822 * command queue then there a command routing bug has been introduced 3822 * command queue then there a command routing bug has been introduced
@@ -3837,7 +3837,7 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv,
3837 !cmd->meta.u.callback(priv, cmd, rxb->skb)) 3837 !cmd->meta.u.callback(priv, cmd, rxb->skb))
3838 rxb->skb = NULL; 3838 rxb->skb = NULL;
3839 3839
3840 iwl_tx_queue_reclaim(priv, txq_id, index); 3840 iwl3945_tx_queue_reclaim(priv, txq_id, index);
3841 3841
3842 if (!(cmd->meta.flags & CMD_ASYNC)) { 3842 if (!(cmd->meta.flags & CMD_ASYNC)) {
3843 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 3843 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
@@ -3879,7 +3879,7 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv,
3879 * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When 3879 * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When
3880 * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled 3880 * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled
3881 * to replenish the iwl->rxq->rx_free. 3881 * to replenish the iwl->rxq->rx_free.
3882 * + In iwl_rx_replenish (scheduled) if 'processed' != 'read' then the 3882 * + In iwl3945_rx_replenish (scheduled) if 'processed' != 'read' then the
3883 * iwl->rxq is replenished and the READ INDEX is updated (updating the 3883 * iwl->rxq is replenished and the READ INDEX is updated (updating the
3884 * 'processed' and 'read' driver indexes as well) 3884 * 'processed' and 'read' driver indexes as well)
3885 * + A received packet is processed and handed to the kernel network stack, 3885 * + A received packet is processed and handed to the kernel network stack,
@@ -3892,28 +3892,28 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv,
3892 * 3892 *
3893 * Driver sequence: 3893 * Driver sequence:
3894 * 3894 *
3895 * iwl_rx_queue_alloc() Allocates rx_free 3895 * iwl3945_rx_queue_alloc() Allocates rx_free
3896 * iwl_rx_replenish() Replenishes rx_free list from rx_used, and calls 3896 * iwl3945_rx_replenish() Replenishes rx_free list from rx_used, and calls
3897 * iwl_rx_queue_restock 3897 * iwl3945_rx_queue_restock
3898 * iwl_rx_queue_restock() Moves available buffers from rx_free into Rx 3898 * iwl3945_rx_queue_restock() Moves available buffers from rx_free into Rx
3899 * queue, updates firmware pointers, and updates 3899 * queue, updates firmware pointers, and updates
3900 * the WRITE index. If insufficient rx_free buffers 3900 * the WRITE index. If insufficient rx_free buffers
3901 * are available, schedules iwl_rx_replenish 3901 * are available, schedules iwl3945_rx_replenish
3902 * 3902 *
3903 * -- enable interrupts -- 3903 * -- enable interrupts --
3904 * ISR - iwl_rx() Detach iwl_rx_mem_buffers from pool up to the 3904 * ISR - iwl3945_rx() Detach iwl3945_rx_mem_buffers from pool up to the
3905 * READ INDEX, detaching the SKB from the pool. 3905 * READ INDEX, detaching the SKB from the pool.
3906 * Moves the packet buffer from queue to rx_used. 3906 * Moves the packet buffer from queue to rx_used.
3907 * Calls iwl_rx_queue_restock to refill any empty 3907 * Calls iwl3945_rx_queue_restock to refill any empty
3908 * slots. 3908 * slots.
3909 * ... 3909 * ...
3910 * 3910 *
3911 */ 3911 */
3912 3912
3913/** 3913/**
3914 * iwl_rx_queue_space - Return number of free slots available in queue. 3914 * iwl3945_rx_queue_space - Return number of free slots available in queue.
3915 */ 3915 */
3916static int iwl_rx_queue_space(const struct iwl_rx_queue *q) 3916static int iwl3945_rx_queue_space(const struct iwl3945_rx_queue *q)
3917{ 3917{
3918 int s = q->read - q->write; 3918 int s = q->read - q->write;
3919 if (s <= 0) 3919 if (s <= 0)
@@ -3926,7 +3926,7 @@ static int iwl_rx_queue_space(const struct iwl_rx_queue *q)
3926} 3926}
3927 3927
3928/** 3928/**
3929 * iwl_rx_queue_update_write_ptr - Update the write pointer for the RX queue 3929 * iwl3945_rx_queue_update_write_ptr - Update the write pointer for the RX queue
3930 * 3930 *
3931 * NOTE: This function has 3945 and 4965 specific code sections 3931 * NOTE: This function has 3945 and 4965 specific code sections
3932 * but is declared in base due to the majority of the 3932 * but is declared in base due to the majority of the
@@ -3934,7 +3934,7 @@ static int iwl_rx_queue_space(const struct iwl_rx_queue *q)
3934 * different) 3934 * different)
3935 * 3935 *
3936 */ 3936 */
3937int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q) 3937int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv, struct iwl3945_rx_queue *q)
3938{ 3938{
3939 u32 reg = 0; 3939 u32 reg = 0;
3940 int rc = 0; 3940 int rc = 0;
@@ -3946,23 +3946,23 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q)
3946 goto exit_unlock; 3946 goto exit_unlock;
3947 3947
3948 if (test_bit(STATUS_POWER_PMI, &priv->status)) { 3948 if (test_bit(STATUS_POWER_PMI, &priv->status)) {
3949 reg = iwl_read32(priv, CSR_UCODE_DRV_GP1); 3949 reg = iwl3945_read32(priv, CSR_UCODE_DRV_GP1);
3950 3950
3951 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { 3951 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
3952 iwl_set_bit(priv, CSR_GP_CNTRL, 3952 iwl3945_set_bit(priv, CSR_GP_CNTRL,
3953 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 3953 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
3954 goto exit_unlock; 3954 goto exit_unlock;
3955 } 3955 }
3956 3956
3957 rc = iwl_grab_nic_access(priv); 3957 rc = iwl3945_grab_nic_access(priv);
3958 if (rc) 3958 if (rc)
3959 goto exit_unlock; 3959 goto exit_unlock;
3960 3960
3961 iwl_write_direct32(priv, FH_RSCSR_CHNL0_WPTR, 3961 iwl3945_write_direct32(priv, FH_RSCSR_CHNL0_WPTR,
3962 q->write & ~0x7); 3962 q->write & ~0x7);
3963 iwl_release_nic_access(priv); 3963 iwl3945_release_nic_access(priv);
3964 } else 3964 } else
3965 iwl_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); 3965 iwl3945_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7);
3966 3966
3967 3967
3968 q->need_update = 0; 3968 q->need_update = 0;
@@ -3973,18 +3973,18 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q)
3973} 3973}
3974 3974
3975/** 3975/**
3976 * iwl_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer pointer. 3976 * iwl3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer pointer.
3977 * 3977 *
3978 * NOTE: This function has 3945 and 4965 specific code paths in it. 3978 * NOTE: This function has 3945 and 4965 specific code paths in it.
3979 */ 3979 */
3980static inline __le32 iwl_dma_addr2rbd_ptr(struct iwl_priv *priv, 3980static inline __le32 iwl3945_dma_addr2rbd_ptr(struct iwl3945_priv *priv,
3981 dma_addr_t dma_addr) 3981 dma_addr_t dma_addr)
3982{ 3982{
3983 return cpu_to_le32((u32)dma_addr); 3983 return cpu_to_le32((u32)dma_addr);
3984} 3984}
3985 3985
3986/** 3986/**
3987 * iwl_rx_queue_restock - refill RX queue from pre-allocated pool 3987 * iwl3945_rx_queue_restock - refill RX queue from pre-allocated pool
3988 * 3988 *
3989 * If there are slots in the RX queue that need to be restocked, 3989 * If there are slots in the RX queue that need to be restocked,
3990 * and we have free pre-allocated buffers, fill the ranks as much 3990 * and we have free pre-allocated buffers, fill the ranks as much
@@ -3994,21 +3994,21 @@ static inline __le32 iwl_dma_addr2rbd_ptr(struct iwl_priv *priv,
3994 * also updates the memory address in the firmware to reference the new 3994 * also updates the memory address in the firmware to reference the new
3995 * target buffer. 3995 * target buffer.
3996 */ 3996 */
3997static int iwl_rx_queue_restock(struct iwl_priv *priv) 3997static int iwl3945_rx_queue_restock(struct iwl3945_priv *priv)
3998{ 3998{
3999 struct iwl_rx_queue *rxq = &priv->rxq; 3999 struct iwl3945_rx_queue *rxq = &priv->rxq;
4000 struct list_head *element; 4000 struct list_head *element;
4001 struct iwl_rx_mem_buffer *rxb; 4001 struct iwl3945_rx_mem_buffer *rxb;
4002 unsigned long flags; 4002 unsigned long flags;
4003 int write, rc; 4003 int write, rc;
4004 4004
4005 spin_lock_irqsave(&rxq->lock, flags); 4005 spin_lock_irqsave(&rxq->lock, flags);
4006 write = rxq->write & ~0x7; 4006 write = rxq->write & ~0x7;
4007 while ((iwl_rx_queue_space(rxq) > 0) && (rxq->free_count)) { 4007 while ((iwl3945_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
4008 element = rxq->rx_free.next; 4008 element = rxq->rx_free.next;
4009 rxb = list_entry(element, struct iwl_rx_mem_buffer, list); 4009 rxb = list_entry(element, struct iwl3945_rx_mem_buffer, list);
4010 list_del(element); 4010 list_del(element);
4011 rxq->bd[rxq->write] = iwl_dma_addr2rbd_ptr(priv, rxb->dma_addr); 4011 rxq->bd[rxq->write] = iwl3945_dma_addr2rbd_ptr(priv, rxb->dma_addr);
4012 rxq->queue[rxq->write] = rxb; 4012 rxq->queue[rxq->write] = rxb;
4013 rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; 4013 rxq->write = (rxq->write + 1) & RX_QUEUE_MASK;
4014 rxq->free_count--; 4014 rxq->free_count--;
@@ -4026,7 +4026,7 @@ static int iwl_rx_queue_restock(struct iwl_priv *priv)
4026 spin_lock_irqsave(&rxq->lock, flags); 4026 spin_lock_irqsave(&rxq->lock, flags);
4027 rxq->need_update = 1; 4027 rxq->need_update = 1;
4028 spin_unlock_irqrestore(&rxq->lock, flags); 4028 spin_unlock_irqrestore(&rxq->lock, flags);
4029 rc = iwl_rx_queue_update_write_ptr(priv, rxq); 4029 rc = iwl3945_rx_queue_update_write_ptr(priv, rxq);
4030 if (rc) 4030 if (rc)
4031 return rc; 4031 return rc;
4032 } 4032 }
@@ -4035,24 +4035,24 @@ static int iwl_rx_queue_restock(struct iwl_priv *priv)
4035} 4035}
4036 4036
4037/** 4037/**
4038 * iwl_rx_replenish - Move all used packet from rx_used to rx_free 4038 * iwl3945_rx_replenish - Move all used packet from rx_used to rx_free
4039 * 4039 *
4040 * When moving to rx_free an SKB is allocated for the slot. 4040 * When moving to rx_free an SKB is allocated for the slot.
4041 * 4041 *
4042 * Also restock the Rx queue via iwl_rx_queue_restock. 4042 * Also restock the Rx queue via iwl3945_rx_queue_restock.
4043 * This is called as a scheduled work item (except for during initialization) 4043 * This is called as a scheduled work item (except for during initialization)
4044 */ 4044 */
4045void iwl_rx_replenish(void *data) 4045void iwl3945_rx_replenish(void *data)
4046{ 4046{
4047 struct iwl_priv *priv = data; 4047 struct iwl3945_priv *priv = data;
4048 struct iwl_rx_queue *rxq = &priv->rxq; 4048 struct iwl3945_rx_queue *rxq = &priv->rxq;
4049 struct list_head *element; 4049 struct list_head *element;
4050 struct iwl_rx_mem_buffer *rxb; 4050 struct iwl3945_rx_mem_buffer *rxb;
4051 unsigned long flags; 4051 unsigned long flags;
4052 spin_lock_irqsave(&rxq->lock, flags); 4052 spin_lock_irqsave(&rxq->lock, flags);
4053 while (!list_empty(&rxq->rx_used)) { 4053 while (!list_empty(&rxq->rx_used)) {
4054 element = rxq->rx_used.next; 4054 element = rxq->rx_used.next;
4055 rxb = list_entry(element, struct iwl_rx_mem_buffer, list); 4055 rxb = list_entry(element, struct iwl3945_rx_mem_buffer, list);
4056 rxb->skb = 4056 rxb->skb =
4057 alloc_skb(IWL_RX_BUF_SIZE, __GFP_NOWARN | GFP_ATOMIC); 4057 alloc_skb(IWL_RX_BUF_SIZE, __GFP_NOWARN | GFP_ATOMIC);
4058 if (!rxb->skb) { 4058 if (!rxb->skb) {
@@ -4075,7 +4075,7 @@ void iwl_rx_replenish(void *data)
4075 spin_unlock_irqrestore(&rxq->lock, flags); 4075 spin_unlock_irqrestore(&rxq->lock, flags);
4076 4076
4077 spin_lock_irqsave(&priv->lock, flags); 4077 spin_lock_irqsave(&priv->lock, flags);
4078 iwl_rx_queue_restock(priv); 4078 iwl3945_rx_queue_restock(priv);
4079 spin_unlock_irqrestore(&priv->lock, flags); 4079 spin_unlock_irqrestore(&priv->lock, flags);
4080} 4080}
4081 4081
@@ -4084,7 +4084,7 @@ void iwl_rx_replenish(void *data)
4084 * This free routine walks the list of POOL entries and if SKB is set to 4084 * This free routine walks the list of POOL entries and if SKB is set to
4085 * non NULL it is unmapped and freed 4085 * non NULL it is unmapped and freed
4086 */ 4086 */
4087static void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 4087static void iwl3945_rx_queue_free(struct iwl3945_priv *priv, struct iwl3945_rx_queue *rxq)
4088{ 4088{
4089 int i; 4089 int i;
4090 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { 4090 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
@@ -4101,9 +4101,9 @@ static void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
4101 rxq->bd = NULL; 4101 rxq->bd = NULL;
4102} 4102}
4103 4103
4104int iwl_rx_queue_alloc(struct iwl_priv *priv) 4104int iwl3945_rx_queue_alloc(struct iwl3945_priv *priv)
4105{ 4105{
4106 struct iwl_rx_queue *rxq = &priv->rxq; 4106 struct iwl3945_rx_queue *rxq = &priv->rxq;
4107 struct pci_dev *dev = priv->pci_dev; 4107 struct pci_dev *dev = priv->pci_dev;
4108 int i; 4108 int i;
4109 4109
@@ -4124,7 +4124,7 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv)
4124 return 0; 4124 return 0;
4125} 4125}
4126 4126
4127void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 4127void iwl3945_rx_queue_reset(struct iwl3945_priv *priv, struct iwl3945_rx_queue *rxq)
4128{ 4128{
4129 unsigned long flags; 4129 unsigned long flags;
4130 int i; 4130 int i;
@@ -4171,7 +4171,7 @@ static u8 ratio2dB[100] = {
4171/* Calculates a relative dB value from a ratio of linear 4171/* Calculates a relative dB value from a ratio of linear
4172 * (i.e. not dB) signal levels. 4172 * (i.e. not dB) signal levels.
4173 * Conversion assumes that levels are voltages (20*log), not powers (10*log). */ 4173 * Conversion assumes that levels are voltages (20*log), not powers (10*log). */
4174int iwl_calc_db_from_ratio(int sig_ratio) 4174int iwl3945_calc_db_from_ratio(int sig_ratio)
4175{ 4175{
4176 /* Anything above 1000:1 just report as 60 dB */ 4176 /* Anything above 1000:1 just report as 60 dB */
4177 if (sig_ratio > 1000) 4177 if (sig_ratio > 1000)
@@ -4197,7 +4197,7 @@ int iwl_calc_db_from_ratio(int sig_ratio)
4197/* Calculate an indication of rx signal quality (a percentage, not dBm!). 4197/* Calculate an indication of rx signal quality (a percentage, not dBm!).
4198 * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info 4198 * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info
4199 * about formulas used below. */ 4199 * about formulas used below. */
4200int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm) 4200int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm)
4201{ 4201{
4202 int sig_qual; 4202 int sig_qual;
4203 int degradation = PERFECT_RSSI - rssi_dbm; 4203 int degradation = PERFECT_RSSI - rssi_dbm;
@@ -4232,22 +4232,22 @@ int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm)
4232} 4232}
4233 4233
4234/** 4234/**
4235 * iwl_rx_handle - Main entry function for receiving responses from the uCode 4235 * iwl3945_rx_handle - Main entry function for receiving responses from the uCode
4236 * 4236 *
4237 * Uses the priv->rx_handlers callback function array to invoke 4237 * Uses the priv->rx_handlers callback function array to invoke
4238 * the appropriate handlers, including command responses, 4238 * the appropriate handlers, including command responses,
4239 * frame-received notifications, and other notifications. 4239 * frame-received notifications, and other notifications.
4240 */ 4240 */
4241static void iwl_rx_handle(struct iwl_priv *priv) 4241static void iwl3945_rx_handle(struct iwl3945_priv *priv)
4242{ 4242{
4243 struct iwl_rx_mem_buffer *rxb; 4243 struct iwl3945_rx_mem_buffer *rxb;
4244 struct iwl_rx_packet *pkt; 4244 struct iwl3945_rx_packet *pkt;
4245 struct iwl_rx_queue *rxq = &priv->rxq; 4245 struct iwl3945_rx_queue *rxq = &priv->rxq;
4246 u32 r, i; 4246 u32 r, i;
4247 int reclaim; 4247 int reclaim;
4248 unsigned long flags; 4248 unsigned long flags;
4249 4249
4250 r = iwl_hw_get_rx_read(priv); 4250 r = iwl3945_hw_get_rx_read(priv);
4251 i = rxq->read; 4251 i = rxq->read;
4252 4252
4253 /* Rx interrupt, but nothing sent from uCode */ 4253 /* Rx interrupt, but nothing sent from uCode */
@@ -4267,7 +4267,7 @@ static void iwl_rx_handle(struct iwl_priv *priv)
4267 pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, 4267 pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr,
4268 IWL_RX_BUF_SIZE, 4268 IWL_RX_BUF_SIZE,
4269 PCI_DMA_FROMDEVICE); 4269 PCI_DMA_FROMDEVICE);
4270 pkt = (struct iwl_rx_packet *)rxb->skb->data; 4270 pkt = (struct iwl3945_rx_packet *)rxb->skb->data;
4271 4271
4272 /* Reclaim a command buffer only if this packet is a response 4272 /* Reclaim a command buffer only if this packet is a response
4273 * to a (driver-originated) command. 4273 * to a (driver-originated) command.
@@ -4281,7 +4281,7 @@ static void iwl_rx_handle(struct iwl_priv *priv)
4281 4281
4282 /* Based on type of command response or notification, 4282 /* Based on type of command response or notification,
4283 * handle those that need handling via function in 4283 * handle those that need handling via function in
4284 * rx_handlers table. See iwl_setup_rx_handlers() */ 4284 * rx_handlers table. See iwl3945_setup_rx_handlers() */
4285 if (priv->rx_handlers[pkt->hdr.cmd]) { 4285 if (priv->rx_handlers[pkt->hdr.cmd]) {
4286 IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR, 4286 IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR,
4287 "r = %d, i = %d, %s, 0x%02x\n", r, i, 4287 "r = %d, i = %d, %s, 0x%02x\n", r, i,
@@ -4297,10 +4297,10 @@ static void iwl_rx_handle(struct iwl_priv *priv)
4297 4297
4298 if (reclaim) { 4298 if (reclaim) {
4299 /* Invoke any callbacks, transfer the skb to caller, 4299 /* Invoke any callbacks, transfer the skb to caller,
4300 * and fire off the (possibly) blocking iwl_send_cmd() 4300 * and fire off the (possibly) blocking iwl3945_send_cmd()
4301 * as we reclaim the driver command queue */ 4301 * as we reclaim the driver command queue */
4302 if (rxb && rxb->skb) 4302 if (rxb && rxb->skb)
4303 iwl_tx_cmd_complete(priv, rxb); 4303 iwl3945_tx_cmd_complete(priv, rxb);
4304 else 4304 else
4305 IWL_WARNING("Claim null rxb?\n"); 4305 IWL_WARNING("Claim null rxb?\n");
4306 } 4306 }
@@ -4324,11 +4324,11 @@ static void iwl_rx_handle(struct iwl_priv *priv)
4324 4324
4325 /* Backtrack one entry */ 4325 /* Backtrack one entry */
4326 priv->rxq.read = i; 4326 priv->rxq.read = i;
4327 iwl_rx_queue_restock(priv); 4327 iwl3945_rx_queue_restock(priv);
4328} 4328}
4329 4329
4330static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, 4330static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv,
4331 struct iwl_tx_queue *txq) 4331 struct iwl3945_tx_queue *txq)
4332{ 4332{
4333 u32 reg = 0; 4333 u32 reg = 0;
4334 int rc = 0; 4334 int rc = 0;
@@ -4342,27 +4342,27 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv,
4342 /* wake up nic if it's powered down ... 4342 /* wake up nic if it's powered down ...
4343 * uCode will wake up, and interrupt us again, so next 4343 * uCode will wake up, and interrupt us again, so next
4344 * time we'll skip this part. */ 4344 * time we'll skip this part. */
4345 reg = iwl_read32(priv, CSR_UCODE_DRV_GP1); 4345 reg = iwl3945_read32(priv, CSR_UCODE_DRV_GP1);
4346 4346
4347 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { 4347 if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
4348 IWL_DEBUG_INFO("Requesting wakeup, GP1 = 0x%x\n", reg); 4348 IWL_DEBUG_INFO("Requesting wakeup, GP1 = 0x%x\n", reg);
4349 iwl_set_bit(priv, CSR_GP_CNTRL, 4349 iwl3945_set_bit(priv, CSR_GP_CNTRL,
4350 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 4350 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
4351 return rc; 4351 return rc;
4352 } 4352 }
4353 4353
4354 /* restore this queue's parameters in nic hardware. */ 4354 /* restore this queue's parameters in nic hardware. */
4355 rc = iwl_grab_nic_access(priv); 4355 rc = iwl3945_grab_nic_access(priv);
4356 if (rc) 4356 if (rc)
4357 return rc; 4357 return rc;
4358 iwl_write_direct32(priv, HBUS_TARG_WRPTR, 4358 iwl3945_write_direct32(priv, HBUS_TARG_WRPTR,
4359 txq->q.write_ptr | (txq_id << 8)); 4359 txq->q.write_ptr | (txq_id << 8));
4360 iwl_release_nic_access(priv); 4360 iwl3945_release_nic_access(priv);
4361 4361
4362 /* else not in power-save mode, uCode will never sleep when we're 4362 /* else not in power-save mode, uCode will never sleep when we're
4363 * trying to tx (during RFKILL, we're not trying to tx). */ 4363 * trying to tx (during RFKILL, we're not trying to tx). */
4364 } else 4364 } else
4365 iwl_write32(priv, HBUS_TARG_WRPTR, 4365 iwl3945_write32(priv, HBUS_TARG_WRPTR,
4366 txq->q.write_ptr | (txq_id << 8)); 4366 txq->q.write_ptr | (txq_id << 8));
4367 4367
4368 txq->need_update = 0; 4368 txq->need_update = 0;
@@ -4371,12 +4371,12 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv,
4371} 4371}
4372 4372
4373#ifdef CONFIG_IWL3945_DEBUG 4373#ifdef CONFIG_IWL3945_DEBUG
4374static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon) 4374static void iwl3945_print_rx_config_cmd(struct iwl3945_rxon_cmd *rxon)
4375{ 4375{
4376 DECLARE_MAC_BUF(mac); 4376 DECLARE_MAC_BUF(mac);
4377 4377
4378 IWL_DEBUG_RADIO("RX CONFIG:\n"); 4378 IWL_DEBUG_RADIO("RX CONFIG:\n");
4379 iwl_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); 4379 iwl3945_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
4380 IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); 4380 IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel));
4381 IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); 4381 IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags));
4382 IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n", 4382 IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n",
@@ -4393,24 +4393,24 @@ static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon)
4393} 4393}
4394#endif 4394#endif
4395 4395
4396static void iwl_enable_interrupts(struct iwl_priv *priv) 4396static void iwl3945_enable_interrupts(struct iwl3945_priv *priv)
4397{ 4397{
4398 IWL_DEBUG_ISR("Enabling interrupts\n"); 4398 IWL_DEBUG_ISR("Enabling interrupts\n");
4399 set_bit(STATUS_INT_ENABLED, &priv->status); 4399 set_bit(STATUS_INT_ENABLED, &priv->status);
4400 iwl_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK); 4400 iwl3945_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK);
4401} 4401}
4402 4402
4403static inline void iwl_disable_interrupts(struct iwl_priv *priv) 4403static inline void iwl3945_disable_interrupts(struct iwl3945_priv *priv)
4404{ 4404{
4405 clear_bit(STATUS_INT_ENABLED, &priv->status); 4405 clear_bit(STATUS_INT_ENABLED, &priv->status);
4406 4406
4407 /* disable interrupts from uCode/NIC to host */ 4407 /* disable interrupts from uCode/NIC to host */
4408 iwl_write32(priv, CSR_INT_MASK, 0x00000000); 4408 iwl3945_write32(priv, CSR_INT_MASK, 0x00000000);
4409 4409
4410 /* acknowledge/clear/reset any interrupts still pending 4410 /* acknowledge/clear/reset any interrupts still pending
4411 * from uCode or flow handler (Rx/Tx DMA) */ 4411 * from uCode or flow handler (Rx/Tx DMA) */
4412 iwl_write32(priv, CSR_INT, 0xffffffff); 4412 iwl3945_write32(priv, CSR_INT, 0xffffffff);
4413 iwl_write32(priv, CSR_FH_INT_STATUS, 0xffffffff); 4413 iwl3945_write32(priv, CSR_FH_INT_STATUS, 0xffffffff);
4414 IWL_DEBUG_ISR("Disabled interrupts\n"); 4414 IWL_DEBUG_ISR("Disabled interrupts\n");
4415} 4415}
4416 4416
@@ -4437,7 +4437,7 @@ static const char *desc_lookup(int i)
4437#define ERROR_START_OFFSET (1 * sizeof(u32)) 4437#define ERROR_START_OFFSET (1 * sizeof(u32))
4438#define ERROR_ELEM_SIZE (7 * sizeof(u32)) 4438#define ERROR_ELEM_SIZE (7 * sizeof(u32))
4439 4439
4440static void iwl_dump_nic_error_log(struct iwl_priv *priv) 4440static void iwl3945_dump_nic_error_log(struct iwl3945_priv *priv)
4441{ 4441{
4442 u32 i; 4442 u32 i;
4443 u32 desc, time, count, base, data1; 4443 u32 desc, time, count, base, data1;
@@ -4446,18 +4446,18 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv)
4446 4446
4447 base = le32_to_cpu(priv->card_alive.error_event_table_ptr); 4447 base = le32_to_cpu(priv->card_alive.error_event_table_ptr);
4448 4448
4449 if (!iwl_hw_valid_rtc_data_addr(base)) { 4449 if (!iwl3945_hw_valid_rtc_data_addr(base)) {
4450 IWL_ERROR("Not valid error log pointer 0x%08X\n", base); 4450 IWL_ERROR("Not valid error log pointer 0x%08X\n", base);
4451 return; 4451 return;
4452 } 4452 }
4453 4453
4454 rc = iwl_grab_nic_access(priv); 4454 rc = iwl3945_grab_nic_access(priv);
4455 if (rc) { 4455 if (rc) {
4456 IWL_WARNING("Can not read from adapter at this time.\n"); 4456 IWL_WARNING("Can not read from adapter at this time.\n");
4457 return; 4457 return;
4458 } 4458 }
4459 4459
4460 count = iwl_read_targ_mem(priv, base); 4460 count = iwl3945_read_targ_mem(priv, base);
4461 4461
4462 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { 4462 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
4463 IWL_ERROR("Start IWL Error Log Dump:\n"); 4463 IWL_ERROR("Start IWL Error Log Dump:\n");
@@ -4470,19 +4470,19 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv)
4470 for (i = ERROR_START_OFFSET; 4470 for (i = ERROR_START_OFFSET;
4471 i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET; 4471 i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET;
4472 i += ERROR_ELEM_SIZE) { 4472 i += ERROR_ELEM_SIZE) {
4473 desc = iwl_read_targ_mem(priv, base + i); 4473 desc = iwl3945_read_targ_mem(priv, base + i);
4474 time = 4474 time =
4475 iwl_read_targ_mem(priv, base + i + 1 * sizeof(u32)); 4475 iwl3945_read_targ_mem(priv, base + i + 1 * sizeof(u32));
4476 blink1 = 4476 blink1 =
4477 iwl_read_targ_mem(priv, base + i + 2 * sizeof(u32)); 4477 iwl3945_read_targ_mem(priv, base + i + 2 * sizeof(u32));
4478 blink2 = 4478 blink2 =
4479 iwl_read_targ_mem(priv, base + i + 3 * sizeof(u32)); 4479 iwl3945_read_targ_mem(priv, base + i + 3 * sizeof(u32));
4480 ilink1 = 4480 ilink1 =
4481 iwl_read_targ_mem(priv, base + i + 4 * sizeof(u32)); 4481 iwl3945_read_targ_mem(priv, base + i + 4 * sizeof(u32));
4482 ilink2 = 4482 ilink2 =
4483 iwl_read_targ_mem(priv, base + i + 5 * sizeof(u32)); 4483 iwl3945_read_targ_mem(priv, base + i + 5 * sizeof(u32));
4484 data1 = 4484 data1 =
4485 iwl_read_targ_mem(priv, base + i + 6 * sizeof(u32)); 4485 iwl3945_read_targ_mem(priv, base + i + 6 * sizeof(u32));
4486 4486
4487 IWL_ERROR 4487 IWL_ERROR
4488 ("%-13s (#%d) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n", 4488 ("%-13s (#%d) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n",
@@ -4490,18 +4490,18 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv)
4490 ilink1, ilink2, data1); 4490 ilink1, ilink2, data1);
4491 } 4491 }
4492 4492
4493 iwl_release_nic_access(priv); 4493 iwl3945_release_nic_access(priv);
4494 4494
4495} 4495}
4496 4496
4497#define EVENT_START_OFFSET (4 * sizeof(u32)) 4497#define EVENT_START_OFFSET (4 * sizeof(u32))
4498 4498
4499/** 4499/**
4500 * iwl_print_event_log - Dump error event log to syslog 4500 * iwl3945_print_event_log - Dump error event log to syslog
4501 * 4501 *
4502 * NOTE: Must be called with iwl_grab_nic_access() already obtained! 4502 * NOTE: Must be called with iwl3945_grab_nic_access() already obtained!
4503 */ 4503 */
4504static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, 4504static void iwl3945_print_event_log(struct iwl3945_priv *priv, u32 start_idx,
4505 u32 num_events, u32 mode) 4505 u32 num_events, u32 mode)
4506{ 4506{
4507 u32 i; 4507 u32 i;
@@ -4525,21 +4525,21 @@ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx,
4525 /* "time" is actually "data" for mode 0 (no timestamp). 4525 /* "time" is actually "data" for mode 0 (no timestamp).
4526 * place event id # at far right for easier visual parsing. */ 4526 * place event id # at far right for easier visual parsing. */
4527 for (i = 0; i < num_events; i++) { 4527 for (i = 0; i < num_events; i++) {
4528 ev = iwl_read_targ_mem(priv, ptr); 4528 ev = iwl3945_read_targ_mem(priv, ptr);
4529 ptr += sizeof(u32); 4529 ptr += sizeof(u32);
4530 time = iwl_read_targ_mem(priv, ptr); 4530 time = iwl3945_read_targ_mem(priv, ptr);
4531 ptr += sizeof(u32); 4531 ptr += sizeof(u32);
4532 if (mode == 0) 4532 if (mode == 0)
4533 IWL_ERROR("0x%08x\t%04u\n", time, ev); /* data, ev */ 4533 IWL_ERROR("0x%08x\t%04u\n", time, ev); /* data, ev */
4534 else { 4534 else {
4535 data = iwl_read_targ_mem(priv, ptr); 4535 data = iwl3945_read_targ_mem(priv, ptr);
4536 ptr += sizeof(u32); 4536 ptr += sizeof(u32);
4537 IWL_ERROR("%010u\t0x%08x\t%04u\n", time, data, ev); 4537 IWL_ERROR("%010u\t0x%08x\t%04u\n", time, data, ev);
4538 } 4538 }
4539 } 4539 }
4540} 4540}
4541 4541
4542static void iwl_dump_nic_event_log(struct iwl_priv *priv) 4542static void iwl3945_dump_nic_event_log(struct iwl3945_priv *priv)
4543{ 4543{
4544 int rc; 4544 int rc;
4545 u32 base; /* SRAM byte address of event log header */ 4545 u32 base; /* SRAM byte address of event log header */
@@ -4550,29 +4550,29 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv)
4550 u32 size; /* # entries that we'll print */ 4550 u32 size; /* # entries that we'll print */
4551 4551
4552 base = le32_to_cpu(priv->card_alive.log_event_table_ptr); 4552 base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
4553 if (!iwl_hw_valid_rtc_data_addr(base)) { 4553 if (!iwl3945_hw_valid_rtc_data_addr(base)) {
4554 IWL_ERROR("Invalid event log pointer 0x%08X\n", base); 4554 IWL_ERROR("Invalid event log pointer 0x%08X\n", base);
4555 return; 4555 return;
4556 } 4556 }
4557 4557
4558 rc = iwl_grab_nic_access(priv); 4558 rc = iwl3945_grab_nic_access(priv);
4559 if (rc) { 4559 if (rc) {
4560 IWL_WARNING("Can not read from adapter at this time.\n"); 4560 IWL_WARNING("Can not read from adapter at this time.\n");
4561 return; 4561 return;
4562 } 4562 }
4563 4563
4564 /* event log header */ 4564 /* event log header */
4565 capacity = iwl_read_targ_mem(priv, base); 4565 capacity = iwl3945_read_targ_mem(priv, base);
4566 mode = iwl_read_targ_mem(priv, base + (1 * sizeof(u32))); 4566 mode = iwl3945_read_targ_mem(priv, base + (1 * sizeof(u32)));
4567 num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32))); 4567 num_wraps = iwl3945_read_targ_mem(priv, base + (2 * sizeof(u32)));
4568 next_entry = iwl_read_targ_mem(priv, base + (3 * sizeof(u32))); 4568 next_entry = iwl3945_read_targ_mem(priv, base + (3 * sizeof(u32)));
4569 4569
4570 size = num_wraps ? capacity : next_entry; 4570 size = num_wraps ? capacity : next_entry;
4571 4571
4572 /* bail out if nothing in log */ 4572 /* bail out if nothing in log */
4573 if (size == 0) { 4573 if (size == 0) {
4574 IWL_ERROR("Start IWL Event Log Dump: nothing in log\n"); 4574 IWL_ERROR("Start IWL Event Log Dump: nothing in log\n");
4575 iwl_release_nic_access(priv); 4575 iwl3945_release_nic_access(priv);
4576 return; 4576 return;
4577 } 4577 }
4578 4578
@@ -4582,31 +4582,31 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv)
4582 /* if uCode has wrapped back to top of log, start at the oldest entry, 4582 /* if uCode has wrapped back to top of log, start at the oldest entry,
4583 * i.e the next one that uCode would fill. */ 4583 * i.e the next one that uCode would fill. */
4584 if (num_wraps) 4584 if (num_wraps)
4585 iwl_print_event_log(priv, next_entry, 4585 iwl3945_print_event_log(priv, next_entry,
4586 capacity - next_entry, mode); 4586 capacity - next_entry, mode);
4587 4587
4588 /* (then/else) start at top of log */ 4588 /* (then/else) start at top of log */
4589 iwl_print_event_log(priv, 0, next_entry, mode); 4589 iwl3945_print_event_log(priv, 0, next_entry, mode);
4590 4590
4591 iwl_release_nic_access(priv); 4591 iwl3945_release_nic_access(priv);
4592} 4592}
4593 4593
4594/** 4594/**
4595 * iwl_irq_handle_error - called for HW or SW error interrupt from card 4595 * iwl3945_irq_handle_error - called for HW or SW error interrupt from card
4596 */ 4596 */
4597static void iwl_irq_handle_error(struct iwl_priv *priv) 4597static void iwl3945_irq_handle_error(struct iwl3945_priv *priv)
4598{ 4598{
4599 /* Set the FW error flag -- cleared on iwl_down */ 4599 /* Set the FW error flag -- cleared on iwl3945_down */
4600 set_bit(STATUS_FW_ERROR, &priv->status); 4600 set_bit(STATUS_FW_ERROR, &priv->status);
4601 4601
4602 /* Cancel currently queued command. */ 4602 /* Cancel currently queued command. */
4603 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 4603 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
4604 4604
4605#ifdef CONFIG_IWL3945_DEBUG 4605#ifdef CONFIG_IWL3945_DEBUG
4606 if (iwl_debug_level & IWL_DL_FW_ERRORS) { 4606 if (iwl3945_debug_level & IWL_DL_FW_ERRORS) {
4607 iwl_dump_nic_error_log(priv); 4607 iwl3945_dump_nic_error_log(priv);
4608 iwl_dump_nic_event_log(priv); 4608 iwl3945_dump_nic_event_log(priv);
4609 iwl_print_rx_config_cmd(&priv->staging_rxon); 4609 iwl3945_print_rx_config_cmd(&priv->staging_rxon);
4610 } 4610 }
4611#endif 4611#endif
4612 4612
@@ -4620,7 +4620,7 @@ static void iwl_irq_handle_error(struct iwl_priv *priv)
4620 IWL_DEBUG(IWL_DL_INFO | IWL_DL_FW_ERRORS, 4620 IWL_DEBUG(IWL_DL_INFO | IWL_DL_FW_ERRORS,
4621 "Restarting adapter due to uCode error.\n"); 4621 "Restarting adapter due to uCode error.\n");
4622 4622
4623 if (iwl_is_associated(priv)) { 4623 if (iwl3945_is_associated(priv)) {
4624 memcpy(&priv->recovery_rxon, &priv->active_rxon, 4624 memcpy(&priv->recovery_rxon, &priv->active_rxon,
4625 sizeof(priv->recovery_rxon)); 4625 sizeof(priv->recovery_rxon));
4626 priv->error_recovering = 1; 4626 priv->error_recovering = 1;
@@ -4629,16 +4629,16 @@ static void iwl_irq_handle_error(struct iwl_priv *priv)
4629 } 4629 }
4630} 4630}
4631 4631
4632static void iwl_error_recovery(struct iwl_priv *priv) 4632static void iwl3945_error_recovery(struct iwl3945_priv *priv)
4633{ 4633{
4634 unsigned long flags; 4634 unsigned long flags;
4635 4635
4636 memcpy(&priv->staging_rxon, &priv->recovery_rxon, 4636 memcpy(&priv->staging_rxon, &priv->recovery_rxon,
4637 sizeof(priv->staging_rxon)); 4637 sizeof(priv->staging_rxon));
4638 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 4638 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
4639 iwl_commit_rxon(priv); 4639 iwl3945_commit_rxon(priv);
4640 4640
4641 iwl_add_station(priv, priv->bssid, 1, 0); 4641 iwl3945_add_station(priv, priv->bssid, 1, 0);
4642 4642
4643 spin_lock_irqsave(&priv->lock, flags); 4643 spin_lock_irqsave(&priv->lock, flags);
4644 priv->assoc_id = le16_to_cpu(priv->staging_rxon.assoc_id); 4644 priv->assoc_id = le16_to_cpu(priv->staging_rxon.assoc_id);
@@ -4646,7 +4646,7 @@ static void iwl_error_recovery(struct iwl_priv *priv)
4646 spin_unlock_irqrestore(&priv->lock, flags); 4646 spin_unlock_irqrestore(&priv->lock, flags);
4647} 4647}
4648 4648
4649static void iwl_irq_tasklet(struct iwl_priv *priv) 4649static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
4650{ 4650{
4651 u32 inta, handled = 0; 4651 u32 inta, handled = 0;
4652 u32 inta_fh; 4652 u32 inta_fh;
@@ -4660,18 +4660,18 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4660 /* Ack/clear/reset pending uCode interrupts. 4660 /* Ack/clear/reset pending uCode interrupts.
4661 * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, 4661 * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS,
4662 * and will clear only when CSR_FH_INT_STATUS gets cleared. */ 4662 * and will clear only when CSR_FH_INT_STATUS gets cleared. */
4663 inta = iwl_read32(priv, CSR_INT); 4663 inta = iwl3945_read32(priv, CSR_INT);
4664 iwl_write32(priv, CSR_INT, inta); 4664 iwl3945_write32(priv, CSR_INT, inta);
4665 4665
4666 /* Ack/clear/reset pending flow-handler (DMA) interrupts. 4666 /* Ack/clear/reset pending flow-handler (DMA) interrupts.
4667 * Any new interrupts that happen after this, either while we're 4667 * Any new interrupts that happen after this, either while we're
4668 * in this tasklet, or later, will show up in next ISR/tasklet. */ 4668 * in this tasklet, or later, will show up in next ISR/tasklet. */
4669 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 4669 inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS);
4670 iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh); 4670 iwl3945_write32(priv, CSR_FH_INT_STATUS, inta_fh);
4671 4671
4672#ifdef CONFIG_IWL3945_DEBUG 4672#ifdef CONFIG_IWL3945_DEBUG
4673 if (iwl_debug_level & IWL_DL_ISR) { 4673 if (iwl3945_debug_level & IWL_DL_ISR) {
4674 inta_mask = iwl_read32(priv, CSR_INT_MASK); /* just for debug */ 4674 inta_mask = iwl3945_read32(priv, CSR_INT_MASK); /* just for debug */
4675 IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 4675 IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
4676 inta, inta_mask, inta_fh); 4676 inta, inta_mask, inta_fh);
4677 } 4677 }
@@ -4691,9 +4691,9 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4691 IWL_ERROR("Microcode HW error detected. Restarting.\n"); 4691 IWL_ERROR("Microcode HW error detected. Restarting.\n");
4692 4692
4693 /* Tell the device to stop sending interrupts */ 4693 /* Tell the device to stop sending interrupts */
4694 iwl_disable_interrupts(priv); 4694 iwl3945_disable_interrupts(priv);
4695 4695
4696 iwl_irq_handle_error(priv); 4696 iwl3945_irq_handle_error(priv);
4697 4697
4698 handled |= CSR_INT_BIT_HW_ERR; 4698 handled |= CSR_INT_BIT_HW_ERR;
4699 4699
@@ -4703,7 +4703,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4703 } 4703 }
4704 4704
4705#ifdef CONFIG_IWL3945_DEBUG 4705#ifdef CONFIG_IWL3945_DEBUG
4706 if (iwl_debug_level & (IWL_DL_ISR)) { 4706 if (iwl3945_debug_level & (IWL_DL_ISR)) {
4707 /* NIC fires this, but we don't use it, redundant with WAKEUP */ 4707 /* NIC fires this, but we don't use it, redundant with WAKEUP */
4708 if (inta & CSR_INT_BIT_MAC_CLK_ACTV) 4708 if (inta & CSR_INT_BIT_MAC_CLK_ACTV)
4709 IWL_DEBUG_ISR("Microcode started or stopped.\n"); 4709 IWL_DEBUG_ISR("Microcode started or stopped.\n");
@@ -4719,7 +4719,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4719 /* HW RF KILL switch toggled (4965 only) */ 4719 /* HW RF KILL switch toggled (4965 only) */
4720 if (inta & CSR_INT_BIT_RF_KILL) { 4720 if (inta & CSR_INT_BIT_RF_KILL) {
4721 int hw_rf_kill = 0; 4721 int hw_rf_kill = 0;
4722 if (!(iwl_read32(priv, CSR_GP_CNTRL) & 4722 if (!(iwl3945_read32(priv, CSR_GP_CNTRL) &
4723 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) 4723 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW))
4724 hw_rf_kill = 1; 4724 hw_rf_kill = 1;
4725 4725
@@ -4749,20 +4749,20 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4749 if (inta & CSR_INT_BIT_SW_ERR) { 4749 if (inta & CSR_INT_BIT_SW_ERR) {
4750 IWL_ERROR("Microcode SW error detected. Restarting 0x%X.\n", 4750 IWL_ERROR("Microcode SW error detected. Restarting 0x%X.\n",
4751 inta); 4751 inta);
4752 iwl_irq_handle_error(priv); 4752 iwl3945_irq_handle_error(priv);
4753 handled |= CSR_INT_BIT_SW_ERR; 4753 handled |= CSR_INT_BIT_SW_ERR;
4754 } 4754 }
4755 4755
4756 /* uCode wakes up after power-down sleep */ 4756 /* uCode wakes up after power-down sleep */
4757 if (inta & CSR_INT_BIT_WAKEUP) { 4757 if (inta & CSR_INT_BIT_WAKEUP) {
4758 IWL_DEBUG_ISR("Wakeup interrupt\n"); 4758 IWL_DEBUG_ISR("Wakeup interrupt\n");
4759 iwl_rx_queue_update_write_ptr(priv, &priv->rxq); 4759 iwl3945_rx_queue_update_write_ptr(priv, &priv->rxq);
4760 iwl_tx_queue_update_write_ptr(priv, &priv->txq[0]); 4760 iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[0]);
4761 iwl_tx_queue_update_write_ptr(priv, &priv->txq[1]); 4761 iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[1]);
4762 iwl_tx_queue_update_write_ptr(priv, &priv->txq[2]); 4762 iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[2]);
4763 iwl_tx_queue_update_write_ptr(priv, &priv->txq[3]); 4763 iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[3]);
4764 iwl_tx_queue_update_write_ptr(priv, &priv->txq[4]); 4764 iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[4]);
4765 iwl_tx_queue_update_write_ptr(priv, &priv->txq[5]); 4765 iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[5]);
4766 4766
4767 handled |= CSR_INT_BIT_WAKEUP; 4767 handled |= CSR_INT_BIT_WAKEUP;
4768 } 4768 }
@@ -4771,19 +4771,19 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4771 * Rx "responses" (frame-received notification), and other 4771 * Rx "responses" (frame-received notification), and other
4772 * notifications from uCode come through here*/ 4772 * notifications from uCode come through here*/
4773 if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { 4773 if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) {
4774 iwl_rx_handle(priv); 4774 iwl3945_rx_handle(priv);
4775 handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); 4775 handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX);
4776 } 4776 }
4777 4777
4778 if (inta & CSR_INT_BIT_FH_TX) { 4778 if (inta & CSR_INT_BIT_FH_TX) {
4779 IWL_DEBUG_ISR("Tx interrupt\n"); 4779 IWL_DEBUG_ISR("Tx interrupt\n");
4780 4780
4781 iwl_write32(priv, CSR_FH_INT_STATUS, (1 << 6)); 4781 iwl3945_write32(priv, CSR_FH_INT_STATUS, (1 << 6));
4782 if (!iwl_grab_nic_access(priv)) { 4782 if (!iwl3945_grab_nic_access(priv)) {
4783 iwl_write_direct32(priv, 4783 iwl3945_write_direct32(priv,
4784 FH_TCSR_CREDIT 4784 FH_TCSR_CREDIT
4785 (ALM_FH_SRVC_CHNL), 0x0); 4785 (ALM_FH_SRVC_CHNL), 0x0);
4786 iwl_release_nic_access(priv); 4786 iwl3945_release_nic_access(priv);
4787 } 4787 }
4788 handled |= CSR_INT_BIT_FH_TX; 4788 handled |= CSR_INT_BIT_FH_TX;
4789 } 4789 }
@@ -4798,13 +4798,13 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4798 } 4798 }
4799 4799
4800 /* Re-enable all interrupts */ 4800 /* Re-enable all interrupts */
4801 iwl_enable_interrupts(priv); 4801 iwl3945_enable_interrupts(priv);
4802 4802
4803#ifdef CONFIG_IWL3945_DEBUG 4803#ifdef CONFIG_IWL3945_DEBUG
4804 if (iwl_debug_level & (IWL_DL_ISR)) { 4804 if (iwl3945_debug_level & (IWL_DL_ISR)) {
4805 inta = iwl_read32(priv, CSR_INT); 4805 inta = iwl3945_read32(priv, CSR_INT);
4806 inta_mask = iwl_read32(priv, CSR_INT_MASK); 4806 inta_mask = iwl3945_read32(priv, CSR_INT_MASK);
4807 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 4807 inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS);
4808 IWL_DEBUG_ISR("End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " 4808 IWL_DEBUG_ISR("End inta 0x%08x, enabled 0x%08x, fh 0x%08x, "
4809 "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); 4809 "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags);
4810 } 4810 }
@@ -4812,9 +4812,9 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4812 spin_unlock_irqrestore(&priv->lock, flags); 4812 spin_unlock_irqrestore(&priv->lock, flags);
4813} 4813}
4814 4814
4815static irqreturn_t iwl_isr(int irq, void *data) 4815static irqreturn_t iwl3945_isr(int irq, void *data)
4816{ 4816{
4817 struct iwl_priv *priv = data; 4817 struct iwl3945_priv *priv = data;
4818 u32 inta, inta_mask; 4818 u32 inta, inta_mask;
4819 u32 inta_fh; 4819 u32 inta_fh;
4820 if (!priv) 4820 if (!priv)
@@ -4826,12 +4826,12 @@ static irqreturn_t iwl_isr(int irq, void *data)
4826 * back-to-back ISRs and sporadic interrupts from our NIC. 4826 * back-to-back ISRs and sporadic interrupts from our NIC.
4827 * If we have something to service, the tasklet will re-enable ints. 4827 * If we have something to service, the tasklet will re-enable ints.
4828 * If we *don't* have something, we'll re-enable before leaving here. */ 4828 * If we *don't* have something, we'll re-enable before leaving here. */
4829 inta_mask = iwl_read32(priv, CSR_INT_MASK); /* just for debug */ 4829 inta_mask = iwl3945_read32(priv, CSR_INT_MASK); /* just for debug */
4830 iwl_write32(priv, CSR_INT_MASK, 0x00000000); 4830 iwl3945_write32(priv, CSR_INT_MASK, 0x00000000);
4831 4831
4832 /* Discover which interrupts are active/pending */ 4832 /* Discover which interrupts are active/pending */
4833 inta = iwl_read32(priv, CSR_INT); 4833 inta = iwl3945_read32(priv, CSR_INT);
4834 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 4834 inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS);
4835 4835
4836 /* Ignore interrupt if there's nothing in NIC to service. 4836 /* Ignore interrupt if there's nothing in NIC to service.
4837 * This may be due to IRQ shared with another device, 4837 * This may be due to IRQ shared with another device,
@@ -4850,7 +4850,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
4850 IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 4850 IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
4851 inta, inta_mask, inta_fh); 4851 inta, inta_mask, inta_fh);
4852 4852
4853 /* iwl_irq_tasklet() will service interrupts and re-enable them */ 4853 /* iwl3945_irq_tasklet() will service interrupts and re-enable them */
4854 tasklet_schedule(&priv->irq_tasklet); 4854 tasklet_schedule(&priv->irq_tasklet);
4855unplugged: 4855unplugged:
4856 spin_unlock(&priv->lock); 4856 spin_unlock(&priv->lock);
@@ -4859,18 +4859,18 @@ unplugged:
4859 4859
4860 none: 4860 none:
4861 /* re-enable interrupts here since we don't have anything to service. */ 4861 /* re-enable interrupts here since we don't have anything to service. */
4862 iwl_enable_interrupts(priv); 4862 iwl3945_enable_interrupts(priv);
4863 spin_unlock(&priv->lock); 4863 spin_unlock(&priv->lock);
4864 return IRQ_NONE; 4864 return IRQ_NONE;
4865} 4865}
4866 4866
4867/************************** EEPROM BANDS **************************** 4867/************************** EEPROM BANDS ****************************
4868 * 4868 *
4869 * The iwl_eeprom_band definitions below provide the mapping from the 4869 * The iwl3945_eeprom_band definitions below provide the mapping from the
4870 * EEPROM contents to the specific channel number supported for each 4870 * EEPROM contents to the specific channel number supported for each
4871 * band. 4871 * band.
4872 * 4872 *
4873 * For example, iwl_priv->eeprom.band_3_channels[4] from the band_3 4873 * For example, iwl3945_priv->eeprom.band_3_channels[4] from the band_3
4874 * definition below maps to physical channel 42 in the 5.2GHz spectrum. 4874 * definition below maps to physical channel 42 in the 5.2GHz spectrum.
4875 * The specific geography and calibration information for that channel 4875 * The specific geography and calibration information for that channel
4876 * is contained in the eeprom map itself. 4876 * is contained in the eeprom map itself.
@@ -4896,58 +4896,58 @@ unplugged:
4896 *********************************************************************/ 4896 *********************************************************************/
4897 4897
4898/* 2.4 GHz */ 4898/* 2.4 GHz */
4899static const u8 iwl_eeprom_band_1[14] = { 4899static const u8 iwl3945_eeprom_band_1[14] = {
4900 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 4900 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
4901}; 4901};
4902 4902
4903/* 5.2 GHz bands */ 4903/* 5.2 GHz bands */
4904static const u8 iwl_eeprom_band_2[] = { 4904static const u8 iwl3945_eeprom_band_2[] = {
4905 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16 4905 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16
4906}; 4906};
4907 4907
4908static const u8 iwl_eeprom_band_3[] = { /* 5205-5320MHz */ 4908static const u8 iwl3945_eeprom_band_3[] = { /* 5205-5320MHz */
4909 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 4909 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
4910}; 4910};
4911 4911
4912static const u8 iwl_eeprom_band_4[] = { /* 5500-5700MHz */ 4912static const u8 iwl3945_eeprom_band_4[] = { /* 5500-5700MHz */
4913 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 4913 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
4914}; 4914};
4915 4915
4916static const u8 iwl_eeprom_band_5[] = { /* 5725-5825MHz */ 4916static const u8 iwl3945_eeprom_band_5[] = { /* 5725-5825MHz */
4917 145, 149, 153, 157, 161, 165 4917 145, 149, 153, 157, 161, 165
4918}; 4918};
4919 4919
4920static void iwl_init_band_reference(const struct iwl_priv *priv, int band, 4920static void iwl3945_init_band_reference(const struct iwl3945_priv *priv, int band,
4921 int *eeprom_ch_count, 4921 int *eeprom_ch_count,
4922 const struct iwl_eeprom_channel 4922 const struct iwl3945_eeprom_channel
4923 **eeprom_ch_info, 4923 **eeprom_ch_info,
4924 const u8 **eeprom_ch_index) 4924 const u8 **eeprom_ch_index)
4925{ 4925{
4926 switch (band) { 4926 switch (band) {
4927 case 1: /* 2.4GHz band */ 4927 case 1: /* 2.4GHz band */
4928 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_1); 4928 *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_1);
4929 *eeprom_ch_info = priv->eeprom.band_1_channels; 4929 *eeprom_ch_info = priv->eeprom.band_1_channels;
4930 *eeprom_ch_index = iwl_eeprom_band_1; 4930 *eeprom_ch_index = iwl3945_eeprom_band_1;
4931 break; 4931 break;
4932 case 2: /* 5.2GHz band */ 4932 case 2: /* 5.2GHz band */
4933 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_2); 4933 *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_2);
4934 *eeprom_ch_info = priv->eeprom.band_2_channels; 4934 *eeprom_ch_info = priv->eeprom.band_2_channels;
4935 *eeprom_ch_index = iwl_eeprom_band_2; 4935 *eeprom_ch_index = iwl3945_eeprom_band_2;
4936 break; 4936 break;
4937 case 3: /* 5.2GHz band */ 4937 case 3: /* 5.2GHz band */
4938 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_3); 4938 *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_3);
4939 *eeprom_ch_info = priv->eeprom.band_3_channels; 4939 *eeprom_ch_info = priv->eeprom.band_3_channels;
4940 *eeprom_ch_index = iwl_eeprom_band_3; 4940 *eeprom_ch_index = iwl3945_eeprom_band_3;
4941 break; 4941 break;
4942 case 4: /* 5.2GHz band */ 4942 case 4: /* 5.2GHz band */
4943 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_4); 4943 *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_4);
4944 *eeprom_ch_info = priv->eeprom.band_4_channels; 4944 *eeprom_ch_info = priv->eeprom.band_4_channels;
4945 *eeprom_ch_index = iwl_eeprom_band_4; 4945 *eeprom_ch_index = iwl3945_eeprom_band_4;
4946 break; 4946 break;
4947 case 5: /* 5.2GHz band */ 4947 case 5: /* 5.2GHz band */
4948 *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_5); 4948 *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_5);
4949 *eeprom_ch_info = priv->eeprom.band_5_channels; 4949 *eeprom_ch_info = priv->eeprom.band_5_channels;
4950 *eeprom_ch_index = iwl_eeprom_band_5; 4950 *eeprom_ch_index = iwl3945_eeprom_band_5;
4951 break; 4951 break;
4952 default: 4952 default:
4953 BUG(); 4953 BUG();
@@ -4955,7 +4955,7 @@ static void iwl_init_band_reference(const struct iwl_priv *priv, int band,
4955 } 4955 }
4956} 4956}
4957 4957
4958const struct iwl_channel_info *iwl_get_channel_info(const struct iwl_priv *priv, 4958const struct iwl3945_channel_info *iwl3945_get_channel_info(const struct iwl3945_priv *priv,
4959 int phymode, u16 channel) 4959 int phymode, u16 channel)
4960{ 4960{
4961 int i; 4961 int i;
@@ -4982,13 +4982,13 @@ const struct iwl_channel_info *iwl_get_channel_info(const struct iwl_priv *priv,
4982#define CHECK_AND_PRINT(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \ 4982#define CHECK_AND_PRINT(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \
4983 ? # x " " : "") 4983 ? # x " " : "")
4984 4984
4985static int iwl_init_channel_map(struct iwl_priv *priv) 4985static int iwl3945_init_channel_map(struct iwl3945_priv *priv)
4986{ 4986{
4987 int eeprom_ch_count = 0; 4987 int eeprom_ch_count = 0;
4988 const u8 *eeprom_ch_index = NULL; 4988 const u8 *eeprom_ch_index = NULL;
4989 const struct iwl_eeprom_channel *eeprom_ch_info = NULL; 4989 const struct iwl3945_eeprom_channel *eeprom_ch_info = NULL;
4990 int band, ch; 4990 int band, ch;
4991 struct iwl_channel_info *ch_info; 4991 struct iwl3945_channel_info *ch_info;
4992 4992
4993 if (priv->channel_count) { 4993 if (priv->channel_count) {
4994 IWL_DEBUG_INFO("Channel map already initialized.\n"); 4994 IWL_DEBUG_INFO("Channel map already initialized.\n");
@@ -5004,15 +5004,15 @@ static int iwl_init_channel_map(struct iwl_priv *priv)
5004 IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n"); 5004 IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n");
5005 5005
5006 priv->channel_count = 5006 priv->channel_count =
5007 ARRAY_SIZE(iwl_eeprom_band_1) + 5007 ARRAY_SIZE(iwl3945_eeprom_band_1) +
5008 ARRAY_SIZE(iwl_eeprom_band_2) + 5008 ARRAY_SIZE(iwl3945_eeprom_band_2) +
5009 ARRAY_SIZE(iwl_eeprom_band_3) + 5009 ARRAY_SIZE(iwl3945_eeprom_band_3) +
5010 ARRAY_SIZE(iwl_eeprom_band_4) + 5010 ARRAY_SIZE(iwl3945_eeprom_band_4) +
5011 ARRAY_SIZE(iwl_eeprom_band_5); 5011 ARRAY_SIZE(iwl3945_eeprom_band_5);
5012 5012
5013 IWL_DEBUG_INFO("Parsing data for %d channels.\n", priv->channel_count); 5013 IWL_DEBUG_INFO("Parsing data for %d channels.\n", priv->channel_count);
5014 5014
5015 priv->channel_info = kzalloc(sizeof(struct iwl_channel_info) * 5015 priv->channel_info = kzalloc(sizeof(struct iwl3945_channel_info) *
5016 priv->channel_count, GFP_KERNEL); 5016 priv->channel_count, GFP_KERNEL);
5017 if (!priv->channel_info) { 5017 if (!priv->channel_info) {
5018 IWL_ERROR("Could not allocate channel_info\n"); 5018 IWL_ERROR("Could not allocate channel_info\n");
@@ -5027,7 +5027,7 @@ static int iwl_init_channel_map(struct iwl_priv *priv)
5027 * what just in the EEPROM) */ 5027 * what just in the EEPROM) */
5028 for (band = 1; band <= 5; band++) { 5028 for (band = 1; band <= 5; band++) {
5029 5029
5030 iwl_init_band_reference(priv, band, &eeprom_ch_count, 5030 iwl3945_init_band_reference(priv, band, &eeprom_ch_count,
5031 &eeprom_ch_info, &eeprom_ch_index); 5031 &eeprom_ch_info, &eeprom_ch_index);
5032 5032
5033 /* Loop through each band adding each of the channels */ 5033 /* Loop through each band adding each of the channels */
@@ -5120,7 +5120,7 @@ static int iwl_init_channel_map(struct iwl_priv *priv)
5120#define IWL_PASSIVE_DWELL_BASE (100) 5120#define IWL_PASSIVE_DWELL_BASE (100)
5121#define IWL_CHANNEL_TUNE_TIME 5 5121#define IWL_CHANNEL_TUNE_TIME 5
5122 5122
5123static inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv, int phymode) 5123static inline u16 iwl3945_get_active_dwell_time(struct iwl3945_priv *priv, int phymode)
5124{ 5124{
5125 if (phymode == MODE_IEEE80211A) 5125 if (phymode == MODE_IEEE80211A)
5126 return IWL_ACTIVE_DWELL_TIME_52; 5126 return IWL_ACTIVE_DWELL_TIME_52;
@@ -5128,14 +5128,14 @@ static inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv, int phymode)
5128 return IWL_ACTIVE_DWELL_TIME_24; 5128 return IWL_ACTIVE_DWELL_TIME_24;
5129} 5129}
5130 5130
5131static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, int phymode) 5131static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv, int phymode)
5132{ 5132{
5133 u16 active = iwl_get_active_dwell_time(priv, phymode); 5133 u16 active = iwl3945_get_active_dwell_time(priv, phymode);
5134 u16 passive = (phymode != MODE_IEEE80211A) ? 5134 u16 passive = (phymode != MODE_IEEE80211A) ?
5135 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : 5135 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 :
5136 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; 5136 IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52;
5137 5137
5138 if (iwl_is_associated(priv)) { 5138 if (iwl3945_is_associated(priv)) {
5139 /* If we're associated, we clamp the maximum passive 5139 /* If we're associated, we clamp the maximum passive
5140 * dwell time to be 98% of the beacon interval (minus 5140 * dwell time to be 98% of the beacon interval (minus
5141 * 2 * channel tune time) */ 5141 * 2 * channel tune time) */
@@ -5151,30 +5151,30 @@ static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, int phymode)
5151 return passive; 5151 return passive;
5152} 5152}
5153 5153
5154static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode, 5154static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, int phymode,
5155 u8 is_active, u8 direct_mask, 5155 u8 is_active, u8 direct_mask,
5156 struct iwl_scan_channel *scan_ch) 5156 struct iwl3945_scan_channel *scan_ch)
5157{ 5157{
5158 const struct ieee80211_channel *channels = NULL; 5158 const struct ieee80211_channel *channels = NULL;
5159 const struct ieee80211_hw_mode *hw_mode; 5159 const struct ieee80211_hw_mode *hw_mode;
5160 const struct iwl_channel_info *ch_info; 5160 const struct iwl3945_channel_info *ch_info;
5161 u16 passive_dwell = 0; 5161 u16 passive_dwell = 0;
5162 u16 active_dwell = 0; 5162 u16 active_dwell = 0;
5163 int added, i; 5163 int added, i;
5164 5164
5165 hw_mode = iwl_get_hw_mode(priv, phymode); 5165 hw_mode = iwl3945_get_hw_mode(priv, phymode);
5166 if (!hw_mode) 5166 if (!hw_mode)
5167 return 0; 5167 return 0;
5168 5168
5169 channels = hw_mode->channels; 5169 channels = hw_mode->channels;
5170 5170
5171 active_dwell = iwl_get_active_dwell_time(priv, phymode); 5171 active_dwell = iwl3945_get_active_dwell_time(priv, phymode);
5172 passive_dwell = iwl_get_passive_dwell_time(priv, phymode); 5172 passive_dwell = iwl3945_get_passive_dwell_time(priv, phymode);
5173 5173
5174 for (i = 0, added = 0; i < hw_mode->num_channels; i++) { 5174 for (i = 0, added = 0; i < hw_mode->num_channels; i++) {
5175 if (channels[i].chan == 5175 if (channels[i].chan ==
5176 le16_to_cpu(priv->active_rxon.channel)) { 5176 le16_to_cpu(priv->active_rxon.channel)) {
5177 if (iwl_is_associated(priv)) { 5177 if (iwl3945_is_associated(priv)) {
5178 IWL_DEBUG_SCAN 5178 IWL_DEBUG_SCAN
5179 ("Skipping current channel %d\n", 5179 ("Skipping current channel %d\n",
5180 le16_to_cpu(priv->active_rxon.channel)); 5180 le16_to_cpu(priv->active_rxon.channel));
@@ -5185,7 +5185,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode,
5185 5185
5186 scan_ch->channel = channels[i].chan; 5186 scan_ch->channel = channels[i].chan;
5187 5187
5188 ch_info = iwl_get_channel_info(priv, phymode, scan_ch->channel); 5188 ch_info = iwl3945_get_channel_info(priv, phymode, scan_ch->channel);
5189 if (!is_channel_valid(ch_info)) { 5189 if (!is_channel_valid(ch_info)) {
5190 IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", 5190 IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n",
5191 scan_ch->channel); 5191 scan_ch->channel);
@@ -5236,7 +5236,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode,
5236 return added; 5236 return added;
5237} 5237}
5238 5238
5239static void iwl_reset_channel_flag(struct iwl_priv *priv) 5239static void iwl3945_reset_channel_flag(struct iwl3945_priv *priv)
5240{ 5240{
5241 int i, j; 5241 int i, j;
5242 for (i = 0; i < 3; i++) { 5242 for (i = 0; i < 3; i++) {
@@ -5246,13 +5246,13 @@ static void iwl_reset_channel_flag(struct iwl_priv *priv)
5246 } 5246 }
5247} 5247}
5248 5248
5249static void iwl_init_hw_rates(struct iwl_priv *priv, 5249static void iwl3945_init_hw_rates(struct iwl3945_priv *priv,
5250 struct ieee80211_rate *rates) 5250 struct ieee80211_rate *rates)
5251{ 5251{
5252 int i; 5252 int i;
5253 5253
5254 for (i = 0; i < IWL_RATE_COUNT; i++) { 5254 for (i = 0; i < IWL_RATE_COUNT; i++) {
5255 rates[i].rate = iwl_rates[i].ieee * 5; 5255 rates[i].rate = iwl3945_rates[i].ieee * 5;
5256 rates[i].val = i; /* Rate scaling will work on indexes */ 5256 rates[i].val = i; /* Rate scaling will work on indexes */
5257 rates[i].val2 = i; 5257 rates[i].val2 = i;
5258 rates[i].flags = IEEE80211_RATE_SUPPORTED; 5258 rates[i].flags = IEEE80211_RATE_SUPPORTED;
@@ -5264,7 +5264,7 @@ static void iwl_init_hw_rates(struct iwl_priv *priv,
5264 * If CCK 1M then set rate flag to CCK else CCK_2 5264 * If CCK 1M then set rate flag to CCK else CCK_2
5265 * which is CCK | PREAMBLE2 5265 * which is CCK | PREAMBLE2
5266 */ 5266 */
5267 rates[i].flags |= (iwl_rates[i].plcp == 10) ? 5267 rates[i].flags |= (iwl3945_rates[i].plcp == 10) ?
5268 IEEE80211_RATE_CCK : IEEE80211_RATE_CCK_2; 5268 IEEE80211_RATE_CCK : IEEE80211_RATE_CCK_2;
5269 } 5269 }
5270 5270
@@ -5275,11 +5275,11 @@ static void iwl_init_hw_rates(struct iwl_priv *priv,
5275} 5275}
5276 5276
5277/** 5277/**
5278 * iwl_init_geos - Initialize mac80211's geo/channel info based from eeprom 5278 * iwl3945_init_geos - Initialize mac80211's geo/channel info based from eeprom
5279 */ 5279 */
5280static int iwl_init_geos(struct iwl_priv *priv) 5280static int iwl3945_init_geos(struct iwl3945_priv *priv)
5281{ 5281{
5282 struct iwl_channel_info *ch; 5282 struct iwl3945_channel_info *ch;
5283 struct ieee80211_hw_mode *modes; 5283 struct ieee80211_hw_mode *modes;
5284 struct ieee80211_channel *channels; 5284 struct ieee80211_channel *channels;
5285 struct ieee80211_channel *geo_ch; 5285 struct ieee80211_channel *geo_ch;
@@ -5325,7 +5325,7 @@ static int iwl_init_geos(struct iwl_priv *priv)
5325 5325
5326 /* 5.2GHz channels start after the 2.4GHz channels */ 5326 /* 5.2GHz channels start after the 2.4GHz channels */
5327 modes[A].mode = MODE_IEEE80211A; 5327 modes[A].mode = MODE_IEEE80211A;
5328 modes[A].channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)]; 5328 modes[A].channels = &channels[ARRAY_SIZE(iwl3945_eeprom_band_1)];
5329 modes[A].rates = &rates[4]; 5329 modes[A].rates = &rates[4];
5330 modes[A].num_rates = 8; /* just OFDM */ 5330 modes[A].num_rates = 8; /* just OFDM */
5331 modes[A].num_channels = 0; 5331 modes[A].num_channels = 0;
@@ -5345,7 +5345,7 @@ static int iwl_init_geos(struct iwl_priv *priv)
5345 priv->ieee_channels = channels; 5345 priv->ieee_channels = channels;
5346 priv->ieee_rates = rates; 5346 priv->ieee_rates = rates;
5347 5347
5348 iwl_init_hw_rates(priv, rates); 5348 iwl3945_init_hw_rates(priv, rates);
5349 5349
5350 for (i = 0, geo_ch = channels; i < priv->channel_count; i++) { 5350 for (i = 0, geo_ch = channels; i < priv->channel_count; i++) {
5351 ch = &priv->channel_info[i]; 5351 ch = &priv->channel_info[i];
@@ -5428,7 +5428,7 @@ static int iwl_init_geos(struct iwl_priv *priv)
5428 * 5428 *
5429 ******************************************************************************/ 5429 ******************************************************************************/
5430 5430
5431static void iwl_dealloc_ucode_pci(struct iwl_priv *priv) 5431static void iwl3945_dealloc_ucode_pci(struct iwl3945_priv *priv)
5432{ 5432{
5433 if (priv->ucode_code.v_addr != NULL) { 5433 if (priv->ucode_code.v_addr != NULL) {
5434 pci_free_consistent(priv->pci_dev, 5434 pci_free_consistent(priv->pci_dev,
@@ -5475,10 +5475,10 @@ static void iwl_dealloc_ucode_pci(struct iwl_priv *priv)
5475} 5475}
5476 5476
5477/** 5477/**
5478 * iwl_verify_inst_full - verify runtime uCode image in card vs. host, 5478 * iwl3945_verify_inst_full - verify runtime uCode image in card vs. host,
5479 * looking at all data. 5479 * looking at all data.
5480 */ 5480 */
5481static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) 5481static int iwl3945_verify_inst_full(struct iwl3945_priv *priv, __le32 * image, u32 len)
5482{ 5482{
5483 u32 val; 5483 u32 val;
5484 u32 save_len = len; 5484 u32 save_len = len;
@@ -5487,18 +5487,18 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len)
5487 5487
5488 IWL_DEBUG_INFO("ucode inst image size is %u\n", len); 5488 IWL_DEBUG_INFO("ucode inst image size is %u\n", len);
5489 5489
5490 rc = iwl_grab_nic_access(priv); 5490 rc = iwl3945_grab_nic_access(priv);
5491 if (rc) 5491 if (rc)
5492 return rc; 5492 return rc;
5493 5493
5494 iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND); 5494 iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND);
5495 5495
5496 errcnt = 0; 5496 errcnt = 0;
5497 for (; len > 0; len -= sizeof(u32), image++) { 5497 for (; len > 0; len -= sizeof(u32), image++) {
5498 /* read data comes through single port, auto-incr addr */ 5498 /* read data comes through single port, auto-incr addr */
5499 /* NOTE: Use the debugless read so we don't flood kernel log 5499 /* NOTE: Use the debugless read so we don't flood kernel log
5500 * if IWL_DL_IO is set */ 5500 * if IWL_DL_IO is set */
5501 val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); 5501 val = _iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT);
5502 if (val != le32_to_cpu(*image)) { 5502 if (val != le32_to_cpu(*image)) {
5503 IWL_ERROR("uCode INST section is invalid at " 5503 IWL_ERROR("uCode INST section is invalid at "
5504 "offset 0x%x, is 0x%x, s/b 0x%x\n", 5504 "offset 0x%x, is 0x%x, s/b 0x%x\n",
@@ -5510,7 +5510,7 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len)
5510 } 5510 }
5511 } 5511 }
5512 5512
5513 iwl_release_nic_access(priv); 5513 iwl3945_release_nic_access(priv);
5514 5514
5515 if (!errcnt) 5515 if (!errcnt)
5516 IWL_DEBUG_INFO("ucode image in INSTRUCTION memory is good\n"); 5516 IWL_DEBUG_INFO("ucode image in INSTRUCTION memory is good\n");
@@ -5520,11 +5520,11 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len)
5520 5520
5521 5521
5522/** 5522/**
5523 * iwl_verify_inst_sparse - verify runtime uCode image in card vs. host, 5523 * iwl3945_verify_inst_sparse - verify runtime uCode image in card vs. host,
5524 * using sample data 100 bytes apart. If these sample points are good, 5524 * using sample data 100 bytes apart. If these sample points are good,
5525 * it's a pretty good bet that everything between them is good, too. 5525 * it's a pretty good bet that everything between them is good, too.
5526 */ 5526 */
5527static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) 5527static int iwl3945_verify_inst_sparse(struct iwl3945_priv *priv, __le32 *image, u32 len)
5528{ 5528{
5529 u32 val; 5529 u32 val;
5530 int rc = 0; 5530 int rc = 0;
@@ -5533,7 +5533,7 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len)
5533 5533
5534 IWL_DEBUG_INFO("ucode inst image size is %u\n", len); 5534 IWL_DEBUG_INFO("ucode inst image size is %u\n", len);
5535 5535
5536 rc = iwl_grab_nic_access(priv); 5536 rc = iwl3945_grab_nic_access(priv);
5537 if (rc) 5537 if (rc)
5538 return rc; 5538 return rc;
5539 5539
@@ -5541,9 +5541,9 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len)
5541 /* read data comes through single port, auto-incr addr */ 5541 /* read data comes through single port, auto-incr addr */
5542 /* NOTE: Use the debugless read so we don't flood kernel log 5542 /* NOTE: Use the debugless read so we don't flood kernel log
5543 * if IWL_DL_IO is set */ 5543 * if IWL_DL_IO is set */
5544 iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, 5544 iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR,
5545 i + RTC_INST_LOWER_BOUND); 5545 i + RTC_INST_LOWER_BOUND);
5546 val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); 5546 val = _iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT);
5547 if (val != le32_to_cpu(*image)) { 5547 if (val != le32_to_cpu(*image)) {
5548#if 0 /* Enable this if you want to see details */ 5548#if 0 /* Enable this if you want to see details */
5549 IWL_ERROR("uCode INST section is invalid at " 5549 IWL_ERROR("uCode INST section is invalid at "
@@ -5557,17 +5557,17 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len)
5557 } 5557 }
5558 } 5558 }
5559 5559
5560 iwl_release_nic_access(priv); 5560 iwl3945_release_nic_access(priv);
5561 5561
5562 return rc; 5562 return rc;
5563} 5563}
5564 5564
5565 5565
5566/** 5566/**
5567 * iwl_verify_ucode - determine which instruction image is in SRAM, 5567 * iwl3945_verify_ucode - determine which instruction image is in SRAM,
5568 * and verify its contents 5568 * and verify its contents
5569 */ 5569 */
5570static int iwl_verify_ucode(struct iwl_priv *priv) 5570static int iwl3945_verify_ucode(struct iwl3945_priv *priv)
5571{ 5571{
5572 __le32 *image; 5572 __le32 *image;
5573 u32 len; 5573 u32 len;
@@ -5576,7 +5576,7 @@ static int iwl_verify_ucode(struct iwl_priv *priv)
5576 /* Try bootstrap */ 5576 /* Try bootstrap */
5577 image = (__le32 *)priv->ucode_boot.v_addr; 5577 image = (__le32 *)priv->ucode_boot.v_addr;
5578 len = priv->ucode_boot.len; 5578 len = priv->ucode_boot.len;
5579 rc = iwl_verify_inst_sparse(priv, image, len); 5579 rc = iwl3945_verify_inst_sparse(priv, image, len);
5580 if (rc == 0) { 5580 if (rc == 0) {
5581 IWL_DEBUG_INFO("Bootstrap uCode is good in inst SRAM\n"); 5581 IWL_DEBUG_INFO("Bootstrap uCode is good in inst SRAM\n");
5582 return 0; 5582 return 0;
@@ -5585,7 +5585,7 @@ static int iwl_verify_ucode(struct iwl_priv *priv)
5585 /* Try initialize */ 5585 /* Try initialize */
5586 image = (__le32 *)priv->ucode_init.v_addr; 5586 image = (__le32 *)priv->ucode_init.v_addr;
5587 len = priv->ucode_init.len; 5587 len = priv->ucode_init.len;
5588 rc = iwl_verify_inst_sparse(priv, image, len); 5588 rc = iwl3945_verify_inst_sparse(priv, image, len);
5589 if (rc == 0) { 5589 if (rc == 0) {
5590 IWL_DEBUG_INFO("Initialize uCode is good in inst SRAM\n"); 5590 IWL_DEBUG_INFO("Initialize uCode is good in inst SRAM\n");
5591 return 0; 5591 return 0;
@@ -5594,7 +5594,7 @@ static int iwl_verify_ucode(struct iwl_priv *priv)
5594 /* Try runtime/protocol */ 5594 /* Try runtime/protocol */
5595 image = (__le32 *)priv->ucode_code.v_addr; 5595 image = (__le32 *)priv->ucode_code.v_addr;
5596 len = priv->ucode_code.len; 5596 len = priv->ucode_code.len;
5597 rc = iwl_verify_inst_sparse(priv, image, len); 5597 rc = iwl3945_verify_inst_sparse(priv, image, len);
5598 if (rc == 0) { 5598 if (rc == 0) {
5599 IWL_DEBUG_INFO("Runtime uCode is good in inst SRAM\n"); 5599 IWL_DEBUG_INFO("Runtime uCode is good in inst SRAM\n");
5600 return 0; 5600 return 0;
@@ -5606,14 +5606,14 @@ static int iwl_verify_ucode(struct iwl_priv *priv)
5606 * Selection of bootstrap image is arbitrary. */ 5606 * Selection of bootstrap image is arbitrary. */
5607 image = (__le32 *)priv->ucode_boot.v_addr; 5607 image = (__le32 *)priv->ucode_boot.v_addr;
5608 len = priv->ucode_boot.len; 5608 len = priv->ucode_boot.len;
5609 rc = iwl_verify_inst_full(priv, image, len); 5609 rc = iwl3945_verify_inst_full(priv, image, len);
5610 5610
5611 return rc; 5611 return rc;
5612} 5612}
5613 5613
5614 5614
5615/* check contents of special bootstrap uCode SRAM */ 5615/* check contents of special bootstrap uCode SRAM */
5616static int iwl_verify_bsm(struct iwl_priv *priv) 5616static int iwl3945_verify_bsm(struct iwl3945_priv *priv)
5617{ 5617{
5618 __le32 *image = priv->ucode_boot.v_addr; 5618 __le32 *image = priv->ucode_boot.v_addr;
5619 u32 len = priv->ucode_boot.len; 5619 u32 len = priv->ucode_boot.len;
@@ -5623,11 +5623,11 @@ static int iwl_verify_bsm(struct iwl_priv *priv)
5623 IWL_DEBUG_INFO("Begin verify bsm\n"); 5623 IWL_DEBUG_INFO("Begin verify bsm\n");
5624 5624
5625 /* verify BSM SRAM contents */ 5625 /* verify BSM SRAM contents */
5626 val = iwl_read_prph(priv, BSM_WR_DWCOUNT_REG); 5626 val = iwl3945_read_prph(priv, BSM_WR_DWCOUNT_REG);
5627 for (reg = BSM_SRAM_LOWER_BOUND; 5627 for (reg = BSM_SRAM_LOWER_BOUND;
5628 reg < BSM_SRAM_LOWER_BOUND + len; 5628 reg < BSM_SRAM_LOWER_BOUND + len;
5629 reg += sizeof(u32), image ++) { 5629 reg += sizeof(u32), image ++) {
5630 val = iwl_read_prph(priv, reg); 5630 val = iwl3945_read_prph(priv, reg);
5631 if (val != le32_to_cpu(*image)) { 5631 if (val != le32_to_cpu(*image)) {
5632 IWL_ERROR("BSM uCode verification failed at " 5632 IWL_ERROR("BSM uCode verification failed at "
5633 "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", 5633 "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n",
@@ -5644,7 +5644,7 @@ static int iwl_verify_bsm(struct iwl_priv *priv)
5644} 5644}
5645 5645
5646/** 5646/**
5647 * iwl_load_bsm - Load bootstrap instructions 5647 * iwl3945_load_bsm - Load bootstrap instructions
5648 * 5648 *
5649 * BSM operation: 5649 * BSM operation:
5650 * 5650 *
@@ -5675,7 +5675,7 @@ static int iwl_verify_bsm(struct iwl_priv *priv)
5675 * the runtime uCode instructions and the backup data cache into SRAM, 5675 * the runtime uCode instructions and the backup data cache into SRAM,
5676 * and re-launches the runtime uCode from where it left off. 5676 * and re-launches the runtime uCode from where it left off.
5677 */ 5677 */
5678static int iwl_load_bsm(struct iwl_priv *priv) 5678static int iwl3945_load_bsm(struct iwl3945_priv *priv)
5679{ 5679{
5680 __le32 *image = priv->ucode_boot.v_addr; 5680 __le32 *image = priv->ucode_boot.v_addr;
5681 u32 len = priv->ucode_boot.len; 5681 u32 len = priv->ucode_boot.len;
@@ -5696,7 +5696,7 @@ static int iwl_load_bsm(struct iwl_priv *priv)
5696 5696
5697 /* Tell bootstrap uCode where to find the "Initialize" uCode 5697 /* Tell bootstrap uCode where to find the "Initialize" uCode
5698 * in host DRAM ... bits 31:0 for 3945, bits 35:4 for 4965. 5698 * in host DRAM ... bits 31:0 for 3945, bits 35:4 for 4965.
5699 * NOTE: iwl_initialize_alive_start() will replace these values, 5699 * NOTE: iwl3945_initialize_alive_start() will replace these values,
5700 * after the "initialize" uCode has run, to point to 5700 * after the "initialize" uCode has run, to point to
5701 * runtime/protocol instructions and backup data cache. */ 5701 * runtime/protocol instructions and backup data cache. */
5702 pinst = priv->ucode_init.p_addr; 5702 pinst = priv->ucode_init.p_addr;
@@ -5704,42 +5704,42 @@ static int iwl_load_bsm(struct iwl_priv *priv)
5704 inst_len = priv->ucode_init.len; 5704 inst_len = priv->ucode_init.len;
5705 data_len = priv->ucode_init_data.len; 5705 data_len = priv->ucode_init_data.len;
5706 5706
5707 rc = iwl_grab_nic_access(priv); 5707 rc = iwl3945_grab_nic_access(priv);
5708 if (rc) 5708 if (rc)
5709 return rc; 5709 return rc;
5710 5710
5711 iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); 5711 iwl3945_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
5712 iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); 5712 iwl3945_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
5713 iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); 5713 iwl3945_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len);
5714 iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); 5714 iwl3945_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len);
5715 5715
5716 /* Fill BSM memory with bootstrap instructions */ 5716 /* Fill BSM memory with bootstrap instructions */
5717 for (reg_offset = BSM_SRAM_LOWER_BOUND; 5717 for (reg_offset = BSM_SRAM_LOWER_BOUND;
5718 reg_offset < BSM_SRAM_LOWER_BOUND + len; 5718 reg_offset < BSM_SRAM_LOWER_BOUND + len;
5719 reg_offset += sizeof(u32), image++) 5719 reg_offset += sizeof(u32), image++)
5720 _iwl_write_prph(priv, reg_offset, 5720 _iwl3945_write_prph(priv, reg_offset,
5721 le32_to_cpu(*image)); 5721 le32_to_cpu(*image));
5722 5722
5723 rc = iwl_verify_bsm(priv); 5723 rc = iwl3945_verify_bsm(priv);
5724 if (rc) { 5724 if (rc) {
5725 iwl_release_nic_access(priv); 5725 iwl3945_release_nic_access(priv);
5726 return rc; 5726 return rc;
5727 } 5727 }
5728 5728
5729 /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ 5729 /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */
5730 iwl_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); 5730 iwl3945_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0);
5731 iwl_write_prph(priv, BSM_WR_MEM_DST_REG, 5731 iwl3945_write_prph(priv, BSM_WR_MEM_DST_REG,
5732 RTC_INST_LOWER_BOUND); 5732 RTC_INST_LOWER_BOUND);
5733 iwl_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); 5733 iwl3945_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32));
5734 5734
5735 /* Load bootstrap code into instruction SRAM now, 5735 /* Load bootstrap code into instruction SRAM now,
5736 * to prepare to load "initialize" uCode */ 5736 * to prepare to load "initialize" uCode */
5737 iwl_write_prph(priv, BSM_WR_CTRL_REG, 5737 iwl3945_write_prph(priv, BSM_WR_CTRL_REG,
5738 BSM_WR_CTRL_REG_BIT_START); 5738 BSM_WR_CTRL_REG_BIT_START);
5739 5739
5740 /* Wait for load of bootstrap uCode to finish */ 5740 /* Wait for load of bootstrap uCode to finish */
5741 for (i = 0; i < 100; i++) { 5741 for (i = 0; i < 100; i++) {
5742 done = iwl_read_prph(priv, BSM_WR_CTRL_REG); 5742 done = iwl3945_read_prph(priv, BSM_WR_CTRL_REG);
5743 if (!(done & BSM_WR_CTRL_REG_BIT_START)) 5743 if (!(done & BSM_WR_CTRL_REG_BIT_START))
5744 break; 5744 break;
5745 udelay(10); 5745 udelay(10);
@@ -5753,28 +5753,28 @@ static int iwl_load_bsm(struct iwl_priv *priv)
5753 5753
5754 /* Enable future boot loads whenever power management unit triggers it 5754 /* Enable future boot loads whenever power management unit triggers it
5755 * (e.g. when powering back up after power-save shutdown) */ 5755 * (e.g. when powering back up after power-save shutdown) */
5756 iwl_write_prph(priv, BSM_WR_CTRL_REG, 5756 iwl3945_write_prph(priv, BSM_WR_CTRL_REG,
5757 BSM_WR_CTRL_REG_BIT_START_EN); 5757 BSM_WR_CTRL_REG_BIT_START_EN);
5758 5758
5759 iwl_release_nic_access(priv); 5759 iwl3945_release_nic_access(priv);
5760 5760
5761 return 0; 5761 return 0;
5762} 5762}
5763 5763
5764static void iwl_nic_start(struct iwl_priv *priv) 5764static void iwl3945_nic_start(struct iwl3945_priv *priv)
5765{ 5765{
5766 /* Remove all resets to allow NIC to operate */ 5766 /* Remove all resets to allow NIC to operate */
5767 iwl_write32(priv, CSR_RESET, 0); 5767 iwl3945_write32(priv, CSR_RESET, 0);
5768} 5768}
5769 5769
5770/** 5770/**
5771 * iwl_read_ucode - Read uCode images from disk file. 5771 * iwl3945_read_ucode - Read uCode images from disk file.
5772 * 5772 *
5773 * Copy into buffers for card to fetch via bus-mastering 5773 * Copy into buffers for card to fetch via bus-mastering
5774 */ 5774 */
5775static int iwl_read_ucode(struct iwl_priv *priv) 5775static int iwl3945_read_ucode(struct iwl3945_priv *priv)
5776{ 5776{
5777 struct iwl_ucode *ucode; 5777 struct iwl3945_ucode *ucode;
5778 int rc = 0; 5778 int rc = 0;
5779 const struct firmware *ucode_raw; 5779 const struct firmware *ucode_raw;
5780 /* firmware file name contains uCode/driver compatibility version */ 5780 /* firmware file name contains uCode/driver compatibility version */
@@ -5926,7 +5926,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
5926 priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); 5926 priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr);
5927 5927
5928 /* Runtime data (2nd block) 5928 /* Runtime data (2nd block)
5929 * NOTE: Copy into backup buffer will be done in iwl_up() */ 5929 * NOTE: Copy into backup buffer will be done in iwl3945_up() */
5930 src = &ucode->data[inst_size]; 5930 src = &ucode->data[inst_size];
5931 len = priv->ucode_data.len; 5931 len = priv->ucode_data.len;
5932 IWL_DEBUG_INFO("Copying (but not loading) uCode data len %d\n", 5932 IWL_DEBUG_INFO("Copying (but not loading) uCode data len %d\n",
@@ -5966,7 +5966,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
5966 err_pci_alloc: 5966 err_pci_alloc:
5967 IWL_ERROR("failed to allocate pci memory\n"); 5967 IWL_ERROR("failed to allocate pci memory\n");
5968 rc = -ENOMEM; 5968 rc = -ENOMEM;
5969 iwl_dealloc_ucode_pci(priv); 5969 iwl3945_dealloc_ucode_pci(priv);
5970 5970
5971 err_release: 5971 err_release:
5972 release_firmware(ucode_raw); 5972 release_firmware(ucode_raw);
@@ -5977,7 +5977,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
5977 5977
5978 5978
5979/** 5979/**
5980 * iwl_set_ucode_ptrs - Set uCode address location 5980 * iwl3945_set_ucode_ptrs - Set uCode address location
5981 * 5981 *
5982 * Tell initialization uCode where to find runtime uCode. 5982 * Tell initialization uCode where to find runtime uCode.
5983 * 5983 *
@@ -5985,7 +5985,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
5985 * We need to replace them to load runtime uCode inst and data, 5985 * We need to replace them to load runtime uCode inst and data,
5986 * and to save runtime data when powering down. 5986 * and to save runtime data when powering down.
5987 */ 5987 */
5988static int iwl_set_ucode_ptrs(struct iwl_priv *priv) 5988static int iwl3945_set_ucode_ptrs(struct iwl3945_priv *priv)
5989{ 5989{
5990 dma_addr_t pinst; 5990 dma_addr_t pinst;
5991 dma_addr_t pdata; 5991 dma_addr_t pdata;
@@ -5997,24 +5997,24 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv)
5997 pdata = priv->ucode_data_backup.p_addr; 5997 pdata = priv->ucode_data_backup.p_addr;
5998 5998
5999 spin_lock_irqsave(&priv->lock, flags); 5999 spin_lock_irqsave(&priv->lock, flags);
6000 rc = iwl_grab_nic_access(priv); 6000 rc = iwl3945_grab_nic_access(priv);
6001 if (rc) { 6001 if (rc) {
6002 spin_unlock_irqrestore(&priv->lock, flags); 6002 spin_unlock_irqrestore(&priv->lock, flags);
6003 return rc; 6003 return rc;
6004 } 6004 }
6005 6005
6006 /* Tell bootstrap uCode where to find image to load */ 6006 /* Tell bootstrap uCode where to find image to load */
6007 iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); 6007 iwl3945_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
6008 iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); 6008 iwl3945_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
6009 iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, 6009 iwl3945_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG,
6010 priv->ucode_data.len); 6010 priv->ucode_data.len);
6011 6011
6012 /* Inst bytecount must be last to set up, bit 31 signals uCode 6012 /* Inst bytecount must be last to set up, bit 31 signals uCode
6013 * that all new ptr/size info is in place */ 6013 * that all new ptr/size info is in place */
6014 iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, 6014 iwl3945_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG,
6015 priv->ucode_code.len | BSM_DRAM_INST_LOAD); 6015 priv->ucode_code.len | BSM_DRAM_INST_LOAD);
6016 6016
6017 iwl_release_nic_access(priv); 6017 iwl3945_release_nic_access(priv);
6018 6018
6019 spin_unlock_irqrestore(&priv->lock, flags); 6019 spin_unlock_irqrestore(&priv->lock, flags);
6020 6020
@@ -6024,7 +6024,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv)
6024} 6024}
6025 6025
6026/** 6026/**
6027 * iwl_init_alive_start - Called after REPLY_ALIVE notification received 6027 * iwl3945_init_alive_start - Called after REPLY_ALIVE notification received
6028 * 6028 *
6029 * Called after REPLY_ALIVE notification received from "initialize" uCode. 6029 * Called after REPLY_ALIVE notification received from "initialize" uCode.
6030 * 6030 *
@@ -6034,7 +6034,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv)
6034 * 6034 *
6035 * Tell "initialize" uCode to go ahead and load the runtime uCode. 6035 * Tell "initialize" uCode to go ahead and load the runtime uCode.
6036*/ 6036*/
6037static void iwl_init_alive_start(struct iwl_priv *priv) 6037static void iwl3945_init_alive_start(struct iwl3945_priv *priv)
6038{ 6038{
6039 /* Check alive response for "valid" sign from uCode */ 6039 /* Check alive response for "valid" sign from uCode */
6040 if (priv->card_alive_init.is_valid != UCODE_VALID_OK) { 6040 if (priv->card_alive_init.is_valid != UCODE_VALID_OK) {
@@ -6047,7 +6047,7 @@ static void iwl_init_alive_start(struct iwl_priv *priv)
6047 /* Bootstrap uCode has loaded initialize uCode ... verify inst image. 6047 /* Bootstrap uCode has loaded initialize uCode ... verify inst image.
6048 * This is a paranoid check, because we would not have gotten the 6048 * This is a paranoid check, because we would not have gotten the
6049 * "initialize" alive if code weren't properly loaded. */ 6049 * "initialize" alive if code weren't properly loaded. */
6050 if (iwl_verify_ucode(priv)) { 6050 if (iwl3945_verify_ucode(priv)) {
6051 /* Runtime instruction load was bad; 6051 /* Runtime instruction load was bad;
6052 * take it all the way back down so we can try again */ 6052 * take it all the way back down so we can try again */
6053 IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n"); 6053 IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n");
@@ -6058,7 +6058,7 @@ static void iwl_init_alive_start(struct iwl_priv *priv)
6058 * load and launch runtime uCode, which will send us another "Alive" 6058 * load and launch runtime uCode, which will send us another "Alive"
6059 * notification. */ 6059 * notification. */
6060 IWL_DEBUG_INFO("Initialization Alive received.\n"); 6060 IWL_DEBUG_INFO("Initialization Alive received.\n");
6061 if (iwl_set_ucode_ptrs(priv)) { 6061 if (iwl3945_set_ucode_ptrs(priv)) {
6062 /* Runtime instruction load won't happen; 6062 /* Runtime instruction load won't happen;
6063 * take it all the way back down so we can try again */ 6063 * take it all the way back down so we can try again */
6064 IWL_DEBUG_INFO("Couldn't set up uCode pointers.\n"); 6064 IWL_DEBUG_INFO("Couldn't set up uCode pointers.\n");
@@ -6072,11 +6072,11 @@ static void iwl_init_alive_start(struct iwl_priv *priv)
6072 6072
6073 6073
6074/** 6074/**
6075 * iwl_alive_start - called after REPLY_ALIVE notification received 6075 * iwl3945_alive_start - called after REPLY_ALIVE notification received
6076 * from protocol/runtime uCode (initialization uCode's 6076 * from protocol/runtime uCode (initialization uCode's
6077 * Alive gets handled by iwl_init_alive_start()). 6077 * Alive gets handled by iwl3945_init_alive_start()).
6078 */ 6078 */
6079static void iwl_alive_start(struct iwl_priv *priv) 6079static void iwl3945_alive_start(struct iwl3945_priv *priv)
6080{ 6080{
6081 int rc = 0; 6081 int rc = 0;
6082 int thermal_spin = 0; 6082 int thermal_spin = 0;
@@ -6094,30 +6094,30 @@ static void iwl_alive_start(struct iwl_priv *priv)
6094 /* Initialize uCode has loaded Runtime uCode ... verify inst image. 6094 /* Initialize uCode has loaded Runtime uCode ... verify inst image.
6095 * This is a paranoid check, because we would not have gotten the 6095 * This is a paranoid check, because we would not have gotten the
6096 * "runtime" alive if code weren't properly loaded. */ 6096 * "runtime" alive if code weren't properly loaded. */
6097 if (iwl_verify_ucode(priv)) { 6097 if (iwl3945_verify_ucode(priv)) {
6098 /* Runtime instruction load was bad; 6098 /* Runtime instruction load was bad;
6099 * take it all the way back down so we can try again */ 6099 * take it all the way back down so we can try again */
6100 IWL_DEBUG_INFO("Bad runtime uCode load.\n"); 6100 IWL_DEBUG_INFO("Bad runtime uCode load.\n");
6101 goto restart; 6101 goto restart;
6102 } 6102 }
6103 6103
6104 iwl_clear_stations_table(priv); 6104 iwl3945_clear_stations_table(priv);
6105 6105
6106 rc = iwl_grab_nic_access(priv); 6106 rc = iwl3945_grab_nic_access(priv);
6107 if (rc) { 6107 if (rc) {
6108 IWL_WARNING("Can not read rfkill status from adapter\n"); 6108 IWL_WARNING("Can not read rfkill status from adapter\n");
6109 return; 6109 return;
6110 } 6110 }
6111 6111
6112 rfkill = iwl_read_prph(priv, APMG_RFKILL_REG); 6112 rfkill = iwl3945_read_prph(priv, APMG_RFKILL_REG);
6113 IWL_DEBUG_INFO("RFKILL status: 0x%x\n", rfkill); 6113 IWL_DEBUG_INFO("RFKILL status: 0x%x\n", rfkill);
6114 iwl_release_nic_access(priv); 6114 iwl3945_release_nic_access(priv);
6115 6115
6116 if (rfkill & 0x1) { 6116 if (rfkill & 0x1) {
6117 clear_bit(STATUS_RF_KILL_HW, &priv->status); 6117 clear_bit(STATUS_RF_KILL_HW, &priv->status);
6118 /* if rfkill is not on, then wait for thermal 6118 /* if rfkill is not on, then wait for thermal
6119 * sensor in adapter to kick in */ 6119 * sensor in adapter to kick in */
6120 while (iwl_hw_get_temperature(priv) == 0) { 6120 while (iwl3945_hw_get_temperature(priv) == 0) {
6121 thermal_spin++; 6121 thermal_spin++;
6122 udelay(10); 6122 udelay(10);
6123 } 6123 }
@@ -6134,28 +6134,28 @@ static void iwl_alive_start(struct iwl_priv *priv)
6134 /* Clear out the uCode error bit if it is set */ 6134 /* Clear out the uCode error bit if it is set */
6135 clear_bit(STATUS_FW_ERROR, &priv->status); 6135 clear_bit(STATUS_FW_ERROR, &priv->status);
6136 6136
6137 rc = iwl_init_channel_map(priv); 6137 rc = iwl3945_init_channel_map(priv);
6138 if (rc) { 6138 if (rc) {
6139 IWL_ERROR("initializing regulatory failed: %d\n", rc); 6139 IWL_ERROR("initializing regulatory failed: %d\n", rc);
6140 return; 6140 return;
6141 } 6141 }
6142 6142
6143 iwl_init_geos(priv); 6143 iwl3945_init_geos(priv);
6144 6144
6145 if (iwl_is_rfkill(priv)) 6145 if (iwl3945_is_rfkill(priv))
6146 return; 6146 return;
6147 6147
6148 if (!priv->mac80211_registered) { 6148 if (!priv->mac80211_registered) {
6149 /* Unlock so any user space entry points can call back into 6149 /* Unlock so any user space entry points can call back into
6150 * the driver without a deadlock... */ 6150 * the driver without a deadlock... */
6151 mutex_unlock(&priv->mutex); 6151 mutex_unlock(&priv->mutex);
6152 iwl_rate_control_register(priv->hw); 6152 iwl3945_rate_control_register(priv->hw);
6153 rc = ieee80211_register_hw(priv->hw); 6153 rc = ieee80211_register_hw(priv->hw);
6154 priv->hw->conf.beacon_int = 100; 6154 priv->hw->conf.beacon_int = 100;
6155 mutex_lock(&priv->mutex); 6155 mutex_lock(&priv->mutex);
6156 6156
6157 if (rc) { 6157 if (rc) {
6158 iwl_rate_control_unregister(priv->hw); 6158 iwl3945_rate_control_unregister(priv->hw);
6159 IWL_ERROR("Failed to register network " 6159 IWL_ERROR("Failed to register network "
6160 "device (error %d)\n", rc); 6160 "device (error %d)\n", rc);
6161 return; 6161 return;
@@ -6163,33 +6163,33 @@ static void iwl_alive_start(struct iwl_priv *priv)
6163 6163
6164 priv->mac80211_registered = 1; 6164 priv->mac80211_registered = 1;
6165 6165
6166 iwl_reset_channel_flag(priv); 6166 iwl3945_reset_channel_flag(priv);
6167 } else 6167 } else
6168 ieee80211_start_queues(priv->hw); 6168 ieee80211_start_queues(priv->hw);
6169 6169
6170 priv->active_rate = priv->rates_mask; 6170 priv->active_rate = priv->rates_mask;
6171 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; 6171 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
6172 6172
6173 iwl_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode)); 6173 iwl3945_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode));
6174 6174
6175 if (iwl_is_associated(priv)) { 6175 if (iwl3945_is_associated(priv)) {
6176 struct iwl_rxon_cmd *active_rxon = 6176 struct iwl3945_rxon_cmd *active_rxon =
6177 (struct iwl_rxon_cmd *)(&priv->active_rxon); 6177 (struct iwl3945_rxon_cmd *)(&priv->active_rxon);
6178 6178
6179 memcpy(&priv->staging_rxon, &priv->active_rxon, 6179 memcpy(&priv->staging_rxon, &priv->active_rxon,
6180 sizeof(priv->staging_rxon)); 6180 sizeof(priv->staging_rxon));
6181 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 6181 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
6182 } else { 6182 } else {
6183 /* Initialize our rx_config data */ 6183 /* Initialize our rx_config data */
6184 iwl_connection_init_rx_config(priv); 6184 iwl3945_connection_init_rx_config(priv);
6185 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); 6185 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
6186 } 6186 }
6187 6187
6188 /* Configure BT coexistence */ 6188 /* Configure BT coexistence */
6189 iwl_send_bt_config(priv); 6189 iwl3945_send_bt_config(priv);
6190 6190
6191 /* Configure the adapter for unassociated operation */ 6191 /* Configure the adapter for unassociated operation */
6192 iwl_commit_rxon(priv); 6192 iwl3945_commit_rxon(priv);
6193 6193
6194 /* At this point, the NIC is initialized and operational */ 6194 /* At this point, the NIC is initialized and operational */
6195 priv->notif_missed_beacons = 0; 6195 priv->notif_missed_beacons = 0;
@@ -6200,7 +6200,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
6200 IWL_DEBUG_INFO("ALIVE processing complete.\n"); 6200 IWL_DEBUG_INFO("ALIVE processing complete.\n");
6201 6201
6202 if (priv->error_recovering) 6202 if (priv->error_recovering)
6203 iwl_error_recovery(priv); 6203 iwl3945_error_recovery(priv);
6204 6204
6205 return; 6205 return;
6206 6206
@@ -6208,9 +6208,9 @@ static void iwl_alive_start(struct iwl_priv *priv)
6208 queue_work(priv->workqueue, &priv->restart); 6208 queue_work(priv->workqueue, &priv->restart);
6209} 6209}
6210 6210
6211static void iwl_cancel_deferred_work(struct iwl_priv *priv); 6211static void iwl3945_cancel_deferred_work(struct iwl3945_priv *priv);
6212 6212
6213static void __iwl_down(struct iwl_priv *priv) 6213static void __iwl3945_down(struct iwl3945_priv *priv)
6214{ 6214{
6215 unsigned long flags; 6215 unsigned long flags;
6216 int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status); 6216 int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status);
@@ -6223,7 +6223,7 @@ static void __iwl_down(struct iwl_priv *priv)
6223 if (!exit_pending) 6223 if (!exit_pending)
6224 set_bit(STATUS_EXIT_PENDING, &priv->status); 6224 set_bit(STATUS_EXIT_PENDING, &priv->status);
6225 6225
6226 iwl_clear_stations_table(priv); 6226 iwl3945_clear_stations_table(priv);
6227 6227
6228 /* Unblock any waiting calls */ 6228 /* Unblock any waiting calls */
6229 wake_up_interruptible_all(&priv->wait_command_queue); 6229 wake_up_interruptible_all(&priv->wait_command_queue);
@@ -6234,17 +6234,17 @@ static void __iwl_down(struct iwl_priv *priv)
6234 clear_bit(STATUS_EXIT_PENDING, &priv->status); 6234 clear_bit(STATUS_EXIT_PENDING, &priv->status);
6235 6235
6236 /* stop and reset the on-board processor */ 6236 /* stop and reset the on-board processor */
6237 iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); 6237 iwl3945_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
6238 6238
6239 /* tell the device to stop sending interrupts */ 6239 /* tell the device to stop sending interrupts */
6240 iwl_disable_interrupts(priv); 6240 iwl3945_disable_interrupts(priv);
6241 6241
6242 if (priv->mac80211_registered) 6242 if (priv->mac80211_registered)
6243 ieee80211_stop_queues(priv->hw); 6243 ieee80211_stop_queues(priv->hw);
6244 6244
6245 /* If we have not previously called iwl_init() then 6245 /* If we have not previously called iwl3945_init() then
6246 * clear all bits but the RF Kill and SUSPEND bits and return */ 6246 * clear all bits but the RF Kill and SUSPEND bits and return */
6247 if (!iwl_is_init(priv)) { 6247 if (!iwl3945_is_init(priv)) {
6248 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << 6248 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) <<
6249 STATUS_RF_KILL_HW | 6249 STATUS_RF_KILL_HW |
6250 test_bit(STATUS_RF_KILL_SW, &priv->status) << 6250 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
@@ -6266,49 +6266,49 @@ static void __iwl_down(struct iwl_priv *priv)
6266 STATUS_FW_ERROR; 6266 STATUS_FW_ERROR;
6267 6267
6268 spin_lock_irqsave(&priv->lock, flags); 6268 spin_lock_irqsave(&priv->lock, flags);
6269 iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 6269 iwl3945_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
6270 spin_unlock_irqrestore(&priv->lock, flags); 6270 spin_unlock_irqrestore(&priv->lock, flags);
6271 6271
6272 iwl_hw_txq_ctx_stop(priv); 6272 iwl3945_hw_txq_ctx_stop(priv);
6273 iwl_hw_rxq_stop(priv); 6273 iwl3945_hw_rxq_stop(priv);
6274 6274
6275 spin_lock_irqsave(&priv->lock, flags); 6275 spin_lock_irqsave(&priv->lock, flags);
6276 if (!iwl_grab_nic_access(priv)) { 6276 if (!iwl3945_grab_nic_access(priv)) {
6277 iwl_write_prph(priv, APMG_CLK_DIS_REG, 6277 iwl3945_write_prph(priv, APMG_CLK_DIS_REG,
6278 APMG_CLK_VAL_DMA_CLK_RQT); 6278 APMG_CLK_VAL_DMA_CLK_RQT);
6279 iwl_release_nic_access(priv); 6279 iwl3945_release_nic_access(priv);
6280 } 6280 }
6281 spin_unlock_irqrestore(&priv->lock, flags); 6281 spin_unlock_irqrestore(&priv->lock, flags);
6282 6282
6283 udelay(5); 6283 udelay(5);
6284 6284
6285 iwl_hw_nic_stop_master(priv); 6285 iwl3945_hw_nic_stop_master(priv);
6286 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); 6286 iwl3945_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
6287 iwl_hw_nic_reset(priv); 6287 iwl3945_hw_nic_reset(priv);
6288 6288
6289 exit: 6289 exit:
6290 memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp)); 6290 memset(&priv->card_alive, 0, sizeof(struct iwl3945_alive_resp));
6291 6291
6292 if (priv->ibss_beacon) 6292 if (priv->ibss_beacon)
6293 dev_kfree_skb(priv->ibss_beacon); 6293 dev_kfree_skb(priv->ibss_beacon);
6294 priv->ibss_beacon = NULL; 6294 priv->ibss_beacon = NULL;
6295 6295
6296 /* clear out any free frames */ 6296 /* clear out any free frames */
6297 iwl_clear_free_frames(priv); 6297 iwl3945_clear_free_frames(priv);
6298} 6298}
6299 6299
6300static void iwl_down(struct iwl_priv *priv) 6300static void iwl3945_down(struct iwl3945_priv *priv)
6301{ 6301{
6302 mutex_lock(&priv->mutex); 6302 mutex_lock(&priv->mutex);
6303 __iwl_down(priv); 6303 __iwl3945_down(priv);
6304 mutex_unlock(&priv->mutex); 6304 mutex_unlock(&priv->mutex);
6305 6305
6306 iwl_cancel_deferred_work(priv); 6306 iwl3945_cancel_deferred_work(priv);
6307} 6307}
6308 6308
6309#define MAX_HW_RESTARTS 5 6309#define MAX_HW_RESTARTS 5
6310 6310
6311static int __iwl_up(struct iwl_priv *priv) 6311static int __iwl3945_up(struct iwl3945_priv *priv)
6312{ 6312{
6313 DECLARE_MAC_BUF(mac); 6313 DECLARE_MAC_BUF(mac);
6314 int rc, i; 6314 int rc, i;
@@ -6329,26 +6329,26 @@ static int __iwl_up(struct iwl_priv *priv)
6329 return -EIO; 6329 return -EIO;
6330 } 6330 }
6331 6331
6332 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 6332 iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF);
6333 6333
6334 rc = iwl_hw_nic_init(priv); 6334 rc = iwl3945_hw_nic_init(priv);
6335 if (rc) { 6335 if (rc) {
6336 IWL_ERROR("Unable to int nic\n"); 6336 IWL_ERROR("Unable to int nic\n");
6337 return rc; 6337 return rc;
6338 } 6338 }
6339 6339
6340 /* make sure rfkill handshake bits are cleared */ 6340 /* make sure rfkill handshake bits are cleared */
6341 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 6341 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
6342 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, 6342 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR,
6343 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 6343 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
6344 6344
6345 /* clear (again), then enable host interrupts */ 6345 /* clear (again), then enable host interrupts */
6346 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 6346 iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF);
6347 iwl_enable_interrupts(priv); 6347 iwl3945_enable_interrupts(priv);
6348 6348
6349 /* really make sure rfkill handshake bits are cleared */ 6349 /* really make sure rfkill handshake bits are cleared */
6350 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 6350 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
6351 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 6351 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
6352 6352
6353 /* Copy original ucode data image from disk into backup cache. 6353 /* Copy original ucode data image from disk into backup cache.
6354 * This will be used to initialize the on-board processor's 6354 * This will be used to initialize the on-board processor's
@@ -6358,12 +6358,12 @@ static int __iwl_up(struct iwl_priv *priv)
6358 6358
6359 for (i = 0; i < MAX_HW_RESTARTS; i++) { 6359 for (i = 0; i < MAX_HW_RESTARTS; i++) {
6360 6360
6361 iwl_clear_stations_table(priv); 6361 iwl3945_clear_stations_table(priv);
6362 6362
6363 /* load bootstrap state machine, 6363 /* load bootstrap state machine,
6364 * load bootstrap program into processor's memory, 6364 * load bootstrap program into processor's memory,
6365 * prepare to load the "initialize" uCode */ 6365 * prepare to load the "initialize" uCode */
6366 rc = iwl_load_bsm(priv); 6366 rc = iwl3945_load_bsm(priv);
6367 6367
6368 if (rc) { 6368 if (rc) {
6369 IWL_ERROR("Unable to set up bootstrap uCode: %d\n", rc); 6369 IWL_ERROR("Unable to set up bootstrap uCode: %d\n", rc);
@@ -6371,7 +6371,7 @@ static int __iwl_up(struct iwl_priv *priv)
6371 } 6371 }
6372 6372
6373 /* start card; "initialize" will load runtime ucode */ 6373 /* start card; "initialize" will load runtime ucode */
6374 iwl_nic_start(priv); 6374 iwl3945_nic_start(priv);
6375 6375
6376 /* MAC Address location in EEPROM same for 3945/4965 */ 6376 /* MAC Address location in EEPROM same for 3945/4965 */
6377 get_eeprom_mac(priv, priv->mac_addr); 6377 get_eeprom_mac(priv, priv->mac_addr);
@@ -6386,7 +6386,7 @@ static int __iwl_up(struct iwl_priv *priv)
6386 } 6386 }
6387 6387
6388 set_bit(STATUS_EXIT_PENDING, &priv->status); 6388 set_bit(STATUS_EXIT_PENDING, &priv->status);
6389 __iwl_down(priv); 6389 __iwl3945_down(priv);
6390 6390
6391 /* tried to restart and config the device for as long as our 6391 /* tried to restart and config the device for as long as our
6392 * patience could withstand */ 6392 * patience could withstand */
@@ -6401,35 +6401,35 @@ static int __iwl_up(struct iwl_priv *priv)
6401 * 6401 *
6402 *****************************************************************************/ 6402 *****************************************************************************/
6403 6403
6404static void iwl_bg_init_alive_start(struct work_struct *data) 6404static void iwl3945_bg_init_alive_start(struct work_struct *data)
6405{ 6405{
6406 struct iwl_priv *priv = 6406 struct iwl3945_priv *priv =
6407 container_of(data, struct iwl_priv, init_alive_start.work); 6407 container_of(data, struct iwl3945_priv, init_alive_start.work);
6408 6408
6409 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6409 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6410 return; 6410 return;
6411 6411
6412 mutex_lock(&priv->mutex); 6412 mutex_lock(&priv->mutex);
6413 iwl_init_alive_start(priv); 6413 iwl3945_init_alive_start(priv);
6414 mutex_unlock(&priv->mutex); 6414 mutex_unlock(&priv->mutex);
6415} 6415}
6416 6416
6417static void iwl_bg_alive_start(struct work_struct *data) 6417static void iwl3945_bg_alive_start(struct work_struct *data)
6418{ 6418{
6419 struct iwl_priv *priv = 6419 struct iwl3945_priv *priv =
6420 container_of(data, struct iwl_priv, alive_start.work); 6420 container_of(data, struct iwl3945_priv, alive_start.work);
6421 6421
6422 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6422 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6423 return; 6423 return;
6424 6424
6425 mutex_lock(&priv->mutex); 6425 mutex_lock(&priv->mutex);
6426 iwl_alive_start(priv); 6426 iwl3945_alive_start(priv);
6427 mutex_unlock(&priv->mutex); 6427 mutex_unlock(&priv->mutex);
6428} 6428}
6429 6429
6430static void iwl_bg_rf_kill(struct work_struct *work) 6430static void iwl3945_bg_rf_kill(struct work_struct *work)
6431{ 6431{
6432 struct iwl_priv *priv = container_of(work, struct iwl_priv, rf_kill); 6432 struct iwl3945_priv *priv = container_of(work, struct iwl3945_priv, rf_kill);
6433 6433
6434 wake_up_interruptible(&priv->wait_command_queue); 6434 wake_up_interruptible(&priv->wait_command_queue);
6435 6435
@@ -6438,7 +6438,7 @@ static void iwl_bg_rf_kill(struct work_struct *work)
6438 6438
6439 mutex_lock(&priv->mutex); 6439 mutex_lock(&priv->mutex);
6440 6440
6441 if (!iwl_is_rfkill(priv)) { 6441 if (!iwl3945_is_rfkill(priv)) {
6442 IWL_DEBUG(IWL_DL_INFO | IWL_DL_RF_KILL, 6442 IWL_DEBUG(IWL_DL_INFO | IWL_DL_RF_KILL,
6443 "HW and/or SW RF Kill no longer active, restarting " 6443 "HW and/or SW RF Kill no longer active, restarting "
6444 "device\n"); 6444 "device\n");
@@ -6459,10 +6459,10 @@ static void iwl_bg_rf_kill(struct work_struct *work)
6459 6459
6460#define IWL_SCAN_CHECK_WATCHDOG (7 * HZ) 6460#define IWL_SCAN_CHECK_WATCHDOG (7 * HZ)
6461 6461
6462static void iwl_bg_scan_check(struct work_struct *data) 6462static void iwl3945_bg_scan_check(struct work_struct *data)
6463{ 6463{
6464 struct iwl_priv *priv = 6464 struct iwl3945_priv *priv =
6465 container_of(data, struct iwl_priv, scan_check.work); 6465 container_of(data, struct iwl3945_priv, scan_check.work);
6466 6466
6467 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6467 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6468 return; 6468 return;
@@ -6475,22 +6475,22 @@ static void iwl_bg_scan_check(struct work_struct *data)
6475 jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); 6475 jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG));
6476 6476
6477 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) 6477 if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
6478 iwl_send_scan_abort(priv); 6478 iwl3945_send_scan_abort(priv);
6479 } 6479 }
6480 mutex_unlock(&priv->mutex); 6480 mutex_unlock(&priv->mutex);
6481} 6481}
6482 6482
6483static void iwl_bg_request_scan(struct work_struct *data) 6483static void iwl3945_bg_request_scan(struct work_struct *data)
6484{ 6484{
6485 struct iwl_priv *priv = 6485 struct iwl3945_priv *priv =
6486 container_of(data, struct iwl_priv, request_scan); 6486 container_of(data, struct iwl3945_priv, request_scan);
6487 struct iwl_host_cmd cmd = { 6487 struct iwl3945_host_cmd cmd = {
6488 .id = REPLY_SCAN_CMD, 6488 .id = REPLY_SCAN_CMD,
6489 .len = sizeof(struct iwl_scan_cmd), 6489 .len = sizeof(struct iwl3945_scan_cmd),
6490 .meta.flags = CMD_SIZE_HUGE, 6490 .meta.flags = CMD_SIZE_HUGE,
6491 }; 6491 };
6492 int rc = 0; 6492 int rc = 0;
6493 struct iwl_scan_cmd *scan; 6493 struct iwl3945_scan_cmd *scan;
6494 struct ieee80211_conf *conf = NULL; 6494 struct ieee80211_conf *conf = NULL;
6495 u8 direct_mask; 6495 u8 direct_mask;
6496 int phymode; 6496 int phymode;
@@ -6499,7 +6499,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6499 6499
6500 mutex_lock(&priv->mutex); 6500 mutex_lock(&priv->mutex);
6501 6501
6502 if (!iwl_is_ready(priv)) { 6502 if (!iwl3945_is_ready(priv)) {
6503 IWL_WARNING("request scan called when driver not ready.\n"); 6503 IWL_WARNING("request scan called when driver not ready.\n");
6504 goto done; 6504 goto done;
6505 } 6505 }
@@ -6528,7 +6528,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6528 goto done; 6528 goto done;
6529 } 6529 }
6530 6530
6531 if (iwl_is_rfkill(priv)) { 6531 if (iwl3945_is_rfkill(priv)) {
6532 IWL_DEBUG_HC("Aborting scan due to RF Kill activation\n"); 6532 IWL_DEBUG_HC("Aborting scan due to RF Kill activation\n");
6533 goto done; 6533 goto done;
6534 } 6534 }
@@ -6544,7 +6544,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6544 } 6544 }
6545 6545
6546 if (!priv->scan) { 6546 if (!priv->scan) {
6547 priv->scan = kmalloc(sizeof(struct iwl_scan_cmd) + 6547 priv->scan = kmalloc(sizeof(struct iwl3945_scan_cmd) +
6548 IWL_MAX_SCAN_SIZE, GFP_KERNEL); 6548 IWL_MAX_SCAN_SIZE, GFP_KERNEL);
6549 if (!priv->scan) { 6549 if (!priv->scan) {
6550 rc = -ENOMEM; 6550 rc = -ENOMEM;
@@ -6552,12 +6552,12 @@ static void iwl_bg_request_scan(struct work_struct *data)
6552 } 6552 }
6553 } 6553 }
6554 scan = priv->scan; 6554 scan = priv->scan;
6555 memset(scan, 0, sizeof(struct iwl_scan_cmd) + IWL_MAX_SCAN_SIZE); 6555 memset(scan, 0, sizeof(struct iwl3945_scan_cmd) + IWL_MAX_SCAN_SIZE);
6556 6556
6557 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; 6557 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH;
6558 scan->quiet_time = IWL_ACTIVE_QUIET_TIME; 6558 scan->quiet_time = IWL_ACTIVE_QUIET_TIME;
6559 6559
6560 if (iwl_is_associated(priv)) { 6560 if (iwl3945_is_associated(priv)) {
6561 u16 interval = 0; 6561 u16 interval = 0;
6562 u32 extra; 6562 u32 extra;
6563 u32 suspend_time = 100; 6563 u32 suspend_time = 100;
@@ -6594,14 +6594,14 @@ static void iwl_bg_request_scan(struct work_struct *data)
6594 if (priv->one_direct_scan) { 6594 if (priv->one_direct_scan) {
6595 IWL_DEBUG_SCAN 6595 IWL_DEBUG_SCAN
6596 ("Kicking off one direct scan for '%s'\n", 6596 ("Kicking off one direct scan for '%s'\n",
6597 iwl_escape_essid(priv->direct_ssid, 6597 iwl3945_escape_essid(priv->direct_ssid,
6598 priv->direct_ssid_len)); 6598 priv->direct_ssid_len));
6599 scan->direct_scan[0].id = WLAN_EID_SSID; 6599 scan->direct_scan[0].id = WLAN_EID_SSID;
6600 scan->direct_scan[0].len = priv->direct_ssid_len; 6600 scan->direct_scan[0].len = priv->direct_ssid_len;
6601 memcpy(scan->direct_scan[0].ssid, 6601 memcpy(scan->direct_scan[0].ssid,
6602 priv->direct_ssid, priv->direct_ssid_len); 6602 priv->direct_ssid, priv->direct_ssid_len);
6603 direct_mask = 1; 6603 direct_mask = 1;
6604 } else if (!iwl_is_associated(priv) && priv->essid_len) { 6604 } else if (!iwl3945_is_associated(priv) && priv->essid_len) {
6605 scan->direct_scan[0].id = WLAN_EID_SSID; 6605 scan->direct_scan[0].id = WLAN_EID_SSID;
6606 scan->direct_scan[0].len = priv->essid_len; 6606 scan->direct_scan[0].len = priv->essid_len;
6607 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); 6607 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
@@ -6612,7 +6612,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6612 /* We don't build a direct scan probe request; the uCode will do 6612 /* We don't build a direct scan probe request; the uCode will do
6613 * that based on the direct_mask added to each channel entry */ 6613 * that based on the direct_mask added to each channel entry */
6614 scan->tx_cmd.len = cpu_to_le16( 6614 scan->tx_cmd.len = cpu_to_le16(
6615 iwl_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, 6615 iwl3945_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data,
6616 IWL_MAX_SCAN_SIZE - sizeof(scan), 0)); 6616 IWL_MAX_SCAN_SIZE - sizeof(scan), 0));
6617 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; 6617 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
6618 scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; 6618 scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id;
@@ -6648,23 +6648,23 @@ static void iwl_bg_request_scan(struct work_struct *data)
6648 if (direct_mask) 6648 if (direct_mask)
6649 IWL_DEBUG_SCAN 6649 IWL_DEBUG_SCAN
6650 ("Initiating direct scan for %s.\n", 6650 ("Initiating direct scan for %s.\n",
6651 iwl_escape_essid(priv->essid, priv->essid_len)); 6651 iwl3945_escape_essid(priv->essid, priv->essid_len));
6652 else 6652 else
6653 IWL_DEBUG_SCAN("Initiating indirect scan.\n"); 6653 IWL_DEBUG_SCAN("Initiating indirect scan.\n");
6654 6654
6655 scan->channel_count = 6655 scan->channel_count =
6656 iwl_get_channels_for_scan( 6656 iwl3945_get_channels_for_scan(
6657 priv, phymode, 1, /* active */ 6657 priv, phymode, 1, /* active */
6658 direct_mask, 6658 direct_mask,
6659 (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); 6659 (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]);
6660 6660
6661 cmd.len += le16_to_cpu(scan->tx_cmd.len) + 6661 cmd.len += le16_to_cpu(scan->tx_cmd.len) +
6662 scan->channel_count * sizeof(struct iwl_scan_channel); 6662 scan->channel_count * sizeof(struct iwl3945_scan_channel);
6663 cmd.data = scan; 6663 cmd.data = scan;
6664 scan->len = cpu_to_le16(cmd.len); 6664 scan->len = cpu_to_le16(cmd.len);
6665 6665
6666 set_bit(STATUS_SCAN_HW, &priv->status); 6666 set_bit(STATUS_SCAN_HW, &priv->status);
6667 rc = iwl_send_cmd_sync(priv, &cmd); 6667 rc = iwl3945_send_cmd_sync(priv, &cmd);
6668 if (rc) 6668 if (rc)
6669 goto done; 6669 goto done;
6670 6670
@@ -6680,45 +6680,45 @@ static void iwl_bg_request_scan(struct work_struct *data)
6680 mutex_unlock(&priv->mutex); 6680 mutex_unlock(&priv->mutex);
6681} 6681}
6682 6682
6683static void iwl_bg_up(struct work_struct *data) 6683static void iwl3945_bg_up(struct work_struct *data)
6684{ 6684{
6685 struct iwl_priv *priv = container_of(data, struct iwl_priv, up); 6685 struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv, up);
6686 6686
6687 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6687 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6688 return; 6688 return;
6689 6689
6690 mutex_lock(&priv->mutex); 6690 mutex_lock(&priv->mutex);
6691 __iwl_up(priv); 6691 __iwl3945_up(priv);
6692 mutex_unlock(&priv->mutex); 6692 mutex_unlock(&priv->mutex);
6693} 6693}
6694 6694
6695static void iwl_bg_restart(struct work_struct *data) 6695static void iwl3945_bg_restart(struct work_struct *data)
6696{ 6696{
6697 struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); 6697 struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv, restart);
6698 6698
6699 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6699 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6700 return; 6700 return;
6701 6701
6702 iwl_down(priv); 6702 iwl3945_down(priv);
6703 queue_work(priv->workqueue, &priv->up); 6703 queue_work(priv->workqueue, &priv->up);
6704} 6704}
6705 6705
6706static void iwl_bg_rx_replenish(struct work_struct *data) 6706static void iwl3945_bg_rx_replenish(struct work_struct *data)
6707{ 6707{
6708 struct iwl_priv *priv = 6708 struct iwl3945_priv *priv =
6709 container_of(data, struct iwl_priv, rx_replenish); 6709 container_of(data, struct iwl3945_priv, rx_replenish);
6710 6710
6711 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6711 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6712 return; 6712 return;
6713 6713
6714 mutex_lock(&priv->mutex); 6714 mutex_lock(&priv->mutex);
6715 iwl_rx_replenish(priv); 6715 iwl3945_rx_replenish(priv);
6716 mutex_unlock(&priv->mutex); 6716 mutex_unlock(&priv->mutex);
6717} 6717}
6718 6718
6719static void iwl_bg_post_associate(struct work_struct *data) 6719static void iwl3945_bg_post_associate(struct work_struct *data)
6720{ 6720{
6721 struct iwl_priv *priv = container_of(data, struct iwl_priv, 6721 struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv,
6722 post_associate.work); 6722 post_associate.work);
6723 6723
6724 int rc = 0; 6724 int rc = 0;
@@ -6744,16 +6744,16 @@ static void iwl_bg_post_associate(struct work_struct *data)
6744 mutex_unlock(&priv->mutex); 6744 mutex_unlock(&priv->mutex);
6745 return; 6745 return;
6746 } 6746 }
6747 iwl_scan_cancel_timeout(priv, 200); 6747 iwl3945_scan_cancel_timeout(priv, 200);
6748 6748
6749 conf = ieee80211_get_hw_conf(priv->hw); 6749 conf = ieee80211_get_hw_conf(priv->hw);
6750 6750
6751 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 6751 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
6752 iwl_commit_rxon(priv); 6752 iwl3945_commit_rxon(priv);
6753 6753
6754 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); 6754 memset(&priv->rxon_timing, 0, sizeof(struct iwl3945_rxon_time_cmd));
6755 iwl_setup_rxon_timing(priv); 6755 iwl3945_setup_rxon_timing(priv);
6756 rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, 6756 rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON_TIMING,
6757 sizeof(priv->rxon_timing), &priv->rxon_timing); 6757 sizeof(priv->rxon_timing), &priv->rxon_timing);
6758 if (rc) 6758 if (rc)
6759 IWL_WARNING("REPLY_RXON_TIMING failed - " 6759 IWL_WARNING("REPLY_RXON_TIMING failed - "
@@ -6782,26 +6782,26 @@ static void iwl_bg_post_associate(struct work_struct *data)
6782 6782
6783 } 6783 }
6784 6784
6785 iwl_commit_rxon(priv); 6785 iwl3945_commit_rxon(priv);
6786 6786
6787 switch (priv->iw_mode) { 6787 switch (priv->iw_mode) {
6788 case IEEE80211_IF_TYPE_STA: 6788 case IEEE80211_IF_TYPE_STA:
6789 iwl_rate_scale_init(priv->hw, IWL_AP_ID); 6789 iwl3945_rate_scale_init(priv->hw, IWL_AP_ID);
6790 break; 6790 break;
6791 6791
6792 case IEEE80211_IF_TYPE_IBSS: 6792 case IEEE80211_IF_TYPE_IBSS:
6793 6793
6794 /* clear out the station table */ 6794 /* clear out the station table */
6795 iwl_clear_stations_table(priv); 6795 iwl3945_clear_stations_table(priv);
6796 6796
6797 iwl_add_station(priv, BROADCAST_ADDR, 0, 0); 6797 iwl3945_add_station(priv, iwl3945_broadcast_addr, 0, 0);
6798 iwl_add_station(priv, priv->bssid, 0, 0); 6798 iwl3945_add_station(priv, priv->bssid, 0, 0);
6799 iwl3945_sync_sta(priv, IWL_STA_ID, 6799 iwl3945_sync_sta(priv, IWL_STA_ID,
6800 (priv->phymode == MODE_IEEE80211A)? 6800 (priv->phymode == MODE_IEEE80211A)?
6801 IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP, 6801 IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP,
6802 CMD_ASYNC); 6802 CMD_ASYNC);
6803 iwl_rate_scale_init(priv->hw, IWL_STA_ID); 6803 iwl3945_rate_scale_init(priv->hw, IWL_STA_ID);
6804 iwl_send_beacon_cmd(priv); 6804 iwl3945_send_beacon_cmd(priv);
6805 6805
6806 break; 6806 break;
6807 6807
@@ -6811,33 +6811,33 @@ static void iwl_bg_post_associate(struct work_struct *data)
6811 break; 6811 break;
6812 } 6812 }
6813 6813
6814 iwl_sequence_reset(priv); 6814 iwl3945_sequence_reset(priv);
6815 6815
6816#ifdef CONFIG_IWL3945_QOS 6816#ifdef CONFIG_IWL3945_QOS
6817 iwl_activate_qos(priv, 0); 6817 iwl3945_activate_qos(priv, 0);
6818#endif /* CONFIG_IWL3945_QOS */ 6818#endif /* CONFIG_IWL3945_QOS */
6819 mutex_unlock(&priv->mutex); 6819 mutex_unlock(&priv->mutex);
6820} 6820}
6821 6821
6822static void iwl_bg_abort_scan(struct work_struct *work) 6822static void iwl3945_bg_abort_scan(struct work_struct *work)
6823{ 6823{
6824 struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); 6824 struct iwl3945_priv *priv = container_of(work, struct iwl3945_priv, abort_scan);
6825 6825
6826 if (!iwl_is_ready(priv)) 6826 if (!iwl3945_is_ready(priv))
6827 return; 6827 return;
6828 6828
6829 mutex_lock(&priv->mutex); 6829 mutex_lock(&priv->mutex);
6830 6830
6831 set_bit(STATUS_SCAN_ABORTING, &priv->status); 6831 set_bit(STATUS_SCAN_ABORTING, &priv->status);
6832 iwl_send_scan_abort(priv); 6832 iwl3945_send_scan_abort(priv);
6833 6833
6834 mutex_unlock(&priv->mutex); 6834 mutex_unlock(&priv->mutex);
6835} 6835}
6836 6836
6837static void iwl_bg_scan_completed(struct work_struct *work) 6837static void iwl3945_bg_scan_completed(struct work_struct *work)
6838{ 6838{
6839 struct iwl_priv *priv = 6839 struct iwl3945_priv *priv =
6840 container_of(work, struct iwl_priv, scan_completed); 6840 container_of(work, struct iwl3945_priv, scan_completed);
6841 6841
6842 IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, "SCAN complete scan\n"); 6842 IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, "SCAN complete scan\n");
6843 6843
@@ -6849,7 +6849,7 @@ static void iwl_bg_scan_completed(struct work_struct *work)
6849 /* Since setting the TXPOWER may have been deferred while 6849 /* Since setting the TXPOWER may have been deferred while
6850 * performing the scan, fire one off */ 6850 * performing the scan, fire one off */
6851 mutex_lock(&priv->mutex); 6851 mutex_lock(&priv->mutex);
6852 iwl_hw_reg_send_txpower(priv); 6852 iwl3945_hw_reg_send_txpower(priv);
6853 mutex_unlock(&priv->mutex); 6853 mutex_unlock(&priv->mutex);
6854} 6854}
6855 6855
@@ -6859,9 +6859,9 @@ static void iwl_bg_scan_completed(struct work_struct *work)
6859 * 6859 *
6860 *****************************************************************************/ 6860 *****************************************************************************/
6861 6861
6862static int iwl_mac_start(struct ieee80211_hw *hw) 6862static int iwl3945_mac_start(struct ieee80211_hw *hw)
6863{ 6863{
6864 struct iwl_priv *priv = hw->priv; 6864 struct iwl3945_priv *priv = hw->priv;
6865 6865
6866 IWL_DEBUG_MAC80211("enter\n"); 6866 IWL_DEBUG_MAC80211("enter\n");
6867 6867
@@ -6870,7 +6870,7 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
6870 6870
6871 priv->is_open = 1; 6871 priv->is_open = 1;
6872 6872
6873 if (!iwl_is_rfkill(priv)) 6873 if (!iwl3945_is_rfkill(priv))
6874 ieee80211_start_queues(priv->hw); 6874 ieee80211_start_queues(priv->hw);
6875 6875
6876 mutex_unlock(&priv->mutex); 6876 mutex_unlock(&priv->mutex);
@@ -6878,9 +6878,9 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
6878 return 0; 6878 return 0;
6879} 6879}
6880 6880
6881static void iwl_mac_stop(struct ieee80211_hw *hw) 6881static void iwl3945_mac_stop(struct ieee80211_hw *hw)
6882{ 6882{
6883 struct iwl_priv *priv = hw->priv; 6883 struct iwl3945_priv *priv = hw->priv;
6884 6884
6885 IWL_DEBUG_MAC80211("enter\n"); 6885 IWL_DEBUG_MAC80211("enter\n");
6886 6886
@@ -6890,19 +6890,19 @@ static void iwl_mac_stop(struct ieee80211_hw *hw)
6890 * RXON_FILTER_ASSOC_MSK BIT 6890 * RXON_FILTER_ASSOC_MSK BIT
6891 */ 6891 */
6892 priv->is_open = 0; 6892 priv->is_open = 0;
6893 iwl_scan_cancel_timeout(priv, 100); 6893 iwl3945_scan_cancel_timeout(priv, 100);
6894 cancel_delayed_work(&priv->post_associate); 6894 cancel_delayed_work(&priv->post_associate);
6895 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 6895 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
6896 iwl_commit_rxon(priv); 6896 iwl3945_commit_rxon(priv);
6897 mutex_unlock(&priv->mutex); 6897 mutex_unlock(&priv->mutex);
6898 6898
6899 IWL_DEBUG_MAC80211("leave\n"); 6899 IWL_DEBUG_MAC80211("leave\n");
6900} 6900}
6901 6901
6902static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, 6902static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
6903 struct ieee80211_tx_control *ctl) 6903 struct ieee80211_tx_control *ctl)
6904{ 6904{
6905 struct iwl_priv *priv = hw->priv; 6905 struct iwl3945_priv *priv = hw->priv;
6906 6906
6907 IWL_DEBUG_MAC80211("enter\n"); 6907 IWL_DEBUG_MAC80211("enter\n");
6908 6908
@@ -6914,17 +6914,17 @@ static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
6914 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 6914 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
6915 ctl->tx_rate); 6915 ctl->tx_rate);
6916 6916
6917 if (iwl_tx_skb(priv, skb, ctl)) 6917 if (iwl3945_tx_skb(priv, skb, ctl))
6918 dev_kfree_skb_any(skb); 6918 dev_kfree_skb_any(skb);
6919 6919
6920 IWL_DEBUG_MAC80211("leave\n"); 6920 IWL_DEBUG_MAC80211("leave\n");
6921 return 0; 6921 return 0;
6922} 6922}
6923 6923
6924static int iwl_mac_add_interface(struct ieee80211_hw *hw, 6924static int iwl3945_mac_add_interface(struct ieee80211_hw *hw,
6925 struct ieee80211_if_init_conf *conf) 6925 struct ieee80211_if_init_conf *conf)
6926{ 6926{
6927 struct iwl_priv *priv = hw->priv; 6927 struct iwl3945_priv *priv = hw->priv;
6928 unsigned long flags; 6928 unsigned long flags;
6929 DECLARE_MAC_BUF(mac); 6929 DECLARE_MAC_BUF(mac);
6930 6930
@@ -6947,7 +6947,7 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
6947 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); 6947 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
6948 } 6948 }
6949 6949
6950 iwl_set_mode(priv, conf->type); 6950 iwl3945_set_mode(priv, conf->type);
6951 6951
6952 IWL_DEBUG_MAC80211("leave\n"); 6952 IWL_DEBUG_MAC80211("leave\n");
6953 mutex_unlock(&priv->mutex); 6953 mutex_unlock(&priv->mutex);
@@ -6956,22 +6956,22 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
6956} 6956}
6957 6957
6958/** 6958/**
6959 * iwl_mac_config - mac80211 config callback 6959 * iwl3945_mac_config - mac80211 config callback
6960 * 6960 *
6961 * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to 6961 * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to
6962 * be set inappropriately and the driver currently sets the hardware up to 6962 * be set inappropriately and the driver currently sets the hardware up to
6963 * use it whenever needed. 6963 * use it whenever needed.
6964 */ 6964 */
6965static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) 6965static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
6966{ 6966{
6967 struct iwl_priv *priv = hw->priv; 6967 struct iwl3945_priv *priv = hw->priv;
6968 const struct iwl_channel_info *ch_info; 6968 const struct iwl3945_channel_info *ch_info;
6969 unsigned long flags; 6969 unsigned long flags;
6970 6970
6971 mutex_lock(&priv->mutex); 6971 mutex_lock(&priv->mutex);
6972 IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel); 6972 IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel);
6973 6973
6974 if (!iwl_is_ready(priv)) { 6974 if (!iwl3945_is_ready(priv)) {
6975 IWL_DEBUG_MAC80211("leave - not ready\n"); 6975 IWL_DEBUG_MAC80211("leave - not ready\n");
6976 mutex_unlock(&priv->mutex); 6976 mutex_unlock(&priv->mutex);
6977 return -EIO; 6977 return -EIO;
@@ -6979,7 +6979,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
6979 6979
6980 /* TODO: Figure out how to get ieee80211_local->sta_scanning w/ only 6980 /* TODO: Figure out how to get ieee80211_local->sta_scanning w/ only
6981 * what is exposed through include/ declarations */ 6981 * what is exposed through include/ declarations */
6982 if (unlikely(!iwl_param_disable_hw_scan && 6982 if (unlikely(!iwl3945_param_disable_hw_scan &&
6983 test_bit(STATUS_SCANNING, &priv->status))) { 6983 test_bit(STATUS_SCANNING, &priv->status))) {
6984 IWL_DEBUG_MAC80211("leave - scanning\n"); 6984 IWL_DEBUG_MAC80211("leave - scanning\n");
6985 mutex_unlock(&priv->mutex); 6985 mutex_unlock(&priv->mutex);
@@ -6988,7 +6988,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
6988 6988
6989 spin_lock_irqsave(&priv->lock, flags); 6989 spin_lock_irqsave(&priv->lock, flags);
6990 6990
6991 ch_info = iwl_get_channel_info(priv, conf->phymode, conf->channel); 6991 ch_info = iwl3945_get_channel_info(priv, conf->phymode, conf->channel);
6992 if (!is_channel_valid(ch_info)) { 6992 if (!is_channel_valid(ch_info)) {
6993 IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this SKU.\n", 6993 IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this SKU.\n",
6994 conf->channel, conf->phymode); 6994 conf->channel, conf->phymode);
@@ -6998,26 +6998,26 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
6998 return -EINVAL; 6998 return -EINVAL;
6999 } 6999 }
7000 7000
7001 iwl_set_rxon_channel(priv, conf->phymode, conf->channel); 7001 iwl3945_set_rxon_channel(priv, conf->phymode, conf->channel);
7002 7002
7003 iwl_set_flags_for_phymode(priv, conf->phymode); 7003 iwl3945_set_flags_for_phymode(priv, conf->phymode);
7004 7004
7005 /* The list of supported rates and rate mask can be different 7005 /* The list of supported rates and rate mask can be different
7006 * for each phymode; since the phymode may have changed, reset 7006 * for each phymode; since the phymode may have changed, reset
7007 * the rate mask to what mac80211 lists */ 7007 * the rate mask to what mac80211 lists */
7008 iwl_set_rate(priv); 7008 iwl3945_set_rate(priv);
7009 7009
7010 spin_unlock_irqrestore(&priv->lock, flags); 7010 spin_unlock_irqrestore(&priv->lock, flags);
7011 7011
7012#ifdef IEEE80211_CONF_CHANNEL_SWITCH 7012#ifdef IEEE80211_CONF_CHANNEL_SWITCH
7013 if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) { 7013 if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) {
7014 iwl_hw_channel_switch(priv, conf->channel); 7014 iwl3945_hw_channel_switch(priv, conf->channel);
7015 mutex_unlock(&priv->mutex); 7015 mutex_unlock(&priv->mutex);
7016 return 0; 7016 return 0;
7017 } 7017 }
7018#endif 7018#endif
7019 7019
7020 iwl_radio_kill_sw(priv, !conf->radio_enabled); 7020 iwl3945_radio_kill_sw(priv, !conf->radio_enabled);
7021 7021
7022 if (!conf->radio_enabled) { 7022 if (!conf->radio_enabled) {
7023 IWL_DEBUG_MAC80211("leave - radio disabled\n"); 7023 IWL_DEBUG_MAC80211("leave - radio disabled\n");
@@ -7025,17 +7025,17 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
7025 return 0; 7025 return 0;
7026 } 7026 }
7027 7027
7028 if (iwl_is_rfkill(priv)) { 7028 if (iwl3945_is_rfkill(priv)) {
7029 IWL_DEBUG_MAC80211("leave - RF kill\n"); 7029 IWL_DEBUG_MAC80211("leave - RF kill\n");
7030 mutex_unlock(&priv->mutex); 7030 mutex_unlock(&priv->mutex);
7031 return -EIO; 7031 return -EIO;
7032 } 7032 }
7033 7033
7034 iwl_set_rate(priv); 7034 iwl3945_set_rate(priv);
7035 7035
7036 if (memcmp(&priv->active_rxon, 7036 if (memcmp(&priv->active_rxon,
7037 &priv->staging_rxon, sizeof(priv->staging_rxon))) 7037 &priv->staging_rxon, sizeof(priv->staging_rxon)))
7038 iwl_commit_rxon(priv); 7038 iwl3945_commit_rxon(priv);
7039 else 7039 else
7040 IWL_DEBUG_INFO("No re-sending same RXON configuration.\n"); 7040 IWL_DEBUG_INFO("No re-sending same RXON configuration.\n");
7041 7041
@@ -7046,7 +7046,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
7046 return 0; 7046 return 0;
7047} 7047}
7048 7048
7049static void iwl_config_ap(struct iwl_priv *priv) 7049static void iwl3945_config_ap(struct iwl3945_priv *priv)
7050{ 7050{
7051 int rc = 0; 7051 int rc = 0;
7052 7052
@@ -7058,12 +7058,12 @@ static void iwl_config_ap(struct iwl_priv *priv)
7058 7058
7059 /* RXON - unassoc (to set timing command) */ 7059 /* RXON - unassoc (to set timing command) */
7060 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7060 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7061 iwl_commit_rxon(priv); 7061 iwl3945_commit_rxon(priv);
7062 7062
7063 /* RXON Timing */ 7063 /* RXON Timing */
7064 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); 7064 memset(&priv->rxon_timing, 0, sizeof(struct iwl3945_rxon_time_cmd));
7065 iwl_setup_rxon_timing(priv); 7065 iwl3945_setup_rxon_timing(priv);
7066 rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, 7066 rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON_TIMING,
7067 sizeof(priv->rxon_timing), &priv->rxon_timing); 7067 sizeof(priv->rxon_timing), &priv->rxon_timing);
7068 if (rc) 7068 if (rc)
7069 IWL_WARNING("REPLY_RXON_TIMING failed - " 7069 IWL_WARNING("REPLY_RXON_TIMING failed - "
@@ -7093,20 +7093,20 @@ static void iwl_config_ap(struct iwl_priv *priv)
7093 } 7093 }
7094 /* restore RXON assoc */ 7094 /* restore RXON assoc */
7095 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; 7095 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
7096 iwl_commit_rxon(priv); 7096 iwl3945_commit_rxon(priv);
7097 iwl_add_station(priv, BROADCAST_ADDR, 0, 0); 7097 iwl3945_add_station(priv, iwl3945_broadcast_addr, 0, 0);
7098 } 7098 }
7099 iwl_send_beacon_cmd(priv); 7099 iwl3945_send_beacon_cmd(priv);
7100 7100
7101 /* FIXME - we need to add code here to detect a totally new 7101 /* FIXME - we need to add code here to detect a totally new
7102 * configuration, reset the AP, unassoc, rxon timing, assoc, 7102 * configuration, reset the AP, unassoc, rxon timing, assoc,
7103 * clear sta table, add BCAST sta... */ 7103 * clear sta table, add BCAST sta... */
7104} 7104}
7105 7105
7106static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, 7106static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7107 struct ieee80211_if_conf *conf) 7107 struct ieee80211_if_conf *conf)
7108{ 7108{
7109 struct iwl_priv *priv = hw->priv; 7109 struct iwl3945_priv *priv = hw->priv;
7110 DECLARE_MAC_BUF(mac); 7110 DECLARE_MAC_BUF(mac);
7111 unsigned long flags; 7111 unsigned long flags;
7112 int rc; 7112 int rc;
@@ -7165,7 +7165,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7165 !is_multicast_ether_addr(conf->bssid)) { 7165 !is_multicast_ether_addr(conf->bssid)) {
7166 /* If there is currently a HW scan going on in the background 7166 /* If there is currently a HW scan going on in the background
7167 * then we need to cancel it else the RXON below will fail. */ 7167 * then we need to cancel it else the RXON below will fail. */
7168 if (iwl_scan_cancel_timeout(priv, 100)) { 7168 if (iwl3945_scan_cancel_timeout(priv, 100)) {
7169 IWL_WARNING("Aborted scan still in progress " 7169 IWL_WARNING("Aborted scan still in progress "
7170 "after 100ms\n"); 7170 "after 100ms\n");
7171 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); 7171 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n");
@@ -7181,18 +7181,18 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7181 memcpy(priv->bssid, conf->bssid, ETH_ALEN); 7181 memcpy(priv->bssid, conf->bssid, ETH_ALEN);
7182 7182
7183 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) 7183 if (priv->iw_mode == IEEE80211_IF_TYPE_AP)
7184 iwl_config_ap(priv); 7184 iwl3945_config_ap(priv);
7185 else { 7185 else {
7186 rc = iwl_commit_rxon(priv); 7186 rc = iwl3945_commit_rxon(priv);
7187 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) 7187 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc)
7188 iwl_add_station(priv, 7188 iwl3945_add_station(priv,
7189 priv->active_rxon.bssid_addr, 1, 0); 7189 priv->active_rxon.bssid_addr, 1, 0);
7190 } 7190 }
7191 7191
7192 } else { 7192 } else {
7193 iwl_scan_cancel_timeout(priv, 100); 7193 iwl3945_scan_cancel_timeout(priv, 100);
7194 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7194 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7195 iwl_commit_rxon(priv); 7195 iwl3945_commit_rxon(priv);
7196 } 7196 }
7197 7197
7198 spin_lock_irqsave(&priv->lock, flags); 7198 spin_lock_irqsave(&priv->lock, flags);
@@ -7210,31 +7210,31 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7210 return 0; 7210 return 0;
7211} 7211}
7212 7212
7213static void iwl_configure_filter(struct ieee80211_hw *hw, 7213static void iwl3945_configure_filter(struct ieee80211_hw *hw,
7214 unsigned int changed_flags, 7214 unsigned int changed_flags,
7215 unsigned int *total_flags, 7215 unsigned int *total_flags,
7216 int mc_count, struct dev_addr_list *mc_list) 7216 int mc_count, struct dev_addr_list *mc_list)
7217{ 7217{
7218 /* 7218 /*
7219 * XXX: dummy 7219 * XXX: dummy
7220 * see also iwl_connection_init_rx_config 7220 * see also iwl3945_connection_init_rx_config
7221 */ 7221 */
7222 *total_flags = 0; 7222 *total_flags = 0;
7223} 7223}
7224 7224
7225static void iwl_mac_remove_interface(struct ieee80211_hw *hw, 7225static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw,
7226 struct ieee80211_if_init_conf *conf) 7226 struct ieee80211_if_init_conf *conf)
7227{ 7227{
7228 struct iwl_priv *priv = hw->priv; 7228 struct iwl3945_priv *priv = hw->priv;
7229 7229
7230 IWL_DEBUG_MAC80211("enter\n"); 7230 IWL_DEBUG_MAC80211("enter\n");
7231 7231
7232 mutex_lock(&priv->mutex); 7232 mutex_lock(&priv->mutex);
7233 7233
7234 iwl_scan_cancel_timeout(priv, 100); 7234 iwl3945_scan_cancel_timeout(priv, 100);
7235 cancel_delayed_work(&priv->post_associate); 7235 cancel_delayed_work(&priv->post_associate);
7236 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7236 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7237 iwl_commit_rxon(priv); 7237 iwl3945_commit_rxon(priv);
7238 7238
7239 if (priv->interface_id == conf->if_id) { 7239 if (priv->interface_id == conf->if_id) {
7240 priv->interface_id = 0; 7240 priv->interface_id = 0;
@@ -7249,18 +7249,18 @@ static void iwl_mac_remove_interface(struct ieee80211_hw *hw,
7249} 7249}
7250 7250
7251#define IWL_DELAY_NEXT_SCAN (HZ*2) 7251#define IWL_DELAY_NEXT_SCAN (HZ*2)
7252static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) 7252static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7253{ 7253{
7254 int rc = 0; 7254 int rc = 0;
7255 unsigned long flags; 7255 unsigned long flags;
7256 struct iwl_priv *priv = hw->priv; 7256 struct iwl3945_priv *priv = hw->priv;
7257 7257
7258 IWL_DEBUG_MAC80211("enter\n"); 7258 IWL_DEBUG_MAC80211("enter\n");
7259 7259
7260 mutex_lock(&priv->mutex); 7260 mutex_lock(&priv->mutex);
7261 spin_lock_irqsave(&priv->lock, flags); 7261 spin_lock_irqsave(&priv->lock, flags);
7262 7262
7263 if (!iwl_is_ready_rf(priv)) { 7263 if (!iwl3945_is_ready_rf(priv)) {
7264 rc = -EIO; 7264 rc = -EIO;
7265 IWL_DEBUG_MAC80211("leave - not ready or exit pending\n"); 7265 IWL_DEBUG_MAC80211("leave - not ready or exit pending\n");
7266 goto out_unlock; 7266 goto out_unlock;
@@ -7282,7 +7282,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7282 if (len) { 7282 if (len) {
7283 IWL_DEBUG_SCAN("direct scan for " 7283 IWL_DEBUG_SCAN("direct scan for "
7284 "%s [%d]\n ", 7284 "%s [%d]\n ",
7285 iwl_escape_essid(ssid, len), (int)len); 7285 iwl3945_escape_essid(ssid, len), (int)len);
7286 7286
7287 priv->one_direct_scan = 1; 7287 priv->one_direct_scan = 1;
7288 priv->direct_ssid_len = (u8) 7288 priv->direct_ssid_len = (u8)
@@ -7291,7 +7291,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7291 } else 7291 } else
7292 priv->one_direct_scan = 0; 7292 priv->one_direct_scan = 0;
7293 7293
7294 rc = iwl_scan_initiate(priv); 7294 rc = iwl3945_scan_initiate(priv);
7295 7295
7296 IWL_DEBUG_MAC80211("leave\n"); 7296 IWL_DEBUG_MAC80211("leave\n");
7297 7297
@@ -7302,17 +7302,17 @@ out_unlock:
7302 return rc; 7302 return rc;
7303} 7303}
7304 7304
7305static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 7305static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7306 const u8 *local_addr, const u8 *addr, 7306 const u8 *local_addr, const u8 *addr,
7307 struct ieee80211_key_conf *key) 7307 struct ieee80211_key_conf *key)
7308{ 7308{
7309 struct iwl_priv *priv = hw->priv; 7309 struct iwl3945_priv *priv = hw->priv;
7310 int rc = 0; 7310 int rc = 0;
7311 u8 sta_id; 7311 u8 sta_id;
7312 7312
7313 IWL_DEBUG_MAC80211("enter\n"); 7313 IWL_DEBUG_MAC80211("enter\n");
7314 7314
7315 if (!iwl_param_hwcrypto) { 7315 if (!iwl3945_param_hwcrypto) {
7316 IWL_DEBUG_MAC80211("leave - hwcrypto disabled\n"); 7316 IWL_DEBUG_MAC80211("leave - hwcrypto disabled\n");
7317 return -EOPNOTSUPP; 7317 return -EOPNOTSUPP;
7318 } 7318 }
@@ -7321,7 +7321,7 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7321 /* only support pairwise keys */ 7321 /* only support pairwise keys */
7322 return -EOPNOTSUPP; 7322 return -EOPNOTSUPP;
7323 7323
7324 sta_id = iwl_hw_find_station(priv, addr); 7324 sta_id = iwl3945_hw_find_station(priv, addr);
7325 if (sta_id == IWL_INVALID_STATION) { 7325 if (sta_id == IWL_INVALID_STATION) {
7326 DECLARE_MAC_BUF(mac); 7326 DECLARE_MAC_BUF(mac);
7327 7327
@@ -7332,24 +7332,24 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7332 7332
7333 mutex_lock(&priv->mutex); 7333 mutex_lock(&priv->mutex);
7334 7334
7335 iwl_scan_cancel_timeout(priv, 100); 7335 iwl3945_scan_cancel_timeout(priv, 100);
7336 7336
7337 switch (cmd) { 7337 switch (cmd) {
7338 case SET_KEY: 7338 case SET_KEY:
7339 rc = iwl_update_sta_key_info(priv, key, sta_id); 7339 rc = iwl3945_update_sta_key_info(priv, key, sta_id);
7340 if (!rc) { 7340 if (!rc) {
7341 iwl_set_rxon_hwcrypto(priv, 1); 7341 iwl3945_set_rxon_hwcrypto(priv, 1);
7342 iwl_commit_rxon(priv); 7342 iwl3945_commit_rxon(priv);
7343 key->hw_key_idx = sta_id; 7343 key->hw_key_idx = sta_id;
7344 IWL_DEBUG_MAC80211("set_key success, using hwcrypto\n"); 7344 IWL_DEBUG_MAC80211("set_key success, using hwcrypto\n");
7345 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 7345 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
7346 } 7346 }
7347 break; 7347 break;
7348 case DISABLE_KEY: 7348 case DISABLE_KEY:
7349 rc = iwl_clear_sta_key_info(priv, sta_id); 7349 rc = iwl3945_clear_sta_key_info(priv, sta_id);
7350 if (!rc) { 7350 if (!rc) {
7351 iwl_set_rxon_hwcrypto(priv, 0); 7351 iwl3945_set_rxon_hwcrypto(priv, 0);
7352 iwl_commit_rxon(priv); 7352 iwl3945_commit_rxon(priv);
7353 IWL_DEBUG_MAC80211("disable hwcrypto key\n"); 7353 IWL_DEBUG_MAC80211("disable hwcrypto key\n");
7354 } 7354 }
7355 break; 7355 break;
@@ -7363,10 +7363,10 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7363 return rc; 7363 return rc;
7364} 7364}
7365 7365
7366static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, 7366static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, int queue,
7367 const struct ieee80211_tx_queue_params *params) 7367 const struct ieee80211_tx_queue_params *params)
7368{ 7368{
7369 struct iwl_priv *priv = hw->priv; 7369 struct iwl3945_priv *priv = hw->priv;
7370#ifdef CONFIG_IWL3945_QOS 7370#ifdef CONFIG_IWL3945_QOS
7371 unsigned long flags; 7371 unsigned long flags;
7372 int q; 7372 int q;
@@ -7374,7 +7374,7 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue,
7374 7374
7375 IWL_DEBUG_MAC80211("enter\n"); 7375 IWL_DEBUG_MAC80211("enter\n");
7376 7376
7377 if (!iwl_is_ready_rf(priv)) { 7377 if (!iwl3945_is_ready_rf(priv)) {
7378 IWL_DEBUG_MAC80211("leave - RF not ready\n"); 7378 IWL_DEBUG_MAC80211("leave - RF not ready\n");
7379 return -EIO; 7379 return -EIO;
7380 } 7380 }
@@ -7407,9 +7407,9 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue,
7407 7407
7408 mutex_lock(&priv->mutex); 7408 mutex_lock(&priv->mutex);
7409 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) 7409 if (priv->iw_mode == IEEE80211_IF_TYPE_AP)
7410 iwl_activate_qos(priv, 1); 7410 iwl3945_activate_qos(priv, 1);
7411 else if (priv->assoc_id && iwl_is_associated(priv)) 7411 else if (priv->assoc_id && iwl3945_is_associated(priv))
7412 iwl_activate_qos(priv, 0); 7412 iwl3945_activate_qos(priv, 0);
7413 7413
7414 mutex_unlock(&priv->mutex); 7414 mutex_unlock(&priv->mutex);
7415 7415
@@ -7419,18 +7419,18 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue,
7419 return 0; 7419 return 0;
7420} 7420}
7421 7421
7422static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw, 7422static int iwl3945_mac_get_tx_stats(struct ieee80211_hw *hw,
7423 struct ieee80211_tx_queue_stats *stats) 7423 struct ieee80211_tx_queue_stats *stats)
7424{ 7424{
7425 struct iwl_priv *priv = hw->priv; 7425 struct iwl3945_priv *priv = hw->priv;
7426 int i, avail; 7426 int i, avail;
7427 struct iwl_tx_queue *txq; 7427 struct iwl3945_tx_queue *txq;
7428 struct iwl_queue *q; 7428 struct iwl3945_queue *q;
7429 unsigned long flags; 7429 unsigned long flags;
7430 7430
7431 IWL_DEBUG_MAC80211("enter\n"); 7431 IWL_DEBUG_MAC80211("enter\n");
7432 7432
7433 if (!iwl_is_ready_rf(priv)) { 7433 if (!iwl3945_is_ready_rf(priv)) {
7434 IWL_DEBUG_MAC80211("leave - RF not ready\n"); 7434 IWL_DEBUG_MAC80211("leave - RF not ready\n");
7435 return -EIO; 7435 return -EIO;
7436 } 7436 }
@@ -7440,7 +7440,7 @@ static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw,
7440 for (i = 0; i < AC_NUM; i++) { 7440 for (i = 0; i < AC_NUM; i++) {
7441 txq = &priv->txq[i]; 7441 txq = &priv->txq[i];
7442 q = &txq->q; 7442 q = &txq->q;
7443 avail = iwl_queue_space(q); 7443 avail = iwl3945_queue_space(q);
7444 7444
7445 stats->data[i].len = q->n_window - avail; 7445 stats->data[i].len = q->n_window - avail;
7446 stats->data[i].limit = q->n_window - q->high_mark; 7446 stats->data[i].limit = q->n_window - q->high_mark;
@@ -7454,7 +7454,7 @@ static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw,
7454 return 0; 7454 return 0;
7455} 7455}
7456 7456
7457static int iwl_mac_get_stats(struct ieee80211_hw *hw, 7457static int iwl3945_mac_get_stats(struct ieee80211_hw *hw,
7458 struct ieee80211_low_level_stats *stats) 7458 struct ieee80211_low_level_stats *stats)
7459{ 7459{
7460 IWL_DEBUG_MAC80211("enter\n"); 7460 IWL_DEBUG_MAC80211("enter\n");
@@ -7463,7 +7463,7 @@ static int iwl_mac_get_stats(struct ieee80211_hw *hw,
7463 return 0; 7463 return 0;
7464} 7464}
7465 7465
7466static u64 iwl_mac_get_tsf(struct ieee80211_hw *hw) 7466static u64 iwl3945_mac_get_tsf(struct ieee80211_hw *hw)
7467{ 7467{
7468 IWL_DEBUG_MAC80211("enter\n"); 7468 IWL_DEBUG_MAC80211("enter\n");
7469 IWL_DEBUG_MAC80211("leave\n"); 7469 IWL_DEBUG_MAC80211("leave\n");
@@ -7471,16 +7471,16 @@ static u64 iwl_mac_get_tsf(struct ieee80211_hw *hw)
7471 return 0; 7471 return 0;
7472} 7472}
7473 7473
7474static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) 7474static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
7475{ 7475{
7476 struct iwl_priv *priv = hw->priv; 7476 struct iwl3945_priv *priv = hw->priv;
7477 unsigned long flags; 7477 unsigned long flags;
7478 7478
7479 mutex_lock(&priv->mutex); 7479 mutex_lock(&priv->mutex);
7480 IWL_DEBUG_MAC80211("enter\n"); 7480 IWL_DEBUG_MAC80211("enter\n");
7481 7481
7482#ifdef CONFIG_IWL3945_QOS 7482#ifdef CONFIG_IWL3945_QOS
7483 iwl_reset_qos(priv); 7483 iwl3945_reset_qos(priv);
7484#endif 7484#endif
7485 cancel_delayed_work(&priv->post_associate); 7485 cancel_delayed_work(&priv->post_associate);
7486 7486
@@ -7507,9 +7507,9 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7507 * clear RXON_FILTER_ASSOC_MSK bit 7507 * clear RXON_FILTER_ASSOC_MSK bit
7508 */ 7508 */
7509 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { 7509 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) {
7510 iwl_scan_cancel_timeout(priv, 100); 7510 iwl3945_scan_cancel_timeout(priv, 100);
7511 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7511 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7512 iwl_commit_rxon(priv); 7512 iwl3945_commit_rxon(priv);
7513 } 7513 }
7514 7514
7515 /* Per mac80211.h: This is only used in IBSS mode... */ 7515 /* Per mac80211.h: This is only used in IBSS mode... */
@@ -7520,7 +7520,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7520 return; 7520 return;
7521 } 7521 }
7522 7522
7523 if (!iwl_is_ready_rf(priv)) { 7523 if (!iwl3945_is_ready_rf(priv)) {
7524 IWL_DEBUG_MAC80211("leave - not ready\n"); 7524 IWL_DEBUG_MAC80211("leave - not ready\n");
7525 mutex_unlock(&priv->mutex); 7525 mutex_unlock(&priv->mutex);
7526 return; 7526 return;
@@ -7528,7 +7528,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7528 7528
7529 priv->only_active_channel = 0; 7529 priv->only_active_channel = 0;
7530 7530
7531 iwl_set_rate(priv); 7531 iwl3945_set_rate(priv);
7532 7532
7533 mutex_unlock(&priv->mutex); 7533 mutex_unlock(&priv->mutex);
7534 7534
@@ -7536,16 +7536,16 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7536 7536
7537} 7537}
7538 7538
7539static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, 7539static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
7540 struct ieee80211_tx_control *control) 7540 struct ieee80211_tx_control *control)
7541{ 7541{
7542 struct iwl_priv *priv = hw->priv; 7542 struct iwl3945_priv *priv = hw->priv;
7543 unsigned long flags; 7543 unsigned long flags;
7544 7544
7545 mutex_lock(&priv->mutex); 7545 mutex_lock(&priv->mutex);
7546 IWL_DEBUG_MAC80211("enter\n"); 7546 IWL_DEBUG_MAC80211("enter\n");
7547 7547
7548 if (!iwl_is_ready_rf(priv)) { 7548 if (!iwl3945_is_ready_rf(priv)) {
7549 IWL_DEBUG_MAC80211("leave - RF not ready\n"); 7549 IWL_DEBUG_MAC80211("leave - RF not ready\n");
7550 mutex_unlock(&priv->mutex); 7550 mutex_unlock(&priv->mutex);
7551 return -EIO; 7551 return -EIO;
@@ -7570,7 +7570,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
7570 spin_unlock_irqrestore(&priv->lock, flags); 7570 spin_unlock_irqrestore(&priv->lock, flags);
7571 7571
7572#ifdef CONFIG_IWL3945_QOS 7572#ifdef CONFIG_IWL3945_QOS
7573 iwl_reset_qos(priv); 7573 iwl3945_reset_qos(priv);
7574#endif 7574#endif
7575 7575
7576 queue_work(priv->workqueue, &priv->post_associate.work); 7576 queue_work(priv->workqueue, &priv->post_associate.work);
@@ -7598,7 +7598,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
7598 7598
7599static ssize_t show_debug_level(struct device_driver *d, char *buf) 7599static ssize_t show_debug_level(struct device_driver *d, char *buf)
7600{ 7600{
7601 return sprintf(buf, "0x%08X\n", iwl_debug_level); 7601 return sprintf(buf, "0x%08X\n", iwl3945_debug_level);
7602} 7602}
7603static ssize_t store_debug_level(struct device_driver *d, 7603static ssize_t store_debug_level(struct device_driver *d,
7604 const char *buf, size_t count) 7604 const char *buf, size_t count)
@@ -7611,7 +7611,7 @@ static ssize_t store_debug_level(struct device_driver *d,
7611 printk(KERN_INFO DRV_NAME 7611 printk(KERN_INFO DRV_NAME
7612 ": %s is not in hex or decimal form.\n", buf); 7612 ": %s is not in hex or decimal form.\n", buf);
7613 else 7613 else
7614 iwl_debug_level = val; 7614 iwl3945_debug_level = val;
7615 7615
7616 return strnlen(buf, count); 7616 return strnlen(buf, count);
7617} 7617}
@@ -7630,7 +7630,7 @@ static ssize_t show_rf_kill(struct device *d,
7630 * 2 - HW based RF kill active 7630 * 2 - HW based RF kill active
7631 * 3 - Both HW and SW based RF kill active 7631 * 3 - Both HW and SW based RF kill active
7632 */ 7632 */
7633 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7633 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7634 int val = (test_bit(STATUS_RF_KILL_SW, &priv->status) ? 0x1 : 0x0) | 7634 int val = (test_bit(STATUS_RF_KILL_SW, &priv->status) ? 0x1 : 0x0) |
7635 (test_bit(STATUS_RF_KILL_HW, &priv->status) ? 0x2 : 0x0); 7635 (test_bit(STATUS_RF_KILL_HW, &priv->status) ? 0x2 : 0x0);
7636 7636
@@ -7641,10 +7641,10 @@ static ssize_t store_rf_kill(struct device *d,
7641 struct device_attribute *attr, 7641 struct device_attribute *attr,
7642 const char *buf, size_t count) 7642 const char *buf, size_t count)
7643{ 7643{
7644 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7644 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7645 7645
7646 mutex_lock(&priv->mutex); 7646 mutex_lock(&priv->mutex);
7647 iwl_radio_kill_sw(priv, buf[0] == '1'); 7647 iwl3945_radio_kill_sw(priv, buf[0] == '1');
7648 mutex_unlock(&priv->mutex); 7648 mutex_unlock(&priv->mutex);
7649 7649
7650 return count; 7650 return count;
@@ -7655,12 +7655,12 @@ static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill);
7655static ssize_t show_temperature(struct device *d, 7655static ssize_t show_temperature(struct device *d,
7656 struct device_attribute *attr, char *buf) 7656 struct device_attribute *attr, char *buf)
7657{ 7657{
7658 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7658 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7659 7659
7660 if (!iwl_is_alive(priv)) 7660 if (!iwl3945_is_alive(priv))
7661 return -EAGAIN; 7661 return -EAGAIN;
7662 7662
7663 return sprintf(buf, "%d\n", iwl_hw_get_temperature(priv)); 7663 return sprintf(buf, "%d\n", iwl3945_hw_get_temperature(priv));
7664} 7664}
7665 7665
7666static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL); 7666static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);
@@ -7669,15 +7669,15 @@ static ssize_t show_rs_window(struct device *d,
7669 struct device_attribute *attr, 7669 struct device_attribute *attr,
7670 char *buf) 7670 char *buf)
7671{ 7671{
7672 struct iwl_priv *priv = d->driver_data; 7672 struct iwl3945_priv *priv = d->driver_data;
7673 return iwl_fill_rs_info(priv->hw, buf, IWL_AP_ID); 7673 return iwl3945_fill_rs_info(priv->hw, buf, IWL_AP_ID);
7674} 7674}
7675static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL); 7675static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL);
7676 7676
7677static ssize_t show_tx_power(struct device *d, 7677static ssize_t show_tx_power(struct device *d,
7678 struct device_attribute *attr, char *buf) 7678 struct device_attribute *attr, char *buf)
7679{ 7679{
7680 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7680 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7681 return sprintf(buf, "%d\n", priv->user_txpower_limit); 7681 return sprintf(buf, "%d\n", priv->user_txpower_limit);
7682} 7682}
7683 7683
@@ -7685,7 +7685,7 @@ static ssize_t store_tx_power(struct device *d,
7685 struct device_attribute *attr, 7685 struct device_attribute *attr,
7686 const char *buf, size_t count) 7686 const char *buf, size_t count)
7687{ 7687{
7688 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7688 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7689 char *p = (char *)buf; 7689 char *p = (char *)buf;
7690 u32 val; 7690 u32 val;
7691 7691
@@ -7694,7 +7694,7 @@ static ssize_t store_tx_power(struct device *d,
7694 printk(KERN_INFO DRV_NAME 7694 printk(KERN_INFO DRV_NAME
7695 ": %s is not in decimal form.\n", buf); 7695 ": %s is not in decimal form.\n", buf);
7696 else 7696 else
7697 iwl_hw_reg_set_txpower(priv, val); 7697 iwl3945_hw_reg_set_txpower(priv, val);
7698 7698
7699 return count; 7699 return count;
7700} 7700}
@@ -7704,7 +7704,7 @@ static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power);
7704static ssize_t show_flags(struct device *d, 7704static ssize_t show_flags(struct device *d,
7705 struct device_attribute *attr, char *buf) 7705 struct device_attribute *attr, char *buf)
7706{ 7706{
7707 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7707 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7708 7708
7709 return sprintf(buf, "0x%04X\n", priv->active_rxon.flags); 7709 return sprintf(buf, "0x%04X\n", priv->active_rxon.flags);
7710} 7710}
@@ -7713,19 +7713,19 @@ static ssize_t store_flags(struct device *d,
7713 struct device_attribute *attr, 7713 struct device_attribute *attr,
7714 const char *buf, size_t count) 7714 const char *buf, size_t count)
7715{ 7715{
7716 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7716 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7717 u32 flags = simple_strtoul(buf, NULL, 0); 7717 u32 flags = simple_strtoul(buf, NULL, 0);
7718 7718
7719 mutex_lock(&priv->mutex); 7719 mutex_lock(&priv->mutex);
7720 if (le32_to_cpu(priv->staging_rxon.flags) != flags) { 7720 if (le32_to_cpu(priv->staging_rxon.flags) != flags) {
7721 /* Cancel any currently running scans... */ 7721 /* Cancel any currently running scans... */
7722 if (iwl_scan_cancel_timeout(priv, 100)) 7722 if (iwl3945_scan_cancel_timeout(priv, 100))
7723 IWL_WARNING("Could not cancel scan.\n"); 7723 IWL_WARNING("Could not cancel scan.\n");
7724 else { 7724 else {
7725 IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n", 7725 IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n",
7726 flags); 7726 flags);
7727 priv->staging_rxon.flags = cpu_to_le32(flags); 7727 priv->staging_rxon.flags = cpu_to_le32(flags);
7728 iwl_commit_rxon(priv); 7728 iwl3945_commit_rxon(priv);
7729 } 7729 }
7730 } 7730 }
7731 mutex_unlock(&priv->mutex); 7731 mutex_unlock(&priv->mutex);
@@ -7738,7 +7738,7 @@ static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, show_flags, store_flags);
7738static ssize_t show_filter_flags(struct device *d, 7738static ssize_t show_filter_flags(struct device *d,
7739 struct device_attribute *attr, char *buf) 7739 struct device_attribute *attr, char *buf)
7740{ 7740{
7741 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7741 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7742 7742
7743 return sprintf(buf, "0x%04X\n", 7743 return sprintf(buf, "0x%04X\n",
7744 le32_to_cpu(priv->active_rxon.filter_flags)); 7744 le32_to_cpu(priv->active_rxon.filter_flags));
@@ -7748,20 +7748,20 @@ static ssize_t store_filter_flags(struct device *d,
7748 struct device_attribute *attr, 7748 struct device_attribute *attr,
7749 const char *buf, size_t count) 7749 const char *buf, size_t count)
7750{ 7750{
7751 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7751 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7752 u32 filter_flags = simple_strtoul(buf, NULL, 0); 7752 u32 filter_flags = simple_strtoul(buf, NULL, 0);
7753 7753
7754 mutex_lock(&priv->mutex); 7754 mutex_lock(&priv->mutex);
7755 if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) { 7755 if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) {
7756 /* Cancel any currently running scans... */ 7756 /* Cancel any currently running scans... */
7757 if (iwl_scan_cancel_timeout(priv, 100)) 7757 if (iwl3945_scan_cancel_timeout(priv, 100))
7758 IWL_WARNING("Could not cancel scan.\n"); 7758 IWL_WARNING("Could not cancel scan.\n");
7759 else { 7759 else {
7760 IWL_DEBUG_INFO("Committing rxon.filter_flags = " 7760 IWL_DEBUG_INFO("Committing rxon.filter_flags = "
7761 "0x%04X\n", filter_flags); 7761 "0x%04X\n", filter_flags);
7762 priv->staging_rxon.filter_flags = 7762 priv->staging_rxon.filter_flags =
7763 cpu_to_le32(filter_flags); 7763 cpu_to_le32(filter_flags);
7764 iwl_commit_rxon(priv); 7764 iwl3945_commit_rxon(priv);
7765 } 7765 }
7766 } 7766 }
7767 mutex_unlock(&priv->mutex); 7767 mutex_unlock(&priv->mutex);
@@ -7775,20 +7775,20 @@ static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags,
7775static ssize_t show_tune(struct device *d, 7775static ssize_t show_tune(struct device *d,
7776 struct device_attribute *attr, char *buf) 7776 struct device_attribute *attr, char *buf)
7777{ 7777{
7778 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7778 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7779 7779
7780 return sprintf(buf, "0x%04X\n", 7780 return sprintf(buf, "0x%04X\n",
7781 (priv->phymode << 8) | 7781 (priv->phymode << 8) |
7782 le16_to_cpu(priv->active_rxon.channel)); 7782 le16_to_cpu(priv->active_rxon.channel));
7783} 7783}
7784 7784
7785static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode); 7785static void iwl3945_set_flags_for_phymode(struct iwl3945_priv *priv, u8 phymode);
7786 7786
7787static ssize_t store_tune(struct device *d, 7787static ssize_t store_tune(struct device *d,
7788 struct device_attribute *attr, 7788 struct device_attribute *attr,
7789 const char *buf, size_t count) 7789 const char *buf, size_t count)
7790{ 7790{
7791 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 7791 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
7792 char *p = (char *)buf; 7792 char *p = (char *)buf;
7793 u16 tune = simple_strtoul(p, &p, 0); 7793 u16 tune = simple_strtoul(p, &p, 0);
7794 u8 phymode = (tune >> 8) & 0xff; 7794 u8 phymode = (tune >> 8) & 0xff;
@@ -7799,9 +7799,9 @@ static ssize_t store_tune(struct device *d,
7799 mutex_lock(&priv->mutex); 7799 mutex_lock(&priv->mutex);
7800 if ((le16_to_cpu(priv->staging_rxon.channel) != channel) || 7800 if ((le16_to_cpu(priv->staging_rxon.channel) != channel) ||
7801 (priv->phymode != phymode)) { 7801 (priv->phymode != phymode)) {
7802 const struct iwl_channel_info *ch_info; 7802 const struct iwl3945_channel_info *ch_info;
7803 7803
7804 ch_info = iwl_get_channel_info(priv, phymode, channel); 7804 ch_info = iwl3945_get_channel_info(priv, phymode, channel);
7805 if (!ch_info) { 7805 if (!ch_info) {
7806 IWL_WARNING("Requested invalid phymode/channel " 7806 IWL_WARNING("Requested invalid phymode/channel "
7807 "combination: %d %d\n", phymode, channel); 7807 "combination: %d %d\n", phymode, channel);
@@ -7810,18 +7810,18 @@ static ssize_t store_tune(struct device *d,
7810 } 7810 }
7811 7811
7812 /* Cancel any currently running scans... */ 7812 /* Cancel any currently running scans... */
7813 if (iwl_scan_cancel_timeout(priv, 100)) 7813 if (iwl3945_scan_cancel_timeout(priv, 100))
7814 IWL_WARNING("Could not cancel scan.\n"); 7814 IWL_WARNING("Could not cancel scan.\n");
7815 else { 7815 else {
7816 IWL_DEBUG_INFO("Committing phymode and " 7816 IWL_DEBUG_INFO("Committing phymode and "
7817 "rxon.channel = %d %d\n", 7817 "rxon.channel = %d %d\n",
7818 phymode, channel); 7818 phymode, channel);
7819 7819
7820 iwl_set_rxon_channel(priv, phymode, channel); 7820 iwl3945_set_rxon_channel(priv, phymode, channel);
7821 iwl_set_flags_for_phymode(priv, phymode); 7821 iwl3945_set_flags_for_phymode(priv, phymode);
7822 7822
7823 iwl_set_rate(priv); 7823 iwl3945_set_rate(priv);
7824 iwl_commit_rxon(priv); 7824 iwl3945_commit_rxon(priv);
7825 } 7825 }
7826 } 7826 }
7827 mutex_unlock(&priv->mutex); 7827 mutex_unlock(&priv->mutex);
@@ -7836,8 +7836,8 @@ static DEVICE_ATTR(tune, S_IWUSR | S_IRUGO, show_tune, store_tune);
7836static ssize_t show_measurement(struct device *d, 7836static ssize_t show_measurement(struct device *d,
7837 struct device_attribute *attr, char *buf) 7837 struct device_attribute *attr, char *buf)
7838{ 7838{
7839 struct iwl_priv *priv = dev_get_drvdata(d); 7839 struct iwl3945_priv *priv = dev_get_drvdata(d);
7840 struct iwl_spectrum_notification measure_report; 7840 struct iwl3945_spectrum_notification measure_report;
7841 u32 size = sizeof(measure_report), len = 0, ofs = 0; 7841 u32 size = sizeof(measure_report), len = 0, ofs = 0;
7842 u8 *data = (u8 *) & measure_report; 7842 u8 *data = (u8 *) & measure_report;
7843 unsigned long flags; 7843 unsigned long flags;
@@ -7869,7 +7869,7 @@ static ssize_t store_measurement(struct device *d,
7869 struct device_attribute *attr, 7869 struct device_attribute *attr,
7870 const char *buf, size_t count) 7870 const char *buf, size_t count)
7871{ 7871{
7872 struct iwl_priv *priv = dev_get_drvdata(d); 7872 struct iwl3945_priv *priv = dev_get_drvdata(d);
7873 struct ieee80211_measurement_params params = { 7873 struct ieee80211_measurement_params params = {
7874 .channel = le16_to_cpu(priv->active_rxon.channel), 7874 .channel = le16_to_cpu(priv->active_rxon.channel),
7875 .start_time = cpu_to_le64(priv->last_tsf), 7875 .start_time = cpu_to_le64(priv->last_tsf),
@@ -7895,7 +7895,7 @@ static ssize_t store_measurement(struct device *d,
7895 7895
7896 IWL_DEBUG_INFO("Invoking measurement of type %d on " 7896 IWL_DEBUG_INFO("Invoking measurement of type %d on "
7897 "channel %d (for '%s')\n", type, params.channel, buf); 7897 "channel %d (for '%s')\n", type, params.channel, buf);
7898 iwl_get_measurement(priv, &params, type); 7898 iwl3945_get_measurement(priv, &params, type);
7899 7899
7900 return count; 7900 return count;
7901} 7901}
@@ -7907,7 +7907,7 @@ static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR,
7907static ssize_t show_rate(struct device *d, 7907static ssize_t show_rate(struct device *d,
7908 struct device_attribute *attr, char *buf) 7908 struct device_attribute *attr, char *buf)
7909{ 7909{
7910 struct iwl_priv *priv = dev_get_drvdata(d); 7910 struct iwl3945_priv *priv = dev_get_drvdata(d);
7911 unsigned long flags; 7911 unsigned long flags;
7912 int i; 7912 int i;
7913 7913
@@ -7918,13 +7918,13 @@ static ssize_t show_rate(struct device *d,
7918 i = priv->stations[IWL_STA_ID].current_rate.s.rate; 7918 i = priv->stations[IWL_STA_ID].current_rate.s.rate;
7919 spin_unlock_irqrestore(&priv->sta_lock, flags); 7919 spin_unlock_irqrestore(&priv->sta_lock, flags);
7920 7920
7921 i = iwl_rate_index_from_plcp(i); 7921 i = iwl3945_rate_index_from_plcp(i);
7922 if (i == -1) 7922 if (i == -1)
7923 return sprintf(buf, "0\n"); 7923 return sprintf(buf, "0\n");
7924 7924
7925 return sprintf(buf, "%d%s\n", 7925 return sprintf(buf, "%d%s\n",
7926 (iwl_rates[i].ieee >> 1), 7926 (iwl3945_rates[i].ieee >> 1),
7927 (iwl_rates[i].ieee & 0x1) ? ".5" : ""); 7927 (iwl3945_rates[i].ieee & 0x1) ? ".5" : "");
7928} 7928}
7929 7929
7930static DEVICE_ATTR(rate, S_IRUSR, show_rate, NULL); 7930static DEVICE_ATTR(rate, S_IRUSR, show_rate, NULL);
@@ -7933,7 +7933,7 @@ static ssize_t store_retry_rate(struct device *d,
7933 struct device_attribute *attr, 7933 struct device_attribute *attr,
7934 const char *buf, size_t count) 7934 const char *buf, size_t count)
7935{ 7935{
7936 struct iwl_priv *priv = dev_get_drvdata(d); 7936 struct iwl3945_priv *priv = dev_get_drvdata(d);
7937 7937
7938 priv->retry_rate = simple_strtoul(buf, NULL, 0); 7938 priv->retry_rate = simple_strtoul(buf, NULL, 0);
7939 if (priv->retry_rate <= 0) 7939 if (priv->retry_rate <= 0)
@@ -7945,7 +7945,7 @@ static ssize_t store_retry_rate(struct device *d,
7945static ssize_t show_retry_rate(struct device *d, 7945static ssize_t show_retry_rate(struct device *d,
7946 struct device_attribute *attr, char *buf) 7946 struct device_attribute *attr, char *buf)
7947{ 7947{
7948 struct iwl_priv *priv = dev_get_drvdata(d); 7948 struct iwl3945_priv *priv = dev_get_drvdata(d);
7949 return sprintf(buf, "%d", priv->retry_rate); 7949 return sprintf(buf, "%d", priv->retry_rate);
7950} 7950}
7951 7951
@@ -7956,14 +7956,14 @@ static ssize_t store_power_level(struct device *d,
7956 struct device_attribute *attr, 7956 struct device_attribute *attr,
7957 const char *buf, size_t count) 7957 const char *buf, size_t count)
7958{ 7958{
7959 struct iwl_priv *priv = dev_get_drvdata(d); 7959 struct iwl3945_priv *priv = dev_get_drvdata(d);
7960 int rc; 7960 int rc;
7961 int mode; 7961 int mode;
7962 7962
7963 mode = simple_strtoul(buf, NULL, 0); 7963 mode = simple_strtoul(buf, NULL, 0);
7964 mutex_lock(&priv->mutex); 7964 mutex_lock(&priv->mutex);
7965 7965
7966 if (!iwl_is_ready(priv)) { 7966 if (!iwl3945_is_ready(priv)) {
7967 rc = -EAGAIN; 7967 rc = -EAGAIN;
7968 goto out; 7968 goto out;
7969 } 7969 }
@@ -7974,7 +7974,7 @@ static ssize_t store_power_level(struct device *d,
7974 mode |= IWL_POWER_ENABLED; 7974 mode |= IWL_POWER_ENABLED;
7975 7975
7976 if (mode != priv->power_mode) { 7976 if (mode != priv->power_mode) {
7977 rc = iwl_send_power_mode(priv, IWL_POWER_LEVEL(mode)); 7977 rc = iwl3945_send_power_mode(priv, IWL_POWER_LEVEL(mode));
7978 if (rc) { 7978 if (rc) {
7979 IWL_DEBUG_MAC80211("failed setting power mode.\n"); 7979 IWL_DEBUG_MAC80211("failed setting power mode.\n");
7980 goto out; 7980 goto out;
@@ -8010,7 +8010,7 @@ static const s32 period_duration[] = {
8010static ssize_t show_power_level(struct device *d, 8010static ssize_t show_power_level(struct device *d,
8011 struct device_attribute *attr, char *buf) 8011 struct device_attribute *attr, char *buf)
8012{ 8012{
8013 struct iwl_priv *priv = dev_get_drvdata(d); 8013 struct iwl3945_priv *priv = dev_get_drvdata(d);
8014 int level = IWL_POWER_LEVEL(priv->power_mode); 8014 int level = IWL_POWER_LEVEL(priv->power_mode);
8015 char *p = buf; 8015 char *p = buf;
8016 8016
@@ -8045,18 +8045,18 @@ static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level,
8045static ssize_t show_channels(struct device *d, 8045static ssize_t show_channels(struct device *d,
8046 struct device_attribute *attr, char *buf) 8046 struct device_attribute *attr, char *buf)
8047{ 8047{
8048 struct iwl_priv *priv = dev_get_drvdata(d); 8048 struct iwl3945_priv *priv = dev_get_drvdata(d);
8049 int len = 0, i; 8049 int len = 0, i;
8050 struct ieee80211_channel *channels = NULL; 8050 struct ieee80211_channel *channels = NULL;
8051 const struct ieee80211_hw_mode *hw_mode = NULL; 8051 const struct ieee80211_hw_mode *hw_mode = NULL;
8052 int count = 0; 8052 int count = 0;
8053 8053
8054 if (!iwl_is_ready(priv)) 8054 if (!iwl3945_is_ready(priv))
8055 return -EAGAIN; 8055 return -EAGAIN;
8056 8056
8057 hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211G); 8057 hw_mode = iwl3945_get_hw_mode(priv, MODE_IEEE80211G);
8058 if (!hw_mode) 8058 if (!hw_mode)
8059 hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211B); 8059 hw_mode = iwl3945_get_hw_mode(priv, MODE_IEEE80211B);
8060 if (hw_mode) { 8060 if (hw_mode) {
8061 channels = hw_mode->channels; 8061 channels = hw_mode->channels;
8062 count = hw_mode->num_channels; 8062 count = hw_mode->num_channels;
@@ -8083,7 +8083,7 @@ static ssize_t show_channels(struct device *d,
8083 flag & IEEE80211_CHAN_W_ACTIVE_SCAN ? 8083 flag & IEEE80211_CHAN_W_ACTIVE_SCAN ?
8084 "active/passive" : "passive only"); 8084 "active/passive" : "passive only");
8085 8085
8086 hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211A); 8086 hw_mode = iwl3945_get_hw_mode(priv, MODE_IEEE80211A);
8087 if (hw_mode) { 8087 if (hw_mode) {
8088 channels = hw_mode->channels; 8088 channels = hw_mode->channels;
8089 count = hw_mode->num_channels; 8089 count = hw_mode->num_channels;
@@ -8119,17 +8119,17 @@ static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL);
8119static ssize_t show_statistics(struct device *d, 8119static ssize_t show_statistics(struct device *d,
8120 struct device_attribute *attr, char *buf) 8120 struct device_attribute *attr, char *buf)
8121{ 8121{
8122 struct iwl_priv *priv = dev_get_drvdata(d); 8122 struct iwl3945_priv *priv = dev_get_drvdata(d);
8123 u32 size = sizeof(struct iwl_notif_statistics); 8123 u32 size = sizeof(struct iwl3945_notif_statistics);
8124 u32 len = 0, ofs = 0; 8124 u32 len = 0, ofs = 0;
8125 u8 *data = (u8 *) & priv->statistics; 8125 u8 *data = (u8 *) & priv->statistics;
8126 int rc = 0; 8126 int rc = 0;
8127 8127
8128 if (!iwl_is_alive(priv)) 8128 if (!iwl3945_is_alive(priv))
8129 return -EAGAIN; 8129 return -EAGAIN;
8130 8130
8131 mutex_lock(&priv->mutex); 8131 mutex_lock(&priv->mutex);
8132 rc = iwl_send_statistics_request(priv); 8132 rc = iwl3945_send_statistics_request(priv);
8133 mutex_unlock(&priv->mutex); 8133 mutex_unlock(&priv->mutex);
8134 8134
8135 if (rc) { 8135 if (rc) {
@@ -8157,9 +8157,9 @@ static DEVICE_ATTR(statistics, S_IRUGO, show_statistics, NULL);
8157static ssize_t show_antenna(struct device *d, 8157static ssize_t show_antenna(struct device *d,
8158 struct device_attribute *attr, char *buf) 8158 struct device_attribute *attr, char *buf)
8159{ 8159{
8160 struct iwl_priv *priv = dev_get_drvdata(d); 8160 struct iwl3945_priv *priv = dev_get_drvdata(d);
8161 8161
8162 if (!iwl_is_alive(priv)) 8162 if (!iwl3945_is_alive(priv))
8163 return -EAGAIN; 8163 return -EAGAIN;
8164 8164
8165 return sprintf(buf, "%d\n", priv->antenna); 8165 return sprintf(buf, "%d\n", priv->antenna);
@@ -8170,7 +8170,7 @@ static ssize_t store_antenna(struct device *d,
8170 const char *buf, size_t count) 8170 const char *buf, size_t count)
8171{ 8171{
8172 int ant; 8172 int ant;
8173 struct iwl_priv *priv = dev_get_drvdata(d); 8173 struct iwl3945_priv *priv = dev_get_drvdata(d);
8174 8174
8175 if (count == 0) 8175 if (count == 0)
8176 return 0; 8176 return 0;
@@ -8182,7 +8182,7 @@ static ssize_t store_antenna(struct device *d,
8182 8182
8183 if ((ant >= 0) && (ant <= 2)) { 8183 if ((ant >= 0) && (ant <= 2)) {
8184 IWL_DEBUG_INFO("Setting antenna select to %d.\n", ant); 8184 IWL_DEBUG_INFO("Setting antenna select to %d.\n", ant);
8185 priv->antenna = (enum iwl_antenna)ant; 8185 priv->antenna = (enum iwl3945_antenna)ant;
8186 } else 8186 } else
8187 IWL_DEBUG_INFO("Bad antenna select value %d.\n", ant); 8187 IWL_DEBUG_INFO("Bad antenna select value %d.\n", ant);
8188 8188
@@ -8195,8 +8195,8 @@ static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, show_antenna, store_antenna);
8195static ssize_t show_status(struct device *d, 8195static ssize_t show_status(struct device *d,
8196 struct device_attribute *attr, char *buf) 8196 struct device_attribute *attr, char *buf)
8197{ 8197{
8198 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 8198 struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
8199 if (!iwl_is_alive(priv)) 8199 if (!iwl3945_is_alive(priv))
8200 return -EAGAIN; 8200 return -EAGAIN;
8201 return sprintf(buf, "0x%08x\n", (int)priv->status); 8201 return sprintf(buf, "0x%08x\n", (int)priv->status);
8202} 8202}
@@ -8210,7 +8210,7 @@ static ssize_t dump_error_log(struct device *d,
8210 char *p = (char *)buf; 8210 char *p = (char *)buf;
8211 8211
8212 if (p[0] == '1') 8212 if (p[0] == '1')
8213 iwl_dump_nic_error_log((struct iwl_priv *)d->driver_data); 8213 iwl3945_dump_nic_error_log((struct iwl3945_priv *)d->driver_data);
8214 8214
8215 return strnlen(buf, count); 8215 return strnlen(buf, count);
8216} 8216}
@@ -8224,7 +8224,7 @@ static ssize_t dump_event_log(struct device *d,
8224 char *p = (char *)buf; 8224 char *p = (char *)buf;
8225 8225
8226 if (p[0] == '1') 8226 if (p[0] == '1')
8227 iwl_dump_nic_event_log((struct iwl_priv *)d->driver_data); 8227 iwl3945_dump_nic_event_log((struct iwl3945_priv *)d->driver_data);
8228 8228
8229 return strnlen(buf, count); 8229 return strnlen(buf, count);
8230} 8230}
@@ -8237,34 +8237,34 @@ static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log);
8237 * 8237 *
8238 *****************************************************************************/ 8238 *****************************************************************************/
8239 8239
8240static void iwl_setup_deferred_work(struct iwl_priv *priv) 8240static void iwl3945_setup_deferred_work(struct iwl3945_priv *priv)
8241{ 8241{
8242 priv->workqueue = create_workqueue(DRV_NAME); 8242 priv->workqueue = create_workqueue(DRV_NAME);
8243 8243
8244 init_waitqueue_head(&priv->wait_command_queue); 8244 init_waitqueue_head(&priv->wait_command_queue);
8245 8245
8246 INIT_WORK(&priv->up, iwl_bg_up); 8246 INIT_WORK(&priv->up, iwl3945_bg_up);
8247 INIT_WORK(&priv->restart, iwl_bg_restart); 8247 INIT_WORK(&priv->restart, iwl3945_bg_restart);
8248 INIT_WORK(&priv->rx_replenish, iwl_bg_rx_replenish); 8248 INIT_WORK(&priv->rx_replenish, iwl3945_bg_rx_replenish);
8249 INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); 8249 INIT_WORK(&priv->scan_completed, iwl3945_bg_scan_completed);
8250 INIT_WORK(&priv->request_scan, iwl_bg_request_scan); 8250 INIT_WORK(&priv->request_scan, iwl3945_bg_request_scan);
8251 INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); 8251 INIT_WORK(&priv->abort_scan, iwl3945_bg_abort_scan);
8252 INIT_WORK(&priv->rf_kill, iwl_bg_rf_kill); 8252 INIT_WORK(&priv->rf_kill, iwl3945_bg_rf_kill);
8253 INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update); 8253 INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update);
8254 INIT_DELAYED_WORK(&priv->post_associate, iwl_bg_post_associate); 8254 INIT_DELAYED_WORK(&priv->post_associate, iwl3945_bg_post_associate);
8255 INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); 8255 INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start);
8256 INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); 8256 INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start);
8257 INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); 8257 INIT_DELAYED_WORK(&priv->scan_check, iwl3945_bg_scan_check);
8258 8258
8259 iwl_hw_setup_deferred_work(priv); 8259 iwl3945_hw_setup_deferred_work(priv);
8260 8260
8261 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) 8261 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))
8262 iwl_irq_tasklet, (unsigned long)priv); 8262 iwl3945_irq_tasklet, (unsigned long)priv);
8263} 8263}
8264 8264
8265static void iwl_cancel_deferred_work(struct iwl_priv *priv) 8265static void iwl3945_cancel_deferred_work(struct iwl3945_priv *priv)
8266{ 8266{
8267 iwl_hw_cancel_deferred_work(priv); 8267 iwl3945_hw_cancel_deferred_work(priv);
8268 8268
8269 cancel_delayed_work_sync(&priv->init_alive_start); 8269 cancel_delayed_work_sync(&priv->init_alive_start);
8270 cancel_delayed_work(&priv->scan_check); 8270 cancel_delayed_work(&priv->scan_check);
@@ -8273,7 +8273,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
8273 cancel_work_sync(&priv->beacon_update); 8273 cancel_work_sync(&priv->beacon_update);
8274} 8274}
8275 8275
8276static struct attribute *iwl_sysfs_entries[] = { 8276static struct attribute *iwl3945_sysfs_entries[] = {
8277 &dev_attr_antenna.attr, 8277 &dev_attr_antenna.attr,
8278 &dev_attr_channels.attr, 8278 &dev_attr_channels.attr,
8279 &dev_attr_dump_errors.attr, 8279 &dev_attr_dump_errors.attr,
@@ -8297,45 +8297,45 @@ static struct attribute *iwl_sysfs_entries[] = {
8297 NULL 8297 NULL
8298}; 8298};
8299 8299
8300static struct attribute_group iwl_attribute_group = { 8300static struct attribute_group iwl3945_attribute_group = {
8301 .name = NULL, /* put in device directory */ 8301 .name = NULL, /* put in device directory */
8302 .attrs = iwl_sysfs_entries, 8302 .attrs = iwl3945_sysfs_entries,
8303}; 8303};
8304 8304
8305static struct ieee80211_ops iwl_hw_ops = { 8305static struct ieee80211_ops iwl3945_hw_ops = {
8306 .tx = iwl_mac_tx, 8306 .tx = iwl3945_mac_tx,
8307 .start = iwl_mac_start, 8307 .start = iwl3945_mac_start,
8308 .stop = iwl_mac_stop, 8308 .stop = iwl3945_mac_stop,
8309 .add_interface = iwl_mac_add_interface, 8309 .add_interface = iwl3945_mac_add_interface,
8310 .remove_interface = iwl_mac_remove_interface, 8310 .remove_interface = iwl3945_mac_remove_interface,
8311 .config = iwl_mac_config, 8311 .config = iwl3945_mac_config,
8312 .config_interface = iwl_mac_config_interface, 8312 .config_interface = iwl3945_mac_config_interface,
8313 .configure_filter = iwl_configure_filter, 8313 .configure_filter = iwl3945_configure_filter,
8314 .set_key = iwl_mac_set_key, 8314 .set_key = iwl3945_mac_set_key,
8315 .get_stats = iwl_mac_get_stats, 8315 .get_stats = iwl3945_mac_get_stats,
8316 .get_tx_stats = iwl_mac_get_tx_stats, 8316 .get_tx_stats = iwl3945_mac_get_tx_stats,
8317 .conf_tx = iwl_mac_conf_tx, 8317 .conf_tx = iwl3945_mac_conf_tx,
8318 .get_tsf = iwl_mac_get_tsf, 8318 .get_tsf = iwl3945_mac_get_tsf,
8319 .reset_tsf = iwl_mac_reset_tsf, 8319 .reset_tsf = iwl3945_mac_reset_tsf,
8320 .beacon_update = iwl_mac_beacon_update, 8320 .beacon_update = iwl3945_mac_beacon_update,
8321 .hw_scan = iwl_mac_hw_scan 8321 .hw_scan = iwl3945_mac_hw_scan
8322}; 8322};
8323 8323
8324static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 8324static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8325{ 8325{
8326 int err = 0; 8326 int err = 0;
8327 u32 pci_id; 8327 u32 pci_id;
8328 struct iwl_priv *priv; 8328 struct iwl3945_priv *priv;
8329 struct ieee80211_hw *hw; 8329 struct ieee80211_hw *hw;
8330 int i; 8330 int i;
8331 8331
8332 if (iwl_param_disable_hw_scan) { 8332 if (iwl3945_param_disable_hw_scan) {
8333 IWL_DEBUG_INFO("Disabling hw_scan\n"); 8333 IWL_DEBUG_INFO("Disabling hw_scan\n");
8334 iwl_hw_ops.hw_scan = NULL; 8334 iwl3945_hw_ops.hw_scan = NULL;
8335 } 8335 }
8336 8336
8337 if ((iwl_param_queues_num > IWL_MAX_NUM_QUEUES) || 8337 if ((iwl3945_param_queues_num > IWL_MAX_NUM_QUEUES) ||
8338 (iwl_param_queues_num < IWL_MIN_NUM_QUEUES)) { 8338 (iwl3945_param_queues_num < IWL_MIN_NUM_QUEUES)) {
8339 IWL_ERROR("invalid queues_num, should be between %d and %d\n", 8339 IWL_ERROR("invalid queues_num, should be between %d and %d\n",
8340 IWL_MIN_NUM_QUEUES, IWL_MAX_NUM_QUEUES); 8340 IWL_MIN_NUM_QUEUES, IWL_MAX_NUM_QUEUES);
8341 err = -EINVAL; 8341 err = -EINVAL;
@@ -8344,7 +8344,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8344 8344
8345 /* mac80211 allocates memory for this device instance, including 8345 /* mac80211 allocates memory for this device instance, including
8346 * space for this driver's private structure */ 8346 * space for this driver's private structure */
8347 hw = ieee80211_alloc_hw(sizeof(struct iwl_priv), &iwl_hw_ops); 8347 hw = ieee80211_alloc_hw(sizeof(struct iwl3945_priv), &iwl3945_hw_ops);
8348 if (hw == NULL) { 8348 if (hw == NULL) {
8349 IWL_ERROR("Can not allocate network device\n"); 8349 IWL_ERROR("Can not allocate network device\n");
8350 err = -ENOMEM; 8350 err = -ENOMEM;
@@ -8359,9 +8359,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8359 priv->hw = hw; 8359 priv->hw = hw;
8360 8360
8361 priv->pci_dev = pdev; 8361 priv->pci_dev = pdev;
8362 priv->antenna = (enum iwl_antenna)iwl_param_antenna; 8362 priv->antenna = (enum iwl3945_antenna)iwl3945_param_antenna;
8363#ifdef CONFIG_IWL3945_DEBUG 8363#ifdef CONFIG_IWL3945_DEBUG
8364 iwl_debug_level = iwl_param_debug; 8364 iwl3945_debug_level = iwl3945_param_debug;
8365 atomic_set(&priv->restrict_refcnt, 0); 8365 atomic_set(&priv->restrict_refcnt, 0);
8366#endif 8366#endif
8367 priv->retry_rate = 1; 8367 priv->retry_rate = 1;
@@ -8400,7 +8400,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8400 8400
8401 pci_set_master(pdev); 8401 pci_set_master(pdev);
8402 8402
8403 iwl_clear_stations_table(priv); 8403 iwl3945_clear_stations_table(priv);
8404 8404
8405 priv->data_retry_limit = -1; 8405 priv->data_retry_limit = -1;
8406 priv->ieee_channels = NULL; 8406 priv->ieee_channels = NULL;
@@ -8434,7 +8434,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8434 8434
8435 /* Initialize module parameter values here */ 8435 /* Initialize module parameter values here */
8436 8436
8437 if (iwl_param_disable) { 8437 if (iwl3945_param_disable) {
8438 set_bit(STATUS_RF_KILL_SW, &priv->status); 8438 set_bit(STATUS_RF_KILL_SW, &priv->status);
8439 IWL_DEBUG_INFO("Radio disabled.\n"); 8439 IWL_DEBUG_INFO("Radio disabled.\n");
8440 } 8440 }
@@ -8469,36 +8469,36 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8469 priv->is_abg ? "A" : ""); 8469 priv->is_abg ? "A" : "");
8470 8470
8471 /* Device-specific setup */ 8471 /* Device-specific setup */
8472 if (iwl_hw_set_hw_setting(priv)) { 8472 if (iwl3945_hw_set_hw_setting(priv)) {
8473 IWL_ERROR("failed to set hw settings\n"); 8473 IWL_ERROR("failed to set hw settings\n");
8474 mutex_unlock(&priv->mutex); 8474 mutex_unlock(&priv->mutex);
8475 goto out_iounmap; 8475 goto out_iounmap;
8476 } 8476 }
8477 8477
8478#ifdef CONFIG_IWL3945_QOS 8478#ifdef CONFIG_IWL3945_QOS
8479 if (iwl_param_qos_enable) 8479 if (iwl3945_param_qos_enable)
8480 priv->qos_data.qos_enable = 1; 8480 priv->qos_data.qos_enable = 1;
8481 8481
8482 iwl_reset_qos(priv); 8482 iwl3945_reset_qos(priv);
8483 8483
8484 priv->qos_data.qos_active = 0; 8484 priv->qos_data.qos_active = 0;
8485 priv->qos_data.qos_cap.val = 0; 8485 priv->qos_data.qos_cap.val = 0;
8486#endif /* CONFIG_IWL3945_QOS */ 8486#endif /* CONFIG_IWL3945_QOS */
8487 8487
8488 iwl_set_rxon_channel(priv, MODE_IEEE80211G, 6); 8488 iwl3945_set_rxon_channel(priv, MODE_IEEE80211G, 6);
8489 iwl_setup_deferred_work(priv); 8489 iwl3945_setup_deferred_work(priv);
8490 iwl_setup_rx_handlers(priv); 8490 iwl3945_setup_rx_handlers(priv);
8491 8491
8492 priv->rates_mask = IWL_RATES_MASK; 8492 priv->rates_mask = IWL_RATES_MASK;
8493 /* If power management is turned on, default to AC mode */ 8493 /* If power management is turned on, default to AC mode */
8494 priv->power_mode = IWL_POWER_AC; 8494 priv->power_mode = IWL_POWER_AC;
8495 priv->user_txpower_limit = IWL_DEFAULT_TX_POWER; 8495 priv->user_txpower_limit = IWL_DEFAULT_TX_POWER;
8496 8496
8497 iwl_disable_interrupts(priv); 8497 iwl3945_disable_interrupts(priv);
8498 8498
8499 pci_enable_msi(pdev); 8499 pci_enable_msi(pdev);
8500 8500
8501 err = request_irq(pdev->irq, iwl_isr, IRQF_SHARED, DRV_NAME, priv); 8501 err = request_irq(pdev->irq, iwl3945_isr, IRQF_SHARED, DRV_NAME, priv);
8502 if (err) { 8502 if (err) {
8503 IWL_ERROR("Error allocating IRQ %d\n", pdev->irq); 8503 IWL_ERROR("Error allocating IRQ %d\n", pdev->irq);
8504 goto out_disable_msi; 8504 goto out_disable_msi;
@@ -8506,7 +8506,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8506 8506
8507 mutex_lock(&priv->mutex); 8507 mutex_lock(&priv->mutex);
8508 8508
8509 err = sysfs_create_group(&pdev->dev.kobj, &iwl_attribute_group); 8509 err = sysfs_create_group(&pdev->dev.kobj, &iwl3945_attribute_group);
8510 if (err) { 8510 if (err) {
8511 IWL_ERROR("failed to create sysfs device attributes\n"); 8511 IWL_ERROR("failed to create sysfs device attributes\n");
8512 mutex_unlock(&priv->mutex); 8512 mutex_unlock(&priv->mutex);
@@ -8515,7 +8515,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8515 8515
8516 /* fetch ucode file from disk, alloc and copy to bus-master buffers ... 8516 /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
8517 * ucode filename and max sizes are card-specific. */ 8517 * ucode filename and max sizes are card-specific. */
8518 err = iwl_read_ucode(priv); 8518 err = iwl3945_read_ucode(priv);
8519 if (err) { 8519 if (err) {
8520 IWL_ERROR("Could not read microcode: %d\n", err); 8520 IWL_ERROR("Could not read microcode: %d\n", err);
8521 mutex_unlock(&priv->mutex); 8521 mutex_unlock(&priv->mutex);
@@ -8531,9 +8531,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8531 return 0; 8531 return 0;
8532 8532
8533 out_pci_alloc: 8533 out_pci_alloc:
8534 iwl_dealloc_ucode_pci(priv); 8534 iwl3945_dealloc_ucode_pci(priv);
8535 8535
8536 sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); 8536 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
8537 8537
8538 out_release_irq: 8538 out_release_irq:
8539 free_irq(pdev->irq, priv); 8539 free_irq(pdev->irq, priv);
@@ -8542,7 +8542,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8542 pci_disable_msi(pdev); 8542 pci_disable_msi(pdev);
8543 destroy_workqueue(priv->workqueue); 8543 destroy_workqueue(priv->workqueue);
8544 priv->workqueue = NULL; 8544 priv->workqueue = NULL;
8545 iwl_unset_hw_setting(priv); 8545 iwl3945_unset_hw_setting(priv);
8546 8546
8547 out_iounmap: 8547 out_iounmap:
8548 pci_iounmap(pdev, priv->hw_base); 8548 pci_iounmap(pdev, priv->hw_base);
@@ -8557,9 +8557,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8557 return err; 8557 return err;
8558} 8558}
8559 8559
8560static void iwl_pci_remove(struct pci_dev *pdev) 8560static void iwl3945_pci_remove(struct pci_dev *pdev)
8561{ 8561{
8562 struct iwl_priv *priv = pci_get_drvdata(pdev); 8562 struct iwl3945_priv *priv = pci_get_drvdata(pdev);
8563 struct list_head *p, *q; 8563 struct list_head *p, *q;
8564 int i; 8564 int i;
8565 8565
@@ -8570,36 +8570,36 @@ static void iwl_pci_remove(struct pci_dev *pdev)
8570 8570
8571 set_bit(STATUS_EXIT_PENDING, &priv->status); 8571 set_bit(STATUS_EXIT_PENDING, &priv->status);
8572 8572
8573 iwl_down(priv); 8573 iwl3945_down(priv);
8574 8574
8575 /* Free MAC hash list for ADHOC */ 8575 /* Free MAC hash list for ADHOC */
8576 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { 8576 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
8577 list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) { 8577 list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) {
8578 list_del(p); 8578 list_del(p);
8579 kfree(list_entry(p, struct iwl_ibss_seq, list)); 8579 kfree(list_entry(p, struct iwl3945_ibss_seq, list));
8580 } 8580 }
8581 } 8581 }
8582 8582
8583 sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); 8583 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
8584 8584
8585 iwl_dealloc_ucode_pci(priv); 8585 iwl3945_dealloc_ucode_pci(priv);
8586 8586
8587 if (priv->rxq.bd) 8587 if (priv->rxq.bd)
8588 iwl_rx_queue_free(priv, &priv->rxq); 8588 iwl3945_rx_queue_free(priv, &priv->rxq);
8589 iwl_hw_txq_ctx_free(priv); 8589 iwl3945_hw_txq_ctx_free(priv);
8590 8590
8591 iwl_unset_hw_setting(priv); 8591 iwl3945_unset_hw_setting(priv);
8592 iwl_clear_stations_table(priv); 8592 iwl3945_clear_stations_table(priv);
8593 8593
8594 if (priv->mac80211_registered) { 8594 if (priv->mac80211_registered) {
8595 ieee80211_unregister_hw(priv->hw); 8595 ieee80211_unregister_hw(priv->hw);
8596 iwl_rate_control_unregister(priv->hw); 8596 iwl3945_rate_control_unregister(priv->hw);
8597 } 8597 }
8598 8598
8599 /*netif_stop_queue(dev); */ 8599 /*netif_stop_queue(dev); */
8600 flush_workqueue(priv->workqueue); 8600 flush_workqueue(priv->workqueue);
8601 8601
8602 /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes 8602 /* ieee80211_unregister_hw calls iwl3945_mac_stop, which flushes
8603 * priv->workqueue... so we can't take down the workqueue 8603 * priv->workqueue... so we can't take down the workqueue
8604 * until now... */ 8604 * until now... */
8605 destroy_workqueue(priv->workqueue); 8605 destroy_workqueue(priv->workqueue);
@@ -8625,14 +8625,14 @@ static void iwl_pci_remove(struct pci_dev *pdev)
8625 8625
8626#ifdef CONFIG_PM 8626#ifdef CONFIG_PM
8627 8627
8628static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) 8628static int iwl3945_pci_suspend(struct pci_dev *pdev, pm_message_t state)
8629{ 8629{
8630 struct iwl_priv *priv = pci_get_drvdata(pdev); 8630 struct iwl3945_priv *priv = pci_get_drvdata(pdev);
8631 8631
8632 set_bit(STATUS_IN_SUSPEND, &priv->status); 8632 set_bit(STATUS_IN_SUSPEND, &priv->status);
8633 8633
8634 /* Take down the device; powers it off, etc. */ 8634 /* Take down the device; powers it off, etc. */
8635 iwl_down(priv); 8635 iwl3945_down(priv);
8636 8636
8637 if (priv->mac80211_registered) 8637 if (priv->mac80211_registered)
8638 ieee80211_stop_queues(priv->hw); 8638 ieee80211_stop_queues(priv->hw);
@@ -8644,7 +8644,7 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
8644 return 0; 8644 return 0;
8645} 8645}
8646 8646
8647static void iwl_resume(struct iwl_priv *priv) 8647static void iwl3945_resume(struct iwl3945_priv *priv)
8648{ 8648{
8649 unsigned long flags; 8649 unsigned long flags;
8650 8650
@@ -8653,47 +8653,47 @@ static void iwl_resume(struct iwl_priv *priv)
8653 * Without all of the following, resume will not attempt to take 8653 * Without all of the following, resume will not attempt to take
8654 * down the NIC (it shouldn't really need to) and will just try 8654 * down the NIC (it shouldn't really need to) and will just try
8655 * and bring the NIC back up. However that fails during the 8655 * and bring the NIC back up. However that fails during the
8656 * ucode verification process. This then causes iwl_down to be 8656 * ucode verification process. This then causes iwl3945_down to be
8657 * called *after* iwl_hw_nic_init() has succeeded -- which 8657 * called *after* iwl3945_hw_nic_init() has succeeded -- which
8658 * then lets the next init sequence succeed. So, we've 8658 * then lets the next init sequence succeed. So, we've
8659 * replicated all of that NIC init code here... */ 8659 * replicated all of that NIC init code here... */
8660 8660
8661 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 8661 iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF);
8662 8662
8663 iwl_hw_nic_init(priv); 8663 iwl3945_hw_nic_init(priv);
8664 8664
8665 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 8665 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
8666 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, 8666 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR,
8667 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 8667 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
8668 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 8668 iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF);
8669 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 8669 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
8670 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 8670 iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
8671 8671
8672 /* tell the device to stop sending interrupts */ 8672 /* tell the device to stop sending interrupts */
8673 iwl_disable_interrupts(priv); 8673 iwl3945_disable_interrupts(priv);
8674 8674
8675 spin_lock_irqsave(&priv->lock, flags); 8675 spin_lock_irqsave(&priv->lock, flags);
8676 iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 8676 iwl3945_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
8677 8677
8678 if (!iwl_grab_nic_access(priv)) { 8678 if (!iwl3945_grab_nic_access(priv)) {
8679 iwl_write_prph(priv, APMG_CLK_DIS_REG, 8679 iwl3945_write_prph(priv, APMG_CLK_DIS_REG,
8680 APMG_CLK_VAL_DMA_CLK_RQT); 8680 APMG_CLK_VAL_DMA_CLK_RQT);
8681 iwl_release_nic_access(priv); 8681 iwl3945_release_nic_access(priv);
8682 } 8682 }
8683 spin_unlock_irqrestore(&priv->lock, flags); 8683 spin_unlock_irqrestore(&priv->lock, flags);
8684 8684
8685 udelay(5); 8685 udelay(5);
8686 8686
8687 iwl_hw_nic_reset(priv); 8687 iwl3945_hw_nic_reset(priv);
8688 8688
8689 /* Bring the device back up */ 8689 /* Bring the device back up */
8690 clear_bit(STATUS_IN_SUSPEND, &priv->status); 8690 clear_bit(STATUS_IN_SUSPEND, &priv->status);
8691 queue_work(priv->workqueue, &priv->up); 8691 queue_work(priv->workqueue, &priv->up);
8692} 8692}
8693 8693
8694static int iwl_pci_resume(struct pci_dev *pdev) 8694static int iwl3945_pci_resume(struct pci_dev *pdev)
8695{ 8695{
8696 struct iwl_priv *priv = pci_get_drvdata(pdev); 8696 struct iwl3945_priv *priv = pci_get_drvdata(pdev);
8697 int err; 8697 int err;
8698 8698
8699 printk(KERN_INFO "Coming out of suspend...\n"); 8699 printk(KERN_INFO "Coming out of suspend...\n");
@@ -8710,7 +8710,7 @@ static int iwl_pci_resume(struct pci_dev *pdev)
8710 */ 8710 */
8711 pci_write_config_byte(pdev, 0x41, 0x00); 8711 pci_write_config_byte(pdev, 0x41, 0x00);
8712 8712
8713 iwl_resume(priv); 8713 iwl3945_resume(priv);
8714 8714
8715 return 0; 8715 return 0;
8716} 8716}
@@ -8723,33 +8723,33 @@ static int iwl_pci_resume(struct pci_dev *pdev)
8723 * 8723 *
8724 *****************************************************************************/ 8724 *****************************************************************************/
8725 8725
8726static struct pci_driver iwl_driver = { 8726static struct pci_driver iwl3945_driver = {
8727 .name = DRV_NAME, 8727 .name = DRV_NAME,
8728 .id_table = iwl_hw_card_ids, 8728 .id_table = iwl3945_hw_card_ids,
8729 .probe = iwl_pci_probe, 8729 .probe = iwl3945_pci_probe,
8730 .remove = __devexit_p(iwl_pci_remove), 8730 .remove = __devexit_p(iwl3945_pci_remove),
8731#ifdef CONFIG_PM 8731#ifdef CONFIG_PM
8732 .suspend = iwl_pci_suspend, 8732 .suspend = iwl3945_pci_suspend,
8733 .resume = iwl_pci_resume, 8733 .resume = iwl3945_pci_resume,
8734#endif 8734#endif
8735}; 8735};
8736 8736
8737static int __init iwl_init(void) 8737static int __init iwl3945_init(void)
8738{ 8738{
8739 8739
8740 int ret; 8740 int ret;
8741 printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); 8741 printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n");
8742 printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); 8742 printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n");
8743 ret = pci_register_driver(&iwl_driver); 8743 ret = pci_register_driver(&iwl3945_driver);
8744 if (ret) { 8744 if (ret) {
8745 IWL_ERROR("Unable to initialize PCI module\n"); 8745 IWL_ERROR("Unable to initialize PCI module\n");
8746 return ret; 8746 return ret;
8747 } 8747 }
8748#ifdef CONFIG_IWL3945_DEBUG 8748#ifdef CONFIG_IWL3945_DEBUG
8749 ret = driver_create_file(&iwl_driver.driver, &driver_attr_debug_level); 8749 ret = driver_create_file(&iwl3945_driver.driver, &driver_attr_debug_level);
8750 if (ret) { 8750 if (ret) {
8751 IWL_ERROR("Unable to create driver sysfs file\n"); 8751 IWL_ERROR("Unable to create driver sysfs file\n");
8752 pci_unregister_driver(&iwl_driver); 8752 pci_unregister_driver(&iwl3945_driver);
8753 return ret; 8753 return ret;
8754 } 8754 }
8755#endif 8755#endif
@@ -8757,32 +8757,32 @@ static int __init iwl_init(void)
8757 return ret; 8757 return ret;
8758} 8758}
8759 8759
8760static void __exit iwl_exit(void) 8760static void __exit iwl3945_exit(void)
8761{ 8761{
8762#ifdef CONFIG_IWL3945_DEBUG 8762#ifdef CONFIG_IWL3945_DEBUG
8763 driver_remove_file(&iwl_driver.driver, &driver_attr_debug_level); 8763 driver_remove_file(&iwl3945_driver.driver, &driver_attr_debug_level);
8764#endif 8764#endif
8765 pci_unregister_driver(&iwl_driver); 8765 pci_unregister_driver(&iwl3945_driver);
8766} 8766}
8767 8767
8768module_param_named(antenna, iwl_param_antenna, int, 0444); 8768module_param_named(antenna, iwl3945_param_antenna, int, 0444);
8769MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); 8769MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])");
8770module_param_named(disable, iwl_param_disable, int, 0444); 8770module_param_named(disable, iwl3945_param_disable, int, 0444);
8771MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])"); 8771MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])");
8772module_param_named(hwcrypto, iwl_param_hwcrypto, int, 0444); 8772module_param_named(hwcrypto, iwl3945_param_hwcrypto, int, 0444);
8773MODULE_PARM_DESC(hwcrypto, 8773MODULE_PARM_DESC(hwcrypto,
8774 "using hardware crypto engine (default 0 [software])\n"); 8774 "using hardware crypto engine (default 0 [software])\n");
8775module_param_named(debug, iwl_param_debug, int, 0444); 8775module_param_named(debug, iwl3945_param_debug, int, 0444);
8776MODULE_PARM_DESC(debug, "debug output mask"); 8776MODULE_PARM_DESC(debug, "debug output mask");
8777module_param_named(disable_hw_scan, iwl_param_disable_hw_scan, int, 0444); 8777module_param_named(disable_hw_scan, iwl3945_param_disable_hw_scan, int, 0444);
8778MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); 8778MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)");
8779 8779
8780module_param_named(queues_num, iwl_param_queues_num, int, 0444); 8780module_param_named(queues_num, iwl3945_param_queues_num, int, 0444);
8781MODULE_PARM_DESC(queues_num, "number of hw queues."); 8781MODULE_PARM_DESC(queues_num, "number of hw queues.");
8782 8782
8783/* QoS */ 8783/* QoS */
8784module_param_named(qos_enable, iwl_param_qos_enable, int, 0444); 8784module_param_named(qos_enable, iwl3945_param_qos_enable, int, 0444);
8785MODULE_PARM_DESC(qos_enable, "enable all QoS functionality"); 8785MODULE_PARM_DESC(qos_enable, "enable all QoS functionality");
8786 8786
8787module_exit(iwl_exit); 8787module_exit(iwl3945_exit);
8788module_init(iwl_init); 8788module_init(iwl3945_init);
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);