diff options
author | adrian <adrian@FreeBSD.org> | 2013-08-02 21:28:36 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2013-08-02 21:28:36 +0000 |
commit | 4e4d1a0f499b837538e71afb1c93681341874ea2 (patch) | |
tree | 84088f48b84c8e5bf777251e9ffc5a8fcdb0dbdf /sys/dev | |
parent | afc0f7449dc5c02a3fc658dcc0c933e7614a4861 (diff) | |
download | FreeBSD-src-4e4d1a0f499b837538e71afb1c93681341874ea2.zip FreeBSD-src-4e4d1a0f499b837538e71afb1c93681341874ea2.tar.gz |
Add in some definitions required for later iwn(4) device support.
This also clarifies a few existing fields.
Tested:
* Intel 5100
Submitted by: Cedric GROSS <cg@gross.info>
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/iwn/if_iwnreg.h | 264 |
1 files changed, 259 insertions, 5 deletions
diff --git a/sys/dev/iwn/if_iwnreg.h b/sys/dev/iwn/if_iwnreg.h index 3285e19..911407b 100644 --- a/sys/dev/iwn/if_iwnreg.h +++ b/sys/dev/iwn/if_iwnreg.h @@ -18,6 +18,9 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#define IWN_CT_KILL_THRESHOLD 114 /* in Celsius */ +#define IWN_CT_KILL_EXIT_THRESHOLD 95 /* in Celsius */ + #define IWN_TX_RING_COUNT 256 #define IWN_TX_RING_LOMARK 192 #define IWN_TX_RING_HIMARK 224 @@ -38,6 +41,10 @@ #define IWN_ICT_SIZE 4096 #define IWN_ICT_COUNT (IWN_ICT_SIZE / sizeof (uint32_t)) +/* For cards with PAN command, default is IWN_CMD_QUEUE_NUM */ +#define IWN_CMD_QUEUE_NUM 4 +#define IWN_PAN_CMD_QUEUE 9 + /* Maximum number of DMA segments for TX. */ #define IWN_MAX_SCATTER 20 @@ -89,6 +96,7 @@ #define IWN_MEM_WADDR 0x410 #define IWN_MEM_WDATA 0x418 #define IWN_MEM_RDATA 0x41c +#define IWN_TARG_MBX_C 0x430 #define IWN_PRPH_WADDR 0x444 #define IWN_PRPH_RADDR 0x448 #define IWN_PRPH_WDATA 0x44c @@ -213,17 +221,45 @@ #define IWN_GP_DRIVER_RADIO_2X2_IPA (2 << 0) #define IWN_GP_DRIVER_CALIB_VER6 (1 << 2) #define IWN_GP_DRIVER_6050_1X2 (1 << 3) +#define IWN_GP_DRIVER_REG_BIT_RADIO_IQ_INVERT (1 << 7) /* Possible flags for register IWN_UCODE_GP1_CLR. */ #define IWN_UCODE_GP1_RFKILL (1 << 1) #define IWN_UCODE_GP1_CMD_BLOCKED (1 << 2) #define IWN_UCODE_GP1_CTEMP_STOP_RF (1 << 3) +#define IWN_UCODE_GP1_CFG_COMPLETE (1 << 5) /* Possible flags/values for register IWN_LED. */ #define IWN_LED_BSM_CTRL (1 << 5) #define IWN_LED_OFF 0x00000038 #define IWN_LED_ON 0x00000078 +#define IWN_MAX_BLINK_TBL 10 +#define IWN_LED_STATIC_ON 0 +#define IWN_LED_STATIC_OFF 1 +#define IWN_LED_SLOW_BLINK 2 +#define IWN_LED_INT_BLINK 3 +#define IWN_LED_UNIT 0x1388 /* 5 ms */ + +static const struct { + uint16_t tpt; /* Mb/s */ + uint8_t on_time; + uint8_t off_time; +} blink_tbl[] = +{ + {300, 5, 5}, + {200, 8, 8}, + {100, 11, 11}, + {70, 13, 13}, + {50, 15, 15}, + {20, 17, 17}, + {10, 19, 19}, + {5, 22, 22}, + {1, 26, 26}, + {0, 33, 33}, + /* SOLID_ON */ +}; + /* Possible flags for register IWN_DRAM_INT_TBL. */ #define IWN_DRAM_INT_TBL_WRAP_CHECK (1 << 27) #define IWN_DRAM_INT_TBL_ENABLE (1 << 31) @@ -370,14 +406,26 @@ struct iwn_rx_status { } __packed; struct iwn_rx_desc { + /* + * 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 + */ uint32_t len; uint8_t type; #define IWN_UC_READY 1 #define IWN_ADD_NODE_DONE 24 #define IWN_TX_DONE 28 +#define IWN_REPLY_LED_CMD 72 #define IWN5000_CALIBRATION_RESULT 102 #define IWN5000_CALIBRATION_DONE 103 #define IWN_START_SCAN 130 +#define IWN_NOTIF_SCAN_RESULT 131 #define IWN_STOP_SCAN 132 #define IWN_RX_STATISTICS 156 #define IWN_BEACON_STATISTICS 157 @@ -388,11 +436,23 @@ struct iwn_rx_desc { #define IWN_RX_DONE 195 #define IWN_RX_COMPRESSED_BA 197 - uint8_t flags; - uint8_t idx; + uint8_t flags; /* 0:5 reserved, 6 abort, 7 internal */ + uint8_t idx; /* position within TX queue */ uint8_t qid; + /* 0:4 TX queue id - 5:6 reserved - 7 unsolicited RX + * or uCode-originated notification + */ } __packed; +#define IWN_RX_DESC_QID_MSK 0x1F +#define IWN_UNSOLICITED_RX_NOTIF 0x80 + +/* CARD_STATE_NOTIFICATION */ +#define IWN_STATE_CHANGE_HW_CARD_DISABLED 0x01 +#define IWN_STATE_CHANGE_SW_CARD_DISABLED 0x02 +#define IWN_STATE_CHANGE_CT_CARD_DISABLED 0x04 +#define IWN_STATE_CHANGE_RXON_CARD_DISABLED 0x10 + /* Possible RX status flags. */ #define IWN_RX_NO_CRC_ERR (1 << 0) #define IWN_RX_NO_OVFL_ERR (1 << 1) @@ -416,6 +476,7 @@ struct iwn_tx_cmd { #define IWN_CMD_LINK_QUALITY 78 #define IWN_CMD_SET_LED 72 #define IWN5000_CMD_WIMAX_COEX 90 +#define IWN_TEMP_NOTIFICATION 98 #define IWN5000_CMD_CALIB_CONFIG 101 #define IWN5000_CMD_CALIB_RESULT 102 #define IWN5000_CMD_CALIB_COMPLETE 103 @@ -432,6 +493,17 @@ struct iwn_tx_cmd { #define IWN_CMD_PHY_CALIB 176 #define IWN_CMD_BT_COEX_PRIOTABLE 204 #define IWN_CMD_BT_COEX_PROT 205 +#define IWN_CMD_BT_COEX_NOTIF 206 +/* PAN commands */ +#define IWN_CMD_WIPAN_PARAMS 0xb2 +#define IWN_CMD_WIPAN_RXON 0xb3 +#define IWN_CMD_WIPAN_RXON_TIMING 0xb4 +#define IWN_CMD_WIPAN_RXON_ASSOC 0xb6 +#define IWN_CMD_WIPAN_QOS_PARAM 0xb7 +#define IWN_CMD_WIPAN_WEPKEY 0xb8 +#define IWN_CMD_WIPAN_P2P_CHANNEL_SWITCH 0xb9 +#define IWN_CMD_WIPAN_NOA_NOTIFICATION 0xbc +#define IWN_CMD_WIPAN_DEACTIVATION_COMPLETE 0xbd uint8_t flags; uint8_t idx; @@ -439,6 +511,27 @@ struct iwn_tx_cmd { uint8_t data[136]; } __packed; +/* + * Structure for IWN_CMD_GET_STATISTICS = (0x9c) 156 + * all devices identical. + * + * This command triggers an immediate response containing uCode statistics. + * The response is in the same format as IWN_BEACON_STATISTICS (0x9d) 157. + * + * If the CLEAR_STATS configuration flag is set, uCode will clear its + * internal copy of the statistics (counters) after issuing the response. + * This flag does not affect IWN_BEACON_STATISTICS after beacons (see below). + * + * If the DISABLE_NOTIF configuration flag is set, uCode will not issue + * IWN_BEACON_STATISTICS after received beacons. This flag + * does not affect the response to the IWN_CMD_GET_STATISTICS 0x9c itself. + */ +struct iwn_statistics_cmd { + uint32_t configuration_flags; +#define IWN_STATS_CONF_CLEAR_STATS htole32(0x1) +#define IWN_STATS_CONF_DISABLE_NOTIF htole32(0x2) +} __packed; + /* Antenna flags, used in various commands. */ #define IWN_ANT_A (1 << 0) #define IWN_ANT_B (1 << 1) @@ -446,6 +539,7 @@ struct iwn_tx_cmd { /* Shortcuts. */ #define IWN_ANT_AB (IWN_ANT_A | IWN_ANT_B) #define IWN_ANT_BC (IWN_ANT_B | IWN_ANT_C) +#define IWN_ANT_AC (IWN_ANT_A | IWN_ANT_C) #define IWN_ANT_ABC (IWN_ANT_A | IWN_ANT_B | IWN_ANT_C) /* Structure for command IWN_CMD_RXON. */ @@ -461,6 +555,8 @@ struct iwn_rxon { #define IWN_MODE_STA 3 #define IWN_MODE_IBSS 4 #define IWN_MODE_MONITOR 6 +#define IWN_MODE_2STA 8 +#define IWN_MODE_P2P 9 uint8_t air; uint16_t rxchain; @@ -544,7 +640,8 @@ struct iwn_cmd_timing { uint16_t atim; uint32_t binitval; uint16_t lintval; - uint16_t reserved; + uint8_t dtim_period; + uint8_t delta_cp_bss_tbtts; } __packed; /* Structure for command IWN_CMD_ADD_NODE. */ @@ -558,6 +655,9 @@ struct iwn_node_info { uint16_t reserved2; uint8_t id; #define IWN_ID_BSS 0 +#define IWN_STA_ID 1 + +#define IWN_PAN_ID_BCAST 14 #define IWN5000_ID_BROADCAST 15 #define IWN4965_ID_BROADCAST 31 @@ -759,6 +859,11 @@ struct iwn_pmgt_cmd { #define IWN_PS_SLEEP_OVER_DTIM (1 << 2) #define IWN_PS_PCI_PMGT (1 << 3) #define IWN_PS_FAST_PD (1 << 4) +#define IWN_PS_BEACON_FILTERING (1 << 5) +#define IWN_PS_SHADOW_REG (1 << 6) +#define IWN_PS_CT_KILL (1 << 7) +#define IWN_PS_BT_SCD (1 << 8) +#define IWN_PS_ADVANCED_PM (1 << 9) uint8_t keepalive; uint8_t debug; @@ -796,6 +901,7 @@ struct iwn_scan_hdr { struct iwn_scan_chan { uint32_t flags; +#define IWN_CHAN_PASSIVE (0 << 0) #define IWN_CHAN_ACTIVE (1 << 0) #define IWN_CHAN_NPBREQS(x) (((1 << (x)) - 1) << 1) @@ -806,9 +912,25 @@ struct iwn_scan_chan { uint16_t passive; /* msecs */ } __packed; +#define IWN_SCAN_CRC_TH_DISABLED 0 +#define IWN_SCAN_CRC_TH_DEFAULT htole16(1) +#define IWN_SCAN_CRC_TH_NEVER htole16(0xffff) + /* Maximum size of a scan command. */ #define IWN_SCAN_MAXSZ (MCLBYTES - 4) +#define IWN_ACTIVE_DWELL_TIME_24 (30) /* all times in msec */ +#define IWN_ACTIVE_DWELL_TIME_52 (20) +#define IWN_ACTIVE_DWELL_FACTOR_24 (3) +#define IWN_ACTIVE_DWELL_FACTOR_52 (2) + +#define IWN_PASSIVE_DWELL_TIME_24 (20) /* all times in msec */ +#define IWN_PASSIVE_DWELL_TIME_52 (10) +#define IWN_PASSIVE_DWELL_BASE (100) +#define IWN_CHANNEL_TUNE_TIME (5) + +#define IWN_SCAN_CHAN_TIMEOUT 2 + /* Structure for command IWN_CMD_TXPOWER (4965AGN only.) */ #define IWN_RIDX_MAX 32 struct iwn4965_cmd_txpower { @@ -855,6 +977,16 @@ struct iwn_bluetooth { struct iwn6000_btcoex_config { uint8_t flags; +#define IWN_BT_FLAG_COEX6000_CHAN_INHIBITION 1 +#define IWN_BT_FLAG_COEX6000_MODE_MASK ((1 << 3) | (1 << 4) | (1 << 5 )) +#define IWN_BT_FLAG_COEX6000_MODE_SHIFT 3 +#define IWN_BT_FLAG_COEX6000_MODE_DISABLED 0 +#define IWN_BT_FLAG_COEX6000_MODE_LEGACY_2W 1 +#define IWN_BT_FLAG_COEX6000_MODE_3W 2 +#define IWN_BT_FLAG_COEX6000_MODE_4W 3 + +#define IWN_BT_FLAG_UCODE_DEFAULT (1 << 6) +#define IWN_BT_FLAG_SYNC_2_BT_DISABLE (1 << 7) uint8_t lead_time; uint8_t max_kill; uint8_t bt3_t7_timer; @@ -871,6 +1003,28 @@ struct iwn6000_btcoex_config { uint16_t rx_prio_boost; } __packed; +/* Structure for enhanced command IWN_CMD_BLUETOOTH for 2000 Series. */ +struct iwn2000_btcoex_config { + uint8_t flags; /* Cf Flags in iwn6000_btcoex_config */ + uint8_t lead_time; + uint8_t max_kill; + uint8_t bt3_t7_timer; + uint32_t kill_ack; + uint32_t kill_cts; + uint8_t sample_time; + uint8_t bt3_t2_timer; + uint16_t bt4_reaction; + uint32_t lookup_table[12]; + uint16_t bt4_decision; + uint16_t valid; + + uint32_t prio_boost; /* size change prior to iwn6000_btcoex_config */ + uint8_t reserved; /* added prior to iwn6000_btcoex_config */ + + uint8_t tx_prio_boost; + uint16_t rx_prio_boost; +} __packed; + struct iwn_btcoex_priotable { uint8_t calib_init1; uint8_t calib_init2; @@ -989,6 +1143,17 @@ struct iwn5000_phy_calib_temp_offset { uint16_t reserved; } __packed; +struct iwn5000_phy_calib_temp_offsetv2 { + uint8_t code; + uint8_t group; + uint8_t ngroups; + uint8_t isvalid; + int16_t offset_high; + int16_t offset_low; + int16_t burnt_voltage_ref; + int16_t reserved; +} __packed; + struct iwn_phy_calib_gain { uint8_t code; uint8_t group; @@ -1056,6 +1221,10 @@ struct iwn_ucode_info { } __packed; /* Structures for IWN_TX_DONE notification. */ +#define IWN_TX_STATUS_MSK 0xff +#define TX_STATUS_SUCCESS 0x01 +#define TX_STATUS_DIRECT_DONE 0x02 + #define IWN_TX_SUCCESS 0x00 #define IWN_TX_FAIL 0x80 /* all failures have 0x80 set */ #define IWN_TX_FAIL_SHORT_LIMIT 0x82 /* too many RTS retries */ @@ -1077,7 +1246,7 @@ struct iwn4965_tx_stat { } __packed; struct iwn5000_tx_stat { - uint8_t nframes; + uint8_t nframes; /* 1 no aggregation, >1 aggregation */ uint8_t btkillcnt; uint8_t rtsfailcnt; uint8_t ackfailcnt; @@ -1089,7 +1258,7 @@ struct iwn5000_tx_stat { uint16_t seq; uint16_t len; uint8_t tlc; - uint8_t ratid; + uint8_t ratid; /* tid (0:3), sta_id (4:7) */ uint8_t fc[2]; uint16_t status; uint16_t sequence; @@ -1137,6 +1306,42 @@ struct iwn_rx_stat { uint16_t chan; uint8_t phybuf[32]; uint32_t rate; +/* + * rate bit fields + * + * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"): + * 2-0: 0) 6 Mbps + * 1) 12 Mbps + * 2) 18 Mbps + * 3) 24 Mbps + * 4) 36 Mbps + * 5) 48 Mbps + * 6) 54 Mbps + * 7) 60 Mbps + * + * 4-3: 0) Single stream (SISO) + * 1) Dual stream (MIMO) + * 2) Triple stream (MIMO) + * + * 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 + * 0xF) 9 Mbps + * 0x5) 12 Mbps + * 0x7) 18 Mbps + * 0x9) 24 Mbps + * 0xB) 36 Mbps + * 0x1) 48 Mbps + * 0x3) 54 Mbps + * + * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): + * 6-0: 10) 1 Mbps + * 20) 2 Mbps + * 55) 5.5 Mbps + * 110) 11 Mbps + * + */ uint16_t len; uint16_t reserve3; } __packed; @@ -1359,8 +1564,18 @@ struct iwn_fw_tlv { #define IWN_FW_TLV_INIT_DATA 4 #define IWN_FW_TLV_BOOT_TEXT 5 #define IWN_FW_TLV_PBREQ_MAXLEN 6 +#define IWN_FW_TLV_PAN 7 +#define IWN_FW_TLV_RUNT_EVTLOG_PTR 8 +#define IWN_FW_TLV_RUNT_EVTLOG_SIZE 9 +#define IWN_FW_TLV_RUNT_ERRLOG_PTR 10 +#define IWN_FW_TLV_INIT_EVTLOG_PTR 11 +#define IWN_FW_TLV_INIT_EVTLOG_SIZE 12 +#define IWN_FW_TLV_INIT_ERRLOG_PTR 13 #define IWN_FW_TLV_ENH_SENS 14 #define IWN_FW_TLV_PHY_CALIB 15 +#define IWN_FW_TLV_WOWLAN_INST 16 +#define IWN_FW_TLV_WOWLAN_DATA 17 +#define IWN_FW_TLV_FLAGS 18 uint16_t alt; uint32_t len; @@ -1394,6 +1609,7 @@ struct iwn_fw_tlv { #define IWN4965_EEPROM_VOLTAGE 0x0e9 #define IWN4965_EEPROM_BANDS 0x0ea /* Indirect offsets. */ +#define IWN5000_EEPROM_NO_HT40 0x000 #define IWN5000_EEPROM_DOMAIN 0x001 #define IWN5000_EEPROM_BAND1 0x004 #define IWN5000_EEPROM_BAND2 0x013 @@ -1505,6 +1721,16 @@ static const uint32_t iwn6000_regulatory_bands[IWN_NBANDS] = { IWN5000_EEPROM_BAND7 }; +static const uint32_t iwn1000_regulatory_bands[IWN_NBANDS] = { + IWN5000_EEPROM_BAND1, + IWN5000_EEPROM_BAND2, + IWN5000_EEPROM_BAND3, + IWN5000_EEPROM_BAND4, + IWN5000_EEPROM_BAND5, + IWN5000_EEPROM_BAND6, + IWN5000_EEPROM_NO_HT40, +}; + #define IWN_CHAN_BANDS_COUNT 7 #define IWN_MAX_CHAN_PER_BAND 14 static const struct iwn_chan_band { @@ -1524,6 +1750,13 @@ static const struct iwn_chan_band { { 11, { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157 } } }; +static const uint8_t iwn_bss_ac_to_queue[] = { + 2, 3, 1, 0, +}; + +static const uint8_t iwn_pan_ac_to_queue[] = { + 5, 4, 6, 7, +}; #define IWN1000_OTP_NBLOCKS 3 #define IWN6000_OTP_NBLOCKS 4 #define IWN6050_OTP_NBLOCKS 7 @@ -1533,6 +1766,14 @@ static const struct iwn_chan_band { #define IWN_RIDX_OFDM6 4 #define IWN4965_MAX_PWR_INDEX 107 +#define IWN_POWERSAVE_LVL_NONE 0 +#define IWN_POWERSAVE_LVL_VOIP_COMPATIBLE 1 +#define IWN_POWERSAVE_LVL_MAX 5 + +#define IWN_POWERSAVE_LVL_DEFAULT IWN_POWERSAVE_LVL_NONE + +/* DTIM value to pass in for IWN_POWERSAVE_LVL_VOIP_COMPATIBLE */ +#define IWN_POWERSAVE_DTIM_VOIP_COMPATIBLE 2 /* * RF Tx gain values from highest to lowest power (values obtained from @@ -1715,6 +1956,19 @@ static const struct iwn_sensitivity_limits iwn6000_sensitivity_limits = { 100 }; +/* Get value from linux kernel 3.2.+ in Drivers/net/wireless/iwlwifi/iwl-2000.c*/ +static const struct iwn_sensitivity_limits iwn2030_sensitivity_limits = { + 105,110, + 128,232, + 80,145, + 128,232, + 125,175, + 160,310, + 97, + 97, + 110 +}; + /* Map TID to TX scheduler's FIFO. */ static const uint8_t iwn_tid2fifo[] = { 1, 0, 0, 1, 2, 2, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 3 |