Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[safe/jmp/linux-2.6] / drivers / net / wireless / iwlwifi / iwl-commands.h
index 3ced5e5..e915075 100644 (file)
@@ -109,11 +109,12 @@ enum {
        REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */
 
        /* WiMAX coexistence */
-       COEX_PRIORITY_TABLE_CMD = 0x5a, /*5000 only */
+       COEX_PRIORITY_TABLE_CMD = 0x5a, /* for 5000 series and up */
        COEX_MEDIUM_NOTIFICATION = 0x5b,
        COEX_EVENT_CMD = 0x5c,
 
        /* Calibration */
+       TEMPERATURE_NOTIFICATION = 0x62,
        CALIBRATION_CFG_CMD = 0x65,
        CALIBRATION_RES_NOTIFICATION = 0x66,
        CALIBRATION_COMPLETE_NOTIFICATION = 0x67,
@@ -144,9 +145,11 @@ enum {
        WHO_IS_AWAKE_NOTIFICATION = 0x94,       /* not used */
 
        /* Miscellaneous commands */
+       REPLY_TX_POWER_DBM_CMD = 0x95,
        QUIET_NOTIFICATION = 0x96,              /* not used */
        REPLY_TX_PWR_TABLE_CMD = 0x97,
-       REPLY_TX_POWER_DBM_CMD = 0x98,
+       REPLY_TX_POWER_DBM_CMD_V1 = 0x98,       /* old version of API */
+       TX_ANT_CONFIGURATION_CMD = 0x98,
        MEASURE_ABORT_NOTIFICATION = 0x99,      /* not used */
 
        /* Bluetooth device coexistence config command */
@@ -281,7 +284,7 @@ struct iwl3945_power_per_rate {
  *        1)  Dual stream (MIMO)
  *        2)  Triple stream (MIMO)
  *
- *    5:  Value of 0x20 in bits 7:0 indicates 6 Mbps FAT duplicate data
+ *    5:  Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data
  *
  * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"):
  *  3-0:  0xD)   6 Mbps
