提交 f89e6e38 编写于 作者: D David S. Miller
......@@ -87,7 +87,7 @@ static inline int wpa2_capable(void)
static inline int precise_ie(void)
{
return 0; /* FIXME */
return (0 <= ps3_compare_firmware_version(2, 2, 0));
}
/*
* post_eurus_cmd helpers
......
b43-y += main.o
b43-y += tables.o
b43-y += tables_nphy.o
b43-$(CONFIG_B43_NPHY) += tables_nphy.o
b43-y += phy.o
b43-y += nphy.o
b43-$(CONFIG_B43_NPHY) += nphy.o
b43-y += sysfs.o
b43-y += xmit.o
b43-y += lo.o
......
......@@ -919,6 +919,10 @@
struct b43_wldev;
#ifdef CONFIG_B43_NPHY
/* N-PHY support enabled */
int b43_phy_initn(struct b43_wldev *dev);
void b43_nphy_radio_turn_on(struct b43_wldev *dev);
......@@ -929,4 +933,40 @@ int b43_nphy_selectchannel(struct b43_wldev *dev, u8 channel);
void b43_nphy_xmitpower(struct b43_wldev *dev);
void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna);
#else /* CONFIG_B43_NPHY */
/* N-PHY support disabled */
static inline
int b43_phy_initn(struct b43_wldev *dev)
{
return -EOPNOTSUPP;
}
static inline
void b43_nphy_radio_turn_on(struct b43_wldev *dev)
{
}
static inline
void b43_nphy_radio_turn_off(struct b43_wldev *dev)
{
}
static inline
int b43_nphy_selectchannel(struct b43_wldev *dev, u8 channel)
{
return -ENOSYS;
}
static inline
void b43_nphy_xmitpower(struct b43_wldev *dev)
{
}
static inline
void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna)
{
}
#endif /* CONFIG_B43_NPHY */
#endif /* B43_NPHY_H_ */
......@@ -4495,9 +4495,9 @@ static void ipw_rx_notification(struct ipw_priv *priv,
priv->
essid_len),
print_mac(mac, priv->bssid),
ntohs(auth->status),
le16_to_cpu(auth->status),
ipw_get_status_code
(ntohs
(le16_to_cpu
(auth->status)));
priv->status &=
......@@ -4532,9 +4532,9 @@ static void ipw_rx_notification(struct ipw_priv *priv,
IPW_DL_STATE |
IPW_DL_ASSOC,
"association failed (0x%04X): %s\n",
ntohs(resp->status),
le16_to_cpu(resp->status),
ipw_get_status_code
(ntohs
(le16_to_cpu
(resp->status)));
}
......@@ -4591,8 +4591,8 @@ static void ipw_rx_notification(struct ipw_priv *priv,
IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE |
IPW_DL_ASSOC,
"authentication failed (0x%04X): %s\n",
ntohs(auth->status),
ipw_get_status_code(ntohs
le16_to_cpu(auth->status),
ipw_get_status_code(le16_to_cpu
(auth->
status)));
}
......
......@@ -385,73 +385,73 @@ struct clx2_queue {
dma_addr_t dma_addr; /**< physical addr for BD's */
int low_mark; /**< low watermark, resume queue if free space more than this */
int high_mark; /**< high watermark, stop queue if free space less than this */
} __attribute__ ((packed));
} __attribute__ ((packed)); /* XXX */
struct machdr32 {
__le16 frame_ctl;
u16 duration; // watch out for endians!
__le16 duration; // watch out for endians!
u8 addr1[MACADRR_BYTE_LEN];
u8 addr2[MACADRR_BYTE_LEN];
u8 addr3[MACADRR_BYTE_LEN];
u16 seq_ctrl; // more endians!
__le16 seq_ctrl; // more endians!
u8 addr4[MACADRR_BYTE_LEN];
__le16 qos_ctrl;
} __attribute__ ((packed));
struct machdr30 {
__le16 frame_ctl;
u16 duration; // watch out for endians!
__le16 duration; // watch out for endians!
u8 addr1[MACADRR_BYTE_LEN];
u8 addr2[MACADRR_BYTE_LEN];
u8 addr3[MACADRR_BYTE_LEN];
u16 seq_ctrl; // more endians!
__le16 seq_ctrl; // more endians!
u8 addr4[MACADRR_BYTE_LEN];
} __attribute__ ((packed));
struct machdr26 {
__le16 frame_ctl;
u16 duration; // watch out for endians!
__le16 duration; // watch out for endians!
u8 addr1[MACADRR_BYTE_LEN];
u8 addr2[MACADRR_BYTE_LEN];
u8 addr3[MACADRR_BYTE_LEN];
u16 seq_ctrl; // more endians!
__le16 seq_ctrl; // more endians!
__le16 qos_ctrl;
} __attribute__ ((packed));
struct machdr24 {
__le16 frame_ctl;
u16 duration; // watch out for endians!
__le16 duration; // watch out for endians!
u8 addr1[MACADRR_BYTE_LEN];
u8 addr2[MACADRR_BYTE_LEN];
u8 addr3[MACADRR_BYTE_LEN];
u16 seq_ctrl; // more endians!
__le16 seq_ctrl; // more endians!
} __attribute__ ((packed));
// TX TFD with 32 byte MAC Header
struct tx_tfd_32 {
struct machdr32 mchdr; // 32
u32 uivplaceholder[2]; // 8
__le32 uivplaceholder[2]; // 8
} __attribute__ ((packed));
// TX TFD with 30 byte MAC Header
struct tx_tfd_30 {
struct machdr30 mchdr; // 30
u8 reserved[2]; // 2
u32 uivplaceholder[2]; // 8
__le32 uivplaceholder[2]; // 8
} __attribute__ ((packed));
// tx tfd with 26 byte mac header
struct tx_tfd_26 {
struct machdr26 mchdr; // 26
u8 reserved1[2]; // 2
u32 uivplaceholder[2]; // 8
__le32 uivplaceholder[2]; // 8
u8 reserved2[4]; // 4
} __attribute__ ((packed));
// tx tfd with 24 byte mac header
struct tx_tfd_24 {
struct machdr24 mchdr; // 24
u32 uivplaceholder[2]; // 8
__le32 uivplaceholder[2]; // 8
u8 reserved[8]; // 8
} __attribute__ ((packed));
......@@ -460,7 +460,7 @@ struct tx_tfd_24 {
struct tfd_command {
u8 index;
u8 length;
u16 reserved;
__le16 reserved;
u8 payload[0];
} __attribute__ ((packed));
......@@ -562,27 +562,27 @@ struct rate_histogram {
struct ipw_cmd_stats {
u8 cmd_id;
u8 seq_num;
u16 good_sfd;
u16 bad_plcp;
u16 wrong_bssid;
u16 valid_mpdu;
u16 bad_mac_header;
u16 reserved_frame_types;
u16 rx_ina;
u16 bad_crc32;
u16 invalid_cts;
u16 invalid_acks;
u16 long_distance_ina_fina;
u16 dsp_silence_unreachable;
u16 accumulated_rssi;
u16 rx_ovfl_frame_tossed;
u16 rssi_silence_threshold;
u16 rx_ovfl_frame_supplied;
u16 last_rx_frame_signal;
u16 last_rx_frame_noise;
u16 rx_autodetec_no_ofdm;
u16 rx_autodetec_no_barker;
u16 reserved;
__le16 good_sfd;
__le16 bad_plcp;
__le16 wrong_bssid;
__le16 valid_mpdu;
__le16 bad_mac_header;
__le16 reserved_frame_types;
__le16 rx_ina;
__le16 bad_crc32;
__le16 invalid_cts;
__le16 invalid_acks;
__le16 long_distance_ina_fina;
__le16 dsp_silence_unreachable;
__le16 accumulated_rssi;
__le16 rx_ovfl_frame_tossed;
__le16 rssi_silence_threshold;
__le16 rx_ovfl_frame_supplied;
__le16 last_rx_frame_signal;
__le16 last_rx_frame_noise;
__le16 rx_autodetec_no_ofdm;
__le16 rx_autodetec_no_barker;
__le16 reserved;
} __attribute__ ((packed));
struct notif_channel_result {
......@@ -637,7 +637,7 @@ struct notif_association {
struct notif_authenticate {
u8 state;
struct machdr24 addr;
u16 status;
__le16 status;
} __attribute__ ((packed));
struct notif_calibration {
......@@ -732,14 +732,14 @@ struct ipw_rx_queue {
struct alive_command_responce {
u8 alive_command;
u8 sequence_number;
u16 software_revision;
__le16 software_revision;
u8 device_identifier;
u8 reserved1[5];
u16 reserved2;
u16 reserved3;
u16 clock_settle_time;
u16 powerup_settle_time;
u16 reserved4;
__le16 reserved2;
__le16 reserved3;
__le16 clock_settle_time;
__le16 powerup_settle_time;
__le16 reserved4;
u8 time_stamp[5]; /* month, day, year, hours, minutes */
u8 ucode_valid;
} __attribute__ ((packed));
......@@ -878,7 +878,11 @@ static inline void ipw_set_scan_type(struct ipw_scan_request_ext *scan,
struct ipw_associate {
u8 channel;
#ifdef __LITTLE_ENDIAN_BITFIELD
u8 auth_type:4, auth_key:4;
#else
u8 auth_key:4, auth_type:4;
#endif
u8 assoc_type;
u8 reserved;
__le16 policy_support;
......@@ -918,12 +922,12 @@ struct ipw_frag_threshold {
struct ipw_retry_limit {
u8 short_retry_limit;
u8 long_retry_limit;
u16 reserved;
__le16 reserved;
} __attribute__ ((packed));
struct ipw_dino_config {
u32 dino_config_addr;
u16 dino_config_size;
__le32 dino_config_addr;
__le16 dino_config_size;
u8 dino_response;
u8 reserved;
} __attribute__ ((packed));
......@@ -998,7 +1002,7 @@ struct ipw_sensitivity_calib {
* - \a status contains status;
* - \a param filled with status parameters.
*/
struct ipw_cmd {
struct ipw_cmd { /* XXX */
u32 cmd; /**< Host command */
u32 status;/**< Status */
u32 status_len;
......@@ -1092,7 +1096,7 @@ struct ipw_ibss_seq {
struct list_head list;
};
struct ipw_error_elem {
struct ipw_error_elem { /* XXX */
u32 desc;
u32 time;
u32 blink1;
......@@ -1102,13 +1106,13 @@ struct ipw_error_elem {
u32 data;
};
struct ipw_event {
struct ipw_event { /* XXX */
u32 event;
u32 time;
u32 data;
} __attribute__ ((packed));
struct ipw_fw_error {
struct ipw_fw_error { /* XXX */
unsigned long jiffies;
u32 status;
u32 config;
......@@ -1153,7 +1157,7 @@ struct ipw_prom_priv {
*/
struct ipw_rt_hdr {
struct ieee80211_radiotap_header rt_hdr;
u64 rt_tsf; /* TSF */
u64 rt_tsf; /* TSF */ /* XXX */
u8 rt_flags; /* radiotap packet flags */
u8 rt_rate; /* rate in 500kb/s */
__le16 rt_channel; /* channel in mhz */
......@@ -1940,8 +1944,8 @@ enum {
#define IPW_MEM_FIXED_OVERRIDE (IPW_SHARED_LOWER_BOUND + 0x41C)
struct ipw_fixed_rate {
u16 tx_rates;
u16 reserved;
__le16 tx_rates;
__le16 reserved;
} __attribute__ ((packed));
#define IPW_INDIRECT_ADDR_MASK (~0x3ul)
......@@ -1951,12 +1955,12 @@ struct host_cmd {
u8 len;
u16 reserved;
u32 *param;
} __attribute__ ((packed));
} __attribute__ ((packed)); /* XXX */
struct cmdlog_host_cmd {
u8 cmd;
u8 len;
u16 reserved;
__le16 reserved;
char param[124];
} __attribute__ ((packed));
......
......@@ -50,7 +50,7 @@ config IWL4965_SENSITIVITY
This option will enable sensitivity calibration for the iwl4965
driver.
config IWL4965_DEBUG
config IWLWIFI_DEBUG
bool "Enable full debugging output in iwl4965 driver"
depends on IWL4965
---help---
......@@ -76,6 +76,12 @@ config IWL4965_DEBUG
as the debug information can assist others in helping you resolve
any problems you may encounter.
config IWLWIFI_DEBUGFS
bool "Iwlwifi debugfs support"
depends on IWLCORE && IWLWIFI_DEBUG && MAC80211_DEBUGFS
---help---
Enable creation of debugfs files for the iwlwifi drivers.
config IWL3945
tristate "Intel PRO/Wireless 3945ABG/BG Network Connection"
depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
......
obj-$(CONFIG_IWLCORE) += iwlcore.o
iwlcore-objs = iwl-core.o iwl-eeprom.o
iwlcore-objs = iwl-core.o iwl-eeprom.o iwl-hcmd.o
ifeq ($(CONFIG_IWLWIFI_DEBUGFS),y)
iwlcore-objs += iwl-debugfs.o
endif
obj-$(CONFIG_IWL3945) += iwl3945.o
iwl3945-objs = iwl3945-base.o iwl-3945.o iwl-3945-rs.o
......
......@@ -707,45 +707,6 @@ struct iwl3945_rx_frame {
struct iwl3945_rx_frame_end end;
} __attribute__ ((packed));
/* Fixed (non-configurable) rx data from phy */
#define RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
#define RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
#define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
#define IWL_AGC_DB_POS (7)
struct iwl4965_rx_non_cfg_phy {
__le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
__le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
u8 pad[0];
} __attribute__ ((packed));
/*
* REPLY_4965_RX = 0xc3 (response only, not a command)
* Used only for legacy (non 11n) frames.
*/
#define RX_RES_PHY_CNT 14
struct iwl4965_rx_phy_res {
u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
u8 stat_id; /* configurable DSP phy data set ID */
u8 reserved1;
__le64 timestamp; /* TSF at on air rise */
__le32 beacon_time_stamp; /* beacon at on-air rise */
__le16 phy_flags; /* general phy flags: band, modulation, ... */
__le16 channel; /* channel number */
__le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */
__le32 reserved2;
__le32 rate_n_flags;
__le16 byte_count; /* frame's byte-count */
__le16 reserved3;
} __attribute__ ((packed));
struct iwl4965_rx_mpdu_res_start {
__le16 byte_count;
__le16 reserved;
} __attribute__ ((packed));
/******************************************************************************
* (5)
* Tx Commands & Responses:
......
......@@ -198,43 +198,27 @@ struct iwl3945_eeprom_temperature_corr {
*/
struct iwl3945_eeprom {
u8 reserved0[16];
#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */
u16 device_id; /* abs.ofs: 16 */
u8 reserved1[2];
#define EEPROM_PMC (2*0x0A) /* 2 bytes */
u16 pmc; /* abs.ofs: 20 */
u8 reserved2[20];
#define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */
u8 mac_address[6]; /* abs.ofs: 42 */
u8 reserved3[58];
#define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */
u16 board_revision; /* abs.ofs: 106 */
u8 reserved4[11];
#define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */
u8 board_pba_number[9]; /* abs.ofs: 119 */
u8 reserved5[8];
#define EEPROM_VERSION (2*0x44) /* 2 bytes */
u16 version; /* abs.ofs: 136 */
#define EEPROM_SKU_CAP (2*0x45) /* 1 bytes */
u8 sku_cap; /* abs.ofs: 138 */
#define EEPROM_LEDS_MODE (2*0x45+1) /* 1 bytes */
u8 leds_mode; /* abs.ofs: 139 */
#define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */
u16 oem_mode;
#define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */
u16 wowlan_mode; /* abs.ofs: 142 */
#define EEPROM_LEDS_TIME_INTERVAL (2*0x48) /* 2 bytes */
u16 leds_time_interval; /* abs.ofs: 144 */
#define EEPROM_LEDS_OFF_TIME (2*0x49) /* 1 bytes */
u8 leds_off_time; /* abs.ofs: 146 */
#define EEPROM_LEDS_ON_TIME (2*0x49+1) /* 1 bytes */
u8 leds_on_time; /* abs.ofs: 147 */
#define EEPROM_ALMGOR_M_VERSION (2*0x4A) /* 1 bytes */
u8 almgor_m_version; /* abs.ofs: 148 */
#define EEPROM_ANTENNA_SWITCH_TYPE (2*0x4A+1) /* 1 bytes */
u8 antenna_switch_type; /* abs.ofs: 149 */
u8 reserved6[42];
#define EEPROM_REGULATORY_SKU_ID (2*0x60) /* 4 bytes */
u8 sku_id[4]; /* abs.ofs: 192 */
/*
......@@ -249,9 +233,7 @@ struct iwl3945_eeprom {
*
* 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
*/
#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 iwl3945_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */
/*
......@@ -259,36 +241,28 @@ struct iwl3945_eeprom {
* 5.0 GHz channels 7, 8, 11, 12, 16
* (4915-5080MHz) (none of these is ever supported)
*/
#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 iwl3945_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
/*
* 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
* (5170-5320MHz)
*/
#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 iwl3945_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
/*
* 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
* (5500-5700MHz)
*/
#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 iwl3945_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
/*
* 5.7 GHz channels 145, 149, 153, 157, 161, 165
* (5725-5825MHz)
*/
#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 iwl3945_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
u8 reserved9[194];
......@@ -296,15 +270,9 @@ struct iwl3945_eeprom {
/*
* 3945 Txpower calibration data.
*/
#define EEPROM_TXPOWER_CALIB_GROUP0 0x200
#define EEPROM_TXPOWER_CALIB_GROUP1 0x240
#define EEPROM_TXPOWER_CALIB_GROUP2 0x280
#define EEPROM_TXPOWER_CALIB_GROUP3 0x2c0
#define EEPROM_TXPOWER_CALIB_GROUP4 0x300
#define IWL_NUM_TX_CALIB_GROUPS 5
struct iwl3945_eeprom_txpower_group groups[IWL_NUM_TX_CALIB_GROUPS];
/* abs.ofs: 512 */
#define EEPROM_CALIB_TEMPERATURE_CORRECT 0x340
struct iwl3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */
u8 reserved16[172]; /* fill out to full 1024 byte block */
} __attribute__ ((packed));
......
......@@ -139,7 +139,7 @@ enum {
REPLY_PHY_CALIBRATION_CMD = 0xb0,
REPLY_RX_PHY_CMD = 0xc0,
REPLY_RX_MPDU_CMD = 0xc1,
REPLY_4965_RX = 0xc3,
REPLY_RX = 0xc3,
REPLY_COMPRESSED_BA = 0xc5,
REPLY_MAX = 0xff
};
......@@ -151,16 +151,16 @@ enum {
*
*****************************************************************************/
/* iwl4965_cmd_header flags value */
/* iwl_cmd_header flags value */
#define IWL_CMD_FAILED_MSK 0x40
/**
* struct iwl4965_cmd_header
* struct iwl_cmd_header
*
* This header format appears in the beginning of each command sent from the
* driver, and each response/notification received from uCode.
*/
struct iwl4965_cmd_header {
struct iwl_cmd_header {
u8 cmd; /* Command ID: REPLY_RXON, etc. */
u8 flags; /* IWL_CMD_* */
/*
......@@ -194,7 +194,7 @@ struct iwl4965_cmd_header {
* 4965 rate_n_flags bit fields
*
* rate_n_flags format is used in following 4965 commands:
* REPLY_4965_RX (response only)
* REPLY_RX (response only)
* REPLY_TX (both command and response)
* REPLY_TX_LINK_QUALITY_CMD
*
......@@ -741,6 +741,7 @@ struct iwl4965_qosparam_cmd {
/* wep key in STA: 5-bytes (0) or 13-bytes (1) */
#define STA_KEY_FLG_KEY_SIZE_MSK __constant_cpu_to_le16(0x1000)
#define STA_KEY_MULTICAST_MSK __constant_cpu_to_le16(0x4000)
#define STA_KEY_MAX_NUM 8
/* Flags indicate whether to modify vs. don't change various station params */
#define STA_MODIFY_KEY_MASK 0x01
......@@ -889,6 +890,10 @@ struct iwl4965_rx_frame_hdr {
#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
#define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8)
#define RX_RES_STATUS_STATION_FOUND (1<<6)
#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7)
#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
......@@ -896,6 +901,11 @@ struct iwl4965_rx_frame_hdr {
#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
#define RX_MPDU_RES_STATUS_ICV_OK (0x20)
#define RX_MPDU_RES_STATUS_MIC_OK (0x40)
#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7)
#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800)
struct iwl4965_rx_frame_end {
__le32 status;
__le64 timestamp;
......@@ -929,7 +939,7 @@ struct iwl4965_rx_non_cfg_phy {
} __attribute__ ((packed));
/*
* REPLY_4965_RX = 0xc3 (response only, not a command)
* REPLY_RX = 0xc3 (response only, not a command)
* Used only for legacy (non 11n) frames.
*/
#define RX_RES_PHY_CNT 14
......@@ -1045,6 +1055,10 @@ struct iwl4965_rx_mpdu_res_start {
* MAC header) to DWORD boundary. */
#define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)
/* accelerate aggregation support
* 0 - no CCMP encryption; 1 - CCMP encryption */
#define TX_CMD_FLG_AGG_CCMP_MSK __constant_cpu_to_le32(1 << 22)
/* HCCA-AP - disable duration overwriting. */
#define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)
......@@ -2650,7 +2664,7 @@ struct iwl4965_led_cmd {
struct iwl4965_rx_packet {
__le32 len;
struct iwl4965_cmd_header hdr;
struct iwl_cmd_header hdr;
union {
struct iwl4965_alive_resp alive_frame;
struct iwl4965_rx_frame rx_frame;
......
......@@ -113,9 +113,6 @@
#define TFD_TX_CMD_SLOTS 256
#define TFD_CMD_SLOTS 32
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl4965_cmd) - \
sizeof(struct iwl4965_cmd_meta))
/*
* RX related structures and functions
*/
......
......@@ -31,7 +31,7 @@
#include <linux/io.h>
#include "iwl-4965-debug.h"
#include "iwl-debug.h"
/*
* IO, register, and NIC memory access functions
......@@ -60,8 +60,8 @@
*/
#define _iwl4965_write32(priv, ofs, val) writel((val), (priv)->hw_base + (ofs))
#ifdef CONFIG_IWL4965_DEBUG
static inline void __iwl4965_write32(const char *f, u32 l, struct iwl4965_priv *priv,
#ifdef CONFIG_IWLWIFI_DEBUG
static inline void __iwl4965_write32(const char *f, u32 l, struct iwl_priv *priv,
u32 ofs, u32 val)
{
IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l);
......@@ -74,8 +74,8 @@ static inline void __iwl4965_write32(const char *f, u32 l, struct iwl4965_priv *
#endif
#define _iwl4965_read32(priv, ofs) readl((priv)->hw_base + (ofs))
#ifdef CONFIG_IWL4965_DEBUG
static inline u32 __iwl4965_read32(char *f, u32 l, struct iwl4965_priv *priv, u32 ofs)
#ifdef CONFIG_IWLWIFI_DEBUG
static inline u32 __iwl4965_read32(char *f, u32 l, struct iwl_priv *priv, u32 ofs)
{
IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l);
return _iwl4965_read32(priv, ofs);
......@@ -85,7 +85,7 @@ static inline u32 __iwl4965_read32(char *f, u32 l, struct iwl4965_priv *priv, u3
#define iwl4965_read32(p, o) _iwl4965_read32(p, o)
#endif
static inline int _iwl4965_poll_bit(struct iwl4965_priv *priv, u32 addr,
static inline int _iwl4965_poll_bit(struct iwl_priv *priv, u32 addr,
u32 bits, u32 mask, int timeout)
{
int i = 0;
......@@ -99,9 +99,9 @@ static inline int _iwl4965_poll_bit(struct iwl4965_priv *priv, u32 addr,
return -ETIMEDOUT;
}
#ifdef CONFIG_IWL4965_DEBUG
#ifdef CONFIG_IWLWIFI_DEBUG
static inline int __iwl4965_poll_bit(const char *f, u32 l,
struct iwl4965_priv *priv, u32 addr,
struct iwl_priv *priv, u32 addr,
u32 bits, u32 mask, int timeout)
{
int ret = _iwl4965_poll_bit(priv, addr, bits, mask, timeout);
......@@ -116,13 +116,13 @@ static inline int __iwl4965_poll_bit(const char *f, u32 l,
#define iwl4965_poll_bit(p, a, b, m, t) _iwl4965_poll_bit(p, a, b, m, t)
#endif
static inline void _iwl4965_set_bit(struct iwl4965_priv *priv, u32 reg, u32 mask)
static inline void _iwl4965_set_bit(struct iwl_priv *priv, u32 reg, u32 mask)
{
_iwl4965_write32(priv, reg, _iwl4965_read32(priv, reg) | mask);
}
#ifdef CONFIG_IWL4965_DEBUG
#ifdef CONFIG_IWLWIFI_DEBUG
static inline void __iwl4965_set_bit(const char *f, u32 l,
struct iwl4965_priv *priv, u32 reg, u32 mask)
struct iwl_priv *priv, u32 reg, u32 mask)
{
u32 val = _iwl4965_read32(priv, reg) | mask;
IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
......@@ -133,13 +133,13 @@ static inline void __iwl4965_set_bit(const char *f, u32 l,
#define iwl4965_set_bit(p, r, m) _iwl4965_set_bit(p, r, m)
#endif
static inline void _iwl4965_clear_bit(struct iwl4965_priv *priv, u32 reg, u32 mask)
static inline void _iwl4965_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask)
{
_iwl4965_write32(priv, reg, _iwl4965_read32(priv, reg) & ~mask);
}
#ifdef CONFIG_IWL4965_DEBUG
#ifdef CONFIG_IWLWIFI_DEBUG
static inline void __iwl4965_clear_bit(const char *f, u32 l,
struct iwl4965_priv *priv, u32 reg, u32 mask)
struct iwl_priv *priv, u32 reg, u32 mask)
{
u32 val = _iwl4965_read32(priv, reg) & ~mask;
IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
......@@ -150,12 +150,12 @@ static inline void __iwl4965_clear_bit(const char *f, u32 l,
#define iwl4965_clear_bit(p, r, m) _iwl4965_clear_bit(p, r, m)
#endif
static inline int _iwl4965_grab_nic_access(struct iwl4965_priv *priv)
static inline int _iwl4965_grab_nic_access(struct iwl_priv *priv)
{
int ret;
u32 gp_ctl;
#ifdef CONFIG_IWL4965_DEBUG
#ifdef CONFIG_IWLWIFI_DEBUG
if (atomic_read(&priv->restrict_refcnt))
return 0;
#endif
......@@ -186,15 +186,15 @@ static inline int _iwl4965_grab_nic_access(struct iwl4965_priv *priv)
return -EIO;
}
#ifdef CONFIG_IWL4965_DEBUG
#ifdef CONFIG_IWLWIFI_DEBUG
atomic_inc(&priv->restrict_refcnt);
#endif
return 0;
}
#ifdef CONFIG_IWL4965_DEBUG
#ifdef CONFIG_IWLWIFI_DEBUG
static inline int __iwl4965_grab_nic_access(const char *f, u32 l,
struct iwl4965_priv *priv)
struct iwl_priv *priv)
{
if (atomic_read(&priv->restrict_refcnt))
IWL_DEBUG_INFO("Grabbing access while already held at "
......@@ -210,17 +210,17 @@ static inline int __iwl4965_grab_nic_access(const char *f, u32 l,
_iwl4965_grab_nic_access(priv)
#endif
static inline void _iwl4965_release_nic_access(struct iwl4965_priv *priv)
static inline void _iwl4965_release_nic_access(struct iwl_priv *priv)
{
#ifdef CONFIG_IWL4965_DEBUG
#ifdef CONFIG_IWLWIFI_DEBUG
if (atomic_dec_and_test(&priv->restrict_refcnt))
#endif
_iwl4965_clear_bit(priv, CSR_GP_CNTRL,
CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
}
#ifdef CONFIG_IWL4965_DEBUG
#ifdef CONFIG_IWLWIFI_DEBUG
static inline void __iwl4965_release_nic_access(const char *f, u32 l,
struct iwl4965_priv *priv)
struct iwl_priv *priv)
{
if (atomic_read(&priv->restrict_refcnt) <= 0)
IWL_ERROR("Release unheld nic access at line %d.\n", l);
......@@ -235,13 +235,13 @@ static inline void __iwl4965_release_nic_access(const char *f, u32 l,
_iwl4965_release_nic_access(priv)
#endif
static inline u32 _iwl4965_read_direct32(struct iwl4965_priv *priv, u32 reg)
static inline u32 _iwl4965_read_direct32(struct iwl_priv *priv, u32 reg)
{
return _iwl4965_read32(priv, reg);
}
#ifdef CONFIG_IWL4965_DEBUG
#ifdef CONFIG_IWLWIFI_DEBUG
static inline u32 __iwl4965_read_direct32(const char *f, u32 l,
struct iwl4965_priv *priv, u32 reg)
struct iwl_priv *priv, u32 reg)
{
u32 value = _iwl4965_read_direct32(priv, reg);
if (!atomic_read(&priv->restrict_refcnt))
......@@ -256,14 +256,14 @@ static inline u32 __iwl4965_read_direct32(const char *f, u32 l,
#define iwl4965_read_direct32 _iwl4965_read_direct32
#endif
static inline void _iwl4965_write_direct32(struct iwl4965_priv *priv,
static inline void _iwl4965_write_direct32(struct iwl_priv *priv,
u32 reg, u32 value)
{
_iwl4965_write32(priv, reg, value);
}
#ifdef CONFIG_IWL4965_DEBUG
#ifdef CONFIG_IWLWIFI_DEBUG
static void __iwl4965_write_direct32(u32 line,
struct iwl4965_priv *priv, u32 reg, u32 value)
struct iwl_priv *priv, u32 reg, u32 value)
{
if (!atomic_read(&priv->restrict_refcnt))
IWL_ERROR("Nic access not held from line %d\n", line);
......@@ -275,7 +275,7 @@ static void __iwl4965_write_direct32(u32 line,
#define iwl4965_write_direct32 _iwl4965_write_direct32
#endif
static inline void iwl4965_write_reg_buf(struct iwl4965_priv *priv,
static inline void iwl4965_write_reg_buf(struct iwl_priv *priv,
u32 reg, u32 len, u32 *values)
{
u32 count = sizeof(u32);
......@@ -286,7 +286,7 @@ static inline void iwl4965_write_reg_buf(struct iwl4965_priv *priv,
}
}
static inline int _iwl4965_poll_direct_bit(struct iwl4965_priv *priv,
static inline int _iwl4965_poll_direct_bit(struct iwl_priv *priv,
u32 addr, u32 mask, int timeout)
{
int i = 0;
......@@ -301,9 +301,9 @@ static inline int _iwl4965_poll_direct_bit(struct iwl4965_priv *priv,
return -ETIMEDOUT;
}
#ifdef CONFIG_IWL4965_DEBUG
#ifdef CONFIG_IWLWIFI_DEBUG
static inline int __iwl4965_poll_direct_bit(const char *f, u32 l,
struct iwl4965_priv *priv,
struct iwl_priv *priv,
u32 addr, u32 mask, int timeout)
{
int ret = _iwl4965_poll_direct_bit(priv, addr, mask, timeout);
......@@ -322,13 +322,13 @@ static inline int __iwl4965_poll_direct_bit(const char *f, u32 l,
#define iwl4965_poll_direct_bit _iwl4965_poll_direct_bit
#endif
static inline u32 _iwl4965_read_prph(struct iwl4965_priv *priv, u32 reg)
static inline u32 _iwl4965_read_prph(struct iwl_priv *priv, u32 reg)
{
_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 __iwl4965_read_prph(u32 line, struct iwl4965_priv *priv, u32 reg)
#ifdef CONFIG_IWLWIFI_DEBUG
static inline u32 __iwl4965_read_prph(u32 line, struct iwl_priv *priv, u32 reg)
{
if (!atomic_read(&priv->restrict_refcnt))
IWL_ERROR("Nic access not held from line %d\n", line);
......@@ -341,15 +341,15 @@ static inline u32 __iwl4965_read_prph(u32 line, struct iwl4965_priv *priv, u32 r
#define iwl4965_read_prph _iwl4965_read_prph
#endif
static inline void _iwl4965_write_prph(struct iwl4965_priv *priv,
static inline void _iwl4965_write_prph(struct iwl_priv *priv,
u32 addr, u32 val)
{
_iwl4965_write_direct32(priv, HBUS_TARG_PRPH_WADDR,
((addr & 0x0000FFFF) | (3 << 24)));
_iwl4965_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val);
}
#ifdef CONFIG_IWL4965_DEBUG
static inline void __iwl4965_write_prph(u32 line, struct iwl4965_priv *priv,
#ifdef CONFIG_IWLWIFI_DEBUG
static inline void __iwl4965_write_prph(u32 line, struct iwl_priv *priv,
u32 addr, u32 val)
{
if (!atomic_read(&priv->restrict_refcnt))
......@@ -365,8 +365,8 @@ static inline void __iwl4965_write_prph(u32 line, struct iwl4965_priv *priv,
#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 __iwl4965_set_bits_prph(u32 line, struct iwl4965_priv *priv,
#ifdef CONFIG_IWLWIFI_DEBUG
static inline void __iwl4965_set_bits_prph(u32 line, struct iwl_priv *priv,
u32 reg, u32 mask)
{
if (!atomic_read(&priv->restrict_refcnt))
......@@ -383,9 +383,9 @@ static inline void __iwl4965_set_bits_prph(u32 line, struct iwl4965_priv *priv,
#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
#ifdef CONFIG_IWLWIFI_DEBUG
static inline void __iwl4965_set_bits_mask_prph(u32 line,
struct iwl4965_priv *priv, u32 reg, u32 bits, u32 mask)
struct iwl_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);
......@@ -397,26 +397,26 @@ static inline void __iwl4965_set_bits_mask_prph(u32 line,
#define iwl4965_set_bits_mask_prph _iwl4965_set_bits_mask_prph
#endif
static inline void iwl4965_clear_bits_prph(struct iwl4965_priv
static inline void iwl4965_clear_bits_prph(struct iwl_priv
*priv, u32 reg, u32 mask)
{
u32 val = _iwl4965_read_prph(priv, reg);
_iwl4965_write_prph(priv, reg, (val & ~mask));
}
static inline u32 iwl4965_read_targ_mem(struct iwl4965_priv *priv, u32 addr)
static inline u32 iwl4965_read_targ_mem(struct iwl_priv *priv, u32 addr)
{
iwl4965_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr);
return iwl4965_read_direct32(priv, HBUS_TARG_MEM_RDAT);
}
static inline void iwl4965_write_targ_mem(struct iwl4965_priv *priv, u32 addr, u32 val)
static inline void iwl4965_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val)
{
iwl4965_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
iwl4965_write_direct32(priv, HBUS_TARG_MEM_WDAT, val);
}
static inline void iwl4965_write_targ_mem_buf(struct iwl4965_priv *priv, u32 addr,
static inline void iwl4965_write_targ_mem_buf(struct iwl_priv *priv, u32 addr,
u32 len, u32 *values)
{
iwl4965_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
......
......@@ -39,6 +39,7 @@
#include "../net/mac80211/ieee80211_rate.h"
#include "iwl-4965.h"
#include "iwl-core.h"
#include "iwl-helpers.h"
#define RS_NAME "iwl-4965-rs"
......@@ -162,11 +163,11 @@ struct iwl4965_lq_sta {
struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file;
#endif
struct iwl4965_rate dbg_fixed;
struct iwl4965_priv *drv;
struct iwl_priv *drv;
#endif
};
static void rs_rate_scale_perform(struct iwl4965_priv *priv,
static void rs_rate_scale_perform(struct iwl_priv *priv,
struct net_device *dev,
struct ieee80211_hdr *hdr,
struct sta_info *sta);
......@@ -229,8 +230,8 @@ static s32 expected_tpt_mimo40MHzSGI[IWL_RATE_COUNT] = {
0, 0, 0, 0, 131, 131, 191, 222, 242, 270, 284, 289, 293
};
static int iwl4965_lq_sync_callback(struct iwl4965_priv *priv,
struct iwl4965_cmd *cmd, struct sk_buff *skb)
static int iwl4965_lq_sync_callback(struct iwl_priv *priv,
struct iwl_cmd *cmd, struct sk_buff *skb)
{
/*We didn't cache the SKB; let the caller free it */
return 1;
......@@ -241,13 +242,13 @@ static inline u8 iwl4965_rate_get_rate(u32 rate_n_flags)
return (u8)(rate_n_flags & 0xFF);
}
static int rs_send_lq_cmd(struct iwl4965_priv *priv,
static int rs_send_lq_cmd(struct iwl_priv *priv,
struct iwl4965_link_quality_cmd *lq, u8 flags)
{
#ifdef CONFIG_IWL4965_DEBUG
#ifdef CONFIG_IWLWIFI_DEBUG
int i;
#endif
struct iwl4965_host_cmd cmd = {
struct iwl_host_cmd cmd = {
.id = REPLY_TX_LINK_QUALITY_CMD,
.len = sizeof(struct iwl4965_link_quality_cmd),
.meta.flags = flags,
......@@ -265,7 +266,7 @@ static int rs_send_lq_cmd(struct iwl4965_priv *priv,
IWL_DEBUG_RATE("lq dta 0x%X 0x%X\n",
lq->general_params.single_stream_ant_msk,
lq->general_params.dual_stream_ant_msk);
#ifdef CONFIG_IWL4965_DEBUG
#ifdef CONFIG_IWLWIFI_DEBUG
for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
IWL_DEBUG_RATE("lq index %d 0x%X\n",
i, lq->rs_table[i].rate_n_flags);
......@@ -276,7 +277,7 @@ static int rs_send_lq_cmd(struct iwl4965_priv *priv,
if (iwl4965_is_associated(priv) && priv->assoc_station_added &&
priv->lq_mngr.lq_ready)
return iwl4965_send_cmd(priv, &cmd);
return iwl_send_cmd(priv, &cmd);
return 0;
}
......@@ -388,7 +389,7 @@ static u32 rs_tl_get_load(struct iwl4965_lq_sta *lq_data, u8 tid)
return tl->total;
}
static void rs_tl_turn_on_agg_for_tid(struct iwl4965_priv *priv,
static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv,
struct iwl4965_lq_sta *lq_data, u8 tid,
struct sta_info *sta)
{
......@@ -407,7 +408,7 @@ static void rs_tl_turn_on_agg_for_tid(struct iwl4965_priv *priv,
}
}
static void rs_tl_turn_on_agg(struct iwl4965_priv *priv, u8 tid,
static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid,
struct iwl4965_lq_sta *lq_data,
struct sta_info *sta)
{
......@@ -658,7 +659,7 @@ static inline void rs_toggle_antenna(struct iwl4965_rate *new_rate,
}
}
static inline u8 rs_use_green(struct iwl4965_priv *priv,
static inline u8 rs_use_green(struct iwl_priv *priv,
struct ieee80211_conf *conf)
{
#ifdef CONFIG_IWL4965_HT
......@@ -821,7 +822,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
struct iwl4965_link_quality_cmd *table;
struct sta_info *sta;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate;
struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee80211_hw *hw = local_to_hw(local);
struct iwl4965_rate_scale_data *window = NULL;
......@@ -1128,7 +1129,7 @@ static void rs_get_expected_tpt_table(struct iwl4965_lq_sta *lq_sta,
* to decrease to match "active" throughput. When moving from MIMO to SISO,
* bit rate will typically need to increase, but not if performance was bad.
*/
static s32 rs_get_best_rate(struct iwl4965_priv *priv,
static s32 rs_get_best_rate(struct iwl_priv *priv,
struct iwl4965_lq_sta *lq_sta,
struct iwl4965_scale_tbl_info *tbl, /* "search" */
u16 rate_mask, s8 index, s8 rate)
......@@ -1226,7 +1227,7 @@ static inline u8 rs_is_both_ant_supp(u8 valid_antenna)
/*
* Set up search table for MIMO
*/
static int rs_switch_to_mimo(struct iwl4965_priv *priv,
static int rs_switch_to_mimo(struct iwl_priv *priv,
struct iwl4965_lq_sta *lq_sta,
struct ieee80211_conf *conf,
struct sta_info *sta,
......@@ -1291,7 +1292,7 @@ static int rs_switch_to_mimo(struct iwl4965_priv *priv,
/*
* Set up search table for SISO
*/
static int rs_switch_to_siso(struct iwl4965_priv *priv,
static int rs_switch_to_siso(struct iwl_priv *priv,
struct iwl4965_lq_sta *lq_sta,
struct ieee80211_conf *conf,
struct sta_info *sta,
......@@ -1354,7 +1355,7 @@ static int rs_switch_to_siso(struct iwl4965_priv *priv,
/*
* Try to switch to new modulation mode from legacy
*/
static int rs_move_legacy_other(struct iwl4965_priv *priv,
static int rs_move_legacy_other(struct iwl_priv *priv,
struct iwl4965_lq_sta *lq_sta,
struct ieee80211_conf *conf,
struct sta_info *sta,
......@@ -1452,7 +1453,7 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv,
/*
* Try to switch to new modulation mode from SISO
*/
static int rs_move_siso_to_other(struct iwl4965_priv *priv,
static int rs_move_siso_to_other(struct iwl_priv *priv,
struct iwl4965_lq_sta *lq_sta,
struct ieee80211_conf *conf,
struct sta_info *sta,
......@@ -1548,7 +1549,7 @@ static int rs_move_siso_to_other(struct iwl4965_priv *priv,
/*
* Try to switch to new modulation mode from MIMO
*/
static int rs_move_mimo_to_other(struct iwl4965_priv *priv,
static int rs_move_mimo_to_other(struct iwl_priv *priv,
struct iwl4965_lq_sta *lq_sta,
struct ieee80211_conf *conf,
struct sta_info *sta,
......@@ -1728,7 +1729,7 @@ static void rs_stay_in_table(struct iwl4965_lq_sta *lq_sta)
/*
* Do rate scaling and search for new modulation mode.
*/
static void rs_rate_scale_perform(struct iwl4965_priv *priv,
static void rs_rate_scale_perform(struct iwl_priv *priv,
struct net_device *dev,
struct ieee80211_hdr *hdr,
struct sta_info *sta)
......@@ -2148,7 +2149,7 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv,
}
static void rs_initialize_lq(struct iwl4965_priv *priv,
static void rs_initialize_lq(struct iwl_priv *priv,
struct ieee80211_conf *conf,
struct sta_info *sta)
{
......@@ -2213,7 +2214,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 fc;
struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate;
struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
struct iwl4965_lq_sta *lq_sta;
IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n");
......@@ -2294,7 +2295,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
int i, j;
struct ieee80211_conf *conf = &local->hw.conf;
struct ieee80211_supported_band *sband;
struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate;
struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
struct iwl4965_lq_sta *lq_sta = priv_sta;
sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
......@@ -2516,7 +2517,7 @@ static void rs_free(void *priv_rate)
static void rs_clear(void *priv_rate)
{
struct iwl4965_priv *priv = (struct iwl4965_priv *) priv_rate;
struct iwl_priv *priv = (struct iwl_priv *) priv_rate;
IWL_DEBUG_RATE("enter\n");
......@@ -2726,7 +2727,7 @@ static struct rate_control_ops rs_ops = {
int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
{
struct ieee80211_local *local = hw_to_local(hw);
struct iwl4965_priv *priv = hw->priv;
struct iwl_priv *priv = hw->priv;
struct iwl4965_lq_sta *lq_sta;
struct sta_info *sta;
int cnt = 0, i;
......@@ -2816,7 +2817,7 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
void iwl4965_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
{
struct iwl4965_priv *priv = hw->priv;
struct iwl_priv *priv = hw->priv;
priv->lq_mngr.lq_ready = 1;
}
......
......@@ -44,7 +44,7 @@ extern struct pci_device_id iwl4965_hw_card_ids[];
#include "iwl-4965-hw.h"
#include "iwl-csr.h"
#include "iwl-prph.h"
#include "iwl-4965-debug.h"
#include "iwl-debug.h"
/* Change firmware file name, using "-" and incrementing number,
* *only* when uCode interface or architecture changes so that it
......@@ -66,11 +66,6 @@ extern struct pci_device_id iwl4965_hw_card_ids[];
* averages within an s8's (used in some apps) range of negative values. */
#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127)
/* Module parameters accessible from iwl-*.c */
extern int iwl4965_param_hwcrypto;
extern int iwl4965_param_queues_num;
extern int iwl4965_param_amsdu_size_8K;
enum iwl4965_antenna {
IWL_ANTENNA_DIVERSITY,
IWL_ANTENNA_MAIN,
......@@ -142,7 +137,7 @@ struct iwl4965_tx_info {
struct iwl4965_tx_queue {
struct iwl4965_queue q;
struct iwl4965_tfd_frame *bd;
struct iwl4965_cmd *cmd;
struct iwl_cmd *cmd;
dma_addr_t dma_addr_cmd;
struct iwl4965_tx_info *txb;
int need_update;
......@@ -199,7 +194,7 @@ enum {
*/
#define IWL4965_MAX_RATE (33)
struct iwl4965_channel_info {
struct iwl_channel_info {
struct iwl4965_channel_tgd_info tgd;
struct iwl4965_channel_tgh_info tgh;
struct iwl4965_eeprom_channel eeprom; /* EEPROM regulatory limit */
......@@ -314,15 +309,15 @@ enum {
CMD_WANT_SKB = (1 << 2),
};
struct iwl4965_cmd;
struct iwl4965_priv;
struct iwl_cmd;
struct iwl_priv;
struct iwl4965_cmd_meta {
struct iwl4965_cmd_meta *source;
struct iwl_cmd_meta {
struct iwl_cmd_meta *source;
union {
struct sk_buff *skb;
int (*callback)(struct iwl4965_priv *priv,
struct iwl4965_cmd *cmd, struct sk_buff *skb);
int (*callback)(struct iwl_priv *priv,
struct iwl_cmd *cmd, struct sk_buff *skb);
} __attribute__ ((packed)) u;
/* The CMD_SIZE_HUGE flag bit indicates that the command
......@@ -332,15 +327,15 @@ struct iwl4965_cmd_meta {
} __attribute__ ((packed));
/**
* struct iwl4965_cmd
* struct iwl_cmd
*
* For allocation of the command and tx queues, this establishes the overall
* size of the largest command we send to uCode, except for a scan command
* (which is relatively huge; space is allocated separately).
*/
struct iwl4965_cmd {
struct iwl4965_cmd_meta meta; /* driver data */
struct iwl4965_cmd_header hdr; /* uCode API */
struct iwl_cmd {
struct iwl_cmd_meta meta; /* driver data */
struct iwl_cmd_header hdr; /* uCode API */
union {
struct iwl4965_addsta_cmd addsta;
struct iwl4965_led_cmd led;
......@@ -360,15 +355,15 @@ struct iwl4965_cmd {
} __attribute__ ((packed)) cmd;
} __attribute__ ((packed));
struct iwl4965_host_cmd {
struct iwl_host_cmd {
u8 id;
u16 len;
struct iwl4965_cmd_meta meta;
struct iwl_cmd_meta meta;
const void *data;
};
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl4965_cmd) - \
sizeof(struct iwl4965_cmd_meta))
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \
sizeof(struct iwl_cmd_meta))
/*
* RX related structures and functions
......@@ -483,6 +478,7 @@ struct iwl4965_tid_data {
struct iwl4965_hw_key {
enum ieee80211_key_alg alg;
int keylen;
struct ieee80211_key_conf *conf;
u8 key[32];
};
......@@ -634,51 +630,50 @@ struct iwl4965_driver_hw_info {
*
*****************************************************************************/
struct iwl4965_addsta_cmd;
extern int iwl4965_send_add_station(struct iwl4965_priv *priv,
extern int iwl4965_send_add_station(struct iwl_priv *priv,
struct iwl4965_addsta_cmd *sta, u8 flags);
extern u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr,
extern u8 iwl4965_add_station_flags(struct iwl_priv *priv, const u8 *addr,
int is_ap, u8 flags, void *ht_data);
extern int iwl4965_is_network_packet(struct iwl4965_priv *priv,
extern int iwl4965_is_network_packet(struct iwl_priv *priv,
struct ieee80211_hdr *header);
extern int iwl4965_power_init_handle(struct iwl4965_priv *priv);
extern void iwl4965_handle_data_packet_monitor(struct iwl4965_priv *priv,
extern int iwl4965_power_init_handle(struct iwl_priv *priv);
extern void iwl4965_handle_data_packet_monitor(struct iwl_priv *priv,
struct iwl4965_rx_mem_buffer *rxb,
void *data, short len,
struct ieee80211_rx_status *stats,
u16 phy_flags);
extern int iwl4965_is_duplicate_packet(struct iwl4965_priv *priv,
extern int iwl4965_is_duplicate_packet(struct iwl_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,
extern int iwl4965_rx_queue_alloc(struct iwl_priv *priv);
extern void iwl4965_rx_queue_reset(struct iwl_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,
extern int iwl4965_tx_queue_init(struct iwl_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 iwl4965_send_cmd(struct iwl4965_priv *priv,
struct iwl4965_host_cmd *cmd);
extern unsigned int iwl4965_fill_beacon_frame(struct iwl4965_priv *priv,
extern void iwl4965_tx_queue_free(struct iwl_priv *priv, struct iwl4965_tx_queue *txq);
extern unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv,
struct ieee80211_hdr *hdr,
const u8 *dest, int left);
extern int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv,
extern int iwl4965_rx_queue_update_write_ptr(struct iwl_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,
extern int iwl4965_send_statistics_request(struct iwl_priv *priv);
extern void iwl4965_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb,
u32 decrypt_res,
struct ieee80211_rx_status *stats);
extern __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr);
int iwl4965_init_geos(struct iwl_priv *priv);
void iwl4965_free_geos(struct iwl_priv *priv);
extern const u8 iwl4965_broadcast_addr[ETH_ALEN];
int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
/*
* Currently used by iwl-3945-rs... look at restructuring so that it doesn't
* call this... todo... fix that.
*/
extern u8 iwl4965_sync_station(struct iwl4965_priv *priv, int sta_id,
extern u8 iwl4965_sync_station(struct iwl_priv *priv, int sta_id,
u16 tx_rate, u8 flags);
/******************************************************************************
......@@ -697,36 +692,36 @@ extern u8 iwl4965_sync_station(struct iwl4965_priv *priv, int sta_id,
* iwl4965_mac_ <-- mac80211 callback
*
****************************************************************************/
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,
extern void iwl4965_hw_rx_handler_setup(struct iwl_priv *priv);
extern void iwl4965_hw_setup_deferred_work(struct iwl_priv *priv);
extern void iwl4965_hw_cancel_deferred_work(struct iwl_priv *priv);
extern int iwl4965_hw_rxq_stop(struct iwl_priv *priv);
extern int iwl4965_hw_set_hw_setting(struct iwl_priv *priv);
extern int iwl4965_hw_nic_init(struct iwl_priv *priv);
extern int iwl4965_hw_nic_stop_master(struct iwl_priv *priv);
extern void iwl4965_hw_txq_ctx_free(struct iwl_priv *priv);
extern void iwl4965_hw_txq_ctx_stop(struct iwl_priv *priv);
extern int iwl4965_hw_nic_reset(struct iwl_priv *priv);
extern int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd,
dma_addr_t addr, u16 len);
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,
extern int iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl4965_tx_queue *txq);
extern int iwl4965_hw_get_temperature(struct iwl_priv *priv);
extern int iwl4965_hw_tx_queue_init(struct iwl_priv *priv,
struct iwl4965_tx_queue *txq);
extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl4965_priv *priv,
extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_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,
extern int iwl4965_hw_get_rx_read(struct iwl_priv *priv);
extern void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv,
struct iwl_cmd *cmd,
struct ieee80211_tx_control *ctrl,
struct ieee80211_hdr *hdr,
int sta_id, int tx_id);
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,
extern int iwl4965_hw_reg_send_txpower(struct iwl_priv *priv);
extern int iwl4965_hw_reg_set_txpower(struct iwl_priv *priv, s8 power);
extern void iwl4965_hw_rx_statistics(struct iwl_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);
extern void iwl4965_disable_events(struct iwl_priv *priv);
extern int iwl4965_get_temperature(const struct iwl_priv *priv);
/**
* iwl4965_hw_find_station - Find station id for a given BSSID
......@@ -736,51 +731,48 @@ extern int iwl4965_get_temperature(const struct iwl4965_priv *priv);
* not yet been merged into a single common layer for managing the
* station tables.
*/
extern u8 iwl4965_hw_find_station(struct iwl4965_priv *priv, const u8 *bssid);
extern u8 iwl4965_hw_find_station(struct iwl_priv *priv, const u8 *bssid);
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);
extern int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel);
extern int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index);
extern int iwl4965_queue_space(const struct iwl4965_queue *q);
struct iwl4965_priv;
struct iwl_priv;
/*
* Forward declare iwl-4965.c functions for iwl-base.c
*/
extern int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv,
extern int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv,
struct iwl4965_tx_queue *txq,
u16 byte_cnt);
extern void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr,
extern void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr,
int is_ap);
extern void iwl4965_set_rxon_chain(struct iwl4965_priv *priv);
extern int iwl4965_alive_notify(struct iwl4965_priv *priv);
extern void iwl4965_update_rate_scaling(struct iwl4965_priv *priv, u8 mode);
extern void iwl4965_chain_noise_reset(struct iwl4965_priv *priv);
extern void iwl4965_init_sensitivity(struct iwl4965_priv *priv, u8 flags,
extern void iwl4965_set_rxon_chain(struct iwl_priv *priv);
extern int iwl4965_alive_notify(struct iwl_priv *priv);
extern void iwl4965_update_rate_scaling(struct iwl_priv *priv, u8 mode);
extern void iwl4965_chain_noise_reset(struct iwl_priv *priv);
extern void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags,
u8 force);
extern int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv,
enum ieee80211_band band,
u16 channel,
const struct iwl4965_eeprom_channel *eeprom_ch,
u8 fat_extension_channel);
extern void iwl4965_rf_kill_ct_config(struct iwl4965_priv *priv);
extern void iwl4965_hwrate_to_tx_control(struct iwl4965_priv *priv,
extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv);
extern void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv,
u32 rate_n_flags,
struct ieee80211_tx_control *control);
#ifdef CONFIG_IWL4965_HT
void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info,
void iwl4965_init_ht_hw_capab(struct iwl_priv *priv,
struct ieee80211_ht_info *ht_info,
enum ieee80211_band band);
void iwl4965_set_rxon_ht(struct iwl4965_priv *priv,
void iwl4965_set_rxon_ht(struct iwl_priv *priv,
struct iwl_ht_info *ht_info);
void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index,
void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index,
struct ieee80211_ht_info *sta_ht_inf);
int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw,
enum ieee80211_ampdu_mlme_action action,
const u8 *addr, u16 tid, u16 *ssn);
int iwl4965_check_empty_hw_queue(struct iwl4965_priv *priv, int sta_id,
int iwl4965_check_empty_hw_queue(struct iwl_priv *priv, int sta_id,
u8 tid, int txq_id);
#else
static inline void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info,
static inline void iwl4965_init_ht_hw_capab(struct iwl_priv *priv,
struct ieee80211_ht_info *ht_info,
enum ieee80211_band band) {}
#endif /*CONFIG_IWL4965_HT */
......@@ -966,7 +958,7 @@ enum {
#endif
struct iwl4965_priv {
struct iwl_priv {
/* ieee device used by generic ieee processing code */
struct ieee80211_hw *hw;
......@@ -982,7 +974,7 @@ struct iwl4965_priv {
int alloc_rxb_skb;
bool add_radiotap;
void (*rx_handlers[REPLY_MAX])(struct iwl4965_priv *priv,
void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
struct iwl4965_rx_mem_buffer *rxb);
struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
......@@ -997,7 +989,7 @@ struct iwl4965_priv {
/* we allocate array of iwl4965_channel_info for NIC's valid channels.
* Access via channel # using indirect index array */
struct iwl4965_channel_info *channel_info; /* channel info array */
struct iwl_channel_info *channel_info; /* channel info array */
u8 channel_count; /* # of channels */
/* each calibration channel group in the EEPROM has a derived
......@@ -1107,6 +1099,12 @@ struct iwl4965_priv {
int last_rx_rssi; /* From Rx packet statisitics */
int last_rx_noise; /* From beacon statistics */
/* counts mgmt, ctl, and data packets */
struct traffic_stats {
u32 cnt;
u64 bytes;
} tx_stats[3], rx_stats[3];
struct iwl4965_power_mgr power_data;
struct iwl4965_notif_statistics statistics;
......@@ -1202,11 +1200,15 @@ struct iwl4965_priv {
u32 pm_state[16];
#endif
#ifdef CONFIG_IWL4965_DEBUG
#ifdef CONFIG_IWLWIFI_DEBUG
/* debugging info */
u32 framecnt_to_us;
atomic_t restrict_refcnt;
#endif
#ifdef CONFIG_IWLWIFI_DEBUGFS
/* debugfs */
struct iwl_debugfs *dbgfs;
#endif /* CONFIG_IWLWIFI_DEBUGFS */
#endif /* CONFIG_IWLWIFI_DEBUG */
struct work_struct txpower_work;
#ifdef CONFIG_IWL4965_SENSITIVITY
......@@ -1214,54 +1216,54 @@ struct iwl4965_priv {
#endif
struct work_struct statistics_work;
struct timer_list statistics_periodic;
}; /*iwl4965_priv */
}; /*iwl_priv */
static inline int iwl4965_is_associated(struct iwl4965_priv *priv)
static inline int iwl4965_is_associated(struct iwl_priv *priv)
{
return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
}
static inline int is_channel_valid(const struct iwl4965_channel_info *ch_info)
static inline int is_channel_valid(const struct iwl_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 iwl4965_channel_info *ch_info)
static inline int is_channel_narrow(const struct iwl_channel_info *ch_info)
{
return (ch_info->flags & EEPROM_CHANNEL_NARROW) ? 1 : 0;
}
static inline int is_channel_radar(const struct iwl4965_channel_info *ch_info)
static inline int is_channel_radar(const struct iwl_channel_info *ch_info)
{
return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0;
}
static inline u8 is_channel_a_band(const struct iwl4965_channel_info *ch_info)
static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info)
{
return ch_info->band == IEEE80211_BAND_5GHZ;
}
static inline u8 is_channel_bg_band(const struct iwl4965_channel_info *ch_info)
static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info)
{
return ch_info->band == IEEE80211_BAND_2GHZ;
}
static inline int is_channel_passive(const struct iwl4965_channel_info *ch)
static inline int is_channel_passive(const struct iwl_channel_info *ch)
{
return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0;
}
static inline int is_channel_ibss(const struct iwl4965_channel_info *ch)
static inline int is_channel_ibss(const struct iwl_channel_info *ch)
{
return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
}
extern const struct iwl4965_channel_info *iwl4965_get_channel_info(
const struct iwl4965_priv *priv, enum ieee80211_band band, u16 channel);
extern const struct iwl_channel_info *iwl_get_channel_info(
const struct iwl_priv *priv, enum ieee80211_band band, u16 channel);
/* Requires full declaration of iwl4965_priv before including */
/* Requires full declaration of iwl_priv before including */
#include "iwl-4965-io.h"
#endif /* __iwl4965_4965_h__ */
......@@ -29,17 +29,223 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/version.h>
#include <net/mac80211.h>
#include "iwl-4965-debug.h"
struct iwl_priv; /* FIXME: remove */
#include "iwl-debug.h"
#include "iwl-eeprom.h"
#include "iwl-core.h"
#include "iwl-4965.h" /* FIXME: remove */
MODULE_DESCRIPTION("iwl core");
MODULE_VERSION(IWLWIFI_VERSION);
MODULE_AUTHOR(DRV_COPYRIGHT);
MODULE_LICENSE("GPL/BSD");
MODULE_LICENSE("GPL");
#ifdef CONFIG_IWL4965_DEBUG
u32 iwl4965_debug_level;
EXPORT_SYMBOL(iwl4965_debug_level);
#ifdef CONFIG_IWLWIFI_DEBUG
u32 iwl_debug_level;
EXPORT_SYMBOL(iwl_debug_level);
#endif
/* This function both allocates and initializes hw and priv. */
struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg,
struct ieee80211_ops *hw_ops)
{
struct iwl_priv *priv;
/* mac80211 allocates memory for this device instance, including
* space for this driver's private structure */
struct ieee80211_hw *hw =
ieee80211_alloc_hw(sizeof(struct iwl_priv), hw_ops);
if (hw == NULL) {
IWL_ERROR("Can not allocate network device\n");
goto out;
}
priv = hw->priv;
priv->hw = hw;
out:
return hw;
}
EXPORT_SYMBOL(iwl_alloc_all);
/**
* iwlcore_clear_stations_table - Clear the driver's station table
*
* NOTE: This does not clear or otherwise alter the device's station table.
*/
void iwlcore_clear_stations_table(struct iwl_priv *priv)
{
unsigned long flags;
spin_lock_irqsave(&priv->sta_lock, flags);
priv->num_stations = 0;
memset(priv->stations, 0, sizeof(priv->stations));
spin_unlock_irqrestore(&priv->sta_lock, flags);
}
EXPORT_SYMBOL(iwlcore_clear_stations_table);
void iwlcore_reset_qos(struct iwl_priv *priv)
{
u16 cw_min = 15;
u16 cw_max = 1023;
u8 aifs = 2;
u8 is_legacy = 0;
unsigned long flags;
int i;
spin_lock_irqsave(&priv->lock, flags);
priv->qos_data.qos_active = 0;
if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) {
if (priv->qos_data.qos_enable)
priv->qos_data.qos_active = 1;
if (!(priv->active_rate & 0xfff0)) {
cw_min = 31;
is_legacy = 1;
}
} else if (priv->iw_mode == IEEE80211_IF_TYPE_AP) {
if (priv->qos_data.qos_enable)
priv->qos_data.qos_active = 1;
} else if (!(priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK)) {
cw_min = 31;
is_legacy = 1;
}
if (priv->qos_data.qos_active)
aifs = 3;
priv->qos_data.def_qos_parm.ac[0].cw_min = cpu_to_le16(cw_min);
priv->qos_data.def_qos_parm.ac[0].cw_max = cpu_to_le16(cw_max);
priv->qos_data.def_qos_parm.ac[0].aifsn = aifs;
priv->qos_data.def_qos_parm.ac[0].edca_txop = 0;
priv->qos_data.def_qos_parm.ac[0].reserved1 = 0;
if (priv->qos_data.qos_active) {
i = 1;
priv->qos_data.def_qos_parm.ac[i].cw_min = cpu_to_le16(cw_min);
priv->qos_data.def_qos_parm.ac[i].cw_max = cpu_to_le16(cw_max);
priv->qos_data.def_qos_parm.ac[i].aifsn = 7;
priv->qos_data.def_qos_parm.ac[i].edca_txop = 0;
priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
i = 2;
priv->qos_data.def_qos_parm.ac[i].cw_min =
cpu_to_le16((cw_min + 1) / 2 - 1);
priv->qos_data.def_qos_parm.ac[i].cw_max =
cpu_to_le16(cw_max);
priv->qos_data.def_qos_parm.ac[i].aifsn = 2;
if (is_legacy)
priv->qos_data.def_qos_parm.ac[i].edca_txop =
cpu_to_le16(6016);
else
priv->qos_data.def_qos_parm.ac[i].edca_txop =
cpu_to_le16(3008);
priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
i = 3;
priv->qos_data.def_qos_parm.ac[i].cw_min =
cpu_to_le16((cw_min + 1) / 4 - 1);
priv->qos_data.def_qos_parm.ac[i].cw_max =
cpu_to_le16((cw_max + 1) / 2 - 1);
priv->qos_data.def_qos_parm.ac[i].aifsn = 2;
priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
if (is_legacy)
priv->qos_data.def_qos_parm.ac[i].edca_txop =
cpu_to_le16(3264);
else
priv->qos_data.def_qos_parm.ac[i].edca_txop =
cpu_to_le16(1504);
} else {
for (i = 1; i < 4; i++) {
priv->qos_data.def_qos_parm.ac[i].cw_min =
cpu_to_le16(cw_min);
priv->qos_data.def_qos_parm.ac[i].cw_max =
cpu_to_le16(cw_max);
priv->qos_data.def_qos_parm.ac[i].aifsn = aifs;
priv->qos_data.def_qos_parm.ac[i].edca_txop = 0;
priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
}
}
IWL_DEBUG_QOS("set QoS to default \n");
spin_unlock_irqrestore(&priv->lock, flags);
}
EXPORT_SYMBOL(iwlcore_reset_qos);
/**
* iwlcore_set_rxon_channel - Set the phymode and channel values in staging RXON
* @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz
* @channel: Any channel valid for the requested phymode
* In addition to setting the staging RXON, priv->phymode is also set.
*
* NOTE: Does not commit to the hardware; it sets appropriate bit fields
* in the staging RXON flag structure based on the phymode
*/
int iwlcore_set_rxon_channel(struct iwl_priv *priv,
enum ieee80211_band band,
u16 channel)
{
if (!iwl_get_channel_info(priv, band, channel)) {
IWL_DEBUG_INFO("Could not set channel to %d [%d]\n",
channel, band);
return -EINVAL;
}
if ((le16_to_cpu(priv->staging_rxon.channel) == channel) &&
(priv->band == band))
return 0;
priv->staging_rxon.channel = cpu_to_le16(channel);
if (band == IEEE80211_BAND_5GHZ)
priv->staging_rxon.flags &= ~RXON_FLG_BAND_24G_MSK;
else
priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK;
priv->band = band;
IWL_DEBUG_INFO("Staging channel set to %d [%d]\n", channel, band);
return 0;
}
EXPORT_SYMBOL(iwlcore_set_rxon_channel);
static void iwlcore_init_hw(struct iwl_priv *priv)
{
struct ieee80211_hw *hw = priv->hw;
hw->rate_control_algorithm = "iwl-4965-rs";
/* Tell mac80211 and its clients (e.g. Wireless Extensions)
* the range of signal quality values that we'll provide.
* Negative values for level/noise indicate that we'll provide dBm.
* For WE, at least, non-0 values here *enable* display of values
* in app (iwconfig). */
hw->max_rssi = -20; /* signal level, negative indicates dBm */
hw->max_noise = -20; /* noise level, negative indicates dBm */
hw->max_signal = 100; /* link quality indication (%) */
/* Tell mac80211 our Tx characteristics */
hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE;
/* Default value; 4 EDCA QOS priorities */
hw->queues = 4;
#ifdef CONFIG_IWL4965_HT
/* Enhanced value; more queues, to support 11n aggregation */
hw->queues = 16;
#endif /* CONFIG_IWL4965_HT */
}
int iwl_setup(struct iwl_priv *priv)
{
int ret = 0;
iwlcore_init_hw(priv);
ret = priv->cfg->ops->lib->init_drv(priv);
return ret;
}
EXPORT_SYMBOL(iwl_setup);
......@@ -63,6 +63,13 @@
#ifndef __iwl_core_h__
#define __iwl_core_h__
/************************
* forward declarations *
************************/
struct iwl_host_cmd;
struct iwl_cmd;
#define IWLWIFI_VERSION "1.2.26k"
#define DRV_COPYRIGHT "Copyright(c) 2003-2008 Intel Corporation"
......@@ -75,13 +82,31 @@
#define IWL_SKU_A 0x2
#define IWL_SKU_N 0x8
struct iwl_hcmd_utils_ops {
int (*enqueue_hcmd)(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
};
struct iwl_lib_ops {
/* iwlwifi driver (priv) init */
int (*init_drv)(struct iwl_priv *priv);
/* eeprom operations (as defined in iwl-eeprom.h) */
struct iwl_eeprom_ops eeprom_ops;
};
struct iwl_ops {
const struct iwl_lib_ops *lib;
const struct iwl_hcmd_utils_ops *utils;
};
struct iwl_mod_params {
int disable; /* def: 0 = enable radio */
int hw_crypto; /* def: 0 = using software encryption */
int debug; /* def: 0 = minimal debug log messages */
int disable_hw_scan; /* def: 0 = use h/w scan */
int num_of_queues; /* def: HW dependent */
int enable_qos; /* def: 1 = use quality of service */
int amsdu_size_8K; /* def: 1 = enable 8K amsdu size */
int antenna; /* def: 0 = both antennas (use diversity) */
};
struct iwl_cfg {
......@@ -89,6 +114,36 @@ struct iwl_cfg {
const char *fw_name;
unsigned int sku;
const struct iwl_ops *ops;
const struct iwl_mod_params *mod_params;
};
/***************************
* L i b *
***************************/
struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg,
struct ieee80211_ops *hw_ops);
void iwlcore_clear_stations_table(struct iwl_priv *priv);
void iwlcore_reset_qos(struct iwl_priv *priv);
int iwlcore_set_rxon_channel(struct iwl_priv *priv,
enum ieee80211_band band,
u16 channel);
int iwl_setup(struct iwl_priv *priv);
/*****************************************************
* S e n d i n g H o s t C o m m a n d s *
*****************************************************/
const char *get_cmd_string(u8 cmd);
int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data);
int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len,
const void *data,
int (*callback)(struct iwl_priv *priv,
struct iwl_cmd *cmd,
struct sk_buff *skb));
#endif /* __iwl_core_h__ */
......@@ -26,43 +26,72 @@
*
*****************************************************************************/
#ifndef __iwl4965_debug_h__
#define __iwl4965_debug_h__
#ifndef __iwl_debug_h__
#define __iwl_debug_h__
#ifdef CONFIG_IWL4965_DEBUG
extern u32 iwl4965_debug_level;
#ifdef CONFIG_IWLWIFI_DEBUG
extern u32 iwl_debug_level;
#define IWL_DEBUG(level, fmt, args...) \
do { if (iwl4965_debug_level & (level)) \
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 ((iwl4965_debug_level & (level)) && net_ratelimit()) \
do { if ((iwl_debug_level & (level)) && net_ratelimit()) \
printk(KERN_ERR DRV_NAME": %c %s " fmt, \
in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
static inline void iwl4965_print_hex_dump(int level, void *p, u32 len)
static inline void iwl_print_hex_dump(int level, void *p, u32 len)
{
if (!(iwl4965_debug_level & level))
if (!(iwl_debug_level & level))
return;
print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1,
p, len, 1);
}
#else
#ifdef CONFIG_IWLWIFI_DEBUGFS
struct iwl_debugfs {
const char *name;
struct dentry *dir_drv;
struct dentry *dir_data;
struct dir_data_files{
struct dentry *file_sram;
struct dentry *file_stations;
struct dentry *file_rx_statistics;
struct dentry *file_tx_statistics;
} dbgfs_data_files;
u32 sram_offset;
u32 sram_len;
};
int iwl_dbgfs_register(struct iwl_priv *priv, const char *name);
void iwl_dbgfs_unregister(struct iwl_priv *priv);
#endif
#else
static inline void IWL_DEBUG(int level, const char *fmt, ...)
{
}
static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...)
{
}
static inline void iwl4965_print_hex_dump(int level, void *p, u32 len)
static inline void iwl_print_hex_dump(int level, void *p, u32 len)
{
}
#endif /* CONFIG_IWL4965_DEBUG */
#endif /* CONFIG_IWLWIFI_DEBUG */
#ifndef CONFIG_IWLWIFI_DEBUGFS
static inline int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
{
return 0;
}
static inline void iwl_dbgfs_unregister(struct iwl_priv *priv)
{
}
#endif /* CONFIG_IWLWIFI_DEBUGFS */
/*
* To use the debug system;
......@@ -83,10 +112,10 @@ static inline void iwl4965_print_hex_dump(int level, void *p, u32 len)
*
* % cat /proc/net/iwl/debug_level
*
* you simply need to add your entry to the iwl4965_debug_levels array.
* 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_IWL4965_DEBUG defined in your kernel configuration
* CONFIG_IWLWIFI_DEBUG defined in your kernel configuration
*
*/
......
/******************************************************************************
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2008 Intel Corporation. All rights reserved.
*
* 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.GPL.
*
* Contact Information:
* Tomas Winkler <tomas.winkler@intel.com>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*****************************************************************************/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/debugfs.h>
#include <linux/ieee80211.h>
#include <net/mac80211.h>
#include "iwl-4965.h"
#include "iwl-debug.h"
#include "iwl-4965-io.h"
/* create and remove of files */
#define DEBUGFS_ADD_DIR(name, parent) do { \
dbgfs->dir_##name = debugfs_create_dir(#name, parent); \
if (!(dbgfs->dir_##name)) \
goto err; \
} while (0)
#define DEBUGFS_ADD_FILE(name, parent) do { \
dbgfs->dbgfs_##parent##_files.file_##name = \
debugfs_create_file(#name, 0644, dbgfs->dir_##parent, priv, \
&iwl_dbgfs_##name##_ops); \
if (!(dbgfs->dbgfs_##parent##_files.file_##name)) \
goto err; \
} while (0)
#define DEBUGFS_REMOVE(name) do { \
debugfs_remove(name); \
name = NULL; \
} while (0);
/* file operation */
#define DEBUGFS_READ_FUNC(name) \
static ssize_t iwl_dbgfs_##name##_read(struct file *file, \
char __user *user_buf, \
size_t count, loff_t *ppos);
#define DEBUGFS_WRITE_FUNC(name) \
static ssize_t iwl_dbgfs_##name##_write(struct file *file, \
const char __user *user_buf, \
size_t count, loff_t *ppos);
static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file)
{
file->private_data = inode->i_private;
return 0;
}
#define DEBUGFS_READ_FILE_OPS(name) \
DEBUGFS_READ_FUNC(name); \
static const struct file_operations iwl_dbgfs_##name##_ops = { \
.read = iwl_dbgfs_##name##_read, \
.open = iwl_dbgfs_open_file_generic, \
};
#define DEBUGFS_READ_WRITE_FILE_OPS(name) \
DEBUGFS_READ_FUNC(name); \
DEBUGFS_WRITE_FUNC(name); \
static const struct file_operations iwl_dbgfs_##name##_ops = { \
.write = iwl_dbgfs_##name##_write, \
.read = iwl_dbgfs_##name##_read, \
.open = iwl_dbgfs_open_file_generic, \
};
static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos) {
struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
char buf[256];
int pos = 0;
pos += sprintf(buf+pos, "mgmt: %u\n", priv->tx_stats[0].cnt);
pos += sprintf(buf+pos, "ctrl: %u\n", priv->tx_stats[1].cnt);
pos += sprintf(buf+pos, "data: %u\n", priv->tx_stats[2].cnt);
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
}
static ssize_t iwl_dbgfs_rx_statistics_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos) {
struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
char buf[256];
int pos = 0;
pos += sprintf(buf+pos, "mgmt: %u\n", priv->rx_stats[0].cnt);
pos += sprintf(buf+pos, "ctrl: %u\n", priv->rx_stats[1].cnt);
pos += sprintf(buf+pos, "data: %u\n", priv->rx_stats[2].cnt);
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
}
#define BYTE1_MASK 0x000000ff;
#define BYTE2_MASK 0x0000ffff;
#define BYTE3_MASK 0x00ffffff;
static ssize_t iwl_dbgfs_sram_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
u32 val;
char buf[1024];
ssize_t ret;
int i;
int pos = 0;
struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
printk(KERN_DEBUG "offset is: 0x%x\tlen is: 0x%x\n",
priv->dbgfs->sram_offset, priv->dbgfs->sram_len);
iwl4965_grab_nic_access(priv);
for (i = priv->dbgfs->sram_len; i > 0; i -= 4) {
val = iwl4965_read_targ_mem(priv, priv->dbgfs->sram_offset + \
priv->dbgfs->sram_len - i);
if (i < 4) {
switch (i) {
case 1:
val &= BYTE1_MASK;
break;
case 2:
val &= BYTE2_MASK;
break;
case 3:
val &= BYTE3_MASK;
break;
}
}
pos += sprintf(buf+pos, "0x%08x ", val);
}
pos += sprintf(buf+pos, "\n");
iwl4965_release_nic_access(priv);
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
return ret;
}
static ssize_t iwl_dbgfs_sram_write(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct iwl_priv *priv = file->private_data;
char buf[64];
int buf_size;
u32 offset, len;
memset(buf, 0, sizeof(buf));
buf_size = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
if (sscanf(buf, "%x,%x", &offset, &len) == 2) {
priv->dbgfs->sram_offset = offset;
priv->dbgfs->sram_len = len;
} else {
priv->dbgfs->sram_offset = 0;
priv->dbgfs->sram_len = 0;
}
return count;
}
static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
struct iwl4965_station_entry *station;
int max_sta = priv->hw_setting.max_stations;
char *buf;
int i, j, pos = 0;
ssize_t ret;
/* Add 30 for initial string */
const size_t bufsz = 30 + sizeof(char) * 500 * (priv->num_stations);
DECLARE_MAC_BUF(mac);
buf = kmalloc(bufsz, GFP_KERNEL);
if(!buf)
return -ENOMEM;
pos += sprintf(buf+pos, "num of stations: %d\n\n",
priv->num_stations);
for (i = 0; i < max_sta; i++) {
station = &priv->stations[i];
if (station->used) {
pos += sprintf(buf+pos, "station %d:\ngeneral data:\n",
i+1);
print_mac(mac, station->sta.sta.addr);
pos += sprintf(buf+pos, "id: %u\n",
station->sta.sta.sta_id);
pos += sprintf(buf+pos, "mode: %u\n",
station->sta.mode);
pos += sprintf(buf+pos, "flags: 0x%x\n",
station->sta.station_flags_msk);
pos += sprintf(buf+pos, "ps_status: %u\n",
station->ps_status);
pos += sprintf(buf+pos, "tid data:\n");
pos += sprintf(buf+pos, "seq_num\t\ttxq_id\t");
pos += sprintf(buf+pos, "frame_count\twait_for_ba\t");
pos += sprintf(buf+pos, "start_idx\tbitmap0\t");
pos += sprintf(buf+pos, "bitmap1\trate_n_flags\n");
for (j = 0; j < MAX_TID_COUNT; j++) {
pos += sprintf(buf+pos, "[%d]:\t\t%u\t",
j, station->tid[j].seq_number);
pos += sprintf(buf+pos, "%u\t\t%u\t\t%u\t\t",
station->tid[j].agg.txq_id,
station->tid[j].agg.frame_count,
station->tid[j].agg.wait_for_ba);
pos += sprintf(buf+pos, "%u\t%llu\t%u\n",
station->tid[j].agg.start_idx,
station->tid[j].agg.bitmap,
station->tid[j].agg.rate_n_flags);
}
pos += sprintf(buf+pos, "\n");
}
}
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
kfree(buf);
return ret;
}
DEBUGFS_READ_WRITE_FILE_OPS(sram);
DEBUGFS_READ_FILE_OPS(stations);
DEBUGFS_READ_FILE_OPS(rx_statistics);
DEBUGFS_READ_FILE_OPS(tx_statistics);
/*
* Create the debugfs files and directories
*
*/
int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
{
struct iwl_debugfs *dbgfs;
dbgfs = kzalloc(sizeof(struct iwl_debugfs), GFP_KERNEL);
if (!dbgfs) {
goto err;
}
priv->dbgfs = dbgfs;
dbgfs->name = name;
dbgfs->dir_drv = debugfs_create_dir(name, NULL);
if (!dbgfs->dir_drv || IS_ERR(dbgfs->dir_drv)){
goto err;
}
DEBUGFS_ADD_DIR(data, dbgfs->dir_drv);
DEBUGFS_ADD_FILE(sram, data);
DEBUGFS_ADD_FILE(stations, data);
DEBUGFS_ADD_FILE(rx_statistics, data);
DEBUGFS_ADD_FILE(tx_statistics, data);
return 0;
err:
IWL_ERROR("Can't open the debugfs directory\n");
iwl_dbgfs_unregister(priv);
return -ENOENT;
}
EXPORT_SYMBOL(iwl_dbgfs_register);
/**
* Remove the debugfs files and directories
*
*/
void iwl_dbgfs_unregister(struct iwl_priv *priv)
{
if (!(priv->dbgfs))
return;
DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_rx_statistics);
DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_tx_statistics);
DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_sram);
DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_stations);
DEBUGFS_REMOVE(priv->dbgfs->dir_data);
DEBUGFS_REMOVE(priv->dbgfs->dir_drv);
kfree(priv->dbgfs);
priv->dbgfs = NULL;
}
EXPORT_SYMBOL(iwl_dbgfs_unregister);
......@@ -71,17 +71,78 @@
#include "iwl-4965-commands.h"
#include "iwl-4965.h"
#include "iwl-core.h"
#include "iwl-4965-debug.h"
#include "iwl-debug.h"
#include "iwl-eeprom.h"
#include "iwl-4965-io.h"
/************************** EEPROM BANDS ****************************
*
* The iwl_eeprom_band definitions below provide the mapping from the
* EEPROM contents to the specific channel number supported for each
* band.
*
* For example, iwl_priv->eeprom.band_3_channels[4] from the band_3
* definition below maps to physical channel 42 in the 5.2GHz spectrum.
* The specific geography and calibration information for that channel
* is contained in the eeprom map itself.
*
* During init, we copy the eeprom information and channel map
* information into priv->channel_info_24/52 and priv->channel_map_24/52
*
* channel_map_24/52 provides the index in the channel_info array for a
* given channel. We have to have two separate maps as there is channel
* overlap with the 2.4GHz and 5.2GHz spectrum as seen in band_1 and
* band_2
*
* A value of 0xff stored in the channel_map indicates that the channel
* is not supported by the hardware at all.
*
* A value of 0xfe in the channel_map indicates that the channel is not
* valid for Tx with the current hardware. This means that
* while the system can tune and receive on a given channel, it may not
* be able to associate or transmit any frames on that
* channel. There is no corresponding channel information for that
* entry.
*
*********************************************************************/
/* 2.4 GHz */
const u8 iwl_eeprom_band_1[14] = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
};
/* 5.2 GHz bands */
static const u8 iwl_eeprom_band_2[] = { /* 4915-5080MHz */
183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16
};
static const u8 iwl_eeprom_band_3[] = { /* 5170-5320MHz */
34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
};
static const u8 iwl_eeprom_band_4[] = { /* 5500-5700MHz */
100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
};
static const u8 iwl_eeprom_band_5[] = { /* 5725-5825MHz */
145, 149, 153, 157, 161, 165
};
static const u8 iwl_eeprom_band_6[] = { /* 2.4 FAT channel */
1, 2, 3, 4, 5, 6, 7
};
static const u8 iwl_eeprom_band_7[] = { /* 5.2 FAT channel */
36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157
};
/******************************************************************************
*
* EEPROM related functions
*
******************************************************************************/
int iwlcore_eeprom_verify_signature(struct iwl4965_priv *priv)
int iwlcore_eeprom_verify_signature(struct iwl_priv *priv)
{
u32 gp = iwl4965_read32(priv, CSR_EEPROM_GP);
if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) {
......@@ -98,7 +159,7 @@ EXPORT_SYMBOL(iwlcore_eeprom_verify_signature);
* EEPROM chip, not a single event, so even reads could conflict if they
* weren't arbitrated by the semaphore.
*/
int iwlcore_eeprom_acquire_semaphore(struct iwl4965_priv *priv)
int iwlcore_eeprom_acquire_semaphore(struct iwl_priv *priv)
{
u16 count;
int ret;
......@@ -124,7 +185,7 @@ int iwlcore_eeprom_acquire_semaphore(struct iwl4965_priv *priv)
}
EXPORT_SYMBOL(iwlcore_eeprom_acquire_semaphore);
void iwlcore_eeprom_release_semaphore(struct iwl4965_priv *priv)
void iwlcore_eeprom_release_semaphore(struct iwl_priv *priv)
{
iwl4965_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
......@@ -140,7 +201,7 @@ EXPORT_SYMBOL(iwlcore_eeprom_release_semaphore);
*
* NOTE: This routine uses the non-debug IO access functions.
*/
int iwl_eeprom_init(struct iwl4965_priv *priv)
int iwl_eeprom_init(struct iwl_priv *priv)
{
u16 *e = (u16 *)&priv->eeprom;
u32 gp = iwl4965_read32(priv, CSR_EEPROM_GP);
......@@ -197,9 +258,304 @@ int iwl_eeprom_init(struct iwl4965_priv *priv)
EXPORT_SYMBOL(iwl_eeprom_init);
void iwl_eeprom_get_mac(const struct iwl4965_priv *priv, u8 *mac)
void iwl_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac)
{
memcpy(mac, priv->eeprom.mac_address, 6);
}
EXPORT_SYMBOL(iwl_eeprom_get_mac);
static void iwl_init_band_reference(const struct iwl_priv *priv,
int band,
int *eeprom_ch_count,
const struct iwl4965_eeprom_channel
**eeprom_ch_info,
const u8 **eeprom_ch_index)
{
switch (band) {
case 1: /* 2.4GHz band */
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_1);
*eeprom_ch_info = priv->eeprom.band_1_channels;
*eeprom_ch_index = iwl_eeprom_band_1;
break;
case 2: /* 4.9GHz band */
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_2);
*eeprom_ch_info = priv->eeprom.band_2_channels;
*eeprom_ch_index = iwl_eeprom_band_2;
break;
case 3: /* 5.2GHz band */
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_3);
*eeprom_ch_info = priv->eeprom.band_3_channels;
*eeprom_ch_index = iwl_eeprom_band_3;
break;
case 4: /* 5.5GHz band */
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_4);
*eeprom_ch_info = priv->eeprom.band_4_channels;
*eeprom_ch_index = iwl_eeprom_band_4;
break;
case 5: /* 5.7GHz band */
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_5);
*eeprom_ch_info = priv->eeprom.band_5_channels;
*eeprom_ch_index = iwl_eeprom_band_5;
break;
case 6: /* 2.4GHz FAT channels */
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_6);
*eeprom_ch_info = priv->eeprom.band_24_channels;
*eeprom_ch_index = iwl_eeprom_band_6;
break;
case 7: /* 5 GHz FAT channels */
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_7);
*eeprom_ch_info = priv->eeprom.band_52_channels;
*eeprom_ch_index = iwl_eeprom_band_7;
break;
default:
BUG();
return;
}
}
#define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \
? # x " " : "")
/**
* iwl4965_set_fat_chan_info - Copy fat channel info into driver's priv.
*
* Does not set up a command, or touch hardware.
*/
static int iwl4965_set_fat_chan_info(struct iwl_priv *priv,
enum ieee80211_band band, u16 channel,
const struct iwl4965_eeprom_channel *eeprom_ch,
u8 fat_extension_channel)
{
struct iwl_channel_info *ch_info;
ch_info = (struct iwl_channel_info *)
iwl_get_channel_info(priv, band, channel);
if (!is_channel_valid(ch_info))
return -1;
IWL_DEBUG_INFO("FAT Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x"
" %ddBm): Ad-Hoc %ssupported\n",
ch_info->channel,
is_channel_a_band(ch_info) ?
"5.2" : "2.4",
CHECK_AND_PRINT(IBSS),
CHECK_AND_PRINT(ACTIVE),
CHECK_AND_PRINT(RADAR),
CHECK_AND_PRINT(WIDE),
CHECK_AND_PRINT(NARROW),
CHECK_AND_PRINT(DFS),
eeprom_ch->flags,
eeprom_ch->max_power_avg,
((eeprom_ch->flags & EEPROM_CHANNEL_IBSS)
&& !(eeprom_ch->flags & EEPROM_CHANNEL_RADAR)) ?
"" : "not ");
ch_info->fat_eeprom = *eeprom_ch;
ch_info->fat_max_power_avg = eeprom_ch->max_power_avg;
ch_info->fat_curr_txpow = eeprom_ch->max_power_avg;
ch_info->fat_min_power = 0;
ch_info->fat_scan_power = eeprom_ch->max_power_avg;
ch_info->fat_flags = eeprom_ch->flags;
ch_info->fat_extension_channel = fat_extension_channel;
return 0;
}
#define CHECK_AND_PRINT_I(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \
? # x " " : "")
/**
* iwl_init_channel_map - Set up driver's info for all possible channels
*/
int iwl_init_channel_map(struct iwl_priv *priv)
{
int eeprom_ch_count = 0;
const u8 *eeprom_ch_index = NULL;
const struct iwl4965_eeprom_channel *eeprom_ch_info = NULL;
int band, ch;
struct iwl_channel_info *ch_info;
if (priv->channel_count) {
IWL_DEBUG_INFO("Channel map already initialized.\n");
return 0;
}
if (priv->eeprom.version < 0x2f) {
IWL_WARNING("Unsupported EEPROM version: 0x%04X\n",
priv->eeprom.version);
return -EINVAL;
}
IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n");
priv->channel_count =
ARRAY_SIZE(iwl_eeprom_band_1) +
ARRAY_SIZE(iwl_eeprom_band_2) +
ARRAY_SIZE(iwl_eeprom_band_3) +
ARRAY_SIZE(iwl_eeprom_band_4) +
ARRAY_SIZE(iwl_eeprom_band_5);
IWL_DEBUG_INFO("Parsing data for %d channels.\n", priv->channel_count);
priv->channel_info = kzalloc(sizeof(struct iwl_channel_info) *
priv->channel_count, GFP_KERNEL);
if (!priv->channel_info) {
IWL_ERROR("Could not allocate channel_info\n");
priv->channel_count = 0;
return -ENOMEM;
}
ch_info = priv->channel_info;
/* Loop through the 5 EEPROM bands adding them in order to the
* channel map we maintain (that contains additional information than
* what just in the EEPROM) */
for (band = 1; band <= 5; band++) {
iwl_init_band_reference(priv, band, &eeprom_ch_count,
&eeprom_ch_info, &eeprom_ch_index);
/* Loop through each band adding each of the channels */
for (ch = 0; ch < eeprom_ch_count; ch++) {
ch_info->channel = eeprom_ch_index[ch];
ch_info->band = (band == 1) ? IEEE80211_BAND_2GHZ :
IEEE80211_BAND_5GHZ;
/* permanently store EEPROM's channel regulatory flags
* and max power in channel info database. */
ch_info->eeprom = eeprom_ch_info[ch];
/* Copy the run-time flags so they are there even on
* invalid channels */
ch_info->flags = eeprom_ch_info[ch].flags;
if (!(is_channel_valid(ch_info))) {
IWL_DEBUG_INFO("Ch. %d Flags %x [%sGHz] - "
"No traffic\n",
ch_info->channel,
ch_info->flags,
is_channel_a_band(ch_info) ?
"5.2" : "2.4");
ch_info++;
continue;
}
/* Initialize regulatory-based run-time data */
ch_info->max_power_avg = ch_info->curr_txpow =
eeprom_ch_info[ch].max_power_avg;
ch_info->scan_power = eeprom_ch_info[ch].max_power_avg;
ch_info->min_power = 0;
IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s%s(0x%02x"
" %ddBm): Ad-Hoc %ssupported\n",
ch_info->channel,
is_channel_a_band(ch_info) ?
"5.2" : "2.4",
CHECK_AND_PRINT_I(VALID),
CHECK_AND_PRINT_I(IBSS),
CHECK_AND_PRINT_I(ACTIVE),
CHECK_AND_PRINT_I(RADAR),
CHECK_AND_PRINT_I(WIDE),
CHECK_AND_PRINT_I(NARROW),
CHECK_AND_PRINT_I(DFS),
eeprom_ch_info[ch].flags,
eeprom_ch_info[ch].max_power_avg,
((eeprom_ch_info[ch].
flags & EEPROM_CHANNEL_IBSS)
&& !(eeprom_ch_info[ch].
flags & EEPROM_CHANNEL_RADAR))
? "" : "not ");
/* Set the user_txpower_limit to the highest power
* supported by any channel */
if (eeprom_ch_info[ch].max_power_avg >
priv->user_txpower_limit)
priv->user_txpower_limit =
eeprom_ch_info[ch].max_power_avg;
ch_info++;
}
}
/* Two additional EEPROM bands for 2.4 and 5 GHz FAT channels */
for (band = 6; band <= 7; band++) {
enum ieee80211_band ieeeband;
u8 fat_extension_chan;
iwl_init_band_reference(priv, band, &eeprom_ch_count,
&eeprom_ch_info, &eeprom_ch_index);
/* EEPROM band 6 is 2.4, band 7 is 5 GHz */
ieeeband =
(band == 6) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
/* Loop through each band adding each of the channels */
for (ch = 0; ch < eeprom_ch_count; ch++) {
if ((band == 6) &&
((eeprom_ch_index[ch] == 5) ||
(eeprom_ch_index[ch] == 6) ||
(eeprom_ch_index[ch] == 7)))
fat_extension_chan = HT_IE_EXT_CHANNEL_MAX;
else
fat_extension_chan = HT_IE_EXT_CHANNEL_ABOVE;
/* Set up driver's info for lower half */
iwl4965_set_fat_chan_info(priv, ieeeband,
eeprom_ch_index[ch],
&(eeprom_ch_info[ch]),
fat_extension_chan);
/* Set up driver's info for upper half */
iwl4965_set_fat_chan_info(priv, ieeeband,
(eeprom_ch_index[ch] + 4),
&(eeprom_ch_info[ch]),
HT_IE_EXT_CHANNEL_BELOW);
}
}
return 0;
}
EXPORT_SYMBOL(iwl_init_channel_map);
/*
* iwl_free_channel_map - undo allocations in iwl4965_init_channel_map
*/
void iwl_free_channel_map(struct iwl_priv *priv)
{
kfree(priv->channel_info);
priv->channel_count = 0;
}
EXPORT_SYMBOL(iwl_free_channel_map);
/**
* iwl_get_channel_info - Find driver's private channel info
*
* Based on band and channel number.
*/
const struct iwl_channel_info *iwl_get_channel_info(
const struct iwl_priv *priv,
enum ieee80211_band band, u16 channel)
{
int i;
switch (band) {
case IEEE80211_BAND_5GHZ:
for (i = 14; i < priv->channel_count; i++) {
if (priv->channel_info[i].channel == channel)
return &priv->channel_info[i];
}
break;
case IEEE80211_BAND_2GHZ:
if (channel >= 1 && channel <= 14)
return &priv->channel_info[channel - 1];
break;
default:
BUG();
}
return NULL;
}
EXPORT_SYMBOL(iwl_get_channel_info);
......@@ -63,7 +63,7 @@
#ifndef __iwl_eeprom_h__
#define __iwl_eeprom_h__
struct iwl4965_priv;
struct iwl_priv;
/*
* EEPROM access time values:
......@@ -137,6 +137,8 @@ struct iwl4965_eeprom_channel {
* Look for this in calib_version member of struct iwl4965_eeprom. */
#define EEPROM_TX_POWER_VERSION_NEW (5)
/* 2.4 GHz */
extern const u8 iwl_eeprom_band_1[14];
/*
* 4965 factory calibration data for one txpower level, on one channel,
......@@ -228,49 +230,31 @@ struct iwl4965_eeprom_calib_info {
*/
struct iwl4965_eeprom {
u8 reserved0[16];
#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */
u16 device_id; /* abs.ofs: 16 */
u8 reserved1[2];
#define EEPROM_PMC (2*0x0A) /* 2 bytes */
u16 pmc; /* abs.ofs: 20 */
u8 reserved2[20];
#define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */
u8 mac_address[6]; /* abs.ofs: 42 */
u8 reserved3[58];
#define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */
u16 board_revision; /* abs.ofs: 106 */
u8 reserved4[11];
#define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */
u8 board_pba_number[9]; /* abs.ofs: 119 */
u8 reserved5[8];
#define EEPROM_VERSION (2*0x44) /* 2 bytes */
u16 version; /* abs.ofs: 136 */
#define EEPROM_SKU_CAP (2*0x45) /* 1 bytes */
u8 sku_cap; /* abs.ofs: 138 */
#define EEPROM_LEDS_MODE (2*0x45+1) /* 1 bytes */
u8 leds_mode; /* abs.ofs: 139 */
#define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */
u16 oem_mode;
#define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */
u16 wowlan_mode; /* abs.ofs: 142 */
#define EEPROM_LEDS_TIME_INTERVAL (2*0x48) /* 2 bytes */
u16 leds_time_interval; /* abs.ofs: 144 */
#define EEPROM_LEDS_OFF_TIME (2*0x49) /* 1 bytes */
u8 leds_off_time; /* abs.ofs: 146 */
#define EEPROM_LEDS_ON_TIME (2*0x49+1) /* 1 bytes */
u8 leds_on_time; /* abs.ofs: 147 */
#define EEPROM_ALMGOR_M_VERSION (2*0x4A) /* 1 bytes */
u8 almgor_m_version; /* abs.ofs: 148 */
#define EEPROM_ANTENNA_SWITCH_TYPE (2*0x4A+1) /* 1 bytes */
u8 antenna_switch_type; /* abs.ofs: 149 */
u8 reserved6[8];
#define EEPROM_4965_BOARD_REVISION (2*0x4F) /* 2 bytes */
u16 board_revision_4965; /* abs.ofs: 158 */
u8 reserved7[13];
#define EEPROM_4965_BOARD_PBA (2*0x56+1) /* 9 bytes */
u8 board_pba_number_4965[9]; /* abs.ofs: 173 */
u8 reserved8[10];
#define EEPROM_REGULATORY_SKU_ID (2*0x60) /* 4 bytes */
u8 sku_id[4]; /* abs.ofs: 192 */
/*
......@@ -285,9 +269,7 @@ struct iwl4965_eeprom {
*
* 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
*/
#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 iwl4965_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */
/*
......@@ -295,36 +277,28 @@ struct iwl4965_eeprom {
* 5.0 GHz channels 7, 8, 11, 12, 16
* (4915-5080MHz) (none of these is ever supported)
*/
#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 iwl4965_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
/*
* 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
* (5170-5320MHz)
*/
#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 iwl4965_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
/*
* 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
* (5500-5700MHz)
*/
#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 iwl4965_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
/*
* 5.7 GHz channels 145, 149, 153, 157, 161, 165
* (5725-5825MHz)
*/
#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 iwl4965_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
u8 reserved10[2];
......@@ -345,7 +319,6 @@ struct iwl4965_eeprom {
*
* NOTE: 4965 does not support FAT channels on 2.4 GHz.
*/
#define EEPROM_REGULATORY_BAND_24_FAT_CHANNELS (2*0xA0) /* 14 bytes */
struct iwl4965_eeprom_channel band_24_channels[7]; /* abs.ofs: 320 */
u8 reserved11[2];
......@@ -353,7 +326,6 @@ struct iwl4965_eeprom {
* 5.2 GHz FAT channels 36 (40), 44 (48), 52 (56), 60 (64),
* 100 (104), 108 (112), 116 (120), 124 (128), 132 (136), 149 (153), 157 (161)
*/
#define EEPROM_REGULATORY_BAND_52_FAT_CHANNELS (2*0xA8) /* 22 bytes */
struct iwl4965_eeprom_channel band_52_channels[11]; /* abs.ofs: 336 */
u8 reserved12[6];
......@@ -362,7 +334,6 @@ struct iwl4965_eeprom {
* Driver does not work with txpower calibration version < 5.
* This value is simply a 16-bit number, no major/minor versions here.
*/
#define EEPROM_CALIB_VERSION_OFFSET (2*0xB6) /* 2 bytes */
u16 calib_version; /* abs.ofs: 364 */
u8 reserved13[2];
u8 reserved14[96]; /* abs.ofs: 368 */
......@@ -370,7 +341,6 @@ struct iwl4965_eeprom {
/*
* 4965 Txpower calibration data.
*/
#define EEPROM_IWL_CALIB_TXPOWER_OFFSET (2*0xE8) /* 48 bytes */
struct iwl4965_eeprom_calib_info calib_info; /* abs.ofs: 464 */
u8 reserved16[140]; /* fill out to full 1024 byte block */
......@@ -383,17 +353,23 @@ struct iwl4965_eeprom {
/* End of EEPROM */
struct iwl_eeprom_ops {
int (*verify_signature) (struct iwl4965_priv *priv);
int (*acquire_semaphore) (struct iwl4965_priv *priv);
void (*release_semaphore) (struct iwl4965_priv *priv);
int (*verify_signature) (struct iwl_priv *priv);
int (*acquire_semaphore) (struct iwl_priv *priv);
void (*release_semaphore) (struct iwl_priv *priv);
};
void iwl_eeprom_get_mac(const struct iwl4965_priv *priv, u8 *mac);
int iwl_eeprom_init(struct iwl4965_priv *priv);
void iwl_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac);
int iwl_eeprom_init(struct iwl_priv *priv);
int iwlcore_eeprom_verify_signature(struct iwl4965_priv *priv);
int iwlcore_eeprom_acquire_semaphore(struct iwl4965_priv *priv);
void iwlcore_eeprom_release_semaphore(struct iwl4965_priv *priv);
int iwlcore_eeprom_verify_signature(struct iwl_priv *priv);
int iwlcore_eeprom_acquire_semaphore(struct iwl_priv *priv);
void iwlcore_eeprom_release_semaphore(struct iwl_priv *priv);
int iwl_init_channel_map(struct iwl_priv *priv);
void iwl_free_channel_map(struct iwl_priv *priv);
const struct iwl_channel_info *iwl_get_channel_info(
const struct iwl_priv *priv,
enum ieee80211_band band, u16 channel);
#endif /* __iwl_eeprom_h__ */
/******************************************************************************
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2008 Intel Corporation. All rights reserved.
*
* 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.GPL.
*
* Contact Information:
* Tomas Winkler <tomas.winkler@intel.com>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*****************************************************************************/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/version.h>
#include <net/mac80211.h>
#include "iwl-4965.h" /* FIXME: remove */
#include "iwl-debug.h"
#include "iwl-eeprom.h"
#include "iwl-core.h"
#define IWL_CMD(x) case x : return #x
const char *get_cmd_string(u8 cmd)
{
switch (cmd) {
IWL_CMD(REPLY_ALIVE);
IWL_CMD(REPLY_ERROR);
IWL_CMD(REPLY_RXON);
IWL_CMD(REPLY_RXON_ASSOC);
IWL_CMD(REPLY_QOS_PARAM);
IWL_CMD(REPLY_RXON_TIMING);
IWL_CMD(REPLY_ADD_STA);
IWL_CMD(REPLY_REMOVE_STA);
IWL_CMD(REPLY_REMOVE_ALL_STA);
IWL_CMD(REPLY_TX);
IWL_CMD(REPLY_RATE_SCALE);
IWL_CMD(REPLY_LEDS_CMD);
IWL_CMD(REPLY_TX_LINK_QUALITY_CMD);
IWL_CMD(RADAR_NOTIFICATION);
IWL_CMD(REPLY_QUIET_CMD);
IWL_CMD(REPLY_CHANNEL_SWITCH);
IWL_CMD(CHANNEL_SWITCH_NOTIFICATION);
IWL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD);
IWL_CMD(SPECTRUM_MEASURE_NOTIFICATION);
IWL_CMD(POWER_TABLE_CMD);
IWL_CMD(PM_SLEEP_NOTIFICATION);
IWL_CMD(PM_DEBUG_STATISTIC_NOTIFIC);
IWL_CMD(REPLY_SCAN_CMD);
IWL_CMD(REPLY_SCAN_ABORT_CMD);
IWL_CMD(SCAN_START_NOTIFICATION);
IWL_CMD(SCAN_RESULTS_NOTIFICATION);
IWL_CMD(SCAN_COMPLETE_NOTIFICATION);
IWL_CMD(BEACON_NOTIFICATION);
IWL_CMD(REPLY_TX_BEACON);
IWL_CMD(WHO_IS_AWAKE_NOTIFICATION);
IWL_CMD(QUIET_NOTIFICATION);
IWL_CMD(REPLY_TX_PWR_TABLE_CMD);
IWL_CMD(MEASURE_ABORT_NOTIFICATION);
IWL_CMD(REPLY_BT_CONFIG);
IWL_CMD(REPLY_STATISTICS_CMD);
IWL_CMD(STATISTICS_NOTIFICATION);
IWL_CMD(REPLY_CARD_STATE_CMD);
IWL_CMD(CARD_STATE_NOTIFICATION);
IWL_CMD(MISSED_BEACONS_NOTIFICATION);
IWL_CMD(REPLY_CT_KILL_CONFIG_CMD);
IWL_CMD(SENSITIVITY_CMD);
IWL_CMD(REPLY_PHY_CALIBRATION_CMD);
IWL_CMD(REPLY_RX_PHY_CMD);
IWL_CMD(REPLY_RX_MPDU_CMD);
IWL_CMD(REPLY_RX);
IWL_CMD(REPLY_COMPRESSED_BA);
default:
return "UNKNOWN";
}
}
EXPORT_SYMBOL(get_cmd_string);
#define HOST_COMPLETE_TIMEOUT (HZ / 2)
static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
{
int ret;
BUG_ON(!(cmd->meta.flags & CMD_ASYNC));
/* An asynchronous command can not expect an SKB to be set. */
BUG_ON(cmd->meta.flags & CMD_WANT_SKB);
/* An asynchronous command MUST have a callback. */
BUG_ON(!cmd->meta.u.callback);
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return -EBUSY;
ret = priv->cfg->ops->utils->enqueue_hcmd(priv, cmd);
if (ret < 0) {
IWL_ERROR("Error sending %s: enqueue_hcmd failed: %d\n",
get_cmd_string(cmd->id), ret);
return ret;
}
return 0;
}
int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
{
int cmd_idx;
int ret;
static atomic_t entry = ATOMIC_INIT(0); /* reentrance protection */
BUG_ON(cmd->meta.flags & CMD_ASYNC);
/* A synchronous command can not have a callback set. */
BUG_ON(cmd->meta.u.callback != NULL);
if (atomic_xchg(&entry, 1)) {
IWL_ERROR("Error sending %s: Already sending a host command\n",
get_cmd_string(cmd->id));
return -EBUSY;
}
set_bit(STATUS_HCMD_ACTIVE, &priv->status);
if (cmd->meta.flags & CMD_WANT_SKB)
cmd->meta.source = &cmd->meta;
cmd_idx = priv->cfg->ops->utils->enqueue_hcmd(priv, cmd);
if (cmd_idx < 0) {
ret = cmd_idx;
IWL_ERROR("Error sending %s: enqueue_hcmd failed: %d\n",
get_cmd_string(cmd->id), ret);
goto out;
}
ret = wait_event_interruptible_timeout(priv->wait_command_queue,
!test_bit(STATUS_HCMD_ACTIVE, &priv->status),
HOST_COMPLETE_TIMEOUT);
if (!ret) {
if (test_bit(STATUS_HCMD_ACTIVE, &priv->status)) {
IWL_ERROR("Error sending %s: time out after %dms.\n",
get_cmd_string(cmd->id),
jiffies_to_msecs(HOST_COMPLETE_TIMEOUT));
clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
ret = -ETIMEDOUT;
goto cancel;
}
}
if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
IWL_DEBUG_INFO("Command %s aborted: RF KILL Switch\n",
get_cmd_string(cmd->id));
ret = -ECANCELED;
goto fail;
}
if (test_bit(STATUS_FW_ERROR, &priv->status)) {
IWL_DEBUG_INFO("Command %s failed: FW Error\n",
get_cmd_string(cmd->id));
ret = -EIO;
goto fail;
}
if ((cmd->meta.flags & CMD_WANT_SKB) && !cmd->meta.u.skb) {
IWL_ERROR("Error: Response NULL in '%s'\n",
get_cmd_string(cmd->id));
ret = -EIO;
goto out;
}
ret = 0;
goto out;
cancel:
if (cmd->meta.flags & CMD_WANT_SKB) {
struct iwl_cmd *qcmd;
/* Cancel the CMD_WANT_SKB flag for the cmd in the
* TX cmd queue. Otherwise in case the cmd comes
* in later, it will possibly set an invalid
* address (cmd->meta.source). */
qcmd = &priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_idx];
qcmd->meta.flags &= ~CMD_WANT_SKB;
}
fail:
if (cmd->meta.u.skb) {
dev_kfree_skb_any(cmd->meta.u.skb);
cmd->meta.u.skb = NULL;
}
out:
atomic_set(&entry, 0);
return ret;
}
EXPORT_SYMBOL(iwl_send_cmd_sync);
int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
{
if (cmd->meta.flags & CMD_ASYNC)
return iwl_send_cmd_async(priv, cmd);
return iwl_send_cmd_sync(priv, cmd);
}
EXPORT_SYMBOL(iwl_send_cmd);
int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data)
{
struct iwl_host_cmd cmd = {
.id = id,
.len = len,
.data = data,
};
return iwl_send_cmd_sync(priv, &cmd);
}
EXPORT_SYMBOL(iwl_send_cmd_pdu);
int iwl_send_cmd_pdu_async(struct iwl_priv *priv,
u8 id, u16 len, const void *data,
int (*callback)(struct iwl_priv *priv,
struct iwl_cmd *cmd,
struct sk_buff *skb))
{
struct iwl_host_cmd cmd = {
.id = id,
.len = len,
.data = data,
};
cmd.meta.flags |= CMD_ASYNC;
cmd.meta.u.callback = callback;
return iwl_send_cmd_async(priv, &cmd);
}
EXPORT_SYMBOL(iwl_send_cmd_pdu_async);
......@@ -79,7 +79,7 @@ static u8 *lbs_code_2_region(u8 code)
* @param nrchan number of channels
* @return the nrchan-th chan number
*/
static u8 lbs_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 *chan)
static u8 lbs_get_chan_11d(u8 firstchan, u8 nrchan, u8 *chan)
/*find the nrchan-th chan after the firstchan*/
{
u8 i;
......@@ -134,7 +134,7 @@ static u8 lbs_channel_known_11d(u8 chan,
return 0;
}
u32 lbs_chan_2_freq(u8 chan, u8 band)
u32 lbs_chan_2_freq(u8 chan)
{
struct chan_freq_power *cf;
u16 i;
......@@ -264,7 +264,7 @@ static void lbs_generate_parsed_region_chan_11d(struct region_channel *region_ch
* @param chan chan
* @return TRUE;FALSE
*/
static u8 lbs_region_chan_supported_11d(u8 region, u8 band, u8 chan)
static u8 lbs_region_chan_supported_11d(u8 region, u8 chan)
{
struct chan_freq_power *cfp;
int cfp_no;
......@@ -273,7 +273,7 @@ static u8 lbs_region_chan_supported_11d(u8 region, u8 band, u8 chan)
lbs_deb_enter(LBS_DEB_11D);
cfp = lbs_get_region_cfp_table(region, band, &cfp_no);
cfp = lbs_get_region_cfp_table(region, &cfp_no);
if (cfp == NULL)
return 0;
......@@ -367,7 +367,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
for (i = 0; idx < MAX_NO_OF_CHAN && i < nrchan; i++) {
/*step4: channel is supported? */
if (!lbs_get_chan_11d(band, firstchan, i, &curchan)) {
if (!lbs_get_chan_11d(firstchan, i, &curchan)) {
/* Chan is not found in UN table */
lbs_deb_11d("chan is not supported: %d \n", i);
break;
......@@ -375,8 +375,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
lastchan = curchan;
if (lbs_region_chan_supported_11d
(region, band, curchan)) {
if (lbs_region_chan_supported_11d(region, curchan)) {
/*step5: Check if curchan is supported by mrvl in region */
parsed_region_chan->chanpwr[idx].chan = curchan;
parsed_region_chan->chanpwr[idx].pwr =
......@@ -554,8 +553,7 @@ int lbs_cmd_802_11d_domain_info(struct lbs_private *priv,
* @param resp pointer to command response buffer
* @return 0; -1
*/
int lbs_ret_802_11d_domain_info(struct lbs_private *priv,
struct cmd_ds_command *resp)
int lbs_ret_802_11d_domain_info(struct cmd_ds_command *resp)
{
struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp;
struct mrvlietypes_domainparamset *domain = &domaininfo->domain;
......
......@@ -83,7 +83,7 @@ struct lbs_private;
u8 lbs_get_scan_type_11d(u8 chan,
struct parsed_region_chan_11d *parsed_region_chan);
u32 lbs_chan_2_freq(u8 chan, u8 band);
u32 lbs_chan_2_freq(u8 chan);
void lbs_init_11d(struct lbs_private *priv);
......@@ -93,8 +93,7 @@ int lbs_cmd_802_11d_domain_info(struct lbs_private *priv,
struct cmd_ds_command *cmd, u16 cmdno,
u16 cmdOption);
int lbs_ret_802_11d_domain_info(struct lbs_private *priv,
struct cmd_ds_command *resp);
int lbs_ret_802_11d_domain_info(struct cmd_ds_command *resp);
struct bss_descriptor;
int lbs_parse_dnld_countryinfo_11d(struct lbs_private *priv,
......
......@@ -268,13 +268,11 @@ static int assoc_helper_wep_keys(struct lbs_private *priv,
/* enable/disable the MAC's WEP packet filter */
if (assoc_req->secinfo.wep_enabled)
priv->currentpacketfilter |= CMD_ACT_MAC_WEP_ENABLE;
priv->mac_control |= CMD_ACT_MAC_WEP_ENABLE;
else
priv->currentpacketfilter &= ~CMD_ACT_MAC_WEP_ENABLE;
priv->mac_control &= ~CMD_ACT_MAC_WEP_ENABLE;
ret = lbs_set_mac_packet_filter(priv);
if (ret)
goto out;
lbs_set_mac_control(priv);
mutex_lock(&priv->lock);
......@@ -304,9 +302,7 @@ static int assoc_helper_secinfo(struct lbs_private *priv,
memcpy(&priv->secinfo, &assoc_req->secinfo,
sizeof(struct lbs_802_11_security));
ret = lbs_set_mac_packet_filter(priv);
if (ret)
goto out;
lbs_set_mac_control(priv);
/* If RSN is already enabled, don't try to enable it again, since
* ENABLE_RSN resets internal state machines and will clobber the
......@@ -628,10 +624,6 @@ void lbs_association_worker(struct work_struct *work)
lbs_prepare_and_send_command(priv,
CMD_802_11_RSSI,
0, CMD_OPTION_WAITFORRSP, 0, NULL);
lbs_prepare_and_send_command(priv,
CMD_802_11_GET_LOG,
0, CMD_OPTION_WAITFORRSP, 0, NULL);
} else {
ret = -1;
}
......
......@@ -14,9 +14,46 @@
#include "cmd.h"
static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv);
static void lbs_set_cmd_ctrl_node(struct lbs_private *priv,
struct cmd_ctrl_node *ptempnode,
void *pdata_buf);
/**
* @brief Simple callback that copies response back into command
*
* @param priv A pointer to struct lbs_private structure
* @param extra A pointer to the original command structure for which
* 'resp' is a response
* @param resp A pointer to the command response
*
* @return 0 on success, error on failure
*/
int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
struct cmd_header *resp)
{
struct cmd_header *buf = (void *)extra;
uint16_t copy_len;
copy_len = min(le16_to_cpu(buf->size), le16_to_cpu(resp->size));
memcpy(buf, resp, copy_len);
return 0;
}
EXPORT_SYMBOL_GPL(lbs_cmd_copyback);
/**
* @brief Simple callback that ignores the result. Use this if
* you just want to send a command to the hardware, but don't
* care for the result.
*
* @param priv ignored
* @param extra ignored
* @param resp ignored
*
* @return 0 for success
*/
static int lbs_cmd_async_callback(struct lbs_private *priv, unsigned long extra,
struct cmd_header *resp)
{
return 0;
}
/**
......@@ -143,8 +180,7 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria)
}
EXPORT_SYMBOL_GPL(lbs_host_sleep_cfg);
static int lbs_cmd_802_11_ps_mode(struct lbs_private *priv,
struct cmd_ds_command *cmd,
static int lbs_cmd_802_11_ps_mode(struct cmd_ds_command *cmd,
u16 cmd_action)
{
struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode;
......@@ -439,8 +475,7 @@ int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action,
return ret;
}
static int lbs_cmd_802_11_reset(struct lbs_private *priv,
struct cmd_ds_command *cmd, int cmd_action)
static int lbs_cmd_802_11_reset(struct cmd_ds_command *cmd, int cmd_action)
{
struct cmd_ds_802_11_reset *reset = &cmd->params.reset;
......@@ -454,30 +489,6 @@ static int lbs_cmd_802_11_reset(struct lbs_private *priv,
return 0;
}
static int lbs_cmd_802_11_get_log(struct lbs_private *priv,
struct cmd_ds_command *cmd)
{
lbs_deb_enter(LBS_DEB_CMD);
cmd->command = cpu_to_le16(CMD_802_11_GET_LOG);
cmd->size =
cpu_to_le16(sizeof(struct cmd_ds_802_11_get_log) + S_DS_GEN);
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
static int lbs_cmd_802_11_get_stat(struct lbs_private *priv,
struct cmd_ds_command *cmd)
{
lbs_deb_enter(LBS_DEB_CMD);
cmd->command = cpu_to_le16(CMD_802_11_GET_STAT);
cmd->size =
cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) + S_DS_GEN);
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv,
struct cmd_ds_command *cmd,
int cmd_action,
......@@ -598,8 +609,7 @@ static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv,
return 0;
}
static int lbs_cmd_802_11_rf_tx_power(struct lbs_private *priv,
struct cmd_ds_command *cmd,
static int lbs_cmd_802_11_rf_tx_power(struct cmd_ds_command *cmd,
u16 cmd_action, void *pdata_buf)
{
......@@ -642,8 +652,7 @@ static int lbs_cmd_802_11_rf_tx_power(struct lbs_private *priv,
return 0;
}
static int lbs_cmd_802_11_monitor_mode(struct lbs_private *priv,
struct cmd_ds_command *cmd,
static int lbs_cmd_802_11_monitor_mode(struct cmd_ds_command *cmd,
u16 cmd_action, void *pdata_buf)
{
struct cmd_ds_802_11_monitor_mode *monitor = &cmd->params.monitor;
......@@ -870,8 +879,7 @@ static int lbs_cmd_802_11_rssi(struct lbs_private *priv,
return 0;
}
static int lbs_cmd_reg_access(struct lbs_private *priv,
struct cmd_ds_command *cmdptr,
static int lbs_cmd_reg_access(struct cmd_ds_command *cmdptr,
u8 cmd_action, void *pdata_buf)
{
struct lbs_offset_value *offval;
......@@ -968,9 +976,8 @@ static int lbs_cmd_802_11_mac_address(struct lbs_private *priv,
return 0;
}
static int lbs_cmd_802_11_eeprom_access(struct lbs_private *priv,
struct cmd_ds_command *cmd,
int cmd_action, void *pdata_buf)
static int lbs_cmd_802_11_eeprom_access(struct cmd_ds_command *cmd,
void *pdata_buf)
{
struct lbs_ioctl_regrdwr *ea = pdata_buf;
......@@ -990,8 +997,7 @@ static int lbs_cmd_802_11_eeprom_access(struct lbs_private *priv,
return 0;
}
static int lbs_cmd_bt_access(struct lbs_private *priv,
struct cmd_ds_command *cmd,
static int lbs_cmd_bt_access(struct cmd_ds_command *cmd,
u16 cmd_action, void *pdata_buf)
{
struct cmd_ds_bt_access *bt_access = &cmd->params.bt;
......@@ -1028,8 +1034,7 @@ static int lbs_cmd_bt_access(struct lbs_private *priv,
return 0;
}
static int lbs_cmd_fwt_access(struct lbs_private *priv,
struct cmd_ds_command *cmd,
static int lbs_cmd_fwt_access(struct cmd_ds_command *cmd,
u16 cmd_action, void *pdata_buf)
{
struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt;
......@@ -1200,24 +1205,6 @@ static void lbs_submit_command(struct lbs_private *priv,
lbs_deb_leave(LBS_DEB_HOST);
}
static int lbs_cmd_mac_control(struct lbs_private *priv,
struct cmd_ds_command *cmd)
{
struct cmd_ds_mac_control *mac = &cmd->params.macctrl;
lbs_deb_enter(LBS_DEB_CMD);
cmd->command = cpu_to_le16(CMD_MAC_CONTROL);
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN);
mac->action = cpu_to_le16(priv->currentpacketfilter);
lbs_deb_cmd("MAC_CONTROL: action 0x%04x, size %d\n",
le16_to_cpu(mac->action), le16_to_cpu(cmd->size));
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
/**
* This function inserts command node to cmdfreeq
* after cleans it. Requires priv->driver_lock held.
......@@ -1260,7 +1247,7 @@ void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd,
cmd->cmdwaitqwoken = 1;
wake_up_interruptible(&cmd->cmdwait_q);
if (!cmd->callback)
if (!cmd->callback || cmd->callback == lbs_cmd_async_callback)
__lbs_cleanup_and_insert_cmd(priv, cmd);
priv->cur_cmd = NULL;
}
......@@ -1304,18 +1291,20 @@ int lbs_set_radio_control(struct lbs_private *priv)
return ret;
}
int lbs_set_mac_packet_filter(struct lbs_private *priv)
void lbs_set_mac_control(struct lbs_private *priv)
{
int ret = 0;
struct cmd_ds_mac_control cmd;
lbs_deb_enter(LBS_DEB_CMD);
/* Send MAC control command to station */
ret = lbs_prepare_and_send_command(priv,
CMD_MAC_CONTROL, 0, 0, 0, NULL);
cmd.hdr.size = cpu_to_le16(sizeof(cmd));
cmd.action = cpu_to_le16(priv->mac_control);
cmd.reserved = 0;
lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
lbs_cmd_async(priv, CMD_MAC_CONTROL,
&cmd.hdr, sizeof(cmd));
lbs_deb_leave(LBS_DEB_CMD);
}
/**
......@@ -1364,7 +1353,8 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
goto done;
}
lbs_set_cmd_ctrl_node(priv, cmdnode, pdata_buf);
cmdnode->callback = NULL;
cmdnode->callback_arg = (unsigned long)pdata_buf;
cmdptr = (struct cmd_ds_command *)cmdnode->cmdbuf;
......@@ -1379,11 +1369,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
switch (cmd_no) {
case CMD_802_11_PS_MODE:
ret = lbs_cmd_802_11_ps_mode(priv, cmdptr, cmd_action);
break;
case CMD_MAC_CONTROL:
ret = lbs_cmd_mac_control(priv, cmdptr);
ret = lbs_cmd_802_11_ps_mode(cmdptr, cmd_action);
break;
case CMD_802_11_ASSOCIATE:
......@@ -1398,25 +1384,15 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
case CMD_802_11_AD_HOC_START:
ret = lbs_cmd_80211_ad_hoc_start(priv, cmdptr, pdata_buf);
break;
case CMD_CODE_DNLD:
break;
case CMD_802_11_RESET:
ret = lbs_cmd_802_11_reset(priv, cmdptr, cmd_action);
break;
case CMD_802_11_GET_LOG:
ret = lbs_cmd_802_11_get_log(priv, cmdptr);
ret = lbs_cmd_802_11_reset(cmdptr, cmd_action);
break;
case CMD_802_11_AUTHENTICATE:
ret = lbs_cmd_80211_authenticate(priv, cmdptr, pdata_buf);
break;
case CMD_802_11_GET_STAT:
ret = lbs_cmd_802_11_get_stat(priv, cmdptr);
break;
case CMD_802_11_SNMP_MIB:
ret = lbs_cmd_802_11_snmp_mib(priv, cmdptr,
cmd_action, cmd_oid, pdata_buf);
......@@ -1425,12 +1401,12 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
case CMD_MAC_REG_ACCESS:
case CMD_BBP_REG_ACCESS:
case CMD_RF_REG_ACCESS:
ret = lbs_cmd_reg_access(priv, cmdptr, cmd_action, pdata_buf);
ret = lbs_cmd_reg_access(cmdptr, cmd_action, pdata_buf);
break;
case CMD_802_11_RF_TX_POWER:
ret = lbs_cmd_802_11_rf_tx_power(priv, cmdptr,
cmd_action, pdata_buf);
ret = lbs_cmd_802_11_rf_tx_power(cmdptr,
cmd_action, pdata_buf);
break;
case CMD_802_11_RATE_ADAPT_RATESET:
......@@ -1443,7 +1419,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
break;
case CMD_802_11_MONITOR_MODE:
ret = lbs_cmd_802_11_monitor_mode(priv, cmdptr,
ret = lbs_cmd_802_11_monitor_mode(cmdptr,
cmd_action, pdata_buf);
break;
......@@ -1456,12 +1432,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
break;
case CMD_802_11_AD_HOC_STOP:
ret = lbs_cmd_80211_ad_hoc_stop(priv, cmdptr);
break;
case CMD_802_11_PAIRWISE_TSC:
break;
case CMD_802_11_GROUP_TSC:
ret = lbs_cmd_80211_ad_hoc_stop(cmdptr);
break;
case CMD_802_11_MAC_ADDRESS:
......@@ -1469,8 +1440,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
break;
case CMD_802_11_EEPROM_ACCESS:
ret = lbs_cmd_802_11_eeprom_access(priv, cmdptr,
cmd_action, pdata_buf);
ret = lbs_cmd_802_11_eeprom_access(cmdptr, pdata_buf);
break;
case CMD_802_11_SET_AFC:
......@@ -1537,11 +1507,11 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
ret = 0;
break;
case CMD_BT_ACCESS:
ret = lbs_cmd_bt_access(priv, cmdptr, cmd_action, pdata_buf);
ret = lbs_cmd_bt_access(cmdptr, cmd_action, pdata_buf);
break;
case CMD_FWT_ACCESS:
ret = lbs_cmd_fwt_access(priv, cmdptr, cmd_action, pdata_buf);
ret = lbs_cmd_fwt_access(cmdptr, cmd_action, pdata_buf);
break;
case CMD_GET_TSF:
......@@ -1713,36 +1683,6 @@ static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv)
return tempnode;
}
/**
* @brief This function cleans command node.
*
* @param ptempnode A pointer to cmdCtrlNode structure
* @return n/a
*/
/**
* @brief This function initializes the command node.
*
* @param priv A pointer to struct lbs_private structure
* @param ptempnode A pointer to cmd_ctrl_node structure
* @param pdata_buf A pointer to informaion buffer
* @return 0 or -1
*/
static void lbs_set_cmd_ctrl_node(struct lbs_private *priv,
struct cmd_ctrl_node *ptempnode,
void *pdata_buf)
{
lbs_deb_enter(LBS_DEB_HOST);
if (!ptempnode)
return;
ptempnode->callback = NULL;
ptempnode->callback_arg = (unsigned long)pdata_buf;
lbs_deb_leave(LBS_DEB_HOST);
}
/**
* @brief This function executes next command in command
* pending queue. It will put fimware back to PS mode
......@@ -1930,10 +1870,6 @@ static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size)
int ret = 0;
lbs_deb_enter(LBS_DEB_HOST);
lbs_deb_host("SEND_SLEEPC_CMD: before download, cmd size %d\n",
size);
lbs_deb_hex(LBS_DEB_HOST, "sleep confirm command", cmdptr, size);
ret = priv->hw_host_to_card(priv, MVMS_CMD, cmdptr, size);
......@@ -1956,8 +1892,6 @@ static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size)
priv->intcounter);
}
spin_unlock_irqrestore(&priv->driver_lock, flags);
lbs_deb_host("SEND_SLEEPC_CMD: sent confirm sleep\n");
}
lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
......@@ -2009,10 +1943,10 @@ void lbs_ps_wakeup(struct lbs_private *priv, int wait_option)
* @param psmode Power Saving mode
* @return n/a
*/
void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode)
void lbs_ps_confirm_sleep(struct lbs_private *priv)
{
unsigned long flags =0;
u8 allowed = 1;
int allowed = 1;
lbs_deb_enter(LBS_DEB_HOST);
......@@ -2044,32 +1978,10 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode)
}
/**
* @brief Simple callback that copies response back into command
*
* @param priv A pointer to struct lbs_private structure
* @param extra A pointer to the original command structure for which
* 'resp' is a response
* @param resp A pointer to the command response
*
* @return 0 on success, error on failure
*/
int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
struct cmd_header *resp)
{
struct cmd_header *buf = (void *)extra;
uint16_t copy_len;
copy_len = min(le16_to_cpu(buf->size), le16_to_cpu(resp->size));
memcpy(buf, resp, copy_len);
return 0;
}
EXPORT_SYMBOL_GPL(lbs_cmd_copyback);
struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command,
struct cmd_header *in_cmd, int in_cmd_size,
int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
unsigned long callback_arg)
static struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv,
uint16_t command, struct cmd_header *in_cmd, int in_cmd_size,
int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
unsigned long callback_arg)
{
struct cmd_ctrl_node *cmdnode;
......@@ -2106,9 +2018,6 @@ struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command
lbs_deb_host("PREP_CMD: command 0x%04x\n", command);
/* here was the big old switch() statement, which is now obsolete,
* because the caller of lbs_cmd() sets up all of *cmd for us. */
cmdnode->cmdwaitqwoken = 0;
lbs_queue_cmd(priv, cmdnode);
wake_up_interruptible(&priv->waitq);
......@@ -2118,6 +2027,15 @@ struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command
return cmdnode;
}
void lbs_cmd_async(struct lbs_private *priv, uint16_t command,
struct cmd_header *in_cmd, int in_cmd_size)
{
lbs_deb_enter(LBS_DEB_CMD);
__lbs_cmd_async(priv, command, in_cmd, in_cmd_size,
lbs_cmd_async_callback, 0);
lbs_deb_leave(LBS_DEB_CMD);
}
int __lbs_cmd(struct lbs_private *priv, uint16_t command,
struct cmd_header *in_cmd, int in_cmd_size,
int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
......
......@@ -18,12 +18,9 @@
#define lbs_cmd_with_response(priv, cmdnr, cmd) \
lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd))
/* __lbs_cmd() will free the cmdnode and return success/failure.
__lbs_cmd_async() requires that the callback free the cmdnode */
struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command,
struct cmd_header *in_cmd, int in_cmd_size,
int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
unsigned long callback_arg);
void lbs_cmd_async(struct lbs_private *priv, uint16_t command,
struct cmd_header *in_cmd, int in_cmd_size);
int __lbs_cmd(struct lbs_private *priv, uint16_t command,
struct cmd_header *in_cmd, int in_cmd_size,
int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
......
......@@ -19,7 +19,7 @@ static char *szStates[] = {
};
#ifdef PROC_DEBUG
static void lbs_debug_init(struct lbs_private *priv, struct net_device *dev);
static void lbs_debug_init(struct lbs_private *priv);
#endif
static int open_file_generic(struct inode *inode, struct file *file)
......@@ -78,7 +78,7 @@ static ssize_t lbs_getscantable(struct file *file, char __user *userbuf,
u16 spectrum_mgmt = (iter_bss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT);
pos += snprintf(buf+pos, len-pos,
"%02u| %03d | %04ld | %s |",
"%02u| %03d | %04d | %s |",
numscansdone, iter_bss->channel, iter_bss->rssi,
print_mac(mac, iter_bss->bssid));
pos += snprintf(buf+pos, len-pos, " %04x-", iter_bss->capability);
......@@ -778,7 +778,7 @@ void lbs_debugfs_init_one(struct lbs_private *priv, struct net_device *dev)
}
#ifdef PROC_DEBUG
lbs_debug_init(priv, dev);
lbs_debug_init(priv);
#endif
exit:
return;
......@@ -952,7 +952,7 @@ static struct file_operations lbs_debug_fops = {
* @param dev pointer net_device
* @return N/A
*/
static void lbs_debug_init(struct lbs_private *priv, struct net_device *dev)
static void lbs_debug_init(struct lbs_private *priv)
{
int i;
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册