Commit 05ef54e8 authored by John W. Linville's avatar John W. Linville
parents b6a27d1e a8448553
...@@ -102,12 +102,28 @@ config IWLWIFI_DEVICE_TRACING ...@@ -102,12 +102,28 @@ config IWLWIFI_DEVICE_TRACING
occur. occur.
endmenu endmenu
config IWLWIFI_DEVICE_SVTOOL config IWLWIFI_DEVICE_TESTMODE
bool "iwlwifi device svtool support" def_bool y
depends on IWLWIFI depends on IWLWIFI
select NL80211_TESTMODE depends on NL80211_TESTMODE
help help
This option enables the svtool support for iwlwifi device through This option enables the testmode support for iwlwifi device through
NL80211_TESTMODE. svtool is a software validation tool that runs in NL80211_TESTMODE. This provide the capabilities of enable user space
the user space and interacts with the device in the kernel space validation applications to interacts with the device through the
through the generic netlink message via NL80211_TESTMODE channel. generic netlink message via NL80211_TESTMODE channel.
config IWLWIFI_P2P
bool "iwlwifi experimental P2P support"
depends on IWLWIFI
help
This option enables experimental P2P support for some devices
based on microcode support. Since P2P support is still under
development, this option may even enable it for some devices
now that turn out to not support it in the future due to
microcode restrictions.
To determine if your microcode supports the experimental P2P
offered by this option, check if the driver advertises AP
support when it is loaded.
Say Y only if you want to experiment with P2P.
...@@ -18,7 +18,7 @@ iwlwifi-objs += iwl-trans-pcie.o iwl-trans-pcie-rx.o iwl-trans-pcie-tx.o ...@@ -18,7 +18,7 @@ iwlwifi-objs += iwl-trans-pcie.o iwl-trans-pcie-rx.o iwl-trans-pcie-tx.o
iwlwifi-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o iwlwifi-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
iwlwifi-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o iwlwifi-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o
iwlwifi-$(CONFIG_IWLWIFI_DEVICE_SVTOOL) += iwl-testmode.o iwlwifi-$(CONFIG_IWLWIFI_DEVICE_TESTMODE) += iwl-testmode.o
CFLAGS_iwl-devtrace.o := -I$(src) CFLAGS_iwl-devtrace.o := -I$(src)
......
...@@ -134,10 +134,10 @@ static struct iwl_sensitivity_ranges iwl5150_sensitivity = { ...@@ -134,10 +134,10 @@ static struct iwl_sensitivity_ranges iwl5150_sensitivity = {
#define IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF (-5) #define IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF (-5)
static s32 iwl_temp_calib_to_offset(struct iwl_priv *priv) static s32 iwl_temp_calib_to_offset(struct iwl_shared *shrd)
{ {
u16 temperature, voltage; u16 temperature, voltage;
__le16 *temp_calib = (__le16 *)iwl_eeprom_query_addr(priv, __le16 *temp_calib = (__le16 *)iwl_eeprom_query_addr(shrd,
EEPROM_KELVIN_TEMPERATURE); EEPROM_KELVIN_TEMPERATURE);
temperature = le16_to_cpu(temp_calib[0]); temperature = le16_to_cpu(temp_calib[0]);
...@@ -151,7 +151,7 @@ static void iwl5150_set_ct_threshold(struct iwl_priv *priv) ...@@ -151,7 +151,7 @@ static void iwl5150_set_ct_threshold(struct iwl_priv *priv)
{ {
const s32 volt2temp_coef = IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF; const s32 volt2temp_coef = IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF;
s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY) - s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY) -
iwl_temp_calib_to_offset(priv); iwl_temp_calib_to_offset(priv->shrd);
hw_params(priv).ct_kill_threshold = threshold * volt2temp_coef; hw_params(priv).ct_kill_threshold = threshold * volt2temp_coef;
} }
...@@ -223,7 +223,7 @@ static int iwl5150_hw_set_hw_params(struct iwl_priv *priv) ...@@ -223,7 +223,7 @@ static int iwl5150_hw_set_hw_params(struct iwl_priv *priv)
static void iwl5150_temperature(struct iwl_priv *priv) static void iwl5150_temperature(struct iwl_priv *priv)
{ {
u32 vt = 0; u32 vt = 0;
s32 offset = iwl_temp_calib_to_offset(priv); s32 offset = iwl_temp_calib_to_offset(priv->shrd);
vt = le32_to_cpu(priv->statistics.common.temperature); vt = le32_to_cpu(priv->statistics.common.temperature);
vt = vt / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF + offset; vt = vt / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF + offset;
......
...@@ -81,7 +81,7 @@ static void iwl6000_set_ct_threshold(struct iwl_priv *priv) ...@@ -81,7 +81,7 @@ static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
static void iwl6050_additional_nic_config(struct iwl_priv *priv) static void iwl6050_additional_nic_config(struct iwl_priv *priv)
{ {
/* Indicate calibration version to uCode. */ /* Indicate calibration version to uCode. */
if (iwlagn_eeprom_calib_version(priv) >= 6) if (iwl_eeprom_calib_version(priv->shrd) >= 6)
iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG, iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG,
CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
} }
...@@ -89,7 +89,7 @@ static void iwl6050_additional_nic_config(struct iwl_priv *priv) ...@@ -89,7 +89,7 @@ static void iwl6050_additional_nic_config(struct iwl_priv *priv)
static void iwl6150_additional_nic_config(struct iwl_priv *priv) static void iwl6150_additional_nic_config(struct iwl_priv *priv)
{ {
/* Indicate calibration version to uCode. */ /* Indicate calibration version to uCode. */
if (iwlagn_eeprom_calib_version(priv) >= 6) if (iwl_eeprom_calib_version(priv->shrd) >= 6)
iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG, iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG,
CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG, iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG,
......
...@@ -82,7 +82,7 @@ struct statistics_general_data { ...@@ -82,7 +82,7 @@ struct statistics_general_data {
u32 beacon_energy_c; u32 beacon_energy_c;
}; };
int iwl_send_calib_results(struct iwl_priv *priv) int iwl_send_calib_results(struct iwl_trans *trans)
{ {
struct iwl_host_cmd hcmd = { struct iwl_host_cmd hcmd = {
.id = REPLY_PHY_CALIBRATION_CMD, .id = REPLY_PHY_CALIBRATION_CMD,
...@@ -90,15 +90,15 @@ int iwl_send_calib_results(struct iwl_priv *priv) ...@@ -90,15 +90,15 @@ int iwl_send_calib_results(struct iwl_priv *priv)
}; };
struct iwl_calib_result *res; struct iwl_calib_result *res;
list_for_each_entry(res, &priv->calib_results, list) { list_for_each_entry(res, &trans->calib_results, list) {
int ret; int ret;
hcmd.len[0] = res->cmd_len; hcmd.len[0] = res->cmd_len;
hcmd.data[0] = &res->hdr; hcmd.data[0] = &res->hdr;
hcmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY; hcmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY;
ret = iwl_trans_send_cmd(trans(priv), &hcmd); ret = iwl_trans_send_cmd(trans, &hcmd);
if (ret) { if (ret) {
IWL_ERR(priv, "Error %d on calib cmd %d\n", IWL_ERR(trans, "Error %d on calib cmd %d\n",
ret, res->hdr.op_code); ret, res->hdr.op_code);
return ret; return ret;
} }
...@@ -107,7 +107,7 @@ int iwl_send_calib_results(struct iwl_priv *priv) ...@@ -107,7 +107,7 @@ int iwl_send_calib_results(struct iwl_priv *priv)
return 0; return 0;
} }
int iwl_calib_set(struct iwl_priv *priv, int iwl_calib_set(struct iwl_trans *trans,
const struct iwl_calib_hdr *cmd, int len) const struct iwl_calib_hdr *cmd, int len)
{ {
struct iwl_calib_result *res, *tmp; struct iwl_calib_result *res, *tmp;
...@@ -119,7 +119,7 @@ int iwl_calib_set(struct iwl_priv *priv, ...@@ -119,7 +119,7 @@ int iwl_calib_set(struct iwl_priv *priv,
memcpy(&res->hdr, cmd, len); memcpy(&res->hdr, cmd, len);
res->cmd_len = len; res->cmd_len = len;
list_for_each_entry(tmp, &priv->calib_results, list) { list_for_each_entry(tmp, &trans->calib_results, list) {
if (tmp->hdr.op_code == res->hdr.op_code) { if (tmp->hdr.op_code == res->hdr.op_code) {
list_replace(&tmp->list, &res->list); list_replace(&tmp->list, &res->list);
kfree(tmp); kfree(tmp);
...@@ -128,16 +128,16 @@ int iwl_calib_set(struct iwl_priv *priv, ...@@ -128,16 +128,16 @@ int iwl_calib_set(struct iwl_priv *priv,
} }
/* wasn't in list already */ /* wasn't in list already */
list_add_tail(&res->list, &priv->calib_results); list_add_tail(&res->list, &trans->calib_results);
return 0; return 0;
} }
void iwl_calib_free_results(struct iwl_priv *priv) void iwl_calib_free_results(struct iwl_trans *trans)
{ {
struct iwl_calib_result *res, *tmp; struct iwl_calib_result *res, *tmp;
list_for_each_entry_safe(res, tmp, &priv->calib_results, list) { list_for_each_entry_safe(res, tmp, &trans->calib_results, list) {
list_del(&res->list); list_del(&res->list);
kfree(res); kfree(res);
} }
......
...@@ -72,9 +72,4 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv); ...@@ -72,9 +72,4 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv);
void iwl_init_sensitivity(struct iwl_priv *priv); void iwl_init_sensitivity(struct iwl_priv *priv);
void iwl_reset_run_time_calib(struct iwl_priv *priv); void iwl_reset_run_time_calib(struct iwl_priv *priv);
int iwl_send_calib_results(struct iwl_priv *priv);
int iwl_calib_set(struct iwl_priv *priv,
const struct iwl_calib_hdr *cmd, int len);
void iwl_calib_free_results(struct iwl_priv *priv);
#endif /* __iwl_calib_h__ */ #endif /* __iwl_calib_h__ */
...@@ -92,11 +92,11 @@ void iwlagn_temperature(struct iwl_priv *priv) ...@@ -92,11 +92,11 @@ void iwlagn_temperature(struct iwl_priv *priv)
iwl_tt_handler(priv); iwl_tt_handler(priv);
} }
u16 iwlagn_eeprom_calib_version(struct iwl_priv *priv) u16 iwl_eeprom_calib_version(struct iwl_shared *shrd)
{ {
struct iwl_eeprom_calib_hdr *hdr; struct iwl_eeprom_calib_hdr *hdr;
hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv, hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(shrd,
EEPROM_CALIB_ALL); EEPROM_CALIB_ALL);
return hdr->version; return hdr->version;
...@@ -105,7 +105,7 @@ u16 iwlagn_eeprom_calib_version(struct iwl_priv *priv) ...@@ -105,7 +105,7 @@ u16 iwlagn_eeprom_calib_version(struct iwl_priv *priv)
/* /*
* EEPROM * EEPROM
*/ */
static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address) static u32 eeprom_indirect_address(const struct iwl_shared *shrd, u32 address)
{ {
u16 offset = 0; u16 offset = 0;
...@@ -114,31 +114,31 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address) ...@@ -114,31 +114,31 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
switch (address & INDIRECT_TYPE_MSK) { switch (address & INDIRECT_TYPE_MSK) {
case INDIRECT_HOST: case INDIRECT_HOST:
offset = iwl_eeprom_query16(priv, EEPROM_LINK_HOST); offset = iwl_eeprom_query16(shrd, EEPROM_LINK_HOST);
break; break;
case INDIRECT_GENERAL: case INDIRECT_GENERAL:
offset = iwl_eeprom_query16(priv, EEPROM_LINK_GENERAL); offset = iwl_eeprom_query16(shrd, EEPROM_LINK_GENERAL);
break; break;
case INDIRECT_REGULATORY: case INDIRECT_REGULATORY:
offset = iwl_eeprom_query16(priv, EEPROM_LINK_REGULATORY); offset = iwl_eeprom_query16(shrd, EEPROM_LINK_REGULATORY);
break; break;
case INDIRECT_TXP_LIMIT: case INDIRECT_TXP_LIMIT:
offset = iwl_eeprom_query16(priv, EEPROM_LINK_TXP_LIMIT); offset = iwl_eeprom_query16(shrd, EEPROM_LINK_TXP_LIMIT);
break; break;
case INDIRECT_TXP_LIMIT_SIZE: case INDIRECT_TXP_LIMIT_SIZE:
offset = iwl_eeprom_query16(priv, EEPROM_LINK_TXP_LIMIT_SIZE); offset = iwl_eeprom_query16(shrd, EEPROM_LINK_TXP_LIMIT_SIZE);
break; break;
case INDIRECT_CALIBRATION: case INDIRECT_CALIBRATION:
offset = iwl_eeprom_query16(priv, EEPROM_LINK_CALIBRATION); offset = iwl_eeprom_query16(shrd, EEPROM_LINK_CALIBRATION);
break; break;
case INDIRECT_PROCESS_ADJST: case INDIRECT_PROCESS_ADJST:
offset = iwl_eeprom_query16(priv, EEPROM_LINK_PROCESS_ADJST); offset = iwl_eeprom_query16(shrd, EEPROM_LINK_PROCESS_ADJST);
break; break;
case INDIRECT_OTHERS: case INDIRECT_OTHERS:
offset = iwl_eeprom_query16(priv, EEPROM_LINK_OTHERS); offset = iwl_eeprom_query16(shrd, EEPROM_LINK_OTHERS);
break; break;
default: default:
IWL_ERR(priv, "illegal indirect type: 0x%X\n", IWL_ERR(shrd->trans, "illegal indirect type: 0x%X\n",
address & INDIRECT_TYPE_MSK); address & INDIRECT_TYPE_MSK);
break; break;
} }
...@@ -147,11 +147,11 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address) ...@@ -147,11 +147,11 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
return (address & ADDRESS_MSK) + (offset << 1); return (address & ADDRESS_MSK) + (offset << 1);
} }
const u8 *iwl_eeprom_query_addr(const struct iwl_priv *priv, size_t offset) const u8 *iwl_eeprom_query_addr(const struct iwl_shared *shrd, size_t offset)
{ {
u32 address = eeprom_indirect_address(priv, offset); u32 address = eeprom_indirect_address(shrd, offset);
BUG_ON(address >= priv->cfg->base_params->eeprom_size); BUG_ON(address >= shrd->priv->cfg->base_params->eeprom_size);
return &priv->eeprom[address]; return &shrd->eeprom[address];
} }
struct iwl_mod_params iwlagn_mod_params = { struct iwl_mod_params iwlagn_mod_params = {
...@@ -1157,7 +1157,7 @@ int iwlagn_suspend(struct iwl_priv *priv, ...@@ -1157,7 +1157,7 @@ int iwlagn_suspend(struct iwl_priv *priv,
* For QoS counters, we store the one to use next, so subtract 0x10 * For QoS counters, we store the one to use next, so subtract 0x10
* since the uCode will add 0x10 before using the value. * since the uCode will add 0x10 before using the value.
*/ */
for (i = 0; i < 8; i++) { for (i = 0; i < IWL_MAX_TID_COUNT; i++) {
seq = priv->shrd->tid_data[IWL_AP_ID][i].seq_number; seq = priv->shrd->tid_data[IWL_AP_ID][i].seq_number;
seq -= 0x10; seq -= 0x10;
wakeup_filter_cmd.qos_seq[i] = cpu_to_le16(seq); wakeup_filter_cmd.qos_seq[i] = cpu_to_le16(seq);
......
...@@ -298,7 +298,7 @@ static u8 rs_tl_add_packet(struct iwl_lq_sta *lq_data, ...@@ -298,7 +298,7 @@ static u8 rs_tl_add_packet(struct iwl_lq_sta *lq_data,
} else } else
return IWL_MAX_TID_COUNT; return IWL_MAX_TID_COUNT;
if (unlikely(tid >= TID_MAX_LOAD_COUNT)) if (unlikely(tid >= IWL_MAX_TID_COUNT))
return IWL_MAX_TID_COUNT; return IWL_MAX_TID_COUNT;
tl = &lq_data->load[tid]; tl = &lq_data->load[tid];
...@@ -352,7 +352,7 @@ static void rs_program_fix_rate(struct iwl_priv *priv, ...@@ -352,7 +352,7 @@ static void rs_program_fix_rate(struct iwl_priv *priv,
lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */
lq_sta->active_mimo3_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ lq_sta->active_mimo3_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */
#ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL #ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE
/* testmode has higher priority to overwirte the fixed rate */ /* testmode has higher priority to overwirte the fixed rate */
if (priv->tm_fixed_rate) if (priv->tm_fixed_rate)
lq_sta->dbg_fixed_rate = priv->tm_fixed_rate; lq_sta->dbg_fixed_rate = priv->tm_fixed_rate;
...@@ -379,7 +379,7 @@ static u32 rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid) ...@@ -379,7 +379,7 @@ static u32 rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid)
s32 index; s32 index;
struct iwl_traffic_load *tl = NULL; struct iwl_traffic_load *tl = NULL;
if (tid >= TID_MAX_LOAD_COUNT) if (tid >= IWL_MAX_TID_COUNT)
return 0; return 0;
tl = &(lq_data->load[tid]); tl = &(lq_data->load[tid]);
...@@ -444,11 +444,11 @@ static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid, ...@@ -444,11 +444,11 @@ static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid,
struct iwl_lq_sta *lq_data, struct iwl_lq_sta *lq_data,
struct ieee80211_sta *sta) struct ieee80211_sta *sta)
{ {
if (tid < TID_MAX_LOAD_COUNT) if (tid < IWL_MAX_TID_COUNT)
rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta);
else else
IWL_ERR(priv, "tid exceeds max load count: %d/%d\n", IWL_ERR(priv, "tid exceeds max TID count: %d/%d\n",
tid, TID_MAX_LOAD_COUNT); tid, IWL_MAX_TID_COUNT);
} }
static inline int get_num_of_ant_from_rate(u32 rate_n_flags) static inline int get_num_of_ant_from_rate(u32 rate_n_flags)
...@@ -1081,7 +1081,7 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, ...@@ -1081,7 +1081,7 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
if (sta && sta->supp_rates[sband->band]) if (sta && sta->supp_rates[sband->band])
rs_rate_scale_perform(priv, skb, sta, lq_sta); rs_rate_scale_perform(priv, skb, sta, lq_sta);
#if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_IWLWIFI_DEVICE_SVTOOL) #if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_IWLWIFI_DEVICE_TESTMODE)
if ((priv->tm_fixed_rate) && if ((priv->tm_fixed_rate) &&
(priv->tm_fixed_rate != lq_sta->dbg_fixed_rate)) (priv->tm_fixed_rate != lq_sta->dbg_fixed_rate))
rs_program_fix_rate(priv, lq_sta); rs_program_fix_rate(priv, lq_sta);
...@@ -2904,7 +2904,7 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i ...@@ -2904,7 +2904,7 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i
if (sband->band == IEEE80211_BAND_5GHZ) if (sband->band == IEEE80211_BAND_5GHZ)
lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
lq_sta->is_agg = 0; lq_sta->is_agg = 0;
#ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL #ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE
priv->tm_fixed_rate = 0; priv->tm_fixed_rate = 0;
#endif #endif
#ifdef CONFIG_MAC80211_DEBUGFS #ifdef CONFIG_MAC80211_DEBUGFS
......
...@@ -281,7 +281,6 @@ enum { ...@@ -281,7 +281,6 @@ enum {
#define TID_QUEUE_CELL_SPACING 50 /*mS */ #define TID_QUEUE_CELL_SPACING 50 /*mS */
#define TID_QUEUE_MAX_SIZE 20 #define TID_QUEUE_MAX_SIZE 20
#define TID_ROUND_VALUE 5 /* mS */ #define TID_ROUND_VALUE 5 /* mS */
#define TID_MAX_LOAD_COUNT 8
#define TID_MAX_TIME_DIFF ((TID_QUEUE_MAX_SIZE - 1) * TID_QUEUE_CELL_SPACING) #define TID_MAX_TIME_DIFF ((TID_QUEUE_MAX_SIZE - 1) * TID_QUEUE_CELL_SPACING)
#define TIME_WRAP_AROUND(x, y) (((y) > (x)) ? (y) - (x) : (0-(x)) + (y)) #define TIME_WRAP_AROUND(x, y) (((y) > (x)) ? (y) - (x) : (0-(x)) + (y))
...@@ -402,7 +401,7 @@ struct iwl_lq_sta { ...@@ -402,7 +401,7 @@ struct iwl_lq_sta {
struct iwl_link_quality_cmd lq; struct iwl_link_quality_cmd lq;
struct iwl_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */ struct iwl_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */
struct iwl_traffic_load load[TID_MAX_LOAD_COUNT]; struct iwl_traffic_load load[IWL_MAX_TID_COUNT];
u8 tx_agg_tid_en; u8 tx_agg_tid_en;
#ifdef CONFIG_MAC80211_DEBUGFS #ifdef CONFIG_MAC80211_DEBUGFS
struct dentry *rs_sta_dbgfs_scale_table_file; struct dentry *rs_sta_dbgfs_scale_table_file;
......
...@@ -1165,7 +1165,7 @@ int iwl_rx_dispatch(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb, ...@@ -1165,7 +1165,7 @@ int iwl_rx_dispatch(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb,
pkt->hdr.cmd); pkt->hdr.cmd);
w->triggered = true; w->triggered = true;
if (w->fn) if (w->fn)
w->fn(priv, pkt, w->fn_data); w->fn(trans(priv), pkt, w->fn_data);
} }
spin_unlock(&priv->shrd->notif_wait_lock); spin_unlock(&priv->shrd->notif_wait_lock);
......
...@@ -135,8 +135,8 @@ static u16 iwlagn_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data) ...@@ -135,8 +135,8 @@ static u16 iwlagn_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
u16 size = (u16)sizeof(struct iwl_addsta_cmd); u16 size = (u16)sizeof(struct iwl_addsta_cmd);
struct iwl_addsta_cmd *addsta = (struct iwl_addsta_cmd *)data; struct iwl_addsta_cmd *addsta = (struct iwl_addsta_cmd *)data;
memcpy(addsta, cmd, size); memcpy(addsta, cmd, size);
/* resrved in 5000 */ /* resrved in agn */
addsta->rate_n_flags = cpu_to_le16(0); addsta->legacy_reserved = cpu_to_le16(0);
return size; return size;
} }
......
...@@ -148,7 +148,7 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv, ...@@ -148,7 +148,7 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv,
if (ieee80211_is_data(fc)) { if (ieee80211_is_data(fc)) {
tx_cmd->initial_rate_index = 0; tx_cmd->initial_rate_index = 0;
tx_cmd->tx_flags |= TX_CMD_FLG_STA_RATE_MSK; tx_cmd->tx_flags |= TX_CMD_FLG_STA_RATE_MSK;
#ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL #ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE
if (priv->tm_fixed_rate) { if (priv->tm_fixed_rate) {
/* /*
* rate overwrite by testmode * rate overwrite by testmode
...@@ -161,7 +161,8 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv, ...@@ -161,7 +161,8 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv,
} }
#endif #endif
return; return;
} } else if (ieee80211_is_back_req(fc))
tx_cmd->tx_flags |= TX_CMD_FLG_STA_RATE_MSK;
/** /**
* If the current TX rate stored in mac80211 has the MCS bit set, it's * If the current TX rate stored in mac80211 has the MCS bit set, it's
......
...@@ -366,7 +366,7 @@ static void iwl_continuous_event_trace(struct iwl_priv *priv) ...@@ -366,7 +366,7 @@ static void iwl_continuous_event_trace(struct iwl_priv *priv)
u32 num_wraps; /* # times uCode wrapped to top of log */ u32 num_wraps; /* # times uCode wrapped to top of log */
u32 next_entry; /* index of next entry to be written by uCode */ u32 next_entry; /* index of next entry to be written by uCode */
base = priv->device_pointers.error_event_table; base = priv->shrd->device_pointers.error_event_table;
if (iwlagn_hw_valid_rtc_data_addr(base)) { if (iwlagn_hw_valid_rtc_data_addr(base)) {
capacity = iwl_read_targ_mem(bus(priv), base); capacity = iwl_read_targ_mem(bus(priv), base);
num_wraps = iwl_read_targ_mem(bus(priv), num_wraps = iwl_read_targ_mem(bus(priv),
...@@ -1036,6 +1036,9 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) ...@@ -1036,6 +1036,9 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
priv->inst_evtlog_size = priv->inst_evtlog_size =
priv->cfg->base_params->max_event_log_size; priv->cfg->base_params->max_event_log_size;
priv->inst_errlog_ptr = pieces.inst_errlog_ptr; priv->inst_errlog_ptr = pieces.inst_errlog_ptr;
#ifndef CONFIG_IWLWIFI_P2P
ucode_capa.flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
#endif
priv->new_scan_threshold_behaviour = priv->new_scan_threshold_behaviour =
!!(ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWSCAN); !!(ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWSCAN);
...@@ -1057,7 +1060,6 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) ...@@ -1057,7 +1060,6 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
priv->sta_key_max_num = STA_KEY_MAX_NUM; priv->sta_key_max_num = STA_KEY_MAX_NUM;
priv->shrd->cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM; priv->shrd->cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
} }
/* /*
* figure out the offset of chain noise reset and gain commands * figure out the offset of chain noise reset and gain commands
* base on the size of standard phy calibration commands table size * base on the size of standard phy calibration commands table size
...@@ -1575,7 +1577,7 @@ static int iwl_init_drv(struct iwl_priv *priv) ...@@ -1575,7 +1577,7 @@ static int iwl_init_drv(struct iwl_priv *priv)
mutex_init(&priv->shrd->mutex); mutex_init(&priv->shrd->mutex);
INIT_LIST_HEAD(&priv->calib_results); INIT_LIST_HEAD(&trans(priv)->calib_results);
priv->ieee_channels = NULL; priv->ieee_channels = NULL;
priv->ieee_rates = NULL; priv->ieee_rates = NULL;
...@@ -1633,7 +1635,6 @@ static int iwl_init_drv(struct iwl_priv *priv) ...@@ -1633,7 +1635,6 @@ static int iwl_init_drv(struct iwl_priv *priv)
static void iwl_uninit_drv(struct iwl_priv *priv) static void iwl_uninit_drv(struct iwl_priv *priv)
{ {
iwl_calib_free_results(priv);
iwl_free_geos(priv); iwl_free_geos(priv);
iwl_free_channel_map(priv); iwl_free_channel_map(priv);
if (priv->tx_cmd_pool) if (priv->tx_cmd_pool)
...@@ -1703,8 +1704,14 @@ static void iwl_debug_config(struct iwl_priv *priv) ...@@ -1703,8 +1704,14 @@ static void iwl_debug_config(struct iwl_priv *priv)
"disabled\n"); "disabled\n");
#endif #endif
dev_printk(KERN_INFO, bus(priv)->dev, "CONFIG_IWLWIFI_DEVICE_SVTOOL " dev_printk(KERN_INFO, bus(priv)->dev, "CONFIG_IWLWIFI_DEVICE_TESTMODE "
#ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL #ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE
"enabled\n");
#else
"disabled\n");
#endif
dev_printk(KERN_INFO, bus(priv)->dev, "CONFIG_IWLWIFI_P2P "
#ifdef CONFIG_IWLWIFI_P2P
"enabled\n"); "enabled\n");
#else #else
"disabled\n"); "disabled\n");
...@@ -1814,11 +1821,11 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops, ...@@ -1814,11 +1821,11 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,
goto out_free_eeprom; goto out_free_eeprom;
/* extract MAC Address */ /* extract MAC Address */
iwl_eeprom_get_mac(priv, priv->addresses[0].addr); iwl_eeprom_get_mac(priv->shrd, priv->addresses[0].addr);
IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr); IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr);
priv->hw->wiphy->addresses = priv->addresses; priv->hw->wiphy->addresses = priv->addresses;
priv->hw->wiphy->n_addresses = 1; priv->hw->wiphy->n_addresses = 1;
num_mac = iwl_eeprom_query16(priv, EEPROM_NUM_MAC_ADDRESS); num_mac = iwl_eeprom_query16(priv->shrd, EEPROM_NUM_MAC_ADDRESS);
if (num_mac > 1) { if (num_mac > 1) {
memcpy(priv->addresses[1].addr, priv->addresses[0].addr, memcpy(priv->addresses[1].addr, priv->addresses[0].addr,
ETH_ALEN); ETH_ALEN);
...@@ -1883,7 +1890,7 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops, ...@@ -1883,7 +1890,7 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,
priv->shrd->workqueue = NULL; priv->shrd->workqueue = NULL;
iwl_uninit_drv(priv); iwl_uninit_drv(priv);
out_free_eeprom: out_free_eeprom:
iwl_eeprom_free(priv); iwl_eeprom_free(priv->shrd);
out_free_trans: out_free_trans:
iwl_trans_free(trans(priv)); iwl_trans_free(trans(priv));
out_free_traffic_mem: out_free_traffic_mem:
...@@ -1922,7 +1929,7 @@ void __devexit iwl_remove(struct iwl_priv * priv) ...@@ -1922,7 +1929,7 @@ void __devexit iwl_remove(struct iwl_priv * priv)
iwl_dealloc_ucode(trans(priv)); iwl_dealloc_ucode(trans(priv));
iwl_eeprom_free(priv); iwl_eeprom_free(priv->shrd);
/*netif_stop_queue(dev); */ /*netif_stop_queue(dev); */
flush_workqueue(priv->shrd->workqueue); flush_workqueue(priv->shrd->workqueue);
......
...@@ -117,7 +117,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, ...@@ -117,7 +117,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
/* lib */ /* lib */
int iwlagn_send_tx_power(struct iwl_priv *priv); int iwlagn_send_tx_power(struct iwl_priv *priv);
void iwlagn_temperature(struct iwl_priv *priv); void iwlagn_temperature(struct iwl_priv *priv);
u16 iwlagn_eeprom_calib_version(struct iwl_priv *priv); u16 iwl_eeprom_calib_version(struct iwl_shared *shrd);
int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control); int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control);
void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control); void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control);
int iwlagn_send_beacon_cmd(struct iwl_priv *priv); int iwlagn_send_beacon_cmd(struct iwl_priv *priv);
...@@ -354,12 +354,12 @@ static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags) ...@@ -354,12 +354,12 @@ static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags)
/* eeprom */ /* eeprom */
void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv); void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv);
void iwl_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac); void iwl_eeprom_get_mac(const struct iwl_shared *shrd, u8 *mac);
extern int iwlagn_init_alive_start(struct iwl_priv *priv); extern int iwlagn_init_alive_start(struct iwl_priv *priv);
extern int iwl_alive_start(struct iwl_priv *priv); extern int iwl_alive_start(struct iwl_priv *priv);
/* svtool */ /* svtool */
#ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL #ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE
extern int iwlagn_mac_testmode_cmd(struct ieee80211_hw *hw, void *data, extern int iwlagn_mac_testmode_cmd(struct ieee80211_hw *hw, void *data,
int len); int len);
extern int iwlagn_mac_testmode_dump(struct ieee80211_hw *hw, extern int iwlagn_mac_testmode_dump(struct ieee80211_hw *hw,
......
...@@ -109,10 +109,10 @@ enum { ...@@ -109,10 +109,10 @@ enum {
/* RX, TX, LEDs */ /* RX, TX, LEDs */
REPLY_TX = 0x1c, REPLY_TX = 0x1c,
REPLY_LEDS_CMD = 0x48, REPLY_LEDS_CMD = 0x48,
REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* for 4965 and up */ REPLY_TX_LINK_QUALITY_CMD = 0x4e,
/* WiMAX coexistence */ /* WiMAX coexistence */
COEX_PRIORITY_TABLE_CMD = 0x5a, /* for 5000 series and up */ COEX_PRIORITY_TABLE_CMD = 0x5a,
COEX_MEDIUM_NOTIFICATION = 0x5b, COEX_MEDIUM_NOTIFICATION = 0x5b,
COEX_EVENT_CMD = 0x5c, COEX_EVENT_CMD = 0x5c,
...@@ -466,23 +466,27 @@ struct iwl_error_event_table { ...@@ -466,23 +466,27 @@ struct iwl_error_event_table {
u32 frame_ptr; /* frame pointer */ u32 frame_ptr; /* frame pointer */
u32 stack_ptr; /* stack pointer */ u32 stack_ptr; /* stack pointer */
u32 hcmd; /* last host command header */ u32 hcmd; /* last host command header */
#if 0 u32 isr0; /* isr status register LMPM_NIC_ISR0:
/* no need to read the remainder, we don't use the values */ * rxtx_flag */
u32 isr0; /* isr status register LMPM_NIC_ISR0: rxtx_flag */ u32 isr1; /* isr status register LMPM_NIC_ISR1:
u32 isr1; /* isr status register LMPM_NIC_ISR1: host_flag */ * host_flag */
u32 isr2; /* isr status register LMPM_NIC_ISR2: enc_flag */ u32 isr2; /* isr status register LMPM_NIC_ISR2:
u32 isr3; /* isr status register LMPM_NIC_ISR3: time_flag */ * enc_flag */
u32 isr4; /* isr status register LMPM_NIC_ISR4: wico interrupt */ u32 isr3; /* isr status register LMPM_NIC_ISR3:
* time_flag */
u32 isr4; /* isr status register LMPM_NIC_ISR4:
* wico interrupt */
u32 isr_pref; /* isr status register LMPM_NIC_PREF_STAT */ u32 isr_pref; /* isr status register LMPM_NIC_PREF_STAT */
u32 wait_event; /* wait event() caller address */ u32 wait_event; /* wait event() caller address */
u32 l2p_control; /* L2pControlField */ u32 l2p_control; /* L2pControlField */
u32 l2p_duration; /* L2pDurationField */ u32 l2p_duration; /* L2pDurationField */
u32 l2p_mhvalid; /* L2pMhValidBits */ u32 l2p_mhvalid; /* L2pMhValidBits */
u32 l2p_addr_match; /* L2pAddrMatchStat */ u32 l2p_addr_match; /* L2pAddrMatchStat */
u32 lmpm_pmg_sel; /* indicate which clocks are turned on (LMPM_PMG_SEL) */ u32 lmpm_pmg_sel; /* indicate which clocks are turned on
u32 u_timestamp; /* indicate when the date and time of the compilation */ * (LMPM_PMG_SEL) */
u32 u_timestamp; /* indicate when the date and time of the
* compilation */
u32 flow_handler; /* FH read/write pointers, RX credit */ u32 flow_handler; /* FH read/write pointers, RX credit */
#endif
} __packed; } __packed;
struct iwl_alive_resp { struct iwl_alive_resp {
...@@ -810,7 +814,7 @@ struct iwl_qosparam_cmd { ...@@ -810,7 +814,7 @@ struct iwl_qosparam_cmd {
#define IWLAGN_STATION_COUNT 16 #define IWLAGN_STATION_COUNT 16
#define IWL_INVALID_STATION 255 #define IWL_INVALID_STATION 255
#define IWL_MAX_TID_COUNT 9 #define IWL_MAX_TID_COUNT 8
#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2) #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2)
#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8) #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8)
...@@ -931,8 +935,7 @@ struct iwl_addsta_cmd { ...@@ -931,8 +935,7 @@ struct iwl_addsta_cmd {
* corresponding to bit (e.g. bit 5 controls TID 5). * corresponding to bit (e.g. bit 5 controls TID 5).
* Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
__le16 tid_disable_tx; __le16 tid_disable_tx;
__le16 legacy_reserved;
__le16 rate_n_flags; /* 3945 only */
/* TID for which to add block-ack support. /* TID for which to add block-ack support.
* Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
...@@ -1162,8 +1165,7 @@ struct iwl_rx_mpdu_res_start { ...@@ -1162,8 +1165,7 @@ struct iwl_rx_mpdu_res_start {
* *
* uCode handles retrying Tx when an ACK is expected but not received. * uCode handles retrying Tx when an ACK is expected but not received.
* This includes trying lower data rates than the one requested in the Tx * This includes trying lower data rates than the one requested in the Tx
* command, as set up by the REPLY_RATE_SCALE (for 3945) or * command, as set up by the REPLY_TX_LINK_QUALITY_CMD (agn).
* REPLY_TX_LINK_QUALITY_CMD (agn).
* *
* Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD. * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
* This command must be executed after every RXON command, before Tx can occur. * This command must be executed after every RXON command, before Tx can occur.
...@@ -1175,25 +1177,9 @@ struct iwl_rx_mpdu_res_start { ...@@ -1175,25 +1177,9 @@ struct iwl_rx_mpdu_res_start {
* 1: Use RTS/CTS protocol or CTS-to-self if spec allows it * 1: Use RTS/CTS protocol or CTS-to-self if spec allows it
* before this frame. if CTS-to-self required check * before this frame. if CTS-to-self required check
* RXON_FLG_SELF_CTS_EN status. * RXON_FLG_SELF_CTS_EN status.
* unused in 3945/4965, used in 5000 series and after
*/ */
#define TX_CMD_FLG_PROT_REQUIRE_MSK cpu_to_le32(1 << 0) #define TX_CMD_FLG_PROT_REQUIRE_MSK cpu_to_le32(1 << 0)
/*
* 1: Use Request-To-Send protocol before this frame.
* Mutually exclusive vs. TX_CMD_FLG_CTS_MSK.
* used in 3945/4965, unused in 5000 series and after
*/
#define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1)
/*
* 1: Transmit Clear-To-Send to self before this frame.
* Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
* Mutually exclusive vs. TX_CMD_FLG_RTS_MSK.
* used in 3945/4965, unused in 5000 series and after
*/
#define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2)
/* 1: Expect ACK from receiving station /* 1: Expect ACK from receiving station
* 0: Don't expect ACK (MAC header's duration field s/b 0) * 0: Don't expect ACK (MAC header's duration field s/b 0)
* Set this for unicast frames, but not broadcast/multicast. */ * Set this for unicast frames, but not broadcast/multicast. */
...@@ -1211,18 +1197,8 @@ struct iwl_rx_mpdu_res_start { ...@@ -1211,18 +1197,8 @@ struct iwl_rx_mpdu_res_start {
* Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */ * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */
#define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6) #define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6)
/* /* Tx antenna selection field; reserved (0) for agn devices. */
* 1: Frame requires full Tx-Op protection.
* Set this if either RTS or CTS Tx Flag gets set.
* used in 3945/4965, unused in 5000 series and after
*/
#define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7)
/* Tx antenna selection field; used only for 3945, reserved (0) for agn devices.
* Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
#define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00) #define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00)
#define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
#define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
/* 1: Ignore Bluetooth priority for this frame. /* 1: Ignore Bluetooth priority for this frame.
* 0: Delay Tx until Bluetooth device is done (normal usage). */ * 0: Delay Tx until Bluetooth device is done (normal usage). */
...@@ -1568,7 +1544,6 @@ struct iwl_compressed_ba_resp { ...@@ -1568,7 +1544,6 @@ struct iwl_compressed_ba_resp {
__le64 bitmap; __le64 bitmap;
__le16 scd_flow; __le16 scd_flow;
__le16 scd_ssn; __le16 scd_ssn;
/* following only for 5000 series and up */
u8 txed; /* number of frames sent */ u8 txed; /* number of frames sent */
u8 txed_2_done; /* number of frames acked */ u8 txed_2_done; /* number of frames acked */
} __packed; } __packed;
...@@ -1670,7 +1645,7 @@ struct iwl_link_qual_agg_params { ...@@ -1670,7 +1645,7 @@ struct iwl_link_qual_agg_params {
/* /*
* REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
* *
* For agn devices only; 3945 uses REPLY_RATE_SCALE. * For agn devices
* *
* Each station in the agn device's internal station table has its own table * Each station in the agn device's internal station table has its own table
* of 16 * of 16
...@@ -1919,7 +1894,7 @@ struct iwl_link_quality_cmd { ...@@ -1919,7 +1894,7 @@ struct iwl_link_quality_cmd {
/* /*
* REPLY_BT_CONFIG = 0x9b (command, has simple generic response) * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
* *
* 3945 and agn devices support hardware handshake with Bluetooth device on * agn devices support hardware handshake with Bluetooth device on
* same platform. Bluetooth device alerts wireless device when it will Tx; * same platform. Bluetooth device alerts wireless device when it will Tx;
* wireless device can delay or kill its own Tx to accommodate. * wireless device can delay or kill its own Tx to accommodate.
*/ */
...@@ -2203,8 +2178,8 @@ struct iwl_spectrum_notification { ...@@ -2203,8 +2178,8 @@ struct iwl_spectrum_notification {
struct iwl_powertable_cmd { struct iwl_powertable_cmd {
__le16 flags; __le16 flags;
u8 keep_alive_seconds; /* 3945 reserved */ u8 keep_alive_seconds;
u8 debug_flags; /* 3945 reserved */ u8 debug_flags;
__le32 rx_data_timeout; __le32 rx_data_timeout;
__le32 tx_data_timeout; __le32 tx_data_timeout;
__le32 sleep_interval[IWL_POWER_VEC_SIZE]; __le32 sleep_interval[IWL_POWER_VEC_SIZE];
...@@ -2325,9 +2300,9 @@ struct iwl_scan_channel { ...@@ -2325,9 +2300,9 @@ struct iwl_scan_channel {
/** /**
* struct iwl_ssid_ie - directed scan network information element * struct iwl_ssid_ie - directed scan network information element
* *
* Up to 20 of these may appear in REPLY_SCAN_CMD (Note: Only 4 are in * Up to 20 of these may appear in REPLY_SCAN_CMD,
* 3945 SCAN api), selected by "type" bit field in struct iwl_scan_channel; * selected by "type" bit field in struct iwl_scan_channel;
* each channel may select different ssids from among the 20 (4) entries. * each channel may select different ssids from among the 20 entries.
* SSID IEs get transmitted in reverse order of entry. * SSID IEs get transmitted in reverse order of entry.
*/ */
struct iwl_ssid_ie { struct iwl_ssid_ie {
...@@ -2336,7 +2311,6 @@ struct iwl_ssid_ie { ...@@ -2336,7 +2311,6 @@ struct iwl_ssid_ie {
u8 ssid[32]; u8 ssid[32];
} __packed; } __packed;
#define PROBE_OPTION_MAX_3945 4
#define PROBE_OPTION_MAX 20 #define PROBE_OPTION_MAX 20
#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) #define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF)
#define IWL_GOOD_CRC_TH_DISABLED 0 #define IWL_GOOD_CRC_TH_DISABLED 0
...@@ -2417,8 +2391,6 @@ struct iwl_scan_cmd { ...@@ -2417,8 +2391,6 @@ struct iwl_scan_cmd {
* channel */ * channel */
__le32 suspend_time; /* pause scan this long (in "extended beacon __le32 suspend_time; /* pause scan this long (in "extended beacon
* format") when returning to service chnl: * format") when returning to service chnl:
* 3945; 31:24 # beacons, 19:0 additional usec,
* 4965; 31:22 # beacons, 21:0 additional usec.
*/ */
__le32 flags; /* RXON_FLG_* */ __le32 flags; /* RXON_FLG_* */
__le32 filter_flags; /* RXON_FILTER_* */ __le32 filter_flags; /* RXON_FILTER_* */
...@@ -2734,7 +2706,7 @@ struct statistics_div { ...@@ -2734,7 +2706,7 @@ struct statistics_div {
struct statistics_general_common { struct statistics_general_common {
__le32 temperature; /* radio temperature */ __le32 temperature; /* radio temperature */
__le32 temperature_m; /* for 5000 and up, this is radio voltage */ __le32 temperature_m; /* radio voltage */
struct statistics_dbg dbg; struct statistics_dbg dbg;
__le32 sleep_time; __le32 sleep_time;
__le32 slots_out; __le32 slots_out;
......
...@@ -416,7 +416,7 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file, ...@@ -416,7 +416,7 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
return -ENODATA; return -ENODATA;
} }
ptr = priv->eeprom; ptr = priv->shrd->eeprom;
if (!ptr) { if (!ptr) {
IWL_ERR(priv, "Invalid EEPROM/OTP memory\n"); IWL_ERR(priv, "Invalid EEPROM/OTP memory\n");
return -ENOMEM; return -ENOMEM;
...@@ -428,7 +428,7 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file, ...@@ -428,7 +428,7 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
IWL_ERR(priv, "Can not allocate Buffer\n"); IWL_ERR(priv, "Can not allocate Buffer\n");
return -ENOMEM; return -ENOMEM;
} }
eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); eeprom_ver = iwl_eeprom_query16(priv->shrd, EEPROM_VERSION);
pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, " pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, "
"version: 0x%x\n", "version: 0x%x\n",
(trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP) (trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP)
......
...@@ -60,11 +60,10 @@ struct iwl_tx_queue; ...@@ -60,11 +60,10 @@ struct iwl_tx_queue;
/* Default noise level to report when noise measurement is not available. /* Default noise level to report when noise measurement is not available.
* This may be because we're: * This may be because we're:
* 1) Not associated (4965, no beacon statistics being sent to driver) * 1) Not associated no beacon statistics being sent to driver)
* 2) Scanning (noise measurement does not apply to associated channel) * 2) Scanning (noise measurement does not apply to associated channel)
* 3) Receiving CCK (3945 delivers noise info only for OFDM frames)
* Use default noise value of -127 ... this is below the range of measurable * Use default noise value of -127 ... this is below the range of measurable
* Rx dBm for either 3945 or 4965, so it can indicate "unmeasurable" to user. * Rx dBm for all agn devices, so it can indicate "unmeasurable" to user.
* Also, -127 works better than 0 when averaging frames with/without * Also, -127 works better than 0 when averaging frames with/without
* noise info (e.g. averaging might be done in app); measured dBm values are * noise info (e.g. averaging might be done in app); measured dBm values are
* always negative ... using a negative value as the default keeps all * always negative ... using a negative value as the default keeps all
...@@ -441,15 +440,6 @@ enum iwlagn_chain_noise_state { ...@@ -441,15 +440,6 @@ enum iwlagn_chain_noise_state {
IWL_CHAIN_NOISE_DONE, IWL_CHAIN_NOISE_DONE,
}; };
/* Opaque calibration results */
struct iwl_calib_result {
struct list_head list;
size_t cmd_len;
struct iwl_calib_hdr hdr;
/* data follows */
};
/* Sensitivity calib data */ /* Sensitivity calib data */
struct iwl_sensitivity_data { struct iwl_sensitivity_data {
u32 auto_corr_ofdm; u32 auto_corr_ofdm;
...@@ -751,7 +741,7 @@ enum iwl_scan_type { ...@@ -751,7 +741,7 @@ enum iwl_scan_type {
IWL_SCAN_ROC, IWL_SCAN_ROC,
}; };
#ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL #ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE
struct iwl_testmode_trace { struct iwl_testmode_trace {
u32 buff_size; u32 buff_size;
u32 total_size; u32 total_size;
...@@ -831,9 +821,6 @@ struct iwl_priv { ...@@ -831,9 +821,6 @@ struct iwl_priv {
s32 temperature; /* Celsius */ s32 temperature; /* Celsius */
s32 last_temperature; s32 last_temperature;
/* init calibration results */
struct list_head calib_results;
struct iwl_wipan_noa_data __rcu *noa_data; struct iwl_wipan_noa_data __rcu *noa_data;
/* Scan related variables */ /* Scan related variables */
...@@ -866,11 +853,6 @@ struct iwl_priv { ...@@ -866,11 +853,6 @@ struct iwl_priv {
__le16 switch_channel; __le16 switch_channel;
struct {
u32 error_event_table;
u32 log_event_table;
} device_pointers;
u16 active_rate; u16 active_rate;
u8 start_calib; u8 start_calib;
...@@ -904,10 +886,6 @@ struct iwl_priv { ...@@ -904,10 +886,6 @@ struct iwl_priv {
/* Indication if ieee80211_ops->open has been called */ /* Indication if ieee80211_ops->open has been called */
u8 is_open; u8 is_open;
/* eeprom -- this is in the card's little endian byte order */
u8 *eeprom;
struct iwl_eeprom_calib_info *calib_info;
enum nl80211_iftype iw_mode; enum nl80211_iftype iw_mode;
/* Last Rx'd beacon timestamp */ /* Last Rx'd beacon timestamp */
...@@ -1040,7 +1018,7 @@ struct iwl_priv { ...@@ -1040,7 +1018,7 @@ struct iwl_priv {
struct led_classdev led; struct led_classdev led;
unsigned long blink_on, blink_off; unsigned long blink_on, blink_off;
bool led_registered; bool led_registered;
#ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL #ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE
struct iwl_testmode_trace testmode_trace; struct iwl_testmode_trace testmode_trace;
struct iwl_testmode_sram testmode_sram; struct iwl_testmode_sram testmode_sram;
u32 tm_fixed_rate; u32 tm_fixed_rate;
......
...@@ -215,11 +215,11 @@ static int iwl_eeprom_verify_signature(struct iwl_trans *trans) ...@@ -215,11 +215,11 @@ static int iwl_eeprom_verify_signature(struct iwl_trans *trans)
return ret; return ret;
} }
u16 iwl_eeprom_query16(const struct iwl_priv *priv, size_t offset) u16 iwl_eeprom_query16(const struct iwl_shared *shrd, size_t offset)
{ {
if (!priv->eeprom) if (!shrd->eeprom)
return 0; return 0;
return (u16)priv->eeprom[offset] | ((u16)priv->eeprom[offset + 1] << 8); return (u16)shrd->eeprom[offset] | ((u16)shrd->eeprom[offset + 1] << 8);
} }
int iwl_eeprom_check_version(struct iwl_priv *priv) int iwl_eeprom_check_version(struct iwl_priv *priv)
...@@ -227,8 +227,8 @@ int iwl_eeprom_check_version(struct iwl_priv *priv) ...@@ -227,8 +227,8 @@ int iwl_eeprom_check_version(struct iwl_priv *priv)
u16 eeprom_ver; u16 eeprom_ver;
u16 calib_ver; u16 calib_ver;
eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); eeprom_ver = iwl_eeprom_query16(priv->shrd, EEPROM_VERSION);
calib_ver = iwlagn_eeprom_calib_version(priv); calib_ver = iwl_eeprom_calib_version(priv->shrd);
if (eeprom_ver < priv->cfg->eeprom_ver || if (eeprom_ver < priv->cfg->eeprom_ver ||
calib_ver < priv->cfg->eeprom_calib_ver) calib_ver < priv->cfg->eeprom_calib_ver)
...@@ -249,11 +249,12 @@ int iwl_eeprom_check_version(struct iwl_priv *priv) ...@@ -249,11 +249,12 @@ int iwl_eeprom_check_version(struct iwl_priv *priv)
int iwl_eeprom_check_sku(struct iwl_priv *priv) int iwl_eeprom_check_sku(struct iwl_priv *priv)
{ {
struct iwl_shared *shrd = priv->shrd;
u16 radio_cfg; u16 radio_cfg;
if (!priv->cfg->sku) { if (!priv->cfg->sku) {
/* not using sku overwrite */ /* not using sku overwrite */
priv->cfg->sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP); priv->cfg->sku = iwl_eeprom_query16(shrd, EEPROM_SKU_CAP);
if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE && if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE &&
!priv->cfg->ht_params) { !priv->cfg->ht_params) {
IWL_ERR(priv, "Invalid 11n configuration\n"); IWL_ERR(priv, "Invalid 11n configuration\n");
...@@ -269,7 +270,7 @@ int iwl_eeprom_check_sku(struct iwl_priv *priv) ...@@ -269,7 +270,7 @@ int iwl_eeprom_check_sku(struct iwl_priv *priv)
if (!priv->cfg->valid_tx_ant && !priv->cfg->valid_rx_ant) { if (!priv->cfg->valid_tx_ant && !priv->cfg->valid_rx_ant) {
/* not using .cfg overwrite */ /* not using .cfg overwrite */
radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG); radio_cfg = iwl_eeprom_query16(shrd, EEPROM_RADIO_CONFIG);
priv->cfg->valid_tx_ant = EEPROM_RF_CFG_TX_ANT_MSK(radio_cfg); priv->cfg->valid_tx_ant = EEPROM_RF_CFG_TX_ANT_MSK(radio_cfg);
priv->cfg->valid_rx_ant = EEPROM_RF_CFG_RX_ANT_MSK(radio_cfg); priv->cfg->valid_rx_ant = EEPROM_RF_CFG_RX_ANT_MSK(radio_cfg);
if (!priv->cfg->valid_tx_ant || !priv->cfg->valid_rx_ant) { if (!priv->cfg->valid_tx_ant || !priv->cfg->valid_rx_ant) {
...@@ -289,9 +290,9 @@ int iwl_eeprom_check_sku(struct iwl_priv *priv) ...@@ -289,9 +290,9 @@ int iwl_eeprom_check_sku(struct iwl_priv *priv)
return 0; return 0;
} }
void iwl_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac) void iwl_eeprom_get_mac(const struct iwl_shared *shrd, u8 *mac)
{ {
const u8 *addr = iwl_eeprom_query_addr(priv, const u8 *addr = iwl_eeprom_query_addr(shrd,
EEPROM_MAC_ADDRESS); EEPROM_MAC_ADDRESS);
memcpy(mac, addr, ETH_ALEN); memcpy(mac, addr, ETH_ALEN);
} }
...@@ -582,6 +583,7 @@ iwl_eeprom_enh_txp_read_element(struct iwl_priv *priv, ...@@ -582,6 +583,7 @@ iwl_eeprom_enh_txp_read_element(struct iwl_priv *priv,
void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv) void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv)
{ {
struct iwl_shared *shrd = priv->shrd;
struct iwl_eeprom_enhanced_txpwr *txp_array, *txp; struct iwl_eeprom_enhanced_txpwr *txp_array, *txp;
int idx, entries; int idx, entries;
__le16 *txp_len; __le16 *txp_len;
...@@ -590,10 +592,10 @@ void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv) ...@@ -590,10 +592,10 @@ void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv)
BUILD_BUG_ON(sizeof(struct iwl_eeprom_enhanced_txpwr) != 8); BUILD_BUG_ON(sizeof(struct iwl_eeprom_enhanced_txpwr) != 8);
/* the length is in 16-bit words, but we want entries */ /* the length is in 16-bit words, but we want entries */
txp_len = (__le16 *) iwl_eeprom_query_addr(priv, EEPROM_TXP_SZ_OFFS); txp_len = (__le16 *) iwl_eeprom_query_addr(shrd, EEPROM_TXP_SZ_OFFS);
entries = le16_to_cpup(txp_len) * 2 / EEPROM_TXP_ENTRY_LEN; entries = le16_to_cpup(txp_len) * 2 / EEPROM_TXP_ENTRY_LEN;
txp_array = (void *) iwl_eeprom_query_addr(priv, EEPROM_TXP_OFFS); txp_array = (void *) iwl_eeprom_query_addr(shrd, EEPROM_TXP_OFFS);
for (idx = 0; idx < entries; idx++) { for (idx = 0; idx < entries; idx++) {
txp = &txp_array[idx]; txp = &txp_array[idx];
...@@ -646,12 +648,13 @@ void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv) ...@@ -646,12 +648,13 @@ void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv)
/** /**
* iwl_eeprom_init - read EEPROM contents * iwl_eeprom_init - read EEPROM contents
* *
* Load the EEPROM contents from adapter into priv->eeprom * Load the EEPROM contents from adapter into shrd->eeprom
* *
* NOTE: This routine uses the non-debug IO access functions. * NOTE: This routine uses the non-debug IO access functions.
*/ */
int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev) int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
{ {
struct iwl_shared *shrd = priv->shrd;
__le16 *e; __le16 *e;
u32 gp = iwl_read32(bus(priv), CSR_EEPROM_GP); u32 gp = iwl_read32(bus(priv), CSR_EEPROM_GP);
int sz; int sz;
...@@ -666,12 +669,12 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev) ...@@ -666,12 +669,12 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
/* allocate eeprom */ /* allocate eeprom */
sz = priv->cfg->base_params->eeprom_size; sz = priv->cfg->base_params->eeprom_size;
IWL_DEBUG_EEPROM(priv, "NVM size = %d\n", sz); IWL_DEBUG_EEPROM(priv, "NVM size = %d\n", sz);
priv->eeprom = kzalloc(sz, GFP_KERNEL); shrd->eeprom = kzalloc(sz, GFP_KERNEL);
if (!priv->eeprom) { if (!shrd->eeprom) {
ret = -ENOMEM; ret = -ENOMEM;
goto alloc_err; goto alloc_err;
} }
e = (__le16 *)priv->eeprom; e = (__le16 *)shrd->eeprom;
iwl_apm_init(priv); iwl_apm_init(priv);
...@@ -746,7 +749,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev) ...@@ -746,7 +749,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
IWL_DEBUG_EEPROM(priv, "NVM Type: %s, version: 0x%x\n", IWL_DEBUG_EEPROM(priv, "NVM Type: %s, version: 0x%x\n",
(trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP) (trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP)
? "OTP" : "EEPROM", ? "OTP" : "EEPROM",
iwl_eeprom_query16(priv, EEPROM_VERSION)); iwl_eeprom_query16(shrd, EEPROM_VERSION));
ret = 0; ret = 0;
done: done:
...@@ -754,17 +757,17 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev) ...@@ -754,17 +757,17 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
err: err:
if (ret) if (ret)
iwl_eeprom_free(priv); iwl_eeprom_free(priv->shrd);
/* Reset chip to save power until we load uCode during "up". */ /* Reset chip to save power until we load uCode during "up". */
iwl_apm_stop(priv); iwl_apm_stop(priv);
alloc_err: alloc_err:
return ret; return ret;
} }
void iwl_eeprom_free(struct iwl_priv *priv) void iwl_eeprom_free(struct iwl_shared *shrd)
{ {
kfree(priv->eeprom); kfree(shrd->eeprom);
priv->eeprom = NULL; shrd->eeprom = NULL;
} }
static void iwl_init_band_reference(const struct iwl_priv *priv, static void iwl_init_band_reference(const struct iwl_priv *priv,
...@@ -772,49 +775,50 @@ static void iwl_init_band_reference(const struct iwl_priv *priv, ...@@ -772,49 +775,50 @@ static void iwl_init_band_reference(const struct iwl_priv *priv,
const struct iwl_eeprom_channel **eeprom_ch_info, const struct iwl_eeprom_channel **eeprom_ch_info,
const u8 **eeprom_ch_index) const u8 **eeprom_ch_index)
{ {
struct iwl_shared *shrd = priv->shrd;
u32 offset = priv->cfg->lib-> u32 offset = priv->cfg->lib->
eeprom_ops.regulatory_bands[eep_band - 1]; eeprom_ops.regulatory_bands[eep_band - 1];
switch (eep_band) { switch (eep_band) {
case 1: /* 2.4GHz band */ case 1: /* 2.4GHz band */
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_1); *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_1);
*eeprom_ch_info = (struct iwl_eeprom_channel *) *eeprom_ch_info = (struct iwl_eeprom_channel *)
iwl_eeprom_query_addr(priv, offset); iwl_eeprom_query_addr(shrd, offset);
*eeprom_ch_index = iwl_eeprom_band_1; *eeprom_ch_index = iwl_eeprom_band_1;
break; break;
case 2: /* 4.9GHz band */ case 2: /* 4.9GHz band */
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_2); *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_2);
*eeprom_ch_info = (struct iwl_eeprom_channel *) *eeprom_ch_info = (struct iwl_eeprom_channel *)
iwl_eeprom_query_addr(priv, offset); iwl_eeprom_query_addr(shrd, offset);
*eeprom_ch_index = iwl_eeprom_band_2; *eeprom_ch_index = iwl_eeprom_band_2;
break; break;
case 3: /* 5.2GHz band */ case 3: /* 5.2GHz band */
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_3); *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_3);
*eeprom_ch_info = (struct iwl_eeprom_channel *) *eeprom_ch_info = (struct iwl_eeprom_channel *)
iwl_eeprom_query_addr(priv, offset); iwl_eeprom_query_addr(shrd, offset);
*eeprom_ch_index = iwl_eeprom_band_3; *eeprom_ch_index = iwl_eeprom_band_3;
break; break;
case 4: /* 5.5GHz band */ case 4: /* 5.5GHz band */
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_4); *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_4);
*eeprom_ch_info = (struct iwl_eeprom_channel *) *eeprom_ch_info = (struct iwl_eeprom_channel *)
iwl_eeprom_query_addr(priv, offset); iwl_eeprom_query_addr(shrd, offset);
*eeprom_ch_index = iwl_eeprom_band_4; *eeprom_ch_index = iwl_eeprom_band_4;
break; break;
case 5: /* 5.7GHz band */ case 5: /* 5.7GHz band */
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_5); *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_5);
*eeprom_ch_info = (struct iwl_eeprom_channel *) *eeprom_ch_info = (struct iwl_eeprom_channel *)
iwl_eeprom_query_addr(priv, offset); iwl_eeprom_query_addr(shrd, offset);
*eeprom_ch_index = iwl_eeprom_band_5; *eeprom_ch_index = iwl_eeprom_band_5;
break; break;
case 6: /* 2.4GHz ht40 channels */ case 6: /* 2.4GHz ht40 channels */
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_6); *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_6);
*eeprom_ch_info = (struct iwl_eeprom_channel *) *eeprom_ch_info = (struct iwl_eeprom_channel *)
iwl_eeprom_query_addr(priv, offset); iwl_eeprom_query_addr(shrd, offset);
*eeprom_ch_index = iwl_eeprom_band_6; *eeprom_ch_index = iwl_eeprom_band_6;
break; break;
case 7: /* 5 GHz ht40 channels */ case 7: /* 5 GHz ht40 channels */
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_7); *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_7);
*eeprom_ch_info = (struct iwl_eeprom_channel *) *eeprom_ch_info = (struct iwl_eeprom_channel *)
iwl_eeprom_query_addr(priv, offset); iwl_eeprom_query_addr(shrd, offset);
*eeprom_ch_index = iwl_eeprom_band_7; *eeprom_ch_index = iwl_eeprom_band_7;
break; break;
default: default:
...@@ -1064,7 +1068,7 @@ void iwl_rf_config(struct iwl_priv *priv) ...@@ -1064,7 +1068,7 @@ void iwl_rf_config(struct iwl_priv *priv)
{ {
u16 radio_cfg; u16 radio_cfg;
radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG); radio_cfg = iwl_eeprom_query16(priv->shrd, EEPROM_RADIO_CONFIG);
/* write radio config values to register */ /* write radio config values to register */
if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) { if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) {
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
#include <net/mac80211.h> #include <net/mac80211.h>
struct iwl_priv; struct iwl_priv;
struct iwl_shared;
/* /*
* EEPROM access time values: * EEPROM access time values:
...@@ -305,11 +306,11 @@ struct iwl_eeprom_ops { ...@@ -305,11 +306,11 @@ struct iwl_eeprom_ops {
int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev); int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev);
void iwl_eeprom_free(struct iwl_priv *priv); void iwl_eeprom_free(struct iwl_shared *shrd);
int iwl_eeprom_check_version(struct iwl_priv *priv); int iwl_eeprom_check_version(struct iwl_priv *priv);
int iwl_eeprom_check_sku(struct iwl_priv *priv); int iwl_eeprom_check_sku(struct iwl_priv *priv);
const u8 *iwl_eeprom_query_addr(const struct iwl_priv *priv, size_t offset); const u8 *iwl_eeprom_query_addr(const struct iwl_shared *shrd, size_t offset);
u16 iwl_eeprom_query16(const struct iwl_priv *priv, size_t offset); u16 iwl_eeprom_query16(const struct iwl_shared *shrd, size_t offset);
int iwl_init_channel_map(struct iwl_priv *priv); int iwl_init_channel_map(struct iwl_priv *priv);
void iwl_free_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_channel_info *iwl_get_channel_info(
......
...@@ -427,7 +427,7 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw) ...@@ -427,7 +427,7 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw)
iwl_write32(bus(priv), CSR_UCODE_DRV_GP1_CLR, iwl_write32(bus(priv), CSR_UCODE_DRV_GP1_CLR,
CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE); CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE);
base = priv->device_pointers.error_event_table; base = priv->shrd->device_pointers.error_event_table;
if (iwlagn_hw_valid_rtc_data_addr(base)) { if (iwlagn_hw_valid_rtc_data_addr(base)) {
spin_lock_irqsave(&bus(priv)->reg_lock, flags); spin_lock_irqsave(&bus(priv)->reg_lock, flags);
ret = iwl_grab_nic_access_silent(bus(priv)); ret = iwl_grab_nic_access_silent(bus(priv));
...@@ -811,21 +811,9 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, ...@@ -811,21 +811,9 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
/* Configure HT40 channels */ /* Configure HT40 channels */
ctx->ht.enabled = conf_is_ht(conf); ctx->ht.enabled = conf_is_ht(conf);
if (ctx->ht.enabled) { if (ctx->ht.enabled)
if (conf_is_ht40_minus(conf)) { iwlagn_config_ht40(conf, ctx);
ctx->ht.extension_chan_offset = else
IEEE80211_HT_PARAM_CHA_SEC_BELOW;
ctx->ht.is_40mhz = true;
} else if (conf_is_ht40_plus(conf)) {
ctx->ht.extension_chan_offset =
IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
ctx->ht.is_40mhz = true;
} else {
ctx->ht.extension_chan_offset =
IEEE80211_HT_PARAM_CHA_SEC_NONE;
ctx->ht.is_40mhz = false;
}
} else
ctx->ht.is_40mhz = false; ctx->ht.is_40mhz = false;
if ((le16_to_cpu(ctx->staging.channel) != ch)) if ((le16_to_cpu(ctx->staging.channel) != ch))
......
...@@ -97,6 +97,7 @@ ...@@ -97,6 +97,7 @@
struct iwl_cfg; struct iwl_cfg;
struct iwl_bus; struct iwl_bus;
struct iwl_priv; struct iwl_priv;
struct iwl_trans;
struct iwl_sensitivity_ranges; struct iwl_sensitivity_ranges;
struct iwl_trans_ops; struct iwl_trans_ops;
...@@ -294,7 +295,7 @@ enum iwl_ucode_type { ...@@ -294,7 +295,7 @@ enum iwl_ucode_type {
struct iwl_notification_wait { struct iwl_notification_wait {
struct list_head list; struct list_head list;
void (*fn)(struct iwl_priv *priv, struct iwl_rx_packet *pkt, void (*fn)(struct iwl_trans *trans, struct iwl_rx_packet *pkt,
void *data); void *data);
void *fn_data; void *fn_data;
...@@ -323,6 +324,7 @@ struct iwl_notification_wait { ...@@ -323,6 +324,7 @@ struct iwl_notification_wait {
* @notif_waits: things waiting for notification * @notif_waits: things waiting for notification
* @notif_wait_lock: lock protecting notification * @notif_wait_lock: lock protecting notification
* @notif_waitq: head of notification wait queue * @notif_waitq: head of notification wait queue
* @device_pointers: pointers to ucode event tables
*/ */
struct iwl_shared { struct iwl_shared {
#ifdef CONFIG_IWLWIFI_DEBUG #ifdef CONFIG_IWLWIFI_DEBUG
...@@ -351,6 +353,9 @@ struct iwl_shared { ...@@ -351,6 +353,9 @@ struct iwl_shared {
wait_queue_head_t wait_command_queue; wait_queue_head_t wait_command_queue;
/* eeprom -- this is in the card's little endian byte order */
u8 *eeprom;
/* ucode related variables */ /* ucode related variables */
enum iwl_ucode_type ucode_type; enum iwl_ucode_type ucode_type;
...@@ -358,6 +363,12 @@ struct iwl_shared { ...@@ -358,6 +363,12 @@ struct iwl_shared {
struct list_head notif_waits; struct list_head notif_waits;
spinlock_t notif_wait_lock; spinlock_t notif_wait_lock;
wait_queue_head_t notif_waitq; wait_queue_head_t notif_waitq;
struct {
u32 error_event_table;
u32 log_event_table;
} device_pointers;
}; };
/*Whatever _m is (iwl_trans, iwl_priv, iwl_bus, these macros will work */ /*Whatever _m is (iwl_trans, iwl_priv, iwl_bus, these macros will work */
...@@ -507,7 +518,7 @@ void __acquires(wait_entry) ...@@ -507,7 +518,7 @@ void __acquires(wait_entry)
iwl_init_notification_wait(struct iwl_shared *shrd, iwl_init_notification_wait(struct iwl_shared *shrd,
struct iwl_notification_wait *wait_entry, struct iwl_notification_wait *wait_entry,
u8 cmd, u8 cmd,
void (*fn)(struct iwl_priv *priv, void (*fn)(struct iwl_trans *trans,
struct iwl_rx_packet *pkt, struct iwl_rx_packet *pkt,
void *data), void *data),
void *fn_data); void *fn_data);
......
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-testmode.h" #include "iwl-testmode.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-bus.h"
/* The TLVs used in the gnl message policy between the kernel module and /* The TLVs used in the gnl message policy between the kernel module and
* user space application. iwl_testmode_gnl_msg_policy is to be carried * user space application. iwl_testmode_gnl_msg_policy is to be carried
...@@ -110,6 +111,9 @@ struct nla_policy iwl_testmode_gnl_msg_policy[IWL_TM_ATTR_MAX] = { ...@@ -110,6 +111,9 @@ struct nla_policy iwl_testmode_gnl_msg_policy[IWL_TM_ATTR_MAX] = {
[IWL_TM_ATTR_SRAM_ADDR] = { .type = NLA_U32, }, [IWL_TM_ATTR_SRAM_ADDR] = { .type = NLA_U32, },
[IWL_TM_ATTR_SRAM_SIZE] = { .type = NLA_U32, }, [IWL_TM_ATTR_SRAM_SIZE] = { .type = NLA_U32, },
[IWL_TM_ATTR_SRAM_DUMP] = { .type = NLA_UNSPEC, }, [IWL_TM_ATTR_SRAM_DUMP] = { .type = NLA_UNSPEC, },
[IWL_TM_ATTR_FW_VERSION] = { .type = NLA_U32, },
[IWL_TM_ATTR_DEVICE_ID] = { .type = NLA_U32, },
}; };
/* /*
...@@ -416,6 +420,8 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) ...@@ -416,6 +420,8 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
struct sk_buff *skb; struct sk_buff *skb;
unsigned char *rsp_data_ptr = NULL; unsigned char *rsp_data_ptr = NULL;
int status = 0, rsp_data_len = 0; int status = 0, rsp_data_len = 0;
char buf[32], *ptr = NULL;
unsigned int num, devid;
switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {
case IWL_TM_CMD_APP2DEV_GET_DEVICENAME: case IWL_TM_CMD_APP2DEV_GET_DEVICENAME:
...@@ -479,7 +485,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) ...@@ -479,7 +485,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
break; break;
case IWL_TM_CMD_APP2DEV_GET_EEPROM: case IWL_TM_CMD_APP2DEV_GET_EEPROM:
if (priv->eeprom) { if (priv->shrd->eeprom) {
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy,
priv->cfg->base_params->eeprom_size + 20); priv->cfg->base_params->eeprom_size + 20);
if (!skb) { if (!skb) {
...@@ -491,7 +497,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) ...@@ -491,7 +497,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
IWL_TM_CMD_DEV2APP_EEPROM_RSP); IWL_TM_CMD_DEV2APP_EEPROM_RSP);
NLA_PUT(skb, IWL_TM_ATTR_EEPROM, NLA_PUT(skb, IWL_TM_ATTR_EEPROM,
priv->cfg->base_params->eeprom_size, priv->cfg->base_params->eeprom_size,
priv->eeprom); priv->shrd->eeprom);
status = cfg80211_testmode_reply(skb); status = cfg80211_testmode_reply(skb);
if (status < 0) if (status < 0)
IWL_DEBUG_INFO(priv, IWL_DEBUG_INFO(priv,
...@@ -510,6 +516,43 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) ...@@ -510,6 +516,43 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
priv->tm_fixed_rate = nla_get_u32(tb[IWL_TM_ATTR_FIXRATE]); priv->tm_fixed_rate = nla_get_u32(tb[IWL_TM_ATTR_FIXRATE]);
break; break;
case IWL_TM_CMD_APP2DEV_GET_FW_VERSION:
IWL_INFO(priv, "uCode version raw: 0x%x\n", priv->ucode_ver);
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20);
if (!skb) {
IWL_DEBUG_INFO(priv, "Error allocating memory\n");
return -ENOMEM;
}
NLA_PUT_U32(skb, IWL_TM_ATTR_FW_VERSION, priv->ucode_ver);
status = cfg80211_testmode_reply(skb);
if (status < 0)
IWL_DEBUG_INFO(priv,
"Error sending msg : %d\n", status);
break;
case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID:
bus_get_hw_id(bus(priv), buf, sizeof(buf));
ptr = buf;
strsep(&ptr, ":");
sscanf(strsep(&ptr, ":"), "%x", &num);
sscanf(strsep(&ptr, ":"), "%x", &devid);
IWL_INFO(priv, "Device ID = 0x%04x, SubDevice ID= 0x%04x\n",
num, devid);
devid |= (num << 16);
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20);
if (!skb) {
IWL_DEBUG_INFO(priv, "Error allocating memory\n");
return -ENOMEM;
}
NLA_PUT_U32(skb, IWL_TM_ATTR_DEVICE_ID, devid);
status = cfg80211_testmode_reply(skb);
if (status < 0)
IWL_DEBUG_INFO(priv,
"Error sending msg : %d\n", status);
break;
default: default:
IWL_DEBUG_INFO(priv, "Unknown testmode driver command ID\n"); IWL_DEBUG_INFO(priv, "Unknown testmode driver command ID\n");
return -ENOSYS; return -ENOSYS;
...@@ -842,6 +885,8 @@ int iwlagn_mac_testmode_cmd(struct ieee80211_hw *hw, void *data, int len) ...@@ -842,6 +885,8 @@ int iwlagn_mac_testmode_cmd(struct ieee80211_hw *hw, void *data, int len)
case IWL_TM_CMD_APP2DEV_GET_EEPROM: case IWL_TM_CMD_APP2DEV_GET_EEPROM:
case IWL_TM_CMD_APP2DEV_FIXRATE_REQ: case IWL_TM_CMD_APP2DEV_FIXRATE_REQ:
case IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW: case IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW:
case IWL_TM_CMD_APP2DEV_GET_FW_VERSION:
case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID:
IWL_DEBUG_INFO(priv, "testmode cmd to driver\n"); IWL_DEBUG_INFO(priv, "testmode cmd to driver\n");
result = iwl_testmode_driver(hw, tb); result = iwl_testmode_driver(hw, tb);
break; break;
......
...@@ -118,6 +118,8 @@ ...@@ -118,6 +118,8 @@
* commands from user applicaiton to read data in sram * commands from user applicaiton to read data in sram
* *
* @IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW: load Weak On Wireless LAN uCode image * @IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW: load Weak On Wireless LAN uCode image
* @IWL_TM_CMD_APP2DEV_GET_FW_VERSION: retrieve uCode version
* @IWL_TM_CMD_APP2DEV_GET_DEVICE_ID: retrieve ID information in device
* *
*/ */
enum iwl_tm_cmd_t { enum iwl_tm_cmd_t {
...@@ -143,7 +145,9 @@ enum iwl_tm_cmd_t { ...@@ -143,7 +145,9 @@ enum iwl_tm_cmd_t {
IWL_TM_CMD_APP2DEV_READ_SRAM = 20, IWL_TM_CMD_APP2DEV_READ_SRAM = 20,
IWL_TM_CMD_APP2DEV_DUMP_SRAM = 21, IWL_TM_CMD_APP2DEV_DUMP_SRAM = 21,
IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW = 22, IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW = 22,
IWL_TM_CMD_MAX = 23, IWL_TM_CMD_APP2DEV_GET_FW_VERSION = 23,
IWL_TM_CMD_APP2DEV_GET_DEVICE_ID = 24,
IWL_TM_CMD_MAX = 25,
}; };
/* /*
...@@ -225,6 +229,14 @@ enum iwl_tm_cmd_t { ...@@ -225,6 +229,14 @@ enum iwl_tm_cmd_t {
* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_DUMP_SRAM, * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_DUMP_SRAM,
* IWL_TM_ATTR_SRAM_DUMP for the data in sram * IWL_TM_ATTR_SRAM_DUMP for the data in sram
* *
* @IWL_TM_ATTR_FW_VERSION:
* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_GET_FW_VERSION,
* IWL_TM_ATTR_FW_VERSION for the uCode version
*
* @IWL_TM_ATTR_DEVICE_ID:
* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_GET_DEVICE_ID,
* IWL_TM_ATTR_DEVICE_ID for the device ID information
*
*/ */
enum iwl_tm_attr_t { enum iwl_tm_attr_t {
IWL_TM_ATTR_NOT_APPLICABLE = 0, IWL_TM_ATTR_NOT_APPLICABLE = 0,
...@@ -245,7 +257,9 @@ enum iwl_tm_attr_t { ...@@ -245,7 +257,9 @@ enum iwl_tm_attr_t {
IWL_TM_ATTR_SRAM_ADDR = 15, IWL_TM_ATTR_SRAM_ADDR = 15,
IWL_TM_ATTR_SRAM_SIZE = 16, IWL_TM_ATTR_SRAM_SIZE = 16,
IWL_TM_ATTR_SRAM_DUMP = 17, IWL_TM_ATTR_SRAM_DUMP = 17,
IWL_TM_ATTR_MAX = 18, IWL_TM_ATTR_FW_VERSION = 18,
IWL_TM_ATTR_DEVICE_ID = 19,
IWL_TM_ATTR_MAX = 20,
}; };
/* uCode trace buffer */ /* uCode trace buffer */
......
...@@ -594,7 +594,7 @@ static void iwl_dump_nic_error_log(struct iwl_trans *trans) ...@@ -594,7 +594,7 @@ static void iwl_dump_nic_error_log(struct iwl_trans *trans)
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie =
IWL_TRANS_GET_PCIE_TRANS(trans); IWL_TRANS_GET_PCIE_TRANS(trans);
base = priv->device_pointers.error_event_table; base = trans->shrd->device_pointers.error_event_table;
if (trans->shrd->ucode_type == IWL_UCODE_INIT) { if (trans->shrd->ucode_type == IWL_UCODE_INIT) {
if (!base) if (!base)
base = priv->init_errlog_ptr; base = priv->init_errlog_ptr;
...@@ -648,6 +648,21 @@ static void iwl_dump_nic_error_log(struct iwl_trans *trans) ...@@ -648,6 +648,21 @@ static void iwl_dump_nic_error_log(struct iwl_trans *trans)
IWL_ERR(trans, "0x%08X | hw version\n", table.hw_ver); IWL_ERR(trans, "0x%08X | hw version\n", table.hw_ver);
IWL_ERR(trans, "0x%08X | board version\n", table.brd_ver); IWL_ERR(trans, "0x%08X | board version\n", table.brd_ver);
IWL_ERR(trans, "0x%08X | hcmd\n", table.hcmd); IWL_ERR(trans, "0x%08X | hcmd\n", table.hcmd);
IWL_ERR(trans, "0x%08X | isr0\n", table.isr0);
IWL_ERR(trans, "0x%08X | isr1\n", table.isr1);
IWL_ERR(trans, "0x%08X | isr2\n", table.isr2);
IWL_ERR(trans, "0x%08X | isr3\n", table.isr3);
IWL_ERR(trans, "0x%08X | isr4\n", table.isr4);
IWL_ERR(trans, "0x%08X | isr_pref\n", table.isr_pref);
IWL_ERR(trans, "0x%08X | wait_event\n", table.wait_event);
IWL_ERR(trans, "0x%08X | l2p_control\n", table.l2p_control);
IWL_ERR(trans, "0x%08X | l2p_duration\n", table.l2p_duration);
IWL_ERR(trans, "0x%08X | l2p_mhvalid\n", table.l2p_mhvalid);
IWL_ERR(trans, "0x%08X | l2p_addr_match\n", table.l2p_addr_match);
IWL_ERR(trans, "0x%08X | lmpm_pmg_sel\n", table.lmpm_pmg_sel);
IWL_ERR(trans, "0x%08X | timestamp\n", table.u_timestamp);
IWL_ERR(trans, "0x%08X | flow_handler\n", table.flow_handler);
} }
/** /**
...@@ -709,7 +724,7 @@ static int iwl_print_event_log(struct iwl_trans *trans, u32 start_idx, ...@@ -709,7 +724,7 @@ static int iwl_print_event_log(struct iwl_trans *trans, u32 start_idx,
if (num_events == 0) if (num_events == 0)
return pos; return pos;
base = priv->device_pointers.log_event_table; base = trans->shrd->device_pointers.log_event_table;
if (trans->shrd->ucode_type == IWL_UCODE_INIT) { if (trans->shrd->ucode_type == IWL_UCODE_INIT) {
if (!base) if (!base)
base = priv->init_evtlog_ptr; base = priv->init_evtlog_ptr;
...@@ -823,7 +838,7 @@ int iwl_dump_nic_event_log(struct iwl_trans *trans, bool full_log, ...@@ -823,7 +838,7 @@ int iwl_dump_nic_event_log(struct iwl_trans *trans, bool full_log,
size_t bufsz = 0; size_t bufsz = 0;
struct iwl_priv *priv = priv(trans); struct iwl_priv *priv = priv(trans);
base = priv->device_pointers.log_event_table; base = trans->shrd->device_pointers.log_event_table;
if (trans->shrd->ucode_type == IWL_UCODE_INIT) { if (trans->shrd->ucode_type == IWL_UCODE_INIT) {
logsize = priv->init_evtlog_size; logsize = priv->init_evtlog_size;
if (!base) if (!base)
......
...@@ -1373,6 +1373,7 @@ static void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int sta_id, int tid, ...@@ -1373,6 +1373,7 @@ static void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int sta_id, int tid,
static void iwl_trans_pcie_free(struct iwl_trans *trans) static void iwl_trans_pcie_free(struct iwl_trans *trans)
{ {
iwl_calib_free_results(trans);
iwl_trans_pcie_tx_free(trans); iwl_trans_pcie_tx_free(trans);
iwl_trans_pcie_rx_free(trans); iwl_trans_pcie_rx_free(trans);
free_irq(bus(trans)->irq, trans); free_irq(bus(trans)->irq, trans);
......
...@@ -220,6 +220,14 @@ struct fw_img { ...@@ -220,6 +220,14 @@ struct fw_img {
struct fw_desc data; /* firmware data image */ struct fw_desc data; /* firmware data image */
}; };
/* Opaque calibration results */
struct iwl_calib_result {
struct list_head list;
size_t cmd_len;
struct iwl_calib_hdr hdr;
/* data follows */
};
/** /**
* struct iwl_trans - transport common data * struct iwl_trans - transport common data
* @ops - pointer to iwl_trans_ops * @ops - pointer to iwl_trans_ops
...@@ -229,6 +237,8 @@ struct fw_img { ...@@ -229,6 +237,8 @@ struct fw_img {
* @ucode_rt: run time ucode image * @ucode_rt: run time ucode image
* @ucode_init: init ucode image * @ucode_init: init ucode image
* @ucode_wowlan: wake on wireless ucode image (optional) * @ucode_wowlan: wake on wireless ucode image (optional)
* @nvm_device_type: indicates OTP or eeprom
* @calib_results: list head for init calibration results
*/ */
struct iwl_trans { struct iwl_trans {
const struct iwl_trans_ops *ops; const struct iwl_trans_ops *ops;
...@@ -243,6 +253,9 @@ struct iwl_trans { ...@@ -243,6 +253,9 @@ struct iwl_trans {
/* eeprom related variables */ /* eeprom related variables */
int nvm_device_type; int nvm_device_type;
/* init calibration results */
struct list_head calib_results;
/* pointer to trans specific struct */ /* pointer to trans specific struct */
/*Ensure that this pointer will always be aligned to sizeof pointer */ /*Ensure that this pointer will always be aligned to sizeof pointer */
char trans_specific[0] __attribute__((__aligned__(sizeof(void *)))); char trans_specific[0] __attribute__((__aligned__(sizeof(void *))));
...@@ -379,4 +392,9 @@ int iwl_alloc_fw_desc(struct iwl_bus *bus, struct fw_desc *desc, ...@@ -379,4 +392,9 @@ int iwl_alloc_fw_desc(struct iwl_bus *bus, struct fw_desc *desc,
const void *data, size_t len); const void *data, size_t len);
void iwl_dealloc_ucode(struct iwl_trans *trans); void iwl_dealloc_ucode(struct iwl_trans *trans);
int iwl_send_calib_results(struct iwl_trans *trans);
int iwl_calib_set(struct iwl_trans *trans,
const struct iwl_calib_hdr *cmd, int len);
void iwl_calib_free_results(struct iwl_trans *trans);
#endif /* __iwl_trans_h__ */ #endif /* __iwl_trans_h__ */
...@@ -217,19 +217,20 @@ static int iwl_set_Xtal_calib(struct iwl_priv *priv) ...@@ -217,19 +217,20 @@ static int iwl_set_Xtal_calib(struct iwl_priv *priv)
{ {
struct iwl_calib_xtal_freq_cmd cmd; struct iwl_calib_xtal_freq_cmd cmd;
__le16 *xtal_calib = __le16 *xtal_calib =
(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_XTAL); (__le16 *)iwl_eeprom_query_addr(priv->shrd, EEPROM_XTAL);
iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD); iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD);
cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]); cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]);
cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]); cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]);
return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd)); return iwl_calib_set(trans(priv), (void *)&cmd, sizeof(cmd));
} }
static int iwl_set_temperature_offset_calib(struct iwl_priv *priv) static int iwl_set_temperature_offset_calib(struct iwl_priv *priv)
{ {
struct iwl_calib_temperature_offset_cmd cmd; struct iwl_calib_temperature_offset_cmd cmd;
__le16 *offset_calib = __le16 *offset_calib =
(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_RAW_TEMPERATURE); (__le16 *)iwl_eeprom_query_addr(priv->shrd,
EEPROM_RAW_TEMPERATURE);
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
...@@ -239,21 +240,22 @@ static int iwl_set_temperature_offset_calib(struct iwl_priv *priv) ...@@ -239,21 +240,22 @@ static int iwl_set_temperature_offset_calib(struct iwl_priv *priv)
IWL_DEBUG_CALIB(priv, "Radio sensor offset: %d\n", IWL_DEBUG_CALIB(priv, "Radio sensor offset: %d\n",
le16_to_cpu(cmd.radio_sensor_offset)); le16_to_cpu(cmd.radio_sensor_offset));
return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd)); return iwl_calib_set(trans(priv), (void *)&cmd, sizeof(cmd));
} }
static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv) static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv)
{ {
struct iwl_calib_temperature_offset_v2_cmd cmd; struct iwl_calib_temperature_offset_v2_cmd cmd;
__le16 *offset_calib_high = (__le16 *)iwl_eeprom_query_addr(priv, __le16 *offset_calib_high = (__le16 *)iwl_eeprom_query_addr(priv->shrd,
EEPROM_KELVIN_TEMPERATURE); EEPROM_KELVIN_TEMPERATURE);
__le16 *offset_calib_low = __le16 *offset_calib_low =
(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_RAW_TEMPERATURE); (__le16 *)iwl_eeprom_query_addr(priv->shrd,
EEPROM_RAW_TEMPERATURE);
struct iwl_eeprom_calib_hdr *hdr; struct iwl_eeprom_calib_hdr *hdr;
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv, hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv->shrd,
EEPROM_CALIB_ALL); EEPROM_CALIB_ALL);
memcpy(&cmd.radio_sensor_offset_high, offset_calib_high, memcpy(&cmd.radio_sensor_offset_high, offset_calib_high,
sizeof(*offset_calib_high)); sizeof(*offset_calib_high));
...@@ -274,7 +276,7 @@ static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv) ...@@ -274,7 +276,7 @@ static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv)
IWL_DEBUG_CALIB(priv, "Voltage Ref: %d\n", IWL_DEBUG_CALIB(priv, "Voltage Ref: %d\n",
le16_to_cpu(cmd.burntVoltageRef)); le16_to_cpu(cmd.burntVoltageRef));
return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd)); return iwl_calib_set(trans(priv), (void *)&cmd, sizeof(cmd));
} }
static int iwl_send_calib_cfg(struct iwl_trans *trans) static int iwl_send_calib_cfg(struct iwl_trans *trans)
...@@ -307,7 +309,7 @@ int iwlagn_rx_calib_result(struct iwl_priv *priv, ...@@ -307,7 +309,7 @@ int iwlagn_rx_calib_result(struct iwl_priv *priv,
/* reduce the size of the length field itself */ /* reduce the size of the length field itself */
len -= 4; len -= 4;
if (iwl_calib_set(priv, hdr, len)) if (iwl_calib_set(trans(priv), hdr, len))
IWL_ERR(priv, "Failed to record calibration data %d\n", IWL_ERR(priv, "Failed to record calibration data %d\n",
hdr->op_code); hdr->op_code);
...@@ -457,7 +459,7 @@ static int iwl_alive_notify(struct iwl_priv *priv) ...@@ -457,7 +459,7 @@ static int iwl_alive_notify(struct iwl_priv *priv)
return ret; return ret;
} }
return iwl_send_calib_results(priv); return iwl_send_calib_results(trans(priv));
} }
...@@ -548,7 +550,7 @@ struct iwlagn_alive_data { ...@@ -548,7 +550,7 @@ struct iwlagn_alive_data {
u8 subtype; u8 subtype;
}; };
static void iwl_alive_fn(struct iwl_priv *priv, static void iwl_alive_fn(struct iwl_trans *trans,
struct iwl_rx_packet *pkt, struct iwl_rx_packet *pkt,
void *data) void *data)
{ {
...@@ -557,14 +559,14 @@ static void iwl_alive_fn(struct iwl_priv *priv, ...@@ -557,14 +559,14 @@ static void iwl_alive_fn(struct iwl_priv *priv,
palive = &pkt->u.alive_frame; palive = &pkt->u.alive_frame;
IWL_DEBUG_FW(priv, "Alive ucode status 0x%08X revision " IWL_DEBUG_FW(trans, "Alive ucode status 0x%08X revision "
"0x%01X 0x%01X\n", "0x%01X 0x%01X\n",
palive->is_valid, palive->ver_type, palive->is_valid, palive->ver_type,
palive->ver_subtype); palive->ver_subtype);
priv->device_pointers.error_event_table = trans->shrd->device_pointers.error_event_table =
le32_to_cpu(palive->error_event_table_ptr); le32_to_cpu(palive->error_event_table_ptr);
priv->device_pointers.log_event_table = trans->shrd->device_pointers.log_event_table =
le32_to_cpu(palive->log_event_table_ptr); le32_to_cpu(palive->log_event_table_ptr);
alive_data->subtype = palive->ver_subtype; alive_data->subtype = palive->ver_subtype;
...@@ -575,7 +577,7 @@ static void iwl_alive_fn(struct iwl_priv *priv, ...@@ -575,7 +577,7 @@ static void iwl_alive_fn(struct iwl_priv *priv,
void iwl_init_notification_wait(struct iwl_shared *shrd, void iwl_init_notification_wait(struct iwl_shared *shrd,
struct iwl_notification_wait *wait_entry, struct iwl_notification_wait *wait_entry,
u8 cmd, u8 cmd,
void (*fn)(struct iwl_priv *priv, void (*fn)(struct iwl_trans *trans,
struct iwl_rx_packet *pkt, struct iwl_rx_packet *pkt,
void *data), void *data),
void *fn_data) void *fn_data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment