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

iwlwifi: keep 3945 and 4965 headers separate

The iwl3945 and iwl4965 devices share some common structure, but with a
lot of difference split all over.  Currently the two drivers share a lot
of headers and use ugly preprocessor magic to manage the difference.

This patch keeps two entirely separate copies of the headers to get rid
of these hacks an ease future development.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarZhu Yi <yi.zhu@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 416e1438
This diff is collapsed.
This diff is collapsed.
......@@ -31,7 +31,7 @@
#include <linux/io.h>
#include "iwl-debug.h"
#include "iwl-3945-debug.h"
/*
* IO, register, and NIC memory access functions
......
......@@ -37,11 +37,9 @@
#include <linux/workqueue.h>
#define IWL 3945
#include "../net/mac80211/ieee80211_rate.h"
#include "iwlwifi.h"
#include "iwl-3945.h"
#define RS_NAME "iwl-3945-rs"
......
......@@ -39,11 +39,8 @@
#include <linux/etherdevice.h>
#define IWL 3945
#include "iwlwifi.h"
#include "iwl-helpers.h"
#include "iwl-3945.h"
#include "iwl-helpers.h"
#include "iwl-3945-rs.h"
#define IWL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \
......
This diff is collapsed.
......@@ -80,9 +80,6 @@ enum {
REPLY_REMOVE_ALL_STA = 0x1a, /* not used */
/* RX, TX, LEDs */
#if IWL == 3945
REPLY_3945_RX = 0x1b, /* 3945 only */
#endif
REPLY_TX = 0x1c,
REPLY_RATE_SCALE = 0x47, /* 3945 only */
REPLY_LEDS_CMD = 0x48,
......@@ -132,7 +129,6 @@ enum {
/* Missed beacons notification */
MISSED_BEACONS_NOTIFICATION = 0xa2,
#if IWL == 4965
REPLY_CT_KILL_CONFIG_CMD = 0xa4,
SENSITIVITY_CMD = 0xa8,
REPLY_PHY_CALIBRATION_CMD = 0xb0,
......@@ -140,7 +136,6 @@ enum {
REPLY_RX_MPDU_CMD = 0xc1,
REPLY_4965_RX = 0xc3,
REPLY_COMPRESSED_BA = 0xc5,
#endif
REPLY_MAX = 0xff
};
......@@ -211,7 +206,6 @@ struct iwl_init_alive_resp {
__le32 timestamp;
__le32 is_valid;
#if IWL == 4965
/* calibration values from "initialize" uCode */
__le32 voltage; /* signed */
__le32 therm_r1[2]; /* signed 1st for normal, 2nd for FAT channel */
......@@ -220,7 +214,6 @@ struct iwl_init_alive_resp {
__le32 therm_r4[2]; /* signed */
__le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups,
* 2 Tx chains */
#endif
} __attribute__ ((packed));
union tsf {
......@@ -237,9 +230,6 @@ struct iwl_error_resp {
u8 cmd_id;
u8 reserved1;
__le16 bad_cmd_seq_num;
#if IWL == 3945
__le16 reserved2;
#endif
__le32 error_info;
union tsf timestamp;
} __attribute__ ((packed));
......@@ -312,23 +302,15 @@ struct iwl_rxon_cmd {
__le16 reserved3;
u8 dev_type;
u8 air_propagation;
#if IWL == 3945
__le16 reserved4;
#elif IWL == 4965
__le16 rx_chain;
#endif
u8 ofdm_basic_rates;
u8 cck_basic_rates;
__le16 assoc_id;
__le32 flags;
__le32 filter_flags;
__le16 channel;
#if IWL == 3945
__le16 reserved5;
#elif IWL == 4965
u8 ofdm_ht_single_stream_basic_rates;
u8 ofdm_ht_dual_stream_basic_rates;
#endif
} __attribute__ ((packed));
/*
......@@ -339,11 +321,9 @@ struct iwl_rxon_assoc_cmd {
__le32 filter_flags;
u8 ofdm_basic_rates;
u8 cck_basic_rates;
#if IWL == 4965
u8 ofdm_ht_single_stream_basic_rates;
u8 ofdm_ht_dual_stream_basic_rates;
__le16 rx_chain_select_flags;
#endif
__le16 reserved;
} __attribute__ ((packed));
......@@ -364,14 +344,6 @@ struct iwl_tx_power {
u8 dsp_atten; /* gain for DSP */
} __attribute__ ((packed));
#if IWL == 3945
struct iwl_power_per_rate {
u8 rate; /* plcp */
struct iwl_tx_power tpc;
u8 reserved;
} __attribute__ ((packed));
#elif IWL == 4965
#define POWER_TABLE_NUM_ENTRIES 33
#define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32
#define POWER_TABLE_CCK_ENTRY 32
......@@ -382,7 +354,6 @@ struct tx_power_dual_stream {
struct iwl_tx_power_db {
struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
} __attribute__ ((packed));
#endif
/*
* REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
......@@ -394,11 +365,7 @@ struct iwl_channel_switch_cmd {
__le32 rxon_flags;
__le32 rxon_filter_flags;
__le32 switch_time;
#if IWL == 3945
struct iwl_power_per_rate power[IWL_MAX_RATES];
#elif IWL == 4965
struct iwl_tx_power_db tx_power;
#endif
} __attribute__ ((packed));
/*
......@@ -463,9 +430,6 @@ struct iwl_qosparam_cmd {
#define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
#define IWL_INVALID_STATION 255
#if IWL == 3945
#define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1<<2);
#endif
#define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8);
#define STA_CONTROL_MODIFY_MSK 0x01
......@@ -528,17 +492,11 @@ struct iwl_addsta_cmd {
__le32 station_flags;
__le32 station_flags_msk;
__le16 tid_disable_tx;
#if IWL == 3945
__le16 rate_n_flags;
#else
__le16 reserved1;
#endif
u8 add_immediate_ba_tid;
u8 remove_immediate_ba_tid;
__le16 add_immediate_ba_ssn;
#if IWL == 4965
__le32 reserved2;
#endif
} __attribute__ ((packed));
/*
......@@ -721,47 +679,24 @@ struct iwl_tx_cmd {
__le16 len;
__le16 next_frame_len;
__le32 tx_flags;
#if IWL == 3945
u8 rate;
u8 sta_id;
u8 tid_tspec;
#elif IWL == 4965
struct iwl_dram_scratch scratch;
__le32 rate_n_flags;
u8 sta_id;
#endif
u8 sec_ctl;
#if IWL == 4965
u8 initial_rate_index;
u8 reserved;
#endif
u8 key[16];
#if IWL == 3945
union {
u8 byte[8];
__le16 word[4];
__le32 dw[2];
} tkip_mic;
__le32 next_frame_info;
#elif IWL == 4965
__le16 next_frame_flags;
__le16 reserved2;
#endif
union {
__le32 life_time;
__le32 attempt;
} stop_time;
#if IWL == 3945
u8 supp_rates[2];
#elif IWL == 4965
__le32 dram_lsb_ptr;
u8 dram_msb_ptr;
#endif
u8 rts_retry_limit; /*byte 50 */
u8 data_retry_limit; /*byte 51 */
#if IWL == 4965
u8 tid_tspec;
#endif
union {
__le16 pm_frame_timeout;
__le16 attempt_duration;
......@@ -872,7 +807,6 @@ enum {
/*
* REPLY_TX = 0x1c (response)
*/
#if IWL == 4965
struct iwl_tx_resp {
u8 frame_count; /* 1 no aggregation, >1 aggregation */
u8 bt_kill_count;
......@@ -886,17 +820,6 @@ struct iwl_tx_resp {
__le32 status; /* TX status (for aggregation status of 1st frame) */
} __attribute__ ((packed));
#elif IWL == 3945
struct iwl_tx_resp {
u8 failure_rts;
u8 failure_frame;
u8 bt_kill_count;
u8 rate;
__le32 wireless_media_time;
__le32 status; /* TX status (for aggregation status of 1st frame) */
} __attribute__ ((packed));
#endif
/*
* REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
*/
......@@ -920,43 +843,9 @@ struct iwl_txpowertable_cmd {
u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
u8 reserved;
__le16 channel;
#if IWL == 3945
struct iwl_power_per_rate power[IWL_MAX_RATES];
#elif IWL == 4965
struct iwl_tx_power_db tx_power;
#endif
} __attribute__ ((packed));
#if IWL == 3945
struct iwl_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
*
* REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
*
* NOTE: The table of rates passed to the uCode via the
* RATE_SCALE command sets up the corresponding order of
* rates used for all related commands, including rate
* masks, etc.
*
* For example, if you set 9MB (PLCP 0x0f) as the first
* rate in the rate table, the bit mask for that rate
* when passed through ofdm_basic_rates on the REPLY_RXON
* command would be bit 0 (1<<0)
*/
struct iwl_rate_scaling_cmd {
u8 table_id;
u8 reserved[3];
struct iwl_rate_scaling_info table[IWL_MAX_RATES];
} __attribute__ ((packed));
#elif IWL == 4965
/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1<<0)
......@@ -996,7 +885,6 @@ struct iwl_link_quality_cmd {
} rs_table[LINK_QUAL_MAX_RETRY_NUM];
__le32 reserved2;
} __attribute__ ((packed));
#endif
/*
* REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
......@@ -1166,21 +1054,6 @@ struct iwl_spectrum_notification {
*/
#define IWL_POWER_VEC_SIZE 5
#if IWL == 3945
#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 {
__le32 flags;
__le32 rx_data_timeout;
__le32 tx_data_timeout;
__le32 sleep_interval[IWL_POWER_VEC_SIZE];
} __attribute__((packed));
#elif IWL == 4965
#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le16(1<<0)
#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)
......@@ -1194,7 +1067,6 @@ struct iwl_powertable_cmd {
__le32 sleep_interval[IWL_POWER_VEC_SIZE];
__le32 keep_alive_beacons;
} __attribute__ ((packed));
#endif
/*
* PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
......@@ -1294,11 +1166,7 @@ struct iwl_scan_cmd {
* (active scan) */
__le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
__le16 good_CRC_th; /* passive -> active promotion threshold */
#if IWL == 3945
__le16 reserved1;
#elif IWL == 4965
__le16 rx_chain;
#endif
__le32 max_out_time; /* max usec to be out of associated (service)
* chnl */
__le32 suspend_time; /* pause scan this long when returning to svc
......@@ -1450,16 +1318,13 @@ struct statistics_rx_phy {
__le32 rxe_frame_limit_overrun;
__le32 sent_ack_cnt;
__le32 sent_cts_cnt;
#if IWL == 4965
__le32 sent_ba_rsp_cnt;
__le32 dsp_self_kill;
__le32 mh_format_err;
__le32 re_acq_main_rssi_sum;
__le32 reserved3;
#endif
} __attribute__ ((packed));
#if IWL == 4965
struct statistics_rx_ht_phy {
__le32 plcp_err;
__le32 overrun_err;
......@@ -1472,7 +1337,6 @@ struct statistics_rx_ht_phy {
__le32 agg_cnt;
__le32 reserved2;
} __attribute__ ((packed));
#endif
struct statistics_rx_non_phy {
__le32 bogus_cts; /* CTS received when not expecting CTS */
......@@ -1483,7 +1347,6 @@ struct statistics_rx_non_phy {
* filtering process */
__le32 non_channel_beacons; /* beacons with our bss id but not on
* our serving channel */
#if IWL == 4965
__le32 channel_beacons; /* beacons with our bss id and in our
* serving channel */
__le32 num_missed_bcon; /* number of missed beacons */
......@@ -1506,19 +1369,15 @@ struct statistics_rx_non_phy {
__le32 beacon_energy_a;
__le32 beacon_energy_b;
__le32 beacon_energy_c;
#endif
} __attribute__ ((packed));
struct statistics_rx {
struct statistics_rx_phy ofdm;
struct statistics_rx_phy cck;
struct statistics_rx_non_phy general;
#if IWL == 4965
struct statistics_rx_ht_phy ofdm_ht;
#endif
} __attribute__ ((packed));
#if IWL == 4965
struct statistics_tx_non_phy_agg {
__le32 ba_timeout;
__le32 ba_reschedule_frames;
......@@ -1533,7 +1392,6 @@ struct statistics_tx_non_phy_agg {
__le32 reserved2;
__le32 reserved3;
} __attribute__ ((packed));
#endif
struct statistics_tx {
__le32 preamble_cnt;
......@@ -1545,14 +1403,12 @@ struct statistics_tx {
__le32 ack_timeout;
__le32 expected_ack_cnt;
__le32 actual_ack_cnt;
#if IWL == 4965
__le32 dump_msdu_cnt;
__le32 burst_abort_next_frame_mismatch_cnt;
__le32 burst_abort_missing_next_frame_cnt;
__le32 cts_timeout_collision;
__le32 ack_or_ba_timeout_collision;
struct statistics_tx_non_phy_agg agg;
#endif
} __attribute__ ((packed));
struct statistics_dbg {
......@@ -1566,29 +1422,23 @@ struct statistics_div {
__le32 tx_on_b;
__le32 exec_time;
__le32 probe_time;
#if IWL == 4965
__le32 reserved1;
__le32 reserved2;
#endif
} __attribute__ ((packed));
struct statistics_general {
__le32 temperature;
#if IWL == 4965
__le32 temperature_m;
#endif
struct statistics_dbg dbg;
__le32 sleep_time;
__le32 slots_out;
__le32 slots_idle;
__le32 ttl_timestamp;
struct statistics_div div;
#if IWL == 4965
__le32 rx_enable_counter;
__le32 reserved1;
__le32 reserved2;
__le32 reserved3;
#endif
} __attribute__ ((packed));
/*
......@@ -1720,10 +1570,8 @@ struct iwl_rx_packet {
struct iwl_sleep_notification sleep_notif;
struct iwl_spectrum_resp spectrum;
struct iwl_notif_statistics stats;
#if IWL == 4965
struct iwl_compressed_ba_resp compressed_ba;
struct iwl_missed_beacon_notif missed_beacon;
#endif
__le32 status;
u8 raw[0];
} u;
......
/******************************************************************************
*
* Copyright(c) 2003 - 2007 Intel Corporation. All rights reserved.
*
* Portions of this file are derived from the ipw3945 project.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* James P. Ketrenos <ipw2100-admin@linux.intel.com>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*
*****************************************************************************/
#ifndef __iwl_debug_h__
#define __iwl_debug_h__
#ifdef CONFIG_IWLWIFI_DEBUG
extern u32 iwl_debug_level;
#define IWL_DEBUG(level, fmt, args...) \
do { if (iwl_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()) \
printk(KERN_ERR DRV_NAME": %c %s " fmt, \
in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
#else
static inline void IWL_DEBUG(int level, const char *fmt, ...)
{
}
static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...)
{
}
#endif /* CONFIG_IWLWIFI_DEBUG */
/*
* To use the debug system;
*
* If you are defining a new debug classification, simply add it to the #define
* list here in the form of:
*
* #define IWL_DL_xxxx VALUE
*
* shifting value to the left one bit from the previous entry. xxxx should be
* the name of the classification (for example, WEP)
*
* You then need to either add a IWL_xxxx_DEBUG() macro definition for your
* classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want
* to send output to that classification.
*
* To add your debug level to the list of levels seen when you perform
*
* % cat /proc/net/iwl/debug_level
*
* you simply need to add your entry to the iwl_debug_levels array.
*
* If you do not see debug_level in /proc/net/iwl then you do not have
* CONFIG_IWLWIFI_DEBUG defined in your kernel configuration
*
*/
#define IWL_DL_INFO (1<<0)
#define IWL_DL_MAC80211 (1<<1)
#define IWL_DL_HOST_COMMAND (1<<2)
#define IWL_DL_STATE (1<<3)
#define IWL_DL_RADIO (1<<7)
#define IWL_DL_POWER (1<<8)
#define IWL_DL_TEMP (1<<9)
#define IWL_DL_NOTIF (1<<10)
#define IWL_DL_SCAN (1<<11)
#define IWL_DL_ASSOC (1<<12)
#define IWL_DL_DROP (1<<13)
#define IWL_DL_TXPOWER (1<<14)
#define IWL_DL_AP (1<<15)
#define IWL_DL_FW (1<<16)
#define IWL_DL_RF_KILL (1<<17)
#define IWL_DL_FW_ERRORS (1<<18)
#define IWL_DL_LED (1<<19)
#define IWL_DL_RATE (1<<20)
#define IWL_DL_CALIB (1<<21)
#define IWL_DL_WEP (1<<22)
#define IWL_DL_TX (1<<23)
#define IWL_DL_RX (1<<24)
#define IWL_DL_ISR (1<<25)
#define IWL_DL_HT (1<<26)
#define IWL_DL_IO (1<<27)
#define IWL_DL_11H (1<<28)
#define IWL_DL_STATS (1<<29)
#define IWL_DL_TX_REPLY (1<<30)
#define IWL_DL_QOS (1<<31)
#define IWL_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a)
#define IWL_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a)
#define IWL_DEBUG_INFO(f, a...) IWL_DEBUG(IWL_DL_INFO, f, ## a)
#define IWL_DEBUG_MAC80211(f, a...) IWL_DEBUG(IWL_DL_MAC80211, f, ## a)
#define IWL_DEBUG_TEMP(f, a...) IWL_DEBUG(IWL_DL_TEMP, f, ## a)
#define IWL_DEBUG_SCAN(f, a...) IWL_DEBUG(IWL_DL_SCAN, f, ## a)
#define IWL_DEBUG_RX(f, a...) IWL_DEBUG(IWL_DL_RX, f, ## a)
#define IWL_DEBUG_TX(f, a...) IWL_DEBUG(IWL_DL_TX, f, ## a)
#define IWL_DEBUG_ISR(f, a...) IWL_DEBUG(IWL_DL_ISR, f, ## a)
#define IWL_DEBUG_LED(f, a...) IWL_DEBUG(IWL_DL_LED, f, ## a)
#define IWL_DEBUG_WEP(f, a...) IWL_DEBUG(IWL_DL_WEP, f, ## a)
#define IWL_DEBUG_HC(f, a...) IWL_DEBUG(IWL_DL_HOST_COMMAND, f, ## a)
#define IWL_DEBUG_CALIB(f, a...) IWL_DEBUG(IWL_DL_CALIB, f, ## a)
#define IWL_DEBUG_FW(f, a...) IWL_DEBUG(IWL_DL_FW, f, ## a)
#define IWL_DEBUG_RF_KILL(f, a...) IWL_DEBUG(IWL_DL_RF_KILL, f, ## a)
#define IWL_DEBUG_DROP(f, a...) IWL_DEBUG(IWL_DL_DROP, f, ## a)
#define IWL_DEBUG_DROP_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_DROP, f, ## a)
#define IWL_DEBUG_AP(f, a...) IWL_DEBUG(IWL_DL_AP, f, ## a)
#define IWL_DEBUG_TXPOWER(f, a...) IWL_DEBUG(IWL_DL_TXPOWER, f, ## a)
#define IWL_DEBUG_IO(f, a...) IWL_DEBUG(IWL_DL_IO, f, ## a)
#define IWL_DEBUG_RATE(f, a...) IWL_DEBUG(IWL_DL_RATE, f, ## a)
#define IWL_DEBUG_RATE_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_RATE, f, ## a)
#define IWL_DEBUG_NOTIF(f, a...) IWL_DEBUG(IWL_DL_NOTIF, f, ## a)
#define IWL_DEBUG_ASSOC(f, a...) IWL_DEBUG(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a)
#define IWL_DEBUG_ASSOC_LIMIT(f, a...) \
IWL_DEBUG_LIMIT(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a)
#define IWL_DEBUG_HT(f, a...) IWL_DEBUG(IWL_DL_HT, f, ## a)
#define IWL_DEBUG_STATS(f, a...) IWL_DEBUG(IWL_DL_STATS, f, ## a)
#define IWL_DEBUG_TX_REPLY(f, a...) IWL_DEBUG(IWL_DL_TX_REPLY, f, ## a)
#define IWL_DEBUG_QOS(f, a...) IWL_DEBUG(IWL_DL_QOS, f, ## a)
#define IWL_DEBUG_RADIO(f, a...) IWL_DEBUG(IWL_DL_RADIO, f, ## a)
#define IWL_DEBUG_POWER(f, a...) IWL_DEBUG(IWL_DL_POWER, f, ## a)
#define IWL_DEBUG_11H(f, a...) IWL_DEBUG(IWL_DL_11H, f, ## a)
#endif
This diff is collapsed.
/******************************************************************************
*
* Copyright(c) 2003 - 2007 Intel Corporation. All rights reserved.
*