Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Update with newer version from Sverre Froyen



details:   https://anonhg.NetBSD.org/src/rev/45640feeb539
branches:  trunk
changeset: 754002:45640feeb539
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Apr 16 01:40:41 2010 +0000

description:
Update with newer version from Sverre Froyen

diffstat:

 sys/dev/pci/if_iwn.c    |  3179 +++++++++++++++++++++++++++-------------------
 sys/dev/pci/if_iwnreg.h |   348 +++-
 sys/dev/pci/if_iwnvar.h |    50 +-
 3 files changed, 2093 insertions(+), 1484 deletions(-)

diffs (truncated from 6127 to 300 lines):

diff -r 30bb4c3ddf46 -r 45640feeb539 sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c      Thu Apr 15 22:55:15 2010 +0000
+++ b/sys/dev/pci/if_iwn.c      Fri Apr 16 01:40:41 2010 +0000
@@ -1,9 +1,8 @@
-/*     $NetBSD: if_iwn.c,v 1.39 2010/04/11 02:02:14 mrg Exp $  */
-/*     $OpenBSD: if_iwn.c,v 1.49 2009/03/29 21:53:52 sthen Exp $       */
+/*     $NetBSD: if_iwn.c,v 1.40 2010/04/16 01:40:41 christos Exp $     */
+/*     $OpenBSD: if_iwn.c,v 1.88 2010/04/10 08:37:36 damien Exp $      */
 
 /*-
- * Copyright (c) 2007, 2008
- *     Damien Bergamini <damien.bergamini%free.fr@localhost>
+ * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini%free.fr@localhost>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -19,12 +18,17 @@
  */
 
 /*
- * Driver for Intel Wireless WiFi Link 4965 and Intel WiFi Link 5000 Series
- * 802.11 network adapters.
+ * Driver for Intel WiFi Link 4965 and 1000/5000/6000 Series 802.11 network
+ * adapters.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.39 2010/04/11 02:02:14 mrg Exp $");
-
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.40 2010/04/16 01:40:41 christos Exp $");
+
+#define IWN_USE_RBUF   /* Use local storage for RX */
+#undef IWN_HWCRYPTO    /* XXX does not even compile yet */
+
+/* XXX Avoid sensor code (correct option for NetBSD too?) */
+#undef SMALL_KERNEL
 
 #include <sys/param.h>
 #include <sys/sockio.h>
@@ -39,6 +43,8 @@
 #include <sys/kauth.h>
 #include <sys/callout.h>
 
+#include <dev/sysmon/sysmonvar.h>
+
 #include <machine/bus.h>
 #include <machine/endian.h>
 #include <machine/intr.h>
@@ -70,19 +76,17 @@
 #include <dev/pci/if_iwnvar.h>
 
 static const pci_product_id_t iwn_devices[] = {
+/* XXX From old NetBSD iwn driver (used by pcidevs) */
        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
+#if 0
+/* XXX From new OpenBSD iwn driver (not in pcidevs) */
        PCI_PRODUCT_INTEL_WIFI_LINK_4965_1,
        PCI_PRODUCT_INTEL_WIFI_LINK_4965_2,
        PCI_PRODUCT_INTEL_WIFI_LINK_5100_1,
@@ -93,16 +97,16 @@
        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,
+       PCI_PRODUCT_INTEL_WIFI_LINK_6000_3X3_1,
+       PCI_PRODUCT_INTEL_WIFI_LINK_6000_3X3_2,
+       PCI_PRODUCT_INTEL_WIFI_LINK_6000_IPA_1,
+       PCI_PRODUCT_INTEL_WIFI_LINK_6000_IPA_2,
+       PCI_PRODUCT_INTEL_WIFI_LINK_6050_2X2_1,
+       PCI_PRODUCT_INTEL_WIFI_LINK_6050_2X2_2,
+       PCI_PRODUCT_INTEL_WIFI_LINK_6005_2X2_1,
+       PCI_PRODUCT_INTEL_WIFI_LINK_6005_2X2_2,
 #endif
 };
 
@@ -118,61 +122,71 @@
 static const struct ieee80211_rateset iwn_rateset_11g =
        { 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_match(device_t , struct cfdata *, void *);
+static void    iwn_attach(device_t , device_t , void *);
+const struct   iwn_hal *iwn_hal_attach(struct iwn_softc *, pci_product_id_t pid);
+#ifndef SMALL_KERNEL
+static void    iwn_sensor_attach(struct iwn_softc *);
+#endif
+static void    iwn_radiotap_attach(struct iwn_softc *);
+static int     iwn_detach(device_t , int);
+#if 0
+static void    iwn_power(int, void *);
+#endif
+static bool    iwn_resume(device_t, const pmf_qual_t *);
 static int     iwn_nic_lock(struct iwn_softc *);
 static int     iwn_eeprom_lock(struct iwn_softc *);
+static int     iwn_init_otprom(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);
+                   void **, bus_size_t, bus_size_t);
 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_ict(struct iwn_softc *);
+static void    iwn_free_ict(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);
+                   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 void    iwn5000_ict_reset(struct iwn_softc *);
 static int     iwn_read_eeprom(struct iwn_softc *);
 static void    iwn4965_read_eeprom(struct iwn_softc *);
+#ifdef IWN_DEBUG
+static void    iwn4965_print_power_group(struct iwn_softc *, int);
+#endif
 static void    iwn5000_read_eeprom(struct iwn_softc *);
 static void    iwn_read_eeprom_channels(struct iwn_softc *, int, uint32_t);
