From 806d1c8d868e22599e575ce3bff417ee69a1fe64 Mon Sep 17 00:00:00 2001 From: Ben Cahill Date: Thu, 16 Aug 2007 14:49:14 -0700 Subject: [PATCH 05/31] iwlwifi: move all uCode API structs into iwl-command.h Move all uCode API structs into iwl-command.h. Signed-off-by: Ben Cahill Signed-off-by: Zhu Yi --- drivers/net/wireless/iwl-4965-hw.h | 75 ------------ drivers/net/wireless/iwl-commands.h | 217 ++++++++++++++++++++++++++--------- 2 files changed, 161 insertions(+), 131 deletions(-) diff --git a/drivers/net/wireless/iwl-4965-hw.h b/drivers/net/wireless/iwl-4965-hw.h index ca17ea4..97cda41 100644 --- a/drivers/net/wireless/iwl-4965-hw.h +++ b/drivers/net/wireless/iwl-4965-hw.h @@ -98,10 +98,6 @@ enum { CALIB_CH_GROUP_MAX }; -#define POWER_TABLE_NUM_ENTRIES 33 -#define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32 -#define POWER_TABLE_CCK_ENTRY 32 - /* Temperature calibration offset is 3% 0C in Kelvin */ #define TEMPERATURE_CALIB_KELVIN_OFFSET 8 #define TEMPERATURE_CALIB_A_VAL 259 @@ -208,40 +204,6 @@ union iwl_tx_power_dual_stream { u32 dw; }; -/* in reality this is a complex structure - * so mac it struct to emphasize it*/ -struct tx_power_dual_stream { - __le32 dw; -} __attribute__ ((packed)); - -struct iwl_tx_power_db { - struct tx_power_dual_stream - power_tbl[POWER_TABLE_NUM_ENTRIES]; -} __attribute__ ((packed)); - -struct iwl_tx_power_table_cmd { - u8 band; - u8 channel_normal_width; - __le16 channel; - struct iwl_tx_power_db tx_power; -} __attribute__ ((packed)); - -struct iwl_channel_switch_cmd { - u8 band; - u8 expect_beacon; - __le16 channel; - __le32 rxon_flags; - __le32 rxon_filter_flags; - __le32 switch_time; - struct iwl_tx_power_db tx_power; -} __attribute__ ((packed)); - -struct iwl_channel_switch_notif { - __le16 band; - __le16 channel; - __le32 status; -} __attribute__ ((packed)); - /********************* END TXPOWER *****************************************/ /* HT flags */ @@ -300,43 +262,6 @@ struct iwl_channel_switch_notif { #define is_a_band(tbl) (((tbl) == LQ_A)) #define is_g_and(tbl) (((tbl) == LQ_G)) -/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ -#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1<<0) - -#define LINK_QUAL_AC_NUM AC_NUM -#define LINK_QUAL_MAX_RETRY_NUM 16 - -#define LINK_QUAL_ANT_A_MSK (1<<0) -#define LINK_QUAL_ANT_B_MSK (1<<1) -#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) - -struct iwl_link_qual_general_params { - u8 flags; - u8 mimo_delimiter; - u8 single_stream_ant_msk; - u8 dual_stream_ant_msk; - u8 start_rate_index[LINK_QUAL_AC_NUM]; -} __attribute__ ((packed)); - -struct iwl_link_qual_agg_params { - __le16 agg_time_limit; - u8 agg_dis_start_th; - u8 agg_frame_cnt_limit; - __le32 reserved; -} __attribute__ ((packed)); - -struct iwl_link_quality_cmd { - u8 sta_id; - u8 reserved1; - __le16 control; - struct iwl_link_qual_general_params general_params; - struct iwl_link_qual_agg_params agg_params; - struct { - __le32 rate_n_flags; - } rs_table[LINK_QUAL_MAX_RETRY_NUM]; - __le32 reserved2; -} __attribute__ ((packed)); - /* Flow Handler Definitions */ /**********************/ diff --git a/drivers/net/wireless/iwl-commands.h b/drivers/net/wireless/iwl-commands.h index 5ce9847..93aab74 100644 --- a/drivers/net/wireless/iwl-commands.h +++ b/drivers/net/wireless/iwl-commands.h @@ -178,13 +178,13 @@ struct iwl_cmd_header { * *****************************************************************************/ -/* - * Alive Command & Response - */ #define UCODE_VALID_OK __constant_cpu_to_le32(0x1) #define INITIALIZE_SUBTYPE (9) +/* + * REPLY_ALIVE = 0x1 (response only, not a command) + */ struct iwl_alive_resp { u8 ucode_minor; u8 ucode_major; @@ -224,16 +224,15 @@ struct iwl_init_alive_resp { #endif } __attribute__ ((packed)); -/* - * Error Command & Response - */ - union tsf { u8 byte[8]; __le16 word[4]; __le32 dw[2]; }; +/* + * REPLY_ERROR = 0x2 (response only, not a command) + */ struct iwl_error_resp { __le32 error_type; u8 cmd_id; @@ -303,7 +302,7 @@ enum { #define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6) /* - * RXON Command + * REPLY_RXON = 0x10 (command, has simple generic response) */ struct iwl_rxon_cmd { u8 node_addr[6]; @@ -334,7 +333,7 @@ struct iwl_rxon_cmd { } __attribute__ ((packed)); /* - * RXON-ASSOCIATED Command + * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) */ struct iwl_rxon_assoc_cmd { __le32 flags; @@ -350,7 +349,7 @@ struct iwl_rxon_assoc_cmd { } __attribute__ ((packed)); /* - * RXON-Timings Command & Response + * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) */ struct iwl_rxon_time_cmd { union tsf timestamp; @@ -361,14 +360,48 @@ struct iwl_rxon_time_cmd { __le16 reserved; } __attribute__ ((packed)); +#if IWL == 4965 +#define POWER_TABLE_NUM_ENTRIES 33 +#define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32 +#define POWER_TABLE_CCK_ENTRY 32 +struct tx_power_dual_stream { + __le32 dw; +} __attribute__ ((packed)); + +struct iwl_tx_power_db { + struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES]; +} __attribute__ ((packed)); + +/* + * REPLY_CHANNEL_SWITCH = 0x72, + * 4965 + */ +struct iwl_channel_switch_cmd { + u8 band; + u8 expect_beacon; + __le16 channel; + __le32 rxon_flags; + __le32 rxon_filter_flags; + __le32 switch_time; + struct iwl_tx_power_db tx_power; +} __attribute__ ((packed)); +#endif + +/* + * CHANNEL_SWITCH_NOTIFICATION = 0x73, + * 3945 and 4965 + */ +struct iwl_channel_switch_notif { + __le16 band; + __le16 channel; + __le32 status; +} __attribute__ ((packed)); + /****************************************************************************** * (2) * Quality-of-Service (QOS) Commands & Responses: * *****************************************************************************/ -/* - * beacon QOS parameters Command & Response - */ struct iwl_ac_qos { __le16 cw_min; __le16 cw_max; @@ -388,6 +421,9 @@ struct iwl_ac_qos { /* number of Access categories (AC) (EDCA), queues 0..3 */ #define AC_NUM 4 +/* + * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) + */ struct iwl_qosparam_cmd { __le32 qos_flags; struct iwl_ac_qos ac[AC_NUM]; @@ -457,9 +493,6 @@ enum { #define RATE_MCS_ANT_B_MSK 0x8000 #define RATE_MCS_ANT_AB_MSK 0xc000 -/* - * Add/Modify Station Command & Response - */ struct iwl_keyinfo { __le16 key_flags; u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ @@ -477,6 +510,9 @@ struct sta_id_modify { __le16 reserved2; } __attribute__ ((packed)); +/* + * REPLY_ADD_STA = 0x18 (command) + */ struct iwl_addsta_cmd { u8 mode; u8 reserved[3]; @@ -498,6 +534,9 @@ struct iwl_addsta_cmd { #endif } __attribute__ ((packed)); +/* + * REPLY_ADD_STA = 0x18 (response) + */ struct iwl_add_sta_resp { u8 status; } __attribute__ ((packed)); @@ -506,7 +545,7 @@ struct iwl_add_sta_resp { /****************************************************************************** * (4) - * Rx Commands & Responses: + * Rx Responses: * *****************************************************************************/ @@ -556,16 +595,23 @@ struct iwl_rx_frame_end { __le32 beacon_timestamp; } __attribute__ ((packed)); -/* NOTE: DO NOT dereference from casts to this structure +/* + * REPLY_3945_RX = 0x1b (response only, not a command) + * + * NOTE: DO NOT dereference from casts to this structure * It is provided only for calculating minimum data set size. * The actual offsets of the hdr and end are dynamic based on - * stats.phy_count */ + * stats.phy_count + */ struct iwl_rx_frame { struct iwl_rx_frame_stats stats; struct iwl_rx_frame_hdr hdr; struct iwl_rx_frame_end end; } __attribute__ ((packed)); +/* + * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) + */ struct iwl_compressed_ba_resp { __le32 sta_addr_lo32; __le16 sta_addr_hi16; @@ -634,6 +680,9 @@ struct iwl_dram_scratch { __le16 reserved; } __attribute__ ((packed)); +/* + * REPLY_TX = 0x1c (command) + */ struct iwl_tx_cmd { __le16 len; __le16 next_frame_len; @@ -688,8 +737,32 @@ struct iwl_tx_cmd { struct ieee80211_hdr hdr[0]; } __attribute__ ((packed)); -/* - * TX command response status +/* TX command response is sent after *all* transmission attempts. + * + * NOTES: + * + * TX_STATUS_FAIL_NEXT_FRAG + * + * If the fragment flag in the MAC header for the frame being transmitted + * is set and there is insufficient time to transmit the next frame, the + * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'. + * + * TX_STATUS_FIFO_UNDERRUN + * + * Indicates the host did not provide bytes to the FIFO fast enough while + * a TX was in progress. + * + * TX_STATUS_FAIL_MGMNT_ABORT + * + * This status is only possible if the ABORT ON MGMT RX parameter was + * set to true with the TX command. + * + * If the MSB of the status parameter is set then an abort sequence is + * required. This sequence consists of the host activating the TX Abort + * control line, and then waiting for the TX Abort command response. This + * indicates that a the device is no longer in a transmit state, and that the + * command FIFO has been cleared. The host must then deactivate the TX Abort + * control line. Receiving is still allowed in this case. */ enum { TX_STATUS_SUCCESS = 0x01, @@ -762,6 +835,9 @@ enum { #define AGG_TX_STATE_SEQ_NUM_POS 16 #define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000 +/* + * REPLY_TX = 0x1c (response) + */ #if IWL == 4965 struct iwl_tx_resp { u8 frame_count; /* 1 no aggregation, >1 aggregation */ @@ -787,49 +863,22 @@ struct iwl_tx_resp { } __attribute__ ((packed)); #endif - -/* TX command response is sent after *all* transmission attempts. - * - * NOTES: - * - * TX_STATUS_FAIL_NEXT_FRAG - * - * If the fragment flag in the MAC header for the frame being transmitted - * is set and there is insufficient time to transmit the next frame, the - * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'. - * - * TX_STATUS_FIFO_UNDERRUN - * - * Indicates the host did not provide bytes to the FIFO fast enough while - * a TX was in progress. - * - * TX_STATUS_FAIL_MGMNT_ABORT - * - * This status is only possible if the ABORT ON MGMT RX parameter was - * set to true with the TX command. - * - * If the MSB of the status parameter is set then an abort sequence is - * required. This sequence consists of the host activating the TX Abort - * control line, and then waiting for the TX Abort command response. This - * indicates that a the device is no longer in a transmit state, and that the - * command FIFO has been cleared. The host must then deactivate the TX Abort - * control line. Receiving is still allowed in this case. - */ - struct iwl_tx_power { u8 tx_gain; /* gain for analog radio */ u8 dsp_atten; /* gain for DSP */ } __attribute__ ((packed)); -/* - * Tx Power Table Command - */ +#if IWL == 3945 struct iwl_power_per_rate { u8 rate; /* plcp */ struct iwl_tx_power tpc; u8 reserved; } __attribute__ ((packed)); +/* + * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) + * 3945 Tx Power Table Command + */ struct iwl_txpowertable_cmd { u8 band; u8 reserved; @@ -837,6 +886,22 @@ struct iwl_txpowertable_cmd { struct iwl_power_per_rate power[IWL_MAX_RATES]; } __attribute__ ((packed)); +#elif IWL == 4965 +/* + * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) + * 4965 Tx Power Table Command + */ +struct iwl_tx_power_table_cmd { + u8 band; + u8 channel_normal_width; + __le16 channel; + struct iwl_tx_power_db tx_power; +} __attribute__ ((packed)); + +#endif + + +#if IWL == 3945 struct iwl_rate_scaling_info { __le16 rate_n_flags; u8 try_cnt; @@ -862,6 +927,47 @@ struct iwl_rate_scaling_cmd { struct iwl_rate_scaling_info table[IWL_MAX_RATES]; } __attribute__ ((packed)); +#elif IWL == 4965 + +/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ +#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1<<0) + +#define LINK_QUAL_AC_NUM AC_NUM +#define LINK_QUAL_MAX_RETRY_NUM 16 + +#define LINK_QUAL_ANT_A_MSK (1<<0) +#define LINK_QUAL_ANT_B_MSK (1<<1) +#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) + +struct iwl_link_qual_general_params { + u8 flags; + u8 mimo_delimiter; + u8 single_stream_ant_msk; + u8 dual_stream_ant_msk; + u8 start_rate_index[LINK_QUAL_AC_NUM]; +} __attribute__ ((packed)); + +struct iwl_link_qual_agg_params { + __le16 agg_time_limit; + u8 agg_dis_start_th; + u8 agg_frame_cnt_limit; + __le32 reserved; +} __attribute__ ((packed)); + +struct iwl_link_quality_cmd { + u8 sta_id; + u8 reserved1; + __le16 control; + struct iwl_link_qual_general_params general_params; + struct iwl_link_qual_agg_params agg_params; + struct { + __le32 rate_n_flags; + } rs_table[LINK_QUAL_MAX_RETRY_NUM]; + __le32 reserved2; +} __attribute__ ((packed)); +#endif + + struct iwl_bt_cmd { u8 flags; u8 lead_time; @@ -1104,14 +1210,13 @@ struct iwl_ct_kill_config { *****************************************************************************/ struct iwl_scan_channel { - u8 type; /* type is defined as: * 0:0 active (0 - passive) * 1:4 SSID direct * If 1 is set then corresponding SSID IE is transmitted in probe - * 5:6 reserved - * 7:7 Narrow + * 5:7 reserved */ + u8 type; u8 channel; struct iwl_tx_power tpc; __le16 active_dwell; -- 1.5.2