@@ -318,11 +321,11 @@ struct iwl3945_power_per_rate {
 #define RATE_MCS_GF_POS 10
 #define RATE_MCS_GF_MSK 0x400
 
-/* Bit 11: (1) Use 40Mhz FAT chnl width, (0) use 20 MHz legacy chnl width */
-#define RATE_MCS_FAT_POS 11
-#define RATE_MCS_FAT_MSK 0x800
+/* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */
+#define RATE_MCS_HT40_POS 11
+#define RATE_MCS_HT40_MSK 0x800
 
-/* Bit 12: (1) Duplicate data on both 20MHz chnls.  FAT (bit 11) must be set. */
+/* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */
 #define RATE_MCS_DUP_POS 12
 #define RATE_MCS_DUP_MSK 0x1000
 
@@ -351,6 +354,9 @@ struct iwl3945_power_per_rate {
 #define POWER_TABLE_NUM_HT_OFDM_ENTRIES                32
 #define POWER_TABLE_CCK_ENTRY                  32
 
+#define IWL_PWR_NUM_HT_OFDM_ENTRIES            24
+#define IWL_PWR_CCK_ENTRIES                    2
+
 /**
  * union iwl4965_tx_power_dual_stream
  *
@@ -409,6 +415,16 @@ struct iwl5000_tx_power_dbm_cmd {
        u8 reserved;
 } __attribute__ ((packed));
 
+/**
+ * Command TX_ANT_CONFIGURATION_CMD = 0x98
+ * This command is used to configure valid Tx antenna.
+ * By default uCode concludes the valid antenna according to the radio flavor.
+ * This command enables the driver to override/modify this conclusion.
+ */
+struct iwl_tx_ant_config_cmd {
+       __le32 valid;
+} __attribute__ ((packed));
+
 /******************************************************************************
  * (0a)
  * Alive and Error Commands & Responses:
@@ -457,7 +473,7 @@ struct iwl_init_alive_resp {
 
        /* calibration values from "initialize" uCode */
        __le32 voltage;         /* signed, higher value is lower voltage */
-       __le32 therm_r1[2];     /* signed, 1st for normal, 2nd for FAT channel*/
+       __le32 therm_r1[2];     /* signed, 1st for normal, 2nd for HT40 */
        __le32 therm_r2[2];     /* signed */
        __le32 therm_r3[2];     /* signed */
        __le32 therm_r4[2];     /* signed */
@@ -563,6 +579,7 @@ enum {
 
 
 #define RXON_RX_CHAIN_DRIVER_FORCE_MSK         cpu_to_le16(0x1 << 0)
+#define RXON_RX_CHAIN_DRIVER_FORCE_POS         (0)
 #define RXON_RX_CHAIN_VALID_MSK                        cpu_to_le16(0x7 << 1)
 #define RXON_RX_CHAIN_VALID_POS                        (1)
 #define RXON_RX_CHAIN_FORCE_SEL_MSK            cpu_to_le16(0x7 << 4)
@@ -607,12 +624,22 @@ enum {
 #define RXON_FLG_HT_OPERATING_MODE_POS         (23)
 
 #define RXON_FLG_HT_PROT_MSK                   cpu_to_le32(0x1 << 23)
-#define RXON_FLG_FAT_PROT_MSK                  cpu_to_le32(0x2 << 23)
+#define RXON_FLG_HT40_PROT_MSK                 cpu_to_le32(0x2 << 23)
 
 #define RXON_FLG_CHANNEL_MODE_POS              (25)
 #define RXON_FLG_CHANNEL_MODE_MSK              cpu_to_le32(0x3 << 25)
-#define RXON_FLG_CHANNEL_MODE_PURE_40_MSK      cpu_to_le32(0x1 << 25)
-#define RXON_FLG_CHANNEL_MODE_MIXED_MSK                cpu_to_le32(0x2 << 25)
+
+/* channel mode */
+enum {
+       CHANNEL_MODE_LEGACY = 0,
+       CHANNEL_MODE_PURE_40 = 1,
+       CHANNEL_MODE_MIXED = 2,
+       CHANNEL_MODE_RESERVED = 3,
+};
+#define RXON_FLG_CHANNEL_MODE_LEGACY   cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS)
+#define RXON_FLG_CHANNEL_MODE_PURE_40  cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS)
+#define RXON_FLG_CHANNEL_MODE_MIXED    cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS)
+
 /* CTS to self (if spec allows) flag */
 #define RXON_FLG_SELF_CTS_EN                   cpu_to_le32(0x1<<30)
 
@@ -752,6 +779,8 @@ struct iwl5000_rxon_assoc_cmd {
 } __attribute__ ((packed));
 
 #define IWL_CONN_MAX_LISTEN_INTERVAL   10
+#define IWL_MAX_UCODE_BEACON_INTERVAL  4 /* 4096 */
+#define IWL39_MAX_UCODE_BEACON_INTERVAL        1 /* 1024 */
 
 /*
  * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
@@ -778,7 +807,7 @@ struct iwl3945_channel_switch_cmd {
        struct iwl3945_power_per_rate power[IWL_MAX_RATES];
 } __attribute__ ((packed));
 
-struct iwl_channel_switch_cmd {
+struct iwl4965_channel_switch_cmd {
        u8 band;
        u8 expect_beacon;
        __le16 channel;
@@ -788,6 +817,48 @@ struct iwl_channel_switch_cmd {
        struct iwl4965_tx_power_db tx_power;
 } __attribute__ ((packed));
 
+/**
+ * struct iwl5000_channel_switch_cmd
+ * @band: 0- 5.2GHz, 1- 2.4GHz
+ * @expect_beacon: 0- resume transmits after channel switch
+ *                1- wait for beacon to resume transmits
+ * @channel: new channel number
+ * @rxon_flags: Rx on flags
+ * @rxon_filter_flags: filtering parameters
+ * @switch_time: switch time in extended beacon format
+ * @reserved: reserved bytes
+ */
+struct iwl5000_channel_switch_cmd {
+       u8 band;
+       u8 expect_beacon;
+       __le16 channel;
+       __le32 rxon_flags;
+       __le32 rxon_filter_flags;
+       __le32 switch_time;
+       __le32 reserved[2][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES];
+} __attribute__ ((packed));
+
+/**
+ * struct iwl6000_channel_switch_cmd
+ * @band: 0- 5.2GHz, 1- 2.4GHz
+ * @expect_beacon: 0- resume transmits after channel switch
+ *                1- wait for beacon to resume transmits
+ * @channel: new channel number
+ * @rxon_flags: Rx on flags
+ * @rxon_filter_flags: filtering parameters
+ * @switch_time: switch time in extended beacon format
+ * @reserved: reserved bytes
+ */
+struct iwl6000_channel_switch_cmd {
+       u8 band;
+       u8 expect_beacon;
+       __le16 channel;
+       __le32 rxon_flags;
+       __le32 rxon_filter_flags;
+       __le32 switch_time;
+       __le32 reserved[3][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES];
+} __attribute__ ((packed));
+
 /*
  * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
  */
@@ -871,12 +942,11 @@ struct iwl_qosparam_cmd {
 
 #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);
 #define STA_FLG_RTS_MIMO_PROT_MSK      cpu_to_le32(1 << 17)
 #define STA_FLG_AGG_MPDU_8US_MSK       cpu_to_le32(1 << 18)
 #define STA_FLG_MAX_AGG_SIZE_POS       (19)
 #define STA_FLG_MAX_AGG_SIZE_MSK       cpu_to_le32(3 << 19)
-#define STA_FLG_FAT_EN_MSK             cpu_to_le32(1 << 21)
+#define STA_FLG_HT40_EN_MSK            cpu_to_le32(1 << 21)
 #define STA_FLG_MIMO_DIS_MSK           cpu_to_le32(1 << 22)
 #define STA_FLG_AGG_MPDU_DENSITY_POS   (23)
 #define STA_FLG_AGG_MPDU_DENSITY_MSK   cpu_to_le32(7 << 23)
@@ -907,6 +977,7 @@ struct iwl_qosparam_cmd {
 #define        STA_MODIFY_TX_RATE_MSK          0x04
 #define STA_MODIFY_ADDBA_TID_MSK       0x08
 #define STA_MODIFY_DELBA_TID_MSK       0x10
+#define STA_MODIFY_SLEEP_TX_COUNT_MSK  0x20
 
 /* Receiver address (actually, Rx station's index into station table),
  * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */
@@ -1037,7 +1108,14 @@ struct iwl4965_addsta_cmd {
         * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
        __le16 add_immediate_ba_ssn;
 
-       __le32 reserved2;
+       /*
+        * Number of packets OK to transmit to station even though
+        * it is asleep -- used to synchronise PS-poll and u-APSD
+        * responses while ucode keeps track of STA sleep state.
+        */
+       __le16 sleep_tx_count;
+
+       __le16 reserved2;
 } __attribute__ ((packed));
 
 /* 5000 */
@@ -1054,7 +1132,7 @@ struct iwl_addsta_cmd {
         * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
        __le16 tid_disable_tx;
 
-       __le16  reserved1;
+       __le16  rate_n_flags;           /* 3945 only */
 
        /* TID for which to add block-ack support.
         * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
@@ -1068,7 +1146,14 @@ struct iwl_addsta_cmd {
         * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
        __le16 add_immediate_ba_ssn;
 
-       __le32 reserved2;
+       /*
+        * Number of packets OK to transmit to station even though
+        * it is asleep -- used to synchronise PS-poll and u-APSD
+        * responses while ucode keeps track of STA sleep state.
+        */
+       __le16 sleep_tx_count;
+
+       __le16 reserved2;
 } __attribute__ ((packed));
 
 
@@ -1140,7 +1225,8 @@ struct iwl_wep_cmd {
 #define RX_RES_PHY_FLAGS_MOD_CCK_MSK           cpu_to_le16(1 << 1)
 #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK    cpu_to_le16(1 << 2)
 #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK       cpu_to_le16(1 << 3)
-#define RX_RES_PHY_FLAGS_ANTENNA_MSK           cpu_to_le16(0xf0)
+#define RX_RES_PHY_FLAGS_ANTENNA_MSK           0xf0
+#define RX_RES_PHY_FLAGS_ANTENNA_POS           4
 
 #define RX_RES_STATUS_SEC_TYPE_MSK     (0x7 << 8)
 #define RX_RES_STATUS_SEC_TYPE_NONE    (0x0 << 8)
@@ -1619,6 +1705,21 @@ enum {
        TX_ABORT_REQUIRED_MSK = 0x80000000,     /* bits 31:31 */
 };
 
+static inline u32 iwl_tx_status_to_mac80211(u32 status)
+{
+       status &= TX_STATUS_MSK;
+
+       switch (status) {
+       case TX_STATUS_SUCCESS:
+       case TX_STATUS_DIRECT_DONE:
+               return IEEE80211_TX_STAT_ACK;
+       case TX_STATUS_FAIL_DEST_PS:
+               return IEEE80211_TX_STAT_TX_FILTERED;
+       default:
+               return 0;
+       }
+}
+
 static inline bool iwl_is_tx_success(u32 status)
 {
        status &= TX_STATUS_MSK;
@@ -1900,6 +2001,18 @@ struct iwl_link_qual_general_params {
        u8 start_rate_index[LINK_QUAL_AC_NUM];
 } __attribute__ ((packed));
 
+#define LINK_QUAL_AGG_TIME_LIMIT_DEF   (4000) /* 4 milliseconds */
+#define LINK_QUAL_AGG_TIME_LIMIT_MAX   (65535)
+#define LINK_QUAL_AGG_TIME_LIMIT_MIN   (0)
+
+#define LINK_QUAL_AGG_DISABLE_START_DEF        (3)
+#define LINK_QUAL_AGG_DISABLE_START_MAX        (255)
+#define LINK_QUAL_AGG_DISABLE_START_MIN        (0)
+
+#define LINK_QUAL_AGG_FRAME_LIMIT_DEF  (31)
+#define LINK_QUAL_AGG_FRAME_LIMIT_MAX  (63)
+#define LINK_QUAL_AGG_FRAME_LIMIT_MIN  (0)
+
 /**
  * struct iwl_link_qual_agg_params
  *
@@ -1957,10 +2070,10 @@ struct iwl_link_qual_agg_params {
  *     a) Use this same initial rate for first 3 entries.
  *     b) Find next lower available rate using same mode (SISO or MIMO),
  *        use for next 3 entries.  If no lower rate available, switch to
- *        legacy mode (no FAT channel, no MIMO, no short guard interval).
+ *        legacy mode (no HT40 channel, no MIMO, no short guard interval).
  *     c) If using MIMO, set command's mimo_delimiter to number of entries
  *        using MIMO (3 or 6).
- *     d) After trying 2 HT rates, switch to legacy mode (no FAT channel,
+ *     d) After trying 2 HT rates, switch to legacy mode (no HT40 channel,
  *        no MIMO, no short guard interval), at the next lower bit rate
  *        (e.g. if second HT bit rate was 54, try 48 legacy), and follow
  *        legacy procedure for remaining table entries.
@@ -2135,6 +2248,19 @@ struct iwl_link_quality_cmd {
        __le32 reserved2;
 } __attribute__ ((packed));
 
+#define BT_COEX_DISABLE (0x0)
+#define BT_COEX_MODE_2W (0x1)
+#define BT_COEX_MODE_3W (0x2)
+#define BT_COEX_MODE_4W (0x3)
+
+#define BT_LEAD_TIME_MIN (0x0)
+#define BT_LEAD_TIME_DEF (0x1E)
+#define BT_LEAD_TIME_MAX (0xFF)
+
+#define BT_MAX_KILL_MIN (0x1)
+#define BT_MAX_KILL_DEF (0x5)
+#define BT_MAX_KILL_MAX (0xFF)
+
 /*
  * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
  *
@@ -2286,15 +2412,22 @@ struct iwl_spectrum_notification {
  * PM allow:
  *   bit 0 - '0' Driver not allow power management
  *           '1' Driver allow PM (use rest of parameters)
+ *
  * uCode send sleep notifications:
  *   bit 1 - '0' Don't send sleep notification
  *           '1' send sleep notification (SEND_PM_NOTIFICATION)
+ *
  * Sleep over DTIM
  *   bit 2 - '0' PM have to walk up every DTIM
  *           '1' PM could sleep over DTIM till listen Interval.
+ *
  * PCI power managed
  *   bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1)
  *           '1' !(PCI_CFG_LINK_CTRL & 0x1)
+ *
+ * Fast PD
+ *   bit 4 - '1' Put radio to sleep when receiving frame for others
+ *
  * Force sleep Modes
  *   bit 31/30- '00' use both mac/xtal sleeps
  *              '01' force Mac sleep
@@ -2386,6 +2519,13 @@ struct iwl_ct_kill_config {
        __le32   critical_temperature_R;
 }  __attribute__ ((packed));
 
+/* 1000, and 6x00 */
+struct iwl_ct_kill_throttling_config {
+       __le32   critical_temperature_exit;
+       __le32   reserved;
+       __le32   critical_temperature_enter;
+}  __attribute__ ((packed));
+
 /******************************************************************************
  * (8)
  * Scan Commands, Responses, Notifications:
@@ -2431,6 +2571,9 @@ struct iwl3945_scan_channel {
        __le16 passive_dwell;   /* in 1024-uSec TU (time units), typ 20-500 */
 } __attribute__ ((packed));
 
+/* set number of direct probes u8 type */
+#define IWL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1))))
+
 struct iwl_scan_channel {
        /*
         * type is defined as:
@@ -2447,12 +2590,16 @@ struct iwl_scan_channel {
        __le16 passive_dwell;   /* in 1024-uSec TU (time units), typ 20-500 */
 } __attribute__ ((packed));
 
+/* set number of direct probes __le32 type */
+#define IWL_SCAN_PROBE_MASK(n)         cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
+
 /**
  * struct iwl_ssid_ie - directed scan network information element
  *
- * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field
- * in struct iwl_scan_channel; each channel may select different ssids from
- * among the 4 entries.  SSID IEs get transmitted in reverse order of entry.
+ * Up to 20 of these may appear in REPLY_SCAN_CMD (Note: Only 4 are in
+ * 3945 SCAN api), selected by "type" bit field in struct iwl_scan_channel;
+ * each channel may select different ssids from among the 20 (4) entries.
+ * SSID IEs get transmitted in reverse order of entry.
  */
 struct iwl_ssid_ie {
        u8 id;
@@ -2460,11 +2607,12 @@ struct iwl_ssid_ie {
        u8 ssid[32];
 } __attribute__ ((packed));
 
-#define PROBE_OPTION_MAX_API1          0x4
-#define PROBE_OPTION_MAX               0x14
+#define PROBE_OPTION_MAX_3945          4
+#define PROBE_OPTION_MAX               20
 #define TX_CMD_LIFE_TIME_INFINITE      cpu_to_le32(0xFFFFFFFF)
 #define IWL_GOOD_CRC_TH                        cpu_to_le16(1)
 #define IWL_MAX_SCAN_SIZE 1024
+#define IWL_MAX_PROBE_REQUEST          200
 
 /*
  * REPLY_SCAN_CMD = 0x80 (command)
@@ -2543,7 +2691,7 @@ struct iwl3945_scan_cmd {
        struct iwl3945_tx_cmd tx_cmd;
 
        /* For directed active scans (set to all-0s otherwise) */
-       struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX_API1];
+       struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX_3945];
 
        /*
         * Probe request frame, followed by channel list.
@@ -2839,7 +2987,7 @@ struct statistics_rx_ht_phy {
        __le32 reserved2;
 } __attribute__ ((packed));
 
-#define INTERFERENCE_DATA_AVAILABLE      __constant_cpu_to_le32(1)
+#define INTERFERENCE_DATA_AVAILABLE      cpu_to_le32(1)
 
 struct statistics_rx_non_phy {
        __le32 bogus_cts;       /* CTS received when not expecting CTS */
@@ -2881,6 +3029,20 @@ struct statistics_rx {
        struct statistics_rx_ht_phy ofdm_ht;
 } __attribute__ ((packed));
 
+/**
+ * struct statistics_tx_power - current tx power
+ *
+ * @ant_a: current tx power on chain a in 1/2 dB step
+ * @ant_b: current tx power on chain b in 1/2 dB step
+ * @ant_c: current tx power on chain c in 1/2 dB step
+ */
+struct statistics_tx_power {
+       u8 ant_a;
+       u8 ant_b;
+       u8 ant_c;
+       u8 reserved;
+} __attribute__ ((packed));
+
 struct statistics_tx_non_phy_agg {
        __le32 ba_timeout;
        __le32 ba_reschedule_frames;
@@ -2892,8 +3054,6 @@ struct statistics_tx_non_phy_agg {
        __le32 underrun;
        __le32 bt_prio_kill;
        __le32 rx_ba_rsp_cnt;
-       __le32 reserved2;
-       __le32 reserved3;
 } __attribute__ ((packed));
 
 struct statistics_tx {
@@ -2912,6 +3072,8 @@ struct statistics_tx {
        __le32 cts_timeout_collision;
        __le32 ack_or_ba_timeout_collision;
        struct statistics_tx_non_phy_agg agg;
+       struct statistics_tx_power tx_power;
+       __le32 reserved1;
 } __attribute__ ((packed));
 
 
@@ -2939,6 +3101,10 @@ struct statistics_general {
        __le32 reserved3;
 } __attribute__ ((packed));
 
+#define UCODE_STATISTICS_CLEAR_MSK             (0x1 << 0)
+#define UCODE_STATISTICS_FREQUENCY_MSK         (0x1 << 1)
+#define UCODE_STATISTICS_NARROW_BAND_MSK       (0x1 << 2)
+
 /*
  * REPLY_STATISTICS_CMD = 0x9c,
  * 3945 and 4965 identical.
@@ -2976,7 +3142,7 @@ struct iwl_statistics_cmd {
  * one channel that has just been scanned.
  */
 #define STATISTICS_REPLY_FLG_BAND_24G_MSK         cpu_to_le32(0x2)
-#define STATISTICS_REPLY_FLG_FAT_MODE_MSK         cpu_to_le32(0x8)
+#define STATISTICS_REPLY_FLG_HT40_MODE_MSK        cpu_to_le32(0x8)
 
 struct iwl3945_notif_statistics {
        __le32 flag;
@@ -3175,12 +3341,6 @@ struct iwl_missed_beacon_notif {
  *   Lower values mean higher energy; this means making sure that the value
  *   in HD_MIN_ENERGY_CCK_DET_INDEX is at or *above* "Max cck energy".
  *
- * Driver should set the following entries to fixed values:
- *
- *   HD_MIN_ENERGY_OFDM_DET_INDEX               100
- *   HD_BARKER_CORR_TH_ADD_MIN_INDEX            190
- *   HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX        390
- *   HD_OFDM_ENERGY_TH_IN_INDEX                  62
  */
 
 /*
@@ -3378,30 +3538,134 @@ struct iwl_led_cmd {
 } __attribute__ ((packed));
 
 /*
- * Coexistence WIFI/WIMAX  Command
- * COEX_PRIORITY_TABLE_CMD = 0x5a
- *
+ * station priority table entries
+ * also used as potential "events" value for both
+ * COEX_MEDIUM_NOTIFICATION and COEX_EVENT_CMD
  */
+
+/*
+ * COEX events entry flag masks
+ * RP - Requested Priority
+ * WP - Win Medium Priority: priority assigned when the contention has been won
+ */
+#define COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG        (0x1)
+#define COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG        (0x2)
+#define COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG  (0x4)
+
+#define COEX_CU_UNASSOC_IDLE_RP               4
+#define COEX_CU_UNASSOC_MANUAL_SCAN_RP        4
+#define COEX_CU_UNASSOC_AUTO_SCAN_RP          4
+#define COEX_CU_CALIBRATION_RP                4
+#define COEX_CU_PERIODIC_CALIBRATION_RP       4
+#define COEX_CU_CONNECTION_ESTAB_RP           4
+#define COEX_CU_ASSOCIATED_IDLE_RP            4
+#define COEX_CU_ASSOC_MANUAL_SCAN_RP          4
+#define COEX_CU_ASSOC_AUTO_SCAN_RP            4
+#define COEX_CU_ASSOC_ACTIVE_LEVEL_RP         4
+#define COEX_CU_RF_ON_RP                      6
+#define COEX_CU_RF_OFF_RP                     4
+#define COEX_CU_STAND_ALONE_DEBUG_RP          6
+#define COEX_CU_IPAN_ASSOC_LEVEL_RP           4
+#define COEX_CU_RSRVD1_RP                     4
+#define COEX_CU_RSRVD2_RP                     4
+
+#define COEX_CU_UNASSOC_IDLE_WP               3
+#define COEX_CU_UNASSOC_MANUAL_SCAN_WP        3
+#define COEX_CU_UNASSOC_AUTO_SCAN_WP          3
+#define COEX_CU_CALIBRATION_WP                3
+#define COEX_CU_PERIODIC_CALIBRATION_WP       3
+#define COEX_CU_CONNECTION_ESTAB_WP           3
+#define COEX_CU_ASSOCIATED_IDLE_WP            3
+#define COEX_CU_ASSOC_MANUAL_SCAN_WP          3
+#define COEX_CU_ASSOC_AUTO_SCAN_WP            3
+#define COEX_CU_ASSOC_ACTIVE_LEVEL_WP         3
+#define COEX_CU_RF_ON_WP                      3
+#define COEX_CU_RF_OFF_WP                     3
+#define COEX_CU_STAND_ALONE_DEBUG_WP          6
+#define COEX_CU_IPAN_ASSOC_LEVEL_WP           3
+#define COEX_CU_RSRVD1_WP                     3
+#define COEX_CU_RSRVD2_WP                     3
+
+#define COEX_UNASSOC_IDLE_FLAGS                     0
+#define COEX_UNASSOC_MANUAL_SCAN_FLAGS         \
+       (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |   \
+       COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
+#define COEX_UNASSOC_AUTO_SCAN_FLAGS           \
+       (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |   \
+       COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
+#define COEX_CALIBRATION_FLAGS                 \
+       (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |   \
+       COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
+#define COEX_PERIODIC_CALIBRATION_FLAGS             0
+/*
+ * COEX_CONNECTION_ESTAB:
+ * we need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network.
+ */
+#define COEX_CONNECTION_ESTAB_FLAGS            \
+       (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |   \
+       COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG |    \
+       COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG)
+#define COEX_ASSOCIATED_IDLE_FLAGS                  0
+#define COEX_ASSOC_MANUAL_SCAN_FLAGS           \
+       (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |   \
+       COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
+#define COEX_ASSOC_AUTO_SCAN_FLAGS             \
+       (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |   \
+        COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
+#define COEX_ASSOC_ACTIVE_LEVEL_FLAGS               0
+#define COEX_RF_ON_FLAGS                            0
+#define COEX_RF_OFF_FLAGS                           0
+#define COEX_STAND_ALONE_DEBUG_FLAGS           \
+       (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |   \
+        COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
+#define COEX_IPAN_ASSOC_LEVEL_FLAGS            \
+       (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |   \
+        COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG |   \
+        COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG)
+#define COEX_RSRVD1_FLAGS                           0
+#define COEX_RSRVD2_FLAGS                           0
+/*
+ * COEX_CU_RF_ON is the event wrapping all radio ownership.
+ * We need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network.
+ */
+#define COEX_CU_RF_ON_FLAGS                    \
+       (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |   \
+        COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG |   \
+        COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG)
+
+
 enum {
+       /* un-association part */
        COEX_UNASSOC_IDLE               = 0,
        COEX_UNASSOC_MANUAL_SCAN        = 1,
        COEX_UNASSOC_AUTO_SCAN          = 2,
+       /* calibration */
        COEX_CALIBRATION                = 3,
        COEX_PERIODIC_CALIBRATION       = 4,
+       /* connection */
        COEX_CONNECTION_ESTAB           = 5,
+       /* association part */
        COEX_ASSOCIATED_IDLE            = 6,
        COEX_ASSOC_MANUAL_SCAN          = 7,
        COEX_ASSOC_AUTO_SCAN            = 8,
        COEX_ASSOC_ACTIVE_LEVEL         = 9,
+       /* RF ON/OFF */
        COEX_RF_ON                      = 10,
        COEX_RF_OFF                     = 11,
        COEX_STAND_ALONE_DEBUG          = 12,
+       /* IPAN */
        COEX_IPAN_ASSOC_LEVEL           = 13,
+       /* reserved */
        COEX_RSRVD1                     = 14,
        COEX_RSRVD2                     = 15,
        COEX_NUM_OF_EVENTS              = 16
 };
 
+/*
+ * Coexistence WIFI/WIMAX  Command
+ * COEX_PRIORITY_TABLE_CMD = 0x5a
+ *
+ */
 struct iwl_wimax_coex_event_entry {
        u8 request_prio;
        u8 win_medium_prio;
@@ -3426,6 +3690,55 @@ struct iwl_wimax_coex_cmd {
        struct iwl_wimax_coex_event_entry sta_prio[COEX_NUM_OF_EVENTS];
 } __attribute__ ((packed));
 
+/*
+ * Coexistence MEDIUM NOTIFICATION
+ * COEX_MEDIUM_NOTIFICATION = 0x5b
+ *
+ * notification from uCode to host to indicate medium changes
+ *
+ */
+/*
+ * status field
+ * bit 0 - 2: medium status
+ * bit 3: medium change indication
+ * bit 4 - 31: reserved
+ */
+/* status option values, (0 - 2 bits) */
+#define COEX_MEDIUM_BUSY       (0x0) /* radio belongs to WiMAX */
+#define COEX_MEDIUM_ACTIVE     (0x1) /* radio belongs to WiFi */
+#define COEX_MEDIUM_PRE_RELEASE        (0x2) /* received radio release */
+#define COEX_MEDIUM_MSK                (0x7)
+
+/* send notification status (1 bit) */
+#define COEX_MEDIUM_CHANGED    (0x8)
+#define COEX_MEDIUM_CHANGED_MSK        (0x8)
+#define COEX_MEDIUM_SHIFT      (3)
+
+struct iwl_coex_medium_notification {
+       __le32 status;
+       __le32 events;
+} __attribute__ ((packed));
+
+/*
+ * Coexistence EVENT  Command
+ * COEX_EVENT_CMD = 0x5c
+ *
+ * send from host to uCode for coex event request.
+ */
+/* flags options */
+#define COEX_EVENT_REQUEST_MSK (0x1)
+
+struct iwl_coex_event_cmd {
+       u8 flags;
+       u8 event;
+       __le16 reserved;
+} __attribute__ ((packed));
+
+struct iwl_coex_event_resp {
+       __le32 status;
+} __attribute__ ((packed));
+
+
 /******************************************************************************
  * (13)
  * Union of all expected notifications/responses:
@@ -3433,7 +3746,17 @@ struct iwl_wimax_coex_cmd {
  *****************************************************************************/
 
 struct iwl_rx_packet {
-       __le32 len;
+       /*
+        * The first 4 bytes of the RX frame header contain both the RX frame
+        * size and some flags.
+        * Bit fields:
+        * 31:    flag flush RB request
+        * 30:    flag ignore TC (terminal counter) request
+        * 29:    flag fast IRQ request
+        * 28-14: Reserved
+        * 13-00: RX frame size
+        */
+       __le32 len_n_flags;
        struct iwl_cmd_header hdr;
        union {
                struct iwl3945_rx_frame rx_frame;
@@ -3452,6 +3775,8 @@ struct iwl_rx_packet {
                struct iwl_notif_statistics stats;
                struct iwl_compressed_ba_resp compressed_ba;
                struct iwl_missed_beacon_notif missed_beacon;
+               struct iwl_coex_medium_notification coex_medium_notif;
+               struct iwl_coex_event_resp coex_event;
                __le32 status;
                u8 raw[0];
        } u;