+static void    iwn_read_eeprom_enhinfo(struct iwn_softc *);
 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_phy(struct iwn_softc *, struct iwn_rx_desc *,
+                   struct iwn_rx_data *);
 static void    iwn_rx_done(struct iwn_softc *, struct iwn_rx_desc *,
                    struct iwn_rx_data *);
+#ifndef IEEE80211_NO_HT
+static void    iwn_rx_compressed_ba(struct iwn_softc *, struct iwn_rx_desc *,
+                   struct iwn_rx_data *);
+#endif
 static void    iwn5000_rx_calib_results(struct iwn_softc *,
-    struct iwn_rx_desc *, struct iwn_rx_data *);
+                   struct iwn_rx_desc *, struct iwn_rx_data *);
 static void    iwn_rx_statistics(struct iwn_softc *, struct iwn_rx_desc *,
-    struct iwn_rx_data *);
+                   struct iwn_rx_data *);
 static void    iwn4965_tx_done(struct iwn_softc *, struct iwn_rx_desc *,
-    struct iwn_rx_data *);
+                   struct iwn_rx_data *);
 static void    iwn5000_tx_done(struct iwn_softc *, struct iwn_rx_desc *,
-    struct iwn_rx_data *);
+                   struct iwn_rx_data *);
 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 *);
@@ -184,14 +198,15 @@
                    uint16_t);
 static void    iwn5000_update_sched(struct iwn_softc *, int, int, uint8_t,
                    uint16_t);
+#ifdef notyet
 static void    iwn5000_reset_sched(struct iwn_softc *, int, int);
+#endif
 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 *,
@@ -202,7 +217,7 @@
 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 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 *);
@@ -220,24 +235,27 @@
 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_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
+#ifdef IWN_HWCRYPTO
+static int     iwn_set_key(struct ieee80211com *, struct ieee80211_node *,
+                   struct ieee80211_key *);
 static void    iwn_delete_key(struct ieee80211com *, struct ieee80211_node *,
                    struct ieee80211_key *);
 #endif
+static int     iwn_wme_update(struct ieee80211com *);
 #ifndef IEEE80211_NO_HT
 static int     iwn_ampdu_rx_start(struct ieee80211com *,
-                   struct ieee80211_node *, uint8_t, uint16_t);
+                   struct ieee80211_node *, uint8_t);
 static void    iwn_ampdu_rx_stop(struct ieee80211com *,
-                   struct ieee80211_node *, uint8_t, uint16_t);
+                   struct ieee80211_node *, uint8_t);
 static int     iwn_ampdu_tx_start(struct ieee80211com *,
-                   struct ieee80211_node *, uint8_t, uint16_t);
+                   struct ieee80211_node *, uint8_t);
 static void    iwn_ampdu_tx_stop(struct ieee80211com *,
-                   struct ieee80211_node *, uint8_t, uint16_t);
+                   struct ieee80211_node *, uint8_t);
 static void    iwn4965_ampdu_tx_start(struct iwn_softc *,
                    struct ieee80211_node *, uint8_t, uint16_t);
 static void    iwn4965_ampdu_tx_stop(struct iwn_softc *,
@@ -249,6 +267,7 @@
 #endif
 static int     iwn5000_query_calibration(struct iwn_softc *);
 static int     iwn5000_send_calibration(struct iwn_softc *);
+static int     iwn5000_send_wimax_coex(struct iwn_softc *);
 static int     iwn4965_post_alive(struct iwn_softc *);
 static int     iwn5000_post_alive(struct iwn_softc *);
 static int     iwn4965_load_bootcode(struct iwn_softc *, const uint8_t *,
@@ -259,20 +278,36 @@
 static int     iwn5000_load_firmware(struct iwn_softc *);
 static int     iwn_read_firmware(struct iwn_softc *);
 static int     iwn_clock_wait(struct iwn_softc *);
-static int     iwn4965_apm_init(struct iwn_softc *);
-static int     iwn5000_apm_init(struct iwn_softc *);
+static int     iwn_apm_init(struct iwn_softc *);
 static void    iwn_apm_stop_master(struct iwn_softc *);
 static void    iwn_apm_stop(struct iwn_softc *);
 static int     iwn4965_nic_config(struct iwn_softc *);
 static int     iwn5000_nic_config(struct iwn_softc *);
+static int     iwn_hw_prepare(struct iwn_softc *);
 static int     iwn_hw_init(struct iwn_softc *);
 static void    iwn_hw_stop(struct iwn_softc *);
 static int     iwn_init(struct ifnet *);
 static void    iwn_stop(struct ifnet *, int);
+
+/* XXX MCLGETI alternative */
+static struct  mbuf *MCLGETIalt(struct iwn_softc *, int,
+                   struct ifnet *, u_int);
+#ifdef IWN_USE_RBUF
+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 *);
+#endif
+
+/* XXX needed by iwn_scan */
+static u_int8_t        *ieee80211_add_ssid(u_int8_t *, const u_int8_t *, u_int);
+static u_int8_t        *ieee80211_add_rates(u_int8_t *,
+    const struct ieee80211_rateset *);
+static u_int8_t        *ieee80211_add_xrates(u_int8_t *,
+    const struct ieee80211_rateset *);
+
 static void    iwn_fix_channel(struct ieee80211com *, struct mbuf *);
-static bool    iwn_resume(device_t, const pmf_qual_t *);
-
-#define IWN_DEBUG
+
 #ifdef IWN_DEBUG
 #define DPRINTF(x)     do { if (iwn_debug > 0) printf x; } while (0)
 #define DPRINTFN(n, x) do { if (iwn_debug >= (n)) printf x; } while (0)
@@ -281,15 +316,11 @@



Home | Main Index | Thread Index | Old Index