Commit bb8c093b authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David S. Miller

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: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarZhu Yi <yi.zhu@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 403ab56b
config IWL4965
tristate "Intel Wireless WiFi 4965AGN"
depends on m && PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
select FW_LOADER
default m
---help---
Select to build the driver supporting the:
......@@ -30,7 +29,6 @@ config IWL4965
config IWL4965_QOS
bool "Enable Wireless QoS in iwl4965 driver"
depends on IWL4965
default y
---help---
This option will enable wireless quality of service (QoS) for the
iw4965 driver.
......@@ -38,14 +36,12 @@ config IWL4965_QOS
config IWL4965_SPECTRUM_MEASUREMENT
bool "Enable Spectrum Measurement in iw4965 driver"
depends on IWL4965
default y
---help---
This option will enable spectrum measurement for the iwl4965 driver.
config IWL4965_SENSITIVITY
bool "Enable Sensitivity Calibration in iwl4965 driver"
depends on IWL4965
default y
---help---
This option will enable sensitivity calibration for the iwl4965
driver.
......@@ -54,7 +50,6 @@ config IWL4965_HT
bool "Enable 802.11n HT features in iwl4965 driver"
depends on EXPERIMENTAL
depends on IWL4965 && MAC80211_HT
default n
---help---
This option enables IEEE 802.11n High Throughput features
for the iwl4965 driver.
......@@ -62,7 +57,6 @@ config IWL4965_HT
config IWL4965_DEBUG
bool "Enable full debugging output in iwl4965 driver"
depends on IWL4965
default y
---help---
This option will enable debug tracing output for the iwl4965
driver.
......@@ -88,9 +82,8 @@ config IWL4965_DEBUG
config IWL3945
tristate "Intel PRO/Wireless 3945ABG/BG Network Connection"
depends on m && PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
select FW_LOADER
default m
---help---
Select to build the driver supporting the:
......@@ -118,7 +111,6 @@ config IWL3945
config IWL3945_QOS
bool "Enable Wireless QoS in iwl3945 driver"
depends on IWL3945
default y
---help---
This option will enable wireless quality of service (QoS) for the
iwl3945 driver.
......@@ -126,14 +118,12 @@ config IWL3945_QOS
config IWL3945_SPECTRUM_MEASUREMENT
bool "Enable Spectrum Measurement in iwl3945 drivers"
depends on IWL3945
default y
---help---
This option will enable spectrum measurement for the iwl3945 driver.
config IWL3945_DEBUG
bool "Enable full debugging output in iwl3945 driver"
depends on IWL3945
default y
---help---
This option will enable debug tracing output for the iwl3945
driver.
......
......@@ -141,7 +141,7 @@ enum {
#define IWL_CMD_FAILED_MSK 0x40
struct iwl_cmd_header {
struct iwl3945_cmd_header {
u8 cmd;
u8 flags;
/* We have 15 LSB to use as we please (MSB indicates
......@@ -173,7 +173,7 @@ struct iwl_cmd_header {
/*
* REPLY_ALIVE = 0x1 (response only, not a command)
*/
struct iwl_alive_resp {
struct iwl3945_alive_resp {
u8 ucode_minor;
u8 ucode_major;
__le16 reserved1;
......@@ -187,7 +187,7 @@ struct iwl_alive_resp {
__le32 is_valid;
} __attribute__ ((packed));
struct iwl_init_alive_resp {
struct iwl3945_init_alive_resp {
u8 ucode_minor;
u8 ucode_major;
__le16 reserved1;
......@@ -210,7 +210,7 @@ union tsf {
/*
* REPLY_ERROR = 0x2 (response only, not a command)
*/
struct iwl_error_resp {
struct iwl3945_error_resp {
__le32 error_type;
u8 cmd_id;
u8 reserved1;
......@@ -279,7 +279,7 @@ enum {
/*
* REPLY_RXON = 0x10 (command, has simple generic response)
*/
struct iwl_rxon_cmd {
struct iwl3945_rxon_cmd {
u8 node_addr[6];
__le16 reserved1;
u8 bssid_addr[6];
......@@ -301,7 +301,7 @@ struct iwl_rxon_cmd {
/*
* REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
*/
struct iwl_rxon_assoc_cmd {
struct iwl3945_rxon_assoc_cmd {
__le32 flags;
__le32 filter_flags;
u8 ofdm_basic_rates;
......@@ -312,7 +312,7 @@ struct iwl_rxon_assoc_cmd {
/*
* REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
*/
struct iwl_rxon_time_cmd {
struct iwl3945_rxon_time_cmd {
union tsf timestamp;
__le16 beacon_interval;
__le16 atim_window;
......@@ -321,34 +321,34 @@ struct iwl_rxon_time_cmd {
__le16 reserved;
} __attribute__ ((packed));
struct iwl_tx_power {
struct iwl3945_tx_power {
u8 tx_gain; /* gain for analog radio */
u8 dsp_atten; /* gain for DSP */
} __attribute__ ((packed));
struct iwl_power_per_rate {
struct iwl3945_power_per_rate {
u8 rate; /* plcp */
struct iwl_tx_power tpc;
struct iwl3945_tx_power tpc;
u8 reserved;
} __attribute__ ((packed));
/*
* REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
*/
struct iwl_channel_switch_cmd {
struct iwl3945_channel_switch_cmd {
u8 band;
u8 expect_beacon;
__le16 channel;
__le32 rxon_flags;
__le32 rxon_filter_flags;
__le32 switch_time;
struct iwl_power_per_rate power[IWL_MAX_RATES];
struct iwl3945_power_per_rate power[IWL_MAX_RATES];
} __attribute__ ((packed));
/*
* CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
*/
struct iwl_csa_notification {
struct iwl3945_csa_notification {
__le16 band;
__le16 channel;
__le32 status; /* 0 - OK, 1 - fail */
......@@ -359,7 +359,7 @@ struct iwl_csa_notification {
* Quality-of-Service (QOS) Commands & Responses:
*
*****************************************************************************/
struct iwl_ac_qos {
struct iwl3945_ac_qos {
__le16 cw_min;
__le16 cw_max;
u8 aifsn;
......@@ -381,9 +381,9 @@ struct iwl_ac_qos {
/*
* REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
*/
struct iwl_qosparam_cmd {
struct iwl3945_qosparam_cmd {
__le32 qos_flags;
struct iwl_ac_qos ac[AC_NUM];
struct iwl3945_ac_qos ac[AC_NUM];
} __attribute__ ((packed));
/******************************************************************************
......@@ -442,7 +442,7 @@ struct iwl_qosparam_cmd {
#define RATE_MCS_ANT_B_MSK 0x8000
#define RATE_MCS_ANT_AB_MSK 0xc000
struct iwl_keyinfo {
struct iwl3945_keyinfo {
__le16 key_flags;
u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
u8 reserved1;
......@@ -462,11 +462,11 @@ struct sta_id_modify {
/*
* REPLY_ADD_STA = 0x18 (command)
*/
struct iwl_addsta_cmd {
struct iwl3945_addsta_cmd {
u8 mode;
u8 reserved[3];
struct sta_id_modify sta;
struct iwl_keyinfo key;
struct iwl3945_keyinfo key;
__le32 station_flags;
__le32 station_flags_msk;
__le16 tid_disable_tx;
......@@ -479,7 +479,7 @@ struct iwl_addsta_cmd {
/*
* REPLY_ADD_STA = 0x18 (response)
*/
struct iwl_add_sta_resp {
struct iwl3945_add_sta_resp {
u8 status;
} __attribute__ ((packed));
......@@ -491,7 +491,7 @@ struct iwl_add_sta_resp {
*
*****************************************************************************/
struct iwl_rx_frame_stats {
struct iwl3945_rx_frame_stats {
u8 phy_count;
u8 id;
u8 rssi;
......@@ -501,7 +501,7 @@ struct iwl_rx_frame_stats {
u8 payload[0];
} __attribute__ ((packed));
struct iwl_rx_frame_hdr {
struct iwl3945_rx_frame_hdr {
__le16 channel;
__le16 phy_flags;
u8 reserved1;
......@@ -531,7 +531,7 @@ struct iwl_rx_frame_hdr {
#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
struct iwl_rx_frame_end {
struct iwl3945_rx_frame_end {
__le32 status;
__le64 timestamp;
__le32 beacon_timestamp;
......@@ -545,10 +545,10 @@ struct iwl_rx_frame_end {
* The actual offsets of the hdr and end are dynamic based on
* stats.phy_count
*/
struct iwl_rx_frame {
struct iwl_rx_frame_stats stats;
struct iwl_rx_frame_hdr hdr;
struct iwl_rx_frame_end end;
struct iwl3945_rx_frame {
struct iwl3945_rx_frame_stats stats;
struct iwl3945_rx_frame_hdr hdr;
struct iwl3945_rx_frame_end end;
} __attribute__ ((packed));
/* Fixed (non-configurable) rx data from phy */
......@@ -643,7 +643,7 @@ struct iwl4965_rx_mpdu_res_start {
* TX command Frame life time
*/
struct iwl_dram_scratch {
struct iwl3945_dram_scratch {
u8 try_cnt;
u8 bt_kill_cnt;
__le16 reserved;
......@@ -652,7 +652,7 @@ struct iwl_dram_scratch {
/*
* REPLY_TX = 0x1c (command)
*/
struct iwl_tx_cmd {
struct iwl3945_tx_cmd {
__le16 len;
__le16 next_frame_len;
__le32 tx_flags;
......@@ -784,7 +784,7 @@ enum {
/*
* REPLY_TX = 0x1c (response)
*/
struct iwl_tx_resp {
struct iwl3945_tx_resp {
u8 failure_rts;
u8 failure_frame;
u8 bt_kill_count;
......@@ -796,7 +796,7 @@ struct iwl_tx_resp {
/*
* REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
*/
struct iwl_compressed_ba_resp {
struct iwl3945_compressed_ba_resp {
__le32 sta_addr_lo32;
__le16 sta_addr_hi16;
__le16 reserved;
......@@ -812,21 +812,21 @@ struct iwl_compressed_ba_resp {
/*
* REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
*/
struct iwl_txpowertable_cmd {
struct iwl3945_txpowertable_cmd {
u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
u8 reserved;
__le16 channel;
struct iwl_power_per_rate power[IWL_MAX_RATES];
struct iwl3945_power_per_rate power[IWL_MAX_RATES];
} __attribute__ ((packed));
struct iwl_rate_scaling_info {
struct iwl3945_rate_scaling_info {
__le16 rate_n_flags;
u8 try_cnt;
u8 next_rate_index;
} __attribute__ ((packed));
/**
* struct iwl_rate_scaling_cmd - Rate Scaling Command & Response
* struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
*
* REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
*
......@@ -840,16 +840,16 @@ struct iwl_rate_scaling_info {
* when passed through ofdm_basic_rates on the REPLY_RXON
* command would be bit 0 (1<<0)
*/
struct iwl_rate_scaling_cmd {
struct iwl3945_rate_scaling_cmd {
u8 table_id;
u8 reserved[3];
struct iwl_rate_scaling_info table[IWL_MAX_RATES];
struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
} __attribute__ ((packed));
/*
* REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
*/
struct iwl_bt_cmd {
struct iwl3945_bt_cmd {
u8 flags;
u8 lead_time;
u8 max_kill;
......@@ -875,18 +875,18 @@ struct iwl_bt_cmd {
RXON_FILTER_ASSOC_MSK | \
RXON_FILTER_BCON_AWARE_MSK)
struct iwl_measure_channel {
struct iwl3945_measure_channel {
__le32 duration; /* measurement duration in extended beacon
* format */
u8 channel; /* channel to measure */
u8 type; /* see enum iwl_measure_type */
u8 type; /* see enum iwl3945_measure_type */
__le16 reserved;
} __attribute__ ((packed));
/*
* REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
*/
struct iwl_spectrum_cmd {
struct iwl3945_spectrum_cmd {
__le16 len; /* number of bytes starting from token */
u8 token; /* token id */
u8 id; /* measurement id -- 0 or 1 */
......@@ -899,13 +899,13 @@ struct iwl_spectrum_cmd {
__le32 filter_flags; /* rxon filter flags */
__le16 channel_count; /* minimum 1, maximum 10 */
__le16 reserved3;
struct iwl_measure_channel channels[10];
struct iwl3945_measure_channel channels[10];
} __attribute__ ((packed));
/*
* REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
*/
struct iwl_spectrum_resp {
struct iwl3945_spectrum_resp {
u8 token;
u8 id; /* id of the prior command replaced, or 0xff */
__le16 status; /* 0 - command will be handled
......@@ -913,12 +913,12 @@ struct iwl_spectrum_resp {
* measurement) */
} __attribute__ ((packed));
enum iwl_measurement_state {
enum iwl3945_measurement_state {
IWL_MEASUREMENT_START = 0,
IWL_MEASUREMENT_STOP = 1,
};
enum iwl_measurement_status {
enum iwl3945_measurement_status {
IWL_MEASUREMENT_OK = 0,
IWL_MEASUREMENT_CONCURRENT = 1,
IWL_MEASUREMENT_CSA_CONFLICT = 2,
......@@ -931,18 +931,18 @@ enum iwl_measurement_status {
#define NUM_ELEMENTS_IN_HISTOGRAM 8
struct iwl_measurement_histogram {
struct iwl3945_measurement_histogram {
__le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
__le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
} __attribute__ ((packed));
/* clear channel availability counters */
struct iwl_measurement_cca_counters {
struct iwl3945_measurement_cca_counters {
__le32 ofdm;
__le32 cck;
} __attribute__ ((packed));
enum iwl_measure_type {
enum iwl3945_measure_type {
IWL_MEASURE_BASIC = (1 << 0),
IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
......@@ -955,7 +955,7 @@ enum iwl_measure_type {
/*
* SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
*/
struct iwl_spectrum_notification {
struct iwl3945_spectrum_notification {
u8 id; /* measurement id -- 0 or 1 */
u8 token;
u8 channel_index; /* index in measurement channel list */
......@@ -963,7 +963,7 @@ struct iwl_spectrum_notification {
__le32 start_time; /* lower 32-bits of TSF */
u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
u8 channel;
u8 type; /* see enum iwl_measurement_type */
u8 type; /* see enum iwl3945_measurement_type */
u8 reserved1;
/* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
* valid if applicable for measurement type requested. */
......@@ -973,9 +973,9 @@ struct iwl_spectrum_notification {
u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
* unidentified */
u8 reserved2[3];
struct iwl_measurement_histogram histogram;
struct iwl3945_measurement_histogram histogram;
__le32 stop_time; /* lower 32-bits of TSF */
__le32 status; /* see iwl_measurement_status */
__le32 status; /* see iwl3945_measurement_status */
} __attribute__ ((packed));
/******************************************************************************
......@@ -985,7 +985,7 @@ struct iwl_spectrum_notification {
*****************************************************************************/
/**
* struct iwl_powertable_cmd - Power Table Command
* struct iwl3945_powertable_cmd - Power Table Command
* @flags: See below:
*
* POWER_TABLE_CMD = 0x77 (command, has simple generic response)
......@@ -1017,7 +1017,7 @@ struct iwl_spectrum_notification {
#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1<<0)
#define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1<<2)
#define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1<<3)
struct iwl_powertable_cmd {
struct iwl3945_powertable_cmd {
__le32 flags;
__le32 rx_data_timeout;
__le32 tx_data_timeout;
......@@ -1028,7 +1028,7 @@ struct iwl_powertable_cmd {
* PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
* 3945 and 4965 identical.
*/
struct iwl_sleep_notification {
struct iwl3945_sleep_notification {
u8 pm_sleep_mode;
u8 pm_wakeup_src;
__le16 reserved;
......@@ -1058,14 +1058,14 @@ enum {
#define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
#define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
#define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
struct iwl_card_state_cmd {
struct iwl3945_card_state_cmd {
__le32 status; /* CARD_STATE_CMD_* request new power state */
} __attribute__ ((packed));
/*
* CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
*/
struct iwl_card_state_notif {
struct iwl3945_card_state_notif {
__le32 flags;
} __attribute__ ((packed));
......@@ -1074,7 +1074,7 @@ struct iwl_card_state_notif {
#define RF_CARD_DISABLED 0x04
#define RXON_CARD_DISABLED 0x10
struct iwl_ct_kill_config {
struct iwl3945_ct_kill_config {
__le32 reserved;
__le32 critical_temperature_M;
__le32 critical_temperature_R;
......@@ -1086,7 +1086,7 @@ struct iwl_ct_kill_config {
*
*****************************************************************************/
struct iwl_scan_channel {
struct iwl3945_scan_channel {
/* type is defined as:
* 0:0 active (0 - passive)
* 1:4 SSID direct
......@@ -1095,12 +1095,12 @@ struct iwl_scan_channel {
*/
u8 type;
u8 channel;
struct iwl_tx_power tpc;
struct iwl3945_tx_power tpc;
__le16 active_dwell;
__le16 passive_dwell;
} __attribute__ ((packed));
struct iwl_ssid_ie {
struct iwl3945_ssid_ie {
u8 id;
u8 len;
u8 ssid[32];
......@@ -1114,7 +1114,7 @@ struct iwl_ssid_ie {
/*
* REPLY_SCAN_CMD = 0x80 (command)
*/
struct iwl_scan_cmd {
struct iwl3945_scan_cmd {
__le16 len;
u8 reserved0;
u8 channel_count;
......@@ -1133,14 +1133,14 @@ struct iwl_scan_cmd {
__le32 flags;
__le32 filter_flags;
struct iwl_tx_cmd tx_cmd;
struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
struct iwl3945_tx_cmd tx_cmd;
struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX];
u8 data[0];
/*
* The channels start after the probe request payload and are of type:
*
* struct iwl_scan_channel channels[0];
* struct iwl3945_scan_channel channels[0];
*
* NOTE: Only one band of channels can be scanned per pass. You
* can not mix 2.4GHz channels and 5.2GHz channels and must
......@@ -1157,14 +1157,14 @@ struct iwl_scan_cmd {
/*
* REPLY_SCAN_CMD = 0x80 (response)
*/
struct iwl_scanreq_notification {
struct iwl3945_scanreq_notification {
__le32 status; /* 1: okay, 2: cannot fulfill request */
} __attribute__ ((packed));
/*
* SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
*/
struct iwl_scanstart_notification {
struct iwl3945_scanstart_notification {
__le32 tsf_low;
__le32 tsf_high;
__le32 beacon_timer;
......@@ -1181,7 +1181,7 @@ struct iwl_scanstart_notification {
/*
* SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
*/
struct iwl_scanresults_notification {
struct iwl3945_scanresults_notification {
u8 channel;
u8 band;
u8 reserved[2];
......@@ -1193,7 +1193,7 @@ struct iwl_scanresults_notification {
/*
* SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
*/
struct iwl_scancomplete_notification {
struct iwl3945_scancomplete_notification {
u8 scanned_channels;
u8 status;
u8 reserved;
......@@ -1212,8 +1212,8 @@ struct iwl_scancomplete_notification {
/*
* BEACON_NOTIFICATION = 0x90 (notification only, not a command)
*/
struct iwl_beacon_notif {
struct iwl_tx_resp beacon_notify_hdr;
struct iwl3945_beacon_notif {
struct iwl3945_tx_resp beacon_notify_hdr;
__le32 low_tsf;
__le32 high_tsf;
__le32 ibss_mgr_status;
......@@ -1222,8 +1222,8 @@ struct iwl_beacon_notif {
/*
* REPLY_TX_BEACON = 0x91 (command, has simple generic response)
*/
struct iwl_tx_beacon_cmd {
struct iwl_tx_cmd tx;
struct iwl3945_tx_beacon_cmd {
struct iwl3945_tx_cmd tx;
__le16 tim_idx;
u8 tim_size;
u8 reserved1;
......@@ -1345,7 +1345,7 @@ struct statistics_general {
*/
#define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */
#define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */
struct iwl_statistics_cmd {
struct iwl3945_statistics_cmd {
__le32 configuration_flags; /* IWL_STATS_CONF_* */
} __attribute__ ((packed));
......@@ -1366,7 +1366,7 @@ struct iwl_statistics_cmd {
*/
#define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2)
#define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8)
struct iwl_notif_statistics {
struct iwl3945_notif_statistics {
__le32 flag;
struct statistics_rx rx;
struct statistics_tx tx;
......@@ -1381,7 +1381,7 @@ struct iwl_notif_statistics {
* then this notification will be sent. */
#define CONSECUTIVE_MISSED_BCONS_TH 20
struct iwl_missed_beacon_notif {
struct iwl3945_missed_beacon_notif {
__le32 consequtive_missed_beacons;
__le32 total_missed_becons;
__le32 num_expected_beacons;
......@@ -1397,12 +1397,12 @@ struct iwl_missed_beacon_notif {
#define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
#define HD_TABLE_SIZE (11)
struct iwl_sensitivity_cmd {
struct iwl3945_sensitivity_cmd {
__le16 control;
__le16 table[HD_TABLE_SIZE];
} __attribute__ ((packed));
struct iwl_calibration_cmd {
struct iwl3945_calibration_cmd {
u8 opCode;
u8 flags;
__le16 reserved;
......@@ -1425,7 +1425,7 @@ struct iwl_calibration_cmd {
* For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
* this command turns it on or off, or sets up a periodic blinking cycle.
*/
struct iwl_led_cmd {
struct iwl3945_led_cmd {
__le32 interval; /* "interval" in uSec */
u8 id; /* 1: Activity, 2: Link, 3: Tech */
u8 off; /* # intervals off while blinking;
......@@ -1441,27 +1441,27 @@ struct iwl_led_cmd {
*
*****************************************************************************/
struct iwl_rx_packet {
struct iwl3945_rx_packet {
__le32 len;
struct iwl_cmd_header hdr;
struct iwl3945_cmd_header hdr;
union {
struct iwl_alive_resp alive_frame;
struct iwl_rx_frame rx_frame;
struct iwl_tx_resp tx_resp;
struct iwl_spectrum_notification spectrum_notif;
struct iwl_csa_notification csa_notif;
struct iwl_error_resp err_resp;
struct iwl_card_state_notif card_state_notif;
struct iwl_beacon_notif beacon_status;
struct iwl_add_sta_resp add_sta;
struct iwl_sleep_notification sleep_notif;
struct iwl_spectrum_resp spectrum;
struct iwl_notif_statistics stats;
struct iwl3945_alive_resp alive_frame;
struct iwl3945_rx_frame rx_frame;
struct iwl3945_tx_resp tx_resp;
struct iwl3945_spectrum_notification spectrum_notif;
struct iwl3945_csa_notification csa_notif;
struct iwl3945_error_resp err_resp;
struct iwl3945_card_state_notif card_state_notif;
struct iwl3945_beacon_notif beacon_status;
struct iwl3945_add_sta_resp add_sta;
struct iwl3945_sleep_notification sleep_notif;
struct iwl3945_spectrum_resp spectrum;
struct iwl3945_notif_statistics stats;
__le32 status;
u8 raw[0];
} u;
} __attribute__ ((packed));
#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl_rx_frame))
#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
#endif /* __iwl_3945_commands_h__ */
#endif /* __iwl3945_3945_commands_h__ */
......@@ -26,18 +26,18 @@
*
*****************************************************************************/
#ifndef __iwl_debug_h__
#define __iwl_debug_h__
#ifndef __iwl3945_debug_h__
#define __iwl3945_debug_h__
#ifdef CONFIG_IWL3945_DEBUG
extern u32 iwl_debug_level;
extern u32 iwl3945_debug_level;
#define IWL_DEBUG(level, fmt, args...) \
do { if (iwl_debug_level & (level)) \
do { if (iwl3945_debug_level & (level)) \
printk(KERN_ERR DRV_NAME": %c %s " fmt, \
in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
#define IWL_DEBUG_LIMIT(level, fmt, args...) \
do { if ((iwl_debug_level & (level)) && net_ratelimit()) \
do { if ((iwl3945_debug_level & (level)) && net_ratelimit()) \
printk(KERN_ERR DRV_NAME": %c %s " fmt, \
in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
#else
......@@ -68,7 +68,7 @@ static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...)
*
* % cat /proc/net/iwl/debug_level
*
* you simply need to add your entry to the iwl_debug_levels array.
* you simply need to add your entry to the iwl3945_debug_levels array.
*
* If you do not see debug_level in /proc/net/iwl then you do not have
* CONFIG_IWL3945_DEBUG defined in your kernel configuration
......
......@@ -133,7 +133,7 @@ enum {
#define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7)
/* *regulatory* channel data from eeprom, one for each channel */
struct iwl_eeprom_channel {
struct iwl3945_eeprom_channel {
u8 flags; /* flags copied from EEPROM */
s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */
} __attribute__ ((packed));
......@@ -148,7 +148,7 @@ struct iwl_eeprom_channel {
* level.
* Data copied from EEPROM.
*/
struct iwl_eeprom_txpower_sample {
struct iwl3945_eeprom_txpower_sample {
u8 gain_index; /* index into power (gain) setup table ... */
s8 power; /* ... for this pwr level for this chnl group */
u16 v_det; /* PA output voltage */
......@@ -162,8 +162,8 @@ struct iwl_eeprom_txpower_sample {
* Data copied from EEPROM.
* DO NOT ALTER THIS STRUCTURE!!!
*/
struct iwl_eeprom_txpower_group {
struct iwl_eeprom_txpower_sample samples[5]; /* 5 power levels */
struct iwl3945_eeprom_txpower_group {
struct iwl3945_eeprom_txpower_sample samples[5]; /* 5 power levels */
s32 a, b, c, d, e; /* coefficients for voltage->power
* formula (signed) */
s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on
......@@ -181,7 +181,7 @@ struct iwl_eeprom_txpower_group {
* difference between current temperature and factory calib temperature.
* Data copied from EEPROM.
*/
struct iwl_eeprom_temperature_corr {
struct iwl3945_eeprom_temperature_corr {
u32 Ta;
u32 Tb;
u32 Tc;
......@@ -189,7 +189,7 @@ struct iwl_eeprom_temperature_corr {
u32 Te;
} __attribute__ ((packed));
struct iwl_eeprom {
struct iwl3945_eeprom {
u8 reserved0[16];
#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */
u16 device_id; /* abs.ofs: 16 */
......@@ -232,23 +232,23 @@ struct iwl_eeprom {
#define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */
u16 band_1_count; /* abs.ofs: 196 */
#define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */
struct iwl_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */
struct iwl3945_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */
#define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */
u16 band_2_count; /* abs.ofs: 226 */
#define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */
struct iwl_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
struct iwl3945_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
#define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */
u16 band_3_count; /* abs.ofs: 254 */
#define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */
struct iwl_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
struct iwl3945_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
#define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */
u16 band_4_count; /* abs.ofs: 280 */
#define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */
struct iwl_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
struct iwl3945_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
#define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */
u16 band_5_count; /* abs.ofs: 304 */
#define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */
struct iwl_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
struct iwl3945_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
u8 reserved9[194];
......@@ -258,10 +258,10 @@ struct iwl_eeprom {
#define EEPROM_TXPOWER_CALIB_GROUP3 0x2c0
#define EEPROM_TXPOWER_CALIB_GROUP4 0x300
#define IWL_NUM_TX_CALIB_GROUPS 5
struct iwl_eeprom_txpower_group groups[IWL_NUM_TX_CALIB_GROUPS];
struct iwl3945_eeprom_txpower_group groups[IWL_NUM_TX_CALIB_GROUPS];
/* abs.ofs: 512 */
#define EEPROM_CALIB_TEMPERATURE_CORRECT 0x340
struct iwl_eeprom_temperature_corr corrections; /* abs.ofs: 832 */
struct iwl3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */
u8 reserved16[172]; /* fill out to full 1024 byte block */
} __attribute__ ((packed));
......@@ -681,8 +681,8 @@ struct iwl_eeprom {
#define TFD_TX_CMD_SLOTS 256
#define TFD_CMD_SLOTS 32
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \
sizeof(struct iwl_cmd_meta))
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl3945_cmd) - \
sizeof(struct iwl3945_cmd_meta))
/*
* RX related structures and functions
......@@ -704,41 +704,41 @@ struct iwl_eeprom {
#define IWL_MAX_DATA_SIZE ALM_RTC_DATA_SIZE
#define IWL_MAX_NUM_QUEUES 8
static inline int iwl_hw_valid_rtc_data_addr(u32 addr)
static inline int iwl3945_hw_valid_rtc_data_addr(u32 addr)
{
return (addr >= RTC_DATA_LOWER_BOUND) &&
(addr < ALM_RTC_DATA_UPPER_BOUND);
}
/* Base physical address of iwl_shared is provided to FH_TSSR_CBB_BASE
* and &iwl_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */
struct iwl_shared {
/* Base physical address of iwl3945_shared is provided to FH_TSSR_CBB_BASE
* and &iwl3945_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */
struct iwl3945_shared {
__le32 tx_base_ptr[8];
__le32 rx_read_ptr[3];
} __attribute__ ((packed));
struct iwl_tfd_frame_data {
struct iwl3945_tfd_frame_data {
__le32 addr;
__le32 len;
} __attribute__ ((packed));
struct iwl_tfd_frame {
struct iwl3945_tfd_frame {
__le32 control_flags;
struct iwl_tfd_frame_data pa[4];
struct iwl3945_tfd_frame_data pa[4];
u8 reserved[28];
} __attribute__ ((packed));
static inline u8 iwl_hw_get_rate(__le16 rate_n_flags)
static inline u8 iwl3945_hw_get_rate(__le16 rate_n_flags)
{
return le16_to_cpu(rate_n_flags) & 0xFF;
}
static inline u16 iwl_hw_get_rate_n_flags(__le16 rate_n_flags)
static inline u16 iwl3945_hw_get_rate_n_flags(__le16 rate_n_flags)
{
return le16_to_cpu(rate_n_flags);
}
static inline __le16 iwl_hw_set_rate_n_flags(u8 rate, u16 flags)
static inline __le16 iwl3945_hw_set_rate_n_flags(u8 rate, u16 flags)
{
return cpu_to_le16((u16)rate|flags);
}
......
......@@ -26,8 +26,8 @@
*
*****************************************************************************/
#ifndef __iwl_io_h__
#define __iwl_io_h__
#ifndef __iwl3945_io_h__
#define __iwl3945_io_h__
#include <linux/io.h>
......@@ -49,8 +49,8 @@
*
* If you wish to call the function without any debug or state checking,
* you should use the single _ prefix version (as is used by dependent IO
* routines, for example _iwl_read_direct32 calls the non-check version of
* _iwl_read32.)
* routines, for example _iwl3945_read_direct32 calls the non-check version of
* _iwl3945_read32.)
*
* These declarations are *extremely* useful in quickly isolating code deltas
* which result in misconfiguring of the hardware I/O. In combination with
......@@ -59,39 +59,39 @@
*
*/
#define _iwl_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs))
#define _iwl3945_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs))
#ifdef CONFIG_IWL3945_DEBUG
static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *iwl,
static inline void __iwl3945_write32(const char *f, u32 l, struct iwl3945_priv *iwl,
u32 ofs, u32 val)
{
IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l);
_iwl_write32(iwl, ofs, val);
_iwl3945_write32(iwl, ofs, val);
}
#define iwl_write32(iwl, ofs, val) \
__iwl_write32(__FILE__, __LINE__, iwl, ofs, val)
#define iwl3945_write32(iwl, ofs, val) \
__iwl3945_write32(__FILE__, __LINE__, iwl, ofs, val)
#else
#define iwl_write32(iwl, ofs, val) _iwl_write32(iwl, ofs, val)
#define iwl3945_write32(iwl, ofs, val) _iwl3945_write32(iwl, ofs, val)
#endif
#define _iwl_read32(iwl, ofs) readl((iwl)->hw_base + (ofs))
#define _iwl3945_read32(iwl, ofs) readl((iwl)->hw_base + (ofs))
#ifdef CONFIG_IWL3945_DEBUG
static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *iwl, u32 ofs)
static inline u32 __iwl3945_read32(char *f, u32 l, struct iwl3945_priv *iwl, u32 ofs)
{
IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l);
return _iwl_read32(iwl, ofs);
return _iwl3945_read32(iwl, ofs);
}
#define iwl_read32(iwl, ofs) __iwl_read32(__FILE__, __LINE__, iwl, ofs)
#define iwl3945_read32(iwl, ofs) __iwl3945_read32(__FILE__, __LINE__, iwl, ofs)
#else
#define iwl_read32(p, o) _iwl_read32(p, o)
#define iwl3945_read32(p, o) _iwl3945_read32(p, o)
#endif
static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr,
static inline int _iwl3945_poll_bit(struct iwl3945_priv *priv, u32 addr,
u32 bits, u32 mask, int timeout)
{
int i = 0;
do {
if ((_iwl_read32(priv, addr) & mask) == (bits & mask))
if ((_iwl3945_read32(priv, addr) & mask) == (bits & mask))
return i;
mdelay(10);
i += 10;
......@@ -100,11 +100,11 @@ static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr,
return -ETIMEDOUT;
}
#ifdef CONFIG_IWL3945_DEBUG
static inline int __iwl_poll_bit(const char *f, u32 l,
struct iwl_priv *priv, u32 addr,
static inline int __iwl3945_poll_bit(const char *f, u32 l,
struct iwl3945_priv *priv, u32 addr,
u32 bits, u32 mask, int timeout)
{
int ret = _iwl_poll_bit(priv, addr, bits, mask, timeout);
int ret = _iwl3945_poll_bit(priv, addr, bits, mask, timeout);
if (unlikely(ret == -ETIMEDOUT))
IWL_DEBUG_IO
("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,
addr, bits, mask, ret, f, l);
return ret;
}
#define iwl_poll_bit(iwl, addr, bits, mask, timeout) \
__iwl_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout)
#define iwl3945_poll_bit(iwl, addr, bits, mask, timeout) \
__iwl3945_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout)
#else
#define iwl_poll_bit(p, a, b, m, t) _iwl_poll_bit(p, a, b, m, t)
#define iwl3945_poll_bit(p, a, b, m, t) _iwl3945_poll_bit(p, a, b, m, t)
#endif
static inline void _iwl_set_bit(struct iwl_priv *priv, u32 reg, u32 mask)
static inline void _iwl3945_set_bit(struct iwl3945_priv *priv, u32 reg, u32 mask)
{
_iwl_write32(priv, reg, _iwl_read32(priv, reg) | mask);
_iwl3945_write32(priv, reg, _iwl3945_read32(priv, reg) | mask);
}
#ifdef CONFIG_IWL3945_DEBUG
static inline void __iwl_set_bit(const char *f, u32 l,
struct iwl_priv *priv, u32 reg, u32 mask)
static inline void __iwl3945_set_bit(const char *f, u32 l,
struct iwl3945_priv *priv, u32 reg, u32 mask)
{
u32 val = _iwl_read32(priv, reg) | mask;
u32 val = _iwl3945_read32(priv, reg) | mask;
IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
_iwl_write32(priv, reg, val);
_iwl3945_write32(priv, reg, val);
}
#define iwl_set_bit(p, r, m) __iwl_set_bit(__FILE__, __LINE__, p, r, m)
#define iwl3945_set_bit(p, r, m) __iwl3945_set_bit(__FILE__, __LINE__, p, r, m)
#else
#define iwl_set_bit(p, r, m) _iwl_set_bit(p, r, m)
#define iwl3945_set_bit(p, r, m) _iwl3945_set_bit(p, r, m)
#endif
static inline void _iwl_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask)
static inline void _iwl3945_clear_bit(struct iwl3945_priv *priv, u32 reg, u32 mask)
{
_iwl_write32(priv, reg, _iwl_read32(priv, reg) & ~mask);
_iwl3945_write32(priv, reg, _iwl3945_read32(priv, reg) & ~mask);
}
#ifdef CONFIG_IWL3945_DEBUG
static inline void __iwl_clear_bit(const char *f, u32 l,
struct iwl_priv *priv, u32 reg, u32 mask)
static inline void __iwl3945_clear_bit(const char *f, u32 l,
struct iwl3945_priv *priv, u32 reg, u32 mask)
{
u32 val = _iwl_read32(priv, reg) & ~mask;
u32 val = _iwl3945_read32(priv, reg) & ~mask;
IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
_iwl_write32(priv, reg, val);
_iwl3945_write32(priv, reg, val);
}
#define iwl_clear_bit(p, r, m) __iwl_clear_bit(__FILE__, __LINE__, p, r, m)
#define iwl3945_clear_bit(p, r, m) __iwl3945_clear_bit(__FILE__, __LINE__, p, r, m)
#else
#define iwl_clear_bit(p, r, m) _iwl_clear_bit(p, r, m)
#define iwl3945_clear_bit(p, r, m) _iwl3945_clear_bit(p, r, m)
#endif
static inline int _iwl_grab_nic_access(struct iwl_priv *priv)
static inline int _iwl3945_grab_nic_access(struct iwl3945_priv *priv)
{
int ret;
u32 gp_ctl;
......@@ -170,7 +170,7 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv)
"wakes up NIC\n");
/* 10 msec allows time for NIC to complete its data save */
gp_ctl = _iwl_read32(priv, CSR_GP_CNTRL);
gp_ctl = _iwl3945_read32(priv, CSR_GP_CNTRL);
if (gp_ctl & CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY) {
IWL_DEBUG_RF_KILL("Wait for complete power-down, "
"gpctl = 0x%08x\n", gp_ctl);
......@@ -181,8 +181,8 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv)
}
/* this bit wakes up the NIC */
_iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
ret = _iwl_poll_bit(priv, CSR_GP_CNTRL,
_iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
ret = _iwl3945_poll_bit(priv, CSR_GP_CNTRL,
CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN,
(CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY |
CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50);
......@@ -198,106 +198,106 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv)
}
#ifdef CONFIG_IWL3945_DEBUG
static inline int __iwl_grab_nic_access(const char *f, u32 l,
struct iwl_priv *priv)
static inline int __iwl3945_grab_nic_access(const char *f, u32 l,
struct iwl3945_priv *priv)
{
if (atomic_read(&priv->restrict_refcnt))
IWL_DEBUG_INFO("Grabbing access while already held at "
"line %d.\n", l);
IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l);
return _iwl_grab_nic_access(priv);
return _iwl3945_grab_nic_access(priv);
}
#define iwl_grab_nic_access(priv) \
__iwl_grab_nic_access(__FILE__, __LINE__, priv)
#define iwl3945_grab_nic_access(priv) \
__iwl3945_grab_nic_access(__FILE__, __LINE__, priv)
#else
#define iwl_grab_nic_access(priv) \
_iwl_grab_nic_access(priv)
#define iwl3945_grab_nic_access(priv) \
_iwl3945_grab_nic_access(priv)
#endif
static inline void _iwl_release_nic_access(struct iwl_priv *priv)
static inline void _iwl3945_release_nic_access(struct iwl3945_priv *priv)
{
#ifdef CONFIG_IWL3945_DEBUG
if (atomic_dec_and_test(&priv->restrict_refcnt))
#endif
_iwl_clear_bit(priv, CSR_GP_CNTRL,
_iwl3945_clear_bit(priv, CSR_GP_CNTRL,
CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
}
#ifdef CONFIG_IWL3945_DEBUG
static inline void __iwl_release_nic_access(const char *f, u32 l,
struct iwl_priv *priv)
static inline void __iwl3945_release_nic_access(const char *f, u32 l,
struct iwl3945_priv *priv)
{
if (atomic_read(&priv->restrict_refcnt) <= 0)
IWL_ERROR("Release unheld nic access at line %d.\n", l);
IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l);
_iwl_release_nic_access(priv);
_iwl3945_release_nic_access(priv);
}
#define iwl_release_nic_access(priv) \
__iwl_release_nic_access(__FILE__, __LINE__, priv)
#define iwl3945_release_nic_access(priv) \
__iwl3945_release_nic_access(__FILE__, __LINE__, priv)
#else
#define iwl_release_nic_access(priv) \
_iwl_release_nic_access(priv)
#define iwl3945_release_nic_access(priv) \
_iwl3945_release_nic_access(priv)
#endif
static inline u32 _iwl_read_direct32(struct iwl_priv *priv, u32 reg)
static inline u32 _iwl3945_read_direct32(struct iwl3945_priv *priv, u32 reg)
{
return _iwl_read32(priv, reg);
return _iwl3945_read32(priv, reg);
}
#ifdef CONFIG_IWL3945_DEBUG
static inline u32 __iwl_read_direct32(const char *f, u32 l,
struct iwl_priv *priv, u32 reg)
static inline u32 __iwl3945_read_direct32(const char *f, u32 l,
struct iwl3945_priv *priv, u32 reg)
{
u32 value = _iwl_read_direct32(priv, reg);
u32 value = _iwl3945_read_direct32(priv, reg);
if (!atomic_read(&priv->restrict_refcnt))
IWL_ERROR("Nic access not held from %s %d\n", f, l);
IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value,
f, l);
return value;
}
#define iwl_read_direct32(priv, reg) \
__iwl_read_direct32(__FILE__, __LINE__, priv, reg)
#define iwl3945_read_direct32(priv, reg) \
__iwl3945_read_direct32(__FILE__, __LINE__, priv, reg)
#else
#define iwl_read_direct32 _iwl_read_direct32
#define iwl3945_read_direct32 _iwl3945_read_direct32
#endif
static inline void _iwl_write_direct32(struct iwl_priv *priv,
static inline void _iwl3945_write_direct32(struct iwl3945_priv *priv,
u32 reg, u32 value)
{
_iwl_write32(priv, reg, value);
_iwl3945_write32(priv, reg, value);
}
#ifdef CONFIG_IWL3945_DEBUG
static void __iwl_write_direct32(u32 line,
struct iwl_priv *priv, u32 reg, u32 value)
static void __iwl3945_write_direct32(u32 line,
struct iwl3945_priv *priv, u32 reg, u32 value)
{
if (!atomic_read(&priv->restrict_refcnt))
IWL_ERROR("Nic access not held from line %d\n", line);
_iwl_write_direct32(priv, reg, value);
_iwl3945_write_direct32(priv, reg, value);
}
#define iwl_write_direct32(priv, reg, value) \
__iwl_write_direct32(__LINE__, priv, reg, value)
#define iwl3945_write_direct32(priv, reg, value) \
__iwl3945_write_direct32(__LINE__, priv, reg, value)
#else
#define iwl_write_direct32 _iwl_write_direct32
#define iwl3945_write_direct32 _iwl3945_write_direct32
#endif
static inline void iwl_write_reg_buf(struct iwl_priv *priv,
static inline void iwl3945_write_reg_buf(struct iwl3945_priv *priv,
u32 reg, u32 len, u32 *values)
{
u32 count = sizeof(u32);
if ((priv != NULL) && (values != NULL)) {
for (; 0 < len; len -= count, reg += count, values++)
_iwl_write_direct32(priv, reg, *values);
_iwl3945_write_direct32(priv, reg, *values);
}
}
static inline int _iwl_poll_direct_bit(struct iwl_priv *priv,
static inline int _iwl3945_poll_direct_bit(struct iwl3945_priv *priv,
u32 addr, u32 mask, int timeout)
{
int i = 0;
do {
if ((_iwl_read_direct32(priv, addr) & mask) == mask)
if ((_iwl3945_read_direct32(priv, addr) & mask) == mask)
return i;
mdelay(10);
i += 10;
......@@ -307,11 +307,11 @@ static inline int _iwl_poll_direct_bit(struct iwl_priv *priv,
}
#ifdef CONFIG_IWL3945_DEBUG
static inline int __iwl_poll_direct_bit(const char *f, u32 l,
struct iwl_priv *priv,
static inline int __iwl3945_poll_direct_bit(const char *f, u32 l,
struct iwl3945_priv *priv,
u32 addr, u32 mask, int timeout)
{
int ret = _iwl_poll_direct_bit(priv, addr, mask, timeout);
int ret = _iwl3945_poll_direct_bit(priv, addr, mask, timeout);
if (unlikely(ret == -ETIMEDOUT))
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,
"- %s %d\n", addr, mask, ret, f, l);
return ret;
}
#define iwl_poll_direct_bit(iwl, addr, mask, timeout) \
__iwl_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout)
#define iwl3945_poll_direct_bit(iwl, addr, mask, timeout) \
__iwl3945_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout)
#else
#define iwl_poll_direct_bit _iwl_poll_direct_bit
#define iwl3945_poll_direct_bit _iwl3945_poll_direct_bit
#endif
static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg)
static inline u32 _iwl3945_read_prph(struct iwl3945_priv *priv, u32 reg)
{
_iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT);
_iwl3945_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
return _iwl3945_read_direct32(priv, HBUS_TARG_PRPH_RDAT);
}
#ifdef CONFIG_IWL3945_DEBUG
static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg)
static inline u32 __iwl3945_read_prph(u32 line, struct iwl3945_priv *priv, u32 reg)
{
if (!atomic_read(&priv->restrict_refcnt))
IWL_ERROR("Nic access not held from line %d\n", line);
return _iwl_read_prph(priv, reg);
return _iwl3945_read_prph(priv, reg);
}
#define iwl_read_prph(priv, reg) \
__iwl_read_prph(__LINE__, priv, reg)
#define iwl3945_read_prph(priv, reg) \
__iwl3945_read_prph(__LINE__, priv, reg)
#else
#define iwl_read_prph _iwl_read_prph
#define iwl3945_read_prph _iwl3945_read_prph
#endif
static inline void _iwl_write_prph(struct iwl_priv *priv,
static inline void _iwl3945_write_prph(struct iwl3945_priv *priv,
u32 addr, u32 val)
{
_iwl_write_direct32(priv, HBUS_TARG_PRPH_WADDR,
_iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WADDR,
((addr & 0x0000FFFF) | (3 << 24)));
_iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val);
_iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val);
}
#ifdef CONFIG_IWL3945_DEBUG
static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv,
static inline void __iwl3945_write_prph(u32 line, struct iwl3945_priv *priv,
u32 addr, u32 val)
{
if (!atomic_read(&priv->restrict_refcnt))
IWL_ERROR("Nic access from line %d\n", line);
_iwl_write_prph(priv, addr, val);
_iwl3945_write_prph(priv, addr, val);
}
#define iwl_write_prph(priv, addr, val) \
__iwl_write_prph(__LINE__, priv, addr, val);
#define iwl3945_write_prph(priv, addr, val) \
__iwl3945_write_prph(__LINE__, priv, addr, val);
#else
#define iwl_write_prph _iwl_write_prph
#define iwl3945_write_prph _iwl3945_write_prph
#endif
#define _iwl_set_bits_prph(priv, reg, mask) \
_iwl_write_prph(priv, reg, (_iwl_read_prph(priv, reg) | mask))
#define _iwl3945_set_bits_prph(priv, reg, mask) \
_iwl3945_write_prph(priv, reg, (_iwl3945_read_prph(priv, reg) | mask))
#ifdef CONFIG_IWL3945_DEBUG
static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv,
static inline void __iwl3945_set_bits_prph(u32 line, struct iwl3945_priv *priv,
u32 reg, u32 mask)
{
if (!atomic_read(&priv->restrict_refcnt))
IWL_ERROR("Nic access not held from line %d\n", line);
_iwl_set_bits_prph(priv, reg, mask);
_iwl3945_set_bits_prph(priv, reg, mask);
}
#define iwl_set_bits_prph(priv, reg, mask) \
__iwl_set_bits_prph(__LINE__, priv, reg, mask)
#define iwl3945_set_bits_prph(priv, reg, mask) \
__iwl3945_set_bits_prph(__LINE__, priv, reg, mask)
#else
#define iwl_set_bits_prph _iwl_set_bits_prph
#define iwl3945_set_bits_prph _iwl3945_set_bits_prph
#endif
#define _iwl_set_bits_mask_prph(priv, reg, bits, mask) \
_iwl_write_prph(priv, reg, ((_iwl_read_prph(priv, reg) & mask) | bits))
#define _iwl3945_set_bits_mask_prph(priv, reg, bits, mask) \
_iwl3945_write_prph(priv, reg, ((_iwl3945_read_prph(priv, reg) & mask) | bits))
#ifdef CONFIG_IWL3945_DEBUG
static inline void __iwl_set_bits_mask_prph(u32 line,
struct iwl_priv *priv, u32 reg, u32 bits, u32 mask)
static inline void __iwl3945_set_bits_mask_prph(u32 line,
struct iwl3945_priv *priv, u32 reg, u32 bits, u32 mask)
{
if (!atomic_read(&priv->restrict_refcnt))
IWL_ERROR("Nic access not held from line %d\n", line);
_iwl_set_bits_mask_prph(priv, reg, bits, mask);
_iwl3945_set_bits_mask_prph(priv, reg, bits, mask);
}
#define iwl_set_bits_mask_prph(priv, reg, bits, mask) \
__iwl_set_bits_mask_prph(__LINE__, priv, reg, bits, mask)
#define iwl3945_set_bits_mask_prph(priv, reg, bits, mask) \
__iwl3945_set_bits_mask_prph(__LINE__, priv, reg, bits, mask)
#else
#define iwl_set_bits_mask_prph _iwl_set_bits_mask_prph
#define iwl3945_set_bits_mask_prph _iwl3945_set_bits_mask_prph
#endif
static inline void iwl_clear_bits_prph(struct iwl_priv
static inline void iwl3945_clear_bits_prph(struct iwl3945_priv
*priv, u32 reg, u32 mask)
{
u32 val = _iwl_read_prph(priv, reg);
_iwl_write_prph(priv, reg, (val & ~mask));
u32 val = _iwl3945_read_prph(priv, reg);
_iwl3945_write_prph(priv, reg, (val & ~mask));
}
static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr)
static inline u32 iwl3945_read_targ_mem(struct iwl3945_priv *priv, u32 addr)
{
iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr);
return iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT);
iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr);
return iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT);
}
static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val)
static inline void iwl3945_write_targ_mem(struct iwl3945_priv *priv, u32 addr, u32 val)
{
iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, val);
iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, val);
}
static inline void iwl_write_targ_mem_buf(struct iwl_priv *priv, u32 addr,
static inline void iwl3945_write_targ_mem_buf(struct iwl3945_priv *priv, u32 addr,
u32 len, u32 *values)
{
iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
for (; 0 < len; len -= sizeof(u32), values++)
iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values);
iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values);
}
#endif
......@@ -43,7 +43,7 @@
#define RS_NAME "iwl-3945-rs"
struct iwl_rate_scale_data {
struct iwl3945_rate_scale_data {
u64 data;
s32 success_counter;
s32 success_ratio;
......@@ -52,7 +52,7 @@ struct iwl_rate_scale_data {
unsigned long stamp;
};
struct iwl_rate_scale_priv {
struct iwl3945_rate_scale_priv {
spinlock_t lock;
s32 *expected_tpt;
unsigned long last_partial_flush;
......@@ -65,31 +65,31 @@ struct iwl_rate_scale_priv {
u8 start_rate;
u8 ibss_sta_added;
struct timer_list rate_scale_flush;
struct iwl_rate_scale_data win[IWL_RATE_COUNT];
struct iwl3945_rate_scale_data win[IWL_RATE_COUNT];
};
static s32 iwl_expected_tpt_g[IWL_RATE_COUNT] = {
static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT] = {
7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202
};
static s32 iwl_expected_tpt_g_prot[IWL_RATE_COUNT] = {
static s32 iwl3945_expected_tpt_g_prot[IWL_RATE_COUNT] = {
7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125
};
static s32 iwl_expected_tpt_a[IWL_RATE_COUNT] = {
static s32 iwl3945_expected_tpt_a[IWL_RATE_COUNT] = {
0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186
};
static s32 iwl_expected_tpt_b[IWL_RATE_COUNT] = {
static s32 iwl3945_expected_tpt_b[IWL_RATE_COUNT] = {
7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0
};
struct iwl_tpt_entry {
struct iwl3945_tpt_entry {
s8 min_rssi;
u8 index;
};
static struct iwl_tpt_entry iwl_tpt_table_a[] = {
static struct iwl3945_tpt_entry iwl3945_tpt_table_a[] = {
{-60, IWL_RATE_54M_INDEX},
{-64, IWL_RATE_48M_INDEX},
{-72, IWL_RATE_36M_INDEX},
......@@ -100,7 +100,7 @@ static struct iwl_tpt_entry iwl_tpt_table_a[] = {
{-89, IWL_RATE_6M_INDEX}
};
static struct iwl_tpt_entry iwl_tpt_table_b[] = {
static struct iwl3945_tpt_entry iwl3945_tpt_table_b[] = {
{-86, IWL_RATE_11M_INDEX},
{-88, IWL_RATE_5M_INDEX},
{-90, IWL_RATE_2M_INDEX},
......@@ -108,7 +108,7 @@ static struct iwl_tpt_entry iwl_tpt_table_b[] = {
};
static struct iwl_tpt_entry iwl_tpt_table_g[] = {
static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = {
{-60, IWL_RATE_54M_INDEX},
{-64, IWL_RATE_48M_INDEX},
{-68, IWL_RATE_36M_INDEX},
......@@ -129,30 +129,30 @@ static struct iwl_tpt_entry iwl_tpt_table_g[] = {
#define IWL_RATE_MIN_SUCCESS_TH 8
#define IWL_RATE_DECREASE_TH 1920
static u8 iwl_get_rate_index_by_rssi(s32 rssi, u8 mode)
static u8 iwl3945_get_rate_index_by_rssi(s32 rssi, u8 mode)
{
u32 index = 0;
u32 table_size = 0;
struct iwl_tpt_entry *tpt_table = NULL;
struct iwl3945_tpt_entry *tpt_table = NULL;
if ((rssi < IWL_MIN_RSSI_VAL) || (rssi > IWL_MAX_RSSI_VAL))
rssi = IWL_MIN_RSSI_VAL;
switch (mode) {
case MODE_IEEE80211G:
tpt_table = iwl_tpt_table_g;
table_size = ARRAY_SIZE(iwl_tpt_table_g);
tpt_table = iwl3945_tpt_table_g;
table_size = ARRAY_SIZE(iwl3945_tpt_table_g);
break;
case MODE_IEEE80211A:
tpt_table = iwl_tpt_table_a;
table_size = ARRAY_SIZE(iwl_tpt_table_a);
tpt_table = iwl3945_tpt_table_a;
table_size = ARRAY_SIZE(iwl3945_tpt_table_a);
break;
default:
case MODE_IEEE80211B:
tpt_table = iwl_tpt_table_b;
table_size = ARRAY_SIZE(iwl_tpt_table_b);
tpt_table = iwl3945_tpt_table_b;
table_size = ARRAY_SIZE(iwl3945_tpt_table_b);
break;
}
......@@ -164,7 +164,7 @@ static u8 iwl_get_rate_index_by_rssi(s32 rssi, u8 mode)
return tpt_table[index].index;
}
static void iwl_clear_window(struct iwl_rate_scale_data *window)
static void iwl3945_clear_window(struct iwl3945_rate_scale_data *window)
{
window->data = 0;
window->success_counter = 0;
......@@ -175,13 +175,13 @@ static void iwl_clear_window(struct iwl_rate_scale_data *window)
}
/**
* iwl_rate_scale_flush_windows - flush out the rate scale windows
* iwl3945_rate_scale_flush_windows - flush out the rate scale windows
*
* Returns the number of windows that have gathered data but were
* not flushed. If there were any that were not flushed, then
* reschedule the rate flushing routine.
*/
static int iwl_rate_scale_flush_windows(struct iwl_rate_scale_priv *rs_priv)
static int iwl3945_rate_scale_flush_windows(struct iwl3945_rate_scale_priv *rs_priv)
{
int unflushed = 0;
int i;
......@@ -202,7 +202,7 @@ static int iwl_rate_scale_flush_windows(struct iwl_rate_scale_priv *rs_priv)
IWL_DEBUG_RATE("flushing %d samples of rate "
"index %d\n",
rs_priv->win[i].counter, i);
iwl_clear_window(&rs_priv->win[i]);
iwl3945_clear_window(&rs_priv->win[i]);
} else
unflushed++;
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)
#define IWL_RATE_FLUSH_MAX 5000 /* msec */
#define IWL_RATE_FLUSH_MIN 50 /* msec */
static void iwl_bg_rate_scale_flush(unsigned long data)
static void iwl3945_bg_rate_scale_flush(unsigned long data)
{
struct iwl_rate_scale_priv *rs_priv = (void *)data;
struct iwl3945_rate_scale_priv *rs_priv = (void *)data;
int unflushed = 0;
unsigned long flags;
u32 packet_count, duration, pps;
IWL_DEBUG_RATE("enter\n");
unflushed = iwl_rate_scale_flush_windows(rs_priv);
unflushed = iwl3945_rate_scale_flush_windows(rs_priv);
spin_lock_irqsave(&rs_priv->lock, flags);
......@@ -277,14 +277,14 @@ static void iwl_bg_rate_scale_flush(unsigned long data)
}
/**
* iwl_collect_tx_data - Update the success/failure sliding window
* iwl3945_collect_tx_data - Update the success/failure sliding window
*
* We keep a sliding window of the last 64 packets transmitted
* at this rate. window->data contains the bitmask of successful
* packets.
*/
static void iwl_collect_tx_data(struct iwl_rate_scale_priv *rs_priv,
struct iwl_rate_scale_data *window,
static void iwl3945_collect_tx_data(struct iwl3945_rate_scale_priv *rs_priv,
struct iwl3945_rate_scale_data *window,
int success, int retries)
{
unsigned long flags;
......@@ -373,12 +373,12 @@ static void rs_clear(void *priv)
static void *rs_alloc_sta(void *priv, gfp_t gfp)
{
struct iwl_rate_scale_priv *rs_priv;
struct iwl3945_rate_scale_priv *rs_priv;
int i;
IWL_DEBUG_RATE("enter\n");
rs_priv = kzalloc(sizeof(struct iwl_rate_scale_priv), gfp);
rs_priv = kzalloc(sizeof(struct iwl3945_rate_scale_priv), gfp);
if (!rs_priv) {
IWL_DEBUG_RATE("leave: ENOMEM\n");
return NULL;
......@@ -389,7 +389,7 @@ static void *rs_alloc_sta(void *priv, gfp_t gfp)
rs_priv->start_rate = IWL_RATE_INVALID;
/* default to just 802.11b */
rs_priv->expected_tpt = iwl_expected_tpt_b;
rs_priv->expected_tpt = iwl3945_expected_tpt_b;
rs_priv->last_partial_flush = jiffies;
rs_priv->last_flush = jiffies;
......@@ -399,10 +399,10 @@ static void *rs_alloc_sta(void *priv, gfp_t gfp)
init_timer(&rs_priv->rate_scale_flush);
rs_priv->rate_scale_flush.data = (unsigned long)rs_priv;
rs_priv->rate_scale_flush.function = &iwl_bg_rate_scale_flush;
rs_priv->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush;
for (i = 0; i < IWL_RATE_COUNT; i++)
iwl_clear_window(&rs_priv->win[i]);
iwl3945_clear_window(&rs_priv->win[i]);
IWL_DEBUG_RATE("leave\n");
......@@ -411,7 +411,7 @@ static void *rs_alloc_sta(void *priv, gfp_t gfp)
static void rs_free_sta(void *priv, void *priv_sta)
{
struct iwl_rate_scale_priv *rs_priv = priv_sta;
struct iwl3945_rate_scale_priv *rs_priv = priv_sta;
IWL_DEBUG_RATE("enter\n");
del_timer_sync(&rs_priv->rate_scale_flush);
......@@ -425,9 +425,9 @@ static void rs_free_sta(void *priv, void *priv_sta)
* for A and B mode we need to overright prev
* value
*/
static int rs_adjust_next_rate(struct iwl_priv *priv, int rate)
static int rs_adjust_next_rate(struct iwl3945_priv *priv, int rate)
{
int next_rate = iwl_get_prev_ieee_rate(rate);
int next_rate = iwl3945_get_prev_ieee_rate(rate);
switch (priv->phymode) {
case MODE_IEEE80211A:
......@@ -449,7 +449,7 @@ static int rs_adjust_next_rate(struct iwl_priv *priv, int rate)
/**
* rs_tx_status - Update rate control values based on Tx results
*
* NOTE: Uses iwl_priv->retry_rate for the # of retries attempted by
* NOTE: Uses iwl3945_priv->retry_rate for the # of retries attempted by
* the hardware for each rate.
*/
static void rs_tx_status(void *priv_rate,
......@@ -462,9 +462,9 @@ static void rs_tx_status(void *priv_rate,
unsigned long flags;
struct sta_info *sta;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate;
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct iwl_rate_scale_priv *rs_priv;
struct iwl3945_rate_scale_priv *rs_priv;
IWL_DEBUG_RATE("enter\n");
......@@ -514,7 +514,7 @@ static void rs_tx_status(void *priv_rate,
/* Update this rate accounting for as many retries
* as was used for it (per current_count) */
iwl_collect_tx_data(rs_priv,
iwl3945_collect_tx_data(rs_priv,
&rs_priv->win[scale_rate_index],
0, current_count);
IWL_DEBUG_RATE("Update rate %d for %d retries.\n",
......@@ -533,7 +533,7 @@ static void rs_tx_status(void *priv_rate,
last_index,
(tx_resp->flags & IEEE80211_TX_STATUS_ACK) ?
"success" : "failure");
iwl_collect_tx_data(rs_priv,
iwl3945_collect_tx_data(rs_priv,
&rs_priv->win[last_index],
tx_resp->flags & IEEE80211_TX_STATUS_ACK, 1);
......@@ -560,8 +560,8 @@ static void rs_tx_status(void *priv_rate,
return;
}
static u16 iwl_get_adjacent_rate(struct iwl_rate_scale_priv *rs_priv,
u8 index, u16 rate_mask, int phymode)
static u16 iwl3945_get_adjacent_rate(struct iwl3945_rate_scale_priv *rs_priv,
u8 index, u16 rate_mask, int phymode)
{
u8 high = IWL_RATE_INVALID;
u8 low = IWL_RATE_INVALID;
......@@ -596,9 +596,9 @@ static u16 iwl_get_adjacent_rate(struct iwl_rate_scale_priv *rs_priv,
low = index;
while (low != IWL_RATE_INVALID) {
if (rs_priv->tgg)
low = iwl_rates[low].prev_rs_tgg;
low = iwl3945_rates[low].prev_rs_tgg;
else
low = iwl_rates[low].prev_rs;
low = iwl3945_rates[low].prev_rs;
if (low == IWL_RATE_INVALID)
break;
if (rate_mask & (1 << low))
......@@ -609,9 +609,9 @@ static u16 iwl_get_adjacent_rate(struct iwl_rate_scale_priv *rs_priv,
high = index;
while (high != IWL_RATE_INVALID) {
if (rs_priv->tgg)
high = iwl_rates[high].next_rs_tgg;
high = iwl3945_rates[high].next_rs_tgg;
else
high = iwl_rates[high].next_rs;
high = iwl3945_rates[high].next_rs;
if (high == IWL_RATE_INVALID)
break;
if (rate_mask & (1 << high))
......@@ -646,8 +646,8 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
u8 high = IWL_RATE_INVALID;
u16 high_low;
int index;
struct iwl_rate_scale_priv *rs_priv;
struct iwl_rate_scale_data *window = NULL;
struct iwl3945_rate_scale_priv *rs_priv;
struct iwl3945_rate_scale_data *window = NULL;
int current_tpt = IWL_INVALID_VALUE;
int low_tpt = IWL_INVALID_VALUE;
int high_tpt = IWL_INVALID_VALUE;
......@@ -658,7 +658,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct sta_info *sta;
u16 rate_mask;
struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate;
DECLARE_MAC_BUF(mac);
IWL_DEBUG_RATE("enter\n");
......@@ -682,12 +682,12 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) &&
!rs_priv->ibss_sta_added) {
u8 sta_id = iwl_hw_find_station(priv, hdr->addr1);
u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1);
if (sta_id == IWL_INVALID_STATION) {
IWL_DEBUG_RATE("LQ: ADD station %s\n",
print_mac(mac, hdr->addr1));
sta_id = iwl_add_station(priv,
sta_id = iwl3945_add_station(priv,
hdr->addr1, 0, CMD_ASYNC);
}
if (sta_id != IWL_INVALID_STATION)
......@@ -725,7 +725,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
rs_priv->expected_tpt[index] + 64) / 128);
current_tpt = window->average_tpt;
high_low = iwl_get_adjacent_rate(rs_priv, index, rate_mask,
high_low = iwl3945_get_adjacent_rate(rs_priv, index, rate_mask,
local->hw.conf.phymode);
low = high_low & 0xff;
high = (high_low >> 8) & 0xff;
......@@ -830,11 +830,11 @@ static struct rate_control_ops rs_ops = {
.free_sta = rs_free_sta,
};
int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
int iwl3945_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
{
struct ieee80211_local *local = hw_to_local(hw);
struct iwl_priv *priv = hw->priv;
struct iwl_rate_scale_priv *rs_priv;
struct iwl3945_priv *priv = hw->priv;
struct iwl3945_rate_scale_priv *rs_priv;
struct sta_info *sta;
unsigned long flags;
int count = 0, i;
......@@ -860,7 +860,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
int j;
count +=
sprintf(&buf[count], " %2dMbs: ", iwl_rates[i].ieee / 2);
sprintf(&buf[count], " %2dMbs: ", iwl3945_rates[i].ieee / 2);
mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1));
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)
samples += rs_priv->win[i].counter;
good += rs_priv->win[i].success_counter;
success += rs_priv->win[i].success_counter * iwl_rates[i].ieee;
success += rs_priv->win[i].success_counter * iwl3945_rates[i].ieee;
if (rs_priv->win[i].stamp) {
int delta =
......@@ -882,7 +882,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
} else
buf[count++] = '\n';
j = iwl_get_prev_ieee_rate(i);
j = iwl3945_get_prev_ieee_rate(i);
if (j == i)
break;
i = j;
......@@ -893,7 +893,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
/* Display the average rate of all samples taken.
*
* NOTE: We multiple # of samples by 2 since the IEEE measurement
* added from iwl_rates is actually 2X the rate */
* added from iwl3945_rates is actually 2X the rate */
if (samples)
count += sprintf(
&buf[count],
......@@ -907,13 +907,13 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
return count;
}
void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
{
struct iwl_priv *priv = hw->priv;
struct iwl3945_priv *priv = hw->priv;
s32 rssi = 0;
unsigned long flags;
struct ieee80211_local *local = hw_to_local(hw);
struct iwl_rate_scale_priv *rs_priv;
struct iwl3945_rate_scale_priv *rs_priv;
struct sta_info *sta;
IWL_DEBUG_RATE("enter\n");
......@@ -942,19 +942,19 @@ void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
case MODE_IEEE80211G:
if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) {
rs_priv->tgg = 1;
rs_priv->expected_tpt = iwl_expected_tpt_g_prot;
rs_priv->expected_tpt = iwl3945_expected_tpt_g_prot;
} else
rs_priv->expected_tpt = iwl_expected_tpt_g;
rs_priv->expected_tpt = iwl3945_expected_tpt_g;
break;
case MODE_IEEE80211A:
rs_priv->expected_tpt = iwl_expected_tpt_a;
rs_priv->expected_tpt = iwl3945_expected_tpt_a;
break;
default:
IWL_WARNING("Invalid phymode. Defaulting to 802.11b\n");
case MODE_IEEE80211B:
rs_priv->expected_tpt = iwl_expected_tpt_b;
rs_priv->expected_tpt = iwl3945_expected_tpt_b;
break;
}
......@@ -967,19 +967,19 @@ void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
IWL_DEBUG(IWL_DL_INFO | IWL_DL_RATE, "Network RSSI: %d\n", rssi);
rs_priv->start_rate = iwl_get_rate_index_by_rssi(rssi, priv->phymode);
rs_priv->start_rate = iwl3945_get_rate_index_by_rssi(rssi, priv->phymode);
IWL_DEBUG_RATE("leave: rssi %d assign rate index: "
"%d (plcp 0x%x)\n", rssi, rs_priv->start_rate,
iwl_rates[rs_priv->start_rate].plcp);
iwl3945_rates[rs_priv->start_rate].plcp);
}
void iwl_rate_control_register(struct ieee80211_hw *hw)
void iwl3945_rate_control_register(struct ieee80211_hw *hw)
{
ieee80211_rate_control_register(&rs_ops);
}
void iwl_rate_control_unregister(struct ieee80211_hw *hw)
void iwl3945_rate_control_unregister(struct ieee80211_hw *hw)
{
ieee80211_rate_control_unregister(&rs_ops);
}
......
......@@ -27,7 +27,7 @@
#ifndef __iwl_3945_rs_h__
#define __iwl_3945_rs_h__
struct iwl_rate_info {
struct iwl3945_rate_info {
u8 plcp;
u8 ieee;
u8 prev_ieee; /* previous rate in IEEE speeds */
......@@ -159,11 +159,11 @@ enum {
#define IWL_MIN_RSSI_VAL -100
#define IWL_MAX_RSSI_VAL 0
extern const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT];
extern const struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT];
static inline u8 iwl_get_prev_ieee_rate(u8 rate_index)
static inline u8 iwl3945_get_prev_ieee_rate(u8 rate_index)
{
u8 rate = iwl_rates[rate_index].prev_ieee;
u8 rate = iwl3945_rates[rate_index].prev_ieee;
if (rate == IWL_RATE_INVALID)
rate = rate_index;
......@@ -171,40 +171,40 @@ static inline u8 iwl_get_prev_ieee_rate(u8 rate_index)
}
/**
* iwl_fill_rs_info - Fill an output text buffer with the rate representation
* iwl3945_fill_rs_info - Fill an output text buffer with the rate representation
*
* NOTE: This is provided as a quick mechanism for a user to visualize
* the performance of the rate control algorithm and is not meant to be
* parsed software.
*/
extern int iwl_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id);
extern int iwl3945_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id);
/**
* iwl_rate_scale_init - Initialize the rate scale table based on assoc info
* iwl3945_rate_scale_init - Initialize the rate scale table based on assoc info
*
* The specific throughput table used is based on the type of network
* the associated with, including A, B, G, and G w/ TGG protection
*/
extern void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id);
extern void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id);
/**
* iwl_rate_control_register - Register the rate control algorithm callbacks
* iwl3945_rate_control_register - Register the rate control algorithm callbacks
*
* Since the rate control algorithm is hardware specific, there is no need
* or reason to place it as a stand alone module. The driver can call
* iwl_rate_control_register in order to register the rate control callbacks
* iwl3945_rate_control_register in order to register the rate control callbacks
* with the mac80211 subsystem. This should be performed prior to calling
* ieee80211_register_hw
*
*/
extern void iwl_rate_control_register(struct ieee80211_hw *hw);
extern void iwl3945_rate_control_register(struct ieee80211_hw *hw);
/**
* iwl_rate_control_unregister - Unregister the rate control callbacks
* iwl3945_rate_control_unregister - Unregister the rate control callbacks
*
* This should be called after calling ieee80211_unregister_hw, but before
* the driver is unloaded.
*/
extern void iwl_rate_control_unregister(struct ieee80211_hw *hw);
extern void iwl3945_rate_control_unregister(struct ieee80211_hw *hw);
#endif
......@@ -63,7 +63,7 @@
* maps to IWL_RATE_INVALID
*
*/
const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = {
const struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT] = {
IWL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */
IWL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */
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] = {
IWL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */
};
/* 1 = enable the iwl_disable_events() function */
/* 1 = enable the iwl3945_disable_events() function */
#define IWL_EVT_DISABLE (0)
#define IWL_EVT_DISABLE_SIZE (1532/32)
/**
* iwl_disable_events - Disable selected events in uCode event log
* iwl3945_disable_events - Disable selected events in uCode event log
*
* Disable an event by writing "1"s into "disable"
* bitmap in SRAM. Bit position corresponds to Event # (id/type).
......@@ -91,7 +91,7 @@ const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = {
* Use for only special debugging. This function is just a placeholder as-is,
* you'll need to provide the special bits! ...
* ... and set IWL_EVT_DISABLE to 1. */
void iwl_disable_events(struct iwl_priv *priv)
void iwl3945_disable_events(struct iwl3945_priv *priv)
{
int ret;
int i;
......@@ -149,31 +149,31 @@ void iwl_disable_events(struct iwl_priv *priv)
};
base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
if (!iwl_hw_valid_rtc_data_addr(base)) {
if (!iwl3945_hw_valid_rtc_data_addr(base)) {
IWL_ERROR("Invalid event log pointer 0x%08X\n", base);
return;
}
ret = iwl_grab_nic_access(priv);
ret = iwl3945_grab_nic_access(priv);
if (ret) {
IWL_WARNING("Can not read from adapter at this time.\n");
return;
}
disable_ptr = iwl_read_targ_mem(priv, base + (4 * sizeof(u32)));
array_size = iwl_read_targ_mem(priv, base + (5 * sizeof(u32)));
iwl_release_nic_access(priv);
disable_ptr = iwl3945_read_targ_mem(priv, base + (4 * sizeof(u32)));
array_size = iwl3945_read_targ_mem(priv, base + (5 * sizeof(u32)));
iwl3945_release_nic_access(priv);
if (IWL_EVT_DISABLE && (array_size == IWL_EVT_DISABLE_SIZE)) {
IWL_DEBUG_INFO("Disabling selected uCode log events at 0x%x\n",
disable_ptr);
ret = iwl_grab_nic_access(priv);
ret = iwl3945_grab_nic_access(priv);
for (i = 0; i < IWL_EVT_DISABLE_SIZE; i++)
iwl_write_targ_mem(priv,
iwl3945_write_targ_mem(priv,
disable_ptr + (i * sizeof(u32)),
evt_disable[i]);
iwl_release_nic_access(priv);
iwl3945_release_nic_access(priv);
} else {
IWL_DEBUG_INFO("Selected uCode log events may be disabled\n");
IWL_DEBUG_INFO(" by writing \"1\"s into disable bitmap\n");
......@@ -194,7 +194,7 @@ void iwl_disable_events(struct iwl_priv *priv)
* IWL_ANTENNA_MAIN - Force MAIN antenna
* IWL_ANTENNA_AUX - Force AUX antenna
*/
__le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv)
__le32 iwl3945_get_antenna_flags(const struct iwl3945_priv *priv)
{
switch (priv->antenna) {
case IWL_ANTENNA_DIVERSITY:
......@@ -226,11 +226,11 @@ __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv)
*
*****************************************************************************/
void iwl_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb)
{
struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
IWL_DEBUG_RX("Statistics notification received (%d vs %d).\n",
(int)sizeof(struct iwl_notif_statistics),
(int)sizeof(struct iwl3945_notif_statistics),
le32_to_cpu(pkt->len));
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)
priv->last_statistics_time = jiffies;
}
static void iwl3945_handle_data_packet(struct iwl_priv *priv, int is_data,
struct iwl_rx_mem_buffer *rxb,
static void iwl3945_handle_data_packet(struct iwl3945_priv *priv, int is_data,
struct iwl3945_rx_mem_buffer *rxb,
struct ieee80211_rx_status *stats,
u16 phy_flags)
{
struct ieee80211_hdr *hdr;
struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
struct iwl_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
struct iwl_rx_frame_end *rx_end = IWL_RX_END(pkt);
struct iwl3945_rx_packet *pkt = (struct iwl3945_rx_packet *)rxb->skb->data;
struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt);
short len = le16_to_cpu(rx_hdr->len);
/* 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,
return;
}
if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) {
if (iwl_param_hwcrypto)
iwl_set_decrypted_flag(priv, rxb->skb,
if (iwl3945_param_hwcrypto)
iwl3945_set_decrypted_flag(priv, rxb->skb,
le32_to_cpu(rx_end->status),
stats);
iwl_handle_data_packet_monitor(priv, rxb, IWL_RX_DATA(pkt),
iwl3945_handle_data_packet_monitor(priv, rxb, IWL_RX_DATA(pkt),
len, stats, phy_flags);
return;
}
......@@ -277,21 +277,21 @@ static void iwl3945_handle_data_packet(struct iwl_priv *priv, int is_data,
hdr = (void *)rxb->skb->data;
if (iwl_param_hwcrypto)
iwl_set_decrypted_flag(priv, rxb->skb,
if (iwl3945_param_hwcrypto)
iwl3945_set_decrypted_flag(priv, rxb->skb,
le32_to_cpu(rx_end->status), stats);
ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats);
rxb->skb = NULL;
}
static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
struct iwl_rx_mem_buffer *rxb)
static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
struct iwl3945_rx_mem_buffer *rxb)
{
struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
struct iwl_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt);
struct iwl_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
struct iwl_rx_frame_end *rx_end = IWL_RX_END(pkt);
struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
struct iwl3945_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt);
struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt);
struct ieee80211_hdr *header;
u16 phy_flags = le16_to_cpu(rx_hdr->phy_flags);
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,
* Calculate stats.signal (quality indicator in %) based on SNR. */
if (rx_stats_noise_diff) {
snr = rx_stats_sig_avg / rx_stats_noise_diff;
stats.noise = stats.ssi - iwl_calc_db_from_ratio(snr);
stats.signal = iwl_calc_sig_qual(stats.ssi, stats.noise);
stats.noise = stats.ssi - iwl3945_calc_db_from_ratio(snr);
stats.signal = iwl3945_calc_sig_qual(stats.ssi, stats.noise);
/* If noise info not available, calculate signal quality indicator (%)
* using just the dBm signal level. */
} else {
stats.noise = priv->last_rx_noise;
stats.signal = iwl_calc_sig_qual(stats.ssi, 0);
stats.signal = iwl3945_calc_sig_qual(stats.ssi, 0);
}
......@@ -364,24 +364,24 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
stats.freq = ieee80211chan2mhz(stats.channel);
/* can be covered by iwl_report_frame() in most cases */
/* can be covered by iwl3945_report_frame() in most cases */
/* IWL_DEBUG_RX("RX status: 0x%08X\n", rx_end->status); */
header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt);
network_packet = iwl_is_network_packet(priv, header);
network_packet = iwl3945_is_network_packet(priv, header);
#ifdef CONFIG_IWL3945_DEBUG
if (iwl_debug_level & IWL_DL_STATS && net_ratelimit())
if (iwl3945_debug_level & IWL_DL_STATS && net_ratelimit())
IWL_DEBUG_STATS
("[%c] %d RSSI: %d Signal: %u, Noise: %u, Rate: %u\n",
network_packet ? '*' : ' ',
stats.channel, stats.ssi, stats.ssi,
stats.ssi, stats.rate);
if (iwl_debug_level & (IWL_DL_RX))
if (iwl3945_debug_level & (IWL_DL_RX))
/* Set "1" to report good data frames in groups of 100 */
iwl_report_frame(priv, pkt, header, 1);
iwl3945_report_frame(priv, pkt, header, 1);
#endif
if (network_packet) {
......@@ -481,7 +481,7 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
DECLARE_MAC_BUF(mac2);
DECLARE_MAC_BUF(mac3);
if (unlikely(is_duplicate_packet(priv, header)))
if (unlikely(iwl3945_is_duplicate_packet(priv, header)))
IWL_DEBUG_DROP("Dropping (dup): %s, %s, %s\n",
print_mac(mac1, header->addr1),
print_mac(mac2, header->addr2),
......@@ -494,12 +494,12 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
}
}
int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr,
int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl3945_priv *priv, void *ptr,
dma_addr_t addr, u16 len)
{
int count;
u32 pad;
struct iwl_tfd_frame *tfd = (struct iwl_tfd_frame *)ptr;
struct iwl3945_tfd_frame *tfd = (struct iwl3945_tfd_frame *)ptr;
count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));
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,
}
/**
* iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr]
* iwl3945_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr]
*
* Does NOT advance any indexes
*/
int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
int iwl3945_hw_txq_free_tfd(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq)
{
struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0];
struct iwl_tfd_frame *bd = &bd_tmp[txq->q.read_ptr];
struct iwl3945_tfd_frame *bd_tmp = (struct iwl3945_tfd_frame *)&txq->bd[0];
struct iwl3945_tfd_frame *bd = &bd_tmp[txq->q.read_ptr];
struct pci_dev *dev = priv->pci_dev;
int i;
int counter;
......@@ -564,7 +564,7 @@ int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
return 0;
}
u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *addr)
u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *addr)
{
int i;
int ret = IWL_INVALID_STATION;
......@@ -588,11 +588,11 @@ u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *addr)
}
/**
* iwl_hw_build_tx_cmd_rate - Add rate portion to TX_CMD:
* iwl3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD:
*
*/
void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
struct iwl_cmd *cmd,
void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
struct iwl3945_cmd *cmd,
struct ieee80211_tx_control *ctrl,
struct ieee80211_hdr *hdr, int sta_id, int tx_id)
{
......@@ -605,7 +605,7 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
__le32 tx_flags;
u16 fc = le16_to_cpu(hdr->frame_control);
rate = iwl_rates[rate_index].plcp;
rate = iwl3945_rates[rate_index].plcp;
tx_flags = cmd->cmd.tx.tx_flags;
/* 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,
cmd->cmd.tx.supp_rates[1], cmd->cmd.tx.supp_rates[0]);
}
u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags)
u8 iwl3945_sync_sta(struct iwl3945_priv *priv, int sta_id, u16 tx_rate, u8 flags)
{
unsigned long flags_spin;
struct iwl_station_entry *station;
struct iwl3945_station_entry *station;
if (sta_id == IWL_INVALID_STATION)
return IWL_INVALID_STATION;
......@@ -690,19 +690,19 @@ u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags)
spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
iwl_send_add_station(priv, &station->sta, flags);
iwl3945_send_add_station(priv, &station->sta, flags);
IWL_DEBUG_RATE("SCALE sync station %d to rate %d\n",
sta_id, tx_rate);
return sta_id;
}
static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max)
static int iwl3945_nic_set_pwr_src(struct iwl3945_priv *priv, int pwr_max)
{
int rc;
unsigned long flags;
spin_lock_irqsave(&priv->lock, flags);
rc = iwl_grab_nic_access(priv);
rc = iwl3945_grab_nic_access(priv);
if (rc) {
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
......@@ -714,23 +714,23 @@ static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max)
rc = pci_read_config_dword(priv->pci_dev,
PCI_POWER_SOURCE, &val);
if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) {
iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
iwl3945_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
~APMG_PS_CTRL_MSK_PWR_SRC);
iwl_release_nic_access(priv);
iwl3945_release_nic_access(priv);
iwl_poll_bit(priv, CSR_GPIO_IN,
iwl3945_poll_bit(priv, CSR_GPIO_IN,
CSR_GPIO_IN_VAL_VAUX_PWR_SRC,
CSR_GPIO_IN_BIT_AUX_POWER, 5000);
} else
iwl_release_nic_access(priv);
iwl3945_release_nic_access(priv);
} else {
iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
iwl3945_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
~APMG_PS_CTRL_MSK_PWR_SRC);
iwl_release_nic_access(priv);
iwl_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC,
iwl3945_release_nic_access(priv);
iwl3945_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC,
CSR_GPIO_IN_BIT_AUX_POWER, 5000); /* uS */
}
spin_unlock_irqrestore(&priv->lock, flags);
......@@ -738,24 +738,24 @@ static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max)
return rc;
}
static int iwl3945_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
static int iwl3945_rx_init(struct iwl3945_priv *priv, struct iwl3945_rx_queue *rxq)
{
int rc;
unsigned long flags;
spin_lock_irqsave(&priv->lock, flags);
rc = iwl_grab_nic_access(priv);
rc = iwl3945_grab_nic_access(priv);
if (rc) {
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
}
iwl_write_direct32(priv, FH_RCSR_RBD_BASE(0), rxq->dma_addr);
iwl_write_direct32(priv, FH_RCSR_RPTR_ADDR(0),
iwl3945_write_direct32(priv, FH_RCSR_RBD_BASE(0), rxq->dma_addr);
iwl3945_write_direct32(priv, FH_RCSR_RPTR_ADDR(0),
priv->hw_setting.shared_phys +
offsetof(struct iwl_shared, rx_read_ptr[0]));
iwl_write_direct32(priv, FH_RCSR_WPTR(0), 0);
iwl_write_direct32(priv, FH_RCSR_CONFIG(0),
offsetof(struct iwl3945_shared, rx_read_ptr[0]));
iwl3945_write_direct32(priv, FH_RCSR_WPTR(0), 0);
iwl3945_write_direct32(priv, FH_RCSR_CONFIG(0),
ALM_FH_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE |
ALM_FH_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE |
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)
ALM_FH_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH);
/* fake read to flush all prev I/O */
iwl_read_direct32(priv, FH_RSSR_CTRL);
iwl3945_read_direct32(priv, FH_RSSR_CTRL);
iwl_release_nic_access(priv);
iwl3945_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
return 0;
}
static int iwl3945_tx_reset(struct iwl_priv *priv)
static int iwl3945_tx_reset(struct iwl3945_priv *priv)
{
int rc;
unsigned long flags;
spin_lock_irqsave(&priv->lock, flags);
rc = iwl_grab_nic_access(priv);
rc = iwl3945_grab_nic_access(priv);
if (rc) {
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
}
/* bypass mode */
iwl_write_prph(priv, ALM_SCD_MODE_REG, 0x2);
iwl3945_write_prph(priv, ALM_SCD_MODE_REG, 0x2);
/* RA 0 is active */
iwl_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01);
iwl3945_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01);
/* all 6 fifo are active */
iwl_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f);
iwl3945_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f);
iwl_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000);
iwl_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002);
iwl_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004);
iwl_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005);
iwl3945_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000);
iwl3945_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002);
iwl3945_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004);
iwl3945_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005);
iwl_write_direct32(priv, FH_TSSR_CBB_BASE,
iwl3945_write_direct32(priv, FH_TSSR_CBB_BASE,
priv->hw_setting.shared_phys);
iwl_write_direct32(priv, FH_TSSR_MSG_CONFIG,
iwl3945_write_direct32(priv, FH_TSSR_MSG_CONFIG,
ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON |
ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON |
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)
ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH |
ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH);
iwl_release_nic_access(priv);
iwl3945_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
return 0;
......@@ -823,12 +823,12 @@ static int iwl3945_tx_reset(struct iwl_priv *priv)
*
* Destroys all DMA structures and initialize them again
*/
static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)
static int iwl3945_txq_ctx_reset(struct iwl3945_priv *priv)
{
int rc;
int txq_id, slots_num;
iwl_hw_txq_ctx_free(priv);
iwl3945_hw_txq_ctx_free(priv);
/* Tx CMD queue */
rc = iwl3945_tx_reset(priv);
......@@ -839,7 +839,7 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)
for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++) {
slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ?
TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
rc = iwl3945_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
txq_id);
if (rc) {
IWL_ERROR("Tx %d queue init failed\n", txq_id);
......@@ -850,26 +850,26 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)
return rc;
error:
iwl_hw_txq_ctx_free(priv);
iwl3945_hw_txq_ctx_free(priv);
return rc;
}
int iwl_hw_nic_init(struct iwl_priv *priv)
int iwl3945_hw_nic_init(struct iwl3945_priv *priv)
{
u8 rev_id;
int rc;
unsigned long flags;
struct iwl_rx_queue *rxq = &priv->rxq;
struct iwl3945_rx_queue *rxq = &priv->rxq;
iwl_power_init_handle(priv);
iwl3945_power_init_handle(priv);
spin_lock_irqsave(&priv->lock, flags);
iwl_set_bit(priv, CSR_ANA_PLL_CFG, (1 << 24));
iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS,
iwl3945_set_bit(priv, CSR_ANA_PLL_CFG, (1 << 24));
iwl3945_set_bit(priv, CSR_GIO_CHICKEN_BITS,
CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX);
iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
rc = iwl_poll_bit(priv, CSR_GP_CNTRL,
iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
rc = iwl3945_poll_bit(priv, CSR_GP_CNTRL,
CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
if (rc < 0) {
......@@ -878,18 +878,18 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
return rc;
}
rc = iwl_grab_nic_access(priv);
rc = iwl3945_grab_nic_access(priv);
if (rc) {
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
}
iwl_write_prph(priv, APMG_CLK_EN_REG,
iwl3945_write_prph(priv, APMG_CLK_EN_REG,
APMG_CLK_VAL_DMA_CLK_RQT |
APMG_CLK_VAL_BSM_CLK_RQT);
udelay(20);
iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
iwl3945_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
iwl_release_nic_access(priv);
iwl3945_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
/* Determine HW type */
......@@ -905,25 +905,25 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
IWL_DEBUG_INFO("RTP type \n");
else if (rev_id & PCI_CFG_REV_ID_BIT_BASIC_SKU) {
IWL_DEBUG_INFO("ALM-MB type\n");
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MB);
} else {
IWL_DEBUG_INFO("ALM-MM type\n");
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MM);
}
spin_unlock_irqrestore(&priv->lock, flags);
/* Initialize the EEPROM */
rc = iwl_eeprom_init(priv);
rc = iwl3945_eeprom_init(priv);
if (rc)
return rc;
spin_lock_irqsave(&priv->lock, flags);
if (EEPROM_SKU_CAP_OP_MODE_MRC == priv->eeprom.sku_cap) {
IWL_DEBUG_INFO("SKU OP mode is mrc\n");
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_SKU_MRC);
} else
IWL_DEBUG_INFO("SKU OP mode is basic\n");
......@@ -931,24 +931,24 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
if ((priv->eeprom.board_revision & 0xF0) == 0xD0) {
IWL_DEBUG_INFO("3945ABG revision is 0x%X\n",
priv->eeprom.board_revision);
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE);
} else {
IWL_DEBUG_INFO("3945ABG revision is 0x%X\n",
priv->eeprom.board_revision);
iwl_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
iwl3945_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE);
}
if (priv->eeprom.almgor_m_version <= 1) {
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A);
IWL_DEBUG_INFO("Card M type A version is 0x%X\n",
priv->eeprom.almgor_m_version);
} else {
IWL_DEBUG_INFO("Card M type B version is 0x%X\n",
priv->eeprom.almgor_m_version);
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B);
}
spin_unlock_irqrestore(&priv->lock, flags);
......@@ -961,15 +961,15 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
/* Allocate the RX queue, or reset if it is already allocated */
if (!rxq->bd) {
rc = iwl_rx_queue_alloc(priv);
rc = iwl3945_rx_queue_alloc(priv);
if (rc) {
IWL_ERROR("Unable to initialize Rx queue\n");
return -ENOMEM;
}
} else
iwl_rx_queue_reset(priv, rxq);
iwl3945_rx_queue_reset(priv, rxq);
iwl_rx_replenish(priv);
iwl3945_rx_replenish(priv);
iwl3945_rx_init(priv, rxq);
......@@ -977,16 +977,16 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
/* Look at using this instead:
rxq->need_update = 1;
iwl_rx_queue_update_write_ptr(priv, rxq);
iwl3945_rx_queue_update_write_ptr(priv, rxq);
*/
rc = iwl_grab_nic_access(priv);
rc = iwl3945_grab_nic_access(priv);
if (rc) {
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
}
iwl_write_direct32(priv, FH_RCSR_WPTR(0), rxq->write & ~7);
iwl_release_nic_access(priv);
iwl3945_write_direct32(priv, FH_RCSR_WPTR(0), rxq->write & ~7);
iwl3945_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
......@@ -1000,49 +1000,49 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
}
/**
* iwl_hw_txq_ctx_free - Free TXQ Context
* iwl3945_hw_txq_ctx_free - Free TXQ Context
*
* Destroy all TX DMA queues and structures
*/
void iwl_hw_txq_ctx_free(struct iwl_priv *priv)
void iwl3945_hw_txq_ctx_free(struct iwl3945_priv *priv)
{
int txq_id;
/* Tx queues */
for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++)
iwl_tx_queue_free(priv, &priv->txq[txq_id]);
iwl3945_tx_queue_free(priv, &priv->txq[txq_id]);
}
void iwl_hw_txq_ctx_stop(struct iwl_priv *priv)
void iwl3945_hw_txq_ctx_stop(struct iwl3945_priv *priv)
{
int queue;
unsigned long flags;
spin_lock_irqsave(&priv->lock, flags);
if (iwl_grab_nic_access(priv)) {
if (iwl3945_grab_nic_access(priv)) {
spin_unlock_irqrestore(&priv->lock, flags);
iwl_hw_txq_ctx_free(priv);
iwl3945_hw_txq_ctx_free(priv);
return;
}
/* stop SCD */
iwl_write_prph(priv, ALM_SCD_MODE_REG, 0);
iwl3945_write_prph(priv, ALM_SCD_MODE_REG, 0);
/* reset TFD queues */
for (queue = TFD_QUEUE_MIN; queue < TFD_QUEUE_MAX; queue++) {
iwl_write_direct32(priv, FH_TCSR_CONFIG(queue), 0x0);
iwl_poll_direct_bit(priv, FH_TSSR_TX_STATUS,
iwl3945_write_direct32(priv, FH_TCSR_CONFIG(queue), 0x0);
iwl3945_poll_direct_bit(priv, FH_TSSR_TX_STATUS,
ALM_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(queue),
1000);
}
iwl_release_nic_access(priv);
iwl3945_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
iwl_hw_txq_ctx_free(priv);
iwl3945_hw_txq_ctx_free(priv);
}
int iwl_hw_nic_stop_master(struct iwl_priv *priv)
int iwl3945_hw_nic_stop_master(struct iwl3945_priv *priv)
{
int rc = 0;
u32 reg_val;
......@@ -1051,16 +1051,16 @@ int iwl_hw_nic_stop_master(struct iwl_priv *priv)
spin_lock_irqsave(&priv->lock, flags);
/* set stop master bit */
iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
iwl3945_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
reg_val = iwl_read32(priv, CSR_GP_CNTRL);
reg_val = iwl3945_read32(priv, CSR_GP_CNTRL);
if (CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE ==
(reg_val & CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE))
IWL_DEBUG_INFO("Card in power save, master is already "
"stopped\n");
else {
rc = iwl_poll_bit(priv, CSR_RESET,
rc = iwl3945_poll_bit(priv, CSR_RESET,
CSR_RESET_REG_FLAG_MASTER_DISABLED,
CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
if (rc < 0) {
......@@ -1075,47 +1075,47 @@ int iwl_hw_nic_stop_master(struct iwl_priv *priv)
return rc;
}
int iwl_hw_nic_reset(struct iwl_priv *priv)
int iwl3945_hw_nic_reset(struct iwl3945_priv *priv)
{
int rc;
unsigned long flags;
iwl_hw_nic_stop_master(priv);
iwl3945_hw_nic_stop_master(priv);
spin_lock_irqsave(&priv->lock, flags);
iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
iwl3945_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
rc = iwl_poll_bit(priv, CSR_GP_CNTRL,
rc = iwl3945_poll_bit(priv, CSR_GP_CNTRL,
CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
rc = iwl_grab_nic_access(priv);
rc = iwl3945_grab_nic_access(priv);
if (!rc) {
iwl_write_prph(priv, APMG_CLK_CTRL_REG,
iwl3945_write_prph(priv, APMG_CLK_CTRL_REG,
APMG_CLK_VAL_BSM_CLK_RQT);
udelay(10);
iwl_set_bit(priv, CSR_GP_CNTRL,
iwl3945_set_bit(priv, CSR_GP_CNTRL,
CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
iwl_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0);
iwl_write_prph(priv, APMG_RTC_INT_STT_REG,
iwl3945_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0);
iwl3945_write_prph(priv, APMG_RTC_INT_STT_REG,
0xFFFFFFFF);
/* enable DMA */
iwl_write_prph(priv, APMG_CLK_EN_REG,
iwl3945_write_prph(priv, APMG_CLK_EN_REG,
APMG_CLK_VAL_DMA_CLK_RQT |
APMG_CLK_VAL_BSM_CLK_RQT);
udelay(10);
iwl_set_bits_prph(priv, APMG_PS_CTRL_REG,
iwl3945_set_bits_prph(priv, APMG_PS_CTRL_REG,
APMG_PS_CTRL_VAL_RESET_REQ);
udelay(5);
iwl_clear_bits_prph(priv, APMG_PS_CTRL_REG,
iwl3945_clear_bits_prph(priv, APMG_PS_CTRL_REG,
APMG_PS_CTRL_VAL_RESET_REQ);
iwl_release_nic_access(priv);
iwl3945_release_nic_access(priv);
}
/* Clear the 'host command active' bit... */
......@@ -1128,43 +1128,43 @@ int iwl_hw_nic_reset(struct iwl_priv *priv)
}
/**
* iwl_hw_reg_adjust_power_by_temp
* iwl3945_hw_reg_adjust_power_by_temp
* return index delta into power gain settings table
*/
static int iwl_hw_reg_adjust_power_by_temp(int new_reading, int old_reading)
static int iwl3945_hw_reg_adjust_power_by_temp(int new_reading, int old_reading)
{
return (new_reading - old_reading) * (-11) / 100;
}
/**
* iwl_hw_reg_temp_out_of_range - Keep temperature in sane range
* iwl3945_hw_reg_temp_out_of_range - Keep temperature in sane range
*/
static inline int iwl_hw_reg_temp_out_of_range(int temperature)
static inline int iwl3945_hw_reg_temp_out_of_range(int temperature)
{
return (((temperature < -260) || (temperature > 25)) ? 1 : 0);
}
int iwl_hw_get_temperature(struct iwl_priv *priv)
int iwl3945_hw_get_temperature(struct iwl3945_priv *priv)
{
return iwl_read32(priv, CSR_UCODE_DRV_GP2);
return iwl3945_read32(priv, CSR_UCODE_DRV_GP2);
}
/**
* iwl_hw_reg_txpower_get_temperature
* iwl3945_hw_reg_txpower_get_temperature
* get the current temperature by reading from NIC
*/
static int iwl_hw_reg_txpower_get_temperature(struct iwl_priv *priv)
static int iwl3945_hw_reg_txpower_get_temperature(struct iwl3945_priv *priv)
{
int temperature;
temperature = iwl_hw_get_temperature(priv);
temperature = iwl3945_hw_get_temperature(priv);
/* driver's okay range is -260 to +25.
* human readable okay range is 0 to +285 */
IWL_DEBUG_INFO("Temperature: %d\n", temperature + IWL_TEMP_CONVERT);
/* handle insane temp reading */
if (iwl_hw_reg_temp_out_of_range(temperature)) {
if (iwl3945_hw_reg_temp_out_of_range(temperature)) {
IWL_ERROR("Error bad temperature value %d\n", temperature);
/* if really really hot(?),
......@@ -1189,11 +1189,11 @@ static int iwl_hw_reg_txpower_get_temperature(struct iwl_priv *priv)
* records new temperature in tx_mgr->temperature.
* replaces tx_mgr->last_temperature *only* if calib needed
* (assumes caller will actually do the calibration!). */
static int is_temp_calib_needed(struct iwl_priv *priv)
static int is_temp_calib_needed(struct iwl3945_priv *priv)
{
int temp_diff;
priv->temperature = iwl_hw_reg_txpower_get_temperature(priv);
priv->temperature = iwl3945_hw_reg_txpower_get_temperature(priv);
temp_diff = priv->temperature - priv->last_temperature;
/* get absolute value */
......@@ -1225,7 +1225,7 @@ static int is_temp_calib_needed(struct iwl_priv *priv)
/* radio and DSP power table, each step is 1/2 dB.
* 1st number is for RF analog gain, 2nd number is for DSP pre-DAC gain. */
static struct iwl_tx_power power_gain_table[2][IWL_MAX_GAIN_ENTRIES] = {
static struct iwl3945_tx_power power_gain_table[2][IWL_MAX_GAIN_ENTRIES] = {
{
{251, 127}, /* 2.4 GHz, highest power */
{251, 127},
......@@ -1386,7 +1386,7 @@ static struct iwl_tx_power power_gain_table[2][IWL_MAX_GAIN_ENTRIES] = {
{3, 120} } /* 5.x GHz, lowest power */
};
static inline u8 iwl_hw_reg_fix_power_index(int index)
static inline u8 iwl3945_hw_reg_fix_power_index(int index)
{
if (index < 0)
return 0;
......@@ -1399,17 +1399,17 @@ static inline u8 iwl_hw_reg_fix_power_index(int index)
#define REG_RECALIB_PERIOD (60)
/**
* iwl_hw_reg_set_scan_power - Set Tx power for scan probe requests
* iwl3945_hw_reg_set_scan_power - Set Tx power for scan probe requests
*
* Set (in our channel info database) the direct scan Tx power for 1 Mbit (CCK)
* or 6 Mbit (OFDM) rates.
*/
static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index,
static void iwl3945_hw_reg_set_scan_power(struct iwl3945_priv *priv, u32 scan_tbl_index,
s32 rate_index, const s8 *clip_pwrs,
struct iwl_channel_info *ch_info,
struct iwl3945_channel_info *ch_info,
int band_index)
{
struct iwl_scan_power_info *scan_power_info;
struct iwl3945_scan_power_info *scan_power_info;
s8 power;
u8 power_index;
......@@ -1445,7 +1445,7 @@ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index,
* of the table. */
/* don't exceed table bounds for "real" setting */
power_index = iwl_hw_reg_fix_power_index(power_index);
power_index = iwl3945_hw_reg_fix_power_index(power_index);
scan_power_info->power_table_index = power_index;
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,
}
/**
* iwl_hw_reg_send_txpower - fill in Tx Power command with gain settings
* iwl3945_hw_reg_send_txpower - fill in Tx Power command with gain settings
*
* Configures power settings for all rates for the current channel,
* using values from channel info struct, and send to NIC
*/
int iwl_hw_reg_send_txpower(struct iwl_priv *priv)
int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv)
{
int rate_idx, i;
const struct iwl_channel_info *ch_info = NULL;
struct iwl_txpowertable_cmd txpower = {
const struct iwl3945_channel_info *ch_info = NULL;
struct iwl3945_txpowertable_cmd txpower = {
.channel = priv->active_rxon.channel,
};
txpower.band = (priv->phymode == MODE_IEEE80211A) ? 0 : 1;
ch_info = iwl_get_channel_info(priv,
ch_info = iwl3945_get_channel_info(priv,
priv->phymode,
le16_to_cpu(priv->active_rxon.channel));
if (!ch_info) {
......@@ -1491,7 +1491,7 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv)
rate_idx <= IWL_LAST_OFDM_RATE; rate_idx++, i++) {
txpower.power[i].tpc = ch_info->power_info[i].tpc;
txpower.power[i].rate = iwl_rates[rate_idx].plcp;
txpower.power[i].rate = iwl3945_rates[rate_idx].plcp;
IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n",
le16_to_cpu(txpower.channel),
......@@ -1504,7 +1504,7 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv)
for (rate_idx = IWL_FIRST_CCK_RATE;
rate_idx <= IWL_LAST_CCK_RATE; rate_idx++, i++) {
txpower.power[i].tpc = ch_info->power_info[i].tpc;
txpower.power[i].rate = iwl_rates[rate_idx].plcp;
txpower.power[i].rate = iwl3945_rates[rate_idx].plcp;
IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n",
le16_to_cpu(txpower.channel),
......@@ -1514,13 +1514,13 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv)
txpower.power[i].rate);
}
return iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD,
sizeof(struct iwl_txpowertable_cmd), &txpower);
return iwl3945_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD,
sizeof(struct iwl3945_txpowertable_cmd), &txpower);
}
/**
* iwl_hw_reg_set_new_power - Configures power tables at new levels
* iwl3945_hw_reg_set_new_power - Configures power tables at new levels
* @ch_info: Channel to update. Uses power_info.requested_power.
*
* 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)
* properly fill out the scan powers, and actual h/w gain settings,
* and send changes to NIC
*/
static int iwl_hw_reg_set_new_power(struct iwl_priv *priv,
struct iwl_channel_info *ch_info)
static int iwl3945_hw_reg_set_new_power(struct iwl3945_priv *priv,
struct iwl3945_channel_info *ch_info)
{
struct iwl_channel_power_info *power_info;
struct iwl3945_channel_power_info *power_info;
int power_changed = 0;
int i;
const s8 *clip_pwrs;
......@@ -1578,7 +1578,7 @@ static int iwl_hw_reg_set_new_power(struct iwl_priv *priv,
ch_info->power_info[IWL_RATE_12M_INDEX_TABLE].
requested_power + IWL_CCK_FROM_OFDM_POWER_DIFF;
/* do all CCK rates' iwl_channel_power_info structures */
/* do all CCK rates' iwl3945_channel_power_info structures */
for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++) {
power_info->requested_power = power;
power_info->base_power_index =
......@@ -1592,13 +1592,13 @@ static int iwl_hw_reg_set_new_power(struct iwl_priv *priv,
}
/**
* iwl_hw_reg_get_ch_txpower_limit - returns new power limit for channel
* iwl3945_hw_reg_get_ch_txpower_limit - returns new power limit for channel
*
* NOTE: Returned power limit may be less (but not more) than requested,
* based strictly on regulatory (eeprom and spectrum mgt) limitations
* (no consideration for h/w clipping limitations).
*/
static int iwl_hw_reg_get_ch_txpower_limit(struct iwl_channel_info *ch_info)
static int iwl3945_hw_reg_get_ch_txpower_limit(struct iwl3945_channel_info *ch_info)
{
s8 max_power;
......@@ -1617,7 +1617,7 @@ static int iwl_hw_reg_get_ch_txpower_limit(struct iwl_channel_info *ch_info)
}
/**
* iwl_hw_reg_comp_txpower_temp - Compensate for temperature
* iwl3945_hw_reg_comp_txpower_temp - Compensate for temperature
*
* Compensate txpower settings of *all* channels for temperature.
* 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)
*
* If RxOn is "associated", this sends the new Txpower to NIC!
*/
static int iwl_hw_reg_comp_txpower_temp(struct iwl_priv *priv)
static int iwl3945_hw_reg_comp_txpower_temp(struct iwl3945_priv *priv)
{
struct iwl_channel_info *ch_info = NULL;
struct iwl3945_channel_info *ch_info = NULL;
int delta_index;
const s8 *clip_pwrs; /* array of h/w max power levels for each rate */
u8 a_band;
......@@ -1649,7 +1649,7 @@ static int iwl_hw_reg_comp_txpower_temp(struct iwl_priv *priv)
/* get power index adjustment based on curr and factory
* temps */
delta_index = iwl_hw_reg_adjust_power_by_temp(temperature,
delta_index = iwl3945_hw_reg_adjust_power_by_temp(temperature,
ref_temp);
/* 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)
power_idx += delta_index;
/* stay within table range */
power_idx = iwl_hw_reg_fix_power_index(power_idx);
power_idx = iwl3945_hw_reg_fix_power_index(power_idx);
ch_info->power_info[rate_index].
power_table_index = (u8) power_idx;
ch_info->power_info[rate_index].tpc =
......@@ -1677,19 +1677,19 @@ static int iwl_hw_reg_comp_txpower_temp(struct iwl_priv *priv)
scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) {
s32 actual_index = (scan_tbl_index == 0) ?
IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE;
iwl_hw_reg_set_scan_power(priv, scan_tbl_index,
iwl3945_hw_reg_set_scan_power(priv, scan_tbl_index,
actual_index, clip_pwrs,
ch_info, a_band);
}
}
/* send Txpower command for current channel to ucode */
return iwl_hw_reg_send_txpower(priv);
return iwl3945_hw_reg_send_txpower(priv);
}
int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power)
int iwl3945_hw_reg_set_txpower(struct iwl3945_priv *priv, s8 power)
{
struct iwl_channel_info *ch_info;
struct iwl3945_channel_info *ch_info;
s8 max_power;
u8 a_band;
u8 i;
......@@ -1711,26 +1711,26 @@ int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power)
/* find minimum power of all user and regulatory constraints
* (does not consider h/w clipping limitations) */
max_power = iwl_hw_reg_get_ch_txpower_limit(ch_info);
max_power = iwl3945_hw_reg_get_ch_txpower_limit(ch_info);
max_power = min(power, max_power);
if (max_power != ch_info->curr_txpow) {
ch_info->curr_txpow = max_power;
/* this considers the h/w clipping limitations */
iwl_hw_reg_set_new_power(priv, ch_info);
iwl3945_hw_reg_set_new_power(priv, ch_info);
}
}
/* update txpower settings for all channels,
* send to NIC if associated. */
is_temp_calib_needed(priv);
iwl_hw_reg_comp_txpower_temp(priv);
iwl3945_hw_reg_comp_txpower_temp(priv);
return 0;
}
/* will add 3945 channel switch cmd handling later */
int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel)
int iwl3945_hw_channel_switch(struct iwl3945_priv *priv, u16 channel)
{
return 0;
}
......@@ -1745,17 +1745,17 @@ int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel)
* -- send new set of gain settings to NIC
* NOTE: This should continue working, even when we're not associated,
* so we can keep our internal table of scan powers current. */
void iwl3945_reg_txpower_periodic(struct iwl_priv *priv)
void iwl3945_reg_txpower_periodic(struct iwl3945_priv *priv)
{
/* This will kick in the "brute force"
* iwl_hw_reg_comp_txpower_temp() below */
* iwl3945_hw_reg_comp_txpower_temp() below */
if (!is_temp_calib_needed(priv))
goto reschedule;
/* Set up a new set of temp-adjusted TxPowers, send to NIC.
* This is based *only* on current temperature,
* ignoring any previous power measurements */
iwl_hw_reg_comp_txpower_temp(priv);
iwl3945_hw_reg_comp_txpower_temp(priv);
reschedule:
queue_delayed_work(priv->workqueue,
......@@ -1764,7 +1764,7 @@ void iwl3945_reg_txpower_periodic(struct iwl_priv *priv)
static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work)
{
struct iwl_priv *priv = container_of(work, struct iwl_priv,
struct iwl3945_priv *priv = container_of(work, struct iwl3945_priv,
thermal_periodic.work);
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
......@@ -1776,7 +1776,7 @@ static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work)
}
/**
* iwl_hw_reg_get_ch_grp_index - find the channel-group index (0-4)
* iwl3945_hw_reg_get_ch_grp_index - find the channel-group index (0-4)
* for the channel.
*
* This function is used when initializing channel-info structs.
......@@ -1786,10 +1786,10 @@ static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work)
* on A-band, EEPROM's "group frequency" entries represent the top
* channel in each group 1-4. Group 5 All B/G channels are in group 0.
*/
static u16 iwl_hw_reg_get_ch_grp_index(struct iwl_priv *priv,
const struct iwl_channel_info *ch_info)
static u16 iwl3945_hw_reg_get_ch_grp_index(struct iwl3945_priv *priv,
const struct iwl3945_channel_info *ch_info)
{
struct iwl_eeprom_txpower_group *ch_grp = &priv->eeprom.groups[0];
struct iwl3945_eeprom_txpower_group *ch_grp = &priv->eeprom.groups[0];
u8 group;
u16 group_index = 0; /* based on factory calib frequencies */
u8 grp_channel;
......@@ -1815,20 +1815,20 @@ static u16 iwl_hw_reg_get_ch_grp_index(struct iwl_priv *priv,
}
/**
* iwl_hw_reg_get_matched_power_index - Interpolate to get nominal index
* iwl3945_hw_reg_get_matched_power_index - Interpolate to get nominal index
*
* Interpolate to get nominal (i.e. at factory calibration temperature) index
* into radio/DSP gain settings table for requested power.
*/
static int iwl_hw_reg_get_matched_power_index(struct iwl_priv *priv,
static int iwl3945_hw_reg_get_matched_power_index(struct iwl3945_priv *priv,
s8 requested_power,
s32 setting_index, s32 *new_index)
{
const struct iwl_eeprom_txpower_group *chnl_grp = NULL;
const struct iwl3945_eeprom_txpower_group *chnl_grp = NULL;
s32 index0, index1;
s32 power = 2 * requested_power;
s32 i;
const struct iwl_eeprom_txpower_sample *samples;
const struct iwl3945_eeprom_txpower_sample *samples;
s32 gains0, gains1;
s32 res;
s32 denominator;
......@@ -1868,11 +1868,11 @@ static int iwl_hw_reg_get_matched_power_index(struct iwl_priv *priv,
return 0;
}
static void iwl_hw_reg_init_channel_groups(struct iwl_priv *priv)
static void iwl3945_hw_reg_init_channel_groups(struct iwl3945_priv *priv)
{
u32 i;
s32 rate_index;
const struct iwl_eeprom_txpower_group *group;
const struct iwl3945_eeprom_txpower_group *group;
IWL_DEBUG_POWER("Initializing factory calib info from EEPROM\n");
......@@ -1948,10 +1948,10 @@ static void iwl_hw_reg_init_channel_groups(struct iwl_priv *priv)
*
* This does *not* write values to NIC, just sets up our internal table.
*/
int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv)
{
struct iwl_channel_info *ch_info = NULL;
struct iwl_channel_power_info *pwr_info;
struct iwl3945_channel_info *ch_info = NULL;
struct iwl3945_channel_power_info *pwr_info;
int delta_index;
u8 rate_index;
u8 scan_tbl_index;
......@@ -1964,10 +1964,10 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
/* save temperature reference,
* so we can determine next time to calibrate */
temperature = iwl_hw_reg_txpower_get_temperature(priv);
temperature = iwl3945_hw_reg_txpower_get_temperature(priv);
priv->last_temperature = temperature;
iwl_hw_reg_init_channel_groups(priv);
iwl3945_hw_reg_init_channel_groups(priv);
/* initialize Tx power info for each and every channel, 2.4 and 5.x */
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)
/* find this channel's channel group (*not* "band") index */
ch_info->group_index =
iwl_hw_reg_get_ch_grp_index(priv, ch_info);
iwl3945_hw_reg_get_ch_grp_index(priv, ch_info);
/* Get this chnlgrp's rate->max/clip-powers table */
clip_pwrs = priv->clip_groups[ch_info->group_index].clip_powers;
/* calculate power index *adjustment* value according to
* diff between current temperature and factory temperature */
delta_index = iwl_hw_reg_adjust_power_by_temp(temperature,
delta_index = iwl3945_hw_reg_adjust_power_by_temp(temperature,
priv->eeprom.groups[ch_info->group_index].
temperature);
......@@ -2008,7 +2008,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
/* get base (i.e. at factory-measured temperature)
* power table index for this rate's power */
rc = iwl_hw_reg_get_matched_power_index(priv, pwr,
rc = iwl3945_hw_reg_get_matched_power_index(priv, pwr,
ch_info->group_index,
&power_idx);
if (rc) {
......@@ -2021,9 +2021,9 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
power_idx += delta_index;
/* stay within range of gain table */
power_idx = iwl_hw_reg_fix_power_index(power_idx);
power_idx = iwl3945_hw_reg_fix_power_index(power_idx);
/* fill 1 OFDM rate's iwl_channel_power_info struct */
/* fill 1 OFDM rate's iwl3945_channel_power_info struct */
pwr_info->requested_power = pwr;
pwr_info->power_table_index = (u8) power_idx;
pwr_info->tpc.tx_gain =
......@@ -2042,11 +2042,11 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
IWL_CCK_FROM_OFDM_INDEX_DIFF;
/* stay within table range */
pwr_index = iwl_hw_reg_fix_power_index(pwr_index);
pwr_index = iwl3945_hw_reg_fix_power_index(pwr_index);
gain = power_gain_table[a_band][pwr_index].tx_gain;
dsp_atten = power_gain_table[a_band][pwr_index].dsp_atten;
/* fill each CCK rate's iwl_channel_power_info structure
/* fill each CCK rate's iwl3945_channel_power_info structure
* NOTE: All CCK-rate Txpwrs are the same for a given chnl!
* NOTE: CCK rates start at end of OFDM rates! */
for (rate_index = 0;
......@@ -2064,7 +2064,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) {
s32 actual_index = (scan_tbl_index == 0) ?
IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE;
iwl_hw_reg_set_scan_power(priv, scan_tbl_index,
iwl3945_hw_reg_set_scan_power(priv, scan_tbl_index,
actual_index, clip_pwrs, ch_info, a_band);
}
}
......@@ -2072,66 +2072,66 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
return 0;
}
int iwl_hw_rxq_stop(struct iwl_priv *priv)
int iwl3945_hw_rxq_stop(struct iwl3945_priv *priv)
{
int rc;
unsigned long flags;
spin_lock_irqsave(&priv->lock, flags);
rc = iwl_grab_nic_access(priv);
rc = iwl3945_grab_nic_access(priv);
if (rc) {
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
}
iwl_write_direct32(priv, FH_RCSR_CONFIG(0), 0);
rc = iwl_poll_direct_bit(priv, FH_RSSR_STATUS, (1 << 24), 1000);
iwl3945_write_direct32(priv, FH_RCSR_CONFIG(0), 0);
rc = iwl3945_poll_direct_bit(priv, FH_RSSR_STATUS, (1 << 24), 1000);
if (rc < 0)
IWL_ERROR("Can't stop Rx DMA.\n");
iwl_release_nic_access(priv);
iwl3945_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
return 0;
}
int iwl_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq)
int iwl3945_hw_tx_queue_init(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq)
{
int rc;
unsigned long flags;
int txq_id = txq->q.id;
struct iwl_shared *shared_data = priv->hw_setting.shared_virt;
struct iwl3945_shared *shared_data = priv->hw_setting.shared_virt;
shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr);
spin_lock_irqsave(&priv->lock, flags);
rc = iwl_grab_nic_access(priv);
rc = iwl3945_grab_nic_access(priv);
if (rc) {
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
}
iwl_write_direct32(priv, FH_CBCC_CTRL(txq_id), 0);
iwl_write_direct32(priv, FH_CBCC_BASE(txq_id), 0);
iwl3945_write_direct32(priv, FH_CBCC_CTRL(txq_id), 0);
iwl3945_write_direct32(priv, FH_CBCC_BASE(txq_id), 0);
iwl_write_direct32(priv, FH_TCSR_CONFIG(txq_id),
iwl3945_write_direct32(priv, FH_TCSR_CONFIG(txq_id),
ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT |
ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF |
ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD |
ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL |
ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE);
iwl_release_nic_access(priv);
iwl3945_release_nic_access(priv);
/* fake read to flush all prev. writes */
iwl_read32(priv, FH_TSSR_CBB_BASE);
iwl3945_read32(priv, FH_TSSR_CBB_BASE);
spin_unlock_irqrestore(&priv->lock, flags);
return 0;
}
int iwl_hw_get_rx_read(struct iwl_priv *priv)
int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv)
{
struct iwl_shared *shared_data = priv->hw_setting.shared_virt;
struct iwl3945_shared *shared_data = priv->hw_setting.shared_virt;
return le32_to_cpu(shared_data->rx_read_ptr[0]);
}
......@@ -2139,22 +2139,22 @@ int iwl_hw_get_rx_read(struct iwl_priv *priv)
/**
* iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table
*/
int iwl3945_init_hw_rate_table(struct iwl_priv *priv)
int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv)
{
int rc, i, index, prev_index;
struct iwl_rate_scaling_cmd rate_cmd = {
struct iwl3945_rate_scaling_cmd rate_cmd = {
.reserved = {0, 0, 0},
};
struct iwl_rate_scaling_info *table = rate_cmd.table;
struct iwl3945_rate_scaling_info *table = rate_cmd.table;
for (i = 0; i < ARRAY_SIZE(iwl_rates); i++) {
index = iwl_rates[i].table_rs_index;
for (i = 0; i < ARRAY_SIZE(iwl3945_rates); i++) {
index = iwl3945_rates[i].table_rs_index;
table[index].rate_n_flags =
iwl_hw_set_rate_n_flags(iwl_rates[i].plcp, 0);
iwl3945_hw_set_rate_n_flags(iwl3945_rates[i].plcp, 0);
table[index].try_cnt = priv->retry_rate;
prev_index = iwl_get_prev_ieee_rate(i);
table[index].next_rate_index = iwl_rates[prev_index].table_rs_index;
prev_index = iwl3945_get_prev_ieee_rate(i);
table[index].next_rate_index = iwl3945_rates[prev_index].table_rs_index;
}
switch (priv->phymode) {
......@@ -2163,14 +2163,14 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv)
/* If one of the following CCK rates is used,
* have it fall back to the 6M OFDM rate */
for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++)
table[i].next_rate_index = iwl_rates[IWL_FIRST_OFDM_RATE].table_rs_index;
table[i].next_rate_index = iwl3945_rates[IWL_FIRST_OFDM_RATE].table_rs_index;
/* Don't fall back to CCK rates */
table[IWL_RATE_12M_INDEX_TABLE].next_rate_index = IWL_RATE_9M_INDEX_TABLE;
/* Don't drop out of OFDM rates */
table[IWL_RATE_6M_INDEX_TABLE].next_rate_index =
iwl_rates[IWL_FIRST_OFDM_RATE].table_rs_index;
iwl3945_rates[IWL_FIRST_OFDM_RATE].table_rs_index;
break;
case MODE_IEEE80211B:
......@@ -2178,7 +2178,7 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv)
/* If an OFDM rate is used, have it fall back to the
* 1M CCK rates */
for (i = IWL_RATE_6M_INDEX_TABLE; i <= IWL_RATE_54M_INDEX_TABLE; i++)
table[i].next_rate_index = iwl_rates[IWL_FIRST_CCK_RATE].table_rs_index;
table[i].next_rate_index = iwl3945_rates[IWL_FIRST_CCK_RATE].table_rs_index;
/* CCK shouldn't fall back to OFDM... */
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)
/* Update the rate scaling for control frame Tx */
rate_cmd.table_id = 0;
rc = iwl_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
rc = iwl3945_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
&rate_cmd);
if (rc)
return rc;
/* Update the rate scaling for data frame Tx */
rate_cmd.table_id = 1;
return iwl_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
return iwl3945_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
&rate_cmd);
}
int iwl_hw_set_hw_setting(struct iwl_priv *priv)
int iwl3945_hw_set_hw_setting(struct iwl3945_priv *priv)
{
memset((void *)&priv->hw_setting, 0,
sizeof(struct iwl_driver_hw_info));
sizeof(struct iwl3945_driver_hw_info));
priv->hw_setting.shared_virt =
pci_alloc_consistent(priv->pci_dev,
sizeof(struct iwl_shared),
sizeof(struct iwl3945_shared),
&priv->hw_setting.shared_phys);
if (!priv->hw_setting.shared_virt) {
......@@ -2220,7 +2220,7 @@ int iwl_hw_set_hw_setting(struct iwl_priv *priv)
priv->hw_setting.ac_queue_count = AC_NUM;
priv->hw_setting.rx_buffer_size = IWL_RX_BUF_SIZE;
priv->hw_setting.tx_cmd_len = sizeof(struct iwl_tx_cmd);
priv->hw_setting.tx_cmd_len = sizeof(struct iwl3945_tx_cmd);
priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE;
priv->hw_setting.max_rxq_log = RX_QUEUE_SIZE_LOG;
priv->hw_setting.max_stations = IWL3945_STATION_COUNT;
......@@ -2228,21 +2228,21 @@ int iwl_hw_set_hw_setting(struct iwl_priv *priv)
return 0;
}
unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
struct iwl_frame *frame, u8 rate)
unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv,
struct iwl3945_frame *frame, u8 rate)
{
struct iwl_tx_beacon_cmd *tx_beacon_cmd;
struct iwl3945_tx_beacon_cmd *tx_beacon_cmd;
unsigned int frame_size;
tx_beacon_cmd = (struct iwl_tx_beacon_cmd *)&frame->u;
tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u;
memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd));
tx_beacon_cmd->tx.sta_id = IWL3945_BROADCAST_ID;
tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
frame_size = iwl_fill_beacon_frame(priv,
frame_size = iwl3945_fill_beacon_frame(priv,
tx_beacon_cmd->frame,
BROADCAST_ADDR,
iwl3945_broadcast_addr,
sizeof(frame->u) - sizeof(*tx_beacon_cmd));
BUG_ON(frame_size > MAX_MPDU_SIZE);
......@@ -2259,35 +2259,35 @@ unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
tx_beacon_cmd->tx.supp_rates[1] =
(IWL_CCK_BASIC_RATES_MASK & 0xF);
return (sizeof(struct iwl_tx_beacon_cmd) + frame_size);
return (sizeof(struct iwl3945_tx_beacon_cmd) + frame_size);
}
void iwl_hw_rx_handler_setup(struct iwl_priv *priv)
void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv)
{
priv->rx_handlers[REPLY_3945_RX] = iwl3945_rx_reply_rx;
}
void iwl_hw_setup_deferred_work(struct iwl_priv *priv)
void iwl3945_hw_setup_deferred_work(struct iwl3945_priv *priv)
{
INIT_DELAYED_WORK(&priv->thermal_periodic,
iwl3945_bg_reg_txpower_periodic);
}
void iwl_hw_cancel_deferred_work(struct iwl_priv *priv)
void iwl3945_hw_cancel_deferred_work(struct iwl3945_priv *priv)
{
cancel_delayed_work(&priv->thermal_periodic);
}
struct pci_device_id iwl_hw_card_ids[] = {
struct pci_device_id iwl3945_hw_card_ids[] = {
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4222)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4227)},
{0}
};
inline int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv)
inline int iwl3945_eeprom_acquire_semaphore(struct iwl3945_priv *priv)
{
_iwl_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK);
_iwl3945_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK);
return 0;
}
MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
MODULE_DEVICE_TABLE(pci, iwl3945_hw_card_ids);
......@@ -31,10 +31,10 @@
#include <linux/kernel.h>
#include <net/ieee80211_radiotap.h>
struct iwl_priv;
struct iwl3945_priv;
/* Hardware specific file defines the PCI IDs table for that hardware module */
extern struct pci_device_id iwl_hw_card_ids[];
extern struct pci_device_id iwl3945_hw_card_ids[];
#define DRV_NAME "iwl3945"
#include "iwl-3945-hw.h"
......@@ -55,10 +55,10 @@ extern struct pci_device_id iwl_hw_card_ids[];
#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127)
/* Module parameters accessible from iwl-*.c */
extern int iwl_param_hwcrypto;
extern int iwl_param_queues_num;
extern int iwl3945_param_hwcrypto;
extern int iwl3945_param_queues_num;
enum iwl_antenna {
enum iwl3945_antenna {
IWL_ANTENNA_DIVERSITY,
IWL_ANTENNA_MAIN,
IWL_ANTENNA_AUX
......@@ -81,13 +81,13 @@ enum iwl_antenna {
#define DEFAULT_SHORT_RETRY_LIMIT 7U
#define DEFAULT_LONG_RETRY_LIMIT 4U
struct iwl_rx_mem_buffer {
struct iwl3945_rx_mem_buffer {
dma_addr_t dma_addr;
struct sk_buff *skb;
struct list_head list;
};
struct iwl_rt_rx_hdr {
struct iwl3945_rt_rx_hdr {
struct ieee80211_radiotap_header rt_hdr;
__le64 rt_tsf; /* TSF */
u8 rt_flags; /* radiotap packet flags */
......@@ -100,7 +100,7 @@ struct iwl_rt_rx_hdr {
u8 payload[0]; /* payload... */
} __attribute__ ((packed));
struct iwl_rt_tx_hdr {
struct iwl3945_rt_tx_hdr {
struct ieee80211_radiotap_header rt_hdr;
u8 rt_rate; /* rate in 500kb/s */
__le16 rt_channel; /* channel in mHz */
......@@ -115,7 +115,7 @@ struct iwl_rt_tx_hdr {
*
* Contains common data for Rx and Tx queues
*/
struct iwl_queue {
struct iwl3945_queue {
int n_bd; /* number of BDs in this queue */
int write_ptr; /* 1-st empty entry (index) host_w*/
int read_ptr; /* last used entry (index) host_r*/
......@@ -130,24 +130,24 @@ struct iwl_queue {
#define MAX_NUM_OF_TBS (20)
struct iwl_tx_info {
struct iwl3945_tx_info {
struct ieee80211_tx_status status;
struct sk_buff *skb[MAX_NUM_OF_TBS];
};
/**
* struct iwl_tx_queue - Tx Queue for DMA
* struct iwl3945_tx_queue - Tx Queue for DMA
* @need_update: need to update read/write index
* @shed_retry: queue is HT AGG enabled
*
* Queue consists of circular buffer of BD's and required locking structures.
*/
struct iwl_tx_queue {
struct iwl_queue q;
struct iwl_tfd_frame *bd;
struct iwl_cmd *cmd;
struct iwl3945_tx_queue {
struct iwl3945_queue q;
struct iwl3945_tfd_frame *bd;
struct iwl3945_cmd *cmd;
dma_addr_t dma_addr_cmd;
struct iwl_tx_info *txb;
struct iwl3945_tx_info *txb;
int need_update;
int sched_retry;
int active;
......@@ -155,12 +155,12 @@ struct iwl_tx_queue {
#define IWL_NUM_SCAN_RATES (2)
struct iwl_channel_tgd_info {
struct iwl3945_channel_tgd_info {
u8 type;
s8 max_power;
};
struct iwl_channel_tgh_info {
struct iwl3945_channel_tgh_info {
s64 last_radar_time;
};
......@@ -171,8 +171,8 @@ struct iwl_channel_tgh_info {
* -- spectrum management
* -- user preference (e.g. iwconfig)
* when requested power is set, base power index must also be set. */
struct iwl_channel_power_info {
struct iwl_tx_power tpc; /* actual radio and DSP gain settings */
struct iwl3945_channel_power_info {
struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */
s8 power_table_index; /* actual (compenst'd) index into gain table */
s8 base_power_index; /* gain index for power at factory temp. */
s8 requested_power; /* power (dBm) requested for this chnl/rate */
......@@ -180,8 +180,8 @@ struct iwl_channel_power_info {
/* current scan Tx power values to use, one for each scan rate for each
* channel. */
struct iwl_scan_power_info {
struct iwl_tx_power tpc; /* actual radio and DSP gain settings */
struct iwl3945_scan_power_info {
struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */
s8 power_table_index; /* actual (compenst'd) index into gain table */
s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */
};
......@@ -201,11 +201,11 @@ struct iwl_scan_power_info {
*/
#define IWL4965_MAX_RATE (33)
struct iwl_channel_info {
struct iwl_channel_tgd_info tgd;
struct iwl_channel_tgh_info tgh;
struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */
struct iwl_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for
struct iwl3945_channel_info {
struct iwl3945_channel_tgd_info tgd;
struct iwl3945_channel_tgh_info tgh;
struct iwl3945_eeprom_channel eeprom; /* EEPROM regulatory limit */
struct iwl3945_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for
* FAT channel */
u8 channel; /* channel number */
......@@ -222,13 +222,13 @@ struct iwl_channel_info {
/* Radio/DSP gain settings for each "normal" data Tx rate.
* These include, in addition to RF and DSP gain, a few fields for
* remembering/modifying gain settings (indexes). */
struct iwl_channel_power_info power_info[IWL4965_MAX_RATE];
struct iwl3945_channel_power_info power_info[IWL4965_MAX_RATE];
/* Radio/DSP gain settings for each scan rate, for directed scans. */
struct iwl_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES];
struct iwl3945_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES];
};
struct iwl_clip_group {
struct iwl3945_clip_group {
/* maximum power level to prevent clipping for each rate, derived by
* us from this band's saturation power in EEPROM */
const s8 clip_powers[IWL_MAX_RATES];
......@@ -249,8 +249,8 @@ struct iwl_clip_group {
/* Power management (not Tx power) structures */
struct iwl_power_vec_entry {
struct iwl_powertable_cmd cmd;
struct iwl3945_power_vec_entry {
struct iwl3945_powertable_cmd cmd;
u8 no_dtim;
};
#define IWL_POWER_RANGE_0 (0)
......@@ -266,10 +266,10 @@ struct iwl_power_vec_entry {
#define IWL_POWER_ENABLED 0x10
#define IWL_POWER_LEVEL(x) ((x) & IWL_POWER_MASK)
struct iwl_power_mgr {
struct iwl3945_power_mgr {
spinlock_t lock;
struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC];
struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC];
struct iwl3945_power_vec_entry pwr_range_0[IWL_POWER_AC];
struct iwl3945_power_vec_entry pwr_range_1[IWL_POWER_AC];
u8 active_index;
u32 dtim_val;
};
......@@ -279,10 +279,10 @@ struct iwl_power_mgr {
#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
struct iwl_frame {
struct iwl3945_frame {
union {
struct ieee80211_hdr frame;
struct iwl_tx_beacon_cmd beacon;
struct iwl3945_tx_beacon_cmd beacon;
u8 raw[IEEE80211_FRAME_LEN];
u8 cmd[360];
} u;
......@@ -308,15 +308,15 @@ enum {
CMD_WANT_SKB = (1 << 2),
};
struct iwl_cmd;
struct iwl_priv;
struct iwl3945_cmd;
struct iwl3945_priv;
struct iwl_cmd_meta {
struct iwl_cmd_meta *source;
struct iwl3945_cmd_meta {
struct iwl3945_cmd_meta *source;
union {
struct sk_buff *skb;
int (*callback)(struct iwl_priv *priv,
struct iwl_cmd *cmd, struct sk_buff *skb);
int (*callback)(struct iwl3945_priv *priv,
struct iwl3945_cmd *cmd, struct sk_buff *skb);
} __attribute__ ((packed)) u;
/* The CMD_SIZE_HUGE flag bit indicates that the command
......@@ -325,37 +325,37 @@ struct iwl_cmd_meta {
} __attribute__ ((packed));
struct iwl_cmd {
struct iwl_cmd_meta meta;
struct iwl_cmd_header hdr;
struct iwl3945_cmd {
struct iwl3945_cmd_meta meta;
struct iwl3945_cmd_header hdr;
union {
struct iwl_addsta_cmd addsta;
struct iwl_led_cmd led;
struct iwl3945_addsta_cmd addsta;
struct iwl3945_led_cmd led;
u32 flags;
u8 val8;
u16 val16;
u32 val32;
struct iwl_bt_cmd bt;
struct iwl_rxon_time_cmd rxon_time;
struct iwl_powertable_cmd powertable;
struct iwl_qosparam_cmd qosparam;
struct iwl_tx_cmd tx;
struct iwl_tx_beacon_cmd tx_beacon;
struct iwl_rxon_assoc_cmd rxon_assoc;
struct iwl3945_bt_cmd bt;
struct iwl3945_rxon_time_cmd rxon_time;
struct iwl3945_powertable_cmd powertable;
struct iwl3945_qosparam_cmd qosparam;
struct iwl3945_tx_cmd tx;
struct iwl3945_tx_beacon_cmd tx_beacon;
struct iwl3945_rxon_assoc_cmd rxon_assoc;
u8 *indirect;
u8 payload[360];
} __attribute__ ((packed)) cmd;
} __attribute__ ((packed));
struct iwl_host_cmd {
struct iwl3945_host_cmd {
u8 id;
u16 len;
struct iwl_cmd_meta meta;
struct iwl3945_cmd_meta meta;
const void *data;
};
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \
sizeof(struct iwl_cmd_meta))
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl3945_cmd) - \
sizeof(struct iwl3945_cmd_meta))
/*
* RX related structures and functions
......@@ -368,7 +368,7 @@ struct iwl_host_cmd {
#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
/**
* struct iwl_rx_queue - Rx queue
* struct iwl3945_rx_queue - Rx queue
* @processed: Internal index to last handled Rx packet
* @read: Shared index to newest available Rx buffer
* @write: Shared index to oldest written Rx packet
......@@ -377,13 +377,13 @@ struct iwl_host_cmd {
* @rx_used: List of Rx buffers with no SKB
* @need_update: flag to indicate we need to update read/write index
*
* NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers
* NOTE: rx_free and rx_used are used as a FIFO for iwl3945_rx_mem_buffers
*/
struct iwl_rx_queue {
struct iwl3945_rx_queue {
__le32 *bd;
dma_addr_t dma_addr;
struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE];
struct iwl3945_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
struct iwl3945_rx_mem_buffer *queue[RX_QUEUE_SIZE];
u32 processed;
u32 read;
u32 write;
......@@ -427,17 +427,17 @@ struct iwl_rx_queue {
#define IWL_INVALID_RATE 0xFF
#define IWL_INVALID_VALUE -1
struct iwl_tid_data {
struct iwl3945_tid_data {
u16 seq_number;
};
struct iwl_hw_key {
struct iwl3945_hw_key {
enum ieee80211_key_alg alg;
int keylen;
u8 key[32];
};
union iwl_ht_rate_supp {
union iwl3945_ht_rate_supp {
u16 rates;
struct {
u8 siso_rate;
......@@ -472,7 +472,7 @@ struct sta_ht_info {
#ifdef CONFIG_IWL3945_QOS
union iwl_qos_capabity {
union iwl3945_qos_capabity {
struct {
u8 edca_count:4; /* bit 0-3 */
u8 q_ack:1; /* bit 4 */
......@@ -493,20 +493,20 @@ union iwl_qos_capabity {
};
/* QoS structures */
struct iwl_qos_info {
struct iwl3945_qos_info {
int qos_enable;
int qos_active;
union iwl_qos_capabity qos_cap;
struct iwl_qosparam_cmd def_qos_parm;
union iwl3945_qos_capabity qos_cap;
struct iwl3945_qosparam_cmd def_qos_parm;
};
#endif /*CONFIG_IWL3945_QOS */
#define STA_PS_STATUS_WAKE 0
#define STA_PS_STATUS_SLEEP 1
struct iwl_station_entry {
struct iwl_addsta_cmd sta;
struct iwl_tid_data tid[MAX_TID_COUNT];
struct iwl3945_station_entry {
struct iwl3945_addsta_cmd sta;
struct iwl3945_tid_data tid[MAX_TID_COUNT];
union {
struct {
u8 rate;
......@@ -516,7 +516,7 @@ struct iwl_station_entry {
} current_rate;
u8 used;
u8 ps_status;
struct iwl_hw_key keyinfo;
struct iwl3945_hw_key keyinfo;
};
/* one for each uCode image (inst/data, boot/init/runtime) */
......@@ -527,7 +527,7 @@ struct fw_desc {
};
/* uCode file layout */
struct iwl_ucode {
struct iwl3945_ucode {
__le32 ver; /* major/minor/subminor */
__le32 inst_size; /* bytes of runtime instructions */
__le32 data_size; /* bytes of runtime data */
......@@ -539,7 +539,7 @@ struct iwl_ucode {
#define IWL_IBSS_MAC_HASH_SIZE 32
struct iwl_ibss_seq {
struct iwl3945_ibss_seq {
u8 mac[ETH_ALEN];
u16 seq_num;
u16 frag_num;
......@@ -547,7 +547,7 @@ struct iwl_ibss_seq {
struct list_head list;
};
struct iwl_driver_hw_info {
struct iwl3945_driver_hw_info {
u16 max_txq_num;
u16 ac_queue_count;
u16 tx_cmd_len;
......@@ -573,10 +573,10 @@ struct iwl_driver_hw_info {
#define HT_SHORT_GI_40MHZ_ONLY (1 << 1)
#define IWL_RX_HDR(x) ((struct iwl_rx_frame_hdr *)(\
#define IWL_RX_HDR(x) ((struct iwl3945_rx_frame_hdr *)(\
x->u.rx_frame.stats.payload + \
x->u.rx_frame.stats.phy_count))
#define IWL_RX_END(x) ((struct iwl_rx_frame_end *)(\
#define IWL_RX_END(x) ((struct iwl3945_rx_frame_end *)(\
IWL_RX_HDR(x)->payload + \
le16_to_cpu(IWL_RX_HDR(x)->len)))
#define IWL_RX_STATS(x) (&x->u.rx_frame.stats)
......@@ -589,61 +589,61 @@ struct iwl_driver_hw_info {
* for use by iwl-*.c
*
*****************************************************************************/
struct iwl_addsta_cmd;
extern int iwl_send_add_station(struct iwl_priv *priv,
struct iwl_addsta_cmd *sta, u8 flags);
extern u8 iwl_add_station(struct iwl_priv *priv, const u8 *bssid,
struct iwl3945_addsta_cmd;
extern int iwl3945_send_add_station(struct iwl3945_priv *priv,
struct iwl3945_addsta_cmd *sta, u8 flags);
extern u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *bssid,
int is_ap, u8 flags);
extern int iwl_is_network_packet(struct iwl_priv *priv,
extern int iwl3945_is_network_packet(struct iwl3945_priv *priv,
struct ieee80211_hdr *header);
extern int iwl_power_init_handle(struct iwl_priv *priv);
extern int iwl_eeprom_init(struct iwl_priv *priv);
extern int iwl3945_power_init_handle(struct iwl3945_priv *priv);
extern int iwl3945_eeprom_init(struct iwl3945_priv *priv);
#ifdef CONFIG_IWL3945_DEBUG
extern void iwl_report_frame(struct iwl_priv *priv,
struct iwl_rx_packet *pkt,
extern void iwl3945_report_frame(struct iwl3945_priv *priv,
struct iwl3945_rx_packet *pkt,
struct ieee80211_hdr *header, int group100);
#else
static inline void iwl_report_frame(struct iwl_priv *priv,
struct iwl_rx_packet *pkt,
static inline void iwl3945_report_frame(struct iwl3945_priv *priv,
struct iwl3945_rx_packet *pkt,
struct ieee80211_hdr *header,
int group100) {}
#endif
extern void iwl_handle_data_packet_monitor(struct iwl_priv *priv,
struct iwl_rx_mem_buffer *rxb,
extern void iwl3945_handle_data_packet_monitor(struct iwl3945_priv *priv,
struct iwl3945_rx_mem_buffer *rxb,
void *data, short len,
struct ieee80211_rx_status *stats,
u16 phy_flags);
extern int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr
*header);
extern int iwl_rx_queue_alloc(struct iwl_priv *priv);
extern void iwl_rx_queue_reset(struct iwl_priv *priv,
struct iwl_rx_queue *rxq);
extern int iwl_calc_db_from_ratio(int sig_ratio);
extern int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm);
extern int iwl_tx_queue_init(struct iwl_priv *priv,
struct iwl_tx_queue *txq, int count, u32 id);
extern void iwl_rx_replenish(void *data);
extern void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq);
extern int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len,
extern int iwl3945_is_duplicate_packet(struct iwl3945_priv *priv,
struct ieee80211_hdr *header);
extern int iwl3945_rx_queue_alloc(struct iwl3945_priv *priv);
extern void iwl3945_rx_queue_reset(struct iwl3945_priv *priv,
struct iwl3945_rx_queue *rxq);
extern int iwl3945_calc_db_from_ratio(int sig_ratio);
extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm);
extern int iwl3945_tx_queue_init(struct iwl3945_priv *priv,
struct iwl3945_tx_queue *txq, int count, u32 id);
extern void iwl3945_rx_replenish(void *data);
extern void iwl3945_tx_queue_free(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq);
extern int iwl3945_send_cmd_pdu(struct iwl3945_priv *priv, u8 id, u16 len,
const void *data);
extern int __must_check iwl_send_cmd(struct iwl_priv *priv,
struct iwl_host_cmd *cmd);
extern unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv,
extern int __must_check iwl3945_send_cmd(struct iwl3945_priv *priv,
struct iwl3945_host_cmd *cmd);
extern unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv,
struct ieee80211_hdr *hdr,
const u8 *dest, int left);
extern int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv,
struct iwl_rx_queue *q);
extern int iwl_send_statistics_request(struct iwl_priv *priv);
extern void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb,
extern int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv,
struct iwl3945_rx_queue *q);
extern int iwl3945_send_statistics_request(struct iwl3945_priv *priv);
extern void iwl3945_set_decrypted_flag(struct iwl3945_priv *priv, struct sk_buff *skb,
u32 decrypt_res,
struct ieee80211_rx_status *stats);
extern const u8 BROADCAST_ADDR[ETH_ALEN];
extern const u8 iwl3945_broadcast_addr[ETH_ALEN];
/*
* Currently used by iwl-3945-rs... look at restructuring so that it doesn't
* call this... todo... fix that.
*/
extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id,
extern u8 iwl3945_sync_station(struct iwl3945_priv *priv, int sta_id,
u16 tx_rate, u8 flags);
/******************************************************************************
......@@ -655,65 +655,65 @@ extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id,
* which is why they are in the hardware specific files (vs. iwl-base.c)
*
* Naming convention --
* iwl_ <-- Its part of iwlwifi (should be changed to iwl_)
* iwl_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW)
* iwl3945_ <-- Its part of iwlwifi (should be changed to iwl3945_)
* iwl3945_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW)
* iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
* iwl_bg_ <-- Called from work queue context
* iwl_mac_ <-- mac80211 callback
* iwl3945_bg_ <-- Called from work queue context
* iwl3945_mac_ <-- mac80211 callback
*
****************************************************************************/
extern void iwl_hw_rx_handler_setup(struct iwl_priv *priv);
extern void iwl_hw_setup_deferred_work(struct iwl_priv *priv);
extern void iwl_hw_cancel_deferred_work(struct iwl_priv *priv);
extern int iwl_hw_rxq_stop(struct iwl_priv *priv);
extern int iwl_hw_set_hw_setting(struct iwl_priv *priv);
extern int iwl_hw_nic_init(struct iwl_priv *priv);
extern int iwl_hw_nic_stop_master(struct iwl_priv *priv);
extern void iwl_hw_txq_ctx_free(struct iwl_priv *priv);
extern void iwl_hw_txq_ctx_stop(struct iwl_priv *priv);
extern int iwl_hw_nic_reset(struct iwl_priv *priv);
extern int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd,
extern void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv);
extern void iwl3945_hw_setup_deferred_work(struct iwl3945_priv *priv);
extern void iwl3945_hw_cancel_deferred_work(struct iwl3945_priv *priv);
extern int iwl3945_hw_rxq_stop(struct iwl3945_priv *priv);
extern int iwl3945_hw_set_hw_setting(struct iwl3945_priv *priv);
extern int iwl3945_hw_nic_init(struct iwl3945_priv *priv);
extern int iwl3945_hw_nic_stop_master(struct iwl3945_priv *priv);
extern void iwl3945_hw_txq_ctx_free(struct iwl3945_priv *priv);
extern void iwl3945_hw_txq_ctx_stop(struct iwl3945_priv *priv);
extern int iwl3945_hw_nic_reset(struct iwl3945_priv *priv);
extern int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl3945_priv *priv, void *tfd,
dma_addr_t addr, u16 len);
extern int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq);
extern int iwl_hw_get_temperature(struct iwl_priv *priv);
extern int iwl_hw_tx_queue_init(struct iwl_priv *priv,
struct iwl_tx_queue *txq);
extern unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
struct iwl_frame *frame, u8 rate);
extern int iwl_hw_get_rx_read(struct iwl_priv *priv);
extern void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
struct iwl_cmd *cmd,
extern int iwl3945_hw_txq_free_tfd(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq);
extern int iwl3945_hw_get_temperature(struct iwl3945_priv *priv);
extern int iwl3945_hw_tx_queue_init(struct iwl3945_priv *priv,
struct iwl3945_tx_queue *txq);
extern unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv,
struct iwl3945_frame *frame, u8 rate);
extern int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv);
extern void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
struct iwl3945_cmd *cmd,
struct ieee80211_tx_control *ctrl,
struct ieee80211_hdr *hdr,
int sta_id, int tx_id);
extern int iwl_hw_reg_send_txpower(struct iwl_priv *priv);
extern int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power);
extern void iwl_hw_rx_statistics(struct iwl_priv *priv,
struct iwl_rx_mem_buffer *rxb);
extern void iwl_disable_events(struct iwl_priv *priv);
extern int iwl4965_get_temperature(const struct iwl_priv *priv);
extern int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv);
extern int iwl3945_hw_reg_set_txpower(struct iwl3945_priv *priv, s8 power);
extern void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv,
struct iwl3945_rx_mem_buffer *rxb);
extern void iwl3945_disable_events(struct iwl3945_priv *priv);
extern int iwl4965_get_temperature(const struct iwl3945_priv *priv);
/**
* iwl_hw_find_station - Find station id for a given BSSID
* iwl3945_hw_find_station - Find station id for a given BSSID
* @bssid: MAC address of station ID to find
*
* NOTE: This should not be hardware specific but the code has
* not yet been merged into a single common layer for managing the
* station tables.
*/
extern u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *bssid);
extern u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *bssid);
extern int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel);
extern int iwl3945_hw_channel_switch(struct iwl3945_priv *priv, u16 channel);
/*
* Forward declare iwl-3945.c functions for iwl-base.c
*/
extern int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv);
extern __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv);
extern int iwl3945_init_hw_rate_table(struct iwl_priv *priv);
extern void iwl3945_reg_txpower_periodic(struct iwl_priv *priv);
extern int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv);
extern u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id,
extern int iwl3945_eeprom_acquire_semaphore(struct iwl3945_priv *priv);
extern __le32 iwl3945_get_antenna_flags(const struct iwl3945_priv *priv);
extern int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv);
extern void iwl3945_reg_txpower_periodic(struct iwl3945_priv *priv);
extern int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv);
extern u8 iwl3945_sync_sta(struct iwl3945_priv *priv, int sta_id,
u16 tx_rate, u8 flags);
......@@ -726,7 +726,7 @@ enum {
#endif
struct iwl_priv {
struct iwl3945_priv {
/* ieee device used by generic ieee processing code */
struct ieee80211_hw *hw;
......@@ -740,27 +740,27 @@ struct iwl_priv {
u8 phymode;
int alloc_rxb_skb;
void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
struct iwl_rx_mem_buffer *rxb);
void (*rx_handlers[REPLY_MAX])(struct iwl3945_priv *priv,
struct iwl3945_rx_mem_buffer *rxb);
const struct ieee80211_hw_mode *modes;
#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
/* spectrum measurement report caching */
struct iwl_spectrum_notification measure_report;
struct iwl3945_spectrum_notification measure_report;
u8 measurement_status;
#endif
/* ucode beacon time */
u32 ucode_beacon_time;
/* we allocate array of iwl_channel_info for NIC's valid channels.
/* we allocate array of iwl3945_channel_info for NIC's valid channels.
* Access via channel # using indirect index array */
struct iwl_channel_info *channel_info; /* channel info array */
struct iwl3945_channel_info *channel_info; /* channel info array */
u8 channel_count; /* # of channels */
/* each calibration channel group in the EEPROM has a derived
* clip setting for each rate. */
const struct iwl_clip_group clip_groups[5];
const struct iwl3945_clip_group clip_groups[5];
/* thermal calibration */
s32 temperature; /* degrees Kelvin */
......@@ -775,7 +775,7 @@ struct iwl_priv {
int one_direct_scan;
u8 direct_ssid_len;
u8 direct_ssid[IW_ESSID_MAX_SIZE];
struct iwl_scan_cmd *scan;
struct iwl3945_scan_cmd *scan;
u8 only_active_channel;
/* spinlock */
......@@ -798,26 +798,26 @@ struct iwl_priv {
struct fw_desc ucode_boot; /* bootstrap inst */
struct iwl_rxon_time_cmd rxon_timing;
struct iwl3945_rxon_time_cmd rxon_timing;
/* We declare this const so it can only be
* changed via explicit cast within the
* routines that actually update the physical
* hardware */
const struct iwl_rxon_cmd active_rxon;
struct iwl_rxon_cmd staging_rxon;
const struct iwl3945_rxon_cmd active_rxon;
struct iwl3945_rxon_cmd staging_rxon;
int error_recovering;
struct iwl_rxon_cmd recovery_rxon;
struct iwl3945_rxon_cmd recovery_rxon;
/* 1st responses from initialize and runtime uCode images.
* 4965's initialize alive response contains some calibration data. */
struct iwl_init_alive_resp card_alive_init;
struct iwl_alive_resp card_alive;
struct iwl3945_init_alive_resp card_alive_init;
struct iwl3945_alive_resp card_alive;
#ifdef LED
/* LED related variables */
struct iwl_activity_blink activity;
struct iwl3945_activity_blink activity;
unsigned long led_packets;
int led_state;
#endif
......@@ -836,8 +836,8 @@ struct iwl_priv {
int activity_timer_active;
/* Rx and Tx DMA processing queues */
struct iwl_rx_queue rxq;
struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES];
struct iwl3945_rx_queue rxq;
struct iwl3945_tx_queue txq[IWL_MAX_NUM_QUEUES];
unsigned long status;
u32 config;
......@@ -845,9 +845,9 @@ struct iwl_priv {
int last_rx_rssi; /* From Rx packet statisitics */
int last_rx_noise; /* From beacon statistics */
struct iwl_power_mgr power_data;
struct iwl3945_power_mgr power_data;
struct iwl_notif_statistics statistics;
struct iwl3945_notif_statistics statistics;
unsigned long last_statistics_time;
/* context information */
......@@ -864,7 +864,7 @@ struct iwl_priv {
/*station table variables */
spinlock_t sta_lock;
int num_stations;
struct iwl_station_entry stations[IWL_STATION_COUNT];
struct iwl3945_station_entry stations[IWL_STATION_COUNT];
/* Indication if ieee80211_ops->open has been called */
int is_open;
......@@ -885,7 +885,7 @@ struct iwl_priv {
struct list_head ibss_mac_hash[IWL_IBSS_MAC_HASH_SIZE];
/* eeprom */
struct iwl_eeprom eeprom;
struct iwl3945_eeprom eeprom;
int iw_mode;
......@@ -895,7 +895,7 @@ struct iwl_priv {
u32 timestamp0;
u32 timestamp1;
u16 beacon_int;
struct iwl_driver_hw_info hw_setting;
struct iwl3945_driver_hw_info hw_setting;
int interface_id;
/* Current association information needed to configure the
......@@ -905,7 +905,7 @@ struct iwl_priv {
u8 ps_mode;
#ifdef CONFIG_IWL3945_QOS
struct iwl_qos_info qos_data;
struct iwl3945_qos_info qos_data;
#endif /*CONFIG_IWL3945_QOS */
struct workqueue_struct *workqueue;
......@@ -946,55 +946,55 @@ struct iwl_priv {
u32 framecnt_to_us;
atomic_t restrict_refcnt;
#endif
}; /*iwl_priv */
}; /*iwl3945_priv */
static inline int iwl_is_associated(struct iwl_priv *priv)
static inline int iwl3945_is_associated(struct iwl3945_priv *priv)
{
return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
}
static inline int is_channel_valid(const struct iwl_channel_info *ch_info)
static inline int is_channel_valid(const struct iwl3945_channel_info *ch_info)
{
if (ch_info == NULL)
return 0;
return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0;
}
static inline int is_channel_narrow(const struct iwl_channel_info *ch_info)
static inline int is_channel_narrow(const struct iwl3945_channel_info *ch_info)
{
return (ch_info->flags & EEPROM_CHANNEL_NARROW) ? 1 : 0;
}
static inline int is_channel_radar(const struct iwl_channel_info *ch_info)
static inline int is_channel_radar(const struct iwl3945_channel_info *ch_info)
{
return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0;
}
static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info)
static inline u8 is_channel_a_band(const struct iwl3945_channel_info *ch_info)
{
return ch_info->phymode == MODE_IEEE80211A;
}
static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info)
static inline u8 is_channel_bg_band(const struct iwl3945_channel_info *ch_info)
{
return ((ch_info->phymode == MODE_IEEE80211B) ||
(ch_info->phymode == MODE_IEEE80211G));
}
static inline int is_channel_passive(const struct iwl_channel_info *ch)
static inline int is_channel_passive(const struct iwl3945_channel_info *ch)
{
return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0;
}
static inline int is_channel_ibss(const struct iwl_channel_info *ch)
static inline int is_channel_ibss(const struct iwl3945_channel_info *ch)
{
return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
}
extern const struct iwl_channel_info *iwl_get_channel_info(
const struct iwl_priv *priv, int phymode, u16 channel);
extern const struct iwl3945_channel_info *iwl3945_get_channel_info(
const struct iwl3945_priv *priv, int phymode, u16 channel);
/* Requires full declaration of iwl_priv before including */
/* Requires full declaration of iwl3945_priv before including */
#include "iwl-3945-io.h"
#endif
......@@ -61,8 +61,8 @@
*
*****************************************************************************/
#ifndef __iwl_commands_h__
#define __iwl_commands_h__
#ifndef __iwl4965_commands_h__
#define __iwl4965_commands_h__
enum {
REPLY_ALIVE = 0x1,
......@@ -147,7 +147,7 @@ enum {
#define IWL_CMD_FAILED_MSK 0x40
struct iwl_cmd_header {
struct iwl4965_cmd_header {
u8 cmd;
u8 flags;
/* We have 15 LSB to use as we please (MSB indicates
......@@ -179,7 +179,7 @@ struct iwl_cmd_header {
/*
* REPLY_ALIVE = 0x1 (response only, not a command)
*/
struct iwl_alive_resp {
struct iwl4965_alive_resp {
u8 ucode_minor;
u8 ucode_major;
__le16 reserved1;
......@@ -193,7 +193,7 @@ struct iwl_alive_resp {
__le32 is_valid;
} __attribute__ ((packed));
struct iwl_init_alive_resp {
struct iwl4965_init_alive_resp {
u8 ucode_minor;
u8 ucode_major;
__le16 reserved1;
......@@ -225,7 +225,7 @@ union tsf {
/*
* REPLY_ERROR = 0x2 (response only, not a command)
*/
struct iwl_error_resp {
struct iwl4965_error_resp {
__le32 error_type;
u8 cmd_id;
u8 reserved1;
......@@ -293,7 +293,7 @@ enum {
/*
* REPLY_RXON = 0x10 (command, has simple generic response)
*/
struct iwl_rxon_cmd {
struct iwl4965_rxon_cmd {
u8 node_addr[6];
__le16 reserved1;
u8 bssid_addr[6];
......@@ -316,7 +316,7 @@ struct iwl_rxon_cmd {
/*
* REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
*/
struct iwl_rxon_assoc_cmd {
struct iwl4965_rxon_assoc_cmd {
__le32 flags;
__le32 filter_flags;
u8 ofdm_basic_rates;
......@@ -330,7 +330,7 @@ struct iwl_rxon_assoc_cmd {
/*
* REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
*/
struct iwl_rxon_time_cmd {
struct iwl4965_rxon_time_cmd {
union tsf timestamp;
__le16 beacon_interval;
__le16 atim_window;
......@@ -339,7 +339,7 @@ struct iwl_rxon_time_cmd {
__le16 reserved;
} __attribute__ ((packed));
struct iwl_tx_power {
struct iwl4965_tx_power {
u8 tx_gain; /* gain for analog radio */
u8 dsp_atten; /* gain for DSP */
} __attribute__ ((packed));
......@@ -351,27 +351,27 @@ struct tx_power_dual_stream {
__le32 dw;
} __attribute__ ((packed));
struct iwl_tx_power_db {
struct iwl4965_tx_power_db {
struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
} __attribute__ ((packed));
/*
* REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
*/
struct iwl_channel_switch_cmd {
struct iwl4965_channel_switch_cmd {
u8 band;
u8 expect_beacon;
__le16 channel;
__le32 rxon_flags;
__le32 rxon_filter_flags;
__le32 switch_time;
struct iwl_tx_power_db tx_power;
struct iwl4965_tx_power_db tx_power;
} __attribute__ ((packed));
/*
* CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
*/
struct iwl_csa_notification {
struct iwl4965_csa_notification {
__le16 band;
__le16 channel;
__le32 status; /* 0 - OK, 1 - fail */
......@@ -382,7 +382,7 @@ struct iwl_csa_notification {
* Quality-of-Service (QOS) Commands & Responses:
*
*****************************************************************************/
struct iwl_ac_qos {
struct iwl4965_ac_qos {
__le16 cw_min;
__le16 cw_max;
u8 aifsn;
......@@ -404,9 +404,9 @@ struct iwl_ac_qos {
/*
* REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
*/
struct iwl_qosparam_cmd {
struct iwl4965_qosparam_cmd {
__le32 qos_flags;
struct iwl_ac_qos ac[AC_NUM];
struct iwl4965_ac_qos ac[AC_NUM];
} __attribute__ ((packed));
/******************************************************************************
......@@ -464,7 +464,7 @@ struct iwl_qosparam_cmd {
#define RATE_MCS_ANT_B_MSK 0x8000
#define RATE_MCS_ANT_AB_MSK 0xc000
struct iwl_keyinfo {
struct iwl4965_keyinfo {
__le16 key_flags;
u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
u8 reserved1;
......@@ -484,11 +484,11 @@ struct sta_id_modify {
/*
* REPLY_ADD_STA = 0x18 (command)
*/
struct iwl_addsta_cmd {
struct iwl4965_addsta_cmd {
u8 mode;
u8 reserved[3];
struct sta_id_modify sta;
struct iwl_keyinfo key;
struct iwl4965_keyinfo key;
__le32 station_flags;
__le32 station_flags_msk;
__le16 tid_disable_tx;
......@@ -502,7 +502,7 @@ struct iwl_addsta_cmd {
/*
* REPLY_ADD_STA = 0x18 (response)
*/
struct iwl_add_sta_resp {
struct iwl4965_add_sta_resp {
u8 status;
} __attribute__ ((packed));
......@@ -514,7 +514,7 @@ struct iwl_add_sta_resp {
*
*****************************************************************************/
struct iwl_rx_frame_stats {
struct iwl4965_rx_frame_stats {
u8 phy_count;
u8 id;
u8 rssi;
......@@ -524,7 +524,7 @@ struct iwl_rx_frame_stats {
u8 payload[0];
} __attribute__ ((packed));
struct iwl_rx_frame_hdr {
struct iwl4965_rx_frame_hdr {
__le16 channel;
__le16 phy_flags;
u8 reserved1;
......@@ -554,7 +554,7 @@ struct iwl_rx_frame_hdr {
#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
struct iwl_rx_frame_end {
struct iwl4965_rx_frame_end {
__le32 status;
__le64 timestamp;
__le32 beacon_timestamp;
......@@ -568,10 +568,10 @@ struct iwl_rx_frame_end {
* The actual offsets of the hdr and end are dynamic based on
* stats.phy_count
*/
struct iwl_rx_frame {
struct iwl_rx_frame_stats stats;
struct iwl_rx_frame_hdr hdr;
struct iwl_rx_frame_end end;
struct iwl4965_rx_frame {
struct iwl4965_rx_frame_stats stats;
struct iwl4965_rx_frame_hdr hdr;
struct iwl4965_rx_frame_end end;
} __attribute__ ((packed));
/* Fixed (non-configurable) rx data from phy */
......@@ -666,7 +666,7 @@ struct iwl4965_rx_mpdu_res_start {
* TX command Frame life time
*/
struct iwl_dram_scratch {
struct iwl4965_dram_scratch {
u8 try_cnt;
u8 bt_kill_cnt;
__le16 reserved;
......@@ -675,11 +675,11 @@ struct iwl_dram_scratch {
/*
* REPLY_TX = 0x1c (command)
*/
struct iwl_tx_cmd {
struct iwl4965_tx_cmd {
__le16 len;
__le16 next_frame_len;
__le32 tx_flags;
struct iwl_dram_scratch scratch;
struct iwl4965_dram_scratch scratch;
__le32 rate_n_flags;
u8 sta_id;
u8 sec_ctl;
......@@ -807,7 +807,7 @@ enum {
/*
* REPLY_TX = 0x1c (response)
*/
struct iwl_tx_resp {
struct iwl4965_tx_resp {
u8 frame_count; /* 1 no aggregation, >1 aggregation */
u8 bt_kill_count;
u8 failure_rts;
......@@ -823,7 +823,7 @@ struct iwl_tx_resp {
/*
* REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
*/
struct iwl_compressed_ba_resp {
struct iwl4965_compressed_ba_resp {
__le32 sta_addr_lo32;
__le16 sta_addr_hi16;
__le16 reserved;
......@@ -839,11 +839,11 @@ struct iwl_compressed_ba_resp {
/*
* REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
*/
struct iwl_txpowertable_cmd {
struct iwl4965_txpowertable_cmd {
u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
u8 reserved;
__le16 channel;
struct iwl_tx_power_db tx_power;
struct iwl4965_tx_power_db tx_power;
} __attribute__ ((packed));
/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
......@@ -856,7 +856,7 @@ struct iwl_txpowertable_cmd {
#define LINK_QUAL_ANT_B_MSK (1<<1)
#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
struct iwl_link_qual_general_params {
struct iwl4965_link_qual_general_params {
u8 flags;
u8 mimo_delimiter;
u8 single_stream_ant_msk;
......@@ -864,7 +864,7 @@ struct iwl_link_qual_general_params {
u8 start_rate_index[LINK_QUAL_AC_NUM];
} __attribute__ ((packed));
struct iwl_link_qual_agg_params {
struct iwl4965_link_qual_agg_params {
__le16 agg_time_limit;
u8 agg_dis_start_th;
u8 agg_frame_cnt_limit;
......@@ -874,12 +874,12 @@ struct iwl_link_qual_agg_params {
/*
* REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
*/
struct iwl_link_quality_cmd {
struct iwl4965_link_quality_cmd {
u8 sta_id;
u8 reserved1;
__le16 control;
struct iwl_link_qual_general_params general_params;
struct iwl_link_qual_agg_params agg_params;
struct iwl4965_link_qual_general_params general_params;
struct iwl4965_link_qual_agg_params agg_params;
struct {
__le32 rate_n_flags;
} rs_table[LINK_QUAL_MAX_RETRY_NUM];
......@@ -889,7 +889,7 @@ struct iwl_link_quality_cmd {
/*
* REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
*/
struct iwl_bt_cmd {
struct iwl4965_bt_cmd {
u8 flags;
u8 lead_time;
u8 max_kill;
......@@ -915,18 +915,18 @@ struct iwl_bt_cmd {
RXON_FILTER_ASSOC_MSK | \
RXON_FILTER_BCON_AWARE_MSK)
struct iwl_measure_channel {
struct iwl4965_measure_channel {
__le32 duration; /* measurement duration in extended beacon
* format */
u8 channel; /* channel to measure */
u8 type; /* see enum iwl_measure_type */
u8 type; /* see enum iwl4965_measure_type */
__le16 reserved;
} __attribute__ ((packed));
/*
* REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
*/
struct iwl_spectrum_cmd {
struct iwl4965_spectrum_cmd {
__le16 len; /* number of bytes starting from token */
u8 token; /* token id */
u8 id; /* measurement id -- 0 or 1 */
......@@ -939,13 +939,13 @@ struct iwl_spectrum_cmd {
__le32 filter_flags; /* rxon filter flags */
__le16 channel_count; /* minimum 1, maximum 10 */
__le16 reserved3;
struct iwl_measure_channel channels[10];
struct iwl4965_measure_channel channels[10];
} __attribute__ ((packed));
/*
* REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
*/
struct iwl_spectrum_resp {
struct iwl4965_spectrum_resp {
u8 token;
u8 id; /* id of the prior command replaced, or 0xff */
__le16 status; /* 0 - command will be handled
......@@ -953,12 +953,12 @@ struct iwl_spectrum_resp {
* measurement) */
} __attribute__ ((packed));
enum iwl_measurement_state {
enum iwl4965_measurement_state {
IWL_MEASUREMENT_START = 0,
IWL_MEASUREMENT_STOP = 1,
};
enum iwl_measurement_status {
enum iwl4965_measurement_status {
IWL_MEASUREMENT_OK = 0,
IWL_MEASUREMENT_CONCURRENT = 1,
IWL_MEASUREMENT_CSA_CONFLICT = 2,
......@@ -971,18 +971,18 @@ enum iwl_measurement_status {
#define NUM_ELEMENTS_IN_HISTOGRAM 8
struct iwl_measurement_histogram {
struct iwl4965_measurement_histogram {
__le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
__le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
} __attribute__ ((packed));
/* clear channel availability counters */
struct iwl_measurement_cca_counters {
struct iwl4965_measurement_cca_counters {
__le32 ofdm;
__le32 cck;
} __attribute__ ((packed));
enum iwl_measure_type {
enum iwl4965_measure_type {
IWL_MEASURE_BASIC = (1 << 0),
IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
......@@ -995,7 +995,7 @@ enum iwl_measure_type {
/*
* SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
*/
struct iwl_spectrum_notification {
struct iwl4965_spectrum_notification {
u8 id; /* measurement id -- 0 or 1 */
u8 token;
u8 channel_index; /* index in measurement channel list */
......@@ -1003,7 +1003,7 @@ struct iwl_spectrum_notification {
__le32 start_time; /* lower 32-bits of TSF */
u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
u8 channel;
u8 type; /* see enum iwl_measurement_type */
u8 type; /* see enum iwl4965_measurement_type */
u8 reserved1;
/* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
* valid if applicable for measurement type requested. */
......@@ -1013,9 +1013,9 @@ struct iwl_spectrum_notification {
u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
* unidentified */
u8 reserved2[3];
struct iwl_measurement_histogram histogram;
struct iwl4965_measurement_histogram histogram;
__le32 stop_time; /* lower 32-bits of TSF */
__le32 status; /* see iwl_measurement_status */
__le32 status; /* see iwl4965_measurement_status */
} __attribute__ ((packed));
/******************************************************************************
......@@ -1025,7 +1025,7 @@ struct iwl_spectrum_notification {
*****************************************************************************/
/**
* struct iwl_powertable_cmd - Power Table Command
* struct iwl4965_powertable_cmd - Power Table Command
* @flags: See below:
*
* POWER_TABLE_CMD = 0x77 (command, has simple generic response)
......@@ -1058,7 +1058,7 @@ struct iwl_spectrum_notification {
#define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le16(1<<2)
#define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1<<3)
struct iwl_powertable_cmd {
struct iwl4965_powertable_cmd {
__le16 flags;
u8 keep_alive_seconds;
u8 debug_flags;
......@@ -1072,7 +1072,7 @@ struct iwl_powertable_cmd {
* PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
* 3945 and 4965 identical.
*/
struct iwl_sleep_notification {
struct iwl4965_sleep_notification {
u8 pm_sleep_mode;
u8 pm_wakeup_src;
__le16 reserved;
......@@ -1102,14 +1102,14 @@ enum {
#define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
#define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
#define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
struct iwl_card_state_cmd {
struct iwl4965_card_state_cmd {
__le32 status; /* CARD_STATE_CMD_* request new power state */
} __attribute__ ((packed));
/*
* CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
*/
struct iwl_card_state_notif {
struct iwl4965_card_state_notif {
__le32 flags;
} __attribute__ ((packed));
......@@ -1118,7 +1118,7 @@ struct iwl_card_state_notif {
#define RF_CARD_DISABLED 0x04
#define RXON_CARD_DISABLED 0x10
struct iwl_ct_kill_config {
struct iwl4965_ct_kill_config {
__le32 reserved;
__le32 critical_temperature_M;
__le32 critical_temperature_R;
......@@ -1130,7 +1130,7 @@ struct iwl_ct_kill_config {
*
*****************************************************************************/
struct iwl_scan_channel {
struct iwl4965_scan_channel {
/* type is defined as:
* 0:0 active (0 - passive)
* 1:4 SSID direct
......@@ -1139,12 +1139,12 @@ struct iwl_scan_channel {
*/
u8 type;
u8 channel;
struct iwl_tx_power tpc;
struct iwl4965_tx_power tpc;
__le16 active_dwell;
__le16 passive_dwell;
} __attribute__ ((packed));
struct iwl_ssid_ie {
struct iwl4965_ssid_ie {
u8 id;
u8 len;
u8 ssid[32];
......@@ -1158,7 +1158,7 @@ struct iwl_ssid_ie {
/*
* REPLY_SCAN_CMD = 0x80 (command)
*/
struct iwl_scan_cmd {
struct iwl4965_scan_cmd {
__le16 len;
u8 reserved0;
u8 channel_count;
......@@ -1177,14 +1177,14 @@ struct iwl_scan_cmd {
__le32 flags;
__le32 filter_flags;
struct iwl_tx_cmd tx_cmd;
struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
struct iwl4965_tx_cmd tx_cmd;
struct iwl4965_ssid_ie direct_scan[PROBE_OPTION_MAX];
u8 data[0];
/*
* The channels start after the probe request payload and are of type:
*
* struct iwl_scan_channel channels[0];
* struct iwl4965_scan_channel channels[0];
*
* NOTE: Only one band of channels can be scanned per pass. You
* can not mix 2.4GHz channels and 5.2GHz channels and must
......@@ -1201,14 +1201,14 @@ struct iwl_scan_cmd {
/*
* REPLY_SCAN_CMD = 0x80 (response)
*/
struct iwl_scanreq_notification {
struct iwl4965_scanreq_notification {
__le32 status; /* 1: okay, 2: cannot fulfill request */
} __attribute__ ((packed));
/*
* SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
*/
struct iwl_scanstart_notification {
struct iwl4965_scanstart_notification {
__le32 tsf_low;
__le32 tsf_high;
__le32 beacon_timer;
......@@ -1225,7 +1225,7 @@ struct iwl_scanstart_notification {
/*
* SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
*/
struct iwl_scanresults_notification {
struct iwl4965_scanresults_notification {
u8 channel;
u8 band;
u8 reserved[2];
......@@ -1237,7 +1237,7 @@ struct iwl_scanresults_notification {
/*
* SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
*/
struct iwl_scancomplete_notification {
struct iwl4965_scancomplete_notification {
u8 scanned_channels;
u8 status;
u8 reserved;
......@@ -1256,8 +1256,8 @@ struct iwl_scancomplete_notification {
/*
* BEACON_NOTIFICATION = 0x90 (notification only, not a command)
*/
struct iwl_beacon_notif {
struct iwl_tx_resp beacon_notify_hdr;
struct iwl4965_beacon_notif {
struct iwl4965_tx_resp beacon_notify_hdr;
__le32 low_tsf;
__le32 high_tsf;
__le32 ibss_mgr_status;
......@@ -1266,8 +1266,8 @@ struct iwl_beacon_notif {
/*
* REPLY_TX_BEACON = 0x91 (command, has simple generic response)
*/
struct iwl_tx_beacon_cmd {
struct iwl_tx_cmd tx;
struct iwl4965_tx_beacon_cmd {
struct iwl4965_tx_cmd tx;
__le16 tim_idx;
u8 tim_size;
u8 reserved1;
......@@ -1458,7 +1458,7 @@ struct statistics_general {
*/
#define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */
#define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */
struct iwl_statistics_cmd {
struct iwl4965_statistics_cmd {
__le32 configuration_flags; /* IWL_STATS_CONF_* */
} __attribute__ ((packed));
......@@ -1479,7 +1479,7 @@ struct iwl_statistics_cmd {
*/
#define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2)
#define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8)
struct iwl_notif_statistics {
struct iwl4965_notif_statistics {
__le32 flag;
struct statistics_rx rx;
struct statistics_tx tx;
......@@ -1494,7 +1494,7 @@ struct iwl_notif_statistics {
* then this notification will be sent. */
#define CONSECUTIVE_MISSED_BCONS_TH 20
struct iwl_missed_beacon_notif {
struct iwl4965_missed_beacon_notif {
__le32 consequtive_missed_beacons;
__le32 total_missed_becons;
__le32 num_expected_beacons;
......@@ -1510,12 +1510,12 @@ struct iwl_missed_beacon_notif {
#define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
#define HD_TABLE_SIZE (11)
struct iwl_sensitivity_cmd {
struct iwl4965_sensitivity_cmd {
__le16 control;
__le16 table[HD_TABLE_SIZE];
} __attribute__ ((packed));
struct iwl_calibration_cmd {
struct iwl4965_calibration_cmd {
u8 opCode;
u8 flags;
__le16 reserved;
......@@ -1538,7 +1538,7 @@ struct iwl_calibration_cmd {
* For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
* this command turns it on or off, or sets up a periodic blinking cycle.
*/
struct iwl_led_cmd {
struct iwl4965_led_cmd {
__le32 interval; /* "interval" in uSec */
u8 id; /* 1: Activity, 2: Link, 3: Tech */
u8 off; /* # intervals off while blinking;
......@@ -1554,29 +1554,29 @@ struct iwl_led_cmd {
*
*****************************************************************************/
struct iwl_rx_packet {
struct iwl4965_rx_packet {
__le32 len;
struct iwl_cmd_header hdr;
struct iwl4965_cmd_header hdr;
union {
struct iwl_alive_resp alive_frame;
struct iwl_rx_frame rx_frame;
struct iwl_tx_resp tx_resp;
struct iwl_spectrum_notification spectrum_notif;
struct iwl_csa_notification csa_notif;
struct iwl_error_resp err_resp;
struct iwl_card_state_notif card_state_notif;
struct iwl_beacon_notif beacon_status;
struct iwl_add_sta_resp add_sta;
struct iwl_sleep_notification sleep_notif;
struct iwl_spectrum_resp spectrum;
struct iwl_notif_statistics stats;
struct iwl_compressed_ba_resp compressed_ba;
struct iwl_missed_beacon_notif missed_beacon;
struct iwl4965_alive_resp alive_frame;
struct iwl4965_rx_frame rx_frame;
struct iwl4965_tx_resp tx_resp;
struct iwl4965_spectrum_notification spectrum_notif;
struct iwl4965_csa_notification csa_notif;
struct iwl4965_error_resp err_resp;
struct iwl4965_card_state_notif card_state_notif;
struct iwl4965_beacon_notif beacon_status;
struct iwl4965_add_sta_resp add_sta;
struct iwl4965_sleep_notification sleep_notif;
struct iwl4965_spectrum_resp spectrum;
struct iwl4965_notif_statistics stats;
struct iwl4965_compressed_ba_resp compressed_ba;
struct iwl4965_missed_beacon_notif missed_beacon;
__le32 status;
u8 raw[0];
} u;
} __attribute__ ((packed));
#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl_rx_frame))
#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl4965_rx_frame))
#endif /* __iwl_commands_h__ */
#endif /* __iwl4965_commands_h__ */
......@@ -26,18 +26,18 @@
*
*****************************************************************************/
#ifndef __iwl_debug_h__
#define __iwl_debug_h__
#ifndef __iwl4965_debug_h__
#define __iwl4965_debug_h__
#ifdef CONFIG_IWL4965_DEBUG
extern u32 iwl_debug_level;
extern u32 iwl4965_debug_level;
#define IWL_DEBUG(level, fmt, args...) \
do { if (iwl_debug_level & (level)) \
do { if (iwl4965_debug_level & (level)) \
printk(KERN_ERR DRV_NAME": %c %s " fmt, \
in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
#define IWL_DEBUG_LIMIT(level, fmt, args...) \
do { if ((iwl_debug_level & (level)) && net_ratelimit()) \
do { if ((iwl4965_debug_level & (level)) && net_ratelimit()) \
printk(KERN_ERR DRV_NAME": %c %s " fmt, \
in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
#else
......@@ -68,7 +68,7 @@ static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...)
*
* % cat /proc/net/iwl/debug_level
*
* you simply need to add your entry to the iwl_debug_levels array.
* you simply need to add your entry to the iwl4965_debug_levels array.
*
* If you do not see debug_level in /proc/net/iwl then you do not have
* CONFIG_IWL4965_DEBUG defined in your kernel configuration
......
......@@ -137,7 +137,7 @@ enum {
#define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7)
/* *regulatory* channel data from eeprom, one for each channel */
struct iwl_eeprom_channel {
struct iwl4965_eeprom_channel {
u8 flags; /* flags copied from EEPROM */
s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */
} __attribute__ ((packed));
......@@ -152,7 +152,7 @@ struct iwl_eeprom_channel {
* level.
* Data copied from EEPROM.
*/
struct iwl_eeprom_txpower_sample {
struct iwl4965_eeprom_txpower_sample {
u8 gain_index; /* index into power (gain) setup table ... */
s8 power; /* ... for this pwr level for this chnl group */
u16 v_det; /* PA output voltage */
......@@ -166,8 +166,8 @@ struct iwl_eeprom_txpower_sample {
* Data copied from EEPROM.
* DO NOT ALTER THIS STRUCTURE!!!
*/
struct iwl_eeprom_txpower_group {
struct iwl_eeprom_txpower_sample samples[5]; /* 5 power levels */
struct iwl4965_eeprom_txpower_group {
struct iwl4965_eeprom_txpower_sample samples[5]; /* 5 power levels */
s32 a, b, c, d, e; /* coefficients for voltage->power
* formula (signed) */
s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on
......@@ -185,7 +185,7 @@ struct iwl_eeprom_txpower_group {
* difference between current temperature and factory calib temperature.
* Data copied from EEPROM.
*/
struct iwl_eeprom_temperature_corr {
struct iwl4965_eeprom_temperature_corr {
u32 Ta;
u32 Tb;
u32 Tc;
......@@ -199,35 +199,35 @@ struct iwl_eeprom_temperature_corr {
#define EEPROM_TX_POWER_VERSION (2)
#define EEPROM_TX_POWER_VERSION_NEW (5)
struct iwl_eeprom_calib_measure {
struct iwl4965_eeprom_calib_measure {
u8 temperature;
u8 gain_idx;
u8 actual_pow;
s8 pa_det;
} __attribute__ ((packed));
struct iwl_eeprom_calib_ch_info {
struct iwl4965_eeprom_calib_ch_info {
u8 ch_num;
struct iwl_eeprom_calib_measure measurements[EEPROM_TX_POWER_TX_CHAINS]
struct iwl4965_eeprom_calib_measure measurements[EEPROM_TX_POWER_TX_CHAINS]
[EEPROM_TX_POWER_MEASUREMENTS];
} __attribute__ ((packed));
struct iwl_eeprom_calib_subband_info {
struct iwl4965_eeprom_calib_subband_info {
u8 ch_from;
u8 ch_to;
struct iwl_eeprom_calib_ch_info ch1;
struct iwl_eeprom_calib_ch_info ch2;
struct iwl4965_eeprom_calib_ch_info ch1;
struct iwl4965_eeprom_calib_ch_info ch2;
} __attribute__ ((packed));
struct iwl_eeprom_calib_info {
struct iwl4965_eeprom_calib_info {
u8 saturation_power24;
u8 saturation_power52;
s16 voltage; /* signed */
struct iwl_eeprom_calib_subband_info band_info[EEPROM_TX_POWER_BANDS];
struct iwl4965_eeprom_calib_subband_info band_info[EEPROM_TX_POWER_BANDS];
} __attribute__ ((packed));
struct iwl_eeprom {
struct iwl4965_eeprom {
u8 reserved0[16];
#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */
u16 device_id; /* abs.ofs: 16 */
......@@ -276,30 +276,30 @@ struct iwl_eeprom {
#define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */
u16 band_1_count; /* abs.ofs: 196 */
#define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */
struct iwl_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */
struct iwl4965_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */
#define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */
u16 band_2_count; /* abs.ofs: 226 */
#define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */
struct iwl_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
struct iwl4965_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
#define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */
u16 band_3_count; /* abs.ofs: 254 */
#define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */
struct iwl_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
struct iwl4965_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
#define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */
u16 band_4_count; /* abs.ofs: 280 */
#define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */
struct iwl_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
struct iwl4965_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
#define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */
u16 band_5_count; /* abs.ofs: 304 */
#define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */
struct iwl_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
struct iwl4965_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
u8 reserved10[2];
#define EEPROM_REGULATORY_BAND_24_FAT_CHANNELS (2*0xA0) /* 14 bytes */
struct iwl_eeprom_channel band_24_channels[7]; /* abs.ofs: 320 */
struct iwl4965_eeprom_channel band_24_channels[7]; /* abs.ofs: 320 */
u8 reserved11[2];
#define EEPROM_REGULATORY_BAND_52_FAT_CHANNELS (2*0xA8) /* 22 bytes */
struct iwl_eeprom_channel band_52_channels[11]; /* abs.ofs: 336 */
struct iwl4965_eeprom_channel band_52_channels[11]; /* abs.ofs: 336 */
u8 reserved12[6];
#define EEPROM_CALIB_VERSION_OFFSET (2*0xB6) /* 2 bytes */
u16 calib_version; /* abs.ofs: 364 */
......@@ -308,7 +308,7 @@ struct iwl_eeprom {
u16 satruation_power; /* abs.ofs: 368 */
u8 reserved14[94];
#define EEPROM_IWL_CALIB_TXPOWER_OFFSET (2*0xE8) /* 48 bytes */
struct iwl_eeprom_calib_info calib_info; /* abs.ofs: 464 */
struct iwl4965_eeprom_calib_info calib_info; /* abs.ofs: 464 */
u8 reserved16[140]; /* fill out to full 1024 byte block */
......@@ -731,8 +731,8 @@ struct iwl_eeprom {
#define TFD_TX_CMD_SLOTS 256
#define TFD_CMD_SLOTS 32
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \
sizeof(struct iwl_cmd_meta))
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl4965_cmd) - \
sizeof(struct iwl4965_cmd_meta))
/*
* RX related structures and functions
......@@ -751,7 +751,7 @@ struct iwl_eeprom {
#define IWL_MAX_INST_SIZE KDR_RTC_INST_SIZE
#define IWL_MAX_DATA_SIZE KDR_RTC_DATA_SIZE
static inline int iwl_hw_valid_rtc_data_addr(u32 addr)
static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
{
return (addr >= RTC_DATA_LOWER_BOUND) &&
(addr < KDR_RTC_DATA_UPPER_BOUND);
......@@ -873,7 +873,7 @@ enum {
#define CALIB_IWL_TX_ATTEN_GR5_LCH 20
union iwl_tx_power_dual_stream {
union iwl4965_tx_power_dual_stream {
struct {
u8 radio_tx_gain[2];
u8 dsp_predis_atten[2];
......@@ -1115,20 +1115,20 @@ union iwl_tx_power_dual_stream {
#define CSR_HW_IF_CONFIG_REG_BIT_MAC_SI (0x00000100)
#define CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI (0x00000200)
static inline u8 iwl_hw_get_rate(__le32 rate_n_flags)
static inline u8 iwl4965_hw_get_rate(__le32 rate_n_flags)
{
return le32_to_cpu(rate_n_flags) & 0xFF;
}
static inline u16 iwl_hw_get_rate_n_flags(__le32 rate_n_flags)
static inline u16 iwl4965_hw_get_rate_n_flags(__le32 rate_n_flags)
{
return le32_to_cpu(rate_n_flags) & 0xFFFF;
}
static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u16 flags)
static inline __le32 iwl4965_hw_set_rate_n_flags(u8 rate, u16 flags)
{
return cpu_to_le32(flags|(u16)rate);
}
struct iwl_tfd_frame_data {
struct iwl4965_tfd_frame_data {
__le32 tb1_addr;
__le32 val1;
......@@ -1156,7 +1156,7 @@ struct iwl_tfd_frame_data {
#define IWL_tb2_len_SYM val2
} __attribute__ ((packed));
struct iwl_tfd_frame {
struct iwl4965_tfd_frame {
__le32 val0;
/* __le32 rsvd1:24; */
/* __le32 num_tbs:5; */
......@@ -1165,7 +1165,7 @@ struct iwl_tfd_frame {
#define IWL_num_tbs_SYM val0
/* __le32 rsvd2:1; */
/* __le32 padding:2; */
struct iwl_tfd_frame_data pa[10];
struct iwl4965_tfd_frame_data pa[10];
__le32 reserved;
} __attribute__ ((packed));
......@@ -1191,9 +1191,9 @@ struct iwl4965_sched_queue_byte_cnt_tbl {
sizeof(__le16)];
} __attribute__ ((packed));
/* Base physical address of iwl_shared is provided to KDR_SCD_DRAM_BASE_ADDR
* and &iwl_shared.val0 is provided to FH_RSCSR_CHNL0_STTS_WPTR_REG */
struct iwl_shared {
/* Base physical address of iwl4965_shared is provided to KDR_SCD_DRAM_BASE_ADDR
* and &iwl4965_shared.val0 is provided to FH_RSCSR_CHNL0_STTS_WPTR_REG */
struct iwl4965_shared {
struct iwl4965_sched_queue_byte_cnt_tbl
queues_byte_cnt_tbls[IWL_MAX_NUM_QUEUES];
__le32 val0;
......@@ -1225,4 +1225,4 @@ struct iwl_shared {
__le32 padding2;
} __attribute__ ((packed));
#endif /* __iwl_4965_hw_h__ */
#endif /* __iwl4965_4965_hw_h__ */
......@@ -26,8 +26,8 @@
*
*****************************************************************************/
#ifndef __iwl_io_h__
#define __iwl_io_h__
#ifndef __iwl4965_io_h__
#define __iwl4965_io_h__
#include <linux/io.h>
......@@ -49,8 +49,8 @@
*
* If you wish to call the function without any debug or state checking,
* you should use the single _ prefix version (as is used by dependent IO
* routines, for example _iwl_read_direct32 calls the non-check version of
* _iwl_read32.)
* routines, for example _iwl4965_read_direct32 calls the non-check version of
* _iwl4965_read32.)
*
* These declarations are *extremely* useful in quickly isolating code deltas
* which result in misconfiguring of the hardware I/O. In combination with
......@@ -59,39 +59,39 @@
*
*/
#define _iwl_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs))
#define _iwl4965_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs))
#ifdef CONFIG_IWL4965_DEBUG
static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *iwl,
static inline void __iwl4965_write32(const char *f, u32 l, struct iwl4965_priv *iwl,
u32 ofs, u32 val)
{
IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l);
_iwl_write32(iwl, ofs, val);
_iwl4965_write32(iwl, ofs, val);
}
#define iwl_write32(iwl, ofs, val) \
__iwl_write32(__FILE__, __LINE__, iwl, ofs, val)
#define iwl4965_write32(iwl, ofs, val) \
__iwl4965_write32(__FILE__, __LINE__, iwl, ofs, val)
#else
#define iwl_write32(iwl, ofs, val) _iwl_write32(iwl, ofs, val)
#define iwl4965_write32(iwl, ofs, val) _iwl4965_write32(iwl, ofs, val)
#endif
#define _iwl_read32(iwl, ofs) readl((iwl)->hw_base + (ofs))
#define _iwl4965_read32(iwl, ofs) readl((iwl)->hw_base + (ofs))
#ifdef CONFIG_IWL4965_DEBUG
static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *iwl, u32 ofs)
static inline u32 __iwl4965_read32(char *f, u32 l, struct iwl4965_priv *iwl, u32 ofs)
{
IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l);
return _iwl_read32(iwl, ofs);
return _iwl4965_read32(iwl, ofs);
}
#define iwl_read32(iwl, ofs) __iwl_read32(__FILE__, __LINE__, iwl, ofs)
#define iwl4965_read32(iwl, ofs) __iwl4965_read32(__FILE__, __LINE__, iwl, ofs)
#else
#define iwl_read32(p, o) _iwl_read32(p, o)
#define iwl4965_read32(p, o) _iwl4965_read32(p, o)
#endif
static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr,
static inline int _iwl4965_poll_bit(struct iwl4965_priv *priv, u32 addr,
u32 bits, u32 mask, int timeout)
{
int i = 0;
do {
if ((_iwl_read32(priv, addr) & mask) == (bits & mask))
if ((_iwl4965_read32(priv, addr) & mask) == (bits & mask))
return i;
mdelay(10);
i += 10;
......@@ -100,11 +100,11 @@ static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr,
return -ETIMEDOUT;
}
#ifdef CONFIG_IWL4965_DEBUG
static inline int __iwl_poll_bit(const char *f, u32 l,
struct iwl_priv *priv, u32 addr,
static inline int __iwl4965_poll_bit(const char *f, u32 l,
struct iwl4965_priv *priv, u32 addr,
u32 bits, u32 mask, int timeout)
{
int ret = _iwl_poll_bit(priv, addr, bits, mask, timeout);
int ret = _iwl4965_poll_bit(priv, addr, bits, mask, timeout);
if (unlikely(ret == -ETIMEDOUT))
IWL_DEBUG_IO
("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,
addr, bits, mask, ret, f, l);
return ret;
}
#define iwl_poll_bit(iwl, addr, bits, mask, timeout) \
__iwl_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout)
#define iwl4965_poll_bit(iwl, addr, bits, mask, timeout) \
__iwl4965_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout)
#else
#define iwl_poll_bit(p, a, b, m, t) _iwl_poll_bit(p, a, b, m, t)
#define iwl4965_poll_bit(p, a, b, m, t) _iwl4965_poll_bit(p, a, b, m, t)
#endif
static inline void _iwl_set_bit(struct iwl_priv *priv, u32 reg, u32 mask)
static inline void _iwl4965_set_bit(struct iwl4965_priv *priv, u32 reg, u32 mask)
{
_iwl_write32(priv, reg, _iwl_read32(priv, reg) | mask);
_iwl4965_write32(priv, reg, _iwl4965_read32(priv, reg) | mask);
}
#ifdef CONFIG_IWL4965_DEBUG
static inline void __iwl_set_bit(const char *f, u32 l,
struct iwl_priv *priv, u32 reg, u32 mask)
static inline void __iwl4965_set_bit(const char *f, u32 l,
struct iwl4965_priv *priv, u32 reg, u32 mask)
{
u32 val = _iwl_read32(priv, reg) | mask;
u32 val = _iwl4965_read32(priv, reg) | mask;
IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
_iwl_write32(priv, reg, val);
_iwl4965_write32(priv, reg, val);
}
#define iwl_set_bit(p, r, m) __iwl_set_bit(__FILE__, __LINE__, p, r, m)
#define iwl4965_set_bit(p, r, m) __iwl4965_set_bit(__FILE__, __LINE__, p, r, m)
#else
#define iwl_set_bit(p, r, m) _iwl_set_bit(p, r, m)
#define iwl4965_set_bit(p, r, m) _iwl4965_set_bit(p, r, m)
#endif
static inline void _iwl_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask)
static inline void _iwl4965_clear_bit(struct iwl4965_priv *priv, u32 reg, u32 mask)
{
_iwl_write32(priv, reg, _iwl_read32(priv, reg) & ~mask);
_iwl4965_write32(priv, reg, _iwl4965_read32(priv, reg) & ~mask);
}
#ifdef CONFIG_IWL4965_DEBUG
static inline void __iwl_clear_bit(const char *f, u32 l,
struct iwl_priv *priv, u32 reg, u32 mask)
static inline void __iwl4965_clear_bit(const char *f, u32 l,
struct iwl4965_priv *priv, u32 reg, u32 mask)
{
u32 val = _iwl_read32(priv, reg) & ~mask;
u32 val = _iwl4965_read32(priv, reg) & ~mask;
IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
_iwl_write32(priv, reg, val);
_iwl4965_write32(priv, reg, val);
}
#define iwl_clear_bit(p, r, m) __iwl_clear_bit(__FILE__, __LINE__, p, r, m)
#define iwl4965_clear_bit(p, r, m) __iwl4965_clear_bit(__FILE__, __LINE__, p, r, m)
#else
#define iwl_clear_bit(p, r, m) _iwl_clear_bit(p, r, m)
#define iwl4965_clear_bit(p, r, m) _iwl4965_clear_bit(p, r, m)
#endif
static inline int _iwl_grab_nic_access(struct iwl_priv *priv)
static inline int _iwl4965_grab_nic_access(struct iwl4965_priv *priv)
{
int ret;
u32 gp_ctl;
......@@ -170,7 +170,7 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv)
"wakes up NIC\n");
/* 10 msec allows time for NIC to complete its data save */
gp_ctl = _iwl_read32(priv, CSR_GP_CNTRL);
gp_ctl = _iwl4965_read32(priv, CSR_GP_CNTRL);
if (gp_ctl & CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY) {
IWL_DEBUG_RF_KILL("Wait for complete power-down, "
"gpctl = 0x%08x\n", gp_ctl);
......@@ -181,8 +181,8 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv)
}
/* this bit wakes up the NIC */
_iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
ret = _iwl_poll_bit(priv, CSR_GP_CNTRL,
_iwl4965_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
ret = _iwl4965_poll_bit(priv, CSR_GP_CNTRL,
CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN,
(CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY |
CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50);
......@@ -198,106 +198,106 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv)
}
#ifdef CONFIG_IWL4965_DEBUG
static inline int __iwl_grab_nic_access(const char *f, u32 l,
struct iwl_priv *priv)
static inline int __iwl4965_grab_nic_access(const char *f, u32 l,
struct iwl4965_priv *priv)
{
if (atomic_read(&priv->restrict_refcnt))
IWL_DEBUG_INFO("Grabbing access while already held at "
"line %d.\n", l);
IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l);
return _iwl_grab_nic_access(priv);
return _iwl4965_grab_nic_access(priv);
}
#define iwl_grab_nic_access(priv) \
__iwl_grab_nic_access(__FILE__, __LINE__, priv)
#define iwl4965_grab_nic_access(priv) \
__iwl4965_grab_nic_access(__FILE__, __LINE__, priv)
#else
#define iwl_grab_nic_access(priv) \
_iwl_grab_nic_access(priv)
#define iwl4965_grab_nic_access(priv) \
_iwl4965_grab_nic_access(priv)
#endif
static inline void _iwl_release_nic_access(struct iwl_priv *priv)
static inline void _iwl4965_release_nic_access(struct iwl4965_priv *priv)
{
#ifdef CONFIG_IWL4965_DEBUG
if (atomic_dec_and_test(&priv->restrict_refcnt))
#endif
_iwl_clear_bit(priv, CSR_GP_CNTRL,
_iwl4965_clear_bit(priv, CSR_GP_CNTRL,
CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
}
#ifdef CONFIG_IWL4965_DEBUG
static inline void __iwl_release_nic_access(const char *f, u32 l,
struct iwl_priv *priv)
static inline void __iwl4965_release_nic_access(const char *f, u32 l,
struct iwl4965_priv *priv)
{
if (atomic_read(&priv->restrict_refcnt) <= 0)
IWL_ERROR("Release unheld nic access at line %d.\n", l);
IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l);
_iwl_release_nic_access(priv);
_iwl4965_release_nic_access(priv);
}
#define iwl_release_nic_access(priv) \
__iwl_release_nic_access(__FILE__, __LINE__, priv)
#define iwl4965_release_nic_access(priv) \
__iwl4965_release_nic_access(__FILE__, __LINE__, priv)
#else
#define iwl_release_nic_access(priv) \
_iwl_release_nic_access(priv)
#define iwl4965_release_nic_access(priv) \
_iwl4965_release_nic_access(priv)
#endif
static inline u32 _iwl_read_direct32(struct iwl_priv *priv, u32 reg)
static inline u32 _iwl4965_read_direct32(struct iwl4965_priv *priv, u32 reg)
{
return _iwl_read32(priv, reg);
return _iwl4965_read32(priv, reg);
}
#ifdef CONFIG_IWL4965_DEBUG
static inline u32 __iwl_read_direct32(const char *f, u32 l,
struct iwl_priv *priv, u32 reg)
static inline u32 __iwl4965_read_direct32(const char *f, u32 l,
struct iwl4965_priv *priv, u32 reg)
{
u32 value = _iwl_read_direct32(priv, reg);
u32 value = _iwl4965_read_direct32(priv, reg);
if (!atomic_read(&priv->restrict_refcnt))
IWL_ERROR("Nic access not held from %s %d\n", f, l);
IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value,
f, l);
return value;
}
#define iwl_read_direct32(priv, reg) \
__iwl_read_direct32(__FILE__, __LINE__, priv, reg)
#define iwl4965_read_direct32(priv, reg) \
__iwl4965_read_direct32(__FILE__, __LINE__, priv, reg)
#else
#define iwl_read_direct32 _iwl_read_direct32
#define iwl4965_read_direct32 _iwl4965_read_direct32
#endif
static inline void _iwl_write_direct32(struct iwl_priv *priv,
static inline void _iwl4965_write_direct32(struct iwl4965_priv *priv,
u32 reg, u32 value)
{
_iwl_write32(priv, reg, value);
_iwl4965_write32(priv, reg, value);
}
#ifdef CONFIG_IWL4965_DEBUG
static void __iwl_write_direct32(u32 line,
struct iwl_priv *priv, u32 reg, u32 value)
static void __iwl4965_write_direct32(u32 line,
struct iwl4965_priv *priv, u32 reg, u32 value)
{
if (!atomic_read(&priv->restrict_refcnt))
IWL_ERROR("Nic access not held from line %d\n", line);
_iwl_write_direct32(priv, reg, value);
_iwl4965_write_direct32(priv, reg, value);
}
#define iwl_write_direct32(priv, reg, value) \
__iwl_write_direct32(__LINE__, priv, reg, value)
#define iwl4965_write_direct32(priv, reg, value) \
__iwl4965_write_direct32(__LINE__, priv, reg, value)
#else
#define iwl_write_direct32 _iwl_write_direct32
#define iwl4965_write_direct32 _iwl4965_write_direct32
#endif
static inline void iwl_write_reg_buf(struct iwl_priv *priv,
static inline void iwl4965_write_reg_buf(struct iwl4965_priv *priv,
u32 reg, u32 len, u32 *values)
{
u32 count = sizeof(u32);
if ((priv != NULL) && (values != NULL)) {
for (; 0 < len; len -= count, reg += count, values++)
_iwl_write_direct32(priv, reg, *values);
_iwl4965_write_direct32(priv, reg, *values);
}
}
static inline int _iwl_poll_direct_bit(struct iwl_priv *priv,
static inline int _iwl4965_poll_direct_bit(struct iwl4965_priv *priv,
u32 addr, u32 mask, int timeout)
{
int i = 0;
do {
if ((_iwl_read_direct32(priv, addr) & mask) == mask)
if ((_iwl4965_read_direct32(priv, addr) & mask) == mask)
return i;
mdelay(10);
i += 10;
......@@ -307,11 +307,11 @@ static inline int _iwl_poll_direct_bit(struct iwl_priv *priv,
}
#ifdef CONFIG_IWL4965_DEBUG
static inline int __iwl_poll_direct_bit(const char *f, u32 l,
struct iwl_priv *priv,
static inline int __iwl4965_poll_direct_bit(const char *f, u32 l,
struct iwl4965_priv *priv,
u32 addr, u32 mask, int timeout)
{
int ret = _iwl_poll_direct_bit(priv, addr, mask, timeout);
int ret = _iwl4965_poll_direct_bit(priv, addr, mask, timeout);
if (unlikely(ret == -ETIMEDOUT))
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,
"- %s %d\n", addr, mask, ret, f, l);
return ret;
}
#define iwl_poll_direct_bit(iwl, addr, mask, timeout) \
__iwl_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout)
#define iwl4965_poll_direct_bit(iwl, addr, mask, timeout) \
__iwl4965_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout)
#else
#define iwl_poll_direct_bit _iwl_poll_direct_bit
#define iwl4965_poll_direct_bit _iwl4965_poll_direct_bit
#endif
static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg)
static inline u32 _iwl4965_read_prph(struct iwl4965_priv *priv, u32 reg)
{
_iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT);
_iwl4965_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
return _iwl4965_read_direct32(priv, HBUS_TARG_PRPH_RDAT);
}
#ifdef CONFIG_IWL4965_DEBUG
static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg)
static inline u32 __iwl4965_read_prph(u32 line, struct iwl4965_priv *priv, u32 reg)
{
if (!atomic_read(&priv->restrict_refcnt))
IWL_ERROR("Nic access not held from line %d\n", line);
return _iwl_read_prph(priv, reg);
return _iwl4965_read_prph(priv, reg);
}
#define iwl_read_prph(priv, reg) \
__iwl_read_prph(__LINE__, priv, reg)
#define iwl4965_read_prph(priv, reg) \
__iwl4965_read_prph(__LINE__, priv, reg)
#else
#define iwl_read_prph _iwl_read_prph
#define iwl4965_read_prph _iwl4965_read_prph
#endif
static inline void _iwl_write_prph(struct iwl_priv *priv,
static inline void _iwl4965_write_prph(struct iwl4965_priv *priv,
u32 addr, u32 val)
{
_iwl_write_direct32(priv, HBUS_TARG_PRPH_WADDR,
_iwl4965_write_direct32(priv, HBUS_TARG_PRPH_WADDR,
((addr & 0x0000FFFF) | (3 << 24)));
_iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val);
_iwl4965_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val);
}
#ifdef CONFIG_IWL4965_DEBUG
static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv,
static inline void __iwl4965_write_prph(u32 line, struct iwl4965_priv *priv,
u32 addr, u32 val)
{
if (!atomic_read(&priv->restrict_refcnt))
IWL_ERROR("Nic access from line %d\n", line);
_iwl_write_prph(priv, addr, val);
_iwl4965_write_prph(priv, addr, val);
}
#define iwl_write_prph(priv, addr, val) \
__iwl_write_prph(__LINE__, priv, addr, val);
#define iwl4965_write_prph(priv, addr, val) \
__iwl4965_write_prph(__LINE__, priv, addr, val);
#else
#define iwl_write_prph _iwl_write_prph
#define iwl4965_write_prph _iwl4965_write_prph
#endif
#define _iwl_set_bits_prph(priv, reg, mask) \
_iwl_write_prph(priv, reg, (_iwl_read_prph(priv, reg) | mask))
#define _iwl4965_set_bits_prph(priv, reg, mask) \
_iwl4965_write_prph(priv, reg, (_iwl4965_read_prph(priv, reg) | mask))
#ifdef CONFIG_IWL4965_DEBUG
static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv,
static inline void __iwl4965_set_bits_prph(u32 line, struct iwl4965_priv *priv,
u32 reg, u32 mask)
{
if (!atomic_read(&priv->restrict_refcnt))
IWL_ERROR("Nic access not held from line %d\n", line);
_iwl_set_bits_prph(priv, reg, mask);
_iwl4965_set_bits_prph(priv, reg, mask);
}
#define iwl_set_bits_prph(priv, reg, mask) \
__iwl_set_bits_prph(__LINE__, priv, reg, mask)
#define iwl4965_set_bits_prph(priv, reg, mask) \
__iwl4965_set_bits_prph(__LINE__, priv, reg, mask)
#else
#define iwl_set_bits_prph _iwl_set_bits_prph
#define iwl4965_set_bits_prph _iwl4965_set_bits_prph
#endif
#define _iwl_set_bits_mask_prph(priv, reg, bits, mask) \
_iwl_write_prph(priv, reg, ((_iwl_read_prph(priv, reg) & mask) | bits))
#define _iwl4965_set_bits_mask_prph(priv, reg, bits, mask) \
_iwl4965_write_prph(priv, reg, ((_iwl4965_read_prph(priv, reg) & mask) | bits))
#ifdef CONFIG_IWL4965_DEBUG
static inline void __iwl_set_bits_mask_prph(u32 line,
struct iwl_priv *priv, u32 reg, u32 bits, u32 mask)
static inline void __iwl4965_set_bits_mask_prph(u32 line,
struct iwl4965_priv *priv, u32 reg, u32 bits, u32 mask)
{
if (!atomic_read(&priv->restrict_refcnt))
IWL_ERROR("Nic access not held from line %d\n", line);
_iwl_set_bits_mask_prph(priv, reg, bits, mask);
_iwl4965_set_bits_mask_prph(priv, reg, bits, mask);
}
#define iwl_set_bits_mask_prph(priv, reg, bits, mask) \
__iwl_set_bits_mask_prph(__LINE__, priv, reg, bits, mask)
#define iwl4965_set_bits_mask_prph(priv, reg, bits, mask) \
__iwl4965_set_bits_mask_prph(__LINE__, priv, reg, bits, mask)
#else
#define iwl_set_bits_mask_prph _iwl_set_bits_mask_prph
#define iwl4965_set_bits_mask_prph _iwl4965_set_bits_mask_prph
#endif
static inline void iwl_clear_bits_prph(struct iwl_priv
static inline void iwl4965_clear_bits_prph(struct iwl4965_priv
*priv, u32 reg, u32 mask)
{
u32 val = _iwl_read_prph(priv, reg);
_iwl_write_prph(priv, reg, (val & ~mask));
u32 val = _iwl4965_read_prph(priv, reg);
_iwl4965_write_prph(priv, reg, (val & ~mask));
}
static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr)
static inline u32 iwl4965_read_targ_mem(struct iwl4965_priv *priv, u32 addr)
{
iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr);
return iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT);
iwl4965_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr);
return iwl4965_read_direct32(priv, HBUS_TARG_MEM_RDAT);
}
static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val)
static inline void iwl4965_write_targ_mem(struct iwl4965_priv *priv, u32 addr, u32 val)
{
iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, val);
iwl4965_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
iwl4965_write_direct32(priv, HBUS_TARG_MEM_WDAT, val);
}
static inline void iwl_write_targ_mem_buf(struct iwl_priv *priv, u32 addr,
static inline void iwl4965_write_targ_mem_buf(struct iwl4965_priv *priv, u32 addr,
u32 len, u32 *values)
{
iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
iwl4965_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
for (; 0 < len; len -= sizeof(u32), values++)
iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values);
iwl4965_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values);
}
#endif
......@@ -65,11 +65,11 @@ static u8 rs_ht_to_legacy[] = {
IWL_RATE_48M_INDEX, IWL_RATE_54M_INDEX
};
struct iwl_rate {
struct iwl4965_rate {
u32 rate_n_flags;
} __attribute__ ((packed));
struct iwl_rate_scale_data {
struct iwl4965_rate_scale_data {
u64 data;
s32 success_counter;
s32 success_ratio;
......@@ -78,19 +78,19 @@ struct iwl_rate_scale_data {
unsigned long stamp;
};
struct iwl_scale_tbl_info {
enum iwl_table_type lq_type;
enum iwl_antenna_type antenna_type;
struct iwl4965_scale_tbl_info {
enum iwl4965_table_type lq_type;
enum iwl4965_antenna_type antenna_type;
u8 is_SGI;
u8 is_fat;
u8 is_dup;
u8 action;
s32 *expected_tpt;
struct iwl_rate current_rate;
struct iwl_rate_scale_data win[IWL_RATE_COUNT];
struct iwl4965_rate current_rate;
struct iwl4965_rate_scale_data win[IWL_RATE_COUNT];
};
struct iwl_rate_scale_priv {
struct iwl4965_rate_scale_priv {
u8 active_tbl;
u8 enable_counter;
u8 stay_in_tbl;
......@@ -115,31 +115,31 @@ struct iwl_rate_scale_priv {
u16 active_siso_rate;
u16 active_mimo_rate;
u16 active_rate_basic;
struct iwl_link_quality_cmd lq;
struct iwl_scale_tbl_info lq_info[LQ_SIZE];
struct iwl4965_link_quality_cmd lq;
struct iwl4965_scale_tbl_info lq_info[LQ_SIZE];
#ifdef CONFIG_MAC80211_DEBUGFS
struct dentry *rs_sta_dbgfs_scale_table_file;
struct dentry *rs_sta_dbgfs_stats_table_file;
struct iwl_rate dbg_fixed;
struct iwl_priv *drv;
struct iwl4965_rate dbg_fixed;
struct iwl4965_priv *drv;
#endif
};
static void rs_rate_scale_perform(struct iwl_priv *priv,
static void rs_rate_scale_perform(struct iwl4965_priv *priv,
struct net_device *dev,
struct ieee80211_hdr *hdr,
struct sta_info *sta);
static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
struct iwl_rate *tx_mcs,
struct iwl_link_quality_cmd *tbl);
static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data,
struct iwl4965_rate *tx_mcs,
struct iwl4965_link_quality_cmd *tbl);
#ifdef CONFIG_MAC80211_DEBUGFS
static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv,
struct iwl_rate *mcs, int index);
static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv,
struct iwl4965_rate *mcs, int index);
#else
static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv,
struct iwl_rate *mcs, int index)
static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv,
struct iwl4965_rate *mcs, int index)
{}
#endif
static s32 expected_tpt_A[IWL_RATE_COUNT] = {
......@@ -182,27 +182,27 @@ static s32 expected_tpt_mimo40MHzSGI[IWL_RATE_COUNT] = {
0, 0, 0, 0, 131, 131, 191, 222, 242, 270, 284, 289, 293
};
static int iwl_lq_sync_callback(struct iwl_priv *priv,
struct iwl_cmd *cmd, struct sk_buff *skb)
static int iwl4965_lq_sync_callback(struct iwl4965_priv *priv,
struct iwl4965_cmd *cmd, struct sk_buff *skb)
{
/*We didn't cache the SKB; let the caller free it */
return 1;
}
static inline u8 iwl_rate_get_rate(u32 rate_n_flags)
static inline u8 iwl4965_rate_get_rate(u32 rate_n_flags)
{
return (u8)(rate_n_flags & 0xFF);
}
static int rs_send_lq_cmd(struct iwl_priv *priv,
struct iwl_link_quality_cmd *lq, u8 flags)
static int rs_send_lq_cmd(struct iwl4965_priv *priv,
struct iwl4965_link_quality_cmd *lq, u8 flags)
{
#ifdef CONFIG_IWL4965_DEBUG
int i;
#endif
struct iwl_host_cmd cmd = {
struct iwl4965_host_cmd cmd = {
.id = REPLY_TX_LINK_QUALITY_CMD,
.len = sizeof(struct iwl_link_quality_cmd),
.len = sizeof(struct iwl4965_link_quality_cmd),
.meta.flags = flags,
.data = lq,
};
......@@ -225,16 +225,16 @@ static int rs_send_lq_cmd(struct iwl_priv *priv,
#endif
if (flags & CMD_ASYNC)
cmd.meta.u.callback = iwl_lq_sync_callback;
cmd.meta.u.callback = iwl4965_lq_sync_callback;
if (iwl_is_associated(priv) && priv->assoc_station_added &&
if (iwl4965_is_associated(priv) && priv->assoc_station_added &&
priv->lq_mngr.lq_ready)
return iwl_send_cmd(priv, &cmd);
return iwl4965_send_cmd(priv, &cmd);
return 0;
}
static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window)
static void rs_rate_scale_clear_window(struct iwl4965_rate_scale_data *window)
{
window->data = 0;
window->success_counter = 0;
......@@ -244,10 +244,10 @@ static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window)
window->stamp = 0;
}
static int rs_collect_tx_data(struct iwl_rate_scale_data *windows,
static int rs_collect_tx_data(struct iwl4965_rate_scale_data *windows,
int scale_index, s32 tpt, u32 status)
{
struct iwl_rate_scale_data *window = NULL;
struct iwl4965_rate_scale_data *window = NULL;
u64 mask;
u8 win_size = IWL_RATE_MAX_WINDOW;
s32 fail_count;
......@@ -295,24 +295,24 @@ static int rs_collect_tx_data(struct iwl_rate_scale_data *windows,
return 0;
}
static void rs_mcs_from_tbl(struct iwl_rate *mcs_rate,
struct iwl_scale_tbl_info *tbl,
static void rs_mcs_from_tbl(struct iwl4965_rate *mcs_rate,
struct iwl4965_scale_tbl_info *tbl,
int index, u8 use_green)
{
if (is_legacy(tbl->lq_type)) {
mcs_rate->rate_n_flags = iwl_rates[index].plcp;
mcs_rate->rate_n_flags = iwl4965_rates[index].plcp;
if (index >= IWL_FIRST_CCK_RATE && index <= IWL_LAST_CCK_RATE)
mcs_rate->rate_n_flags |= RATE_MCS_CCK_MSK;
} else if (is_siso(tbl->lq_type)) {
if (index > IWL_LAST_OFDM_RATE)
index = IWL_LAST_OFDM_RATE;
mcs_rate->rate_n_flags = iwl_rates[index].plcp_siso |
mcs_rate->rate_n_flags = iwl4965_rates[index].plcp_siso |
RATE_MCS_HT_MSK;
} else {
if (index > IWL_LAST_OFDM_RATE)
index = IWL_LAST_OFDM_RATE;
mcs_rate->rate_n_flags = iwl_rates[index].plcp_mimo |
mcs_rate->rate_n_flags = iwl4965_rates[index].plcp_mimo |
RATE_MCS_HT_MSK;
}
......@@ -349,14 +349,14 @@ static void rs_mcs_from_tbl(struct iwl_rate *mcs_rate,
}
}
static int rs_get_tbl_info_from_mcs(const struct iwl_rate *mcs_rate,
int phymode, struct iwl_scale_tbl_info *tbl,
static int rs_get_tbl_info_from_mcs(const struct iwl4965_rate *mcs_rate,
int phymode, struct iwl4965_scale_tbl_info *tbl,
int *rate_idx)
{
int index;
u32 ant_msk;
index = iwl_rate_index_from_plcp(mcs_rate->rate_n_flags);
index = iwl4965_rate_index_from_plcp(mcs_rate->rate_n_flags);
if (index == IWL_RATE_INVALID) {
*rate_idx = -1;
......@@ -386,7 +386,7 @@ static int rs_get_tbl_info_from_mcs(const struct iwl_rate *mcs_rate,
}
*rate_idx = index;
} else if (iwl_rate_get_rate(mcs_rate->rate_n_flags)
} else if (iwl4965_rate_get_rate(mcs_rate->rate_n_flags)
<= IWL_RATE_SISO_60M_PLCP) {
tbl->lq_type = LQ_SISO;
......@@ -426,8 +426,8 @@ static int rs_get_tbl_info_from_mcs(const struct iwl_rate *mcs_rate,
return 0;
}
static inline void rs_toggle_antenna(struct iwl_rate *new_rate,
struct iwl_scale_tbl_info *tbl)
static inline void rs_toggle_antenna(struct iwl4965_rate *new_rate,
struct iwl4965_scale_tbl_info *tbl)
{
if (tbl->antenna_type == ANT_AUX) {
tbl->antenna_type = ANT_MAIN;
......@@ -440,7 +440,7 @@ static inline void rs_toggle_antenna(struct iwl_rate *new_rate,
}
}
static inline u8 rs_use_green(struct iwl_priv *priv)
static inline u8 rs_use_green(struct iwl4965_priv *priv)
{
#ifdef CONFIG_IWL4965_HT
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)
* basic available rates.
*
*/
static void rs_get_supported_rates(struct iwl_rate_scale_priv *lq_data,
static void rs_get_supported_rates(struct iwl4965_rate_scale_priv *lq_data,
struct ieee80211_hdr *hdr,
enum iwl_table_type rate_type,
enum iwl4965_table_type rate_type,
u16 *data_rate)
{
if (is_legacy(rate_type))
......@@ -512,7 +512,7 @@ static u16 rs_get_adjacent_rate(u8 index, u16 rate_mask, int rate_type)
low = index;
while (low != IWL_RATE_INVALID) {
low = iwl_rates[low].prev_rs;
low = iwl4965_rates[low].prev_rs;
if (low == IWL_RATE_INVALID)
break;
if (rate_mask & (1 << low))
......@@ -522,7 +522,7 @@ static u16 rs_get_adjacent_rate(u8 index, u16 rate_mask, int rate_type)
high = index;
while (high != IWL_RATE_INVALID) {
high = iwl_rates[high].next_rs;
high = iwl4965_rates[high].next_rs;
if (high == IWL_RATE_INVALID)
break;
if (rate_mask & (1 << high))
......@@ -533,9 +533,9 @@ static u16 rs_get_adjacent_rate(u8 index, u16 rate_mask, int rate_type)
return (high << 8) | low;
}
static void rs_get_lower_rate(struct iwl_rate_scale_priv *lq_data,
struct iwl_scale_tbl_info *tbl, u8 scale_index,
u8 ht_possible, struct iwl_rate *mcs_rate)
static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data,
struct iwl4965_scale_tbl_info *tbl, u8 scale_index,
u8 ht_possible, struct iwl4965_rate *mcs_rate)
{
s32 low;
u16 rate_mask;
......@@ -596,17 +596,17 @@ static void rs_tx_status(void *priv_rate,
int status;
u8 retries;
int rs_index, index = 0;
struct iwl_rate_scale_priv *lq;
struct iwl_link_quality_cmd *table;
struct iwl4965_rate_scale_priv *lq;
struct iwl4965_link_quality_cmd *table;
struct sta_info *sta;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate;
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct iwl_rate_scale_data *window = NULL;
struct iwl_rate_scale_data *search_win = NULL;
struct iwl_rate tx_mcs;
struct iwl_scale_tbl_info tbl_type;
struct iwl_scale_tbl_info *curr_tbl, *search_tbl;
struct iwl4965_rate_scale_data *window = NULL;
struct iwl4965_rate_scale_data *search_win = NULL;
struct iwl4965_rate tx_mcs;
struct iwl4965_scale_tbl_info tbl_type;
struct iwl4965_scale_tbl_info *curr_tbl, *search_tbl;
u8 active_index = 0;
u16 fc = le16_to_cpu(hdr->frame_control);
s32 tpt = 0;
......@@ -630,7 +630,7 @@ static void rs_tx_status(void *priv_rate,
return;
}
lq = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv;
lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv;
if (!priv->lq_mngr.lq_ready)
return;
......@@ -648,9 +648,9 @@ static void rs_tx_status(void *priv_rate,
lq->antenna = lq->valid_antenna;
curr_tbl = &(lq->lq_info[active_index]);
search_tbl = &(lq->lq_info[(1 - active_index)]);
window = (struct iwl_rate_scale_data *)
window = (struct iwl4965_rate_scale_data *)
&(curr_tbl->win[0]);
search_win = (struct iwl_rate_scale_data *)
search_win = (struct iwl4965_rate_scale_data *)
&(search_tbl->win[0]);
tx_mcs.rate_n_flags = tx_resp->control.tx_rate;
......@@ -751,7 +751,7 @@ static void rs_tx_status(void *priv_rate,
}
static u8 rs_is_ant_connected(u8 valid_antenna,
enum iwl_antenna_type antenna_type)
enum iwl4965_antenna_type antenna_type)
{
if (antenna_type == ANT_AUX)
return ((valid_antenna & 0x2) ? 1:0);
......@@ -764,7 +764,7 @@ static u8 rs_is_ant_connected(u8 valid_antenna,
}
static u8 rs_is_other_ant_connected(u8 valid_antenna,
enum iwl_antenna_type antenna_type)
enum iwl4965_antenna_type antenna_type)
{
if (antenna_type == ANT_AUX)
return rs_is_ant_connected(valid_antenna, ANT_MAIN);
......@@ -775,7 +775,7 @@ static u8 rs_is_other_ant_connected(u8 valid_antenna,
}
static void rs_set_stay_in_table(u8 is_legacy,
struct iwl_rate_scale_priv *lq_data)
struct iwl4965_rate_scale_priv *lq_data)
{
IWL_DEBUG_HT("we are staying in the same table\n");
lq_data->stay_in_tbl = 1;
......@@ -793,8 +793,8 @@ static void rs_set_stay_in_table(u8 is_legacy,
lq_data->total_success = 0;
}
static void rs_get_expected_tpt_table(struct iwl_rate_scale_priv *lq_data,
struct iwl_scale_tbl_info *tbl)
static void rs_get_expected_tpt_table(struct iwl4965_rate_scale_priv *lq_data,
struct iwl4965_scale_tbl_info *tbl)
{
if (is_legacy(tbl->lq_type)) {
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,
}
#ifdef CONFIG_IWL4965_HT
static s32 rs_get_best_rate(struct iwl_priv *priv,
struct iwl_rate_scale_priv *lq_data,
struct iwl_scale_tbl_info *tbl,
static s32 rs_get_best_rate(struct iwl4965_priv *priv,
struct iwl4965_rate_scale_priv *lq_data,
struct iwl4965_scale_tbl_info *tbl,
u16 rate_mask, s8 index, s8 rate)
{
struct iwl_scale_tbl_info *active_tbl =
struct iwl4965_scale_tbl_info *active_tbl =
&(lq_data->lq_info[lq_data->active_tbl]);
s32 new_rate, high, low, start_hi;
s32 active_sr = active_tbl->win[index].success_ratio;
......@@ -886,9 +886,9 @@ static inline u8 rs_is_both_ant_supp(u8 valid_antenna)
return (rs_is_ant_connected(valid_antenna, ANT_BOTH));
}
static int rs_switch_to_mimo(struct iwl_priv *priv,
struct iwl_rate_scale_priv *lq_data,
struct iwl_scale_tbl_info *tbl, int index)
static int rs_switch_to_mimo(struct iwl4965_priv *priv,
struct iwl4965_rate_scale_priv *lq_data,
struct iwl4965_scale_tbl_info *tbl, int index)
{
#ifdef CONFIG_IWL4965_HT
u16 rate_mask;
......@@ -943,9 +943,9 @@ static int rs_switch_to_mimo(struct iwl_priv *priv,
#endif /*CONFIG_IWL4965_HT */
}
static int rs_switch_to_siso(struct iwl_priv *priv,
struct iwl_rate_scale_priv *lq_data,
struct iwl_scale_tbl_info *tbl, int index)
static int rs_switch_to_siso(struct iwl4965_priv *priv,
struct iwl4965_rate_scale_priv *lq_data,
struct iwl4965_scale_tbl_info *tbl, int index)
{
#ifdef CONFIG_IWL4965_HT
u16 rate_mask;
......@@ -999,18 +999,18 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
#endif /*CONFIG_IWL4965_HT */
}
static int rs_move_legacy_other(struct iwl_priv *priv,
struct iwl_rate_scale_priv *lq_data,
static int rs_move_legacy_other(struct iwl4965_priv *priv,
struct iwl4965_rate_scale_priv *lq_data,
int index)
{
int ret = 0;
struct iwl_scale_tbl_info *tbl =
struct iwl4965_scale_tbl_info *tbl =
&(lq_data->lq_info[lq_data->active_tbl]);
struct iwl_scale_tbl_info *search_tbl =
struct iwl4965_scale_tbl_info *search_tbl =
&(lq_data->lq_info[(1 - lq_data->active_tbl)]);
struct iwl_rate_scale_data *window = &(tbl->win[index]);
u32 sz = (sizeof(struct iwl_scale_tbl_info) -
(sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
struct iwl4965_rate_scale_data *window = &(tbl->win[index]);
u32 sz = (sizeof(struct iwl4965_scale_tbl_info) -
(sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT));
u8 start_action = tbl->action;
for (; ;) {
......@@ -1083,19 +1083,19 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
}
static int rs_move_siso_to_other(struct iwl_priv *priv,
struct iwl_rate_scale_priv *lq_data,
static int rs_move_siso_to_other(struct iwl4965_priv *priv,
struct iwl4965_rate_scale_priv *lq_data,
int index)
{
int ret;
u8 is_green = lq_data->is_green;
struct iwl_scale_tbl_info *tbl =
struct iwl4965_scale_tbl_info *tbl =
&(lq_data->lq_info[lq_data->active_tbl]);
struct iwl_scale_tbl_info *search_tbl =
struct iwl4965_scale_tbl_info *search_tbl =
&(lq_data->lq_info[(1 - lq_data->active_tbl)]);
struct iwl_rate_scale_data *window = &(tbl->win[index]);
u32 sz = (sizeof(struct iwl_scale_tbl_info) -
(sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
struct iwl4965_rate_scale_data *window = &(tbl->win[index]);
u32 sz = (sizeof(struct iwl4965_scale_tbl_info) -
(sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT));
u8 start_action = tbl->action;
for (;;) {
......@@ -1173,18 +1173,18 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
return 0;
}
static int rs_move_mimo_to_other(struct iwl_priv *priv,
struct iwl_rate_scale_priv *lq_data,
static int rs_move_mimo_to_other(struct iwl4965_priv *priv,
struct iwl4965_rate_scale_priv *lq_data,
int index)
{
int ret;
s8 is_green = lq_data->is_green;
struct iwl_scale_tbl_info *tbl =
struct iwl4965_scale_tbl_info *tbl =
&(lq_data->lq_info[lq_data->active_tbl]);
struct iwl_scale_tbl_info *search_tbl =
struct iwl4965_scale_tbl_info *search_tbl =
&(lq_data->lq_info[(1 - lq_data->active_tbl)]);
u32 sz = (sizeof(struct iwl_scale_tbl_info) -
(sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
u32 sz = (sizeof(struct iwl4965_scale_tbl_info) -
(sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT));
u8 start_action = tbl->action;
for (;;) {
......@@ -1253,9 +1253,9 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv,
}
static void rs_stay_in_table(struct iwl_rate_scale_priv *lq_data)
static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data)
{
struct iwl_scale_tbl_info *tbl;
struct iwl4965_scale_tbl_info *tbl;
int i;
int active_tbl;
int flush_interval_passed = 0;
......@@ -1305,7 +1305,7 @@ static void rs_stay_in_table(struct iwl_rate_scale_priv *lq_data)
}
}
static void rs_rate_scale_perform(struct iwl_priv *priv,
static void rs_rate_scale_perform(struct iwl4965_priv *priv,
struct net_device *dev,
struct ieee80211_hdr *hdr,
struct sta_info *sta)
......@@ -1314,7 +1314,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
int high = IWL_RATE_INVALID;
int index;
int i;
struct iwl_rate_scale_data *window = NULL;
struct iwl4965_rate_scale_data *window = NULL;
int current_tpt = IWL_INVALID_VALUE;
int low_tpt = IWL_INVALID_VALUE;
int high_tpt = IWL_INVALID_VALUE;
......@@ -1322,10 +1322,10 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
s8 scale_action = 0;
u16 fc, rate_mask;
u8 update_lq = 0;
struct iwl_rate_scale_priv *lq_data;
struct iwl_scale_tbl_info *tbl, *tbl1;
struct iwl4965_rate_scale_priv *lq_data;
struct iwl4965_scale_tbl_info *tbl, *tbl1;
u16 rate_scale_index_msk = 0;
struct iwl_rate mcs_rate;
struct iwl4965_rate mcs_rate;
u8 is_green = 0;
u8 active_tbl = 0;
u8 done_search = 0;
......@@ -1348,7 +1348,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
IWL_DEBUG_RATE("still rate scaling not ready\n");
return;
}
lq_data = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv;
lq_data = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv;
if (!lq_data->search_better_tbl)
active_tbl = lq_data->active_tbl;
......@@ -1445,7 +1445,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
active_tbl = lq_data->active_tbl;
tbl = &(lq_data->lq_info[active_tbl]);
index = iwl_rate_index_from_plcp(
index = iwl4965_rate_index_from_plcp(
tbl->current_rate.rate_n_flags);
update_lq = 1;
......@@ -1559,7 +1559,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
for (i = 0; i < IWL_RATE_COUNT; i++)
rs_rate_scale_clear_window(&(tbl->win[i]));
index = iwl_rate_index_from_plcp(
index = iwl4965_rate_index_from_plcp(
tbl->current_rate.rate_n_flags);
IWL_DEBUG_HT("Switch current mcs: %X index: %d\n",
......@@ -1615,21 +1615,21 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
}
static void rs_initialize_lq(struct iwl_priv *priv,
static void rs_initialize_lq(struct iwl4965_priv *priv,
struct sta_info *sta)
{
int i;
struct iwl_rate_scale_priv *lq;
struct iwl_scale_tbl_info *tbl;
struct iwl4965_rate_scale_priv *lq;
struct iwl4965_scale_tbl_info *tbl;
u8 active_tbl = 0;
int rate_idx;
u8 use_green = rs_use_green(priv);
struct iwl_rate mcs_rate;
struct iwl4965_rate mcs_rate;
if (!sta || !sta->rate_ctrl_priv)
goto out;
lq = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv;
lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv;
i = sta->last_txrate;
if ((lq->lq.sta_id == 0xff) &&
......@@ -1646,7 +1646,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
if ((i < 0) || (i >= IWL_RATE_COUNT))
i = 0;
mcs_rate.rate_n_flags = iwl_rates[i].plcp ;
mcs_rate.rate_n_flags = iwl4965_rates[i].plcp ;
mcs_rate.rate_n_flags |= RATE_MCS_ANT_B_MSK;
mcs_rate.rate_n_flags &= ~RATE_MCS_ANT_A_MSK;
......@@ -1676,8 +1676,8 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct sta_info *sta;
struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
struct iwl_rate_scale_priv *lq;
struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate;
struct iwl4965_rate_scale_priv *lq;
IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n");
......@@ -1690,17 +1690,17 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
return;
}
lq = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv;
lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv;
i = sta->last_txrate;
if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && !lq->ibss_sta_added) {
u8 sta_id = iwl_hw_find_station(priv, hdr->addr1);
u8 sta_id = iwl4965_hw_find_station(priv, hdr->addr1);
DECLARE_MAC_BUF(mac);
if (sta_id == IWL_INVALID_STATION) {
IWL_DEBUG_RATE("LQ: ADD station %s\n",
print_mac(mac, hdr->addr1));
sta_id = iwl_add_station(priv,
sta_id = iwl4965_add_station_flags(priv,
hdr->addr1, 0, CMD_ASYNC);
}
if ((sta_id != IWL_INVALID_STATION)) {
......@@ -1725,12 +1725,12 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
static void *rs_alloc_sta(void *priv, gfp_t gfp)
{
struct iwl_rate_scale_priv *crl;
struct iwl4965_rate_scale_priv *crl;
int i, j;
IWL_DEBUG_RATE("create station rate scale window\n");
crl = kzalloc(sizeof(struct iwl_rate_scale_priv), gfp);
crl = kzalloc(sizeof(struct iwl4965_rate_scale_priv), gfp);
if (crl == NULL)
return NULL;
......@@ -1750,8 +1750,8 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
{
int i, j;
struct ieee80211_hw_mode *mode = local->oper_hw_mode;
struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
struct iwl_rate_scale_priv *crl = priv_sta;
struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate;
struct iwl4965_rate_scale_priv *crl = priv_sta;
crl->flush_timer = 0;
crl->supp_rates = sta->supp_rates;
......@@ -1768,7 +1768,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
crl->ibss_sta_added = 0;
if (priv->iw_mode == IEEE80211_IF_TYPE_AP) {
u8 sta_id = iwl_hw_find_station(priv, sta->addr);
u8 sta_id = iwl4965_hw_find_station(priv, sta->addr);
DECLARE_MAC_BUF(mac);
/* for IBSS the call are from tasklet */
......@@ -1778,7 +1778,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
if (sta_id == IWL_INVALID_STATION) {
IWL_DEBUG_RATE("LQ: ADD station %s\n",
print_mac(mac, sta->addr));
sta_id = iwl_add_station(priv,
sta_id = iwl4965_add_station_flags(priv,
sta->addr, 0, CMD_ASYNC);
}
if ((sta_id != IWL_INVALID_STATION)) {
......@@ -1832,17 +1832,17 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
rs_initialize_lq(priv, sta);
}
static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
struct iwl_rate *tx_mcs,
struct iwl_link_quality_cmd *lq_cmd)
static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data,
struct iwl4965_rate *tx_mcs,
struct iwl4965_link_quality_cmd *lq_cmd)
{
int index = 0;
int rate_idx;
int repeat_rate = 0;
u8 ant_toggle_count = 0;
u8 use_ht_possible = 1;
struct iwl_rate new_rate;
struct iwl_scale_tbl_info tbl_type = { 0 };
struct iwl4965_rate new_rate;
struct iwl4965_scale_tbl_info tbl_type = { 0 };
rs_dbgfs_set_mcs(lq_data, tx_mcs, index);
......@@ -1935,7 +1935,7 @@ static void rs_free(void *priv_rate)
static void rs_clear(void *priv_rate)
{
struct iwl_priv *priv = (struct iwl_priv *) priv_rate;
struct iwl4965_priv *priv = (struct iwl4965_priv *) priv_rate;
IWL_DEBUG_RATE("enter\n");
......@@ -1952,7 +1952,7 @@ static void rs_clear(void *priv_rate)
static void rs_free_sta(void *priv, void *priv_sta)
{
struct iwl_rate_scale_priv *rs_priv = priv_sta;
struct iwl4965_rate_scale_priv *rs_priv = priv_sta;
IWL_DEBUG_RATE("enter\n");
kfree(rs_priv);
......@@ -1966,8 +1966,8 @@ static int open_file_generic(struct inode *inode, struct file *file)
file->private_data = inode->i_private;
return 0;
}
static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv,
struct iwl_rate *mcs, int index)
static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv,
struct iwl4965_rate *mcs, int index)
{
u32 base_rate;
......@@ -1991,7 +1991,7 @@ static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv,
static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
const char __user *user_buf, size_t count, loff_t *ppos)
{
struct iwl_rate_scale_priv *rs_priv = file->private_data;
struct iwl4965_rate_scale_priv *rs_priv = file->private_data;
char buf[64];
int buf_size;
u32 parsed_rate;
......@@ -2028,7 +2028,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
int desc = 0;
int i = 0;
struct iwl_rate_scale_priv *rs_priv = file->private_data;
struct iwl4965_rate_scale_priv *rs_priv = file->private_data;
desc += sprintf(buff+desc, "sta_id %d\n", rs_priv->lq.sta_id);
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,
int desc = 0;
int i, j;
struct iwl_rate_scale_priv *rs_priv = file->private_data;
struct iwl4965_rate_scale_priv *rs_priv = file->private_data;
for (i = 0; i < LQ_SIZE; i++) {
desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n"
"rate=0x%X\n",
......@@ -2105,7 +2105,7 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
static void rs_add_debugfs(void *priv, void *priv_sta,
struct dentry *dir)
{
struct iwl_rate_scale_priv *rs_priv = priv_sta;
struct iwl4965_rate_scale_priv *rs_priv = priv_sta;
rs_priv->rs_sta_dbgfs_scale_table_file =
debugfs_create_file("rate_scale_table", 0600, dir,
rs_priv, &rs_sta_dbgfs_scale_table_ops);
......@@ -2116,7 +2116,7 @@ static void rs_add_debugfs(void *priv, void *priv_sta,
static void rs_remove_debugfs(void *priv, void *priv_sta)
{
struct iwl_rate_scale_priv *rs_priv = priv_sta;
struct iwl4965_rate_scale_priv *rs_priv = priv_sta;
debugfs_remove(rs_priv->rs_sta_dbgfs_scale_table_file);
debugfs_remove(rs_priv->rs_sta_dbgfs_stats_table_file);
}
......@@ -2139,11 +2139,11 @@ static struct rate_control_ops rs_ops = {
#endif
};
int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
{
struct ieee80211_local *local = hw_to_local(hw);
struct iwl_priv *priv = hw->priv;
struct iwl_rate_scale_priv *rs_priv;
struct iwl4965_priv *priv = hw->priv;
struct iwl4965_rate_scale_priv *rs_priv;
struct sta_info *sta;
int count = 0, i;
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)
int active = rs_priv->active_tbl;
count +=
sprintf(&buf[count], " %2dMbs: ", iwl_rates[i].ieee / 2);
sprintf(&buf[count], " %2dMbs: ", iwl4965_rates[i].ieee / 2);
mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1));
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)
samples += rs_priv->lq_info[active].win[i].counter;
good += rs_priv->lq_info[active].win[i].success_counter;
success += rs_priv->lq_info[active].win[i].success_counter *
iwl_rates[i].ieee;
iwl4965_rates[i].ieee;
if (rs_priv->lq_info[active].win[i].stamp) {
int delta =
......@@ -2201,7 +2201,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
} else
buf[count++] = '\n';
j = iwl_get_prev_ieee_rate(i);
j = iwl4965_get_prev_ieee_rate(i);
if (j == i)
break;
i = j;
......@@ -2210,7 +2210,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
/* Display the average rate of all samples taken.
*
* NOTE: We multiple # of samples by 2 since the IEEE measurement
* added from iwl_rates is actually 2X the rate */
* added from iwl4965_rates is actually 2X the rate */
if (samples)
count += sprintf(&buf[count],
"\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)
return count;
}
void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
void iwl4965_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
{
struct iwl_priv *priv = hw->priv;
struct iwl4965_priv *priv = hw->priv;
priv->lq_mngr.lq_ready = 1;
}
void iwl_rate_control_register(struct ieee80211_hw *hw)
void iwl4965_rate_control_register(struct ieee80211_hw *hw)
{
ieee80211_rate_control_register(&rs_ops);
}
void iwl_rate_control_unregister(struct ieee80211_hw *hw)
void iwl4965_rate_control_unregister(struct ieee80211_hw *hw)
{
ieee80211_rate_control_unregister(&rs_ops);
}
......
......@@ -29,7 +29,7 @@
#include "iwl-4965.h"
struct iwl_rate_info {
struct iwl4965_rate_info {
u8 plcp;
u8 plcp_siso;
u8 plcp_mimo;
......@@ -197,9 +197,9 @@ enum {
#define LQ_SIZE 2
extern const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT];
extern const struct iwl4965_rate_info iwl4965_rates[IWL_RATE_COUNT];
enum iwl_table_type {
enum iwl4965_table_type {
LQ_NONE,
LQ_G,
LQ_A,
......@@ -208,59 +208,59 @@ enum iwl_table_type {
LQ_MAX,
};
enum iwl_antenna_type {
enum iwl4965_antenna_type {
ANT_NONE,
ANT_MAIN,
ANT_AUX,
ANT_BOTH,
};
static inline u8 iwl_get_prev_ieee_rate(u8 rate_index)
static inline u8 iwl4965_get_prev_ieee_rate(u8 rate_index)
{
u8 rate = iwl_rates[rate_index].prev_ieee;
u8 rate = iwl4965_rates[rate_index].prev_ieee;
if (rate == IWL_RATE_INVALID)
rate = rate_index;
return rate;
}
extern int iwl_rate_index_from_plcp(int plcp);
extern int iwl4965_rate_index_from_plcp(int plcp);
/**
* iwl_fill_rs_info - Fill an output text buffer with the rate representation
* iwl4965_fill_rs_info - Fill an output text buffer with the rate representation
*
* NOTE: This is provided as a quick mechanism for a user to visualize
* the performance of the rate control algorithm and is not meant to be
* parsed software.
*/
extern int iwl_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id);
extern int iwl4965_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id);
/**
* iwl_rate_scale_init - Initialize the rate scale table based on assoc info
* iwl4965_rate_scale_init - Initialize the rate scale table based on assoc info
*
* The specific throughput table used is based on the type of network
* the associated with, including A, B, G, and G w/ TGG protection
*/
extern void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id);
extern void iwl4965_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id);
/**
* iwl_rate_control_register - Register the rate control algorithm callbacks
* iwl4965_rate_control_register - Register the rate control algorithm callbacks
*
* Since the rate control algorithm is hardware specific, there is no need
* or reason to place it as a stand alone module. The driver can call
* iwl_rate_control_register in order to register the rate control callbacks
* iwl4965_rate_control_register in order to register the rate control callbacks
* with the mac80211 subsystem. This should be performed prior to calling
* ieee80211_register_hw
*
*/
extern void iwl_rate_control_register(struct ieee80211_hw *hw);
extern void iwl4965_rate_control_register(struct ieee80211_hw *hw);
/**
* iwl_rate_control_unregister - Unregister the rate control callbacks
* iwl4965_rate_control_unregister - Unregister the rate control callbacks
*
* This should be called after calling ieee80211_unregister_hw, but before
* the driver is unloaded.
*/
extern void iwl_rate_control_unregister(struct ieee80211_hw *hw);
extern void iwl4965_rate_control_unregister(struct ieee80211_hw *hw);
#endif
......@@ -40,7 +40,7 @@
#include "iwl-4965.h"
#include "iwl-helpers.h"
static void iwl_hw_card_show_info(struct iwl_priv *priv);
static void iwl4965_hw_card_show_info(struct iwl4965_priv *priv);
#define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \
[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);
* maps to IWL_RATE_INVALID
*
*/
const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = {
const struct iwl4965_rate_info iwl4965_rates[IWL_RATE_COUNT] = {
IWL_DECLARE_RATE_INFO(1, INV, INV, 2, INV, 2, INV, 2), /* 1mbps */
IWL_DECLARE_RATE_INFO(2, INV, 1, 5, 1, 5, 1, 5), /* 2mbps */
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)
(rxon_flags & RXON_FLG_CHANNEL_MODE_MIXED_MSK);
}
static u8 is_single_stream(struct iwl_priv *priv)
static u8 is_single_stream(struct iwl4965_priv *priv)
{
#ifdef CONFIG_IWL4965_HT
if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht ||
......@@ -103,7 +103,7 @@ static u8 is_single_stream(struct iwl_priv *priv)
* MIMO (dual stream) requires at least 2, but works better with 3.
* This does not determine *which* chains to use, just how many.
*/
static int iwl4965_get_rx_chain_counter(struct iwl_priv *priv,
static int iwl4965_get_rx_chain_counter(struct iwl4965_priv *priv,
u8 *idle_state, u8 *rx_state)
{
u8 is_single = is_single_stream(priv);
......@@ -132,32 +132,32 @@ static int iwl4965_get_rx_chain_counter(struct iwl_priv *priv,
return 0;
}
int iwl_hw_rxq_stop(struct iwl_priv *priv)
int iwl4965_hw_rxq_stop(struct iwl4965_priv *priv)
{
int rc;
unsigned long flags;
spin_lock_irqsave(&priv->lock, flags);
rc = iwl_grab_nic_access(priv);
rc = iwl4965_grab_nic_access(priv);
if (rc) {
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
}
/* stop HW */
iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
rc = iwl_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG,
iwl4965_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
rc = iwl4965_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG,
(1 << 24), 1000);
if (rc < 0)
IWL_ERROR("Can't stop Rx DMA.\n");
iwl_release_nic_access(priv);
iwl4965_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
return 0;
}
u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *addr)
u8 iwl4965_hw_find_station(struct iwl4965_priv *priv, const u8 *addr)
{
int i;
int start = 0;
......@@ -189,13 +189,13 @@ u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *addr)
return ret;
}
static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max)
static int iwl4965_nic_set_pwr_src(struct iwl4965_priv *priv, int pwr_max)
{
int ret;
unsigned long flags;
spin_lock_irqsave(&priv->lock, flags);
ret = iwl_grab_nic_access(priv);
ret = iwl4965_grab_nic_access(priv);
if (ret) {
spin_unlock_irqrestore(&priv->lock, flags);
return ret;
......@@ -208,44 +208,44 @@ static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max)
&val);
if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT)
iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
iwl4965_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
~APMG_PS_CTRL_MSK_PWR_SRC);
} else
iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
iwl4965_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
~APMG_PS_CTRL_MSK_PWR_SRC);
iwl_release_nic_access(priv);
iwl4965_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
return ret;
}
static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
static int iwl4965_rx_init(struct iwl4965_priv *priv, struct iwl4965_rx_queue *rxq)
{
int rc;
unsigned long flags;
spin_lock_irqsave(&priv->lock, flags);
rc = iwl_grab_nic_access(priv);
rc = iwl4965_grab_nic_access(priv);
if (rc) {
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
}
/* stop HW */
iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
iwl4965_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
iwl_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0);
iwl_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG,
iwl4965_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0);
iwl4965_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG,
rxq->dma_addr >> 8);
iwl_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG,
iwl4965_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG,
(priv->hw_setting.shared_phys +
offsetof(struct iwl_shared, val0)) >> 4);
offsetof(struct iwl4965_shared, val0)) >> 4);
iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG,
iwl4965_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG,
FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL |
FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL |
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)
FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT));
/*
* iwl_write32(priv,CSR_INT_COAL_REG,0);
* iwl4965_write32(priv,CSR_INT_COAL_REG,0);
*/
iwl_release_nic_access(priv);
iwl4965_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
return 0;
}
static int iwl4965_kw_init(struct iwl_priv *priv)
static int iwl4965_kw_init(struct iwl4965_priv *priv)
{
unsigned long flags;
int rc;
spin_lock_irqsave(&priv->lock, flags);
rc = iwl_grab_nic_access(priv);
rc = iwl4965_grab_nic_access(priv);
if (rc)
goto out;
iwl_write_direct32(priv, IWL_FH_KW_MEM_ADDR_REG,
iwl4965_write_direct32(priv, IWL_FH_KW_MEM_ADDR_REG,
priv->kw.dma_addr >> 4);
iwl_release_nic_access(priv);
iwl4965_release_nic_access(priv);
out:
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
}
static int iwl4965_kw_alloc(struct iwl_priv *priv)
static int iwl4965_kw_alloc(struct iwl4965_priv *priv)
{
struct pci_dev *dev = priv->pci_dev;
struct iwl_kw *kw = &priv->kw;
struct iwl4965_kw *kw = &priv->kw;
kw->size = IWL4965_KW_SIZE; /* TBW need set somewhere else */
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)
#define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \
? # x " " : "")
int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, u16 channel,
const struct iwl_eeprom_channel *eeprom_ch,
int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv, int phymode, u16 channel,
const struct iwl4965_eeprom_channel *eeprom_ch,
u8 fat_extension_channel)
{
struct iwl_channel_info *ch_info;
struct iwl4965_channel_info *ch_info;
ch_info = (struct iwl_channel_info *)
iwl_get_channel_info(priv, phymode, channel);
ch_info = (struct iwl4965_channel_info *)
iwl4965_get_channel_info(priv, phymode, channel);
if (!is_channel_valid(ch_info))
return -1;
......@@ -337,10 +337,10 @@ int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, u16 channel,
return 0;
}
static void iwl4965_kw_free(struct iwl_priv *priv)
static void iwl4965_kw_free(struct iwl4965_priv *priv)
{
struct pci_dev *dev = priv->pci_dev;
struct iwl_kw *kw = &priv->kw;
struct iwl4965_kw *kw = &priv->kw;
if (kw->v_addr) {
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)
* @param priv
* @return error code
*/
static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
static int iwl4965_txq_ctx_reset(struct iwl4965_priv *priv)
{
int rc = 0;
int txq_id, slots_num;
......@@ -363,7 +363,7 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
iwl4965_kw_free(priv);
iwl_hw_txq_ctx_free(priv);
iwl4965_hw_txq_ctx_free(priv);
/* Tx CMD queue */
rc = iwl4965_kw_alloc(priv);
......@@ -374,15 +374,15 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
spin_lock_irqsave(&priv->lock, flags);
rc = iwl_grab_nic_access(priv);
rc = iwl4965_grab_nic_access(priv);
if (unlikely(rc)) {
IWL_ERROR("TX reset failed");
spin_unlock_irqrestore(&priv->lock, flags);
goto error_reset;
}
iwl_write_prph(priv, KDR_SCD_TXFACT, 0);
iwl_release_nic_access(priv);
iwl4965_write_prph(priv, KDR_SCD_TXFACT, 0);
iwl4965_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
rc = iwl4965_kw_init(priv);
......@@ -395,7 +395,7 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++) {
slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ?
TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
rc = iwl4965_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
txq_id);
if (rc) {
IWL_ERROR("Tx %d queue init failed\n", txq_id);
......@@ -406,32 +406,32 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
return rc;
error:
iwl_hw_txq_ctx_free(priv);
iwl4965_hw_txq_ctx_free(priv);
error_reset:
iwl4965_kw_free(priv);
error_kw:
return rc;
}
int iwl_hw_nic_init(struct iwl_priv *priv)
int iwl4965_hw_nic_init(struct iwl4965_priv *priv)
{
int rc;
unsigned long flags;
struct iwl_rx_queue *rxq = &priv->rxq;
struct iwl4965_rx_queue *rxq = &priv->rxq;
u8 rev_id;
u32 val;
u8 val_link;
iwl_power_init_handle(priv);
iwl4965_power_init_handle(priv);
/* nic_init */
spin_lock_irqsave(&priv->lock, flags);
iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS,
iwl4965_set_bit(priv, CSR_GIO_CHICKEN_BITS,
CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
rc = iwl_poll_bit(priv, CSR_GP_CNTRL,
iwl4965_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
rc = iwl4965_poll_bit(priv, CSR_GP_CNTRL,
CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
if (rc < 0) {
......@@ -440,26 +440,26 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
return rc;
}
rc = iwl_grab_nic_access(priv);
rc = iwl4965_grab_nic_access(priv);
if (rc) {
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
}
iwl_read_prph(priv, APMG_CLK_CTRL_REG);
iwl4965_read_prph(priv, APMG_CLK_CTRL_REG);
iwl_write_prph(priv, APMG_CLK_CTRL_REG,
iwl4965_write_prph(priv, APMG_CLK_CTRL_REG,
APMG_CLK_VAL_DMA_CLK_RQT |
APMG_CLK_VAL_BSM_CLK_RQT);
iwl_read_prph(priv, APMG_CLK_CTRL_REG);
iwl4965_read_prph(priv, APMG_CLK_CTRL_REG);
udelay(20);
iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
iwl4965_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
iwl_release_nic_access(priv);
iwl_write32(priv, CSR_INT_COALESCING, 512 / 32);
iwl4965_release_nic_access(priv);
iwl4965_write32(priv, CSR_INT_COALESCING, 512 / 32);
spin_unlock_irqrestore(&priv->lock, flags);
/* Determine HW type */
......@@ -482,7 +482,7 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
spin_unlock_irqrestore(&priv->lock, flags);
/* Read the EEPROM */
rc = iwl_eeprom_init(priv);
rc = iwl4965_eeprom_init(priv);
if (rc)
return rc;
......@@ -500,49 +500,49 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
/* set CSR_HW_CONFIG_REG for uCode use */
iwl_set_bit(priv, CSR_SW_VER, CSR_HW_IF_CONFIG_REG_BIT_KEDRON_R |
iwl4965_set_bit(priv, CSR_SW_VER, CSR_HW_IF_CONFIG_REG_BIT_KEDRON_R |
CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
rc = iwl_grab_nic_access(priv);
rc = iwl4965_grab_nic_access(priv);
if (rc < 0) {
spin_unlock_irqrestore(&priv->lock, flags);
IWL_DEBUG_INFO("Failed to init the card\n");
return rc;
}
iwl_read_prph(priv, APMG_PS_CTRL_REG);
iwl_set_bits_prph(priv, APMG_PS_CTRL_REG,
iwl4965_read_prph(priv, APMG_PS_CTRL_REG);
iwl4965_set_bits_prph(priv, APMG_PS_CTRL_REG,
APMG_PS_CTRL_VAL_RESET_REQ);
udelay(5);
iwl_clear_bits_prph(priv, APMG_PS_CTRL_REG,
iwl4965_clear_bits_prph(priv, APMG_PS_CTRL_REG,
APMG_PS_CTRL_VAL_RESET_REQ);
iwl_release_nic_access(priv);
iwl4965_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
iwl_hw_card_show_info(priv);
iwl4965_hw_card_show_info(priv);
/* end nic_init */
/* Allocate the RX queue, or reset if it is already allocated */
if (!rxq->bd) {
rc = iwl_rx_queue_alloc(priv);
rc = iwl4965_rx_queue_alloc(priv);
if (rc) {
IWL_ERROR("Unable to initialize Rx queue\n");
return -ENOMEM;
}
} else
iwl_rx_queue_reset(priv, rxq);
iwl4965_rx_queue_reset(priv, rxq);
iwl_rx_replenish(priv);
iwl4965_rx_replenish(priv);
iwl4965_rx_init(priv, rxq);
spin_lock_irqsave(&priv->lock, flags);
rxq->need_update = 1;
iwl_rx_queue_update_write_ptr(priv, rxq);
iwl4965_rx_queue_update_write_ptr(priv, rxq);
spin_unlock_irqrestore(&priv->lock, flags);
rc = iwl4965_txq_ctx_reset(priv);
......@@ -560,7 +560,7 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
return 0;
}
int iwl_hw_nic_stop_master(struct iwl_priv *priv)
int iwl4965_hw_nic_stop_master(struct iwl4965_priv *priv)
{
int rc = 0;
u32 reg_val;
......@@ -569,16 +569,16 @@ int iwl_hw_nic_stop_master(struct iwl_priv *priv)
spin_lock_irqsave(&priv->lock, flags);
/* set stop master bit */
iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
iwl4965_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
reg_val = iwl_read32(priv, CSR_GP_CNTRL);
reg_val = iwl4965_read32(priv, CSR_GP_CNTRL);
if (CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE ==
(reg_val & CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE))
IWL_DEBUG_INFO("Card in power save, master is already "
"stopped\n");
else {
rc = iwl_poll_bit(priv, CSR_RESET,
rc = iwl4965_poll_bit(priv, CSR_RESET,
CSR_RESET_REG_FLAG_MASTER_DISABLED,
CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
if (rc < 0) {
......@@ -593,7 +593,7 @@ int iwl_hw_nic_stop_master(struct iwl_priv *priv)
return rc;
}
void iwl_hw_txq_ctx_stop(struct iwl_priv *priv)
void iwl4965_hw_txq_ctx_stop(struct iwl4965_priv *priv)
{
int txq_id;
......@@ -602,56 +602,56 @@ void iwl_hw_txq_ctx_stop(struct iwl_priv *priv)
/* reset TFD queues */
for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++) {
spin_lock_irqsave(&priv->lock, flags);
if (iwl_grab_nic_access(priv)) {
if (iwl4965_grab_nic_access(priv)) {
spin_unlock_irqrestore(&priv->lock, flags);
continue;
}
iwl_write_direct32(priv,
iwl4965_write_direct32(priv,
IWL_FH_TCSR_CHNL_TX_CONFIG_REG(txq_id),
0x0);
iwl_poll_direct_bit(priv, IWL_FH_TSSR_TX_STATUS_REG,
iwl4965_poll_direct_bit(priv, IWL_FH_TSSR_TX_STATUS_REG,
IWL_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE
(txq_id), 200);
iwl_release_nic_access(priv);
iwl4965_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
}
iwl_hw_txq_ctx_free(priv);
iwl4965_hw_txq_ctx_free(priv);
}
int iwl_hw_nic_reset(struct iwl_priv *priv)
int iwl4965_hw_nic_reset(struct iwl4965_priv *priv)
{
int rc = 0;
unsigned long flags;
iwl_hw_nic_stop_master(priv);
iwl4965_hw_nic_stop_master(priv);
spin_lock_irqsave(&priv->lock, flags);
iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
iwl4965_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
udelay(10);
iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
rc = iwl_poll_bit(priv, CSR_RESET,
iwl4965_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
rc = iwl4965_poll_bit(priv, CSR_RESET,
CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25);
udelay(10);
rc = iwl_grab_nic_access(priv);
rc = iwl4965_grab_nic_access(priv);
if (!rc) {
iwl_write_prph(priv, APMG_CLK_EN_REG,
iwl4965_write_prph(priv, APMG_CLK_EN_REG,
APMG_CLK_VAL_DMA_CLK_RQT |
APMG_CLK_VAL_BSM_CLK_RQT);
udelay(10);
iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
iwl4965_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
iwl_release_nic_access(priv);
iwl4965_release_nic_access(priv);
}
clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
......@@ -681,7 +681,7 @@ int iwl_hw_nic_reset(struct iwl_priv *priv)
*/
static void iwl4965_bg_statistics_periodic(unsigned long data)
{
struct iwl_priv *priv = (struct iwl_priv *)data;
struct iwl4965_priv *priv = (struct iwl4965_priv *)data;
queue_work(priv->workqueue, &priv->statistics_work);
}
......@@ -689,27 +689,27 @@ static void iwl4965_bg_statistics_periodic(unsigned long data)
/**
* iwl4965_bg_statistics_work - Send the statistics request to the hardware.
*
* This is queued by iwl_bg_statistics_periodic.
* This is queued by iwl4965_bg_statistics_periodic.
*/
static void iwl4965_bg_statistics_work(struct work_struct *work)
{
struct iwl_priv *priv = container_of(work, struct iwl_priv,
struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv,
statistics_work);
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;
mutex_lock(&priv->mutex);
iwl_send_statistics_request(priv);
iwl4965_send_statistics_request(priv);
mutex_unlock(&priv->mutex);
}
#define CT_LIMIT_CONST 259
#define TM_CT_KILL_THRESHOLD 110
void iwl4965_rf_kill_ct_config(struct iwl_priv *priv)
void iwl4965_rf_kill_ct_config(struct iwl4965_priv *priv)
{
struct iwl_ct_kill_config cmd;
struct iwl4965_ct_kill_config cmd;
u32 R1, R2, R3;
u32 temp_th;
u32 crit_temperature;
......@@ -717,7 +717,7 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv)
int rc = 0;
spin_lock_irqsave(&priv->lock, flags);
iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR,
iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR,
CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT);
spin_unlock_irqrestore(&priv->lock, flags);
......@@ -735,7 +735,7 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv)
crit_temperature = ((temp_th * (R3-R1))/CT_LIMIT_CONST) + R2;
cmd.critical_temperature_R = cpu_to_le32(crit_temperature);
rc = iwl_send_cmd_pdu(priv,
rc = iwl4965_send_cmd_pdu(priv,
REPLY_CT_KILL_CONFIG_CMD, sizeof(cmd), &cmd);
if (rc)
IWL_ERROR("REPLY_CT_KILL_CONFIG_CMD failed\n");
......@@ -753,7 +753,7 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv)
* enough to receive all of our own network traffic, but not so
* high that our DSP gets too busy trying to lock onto non-network
* activity/noise. */
static int iwl4965_sens_energy_cck(struct iwl_priv *priv,
static int iwl4965_sens_energy_cck(struct iwl4965_priv *priv,
u32 norm_fa,
u32 rx_enable_time,
struct statistics_general_data *rx_info)
......@@ -779,7 +779,7 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv,
u32 false_alarms = norm_fa * 200 * 1024;
u32 max_false_alarms = MAX_FA_CCK * rx_enable_time;
u32 min_false_alarms = MIN_FA_CCK * rx_enable_time;
struct iwl_sensitivity_data *data = NULL;
struct iwl4965_sensitivity_data *data = NULL;
data = &(priv->sensitivity_data);
......@@ -944,7 +944,7 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv,
}
static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv,
static int iwl4965_sens_auto_corr_ofdm(struct iwl4965_priv *priv,
u32 norm_fa,
u32 rx_enable_time)
{
......@@ -952,7 +952,7 @@ static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv,
u32 false_alarms = norm_fa * 200 * 1024;
u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time;
u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time;
struct iwl_sensitivity_data *data = NULL;
struct iwl4965_sensitivity_data *data = NULL;
data = &(priv->sensitivity_data);
......@@ -1009,22 +1009,22 @@ static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv,
return 0;
}
static int iwl_sensitivity_callback(struct iwl_priv *priv,
struct iwl_cmd *cmd, struct sk_buff *skb)
static int iwl4965_sensitivity_callback(struct iwl4965_priv *priv,
struct iwl4965_cmd *cmd, struct sk_buff *skb)
{
/* We didn't cache the SKB; let the caller free it */
return 1;
}
/* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */
static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags)
static int iwl4965_sensitivity_write(struct iwl4965_priv *priv, u8 flags)
{
int rc = 0;
struct iwl_sensitivity_cmd cmd ;
struct iwl_sensitivity_data *data = NULL;
struct iwl_host_cmd cmd_out = {
struct iwl4965_sensitivity_cmd cmd ;
struct iwl4965_sensitivity_data *data = NULL;
struct iwl4965_host_cmd cmd_out = {
.id = SENSITIVITY_CMD,
.len = sizeof(struct iwl_sensitivity_cmd),
.len = sizeof(struct iwl4965_sensitivity_cmd),
.meta.flags = flags,
.data = &cmd,
};
......@@ -1071,7 +1071,7 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags)
cmd.control = SENSITIVITY_CMD_CONTROL_WORK_TABLE;
if (flags & CMD_ASYNC)
cmd_out.meta.u.callback = iwl_sensitivity_callback;
cmd_out.meta.u.callback = iwl4965_sensitivity_callback;
/* Don't send command to uCode if nothing has changed */
if (!memcmp(&cmd.table[0], &(priv->sensitivity_tbl[0]),
......@@ -1084,7 +1084,7 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags)
memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]),
sizeof(u16)*HD_TABLE_SIZE);
rc = iwl_send_cmd(priv, &cmd_out);
rc = iwl4965_send_cmd(priv, &cmd_out);
if (!rc) {
IWL_DEBUG_CALIB("SENSITIVITY_CMD succeeded\n");
return rc;
......@@ -1093,11 +1093,11 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags)
return 0;
}
void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force)
void iwl4965_init_sensitivity(struct iwl4965_priv *priv, u8 flags, u8 force)
{
int rc = 0;
int i;
struct iwl_sensitivity_data *data = NULL;
struct iwl4965_sensitivity_data *data = NULL;
IWL_DEBUG_CALIB("Start iwl4965_init_sensitivity\n");
......@@ -1107,7 +1107,7 @@ void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force)
/* Clear driver's sensitivity algo data */
data = &(priv->sensitivity_data);
memset(data, 0, sizeof(struct iwl_sensitivity_data));
memset(data, 0, sizeof(struct iwl4965_sensitivity_data));
data->num_in_cck_no_fa = 0;
data->nrg_curr_state = IWL_FA_TOO_MANY;
......@@ -1151,21 +1151,21 @@ void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force)
/* Reset differential Rx gains in NIC to prepare for chain noise calibration.
* Called after every association, but this runs only once!
* ... once chain noise is calibrated the first time, it's good forever. */
void iwl4965_chain_noise_reset(struct iwl_priv *priv)
void iwl4965_chain_noise_reset(struct iwl4965_priv *priv)
{
struct iwl_chain_noise_data *data = NULL;
struct iwl4965_chain_noise_data *data = NULL;
int rc = 0;
data = &(priv->chain_noise_data);
if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) {
struct iwl_calibration_cmd cmd;
if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl4965_is_associated(priv)) {
struct iwl4965_calibration_cmd cmd;
memset(&cmd, 0, sizeof(cmd));
cmd.opCode = PHY_CALIBRATE_DIFF_GAIN_CMD;
cmd.diff_gain_a = 0;
cmd.diff_gain_b = 0;
cmd.diff_gain_c = 0;
rc = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
rc = iwl4965_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
sizeof(cmd), &cmd);
msleep(4);
data->state = IWL_CHAIN_NOISE_ACCUMULATE;
......@@ -1180,10 +1180,10 @@ void iwl4965_chain_noise_reset(struct iwl_priv *priv)
* 1) Which antennas are connected.
* 2) Differential rx gain settings to balance the 3 receivers.
*/
static void iwl4965_noise_calibration(struct iwl_priv *priv,
struct iwl_notif_statistics *stat_resp)
static void iwl4965_noise_calibration(struct iwl4965_priv *priv,
struct iwl4965_notif_statistics *stat_resp)
{
struct iwl_chain_noise_data *data = NULL;
struct iwl4965_chain_noise_data *data = NULL;
int rc = 0;
u32 chain_noise_a;
......@@ -1382,7 +1382,7 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv,
/* Differential gain gets sent to uCode only once */
if (!data->radio_write) {
struct iwl_calibration_cmd cmd;
struct iwl4965_calibration_cmd cmd;
data->radio_write = 1;
memset(&cmd, 0, sizeof(cmd));
......@@ -1390,7 +1390,7 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv,
cmd.diff_gain_a = data->delta_gain_code[0];
cmd.diff_gain_b = data->delta_gain_code[1];
cmd.diff_gain_c = data->delta_gain_code[2];
rc = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
rc = iwl4965_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
sizeof(cmd), &cmd);
if (rc)
IWL_DEBUG_CALIB("fail sending cmd "
......@@ -1413,8 +1413,8 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv,
return;
}
static void iwl4965_sensitivity_calibration(struct iwl_priv *priv,
struct iwl_notif_statistics *resp)
static void iwl4965_sensitivity_calibration(struct iwl4965_priv *priv,
struct iwl4965_notif_statistics *resp)
{
int rc = 0;
u32 rx_enable_time;
......@@ -1424,7 +1424,7 @@ static void iwl4965_sensitivity_calibration(struct iwl_priv *priv,
u32 bad_plcp_ofdm;
u32 norm_fa_ofdm;
u32 norm_fa_cck;
struct iwl_sensitivity_data *data = NULL;
struct iwl4965_sensitivity_data *data = NULL;
struct statistics_rx_non_phy *rx_info = &(resp->rx.general);
struct statistics_rx *statistics = &(resp->rx);
unsigned long flags;
......@@ -1432,7 +1432,7 @@ static void iwl4965_sensitivity_calibration(struct iwl_priv *priv,
data = &(priv->sensitivity_data);
if (!iwl_is_associated(priv)) {
if (!iwl4965_is_associated(priv)) {
IWL_DEBUG_CALIB("<< - not associated\n");
return;
}
......@@ -1520,7 +1520,7 @@ static void iwl4965_sensitivity_calibration(struct iwl_priv *priv,
static void iwl4965_bg_sensitivity_work(struct work_struct *work)
{
struct iwl_priv *priv = container_of(work, struct iwl_priv,
struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv,
sensitivity_work);
mutex_lock(&priv->mutex);
......@@ -1550,7 +1550,7 @@ static void iwl4965_bg_sensitivity_work(struct work_struct *work)
static void iwl4965_bg_txpower_work(struct work_struct *work)
{
struct iwl_priv *priv = container_of(work, struct iwl_priv,
struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv,
txpower_work);
/* If a scan happened to start before we got here
......@@ -1566,7 +1566,7 @@ static void iwl4965_bg_txpower_work(struct work_struct *work)
/* Regardless of if we are assocaited, we must reconfigure the
* TX power since frames can be sent on non-radar channels while
* not associated */
iwl_hw_reg_send_txpower(priv);
iwl4965_hw_reg_send_txpower(priv);
/* Update last_temperature to keep is_calib_needed from running
* when it isn't needed... */
......@@ -1578,24 +1578,24 @@ static void iwl4965_bg_txpower_work(struct work_struct *work)
/*
* Acquire priv->lock before calling this function !
*/
static void iwl4965_set_wr_ptrs(struct iwl_priv *priv, int txq_id, u32 index)
static void iwl4965_set_wr_ptrs(struct iwl4965_priv *priv, int txq_id, u32 index)
{
iwl_write_direct32(priv, HBUS_TARG_WRPTR,
iwl4965_write_direct32(priv, HBUS_TARG_WRPTR,
(index & 0xff) | (txq_id << 8));
iwl_write_prph(priv, KDR_SCD_QUEUE_RDPTR(txq_id), index);
iwl4965_write_prph(priv, KDR_SCD_QUEUE_RDPTR(txq_id), index);
}
/*
* Acquire priv->lock before calling this function !
*/
static void iwl4965_tx_queue_set_status(struct iwl_priv *priv,
struct iwl_tx_queue *txq,
static void iwl4965_tx_queue_set_status(struct iwl4965_priv *priv,
struct iwl4965_tx_queue *txq,
int tx_fifo_id, int scd_retry)
{
int txq_id = txq->q.id;
int active = test_bit(txq_id, &priv->txq_ctx_active_msk)?1:0;
iwl_write_prph(priv, KDR_SCD_QUEUE_STATUS_BITS(txq_id),
iwl4965_write_prph(priv, KDR_SCD_QUEUE_STATUS_BITS(txq_id),
(active << SCD_QUEUE_STTS_REG_POS_ACTIVE) |
(tx_fifo_id << SCD_QUEUE_STTS_REG_POS_TXF) |
(scd_retry << SCD_QUEUE_STTS_REG_POS_WSL) |
......@@ -1619,17 +1619,17 @@ static const u16 default_queue_to_tx_fifo[] = {
IWL_TX_FIFO_HCCA_2
};
static inline void iwl4965_txq_ctx_activate(struct iwl_priv *priv, int txq_id)
static inline void iwl4965_txq_ctx_activate(struct iwl4965_priv *priv, int txq_id)
{
set_bit(txq_id, &priv->txq_ctx_active_msk);
}
static inline void iwl4965_txq_ctx_deactivate(struct iwl_priv *priv, int txq_id)
static inline void iwl4965_txq_ctx_deactivate(struct iwl4965_priv *priv, int txq_id)
{
clear_bit(txq_id, &priv->txq_ctx_active_msk);
}
int iwl4965_alive_notify(struct iwl_priv *priv)
int iwl4965_alive_notify(struct iwl4965_priv *priv)
{
u32 a;
int i = 0;
......@@ -1640,43 +1640,43 @@ int iwl4965_alive_notify(struct iwl_priv *priv)
#ifdef CONFIG_IWL4965_SENSITIVITY
memset(&(priv->sensitivity_data), 0,
sizeof(struct iwl_sensitivity_data));
sizeof(struct iwl4965_sensitivity_data));
memset(&(priv->chain_noise_data), 0,
sizeof(struct iwl_chain_noise_data));
sizeof(struct iwl4965_chain_noise_data));
for (i = 0; i < NUM_RX_CHAINS; i++)
priv->chain_noise_data.delta_gain_code[i] =
CHAIN_NOISE_DELTA_GAIN_INIT_VAL;
#endif /* CONFIG_IWL4965_SENSITIVITY*/
rc = iwl_grab_nic_access(priv);
rc = iwl4965_grab_nic_access(priv);
if (rc) {
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
}
priv->scd_base_addr = iwl_read_prph(priv, KDR_SCD_SRAM_BASE_ADDR);
priv->scd_base_addr = iwl4965_read_prph(priv, KDR_SCD_SRAM_BASE_ADDR);
a = priv->scd_base_addr + SCD_CONTEXT_DATA_OFFSET;
for (; a < priv->scd_base_addr + SCD_TX_STTS_BITMAP_OFFSET; a += 4)
iwl_write_targ_mem(priv, a, 0);
iwl4965_write_targ_mem(priv, a, 0);
for (; a < priv->scd_base_addr + SCD_TRANSLATE_TBL_OFFSET; a += 4)
iwl_write_targ_mem(priv, a, 0);
iwl4965_write_targ_mem(priv, a, 0);
for (; a < sizeof(u16) * priv->hw_setting.max_txq_num; a += 4)
iwl_write_targ_mem(priv, a, 0);
iwl4965_write_targ_mem(priv, a, 0);
iwl_write_prph(priv, KDR_SCD_DRAM_BASE_ADDR,
iwl4965_write_prph(priv, KDR_SCD_DRAM_BASE_ADDR,
(priv->hw_setting.shared_phys +
offsetof(struct iwl_shared, queues_byte_cnt_tbls)) >> 10);
iwl_write_prph(priv, KDR_SCD_QUEUECHAIN_SEL, 0);
offsetof(struct iwl4965_shared, queues_byte_cnt_tbls)) >> 10);
iwl4965_write_prph(priv, KDR_SCD_QUEUECHAIN_SEL, 0);
/* initiate the queues */
for (i = 0; i < priv->hw_setting.max_txq_num; i++) {
iwl_write_prph(priv, KDR_SCD_QUEUE_RDPTR(i), 0);
iwl_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8));
iwl_write_targ_mem(priv, priv->scd_base_addr +
iwl4965_write_prph(priv, KDR_SCD_QUEUE_RDPTR(i), 0);
iwl4965_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8));
iwl4965_write_targ_mem(priv, priv->scd_base_addr +
SCD_CONTEXT_QUEUE_OFFSET(i),
(SCD_WIN_SIZE <<
SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) &
SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK);
iwl_write_targ_mem(priv, priv->scd_base_addr +
iwl4965_write_targ_mem(priv, priv->scd_base_addr +
SCD_CONTEXT_QUEUE_OFFSET(i) +
sizeof(u32),
(SCD_FRAME_LIMIT <<
......@@ -1684,10 +1684,10 @@ int iwl4965_alive_notify(struct iwl_priv *priv)
SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK);
}
iwl_write_prph(priv, KDR_SCD_INTERRUPT_MASK,
iwl4965_write_prph(priv, KDR_SCD_INTERRUPT_MASK,
(1 << priv->hw_setting.max_txq_num) - 1);
iwl_write_prph(priv, KDR_SCD_TXFACT,
iwl4965_write_prph(priv, KDR_SCD_TXFACT,
SCD_TXFACT_REG_TXFIFO_MASK(0, 7));
iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0);
......@@ -1698,27 +1698,27 @@ int iwl4965_alive_notify(struct iwl_priv *priv)
iwl4965_tx_queue_set_status(priv, &priv->txq[i], ac, 0);
}
iwl_release_nic_access(priv);
iwl4965_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
return 0;
}
int iwl_hw_set_hw_setting(struct iwl_priv *priv)
int iwl4965_hw_set_hw_setting(struct iwl4965_priv *priv)
{
priv->hw_setting.shared_virt =
pci_alloc_consistent(priv->pci_dev,
sizeof(struct iwl_shared),
sizeof(struct iwl4965_shared),
&priv->hw_setting.shared_phys);
if (!priv->hw_setting.shared_virt)
return -1;
memset(priv->hw_setting.shared_virt, 0, sizeof(struct iwl_shared));
memset(priv->hw_setting.shared_virt, 0, sizeof(struct iwl4965_shared));
priv->hw_setting.max_txq_num = iwl_param_queues_num;
priv->hw_setting.max_txq_num = iwl4965_param_queues_num;
priv->hw_setting.ac_queue_count = AC_NUM;
priv->hw_setting.tx_cmd_len = sizeof(struct iwl_tx_cmd);
priv->hw_setting.tx_cmd_len = sizeof(struct iwl4965_tx_cmd);
priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE;
priv->hw_setting.max_rxq_log = RX_QUEUE_SIZE_LOG;
......@@ -1728,30 +1728,30 @@ int iwl_hw_set_hw_setting(struct iwl_priv *priv)
}
/**
* iwl_hw_txq_ctx_free - Free TXQ Context
* iwl4965_hw_txq_ctx_free - Free TXQ Context
*
* Destroy all TX DMA queues and structures
*/
void iwl_hw_txq_ctx_free(struct iwl_priv *priv)
void iwl4965_hw_txq_ctx_free(struct iwl4965_priv *priv)
{
int txq_id;
/* Tx queues */
for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++)
iwl_tx_queue_free(priv, &priv->txq[txq_id]);
iwl4965_tx_queue_free(priv, &priv->txq[txq_id]);
iwl4965_kw_free(priv);
}
/**
* iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr]
* iwl4965_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr]
*
* Does NOT advance any indexes
*/
int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
int iwl4965_hw_txq_free_tfd(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq)
{
struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0];
struct iwl_tfd_frame *bd = &bd_tmp[txq->q.read_ptr];
struct iwl4965_tfd_frame *bd_tmp = (struct iwl4965_tfd_frame *)&txq->bd[0];
struct iwl4965_tfd_frame *bd = &bd_tmp[txq->q.read_ptr];
struct pci_dev *dev = priv->pci_dev;
int i;
int counter = 0;
......@@ -1801,9 +1801,9 @@ int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
return 0;
}
int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power)
int iwl4965_hw_reg_set_txpower(struct iwl4965_priv *priv, s8 power)
{
IWL_ERROR("TODO: Implement iwl_hw_reg_set_txpower!\n");
IWL_ERROR("TODO: Implement iwl4965_hw_reg_set_txpower!\n");
return -EINVAL;
}
......@@ -1845,12 +1845,12 @@ static s32 iwl4965_get_voltage_compensation(s32 eeprom_voltage,
return comp;
}
static const struct iwl_channel_info *
iwl4965_get_channel_txpower_info(struct iwl_priv *priv, u8 phymode, u16 channel)
static const struct iwl4965_channel_info *
iwl4965_get_channel_txpower_info(struct iwl4965_priv *priv, u8 phymode, u16 channel)
{
const struct iwl_channel_info *ch_info;
const struct iwl4965_channel_info *ch_info;
ch_info = iwl_get_channel_info(priv, phymode, channel);
ch_info = iwl4965_get_channel_info(priv, phymode, channel);
if (!is_channel_valid(ch_info))
return NULL;
......@@ -1884,7 +1884,7 @@ static s32 iwl4965_get_tx_atten_grp(u16 channel)
return -1;
}
static u32 iwl4965_get_sub_band(const struct iwl_priv *priv, u32 channel)
static u32 iwl4965_get_sub_band(const struct iwl4965_priv *priv, u32 channel)
{
s32 b = -1;
......@@ -1912,15 +1912,15 @@ static s32 iwl4965_interpolate_value(s32 x, s32 x1, s32 y1, s32 x2, s32 y2)
}
}
static int iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel,
struct iwl_eeprom_calib_ch_info *chan_info)
static int iwl4965_interpolate_chan(struct iwl4965_priv *priv, u32 channel,
struct iwl4965_eeprom_calib_ch_info *chan_info)
{
s32 s = -1;
u32 c;
u32 m;
const struct iwl_eeprom_calib_measure *m1;
const struct iwl_eeprom_calib_measure *m2;
struct iwl_eeprom_calib_measure *omeas;
const struct iwl4965_eeprom_calib_measure *m1;
const struct iwl4965_eeprom_calib_measure *m2;
struct iwl4965_eeprom_calib_measure *omeas;
u32 ch_i1;
u32 ch_i2;
......@@ -1995,7 +1995,7 @@ static s32 back_off_table[] = {
/* Thermal compensation values for txpower for various frequency ranges ...
* ratios from 3:1 to 4.5:1 of degrees (Celsius) per half-dB gain adjust */
static struct iwl_txpower_comp_entry {
static struct iwl4965_txpower_comp_entry {
s32 degrees_per_05db_a;
s32 degrees_per_05db_a_denom;
} tx_power_cmp_tble[CALIB_CH_GROUP_MAX] = {
......@@ -2245,9 +2245,9 @@ static const struct gain_entry gain_table[2][108] = {
}
};
static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
static int iwl4965_fill_txpower_tbl(struct iwl4965_priv *priv, u8 band, u16 channel,
u8 is_fat, u8 ctrl_chan_high,
struct iwl_tx_power_db *tx_power_tbl)
struct iwl4965_tx_power_db *tx_power_tbl)
{
u8 saturation_power;
s32 target_power;
......@@ -2259,9 +2259,9 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
s32 txatten_grp = CALIB_CH_GROUP_MAX;
int i;
int c;
const struct iwl_channel_info *ch_info = NULL;
struct iwl_eeprom_calib_ch_info ch_eeprom_info;
const struct iwl_eeprom_calib_measure *measurement;
const struct iwl4965_channel_info *ch_info = NULL;
struct iwl4965_eeprom_calib_ch_info ch_eeprom_info;
const struct iwl4965_eeprom_calib_measure *measurement;
s16 voltage;
s32 init_voltage;
s32 voltage_compensation;
......@@ -2400,7 +2400,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
/* for each of 33 bit-rates (including 1 for CCK) */
for (i = 0; i < POWER_TABLE_NUM_ENTRIES; i++) {
u8 is_mimo_rate;
union iwl_tx_power_dual_stream tx_power;
union iwl4965_tx_power_dual_stream tx_power;
/* for mimo, reduce each chain's txpower by half
* (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,
}
/**
* iwl_hw_reg_send_txpower - Configure the TXPOWER level user limit
* iwl4965_hw_reg_send_txpower - Configure the TXPOWER level user limit
*
* Uses the active RXON for channel, band, and characteristics (fat, high)
* The power limit is taken from priv->user_txpower_limit.
*/
int iwl_hw_reg_send_txpower(struct iwl_priv *priv)
int iwl4965_hw_reg_send_txpower(struct iwl4965_priv *priv)
{
struct iwl_txpowertable_cmd cmd = { 0 };
struct iwl4965_txpowertable_cmd cmd = { 0 };
int rc = 0;
u8 band = 0;
u8 is_fat = 0;
......@@ -2536,23 +2536,23 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv)
if (rc)
return rc;
rc = iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd);
rc = iwl4965_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd);
return rc;
}
int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel)
int iwl4965_hw_channel_switch(struct iwl4965_priv *priv, u16 channel)
{
int rc;
u8 band = 0;
u8 is_fat = 0;
u8 ctrl_chan_high = 0;
struct iwl_channel_switch_cmd cmd = { 0 };
const struct iwl_channel_info *ch_info;
struct iwl4965_channel_switch_cmd cmd = { 0 };
const struct iwl4965_channel_info *ch_info;
band = ((priv->phymode == MODE_IEEE80211B) ||
(priv->phymode == MODE_IEEE80211G));
ch_info = iwl_get_channel_info(priv, priv->phymode, channel);
ch_info = iwl4965_get_channel_info(priv, priv->phymode, channel);
is_fat = is_fat_channel(priv->staging_rxon.flags);
......@@ -2578,15 +2578,15 @@ int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel)
return rc;
}
rc = iwl_send_cmd_pdu(priv, REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd);
rc = iwl4965_send_cmd_pdu(priv, REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd);
return rc;
}
#define RTS_HCCA_RETRY_LIMIT 3
#define RTS_DFAULT_RETRY_LIMIT 60
void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
struct iwl_cmd *cmd,
void iwl4965_hw_build_tx_cmd_rate(struct iwl4965_priv *priv,
struct iwl4965_cmd *cmd,
struct ieee80211_tx_control *ctrl,
struct ieee80211_hdr *hdr, int sta_id,
int is_hcca)
......@@ -2599,7 +2599,7 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
tx_flags = cmd->cmd.tx.tx_flags;
rate = iwl_rates[ctrl->tx_rate].plcp;
rate = iwl4965_rates[ctrl->tx_rate].plcp;
rts_retry_limit = (is_hcca) ?
RTS_HCCA_RETRY_LIMIT : RTS_DFAULT_RETRY_LIMIT;
......@@ -2632,26 +2632,26 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
cmd->cmd.tx.rts_retry_limit = rts_retry_limit;
cmd->cmd.tx.data_retry_limit = data_retry_limit;
cmd->cmd.tx.rate_n_flags = iwl_hw_set_rate_n_flags(rate, 0);
cmd->cmd.tx.rate_n_flags = iwl4965_hw_set_rate_n_flags(rate, 0);
cmd->cmd.tx.tx_flags = tx_flags;
}
int iwl_hw_get_rx_read(struct iwl_priv *priv)
int iwl4965_hw_get_rx_read(struct iwl4965_priv *priv)
{
struct iwl_shared *shared_data = priv->hw_setting.shared_virt;
struct iwl4965_shared *shared_data = priv->hw_setting.shared_virt;
return IWL_GET_BITS(*shared_data, rb_closed_stts_rb_num);
}
int iwl_hw_get_temperature(struct iwl_priv *priv)
int iwl4965_hw_get_temperature(struct iwl4965_priv *priv)
{
return priv->temperature;
}
unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
struct iwl_frame *frame, u8 rate)
unsigned int iwl4965_hw_get_beacon_cmd(struct iwl4965_priv *priv,
struct iwl4965_frame *frame, u8 rate)
{
struct iwl_tx_beacon_cmd *tx_beacon_cmd;
struct iwl4965_tx_beacon_cmd *tx_beacon_cmd;
unsigned int frame_size;
tx_beacon_cmd = &frame->u.beacon;
......@@ -2660,9 +2660,9 @@ unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
tx_beacon_cmd->tx.sta_id = IWL4965_BROADCAST_ID;
tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
frame_size = iwl_fill_beacon_frame(priv,
frame_size = iwl4965_fill_beacon_frame(priv,
tx_beacon_cmd->frame,
BROADCAST_ADDR,
iwl4965_broadcast_addr,
sizeof(frame->u) - sizeof(*tx_beacon_cmd));
BUG_ON(frame_size > MAX_MPDU_SIZE);
......@@ -2670,36 +2670,36 @@ unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP))
tx_beacon_cmd->tx.rate_n_flags =
iwl_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK);
iwl4965_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK);
else
tx_beacon_cmd->tx.rate_n_flags =
iwl_hw_set_rate_n_flags(rate, 0);
iwl4965_hw_set_rate_n_flags(rate, 0);
tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK |
TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK);
return (sizeof(*tx_beacon_cmd) + frame_size);
}
int iwl_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq)
int iwl4965_hw_tx_queue_init(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq)
{
int rc;
unsigned long flags;
int txq_id = txq->q.id;
spin_lock_irqsave(&priv->lock, flags);
rc = iwl_grab_nic_access(priv);
rc = iwl4965_grab_nic_access(priv);
if (rc) {
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
}
iwl_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id),
iwl4965_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id),
txq->q.dma_addr >> 8);
iwl_write_direct32(
iwl4965_write_direct32(
priv, IWL_FH_TCSR_CHNL_TX_CONFIG_REG(txq_id),
IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL);
iwl_release_nic_access(priv);
iwl4965_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
return 0;
......@@ -2710,11 +2710,11 @@ static inline u8 iwl4965_get_dma_hi_address(dma_addr_t addr)
return sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0;
}
int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr,
int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl4965_priv *priv, void *ptr,
dma_addr_t addr, u16 len)
{
int index, is_odd;
struct iwl_tfd_frame *tfd = ptr;
struct iwl4965_tfd_frame *tfd = ptr;
u32 num_tbs = IWL_GET_BITS(*tfd, num_tbs);
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,
return 0;
}
static void iwl_hw_card_show_info(struct iwl_priv *priv)
static void iwl4965_hw_card_show_info(struct iwl4965_priv *priv)
{
u16 hw_version = priv->eeprom.board_revision_4965;
......@@ -2758,12 +2758,12 @@ static void iwl_hw_card_show_info(struct iwl_priv *priv)
#define IWL_TX_CRC_SIZE 4
#define IWL_TX_DELIMITER_SIZE 4
int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv,
struct iwl_tx_queue *txq, u16 byte_cnt)
int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv,
struct iwl4965_tx_queue *txq, u16 byte_cnt)
{
int len;
int txq_id = txq->q.id;
struct iwl_shared *shared_data = priv->hw_setting.shared_virt;
struct iwl4965_shared *shared_data = priv->hw_setting.shared_virt;
if (txq->need_update == 0)
return 0;
......@@ -2783,7 +2783,7 @@ int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv,
/* Set up Rx receiver/antenna/chain usage in "staging" RXON image.
* This should not be used for scan command ... it puts data in wrong place. */
void iwl4965_set_rxon_chain(struct iwl_priv *priv)
void iwl4965_set_rxon_chain(struct iwl4965_priv *priv)
{
u8 is_single = is_single_stream(priv);
u8 idle_state, rx_state;
......@@ -2819,14 +2819,14 @@ void iwl4965_set_rxon_chain(struct iwl_priv *priv)
/*
get the traffic load value for tid
*/
static u32 iwl4965_tl_get_load(struct iwl_priv *priv, u8 tid)
static u32 iwl4965_tl_get_load(struct iwl4965_priv *priv, u8 tid)
{
u32 load = 0;
u32 current_time = jiffies_to_msecs(jiffies);
u32 time_diff;
s32 index;
unsigned long flags;
struct iwl_traffic_load *tid_ptr = NULL;
struct iwl4965_traffic_load *tid_ptr = NULL;
if (tid >= TID_MAX_LOAD_COUNT)
return 0;
......@@ -2867,13 +2867,13 @@ static u32 iwl4965_tl_get_load(struct iwl_priv *priv, u8 tid)
increment traffic load value for tid and also remove
any old values if passed the certian time period
*/
static void iwl4965_tl_add_packet(struct iwl_priv *priv, u8 tid)
static void iwl4965_tl_add_packet(struct iwl4965_priv *priv, u8 tid)
{
u32 current_time = jiffies_to_msecs(jiffies);
u32 time_diff;
s32 index;
unsigned long flags;
struct iwl_traffic_load *tid_ptr = NULL;
struct iwl4965_traffic_load *tid_ptr = NULL;
if (tid >= TID_MAX_LOAD_COUNT)
return;
......@@ -2930,14 +2930,14 @@ enum HT_STATUS {
BA_STATUS_ACTIVE,
};
static u8 iwl4964_tl_ba_avail(struct iwl_priv *priv)
static u8 iwl4964_tl_ba_avail(struct iwl4965_priv *priv)
{
int i;
struct iwl_lq_mngr *lq;
struct iwl4965_lq_mngr *lq;
u8 count = 0;
u16 msk;
lq = (struct iwl_lq_mngr *)&(priv->lq_mngr);
lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr);
for (i = 0; i < TID_MAX_LOAD_COUNT ; i++) {
msk = 1 << i;
if ((lq->agg_ctrl.granted_ba & msk) ||
......@@ -2951,10 +2951,10 @@ static u8 iwl4964_tl_ba_avail(struct iwl_priv *priv)
return 0;
}
static void iwl4965_ba_status(struct iwl_priv *priv,
static void iwl4965_ba_status(struct iwl4965_priv *priv,
u8 tid, enum HT_STATUS status);
static int iwl4965_perform_addba(struct iwl_priv *priv, u8 tid, u32 length,
static int iwl4965_perform_addba(struct iwl4965_priv *priv, u8 tid, u32 length,
u32 ba_timeout)
{
int rc;
......@@ -2966,7 +2966,7 @@ static int iwl4965_perform_addba(struct iwl_priv *priv, u8 tid, u32 length,
return rc;
}
static int iwl4965_perform_delba(struct iwl_priv *priv, u8 tid)
static int iwl4965_perform_delba(struct iwl4965_priv *priv, u8 tid)
{
int rc;
......@@ -2977,8 +2977,8 @@ static int iwl4965_perform_delba(struct iwl_priv *priv, u8 tid)
return rc;
}
static void iwl4965_turn_on_agg_for_tid(struct iwl_priv *priv,
struct iwl_lq_mngr *lq,
static void iwl4965_turn_on_agg_for_tid(struct iwl4965_priv *priv,
struct iwl4965_lq_mngr *lq,
u8 auto_agg, u8 tid)
{
u32 tid_msk = (1 << tid);
......@@ -3025,12 +3025,12 @@ static void iwl4965_turn_on_agg_for_tid(struct iwl_priv *priv,
spin_unlock_irqrestore(&priv->lq_mngr.lock, flags);
}
static void iwl4965_turn_on_agg(struct iwl_priv *priv, u8 tid)
static void iwl4965_turn_on_agg(struct iwl4965_priv *priv, u8 tid)
{
struct iwl_lq_mngr *lq;
struct iwl4965_lq_mngr *lq;
unsigned long flags;
lq = (struct iwl_lq_mngr *)&(priv->lq_mngr);
lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr);
if ((tid < TID_MAX_LOAD_COUNT))
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)
}
void iwl4965_turn_off_agg(struct iwl_priv *priv, u8 tid)
void iwl4965_turn_off_agg(struct iwl4965_priv *priv, u8 tid)
{
u32 tid_msk;
struct iwl_lq_mngr *lq;
struct iwl4965_lq_mngr *lq;
unsigned long flags;
lq = (struct iwl_lq_mngr *)&(priv->lq_mngr);
lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr);
if ((tid < TID_MAX_LOAD_COUNT)) {
tid_msk = 1 << tid;
......@@ -3079,14 +3079,14 @@ void iwl4965_turn_off_agg(struct iwl_priv *priv, u8 tid)
}
}
static void iwl4965_ba_status(struct iwl_priv *priv,
static void iwl4965_ba_status(struct iwl4965_priv *priv,
u8 tid, enum HT_STATUS status)
{
struct iwl_lq_mngr *lq;
struct iwl4965_lq_mngr *lq;
u32 tid_msk = (1 << tid);
unsigned long flags;
lq = (struct iwl_lq_mngr *)&(priv->lq_mngr);
lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr);
if ((tid >= TID_MAX_LOAD_COUNT))
goto out;
......@@ -3119,14 +3119,14 @@ static void iwl4965_ba_status(struct iwl_priv *priv,
static void iwl4965_bg_agg_work(struct work_struct *work)
{
struct iwl_priv *priv = container_of(work, struct iwl_priv,
struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv,
agg_work);
u32 tid;
u32 retry_tid;
u32 tid_msk;
unsigned long flags;
struct iwl_lq_mngr *lq = (struct iwl_lq_mngr *)&(priv->lq_mngr);
struct iwl4965_lq_mngr *lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr);
spin_lock_irqsave(&priv->lq_mngr.lock, flags);
retry_tid = lq->agg_ctrl.tid_retry;
......@@ -3152,13 +3152,13 @@ static void iwl4965_bg_agg_work(struct work_struct *work)
#endif /*CONFIG_IWL4965_HT_AGG */
#endif /* CONFIG_IWL4965_HT */
int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd,
int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd,
u8 sta_id, dma_addr_t txcmd_phys,
struct ieee80211_hdr *hdr, u8 hdr_len,
struct ieee80211_tx_control *ctrl, void *sta_in)
{
struct iwl_tx_cmd cmd;
struct iwl_tx_cmd *tx = (struct iwl_tx_cmd *)&out_cmd->cmd.payload[0];
struct iwl4965_tx_cmd cmd;
struct iwl4965_tx_cmd *tx = (struct iwl4965_tx_cmd *)&out_cmd->cmd.payload[0];
dma_addr_t scratch_phys;
u8 unicast = 0;
u8 is_data = 1;
......@@ -3177,8 +3177,8 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd,
if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA)
is_data = 0;
memcpy(&cmd, &(out_cmd->cmd.tx), sizeof(struct iwl_tx_cmd));
memset(tx, 0, sizeof(struct iwl_tx_cmd));
memcpy(&cmd, &(out_cmd->cmd.tx), sizeof(struct iwl4965_tx_cmd));
memset(tx, 0, sizeof(struct iwl4965_tx_cmd));
memcpy(tx->hdr, hdr, hdr_len);
tx->len = cmd.len;
......@@ -3197,8 +3197,8 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd,
tx->rts_retry_limit = cmd.rts_retry_limit;
tx->data_retry_limit = cmd.data_retry_limit;
scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) +
offsetof(struct iwl_tx_cmd, scratch);
scratch_phys = txcmd_phys + sizeof(struct iwl4965_cmd_header) +
offsetof(struct iwl4965_tx_cmd, scratch);
tx->dram_lsb_ptr = cpu_to_le32(scratch_phys);
tx->dram_msb_ptr = iwl4965_get_dma_hi_address(scratch_phys);
......@@ -3224,7 +3224,7 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd,
tx->tx_flags |= TX_CMD_FLG_STA_RATE_MSK;
}
tx->rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[rate_index].plcp,
tx->rate_n_flags = iwl4965_hw_set_rate_n_flags(iwl4965_rates[rate_index].plcp,
rate_flags);
if (ieee80211_is_back_request(fc))
......@@ -3277,7 +3277,7 @@ static s32 sign_extend(u32 oper, int index)
*
* A return of <0 indicates bogus data in the statistics
*/
int iwl4965_get_temperature(const struct iwl_priv *priv)
int iwl4965_get_temperature(const struct iwl4965_priv *priv)
{
s32 temperature;
s32 vt;
......@@ -3344,7 +3344,7 @@ int iwl4965_get_temperature(const struct iwl_priv *priv)
* Assumes caller will replace priv->last_temperature once calibration
* executed.
*/
static int iwl4965_is_temp_calib_needed(struct iwl_priv *priv)
static int iwl4965_is_temp_calib_needed(struct iwl4965_priv *priv)
{
int temp_diff;
......@@ -3377,7 +3377,7 @@ static int iwl4965_is_temp_calib_needed(struct iwl_priv *priv)
/* Calculate noise level, based on measurements during network silence just
* before arriving beacon. This measurement can be done only if we know
* exactly when to expect beacons, therefore only when we're associated. */
static void iwl4965_rx_calc_noise(struct iwl_priv *priv)
static void iwl4965_rx_calc_noise(struct iwl4965_priv *priv)
{
struct statistics_rx_non_phy *rx_info
= &(priv->statistics.rx.general);
......@@ -3414,9 +3414,9 @@ static void iwl4965_rx_calc_noise(struct iwl_priv *priv)
priv->last_rx_noise);
}
void iwl_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
void iwl4965_hw_rx_statistics(struct iwl4965_priv *priv, struct iwl4965_rx_mem_buffer *rxb)
{
struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
int change;
s32 temp;
......@@ -3478,12 +3478,12 @@ void iwl_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
queue_work(priv->workqueue, &priv->txpower_work);
}
static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data,
static void iwl4965_handle_data_packet(struct iwl4965_priv *priv, int is_data,
int include_phy,
struct iwl_rx_mem_buffer *rxb,
struct iwl4965_rx_mem_buffer *rxb,
struct ieee80211_rx_status *stats)
{
struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
struct iwl4965_rx_packet *pkt = (struct iwl4965_rx_packet *)rxb->skb->data;
struct iwl4965_rx_phy_res *rx_start = (include_phy) ?
(struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) : NULL;
struct ieee80211_hdr *hdr;
......@@ -3540,25 +3540,25 @@ static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data,
}
if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) {
if (iwl_param_hwcrypto)
iwl_set_decrypted_flag(priv, rxb->skb,
if (iwl4965_param_hwcrypto)
iwl4965_set_decrypted_flag(priv, rxb->skb,
ampdu_status, stats);
iwl_handle_data_packet_monitor(priv, rxb, hdr, len, stats, 0);
iwl4965_handle_data_packet_monitor(priv, rxb, hdr, len, stats, 0);
return;
}
stats->flag = 0;
hdr = (struct ieee80211_hdr *)rxb->skb->data;
if (iwl_param_hwcrypto)
iwl_set_decrypted_flag(priv, rxb->skb, ampdu_status, stats);
if (iwl4965_param_hwcrypto)
iwl4965_set_decrypted_flag(priv, rxb->skb, ampdu_status, stats);
ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats);
priv->alloc_rxb_skb--;
rxb->skb = NULL;
#ifdef LED
priv->led_packets += len;
iwl_setup_activity_timer(priv);
iwl4965_setup_activity_timer(priv);
#endif
}
......@@ -3670,7 +3670,7 @@ static int parse_elems(u8 *start, size_t len, struct ieee802_11_elems *elems)
}
#endif /* CONFIG_IWL4965_HT */
static void iwl4965_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id)
static void iwl4965_sta_modify_ps_wake(struct iwl4965_priv *priv, int sta_id)
{
unsigned long flags;
......@@ -3681,13 +3681,13 @@ static void iwl4965_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id)
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
spin_unlock_irqrestore(&priv->sta_lock, flags);
iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
}
static void iwl4965_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr)
static void iwl4965_update_ps_mode(struct iwl4965_priv *priv, u16 ps_bit, u8 *addr)
{
/* FIXME: need locking over ps_status ??? */
u8 sta_id = iwl_hw_find_station(priv, addr);
u8 sta_id = iwl4965_hw_find_station(priv, addr);
if (sta_id != IWL_INVALID_STATION) {
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)
/* Called for REPLY_4965_RX (legacy ABG frames), or
* REPLY_RX_MPDU_CMD (HT high-throughput N frames). */
static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
struct iwl_rx_mem_buffer *rxb)
static void iwl4965_rx_reply_rx(struct iwl4965_priv *priv,
struct iwl4965_rx_mem_buffer *rxb)
{
struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
/* Use phy data (Rx signal strength, etc.) contained within
* this rx packet for legacy frames,
* 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,
(rx_start->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ?
MODE_IEEE80211G : MODE_IEEE80211A,
.antenna = 0,
.rate = iwl_hw_get_rate(rx_start->rate_n_flags),
.rate = iwl4965_hw_get_rate(rx_start->rate_n_flags),
.flag = 0,
#ifdef CONFIG_IWL4965_HT_AGG
.ordered = 0
......@@ -3789,32 +3789,32 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
* which are gathered only when associated, and indicate noise
* only for the associated network channel ...
* Ignore these noise values while scanning (other channels) */
if (iwl_is_associated(priv) &&
if (iwl4965_is_associated(priv) &&
!test_bit(STATUS_SCANNING, &priv->status)) {
stats.noise = priv->last_rx_noise;
stats.signal = iwl_calc_sig_qual(stats.ssi, stats.noise);
stats.signal = iwl4965_calc_sig_qual(stats.ssi, stats.noise);
} else {
stats.noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
stats.signal = iwl_calc_sig_qual(stats.ssi, 0);
stats.signal = iwl4965_calc_sig_qual(stats.ssi, 0);
}
/* Reset beacon noise level if not associated. */
if (!iwl_is_associated(priv))
if (!iwl4965_is_associated(priv))
priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
#ifdef CONFIG_IWL4965_DEBUG
/* TODO: Parts of iwl_report_frame are broken for 4965 */
if (iwl_debug_level & (IWL_DL_RX))
/* TODO: Parts of iwl4965_report_frame are broken for 4965 */
if (iwl4965_debug_level & (IWL_DL_RX))
/* Set "1" to report good data frames in groups of 100 */
iwl_report_frame(priv, pkt, header, 1);
iwl4965_report_frame(priv, pkt, header, 1);
if (iwl_debug_level & (IWL_DL_RX | IWL_DL_STATS))
if (iwl4965_debug_level & (IWL_DL_RX | IWL_DL_STATS))
IWL_DEBUG_RX("Rssi %d, noise %d, qual %d, TSF %lu\n",
stats.ssi, stats.noise, stats.signal,
(long unsigned int)le64_to_cpu(rx_start->timestamp));
#endif
network_packet = iwl_is_network_packet(priv, header);
network_packet = iwl4965_is_network_packet(priv, header);
if (network_packet) {
priv->last_rx_rssi = stats.ssi;
priv->last_beacon_time = priv->ucode_beacon_time;
......@@ -3902,7 +3902,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
case IEEE80211_STYPE_PROBE_REQ:
if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) &&
!iwl_is_associated(priv)) {
!iwl4965_is_associated(priv)) {
DECLARE_MAC_BUF(mac1);
DECLARE_MAC_BUF(mac2);
DECLARE_MAC_BUF(mac3);
......@@ -3948,7 +3948,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
print_mac(mac1, header->addr1),
print_mac(mac2, header->addr2),
print_mac(mac3, header->addr3));
else if (unlikely(is_duplicate_packet(priv, header)))
else if (unlikely(iwl4965_is_duplicate_packet(priv, header)))
IWL_DEBUG_DROP("Dropping (dup): %s, %s, %s\n",
print_mac(mac1, header->addr1),
print_mac(mac2, header->addr2),
......@@ -3966,22 +3966,22 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
/* Cache phy data (Rx signal strength, etc) for HT frame (REPLY_RX_PHY_CMD).
* This will be used later in iwl4965_rx_reply_rx() for REPLY_RX_MPDU_CMD. */
static void iwl4965_rx_reply_rx_phy(struct iwl_priv *priv,
struct iwl_rx_mem_buffer *rxb)
static void iwl4965_rx_reply_rx_phy(struct iwl4965_priv *priv,
struct iwl4965_rx_mem_buffer *rxb)
{
struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
priv->last_phy_res[0] = 1;
memcpy(&priv->last_phy_res[1], &(pkt->u.raw[0]),
sizeof(struct iwl4965_rx_phy_res));
}
static void iwl4965_rx_missed_beacon_notif(struct iwl_priv *priv,
struct iwl_rx_mem_buffer *rxb)
static void iwl4965_rx_missed_beacon_notif(struct iwl4965_priv *priv,
struct iwl4965_rx_mem_buffer *rxb)
{
#ifdef CONFIG_IWL4965_SENSITIVITY
struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
struct iwl_missed_beacon_notif *missed_beacon;
struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
struct iwl4965_missed_beacon_notif *missed_beacon;
missed_beacon = &pkt->u.missed_beacon;
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,
#ifdef CONFIG_IWL4965_HT
#ifdef CONFIG_IWL4965_HT_AGG
static void iwl4965_set_tx_status(struct iwl_priv *priv, int txq_id, int idx,
static void iwl4965_set_tx_status(struct iwl4965_priv *priv, int txq_id, int idx,
u32 status, u32 retry_count, u32 rate)
{
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,
}
static void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv,
static void iwl4965_sta_modify_enable_tid_tx(struct iwl4965_priv *priv,
int sta_id, int tid)
{
unsigned long flags;
......@@ -4023,13 +4023,13 @@ static void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv,
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
spin_unlock_irqrestore(&priv->sta_lock, flags);
iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
}
static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
struct iwl_ht_agg *agg,
struct iwl_compressed_ba_resp*
static int iwl4965_tx_status_reply_compressed_ba(struct iwl4965_priv *priv,
struct iwl4965_ht_agg *agg,
struct iwl4965_compressed_ba_resp*
ba_resp)
{
......@@ -4079,19 +4079,19 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
return 0;
}
static inline int iwl_queue_dec_wrap(int index, int n_bd)
static inline int iwl4965_queue_dec_wrap(int index, int n_bd)
{
return (index == 0) ? n_bd - 1 : index - 1;
}
static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv,
struct iwl_rx_mem_buffer *rxb)
static void iwl4965_rx_reply_compressed_ba(struct iwl4965_priv *priv,
struct iwl4965_rx_mem_buffer *rxb)
{
struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
struct iwl_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba;
struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data;
struct iwl4965_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba;
int index;
struct iwl_tx_queue *txq = NULL;
struct iwl_ht_agg *agg;
struct iwl4965_tx_queue *txq = NULL;
struct iwl4965_ht_agg *agg;
u16 ba_resp_scd_flow = le16_to_cpu(ba_resp->scd_flow);
u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn);
......@@ -4102,7 +4102,7 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv,
txq = &priv->txq[ba_resp_scd_flow];
agg = &priv->stations[ba_resp->sta_id].tid[ba_resp->tid].agg;
index = iwl_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd);
index = iwl4965_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd);
/* TODO: Need to get this copy more safely - now good for debug */
/*
......@@ -4130,20 +4130,20 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv,
iwl4965_tx_status_reply_compressed_ba(priv, agg, ba_resp);
/* releases all the TFDs until the SSN */
if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff))
iwl_tx_queue_reclaim(priv, ba_resp_scd_flow, index);
iwl4965_tx_queue_reclaim(priv, ba_resp_scd_flow, index);
}
static void iwl4965_tx_queue_stop_scheduler(struct iwl_priv *priv, u16 txq_id)
static void iwl4965_tx_queue_stop_scheduler(struct iwl4965_priv *priv, u16 txq_id)
{
iwl_write_prph(priv,
iwl4965_write_prph(priv,
KDR_SCD_QUEUE_STATUS_BITS(txq_id),
(0 << SCD_QUEUE_STTS_REG_POS_ACTIVE)|
(1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
}
static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid,
static int iwl4965_tx_queue_set_q2ratid(struct iwl4965_priv *priv, u16 ra_tid,
u16 txq_id)
{
u32 tbl_dw_addr;
......@@ -4155,14 +4155,14 @@ static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid,
tbl_dw_addr = priv->scd_base_addr +
SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id);
tbl_dw = iwl_read_targ_mem(priv, tbl_dw_addr);
tbl_dw = iwl4965_read_targ_mem(priv, tbl_dw_addr);
if (txq_id & 0x1)
tbl_dw = (scd_q2ratid << 16) | (tbl_dw & 0x0000FFFF);
else
tbl_dw = scd_q2ratid | (tbl_dw & 0xFFFF0000);
iwl_write_targ_mem(priv, tbl_dw_addr, tbl_dw);
iwl4965_write_targ_mem(priv, tbl_dw_addr, tbl_dw);
return 0;
}
......@@ -4170,7 +4170,7 @@ static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid,
/**
* txq_id must be greater than IWL_BACK_QUEUE_FIRST_ID
*/
static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id,
static int iwl4965_tx_queue_agg_enable(struct iwl4965_priv *priv, int txq_id,
int tx_fifo, int sta_id, int tid,
u16 ssn_idx)
{
......@@ -4184,10 +4184,10 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id,
ra_tid = BUILD_RAxTID(sta_id, tid);
iwl_sta_modify_enable_tid_tx(priv, sta_id, tid);
iwl4965_sta_modify_enable_tid_tx(priv, sta_id, tid);
spin_lock_irqsave(&priv->lock, flags);
rc = iwl_grab_nic_access(priv);
rc = iwl4965_grab_nic_access(priv);
if (rc) {
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
......@@ -4198,7 +4198,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id,
iwl4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id);
iwl_set_bits_prph(priv, KDR_SCD_QUEUECHAIN_SEL, (1<<txq_id));
iwl4965_set_bits_prph(priv, KDR_SCD_QUEUECHAIN_SEL, (1<<txq_id));
priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff);
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,
/* supposes that ssn_idx is valid (!= 0xFFF) */
iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx);
iwl_write_targ_mem(priv,
iwl4965_write_targ_mem(priv,
priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(txq_id),
(SCD_WIN_SIZE << SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) &
SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK);
iwl_write_targ_mem(priv, priv->scd_base_addr +
iwl4965_write_targ_mem(priv, priv->scd_base_addr +
SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32),
(SCD_FRAME_LIMIT << SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS)
& SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK);
iwl_set_bits_prph(priv, KDR_SCD_INTERRUPT_MASK, (1 << txq_id));
iwl4965_set_bits_prph(priv, KDR_SCD_INTERRUPT_MASK, (1 << txq_id));
iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1);
iwl_release_nic_access(priv);
iwl4965_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
return 0;
......@@ -4229,7 +4229,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id,
/**
* txq_id must be greater than IWL_BACK_QUEUE_FIRST_ID
*/
static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id,
static int iwl4965_tx_queue_agg_disable(struct iwl4965_priv *priv, u16 txq_id,
u16 ssn_idx, u8 tx_fifo)
{
unsigned long flags;
......@@ -4242,7 +4242,7 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id,
}
spin_lock_irqsave(&priv->lock, flags);
rc = iwl_grab_nic_access(priv);
rc = iwl4965_grab_nic_access(priv);
if (rc) {
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
......@@ -4250,18 +4250,18 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id,
iwl4965_tx_queue_stop_scheduler(priv, txq_id);
iwl_clear_bits_prph(priv, KDR_SCD_QUEUECHAIN_SEL, (1 << txq_id));
iwl4965_clear_bits_prph(priv, KDR_SCD_QUEUECHAIN_SEL, (1 << txq_id));
priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff);
priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff);
/* supposes that ssn_idx is valid (!= 0xFFF) */
iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx);
iwl_clear_bits_prph(priv, KDR_SCD_INTERRUPT_MASK, (1 << txq_id));
iwl4965_clear_bits_prph(priv, KDR_SCD_INTERRUPT_MASK, (1 << txq_id));
iwl4965_txq_ctx_deactivate(priv, txq_id);
iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0);
iwl_release_nic_access(priv);
iwl4965_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
return 0;
......@@ -4272,7 +4272,7 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id,
/*
* RATE SCALE CODE
*/
int iwl4965_init_hw_rates(struct iwl_priv *priv, struct ieee80211_rate *rates)
int iwl4965_init_hw_rates(struct iwl4965_priv *priv, struct ieee80211_rate *rates)
{
return 0;
}
......@@ -4290,10 +4290,10 @@ int iwl4965_init_hw_rates(struct iwl_priv *priv, struct ieee80211_rate *rates)
* rc80211_simple which is what this driver is currently using.
*
*/
void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap)
{
int i, r;
struct iwl_link_quality_cmd link_cmd = {
struct iwl4965_link_quality_cmd link_cmd = {
.reserved1 = 0,
};
u16 rate_flags;
......@@ -4315,8 +4315,8 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
rate_flags |= RATE_MCS_ANT_B_MSK;
rate_flags &= ~RATE_MCS_ANT_A_MSK;
link_cmd.rs_table[i].rate_n_flags =
iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags);
r = iwl_get_prev_ieee_rate(r);
iwl4965_hw_set_rate_n_flags(iwl4965_rates[r].plcp, rate_flags);
r = iwl4965_get_prev_ieee_rate(r);
}
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)
/* Update the rate scaling for control frame Tx to AP */
link_cmd.sta_id = is_ap ? IWL_AP_ID : IWL4965_BROADCAST_ID;
iwl_send_cmd_pdu(priv, REPLY_TX_LINK_QUALITY_CMD, sizeof(link_cmd),
iwl4965_send_cmd_pdu(priv, REPLY_TX_LINK_QUALITY_CMD, sizeof(link_cmd),
&link_cmd);
}
#ifdef CONFIG_IWL4965_HT
static u8 iwl_is_channel_extension(struct iwl_priv *priv, int phymode,
static u8 iwl4965_is_channel_extension(struct iwl4965_priv *priv, int phymode,
u16 channel, u8 extension_chan_offset)
{
const struct iwl_channel_info *ch_info;
const struct iwl4965_channel_info *ch_info;
ch_info = iwl_get_channel_info(priv, phymode, channel);
ch_info = iwl4965_get_channel_info(priv, phymode, channel);
if (!is_channel_valid(ch_info))
return 0;
......@@ -4352,7 +4352,7 @@ static u8 iwl_is_channel_extension(struct iwl_priv *priv, int phymode,
return 0;
}
static u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
static u8 iwl4965_is_fat_tx_allowed(struct iwl4965_priv *priv,
const struct sta_ht_info *ht_info)
{
......@@ -4368,20 +4368,20 @@ static u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
/* no fat tx allowed on 2.4GHZ */
if (priv->phymode != MODE_IEEE80211A)
return 0;
return (iwl_is_channel_extension(priv, priv->phymode,
return (iwl4965_is_channel_extension(priv, priv->phymode,
ht_info->control_channel,
ht_info->extension_chan_offset));
}
void iwl4965_set_rxon_ht(struct iwl_priv *priv, struct sta_ht_info *ht_info)
void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, struct sta_ht_info *ht_info)
{
struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon;
u32 val;
if (!ht_info->is_ht)
return;
if (iwl_is_fat_tx_allowed(priv, ht_info))
if (iwl4965_is_fat_tx_allowed(priv, ht_info))
rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED_MSK;
else
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)
return;
}
void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index)
void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index)
{
__le32 sta_flags;
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)
ht_info->tx_chan_width = IWL_CHANNEL_WIDTH_20MHZ;
ht_info->chan_width_cap = IWL_CHANNEL_WIDTH_20MHZ;
if (iwl_is_fat_tx_allowed(priv, ht_info)) {
if (iwl4965_is_fat_tx_allowed(priv, ht_info)) {
sta_flags |= STA_FLG_FAT_EN_MSK;
ht_info->chan_width_cap = IWL_CHANNEL_WIDTH_40MHZ;
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)
#ifdef CONFIG_IWL4965_HT_AGG
static void iwl4965_sta_modify_add_ba_tid(struct iwl_priv *priv,
static void iwl4965_sta_modify_add_ba_tid(struct iwl4965_priv *priv,
int sta_id, int tid, u16 ssn)
{
unsigned long flags;
......@@ -4483,10 +4483,10 @@ static void iwl4965_sta_modify_add_ba_tid(struct iwl_priv *priv,
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
spin_unlock_irqrestore(&priv->sta_lock, flags);
iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
}
static void iwl4965_sta_modify_del_ba_tid(struct iwl_priv *priv,
static void iwl4965_sta_modify_del_ba_tid(struct iwl4965_priv *priv,
int sta_id, int tid)
{
unsigned long flags;
......@@ -4498,7 +4498,7 @@ static void iwl4965_sta_modify_del_ba_tid(struct iwl_priv *priv,
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
spin_unlock_irqrestore(&priv->sta_lock, flags);
iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
}
static const u16 default_tid_to_tx_fifo[] = {
......@@ -4521,7 +4521,7 @@ static const u16 default_tid_to_tx_fifo[] = {
IWL_TX_FIFO_AC3
};
static int iwl_txq_ctx_activate_free(struct iwl_priv *priv)
static int iwl4965_txq_ctx_activate_free(struct iwl4965_priv *priv)
{
int txq_id;
......@@ -4531,17 +4531,17 @@ static int iwl_txq_ctx_activate_free(struct iwl_priv *priv)
return -1;
}
int iwl_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid,
int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid,
u16 *start_seq_num)
{
struct iwl_priv *priv = hw->priv;
struct iwl4965_priv *priv = hw->priv;
int sta_id;
int tx_fifo;
int txq_id;
int ssn = -1;
unsigned long flags;
struct iwl_tid_data *tid_data;
struct iwl4965_tid_data *tid_data;
DECLARE_MAC_BUF(mac);
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,
else
return -EINVAL;
IWL_WARNING("iwl-AGG iwl_mac_ht_tx_agg_start on da=%s"
IWL_WARNING("iwl-AGG iwl4965_mac_ht_tx_agg_start on da=%s"
" tid=%d\n", print_mac(mac, da), tid);
sta_id = iwl_hw_find_station(priv, da);
sta_id = iwl4965_hw_find_station(priv, da);
if (sta_id == IWL_INVALID_STATION)
return -ENXIO;
txq_id = iwl_txq_ctx_activate_free(priv);
txq_id = iwl4965_txq_ctx_activate_free(priv);
if (txq_id == -1)
return -ENXIO;
......@@ -4573,13 +4573,13 @@ int iwl_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid,
}
int iwl_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid,
int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid,
int generator)
{
struct iwl_priv *priv = hw->priv;
struct iwl4965_priv *priv = hw->priv;
int tx_fifo_id, txq_id, sta_id, ssn = -1;
struct iwl_tid_data *tid_data;
struct iwl4965_tid_data *tid_data;
int rc;
DECLARE_MAC_BUF(mac);
......@@ -4593,7 +4593,7 @@ int iwl_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid,
else
return -EINVAL;
sta_id = iwl_hw_find_station(priv, da);
sta_id = iwl4965_hw_find_station(priv, da);
if (sta_id == IWL_INVALID_STATION)
return -ENXIO;
......@@ -4608,36 +4608,36 @@ int iwl_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid,
return rc;
iwl4965_ba_status(priv, tid, BA_STATUS_INITIATOR_DELBA);
IWL_DEBUG_INFO("iwl_mac_ht_tx_agg_stop on da=%s tid=%d\n",
IWL_DEBUG_INFO("iwl4965_mac_ht_tx_agg_stop on da=%s tid=%d\n",
print_mac(mac, da), tid);
return 0;
}
int iwl_mac_ht_rx_agg_start(struct ieee80211_hw *hw, u8 *da,
int iwl4965_mac_ht_rx_agg_start(struct ieee80211_hw *hw, u8 *da,
u16 tid, u16 start_seq_num)
{
struct iwl_priv *priv = hw->priv;
struct iwl4965_priv *priv = hw->priv;
int sta_id;
DECLARE_MAC_BUF(mac);
IWL_WARNING("iwl-AGG iwl_mac_ht_rx_agg_start on da=%s"
IWL_WARNING("iwl-AGG iwl4965_mac_ht_rx_agg_start on da=%s"
" tid=%d\n", print_mac(mac, da), tid);
sta_id = iwl_hw_find_station(priv, da);
sta_id = iwl4965_hw_find_station(priv, da);
iwl4965_sta_modify_add_ba_tid(priv, sta_id, tid, start_seq_num);
return 0;
}
int iwl_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da,
int iwl4965_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da,
u16 tid, int generator)
{
struct iwl_priv *priv = hw->priv;
struct iwl4965_priv *priv = hw->priv;
int sta_id;
DECLARE_MAC_BUF(mac);
IWL_WARNING("iwl-AGG iwl_mac_ht_rx_agg_stop on da=%s tid=%d\n",
IWL_WARNING("iwl-AGG iwl4965_mac_ht_rx_agg_stop on da=%s tid=%d\n",
print_mac(mac, da), tid);
sta_id = iwl_hw_find_station(priv, da);
sta_id = iwl4965_hw_find_station(priv, da);
iwl4965_sta_modify_del_ba_tid(priv, sta_id, tid);
return 0;
}
......@@ -4646,7 +4646,7 @@ int iwl_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da,
#endif /* CONFIG_IWL4965_HT */
/* Set up 4965-specific Rx frame reply handlers */
void iwl_hw_rx_handler_setup(struct iwl_priv *priv)
void iwl4965_hw_rx_handler_setup(struct iwl4965_priv *priv)
{
/* Legacy Rx frames */
priv->rx_handlers[REPLY_4965_RX] = iwl4965_rx_reply_rx;
......@@ -4665,7 +4665,7 @@ void iwl_hw_rx_handler_setup(struct iwl_priv *priv)
#endif /* CONFIG_IWL4965_HT */
}
void iwl_hw_setup_deferred_work(struct iwl_priv *priv)
void iwl4965_hw_setup_deferred_work(struct iwl4965_priv *priv)
{
INIT_WORK(&priv->txpower_work, iwl4965_bg_txpower_work);
INIT_WORK(&priv->statistics_work, iwl4965_bg_statistics_work);
......@@ -4682,28 +4682,28 @@ void iwl_hw_setup_deferred_work(struct iwl_priv *priv)
priv->statistics_periodic.function = iwl4965_bg_statistics_periodic;
}
void iwl_hw_cancel_deferred_work(struct iwl_priv *priv)
void iwl4965_hw_cancel_deferred_work(struct iwl4965_priv *priv)
{
del_timer_sync(&priv->statistics_periodic);
cancel_delayed_work(&priv->init_alive_start);
}
struct pci_device_id iwl_hw_card_ids[] = {
struct pci_device_id iwl4965_hw_card_ids[] = {
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4229)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4230)},
{0}
};
int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv)
int iwl4965_eeprom_acquire_semaphore(struct iwl4965_priv *priv)
{
u16 count;
int rc;
for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) {
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
iwl4965_set_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
rc = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG,
rc = iwl4965_poll_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
EEPROM_SEM_TIMEOUT);
......@@ -4717,11 +4717,11 @@ int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv)
return rc;
}
inline void iwl_eeprom_release_semaphore(struct iwl_priv *priv)
inline void iwl4965_eeprom_release_semaphore(struct iwl4965_priv *priv)
{
iwl_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
iwl4965_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
}
MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
MODULE_DEVICE_TABLE(pci, iwl4965_hw_card_ids);
......@@ -30,10 +30,10 @@
#include <linux/kernel.h>
#include <net/ieee80211_radiotap.h>
struct iwl_priv;
struct iwl4965_priv;
/* Hardware specific file defines the PCI IDs table for that hardware module */
extern struct pci_device_id iwl_hw_card_ids[];
extern struct pci_device_id iwl4965_hw_card_ids[];
#define DRV_NAME "iwl4965"
#include "iwl-4965-hw.h"
......@@ -54,10 +54,10 @@ extern struct pci_device_id iwl_hw_card_ids[];
#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127)
/* Module parameters accessible from iwl-*.c */
extern int iwl_param_hwcrypto;
extern int iwl_param_queues_num;
extern int iwl4965_param_hwcrypto;
extern int iwl4965_param_queues_num;
enum iwl_antenna {
enum iwl4965_antenna {
IWL_ANTENNA_DIVERSITY,
IWL_ANTENNA_MAIN,
IWL_ANTENNA_AUX
......@@ -80,13 +80,13 @@ enum iwl_antenna {
#define DEFAULT_SHORT_RETRY_LIMIT 7U
#define DEFAULT_LONG_RETRY_LIMIT 4U
struct iwl_rx_mem_buffer {
struct iwl4965_rx_mem_buffer {
dma_addr_t dma_addr;
struct sk_buff *skb;
struct list_head list;
};
struct iwl_rt_rx_hdr {
struct iwl4965_rt_rx_hdr {
struct ieee80211_radiotap_header rt_hdr;
__le64 rt_tsf; /* TSF */
u8 rt_flags; /* radiotap packet flags */
......@@ -99,7 +99,7 @@ struct iwl_rt_rx_hdr {
u8 payload[0]; /* payload... */
} __attribute__ ((packed));
struct iwl_rt_tx_hdr {
struct iwl4965_rt_tx_hdr {
struct ieee80211_radiotap_header rt_hdr;
u8 rt_rate; /* rate in 500kb/s */
__le16 rt_channel; /* channel in mHz */
......@@ -114,7 +114,7 @@ struct iwl_rt_tx_hdr {
*
* Contains common data for Rx and Tx queues
*/
struct iwl_queue {
struct iwl4965_queue {
int n_bd; /* number of BDs in this queue */
int write_ptr; /* 1-st empty entry (index) host_w*/
int read_ptr; /* last used entry (index) host_r*/
......@@ -129,24 +129,24 @@ struct iwl_queue {
#define MAX_NUM_OF_TBS (20)
struct iwl_tx_info {
struct iwl4965_tx_info {
struct ieee80211_tx_status status;
struct sk_buff *skb[MAX_NUM_OF_TBS];
};
/**
* struct iwl_tx_queue - Tx Queue for DMA
* struct iwl4965_tx_queue - Tx Queue for DMA
* @need_update: need to update read/write index
* @shed_retry: queue is HT AGG enabled
*
* Queue consists of circular buffer of BD's and required locking structures.
*/
struct iwl_tx_queue {
struct iwl_queue q;
struct iwl_tfd_frame *bd;
struct iwl_cmd *cmd;
struct iwl4965_tx_queue {
struct iwl4965_queue q;
struct iwl4965_tfd_frame *bd;
struct iwl4965_cmd *cmd;
dma_addr_t dma_addr_cmd;
struct iwl_tx_info *txb;
struct iwl4965_tx_info *txb;
int need_update;
int sched_retry;
int active;
......@@ -154,12 +154,12 @@ struct iwl_tx_queue {
#define IWL_NUM_SCAN_RATES (2)
struct iwl_channel_tgd_info {
struct iwl4965_channel_tgd_info {
u8 type;
s8 max_power;
};
struct iwl_channel_tgh_info {
struct iwl4965_channel_tgh_info {
s64 last_radar_time;
};
......@@ -170,8 +170,8 @@ struct iwl_channel_tgh_info {
* -- spectrum management
* -- user preference (e.g. iwconfig)
* when requested power is set, base power index must also be set. */
struct iwl_channel_power_info {
struct iwl_tx_power tpc; /* actual radio and DSP gain settings */
struct iwl4965_channel_power_info {
struct iwl4965_tx_power tpc; /* actual radio and DSP gain settings */
s8 power_table_index; /* actual (compenst'd) index into gain table */
s8 base_power_index; /* gain index for power at factory temp. */
s8 requested_power; /* power (dBm) requested for this chnl/rate */
......@@ -179,8 +179,8 @@ struct iwl_channel_power_info {
/* current scan Tx power values to use, one for each scan rate for each
* channel. */
struct iwl_scan_power_info {
struct iwl_tx_power tpc; /* actual radio and DSP gain settings */
struct iwl4965_scan_power_info {
struct iwl4965_tx_power tpc; /* actual radio and DSP gain settings */
s8 power_table_index; /* actual (compenst'd) index into gain table */
s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */
};
......@@ -200,11 +200,11 @@ struct iwl_scan_power_info {
*/
#define IWL4965_MAX_RATE (33)
struct iwl_channel_info {
struct iwl_channel_tgd_info tgd;
struct iwl_channel_tgh_info tgh;
struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */
struct iwl_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for
struct iwl4965_channel_info {
struct iwl4965_channel_tgd_info tgd;
struct iwl4965_channel_tgh_info tgh;
struct iwl4965_eeprom_channel eeprom; /* EEPROM regulatory limit */
struct iwl4965_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for
* FAT channel */
u8 channel; /* channel number */
......@@ -221,7 +221,7 @@ struct iwl_channel_info {
/* Radio/DSP gain settings for each "normal" data Tx rate.
* These include, in addition to RF and DSP gain, a few fields for
* remembering/modifying gain settings (indexes). */
struct iwl_channel_power_info power_info[IWL4965_MAX_RATE];
struct iwl4965_channel_power_info power_info[IWL4965_MAX_RATE];
/* FAT channel info */
s8 fat_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */
......@@ -232,10 +232,10 @@ struct iwl_channel_info {
u8 fat_extension_channel;
/* Radio/DSP gain settings for each scan rate, for directed scans. */
struct iwl_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES];
struct iwl4965_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES];
};
struct iwl_clip_group {
struct iwl4965_clip_group {
/* maximum power level to prevent clipping for each rate, derived by
* us from this band's saturation power in EEPROM */
const s8 clip_powers[IWL_MAX_RATES];
......@@ -256,8 +256,8 @@ struct iwl_clip_group {
/* Power management (not Tx power) structures */
struct iwl_power_vec_entry {
struct iwl_powertable_cmd cmd;
struct iwl4965_power_vec_entry {
struct iwl4965_powertable_cmd cmd;
u8 no_dtim;
};
#define IWL_POWER_RANGE_0 (0)
......@@ -273,10 +273,10 @@ struct iwl_power_vec_entry {
#define IWL_POWER_ENABLED 0x10
#define IWL_POWER_LEVEL(x) ((x) & IWL_POWER_MASK)
struct iwl_power_mgr {
struct iwl4965_power_mgr {
spinlock_t lock;
struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC];
struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC];
struct iwl4965_power_vec_entry pwr_range_0[IWL_POWER_AC];
struct iwl4965_power_vec_entry pwr_range_1[IWL_POWER_AC];
u8 active_index;
u32 dtim_val;
};
......@@ -286,10 +286,10 @@ struct iwl_power_mgr {
#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
struct iwl_frame {
struct iwl4965_frame {
union {
struct ieee80211_hdr frame;
struct iwl_tx_beacon_cmd beacon;
struct iwl4965_tx_beacon_cmd beacon;
u8 raw[IEEE80211_FRAME_LEN];
u8 cmd[360];
} u;
......@@ -315,15 +315,15 @@ enum {
CMD_WANT_SKB = (1 << 2),
};
struct iwl_cmd;
struct iwl_priv;
struct iwl4965_cmd;
struct iwl4965_priv;
struct iwl_cmd_meta {
struct iwl_cmd_meta *source;
struct iwl4965_cmd_meta {
struct iwl4965_cmd_meta *source;
union {
struct sk_buff *skb;
int (*callback)(struct iwl_priv *priv,
struct iwl_cmd *cmd, struct sk_buff *skb);
int (*callback)(struct iwl4965_priv *priv,
struct iwl4965_cmd *cmd, struct sk_buff *skb);
} __attribute__ ((packed)) u;
/* The CMD_SIZE_HUGE flag bit indicates that the command
......@@ -332,37 +332,37 @@ struct iwl_cmd_meta {
} __attribute__ ((packed));
struct iwl_cmd {
struct iwl_cmd_meta meta;
struct iwl_cmd_header hdr;
struct iwl4965_cmd {
struct iwl4965_cmd_meta meta;
struct iwl4965_cmd_header hdr;
union {
struct iwl_addsta_cmd addsta;
struct iwl_led_cmd led;
struct iwl4965_addsta_cmd addsta;
struct iwl4965_led_cmd led;
u32 flags;
u8 val8;
u16 val16;
u32 val32;
struct iwl_bt_cmd bt;
struct iwl_rxon_time_cmd rxon_time;
struct iwl_powertable_cmd powertable;
struct iwl_qosparam_cmd qosparam;
struct iwl_tx_cmd tx;
struct iwl_tx_beacon_cmd tx_beacon;
struct iwl_rxon_assoc_cmd rxon_assoc;
struct iwl4965_bt_cmd bt;
struct iwl4965_rxon_time_cmd rxon_time;
struct iwl4965_powertable_cmd powertable;
struct iwl4965_qosparam_cmd qosparam;
struct iwl4965_tx_cmd tx;
struct iwl4965_tx_beacon_cmd tx_beacon;
struct iwl4965_rxon_assoc_cmd rxon_assoc;
u8 *indirect;
u8 payload[360];
} __attribute__ ((packed)) cmd;
} __attribute__ ((packed));
struct iwl_host_cmd {
struct iwl4965_host_cmd {
u8 id;
u16 len;
struct iwl_cmd_meta meta;
struct iwl4965_cmd_meta meta;
const void *data;
};
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \
sizeof(struct iwl_cmd_meta))
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl4965_cmd) - \
sizeof(struct iwl4965_cmd_meta))
/*
* RX related structures and functions
......@@ -375,7 +375,7 @@ struct iwl_host_cmd {
#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
/**
* struct iwl_rx_queue - Rx queue
* struct iwl4965_rx_queue - Rx queue
* @processed: Internal index to last handled Rx packet
* @read: Shared index to newest available Rx buffer
* @write: Shared index to oldest written Rx packet
......@@ -384,13 +384,13 @@ struct iwl_host_cmd {
* @rx_used: List of Rx buffers with no SKB
* @need_update: flag to indicate we need to update read/write index
*
* NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers
* NOTE: rx_free and rx_used are used as a FIFO for iwl4965_rx_mem_buffers
*/
struct iwl_rx_queue {
struct iwl4965_rx_queue {
__le32 *bd;
dma_addr_t dma_addr;
struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE];
struct iwl4965_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
struct iwl4965_rx_mem_buffer *queue[RX_QUEUE_SIZE];
u32 processed;
u32 read;
u32 write;
......@@ -436,7 +436,7 @@ struct iwl_rx_queue {
#ifdef CONFIG_IWL4965_HT
#ifdef CONFIG_IWL4965_HT_AGG
struct iwl_ht_agg {
struct iwl4965_ht_agg {
u16 txq_id;
u16 frame_count;
u16 wait_for_ba;
......@@ -448,22 +448,22 @@ struct iwl_ht_agg {
#endif /* CONFIG_IWL4965_HT_AGG */
#endif /* CONFIG_IWL4965_HT */
struct iwl_tid_data {
struct iwl4965_tid_data {
u16 seq_number;
#ifdef CONFIG_IWL4965_HT
#ifdef CONFIG_IWL4965_HT_AGG
struct iwl_ht_agg agg;
struct iwl4965_ht_agg agg;
#endif /* CONFIG_IWL4965_HT_AGG */
#endif /* CONFIG_IWL4965_HT */
};
struct iwl_hw_key {
struct iwl4965_hw_key {
enum ieee80211_key_alg alg;
int keylen;
u8 key[32];
};
union iwl_ht_rate_supp {
union iwl4965_ht_rate_supp {
u16 rates;
struct {
u8 siso_rate;
......@@ -498,7 +498,7 @@ struct sta_ht_info {
#ifdef CONFIG_IWL4965_QOS
union iwl_qos_capabity {
union iwl4965_qos_capabity {
struct {
u8 edca_count:4; /* bit 0-3 */
u8 q_ack:1; /* bit 4 */
......@@ -519,23 +519,23 @@ union iwl_qos_capabity {
};
/* QoS structures */
struct iwl_qos_info {
struct iwl4965_qos_info {
int qos_enable;
int qos_active;
union iwl_qos_capabity qos_cap;
struct iwl_qosparam_cmd def_qos_parm;
union iwl4965_qos_capabity qos_cap;
struct iwl4965_qosparam_cmd def_qos_parm;
};
#endif /*CONFIG_IWL4965_QOS */
#define STA_PS_STATUS_WAKE 0
#define STA_PS_STATUS_SLEEP 1
struct iwl_station_entry {
struct iwl_addsta_cmd sta;
struct iwl_tid_data tid[MAX_TID_COUNT];
struct iwl4965_station_entry {
struct iwl4965_addsta_cmd sta;
struct iwl4965_tid_data tid[MAX_TID_COUNT];
u8 used;
u8 ps_status;
struct iwl_hw_key keyinfo;
struct iwl4965_hw_key keyinfo;
};
/* one for each uCode image (inst/data, boot/init/runtime) */
......@@ -546,7 +546,7 @@ struct fw_desc {
};
/* uCode file layout */
struct iwl_ucode {
struct iwl4965_ucode {
__le32 ver; /* major/minor/subminor */
__le32 inst_size; /* bytes of runtime instructions */
__le32 data_size; /* bytes of runtime data */
......@@ -558,7 +558,7 @@ struct iwl_ucode {
#define IWL_IBSS_MAC_HASH_SIZE 32
struct iwl_ibss_seq {
struct iwl4965_ibss_seq {
u8 mac[ETH_ALEN];
u16 seq_num;
u16 frag_num;
......@@ -566,7 +566,7 @@ struct iwl_ibss_seq {
struct list_head list;
};
struct iwl_driver_hw_info {
struct iwl4965_driver_hw_info {
u16 max_txq_num;
u16 ac_queue_count;
u16 tx_cmd_len;
......@@ -592,10 +592,10 @@ struct iwl_driver_hw_info {
#define HT_SHORT_GI_40MHZ_ONLY (1 << 1)
#define IWL_RX_HDR(x) ((struct iwl_rx_frame_hdr *)(\
#define IWL_RX_HDR(x) ((struct iwl4965_rx_frame_hdr *)(\
x->u.rx_frame.stats.payload + \
x->u.rx_frame.stats.phy_count))
#define IWL_RX_END(x) ((struct iwl_rx_frame_end *)(\
#define IWL_RX_END(x) ((struct iwl4965_rx_frame_end *)(\
IWL_RX_HDR(x)->payload + \
le16_to_cpu(IWL_RX_HDR(x)->len)))
#define IWL_RX_STATS(x) (&x->u.rx_frame.stats)
......@@ -608,63 +608,63 @@ struct iwl_driver_hw_info {
* for use by iwl-*.c
*
*****************************************************************************/
struct iwl_addsta_cmd;
extern int iwl_send_add_station(struct iwl_priv *priv,
struct iwl_addsta_cmd *sta, u8 flags);
extern u8 iwl_add_station(struct iwl_priv *priv, const u8 *bssid,
struct iwl4965_addsta_cmd;
extern int iwl4965_send_add_station(struct iwl4965_priv *priv,
struct iwl4965_addsta_cmd *sta, u8 flags);
extern u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *bssid,
int is_ap, u8 flags);
extern int iwl_is_network_packet(struct iwl_priv *priv,
extern int iwl4965_is_network_packet(struct iwl4965_priv *priv,
struct ieee80211_hdr *header);
extern int iwl_power_init_handle(struct iwl_priv *priv);
extern int iwl_eeprom_init(struct iwl_priv *priv);
extern int iwl4965_power_init_handle(struct iwl4965_priv *priv);
extern int iwl4965_eeprom_init(struct iwl4965_priv *priv);
#ifdef CONFIG_IWL4965_DEBUG
extern void iwl_report_frame(struct iwl_priv *priv,
struct iwl_rx_packet *pkt,
extern void iwl4965_report_frame(struct iwl4965_priv *priv,
struct iwl4965_rx_packet *pkt,
struct ieee80211_hdr *header, int group100);
#else
static inline void iwl_report_frame(struct iwl_priv *priv,
struct iwl_rx_packet *pkt,
static inline void iwl4965_report_frame(struct iwl4965_priv *priv,
struct iwl4965_rx_packet *pkt,
struct ieee80211_hdr *header,
int group100) {}
#endif
extern void iwl_handle_data_packet_monitor(struct iwl_priv *priv,
struct iwl_rx_mem_buffer *rxb,
extern void iwl4965_handle_data_packet_monitor(struct iwl4965_priv *priv,
struct iwl4965_rx_mem_buffer *rxb,
void *data, short len,
struct ieee80211_rx_status *stats,
u16 phy_flags);
extern int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr
*header);
extern int iwl_rx_queue_alloc(struct iwl_priv *priv);
extern void iwl_rx_queue_reset(struct iwl_priv *priv,
struct iwl_rx_queue *rxq);
extern int iwl_calc_db_from_ratio(int sig_ratio);
extern int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm);
extern int iwl_tx_queue_init(struct iwl_priv *priv,
struct iwl_tx_queue *txq, int count, u32 id);
extern void iwl_rx_replenish(void *data);
extern void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq);
extern int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len,
extern int iwl4965_is_duplicate_packet(struct iwl4965_priv *priv,
struct ieee80211_hdr *header);
extern int iwl4965_rx_queue_alloc(struct iwl4965_priv *priv);
extern void iwl4965_rx_queue_reset(struct iwl4965_priv *priv,
struct iwl4965_rx_queue *rxq);
extern int iwl4965_calc_db_from_ratio(int sig_ratio);
extern int iwl4965_calc_sig_qual(int rssi_dbm, int noise_dbm);
extern int iwl4965_tx_queue_init(struct iwl4965_priv *priv,
struct iwl4965_tx_queue *txq, int count, u32 id);
extern void iwl4965_rx_replenish(void *data);
extern void iwl4965_tx_queue_free(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq);
extern int iwl4965_send_cmd_pdu(struct iwl4965_priv *priv, u8 id, u16 len,
const void *data);
extern int __must_check iwl_send_cmd(struct iwl_priv *priv,
struct iwl_host_cmd *cmd);
extern unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv,
extern int __must_check iwl4965_send_cmd(struct iwl4965_priv *priv,
struct iwl4965_host_cmd *cmd);
extern unsigned int iwl4965_fill_beacon_frame(struct iwl4965_priv *priv,
struct ieee80211_hdr *hdr,
const u8 *dest, int left);
extern int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv,
struct iwl_rx_queue *q);
extern int iwl_send_statistics_request(struct iwl_priv *priv);
extern void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb,
extern int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv,
struct iwl4965_rx_queue *q);
extern int iwl4965_send_statistics_request(struct iwl4965_priv *priv);
extern void iwl4965_set_decrypted_flag(struct iwl4965_priv *priv, struct sk_buff *skb,
u32 decrypt_res,
struct ieee80211_rx_status *stats);
extern __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr);
extern const u8 BROADCAST_ADDR[ETH_ALEN];
extern const u8 iwl4965_broadcast_addr[ETH_ALEN];
/*
* Currently used by iwl-3945-rs... look at restructuring so that it doesn't
* call this... todo... fix that.
*/
extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id,
extern u8 iwl4965_sync_station(struct iwl4965_priv *priv, int sta_id,
u16 tx_rate, u8 flags);
/******************************************************************************
......@@ -676,112 +676,110 @@ extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id,
* which is why they are in the hardware specific files (vs. iwl-base.c)
*
* Naming convention --
* iwl_ <-- Its part of iwlwifi (should be changed to iwl_)
* iwl_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW)
* iwl4965_ <-- Its part of iwlwifi (should be changed to iwl4965_)
* iwl4965_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW)
* iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
* iwl_bg_ <-- Called from work queue context
* iwl_mac_ <-- mac80211 callback
* iwl4965_bg_ <-- Called from work queue context
* iwl4965_mac_ <-- mac80211 callback
*
****************************************************************************/
extern void iwl_hw_rx_handler_setup(struct iwl_priv *priv);
extern void iwl_hw_setup_deferred_work(struct iwl_priv *priv);
extern void iwl_hw_cancel_deferred_work(struct iwl_priv *priv);
extern int iwl_hw_rxq_stop(struct iwl_priv *priv);
extern int iwl_hw_set_hw_setting(struct iwl_priv *priv);
extern int iwl_hw_nic_init(struct iwl_priv *priv);
extern int iwl_hw_nic_stop_master(struct iwl_priv *priv);
extern void iwl_hw_txq_ctx_free(struct iwl_priv *priv);
extern void iwl_hw_txq_ctx_stop(struct iwl_priv *priv);
extern int iwl_hw_nic_reset(struct iwl_priv *priv);
extern int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd,
extern void iwl4965_hw_rx_handler_setup(struct iwl4965_priv *priv);
extern void iwl4965_hw_setup_deferred_work(struct iwl4965_priv *priv);
extern void iwl4965_hw_cancel_deferred_work(struct iwl4965_priv *priv);
extern int iwl4965_hw_rxq_stop(struct iwl4965_priv *priv);
extern int iwl4965_hw_set_hw_setting(struct iwl4965_priv *priv);
extern int iwl4965_hw_nic_init(struct iwl4965_priv *priv);
extern int iwl4965_hw_nic_stop_master(struct iwl4965_priv *priv);
extern void iwl4965_hw_txq_ctx_free(struct iwl4965_priv *priv);
extern void iwl4965_hw_txq_ctx_stop(struct iwl4965_priv *priv);
extern int iwl4965_hw_nic_reset(struct iwl4965_priv *priv);
extern int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl4965_priv *priv, void *tfd,
dma_addr_t addr, u16 len);
extern int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq);
extern int iwl_hw_get_temperature(struct iwl_priv *priv);
extern int iwl_hw_tx_queue_init(struct iwl_priv *priv,
struct iwl_tx_queue *txq);
extern unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
struct iwl_frame *frame, u8 rate);
extern int iwl_hw_get_rx_read(struct iwl_priv *priv);
extern void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
struct iwl_cmd *cmd,
extern int iwl4965_hw_txq_free_tfd(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq);
extern int iwl4965_hw_get_temperature(struct iwl4965_priv *priv);
extern int iwl4965_hw_tx_queue_init(struct iwl4965_priv *priv,
struct iwl4965_tx_queue *txq);
extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl4965_priv *priv,
struct iwl4965_frame *frame, u8 rate);
extern int iwl4965_hw_get_rx_read(struct iwl4965_priv *priv);
extern void iwl4965_hw_build_tx_cmd_rate(struct iwl4965_priv *priv,
struct iwl4965_cmd *cmd,
struct ieee80211_tx_control *ctrl,
struct ieee80211_hdr *hdr,
int sta_id, int tx_id);
extern int iwl_hw_reg_send_txpower(struct iwl_priv *priv);
extern int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power);
extern void iwl_hw_rx_statistics(struct iwl_priv *priv,
struct iwl_rx_mem_buffer *rxb);
extern void iwl_disable_events(struct iwl_priv *priv);
extern int iwl4965_get_temperature(const struct iwl_priv *priv);
extern int iwl4965_hw_reg_send_txpower(struct iwl4965_priv *priv);
extern int iwl4965_hw_reg_set_txpower(struct iwl4965_priv *priv, s8 power);
extern void iwl4965_hw_rx_statistics(struct iwl4965_priv *priv,
struct iwl4965_rx_mem_buffer *rxb);
extern void iwl4965_disable_events(struct iwl4965_priv *priv);
extern int iwl4965_get_temperature(const struct iwl4965_priv *priv);
/**
* iwl_hw_find_station - Find station id for a given BSSID
* iwl4965_hw_find_station - Find station id for a given BSSID
* @bssid: MAC address of station ID to find
*
* NOTE: This should not be hardware specific but the code has
* not yet been merged into a single common layer for managing the
* station tables.
*/
extern u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *bssid);
extern u8 iwl4965_hw_find_station(struct iwl4965_priv *priv, const u8 *bssid);
extern int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel);
extern int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index);
extern int iwl4965_hw_channel_switch(struct iwl4965_priv *priv, u16 channel);
extern int iwl4965_tx_queue_reclaim(struct iwl4965_priv *priv, int txq_id, int index);
struct iwl_priv;
struct iwl4965_priv;
struct sta_ht_info;
/*
* Forward declare iwl-4965.c functions for iwl-base.c
*/
extern int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv);
extern void iwl_eeprom_release_semaphore(struct iwl_priv *priv);
extern int iwl4965_eeprom_acquire_semaphore(struct iwl4965_priv *priv);
extern void iwl4965_eeprom_release_semaphore(struct iwl4965_priv *priv);
extern int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv,
struct iwl_tx_queue *txq,
extern int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv,
struct iwl4965_tx_queue *txq,
u16 byte_cnt);
extern void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr,
extern void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr,
int is_ap);
extern void iwl4965_set_rxon_ht(struct iwl_priv *priv,
extern void iwl4965_set_rxon_ht(struct iwl4965_priv *priv,
struct sta_ht_info *ht_info);
extern void iwl4965_set_rxon_chain(struct iwl_priv *priv);
extern int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd,
extern void iwl4965_set_rxon_chain(struct iwl4965_priv *priv);
extern int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd,
u8 sta_id, dma_addr_t txcmd_phys,
struct ieee80211_hdr *hdr, u8 hdr_len,
struct ieee80211_tx_control *ctrl, void *sta_in);
extern int iwl4965_init_hw_rates(struct iwl_priv *priv,
struct ieee80211_rate *rates);
extern int iwl4965_alive_notify(struct iwl_priv *priv);
extern void iwl4965_update_rate_scaling(struct iwl_priv *priv, u8 mode);
extern void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index);
extern void iwl4965_chain_noise_reset(struct iwl_priv *priv);
extern void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags,
extern int iwl4965_alive_notify(struct iwl4965_priv *priv);
extern void iwl4965_update_rate_scaling(struct iwl4965_priv *priv, u8 mode);
extern void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index);
extern void iwl4965_chain_noise_reset(struct iwl4965_priv *priv);
extern void iwl4965_init_sensitivity(struct iwl4965_priv *priv, u8 flags,
u8 force);
extern int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode,
extern int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv, int phymode,
u16 channel,
const struct iwl_eeprom_channel *eeprom_ch,
const struct iwl4965_eeprom_channel *eeprom_ch,
u8 fat_extension_channel);
extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv);
extern void iwl4965_rf_kill_ct_config(struct iwl4965_priv *priv);
#ifdef CONFIG_IWL4965_HT
#ifdef CONFIG_IWL4965_HT_AGG
extern int iwl_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da,
extern int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da,
u16 tid, u16 *start_seq_num);
extern int iwl_mac_ht_rx_agg_start(struct ieee80211_hw *hw, u8 *da,
extern int iwl4965_mac_ht_rx_agg_start(struct ieee80211_hw *hw, u8 *da,
u16 tid, u16 start_seq_num);
extern int iwl_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da,
extern int iwl4965_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da,
u16 tid, int generator);
extern int iwl_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da,
extern int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da,
u16 tid, int generator);
extern void iwl4965_turn_off_agg(struct iwl_priv *priv, u8 tid);
extern void iwl4965_turn_off_agg(struct iwl4965_priv *priv, u8 tid);
#endif /* CONFIG_IWL4965_HT_AGG */
#endif /*CONFIG_IWL4965_HT */
/* Structures, enum, and defines specific to the 4965 */
#define IWL4965_KW_SIZE 0x1000 /*4k */
struct iwl_kw {
struct iwl4965_kw {
dma_addr_t dma_addr;
void *v_addr;
size_t size;
......@@ -835,7 +833,7 @@ struct iwl_kw {
#define IWL_TX_POWER_CCK_COMPENSATION_B_STEP (9)
#define IWL_TX_POWER_CCK_COMPENSATION_C_STEP (5)
struct iwl_traffic_load {
struct iwl4965_traffic_load {
unsigned long time_stamp;
u32 packet_count[TID_QUEUE_MAX_SIZE];
u8 queue_count;
......@@ -844,7 +842,7 @@ struct iwl_traffic_load {
};
#ifdef CONFIG_IWL4965_HT_AGG
struct iwl_agg_control {
struct iwl4965_agg_control {
unsigned long next_retry;
u32 wait_for_agg_status;
u32 tid_retry;
......@@ -853,13 +851,13 @@ struct iwl_agg_control {
u8 auto_agg;
u32 tid_traffic_load_threshold;
u32 ba_timeout;
struct iwl_traffic_load traffic_load[TID_MAX_LOAD_COUNT];
struct iwl4965_traffic_load traffic_load[TID_MAX_LOAD_COUNT];
};
#endif /*CONFIG_IWL4965_HT_AGG */
struct iwl_lq_mngr {
struct iwl4965_lq_mngr {
#ifdef CONFIG_IWL4965_HT_AGG
struct iwl_agg_control agg_ctrl;
struct iwl4965_agg_control agg_ctrl;
#endif
spinlock_t lock;
s32 max_window_size;
......@@ -940,24 +938,24 @@ struct iwl_lq_mngr {
#define IN_BAND_FILTER 0xFF
#define MIN_AVERAGE_NOISE_MAX_VALUE 0xFFFFFFFF
enum iwl_false_alarm_state {
enum iwl4965_false_alarm_state {
IWL_FA_TOO_MANY = 0,
IWL_FA_TOO_FEW = 1,
IWL_FA_GOOD_RANGE = 2,
};
enum iwl_chain_noise_state {
enum iwl4965_chain_noise_state {
IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */
IWL_CHAIN_NOISE_ACCUMULATE = 1,
IWL_CHAIN_NOISE_CALIBRATED = 2,
};
enum iwl_sensitivity_state {
enum iwl4965_sensitivity_state {
IWL_SENS_CALIB_ALLOWED = 0,
IWL_SENS_CALIB_NEED_REINIT = 1,
};
enum iwl_calib_enabled_state {
enum iwl4965_calib_enabled_state {
IWL_CALIB_DISABLED = 0, /* must be 0 */
IWL_CALIB_ENABLED = 1,
};
......@@ -972,7 +970,7 @@ struct statistics_general_data {
};
/* Sensitivity calib data */
struct iwl_sensitivity_data {
struct iwl4965_sensitivity_data {
u32 auto_corr_ofdm;
u32 auto_corr_ofdm_mrc;
u32 auto_corr_ofdm_x1;
......@@ -1001,7 +999,7 @@ struct iwl_sensitivity_data {
};
/* Chain noise (differential Rx gain) calib data */
struct iwl_chain_noise_data {
struct iwl4965_chain_noise_data {
u8 state;
u16 beacon_count;
u32 chain_noise_a;
......@@ -1049,7 +1047,7 @@ enum {
#endif
struct iwl_priv {
struct iwl4965_priv {
/* ieee device used by generic ieee processing code */
struct ieee80211_hw *hw;
......@@ -1063,27 +1061,27 @@ struct iwl_priv {
u8 phymode;
int alloc_rxb_skb;
void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
struct iwl_rx_mem_buffer *rxb);
void (*rx_handlers[REPLY_MAX])(struct iwl4965_priv *priv,
struct iwl4965_rx_mem_buffer *rxb);
const struct ieee80211_hw_mode *modes;
#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT
/* spectrum measurement report caching */
struct iwl_spectrum_notification measure_report;
struct iwl4965_spectrum_notification measure_report;
u8 measurement_status;
#endif
/* ucode beacon time */
u32 ucode_beacon_time;
/* we allocate array of iwl_channel_info for NIC's valid channels.
/* we allocate array of iwl4965_channel_info for NIC's valid channels.
* Access via channel # using indirect index array */
struct iwl_channel_info *channel_info; /* channel info array */
struct iwl4965_channel_info *channel_info; /* channel info array */
u8 channel_count; /* # of channels */
/* each calibration channel group in the EEPROM has a derived
* clip setting for each rate. */
const struct iwl_clip_group clip_groups[5];
const struct iwl4965_clip_group clip_groups[5];
/* thermal calibration */
s32 temperature; /* degrees Kelvin */
......@@ -1098,7 +1096,7 @@ struct iwl_priv {
int one_direct_scan;
u8 direct_ssid_len;
u8 direct_ssid[IW_ESSID_MAX_SIZE];
struct iwl_scan_cmd *scan;
struct iwl4965_scan_cmd *scan;
u8 only_active_channel;
/* spinlock */
......@@ -1121,26 +1119,26 @@ struct iwl_priv {
struct fw_desc ucode_boot; /* bootstrap inst */
struct iwl_rxon_time_cmd rxon_timing;
struct iwl4965_rxon_time_cmd rxon_timing;
/* We declare this const so it can only be
* changed via explicit cast within the
* routines that actually update the physical
* hardware */
const struct iwl_rxon_cmd active_rxon;
struct iwl_rxon_cmd staging_rxon;
const struct iwl4965_rxon_cmd active_rxon;
struct iwl4965_rxon_cmd staging_rxon;
int error_recovering;
struct iwl_rxon_cmd recovery_rxon;
struct iwl4965_rxon_cmd recovery_rxon;
/* 1st responses from initialize and runtime uCode images.
* 4965's initialize alive response contains some calibration data. */
struct iwl_init_alive_resp card_alive_init;
struct iwl_alive_resp card_alive;
struct iwl4965_init_alive_resp card_alive_init;
struct iwl4965_alive_resp card_alive;
#ifdef LED
/* LED related variables */
struct iwl_activity_blink activity;
struct iwl4965_activity_blink activity;
unsigned long led_packets;
int led_state;
#endif
......@@ -1158,8 +1156,8 @@ struct iwl_priv {
u8 current_channel_width;
u8 valid_antenna; /* Bit mask of antennas actually connected */
#ifdef CONFIG_IWL4965_SENSITIVITY
struct iwl_sensitivity_data sensitivity_data;
struct iwl_chain_noise_data chain_noise_data;
struct iwl4965_sensitivity_data sensitivity_data;
struct iwl4965_chain_noise_data chain_noise_data;
u8 start_calib;
__le16 sensitivity_tbl[HD_TABLE_SIZE];
#endif /*CONFIG_IWL4965_SENSITIVITY*/
......@@ -1171,7 +1169,7 @@ struct iwl_priv {
u8 last_phy_res[100];
/* Rate scaling data */
struct iwl_lq_mngr lq_mngr;
struct iwl4965_lq_mngr lq_mngr;
/* Rate scaling data */
s8 data_retry_limit;
......@@ -1182,10 +1180,10 @@ struct iwl_priv {
int activity_timer_active;
/* Rx and Tx DMA processing queues */
struct iwl_rx_queue rxq;
struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES];
struct iwl4965_rx_queue rxq;
struct iwl4965_tx_queue txq[IWL_MAX_NUM_QUEUES];
unsigned long txq_ctx_active_msk;
struct iwl_kw kw; /* keep warm address */
struct iwl4965_kw kw; /* keep warm address */
u32 scd_base_addr; /* scheduler sram base address */
unsigned long status;
......@@ -1194,9 +1192,9 @@ struct iwl_priv {
int last_rx_rssi; /* From Rx packet statisitics */
int last_rx_noise; /* From beacon statistics */
struct iwl_power_mgr power_data;
struct iwl4965_power_mgr power_data;
struct iwl_notif_statistics statistics;
struct iwl4965_notif_statistics statistics;
unsigned long last_statistics_time;
/* context information */
......@@ -1213,7 +1211,7 @@ struct iwl_priv {
/*station table variables */
spinlock_t sta_lock;
int num_stations;
struct iwl_station_entry stations[IWL_STATION_COUNT];
struct iwl4965_station_entry stations[IWL_STATION_COUNT];
/* Indication if ieee80211_ops->open has been called */
int is_open;
......@@ -1234,7 +1232,7 @@ struct iwl_priv {
struct list_head ibss_mac_hash[IWL_IBSS_MAC_HASH_SIZE];
/* eeprom */
struct iwl_eeprom eeprom;
struct iwl4965_eeprom eeprom;
int iw_mode;
......@@ -1244,7 +1242,7 @@ struct iwl_priv {
u32 timestamp0;
u32 timestamp1;
u16 beacon_int;
struct iwl_driver_hw_info hw_setting;
struct iwl4965_driver_hw_info hw_setting;
int interface_id;
/* Current association information needed to configure the
......@@ -1254,7 +1252,7 @@ struct iwl_priv {
u8 ps_mode;
#ifdef CONFIG_IWL4965_QOS
struct iwl_qos_info qos_data;
struct iwl4965_qos_info qos_data;
#endif /*CONFIG_IWL4965_QOS */
struct workqueue_struct *workqueue;
......@@ -1306,55 +1304,55 @@ struct iwl_priv {
#ifdef CONFIG_IWL4965_HT_AGG
struct work_struct agg_work;
#endif
}; /*iwl_priv */
}; /*iwl4965_priv */
static inline int iwl_is_associated(struct iwl_priv *priv)
static inline int iwl4965_is_associated(struct iwl4965_priv *priv)
{
return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
}
static inline int is_channel_valid(const struct iwl_channel_info *ch_info)
static inline int is_channel_valid(const struct iwl4965_channel_info *ch_info)
{
if (ch_info == NULL)
return 0;
return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0;
}
static inline int is_channel_narrow(const struct iwl_channel_info *ch_info)
static inline int is_channel_narrow(const struct iwl4965_channel_info *ch_info)
{
return (ch_info->flags & EEPROM_CHANNEL_NARROW) ? 1 : 0;
}
static inline int is_channel_radar(const struct iwl_channel_info *ch_info)
static inline int is_channel_radar(const struct iwl4965_channel_info *ch_info)
{
return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0;
}
static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info)
static inline u8 is_channel_a_band(const struct iwl4965_channel_info *ch_info)
{
return ch_info->phymode == MODE_IEEE80211A;
}
static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info)
static inline u8 is_channel_bg_band(const struct iwl4965_channel_info *ch_info)
{
return ((ch_info->phymode == MODE_IEEE80211B) ||
(ch_info->phymode == MODE_IEEE80211G));
}
static inline int is_channel_passive(const struct iwl_channel_info *ch)
static inline int is_channel_passive(const struct iwl4965_channel_info *ch)
{
return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0;
}
static inline int is_channel_ibss(const struct iwl_channel_info *ch)
static inline int is_channel_ibss(const struct iwl4965_channel_info *ch)
{
return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
}
extern const struct iwl_channel_info *iwl_get_channel_info(
const struct iwl_priv *priv, int phymode, u16 channel);
extern const struct iwl4965_channel_info *iwl4965_get_channel_info(
const struct iwl4965_priv *priv, int phymode, u16 channel);
/* Requires full declaration of iwl_priv before including */
/* Requires full declaration of iwl4965_priv before including */
#include "iwl-4965-io.h"
#endif /* __iwl_4965_h__ */
#endif /* __iwl4965_4965_h__ */
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment