Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Add support for the 5100 and newer firmware. Tes...
details: https://anonhg.NetBSD.org/src/rev/b2cae731232b
branches: trunk
changeset: 747320:b2cae731232b
user: christos <christos%NetBSD.org@localhost>
date: Fri Sep 11 01:28:20 2009 +0000
description:
Add support for the 5100 and newer firmware. Tested also with the 4900.
Thanks to everyone for helping and testing.
diffstat:
sys/dev/pci/if_iwn.c | 6182 ++++++++++++++++++++++++++++++----------------
sys/dev/pci/if_iwnreg.h | 1448 +++++++---
sys/dev/pci/if_iwnvar.h | 160 +-
sys/dev/pci/pcireg.h | 38 +-
4 files changed, 5169 insertions(+), 2659 deletions(-)
diffs (truncated from 9892 to 300 lines):
diff -r bdfad77299be -r b2cae731232b sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c Thu Sep 10 22:27:11 2009 +0000
+++ b/sys/dev/pci/if_iwn.c Fri Sep 11 01:28:20 2009 +0000
@@ -1,7 +1,8 @@
-/* $NetBSD: if_iwn.c,v 1.32 2009/09/05 14:09:55 tsutsui Exp $ */
+/* $NetBSD: if_iwn.c,v 1.33 2009/09/11 01:28:20 christos Exp $ */
+/* $OpenBSD: if_iwn.c,v 1.49 2009/03/29 21:53:52 sthen Exp $ */
/*-
- * Copyright (c) 2007
+ * Copyright (c) 2007, 2008
* Damien Bergamini <damien.bergamini%free.fr@localhost>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -17,13 +18,12 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+/*
+ * Driver for Intel Wireless WiFi Link 4965 and Intel WiFi Link 5000 Series
+ * 802.11 network adapters.
+ */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.32 2009/09/05 14:09:55 tsutsui Exp $");
-
-
-/*
- * Driver for Intel Wireless WiFi Link 4965AGN 802.11 network adapters.
- */
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.33 2009/09/11 01:28:20 christos Exp $");
#include "bpfilter.h"
@@ -72,12 +72,42 @@
#include <dev/pci/if_iwnreg.h>
#include <dev/pci/if_iwnvar.h>
-#if 0
-static const struct pci_matchid iwn_devices[] = {
- { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_WL_4965AGN_1 },
- { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_WL_4965AGN_2 }
+static const pci_product_id_t iwn_devices[] = {
+ PCI_PRODUCT_INTEL_PRO_WL_4965AGN_1,
+ PCI_PRODUCT_INTEL_PRO_WL_4965AGN_2,
+ PCI_PRODUCT_INTEL_PRO_WL_5100AGN_1,
+ PCI_PRODUCT_INTEL_PRO_WL_5100AGN_2,
+#ifdef notyet
+ PCI_PRODUCT_INTEL_PRO_WL_5150AGN_1,
+ PCI_PRODUCT_INTEL_PRO_WL_5150AGN_2,
+#endif
+ PCI_PRODUCT_INTEL_PRO_WL_5300AGN_1,
+ PCI_PRODUCT_INTEL_PRO_WL_5300AGN_2,
+ PCI_PRODUCT_INTEL_PRO_WL_5350AGN_1,
+ PCI_PRODUCT_INTEL_PRO_WL_5350AGN_2,
+#ifdef notyet
+ PCI_PRODUCT_INTEL_WIFI_LINK_4965_1,
+ PCI_PRODUCT_INTEL_WIFI_LINK_4965_2,
+ PCI_PRODUCT_INTEL_WIFI_LINK_5100_1,
+ PCI_PRODUCT_INTEL_WIFI_LINK_5100_2,
+ PCI_PRODUCT_INTEL_WIFI_LINK_5150_1,
+ PCI_PRODUCT_INTEL_WIFI_LINK_5150_2,
+ PCI_PRODUCT_INTEL_WIFI_LINK_5300_1,
+ PCI_PRODUCT_INTEL_WIFI_LINK_5300_2,
+ PCI_PRODUCT_INTEL_WIFI_LINK_5350_1,
+ PCI_PRODUCT_INTEL_WIFI_LINK_5350_2,
+ PCI_PRODUCT_INTEL_WIFI_LINK_6000_1,
+ PCI_PRODUCT_INTEL_WIFI_LINK_6000_2,
+ PCI_PRODUCT_INTEL_WIFI_LINK_6000_3,
+ PCI_PRODUCT_INTEL_WIFI_LINK_6000_4,
+ PCI_PRODUCT_INTEL_WIFI_LINK_6050_1,
+ PCI_PRODUCT_INTEL_WIFI_LINK_6050_2,
+ PCI_PRODUCT_INTEL_WIFI_LINK_6050_3,
+ PCI_PRODUCT_INTEL_WIFI_LINK_6050_4,
+ PCI_PRODUCT_INTEL_WIFI_LINK_1000_1,
+ PCI_PRODUCT_INTEL_WIFI_LINK_1000_2,
+#endif
};
-#endif
/*
* Supported rates for 802.11a/b/g modes (in 500Kbps unit).
@@ -86,109 +116,166 @@
{ 8, { 12, 18, 24, 36, 48, 72, 96, 108 } };
static const struct ieee80211_rateset iwn_rateset_11b =
- { 4, { 2, 4, 11, 22 } };
+ { 4, { 2, 4, 11, 22 } };
static const struct ieee80211_rateset iwn_rateset_11g =
- { 12, { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 } };
-
-
-#define EDCA_NUM_AC 4
-static int iwn_match(device_t , cfdata_t, void *);
-static void iwn_attach(device_t , device_t, void *);
-static int iwn_detach(device_t, int);
-
-static void iwn_radiotap_attach(struct iwn_softc *);
-static int iwn_dma_contig_alloc(bus_dma_tag_t, struct iwn_dma_info *,
- void **, bus_size_t, bus_size_t, int);
-static void iwn_dma_contig_free(struct iwn_dma_info *);
-static int iwn_alloc_shared(struct iwn_softc *);
-static void iwn_free_shared(struct iwn_softc *);
-static int iwn_alloc_kw(struct iwn_softc *);
-static void iwn_free_kw(struct iwn_softc *);
-static int iwn_alloc_fwmem(struct iwn_softc *);
-static void iwn_free_fwmem(struct iwn_softc *);
-static struct iwn_rbuf *iwn_alloc_rbuf(struct iwn_softc *);
-static void iwn_free_rbuf(struct mbuf *, void *, size_t, void *);
-static int iwn_alloc_rpool(struct iwn_softc *);
-static void iwn_free_rpool(struct iwn_softc *);
-static int iwn_alloc_rx_ring(struct iwn_softc *, struct iwn_rx_ring *);
-static void iwn_reset_rx_ring(struct iwn_softc *, struct iwn_rx_ring *);
-static void iwn_free_rx_ring(struct iwn_softc *, struct iwn_rx_ring *);
-static int iwn_alloc_tx_ring(struct iwn_softc *, struct iwn_tx_ring *,
- int, int);
-static void iwn_reset_tx_ring(struct iwn_softc *, struct iwn_tx_ring *);
-static void iwn_free_tx_ring(struct iwn_softc *, struct iwn_tx_ring *);
-static struct ieee80211_node *iwn_node_alloc(struct ieee80211_node_table *);
-static void iwn_newassoc(struct ieee80211_node *, int);
-static int iwn_media_change(struct ifnet *);
-static int iwn_newstate(struct ieee80211com *, enum ieee80211_state, int);
-static void iwn_mem_lock(struct iwn_softc *);
-static void iwn_mem_unlock(struct iwn_softc *);
-static uint32_t iwn_mem_read(struct iwn_softc *, uint32_t);
-static void iwn_mem_write(struct iwn_softc *, uint32_t, uint32_t);
-static void iwn_mem_write_region_4(struct iwn_softc *, uint32_t,
- const uint32_t *, int);
-static int iwn_eeprom_lock(struct iwn_softc *);
-static void iwn_eeprom_unlock(struct iwn_softc *);
-static int iwn_read_prom_data(struct iwn_softc *, uint32_t, void *, int);
-static int iwn_load_microcode(struct iwn_softc *, const uint8_t *, int);
-static int iwn_load_firmware(struct iwn_softc *);
-static void iwn_calib_timeout(void *);
-static void iwn_iter_func(void *, struct ieee80211_node *);
-static void iwn_ampdu_rx_start(struct iwn_softc *, struct iwn_rx_desc *);
-static void iwn_rx_intr(struct iwn_softc *, struct iwn_rx_desc *,
+ { 12, { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 } };
+
+
+static int iwn_match(device_t , struct cfdata *, void *);
+static void iwn_attach(device_t , device_t, void *);
+static int iwn_detach(device_t, int);
+
+const struct iwn_hal *iwn_hal_attach(struct iwn_softc *);
+static int iwn_nic_lock(struct iwn_softc *);
+static int iwn_eeprom_lock(struct iwn_softc *);
+static int iwn_read_prom_data(struct iwn_softc *, uint32_t, void *, int);
+static void iwn_radiotap_attach(struct iwn_softc *);
+static int iwn_dma_contig_alloc(bus_dma_tag_t, struct iwn_dma_info *,
+ void **, bus_size_t, bus_size_t, int);
+static void iwn_dma_contig_free(struct iwn_dma_info *);
+static int iwn_alloc_sched(struct iwn_softc *);
+static void iwn_free_sched(struct iwn_softc *);
+static int iwn_alloc_kw(struct iwn_softc *);
+static void iwn_free_kw(struct iwn_softc *);
+static int iwn_alloc_fwmem(struct iwn_softc *);
+static void iwn_free_fwmem(struct iwn_softc *);
+static struct iwn_rbuf *iwn_alloc_rbuf(struct iwn_softc *);
+static void iwn_free_rbuf(struct mbuf *, void *, size_t, void *);
+static int iwn_alloc_rpool(struct iwn_softc *);
+static void iwn_free_rpool(struct iwn_softc *);
+static int iwn_alloc_rx_ring(struct iwn_softc *, struct iwn_rx_ring *);
+static void iwn_reset_rx_ring(struct iwn_softc *, struct iwn_rx_ring *);
+static void iwn_free_rx_ring(struct iwn_softc *, struct iwn_rx_ring *);
+static int iwn_alloc_tx_ring(struct iwn_softc *, struct iwn_tx_ring *,
+ int, int);
+static void iwn_reset_tx_ring(struct iwn_softc *, struct iwn_tx_ring *);
+static void iwn_free_tx_ring(struct iwn_softc *, struct iwn_tx_ring *);
+static int iwn_read_eeprom(struct iwn_softc *);
+static void iwn4965_read_eeprom(struct iwn_softc *);
+static void iwn5000_read_eeprom(struct iwn_softc *);
+static void iwn_read_eeprom_channels(struct iwn_softc *, int, uint32_t);
+static struct ieee80211_node *iwn_node_alloc(struct ieee80211_node_table *);
+static void iwn_newassoc(struct ieee80211_node *, int);
+static int iwn_media_change(struct ifnet *);
+static int iwn_newstate(struct ieee80211com *, enum ieee80211_state, int);
+static void iwn_iter_func(void *, struct ieee80211_node *);
+static void iwn_calib_timeout(void *);
+#if 0
+static int iwn_ccmp_decap(struct iwn_softc *, struct mbuf *,
+ struct ieee80211_key *);
+#endif
+static void iwn_rx_phy(struct iwn_softc *, struct iwn_rx_desc *);
+static void iwn_rx_done(struct iwn_softc *, struct iwn_rx_desc *,
+ struct iwn_rx_data *);
+static void iwn5000_rx_calib_results(struct iwn_softc *,
+ struct iwn_rx_desc *, struct iwn_rx_data *);
+static void iwn_rx_statistics(struct iwn_softc *, struct iwn_rx_desc *,
+ struct iwn_rx_data *);
+static void iwn4965_tx_done(struct iwn_softc *, struct iwn_rx_desc *,
+ struct iwn_rx_data *);
+static void iwn5000_tx_done(struct iwn_softc *, struct iwn_rx_desc *,
struct iwn_rx_data *);
-static void iwn_rx_statistics(struct iwn_softc *, struct iwn_rx_desc *);
-static void iwn_tx_intr(struct iwn_softc *, struct iwn_rx_desc *);
-static void iwn_cmd_intr(struct iwn_softc *, struct iwn_rx_desc *);
-static void iwn_notif_intr(struct iwn_softc *);
-static int iwn_intr(void *);
-static void iwn_read_eeprom(struct iwn_softc *);
-static void iwn_read_eeprom_channels(struct iwn_softc *, int);
-static uint8_t iwn_plcp_signal(int);
-static int iwn_tx_data(struct iwn_softc *, struct mbuf *,
- struct ieee80211_node *, int);
-static void iwn_start(struct ifnet *);
-static void iwn_watchdog(struct ifnet *);
-static int iwn_ioctl(struct ifnet *, u_long, void *);
-static int iwn_cmd(struct iwn_softc *, int, const void *, int, int);
-static int iwn_wme_update(struct ieee80211com *);
-static int iwn_setup_node_mrr(struct iwn_softc *, uint8_t, int);
-static void iwn_set_led(struct iwn_softc *, uint8_t, uint8_t, uint8_t);
-static int iwn_set_critical_temp(struct iwn_softc *);
-static void iwn_enable_tsf(struct iwn_softc *, struct ieee80211_node *);
-static void iwn_power_calibration(struct iwn_softc *, int);
-static int iwn_set_txpower(struct iwn_softc *,
- struct ieee80211_channel *, int);
-static int iwn_get_rssi(const struct iwn_rx_stat *);
-static int iwn_get_noise(const struct iwn_rx_general_stats *);
-static int iwn_get_temperature(struct iwn_softc *);
-static int iwn_init_sensitivity(struct iwn_softc *);
-static void iwn_compute_differential_gain(struct iwn_softc *,
- const struct iwn_rx_general_stats *);
-static void iwn_tune_sensitivity(struct iwn_softc *,
- const struct iwn_rx_stats *);
-static int iwn_send_sensitivity(struct iwn_softc *);
-static int iwn_setup_beacon(struct iwn_softc *, struct ieee80211_node *);
-static int iwn_auth(struct iwn_softc *);
-static int iwn_run(struct iwn_softc *);
-static int iwn_scan(struct iwn_softc *, uint16_t);
-static int iwn_config(struct iwn_softc *);
-static void iwn_post_alive(struct iwn_softc *);
-static void iwn_stop_master(struct iwn_softc *);
-static int iwn_reset(struct iwn_softc *);
-static void iwn_hw_config(struct iwn_softc *);
-static int iwn_init(struct ifnet *);
-static void iwn_stop(struct ifnet *, int);
-static void iwn_fix_channel(struct ieee80211com *, struct mbuf *);
-static bool iwn_resume(device_t PMF_FN_PROTO);
-static int iwn_add_node(struct iwn_softc *sc,
- struct ieee80211_node *ni, bool broadcast, bool async, uint32_t htflags);
-
-
+static void iwn_tx_done(struct iwn_softc *, struct iwn_rx_desc *, int,
+ uint8_t);
+static void iwn_cmd_done(struct iwn_softc *, struct iwn_rx_desc *);
+static void iwn_notif_intr(struct iwn_softc *);
+static void iwn_wakeup_intr(struct iwn_softc *);
+static void iwn_fatal_intr(struct iwn_softc *);
+static int iwn_intr(void *);
+static void iwn4965_update_sched(struct iwn_softc *, int, int, uint8_t,
+ uint16_t);
+static void iwn5000_update_sched(struct iwn_softc *, int, int, uint8_t,
+ uint16_t);
+static void iwn5000_reset_sched(struct iwn_softc *, int, int);
+static int iwn_tx(struct iwn_softc *, struct mbuf *,
+ struct ieee80211_node *, int);
+static void iwn_start(struct ifnet *);
+static void iwn_watchdog(struct ifnet *);
+static int iwn_ioctl(struct ifnet *, u_long, void *);
+static int iwn_cmd(struct iwn_softc *, int, const void *, int, int);
+static int iwn_wme_update(struct ieee80211com *);
+static int iwn4965_add_node(struct iwn_softc *, struct iwn_node_info *,
+ int);
+static int iwn5000_add_node(struct iwn_softc *, struct iwn_node_info *,
+ int);
+static int iwn_set_link_quality(struct iwn_softc *,
+ struct ieee80211_node *);
+static int iwn_add_broadcast_node(struct iwn_softc *, int);
+static void iwn_set_led(struct iwn_softc *, uint8_t, uint8_t, uint8_t);
+static int iwn_set_critical_temp(struct iwn_softc *);
+static int iwn_set_timing(struct iwn_softc *, struct ieee80211_node *);
+//static void iwn4965_power_calibration(struct iwn_softc *, int);
+static int iwn4965_set_txpower(struct iwn_softc *, int);
+static int iwn5000_set_txpower(struct iwn_softc *, int);
+static int iwn4965_get_rssi(const struct iwn_rx_stat *);
+static int iwn5000_get_rssi(const struct iwn_rx_stat *);
+static int iwn_get_noise(const struct iwn_rx_general_stats *);
+static int iwn4965_get_temperature(struct iwn_softc *);
+static int iwn5000_get_temperature(struct iwn_softc *);
+static int iwn_init_sensitivity(struct iwn_softc *);
+static void iwn_collect_noise(struct iwn_softc *,
+ const struct iwn_rx_general_stats *);
+static int iwn4965_init_gains(struct iwn_softc *);
+static int iwn5000_init_gains(struct iwn_softc *);
+static int iwn4965_set_gains(struct iwn_softc *);
+static int iwn5000_set_gains(struct iwn_softc *);
+static void iwn_tune_sensitivity(struct iwn_softc *,
+ const struct iwn_rx_stats *);
+static int iwn_send_sensitivity(struct iwn_softc *);
+// XXX static int iwn_set_pslevel(struct iwn_softc *, int, int, int);
+static int iwn_config(struct iwn_softc *);
+static int iwn_scan(struct iwn_softc *, uint16_t);
+static int iwn_auth(struct iwn_softc *);
+static int iwn_run(struct iwn_softc *);
+#ifdef notyet
+static void iwn_delete_key(struct ieee80211com *, struct ieee80211_node *,
+ struct ieee80211_key *);
+#endif
+#ifndef IEEE80211_NO_HT
+static int iwn_ampdu_rx_start(struct ieee80211com *,
Home |
Main Index |
Thread Index |
Old Index